Commit 03b32e4c authored by John Youn's avatar John Youn Committed by Felipe Balbi

Revert "usb: dwc2: Move reset into dwc2_get_hwparams()"

This reverts commit 263b7fb5 ("usb: dwc2: Move reset into
dwc2_get_hwparams()") due to regression found on bcm2835 platform. USB
ethernet fails, due to being unable to pick up proper parameters when
performing a plain reset before reading hw params.

Below shows the results of the gnptxfsiz and hptxfsiz with and before
and after reverting this (from Stefan Wahren):

So here is the probe result before Patch 1 is applied:

[    1.283148] dwc2 20980000.usb: Configuration mismatch. dr_mode forced to host
[    1.313894] dwc2 20980000.usb: gnptxfsiz=00201000
[    1.314104] dwc2 20980000.usb: hptxfsiz=00000000
[    1.353908] dwc2 20980000.usb: 256 invalid for host_nperio_tx_fifo_size. Check HW configuration.
[    1.354262] dwc2 20980000.usb: 512 invalid for host_perio_tx_fifo_size. Check HW configuration.
[    1.394249] dwc2 20980000.usb: DWC OTG Controller
[    1.394561] dwc2 20980000.usb: new USB bus registered, assigned bus number 1
[    1.394917] dwc2 20980000.usb: irq 33, io mem 0x00000000

And here is the probe result after Patch 1 is applied:

[    1.280107] dwc2 20980000.usb: Configuration mismatch. dr_mode forced to host
[    1.353949] dwc2 20980000.usb: gnptxfsiz=01001000
[    1.354166] dwc2 20980000.usb: hptxfsiz=02002000
[    1.434301] dwc2 20980000.usb: DWC OTG Controller
[    1.434616] dwc2 20980000.usb: new USB bus registered, assigned bus number 1
[    1.434973] dwc2 20980000.usb: irq 33, io mem 0x00000000
Tested-by: default avatarHeiko Stuebner <heiko@sntech.de>
Tested-by: default avatarDouglas Anderson <dianders@chromium.org>
Signed-off-by: default avatarJohn Youn <johnyoun@synopsys.com>
Reported-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Reported-by: default avatarRemi Pommarel <repk@triplefau.lt>
Tested-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Tested-by: default avatarRemi Pommarel <repk@triplefau.lt>
Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
parent 79c5623f
...@@ -3278,9 +3278,6 @@ static void dwc2_get_dev_hwparams(struct dwc2_hsotg *hsotg) ...@@ -3278,9 +3278,6 @@ static void dwc2_get_dev_hwparams(struct dwc2_hsotg *hsotg)
/** /**
* During device initialization, read various hardware configuration * During device initialization, read various hardware configuration
* registers and interpret the contents. * registers and interpret the contents.
*
* This should be called during driver probe. It will perform a core
* soft reset in order to get the reset values of the parameters.
*/ */
int dwc2_get_hwparams(struct dwc2_hsotg *hsotg) int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
{ {
...@@ -3288,7 +3285,6 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg) ...@@ -3288,7 +3285,6 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
unsigned width; unsigned width;
u32 hwcfg1, hwcfg2, hwcfg3, hwcfg4; u32 hwcfg1, hwcfg2, hwcfg3, hwcfg4;
u32 grxfsiz; u32 grxfsiz;
int retval;
/* /*
* Attempt to ensure this device is really a DWC_otg Controller. * Attempt to ensure this device is really a DWC_otg Controller.
...@@ -3308,10 +3304,6 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg) ...@@ -3308,10 +3304,6 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
hw->snpsid >> 12 & 0xf, hw->snpsid >> 8 & 0xf, hw->snpsid >> 12 & 0xf, hw->snpsid >> 8 & 0xf,
hw->snpsid >> 4 & 0xf, hw->snpsid & 0xf, hw->snpsid); hw->snpsid >> 4 & 0xf, hw->snpsid & 0xf, hw->snpsid);
retval = dwc2_core_reset(hsotg);
if (retval)
return retval;
hwcfg1 = dwc2_readl(hsotg->regs + GHWCFG1); hwcfg1 = dwc2_readl(hsotg->regs + GHWCFG1);
hwcfg2 = dwc2_readl(hsotg->regs + GHWCFG2); hwcfg2 = dwc2_readl(hsotg->regs + GHWCFG2);
hwcfg3 = dwc2_readl(hsotg->regs + GHWCFG3); hwcfg3 = dwc2_readl(hsotg->regs + GHWCFG3);
......
...@@ -530,7 +530,13 @@ static int dwc2_driver_probe(struct platform_device *dev) ...@@ -530,7 +530,13 @@ static int dwc2_driver_probe(struct platform_device *dev)
if (retval) if (retval)
return retval; return retval;
/* Reset the controller and detect hardware config values */ /*
* Reset before dwc2_get_hwparams() then it could get power-on real
* reset value form registers.
*/
dwc2_core_reset_and_force_dr_mode(hsotg);
/* Detect config values from hardware */
retval = dwc2_get_hwparams(hsotg); retval = dwc2_get_hwparams(hsotg);
if (retval) if (retval)
goto error; goto error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment