0042-USB-DWC2-big-endian-support.patch 107 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184
  1. --- a/drivers/usb/dwc2/core.c
  2. +++ b/drivers/usb/dwc2/core.c
  3. @@ -67,10 +67,10 @@ static void dwc2_enable_common_interrupt
  4. u32 intmsk;
  5. /* Clear any pending OTG Interrupts */
  6. - writel(0xffffffff, hsotg->regs + GOTGINT);
  7. + dwc2_writel(0xffffffff, hsotg->regs + GOTGINT);
  8. /* Clear any pending interrupts */
  9. - writel(0xffffffff, hsotg->regs + GINTSTS);
  10. + dwc2_writel(0xffffffff, hsotg->regs + GINTSTS);
  11. /* Enable the interrupts in the GINTMSK */
  12. intmsk = GINTSTS_MODEMIS | GINTSTS_OTGINT;
  13. @@ -81,7 +81,7 @@ static void dwc2_enable_common_interrupt
  14. intmsk |= GINTSTS_CONIDSTSCHNG | GINTSTS_WKUPINT | GINTSTS_USBSUSP |
  15. GINTSTS_SESSREQINT;
  16. - writel(intmsk, hsotg->regs + GINTMSK);
  17. + dwc2_writel(intmsk, hsotg->regs + GINTMSK);
  18. }
  19. /*
  20. @@ -104,10 +104,10 @@ static void dwc2_init_fs_ls_pclk_sel(str
  21. }
  22. dev_dbg(hsotg->dev, "Initializing HCFG.FSLSPClkSel to %08x\n", val);
  23. - hcfg = readl(hsotg->regs + HCFG);
  24. + hcfg = dwc2_readl(hsotg->regs + HCFG);
  25. hcfg &= ~HCFG_FSLSPCLKSEL_MASK;
  26. hcfg |= val << HCFG_FSLSPCLKSEL_SHIFT;
  27. - writel(hcfg, hsotg->regs + HCFG);
  28. + dwc2_writel(hcfg, hsotg->regs + HCFG);
  29. }
  30. /*
  31. @@ -125,7 +125,7 @@ static int dwc2_core_reset(struct dwc2_h
  32. /* Wait for AHB master IDLE state */
  33. do {
  34. usleep_range(20000, 40000);
  35. - greset = readl(hsotg->regs + GRSTCTL);
  36. + greset = dwc2_readl(hsotg->regs + GRSTCTL);
  37. if (++count > 50) {
  38. dev_warn(hsotg->dev,
  39. "%s() HANG! AHB Idle GRSTCTL=%0x\n",
  40. @@ -137,10 +137,10 @@ static int dwc2_core_reset(struct dwc2_h
  41. /* Core Soft Reset */
  42. count = 0;
  43. greset |= GRSTCTL_CSFTRST;
  44. - writel(greset, hsotg->regs + GRSTCTL);
  45. + dwc2_writel(greset, hsotg->regs + GRSTCTL);
  46. do {
  47. usleep_range(20000, 40000);
  48. - greset = readl(hsotg->regs + GRSTCTL);
  49. + greset = dwc2_readl(hsotg->regs + GRSTCTL);
  50. if (++count > 50) {
  51. dev_warn(hsotg->dev,
  52. "%s() HANG! Soft Reset GRSTCTL=%0x\n",
  53. @@ -150,20 +150,20 @@ static int dwc2_core_reset(struct dwc2_h
  54. } while (greset & GRSTCTL_CSFTRST);
  55. if (hsotg->dr_mode == USB_DR_MODE_HOST) {
  56. - gusbcfg = readl(hsotg->regs + GUSBCFG);
  57. + gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
  58. gusbcfg &= ~GUSBCFG_FORCEDEVMODE;
  59. gusbcfg |= GUSBCFG_FORCEHOSTMODE;
  60. - writel(gusbcfg, hsotg->regs + GUSBCFG);
  61. + dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG);
  62. } else if (hsotg->dr_mode == USB_DR_MODE_PERIPHERAL) {
  63. - gusbcfg = readl(hsotg->regs + GUSBCFG);
  64. + gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
  65. gusbcfg &= ~GUSBCFG_FORCEHOSTMODE;
  66. gusbcfg |= GUSBCFG_FORCEDEVMODE;
  67. - writel(gusbcfg, hsotg->regs + GUSBCFG);
  68. + dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG);
  69. } else if (hsotg->dr_mode == USB_DR_MODE_OTG) {
  70. - gusbcfg = readl(hsotg->regs + GUSBCFG);
  71. + gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
  72. gusbcfg &= ~GUSBCFG_FORCEHOSTMODE;
  73. gusbcfg &= ~GUSBCFG_FORCEDEVMODE;
  74. - writel(gusbcfg, hsotg->regs + GUSBCFG);
  75. + dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG);
  76. }
  77. /*
  78. @@ -186,9 +186,9 @@ static int dwc2_fs_phy_init(struct dwc2_
  79. */
  80. if (select_phy) {
  81. dev_dbg(hsotg->dev, "FS PHY selected\n");
  82. - usbcfg = readl(hsotg->regs + GUSBCFG);
  83. + usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
  84. usbcfg |= GUSBCFG_PHYSEL;
  85. - writel(usbcfg, hsotg->regs + GUSBCFG);
  86. + dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
  87. /* Reset after a PHY select */
  88. retval = dwc2_core_reset(hsotg);
  89. @@ -211,18 +211,18 @@ static int dwc2_fs_phy_init(struct dwc2_
  90. dev_dbg(hsotg->dev, "FS PHY enabling I2C\n");
  91. /* Program GUSBCFG.OtgUtmiFsSel to I2C */
  92. - usbcfg = readl(hsotg->regs + GUSBCFG);
  93. + usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
  94. usbcfg |= GUSBCFG_OTG_UTMI_FS_SEL;
  95. - writel(usbcfg, hsotg->regs + GUSBCFG);
  96. + dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
  97. /* Program GI2CCTL.I2CEn */
  98. - i2cctl = readl(hsotg->regs + GI2CCTL);
  99. + i2cctl = dwc2_readl(hsotg->regs + GI2CCTL);
  100. i2cctl &= ~GI2CCTL_I2CDEVADDR_MASK;
  101. i2cctl |= 1 << GI2CCTL_I2CDEVADDR_SHIFT;
  102. i2cctl &= ~GI2CCTL_I2CEN;
  103. - writel(i2cctl, hsotg->regs + GI2CCTL);
  104. + dwc2_writel(i2cctl, hsotg->regs + GI2CCTL);
  105. i2cctl |= GI2CCTL_I2CEN;
  106. - writel(i2cctl, hsotg->regs + GI2CCTL);
  107. + dwc2_writel(i2cctl, hsotg->regs + GI2CCTL);
  108. }
  109. return retval;
  110. @@ -236,7 +236,7 @@ static int dwc2_hs_phy_init(struct dwc2_
  111. if (!select_phy)
  112. return 0;
  113. - usbcfg = readl(hsotg->regs + GUSBCFG);
  114. + usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
  115. /*
  116. * HS PHY parameters. These parameters are preserved during soft reset
  117. @@ -264,7 +264,7 @@ static int dwc2_hs_phy_init(struct dwc2_
  118. break;
  119. }
  120. - writel(usbcfg, hsotg->regs + GUSBCFG);
  121. + dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
  122. /* Reset after setting the PHY parameters */
  123. retval = dwc2_core_reset(hsotg);
  124. @@ -299,15 +299,15 @@ static int dwc2_phy_init(struct dwc2_hso
  125. hsotg->hw_params.fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED &&
  126. hsotg->core_params->ulpi_fs_ls > 0) {
  127. dev_dbg(hsotg->dev, "Setting ULPI FSLS\n");
  128. - usbcfg = readl(hsotg->regs + GUSBCFG);
  129. + usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
  130. usbcfg |= GUSBCFG_ULPI_FS_LS;
  131. usbcfg |= GUSBCFG_ULPI_CLK_SUSP_M;
  132. - writel(usbcfg, hsotg->regs + GUSBCFG);
  133. + dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
  134. } else {
  135. - usbcfg = readl(hsotg->regs + GUSBCFG);
  136. + usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
  137. usbcfg &= ~GUSBCFG_ULPI_FS_LS;
  138. usbcfg &= ~GUSBCFG_ULPI_CLK_SUSP_M;
  139. - writel(usbcfg, hsotg->regs + GUSBCFG);
  140. + dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
  141. }
  142. return retval;
  143. @@ -315,7 +315,7 @@ static int dwc2_phy_init(struct dwc2_hso
  144. static int dwc2_gahbcfg_init(struct dwc2_hsotg *hsotg)
  145. {
  146. - u32 ahbcfg = readl(hsotg->regs + GAHBCFG);
  147. + u32 ahbcfg = dwc2_readl(hsotg->regs + GAHBCFG);
  148. switch (hsotg->hw_params.arch) {
  149. case GHWCFG2_EXT_DMA_ARCH:
  150. @@ -354,7 +354,7 @@ static int dwc2_gahbcfg_init(struct dwc2
  151. if (hsotg->core_params->dma_enable > 0)
  152. ahbcfg |= GAHBCFG_DMA_EN;
  153. - writel(ahbcfg, hsotg->regs + GAHBCFG);
  154. + dwc2_writel(ahbcfg, hsotg->regs + GAHBCFG);
  155. return 0;
  156. }
  157. @@ -363,7 +363,7 @@ static void dwc2_gusbcfg_init(struct dwc
  158. {
  159. u32 usbcfg;
  160. - usbcfg = readl(hsotg->regs + GUSBCFG);
  161. + usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
  162. usbcfg &= ~(GUSBCFG_HNPCAP | GUSBCFG_SRPCAP);
  163. switch (hsotg->hw_params.op_mode) {
  164. @@ -391,7 +391,7 @@ static void dwc2_gusbcfg_init(struct dwc
  165. break;
  166. }
  167. - writel(usbcfg, hsotg->regs + GUSBCFG);
  168. + dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
  169. }
  170. /**
  171. @@ -409,7 +409,7 @@ int dwc2_core_init(struct dwc2_hsotg *hs
  172. dev_dbg(hsotg->dev, "%s(%p)\n", __func__, hsotg);
  173. - usbcfg = readl(hsotg->regs + GUSBCFG);
  174. + usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
  175. /* Set ULPI External VBUS bit if needed */
  176. usbcfg &= ~GUSBCFG_ULPI_EXT_VBUS_DRV;
  177. @@ -422,7 +422,7 @@ int dwc2_core_init(struct dwc2_hsotg *hs
  178. if (hsotg->core_params->ts_dline > 0)
  179. usbcfg |= GUSBCFG_TERMSELDLPULSE;
  180. - writel(usbcfg, hsotg->regs + GUSBCFG);
  181. + dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
  182. /* Reset the Controller */
  183. retval = dwc2_core_reset(hsotg);
  184. @@ -448,11 +448,11 @@ int dwc2_core_init(struct dwc2_hsotg *hs
  185. dwc2_gusbcfg_init(hsotg);
  186. /* Program the GOTGCTL register */
  187. - otgctl = readl(hsotg->regs + GOTGCTL);
  188. + otgctl = dwc2_readl(hsotg->regs + GOTGCTL);
  189. otgctl &= ~GOTGCTL_OTGVER;
  190. if (hsotg->core_params->otg_ver > 0)
  191. otgctl |= GOTGCTL_OTGVER;
  192. - writel(otgctl, hsotg->regs + GOTGCTL);
  193. + dwc2_writel(otgctl, hsotg->regs + GOTGCTL);
  194. dev_dbg(hsotg->dev, "OTG VER PARAM: %d\n", hsotg->core_params->otg_ver);
  195. /* Clear the SRP success bit for FS-I2c */
  196. @@ -498,16 +498,16 @@ void dwc2_enable_host_interrupts(struct
  197. dev_dbg(hsotg->dev, "%s()\n", __func__);
  198. /* Disable all interrupts */
  199. - writel(0, hsotg->regs + GINTMSK);
  200. - writel(0, hsotg->regs + HAINTMSK);
  201. + dwc2_writel(0, hsotg->regs + GINTMSK);
  202. + dwc2_writel(0, hsotg->regs + HAINTMSK);
  203. /* Enable the common interrupts */
  204. dwc2_enable_common_interrupts(hsotg);
  205. /* Enable host mode interrupts without disturbing common interrupts */
  206. - intmsk = readl(hsotg->regs + GINTMSK);
  207. + intmsk = dwc2_readl(hsotg->regs + GINTMSK);
  208. intmsk |= GINTSTS_DISCONNINT | GINTSTS_PRTINT | GINTSTS_HCHINT;
  209. - writel(intmsk, hsotg->regs + GINTMSK);
  210. + dwc2_writel(intmsk, hsotg->regs + GINTMSK);
  211. }
  212. /**
  213. @@ -517,12 +517,12 @@ void dwc2_enable_host_interrupts(struct
  214. */
  215. void dwc2_disable_host_interrupts(struct dwc2_hsotg *hsotg)
  216. {
  217. - u32 intmsk = readl(hsotg->regs + GINTMSK);
  218. + u32 intmsk = dwc2_readl(hsotg->regs + GINTMSK);
  219. /* Disable host mode interrupts without disturbing common interrupts */
  220. intmsk &= ~(GINTSTS_SOF | GINTSTS_PRTINT | GINTSTS_HCHINT |
  221. GINTSTS_PTXFEMP | GINTSTS_NPTXFEMP);
  222. - writel(intmsk, hsotg->regs + GINTMSK);
  223. + dwc2_writel(intmsk, hsotg->regs + GINTMSK);
  224. }
  225. /*
  226. @@ -602,36 +602,36 @@ static void dwc2_config_fifos(struct dwc
  227. dwc2_calculate_dynamic_fifo(hsotg);
  228. /* Rx FIFO */
  229. - grxfsiz = readl(hsotg->regs + GRXFSIZ);
  230. + grxfsiz = dwc2_readl(hsotg->regs + GRXFSIZ);
  231. dev_dbg(hsotg->dev, "initial grxfsiz=%08x\n", grxfsiz);
  232. grxfsiz &= ~GRXFSIZ_DEPTH_MASK;
  233. grxfsiz |= params->host_rx_fifo_size <<
  234. GRXFSIZ_DEPTH_SHIFT & GRXFSIZ_DEPTH_MASK;
  235. - writel(grxfsiz, hsotg->regs + GRXFSIZ);
  236. - dev_dbg(hsotg->dev, "new grxfsiz=%08x\n", readl(hsotg->regs + GRXFSIZ));
  237. + dwc2_writel(grxfsiz, hsotg->regs + GRXFSIZ);
  238. + dev_dbg(hsotg->dev, "new grxfsiz=%08x\n", dwc2_readl(hsotg->regs + GRXFSIZ));
  239. /* Non-periodic Tx FIFO */
  240. dev_dbg(hsotg->dev, "initial gnptxfsiz=%08x\n",
  241. - readl(hsotg->regs + GNPTXFSIZ));
  242. + dwc2_readl(hsotg->regs + GNPTXFSIZ));
  243. nptxfsiz = params->host_nperio_tx_fifo_size <<
  244. FIFOSIZE_DEPTH_SHIFT & FIFOSIZE_DEPTH_MASK;
  245. nptxfsiz |= params->host_rx_fifo_size <<
  246. FIFOSIZE_STARTADDR_SHIFT & FIFOSIZE_STARTADDR_MASK;
  247. - writel(nptxfsiz, hsotg->regs + GNPTXFSIZ);
  248. + dwc2_writel(nptxfsiz, hsotg->regs + GNPTXFSIZ);
  249. dev_dbg(hsotg->dev, "new gnptxfsiz=%08x\n",
  250. - readl(hsotg->regs + GNPTXFSIZ));
  251. + dwc2_readl(hsotg->regs + GNPTXFSIZ));
  252. /* Periodic Tx FIFO */
  253. dev_dbg(hsotg->dev, "initial hptxfsiz=%08x\n",
  254. - readl(hsotg->regs + HPTXFSIZ));
  255. + dwc2_readl(hsotg->regs + HPTXFSIZ));
  256. hptxfsiz = params->host_perio_tx_fifo_size <<
  257. FIFOSIZE_DEPTH_SHIFT & FIFOSIZE_DEPTH_MASK;
  258. hptxfsiz |= (params->host_rx_fifo_size +
  259. params->host_nperio_tx_fifo_size) <<
  260. FIFOSIZE_STARTADDR_SHIFT & FIFOSIZE_STARTADDR_MASK;
  261. - writel(hptxfsiz, hsotg->regs + HPTXFSIZ);
  262. + dwc2_writel(hptxfsiz, hsotg->regs + HPTXFSIZ);
  263. dev_dbg(hsotg->dev, "new hptxfsiz=%08x\n",
  264. - readl(hsotg->regs + HPTXFSIZ));
  265. + dwc2_readl(hsotg->regs + HPTXFSIZ));
  266. if (hsotg->core_params->en_multiple_tx_fifo > 0 &&
  267. hsotg->hw_params.snpsid <= DWC2_CORE_REV_2_94a) {
  268. @@ -639,14 +639,14 @@ static void dwc2_config_fifos(struct dwc
  269. * Global DFIFOCFG calculation for Host mode -
  270. * include RxFIFO, NPTXFIFO and HPTXFIFO
  271. */
  272. - dfifocfg = readl(hsotg->regs + GDFIFOCFG);
  273. + dfifocfg = dwc2_readl(hsotg->regs + GDFIFOCFG);
  274. dfifocfg &= ~GDFIFOCFG_EPINFOBASE_MASK;
  275. dfifocfg |= (params->host_rx_fifo_size +
  276. params->host_nperio_tx_fifo_size +
  277. params->host_perio_tx_fifo_size) <<
  278. GDFIFOCFG_EPINFOBASE_SHIFT &
  279. GDFIFOCFG_EPINFOBASE_MASK;
  280. - writel(dfifocfg, hsotg->regs + GDFIFOCFG);
  281. + dwc2_writel(dfifocfg, hsotg->regs + GDFIFOCFG);
  282. }
  283. }
  284. @@ -667,14 +667,14 @@ void dwc2_core_host_init(struct dwc2_hso
  285. dev_dbg(hsotg->dev, "%s(%p)\n", __func__, hsotg);
  286. /* Restart the Phy Clock */
  287. - writel(0, hsotg->regs + PCGCTL);
  288. + dwc2_writel(0, hsotg->regs + PCGCTL);
  289. /* Initialize Host Configuration Register */
  290. dwc2_init_fs_ls_pclk_sel(hsotg);
  291. if (hsotg->core_params->speed == DWC2_SPEED_PARAM_FULL) {
  292. - hcfg = readl(hsotg->regs + HCFG);
  293. + hcfg = dwc2_readl(hsotg->regs + HCFG);
  294. hcfg |= HCFG_FSLSSUPP;
  295. - writel(hcfg, hsotg->regs + HCFG);
  296. + dwc2_writel(hcfg, hsotg->regs + HCFG);
  297. }
  298. /*
  299. @@ -683,9 +683,9 @@ void dwc2_core_host_init(struct dwc2_hso
  300. * and its value must not be changed during runtime.
  301. */
  302. if (hsotg->core_params->reload_ctl > 0) {
  303. - hfir = readl(hsotg->regs + HFIR);
  304. + hfir = dwc2_readl(hsotg->regs + HFIR);
  305. hfir |= HFIR_RLDCTRL;
  306. - writel(hfir, hsotg->regs + HFIR);
  307. + dwc2_writel(hfir, hsotg->regs + HFIR);
  308. }
  309. if (hsotg->core_params->dma_desc_enable > 0) {
  310. @@ -701,9 +701,9 @@ void dwc2_core_host_init(struct dwc2_hso
  311. "falling back to buffer DMA mode.\n");
  312. hsotg->core_params->dma_desc_enable = 0;
  313. } else {
  314. - hcfg = readl(hsotg->regs + HCFG);
  315. + hcfg = dwc2_readl(hsotg->regs + HCFG);
  316. hcfg |= HCFG_DESCDMA;
  317. - writel(hcfg, hsotg->regs + HCFG);
  318. + dwc2_writel(hcfg, hsotg->regs + HCFG);
  319. }
  320. }
  321. @@ -712,18 +712,18 @@ void dwc2_core_host_init(struct dwc2_hso
  322. /* TODO - check this */
  323. /* Clear Host Set HNP Enable in the OTG Control Register */
  324. - otgctl = readl(hsotg->regs + GOTGCTL);
  325. + otgctl = dwc2_readl(hsotg->regs + GOTGCTL);
  326. otgctl &= ~GOTGCTL_HSTSETHNPEN;
  327. - writel(otgctl, hsotg->regs + GOTGCTL);
  328. + dwc2_writel(otgctl, hsotg->regs + GOTGCTL);
  329. /* Make sure the FIFOs are flushed */
  330. dwc2_flush_tx_fifo(hsotg, 0x10 /* all TX FIFOs */);
  331. dwc2_flush_rx_fifo(hsotg);
  332. /* Clear Host Set HNP Enable in the OTG Control Register */
  333. - otgctl = readl(hsotg->regs + GOTGCTL);
  334. + otgctl = dwc2_readl(hsotg->regs + GOTGCTL);
  335. otgctl &= ~GOTGCTL_HSTSETHNPEN;
  336. - writel(otgctl, hsotg->regs + GOTGCTL);
  337. + dwc2_writel(otgctl, hsotg->regs + GOTGCTL);
  338. if (hsotg->core_params->dma_desc_enable <= 0) {
  339. int num_channels, i;
  340. @@ -732,25 +732,25 @@ void dwc2_core_host_init(struct dwc2_hso
  341. /* Flush out any leftover queued requests */
  342. num_channels = hsotg->core_params->host_channels;
  343. for (i = 0; i < num_channels; i++) {
  344. - hcchar = readl(hsotg->regs + HCCHAR(i));
  345. + hcchar = dwc2_readl(hsotg->regs + HCCHAR(i));
  346. hcchar &= ~HCCHAR_CHENA;
  347. hcchar |= HCCHAR_CHDIS;
  348. hcchar &= ~HCCHAR_EPDIR;
  349. - writel(hcchar, hsotg->regs + HCCHAR(i));
  350. + dwc2_writel(hcchar, hsotg->regs + HCCHAR(i));
  351. }
  352. /* Halt all channels to put them into a known state */
  353. for (i = 0; i < num_channels; i++) {
  354. int count = 0;
  355. - hcchar = readl(hsotg->regs + HCCHAR(i));
  356. + hcchar = dwc2_readl(hsotg->regs + HCCHAR(i));
  357. hcchar |= HCCHAR_CHENA | HCCHAR_CHDIS;
  358. hcchar &= ~HCCHAR_EPDIR;
  359. - writel(hcchar, hsotg->regs + HCCHAR(i));
  360. + dwc2_writel(hcchar, hsotg->regs + HCCHAR(i));
  361. dev_dbg(hsotg->dev, "%s: Halt channel %d\n",
  362. __func__, i);
  363. do {
  364. - hcchar = readl(hsotg->regs + HCCHAR(i));
  365. + hcchar = dwc2_readl(hsotg->regs + HCCHAR(i));
  366. if (++count > 1000) {
  367. dev_err(hsotg->dev,
  368. "Unable to clear enable on channel %d\n",
  369. @@ -771,7 +771,7 @@ void dwc2_core_host_init(struct dwc2_hso
  370. !!(hprt0 & HPRT0_PWR));
  371. if (!(hprt0 & HPRT0_PWR)) {
  372. hprt0 |= HPRT0_PWR;
  373. - writel(hprt0, hsotg->regs + HPRT0);
  374. + dwc2_writel(hprt0, hsotg->regs + HPRT0);
  375. }
  376. }
  377. @@ -851,7 +851,7 @@ static void dwc2_hc_enable_slave_ints(st
  378. break;
  379. }
  380. - writel(hcintmsk, hsotg->regs + HCINTMSK(chan->hc_num));
  381. + dwc2_writel(hcintmsk, hsotg->regs + HCINTMSK(chan->hc_num));
  382. if (dbg_hc(chan))
  383. dev_vdbg(hsotg->dev, "set HCINTMSK to %08x\n", hcintmsk);
  384. }
  385. @@ -888,7 +888,7 @@ static void dwc2_hc_enable_dma_ints(stru
  386. }
  387. }
  388. - writel(hcintmsk, hsotg->regs + HCINTMSK(chan->hc_num));
  389. + dwc2_writel(hcintmsk, hsotg->regs + HCINTMSK(chan->hc_num));
  390. if (dbg_hc(chan))
  391. dev_vdbg(hsotg->dev, "set HCINTMSK to %08x\n", hcintmsk);
  392. }
  393. @@ -909,16 +909,16 @@ static void dwc2_hc_enable_ints(struct d
  394. }
  395. /* Enable the top level host channel interrupt */
  396. - intmsk = readl(hsotg->regs + HAINTMSK);
  397. + intmsk = dwc2_readl(hsotg->regs + HAINTMSK);
  398. intmsk |= 1 << chan->hc_num;
  399. - writel(intmsk, hsotg->regs + HAINTMSK);
  400. + dwc2_writel(intmsk, hsotg->regs + HAINTMSK);
  401. if (dbg_hc(chan))
  402. dev_vdbg(hsotg->dev, "set HAINTMSK to %08x\n", intmsk);
  403. /* Make sure host channel interrupts are enabled */
  404. - intmsk = readl(hsotg->regs + GINTMSK);
  405. + intmsk = dwc2_readl(hsotg->regs + GINTMSK);
  406. intmsk |= GINTSTS_HCHINT;
  407. - writel(intmsk, hsotg->regs + GINTMSK);
  408. + dwc2_writel(intmsk, hsotg->regs + GINTMSK);
  409. if (dbg_hc(chan))
  410. dev_vdbg(hsotg->dev, "set GINTMSK to %08x\n", intmsk);
  411. }
  412. @@ -947,7 +947,7 @@ void dwc2_hc_init(struct dwc2_hsotg *hso
  413. /* Clear old interrupt conditions for this host channel */
  414. hcintmsk = 0xffffffff;
  415. hcintmsk &= ~HCINTMSK_RESERVED14_31;
  416. - writel(hcintmsk, hsotg->regs + HCINT(hc_num));
  417. + dwc2_writel(hcintmsk, hsotg->regs + HCINT(hc_num));
  418. /* Enable channel interrupts required for this transfer */
  419. dwc2_hc_enable_ints(hsotg, chan);
  420. @@ -964,7 +964,7 @@ void dwc2_hc_init(struct dwc2_hsotg *hso
  421. hcchar |= HCCHAR_LSPDDEV;
  422. hcchar |= chan->ep_type << HCCHAR_EPTYPE_SHIFT & HCCHAR_EPTYPE_MASK;
  423. hcchar |= chan->max_packet << HCCHAR_MPS_SHIFT & HCCHAR_MPS_MASK;
  424. - writel(hcchar, hsotg->regs + HCCHAR(hc_num));
  425. + dwc2_writel(hcchar, hsotg->regs + HCCHAR(hc_num));
  426. if (dbg_hc(chan)) {
  427. dev_vdbg(hsotg->dev, "set HCCHAR(%d) to %08x\n",
  428. hc_num, hcchar);
  429. @@ -1018,7 +1018,7 @@ void dwc2_hc_init(struct dwc2_hsotg *hso
  430. }
  431. }
  432. - writel(hcsplt, hsotg->regs + HCSPLT(hc_num));
  433. + dwc2_writel(hcsplt, hsotg->regs + HCSPLT(hc_num));
  434. }
  435. /**
  436. @@ -1070,14 +1070,14 @@ void dwc2_hc_halt(struct dwc2_hsotg *hso
  437. u32 hcintmsk = HCINTMSK_CHHLTD;
  438. dev_vdbg(hsotg->dev, "dequeue/error\n");
  439. - writel(hcintmsk, hsotg->regs + HCINTMSK(chan->hc_num));
  440. + dwc2_writel(hcintmsk, hsotg->regs + HCINTMSK(chan->hc_num));
  441. /*
  442. * Make sure no other interrupts besides halt are currently
  443. * pending. Handling another interrupt could cause a crash due
  444. * to the QTD and QH state.
  445. */
  446. - writel(~hcintmsk, hsotg->regs + HCINT(chan->hc_num));
  447. + dwc2_writel(~hcintmsk, hsotg->regs + HCINT(chan->hc_num));
  448. /*
  449. * Make sure the halt status is set to URB_DEQUEUE or AHB_ERR
  450. @@ -1086,7 +1086,7 @@ void dwc2_hc_halt(struct dwc2_hsotg *hso
  451. */
  452. chan->halt_status = halt_status;
  453. - hcchar = readl(hsotg->regs + HCCHAR(chan->hc_num));
  454. + hcchar = dwc2_readl(hsotg->regs + HCCHAR(chan->hc_num));
  455. if (!(hcchar & HCCHAR_CHENA)) {
  456. /*
  457. * The channel is either already halted or it hasn't
  458. @@ -1114,7 +1114,7 @@ void dwc2_hc_halt(struct dwc2_hsotg *hso
  459. return;
  460. }
  461. - hcchar = readl(hsotg->regs + HCCHAR(chan->hc_num));
  462. + hcchar = dwc2_readl(hsotg->regs + HCCHAR(chan->hc_num));
  463. /* No need to set the bit in DDMA for disabling the channel */
  464. /* TODO check it everywhere channel is disabled */
  465. @@ -1137,7 +1137,7 @@ void dwc2_hc_halt(struct dwc2_hsotg *hso
  466. if (chan->ep_type == USB_ENDPOINT_XFER_CONTROL ||
  467. chan->ep_type == USB_ENDPOINT_XFER_BULK) {
  468. dev_vdbg(hsotg->dev, "control/bulk\n");
  469. - nptxsts = readl(hsotg->regs + GNPTXSTS);
  470. + nptxsts = dwc2_readl(hsotg->regs + GNPTXSTS);
  471. if ((nptxsts & TXSTS_QSPCAVAIL_MASK) == 0) {
  472. dev_vdbg(hsotg->dev, "Disabling channel\n");
  473. hcchar &= ~HCCHAR_CHENA;
  474. @@ -1145,7 +1145,7 @@ void dwc2_hc_halt(struct dwc2_hsotg *hso
  475. } else {
  476. if (dbg_perio())
  477. dev_vdbg(hsotg->dev, "isoc/intr\n");
  478. - hptxsts = readl(hsotg->regs + HPTXSTS);
  479. + hptxsts = dwc2_readl(hsotg->regs + HPTXSTS);
  480. if ((hptxsts & TXSTS_QSPCAVAIL_MASK) == 0 ||
  481. hsotg->queuing_high_bandwidth) {
  482. if (dbg_perio())
  483. @@ -1158,7 +1158,7 @@ void dwc2_hc_halt(struct dwc2_hsotg *hso
  484. dev_vdbg(hsotg->dev, "DMA enabled\n");
  485. }
  486. - writel(hcchar, hsotg->regs + HCCHAR(chan->hc_num));
  487. + dwc2_writel(hcchar, hsotg->regs + HCCHAR(chan->hc_num));
  488. chan->halt_status = halt_status;
  489. if (hcchar & HCCHAR_CHENA) {
  490. @@ -1205,10 +1205,10 @@ void dwc2_hc_cleanup(struct dwc2_hsotg *
  491. * Clear channel interrupt enables and any unhandled channel interrupt
  492. * conditions
  493. */
  494. - writel(0, hsotg->regs + HCINTMSK(chan->hc_num));
  495. + dwc2_writel(0, hsotg->regs + HCINTMSK(chan->hc_num));
  496. hcintmsk = 0xffffffff;
  497. hcintmsk &= ~HCINTMSK_RESERVED14_31;
  498. - writel(hcintmsk, hsotg->regs + HCINT(chan->hc_num));
  499. + dwc2_writel(hcintmsk, hsotg->regs + HCINT(chan->hc_num));
  500. }
  501. /**
  502. @@ -1294,13 +1294,13 @@ static void dwc2_hc_write_packet(struct
  503. if (((unsigned long)data_buf & 0x3) == 0) {
  504. /* xfer_buf is DWORD aligned */
  505. for (i = 0; i < dword_count; i++, data_buf++)
  506. - writel(*data_buf, data_fifo);
  507. + dwc2_writel(*data_buf, data_fifo);
  508. } else {
  509. /* xfer_buf is not DWORD aligned */
  510. for (i = 0; i < dword_count; i++, data_buf++) {
  511. u32 data = data_buf[0] | data_buf[1] << 8 |
  512. data_buf[2] << 16 | data_buf[3] << 24;
  513. - writel(data, data_fifo);
  514. + dwc2_writel(data, data_fifo);
  515. }
  516. }
  517. @@ -1453,7 +1453,7 @@ void dwc2_hc_start_transfer(struct dwc2_
  518. hctsiz |= num_packets << TSIZ_PKTCNT_SHIFT & TSIZ_PKTCNT_MASK;
  519. hctsiz |= chan->data_pid_start << TSIZ_SC_MC_PID_SHIFT &
  520. TSIZ_SC_MC_PID_MASK;
  521. - writel(hctsiz, hsotg->regs + HCTSIZ(chan->hc_num));
  522. + dwc2_writel(hctsiz, hsotg->regs + HCTSIZ(chan->hc_num));
  523. if (dbg_hc(chan)) {
  524. dev_vdbg(hsotg->dev, "Wrote %08x to HCTSIZ(%d)\n",
  525. hctsiz, chan->hc_num);
  526. @@ -1481,7 +1481,7 @@ void dwc2_hc_start_transfer(struct dwc2_
  527. } else {
  528. dma_addr = chan->xfer_dma;
  529. }
  530. - writel((u32)dma_addr, hsotg->regs + HCDMA(chan->hc_num));
  531. + dwc2_writel((u32)dma_addr, hsotg->regs + HCDMA(chan->hc_num));
  532. if (dbg_hc(chan))
  533. dev_vdbg(hsotg->dev, "Wrote %08lx to HCDMA(%d)\n",
  534. (unsigned long)dma_addr, chan->hc_num);
  535. @@ -1489,13 +1489,13 @@ void dwc2_hc_start_transfer(struct dwc2_
  536. /* Start the split */
  537. if (chan->do_split) {
  538. - u32 hcsplt = readl(hsotg->regs + HCSPLT(chan->hc_num));
  539. + u32 hcsplt = dwc2_readl(hsotg->regs + HCSPLT(chan->hc_num));
  540. hcsplt |= HCSPLT_SPLTENA;
  541. - writel(hcsplt, hsotg->regs + HCSPLT(chan->hc_num));
  542. + dwc2_writel(hcsplt, hsotg->regs + HCSPLT(chan->hc_num));
  543. }
  544. - hcchar = readl(hsotg->regs + HCCHAR(chan->hc_num));
  545. + hcchar = dwc2_readl(hsotg->regs + HCCHAR(chan->hc_num));
  546. hcchar &= ~HCCHAR_MULTICNT_MASK;
  547. hcchar |= chan->multi_count << HCCHAR_MULTICNT_SHIFT &
  548. HCCHAR_MULTICNT_MASK;
  549. @@ -1515,7 +1515,7 @@ void dwc2_hc_start_transfer(struct dwc2_
  550. (hcchar & HCCHAR_MULTICNT_MASK) >>
  551. HCCHAR_MULTICNT_SHIFT);
  552. - writel(hcchar, hsotg->regs + HCCHAR(chan->hc_num));
  553. + dwc2_writel(hcchar, hsotg->regs + HCCHAR(chan->hc_num));
  554. if (dbg_hc(chan))
  555. dev_vdbg(hsotg->dev, "Wrote %08x to HCCHAR(%d)\n", hcchar,
  556. chan->hc_num);
  557. @@ -1574,18 +1574,18 @@ void dwc2_hc_start_transfer_ddma(struct
  558. dev_vdbg(hsotg->dev, " NTD: %d\n", chan->ntd - 1);
  559. }
  560. - writel(hctsiz, hsotg->regs + HCTSIZ(chan->hc_num));
  561. + dwc2_writel(hctsiz, hsotg->regs + HCTSIZ(chan->hc_num));
  562. hc_dma = (u32)chan->desc_list_addr & HCDMA_DMA_ADDR_MASK;
  563. /* Always start from first descriptor */
  564. hc_dma &= ~HCDMA_CTD_MASK;
  565. - writel(hc_dma, hsotg->regs + HCDMA(chan->hc_num));
  566. + dwc2_writel(hc_dma, hsotg->regs + HCDMA(chan->hc_num));
  567. if (dbg_hc(chan))
  568. dev_vdbg(hsotg->dev, "Wrote %08x to HCDMA(%d)\n",
  569. hc_dma, chan->hc_num);
  570. - hcchar = readl(hsotg->regs + HCCHAR(chan->hc_num));
  571. + hcchar = dwc2_readl(hsotg->regs + HCCHAR(chan->hc_num));
  572. hcchar &= ~HCCHAR_MULTICNT_MASK;
  573. hcchar |= chan->multi_count << HCCHAR_MULTICNT_SHIFT &
  574. HCCHAR_MULTICNT_MASK;
  575. @@ -1604,7 +1604,7 @@ void dwc2_hc_start_transfer_ddma(struct
  576. (hcchar & HCCHAR_MULTICNT_MASK) >>
  577. HCCHAR_MULTICNT_SHIFT);
  578. - writel(hcchar, hsotg->regs + HCCHAR(chan->hc_num));
  579. + dwc2_writel(hcchar, hsotg->regs + HCCHAR(chan->hc_num));
  580. if (dbg_hc(chan))
  581. dev_vdbg(hsotg->dev, "Wrote %08x to HCCHAR(%d)\n", hcchar,
  582. chan->hc_num);
  583. @@ -1661,7 +1661,7 @@ int dwc2_hc_continue_transfer(struct dwc
  584. * transfer completes, the extra requests for the channel will
  585. * be flushed.
  586. */
  587. - u32 hcchar = readl(hsotg->regs + HCCHAR(chan->hc_num));
  588. + u32 hcchar = dwc2_readl(hsotg->regs + HCCHAR(chan->hc_num));
  589. dwc2_hc_set_even_odd_frame(hsotg, chan, &hcchar);
  590. hcchar |= HCCHAR_CHENA;
  591. @@ -1669,7 +1669,7 @@ int dwc2_hc_continue_transfer(struct dwc
  592. if (dbg_hc(chan))
  593. dev_vdbg(hsotg->dev, " IN xfer: hcchar = 0x%08x\n",
  594. hcchar);
  595. - writel(hcchar, hsotg->regs + HCCHAR(chan->hc_num));
  596. + dwc2_writel(hcchar, hsotg->regs + HCCHAR(chan->hc_num));
  597. chan->requests++;
  598. return 1;
  599. }
  600. @@ -1679,7 +1679,7 @@ int dwc2_hc_continue_transfer(struct dwc
  601. if (chan->xfer_count < chan->xfer_len) {
  602. if (chan->ep_type == USB_ENDPOINT_XFER_INT ||
  603. chan->ep_type == USB_ENDPOINT_XFER_ISOC) {
  604. - u32 hcchar = readl(hsotg->regs +
  605. + u32 hcchar = dwc2_readl(hsotg->regs +
  606. HCCHAR(chan->hc_num));
  607. dwc2_hc_set_even_odd_frame(hsotg, chan,
  608. @@ -1716,12 +1716,12 @@ void dwc2_hc_do_ping(struct dwc2_hsotg *
  609. hctsiz = TSIZ_DOPNG;
  610. hctsiz |= 1 << TSIZ_PKTCNT_SHIFT;
  611. - writel(hctsiz, hsotg->regs + HCTSIZ(chan->hc_num));
  612. + dwc2_writel(hctsiz, hsotg->regs + HCTSIZ(chan->hc_num));
  613. - hcchar = readl(hsotg->regs + HCCHAR(chan->hc_num));
  614. + hcchar = dwc2_readl(hsotg->regs + HCCHAR(chan->hc_num));
  615. hcchar |= HCCHAR_CHENA;
  616. hcchar &= ~HCCHAR_CHDIS;
  617. - writel(hcchar, hsotg->regs + HCCHAR(chan->hc_num));
  618. + dwc2_writel(hcchar, hsotg->regs + HCCHAR(chan->hc_num));
  619. }
  620. /**
  621. @@ -1740,8 +1740,8 @@ u32 dwc2_calc_frame_interval(struct dwc2
  622. u32 hprt0;
  623. int clock = 60; /* default value */
  624. - usbcfg = readl(hsotg->regs + GUSBCFG);
  625. - hprt0 = readl(hsotg->regs + HPRT0);
  626. + usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
  627. + hprt0 = dwc2_readl(hsotg->regs + HPRT0);
  628. if (!(usbcfg & GUSBCFG_PHYSEL) && (usbcfg & GUSBCFG_ULPI_UTMI_SEL) &&
  629. !(usbcfg & GUSBCFG_PHYIF16))
  630. @@ -1797,7 +1797,7 @@ void dwc2_read_packet(struct dwc2_hsotg
  631. dev_vdbg(hsotg->dev, "%s(%p,%p,%d)\n", __func__, hsotg, dest, bytes);
  632. for (i = 0; i < word_count; i++, data_buf++)
  633. - *data_buf = readl(fifo);
  634. + *data_buf = dwc2_readl(fifo);
  635. }
  636. /**
  637. @@ -1817,56 +1817,56 @@ void dwc2_dump_host_registers(struct dwc
  638. dev_dbg(hsotg->dev, "Host Global Registers\n");
  639. addr = hsotg->regs + HCFG;
  640. dev_dbg(hsotg->dev, "HCFG @0x%08lX : 0x%08X\n",
  641. - (unsigned long)addr, readl(addr));
  642. + (unsigned long)addr, dwc2_readl(addr));
  643. addr = hsotg->regs + HFIR;
  644. dev_dbg(hsotg->dev, "HFIR @0x%08lX : 0x%08X\n",
  645. - (unsigned long)addr, readl(addr));
  646. + (unsigned long)addr, dwc2_readl(addr));
  647. addr = hsotg->regs + HFNUM;
  648. dev_dbg(hsotg->dev, "HFNUM @0x%08lX : 0x%08X\n",
  649. - (unsigned long)addr, readl(addr));
  650. + (unsigned long)addr, dwc2_readl(addr));
  651. addr = hsotg->regs + HPTXSTS;
  652. dev_dbg(hsotg->dev, "HPTXSTS @0x%08lX : 0x%08X\n",
  653. - (unsigned long)addr, readl(addr));
  654. + (unsigned long)addr, dwc2_readl(addr));
  655. addr = hsotg->regs + HAINT;
  656. dev_dbg(hsotg->dev, "HAINT @0x%08lX : 0x%08X\n",
  657. - (unsigned long)addr, readl(addr));
  658. + (unsigned long)addr, dwc2_readl(addr));
  659. addr = hsotg->regs + HAINTMSK;
  660. dev_dbg(hsotg->dev, "HAINTMSK @0x%08lX : 0x%08X\n",
  661. - (unsigned long)addr, readl(addr));
  662. + (unsigned long)addr, dwc2_readl(addr));
  663. if (hsotg->core_params->dma_desc_enable > 0) {
  664. addr = hsotg->regs + HFLBADDR;
  665. dev_dbg(hsotg->dev, "HFLBADDR @0x%08lX : 0x%08X\n",
  666. - (unsigned long)addr, readl(addr));
  667. + (unsigned long)addr, dwc2_readl(addr));
  668. }
  669. addr = hsotg->regs + HPRT0;
  670. dev_dbg(hsotg->dev, "HPRT0 @0x%08lX : 0x%08X\n",
  671. - (unsigned long)addr, readl(addr));
  672. + (unsigned long)addr, dwc2_readl(addr));
  673. for (i = 0; i < hsotg->core_params->host_channels; i++) {
  674. dev_dbg(hsotg->dev, "Host Channel %d Specific Registers\n", i);
  675. addr = hsotg->regs + HCCHAR(i);
  676. dev_dbg(hsotg->dev, "HCCHAR @0x%08lX : 0x%08X\n",
  677. - (unsigned long)addr, readl(addr));
  678. + (unsigned long)addr, dwc2_readl(addr));
  679. addr = hsotg->regs + HCSPLT(i);
  680. dev_dbg(hsotg->dev, "HCSPLT @0x%08lX : 0x%08X\n",
  681. - (unsigned long)addr, readl(addr));
  682. + (unsigned long)addr, dwc2_readl(addr));
  683. addr = hsotg->regs + HCINT(i);
  684. dev_dbg(hsotg->dev, "HCINT @0x%08lX : 0x%08X\n",
  685. - (unsigned long)addr, readl(addr));
  686. + (unsigned long)addr, dwc2_readl(addr));
  687. addr = hsotg->regs + HCINTMSK(i);
  688. dev_dbg(hsotg->dev, "HCINTMSK @0x%08lX : 0x%08X\n",
  689. - (unsigned long)addr, readl(addr));
  690. + (unsigned long)addr, dwc2_readl(addr));
  691. addr = hsotg->regs + HCTSIZ(i);
  692. dev_dbg(hsotg->dev, "HCTSIZ @0x%08lX : 0x%08X\n",
  693. - (unsigned long)addr, readl(addr));
  694. + (unsigned long)addr, dwc2_readl(addr));
  695. addr = hsotg->regs + HCDMA(i);
  696. dev_dbg(hsotg->dev, "HCDMA @0x%08lX : 0x%08X\n",
  697. - (unsigned long)addr, readl(addr));
  698. + (unsigned long)addr, dwc2_readl(addr));
  699. if (hsotg->core_params->dma_desc_enable > 0) {
  700. addr = hsotg->regs + HCDMAB(i);
  701. dev_dbg(hsotg->dev, "HCDMAB @0x%08lX : 0x%08X\n",
  702. - (unsigned long)addr, readl(addr));
  703. + (unsigned long)addr, dwc2_readl(addr));
  704. }
  705. }
  706. #endif
  707. @@ -1888,80 +1888,80 @@ void dwc2_dump_global_registers(struct d
  708. dev_dbg(hsotg->dev, "Core Global Registers\n");
  709. addr = hsotg->regs + GOTGCTL;
  710. dev_dbg(hsotg->dev, "GOTGCTL @0x%08lX : 0x%08X\n",
  711. - (unsigned long)addr, readl(addr));
  712. + (unsigned long)addr, dwc2_readl(addr));
  713. addr = hsotg->regs + GOTGINT;
  714. dev_dbg(hsotg->dev, "GOTGINT @0x%08lX : 0x%08X\n",
  715. - (unsigned long)addr, readl(addr));
  716. + (unsigned long)addr, dwc2_readl(addr));
  717. addr = hsotg->regs + GAHBCFG;
  718. dev_dbg(hsotg->dev, "GAHBCFG @0x%08lX : 0x%08X\n",
  719. - (unsigned long)addr, readl(addr));
  720. + (unsigned long)addr, dwc2_readl(addr));
  721. addr = hsotg->regs + GUSBCFG;
  722. dev_dbg(hsotg->dev, "GUSBCFG @0x%08lX : 0x%08X\n",
  723. - (unsigned long)addr, readl(addr));
  724. + (unsigned long)addr, dwc2_readl(addr));
  725. addr = hsotg->regs + GRSTCTL;
  726. dev_dbg(hsotg->dev, "GRSTCTL @0x%08lX : 0x%08X\n",
  727. - (unsigned long)addr, readl(addr));
  728. + (unsigned long)addr, dwc2_readl(addr));
  729. addr = hsotg->regs + GINTSTS;
  730. dev_dbg(hsotg->dev, "GINTSTS @0x%08lX : 0x%08X\n",
  731. - (unsigned long)addr, readl(addr));
  732. + (unsigned long)addr, dwc2_readl(addr));
  733. addr = hsotg->regs + GINTMSK;
  734. dev_dbg(hsotg->dev, "GINTMSK @0x%08lX : 0x%08X\n",
  735. - (unsigned long)addr, readl(addr));
  736. + (unsigned long)addr, dwc2_readl(addr));
  737. addr = hsotg->regs + GRXSTSR;
  738. dev_dbg(hsotg->dev, "GRXSTSR @0x%08lX : 0x%08X\n",
  739. - (unsigned long)addr, readl(addr));
  740. + (unsigned long)addr, dwc2_readl(addr));
  741. addr = hsotg->regs + GRXFSIZ;
  742. dev_dbg(hsotg->dev, "GRXFSIZ @0x%08lX : 0x%08X\n",
  743. - (unsigned long)addr, readl(addr));
  744. + (unsigned long)addr, dwc2_readl(addr));
  745. addr = hsotg->regs + GNPTXFSIZ;
  746. dev_dbg(hsotg->dev, "GNPTXFSIZ @0x%08lX : 0x%08X\n",
  747. - (unsigned long)addr, readl(addr));
  748. + (unsigned long)addr, dwc2_readl(addr));
  749. addr = hsotg->regs + GNPTXSTS;
  750. dev_dbg(hsotg->dev, "GNPTXSTS @0x%08lX : 0x%08X\n",
  751. - (unsigned long)addr, readl(addr));
  752. + (unsigned long)addr, dwc2_readl(addr));
  753. addr = hsotg->regs + GI2CCTL;
  754. dev_dbg(hsotg->dev, "GI2CCTL @0x%08lX : 0x%08X\n",
  755. - (unsigned long)addr, readl(addr));
  756. + (unsigned long)addr, dwc2_readl(addr));
  757. addr = hsotg->regs + GPVNDCTL;
  758. dev_dbg(hsotg->dev, "GPVNDCTL @0x%08lX : 0x%08X\n",
  759. - (unsigned long)addr, readl(addr));
  760. + (unsigned long)addr, dwc2_readl(addr));
  761. addr = hsotg->regs + GGPIO;
  762. dev_dbg(hsotg->dev, "GGPIO @0x%08lX : 0x%08X\n",
  763. - (unsigned long)addr, readl(addr));
  764. + (unsigned long)addr, dwc2_readl(addr));
  765. addr = hsotg->regs + GUID;
  766. dev_dbg(hsotg->dev, "GUID @0x%08lX : 0x%08X\n",
  767. - (unsigned long)addr, readl(addr));
  768. + (unsigned long)addr, dwc2_readl(addr));
  769. addr = hsotg->regs + GSNPSID;
  770. dev_dbg(hsotg->dev, "GSNPSID @0x%08lX : 0x%08X\n",
  771. - (unsigned long)addr, readl(addr));
  772. + (unsigned long)addr, dwc2_readl(addr));
  773. addr = hsotg->regs + GHWCFG1;
  774. dev_dbg(hsotg->dev, "GHWCFG1 @0x%08lX : 0x%08X\n",
  775. - (unsigned long)addr, readl(addr));
  776. + (unsigned long)addr, dwc2_readl(addr));
  777. addr = hsotg->regs + GHWCFG2;
  778. dev_dbg(hsotg->dev, "GHWCFG2 @0x%08lX : 0x%08X\n",
  779. - (unsigned long)addr, readl(addr));
  780. + (unsigned long)addr, dwc2_readl(addr));
  781. addr = hsotg->regs + GHWCFG3;
  782. dev_dbg(hsotg->dev, "GHWCFG3 @0x%08lX : 0x%08X\n",
  783. - (unsigned long)addr, readl(addr));
  784. + (unsigned long)addr, dwc2_readl(addr));
  785. addr = hsotg->regs + GHWCFG4;
  786. dev_dbg(hsotg->dev, "GHWCFG4 @0x%08lX : 0x%08X\n",
  787. - (unsigned long)addr, readl(addr));
  788. + (unsigned long)addr, dwc2_readl(addr));
  789. addr = hsotg->regs + GLPMCFG;
  790. dev_dbg(hsotg->dev, "GLPMCFG @0x%08lX : 0x%08X\n",
  791. - (unsigned long)addr, readl(addr));
  792. + (unsigned long)addr, dwc2_readl(addr));
  793. addr = hsotg->regs + GPWRDN;
  794. dev_dbg(hsotg->dev, "GPWRDN @0x%08lX : 0x%08X\n",
  795. - (unsigned long)addr, readl(addr));
  796. + (unsigned long)addr, dwc2_readl(addr));
  797. addr = hsotg->regs + GDFIFOCFG;
  798. dev_dbg(hsotg->dev, "GDFIFOCFG @0x%08lX : 0x%08X\n",
  799. - (unsigned long)addr, readl(addr));
  800. + (unsigned long)addr, dwc2_readl(addr));
  801. addr = hsotg->regs + HPTXFSIZ;
  802. dev_dbg(hsotg->dev, "HPTXFSIZ @0x%08lX : 0x%08X\n",
  803. - (unsigned long)addr, readl(addr));
  804. + (unsigned long)addr, dwc2_readl(addr));
  805. addr = hsotg->regs + PCGCTL;
  806. dev_dbg(hsotg->dev, "PCGCTL @0x%08lX : 0x%08X\n",
  807. - (unsigned long)addr, readl(addr));
  808. + (unsigned long)addr, dwc2_readl(addr));
  809. #endif
  810. }
  811. @@ -1980,15 +1980,15 @@ void dwc2_flush_tx_fifo(struct dwc2_hsot
  812. greset = GRSTCTL_TXFFLSH;
  813. greset |= num << GRSTCTL_TXFNUM_SHIFT & GRSTCTL_TXFNUM_MASK;
  814. - writel(greset, hsotg->regs + GRSTCTL);
  815. + dwc2_writel(greset, hsotg->regs + GRSTCTL);
  816. do {
  817. - greset = readl(hsotg->regs + GRSTCTL);
  818. + greset = dwc2_readl(hsotg->regs + GRSTCTL);
  819. if (++count > 10000) {
  820. dev_warn(hsotg->dev,
  821. "%s() HANG! GRSTCTL=%0x GNPTXSTS=0x%08x\n",
  822. __func__, greset,
  823. - readl(hsotg->regs + GNPTXSTS));
  824. + dwc2_readl(hsotg->regs + GNPTXSTS));
  825. break;
  826. }
  827. udelay(1);
  828. @@ -2011,10 +2011,10 @@ void dwc2_flush_rx_fifo(struct dwc2_hsot
  829. dev_vdbg(hsotg->dev, "%s()\n", __func__);
  830. greset = GRSTCTL_RXFFLSH;
  831. - writel(greset, hsotg->regs + GRSTCTL);
  832. + dwc2_writel(greset, hsotg->regs + GRSTCTL);
  833. do {
  834. - greset = readl(hsotg->regs + GRSTCTL);
  835. + greset = dwc2_readl(hsotg->regs + GRSTCTL);
  836. if (++count > 10000) {
  837. dev_warn(hsotg->dev, "%s() HANG! GRSTCTL=%0x\n",
  838. __func__, greset);
  839. @@ -2676,7 +2676,7 @@ int dwc2_get_hwparams(struct dwc2_hsotg
  840. * 0x45f42xxx or 0x45f43xxx, which corresponds to either "OT2" or "OT3",
  841. * as in "OTG version 2.xx" or "OTG version 3.xx".
  842. */
  843. - hw->snpsid = readl(hsotg->regs + GSNPSID);
  844. + hw->snpsid = dwc2_readl(hsotg->regs + GSNPSID);
  845. if ((hw->snpsid & 0xfffff000) != 0x4f542000 &&
  846. (hw->snpsid & 0xfffff000) != 0x4f543000) {
  847. dev_err(hsotg->dev, "Bad value for GSNPSID: 0x%08x\n",
  848. @@ -2688,11 +2688,11 @@ int dwc2_get_hwparams(struct dwc2_hsotg
  849. hw->snpsid >> 12 & 0xf, hw->snpsid >> 8 & 0xf,
  850. hw->snpsid >> 4 & 0xf, hw->snpsid & 0xf, hw->snpsid);
  851. - hwcfg1 = readl(hsotg->regs + GHWCFG1);
  852. - hwcfg2 = readl(hsotg->regs + GHWCFG2);
  853. - hwcfg3 = readl(hsotg->regs + GHWCFG3);
  854. - hwcfg4 = readl(hsotg->regs + GHWCFG4);
  855. - grxfsiz = readl(hsotg->regs + GRXFSIZ);
  856. + hwcfg1 = dwc2_readl(hsotg->regs + GHWCFG1);
  857. + hwcfg2 = dwc2_readl(hsotg->regs + GHWCFG2);
  858. + hwcfg3 = dwc2_readl(hsotg->regs + GHWCFG3);
  859. + hwcfg4 = dwc2_readl(hsotg->regs + GHWCFG4);
  860. + grxfsiz = dwc2_readl(hsotg->regs + GRXFSIZ);
  861. dev_dbg(hsotg->dev, "hwcfg1=%08x\n", hwcfg1);
  862. dev_dbg(hsotg->dev, "hwcfg2=%08x\n", hwcfg2);
  863. @@ -2701,18 +2701,18 @@ int dwc2_get_hwparams(struct dwc2_hsotg
  864. dev_dbg(hsotg->dev, "grxfsiz=%08x\n", grxfsiz);
  865. /* Force host mode to get HPTXFSIZ / GNPTXFSIZ exact power on value */
  866. - gusbcfg = readl(hsotg->regs + GUSBCFG);
  867. + gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
  868. gusbcfg |= GUSBCFG_FORCEHOSTMODE;
  869. - writel(gusbcfg, hsotg->regs + GUSBCFG);
  870. + dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG);
  871. usleep_range(100000, 150000);
  872. - gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ);
  873. - hptxfsiz = readl(hsotg->regs + HPTXFSIZ);
  874. + gnptxfsiz = dwc2_readl(hsotg->regs + GNPTXFSIZ);
  875. + hptxfsiz = dwc2_readl(hsotg->regs + HPTXFSIZ);
  876. dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
  877. dev_dbg(hsotg->dev, "hptxfsiz=%08x\n", hptxfsiz);
  878. - gusbcfg = readl(hsotg->regs + GUSBCFG);
  879. + gusbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
  880. gusbcfg &= ~GUSBCFG_FORCEHOSTMODE;
  881. - writel(gusbcfg, hsotg->regs + GUSBCFG);
  882. + dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG);
  883. usleep_range(100000, 150000);
  884. /* hwcfg2 */
  885. @@ -2831,7 +2831,7 @@ u16 dwc2_get_otg_version(struct dwc2_hso
  886. bool dwc2_is_controller_alive(struct dwc2_hsotg *hsotg)
  887. {
  888. - if (readl(hsotg->regs + GSNPSID) == 0xffffffff)
  889. + if (dwc2_readl(hsotg->regs + GSNPSID) == 0xffffffff)
  890. return false;
  891. else
  892. return true;
  893. @@ -2845,10 +2845,10 @@ bool dwc2_is_controller_alive(struct dwc
  894. */
  895. void dwc2_enable_global_interrupts(struct dwc2_hsotg *hsotg)
  896. {
  897. - u32 ahbcfg = readl(hsotg->regs + GAHBCFG);
  898. + u32 ahbcfg = dwc2_readl(hsotg->regs + GAHBCFG);
  899. ahbcfg |= GAHBCFG_GLBL_INTR_EN;
  900. - writel(ahbcfg, hsotg->regs + GAHBCFG);
  901. + dwc2_writel(ahbcfg, hsotg->regs + GAHBCFG);
  902. }
  903. /**
  904. @@ -2859,10 +2859,10 @@ void dwc2_enable_global_interrupts(struc
  905. */
  906. void dwc2_disable_global_interrupts(struct dwc2_hsotg *hsotg)
  907. {
  908. - u32 ahbcfg = readl(hsotg->regs + GAHBCFG);
  909. + u32 ahbcfg = dwc2_readl(hsotg->regs + GAHBCFG);
  910. ahbcfg &= ~GAHBCFG_GLBL_INTR_EN;
  911. - writel(ahbcfg, hsotg->regs + GAHBCFG);
  912. + dwc2_writel(ahbcfg, hsotg->regs + GAHBCFG);
  913. }
  914. MODULE_DESCRIPTION("DESIGNWARE HS OTG Core");
  915. --- a/drivers/usb/dwc2/core.h
  916. +++ b/drivers/usb/dwc2/core.h
  917. @@ -44,16 +44,28 @@
  918. #include <linux/usb/phy.h>
  919. #include "hw.h"
  920. -#ifdef DWC2_LOG_WRITES
  921. -static inline void do_write(u32 value, void *addr)
  922. +static inline u32 dwc2_readl(const void __iomem *addr)
  923. {
  924. - writel(value, addr);
  925. - pr_info("INFO:: wrote %08x to %p\n", value, addr);
  926. + u32 value = __raw_readl(addr);
  927. +
  928. + /* In order to preserve endianness __raw_* operation is used. Therefore
  929. + a barrier is needed to ensure IO access is not re-ordered across
  930. + reads or writes */
  931. + mb();
  932. + return value;
  933. }
  934. -#undef writel
  935. -#define writel(v, a) do_write(v, a)
  936. +static inline void dwc2_writel(u32 value, void __iomem *addr)
  937. +{
  938. + __raw_writel(value, addr);
  939. + /* In order to preserve endianness __raw_* operation is used. Therefore
  940. + a barrier is needed to ensure IO access is not re-ordered across
  941. + reads or writes */
  942. + mb();
  943. +#ifdef DWC2_LOG_WRITES
  944. + pr_info("INFO:: wrote %08x to %p\n", value, addr);
  945. #endif
  946. +}
  947. /* Maximum number of Endpoints/HostChannels */
  948. #define MAX_EPS_CHANNELS 16
  949. --- a/drivers/usb/dwc2/core_intr.c
  950. +++ b/drivers/usb/dwc2/core_intr.c
  951. @@ -80,15 +80,15 @@ static const char *dwc2_op_state_str(str
  952. */
  953. static void dwc2_handle_usb_port_intr(struct dwc2_hsotg *hsotg)
  954. {
  955. - u32 hprt0 = readl(hsotg->regs + HPRT0);
  956. + u32 hprt0 = dwc2_readl(hsotg->regs + HPRT0);
  957. if (hprt0 & HPRT0_ENACHG) {
  958. hprt0 &= ~HPRT0_ENA;
  959. - writel(hprt0, hsotg->regs + HPRT0);
  960. + dwc2_writel(hprt0, hsotg->regs + HPRT0);
  961. }
  962. /* Clear interrupt */
  963. - writel(GINTSTS_PRTINT, hsotg->regs + GINTSTS);
  964. + dwc2_writel(GINTSTS_PRTINT, hsotg->regs + GINTSTS);
  965. }
  966. /**
  967. @@ -102,7 +102,7 @@ static void dwc2_handle_mode_mismatch_in
  968. dwc2_is_host_mode(hsotg) ? "Host" : "Device");
  969. /* Clear interrupt */
  970. - writel(GINTSTS_MODEMIS, hsotg->regs + GINTSTS);
  971. + dwc2_writel(GINTSTS_MODEMIS, hsotg->regs + GINTSTS);
  972. }
  973. /**
  974. @@ -117,8 +117,8 @@ static void dwc2_handle_otg_intr(struct
  975. u32 gotgctl;
  976. u32 gintmsk;
  977. - gotgint = readl(hsotg->regs + GOTGINT);
  978. - gotgctl = readl(hsotg->regs + GOTGCTL);
  979. + gotgint = dwc2_readl(hsotg->regs + GOTGINT);
  980. + gotgctl = dwc2_readl(hsotg->regs + GOTGCTL);
  981. dev_dbg(hsotg->dev, "++OTG Interrupt gotgint=%0x [%s]\n", gotgint,
  982. dwc2_op_state_str(hsotg));
  983. @@ -126,7 +126,7 @@ static void dwc2_handle_otg_intr(struct
  984. dev_dbg(hsotg->dev,
  985. " ++OTG Interrupt: Session End Detected++ (%s)\n",
  986. dwc2_op_state_str(hsotg));
  987. - gotgctl = readl(hsotg->regs + GOTGCTL);
  988. + gotgctl = dwc2_readl(hsotg->regs + GOTGCTL);
  989. if (hsotg->op_state == OTG_STATE_B_HOST) {
  990. hsotg->op_state = OTG_STATE_B_PERIPHERAL;
  991. @@ -149,15 +149,15 @@ static void dwc2_handle_otg_intr(struct
  992. hsotg->lx_state = DWC2_L0;
  993. }
  994. - gotgctl = readl(hsotg->regs + GOTGCTL);
  995. + gotgctl = dwc2_readl(hsotg->regs + GOTGCTL);
  996. gotgctl &= ~GOTGCTL_DEVHNPEN;
  997. - writel(gotgctl, hsotg->regs + GOTGCTL);
  998. + dwc2_writel(gotgctl, hsotg->regs + GOTGCTL);
  999. }
  1000. if (gotgint & GOTGINT_SES_REQ_SUC_STS_CHNG) {
  1001. dev_dbg(hsotg->dev,
  1002. " ++OTG Interrupt: Session Request Success Status Change++\n");
  1003. - gotgctl = readl(hsotg->regs + GOTGCTL);
  1004. + gotgctl = dwc2_readl(hsotg->regs + GOTGCTL);
  1005. if (gotgctl & GOTGCTL_SESREQSCS) {
  1006. if (hsotg->core_params->phy_type ==
  1007. DWC2_PHY_TYPE_PARAM_FS
  1008. @@ -165,9 +165,9 @@ static void dwc2_handle_otg_intr(struct
  1009. hsotg->srp_success = 1;
  1010. } else {
  1011. /* Clear Session Request */
  1012. - gotgctl = readl(hsotg->regs + GOTGCTL);
  1013. + gotgctl = dwc2_readl(hsotg->regs + GOTGCTL);
  1014. gotgctl &= ~GOTGCTL_SESREQ;
  1015. - writel(gotgctl, hsotg->regs + GOTGCTL);
  1016. + dwc2_writel(gotgctl, hsotg->regs + GOTGCTL);
  1017. }
  1018. }
  1019. }
  1020. @@ -177,7 +177,7 @@ static void dwc2_handle_otg_intr(struct
  1021. * Print statements during the HNP interrupt handling
  1022. * can cause it to fail
  1023. */
  1024. - gotgctl = readl(hsotg->regs + GOTGCTL);
  1025. + gotgctl = dwc2_readl(hsotg->regs + GOTGCTL);
  1026. /*
  1027. * WA for 3.00a- HW is not setting cur_mode, even sometimes
  1028. * this does not help
  1029. @@ -197,9 +197,9 @@ static void dwc2_handle_otg_intr(struct
  1030. * interrupt does not get handled and Linux
  1031. * complains loudly.
  1032. */
  1033. - gintmsk = readl(hsotg->regs + GINTMSK);
  1034. + gintmsk = dwc2_readl(hsotg->regs + GINTMSK);
  1035. gintmsk &= ~GINTSTS_SOF;
  1036. - writel(gintmsk, hsotg->regs + GINTMSK);
  1037. + dwc2_writel(gintmsk, hsotg->regs + GINTMSK);
  1038. /*
  1039. * Call callback function with spin lock
  1040. @@ -213,9 +213,9 @@ static void dwc2_handle_otg_intr(struct
  1041. hsotg->op_state = OTG_STATE_B_HOST;
  1042. }
  1043. } else {
  1044. - gotgctl = readl(hsotg->regs + GOTGCTL);
  1045. + gotgctl = dwc2_readl(hsotg->regs + GOTGCTL);
  1046. gotgctl &= ~(GOTGCTL_HNPREQ | GOTGCTL_DEVHNPEN);
  1047. - writel(gotgctl, hsotg->regs + GOTGCTL);
  1048. + dwc2_writel(gotgctl, hsotg->regs + GOTGCTL);
  1049. dev_dbg(hsotg->dev, "HNP Failed\n");
  1050. dev_err(hsotg->dev,
  1051. "Device Not Connected/Responding\n");
  1052. @@ -241,9 +241,9 @@ static void dwc2_handle_otg_intr(struct
  1053. hsotg->op_state = OTG_STATE_A_PERIPHERAL;
  1054. } else {
  1055. /* Need to disable SOF interrupt immediately */
  1056. - gintmsk = readl(hsotg->regs + GINTMSK);
  1057. + gintmsk = dwc2_readl(hsotg->regs + GINTMSK);
  1058. gintmsk &= ~GINTSTS_SOF;
  1059. - writel(gintmsk, hsotg->regs + GINTMSK);
  1060. + dwc2_writel(gintmsk, hsotg->regs + GINTMSK);
  1061. spin_unlock(&hsotg->lock);
  1062. dwc2_hcd_start(hsotg);
  1063. spin_lock(&hsotg->lock);
  1064. @@ -258,7 +258,7 @@ static void dwc2_handle_otg_intr(struct
  1065. dev_dbg(hsotg->dev, " ++OTG Interrupt: Debounce Done++\n");
  1066. /* Clear GOTGINT */
  1067. - writel(gotgint, hsotg->regs + GOTGINT);
  1068. + dwc2_writel(gotgint, hsotg->regs + GOTGINT);
  1069. }
  1070. /**
  1071. @@ -273,11 +273,11 @@ static void dwc2_handle_otg_intr(struct
  1072. */
  1073. static void dwc2_handle_conn_id_status_change_intr(struct dwc2_hsotg *hsotg)
  1074. {
  1075. - u32 gintmsk = readl(hsotg->regs + GINTMSK);
  1076. + u32 gintmsk = dwc2_readl(hsotg->regs + GINTMSK);
  1077. /* Need to disable SOF interrupt immediately */
  1078. gintmsk &= ~GINTSTS_SOF;
  1079. - writel(gintmsk, hsotg->regs + GINTMSK);
  1080. + dwc2_writel(gintmsk, hsotg->regs + GINTMSK);
  1081. dev_dbg(hsotg->dev, " ++Connector ID Status Change Interrupt++ (%s)\n",
  1082. dwc2_is_host_mode(hsotg) ? "Host" : "Device");
  1083. @@ -292,7 +292,7 @@ static void dwc2_handle_conn_id_status_c
  1084. spin_lock(&hsotg->lock);
  1085. /* Clear interrupt */
  1086. - writel(GINTSTS_CONIDSTSCHNG, hsotg->regs + GINTSTS);
  1087. + dwc2_writel(GINTSTS_CONIDSTSCHNG, hsotg->regs + GINTSTS);
  1088. }
  1089. /**
  1090. @@ -311,7 +311,7 @@ static void dwc2_handle_session_req_intr
  1091. dev_dbg(hsotg->dev, "++Session Request Interrupt++\n");
  1092. /* Clear interrupt */
  1093. - writel(GINTSTS_SESSREQINT, hsotg->regs + GINTSTS);
  1094. + dwc2_writel(GINTSTS_SESSREQINT, hsotg->regs + GINTSTS);
  1095. }
  1096. /*
  1097. @@ -327,23 +327,23 @@ static void dwc2_handle_wakeup_detected_
  1098. dev_dbg(hsotg->dev, "%s lxstate = %d\n", __func__, hsotg->lx_state);
  1099. if (dwc2_is_device_mode(hsotg)) {
  1100. - dev_dbg(hsotg->dev, "DSTS=0x%0x\n", readl(hsotg->regs + DSTS));
  1101. + dev_dbg(hsotg->dev, "DSTS=0x%0x\n", dwc2_readl(hsotg->regs + DSTS));
  1102. if (hsotg->lx_state == DWC2_L2) {
  1103. - u32 dctl = readl(hsotg->regs + DCTL);
  1104. + u32 dctl = dwc2_readl(hsotg->regs + DCTL);
  1105. /* Clear Remote Wakeup Signaling */
  1106. dctl &= ~DCTL_RMTWKUPSIG;
  1107. - writel(dctl, hsotg->regs + DCTL);
  1108. + dwc2_writel(dctl, hsotg->regs + DCTL);
  1109. }
  1110. /* Change to L0 state */
  1111. hsotg->lx_state = DWC2_L0;
  1112. } else {
  1113. if (hsotg->lx_state != DWC2_L1) {
  1114. - u32 pcgcctl = readl(hsotg->regs + PCGCTL);
  1115. + u32 pcgcctl = dwc2_readl(hsotg->regs + PCGCTL);
  1116. /* Restart the Phy Clock */
  1117. pcgcctl &= ~PCGCTL_STOPPCLK;
  1118. - writel(pcgcctl, hsotg->regs + PCGCTL);
  1119. + dwc2_writel(pcgcctl, hsotg->regs + PCGCTL);
  1120. mod_timer(&hsotg->wkp_timer,
  1121. jiffies + msecs_to_jiffies(71));
  1122. } else {
  1123. @@ -353,7 +353,7 @@ static void dwc2_handle_wakeup_detected_
  1124. }
  1125. /* Clear interrupt */
  1126. - writel(GINTSTS_WKUPINT, hsotg->regs + GINTSTS);
  1127. + dwc2_writel(GINTSTS_WKUPINT, hsotg->regs + GINTSTS);
  1128. }
  1129. /*
  1130. @@ -369,7 +369,7 @@ static void dwc2_handle_disconnect_intr(
  1131. /* Change to L3 (OFF) state */
  1132. hsotg->lx_state = DWC2_L3;
  1133. - writel(GINTSTS_DISCONNINT, hsotg->regs + GINTSTS);
  1134. + dwc2_writel(GINTSTS_DISCONNINT, hsotg->regs + GINTSTS);
  1135. }
  1136. /*
  1137. @@ -391,7 +391,7 @@ static void dwc2_handle_usb_suspend_intr
  1138. * Check the Device status register to determine if the Suspend
  1139. * state is active
  1140. */
  1141. - dsts = readl(hsotg->regs + DSTS);
  1142. + dsts = dwc2_readl(hsotg->regs + DSTS);
  1143. dev_dbg(hsotg->dev, "DSTS=0x%0x\n", dsts);
  1144. dev_dbg(hsotg->dev,
  1145. "DSTS.Suspend Status=%d HWCFG4.Power Optimize=%d\n",
  1146. @@ -413,7 +413,7 @@ static void dwc2_handle_usb_suspend_intr
  1147. hsotg->lx_state = DWC2_L2;
  1148. /* Clear interrupt */
  1149. - writel(GINTSTS_USBSUSP, hsotg->regs + GINTSTS);
  1150. + dwc2_writel(GINTSTS_USBSUSP, hsotg->regs + GINTSTS);
  1151. }
  1152. #define GINTMSK_COMMON (GINTSTS_WKUPINT | GINTSTS_SESSREQINT | \
  1153. @@ -431,9 +431,9 @@ static u32 dwc2_read_common_intr(struct
  1154. u32 gahbcfg;
  1155. u32 gintmsk_common = GINTMSK_COMMON;
  1156. - gintsts = readl(hsotg->regs + GINTSTS);
  1157. - gintmsk = readl(hsotg->regs + GINTMSK);
  1158. - gahbcfg = readl(hsotg->regs + GAHBCFG);
  1159. + gintsts = dwc2_readl(hsotg->regs + GINTSTS);
  1160. + gintmsk = dwc2_readl(hsotg->regs + GINTMSK);
  1161. + gahbcfg = dwc2_readl(hsotg->regs + GAHBCFG);
  1162. /* If any common interrupts set */
  1163. if (gintsts & gintmsk_common)
  1164. --- a/drivers/usb/dwc2/gadget.c
  1165. +++ b/drivers/usb/dwc2/gadget.c
  1166. @@ -55,12 +55,12 @@ static inline struct s3c_hsotg *to_hsotg
  1167. static inline void __orr32(void __iomem *ptr, u32 val)
  1168. {
  1169. - writel(readl(ptr) | val, ptr);
  1170. + dwc2_writel(dwc2_readl(ptr) | val, ptr);
  1171. }
  1172. static inline void __bic32(void __iomem *ptr, u32 val)
  1173. {
  1174. - writel(readl(ptr) & ~val, ptr);
  1175. + dwc2_writel(dwc2_readl(ptr) & ~val, ptr);
  1176. }
  1177. /* forward decleration of functions */
  1178. @@ -97,14 +97,14 @@ static inline bool using_dma(struct s3c_
  1179. */
  1180. static void s3c_hsotg_en_gsint(struct s3c_hsotg *hsotg, u32 ints)
  1181. {
  1182. - u32 gsintmsk = readl(hsotg->regs + GINTMSK);
  1183. + u32 gsintmsk = dwc2_readl(hsotg->regs + GINTMSK);
  1184. u32 new_gsintmsk;
  1185. new_gsintmsk = gsintmsk | ints;
  1186. if (new_gsintmsk != gsintmsk) {
  1187. dev_dbg(hsotg->dev, "gsintmsk now 0x%08x\n", new_gsintmsk);
  1188. - writel(new_gsintmsk, hsotg->regs + GINTMSK);
  1189. + dwc2_writel(new_gsintmsk, hsotg->regs + GINTMSK);
  1190. }
  1191. }
  1192. @@ -115,13 +115,13 @@ static void s3c_hsotg_en_gsint(struct s3
  1193. */
  1194. static void s3c_hsotg_disable_gsint(struct s3c_hsotg *hsotg, u32 ints)
  1195. {
  1196. - u32 gsintmsk = readl(hsotg->regs + GINTMSK);
  1197. + u32 gsintmsk = dwc2_readl(hsotg->regs + GINTMSK);
  1198. u32 new_gsintmsk;
  1199. new_gsintmsk = gsintmsk & ~ints;
  1200. if (new_gsintmsk != gsintmsk)
  1201. - writel(new_gsintmsk, hsotg->regs + GINTMSK);
  1202. + dwc2_writel(new_gsintmsk, hsotg->regs + GINTMSK);
  1203. }
  1204. /**
  1205. @@ -146,12 +146,12 @@ static void s3c_hsotg_ctrl_epint(struct
  1206. bit <<= 16;
  1207. local_irq_save(flags);
  1208. - daint = readl(hsotg->regs + DAINTMSK);
  1209. + daint = dwc2_readl(hsotg->regs + DAINTMSK);
  1210. if (en)
  1211. daint |= bit;
  1212. else
  1213. daint &= ~bit;
  1214. - writel(daint, hsotg->regs + DAINTMSK);
  1215. + dwc2_writel(daint, hsotg->regs + DAINTMSK);
  1216. local_irq_restore(flags);
  1217. }
  1218. @@ -169,8 +169,8 @@ static void s3c_hsotg_init_fifo(struct s
  1219. /* set FIFO sizes to 2048/1024 */
  1220. - writel(2048, hsotg->regs + GRXFSIZ);
  1221. - writel((2048 << FIFOSIZE_STARTADDR_SHIFT) |
  1222. + dwc2_writel(2048, hsotg->regs + GRXFSIZ);
  1223. + dwc2_writel((2048 << FIFOSIZE_STARTADDR_SHIFT) |
  1224. (1024 << FIFOSIZE_DEPTH_SHIFT), hsotg->regs + GNPTXFSIZ);
  1225. /*
  1226. @@ -200,7 +200,7 @@ static void s3c_hsotg_init_fifo(struct s
  1227. "insufficient fifo memory");
  1228. addr += size;
  1229. - writel(val, hsotg->regs + DPTXFSIZN(ep));
  1230. + dwc2_writel(val, hsotg->regs + DPTXFSIZN(ep));
  1231. }
  1232. /* 768*4=3072 bytes FIFO length */
  1233. size = 768;
  1234. @@ -211,7 +211,7 @@ static void s3c_hsotg_init_fifo(struct s
  1235. "insufficient fifo memory");
  1236. addr += size;
  1237. - writel(val, hsotg->regs + DPTXFSIZN(ep));
  1238. + dwc2_writel(val, hsotg->regs + DPTXFSIZN(ep));
  1239. }
  1240. /*
  1241. @@ -219,13 +219,13 @@ static void s3c_hsotg_init_fifo(struct s
  1242. * all fifos are flushed before continuing
  1243. */
  1244. - writel(GRSTCTL_TXFNUM(0x10) | GRSTCTL_TXFFLSH |
  1245. + dwc2_writel(GRSTCTL_TXFNUM(0x10) | GRSTCTL_TXFFLSH |
  1246. GRSTCTL_RXFFLSH, hsotg->regs + GRSTCTL);
  1247. /* wait until the fifos are both flushed */
  1248. timeout = 100;
  1249. while (1) {
  1250. - val = readl(hsotg->regs + GRSTCTL);
  1251. + val = dwc2_readl(hsotg->regs + GRSTCTL);
  1252. if ((val & (GRSTCTL_TXFFLSH | GRSTCTL_RXFFLSH)) == 0)
  1253. break;
  1254. @@ -317,7 +317,7 @@ static int s3c_hsotg_write_fifo(struct s
  1255. struct s3c_hsotg_req *hs_req)
  1256. {
  1257. bool periodic = is_ep_periodic(hs_ep);
  1258. - u32 gnptxsts = readl(hsotg->regs + GNPTXSTS);
  1259. + u32 gnptxsts = dwc2_readl(hsotg->regs + GNPTXSTS);
  1260. int buf_pos = hs_req->req.actual;
  1261. int to_write = hs_ep->size_loaded;
  1262. void *data;
  1263. @@ -332,7 +332,7 @@ static int s3c_hsotg_write_fifo(struct s
  1264. return 0;
  1265. if (periodic && !hsotg->dedicated_fifos) {
  1266. - u32 epsize = readl(hsotg->regs + DIEPTSIZ(hs_ep->index));
  1267. + u32 epsize = dwc2_readl(hsotg->regs + DIEPTSIZ(hs_ep->index));
  1268. int size_left;
  1269. int size_done;
  1270. @@ -373,7 +373,7 @@ static int s3c_hsotg_write_fifo(struct s
  1271. return -ENOSPC;
  1272. }
  1273. } else if (hsotg->dedicated_fifos && hs_ep->index != 0) {
  1274. - can_write = readl(hsotg->regs + DTXFSTS(hs_ep->index));
  1275. + can_write = dwc2_readl(hsotg->regs + DTXFSTS(hs_ep->index));
  1276. can_write &= 0xffff;
  1277. can_write *= 4;
  1278. @@ -550,11 +550,11 @@ static void s3c_hsotg_start_req(struct s
  1279. epsize_reg = dir_in ? DIEPTSIZ(index) : DOEPTSIZ(index);
  1280. dev_dbg(hsotg->dev, "%s: DxEPCTL=0x%08x, ep %d, dir %s\n",
  1281. - __func__, readl(hsotg->regs + epctrl_reg), index,
  1282. + __func__, dwc2_readl(hsotg->regs + epctrl_reg), index,
  1283. hs_ep->dir_in ? "in" : "out");
  1284. /* If endpoint is stalled, we will restart request later */
  1285. - ctrl = readl(hsotg->regs + epctrl_reg);
  1286. + ctrl = dwc2_readl(hsotg->regs + epctrl_reg);
  1287. if (ctrl & DXEPCTL_STALL) {
  1288. dev_warn(hsotg->dev, "%s: ep%d is stalled\n", __func__, index);
  1289. @@ -622,7 +622,7 @@ static void s3c_hsotg_start_req(struct s
  1290. hs_ep->req = hs_req;
  1291. /* write size / packets */
  1292. - writel(epsize, hsotg->regs + epsize_reg);
  1293. + dwc2_writel(epsize, hsotg->regs + epsize_reg);
  1294. if (using_dma(hsotg) && !continuing) {
  1295. unsigned int dma_reg;
  1296. @@ -633,7 +633,7 @@ static void s3c_hsotg_start_req(struct s
  1297. */
  1298. dma_reg = dir_in ? DIEPDMA(index) : DOEPDMA(index);
  1299. - writel(ureq->dma, hsotg->regs + dma_reg);
  1300. + dwc2_writel(ureq->dma, hsotg->regs + dma_reg);
  1301. dev_dbg(hsotg->dev, "%s: %pad => 0x%08x\n",
  1302. __func__, &ureq->dma, dma_reg);
  1303. @@ -652,7 +652,7 @@ static void s3c_hsotg_start_req(struct s
  1304. dev_dbg(hsotg->dev, "%s: DxEPCTL=0x%08x\n", __func__, ctrl);
  1305. - writel(ctrl, hsotg->regs + epctrl_reg);
  1306. + dwc2_writel(ctrl, hsotg->regs + epctrl_reg);
  1307. /*
  1308. * set these, it seems that DMA support increments past the end
  1309. @@ -674,7 +674,7 @@ static void s3c_hsotg_start_req(struct s
  1310. * to debugging to see what is going on.
  1311. */
  1312. if (dir_in)
  1313. - writel(DIEPMSK_INTKNTXFEMPMSK,
  1314. + dwc2_writel(DIEPMSK_INTKNTXFEMPMSK,
  1315. hsotg->regs + DIEPINT(index));
  1316. /*
  1317. @@ -683,13 +683,13 @@ static void s3c_hsotg_start_req(struct s
  1318. */
  1319. /* check ep is enabled */
  1320. - if (!(readl(hsotg->regs + epctrl_reg) & DXEPCTL_EPENA))
  1321. + if (!(dwc2_readl(hsotg->regs + epctrl_reg) & DXEPCTL_EPENA))
  1322. dev_warn(hsotg->dev,
  1323. "ep%d: failed to become enabled (DXEPCTL=0x%08x)?\n",
  1324. - index, readl(hsotg->regs + epctrl_reg));
  1325. + index, dwc2_readl(hsotg->regs + epctrl_reg));
  1326. dev_dbg(hsotg->dev, "%s: DXEPCTL=0x%08x\n",
  1327. - __func__, readl(hsotg->regs + epctrl_reg));
  1328. + __func__, dwc2_readl(hsotg->regs + epctrl_reg));
  1329. /* enable ep interrupts */
  1330. s3c_hsotg_ctrl_epint(hsotg, hs_ep->index, hs_ep->dir_in, 1);
  1331. @@ -1051,14 +1051,14 @@ static void s3c_hsotg_stall_ep0(struct s
  1332. * taken effect, so no need to clear later.
  1333. */
  1334. - ctrl = readl(hsotg->regs + reg);
  1335. + ctrl = dwc2_readl(hsotg->regs + reg);
  1336. ctrl |= DXEPCTL_STALL;
  1337. ctrl |= DXEPCTL_CNAK;
  1338. - writel(ctrl, hsotg->regs + reg);
  1339. + dwc2_writel(ctrl, hsotg->regs + reg);
  1340. dev_dbg(hsotg->dev,
  1341. "written DXEPCTL=0x%08x to %08x (DXEPCTL=0x%08x)\n",
  1342. - ctrl, reg, readl(hsotg->regs + reg));
  1343. + ctrl, reg, dwc2_readl(hsotg->regs + reg));
  1344. /*
  1345. * complete won't be called, so we enqueue
  1346. @@ -1108,11 +1108,11 @@ static void s3c_hsotg_process_control(st
  1347. switch (ctrl->bRequest) {
  1348. case USB_REQ_SET_ADDRESS:
  1349. s3c_hsotg_disconnect(hsotg);
  1350. - dcfg = readl(hsotg->regs + DCFG);
  1351. + dcfg = dwc2_readl(hsotg->regs + DCFG);
  1352. dcfg &= ~DCFG_DEVADDR_MASK;
  1353. dcfg |= (le16_to_cpu(ctrl->wValue) <<
  1354. DCFG_DEVADDR_SHIFT) & DCFG_DEVADDR_MASK;
  1355. - writel(dcfg, hsotg->regs + DCFG);
  1356. + dwc2_writel(dcfg, hsotg->regs + DCFG);
  1357. dev_info(hsotg->dev, "new address %d\n", ctrl->wValue);
  1358. @@ -1302,7 +1302,7 @@ static void s3c_hsotg_rx_data(struct s3c
  1359. if (!hs_req) {
  1360. - u32 epctl = readl(hsotg->regs + DOEPCTL(ep_idx));
  1361. + u32 epctl = dwc2_readl(hsotg->regs + DOEPCTL(ep_idx));
  1362. int ptr;
  1363. dev_warn(hsotg->dev,
  1364. @@ -1311,7 +1311,7 @@ static void s3c_hsotg_rx_data(struct s3c
  1365. /* dump the data from the FIFO, we've nothing we can do */
  1366. for (ptr = 0; ptr < size; ptr += 4)
  1367. - (void)readl(fifo);
  1368. + (void)dwc2_readl(fifo);
  1369. return;
  1370. }
  1371. @@ -1378,14 +1378,14 @@ static void s3c_hsotg_send_zlp(struct s3
  1372. dev_dbg(hsotg->dev, "sending zero-length packet\n");
  1373. /* issue a zero-sized packet to terminate this */
  1374. - writel(DXEPTSIZ_MC(1) | DXEPTSIZ_PKTCNT(1) |
  1375. + dwc2_writel(DXEPTSIZ_MC(1) | DXEPTSIZ_PKTCNT(1) |
  1376. DXEPTSIZ_XFERSIZE(0), hsotg->regs + DIEPTSIZ(0));
  1377. - ctrl = readl(hsotg->regs + DIEPCTL0);
  1378. + ctrl = dwc2_readl(hsotg->regs + DIEPCTL0);
  1379. ctrl |= DXEPCTL_CNAK; /* clear NAK set by core */
  1380. ctrl |= DXEPCTL_EPENA; /* ensure ep enabled */
  1381. ctrl |= DXEPCTL_USBACTEP;
  1382. - writel(ctrl, hsotg->regs + DIEPCTL0);
  1383. + dwc2_writel(ctrl, hsotg->regs + DIEPCTL0);
  1384. }
  1385. /**
  1386. @@ -1401,7 +1401,7 @@ static void s3c_hsotg_send_zlp(struct s3
  1387. static void s3c_hsotg_handle_outdone(struct s3c_hsotg *hsotg,
  1388. int epnum, bool was_setup)
  1389. {
  1390. - u32 epsize = readl(hsotg->regs + DOEPTSIZ(epnum));
  1391. + u32 epsize = dwc2_readl(hsotg->regs + DOEPTSIZ(epnum));
  1392. struct s3c_hsotg_ep *hs_ep = &hsotg->eps[epnum];
  1393. struct s3c_hsotg_req *hs_req = hs_ep->req;
  1394. struct usb_request *req = &hs_req->req;
  1395. @@ -1475,7 +1475,7 @@ static u32 s3c_hsotg_read_frameno(struct
  1396. {
  1397. u32 dsts;
  1398. - dsts = readl(hsotg->regs + DSTS);
  1399. + dsts = dwc2_readl(hsotg->regs + DSTS);
  1400. dsts &= DSTS_SOFFN_MASK;
  1401. dsts >>= DSTS_SOFFN_SHIFT;
  1402. @@ -1500,7 +1500,7 @@ static u32 s3c_hsotg_read_frameno(struct
  1403. */
  1404. static void s3c_hsotg_handle_rx(struct s3c_hsotg *hsotg)
  1405. {
  1406. - u32 grxstsr = readl(hsotg->regs + GRXSTSP);
  1407. + u32 grxstsr = dwc2_readl(hsotg->regs + GRXSTSP);
  1408. u32 epnum, status, size;
  1409. WARN_ON(using_dma(hsotg));
  1410. @@ -1532,7 +1532,7 @@ static void s3c_hsotg_handle_rx(struct s
  1411. dev_dbg(hsotg->dev,
  1412. "SetupDone (Frame=0x%08x, DOPEPCTL=0x%08x)\n",
  1413. s3c_hsotg_read_frameno(hsotg),
  1414. - readl(hsotg->regs + DOEPCTL(0)));
  1415. + dwc2_readl(hsotg->regs + DOEPCTL(0)));
  1416. s3c_hsotg_handle_outdone(hsotg, epnum, true);
  1417. break;
  1418. @@ -1545,7 +1545,7 @@ static void s3c_hsotg_handle_rx(struct s
  1419. dev_dbg(hsotg->dev,
  1420. "SetupRX (Frame=0x%08x, DOPEPCTL=0x%08x)\n",
  1421. s3c_hsotg_read_frameno(hsotg),
  1422. - readl(hsotg->regs + DOEPCTL(0)));
  1423. + dwc2_readl(hsotg->regs + DOEPCTL(0)));
  1424. s3c_hsotg_rx_data(hsotg, epnum, size);
  1425. break;
  1426. @@ -1622,16 +1622,16 @@ static void s3c_hsotg_set_ep_maxpacket(s
  1427. * if one of the directions may not be in use.
  1428. */
  1429. - reg = readl(regs + DIEPCTL(ep));
  1430. + reg = dwc2_readl(regs + DIEPCTL(ep));
  1431. reg &= ~DXEPCTL_MPS_MASK;
  1432. reg |= mpsval;
  1433. - writel(reg, regs + DIEPCTL(ep));
  1434. + dwc2_writel(reg, regs + DIEPCTL(ep));
  1435. if (ep) {
  1436. - reg = readl(regs + DOEPCTL(ep));
  1437. + reg = dwc2_readl(regs + DOEPCTL(ep));
  1438. reg &= ~DXEPCTL_MPS_MASK;
  1439. reg |= mpsval;
  1440. - writel(reg, regs + DOEPCTL(ep));
  1441. + dwc2_writel(reg, regs + DOEPCTL(ep));
  1442. }
  1443. return;
  1444. @@ -1650,14 +1650,14 @@ static void s3c_hsotg_txfifo_flush(struc
  1445. int timeout;
  1446. int val;
  1447. - writel(GRSTCTL_TXFNUM(idx) | GRSTCTL_TXFFLSH,
  1448. + dwc2_writel(GRSTCTL_TXFNUM(idx) | GRSTCTL_TXFFLSH,
  1449. hsotg->regs + GRSTCTL);
  1450. /* wait until the fifo is flushed */
  1451. timeout = 100;
  1452. while (1) {
  1453. - val = readl(hsotg->regs + GRSTCTL);
  1454. + val = dwc2_readl(hsotg->regs + GRSTCTL);
  1455. if ((val & (GRSTCTL_TXFFLSH)) == 0)
  1456. break;
  1457. @@ -1718,7 +1718,7 @@ static void s3c_hsotg_complete_in(struct
  1458. struct s3c_hsotg_ep *hs_ep)
  1459. {
  1460. struct s3c_hsotg_req *hs_req = hs_ep->req;
  1461. - u32 epsize = readl(hsotg->regs + DIEPTSIZ(hs_ep->index));
  1462. + u32 epsize = dwc2_readl(hsotg->regs + DIEPTSIZ(hs_ep->index));
  1463. int size_left, size_done;
  1464. if (!hs_req) {
  1465. @@ -1801,11 +1801,11 @@ static void s3c_hsotg_epint(struct s3c_h
  1466. u32 ints;
  1467. u32 ctrl;
  1468. - ints = readl(hsotg->regs + epint_reg);
  1469. - ctrl = readl(hsotg->regs + epctl_reg);
  1470. + ints = dwc2_readl(hsotg->regs + epint_reg);
  1471. + ctrl = dwc2_readl(hsotg->regs + epctl_reg);
  1472. /* Clear endpoint interrupts */
  1473. - writel(ints, hsotg->regs + epint_reg);
  1474. + dwc2_writel(ints, hsotg->regs + epint_reg);
  1475. dev_dbg(hsotg->dev, "%s: ep%d(%s) DxEPINT=0x%08x\n",
  1476. __func__, idx, dir_in ? "in" : "out", ints);
  1477. @@ -1816,13 +1816,13 @@ static void s3c_hsotg_epint(struct s3c_h
  1478. ctrl |= DXEPCTL_SETEVENFR;
  1479. else
  1480. ctrl |= DXEPCTL_SETODDFR;
  1481. - writel(ctrl, hsotg->regs + epctl_reg);
  1482. + dwc2_writel(ctrl, hsotg->regs + epctl_reg);
  1483. }
  1484. dev_dbg(hsotg->dev,
  1485. "%s: XferCompl: DxEPCTL=0x%08x, DXEPTSIZ=%08x\n",
  1486. - __func__, readl(hsotg->regs + epctl_reg),
  1487. - readl(hsotg->regs + epsiz_reg));
  1488. + __func__, dwc2_readl(hsotg->regs + epctl_reg),
  1489. + dwc2_readl(hsotg->regs + epsiz_reg));
  1490. /*
  1491. * we get OutDone from the FIFO, so we only need to look
  1492. @@ -1847,16 +1847,16 @@ static void s3c_hsotg_epint(struct s3c_h
  1493. dev_dbg(hsotg->dev, "%s: EPDisbld\n", __func__);
  1494. if (dir_in) {
  1495. - int epctl = readl(hsotg->regs + epctl_reg);
  1496. + int epctl = dwc2_readl(hsotg->regs + epctl_reg);
  1497. s3c_hsotg_txfifo_flush(hsotg, hs_ep->fifo_index);
  1498. if ((epctl & DXEPCTL_STALL) &&
  1499. (epctl & DXEPCTL_EPTYPE_BULK)) {
  1500. - int dctl = readl(hsotg->regs + DCTL);
  1501. + int dctl = dwc2_readl(hsotg->regs + DCTL);
  1502. dctl |= DCTL_CGNPINNAK;
  1503. - writel(dctl, hsotg->regs + DCTL);
  1504. + dwc2_writel(dctl, hsotg->regs + DCTL);
  1505. }
  1506. }
  1507. }
  1508. @@ -1918,7 +1918,7 @@ static void s3c_hsotg_epint(struct s3c_h
  1509. */
  1510. static void s3c_hsotg_irq_enumdone(struct s3c_hsotg *hsotg)
  1511. {
  1512. - u32 dsts = readl(hsotg->regs + DSTS);
  1513. + u32 dsts = dwc2_readl(hsotg->regs + DSTS);
  1514. int ep0_mps = 0, ep_mps = 8;
  1515. /*
  1516. @@ -1979,8 +1979,8 @@ static void s3c_hsotg_irq_enumdone(struc
  1517. s3c_hsotg_enqueue_setup(hsotg);
  1518. dev_dbg(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n",
  1519. - readl(hsotg->regs + DIEPCTL0),
  1520. - readl(hsotg->regs + DOEPCTL0));
  1521. + dwc2_readl(hsotg->regs + DIEPCTL0),
  1522. + dwc2_readl(hsotg->regs + DOEPCTL0));
  1523. }
  1524. /**
  1525. @@ -2014,7 +2014,7 @@ static void kill_all_requests(struct s3c
  1526. }
  1527. if (!hsotg->dedicated_fifos)
  1528. return;
  1529. - size = (readl(hsotg->regs + DTXFSTS(ep->index)) & 0xffff) * 4;
  1530. + size = (dwc2_readl(hsotg->regs + DTXFSTS(ep->index)) & 0xffff) * 4;
  1531. if (size < ep->fifo_size)
  1532. s3c_hsotg_txfifo_flush(hsotg, ep->fifo_index);
  1533. }
  1534. @@ -2084,11 +2084,11 @@ static int s3c_hsotg_corereset(struct s3
  1535. dev_dbg(hsotg->dev, "resetting core\n");
  1536. /* issue soft reset */
  1537. - writel(GRSTCTL_CSFTRST, hsotg->regs + GRSTCTL);
  1538. + dwc2_writel(GRSTCTL_CSFTRST, hsotg->regs + GRSTCTL);
  1539. timeout = 10000;
  1540. do {
  1541. - grstctl = readl(hsotg->regs + GRSTCTL);
  1542. + grstctl = dwc2_readl(hsotg->regs + GRSTCTL);
  1543. } while ((grstctl & GRSTCTL_CSFTRST) && timeout-- > 0);
  1544. if (grstctl & GRSTCTL_CSFTRST) {
  1545. @@ -2099,7 +2099,7 @@ static int s3c_hsotg_corereset(struct s3
  1546. timeout = 10000;
  1547. while (1) {
  1548. - u32 grstctl = readl(hsotg->regs + GRSTCTL);
  1549. + u32 grstctl = dwc2_readl(hsotg->regs + GRSTCTL);
  1550. if (timeout-- < 0) {
  1551. dev_info(hsotg->dev,
  1552. @@ -2134,22 +2134,22 @@ static void s3c_hsotg_core_init(struct s
  1553. */
  1554. /* set the PLL on, remove the HNP/SRP and set the PHY */
  1555. - writel(hsotg->phyif | GUSBCFG_TOUTCAL(7) |
  1556. + dwc2_writel(hsotg->phyif | GUSBCFG_TOUTCAL(7) |
  1557. (0x5 << 10), hsotg->regs + GUSBCFG);
  1558. s3c_hsotg_init_fifo(hsotg);
  1559. __orr32(hsotg->regs + DCTL, DCTL_SFTDISCON);
  1560. - writel(1 << 18 | DCFG_DEVSPD_HS, hsotg->regs + DCFG);
  1561. + dwc2_writel(1 << 18 | DCFG_DEVSPD_HS, hsotg->regs + DCFG);
  1562. /* Clear any pending OTG interrupts */
  1563. - writel(0xffffffff, hsotg->regs + GOTGINT);
  1564. + dwc2_writel(0xffffffff, hsotg->regs + GOTGINT);
  1565. /* Clear any pending interrupts */
  1566. - writel(0xffffffff, hsotg->regs + GINTSTS);
  1567. + dwc2_writel(0xffffffff, hsotg->regs + GINTSTS);
  1568. - writel(GINTSTS_ERLYSUSP | GINTSTS_SESSREQINT |
  1569. + dwc2_writel(GINTSTS_ERLYSUSP | GINTSTS_SESSREQINT |
  1570. GINTSTS_GOUTNAKEFF | GINTSTS_GINNAKEFF |
  1571. GINTSTS_CONIDSTSCHNG | GINTSTS_USBRST |
  1572. GINTSTS_ENUMDONE | GINTSTS_OTGINT |
  1573. @@ -2157,11 +2157,11 @@ static void s3c_hsotg_core_init(struct s
  1574. hsotg->regs + GINTMSK);
  1575. if (using_dma(hsotg))
  1576. - writel(GAHBCFG_GLBL_INTR_EN | GAHBCFG_DMA_EN |
  1577. + dwc2_writel(GAHBCFG_GLBL_INTR_EN | GAHBCFG_DMA_EN |
  1578. GAHBCFG_HBSTLEN_INCR4,
  1579. hsotg->regs + GAHBCFG);
  1580. else
  1581. - writel(((hsotg->dedicated_fifos) ? (GAHBCFG_NP_TXF_EMP_LVL |
  1582. + dwc2_writel(((hsotg->dedicated_fifos) ? (GAHBCFG_NP_TXF_EMP_LVL |
  1583. GAHBCFG_P_TXF_EMP_LVL) : 0) |
  1584. GAHBCFG_GLBL_INTR_EN,
  1585. hsotg->regs + GAHBCFG);
  1586. @@ -2172,7 +2172,7 @@ static void s3c_hsotg_core_init(struct s
  1587. * interrupts.
  1588. */
  1589. - writel(((hsotg->dedicated_fifos) ? DIEPMSK_TXFIFOEMPTY |
  1590. + dwc2_writel(((hsotg->dedicated_fifos) ? DIEPMSK_TXFIFOEMPTY |
  1591. DIEPMSK_INTKNTXFEMPMSK : 0) |
  1592. DIEPMSK_EPDISBLDMSK | DIEPMSK_XFERCOMPLMSK |
  1593. DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK |
  1594. @@ -2183,17 +2183,17 @@ static void s3c_hsotg_core_init(struct s
  1595. * don't need XferCompl, we get that from RXFIFO in slave mode. In
  1596. * DMA mode we may need this.
  1597. */
  1598. - writel((using_dma(hsotg) ? (DIEPMSK_XFERCOMPLMSK |
  1599. + dwc2_writel((using_dma(hsotg) ? (DIEPMSK_XFERCOMPLMSK |
  1600. DIEPMSK_TIMEOUTMSK) : 0) |
  1601. DOEPMSK_EPDISBLDMSK | DOEPMSK_AHBERRMSK |
  1602. DOEPMSK_SETUPMSK,
  1603. hsotg->regs + DOEPMSK);
  1604. - writel(0, hsotg->regs + DAINTMSK);
  1605. + dwc2_writel(0, hsotg->regs + DAINTMSK);
  1606. dev_dbg(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n",
  1607. - readl(hsotg->regs + DIEPCTL0),
  1608. - readl(hsotg->regs + DOEPCTL0));
  1609. + dwc2_readl(hsotg->regs + DIEPCTL0),
  1610. + dwc2_readl(hsotg->regs + DOEPCTL0));
  1611. /* enable in and out endpoint interrupts */
  1612. s3c_hsotg_en_gsint(hsotg, GINTSTS_OEPINT | GINTSTS_IEPINT);
  1613. @@ -2214,7 +2214,7 @@ static void s3c_hsotg_core_init(struct s
  1614. udelay(10); /* see openiboot */
  1615. __bic32(hsotg->regs + DCTL, DCTL_PWRONPRGDONE);
  1616. - dev_dbg(hsotg->dev, "DCTL=0x%08x\n", readl(hsotg->regs + DCTL));
  1617. + dev_dbg(hsotg->dev, "DCTL=0x%08x\n", dwc2_readl(hsotg->regs + DCTL));
  1618. /*
  1619. * DxEPCTL_USBActEp says RO in manual, but seems to be set by
  1620. @@ -2222,26 +2222,26 @@ static void s3c_hsotg_core_init(struct s
  1621. */
  1622. /* set to read 1 8byte packet */
  1623. - writel(DXEPTSIZ_MC(1) | DXEPTSIZ_PKTCNT(1) |
  1624. + dwc2_writel(DXEPTSIZ_MC(1) | DXEPTSIZ_PKTCNT(1) |
  1625. DXEPTSIZ_XFERSIZE(8), hsotg->regs + DOEPTSIZ0);
  1626. - writel(s3c_hsotg_ep0_mps(hsotg->eps[0].ep.maxpacket) |
  1627. + dwc2_writel(s3c_hsotg_ep0_mps(hsotg->eps[0].ep.maxpacket) |
  1628. DXEPCTL_CNAK | DXEPCTL_EPENA |
  1629. DXEPCTL_USBACTEP,
  1630. hsotg->regs + DOEPCTL0);
  1631. /* enable, but don't activate EP0in */
  1632. - writel(s3c_hsotg_ep0_mps(hsotg->eps[0].ep.maxpacket) |
  1633. + dwc2_writel(s3c_hsotg_ep0_mps(hsotg->eps[0].ep.maxpacket) |
  1634. DXEPCTL_USBACTEP, hsotg->regs + DIEPCTL0);
  1635. s3c_hsotg_enqueue_setup(hsotg);
  1636. dev_dbg(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n",
  1637. - readl(hsotg->regs + DIEPCTL0),
  1638. - readl(hsotg->regs + DOEPCTL0));
  1639. + dwc2_readl(hsotg->regs + DIEPCTL0),
  1640. + dwc2_readl(hsotg->regs + DOEPCTL0));
  1641. /* clear global NAKs */
  1642. - writel(DCTL_CGOUTNAK | DCTL_CGNPINNAK,
  1643. + dwc2_writel(DCTL_CGOUTNAK | DCTL_CGNPINNAK,
  1644. hsotg->regs + DCTL);
  1645. /* must be at-least 3ms to allow bus to see disconnect */
  1646. @@ -2265,8 +2265,8 @@ static irqreturn_t s3c_hsotg_irq(int irq
  1647. spin_lock(&hsotg->lock);
  1648. irq_retry:
  1649. - gintsts = readl(hsotg->regs + GINTSTS);
  1650. - gintmsk = readl(hsotg->regs + GINTMSK);
  1651. + gintsts = dwc2_readl(hsotg->regs + GINTSTS);
  1652. + gintmsk = dwc2_readl(hsotg->regs + GINTMSK);
  1653. dev_dbg(hsotg->dev, "%s: %08x %08x (%08x) retry %d\n",
  1654. __func__, gintsts, gintsts & gintmsk, gintmsk, retry_count);
  1655. @@ -2274,35 +2274,35 @@ irq_retry:
  1656. gintsts &= gintmsk;
  1657. if (gintsts & GINTSTS_OTGINT) {
  1658. - u32 otgint = readl(hsotg->regs + GOTGINT);
  1659. + u32 otgint = dwc2_readl(hsotg->regs + GOTGINT);
  1660. dev_info(hsotg->dev, "OTGInt: %08x\n", otgint);
  1661. - writel(otgint, hsotg->regs + GOTGINT);
  1662. + dwc2_writel(otgint, hsotg->regs + GOTGINT);
  1663. }
  1664. if (gintsts & GINTSTS_SESSREQINT) {
  1665. dev_dbg(hsotg->dev, "%s: SessReqInt\n", __func__);
  1666. - writel(GINTSTS_SESSREQINT, hsotg->regs + GINTSTS);
  1667. + dwc2_writel(GINTSTS_SESSREQINT, hsotg->regs + GINTSTS);
  1668. }
  1669. if (gintsts & GINTSTS_ENUMDONE) {
  1670. - writel(GINTSTS_ENUMDONE, hsotg->regs + GINTSTS);
  1671. + dwc2_writel(GINTSTS_ENUMDONE, hsotg->regs + GINTSTS);
  1672. s3c_hsotg_irq_enumdone(hsotg);
  1673. }
  1674. if (gintsts & GINTSTS_CONIDSTSCHNG) {
  1675. dev_dbg(hsotg->dev, "ConIDStsChg (DSTS=0x%08x, GOTCTL=%08x)\n",
  1676. - readl(hsotg->regs + DSTS),
  1677. - readl(hsotg->regs + GOTGCTL));
  1678. + dwc2_readl(hsotg->regs + DSTS),
  1679. + dwc2_readl(hsotg->regs + GOTGCTL));
  1680. - writel(GINTSTS_CONIDSTSCHNG, hsotg->regs + GINTSTS);
  1681. + dwc2_writel(GINTSTS_CONIDSTSCHNG, hsotg->regs + GINTSTS);
  1682. }
  1683. if (gintsts & (GINTSTS_OEPINT | GINTSTS_IEPINT)) {
  1684. - u32 daint = readl(hsotg->regs + DAINT);
  1685. - u32 daintmsk = readl(hsotg->regs + DAINTMSK);
  1686. + u32 daint = dwc2_readl(hsotg->regs + DAINT);
  1687. + u32 daintmsk = dwc2_readl(hsotg->regs + DAINTMSK);
  1688. u32 daint_out, daint_in;
  1689. int ep;
  1690. @@ -2325,13 +2325,13 @@ irq_retry:
  1691. if (gintsts & GINTSTS_USBRST) {
  1692. - u32 usb_status = readl(hsotg->regs + GOTGCTL);
  1693. + u32 usb_status = dwc2_readl(hsotg->regs + GOTGCTL);
  1694. dev_dbg(hsotg->dev, "%s: USBRst\n", __func__);
  1695. dev_dbg(hsotg->dev, "GNPTXSTS=%08x\n",
  1696. - readl(hsotg->regs + GNPTXSTS));
  1697. + dwc2_readl(hsotg->regs + GNPTXSTS));
  1698. - writel(GINTSTS_USBRST, hsotg->regs + GINTSTS);
  1699. + dwc2_writel(GINTSTS_USBRST, hsotg->regs + GINTSTS);
  1700. if (usb_status & GOTGCTL_BSESVLD) {
  1701. if (time_after(jiffies, hsotg->last_rst +
  1702. @@ -2382,26 +2382,26 @@ irq_retry:
  1703. if (gintsts & GINTSTS_MODEMIS) {
  1704. dev_warn(hsotg->dev, "warning, mode mismatch triggered\n");
  1705. - writel(GINTSTS_MODEMIS, hsotg->regs + GINTSTS);
  1706. + dwc2_writel(GINTSTS_MODEMIS, hsotg->regs + GINTSTS);
  1707. }
  1708. if (gintsts & GINTSTS_USBSUSP) {
  1709. dev_info(hsotg->dev, "GINTSTS_USBSusp\n");
  1710. - writel(GINTSTS_USBSUSP, hsotg->regs + GINTSTS);
  1711. + dwc2_writel(GINTSTS_USBSUSP, hsotg->regs + GINTSTS);
  1712. call_gadget(hsotg, suspend);
  1713. }
  1714. if (gintsts & GINTSTS_WKUPINT) {
  1715. dev_info(hsotg->dev, "GINTSTS_WkUpIn\n");
  1716. - writel(GINTSTS_WKUPINT, hsotg->regs + GINTSTS);
  1717. + dwc2_writel(GINTSTS_WKUPINT, hsotg->regs + GINTSTS);
  1718. call_gadget(hsotg, resume);
  1719. }
  1720. if (gintsts & GINTSTS_ERLYSUSP) {
  1721. dev_dbg(hsotg->dev, "GINTSTS_ErlySusp\n");
  1722. - writel(GINTSTS_ERLYSUSP, hsotg->regs + GINTSTS);
  1723. + dwc2_writel(GINTSTS_ERLYSUSP, hsotg->regs + GINTSTS);
  1724. }
  1725. /*
  1726. @@ -2413,7 +2413,7 @@ irq_retry:
  1727. if (gintsts & GINTSTS_GOUTNAKEFF) {
  1728. dev_info(hsotg->dev, "GOUTNakEff triggered\n");
  1729. - writel(DCTL_CGOUTNAK, hsotg->regs + DCTL);
  1730. + dwc2_writel(DCTL_CGOUTNAK, hsotg->regs + DCTL);
  1731. s3c_hsotg_dump(hsotg);
  1732. }
  1733. @@ -2421,7 +2421,7 @@ irq_retry:
  1734. if (gintsts & GINTSTS_GINNAKEFF) {
  1735. dev_info(hsotg->dev, "GINNakEff triggered\n");
  1736. - writel(DCTL_CGNPINNAK, hsotg->regs + DCTL);
  1737. + dwc2_writel(DCTL_CGNPINNAK, hsotg->regs + DCTL);
  1738. s3c_hsotg_dump(hsotg);
  1739. }
  1740. @@ -2479,7 +2479,7 @@ static int s3c_hsotg_ep_enable(struct us
  1741. /* note, we handle this here instead of s3c_hsotg_set_ep_maxpacket */
  1742. epctrl_reg = dir_in ? DIEPCTL(index) : DOEPCTL(index);
  1743. - epctrl = readl(hsotg->regs + epctrl_reg);
  1744. + epctrl = dwc2_readl(hsotg->regs + epctrl_reg);
  1745. dev_dbg(hsotg->dev, "%s: read DxEPCTL=0x%08x from 0x%08x\n",
  1746. __func__, epctrl, epctrl_reg);
  1747. @@ -2550,7 +2550,7 @@ static int s3c_hsotg_ep_enable(struct us
  1748. for (i = 1; i <= 8; ++i) {
  1749. if (hsotg->fifo_map & (1<<i))
  1750. continue;
  1751. - val = readl(hsotg->regs + DPTXFSIZN(i));
  1752. + val = dwc2_readl(hsotg->regs + DPTXFSIZN(i));
  1753. val = (val >> FIFOSIZE_DEPTH_SHIFT)*4;
  1754. if (val < size)
  1755. continue;
  1756. @@ -2574,9 +2574,9 @@ static int s3c_hsotg_ep_enable(struct us
  1757. dev_dbg(hsotg->dev, "%s: write DxEPCTL=0x%08x\n",
  1758. __func__, epctrl);
  1759. - writel(epctrl, hsotg->regs + epctrl_reg);
  1760. + dwc2_writel(epctrl, hsotg->regs + epctrl_reg);
  1761. dev_dbg(hsotg->dev, "%s: read DxEPCTL=0x%08x\n",
  1762. - __func__, readl(hsotg->regs + epctrl_reg));
  1763. + __func__, dwc2_readl(hsotg->regs + epctrl_reg));
  1764. /* enable the endpoint interrupt */
  1765. s3c_hsotg_ctrl_epint(hsotg, index, dir_in, 1);
  1766. @@ -2617,13 +2617,13 @@ static int s3c_hsotg_ep_disable(struct u
  1767. hs_ep->fifo_index = 0;
  1768. hs_ep->fifo_size = 0;
  1769. - ctrl = readl(hsotg->regs + epctrl_reg);
  1770. + ctrl = dwc2_readl(hsotg->regs + epctrl_reg);
  1771. ctrl &= ~DXEPCTL_EPENA;
  1772. ctrl &= ~DXEPCTL_USBACTEP;
  1773. ctrl |= DXEPCTL_SNAK;
  1774. dev_dbg(hsotg->dev, "%s: DxEPCTL=0x%08x\n", __func__, ctrl);
  1775. - writel(ctrl, hsotg->regs + epctrl_reg);
  1776. + dwc2_writel(ctrl, hsotg->regs + epctrl_reg);
  1777. /* disable endpoint interrupts */
  1778. s3c_hsotg_ctrl_epint(hsotg, hs_ep->index, hs_ep->dir_in, 0);
  1779. @@ -2704,7 +2704,7 @@ static int s3c_hsotg_ep_sethalt(struct u
  1780. /* write both IN and OUT control registers */
  1781. epreg = DIEPCTL(index);
  1782. - epctl = readl(hs->regs + epreg);
  1783. + epctl = dwc2_readl(hs->regs + epreg);
  1784. if (value) {
  1785. epctl |= DXEPCTL_STALL + DXEPCTL_SNAK;
  1786. @@ -2718,10 +2718,10 @@ static int s3c_hsotg_ep_sethalt(struct u
  1787. epctl |= DXEPCTL_SETD0PID;
  1788. }
  1789. - writel(epctl, hs->regs + epreg);
  1790. + dwc2_writel(epctl, hs->regs + epreg);
  1791. epreg = DOEPCTL(index);
  1792. - epctl = readl(hs->regs + epreg);
  1793. + epctl = dwc2_readl(hs->regs + epreg);
  1794. if (value)
  1795. epctl |= DXEPCTL_STALL;
  1796. @@ -2733,7 +2733,7 @@ static int s3c_hsotg_ep_sethalt(struct u
  1797. epctl |= DXEPCTL_SETD0PID;
  1798. }
  1799. - writel(epctl, hs->regs + epreg);
  1800. + dwc2_writel(epctl, hs->regs + epreg);
  1801. hs_ep->halted = value;
  1802. @@ -2822,38 +2822,38 @@ static void s3c_hsotg_init(struct s3c_hs
  1803. {
  1804. /* unmask subset of endpoint interrupts */
  1805. - writel(DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK |
  1806. + dwc2_writel(DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK |
  1807. DIEPMSK_EPDISBLDMSK | DIEPMSK_XFERCOMPLMSK,
  1808. hsotg->regs + DIEPMSK);
  1809. - writel(DOEPMSK_SETUPMSK | DOEPMSK_AHBERRMSK |
  1810. + dwc2_writel(DOEPMSK_SETUPMSK | DOEPMSK_AHBERRMSK |
  1811. DOEPMSK_EPDISBLDMSK | DOEPMSK_XFERCOMPLMSK,
  1812. hsotg->regs + DOEPMSK);
  1813. - writel(0, hsotg->regs + DAINTMSK);
  1814. + dwc2_writel(0, hsotg->regs + DAINTMSK);
  1815. /* Be in disconnected state until gadget is registered */
  1816. __orr32(hsotg->regs + DCTL, DCTL_SFTDISCON);
  1817. if (0) {
  1818. /* post global nak until we're ready */
  1819. - writel(DCTL_SGNPINNAK | DCTL_SGOUTNAK,
  1820. + dwc2_writel(DCTL_SGNPINNAK | DCTL_SGOUTNAK,
  1821. hsotg->regs + DCTL);
  1822. }
  1823. /* setup fifos */
  1824. dev_dbg(hsotg->dev, "GRXFSIZ=0x%08x, GNPTXFSIZ=0x%08x\n",
  1825. - readl(hsotg->regs + GRXFSIZ),
  1826. - readl(hsotg->regs + GNPTXFSIZ));
  1827. + dwc2_readl(hsotg->regs + GRXFSIZ),
  1828. + dwc2_readl(hsotg->regs + GNPTXFSIZ));
  1829. s3c_hsotg_init_fifo(hsotg);
  1830. /* set the PLL on, remove the HNP/SRP and set the PHY */
  1831. - writel(GUSBCFG_PHYIF16 | GUSBCFG_TOUTCAL(7) | (0x5 << 10),
  1832. + dwc2_writel(GUSBCFG_PHYIF16 | GUSBCFG_TOUTCAL(7) | (0x5 << 10),
  1833. hsotg->regs + GUSBCFG);
  1834. - writel(using_dma(hsotg) ? GAHBCFG_DMA_EN : 0x0,
  1835. + dwc2_writel(using_dma(hsotg) ? GAHBCFG_DMA_EN : 0x0,
  1836. hsotg->regs + GAHBCFG);
  1837. }
  1838. @@ -3045,8 +3045,8 @@ static void s3c_hsotg_initep(struct s3c_
  1839. if (using_dma(hsotg)) {
  1840. u32 next = DXEPCTL_NEXTEP((epnum + 1) % 15);
  1841. - writel(next, hsotg->regs + DIEPCTL(epnum));
  1842. - writel(next, hsotg->regs + DOEPCTL(epnum));
  1843. + dwc2_writel(next, hsotg->regs + DIEPCTL(epnum));
  1844. + dwc2_writel(next, hsotg->regs + DOEPCTL(epnum));
  1845. }
  1846. }
  1847. @@ -3061,13 +3061,13 @@ static void s3c_hsotg_hw_cfg(struct s3c_
  1848. u32 cfg2, cfg3, cfg4;
  1849. /* check hardware configuration */
  1850. - cfg2 = readl(hsotg->regs + 0x48);
  1851. + cfg2 = dwc2_readl(hsotg->regs + 0x48);
  1852. hsotg->num_of_eps = (cfg2 >> 10) & 0xF;
  1853. - cfg3 = readl(hsotg->regs + 0x4C);
  1854. + cfg3 = dwc2_readl(hsotg->regs + 0x4C);
  1855. hsotg->fifo_mem = (cfg3 >> 16);
  1856. - cfg4 = readl(hsotg->regs + 0x50);
  1857. + cfg4 = dwc2_readl(hsotg->regs + 0x50);
  1858. hsotg->dedicated_fifos = (cfg4 >> 25) & 1;
  1859. dev_info(hsotg->dev, "EPs: %d, %s fifos, %d entries in SPRAM\n",
  1860. @@ -3089,19 +3089,19 @@ static void s3c_hsotg_dump(struct s3c_hs
  1861. int idx;
  1862. dev_info(dev, "DCFG=0x%08x, DCTL=0x%08x, DIEPMSK=%08x\n",
  1863. - readl(regs + DCFG), readl(regs + DCTL),
  1864. - readl(regs + DIEPMSK));
  1865. + dwc2_readl(regs + DCFG), dwc2_readl(regs + DCTL),
  1866. + dwc2_readl(regs + DIEPMSK));
  1867. dev_info(dev, "GAHBCFG=0x%08x, 0x44=0x%08x\n",
  1868. - readl(regs + GAHBCFG), readl(regs + 0x44));
  1869. + dwc2_readl(regs + GAHBCFG), dwc2_readl(regs + 0x44));
  1870. dev_info(dev, "GRXFSIZ=0x%08x, GNPTXFSIZ=0x%08x\n",
  1871. - readl(regs + GRXFSIZ), readl(regs + GNPTXFSIZ));
  1872. + dwc2_readl(regs + GRXFSIZ), dwc2_readl(regs + GNPTXFSIZ));
  1873. /* show periodic fifo settings */
  1874. for (idx = 1; idx <= 15; idx++) {
  1875. - val = readl(regs + DPTXFSIZN(idx));
  1876. + val = dwc2_readl(regs + DPTXFSIZN(idx));
  1877. dev_info(dev, "DPTx[%d] FSize=%d, StAddr=0x%08x\n", idx,
  1878. val >> FIFOSIZE_DEPTH_SHIFT,
  1879. val & FIFOSIZE_STARTADDR_MASK);
  1880. @@ -3110,21 +3110,21 @@ static void s3c_hsotg_dump(struct s3c_hs
  1881. for (idx = 0; idx < 15; idx++) {
  1882. dev_info(dev,
  1883. "ep%d-in: EPCTL=0x%08x, SIZ=0x%08x, DMA=0x%08x\n", idx,
  1884. - readl(regs + DIEPCTL(idx)),
  1885. - readl(regs + DIEPTSIZ(idx)),
  1886. - readl(regs + DIEPDMA(idx)));
  1887. + dwc2_readl(regs + DIEPCTL(idx)),
  1888. + dwc2_readl(regs + DIEPTSIZ(idx)),
  1889. + dwc2_readl(regs + DIEPDMA(idx)));
  1890. - val = readl(regs + DOEPCTL(idx));
  1891. + val = dwc2_readl(regs + DOEPCTL(idx));
  1892. dev_info(dev,
  1893. "ep%d-out: EPCTL=0x%08x, SIZ=0x%08x, DMA=0x%08x\n",
  1894. - idx, readl(regs + DOEPCTL(idx)),
  1895. - readl(regs + DOEPTSIZ(idx)),
  1896. - readl(regs + DOEPDMA(idx)));
  1897. + idx, dwc2_readl(regs + DOEPCTL(idx)),
  1898. + dwc2_readl(regs + DOEPTSIZ(idx)),
  1899. + dwc2_readl(regs + DOEPDMA(idx)));
  1900. }
  1901. dev_info(dev, "DVBUSDIS=0x%08x, DVBUSPULSE=%08x\n",
  1902. - readl(regs + DVBUSDIS), readl(regs + DVBUSPULSE));
  1903. + dwc2_readl(regs + DVBUSDIS), dwc2_readl(regs + DVBUSPULSE));
  1904. #endif
  1905. }
  1906. @@ -3144,38 +3144,38 @@ static int state_show(struct seq_file *s
  1907. int idx;
  1908. seq_printf(seq, "DCFG=0x%08x, DCTL=0x%08x, DSTS=0x%08x\n",
  1909. - readl(regs + DCFG),
  1910. - readl(regs + DCTL),
  1911. - readl(regs + DSTS));
  1912. + dwc2_readl(regs + DCFG),
  1913. + dwc2_readl(regs + DCTL),
  1914. + dwc2_readl(regs + DSTS));
  1915. seq_printf(seq, "DIEPMSK=0x%08x, DOEPMASK=0x%08x\n",
  1916. - readl(regs + DIEPMSK), readl(regs + DOEPMSK));
  1917. + dwc2_readl(regs + DIEPMSK), dwc2_readl(regs + DOEPMSK));
  1918. seq_printf(seq, "GINTMSK=0x%08x, GINTSTS=0x%08x\n",
  1919. - readl(regs + GINTMSK),
  1920. - readl(regs + GINTSTS));
  1921. + dwc2_readl(regs + GINTMSK),
  1922. + dwc2_readl(regs + GINTSTS));
  1923. seq_printf(seq, "DAINTMSK=0x%08x, DAINT=0x%08x\n",
  1924. - readl(regs + DAINTMSK),
  1925. - readl(regs + DAINT));
  1926. + dwc2_readl(regs + DAINTMSK),
  1927. + dwc2_readl(regs + DAINT));
  1928. seq_printf(seq, "GNPTXSTS=0x%08x, GRXSTSR=%08x\n",
  1929. - readl(regs + GNPTXSTS),
  1930. - readl(regs + GRXSTSR));
  1931. + dwc2_readl(regs + GNPTXSTS),
  1932. + dwc2_readl(regs + GRXSTSR));
  1933. seq_puts(seq, "\nEndpoint status:\n");
  1934. for (idx = 0; idx < 15; idx++) {
  1935. u32 in, out;
  1936. - in = readl(regs + DIEPCTL(idx));
  1937. - out = readl(regs + DOEPCTL(idx));
  1938. + in = dwc2_readl(regs + DIEPCTL(idx));
  1939. + out = dwc2_readl(regs + DOEPCTL(idx));
  1940. seq_printf(seq, "ep%d: DIEPCTL=0x%08x, DOEPCTL=0x%08x",
  1941. idx, in, out);
  1942. - in = readl(regs + DIEPTSIZ(idx));
  1943. - out = readl(regs + DOEPTSIZ(idx));
  1944. + in = dwc2_readl(regs + DIEPTSIZ(idx));
  1945. + out = dwc2_readl(regs + DOEPTSIZ(idx));
  1946. seq_printf(seq, ", DIEPTSIZ=0x%08x, DOEPTSIZ=0x%08x",
  1947. in, out);
  1948. @@ -3215,9 +3215,9 @@ static int fifo_show(struct seq_file *se
  1949. int idx;
  1950. seq_puts(seq, "Non-periodic FIFOs:\n");
  1951. - seq_printf(seq, "RXFIFO: Size %d\n", readl(regs + GRXFSIZ));
  1952. + seq_printf(seq, "RXFIFO: Size %d\n", dwc2_readl(regs + GRXFSIZ));
  1953. - val = readl(regs + GNPTXFSIZ);
  1954. + val = dwc2_readl(regs + GNPTXFSIZ);
  1955. seq_printf(seq, "NPTXFIFO: Size %d, Start 0x%08x\n",
  1956. val >> FIFOSIZE_DEPTH_SHIFT,
  1957. val & FIFOSIZE_DEPTH_MASK);
  1958. @@ -3225,7 +3225,7 @@ static int fifo_show(struct seq_file *se
  1959. seq_puts(seq, "\nPeriodic TXFIFOs:\n");
  1960. for (idx = 1; idx <= 15; idx++) {
  1961. - val = readl(regs + DPTXFSIZN(idx));
  1962. + val = dwc2_readl(regs + DPTXFSIZN(idx));
  1963. seq_printf(seq, "\tDPTXFIFO%2d: Size %d, Start 0x%08x\n", idx,
  1964. val >> FIFOSIZE_DEPTH_SHIFT,
  1965. @@ -3278,20 +3278,20 @@ static int ep_show(struct seq_file *seq,
  1966. /* first show the register state */
  1967. seq_printf(seq, "\tDIEPCTL=0x%08x, DOEPCTL=0x%08x\n",
  1968. - readl(regs + DIEPCTL(index)),
  1969. - readl(regs + DOEPCTL(index)));
  1970. + dwc2_readl(regs + DIEPCTL(index)),
  1971. + dwc2_readl(regs + DOEPCTL(index)));
  1972. seq_printf(seq, "\tDIEPDMA=0x%08x, DOEPDMA=0x%08x\n",
  1973. - readl(regs + DIEPDMA(index)),
  1974. - readl(regs + DOEPDMA(index)));
  1975. + dwc2_readl(regs + DIEPDMA(index)),
  1976. + dwc2_readl(regs + DOEPDMA(index)));
  1977. seq_printf(seq, "\tDIEPINT=0x%08x, DOEPINT=0x%08x\n",
  1978. - readl(regs + DIEPINT(index)),
  1979. - readl(regs + DOEPINT(index)));
  1980. + dwc2_readl(regs + DIEPINT(index)),
  1981. + dwc2_readl(regs + DOEPINT(index)));
  1982. seq_printf(seq, "\tDIEPTSIZ=0x%08x, DOEPTSIZ=0x%08x\n",
  1983. - readl(regs + DIEPTSIZ(index)),
  1984. - readl(regs + DOEPTSIZ(index)));
  1985. + dwc2_readl(regs + DIEPTSIZ(index)),
  1986. + dwc2_readl(regs + DOEPTSIZ(index)));
  1987. seq_puts(seq, "\n");
  1988. seq_printf(seq, "mps %d\n", ep->ep.maxpacket);
  1989. --- a/drivers/usb/dwc2/hcd.c
  1990. +++ b/drivers/usb/dwc2/hcd.c
  1991. @@ -80,10 +80,10 @@ static void dwc2_dump_channel_info(struc
  1992. if (chan == NULL)
  1993. return;
  1994. - hcchar = readl(hsotg->regs + HCCHAR(chan->hc_num));
  1995. - hcsplt = readl(hsotg->regs + HCSPLT(chan->hc_num));
  1996. - hctsiz = readl(hsotg->regs + HCTSIZ(chan->hc_num));
  1997. - hc_dma = readl(hsotg->regs + HCDMA(chan->hc_num));
  1998. + hcchar = dwc2_readl(hsotg->regs + HCCHAR(chan->hc_num));
  1999. + hcsplt = dwc2_readl(hsotg->regs + HCSPLT(chan->hc_num));
  2000. + hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chan->hc_num));
  2001. + hc_dma = dwc2_readl(hsotg->regs + HCDMA(chan->hc_num));
  2002. dev_dbg(hsotg->dev, " Assigned to channel %p:\n", chan);
  2003. dev_dbg(hsotg->dev, " hcchar 0x%08x, hcsplt 0x%08x\n",
  2004. @@ -207,7 +207,7 @@ void dwc2_hcd_start(struct dwc2_hsotg *h
  2005. */
  2006. hprt0 = dwc2_read_hprt0(hsotg);
  2007. hprt0 |= HPRT0_RST;
  2008. - writel(hprt0, hsotg->regs + HPRT0);
  2009. + dwc2_writel(hprt0, hsotg->regs + HPRT0);
  2010. }
  2011. queue_delayed_work(hsotg->wq_otg, &hsotg->start_work,
  2012. @@ -228,11 +228,11 @@ static void dwc2_hcd_cleanup_channels(st
  2013. channel = hsotg->hc_ptr_array[i];
  2014. if (!list_empty(&channel->hc_list_entry))
  2015. continue;
  2016. - hcchar = readl(hsotg->regs + HCCHAR(i));
  2017. + hcchar = dwc2_readl(hsotg->regs + HCCHAR(i));
  2018. if (hcchar & HCCHAR_CHENA) {
  2019. hcchar &= ~(HCCHAR_CHENA | HCCHAR_EPDIR);
  2020. hcchar |= HCCHAR_CHDIS;
  2021. - writel(hcchar, hsotg->regs + HCCHAR(i));
  2022. + dwc2_writel(hcchar, hsotg->regs + HCCHAR(i));
  2023. }
  2024. }
  2025. }
  2026. @@ -241,11 +241,11 @@ static void dwc2_hcd_cleanup_channels(st
  2027. channel = hsotg->hc_ptr_array[i];
  2028. if (!list_empty(&channel->hc_list_entry))
  2029. continue;
  2030. - hcchar = readl(hsotg->regs + HCCHAR(i));
  2031. + hcchar = dwc2_readl(hsotg->regs + HCCHAR(i));
  2032. if (hcchar & HCCHAR_CHENA) {
  2033. /* Halt the channel */
  2034. hcchar |= HCCHAR_CHDIS;
  2035. - writel(hcchar, hsotg->regs + HCCHAR(i));
  2036. + dwc2_writel(hcchar, hsotg->regs + HCCHAR(i));
  2037. }
  2038. dwc2_hc_cleanup(hsotg, channel);
  2039. @@ -279,11 +279,11 @@ void dwc2_hcd_disconnect(struct dwc2_hso
  2040. * interrupt mask and status bits and disabling subsequent host
  2041. * channel interrupts.
  2042. */
  2043. - intr = readl(hsotg->regs + GINTMSK);
  2044. + intr = dwc2_readl(hsotg->regs + GINTMSK);
  2045. intr &= ~(GINTSTS_NPTXFEMP | GINTSTS_PTXFEMP | GINTSTS_HCHINT);
  2046. - writel(intr, hsotg->regs + GINTMSK);
  2047. + dwc2_writel(intr, hsotg->regs + GINTMSK);
  2048. intr = GINTSTS_NPTXFEMP | GINTSTS_PTXFEMP | GINTSTS_HCHINT;
  2049. - writel(intr, hsotg->regs + GINTSTS);
  2050. + dwc2_writel(intr, hsotg->regs + GINTSTS);
  2051. /*
  2052. * Turn off the vbus power only if the core has transitioned to device
  2053. @@ -293,7 +293,7 @@ void dwc2_hcd_disconnect(struct dwc2_hso
  2054. if (dwc2_is_device_mode(hsotg)) {
  2055. if (hsotg->op_state != OTG_STATE_A_SUSPEND) {
  2056. dev_dbg(hsotg->dev, "Disconnect: PortPower off\n");
  2057. - writel(0, hsotg->regs + HPRT0);
  2058. + dwc2_writel(0, hsotg->regs + HPRT0);
  2059. }
  2060. dwc2_disable_host_interrupts(hsotg);
  2061. @@ -344,7 +344,7 @@ void dwc2_hcd_stop(struct dwc2_hsotg *hs
  2062. /* Turn off the vbus power */
  2063. dev_dbg(hsotg->dev, "PortPower off\n");
  2064. - writel(0, hsotg->regs + HPRT0);
  2065. + dwc2_writel(0, hsotg->regs + HPRT0);
  2066. }
  2067. static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg,
  2068. @@ -369,7 +369,7 @@ static int dwc2_hcd_urb_enqueue(struct d
  2069. if ((dev_speed == USB_SPEED_LOW) &&
  2070. (hsotg->hw_params.fs_phy_type == GHWCFG2_FS_PHY_TYPE_DEDICATED) &&
  2071. (hsotg->hw_params.hs_phy_type == GHWCFG2_HS_PHY_TYPE_UTMI)) {
  2072. - u32 hprt0 = readl(hsotg->regs + HPRT0);
  2073. + u32 hprt0 = dwc2_readl(hsotg->regs + HPRT0);
  2074. u32 prtspd = (hprt0 & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT;
  2075. if (prtspd == HPRT0_SPD_FULL_SPEED)
  2076. @@ -391,7 +391,7 @@ static int dwc2_hcd_urb_enqueue(struct d
  2077. return retval;
  2078. }
  2079. - intr_mask = readl(hsotg->regs + GINTMSK);
  2080. + intr_mask = dwc2_readl(hsotg->regs + GINTMSK);
  2081. if (!(intr_mask & GINTSTS_SOF)) {
  2082. enum dwc2_transaction_type tr_type;
  2083. @@ -1059,7 +1059,7 @@ static void dwc2_process_periodic_channe
  2084. if (dbg_perio())
  2085. dev_vdbg(hsotg->dev, "Queue periodic transactions\n");
  2086. - tx_status = readl(hsotg->regs + HPTXSTS);
  2087. + tx_status = dwc2_readl(hsotg->regs + HPTXSTS);
  2088. qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>
  2089. TXSTS_QSPCAVAIL_SHIFT;
  2090. fspcavail = (tx_status & TXSTS_FSPCAVAIL_MASK) >>
  2091. @@ -1074,7 +1074,7 @@ static void dwc2_process_periodic_channe
  2092. qh_ptr = hsotg->periodic_sched_assigned.next;
  2093. while (qh_ptr != &hsotg->periodic_sched_assigned) {
  2094. - tx_status = readl(hsotg->regs + HPTXSTS);
  2095. + tx_status = dwc2_readl(hsotg->regs + HPTXSTS);
  2096. qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>
  2097. TXSTS_QSPCAVAIL_SHIFT;
  2098. if (qspcavail == 0) {
  2099. @@ -1134,7 +1134,7 @@ static void dwc2_process_periodic_channe
  2100. }
  2101. if (hsotg->core_params->dma_enable <= 0) {
  2102. - tx_status = readl(hsotg->regs + HPTXSTS);
  2103. + tx_status = dwc2_readl(hsotg->regs + HPTXSTS);
  2104. qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>
  2105. TXSTS_QSPCAVAIL_SHIFT;
  2106. fspcavail = (tx_status & TXSTS_FSPCAVAIL_MASK) >>
  2107. @@ -1157,9 +1157,9 @@ static void dwc2_process_periodic_channe
  2108. * level to ensure that new requests are loaded as
  2109. * soon as possible.)
  2110. */
  2111. - gintmsk = readl(hsotg->regs + GINTMSK);
  2112. + gintmsk = dwc2_readl(hsotg->regs + GINTMSK);
  2113. gintmsk |= GINTSTS_PTXFEMP;
  2114. - writel(gintmsk, hsotg->regs + GINTMSK);
  2115. + dwc2_writel(gintmsk, hsotg->regs + GINTMSK);
  2116. } else {
  2117. /*
  2118. * Disable the Tx FIFO empty interrupt since there are
  2119. @@ -1168,9 +1168,9 @@ static void dwc2_process_periodic_channe
  2120. * handlers to queue more transactions as transfer
  2121. * states change.
  2122. */
  2123. - gintmsk = readl(hsotg->regs + GINTMSK);
  2124. + gintmsk = dwc2_readl(hsotg->regs + GINTMSK);
  2125. gintmsk &= ~GINTSTS_PTXFEMP;
  2126. - writel(gintmsk, hsotg->regs + GINTMSK);
  2127. + dwc2_writel(gintmsk, hsotg->regs + GINTMSK);
  2128. }
  2129. }
  2130. }
  2131. @@ -1199,7 +1199,7 @@ static void dwc2_process_non_periodic_ch
  2132. dev_vdbg(hsotg->dev, "Queue non-periodic transactions\n");
  2133. - tx_status = readl(hsotg->regs + GNPTXSTS);
  2134. + tx_status = dwc2_readl(hsotg->regs + GNPTXSTS);
  2135. qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>
  2136. TXSTS_QSPCAVAIL_SHIFT;
  2137. fspcavail = (tx_status & TXSTS_FSPCAVAIL_MASK) >>
  2138. @@ -1222,7 +1222,7 @@ static void dwc2_process_non_periodic_ch
  2139. * available in the request queue or the Tx FIFO
  2140. */
  2141. do {
  2142. - tx_status = readl(hsotg->regs + GNPTXSTS);
  2143. + tx_status = dwc2_readl(hsotg->regs + GNPTXSTS);
  2144. qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>
  2145. TXSTS_QSPCAVAIL_SHIFT;
  2146. if (hsotg->core_params->dma_enable <= 0 && qspcavail == 0) {
  2147. @@ -1259,7 +1259,7 @@ next:
  2148. } while (hsotg->non_periodic_qh_ptr != orig_qh_ptr);
  2149. if (hsotg->core_params->dma_enable <= 0) {
  2150. - tx_status = readl(hsotg->regs + GNPTXSTS);
  2151. + tx_status = dwc2_readl(hsotg->regs + GNPTXSTS);
  2152. qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>
  2153. TXSTS_QSPCAVAIL_SHIFT;
  2154. fspcavail = (tx_status & TXSTS_FSPCAVAIL_MASK) >>
  2155. @@ -1279,9 +1279,9 @@ next:
  2156. * level to ensure that new requests are loaded as
  2157. * soon as possible.)
  2158. */
  2159. - gintmsk = readl(hsotg->regs + GINTMSK);
  2160. + gintmsk = dwc2_readl(hsotg->regs + GINTMSK);
  2161. gintmsk |= GINTSTS_NPTXFEMP;
  2162. - writel(gintmsk, hsotg->regs + GINTMSK);
  2163. + dwc2_writel(gintmsk, hsotg->regs + GINTMSK);
  2164. } else {
  2165. /*
  2166. * Disable the Tx FIFO empty interrupt since there are
  2167. @@ -1290,9 +1290,9 @@ next:
  2168. * handlers to queue more transactions as transfer
  2169. * states change.
  2170. */
  2171. - gintmsk = readl(hsotg->regs + GINTMSK);
  2172. + gintmsk = dwc2_readl(hsotg->regs + GINTMSK);
  2173. gintmsk &= ~GINTSTS_NPTXFEMP;
  2174. - writel(gintmsk, hsotg->regs + GINTMSK);
  2175. + dwc2_writel(gintmsk, hsotg->regs + GINTMSK);
  2176. }
  2177. }
  2178. }
  2179. @@ -1330,10 +1330,10 @@ void dwc2_hcd_queue_transactions(struct
  2180. * Ensure NP Tx FIFO empty interrupt is disabled when
  2181. * there are no non-periodic transfers to process
  2182. */
  2183. - u32 gintmsk = readl(hsotg->regs + GINTMSK);
  2184. + u32 gintmsk = dwc2_readl(hsotg->regs + GINTMSK);
  2185. gintmsk &= ~GINTSTS_NPTXFEMP;
  2186. - writel(gintmsk, hsotg->regs + GINTMSK);
  2187. + dwc2_writel(gintmsk, hsotg->regs + GINTMSK);
  2188. }
  2189. }
  2190. }
  2191. @@ -1347,7 +1347,7 @@ static void dwc2_conn_id_status_change(s
  2192. dev_dbg(hsotg->dev, "%s()\n", __func__);
  2193. - gotgctl = readl(hsotg->regs + GOTGCTL);
  2194. + gotgctl = dwc2_readl(hsotg->regs + GOTGCTL);
  2195. dev_dbg(hsotg->dev, "gotgctl=%0x\n", gotgctl);
  2196. dev_dbg(hsotg->dev, "gotgctl.b.conidsts=%d\n",
  2197. !!(gotgctl & GOTGCTL_CONID_B));
  2198. @@ -1408,9 +1408,9 @@ static void dwc2_wakeup_detected(unsigne
  2199. hprt0 = dwc2_read_hprt0(hsotg);
  2200. dev_dbg(hsotg->dev, "Resume: HPRT0=%0x\n", hprt0);
  2201. hprt0 &= ~HPRT0_RES;
  2202. - writel(hprt0, hsotg->regs + HPRT0);
  2203. + dwc2_writel(hprt0, hsotg->regs + HPRT0);
  2204. dev_dbg(hsotg->dev, "Clear Resume: HPRT0=%0x\n",
  2205. - readl(hsotg->regs + HPRT0));
  2206. + dwc2_readl(hsotg->regs + HPRT0));
  2207. dwc2_hcd_rem_wakeup(hsotg);
  2208. @@ -1438,30 +1438,30 @@ static void dwc2_port_suspend(struct dwc
  2209. spin_lock_irqsave(&hsotg->lock, flags);
  2210. if (windex == hsotg->otg_port && dwc2_host_is_b_hnp_enabled(hsotg)) {
  2211. - gotgctl = readl(hsotg->regs + GOTGCTL);
  2212. + gotgctl = dwc2_readl(hsotg->regs + GOTGCTL);
  2213. gotgctl |= GOTGCTL_HSTSETHNPEN;
  2214. - writel(gotgctl, hsotg->regs + GOTGCTL);
  2215. + dwc2_writel(gotgctl, hsotg->regs + GOTGCTL);
  2216. hsotg->op_state = OTG_STATE_A_SUSPEND;
  2217. }
  2218. hprt0 = dwc2_read_hprt0(hsotg);
  2219. hprt0 |= HPRT0_SUSP;
  2220. - writel(hprt0, hsotg->regs + HPRT0);
  2221. + dwc2_writel(hprt0, hsotg->regs + HPRT0);
  2222. /* Update lx_state */
  2223. hsotg->lx_state = DWC2_L2;
  2224. /* Suspend the Phy Clock */
  2225. - pcgctl = readl(hsotg->regs + PCGCTL);
  2226. + pcgctl = dwc2_readl(hsotg->regs + PCGCTL);
  2227. pcgctl |= PCGCTL_STOPPCLK;
  2228. - writel(pcgctl, hsotg->regs + PCGCTL);
  2229. + dwc2_writel(pcgctl, hsotg->regs + PCGCTL);
  2230. udelay(10);
  2231. /* For HNP the bus must be suspended for at least 200ms */
  2232. if (dwc2_host_is_b_hnp_enabled(hsotg)) {
  2233. - pcgctl = readl(hsotg->regs + PCGCTL);
  2234. + pcgctl = dwc2_readl(hsotg->regs + PCGCTL);
  2235. pcgctl &= ~PCGCTL_STOPPCLK;
  2236. - writel(pcgctl, hsotg->regs + PCGCTL);
  2237. + dwc2_writel(pcgctl, hsotg->regs + PCGCTL);
  2238. spin_unlock_irqrestore(&hsotg->lock, flags);
  2239. @@ -1510,23 +1510,23 @@ static int dwc2_hcd_hub_control(struct d
  2240. "ClearPortFeature USB_PORT_FEAT_ENABLE\n");
  2241. hprt0 = dwc2_read_hprt0(hsotg);
  2242. hprt0 |= HPRT0_ENA;
  2243. - writel(hprt0, hsotg->regs + HPRT0);
  2244. + dwc2_writel(hprt0, hsotg->regs + HPRT0);
  2245. break;
  2246. case USB_PORT_FEAT_SUSPEND:
  2247. dev_dbg(hsotg->dev,
  2248. "ClearPortFeature USB_PORT_FEAT_SUSPEND\n");
  2249. - writel(0, hsotg->regs + PCGCTL);
  2250. + dwc2_writel(0, hsotg->regs + PCGCTL);
  2251. msleep(USB_RESUME_TIMEOUT);
  2252. hprt0 = dwc2_read_hprt0(hsotg);
  2253. hprt0 |= HPRT0_RES;
  2254. - writel(hprt0, hsotg->regs + HPRT0);
  2255. + dwc2_writel(hprt0, hsotg->regs + HPRT0);
  2256. hprt0 &= ~HPRT0_SUSP;
  2257. usleep_range(100000, 150000);
  2258. hprt0 &= ~HPRT0_RES;
  2259. - writel(hprt0, hsotg->regs + HPRT0);
  2260. + dwc2_writel(hprt0, hsotg->regs + HPRT0);
  2261. break;
  2262. case USB_PORT_FEAT_POWER:
  2263. @@ -1534,7 +1534,7 @@ static int dwc2_hcd_hub_control(struct d
  2264. "ClearPortFeature USB_PORT_FEAT_POWER\n");
  2265. hprt0 = dwc2_read_hprt0(hsotg);
  2266. hprt0 &= ~HPRT0_PWR;
  2267. - writel(hprt0, hsotg->regs + HPRT0);
  2268. + dwc2_writel(hprt0, hsotg->regs + HPRT0);
  2269. break;
  2270. case USB_PORT_FEAT_INDICATOR:
  2271. @@ -1653,7 +1653,7 @@ static int dwc2_hcd_hub_control(struct d
  2272. break;
  2273. }
  2274. - hprt0 = readl(hsotg->regs + HPRT0);
  2275. + hprt0 = dwc2_readl(hsotg->regs + HPRT0);
  2276. dev_vdbg(hsotg->dev, " HPRT0: 0x%08x\n", hprt0);
  2277. if (hprt0 & HPRT0_CONNSTS)
  2278. @@ -1718,18 +1718,18 @@ static int dwc2_hcd_hub_control(struct d
  2279. "SetPortFeature - USB_PORT_FEAT_POWER\n");
  2280. hprt0 = dwc2_read_hprt0(hsotg);
  2281. hprt0 |= HPRT0_PWR;
  2282. - writel(hprt0, hsotg->regs + HPRT0);
  2283. + dwc2_writel(hprt0, hsotg->regs + HPRT0);
  2284. break;
  2285. case USB_PORT_FEAT_RESET:
  2286. hprt0 = dwc2_read_hprt0(hsotg);
  2287. dev_dbg(hsotg->dev,
  2288. "SetPortFeature - USB_PORT_FEAT_RESET\n");
  2289. - pcgctl = readl(hsotg->regs + PCGCTL);
  2290. + pcgctl = dwc2_readl(hsotg->regs + PCGCTL);
  2291. pcgctl &= ~(PCGCTL_ENBL_SLEEP_GATING | PCGCTL_STOPPCLK);
  2292. - writel(pcgctl, hsotg->regs + PCGCTL);
  2293. + dwc2_writel(pcgctl, hsotg->regs + PCGCTL);
  2294. /* ??? Original driver does this */
  2295. - writel(0, hsotg->regs + PCGCTL);
  2296. + dwc2_writel(0, hsotg->regs + PCGCTL);
  2297. hprt0 = dwc2_read_hprt0(hsotg);
  2298. /* Clear suspend bit if resetting from suspend state */
  2299. @@ -1744,13 +1744,13 @@ static int dwc2_hcd_hub_control(struct d
  2300. hprt0 |= HPRT0_PWR | HPRT0_RST;
  2301. dev_dbg(hsotg->dev,
  2302. "In host mode, hprt0=%08x\n", hprt0);
  2303. - writel(hprt0, hsotg->regs + HPRT0);
  2304. + dwc2_writel(hprt0, hsotg->regs + HPRT0);
  2305. }
  2306. /* Clear reset bit in 10ms (FS/LS) or 50ms (HS) */
  2307. usleep_range(50000, 70000);
  2308. hprt0 &= ~HPRT0_RST;
  2309. - writel(hprt0, hsotg->regs + HPRT0);
  2310. + dwc2_writel(hprt0, hsotg->regs + HPRT0);
  2311. hsotg->lx_state = DWC2_L0; /* Now back to On state */
  2312. break;
  2313. @@ -1814,7 +1814,7 @@ static int dwc2_hcd_is_status_changed(st
  2314. int dwc2_hcd_get_frame_number(struct dwc2_hsotg *hsotg)
  2315. {
  2316. - u32 hfnum = readl(hsotg->regs + HFNUM);
  2317. + u32 hfnum = dwc2_readl(hsotg->regs + HFNUM);
  2318. #ifdef DWC2_DEBUG_SOF
  2319. dev_vdbg(hsotg->dev, "DWC OTG HCD GET FRAME NUMBER %d\n",
  2320. @@ -1917,11 +1917,11 @@ void dwc2_hcd_dump_state(struct dwc2_hso
  2321. if (chan->xfer_started) {
  2322. u32 hfnum, hcchar, hctsiz, hcint, hcintmsk;
  2323. - hfnum = readl(hsotg->regs + HFNUM);
  2324. - hcchar = readl(hsotg->regs + HCCHAR(i));
  2325. - hctsiz = readl(hsotg->regs + HCTSIZ(i));
  2326. - hcint = readl(hsotg->regs + HCINT(i));
  2327. - hcintmsk = readl(hsotg->regs + HCINTMSK(i));
  2328. + hfnum = dwc2_readl(hsotg->regs + HFNUM);
  2329. + hcchar = dwc2_readl(hsotg->regs + HCCHAR(i));
  2330. + hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(i));
  2331. + hcint = dwc2_readl(hsotg->regs + HCINT(i));
  2332. + hcintmsk = dwc2_readl(hsotg->regs + HCINTMSK(i));
  2333. dev_dbg(hsotg->dev, " hfnum: 0x%08x\n", hfnum);
  2334. dev_dbg(hsotg->dev, " hcchar: 0x%08x\n", hcchar);
  2335. dev_dbg(hsotg->dev, " hctsiz: 0x%08x\n", hctsiz);
  2336. @@ -1969,12 +1969,12 @@ void dwc2_hcd_dump_state(struct dwc2_hso
  2337. dev_dbg(hsotg->dev, " periodic_channels: %d\n",
  2338. hsotg->periodic_channels);
  2339. dev_dbg(hsotg->dev, " periodic_usecs: %d\n", hsotg->periodic_usecs);
  2340. - np_tx_status = readl(hsotg->regs + GNPTXSTS);
  2341. + np_tx_status = dwc2_readl(hsotg->regs + GNPTXSTS);
  2342. dev_dbg(hsotg->dev, " NP Tx Req Queue Space Avail: %d\n",
  2343. (np_tx_status & TXSTS_QSPCAVAIL_MASK) >> TXSTS_QSPCAVAIL_SHIFT);
  2344. dev_dbg(hsotg->dev, " NP Tx FIFO Space Avail: %d\n",
  2345. (np_tx_status & TXSTS_FSPCAVAIL_MASK) >> TXSTS_FSPCAVAIL_SHIFT);
  2346. - p_tx_status = readl(hsotg->regs + HPTXSTS);
  2347. + p_tx_status = dwc2_readl(hsotg->regs + HPTXSTS);
  2348. dev_dbg(hsotg->dev, " P Tx Req Queue Space Avail: %d\n",
  2349. (p_tx_status & TXSTS_QSPCAVAIL_MASK) >> TXSTS_QSPCAVAIL_SHIFT);
  2350. dev_dbg(hsotg->dev, " P Tx FIFO Space Avail: %d\n",
  2351. @@ -2238,7 +2238,7 @@ static void dwc2_hcd_reset_func(struct w
  2352. dev_dbg(hsotg->dev, "USB RESET function called\n");
  2353. hprt0 = dwc2_read_hprt0(hsotg);
  2354. hprt0 &= ~HPRT0_RST;
  2355. - writel(hprt0, hsotg->regs + HPRT0);
  2356. + dwc2_writel(hprt0, hsotg->regs + HPRT0);
  2357. hsotg->flags.b.port_reset_change = 1;
  2358. }
  2359. @@ -2715,17 +2715,17 @@ static void dwc2_hcd_free(struct dwc2_hs
  2360. hsotg->status_buf = NULL;
  2361. }
  2362. - ahbcfg = readl(hsotg->regs + GAHBCFG);
  2363. + ahbcfg = dwc2_readl(hsotg->regs + GAHBCFG);
  2364. /* Disable all interrupts */
  2365. ahbcfg &= ~GAHBCFG_GLBL_INTR_EN;
  2366. - writel(ahbcfg, hsotg->regs + GAHBCFG);
  2367. - writel(0, hsotg->regs + GINTMSK);
  2368. + dwc2_writel(ahbcfg, hsotg->regs + GAHBCFG);
  2369. + dwc2_writel(0, hsotg->regs + GINTMSK);
  2370. if (hsotg->hw_params.snpsid >= DWC2_CORE_REV_3_00a) {
  2371. - dctl = readl(hsotg->regs + DCTL);
  2372. + dctl = dwc2_readl(hsotg->regs + DCTL);
  2373. dctl |= DCTL_SFTDISCON;
  2374. - writel(dctl, hsotg->regs + DCTL);
  2375. + dwc2_writel(dctl, hsotg->regs + DCTL);
  2376. }
  2377. if (hsotg->wq_otg) {
  2378. @@ -2788,7 +2788,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hso
  2379. retval = -ENOMEM;
  2380. - hcfg = readl(hsotg->regs + HCFG);
  2381. + hcfg = dwc2_readl(hsotg->regs + HCFG);
  2382. dev_dbg(hsotg->dev, "hcfg=%08x\n", hcfg);
  2383. #ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS
  2384. --- a/drivers/usb/dwc2/hcd_ddma.c
  2385. +++ b/drivers/usb/dwc2/hcd_ddma.c
  2386. @@ -169,19 +169,19 @@ static void dwc2_per_sched_enable(struct
  2387. spin_lock_irqsave(&hsotg->lock, flags);
  2388. - hcfg = readl(hsotg->regs + HCFG);
  2389. + hcfg = dwc2_readl(hsotg->regs + HCFG);
  2390. if (hcfg & HCFG_PERSCHEDENA) {
  2391. /* already enabled */
  2392. spin_unlock_irqrestore(&hsotg->lock, flags);
  2393. return;
  2394. }
  2395. - writel(hsotg->frame_list_dma, hsotg->regs + HFLBADDR);
  2396. + dwc2_writel(hsotg->frame_list_dma, hsotg->regs + HFLBADDR);
  2397. hcfg &= ~HCFG_FRLISTEN_MASK;
  2398. hcfg |= fr_list_en | HCFG_PERSCHEDENA;
  2399. dev_vdbg(hsotg->dev, "Enabling Periodic schedule\n");
  2400. - writel(hcfg, hsotg->regs + HCFG);
  2401. + dwc2_writel(hcfg, hsotg->regs + HCFG);
  2402. spin_unlock_irqrestore(&hsotg->lock, flags);
  2403. }
  2404. @@ -193,7 +193,7 @@ static void dwc2_per_sched_disable(struc
  2405. spin_lock_irqsave(&hsotg->lock, flags);
  2406. - hcfg = readl(hsotg->regs + HCFG);
  2407. + hcfg = dwc2_readl(hsotg->regs + HCFG);
  2408. if (!(hcfg & HCFG_PERSCHEDENA)) {
  2409. /* already disabled */
  2410. spin_unlock_irqrestore(&hsotg->lock, flags);
  2411. @@ -202,7 +202,7 @@ static void dwc2_per_sched_disable(struc
  2412. hcfg &= ~HCFG_PERSCHEDENA;
  2413. dev_vdbg(hsotg->dev, "Disabling Periodic schedule\n");
  2414. - writel(hcfg, hsotg->regs + HCFG);
  2415. + dwc2_writel(hcfg, hsotg->regs + HCFG);
  2416. spin_unlock_irqrestore(&hsotg->lock, flags);
  2417. }
  2418. --- a/drivers/usb/dwc2/hcd.h
  2419. +++ b/drivers/usb/dwc2/hcd.h
  2420. @@ -371,10 +371,10 @@ static inline struct usb_hcd *dwc2_hsotg
  2421. */
  2422. static inline void disable_hc_int(struct dwc2_hsotg *hsotg, int chnum, u32 intr)
  2423. {
  2424. - u32 mask = readl(hsotg->regs + HCINTMSK(chnum));
  2425. + u32 mask = dwc2_readl(hsotg->regs + HCINTMSK(chnum));
  2426. mask &= ~intr;
  2427. - writel(mask, hsotg->regs + HCINTMSK(chnum));
  2428. + dwc2_writel(mask, hsotg->regs + HCINTMSK(chnum));
  2429. }
  2430. /*
  2431. @@ -382,11 +382,11 @@ static inline void disable_hc_int(struct
  2432. */
  2433. static inline int dwc2_is_host_mode(struct dwc2_hsotg *hsotg)
  2434. {
  2435. - return (readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) != 0;
  2436. + return (dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) != 0;
  2437. }
  2438. static inline int dwc2_is_device_mode(struct dwc2_hsotg *hsotg)
  2439. {
  2440. - return (readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) == 0;
  2441. + return (dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) == 0;
  2442. }
  2443. /*
  2444. @@ -395,7 +395,7 @@ static inline int dwc2_is_device_mode(st
  2445. */
  2446. static inline u32 dwc2_read_hprt0(struct dwc2_hsotg *hsotg)
  2447. {
  2448. - u32 hprt0 = readl(hsotg->regs + HPRT0);
  2449. + u32 hprt0 = dwc2_readl(hsotg->regs + HPRT0);
  2450. hprt0 &= ~(HPRT0_ENA | HPRT0_CONNDET | HPRT0_ENACHG | HPRT0_OVRCURRCHG);
  2451. return hprt0;
  2452. @@ -582,7 +582,7 @@ static inline u16 dwc2_micro_frame_num(u
  2453. */
  2454. static inline u32 dwc2_read_core_intr(struct dwc2_hsotg *hsotg)
  2455. {
  2456. - return readl(hsotg->regs + GINTSTS) & readl(hsotg->regs + GINTMSK);
  2457. + return dwc2_readl(hsotg->regs + GINTSTS) & dwc2_readl(hsotg->regs + GINTMSK);
  2458. }
  2459. static inline u32 dwc2_hcd_urb_get_status(struct dwc2_hcd_urb *dwc2_urb)
  2460. @@ -744,7 +744,7 @@ do { \
  2461. qtd_list_entry); \
  2462. if (usb_pipeint(_qtd_->urb->pipe) && \
  2463. (_qh_)->start_split_frame != 0 && !_qtd_->complete_split) { \
  2464. - _hfnum_.d32 = readl((_hcd_)->regs + HFNUM); \
  2465. + _hfnum_.d32 = dwc2_readl((_hcd_)->regs + HFNUM); \
  2466. switch (_hfnum_.b.frnum & 0x7) { \
  2467. case 7: \
  2468. (_hcd_)->hfnum_7_samples_##_letter_++; \
  2469. --- a/drivers/usb/dwc2/hcd_intr.c
  2470. +++ b/drivers/usb/dwc2/hcd_intr.c
  2471. @@ -148,7 +148,7 @@ static void dwc2_sof_intr(struct dwc2_hs
  2472. dwc2_hcd_queue_transactions(hsotg, tr_type);
  2473. /* Clear interrupt */
  2474. - writel(GINTSTS_SOF, hsotg->regs + GINTSTS);
  2475. + dwc2_writel(GINTSTS_SOF, hsotg->regs + GINTSTS);
  2476. }
  2477. /*
  2478. @@ -164,7 +164,7 @@ static void dwc2_rx_fifo_level_intr(stru
  2479. if (dbg_perio())
  2480. dev_vdbg(hsotg->dev, "--RxFIFO Level Interrupt--\n");
  2481. - grxsts = readl(hsotg->regs + GRXSTSP);
  2482. + grxsts = dwc2_readl(hsotg->regs + GRXSTSP);
  2483. chnum = (grxsts & GRXSTS_HCHNUM_MASK) >> GRXSTS_HCHNUM_SHIFT;
  2484. chan = hsotg->hc_ptr_array[chnum];
  2485. if (!chan) {
  2486. @@ -247,11 +247,11 @@ static void dwc2_hprt0_enable(struct dwc
  2487. dev_vdbg(hsotg->dev, "%s(%p)\n", __func__, hsotg);
  2488. /* Every time when port enables calculate HFIR.FrInterval */
  2489. - hfir = readl(hsotg->regs + HFIR);
  2490. + hfir = dwc2_readl(hsotg->regs + HFIR);
  2491. hfir &= ~HFIR_FRINT_MASK;
  2492. hfir |= dwc2_calc_frame_interval(hsotg) << HFIR_FRINT_SHIFT &
  2493. HFIR_FRINT_MASK;
  2494. - writel(hfir, hsotg->regs + HFIR);
  2495. + dwc2_writel(hfir, hsotg->regs + HFIR);
  2496. /* Check if we need to adjust the PHY clock speed for low power */
  2497. if (!params->host_support_fs_ls_low_power) {
  2498. @@ -260,7 +260,7 @@ static void dwc2_hprt0_enable(struct dwc
  2499. return;
  2500. }
  2501. - usbcfg = readl(hsotg->regs + GUSBCFG);
  2502. + usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
  2503. prtspd = (hprt0 & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT;
  2504. if (prtspd == HPRT0_SPD_LOW_SPEED || prtspd == HPRT0_SPD_FULL_SPEED) {
  2505. @@ -268,11 +268,11 @@ static void dwc2_hprt0_enable(struct dwc
  2506. if (!(usbcfg & GUSBCFG_PHY_LP_CLK_SEL)) {
  2507. /* Set PHY low power clock select for FS/LS devices */
  2508. usbcfg |= GUSBCFG_PHY_LP_CLK_SEL;
  2509. - writel(usbcfg, hsotg->regs + GUSBCFG);
  2510. + dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
  2511. do_reset = 1;
  2512. }
  2513. - hcfg = readl(hsotg->regs + HCFG);
  2514. + hcfg = dwc2_readl(hsotg->regs + HCFG);
  2515. fslspclksel = (hcfg & HCFG_FSLSPCLKSEL_MASK) >>
  2516. HCFG_FSLSPCLKSEL_SHIFT;
  2517. @@ -286,7 +286,7 @@ static void dwc2_hprt0_enable(struct dwc
  2518. fslspclksel = HCFG_FSLSPCLKSEL_6_MHZ;
  2519. hcfg &= ~HCFG_FSLSPCLKSEL_MASK;
  2520. hcfg |= fslspclksel << HCFG_FSLSPCLKSEL_SHIFT;
  2521. - writel(hcfg, hsotg->regs + HCFG);
  2522. + dwc2_writel(hcfg, hsotg->regs + HCFG);
  2523. do_reset = 1;
  2524. }
  2525. } else {
  2526. @@ -297,7 +297,7 @@ static void dwc2_hprt0_enable(struct dwc
  2527. fslspclksel = HCFG_FSLSPCLKSEL_48_MHZ;
  2528. hcfg &= ~HCFG_FSLSPCLKSEL_MASK;
  2529. hcfg |= fslspclksel << HCFG_FSLSPCLKSEL_SHIFT;
  2530. - writel(hcfg, hsotg->regs + HCFG);
  2531. + dwc2_writel(hcfg, hsotg->regs + HCFG);
  2532. do_reset = 1;
  2533. }
  2534. }
  2535. @@ -305,7 +305,7 @@ static void dwc2_hprt0_enable(struct dwc
  2536. /* Not low power */
  2537. if (usbcfg & GUSBCFG_PHY_LP_CLK_SEL) {
  2538. usbcfg &= ~GUSBCFG_PHY_LP_CLK_SEL;
  2539. - writel(usbcfg, hsotg->regs + GUSBCFG);
  2540. + dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
  2541. do_reset = 1;
  2542. }
  2543. }
  2544. @@ -332,7 +332,7 @@ static void dwc2_port_intr(struct dwc2_h
  2545. dev_vdbg(hsotg->dev, "--Port Interrupt--\n");
  2546. - hprt0 = readl(hsotg->regs + HPRT0);
  2547. + hprt0 = dwc2_readl(hsotg->regs + HPRT0);
  2548. hprt0_modify = hprt0;
  2549. /*
  2550. @@ -385,7 +385,7 @@ static void dwc2_port_intr(struct dwc2_h
  2551. }
  2552. /* Clear Port Interrupts */
  2553. - writel(hprt0_modify, hsotg->regs + HPRT0);
  2554. + dwc2_writel(hprt0_modify, hsotg->regs + HPRT0);
  2555. }
  2556. /*
  2557. @@ -405,7 +405,7 @@ static u32 dwc2_get_actual_xfer_length(s
  2558. {
  2559. u32 hctsiz, count, length;
  2560. - hctsiz = readl(hsotg->regs + HCTSIZ(chnum));
  2561. + hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chnum));
  2562. if (halt_status == DWC2_HC_XFER_COMPLETE) {
  2563. if (chan->ep_is_in) {
  2564. @@ -483,7 +483,7 @@ static int dwc2_update_urb_state(struct
  2565. urb->status = 0;
  2566. }
  2567. - hctsiz = readl(hsotg->regs + HCTSIZ(chnum));
  2568. + hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chnum));
  2569. dev_vdbg(hsotg->dev, "DWC_otg: %s: %s, channel %d\n",
  2570. __func__, (chan->ep_is_in ? "IN" : "OUT"), chnum);
  2571. dev_vdbg(hsotg->dev, " chan->xfer_len %d\n", chan->xfer_len);
  2572. @@ -506,7 +506,7 @@ void dwc2_hcd_save_data_toggle(struct dw
  2573. struct dwc2_host_chan *chan, int chnum,
  2574. struct dwc2_qtd *qtd)
  2575. {
  2576. - u32 hctsiz = readl(hsotg->regs + HCTSIZ(chnum));
  2577. + u32 hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chnum));
  2578. u32 pid = (hctsiz & TSIZ_SC_MC_PID_MASK) >> TSIZ_SC_MC_PID_SHIFT;
  2579. if (chan->ep_type != USB_ENDPOINT_XFER_CONTROL) {
  2580. @@ -753,9 +753,9 @@ cleanup:
  2581. }
  2582. }
  2583. - haintmsk = readl(hsotg->regs + HAINTMSK);
  2584. + haintmsk = dwc2_readl(hsotg->regs + HAINTMSK);
  2585. haintmsk &= ~(1 << chan->hc_num);
  2586. - writel(haintmsk, hsotg->regs + HAINTMSK);
  2587. + dwc2_writel(haintmsk, hsotg->regs + HAINTMSK);
  2588. /* Try to queue more transfers now that there's a free channel */
  2589. tr_type = dwc2_hcd_select_transactions(hsotg);
  2590. @@ -802,9 +802,9 @@ static void dwc2_halt_channel(struct dwc
  2591. * is enabled so that the non-periodic schedule will
  2592. * be processed
  2593. */
  2594. - gintmsk = readl(hsotg->regs + GINTMSK);
  2595. + gintmsk = dwc2_readl(hsotg->regs + GINTMSK);
  2596. gintmsk |= GINTSTS_NPTXFEMP;
  2597. - writel(gintmsk, hsotg->regs + GINTMSK);
  2598. + dwc2_writel(gintmsk, hsotg->regs + GINTMSK);
  2599. } else {
  2600. dev_vdbg(hsotg->dev, "isoc/intr\n");
  2601. /*
  2602. @@ -821,9 +821,9 @@ static void dwc2_halt_channel(struct dwc
  2603. * enabled so that the periodic schedule will be
  2604. * processed
  2605. */
  2606. - gintmsk = readl(hsotg->regs + GINTMSK);
  2607. + gintmsk = dwc2_readl(hsotg->regs + GINTMSK);
  2608. gintmsk |= GINTSTS_PTXFEMP;
  2609. - writel(gintmsk, hsotg->regs + GINTMSK);
  2610. + dwc2_writel(gintmsk, hsotg->regs + GINTMSK);
  2611. }
  2612. }
  2613. }
  2614. @@ -888,7 +888,7 @@ static void dwc2_complete_periodic_xfer(
  2615. struct dwc2_qtd *qtd,
  2616. enum dwc2_halt_status halt_status)
  2617. {
  2618. - u32 hctsiz = readl(hsotg->regs + HCTSIZ(chnum));
  2619. + u32 hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chnum));
  2620. qtd->error_count = 0;
  2621. @@ -1158,7 +1158,7 @@ static void dwc2_update_urb_state_abn(st
  2622. urb->actual_length += xfer_length;
  2623. - hctsiz = readl(hsotg->regs + HCTSIZ(chnum));
  2624. + hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chnum));
  2625. dev_vdbg(hsotg->dev, "DWC_otg: %s: %s, channel %d\n",
  2626. __func__, (chan->ep_is_in ? "IN" : "OUT"), chnum);
  2627. dev_vdbg(hsotg->dev, " chan->start_pkt_count %d\n",
  2628. @@ -1469,10 +1469,10 @@ static void dwc2_hc_ahberr_intr(struct d
  2629. dwc2_hc_handle_tt_clear(hsotg, chan, qtd);
  2630. - hcchar = readl(hsotg->regs + HCCHAR(chnum));
  2631. - hcsplt = readl(hsotg->regs + HCSPLT(chnum));
  2632. - hctsiz = readl(hsotg->regs + HCTSIZ(chnum));
  2633. - hc_dma = readl(hsotg->regs + HCDMA(chnum));
  2634. + hcchar = dwc2_readl(hsotg->regs + HCCHAR(chnum));
  2635. + hcsplt = dwc2_readl(hsotg->regs + HCSPLT(chnum));
  2636. + hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chnum));
  2637. + hc_dma = dwc2_readl(hsotg->regs + HCDMA(chnum));
  2638. dev_err(hsotg->dev, "AHB ERROR, Channel %d\n", chnum);
  2639. dev_err(hsotg->dev, " hcchar 0x%08x, hcsplt 0x%08x\n", hcchar, hcsplt);
  2640. @@ -1685,10 +1685,10 @@ static bool dwc2_halt_status_ok(struct d
  2641. * This code is here only as a check. This condition should
  2642. * never happen. Ignore the halt if it does occur.
  2643. */
  2644. - hcchar = readl(hsotg->regs + HCCHAR(chnum));
  2645. - hctsiz = readl(hsotg->regs + HCTSIZ(chnum));
  2646. - hcintmsk = readl(hsotg->regs + HCINTMSK(chnum));
  2647. - hcsplt = readl(hsotg->regs + HCSPLT(chnum));
  2648. + hcchar = dwc2_readl(hsotg->regs + HCCHAR(chnum));
  2649. + hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chnum));
  2650. + hcintmsk = dwc2_readl(hsotg->regs + HCINTMSK(chnum));
  2651. + hcsplt = dwc2_readl(hsotg->regs + HCSPLT(chnum));
  2652. dev_dbg(hsotg->dev,
  2653. "%s: chan->halt_status DWC2_HC_XFER_NO_HALT_STATUS,\n",
  2654. __func__);
  2655. @@ -1712,7 +1712,7 @@ static bool dwc2_halt_status_ok(struct d
  2656. * when the halt interrupt occurs. Halt the channel again if it does
  2657. * occur.
  2658. */
  2659. - hcchar = readl(hsotg->regs + HCCHAR(chnum));
  2660. + hcchar = dwc2_readl(hsotg->regs + HCCHAR(chnum));
  2661. if (hcchar & HCCHAR_CHDIS) {
  2662. dev_warn(hsotg->dev,
  2663. "%s: hcchar.chdis set unexpectedly, hcchar 0x%08x, trying to halt again\n",
  2664. @@ -1772,7 +1772,7 @@ static void dwc2_hc_chhltd_intr_dma(stru
  2665. return;
  2666. }
  2667. - hcintmsk = readl(hsotg->regs + HCINTMSK(chnum));
  2668. + hcintmsk = dwc2_readl(hsotg->regs + HCINTMSK(chnum));
  2669. if (chan->hcint & HCINTMSK_XFERCOMPL) {
  2670. /*
  2671. @@ -1867,7 +1867,7 @@ static void dwc2_hc_chhltd_intr_dma(stru
  2672. dev_err(hsotg->dev,
  2673. "hcint 0x%08x, intsts 0x%08x\n",
  2674. chan->hcint,
  2675. - readl(hsotg->regs + GINTSTS));
  2676. + dwc2_readl(hsotg->regs + GINTSTS));
  2677. goto error;
  2678. }
  2679. }
  2680. @@ -1922,11 +1922,11 @@ static void dwc2_hc_n_intr(struct dwc2_h
  2681. chan = hsotg->hc_ptr_array[chnum];
  2682. - hcint = readl(hsotg->regs + HCINT(chnum));
  2683. - hcintmsk = readl(hsotg->regs + HCINTMSK(chnum));
  2684. + hcint = dwc2_readl(hsotg->regs + HCINT(chnum));
  2685. + hcintmsk = dwc2_readl(hsotg->regs + HCINTMSK(chnum));
  2686. if (!chan) {
  2687. dev_err(hsotg->dev, "## hc_ptr_array for channel is NULL ##\n");
  2688. - writel(hcint, hsotg->regs + HCINT(chnum));
  2689. + dwc2_writel(hcint, hsotg->regs + HCINT(chnum));
  2690. return;
  2691. }
  2692. @@ -1938,7 +1938,7 @@ static void dwc2_hc_n_intr(struct dwc2_h
  2693. hcint, hcintmsk, hcint & hcintmsk);
  2694. }
  2695. - writel(hcint, hsotg->regs + HCINT(chnum));
  2696. + dwc2_writel(hcint, hsotg->regs + HCINT(chnum));
  2697. chan->hcint = hcint;
  2698. hcint &= hcintmsk;
  2699. @@ -2030,7 +2030,7 @@ static void dwc2_hc_intr(struct dwc2_hso
  2700. u32 haint;
  2701. int i;
  2702. - haint = readl(hsotg->regs + HAINT);
  2703. + haint = dwc2_readl(hsotg->regs + HAINT);
  2704. if (dbg_perio()) {
  2705. dev_vdbg(hsotg->dev, "%s()\n", __func__);
  2706. @@ -2098,8 +2098,8 @@ irqreturn_t dwc2_handle_hcd_intr(struct
  2707. "DWC OTG HCD Finished Servicing Interrupts\n");
  2708. dev_vdbg(hsotg->dev,
  2709. "DWC OTG HCD gintsts=0x%08x gintmsk=0x%08x\n",
  2710. - readl(hsotg->regs + GINTSTS),
  2711. - readl(hsotg->regs + GINTMSK));
  2712. + dwc2_readl(hsotg->regs + GINTSTS),
  2713. + dwc2_readl(hsotg->regs + GINTMSK));
  2714. }
  2715. }
  2716. --- a/drivers/usb/dwc2/hcd_queue.c
  2717. +++ b/drivers/usb/dwc2/hcd_queue.c
  2718. @@ -115,7 +115,7 @@ static void dwc2_qh_init(struct dwc2_hso
  2719. if (qh->ep_type == USB_ENDPOINT_XFER_INT)
  2720. qh->interval = 8;
  2721. #endif
  2722. - hprt = readl(hsotg->regs + HPRT0);
  2723. + hprt = dwc2_readl(hsotg->regs + HPRT0);
  2724. prtspd = (hprt & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT;
  2725. if (prtspd == HPRT0_SPD_HIGH_SPEED &&
  2726. (dev_speed == USB_SPEED_LOW ||
  2727. @@ -593,9 +593,9 @@ int dwc2_hcd_qh_add(struct dwc2_hsotg *h
  2728. if (status)
  2729. return status;
  2730. if (!hsotg->periodic_qh_count) {
  2731. - intr_mask = readl(hsotg->regs + GINTMSK);
  2732. + intr_mask = dwc2_readl(hsotg->regs + GINTMSK);
  2733. intr_mask |= GINTSTS_SOF;
  2734. - writel(intr_mask, hsotg->regs + GINTMSK);
  2735. + dwc2_writel(intr_mask, hsotg->regs + GINTMSK);
  2736. }
  2737. hsotg->periodic_qh_count++;
  2738. @@ -630,9 +630,9 @@ void dwc2_hcd_qh_unlink(struct dwc2_hsot
  2739. dwc2_deschedule_periodic(hsotg, qh);
  2740. hsotg->periodic_qh_count--;
  2741. if (!hsotg->periodic_qh_count) {
  2742. - intr_mask = readl(hsotg->regs + GINTMSK);
  2743. + intr_mask = dwc2_readl(hsotg->regs + GINTMSK);
  2744. intr_mask &= ~GINTSTS_SOF;
  2745. - writel(intr_mask, hsotg->regs + GINTMSK);
  2746. + dwc2_writel(intr_mask, hsotg->regs + GINTMSK);
  2747. }
  2748. }