blob: 5061d66ca10cb47809ae9b33c62da0be52b1bc9e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* linux/arch/arm/mach-s3c2410/s3c2410.c
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 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
Linus Torvalds1da177e2005-04-16 15:20:36 -070011*/
12
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/interrupt.h>
16#include <linux/list.h>
17#include <linux/timer.h>
18#include <linux/init.h>
Ben Dooks1ec72692010-05-03 14:39:45 +090019#include <linux/gpio.h>
Ben Dookse4253822008-10-21 14:06:38 +010020#include <linux/clk.h>
Kay Sievers4a858cf2011-12-21 16:01:38 -080021#include <linux/device.h>
Rafael J. Wysockibb072c32011-04-22 22:03:21 +020022#include <linux/syscore_ops.h>
Ben Dooksb6d1f542006-12-17 23:22:26 +010023#include <linux/serial_core.h>
Tushar Behera334a1c72014-02-14 10:32:45 +090024#include <linux/serial_s3c.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010025#include <linux/platform_device.h>
Robin Holt7b6d8642013-07-08 16:01:40 -070026#include <linux/reboot.h>
Russell Kingfced80c2008-09-06 12:10:45 +010027#include <linux/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31#include <asm/mach/irq.h>
32
Russell Kinga09e64f2008-08-05 16:14:15 +010033#include <mach/hardware.h>
Linus Walleijb0161ca2014-01-14 14:24:24 +010034#include <mach/gpio-samsung.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070035#include <asm/irq.h>
David Howells9f97da72012-03-28 18:30:01 +010036#include <asm/system_misc.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
Ben Dookse4253822008-10-21 14:06:38 +010038#include <plat/cpu-freq.h>
39
Russell Kinga09e64f2008-08-05 16:14:15 +010040#include <mach/regs-clock.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
Ben Dooksa2b7ba92008-10-07 22:26:09 +010042#include <plat/cpu.h>
43#include <plat/devs.h>
Rafael J. Wysockibb072c32011-04-22 22:03:21 +020044#include <plat/pm.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070045
Ben Dooks1ec72692010-05-03 14:39:45 +090046#include <plat/gpio-core.h>
47#include <plat/gpio-cfg.h>
48#include <plat/gpio-cfg-helpers.h>
49
Heiko Stuebnerd8fdec12013-01-29 10:25:22 -080050#include "common.h"
51
Linus Torvalds1da177e2005-04-16 15:20:36 -070052/* Initial IO mappings */
53
54static struct map_desc s3c2410_iodesc[] __initdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 IODESC_ENT(CLKPWR),
Linus Torvalds1da177e2005-04-16 15:20:36 -070056 IODESC_ENT(TIMER),
Dimitry Andric62ee9142005-08-17 13:01:19 +010057 IODESC_ENT(WATCHDOG),
Linus Torvalds1da177e2005-04-16 15:20:36 -070058};
59
Linus Torvalds1da177e2005-04-16 15:20:36 -070060/* our uart devices */
61
Linus Torvalds1da177e2005-04-16 15:20:36 -070062/* uart registration process */
63
64void __init s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no)
65{
Ben Dooks66a9b492006-06-18 23:04:05 +010066 s3c24xx_init_uartdevs("s3c2410-uart", s3c2410_uart_resources, cfg, no);
Linus Torvalds1da177e2005-04-16 15:20:36 -070067}
68
69/* s3c2410_map_io
70 *
71 * register the standard cpu IO areas, and any passed in from the
72 * machine specific initialisation.
73*/
74
Ben Dooks74b265d2008-10-21 14:06:31 +010075void __init s3c2410_map_io(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070076{
Kukjin Kim782d8a32011-08-30 20:47:32 +090077 s3c24xx_gpiocfg_default.set_pull = s3c24xx_gpio_setpull_1up;
78 s3c24xx_gpiocfg_default.get_pull = s3c24xx_gpio_getpull_1up;
Ben Dooks1ec72692010-05-03 14:39:45 +090079
Linus Torvalds1da177e2005-04-16 15:20:36 -070080 iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc));
Linus Torvalds1da177e2005-04-16 15:20:36 -070081}
82
Kay Sievers4a858cf2011-12-21 16:01:38 -080083struct bus_type s3c2410_subsys = {
Kay Sieversaf5ca3f2007-12-20 02:09:39 +010084 .name = "s3c2410-core",
Kay Sievers4a858cf2011-12-21 16:01:38 -080085 .dev_name = "s3c2410-core",
Ben Dooksa3413052006-06-22 22:18:13 +010086};
87
Ben Dooksf0176792009-07-30 23:23:38 +010088/* Note, we would have liked to name this s3c2410-core, but we cannot
Kay Sievers4a858cf2011-12-21 16:01:38 -080089 * register two subsystems with the same name.
Ben Dooksf0176792009-07-30 23:23:38 +010090 */
Kay Sievers4a858cf2011-12-21 16:01:38 -080091struct bus_type s3c2410a_subsys = {
Ben Dooksf0176792009-07-30 23:23:38 +010092 .name = "s3c2410a-core",
Kay Sievers4a858cf2011-12-21 16:01:38 -080093 .dev_name = "s3c2410a-core",
Ben Dooksf0176792009-07-30 23:23:38 +010094};
95
Kay Sievers4a858cf2011-12-21 16:01:38 -080096static struct device s3c2410_dev = {
97 .bus = &s3c2410_subsys,
Ben Dooksa3413052006-06-22 22:18:13 +010098};
99
Kay Sievers4a858cf2011-12-21 16:01:38 -0800100/* need to register the subsystem before we actually register the device, and
Ben Dooksa3413052006-06-22 22:18:13 +0100101 * we also need to ensure that it has been initialised before any of the
Ben Dooks6db3eee2007-02-12 16:03:22 +0100102 * drivers even try to use it (even if not on an s3c2410 based system)
Ben Dooksa3413052006-06-22 22:18:13 +0100103 * as a driver which may support both 2410 and 2440 may try and use it.
104*/
105
106static int __init s3c2410_core_init(void)
107{
Kay Sievers4a858cf2011-12-21 16:01:38 -0800108 return subsys_system_register(&s3c2410_subsys, NULL);
Ben Dooksa3413052006-06-22 22:18:13 +0100109}
110
111core_initcall(s3c2410_core_init);
112
Ben Dooksf0176792009-07-30 23:23:38 +0100113static int __init s3c2410a_core_init(void)
114{
Kay Sievers4a858cf2011-12-21 16:01:38 -0800115 return subsys_system_register(&s3c2410a_subsys, NULL);
Ben Dooksf0176792009-07-30 23:23:38 +0100116}
117
118core_initcall(s3c2410a_core_init);
119
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120int __init s3c2410_init(void)
121{
122 printk("S3C2410: Initialising architecture\n");
123
Arnd Bergmann4f506da2015-02-27 05:50:22 +0900124#ifdef CONFIG_PM_SLEEP
Rafael J. Wysockibb072c32011-04-22 22:03:21 +0200125 register_syscore_ops(&s3c2410_pm_syscore_ops);
126 register_syscore_ops(&s3c24xx_irq_syscore_ops);
Heiko Stuebnerd8fdec12013-01-29 10:25:22 -0800127#endif
Rafael J. Wysockibb072c32011-04-22 22:03:21 +0200128
Kay Sievers4a858cf2011-12-21 16:01:38 -0800129 return device_register(&s3c2410_dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130}
Ben Dooksf0176792009-07-30 23:23:38 +0100131
132int __init s3c2410a_init(void)
133{
Kay Sievers4a858cf2011-12-21 16:01:38 -0800134 s3c2410_dev.bus = &s3c2410a_subsys;
Ben Dooksf0176792009-07-30 23:23:38 +0100135 return s3c2410_init();
136}