Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / arm / mach-s3c24xx / common-smdk.c
blob58e30cad386c0717b765ea044fecf43ed3401f23
1 // SPDX-License-Identifier: GPL-2.0
2 //
3 // Copyright (c) 2006 Simtec Electronics
4 // Ben Dooks <ben@simtec.co.uk>
5 //
6 // Common code for SMDK2410 and SMDK2440 boards
7 //
8 // http://www.fluff.org/ben/smdk2440/
10 #include <linux/kernel.h>
11 #include <linux/types.h>
12 #include <linux/interrupt.h>
13 #include <linux/list.h>
14 #include <linux/timer.h>
15 #include <linux/init.h>
16 #include <linux/gpio.h>
17 #include <linux/device.h>
18 #include <linux/platform_device.h>
20 #include <linux/mtd/mtd.h>
21 #include <linux/mtd/rawnand.h>
22 #include <linux/mtd/nand_ecc.h>
23 #include <linux/mtd/partitions.h>
24 #include <linux/io.h>
26 #include <asm/mach/arch.h>
27 #include <asm/mach/map.h>
28 #include <asm/mach/irq.h>
30 #include <asm/mach-types.h>
31 #include <mach/hardware.h>
32 #include <asm/irq.h>
34 #include <mach/regs-gpio.h>
35 #include <mach/gpio-samsung.h>
36 #include <linux/platform_data/leds-s3c24xx.h>
37 #include <linux/platform_data/mtd-nand-s3c2410.h>
39 #include <plat/gpio-cfg.h>
40 #include <plat/devs.h>
41 #include <plat/pm.h>
43 #include "common-smdk.h"
45 /* LED devices */
47 static struct s3c24xx_led_platdata smdk_pdata_led4 = {
48 .gpio = S3C2410_GPF(4),
49 .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
50 .name = "led4",
51 .def_trigger = "timer",
54 static struct s3c24xx_led_platdata smdk_pdata_led5 = {
55 .gpio = S3C2410_GPF(5),
56 .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
57 .name = "led5",
58 .def_trigger = "nand-disk",
61 static struct s3c24xx_led_platdata smdk_pdata_led6 = {
62 .gpio = S3C2410_GPF(6),
63 .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
64 .name = "led6",
67 static struct s3c24xx_led_platdata smdk_pdata_led7 = {
68 .gpio = S3C2410_GPF(7),
69 .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
70 .name = "led7",
73 static struct platform_device smdk_led4 = {
74 .name = "s3c24xx_led",
75 .id = 0,
76 .dev = {
77 .platform_data = &smdk_pdata_led4,
81 static struct platform_device smdk_led5 = {
82 .name = "s3c24xx_led",
83 .id = 1,
84 .dev = {
85 .platform_data = &smdk_pdata_led5,
89 static struct platform_device smdk_led6 = {
90 .name = "s3c24xx_led",
91 .id = 2,
92 .dev = {
93 .platform_data = &smdk_pdata_led6,
97 static struct platform_device smdk_led7 = {
98 .name = "s3c24xx_led",
99 .id = 3,
100 .dev = {
101 .platform_data = &smdk_pdata_led7,
105 /* NAND parititon from 2.4.18-swl5 */
107 static struct mtd_partition smdk_default_nand_part[] = {
108 [0] = {
109 .name = "Boot Agent",
110 .size = SZ_16K,
111 .offset = 0,
113 [1] = {
114 .name = "S3C2410 flash partition 1",
115 .offset = 0,
116 .size = SZ_2M,
118 [2] = {
119 .name = "S3C2410 flash partition 2",
120 .offset = SZ_4M,
121 .size = SZ_4M,
123 [3] = {
124 .name = "S3C2410 flash partition 3",
125 .offset = SZ_8M,
126 .size = SZ_2M,
128 [4] = {
129 .name = "S3C2410 flash partition 4",
130 .offset = SZ_1M * 10,
131 .size = SZ_4M,
133 [5] = {
134 .name = "S3C2410 flash partition 5",
135 .offset = SZ_1M * 14,
136 .size = SZ_1M * 10,
138 [6] = {
139 .name = "S3C2410 flash partition 6",
140 .offset = SZ_1M * 24,
141 .size = SZ_1M * 24,
143 [7] = {
144 .name = "S3C2410 flash partition 7",
145 .offset = SZ_1M * 48,
146 .size = MTDPART_SIZ_FULL,
150 static struct s3c2410_nand_set smdk_nand_sets[] = {
151 [0] = {
152 .name = "NAND",
153 .nr_chips = 1,
154 .nr_partitions = ARRAY_SIZE(smdk_default_nand_part),
155 .partitions = smdk_default_nand_part,
159 /* choose a set of timings which should suit most 512Mbit
160 * chips and beyond.
163 static struct s3c2410_platform_nand smdk_nand_info = {
164 .tacls = 20,
165 .twrph0 = 60,
166 .twrph1 = 20,
167 .nr_sets = ARRAY_SIZE(smdk_nand_sets),
168 .sets = smdk_nand_sets,
169 .ecc_mode = NAND_ECC_SOFT,
172 /* devices we initialise */
174 static struct platform_device __initdata *smdk_devs[] = {
175 &s3c_device_nand,
176 &smdk_led4,
177 &smdk_led5,
178 &smdk_led6,
179 &smdk_led7,
182 static const struct gpio smdk_led_gpios[] = {
183 { S3C2410_GPF(4), GPIOF_OUT_INIT_HIGH, NULL },
184 { S3C2410_GPF(5), GPIOF_OUT_INIT_HIGH, NULL },
185 { S3C2410_GPF(6), GPIOF_OUT_INIT_HIGH, NULL },
186 { S3C2410_GPF(7), GPIOF_OUT_INIT_HIGH, NULL },
189 void __init smdk_machine_init(void)
191 /* Configure the LEDs (even if we have no LED support)*/
193 int ret = gpio_request_array(smdk_led_gpios,
194 ARRAY_SIZE(smdk_led_gpios));
195 if (!WARN_ON(ret < 0))
196 gpio_free_array(smdk_led_gpios, ARRAY_SIZE(smdk_led_gpios));
198 if (machine_is_smdk2443())
199 smdk_nand_info.twrph0 = 50;
201 s3c_nand_set_platdata(&smdk_nand_info);
203 platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs));
205 s3c_pm_init();