On 25.08.2022 23:44, Michael Walle wrote:
This is now the third attempt to fetch the MAC addresses from the VPD
for the Kontron sl28 boards. Previous discussions can be found here:
https://lore.kernel.org/lkml/20211228142549.1275412-1-michael@xxxxxxxx/
NVMEM cells are typically added by board code or by the devicetree. But
as the cells get more complex, there is (valid) push back from the
devicetree maintainers to not put that handling in the devicetree.
I dropped the ball waiting for Rob's reponse in the
[PATCH 0/2] dt-bindings: nvmem: support describing cells
https://lore.kernel.org/linux-arm-kernel/0b7b8f7ea6569f79524aea1a3d783665@xxxxxxxx/T/
Before we go any further can we have a clear answer from Rob (or
Krzysztof now too?):
Is there any point in having bindings like:
compatible = "mac-address";
for NVMEM cells nodes? So systems (Linux, U-Boot) can handle them in a
more generic way?
Or do we prefer more conditional drivers code (or layouts code as in
this Michael's proposal) that will handle cells properly based on their
names?
I'm not arguing for any solution. I just want to make sure we choose the
right way to proceed.
Therefore, introduce NVMEM layouts. They operate on the NVMEM device and
can add cells during runtime. That way it is possible to add complex
cells than it is possible right now with the offset/length/bits
description in the device tree. For example, you can have post processing
for individual cells (think of endian swapping, or ethernet offset
handling). You can also have cells which have no static offset, like the
ones in an u-boot environment. The last patches will convert the current
u-boot environment driver to a NVMEM layout and lifting the restriction
that it only works with mtd devices. But as it will change the required
compatible strings, it is marked as RFC for now. It also needs to have
its device tree schema update which is left out here.
So do I get it right that we want to have:
1. NVMEM drivers for providing I/O access to NVMEM devices
2. NVMEM layouts for parsing & NVMEM cells and translating their content
?
I guess it sounds good and seems to be a clean solution.
One thing I believe you need to handle is replacing "cell_post_process"
callback with your layout thing.
I find it confusing to have
1. cell_post_process() CB at NVMEM device level
2. post_process() CB at NVMEM cell level