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)  *  linux/arch/mips/sni/process.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *  Reset a SNI machine.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <asm/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <asm/reboot.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <asm/sni.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  * This routine reboots the machine by asking the keyboard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  * controller to pulse the reset-line low. We try that for a while,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)  * and if it doesn't work, we do some other stupid things.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) static inline void kb_wait(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	for (i = 0; i < 0x10000; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 		if ((inb_p(0x64) & 0x02) == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) /* XXX This ends up at the ARC firmware prompt ...  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) void sni_machine_restart(char *command)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	/* This does a normal via the keyboard controller like a PC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	   We can do that easier ...  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	local_irq_disable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	for (;;) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 		for (i = 0; i < 100; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 			kb_wait();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 			udelay(50);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 			outb_p(0xfe, 0x64);	 /* pulse reset low */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 			udelay(50);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) void sni_machine_power_off(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	*(volatile unsigned char *)PCIMT_CSWCSM = 0xfd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }