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) 2009 Yauhen Kharuzhy <jekhor@gmail.com>,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) //	as part of OpenInkpot project
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) // Copyright (c) 2009 Promwad Innovation Company
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) //	Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) // Samsung S3C2416 Mobile CPU support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^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/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/timer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/serial_core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/syscore_ops.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/clk.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <linux/reboot.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <asm/mach/map.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <asm/mach/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include "map.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include "gpio-samsung.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <asm/proc-fns.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include <asm/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include <asm/system_misc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #include "regs-s3c2443-clock.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #include "rtc-core-s3c24xx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #include "gpio-core.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #include "gpio-cfg.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #include "gpio-cfg-helpers.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #include "devs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #include "cpu.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #include "sdhci.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #include "pm.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #include "iic-core.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #include "adc-core.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #include "s3c24xx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #include "fb-core-s3c24xx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #include "nand-core-s3c24xx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #include "spi-core-s3c24xx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) static struct map_desc s3c2416_iodesc[] __initdata __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	IODESC_ENT(WATCHDOG),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	IODESC_ENT(CLKPWR),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	IODESC_ENT(TIMER),
^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) struct bus_type s3c2416_subsys = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	.name = "s3c2416-core",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	.dev_name = "s3c2416-core",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) static struct device s3c2416_dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	.bus		= &s3c2416_subsys,
^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) int __init s3c2416_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	printk(KERN_INFO "S3C2416: Initializing architecture\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	/* change WDT IRQ number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	s3c_device_wdt.resource[1].end   = IRQ_S3C2443_WDT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	/* the i2c devices are directly compatible with s3c2440 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	s3c_i2c0_setname("s3c2440-i2c");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	s3c_i2c1_setname("s3c2440-i2c");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	s3c_fb_setname("s3c2443-fb");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	s3c_adc_setname("s3c2416-adc");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	s3c_rtc_setname("s3c2416-rtc");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) #ifdef CONFIG_PM_SLEEP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	register_syscore_ops(&s3c2416_pm_syscore_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	register_syscore_ops(&s3c24xx_irq_syscore_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	register_syscore_ops(&s3c2416_irq_syscore_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	return device_register(&s3c2416_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) void __init s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	s3c_nand_setname("s3c2412-nand");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) /* s3c2416_map_io
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)  * register the standard cpu IO areas, and any passed in from the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)  * machine specific initialisation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) void __init s3c2416_map_io(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	s3c24xx_gpiocfg_default.set_pull = samsung_gpio_setpull_updown;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	s3c24xx_gpiocfg_default.get_pull = samsung_gpio_getpull_updown;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	/* initialize device information early */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	s3c2416_default_sdhci0();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	s3c2416_default_sdhci1();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	s3c24xx_spi_setname("s3c2443-spi");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) /* need to register the subsystem before we actually register the device, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  * we also need to ensure that it has been initialised before any of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)  * drivers even try to use it (even if not on an s3c2416 based system)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  * as a driver which may support both 2443 and 2440 may try and use it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) static int __init s3c2416_core_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	return subsys_system_register(&s3c2416_subsys, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) core_initcall(s3c2416_core_init);