mtd: nand: raw: atmel: R/B gpio on sam9x60
Subsystems (4)
v2 cover mtd: nand: raw: atmel: R/B gpio on sam9x60
Hei hei,
after sending v1 of this patch Eugen and Michael discussed what would be the right approach in U-Boot here. Actually now I saw I did not correctly port what Linux does here in v1, but this v2 should be what I understood would be the preferred solution and should be similar to what Linux does now.
The original patch series had two patches, from which one was applied already. To not confuse patchwork or mailing setups, I send v2 with a cover letter too, although it is only one patch left in the series.
Link to v1 below.
Greets
Alex
Alexander Dahl (1):
mtd: nand: raw: atmel: Add error handling when rb-gpios missing
drivers/mtd/nand/raw/atmel/nand-controller.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
base-commit: 5d2fae79c7d60eaf7f50322e4ec125d2f58544e9
Signature · 1 line
2.30.2
PATCH v2 1/1 mtd: nand: raw: atmel: Add error handling when rb-gpios missing
Adapt behaviour to Linux kernel driver.
The return value of gpio_request_by_name_nodev() was not checked before, and thus in case 'rb-gpios' was missing in DT, rb.type was set to ATMEL_NAND_GPIO_RB nevertheless, leading to output like this for example (on sam9x60-curiosity with the line removed from dts):
NAND: Could not find valid ONFI parameter page; aborting device found, Manufacturer ID: 0xc2, Chip ID: 0xdc Macronix NAND 512MiB 3,3V 8-bit
512 MiB, SLC, erase size: 256 KiB, page size: 4096, OOB size: 64 atmel-nand-controller nand-controller: NAND scan failed: -22 Failed to probe nand driver (err = -22)
Failed to initialize NAND controller. (error -22)
0 MiB
Note: not having that gpio assigned in dts is possible, the driver does not override nand_chip->dev_ready() then and a generic solution is used.
---
Notes:
v1 -> v2:
- Only issue error message if error is not ENOENT. If the node just is missing, move on without error message.
drivers/mtd/nand/raw/atmel/nand-controller.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/mtd/nand/raw/atmel/nand-controller.c +7 -4
@@ -1600,10 +1600,13 @@ static struct atmel_nand *atmel_nand_create(struct atmel_nand_controller *nc, nand->cs[i].rb.type =ATMEL_NAND_NATIVE_RB ; nand->cs[i].rb.id = val; }else { -gpio_request_by_name_nodev (np,"rb-gpios" ,0 , - &nand->cs[i].rb.gpio, -GPIOD_IS_IN ); - nand->cs[i].rb.type =ATMEL_NAND_GPIO_RB ; + ret =gpio_request_by_name_nodev (np,"rb-gpios" ,0 , + &nand->cs[i].rb.gpio, +GPIOD_IS_IN ); +if (ret && ret != -ENOENT ) +dev_err (nc->dev,"Failed to get R/B gpio (err = %d)\n" , ret); +if (!ret) + nand->cs[i].rb.type =ATMEL_NAND_GPIO_RB ; } gpio_request_by_name_nodev(np, "cs-gpios", 0,
Signature · 1 line
2.30.2
Re: [PATCH v2 1/1] mtd: nand: raw: atmel: Add error handling when rb-gpios missing
Quoted 16 lines · Alexander Dahl
Adapt behaviour to Linux kernel driver.
The return value of
gpio_request_by_name_nodev()was not checked before, and thus in case 'rb-gpios' was missing in DT, rb.type was set toATMEL_NAND_GPIO_RBnevertheless, leading to output like this for example (on sam9x60-curiosity with the line removed from dts):NAND: Could not find valid ONFI parameter page; aborting device found, Manufacturer ID:
0xc2, Chip ID:0xdcMacronix NAND 512MiB 3,3V 8-bit
512 MiB, SLC, erase size: 256 KiB, page size: 4096, OOB size: 64 atmel-nand-controller nand-controller: NAND scan failed: -22 Failed to probe nand driver (err = -22)
Failed to initialize NAND controller. (error -22)
0 MiB
Quoted 6 lines
Note: not having that gpio assigned in dts is possible, the driver does not override
nand_chip->dev_ready()then and a generic solution is used.Fixes 6a8dfd57220d ("nand: atmel: Add DM based NAND driver")Signed-off-by Alexander Dahl <[email protected]>---
Quoted 10 lines
Notes:
v1 -> v2:- Only issue error message if error is not ENOENT. If the node just is missing, move on without error message.
drivers/mtd/nand/raw/atmel/nand-controller.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
Michael Nazzareno Trimarchi
Acked-byRe: [PATCH v2 1/1] mtd: nand: raw: atmel: Add error handling when rb-gpios missing
Quoted 18 lines · Eugen Hristev
Quoted 16 lines · Alexander Dahl
Adapt behaviour to Linux kernel driver.
The return value of
gpio_request_by_name_nodev()was not checked before, and thus in case 'rb-gpios' was missing in DT, rb.type was set toATMEL_NAND_GPIO_RBnevertheless, leading to output like this for example (on sam9x60-curiosity with the line removed from dts):NAND: Could not find valid ONFI parameter page; aborting device found, Manufacturer ID:
0xc2, Chip ID:0xdcMacronix NAND 512MiB 3,3V 8-bit
512 MiB, SLC, erase size: 256 KiB, page size: 4096, OOB size: 64 atmel-nand-controller nand-controller: NAND scan failed: -22 Failed to probe nand driver (err = -22)
Failed to initialize NAND controller. (error -22)
0 MiB
Quoted 20 lines
Quoted 6 lines
Note: not having that gpio assigned in dts is possible, the driver does not override
nand_chip->dev_ready()then and a generic solution is used.Fixes 6a8dfd57220d ("nand: atmel: Add DM based NAND driver")Signed-off-by Alexander Dahl <[email protected]>---
Reviewed-by Eugen Hristev <[email protected]>Quoted 10 lines
Notes:
v1 -> v2:- Only issue error message if error is not ENOENT. If the node just is missing, move on without error message.
drivers/mtd/nand/raw/atmel/nand-controller.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [PATCH v2 1/1] mtd: nand: raw: atmel: Add error handling when rb-gpios missing
Quoted 33 lines · Michael Nazzareno Trimarchi
Quoted 31 lines · Eugen Hristev
Quoted 16 lines · Alexander Dahl
Adapt behaviour to Linux kernel driver.
The return value of
gpio_request_by_name_nodev()was not checked before, and thus in case 'rb-gpios' was missing in DT, rb.type was set toATMEL_NAND_GPIO_RBnevertheless, leading to output like this for example (on sam9x60-curiosity with the line removed from dts):NAND: Could not find valid ONFI parameter page; aborting device found, Manufacturer ID:
0xc2, Chip ID:0xdcMacronix NAND 512MiB 3,3V 8-bit
512 MiB, SLC, erase size: 256 KiB, page size: 4096, OOB size: 64 atmel-nand-controller nand-controller: NAND scan failed: -22 Failed to probe nand driver (err = -22)
Failed to initialize NAND controller. (error -22)
0 MiBQuoted 6 lines
Note: not having that gpio assigned in dts is possible, the driver does not override
nand_chip->dev_ready()then and a generic solution is used.Fixes 6a8dfd57220d ("nand: atmel: Add DM based NAND driver")Signed-off-by Alexander Dahl <[email protected]>---
Reviewed-by Eugen Hristev <[email protected]>Quoted 4 lines
Notes:
v1 -> v2:
Quoted 9 lines
Quoted 7 lines
Quoted 6 lines
- Only issue error message if error is not ENOENT. If the node just is missing, move on without error message.
drivers/mtd/nand/raw/atmel/nand-controller.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
Applied to u-boot-at91/master, thanks !