diff options
author | Ye Li <ye.li@nxp.com> | 2017-03-16 17:00:59 +0800 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2017-04-05 17:24:34 +0800 |
commit | 8382781a59fbae1d8ab797d64761136277e291d1 (patch) | |
tree | cac907581fe4acfd7cb64930a5473192656b8803 | |
parent | d54d59ecc1800a46d5ed897448496b8d73a822aa (diff) | |
download | u-boot-imx-8382781a59fbae1d8ab797d64761136277e291d1.zip u-boot-imx-8382781a59fbae1d8ab797d64761136277e291d1.tar.gz u-boot-imx-8382781a59fbae1d8ab797d64761136277e291d1.tar.bz2 |
MLK-14445-5 ehci-mx6: Add OTG ID detecting by GPIO
The i.MX7ulp EVK board uses GPIO to detect ID for USB OTG0,
but when using DM USB driver, it is hard coded to use OTG ID pin.
Add a board override function that when extcon property is provided,
the function can check the GPIO to get ID.
Signed-off-by: Ye Li <ye.li@nxp.com>
-rw-r--r-- | drivers/usb/host/ehci-mx6.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index ffe702b..9268e21 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -492,6 +492,25 @@ static const struct ehci_ops mx6_ehci_ops = { .init_after_reset = mx6_init_after_reset }; +/** + * board_ehci_usb_phy_mode - override usb phy mode + * @port: usb host/otg port + * + * Target board specific, override usb_phy_mode. + * When usb-otg is used as usb host port, iomux pad usb_otg_id can be + * left disconnected in this case usb_phy_mode will not be able to identify + * the phy mode that usb port is used. + * Machine file overrides board_usb_phy_mode. + * When the extcon property is set in DTB, machine must provide this function, otherwise + * it will default return HOST. + * + * Return: USB_INIT_DEVICE or USB_INIT_HOST + */ +int __weak board_ehci_usb_phy_mode(struct udevice *dev) +{ + return USB_INIT_HOST; +} + static int ehci_usb_phy_mode(struct udevice *dev) { struct usb_platdata *plat = dev_get_platdata(dev); @@ -544,6 +563,7 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev) { struct usb_platdata *plat = dev_get_platdata(dev); const char *mode; + const struct fdt_property *extcon; mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "dr_mode", NULL); if (mode) { @@ -557,6 +577,13 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev) return -EINVAL; return 0; + } else { + extcon = fdt_get_property(gd->fdt_blob, dev_of_offset(dev), + "extcon", NULL); + if (extcon) { + plat->init_type = board_ehci_usb_phy_mode(dev); + return 0; + } } return ehci_usb_phy_mode(dev); |