diff mbox series

[v1,2/6] arm: dts: rockchip: rk3066a-u-boot: add gpio-ranges

Message ID d6e940a1-3285-b46a-324e-0246cd4f95aa@gmail.com
State Superseded
Delegated to: Kever Yang
Headers show
Series [v1,1/6] rockchip: gpio: rk_gpio: use ROCKCHIP_GPIOS_PER_BANK as divider | expand

Commit Message

Johan Jonker March 16, 2023, 4:47 p.m. UTC
The gpio node names are made generic, but without
gpio bank ID. Add gpio-ranges to rk3066a-u-boot.dtsi
for now till a better method is found.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---
 arch/arm/dts/rk3066a-u-boot.dtsi | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

--
2.20.1

Comments

Simon Glass March 18, 2023, 8:20 p.m. UTC | #1
On Thu, 16 Mar 2023 at 10:47, Johan Jonker <jbx6244@gmail.com> wrote:
>
> The gpio node names are made generic, but without
> gpio bank ID. Add gpio-ranges to rk3066a-u-boot.dtsi
> for now till a better method is found.
>
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> ---
>  arch/arm/dts/rk3066a-u-boot.dtsi | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
Jonas Karlman March 19, 2023, 3:46 p.m. UTC | #2
Hi Johan,

On 2023-03-16 17:47, Johan Jonker wrote:
> The gpio node names are made generic, but without
> gpio bank ID. Add gpio-ranges to rk3066a-u-boot.dtsi
> for now till a better method is found.
> 
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> ---
>  arch/arm/dts/rk3066a-u-boot.dtsi | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/arch/arm/dts/rk3066a-u-boot.dtsi b/arch/arm/dts/rk3066a-u-boot.dtsi
> index bc6e609d..8d4e1ad2 100644
> --- a/arch/arm/dts/rk3066a-u-boot.dtsi
> +++ b/arch/arm/dts/rk3066a-u-boot.dtsi
> @@ -2,3 +2,28 @@
> 
>  #include "rockchip-u-boot.dtsi"
>  #include "rk3xxx-u-boot.dtsi"
> +
> +&gpio0 {
> +	gpio-ranges = <&pinctrl 0 0 32>;
> +};
> +
> +&gpio1 {
> +	gpio-ranges = <&pinctrl 0 32 32>;
> +};
> +
> +&gpio2 {
> +	gpio-ranges = <&pinctrl 0 64 32>;
> +};
> +
> +&gpio3 {
> +	gpio-ranges = <&pinctrl 0 96 32>;
> +};
> +
> +&gpio4 {
> +	gpio-ranges = <&pinctrl 0 128 32>;
> +};
> +
> +&gpio6 {
> +	gpio-ranges = <&pinctrl 0 192 32>;

I guess technically this should be <&pinctrl 0 160 16> to correctly
describe the hardware, i.e. pin 160-175 is controlled by the "gpio6"
controller. The name gpio6 should probably only be used in aliases.

I see no reason why the gpio + pinctrl drivers can't call it bank 5
instead of 6. And if that is the case I think our intended use of
gpio-ranges should be acceptable in linux and should also remove the
need for adding a new rockchip,gpio-controller prop.

Because of limitation in HW, 32 pin blocks, any other use of gpio-ranges
other than for a full 32 pin block is invalid. The gpio driver should fail
when [GPIO controller offset] != 0 or [pin controller offset] % 32 != 0
or when multiple ranges is specified.

Regards,
Jonas

> +};
> +
> --
> 2.20.1
>
diff mbox series

Patch

diff --git a/arch/arm/dts/rk3066a-u-boot.dtsi b/arch/arm/dts/rk3066a-u-boot.dtsi
index bc6e609d..8d4e1ad2 100644
--- a/arch/arm/dts/rk3066a-u-boot.dtsi
+++ b/arch/arm/dts/rk3066a-u-boot.dtsi
@@ -2,3 +2,28 @@ 

 #include "rockchip-u-boot.dtsi"
 #include "rk3xxx-u-boot.dtsi"
+
+&gpio0 {
+	gpio-ranges = <&pinctrl 0 0 32>;
+};
+
+&gpio1 {
+	gpio-ranges = <&pinctrl 0 32 32>;
+};
+
+&gpio2 {
+	gpio-ranges = <&pinctrl 0 64 32>;
+};
+
+&gpio3 {
+	gpio-ranges = <&pinctrl 0 96 32>;
+};
+
+&gpio4 {
+	gpio-ranges = <&pinctrl 0 128 32>;
+};
+
+&gpio6 {
+	gpio-ranges = <&pinctrl 0 192 32>;
+};
+