blob: 31fd273269c2d944ba9e69146093b79247bee803 [file] [log] [blame]
Ben Dooksa21765a2007-02-11 18:31:01 +01001/* linux/arch/arm/plat-s3c24xx/s3c244x.c
Ben Dooks96ce2382006-06-18 23:06:41 +01002 *
3 * Copyright (c) 2004-2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
Ben Dookse4d06e32007-02-16 12:12:31 +01006 * Samsung S3C2440 and S3C2442 Mobile CPU support (not S3C2443)
Ben Dooks96ce2382006-06-18 23:06:41 +01007 *
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.
11*/
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 Dooksb6d1f542006-12-17 23:22:26 +010019#include <linux/serial_core.h>
Tushar Behera334a1c72014-02-14 10:32:45 +090020#include <linux/serial_s3c.h>
Ben Dooks96ce2382006-06-18 23:06:41 +010021#include <linux/platform_device.h>
Robin Holt7b6d8642013-07-08 16:01:40 -070022#include <linux/reboot.h>
Kay Sievers4a858cf2011-12-21 16:01:38 -080023#include <linux/device.h>
Rafael J. Wysockibb072c32011-04-22 22:03:21 +020024#include <linux/syscore_ops.h>
Ben Dooks96ce2382006-06-18 23:06:41 +010025#include <linux/clk.h>
Russell Kingfced80c2008-09-06 12:10:45 +010026#include <linux/io.h>
Ben Dooks96ce2382006-06-18 23:06:41 +010027
David Howells9f97da72012-03-28 18:30:01 +010028#include <asm/system_misc.h>
Ben Dooks96ce2382006-06-18 23:06:41 +010029#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>
Ben Dooks96ce2382006-06-18 23:06:41 +010034#include <asm/irq.h>
35
Ben Dookse4253822008-10-21 14:06:38 +010036#include <plat/cpu-freq.h>
37
Russell Kinga09e64f2008-08-05 16:14:15 +010038#include <mach/regs-clock.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010039#include <mach/regs-gpio.h>
Ben Dooks96ce2382006-06-18 23:06:41 +010040
Ben Dooksa2b7ba92008-10-07 22:26:09 +010041#include <plat/devs.h>
42#include <plat/cpu.h>
43#include <plat/pm.h>
Ben Dooks96ce2382006-06-18 23:06:41 +010044
Heiko Stuebner51cb1282014-05-09 05:48:57 +090045#include "common.h"
Kukjin Kimf8eed6c2015-07-30 02:00:35 +090046#include "nand-core.h"
Kukjin Kimb4353782013-01-02 14:01:09 -080047#include "regs-dsc.h"
48
Ben Dooks96ce2382006-06-18 23:06:41 +010049static struct map_desc s3c244x_iodesc[] __initdata = {
50 IODESC_ENT(CLKPWR),
51 IODESC_ENT(TIMER),
52 IODESC_ENT(WATCHDOG),
Ben Dooks96ce2382006-06-18 23:06:41 +010053};
54
55/* uart initialisation */
56
57void __init s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no)
58{
59 s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
60}
61
Ben Dooks74b265d2008-10-21 14:06:31 +010062void __init s3c244x_map_io(void)
Ben Dooks96ce2382006-06-18 23:06:41 +010063{
64 /* register our io-tables */
65
66 iotable_init(s3c244x_iodesc, ARRAY_SIZE(s3c244x_iodesc));
Ben Dooks96ce2382006-06-18 23:06:41 +010067
68 /* rename any peripherals used differing from the s3c2410 */
69
Ben Dooks90239bb2008-05-21 10:24:17 +010070 s3c_device_sdi.name = "s3c2440-sdi";
Ben Dooks3e1b7762008-10-31 16:14:40 +000071 s3c_device_i2c0.name = "s3c2440-i2c";
Atul Dahiyaef3f2dd2010-10-18 19:56:45 +090072 s3c_nand_setname("s3c2440-nand");
Arnaud Patardce8877b2009-12-23 19:25:05 +000073 s3c_device_ts.name = "s3c2440-ts";
Ben Dooksb8ccca42006-06-27 22:53:03 +010074 s3c_device_usbgadget.name = "s3c2440-usbgadget";
Heiko Stuebner51cb1282014-05-09 05:48:57 +090075 s3c2410_device_dclk.name = "s3c2440-dclk";
Ben Dooks96ce2382006-06-18 23:06:41 +010076}
77
Kay Sievers4a858cf2011-12-21 16:01:38 -080078/* Since the S3C2442 and S3C2440 share items, put both subsystems here */
Ben Dooks96ce2382006-06-18 23:06:41 +010079
Kay Sievers4a858cf2011-12-21 16:01:38 -080080struct bus_type s3c2440_subsys = {
Kay Sieversaf5ca3f2007-12-20 02:09:39 +010081 .name = "s3c2440-core",
Kay Sievers4a858cf2011-12-21 16:01:38 -080082 .dev_name = "s3c2440-core",
Ben Dooks96ce2382006-06-18 23:06:41 +010083};
84
Kay Sievers4a858cf2011-12-21 16:01:38 -080085struct bus_type s3c2442_subsys = {
Kay Sieversaf5ca3f2007-12-20 02:09:39 +010086 .name = "s3c2442-core",
Kay Sievers4a858cf2011-12-21 16:01:38 -080087 .dev_name = "s3c2442-core",
Ben Dooks96ce2382006-06-18 23:06:41 +010088};
89
Kay Sievers4a858cf2011-12-21 16:01:38 -080090/* need to register the subsystem before we actually register the device, and
Ben Dooks96ce2382006-06-18 23:06:41 +010091 * we also need to ensure that it has been initialised before any of the
92 * drivers even try to use it (even if not on an s3c2440 based system)
93 * as a driver which may support both 2410 and 2440 may try and use it.
94*/
95
96static int __init s3c2440_core_init(void)
97{
Kay Sievers4a858cf2011-12-21 16:01:38 -080098 return subsys_system_register(&s3c2440_subsys, NULL);
Ben Dooks96ce2382006-06-18 23:06:41 +010099}
100
101core_initcall(s3c2440_core_init);
102
103static int __init s3c2442_core_init(void)
104{
Kay Sievers4a858cf2011-12-21 16:01:38 -0800105 return subsys_system_register(&s3c2442_subsys, NULL);
Ben Dooks96ce2382006-06-18 23:06:41 +0100106}
107
108core_initcall(s3c2442_core_init);
Rafael J. Wysockibb072c32011-04-22 22:03:21 +0200109
110
Arnd Bergmann4f506da2015-02-27 05:50:22 +0900111#ifdef CONFIG_PM_SLEEP
Rafael J. Wysockibb072c32011-04-22 22:03:21 +0200112static struct sleep_save s3c244x_sleep[] = {
113 SAVE_ITEM(S3C2440_DSC0),
114 SAVE_ITEM(S3C2440_DSC1),
115 SAVE_ITEM(S3C2440_GPJDAT),
116 SAVE_ITEM(S3C2440_GPJCON),
117 SAVE_ITEM(S3C2440_GPJUP)
118};
119
120static int s3c244x_suspend(void)
121{
122 s3c_pm_do_save(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
123 return 0;
124}
125
126static void s3c244x_resume(void)
127{
128 s3c_pm_do_restore(s3c244x_sleep, ARRAY_SIZE(s3c244x_sleep));
129}
Rafael J. Wysockibb072c32011-04-22 22:03:21 +0200130
131struct syscore_ops s3c244x_pm_syscore_ops = {
132 .suspend = s3c244x_suspend,
133 .resume = s3c244x_resume,
134};
Arnd Bergmann4f506da2015-02-27 05:50:22 +0900135#endif