How to get partition table from a device tree for a SPI FLASH driver?

Wendy Liang wendy.liang at petalogix.com
Mon Feb 8 17:51:07 EST 2010


Hello,

I am trying to get Flash partition table information from the device tree in
a SPI FLASH driver in 2.6.31 kernel. I wonder whether this has been done
already.

If yes, could you please tell where I can refer to?

If no, can I do the following changes for this purpose?:

   - Add a sub-node of the SPI FLASH into the SPI controller in the DTS file
   - Add the FLASH partitions as sub-nodes into the SPI FLASH sub-node.

E.g.:
spi-controller at 83400000 {
......
spi-flash at xxxxxxxx {
compatible = ",m25p80";
reg = <0x0>;
spi-max-frequency = <80000000>;
parition at 0x00000000 {
label = "boot";
reg = <0x00000000 0x00040000>;
}
... ...
};
}

   - In the probe function of a SPI FLASH driver, e.g., m25p_probe() in
   m25p80.c, call of_mtd_parse_partitions().

e.g.:
if (mtd_has_partitions()) {
struct mtd_partition    *parts = NULL;
int                     nr_parts = 0;
nr_parts = of_mtd_parse_partitions(&spi->dev, spi->dev.archdata.of_node,
&parts)
... ...
}

Thanks,
Wendy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20100208/e0e8de10/attachment.htm>


More information about the devicetree-discuss mailing list