mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-03-16 23:07:00 +00:00
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.
Fixes: 6a8dfd5722
("nand: atmel: Add DM based NAND driver")
Signed-off-by: Alexander Dahl <ada@thorsis.com>
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com>
Acked-by: Michael Trimarchi <michael@amarulasolutions.com>
This commit is contained in:
parent
15155ab0a3
commit
d6b4359e50
1 changed files with 7 additions and 4 deletions
|
@ -1601,10 +1601,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,
|
||||
|
|
Loading…
Add table
Reference in a new issue