]> Git Repo - linux.git/blob - arch/arm/mach-s3c24xx/common-smdk.c
enetc: Migrate to PHYLINK and PCS_LYNX
[linux.git] / arch / arm / mach-s3c24xx / common-smdk.c
1 // SPDX-License-Identifier: GPL-2.0
2 //
3 // Copyright (c) 2006 Simtec Electronics
4 //      Ben Dooks <[email protected]>
5 //
6 // Common code for SMDK2410 and SMDK2440 boards
7 //
8 // http://www.fluff.org/ben/smdk2440/
9
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>
20
21 #include <linux/mtd/mtd.h>
22 #include <linux/mtd/rawnand.h>
23 #include <linux/mtd/nand_ecc.h>
24 #include <linux/mtd/partitions.h>
25 #include <linux/io.h>
26
27 #include <asm/mach/arch.h>
28 #include <asm/mach/map.h>
29 #include <asm/mach/irq.h>
30
31 #include <asm/mach-types.h>
32 #include <mach/hardware.h>
33 #include <asm/irq.h>
34
35 #include <mach/regs-gpio.h>
36 #include <mach/gpio-samsung.h>
37 #include <linux/platform_data/leds-s3c24xx.h>
38 #include <linux/platform_data/mtd-nand-s3c2410.h>
39
40 #include <plat/gpio-cfg.h>
41 #include <plat/devs.h>
42 #include <plat/pm.h>
43
44 #include "common-smdk.h"
45
46 /* LED devices */
47
48 static struct gpiod_lookup_table smdk_led4_gpio_table = {
49         .dev_id = "s3c24xx_led.0",
50         .table = {
51                 GPIO_LOOKUP("GPF", 4, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
52                 { },
53         },
54 };
55
56 static struct gpiod_lookup_table smdk_led5_gpio_table = {
57         .dev_id = "s3c24xx_led.1",
58         .table = {
59                 GPIO_LOOKUP("GPF", 5, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
60                 { },
61         },
62 };
63
64 static struct gpiod_lookup_table smdk_led6_gpio_table = {
65         .dev_id = "s3c24xx_led.2",
66         .table = {
67                 GPIO_LOOKUP("GPF", 6, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
68                 { },
69         },
70 };
71
72 static struct gpiod_lookup_table smdk_led7_gpio_table = {
73         .dev_id = "s3c24xx_led.3",
74         .table = {
75                 GPIO_LOOKUP("GPF", 7, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
76                 { },
77         },
78 };
79
80 static struct s3c24xx_led_platdata smdk_pdata_led4 = {
81         .name           = "led4",
82         .def_trigger    = "timer",
83 };
84
85 static struct s3c24xx_led_platdata smdk_pdata_led5 = {
86         .name           = "led5",
87         .def_trigger    = "nand-disk",
88 };
89
90 static struct s3c24xx_led_platdata smdk_pdata_led6 = {
91         .name           = "led6",
92 };
93
94 static struct s3c24xx_led_platdata smdk_pdata_led7 = {
95         .name           = "led7",
96 };
97
98 static struct platform_device smdk_led4 = {
99         .name           = "s3c24xx_led",
100         .id             = 0,
101         .dev            = {
102                 .platform_data = &smdk_pdata_led4,
103         },
104 };
105
106 static struct platform_device smdk_led5 = {
107         .name           = "s3c24xx_led",
108         .id             = 1,
109         .dev            = {
110                 .platform_data = &smdk_pdata_led5,
111         },
112 };
113
114 static struct platform_device smdk_led6 = {
115         .name           = "s3c24xx_led",
116         .id             = 2,
117         .dev            = {
118                 .platform_data = &smdk_pdata_led6,
119         },
120 };
121
122 static struct platform_device smdk_led7 = {
123         .name           = "s3c24xx_led",
124         .id             = 3,
125         .dev            = {
126                 .platform_data = &smdk_pdata_led7,
127         },
128 };
129
130 /* NAND parititon from 2.4.18-swl5 */
131
132 static struct mtd_partition smdk_default_nand_part[] = {
133         [0] = {
134                 .name   = "Boot Agent",
135                 .size   = SZ_16K,
136                 .offset = 0,
137         },
138         [1] = {
139                 .name   = "S3C2410 flash partition 1",
140                 .offset = 0,
141                 .size   = SZ_2M,
142         },
143         [2] = {
144                 .name   = "S3C2410 flash partition 2",
145                 .offset = SZ_4M,
146                 .size   = SZ_4M,
147         },
148         [3] = {
149                 .name   = "S3C2410 flash partition 3",
150                 .offset = SZ_8M,
151                 .size   = SZ_2M,
152         },
153         [4] = {
154                 .name   = "S3C2410 flash partition 4",
155                 .offset = SZ_1M * 10,
156                 .size   = SZ_4M,
157         },
158         [5] = {
159                 .name   = "S3C2410 flash partition 5",
160                 .offset = SZ_1M * 14,
161                 .size   = SZ_1M * 10,
162         },
163         [6] = {
164                 .name   = "S3C2410 flash partition 6",
165                 .offset = SZ_1M * 24,
166                 .size   = SZ_1M * 24,
167         },
168         [7] = {
169                 .name   = "S3C2410 flash partition 7",
170                 .offset = SZ_1M * 48,
171                 .size   = MTDPART_SIZ_FULL,
172         }
173 };
174
175 static struct s3c2410_nand_set smdk_nand_sets[] = {
176         [0] = {
177                 .name           = "NAND",
178                 .nr_chips       = 1,
179                 .nr_partitions  = ARRAY_SIZE(smdk_default_nand_part),
180                 .partitions     = smdk_default_nand_part,
181         },
182 };
183
184 /* choose a set of timings which should suit most 512Mbit
185  * chips and beyond.
186 */
187
188 static struct s3c2410_platform_nand smdk_nand_info = {
189         .tacls          = 20,
190         .twrph0         = 60,
191         .twrph1         = 20,
192         .nr_sets        = ARRAY_SIZE(smdk_nand_sets),
193         .sets           = smdk_nand_sets,
194         .ecc_mode       = NAND_ECC_SOFT,
195 };
196
197 /* devices we initialise */
198
199 static struct platform_device __initdata *smdk_devs[] = {
200         &s3c_device_nand,
201         &smdk_led4,
202         &smdk_led5,
203         &smdk_led6,
204         &smdk_led7,
205 };
206
207 void __init smdk_machine_init(void)
208 {
209         if (machine_is_smdk2443())
210                 smdk_nand_info.twrph0 = 50;
211
212         s3c_nand_set_platdata(&smdk_nand_info);
213
214         /* Disable pull-up on the LED lines */
215         s3c_gpio_setpull(S3C2410_GPF(4), S3C_GPIO_PULL_NONE);
216         s3c_gpio_setpull(S3C2410_GPF(5), S3C_GPIO_PULL_NONE);
217         s3c_gpio_setpull(S3C2410_GPF(6), S3C_GPIO_PULL_NONE);
218         s3c_gpio_setpull(S3C2410_GPF(7), S3C_GPIO_PULL_NONE);
219
220         /* Add lookups for the lines */
221         gpiod_add_lookup_table(&smdk_led4_gpio_table);
222         gpiod_add_lookup_table(&smdk_led5_gpio_table);
223         gpiod_add_lookup_table(&smdk_led6_gpio_table);
224         gpiod_add_lookup_table(&smdk_led7_gpio_table);
225
226         platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs));
227
228         s3c_pm_init();
229 }
This page took 0.044674 seconds and 4 git commands to generate.