mirror of https://gitee.com/openkylin/linux.git
usb: core: TPL should apply for both OTG and EH
According to On-The-Go and Embedded Host Supplement to the USB Revision 2.0 Specification, the targeted hosts (non-PC hosts) include both embedded hosts and otg, and each targeted host product defines the set of supported peripherals on a TPL (Targeted Peripheral List). So, TPL should apply for both OTG and embedded host, and the otg support is not a must for embedded host. The TPL support feature will only be effect when CONFIG_USB_OTG_WHITELIST has been chosen and hcd->tpl_support flag is set, it can avoid the enumeration fails problem for the user who chooses CONFIG_USB_OTG_WHITELIST wrongly. Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
f2693b430b
commit
026f3fcbb0
|
@ -32,6 +32,7 @@
|
||||||
#include <asm/byteorder.h>
|
#include <asm/byteorder.h>
|
||||||
|
|
||||||
#include "hub.h"
|
#include "hub.h"
|
||||||
|
#include "otg_whitelist.h"
|
||||||
|
|
||||||
#define USB_VENDOR_GENESYS_LOGIC 0x05e3
|
#define USB_VENDOR_GENESYS_LOGIC 0x05e3
|
||||||
#define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01
|
#define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01
|
||||||
|
@ -2205,9 +2206,6 @@ static void announce_device(struct usb_device *udev)
|
||||||
static inline void announce_device(struct usb_device *udev) { }
|
static inline void announce_device(struct usb_device *udev) { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_USB_OTG
|
|
||||||
#include "otg_whitelist.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* usb_enumerate_device_otg - FIXME (usbcore-internal)
|
* usb_enumerate_device_otg - FIXME (usbcore-internal)
|
||||||
|
@ -2267,21 +2265,6 @@ static int usb_enumerate_device_otg(struct usb_device *udev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_targeted(udev)) {
|
|
||||||
|
|
||||||
/* Maybe it can talk to us, though we can't talk to it.
|
|
||||||
* (Includes HNP test device.)
|
|
||||||
*/
|
|
||||||
if (udev->bus->b_hnp_enable || udev->bus->is_b_host) {
|
|
||||||
err = usb_port_suspend(udev, PMSG_SUSPEND);
|
|
||||||
if (err < 0)
|
|
||||||
dev_dbg(&udev->dev, "HNP fail, %d\n", err);
|
|
||||||
}
|
|
||||||
err = -ENOTSUPP;
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
fail:
|
|
||||||
#endif
|
#endif
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -2304,6 +2287,7 @@ static int usb_enumerate_device_otg(struct usb_device *udev)
|
||||||
static int usb_enumerate_device(struct usb_device *udev)
|
static int usb_enumerate_device(struct usb_device *udev)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
struct usb_hcd *hcd = bus_to_hcd(udev->bus);
|
||||||
|
|
||||||
if (udev->config == NULL) {
|
if (udev->config == NULL) {
|
||||||
err = usb_get_configuration(udev);
|
err = usb_get_configuration(udev);
|
||||||
|
@ -2325,6 +2309,19 @@ static int usb_enumerate_device(struct usb_device *udev)
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
if (IS_ENABLED(CONFIG_USB_OTG_WHITELIST) && hcd->tpl_support &&
|
||||||
|
!is_targeted(udev) && IS_ENABLED(CONFIG_USB_OTG)) {
|
||||||
|
/* Maybe it can talk to us, though we can't talk to it.
|
||||||
|
* (Includes HNP test device.)
|
||||||
|
*/
|
||||||
|
if (udev->bus->b_hnp_enable || udev->bus->is_b_host) {
|
||||||
|
err = usb_port_suspend(udev, PMSG_AUTO_SUSPEND);
|
||||||
|
if (err < 0)
|
||||||
|
dev_dbg(&udev->dev, "HNP fail, %d\n", err);
|
||||||
|
}
|
||||||
|
return -ENOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
usb_detect_interface_quirks(udev);
|
usb_detect_interface_quirks(udev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This OTG Whitelist is the OTG "Targeted Peripheral List". It should
|
* This OTG and Embedded Host Whitelist is "Targeted Peripheral List".
|
||||||
* mostly use of USB_DEVICE() or USB_DEVICE_VER() entries..
|
* It should mostly use of USB_DEVICE() or USB_DEVICE_VER() entries..
|
||||||
*
|
*
|
||||||
* YOU _SHOULD_ CHANGE THIS LIST TO MATCH YOUR PRODUCT AND ITS TESTING!
|
* YOU _SHOULD_ CHANGE THIS LIST TO MATCH YOUR PRODUCT AND ITS TESTING!
|
||||||
*/
|
*/
|
||||||
|
@ -50,10 +50,6 @@ static int is_targeted(struct usb_device *dev)
|
||||||
{
|
{
|
||||||
struct usb_device_id *id = whitelist_table;
|
struct usb_device_id *id = whitelist_table;
|
||||||
|
|
||||||
/* possible in developer configs only! */
|
|
||||||
if (!dev->bus->otg_port)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
/* HNP test device is _never_ targeted (see OTG spec 6.6.6) */
|
/* HNP test device is _never_ targeted (see OTG spec 6.6.6) */
|
||||||
if ((le16_to_cpu(dev->descriptor.idVendor) == 0x1a0a &&
|
if ((le16_to_cpu(dev->descriptor.idVendor) == 0x1a0a &&
|
||||||
le16_to_cpu(dev->descriptor.idProduct) == 0xbadd))
|
le16_to_cpu(dev->descriptor.idProduct) == 0xbadd))
|
||||||
|
@ -103,10 +99,7 @@ static int is_targeted(struct usb_device *dev)
|
||||||
dev_err(&dev->dev, "device v%04x p%04x is not supported\n",
|
dev_err(&dev->dev, "device v%04x p%04x is not supported\n",
|
||||||
le16_to_cpu(dev->descriptor.idVendor),
|
le16_to_cpu(dev->descriptor.idVendor),
|
||||||
le16_to_cpu(dev->descriptor.idProduct));
|
le16_to_cpu(dev->descriptor.idProduct));
|
||||||
#ifdef CONFIG_USB_OTG_WHITELIST
|
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
|
||||||
return 1;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue