aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/board-h2.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-h2.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-h2.c')
-rw-r--r--arch/arm/mach-omap1/board-h2.c49
1 files changed, 39 insertions, 10 deletions
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index eeafe6ed15cb..fa7cecea19f9 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -41,7 +41,6 @@
41#include <plat/mux.h> 41#include <plat/mux.h>
42#include <plat/dma.h> 42#include <plat/dma.h>
43#include <plat/tc.h> 43#include <plat/tc.h>
44#include <plat/nand.h>
45#include <plat/irda.h> 44#include <plat/irda.h>
46#include <plat/usb.h> 45#include <plat/usb.h>
47#include <plat/keypad.h> 46#include <plat/keypad.h>
@@ -180,11 +179,43 @@ static struct mtd_partition h2_nand_partitions[] = {
180 }, 179 },
181}; 180};
182 181
183/* dip switches control NAND chip access: 8 bit, 16 bit, or neither */ 182static void h2_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
184static struct omap_nand_platform_data h2_nand_data = { 183{
185 .options = NAND_SAMSUNG_LP_OPTIONS, 184 struct nand_chip *this = mtd->priv;
186 .parts = h2_nand_partitions, 185 unsigned long mask;
187 .nr_parts = ARRAY_SIZE(h2_nand_partitions), 186
187 if (cmd == NAND_CMD_NONE)
188 return;
189
190 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
191 if (ctrl & NAND_ALE)
192 mask |= 0x04;
193 writeb(cmd, (unsigned long)this->IO_ADDR_W | mask);
194}
195
196#define H2_NAND_RB_GPIO_PIN 62
197
198static int h2_nand_dev_ready(struct mtd_info *mtd)
199{
200 return gpio_get_value(H2_NAND_RB_GPIO_PIN);
201}
202
203static const char *h2_part_probes[] = { "cmdlinepart", NULL };
204
205struct platform_nand_data h2_nand_platdata = {
206 .chip = {
207 .nr_chips = 1,
208 .chip_offset = 0,
209 .nr_partitions = ARRAY_SIZE(h2_nand_partitions),
210 .partitions = h2_nand_partitions,
211 .options = NAND_SAMSUNG_LP_OPTIONS,
212 .part_probe_types = h2_part_probes,
213 },
214 .ctrl = {
215 .cmd_ctrl = h2_nand_cmd_ctl,
216 .dev_ready = h2_nand_dev_ready,
217
218 },
188}; 219};
189 220
190static struct resource h2_nand_resource = { 221static struct resource h2_nand_resource = {
@@ -192,10 +223,10 @@ static struct resource h2_nand_resource = {
192}; 223};
193 224
194static struct platform_device h2_nand_device = { 225static struct platform_device h2_nand_device = {
195 .name = "omapnand", 226 .name = "gen_nand",
196 .id = 0, 227 .id = 0,
197 .dev = { 228 .dev = {
198 .platform_data = &h2_nand_data, 229 .platform_data = &h2_nand_platdata,
199 }, 230 },
200 .num_resources = 1, 231 .num_resources = 1,
201 .resource = &h2_nand_resource, 232 .resource = &h2_nand_resource,
@@ -378,8 +409,6 @@ static struct omap_board_config_kernel h2_config[] __initdata = {
378 { OMAP_TAG_LCD, &h2_lcd_config }, 409 { OMAP_TAG_LCD, &h2_lcd_config },
379}; 410};
380 411
381#define H2_NAND_RB_GPIO_PIN 62
382
383static void __init h2_init(void) 412static void __init h2_init(void)
384{ 413{
385 /* Here we assume the NOR boot config: NOR on CS3 (possibly swapped 414 /* Here we assume the NOR boot config: NOR on CS3 (possibly swapped