aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-pxa/balloon3.c51
-rw-r--r--arch/arm/mach-pxa/include/mach/balloon3.h2
-rw-r--r--drivers/pcmcia/pxa2xx_balloon3.c11
3 files changed, 36 insertions, 28 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)
diff --git a/drivers/pcmcia/pxa2xx_balloon3.c b/drivers/pcmcia/pxa2xx_balloon3.c
index dbbdd0063202..453c54c97612 100644
--- a/drivers/pcmcia/pxa2xx_balloon3.c
+++ b/drivers/pcmcia/pxa2xx_balloon3.c
@@ -39,12 +39,10 @@ static struct pcmcia_irqs irqs[] = {
39static int balloon3_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 39static int balloon3_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
40{ 40{
41 uint16_t ver; 41 uint16_t ver;
42 int ret;
43 static void __iomem *fpga_ver;
44 42
45 ver = __raw_readw(BALLOON3_FPGA_VER); 43 ver = __raw_readw(BALLOON3_FPGA_VER);
46 if (ver > 0x0201) 44 if (ver < 0x4f08)
47 pr_warn("The FPGA code, version 0x%04x, is newer than rel-0.3. " 45 pr_warn("The FPGA code, version 0x%04x, is too old. "
48 "PCMCIA/CF support might be broken in this version!", 46 "PCMCIA/CF support might be broken in this version!",
49 ver); 47 ver);
50 48
@@ -97,8 +95,9 @@ static void balloon3_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
97static int balloon3_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, 95static int balloon3_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
98 const socket_state_t *state) 96 const socket_state_t *state)
99{ 97{
100 __raw_writew((state->flags & SS_RESET) ? BALLOON3_CF_RESET : 0, 98 __raw_writew(BALLOON3_CF_RESET, BALLOON3_CF_CONTROL_REG |
101 BALLOON3_CF_CONTROL_REG); 99 ((state->flags & SS_RESET) ?
100 BALLOON3_FPGA_SETnCLR : 0));
102 return 0; 101 return 0;
103} 102}
104 103