Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: dwc2: Modify dwc2_readl/writel functions prototype

Added hsotg argument to dwc2_readl/writel function prototype,
and also instead of address pass offset of register.
hsotg will contain flag field for endianness.

Also customized dwc2_set_bit and dwc2_clear_bit function for
dwc2_readl/writel functions.

Signed-off-by: Gevorg Sahakyan <sahakyan@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>

authored by

Gevorg Sahakyan and committed by
Felipe Balbi
f25c42b8 c31d983b

+776 -780
+121 -120
drivers/usb/dwc2/core.c
··· 73 73 /* Backup global regs */ 74 74 gr = &hsotg->gr_backup; 75 75 76 - gr->gotgctl = dwc2_readl(hsotg->regs + GOTGCTL); 77 - gr->gintmsk = dwc2_readl(hsotg->regs + GINTMSK); 78 - gr->gahbcfg = dwc2_readl(hsotg->regs + GAHBCFG); 79 - gr->gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 80 - gr->grxfsiz = dwc2_readl(hsotg->regs + GRXFSIZ); 81 - gr->gnptxfsiz = dwc2_readl(hsotg->regs + GNPTXFSIZ); 82 - gr->gdfifocfg = dwc2_readl(hsotg->regs + GDFIFOCFG); 83 - gr->pcgcctl1 = dwc2_readl(hsotg->regs + PCGCCTL1); 84 - gr->glpmcfg = dwc2_readl(hsotg->regs + GLPMCFG); 85 - gr->gi2cctl = dwc2_readl(hsotg->regs + GI2CCTL); 86 - gr->pcgcctl = dwc2_readl(hsotg->regs + PCGCTL); 76 + gr->gotgctl = dwc2_readl(hsotg, GOTGCTL); 77 + gr->gintmsk = dwc2_readl(hsotg, GINTMSK); 78 + gr->gahbcfg = dwc2_readl(hsotg, GAHBCFG); 79 + gr->gusbcfg = dwc2_readl(hsotg, GUSBCFG); 80 + gr->grxfsiz = dwc2_readl(hsotg, GRXFSIZ); 81 + gr->gnptxfsiz = dwc2_readl(hsotg, GNPTXFSIZ); 82 + gr->gdfifocfg = dwc2_readl(hsotg, GDFIFOCFG); 83 + gr->pcgcctl1 = dwc2_readl(hsotg, PCGCCTL1); 84 + gr->glpmcfg = dwc2_readl(hsotg, GLPMCFG); 85 + gr->gi2cctl = dwc2_readl(hsotg, GI2CCTL); 86 + gr->pcgcctl = dwc2_readl(hsotg, PCGCTL); 87 87 88 88 gr->valid = true; 89 89 return 0; ··· 111 111 } 112 112 gr->valid = false; 113 113 114 - dwc2_writel(0xffffffff, hsotg->regs + GINTSTS); 115 - dwc2_writel(gr->gotgctl, hsotg->regs + GOTGCTL); 116 - dwc2_writel(gr->gintmsk, hsotg->regs + GINTMSK); 117 - dwc2_writel(gr->gusbcfg, hsotg->regs + GUSBCFG); 118 - dwc2_writel(gr->gahbcfg, hsotg->regs + GAHBCFG); 119 - dwc2_writel(gr->grxfsiz, hsotg->regs + GRXFSIZ); 120 - dwc2_writel(gr->gnptxfsiz, hsotg->regs + GNPTXFSIZ); 121 - dwc2_writel(gr->gdfifocfg, hsotg->regs + GDFIFOCFG); 122 - dwc2_writel(gr->pcgcctl1, hsotg->regs + PCGCCTL1); 123 - dwc2_writel(gr->glpmcfg, hsotg->regs + GLPMCFG); 124 - dwc2_writel(gr->pcgcctl, hsotg->regs + PCGCTL); 125 - dwc2_writel(gr->gi2cctl, hsotg->regs + GI2CCTL); 114 + dwc2_writel(hsotg, 0xffffffff, GINTSTS); 115 + dwc2_writel(hsotg, gr->gotgctl, GOTGCTL); 116 + dwc2_writel(hsotg, gr->gintmsk, GINTMSK); 117 + dwc2_writel(hsotg, gr->gusbcfg, GUSBCFG); 118 + dwc2_writel(hsotg, gr->gahbcfg, GAHBCFG); 119 + dwc2_writel(hsotg, gr->grxfsiz, GRXFSIZ); 120 + dwc2_writel(hsotg, gr->gnptxfsiz, GNPTXFSIZ); 121 + dwc2_writel(hsotg, gr->gdfifocfg, GDFIFOCFG); 122 + dwc2_writel(hsotg, gr->pcgcctl1, PCGCCTL1); 123 + dwc2_writel(hsotg, gr->glpmcfg, GLPMCFG); 124 + dwc2_writel(hsotg, gr->pcgcctl, PCGCTL); 125 + dwc2_writel(hsotg, gr->gi2cctl, GI2CCTL); 126 126 127 127 return 0; 128 128 } ··· 141 141 if (hsotg->params.power_down != DWC2_POWER_DOWN_PARAM_PARTIAL) 142 142 return -ENOTSUPP; 143 143 144 - pcgcctl = dwc2_readl(hsotg->regs + PCGCTL); 144 + pcgcctl = dwc2_readl(hsotg, PCGCTL); 145 145 pcgcctl &= ~PCGCTL_STOPPCLK; 146 - dwc2_writel(pcgcctl, hsotg->regs + PCGCTL); 146 + dwc2_writel(hsotg, pcgcctl, PCGCTL); 147 147 148 - pcgcctl = dwc2_readl(hsotg->regs + PCGCTL); 148 + pcgcctl = dwc2_readl(hsotg, PCGCTL); 149 149 pcgcctl &= ~PCGCTL_PWRCLMP; 150 - dwc2_writel(pcgcctl, hsotg->regs + PCGCTL); 150 + dwc2_writel(hsotg, pcgcctl, PCGCTL); 151 151 152 - pcgcctl = dwc2_readl(hsotg->regs + PCGCTL); 152 + pcgcctl = dwc2_readl(hsotg, PCGCTL); 153 153 pcgcctl &= ~PCGCTL_RSTPDWNMODULE; 154 - dwc2_writel(pcgcctl, hsotg->regs + PCGCTL); 154 + dwc2_writel(hsotg, pcgcctl, PCGCTL); 155 155 156 156 udelay(100); 157 157 if (restore) { ··· 222 222 * Clear any pending interrupts since dwc2 will not be able to 223 223 * clear them after entering partial_power_down. 224 224 */ 225 - dwc2_writel(0xffffffff, hsotg->regs + GINTSTS); 225 + dwc2_writel(hsotg, 0xffffffff, GINTSTS); 226 226 227 227 /* Put the controller in low power state */ 228 - pcgcctl = dwc2_readl(hsotg->regs + PCGCTL); 228 + pcgcctl = dwc2_readl(hsotg, PCGCTL); 229 229 230 230 pcgcctl |= PCGCTL_PWRCLMP; 231 - dwc2_writel(pcgcctl, hsotg->regs + PCGCTL); 231 + dwc2_writel(hsotg, pcgcctl, PCGCTL); 232 232 ndelay(20); 233 233 234 234 pcgcctl |= PCGCTL_RSTPDWNMODULE; 235 - dwc2_writel(pcgcctl, hsotg->regs + PCGCTL); 235 + dwc2_writel(hsotg, pcgcctl, PCGCTL); 236 236 ndelay(20); 237 237 238 238 pcgcctl |= PCGCTL_STOPPCLK; 239 - dwc2_writel(pcgcctl, hsotg->regs + PCGCTL); 239 + dwc2_writel(hsotg, pcgcctl, PCGCTL); 240 240 241 241 return ret; 242 242 } ··· 272 272 if (!(pcgcctl & PCGCTL_P2HD_DEV_ENUM_SPD_MASK)) 273 273 pcgcctl |= BIT(17); 274 274 } 275 - dwc2_writel(pcgcctl, hsotg->regs + PCGCTL); 275 + dwc2_writel(hsotg, pcgcctl, PCGCTL); 276 276 277 277 /* Umnask global Interrupt in GAHBCFG and restore it */ 278 - dwc2_writel(gr->gahbcfg | GAHBCFG_GLBL_INTR_EN, hsotg->regs + GAHBCFG); 278 + dwc2_writel(hsotg, gr->gahbcfg | GAHBCFG_GLBL_INTR_EN, GAHBCFG); 279 279 280 280 /* Clear all pending interupts */ 281 - dwc2_writel(0xffffffff, hsotg->regs + GINTSTS); 281 + dwc2_writel(hsotg, 0xffffffff, GINTSTS); 282 282 283 283 /* Unmask restore done interrupt */ 284 - dwc2_writel(GINTSTS_RESTOREDONE, hsotg->regs + GINTMSK); 284 + dwc2_writel(hsotg, GINTSTS_RESTOREDONE, GINTMSK); 285 285 286 286 /* Restore GUSBCFG and HCFG/DCFG */ 287 - dwc2_writel(gr->gusbcfg, hsotg->regs + GUSBCFG); 287 + dwc2_writel(hsotg, gr->gusbcfg, GUSBCFG); 288 288 289 289 if (is_host) { 290 - dwc2_writel(hr->hcfg, hsotg->regs + HCFG); 290 + dwc2_writel(hsotg, hr->hcfg, HCFG); 291 291 if (rmode) 292 292 pcgcctl |= PCGCTL_RESTOREMODE; 293 - dwc2_writel(pcgcctl, hsotg->regs + PCGCTL); 293 + dwc2_writel(hsotg, pcgcctl, PCGCTL); 294 294 udelay(10); 295 295 296 296 pcgcctl |= PCGCTL_ESS_REG_RESTORED; 297 - dwc2_writel(pcgcctl, hsotg->regs + PCGCTL); 297 + dwc2_writel(hsotg, pcgcctl, PCGCTL); 298 298 udelay(10); 299 299 } else { 300 - dwc2_writel(dr->dcfg, hsotg->regs + DCFG); 300 + dwc2_writel(hsotg, dr->dcfg, DCFG); 301 301 if (!rmode) 302 302 pcgcctl |= PCGCTL_RESTOREMODE | PCGCTL_RSTPDWNMODULE; 303 - dwc2_writel(pcgcctl, hsotg->regs + PCGCTL); 303 + dwc2_writel(hsotg, pcgcctl, PCGCTL); 304 304 udelay(10); 305 305 306 306 pcgcctl |= PCGCTL_ESS_REG_RESTORED; 307 - dwc2_writel(pcgcctl, hsotg->regs + PCGCTL); 307 + dwc2_writel(hsotg, pcgcctl, PCGCTL); 308 308 udelay(10); 309 309 } 310 310 } ··· 322 322 u32 gpwrdn; 323 323 324 324 /* Switch-on voltage to the core */ 325 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 325 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 326 326 gpwrdn &= ~GPWRDN_PWRDNSWTCH; 327 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 327 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 328 328 udelay(10); 329 329 330 330 /* Reset core */ 331 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 331 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 332 332 gpwrdn &= ~GPWRDN_PWRDNRSTN; 333 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 333 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 334 334 udelay(10); 335 335 336 336 /* Enable restore from PMU */ 337 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 337 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 338 338 gpwrdn |= GPWRDN_RESTORE; 339 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 339 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 340 340 udelay(10); 341 341 342 342 /* Disable Power Down Clamp */ 343 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 343 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 344 344 gpwrdn &= ~GPWRDN_PWRDNCLMP; 345 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 345 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 346 346 udelay(50); 347 347 348 348 if (!is_host && rem_wakeup) 349 349 udelay(70); 350 350 351 351 /* Deassert reset core */ 352 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 352 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 353 353 gpwrdn |= GPWRDN_PWRDNRSTN; 354 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 354 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 355 355 udelay(10); 356 356 357 357 /* Disable PMU interrupt */ 358 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 358 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 359 359 gpwrdn &= ~GPWRDN_PMUINTSEL; 360 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 360 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 361 361 udelay(10); 362 362 363 363 /* Set Restore Essential Regs bit in PCGCCTL register */ ··· 431 431 return false; 432 432 433 433 /* Check if core configuration includes the IDDIG filter. */ 434 - ghwcfg4 = dwc2_readl(hsotg->regs + GHWCFG4); 434 + ghwcfg4 = dwc2_readl(hsotg, GHWCFG4); 435 435 if (!(ghwcfg4 & GHWCFG4_IDDIG_FILT_EN)) 436 436 return false; 437 437 ··· 439 439 * Check if the IDDIG debounce filter is bypassed. Available 440 440 * in core version >= 3.10a. 441 441 */ 442 - gsnpsid = dwc2_readl(hsotg->regs + GSNPSID); 442 + gsnpsid = dwc2_readl(hsotg, GSNPSID); 443 443 if (gsnpsid >= DWC2_CORE_REV_3_10a) { 444 - u32 gotgctl = dwc2_readl(hsotg->regs + GOTGCTL); 444 + u32 gotgctl = dwc2_readl(hsotg, GOTGCTL); 445 445 446 446 if (gotgctl & GOTGCTL_DBNCE_FLTR_BYPASS) 447 447 return false; ··· 510 510 * reset and account for this delay after the reset. 511 511 */ 512 512 if (dwc2_iddig_filter_enabled(hsotg)) { 513 - u32 gotgctl = dwc2_readl(hsotg->regs + GOTGCTL); 514 - u32 gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 513 + u32 gotgctl = dwc2_readl(hsotg, GOTGCTL); 514 + u32 gusbcfg = dwc2_readl(hsotg, GUSBCFG); 515 515 516 516 if (!(gotgctl & GOTGCTL_CONID_B) || 517 517 (gusbcfg & GUSBCFG_FORCEHOSTMODE)) { ··· 520 520 } 521 521 522 522 /* Core Soft Reset */ 523 - greset = dwc2_readl(hsotg->regs + GRSTCTL); 523 + greset = dwc2_readl(hsotg, GRSTCTL); 524 524 greset |= GRSTCTL_CSFTRST; 525 - dwc2_writel(greset, hsotg->regs + GRSTCTL); 525 + dwc2_writel(hsotg, greset, GRSTCTL); 526 526 527 527 if (dwc2_hsotg_wait_bit_clear(hsotg, GRSTCTL, GRSTCTL_CSFTRST, 50)) { 528 528 dev_warn(hsotg->dev, "%s: HANG! Soft Reset timeout GRSTCTL GRSTCTL_CSFTRST\n", ··· 594 594 if (WARN_ON(!host && hsotg->dr_mode == USB_DR_MODE_HOST)) 595 595 return; 596 596 597 - gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 597 + gusbcfg = dwc2_readl(hsotg, GUSBCFG); 598 598 599 599 set = host ? GUSBCFG_FORCEHOSTMODE : GUSBCFG_FORCEDEVMODE; 600 600 clear = host ? GUSBCFG_FORCEDEVMODE : GUSBCFG_FORCEHOSTMODE; 601 601 602 602 gusbcfg &= ~clear; 603 603 gusbcfg |= set; 604 - dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG); 604 + dwc2_writel(hsotg, gusbcfg, GUSBCFG); 605 605 606 606 dwc2_wait_for_mode(hsotg, host); 607 607 return; ··· 627 627 628 628 dev_dbg(hsotg->dev, "Clearing force mode bits\n"); 629 629 630 - gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 630 + gusbcfg = dwc2_readl(hsotg, GUSBCFG); 631 631 gusbcfg &= ~GUSBCFG_FORCEHOSTMODE; 632 632 gusbcfg &= ~GUSBCFG_FORCEDEVMODE; 633 - dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG); 633 + dwc2_writel(hsotg, gusbcfg, GUSBCFG); 634 634 635 635 if (dwc2_iddig_filter_enabled(hsotg)) 636 636 msleep(100); ··· 670 670 void dwc2_enable_acg(struct dwc2_hsotg *hsotg) 671 671 { 672 672 if (hsotg->params.acg_enable) { 673 - u32 pcgcctl1 = dwc2_readl(hsotg->regs + PCGCCTL1); 673 + u32 pcgcctl1 = dwc2_readl(hsotg, PCGCCTL1); 674 674 675 675 dev_dbg(hsotg->dev, "Enabling Active Clock Gating\n"); 676 676 pcgcctl1 |= PCGCCTL1_GATEEN; 677 - dwc2_writel(pcgcctl1, hsotg->regs + PCGCCTL1); 677 + dwc2_writel(hsotg, pcgcctl1, PCGCCTL1); 678 678 } 679 679 } 680 680 ··· 695 695 dev_dbg(hsotg->dev, "Host Global Registers\n"); 696 696 addr = hsotg->regs + HCFG; 697 697 dev_dbg(hsotg->dev, "HCFG @0x%08lX : 0x%08X\n", 698 - (unsigned long)addr, dwc2_readl(addr)); 698 + (unsigned long)addr, dwc2_readl(hsotg, HCFG)); 699 699 addr = hsotg->regs + HFIR; 700 700 dev_dbg(hsotg->dev, "HFIR @0x%08lX : 0x%08X\n", 701 - (unsigned long)addr, dwc2_readl(addr)); 701 + (unsigned long)addr, dwc2_readl(hsotg, HFIR)); 702 702 addr = hsotg->regs + HFNUM; 703 703 dev_dbg(hsotg->dev, "HFNUM @0x%08lX : 0x%08X\n", 704 - (unsigned long)addr, dwc2_readl(addr)); 704 + (unsigned long)addr, dwc2_readl(hsotg, HFNUM)); 705 705 addr = hsotg->regs + HPTXSTS; 706 706 dev_dbg(hsotg->dev, "HPTXSTS @0x%08lX : 0x%08X\n", 707 - (unsigned long)addr, dwc2_readl(addr)); 707 + (unsigned long)addr, dwc2_readl(hsotg, HPTXSTS)); 708 708 addr = hsotg->regs + HAINT; 709 709 dev_dbg(hsotg->dev, "HAINT @0x%08lX : 0x%08X\n", 710 - (unsigned long)addr, dwc2_readl(addr)); 710 + (unsigned long)addr, dwc2_readl(hsotg, HAINT)); 711 711 addr = hsotg->regs + HAINTMSK; 712 712 dev_dbg(hsotg->dev, "HAINTMSK @0x%08lX : 0x%08X\n", 713 - (unsigned long)addr, dwc2_readl(addr)); 713 + (unsigned long)addr, dwc2_readl(hsotg, HAINTMSK)); 714 714 if (hsotg->params.dma_desc_enable) { 715 715 addr = hsotg->regs + HFLBADDR; 716 716 dev_dbg(hsotg->dev, "HFLBADDR @0x%08lX : 0x%08X\n", 717 - (unsigned long)addr, dwc2_readl(addr)); 717 + (unsigned long)addr, dwc2_readl(hsotg, HFLBADDR)); 718 718 } 719 719 720 720 addr = hsotg->regs + HPRT0; 721 721 dev_dbg(hsotg->dev, "HPRT0 @0x%08lX : 0x%08X\n", 722 - (unsigned long)addr, dwc2_readl(addr)); 722 + (unsigned long)addr, dwc2_readl(hsotg, HPRT0)); 723 723 724 724 for (i = 0; i < hsotg->params.host_channels; i++) { 725 725 dev_dbg(hsotg->dev, "Host Channel %d Specific Registers\n", i); 726 726 addr = hsotg->regs + HCCHAR(i); 727 727 dev_dbg(hsotg->dev, "HCCHAR @0x%08lX : 0x%08X\n", 728 - (unsigned long)addr, dwc2_readl(addr)); 728 + (unsigned long)addr, dwc2_readl(hsotg, HCCHAR(i))); 729 729 addr = hsotg->regs + HCSPLT(i); 730 730 dev_dbg(hsotg->dev, "HCSPLT @0x%08lX : 0x%08X\n", 731 - (unsigned long)addr, dwc2_readl(addr)); 731 + (unsigned long)addr, dwc2_readl(hsotg, HCSPLT(i))); 732 732 addr = hsotg->regs + HCINT(i); 733 733 dev_dbg(hsotg->dev, "HCINT @0x%08lX : 0x%08X\n", 734 - (unsigned long)addr, dwc2_readl(addr)); 734 + (unsigned long)addr, dwc2_readl(hsotg, HCINT(i))); 735 735 addr = hsotg->regs + HCINTMSK(i); 736 736 dev_dbg(hsotg->dev, "HCINTMSK @0x%08lX : 0x%08X\n", 737 - (unsigned long)addr, dwc2_readl(addr)); 737 + (unsigned long)addr, dwc2_readl(hsotg, HCINTMSK(i))); 738 738 addr = hsotg->regs + HCTSIZ(i); 739 739 dev_dbg(hsotg->dev, "HCTSIZ @0x%08lX : 0x%08X\n", 740 - (unsigned long)addr, dwc2_readl(addr)); 740 + (unsigned long)addr, dwc2_readl(hsotg, HCTSIZ(i))); 741 741 addr = hsotg->regs + HCDMA(i); 742 742 dev_dbg(hsotg->dev, "HCDMA @0x%08lX : 0x%08X\n", 743 - (unsigned long)addr, dwc2_readl(addr)); 743 + (unsigned long)addr, dwc2_readl(hsotg, HCDMA(i))); 744 744 if (hsotg->params.dma_desc_enable) { 745 745 addr = hsotg->regs + HCDMAB(i); 746 746 dev_dbg(hsotg->dev, "HCDMAB @0x%08lX : 0x%08X\n", 747 - (unsigned long)addr, dwc2_readl(addr)); 747 + (unsigned long)addr, dwc2_readl(hsotg, 748 + HCDMAB(i))); 748 749 } 749 750 } 750 751 #endif ··· 767 766 dev_dbg(hsotg->dev, "Core Global Registers\n"); 768 767 addr = hsotg->regs + GOTGCTL; 769 768 dev_dbg(hsotg->dev, "GOTGCTL @0x%08lX : 0x%08X\n", 770 - (unsigned long)addr, dwc2_readl(addr)); 769 + (unsigned long)addr, dwc2_readl(hsotg, GOTGCTL)); 771 770 addr = hsotg->regs + GOTGINT; 772 771 dev_dbg(hsotg->dev, "GOTGINT @0x%08lX : 0x%08X\n", 773 - (unsigned long)addr, dwc2_readl(addr)); 772 + (unsigned long)addr, dwc2_readl(hsotg, GOTGINT)); 774 773 addr = hsotg->regs + GAHBCFG; 775 774 dev_dbg(hsotg->dev, "GAHBCFG @0x%08lX : 0x%08X\n", 776 - (unsigned long)addr, dwc2_readl(addr)); 775 + (unsigned long)addr, dwc2_readl(hsotg, GAHBCFG)); 777 776 addr = hsotg->regs + GUSBCFG; 778 777 dev_dbg(hsotg->dev, "GUSBCFG @0x%08lX : 0x%08X\n", 779 - (unsigned long)addr, dwc2_readl(addr)); 778 + (unsigned long)addr, dwc2_readl(hsotg, GUSBCFG)); 780 779 addr = hsotg->regs + GRSTCTL; 781 780 dev_dbg(hsotg->dev, "GRSTCTL @0x%08lX : 0x%08X\n", 782 - (unsigned long)addr, dwc2_readl(addr)); 781 + (unsigned long)addr, dwc2_readl(hsotg, GRSTCTL)); 783 782 addr = hsotg->regs + GINTSTS; 784 783 dev_dbg(hsotg->dev, "GINTSTS @0x%08lX : 0x%08X\n", 785 - (unsigned long)addr, dwc2_readl(addr)); 784 + (unsigned long)addr, dwc2_readl(hsotg, GINTSTS)); 786 785 addr = hsotg->regs + GINTMSK; 787 786 dev_dbg(hsotg->dev, "GINTMSK @0x%08lX : 0x%08X\n", 788 - (unsigned long)addr, dwc2_readl(addr)); 787 + (unsigned long)addr, dwc2_readl(hsotg, GINTMSK)); 789 788 addr = hsotg->regs + GRXSTSR; 790 789 dev_dbg(hsotg->dev, "GRXSTSR @0x%08lX : 0x%08X\n", 791 - (unsigned long)addr, dwc2_readl(addr)); 790 + (unsigned long)addr, dwc2_readl(hsotg, GRXSTSR)); 792 791 addr = hsotg->regs + GRXFSIZ; 793 792 dev_dbg(hsotg->dev, "GRXFSIZ @0x%08lX : 0x%08X\n", 794 - (unsigned long)addr, dwc2_readl(addr)); 793 + (unsigned long)addr, dwc2_readl(hsotg, GRXFSIZ)); 795 794 addr = hsotg->regs + GNPTXFSIZ; 796 795 dev_dbg(hsotg->dev, "GNPTXFSIZ @0x%08lX : 0x%08X\n", 797 - (unsigned long)addr, dwc2_readl(addr)); 796 + (unsigned long)addr, dwc2_readl(hsotg, GNPTXFSIZ)); 798 797 addr = hsotg->regs + GNPTXSTS; 799 798 dev_dbg(hsotg->dev, "GNPTXSTS @0x%08lX : 0x%08X\n", 800 - (unsigned long)addr, dwc2_readl(addr)); 799 + (unsigned long)addr, dwc2_readl(hsotg, GNPTXSTS)); 801 800 addr = hsotg->regs + GI2CCTL; 802 801 dev_dbg(hsotg->dev, "GI2CCTL @0x%08lX : 0x%08X\n", 803 - (unsigned long)addr, dwc2_readl(addr)); 802 + (unsigned long)addr, dwc2_readl(hsotg, GI2CCTL)); 804 803 addr = hsotg->regs + GPVNDCTL; 805 804 dev_dbg(hsotg->dev, "GPVNDCTL @0x%08lX : 0x%08X\n", 806 - (unsigned long)addr, dwc2_readl(addr)); 805 + (unsigned long)addr, dwc2_readl(hsotg, GPVNDCTL)); 807 806 addr = hsotg->regs + GGPIO; 808 807 dev_dbg(hsotg->dev, "GGPIO @0x%08lX : 0x%08X\n", 809 - (unsigned long)addr, dwc2_readl(addr)); 808 + (unsigned long)addr, dwc2_readl(hsotg, GGPIO)); 810 809 addr = hsotg->regs + GUID; 811 810 dev_dbg(hsotg->dev, "GUID @0x%08lX : 0x%08X\n", 812 - (unsigned long)addr, dwc2_readl(addr)); 811 + (unsigned long)addr, dwc2_readl(hsotg, GUID)); 813 812 addr = hsotg->regs + GSNPSID; 814 813 dev_dbg(hsotg->dev, "GSNPSID @0x%08lX : 0x%08X\n", 815 - (unsigned long)addr, dwc2_readl(addr)); 814 + (unsigned long)addr, dwc2_readl(hsotg, GSNPSID)); 816 815 addr = hsotg->regs + GHWCFG1; 817 816 dev_dbg(hsotg->dev, "GHWCFG1 @0x%08lX : 0x%08X\n", 818 - (unsigned long)addr, dwc2_readl(addr)); 817 + (unsigned long)addr, dwc2_readl(hsotg, GHWCFG1)); 819 818 addr = hsotg->regs + GHWCFG2; 820 819 dev_dbg(hsotg->dev, "GHWCFG2 @0x%08lX : 0x%08X\n", 821 - (unsigned long)addr, dwc2_readl(addr)); 820 + (unsigned long)addr, dwc2_readl(hsotg, GHWCFG2)); 822 821 addr = hsotg->regs + GHWCFG3; 823 822 dev_dbg(hsotg->dev, "GHWCFG3 @0x%08lX : 0x%08X\n", 824 - (unsigned long)addr, dwc2_readl(addr)); 823 + (unsigned long)addr, dwc2_readl(hsotg, GHWCFG3)); 825 824 addr = hsotg->regs + GHWCFG4; 826 825 dev_dbg(hsotg->dev, "GHWCFG4 @0x%08lX : 0x%08X\n", 827 - (unsigned long)addr, dwc2_readl(addr)); 826 + (unsigned long)addr, dwc2_readl(hsotg, GHWCFG4)); 828 827 addr = hsotg->regs + GLPMCFG; 829 828 dev_dbg(hsotg->dev, "GLPMCFG @0x%08lX : 0x%08X\n", 830 - (unsigned long)addr, dwc2_readl(addr)); 829 + (unsigned long)addr, dwc2_readl(hsotg, GLPMCFG)); 831 830 addr = hsotg->regs + GPWRDN; 832 831 dev_dbg(hsotg->dev, "GPWRDN @0x%08lX : 0x%08X\n", 833 - (unsigned long)addr, dwc2_readl(addr)); 832 + (unsigned long)addr, dwc2_readl(hsotg, GPWRDN)); 834 833 addr = hsotg->regs + GDFIFOCFG; 835 834 dev_dbg(hsotg->dev, "GDFIFOCFG @0x%08lX : 0x%08X\n", 836 - (unsigned long)addr, dwc2_readl(addr)); 835 + (unsigned long)addr, dwc2_readl(hsotg, GDFIFOCFG)); 837 836 addr = hsotg->regs + HPTXFSIZ; 838 837 dev_dbg(hsotg->dev, "HPTXFSIZ @0x%08lX : 0x%08X\n", 839 - (unsigned long)addr, dwc2_readl(addr)); 838 + (unsigned long)addr, dwc2_readl(hsotg, HPTXFSIZ)); 840 839 841 840 addr = hsotg->regs + PCGCTL; 842 841 dev_dbg(hsotg->dev, "PCGCTL @0x%08lX : 0x%08X\n", 843 - (unsigned long)addr, dwc2_readl(addr)); 842 + (unsigned long)addr, dwc2_readl(hsotg, PCGCTL)); 844 843 #endif 845 844 } 846 845 ··· 863 862 864 863 greset = GRSTCTL_TXFFLSH; 865 864 greset |= num << GRSTCTL_TXFNUM_SHIFT & GRSTCTL_TXFNUM_MASK; 866 - dwc2_writel(greset, hsotg->regs + GRSTCTL); 865 + dwc2_writel(hsotg, greset, GRSTCTL); 867 866 868 867 if (dwc2_hsotg_wait_bit_clear(hsotg, GRSTCTL, GRSTCTL_TXFFLSH, 10000)) 869 868 dev_warn(hsotg->dev, "%s: HANG! timeout GRSTCTL GRSTCTL_TXFFLSH\n", ··· 890 889 __func__); 891 890 892 891 greset = GRSTCTL_RXFFLSH; 893 - dwc2_writel(greset, hsotg->regs + GRSTCTL); 892 + dwc2_writel(hsotg, greset, GRSTCTL); 894 893 895 894 /* Wait for RxFIFO flush done */ 896 895 if (dwc2_hsotg_wait_bit_clear(hsotg, GRSTCTL, GRSTCTL_RXFFLSH, 10000)) ··· 903 902 904 903 bool dwc2_is_controller_alive(struct dwc2_hsotg *hsotg) 905 904 { 906 - if (dwc2_readl(hsotg->regs + GSNPSID) == 0xffffffff) 905 + if (dwc2_readl(hsotg, GSNPSID) == 0xffffffff) 907 906 return false; 908 907 else 909 908 return true; ··· 917 916 */ 918 917 void dwc2_enable_global_interrupts(struct dwc2_hsotg *hsotg) 919 918 { 920 - u32 ahbcfg = dwc2_readl(hsotg->regs + GAHBCFG); 919 + u32 ahbcfg = dwc2_readl(hsotg, GAHBCFG); 921 920 922 921 ahbcfg |= GAHBCFG_GLBL_INTR_EN; 923 - dwc2_writel(ahbcfg, hsotg->regs + GAHBCFG); 922 + dwc2_writel(hsotg, ahbcfg, GAHBCFG); 924 923 } 925 924 926 925 /** ··· 931 930 */ 932 931 void dwc2_disable_global_interrupts(struct dwc2_hsotg *hsotg) 933 932 { 934 - u32 ahbcfg = dwc2_readl(hsotg->regs + GAHBCFG); 933 + u32 ahbcfg = dwc2_readl(hsotg, GAHBCFG); 935 934 936 935 ahbcfg &= ~GAHBCFG_GLBL_INTR_EN; 937 - dwc2_writel(ahbcfg, hsotg->regs + GAHBCFG); 936 + dwc2_writel(hsotg, ahbcfg, GAHBCFG); 938 937 } 939 938 940 939 /* Returns the controller's GHWCFG2.OTG_MODE. */ 941 940 unsigned int dwc2_op_mode(struct dwc2_hsotg *hsotg) 942 941 { 943 - u32 ghwcfg2 = dwc2_readl(hsotg->regs + GHWCFG2); 942 + u32 ghwcfg2 = dwc2_readl(hsotg, GHWCFG2); 944 943 945 944 return (ghwcfg2 & GHWCFG2_OP_MODE_MASK) >> 946 945 GHWCFG2_OP_MODE_SHIFT; ··· 989 988 u32 i; 990 989 991 990 for (i = 0; i < timeout; i++) { 992 - if (dwc2_readl(hsotg->regs + offset) & mask) 991 + if (dwc2_readl(hsotg, offset) & mask) 993 992 return 0; 994 993 udelay(1); 995 994 } ··· 1012 1011 u32 i; 1013 1012 1014 1013 for (i = 0; i < timeout; i++) { 1015 - if (!(dwc2_readl(hsotg->regs + offset) & mask)) 1014 + if (!(dwc2_readl(hsotg, offset) & mask)) 1016 1015 return 0; 1017 1016 udelay(1); 1018 1017 }
+13 -12
drivers/usb/dwc2/core.h
··· 1172 1172 * writes. This set of operations was added specifically for MIPS and 1173 1173 * should only be used there. 1174 1174 */ 1175 - static inline u32 dwc2_readl(const void __iomem *addr) 1175 + static inline u32 dwc2_readl(struct dwc2_hsotg *hsotg, u32 offset) 1176 1176 { 1177 - u32 value = __raw_readl(addr); 1177 + u32 value = __raw_readl(hsotg->regs + offset); 1178 1178 1179 1179 /* In order to preserve endianness __raw_* operation is used. Therefore 1180 1180 * a barrier is needed to ensure IO access is not re-ordered across ··· 1184 1184 return value; 1185 1185 } 1186 1186 1187 - static inline void dwc2_writel(u32 value, void __iomem *addr) 1187 + static inline void dwc2_writel(struct dwc2_hsotg *hsotg, u32 value, u32 offset) 1188 1188 { 1189 - __raw_writel(value, addr); 1189 + __raw_writel(value, hsotg->regs + offset); 1190 1190 1191 1191 /* 1192 1192 * In order to preserve endianness __raw_* operation is used. Therefore ··· 1195 1195 */ 1196 1196 mb(); 1197 1197 #ifdef DWC2_LOG_WRITES 1198 - pr_info("INFO:: wrote %08x to %p\n", value, addr); 1198 + pr_info("INFO:: wrote %08x to %p\n", value, hsotg->regs + offset); 1199 1199 #endif 1200 1200 } 1201 1201 #else 1202 + 1202 1203 /* Normal architectures just use readl/write */ 1203 - static inline u32 dwc2_readl(const void __iomem *addr) 1204 + static inline u32 dwc2_readl(struct dwc2_hsotg *hsotg, u32 offset) 1204 1205 { 1205 - return readl(addr); 1206 + return readl(hsotg->regs + offset); 1206 1207 } 1207 1208 1208 - static inline void dwc2_writel(u32 value, void __iomem *addr) 1209 + static inline void dwc2_writel(struct dwc2_hsotg *hsotg, u32 value, u32 offset) 1209 1210 { 1210 - writel(value, addr); 1211 + writel(value, hsotg->regs + offset); 1211 1212 1212 1213 #ifdef DWC2_LOG_WRITES 1213 - pr_info("info:: wrote %08x to %p\n", value, addr); 1214 + pr_info("info:: wrote %08x to %p\n", value, hsotg->regs + offset); 1214 1215 #endif 1215 1216 } 1216 1217 #endif ··· 1321 1320 */ 1322 1321 static inline int dwc2_is_host_mode(struct dwc2_hsotg *hsotg) 1323 1322 { 1324 - return (dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) != 0; 1323 + return (dwc2_readl(hsotg, GINTSTS) & GINTSTS_CURMODE_HOST) != 0; 1325 1324 } 1326 1325 1327 1326 static inline int dwc2_is_device_mode(struct dwc2_hsotg *hsotg) 1328 1327 { 1329 - return (dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) == 0; 1328 + return (dwc2_readl(hsotg, GINTSTS) & GINTSTS_CURMODE_HOST) == 0; 1330 1329 } 1331 1330 1332 1331 /*
+59 -59
drivers/usb/dwc2/core_intr.c
··· 81 81 */ 82 82 static void dwc2_handle_usb_port_intr(struct dwc2_hsotg *hsotg) 83 83 { 84 - u32 hprt0 = dwc2_readl(hsotg->regs + HPRT0); 84 + u32 hprt0 = dwc2_readl(hsotg, HPRT0); 85 85 86 86 if (hprt0 & HPRT0_ENACHG) { 87 87 hprt0 &= ~HPRT0_ENA; 88 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 88 + dwc2_writel(hsotg, hprt0, HPRT0); 89 89 } 90 90 } 91 91 ··· 97 97 static void dwc2_handle_mode_mismatch_intr(struct dwc2_hsotg *hsotg) 98 98 { 99 99 /* Clear interrupt */ 100 - dwc2_writel(GINTSTS_MODEMIS, hsotg->regs + GINTSTS); 100 + dwc2_writel(hsotg, GINTSTS_MODEMIS, GINTSTS); 101 101 102 102 dev_warn(hsotg->dev, "Mode Mismatch Interrupt: currently in %s mode\n", 103 103 dwc2_is_host_mode(hsotg) ? "Host" : "Device"); ··· 115 115 u32 gotgctl; 116 116 u32 gintmsk; 117 117 118 - gotgint = dwc2_readl(hsotg->regs + GOTGINT); 119 - gotgctl = dwc2_readl(hsotg->regs + GOTGCTL); 118 + gotgint = dwc2_readl(hsotg, GOTGINT); 119 + gotgctl = dwc2_readl(hsotg, GOTGCTL); 120 120 dev_dbg(hsotg->dev, "++OTG Interrupt gotgint=%0x [%s]\n", gotgint, 121 121 dwc2_op_state_str(hsotg)); 122 122 ··· 124 124 dev_dbg(hsotg->dev, 125 125 " ++OTG Interrupt: Session End Detected++ (%s)\n", 126 126 dwc2_op_state_str(hsotg)); 127 - gotgctl = dwc2_readl(hsotg->regs + GOTGCTL); 127 + gotgctl = dwc2_readl(hsotg, GOTGCTL); 128 128 129 129 if (dwc2_is_device_mode(hsotg)) 130 130 dwc2_hsotg_disconnect(hsotg); ··· 150 150 hsotg->lx_state = DWC2_L0; 151 151 } 152 152 153 - gotgctl = dwc2_readl(hsotg->regs + GOTGCTL); 153 + gotgctl = dwc2_readl(hsotg, GOTGCTL); 154 154 gotgctl &= ~GOTGCTL_DEVHNPEN; 155 - dwc2_writel(gotgctl, hsotg->regs + GOTGCTL); 155 + dwc2_writel(hsotg, gotgctl, GOTGCTL); 156 156 } 157 157 158 158 if (gotgint & GOTGINT_SES_REQ_SUC_STS_CHNG) { 159 159 dev_dbg(hsotg->dev, 160 160 " ++OTG Interrupt: Session Request Success Status Change++\n"); 161 - gotgctl = dwc2_readl(hsotg->regs + GOTGCTL); 161 + gotgctl = dwc2_readl(hsotg, GOTGCTL); 162 162 if (gotgctl & GOTGCTL_SESREQSCS) { 163 163 if (hsotg->params.phy_type == DWC2_PHY_TYPE_PARAM_FS && 164 164 hsotg->params.i2c_enable) { 165 165 hsotg->srp_success = 1; 166 166 } else { 167 167 /* Clear Session Request */ 168 - gotgctl = dwc2_readl(hsotg->regs + GOTGCTL); 168 + gotgctl = dwc2_readl(hsotg, GOTGCTL); 169 169 gotgctl &= ~GOTGCTL_SESREQ; 170 - dwc2_writel(gotgctl, hsotg->regs + GOTGCTL); 170 + dwc2_writel(hsotg, gotgctl, GOTGCTL); 171 171 } 172 172 } 173 173 } ··· 177 177 * Print statements during the HNP interrupt handling 178 178 * can cause it to fail 179 179 */ 180 - gotgctl = dwc2_readl(hsotg->regs + GOTGCTL); 180 + gotgctl = dwc2_readl(hsotg, GOTGCTL); 181 181 /* 182 182 * WA for 3.00a- HW is not setting cur_mode, even sometimes 183 183 * this does not help ··· 197 197 * interrupt does not get handled and Linux 198 198 * complains loudly. 199 199 */ 200 - gintmsk = dwc2_readl(hsotg->regs + GINTMSK); 200 + gintmsk = dwc2_readl(hsotg, GINTMSK); 201 201 gintmsk &= ~GINTSTS_SOF; 202 - dwc2_writel(gintmsk, hsotg->regs + GINTMSK); 202 + dwc2_writel(hsotg, gintmsk, GINTMSK); 203 203 204 204 /* 205 205 * Call callback function with spin lock ··· 213 213 hsotg->op_state = OTG_STATE_B_HOST; 214 214 } 215 215 } else { 216 - gotgctl = dwc2_readl(hsotg->regs + GOTGCTL); 216 + gotgctl = dwc2_readl(hsotg, GOTGCTL); 217 217 gotgctl &= ~(GOTGCTL_HNPREQ | GOTGCTL_DEVHNPEN); 218 - dwc2_writel(gotgctl, hsotg->regs + GOTGCTL); 218 + dwc2_writel(hsotg, gotgctl, GOTGCTL); 219 219 dev_dbg(hsotg->dev, "HNP Failed\n"); 220 220 dev_err(hsotg->dev, 221 221 "Device Not Connected/Responding\n"); ··· 241 241 hsotg->op_state = OTG_STATE_A_PERIPHERAL; 242 242 } else { 243 243 /* Need to disable SOF interrupt immediately */ 244 - gintmsk = dwc2_readl(hsotg->regs + GINTMSK); 244 + gintmsk = dwc2_readl(hsotg, GINTMSK); 245 245 gintmsk &= ~GINTSTS_SOF; 246 - dwc2_writel(gintmsk, hsotg->regs + GINTMSK); 246 + dwc2_writel(hsotg, gintmsk, GINTMSK); 247 247 spin_unlock(&hsotg->lock); 248 248 dwc2_hcd_start(hsotg); 249 249 spin_lock(&hsotg->lock); ··· 258 258 dev_dbg(hsotg->dev, " ++OTG Interrupt: Debounce Done++\n"); 259 259 260 260 /* Clear GOTGINT */ 261 - dwc2_writel(gotgint, hsotg->regs + GOTGINT); 261 + dwc2_writel(hsotg, gotgint, GOTGINT); 262 262 } 263 263 264 264 /** ··· 276 276 u32 gintmsk; 277 277 278 278 /* Clear interrupt */ 279 - dwc2_writel(GINTSTS_CONIDSTSCHNG, hsotg->regs + GINTSTS); 279 + dwc2_writel(hsotg, GINTSTS_CONIDSTSCHNG, GINTSTS); 280 280 281 281 /* Need to disable SOF interrupt immediately */ 282 - gintmsk = dwc2_readl(hsotg->regs + GINTMSK); 282 + gintmsk = dwc2_readl(hsotg, GINTMSK); 283 283 gintmsk &= ~GINTSTS_SOF; 284 - dwc2_writel(gintmsk, hsotg->regs + GINTMSK); 284 + dwc2_writel(hsotg, gintmsk, GINTMSK); 285 285 286 286 dev_dbg(hsotg->dev, " ++Connector ID Status Change Interrupt++ (%s)\n", 287 287 dwc2_is_host_mode(hsotg) ? "Host" : "Device"); ··· 314 314 int ret; 315 315 316 316 /* Clear interrupt */ 317 - dwc2_writel(GINTSTS_SESSREQINT, hsotg->regs + GINTSTS); 317 + dwc2_writel(hsotg, GINTSTS_SESSREQINT, GINTSTS); 318 318 319 319 dev_dbg(hsotg->dev, "Session request interrupt - lx_state=%d\n", 320 320 hsotg->lx_state); ··· 351 351 return; 352 352 } 353 353 354 - glpmcfg = dwc2_readl(hsotg->regs + GLPMCFG); 354 + glpmcfg = dwc2_readl(hsotg, GLPMCFG); 355 355 if (dwc2_is_device_mode(hsotg)) { 356 356 dev_dbg(hsotg->dev, "Exit from L1 state\n"); 357 357 glpmcfg &= ~GLPMCFG_ENBLSLPM; 358 358 glpmcfg &= ~GLPMCFG_HIRD_THRES_EN; 359 - dwc2_writel(glpmcfg, hsotg->regs + GLPMCFG); 359 + dwc2_writel(hsotg, glpmcfg, GLPMCFG); 360 360 361 361 do { 362 - glpmcfg = dwc2_readl(hsotg->regs + GLPMCFG); 362 + glpmcfg = dwc2_readl(hsotg, GLPMCFG); 363 363 364 364 if (!(glpmcfg & (GLPMCFG_COREL1RES_MASK | 365 365 GLPMCFG_L1RESUMEOK | GLPMCFG_SLPSTS))) ··· 398 398 int ret; 399 399 400 400 /* Clear interrupt */ 401 - dwc2_writel(GINTSTS_WKUPINT, hsotg->regs + GINTSTS); 401 + dwc2_writel(hsotg, GINTSTS_WKUPINT, GINTSTS); 402 402 403 403 dev_dbg(hsotg->dev, "++Resume or Remote Wakeup Detected Interrupt++\n"); 404 404 dev_dbg(hsotg->dev, "%s lxstate = %d\n", __func__, hsotg->lx_state); ··· 410 410 411 411 if (dwc2_is_device_mode(hsotg)) { 412 412 dev_dbg(hsotg->dev, "DSTS=0x%0x\n", 413 - dwc2_readl(hsotg->regs + DSTS)); 413 + dwc2_readl(hsotg, DSTS)); 414 414 if (hsotg->lx_state == DWC2_L2) { 415 - u32 dctl = dwc2_readl(hsotg->regs + DCTL); 415 + u32 dctl = dwc2_readl(hsotg, DCTL); 416 416 417 417 /* Clear Remote Wakeup Signaling */ 418 418 dctl &= ~DCTL_RMTWKUPSIG; 419 - dwc2_writel(dctl, hsotg->regs + DCTL); 419 + dwc2_writel(hsotg, dctl, DCTL); 420 420 ret = dwc2_exit_partial_power_down(hsotg, true); 421 421 if (ret && (ret != -ENOTSUPP)) 422 422 dev_err(hsotg->dev, "exit power_down failed\n"); ··· 430 430 return; 431 431 432 432 if (hsotg->lx_state != DWC2_L1) { 433 - u32 pcgcctl = dwc2_readl(hsotg->regs + PCGCTL); 433 + u32 pcgcctl = dwc2_readl(hsotg, PCGCTL); 434 434 435 435 /* Restart the Phy Clock */ 436 436 pcgcctl &= ~PCGCTL_STOPPCLK; 437 - dwc2_writel(pcgcctl, hsotg->regs + PCGCTL); 437 + dwc2_writel(hsotg, pcgcctl, PCGCTL); 438 438 mod_timer(&hsotg->wkp_timer, 439 439 jiffies + msecs_to_jiffies(71)); 440 440 } else { ··· 450 450 */ 451 451 static void dwc2_handle_disconnect_intr(struct dwc2_hsotg *hsotg) 452 452 { 453 - dwc2_writel(GINTSTS_DISCONNINT, hsotg->regs + GINTSTS); 453 + dwc2_writel(hsotg, GINTSTS_DISCONNINT, GINTSTS); 454 454 455 455 dev_dbg(hsotg->dev, "++Disconnect Detected Interrupt++ (%s) %s\n", 456 456 dwc2_is_host_mode(hsotg) ? "Host" : "Device", ··· 474 474 int ret; 475 475 476 476 /* Clear interrupt */ 477 - dwc2_writel(GINTSTS_USBSUSP, hsotg->regs + GINTSTS); 477 + dwc2_writel(hsotg, GINTSTS_USBSUSP, GINTSTS); 478 478 479 479 dev_dbg(hsotg->dev, "USB SUSPEND\n"); 480 480 ··· 483 483 * Check the Device status register to determine if the Suspend 484 484 * state is active 485 485 */ 486 - dsts = dwc2_readl(hsotg->regs + DSTS); 486 + dsts = dwc2_readl(hsotg, DSTS); 487 487 dev_dbg(hsotg->dev, "%s: DSTS=0x%0x\n", __func__, dsts); 488 488 dev_dbg(hsotg->dev, 489 489 "DSTS.Suspend Status=%d HWCFG4.Power Optimize=%d HWCFG4.Hibernation=%d\n", ··· 563 563 u32 enslpm; 564 564 565 565 /* Clear interrupt */ 566 - dwc2_writel(GINTSTS_LPMTRANRCVD, hsotg->regs + GINTSTS); 566 + dwc2_writel(hsotg, GINTSTS_LPMTRANRCVD, GINTSTS); 567 567 568 - glpmcfg = dwc2_readl(hsotg->regs + GLPMCFG); 568 + glpmcfg = dwc2_readl(hsotg, GLPMCFG); 569 569 570 570 if (!(glpmcfg & GLPMCFG_LPMCAP)) { 571 571 dev_err(hsotg->dev, "Unexpected LPM interrupt\n"); ··· 588 588 } else { 589 589 dev_dbg(hsotg->dev, "Entering Sleep with L1 Gating\n"); 590 590 591 - pcgcctl = dwc2_readl(hsotg->regs + PCGCTL); 591 + pcgcctl = dwc2_readl(hsotg, PCGCTL); 592 592 pcgcctl |= PCGCTL_ENBL_SLEEP_GATING; 593 - dwc2_writel(pcgcctl, hsotg->regs + PCGCTL); 593 + dwc2_writel(hsotg, pcgcctl, PCGCTL); 594 594 } 595 595 /** 596 596 * Examine prt_sleep_sts after TL1TokenTetry period max (10 us) 597 597 */ 598 598 udelay(10); 599 599 600 - glpmcfg = dwc2_readl(hsotg->regs + GLPMCFG); 600 + glpmcfg = dwc2_readl(hsotg, GLPMCFG); 601 601 602 602 if (glpmcfg & GLPMCFG_SLPSTS) { 603 603 /* Save the current state */ ··· 627 627 u32 gahbcfg; 628 628 u32 gintmsk_common = GINTMSK_COMMON; 629 629 630 - gintsts = dwc2_readl(hsotg->regs + GINTSTS); 631 - gintmsk = dwc2_readl(hsotg->regs + GINTMSK); 632 - gahbcfg = dwc2_readl(hsotg->regs + GAHBCFG); 630 + gintsts = dwc2_readl(hsotg, GINTSTS); 631 + gintmsk = dwc2_readl(hsotg, GINTMSK); 632 + gahbcfg = dwc2_readl(hsotg, GAHBCFG); 633 633 634 634 /* If any common interrupts set */ 635 635 if (gintsts & gintmsk_common) ··· 653 653 u32 gpwrdn; 654 654 int linestate; 655 655 656 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 656 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 657 657 /* clear all interrupt */ 658 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 658 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 659 659 linestate = (gpwrdn & GPWRDN_LINESTATE_MASK) >> GPWRDN_LINESTATE_SHIFT; 660 660 dev_dbg(hsotg->dev, 661 661 "%s: dwc2_handle_gpwrdwn_intr called gpwrdn= %08x\n", __func__, ··· 668 668 dev_dbg(hsotg->dev, "%s: GPWRDN_DISCONN_DET\n", __func__); 669 669 670 670 /* Switch-on voltage to the core */ 671 - gpwrdn_tmp = dwc2_readl(hsotg->regs + GPWRDN); 671 + gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); 672 672 gpwrdn_tmp &= ~GPWRDN_PWRDNSWTCH; 673 - dwc2_writel(gpwrdn_tmp, hsotg->regs + GPWRDN); 673 + dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); 674 674 udelay(10); 675 675 676 676 /* Reset core */ 677 - gpwrdn_tmp = dwc2_readl(hsotg->regs + GPWRDN); 677 + gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); 678 678 gpwrdn_tmp &= ~GPWRDN_PWRDNRSTN; 679 - dwc2_writel(gpwrdn_tmp, hsotg->regs + GPWRDN); 679 + dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); 680 680 udelay(10); 681 681 682 682 /* Disable Power Down Clamp */ 683 - gpwrdn_tmp = dwc2_readl(hsotg->regs + GPWRDN); 683 + gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); 684 684 gpwrdn_tmp &= ~GPWRDN_PWRDNCLMP; 685 - dwc2_writel(gpwrdn_tmp, hsotg->regs + GPWRDN); 685 + dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); 686 686 udelay(10); 687 687 688 688 /* Deassert reset core */ 689 - gpwrdn_tmp = dwc2_readl(hsotg->regs + GPWRDN); 689 + gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); 690 690 gpwrdn_tmp |= GPWRDN_PWRDNRSTN; 691 - dwc2_writel(gpwrdn_tmp, hsotg->regs + GPWRDN); 691 + dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); 692 692 udelay(10); 693 693 694 694 /* Disable PMU interrupt */ 695 - gpwrdn_tmp = dwc2_readl(hsotg->regs + GPWRDN); 695 + gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); 696 696 gpwrdn_tmp &= ~GPWRDN_PMUINTSEL; 697 - dwc2_writel(gpwrdn_tmp, hsotg->regs + GPWRDN); 697 + dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); 698 698 699 699 /* De-assert Wakeup Logic */ 700 - gpwrdn_tmp = dwc2_readl(hsotg->regs + GPWRDN); 700 + gpwrdn_tmp = dwc2_readl(hsotg, GPWRDN); 701 701 gpwrdn_tmp &= ~GPWRDN_PMUACTV; 702 - dwc2_writel(gpwrdn_tmp, hsotg->regs + GPWRDN); 702 + dwc2_writel(hsotg, gpwrdn_tmp, GPWRDN); 703 703 704 704 hsotg->hibernated = 0; 705 705 ··· 780 780 781 781 /* Reading current frame number value in device or host modes. */ 782 782 if (dwc2_is_device_mode(hsotg)) 783 - hsotg->frame_number = (dwc2_readl(hsotg->regs + DSTS) 783 + hsotg->frame_number = (dwc2_readl(hsotg, DSTS) 784 784 & DSTS_SOFFN_MASK) >> DSTS_SOFFN_SHIFT; 785 785 else 786 - hsotg->frame_number = (dwc2_readl(hsotg->regs + HFNUM) 786 + hsotg->frame_number = (dwc2_readl(hsotg, HFNUM) 787 787 & HFNUM_FRNUM_MASK) >> HFNUM_FRNUM_SHIFT; 788 788 789 789 gintsts = dwc2_read_common_intr(hsotg);
+26 -29
drivers/usb/dwc2/debugfs.c
··· 69 69 int dctl; 70 70 71 71 spin_lock_irqsave(&hsotg->lock, flags); 72 - dctl = dwc2_readl(hsotg->regs + DCTL); 72 + dctl = dwc2_readl(hsotg, DCTL); 73 73 dctl &= DCTL_TSTCTL_MASK; 74 74 dctl >>= DCTL_TSTCTL_SHIFT; 75 75 spin_unlock_irqrestore(&hsotg->lock, flags); ··· 126 126 static int state_show(struct seq_file *seq, void *v) 127 127 { 128 128 struct dwc2_hsotg *hsotg = seq->private; 129 - void __iomem *regs = hsotg->regs; 130 129 int idx; 131 130 132 131 seq_printf(seq, "DCFG=0x%08x, DCTL=0x%08x, DSTS=0x%08x\n", 133 - dwc2_readl(regs + DCFG), 134 - dwc2_readl(regs + DCTL), 135 - dwc2_readl(regs + DSTS)); 132 + dwc2_readl(hsotg, DCFG), 133 + dwc2_readl(hsotg, DCTL), 134 + dwc2_readl(hsotg, DSTS)); 136 135 137 136 seq_printf(seq, "DIEPMSK=0x%08x, DOEPMASK=0x%08x\n", 138 - dwc2_readl(regs + DIEPMSK), dwc2_readl(regs + DOEPMSK)); 137 + dwc2_readl(hsotg, DIEPMSK), dwc2_readl(hsotg, DOEPMSK)); 139 138 140 139 seq_printf(seq, "GINTMSK=0x%08x, GINTSTS=0x%08x\n", 141 - dwc2_readl(regs + GINTMSK), 142 - dwc2_readl(regs + GINTSTS)); 140 + dwc2_readl(hsotg, GINTMSK), 141 + dwc2_readl(hsotg, GINTSTS)); 143 142 144 143 seq_printf(seq, "DAINTMSK=0x%08x, DAINT=0x%08x\n", 145 - dwc2_readl(regs + DAINTMSK), 146 - dwc2_readl(regs + DAINT)); 144 + dwc2_readl(hsotg, DAINTMSK), 145 + dwc2_readl(hsotg, DAINT)); 147 146 148 147 seq_printf(seq, "GNPTXSTS=0x%08x, GRXSTSR=%08x\n", 149 - dwc2_readl(regs + GNPTXSTS), 150 - dwc2_readl(regs + GRXSTSR)); 148 + dwc2_readl(hsotg, GNPTXSTS), 149 + dwc2_readl(hsotg, GRXSTSR)); 151 150 152 151 seq_puts(seq, "\nEndpoint status:\n"); 153 152 154 153 for (idx = 0; idx < hsotg->num_of_eps; idx++) { 155 154 u32 in, out; 156 155 157 - in = dwc2_readl(regs + DIEPCTL(idx)); 158 - out = dwc2_readl(regs + DOEPCTL(idx)); 156 + in = dwc2_readl(hsotg, DIEPCTL(idx)); 157 + out = dwc2_readl(hsotg, DOEPCTL(idx)); 159 158 160 159 seq_printf(seq, "ep%d: DIEPCTL=0x%08x, DOEPCTL=0x%08x", 161 160 idx, in, out); 162 161 163 - in = dwc2_readl(regs + DIEPTSIZ(idx)); 164 - out = dwc2_readl(regs + DOEPTSIZ(idx)); 162 + in = dwc2_readl(hsotg, DIEPTSIZ(idx)); 163 + out = dwc2_readl(hsotg, DOEPTSIZ(idx)); 165 164 166 165 seq_printf(seq, ", DIEPTSIZ=0x%08x, DOEPTSIZ=0x%08x", 167 166 in, out); ··· 183 184 static int fifo_show(struct seq_file *seq, void *v) 184 185 { 185 186 struct dwc2_hsotg *hsotg = seq->private; 186 - void __iomem *regs = hsotg->regs; 187 187 u32 val; 188 188 int idx; 189 189 190 190 seq_puts(seq, "Non-periodic FIFOs:\n"); 191 - seq_printf(seq, "RXFIFO: Size %d\n", dwc2_readl(regs + GRXFSIZ)); 191 + seq_printf(seq, "RXFIFO: Size %d\n", dwc2_readl(hsotg, GRXFSIZ)); 192 192 193 - val = dwc2_readl(regs + GNPTXFSIZ); 193 + val = dwc2_readl(hsotg, GNPTXFSIZ); 194 194 seq_printf(seq, "NPTXFIFO: Size %d, Start 0x%08x\n", 195 195 val >> FIFOSIZE_DEPTH_SHIFT, 196 196 val & FIFOSIZE_STARTADDR_MASK); ··· 197 199 seq_puts(seq, "\nPeriodic TXFIFOs:\n"); 198 200 199 201 for (idx = 1; idx < hsotg->num_of_eps; idx++) { 200 - val = dwc2_readl(regs + DPTXFSIZN(idx)); 202 + val = dwc2_readl(hsotg, DPTXFSIZN(idx)); 201 203 202 204 seq_printf(seq, "\tDPTXFIFO%2d: Size %d, Start 0x%08x\n", idx, 203 205 val >> FIFOSIZE_DEPTH_SHIFT, ··· 226 228 struct dwc2_hsotg_ep *ep = seq->private; 227 229 struct dwc2_hsotg *hsotg = ep->parent; 228 230 struct dwc2_hsotg_req *req; 229 - void __iomem *regs = hsotg->regs; 230 231 int index = ep->index; 231 232 int show_limit = 15; 232 233 unsigned long flags; ··· 236 239 /* first show the register state */ 237 240 238 241 seq_printf(seq, "\tDIEPCTL=0x%08x, DOEPCTL=0x%08x\n", 239 - dwc2_readl(regs + DIEPCTL(index)), 240 - dwc2_readl(regs + DOEPCTL(index))); 242 + dwc2_readl(hsotg, DIEPCTL(index)), 243 + dwc2_readl(hsotg, DOEPCTL(index))); 241 244 242 245 seq_printf(seq, "\tDIEPDMA=0x%08x, DOEPDMA=0x%08x\n", 243 - dwc2_readl(regs + DIEPDMA(index)), 244 - dwc2_readl(regs + DOEPDMA(index))); 246 + dwc2_readl(hsotg, DIEPDMA(index)), 247 + dwc2_readl(hsotg, DOEPDMA(index))); 245 248 246 249 seq_printf(seq, "\tDIEPINT=0x%08x, DOEPINT=0x%08x\n", 247 - dwc2_readl(regs + DIEPINT(index)), 248 - dwc2_readl(regs + DOEPINT(index))); 250 + dwc2_readl(hsotg, DIEPINT(index)), 251 + dwc2_readl(hsotg, DOEPINT(index))); 249 252 250 253 seq_printf(seq, "\tDIEPTSIZ=0x%08x, DOEPTSIZ=0x%08x\n", 251 - dwc2_readl(regs + DIEPTSIZ(index)), 252 - dwc2_readl(regs + DOEPTSIZ(index))); 254 + dwc2_readl(hsotg, DIEPTSIZ(index)), 255 + dwc2_readl(hsotg, DOEPTSIZ(index))); 253 256 254 257 seq_puts(seq, "\n"); 255 258 seq_printf(seq, "mps %d\n", ep->ep.maxpacket);
+255 -257
drivers/usb/dwc2/gadget.c
··· 47 47 return container_of(gadget, struct dwc2_hsotg, gadget); 48 48 } 49 49 50 - static inline void dwc2_set_bit(void __iomem *ptr, u32 val) 50 + static inline void dwc2_set_bit(struct dwc2_hsotg *hsotg, u32 offset, u32 val) 51 51 { 52 - dwc2_writel(dwc2_readl(ptr) | val, ptr); 52 + dwc2_writel(hsotg, dwc2_readl(hsotg, offset) | val, offset); 53 53 } 54 54 55 - static inline void dwc2_clear_bit(void __iomem *ptr, u32 val) 55 + static inline void dwc2_clear_bit(struct dwc2_hsotg *hsotg, u32 offset, u32 val) 56 56 { 57 - dwc2_writel(dwc2_readl(ptr) & ~val, ptr); 57 + dwc2_writel(hsotg, dwc2_readl(hsotg, offset) & ~val, offset); 58 58 } 59 59 60 60 static inline struct dwc2_hsotg_ep *index_to_ep(struct dwc2_hsotg *hsotg, ··· 129 129 */ 130 130 static void dwc2_hsotg_en_gsint(struct dwc2_hsotg *hsotg, u32 ints) 131 131 { 132 - u32 gsintmsk = dwc2_readl(hsotg->regs + GINTMSK); 132 + u32 gsintmsk = dwc2_readl(hsotg, GINTMSK); 133 133 u32 new_gsintmsk; 134 134 135 135 new_gsintmsk = gsintmsk | ints; 136 136 137 137 if (new_gsintmsk != gsintmsk) { 138 138 dev_dbg(hsotg->dev, "gsintmsk now 0x%08x\n", new_gsintmsk); 139 - dwc2_writel(new_gsintmsk, hsotg->regs + GINTMSK); 139 + dwc2_writel(hsotg, new_gsintmsk, GINTMSK); 140 140 } 141 141 } 142 142 ··· 147 147 */ 148 148 static void dwc2_hsotg_disable_gsint(struct dwc2_hsotg *hsotg, u32 ints) 149 149 { 150 - u32 gsintmsk = dwc2_readl(hsotg->regs + GINTMSK); 150 + u32 gsintmsk = dwc2_readl(hsotg, GINTMSK); 151 151 u32 new_gsintmsk; 152 152 153 153 new_gsintmsk = gsintmsk & ~ints; 154 154 155 155 if (new_gsintmsk != gsintmsk) 156 - dwc2_writel(new_gsintmsk, hsotg->regs + GINTMSK); 156 + dwc2_writel(hsotg, new_gsintmsk, GINTMSK); 157 157 } 158 158 159 159 /** ··· 178 178 bit <<= 16; 179 179 180 180 local_irq_save(flags); 181 - daint = dwc2_readl(hsotg->regs + DAINTMSK); 181 + daint = dwc2_readl(hsotg, DAINTMSK); 182 182 if (en) 183 183 daint |= bit; 184 184 else 185 185 daint &= ~bit; 186 - dwc2_writel(daint, hsotg->regs + DAINTMSK); 186 + dwc2_writel(hsotg, daint, DAINTMSK); 187 187 local_irq_restore(flags); 188 188 } 189 189 ··· 266 266 hsotg->fifo_map = 0; 267 267 268 268 /* set RX/NPTX FIFO sizes */ 269 - dwc2_writel(hsotg->params.g_rx_fifo_size, hsotg->regs + GRXFSIZ); 270 - dwc2_writel((hsotg->params.g_rx_fifo_size << FIFOSIZE_STARTADDR_SHIFT) | 269 + dwc2_writel(hsotg, hsotg->params.g_rx_fifo_size, GRXFSIZ); 270 + dwc2_writel(hsotg, (hsotg->params.g_rx_fifo_size << 271 + FIFOSIZE_STARTADDR_SHIFT) | 271 272 (hsotg->params.g_np_tx_fifo_size << FIFOSIZE_DEPTH_SHIFT), 272 - hsotg->regs + GNPTXFSIZ); 273 + GNPTXFSIZ); 273 274 274 275 /* 275 276 * arange all the rest of the TX FIFOs, as some versions of this ··· 296 295 "insufficient fifo memory"); 297 296 addr += txfsz[ep]; 298 297 299 - dwc2_writel(val, hsotg->regs + DPTXFSIZN(ep)); 300 - val = dwc2_readl(hsotg->regs + DPTXFSIZN(ep)); 298 + dwc2_writel(hsotg, val, DPTXFSIZN(ep)); 299 + val = dwc2_readl(hsotg, DPTXFSIZN(ep)); 301 300 } 302 301 303 - dwc2_writel(hsotg->hw_params.total_fifo_size | 302 + dwc2_writel(hsotg, hsotg->hw_params.total_fifo_size | 304 303 addr << GDFIFOCFG_EPINFOBASE_SHIFT, 305 - hsotg->regs + GDFIFOCFG); 304 + GDFIFOCFG); 306 305 /* 307 306 * according to p428 of the design guide, we need to ensure that 308 307 * all fifos are flushed before continuing 309 308 */ 310 309 311 - dwc2_writel(GRSTCTL_TXFNUM(0x10) | GRSTCTL_TXFFLSH | 312 - GRSTCTL_RXFFLSH, hsotg->regs + GRSTCTL); 310 + dwc2_writel(hsotg, GRSTCTL_TXFNUM(0x10) | GRSTCTL_TXFFLSH | 311 + GRSTCTL_RXFFLSH, GRSTCTL); 313 312 314 313 /* wait until the fifos are both flushed */ 315 314 timeout = 100; 316 315 while (1) { 317 - val = dwc2_readl(hsotg->regs + GRSTCTL); 316 + val = dwc2_readl(hsotg, GRSTCTL); 318 317 319 318 if ((val & (GRSTCTL_TXFFLSH | GRSTCTL_RXFFLSH)) == 0) 320 319 break; ··· 452 451 struct dwc2_hsotg_req *hs_req) 453 452 { 454 453 bool periodic = is_ep_periodic(hs_ep); 455 - u32 gnptxsts = dwc2_readl(hsotg->regs + GNPTXSTS); 454 + u32 gnptxsts = dwc2_readl(hsotg, GNPTXSTS); 456 455 int buf_pos = hs_req->req.actual; 457 456 int to_write = hs_ep->size_loaded; 458 457 void *data; ··· 467 466 return 0; 468 467 469 468 if (periodic && !hsotg->dedicated_fifos) { 470 - u32 epsize = dwc2_readl(hsotg->regs + DIEPTSIZ(hs_ep->index)); 469 + u32 epsize = dwc2_readl(hsotg, DIEPTSIZ(hs_ep->index)); 471 470 int size_left; 472 471 int size_done; 473 472 ··· 508 507 return -ENOSPC; 509 508 } 510 509 } else if (hsotg->dedicated_fifos && hs_ep->index != 0) { 511 - can_write = dwc2_readl(hsotg->regs + 512 - DTXFSTS(hs_ep->fifo_index)); 510 + can_write = dwc2_readl(hsotg, 511 + DTXFSTS(hs_ep->fifo_index)); 513 512 514 513 can_write &= 0xffff; 515 514 can_write *= 4; ··· 653 652 { 654 653 u32 dsts; 655 654 656 - dsts = dwc2_readl(hsotg->regs + DSTS); 655 + dsts = dwc2_readl(hsotg, DSTS); 657 656 dsts &= DSTS_SOFFN_MASK; 658 657 dsts >>= DSTS_SOFFN_SHIFT; 659 658 ··· 916 915 dma_reg = hs_ep->dir_in ? DIEPDMA(index) : DOEPDMA(index); 917 916 918 917 /* write descriptor chain address to control register */ 919 - dwc2_writel(hs_ep->desc_list_dma, hsotg->regs + dma_reg); 918 + dwc2_writel(hsotg, hs_ep->desc_list_dma, dma_reg); 920 919 921 - ctrl = dwc2_readl(hsotg->regs + depctl); 920 + ctrl = dwc2_readl(hsotg, depctl); 922 921 ctrl |= DXEPCTL_EPENA | DXEPCTL_CNAK; 923 - dwc2_writel(ctrl, hsotg->regs + depctl); 922 + dwc2_writel(hsotg, ctrl, depctl); 924 923 } 925 924 926 925 /** ··· 968 967 epsize_reg = dir_in ? DIEPTSIZ(index) : DOEPTSIZ(index); 969 968 970 969 dev_dbg(hsotg->dev, "%s: DxEPCTL=0x%08x, ep %d, dir %s\n", 971 - __func__, dwc2_readl(hsotg->regs + epctrl_reg), index, 970 + __func__, dwc2_readl(hsotg, epctrl_reg), index, 972 971 hs_ep->dir_in ? "in" : "out"); 973 972 974 973 /* If endpoint is stalled, we will restart request later */ 975 - ctrl = dwc2_readl(hsotg->regs + epctrl_reg); 974 + ctrl = dwc2_readl(hsotg, epctrl_reg); 976 975 977 976 if (index && ctrl & DXEPCTL_STALL) { 978 977 dev_warn(hsotg->dev, "%s: ep%d is stalled\n", __func__, index); ··· 1065 1064 length); 1066 1065 1067 1066 /* write descriptor chain address to control register */ 1068 - dwc2_writel(hs_ep->desc_list_dma, hsotg->regs + dma_reg); 1067 + dwc2_writel(hsotg, hs_ep->desc_list_dma, dma_reg); 1069 1068 1070 1069 dev_dbg(hsotg->dev, "%s: %08x pad => 0x%08x\n", 1071 1070 __func__, (u32)hs_ep->desc_list_dma, dma_reg); 1072 1071 } else { 1073 1072 /* write size / packets */ 1074 - dwc2_writel(epsize, hsotg->regs + epsize_reg); 1073 + dwc2_writel(hsotg, epsize, epsize_reg); 1075 1074 1076 1075 if (using_dma(hsotg) && !continuing && (length != 0)) { 1077 1076 /* ··· 1079 1078 * already synced by dwc2_hsotg_ep_queue(). 1080 1079 */ 1081 1080 1082 - dwc2_writel(ureq->dma, hsotg->regs + dma_reg); 1081 + dwc2_writel(hsotg, ureq->dma, dma_reg); 1083 1082 1084 1083 dev_dbg(hsotg->dev, "%s: %pad => 0x%08x\n", 1085 1084 __func__, &ureq->dma, dma_reg); ··· 1105 1104 ctrl |= DXEPCTL_CNAK; /* clear NAK set by core */ 1106 1105 1107 1106 dev_dbg(hsotg->dev, "%s: DxEPCTL=0x%08x\n", __func__, ctrl); 1108 - dwc2_writel(ctrl, hsotg->regs + epctrl_reg); 1107 + dwc2_writel(hsotg, ctrl, epctrl_reg); 1109 1108 1110 1109 /* 1111 1110 * set these, it seems that DMA support increments past the end ··· 1128 1127 */ 1129 1128 1130 1129 /* check ep is enabled */ 1131 - if (!(dwc2_readl(hsotg->regs + epctrl_reg) & DXEPCTL_EPENA)) 1130 + if (!(dwc2_readl(hsotg, epctrl_reg) & DXEPCTL_EPENA)) 1132 1131 dev_dbg(hsotg->dev, 1133 1132 "ep%d: failed to become enabled (DXEPCTL=0x%08x)?\n", 1134 - index, dwc2_readl(hsotg->regs + epctrl_reg)); 1133 + index, dwc2_readl(hsotg, epctrl_reg)); 1135 1134 1136 1135 dev_dbg(hsotg->dev, "%s: DXEPCTL=0x%08x\n", 1137 - __func__, dwc2_readl(hsotg->regs + epctrl_reg)); 1136 + __func__, dwc2_readl(hsotg, epctrl_reg)); 1138 1137 1139 1138 /* enable ep interrupts */ 1140 1139 dwc2_hsotg_ctrl_epint(hsotg, hs_ep->index, hs_ep->dir_in, 1); ··· 1467 1466 */ 1468 1467 int dwc2_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, int testmode) 1469 1468 { 1470 - int dctl = dwc2_readl(hsotg->regs + DCTL); 1469 + int dctl = dwc2_readl(hsotg, DCTL); 1471 1470 1472 1471 dctl &= ~DCTL_TSTCTL_MASK; 1473 1472 switch (testmode) { ··· 1481 1480 default: 1482 1481 return -EINVAL; 1483 1482 } 1484 - dwc2_writel(dctl, hsotg->regs + DCTL); 1483 + dwc2_writel(hsotg, dctl, DCTL); 1485 1484 return 0; 1486 1485 } 1487 1486 ··· 1635 1634 } else { 1636 1635 dev_dbg(hsotg->dev, "%s: No more ISOC-OUT requests\n", 1637 1636 __func__); 1638 - mask = dwc2_readl(hsotg->regs + epmsk_reg); 1637 + mask = dwc2_readl(hsotg, epmsk_reg); 1639 1638 mask |= DOEPMSK_OUTTKNEPDISMSK; 1640 - dwc2_writel(mask, hsotg->regs + epmsk_reg); 1639 + dwc2_writel(hsotg, mask, epmsk_reg); 1641 1640 } 1642 1641 } 1643 1642 ··· 1774 1773 * taken effect, so no need to clear later. 1775 1774 */ 1776 1775 1777 - ctrl = dwc2_readl(hsotg->regs + reg); 1776 + ctrl = dwc2_readl(hsotg, reg); 1778 1777 ctrl |= DXEPCTL_STALL; 1779 1778 ctrl |= DXEPCTL_CNAK; 1780 - dwc2_writel(ctrl, hsotg->regs + reg); 1779 + dwc2_writel(hsotg, ctrl, reg); 1781 1780 1782 1781 dev_dbg(hsotg->dev, 1783 1782 "written DXEPCTL=0x%08x to %08x (DXEPCTL=0x%08x)\n", 1784 - ctrl, reg, dwc2_readl(hsotg->regs + reg)); 1783 + ctrl, reg, dwc2_readl(hsotg, reg)); 1785 1784 1786 1785 /* 1787 1786 * complete won't be called, so we enqueue ··· 1826 1825 switch (ctrl->bRequest) { 1827 1826 case USB_REQ_SET_ADDRESS: 1828 1827 hsotg->connected = 1; 1829 - dcfg = dwc2_readl(hsotg->regs + DCFG); 1828 + dcfg = dwc2_readl(hsotg, DCFG); 1830 1829 dcfg &= ~DCFG_DEVADDR_MASK; 1831 1830 dcfg |= (le16_to_cpu(ctrl->wValue) << 1832 1831 DCFG_DEVADDR_SHIFT) & DCFG_DEVADDR_MASK; 1833 - dwc2_writel(dcfg, hsotg->regs + DCFG); 1832 + dwc2_writel(hsotg, dcfg, DCFG); 1834 1833 1835 1834 dev_info(hsotg->dev, "new address %d\n", ctrl->wValue); 1836 1835 ··· 1956 1955 1957 1956 dwc2_gadget_config_nonisoc_xfer_ddma(hs_ep, dma, 0); 1958 1957 } else { 1959 - dwc2_writel(DXEPTSIZ_MC(1) | DXEPTSIZ_PKTCNT(1) | 1960 - DXEPTSIZ_XFERSIZE(0), hsotg->regs + 1958 + dwc2_writel(hsotg, DXEPTSIZ_MC(1) | DXEPTSIZ_PKTCNT(1) | 1959 + DXEPTSIZ_XFERSIZE(0), 1961 1960 epsiz_reg); 1962 1961 } 1963 1962 1964 - ctrl = dwc2_readl(hsotg->regs + epctl_reg); 1963 + ctrl = dwc2_readl(hsotg, epctl_reg); 1965 1964 ctrl |= DXEPCTL_CNAK; /* clear NAK set by core */ 1966 1965 ctrl |= DXEPCTL_EPENA; /* ensure ep enabled */ 1967 1966 ctrl |= DXEPCTL_USBACTEP; 1968 - dwc2_writel(ctrl, hsotg->regs + epctl_reg); 1967 + dwc2_writel(hsotg, ctrl, epctl_reg); 1969 1968 } 1970 1969 1971 1970 /** ··· 2125 2124 { 2126 2125 struct dwc2_hsotg_ep *hs_ep = hsotg->eps_out[ep_idx]; 2127 2126 struct dwc2_hsotg_req *hs_req = hs_ep->req; 2128 - void __iomem *fifo = hsotg->regs + EPFIFO(ep_idx); 2129 2127 int to_read; 2130 2128 int max_req; 2131 2129 int read_ptr; 2132 2130 2133 2131 if (!hs_req) { 2134 - u32 epctl = dwc2_readl(hsotg->regs + DOEPCTL(ep_idx)); 2132 + u32 epctl = dwc2_readl(hsotg, DOEPCTL(ep_idx)); 2135 2133 int ptr; 2136 2134 2137 2135 dev_dbg(hsotg->dev, ··· 2139 2139 2140 2140 /* dump the data from the FIFO, we've nothing we can do */ 2141 2141 for (ptr = 0; ptr < size; ptr += 4) 2142 - (void)dwc2_readl(fifo); 2142 + (void)dwc2_readl(hsotg, EPFIFO(ep_idx)); 2143 2143 2144 2144 return; 2145 2145 } ··· 2169 2169 * note, we might over-write the buffer end by 3 bytes depending on 2170 2170 * alignment of the data. 2171 2171 */ 2172 - ioread32_rep(fifo, hs_req->req.buf + read_ptr, to_read); 2172 + ioread32_rep(hsotg->regs + EPFIFO(ep_idx), 2173 + hs_req->req.buf + read_ptr, to_read); 2173 2174 } 2174 2175 2175 2176 /** ··· 2199 2198 { 2200 2199 u32 ctrl; 2201 2200 2202 - ctrl = dwc2_readl(hsotg->regs + epctl_reg); 2201 + ctrl = dwc2_readl(hsotg, epctl_reg); 2203 2202 if (ctrl & DXEPCTL_EOFRNUM) 2204 2203 ctrl |= DXEPCTL_SETEVENFR; 2205 2204 else 2206 2205 ctrl |= DXEPCTL_SETODDFR; 2207 - dwc2_writel(ctrl, hsotg->regs + epctl_reg); 2206 + dwc2_writel(hsotg, ctrl, epctl_reg); 2208 2207 } 2209 2208 2210 2209 /* ··· 2248 2247 */ 2249 2248 static void dwc2_hsotg_handle_outdone(struct dwc2_hsotg *hsotg, int epnum) 2250 2249 { 2251 - u32 epsize = dwc2_readl(hsotg->regs + DOEPTSIZ(epnum)); 2250 + u32 epsize = dwc2_readl(hsotg, DOEPTSIZ(epnum)); 2252 2251 struct dwc2_hsotg_ep *hs_ep = hsotg->eps_out[epnum]; 2253 2252 struct dwc2_hsotg_req *hs_req = hs_ep->req; 2254 2253 struct usb_request *req = &hs_req->req; ··· 2344 2343 */ 2345 2344 static void dwc2_hsotg_handle_rx(struct dwc2_hsotg *hsotg) 2346 2345 { 2347 - u32 grxstsr = dwc2_readl(hsotg->regs + GRXSTSP); 2346 + u32 grxstsr = dwc2_readl(hsotg, GRXSTSP); 2348 2347 u32 epnum, status, size; 2349 2348 2350 2349 WARN_ON(using_dma(hsotg)); ··· 2375 2374 dev_dbg(hsotg->dev, 2376 2375 "SetupDone (Frame=0x%08x, DOPEPCTL=0x%08x)\n", 2377 2376 dwc2_hsotg_read_frameno(hsotg), 2378 - dwc2_readl(hsotg->regs + DOEPCTL(0))); 2377 + dwc2_readl(hsotg, DOEPCTL(0))); 2379 2378 /* 2380 2379 * Call dwc2_hsotg_handle_outdone here if it was not called from 2381 2380 * GRXSTS_PKTSTS_OUTDONE. That is, if the core didn't ··· 2393 2392 dev_dbg(hsotg->dev, 2394 2393 "SetupRX (Frame=0x%08x, DOPEPCTL=0x%08x)\n", 2395 2394 dwc2_hsotg_read_frameno(hsotg), 2396 - dwc2_readl(hsotg->regs + DOEPCTL(0))); 2395 + dwc2_readl(hsotg, DOEPCTL(0))); 2397 2396 2398 2397 WARN_ON(hsotg->ep0_state != DWC2_EP0_SETUP); 2399 2398 ··· 2447 2446 unsigned int mc, unsigned int dir_in) 2448 2447 { 2449 2448 struct dwc2_hsotg_ep *hs_ep; 2450 - void __iomem *regs = hsotg->regs; 2451 2449 u32 reg; 2452 2450 2453 2451 hs_ep = index_to_ep(hsotg, ep, dir_in); ··· 2472 2472 } 2473 2473 2474 2474 if (dir_in) { 2475 - reg = dwc2_readl(regs + DIEPCTL(ep)); 2475 + reg = dwc2_readl(hsotg, DIEPCTL(ep)); 2476 2476 reg &= ~DXEPCTL_MPS_MASK; 2477 2477 reg |= mps; 2478 - dwc2_writel(reg, regs + DIEPCTL(ep)); 2478 + dwc2_writel(hsotg, reg, DIEPCTL(ep)); 2479 2479 } else { 2480 - reg = dwc2_readl(regs + DOEPCTL(ep)); 2480 + reg = dwc2_readl(hsotg, DOEPCTL(ep)); 2481 2481 reg &= ~DXEPCTL_MPS_MASK; 2482 2482 reg |= mps; 2483 - dwc2_writel(reg, regs + DOEPCTL(ep)); 2483 + dwc2_writel(hsotg, reg, DOEPCTL(ep)); 2484 2484 } 2485 2485 2486 2486 return; ··· 2496 2496 */ 2497 2497 static void dwc2_hsotg_txfifo_flush(struct dwc2_hsotg *hsotg, unsigned int idx) 2498 2498 { 2499 - dwc2_writel(GRSTCTL_TXFNUM(idx) | GRSTCTL_TXFFLSH, 2500 - hsotg->regs + GRSTCTL); 2499 + dwc2_writel(hsotg, GRSTCTL_TXFNUM(idx) | GRSTCTL_TXFFLSH, 2500 + GRSTCTL); 2501 2501 2502 2502 /* wait until the fifo is flushed */ 2503 2503 if (dwc2_hsotg_wait_bit_clear(hsotg, GRSTCTL, GRSTCTL_TXFFLSH, 100)) ··· 2550 2550 struct dwc2_hsotg_ep *hs_ep) 2551 2551 { 2552 2552 struct dwc2_hsotg_req *hs_req = hs_ep->req; 2553 - u32 epsize = dwc2_readl(hsotg->regs + DIEPTSIZ(hs_ep->index)); 2553 + u32 epsize = dwc2_readl(hsotg, DIEPTSIZ(hs_ep->index)); 2554 2554 int size_left, size_done; 2555 2555 2556 2556 if (!hs_req) { ··· 2654 2654 u32 mask; 2655 2655 u32 diepempmsk; 2656 2656 2657 - mask = dwc2_readl(hsotg->regs + epmsk_reg); 2658 - diepempmsk = dwc2_readl(hsotg->regs + DIEPEMPMSK); 2657 + mask = dwc2_readl(hsotg, epmsk_reg); 2658 + diepempmsk = dwc2_readl(hsotg, DIEPEMPMSK); 2659 2659 mask |= ((diepempmsk >> idx) & 0x1) ? DIEPMSK_TXFIFOEMPTY : 0; 2660 2660 mask |= DXEPINT_SETUP_RCVD; 2661 2661 2662 - ints = dwc2_readl(hsotg->regs + epint_reg); 2662 + ints = dwc2_readl(hsotg, epint_reg); 2663 2663 ints &= mask; 2664 2664 return ints; 2665 2665 } ··· 2684 2684 unsigned char idx = hs_ep->index; 2685 2685 int dir_in = hs_ep->dir_in; 2686 2686 u32 epctl_reg = dir_in ? DIEPCTL(idx) : DOEPCTL(idx); 2687 - int dctl = dwc2_readl(hsotg->regs + DCTL); 2687 + int dctl = dwc2_readl(hsotg, DCTL); 2688 2688 2689 2689 dev_dbg(hsotg->dev, "%s: EPDisbld\n", __func__); 2690 2690 2691 2691 if (dir_in) { 2692 - int epctl = dwc2_readl(hsotg->regs + epctl_reg); 2692 + int epctl = dwc2_readl(hsotg, epctl_reg); 2693 2693 2694 2694 dwc2_hsotg_txfifo_flush(hsotg, hs_ep->fifo_index); 2695 2695 ··· 2699 2699 } 2700 2700 2701 2701 if ((epctl & DXEPCTL_STALL) && (epctl & DXEPCTL_EPTYPE_BULK)) { 2702 - int dctl = dwc2_readl(hsotg->regs + DCTL); 2702 + int dctl = dwc2_readl(hsotg, DCTL); 2703 2703 2704 2704 dctl |= DCTL_CGNPINNAK; 2705 - dwc2_writel(dctl, hsotg->regs + DCTL); 2705 + dwc2_writel(hsotg, dctl, DCTL); 2706 2706 } 2707 2707 return; 2708 2708 } 2709 2709 2710 2710 if (dctl & DCTL_GOUTNAKSTS) { 2711 2711 dctl |= DCTL_CGOUTNAK; 2712 - dwc2_writel(dctl, hsotg->regs + DCTL); 2712 + dwc2_writel(hsotg, dctl, DCTL); 2713 2713 } 2714 2714 2715 2715 if (!hs_ep->isochronous) ··· 2775 2775 u32 dsts; 2776 2776 u32 ctrl; 2777 2777 2778 - dsts = dwc2_readl(hsotg->regs + DSTS); 2778 + dsts = dwc2_readl(hsotg, DSTS); 2779 2779 ep->target_frame = dwc2_hsotg_read_frameno(hsotg); 2780 2780 dwc2_gadget_incr_frame_num(ep); 2781 2781 2782 - ctrl = dwc2_readl(hsotg->regs + DOEPCTL(ep->index)); 2782 + ctrl = dwc2_readl(hsotg, DOEPCTL(ep->index)); 2783 2783 if (ep->target_frame & 0x1) 2784 2784 ctrl |= DXEPCTL_SETODDFR; 2785 2785 else 2786 2786 ctrl |= DXEPCTL_SETEVENFR; 2787 2787 2788 - dwc2_writel(ctrl, hsotg->regs + DOEPCTL(ep->index)); 2788 + dwc2_writel(hsotg, ctrl, DOEPCTL(ep->index)); 2789 2789 } 2790 2790 2791 2791 dwc2_gadget_start_next_request(ep); 2792 - doepmsk = dwc2_readl(hsotg->regs + DOEPMSK); 2792 + doepmsk = dwc2_readl(hsotg, DOEPMSK); 2793 2793 doepmsk &= ~DOEPMSK_OUTTKNEPDISMSK; 2794 - dwc2_writel(doepmsk, hsotg->regs + DOEPMSK); 2794 + dwc2_writel(hsotg, doepmsk, DOEPMSK); 2795 2795 } 2796 2796 2797 2797 /** ··· 2829 2829 2830 2830 hs_ep->target_frame = tmp; 2831 2831 if (hs_ep->interval > 1) { 2832 - u32 ctrl = dwc2_readl(hsotg->regs + 2832 + u32 ctrl = dwc2_readl(hsotg, 2833 2833 DIEPCTL(hs_ep->index)); 2834 2834 if (hs_ep->target_frame & 0x1) 2835 2835 ctrl |= DXEPCTL_SETODDFR; 2836 2836 else 2837 2837 ctrl |= DXEPCTL_SETEVENFR; 2838 2838 2839 - dwc2_writel(ctrl, hsotg->regs + DIEPCTL(hs_ep->index)); 2839 + dwc2_writel(hsotg, ctrl, DIEPCTL(hs_ep->index)); 2840 2840 } 2841 2841 2842 2842 dwc2_hsotg_complete_request(hsotg, hs_ep, ··· 2866 2866 u32 ctrl; 2867 2867 2868 2868 ints = dwc2_gadget_read_ep_interrupts(hsotg, idx, dir_in); 2869 - ctrl = dwc2_readl(hsotg->regs + epctl_reg); 2869 + ctrl = dwc2_readl(hsotg, epctl_reg); 2870 2870 2871 2871 /* Clear endpoint interrupts */ 2872 - dwc2_writel(ints, hsotg->regs + epint_reg); 2872 + dwc2_writel(hsotg, ints, epint_reg); 2873 2873 2874 2874 if (!hs_ep) { 2875 2875 dev_err(hsotg->dev, "%s:Interrupt for unconfigured ep%d(%s)\n", ··· 2897 2897 if (ints & DXEPINT_XFERCOMPL) { 2898 2898 dev_dbg(hsotg->dev, 2899 2899 "%s: XferCompl: DxEPCTL=0x%08x, DXEPTSIZ=%08x\n", 2900 - __func__, dwc2_readl(hsotg->regs + epctl_reg), 2901 - dwc2_readl(hsotg->regs + epsiz_reg)); 2900 + __func__, dwc2_readl(hsotg, epctl_reg), 2901 + dwc2_readl(hsotg, epsiz_reg)); 2902 2902 2903 2903 /* In DDMA handle isochronous requests separately */ 2904 2904 if (using_desc_dma(hsotg) && hs_ep->isochronous) { ··· 3016 3016 */ 3017 3017 static void dwc2_hsotg_irq_enumdone(struct dwc2_hsotg *hsotg) 3018 3018 { 3019 - u32 dsts = dwc2_readl(hsotg->regs + DSTS); 3019 + u32 dsts = dwc2_readl(hsotg, DSTS); 3020 3020 int ep0_mps = 0, ep_mps = 8; 3021 3021 3022 3022 /* ··· 3087 3087 dwc2_hsotg_enqueue_setup(hsotg); 3088 3088 3089 3089 dev_dbg(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n", 3090 - dwc2_readl(hsotg->regs + DIEPCTL0), 3091 - dwc2_readl(hsotg->regs + DOEPCTL0)); 3090 + dwc2_readl(hsotg, DIEPCTL0), 3091 + dwc2_readl(hsotg, DOEPCTL0)); 3092 3092 } 3093 3093 3094 3094 /** ··· 3115 3115 3116 3116 if (!hsotg->dedicated_fifos) 3117 3117 return; 3118 - size = (dwc2_readl(hsotg->regs + DTXFSTS(ep->fifo_index)) & 0xffff) * 4; 3118 + size = (dwc2_readl(hsotg, DTXFSTS(ep->fifo_index)) & 0xffff) * 4; 3119 3119 if (size < ep->fifo_size) 3120 3120 dwc2_hsotg_txfifo_flush(hsotg, ep->fifo_index); 3121 3121 } ··· 3216 3216 */ 3217 3217 3218 3218 /* keep other bits untouched (so e.g. forced modes are not lost) */ 3219 - usbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 3219 + usbcfg = dwc2_readl(hsotg, GUSBCFG); 3220 3220 usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP | 3221 3221 GUSBCFG_HNPCAP | GUSBCFG_USBTRDTIM_MASK); 3222 3222 ··· 3231 3231 usbcfg |= hsotg->phyif | GUSBCFG_TOUTCAL(7) | 3232 3232 (val << GUSBCFG_USBTRDTIM_SHIFT); 3233 3233 } 3234 - dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); 3234 + dwc2_writel(hsotg, usbcfg, GUSBCFG); 3235 3235 3236 3236 dwc2_hsotg_init_fifo(hsotg); 3237 3237 3238 3238 if (!is_usb_reset) 3239 - dwc2_set_bit(hsotg->regs + DCTL, DCTL_SFTDISCON); 3239 + dwc2_set_bit(hsotg, DCTL, DCTL_SFTDISCON); 3240 3240 3241 3241 dcfg |= DCFG_EPMISCNT(1); 3242 3242 ··· 3257 3257 if (hsotg->params.ipg_isoc_en) 3258 3258 dcfg |= DCFG_IPG_ISOC_SUPPORDED; 3259 3259 3260 - dwc2_writel(dcfg, hsotg->regs + DCFG); 3260 + dwc2_writel(hsotg, dcfg, DCFG); 3261 3261 3262 3262 /* Clear any pending OTG interrupts */ 3263 - dwc2_writel(0xffffffff, hsotg->regs + GOTGINT); 3263 + dwc2_writel(hsotg, 0xffffffff, GOTGINT); 3264 3264 3265 3265 /* Clear any pending interrupts */ 3266 - dwc2_writel(0xffffffff, hsotg->regs + GINTSTS); 3266 + dwc2_writel(hsotg, 0xffffffff, GINTSTS); 3267 3267 intmsk = GINTSTS_ERLYSUSP | GINTSTS_SESSREQINT | 3268 3268 GINTSTS_GOUTNAKEFF | GINTSTS_GINNAKEFF | 3269 3269 GINTSTS_USBRST | GINTSTS_RESETDET | ··· 3277 3277 if (!hsotg->params.external_id_pin_ctl) 3278 3278 intmsk |= GINTSTS_CONIDSTSCHNG; 3279 3279 3280 - dwc2_writel(intmsk, hsotg->regs + GINTMSK); 3280 + dwc2_writel(hsotg, intmsk, GINTMSK); 3281 3281 3282 3282 if (using_dma(hsotg)) { 3283 - dwc2_writel(GAHBCFG_GLBL_INTR_EN | GAHBCFG_DMA_EN | 3283 + dwc2_writel(hsotg, GAHBCFG_GLBL_INTR_EN | GAHBCFG_DMA_EN | 3284 3284 hsotg->params.ahbcfg, 3285 - hsotg->regs + GAHBCFG); 3285 + GAHBCFG); 3286 3286 3287 3287 /* Set DDMA mode support in the core if needed */ 3288 3288 if (using_desc_dma(hsotg)) 3289 - dwc2_set_bit(hsotg->regs + DCFG, DCFG_DESCDMA_EN); 3289 + dwc2_set_bit(hsotg, DCFG, DCFG_DESCDMA_EN); 3290 3290 3291 3291 } else { 3292 - dwc2_writel(((hsotg->dedicated_fifos) ? 3292 + dwc2_writel(hsotg, ((hsotg->dedicated_fifos) ? 3293 3293 (GAHBCFG_NP_TXF_EMP_LVL | 3294 3294 GAHBCFG_P_TXF_EMP_LVL) : 0) | 3295 - GAHBCFG_GLBL_INTR_EN, hsotg->regs + GAHBCFG); 3295 + GAHBCFG_GLBL_INTR_EN, GAHBCFG); 3296 3296 } 3297 3297 3298 3298 /* ··· 3301 3301 * interrupts. 3302 3302 */ 3303 3303 3304 - dwc2_writel(((hsotg->dedicated_fifos && !using_dma(hsotg)) ? 3304 + dwc2_writel(hsotg, ((hsotg->dedicated_fifos && !using_dma(hsotg)) ? 3305 3305 DIEPMSK_TXFIFOEMPTY | DIEPMSK_INTKNTXFEMPMSK : 0) | 3306 3306 DIEPMSK_EPDISBLDMSK | DIEPMSK_XFERCOMPLMSK | 3307 3307 DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK, 3308 - hsotg->regs + DIEPMSK); 3308 + DIEPMSK); 3309 3309 3310 3310 /* 3311 3311 * don't need XferCompl, we get that from RXFIFO in slave mode. In 3312 3312 * DMA mode we may need this and StsPhseRcvd. 3313 3313 */ 3314 - dwc2_writel((using_dma(hsotg) ? (DIEPMSK_XFERCOMPLMSK | 3314 + dwc2_writel(hsotg, (using_dma(hsotg) ? (DIEPMSK_XFERCOMPLMSK | 3315 3315 DOEPMSK_STSPHSERCVDMSK) : 0) | 3316 3316 DOEPMSK_EPDISBLDMSK | DOEPMSK_AHBERRMSK | 3317 3317 DOEPMSK_SETUPMSK, 3318 - hsotg->regs + DOEPMSK); 3318 + DOEPMSK); 3319 3319 3320 3320 /* Enable BNA interrupt for DDMA */ 3321 3321 if (using_desc_dma(hsotg)) { 3322 - dwc2_set_bit(hsotg->regs + DOEPMSK, DOEPMSK_BNAMSK); 3323 - dwc2_set_bit(hsotg->regs + DIEPMSK, DIEPMSK_BNAININTRMSK); 3322 + dwc2_set_bit(hsotg, DOEPMSK, DOEPMSK_BNAMSK); 3323 + dwc2_set_bit(hsotg, DIEPMSK, DIEPMSK_BNAININTRMSK); 3324 3324 } 3325 3325 3326 - dwc2_writel(0, hsotg->regs + DAINTMSK); 3326 + dwc2_writel(hsotg, 0, DAINTMSK); 3327 3327 3328 3328 dev_dbg(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n", 3329 - dwc2_readl(hsotg->regs + DIEPCTL0), 3330 - dwc2_readl(hsotg->regs + DOEPCTL0)); 3329 + dwc2_readl(hsotg, DIEPCTL0), 3330 + dwc2_readl(hsotg, DOEPCTL0)); 3331 3331 3332 3332 /* enable in and out endpoint interrupts */ 3333 3333 dwc2_hsotg_en_gsint(hsotg, GINTSTS_OEPINT | GINTSTS_IEPINT); ··· 3345 3345 dwc2_hsotg_ctrl_epint(hsotg, 0, 1, 1); 3346 3346 3347 3347 if (!is_usb_reset) { 3348 - dwc2_set_bit(hsotg->regs + DCTL, DCTL_PWRONPRGDONE); 3348 + dwc2_set_bit(hsotg, DCTL, DCTL_PWRONPRGDONE); 3349 3349 udelay(10); /* see openiboot */ 3350 - dwc2_clear_bit(hsotg->regs + DCTL, DCTL_PWRONPRGDONE); 3350 + dwc2_clear_bit(hsotg, DCTL, DCTL_PWRONPRGDONE); 3351 3351 } 3352 3352 3353 - dev_dbg(hsotg->dev, "DCTL=0x%08x\n", dwc2_readl(hsotg->regs + DCTL)); 3353 + dev_dbg(hsotg->dev, "DCTL=0x%08x\n", dwc2_readl(hsotg, DCTL)); 3354 3354 3355 3355 /* 3356 3356 * DxEPCTL_USBActEp says RO in manual, but seems to be set by ··· 3358 3358 */ 3359 3359 3360 3360 /* set to read 1 8byte packet */ 3361 - dwc2_writel(DXEPTSIZ_MC(1) | DXEPTSIZ_PKTCNT(1) | 3362 - DXEPTSIZ_XFERSIZE(8), hsotg->regs + DOEPTSIZ0); 3361 + dwc2_writel(hsotg, DXEPTSIZ_MC(1) | DXEPTSIZ_PKTCNT(1) | 3362 + DXEPTSIZ_XFERSIZE(8), DOEPTSIZ0); 3363 3363 3364 - dwc2_writel(dwc2_hsotg_ep0_mps(hsotg->eps_out[0]->ep.maxpacket) | 3364 + dwc2_writel(hsotg, dwc2_hsotg_ep0_mps(hsotg->eps_out[0]->ep.maxpacket) | 3365 3365 DXEPCTL_CNAK | DXEPCTL_EPENA | 3366 3366 DXEPCTL_USBACTEP, 3367 - hsotg->regs + DOEPCTL0); 3367 + DOEPCTL0); 3368 3368 3369 3369 /* enable, but don't activate EP0in */ 3370 - dwc2_writel(dwc2_hsotg_ep0_mps(hsotg->eps_out[0]->ep.maxpacket) | 3371 - DXEPCTL_USBACTEP, hsotg->regs + DIEPCTL0); 3370 + dwc2_writel(hsotg, dwc2_hsotg_ep0_mps(hsotg->eps_out[0]->ep.maxpacket) | 3371 + DXEPCTL_USBACTEP, DIEPCTL0); 3372 3372 3373 3373 /* clear global NAKs */ 3374 3374 val = DCTL_CGOUTNAK | DCTL_CGNPINNAK; 3375 3375 if (!is_usb_reset) 3376 3376 val |= DCTL_SFTDISCON; 3377 - dwc2_set_bit(hsotg->regs + DCTL, val); 3377 + dwc2_set_bit(hsotg, DCTL, val); 3378 3378 3379 3379 /* configure the core to support LPM */ 3380 3380 dwc2_gadget_init_lpm(hsotg); ··· 3387 3387 dwc2_hsotg_enqueue_setup(hsotg); 3388 3388 3389 3389 dev_dbg(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n", 3390 - dwc2_readl(hsotg->regs + DIEPCTL0), 3391 - dwc2_readl(hsotg->regs + DOEPCTL0)); 3390 + dwc2_readl(hsotg, DIEPCTL0), 3391 + dwc2_readl(hsotg, DOEPCTL0)); 3392 3392 } 3393 3393 3394 3394 static void dwc2_hsotg_core_disconnect(struct dwc2_hsotg *hsotg) 3395 3395 { 3396 3396 /* set the soft-disconnect bit */ 3397 - dwc2_set_bit(hsotg->regs + DCTL, DCTL_SFTDISCON); 3397 + dwc2_set_bit(hsotg, DCTL, DCTL_SFTDISCON); 3398 3398 } 3399 3399 3400 3400 void dwc2_hsotg_core_connect(struct dwc2_hsotg *hsotg) 3401 3401 { 3402 3402 /* remove the soft-disconnect and let's go */ 3403 - dwc2_clear_bit(hsotg->regs + DCTL, DCTL_SFTDISCON); 3403 + dwc2_clear_bit(hsotg, DCTL, DCTL_SFTDISCON); 3404 3404 } 3405 3405 3406 3406 /** ··· 3425 3425 3426 3426 dev_dbg(hsotg->dev, "Incomplete isoc in interrupt received:\n"); 3427 3427 3428 - daintmsk = dwc2_readl(hsotg->regs + DAINTMSK); 3428 + daintmsk = dwc2_readl(hsotg, DAINTMSK); 3429 3429 3430 3430 for (idx = 1; idx < hsotg->num_of_eps; idx++) { 3431 3431 hs_ep = hsotg->eps_in[idx]; ··· 3433 3433 if (!hs_ep->isochronous || (BIT(idx) & ~daintmsk)) 3434 3434 continue; 3435 3435 3436 - epctrl = dwc2_readl(hsotg->regs + DIEPCTL(idx)); 3436 + epctrl = dwc2_readl(hsotg, DIEPCTL(idx)); 3437 3437 if ((epctrl & DXEPCTL_EPENA) && 3438 3438 dwc2_gadget_target_frame_elapsed(hs_ep)) { 3439 3439 epctrl |= DXEPCTL_SNAK; 3440 3440 epctrl |= DXEPCTL_EPDIS; 3441 - dwc2_writel(epctrl, hsotg->regs + DIEPCTL(idx)); 3441 + dwc2_writel(hsotg, epctrl, DIEPCTL(idx)); 3442 3442 } 3443 3443 } 3444 3444 3445 3445 /* Clear interrupt */ 3446 - dwc2_writel(GINTSTS_INCOMPL_SOIN, hsotg->regs + GINTSTS); 3446 + dwc2_writel(hsotg, GINTSTS_INCOMPL_SOIN, GINTSTS); 3447 3447 } 3448 3448 3449 3449 /** ··· 3470 3470 3471 3471 dev_dbg(hsotg->dev, "%s: GINTSTS_INCOMPL_SOOUT\n", __func__); 3472 3472 3473 - daintmsk = dwc2_readl(hsotg->regs + DAINTMSK); 3473 + daintmsk = dwc2_readl(hsotg, DAINTMSK); 3474 3474 daintmsk >>= DAINT_OUTEP_SHIFT; 3475 3475 3476 3476 for (idx = 1; idx < hsotg->num_of_eps; idx++) { ··· 3479 3479 if (!hs_ep->isochronous || (BIT(idx) & ~daintmsk)) 3480 3480 continue; 3481 3481 3482 - epctrl = dwc2_readl(hsotg->regs + DOEPCTL(idx)); 3482 + epctrl = dwc2_readl(hsotg, DOEPCTL(idx)); 3483 3483 if ((epctrl & DXEPCTL_EPENA) && 3484 3484 dwc2_gadget_target_frame_elapsed(hs_ep)) { 3485 3485 /* Unmask GOUTNAKEFF interrupt */ 3486 - gintmsk = dwc2_readl(hsotg->regs + GINTMSK); 3486 + gintmsk = dwc2_readl(hsotg, GINTMSK); 3487 3487 gintmsk |= GINTSTS_GOUTNAKEFF; 3488 - dwc2_writel(gintmsk, hsotg->regs + GINTMSK); 3488 + dwc2_writel(hsotg, gintmsk, GINTMSK); 3489 3489 3490 - gintsts = dwc2_readl(hsotg->regs + GINTSTS); 3490 + gintsts = dwc2_readl(hsotg, GINTSTS); 3491 3491 if (!(gintsts & GINTSTS_GOUTNAKEFF)) { 3492 - dwc2_set_bit(hsotg->regs + DCTL, DCTL_SGOUTNAK); 3492 + dwc2_set_bit(hsotg, DCTL, DCTL_SGOUTNAK); 3493 3493 break; 3494 3494 } 3495 3495 } 3496 3496 } 3497 3497 3498 3498 /* Clear interrupt */ 3499 - dwc2_writel(GINTSTS_INCOMPL_SOOUT, hsotg->regs + GINTSTS); 3499 + dwc2_writel(hsotg, GINTSTS_INCOMPL_SOOUT, GINTSTS); 3500 3500 } 3501 3501 3502 3502 /** ··· 3516 3516 3517 3517 spin_lock(&hsotg->lock); 3518 3518 irq_retry: 3519 - gintsts = dwc2_readl(hsotg->regs + GINTSTS); 3520 - gintmsk = dwc2_readl(hsotg->regs + GINTMSK); 3519 + gintsts = dwc2_readl(hsotg, GINTSTS); 3520 + gintmsk = dwc2_readl(hsotg, GINTMSK); 3521 3521 3522 3522 dev_dbg(hsotg->dev, "%s: %08x %08x (%08x) retry %d\n", 3523 3523 __func__, gintsts, gintsts & gintmsk, gintmsk, retry_count); ··· 3527 3527 if (gintsts & GINTSTS_RESETDET) { 3528 3528 dev_dbg(hsotg->dev, "%s: USBRstDet\n", __func__); 3529 3529 3530 - dwc2_writel(GINTSTS_RESETDET, hsotg->regs + GINTSTS); 3530 + dwc2_writel(hsotg, GINTSTS_RESETDET, GINTSTS); 3531 3531 3532 3532 /* This event must be used only if controller is suspended */ 3533 3533 if (hsotg->lx_state == DWC2_L2) { ··· 3537 3537 } 3538 3538 3539 3539 if (gintsts & (GINTSTS_USBRST | GINTSTS_RESETDET)) { 3540 - u32 usb_status = dwc2_readl(hsotg->regs + GOTGCTL); 3540 + u32 usb_status = dwc2_readl(hsotg, GOTGCTL); 3541 3541 u32 connected = hsotg->connected; 3542 3542 3543 3543 dev_dbg(hsotg->dev, "%s: USBRst\n", __func__); 3544 3544 dev_dbg(hsotg->dev, "GNPTXSTS=%08x\n", 3545 - dwc2_readl(hsotg->regs + GNPTXSTS)); 3545 + dwc2_readl(hsotg, GNPTXSTS)); 3546 3546 3547 - dwc2_writel(GINTSTS_USBRST, hsotg->regs + GINTSTS); 3547 + dwc2_writel(hsotg, GINTSTS_USBRST, GINTSTS); 3548 3548 3549 3549 /* Report disconnection if it is not already done. */ 3550 3550 dwc2_hsotg_disconnect(hsotg); 3551 3551 3552 3552 /* Reset device address to zero */ 3553 - dwc2_clear_bit(hsotg->regs + DCFG, DCFG_DEVADDR_MASK); 3553 + dwc2_clear_bit(hsotg, DCFG, DCFG_DEVADDR_MASK); 3554 3554 3555 3555 if (usb_status & GOTGCTL_BSESVLD && connected) 3556 3556 dwc2_hsotg_core_init_disconnected(hsotg, true); 3557 3557 } 3558 3558 3559 3559 if (gintsts & GINTSTS_ENUMDONE) { 3560 - dwc2_writel(GINTSTS_ENUMDONE, hsotg->regs + GINTSTS); 3560 + dwc2_writel(hsotg, GINTSTS_ENUMDONE, GINTSTS); 3561 3561 3562 3562 dwc2_hsotg_irq_enumdone(hsotg); 3563 3563 } 3564 3564 3565 3565 if (gintsts & (GINTSTS_OEPINT | GINTSTS_IEPINT)) { 3566 - u32 daint = dwc2_readl(hsotg->regs + DAINT); 3567 - u32 daintmsk = dwc2_readl(hsotg->regs + DAINTMSK); 3566 + u32 daint = dwc2_readl(hsotg, DAINT); 3567 + u32 daintmsk = dwc2_readl(hsotg, DAINTMSK); 3568 3568 u32 daint_out, daint_in; 3569 3569 int ep; 3570 3570 ··· 3623 3623 3624 3624 if (gintsts & GINTSTS_ERLYSUSP) { 3625 3625 dev_dbg(hsotg->dev, "GINTSTS_ErlySusp\n"); 3626 - dwc2_writel(GINTSTS_ERLYSUSP, hsotg->regs + GINTSTS); 3626 + dwc2_writel(hsotg, GINTSTS_ERLYSUSP, GINTSTS); 3627 3627 } 3628 3628 3629 3629 /* ··· 3639 3639 u32 daintmsk; 3640 3640 struct dwc2_hsotg_ep *hs_ep; 3641 3641 3642 - daintmsk = dwc2_readl(hsotg->regs + DAINTMSK); 3642 + daintmsk = dwc2_readl(hsotg, DAINTMSK); 3643 3643 daintmsk >>= DAINT_OUTEP_SHIFT; 3644 3644 /* Mask this interrupt */ 3645 - gintmsk = dwc2_readl(hsotg->regs + GINTMSK); 3645 + gintmsk = dwc2_readl(hsotg, GINTMSK); 3646 3646 gintmsk &= ~GINTSTS_GOUTNAKEFF; 3647 - dwc2_writel(gintmsk, hsotg->regs + GINTMSK); 3647 + dwc2_writel(hsotg, gintmsk, GINTMSK); 3648 3648 3649 3649 dev_dbg(hsotg->dev, "GOUTNakEff triggered\n"); 3650 3650 for (idx = 1; idx < hsotg->num_of_eps; idx++) { ··· 3653 3653 if (!hs_ep->isochronous || (BIT(idx) & ~daintmsk)) 3654 3654 continue; 3655 3655 3656 - epctrl = dwc2_readl(hsotg->regs + DOEPCTL(idx)); 3656 + epctrl = dwc2_readl(hsotg, DOEPCTL(idx)); 3657 3657 3658 3658 if (epctrl & DXEPCTL_EPENA) { 3659 3659 epctrl |= DXEPCTL_SNAK; 3660 3660 epctrl |= DXEPCTL_EPDIS; 3661 - dwc2_writel(epctrl, hsotg->regs + DOEPCTL(idx)); 3661 + dwc2_writel(hsotg, epctrl, DOEPCTL(idx)); 3662 3662 } 3663 3663 } 3664 3664 ··· 3668 3668 if (gintsts & GINTSTS_GINNAKEFF) { 3669 3669 dev_info(hsotg->dev, "GINNakEff triggered\n"); 3670 3670 3671 - dwc2_set_bit(hsotg->regs + DCTL, DCTL_CGNPINNAK); 3671 + dwc2_set_bit(hsotg, DCTL, DCTL_CGNPINNAK); 3672 3672 3673 3673 dwc2_hsotg_dump(hsotg); 3674 3674 } ··· 3708 3708 3709 3709 if (hs_ep->dir_in) { 3710 3710 if (hsotg->dedicated_fifos || hs_ep->periodic) { 3711 - dwc2_set_bit(hsotg->regs + epctrl_reg, DXEPCTL_SNAK); 3711 + dwc2_set_bit(hsotg, epctrl_reg, DXEPCTL_SNAK); 3712 3712 /* Wait for Nak effect */ 3713 3713 if (dwc2_hsotg_wait_bit_set(hsotg, epint_reg, 3714 3714 DXEPINT_INEPNAKEFF, 100)) ··· 3716 3716 "%s: timeout DIEPINT.NAKEFF\n", 3717 3717 __func__); 3718 3718 } else { 3719 - dwc2_set_bit(hsotg->regs + DCTL, DCTL_SGNPINNAK); 3719 + dwc2_set_bit(hsotg, DCTL, DCTL_SGNPINNAK); 3720 3720 /* Wait for Nak effect */ 3721 3721 if (dwc2_hsotg_wait_bit_set(hsotg, GINTSTS, 3722 3722 GINTSTS_GINNAKEFF, 100)) ··· 3725 3725 __func__); 3726 3726 } 3727 3727 } else { 3728 - if (!(dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_GOUTNAKEFF)) 3729 - dwc2_set_bit(hsotg->regs + DCTL, DCTL_SGOUTNAK); 3728 + if (!(dwc2_readl(hsotg, GINTSTS) & GINTSTS_GOUTNAKEFF)) 3729 + dwc2_set_bit(hsotg, DCTL, DCTL_SGOUTNAK); 3730 3730 3731 3731 /* Wait for global nak to take effect */ 3732 3732 if (dwc2_hsotg_wait_bit_set(hsotg, GINTSTS, ··· 3736 3736 } 3737 3737 3738 3738 /* Disable ep */ 3739 - dwc2_set_bit(hsotg->regs + epctrl_reg, DXEPCTL_EPDIS | DXEPCTL_SNAK); 3739 + dwc2_set_bit(hsotg, epctrl_reg, DXEPCTL_EPDIS | DXEPCTL_SNAK); 3740 3740 3741 3741 /* Wait for ep to be disabled */ 3742 3742 if (dwc2_hsotg_wait_bit_set(hsotg, epint_reg, DXEPINT_EPDISBLD, 100)) ··· 3744 3744 "%s: timeout DOEPCTL.EPDisable\n", __func__); 3745 3745 3746 3746 /* Clear EPDISBLD interrupt */ 3747 - dwc2_set_bit(hsotg->regs + epint_reg, DXEPINT_EPDISBLD); 3747 + dwc2_set_bit(hsotg, epint_reg, DXEPINT_EPDISBLD); 3748 3748 3749 3749 if (hs_ep->dir_in) { 3750 3750 unsigned short fifo_index; ··· 3759 3759 3760 3760 /* Clear Global In NP NAK in Shared FIFO for non periodic ep */ 3761 3761 if (!hsotg->dedicated_fifos && !hs_ep->periodic) 3762 - dwc2_set_bit(hsotg->regs + DCTL, DCTL_CGNPINNAK); 3762 + dwc2_set_bit(hsotg, DCTL, DCTL_CGNPINNAK); 3763 3763 3764 3764 } else { 3765 3765 /* Remove global NAKs */ 3766 - dwc2_set_bit(hsotg->regs + DCTL, DCTL_CGOUTNAK); 3766 + dwc2_set_bit(hsotg, DCTL, DCTL_CGOUTNAK); 3767 3767 } 3768 3768 } 3769 3769 ··· 3831 3831 /* note, we handle this here instead of dwc2_hsotg_set_ep_maxpacket */ 3832 3832 3833 3833 epctrl_reg = dir_in ? DIEPCTL(index) : DOEPCTL(index); 3834 - epctrl = dwc2_readl(hsotg->regs + epctrl_reg); 3834 + epctrl = dwc2_readl(hsotg, epctrl_reg); 3835 3835 3836 3836 dev_dbg(hsotg->dev, "%s: read DxEPCTL=0x%08x from 0x%08x\n", 3837 3837 __func__, epctrl, epctrl_reg); ··· 3879 3879 hs_ep->compl_desc = 0; 3880 3880 if (dir_in) { 3881 3881 hs_ep->periodic = 1; 3882 - mask = dwc2_readl(hsotg->regs + DIEPMSK); 3882 + mask = dwc2_readl(hsotg, DIEPMSK); 3883 3883 mask |= DIEPMSK_NAKMSK; 3884 - dwc2_writel(mask, hsotg->regs + DIEPMSK); 3884 + dwc2_writel(hsotg, mask, DIEPMSK); 3885 3885 } else { 3886 - mask = dwc2_readl(hsotg->regs + DOEPMSK); 3886 + mask = dwc2_readl(hsotg, DOEPMSK); 3887 3887 mask |= DOEPMSK_OUTTKNEPDISMSK; 3888 - dwc2_writel(mask, hsotg->regs + DOEPMSK); 3888 + dwc2_writel(hsotg, mask, DOEPMSK); 3889 3889 } 3890 3890 break; 3891 3891 ··· 3920 3920 for (i = 1; i < hsotg->num_of_eps; ++i) { 3921 3921 if (hsotg->fifo_map & (1 << i)) 3922 3922 continue; 3923 - val = dwc2_readl(hsotg->regs + DPTXFSIZN(i)); 3923 + val = dwc2_readl(hsotg, DPTXFSIZN(i)); 3924 3924 val = (val >> FIFOSIZE_DEPTH_SHIFT) * 4; 3925 3925 if (val < size) 3926 3926 continue; ··· 3958 3958 * to 4.00a (including both). Also for FS_IOT_1.00a 3959 3959 * and HS_IOT_1.00a. 3960 3960 */ 3961 - u32 gsnpsid = dwc2_readl(hsotg->regs + GSNPSID); 3961 + u32 gsnpsid = dwc2_readl(hsotg, GSNPSID); 3962 3962 3963 3963 if ((gsnpsid >= DWC2_CORE_REV_2_72a && 3964 3964 gsnpsid <= DWC2_CORE_REV_4_00a) || ··· 3970 3970 dev_dbg(hsotg->dev, "%s: write DxEPCTL=0x%08x\n", 3971 3971 __func__, epctrl); 3972 3972 3973 - dwc2_writel(epctrl, hsotg->regs + epctrl_reg); 3973 + dwc2_writel(hsotg, epctrl, epctrl_reg); 3974 3974 dev_dbg(hsotg->dev, "%s: read DxEPCTL=0x%08x\n", 3975 - __func__, dwc2_readl(hsotg->regs + epctrl_reg)); 3975 + __func__, dwc2_readl(hsotg, epctrl_reg)); 3976 3976 3977 3977 /* enable the endpoint interrupt */ 3978 3978 dwc2_hsotg_ctrl_epint(hsotg, index, dir_in, 1); ··· 4021 4021 4022 4022 spin_lock_irqsave(&hsotg->lock, flags); 4023 4023 4024 - ctrl = dwc2_readl(hsotg->regs + epctrl_reg); 4024 + ctrl = dwc2_readl(hsotg, epctrl_reg); 4025 4025 4026 4026 if (ctrl & DXEPCTL_EPENA) 4027 4027 dwc2_hsotg_ep_stop_xfr(hsotg, hs_ep); ··· 4031 4031 ctrl |= DXEPCTL_SNAK; 4032 4032 4033 4033 dev_dbg(hsotg->dev, "%s: DxEPCTL=0x%08x\n", __func__, ctrl); 4034 - dwc2_writel(ctrl, hsotg->regs + epctrl_reg); 4034 + dwc2_writel(hsotg, ctrl, epctrl_reg); 4035 4035 4036 4036 /* disable endpoint interrupts */ 4037 4037 dwc2_hsotg_ctrl_epint(hsotg, hs_ep->index, hs_ep->dir_in, 0); ··· 4138 4138 4139 4139 if (hs_ep->dir_in) { 4140 4140 epreg = DIEPCTL(index); 4141 - epctl = dwc2_readl(hs->regs + epreg); 4141 + epctl = dwc2_readl(hs, epreg); 4142 4142 4143 4143 if (value) { 4144 4144 epctl |= DXEPCTL_STALL | DXEPCTL_SNAK; ··· 4151 4151 xfertype == DXEPCTL_EPTYPE_INTERRUPT) 4152 4152 epctl |= DXEPCTL_SETD0PID; 4153 4153 } 4154 - dwc2_writel(epctl, hs->regs + epreg); 4154 + dwc2_writel(hs, epctl, epreg); 4155 4155 } else { 4156 4156 epreg = DOEPCTL(index); 4157 - epctl = dwc2_readl(hs->regs + epreg); 4157 + epctl = dwc2_readl(hs, epreg); 4158 4158 4159 4159 if (value) { 4160 4160 epctl |= DXEPCTL_STALL; ··· 4165 4165 xfertype == DXEPCTL_EPTYPE_INTERRUPT) 4166 4166 epctl |= DXEPCTL_SETD0PID; 4167 4167 } 4168 - dwc2_writel(epctl, hs->regs + epreg); 4168 + dwc2_writel(hs, epctl, epreg); 4169 4169 } 4170 4170 4171 4171 hs_ep->halted = value; ··· 4213 4213 u32 usbcfg; 4214 4214 /* unmask subset of endpoint interrupts */ 4215 4215 4216 - dwc2_writel(DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK | 4216 + dwc2_writel(hsotg, DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK | 4217 4217 DIEPMSK_EPDISBLDMSK | DIEPMSK_XFERCOMPLMSK, 4218 - hsotg->regs + DIEPMSK); 4218 + DIEPMSK); 4219 4219 4220 - dwc2_writel(DOEPMSK_SETUPMSK | DOEPMSK_AHBERRMSK | 4220 + dwc2_writel(hsotg, DOEPMSK_SETUPMSK | DOEPMSK_AHBERRMSK | 4221 4221 DOEPMSK_EPDISBLDMSK | DOEPMSK_XFERCOMPLMSK, 4222 - hsotg->regs + DOEPMSK); 4222 + DOEPMSK); 4223 4223 4224 - dwc2_writel(0, hsotg->regs + DAINTMSK); 4224 + dwc2_writel(hsotg, 0, DAINTMSK); 4225 4225 4226 4226 /* Be in disconnected state until gadget is registered */ 4227 - dwc2_set_bit(hsotg->regs + DCTL, DCTL_SFTDISCON); 4227 + dwc2_set_bit(hsotg, DCTL, DCTL_SFTDISCON); 4228 4228 4229 4229 /* setup fifos */ 4230 4230 4231 4231 dev_dbg(hsotg->dev, "GRXFSIZ=0x%08x, GNPTXFSIZ=0x%08x\n", 4232 - dwc2_readl(hsotg->regs + GRXFSIZ), 4233 - dwc2_readl(hsotg->regs + GNPTXFSIZ)); 4232 + dwc2_readl(hsotg, GRXFSIZ), 4233 + dwc2_readl(hsotg, GNPTXFSIZ)); 4234 4234 4235 4235 dwc2_hsotg_init_fifo(hsotg); 4236 4236 4237 4237 /* keep other bits untouched (so e.g. forced modes are not lost) */ 4238 - usbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 4238 + usbcfg = dwc2_readl(hsotg, GUSBCFG); 4239 4239 usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP | 4240 4240 GUSBCFG_HNPCAP | GUSBCFG_USBTRDTIM_MASK); 4241 4241 ··· 4243 4243 trdtim = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5; 4244 4244 usbcfg |= hsotg->phyif | GUSBCFG_TOUTCAL(7) | 4245 4245 (trdtim << GUSBCFG_USBTRDTIM_SHIFT); 4246 - dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); 4246 + dwc2_writel(hsotg, usbcfg, GUSBCFG); 4247 4247 4248 4248 if (using_dma(hsotg)) 4249 - dwc2_set_bit(hsotg->regs + GAHBCFG, GAHBCFG_DMA_EN); 4249 + dwc2_set_bit(hsotg, GAHBCFG, GAHBCFG_DMA_EN); 4250 4250 } 4251 4251 4252 4252 /** ··· 4536 4536 u32 next = DXEPCTL_NEXTEP((epnum + 1) % 15); 4537 4537 4538 4538 if (dir_in) 4539 - dwc2_writel(next, hsotg->regs + DIEPCTL(epnum)); 4539 + dwc2_writel(hsotg, next, DIEPCTL(epnum)); 4540 4540 else 4541 - dwc2_writel(next, hsotg->regs + DOEPCTL(epnum)); 4541 + dwc2_writel(hsotg, next, DOEPCTL(epnum)); 4542 4542 } 4543 4543 } 4544 4544 ··· 4607 4607 { 4608 4608 #ifdef DEBUG 4609 4609 struct device *dev = hsotg->dev; 4610 - void __iomem *regs = hsotg->regs; 4611 4610 u32 val; 4612 4611 int idx; 4613 4612 4614 4613 dev_info(dev, "DCFG=0x%08x, DCTL=0x%08x, DIEPMSK=%08x\n", 4615 - dwc2_readl(regs + DCFG), dwc2_readl(regs + DCTL), 4616 - dwc2_readl(regs + DIEPMSK)); 4614 + dwc2_readl(hsotg, DCFG), dwc2_readl(hsotg, DCTL), 4615 + dwc2_readl(hsotg, DIEPMSK)); 4617 4616 4618 4617 dev_info(dev, "GAHBCFG=0x%08x, GHWCFG1=0x%08x\n", 4619 - dwc2_readl(regs + GAHBCFG), dwc2_readl(regs + GHWCFG1)); 4618 + dwc2_readl(hsotg, GAHBCFG), dwc2_readl(hsotg, GHWCFG1)); 4620 4619 4621 4620 dev_info(dev, "GRXFSIZ=0x%08x, GNPTXFSIZ=0x%08x\n", 4622 - dwc2_readl(regs + GRXFSIZ), dwc2_readl(regs + GNPTXFSIZ)); 4621 + dwc2_readl(hsotg, GRXFSIZ), dwc2_readl(hsotg, GNPTXFSIZ)); 4623 4622 4624 4623 /* show periodic fifo settings */ 4625 4624 4626 4625 for (idx = 1; idx < hsotg->num_of_eps; idx++) { 4627 - val = dwc2_readl(regs + DPTXFSIZN(idx)); 4626 + val = dwc2_readl(hsotg, DPTXFSIZN(idx)); 4628 4627 dev_info(dev, "DPTx[%d] FSize=%d, StAddr=0x%08x\n", idx, 4629 4628 val >> FIFOSIZE_DEPTH_SHIFT, 4630 4629 val & FIFOSIZE_STARTADDR_MASK); ··· 4632 4633 for (idx = 0; idx < hsotg->num_of_eps; idx++) { 4633 4634 dev_info(dev, 4634 4635 "ep%d-in: EPCTL=0x%08x, SIZ=0x%08x, DMA=0x%08x\n", idx, 4635 - dwc2_readl(regs + DIEPCTL(idx)), 4636 - dwc2_readl(regs + DIEPTSIZ(idx)), 4637 - dwc2_readl(regs + DIEPDMA(idx))); 4636 + dwc2_readl(hsotg, DIEPCTL(idx)), 4637 + dwc2_readl(hsotg, DIEPTSIZ(idx)), 4638 + dwc2_readl(hsotg, DIEPDMA(idx))); 4638 4639 4639 - val = dwc2_readl(regs + DOEPCTL(idx)); 4640 + val = dwc2_readl(hsotg, DOEPCTL(idx)); 4640 4641 dev_info(dev, 4641 4642 "ep%d-out: EPCTL=0x%08x, SIZ=0x%08x, DMA=0x%08x\n", 4642 - idx, dwc2_readl(regs + DOEPCTL(idx)), 4643 - dwc2_readl(regs + DOEPTSIZ(idx)), 4644 - dwc2_readl(regs + DOEPDMA(idx))); 4643 + idx, dwc2_readl(hsotg, DOEPCTL(idx)), 4644 + dwc2_readl(hsotg, DOEPTSIZ(idx)), 4645 + dwc2_readl(hsotg, DOEPDMA(idx))); 4645 4646 } 4646 4647 4647 4648 dev_info(dev, "DVBUSDIS=0x%08x, DVBUSPULSE=%08x\n", 4648 - dwc2_readl(regs + DVBUSDIS), dwc2_readl(regs + DVBUSPULSE)); 4649 + dwc2_readl(hsotg, DVBUSDIS), dwc2_readl(hsotg, DVBUSPULSE)); 4649 4650 #endif 4650 4651 } 4651 4652 ··· 4834 4835 /* Backup dev regs */ 4835 4836 dr = &hsotg->dr_backup; 4836 4837 4837 - dr->dcfg = dwc2_readl(hsotg->regs + DCFG); 4838 - dr->dctl = dwc2_readl(hsotg->regs + DCTL); 4839 - dr->daintmsk = dwc2_readl(hsotg->regs + DAINTMSK); 4840 - dr->diepmsk = dwc2_readl(hsotg->regs + DIEPMSK); 4841 - dr->doepmsk = dwc2_readl(hsotg->regs + DOEPMSK); 4838 + dr->dcfg = dwc2_readl(hsotg, DCFG); 4839 + dr->dctl = dwc2_readl(hsotg, DCTL); 4840 + dr->daintmsk = dwc2_readl(hsotg, DAINTMSK); 4841 + dr->diepmsk = dwc2_readl(hsotg, DIEPMSK); 4842 + dr->doepmsk = dwc2_readl(hsotg, DOEPMSK); 4842 4843 4843 4844 for (i = 0; i < hsotg->num_of_eps; i++) { 4844 4845 /* Backup IN EPs */ 4845 - dr->diepctl[i] = dwc2_readl(hsotg->regs + DIEPCTL(i)); 4846 + dr->diepctl[i] = dwc2_readl(hsotg, DIEPCTL(i)); 4846 4847 4847 4848 /* Ensure DATA PID is correctly configured */ 4848 4849 if (dr->diepctl[i] & DXEPCTL_DPID) ··· 4850 4851 else 4851 4852 dr->diepctl[i] |= DXEPCTL_SETD0PID; 4852 4853 4853 - dr->dieptsiz[i] = dwc2_readl(hsotg->regs + DIEPTSIZ(i)); 4854 - dr->diepdma[i] = dwc2_readl(hsotg->regs + DIEPDMA(i)); 4854 + dr->dieptsiz[i] = dwc2_readl(hsotg, DIEPTSIZ(i)); 4855 + dr->diepdma[i] = dwc2_readl(hsotg, DIEPDMA(i)); 4855 4856 4856 4857 /* Backup OUT EPs */ 4857 - dr->doepctl[i] = dwc2_readl(hsotg->regs + DOEPCTL(i)); 4858 + dr->doepctl[i] = dwc2_readl(hsotg, DOEPCTL(i)); 4858 4859 4859 4860 /* Ensure DATA PID is correctly configured */ 4860 4861 if (dr->doepctl[i] & DXEPCTL_DPID) ··· 4862 4863 else 4863 4864 dr->doepctl[i] |= DXEPCTL_SETD0PID; 4864 4865 4865 - dr->doeptsiz[i] = dwc2_readl(hsotg->regs + DOEPTSIZ(i)); 4866 - dr->doepdma[i] = dwc2_readl(hsotg->regs + DOEPDMA(i)); 4867 - dr->dtxfsiz[i] = dwc2_readl(hsotg->regs + DPTXFSIZN(i)); 4866 + dr->doeptsiz[i] = dwc2_readl(hsotg, DOEPTSIZ(i)); 4867 + dr->doepdma[i] = dwc2_readl(hsotg, DOEPDMA(i)); 4868 + dr->dtxfsiz[i] = dwc2_readl(hsotg, DPTXFSIZN(i)); 4868 4869 } 4869 4870 dr->valid = true; 4870 4871 return 0; ··· 4897 4898 dr->valid = false; 4898 4899 4899 4900 if (!remote_wakeup) 4900 - dwc2_writel(dr->dctl, hsotg->regs + DCTL); 4901 + dwc2_writel(hsotg, dr->dctl, DCTL); 4901 4902 4902 - dwc2_writel(dr->daintmsk, hsotg->regs + DAINTMSK); 4903 - dwc2_writel(dr->diepmsk, hsotg->regs + DIEPMSK); 4904 - dwc2_writel(dr->doepmsk, hsotg->regs + DOEPMSK); 4903 + dwc2_writel(hsotg, dr->daintmsk, DAINTMSK); 4904 + dwc2_writel(hsotg, dr->diepmsk, DIEPMSK); 4905 + dwc2_writel(hsotg, dr->doepmsk, DOEPMSK); 4905 4906 4906 4907 for (i = 0; i < hsotg->num_of_eps; i++) { 4907 4908 /* Restore IN EPs */ 4908 - dwc2_writel(dr->dieptsiz[i], hsotg->regs + DIEPTSIZ(i)); 4909 - dwc2_writel(dr->diepdma[i], hsotg->regs + DIEPDMA(i)); 4910 - dwc2_writel(dr->doeptsiz[i], hsotg->regs + DOEPTSIZ(i)); 4909 + dwc2_writel(hsotg, dr->dieptsiz[i], DIEPTSIZ(i)); 4910 + dwc2_writel(hsotg, dr->diepdma[i], DIEPDMA(i)); 4911 + dwc2_writel(hsotg, dr->doeptsiz[i], DOEPTSIZ(i)); 4911 4912 /** WA for enabled EPx's IN in DDMA mode. On entering to 4912 4913 * hibernation wrong value read and saved from DIEPDMAx, 4913 4914 * as result BNA interrupt asserted on hibernation exit ··· 4916 4917 if (hsotg->params.g_dma_desc && 4917 4918 (dr->diepctl[i] & DXEPCTL_EPENA)) 4918 4919 dr->diepdma[i] = hsotg->eps_in[i]->desc_list_dma; 4919 - dwc2_writel(dr->dtxfsiz[i], hsotg->regs + DPTXFSIZN(i)); 4920 - dwc2_writel(dr->diepctl[i], hsotg->regs + DIEPCTL(i)); 4920 + dwc2_writel(hsotg, dr->dtxfsiz[i], DPTXFSIZN(i)); 4921 + dwc2_writel(hsotg, dr->diepctl[i], DIEPCTL(i)); 4921 4922 /* Restore OUT EPs */ 4922 - dwc2_writel(dr->doeptsiz[i], hsotg->regs + DOEPTSIZ(i)); 4923 + dwc2_writel(hsotg, dr->doeptsiz[i], DOEPTSIZ(i)); 4923 4924 /* WA for enabled EPx's OUT in DDMA mode. On entering to 4924 4925 * hibernation wrong value read and saved from DOEPDMAx, 4925 4926 * as result BNA interrupt asserted on hibernation exit ··· 4928 4929 if (hsotg->params.g_dma_desc && 4929 4930 (dr->doepctl[i] & DXEPCTL_EPENA)) 4930 4931 dr->doepdma[i] = hsotg->eps_out[i]->desc_list_dma; 4931 - dwc2_writel(dr->doepdma[i], hsotg->regs + DOEPDMA(i)); 4932 - dwc2_writel(dr->doepctl[i], hsotg->regs + DOEPCTL(i)); 4932 + dwc2_writel(hsotg, dr->doepdma[i], DOEPDMA(i)); 4933 + dwc2_writel(hsotg, dr->doepctl[i], DOEPCTL(i)); 4933 4934 } 4934 4935 4935 4936 return 0; ··· 4953 4954 val |= hsotg->params.lpm_clock_gating ? GLPMCFG_ENBLSLPM : 0; 4954 4955 val |= hsotg->params.hird_threshold << GLPMCFG_HIRD_THRES_SHIFT; 4955 4956 val |= hsotg->params.besl ? GLPMCFG_ENBESL : 0; 4956 - dwc2_writel(val, hsotg->regs + GLPMCFG); 4957 - dev_dbg(hsotg->dev, "GLPMCFG=0x%08x\n", dwc2_readl(hsotg->regs 4958 - + GLPMCFG)); 4957 + dwc2_writel(hsotg, val, GLPMCFG); 4958 + dev_dbg(hsotg->dev, "GLPMCFG=0x%08x\n", dwc2_readl(hsotg, GLPMCFG)); 4959 4959 } 4960 4960 4961 4961 /** ··· 4987 4989 4988 4990 gpwrdn = GPWRDN_PWRDNRSTN; 4989 4991 gpwrdn |= GPWRDN_PMUACTV; 4990 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 4992 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 4991 4993 udelay(10); 4992 4994 4993 4995 /* Set flag to indicate that we are in hibernation */ 4994 4996 hsotg->hibernated = 1; 4995 4997 4996 4998 /* Enable interrupts from wake up logic */ 4997 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 4999 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 4998 5000 gpwrdn |= GPWRDN_PMUINTSEL; 4999 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 5001 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 5000 5002 udelay(10); 5001 5003 5002 5004 /* Unmask device mode interrupts in GPWRDN */ 5003 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 5005 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 5004 5006 gpwrdn |= GPWRDN_RST_DET_MSK; 5005 5007 gpwrdn |= GPWRDN_LNSTSCHG_MSK; 5006 5008 gpwrdn |= GPWRDN_STS_CHGINT_MSK; 5007 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 5009 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 5008 5010 udelay(10); 5009 5011 5010 5012 /* Enable Power Down Clamp */ 5011 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 5013 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 5012 5014 gpwrdn |= GPWRDN_PWRDNCLMP; 5013 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 5015 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 5014 5016 udelay(10); 5015 5017 5016 5018 /* Switch off VDD */ 5017 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 5019 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 5018 5020 gpwrdn |= GPWRDN_PWRDNSWTCH; 5019 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 5021 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 5020 5022 udelay(10); 5021 5023 5022 5024 /* Save gpwrdn register for further usage if stschng interrupt */ 5023 - hsotg->gr_backup.gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 5025 + hsotg->gr_backup.gpwrdn = dwc2_readl(hsotg, GPWRDN); 5024 5026 dev_dbg(hsotg->dev, "Hibernation completed\n"); 5025 5027 5026 5028 return ret; ··· 5062 5064 5063 5065 if (!reset) { 5064 5066 /* Clear all pending interupts */ 5065 - dwc2_writel(0xffffffff, hsotg->regs + GINTSTS); 5067 + dwc2_writel(hsotg, 0xffffffff, GINTSTS); 5066 5068 } 5067 5069 5068 5070 /* De-assert Restore */ 5069 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 5071 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 5070 5072 gpwrdn &= ~GPWRDN_RESTORE; 5071 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 5073 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 5072 5074 udelay(10); 5073 5075 5074 5076 if (!rem_wakeup) { 5075 - pcgcctl = dwc2_readl(hsotg->regs + PCGCTL); 5077 + pcgcctl = dwc2_readl(hsotg, PCGCTL); 5076 5078 pcgcctl &= ~PCGCTL_RSTPDWNMODULE; 5077 - dwc2_writel(pcgcctl, hsotg->regs + PCGCTL); 5079 + dwc2_writel(hsotg, pcgcctl, PCGCTL); 5078 5080 } 5079 5081 5080 5082 /* Restore GUSBCFG, DCFG and DCTL */ 5081 - dwc2_writel(gr->gusbcfg, hsotg->regs + GUSBCFG); 5082 - dwc2_writel(dr->dcfg, hsotg->regs + DCFG); 5083 - dwc2_writel(dr->dctl, hsotg->regs + DCTL); 5083 + dwc2_writel(hsotg, gr->gusbcfg, GUSBCFG); 5084 + dwc2_writel(hsotg, dr->dcfg, DCFG); 5085 + dwc2_writel(hsotg, dr->dctl, DCTL); 5084 5086 5085 5087 /* De-assert Wakeup Logic */ 5086 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 5088 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 5087 5089 gpwrdn &= ~GPWRDN_PMUACTV; 5088 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 5090 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 5089 5091 5090 5092 if (rem_wakeup) { 5091 5093 udelay(10); 5092 5094 /* Start Remote Wakeup Signaling */ 5093 - dwc2_writel(dr->dctl | DCTL_RMTWKUPSIG, hsotg->regs + DCTL); 5095 + dwc2_writel(hsotg, dr->dctl | DCTL_RMTWKUPSIG, DCTL); 5094 5096 } else { 5095 5097 udelay(50); 5096 5098 /* Set Device programming done bit */ 5097 - dctl = dwc2_readl(hsotg->regs + DCTL); 5099 + dctl = dwc2_readl(hsotg, DCTL); 5098 5100 dctl |= DCTL_PWRONPRGDONE; 5099 - dwc2_writel(dctl, hsotg->regs + DCTL); 5101 + dwc2_writel(hsotg, dctl, DCTL); 5100 5102 } 5101 5103 /* Wait for interrupts which must be cleared */ 5102 5104 mdelay(2); 5103 5105 /* Clear all pending interupts */ 5104 - dwc2_writel(0xffffffff, hsotg->regs + GINTSTS); 5106 + dwc2_writel(hsotg, 0xffffffff, GINTSTS); 5105 5107 5106 5108 /* Restore global registers */ 5107 5109 ret = dwc2_restore_global_registers(hsotg); ··· 5121 5123 5122 5124 if (rem_wakeup) { 5123 5125 mdelay(10); 5124 - dctl = dwc2_readl(hsotg->regs + DCTL); 5126 + dctl = dwc2_readl(hsotg, DCTL); 5125 5127 dctl &= ~DCTL_RMTWKUPSIG; 5126 - dwc2_writel(dctl, hsotg->regs + DCTL); 5128 + dwc2_writel(hsotg, dctl, DCTL); 5127 5129 } 5128 5130 5129 5131 hsotg->hibernated = 0;
+229 -230
drivers/usb/dwc2/hcd.c
··· 75 75 u32 intmsk; 76 76 77 77 /* Clear any pending OTG Interrupts */ 78 - dwc2_writel(0xffffffff, hsotg->regs + GOTGINT); 78 + dwc2_writel(hsotg, 0xffffffff, GOTGINT); 79 79 80 80 /* Clear any pending interrupts */ 81 - dwc2_writel(0xffffffff, hsotg->regs + GINTSTS); 81 + dwc2_writel(hsotg, 0xffffffff, GINTSTS); 82 82 83 83 /* Enable the interrupts in the GINTMSK */ 84 84 intmsk = GINTSTS_MODEMIS | GINTSTS_OTGINT; ··· 94 94 if (dwc2_is_device_mode(hsotg) && hsotg->params.lpm) 95 95 intmsk |= GINTSTS_LPMTRANRCVD; 96 96 97 - dwc2_writel(intmsk, hsotg->regs + GINTMSK); 97 + dwc2_writel(hsotg, intmsk, GINTMSK); 98 98 } 99 99 100 100 /* ··· 117 117 } 118 118 119 119 dev_dbg(hsotg->dev, "Initializing HCFG.FSLSPClkSel to %08x\n", val); 120 - hcfg = dwc2_readl(hsotg->regs + HCFG); 120 + hcfg = dwc2_readl(hsotg, HCFG); 121 121 hcfg &= ~HCFG_FSLSPCLKSEL_MASK; 122 122 hcfg |= val << HCFG_FSLSPCLKSEL_SHIFT; 123 - dwc2_writel(hcfg, hsotg->regs + HCFG); 123 + dwc2_writel(hsotg, hcfg, HCFG); 124 124 } 125 125 126 126 static int dwc2_fs_phy_init(struct dwc2_hsotg *hsotg, bool select_phy) ··· 135 135 if (select_phy) { 136 136 dev_dbg(hsotg->dev, "FS PHY selected\n"); 137 137 138 - usbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 138 + usbcfg = dwc2_readl(hsotg, GUSBCFG); 139 139 if (!(usbcfg & GUSBCFG_PHYSEL)) { 140 140 usbcfg |= GUSBCFG_PHYSEL; 141 - dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); 141 + dwc2_writel(hsotg, usbcfg, GUSBCFG); 142 142 143 143 /* Reset after a PHY select */ 144 144 retval = dwc2_core_reset(hsotg, false); ··· 151 151 } 152 152 153 153 if (hsotg->params.activate_stm_fs_transceiver) { 154 - ggpio = dwc2_readl(hsotg->regs + GGPIO); 154 + ggpio = dwc2_readl(hsotg, GGPIO); 155 155 if (!(ggpio & GGPIO_STM32_OTG_GCCFG_PWRDWN)) { 156 156 dev_dbg(hsotg->dev, "Activating transceiver\n"); 157 157 /* ··· 159 159 * core configuration register. 160 160 */ 161 161 ggpio |= GGPIO_STM32_OTG_GCCFG_PWRDWN; 162 - dwc2_writel(ggpio, hsotg->regs + GGPIO); 162 + dwc2_writel(hsotg, ggpio, GGPIO); 163 163 } 164 164 } 165 165 } ··· 176 176 dev_dbg(hsotg->dev, "FS PHY enabling I2C\n"); 177 177 178 178 /* Program GUSBCFG.OtgUtmiFsSel to I2C */ 179 - usbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 179 + usbcfg = dwc2_readl(hsotg, GUSBCFG); 180 180 usbcfg |= GUSBCFG_OTG_UTMI_FS_SEL; 181 - dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); 181 + dwc2_writel(hsotg, usbcfg, GUSBCFG); 182 182 183 183 /* Program GI2CCTL.I2CEn */ 184 - i2cctl = dwc2_readl(hsotg->regs + GI2CCTL); 184 + i2cctl = dwc2_readl(hsotg, GI2CCTL); 185 185 i2cctl &= ~GI2CCTL_I2CDEVADDR_MASK; 186 186 i2cctl |= 1 << GI2CCTL_I2CDEVADDR_SHIFT; 187 187 i2cctl &= ~GI2CCTL_I2CEN; 188 - dwc2_writel(i2cctl, hsotg->regs + GI2CCTL); 188 + dwc2_writel(hsotg, i2cctl, GI2CCTL); 189 189 i2cctl |= GI2CCTL_I2CEN; 190 - dwc2_writel(i2cctl, hsotg->regs + GI2CCTL); 190 + dwc2_writel(hsotg, i2cctl, GI2CCTL); 191 191 } 192 192 193 193 return retval; ··· 201 201 if (!select_phy) 202 202 return 0; 203 203 204 - usbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 204 + usbcfg = dwc2_readl(hsotg, GUSBCFG); 205 205 usbcfg_old = usbcfg; 206 206 207 207 /* ··· 236 236 } 237 237 238 238 if (usbcfg != usbcfg_old) { 239 - dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); 239 + dwc2_writel(hsotg, usbcfg, GUSBCFG); 240 240 241 241 /* Reset after setting the PHY parameters */ 242 242 retval = dwc2_core_reset(hsotg, false); ··· 273 273 hsotg->hw_params.fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED && 274 274 hsotg->params.ulpi_fs_ls) { 275 275 dev_dbg(hsotg->dev, "Setting ULPI FSLS\n"); 276 - usbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 276 + usbcfg = dwc2_readl(hsotg, GUSBCFG); 277 277 usbcfg |= GUSBCFG_ULPI_FS_LS; 278 278 usbcfg |= GUSBCFG_ULPI_CLK_SUSP_M; 279 - dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); 279 + dwc2_writel(hsotg, usbcfg, GUSBCFG); 280 280 } else { 281 - usbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 281 + usbcfg = dwc2_readl(hsotg, GUSBCFG); 282 282 usbcfg &= ~GUSBCFG_ULPI_FS_LS; 283 283 usbcfg &= ~GUSBCFG_ULPI_CLK_SUSP_M; 284 - dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); 284 + dwc2_writel(hsotg, usbcfg, GUSBCFG); 285 285 } 286 286 287 287 return retval; ··· 289 289 290 290 static int dwc2_gahbcfg_init(struct dwc2_hsotg *hsotg) 291 291 { 292 - u32 ahbcfg = dwc2_readl(hsotg->regs + GAHBCFG); 292 + u32 ahbcfg = dwc2_readl(hsotg, GAHBCFG); 293 293 294 294 switch (hsotg->hw_params.arch) { 295 295 case GHWCFG2_EXT_DMA_ARCH: ··· 316 316 else 317 317 hsotg->params.dma_desc_enable = false; 318 318 319 - dwc2_writel(ahbcfg, hsotg->regs + GAHBCFG); 319 + dwc2_writel(hsotg, ahbcfg, GAHBCFG); 320 320 321 321 return 0; 322 322 } ··· 325 325 { 326 326 u32 usbcfg; 327 327 328 - usbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 328 + usbcfg = dwc2_readl(hsotg, GUSBCFG); 329 329 usbcfg &= ~(GUSBCFG_HNPCAP | GUSBCFG_SRPCAP); 330 330 331 331 switch (hsotg->hw_params.op_mode) { ··· 353 353 break; 354 354 } 355 355 356 - dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); 356 + dwc2_writel(hsotg, usbcfg, GUSBCFG); 357 357 } 358 358 359 359 static int dwc2_vbus_supply_init(struct dwc2_hsotg *hsotg) ··· 390 390 dev_dbg(hsotg->dev, "%s()\n", __func__); 391 391 392 392 /* Disable all interrupts */ 393 - dwc2_writel(0, hsotg->regs + GINTMSK); 394 - dwc2_writel(0, hsotg->regs + HAINTMSK); 393 + dwc2_writel(hsotg, 0, GINTMSK); 394 + dwc2_writel(hsotg, 0, HAINTMSK); 395 395 396 396 /* Enable the common interrupts */ 397 397 dwc2_enable_common_interrupts(hsotg); 398 398 399 399 /* Enable host mode interrupts without disturbing common interrupts */ 400 - intmsk = dwc2_readl(hsotg->regs + GINTMSK); 400 + intmsk = dwc2_readl(hsotg, GINTMSK); 401 401 intmsk |= GINTSTS_DISCONNINT | GINTSTS_PRTINT | GINTSTS_HCHINT; 402 - dwc2_writel(intmsk, hsotg->regs + GINTMSK); 402 + dwc2_writel(hsotg, intmsk, GINTMSK); 403 403 } 404 404 405 405 /** ··· 409 409 */ 410 410 static void dwc2_disable_host_interrupts(struct dwc2_hsotg *hsotg) 411 411 { 412 - u32 intmsk = dwc2_readl(hsotg->regs + GINTMSK); 412 + u32 intmsk = dwc2_readl(hsotg, GINTMSK); 413 413 414 414 /* Disable host mode interrupts without disturbing common interrupts */ 415 415 intmsk &= ~(GINTSTS_SOF | GINTSTS_PRTINT | GINTSTS_HCHINT | 416 416 GINTSTS_PTXFEMP | GINTSTS_NPTXFEMP | GINTSTS_DISCONNINT); 417 - dwc2_writel(intmsk, hsotg->regs + GINTMSK); 417 + dwc2_writel(hsotg, intmsk, GINTMSK); 418 418 } 419 419 420 420 /* ··· 494 494 dwc2_calculate_dynamic_fifo(hsotg); 495 495 496 496 /* Rx FIFO */ 497 - grxfsiz = dwc2_readl(hsotg->regs + GRXFSIZ); 497 + grxfsiz = dwc2_readl(hsotg, GRXFSIZ); 498 498 dev_dbg(hsotg->dev, "initial grxfsiz=%08x\n", grxfsiz); 499 499 grxfsiz &= ~GRXFSIZ_DEPTH_MASK; 500 500 grxfsiz |= params->host_rx_fifo_size << 501 501 GRXFSIZ_DEPTH_SHIFT & GRXFSIZ_DEPTH_MASK; 502 - dwc2_writel(grxfsiz, hsotg->regs + GRXFSIZ); 502 + dwc2_writel(hsotg, grxfsiz, GRXFSIZ); 503 503 dev_dbg(hsotg->dev, "new grxfsiz=%08x\n", 504 - dwc2_readl(hsotg->regs + GRXFSIZ)); 504 + dwc2_readl(hsotg, GRXFSIZ)); 505 505 506 506 /* Non-periodic Tx FIFO */ 507 507 dev_dbg(hsotg->dev, "initial gnptxfsiz=%08x\n", 508 - dwc2_readl(hsotg->regs + GNPTXFSIZ)); 508 + dwc2_readl(hsotg, GNPTXFSIZ)); 509 509 nptxfsiz = params->host_nperio_tx_fifo_size << 510 510 FIFOSIZE_DEPTH_SHIFT & FIFOSIZE_DEPTH_MASK; 511 511 nptxfsiz |= params->host_rx_fifo_size << 512 512 FIFOSIZE_STARTADDR_SHIFT & FIFOSIZE_STARTADDR_MASK; 513 - dwc2_writel(nptxfsiz, hsotg->regs + GNPTXFSIZ); 513 + dwc2_writel(hsotg, nptxfsiz, GNPTXFSIZ); 514 514 dev_dbg(hsotg->dev, "new gnptxfsiz=%08x\n", 515 - dwc2_readl(hsotg->regs + GNPTXFSIZ)); 515 + dwc2_readl(hsotg, GNPTXFSIZ)); 516 516 517 517 /* Periodic Tx FIFO */ 518 518 dev_dbg(hsotg->dev, "initial hptxfsiz=%08x\n", 519 - dwc2_readl(hsotg->regs + HPTXFSIZ)); 519 + dwc2_readl(hsotg, HPTXFSIZ)); 520 520 hptxfsiz = params->host_perio_tx_fifo_size << 521 521 FIFOSIZE_DEPTH_SHIFT & FIFOSIZE_DEPTH_MASK; 522 522 hptxfsiz |= (params->host_rx_fifo_size + 523 523 params->host_nperio_tx_fifo_size) << 524 524 FIFOSIZE_STARTADDR_SHIFT & FIFOSIZE_STARTADDR_MASK; 525 - dwc2_writel(hptxfsiz, hsotg->regs + HPTXFSIZ); 525 + dwc2_writel(hsotg, hptxfsiz, HPTXFSIZ); 526 526 dev_dbg(hsotg->dev, "new hptxfsiz=%08x\n", 527 - dwc2_readl(hsotg->regs + HPTXFSIZ)); 527 + dwc2_readl(hsotg, HPTXFSIZ)); 528 528 529 529 if (hsotg->params.en_multiple_tx_fifo && 530 530 hsotg->hw_params.snpsid >= DWC2_CORE_REV_2_91a) { ··· 533 533 * Global DFIFOCFG calculation for Host mode - 534 534 * include RxFIFO, NPTXFIFO and HPTXFIFO 535 535 */ 536 - dfifocfg = dwc2_readl(hsotg->regs + GDFIFOCFG); 536 + dfifocfg = dwc2_readl(hsotg, GDFIFOCFG); 537 537 dfifocfg &= ~GDFIFOCFG_EPINFOBASE_MASK; 538 538 dfifocfg |= (params->host_rx_fifo_size + 539 539 params->host_nperio_tx_fifo_size + 540 540 params->host_perio_tx_fifo_size) << 541 541 GDFIFOCFG_EPINFOBASE_SHIFT & 542 542 GDFIFOCFG_EPINFOBASE_MASK; 543 - dwc2_writel(dfifocfg, hsotg->regs + GDFIFOCFG); 543 + dwc2_writel(hsotg, dfifocfg, GDFIFOCFG); 544 544 } 545 545 } 546 546 ··· 560 560 u32 hprt0; 561 561 int clock = 60; /* default value */ 562 562 563 - usbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 564 - hprt0 = dwc2_readl(hsotg->regs + HPRT0); 563 + usbcfg = dwc2_readl(hsotg, GUSBCFG); 564 + hprt0 = dwc2_readl(hsotg, HPRT0); 565 565 566 566 if (!(usbcfg & GUSBCFG_PHYSEL) && (usbcfg & GUSBCFG_ULPI_UTMI_SEL) && 567 567 !(usbcfg & GUSBCFG_PHYIF16)) ··· 603 603 */ 604 604 void dwc2_read_packet(struct dwc2_hsotg *hsotg, u8 *dest, u16 bytes) 605 605 { 606 - u32 __iomem *fifo = hsotg->regs + HCFIFO(0); 607 606 u32 *data_buf = (u32 *)dest; 608 607 int word_count = (bytes + 3) / 4; 609 608 int i; ··· 616 617 dev_vdbg(hsotg->dev, "%s(%p,%p,%d)\n", __func__, hsotg, dest, bytes); 617 618 618 619 for (i = 0; i < word_count; i++, data_buf++) 619 - *data_buf = dwc2_readl(fifo); 620 + *data_buf = dwc2_readl(hsotg, HCFIFO(0)); 620 621 } 621 622 622 623 /** ··· 645 646 if (!chan) 646 647 return; 647 648 648 - hcchar = dwc2_readl(hsotg->regs + HCCHAR(chan->hc_num)); 649 - hcsplt = dwc2_readl(hsotg->regs + HCSPLT(chan->hc_num)); 650 - hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chan->hc_num)); 651 - hc_dma = dwc2_readl(hsotg->regs + HCDMA(chan->hc_num)); 649 + hcchar = dwc2_readl(hsotg, HCCHAR(chan->hc_num)); 650 + hcsplt = dwc2_readl(hsotg, HCSPLT(chan->hc_num)); 651 + hctsiz = dwc2_readl(hsotg, HCTSIZ(chan->hc_num)); 652 + hc_dma = dwc2_readl(hsotg, HCDMA(chan->hc_num)); 652 653 653 654 dev_dbg(hsotg->dev, " Assigned to channel %p:\n", chan); 654 655 dev_dbg(hsotg->dev, " hcchar 0x%08x, hcsplt 0x%08x\n", ··· 796 797 break; 797 798 } 798 799 799 - dwc2_writel(hcintmsk, hsotg->regs + HCINTMSK(chan->hc_num)); 800 + dwc2_writel(hsotg, hcintmsk, HCINTMSK(chan->hc_num)); 800 801 if (dbg_hc(chan)) 801 802 dev_vdbg(hsotg->dev, "set HCINTMSK to %08x\n", hcintmsk); 802 803 } ··· 833 834 } 834 835 } 835 836 836 - dwc2_writel(hcintmsk, hsotg->regs + HCINTMSK(chan->hc_num)); 837 + dwc2_writel(hsotg, hcintmsk, HCINTMSK(chan->hc_num)); 837 838 if (dbg_hc(chan)) 838 839 dev_vdbg(hsotg->dev, "set HCINTMSK to %08x\n", hcintmsk); 839 840 } ··· 854 855 } 855 856 856 857 /* Enable the top level host channel interrupt */ 857 - intmsk = dwc2_readl(hsotg->regs + HAINTMSK); 858 + intmsk = dwc2_readl(hsotg, HAINTMSK); 858 859 intmsk |= 1 << chan->hc_num; 859 - dwc2_writel(intmsk, hsotg->regs + HAINTMSK); 860 + dwc2_writel(hsotg, intmsk, HAINTMSK); 860 861 if (dbg_hc(chan)) 861 862 dev_vdbg(hsotg->dev, "set HAINTMSK to %08x\n", intmsk); 862 863 863 864 /* Make sure host channel interrupts are enabled */ 864 - intmsk = dwc2_readl(hsotg->regs + GINTMSK); 865 + intmsk = dwc2_readl(hsotg, GINTMSK); 865 866 intmsk |= GINTSTS_HCHINT; 866 - dwc2_writel(intmsk, hsotg->regs + GINTMSK); 867 + dwc2_writel(hsotg, intmsk, GINTMSK); 867 868 if (dbg_hc(chan)) 868 869 dev_vdbg(hsotg->dev, "set GINTMSK to %08x\n", intmsk); 869 870 } ··· 892 893 /* Clear old interrupt conditions for this host channel */ 893 894 hcintmsk = 0xffffffff; 894 895 hcintmsk &= ~HCINTMSK_RESERVED14_31; 895 - dwc2_writel(hcintmsk, hsotg->regs + HCINT(hc_num)); 896 + dwc2_writel(hsotg, hcintmsk, HCINT(hc_num)); 896 897 897 898 /* Enable channel interrupts required for this transfer */ 898 899 dwc2_hc_enable_ints(hsotg, chan); ··· 909 910 hcchar |= HCCHAR_LSPDDEV; 910 911 hcchar |= chan->ep_type << HCCHAR_EPTYPE_SHIFT & HCCHAR_EPTYPE_MASK; 911 912 hcchar |= chan->max_packet << HCCHAR_MPS_SHIFT & HCCHAR_MPS_MASK; 912 - dwc2_writel(hcchar, hsotg->regs + HCCHAR(hc_num)); 913 + dwc2_writel(hsotg, hcchar, HCCHAR(hc_num)); 913 914 if (dbg_hc(chan)) { 914 915 dev_vdbg(hsotg->dev, "set HCCHAR(%d) to %08x\n", 915 916 hc_num, hcchar); ··· 963 964 } 964 965 } 965 966 966 - dwc2_writel(hcsplt, hsotg->regs + HCSPLT(hc_num)); 967 + dwc2_writel(hsotg, hcsplt, HCSPLT(hc_num)); 967 968 } 968 969 969 970 /** ··· 1033 1034 u32 hcintmsk = HCINTMSK_CHHLTD; 1034 1035 1035 1036 dev_vdbg(hsotg->dev, "dequeue/error\n"); 1036 - dwc2_writel(hcintmsk, hsotg->regs + HCINTMSK(chan->hc_num)); 1037 + dwc2_writel(hsotg, hcintmsk, HCINTMSK(chan->hc_num)); 1037 1038 1038 1039 /* 1039 1040 * Make sure no other interrupts besides halt are currently 1040 1041 * pending. Handling another interrupt could cause a crash due 1041 1042 * to the QTD and QH state. 1042 1043 */ 1043 - dwc2_writel(~hcintmsk, hsotg->regs + HCINT(chan->hc_num)); 1044 + dwc2_writel(hsotg, ~hcintmsk, HCINT(chan->hc_num)); 1044 1045 1045 1046 /* 1046 1047 * Make sure the halt status is set to URB_DEQUEUE or AHB_ERR ··· 1049 1050 */ 1050 1051 chan->halt_status = halt_status; 1051 1052 1052 - hcchar = dwc2_readl(hsotg->regs + HCCHAR(chan->hc_num)); 1053 + hcchar = dwc2_readl(hsotg, HCCHAR(chan->hc_num)); 1053 1054 if (!(hcchar & HCCHAR_CHENA)) { 1054 1055 /* 1055 1056 * The channel is either already halted or it hasn't ··· 1077 1078 return; 1078 1079 } 1079 1080 1080 - hcchar = dwc2_readl(hsotg->regs + HCCHAR(chan->hc_num)); 1081 + hcchar = dwc2_readl(hsotg, HCCHAR(chan->hc_num)); 1081 1082 1082 1083 /* No need to set the bit in DDMA for disabling the channel */ 1083 1084 /* TODO check it everywhere channel is disabled */ ··· 1100 1101 if (chan->ep_type == USB_ENDPOINT_XFER_CONTROL || 1101 1102 chan->ep_type == USB_ENDPOINT_XFER_BULK) { 1102 1103 dev_vdbg(hsotg->dev, "control/bulk\n"); 1103 - nptxsts = dwc2_readl(hsotg->regs + GNPTXSTS); 1104 + nptxsts = dwc2_readl(hsotg, GNPTXSTS); 1104 1105 if ((nptxsts & TXSTS_QSPCAVAIL_MASK) == 0) { 1105 1106 dev_vdbg(hsotg->dev, "Disabling channel\n"); 1106 1107 hcchar &= ~HCCHAR_CHENA; ··· 1108 1109 } else { 1109 1110 if (dbg_perio()) 1110 1111 dev_vdbg(hsotg->dev, "isoc/intr\n"); 1111 - hptxsts = dwc2_readl(hsotg->regs + HPTXSTS); 1112 + hptxsts = dwc2_readl(hsotg, HPTXSTS); 1112 1113 if ((hptxsts & TXSTS_QSPCAVAIL_MASK) == 0 || 1113 1114 hsotg->queuing_high_bandwidth) { 1114 1115 if (dbg_perio()) ··· 1121 1122 dev_vdbg(hsotg->dev, "DMA enabled\n"); 1122 1123 } 1123 1124 1124 - dwc2_writel(hcchar, hsotg->regs + HCCHAR(chan->hc_num)); 1125 + dwc2_writel(hsotg, hcchar, HCCHAR(chan->hc_num)); 1125 1126 chan->halt_status = halt_status; 1126 1127 1127 1128 if (hcchar & HCCHAR_CHENA) { ··· 1170 1171 * Clear channel interrupt enables and any unhandled channel interrupt 1171 1172 * conditions 1172 1173 */ 1173 - dwc2_writel(0, hsotg->regs + HCINTMSK(chan->hc_num)); 1174 + dwc2_writel(hsotg, 0, HCINTMSK(chan->hc_num)); 1174 1175 hcintmsk = 0xffffffff; 1175 1176 hcintmsk &= ~HCINTMSK_RESERVED14_31; 1176 - dwc2_writel(hcintmsk, hsotg->regs + HCINT(chan->hc_num)); 1177 + dwc2_writel(hsotg, hcintmsk, HCINT(chan->hc_num)); 1177 1178 } 1178 1179 1179 1180 /** ··· 1227 1228 !chan->do_split) ? chan->speed : USB_SPEED_HIGH; 1228 1229 1229 1230 /* See how many bytes are in the periodic FIFO right now */ 1230 - fifo_space = (dwc2_readl(hsotg->regs + HPTXSTS) & 1231 + fifo_space = (dwc2_readl(hsotg, HPTXSTS) & 1231 1232 TXSTS_FSPCAVAIL_MASK) >> TXSTS_FSPCAVAIL_SHIFT; 1232 1233 bytes_in_fifo = sizeof(u32) * 1233 1234 (hsotg->params.host_perio_tx_fifo_size - ··· 1347 1348 if (((unsigned long)data_buf & 0x3) == 0) { 1348 1349 /* xfer_buf is DWORD aligned */ 1349 1350 for (i = 0; i < dword_count; i++, data_buf++) 1350 - dwc2_writel(*data_buf, data_fifo); 1351 + dwc2_writel(hsotg, *data_buf, HCFIFO(chan->hc_num)); 1351 1352 } else { 1352 1353 /* xfer_buf is not DWORD aligned */ 1353 1354 for (i = 0; i < dword_count; i++, data_buf++) { 1354 1355 u32 data = data_buf[0] | data_buf[1] << 8 | 1355 1356 data_buf[2] << 16 | data_buf[3] << 24; 1356 - dwc2_writel(data, data_fifo); 1357 + dwc2_writel(hsotg, data, HCFIFO(chan->hc_num)); 1357 1358 } 1358 1359 } 1359 1360 ··· 1382 1383 1383 1384 hctsiz = TSIZ_DOPNG; 1384 1385 hctsiz |= 1 << TSIZ_PKTCNT_SHIFT; 1385 - dwc2_writel(hctsiz, hsotg->regs + HCTSIZ(chan->hc_num)); 1386 + dwc2_writel(hsotg, hctsiz, HCTSIZ(chan->hc_num)); 1386 1387 1387 - hcchar = dwc2_readl(hsotg->regs + HCCHAR(chan->hc_num)); 1388 + hcchar = dwc2_readl(hsotg, HCCHAR(chan->hc_num)); 1388 1389 hcchar |= HCCHAR_CHENA; 1389 1390 hcchar &= ~HCCHAR_CHDIS; 1390 - dwc2_writel(hcchar, hsotg->regs + HCCHAR(chan->hc_num)); 1391 + dwc2_writel(hsotg, hcchar, HCCHAR(chan->hc_num)); 1391 1392 } 1392 1393 1393 1394 /** ··· 1547 1548 hctsiz |= num_packets << TSIZ_PKTCNT_SHIFT & TSIZ_PKTCNT_MASK; 1548 1549 hctsiz |= chan->data_pid_start << TSIZ_SC_MC_PID_SHIFT & 1549 1550 TSIZ_SC_MC_PID_MASK; 1550 - dwc2_writel(hctsiz, hsotg->regs + HCTSIZ(chan->hc_num)); 1551 + dwc2_writel(hsotg, hctsiz, HCTSIZ(chan->hc_num)); 1551 1552 if (dbg_hc(chan)) { 1552 1553 dev_vdbg(hsotg->dev, "Wrote %08x to HCTSIZ(%d)\n", 1553 1554 hctsiz, chan->hc_num); ··· 1575 1576 } else { 1576 1577 dma_addr = chan->xfer_dma; 1577 1578 } 1578 - dwc2_writel((u32)dma_addr, hsotg->regs + HCDMA(chan->hc_num)); 1579 + dwc2_writel(hsotg, (u32)dma_addr, HCDMA(chan->hc_num)); 1579 1580 1580 1581 if (dbg_hc(chan)) 1581 1582 dev_vdbg(hsotg->dev, "Wrote %08lx to HCDMA(%d)\n", ··· 1584 1585 1585 1586 /* Start the split */ 1586 1587 if (chan->do_split) { 1587 - u32 hcsplt = dwc2_readl(hsotg->regs + HCSPLT(chan->hc_num)); 1588 + u32 hcsplt = dwc2_readl(hsotg, HCSPLT(chan->hc_num)); 1588 1589 1589 1590 hcsplt |= HCSPLT_SPLTENA; 1590 - dwc2_writel(hcsplt, hsotg->regs + HCSPLT(chan->hc_num)); 1591 + dwc2_writel(hsotg, hcsplt, HCSPLT(chan->hc_num)); 1591 1592 } 1592 1593 1593 - hcchar = dwc2_readl(hsotg->regs + HCCHAR(chan->hc_num)); 1594 + hcchar = dwc2_readl(hsotg, HCCHAR(chan->hc_num)); 1594 1595 hcchar &= ~HCCHAR_MULTICNT_MASK; 1595 1596 hcchar |= (ec_mc << HCCHAR_MULTICNT_SHIFT) & HCCHAR_MULTICNT_MASK; 1596 1597 dwc2_hc_set_even_odd_frame(hsotg, chan, &hcchar); ··· 1609 1610 (hcchar & HCCHAR_MULTICNT_MASK) >> 1610 1611 HCCHAR_MULTICNT_SHIFT); 1611 1612 1612 - dwc2_writel(hcchar, hsotg->regs + HCCHAR(chan->hc_num)); 1613 + dwc2_writel(hsotg, hcchar, HCCHAR(chan->hc_num)); 1613 1614 if (dbg_hc(chan)) 1614 1615 dev_vdbg(hsotg->dev, "Wrote %08x to HCCHAR(%d)\n", hcchar, 1615 1616 chan->hc_num); ··· 1667 1668 dev_vdbg(hsotg->dev, " NTD: %d\n", chan->ntd - 1); 1668 1669 } 1669 1670 1670 - dwc2_writel(hctsiz, hsotg->regs + HCTSIZ(chan->hc_num)); 1671 + dwc2_writel(hsotg, hctsiz, HCTSIZ(chan->hc_num)); 1671 1672 1672 1673 dma_sync_single_for_device(hsotg->dev, chan->desc_list_addr, 1673 1674 chan->desc_list_sz, DMA_TO_DEVICE); 1674 1675 1675 - dwc2_writel(chan->desc_list_addr, hsotg->regs + HCDMA(chan->hc_num)); 1676 + dwc2_writel(hsotg, chan->desc_list_addr, HCDMA(chan->hc_num)); 1676 1677 1677 1678 if (dbg_hc(chan)) 1678 1679 dev_vdbg(hsotg->dev, "Wrote %pad to HCDMA(%d)\n", 1679 1680 &chan->desc_list_addr, chan->hc_num); 1680 1681 1681 - hcchar = dwc2_readl(hsotg->regs + HCCHAR(chan->hc_num)); 1682 + hcchar = dwc2_readl(hsotg, HCCHAR(chan->hc_num)); 1682 1683 hcchar &= ~HCCHAR_MULTICNT_MASK; 1683 1684 hcchar |= chan->multi_count << HCCHAR_MULTICNT_SHIFT & 1684 1685 HCCHAR_MULTICNT_MASK; ··· 1697 1698 (hcchar & HCCHAR_MULTICNT_MASK) >> 1698 1699 HCCHAR_MULTICNT_SHIFT); 1699 1700 1700 - dwc2_writel(hcchar, hsotg->regs + HCCHAR(chan->hc_num)); 1701 + dwc2_writel(hsotg, hcchar, HCCHAR(chan->hc_num)); 1701 1702 if (dbg_hc(chan)) 1702 1703 dev_vdbg(hsotg->dev, "Wrote %08x to HCCHAR(%d)\n", hcchar, 1703 1704 chan->hc_num); ··· 1754 1755 * transfer completes, the extra requests for the channel will 1755 1756 * be flushed. 1756 1757 */ 1757 - u32 hcchar = dwc2_readl(hsotg->regs + HCCHAR(chan->hc_num)); 1758 + u32 hcchar = dwc2_readl(hsotg, HCCHAR(chan->hc_num)); 1758 1759 1759 1760 dwc2_hc_set_even_odd_frame(hsotg, chan, &hcchar); 1760 1761 hcchar |= HCCHAR_CHENA; ··· 1762 1763 if (dbg_hc(chan)) 1763 1764 dev_vdbg(hsotg->dev, " IN xfer: hcchar = 0x%08x\n", 1764 1765 hcchar); 1765 - dwc2_writel(hcchar, hsotg->regs + HCCHAR(chan->hc_num)); 1766 + dwc2_writel(hsotg, hcchar, HCCHAR(chan->hc_num)); 1766 1767 chan->requests++; 1767 1768 return 1; 1768 1769 } ··· 1772 1773 if (chan->xfer_count < chan->xfer_len) { 1773 1774 if (chan->ep_type == USB_ENDPOINT_XFER_INT || 1774 1775 chan->ep_type == USB_ENDPOINT_XFER_ISOC) { 1775 - u32 hcchar = dwc2_readl(hsotg->regs + 1776 + u32 hcchar = dwc2_readl(hsotg, 1776 1777 HCCHAR(chan->hc_num)); 1777 1778 1778 1779 dwc2_hc_set_even_odd_frame(hsotg, chan, ··· 1886 1887 */ 1887 1888 hprt0 = dwc2_read_hprt0(hsotg); 1888 1889 hprt0 |= HPRT0_RST; 1889 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 1890 + dwc2_writel(hsotg, hprt0, HPRT0); 1890 1891 } 1891 1892 1892 1893 queue_delayed_work(hsotg->wq_otg, &hsotg->start_work, ··· 1907 1908 channel = hsotg->hc_ptr_array[i]; 1908 1909 if (!list_empty(&channel->hc_list_entry)) 1909 1910 continue; 1910 - hcchar = dwc2_readl(hsotg->regs + HCCHAR(i)); 1911 + hcchar = dwc2_readl(hsotg, HCCHAR(i)); 1911 1912 if (hcchar & HCCHAR_CHENA) { 1912 1913 hcchar &= ~(HCCHAR_CHENA | HCCHAR_EPDIR); 1913 1914 hcchar |= HCCHAR_CHDIS; 1914 - dwc2_writel(hcchar, hsotg->regs + HCCHAR(i)); 1915 + dwc2_writel(hsotg, hcchar, HCCHAR(i)); 1915 1916 } 1916 1917 } 1917 1918 } ··· 1920 1921 channel = hsotg->hc_ptr_array[i]; 1921 1922 if (!list_empty(&channel->hc_list_entry)) 1922 1923 continue; 1923 - hcchar = dwc2_readl(hsotg->regs + HCCHAR(i)); 1924 + hcchar = dwc2_readl(hsotg, HCCHAR(i)); 1924 1925 if (hcchar & HCCHAR_CHENA) { 1925 1926 /* Halt the channel */ 1926 1927 hcchar |= HCCHAR_CHDIS; 1927 - dwc2_writel(hcchar, hsotg->regs + HCCHAR(i)); 1928 + dwc2_writel(hsotg, hcchar, HCCHAR(i)); 1928 1929 } 1929 1930 1930 1931 dwc2_hc_cleanup(hsotg, channel); ··· 1984 1985 * interrupt mask and status bits and disabling subsequent host 1985 1986 * channel interrupts. 1986 1987 */ 1987 - intr = dwc2_readl(hsotg->regs + GINTMSK); 1988 + intr = dwc2_readl(hsotg, GINTMSK); 1988 1989 intr &= ~(GINTSTS_NPTXFEMP | GINTSTS_PTXFEMP | GINTSTS_HCHINT); 1989 - dwc2_writel(intr, hsotg->regs + GINTMSK); 1990 + dwc2_writel(hsotg, intr, GINTMSK); 1990 1991 intr = GINTSTS_NPTXFEMP | GINTSTS_PTXFEMP | GINTSTS_HCHINT; 1991 - dwc2_writel(intr, hsotg->regs + GINTSTS); 1992 + dwc2_writel(hsotg, intr, GINTSTS); 1992 1993 1993 1994 /* 1994 1995 * Turn off the vbus power only if the core has transitioned to device ··· 1998 1999 if (dwc2_is_device_mode(hsotg)) { 1999 2000 if (hsotg->op_state != OTG_STATE_A_SUSPEND) { 2000 2001 dev_dbg(hsotg->dev, "Disconnect: PortPower off\n"); 2001 - dwc2_writel(0, hsotg->regs + HPRT0); 2002 + dwc2_writel(hsotg, 0, HPRT0); 2002 2003 } 2003 2004 2004 2005 dwc2_disable_host_interrupts(hsotg); ··· 2026 2027 * and won't get any future interrupts to handle the connect. 2027 2028 */ 2028 2029 if (!force) { 2029 - hprt0 = dwc2_readl(hsotg->regs + HPRT0); 2030 + hprt0 = dwc2_readl(hsotg, HPRT0); 2030 2031 if (!(hprt0 & HPRT0_CONNDET) && (hprt0 & HPRT0_CONNSTS)) 2031 2032 dwc2_hcd_connect(hsotg); 2032 2033 } ··· 2070 2071 2071 2072 /* Turn off the vbus power */ 2072 2073 dev_dbg(hsotg->dev, "PortPower off\n"); 2073 - dwc2_writel(0, hsotg->regs + HPRT0); 2074 + dwc2_writel(hsotg, 0, HPRT0); 2074 2075 } 2075 2076 2076 2077 /* Caller must hold driver lock */ ··· 2094 2095 if ((dev_speed == USB_SPEED_LOW) && 2095 2096 (hsotg->hw_params.fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED) && 2096 2097 (hsotg->hw_params.hs_phy_type == GHWCFG2_HS_PHY_TYPE_UTMI)) { 2097 - u32 hprt0 = dwc2_readl(hsotg->regs + HPRT0); 2098 + u32 hprt0 = dwc2_readl(hsotg, HPRT0); 2098 2099 u32 prtspd = (hprt0 & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT; 2099 2100 2100 2101 if (prtspd == HPRT0_SPD_FULL_SPEED) ··· 2113 2114 return retval; 2114 2115 } 2115 2116 2116 - intr_mask = dwc2_readl(hsotg->regs + GINTMSK); 2117 + intr_mask = dwc2_readl(hsotg, GINTMSK); 2117 2118 if (!(intr_mask & GINTSTS_SOF)) { 2118 2119 enum dwc2_transaction_type tr_type; 2119 2120 ··· 2278 2279 2279 2280 dev_dbg(hsotg->dev, "%s(%p)\n", __func__, hsotg); 2280 2281 2281 - usbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 2282 + usbcfg = dwc2_readl(hsotg, GUSBCFG); 2282 2283 2283 2284 /* Set ULPI External VBUS bit if needed */ 2284 2285 usbcfg &= ~GUSBCFG_ULPI_EXT_VBUS_DRV; ··· 2290 2291 if (hsotg->params.ts_dline) 2291 2292 usbcfg |= GUSBCFG_TERMSELDLPULSE; 2292 2293 2293 - dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); 2294 + dwc2_writel(hsotg, usbcfg, GUSBCFG); 2294 2295 2295 2296 /* 2296 2297 * Reset the Controller ··· 2324 2325 dwc2_gusbcfg_init(hsotg); 2325 2326 2326 2327 /* Program the GOTGCTL register */ 2327 - otgctl = dwc2_readl(hsotg->regs + GOTGCTL); 2328 + otgctl = dwc2_readl(hsotg, GOTGCTL); 2328 2329 otgctl &= ~GOTGCTL_OTGVER; 2329 - dwc2_writel(otgctl, hsotg->regs + GOTGCTL); 2330 + dwc2_writel(hsotg, otgctl, GOTGCTL); 2330 2331 2331 2332 /* Clear the SRP success bit for FS-I2c */ 2332 2333 hsotg->srp_success = 0; ··· 2373 2374 * introduced by the PHY in generating the linestate condition 2374 2375 * can vary from one PHY to another. 2375 2376 */ 2376 - usbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 2377 + usbcfg = dwc2_readl(hsotg, GUSBCFG); 2377 2378 usbcfg |= GUSBCFG_TOUTCAL(7); 2378 - dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); 2379 + dwc2_writel(hsotg, usbcfg, GUSBCFG); 2379 2380 2380 2381 /* Restart the Phy Clock */ 2381 - dwc2_writel(0, hsotg->regs + PCGCTL); 2382 + dwc2_writel(hsotg, 0, PCGCTL); 2382 2383 2383 2384 /* Initialize Host Configuration Register */ 2384 2385 dwc2_init_fs_ls_pclk_sel(hsotg); 2385 2386 if (hsotg->params.speed == DWC2_SPEED_PARAM_FULL || 2386 2387 hsotg->params.speed == DWC2_SPEED_PARAM_LOW) { 2387 - hcfg = dwc2_readl(hsotg->regs + HCFG); 2388 + hcfg = dwc2_readl(hsotg, HCFG); 2388 2389 hcfg |= HCFG_FSLSSUPP; 2389 - dwc2_writel(hcfg, hsotg->regs + HCFG); 2390 + dwc2_writel(hsotg, hcfg, HCFG); 2390 2391 } 2391 2392 2392 2393 /* ··· 2395 2396 * and its value must not be changed during runtime. 2396 2397 */ 2397 2398 if (hsotg->params.reload_ctl) { 2398 - hfir = dwc2_readl(hsotg->regs + HFIR); 2399 + hfir = dwc2_readl(hsotg, HFIR); 2399 2400 hfir |= HFIR_RLDCTRL; 2400 - dwc2_writel(hfir, hsotg->regs + HFIR); 2401 + dwc2_writel(hsotg, hfir, HFIR); 2401 2402 } 2402 2403 2403 2404 if (hsotg->params.dma_desc_enable) { ··· 2414 2415 "falling back to buffer DMA mode.\n"); 2415 2416 hsotg->params.dma_desc_enable = false; 2416 2417 } else { 2417 - hcfg = dwc2_readl(hsotg->regs + HCFG); 2418 + hcfg = dwc2_readl(hsotg, HCFG); 2418 2419 hcfg |= HCFG_DESCDMA; 2419 - dwc2_writel(hcfg, hsotg->regs + HCFG); 2420 + dwc2_writel(hsotg, hcfg, HCFG); 2420 2421 } 2421 2422 } 2422 2423 ··· 2425 2426 2426 2427 /* TODO - check this */ 2427 2428 /* Clear Host Set HNP Enable in the OTG Control Register */ 2428 - otgctl = dwc2_readl(hsotg->regs + GOTGCTL); 2429 + otgctl = dwc2_readl(hsotg, GOTGCTL); 2429 2430 otgctl &= ~GOTGCTL_HSTSETHNPEN; 2430 - dwc2_writel(otgctl, hsotg->regs + GOTGCTL); 2431 + dwc2_writel(hsotg, otgctl, GOTGCTL); 2431 2432 2432 2433 /* Make sure the FIFOs are flushed */ 2433 2434 dwc2_flush_tx_fifo(hsotg, 0x10 /* all TX FIFOs */); 2434 2435 dwc2_flush_rx_fifo(hsotg); 2435 2436 2436 2437 /* Clear Host Set HNP Enable in the OTG Control Register */ 2437 - otgctl = dwc2_readl(hsotg->regs + GOTGCTL); 2438 + otgctl = dwc2_readl(hsotg, GOTGCTL); 2438 2439 otgctl &= ~GOTGCTL_HSTSETHNPEN; 2439 - dwc2_writel(otgctl, hsotg->regs + GOTGCTL); 2440 + dwc2_writel(hsotg, otgctl, GOTGCTL); 2440 2441 2441 2442 if (!hsotg->params.dma_desc_enable) { 2442 2443 int num_channels, i; ··· 2445 2446 /* Flush out any leftover queued requests */ 2446 2447 num_channels = hsotg->params.host_channels; 2447 2448 for (i = 0; i < num_channels; i++) { 2448 - hcchar = dwc2_readl(hsotg->regs + HCCHAR(i)); 2449 + hcchar = dwc2_readl(hsotg, HCCHAR(i)); 2449 2450 hcchar &= ~HCCHAR_CHENA; 2450 2451 hcchar |= HCCHAR_CHDIS; 2451 2452 hcchar &= ~HCCHAR_EPDIR; 2452 - dwc2_writel(hcchar, hsotg->regs + HCCHAR(i)); 2453 + dwc2_writel(hsotg, hcchar, HCCHAR(i)); 2453 2454 } 2454 2455 2455 2456 /* Halt all channels to put them into a known state */ 2456 2457 for (i = 0; i < num_channels; i++) { 2457 - hcchar = dwc2_readl(hsotg->regs + HCCHAR(i)); 2458 + hcchar = dwc2_readl(hsotg, HCCHAR(i)); 2458 2459 hcchar |= HCCHAR_CHENA | HCCHAR_CHDIS; 2459 2460 hcchar &= ~HCCHAR_EPDIR; 2460 - dwc2_writel(hcchar, hsotg->regs + HCCHAR(i)); 2461 + dwc2_writel(hsotg, hcchar, HCCHAR(i)); 2461 2462 dev_dbg(hsotg->dev, "%s: Halt channel %d\n", 2462 2463 __func__, i); 2463 2464 ··· 2481 2482 !!(hprt0 & HPRT0_PWR)); 2482 2483 if (!(hprt0 & HPRT0_PWR)) { 2483 2484 hprt0 |= HPRT0_PWR; 2484 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 2485 + dwc2_writel(hsotg, hprt0, HPRT0); 2485 2486 } 2486 2487 } 2487 2488 ··· 3075 3076 if (dbg_perio()) 3076 3077 dev_vdbg(hsotg->dev, "Queue periodic transactions\n"); 3077 3078 3078 - tx_status = dwc2_readl(hsotg->regs + HPTXSTS); 3079 + tx_status = dwc2_readl(hsotg, HPTXSTS); 3079 3080 qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >> 3080 3081 TXSTS_QSPCAVAIL_SHIFT; 3081 3082 fspcavail = (tx_status & TXSTS_FSPCAVAIL_MASK) >> ··· 3090 3091 3091 3092 qh_ptr = hsotg->periodic_sched_assigned.next; 3092 3093 while (qh_ptr != &hsotg->periodic_sched_assigned) { 3093 - tx_status = dwc2_readl(hsotg->regs + HPTXSTS); 3094 + tx_status = dwc2_readl(hsotg, HPTXSTS); 3094 3095 qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >> 3095 3096 TXSTS_QSPCAVAIL_SHIFT; 3096 3097 if (qspcavail == 0) { ··· 3160 3161 * level to ensure that new requests are loaded as 3161 3162 * soon as possible.) 3162 3163 */ 3163 - gintmsk = dwc2_readl(hsotg->regs + GINTMSK); 3164 + gintmsk = dwc2_readl(hsotg, GINTMSK); 3164 3165 if (!(gintmsk & GINTSTS_PTXFEMP)) { 3165 3166 gintmsk |= GINTSTS_PTXFEMP; 3166 - dwc2_writel(gintmsk, hsotg->regs + GINTMSK); 3167 + dwc2_writel(hsotg, gintmsk, GINTMSK); 3167 3168 } 3168 3169 } else { 3169 3170 /* ··· 3173 3174 * handlers to queue more transactions as transfer 3174 3175 * states change. 3175 3176 */ 3176 - gintmsk = dwc2_readl(hsotg->regs + GINTMSK); 3177 + gintmsk = dwc2_readl(hsotg, GINTMSK); 3177 3178 if (gintmsk & GINTSTS_PTXFEMP) { 3178 3179 gintmsk &= ~GINTSTS_PTXFEMP; 3179 - dwc2_writel(gintmsk, hsotg->regs + GINTMSK); 3180 + dwc2_writel(hsotg, gintmsk, GINTMSK); 3180 3181 } 3181 3182 } 3182 3183 } ··· 3205 3206 3206 3207 dev_vdbg(hsotg->dev, "Queue non-periodic transactions\n"); 3207 3208 3208 - tx_status = dwc2_readl(hsotg->regs + GNPTXSTS); 3209 + tx_status = dwc2_readl(hsotg, GNPTXSTS); 3209 3210 qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >> 3210 3211 TXSTS_QSPCAVAIL_SHIFT; 3211 3212 fspcavail = (tx_status & TXSTS_FSPCAVAIL_MASK) >> ··· 3228 3229 * available in the request queue or the Tx FIFO 3229 3230 */ 3230 3231 do { 3231 - tx_status = dwc2_readl(hsotg->regs + GNPTXSTS); 3232 + tx_status = dwc2_readl(hsotg, GNPTXSTS); 3232 3233 qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >> 3233 3234 TXSTS_QSPCAVAIL_SHIFT; 3234 3235 if (!hsotg->params.host_dma && qspcavail == 0) { ··· 3265 3266 } while (hsotg->non_periodic_qh_ptr != orig_qh_ptr); 3266 3267 3267 3268 if (!hsotg->params.host_dma) { 3268 - tx_status = dwc2_readl(hsotg->regs + GNPTXSTS); 3269 + tx_status = dwc2_readl(hsotg, GNPTXSTS); 3269 3270 qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >> 3270 3271 TXSTS_QSPCAVAIL_SHIFT; 3271 3272 fspcavail = (tx_status & TXSTS_FSPCAVAIL_MASK) >> ··· 3285 3286 * level to ensure that new requests are loaded as 3286 3287 * soon as possible.) 3287 3288 */ 3288 - gintmsk = dwc2_readl(hsotg->regs + GINTMSK); 3289 + gintmsk = dwc2_readl(hsotg, GINTMSK); 3289 3290 gintmsk |= GINTSTS_NPTXFEMP; 3290 - dwc2_writel(gintmsk, hsotg->regs + GINTMSK); 3291 + dwc2_writel(hsotg, gintmsk, GINTMSK); 3291 3292 } else { 3292 3293 /* 3293 3294 * Disable the Tx FIFO empty interrupt since there are ··· 3296 3297 * handlers to queue more transactions as transfer 3297 3298 * states change. 3298 3299 */ 3299 - gintmsk = dwc2_readl(hsotg->regs + GINTMSK); 3300 + gintmsk = dwc2_readl(hsotg, GINTMSK); 3300 3301 gintmsk &= ~GINTSTS_NPTXFEMP; 3301 - dwc2_writel(gintmsk, hsotg->regs + GINTMSK); 3302 + dwc2_writel(hsotg, gintmsk, GINTMSK); 3302 3303 } 3303 3304 } 3304 3305 } ··· 3335 3336 * Ensure NP Tx FIFO empty interrupt is disabled when 3336 3337 * there are no non-periodic transfers to process 3337 3338 */ 3338 - u32 gintmsk = dwc2_readl(hsotg->regs + GINTMSK); 3339 + u32 gintmsk = dwc2_readl(hsotg, GINTMSK); 3339 3340 3340 3341 gintmsk &= ~GINTSTS_NPTXFEMP; 3341 - dwc2_writel(gintmsk, hsotg->regs + GINTMSK); 3342 + dwc2_writel(hsotg, gintmsk, GINTMSK); 3342 3343 } 3343 3344 } 3344 3345 } ··· 3353 3354 3354 3355 dev_dbg(hsotg->dev, "%s()\n", __func__); 3355 3356 3356 - gotgctl = dwc2_readl(hsotg->regs + GOTGCTL); 3357 + gotgctl = dwc2_readl(hsotg, GOTGCTL); 3357 3358 dev_dbg(hsotg->dev, "gotgctl=%0x\n", gotgctl); 3358 3359 dev_dbg(hsotg->dev, "gotgctl.b.conidsts=%d\n", 3359 3360 !!(gotgctl & GOTGCTL_CONID_B)); ··· 3379 3380 * check it again and jump to host mode if that was 3380 3381 * the case. 3381 3382 */ 3382 - gotgctl = dwc2_readl(hsotg->regs + GOTGCTL); 3383 + gotgctl = dwc2_readl(hsotg, GOTGCTL); 3383 3384 if (!(gotgctl & GOTGCTL_CONID_B)) 3384 3385 goto host; 3385 3386 if (++count > 250) ··· 3439 3440 hprt0 = dwc2_read_hprt0(hsotg); 3440 3441 dev_dbg(hsotg->dev, "Resume: HPRT0=%0x\n", hprt0); 3441 3442 hprt0 &= ~HPRT0_RES; 3442 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 3443 + dwc2_writel(hsotg, hprt0, HPRT0); 3443 3444 dev_dbg(hsotg->dev, "Clear Resume: HPRT0=%0x\n", 3444 - dwc2_readl(hsotg->regs + HPRT0)); 3445 + dwc2_readl(hsotg, HPRT0)); 3445 3446 3446 3447 dwc2_hcd_rem_wakeup(hsotg); 3447 3448 hsotg->bus_suspended = false; ··· 3470 3471 spin_lock_irqsave(&hsotg->lock, flags); 3471 3472 3472 3473 if (windex == hsotg->otg_port && dwc2_host_is_b_hnp_enabled(hsotg)) { 3473 - gotgctl = dwc2_readl(hsotg->regs + GOTGCTL); 3474 + gotgctl = dwc2_readl(hsotg, GOTGCTL); 3474 3475 gotgctl |= GOTGCTL_HSTSETHNPEN; 3475 - dwc2_writel(gotgctl, hsotg->regs + GOTGCTL); 3476 + dwc2_writel(hsotg, gotgctl, GOTGCTL); 3476 3477 hsotg->op_state = OTG_STATE_A_SUSPEND; 3477 3478 } 3478 3479 3479 3480 hprt0 = dwc2_read_hprt0(hsotg); 3480 3481 hprt0 |= HPRT0_SUSP; 3481 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 3482 + dwc2_writel(hsotg, hprt0, HPRT0); 3482 3483 3483 3484 hsotg->bus_suspended = true; 3484 3485 ··· 3488 3489 */ 3489 3490 if (!hsotg->params.power_down) { 3490 3491 /* Suspend the Phy Clock */ 3491 - pcgctl = dwc2_readl(hsotg->regs + PCGCTL); 3492 + pcgctl = dwc2_readl(hsotg, PCGCTL); 3492 3493 pcgctl |= PCGCTL_STOPPCLK; 3493 - dwc2_writel(pcgctl, hsotg->regs + PCGCTL); 3494 + dwc2_writel(hsotg, pcgctl, PCGCTL); 3494 3495 udelay(10); 3495 3496 } 3496 3497 3497 3498 /* For HNP the bus must be suspended for at least 200ms */ 3498 3499 if (dwc2_host_is_b_hnp_enabled(hsotg)) { 3499 - pcgctl = dwc2_readl(hsotg->regs + PCGCTL); 3500 + pcgctl = dwc2_readl(hsotg, PCGCTL); 3500 3501 pcgctl &= ~PCGCTL_STOPPCLK; 3501 - dwc2_writel(pcgctl, hsotg->regs + PCGCTL); 3502 + dwc2_writel(hsotg, pcgctl, PCGCTL); 3502 3503 3503 3504 spin_unlock_irqrestore(&hsotg->lock, flags); 3504 3505 ··· 3522 3523 * after registers restore. 3523 3524 */ 3524 3525 if (!hsotg->params.power_down) { 3525 - pcgctl = dwc2_readl(hsotg->regs + PCGCTL); 3526 + pcgctl = dwc2_readl(hsotg, PCGCTL); 3526 3527 pcgctl &= ~PCGCTL_STOPPCLK; 3527 - dwc2_writel(pcgctl, hsotg->regs + PCGCTL); 3528 + dwc2_writel(hsotg, pcgctl, PCGCTL); 3528 3529 spin_unlock_irqrestore(&hsotg->lock, flags); 3529 3530 msleep(20); 3530 3531 spin_lock_irqsave(&hsotg->lock, flags); ··· 3533 3534 hprt0 = dwc2_read_hprt0(hsotg); 3534 3535 hprt0 |= HPRT0_RES; 3535 3536 hprt0 &= ~HPRT0_SUSP; 3536 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 3537 + dwc2_writel(hsotg, hprt0, HPRT0); 3537 3538 spin_unlock_irqrestore(&hsotg->lock, flags); 3538 3539 3539 3540 msleep(USB_RESUME_TIMEOUT); ··· 3541 3542 spin_lock_irqsave(&hsotg->lock, flags); 3542 3543 hprt0 = dwc2_read_hprt0(hsotg); 3543 3544 hprt0 &= ~(HPRT0_RES | HPRT0_SUSP); 3544 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 3545 + dwc2_writel(hsotg, hprt0, HPRT0); 3545 3546 hsotg->bus_suspended = false; 3546 3547 spin_unlock_irqrestore(&hsotg->lock, flags); 3547 3548 } ··· 3585 3586 "ClearPortFeature USB_PORT_FEAT_ENABLE\n"); 3586 3587 hprt0 = dwc2_read_hprt0(hsotg); 3587 3588 hprt0 |= HPRT0_ENA; 3588 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 3589 + dwc2_writel(hsotg, hprt0, HPRT0); 3589 3590 break; 3590 3591 3591 3592 case USB_PORT_FEAT_SUSPEND: ··· 3605 3606 "ClearPortFeature USB_PORT_FEAT_POWER\n"); 3606 3607 hprt0 = dwc2_read_hprt0(hsotg); 3607 3608 hprt0 &= ~HPRT0_PWR; 3608 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 3609 + dwc2_writel(hsotg, hprt0, HPRT0); 3609 3610 break; 3610 3611 3611 3612 case USB_PORT_FEAT_INDICATOR: ··· 3726 3727 break; 3727 3728 } 3728 3729 3729 - hprt0 = dwc2_readl(hsotg->regs + HPRT0); 3730 + hprt0 = dwc2_readl(hsotg, HPRT0); 3730 3731 dev_vdbg(hsotg->dev, " HPRT0: 0x%08x\n", hprt0); 3731 3732 3732 3733 if (hprt0 & HPRT0_CONNSTS) ··· 3767 3768 3768 3769 dev_info(hsotg->dev, "Enabling descriptor DMA mode\n"); 3769 3770 hsotg->params.dma_desc_enable = true; 3770 - hcfg = dwc2_readl(hsotg->regs + HCFG); 3771 + hcfg = dwc2_readl(hsotg, HCFG); 3771 3772 hcfg |= HCFG_DESCDMA; 3772 - dwc2_writel(hcfg, hsotg->regs + HCFG); 3773 + dwc2_writel(hsotg, hcfg, HCFG); 3773 3774 hsotg->new_connection = false; 3774 3775 } 3775 3776 } ··· 3816 3817 "SetPortFeature - USB_PORT_FEAT_POWER\n"); 3817 3818 hprt0 = dwc2_read_hprt0(hsotg); 3818 3819 hprt0 |= HPRT0_PWR; 3819 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 3820 + dwc2_writel(hsotg, hprt0, HPRT0); 3820 3821 break; 3821 3822 3822 3823 case USB_PORT_FEAT_RESET: ··· 3826 3827 hprt0 = dwc2_read_hprt0(hsotg); 3827 3828 dev_dbg(hsotg->dev, 3828 3829 "SetPortFeature - USB_PORT_FEAT_RESET\n"); 3829 - pcgctl = dwc2_readl(hsotg->regs + PCGCTL); 3830 + pcgctl = dwc2_readl(hsotg, PCGCTL); 3830 3831 pcgctl &= ~(PCGCTL_ENBL_SLEEP_GATING | PCGCTL_STOPPCLK); 3831 - dwc2_writel(pcgctl, hsotg->regs + PCGCTL); 3832 + dwc2_writel(hsotg, pcgctl, PCGCTL); 3832 3833 /* ??? Original driver does this */ 3833 - dwc2_writel(0, hsotg->regs + PCGCTL); 3834 + dwc2_writel(hsotg, 0, PCGCTL); 3834 3835 3835 3836 hprt0 = dwc2_read_hprt0(hsotg); 3836 3837 /* Clear suspend bit if resetting from suspend state */ ··· 3845 3846 hprt0 |= HPRT0_PWR | HPRT0_RST; 3846 3847 dev_dbg(hsotg->dev, 3847 3848 "In host mode, hprt0=%08x\n", hprt0); 3848 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 3849 + dwc2_writel(hsotg, hprt0, HPRT0); 3849 3850 } 3850 3851 3851 3852 /* Clear reset bit in 10ms (FS/LS) or 50ms (HS) */ 3852 3853 msleep(50); 3853 3854 hprt0 &= ~HPRT0_RST; 3854 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 3855 + dwc2_writel(hsotg, hprt0, HPRT0); 3855 3856 hsotg->lx_state = DWC2_L0; /* Now back to On state */ 3856 3857 break; 3857 3858 ··· 3867 3868 "SetPortFeature - USB_PORT_FEAT_TEST\n"); 3868 3869 hprt0 &= ~HPRT0_TSTCTL_MASK; 3869 3870 hprt0 |= (windex >> 8) << HPRT0_TSTCTL_SHIFT; 3870 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 3871 + dwc2_writel(hsotg, hprt0, HPRT0); 3871 3872 break; 3872 3873 3873 3874 default: ··· 3924 3925 3925 3926 int dwc2_hcd_get_frame_number(struct dwc2_hsotg *hsotg) 3926 3927 { 3927 - u32 hfnum = dwc2_readl(hsotg->regs + HFNUM); 3928 + u32 hfnum = dwc2_readl(hsotg, HFNUM); 3928 3929 3929 3930 #ifdef DWC2_DEBUG_SOF 3930 3931 dev_vdbg(hsotg->dev, "DWC OTG HCD GET FRAME NUMBER %d\n", ··· 3935 3936 3936 3937 int dwc2_hcd_get_future_frame_number(struct dwc2_hsotg *hsotg, int us) 3937 3938 { 3938 - u32 hprt = dwc2_readl(hsotg->regs + HPRT0); 3939 - u32 hfir = dwc2_readl(hsotg->regs + HFIR); 3940 - u32 hfnum = dwc2_readl(hsotg->regs + HFNUM); 3939 + u32 hprt = dwc2_readl(hsotg, HPRT0); 3940 + u32 hfir = dwc2_readl(hsotg, HFIR); 3941 + u32 hfnum = dwc2_readl(hsotg, HFNUM); 3941 3942 unsigned int us_per_frame; 3942 3943 unsigned int frame_number; 3943 3944 unsigned int remaining; ··· 4056 4057 if (chan->xfer_started) { 4057 4058 u32 hfnum, hcchar, hctsiz, hcint, hcintmsk; 4058 4059 4059 - hfnum = dwc2_readl(hsotg->regs + HFNUM); 4060 - hcchar = dwc2_readl(hsotg->regs + HCCHAR(i)); 4061 - hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(i)); 4062 - hcint = dwc2_readl(hsotg->regs + HCINT(i)); 4063 - hcintmsk = dwc2_readl(hsotg->regs + HCINTMSK(i)); 4060 + hfnum = dwc2_readl(hsotg, HFNUM); 4061 + hcchar = dwc2_readl(hsotg, HCCHAR(i)); 4062 + hctsiz = dwc2_readl(hsotg, HCTSIZ(i)); 4063 + hcint = dwc2_readl(hsotg, HCINT(i)); 4064 + hcintmsk = dwc2_readl(hsotg, HCINTMSK(i)); 4064 4065 dev_dbg(hsotg->dev, " hfnum: 0x%08x\n", hfnum); 4065 4066 dev_dbg(hsotg->dev, " hcchar: 0x%08x\n", hcchar); 4066 4067 dev_dbg(hsotg->dev, " hctsiz: 0x%08x\n", hctsiz); ··· 4108 4109 dev_dbg(hsotg->dev, " periodic_channels: %d\n", 4109 4110 hsotg->periodic_channels); 4110 4111 dev_dbg(hsotg->dev, " periodic_usecs: %d\n", hsotg->periodic_usecs); 4111 - np_tx_status = dwc2_readl(hsotg->regs + GNPTXSTS); 4112 + np_tx_status = dwc2_readl(hsotg, GNPTXSTS); 4112 4113 dev_dbg(hsotg->dev, " NP Tx Req Queue Space Avail: %d\n", 4113 4114 (np_tx_status & TXSTS_QSPCAVAIL_MASK) >> TXSTS_QSPCAVAIL_SHIFT); 4114 4115 dev_dbg(hsotg->dev, " NP Tx FIFO Space Avail: %d\n", 4115 4116 (np_tx_status & TXSTS_FSPCAVAIL_MASK) >> TXSTS_FSPCAVAIL_SHIFT); 4116 - p_tx_status = dwc2_readl(hsotg->regs + HPTXSTS); 4117 + p_tx_status = dwc2_readl(hsotg, HPTXSTS); 4117 4118 dev_dbg(hsotg->dev, " P Tx Req Queue Space Avail: %d\n", 4118 4119 (p_tx_status & TXSTS_QSPCAVAIL_MASK) >> TXSTS_QSPCAVAIL_SHIFT); 4119 4120 dev_dbg(hsotg->dev, " P Tx FIFO Space Avail: %d\n", ··· 4363 4364 4364 4365 hprt0 = dwc2_read_hprt0(hsotg); 4365 4366 hprt0 &= ~HPRT0_RST; 4366 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 4367 + dwc2_writel(hsotg, hprt0, HPRT0); 4367 4368 hsotg->flags.b.port_reset_change = 1; 4368 4369 4369 4370 spin_unlock_irqrestore(&hsotg->lock, flags); ··· 4473 4474 hprt0 = dwc2_read_hprt0(hsotg); 4474 4475 hprt0 |= HPRT0_SUSP; 4475 4476 hprt0 &= ~HPRT0_PWR; 4476 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 4477 + dwc2_writel(hsotg, hprt0, HPRT0); 4477 4478 dwc2_vbus_supply_exit(hsotg); 4478 4479 } 4479 4480 ··· 4564 4565 * Clear Port Enable and Port Status changes. 4565 4566 * Enable Port Power. 4566 4567 */ 4567 - dwc2_writel(HPRT0_PWR | HPRT0_CONNDET | 4568 - HPRT0_ENACHG, hsotg->regs + HPRT0); 4568 + dwc2_writel(hsotg, HPRT0_PWR | HPRT0_CONNDET | 4569 + HPRT0_ENACHG, HPRT0); 4569 4570 /* Wait for controller to detect Port Connect */ 4570 4571 usleep_range(5000, 7000); 4571 4572 } ··· 5085 5086 hsotg->status_buf = NULL; 5086 5087 } 5087 5088 5088 - ahbcfg = dwc2_readl(hsotg->regs + GAHBCFG); 5089 + ahbcfg = dwc2_readl(hsotg, GAHBCFG); 5089 5090 5090 5091 /* Disable all interrupts */ 5091 5092 ahbcfg &= ~GAHBCFG_GLBL_INTR_EN; 5092 - dwc2_writel(ahbcfg, hsotg->regs + GAHBCFG); 5093 - dwc2_writel(0, hsotg->regs + GINTMSK); 5093 + dwc2_writel(hsotg, ahbcfg, GAHBCFG); 5094 + dwc2_writel(hsotg, 0, GINTMSK); 5094 5095 5095 5096 if (hsotg->hw_params.snpsid >= DWC2_CORE_REV_3_00a) { 5096 - dctl = dwc2_readl(hsotg->regs + DCTL); 5097 + dctl = dwc2_readl(hsotg, DCTL); 5097 5098 dctl |= DCTL_SFTDISCON; 5098 - dwc2_writel(dctl, hsotg->regs + DCTL); 5099 + dwc2_writel(hsotg, dctl, DCTL); 5099 5100 } 5100 5101 5101 5102 if (hsotg->wq_otg) { ··· 5138 5139 5139 5140 retval = -ENOMEM; 5140 5141 5141 - hcfg = dwc2_readl(hsotg->regs + HCFG); 5142 + hcfg = dwc2_readl(hsotg, HCFG); 5142 5143 dev_dbg(hsotg->dev, "hcfg=%08x\n", hcfg); 5143 5144 5144 5145 #ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS ··· 5428 5429 5429 5430 /* Backup Host regs */ 5430 5431 hr = &hsotg->hr_backup; 5431 - hr->hcfg = dwc2_readl(hsotg->regs + HCFG); 5432 - hr->haintmsk = dwc2_readl(hsotg->regs + HAINTMSK); 5432 + hr->hcfg = dwc2_readl(hsotg, HCFG); 5433 + hr->haintmsk = dwc2_readl(hsotg, HAINTMSK); 5433 5434 for (i = 0; i < hsotg->params.host_channels; ++i) 5434 - hr->hcintmsk[i] = dwc2_readl(hsotg->regs + HCINTMSK(i)); 5435 + hr->hcintmsk[i] = dwc2_readl(hsotg, HCINTMSK(i)); 5435 5436 5436 5437 hr->hprt0 = dwc2_read_hprt0(hsotg); 5437 - hr->hfir = dwc2_readl(hsotg->regs + HFIR); 5438 - hr->hptxfsiz = dwc2_readl(hsotg->regs + HPTXFSIZ); 5438 + hr->hfir = dwc2_readl(hsotg, HFIR); 5439 + hr->hptxfsiz = dwc2_readl(hsotg, HPTXFSIZ); 5439 5440 hr->valid = true; 5440 5441 5441 5442 return 0; ··· 5464 5465 } 5465 5466 hr->valid = false; 5466 5467 5467 - dwc2_writel(hr->hcfg, hsotg->regs + HCFG); 5468 - dwc2_writel(hr->haintmsk, hsotg->regs + HAINTMSK); 5468 + dwc2_writel(hsotg, hr->hcfg, HCFG); 5469 + dwc2_writel(hsotg, hr->haintmsk, HAINTMSK); 5469 5470 5470 5471 for (i = 0; i < hsotg->params.host_channels; ++i) 5471 - dwc2_writel(hr->hcintmsk[i], hsotg->regs + HCINTMSK(i)); 5472 + dwc2_writel(hsotg, hr->hcintmsk[i], HCINTMSK(i)); 5472 5473 5473 - dwc2_writel(hr->hprt0, hsotg->regs + HPRT0); 5474 - dwc2_writel(hr->hfir, hsotg->regs + HFIR); 5475 - dwc2_writel(hr->hptxfsiz, hsotg->regs + HPTXFSIZ); 5474 + dwc2_writel(hsotg, hr->hprt0, HPRT0); 5475 + dwc2_writel(hsotg, hr->hfir, HFIR); 5476 + dwc2_writel(hsotg, hr->hptxfsiz, HPTXFSIZ); 5476 5477 hsotg->frame_number = 0; 5477 5478 5478 5479 return 0; ··· 5507 5508 } 5508 5509 5509 5510 /* Enter USB Suspend Mode */ 5510 - hprt0 = dwc2_readl(hsotg->regs + HPRT0); 5511 + hprt0 = dwc2_readl(hsotg, HPRT0); 5511 5512 hprt0 |= HPRT0_SUSP; 5512 5513 hprt0 &= ~HPRT0_ENA; 5513 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 5514 + dwc2_writel(hsotg, hprt0, HPRT0); 5514 5515 5515 5516 /* Wait for the HPRT0.PrtSusp register field to be set */ 5516 5517 if (dwc2_hsotg_wait_bit_set(hsotg, HPRT0, HPRT0_SUSP, 3000)) ··· 5523 5524 spin_lock_irqsave(&hsotg->lock, flags); 5524 5525 hsotg->lx_state = DWC2_L2; 5525 5526 5526 - gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 5527 + gusbcfg = dwc2_readl(hsotg, GUSBCFG); 5527 5528 if (gusbcfg & GUSBCFG_ULPI_UTMI_SEL) { 5528 5529 /* ULPI interface */ 5529 5530 /* Suspend the Phy Clock */ 5530 - pcgcctl = dwc2_readl(hsotg->regs + PCGCTL); 5531 + pcgcctl = dwc2_readl(hsotg, PCGCTL); 5531 5532 pcgcctl |= PCGCTL_STOPPCLK; 5532 - dwc2_writel(pcgcctl, hsotg->regs + PCGCTL); 5533 + dwc2_writel(hsotg, pcgcctl, PCGCTL); 5533 5534 udelay(10); 5534 5535 5535 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 5536 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 5536 5537 gpwrdn |= GPWRDN_PMUACTV; 5537 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 5538 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 5538 5539 udelay(10); 5539 5540 } else { 5540 5541 /* UTMI+ Interface */ 5541 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 5542 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 5542 5543 gpwrdn |= GPWRDN_PMUACTV; 5543 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 5544 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 5544 5545 udelay(10); 5545 5546 5546 - pcgcctl = dwc2_readl(hsotg->regs + PCGCTL); 5547 + pcgcctl = dwc2_readl(hsotg, PCGCTL); 5547 5548 pcgcctl |= PCGCTL_STOPPCLK; 5548 - dwc2_writel(pcgcctl, hsotg->regs + PCGCTL); 5549 + dwc2_writel(hsotg, pcgcctl, PCGCTL); 5549 5550 udelay(10); 5550 5551 } 5551 5552 5552 5553 /* Enable interrupts from wake up logic */ 5553 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 5554 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 5554 5555 gpwrdn |= GPWRDN_PMUINTSEL; 5555 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 5556 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 5556 5557 udelay(10); 5557 5558 5558 5559 /* Unmask host mode interrupts in GPWRDN */ 5559 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 5560 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 5560 5561 gpwrdn |= GPWRDN_DISCONN_DET_MSK; 5561 5562 gpwrdn |= GPWRDN_LNSTSCHG_MSK; 5562 5563 gpwrdn |= GPWRDN_STS_CHGINT_MSK; 5563 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 5564 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 5564 5565 udelay(10); 5565 5566 5566 5567 /* Enable Power Down Clamp */ 5567 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 5568 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 5568 5569 gpwrdn |= GPWRDN_PWRDNCLMP; 5569 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 5570 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 5570 5571 udelay(10); 5571 5572 5572 5573 /* Switch off VDD */ 5573 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 5574 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 5574 5575 gpwrdn |= GPWRDN_PWRDNSWTCH; 5575 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 5576 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 5576 5577 5577 5578 hsotg->hibernated = 1; 5578 5579 hsotg->bus_suspended = 1; ··· 5620 5621 mdelay(100); 5621 5622 5622 5623 /* Clear all pending interupts */ 5623 - dwc2_writel(0xffffffff, hsotg->regs + GINTSTS); 5624 + dwc2_writel(hsotg, 0xffffffff, GINTSTS); 5624 5625 5625 5626 /* De-assert Restore */ 5626 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 5627 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 5627 5628 gpwrdn &= ~GPWRDN_RESTORE; 5628 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 5629 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 5629 5630 udelay(10); 5630 5631 5631 5632 /* Restore GUSBCFG, HCFG */ 5632 - dwc2_writel(gr->gusbcfg, hsotg->regs + GUSBCFG); 5633 - dwc2_writel(hr->hcfg, hsotg->regs + HCFG); 5633 + dwc2_writel(hsotg, gr->gusbcfg, GUSBCFG); 5634 + dwc2_writel(hsotg, hr->hcfg, HCFG); 5634 5635 5635 5636 /* De-assert Wakeup Logic */ 5636 - gpwrdn = dwc2_readl(hsotg->regs + GPWRDN); 5637 + gpwrdn = dwc2_readl(hsotg, GPWRDN); 5637 5638 gpwrdn &= ~GPWRDN_PMUACTV; 5638 - dwc2_writel(gpwrdn, hsotg->regs + GPWRDN); 5639 + dwc2_writel(hsotg, gpwrdn, GPWRDN); 5639 5640 udelay(10); 5640 5641 5641 5642 hprt0 = hr->hprt0; 5642 5643 hprt0 |= HPRT0_PWR; 5643 5644 hprt0 &= ~HPRT0_ENA; 5644 5645 hprt0 &= ~HPRT0_SUSP; 5645 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 5646 + dwc2_writel(hsotg, hprt0, HPRT0); 5646 5647 5647 5648 hprt0 = hr->hprt0; 5648 5649 hprt0 |= HPRT0_PWR; ··· 5651 5652 5652 5653 if (reset) { 5653 5654 hprt0 |= HPRT0_RST; 5654 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 5655 + dwc2_writel(hsotg, hprt0, HPRT0); 5655 5656 5656 5657 /* Wait for Resume time and then program HPRT again */ 5657 5658 mdelay(60); 5658 5659 hprt0 &= ~HPRT0_RST; 5659 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 5660 + dwc2_writel(hsotg, hprt0, HPRT0); 5660 5661 } else { 5661 5662 hprt0 |= HPRT0_RES; 5662 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 5663 + dwc2_writel(hsotg, hprt0, HPRT0); 5663 5664 5664 5665 /* Wait for Resume time and then program HPRT again */ 5665 5666 mdelay(100); 5666 5667 hprt0 &= ~HPRT0_RES; 5667 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 5668 + dwc2_writel(hsotg, hprt0, HPRT0); 5668 5669 } 5669 5670 /* Clear all interrupt status */ 5670 - hprt0 = dwc2_readl(hsotg->regs + HPRT0); 5671 + hprt0 = dwc2_readl(hsotg, HPRT0); 5671 5672 hprt0 |= HPRT0_CONNDET; 5672 5673 hprt0 |= HPRT0_ENACHG; 5673 5674 hprt0 &= ~HPRT0_ENA; 5674 - dwc2_writel(hprt0, hsotg->regs + HPRT0); 5675 + dwc2_writel(hsotg, hprt0, HPRT0); 5675 5676 5676 - hprt0 = dwc2_readl(hsotg->regs + HPRT0); 5677 + hprt0 = dwc2_readl(hsotg, HPRT0); 5677 5678 5678 5679 /* Clear all pending interupts */ 5679 - dwc2_writel(0xffffffff, hsotg->regs + GINTSTS); 5680 + dwc2_writel(hsotg, 0xffffffff, GINTSTS); 5680 5681 5681 5682 /* Restore global registers */ 5682 5683 ret = dwc2_restore_global_registers(hsotg);
+5 -5
drivers/usb/dwc2/hcd.h
··· 469 469 */ 470 470 static inline void disable_hc_int(struct dwc2_hsotg *hsotg, int chnum, u32 intr) 471 471 { 472 - u32 mask = dwc2_readl(hsotg->regs + HCINTMSK(chnum)); 472 + u32 mask = dwc2_readl(hsotg, HCINTMSK(chnum)); 473 473 474 474 mask &= ~intr; 475 - dwc2_writel(mask, hsotg->regs + HCINTMSK(chnum)); 475 + dwc2_writel(hsotg, mask, HCINTMSK(chnum)); 476 476 } 477 477 478 478 void dwc2_hc_cleanup(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan); ··· 487 487 */ 488 488 static inline u32 dwc2_read_hprt0(struct dwc2_hsotg *hsotg) 489 489 { 490 - u32 hprt0 = dwc2_readl(hsotg->regs + HPRT0); 490 + u32 hprt0 = dwc2_readl(hsotg, HPRT0); 491 491 492 492 hprt0 &= ~(HPRT0_ENA | HPRT0_CONNDET | HPRT0_ENACHG | HPRT0_OVRCURRCHG); 493 493 return hprt0; ··· 690 690 */ 691 691 static inline u32 dwc2_read_core_intr(struct dwc2_hsotg *hsotg) 692 692 { 693 - return dwc2_readl(hsotg->regs + GINTSTS) & 694 - dwc2_readl(hsotg->regs + GINTMSK); 693 + return dwc2_readl(hsotg, GINTSTS) & 694 + dwc2_readl(hsotg, GINTMSK); 695 695 } 696 696 697 697 static inline u32 dwc2_hcd_urb_get_status(struct dwc2_hcd_urb *dwc2_urb)
+5 -5
drivers/usb/dwc2/hcd_ddma.c
··· 185 185 186 186 spin_lock_irqsave(&hsotg->lock, flags); 187 187 188 - hcfg = dwc2_readl(hsotg->regs + HCFG); 188 + hcfg = dwc2_readl(hsotg, HCFG); 189 189 if (hcfg & HCFG_PERSCHEDENA) { 190 190 /* already enabled */ 191 191 spin_unlock_irqrestore(&hsotg->lock, flags); 192 192 return; 193 193 } 194 194 195 - dwc2_writel(hsotg->frame_list_dma, hsotg->regs + HFLBADDR); 195 + dwc2_writel(hsotg, hsotg->frame_list_dma, HFLBADDR); 196 196 197 197 hcfg &= ~HCFG_FRLISTEN_MASK; 198 198 hcfg |= fr_list_en | HCFG_PERSCHEDENA; 199 199 dev_vdbg(hsotg->dev, "Enabling Periodic schedule\n"); 200 - dwc2_writel(hcfg, hsotg->regs + HCFG); 200 + dwc2_writel(hsotg, hcfg, HCFG); 201 201 202 202 spin_unlock_irqrestore(&hsotg->lock, flags); 203 203 } ··· 209 209 210 210 spin_lock_irqsave(&hsotg->lock, flags); 211 211 212 - hcfg = dwc2_readl(hsotg->regs + HCFG); 212 + hcfg = dwc2_readl(hsotg, HCFG); 213 213 if (!(hcfg & HCFG_PERSCHEDENA)) { 214 214 /* already disabled */ 215 215 spin_unlock_irqrestore(&hsotg->lock, flags); ··· 218 218 219 219 hcfg &= ~HCFG_PERSCHEDENA; 220 220 dev_vdbg(hsotg->dev, "Disabling Periodic schedule\n"); 221 - dwc2_writel(hcfg, hsotg->regs + HCFG); 221 + dwc2_writel(hsotg, hcfg, HCFG); 222 222 223 223 spin_unlock_irqrestore(&hsotg->lock, flags); 224 224 }
+48 -48
drivers/usb/dwc2/hcd_intr.c
··· 144 144 enum dwc2_transaction_type tr_type; 145 145 146 146 /* Clear interrupt */ 147 - dwc2_writel(GINTSTS_SOF, hsotg->regs + GINTSTS); 147 + dwc2_writel(hsotg, GINTSTS_SOF, GINTSTS); 148 148 149 149 #ifdef DEBUG_SOF 150 150 dev_vdbg(hsotg->dev, "--Start of Frame Interrupt--\n"); ··· 191 191 if (dbg_perio()) 192 192 dev_vdbg(hsotg->dev, "--RxFIFO Level Interrupt--\n"); 193 193 194 - grxsts = dwc2_readl(hsotg->regs + GRXSTSP); 194 + grxsts = dwc2_readl(hsotg, GRXSTSP); 195 195 chnum = (grxsts & GRXSTS_HCHNUM_MASK) >> GRXSTS_HCHNUM_SHIFT; 196 196 chan = hsotg->hc_ptr_array[chnum]; 197 197 if (!chan) { ··· 274 274 dev_vdbg(hsotg->dev, "%s(%p)\n", __func__, hsotg); 275 275 276 276 /* Every time when port enables calculate HFIR.FrInterval */ 277 - hfir = dwc2_readl(hsotg->regs + HFIR); 277 + hfir = dwc2_readl(hsotg, HFIR); 278 278 hfir &= ~HFIR_FRINT_MASK; 279 279 hfir |= dwc2_calc_frame_interval(hsotg) << HFIR_FRINT_SHIFT & 280 280 HFIR_FRINT_MASK; 281 - dwc2_writel(hfir, hsotg->regs + HFIR); 281 + dwc2_writel(hsotg, hfir, HFIR); 282 282 283 283 /* Check if we need to adjust the PHY clock speed for low power */ 284 284 if (!params->host_support_fs_ls_low_power) { ··· 287 287 return; 288 288 } 289 289 290 - usbcfg = dwc2_readl(hsotg->regs + GUSBCFG); 290 + usbcfg = dwc2_readl(hsotg, GUSBCFG); 291 291 prtspd = (hprt0 & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT; 292 292 293 293 if (prtspd == HPRT0_SPD_LOW_SPEED || prtspd == HPRT0_SPD_FULL_SPEED) { ··· 295 295 if (!(usbcfg & GUSBCFG_PHY_LP_CLK_SEL)) { 296 296 /* Set PHY low power clock select for FS/LS devices */ 297 297 usbcfg |= GUSBCFG_PHY_LP_CLK_SEL; 298 - dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); 298 + dwc2_writel(hsotg, usbcfg, GUSBCFG); 299 299 do_reset = 1; 300 300 } 301 301 302 - hcfg = dwc2_readl(hsotg->regs + HCFG); 302 + hcfg = dwc2_readl(hsotg, HCFG); 303 303 fslspclksel = (hcfg & HCFG_FSLSPCLKSEL_MASK) >> 304 304 HCFG_FSLSPCLKSEL_SHIFT; 305 305 ··· 312 312 fslspclksel = HCFG_FSLSPCLKSEL_6_MHZ; 313 313 hcfg &= ~HCFG_FSLSPCLKSEL_MASK; 314 314 hcfg |= fslspclksel << HCFG_FSLSPCLKSEL_SHIFT; 315 - dwc2_writel(hcfg, hsotg->regs + HCFG); 315 + dwc2_writel(hsotg, hcfg, HCFG); 316 316 do_reset = 1; 317 317 } 318 318 } else { ··· 323 323 fslspclksel = HCFG_FSLSPCLKSEL_48_MHZ; 324 324 hcfg &= ~HCFG_FSLSPCLKSEL_MASK; 325 325 hcfg |= fslspclksel << HCFG_FSLSPCLKSEL_SHIFT; 326 - dwc2_writel(hcfg, hsotg->regs + HCFG); 326 + dwc2_writel(hsotg, hcfg, HCFG); 327 327 do_reset = 1; 328 328 } 329 329 } ··· 331 331 /* Not low power */ 332 332 if (usbcfg & GUSBCFG_PHY_LP_CLK_SEL) { 333 333 usbcfg &= ~GUSBCFG_PHY_LP_CLK_SEL; 334 - dwc2_writel(usbcfg, hsotg->regs + GUSBCFG); 334 + dwc2_writel(hsotg, usbcfg, GUSBCFG); 335 335 do_reset = 1; 336 336 } 337 337 } 338 338 339 339 if (do_reset) { 340 340 *hprt0_modify |= HPRT0_RST; 341 - dwc2_writel(*hprt0_modify, hsotg->regs + HPRT0); 341 + dwc2_writel(hsotg, *hprt0_modify, HPRT0); 342 342 queue_delayed_work(hsotg->wq_otg, &hsotg->reset_work, 343 343 msecs_to_jiffies(60)); 344 344 } else { ··· 359 359 360 360 dev_vdbg(hsotg->dev, "--Port Interrupt--\n"); 361 361 362 - hprt0 = dwc2_readl(hsotg->regs + HPRT0); 362 + hprt0 = dwc2_readl(hsotg, HPRT0); 363 363 hprt0_modify = hprt0; 364 364 365 365 /* ··· 374 374 * Set flag and clear if detected 375 375 */ 376 376 if (hprt0 & HPRT0_CONNDET) { 377 - dwc2_writel(hprt0_modify | HPRT0_CONNDET, hsotg->regs + HPRT0); 377 + dwc2_writel(hsotg, hprt0_modify | HPRT0_CONNDET, HPRT0); 378 378 379 379 dev_vdbg(hsotg->dev, 380 380 "--Port Interrupt HPRT0=0x%08x Port Connect Detected--\n", ··· 392 392 * Clear if detected - Set internal flag if disabled 393 393 */ 394 394 if (hprt0 & HPRT0_ENACHG) { 395 - dwc2_writel(hprt0_modify | HPRT0_ENACHG, hsotg->regs + HPRT0); 395 + dwc2_writel(hsotg, hprt0_modify | HPRT0_ENACHG, HPRT0); 396 396 dev_vdbg(hsotg->dev, 397 397 " --Port Interrupt HPRT0=0x%08x Port Enable Changed (now %d)--\n", 398 398 hprt0, !!(hprt0 & HPRT0_ENA)); ··· 406 406 407 407 hsotg->params.dma_desc_enable = false; 408 408 hsotg->new_connection = false; 409 - hcfg = dwc2_readl(hsotg->regs + HCFG); 409 + hcfg = dwc2_readl(hsotg, HCFG); 410 410 hcfg &= ~HCFG_DESCDMA; 411 - dwc2_writel(hcfg, hsotg->regs + HCFG); 411 + dwc2_writel(hsotg, hcfg, HCFG); 412 412 } 413 413 } 414 414 } 415 415 416 416 /* Overcurrent Change Interrupt */ 417 417 if (hprt0 & HPRT0_OVRCURRCHG) { 418 - dwc2_writel(hprt0_modify | HPRT0_OVRCURRCHG, 419 - hsotg->regs + HPRT0); 418 + dwc2_writel(hsotg, hprt0_modify | HPRT0_OVRCURRCHG, 419 + HPRT0); 420 420 dev_vdbg(hsotg->dev, 421 421 " --Port Interrupt HPRT0=0x%08x Port Overcurrent Changed--\n", 422 422 hprt0); ··· 441 441 { 442 442 u32 hctsiz, count, length; 443 443 444 - hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chnum)); 444 + hctsiz = dwc2_readl(hsotg, HCTSIZ(chnum)); 445 445 446 446 if (halt_status == DWC2_HC_XFER_COMPLETE) { 447 447 if (chan->ep_is_in) { ··· 518 518 urb->status = 0; 519 519 } 520 520 521 - hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chnum)); 521 + hctsiz = dwc2_readl(hsotg, HCTSIZ(chnum)); 522 522 dev_vdbg(hsotg->dev, "DWC_otg: %s: %s, channel %d\n", 523 523 __func__, (chan->ep_is_in ? "IN" : "OUT"), chnum); 524 524 dev_vdbg(hsotg->dev, " chan->xfer_len %d\n", chan->xfer_len); ··· 541 541 struct dwc2_host_chan *chan, int chnum, 542 542 struct dwc2_qtd *qtd) 543 543 { 544 - u32 hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chnum)); 544 + u32 hctsiz = dwc2_readl(hsotg, HCTSIZ(chnum)); 545 545 u32 pid = (hctsiz & TSIZ_SC_MC_PID_MASK) >> TSIZ_SC_MC_PID_SHIFT; 546 546 547 547 if (chan->ep_type != USB_ENDPOINT_XFER_CONTROL) { ··· 780 780 } 781 781 } 782 782 783 - haintmsk = dwc2_readl(hsotg->regs + HAINTMSK); 783 + haintmsk = dwc2_readl(hsotg, HAINTMSK); 784 784 haintmsk &= ~(1 << chan->hc_num); 785 - dwc2_writel(haintmsk, hsotg->regs + HAINTMSK); 785 + dwc2_writel(hsotg, haintmsk, HAINTMSK); 786 786 787 787 /* Try to queue more transfers now that there's a free channel */ 788 788 tr_type = dwc2_hcd_select_transactions(hsotg); ··· 829 829 * is enabled so that the non-periodic schedule will 830 830 * be processed 831 831 */ 832 - gintmsk = dwc2_readl(hsotg->regs + GINTMSK); 832 + gintmsk = dwc2_readl(hsotg, GINTMSK); 833 833 gintmsk |= GINTSTS_NPTXFEMP; 834 - dwc2_writel(gintmsk, hsotg->regs + GINTMSK); 834 + dwc2_writel(hsotg, gintmsk, GINTMSK); 835 835 } else { 836 836 dev_vdbg(hsotg->dev, "isoc/intr\n"); 837 837 /* ··· 848 848 * enabled so that the periodic schedule will be 849 849 * processed 850 850 */ 851 - gintmsk = dwc2_readl(hsotg->regs + GINTMSK); 851 + gintmsk = dwc2_readl(hsotg, GINTMSK); 852 852 gintmsk |= GINTSTS_PTXFEMP; 853 - dwc2_writel(gintmsk, hsotg->regs + GINTMSK); 853 + dwc2_writel(hsotg, gintmsk, GINTMSK); 854 854 } 855 855 } 856 856 } ··· 915 915 struct dwc2_qtd *qtd, 916 916 enum dwc2_halt_status halt_status) 917 917 { 918 - u32 hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chnum)); 918 + u32 hctsiz = dwc2_readl(hsotg, HCTSIZ(chnum)); 919 919 920 920 qtd->error_count = 0; 921 921 ··· 959 959 960 960 qtd->isoc_split_offset += len; 961 961 962 - hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chnum)); 962 + hctsiz = dwc2_readl(hsotg, HCTSIZ(chnum)); 963 963 pid = (hctsiz & TSIZ_SC_MC_PID_MASK) >> TSIZ_SC_MC_PID_SHIFT; 964 964 965 965 if (frame_desc->actual_length >= frame_desc->length || pid == 0) { ··· 1185 1185 1186 1186 urb->actual_length += xfer_length; 1187 1187 1188 - hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chnum)); 1188 + hctsiz = dwc2_readl(hsotg, HCTSIZ(chnum)); 1189 1189 dev_vdbg(hsotg->dev, "DWC_otg: %s: %s, channel %d\n", 1190 1190 __func__, (chan->ep_is_in ? "IN" : "OUT"), chnum); 1191 1191 dev_vdbg(hsotg->dev, " chan->start_pkt_count %d\n", ··· 1561 1561 1562 1562 dwc2_hc_handle_tt_clear(hsotg, chan, qtd); 1563 1563 1564 - hcchar = dwc2_readl(hsotg->regs + HCCHAR(chnum)); 1565 - hcsplt = dwc2_readl(hsotg->regs + HCSPLT(chnum)); 1566 - hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chnum)); 1567 - hc_dma = dwc2_readl(hsotg->regs + HCDMA(chnum)); 1564 + hcchar = dwc2_readl(hsotg, HCCHAR(chnum)); 1565 + hcsplt = dwc2_readl(hsotg, HCSPLT(chnum)); 1566 + hctsiz = dwc2_readl(hsotg, HCTSIZ(chnum)); 1567 + hc_dma = dwc2_readl(hsotg, HCDMA(chnum)); 1568 1568 1569 1569 dev_err(hsotg->dev, "AHB ERROR, Channel %d\n", chnum); 1570 1570 dev_err(hsotg->dev, " hcchar 0x%08x, hcsplt 0x%08x\n", hcchar, hcsplt); ··· 1776 1776 * This code is here only as a check. This condition should 1777 1777 * never happen. Ignore the halt if it does occur. 1778 1778 */ 1779 - hcchar = dwc2_readl(hsotg->regs + HCCHAR(chnum)); 1780 - hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chnum)); 1781 - hcintmsk = dwc2_readl(hsotg->regs + HCINTMSK(chnum)); 1782 - hcsplt = dwc2_readl(hsotg->regs + HCSPLT(chnum)); 1779 + hcchar = dwc2_readl(hsotg, HCCHAR(chnum)); 1780 + hctsiz = dwc2_readl(hsotg, HCTSIZ(chnum)); 1781 + hcintmsk = dwc2_readl(hsotg, HCINTMSK(chnum)); 1782 + hcsplt = dwc2_readl(hsotg, HCSPLT(chnum)); 1783 1783 dev_dbg(hsotg->dev, 1784 1784 "%s: chan->halt_status DWC2_HC_XFER_NO_HALT_STATUS,\n", 1785 1785 __func__); ··· 1803 1803 * when the halt interrupt occurs. Halt the channel again if it does 1804 1804 * occur. 1805 1805 */ 1806 - hcchar = dwc2_readl(hsotg->regs + HCCHAR(chnum)); 1806 + hcchar = dwc2_readl(hsotg, HCCHAR(chnum)); 1807 1807 if (hcchar & HCCHAR_CHDIS) { 1808 1808 dev_warn(hsotg->dev, 1809 1809 "%s: hcchar.chdis set unexpectedly, hcchar 0x%08x, trying to halt again\n", ··· 1863 1863 return; 1864 1864 } 1865 1865 1866 - hcintmsk = dwc2_readl(hsotg->regs + HCINTMSK(chnum)); 1866 + hcintmsk = dwc2_readl(hsotg, HCINTMSK(chnum)); 1867 1867 1868 1868 if (chan->hcint & HCINTMSK_XFERCOMPL) { 1869 1869 /* ··· 1958 1958 dev_err(hsotg->dev, 1959 1959 "hcint 0x%08x, intsts 0x%08x\n", 1960 1960 chan->hcint, 1961 - dwc2_readl(hsotg->regs + GINTSTS)); 1961 + dwc2_readl(hsotg, GINTSTS)); 1962 1962 goto error; 1963 1963 } 1964 1964 } ··· 2031 2031 2032 2032 chan = hsotg->hc_ptr_array[chnum]; 2033 2033 2034 - hcint = dwc2_readl(hsotg->regs + HCINT(chnum)); 2035 - hcintmsk = dwc2_readl(hsotg->regs + HCINTMSK(chnum)); 2034 + hcint = dwc2_readl(hsotg, HCINT(chnum)); 2035 + hcintmsk = dwc2_readl(hsotg, HCINTMSK(chnum)); 2036 2036 if (!chan) { 2037 2037 dev_err(hsotg->dev, "## hc_ptr_array for channel is NULL ##\n"); 2038 - dwc2_writel(hcint, hsotg->regs + HCINT(chnum)); 2038 + dwc2_writel(hsotg, hcint, HCINT(chnum)); 2039 2039 return; 2040 2040 } 2041 2041 ··· 2047 2047 hcint, hcintmsk, hcint & hcintmsk); 2048 2048 } 2049 2049 2050 - dwc2_writel(hcint, hsotg->regs + HCINT(chnum)); 2050 + dwc2_writel(hsotg, hcint, HCINT(chnum)); 2051 2051 2052 2052 /* 2053 2053 * If we got an interrupt after someone called ··· 2182 2182 int i; 2183 2183 struct dwc2_host_chan *chan, *chan_tmp; 2184 2184 2185 - haint = dwc2_readl(hsotg->regs + HAINT); 2185 + haint = dwc2_readl(hsotg, HAINT); 2186 2186 if (dbg_perio()) { 2187 2187 dev_vdbg(hsotg->dev, "%s()\n", __func__); 2188 2188 ··· 2266 2266 "DWC OTG HCD Finished Servicing Interrupts\n"); 2267 2267 dev_vdbg(hsotg->dev, 2268 2268 "DWC OTG HCD gintsts=0x%08x gintmsk=0x%08x\n", 2269 - dwc2_readl(hsotg->regs + GINTSTS), 2270 - dwc2_readl(hsotg->regs + GINTMSK)); 2269 + dwc2_readl(hsotg, GINTSTS), 2270 + dwc2_readl(hsotg, GINTMSK)); 2271 2271 } 2272 2272 } 2273 2273
+5 -5
drivers/usb/dwc2/hcd_queue.c
··· 1510 1510 bool ep_is_in = !!dwc2_hcd_is_pipe_in(&urb->pipe_info); 1511 1511 bool ep_is_isoc = (ep_type == USB_ENDPOINT_XFER_ISOC); 1512 1512 bool ep_is_int = (ep_type == USB_ENDPOINT_XFER_INT); 1513 - u32 hprt = dwc2_readl(hsotg->regs + HPRT0); 1513 + u32 hprt = dwc2_readl(hsotg, HPRT0); 1514 1514 u32 prtspd = (hprt & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT; 1515 1515 bool do_split = (prtspd == HPRT0_SPD_HIGH_SPEED && 1516 1516 dev_speed != USB_SPEED_HIGH); ··· 1747 1747 if (status) 1748 1748 return status; 1749 1749 if (!hsotg->periodic_qh_count) { 1750 - intr_mask = dwc2_readl(hsotg->regs + GINTMSK); 1750 + intr_mask = dwc2_readl(hsotg, GINTMSK); 1751 1751 intr_mask |= GINTSTS_SOF; 1752 - dwc2_writel(intr_mask, hsotg->regs + GINTMSK); 1752 + dwc2_writel(hsotg, intr_mask, GINTMSK); 1753 1753 } 1754 1754 hsotg->periodic_qh_count++; 1755 1755 ··· 1788 1788 hsotg->periodic_qh_count--; 1789 1789 if (!hsotg->periodic_qh_count && 1790 1790 !hsotg->params.dma_desc_enable) { 1791 - intr_mask = dwc2_readl(hsotg->regs + GINTMSK); 1791 + intr_mask = dwc2_readl(hsotg, GINTMSK); 1792 1792 intr_mask &= ~GINTSTS_SOF; 1793 - dwc2_writel(intr_mask, hsotg->regs + GINTMSK); 1793 + dwc2_writel(hsotg, intr_mask, GINTMSK); 1794 1794 } 1795 1795 } 1796 1796
+10 -10
drivers/usb/dwc2/params.c
··· 654 654 655 655 dwc2_force_mode(hsotg, true); 656 656 657 - gnptxfsiz = dwc2_readl(hsotg->regs + GNPTXFSIZ); 658 - hptxfsiz = dwc2_readl(hsotg->regs + HPTXFSIZ); 657 + gnptxfsiz = dwc2_readl(hsotg, GNPTXFSIZ); 658 + hptxfsiz = dwc2_readl(hsotg, HPTXFSIZ); 659 659 660 660 hw->host_nperio_tx_fifo_size = (gnptxfsiz & FIFOSIZE_DEPTH_MASK) >> 661 661 FIFOSIZE_DEPTH_SHIFT; ··· 679 679 680 680 dwc2_force_mode(hsotg, false); 681 681 682 - gnptxfsiz = dwc2_readl(hsotg->regs + GNPTXFSIZ); 682 + gnptxfsiz = dwc2_readl(hsotg, GNPTXFSIZ); 683 683 684 684 fifo_count = dwc2_hsotg_tx_fifo_count(hsotg); 685 685 686 686 for (fifo = 1; fifo <= fifo_count; fifo++) { 687 687 hw->g_tx_fifo_size[fifo] = 688 - (dwc2_readl(hsotg->regs + DPTXFSIZN(fifo)) & 688 + (dwc2_readl(hsotg, DPTXFSIZN(fifo)) & 689 689 FIFOSIZE_DEPTH_MASK) >> FIFOSIZE_DEPTH_SHIFT; 690 690 } 691 691 ··· 713 713 * 0x45f4xxxx, 0x5531xxxx or 0x5532xxxx 714 714 */ 715 715 716 - hw->snpsid = dwc2_readl(hsotg->regs + GSNPSID); 716 + hw->snpsid = dwc2_readl(hsotg, GSNPSID); 717 717 if ((hw->snpsid & GSNPSID_ID_MASK) != DWC2_OTG_ID && 718 718 (hw->snpsid & GSNPSID_ID_MASK) != DWC2_FS_IOT_ID && 719 719 (hw->snpsid & GSNPSID_ID_MASK) != DWC2_HS_IOT_ID) { ··· 726 726 hw->snpsid >> 12 & 0xf, hw->snpsid >> 8 & 0xf, 727 727 hw->snpsid >> 4 & 0xf, hw->snpsid & 0xf, hw->snpsid); 728 728 729 - hwcfg1 = dwc2_readl(hsotg->regs + GHWCFG1); 730 - hwcfg2 = dwc2_readl(hsotg->regs + GHWCFG2); 731 - hwcfg3 = dwc2_readl(hsotg->regs + GHWCFG3); 732 - hwcfg4 = dwc2_readl(hsotg->regs + GHWCFG4); 733 - grxfsiz = dwc2_readl(hsotg->regs + GRXFSIZ); 729 + hwcfg1 = dwc2_readl(hsotg, GHWCFG1); 730 + hwcfg2 = dwc2_readl(hsotg, GHWCFG2); 731 + hwcfg3 = dwc2_readl(hsotg, GHWCFG3); 732 + hwcfg4 = dwc2_readl(hsotg, GHWCFG4); 733 + grxfsiz = dwc2_readl(hsotg, GRXFSIZ); 734 734 735 735 /* hwcfg1 */ 736 736 hw->dev_ep_dirs = hwcfg1;