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)  * ip22-setup.c: SGI specific setup, including init of the feature struct.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Copyright (C) 1997, 1998 Ralf Baechle (ralf@gnu.org)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/kdev_t.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/console.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/tty.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <asm/addrspace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <asm/bcache.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <asm/bootinfo.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <asm/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <asm/reboot.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <asm/time.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 <asm/traps.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <asm/sgialib.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <asm/sgi/mc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <asm/sgi/hpc3.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include <asm/sgi/ip22.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) extern void ip22_be_init(void) __init;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) void __init plat_mem_setup(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	char *ctype;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	char *cserial;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	board_be_init = ip22_be_init;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	/* Init the INDY HPC I/O controller.  Need to call this before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	 * fucking with the memory controller because it needs to know the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	 * boardID and whether this is a Guiness or a FullHouse machine.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	sgihpc_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	/* Init INDY memory controller. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	sgimc_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #ifdef CONFIG_BOARD_SCACHE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	/* Now enable boardcaches, if any. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	indy_sc_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	/* Set EISA IO port base for Indigo2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	 * ioremap cannot fail */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	set_io_port_base((unsigned long)ioremap(0x00080000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 						0x1fffffff - 0x00080000));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	/* ARCS console environment variable is set to "g?" for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	 * graphics console, it is set to "d" for the first serial
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	 * line and "d2" for the second serial line.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	 * Need to check if the case is 'g' but no keyboard:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	 * (ConsoleIn/Out = serial)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	ctype = ArcGetEnvironmentVariable("console");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	cserial = ArcGetEnvironmentVariable("ConsoleOut");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 	if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 		static char options[8] __initdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 		char *baud = ArcGetEnvironmentVariable("dbaud");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 		if (baud)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 			strcpy(options, baud);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 		add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 				      baud ? options : NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	} else if (!ctype || *ctype != 'g') {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 		/* Use ARC if we don't want serial ('d') or graphics ('g'). */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 		prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 		add_preferred_console("arc", 0, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) }