aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/board-fsample.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-fsample.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-fsample.c')
-rw-r--r--arch/arm/mach-omap1/board-fsample.c50
1 files changed, 37 insertions, 13 deletions
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index 91e7b2f2bc05..7e70c3c08da6 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -31,7 +31,6 @@
31#include <mach/gpio.h> 31#include <mach/gpio.h>
32#include <plat/mux.h> 32#include <plat/mux.h>
33#include <plat/fpga.h> 33#include <plat/fpga.h>
34#include <plat/nand.h>
35#include <plat/keypad.h> 34#include <plat/keypad.h>
36#include <plat/common.h> 35#include <plat/common.h>
37#include <plat/board.h> 36#include <plat/board.h>
@@ -174,8 +173,40 @@ static struct platform_device nor_device = {
174 .resource = &nor_resource, 173 .resource = &nor_resource,
175}; 174};
176 175
177static struct omap_nand_platform_data nand_data = { 176static void nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
178 .options = NAND_SAMSUNG_LP_OPTIONS, 177{
178 struct nand_chip *this = mtd->priv;
179 unsigned long mask;
180
181 if (cmd == NAND_CMD_NONE)
182 return;
183
184 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
185 if (ctrl & NAND_ALE)
186 mask |= 0x04;
187 writeb(cmd, (unsigned long)this->IO_ADDR_W | mask);
188}
189
190#define FSAMPLE_NAND_RB_GPIO_PIN 62
191
192static int nand_dev_ready(struct mtd_info *mtd)
193{
194 return gpio_get_value(FSAMPLE_NAND_RB_GPIO_PIN);
195}
196
197static const char *part_probes[] = { "cmdlinepart", NULL };
198
199static struct platform_nand_data nand_data = {
200 .chip = {
201 .nr_chips = 1,
202 .chip_offset = 0,
203 .options = NAND_SAMSUNG_LP_OPTIONS,
204 .part_probe_types = part_probes,
205 },
206 .ctrl = {
207 .cmd_ctrl = nand_cmd_ctl,
208 .dev_ready = nand_dev_ready,
209 },
179}; 210};
180 211
181static struct resource nand_resource = { 212static struct resource nand_resource = {
@@ -185,7 +216,7 @@ static struct resource nand_resource = {
185}; 216};
186 217
187static struct platform_device nand_device = { 218static struct platform_device nand_device = {
188 .name = "omapnand", 219 .name = "gen_nand",
189 .id = 0, 220 .id = 0,
190 .dev = { 221 .dev = {
191 .platform_data = &nand_data, 222 .platform_data = &nand_data,
@@ -243,13 +274,6 @@ static struct platform_device *devices[] __initdata = {
243 &lcd_device, 274 &lcd_device,
244}; 275};
245 276
246#define P2_NAND_RB_GPIO_PIN 62
247
248static int nand_dev_ready(struct omap_nand_platform_data *data)
249{
250 return gpio_get_value(P2_NAND_RB_GPIO_PIN);
251}
252
253static struct omap_lcd_config fsample_lcd_config __initdata = { 277static struct omap_lcd_config fsample_lcd_config __initdata = {
254 .ctrl_name = "internal", 278 .ctrl_name = "internal",
255}; 279};
@@ -260,9 +284,9 @@ static struct omap_board_config_kernel fsample_config[] = {
260 284
261static void __init omap_fsample_init(void) 285static void __init omap_fsample_init(void)
262{ 286{
263 if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0) 287 if (gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, "NAND ready") < 0)
264 BUG(); 288 BUG();
265 nand_data.dev_ready = nand_dev_ready; 289 gpio_direction_input(FSAMPLE_NAND_RB_GPIO_PIN);
266 290
267 omap_cfg_reg(L3_1610_FLASH_CS2B_OE); 291 omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
268 omap_cfg_reg(M8_1610_FLASH_CS2B_WE); 292 omap_cfg_reg(M8_1610_FLASH_CS2B_WE);