Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s3c2412/mach-vstms.c |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 2 | * |
| 3 | * (C) 2006 Thomas Gleixner <tglx@linutronix.de> |
| 4 | * |
| 5 | * Derived from mach-smdk2413.c - (C) 2006 Simtec Electronics |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/kernel.h> |
| 13 | #include <linux/types.h> |
| 14 | #include <linux/interrupt.h> |
| 15 | #include <linux/list.h> |
| 16 | #include <linux/timer.h> |
| 17 | #include <linux/init.h> |
Ben Dooks | b6d1f54 | 2006-12-17 23:22:26 +0100 | [diff] [blame] | 18 | #include <linux/serial_core.h> |
Tushar Behera | 334a1c7 | 2014-02-14 10:32:45 +0900 | [diff] [blame] | 19 | #include <linux/serial_s3c.h> |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 20 | #include <linux/platform_device.h> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 21 | #include <linux/io.h> |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 22 | #include <linux/mtd/mtd.h> |
| 23 | #include <linux/mtd/nand.h> |
| 24 | #include <linux/mtd/nand_ecc.h> |
| 25 | #include <linux/mtd/partitions.h> |
Laura Abbott | 1c2f87c | 2014-04-13 22:54:58 +0100 | [diff] [blame] | 26 | #include <linux/memblock.h> |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 27 | |
| 28 | #include <asm/mach/arch.h> |
| 29 | #include <asm/mach/map.h> |
| 30 | #include <asm/mach/irq.h> |
| 31 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 32 | #include <mach/hardware.h> |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 33 | #include <asm/setup.h> |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 34 | #include <asm/irq.h> |
| 35 | #include <asm/mach-types.h> |
| 36 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 37 | #include <mach/regs-gpio.h> |
| 38 | #include <mach/regs-lcd.h> |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 39 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 40 | #include <mach/fb.h> |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 41 | |
Arnd Bergmann | 436d42c | 2012-08-24 15:22:12 +0200 | [diff] [blame] | 42 | #include <linux/platform_data/i2c-s3c2410.h> |
| 43 | #include <linux/platform_data/mtd-nand-s3c2410.h> |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 44 | |
Ben Dooks | a2b7ba9 | 2008-10-07 22:26:09 +0100 | [diff] [blame] | 45 | #include <plat/devs.h> |
| 46 | #include <plat/cpu.h> |
Romain Naour | 7f78b6e | 2013-01-09 18:47:04 -0800 | [diff] [blame] | 47 | #include <plat/samsung-time.h> |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 48 | |
Heiko Stuebner | e1a621d | 2013-02-08 10:31:28 -0800 | [diff] [blame] | 49 | #include "common.h" |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 50 | |
| 51 | static struct map_desc vstms_iodesc[] __initdata = { |
| 52 | }; |
| 53 | |
| 54 | static struct s3c2410_uartcfg vstms_uartcfgs[] __initdata = { |
| 55 | [0] = { |
| 56 | .hwport = 0, |
| 57 | .flags = 0, |
| 58 | .ucon = 0x3c5, |
| 59 | .ulcon = 0x03, |
| 60 | .ufcon = 0x51, |
| 61 | }, |
| 62 | [1] = { |
| 63 | .hwport = 1, |
| 64 | .flags = 0, |
| 65 | .ucon = 0x3c5, |
| 66 | .ulcon = 0x03, |
| 67 | .ufcon = 0x51, |
| 68 | }, |
| 69 | [2] = { |
| 70 | .hwport = 2, |
| 71 | .flags = 0, |
| 72 | .ucon = 0x3c5, |
| 73 | .ulcon = 0x03, |
| 74 | .ufcon = 0x51, |
| 75 | } |
| 76 | }; |
| 77 | |
Ben Dooks | 2a3a180 | 2009-09-28 13:59:49 +0300 | [diff] [blame] | 78 | static struct mtd_partition __initdata vstms_nand_part[] = { |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 79 | [0] = { |
| 80 | .name = "Boot Agent", |
| 81 | .size = 0x7C000, |
| 82 | .offset = 0, |
| 83 | }, |
| 84 | [1] = { |
| 85 | .name = "UBoot Config", |
| 86 | .offset = 0x7C000, |
| 87 | .size = 0x4000, |
| 88 | }, |
| 89 | [2] = { |
| 90 | .name = "Kernel", |
| 91 | .offset = 0x80000, |
| 92 | .size = 0x200000, |
| 93 | }, |
| 94 | [3] = { |
| 95 | .name = "RFS", |
| 96 | .offset = 0x280000, |
| 97 | .size = 0x3d80000, |
| 98 | }, |
| 99 | }; |
| 100 | |
Ben Dooks | 2a3a180 | 2009-09-28 13:59:49 +0300 | [diff] [blame] | 101 | static struct s3c2410_nand_set __initdata vstms_nand_sets[] = { |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 102 | [0] = { |
| 103 | .name = "NAND", |
| 104 | .nr_chips = 1, |
| 105 | .nr_partitions = ARRAY_SIZE(vstms_nand_part), |
| 106 | .partitions = vstms_nand_part, |
| 107 | }, |
| 108 | }; |
| 109 | |
| 110 | /* choose a set of timings which should suit most 512Mbit |
| 111 | * chips and beyond. |
| 112 | */ |
| 113 | |
Ben Dooks | 2a3a180 | 2009-09-28 13:59:49 +0300 | [diff] [blame] | 114 | static struct s3c2410_platform_nand __initdata vstms_nand_info = { |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 115 | .tacls = 20, |
| 116 | .twrph0 = 60, |
| 117 | .twrph1 = 20, |
| 118 | .nr_sets = ARRAY_SIZE(vstms_nand_sets), |
| 119 | .sets = vstms_nand_sets, |
| 120 | }; |
| 121 | |
| 122 | static struct platform_device *vstms_devices[] __initdata = { |
Ben Dooks | b813248 | 2009-11-23 00:13:39 +0000 | [diff] [blame] | 123 | &s3c_device_ohci, |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 124 | &s3c_device_wdt, |
Ben Dooks | 3e1b776 | 2008-10-31 16:14:40 +0000 | [diff] [blame] | 125 | &s3c_device_i2c0, |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 126 | &s3c_device_iis, |
| 127 | &s3c_device_rtc, |
| 128 | &s3c_device_nand, |
Heiko Stuebner | f2dda07 | 2013-10-08 06:42:10 +0900 | [diff] [blame] | 129 | &s3c2412_device_dma, |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 130 | }; |
| 131 | |
Laura Abbott | 1c2f87c | 2014-04-13 22:54:58 +0100 | [diff] [blame] | 132 | static void __init vstms_fixup(struct tag *tags, char **cmdline) |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 133 | { |
| 134 | if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) { |
Laura Abbott | 1c2f87c | 2014-04-13 22:54:58 +0100 | [diff] [blame] | 135 | memblock_add(0x30000000, SZ_64M); |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 136 | } |
| 137 | } |
| 138 | |
| 139 | static void __init vstms_map_io(void) |
| 140 | { |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 141 | s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc)); |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 142 | s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs)); |
Romain Naour | 7f78b6e | 2013-01-09 18:47:04 -0800 | [diff] [blame] | 143 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); |
Ben Dooks | 57e5171 | 2007-04-20 11:19:16 +0100 | [diff] [blame] | 144 | } |
| 145 | |
Heiko Stuebner | 3c27f31 | 2014-02-25 09:50:44 +0900 | [diff] [blame] | 146 | static void __init vstms_init_time(void) |
| 147 | { |
| 148 | s3c2412_init_clocks(12000000); |
| 149 | samsung_timer_init(); |
| 150 | } |
| 151 | |
Ben Dooks | 57e5171 | 2007-04-20 11:19:16 +0100 | [diff] [blame] | 152 | static void __init vstms_init(void) |
| 153 | { |
Ben Dooks | 3e1b776 | 2008-10-31 16:14:40 +0000 | [diff] [blame] | 154 | s3c_i2c0_set_platdata(NULL); |
Ben Dooks | 2a3a180 | 2009-09-28 13:59:49 +0300 | [diff] [blame] | 155 | s3c_nand_set_platdata(&vstms_nand_info); |
| 156 | |
Ben Dooks | 57e5171 | 2007-04-20 11:19:16 +0100 | [diff] [blame] | 157 | platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices)); |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 158 | } |
| 159 | |
| 160 | MACHINE_START(VSTMS, "VSTMS") |
Nicolas Pitre | 69d5071 | 2011-07-05 22:38:17 -0400 | [diff] [blame] | 161 | .atag_offset = 0x100, |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 162 | |
| 163 | .fixup = vstms_fixup, |
Heiko Stuebner | 0da0993 | 2013-02-12 10:09:18 -0800 | [diff] [blame] | 164 | .init_irq = s3c2412_init_irq, |
Ben Dooks | 57e5171 | 2007-04-20 11:19:16 +0100 | [diff] [blame] | 165 | .init_machine = vstms_init, |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 166 | .map_io = vstms_map_io, |
Heiko Stuebner | 3c27f31 | 2014-02-25 09:50:44 +0900 | [diff] [blame] | 167 | .init_time = vstms_init_time, |
Ben Dooks | b6c440a | 2006-09-20 20:32:33 +0100 | [diff] [blame] | 168 | MACHINE_END |