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-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *  linux/arch/arm/mach-ep93xx/micro9.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 2006 Contec Steuerungstechnik & Automation GmbH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *                    Manfred Gruber <m.gruber@tirol.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Copyright (C) 2009 Contec Steuerungstechnik & Automation GmbH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *                    Hubert Feurstein <hubert.feurstein@contec.at>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include "hardware.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include "soc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) /*************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * Micro9 NOR Flash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * Micro9-High has up to 64MB of 32-bit flash on CS1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * Micro9-Mid has up to 64MB of either 32-bit or 16-bit flash on CS1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * Micro9-Lite uses a separate MTD map driver for flash support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  *************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) static unsigned int __init micro9_detect_bootwidth(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	u32 v;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	/* Detect the bus width of the external flash memory */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	v = __raw_readl(EP93XX_SYSCON_SYSCFG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	if (v & EP93XX_SYSCON_SYSCFG_LCSN7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 		return 4; /* 32-bit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 		return 2; /* 16-bit */
^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) static void __init micro9_register_flash(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	unsigned int width;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	if (machine_is_micro9())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 		width = 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	else if (machine_is_micro9m() || machine_is_micro9s())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 		width = micro9_detect_bootwidth();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		width = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	if (width)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		ep93xx_register_flash(width, EP93XX_CS1_PHYS_BASE, SZ_64M);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) /*************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  * Micro9 Ethernet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  *************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) static struct ep93xx_eth_data __initdata micro9_eth_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	.phy_id		= 0x1f,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) static void __init micro9_init_machine(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	ep93xx_init_devices();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	ep93xx_register_eth(&micro9_eth_data, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	micro9_register_flash();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) #ifdef CONFIG_MACH_MICRO9H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) MACHINE_START(MICRO9, "Contec Micro9-High")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	/* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	.atag_offset	= 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	.map_io		= ep93xx_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	.init_irq	= ep93xx_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	.init_time	= ep93xx_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	.init_machine	= micro9_init_machine,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	.init_late	= ep93xx_init_late,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	.restart	= ep93xx_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) MACHINE_END
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) #ifdef CONFIG_MACH_MICRO9M
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) MACHINE_START(MICRO9M, "Contec Micro9-Mid")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	/* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	.atag_offset	= 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	.map_io		= ep93xx_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	.init_irq	= ep93xx_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	.init_time	= ep93xx_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	.init_machine	= micro9_init_machine,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	.init_late	= ep93xx_init_late,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	.restart	= ep93xx_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) MACHINE_END
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #ifdef CONFIG_MACH_MICRO9L
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) MACHINE_START(MICRO9L, "Contec Micro9-Lite")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	/* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	.atag_offset	= 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	.map_io		= ep93xx_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	.init_irq	= ep93xx_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	.init_time	= ep93xx_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	.init_machine	= micro9_init_machine,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	.init_late	= ep93xx_init_late,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	.restart	= ep93xx_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) MACHINE_END
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) #ifdef CONFIG_MACH_MICRO9S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) MACHINE_START(MICRO9S, "Contec Micro9-Slim")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	/* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	.atag_offset	= 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	.map_io		= ep93xx_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	.init_irq	= ep93xx_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	.init_time	= ep93xx_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	.init_machine	= micro9_init_machine,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	.init_late	= ep93xx_init_late,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	.restart	= ep93xx_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) MACHINE_END
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) #endif