blob: 77ee0b732237d93de59c80632279a00dbf5dc2bd [file] [log] [blame]
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +09001/* linux/arch/arm/mach-s3c2416/s3c2416.c
2 *
3 * Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com>,
4 * as part of OpenInkpot project
5 * Copyright (c) 2009 Promwad Innovation Company
6 * Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
7 *
8 * Samsung S3C2416 Mobile CPU support
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23*/
24
25#include <linux/kernel.h>
26#include <linux/types.h>
27#include <linux/interrupt.h>
28#include <linux/list.h>
29#include <linux/timer.h>
30#include <linux/init.h>
Ben Dookseb90de42010-04-30 19:48:02 +090031#include <linux/gpio.h>
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +090032#include <linux/platform_device.h>
33#include <linux/serial_core.h>
Kay Sievers4a858cf2011-12-21 16:01:38 -080034#include <linux/device.h>
Rafael J. Wysockibb072c32011-04-22 22:03:21 +020035#include <linux/syscore_ops.h>
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +090036#include <linux/clk.h>
37#include <linux/io.h>
38
39#include <asm/mach/arch.h>
40#include <asm/mach/map.h>
41#include <asm/mach/irq.h>
42
43#include <mach/hardware.h>
44#include <asm/proc-fns.h>
45#include <asm/irq.h>
David Howells9f97da72012-03-28 18:30:01 +010046#include <asm/system_misc.h>
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +090047
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +090048#include <mach/regs-s3c2443-clock.h>
49
Ben Dookseb90de42010-04-30 19:48:02 +090050#include <plat/gpio-core.h>
51#include <plat/gpio-cfg.h>
52#include <plat/gpio-cfg-helpers.h>
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +090053#include <plat/s3c2416.h>
54#include <plat/devs.h>
55#include <plat/cpu.h>
Yauhen Kharuzhyc29cfa62010-12-17 14:42:09 +090056#include <plat/sdhci.h>
Rafael J. Wysockibb072c32011-04-22 22:03:21 +020057#include <plat/pm.h>
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +090058
Ben Dookse12ef7f2010-05-03 16:44:35 +090059#include <plat/iic-core.h>
Pawel Osciakeb42b042010-08-10 18:02:37 -070060#include <plat/fb-core.h>
Atul Dahiyaef3f2dd2010-10-18 19:56:45 +090061#include <plat/nand-core.h>
Heiko Stuebner35cc3ce2011-10-12 21:34:12 +090062#include <plat/adc-core.h>
Heiko Stuebnerb2994d32011-12-24 10:52:23 +090063#include <plat/rtc-core.h>
Heiko Stuebner308b3af2012-10-17 16:47:11 +090064#include <plat/spi-core.h>
Ben Dookse12ef7f2010-05-03 16:44:35 +090065
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +090066static struct map_desc s3c2416_iodesc[] __initdata = {
67 IODESC_ENT(WATCHDOG),
68 IODESC_ENT(CLKPWR),
69 IODESC_ENT(TIMER),
70};
71
Kay Sievers4a858cf2011-12-21 16:01:38 -080072struct bus_type s3c2416_subsys = {
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +090073 .name = "s3c2416-core",
Kay Sievers4a858cf2011-12-21 16:01:38 -080074 .dev_name = "s3c2416-core",
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +090075};
76
Kay Sievers4a858cf2011-12-21 16:01:38 -080077static struct device s3c2416_dev = {
78 .bus = &s3c2416_subsys,
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +090079};
80
Heiko Stuebner57538972011-12-22 23:37:44 +010081void s3c2416_restart(char mode, const char *cmd)
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +090082{
Heiko Stuebner57538972011-12-22 23:37:44 +010083 if (mode == 's')
84 soft_restart(0);
85
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +090086 __raw_writel(S3C2443_SWRST_RESET, S3C2443_SWRST);
87}
88
89int __init s3c2416_init(void)
90{
91 printk(KERN_INFO "S3C2416: Initializing architecture\n");
92
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +090093 /* change WDT IRQ number */
94 s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT;
95 s3c_device_wdt.resource[1].end = IRQ_S3C2443_WDT;
96
Ben Dookse12ef7f2010-05-03 16:44:35 +090097 /* the i2c devices are directly compatible with s3c2440 */
98 s3c_i2c0_setname("s3c2440-i2c");
99 s3c_i2c1_setname("s3c2440-i2c");
100
Pawel Osciakeb42b042010-08-10 18:02:37 -0700101 s3c_fb_setname("s3c2443-fb");
Ben Dooksf64bea42010-05-03 15:29:44 +0900102
Heiko Stuebner35cc3ce2011-10-12 21:34:12 +0900103 s3c_adc_setname("s3c2416-adc");
Heiko Stuebnerb2994d32011-12-24 10:52:23 +0900104 s3c_rtc_setname("s3c2416-rtc");
Heiko Stuebner35cc3ce2011-10-12 21:34:12 +0900105
Domenico Andreolifb630b92011-10-22 04:00:53 +0900106#ifdef CONFIG_PM
Rafael J. Wysockibb072c32011-04-22 22:03:21 +0200107 register_syscore_ops(&s3c2416_pm_syscore_ops);
Domenico Andreolifb630b92011-10-22 04:00:53 +0900108#endif
Rafael J. Wysockibb072c32011-04-22 22:03:21 +0200109 register_syscore_ops(&s3c24xx_irq_syscore_ops);
Heiko Stuebner0e944e22012-05-20 01:01:35 +0900110 register_syscore_ops(&s3c2416_irq_syscore_ops);
Rafael J. Wysockibb072c32011-04-22 22:03:21 +0200111
Kay Sievers4a858cf2011-12-21 16:01:38 -0800112 return device_register(&s3c2416_dev);
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +0900113}
114
115void __init s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no)
116{
117 s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
118
Atul Dahiya4bc77862010-10-18 19:56:49 +0900119 s3c_nand_setname("s3c2412-nand");
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +0900120}
121
122/* s3c2416_map_io
123 *
124 * register the standard cpu IO areas, and any passed in from the
125 * machine specific initialisation.
126 */
127
128void __init s3c2416_map_io(void)
129{
Kukjin Kim782d8a32011-08-30 20:47:32 +0900130 s3c24xx_gpiocfg_default.set_pull = samsung_gpio_setpull_updown;
131 s3c24xx_gpiocfg_default.get_pull = samsung_gpio_getpull_updown;
Ben Dookseb90de42010-04-30 19:48:02 +0900132
Yauhen Kharuzhyc29cfa62010-12-17 14:42:09 +0900133 /* initialize device information early */
134 s3c2416_default_sdhci0();
135 s3c2416_default_sdhci1();
Heiko Stuebner308b3af2012-10-17 16:47:11 +0900136 s3c64xx_spi_setname("s3c2443-spi");
Yauhen Kharuzhyc29cfa62010-12-17 14:42:09 +0900137
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +0900138 iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc));
139}
140
Kay Sievers4a858cf2011-12-21 16:01:38 -0800141/* need to register the subsystem before we actually register the device, and
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +0900142 * we also need to ensure that it has been initialised before any of the
143 * drivers even try to use it (even if not on an s3c2416 based system)
144 * as a driver which may support both 2443 and 2440 may try and use it.
145*/
146
147static int __init s3c2416_core_init(void)
148{
Kay Sievers4a858cf2011-12-21 16:01:38 -0800149 return subsys_system_register(&s3c2416_subsys, NULL);
Yauhen Kharuzhyf1290a42010-04-28 18:09:01 +0900150}
151
152core_initcall(s3c2416_core_init);