diff options
author | Stefan Roese <sr@denx.de> | 2009-04-24 15:59:35 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-04-28 01:15:38 +0200 |
commit | dbe29e36a4c2775b69b5a63b0ce2bac89c08e691 (patch) | |
tree | da7930d4f212f88a2a9e3ede33873869f75bea16 /drivers/mtd/nand | |
parent | 10bb62d85a0850dbad1fdd34123378686373f166 (diff) | |
download | u-boot-imx-dbe29e36a4c2775b69b5a63b0ce2bac89c08e691.zip u-boot-imx-dbe29e36a4c2775b69b5a63b0ce2bac89c08e691.tar.gz u-boot-imx-dbe29e36a4c2775b69b5a63b0ce2bac89c08e691.tar.bz2 |
mtd: nand/onenand: Register mtd device upon device scanning
With this patch the NAND and OneNAND devices are registered in the MTD
subsystem and can then be referenced by the mtdcore code (e.g.
get_mtd_device_nm()). This is needed for the new "ubi part" command
syntax without the flash type parameter (nor|nand|onenand).
Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/nand.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/mtd/nand/nand.c b/drivers/mtd/nand/nand.c index 9d83794..d369115 100644 --- a/drivers/mtd/nand/nand.c +++ b/drivers/mtd/nand/nand.c @@ -37,11 +37,13 @@ static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE]; static ulong base_address[CONFIG_SYS_MAX_NAND_DEVICE] = CONFIG_SYS_NAND_BASE_LIST; static const char default_nand_name[] = "nand"; +static __attribute__((unused)) char dev_name[CONFIG_SYS_MAX_NAND_DEVICE][8]; static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand, ulong base_addr) { int maxchips = CONFIG_SYS_NAND_MAX_CHIPS; + int __attribute__((unused)) i = 0; if (maxchips < 1) maxchips = 1; @@ -54,6 +56,16 @@ static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand, mtd->name = (char *)default_nand_name; else mtd->name += gd->reloc_off; + +#ifdef CONFIG_MTD_PARTITIONS + /* + * Add MTD device so that we can reference it later + * via the mtdcore infrastructure (e.g. ubi). + */ + sprintf(dev_name[i], "nand%d", i); + mtd->name = dev_name[i++]; + add_mtd_device(mtd); +#endif } else mtd->name = NULL; } else { |