aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc2
diff options
context:
space:
mode:
authorJohn Youn <johnyoun@synopsys.com>2016-11-03 20:55:53 -0400
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-11-18 06:54:11 -0500
commitbea8e86c51cf9cf637e5bf0610d14674e9115783 (patch)
tree12340f7d5354c95e6194f0d737ad41e9f6fc28f1 /drivers/usb/dwc2
parent323230ef4ef17512007c22898b008e9fb87b372e (diff)
usb: dwc2: Declare the core params struct statically
This makes it consistent with the hw_params struct and simplifies the memory management for future refactoring. Fix up usage in all files. Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc2')
-rw-r--r--drivers/usb/dwc2/core.c12
-rw-r--r--drivers/usb/dwc2/core.h2
-rw-r--r--drivers/usb/dwc2/core_intr.c6
-rw-r--r--drivers/usb/dwc2/gadget.c2
-rw-r--r--drivers/usb/dwc2/hcd.c190
-rw-r--r--drivers/usb/dwc2/hcd_ddma.c4
-rw-r--r--drivers/usb/dwc2/hcd_intr.c48
-rw-r--r--drivers/usb/dwc2/hcd_queue.c18
-rw-r--r--drivers/usb/dwc2/params.c68
-rw-r--r--drivers/usb/dwc2/platform.c7
10 files changed, 176 insertions, 181 deletions
diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
index e1f1b19a694a..11d8ae9aead1 100644
--- a/drivers/usb/dwc2/core.c
+++ b/drivers/usb/dwc2/core.c
@@ -135,7 +135,7 @@ int dwc2_exit_hibernation(struct dwc2_hsotg *hsotg, bool restore)
135 u32 pcgcctl; 135 u32 pcgcctl;
136 int ret = 0; 136 int ret = 0;
137 137
138 if (!hsotg->core_params->hibernation) 138 if (!hsotg->params.hibernation)
139 return -ENOTSUPP; 139 return -ENOTSUPP;
140 140
141 pcgcctl = dwc2_readl(hsotg->regs + PCGCTL); 141 pcgcctl = dwc2_readl(hsotg->regs + PCGCTL);
@@ -188,7 +188,7 @@ int dwc2_enter_hibernation(struct dwc2_hsotg *hsotg)
188 u32 pcgcctl; 188 u32 pcgcctl;
189 int ret = 0; 189 int ret = 0;
190 190
191 if (!hsotg->core_params->hibernation) 191 if (!hsotg->params.hibernation)
192 return -ENOTSUPP; 192 return -ENOTSUPP;
193 193
194 /* Backup all registers */ 194 /* Backup all registers */
@@ -541,7 +541,7 @@ void dwc2_dump_host_registers(struct dwc2_hsotg *hsotg)
541 addr = hsotg->regs + HAINTMSK; 541 addr = hsotg->regs + HAINTMSK;
542 dev_dbg(hsotg->dev, "HAINTMSK @0x%08lX : 0x%08X\n", 542 dev_dbg(hsotg->dev, "HAINTMSK @0x%08lX : 0x%08X\n",
543 (unsigned long)addr, dwc2_readl(addr)); 543 (unsigned long)addr, dwc2_readl(addr));
544 if (hsotg->core_params->dma_desc_enable > 0) { 544 if (hsotg->params.dma_desc_enable > 0) {
545 addr = hsotg->regs + HFLBADDR; 545 addr = hsotg->regs + HFLBADDR;
546 dev_dbg(hsotg->dev, "HFLBADDR @0x%08lX : 0x%08X\n", 546 dev_dbg(hsotg->dev, "HFLBADDR @0x%08lX : 0x%08X\n",
547 (unsigned long)addr, dwc2_readl(addr)); 547 (unsigned long)addr, dwc2_readl(addr));
@@ -551,7 +551,7 @@ void dwc2_dump_host_registers(struct dwc2_hsotg *hsotg)
551 dev_dbg(hsotg->dev, "HPRT0 @0x%08lX : 0x%08X\n", 551 dev_dbg(hsotg->dev, "HPRT0 @0x%08lX : 0x%08X\n",
552 (unsigned long)addr, dwc2_readl(addr)); 552 (unsigned long)addr, dwc2_readl(addr));
553 553
554 for (i = 0; i < hsotg->core_params->host_channels; i++) { 554 for (i = 0; i < hsotg->params.host_channels; i++) {
555 dev_dbg(hsotg->dev, "Host Channel %d Specific Registers\n", i); 555 dev_dbg(hsotg->dev, "Host Channel %d Specific Registers\n", i);
556 addr = hsotg->regs + HCCHAR(i); 556 addr = hsotg->regs + HCCHAR(i);
557 dev_dbg(hsotg->dev, "HCCHAR @0x%08lX : 0x%08X\n", 557 dev_dbg(hsotg->dev, "HCCHAR @0x%08lX : 0x%08X\n",
@@ -571,7 +571,7 @@ void dwc2_dump_host_registers(struct dwc2_hsotg *hsotg)
571 addr = hsotg->regs + HCDMA(i); 571 addr = hsotg->regs + HCDMA(i);
572 dev_dbg(hsotg->dev, "HCDMA @0x%08lX : 0x%08X\n", 572 dev_dbg(hsotg->dev, "HCDMA @0x%08lX : 0x%08X\n",
573 (unsigned long)addr, dwc2_readl(addr)); 573 (unsigned long)addr, dwc2_readl(addr));
574 if (hsotg->core_params->dma_desc_enable > 0) { 574 if (hsotg->params.dma_desc_enable > 0) {
575 addr = hsotg->regs + HCDMAB(i); 575 addr = hsotg->regs + HCDMAB(i);
576 dev_dbg(hsotg->dev, "HCDMAB @0x%08lX : 0x%08X\n", 576 dev_dbg(hsotg->dev, "HCDMAB @0x%08lX : 0x%08X\n",
577 (unsigned long)addr, dwc2_readl(addr)); 577 (unsigned long)addr, dwc2_readl(addr));
@@ -753,7 +753,7 @@ bool dwc2_force_mode_if_needed(struct dwc2_hsotg *hsotg, bool host)
753 753
754u16 dwc2_get_otg_version(struct dwc2_hsotg *hsotg) 754u16 dwc2_get_otg_version(struct dwc2_hsotg *hsotg)
755{ 755{
756 return hsotg->core_params->otg_ver == 1 ? 0x0200 : 0x0103; 756 return hsotg->params.otg_ver == 1 ? 0x0200 : 0x0103;
757} 757}
758 758
759bool dwc2_is_controller_alive(struct dwc2_hsotg *hsotg) 759bool dwc2_is_controller_alive(struct dwc2_hsotg *hsotg)
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 35337ff4a692..f3d14f327478 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -850,7 +850,7 @@ struct dwc2_hsotg {
850 /** Params detected from hardware */ 850 /** Params detected from hardware */
851 struct dwc2_hw_params hw_params; 851 struct dwc2_hw_params hw_params;
852 /** Params to actually use */ 852 /** Params to actually use */
853 struct dwc2_core_params *core_params; 853 struct dwc2_core_params params;
854 enum usb_otg_state op_state; 854 enum usb_otg_state op_state;
855 enum usb_dr_mode dr_mode; 855 enum usb_dr_mode dr_mode;
856 unsigned int hcd_enabled:1; 856 unsigned int hcd_enabled:1;
diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
index d85c5c9f96c1..5b228ba6045f 100644
--- a/drivers/usb/dwc2/core_intr.c
+++ b/drivers/usb/dwc2/core_intr.c
@@ -159,9 +159,9 @@ static void dwc2_handle_otg_intr(struct dwc2_hsotg *hsotg)
159 " ++OTG Interrupt: Session Request Success Status Change++\n"); 159 " ++OTG Interrupt: Session Request Success Status Change++\n");
160 gotgctl = dwc2_readl(hsotg->regs + GOTGCTL); 160 gotgctl = dwc2_readl(hsotg->regs + GOTGCTL);
161 if (gotgctl & GOTGCTL_SESREQSCS) { 161 if (gotgctl & GOTGCTL_SESREQSCS) {
162 if (hsotg->core_params->phy_type == 162 if (hsotg->params.phy_type ==
163 DWC2_PHY_TYPE_PARAM_FS 163 DWC2_PHY_TYPE_PARAM_FS
164 && hsotg->core_params->i2c_enable > 0) { 164 && hsotg->params.i2c_enable > 0) {
165 hsotg->srp_success = 1; 165 hsotg->srp_success = 1;
166 } else { 166 } else {
167 /* Clear Session Request */ 167 /* Clear Session Request */
@@ -370,7 +370,7 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)
370 /* Change to L0 state */ 370 /* Change to L0 state */
371 hsotg->lx_state = DWC2_L0; 371 hsotg->lx_state = DWC2_L0;
372 } else { 372 } else {
373 if (hsotg->core_params->hibernation) 373 if (hsotg->params.hibernation)
374 return; 374 return;
375 375
376 if (hsotg->lx_state != DWC2_L1) { 376 if (hsotg->lx_state != DWC2_L1) {
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 9dc6c482b89e..54f69275b61e 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2557,7 +2557,7 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
2557 GINTSTS_USBSUSP | GINTSTS_WKUPINT | 2557 GINTSTS_USBSUSP | GINTSTS_WKUPINT |
2558 GINTSTS_INCOMPL_SOIN | GINTSTS_INCOMPL_SOOUT; 2558 GINTSTS_INCOMPL_SOIN | GINTSTS_INCOMPL_SOOUT;
2559 2559
2560 if (hsotg->core_params->external_id_pin_ctl <= 0) 2560 if (hsotg->params.external_id_pin_ctl <= 0)
2561 intmsk |= GINTSTS_CONIDSTSCHNG; 2561 intmsk |= GINTSTS_CONIDSTSCHNG;
2562 2562
2563 dwc2_writel(intmsk, hsotg->regs + GINTMSK); 2563 dwc2_writel(intmsk, hsotg->regs + GINTMSK);
diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 1b6f5e1cf31a..7a86878205a1 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -79,9 +79,9 @@ static void dwc2_enable_common_interrupts(struct dwc2_hsotg *hsotg)
79 /* Enable the interrupts in the GINTMSK */ 79 /* Enable the interrupts in the GINTMSK */
80 intmsk = GINTSTS_MODEMIS | GINTSTS_OTGINT; 80 intmsk = GINTSTS_MODEMIS | GINTSTS_OTGINT;
81 81
82 if (hsotg->core_params->dma_enable <= 0) 82 if (hsotg->params.dma_enable <= 0)
83 intmsk |= GINTSTS_RXFLVL; 83 intmsk |= GINTSTS_RXFLVL;
84 if (hsotg->core_params->external_id_pin_ctl <= 0) 84 if (hsotg->params.external_id_pin_ctl <= 0)
85 intmsk |= GINTSTS_CONIDSTSCHNG; 85 intmsk |= GINTSTS_CONIDSTSCHNG;
86 86
87 intmsk |= GINTSTS_WKUPINT | GINTSTS_USBSUSP | 87 intmsk |= GINTSTS_WKUPINT | GINTSTS_USBSUSP |
@@ -100,8 +100,8 @@ static void dwc2_init_fs_ls_pclk_sel(struct dwc2_hsotg *hsotg)
100 100
101 if ((hsotg->hw_params.hs_phy_type == GHWCFG2_HS_PHY_TYPE_ULPI && 101 if ((hsotg->hw_params.hs_phy_type == GHWCFG2_HS_PHY_TYPE_ULPI &&
102 hsotg->hw_params.fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED && 102 hsotg->hw_params.fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED &&
103 hsotg->core_params->ulpi_fs_ls > 0) || 103 hsotg->params.ulpi_fs_ls > 0) ||
104 hsotg->core_params->phy_type == DWC2_PHY_TYPE_PARAM_FS) { 104 hsotg->params.phy_type == DWC2_PHY_TYPE_PARAM_FS) {
105 /* Full speed PHY */ 105 /* Full speed PHY */
106 val = HCFG_FSLSPCLKSEL_48_MHZ; 106 val = HCFG_FSLSPCLKSEL_48_MHZ;
107 } else { 107 } else {
@@ -152,7 +152,7 @@ static int dwc2_fs_phy_init(struct dwc2_hsotg *hsotg, bool select_phy)
152 if (dwc2_is_host_mode(hsotg)) 152 if (dwc2_is_host_mode(hsotg))
153 dwc2_init_fs_ls_pclk_sel(hsotg); 153 dwc2_init_fs_ls_pclk_sel(hsotg);
154 154
155 if (hsotg->core_params->i2c_enable > 0) { 155 if (hsotg->params.i2c_enable > 0) {
156 dev_dbg(hsotg->dev, "FS PHY enabling I2C\n"); 156 dev_dbg(hsotg->dev, "FS PHY enabling I2C\n");
157 157
158 /* Program GUSBCFG.OtgUtmiFsSel to I2C */ 158 /* Program GUSBCFG.OtgUtmiFsSel to I2C */
@@ -189,20 +189,20 @@ static int dwc2_hs_phy_init(struct dwc2_hsotg *hsotg, bool select_phy)
189 * so only program the first time. Do a soft reset immediately after 189 * so only program the first time. Do a soft reset immediately after
190 * setting phyif. 190 * setting phyif.
191 */ 191 */
192 switch (hsotg->core_params->phy_type) { 192 switch (hsotg->params.phy_type) {
193 case DWC2_PHY_TYPE_PARAM_ULPI: 193 case DWC2_PHY_TYPE_PARAM_ULPI:
194 /* ULPI interface */ 194 /* ULPI interface */
195 dev_dbg(hsotg->dev, "HS ULPI PHY selected\n"); 195 dev_dbg(hsotg->dev, "HS ULPI PHY selected\n");
196 usbcfg |= GUSBCFG_ULPI_UTMI_SEL; 196 usbcfg |= GUSBCFG_ULPI_UTMI_SEL;
197 usbcfg &= ~(GUSBCFG_PHYIF16 | GUSBCFG_DDRSEL); 197 usbcfg &= ~(GUSBCFG_PHYIF16 | GUSBCFG_DDRSEL);
198 if (hsotg->core_params->phy_ulpi_ddr > 0) 198 if (hsotg->params.phy_ulpi_ddr > 0)
199 usbcfg |= GUSBCFG_DDRSEL; 199 usbcfg |= GUSBCFG_DDRSEL;
200 break; 200 break;
201 case DWC2_PHY_TYPE_PARAM_UTMI: 201 case DWC2_PHY_TYPE_PARAM_UTMI:
202 /* UTMI+ interface */ 202 /* UTMI+ interface */
203 dev_dbg(hsotg->dev, "HS UTMI+ PHY selected\n"); 203 dev_dbg(hsotg->dev, "HS UTMI+ PHY selected\n");
204 usbcfg &= ~(GUSBCFG_ULPI_UTMI_SEL | GUSBCFG_PHYIF16); 204 usbcfg &= ~(GUSBCFG_ULPI_UTMI_SEL | GUSBCFG_PHYIF16);
205 if (hsotg->core_params->phy_utmi_width == 16) 205 if (hsotg->params.phy_utmi_width == 16)
206 usbcfg |= GUSBCFG_PHYIF16; 206 usbcfg |= GUSBCFG_PHYIF16;
207 break; 207 break;
208 default: 208 default:
@@ -230,8 +230,8 @@ static int dwc2_phy_init(struct dwc2_hsotg *hsotg, bool select_phy)
230 u32 usbcfg; 230 u32 usbcfg;
231 int retval = 0; 231 int retval = 0;
232 232
233 if (hsotg->core_params->speed == DWC2_SPEED_PARAM_FULL && 233 if (hsotg->params.speed == DWC2_SPEED_PARAM_FULL &&
234 hsotg->core_params->phy_type == DWC2_PHY_TYPE_PARAM_FS) { 234 hsotg->params.phy_type == DWC2_PHY_TYPE_PARAM_FS) {
235 /* If FS mode with FS PHY */ 235 /* If FS mode with FS PHY */
236 retval = dwc2_fs_phy_init(hsotg, select_phy); 236 retval = dwc2_fs_phy_init(hsotg, select_phy);
237 if (retval) 237 if (retval)
@@ -245,7 +245,7 @@ static int dwc2_phy_init(struct dwc2_hsotg *hsotg, bool select_phy)
245 245
246 if (hsotg->hw_params.hs_phy_type == GHWCFG2_HS_PHY_TYPE_ULPI && 246 if (hsotg->hw_params.hs_phy_type == GHWCFG2_HS_PHY_TYPE_ULPI &&
247 hsotg->hw_params.fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED && 247 hsotg->hw_params.fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED &&
248 hsotg->core_params->ulpi_fs_ls > 0) { 248 hsotg->params.ulpi_fs_ls > 0) {
249 dev_dbg(hsotg->dev, "Setting ULPI FSLS\n"); 249 dev_dbg(hsotg->dev, "Setting ULPI FSLS\n");
250 usbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 250 usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
251 usbcfg |= GUSBCFG_ULPI_FS_LS; 251 usbcfg |= GUSBCFG_ULPI_FS_LS;
@@ -272,9 +272,9 @@ static int dwc2_gahbcfg_init(struct dwc2_hsotg *hsotg)
272 272
273 case GHWCFG2_INT_DMA_ARCH: 273 case GHWCFG2_INT_DMA_ARCH:
274 dev_dbg(hsotg->dev, "Internal DMA Mode\n"); 274 dev_dbg(hsotg->dev, "Internal DMA Mode\n");
275 if (hsotg->core_params->ahbcfg != -1) { 275 if (hsotg->params.ahbcfg != -1) {
276 ahbcfg &= GAHBCFG_CTRL_MASK; 276 ahbcfg &= GAHBCFG_CTRL_MASK;
277 ahbcfg |= hsotg->core_params->ahbcfg & 277 ahbcfg |= hsotg->params.ahbcfg &
278 ~GAHBCFG_CTRL_MASK; 278 ~GAHBCFG_CTRL_MASK;
279 } 279 }
280 break; 280 break;
@@ -286,20 +286,20 @@ static int dwc2_gahbcfg_init(struct dwc2_hsotg *hsotg)
286 } 286 }
287 287
288 dev_dbg(hsotg->dev, "dma_enable:%d dma_desc_enable:%d\n", 288 dev_dbg(hsotg->dev, "dma_enable:%d dma_desc_enable:%d\n",
289 hsotg->core_params->dma_enable, 289 hsotg->params.dma_enable,
290 hsotg->core_params->dma_desc_enable); 290 hsotg->params.dma_desc_enable);
291 291
292 if (hsotg->core_params->dma_enable > 0) { 292 if (hsotg->params.dma_enable > 0) {
293 if (hsotg->core_params->dma_desc_enable > 0) 293 if (hsotg->params.dma_desc_enable > 0)
294 dev_dbg(hsotg->dev, "Using Descriptor DMA mode\n"); 294 dev_dbg(hsotg->dev, "Using Descriptor DMA mode\n");
295 else 295 else
296 dev_dbg(hsotg->dev, "Using Buffer DMA mode\n"); 296 dev_dbg(hsotg->dev, "Using Buffer DMA mode\n");
297 } else { 297 } else {
298 dev_dbg(hsotg->dev, "Using Slave mode\n"); 298 dev_dbg(hsotg->dev, "Using Slave mode\n");
299 hsotg->core_params->dma_desc_enable = 0; 299 hsotg->params.dma_desc_enable = 0;
300 } 300 }
301 301
302 if (hsotg->core_params->dma_enable > 0) 302 if (hsotg->params.dma_enable > 0)
303 ahbcfg |= GAHBCFG_DMA_EN; 303 ahbcfg |= GAHBCFG_DMA_EN;
304 304
305 dwc2_writel(ahbcfg, hsotg->regs + GAHBCFG); 305 dwc2_writel(ahbcfg, hsotg->regs + GAHBCFG);
@@ -316,10 +316,10 @@ static void dwc2_gusbcfg_init(struct dwc2_hsotg *hsotg)
316 316
317 switch (hsotg->hw_params.op_mode) { 317 switch (hsotg->hw_params.op_mode) {
318 case GHWCFG2_OP_MODE_HNP_SRP_CAPABLE: 318 case GHWCFG2_OP_MODE_HNP_SRP_CAPABLE:
319 if (hsotg->core_params->otg_cap == 319 if (hsotg->params.otg_cap ==
320 DWC2_CAP_PARAM_HNP_SRP_CAPABLE) 320 DWC2_CAP_PARAM_HNP_SRP_CAPABLE)
321 usbcfg |= GUSBCFG_HNPCAP; 321 usbcfg |= GUSBCFG_HNPCAP;
322 if (hsotg->core_params->otg_cap != 322 if (hsotg->params.otg_cap !=
323 DWC2_CAP_PARAM_NO_HNP_SRP_CAPABLE) 323 DWC2_CAP_PARAM_NO_HNP_SRP_CAPABLE)
324 usbcfg |= GUSBCFG_SRPCAP; 324 usbcfg |= GUSBCFG_SRPCAP;
325 break; 325 break;
@@ -327,7 +327,7 @@ static void dwc2_gusbcfg_init(struct dwc2_hsotg *hsotg)
327 case GHWCFG2_OP_MODE_SRP_ONLY_CAPABLE: 327 case GHWCFG2_OP_MODE_SRP_ONLY_CAPABLE:
328 case GHWCFG2_OP_MODE_SRP_CAPABLE_DEVICE: 328 case GHWCFG2_OP_MODE_SRP_CAPABLE_DEVICE:
329 case GHWCFG2_OP_MODE_SRP_CAPABLE_HOST: 329 case GHWCFG2_OP_MODE_SRP_CAPABLE_HOST:
330 if (hsotg->core_params->otg_cap != 330 if (hsotg->params.otg_cap !=
331 DWC2_CAP_PARAM_NO_HNP_SRP_CAPABLE) 331 DWC2_CAP_PARAM_NO_HNP_SRP_CAPABLE)
332 usbcfg |= GUSBCFG_SRPCAP; 332 usbcfg |= GUSBCFG_SRPCAP;
333 break; 333 break;
@@ -390,7 +390,7 @@ static void dwc2_disable_host_interrupts(struct dwc2_hsotg *hsotg)
390 */ 390 */
391static void dwc2_calculate_dynamic_fifo(struct dwc2_hsotg *hsotg) 391static void dwc2_calculate_dynamic_fifo(struct dwc2_hsotg *hsotg)
392{ 392{
393 struct dwc2_core_params *params = hsotg->core_params; 393 struct dwc2_core_params *params = &hsotg->params;
394 struct dwc2_hw_params *hw = &hsotg->hw_params; 394 struct dwc2_hw_params *hw = &hsotg->hw_params;
395 u32 rxfsiz, nptxfsiz, ptxfsiz, total_fifo_size; 395 u32 rxfsiz, nptxfsiz, ptxfsiz, total_fifo_size;
396 396
@@ -449,7 +449,7 @@ static void dwc2_calculate_dynamic_fifo(struct dwc2_hsotg *hsotg)
449 449
450static void dwc2_config_fifos(struct dwc2_hsotg *hsotg) 450static void dwc2_config_fifos(struct dwc2_hsotg *hsotg)
451{ 451{
452 struct dwc2_core_params *params = hsotg->core_params; 452 struct dwc2_core_params *params = &hsotg->params;
453 u32 nptxfsiz, hptxfsiz, dfifocfg, grxfsiz; 453 u32 nptxfsiz, hptxfsiz, dfifocfg, grxfsiz;
454 454
455 if (!params->enable_dynamic_fifo) 455 if (!params->enable_dynamic_fifo)
@@ -490,7 +490,7 @@ static void dwc2_config_fifos(struct dwc2_hsotg *hsotg)
490 dev_dbg(hsotg->dev, "new hptxfsiz=%08x\n", 490 dev_dbg(hsotg->dev, "new hptxfsiz=%08x\n",
491 dwc2_readl(hsotg->regs + HPTXFSIZ)); 491 dwc2_readl(hsotg->regs + HPTXFSIZ));
492 492
493 if (hsotg->core_params->en_multiple_tx_fifo > 0 && 493 if (hsotg->params.en_multiple_tx_fifo > 0 &&
494 hsotg->hw_params.snpsid <= DWC2_CORE_REV_2_94a) { 494 hsotg->hw_params.snpsid <= DWC2_CORE_REV_2_94a) {
495 /* 495 /*
496 * Global DFIFOCFG calculation for Host mode - 496 * Global DFIFOCFG calculation for Host mode -
@@ -598,7 +598,7 @@ static void dwc2_dump_channel_info(struct dwc2_hsotg *hsotg,
598 struct dwc2_host_chan *chan) 598 struct dwc2_host_chan *chan)
599{ 599{
600#ifdef VERBOSE_DEBUG 600#ifdef VERBOSE_DEBUG
601 int num_channels = hsotg->core_params->host_channels; 601 int num_channels = hsotg->params.host_channels;
602 struct dwc2_qh *qh; 602 struct dwc2_qh *qh;
603 u32 hcchar; 603 u32 hcchar;
604 u32 hcsplt; 604 u32 hcsplt;
@@ -741,7 +741,7 @@ static void dwc2_hc_enable_dma_ints(struct dwc2_hsotg *hsotg,
741 * For Descriptor DMA mode core halts the channel on AHB error. 741 * For Descriptor DMA mode core halts the channel on AHB error.
742 * Interrupt is not required. 742 * Interrupt is not required.
743 */ 743 */
744 if (hsotg->core_params->dma_desc_enable <= 0) { 744 if (hsotg->params.dma_desc_enable <= 0) {
745 if (dbg_hc(chan)) 745 if (dbg_hc(chan))
746 dev_vdbg(hsotg->dev, "desc DMA disabled\n"); 746 dev_vdbg(hsotg->dev, "desc DMA disabled\n");
747 hcintmsk |= HCINTMSK_AHBERR; 747 hcintmsk |= HCINTMSK_AHBERR;
@@ -774,7 +774,7 @@ static void dwc2_hc_enable_ints(struct dwc2_hsotg *hsotg,
774{ 774{
775 u32 intmsk; 775 u32 intmsk;
776 776
777 if (hsotg->core_params->dma_enable > 0) { 777 if (hsotg->params.dma_enable > 0) {
778 if (dbg_hc(chan)) 778 if (dbg_hc(chan))
779 dev_vdbg(hsotg->dev, "DMA enabled\n"); 779 dev_vdbg(hsotg->dev, "DMA enabled\n");
780 dwc2_hc_enable_dma_ints(hsotg, chan); 780 dwc2_hc_enable_dma_ints(hsotg, chan);
@@ -994,7 +994,7 @@ void dwc2_hc_halt(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan,
994 994
995 /* No need to set the bit in DDMA for disabling the channel */ 995 /* No need to set the bit in DDMA for disabling the channel */
996 /* TODO check it everywhere channel is disabled */ 996 /* TODO check it everywhere channel is disabled */
997 if (hsotg->core_params->dma_desc_enable <= 0) { 997 if (hsotg->params.dma_desc_enable <= 0) {
998 if (dbg_hc(chan)) 998 if (dbg_hc(chan))
999 dev_vdbg(hsotg->dev, "desc DMA disabled\n"); 999 dev_vdbg(hsotg->dev, "desc DMA disabled\n");
1000 hcchar |= HCCHAR_CHENA; 1000 hcchar |= HCCHAR_CHENA;
@@ -1004,7 +1004,7 @@ void dwc2_hc_halt(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan,
1004 } 1004 }
1005 hcchar |= HCCHAR_CHDIS; 1005 hcchar |= HCCHAR_CHDIS;
1006 1006
1007 if (hsotg->core_params->dma_enable <= 0) { 1007 if (hsotg->params.dma_enable <= 0) {
1008 if (dbg_hc(chan)) 1008 if (dbg_hc(chan))
1009 dev_vdbg(hsotg->dev, "DMA not enabled\n"); 1009 dev_vdbg(hsotg->dev, "DMA not enabled\n");
1010 hcchar |= HCCHAR_CHENA; 1010 hcchar |= HCCHAR_CHENA;
@@ -1143,7 +1143,7 @@ static void dwc2_hc_set_even_odd_frame(struct dwc2_hsotg *hsotg,
1143 fifo_space = (dwc2_readl(hsotg->regs + HPTXSTS) & 1143 fifo_space = (dwc2_readl(hsotg->regs + HPTXSTS) &
1144 TXSTS_FSPCAVAIL_MASK) >> TXSTS_FSPCAVAIL_SHIFT; 1144 TXSTS_FSPCAVAIL_MASK) >> TXSTS_FSPCAVAIL_SHIFT;
1145 bytes_in_fifo = sizeof(u32) * 1145 bytes_in_fifo = sizeof(u32) *
1146 (hsotg->core_params->host_perio_tx_fifo_size - 1146 (hsotg->params.host_perio_tx_fifo_size -
1147 fifo_space); 1147 fifo_space);
1148 1148
1149 /* 1149 /*
@@ -1339,8 +1339,8 @@ static void dwc2_hc_do_ping(struct dwc2_hsotg *hsotg,
1339static void dwc2_hc_start_transfer(struct dwc2_hsotg *hsotg, 1339static void dwc2_hc_start_transfer(struct dwc2_hsotg *hsotg,
1340 struct dwc2_host_chan *chan) 1340 struct dwc2_host_chan *chan)
1341{ 1341{
1342 u32 max_hc_xfer_size = hsotg->core_params->max_transfer_size; 1342 u32 max_hc_xfer_size = hsotg->params.max_transfer_size;
1343 u16 max_hc_pkt_count = hsotg->core_params->max_packet_count; 1343 u16 max_hc_pkt_count = hsotg->params.max_packet_count;
1344 u32 hcchar; 1344 u32 hcchar;
1345 u32 hctsiz = 0; 1345 u32 hctsiz = 0;
1346 u16 num_packets; 1346 u16 num_packets;
@@ -1350,7 +1350,7 @@ static void dwc2_hc_start_transfer(struct dwc2_hsotg *hsotg,
1350 dev_vdbg(hsotg->dev, "%s()\n", __func__); 1350 dev_vdbg(hsotg->dev, "%s()\n", __func__);
1351 1351
1352 if (chan->do_ping) { 1352 if (chan->do_ping) {
1353 if (hsotg->core_params->dma_enable <= 0) { 1353 if (hsotg->params.dma_enable <= 0) {
1354 if (dbg_hc(chan)) 1354 if (dbg_hc(chan))
1355 dev_vdbg(hsotg->dev, "ping, no DMA\n"); 1355 dev_vdbg(hsotg->dev, "ping, no DMA\n");
1356 dwc2_hc_do_ping(hsotg, chan); 1356 dwc2_hc_do_ping(hsotg, chan);
@@ -1478,7 +1478,7 @@ static void dwc2_hc_start_transfer(struct dwc2_hsotg *hsotg,
1478 TSIZ_SC_MC_PID_SHIFT); 1478 TSIZ_SC_MC_PID_SHIFT);
1479 } 1479 }
1480 1480
1481 if (hsotg->core_params->dma_enable > 0) { 1481 if (hsotg->params.dma_enable > 0) {
1482 dwc2_writel((u32)chan->xfer_dma, 1482 dwc2_writel((u32)chan->xfer_dma,
1483 hsotg->regs + HCDMA(chan->hc_num)); 1483 hsotg->regs + HCDMA(chan->hc_num));
1484 if (dbg_hc(chan)) 1484 if (dbg_hc(chan))
@@ -1521,7 +1521,7 @@ static void dwc2_hc_start_transfer(struct dwc2_hsotg *hsotg,
1521 chan->xfer_started = 1; 1521 chan->xfer_started = 1;
1522 chan->requests++; 1522 chan->requests++;
1523 1523
1524 if (hsotg->core_params->dma_enable <= 0 && 1524 if (hsotg->params.dma_enable <= 0 &&
1525 !chan->ep_is_in && chan->xfer_len > 0) 1525 !chan->ep_is_in && chan->xfer_len > 0)
1526 /* Load OUT packet into the appropriate Tx FIFO */ 1526 /* Load OUT packet into the appropriate Tx FIFO */
1527 dwc2_hc_write_packet(hsotg, chan); 1527 dwc2_hc_write_packet(hsotg, chan);
@@ -1799,12 +1799,12 @@ void dwc2_hcd_start(struct dwc2_hsotg *hsotg)
1799/* Must be called with interrupt disabled and spinlock held */ 1799/* Must be called with interrupt disabled and spinlock held */
1800static void dwc2_hcd_cleanup_channels(struct dwc2_hsotg *hsotg) 1800static void dwc2_hcd_cleanup_channels(struct dwc2_hsotg *hsotg)
1801{ 1801{
1802 int num_channels = hsotg->core_params->host_channels; 1802 int num_channels = hsotg->params.host_channels;
1803 struct dwc2_host_chan *channel; 1803 struct dwc2_host_chan *channel;
1804 u32 hcchar; 1804 u32 hcchar;
1805 int i; 1805 int i;
1806 1806
1807 if (hsotg->core_params->dma_enable <= 0) { 1807 if (hsotg->params.dma_enable <= 0) {
1808 /* Flush out any channel requests in slave mode */ 1808 /* Flush out any channel requests in slave mode */
1809 for (i = 0; i < num_channels; i++) { 1809 for (i = 0; i < num_channels; i++) {
1810 channel = hsotg->hc_ptr_array[i]; 1810 channel = hsotg->hc_ptr_array[i];
@@ -1840,9 +1840,9 @@ static void dwc2_hcd_cleanup_channels(struct dwc2_hsotg *hsotg)
1840 channel->qh = NULL; 1840 channel->qh = NULL;
1841 } 1841 }
1842 /* All channels have been freed, mark them available */ 1842 /* All channels have been freed, mark them available */
1843 if (hsotg->core_params->uframe_sched > 0) { 1843 if (hsotg->params.uframe_sched > 0) {
1844 hsotg->available_host_channels = 1844 hsotg->available_host_channels =
1845 hsotg->core_params->host_channels; 1845 hsotg->params.host_channels;
1846 } else { 1846 } else {
1847 hsotg->non_periodic_channels = 0; 1847 hsotg->non_periodic_channels = 0;
1848 hsotg->periodic_channels = 0; 1848 hsotg->periodic_channels = 0;
@@ -2077,7 +2077,7 @@ static int dwc2_hcd_urb_dequeue(struct dwc2_hsotg *hsotg,
2077 * Free the QTD and clean up the associated QH. Leave the QH in the 2077 * Free the QTD and clean up the associated QH. Leave the QH in the
2078 * schedule if it has any remaining QTDs. 2078 * schedule if it has any remaining QTDs.
2079 */ 2079 */
2080 if (hsotg->core_params->dma_desc_enable <= 0) { 2080 if (hsotg->params.dma_desc_enable <= 0) {
2081 u8 in_process = urb_qtd->in_process; 2081 u8 in_process = urb_qtd->in_process;
2082 2082
2083 dwc2_hcd_qtd_unlink_and_free(hsotg, urb_qtd, qh); 2083 dwc2_hcd_qtd_unlink_and_free(hsotg, urb_qtd, qh);
@@ -2185,13 +2185,13 @@ static int dwc2_core_init(struct dwc2_hsotg *hsotg, bool initial_setup)
2185 2185
2186 /* Set ULPI External VBUS bit if needed */ 2186 /* Set ULPI External VBUS bit if needed */
2187 usbcfg &= ~GUSBCFG_ULPI_EXT_VBUS_DRV; 2187 usbcfg &= ~GUSBCFG_ULPI_EXT_VBUS_DRV;
2188 if (hsotg->core_params->phy_ulpi_ext_vbus == 2188 if (hsotg->params.phy_ulpi_ext_vbus ==
2189 DWC2_PHY_ULPI_EXTERNAL_VBUS) 2189 DWC2_PHY_ULPI_EXTERNAL_VBUS)
2190 usbcfg |= GUSBCFG_ULPI_EXT_VBUS_DRV; 2190 usbcfg |= GUSBCFG_ULPI_EXT_VBUS_DRV;
2191 2191
2192 /* Set external TS Dline pulsing bit if needed */ 2192 /* Set external TS Dline pulsing bit if needed */
2193 usbcfg &= ~GUSBCFG_TERMSELDLPULSE; 2193 usbcfg &= ~GUSBCFG_TERMSELDLPULSE;
2194 if (hsotg->core_params->ts_dline > 0) 2194 if (hsotg->params.ts_dline > 0)
2195 usbcfg |= GUSBCFG_TERMSELDLPULSE; 2195 usbcfg |= GUSBCFG_TERMSELDLPULSE;
2196 2196
2197 dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); 2197 dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
@@ -2230,10 +2230,10 @@ static int dwc2_core_init(struct dwc2_hsotg *hsotg, bool initial_setup)
2230 /* Program the GOTGCTL register */ 2230 /* Program the GOTGCTL register */
2231 otgctl = dwc2_readl(hsotg->regs + GOTGCTL); 2231 otgctl = dwc2_readl(hsotg->regs + GOTGCTL);
2232 otgctl &= ~GOTGCTL_OTGVER; 2232 otgctl &= ~GOTGCTL_OTGVER;
2233 if (hsotg->core_params->otg_ver > 0) 2233 if (hsotg->params.otg_ver > 0)
2234 otgctl |= GOTGCTL_OTGVER; 2234 otgctl |= GOTGCTL_OTGVER;
2235 dwc2_writel(otgctl, hsotg->regs + GOTGCTL); 2235 dwc2_writel(otgctl, hsotg->regs + GOTGCTL);
2236 dev_dbg(hsotg->dev, "OTG VER PARAM: %d\n", hsotg->core_params->otg_ver); 2236 dev_dbg(hsotg->dev, "OTG VER PARAM: %d\n", hsotg->params.otg_ver);
2237 2237
2238 /* Clear the SRP success bit for FS-I2c */ 2238 /* Clear the SRP success bit for FS-I2c */
2239 hsotg->srp_success = 0; 2239 hsotg->srp_success = 0;
@@ -2277,7 +2277,7 @@ static void dwc2_core_host_init(struct dwc2_hsotg *hsotg)
2277 2277
2278 /* Initialize Host Configuration Register */ 2278 /* Initialize Host Configuration Register */
2279 dwc2_init_fs_ls_pclk_sel(hsotg); 2279 dwc2_init_fs_ls_pclk_sel(hsotg);
2280 if (hsotg->core_params->speed == DWC2_SPEED_PARAM_FULL) { 2280 if (hsotg->params.speed == DWC2_SPEED_PARAM_FULL) {
2281 hcfg = dwc2_readl(hsotg->regs + HCFG); 2281 hcfg = dwc2_readl(hsotg->regs + HCFG);
2282 hcfg |= HCFG_FSLSSUPP; 2282 hcfg |= HCFG_FSLSSUPP;
2283 dwc2_writel(hcfg, hsotg->regs + HCFG); 2283 dwc2_writel(hcfg, hsotg->regs + HCFG);
@@ -2288,13 +2288,13 @@ static void dwc2_core_host_init(struct dwc2_hsotg *hsotg)
2288 * runtime. This bit needs to be programmed during initial configuration 2288 * runtime. This bit needs to be programmed during initial configuration
2289 * and its value must not be changed during runtime. 2289 * and its value must not be changed during runtime.
2290 */ 2290 */
2291 if (hsotg->core_params->reload_ctl > 0) { 2291 if (hsotg->params.reload_ctl > 0) {
2292 hfir = dwc2_readl(hsotg->regs + HFIR); 2292 hfir = dwc2_readl(hsotg->regs + HFIR);
2293 hfir |= HFIR_RLDCTRL; 2293 hfir |= HFIR_RLDCTRL;
2294 dwc2_writel(hfir, hsotg->regs + HFIR); 2294 dwc2_writel(hfir, hsotg->regs + HFIR);
2295 } 2295 }
2296 2296
2297 if (hsotg->core_params->dma_desc_enable > 0) { 2297 if (hsotg->params.dma_desc_enable > 0) {
2298 u32 op_mode = hsotg->hw_params.op_mode; 2298 u32 op_mode = hsotg->hw_params.op_mode;
2299 2299
2300 if (hsotg->hw_params.snpsid < DWC2_CORE_REV_2_90a || 2300 if (hsotg->hw_params.snpsid < DWC2_CORE_REV_2_90a ||
@@ -2306,7 +2306,7 @@ static void dwc2_core_host_init(struct dwc2_hsotg *hsotg)
2306 "Hardware does not support descriptor DMA mode -\n"); 2306 "Hardware does not support descriptor DMA mode -\n");
2307 dev_err(hsotg->dev, 2307 dev_err(hsotg->dev,
2308 "falling back to buffer DMA mode.\n"); 2308 "falling back to buffer DMA mode.\n");
2309 hsotg->core_params->dma_desc_enable = 0; 2309 hsotg->params.dma_desc_enable = 0;
2310 } else { 2310 } else {
2311 hcfg = dwc2_readl(hsotg->regs + HCFG); 2311 hcfg = dwc2_readl(hsotg->regs + HCFG);
2312 hcfg |= HCFG_DESCDMA; 2312 hcfg |= HCFG_DESCDMA;
@@ -2332,12 +2332,12 @@ static void dwc2_core_host_init(struct dwc2_hsotg *hsotg)
2332 otgctl &= ~GOTGCTL_HSTSETHNPEN; 2332 otgctl &= ~GOTGCTL_HSTSETHNPEN;
2333 dwc2_writel(otgctl, hsotg->regs + GOTGCTL); 2333 dwc2_writel(otgctl, hsotg->regs + GOTGCTL);
2334 2334
2335 if (hsotg->core_params->dma_desc_enable <= 0) { 2335 if (hsotg->params.dma_desc_enable <= 0) {
2336 int num_channels, i; 2336 int num_channels, i;
2337 u32 hcchar; 2337 u32 hcchar;
2338 2338
2339 /* Flush out any leftover queued requests */ 2339 /* Flush out any leftover queued requests */
2340 num_channels = hsotg->core_params->host_channels; 2340 num_channels = hsotg->params.host_channels;
2341 for (i = 0; i < num_channels; i++) { 2341 for (i = 0; i < num_channels; i++) {
2342 hcchar = dwc2_readl(hsotg->regs + HCCHAR(i)); 2342 hcchar = dwc2_readl(hsotg->regs + HCCHAR(i));
2343 hcchar &= ~HCCHAR_CHENA; 2343 hcchar &= ~HCCHAR_CHENA;
@@ -2399,9 +2399,9 @@ static void dwc2_hcd_reinit(struct dwc2_hsotg *hsotg)
2399 hsotg->flags.d32 = 0; 2399 hsotg->flags.d32 = 0;
2400 hsotg->non_periodic_qh_ptr = &hsotg->non_periodic_sched_active; 2400 hsotg->non_periodic_qh_ptr = &hsotg->non_periodic_sched_active;
2401 2401
2402 if (hsotg->core_params->uframe_sched > 0) { 2402 if (hsotg->params.uframe_sched > 0) {
2403 hsotg->available_host_channels = 2403 hsotg->available_host_channels =
2404 hsotg->core_params->host_channels; 2404 hsotg->params.host_channels;
2405 } else { 2405 } else {
2406 hsotg->non_periodic_channels = 0; 2406 hsotg->non_periodic_channels = 0;
2407 hsotg->periodic_channels = 0; 2407 hsotg->periodic_channels = 0;
@@ -2415,7 +2415,7 @@ static void dwc2_hcd_reinit(struct dwc2_hsotg *hsotg)
2415 hc_list_entry) 2415 hc_list_entry)
2416 list_del_init(&chan->hc_list_entry); 2416 list_del_init(&chan->hc_list_entry);
2417 2417
2418 num_channels = hsotg->core_params->host_channels; 2418 num_channels = hsotg->params.host_channels;
2419 for (i = 0; i < num_channels; i++) { 2419 for (i = 0; i < num_channels; i++) {
2420 chan = hsotg->hc_ptr_array[i]; 2420 chan = hsotg->hc_ptr_array[i];
2421 list_add_tail(&chan->hc_list_entry, &hsotg->free_hc_list); 2421 list_add_tail(&chan->hc_list_entry, &hsotg->free_hc_list);
@@ -2457,7 +2457,7 @@ static void dwc2_hc_init_xfer(struct dwc2_hsotg *hsotg,
2457 chan->do_ping = 0; 2457 chan->do_ping = 0;
2458 chan->ep_is_in = 0; 2458 chan->ep_is_in = 0;
2459 chan->data_pid_start = DWC2_HC_PID_SETUP; 2459 chan->data_pid_start = DWC2_HC_PID_SETUP;
2460 if (hsotg->core_params->dma_enable > 0) 2460 if (hsotg->params.dma_enable > 0)
2461 chan->xfer_dma = urb->setup_dma; 2461 chan->xfer_dma = urb->setup_dma;
2462 else 2462 else
2463 chan->xfer_buf = urb->setup_packet; 2463 chan->xfer_buf = urb->setup_packet;
@@ -2484,7 +2484,7 @@ static void dwc2_hc_init_xfer(struct dwc2_hsotg *hsotg,
2484 chan->do_ping = 0; 2484 chan->do_ping = 0;
2485 chan->data_pid_start = DWC2_HC_PID_DATA1; 2485 chan->data_pid_start = DWC2_HC_PID_DATA1;
2486 chan->xfer_len = 0; 2486 chan->xfer_len = 0;
2487 if (hsotg->core_params->dma_enable > 0) 2487 if (hsotg->params.dma_enable > 0)
2488 chan->xfer_dma = hsotg->status_buf_dma; 2488 chan->xfer_dma = hsotg->status_buf_dma;
2489 else 2489 else
2490 chan->xfer_buf = hsotg->status_buf; 2490 chan->xfer_buf = hsotg->status_buf;
@@ -2502,13 +2502,13 @@ static void dwc2_hc_init_xfer(struct dwc2_hsotg *hsotg,
2502 2502
2503 case USB_ENDPOINT_XFER_ISOC: 2503 case USB_ENDPOINT_XFER_ISOC:
2504 chan->ep_type = USB_ENDPOINT_XFER_ISOC; 2504 chan->ep_type = USB_ENDPOINT_XFER_ISOC;
2505 if (hsotg->core_params->dma_desc_enable > 0) 2505 if (hsotg->params.dma_desc_enable > 0)
2506 break; 2506 break;
2507 2507
2508 frame_desc = &urb->iso_descs[qtd->isoc_frame_index]; 2508 frame_desc = &urb->iso_descs[qtd->isoc_frame_index];
2509 frame_desc->status = 0; 2509 frame_desc->status = 0;
2510 2510
2511 if (hsotg->core_params->dma_enable > 0) { 2511 if (hsotg->params.dma_enable > 0) {
2512 chan->xfer_dma = urb->dma; 2512 chan->xfer_dma = urb->dma;
2513 chan->xfer_dma += frame_desc->offset + 2513 chan->xfer_dma += frame_desc->offset +
2514 qtd->isoc_split_offset; 2514 qtd->isoc_split_offset;
@@ -2690,7 +2690,7 @@ static int dwc2_assign_and_init_hc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
2690 !dwc2_hcd_is_pipe_in(&urb->pipe_info)) 2690 !dwc2_hcd_is_pipe_in(&urb->pipe_info))
2691 urb->actual_length = urb->length; 2691 urb->actual_length = urb->length;
2692 2692
2693 if (hsotg->core_params->dma_enable > 0) 2693 if (hsotg->params.dma_enable > 0)
2694 chan->xfer_dma = urb->dma + urb->actual_length; 2694 chan->xfer_dma = urb->dma + urb->actual_length;
2695 else 2695 else
2696 chan->xfer_buf = (u8 *)urb->buf + urb->actual_length; 2696 chan->xfer_buf = (u8 *)urb->buf + urb->actual_length;
@@ -2715,7 +2715,7 @@ static int dwc2_assign_and_init_hc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
2715 */ 2715 */
2716 chan->multi_count = dwc2_hb_mult(qh->maxp); 2716 chan->multi_count = dwc2_hb_mult(qh->maxp);
2717 2717
2718 if (hsotg->core_params->dma_desc_enable > 0) { 2718 if (hsotg->params.dma_desc_enable > 0) {
2719 chan->desc_list_addr = qh->desc_list_dma; 2719 chan->desc_list_addr = qh->desc_list_dma;
2720 chan->desc_list_sz = qh->desc_list_sz; 2720 chan->desc_list_sz = qh->desc_list_sz;
2721 } 2721 }
@@ -2752,7 +2752,7 @@ enum dwc2_transaction_type dwc2_hcd_select_transactions(
2752 while (qh_ptr != &hsotg->periodic_sched_ready) { 2752 while (qh_ptr != &hsotg->periodic_sched_ready) {
2753 if (list_empty(&hsotg->free_hc_list)) 2753 if (list_empty(&hsotg->free_hc_list))
2754 break; 2754 break;
2755 if (hsotg->core_params->uframe_sched > 0) { 2755 if (hsotg->params.uframe_sched > 0) {
2756 if (hsotg->available_host_channels <= 1) 2756 if (hsotg->available_host_channels <= 1)
2757 break; 2757 break;
2758 hsotg->available_host_channels--; 2758 hsotg->available_host_channels--;
@@ -2776,17 +2776,17 @@ enum dwc2_transaction_type dwc2_hcd_select_transactions(
2776 * schedule. Some free host channels may not be used if they are 2776 * schedule. Some free host channels may not be used if they are
2777 * reserved for periodic transfers. 2777 * reserved for periodic transfers.
2778 */ 2778 */
2779 num_channels = hsotg->core_params->host_channels; 2779 num_channels = hsotg->params.host_channels;
2780 qh_ptr = hsotg->non_periodic_sched_inactive.next; 2780 qh_ptr = hsotg->non_periodic_sched_inactive.next;
2781 while (qh_ptr != &hsotg->non_periodic_sched_inactive) { 2781 while (qh_ptr != &hsotg->non_periodic_sched_inactive) {
2782 if (hsotg->core_params->uframe_sched <= 0 && 2782 if (hsotg->params.uframe_sched <= 0 &&
2783 hsotg->non_periodic_channels >= num_channels - 2783 hsotg->non_periodic_channels >= num_channels -
2784 hsotg->periodic_channels) 2784 hsotg->periodic_channels)
2785 break; 2785 break;
2786 if (list_empty(&hsotg->free_hc_list)) 2786 if (list_empty(&hsotg->free_hc_list))
2787 break; 2787 break;
2788 qh = list_entry(qh_ptr, struct dwc2_qh, qh_list_entry); 2788 qh = list_entry(qh_ptr, struct dwc2_qh, qh_list_entry);
2789 if (hsotg->core_params->uframe_sched > 0) { 2789 if (hsotg->params.uframe_sched > 0) {
2790 if (hsotg->available_host_channels < 1) 2790 if (hsotg->available_host_channels < 1)
2791 break; 2791 break;
2792 hsotg->available_host_channels--; 2792 hsotg->available_host_channels--;
@@ -2808,7 +2808,7 @@ enum dwc2_transaction_type dwc2_hcd_select_transactions(
2808 else 2808 else
2809 ret_val = DWC2_TRANSACTION_ALL; 2809 ret_val = DWC2_TRANSACTION_ALL;
2810 2810
2811 if (hsotg->core_params->uframe_sched <= 0) 2811 if (hsotg->params.uframe_sched <= 0)
2812 hsotg->non_periodic_channels++; 2812 hsotg->non_periodic_channels++;
2813 } 2813 }
2814 2814
@@ -2847,8 +2847,8 @@ static int dwc2_queue_transaction(struct dwc2_hsotg *hsotg,
2847 list_move_tail(&chan->split_order_list_entry, 2847 list_move_tail(&chan->split_order_list_entry,
2848 &hsotg->split_order); 2848 &hsotg->split_order);
2849 2849
2850 if (hsotg->core_params->dma_enable > 0) { 2850 if (hsotg->params.dma_enable > 0) {
2851 if (hsotg->core_params->dma_desc_enable > 0) { 2851 if (hsotg->params.dma_desc_enable > 0) {
2852 if (!chan->xfer_started || 2852 if (!chan->xfer_started ||
2853 chan->ep_type == USB_ENDPOINT_XFER_ISOC) { 2853 chan->ep_type == USB_ENDPOINT_XFER_ISOC) {
2854 dwc2_hcd_start_xfer_ddma(hsotg, chan->qh); 2854 dwc2_hcd_start_xfer_ddma(hsotg, chan->qh);
@@ -2957,7 +2957,7 @@ static void dwc2_process_periodic_channels(struct dwc2_hsotg *hsotg)
2957 * The flag prevents any halts to get into the request queue in 2957 * The flag prevents any halts to get into the request queue in
2958 * the middle of multiple high-bandwidth packets getting queued. 2958 * the middle of multiple high-bandwidth packets getting queued.
2959 */ 2959 */
2960 if (hsotg->core_params->dma_enable <= 0 && 2960 if (hsotg->params.dma_enable <= 0 &&
2961 qh->channel->multi_count > 1) 2961 qh->channel->multi_count > 1)
2962 hsotg->queuing_high_bandwidth = 1; 2962 hsotg->queuing_high_bandwidth = 1;
2963 2963
@@ -2976,7 +2976,7 @@ static void dwc2_process_periodic_channels(struct dwc2_hsotg *hsotg)
2976 * controller automatically handles multiple packets for 2976 * controller automatically handles multiple packets for
2977 * high-bandwidth transfers. 2977 * high-bandwidth transfers.
2978 */ 2978 */
2979 if (hsotg->core_params->dma_enable > 0 || status == 0 || 2979 if (hsotg->params.dma_enable > 0 || status == 0 ||
2980 qh->channel->requests == qh->channel->multi_count) { 2980 qh->channel->requests == qh->channel->multi_count) {
2981 qh_ptr = qh_ptr->next; 2981 qh_ptr = qh_ptr->next;
2982 /* 2982 /*
@@ -2993,7 +2993,7 @@ static void dwc2_process_periodic_channels(struct dwc2_hsotg *hsotg)
2993 2993
2994exit: 2994exit:
2995 if (no_queue_space || no_fifo_space || 2995 if (no_queue_space || no_fifo_space ||
2996 (hsotg->core_params->dma_enable <= 0 && 2996 (hsotg->params.dma_enable <= 0 &&
2997 !list_empty(&hsotg->periodic_sched_assigned))) { 2997 !list_empty(&hsotg->periodic_sched_assigned))) {
2998 /* 2998 /*
2999 * May need to queue more transactions as the request 2999 * May need to queue more transactions as the request
@@ -3073,7 +3073,7 @@ static void dwc2_process_non_periodic_channels(struct dwc2_hsotg *hsotg)
3073 tx_status = dwc2_readl(hsotg->regs + GNPTXSTS); 3073 tx_status = dwc2_readl(hsotg->regs + GNPTXSTS);
3074 qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >> 3074 qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>
3075 TXSTS_QSPCAVAIL_SHIFT; 3075 TXSTS_QSPCAVAIL_SHIFT;
3076 if (hsotg->core_params->dma_enable <= 0 && qspcavail == 0) { 3076 if (hsotg->params.dma_enable <= 0 && qspcavail == 0) {
3077 no_queue_space = 1; 3077 no_queue_space = 1;
3078 break; 3078 break;
3079 } 3079 }
@@ -3106,7 +3106,7 @@ next:
3106 hsotg->non_periodic_qh_ptr->next; 3106 hsotg->non_periodic_qh_ptr->next;
3107 } while (hsotg->non_periodic_qh_ptr != orig_qh_ptr); 3107 } while (hsotg->non_periodic_qh_ptr != orig_qh_ptr);
3108 3108
3109 if (hsotg->core_params->dma_enable <= 0) { 3109 if (hsotg->params.dma_enable <= 0) {
3110 tx_status = dwc2_readl(hsotg->regs + GNPTXSTS); 3110 tx_status = dwc2_readl(hsotg->regs + GNPTXSTS);
3111 qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >> 3111 qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>
3112 TXSTS_QSPCAVAIL_SHIFT; 3112 TXSTS_QSPCAVAIL_SHIFT;
@@ -3307,7 +3307,7 @@ static void dwc2_port_suspend(struct dwc2_hsotg *hsotg, u16 windex)
3307 * If hibernation is supported, Phy clock will be suspended 3307 * If hibernation is supported, Phy clock will be suspended
3308 * after registers are backuped. 3308 * after registers are backuped.
3309 */ 3309 */
3310 if (!hsotg->core_params->hibernation) { 3310 if (!hsotg->params.hibernation) {
3311 /* Suspend the Phy Clock */ 3311 /* Suspend the Phy Clock */
3312 pcgctl = dwc2_readl(hsotg->regs + PCGCTL); 3312 pcgctl = dwc2_readl(hsotg->regs + PCGCTL);
3313 pcgctl |= PCGCTL_STOPPCLK; 3313 pcgctl |= PCGCTL_STOPPCLK;
@@ -3342,7 +3342,7 @@ static void dwc2_port_resume(struct dwc2_hsotg *hsotg)
3342 * If hibernation is supported, Phy clock is already resumed 3342 * If hibernation is supported, Phy clock is already resumed
3343 * after registers restore. 3343 * after registers restore.
3344 */ 3344 */
3345 if (!hsotg->core_params->hibernation) { 3345 if (!hsotg->params.hibernation) {
3346 pcgctl = dwc2_readl(hsotg->regs + PCGCTL); 3346 pcgctl = dwc2_readl(hsotg->regs + PCGCTL);
3347 pcgctl &= ~PCGCTL_STOPPCLK; 3347 pcgctl &= ~PCGCTL_STOPPCLK;
3348 dwc2_writel(pcgctl, hsotg->regs + PCGCTL); 3348 dwc2_writel(pcgctl, hsotg->regs + PCGCTL);
@@ -3569,7 +3569,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq,
3569 port_status |= USB_PORT_STAT_TEST; 3569 port_status |= USB_PORT_STAT_TEST;
3570 /* USB_PORT_FEAT_INDICATOR unsupported always 0 */ 3570 /* USB_PORT_FEAT_INDICATOR unsupported always 0 */
3571 3571
3572 if (hsotg->core_params->dma_desc_fs_enable) { 3572 if (hsotg->params.dma_desc_fs_enable) {
3573 /* 3573 /*
3574 * Enable descriptor DMA only if a full speed 3574 * Enable descriptor DMA only if a full speed
3575 * device is connected. 3575 * device is connected.
@@ -3583,7 +3583,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq,
3583 u32 hcfg; 3583 u32 hcfg;
3584 3584
3585 dev_info(hsotg->dev, "Enabling descriptor DMA mode\n"); 3585 dev_info(hsotg->dev, "Enabling descriptor DMA mode\n");
3586 hsotg->core_params->dma_desc_enable = 1; 3586 hsotg->params.dma_desc_enable = 1;
3587 hcfg = dwc2_readl(hsotg->regs + HCFG); 3587 hcfg = dwc2_readl(hsotg->regs + HCFG);
3588 hcfg |= HCFG_DESCDMA; 3588 hcfg |= HCFG_DESCDMA;
3589 dwc2_writel(hcfg, hsotg->regs + HCFG); 3589 dwc2_writel(hcfg, hsotg->regs + HCFG);
@@ -3824,7 +3824,7 @@ void dwc2_hcd_dump_state(struct dwc2_hsotg *hsotg)
3824 u32 p_tx_status; 3824 u32 p_tx_status;
3825 int i; 3825 int i;
3826 3826
3827 num_channels = hsotg->core_params->host_channels; 3827 num_channels = hsotg->params.host_channels;
3828 dev_dbg(hsotg->dev, "\n"); 3828 dev_dbg(hsotg->dev, "\n");
3829 dev_dbg(hsotg->dev, 3829 dev_dbg(hsotg->dev,
3830 "************************************************************\n"); 3830 "************************************************************\n");
@@ -4365,7 +4365,7 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd)
4365 if (!HCD_HW_ACCESSIBLE(hcd)) 4365 if (!HCD_HW_ACCESSIBLE(hcd))
4366 goto unlock; 4366 goto unlock;
4367 4367
4368 if (!hsotg->core_params->hibernation) 4368 if (!hsotg->params.hibernation)
4369 goto skip_power_saving; 4369 goto skip_power_saving;
4370 4370
4371 /* 4371 /*
@@ -4417,7 +4417,7 @@ static int _dwc2_hcd_resume(struct usb_hcd *hcd)
4417 if (hsotg->lx_state != DWC2_L2) 4417 if (hsotg->lx_state != DWC2_L2)
4418 goto unlock; 4418 goto unlock;
4419 4419
4420 if (!hsotg->core_params->hibernation) { 4420 if (!hsotg->params.hibernation) {
4421 hsotg->lx_state = DWC2_L0; 4421 hsotg->lx_state = DWC2_L0;
4422 goto unlock; 4422 goto unlock;
4423 } 4423 }
@@ -4919,7 +4919,7 @@ static void dwc2_hcd_free(struct dwc2_hsotg *hsotg)
4919 } 4919 }
4920 } 4920 }
4921 4921
4922 if (hsotg->core_params->dma_enable > 0) { 4922 if (hsotg->params.dma_enable > 0) {
4923 if (hsotg->status_buf) { 4923 if (hsotg->status_buf) {
4924 dma_free_coherent(hsotg->dev, DWC2_HCD_STATUS_BUF_SIZE, 4924 dma_free_coherent(hsotg->dev, DWC2_HCD_STATUS_BUF_SIZE,
4925 hsotg->status_buf, 4925 hsotg->status_buf,
@@ -4999,16 +4999,16 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
4999 hsotg->last_frame_num = HFNUM_MAX_FRNUM; 4999 hsotg->last_frame_num = HFNUM_MAX_FRNUM;
5000 5000
5001 /* Check if the bus driver or platform code has setup a dma_mask */ 5001 /* Check if the bus driver or platform code has setup a dma_mask */
5002 if (hsotg->core_params->dma_enable > 0 && 5002 if (hsotg->params.dma_enable > 0 &&
5003 hsotg->dev->dma_mask == NULL) { 5003 hsotg->dev->dma_mask == NULL) {
5004 dev_warn(hsotg->dev, 5004 dev_warn(hsotg->dev,
5005 "dma_mask not set, disabling DMA\n"); 5005 "dma_mask not set, disabling DMA\n");
5006 hsotg->core_params->dma_enable = 0; 5006 hsotg->params.dma_enable = 0;
5007 hsotg->core_params->dma_desc_enable = 0; 5007 hsotg->params.dma_desc_enable = 0;
5008 } 5008 }
5009 5009
5010 /* Set device flags indicating whether the HCD supports DMA */ 5010 /* Set device flags indicating whether the HCD supports DMA */
5011 if (hsotg->core_params->dma_enable > 0) { 5011 if (hsotg->params.dma_enable > 0) {
5012 if (dma_set_mask(hsotg->dev, DMA_BIT_MASK(32)) < 0) 5012 if (dma_set_mask(hsotg->dev, DMA_BIT_MASK(32)) < 0)
5013 dev_warn(hsotg->dev, "can't set DMA mask\n"); 5013 dev_warn(hsotg->dev, "can't set DMA mask\n");
5014 if (dma_set_coherent_mask(hsotg->dev, DMA_BIT_MASK(32)) < 0) 5014 if (dma_set_coherent_mask(hsotg->dev, DMA_BIT_MASK(32)) < 0)
@@ -5019,7 +5019,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
5019 if (!hcd) 5019 if (!hcd)
5020 goto error1; 5020 goto error1;
5021 5021
5022 if (hsotg->core_params->dma_enable <= 0) 5022 if (hsotg->params.dma_enable <= 0)
5023 hcd->self.uses_dma = 0; 5023 hcd->self.uses_dma = 0;
5024 5024
5025 hcd->has_tt = 1; 5025 hcd->has_tt = 1;
@@ -5067,7 +5067,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
5067 * in the controller. Initialize the channel descriptor array. 5067 * in the controller. Initialize the channel descriptor array.
5068 */ 5068 */
5069 INIT_LIST_HEAD(&hsotg->free_hc_list); 5069 INIT_LIST_HEAD(&hsotg->free_hc_list);
5070 num_channels = hsotg->core_params->host_channels; 5070 num_channels = hsotg->params.host_channels;
5071 memset(&hsotg->hc_ptr_array[0], 0, sizeof(hsotg->hc_ptr_array)); 5071 memset(&hsotg->hc_ptr_array[0], 0, sizeof(hsotg->hc_ptr_array));
5072 5072
5073 for (i = 0; i < num_channels; i++) { 5073 for (i = 0; i < num_channels; i++) {
@@ -5091,7 +5091,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
5091 * done after usb_add_hcd since that function allocates the DMA buffer 5091 * done after usb_add_hcd since that function allocates the DMA buffer
5092 * pool. 5092 * pool.
5093 */ 5093 */
5094 if (hsotg->core_params->dma_enable > 0) 5094 if (hsotg->params.dma_enable > 0)
5095 hsotg->status_buf = dma_alloc_coherent(hsotg->dev, 5095 hsotg->status_buf = dma_alloc_coherent(hsotg->dev,
5096 DWC2_HCD_STATUS_BUF_SIZE, 5096 DWC2_HCD_STATUS_BUF_SIZE,
5097 &hsotg->status_buf_dma, GFP_KERNEL); 5097 &hsotg->status_buf_dma, GFP_KERNEL);
@@ -5107,8 +5107,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
5107 * DMA mode. 5107 * DMA mode.
5108 * Alignment must be set to 512 bytes. 5108 * Alignment must be set to 512 bytes.
5109 */ 5109 */
5110 if (hsotg->core_params->dma_desc_enable || 5110 if (hsotg->params.dma_desc_enable ||
5111 hsotg->core_params->dma_desc_fs_enable) { 5111 hsotg->params.dma_desc_fs_enable) {
5112 hsotg->desc_gen_cache = kmem_cache_create("dwc2-gen-desc", 5112 hsotg->desc_gen_cache = kmem_cache_create("dwc2-gen-desc",
5113 sizeof(struct dwc2_hcd_dma_desc) * 5113 sizeof(struct dwc2_hcd_dma_desc) *
5114 MAX_DMA_DESC_NUM_GENERIC, 512, SLAB_CACHE_DMA, 5114 MAX_DMA_DESC_NUM_GENERIC, 512, SLAB_CACHE_DMA,
@@ -5121,8 +5121,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
5121 * Disable descriptor dma mode since it will not be 5121 * Disable descriptor dma mode since it will not be
5122 * usable. 5122 * usable.
5123 */ 5123 */
5124 hsotg->core_params->dma_desc_enable = 0; 5124 hsotg->params.dma_desc_enable = 0;
5125 hsotg->core_params->dma_desc_fs_enable = 0; 5125 hsotg->params.dma_desc_fs_enable = 0;
5126 } 5126 }
5127 5127
5128 hsotg->desc_hsisoc_cache = kmem_cache_create("dwc2-hsisoc-desc", 5128 hsotg->desc_hsisoc_cache = kmem_cache_create("dwc2-hsisoc-desc",
@@ -5138,8 +5138,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
5138 * Disable descriptor dma mode since it will not be 5138 * Disable descriptor dma mode since it will not be
5139 * usable. 5139 * usable.
5140 */ 5140 */
5141 hsotg->core_params->dma_desc_enable = 0; 5141 hsotg->params.dma_desc_enable = 0;
5142 hsotg->core_params->dma_desc_fs_enable = 0; 5142 hsotg->params.dma_desc_fs_enable = 0;
5143 } 5143 }
5144 } 5144 }
5145 5145
@@ -5249,7 +5249,7 @@ int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg)
5249 hr = &hsotg->hr_backup; 5249 hr = &hsotg->hr_backup;
5250 hr->hcfg = dwc2_readl(hsotg->regs + HCFG); 5250 hr->hcfg = dwc2_readl(hsotg->regs + HCFG);
5251 hr->haintmsk = dwc2_readl(hsotg->regs + HAINTMSK); 5251 hr->haintmsk = dwc2_readl(hsotg->regs + HAINTMSK);
5252 for (i = 0; i < hsotg->core_params->host_channels; ++i) 5252 for (i = 0; i < hsotg->params.host_channels; ++i)
5253 hr->hcintmsk[i] = dwc2_readl(hsotg->regs + HCINTMSK(i)); 5253 hr->hcintmsk[i] = dwc2_readl(hsotg->regs + HCINTMSK(i));
5254 5254
5255 hr->hprt0 = dwc2_read_hprt0(hsotg); 5255 hr->hprt0 = dwc2_read_hprt0(hsotg);
@@ -5285,7 +5285,7 @@ int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg)
5285 dwc2_writel(hr->hcfg, hsotg->regs + HCFG); 5285 dwc2_writel(hr->hcfg, hsotg->regs + HCFG);
5286 dwc2_writel(hr->haintmsk, hsotg->regs + HAINTMSK); 5286 dwc2_writel(hr->haintmsk, hsotg->regs + HAINTMSK);
5287 5287
5288 for (i = 0; i < hsotg->core_params->host_channels; ++i) 5288 for (i = 0; i < hsotg->params.host_channels; ++i)
5289 dwc2_writel(hr->hcintmsk[i], hsotg->regs + HCINTMSK(i)); 5289 dwc2_writel(hr->hcintmsk[i], hsotg->regs + HCINTMSK(i));
5290 5290
5291 dwc2_writel(hr->hprt0, hsotg->regs + HPRT0); 5291 dwc2_writel(hr->hprt0, hsotg->regs + HPRT0);
diff --git a/drivers/usb/dwc2/hcd_ddma.c b/drivers/usb/dwc2/hcd_ddma.c
index 0e1d42b5dec5..41e0a8d2f59e 100644
--- a/drivers/usb/dwc2/hcd_ddma.c
+++ b/drivers/usb/dwc2/hcd_ddma.c
@@ -297,7 +297,7 @@ static void dwc2_release_channel_ddma(struct dwc2_hsotg *hsotg,
297 struct dwc2_host_chan *chan = qh->channel; 297 struct dwc2_host_chan *chan = qh->channel;
298 298
299 if (dwc2_qh_is_non_per(qh)) { 299 if (dwc2_qh_is_non_per(qh)) {
300 if (hsotg->core_params->uframe_sched > 0) 300 if (hsotg->params.uframe_sched > 0)
301 hsotg->available_host_channels++; 301 hsotg->available_host_channels++;
302 else 302 else
303 hsotg->non_periodic_channels--; 303 hsotg->non_periodic_channels--;
@@ -404,7 +404,7 @@ void dwc2_hcd_qh_free_ddma(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
404 404
405 if ((qh->ep_type == USB_ENDPOINT_XFER_ISOC || 405 if ((qh->ep_type == USB_ENDPOINT_XFER_ISOC ||
406 qh->ep_type == USB_ENDPOINT_XFER_INT) && 406 qh->ep_type == USB_ENDPOINT_XFER_INT) &&
407 (hsotg->core_params->uframe_sched > 0 || 407 (hsotg->params.uframe_sched > 0 ||
408 !hsotg->periodic_channels) && hsotg->frame_list) { 408 !hsotg->periodic_channels) && hsotg->frame_list) {
409 dwc2_per_sched_disable(hsotg); 409 dwc2_per_sched_disable(hsotg);
410 dwc2_frame_list_free(hsotg); 410 dwc2_frame_list_free(hsotg);
diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c
index 906f223542ee..1b214a4effdb 100644
--- a/drivers/usb/dwc2/hcd_intr.c
+++ b/drivers/usb/dwc2/hcd_intr.c
@@ -256,7 +256,7 @@ static void dwc2_perio_tx_fifo_empty_intr(struct dwc2_hsotg *hsotg)
256static void dwc2_hprt0_enable(struct dwc2_hsotg *hsotg, u32 hprt0, 256static void dwc2_hprt0_enable(struct dwc2_hsotg *hsotg, u32 hprt0,
257 u32 *hprt0_modify) 257 u32 *hprt0_modify)
258{ 258{
259 struct dwc2_core_params *params = hsotg->core_params; 259 struct dwc2_core_params *params = &hsotg->params;
260 int do_reset = 0; 260 int do_reset = 0;
261 u32 usbcfg; 261 u32 usbcfg;
262 u32 prtspd; 262 u32 prtspd;
@@ -395,10 +395,10 @@ static void dwc2_port_intr(struct dwc2_hsotg *hsotg)
395 dwc2_hprt0_enable(hsotg, hprt0, &hprt0_modify); 395 dwc2_hprt0_enable(hsotg, hprt0, &hprt0_modify);
396 } else { 396 } else {
397 hsotg->flags.b.port_enable_change = 1; 397 hsotg->flags.b.port_enable_change = 1;
398 if (hsotg->core_params->dma_desc_fs_enable) { 398 if (hsotg->params.dma_desc_fs_enable) {
399 u32 hcfg; 399 u32 hcfg;
400 400
401 hsotg->core_params->dma_desc_enable = 0; 401 hsotg->params.dma_desc_enable = 0;
402 hsotg->new_connection = false; 402 hsotg->new_connection = false;
403 hcfg = dwc2_readl(hsotg->regs + HCFG); 403 hcfg = dwc2_readl(hsotg->regs + HCFG);
404 hcfg &= ~HCFG_DESCDMA; 404 hcfg &= ~HCFG_DESCDMA;
@@ -604,7 +604,7 @@ static enum dwc2_halt_status dwc2_update_isoc_urb_state(
604 /* Skip whole frame */ 604 /* Skip whole frame */
605 if (chan->qh->do_split && 605 if (chan->qh->do_split &&
606 chan->ep_type == USB_ENDPOINT_XFER_ISOC && chan->ep_is_in && 606 chan->ep_type == USB_ENDPOINT_XFER_ISOC && chan->ep_is_in &&
607 hsotg->core_params->dma_enable > 0) { 607 hsotg->params.dma_enable > 0) {
608 qtd->complete_split = 0; 608 qtd->complete_split = 0;
609 qtd->isoc_split_offset = 0; 609 qtd->isoc_split_offset = 0;
610 } 610 }
@@ -743,7 +743,7 @@ cleanup:
743 dwc2_hc_cleanup(hsotg, chan); 743 dwc2_hc_cleanup(hsotg, chan);
744 list_add_tail(&chan->hc_list_entry, &hsotg->free_hc_list); 744 list_add_tail(&chan->hc_list_entry, &hsotg->free_hc_list);
745 745
746 if (hsotg->core_params->uframe_sched > 0) { 746 if (hsotg->params.uframe_sched > 0) {
747 hsotg->available_host_channels++; 747 hsotg->available_host_channels++;
748 } else { 748 } else {
749 switch (chan->ep_type) { 749 switch (chan->ep_type) {
@@ -789,7 +789,7 @@ static void dwc2_halt_channel(struct dwc2_hsotg *hsotg,
789 if (dbg_hc(chan)) 789 if (dbg_hc(chan))
790 dev_vdbg(hsotg->dev, "%s()\n", __func__); 790 dev_vdbg(hsotg->dev, "%s()\n", __func__);
791 791
792 if (hsotg->core_params->dma_enable > 0) { 792 if (hsotg->params.dma_enable > 0) {
793 if (dbg_hc(chan)) 793 if (dbg_hc(chan))
794 dev_vdbg(hsotg->dev, "DMA enabled\n"); 794 dev_vdbg(hsotg->dev, "DMA enabled\n");
795 dwc2_release_channel(hsotg, chan, qtd, halt_status); 795 dwc2_release_channel(hsotg, chan, qtd, halt_status);
@@ -974,7 +974,7 @@ static void dwc2_hc_xfercomp_intr(struct dwc2_hsotg *hsotg,
974 974
975 pipe_type = dwc2_hcd_get_pipe_type(&urb->pipe_info); 975 pipe_type = dwc2_hcd_get_pipe_type(&urb->pipe_info);
976 976
977 if (hsotg->core_params->dma_desc_enable > 0) { 977 if (hsotg->params.dma_desc_enable > 0) {
978 dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, halt_status); 978 dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, halt_status);
979 if (pipe_type == USB_ENDPOINT_XFER_ISOC) 979 if (pipe_type == USB_ENDPOINT_XFER_ISOC)
980 /* Do not disable the interrupt, just clear it */ 980 /* Do not disable the interrupt, just clear it */
@@ -985,7 +985,7 @@ static void dwc2_hc_xfercomp_intr(struct dwc2_hsotg *hsotg,
985 /* Handle xfer complete on CSPLIT */ 985 /* Handle xfer complete on CSPLIT */
986 if (chan->qh->do_split) { 986 if (chan->qh->do_split) {
987 if (chan->ep_type == USB_ENDPOINT_XFER_ISOC && chan->ep_is_in && 987 if (chan->ep_type == USB_ENDPOINT_XFER_ISOC && chan->ep_is_in &&
988 hsotg->core_params->dma_enable > 0) { 988 hsotg->params.dma_enable > 0) {
989 if (qtd->complete_split && 989 if (qtd->complete_split &&
990 dwc2_xfercomp_isoc_split_in(hsotg, chan, chnum, 990 dwc2_xfercomp_isoc_split_in(hsotg, chan, chnum,
991 qtd)) 991 qtd))
@@ -1097,7 +1097,7 @@ static void dwc2_hc_stall_intr(struct dwc2_hsotg *hsotg,
1097 dev_dbg(hsotg->dev, "--Host Channel %d Interrupt: STALL Received--\n", 1097 dev_dbg(hsotg->dev, "--Host Channel %d Interrupt: STALL Received--\n",
1098 chnum); 1098 chnum);
1099 1099
1100 if (hsotg->core_params->dma_desc_enable > 0) { 1100 if (hsotg->params.dma_desc_enable > 0) {
1101 dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, 1101 dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,
1102 DWC2_HC_XFER_STALL); 1102 DWC2_HC_XFER_STALL);
1103 goto handle_stall_done; 1103 goto handle_stall_done;
@@ -1207,7 +1207,7 @@ static void dwc2_hc_nak_intr(struct dwc2_hsotg *hsotg,
1207 switch (dwc2_hcd_get_pipe_type(&qtd->urb->pipe_info)) { 1207 switch (dwc2_hcd_get_pipe_type(&qtd->urb->pipe_info)) {
1208 case USB_ENDPOINT_XFER_CONTROL: 1208 case USB_ENDPOINT_XFER_CONTROL:
1209 case USB_ENDPOINT_XFER_BULK: 1209 case USB_ENDPOINT_XFER_BULK:
1210 if (hsotg->core_params->dma_enable > 0 && chan->ep_is_in) { 1210 if (hsotg->params.dma_enable > 0 && chan->ep_is_in) {
1211 /* 1211 /*
1212 * NAK interrupts are enabled on bulk/control IN 1212 * NAK interrupts are enabled on bulk/control IN
1213 * transfers in DMA mode for the sole purpose of 1213 * transfers in DMA mode for the sole purpose of
@@ -1353,7 +1353,7 @@ static void dwc2_hc_nyet_intr(struct dwc2_hsotg *hsotg,
1353 */ 1353 */
1354 if (chan->do_split && chan->complete_split) { 1354 if (chan->do_split && chan->complete_split) {
1355 if (chan->ep_is_in && chan->ep_type == USB_ENDPOINT_XFER_ISOC && 1355 if (chan->ep_is_in && chan->ep_type == USB_ENDPOINT_XFER_ISOC &&
1356 hsotg->core_params->dma_enable > 0) { 1356 hsotg->params.dma_enable > 0) {
1357 qtd->complete_split = 0; 1357 qtd->complete_split = 0;
1358 qtd->isoc_split_offset = 0; 1358 qtd->isoc_split_offset = 0;
1359 qtd->isoc_frame_index++; 1359 qtd->isoc_frame_index++;
@@ -1374,7 +1374,7 @@ static void dwc2_hc_nyet_intr(struct dwc2_hsotg *hsotg,
1374 struct dwc2_qh *qh = chan->qh; 1374 struct dwc2_qh *qh = chan->qh;
1375 bool past_end; 1375 bool past_end;
1376 1376
1377 if (hsotg->core_params->uframe_sched <= 0) { 1377 if (hsotg->params.uframe_sched <= 0) {
1378 int frnum = dwc2_hcd_get_frame_number(hsotg); 1378 int frnum = dwc2_hcd_get_frame_number(hsotg);
1379 1379
1380 /* Don't have num_hs_transfers; simple logic */ 1380 /* Don't have num_hs_transfers; simple logic */
@@ -1467,7 +1467,7 @@ static void dwc2_hc_babble_intr(struct dwc2_hsotg *hsotg,
1467 1467
1468 dwc2_hc_handle_tt_clear(hsotg, chan, qtd); 1468 dwc2_hc_handle_tt_clear(hsotg, chan, qtd);
1469 1469
1470 if (hsotg->core_params->dma_desc_enable > 0) { 1470 if (hsotg->params.dma_desc_enable > 0) {
1471 dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, 1471 dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,
1472 DWC2_HC_XFER_BABBLE_ERR); 1472 DWC2_HC_XFER_BABBLE_ERR);
1473 goto disable_int; 1473 goto disable_int;
@@ -1572,7 +1572,7 @@ static void dwc2_hc_ahberr_intr(struct dwc2_hsotg *hsotg,
1572 dev_err(hsotg->dev, " Interval: %d\n", urb->interval); 1572 dev_err(hsotg->dev, " Interval: %d\n", urb->interval);
1573 1573
1574 /* Core halts the channel for Descriptor DMA mode */ 1574 /* Core halts the channel for Descriptor DMA mode */
1575 if (hsotg->core_params->dma_desc_enable > 0) { 1575 if (hsotg->params.dma_desc_enable > 0) {
1576 dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, 1576 dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,
1577 DWC2_HC_XFER_AHB_ERR); 1577 DWC2_HC_XFER_AHB_ERR);
1578 goto handle_ahberr_done; 1578 goto handle_ahberr_done;
@@ -1604,7 +1604,7 @@ static void dwc2_hc_xacterr_intr(struct dwc2_hsotg *hsotg,
1604 1604
1605 dwc2_hc_handle_tt_clear(hsotg, chan, qtd); 1605 dwc2_hc_handle_tt_clear(hsotg, chan, qtd);
1606 1606
1607 if (hsotg->core_params->dma_desc_enable > 0) { 1607 if (hsotg->params.dma_desc_enable > 0) {
1608 dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, 1608 dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,
1609 DWC2_HC_XFER_XACT_ERR); 1609 DWC2_HC_XFER_XACT_ERR);
1610 goto handle_xacterr_done; 1610 goto handle_xacterr_done;
@@ -1798,8 +1798,8 @@ static void dwc2_hc_chhltd_intr_dma(struct dwc2_hsotg *hsotg,
1798 1798
1799 if (chan->halt_status == DWC2_HC_XFER_URB_DEQUEUE || 1799 if (chan->halt_status == DWC2_HC_XFER_URB_DEQUEUE ||
1800 (chan->halt_status == DWC2_HC_XFER_AHB_ERR && 1800 (chan->halt_status == DWC2_HC_XFER_AHB_ERR &&
1801 hsotg->core_params->dma_desc_enable <= 0)) { 1801 hsotg->params.dma_desc_enable <= 0)) {
1802 if (hsotg->core_params->dma_desc_enable > 0) 1802 if (hsotg->params.dma_desc_enable > 0)
1803 dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, 1803 dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,
1804 chan->halt_status); 1804 chan->halt_status);
1805 else 1805 else
@@ -1830,7 +1830,7 @@ static void dwc2_hc_chhltd_intr_dma(struct dwc2_hsotg *hsotg,
1830 } else if (chan->hcint & HCINTMSK_STALL) { 1830 } else if (chan->hcint & HCINTMSK_STALL) {
1831 dwc2_hc_stall_intr(hsotg, chan, chnum, qtd); 1831 dwc2_hc_stall_intr(hsotg, chan, chnum, qtd);
1832 } else if ((chan->hcint & HCINTMSK_XACTERR) && 1832 } else if ((chan->hcint & HCINTMSK_XACTERR) &&
1833 hsotg->core_params->dma_desc_enable <= 0) { 1833 hsotg->params.dma_desc_enable <= 0) {
1834 if (out_nak_enh) { 1834 if (out_nak_enh) {
1835 if (chan->hcint & 1835 if (chan->hcint &
1836 (HCINTMSK_NYET | HCINTMSK_NAK | HCINTMSK_ACK)) { 1836 (HCINTMSK_NYET | HCINTMSK_NAK | HCINTMSK_ACK)) {
@@ -1850,10 +1850,10 @@ static void dwc2_hc_chhltd_intr_dma(struct dwc2_hsotg *hsotg,
1850 */ 1850 */
1851 dwc2_hc_xacterr_intr(hsotg, chan, chnum, qtd); 1851 dwc2_hc_xacterr_intr(hsotg, chan, chnum, qtd);
1852 } else if ((chan->hcint & HCINTMSK_XCS_XACT) && 1852 } else if ((chan->hcint & HCINTMSK_XCS_XACT) &&
1853 hsotg->core_params->dma_desc_enable > 0) { 1853 hsotg->params.dma_desc_enable > 0) {
1854 dwc2_hc_xacterr_intr(hsotg, chan, chnum, qtd); 1854 dwc2_hc_xacterr_intr(hsotg, chan, chnum, qtd);
1855 } else if ((chan->hcint & HCINTMSK_AHBERR) && 1855 } else if ((chan->hcint & HCINTMSK_AHBERR) &&
1856 hsotg->core_params->dma_desc_enable > 0) { 1856 hsotg->params.dma_desc_enable > 0) {
1857 dwc2_hc_ahberr_intr(hsotg, chan, chnum, qtd); 1857 dwc2_hc_ahberr_intr(hsotg, chan, chnum, qtd);
1858 } else if (chan->hcint & HCINTMSK_BBLERR) { 1858 } else if (chan->hcint & HCINTMSK_BBLERR) {
1859 dwc2_hc_babble_intr(hsotg, chan, chnum, qtd); 1859 dwc2_hc_babble_intr(hsotg, chan, chnum, qtd);
@@ -1946,7 +1946,7 @@ static void dwc2_hc_chhltd_intr(struct dwc2_hsotg *hsotg,
1946 dev_vdbg(hsotg->dev, "--Host Channel %d Interrupt: Channel Halted--\n", 1946 dev_vdbg(hsotg->dev, "--Host Channel %d Interrupt: Channel Halted--\n",
1947 chnum); 1947 chnum);
1948 1948
1949 if (hsotg->core_params->dma_enable > 0) { 1949 if (hsotg->params.dma_enable > 0) {
1950 dwc2_hc_chhltd_intr_dma(hsotg, chan, chnum, qtd); 1950 dwc2_hc_chhltd_intr_dma(hsotg, chan, chnum, qtd);
1951 } else { 1951 } else {
1952 if (!dwc2_halt_status_ok(hsotg, chan, chnum, qtd)) 1952 if (!dwc2_halt_status_ok(hsotg, chan, chnum, qtd))
@@ -2023,7 +2023,7 @@ static void dwc2_hc_n_intr(struct dwc2_hsotg *hsotg, int chnum)
2023 * interrupt unmasked 2023 * interrupt unmasked
2024 */ 2024 */
2025 WARN_ON(hcint != HCINTMSK_CHHLTD); 2025 WARN_ON(hcint != HCINTMSK_CHHLTD);
2026 if (hsotg->core_params->dma_desc_enable > 0) 2026 if (hsotg->params.dma_desc_enable > 0)
2027 dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, 2027 dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum,
2028 chan->halt_status); 2028 chan->halt_status);
2029 else 2029 else
@@ -2051,7 +2051,7 @@ static void dwc2_hc_n_intr(struct dwc2_hsotg *hsotg, int chnum)
2051 qtd = list_first_entry(&chan->qh->qtd_list, struct dwc2_qtd, 2051 qtd = list_first_entry(&chan->qh->qtd_list, struct dwc2_qtd,
2052 qtd_list_entry); 2052 qtd_list_entry);
2053 2053
2054 if (hsotg->core_params->dma_enable <= 0) { 2054 if (hsotg->params.dma_enable <= 0) {
2055 if ((hcint & HCINTMSK_CHHLTD) && hcint != HCINTMSK_CHHLTD) 2055 if ((hcint & HCINTMSK_CHHLTD) && hcint != HCINTMSK_CHHLTD)
2056 hcint &= ~HCINTMSK_CHHLTD; 2056 hcint &= ~HCINTMSK_CHHLTD;
2057 } 2057 }
@@ -2156,7 +2156,7 @@ static void dwc2_hc_intr(struct dwc2_hsotg *hsotg)
2156 } 2156 }
2157 } 2157 }
2158 2158
2159 for (i = 0; i < hsotg->core_params->host_channels; i++) { 2159 for (i = 0; i < hsotg->params.host_channels; i++) {
2160 if (haint & (1 << i)) 2160 if (haint & (1 << i))
2161 dwc2_hc_n_intr(hsotg, i); 2161 dwc2_hc_n_intr(hsotg, i);
2162 } 2162 }
diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c
index 13754353251f..08293f0281dc 100644
--- a/drivers/usb/dwc2/hcd_queue.c
+++ b/drivers/usb/dwc2/hcd_queue.c
@@ -75,7 +75,7 @@ static int dwc2_periodic_channel_available(struct dwc2_hsotg *hsotg)
75 int status; 75 int status;
76 int num_channels; 76 int num_channels;
77 77
78 num_channels = hsotg->core_params->host_channels; 78 num_channels = hsotg->params.host_channels;
79 if (hsotg->periodic_channels + hsotg->non_periodic_channels < 79 if (hsotg->periodic_channels + hsotg->non_periodic_channels <
80 num_channels 80 num_channels
81 && hsotg->periodic_channels < num_channels - 1) { 81 && hsotg->periodic_channels < num_channels - 1) {
@@ -1104,7 +1104,7 @@ static void dwc2_pick_first_frame(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
1104 next_active_frame = earliest_frame; 1104 next_active_frame = earliest_frame;
1105 1105
1106 /* Get the "no microframe schduler" out of the way... */ 1106 /* Get the "no microframe schduler" out of the way... */
1107 if (hsotg->core_params->uframe_sched <= 0) { 1107 if (hsotg->params.uframe_sched <= 0) {
1108 if (qh->do_split) 1108 if (qh->do_split)
1109 /* Splits are active at microframe 0 minus 1 */ 1109 /* Splits are active at microframe 0 minus 1 */
1110 next_active_frame |= 0x7; 1110 next_active_frame |= 0x7;
@@ -1197,7 +1197,7 @@ static int dwc2_do_reserve(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
1197{ 1197{
1198 int status; 1198 int status;
1199 1199
1200 if (hsotg->core_params->uframe_sched > 0) { 1200 if (hsotg->params.uframe_sched > 0) {
1201 status = dwc2_uframe_schedule(hsotg, qh); 1201 status = dwc2_uframe_schedule(hsotg, qh);
1202 } else { 1202 } else {
1203 status = dwc2_periodic_channel_available(hsotg); 1203 status = dwc2_periodic_channel_available(hsotg);
@@ -1218,7 +1218,7 @@ static int dwc2_do_reserve(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
1218 return status; 1218 return status;
1219 } 1219 }
1220 1220
1221 if (hsotg->core_params->uframe_sched <= 0) 1221 if (hsotg->params.uframe_sched <= 0)
1222 /* Reserve periodic channel */ 1222 /* Reserve periodic channel */
1223 hsotg->periodic_channels++; 1223 hsotg->periodic_channels++;
1224 1224
@@ -1254,7 +1254,7 @@ static void dwc2_do_unreserve(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
1254 /* Update claimed usecs per (micro)frame */ 1254 /* Update claimed usecs per (micro)frame */
1255 hsotg->periodic_usecs -= qh->host_us; 1255 hsotg->periodic_usecs -= qh->host_us;
1256 1256
1257 if (hsotg->core_params->uframe_sched > 0) { 1257 if (hsotg->params.uframe_sched > 0) {
1258 dwc2_uframe_unschedule(hsotg, qh); 1258 dwc2_uframe_unschedule(hsotg, qh);
1259 } else { 1259 } else {
1260 /* Release periodic channel reservation */ 1260 /* Release periodic channel reservation */
@@ -1328,7 +1328,7 @@ static int dwc2_check_max_xfer_size(struct dwc2_hsotg *hsotg,
1328 int status = 0; 1328 int status = 0;
1329 1329
1330 max_xfer_size = dwc2_max_packet(qh->maxp) * dwc2_hb_mult(qh->maxp); 1330 max_xfer_size = dwc2_max_packet(qh->maxp) * dwc2_hb_mult(qh->maxp);
1331 max_channel_xfer_size = hsotg->core_params->max_transfer_size; 1331 max_channel_xfer_size = hsotg->params.max_transfer_size;
1332 1332
1333 if (max_xfer_size > max_channel_xfer_size) { 1333 if (max_xfer_size > max_channel_xfer_size) {
1334 dev_err(hsotg->dev, 1334 dev_err(hsotg->dev,
@@ -1391,7 +1391,7 @@ static int dwc2_schedule_periodic(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
1391 1391
1392 qh->unreserve_pending = 0; 1392 qh->unreserve_pending = 0;
1393 1393
1394 if (hsotg->core_params->dma_desc_enable > 0) 1394 if (hsotg->params.dma_desc_enable > 0)
1395 /* Don't rely on SOF and start in ready schedule */ 1395 /* Don't rely on SOF and start in ready schedule */
1396 list_add_tail(&qh->qh_list_entry, &hsotg->periodic_sched_ready); 1396 list_add_tail(&qh->qh_list_entry, &hsotg->periodic_sched_ready);
1397 else 1397 else
@@ -1599,7 +1599,7 @@ struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg,
1599 1599
1600 dwc2_qh_init(hsotg, qh, urb, mem_flags); 1600 dwc2_qh_init(hsotg, qh, urb, mem_flags);
1601 1601
1602 if (hsotg->core_params->dma_desc_enable > 0 && 1602 if (hsotg->params.dma_desc_enable > 0 &&
1603 dwc2_hcd_qh_init_ddma(hsotg, qh, mem_flags) < 0) { 1603 dwc2_hcd_qh_init_ddma(hsotg, qh, mem_flags) < 0) {
1604 dwc2_hcd_qh_free(hsotg, qh); 1604 dwc2_hcd_qh_free(hsotg, qh);
1605 return NULL; 1605 return NULL;
@@ -1711,7 +1711,7 @@ void dwc2_hcd_qh_unlink(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
1711 dwc2_deschedule_periodic(hsotg, qh); 1711 dwc2_deschedule_periodic(hsotg, qh);
1712 hsotg->periodic_qh_count--; 1712 hsotg->periodic_qh_count--;
1713 if (!hsotg->periodic_qh_count && 1713 if (!hsotg->periodic_qh_count &&
1714 hsotg->core_params->dma_desc_enable <= 0) { 1714 hsotg->params.dma_desc_enable <= 0) {
1715 intr_mask = dwc2_readl(hsotg->regs + GINTMSK); 1715 intr_mask = dwc2_readl(hsotg->regs + GINTMSK);
1716 intr_mask &= ~GINTSTS_SOF; 1716 intr_mask &= ~GINTSTS_SOF;
1717 dwc2_writel(intr_mask, hsotg->regs + GINTMSK); 1717 dwc2_writel(intr_mask, hsotg->regs + GINTMSK);
diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
index 66a827a25103..ff7c844382eb 100644
--- a/drivers/usb/dwc2/params.c
+++ b/drivers/usb/dwc2/params.c
@@ -264,7 +264,7 @@ void dwc2_set_param_otg_cap(struct dwc2_hsotg *hsotg, int val)
264 dev_dbg(hsotg->dev, "Setting otg_cap to %d\n", val); 264 dev_dbg(hsotg->dev, "Setting otg_cap to %d\n", val);
265 } 265 }
266 266
267 hsotg->core_params->otg_cap = val; 267 hsotg->params.otg_cap = val;
268} 268}
269 269
270void dwc2_set_param_dma_enable(struct dwc2_hsotg *hsotg, int val) 270void dwc2_set_param_dma_enable(struct dwc2_hsotg *hsotg, int val)
@@ -285,14 +285,14 @@ void dwc2_set_param_dma_enable(struct dwc2_hsotg *hsotg, int val)
285 dev_dbg(hsotg->dev, "Setting dma_enable to %d\n", val); 285 dev_dbg(hsotg->dev, "Setting dma_enable to %d\n", val);
286 } 286 }
287 287
288 hsotg->core_params->dma_enable = val; 288 hsotg->params.dma_enable = val;
289} 289}
290 290
291void dwc2_set_param_dma_desc_enable(struct dwc2_hsotg *hsotg, int val) 291void dwc2_set_param_dma_desc_enable(struct dwc2_hsotg *hsotg, int val)
292{ 292{
293 int valid = 1; 293 int valid = 1;
294 294
295 if (val > 0 && (hsotg->core_params->dma_enable <= 0 || 295 if (val > 0 && (hsotg->params.dma_enable <= 0 ||
296 !hsotg->hw_params.dma_desc_enable)) 296 !hsotg->hw_params.dma_desc_enable))
297 valid = 0; 297 valid = 0;
298 if (val < 0) 298 if (val < 0)
@@ -303,19 +303,19 @@ void dwc2_set_param_dma_desc_enable(struct dwc2_hsotg *hsotg, int val)
303 dev_err(hsotg->dev, 303 dev_err(hsotg->dev,
304 "%d invalid for dma_desc_enable parameter. Check HW configuration.\n", 304 "%d invalid for dma_desc_enable parameter. Check HW configuration.\n",
305 val); 305 val);
306 val = (hsotg->core_params->dma_enable > 0 && 306 val = (hsotg->params.dma_enable > 0 &&
307 hsotg->hw_params.dma_desc_enable); 307 hsotg->hw_params.dma_desc_enable);
308 dev_dbg(hsotg->dev, "Setting dma_desc_enable to %d\n", val); 308 dev_dbg(hsotg->dev, "Setting dma_desc_enable to %d\n", val);
309 } 309 }
310 310
311 hsotg->core_params->dma_desc_enable = val; 311 hsotg->params.dma_desc_enable = val;
312} 312}
313 313
314void dwc2_set_param_dma_desc_fs_enable(struct dwc2_hsotg *hsotg, int val) 314void dwc2_set_param_dma_desc_fs_enable(struct dwc2_hsotg *hsotg, int val)
315{ 315{
316 int valid = 1; 316 int valid = 1;
317 317
318 if (val > 0 && (hsotg->core_params->dma_enable <= 0 || 318 if (val > 0 && (hsotg->params.dma_enable <= 0 ||
319 !hsotg->hw_params.dma_desc_enable)) 319 !hsotg->hw_params.dma_desc_enable))
320 valid = 0; 320 valid = 0;
321 if (val < 0) 321 if (val < 0)
@@ -326,11 +326,11 @@ void dwc2_set_param_dma_desc_fs_enable(struct dwc2_hsotg *hsotg, int val)
326 dev_err(hsotg->dev, 326 dev_err(hsotg->dev,
327 "%d invalid for dma_desc_fs_enable parameter. Check HW configuration.\n", 327 "%d invalid for dma_desc_fs_enable parameter. Check HW configuration.\n",
328 val); 328 val);
329 val = (hsotg->core_params->dma_enable > 0 && 329 val = (hsotg->params.dma_enable > 0 &&
330 hsotg->hw_params.dma_desc_enable); 330 hsotg->hw_params.dma_desc_enable);
331 } 331 }
332 332
333 hsotg->core_params->dma_desc_fs_enable = val; 333 hsotg->params.dma_desc_fs_enable = val;
334 dev_dbg(hsotg->dev, "Setting dma_desc_fs_enable to %d\n", val); 334 dev_dbg(hsotg->dev, "Setting dma_desc_fs_enable to %d\n", val);
335} 335}
336 336
@@ -349,7 +349,7 @@ void dwc2_set_param_host_support_fs_ls_low_power(struct dwc2_hsotg *hsotg,
349 "Setting host_support_fs_low_power to %d\n", val); 349 "Setting host_support_fs_low_power to %d\n", val);
350 } 350 }
351 351
352 hsotg->core_params->host_support_fs_ls_low_power = val; 352 hsotg->params.host_support_fs_ls_low_power = val;
353} 353}
354 354
355void dwc2_set_param_enable_dynamic_fifo(struct dwc2_hsotg *hsotg, int val) 355void dwc2_set_param_enable_dynamic_fifo(struct dwc2_hsotg *hsotg, int val)
@@ -370,7 +370,7 @@ void dwc2_set_param_enable_dynamic_fifo(struct dwc2_hsotg *hsotg, int val)
370 dev_dbg(hsotg->dev, "Setting enable_dynamic_fifo to %d\n", val); 370 dev_dbg(hsotg->dev, "Setting enable_dynamic_fifo to %d\n", val);
371 } 371 }
372 372
373 hsotg->core_params->enable_dynamic_fifo = val; 373 hsotg->params.enable_dynamic_fifo = val;
374} 374}
375 375
376void dwc2_set_param_host_rx_fifo_size(struct dwc2_hsotg *hsotg, int val) 376void dwc2_set_param_host_rx_fifo_size(struct dwc2_hsotg *hsotg, int val)
@@ -389,7 +389,7 @@ void dwc2_set_param_host_rx_fifo_size(struct dwc2_hsotg *hsotg, int val)
389 dev_dbg(hsotg->dev, "Setting host_rx_fifo_size to %d\n", val); 389 dev_dbg(hsotg->dev, "Setting host_rx_fifo_size to %d\n", val);
390 } 390 }
391 391
392 hsotg->core_params->host_rx_fifo_size = val; 392 hsotg->params.host_rx_fifo_size = val;
393} 393}
394 394
395void dwc2_set_param_host_nperio_tx_fifo_size(struct dwc2_hsotg *hsotg, int val) 395void dwc2_set_param_host_nperio_tx_fifo_size(struct dwc2_hsotg *hsotg, int val)
@@ -409,7 +409,7 @@ void dwc2_set_param_host_nperio_tx_fifo_size(struct dwc2_hsotg *hsotg, int val)
409 val); 409 val);
410 } 410 }
411 411
412 hsotg->core_params->host_nperio_tx_fifo_size = val; 412 hsotg->params.host_nperio_tx_fifo_size = val;
413} 413}
414 414
415void dwc2_set_param_host_perio_tx_fifo_size(struct dwc2_hsotg *hsotg, int val) 415void dwc2_set_param_host_perio_tx_fifo_size(struct dwc2_hsotg *hsotg, int val)
@@ -429,7 +429,7 @@ void dwc2_set_param_host_perio_tx_fifo_size(struct dwc2_hsotg *hsotg, int val)
429 val); 429 val);
430 } 430 }
431 431
432 hsotg->core_params->host_perio_tx_fifo_size = val; 432 hsotg->params.host_perio_tx_fifo_size = val;
433} 433}
434 434
435void dwc2_set_param_max_transfer_size(struct dwc2_hsotg *hsotg, int val) 435void dwc2_set_param_max_transfer_size(struct dwc2_hsotg *hsotg, int val)
@@ -448,7 +448,7 @@ void dwc2_set_param_max_transfer_size(struct dwc2_hsotg *hsotg, int val)
448 dev_dbg(hsotg->dev, "Setting max_transfer_size to %d\n", val); 448 dev_dbg(hsotg->dev, "Setting max_transfer_size to %d\n", val);
449 } 449 }
450 450
451 hsotg->core_params->max_transfer_size = val; 451 hsotg->params.max_transfer_size = val;
452} 452}
453 453
454void dwc2_set_param_max_packet_count(struct dwc2_hsotg *hsotg, int val) 454void dwc2_set_param_max_packet_count(struct dwc2_hsotg *hsotg, int val)
@@ -467,7 +467,7 @@ void dwc2_set_param_max_packet_count(struct dwc2_hsotg *hsotg, int val)
467 dev_dbg(hsotg->dev, "Setting max_packet_count to %d\n", val); 467 dev_dbg(hsotg->dev, "Setting max_packet_count to %d\n", val);
468 } 468 }
469 469
470 hsotg->core_params->max_packet_count = val; 470 hsotg->params.max_packet_count = val;
471} 471}
472 472
473void dwc2_set_param_host_channels(struct dwc2_hsotg *hsotg, int val) 473void dwc2_set_param_host_channels(struct dwc2_hsotg *hsotg, int val)
@@ -486,7 +486,7 @@ void dwc2_set_param_host_channels(struct dwc2_hsotg *hsotg, int val)
486 dev_dbg(hsotg->dev, "Setting host_channels to %d\n", val); 486 dev_dbg(hsotg->dev, "Setting host_channels to %d\n", val);
487 } 487 }
488 488
489 hsotg->core_params->host_channels = val; 489 hsotg->params.host_channels = val;
490} 490}
491 491
492void dwc2_set_param_phy_type(struct dwc2_hsotg *hsotg, int val) 492void dwc2_set_param_phy_type(struct dwc2_hsotg *hsotg, int val)
@@ -534,12 +534,12 @@ void dwc2_set_param_phy_type(struct dwc2_hsotg *hsotg, int val)
534 dev_dbg(hsotg->dev, "Setting phy_type to %d\n", val); 534 dev_dbg(hsotg->dev, "Setting phy_type to %d\n", val);
535 } 535 }
536 536
537 hsotg->core_params->phy_type = val; 537 hsotg->params.phy_type = val;
538} 538}
539 539
540static int dwc2_get_param_phy_type(struct dwc2_hsotg *hsotg) 540static int dwc2_get_param_phy_type(struct dwc2_hsotg *hsotg)
541{ 541{
542 return hsotg->core_params->phy_type; 542 return hsotg->params.phy_type;
543} 543}
544 544
545void dwc2_set_param_speed(struct dwc2_hsotg *hsotg, int val) 545void dwc2_set_param_speed(struct dwc2_hsotg *hsotg, int val)
@@ -568,7 +568,7 @@ void dwc2_set_param_speed(struct dwc2_hsotg *hsotg, int val)
568 dev_dbg(hsotg->dev, "Setting speed to %d\n", val); 568 dev_dbg(hsotg->dev, "Setting speed to %d\n", val);
569 } 569 }
570 570
571 hsotg->core_params->speed = val; 571 hsotg->params.speed = val;
572} 572}
573 573
574void dwc2_set_param_host_ls_low_power_phy_clk(struct dwc2_hsotg *hsotg, int val) 574void dwc2_set_param_host_ls_low_power_phy_clk(struct dwc2_hsotg *hsotg, int val)
@@ -602,7 +602,7 @@ void dwc2_set_param_host_ls_low_power_phy_clk(struct dwc2_hsotg *hsotg, int val)
602 val); 602 val);
603 } 603 }
604 604
605 hsotg->core_params->host_ls_low_power_phy_clk = val; 605 hsotg->params.host_ls_low_power_phy_clk = val;
606} 606}
607 607
608void dwc2_set_param_phy_ulpi_ddr(struct dwc2_hsotg *hsotg, int val) 608void dwc2_set_param_phy_ulpi_ddr(struct dwc2_hsotg *hsotg, int val)
@@ -616,7 +616,7 @@ void dwc2_set_param_phy_ulpi_ddr(struct dwc2_hsotg *hsotg, int val)
616 dev_dbg(hsotg->dev, "Setting phy_upli_ddr to %d\n", val); 616 dev_dbg(hsotg->dev, "Setting phy_upli_ddr to %d\n", val);
617 } 617 }
618 618
619 hsotg->core_params->phy_ulpi_ddr = val; 619 hsotg->params.phy_ulpi_ddr = val;
620} 620}
621 621
622void dwc2_set_param_phy_ulpi_ext_vbus(struct dwc2_hsotg *hsotg, int val) 622void dwc2_set_param_phy_ulpi_ext_vbus(struct dwc2_hsotg *hsotg, int val)
@@ -632,7 +632,7 @@ void dwc2_set_param_phy_ulpi_ext_vbus(struct dwc2_hsotg *hsotg, int val)
632 dev_dbg(hsotg->dev, "Setting phy_ulpi_ext_vbus to %d\n", val); 632 dev_dbg(hsotg->dev, "Setting phy_ulpi_ext_vbus to %d\n", val);
633 } 633 }
634 634
635 hsotg->core_params->phy_ulpi_ext_vbus = val; 635 hsotg->params.phy_ulpi_ext_vbus = val;
636} 636}
637 637
638void dwc2_set_param_phy_utmi_width(struct dwc2_hsotg *hsotg, int val) 638void dwc2_set_param_phy_utmi_width(struct dwc2_hsotg *hsotg, int val)
@@ -662,7 +662,7 @@ void dwc2_set_param_phy_utmi_width(struct dwc2_hsotg *hsotg, int val)
662 dev_dbg(hsotg->dev, "Setting phy_utmi_width to %d\n", val); 662 dev_dbg(hsotg->dev, "Setting phy_utmi_width to %d\n", val);
663 } 663 }
664 664
665 hsotg->core_params->phy_utmi_width = val; 665 hsotg->params.phy_utmi_width = val;
666} 666}
667 667
668void dwc2_set_param_ulpi_fs_ls(struct dwc2_hsotg *hsotg, int val) 668void dwc2_set_param_ulpi_fs_ls(struct dwc2_hsotg *hsotg, int val)
@@ -676,7 +676,7 @@ void dwc2_set_param_ulpi_fs_ls(struct dwc2_hsotg *hsotg, int val)
676 dev_dbg(hsotg->dev, "Setting ulpi_fs_ls to %d\n", val); 676 dev_dbg(hsotg->dev, "Setting ulpi_fs_ls to %d\n", val);
677 } 677 }
678 678
679 hsotg->core_params->ulpi_fs_ls = val; 679 hsotg->params.ulpi_fs_ls = val;
680} 680}
681 681
682void dwc2_set_param_ts_dline(struct dwc2_hsotg *hsotg, int val) 682void dwc2_set_param_ts_dline(struct dwc2_hsotg *hsotg, int val)
@@ -690,7 +690,7 @@ void dwc2_set_param_ts_dline(struct dwc2_hsotg *hsotg, int val)
690 dev_dbg(hsotg->dev, "Setting ts_dline to %d\n", val); 690 dev_dbg(hsotg->dev, "Setting ts_dline to %d\n", val);
691 } 691 }
692 692
693 hsotg->core_params->ts_dline = val; 693 hsotg->params.ts_dline = val;
694} 694}
695 695
696void dwc2_set_param_i2c_enable(struct dwc2_hsotg *hsotg, int val) 696void dwc2_set_param_i2c_enable(struct dwc2_hsotg *hsotg, int val)
@@ -718,7 +718,7 @@ void dwc2_set_param_i2c_enable(struct dwc2_hsotg *hsotg, int val)
718 dev_dbg(hsotg->dev, "Setting i2c_enable to %d\n", val); 718 dev_dbg(hsotg->dev, "Setting i2c_enable to %d\n", val);
719 } 719 }
720 720
721 hsotg->core_params->i2c_enable = val; 721 hsotg->params.i2c_enable = val;
722} 722}
723 723
724void dwc2_set_param_en_multiple_tx_fifo(struct dwc2_hsotg *hsotg, int val) 724void dwc2_set_param_en_multiple_tx_fifo(struct dwc2_hsotg *hsotg, int val)
@@ -747,7 +747,7 @@ void dwc2_set_param_en_multiple_tx_fifo(struct dwc2_hsotg *hsotg, int val)
747 dev_dbg(hsotg->dev, "Setting en_multiple_tx_fifo to %d\n", val); 747 dev_dbg(hsotg->dev, "Setting en_multiple_tx_fifo to %d\n", val);
748 } 748 }
749 749
750 hsotg->core_params->en_multiple_tx_fifo = val; 750 hsotg->params.en_multiple_tx_fifo = val;
751} 751}
752 752
753void dwc2_set_param_reload_ctl(struct dwc2_hsotg *hsotg, int val) 753void dwc2_set_param_reload_ctl(struct dwc2_hsotg *hsotg, int val)
@@ -775,15 +775,15 @@ void dwc2_set_param_reload_ctl(struct dwc2_hsotg *hsotg, int val)
775 dev_dbg(hsotg->dev, "Setting reload_ctl to %d\n", val); 775 dev_dbg(hsotg->dev, "Setting reload_ctl to %d\n", val);
776 } 776 }
777 777
778 hsotg->core_params->reload_ctl = val; 778 hsotg->params.reload_ctl = val;
779} 779}
780 780
781void dwc2_set_param_ahbcfg(struct dwc2_hsotg *hsotg, int val) 781void dwc2_set_param_ahbcfg(struct dwc2_hsotg *hsotg, int val)
782{ 782{
783 if (val != -1) 783 if (val != -1)
784 hsotg->core_params->ahbcfg = val; 784 hsotg->params.ahbcfg = val;
785 else 785 else
786 hsotg->core_params->ahbcfg = GAHBCFG_HBSTLEN_INCR4 << 786 hsotg->params.ahbcfg = GAHBCFG_HBSTLEN_INCR4 <<
787 GAHBCFG_HBSTLEN_SHIFT; 787 GAHBCFG_HBSTLEN_SHIFT;
788} 788}
789 789
@@ -800,7 +800,7 @@ void dwc2_set_param_otg_ver(struct dwc2_hsotg *hsotg, int val)
800 dev_dbg(hsotg->dev, "Setting otg_ver to %d\n", val); 800 dev_dbg(hsotg->dev, "Setting otg_ver to %d\n", val);
801 } 801 }
802 802
803 hsotg->core_params->otg_ver = val; 803 hsotg->params.otg_ver = val;
804} 804}
805 805
806static void dwc2_set_param_uframe_sched(struct dwc2_hsotg *hsotg, int val) 806static void dwc2_set_param_uframe_sched(struct dwc2_hsotg *hsotg, int val)
@@ -816,7 +816,7 @@ static void dwc2_set_param_uframe_sched(struct dwc2_hsotg *hsotg, int val)
816 dev_dbg(hsotg->dev, "Setting uframe_sched to %d\n", val); 816 dev_dbg(hsotg->dev, "Setting uframe_sched to %d\n", val);
817 } 817 }
818 818
819 hsotg->core_params->uframe_sched = val; 819 hsotg->params.uframe_sched = val;
820} 820}
821 821
822static void dwc2_set_param_external_id_pin_ctl(struct dwc2_hsotg *hsotg, 822static void dwc2_set_param_external_id_pin_ctl(struct dwc2_hsotg *hsotg,
@@ -833,7 +833,7 @@ static void dwc2_set_param_external_id_pin_ctl(struct dwc2_hsotg *hsotg,
833 dev_dbg(hsotg->dev, "Setting external_id_pin_ctl to %d\n", val); 833 dev_dbg(hsotg->dev, "Setting external_id_pin_ctl to %d\n", val);
834 } 834 }
835 835
836 hsotg->core_params->external_id_pin_ctl = val; 836 hsotg->params.external_id_pin_ctl = val;
837} 837}
838 838
839static void dwc2_set_param_hibernation(struct dwc2_hsotg *hsotg, 839static void dwc2_set_param_hibernation(struct dwc2_hsotg *hsotg,
@@ -850,7 +850,7 @@ static void dwc2_set_param_hibernation(struct dwc2_hsotg *hsotg,
850 dev_dbg(hsotg->dev, "Setting hibernation to %d\n", val); 850 dev_dbg(hsotg->dev, "Setting hibernation to %d\n", val);
851 } 851 }
852 852
853 hsotg->core_params->hibernation = val; 853 hsotg->params.hibernation = val;
854} 854}
855 855
856/* 856/*
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index c4b855b4e783..d335e3644c6f 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -418,12 +418,7 @@ static int dwc2_driver_probe(struct platform_device *dev)
418 418
419 spin_lock_init(&hsotg->lock); 419 spin_lock_init(&hsotg->lock);
420 420
421 hsotg->core_params = devm_kzalloc(&dev->dev, 421 dwc2_set_all_params(&hsotg->params, -1);
422 sizeof(*hsotg->core_params), GFP_KERNEL);
423 if (!hsotg->core_params)
424 return -ENOMEM;
425
426 dwc2_set_all_params(hsotg->core_params, -1);
427 422
428 hsotg->irq = platform_get_irq(dev, 0); 423 hsotg->irq = platform_get_irq(dev, 0);
429 if (hsotg->irq < 0) { 424 if (hsotg->irq < 0) {