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