lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Wed, 15 Jan 2020 14:13:25 +0000 From: Bryan O'Donoghue <bryan.odonoghue@...aro.org> To: linux-arm-msm@...r.kernel.org, linux-usb@...r.kernel.org, gregkh@...uxfoundation.org, jackp@...eaurora.org, balbi@...nel.org, bjorn.andersson@...aro.org Cc: linux-kernel@...r.kernel.org, Bryan O'Donoghue <bryan.odonoghue@...aro.org>, John Stultz <john.stultz@...aro.org>, Lee Jones <lee.jones@...aro.org>, Rob Herring <robh+dt@...nel.org>, Mark Rutland <mark.rutland@....com>, ShuFan Lee <shufan_lee@...htek.com>, Heikki Krogerus <heikki.krogerus@...ux.intel.com>, Suzuki K Poulose <suzuki.poulose@....com>, Chunfeng Yun <chunfeng.yun@...iatek.com>, Yu Chen <chenyu56@...wei.com>, Hans de Goede <hdegoede@...hat.com>, Andy Shevchenko <andy.shevchenko@...il.com>, Jun Li <lijun.kernel@...il.com>, Valentin Schneider <valentin.schneider@....com>, devicetree@...r.kernel.org Subject: [PATCH 11/19] usb: dwc3: Add support for usb-conn-gpio connectors This patch adds the ability to probe and enumerate a connector based on usb-conn-gpio. A device node label gpio_usb_connector is used to identify a usb-conn-gpio as a child of the USB interface. You would use usb-conn-gpio when a regulator in your system provides VBUS directly to the connector instead of supplying via the USB PHY. The parent device must have the "usb-role-switch" property, so that when the usb-conn-gpio driver calls usb_role_switch_set_role() the notification in dwc3 will run and the block registers will be updated to match the state detected at the connector. Cc: John Stultz <john.stultz@...aro.org> Cc: Bjorn Andersson <bjorn.andersson@...aro.org> Cc: Lee Jones <lee.jones@...aro.org> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org> Cc: Rob Herring <robh+dt@...nel.org> Cc: Mark Rutland <mark.rutland@....com> CC: ShuFan Lee <shufan_lee@...htek.com> Cc: Heikki Krogerus <heikki.krogerus@...ux.intel.com> Cc: Suzuki K Poulose <suzuki.poulose@....com> Cc: Chunfeng Yun <chunfeng.yun@...iatek.com> Cc: Yu Chen <chenyu56@...wei.com> Cc: Felipe Balbi <balbi@...nel.org> Cc: Hans de Goede <hdegoede@...hat.com> Cc: Andy Shevchenko <andy.shevchenko@...il.com> Cc: Jun Li <lijun.kernel@...il.com> Cc: Valentin Schneider <valentin.schneider@....com> Cc: Jack Pham <jackp@...eaurora.org> Cc: linux-usb@...r.kernel.org Cc: devicetree@...r.kernel.org Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@...aro.org> --- drivers/usb/dwc3/drd.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c index 865341facece..c6bb7cb809d5 100644 --- a/drivers/usb/dwc3/drd.c +++ b/drivers/usb/dwc3/drd.c @@ -11,6 +11,7 @@ #include <linux/of_graph.h> #include <linux/platform_device.h> #include <linux/property.h> +#include <linux/of_platform.h> #include "debug.h" #include "core.h" @@ -557,9 +558,32 @@ static int dwc3_setup_role_switch(struct dwc3 *dwc) dwc3_set_mode(dwc, mode); return 0; } + +static int dwc3_register_gpio_usb_connector(struct dwc3 *dwc) +{ + struct device *dev = dwc->dev; + struct device_node *np = dev->of_node, *con_np; + int ret; + + con_np = of_get_child_by_name(np, "gpio_usb_connector"); + if (!np) { + dev_dbg(dev, "no usb_connector child node specified\n"); + return 0; + } + + ret = of_platform_populate(np, NULL, NULL, dev); + if (ret) { + dev_err(dev, "failed to register usb_connector - %d\n", ret); + return ret; + } + + return 0; +} + #else #define ROLE_SWITCH 0 #define dwc3_setup_role_switch(x) 0 +#define dwc3_register_gpio_usb_connector(x) 0 #endif int dwc3_drd_init(struct dwc3 *dwc) @@ -575,6 +599,9 @@ int dwc3_drd_init(struct dwc3 *dwc) ret = dwc3_setup_role_switch(dwc); if (ret < 0) return ret; + ret = dwc3_register_gpio_usb_connector(dwc); + if (ret < 0) + return ret; } else if (dwc->edev) { dwc->edev_nb.notifier_call = dwc3_drd_notifier; ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST, -- 2.24.0
Powered by blists - more mailing lists