Linux 5.6-rc2
[sfrench/cifs-2.6.git] / arch / arm / mach-s3c24xx / mach-vstms.c
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
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>
13 #include <linux/serial_core.h>
14 #include <linux/serial_s3c.h>
15 #include <linux/platform_device.h>
16 #include <linux/io.h>
17 #include <linux/mtd/mtd.h>
18 #include <linux/mtd/rawnand.h>
19 #include <linux/mtd/nand_ecc.h>
20 #include <linux/mtd/partitions.h>
21 #include <linux/memblock.h>
22
23 #include <asm/mach/arch.h>
24 #include <asm/mach/map.h>
25 #include <asm/mach/irq.h>
26
27 #include <mach/hardware.h>
28 #include <asm/setup.h>
29 #include <asm/irq.h>
30 #include <asm/mach-types.h>
31
32 #include <mach/regs-gpio.h>
33 #include <mach/regs-lcd.h>
34
35 #include <mach/fb.h>
36
37 #include <linux/platform_data/i2c-s3c2410.h>
38 #include <linux/platform_data/mtd-nand-s3c2410.h>
39
40 #include <plat/devs.h>
41 #include <plat/cpu.h>
42 #include <plat/samsung-time.h>
43
44 #include "common.h"
45
46 static struct map_desc vstms_iodesc[] __initdata = {
47 };
48
49 static struct s3c2410_uartcfg vstms_uartcfgs[] __initdata = {
50         [0] = {
51                 .hwport      = 0,
52                 .flags       = 0,
53                 .ucon        = 0x3c5,
54                 .ulcon       = 0x03,
55                 .ufcon       = 0x51,
56         },
57         [1] = {
58                 .hwport      = 1,
59                 .flags       = 0,
60                 .ucon        = 0x3c5,
61                 .ulcon       = 0x03,
62                 .ufcon       = 0x51,
63         },
64         [2] = {
65                 .hwport      = 2,
66                 .flags       = 0,
67                 .ucon        = 0x3c5,
68                 .ulcon       = 0x03,
69                 .ufcon       = 0x51,
70         }
71 };
72
73 static struct mtd_partition __initdata vstms_nand_part[] = {
74         [0] = {
75                 .name   = "Boot Agent",
76                 .size   = 0x7C000,
77                 .offset = 0,
78         },
79         [1] = {
80                 .name   = "UBoot Config",
81                 .offset = 0x7C000,
82                 .size   = 0x4000,
83         },
84         [2] = {
85                 .name   = "Kernel",
86                 .offset = 0x80000,
87                 .size   = 0x200000,
88         },
89         [3] = {
90                 .name   = "RFS",
91                 .offset = 0x280000,
92                 .size   = 0x3d80000,
93         },
94 };
95
96 static struct s3c2410_nand_set __initdata vstms_nand_sets[] = {
97         [0] = {
98                 .name           = "NAND",
99                 .nr_chips       = 1,
100                 .nr_partitions  = ARRAY_SIZE(vstms_nand_part),
101                 .partitions     = vstms_nand_part,
102         },
103 };
104
105 /* choose a set of timings which should suit most 512Mbit
106  * chips and beyond.
107 */
108
109 static struct s3c2410_platform_nand __initdata vstms_nand_info = {
110         .tacls          = 20,
111         .twrph0         = 60,
112         .twrph1         = 20,
113         .nr_sets        = ARRAY_SIZE(vstms_nand_sets),
114         .sets           = vstms_nand_sets,
115         .ecc_mode       = NAND_ECC_SOFT,
116 };
117
118 static struct platform_device *vstms_devices[] __initdata = {
119         &s3c_device_ohci,
120         &s3c_device_wdt,
121         &s3c_device_i2c0,
122         &s3c_device_iis,
123         &s3c_device_rtc,
124         &s3c_device_nand,
125         &s3c2412_device_dma,
126 };
127
128 static void __init vstms_fixup(struct tag *tags, char **cmdline)
129 {
130         if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) {
131                 memblock_add(0x30000000, SZ_64M);
132         }
133 }
134
135 static void __init vstms_map_io(void)
136 {
137         s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
138         s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
139         samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
140 }
141
142 static void __init vstms_init_time(void)
143 {
144         s3c2412_init_clocks(12000000);
145         samsung_timer_init();
146 }
147
148 static void __init vstms_init(void)
149 {
150         s3c_i2c0_set_platdata(NULL);
151         s3c_nand_set_platdata(&vstms_nand_info);
152
153         platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices));
154 }
155
156 MACHINE_START(VSTMS, "VSTMS")
157         .atag_offset    = 0x100,
158
159         .fixup          = vstms_fixup,
160         .init_irq       = s3c2412_init_irq,
161         .init_machine   = vstms_init,
162         .map_io         = vstms_map_io,
163         .init_time      = vstms_init_time,
164 MACHINE_END