Re: [PATCH] arm: dts: qcom: Sync pinctrl DT nodes with Linux bindings

2022-08-09 Thread Sumit Garg
On Sun, 7 Aug 2022 at 05:50, Ramon Fried  wrote:
>
> On Thu, Jul 14, 2022 at 10:33 AM Sumit Garg  wrote:
> >
> > Currently for all Qcom SoCs/boards there are separate compatibles for
> > GPIO and pinctrl. But this is inconsistent with official (upstream) Linux
> > bindings which requires only a single compatible "qcom,-pinctrl"
> > and there is no such compatible property as "qcom,tlmm-".
> >
> > So fix this inconsistency for Qcom SoCs in order to comply with upstream
> > DT bindings. This is done via removing compatibles from "msm_gpio" driver
> > and via binding to "msm_gpio" driver from pinctrl driver in case
> > "gpio-controller" property is specified for pinctrl node.
> >
> > Suggested-by: Stephan Gerhold 
> > Signed-off-by: Sumit Garg 
> > ---
> >
> > This is based on top of mine other patch-set [1]. Although, I have tested
> > it on db845c and qcs404-evb but I would like other board maintainers to
> > test it as well.
> >
> > [1] https://patchwork.ozlabs.org/project/uboot/list/?series=309135
> >
> >  arch/arm/dts/dragonboard410c-uboot.dtsi   |  2 +-
> >  arch/arm/dts/dragonboard410c.dts  | 17 +++-
> >  arch/arm/dts/dragonboard820c-uboot.dtsi   |  2 +-
> >  arch/arm/dts/dragonboard820c.dts  |  4 +-
> >  arch/arm/dts/qcom-ipq4019.dtsi| 18 +++--
> >  arch/arm/dts/qcs404-evb.dts   |  2 +-
> >  arch/arm/dts/sdm845.dtsi  |  2 +-
> >  arch/arm/mach-ipq40xx/pinctrl-snapdragon.c| 31 ++-
> >  arch/arm/mach-snapdragon/Makefile |  2 +-
> >  arch/arm/mach-snapdragon/pinctrl-snapdragon.c | 39 ---
> >  drivers/gpio/msm_gpio.c   | 10 +
> >  11 files changed, 83 insertions(+), 46 deletions(-)
> >
> > diff --git a/arch/arm/dts/dragonboard410c-uboot.dtsi 
> > b/arch/arm/dts/dragonboard410c-uboot.dtsi
> > index 9c1be2566f..e4fecaa19e 100644
> > --- a/arch/arm/dts/dragonboard410c-uboot.dtsi
> > +++ b/arch/arm/dts/dragonboard410c-uboot.dtsi
> > @@ -14,7 +14,7 @@
> > soc {
> > u-boot,dm-pre-reloc;
> >
> > -   qcom,tlmm@100 {
> > +   pinctrl@100 {
> > u-boot,dm-pre-reloc;
> >
> > uart {
> > diff --git a/arch/arm/dts/dragonboard410c.dts 
> > b/arch/arm/dts/dragonboard410c.dts
> > index 7e56140df2..e0452b270c 100644
> > --- a/arch/arm/dts/dragonboard410c.dts
> > +++ b/arch/arm/dts/dragonboard410c.dts
> > @@ -60,9 +60,13 @@
> > reg = <0x6 0x8000>;
> > };
> >
> > -   pinctrl: qcom,tlmm@100 {
> > -   compatible = "qcom,tlmm-apq8016";
> > +   soc_gpios: pinctrl@100 {
> > +   compatible = "qcom,apq8016-pinctrl";
> > reg = <0x100 0x40>;
> > +   gpio-controller;
> > +   gpio-count = <122>;
> > +   gpio-bank-name="soc";
> > +   #gpio-cells = <2>;
> >
> > blsp1_uart: uart {
> > function = "blsp1_uart";
> > @@ -86,15 +90,6 @@
> > pinctrl-0 = <&blsp1_uart>;
> > };
> >
> > -   soc_gpios: pinctrl@100 {
> > -   compatible = "qcom,apq8016-pinctrl";
> > -   reg = <0x100 0x30>;
> > -   gpio-controller;
> > -   gpio-count = <122>;
> > -   gpio-bank-name="soc";
> > -   #gpio-cells = <2>;
> > -   };
> > -
> > ehci@78d9000 {
> > compatible = "qcom,ehci-host";
> > reg = <0x78d9000 0x400>;
> > diff --git a/arch/arm/dts/dragonboard820c-uboot.dtsi 
> > b/arch/arm/dts/dragonboard820c-uboot.dtsi
> > index 8610d7ec37..2270ac73bf 100644
> > --- a/arch/arm/dts/dragonboard820c-uboot.dtsi
> > +++ b/arch/arm/dts/dragonboard820c-uboot.dtsi
> > @@ -13,7 +13,7 @@
> > soc {
> > u-boot,dm-pre-reloc;
> >
> > -   qcom,tlmm@101 {
> > +   pinctrl@101 {
> > u-boot,dm-pre-reloc;
> >
> > uart {
> > diff --git a/arch/arm/dts/dragonboard820c.dts 
> > b/arch/arm/dts/dragonboard820c.dts
> > index 1114ddd7d3..1a6e37887f 100644
> > --- a/arch/arm/dts/dragonboard820c.dts
> > +++ b/arch/arm/dts/dragonboard820c.dts
> > @@ -64,8 +64,8 @@
> > reg = <0x30 0x9>;
> > };
> >
> > -   pinctrl: qcom,tlmm@101 {
> > -   compatible = "qcom,tlmm-apq8096";
> > +   pinctrl: pinctrl@101 {
> > +   compatible = "qcom,msm8916-pinctrl";
> > reg = <0x101 0x40>;
> >
> > blsp8_uart: uart {
> > diff --git a/arch/arm/dts/qcom-ipq4019.d

Re: [PATCH] arm: dts: qcom: Sync pinctrl DT nodes with Linux bindings

2022-08-06 Thread Ramon Fried
On Thu, Jul 14, 2022 at 10:33 AM Sumit Garg  wrote:
>
> Currently for all Qcom SoCs/boards there are separate compatibles for
> GPIO and pinctrl. But this is inconsistent with official (upstream) Linux
> bindings which requires only a single compatible "qcom,-pinctrl"
> and there is no such compatible property as "qcom,tlmm-".
>
> So fix this inconsistency for Qcom SoCs in order to comply with upstream
> DT bindings. This is done via removing compatibles from "msm_gpio" driver
> and via binding to "msm_gpio" driver from pinctrl driver in case
> "gpio-controller" property is specified for pinctrl node.
>
> Suggested-by: Stephan Gerhold 
> Signed-off-by: Sumit Garg 
> ---
>
> This is based on top of mine other patch-set [1]. Although, I have tested
> it on db845c and qcs404-evb but I would like other board maintainers to
> test it as well.
>
> [1] https://patchwork.ozlabs.org/project/uboot/list/?series=309135
>
>  arch/arm/dts/dragonboard410c-uboot.dtsi   |  2 +-
>  arch/arm/dts/dragonboard410c.dts  | 17 +++-
>  arch/arm/dts/dragonboard820c-uboot.dtsi   |  2 +-
>  arch/arm/dts/dragonboard820c.dts  |  4 +-
>  arch/arm/dts/qcom-ipq4019.dtsi| 18 +++--
>  arch/arm/dts/qcs404-evb.dts   |  2 +-
>  arch/arm/dts/sdm845.dtsi  |  2 +-
>  arch/arm/mach-ipq40xx/pinctrl-snapdragon.c| 31 ++-
>  arch/arm/mach-snapdragon/Makefile |  2 +-
>  arch/arm/mach-snapdragon/pinctrl-snapdragon.c | 39 ---
>  drivers/gpio/msm_gpio.c   | 10 +
>  11 files changed, 83 insertions(+), 46 deletions(-)
>
> diff --git a/arch/arm/dts/dragonboard410c-uboot.dtsi 
> b/arch/arm/dts/dragonboard410c-uboot.dtsi
> index 9c1be2566f..e4fecaa19e 100644
> --- a/arch/arm/dts/dragonboard410c-uboot.dtsi
> +++ b/arch/arm/dts/dragonboard410c-uboot.dtsi
> @@ -14,7 +14,7 @@
> soc {
> u-boot,dm-pre-reloc;
>
> -   qcom,tlmm@100 {
> +   pinctrl@100 {
> u-boot,dm-pre-reloc;
>
> uart {
> diff --git a/arch/arm/dts/dragonboard410c.dts 
> b/arch/arm/dts/dragonboard410c.dts
> index 7e56140df2..e0452b270c 100644
> --- a/arch/arm/dts/dragonboard410c.dts
> +++ b/arch/arm/dts/dragonboard410c.dts
> @@ -60,9 +60,13 @@
> reg = <0x6 0x8000>;
> };
>
> -   pinctrl: qcom,tlmm@100 {
> -   compatible = "qcom,tlmm-apq8016";
> +   soc_gpios: pinctrl@100 {
> +   compatible = "qcom,apq8016-pinctrl";
> reg = <0x100 0x40>;
> +   gpio-controller;
> +   gpio-count = <122>;
> +   gpio-bank-name="soc";
> +   #gpio-cells = <2>;
>
> blsp1_uart: uart {
> function = "blsp1_uart";
> @@ -86,15 +90,6 @@
> pinctrl-0 = <&blsp1_uart>;
> };
>
> -   soc_gpios: pinctrl@100 {
> -   compatible = "qcom,apq8016-pinctrl";
> -   reg = <0x100 0x30>;
> -   gpio-controller;
> -   gpio-count = <122>;
> -   gpio-bank-name="soc";
> -   #gpio-cells = <2>;
> -   };
> -
> ehci@78d9000 {
> compatible = "qcom,ehci-host";
> reg = <0x78d9000 0x400>;
> diff --git a/arch/arm/dts/dragonboard820c-uboot.dtsi 
> b/arch/arm/dts/dragonboard820c-uboot.dtsi
> index 8610d7ec37..2270ac73bf 100644
> --- a/arch/arm/dts/dragonboard820c-uboot.dtsi
> +++ b/arch/arm/dts/dragonboard820c-uboot.dtsi
> @@ -13,7 +13,7 @@
> soc {
> u-boot,dm-pre-reloc;
>
> -   qcom,tlmm@101 {
> +   pinctrl@101 {
> u-boot,dm-pre-reloc;
>
> uart {
> diff --git a/arch/arm/dts/dragonboard820c.dts 
> b/arch/arm/dts/dragonboard820c.dts
> index 1114ddd7d3..1a6e37887f 100644
> --- a/arch/arm/dts/dragonboard820c.dts
> +++ b/arch/arm/dts/dragonboard820c.dts
> @@ -64,8 +64,8 @@
> reg = <0x30 0x9>;
> };
>
> -   pinctrl: qcom,tlmm@101 {
> -   compatible = "qcom,tlmm-apq8096";
> +   pinctrl: pinctrl@101 {
> +   compatible = "qcom,msm8916-pinctrl";
> reg = <0x101 0x40>;
>
> blsp8_uart: uart {
> diff --git a/arch/arm/dts/qcom-ipq4019.dtsi b/arch/arm/dts/qcom-ipq4019.dtsi
> index 7a52ea2c4e..181732d262 100644
> --- a/arch/arm/dts/qcom-ipq4019.dtsi
> +++ b/arch/arm/dts/qcom-ipq4019.dtsi
> @@ -75,9 +75,13 @@
> u-boot,dm-pre-reloc;
> };
>
> -   pinctrl: qcom,tlmm@1000

Re: [PATCH] arm: dts: qcom: Sync pinctrl DT nodes with Linux bindings

2022-07-18 Thread Sumit Garg
On Sat, 16 Jul 2022 at 18:54, Stephan Gerhold  wrote:
>
> On Fri, Jul 15, 2022 at 03:21:45PM +0530, Sumit Garg wrote:
> > On Thu, 14 Jul 2022 at 23:45, Stephan Gerhold  wrote:
> > > On Thu, Jul 14, 2022 at 01:03:37PM +0530, Sumit Garg wrote:
> > > > This is based on top of mine other patch-set [1]. Although, I have
> > > > tested it on db845c and qcs404-evb but I would like other board
> > > > maintainers to test it as well.
> > > >
> > > > [1] https://patchwork.ozlabs.org/project/uboot/list/?series=309135
> > >
> > > If possible I would prefer to introduce the QCS404 platform with a clean
> > > DT (i.e. qcs404.dtsi imported from the Linux kernel, instead of adding
> > > the custom qcs404-evb.dts and then cleaning it up). This patch would
> > > need to come before the QCS404 addition then.
> > >
> >
> > Sorry but it's unfair to block new SoCs/boards support until all the
> > existing mess around DT is cleaned up in Qcom specific u-boot drivers.
> > This patch is a good example to demonstrate that all corresponding
> > boards DT need to be fixed as well which requires testing. And I don't
> > even have access to starqltechn, ipq4019 based board and db820c.
> >
>
> Sorry, I thought this is the only patch you need to use the Linux QCS404
> DT as-is (maybe I misunderstood). I'm not expecting that you clean up
> all existing boards first of course. :) I just thought it would be nice
> to start clean for QCS404 immediately if this is the only patch you need.
>
> This patch looks simple enough for me if we test it on a couple of
> boards, the pinctrl setup is fairly similar across all of them. However,
> I wrote this before the comments with the additional "reg"s below. If we
> need to add handling for that as well the patch will need to become a
> bit larger of course, maybe too large to prepend it to your QCS404
> series.

Yeah especially the test dependency makes it cumbersome to prepend it
to QCS404 series.

>
> > AFAIK, it's not a requirement yet but a recommendation at this stage
> > to import DT directly from Linux kernel and work with it. But I would
> > be very happy to work in this direction to make Qcom SoCs/boards DT
> > compliant. So I would request the merge of new boards support and then
> > we can follow up with patches like this one.
> >
>
> Thanks! I'm not familiar with the requirements so I'll leave this up to
> Tom to decide. :)
>
> > [...]
> > > > diff --git a/arch/arm/dts/qcs404-evb.dts b/arch/arm/dts/qcs404-evb.dts
> > > > index 4f0ae20bdb..09687e1fd3 100644
> > > > --- a/arch/arm/dts/qcs404-evb.dts
> > > > +++ b/arch/arm/dts/qcs404-evb.dts
> > > > @@ -38,7 +38,7 @@
> > > >   compatible = "simple-bus";
> > > >
> > > >   pinctrl_north@130 {
> > > > - compatible = "qcom,tlmm-qcs404";
> > > > + compatible = "qcom,qcs404-pinctrl";
> > > >   reg = <0x130 0x20>;
> > >
> > > The Linux node still looks a bit different (from qcs404.dtsi):
> > >
> > > tlmm: pinctrl@100 {
> > > compatible = "qcom,qcs404-pinctrl";
> > > reg = <0x0100 0x20>,
> > >   <0x0130 0x20>,
> > >   <0x07b0 0x20>;
> > > reg-names = "south", "north", "east";
> > >
> > > I guess we'll need to fetch the "north" region from it (if that's what
> > > you need)?
> >
> > This is another example of a shortcut already used by the u-boot
> > pinctrl driver (arch/arm/mach-snapdragon/pinctrl-snapdragon.c). You
> > can find another user here (arch/arm/dts/sdm845.dtsi). So the pinctrl
> > drivers need to be converted to a format supported by Linux kernel.
> > Also, the pinctrl drivers need to be moved to "drivers/pinctrl/qcom/"
> > dir instead.
> >
>
> Right. FYI, there is started work on one possible solution for this
> here: https://github.com/minlexx/u-boot-2nd/commits/660
>
> Basically Alexey (now in Cc) and Michael ported parts of the Linux
> pinctrl-msm driver to U-Boot, in a way that you can mostly just copy the
> platform specific definitions as-is. The additional memory regions are
> handled correctly there AFAICT.
>
> The code size overall is quite a bit higher of course, but I think this
> is not a problem for any of the Qualcomm boards in U-Boot. The ease of
> porting and flexibility should outweigh the cost here, I think.

I had a brief look at this WIP patch-set but in general this should be
the direction we should pursue longer term. Although I think the
platform specific definitions could be limited to what's actually
required for u-boot to function properly rather than adding redundant
code. I think in a similar manner we need to generalize Qcom clock
drivers as well (move from arch/arm/mach-snapdragon/clock-* ->
drivers/clk/qcom/).

I would be happy to review this patch-set once it's posted upstream
and would be able to port platforms which I have access to using a

Re: [PATCH] arm: dts: qcom: Sync pinctrl DT nodes with Linux bindings

2022-07-16 Thread Stephan Gerhold
On Fri, Jul 15, 2022 at 03:21:45PM +0530, Sumit Garg wrote:
> On Thu, 14 Jul 2022 at 23:45, Stephan Gerhold  wrote:
> > On Thu, Jul 14, 2022 at 01:03:37PM +0530, Sumit Garg wrote:
> > > This is based on top of mine other patch-set [1]. Although, I have
> > > tested it on db845c and qcs404-evb but I would like other board
> > > maintainers to test it as well.
> > >
> > > [1] https://patchwork.ozlabs.org/project/uboot/list/?series=309135
> >
> > If possible I would prefer to introduce the QCS404 platform with a clean
> > DT (i.e. qcs404.dtsi imported from the Linux kernel, instead of adding
> > the custom qcs404-evb.dts and then cleaning it up). This patch would
> > need to come before the QCS404 addition then.
> >
> 
> Sorry but it's unfair to block new SoCs/boards support until all the
> existing mess around DT is cleaned up in Qcom specific u-boot drivers.
> This patch is a good example to demonstrate that all corresponding
> boards DT need to be fixed as well which requires testing. And I don't
> even have access to starqltechn, ipq4019 based board and db820c.
> 

Sorry, I thought this is the only patch you need to use the Linux QCS404
DT as-is (maybe I misunderstood). I'm not expecting that you clean up
all existing boards first of course. :) I just thought it would be nice
to start clean for QCS404 immediately if this is the only patch you need.

This patch looks simple enough for me if we test it on a couple of
boards, the pinctrl setup is fairly similar across all of them. However,
I wrote this before the comments with the additional "reg"s below. If we
need to add handling for that as well the patch will need to become a
bit larger of course, maybe too large to prepend it to your QCS404
series.

> AFAIK, it's not a requirement yet but a recommendation at this stage
> to import DT directly from Linux kernel and work with it. But I would
> be very happy to work in this direction to make Qcom SoCs/boards DT
> compliant. So I would request the merge of new boards support and then
> we can follow up with patches like this one.
> 

Thanks! I'm not familiar with the requirements so I'll leave this up to
Tom to decide. :)

> [...]
> > > diff --git a/arch/arm/dts/qcs404-evb.dts b/arch/arm/dts/qcs404-evb.dts
> > > index 4f0ae20bdb..09687e1fd3 100644
> > > --- a/arch/arm/dts/qcs404-evb.dts
> > > +++ b/arch/arm/dts/qcs404-evb.dts
> > > @@ -38,7 +38,7 @@
> > >   compatible = "simple-bus";
> > >
> > >   pinctrl_north@130 {
> > > - compatible = "qcom,tlmm-qcs404";
> > > + compatible = "qcom,qcs404-pinctrl";
> > >   reg = <0x130 0x20>;
> >
> > The Linux node still looks a bit different (from qcs404.dtsi):
> >
> > tlmm: pinctrl@100 {
> > compatible = "qcom,qcs404-pinctrl";
> > reg = <0x0100 0x20>,
> >   <0x0130 0x20>,
> >   <0x07b0 0x20>;
> > reg-names = "south", "north", "east";
> >
> > I guess we'll need to fetch the "north" region from it (if that's what
> > you need)?
> 
> This is another example of a shortcut already used by the u-boot
> pinctrl driver (arch/arm/mach-snapdragon/pinctrl-snapdragon.c). You
> can find another user here (arch/arm/dts/sdm845.dtsi). So the pinctrl
> drivers need to be converted to a format supported by Linux kernel.
> Also, the pinctrl drivers need to be moved to "drivers/pinctrl/qcom/"
> dir instead.
> 

Right. FYI, there is started work on one possible solution for this
here: https://github.com/minlexx/u-boot-2nd/commits/660

Basically Alexey (now in Cc) and Michael ported parts of the Linux
pinctrl-msm driver to U-Boot, in a way that you can mostly just copy the
platform specific definitions as-is. The additional memory regions are
handled correctly there AFAICT.

The code size overall is quite a bit higher of course, but I think this
is not a problem for any of the Qualcomm boards in U-Boot. The ease of
porting and flexibility should outweigh the cost here, I think.

Thanks,
Stephan


Re: [PATCH] arm: dts: qcom: Sync pinctrl DT nodes with Linux bindings

2022-07-15 Thread Sumit Garg
On Thu, 14 Jul 2022 at 23:45, Stephan Gerhold  wrote:
>
> On Thu, Jul 14, 2022 at 01:03:37PM +0530, Sumit Garg wrote:
> > Currently for all Qcom SoCs/boards there are separate compatibles for
> > GPIO and pinctrl. But this is inconsistent with official (upstream) Linux
> > bindings which requires only a single compatible "qcom,-pinctrl"
> > and there is no such compatible property as "qcom,tlmm-".
> >
> > So fix this inconsistency for Qcom SoCs in order to comply with upstream
> > DT bindings. This is done via removing compatibles from "msm_gpio" driver
> > and via binding to "msm_gpio" driver from pinctrl driver in case
> > "gpio-controller" property is specified for pinctrl node.
> >
> > Suggested-by: Stephan Gerhold 
> > Signed-off-by: Sumit Garg 
>
> This is a great start, thank you!
>

You are welcome.

> > ---
> >
> > This is based on top of mine other patch-set [1]. Although, I have
> > tested it on db845c and qcs404-evb but I would like other board
> > maintainers to test it as well.
> >
> > [1] https://patchwork.ozlabs.org/project/uboot/list/?series=309135
>
> If possible I would prefer to introduce the QCS404 platform with a clean
> DT (i.e. qcs404.dtsi imported from the Linux kernel, instead of adding
> the custom qcs404-evb.dts and then cleaning it up). This patch would
> need to come before the QCS404 addition then.
>

Sorry but it's unfair to block new SoCs/boards support until all the
existing mess around DT is cleaned up in Qcom specific u-boot drivers.
This patch is a good example to demonstrate that all corresponding
boards DT need to be fixed as well which requires testing. And I don't
even have access to starqltechn, ipq4019 based board and db820c.

AFAIK, it's not a requirement yet but a recommendation at this stage
to import DT directly from Linux kernel and work with it. But I would
be very happy to work in this direction to make Qcom SoCs/boards DT
compliant. So I would request the merge of new boards support and then
we can follow up with patches like this one.

> >
> >  arch/arm/dts/dragonboard410c-uboot.dtsi   |  2 +-
> >  arch/arm/dts/dragonboard410c.dts  | 17 +++-
> >  arch/arm/dts/dragonboard820c-uboot.dtsi   |  2 +-
> >  arch/arm/dts/dragonboard820c.dts  |  4 +-
> >  arch/arm/dts/qcom-ipq4019.dtsi| 18 +++--
> >  arch/arm/dts/qcs404-evb.dts   |  2 +-
> >  arch/arm/dts/sdm845.dtsi  |  2 +-
> >  arch/arm/mach-ipq40xx/pinctrl-snapdragon.c| 31 ++-
> >  arch/arm/mach-snapdragon/Makefile |  2 +-
> >  arch/arm/mach-snapdragon/pinctrl-snapdragon.c | 39 ---
> >  drivers/gpio/msm_gpio.c   | 10 +
> >  11 files changed, 83 insertions(+), 46 deletions(-)
> >
> > [...]
> > diff --git a/arch/arm/dts/dragonboard410c.dts 
> > b/arch/arm/dts/dragonboard410c.dts
> > index 7e56140df2..e0452b270c 100644
> > --- a/arch/arm/dts/dragonboard410c.dts
> > +++ b/arch/arm/dts/dragonboard410c.dts
> > @@ -60,9 +60,13 @@
> >   reg = <0x6 0x8000>;
> >   };
> >
> > - pinctrl: qcom,tlmm@100 {
> > - compatible = "qcom,tlmm-apq8016";
> > + soc_gpios: pinctrl@100 {
> > + compatible = "qcom,apq8016-pinctrl";
>
> This should be "qcom,msm8916-pinctrl" (see msm8916.dtsi in Linux)
>

Ack.

> >   reg = <0x100 0x40>;
> > + gpio-controller;
> > + gpio-count = <122>;
> > + gpio-bank-name="soc";
> > + #gpio-cells = <2>;
> >
> >   blsp1_uart: uart {
> >   function = "blsp1_uart";
> > @@ -86,15 +90,6 @@
> >   pinctrl-0 = <&blsp1_uart>;
> >   };
> >
> > - soc_gpios: pinctrl@100 {
> > - compatible = "qcom,apq8016-pinctrl";
> > - reg = <0x100 0x30>;
> > - gpio-controller;
> > - gpio-count = <122>;
> > - gpio-bank-name="soc";
> > - #gpio-cells = <2>;
> > - };
> > -
> >   ehci@78d9000 {
> >   compatible = "qcom,ehci-host";
> >   reg = <0x78d9000 0x400>;
> > [...]
> > diff --git a/arch/arm/dts/dragonboard820c.dts 
> > b/arch/arm/dts/dragonboard820c.dts
> > index 1114ddd7d3..1a6e37887f 100644
> > --- a/arch/arm/dts/dragonboard820c.dts
> > +++ b/arch/arm/dts/dragonboard820c.dts
> > @@ -64,8 +64,8 @@
> >   reg = <0x30 0x9>;
> >   };
> >
> > - pinctrl: qcom,tlmm@101 {
> > - compatible = "qcom,tlmm-apq8096";
> > + pinctrl: pinctrl@101 {
> > + compatible = "qcom,msm8916-pinctrl";
>
> Huh, this should be "qcom,msm8996-pinctrl" :)
>

Correct, I mixed it up.

> > 

Re: [PATCH] arm: dts: qcom: Sync pinctrl DT nodes with Linux bindings

2022-07-14 Thread Stephan Gerhold
On Thu, Jul 14, 2022 at 01:03:37PM +0530, Sumit Garg wrote:
> Currently for all Qcom SoCs/boards there are separate compatibles for
> GPIO and pinctrl. But this is inconsistent with official (upstream) Linux
> bindings which requires only a single compatible "qcom,-pinctrl"
> and there is no such compatible property as "qcom,tlmm-".
> 
> So fix this inconsistency for Qcom SoCs in order to comply with upstream
> DT bindings. This is done via removing compatibles from "msm_gpio" driver
> and via binding to "msm_gpio" driver from pinctrl driver in case
> "gpio-controller" property is specified for pinctrl node.
> 
> Suggested-by: Stephan Gerhold 
> Signed-off-by: Sumit Garg 

This is a great start, thank you!

> ---
> 
> This is based on top of mine other patch-set [1]. Although, I have
> tested it on db845c and qcs404-evb but I would like other board
> maintainers to test it as well.
>
> [1] https://patchwork.ozlabs.org/project/uboot/list/?series=309135

If possible I would prefer to introduce the QCS404 platform with a clean
DT (i.e. qcs404.dtsi imported from the Linux kernel, instead of adding
the custom qcs404-evb.dts and then cleaning it up). This patch would
need to come before the QCS404 addition then.

> 
>  arch/arm/dts/dragonboard410c-uboot.dtsi   |  2 +-
>  arch/arm/dts/dragonboard410c.dts  | 17 +++-
>  arch/arm/dts/dragonboard820c-uboot.dtsi   |  2 +-
>  arch/arm/dts/dragonboard820c.dts  |  4 +-
>  arch/arm/dts/qcom-ipq4019.dtsi| 18 +++--
>  arch/arm/dts/qcs404-evb.dts   |  2 +-
>  arch/arm/dts/sdm845.dtsi  |  2 +-
>  arch/arm/mach-ipq40xx/pinctrl-snapdragon.c| 31 ++-
>  arch/arm/mach-snapdragon/Makefile |  2 +-
>  arch/arm/mach-snapdragon/pinctrl-snapdragon.c | 39 ---
>  drivers/gpio/msm_gpio.c   | 10 +
>  11 files changed, 83 insertions(+), 46 deletions(-)
> 
> [...]
> diff --git a/arch/arm/dts/dragonboard410c.dts 
> b/arch/arm/dts/dragonboard410c.dts
> index 7e56140df2..e0452b270c 100644
> --- a/arch/arm/dts/dragonboard410c.dts
> +++ b/arch/arm/dts/dragonboard410c.dts
> @@ -60,9 +60,13 @@
>   reg = <0x6 0x8000>;
>   };
>  
> - pinctrl: qcom,tlmm@100 {
> - compatible = "qcom,tlmm-apq8016";
> + soc_gpios: pinctrl@100 {
> + compatible = "qcom,apq8016-pinctrl";

This should be "qcom,msm8916-pinctrl" (see msm8916.dtsi in Linux)

>   reg = <0x100 0x40>;
> + gpio-controller;
> + gpio-count = <122>;
> + gpio-bank-name="soc";
> + #gpio-cells = <2>;
>  
>   blsp1_uart: uart {
>   function = "blsp1_uart";
> @@ -86,15 +90,6 @@
>   pinctrl-0 = <&blsp1_uart>;
>   };
>  
> - soc_gpios: pinctrl@100 {
> - compatible = "qcom,apq8016-pinctrl";
> - reg = <0x100 0x30>;
> - gpio-controller;
> - gpio-count = <122>;
> - gpio-bank-name="soc";
> - #gpio-cells = <2>;
> - };
> -
>   ehci@78d9000 {
>   compatible = "qcom,ehci-host";
>   reg = <0x78d9000 0x400>;
> [...]
> diff --git a/arch/arm/dts/dragonboard820c.dts 
> b/arch/arm/dts/dragonboard820c.dts
> index 1114ddd7d3..1a6e37887f 100644
> --- a/arch/arm/dts/dragonboard820c.dts
> +++ b/arch/arm/dts/dragonboard820c.dts
> @@ -64,8 +64,8 @@
>   reg = <0x30 0x9>;
>   };
>  
> - pinctrl: qcom,tlmm@101 {
> - compatible = "qcom,tlmm-apq8096";
> + pinctrl: pinctrl@101 {
> + compatible = "qcom,msm8916-pinctrl";

Huh, this should be "qcom,msm8996-pinctrl" :)

>   reg = <0x101 0x40>;
>  
>   blsp8_uart: uart {
> [...]
> diff --git a/arch/arm/dts/qcs404-evb.dts b/arch/arm/dts/qcs404-evb.dts
> index 4f0ae20bdb..09687e1fd3 100644
> --- a/arch/arm/dts/qcs404-evb.dts
> +++ b/arch/arm/dts/qcs404-evb.dts
> @@ -38,7 +38,7 @@
>   compatible = "simple-bus";
>  
>   pinctrl_north@130 {
> - compatible = "qcom,tlmm-qcs404";
> + compatible = "qcom,qcs404-pinctrl";
>   reg = <0x130 0x20>;

The Linux node still looks a bit different (from qcs404.dtsi):

tlmm: pinctrl@100 {
compatible = "qcom,qcs404-pinctrl";
reg = <0x0100 0x20>,
  <0x0130 0x20>,
  <0x07b0 0x20>;
reg-names = "south", "north", "east";

I guess we'll need to fet

[PATCH] arm: dts: qcom: Sync pinctrl DT nodes with Linux bindings

2022-07-14 Thread Sumit Garg
Currently for all Qcom SoCs/boards there are separate compatibles for
GPIO and pinctrl. But this is inconsistent with official (upstream) Linux
bindings which requires only a single compatible "qcom,-pinctrl"
and there is no such compatible property as "qcom,tlmm-".

So fix this inconsistency for Qcom SoCs in order to comply with upstream
DT bindings. This is done via removing compatibles from "msm_gpio" driver
and via binding to "msm_gpio" driver from pinctrl driver in case
"gpio-controller" property is specified for pinctrl node.

Suggested-by: Stephan Gerhold 
Signed-off-by: Sumit Garg 
---

This is based on top of mine other patch-set [1]. Although, I have tested
it on db845c and qcs404-evb but I would like other board maintainers to
test it as well.

[1] https://patchwork.ozlabs.org/project/uboot/list/?series=309135

 arch/arm/dts/dragonboard410c-uboot.dtsi   |  2 +-
 arch/arm/dts/dragonboard410c.dts  | 17 +++-
 arch/arm/dts/dragonboard820c-uboot.dtsi   |  2 +-
 arch/arm/dts/dragonboard820c.dts  |  4 +-
 arch/arm/dts/qcom-ipq4019.dtsi| 18 +++--
 arch/arm/dts/qcs404-evb.dts   |  2 +-
 arch/arm/dts/sdm845.dtsi  |  2 +-
 arch/arm/mach-ipq40xx/pinctrl-snapdragon.c| 31 ++-
 arch/arm/mach-snapdragon/Makefile |  2 +-
 arch/arm/mach-snapdragon/pinctrl-snapdragon.c | 39 ---
 drivers/gpio/msm_gpio.c   | 10 +
 11 files changed, 83 insertions(+), 46 deletions(-)

diff --git a/arch/arm/dts/dragonboard410c-uboot.dtsi 
b/arch/arm/dts/dragonboard410c-uboot.dtsi
index 9c1be2566f..e4fecaa19e 100644
--- a/arch/arm/dts/dragonboard410c-uboot.dtsi
+++ b/arch/arm/dts/dragonboard410c-uboot.dtsi
@@ -14,7 +14,7 @@
soc {
u-boot,dm-pre-reloc;
 
-   qcom,tlmm@100 {
+   pinctrl@100 {
u-boot,dm-pre-reloc;
 
uart {
diff --git a/arch/arm/dts/dragonboard410c.dts b/arch/arm/dts/dragonboard410c.dts
index 7e56140df2..e0452b270c 100644
--- a/arch/arm/dts/dragonboard410c.dts
+++ b/arch/arm/dts/dragonboard410c.dts
@@ -60,9 +60,13 @@
reg = <0x6 0x8000>;
};
 
-   pinctrl: qcom,tlmm@100 {
-   compatible = "qcom,tlmm-apq8016";
+   soc_gpios: pinctrl@100 {
+   compatible = "qcom,apq8016-pinctrl";
reg = <0x100 0x40>;
+   gpio-controller;
+   gpio-count = <122>;
+   gpio-bank-name="soc";
+   #gpio-cells = <2>;
 
blsp1_uart: uart {
function = "blsp1_uart";
@@ -86,15 +90,6 @@
pinctrl-0 = <&blsp1_uart>;
};
 
-   soc_gpios: pinctrl@100 {
-   compatible = "qcom,apq8016-pinctrl";
-   reg = <0x100 0x30>;
-   gpio-controller;
-   gpio-count = <122>;
-   gpio-bank-name="soc";
-   #gpio-cells = <2>;
-   };
-
ehci@78d9000 {
compatible = "qcom,ehci-host";
reg = <0x78d9000 0x400>;
diff --git a/arch/arm/dts/dragonboard820c-uboot.dtsi 
b/arch/arm/dts/dragonboard820c-uboot.dtsi
index 8610d7ec37..2270ac73bf 100644
--- a/arch/arm/dts/dragonboard820c-uboot.dtsi
+++ b/arch/arm/dts/dragonboard820c-uboot.dtsi
@@ -13,7 +13,7 @@
soc {
u-boot,dm-pre-reloc;
 
-   qcom,tlmm@101 {
+   pinctrl@101 {
u-boot,dm-pre-reloc;
 
uart {
diff --git a/arch/arm/dts/dragonboard820c.dts b/arch/arm/dts/dragonboard820c.dts
index 1114ddd7d3..1a6e37887f 100644
--- a/arch/arm/dts/dragonboard820c.dts
+++ b/arch/arm/dts/dragonboard820c.dts
@@ -64,8 +64,8 @@
reg = <0x30 0x9>;
};
 
-   pinctrl: qcom,tlmm@101 {
-   compatible = "qcom,tlmm-apq8096";
+   pinctrl: pinctrl@101 {
+   compatible = "qcom,msm8916-pinctrl";
reg = <0x101 0x40>;
 
blsp8_uart: uart {
diff --git a/arch/arm/dts/qcom-ipq4019.dtsi b/arch/arm/dts/qcom-ipq4019.dtsi
index 7a52ea2c4e..181732d262 100644
--- a/arch/arm/dts/qcom-ipq4019.dtsi
+++ b/arch/arm/dts/qcom-ipq4019.dtsi
@@ -75,9 +75,13 @@
u-boot,dm-pre-reloc;
};
 
-   pinctrl: qcom,tlmm@100 {
-   compatible = "qcom,tlmm-ipq4019";
+   soc_gpios: pinctrl@100 {
+   compatible = "qcom,ipq4019-pinctrl";
reg = <0x100 0x30>;
+   gpio-controller;
+