Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1903990pxb; Mon, 20 Sep 2021 07:53:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWCQQ3tfpaoL1wc8ey8skb0OmcKYYV9d9oBfZ0RTEQtgaTdE5gKCy3OrJKzOE4LjOc9/o6 X-Received: by 2002:a17:906:7250:: with SMTP id n16mr28464854ejk.147.1632149617281; Mon, 20 Sep 2021 07:53:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632149617; cv=none; d=google.com; s=arc-20160816; b=GlAE6rLmSafI8ERgca+oHtJm5XxdTwbuY4t1LgQS26YGo/HkHNZ4mkb9Cv/sxmRfYf 3KLtXWJ388BGaUkgk+Cp93DTwjitIm/DvLCFGQjCY1d0XsPrmf9kzs4FI8XH5kUJfQYH lNoyal/hzGi8jXQDtZk3wF7FUGaI41uQSg6sYr3pKjk11zulC59STRRFSrtR7xMF0gQK KHKZw0/O0qafwbM32nF/50vwbGMUdPG8irb0zKwpgqKsrxqLJKcmF6bN6rtKMjtTW9FL gEAQZNWS4vbK78P9Y7AZvChptS9Wb6tEgeUv2livelDkht/dNFeX5iMGzon0L/oSnFOt jETA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=erT+KHY68UKYg3Gicz9ztxbOzi5bhYqhoRSUUgL2FBg=; b=Dk8VCX9iV5cg8NpAziE42nXQlybDgwtsJLzfL7V5H6+gDrBZyMXOZKduKHTyJbvuIZ MhgW3OI9oZVGIZHxszzsH/eVM/CJ9AwHWqhAbB7l6oKiSHWcFMDNtR3HevsBY+BELnnY 9JWeJsE0gKRdgrfKL25ITdRr7Zn+3NG5wLltdJk14DotXirB3oJQCi4JTDInUGgQX4d0 oxn0T65ahVQEPLKq06K+pJr3cZr9T0xzqP98g/wfFJaVedaQiXAdMyq0L9KNBbNm5HjK o1h+KtSm5UwEKzv6R3WvLQpG716h+JEyFOKv8yFXSuG0xWnTLYOTAKt6YRSPT3oc8wcF 2F5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eBymerSr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w13si19169814edx.20.2021.09.20.07.53.12; Mon, 20 Sep 2021 07:53:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eBymerSr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235995AbhITKhi (ORCPT + 99 others); Mon, 20 Sep 2021 06:37:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235968AbhITKhh (ORCPT ); Mon, 20 Sep 2021 06:37:37 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03E8AC061574 for ; Mon, 20 Sep 2021 03:36:11 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id c22so59452852edn.12 for ; Mon, 20 Sep 2021 03:36:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=erT+KHY68UKYg3Gicz9ztxbOzi5bhYqhoRSUUgL2FBg=; b=eBymerSrPoJeHhz5SlImhD5YfoMhRyAyW79bu1DzisqTBZS6BXkvbyQYSLsUyDsQXd IO/FrjbxW3mfFqmWiEF0tPU+UDr8wrvfXcGvUMtoEY6VZI5kHx3ryrY/v2WZCUJl8n15 SN5S84yUooNPmz14/YyaLTxXNWCFfPsplq41PbNnqkqr8D91drYMcGhFg5a02KUtCNNB iQstH6SF2iHcnMfPs2H3zqa5msSvyF+m9T1Z/jCuz7ZIOjiyqUExYVwbjdzGYiOP//5V vnX6AkedQDxC4nS+fbZJdGSnUrE+0rScw2y+3wGzukzGsqngXnhzUiYtTAecjmFjtESA HQtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=erT+KHY68UKYg3Gicz9ztxbOzi5bhYqhoRSUUgL2FBg=; b=DVPvnHz8ey/ManlgTEBWQ1tOz4FVfuZSyViFSqN5s3N8vQzaPH3mqyFhgXQtbgoyev lyNfYtQ1TyP+4SslDmlEODEoiZqYs96M4JqbH6i17VuT/7DUkGltbBWiHCHgmMsh+mXH RpzTRPeeNSxUcNpbca8K5rsbGPd1gbORXOg+QsgouHtAVZlcW9AnqWHvTBv67eFps6LL 9P85mrZtiNr8DhOi+Dz0WUxCoddfgkAcirJC3yvgnhtNnZCodwTiGoAJaNOTahAgbUMF 5RrsSwru/7nbHJqTnI2+EgQIAy5MEfGiJjOw93WzVkHPd3xxES+e4Ubj5PmUdR3MOnsw jacg== X-Gm-Message-State: AOAM5308NNQBWStUEh9lve5KyI5G2/CZu/ZrmFYD+hr8D4c+0nT4skjn Ob6JtuBOUnSe+mi4HrJ3eIZVtqowOJatww== X-Received: by 2002:aa7:d1d3:: with SMTP id g19mr27279440edp.103.1632134169639; Mon, 20 Sep 2021 03:36:09 -0700 (PDT) Received: from [192.168.86.34] (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.googlemail.com with ESMTPSA id z3sm5838658eju.34.2021.09.20.03.36.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Sep 2021 03:36:09 -0700 (PDT) Subject: Re: [PATCH v2 1/3] nvmem: core: introduce cells parser To: Vadym Kochan Cc: Rob Herring , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Robert Marko References: <20210608190327.22071-1-vadym.kochan@plvision.eu> <20210608190327.22071-2-vadym.kochan@plvision.eu> <43023500-dd6a-5180-057e-cecc1f1b6500@linaro.org> <20210616123356.GA9951@plvision.eu> <7e6d75ed-cebc-597f-7062-34261d184968@linaro.org> From: Srinivas Kandagatla Message-ID: <0e471789-fe29-b747-5153-75c9b4616c7f@linaro.org> Date: Mon, 20 Sep 2021 11:36:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.