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