aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-10-28 21:56:39 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2007-10-28 21:56:39 -0400
commit9c37f3329ae098d4c17e8bec589a589bcbf0acff (patch)
tree140386fb85eca0c4fbbae5f19802228ce99c51df /drivers/mtd/nand
parent2a397e82c7db18019e408f953dd58dc1963a328c (diff)
[MTD] [NAND] Check for RedBoot partitions on CAFÉ NAND
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/cafe_nand.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c
index 1e811715211a..da6ceaa80ba1 100644
--- a/drivers/mtd/nand/cafe_nand.c
+++ b/drivers/mtd/nand/cafe_nand.c
@@ -11,6 +11,7 @@
11#undef DEBUG 11#undef DEBUG
12#include <linux/mtd/mtd.h> 12#include <linux/mtd/mtd.h>
13#include <linux/mtd/nand.h> 13#include <linux/mtd/nand.h>
14#include <linux/mtd/partitions.h>
14#include <linux/rslib.h> 15#include <linux/rslib.h>
15#include <linux/pci.h> 16#include <linux/pci.h>
16#include <linux/delay.h> 17#include <linux/delay.h>
@@ -52,6 +53,7 @@
52 53
53struct cafe_priv { 54struct cafe_priv {
54 struct nand_chip nand; 55 struct nand_chip nand;
56 struct mtd_partition *parts;
55 struct pci_dev *pdev; 57 struct pci_dev *pdev;
56 void __iomem *mmio; 58 void __iomem *mmio;
57 struct rs_control *rs; 59 struct rs_control *rs;
@@ -84,6 +86,10 @@ static unsigned int numtimings;
84static int timing[3]; 86static int timing[3];
85module_param_array(timing, int, &numtimings, 0644); 87module_param_array(timing, int, &numtimings, 0644);
86 88
89#ifdef CONFIG_MTD_PARTITIONS
90static const char *part_probes[] = { "RedBoot", NULL };
91#endif
92
87/* Hrm. Why isn't this already conditional on something in the struct device? */ 93/* Hrm. Why isn't this already conditional on something in the struct device? */
88#define cafe_dev_dbg(dev, args...) do { if (debug) dev_dbg(dev, ##args); } while(0) 94#define cafe_dev_dbg(dev, args...) do { if (debug) dev_dbg(dev, ##args); } while(0)
89 95
@@ -620,7 +626,9 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev,
620{ 626{
621 struct mtd_info *mtd; 627 struct mtd_info *mtd;
622 struct cafe_priv *cafe; 628 struct cafe_priv *cafe;
629 struct mtd_partition *parts;
623 uint32_t ctrl; 630 uint32_t ctrl;
631 int nr_parts;
624 int err = 0; 632 int err = 0;
625 633
626 /* Very old versions shared the same PCI ident for all three 634 /* Very old versions shared the same PCI ident for all three
@@ -787,7 +795,18 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev,
787 goto out_irq; 795 goto out_irq;
788 796
789 pci_set_drvdata(pdev, mtd); 797 pci_set_drvdata(pdev, mtd);
798
799 /* We register the whole device first, separate from the partitions */
790 add_mtd_device(mtd); 800 add_mtd_device(mtd);
801
802#ifdef CONFIG_MTD_PARTITIONS
803 nr_parts = parse_mtd_partitions(mtd, part_probes, &parts, 0);
804 if (nr_parts > 0) {
805 cafe->parts = parts;
806 dev_info(&cafe->pdev->dev, "%d RedBoot partitions found\n", nr_parts);
807 add_mtd_partitions(mtd, parts, nr_parts);
808 }
809#endif
791 goto out; 810 goto out;
792 811
793 out_irq: 812 out_irq: