diff mbox

[v4,11/16] mtd: onenand: omap2: Do not make delay for GPIO OMAP3 specific

Message ID 20171111212406.lgqpj57o4ckxbx4i@lenoch (mailing list archive)
State New, archived
Headers show

Commit Message

Ladislav Michl Nov. 11, 2017, 9:24 p.m. UTC
Second commit in driver history (782b7a367d81: "[MTD] [OneNAND] OMAP3:
add delay for GPIO") added quirk for waiting until GPIO line settle.
As DMA was disabled for OMAP2 boards, chances are this problem was
not OMAP3 specific and as it is just one register read, previous
test for SoC type is approximately as expensive as read itself.
Make delay unconditional, which allows removing SoC specific code
alltogether.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 Changes:
 -v3: new patch
 -v4: none

 drivers/mtd/onenand/omap2.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Roger Quadros Nov. 15, 2017, 9:31 a.m. UTC | #1
On 11/11/17 23:24, Ladislav Michl wrote:
> Second commit in driver history (782b7a367d81: "[MTD] [OneNAND] OMAP3:
> add delay for GPIO") added quirk for waiting until GPIO line settle.
> As DMA was disabled for OMAP2 boards, chances are this problem was
> not OMAP3 specific and as it is just one register read, previous
> test for SoC type is approximately as expensive as read itself.
> Make delay unconditional, which allows removing SoC specific code
> alltogether.
> 
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>

Acked-by: Roger Quadros <rogerq@ti.com>

> ---
>  Changes:
>  -v3: new patch
>  -v4: none
> 
>  drivers/mtd/onenand/omap2.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
> index c9ff67100ef4..e4857a41760d 100644
> --- a/drivers/mtd/onenand/omap2.c
> +++ b/drivers/mtd/onenand/omap2.c
> @@ -57,7 +57,6 @@ struct omap2_onenand {
>  	struct dma_chan *dma_chan;
>  	int freq;
>  	int (*setup)(void __iomem *base, int *freq_ptr);
> -	u8 flags;
>  };
>  
>  static void omap2_onenand_dma_complete_func(void *completion)
> @@ -148,9 +147,8 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state)
>  		if (!(syscfg & ONENAND_SYS_CFG1_IOBE)) {
>  			syscfg |= ONENAND_SYS_CFG1_IOBE;
>  			write_reg(c, syscfg, ONENAND_REG_SYS_CFG1);
> -			if (c->flags & ONENAND_IN_OMAP34XX)
> -				/* Add a delay to let GPIO settle */
> -				syscfg = read_reg(c, ONENAND_REG_SYS_CFG1);
> +			/* Add a delay to let GPIO settle */
> +			syscfg = read_reg(c, ONENAND_REG_SYS_CFG1);
>  		}
>  
>  		reinit_completion(&c->irq_done);
> @@ -470,7 +468,6 @@ static int omap2_onenand_probe(struct platform_device *pdev)
>  
>  	init_completion(&c->irq_done);
>  	init_completion(&c->dma_done);
> -	c->flags = pdata->flags;
>  	c->gpmc_cs = pdata->cs;
>  	c->gpio_irq = pdata->gpio_irq;
>  	if (pdata->dma_channel < 0) {
>
Sebastian Reichel Nov. 15, 2017, 3:20 p.m. UTC | #2
Hi,

On Sat, Nov 11, 2017 at 10:24:06PM +0100, Ladislav Michl wrote:
> Second commit in driver history (782b7a367d81: "[MTD] [OneNAND] OMAP3:
> add delay for GPIO") added quirk for waiting until GPIO line settle.
> As DMA was disabled for OMAP2 boards, chances are this problem was
> not OMAP3 specific and as it is just one register read, previous
> test for SoC type is approximately as expensive as read itself.
> Make delay unconditional, which allows removing SoC specific code
> alltogether.
> 
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

-- Sebastian

> ---
>  Changes:
>  -v3: new patch
>  -v4: none
> 
>  drivers/mtd/onenand/omap2.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
> index c9ff67100ef4..e4857a41760d 100644
> --- a/drivers/mtd/onenand/omap2.c
> +++ b/drivers/mtd/onenand/omap2.c
> @@ -57,7 +57,6 @@ struct omap2_onenand {
>  	struct dma_chan *dma_chan;
>  	int freq;
>  	int (*setup)(void __iomem *base, int *freq_ptr);
> -	u8 flags;
>  };
>  
>  static void omap2_onenand_dma_complete_func(void *completion)
> @@ -148,9 +147,8 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state)
>  		if (!(syscfg & ONENAND_SYS_CFG1_IOBE)) {
>  			syscfg |= ONENAND_SYS_CFG1_IOBE;
>  			write_reg(c, syscfg, ONENAND_REG_SYS_CFG1);
> -			if (c->flags & ONENAND_IN_OMAP34XX)
> -				/* Add a delay to let GPIO settle */
> -				syscfg = read_reg(c, ONENAND_REG_SYS_CFG1);
> +			/* Add a delay to let GPIO settle */
> +			syscfg = read_reg(c, ONENAND_REG_SYS_CFG1);
>  		}
>  
>  		reinit_completion(&c->irq_done);
> @@ -470,7 +468,6 @@ static int omap2_onenand_probe(struct platform_device *pdev)
>  
>  	init_completion(&c->irq_done);
>  	init_completion(&c->dma_done);
> -	c->flags = pdata->flags;
>  	c->gpmc_cs = pdata->cs;
>  	c->gpio_irq = pdata->gpio_irq;
>  	if (pdata->dma_channel < 0) {
> -- 
> 2.11.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
index c9ff67100ef4..e4857a41760d 100644
--- a/drivers/mtd/onenand/omap2.c
+++ b/drivers/mtd/onenand/omap2.c
@@ -57,7 +57,6 @@  struct omap2_onenand {
 	struct dma_chan *dma_chan;
 	int freq;
 	int (*setup)(void __iomem *base, int *freq_ptr);
-	u8 flags;
 };
 
 static void omap2_onenand_dma_complete_func(void *completion)
@@ -148,9 +147,8 @@  static int omap2_onenand_wait(struct mtd_info *mtd, int state)
 		if (!(syscfg & ONENAND_SYS_CFG1_IOBE)) {
 			syscfg |= ONENAND_SYS_CFG1_IOBE;
 			write_reg(c, syscfg, ONENAND_REG_SYS_CFG1);
-			if (c->flags & ONENAND_IN_OMAP34XX)
-				/* Add a delay to let GPIO settle */
-				syscfg = read_reg(c, ONENAND_REG_SYS_CFG1);
+			/* Add a delay to let GPIO settle */
+			syscfg = read_reg(c, ONENAND_REG_SYS_CFG1);
 		}
 
 		reinit_completion(&c->irq_done);
@@ -470,7 +468,6 @@  static int omap2_onenand_probe(struct platform_device *pdev)
 
 	init_completion(&c->irq_done);
 	init_completion(&c->dma_done);
-	c->flags = pdata->flags;
 	c->gpmc_cs = pdata->cs;
 	c->gpio_irq = pdata->gpio_irq;
 	if (pdata->dma_channel < 0) {