Ben Dooks | e4d06e3 | 2007-02-16 12:12:31 +0100 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s3c2443/s3c2443.c |
| 2 | * |
| 3 | * Copyright (c) 2007 Simtec Electronics |
| 4 | * Ben Dooks <ben@simtec.co.uk> |
| 5 | * |
| 6 | * Samsung S3C2443 Mobile CPU support |
| 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. |
| 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> |
Yauhen Kharuzhy | 0536d0d | 2011-01-06 13:04:33 +0900 | [diff] [blame] | 19 | #include <linux/gpio.h> |
Ben Dooks | e4d06e3 | 2007-02-16 12:12:31 +0100 | [diff] [blame] | 20 | #include <linux/platform_device.h> |
| 21 | #include <linux/serial_core.h> |
Kay Sievers | 4a858cf | 2011-12-21 16:01:38 -0800 | [diff] [blame] | 22 | #include <linux/device.h> |
Ben Dooks | e4d06e3 | 2007-02-16 12:12:31 +0100 | [diff] [blame] | 23 | #include <linux/clk.h> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 24 | #include <linux/io.h> |
Robin Holt | 7b6d864 | 2013-07-08 16:01:40 -0700 | [diff] [blame] | 25 | #include <linux/reboot.h> |
Ben Dooks | e4d06e3 | 2007-02-16 12:12:31 +0100 | [diff] [blame] | 26 | |
| 27 | #include <asm/mach/arch.h> |
| 28 | #include <asm/mach/map.h> |
| 29 | #include <asm/mach/irq.h> |
| 30 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 31 | #include <mach/hardware.h> |
Ben Dooks | e4d06e3 | 2007-02-16 12:12:31 +0100 | [diff] [blame] | 32 | #include <asm/irq.h> |
David Howells | 9f97da7 | 2012-03-28 18:30:01 +0100 | [diff] [blame] | 33 | #include <asm/system_misc.h> |
Ben Dooks | e4d06e3 | 2007-02-16 12:12:31 +0100 | [diff] [blame] | 34 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 35 | #include <mach/regs-s3c2443-clock.h> |
Ben Dooks | e4d06e3 | 2007-02-16 12:12:31 +0100 | [diff] [blame] | 36 | |
Yauhen Kharuzhy | 0536d0d | 2011-01-06 13:04:33 +0900 | [diff] [blame] | 37 | #include <plat/gpio-core.h> |
| 38 | #include <plat/gpio-cfg.h> |
| 39 | #include <plat/gpio-cfg-helpers.h> |
Ben Dooks | a2b7ba9 | 2008-10-07 22:26:09 +0100 | [diff] [blame] | 40 | #include <plat/devs.h> |
| 41 | #include <plat/cpu.h> |
Pawel Osciak | eb42b04 | 2010-08-10 18:02:37 -0700 | [diff] [blame] | 42 | #include <plat/fb-core.h> |
Atul Dahiya | ef3f2dd | 2010-10-18 19:56:45 +0900 | [diff] [blame] | 43 | #include <plat/nand-core.h> |
Heiko Stuebner | 6247cea | 2011-10-12 21:34:12 +0900 | [diff] [blame] | 44 | #include <plat/adc-core.h> |
Heiko Stuebner | b2994d3 | 2011-12-24 10:52:23 +0900 | [diff] [blame] | 45 | #include <plat/rtc-core.h> |
Heiko Stuebner | 308b3af | 2012-10-17 16:47:11 +0900 | [diff] [blame] | 46 | #include <plat/spi-core.h> |
Ben Dooks | e4d06e3 | 2007-02-16 12:12:31 +0100 | [diff] [blame] | 47 | |
| 48 | static struct map_desc s3c2443_iodesc[] __initdata = { |
| 49 | IODESC_ENT(WATCHDOG), |
| 50 | IODESC_ENT(CLKPWR), |
| 51 | IODESC_ENT(TIMER), |
| 52 | }; |
| 53 | |
Kay Sievers | 4a858cf | 2011-12-21 16:01:38 -0800 | [diff] [blame] | 54 | struct bus_type s3c2443_subsys = { |
Kay Sievers | af5ca3f | 2007-12-20 02:09:39 +0100 | [diff] [blame] | 55 | .name = "s3c2443-core", |
Kay Sievers | 4a858cf | 2011-12-21 16:01:38 -0800 | [diff] [blame] | 56 | .dev_name = "s3c2443-core", |
Ben Dooks | e4d06e3 | 2007-02-16 12:12:31 +0100 | [diff] [blame] | 57 | }; |
| 58 | |
Kay Sievers | 4a858cf | 2011-12-21 16:01:38 -0800 | [diff] [blame] | 59 | static struct device s3c2443_dev = { |
| 60 | .bus = &s3c2443_subsys, |
Ben Dooks | e4d06e3 | 2007-02-16 12:12:31 +0100 | [diff] [blame] | 61 | }; |
| 62 | |
Robin Holt | 7b6d864 | 2013-07-08 16:01:40 -0700 | [diff] [blame] | 63 | void s3c2443_restart(enum reboot_mode mode, const char *cmd) |
Ben Dooks | b4f14eb | 2007-02-15 22:53:52 +0100 | [diff] [blame] | 64 | { |
Robin Holt | 7b6d864 | 2013-07-08 16:01:40 -0700 | [diff] [blame] | 65 | if (mode == REBOOT_SOFT) |
Heiko Stuebner | 5753897 | 2011-12-22 23:37:44 +0100 | [diff] [blame] | 66 | soft_restart(0); |
| 67 | |
Ben Dooks | b4f14eb | 2007-02-15 22:53:52 +0100 | [diff] [blame] | 68 | __raw_writel(S3C2443_SWRST_RESET, S3C2443_SWRST); |
| 69 | } |
| 70 | |
Ben Dooks | e4d06e3 | 2007-02-16 12:12:31 +0100 | [diff] [blame] | 71 | int __init s3c2443_init(void) |
| 72 | { |
| 73 | printk("S3C2443: Initialising architecture\n"); |
| 74 | |
Atul Dahiya | ef3f2dd | 2010-10-18 19:56:45 +0900 | [diff] [blame] | 75 | s3c_nand_setname("s3c2412-nand"); |
Pawel Osciak | eb42b04 | 2010-08-10 18:02:37 -0700 | [diff] [blame] | 76 | s3c_fb_setname("s3c2443-fb"); |
Ben Dooks | d9c0ebb | 2007-02-15 22:29:36 +0100 | [diff] [blame] | 77 | |
Heiko Stuebner | 6247cea | 2011-10-12 21:34:12 +0900 | [diff] [blame] | 78 | s3c_adc_setname("s3c2443-adc"); |
Heiko Stuebner | b2994d3 | 2011-12-24 10:52:23 +0900 | [diff] [blame] | 79 | s3c_rtc_setname("s3c2443-rtc"); |
Heiko Stuebner | 6247cea | 2011-10-12 21:34:12 +0900 | [diff] [blame] | 80 | |
Ben Dooks | 7e966f3 | 2007-05-20 18:02:50 +0100 | [diff] [blame] | 81 | /* change WDT IRQ number */ |
| 82 | s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT; |
| 83 | s3c_device_wdt.resource[1].end = IRQ_S3C2443_WDT; |
| 84 | |
Kay Sievers | 4a858cf | 2011-12-21 16:01:38 -0800 | [diff] [blame] | 85 | return device_register(&s3c2443_dev); |
Ben Dooks | e4d06e3 | 2007-02-16 12:12:31 +0100 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | void __init s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no) |
| 89 | { |
| 90 | s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no); |
| 91 | } |
| 92 | |
| 93 | /* s3c2443_map_io |
| 94 | * |
| 95 | * register the standard cpu IO areas, and any passed in from the |
| 96 | * machine specific initialisation. |
| 97 | */ |
| 98 | |
Ben Dooks | 74b265d | 2008-10-21 14:06:31 +0100 | [diff] [blame] | 99 | void __init s3c2443_map_io(void) |
Ben Dooks | e4d06e3 | 2007-02-16 12:12:31 +0100 | [diff] [blame] | 100 | { |
Kukjin Kim | 782d8a3 | 2011-08-30 20:47:32 +0900 | [diff] [blame] | 101 | s3c24xx_gpiocfg_default.set_pull = s3c2443_gpio_setpull; |
| 102 | s3c24xx_gpiocfg_default.get_pull = s3c2443_gpio_getpull; |
Yauhen Kharuzhy | 0536d0d | 2011-01-06 13:04:33 +0900 | [diff] [blame] | 103 | |
Heiko Stuebner | 308b3af | 2012-10-17 16:47:11 +0900 | [diff] [blame] | 104 | /* initialize device information early */ |
| 105 | s3c64xx_spi_setname("s3c2443-spi"); |
| 106 | |
Ben Dooks | e4d06e3 | 2007-02-16 12:12:31 +0100 | [diff] [blame] | 107 | iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc)); |
Ben Dooks | e4d06e3 | 2007-02-16 12:12:31 +0100 | [diff] [blame] | 108 | } |
| 109 | |
Kay Sievers | 4a858cf | 2011-12-21 16:01:38 -0800 | [diff] [blame] | 110 | /* need to register the subsystem before we actually register the device, and |
Ben Dooks | e4d06e3 | 2007-02-16 12:12:31 +0100 | [diff] [blame] | 111 | * we also need to ensure that it has been initialised before any of the |
| 112 | * drivers even try to use it (even if not on an s3c2443 based system) |
| 113 | * as a driver which may support both 2443 and 2440 may try and use it. |
| 114 | */ |
| 115 | |
| 116 | static int __init s3c2443_core_init(void) |
| 117 | { |
Kay Sievers | 4a858cf | 2011-12-21 16:01:38 -0800 | [diff] [blame] | 118 | return subsys_system_register(&s3c2443_subsys, NULL); |
Ben Dooks | e4d06e3 | 2007-02-16 12:12:31 +0100 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | core_initcall(s3c2443_core_init); |