summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc2/platform.c
diff options
context:
space:
mode:
authorMian Yousaf Kaukab <yousaf.kaukab@intel.com>2015-04-29 22:09:05 +0200
committerFelipe Balbi <balbi@ti.com>2015-04-29 15:19:02 -0500
commitecb176c63ac49ddcea83b0171ead1372bb78c165 (patch)
treeb37ddff592892a69994624fbf5cd6023c409c2b7 /drivers/usb/dwc2/platform.c
parenta6d249d8373343749f9ae55f5581f3b21e178471 (diff)
downloadlinux-ecb176c63ac49ddcea83b0171ead1372bb78c165.tar.gz
linux-ecb176c63ac49ddcea83b0171ead1372bb78c165.tar.bz2
linux-ecb176c63ac49ddcea83b0171ead1372bb78c165.zip
usb: dwc2: set parameter values in probe function
So the parameters can be used in both host and gadget modes. Also consolidate param functions in the core.h Acked-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc2/platform.c')
-rw-r--r--drivers/usb/dwc2/platform.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index ce39e8a01844..2562c9019955 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -241,6 +241,21 @@ static int dwc2_driver_probe(struct platform_device *dev)
spin_lock_init(&hsotg->lock);
mutex_init(&hsotg->init_mutex);
+ /* Detect config values from hardware */
+ retval = dwc2_get_hwparams(hsotg);
+ if (retval)
+ return retval;
+
+ hsotg->core_params = devm_kzalloc(&dev->dev,
+ sizeof(*hsotg->core_params), GFP_KERNEL);
+ if (!hsotg->core_params)
+ return -ENOMEM;
+
+ dwc2_set_all_params(hsotg->core_params, -1);
+
+ /* Validate parameter values */
+ dwc2_set_parameters(hsotg, params);
+
if (hsotg->dr_mode != USB_DR_MODE_HOST) {
retval = dwc2_gadget_init(hsotg, irq);
if (retval)
@@ -249,7 +264,7 @@ static int dwc2_driver_probe(struct platform_device *dev)
}
if (hsotg->dr_mode != USB_DR_MODE_PERIPHERAL) {
- retval = dwc2_hcd_init(hsotg, irq, params);
+ retval = dwc2_hcd_init(hsotg, irq);
if (retval) {
if (hsotg->gadget_enabled)
s3c_hsotg_remove(hsotg);