File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -3120,6 +3120,9 @@ void dwc2_set_parameters(struct dwc2_hsotg *hsotg,
3120
3120
/**
3121
3121
* During device initialization, read various hardware configuration
3122
3122
* registers and interpret the contents.
3123
+ *
3124
+ * This should be called during driver probe. It will perform a core
3125
+ * soft reset in order to get the reset values of the parameters.
3123
3126
*/
3124
3127
int dwc2_get_hwparams (struct dwc2_hsotg * hsotg )
3125
3128
{
@@ -3128,6 +3131,7 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
3128
3131
u32 hwcfg1 , hwcfg2 , hwcfg3 , hwcfg4 ;
3129
3132
u32 hptxfsiz , grxfsiz , gnptxfsiz ;
3130
3133
u32 gusbcfg = 0 ;
3134
+ int retval ;
3131
3135
3132
3136
/*
3133
3137
* Attempt to ensure this device is really a DWC_otg Controller.
@@ -3147,6 +3151,10 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
3147
3151
hw -> snpsid >> 12 & 0xf , hw -> snpsid >> 8 & 0xf ,
3148
3152
hw -> snpsid >> 4 & 0xf , hw -> snpsid & 0xf , hw -> snpsid );
3149
3153
3154
+ retval = dwc2_core_reset (hsotg );
3155
+ if (retval )
3156
+ return retval ;
3157
+
3150
3158
hwcfg1 = dwc2_readl (hsotg -> regs + GHWCFG1 );
3151
3159
hwcfg2 = dwc2_readl (hsotg -> regs + GHWCFG2 );
3152
3160
hwcfg3 = dwc2_readl (hsotg -> regs + GHWCFG3 );
Original file line number Diff line number Diff line change @@ -512,20 +512,16 @@ static int dwc2_driver_probe(struct platform_device *dev)
512
512
if (retval )
513
513
return retval ;
514
514
515
- /*
516
- * Reset before dwc2_get_hwparams() then it could get power-on real
517
- * reset value form registers.
518
- */
519
- dwc2_core_reset_and_force_dr_mode (hsotg );
520
-
521
- /* Detect config values from hardware */
515
+ /* Reset the controller and detect hardware config values */
522
516
retval = dwc2_get_hwparams (hsotg );
523
517
if (retval )
524
518
goto error ;
525
519
526
520
/* Validate parameter values */
527
521
dwc2_set_parameters (hsotg , params );
528
522
523
+ dwc2_core_reset_and_force_dr_mode (hsotg );
524
+
529
525
if (hsotg -> dr_mode != USB_DR_MODE_HOST ) {
530
526
retval = dwc2_gadget_init (hsotg , irq );
531
527
if (retval )
You can’t perform that action at this time.
0 commit comments