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

From: Wendy Liang <hidden>
Date: 2010-02-08 06:51:07

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@83400000 {
......
spi-flash@xxxxxxxx {
compatible = ",m25p80";
reg = <0x0>;
spi-max-frequency = <80000000>;
parition@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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help