1 // SPDX-License-Identifier: GPL-2.0
2 //
3 // Copyright (c) 2003-2005 Simtec Electronics
4 //	Ben Dooks <ben@simtec.co.uk>
5 //
6 // http://www.simtec.co.uk/products/EB2410ITX/
7 
8 #include <linux/kernel.h>
9 #include <linux/types.h>
10 #include <linux/interrupt.h>
11 #include <linux/list.h>
12 #include <linux/timer.h>
13 #include <linux/init.h>
14 #include <linux/gpio.h>
15 #include <linux/clk.h>
16 #include <linux/device.h>
17 #include <linux/syscore_ops.h>
18 #include <linux/serial_core.h>
19 #include <linux/serial_s3c.h>
20 #include <linux/platform_device.h>
21 #include <linux/reboot.h>
22 #include <linux/io.h>
23 
24 #include <asm/mach/arch.h>
25 #include <asm/mach/map.h>
26 #include <asm/mach/irq.h>
27 
28 #include "map.h"
29 #include "gpio-samsung.h"
30 #include <asm/irq.h>
31 #include <asm/system_misc.h>
32 
33 
34 #include "regs-clock.h"
35 
36 #include "cpu.h"
37 #include "devs.h"
38 #include "pm.h"
39 
40 #include "gpio-core.h"
41 #include "gpio-cfg.h"
42 #include "gpio-cfg-helpers.h"
43 
44 #include "s3c24xx.h"
45 
46 /* Initial IO mappings */
47 
48 static struct map_desc s3c2410_iodesc[] __initdata __maybe_unused = {
49 	IODESC_ENT(CLKPWR),
50 	IODESC_ENT(TIMER),
51 	IODESC_ENT(WATCHDOG),
52 };
53 
54 /* our uart devices */
55 
56 /* uart registration process */
57 
s3c2410_init_uarts(struct s3c2410_uartcfg * cfg,int no)58 void __init s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no)
59 {
60 	s3c24xx_init_uartdevs("s3c2410-uart", s3c2410_uart_resources, cfg, no);
61 }
62 
63 /* s3c2410_map_io
64  *
65  * register the standard cpu IO areas, and any passed in from the
66  * machine specific initialisation.
67 */
68 
s3c2410_map_io(void)69 void __init s3c2410_map_io(void)
70 {
71 	s3c24xx_gpiocfg_default.set_pull = s3c24xx_gpio_setpull_1up;
72 	s3c24xx_gpiocfg_default.get_pull = s3c24xx_gpio_getpull_1up;
73 
74 	iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc));
75 }
76 
77 struct bus_type s3c2410_subsys = {
78 	.name = "s3c2410-core",
79 	.dev_name = "s3c2410-core",
80 };
81 
82 /* Note, we would have liked to name this s3c2410-core, but we cannot
83  * register two subsystems with the same name.
84  */
85 struct bus_type s3c2410a_subsys = {
86 	.name = "s3c2410a-core",
87 	.dev_name = "s3c2410a-core",
88 };
89 
90 static struct device s3c2410_dev = {
91 	.bus		= &s3c2410_subsys,
92 };
93 
94 /* need to register the subsystem before we actually register the device, and
95  * we also need to ensure that it has been initialised before any of the
96  * drivers even try to use it (even if not on an s3c2410 based system)
97  * as a driver which may support both 2410 and 2440 may try and use it.
98 */
99 
s3c2410_core_init(void)100 static int __init s3c2410_core_init(void)
101 {
102 	return subsys_system_register(&s3c2410_subsys, NULL);
103 }
104 
105 core_initcall(s3c2410_core_init);
106 
s3c2410a_core_init(void)107 static int __init s3c2410a_core_init(void)
108 {
109 	return subsys_system_register(&s3c2410a_subsys, NULL);
110 }
111 
112 core_initcall(s3c2410a_core_init);
113 
s3c2410_init(void)114 int __init s3c2410_init(void)
115 {
116 	printk("S3C2410: Initialising architecture\n");
117 
118 #ifdef CONFIG_PM_SLEEP
119 	register_syscore_ops(&s3c2410_pm_syscore_ops);
120 	register_syscore_ops(&s3c24xx_irq_syscore_ops);
121 #endif
122 
123 	return device_register(&s3c2410_dev);
124 }
125 
s3c2410a_init(void)126 int __init s3c2410a_init(void)
127 {
128 	s3c2410_dev.bus = &s3c2410a_subsys;
129 	return s3c2410_init();
130 }
131