diff options
| author | Miquel Raynal <[email protected]> | 2025-09-30 03:21:05 +0300 |
|---|---|---|
| committer | Michael Trimarchi <[email protected]> | 2025-10-05 20:26:27 +0200 |
| commit | 1e103284a51fae91e73bb2014221f53c53435341 (patch) | |
| tree | efcda0d54dd2d135325ec73a9791d73d06871d15 /drivers | |
| parent | f61362c24f5d827005cca5b46887400625faf540 (diff) | |
mtd: spinand: Add a ->configure_chip() hook
There is already a manufacturer hook, which is manufacturer specific but
not chip specific. We no longer have access to the actual NAND identity
at this stage so let's add a per-chip configuration hook to align the
chip configuration (if any) with the core's setting.
This is a port of linux commit
da55809ebb45 ("mtd: spinand: Add a ->configure_chip() hook")
Signed-off-by: Miquel Raynal <[email protected]>
Signed-off-by: Mikhail Kshevetskiy <[email protected]> # U-Boot port
Reviewed-by: Frieder Schrempf <[email protected]>
Signed-off-by: Michael Trimarchi <[email protected]>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/mtd/nand/spi/core.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 3e21a06dd0f..25e7a38a874 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -1251,8 +1251,19 @@ static int spinand_id_detect(struct spinand_device *spinand) static int spinand_manufacturer_init(struct spinand_device *spinand) { - if (spinand->manufacturer->ops->init) - return spinand->manufacturer->ops->init(spinand); + int ret; + + if (spinand->manufacturer->ops->init) { + ret = spinand->manufacturer->ops->init(spinand); + if (ret) + return ret; + } + + if (spinand->configure_chip) { + ret = spinand->configure_chip(spinand); + if (ret) + return ret; + } return 0; } @@ -1363,6 +1374,7 @@ int spinand_match_and_init(struct spinand_device *spinand, spinand->flags = table[i].flags; spinand->id.len = 1 + table[i].devid.len; spinand->select_target = table[i].select_target; + spinand->configure_chip = table[i].configure_chip; spinand->set_cont_read = table[i].set_cont_read; spinand->fact_otp = &table[i].fact_otp; spinand->user_otp = &table[i].user_otp; |
