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-control...@83400000 {
......
spi-fl...@xxxxxxxx {
compatible = ",m25p80";
reg = <0x0>;
spi-max-frequency = <80000000>;
parit...@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
_______________________________________________
devicetree-discuss mailing list
[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss