aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap2/gpmc-nand.c2
-rw-r--r--arch/arm/mach-omap2/gpmc.c49
-rw-r--r--arch/arm/mach-omap2/gpmc.h5
3 files changed, 9 insertions, 47 deletions
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
index 75feb9558b6d..12e9753f5ad9 100644
--- a/arch/arm/mach-omap2/gpmc-nand.c
+++ b/arch/arm/mach-omap2/gpmc-nand.c
@@ -154,7 +154,7 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
154 if (err < 0) 154 if (err < 0)
155 goto out_free_cs; 155 goto out_free_cs;
156 156
157 err = gpmc_cs_configure(gpmc_nand_data->cs, GPMC_CONFIG_WP, 0); 157 err = gpmc_configure(GPMC_CONFIG_WP, 0);
158 if (err < 0) 158 if (err < 0)
159 goto out_free_cs; 159 goto out_free_cs;
160 } 160 }
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index ee5d0e970c62..b22771b4d9f2 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -550,16 +550,14 @@ void gpmc_cs_free(int cs)
550EXPORT_SYMBOL(gpmc_cs_free); 550EXPORT_SYMBOL(gpmc_cs_free);
551 551
552/** 552/**
553 * gpmc_cs_configure - write request to configure gpmc 553 * gpmc_configure - write request to configure gpmc
554 * @cs: chip select number
555 * @cmd: command type 554 * @cmd: command type
556 * @wval: value to write 555 * @wval: value to write
557 * @return status of the operation 556 * @return status of the operation
558 */ 557 */
559int gpmc_cs_configure(int cs, int cmd, int wval) 558int gpmc_configure(int cmd, int wval)
560{ 559{
561 int err = 0; 560 u32 regval;
562 u32 regval = 0;
563 561
564 switch (cmd) { 562 switch (cmd) {
565 case GPMC_ENABLE_IRQ: 563 case GPMC_ENABLE_IRQ:
@@ -579,47 +577,14 @@ int gpmc_cs_configure(int cs, int cmd, int wval)
579 gpmc_write_reg(GPMC_CONFIG, regval); 577 gpmc_write_reg(GPMC_CONFIG, regval);
580 break; 578 break;
581 579
582 case GPMC_CONFIG_RDY_BSY:
583 regval = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
584 if (wval)
585 regval |= WR_RD_PIN_MONITORING;
586 else
587 regval &= ~WR_RD_PIN_MONITORING;
588 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, regval);
589 break;
590
591 case GPMC_CONFIG_DEV_SIZE:
592 regval = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
593
594 /* clear 2 target bits */
595 regval &= ~GPMC_CONFIG1_DEVICESIZE(3);
596
597 /* set the proper value */
598 regval |= GPMC_CONFIG1_DEVICESIZE(wval);
599
600 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, regval);
601 break;
602
603 case GPMC_CONFIG_DEV_TYPE:
604 regval = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
605 /* clear 4 target bits */
606 regval &= ~(GPMC_CONFIG1_DEVICETYPE(3) |
607 GPMC_CONFIG1_MUXTYPE(3));
608 /* set the proper value */
609 regval |= GPMC_CONFIG1_DEVICETYPE(wval);
610 if (wval == GPMC_DEVICETYPE_NOR)
611 regval |= GPMC_CONFIG1_MUXADDDATA;
612 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, regval);
613 break;
614
615 default: 580 default:
616 printk(KERN_ERR "gpmc_configure_cs: Not supported\n"); 581 pr_err("%s: command not supported\n", __func__);
617 err = -EINVAL; 582 return -EINVAL;
618 } 583 }
619 584
620 return err; 585 return 0;
621} 586}
622EXPORT_SYMBOL(gpmc_cs_configure); 587EXPORT_SYMBOL(gpmc_configure);
623 588
624void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs) 589void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
625{ 590{
diff --git a/arch/arm/mach-omap2/gpmc.h b/arch/arm/mach-omap2/gpmc.h
index ce6ae218f41f..87d2a226a3ba 100644
--- a/arch/arm/mach-omap2/gpmc.h
+++ b/arch/arm/mach-omap2/gpmc.h
@@ -59,9 +59,6 @@
59#define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10) 59#define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10)
60#define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0) 60#define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0)
61#define GPMC_CONFIG1_MUXTYPE(val) ((val & 3) << 8) 61#define GPMC_CONFIG1_MUXTYPE(val) ((val & 3) << 8)
62#define GPMC_CONFIG1_MUXNONMUX GPMC_CONFIG1_MUXTYPE(0)
63#define GPMC_CONFIG1_MUXAAD GPMC_CONFIG1_MUXTYPE(GPMC_MUX_AAD)
64#define GPMC_CONFIG1_MUXADDDATA GPMC_CONFIG1_MUXTYPE(GPMC_MUX_AD)
65#define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4) 62#define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4)
66#define GPMC_CONFIG1_FCLK_DIV(val) (val & 3) 63#define GPMC_CONFIG1_FCLK_DIV(val) (val & 3)
67#define GPMC_CONFIG1_FCLK_DIV2 (GPMC_CONFIG1_FCLK_DIV(1)) 64#define GPMC_CONFIG1_FCLK_DIV2 (GPMC_CONFIG1_FCLK_DIV(1))
@@ -227,6 +224,6 @@ extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
227extern void gpmc_cs_free(int cs); 224extern void gpmc_cs_free(int cs);
228extern void omap3_gpmc_save_context(void); 225extern void omap3_gpmc_save_context(void);
229extern void omap3_gpmc_restore_context(void); 226extern void omap3_gpmc_restore_context(void);
230extern int gpmc_cs_configure(int cs, int cmd, int wval); 227extern int gpmc_configure(int cmd, int wval);
231 228
232#endif 229#endif