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