diff mbox series

[v2,07/10] mtd: rawnand: brcmnand: fix CS0 layout

Message ID 20230211152909.1436133-8-linus.walleij@linaro.org
State New
Headers show
Series Backport BRCMNAND changes from Linux | expand

Commit Message

Linus Walleij Feb. 11, 2023, 3:29 p.m. UTC
From: Álvaro Fernández Rojas <noltari@gmail.com>

Only v3.3-v5.0 have a different CS0 layout.
Controllers before v3.3 use the same layout for every CS.

Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200522121524.4161539-3-noltari@gmail.com
[Ported to U-Boot from the Linux kernel]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Michael Nazzareno Trimarchi Feb. 13, 2023, 7:23 a.m. UTC | #1
On Sat, Feb 11, 2023 at 4:29 PM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> From: Álvaro Fernández Rojas <noltari@gmail.com>
>
> Only v3.3-v5.0 have a different CS0 layout.
> Controllers before v3.3 use the same layout for every CS.
>
> Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> Acked-by: Florian Fainelli <f.fainelli@gmail.com>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> Link: https://lore.kernel.org/linux-mtd/20200522121524.4161539-3-noltari@gmail.com
> [Ported to U-Boot from the Linux kernel]
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/mtd/nand/raw/brcmnand/brcmnand.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> index ee7c3a21602e..1ea9091e6497 100644
> --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> @@ -561,8 +561,9 @@ static int brcmnand_revision_init(struct brcmnand_controller *ctrl)
>         } else {
>                 ctrl->cs_offsets = brcmnand_cs_offsets;
>
> -               /* v5.0 and earlier has a different CS0 offset layout */
> -               if (ctrl->nand_version <= 0x0500)
> +               /* v3.3-5.0 have a different CS0 offset layout */
> +               if (ctrl->nand_version >= 0x0303 &&
> +                   ctrl->nand_version <= 0x0500)
>                         ctrl->cs0_offsets = brcmnand_cs_offsets_cs0;
>         }
>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>

> --
> 2.39.1
>
William Zhang Feb. 22, 2023, 1:15 a.m. UTC | #2
On 02/11/2023 07:29 AM, Linus Walleij wrote:
> From: Álvaro Fernández Rojas <noltari@gmail.com>
> 
> Only v3.3-v5.0 have a different CS0 layout.
> Controllers before v3.3 use the same layout for every CS.
> 
> Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> Acked-by: Florian Fainelli <f.fainelli@gmail.com>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> Link: https://lore.kernel.org/linux-mtd/20200522121524.4161539-3-noltari@gmail.com
> [Ported to U-Boot from the Linux kernel]
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>   drivers/mtd/nand/raw/brcmnand/brcmnand.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> index ee7c3a21602e..1ea9091e6497 100644
> --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> @@ -561,8 +561,9 @@ static int brcmnand_revision_init(struct brcmnand_controller *ctrl)
>   	} else {
>   		ctrl->cs_offsets = brcmnand_cs_offsets;
>   
> -		/* v5.0 and earlier has a different CS0 offset layout */
> -		if (ctrl->nand_version <= 0x0500)
> +		/* v3.3-5.0 have a different CS0 offset layout */
> +		if (ctrl->nand_version >= 0x0303 &&
> +		    ctrl->nand_version <= 0x0500)
>   			ctrl->cs0_offsets = brcmnand_cs_offsets_cs0;
>   	}
>   
> 

Acked-by: William Zhang <william.zhang@broadcom.com>
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index ee7c3a21602e..1ea9091e6497 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -561,8 +561,9 @@  static int brcmnand_revision_init(struct brcmnand_controller *ctrl)
 	} else {
 		ctrl->cs_offsets = brcmnand_cs_offsets;
 
-		/* v5.0 and earlier has a different CS0 offset layout */
-		if (ctrl->nand_version <= 0x0500)
+		/* v3.3-5.0 have a different CS0 offset layout */
+		if (ctrl->nand_version >= 0x0303 &&
+		    ctrl->nand_version <= 0x0500)
 			ctrl->cs0_offsets = brcmnand_cs_offsets_cs0;
 	}