Thread (9 messages) flat view 9 messages, 5 authors, 2021-10-14

Re: [PATCH RFC linux] dt-bindings: nvmem: Add binding for U-Boot environment NVMEM provider

From: Srinivas Kandagatla <hidden>
Date: 2021-10-14 10:30:21
Also in: linux-devicetree, lkml, u-boot


On 14/10/2021 11:06, Marek Behún wrote:
On Thu, 14 Oct 2021 09:26:27 +0100
Srinivas Kandagatla [off-list ref] wrote:
quoted
On 14/10/2021 00:20, Marek Behún wrote:
quoted
Add device tree bindings for U-Boot environment NVMEM provider.

U-Boot environment can be stored at a specific offset of a MTD
device, EEPROM, MMC, NAND or SATA device, on an UBI volume, or in a
file on a filesystem.

The environment can contain information such as device's MAC
address, which should be used by the ethernet controller node.
   
Have you looked at
./Documentation/devicetree/bindings/mtd/partitions/nvmem-cells.yaml ?
Hello srini,

yes, I have. What about it? :)

That binding won't work for u-boot-env, because the data are stored
in a different way. A cell does not have a constant predetermined
offset on the MTD.
Can't you dynamically update the nodes before nvmem-provider is registered?
The variables are stored as a sequence of values of format
"name=value", separated by '\0's, for example:
   board=turris_mox\0ethaddr=00:11:22:33:44:55\0bootcmd=run distro_bootcmd\0....
Chaning lengths of values of variables, or deleting variables, moves
the data around. Integers and MAC addresses are stored as strings, and so on.
Do you already have a provider driver for handing this.

How is pre parsing cell info and post processing data planned to be handled?

Currently in nvmem core we do check for "reg" property for each cell, 
unless the provider driver is adding/updating dt entries dynamically 
before registering nvmem provider, It will not work as it is. Alteast 
this is what I suggested in similar case where cell information is in 
tlv format.

Secondly mac-address seems to be delimited, we recently introduced post 
processing callback for provider driver [1], which should help in this case.

If the nvmem-cell names are standard like "mac-address" then you do not 
need to add a new "type" binding to cell too, you can do post-processing 
based on name.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/nvmem/imx-ocotp.c?id=823571f8c6f8968d8f14e91972fa350ce200f5db


--srini
Also the mtd/partitions/nvmem-cells.yaml doesn't take into account
u-boot-env stored on non-MTD devices.

Marek

   
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help