pistachio: Fix setting mtd name
The bootloader provides the partition table using the boot arguments and uses the name spi-nor and spi-nand for the different controllers. The old code was not setting the name any more because mtd->name was already set before. Move the setting of the name to the spi-mem code now. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
parent
cd080be84c
commit
de01fec4a7
|
@ -8,29 +8,37 @@ Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
|
||||||
drivers/mtd/spi-nor/spi-nor.c | 8 +++++++-
|
drivers/mtd/spi-nor/spi-nor.c | 8 +++++++-
|
||||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
--- a/drivers/mtd/spi-nor/core.c
|
--- a/drivers/spi/spi-mem.c
|
||||||
+++ b/drivers/mtd/spi-nor/core.c
|
+++ b/drivers/spi/spi-mem.c
|
||||||
@@ -3420,12 +3420,20 @@ static void spi_nor_set_mtd_info(struct
|
@@ -846,7 +846,9 @@ static int spi_mem_probe(struct spi_devi
|
||||||
{
|
{
|
||||||
struct mtd_info *mtd = &nor->mtd;
|
struct spi_mem_driver *memdrv = to_spi_mem_drv(spi->dev.driver);
|
||||||
struct device *dev = nor->dev;
|
struct spi_controller *ctlr = spi->controller;
|
||||||
+ struct device_node *np = spi_nor_get_flash_node(nor);
|
|
||||||
+ const char __maybe_unused *of_mtd_name = NULL;
|
+ const char __maybe_unused *of_mtd_name = NULL;
|
||||||
|
struct spi_mem *mem;
|
||||||
|
+ int ret;
|
||||||
|
|
||||||
spi_nor_set_mtd_locking_ops(nor);
|
mem = devm_kzalloc(&spi->dev, sizeof(*mem), GFP_KERNEL);
|
||||||
spi_nor_set_mtd_otp_ops(nor);
|
if (!mem)
|
||||||
|
@@ -854,10 +856,15 @@ static int spi_mem_probe(struct spi_devi
|
||||||
|
|
||||||
mtd->dev.parent = dev;
|
mem->spi = spi;
|
||||||
if (!mtd->name)
|
|
||||||
+#ifdef CONFIG_MTD_OF_PARTS
|
- if (ctlr->mem_ops && ctlr->mem_ops->get_name)
|
||||||
+ of_property_read_string(np, "linux,mtd-name", &of_mtd_name);
|
+ if (ctlr->mem_ops && ctlr->mem_ops->get_name) {
|
||||||
+#endif
|
mem->name = ctlr->mem_ops->get_name(mem);
|
||||||
+ if (of_mtd_name)
|
- else
|
||||||
+ mtd->name = of_mtd_name;
|
- mem->name = dev_name(&spi->dev);
|
||||||
+ else if (!mtd->name)
|
+ } else {
|
||||||
mtd->name = dev_name(dev);
|
+ ret = device_property_read_string(&spi->dev, "linux,mtd-name", &of_mtd_name);
|
||||||
mtd->type = MTD_NORFLASH;
|
+ if (!ret)
|
||||||
mtd->flags = MTD_CAP_NORFLASH;
|
+ mem->name = of_mtd_name;
|
||||||
|
+ else
|
||||||
|
+ mem->name = dev_name(&spi->dev);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (IS_ERR_OR_NULL(mem->name))
|
||||||
|
return PTR_ERR_OR_ZERO(mem->name);
|
||||||
--- a/drivers/mtd/mtdcore.c
|
--- a/drivers/mtd/mtdcore.c
|
||||||
+++ b/drivers/mtd/mtdcore.c
|
+++ b/drivers/mtd/mtdcore.c
|
||||||
@@ -870,6 +870,17 @@ out_error:
|
@@ -870,6 +870,17 @@ out_error:
|
||||||
|
|
Loading…
Reference in New Issue