xref: /OK3568_Linux_fs/kernel/arch/arm/mach-s3c/s3c2443.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun //
3*4882a593Smuzhiyun // Copyright (c) 2007 Simtec Electronics
4*4882a593Smuzhiyun //   Ben Dooks <ben@simtec.co.uk>
5*4882a593Smuzhiyun //
6*4882a593Smuzhiyun // Samsung S3C2443 Mobile CPU support
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/platform_device.h>
16*4882a593Smuzhiyun #include <linux/serial_core.h>
17*4882a593Smuzhiyun #include <linux/device.h>
18*4882a593Smuzhiyun #include <linux/clk.h>
19*4882a593Smuzhiyun #include <linux/io.h>
20*4882a593Smuzhiyun #include <linux/reboot.h>
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun #include <asm/mach/arch.h>
23*4882a593Smuzhiyun #include <asm/mach/map.h>
24*4882a593Smuzhiyun #include <asm/mach/irq.h>
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun #include "map.h"
27*4882a593Smuzhiyun #include "gpio-samsung.h"
28*4882a593Smuzhiyun #include <mach/irqs.h>
29*4882a593Smuzhiyun #include <asm/irq.h>
30*4882a593Smuzhiyun #include <asm/system_misc.h>
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun #include "regs-s3c2443-clock.h"
33*4882a593Smuzhiyun #include "rtc-core-s3c24xx.h"
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun #include "gpio-core.h"
36*4882a593Smuzhiyun #include "gpio-cfg.h"
37*4882a593Smuzhiyun #include "gpio-cfg-helpers.h"
38*4882a593Smuzhiyun #include "devs.h"
39*4882a593Smuzhiyun #include "cpu.h"
40*4882a593Smuzhiyun #include "adc-core.h"
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun #include "s3c24xx.h"
43*4882a593Smuzhiyun #include "fb-core-s3c24xx.h"
44*4882a593Smuzhiyun #include "nand-core-s3c24xx.h"
45*4882a593Smuzhiyun #include "spi-core-s3c24xx.h"
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun static struct map_desc s3c2443_iodesc[] __initdata __maybe_unused = {
48*4882a593Smuzhiyun 	IODESC_ENT(WATCHDOG),
49*4882a593Smuzhiyun 	IODESC_ENT(CLKPWR),
50*4882a593Smuzhiyun 	IODESC_ENT(TIMER),
51*4882a593Smuzhiyun };
52*4882a593Smuzhiyun 
53*4882a593Smuzhiyun struct bus_type s3c2443_subsys = {
54*4882a593Smuzhiyun 	.name = "s3c2443-core",
55*4882a593Smuzhiyun 	.dev_name = "s3c2443-core",
56*4882a593Smuzhiyun };
57*4882a593Smuzhiyun 
58*4882a593Smuzhiyun static struct device s3c2443_dev = {
59*4882a593Smuzhiyun 	.bus		= &s3c2443_subsys,
60*4882a593Smuzhiyun };
61*4882a593Smuzhiyun 
s3c2443_init(void)62*4882a593Smuzhiyun int __init s3c2443_init(void)
63*4882a593Smuzhiyun {
64*4882a593Smuzhiyun 	printk("S3C2443: Initialising architecture\n");
65*4882a593Smuzhiyun 
66*4882a593Smuzhiyun 	s3c_nand_setname("s3c2412-nand");
67*4882a593Smuzhiyun 	s3c_fb_setname("s3c2443-fb");
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun 	s3c_adc_setname("s3c2443-adc");
70*4882a593Smuzhiyun 	s3c_rtc_setname("s3c2443-rtc");
71*4882a593Smuzhiyun 
72*4882a593Smuzhiyun 	/* change WDT IRQ number */
73*4882a593Smuzhiyun 	s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
74*4882a593Smuzhiyun 	s3c_device_wdt.resource[1].end   = IRQ_S3C2443_WDT;
75*4882a593Smuzhiyun 
76*4882a593Smuzhiyun 	return device_register(&s3c2443_dev);
77*4882a593Smuzhiyun }
78*4882a593Smuzhiyun 
s3c2443_init_uarts(struct s3c2410_uartcfg * cfg,int no)79*4882a593Smuzhiyun void __init s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no)
80*4882a593Smuzhiyun {
81*4882a593Smuzhiyun 	s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
82*4882a593Smuzhiyun }
83*4882a593Smuzhiyun 
84*4882a593Smuzhiyun /* s3c2443_map_io
85*4882a593Smuzhiyun  *
86*4882a593Smuzhiyun  * register the standard cpu IO areas, and any passed in from the
87*4882a593Smuzhiyun  * machine specific initialisation.
88*4882a593Smuzhiyun  */
89*4882a593Smuzhiyun 
s3c2443_map_io(void)90*4882a593Smuzhiyun void __init s3c2443_map_io(void)
91*4882a593Smuzhiyun {
92*4882a593Smuzhiyun 	s3c24xx_gpiocfg_default.set_pull = s3c2443_gpio_setpull;
93*4882a593Smuzhiyun 	s3c24xx_gpiocfg_default.get_pull = s3c2443_gpio_getpull;
94*4882a593Smuzhiyun 
95*4882a593Smuzhiyun 	/* initialize device information early */
96*4882a593Smuzhiyun 	s3c24xx_spi_setname("s3c2443-spi");
97*4882a593Smuzhiyun 
98*4882a593Smuzhiyun 	iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc));
99*4882a593Smuzhiyun }
100*4882a593Smuzhiyun 
101*4882a593Smuzhiyun /* need to register the subsystem before we actually register the device, and
102*4882a593Smuzhiyun  * we also need to ensure that it has been initialised before any of the
103*4882a593Smuzhiyun  * drivers even try to use it (even if not on an s3c2443 based system)
104*4882a593Smuzhiyun  * as a driver which may support both 2443 and 2440 may try and use it.
105*4882a593Smuzhiyun */
106*4882a593Smuzhiyun 
s3c2443_core_init(void)107*4882a593Smuzhiyun static int __init s3c2443_core_init(void)
108*4882a593Smuzhiyun {
109*4882a593Smuzhiyun 	return subsys_system_register(&s3c2443_subsys, NULL);
110*4882a593Smuzhiyun }
111*4882a593Smuzhiyun 
112*4882a593Smuzhiyun core_initcall(s3c2443_core_init);
113