[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240930162616.2241e46f@bootlin.com>
Date: Mon, 30 Sep 2024 16:26:16 +0200
From: Herve Codina <herve.codina@...tlin.com>
To: "Arnd Bergmann" <arnd@...db.de>
Cc: "Geert Uytterhoeven" <geert@...ux-m68k.org>, "Andy Shevchenko"
<andy.shevchenko@...il.com>, "Simon Horman" <horms@...nel.org>, "Lee Jones"
<lee@...nel.org>, "derek.kiernan@....com" <derek.kiernan@....com>,
"dragan.cvetic@....com" <dragan.cvetic@....com>, "Greg Kroah-Hartman"
<gregkh@...uxfoundation.org>, "Bjorn Helgaas" <bhelgaas@...gle.com>,
"Philipp Zabel" <p.zabel@...gutronix.de>, "Lars Povlsen"
<lars.povlsen@...rochip.com>, "Steen Hegelund"
<Steen.Hegelund@...rochip.com>, "Daniel Machon"
<daniel.machon@...rochip.com>, UNGLinuxDriver@...rochip.com, "Rob Herring"
<robh@...nel.org>, "Krzysztof Kozlowski" <krzk+dt@...nel.org>, "Conor
Dooley" <conor+dt@...nel.org>, "Saravana Kannan" <saravanak@...gle.com>,
"David S . Miller" <davem@...emloft.net>, "Eric Dumazet"
<edumazet@...gle.com>, "Jakub Kicinski" <kuba@...nel.org>, "Paolo Abeni"
<pabeni@...hat.com>, "Horatiu Vultur" <horatiu.vultur@...rochip.com>,
"Andrew Lunn" <andrew@...n.ch>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, Netdev <netdev@...r.kernel.org>,
linux-pci@...r.kernel.org, linux-arm-kernel@...ts.infradead.org, "Allan
Nielsen" <allan.nielsen@...rochip.com>, "Luca Ceresoli"
<luca.ceresoli@...tlin.com>, "Thomas Petazzoni"
<thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH v6 2/7] reset: mchp: sparx5: Use the second reg item
when cpu-syscon is not present
On Mon, 30 Sep 2024 13:57:01 +0000
"Arnd Bergmann" <arnd@...db.de> wrote:
> On Mon, Sep 30, 2024, at 12:15, Herve Codina wrote:
> > In the LAN966x PCI device use case, syscon cannot be used as syscon
> > devices do not support removal [1]. A syscon device is a core "system"
> > device and not a device available in some addon boards and so, it is not
> > supposed to be removed.
> >
> > In order to remove the syscon usage, use a local mapping of a reg
> > address range when cpu-syscon is not present.
> >
> > Link: https://lore.kernel.org/all/20240923100741.11277439@bootlin.com/ [1]
> > Signed-off-by: Herve Codina <herve.codina@...tlin.com>
> > ---
>
> >> err = mchp_sparx5_map_syscon(pdev, "cpu-syscon", &ctx->cpu_ctrl);
> > - if (err)
> > + switch (err) {
> > + case 0:
> > + break;
> > + case -ENODEV:
>
> I was expecting a patch that would read the phandle and map the
> syscon node to keep the behavior unchanged, but I guess this one
> works as well.
>
> The downside of your approach is that it requires an different
> DT binding, which only works as long as there are no other
> users of the syscon registers.
Yes, I knwow but keeping the binding with the syscon device (i.e. compatible
= "...", "syscon";) leads to confusion.
Indeed, the syscon API cannot be used because using this API leads issues
when the syscon device is removed.
That means the you have a "syscon" node (compatible = "syscon") but we cannot
use the syscon API (include/linux/mfd/syscon.h) with this node.
Also, in order to share resources between several consumers of the "syscon"
registers, we need exactly what is done in syscon. I mean we need to map
resources only once, provide this resource throught a regmap an share this
regmap between the consumers. Indeed a lock needs to be shared in order to
protect against registers RMW accesses done by several consumers.
In other word, we need to copy/paste syscon code with support for removal
implemented (feature needed in the LAN966x PCI device use case).
So, I found really simpler and less confusing to fully discard the syscon node
and handle registers directly in the only one consumer.
With all of these, do you thing my approach can be acceptable ?
Best regards,
Hervé
Powered by blists - more mailing lists