aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2008-03-18 12:34:03 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2008-04-22 15:50:31 -0400
commit9ebed3e60f9991e980e6c38b0edbdf9c8ff2ff6d (patch)
treed4fd5614e4bcf3257abc5c59909b47a95b3c89c3 /drivers/mtd
parentf0797881d59ab93d7d92c55411e0573977d909d4 (diff)
[MTD] [NAND] fsl_elbc_nand: fix mtd name
Currently fsl_elbc_nand doesn't initialize mtd->name, and this causes nand_get_flash_type() to assign name that is equal to chip type, like this: root@b1:~# cat /proc/mtd dev: size erasesize name mtd0: 00800000 00010000 "fe000000.flash" mtd1: 02000000 00004000 "NAND 32MiB 3,3V 8-bit" mtd0 is physmap_of flash (normal name), and mtd1 is fsl_elbc_nand. Despite inconsistency, with mtd name like this specifying paritions from the kernel command line becomes a torture (though, I didn't tried and not sure if mtdparts= can handle spaces at all). Plus, this causes real bugs when multiple fsl_elbc_nand chips registered. With this patch applied fsl_elbc_nand chip will have proper name: root@b1:~# cat /proc/mtd dev: size erasesize name mtd0: 00800000 00010000 "fe000000.flash" mtd1: 02000000 00004000 "e0600000.flash" p.s. We can't use priv->dev->bus_id as in physmap_of, because fsl_elbc_nand pretends to be a localbus controller, so its bus_id is "address.localbus", which is incorrect and thus will also not work for multiple chips. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/fsl_elbc_nand.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index b9f9f22cd860..cb12b67ce5ef 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -780,6 +780,8 @@ static int fsl_elbc_chip_remove(struct fsl_elbc_mtd *priv)
780 780
781 nand_release(&priv->mtd); 781 nand_release(&priv->mtd);
782 782
783 kfree(priv->mtd.name);
784
783 if (priv->vbase) 785 if (priv->vbase)
784 iounmap(priv->vbase); 786 iounmap(priv->vbase);
785 787
@@ -840,6 +842,12 @@ static int fsl_elbc_chip_probe(struct fsl_elbc_ctrl *ctrl,
840 goto err; 842 goto err;
841 } 843 }
842 844
845 priv->mtd.name = kasprintf(GFP_KERNEL, "%x.flash", res.start);
846 if (!priv->mtd.name) {
847 ret = -ENOMEM;
848 goto err;
849 }
850
843 ret = fsl_elbc_chip_init(priv); 851 ret = fsl_elbc_chip_init(priv);
844 if (ret) 852 if (ret)
845 goto err; 853 goto err;