[PATCHv2 5/6] nand/denali: support MTD partitioning
Jamie Iles
jamie at jamieiles.com
Fri Jun 3 06:32:48 EDT 2011
Allow the platform to specify partitions through platform data. If
there are no partitions specified then the whole device will be
registered.
Cc: David Woodhouse <dwmw2 at infradead.org>
Cc: Chuanxiao Dong <chuanxiao.dong at intel.com>
Cc: Artem Bityutskiy <dedekind1 at gmail.com>
Signed-off-by: Jamie Iles <jamie at jamieiles.com>
---
drivers/mtd/nand/denali.c | 8 +++++++-
include/linux/platform_data/denali.h | 8 ++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c
index 229696b..e24e214 100644
--- a/drivers/mtd/nand/denali.c
+++ b/drivers/mtd/nand/denali.c
@@ -25,6 +25,7 @@
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
#include <linux/module.h>
#include <linux/platform_data/denali.h>
@@ -1643,7 +1644,12 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
goto failed_req_irq;
}
- ret = mtd_device_register(&denali->mtd, NULL, 0);
+ if (pdata && pdata->parts)
+ ret = mtd_device_register(&denali->mtd, pdata->parts,
+ pdata->nr_parts);
+ else
+ ret = mtd_device_register(&denali->mtd, NULL, 0);
+
if (ret) {
dev_err(denali->dev, "Spectra: Failed to register MTD: %d\n",
ret);
diff --git a/include/linux/platform_data/denali.h b/include/linux/platform_data/denali.h
index 3767333..141da35 100644
--- a/include/linux/platform_data/denali.h
+++ b/include/linux/platform_data/denali.h
@@ -14,9 +14,13 @@
#ifndef __DENALI_PDATA_H__
#define __DENALI_PDATA_H__
+struct mtd_partition;
+
struct denali_nand_pdata {
- int nr_ecc_bits;
- bool have_hw_ecc_fixup;
+ int nr_ecc_bits;
+ bool have_hw_ecc_fixup;
+ const struct mtd_partition *parts;
+ unsigned int nr_parts;
};
#endif /* __DENALI_PDATA_H__ */
--
1.7.4.1
More information about the linux-mtd
mailing list