aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut@gmail.com>2010-10-19 10:19:32 -0400
committerEric Miao <eric.y.miao@gmail.com>2010-12-20 10:14:02 -0500
commit1b9169d8a0fe2b41fbbb8d152c8108190865f3cf (patch)
treeb7aa4266dab7ac291823acdd9ef7f2a1638f10cd /arch/arm/mach-pxa
parente60f137b715b0a19b84502c23a09c5af9107399d (diff)
ARM: pxa: Update Balloon3 for new FPGA firmware
The new FPGA firmware in Balloon3 uses different methods to control it's bus control lines. In the new version, there are separate registers to set/clear bus control lines. This patch updates affected places. Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r--arch/arm/mach-pxa/balloon3.c51
-rw-r--r--arch/arm/mach-pxa/include/mach/balloon3.h2
2 files changed, 31 insertions, 22 deletions
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
index adb8e9f355d1..d4649c0e23f6 100644
--- a/arch/arm/mach-pxa/balloon3.c
+++ b/arch/arm/mach-pxa/balloon3.c
@@ -567,27 +567,29 @@ static inline void balloon3_i2c_init(void) {}
567 * NAND 567 * NAND
568 ******************************************************************************/ 568 ******************************************************************************/
569#if defined(CONFIG_MTD_NAND_PLATFORM)||defined(CONFIG_MTD_NAND_PLATFORM_MODULE) 569#if defined(CONFIG_MTD_NAND_PLATFORM)||defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
570static uint16_t balloon3_ctl =
571 BALLOON3_NAND_CONTROL_FLCE0 | BALLOON3_NAND_CONTROL_FLCE1 |
572 BALLOON3_NAND_CONTROL_FLCE2 | BALLOON3_NAND_CONTROL_FLCE3 |
573 BALLOON3_NAND_CONTROL_FLWP;
574
575static void balloon3_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl) 570static void balloon3_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
576{ 571{
577 struct nand_chip *this = mtd->priv; 572 struct nand_chip *this = mtd->priv;
573 uint8_t balloon3_ctl_set = 0, balloon3_ctl_clr = 0;
578 574
579 if (ctrl & NAND_CTRL_CHANGE) { 575 if (ctrl & NAND_CTRL_CHANGE) {
580 if (ctrl & NAND_CLE) 576 if (ctrl & NAND_CLE)
581 balloon3_ctl |= BALLOON3_NAND_CONTROL_FLCLE; 577 balloon3_ctl_set |= BALLOON3_NAND_CONTROL_FLCLE;
582 else 578 else
583 balloon3_ctl &= ~BALLOON3_NAND_CONTROL_FLCLE; 579 balloon3_ctl_clr |= BALLOON3_NAND_CONTROL_FLCLE;
584 580
585 if (ctrl & NAND_ALE) 581 if (ctrl & NAND_ALE)
586 balloon3_ctl |= BALLOON3_NAND_CONTROL_FLALE; 582 balloon3_ctl_set |= BALLOON3_NAND_CONTROL_FLALE;
587 else 583 else
588 balloon3_ctl &= ~BALLOON3_NAND_CONTROL_FLALE; 584 balloon3_ctl_clr |= BALLOON3_NAND_CONTROL_FLALE;
589 585
590 __raw_writel(balloon3_ctl, BALLOON3_NAND_CONTROL_REG); 586 if (balloon3_ctl_clr)
587 __raw_writel(balloon3_ctl_clr,
588 BALLOON3_NAND_CONTROL_REG);
589 if (balloon3_ctl_set)
590 __raw_writel(balloon3_ctl_set,
591 BALLOON3_NAND_CONTROL_REG |
592 BALLOON3_FPGA_SETnCLR);
591 } 593 }
592 594
593 if (cmd != NAND_CMD_NONE) 595 if (cmd != NAND_CMD_NONE)
@@ -599,15 +601,15 @@ static void balloon3_nand_select_chip(struct mtd_info *mtd, int chip)
599 if (chip < 0 || chip > 3) 601 if (chip < 0 || chip > 3)
600 return; 602 return;
601 603
602 balloon3_ctl |= BALLOON3_NAND_CONTROL_FLCE0 | 604 /* Assert all nCE lines */
603 BALLOON3_NAND_CONTROL_FLCE1 | 605 __raw_writew(
604 BALLOON3_NAND_CONTROL_FLCE2 | 606 BALLOON3_NAND_CONTROL_FLCE0 | BALLOON3_NAND_CONTROL_FLCE1 |
605 BALLOON3_NAND_CONTROL_FLCE3; 607 BALLOON3_NAND_CONTROL_FLCE2 | BALLOON3_NAND_CONTROL_FLCE3,
608 BALLOON3_NAND_CONTROL_REG | BALLOON3_FPGA_SETnCLR);
606 609
607 /* Deassert correct nCE line */ 610 /* Deassert correct nCE line */
608 balloon3_ctl &= ~(BALLOON3_NAND_CONTROL_FLCE0 << chip); 611 __raw_writew(BALLOON3_NAND_CONTROL_FLCE0 << chip,
609 612 BALLOON3_NAND_CONTROL_REG);
610 __raw_writew(balloon3_ctl, BALLOON3_NAND_CONTROL_REG);
611} 613}
612 614
613static int balloon3_nand_probe(struct platform_device *pdev) 615static int balloon3_nand_probe(struct platform_device *pdev)
@@ -616,11 +618,12 @@ static int balloon3_nand_probe(struct platform_device *pdev)
616 uint16_t ver; 618 uint16_t ver;
617 int ret; 619 int ret;
618 620
619 __raw_writew(BALLOON3_NAND_CONTROL2_16BIT, BALLOON3_NAND_CONTROL2_REG); 621 __raw_writew(BALLOON3_NAND_CONTROL2_16BIT,
622 BALLOON3_NAND_CONTROL2_REG | BALLOON3_FPGA_SETnCLR);
620 623
621 ver = __raw_readw(BALLOON3_FPGA_VER); 624 ver = __raw_readw(BALLOON3_FPGA_VER);
622 if (ver > 0x0201) 625 if (ver < 0x4f08)
623 pr_warn("The FPGA code, version 0x%04x, is newer than rel-0.3. " 626 pr_warn("The FPGA code, version 0x%04x, is too old. "
624 "NAND support might be broken in this version!", ver); 627 "NAND support might be broken in this version!", ver);
625 628
626 /* Power up the NAND chips */ 629 /* Power up the NAND chips */
@@ -635,7 +638,11 @@ static int balloon3_nand_probe(struct platform_device *pdev)
635 gpio_set_value(BALLOON3_GPIO_RUN_NAND, 1); 638 gpio_set_value(BALLOON3_GPIO_RUN_NAND, 1);
636 639
637 /* Deassert all nCE lines and write protect line */ 640 /* Deassert all nCE lines and write protect line */
638 __raw_writel(balloon3_ctl, BALLOON3_NAND_CONTROL_REG); 641 __raw_writel(
642 BALLOON3_NAND_CONTROL_FLCE0 | BALLOON3_NAND_CONTROL_FLCE1 |
643 BALLOON3_NAND_CONTROL_FLCE2 | BALLOON3_NAND_CONTROL_FLCE3 |
644 BALLOON3_NAND_CONTROL_FLWP,
645 BALLOON3_NAND_CONTROL_REG | BALLOON3_FPGA_SETnCLR);
639 return 0; 646 return 0;
640 647
641err2: 648err2:
diff --git a/arch/arm/mach-pxa/include/mach/balloon3.h b/arch/arm/mach-pxa/include/mach/balloon3.h
index 3506da1f27bb..f6c81ea51487 100644
--- a/arch/arm/mach-pxa/include/mach/balloon3.h
+++ b/arch/arm/mach-pxa/include/mach/balloon3.h
@@ -26,6 +26,8 @@ enum balloon3_features {
26#define BALLOON3_FPGA_VIRT (0xf1000000) /* as per balloon2 */ 26#define BALLOON3_FPGA_VIRT (0xf1000000) /* as per balloon2 */
27#define BALLOON3_FPGA_LENGTH 0x01000000 27#define BALLOON3_FPGA_LENGTH 0x01000000
28 28
29#define BALLOON3_FPGA_SETnCLR (0x1000)
30
29/* FPGA / CPLD registers for CF socket */ 31/* FPGA / CPLD registers for CF socket */
30#define BALLOON3_CF_STATUS_REG (BALLOON3_FPGA_VIRT + 0x00e00008) 32#define BALLOON3_CF_STATUS_REG (BALLOON3_FPGA_VIRT + 0x00e00008)
31#define BALLOON3_CF_CONTROL_REG (BALLOON3_FPGA_VIRT + 0x00e00008) 33#define BALLOON3_CF_CONTROL_REG (BALLOON3_FPGA_VIRT + 0x00e00008)