blob: ec024af7b0ce49f18978b90274298c4b50f54a3b [file] [log] [blame]
Krzysztof Kozlowski84b21702017-12-25 20:54:32 +01001// 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 Dooksb6c440a2006-09-20 20:32:33 +01006
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 Dooksb6d1f542006-12-17 23:22:26 +010013#include <linux/serial_core.h>
Tushar Behera334a1c72014-02-14 10:32:45 +090014#include <linux/serial_s3c.h>
Ben Dooksb6c440a2006-09-20 20:32:33 +010015#include <linux/platform_device.h>
Russell Kingfced80c2008-09-06 12:10:45 +010016#include <linux/io.h>
Ben Dooksb6c440a2006-09-20 20:32:33 +010017#include <linux/mtd/mtd.h>
Boris Brezillond4092d72017-08-04 17:29:10 +020018#include <linux/mtd/rawnand.h>
Miquel Raynale5acf9c2020-09-30 01:01:15 +020019#include <linux/mtd/nand-ecc-sw-hamming.h>
Ben Dooksb6c440a2006-09-20 20:32:33 +010020#include <linux/mtd/partitions.h>
Laura Abbott1c2f87c2014-04-13 22:54:58 +010021#include <linux/memblock.h>
Ben Dooksb6c440a2006-09-20 20:32:33 +010022
23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25#include <asm/mach/irq.h>
26
Ben Dooksb6c440a2006-09-20 20:32:33 +010027#include <asm/setup.h>
Ben Dooksb6c440a2006-09-20 20:32:33 +010028#include <asm/irq.h>
29#include <asm/mach-types.h>
30
Arnd Bergmannc6ff1322019-09-02 18:37:30 +020031#include "regs-gpio.h"
32#include "gpio-samsung.h"
33#include "gpio-cfg.h"
Ben Dooksb6c440a2006-09-20 20:32:33 +010034
Arnd Bergmann81994e02019-09-02 22:33:24 +020035#include <linux/platform_data/fb-s3c2410.h>
Ben Dooksb6c440a2006-09-20 20:32:33 +010036
Arnd Bergmann436d42c2012-08-24 15:22:12 +020037#include <linux/platform_data/i2c-s3c2410.h>
38#include <linux/platform_data/mtd-nand-s3c2410.h>
Ben Dooksb6c440a2006-09-20 20:32:33 +010039
Arnd Bergmannc6ff1322019-09-02 18:37:30 +020040#include "devs.h"
41#include "cpu.h"
Ben Dooksb6c440a2006-09-20 20:32:33 +010042
Arnd Bergmann71b91142019-09-02 17:47:55 +020043#include "s3c24xx.h"
Ben Dooksb6c440a2006-09-20 20:32:33 +010044
45static struct map_desc vstms_iodesc[] __initdata = {
46};
47
48static 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 Dooks2a3a1802009-09-28 13:59:49 +030072static struct mtd_partition __initdata vstms_nand_part[] = {
Ben Dooksb6c440a2006-09-20 20:32:33 +010073 [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 Dooks2a3a1802009-09-28 13:59:49 +030095static struct s3c2410_nand_set __initdata vstms_nand_sets[] = {
Ben Dooksb6c440a2006-09-20 20:32:33 +010096 [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 Dooks2a3a1802009-09-28 13:59:49 +0300108static struct s3c2410_platform_nand __initdata vstms_nand_info = {
Ben Dooksb6c440a2006-09-20 20:32:33 +0100109 .tacls = 20,
110 .twrph0 = 60,
111 .twrph1 = 20,
112 .nr_sets = ARRAY_SIZE(vstms_nand_sets),
113 .sets = vstms_nand_sets,
Miquel Raynalbace41f2020-08-27 10:51:58 +0200114 .engine_type = NAND_ECC_ENGINE_TYPE_SOFT,
Ben Dooksb6c440a2006-09-20 20:32:33 +0100115};
116
117static struct platform_device *vstms_devices[] __initdata = {
Ben Dooksb8132482009-11-23 00:13:39 +0000118 &s3c_device_ohci,
Ben Dooksb6c440a2006-09-20 20:32:33 +0100119 &s3c_device_wdt,
Ben Dooks3e1b7762008-10-31 16:14:40 +0000120 &s3c_device_i2c0,
Ben Dooksb6c440a2006-09-20 20:32:33 +0100121 &s3c_device_iis,
122 &s3c_device_rtc,
123 &s3c_device_nand,
Heiko Stuebnerf2dda072013-10-08 06:42:10 +0900124 &s3c2412_device_dma,
Ben Dooksb6c440a2006-09-20 20:32:33 +0100125};
126
Laura Abbott1c2f87c2014-04-13 22:54:58 +0100127static void __init vstms_fixup(struct tag *tags, char **cmdline)
Ben Dooksb6c440a2006-09-20 20:32:33 +0100128{
129 if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) {
Laura Abbott1c2f87c2014-04-13 22:54:58 +0100130 memblock_add(0x30000000, SZ_64M);
Ben Dooksb6c440a2006-09-20 20:32:33 +0100131 }
132}
133
134static void __init vstms_map_io(void)
135{
Ben Dooksb6c440a2006-09-20 20:32:33 +0100136 s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
Ben Dooksb6c440a2006-09-20 20:32:33 +0100137 s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
Krzysztof Kozlowskia1342f62020-08-20 22:42:03 +0200138 s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
Ben Dooks57e51712007-04-20 11:19:16 +0100139}
140
Heiko Stuebner3c27f312014-02-25 09:50:44 +0900141static void __init vstms_init_time(void)
142{
143 s3c2412_init_clocks(12000000);
Krzysztof Kozlowskia1342f62020-08-20 22:42:03 +0200144 s3c24xx_timer_init();
Heiko Stuebner3c27f312014-02-25 09:50:44 +0900145}
146
Ben Dooks57e51712007-04-20 11:19:16 +0100147static void __init vstms_init(void)
148{
Ben Dooks3e1b7762008-10-31 16:14:40 +0000149 s3c_i2c0_set_platdata(NULL);
Ben Dooks2a3a1802009-09-28 13:59:49 +0300150 s3c_nand_set_platdata(&vstms_nand_info);
Arnd Bergmann673085f2020-08-06 20:20:45 +0200151 /* 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 Dooks57e51712007-04-20 11:19:16 +0100154 platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices));
Ben Dooksb6c440a2006-09-20 20:32:33 +0100155}
156
157MACHINE_START(VSTMS, "VSTMS")
Nicolas Pitre69d50712011-07-05 22:38:17 -0400158 .atag_offset = 0x100,
Ben Dooksb6c440a2006-09-20 20:32:33 +0100159
160 .fixup = vstms_fixup,
Heiko Stuebner0da09932013-02-12 10:09:18 -0800161 .init_irq = s3c2412_init_irq,
Ben Dooks57e51712007-04-20 11:19:16 +0100162 .init_machine = vstms_init,
Ben Dooksb6c440a2006-09-20 20:32:33 +0100163 .map_io = vstms_map_io,
Heiko Stuebner3c27f312014-02-25 09:50:44 +0900164 .init_time = vstms_init_time,
Ben Dooksb6c440a2006-09-20 20:32:33 +0100165MACHINE_END