gpio: Introduce gpio-delay driver and enable it on Kria
Subsystems (3)
Michal Simek
maintainerv2 cover gpio: Introduce gpio-delay driver and enable it on Kria
Hi,
we need to wait more time for getting USB hub out of reset to be able to do initialiation over i2c that's why use gpio-delay driver instead of changing waiting time in usb hub driver. Waiting time depends on gpio wiring on the board which is in some of our case going via SLG programmable device.
Thanks,
Michal
Changes in v2:
- Check return value from dm_gpio_set_value()
- Do not use GPIOD_IS_OUT when requesting gpio
- fix commit message
Michal Simek (3):
gpio: Add GPIO delay driver
xilinx: Enable GPIO delay driver on Kria platforms
arm64: zynqmp: Wire gpio-delay driver for USB hub reset
arch/arm/dts/zynqmp-sck-kd-g-revA.dtso | 13 ++- arch/arm/dts/zynqmp-sck-kr-g-revA.dtso | 16 ++- arch/arm/dts/zynqmp-sck-kr-g-revB.dtso | 16 ++- arch/arm/dts/zynqmp-sck-kv-g-revA.dtso | 13 ++- arch/arm/dts/zynqmp-sck-kv-g-revB.dtso | 11 +- configs/xilinx_zynqmp_kria_defconfig | 1 + drivers/gpio/Kconfig | 8 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-delay.c | 139 +++++++++++++++++++++++++ 9 files changed, 202 insertions(+), 16 deletions(-) create mode 100644 drivers/gpio/gpio-delay.c
Signature · 3 lines
2.43.0 base-commit: bc3e36d5bbfe1cc3cd3bf8b0e5ddcc261fbfa14d
Michal Simek
maintainerPATCH v2 2/3 xilinx: Enable GPIO delay driver on Kria platforms
GPIO delay driver is necessary to use to extend delay times for USB hubs available on the Kria platforms.
---
(no changes since v1)
configs/xilinx_zynqmp_kria_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/xilinx_zynqmp_kria_defconfig +1 -0
@@ -136,6 +136,7 @@ CONFIG_XILINX_DPDMA=y CONFIG_ARM_FFA_TRANSPORT=y CONFIG_FPGA_XILINX=y CONFIG_FPGA_ZYNQMPPL=y +CONFIG_GPIO_DELAY=y CONFIG_GPIO_HOG=y CONFIG_XILINX_GPIO=y CONFIG_DM_PCA953X=y
Signature · 1 line
2.43.0
Michal Simek
maintainerPATCH v2 1/3 gpio: Add GPIO delay driver
In reply to Michal SimekAdd a GPIO controller driver that provides configurable delays when setting GPIO output values. This is useful for hardware that requires specific timing delays during power sequencing or GPIO state changes.
The driver wraps underlying GPIO controllers and adds programmable ramp-up and ramp-down delays specified in microseconds through the device tree. Each GPIO can have independent delay timings.
Device tree binding matches Linux.
---
Changes in v2:
- Check return value from dm_gpio_set_value()
- Do not use GPIOD_IS_OUT when requesting gpio
drivers/gpio/Kconfig | 8 +++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-delay.c | 139 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+) create mode 100644 drivers/gpio/gpio-delay.c
drivers/gpio/Kconfig +8 -0
@@ -1,3 +1,11 @@ +config GPIO_DELAY + bool "GPIO delay driver" + depends on DM_GPIO + help + Enable the GPIO delay driver. + This driver allows wrapping another GPIO controller and inserting + ramp-up/ramp-down delays on output changes, as described in the + Linux gpio-delay binding. # # GPIO infrastructure and drivers #
drivers/gpio/Makefile +1 -0
@@ -21,6 +21,7 @@ obj-$(CONFIG_ATMEL_PIO4) += atmel_pio4.o obj-$(CONFIG_BCM6345_GPIO) += bcm6345_gpio.o obj-$(CONFIG_CORTINA_GPIO) += cortina_gpio.o obj-$(CONFIG_FXL6408_GPIO) += gpio-fxl6408.o +obj-$(CONFIG_GPIO_DELAY) += gpio-delay.o obj-$(CONFIG_INTEL_GPIO) += intel_gpio.o obj-$(CONFIG_INTEL_ICH6_GPIO) += intel_ich6_gpio.o obj-$(CONFIG_INTEL_BROADWELL_GPIO) += intel_broadwell_gpio.o
drivers/gpio/gpio-delay.c new file +139 -0
139 lines not on this page · raw message
Signature · 1 line
2.43.0
Michal Simek
maintainerPATCH v2 3/3 arm64: zynqmp: Wire gpio-delay driver for USB hub reset
In reply to Michal SimekUSB hub requires longer delay to get out of the reset to work properly that's why use gpio-delay to ensure enough waiting time.
---
Changes in v2:
- fix commit message
arch/arm/dts/zynqmp-sck-kd-g-revA.dtso | 13 ++++++++++--- arch/arm/dts/zynqmp-sck-kr-g-revA.dtso | 16 ++++++++++++---- arch/arm/dts/zynqmp-sck-kr-g-revB.dtso | 16 ++++++++++++---- arch/arm/dts/zynqmp-sck-kv-g-revA.dtso | 13 ++++++++++--- arch/arm/dts/zynqmp-sck-kv-g-revB.dtso | 11 +++++++++-- 5 files changed, 53 insertions(+), 16 deletions(-)
arch/arm/dts/zynqmp-sck-kd-g-revA.dtso +10 -3
@@ -3,7 +3,7 @@ * dts file for KD240 revA Carrier Card * * Copyright (C) 2021 - 2022, Xilinx, Inc. - * Copyright (C) 2022 - 2023, Advanced Micro Devices, Inc. + * Copyright (C) 2022 - 2026, Advanced Micro Devices, Inc. * * Michal Simek <[email protected]> */
@@ -43,6 +43,13 @@ #clock-cells = <0>; clock-frequency = <25000000>; }; + + slg_delay: enable-delay { + compatible = "gpio-delay"; + #gpio-cells = <3>; + gpio-controller; + gpios = <&slg7xl45106 3 GPIO_ACTIVE_LOW>; + }; }; &can0 {
@@ -116,7 +123,7 @@ reg = <1>; peer-hub = <&hub_3_0>; i2c-bus = <&hub>; - reset-gpios = <&slg7xl45106 3 GPIO_ACTIVE_LOW>; + reset-gpios = <&slg_delay 0 10000 10000>; }; /* 3.0 hub on port 2 */
@@ -125,7 +132,7 @@ reg = <2>; peer-hub = <&hub_2_0>; i2c-bus = <&hub>; - reset-gpios = <&slg7xl45106 3 GPIO_ACTIVE_LOW>; + reset-gpios = <&slg_delay 0 10000 10000>; }; };
arch/arm/dts/zynqmp-sck-kr-g-revA.dtso +12 -4
@@ -77,6 +77,14 @@ }; }; }; + + slg_delay: enable-delay { + compatible = "gpio-delay"; + #gpio-cells = <3>; + gpio-controller; + gpios = <&slg7xl45106 3 GPIO_ACTIVE_LOW>, + <&slg7xl45106 4 GPIO_ACTIVE_LOW>; + }; }; &i2c1 { /* I2C_SCK C26/C27 - MIO from SOM */
@@ -187,7 +195,7 @@ reg = <1>; peer-hub = <&hub_3_0>; i2c-bus = <&hub_1>; - reset-gpios = <&slg7xl45106 3 GPIO_ACTIVE_LOW>; + reset-gpios = <&slg_delay 0 10000 10000>; }; /* 3.0 hub on port 2 */
@@ -196,7 +204,7 @@ reg = <2>; peer-hub = <&hub_2_0>; i2c-bus = <&hub_1>; - reset-gpios = <&slg7xl45106 3 GPIO_ACTIVE_LOW>; + reset-gpios = <&slg_delay 0 10000 10000>; }; };
@@ -224,7 +232,7 @@ reg = <1>; peer-hub = <&hub1_3_0>; i2c-bus = <&hub_2>; - reset-gpios = <&slg7xl45106 4 GPIO_ACTIVE_LOW>; + reset-gpios = <&slg_delay 1 10000 10000>; }; /* 3.0 hub on port 2 */
@@ -233,7 +241,7 @@ reg = <2>; peer-hub = <&hub1_2_0>; i2c-bus = <&hub_2>; - reset-gpios = <&slg7xl45106 4 GPIO_ACTIVE_LOW>; + reset-gpios = <&slg_delay 1 10000 10000>; }; };
arch/arm/dts/zynqmp-sck-kr-g-revB.dtso +12 -4
@@ -78,6 +78,14 @@ }; }; }; + + slg_delay: enable-delay { + compatible = "gpio-delay"; + #gpio-cells = <3>; + gpio-controller; + gpios = <&slg7xl45106 3 GPIO_ACTIVE_LOW>, + <&slg7xl45106 4 GPIO_ACTIVE_LOW>; + }; }; &i2c1 { /* I2C_SCK C26/C27 - MIO from SOM */
@@ -188,7 +196,7 @@ reg = <1>; peer-hub = <&hub_3_0>; i2c-bus = <&hub_1>; - reset-gpios = <&slg7xl45106 3 GPIO_ACTIVE_LOW>; + reset-gpios = <&slg_delay 0 10000 10000>; }; /* 3.0 hub on port 2 */
@@ -197,7 +205,7 @@ reg = <2>; peer-hub = <&hub_2_0>; i2c-bus = <&hub_1>; - reset-gpios = <&slg7xl45106 3 GPIO_ACTIVE_LOW>; + reset-gpios = <&slg_delay 0 10000 10000>; }; };
@@ -225,7 +233,7 @@ reg = <1>; peer-hub = <&hub1_3_0>; i2c-bus = <&hub_2>; - reset-gpios = <&slg7xl45106 4 GPIO_ACTIVE_LOW>; + reset-gpios = <&slg_delay 1 10000 10000>; }; /* 3.0 hub on port 2 */
@@ -234,7 +242,7 @@ reg = <2>; peer-hub = <&hub1_2_0>; i2c-bus = <&hub_2>; - reset-gpios = <&slg7xl45106 4 GPIO_ACTIVE_LOW>; + reset-gpios = <&slg_delay 1 10000 10000>; }; };
arch/arm/dts/zynqmp-sck-kv-g-revA.dtso +10 -3
@@ -3,7 +3,7 @@ * dts file for KV260 revA Carrier Card * * (C) Copyright 2020 - 2022, Xilinx, Inc. - * (C) Copyright 2022 - 2025, Advanced Micro Devices, Inc. + * (C) Copyright 2022 - 2026, Advanced Micro Devices, Inc. * * SD level shifter: * "A" - A01 board un-modified (NXP)
@@ -78,6 +78,13 @@ }; }; }; + + slg_delay: enable-delay { + compatible = "gpio-delay"; + #gpio-cells = <3>; + gpio-controller; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + }; }; &i2c1 { /* I2C_SCK C23/C24 - MIO from SOM */
@@ -161,7 +168,7 @@ compatible = "usb424,2744"; reg = <1>; peer-hub = <&hub_3_0>; - reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + reset-gpios = <&slg_delay 0 10000 10000>; }; /* 3.0 hub on port 2 */
@@ -169,7 +176,7 @@ compatible = "usb424,5744"; reg = <2>; peer-hub = <&hub_2_0>; - reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + reset-gpios = <&slg_delay 0 10000 10000>; }; };
arch/arm/dts/zynqmp-sck-kv-g-revB.dtso +9 -2
@@ -74,6 +74,13 @@ }; }; }; + + slg_delay: enable-delay { + compatible = "gpio-delay"; + #gpio-cells = <3>; + gpio-controller; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + }; }; &i2c1 { /* I2C_SCK C23/C24 - MIO from SOM */
@@ -148,7 +155,7 @@ reg = <1>; peer-hub = <&hub_3_0>; i2c-bus = <&hub>; - reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + reset-gpios = <&slg_delay 0 10000 10000>; }; /* 3.0 hub on port 2 */
@@ -157,7 +164,7 @@ reg = <2>; peer-hub = <&hub_2_0>; i2c-bus = <&hub>; - reset-gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + reset-gpios = <&slg_delay 0 10000 10000>; }; };
Signature · 1 line
2.43.0
Quoted 6 lines · Michal Simek
Hi,
we need to wait more time for getting USB hub out of reset to be able to do initialiation over i2c that's why use gpio-delay driver instead of changing waiting time in usb hub driver. Waiting time depends on gpio wiring on the board which is in some of our case going via SLG programmable device.
Can you not use some regulator or make the reset assert/deassert time configurable via DT property ?
Michal Simek
maintainerQuoted 8 lines · Marek Vasut
Quoted 6 lines · Michal Simek
Hi,
we need to wait more time for getting USB hub out of reset to be able to do initialiation over i2c that's why use gpio-delay driver instead of changing waiting time in usb hub driver. Waiting time depends on gpio wiring on the board which is in some of our case going via SLG programmable device.
Can you not use some regulator or make the reset assert/deassert time configurable via DT property ?
Sorry not following. delay is configurable via DT now - the patch 3/3 for example. This avoid a need to change usb5744 driver to wait longer time which is what we discussed in past.
M
Quoted 6 lines · Michal Simek
Quoted 3 lines · Marek Vasut
Quoted 2 lines · Michal Simek
Hi,
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
we need to wait more time for getting USB hub out of reset to be able to do initialiation over i2c that's why use gpio-delay driver instead of changing waiting time in usb hub driver. Waiting time depends on gpio wiring on the board which is in some of our case going via SLG programmable device.
Can you not use some regulator or make the reset assert/deassert time configurable via DT property ?
Sorry not following. delay is configurable via DT now - the patch 3/3 for example.
3/3 never arrived in my mailbox, I think I was CCed only on 0 and 2 .
Quoted 1 line
This avoid a need to change usb5744 driver to wait longer time which is what we discussed in past.
If the delay is configurable via DT, why would the driver have to be changed ?
Hi Marek,
Quoted 11 lines · Marek Vasut
Quoted 10 lines · Michal Simek
Quoted 7 lines · Marek Vasut
Quoted 6 lines · Michal Simek
Hi,
we need to wait more time for getting USB hub out of reset to be able to do initialiation over i2c that's why use gpio-delay driver instead of changing waiting time in usb hub driver. Waiting time depends on gpio wiring on the board which is in some of our case going via SLG programmable device.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Can you not use some regulator or make the reset assert/deassert time configurable via DT property ?
Sorry not following. delay is configurable via DT now - the patch 3/3 for example.
3/3 never arrived in my mailbox, I think I was CCed only on 0 and 2 .
Quoted 1 line
This avoid a need to change usb5744 driver to wait longer time which is what we discussed in past.
If the delay is configurable via DT, why would the driver have to be changed ?
Delay is configurable via DT for the GPIO delay device. The delay is NOT configurable via DT for the USB onboard hub device. Because of the latter, the former is added as GPIO controller for adding delay to the latter driver's reset line.
Quoted 16 lines · Quentin Schulz
Hi Marek,
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Michal Simek
Quoted 8 lines · Marek Vasut
Quoted 6 lines · Michal Simek
Hi,
we need to wait more time for getting USB hub out of reset to be able to do initialiation over i2c that's why use gpio-delay driver instead of changing waiting time in usb hub driver. Waiting time depends on gpio wiring on the board which is in some of our case going via SLG programmable device.
Can you not use some regulator or make the reset assert/deassert time configurable via DT property ?
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Sorry not following. delay is configurable via DT now - the patch 3/3 for example.
3/3 never arrived in my mailbox, I think I was CCed only on 0 and 2 .
Quoted 1 line
This avoid a need to change usb5744 driver to wait longer time which is what we discussed in past.
If the delay is configurable via DT, why would the driver have to be changed ?
Delay is configurable via DT for the GPIO delay device. The delay is NOT configurable via DT for the USB onboard hub device. Because of the latter, the former is added as GPIO controller for adding delay to the latter driver's reset line.
Oh, I see, thank you for the clarification.
Quoted 30 lines · Michal Simek
Hi,
we need to wait more time for getting USB hub out of reset to be able to do initialiation over i2c that's why use gpio-delay driver instead of changing waiting time in usb hub driver. Waiting time depends on gpio wiring on the board which is in some of our case going via SLG programmable device.
Thanks,
MichalChanges in v2:
- Check return value fromdm_gpio_set_value()
- Do not useGPIOD_IS_OUTwhen requesting gpio
- fix commit messageMichal Simek (3):
gpio: Add GPIO delay driver
xilinx: Enable GPIO delay driver on Kria platforms
arm64: zynqmp: Wire gpio-delay driver for USB hub resetarch/arm/dts/zynqmp-sck-kd-g-revA.dtso | 13 ++- arch/arm/dts/zynqmp-sck-kr-g-revA.dtso | 16 ++- arch/arm/dts/zynqmp-sck-kr-g-revB.dtso | 16 ++- arch/arm/dts/zynqmp-sck-kv-g-revA.dtso | 13 ++- arch/arm/dts/zynqmp-sck-kv-g-revB.dtso | 11 +- configs/xilinx_zynqmp_kria_defconfig | 1 + drivers/gpio/Kconfig | 8 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-delay.c | 139 +++++++++++++++++++++++++ 9 files changed, 202 insertions(+), 16 deletions(-)
Quoted 2 lines
create mode 100644
drivers/gpio/gpio-delay.c
Applied.
M