0001-usb-phy-phy-gpio-vbus-usb-Add-device-tree-probing.patch 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. From d5a026cc8306ccd3e99e1455c87e38f8e6fa18df Mon Sep 17 00:00:00 2001
  2. From: Linus Walleij <[email protected]>
  3. Date: Mon, 7 Nov 2022 00:05:06 +0100
  4. Subject: [PATCH 01/29] usb: phy: phy-gpio-vbus-usb: Add device tree probing
  5. Make it possible to probe the GPIO VBUS detection driver
  6. from the device tree compatible for GPIO USB B connectors.
  7. Since this driver is using the "gpio-usb-b-connector"
  8. compatible, it is important to discern it from the role
  9. switch connector driver (which does not provide a phy),
  10. so we add some Kconfig text and depend on !USB_CONN_GPIO.
  11. Cc: Rob Herring <[email protected]>
  12. Cc: Prashant Malani <[email protected]>
  13. Cc: Felipe Balbi <[email protected]>
  14. Signed-off-by: Linus Walleij <[email protected]>
  15. Link: https://lore.kernel.org/r/[email protected]
  16. Signed-off-by: Greg Kroah-Hartman <[email protected]>
  17. ---
  18. --- a/drivers/usb/phy/Kconfig
  19. +++ b/drivers/usb/phy/Kconfig
  20. @@ -93,12 +93,16 @@ config USB_GPIO_VBUS
  21. tristate "GPIO based peripheral-only VBUS sensing 'transceiver'"
  22. depends on GPIOLIB || COMPILE_TEST
  23. depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y'
  24. + depends on !USB_CONN_GPIO
  25. select USB_PHY
  26. help
  27. Provides simple GPIO VBUS sensing for controllers with an
  28. internal transceiver via the usb_phy interface, and
  29. optionally control of a D+ pullup GPIO as well as a VBUS
  30. - current limit regulator.
  31. + current limit regulator. This driver is for devices that do
  32. + NOT support role switch. OTG devices that can do role switch
  33. + (master/peripheral) shall use the USB based connection
  34. + detection driver USB_CONN_GPIO.
  35. config OMAP_OTG
  36. tristate "OMAP USB OTG controller driver"
  37. --- a/drivers/usb/phy/phy-gpio-vbus-usb.c
  38. +++ b/drivers/usb/phy/phy-gpio-vbus-usb.c
  39. @@ -366,12 +366,24 @@ static const struct dev_pm_ops gpio_vbus
  40. MODULE_ALIAS("platform:gpio-vbus");
  41. +/*
  42. + * NOTE: this driver matches against "gpio-usb-b-connector" for
  43. + * devices that do NOT support role switch.
  44. + */
  45. +static const struct of_device_id gpio_vbus_of_match[] = {
  46. + {
  47. + .compatible = "gpio-usb-b-connector",
  48. + },
  49. + {},
  50. +};
  51. +
  52. static struct platform_driver gpio_vbus_driver = {
  53. .driver = {
  54. .name = "gpio-vbus",
  55. #ifdef CONFIG_PM
  56. .pm = &gpio_vbus_dev_pm_ops,
  57. #endif
  58. + .of_match_table = gpio_vbus_of_match,
  59. },
  60. .probe = gpio_vbus_probe,
  61. .remove = gpio_vbus_remove,