Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1)  /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * linux/arch/m68k/sun3/sun3ints.c -- Sun-3(x) Linux interrupt handling code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * License.  See the file COPYING in the main directory of this archive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/kernel_stat.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <asm/segment.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <asm/intersil.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <asm/oplib.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <asm/sun3ints.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <asm/irq_regs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/seq_file.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) extern void sun3_leds (unsigned char);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) void sun3_disable_interrupts(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	sun3_disable_irq(0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) void sun3_enable_interrupts(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	sun3_enable_irq(0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) static int led_pattern[8] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)        ~(0x80), ~(0x01),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)        ~(0x40), ~(0x02),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)        ~(0x20), ~(0x04),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)        ~(0x10), ~(0x08)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) volatile unsigned char* sun3_intreg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) void sun3_enable_irq(unsigned int irq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	*sun3_intreg |=  (1 << irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) void sun3_disable_irq(unsigned int irq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	*sun3_intreg &= ~(1 << irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) static irqreturn_t sun3_int7(int irq, void *dev_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	unsigned int cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	cnt = kstat_irqs_cpu(irq, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	if (!(cnt % 2000))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 		sun3_leds(led_pattern[cnt % 16000 / 2000]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) static irqreturn_t sun3_int5(int irq, void *dev_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	unsigned int cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	local_irq_save(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) #ifdef CONFIG_SUN3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	intersil_clear();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	sun3_disable_irq(5);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	sun3_enable_irq(5);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) #ifdef CONFIG_SUN3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	intersil_clear();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	xtime_update(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	update_process_times(user_mode(get_irq_regs()));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	cnt = kstat_irqs_cpu(irq, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	if (!(cnt % 20))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		sun3_leds(led_pattern[cnt % 160 / 20]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	local_irq_restore(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) static irqreturn_t sun3_vec255(int irq, void *dev_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) void __init sun3_init_IRQ(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	*sun3_intreg = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	m68k_setup_user_interrupt(VEC_USER, 128);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	if (request_irq(IRQ_AUTO_5, sun3_int5, 0, "clock", NULL))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		pr_err("Couldn't register %s interrupt\n", "int5");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	if (request_irq(IRQ_AUTO_7, sun3_int7, 0, "nmi", NULL))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		pr_err("Couldn't register %s interrupt\n", "int7");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	if (request_irq(IRQ_USER+127, sun3_vec255, 0, "vec255", NULL))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		pr_err("Couldn't register %s interrupt\n", "vec255");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) }