public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: "Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"Hector Martin" <marcan@marcan.st>,
	"Sven Peter" <sven@svenpeter.dev>,
	"Alyssa Rosenzweig" <alyssa@rosenzweig.io>,
	"Shawn Guo" <shawnguo@kernel.org>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Pengutronix Kernel Team" <kernel@pengutronix.de>,
	"Fabio Estevam" <festevam@gmail.com>,
	"NXP Linux Team" <linux-imx@nxp.com>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Kevin Hilman" <khilman@baylibre.com>,
	"Jerome Brunet" <jbrunet@baylibre.com>,
	"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
	"Claudiu Beznea" <claudiu.beznea@microchip.com>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Andy Gross" <agross@kernel.org>,
	"Bjorn Andersson" <andersson@kernel.org>,
	"Konrad Dybcio" <konrad.dybcio@linaro.org>,
	"Heiko Stuebner" <heiko@sntech.de>,
	"Orson Zhai" <orsonzhai@gmail.com>,
	"Baolin Wang" <baolin.wang@linux.alibaba.com>,
	"Chunyan Zhang" <zhang.lyra@gmail.com>,
	"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
	"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
	"Vincent Shih" <vincent.sunplus@gmail.com>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Samuel Holland" <samuel@sholland.org>,
	"Kunihiko Hayashi" <hayashi.kunihiko@socionext.com>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Michal Simek" <michal.simek@xilinx.com>,
	"Alessandro Zummo" <a.zummo@towertech.it>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Evgeniy Polyakov" <zbr@ioremap.net>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-amlogic@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	linux-arm-msm@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-sunxi@lists.linux.dev, linux-rtc@vger.kernel.org,
	"Michael Walle" <michael@walle.cc>,
	"Rafał Miłecki" <rafal@milecki.pl>
Subject: Re: [PATCH V3] nvmem: add explicit config option to read OF fixed cells
Date: Fri, 10 Mar 2023 11:43:32 +0100	[thread overview]
Message-ID: <453c9298-d64a-aa77-28ba-ac986dfdd722@gmail.com> (raw)
In-Reply-To: <ac94f04b-4b25-81e4-386f-55b0a2c7c85f@linaro.org>

On 10.03.2023 10:22, Srinivas Kandagatla wrote:
> 
> On 09/03/2023 11:20, Rafał Miłecki wrote:
>> From: Rafał Miłecki <rafal@milecki.pl>
>>
>> NVMEM subsystem looks for fixed NVMEM cells (specified in DT) by
>> default. This behaviour was totally safe in early days before adding
>> support for dynamic cells and with simple DT syntax.
>>
>> With every new supported NVMEM device with dynamic cells the current
>> behaviour becomes non-optimal:
>> 1. It results in unneeded iterating over DT nodes
>> 2. It may result in false discovery of cells (in case DT subnodes
>>     contain "reg" property)
>>
> 
> Am really not sure what is going on here,
> I did raise some issues with this overall approch to start with at [1] none of which are discussed and now I see v3 :-)
> 
> [1] https://lore.kernel.org/lkml/20230309094010.1051573-1-michael@walle.cc/T/#m7706b640979aabf251436e017b8189413661a53a

I updated commit message to address your concerns. I thought I made it
clear. I don't know how to emphasize it better.

I'll try to answer nevertheless, please see below.


On 9.03.2023 10:37, Srinivas Kandagatla wrote:
 > On 24/02/2023 07:29, Rafał Miłecki wrote:
 >> From: Rafał Miłecki <rafal@milecki.pl>
 >>
 >> NVMEM subsystem looks for fixed NVMEM cells (specified in DT) by
 >> default. This behaviour made sense in early days before adding support
 >> for dynamic cells.
 >>
 >> With every new supported NVMEM device with dynamic cells current
 >> behaviour becomes non-optimal. It results in unneeded iterating over DT
 >> nodes and may result in false discovery of cells (depending on used DT
 >> properties).
 >
 >>
 >> This behaviour has actually caused a problem already with the MTD
 >> subsystem. MTD subpartitions were incorrectly treated as NVMEM cells.
 >>
 >> Also with upcoming support for NVMEM layouts no new binding or driver
 >> should support fixed cells defined in device node.
 >
 > This is not very clear, are you saying that we should not support fixed cells? If that is the case then you are proabably taking this in wrong direction. nvmem was built based on the fact that drivers can read from a fixed offsets. Dynamic cells is something very new, that does not mean that we should ditch fixed cells support in dt.

I DON'T deprecate or drop support for fixed layouts (fixed NVMEM cells).
Period.
I WON'T drop support for old binding. We stay backward compatible.
Period.

In this patch's body I wrote:
"with the support for NVMEM layouts we may & should have *new* bindings allow fixed NVMEM cells only in the "nvmem-layout" subnode"
that clearly means I still want to ALLOW fixed NVMEM cells - just in the *nvmem-layout* node.

I want to KEEP support for fixed NVMEM cells.
I just want them to be preferably defined in the "nvmem-layout" node.


 >> Solve this by modifying drivers for bindings that support specifying
 >> fixed NVMEM cells in DT. Make them explicitly tell NVMEM subsystem to
 >> read cells from DT.
 >
 > Shouldn't this be opposite, let the new providers tell that cells are created at runtime?
 >
 > or even better if there is a way to detect if we can set this flag dynamically based on layout/post-processing configuration.
 >
 > that should be much cleaner approch.

I tried to address this concert in the following part of commit body:

 > The best approach seems to be making NVMEM core looking for fixed DT
 > cells in **device** node an opt-in feature. It's a feature that over
 > time should get deprecated in a favor of using "nvmem-layouts" also for
 > fixed NVMEM cells.

New NVMEM provider bindings and drivers will get developed. I would
want all new bindings to use "nvmem-layout" for describing NVMEM cells
(no matter if fixed or dynamic).

That means all new drivers WILL NOT need to set "use_fixed_of_cells".

So over time "use_fixed_of_cells" will become a minority. It'w would be
pitty to have every new driver to request NVMEM code to skip looking for
NVMEM cells in **device** node.

So my answer is: no. I don't believe it should be opposite. Looking for
fixed NVMEM cells in **device** DT node should be an opt-in.

If by some miracle I manage to get my patches through then you'll forget
about "use_fixed_of_cells" next month. Noone will need it for any new
stuff. It'll stay for backward compatibility only.

      reply	other threads:[~2023-03-10 10:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09 11:20 [PATCH V3] nvmem: add explicit config option to read OF fixed cells Rafał Miłecki
2023-03-09 11:35 ` Miquel Raynal
2023-03-09 12:01   ` Rafał Miłecki
2023-03-09 13:19     ` Miquel Raynal
2023-03-10  9:22 ` Srinivas Kandagatla
2023-03-10 10:43   ` Rafał Miłecki [this message]

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=453c9298-d64a-aa77-28ba-ac986dfdd722@gmail.com \
    --to=zajec5@gmail.com \
    --cc=a.zummo@towertech.it \
    --cc=agross@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=alyssa@rosenzweig.io \
    --cc=andersson@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=asahi@lists.linux.dev \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=claudiu.beznea@microchip.com \
    --cc=festevam@gmail.com \
    --cc=hayashi.kunihiko@socionext.com \
    --cc=heiko@sntech.de \
    --cc=jbrunet@baylibre.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=khilman@baylibre.com \
    --cc=konrad.dybcio@linaro.org \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=marcan@marcan.st \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mhiramat@kernel.org \
    --cc=michael@walle.cc \
    --cc=michal.simek@xilinx.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=neil.armstrong@linaro.org \
    --cc=orsonzhai@gmail.com \
    --cc=rafal@milecki.pl \
    --cc=richard@nod.at \
    --cc=s.hauer@pengutronix.de \
    --cc=samuel@sholland.org \
    --cc=shawnguo@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=sven@svenpeter.dev \
    --cc=vigneshr@ti.com \
    --cc=vincent.sunplus@gmail.com \
    --cc=wens@csie.org \
    --cc=zbr@ioremap.net \
    --cc=zhang.lyra@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox