nvmem: Defining cells on mtd created by mtdparts
Pratyush Yadav
p.yadav at ti.com
Tue Oct 12 11:24:46 PDT 2021
Hi Sven,
On 11/10/21 09:06AM, Sven Eckelmann wrote:
> On Sunday, 10 October 2021 14:53:13 CEST Sven Eckelmann wrote:
> [...]
> > Since there are most likely more devices out there which use mtdparts, I would
> > guess that there might already be a strategy out there which can be used to
> > define the nvmem-provider for mtdparts defined partitions. At least I saw that
> > Bartosz Golaszewski added all the mtd devices automatically as nvmem provider
> > in c4dfa25ab307 ("mtd: add support for reading MTD devices via the nvmem
> > API"). So there might also be something for nvmem-cells to find the correct
> > mtd instead of relying on the fixed-partitions registration + of_node (which
> > doesn't exist because it comes from mtdparts and not devicetree).
I have been wanting to fix this problem for a while but just never got
around to it. I was thinking about either extending the mtdparts syntax
to maybe add nvmem cell information in there or adding a separate
cmdline argument that complements mtdparts with nvmem cell info. Dunno
if either of these would work well though...
>
> Ansuel Smith just proposed in OpenWrt [1] a workaround. It basically adds a
> minimal fixed-partitions parser to the mtd cmdlinepart parser (responsible for
> the mtdparts=) that tries to find the matching (size + offset) fixed-partition
> from the devicetree. The code in mtd_device_parse_register
> (add_mtd_partitions -> add_mtd_device -> mtd_nvmem_add) will then
> automatically take care of the rest.
I don't quite see how this helps. You say that some devices don't have a
device tree at all so how would you even match the fixed partition? And
this of course doesn't solve the problem where you might want nvmem
cells with a partition layout that is different from the one in device
tree.
I unfortunately don't really have any answers for this at this point,
but maybe I can figure something out in the future...
>
> Kind regards,
> Sven
>
> [1] https://github.com/openwrt/openwrt/pull/4664#issuecomment-939567963
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
--
Regards,
Pratyush Yadav
Texas Instruments Inc.
More information about the linux-mtd
mailing list