blob: 1dd60a689ae51eaa56335e2148dbb76557cf7179 [file] [log] [blame]
Ben Dooksa21765a2007-02-11 18:31:01 +01001/* linux/arch/arm/plat-s3c24xx/common-smdk.c
Ben Dooksd3f4c572006-04-01 18:33:42 +01002 *
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/
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/interrupt.h>
18#include <linux/list.h>
19#include <linux/timer.h>
20#include <linux/init.h>
Ben Dooks333a42e2007-05-20 11:55:53 +010021#include <linux/sysdev.h>
Ben Dooksd3f4c572006-04-01 18:33:42 +010022#include <linux/platform_device.h>
23
Ben Dooksdee9b2e2006-04-02 10:00:09 +010024#include <linux/mtd/mtd.h>
25#include <linux/mtd/nand.h>
26#include <linux/mtd/nand_ecc.h>
27#include <linux/mtd/partitions.h>
28
Ben Dooksd3f4c572006-04-01 18:33:42 +010029#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31#include <asm/mach/irq.h>
32
33#include <asm/hardware.h>
34#include <asm/io.h>
35#include <asm/irq.h>
Ben Dooksd3f4c572006-04-01 18:33:42 +010036
37#include <asm/arch/regs-gpio.h>
Ben Dooks810c8942006-06-18 22:56:37 +010038#include <asm/arch/leds-gpio.h>
Ben Dooksd3f4c572006-04-01 18:33:42 +010039
Ben Dooksdee9b2e2006-04-02 10:00:09 +010040#include <asm/arch/nand.h>
41
Ben Dooksa21765a2007-02-11 18:31:01 +010042#include <asm/plat-s3c24xx/common-smdk.h>
43#include <asm/plat-s3c24xx/devs.h>
44#include <asm/plat-s3c24xx/pm.h>
Ben Dooksd3f4c572006-04-01 18:33:42 +010045
Ben Dooks810c8942006-06-18 22:56:37 +010046/* LED devices */
47
48static struct s3c24xx_led_platdata smdk_pdata_led4 = {
49 .gpio = S3C2410_GPF4,
50 .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
51 .name = "led4",
52 .def_trigger = "timer",
53};
54
55static struct s3c24xx_led_platdata smdk_pdata_led5 = {
56 .gpio = S3C2410_GPF5,
57 .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
58 .name = "led5",
59 .def_trigger = "nand-disk",
60};
61
62static struct s3c24xx_led_platdata smdk_pdata_led6 = {
63 .gpio = S3C2410_GPF6,
64 .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
65 .name = "led6",
66};
67
68static struct s3c24xx_led_platdata smdk_pdata_led7 = {
69 .gpio = S3C2410_GPF7,
70 .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
71 .name = "led7",
72};
73
74static struct platform_device smdk_led4 = {
75 .name = "s3c24xx_led",
76 .id = 0,
77 .dev = {
78 .platform_data = &smdk_pdata_led4,
79 },
80};
81
82static struct platform_device smdk_led5 = {
83 .name = "s3c24xx_led",
84 .id = 1,
85 .dev = {
86 .platform_data = &smdk_pdata_led5,
87 },
88};
89
90static struct platform_device smdk_led6 = {
91 .name = "s3c24xx_led",
92 .id = 2,
93 .dev = {
94 .platform_data = &smdk_pdata_led6,
95 },
96};
97
98static struct platform_device smdk_led7 = {
99 .name = "s3c24xx_led",
100 .id = 3,
101 .dev = {
102 .platform_data = &smdk_pdata_led7,
103 },
104};
105
Ben Dooksdee9b2e2006-04-02 10:00:09 +0100106/* NAND parititon from 2.4.18-swl5 */
107
108static struct mtd_partition smdk_default_nand_part[] = {
109 [0] = {
110 .name = "Boot Agent",
111 .size = SZ_16K,
112 .offset = 0,
113 },
114 [1] = {
Ben Dooksf6835542006-04-13 09:57:15 +0100115 .name = "S3C2410 flash partition 1",
Ben Dooksdee9b2e2006-04-02 10:00:09 +0100116 .offset = 0,
117 .size = SZ_2M,
118 },
119 [2] = {
120 .name = "S3C2410 flash partition 2",
121 .offset = SZ_4M,
122 .size = SZ_4M,
123 },
124 [3] = {
125 .name = "S3C2410 flash partition 3",
126 .offset = SZ_8M,
127 .size = SZ_2M,
128 },
129 [4] = {
130 .name = "S3C2410 flash partition 4",
131 .offset = SZ_1M * 10,
132 .size = SZ_4M,
133 },
134 [5] = {
135 .name = "S3C2410 flash partition 5",
136 .offset = SZ_1M * 14,
137 .size = SZ_1M * 10,
138 },
139 [6] = {
140 .name = "S3C2410 flash partition 6",
141 .offset = SZ_1M * 24,
142 .size = SZ_1M * 24,
143 },
144 [7] = {
145 .name = "S3C2410 flash partition 7",
146 .offset = SZ_1M * 48,
147 .size = SZ_16M,
148 }
149};
150
151static struct s3c2410_nand_set smdk_nand_sets[] = {
152 [0] = {
153 .name = "NAND",
154 .nr_chips = 1,
155 .nr_partitions = ARRAY_SIZE(smdk_default_nand_part),
156 .partitions = smdk_default_nand_part,
157 },
158};
159
160/* choose a set of timings which should suit most 512Mbit
161 * chips and beyond.
162*/
163
164static struct s3c2410_platform_nand smdk_nand_info = {
165 .tacls = 20,
166 .twrph0 = 60,
167 .twrph1 = 20,
168 .nr_sets = ARRAY_SIZE(smdk_nand_sets),
169 .sets = smdk_nand_sets,
170};
171
172/* devices we initialise */
173
174static struct platform_device __initdata *smdk_devs[] = {
175 &s3c_device_nand,
Ben Dooks810c8942006-06-18 22:56:37 +0100176 &smdk_led4,
177 &smdk_led5,
178 &smdk_led6,
179 &smdk_led7,
Ben Dooksdee9b2e2006-04-02 10:00:09 +0100180};
181
Ben Dooksd3f4c572006-04-01 18:33:42 +0100182void __init smdk_machine_init(void)
183{
184 /* Configure the LEDs (even if we have no LED support)*/
185
186 s3c2410_gpio_cfgpin(S3C2410_GPF4, S3C2410_GPF4_OUTP);
187 s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
188 s3c2410_gpio_cfgpin(S3C2410_GPF6, S3C2410_GPF6_OUTP);
189 s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPF7_OUTP);
190
Ben Dooks66ce2292006-04-02 10:00:08 +0100191 s3c2410_gpio_setpin(S3C2410_GPF4, 1);
192 s3c2410_gpio_setpin(S3C2410_GPF5, 1);
193 s3c2410_gpio_setpin(S3C2410_GPF6, 1);
194 s3c2410_gpio_setpin(S3C2410_GPF7, 1);
Ben Dooksd3f4c572006-04-01 18:33:42 +0100195
Ben Dooksdee9b2e2006-04-02 10:00:09 +0100196 s3c_device_nand.dev.platform_data = &smdk_nand_info;
197
198 platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs));
199
Ben Dooksd3f4c572006-04-01 18:33:42 +0100200 s3c2410_pm_init();
201}