Skip to content

Commit 03b32e4

Browse files
jysnpsfelipebalbi
authored andcommitted
Revert "usb: dwc2: Move reset into dwc2_get_hwparams()"
This reverts commit 263b7fb ("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: Heiko Stuebner <[email protected]> Tested-by: Douglas Anderson <[email protected]> Signed-off-by: John Youn <[email protected]> Reported-by: Stefan Wahren <[email protected]> Reported-by: Remi Pommarel <[email protected]> Tested-by: Stefan Wahren <[email protected]> Tested-by: Remi Pommarel <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 79c5623 commit 03b32e4

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

drivers/usb/dwc2/core.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3278,17 +3278,13 @@ static void dwc2_get_dev_hwparams(struct dwc2_hsotg *hsotg)
32783278
/**
32793279
* During device initialization, read various hardware configuration
32803280
* registers and interpret the contents.
3281-
*
3282-
* This should be called during driver probe. It will perform a core
3283-
* soft reset in order to get the reset values of the parameters.
32843281
*/
32853282
int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
32863283
{
32873284
struct dwc2_hw_params *hw = &hsotg->hw_params;
32883285
unsigned width;
32893286
u32 hwcfg1, hwcfg2, hwcfg3, hwcfg4;
32903287
u32 grxfsiz;
3291-
int retval;
32923288

32933289
/*
32943290
* Attempt to ensure this device is really a DWC_otg Controller.
@@ -3308,10 +3304,6 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
33083304
hw->snpsid >> 12 & 0xf, hw->snpsid >> 8 & 0xf,
33093305
hw->snpsid >> 4 & 0xf, hw->snpsid & 0xf, hw->snpsid);
33103306

3311-
retval = dwc2_core_reset(hsotg);
3312-
if (retval)
3313-
return retval;
3314-
33153307
hwcfg1 = dwc2_readl(hsotg->regs + GHWCFG1);
33163308
hwcfg2 = dwc2_readl(hsotg->regs + GHWCFG2);
33173309
hwcfg3 = dwc2_readl(hsotg->regs + GHWCFG3);

drivers/usb/dwc2/platform.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,13 @@ static int dwc2_driver_probe(struct platform_device *dev)
530530
if (retval)
531531
return retval;
532532

533-
/* Reset the controller and detect hardware config values */
533+
/*
534+
* Reset before dwc2_get_hwparams() then it could get power-on real
535+
* reset value form registers.
536+
*/
537+
dwc2_core_reset_and_force_dr_mode(hsotg);
538+
539+
/* Detect config values from hardware */
534540
retval = dwc2_get_hwparams(hsotg);
535541
if (retval)
536542
goto error;

0 commit comments

Comments
 (0)