Merge tag 'usb-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
[linux/fpc-iii.git] / arch / arm / mach-s3c / s3c2412.c
blob0b1ca78c9d2a3671c065f0fe633cb5e708c5d4d0
1 // SPDX-License-Identifier: GPL-2.0
2 //
3 // Copyright (c) 2006 Simtec Electronics
4 // Ben Dooks <ben@simtec.co.uk>
5 //
6 // http://armlinux.simtec.co.uk/.
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/clk.h>
15 #include <linux/delay.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/io.h>
22 #include <linux/reboot.h>
24 #include <asm/mach/arch.h>
25 #include <asm/mach/map.h>
26 #include <asm/mach/irq.h>
28 #include <asm/proc-fns.h>
29 #include <asm/irq.h>
30 #include <asm/system_misc.h>
32 #include "map.h"
33 #include "regs-clock.h"
34 #include "regs-gpio.h"
36 #include "cpu.h"
37 #include "devs.h"
38 #include "pm.h"
40 #include "s3c24xx.h"
41 #include "nand-core-s3c24xx.h"
42 #include "regs-dsc-s3c24xx.h"
43 #include "s3c2412-power.h"
45 #ifndef CONFIG_CPU_S3C2412_ONLY
46 void __iomem *s3c24xx_va_gpio2 = S3C24XX_VA_GPIO;
48 static inline void s3c2412_init_gpio2(void)
50 s3c24xx_va_gpio2 = S3C24XX_VA_GPIO + 0x10;
52 #else
53 #define s3c2412_init_gpio2() do { } while(0)
54 #endif
56 /* Initial IO mappings */
58 static struct map_desc s3c2412_iodesc[] __initdata __maybe_unused = {
59 IODESC_ENT(CLKPWR),
60 IODESC_ENT(TIMER),
61 IODESC_ENT(WATCHDOG),
63 .virtual = (unsigned long)S3C2412_VA_SSMC,
64 .pfn = __phys_to_pfn(S3C2412_PA_SSMC),
65 .length = SZ_1M,
66 .type = MT_DEVICE,
69 .virtual = (unsigned long)S3C2412_VA_EBI,
70 .pfn = __phys_to_pfn(S3C2412_PA_EBI),
71 .length = SZ_1M,
72 .type = MT_DEVICE,
76 /* uart registration process */
78 void __init s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no)
80 s3c24xx_init_uartdevs("s3c2412-uart", s3c2410_uart_resources, cfg, no);
82 /* rename devices that are s3c2412/s3c2413 specific */
83 s3c_device_sdi.name = "s3c2412-sdi";
84 s3c_device_lcd.name = "s3c2412-lcd";
85 s3c_nand_setname("s3c2412-nand");
87 /* alter IRQ of SDI controller */
89 s3c_device_sdi.resource[1].start = IRQ_S3C2412_SDI;
90 s3c_device_sdi.resource[1].end = IRQ_S3C2412_SDI;
92 /* spi channel related changes, s3c2412/13 specific */
93 s3c_device_spi0.name = "s3c2412-spi";
94 s3c_device_spi0.resource[0].end = S3C24XX_PA_SPI + 0x24;
95 s3c_device_spi1.name = "s3c2412-spi";
96 s3c_device_spi1.resource[0].start = S3C24XX_PA_SPI + S3C2412_SPI1;
97 s3c_device_spi1.resource[0].end = S3C24XX_PA_SPI + S3C2412_SPI1 + 0x24;
101 /* s3c2412_idle
103 * use the standard idle call by ensuring the idle mode
104 * in power config, then issuing the idle co-processor
105 * instruction
108 static void s3c2412_idle(void)
110 unsigned long tmp;
112 /* ensure our idle mode is to go to idle */
114 tmp = __raw_readl(S3C2412_PWRCFG);
115 tmp &= ~S3C2412_PWRCFG_STANDBYWFI_MASK;
116 tmp |= S3C2412_PWRCFG_STANDBYWFI_IDLE;
117 __raw_writel(tmp, S3C2412_PWRCFG);
119 cpu_do_idle();
122 /* s3c2412_map_io
124 * register the standard cpu IO areas, and any passed in from the
125 * machine specific initialisation.
128 void __init s3c2412_map_io(void)
130 /* move base of IO */
132 s3c2412_init_gpio2();
134 /* set our idle function */
136 arm_pm_idle = s3c2412_idle;
138 /* register our io-tables */
140 iotable_init(s3c2412_iodesc, ARRAY_SIZE(s3c2412_iodesc));
143 /* need to register the subsystem before we actually register the device, and
144 * we also need to ensure that it has been initialised before any of the
145 * drivers even try to use it (even if not on an s3c2412 based system)
146 * as a driver which may support both 2410 and 2440 may try and use it.
149 struct bus_type s3c2412_subsys = {
150 .name = "s3c2412-core",
151 .dev_name = "s3c2412-core",
154 static int __init s3c2412_core_init(void)
156 return subsys_system_register(&s3c2412_subsys, NULL);
159 core_initcall(s3c2412_core_init);
161 static struct device s3c2412_dev = {
162 .bus = &s3c2412_subsys,
165 int __init s3c2412_init(void)
167 printk("S3C2412: Initialising architecture\n");
169 #ifdef CONFIG_PM_SLEEP
170 register_syscore_ops(&s3c2412_pm_syscore_ops);
171 register_syscore_ops(&s3c24xx_irq_syscore_ops);
172 #endif
174 return device_register(&s3c2412_dev);