blob: 21fd5404bc98834971d0448de6e17914ff8072ab [file] [log] [blame]
xjb04a4022021-11-25 15:01:52 +08001// 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 <mach/hardware.h>
29#include <mach/gpio-samsung.h>
30#include <asm/irq.h>
31#include <asm/system_misc.h>
32
33#include <plat/cpu-freq.h>
34
35#include <mach/regs-clock.h>
36
37#include <plat/cpu.h>
38#include <plat/devs.h>
39#include <plat/pm.h>
40
41#include <plat/gpio-core.h>
42#include <plat/gpio-cfg.h>
43#include <plat/gpio-cfg-helpers.h>
44
45#include "common.h"
46
47/* Initial IO mappings */
48
49static struct map_desc s3c2410_iodesc[] __initdata = {
50 IODESC_ENT(CLKPWR),
51 IODESC_ENT(TIMER),
52 IODESC_ENT(WATCHDOG),
53};
54
55/* our uart devices */
56
57/* uart registration process */
58
59void __init s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no)
60{
61 s3c24xx_init_uartdevs("s3c2410-uart", s3c2410_uart_resources, cfg, no);
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
70void __init s3c2410_map_io(void)
71{
72 s3c24xx_gpiocfg_default.set_pull = s3c24xx_gpio_setpull_1up;
73 s3c24xx_gpiocfg_default.get_pull = s3c24xx_gpio_getpull_1up;
74
75 iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc));
76}
77
78struct bus_type s3c2410_subsys = {
79 .name = "s3c2410-core",
80 .dev_name = "s3c2410-core",
81};
82
83/* Note, we would have liked to name this s3c2410-core, but we cannot
84 * register two subsystems with the same name.
85 */
86struct bus_type s3c2410a_subsys = {
87 .name = "s3c2410a-core",
88 .dev_name = "s3c2410a-core",
89};
90
91static struct device s3c2410_dev = {
92 .bus = &s3c2410_subsys,
93};
94
95/* need to register the subsystem before we actually register the device, and
96 * we also need to ensure that it has been initialised before any of the
97 * drivers even try to use it (even if not on an s3c2410 based system)
98 * as a driver which may support both 2410 and 2440 may try and use it.
99*/
100
101static int __init s3c2410_core_init(void)
102{
103 return subsys_system_register(&s3c2410_subsys, NULL);
104}
105
106core_initcall(s3c2410_core_init);
107
108static int __init s3c2410a_core_init(void)
109{
110 return subsys_system_register(&s3c2410a_subsys, NULL);
111}
112
113core_initcall(s3c2410a_core_init);
114
115int __init s3c2410_init(void)
116{
117 printk("S3C2410: Initialising architecture\n");
118
119#ifdef CONFIG_PM_SLEEP
120 register_syscore_ops(&s3c2410_pm_syscore_ops);
121 register_syscore_ops(&s3c24xx_irq_syscore_ops);
122#endif
123
124 return device_register(&s3c2410_dev);
125}
126
127int __init s3c2410a_init(void)
128{
129 s3c2410_dev.bus = &s3c2410a_subsys;
130 return s3c2410_init();
131}