summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3/core.c
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2011-05-05 16:53:10 +0400
committerFelipe Balbi <balbi@ti.com>2013-03-18 13:18:02 +0400
commit789451f6c698282d0745f265bde47173c9372867 (patch)
tree6ce8ccfe373fee12134fb3c97c1e93d8400ef802 /drivers/usb/dwc3/core.c
parent5f71791947fcb1942df7d0df45520d420c2aee2b (diff)
downloadlinux-789451f6c698282d0745f265bde47173c9372867.tar.xz
usb: dwc3: calculate the number of endpoints
hwparams2 holds the number of endpoints which were selected during RTL generation, we can use that on our driver. Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3/core.c')
-rw-r--r--drivers/usb/dwc3/core.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index c6a46e0efe4f..66c05725daf3 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -260,6 +260,17 @@ static void dwc3_event_buffers_cleanup(struct dwc3 *dwc)
}
}
+static void dwc3_core_num_eps(struct dwc3 *dwc)
+{
+ struct dwc3_hwparams *parms = &dwc->hwparams;
+
+ dwc->num_in_eps = DWC3_NUM_IN_EPS(parms);
+ dwc->num_out_eps = DWC3_NUM_EPS(parms) - dwc->num_in_eps;
+
+ dev_vdbg(dwc->dev, "found %d IN and %d OUT endpoints\n",
+ dwc->num_in_eps, dwc->num_out_eps);
+}
+
static void dwc3_cache_hwparams(struct dwc3 *dwc)
{
struct dwc3_hwparams *parms = &dwc->hwparams;
@@ -336,6 +347,8 @@ static int dwc3_core_init(struct dwc3 *dwc)
if (dwc->revision < DWC3_REVISION_190A)
reg |= DWC3_GCTL_U2RSTECN;
+ dwc3_core_num_eps(dwc);
+
dwc3_writel(dwc->regs, DWC3_GCTL, reg);
return 0;