usb: renesas_usbhs: Deprecate renesas,enable-gpio
Subsystems (4)
Geert Uytterhoeven
maintainercover usb: renesas_usbhs: Deprecate renesas,enable-gpio
Hi all,
The "gpio" suffix for GPIO consumers was deprecated a while ago, in favor of the "gpios" suffix. However, there are still several users of the "renesas,enable-gpio" property, in DT bindings and DT source files.
Hence this series deprecates the old property in the DT bindings, and converts all users in DTS files to the new property. No driver changes are needed, as devm_gpiod_get_optional() as called from usbhs_probe() tries all suffixes.
The first patch is targeted for the DT or USB tree. The second patch is targeted for the Renesas DTS tree.
Thanks for your comments!
Geert Uytterhoeven (2):
dt-bindings: usb: renesas,usbhs: Deprecate renesas,enable-gpio
ARM: dts: renesas: rcar-gen2: Switch HS-USB to renesas,enable-gpios
Documentation/devicetree/bindings/usb/renesas,usbhs.yaml | 4 ++++ arch/arm/boot/dts/renesas/r8a7790-lager.dts | 2 +- arch/arm/boot/dts/renesas/r8a7791-koelsch.dts | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-)
Signature · 12 lines
2.34.1
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus TorvaldsGeert Uytterhoeven
maintainerPATCH 1/2 dt-bindings: usb: renesas,usbhs: Deprecate renesas,enable-gpio
Commit 2071d0968e564b4b ("Documentation: gpio: guidelines for bindings") deprecated the "gpio" suffix for GPIO consumers in favor of the "gpios" suffix. Update the Renesas HS-USB DT bindings to reflect this.
--- Documentation/devicetree/bindings/usb/renesas,usbhs.yaml | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/usb/renesas,usbhs.yaml +4 -0
@@ -76,6 +76,10 @@ properties: Integer to use BUSWAIT register. renesas,enable-gpio: + deprecated: true + maxItems: 1 + + renesas,enable-gpios: maxItems: 1 description: | gpio specifier to check GPIO determining if USB function should be
Signature · 1 line
2.34.1
Re: [PATCH 1/2] dt-bindings: usb: renesas,usbhs: Deprecate renesas,enable-gpio
Quoted 2 lines
+ renesas,enable-gpios:
Isn't this a good occasion to drop the "renesas"-prefix? Binding docs are full of plain "enable-gpios".
Re: [PATCH 1/2] dt-bindings: usb: renesas,usbhs: Deprecate renesas,enable-gpio
Hi Wolfram,
CC gpio
Quoted 4 lines · Wolfram Sang
Quoted 1 line
+ renesas,enable-gpios:
Isn't this a good occasion to drop the "renesas"-prefix? Binding docs are full of plain "enable-gpios".
Well, that's of course another option (actually 3 ;-) Compared to simply switching from "renesas,enable-gpio" to "renesas,enable-gpios", dropping the vendor prefix requires changes to the HS-USB driver and/or to gpiolib. Worse, this would also become a hard dependency for updating the DTS files.
Option A: Add a call to devm_gpiod_get_optional(dev, "enable", GPIOD_IN) as a fallback to usbhs_probe().
Option B: Switch usbhs_probe() from "renesas,enable" to "enable" and add quirks to of_find_gpio_rename():
#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS)
/*
* The Renesas HS-USB DT bindings happened beforeenable-gpios
* was established as a generic property */
{ "enable", "renesas,enable-gpio",
"renesas,rza1-usbhs" },
{ "enable", "renesas,enable-gpio",
"renesas,rza2-usbhs" },
{ "enable", "renesas,enable-gpio",
"renesas,rzg2l-usbhs" },
{ "enable", "renesas,enable-gpio",
"renesas,rcar-gen2-usbhs" },
{ "enable", "renesas,enable-gpio",
"renesas,rcar-gen3-usbhs" },
#endif
Option C: Add a generic "strip vendor prefix" fallback to of_find_gpio():
const char *stripped;
if (gpiod_not_found(desc) && con_id &&
(stripped = strchr(con_id, ',')) && *(++stripped)) {
for_each_gpio_property_name(propname, stripped) {
desc = of_get_named_gpiod_flags(np, propname, idx,
&of_flags);
if (!gpiod_not_found(desc))
break;
}
}Option B adds a bit too much to my liking.
Option C may be useful for others (e.g. {ti,nxp,maxim},enable-gpio(s)), but might be considered too dangerous as a general fallback?
Thoughts?
Thanks!
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH 1/2] dt-bindings: usb: renesas,usbhs: Deprecate renesas,enable-gpio
Quoted 11 lines · Geert Uytterhoeven
Option B: Switch
usbhs_probe()from "renesas,enable" to "enable" and add quirks toof_find_gpio_rename():#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS) /* * The Renesas HS-USB DT bindings happened beforeenable-gpios
* was established as a generic property */
{ "enable", "renesas,enable-gpio",
"renesas,rza1-usbhs" },
(...)
I would actually prefer this.
Quoted 2 lines
Option C: Add a generic "strip vendor prefix" fallback to
of_find_gpio():
I understand the appeal, but the idea is for the quirks to be very specific (hence they are enabled only if specific drivers are compiled in) and not start to be helpful. Doing this would make any vendor,foo start to work and I don't like that at all: any such mechanism will invariably be abused.
Yours,
Linus Walleij
Rob Herring
maintainerRe: [PATCH 1/2] dt-bindings: usb: renesas,usbhs: Deprecate renesas,enable-gpio
Quoted 17 lines · Linus Walleij
Quoted 11 lines · Geert Uytterhoeven
Option B: Switch
usbhs_probe()from "renesas,enable" to "enable" and add quirks toof_find_gpio_rename():#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS) /* * The Renesas HS-USB DT bindings happened beforeenable-gpios
* was established as a generic property */
{ "enable", "renesas,enable-gpio",
"renesas,rza1-usbhs" },(...)
I would actually prefer this.
Quoted 8 lines
Quoted 2 lines
Option C: Add a generic "strip vendor prefix" fallback to
of_find_gpio():I understand the appeal, but the idea is for the quirks to be very specific (hence they are enabled only if specific drivers are compiled in) and not start to be helpful. Doing this would make any vendor,foo start to work and I don't like that at all: any such mechanism will invariably be abused.
+1
Unless there's a bunch more platforms coming, I'd just stick with this patch (or even do nothing).
Rob
Re: [PATCH 1/2] dt-bindings: usb: renesas,usbhs: Deprecate renesas,enable-gpio
In reply to Geert UytterhoevenQuoted 9 lines · Geert Uytterhoeven
Commit
2071d0968e564b4b("Documentation: gpio: guidelines for bindings") deprecated the "gpio" suffix for GPIO consumers in favor of the "gpios" suffix. Update the Renesas HS-USB DT bindings to reflect this.Signed-off-by Geert Uytterhoeven <[email protected]>--- Documentation/devicetree/bindings/usb/renesas,usbhs.yaml | 4 ++++ 1 file changed, 4 insertions(+)
Geert Uytterhoeven
maintainerPATCH 2/2 ARM: dts: renesas: rcar-gen2: Switch HS-USB to renesas,enable-gpios
In reply to Geert UytterhoevenCommit 2071d0968e564b4b ("Documentation: gpio: guidelines for bindings") deprecated the "gpio" suffix for GPIO consumers in favor of the "gpios" suffix. Hence replace the "renesas,enable-gpio" property by "renesas,enable-gpios" in HS-USB device nodes.
--- arch/arm/boot/dts/renesas/r8a7790-lager.dts | 2 +- arch/arm/boot/dts/renesas/r8a7791-koelsch.dts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/renesas/r8a7790-lager.dts +1 -1
@@ -890,7 +890,7 @@ &hsusb { status = "okay"; pinctrl-0 = <&hsusb_pins>; pinctrl-names = "default"; - renesas,enable-gpio = <&gpio5 18 GPIO_ACTIVE_HIGH>; + renesas,enable-gpios = <&gpio5 18 GPIO_ACTIVE_HIGH>; }; &usbphy {
arch/arm/boot/dts/renesas/r8a7791-koelsch.dts +1 -1
@@ -859,7 +859,7 @@ &hsusb { status = "okay"; pinctrl-0 = <&usb0_pins>; pinctrl-names = "default"; - renesas,enable-gpio = <&gpio5 31 GPIO_ACTIVE_HIGH>; + renesas,enable-gpios = <&gpio5 31 GPIO_ACTIVE_HIGH>; }; &usbphy {
Signature · 1 line
2.34.1