aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut@gmail.com>2009-07-18 10:51:41 -0400
committerEric Miao <eric.y.miao@gmail.com>2009-09-10 06:49:35 -0400
commit3eb37ff06ba189ce386d582179fc9abd37a92405 (patch)
treedb113f5794417d7b04730e7cbd3b427e506392a6 /arch/arm
parentd7c307cfe76ae0c0493fbdac417ef6e30221f61b (diff)
[ARM] pxa/palm: add NAND Flash support for PalmTX
This patch adds support for NAND chip found in PalmTX handheld. Support is implemented through the gen_nand driver. Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-pxa/include/mach/palmtx.h5
-rw-r--r--arch/arm/mach-pxa/palmtx.c83
2 files changed, 86 insertions, 2 deletions
diff --git a/arch/arm/mach-pxa/include/mach/palmtx.h b/arch/arm/mach-pxa/include/mach/palmtx.h
index e74082c872e1..1be0db6ed55e 100644
--- a/arch/arm/mach-pxa/include/mach/palmtx.h
+++ b/arch/arm/mach-pxa/include/mach/palmtx.h
@@ -82,6 +82,11 @@
82#define PALMTX_PHYS_FLASH_START PXA_CS0_PHYS /* ChipSelect 0 */ 82#define PALMTX_PHYS_FLASH_START PXA_CS0_PHYS /* ChipSelect 0 */
83#define PALMTX_PHYS_NAND_START PXA_CS1_PHYS /* ChipSelect 1 */ 83#define PALMTX_PHYS_NAND_START PXA_CS1_PHYS /* ChipSelect 1 */
84 84
85#define PALMTX_NAND_ALE_PHYS (PALMTX_PHYS_NAND_START | (1 << 24))
86#define PALMTX_NAND_CLE_PHYS (PALMTX_PHYS_NAND_START | (1 << 25))
87#define PALMTX_NAND_ALE_VIRT 0xff100000
88#define PALMTX_NAND_CLE_VIRT 0xff200000
89
85/* TOUCHSCREEN */ 90/* TOUCHSCREEN */
86#define AC97_LINK_FRAME 21 91#define AC97_LINK_FRAME 21
87 92
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
index fffa32a6fa3f..052f99863dab 100644
--- a/arch/arm/mach-pxa/palmtx.c
+++ b/arch/arm/mach-pxa/palmtx.c
@@ -28,6 +28,8 @@
28#include <linux/wm97xx_batt.h> 28#include <linux/wm97xx_batt.h>
29#include <linux/power_supply.h> 29#include <linux/power_supply.h>
30#include <linux/usb/gpio_vbus.h> 30#include <linux/usb/gpio_vbus.h>
31#include <linux/mtd/nand.h>
32#include <linux/mtd/partitions.h>
31 33
32#include <asm/mach-types.h> 34#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
@@ -131,6 +133,10 @@ static unsigned long palmtx_pin_config[] __initdata = {
131 GPIO34_FFUART_RXD, 133 GPIO34_FFUART_RXD,
132 GPIO39_FFUART_TXD, 134 GPIO39_FFUART_TXD,
133 135
136 /* NAND */
137 GPIO15_nCS_1,
138 GPIO18_RDY,
139
134 /* MISC. */ 140 /* MISC. */
135 GPIO10_GPIO, /* hotsync button */ 141 GPIO10_GPIO, /* hotsync button */
136 GPIO12_GPIO, /* power detect */ 142 GPIO12_GPIO, /* power detect */
@@ -422,6 +428,68 @@ static struct pxafb_mach_info palmtx_lcd_screen = {
422}; 428};
423 429
424/****************************************************************************** 430/******************************************************************************
431 * NAND Flash
432 ******************************************************************************/
433static void palmtx_nand_cmd_ctl(struct mtd_info *mtd, int cmd,
434 unsigned int ctrl)
435{
436 struct nand_chip *this = mtd->priv;
437 unsigned long nandaddr = (unsigned long)this->IO_ADDR_W;
438
439 if (cmd == NAND_CMD_NONE)
440 return;
441
442 if (ctrl & NAND_CLE)
443 writeb(cmd, PALMTX_NAND_CLE_VIRT);
444 else if (ctrl & NAND_ALE)
445 writeb(cmd, PALMTX_NAND_ALE_VIRT);
446 else
447 writeb(cmd, nandaddr);
448}
449
450static struct mtd_partition palmtx_partition_info[] = {
451 [0] = {
452 .name = "palmtx-0",
453 .offset = 0,
454 .size = MTDPART_SIZ_FULL
455 },
456};
457
458static const char *palmtx_part_probes[] = { "cmdlinepart", NULL };
459
460struct platform_nand_data palmtx_nand_platdata = {
461 .chip = {
462 .nr_chips = 1,
463 .chip_offset = 0,
464 .nr_partitions = ARRAY_SIZE(palmtx_partition_info),
465 .partitions = palmtx_partition_info,
466 .chip_delay = 20,
467 .part_probe_types = palmtx_part_probes,
468 },
469 .ctrl = {
470 .cmd_ctrl = palmtx_nand_cmd_ctl,
471 },
472};
473
474static struct resource palmtx_nand_resource[] = {
475 [0] = {
476 .start = PXA_CS1_PHYS,
477 .end = PXA_CS1_PHYS + SZ_1M - 1,
478 .flags = IORESOURCE_MEM,
479 },
480};
481
482static struct platform_device palmtx_nand = {
483 .name = "gen_nand",
484 .num_resources = ARRAY_SIZE(palmtx_nand_resource),
485 .resource = palmtx_nand_resource,
486 .id = -1,
487 .dev = {
488 .platform_data = &palmtx_nand_platdata,
489 }
490};
491
492/******************************************************************************
425 * Power management - standby 493 * Power management - standby
426 ******************************************************************************/ 494 ******************************************************************************/
427static void __init palmtx_pm_init(void) 495static void __init palmtx_pm_init(void)
@@ -447,6 +515,7 @@ static struct platform_device *devices[] __initdata = {
447 &power_supply, 515 &power_supply,
448 &palmtx_asoc, 516 &palmtx_asoc,
449 &palmtx_gpio_vbus, 517 &palmtx_gpio_vbus,
518 &palmtx_nand,
450}; 519};
451 520
452static struct map_desc palmtx_io_desc[] __initdata = { 521static struct map_desc palmtx_io_desc[] __initdata = {
@@ -454,8 +523,18 @@ static struct map_desc palmtx_io_desc[] __initdata = {
454 .virtual = PALMTX_PCMCIA_VIRT, 523 .virtual = PALMTX_PCMCIA_VIRT,
455 .pfn = __phys_to_pfn(PALMTX_PCMCIA_PHYS), 524 .pfn = __phys_to_pfn(PALMTX_PCMCIA_PHYS),
456 .length = PALMTX_PCMCIA_SIZE, 525 .length = PALMTX_PCMCIA_SIZE,
457 .type = MT_DEVICE 526 .type = MT_DEVICE,
458}, 527}, {
528 .virtual = PALMTX_NAND_ALE_VIRT,
529 .pfn = __phys_to_pfn(PALMTX_NAND_ALE_PHYS),
530 .length = SZ_1M,
531 .type = MT_DEVICE,
532}, {
533 .virtual = PALMTX_NAND_CLE_VIRT,
534 .pfn = __phys_to_pfn(PALMTX_NAND_CLE_PHYS),
535 .length = SZ_1M,
536 .type = MT_DEVICE,
537}
459}; 538};
460 539
461static void __init palmtx_map_io(void) 540static void __init palmtx_map_io(void)