LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Vadym Kochan <vadym.kochan@plvision.eu>
Cc: Rob Herring <robh+dt@kernel.org>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	Robert Marko <robert.marko@sartura.hr>
Subject: Re: [PATCH v2 1/3] nvmem: core: introduce cells parser
Date: Mon, 20 Sep 2021 11:36:08 +0100	[thread overview]
Message-ID: <0e471789-fe29-b747-5153-75c9b4616c7f@linaro.org> (raw)
In-Reply-To: <vrcxh2pmt3bl4h.fsf@plvision.eu>



On 20/09/2021 11:24, Vadym Kochan wrote:
>>>
>>> Probably this might be fixed by lookup nvmem device too ?
>> Honestly, this approach is a total hack to get it working.
>>
>> This is what Am thinking which should look like:
>>
>> ## DT ##
>> eeprom_at24: at24@56 {
>> 	compatible = "atmel,24c32";
>> 	/* Some way to identify that this is a TLV data */
>> 	nvmem-cell-parser-name = "onie-tlv-cells";
>> 	reg = <0x56>;
>>
>> 	mac_address: mac-address {
>> 		/* THIS REG is updated once TLV is parsed */
>> 		reg = <0 0x6>
>> 	};
> I assume these cell nodes should be marked with some property that they
> should be evaluated later, so the cell will be not read
> in case it was not parsed because it may
> exist in nvmem device optionally.
No, we should hit that use case to start with.

nvmem cells are parsed in the core during register path.
Parser should parse the cells before this to keep it simple.

> 
> Or, treat cells with length "0" in a special way and allow to update
> cell info later.you can update irrespective of the length, as long as this is done 
before register.


> 
>> };
>>
>> some_dev_node {
>> 	compatible = "xxx";
>> 	nvmem-cells = <&mac_address>;
>> 	nvmem-cell-names = "mac-address";
>> };
>>
>> == CODE ==
>> ret = of_get_mac_address(dev->of_node, base_mac);
>> ==========
>>
>>
>> If you notice the mac_address node reg is 0.
>> This node "reg" property should be updated ( using of_update_property())
>> by nvmem-provider driver while tlv parsing and by matching the node name
>> with tlv name.
>>
> I assume parser driver can just invoke add_cell_table (with may be
> by adding 'bool update' field to the cell_info struct) and core.c will just
> update existing cells parsed from OF.
> 

Lets keep the core code clean for now, I would expect the provider 
driver along with parser function to do update the nodes.

--srini

>> That way rest of the code will work as usual.
>>
>> If this work for you then we can ask Rob if he foresee any issues in
>> this approach. I already see similar usage in reserved-memory case.

  reply	other threads:[~2021-09-20 10:36 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 19:03 [PATCH v2 0/3] nvmem: add ONIE NVMEM " Vadym Kochan
2021-06-08 19:03 ` [PATCH v2 1/3] nvmem: core: introduce " Vadym Kochan
2021-06-08 22:49   ` kernel test robot
2021-06-09  3:05   ` kernel test robot
2021-06-14 10:44   ` Srinivas Kandagatla
2021-06-16 12:33     ` Vadym Kochan
2021-06-21 11:00       ` Srinivas Kandagatla
2021-09-08  9:38         ` Vadym Kochan
2021-09-13 14:19           ` Srinivas Kandagatla
2021-09-20 10:24             ` Vadym Kochan
2021-09-20 10:36               ` Srinivas Kandagatla [this message]
2021-09-20 11:25                 ` Vadym Kochan
2021-09-20 11:32                   ` Srinivas Kandagatla
2021-09-20 12:29                     ` Vadym Kochan
2021-09-20 12:34                       ` Srinivas Kandagatla
2021-09-20 13:29                         ` Vadym Kochan
2021-09-20 13:40                           ` Srinivas Kandagatla
2021-09-21  5:50                             ` John Thomson
2021-09-27  7:50                               ` Vadym Kochan
2021-09-27 10:12                                 ` Srinivas Kandagatla
2021-09-28 13:31                                   ` Vadym Kochan
2021-09-28 13:51                                     ` Srinivas Kandagatla
2021-09-28 14:11                                       ` Vadym Kochan
2021-09-28 14:39                                         ` Srinivas Kandagatla
2021-09-27 10:12                               ` Srinivas Kandagatla
2021-09-27 12:38                                 ` John Thomson
2021-09-08  9:44     ` Vadym Kochan
2021-06-08 19:03 ` [PATCH v2 2/3] dt-bindings: nvmem: document nvmem-cells-parser-name property Vadym Kochan
2021-06-18 20:59   ` Rob Herring
2021-06-08 19:03 ` [PATCH v2 3/3] nvmem: add ONIE nvmem cells parser Vadym Kochan
2021-08-06 15:39   ` Jan Lübbe
2021-09-08  9:56     ` Vadym Kochan
2021-09-12 21:06       ` John Thomson
2021-09-13 14:20         ` Srinivas Kandagatla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0e471789-fe29-b747-5153-75c9b4616c7f@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robert.marko@sartura.hr \
    --cc=robh+dt@kernel.org \
    --cc=vadym.kochan@plvision.eu \
    --subject='Re: [PATCH v2 1/3] nvmem: core: introduce cells parser' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).