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) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Copyright (C) 2002  David McCullough <davidm@snapgear.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Copyright (C) 2003  Paul Mundt <lethal@linux-sh.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Based on files with the following comments:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  *           Copyright (C) 2000  Kazumoto Kojima
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  *           Modified for 7751 Solution Engine by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  *           Ian da Silva and Jeremy Siegel, 2001.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/timer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <asm/machvec.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <mach/secureedge5410.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <asm/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <asm/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <cpu/timer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) unsigned short secureedge5410_ioport;
^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)  * EraseConfig handling functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	printk("SnapGear: erase switch interrupt!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) static int __init eraseconfig_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	unsigned int irq = evt2irq(0x240);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	printk("SnapGear: EraseConfig init\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	/* Setup "EraseConfig" switch on external IRQ 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	if (request_irq(irq, eraseconfig_interrupt, 0, "Erase Config", NULL))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 		printk("SnapGear: failed to register IRQ%d for Reset witch\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 				irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 		printk("SnapGear: registered EraseConfig switch on IRQ%d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 				irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) device_initcall(eraseconfig_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)  * Initialize IRQ setting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)  * IRL0 = erase switch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)  * IRL1 = eth0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)  * IRL2 = eth1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)  * IRL3 = crypto
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) static void __init init_snapgear_IRQ(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	printk("Setup SnapGear IRQ/IPR ...\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	/* enable individual interrupt mode for externals */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 	plat_irq_setup_pins(IRQ_MODE_IRQ);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)  * The Machine Vector
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) static struct sh_machine_vector mv_snapgear __initmv = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	.mv_name		= "SnapGear SecureEdge5410",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 	.mv_init_irq		= init_snapgear_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) };