aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/cafe_nand.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 13:20:31 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 13:20:31 -0500
commita8e98d6d51a3eb7bb061b1625193a129c8bd094f (patch)
tree0fa58b6e11e37023b024e55b8f0e7e01438706d4 /drivers/mtd/nand/cafe_nand.c
parentf0f1b3364ae7f48084bdf2837fb979ff59622523 (diff)
parentf9f7dd222364a6428d2ad99a515935dd1dd89d18 (diff)
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (120 commits) [MTD] Fix mtdoops.c compilation [MTD] [NOR] fix startup lock when using multiple nor flash chips [MTD] [DOC200x] eccbuf is statically defined and always evaluate to true [MTD] Fix maps/physmap.c compilation with CONFIG_PM [MTD] onenand: Add panic_write function to the onenand driver [MTD] mtdoops: Use the panic_write function when present [MTD] Add mtd panic_write function pointer [MTD] [NAND] Freescale enhanced Local Bus Controller FCM NAND support. [MTD] physmap.c: Add support for multiple resources [MTD] [NAND] Fix misparenthesization introduced by commit 78b65179... [MTD] [NAND] Fix Blackfin NFC ECC calculating bug with page size 512 bytes [MTD] [NAND] Remove wrong operation in PM function of the BF54x NFC driver [MTD] [NAND] Remove unused variable in plat_nand_remove [MTD] Unlocking all Intel flash that is locked on power up. [MTD] [NAND] at91_nand: Make mtdparts option can override board info [MTD] mtdoops: Various minor cleanups [MTD] mtdoops: Ensure sequential write to the buffer [MTD] mtdoops: Perform write operations in a workqueue [MTD] mtdoops: Add further error return code checking [MTD] [NOR] Test devtype, not definition in flash_probe(), drivers/mtd/devices/lart.c ...
Diffstat (limited to 'drivers/mtd/nand/cafe_nand.c')
-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: