mtd: spi-nor: aspeed: set 4B setting for all chips

Submitted by Cédric Le Goater on Aug. 2, 2017, 8:51 a.m.

Details

Message ID 1501663911-26532-1-git-send-email-clg@kaod.org
State Accepted
Delegated to: Cyrille Pitchen
Headers show

Commit Message

Cédric Le Goater Aug. 2, 2017, 8:51 a.m.
The driver made the wrong assumption that the 4B setting was
autodetected for all chips of the AST2500 FMC flash controller. This
is only the case for the CS0.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 drivers/mtd/spi-nor/aspeed-smc.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Cyrille Pitchen Aug. 14, 2017, 3:28 p.m.
Le 02/08/2017 à 10:51, Cédric Le Goater a écrit :
> The driver made the wrong assumption that the 4B setting was
> autodetected for all chips of the AST2500 FMC flash controller. This
> is only the case for the CS0.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Applied to the spi-nor/next branch of l2-mtd

Thanks!
> ---
>  drivers/mtd/spi-nor/aspeed-smc.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/aspeed-smc.c b/drivers/mtd/spi-nor/aspeed-smc.c
> index 23622bf62b6b..1b76fe14a435 100644
> --- a/drivers/mtd/spi-nor/aspeed-smc.c
> +++ b/drivers/mtd/spi-nor/aspeed-smc.c
> @@ -794,19 +794,18 @@ static void aspeed_smc_chip_set_type(struct aspeed_smc_chip *chip, int type)
>  }
>  
>  /*
> - * The AST2500 FMC flash controller should be strapped by hardware, or
> - * autodetected, but the AST2500 SPI flash needs to be set.
> + * The first chip of the AST2500 FMC flash controller is strapped by
> + * hardware, or autodetected, but other chips need to be set. Enforce
> + * the 4B setting for all chips.
>   */
>  static void aspeed_smc_chip_set_4b(struct aspeed_smc_chip *chip)
>  {
>  	struct aspeed_smc_controller *controller = chip->controller;
>  	u32 reg;
>  
> -	if (chip->controller->info == &spi_2500_info) {
> -		reg = readl(controller->regs + CE_CONTROL_REG);
> -		reg |= 1 << chip->cs;
> -		writel(reg, controller->regs + CE_CONTROL_REG);
> -	}
> +	reg = readl(controller->regs + CE_CONTROL_REG);
> +	reg |= 1 << chip->cs;
> +	writel(reg, controller->regs + CE_CONTROL_REG);
>  }
>  
>  /*
>

Patch hide | download patch | download mbox

diff --git a/drivers/mtd/spi-nor/aspeed-smc.c b/drivers/mtd/spi-nor/aspeed-smc.c
index 23622bf62b6b..1b76fe14a435 100644
--- a/drivers/mtd/spi-nor/aspeed-smc.c
+++ b/drivers/mtd/spi-nor/aspeed-smc.c
@@ -794,19 +794,18 @@  static void aspeed_smc_chip_set_type(struct aspeed_smc_chip *chip, int type)
 }
 
 /*
- * The AST2500 FMC flash controller should be strapped by hardware, or
- * autodetected, but the AST2500 SPI flash needs to be set.
+ * The first chip of the AST2500 FMC flash controller is strapped by
+ * hardware, or autodetected, but other chips need to be set. Enforce
+ * the 4B setting for all chips.
  */
 static void aspeed_smc_chip_set_4b(struct aspeed_smc_chip *chip)
 {
 	struct aspeed_smc_controller *controller = chip->controller;
 	u32 reg;
 
-	if (chip->controller->info == &spi_2500_info) {
-		reg = readl(controller->regs + CE_CONTROL_REG);
-		reg |= 1 << chip->cs;
-		writel(reg, controller->regs + CE_CONTROL_REG);
-	}
+	reg = readl(controller->regs + CE_CONTROL_REG);
+	reg |= 1 << chip->cs;
+	writel(reg, controller->regs + CE_CONTROL_REG);
 }
 
 /*