mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: Xianwei Zhao <xianwei.zhao@amlogic.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Kevin Hilman <khilman@baylibre.com>,
	Jerome Brunet <jbrunet@baylibre.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-amlogic@lists.infradead.org
Subject: Re: [PATCH RFC 2/3] pinctrl: Add driver support for Amlogic SoCs
Date: Thu, 26 Dec 2024 15:49:28 +0800	[thread overview]
Message-ID: <cd67acd0-2595-496d-a725-6c3e509492aa@amlogic.com> (raw)
In-Reply-To: <CACRpkdZn75ks4Gc7rm8jzkKM6y0JeQmUF3qmbJA+O+cEA9r--Q@mail.gmail.com>

Hi Linus,
    Thanks for your reply.

On 2024/12/22 17:08, Linus Walleij wrote:
> [ EXTERNAL EMAIL ]
> 
> Hi Xianwei!
> 
> On Wed, Dec 18, 2024 at 10:37 AM Xianwei Zhao <xianwei.zhao@amlogic.com> wrote:
> 
>> [Me]
>>> In any way I recommend:
>>>
>>> - Renaming drivers/pinctrl/sunxi to drivers/pinctrl/amlogic
>>>     so we keep this sorted by actual vendor, sunxi is apparently
>>>     yours (AMlogic:s) isn't it?
>>>
>>
>> It isn't. Sunxi is Allwinner SoCs.
> 
> My apologies. I mixed it up completely. :(
> 
> What do you think of the idea of a separate drivers/pinctrl/amlogic directory
> though? I think there are already quite a few amlogic SoCs that need
> to be supported and more will come.
> 

 From the existing specifications of several subsequent chips, the 
support for the new chip does not require additional files, and there 
may be a little difference for special bank in the future chip, which 
can be solved by private architecture.

>>>> +       ret = pinconf_generic_parse_dt_config(np, info->pctl, &grp->configs,
>>>> +                                             &grp->num_configs);
>>>
>>> But can't you just move this code around? grp->num_configs give the
>>> number of configs, so why do you have to go and look up pinmux
>>> above, can't you just use grp->num_configs instead of of_pins
>>> and npins above?
>>>
>> They are different.
>> The of_pins(grp->npins) specifies the mux values for pin-mux register
>> and pin index in pinctrl. It can include multiple pins in groups.
>>
>> The grp->configs and grp->num_configs specify the configuration
>> information for all pins of this groups(such as bias-pull-up,
>> drive-strength-microamp)
>>
>> uart-d-pins2{
>>          pinmux= <AML_PINMUX(AMLOGIC_GPIO_T, 7, AF2)>,
>>                  <AML_PINMUX(AMLOGIC_GPIO_T, 8, AF2)>,
>>                  <AML_PINMUX(AMLOGIC_GPIO_T, 9, AF2)>,
>>                  <AML_PINMUX(AMLOGIC_GPIO_T, 10, AF2)>;
>>          bias-pull-up;
>>          drive-strength-microamp = <4000>;
>> };
> 
> OK I get it ... I think. It's nice that you combine muxing and pin config
> into the same node like this, it's very readable.
> 
> Think about if you even want to add generic helpers for this in
> the generic code.
> 

I will try to add API for pinmux property to pinconf-generic.c.

>>>> +static void aml_pctl_dt_child_count(struct aml_pinctrl *info,
>>>> +                                   struct device_node *np)
>>>> +{
>>>> +       struct device_node *child;
>>>> +
>>>> +       for_each_child_of_node(np, child) {
>>>> +               if (of_property_read_bool(child, "gpio-controller")) {
>>>> +                       info->nbanks++;
>>>> +               } else {
>>>> +                       info->nfunctions++;
>>>> +                       info->ngroups += of_get_child_count(child);
>>>> +               }
>>>> +       }
>>>> +}
>>>
>>> This looks like a weird dependency between gpio chips and
>>> pins that I don't quite understand. Some comments and
>>> references to the bindings will be needed so it is clear
>>> what is going on.
>>>
>>
>> A pinctrl device contains two types of nodes. The one named GPIO bank
>> which includes "gpio-controller" property. The other one named function
>> which includes one or more pin groups.
>> The pin group include pinmux property(pin index in pinctrl dev,and mux
>> vlaue in mux reg) and pin configuration properties.
> 
> OK I  guess the binding patch explains why you need several
> separate gpio controller "bank" nodes instead of just the base
> node being one for all of the pins (which is the most
> common). In a way I like it because it often helps to divide
> up GPIOs by bank.
> 
> Yours,
> Linus Walleij

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2024-12-26  7:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11  6:47 [PATCH RFC 0/3] Pinctrl: Add Amlogic pinctrl driver Xianwei Zhao via B4 Relay
2024-12-11  6:47 ` [PATCH RFC 1/3] dt-bindings: pinctrl: Add support for Amlogic SoCs Xianwei Zhao via B4 Relay
2024-12-17 14:20   ` Rob Herring
2024-12-18  8:47     ` Xianwei Zhao
2024-12-11  6:47 ` [PATCH RFC 2/3] pinctrl: Add driver " Xianwei Zhao via B4 Relay
2024-12-17 14:49   ` Linus Walleij
2024-12-17 14:53     ` Neil Armstrong
2024-12-18  9:37     ` Xianwei Zhao
2024-12-22  9:08       ` Linus Walleij
2024-12-26  7:49         ` Xianwei Zhao [this message]
2024-12-27 17:19         ` Linus Walleij
2024-12-27 21:01           ` Martin Blumenstingl
2024-12-31  8:26           ` Xianwei Zhao
2024-12-11  6:47 ` [PATCH RFC 3/3] arm64: dts: amlogic: a4: add pinctrl node Xianwei Zhao via B4 Relay

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=cd67acd0-2595-496d-a725-6c3e509492aa@amlogic.com \
    --to=xianwei.zhao@amlogic.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=robh@kernel.org \
    /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

all inboxes | Powered by JetHome®