1 // SPDX-License-Identifier: GPL-2.0
3 // Copyright (c) 2006 Simtec Electronics
4 // Ben Dooks <ben@simtec.co.uk>
6 // Common code for SMDK2410 and SMDK2440 boards
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/gpio/machine.h>
18 #include <linux/device.h>
19 #include <linux/platform_device.h>
21 #include <linux/mtd/mtd.h>
22 #include <linux/mtd/rawnand.h>
23 #include <linux/mtd/nand-ecc-sw-hamming.h>
24 #include <linux/mtd/partitions.h>
27 #include <asm/mach/arch.h>
28 #include <asm/mach/map.h>
29 #include <asm/mach/irq.h>
31 #include <asm/mach-types.h>
34 #include "regs-gpio.h"
35 #include "gpio-samsung.h"
36 #include <linux/platform_data/leds-s3c24xx.h>
37 #include <linux/platform_data/mtd-nand-s3c2410.h>
43 #include "common-smdk-s3c24xx.h"
47 static struct gpiod_lookup_table smdk_led4_gpio_table
= {
48 .dev_id
= "s3c24xx_led.0",
50 GPIO_LOOKUP("GPF", 4, NULL
, GPIO_ACTIVE_LOW
| GPIO_OPEN_DRAIN
),
55 static struct gpiod_lookup_table smdk_led5_gpio_table
= {
56 .dev_id
= "s3c24xx_led.1",
58 GPIO_LOOKUP("GPF", 5, NULL
, GPIO_ACTIVE_LOW
| GPIO_OPEN_DRAIN
),
63 static struct gpiod_lookup_table smdk_led6_gpio_table
= {
64 .dev_id
= "s3c24xx_led.2",
66 GPIO_LOOKUP("GPF", 6, NULL
, GPIO_ACTIVE_LOW
| GPIO_OPEN_DRAIN
),
71 static struct gpiod_lookup_table smdk_led7_gpio_table
= {
72 .dev_id
= "s3c24xx_led.3",
74 GPIO_LOOKUP("GPF", 7, NULL
, GPIO_ACTIVE_LOW
| GPIO_OPEN_DRAIN
),
79 static struct s3c24xx_led_platdata smdk_pdata_led4
= {
81 .def_trigger
= "timer",
84 static struct s3c24xx_led_platdata smdk_pdata_led5
= {
86 .def_trigger
= "nand-disk",
89 static struct s3c24xx_led_platdata smdk_pdata_led6
= {
93 static struct s3c24xx_led_platdata smdk_pdata_led7
= {
97 static struct platform_device smdk_led4
= {
98 .name
= "s3c24xx_led",
101 .platform_data
= &smdk_pdata_led4
,
105 static struct platform_device smdk_led5
= {
106 .name
= "s3c24xx_led",
109 .platform_data
= &smdk_pdata_led5
,
113 static struct platform_device smdk_led6
= {
114 .name
= "s3c24xx_led",
117 .platform_data
= &smdk_pdata_led6
,
121 static struct platform_device smdk_led7
= {
122 .name
= "s3c24xx_led",
125 .platform_data
= &smdk_pdata_led7
,
129 /* NAND parititon from 2.4.18-swl5 */
131 static struct mtd_partition smdk_default_nand_part
[] = {
133 .name
= "Boot Agent",
138 .name
= "S3C2410 flash partition 1",
143 .name
= "S3C2410 flash partition 2",
148 .name
= "S3C2410 flash partition 3",
153 .name
= "S3C2410 flash partition 4",
154 .offset
= SZ_1M
* 10,
158 .name
= "S3C2410 flash partition 5",
159 .offset
= SZ_1M
* 14,
163 .name
= "S3C2410 flash partition 6",
164 .offset
= SZ_1M
* 24,
168 .name
= "S3C2410 flash partition 7",
169 .offset
= SZ_1M
* 48,
170 .size
= MTDPART_SIZ_FULL
,
174 static struct s3c2410_nand_set smdk_nand_sets
[] = {
178 .nr_partitions
= ARRAY_SIZE(smdk_default_nand_part
),
179 .partitions
= smdk_default_nand_part
,
183 /* choose a set of timings which should suit most 512Mbit
187 static struct s3c2410_platform_nand smdk_nand_info
= {
191 .nr_sets
= ARRAY_SIZE(smdk_nand_sets
),
192 .sets
= smdk_nand_sets
,
193 .engine_type
= NAND_ECC_ENGINE_TYPE_SOFT
,
196 /* devices we initialise */
198 static struct platform_device __initdata
*smdk_devs
[] = {
206 void __init
smdk_machine_init(void)
208 if (machine_is_smdk2443())
209 smdk_nand_info
.twrph0
= 50;
211 s3c_nand_set_platdata(&smdk_nand_info
);
213 /* Disable pull-up on the LED lines */
214 s3c_gpio_setpull(S3C2410_GPF(4), S3C_GPIO_PULL_NONE
);
215 s3c_gpio_setpull(S3C2410_GPF(5), S3C_GPIO_PULL_NONE
);
216 s3c_gpio_setpull(S3C2410_GPF(6), S3C_GPIO_PULL_NONE
);
217 s3c_gpio_setpull(S3C2410_GPF(7), S3C_GPIO_PULL_NONE
);
219 /* Add lookups for the lines */
220 gpiod_add_lookup_table(&smdk_led4_gpio_table
);
221 gpiod_add_lookup_table(&smdk_led5_gpio_table
);
222 gpiod_add_lookup_table(&smdk_led6_gpio_table
);
223 gpiod_add_lookup_table(&smdk_led7_gpio_table
);
225 platform_add_devices(smdk_devs
, ARRAY_SIZE(smdk_devs
));