mtd: davinci: add support for parition binding nodes
authorMurali Karicheri <m-karicheri2@ti.com>
Fri, 2 Nov 2012 14:22:41 +0000 (10:22 -0400)
committerArtem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Thu, 15 Nov 2012 17:50:30 +0000 (19:50 +0200)
Enhance the driver to support partition subnodes inside the nand
device bindings to describe partions on the nand device.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Reviewed-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Documentation/devicetree/bindings/arm/davinci/nand.txt
drivers/mtd/nand/davinci_nand.c

index e37241f1fdd85d31fcbdf338219fab719d6c4217..4746452c4f5ddf4a8d6922a097c2f4c24cd2a919 100644 (file)
@@ -23,6 +23,9 @@ Recommended properties :
 - ti,davinci-nand-buswidth: buswidth 8 or 16
 - ti,davinci-nand-use-bbt: use flash based bad block table support.
 
+nand device bindings may contain additional sub-nodes describing
+partitions of the address space. See partition.txt for more detail.
+
 Example (enbw_cmc board):
 aemif@60000000 {
        compatible = "ti,davinci-aemif";
@@ -47,5 +50,10 @@ aemif@60000000 {
                ti,davinci-ecc-mode = "hw";
                ti,davinci-ecc-bits = <4>;
                ti,davinci-nand-use-bbt;
+
+               partition@180000 {
+                       label = "ubifs";
+                       reg = <0x180000 0x7e80000>;
+               };
        };
 };
index 945047ad09527ca6a9328f34866ddd5a3a7e7dd8..3502606f64806a06ad426a112174c0117482e8dc 100644 (file)
@@ -821,9 +821,16 @@ syndrome_done:
        if (ret < 0)
                goto err_scan;
 
-       ret = mtd_device_parse_register(&info->mtd, NULL, NULL, pdata->parts,
-                                       pdata->nr_parts);
-
+       if (pdata->parts)
+               ret = mtd_device_parse_register(&info->mtd, NULL, NULL,
+                                       pdata->parts, pdata->nr_parts);
+       else {
+               struct mtd_part_parser_data     ppdata;
+
+               ppdata.of_node = pdev->dev.of_node;
+               ret = mtd_device_parse_register(&info->mtd, NULL, &ppdata,
+                                               NULL, 0);
+       }
        if (ret < 0)
                goto err_scan;