Commit | Line | Data |
---|---|---|
84b21701 KK |
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/ | |
1da177e4 LT |
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> | |
1ec7269f | 14 | #include <linux/gpio.h> |
e425382e | 15 | #include <linux/clk.h> |
4a858cfc | 16 | #include <linux/device.h> |
bb072c3c | 17 | #include <linux/syscore_ops.h> |
b6d1f542 | 18 | #include <linux/serial_core.h> |
334a1c70 | 19 | #include <linux/serial_s3c.h> |
d052d1be | 20 | #include <linux/platform_device.h> |
7b6d864b | 21 | #include <linux/reboot.h> |
fced80c7 | 22 | #include <linux/io.h> |
1da177e4 LT |
23 | |
24 | #include <asm/mach/arch.h> | |
25 | #include <asm/mach/map.h> | |
26 | #include <asm/mach/irq.h> | |
27 | ||
a09e64fb | 28 | #include <mach/hardware.h> |
b0161caa | 29 | #include <mach/gpio-samsung.h> |
1da177e4 | 30 | #include <asm/irq.h> |
9f97da78 | 31 | #include <asm/system_misc.h> |
1da177e4 | 32 | |
e425382e BD |
33 | #include <plat/cpu-freq.h> |
34 | ||
a09e64fb | 35 | #include <mach/regs-clock.h> |
1da177e4 | 36 | |
a2b7ba9c BD |
37 | #include <plat/cpu.h> |
38 | #include <plat/devs.h> | |
bb072c3c | 39 | #include <plat/pm.h> |
1da177e4 | 40 | |
1ec7269f BD |
41 | #include <plat/gpio-core.h> |
42 | #include <plat/gpio-cfg.h> | |
43 | #include <plat/gpio-cfg-helpers.h> | |
44 | ||
d8fdec16 HS |
45 | #include "common.h" |
46 | ||
1da177e4 LT |
47 | /* Initial IO mappings */ |
48 | ||
49 | static struct map_desc s3c2410_iodesc[] __initdata = { | |
1da177e4 | 50 | IODESC_ENT(CLKPWR), |
1da177e4 | 51 | IODESC_ENT(TIMER), |
62ee914e | 52 | IODESC_ENT(WATCHDOG), |
1da177e4 LT |
53 | }; |
54 | ||
1da177e4 LT |
55 | /* our uart devices */ |
56 | ||
1da177e4 LT |
57 | /* uart registration process */ |
58 | ||
59 | void __init s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no) | |
60 | { | |
66a9b49a | 61 | s3c24xx_init_uartdevs("s3c2410-uart", s3c2410_uart_resources, cfg, no); |
1da177e4 LT |
62 | } |
63 | ||
64 | /* s3c2410_map_io | |
65 | * | |
66 | * register the standard cpu IO areas, and any passed in from the | |
67 | * machine specific initialisation. | |
68 | */ | |
69 | ||
74b265d4 | 70 | void __init s3c2410_map_io(void) |
1da177e4 | 71 | { |
782d8a3c KK |
72 | s3c24xx_gpiocfg_default.set_pull = s3c24xx_gpio_setpull_1up; |
73 | s3c24xx_gpiocfg_default.get_pull = s3c24xx_gpio_getpull_1up; | |
1ec7269f | 74 | |
1da177e4 | 75 | iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc)); |
1da177e4 LT |
76 | } |
77 | ||
4a858cfc | 78 | struct bus_type s3c2410_subsys = { |
af5ca3f4 | 79 | .name = "s3c2410-core", |
4a858cfc | 80 | .dev_name = "s3c2410-core", |
a341305e BD |
81 | }; |
82 | ||
f0176794 | 83 | /* Note, we would have liked to name this s3c2410-core, but we cannot |
4a858cfc | 84 | * register two subsystems with the same name. |
f0176794 | 85 | */ |
4a858cfc | 86 | struct bus_type s3c2410a_subsys = { |
f0176794 | 87 | .name = "s3c2410a-core", |
4a858cfc | 88 | .dev_name = "s3c2410a-core", |
f0176794 BD |
89 | }; |
90 | ||
4a858cfc KS |
91 | static struct device s3c2410_dev = { |
92 | .bus = &s3c2410_subsys, | |
a341305e BD |
93 | }; |
94 | ||
4a858cfc | 95 | /* need to register the subsystem before we actually register the device, and |
a341305e | 96 | * we also need to ensure that it has been initialised before any of the |
6db3eee4 | 97 | * drivers even try to use it (even if not on an s3c2410 based system) |
a341305e BD |
98 | * as a driver which may support both 2410 and 2440 may try and use it. |
99 | */ | |
100 | ||
101 | static int __init s3c2410_core_init(void) | |
102 | { | |
4a858cfc | 103 | return subsys_system_register(&s3c2410_subsys, NULL); |
a341305e BD |
104 | } |
105 | ||
106 | core_initcall(s3c2410_core_init); | |
107 | ||
f0176794 BD |
108 | static int __init s3c2410a_core_init(void) |
109 | { | |
4a858cfc | 110 | return subsys_system_register(&s3c2410a_subsys, NULL); |
f0176794 BD |
111 | } |
112 | ||
113 | core_initcall(s3c2410a_core_init); | |
114 | ||
1da177e4 LT |
115 | int __init s3c2410_init(void) |
116 | { | |
117 | printk("S3C2410: Initialising architecture\n"); | |
118 | ||
4f506daf | 119 | #ifdef CONFIG_PM_SLEEP |
bb072c3c RW |
120 | register_syscore_ops(&s3c2410_pm_syscore_ops); |
121 | register_syscore_ops(&s3c24xx_irq_syscore_ops); | |
d8fdec16 | 122 | #endif |
bb072c3c | 123 | |
4a858cfc | 124 | return device_register(&s3c2410_dev); |
1da177e4 | 125 | } |
f0176794 BD |
126 | |
127 | int __init s3c2410a_init(void) | |
128 | { | |
4a858cfc | 129 | s3c2410_dev.bus = &s3c2410a_subsys; |
f0176794 BD |
130 | return s3c2410_init(); |
131 | } |