usb: dwc2: Move reset into dwc2_get_hwparams()
The reset is required to get reset values of the hardware parameters but the force mode is not. Move the base reset into dwc2_get_hwparams() and do the reset and force mode afterwards. Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
Родитель
1696d5ab99
Коммит
263b7fb557
|
@ -3120,6 +3120,9 @@ void dwc2_set_parameters(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)
|
||||||
{
|
{
|
||||||
|
@ -3128,6 +3131,7 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
|
||||||
u32 hwcfg1, hwcfg2, hwcfg3, hwcfg4;
|
u32 hwcfg1, hwcfg2, hwcfg3, hwcfg4;
|
||||||
u32 hptxfsiz, grxfsiz, gnptxfsiz;
|
u32 hptxfsiz, grxfsiz, gnptxfsiz;
|
||||||
u32 gusbcfg = 0;
|
u32 gusbcfg = 0;
|
||||||
|
int retval;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attempt to ensure this device is really a DWC_otg Controller.
|
* Attempt to ensure this device is really a DWC_otg Controller.
|
||||||
|
@ -3147,6 +3151,10 @@ 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);
|
||||||
|
|
|
@ -512,13 +512,7 @@ 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;
|
||||||
|
@ -526,6 +520,8 @@ static int dwc2_driver_probe(struct platform_device *dev)
|
||||||
/* Validate parameter values */
|
/* Validate parameter values */
|
||||||
dwc2_set_parameters(hsotg, params);
|
dwc2_set_parameters(hsotg, params);
|
||||||
|
|
||||||
|
dwc2_core_reset_and_force_dr_mode(hsotg);
|
||||||
|
|
||||||
if (hsotg->dr_mode != USB_DR_MODE_HOST) {
|
if (hsotg->dr_mode != USB_DR_MODE_HOST) {
|
||||||
retval = dwc2_gadget_init(hsotg, irq);
|
retval = dwc2_gadget_init(hsotg, irq);
|
||||||
if (retval)
|
if (retval)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче