blob: 21fd5404bc98834971d0448de6e17914ff8072ab [file] [log] [blame]
Krzysztof Kozlowski84b21702017-12-25 20:54:32 +01001// 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/
Linus Torvalds1da177e2005-04-16 15:20:36 -07007
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>
Ben Dooks1ec72692010-05-03 14:39:45 +090014#include <linux/gpio.h>
Ben Dookse4253822008-10-21 14:06:38 +010015#include <linux/clk.h>
Kay Sievers4a858cf2011-12-21 16:01:38 -080016#include <linux/device.h>
Rafael J. Wysockibb072c32011-04-22 22:03:21 +020017#include <linux/syscore_ops.h>
Ben Dooksb6d1f542006-12-17 23:22:26 +010018#include <linux/serial_core.h>
Tushar Behera334a1c72014-02-14 10:32:45 +090019#include <linux/serial_s3c.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010020#include <linux/platform_device.h>
Robin Holt7b6d8642013-07-08 16:01:40 -070021#include <linux/reboot.h>
Russell Kingfced80c2008-09-06 12:10:45 +010022#include <linux/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
24#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
26#include <asm/mach/irq.h>
27
Russell Kinga09e64f2008-08-05 16:14:15 +010028#include <mach/hardware.h>
Linus Walleijb0161ca2014-01-14 14:24:24 +010029#include <mach/gpio-samsung.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#include <asm/irq.h>
David Howells9f97da72012-03-28 18:30:01 +010031#include <asm/system_misc.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
Ben Dookse4253822008-10-21 14:06:38 +010033#include <plat/cpu-freq.h>
34
Russell Kinga09e64f2008-08-05 16:14:15 +010035#include <mach/regs-clock.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
Ben Dooksa2b7ba92008-10-07 22:26:09 +010037#include <plat/cpu.h>
38#include <plat/devs.h>
Rafael J. Wysockibb072c32011-04-22 22:03:21 +020039#include <plat/pm.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
Ben Dooks1ec72692010-05-03 14:39:45 +090041#include <plat/gpio-core.h>
42#include <plat/gpio-cfg.h>
43#include <plat/gpio-cfg-helpers.h>
44
Heiko Stuebnerd8fdec12013-01-29 10:25:22 -080045#include "common.h"
46
Linus Torvalds1da177e2005-04-16 15:20:36 -070047/* Initial IO mappings */
48
49static struct map_desc s3c2410_iodesc[] __initdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 IODESC_ENT(CLKPWR),
Linus Torvalds1da177e2005-04-16 15:20:36 -070051 IODESC_ENT(TIMER),
Dimitry Andric62ee9142005-08-17 13:01:19 +010052 IODESC_ENT(WATCHDOG),
Linus Torvalds1da177e2005-04-16 15:20:36 -070053};
54
Linus Torvalds1da177e2005-04-16 15:20:36 -070055/* our uart devices */
56
Linus Torvalds1da177e2005-04-16 15:20:36 -070057/* uart registration process */
58
59void __init s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no)
60{
Ben Dooks66a9b492006-06-18 23:04:05 +010061 s3c24xx_init_uartdevs("s3c2410-uart", s3c2410_uart_resources, cfg, no);
Linus Torvalds1da177e2005-04-16 15:20:36 -070062}
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
Ben Dooks74b265d2008-10-21 14:06:31 +010070void __init s3c2410_map_io(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070071{
Kukjin Kim782d8a32011-08-30 20:47:32 +090072 s3c24xx_gpiocfg_default.set_pull = s3c24xx_gpio_setpull_1up;
73 s3c24xx_gpiocfg_default.get_pull = s3c24xx_gpio_getpull_1up;
Ben Dooks1ec72692010-05-03 14:39:45 +090074
Linus Torvalds1da177e2005-04-16 15:20:36 -070075 iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc));
Linus Torvalds1da177e2005-04-16 15:20:36 -070076}
77
Kay Sievers4a858cf2011-12-21 16:01:38 -080078struct bus_type s3c2410_subsys = {
Kay Sieversaf5ca3f42007-12-20 02:09:39 +010079 .name = "s3c2410-core",
Kay Sievers4a858cf2011-12-21 16:01:38 -080080 .dev_name = "s3c2410-core",
Ben Dooksa3413052006-06-22 22:18:13 +010081};
82
Ben Dooksf0176792009-07-30 23:23:38 +010083/* Note, we would have liked to name this s3c2410-core, but we cannot
Kay Sievers4a858cf2011-12-21 16:01:38 -080084 * register two subsystems with the same name.
Ben Dooksf0176792009-07-30 23:23:38 +010085 */
Kay Sievers4a858cf2011-12-21 16:01:38 -080086struct bus_type s3c2410a_subsys = {
Ben Dooksf0176792009-07-30 23:23:38 +010087 .name = "s3c2410a-core",
Kay Sievers4a858cf2011-12-21 16:01:38 -080088 .dev_name = "s3c2410a-core",
Ben Dooksf0176792009-07-30 23:23:38 +010089};
90
Kay Sievers4a858cf2011-12-21 16:01:38 -080091static struct device s3c2410_dev = {
92 .bus = &s3c2410_subsys,
Ben Dooksa3413052006-06-22 22:18:13 +010093};
94
Kay Sievers4a858cf2011-12-21 16:01:38 -080095/* need to register the subsystem before we actually register the device, and
Ben Dooksa3413052006-06-22 22:18:13 +010096 * we also need to ensure that it has been initialised before any of the
Ben Dooks6db3eee2007-02-12 16:03:22 +010097 * drivers even try to use it (even if not on an s3c2410 based system)
Ben Dooksa3413052006-06-22 22:18:13 +010098 * 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{
Kay Sievers4a858cf2011-12-21 16:01:38 -0800103 return subsys_system_register(&s3c2410_subsys, NULL);
Ben Dooksa3413052006-06-22 22:18:13 +0100104}
105
106core_initcall(s3c2410_core_init);
107
Ben Dooksf0176792009-07-30 23:23:38 +0100108static int __init s3c2410a_core_init(void)
109{
Kay Sievers4a858cf2011-12-21 16:01:38 -0800110 return subsys_system_register(&s3c2410a_subsys, NULL);
Ben Dooksf0176792009-07-30 23:23:38 +0100111}
112
113core_initcall(s3c2410a_core_init);
114
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115int __init s3c2410_init(void)
116{
117 printk("S3C2410: Initialising architecture\n");
118
Arnd Bergmann4f506da2015-02-27 05:50:22 +0900119#ifdef CONFIG_PM_SLEEP
Rafael J. Wysockibb072c32011-04-22 22:03:21 +0200120 register_syscore_ops(&s3c2410_pm_syscore_ops);
121 register_syscore_ops(&s3c24xx_irq_syscore_ops);
Heiko Stuebnerd8fdec12013-01-29 10:25:22 -0800122#endif
Rafael J. Wysockibb072c32011-04-22 22:03:21 +0200123
Kay Sievers4a858cf2011-12-21 16:01:38 -0800124 return device_register(&s3c2410_dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125}
Ben Dooksf0176792009-07-30 23:23:38 +0100126
127int __init s3c2410a_init(void)
128{
Kay Sievers4a858cf2011-12-21 16:01:38 -0800129 s3c2410_dev.bus = &s3c2410a_subsys;
Ben Dooksf0176792009-07-30 23:23:38 +0100130 return s3c2410_init();
131}