diff options
author | Li Jun <jun.li@freescale.com> | 2015-06-17 16:38:47 +0800 |
---|---|---|
committer | Li Jun <jun.li@freescale.com> | 2015-07-22 10:22:10 +0800 |
commit | 72673b2646f4b1915a127395e850ae8be93a9e7d (patch) | |
tree | ccae988d50d5746063df6b68ea7dd7075629826f /drivers | |
parent | f67334791e0380b5020ab0b14d1b29c9e034ad41 (diff) |
MLK-11123-8 usb: chipidea: set usb gadeget's otg capabilities
Set gadget's otg capabilities according to controller's capability and otg
properties in device tree.
Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit ec53d399f649b9d3eeefd0e4f1b7770241f9db63)
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/chipidea/core.c | 8 | ||||
-rw-r--r-- | drivers/usb/chipidea/udc.c | 7 |
2 files changed, 11 insertions, 4 deletions
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index b5ed56eaf0c7..e5f315636569 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -624,9 +624,11 @@ static int ci_get_platdata(struct device *dev, } if (platdata->dr_mode == USB_DR_MODE_OTG) { - if (!platdata->adp_support) - platdata->adp_support = - of_usb_otg_adp_support(dev->of_node); + /* We can support HNP and SRP */ + platdata->ci_otg_caps.hnp_support = true; + platdata->ci_otg_caps.srp_support = true; + /* Update otg capabilities by DT properties */ + of_usb_set_otg_caps(dev->of_node, &platdata->ci_otg_caps); } if (of_usb_get_maximum_speed(dev->of_node) == USB_SPEED_FULL) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 3ac22d19312d..33931628416a 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1887,6 +1887,7 @@ static irqreturn_t udc_irq(struct ci_hdrc *ci) static int udc_start(struct ci_hdrc *ci) { struct device *dev = ci->dev; + struct usb_otg_caps *otg_caps = &ci->platdata->ci_otg_caps; int retval = 0; spin_lock_init(&ci->lock); @@ -1894,8 +1895,12 @@ static int udc_start(struct ci_hdrc *ci) ci->gadget.ops = &usb_gadget_ops; ci->gadget.speed = USB_SPEED_UNKNOWN; ci->gadget.max_speed = USB_SPEED_HIGH; - ci->gadget.is_otg = ci->is_otg ? 1 : 0; ci->gadget.name = ci->platdata->name; + ci->gadget.otg_caps = &ci->platdata->ci_otg_caps; + + if (otg_caps->hnp_support || otg_caps->srp_support || + otg_caps->adp_support) + ci->gadget.is_otg = 1; INIT_LIST_HEAD(&ci->gadget.ep_list); |