[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <63e9ab78-3e5a-4d2f-8a67-c002142ca852@linaro.org>
Date: Mon, 29 Jan 2024 09:46:13 +0100
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: neil.armstrong@...aro.org,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Banajit Goswami <bgoswami@...cinc.com>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>, Liam Girdwood
<lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>, Philipp Zabel <p.zabel@...gutronix.de>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Viresh Kumar <viresh.kumar@...aro.org>, Frank Rowand
<frowand.list@...il.com>, Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, alsa-devel@...a-project.org,
linux-arm-msm@...r.kernel.org, linux-sound@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org
Cc: Bartosz Golaszewski <brgl@...ev.pl>,
Chris Packham <chris.packham@...iedtelesis.co.nz>,
Sean Anderson <sean.anderson@...o.com>
Subject: Re: [PATCH v5 4/6] reset: Instantiate reset GPIO controller for
shared reset-gpios
On 25/01/2024 09:27, neil.armstrong@...aro.org wrote:
> On 24/01/2024 08:45, Krzysztof Kozlowski wrote:
>> Devices sharing a reset GPIO could use the reset framework for
>> coordinated handling of that shared GPIO line. We have several cases of
>> such needs, at least for Devicetree-based platforms.
>>
>> If Devicetree-based device requests a reset line, while "resets"
>> Devicetree property is missing but there is a "reset-gpios" one,
>> instantiate a new "reset-gpio" platform device which will handle such
>> reset line. This allows seamless handling of such shared reset-gpios
>> without need of changing Devicetree binding [1].
>>
>> To avoid creating multiple "reset-gpio" platform devices, store the
>> Devicetree "reset-gpios" GPIO specifiers used for new devices on a
>> linked list. Later such Devicetree GPIO specifier (phandle to GPIO
>> controller, GPIO number and GPIO flags) is used to check if reset
>> controller for given GPIO was already registered.
>>
>> If two devices have conflicting "reset-gpios" property, e.g. with
>> different ACTIVE_xxx flags, this would allow to spawn two separate
>> "reset-gpio" devices, where the second would fail probing on busy GPIO
>> request.
>>
>> Link: https://lore.kernel.org/all/YXi5CUCEi7YmNxXM@robh.at.kernel.org/ [1]
>> Cc: Bartosz Golaszewski <brgl@...ev.pl>
>> Cc: Chris Packham <chris.packham@...iedtelesis.co.nz>
>> Cc: Sean Anderson <sean.anderson@...o.com>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
>>
>> ---
>>
>> Depends on previous of change.
>> ---
>> drivers/reset/core.c | 215 +++++++++++++++++++++++++++++--
>> include/linux/reset-controller.h | 4 +
>> 2 files changed, 206 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/reset/core.c b/drivers/reset/core.c
>> index 4d5a78d3c085..60a8a33c4419 100644
>> --- a/drivers/reset/core.c
>> +++ b/drivers/reset/core.c
>
> <snip>
>
>> + }
>> +
>> + ret = __reset_add_reset_gpio_lookup(id, args->np, args->args[0],
>> + args->args[1]);
>
> What would happen with gpio controllers using #gpio-cells = <3> (or more) like allwinner,sun4i-a10-pinctrl.yaml ?
>
> On this example the flags are args->args[2] so this would probably fail.
>
> This would also fails badly with #gpio-cells = <1>, args->args[1] value would be undefined.
>
> You should probably limit to args->args_count == 2 for now.
Hm, good point. Both cells are actually possible, so I need to check it.
Thanks.
Best regards,
Krzysztof
Powered by blists - more mailing lists