blob: 451d9851b0a70b3b4118755a9e65fc832ca744b5 [file] [log] [blame]
Krzysztof Kozlowski84b21702017-12-25 20:54:32 +01001// SPDX-License-Identifier: GPL-2.0
2//
3// Copyright (c) 2004-2006 Simtec Electronics
4// Ben Dooks <ben@simtec.co.uk>
5//
6// Samsung S3C2440 Mobile CPU support
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>
Russell Kingd052d1b2005-10-29 19:07:23 +010014#include <linux/platform_device.h>
Ben Dooksb6d1f542006-12-17 23:22:26 +010015#include <linux/serial_core.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 Dooks1ec72692010-05-03 14:39:45 +090018#include <linux/gpio.h>
Russell Kingf8ce2542006-01-07 16:15:52 +000019#include <linux/clk.h>
Russell Kingfced80c2008-09-06 12:10:45 +010020#include <linux/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
22#include <asm/mach/arch.h>
23#include <asm/mach/map.h>
24#include <asm/mach/irq.h>
25
Russell Kinga09e64f2008-08-05 16:14:15 +010026#include <mach/hardware.h>
Linus Walleijb0161ca2014-01-14 14:24:24 +010027#include <mach/gpio-samsung.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070028#include <asm/irq.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
Ben Dooksa2b7ba92008-10-07 22:26:09 +010030#include <plat/devs.h>
31#include <plat/cpu.h>
Rafael J. Wysockibb072c32011-04-22 22:03:21 +020032#include <plat/pm.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
Ben Dooks1ec72692010-05-03 14:39:45 +090034#include <plat/gpio-core.h>
35#include <plat/gpio-cfg.h>
36#include <plat/gpio-cfg-helpers.h>
37
Heiko Stuebnerd8fdec12013-01-29 10:25:22 -080038#include "common.h"
39
Kay Sievers4a858cf2011-12-21 16:01:38 -080040static struct device s3c2440_dev = {
41 .bus = &s3c2440_subsys,
Linus Torvalds1da177e2005-04-16 15:20:36 -070042};
43
Ben Dooks96ce2382006-06-18 23:06:41 +010044int __init s3c2440_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070045{
Ben Dooks96ce2382006-06-18 23:06:41 +010046 printk("S3C2440: Initialising architecture\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
48 /* change irq for watchdog */
49
50 s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT;
51 s3c_device_wdt.resource[1].end = IRQ_S3C2440_WDT;
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
Rafael J. Wysockibb072c32011-04-22 22:03:21 +020053 /* register suspend/resume handlers */
54
Arnd Bergmann4f506da2015-02-27 05:50:22 +090055#ifdef CONFIG_PM_SLEEP
Rafael J. Wysockibb072c32011-04-22 22:03:21 +020056 register_syscore_ops(&s3c2410_pm_syscore_ops);
Heiko Stuebnerd8fdec12013-01-29 10:25:22 -080057 register_syscore_ops(&s3c24xx_irq_syscore_ops);
Rafael J. Wysockibb072c32011-04-22 22:03:21 +020058 register_syscore_ops(&s3c244x_pm_syscore_ops);
Arnd Bergmann4f506da2015-02-27 05:50:22 +090059#endif
Rafael J. Wysockibb072c32011-04-22 22:03:21 +020060
Ben Dooks96ce2382006-06-18 23:06:41 +010061 /* register our system device for everything else */
Linus Torvalds1da177e2005-04-16 15:20:36 -070062
Kay Sievers4a858cf2011-12-21 16:01:38 -080063 return device_register(&s3c2440_dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070064}
Vasily Khoruzhick812c4e42010-12-01 08:29:23 +020065
66void __init s3c2440_map_io(void)
67{
68 s3c244x_map_io();
69
Kukjin Kim782d8a32011-08-30 20:47:32 +090070 s3c24xx_gpiocfg_default.set_pull = s3c24xx_gpio_setpull_1up;
71 s3c24xx_gpiocfg_default.get_pull = s3c24xx_gpio_getpull_1up;
Vasily Khoruzhick812c4e42010-12-01 08:29:23 +020072}