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