diff options
author | Li Jun <B47624@freescale.com> | 2014-10-10 15:34:39 +0800 |
---|---|---|
committer | Nitin Garg <nitin.garg@nxp.com> | 2016-01-14 10:59:15 -0600 |
commit | afb4c426c4b8da0d4a90736191bc4150b7abeb54 (patch) | |
tree | 80f88bee18baeedfdf3256c29b8829d7e66f6749 /drivers/usb | |
parent | cb94741a98495cb139ec09da51a0e6106b3ab1be (diff) |
MLK-9617-9 usb: core: hub: use a_set_b_hnp_en and b_hnp_en for otg fsm mode
Use a_set_b_hnp_en to identify if a host can succeed to set b_hnp_enable
for B device, use b_hnp_enable flag to identify if the connected OTG device
is HNP capable. So if the connected otg device is HNP capable but b_hnp_enable
is not set for A host, the host which support HNP polling should continue
enumeration to see if the B device can talk to it later by hnp polling.
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit b715d0773eea212a25d6b8c5d94530e12935fdaf)
(cherry picked from commit 454369742ce4dec01d89c946a28c3069fc23bbea)
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/hub.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 0bb7f177ca38..5215fdcc508e 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -21,6 +21,7 @@ #include <linux/usbdevice_fs.h> #include <linux/usb/hcd.h> #include <linux/usb/otg.h> +#include <linux/usb/otg-fsm.h> #include <linux/usb/quirks.h> #include <linux/workqueue.h> #include <linux/mutex.h> @@ -2272,6 +2273,13 @@ static int usb_enumerate_device_otg(struct usb_device *udev) bus->b_hnp_enable = 0; } + if (bus->otg_fsm) { + if (port1 == bus->otg_port) + bus->otg_fsm->b_hnp_enable = 1; + if (bus->b_hnp_enable) + bus->otg_fsm->a_set_b_hnp_en = 1; + } + /* For OTG supplement version 1.3 or earlier */ if ((desc->bLength < 5) && (port1 == bus->otg_port)) { @@ -2312,6 +2320,7 @@ static int usb_enumerate_device(struct usb_device *udev) { int err; struct usb_hcd *hcd = bus_to_hcd(udev->bus); + struct otg_fsm *fsm = udev->bus->otg_fsm; if (udev->config == NULL) { err = usb_get_configuration(udev); @@ -2343,8 +2352,10 @@ static int usb_enumerate_device(struct usb_device *udev) err = usb_port_suspend(udev, PMSG_AUTO_SUSPEND); if (err < 0) dev_dbg(&udev->dev, "HNP fail, %d\n", err); + return -ENOTSUPP; + } else if (!fsm || !fsm->b_hnp_enable || !fsm->hnp_polling) { + return -ENOTSUPP; } - return -ENOTSUPP; } usb_detect_interface_quirks(udev); |