aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/board-h3.c
diff options
context:
space:
mode:
authorLadislav Michl <ladis@linux-mips.org>2009-12-11 19:16:33 -0500
committerTony Lindgren <tony@atomide.com>2009-12-11 19:16:33 -0500
commit414f552ad872e19a7471644317a60f3cbba25ced (patch)
tree441f388dffb45868e3898893aa1b22e2a3a60f59 /arch/arm/mach-omap1/board-h3.c
parente2b18e3018630d80eda54508e697d613283d57ac (diff)
omap1: Use gen_nand
Since omapnand driver never find its way into mainline, switch to gen_nand instead. Following patch is compile tested only, but it is based on code I wrote for NetStar board and runtime tested it there. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Cc: Imre Deak <imre.deak@nokia.com> Cc: Brian Swetland <swetland@google.com> Cc: Kevin Hilman <kjh@hilman.org> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap1/board-h3.c')
-rw-r--r--arch/arm/mach-omap1/board-h3.c56
1 files changed, 40 insertions, 16 deletions
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index e0aee66e43e6..6a7f9c391cf1 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -43,7 +43,6 @@
43#include <mach/irqs.h> 43#include <mach/irqs.h>
44#include <plat/mux.h> 44#include <plat/mux.h>
45#include <plat/tc.h> 45#include <plat/tc.h>
46#include <plat/nand.h>
47#include <plat/usb.h> 46#include <plat/usb.h>
48#include <plat/keypad.h> 47#include <plat/keypad.h>
49#include <plat/dma.h> 48#include <plat/dma.h>
@@ -182,11 +181,43 @@ static struct mtd_partition nand_partitions[] = {
182 }, 181 },
183}; 182};
184 183
185/* dip switches control NAND chip access: 8 bit, 16 bit, or neither */ 184static void nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
186static struct omap_nand_platform_data nand_data = { 185{
187 .options = NAND_SAMSUNG_LP_OPTIONS, 186 struct nand_chip *this = mtd->priv;
188 .parts = nand_partitions, 187 unsigned long mask;
189 .nr_parts = ARRAY_SIZE(nand_partitions), 188
189 if (cmd == NAND_CMD_NONE)
190 return;
191
192 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
193 if (ctrl & NAND_ALE)
194 mask |= 0x04;
195 writeb(cmd, (unsigned long)this->IO_ADDR_W | mask);
196}
197
198#define H3_NAND_RB_GPIO_PIN 10
199
200static int nand_dev_ready(struct mtd_info *mtd)
201{
202 return gpio_get_value(H3_NAND_RB_GPIO_PIN);
203}
204
205static const char *part_probes[] = { "cmdlinepart", NULL };
206
207struct platform_nand_data nand_platdata = {
208 .chip = {
209 .nr_chips = 1,
210 .chip_offset = 0,
211 .nr_partitions = ARRAY_SIZE(nand_partitions),
212 .partitions = nand_partitions,
213 .options = NAND_SAMSUNG_LP_OPTIONS,
214 .part_probe_types = part_probes,
215 },
216 .ctrl = {
217 .cmd_ctrl = nand_cmd_ctl,
218 .dev_ready = nand_dev_ready,
219
220 },
190}; 221};
191 222
192static struct resource nand_resource = { 223static struct resource nand_resource = {
@@ -194,10 +225,10 @@ static struct resource nand_resource = {
194}; 225};
195 226
196static struct platform_device nand_device = { 227static struct platform_device nand_device = {
197 .name = "omapnand", 228 .name = "gen_nand",
198 .id = 0, 229 .id = 0,
199 .dev = { 230 .dev = {
200 .platform_data = &nand_data, 231 .platform_data = &nand_platdata,
201 }, 232 },
202 .num_resources = 1, 233 .num_resources = 1,
203 .resource = &nand_resource, 234 .resource = &nand_resource,
@@ -342,13 +373,6 @@ static struct i2c_board_info __initdata h3_i2c_board_info[] = {
342 }, 373 },
343}; 374};
344 375
345#define H3_NAND_RB_GPIO_PIN 10
346
347static int nand_dev_ready(struct omap_nand_platform_data *data)
348{
349 return gpio_get_value(H3_NAND_RB_GPIO_PIN);
350}
351
352static void __init h3_init(void) 376static void __init h3_init(void)
353{ 377{
354 /* Here we assume the NOR boot config: NOR on CS3 (possibly swapped 378 /* Here we assume the NOR boot config: NOR on CS3 (possibly swapped
@@ -366,7 +390,7 @@ static void __init h3_init(void)
366 nand_resource.end += SZ_4K - 1; 390 nand_resource.end += SZ_4K - 1;
367 if (gpio_request(H3_NAND_RB_GPIO_PIN, "NAND ready") < 0) 391 if (gpio_request(H3_NAND_RB_GPIO_PIN, "NAND ready") < 0)
368 BUG(); 392 BUG();
369 nand_data.dev_ready = nand_dev_ready; 393 gpio_direction_input(H3_NAND_RB_GPIO_PIN);
370 394
371 /* GPIO10 Func_MUX_CTRL reg bit 29:27, Configure V2 to mode1 as GPIO */ 395 /* GPIO10 Func_MUX_CTRL reg bit 29:27, Configure V2 to mode1 as GPIO */
372 /* GPIO10 pullup/down register, Enable pullup on GPIO10 */ 396 /* GPIO10 pullup/down register, Enable pullup on GPIO10 */