mtd: nand: assign reasonable default name for NAND drivers
Subsystems (2)
PATCH 1/1 mtd: nand: assign reasonable default name for NAND drivers
Commits such as commit 853f1c58c4b2 ("mtd: nand: omap2: show parent device structure in sysfs") attempt to rely on the core MTD code to set the MTD name based on the parent device. However, nand_base tries to set a different default name according to the flash name (e.g., extracted from the ONFI parameter page), which means NAND drivers will never make use of the MTD defaults. This is not the intention of commit 853f1c58c4b2.
This results in problems when trying to use the cmdline partition parser, since the MTD name is different than expected. Let's fix this by providing a default NAND name, where possible.
Note that this is not really a great default name in the long run, since this means that if there are multiple MTDs attached to the same controller device, they will have the same name. But that is an existing issue and requires future work on a better controller vs. flash chip abstraction to fix properly.
---
This patch is needed in additon to commit 472b444eef93 ("mtd: fix cmdlinepart parser, early naming for auto-filled MTD") to fix Heiko's reported problem. At this point, I'm not sure if this should be targeted toward late 4.4 or for 4.5. It's a 4.4 regresssion, but a very small one. And I'm not sure if this will have wide enough impact that it should be given a longer time to be reviewed and tested. We can always send it to -stable later, if it's really needed.
drivers/mtd/nand/nand_base.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mtd/nand/nand_base.c +3 -0
@@ -3826,6 +3826,9 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,if (!type) type = nand_flash_ids; +if (!mtd->name && mtd->dev.parent) + mtd->name =dev_name (mtd->dev.parent); +for (; type->name !=NULL ; type++) {if (is_full_id_nand (type)) {if (find_full_id_nand (mtd, chip, type, id_data, &busw))
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
Hi Brian,
Quoted 12 lines · On Mon, 4 Jan 2016 11:11:03 -0800 Brian Norris <[email protected]>…
Commits such as commit
853f1c58c4b2("mtd: nand: omap2: show parent device structure in sysfs") attempt to rely on the core MTD code to set the MTD name based on the parent device. However,nand_basetries to set a different default name according to the flash name (e.g., extracted from the ONFI parameter page), which means NAND drivers will never make use of the MTD defaults. This is not the intention of commit853f1c58c4b2.This results in problems when trying to use the cmdline partition parser, since the MTD name is different than expected. Let's fix this by providing a default NAND name, where possible.
Quoted 5 lines
Note that this is not really a great default name in the long run, since this means that if there are multiple MTDs attached to the same controller device, they will have the same name. But that is an existing issue and requires future work on a better controller vs. flash chip abstraction to fix properly.
Yep, and IMHO, the chip numbering currently in use in most NAND controller drivers is not the best solution either. We should somehow find a way to describe the mtd id using something like:
mtd-id: <nand-controller-id>@<cs-line>
nand-controller-id: <nand-controller-ip-name>-<ip-address>
Anyway, let's discuss that after the nand-chip <-> nand-controller separation rework.
Quoted 21 lines
Reported-by Heiko Schocher <[email protected]>Signed-off-by Brian Norris <[email protected]>Cc Heiko Schocher <[email protected]>Cc Frans Klaver <[email protected]>---
This patch is needed in additon to commit472b444eef93("mtd: fix cmdlinepart parser, early naming for auto-filled MTD") to fix Heiko's reported problem. At this point, I'm not sure if this should be targeted toward late 4.4 or for 4.5. It's a 4.4 regresssion, but a very small one. And I'm not sure if this will have wide enough impact that it should be given a longer time to be reviewed and tested. We can always send it to -stable later, if it's really needed.drivers/mtd/nand/nand_base.c | 3 +++ 1 file changed, 3 insertions(+)drivers/mtd/nand/nand_base.c +0
-0
drivers/mtd/nand/nand_base.c static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, · line 3831
Quoted 6 lines
drivers/mtd/nand/nand_base.c +3
-0@@ -3826,6 +3826,9 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,if (!type) type = nand_flash_ids; +if (!mtd->name && mtd->dev.parent) + mtd->name =dev_name (mtd->dev.parent); +
Just nitpicking, but I think this would be better placed in nand_set_defaults() or in nand_scan_ident() before nand_get_flash_type() call.
Anyway,
drivers/mtd/nand/nand_base.c static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, · line 3834
Quoted 3 lines
drivers/mtd/nand/nand_base.c +0
-0for (; type->name !=NULL ; type++) {if (is_full_id_nand (type)) {if (find_full_id_nand (mtd, chip, type, id_data, &busw))
Best Regards,
Boris
Signature · 3 lines
Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Hi Boris,
Quoted 21 lines · Boris Brezillon
Quoted 12 lines · On Mon, 4 Jan 2016 11:11:03 -0800 Brian Norris <[email protected]>…
Commits such as commit
853f1c58c4b2("mtd: nand: omap2: show parent device structure in sysfs") attempt to rely on the core MTD code to set the MTD name based on the parent device. However,nand_basetries to set a different default name according to the flash name (e.g., extracted from the ONFI parameter page), which means NAND drivers will never make use of the MTD defaults. This is not the intention of commit853f1c58c4b2.This results in problems when trying to use the cmdline partition parser, since the MTD name is different than expected. Let's fix this by providing a default NAND name, where possible.
Quoted 5 lines
Note that this is not really a great default name in the long run, since this means that if there are multiple MTDs attached to the same controller device, they will have the same name. But that is an existing issue and requires future work on a better controller vs. flash chip abstraction to fix properly.
Quoted 6 lines
Yep, and IMHO, the chip numbering currently in use in most NAND controller drivers is not the best solution either. We should somehow find a way to describe the mtd id using something like:
mtd-id: <nand-controller-id>@<cs-line>
nand-controller-id: <nand-controller-ip-name>-<ip-address>
Maybe dots ('.') instead of '@'? But otherwise, seems somewhat reasonable. Maybe this could just be something like:
dev_name(mtd->dev.parent) + "." + chip_select
Quoted 2 lines
Anyway, let's discuss that after the nand-chip <-> nand-controller separation rework.
Sure.
Quoted 23 lines
Quoted 23 lines
Reported-by Heiko Schocher <[email protected]>Signed-off-by Brian Norris <[email protected]>Cc Heiko Schocher <[email protected]>Cc Frans Klaver <[email protected]>---
This patch is needed in additon to commit472b444eef93("mtd: fix cmdlinepart parser, early naming for auto-filled MTD") to fix Heiko's reported problem. At this point, I'm not sure if this should be targeted toward late 4.4 or for 4.5. It's a 4.4 regresssion, but a very small one. And I'm not sure if this will have wide enough impact that it should be given a longer time to be reviewed and tested. We can always send it to -stable later, if it's really needed.drivers/mtd/nand/nand_base.c | 3 +++ 1 file changed, 3 insertions(+)drivers/mtd/nand/nand_base.c +0
-0@@ -3826,6 +3826,9 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,if (!type) type = nand_flash_ids;
Quoted 7 lines
drivers/mtd/nand/nand_base.c static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, · line 3831
Quoted 3 lines
drivers/mtd/nand/nand_base.c +3
-0+if (!mtd->name && mtd->dev.parent) + mtd->name =dev_name (mtd->dev.parent); +Just nitpicking, but I think this would be better placed in
nand_set_defaults()or innand_scan_ident()beforenand_get_flash_type()call.
Hmm, nand_set_defaults() would probably be better. I'll resend this and defer it to 4.5 (and 4.4.x).
Quoted 3 lines
Anyway,
Reviewed-by Boris Brezillon <[email protected]>
Thanks,
Brian
Hello Brian,
Am 04.01.2016 um 20:11 schrieb Brian Norris:
Quoted 22 lines
Commits such as commit
853f1c58c4b2("mtd: nand: omap2: show parent device structure in sysfs") attempt to rely on the core MTD code to set the MTD name based on the parent device. However,nand_basetries to set a different default name according to the flash name (e.g., extracted from the ONFI parameter page), which means NAND drivers will never make use of the MTD defaults. This is not the intention of commit853f1c58c4b2.This results in problems when trying to use the cmdline partition parser, since the MTD name is different than expected. Let's fix this by providing a default NAND name, where possible.
Note that this is not really a great default name in the long run, since this means that if there are multiple MTDs attached to the same controller device, they will have the same name. But that is an existing issue and requires future work on a better controller vs. flash chip abstraction to fix properly.
Reported-by Heiko Schocher <[email protected]>Signed-off-by Brian Norris <[email protected]>Cc Heiko Schocher <[email protected]>Cc Frans Klaver <[email protected]>
Quoted 7 lines
---
This patch is needed in additon to commit472b444eef93("mtd: fix cmdlinepart parser, early naming for auto-filled MTD") to fix Heiko's reported problem. At this point, I'm not sure if this should be targeted toward late 4.4 or for 4.5. It's a 4.4 regresssion, but a very small one. And I'm not sure if this will have wide enough impact that it should be given a longer time to be reviewed and tested. We can always send it to -stable later, if it's really needed.
Ok... but I wonder if nobody have the same problems as I ...
Quoted 2 lines
drivers/mtd/nand/nand_base.c | 3 +++ 1 file changed, 3 insertions(+)
Thanks!
works for me, so:
bye,
Heiko
Quoted 16 lines
drivers/mtd/nand/nand_base.c +3
-0@@ -3826,6 +3826,9 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,if (!type) type = nand_flash_ids; +if (!mtd->name && mtd->dev.parent) + mtd->name =dev_name (mtd->dev.parent); +for (; type->name !=NULL ; type++) {if (is_full_id_nand (type)) {if (find_full_id_nand (mtd, chip, type, id_data, &busw))
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Hi Brian,
Quoted 8 lines · Brian Norris
This patch is needed in additon to commit
472b444eef93("mtd: fix cmdlinepart parser, early naming for auto-filled MTD") to fix Heiko's reported problem. At this point, I'm not sure if this should be targeted toward late 4.4 or for 4.5. It's a 4.4 regresssion, but a very small one. And I'm not sure if this will have wide enough impact that it should be given a longer time to be reviewed and tested. We can always send it to -stable later, if it's really needed.
I have boards that will not boot 4.4 without these two patches, so I hope to see it go in to 4.4.1 (I guess it is too late for 4.4).
Regards, Stefan���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�