From: Dinh Nguyen <dingu...@altera.com>

The variable host_channels of dwc2_hw_params struct is only 4-bits. Adding
a 1 to a 0xf results in a 0 for host_channels. Thus, the driver was always
thinking it had 0 host channels.

Represent the correct number of host channels by using the host_channels
variable of dwc2_core_params struct. We should do the +1 in
dwc2_set_param_host_channels();

Signed-off-by: Dinh Nguyen <dingu...@altera.com>
Cc: Matthijs Kooijman <matth...@stdin.nl>
Cc: Paul Zimmerman <pa...@synopsys.com>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Cc: linux-...@vger.kernel.org
Cc: de...@driverdev.osuosl.org
---
v2:
- Fix compile by remove extra closing )

 drivers/staging/dwc2/core.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/dwc2/core.c b/drivers/staging/dwc2/core.c
index 825c5e5..5f71fb4 100644
--- a/drivers/staging/dwc2/core.c
+++ b/drivers/staging/dwc2/core.c
@@ -2197,7 +2197,7 @@ int dwc2_set_param_host_channels(struct dwc2_hsotg 
*hsotg, int val)
                retval = -EINVAL;
        }
 
-       hsotg->core_params->host_channels = val;
+       hsotg->core_params->host_channels = val + 1;
        return retval;
 }
 
@@ -2625,8 +2625,8 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
        hw->arch = (hwcfg2 & GHWCFG2_ARCHITECTURE_MASK) >>
                   GHWCFG2_ARCHITECTURE_SHIFT;
        hw->enable_dynamic_fifo = !!(hwcfg2 & GHWCFG2_DYNAMIC_FIFO);
-       hw->host_channels = 1 + ((hwcfg2 & GHWCFG2_NUM_HOST_CHAN_MASK) >>
-                               GHWCFG2_NUM_HOST_CHAN_SHIFT);
+       hw->host_channels = (hwcfg2 & GHWCFG2_NUM_HOST_CHAN_MASK) >>
+                               GHWCFG2_NUM_HOST_CHAN_SHIFT;
        hw->hs_phy_type = (hwcfg2 & GHWCFG2_HS_PHY_TYPE_MASK) >>
                          GHWCFG2_HS_PHY_TYPE_SHIFT;
        hw->fs_phy_type = (hwcfg2 & GHWCFG2_FS_PHY_TYPE_MASK) >>
-- 
1.7.9.5


_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to