btc_dpm.c 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188
  1. /*
  2. * Copyright 2011 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * Authors: Alex Deucher
  23. */
  24. #include "drmP.h"
  25. #include "radeon.h"
  26. #include "btcd.h"
  27. #include "r600_dpm.h"
  28. #include "cypress_dpm.h"
  29. #include "btc_dpm.h"
  30. #include "atom.h"
  31. #define MC_CG_ARB_FREQ_F0 0x0a
  32. #define MC_CG_ARB_FREQ_F1 0x0b
  33. #define MC_CG_ARB_FREQ_F2 0x0c
  34. #define MC_CG_ARB_FREQ_F3 0x0d
  35. #define MC_CG_SEQ_DRAMCONF_S0 0x05
  36. #define MC_CG_SEQ_DRAMCONF_S1 0x06
  37. #define MC_CG_SEQ_YCLK_SUSPEND 0x04
  38. #define MC_CG_SEQ_YCLK_RESUME 0x0a
  39. #define SMC_RAM_END 0x8000
  40. #ifndef BTC_MGCG_SEQUENCE
  41. #define BTC_MGCG_SEQUENCE 300
  42. struct rv7xx_ps *rv770_get_ps(struct radeon_ps *rps);
  43. struct rv7xx_power_info *rv770_get_pi(struct radeon_device *rdev);
  44. struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev);
  45. //********* BARTS **************//
  46. static const u32 barts_cgcg_cgls_default[] =
  47. {
  48. /* Register, Value, Mask bits */
  49. 0x000008f8, 0x00000010, 0xffffffff,
  50. 0x000008fc, 0x00000000, 0xffffffff,
  51. 0x000008f8, 0x00000011, 0xffffffff,
  52. 0x000008fc, 0x00000000, 0xffffffff,
  53. 0x000008f8, 0x00000012, 0xffffffff,
  54. 0x000008fc, 0x00000000, 0xffffffff,
  55. 0x000008f8, 0x00000013, 0xffffffff,
  56. 0x000008fc, 0x00000000, 0xffffffff,
  57. 0x000008f8, 0x00000014, 0xffffffff,
  58. 0x000008fc, 0x00000000, 0xffffffff,
  59. 0x000008f8, 0x00000015, 0xffffffff,
  60. 0x000008fc, 0x00000000, 0xffffffff,
  61. 0x000008f8, 0x00000016, 0xffffffff,
  62. 0x000008fc, 0x00000000, 0xffffffff,
  63. 0x000008f8, 0x00000017, 0xffffffff,
  64. 0x000008fc, 0x00000000, 0xffffffff,
  65. 0x000008f8, 0x00000018, 0xffffffff,
  66. 0x000008fc, 0x00000000, 0xffffffff,
  67. 0x000008f8, 0x00000019, 0xffffffff,
  68. 0x000008fc, 0x00000000, 0xffffffff,
  69. 0x000008f8, 0x0000001a, 0xffffffff,
  70. 0x000008fc, 0x00000000, 0xffffffff,
  71. 0x000008f8, 0x0000001b, 0xffffffff,
  72. 0x000008fc, 0x00000000, 0xffffffff,
  73. 0x000008f8, 0x00000020, 0xffffffff,
  74. 0x000008fc, 0x00000000, 0xffffffff,
  75. 0x000008f8, 0x00000021, 0xffffffff,
  76. 0x000008fc, 0x00000000, 0xffffffff,
  77. 0x000008f8, 0x00000022, 0xffffffff,
  78. 0x000008fc, 0x00000000, 0xffffffff,
  79. 0x000008f8, 0x00000023, 0xffffffff,
  80. 0x000008fc, 0x00000000, 0xffffffff,
  81. 0x000008f8, 0x00000024, 0xffffffff,
  82. 0x000008fc, 0x00000000, 0xffffffff,
  83. 0x000008f8, 0x00000025, 0xffffffff,
  84. 0x000008fc, 0x00000000, 0xffffffff,
  85. 0x000008f8, 0x00000026, 0xffffffff,
  86. 0x000008fc, 0x00000000, 0xffffffff,
  87. 0x000008f8, 0x00000027, 0xffffffff,
  88. 0x000008fc, 0x00000000, 0xffffffff,
  89. 0x000008f8, 0x00000028, 0xffffffff,
  90. 0x000008fc, 0x00000000, 0xffffffff,
  91. 0x000008f8, 0x00000029, 0xffffffff,
  92. 0x000008fc, 0x00000000, 0xffffffff,
  93. 0x000008f8, 0x0000002a, 0xffffffff,
  94. 0x000008fc, 0x00000000, 0xffffffff,
  95. 0x000008f8, 0x0000002b, 0xffffffff,
  96. 0x000008fc, 0x00000000, 0xffffffff
  97. };
  98. #define BARTS_CGCG_CGLS_DEFAULT_LENGTH sizeof(barts_cgcg_cgls_default) / (3 * sizeof(u32))
  99. static const u32 barts_cgcg_cgls_disable[] =
  100. {
  101. 0x000008f8, 0x00000010, 0xffffffff,
  102. 0x000008fc, 0xffffffff, 0xffffffff,
  103. 0x000008f8, 0x00000011, 0xffffffff,
  104. 0x000008fc, 0xffffffff, 0xffffffff,
  105. 0x000008f8, 0x00000012, 0xffffffff,
  106. 0x000008fc, 0xffffffff, 0xffffffff,
  107. 0x000008f8, 0x00000013, 0xffffffff,
  108. 0x000008fc, 0xffffffff, 0xffffffff,
  109. 0x000008f8, 0x00000014, 0xffffffff,
  110. 0x000008fc, 0xffffffff, 0xffffffff,
  111. 0x000008f8, 0x00000015, 0xffffffff,
  112. 0x000008fc, 0xffffffff, 0xffffffff,
  113. 0x000008f8, 0x00000016, 0xffffffff,
  114. 0x000008fc, 0xffffffff, 0xffffffff,
  115. 0x000008f8, 0x00000017, 0xffffffff,
  116. 0x000008fc, 0xffffffff, 0xffffffff,
  117. 0x000008f8, 0x00000018, 0xffffffff,
  118. 0x000008fc, 0xffffffff, 0xffffffff,
  119. 0x000008f8, 0x00000019, 0xffffffff,
  120. 0x000008fc, 0xffffffff, 0xffffffff,
  121. 0x000008f8, 0x0000001a, 0xffffffff,
  122. 0x000008fc, 0xffffffff, 0xffffffff,
  123. 0x000008f8, 0x0000001b, 0xffffffff,
  124. 0x000008fc, 0xffffffff, 0xffffffff,
  125. 0x000008f8, 0x00000020, 0xffffffff,
  126. 0x000008fc, 0x00000000, 0xffffffff,
  127. 0x000008f8, 0x00000021, 0xffffffff,
  128. 0x000008fc, 0x00000000, 0xffffffff,
  129. 0x000008f8, 0x00000022, 0xffffffff,
  130. 0x000008fc, 0x00000000, 0xffffffff,
  131. 0x000008f8, 0x00000023, 0xffffffff,
  132. 0x000008fc, 0x00000000, 0xffffffff,
  133. 0x000008f8, 0x00000024, 0xffffffff,
  134. 0x000008fc, 0x00000000, 0xffffffff,
  135. 0x000008f8, 0x00000025, 0xffffffff,
  136. 0x000008fc, 0x00000000, 0xffffffff,
  137. 0x000008f8, 0x00000026, 0xffffffff,
  138. 0x000008fc, 0x00000000, 0xffffffff,
  139. 0x000008f8, 0x00000027, 0xffffffff,
  140. 0x000008fc, 0x00000000, 0xffffffff,
  141. 0x000008f8, 0x00000028, 0xffffffff,
  142. 0x000008fc, 0x00000000, 0xffffffff,
  143. 0x000008f8, 0x00000029, 0xffffffff,
  144. 0x000008fc, 0x00000000, 0xffffffff,
  145. 0x000008f8, 0x0000002a, 0xffffffff,
  146. 0x000008fc, 0x00000000, 0xffffffff,
  147. 0x000008f8, 0x0000002b, 0xffffffff,
  148. 0x000008fc, 0x00000000, 0xffffffff,
  149. 0x00000644, 0x000f7912, 0x001f4180,
  150. 0x00000644, 0x000f3812, 0x001f4180
  151. };
  152. #define BARTS_CGCG_CGLS_DISABLE_LENGTH sizeof(barts_cgcg_cgls_disable) / (3 * sizeof(u32))
  153. static const u32 barts_cgcg_cgls_enable[] =
  154. {
  155. /* 0x0000c124, 0x84180000, 0x00180000, */
  156. 0x00000644, 0x000f7892, 0x001f4080,
  157. 0x000008f8, 0x00000010, 0xffffffff,
  158. 0x000008fc, 0x00000000, 0xffffffff,
  159. 0x000008f8, 0x00000011, 0xffffffff,
  160. 0x000008fc, 0x00000000, 0xffffffff,
  161. 0x000008f8, 0x00000012, 0xffffffff,
  162. 0x000008fc, 0x00000000, 0xffffffff,
  163. 0x000008f8, 0x00000013, 0xffffffff,
  164. 0x000008fc, 0x00000000, 0xffffffff,
  165. 0x000008f8, 0x00000014, 0xffffffff,
  166. 0x000008fc, 0x00000000, 0xffffffff,
  167. 0x000008f8, 0x00000015, 0xffffffff,
  168. 0x000008fc, 0x00000000, 0xffffffff,
  169. 0x000008f8, 0x00000016, 0xffffffff,
  170. 0x000008fc, 0x00000000, 0xffffffff,
  171. 0x000008f8, 0x00000017, 0xffffffff,
  172. 0x000008fc, 0x00000000, 0xffffffff,
  173. 0x000008f8, 0x00000018, 0xffffffff,
  174. 0x000008fc, 0x00000000, 0xffffffff,
  175. 0x000008f8, 0x00000019, 0xffffffff,
  176. 0x000008fc, 0x00000000, 0xffffffff,
  177. 0x000008f8, 0x0000001a, 0xffffffff,
  178. 0x000008fc, 0x00000000, 0xffffffff,
  179. 0x000008f8, 0x0000001b, 0xffffffff,
  180. 0x000008fc, 0x00000000, 0xffffffff,
  181. 0x000008f8, 0x00000020, 0xffffffff,
  182. 0x000008fc, 0xffffffff, 0xffffffff,
  183. 0x000008f8, 0x00000021, 0xffffffff,
  184. 0x000008fc, 0xffffffff, 0xffffffff,
  185. 0x000008f8, 0x00000022, 0xffffffff,
  186. 0x000008fc, 0xffffffff, 0xffffffff,
  187. 0x000008f8, 0x00000023, 0xffffffff,
  188. 0x000008fc, 0xffffffff, 0xffffffff,
  189. 0x000008f8, 0x00000024, 0xffffffff,
  190. 0x000008fc, 0xffffffff, 0xffffffff,
  191. 0x000008f8, 0x00000025, 0xffffffff,
  192. 0x000008fc, 0xffffffff, 0xffffffff,
  193. 0x000008f8, 0x00000026, 0xffffffff,
  194. 0x000008fc, 0xffffffff, 0xffffffff,
  195. 0x000008f8, 0x00000027, 0xffffffff,
  196. 0x000008fc, 0xffffffff, 0xffffffff,
  197. 0x000008f8, 0x00000028, 0xffffffff,
  198. 0x000008fc, 0xffffffff, 0xffffffff,
  199. 0x000008f8, 0x00000029, 0xffffffff,
  200. 0x000008fc, 0xffffffff, 0xffffffff,
  201. 0x000008f8, 0x0000002a, 0xffffffff,
  202. 0x000008fc, 0xffffffff, 0xffffffff,
  203. 0x000008f8, 0x0000002b, 0xffffffff,
  204. 0x000008fc, 0xffffffff, 0xffffffff
  205. };
  206. #define BARTS_CGCG_CGLS_ENABLE_LENGTH sizeof(barts_cgcg_cgls_enable) / (3 * sizeof(u32))
  207. static const u32 barts_mgcg_default[] =
  208. {
  209. 0x0000802c, 0xc0000000, 0xffffffff,
  210. 0x00005448, 0x00000100, 0xffffffff,
  211. 0x000055e4, 0x00600100, 0xffffffff,
  212. 0x0000160c, 0x00000100, 0xffffffff,
  213. 0x0000c164, 0x00000100, 0xffffffff,
  214. 0x00008a18, 0x00000100, 0xffffffff,
  215. 0x0000897c, 0x06000100, 0xffffffff,
  216. 0x00008b28, 0x00000100, 0xffffffff,
  217. 0x00009144, 0x00000100, 0xffffffff,
  218. 0x00009a60, 0x00000100, 0xffffffff,
  219. 0x00009868, 0x00000100, 0xffffffff,
  220. 0x00008d58, 0x00000100, 0xffffffff,
  221. 0x00009510, 0x00000100, 0xffffffff,
  222. 0x0000949c, 0x00000100, 0xffffffff,
  223. 0x00009654, 0x00000100, 0xffffffff,
  224. 0x00009030, 0x00000100, 0xffffffff,
  225. 0x00009034, 0x00000100, 0xffffffff,
  226. 0x00009038, 0x00000100, 0xffffffff,
  227. 0x0000903c, 0x00000100, 0xffffffff,
  228. 0x00009040, 0x00000100, 0xffffffff,
  229. 0x0000a200, 0x00000100, 0xffffffff,
  230. 0x0000a204, 0x00000100, 0xffffffff,
  231. 0x0000a208, 0x00000100, 0xffffffff,
  232. 0x0000a20c, 0x00000100, 0xffffffff,
  233. 0x0000977c, 0x00000100, 0xffffffff,
  234. 0x00003f80, 0x00000100, 0xffffffff,
  235. 0x0000a210, 0x00000100, 0xffffffff,
  236. 0x0000a214, 0x00000100, 0xffffffff,
  237. 0x000004d8, 0x00000100, 0xffffffff,
  238. 0x00009784, 0x00000100, 0xffffffff,
  239. 0x00009698, 0x00000100, 0xffffffff,
  240. 0x000004d4, 0x00000200, 0xffffffff,
  241. 0x000004d0, 0x00000000, 0xffffffff,
  242. 0x000030cc, 0x00000100, 0xffffffff,
  243. 0x0000d0c0, 0xff000100, 0xffffffff,
  244. 0x0000802c, 0x40000000, 0xffffffff,
  245. 0x0000915c, 0x00010000, 0xffffffff,
  246. 0x00009160, 0x00030002, 0xffffffff,
  247. 0x00009164, 0x00050004, 0xffffffff,
  248. 0x00009168, 0x00070006, 0xffffffff,
  249. 0x00009178, 0x00070000, 0xffffffff,
  250. 0x0000917c, 0x00030002, 0xffffffff,
  251. 0x00009180, 0x00050004, 0xffffffff,
  252. 0x0000918c, 0x00010006, 0xffffffff,
  253. 0x00009190, 0x00090008, 0xffffffff,
  254. 0x00009194, 0x00070000, 0xffffffff,
  255. 0x00009198, 0x00030002, 0xffffffff,
  256. 0x0000919c, 0x00050004, 0xffffffff,
  257. 0x000091a8, 0x00010006, 0xffffffff,
  258. 0x000091ac, 0x00090008, 0xffffffff,
  259. 0x000091b0, 0x00070000, 0xffffffff,
  260. 0x000091b4, 0x00030002, 0xffffffff,
  261. 0x000091b8, 0x00050004, 0xffffffff,
  262. 0x000091c4, 0x00010006, 0xffffffff,
  263. 0x000091c8, 0x00090008, 0xffffffff,
  264. 0x000091cc, 0x00070000, 0xffffffff,
  265. 0x000091d0, 0x00030002, 0xffffffff,
  266. 0x000091d4, 0x00050004, 0xffffffff,
  267. 0x000091e0, 0x00010006, 0xffffffff,
  268. 0x000091e4, 0x00090008, 0xffffffff,
  269. 0x000091e8, 0x00000000, 0xffffffff,
  270. 0x000091ec, 0x00070000, 0xffffffff,
  271. 0x000091f0, 0x00030002, 0xffffffff,
  272. 0x000091f4, 0x00050004, 0xffffffff,
  273. 0x00009200, 0x00010006, 0xffffffff,
  274. 0x00009204, 0x00090008, 0xffffffff,
  275. 0x00009208, 0x00070000, 0xffffffff,
  276. 0x0000920c, 0x00030002, 0xffffffff,
  277. 0x00009210, 0x00050004, 0xffffffff,
  278. 0x0000921c, 0x00010006, 0xffffffff,
  279. 0x00009220, 0x00090008, 0xffffffff,
  280. 0x00009224, 0x00070000, 0xffffffff,
  281. 0x00009228, 0x00030002, 0xffffffff,
  282. 0x0000922c, 0x00050004, 0xffffffff,
  283. 0x00009238, 0x00010006, 0xffffffff,
  284. 0x0000923c, 0x00090008, 0xffffffff,
  285. 0x00009294, 0x00000000, 0xffffffff,
  286. 0x0000802c, 0x40010000, 0xffffffff,
  287. 0x0000915c, 0x00010000, 0xffffffff,
  288. 0x00009160, 0x00030002, 0xffffffff,
  289. 0x00009164, 0x00050004, 0xffffffff,
  290. 0x00009168, 0x00070006, 0xffffffff,
  291. 0x00009178, 0x00070000, 0xffffffff,
  292. 0x0000917c, 0x00030002, 0xffffffff,
  293. 0x00009180, 0x00050004, 0xffffffff,
  294. 0x0000918c, 0x00010006, 0xffffffff,
  295. 0x00009190, 0x00090008, 0xffffffff,
  296. 0x00009194, 0x00070000, 0xffffffff,
  297. 0x00009198, 0x00030002, 0xffffffff,
  298. 0x0000919c, 0x00050004, 0xffffffff,
  299. 0x000091a8, 0x00010006, 0xffffffff,
  300. 0x000091ac, 0x00090008, 0xffffffff,
  301. 0x000091b0, 0x00070000, 0xffffffff,
  302. 0x000091b4, 0x00030002, 0xffffffff,
  303. 0x000091b8, 0x00050004, 0xffffffff,
  304. 0x000091c4, 0x00010006, 0xffffffff,
  305. 0x000091c8, 0x00090008, 0xffffffff,
  306. 0x000091cc, 0x00070000, 0xffffffff,
  307. 0x000091d0, 0x00030002, 0xffffffff,
  308. 0x000091d4, 0x00050004, 0xffffffff,
  309. 0x000091e0, 0x00010006, 0xffffffff,
  310. 0x000091e4, 0x00090008, 0xffffffff,
  311. 0x000091e8, 0x00000000, 0xffffffff,
  312. 0x000091ec, 0x00070000, 0xffffffff,
  313. 0x000091f0, 0x00030002, 0xffffffff,
  314. 0x000091f4, 0x00050004, 0xffffffff,
  315. 0x00009200, 0x00010006, 0xffffffff,
  316. 0x00009204, 0x00090008, 0xffffffff,
  317. 0x00009208, 0x00070000, 0xffffffff,
  318. 0x0000920c, 0x00030002, 0xffffffff,
  319. 0x00009210, 0x00050004, 0xffffffff,
  320. 0x0000921c, 0x00010006, 0xffffffff,
  321. 0x00009220, 0x00090008, 0xffffffff,
  322. 0x00009224, 0x00070000, 0xffffffff,
  323. 0x00009228, 0x00030002, 0xffffffff,
  324. 0x0000922c, 0x00050004, 0xffffffff,
  325. 0x00009238, 0x00010006, 0xffffffff,
  326. 0x0000923c, 0x00090008, 0xffffffff,
  327. 0x00009294, 0x00000000, 0xffffffff,
  328. 0x0000802c, 0xc0000000, 0xffffffff,
  329. 0x000008f8, 0x00000010, 0xffffffff,
  330. 0x000008fc, 0x00000000, 0xffffffff,
  331. 0x000008f8, 0x00000011, 0xffffffff,
  332. 0x000008fc, 0x00000000, 0xffffffff,
  333. 0x000008f8, 0x00000012, 0xffffffff,
  334. 0x000008fc, 0x00000000, 0xffffffff,
  335. 0x000008f8, 0x00000013, 0xffffffff,
  336. 0x000008fc, 0x00000000, 0xffffffff,
  337. 0x000008f8, 0x00000014, 0xffffffff,
  338. 0x000008fc, 0x00000000, 0xffffffff,
  339. 0x000008f8, 0x00000015, 0xffffffff,
  340. 0x000008fc, 0x00000000, 0xffffffff,
  341. 0x000008f8, 0x00000016, 0xffffffff,
  342. 0x000008fc, 0x00000000, 0xffffffff,
  343. 0x000008f8, 0x00000017, 0xffffffff,
  344. 0x000008fc, 0x00000000, 0xffffffff,
  345. 0x000008f8, 0x00000018, 0xffffffff,
  346. 0x000008fc, 0x00000000, 0xffffffff,
  347. 0x000008f8, 0x00000019, 0xffffffff,
  348. 0x000008fc, 0x00000000, 0xffffffff,
  349. 0x000008f8, 0x0000001a, 0xffffffff,
  350. 0x000008fc, 0x00000000, 0xffffffff,
  351. 0x000008f8, 0x0000001b, 0xffffffff,
  352. 0x000008fc, 0x00000000, 0xffffffff
  353. };
  354. #define BARTS_MGCG_DEFAULT_LENGTH sizeof(barts_mgcg_default) / (3 * sizeof(u32))
  355. static const u32 barts_mgcg_disable[] =
  356. {
  357. 0x0000802c, 0xc0000000, 0xffffffff,
  358. 0x000008f8, 0x00000000, 0xffffffff,
  359. 0x000008fc, 0xffffffff, 0xffffffff,
  360. 0x000008f8, 0x00000001, 0xffffffff,
  361. 0x000008fc, 0xffffffff, 0xffffffff,
  362. 0x000008f8, 0x00000002, 0xffffffff,
  363. 0x000008fc, 0xffffffff, 0xffffffff,
  364. 0x000008f8, 0x00000003, 0xffffffff,
  365. 0x000008fc, 0xffffffff, 0xffffffff,
  366. 0x00009150, 0x00600000, 0xffffffff
  367. };
  368. #define BARTS_MGCG_DISABLE_LENGTH sizeof(barts_mgcg_disable) / (3 * sizeof(u32))
  369. static const u32 barts_mgcg_enable[] =
  370. {
  371. 0x0000802c, 0xc0000000, 0xffffffff,
  372. 0x000008f8, 0x00000000, 0xffffffff,
  373. 0x000008fc, 0x00000000, 0xffffffff,
  374. 0x000008f8, 0x00000001, 0xffffffff,
  375. 0x000008fc, 0x00000000, 0xffffffff,
  376. 0x000008f8, 0x00000002, 0xffffffff,
  377. 0x000008fc, 0x00000000, 0xffffffff,
  378. 0x000008f8, 0x00000003, 0xffffffff,
  379. 0x000008fc, 0x00000000, 0xffffffff,
  380. 0x00009150, 0x81944000, 0xffffffff
  381. };
  382. #define BARTS_MGCG_ENABLE_LENGTH sizeof(barts_mgcg_enable) / (3 * sizeof(u32))
  383. //********* CAICOS **************//
  384. static const u32 caicos_cgcg_cgls_default[] =
  385. {
  386. 0x000008f8, 0x00000010, 0xffffffff,
  387. 0x000008fc, 0x00000000, 0xffffffff,
  388. 0x000008f8, 0x00000011, 0xffffffff,
  389. 0x000008fc, 0x00000000, 0xffffffff,
  390. 0x000008f8, 0x00000012, 0xffffffff,
  391. 0x000008fc, 0x00000000, 0xffffffff,
  392. 0x000008f8, 0x00000013, 0xffffffff,
  393. 0x000008fc, 0x00000000, 0xffffffff,
  394. 0x000008f8, 0x00000014, 0xffffffff,
  395. 0x000008fc, 0x00000000, 0xffffffff,
  396. 0x000008f8, 0x00000015, 0xffffffff,
  397. 0x000008fc, 0x00000000, 0xffffffff,
  398. 0x000008f8, 0x00000016, 0xffffffff,
  399. 0x000008fc, 0x00000000, 0xffffffff,
  400. 0x000008f8, 0x00000017, 0xffffffff,
  401. 0x000008fc, 0x00000000, 0xffffffff,
  402. 0x000008f8, 0x00000018, 0xffffffff,
  403. 0x000008fc, 0x00000000, 0xffffffff,
  404. 0x000008f8, 0x00000019, 0xffffffff,
  405. 0x000008fc, 0x00000000, 0xffffffff,
  406. 0x000008f8, 0x0000001a, 0xffffffff,
  407. 0x000008fc, 0x00000000, 0xffffffff,
  408. 0x000008f8, 0x0000001b, 0xffffffff,
  409. 0x000008fc, 0x00000000, 0xffffffff,
  410. 0x000008f8, 0x00000020, 0xffffffff,
  411. 0x000008fc, 0x00000000, 0xffffffff,
  412. 0x000008f8, 0x00000021, 0xffffffff,
  413. 0x000008fc, 0x00000000, 0xffffffff,
  414. 0x000008f8, 0x00000022, 0xffffffff,
  415. 0x000008fc, 0x00000000, 0xffffffff,
  416. 0x000008f8, 0x00000023, 0xffffffff,
  417. 0x000008fc, 0x00000000, 0xffffffff,
  418. 0x000008f8, 0x00000024, 0xffffffff,
  419. 0x000008fc, 0x00000000, 0xffffffff,
  420. 0x000008f8, 0x00000025, 0xffffffff,
  421. 0x000008fc, 0x00000000, 0xffffffff,
  422. 0x000008f8, 0x00000026, 0xffffffff,
  423. 0x000008fc, 0x00000000, 0xffffffff,
  424. 0x000008f8, 0x00000027, 0xffffffff,
  425. 0x000008fc, 0x00000000, 0xffffffff,
  426. 0x000008f8, 0x00000028, 0xffffffff,
  427. 0x000008fc, 0x00000000, 0xffffffff,
  428. 0x000008f8, 0x00000029, 0xffffffff,
  429. 0x000008fc, 0x00000000, 0xffffffff,
  430. 0x000008f8, 0x0000002a, 0xffffffff,
  431. 0x000008fc, 0x00000000, 0xffffffff,
  432. 0x000008f8, 0x0000002b, 0xffffffff,
  433. 0x000008fc, 0x00000000, 0xffffffff
  434. };
  435. #define CAICOS_CGCG_CGLS_DEFAULT_LENGTH sizeof(caicos_cgcg_cgls_default) / (3 * sizeof(u32))
  436. static const u32 caicos_cgcg_cgls_disable[] =
  437. {
  438. 0x000008f8, 0x00000010, 0xffffffff,
  439. 0x000008fc, 0xffffffff, 0xffffffff,
  440. 0x000008f8, 0x00000011, 0xffffffff,
  441. 0x000008fc, 0xffffffff, 0xffffffff,
  442. 0x000008f8, 0x00000012, 0xffffffff,
  443. 0x000008fc, 0xffffffff, 0xffffffff,
  444. 0x000008f8, 0x00000013, 0xffffffff,
  445. 0x000008fc, 0xffffffff, 0xffffffff,
  446. 0x000008f8, 0x00000014, 0xffffffff,
  447. 0x000008fc, 0xffffffff, 0xffffffff,
  448. 0x000008f8, 0x00000015, 0xffffffff,
  449. 0x000008fc, 0xffffffff, 0xffffffff,
  450. 0x000008f8, 0x00000016, 0xffffffff,
  451. 0x000008fc, 0xffffffff, 0xffffffff,
  452. 0x000008f8, 0x00000017, 0xffffffff,
  453. 0x000008fc, 0xffffffff, 0xffffffff,
  454. 0x000008f8, 0x00000018, 0xffffffff,
  455. 0x000008fc, 0xffffffff, 0xffffffff,
  456. 0x000008f8, 0x00000019, 0xffffffff,
  457. 0x000008fc, 0xffffffff, 0xffffffff,
  458. 0x000008f8, 0x0000001a, 0xffffffff,
  459. 0x000008fc, 0xffffffff, 0xffffffff,
  460. 0x000008f8, 0x0000001b, 0xffffffff,
  461. 0x000008fc, 0xffffffff, 0xffffffff,
  462. 0x000008f8, 0x00000020, 0xffffffff,
  463. 0x000008fc, 0x00000000, 0xffffffff,
  464. 0x000008f8, 0x00000021, 0xffffffff,
  465. 0x000008fc, 0x00000000, 0xffffffff,
  466. 0x000008f8, 0x00000022, 0xffffffff,
  467. 0x000008fc, 0x00000000, 0xffffffff,
  468. 0x000008f8, 0x00000023, 0xffffffff,
  469. 0x000008fc, 0x00000000, 0xffffffff,
  470. 0x000008f8, 0x00000024, 0xffffffff,
  471. 0x000008fc, 0x00000000, 0xffffffff,
  472. 0x000008f8, 0x00000025, 0xffffffff,
  473. 0x000008fc, 0x00000000, 0xffffffff,
  474. 0x000008f8, 0x00000026, 0xffffffff,
  475. 0x000008fc, 0x00000000, 0xffffffff,
  476. 0x000008f8, 0x00000027, 0xffffffff,
  477. 0x000008fc, 0x00000000, 0xffffffff,
  478. 0x000008f8, 0x00000028, 0xffffffff,
  479. 0x000008fc, 0x00000000, 0xffffffff,
  480. 0x000008f8, 0x00000029, 0xffffffff,
  481. 0x000008fc, 0x00000000, 0xffffffff,
  482. 0x000008f8, 0x0000002a, 0xffffffff,
  483. 0x000008fc, 0x00000000, 0xffffffff,
  484. 0x000008f8, 0x0000002b, 0xffffffff,
  485. 0x000008fc, 0x00000000, 0xffffffff,
  486. 0x00000644, 0x000f7912, 0x001f4180,
  487. 0x00000644, 0x000f3812, 0x001f4180
  488. };
  489. #define CAICOS_CGCG_CGLS_DISABLE_LENGTH sizeof(caicos_cgcg_cgls_disable) / (3 * sizeof(u32))
  490. static const u32 caicos_cgcg_cgls_enable[] =
  491. {
  492. /* 0x0000c124, 0x84180000, 0x00180000, */
  493. 0x00000644, 0x000f7892, 0x001f4080,
  494. 0x000008f8, 0x00000010, 0xffffffff,
  495. 0x000008fc, 0x00000000, 0xffffffff,
  496. 0x000008f8, 0x00000011, 0xffffffff,
  497. 0x000008fc, 0x00000000, 0xffffffff,
  498. 0x000008f8, 0x00000012, 0xffffffff,
  499. 0x000008fc, 0x00000000, 0xffffffff,
  500. 0x000008f8, 0x00000013, 0xffffffff,
  501. 0x000008fc, 0x00000000, 0xffffffff,
  502. 0x000008f8, 0x00000014, 0xffffffff,
  503. 0x000008fc, 0x00000000, 0xffffffff,
  504. 0x000008f8, 0x00000015, 0xffffffff,
  505. 0x000008fc, 0x00000000, 0xffffffff,
  506. 0x000008f8, 0x00000016, 0xffffffff,
  507. 0x000008fc, 0x00000000, 0xffffffff,
  508. 0x000008f8, 0x00000017, 0xffffffff,
  509. 0x000008fc, 0x00000000, 0xffffffff,
  510. 0x000008f8, 0x00000018, 0xffffffff,
  511. 0x000008fc, 0x00000000, 0xffffffff,
  512. 0x000008f8, 0x00000019, 0xffffffff,
  513. 0x000008fc, 0x00000000, 0xffffffff,
  514. 0x000008f8, 0x0000001a, 0xffffffff,
  515. 0x000008fc, 0x00000000, 0xffffffff,
  516. 0x000008f8, 0x0000001b, 0xffffffff,
  517. 0x000008fc, 0x00000000, 0xffffffff,
  518. 0x000008f8, 0x00000020, 0xffffffff,
  519. 0x000008fc, 0xffffffff, 0xffffffff,
  520. 0x000008f8, 0x00000021, 0xffffffff,
  521. 0x000008fc, 0xffffffff, 0xffffffff,
  522. 0x000008f8, 0x00000022, 0xffffffff,
  523. 0x000008fc, 0xffffffff, 0xffffffff,
  524. 0x000008f8, 0x00000023, 0xffffffff,
  525. 0x000008fc, 0xffffffff, 0xffffffff,
  526. 0x000008f8, 0x00000024, 0xffffffff,
  527. 0x000008fc, 0xffffffff, 0xffffffff,
  528. 0x000008f8, 0x00000025, 0xffffffff,
  529. 0x000008fc, 0xffffffff, 0xffffffff,
  530. 0x000008f8, 0x00000026, 0xffffffff,
  531. 0x000008fc, 0xffffffff, 0xffffffff,
  532. 0x000008f8, 0x00000027, 0xffffffff,
  533. 0x000008fc, 0xffffffff, 0xffffffff,
  534. 0x000008f8, 0x00000028, 0xffffffff,
  535. 0x000008fc, 0xffffffff, 0xffffffff,
  536. 0x000008f8, 0x00000029, 0xffffffff,
  537. 0x000008fc, 0xffffffff, 0xffffffff,
  538. 0x000008f8, 0x0000002a, 0xffffffff,
  539. 0x000008fc, 0xffffffff, 0xffffffff,
  540. 0x000008f8, 0x0000002b, 0xffffffff,
  541. 0x000008fc, 0xffffffff, 0xffffffff
  542. };
  543. #define CAICOS_CGCG_CGLS_ENABLE_LENGTH sizeof(caicos_cgcg_cgls_enable) / (3 * sizeof(u32))
  544. static const u32 caicos_mgcg_default[] =
  545. {
  546. 0x0000802c, 0xc0000000, 0xffffffff,
  547. 0x00005448, 0x00000100, 0xffffffff,
  548. 0x000055e4, 0x00600100, 0xffffffff,
  549. 0x0000160c, 0x00000100, 0xffffffff,
  550. 0x0000c164, 0x00000100, 0xffffffff,
  551. 0x00008a18, 0x00000100, 0xffffffff,
  552. 0x0000897c, 0x06000100, 0xffffffff,
  553. 0x00008b28, 0x00000100, 0xffffffff,
  554. 0x00009144, 0x00000100, 0xffffffff,
  555. 0x00009a60, 0x00000100, 0xffffffff,
  556. 0x00009868, 0x00000100, 0xffffffff,
  557. 0x00008d58, 0x00000100, 0xffffffff,
  558. 0x00009510, 0x00000100, 0xffffffff,
  559. 0x0000949c, 0x00000100, 0xffffffff,
  560. 0x00009654, 0x00000100, 0xffffffff,
  561. 0x00009030, 0x00000100, 0xffffffff,
  562. 0x00009034, 0x00000100, 0xffffffff,
  563. 0x00009038, 0x00000100, 0xffffffff,
  564. 0x0000903c, 0x00000100, 0xffffffff,
  565. 0x00009040, 0x00000100, 0xffffffff,
  566. 0x0000a200, 0x00000100, 0xffffffff,
  567. 0x0000a204, 0x00000100, 0xffffffff,
  568. 0x0000a208, 0x00000100, 0xffffffff,
  569. 0x0000a20c, 0x00000100, 0xffffffff,
  570. 0x0000977c, 0x00000100, 0xffffffff,
  571. 0x00003f80, 0x00000100, 0xffffffff,
  572. 0x0000a210, 0x00000100, 0xffffffff,
  573. 0x0000a214, 0x00000100, 0xffffffff,
  574. 0x000004d8, 0x00000100, 0xffffffff,
  575. 0x00009784, 0x00000100, 0xffffffff,
  576. 0x00009698, 0x00000100, 0xffffffff,
  577. 0x000004d4, 0x00000200, 0xffffffff,
  578. 0x000004d0, 0x00000000, 0xffffffff,
  579. 0x000030cc, 0x00000100, 0xffffffff,
  580. 0x0000d0c0, 0xff000100, 0xffffffff,
  581. 0x0000915c, 0x00010000, 0xffffffff,
  582. 0x00009160, 0x00030002, 0xffffffff,
  583. 0x00009164, 0x00050004, 0xffffffff,
  584. 0x00009168, 0x00070006, 0xffffffff,
  585. 0x00009178, 0x00070000, 0xffffffff,
  586. 0x0000917c, 0x00030002, 0xffffffff,
  587. 0x00009180, 0x00050004, 0xffffffff,
  588. 0x0000918c, 0x00010006, 0xffffffff,
  589. 0x00009190, 0x00090008, 0xffffffff,
  590. 0x00009194, 0x00070000, 0xffffffff,
  591. 0x00009198, 0x00030002, 0xffffffff,
  592. 0x0000919c, 0x00050004, 0xffffffff,
  593. 0x000091a8, 0x00010006, 0xffffffff,
  594. 0x000091ac, 0x00090008, 0xffffffff,
  595. 0x000091e8, 0x00000000, 0xffffffff,
  596. 0x00009294, 0x00000000, 0xffffffff,
  597. 0x000008f8, 0x00000010, 0xffffffff,
  598. 0x000008fc, 0x00000000, 0xffffffff,
  599. 0x000008f8, 0x00000011, 0xffffffff,
  600. 0x000008fc, 0x00000000, 0xffffffff,
  601. 0x000008f8, 0x00000012, 0xffffffff,
  602. 0x000008fc, 0x00000000, 0xffffffff,
  603. 0x000008f8, 0x00000013, 0xffffffff,
  604. 0x000008fc, 0x00000000, 0xffffffff,
  605. 0x000008f8, 0x00000014, 0xffffffff,
  606. 0x000008fc, 0x00000000, 0xffffffff,
  607. 0x000008f8, 0x00000015, 0xffffffff,
  608. 0x000008fc, 0x00000000, 0xffffffff,
  609. 0x000008f8, 0x00000016, 0xffffffff,
  610. 0x000008fc, 0x00000000, 0xffffffff,
  611. 0x000008f8, 0x00000017, 0xffffffff,
  612. 0x000008fc, 0x00000000, 0xffffffff,
  613. 0x000008f8, 0x00000018, 0xffffffff,
  614. 0x000008fc, 0x00000000, 0xffffffff,
  615. 0x000008f8, 0x00000019, 0xffffffff,
  616. 0x000008fc, 0x00000000, 0xffffffff,
  617. 0x000008f8, 0x0000001a, 0xffffffff,
  618. 0x000008fc, 0x00000000, 0xffffffff,
  619. 0x000008f8, 0x0000001b, 0xffffffff,
  620. 0x000008fc, 0x00000000, 0xffffffff
  621. };
  622. #define CAICOS_MGCG_DEFAULT_LENGTH sizeof(caicos_mgcg_default) / (3 * sizeof(u32))
  623. static const u32 caicos_mgcg_disable[] =
  624. {
  625. 0x0000802c, 0xc0000000, 0xffffffff,
  626. 0x000008f8, 0x00000000, 0xffffffff,
  627. 0x000008fc, 0xffffffff, 0xffffffff,
  628. 0x000008f8, 0x00000001, 0xffffffff,
  629. 0x000008fc, 0xffffffff, 0xffffffff,
  630. 0x000008f8, 0x00000002, 0xffffffff,
  631. 0x000008fc, 0xffffffff, 0xffffffff,
  632. 0x000008f8, 0x00000003, 0xffffffff,
  633. 0x000008fc, 0xffffffff, 0xffffffff,
  634. 0x00009150, 0x00600000, 0xffffffff
  635. };
  636. #define CAICOS_MGCG_DISABLE_LENGTH sizeof(caicos_mgcg_disable) / (3 * sizeof(u32))
  637. static const u32 caicos_mgcg_enable[] =
  638. {
  639. 0x0000802c, 0xc0000000, 0xffffffff,
  640. 0x000008f8, 0x00000000, 0xffffffff,
  641. 0x000008fc, 0x00000000, 0xffffffff,
  642. 0x000008f8, 0x00000001, 0xffffffff,
  643. 0x000008fc, 0x00000000, 0xffffffff,
  644. 0x000008f8, 0x00000002, 0xffffffff,
  645. 0x000008fc, 0x00000000, 0xffffffff,
  646. 0x000008f8, 0x00000003, 0xffffffff,
  647. 0x000008fc, 0x00000000, 0xffffffff,
  648. 0x00009150, 0x46944040, 0xffffffff
  649. };
  650. #define CAICOS_MGCG_ENABLE_LENGTH sizeof(caicos_mgcg_enable) / (3 * sizeof(u32))
  651. //********* TURKS **************//
  652. static const u32 turks_cgcg_cgls_default[] =
  653. {
  654. 0x000008f8, 0x00000010, 0xffffffff,
  655. 0x000008fc, 0x00000000, 0xffffffff,
  656. 0x000008f8, 0x00000011, 0xffffffff,
  657. 0x000008fc, 0x00000000, 0xffffffff,
  658. 0x000008f8, 0x00000012, 0xffffffff,
  659. 0x000008fc, 0x00000000, 0xffffffff,
  660. 0x000008f8, 0x00000013, 0xffffffff,
  661. 0x000008fc, 0x00000000, 0xffffffff,
  662. 0x000008f8, 0x00000014, 0xffffffff,
  663. 0x000008fc, 0x00000000, 0xffffffff,
  664. 0x000008f8, 0x00000015, 0xffffffff,
  665. 0x000008fc, 0x00000000, 0xffffffff,
  666. 0x000008f8, 0x00000016, 0xffffffff,
  667. 0x000008fc, 0x00000000, 0xffffffff,
  668. 0x000008f8, 0x00000017, 0xffffffff,
  669. 0x000008fc, 0x00000000, 0xffffffff,
  670. 0x000008f8, 0x00000018, 0xffffffff,
  671. 0x000008fc, 0x00000000, 0xffffffff,
  672. 0x000008f8, 0x00000019, 0xffffffff,
  673. 0x000008fc, 0x00000000, 0xffffffff,
  674. 0x000008f8, 0x0000001a, 0xffffffff,
  675. 0x000008fc, 0x00000000, 0xffffffff,
  676. 0x000008f8, 0x0000001b, 0xffffffff,
  677. 0x000008fc, 0x00000000, 0xffffffff,
  678. 0x000008f8, 0x00000020, 0xffffffff,
  679. 0x000008fc, 0x00000000, 0xffffffff,
  680. 0x000008f8, 0x00000021, 0xffffffff,
  681. 0x000008fc, 0x00000000, 0xffffffff,
  682. 0x000008f8, 0x00000022, 0xffffffff,
  683. 0x000008fc, 0x00000000, 0xffffffff,
  684. 0x000008f8, 0x00000023, 0xffffffff,
  685. 0x000008fc, 0x00000000, 0xffffffff,
  686. 0x000008f8, 0x00000024, 0xffffffff,
  687. 0x000008fc, 0x00000000, 0xffffffff,
  688. 0x000008f8, 0x00000025, 0xffffffff,
  689. 0x000008fc, 0x00000000, 0xffffffff,
  690. 0x000008f8, 0x00000026, 0xffffffff,
  691. 0x000008fc, 0x00000000, 0xffffffff,
  692. 0x000008f8, 0x00000027, 0xffffffff,
  693. 0x000008fc, 0x00000000, 0xffffffff,
  694. 0x000008f8, 0x00000028, 0xffffffff,
  695. 0x000008fc, 0x00000000, 0xffffffff,
  696. 0x000008f8, 0x00000029, 0xffffffff,
  697. 0x000008fc, 0x00000000, 0xffffffff,
  698. 0x000008f8, 0x0000002a, 0xffffffff,
  699. 0x000008fc, 0x00000000, 0xffffffff,
  700. 0x000008f8, 0x0000002b, 0xffffffff,
  701. 0x000008fc, 0x00000000, 0xffffffff
  702. };
  703. #define TURKS_CGCG_CGLS_DEFAULT_LENGTH sizeof(turks_cgcg_cgls_default) / (3 * sizeof(u32))
  704. static const u32 turks_cgcg_cgls_disable[] =
  705. {
  706. 0x000008f8, 0x00000010, 0xffffffff,
  707. 0x000008fc, 0xffffffff, 0xffffffff,
  708. 0x000008f8, 0x00000011, 0xffffffff,
  709. 0x000008fc, 0xffffffff, 0xffffffff,
  710. 0x000008f8, 0x00000012, 0xffffffff,
  711. 0x000008fc, 0xffffffff, 0xffffffff,
  712. 0x000008f8, 0x00000013, 0xffffffff,
  713. 0x000008fc, 0xffffffff, 0xffffffff,
  714. 0x000008f8, 0x00000014, 0xffffffff,
  715. 0x000008fc, 0xffffffff, 0xffffffff,
  716. 0x000008f8, 0x00000015, 0xffffffff,
  717. 0x000008fc, 0xffffffff, 0xffffffff,
  718. 0x000008f8, 0x00000016, 0xffffffff,
  719. 0x000008fc, 0xffffffff, 0xffffffff,
  720. 0x000008f8, 0x00000017, 0xffffffff,
  721. 0x000008fc, 0xffffffff, 0xffffffff,
  722. 0x000008f8, 0x00000018, 0xffffffff,
  723. 0x000008fc, 0xffffffff, 0xffffffff,
  724. 0x000008f8, 0x00000019, 0xffffffff,
  725. 0x000008fc, 0xffffffff, 0xffffffff,
  726. 0x000008f8, 0x0000001a, 0xffffffff,
  727. 0x000008fc, 0xffffffff, 0xffffffff,
  728. 0x000008f8, 0x0000001b, 0xffffffff,
  729. 0x000008fc, 0xffffffff, 0xffffffff,
  730. 0x000008f8, 0x00000020, 0xffffffff,
  731. 0x000008fc, 0x00000000, 0xffffffff,
  732. 0x000008f8, 0x00000021, 0xffffffff,
  733. 0x000008fc, 0x00000000, 0xffffffff,
  734. 0x000008f8, 0x00000022, 0xffffffff,
  735. 0x000008fc, 0x00000000, 0xffffffff,
  736. 0x000008f8, 0x00000023, 0xffffffff,
  737. 0x000008fc, 0x00000000, 0xffffffff,
  738. 0x000008f8, 0x00000024, 0xffffffff,
  739. 0x000008fc, 0x00000000, 0xffffffff,
  740. 0x000008f8, 0x00000025, 0xffffffff,
  741. 0x000008fc, 0x00000000, 0xffffffff,
  742. 0x000008f8, 0x00000026, 0xffffffff,
  743. 0x000008fc, 0x00000000, 0xffffffff,
  744. 0x000008f8, 0x00000027, 0xffffffff,
  745. 0x000008fc, 0x00000000, 0xffffffff,
  746. 0x000008f8, 0x00000028, 0xffffffff,
  747. 0x000008fc, 0x00000000, 0xffffffff,
  748. 0x000008f8, 0x00000029, 0xffffffff,
  749. 0x000008fc, 0x00000000, 0xffffffff,
  750. 0x000008f8, 0x0000002a, 0xffffffff,
  751. 0x000008fc, 0x00000000, 0xffffffff,
  752. 0x000008f8, 0x0000002b, 0xffffffff,
  753. 0x000008fc, 0x00000000, 0xffffffff,
  754. 0x00000644, 0x000f7912, 0x001f4180,
  755. 0x00000644, 0x000f3812, 0x001f4180
  756. };
  757. #define TURKS_CGCG_CGLS_DISABLE_LENGTH sizeof(turks_cgcg_cgls_disable) / (3 * sizeof(u32))
  758. static const u32 turks_cgcg_cgls_enable[] =
  759. {
  760. /* 0x0000c124, 0x84180000, 0x00180000, */
  761. 0x00000644, 0x000f7892, 0x001f4080,
  762. 0x000008f8, 0x00000010, 0xffffffff,
  763. 0x000008fc, 0x00000000, 0xffffffff,
  764. 0x000008f8, 0x00000011, 0xffffffff,
  765. 0x000008fc, 0x00000000, 0xffffffff,
  766. 0x000008f8, 0x00000012, 0xffffffff,
  767. 0x000008fc, 0x00000000, 0xffffffff,
  768. 0x000008f8, 0x00000013, 0xffffffff,
  769. 0x000008fc, 0x00000000, 0xffffffff,
  770. 0x000008f8, 0x00000014, 0xffffffff,
  771. 0x000008fc, 0x00000000, 0xffffffff,
  772. 0x000008f8, 0x00000015, 0xffffffff,
  773. 0x000008fc, 0x00000000, 0xffffffff,
  774. 0x000008f8, 0x00000016, 0xffffffff,
  775. 0x000008fc, 0x00000000, 0xffffffff,
  776. 0x000008f8, 0x00000017, 0xffffffff,
  777. 0x000008fc, 0x00000000, 0xffffffff,
  778. 0x000008f8, 0x00000018, 0xffffffff,
  779. 0x000008fc, 0x00000000, 0xffffffff,
  780. 0x000008f8, 0x00000019, 0xffffffff,
  781. 0x000008fc, 0x00000000, 0xffffffff,
  782. 0x000008f8, 0x0000001a, 0xffffffff,
  783. 0x000008fc, 0x00000000, 0xffffffff,
  784. 0x000008f8, 0x0000001b, 0xffffffff,
  785. 0x000008fc, 0x00000000, 0xffffffff,
  786. 0x000008f8, 0x00000020, 0xffffffff,
  787. 0x000008fc, 0xffffffff, 0xffffffff,
  788. 0x000008f8, 0x00000021, 0xffffffff,
  789. 0x000008fc, 0xffffffff, 0xffffffff,
  790. 0x000008f8, 0x00000022, 0xffffffff,
  791. 0x000008fc, 0xffffffff, 0xffffffff,
  792. 0x000008f8, 0x00000023, 0xffffffff,
  793. 0x000008fc, 0xffffffff, 0xffffffff,
  794. 0x000008f8, 0x00000024, 0xffffffff,
  795. 0x000008fc, 0xffffffff, 0xffffffff,
  796. 0x000008f8, 0x00000025, 0xffffffff,
  797. 0x000008fc, 0xffffffff, 0xffffffff,
  798. 0x000008f8, 0x00000026, 0xffffffff,
  799. 0x000008fc, 0xffffffff, 0xffffffff,
  800. 0x000008f8, 0x00000027, 0xffffffff,
  801. 0x000008fc, 0xffffffff, 0xffffffff,
  802. 0x000008f8, 0x00000028, 0xffffffff,
  803. 0x000008fc, 0xffffffff, 0xffffffff,
  804. 0x000008f8, 0x00000029, 0xffffffff,
  805. 0x000008fc, 0xffffffff, 0xffffffff,
  806. 0x000008f8, 0x0000002a, 0xffffffff,
  807. 0x000008fc, 0xffffffff, 0xffffffff,
  808. 0x000008f8, 0x0000002b, 0xffffffff,
  809. 0x000008fc, 0xffffffff, 0xffffffff
  810. };
  811. #define TURKS_CGCG_CGLS_ENABLE_LENGTH sizeof(turks_cgcg_cgls_enable) / (3 * sizeof(u32))
  812. // These are the sequences for turks_mgcg_shls
  813. static const u32 turks_mgcg_default[] =
  814. {
  815. 0x0000802c, 0xc0000000, 0xffffffff,
  816. 0x00005448, 0x00000100, 0xffffffff,
  817. 0x000055e4, 0x00600100, 0xffffffff,
  818. 0x0000160c, 0x00000100, 0xffffffff,
  819. 0x0000c164, 0x00000100, 0xffffffff,
  820. 0x00008a18, 0x00000100, 0xffffffff,
  821. 0x0000897c, 0x06000100, 0xffffffff,
  822. 0x00008b28, 0x00000100, 0xffffffff,
  823. 0x00009144, 0x00000100, 0xffffffff,
  824. 0x00009a60, 0x00000100, 0xffffffff,
  825. 0x00009868, 0x00000100, 0xffffffff,
  826. 0x00008d58, 0x00000100, 0xffffffff,
  827. 0x00009510, 0x00000100, 0xffffffff,
  828. 0x0000949c, 0x00000100, 0xffffffff,
  829. 0x00009654, 0x00000100, 0xffffffff,
  830. 0x00009030, 0x00000100, 0xffffffff,
  831. 0x00009034, 0x00000100, 0xffffffff,
  832. 0x00009038, 0x00000100, 0xffffffff,
  833. 0x0000903c, 0x00000100, 0xffffffff,
  834. 0x00009040, 0x00000100, 0xffffffff,
  835. 0x0000a200, 0x00000100, 0xffffffff,
  836. 0x0000a204, 0x00000100, 0xffffffff,
  837. 0x0000a208, 0x00000100, 0xffffffff,
  838. 0x0000a20c, 0x00000100, 0xffffffff,
  839. 0x0000977c, 0x00000100, 0xffffffff,
  840. 0x00003f80, 0x00000100, 0xffffffff,
  841. 0x0000a210, 0x00000100, 0xffffffff,
  842. 0x0000a214, 0x00000100, 0xffffffff,
  843. 0x000004d8, 0x00000100, 0xffffffff,
  844. 0x00009784, 0x00000100, 0xffffffff,
  845. 0x00009698, 0x00000100, 0xffffffff,
  846. 0x000004d4, 0x00000200, 0xffffffff,
  847. 0x000004d0, 0x00000000, 0xffffffff,
  848. 0x000030cc, 0x00000100, 0xffffffff,
  849. 0x0000d0c0, 0x00000100, 0xffffffff,
  850. 0x0000915c, 0x00010000, 0xffffffff,
  851. 0x00009160, 0x00030002, 0xffffffff,
  852. 0x00009164, 0x00050004, 0xffffffff,
  853. 0x00009168, 0x00070006, 0xffffffff,
  854. 0x00009178, 0x00070000, 0xffffffff,
  855. 0x0000917c, 0x00030002, 0xffffffff,
  856. 0x00009180, 0x00050004, 0xffffffff,
  857. 0x0000918c, 0x00010006, 0xffffffff,
  858. 0x00009190, 0x00090008, 0xffffffff,
  859. 0x00009194, 0x00070000, 0xffffffff,
  860. 0x00009198, 0x00030002, 0xffffffff,
  861. 0x0000919c, 0x00050004, 0xffffffff,
  862. 0x000091a8, 0x00010006, 0xffffffff,
  863. 0x000091ac, 0x00090008, 0xffffffff,
  864. 0x000091b0, 0x00070000, 0xffffffff,
  865. 0x000091b4, 0x00030002, 0xffffffff,
  866. 0x000091b8, 0x00050004, 0xffffffff,
  867. 0x000091c4, 0x00010006, 0xffffffff,
  868. 0x000091c8, 0x00090008, 0xffffffff,
  869. 0x000091cc, 0x00070000, 0xffffffff,
  870. 0x000091d0, 0x00030002, 0xffffffff,
  871. 0x000091d4, 0x00050004, 0xffffffff,
  872. 0x000091e0, 0x00010006, 0xffffffff,
  873. 0x000091e4, 0x00090008, 0xffffffff,
  874. 0x000091e8, 0x00000000, 0xffffffff,
  875. 0x000091ec, 0x00070000, 0xffffffff,
  876. 0x000091f0, 0x00030002, 0xffffffff,
  877. 0x000091f4, 0x00050004, 0xffffffff,
  878. 0x00009200, 0x00010006, 0xffffffff,
  879. 0x00009204, 0x00090008, 0xffffffff,
  880. 0x00009208, 0x00070000, 0xffffffff,
  881. 0x0000920c, 0x00030002, 0xffffffff,
  882. 0x00009210, 0x00050004, 0xffffffff,
  883. 0x0000921c, 0x00010006, 0xffffffff,
  884. 0x00009220, 0x00090008, 0xffffffff,
  885. 0x00009294, 0x00000000, 0xffffffff,
  886. 0x000008f8, 0x00000010, 0xffffffff,
  887. 0x000008fc, 0x00000000, 0xffffffff,
  888. 0x000008f8, 0x00000011, 0xffffffff,
  889. 0x000008fc, 0x00000000, 0xffffffff,
  890. 0x000008f8, 0x00000012, 0xffffffff,
  891. 0x000008fc, 0x00000000, 0xffffffff,
  892. 0x000008f8, 0x00000013, 0xffffffff,
  893. 0x000008fc, 0x00000000, 0xffffffff,
  894. 0x000008f8, 0x00000014, 0xffffffff,
  895. 0x000008fc, 0x00000000, 0xffffffff,
  896. 0x000008f8, 0x00000015, 0xffffffff,
  897. 0x000008fc, 0x00000000, 0xffffffff,
  898. 0x000008f8, 0x00000016, 0xffffffff,
  899. 0x000008fc, 0x00000000, 0xffffffff,
  900. 0x000008f8, 0x00000017, 0xffffffff,
  901. 0x000008fc, 0x00000000, 0xffffffff,
  902. 0x000008f8, 0x00000018, 0xffffffff,
  903. 0x000008fc, 0x00000000, 0xffffffff,
  904. 0x000008f8, 0x00000019, 0xffffffff,
  905. 0x000008fc, 0x00000000, 0xffffffff,
  906. 0x000008f8, 0x0000001a, 0xffffffff,
  907. 0x000008fc, 0x00000000, 0xffffffff,
  908. 0x000008f8, 0x0000001b, 0xffffffff,
  909. 0x000008fc, 0x00000000, 0xffffffff
  910. };
  911. #define TURKS_MGCG_DEFAULT_LENGTH sizeof(turks_mgcg_default) / (3 * sizeof(u32))
  912. static const u32 turks_mgcg_disable[] =
  913. {
  914. 0x0000802c, 0xc0000000, 0xffffffff,
  915. 0x000008f8, 0x00000000, 0xffffffff,
  916. 0x000008fc, 0xffffffff, 0xffffffff,
  917. 0x000008f8, 0x00000001, 0xffffffff,
  918. 0x000008fc, 0xffffffff, 0xffffffff,
  919. 0x000008f8, 0x00000002, 0xffffffff,
  920. 0x000008fc, 0xffffffff, 0xffffffff,
  921. 0x000008f8, 0x00000003, 0xffffffff,
  922. 0x000008fc, 0xffffffff, 0xffffffff,
  923. 0x00009150, 0x00600000, 0xffffffff
  924. };
  925. #define TURKS_MGCG_DISABLE_LENGTH sizeof(turks_mgcg_disable) / (3 * sizeof(u32))
  926. static const u32 turks_mgcg_enable[] =
  927. {
  928. 0x0000802c, 0xc0000000, 0xffffffff,
  929. 0x000008f8, 0x00000000, 0xffffffff,
  930. 0x000008fc, 0x00000000, 0xffffffff,
  931. 0x000008f8, 0x00000001, 0xffffffff,
  932. 0x000008fc, 0x00000000, 0xffffffff,
  933. 0x000008f8, 0x00000002, 0xffffffff,
  934. 0x000008fc, 0x00000000, 0xffffffff,
  935. 0x000008f8, 0x00000003, 0xffffffff,
  936. 0x000008fc, 0x00000000, 0xffffffff,
  937. 0x00009150, 0x6e944000, 0xffffffff
  938. };
  939. #define TURKS_MGCG_ENABLE_LENGTH sizeof(turks_mgcg_enable) / (3 * sizeof(u32))
  940. #endif
  941. #ifndef BTC_SYSLS_SEQUENCE
  942. #define BTC_SYSLS_SEQUENCE 100
  943. //********* BARTS **************//
  944. static const u32 barts_sysls_default[] =
  945. {
  946. /* Register, Value, Mask bits */
  947. 0x000055e8, 0x00000000, 0xffffffff,
  948. 0x0000d0bc, 0x00000000, 0xffffffff,
  949. 0x000015c0, 0x000c1401, 0xffffffff,
  950. 0x0000264c, 0x000c0400, 0xffffffff,
  951. 0x00002648, 0x000c0400, 0xffffffff,
  952. 0x00002650, 0x000c0400, 0xffffffff,
  953. 0x000020b8, 0x000c0400, 0xffffffff,
  954. 0x000020bc, 0x000c0400, 0xffffffff,
  955. 0x000020c0, 0x000c0c80, 0xffffffff,
  956. 0x0000f4a0, 0x000000c0, 0xffffffff,
  957. 0x0000f4a4, 0x00680fff, 0xffffffff,
  958. 0x000004c8, 0x00000001, 0xffffffff,
  959. 0x000064ec, 0x00000000, 0xffffffff,
  960. 0x00000c7c, 0x00000000, 0xffffffff,
  961. 0x00006dfc, 0x00000000, 0xffffffff
  962. };
  963. #define BARTS_SYSLS_DEFAULT_LENGTH sizeof(barts_sysls_default) / (3 * sizeof(u32))
  964. static const u32 barts_sysls_disable[] =
  965. {
  966. 0x000055e8, 0x00000000, 0xffffffff,
  967. 0x0000d0bc, 0x00000000, 0xffffffff,
  968. 0x000015c0, 0x00041401, 0xffffffff,
  969. 0x0000264c, 0x00040400, 0xffffffff,
  970. 0x00002648, 0x00040400, 0xffffffff,
  971. 0x00002650, 0x00040400, 0xffffffff,
  972. 0x000020b8, 0x00040400, 0xffffffff,
  973. 0x000020bc, 0x00040400, 0xffffffff,
  974. 0x000020c0, 0x00040c80, 0xffffffff,
  975. 0x0000f4a0, 0x000000c0, 0xffffffff,
  976. 0x0000f4a4, 0x00680000, 0xffffffff,
  977. 0x000004c8, 0x00000001, 0xffffffff,
  978. 0x000064ec, 0x00007ffd, 0xffffffff,
  979. 0x00000c7c, 0x0000ff00, 0xffffffff,
  980. 0x00006dfc, 0x0000007f, 0xffffffff
  981. };
  982. #define BARTS_SYSLS_DISABLE_LENGTH sizeof(barts_sysls_disable) / (3 * sizeof(u32))
  983. static const u32 barts_sysls_enable[] =
  984. {
  985. 0x000055e8, 0x00000001, 0xffffffff,
  986. 0x0000d0bc, 0x00000100, 0xffffffff,
  987. 0x000015c0, 0x000c1401, 0xffffffff,
  988. 0x0000264c, 0x000c0400, 0xffffffff,
  989. 0x00002648, 0x000c0400, 0xffffffff,
  990. 0x00002650, 0x000c0400, 0xffffffff,
  991. 0x000020b8, 0x000c0400, 0xffffffff,
  992. 0x000020bc, 0x000c0400, 0xffffffff,
  993. 0x000020c0, 0x000c0c80, 0xffffffff,
  994. 0x0000f4a0, 0x000000c0, 0xffffffff,
  995. 0x0000f4a4, 0x00680fff, 0xffffffff,
  996. 0x000004c8, 0x00000000, 0xffffffff,
  997. 0x000064ec, 0x00000000, 0xffffffff,
  998. 0x00000c7c, 0x00000000, 0xffffffff,
  999. 0x00006dfc, 0x00000000, 0xffffffff
  1000. };
  1001. #define BARTS_SYSLS_ENABLE_LENGTH sizeof(barts_sysls_enable) / (3 * sizeof(u32))
  1002. //********* CAICOS **************//
  1003. static const u32 caicos_sysls_default[] =
  1004. {
  1005. 0x000055e8, 0x00000000, 0xffffffff,
  1006. 0x0000d0bc, 0x00000000, 0xffffffff,
  1007. 0x000015c0, 0x000c1401, 0xffffffff,
  1008. 0x0000264c, 0x000c0400, 0xffffffff,
  1009. 0x00002648, 0x000c0400, 0xffffffff,
  1010. 0x00002650, 0x000c0400, 0xffffffff,
  1011. 0x000020b8, 0x000c0400, 0xffffffff,
  1012. 0x000020bc, 0x000c0400, 0xffffffff,
  1013. 0x0000f4a0, 0x000000c0, 0xffffffff,
  1014. 0x0000f4a4, 0x00680fff, 0xffffffff,
  1015. 0x000004c8, 0x00000001, 0xffffffff,
  1016. 0x000064ec, 0x00000000, 0xffffffff,
  1017. 0x00000c7c, 0x00000000, 0xffffffff,
  1018. 0x00006dfc, 0x00000000, 0xffffffff
  1019. };
  1020. #define CAICOS_SYSLS_DEFAULT_LENGTH sizeof(caicos_sysls_default) / (3 * sizeof(u32))
  1021. static const u32 caicos_sysls_disable[] =
  1022. {
  1023. 0x000055e8, 0x00000000, 0xffffffff,
  1024. 0x0000d0bc, 0x00000000, 0xffffffff,
  1025. 0x000015c0, 0x00041401, 0xffffffff,
  1026. 0x0000264c, 0x00040400, 0xffffffff,
  1027. 0x00002648, 0x00040400, 0xffffffff,
  1028. 0x00002650, 0x00040400, 0xffffffff,
  1029. 0x000020b8, 0x00040400, 0xffffffff,
  1030. 0x000020bc, 0x00040400, 0xffffffff,
  1031. 0x0000f4a0, 0x000000c0, 0xffffffff,
  1032. 0x0000f4a4, 0x00680000, 0xffffffff,
  1033. 0x000004c8, 0x00000001, 0xffffffff,
  1034. 0x000064ec, 0x00007ffd, 0xffffffff,
  1035. 0x00000c7c, 0x0000ff00, 0xffffffff,
  1036. 0x00006dfc, 0x0000007f, 0xffffffff
  1037. };
  1038. #define CAICOS_SYSLS_DISABLE_LENGTH sizeof(caicos_sysls_disable) / (3 * sizeof(u32))
  1039. static const u32 caicos_sysls_enable[] =
  1040. {
  1041. 0x000055e8, 0x00000001, 0xffffffff,
  1042. 0x0000d0bc, 0x00000100, 0xffffffff,
  1043. 0x000015c0, 0x000c1401, 0xffffffff,
  1044. 0x0000264c, 0x000c0400, 0xffffffff,
  1045. 0x00002648, 0x000c0400, 0xffffffff,
  1046. 0x00002650, 0x000c0400, 0xffffffff,
  1047. 0x000020b8, 0x000c0400, 0xffffffff,
  1048. 0x000020bc, 0x000c0400, 0xffffffff,
  1049. 0x0000f4a0, 0x000000c0, 0xffffffff,
  1050. 0x0000f4a4, 0x00680fff, 0xffffffff,
  1051. 0x000064ec, 0x00000000, 0xffffffff,
  1052. 0x00000c7c, 0x00000000, 0xffffffff,
  1053. 0x00006dfc, 0x00000000, 0xffffffff,
  1054. 0x000004c8, 0x00000000, 0xffffffff
  1055. };
  1056. #define CAICOS_SYSLS_ENABLE_LENGTH sizeof(caicos_sysls_enable) / (3 * sizeof(u32))
  1057. //********* TURKS **************//
  1058. static const u32 turks_sysls_default[] =
  1059. {
  1060. 0x000055e8, 0x00000000, 0xffffffff,
  1061. 0x0000d0bc, 0x00000000, 0xffffffff,
  1062. 0x000015c0, 0x000c1401, 0xffffffff,
  1063. 0x0000264c, 0x000c0400, 0xffffffff,
  1064. 0x00002648, 0x000c0400, 0xffffffff,
  1065. 0x00002650, 0x000c0400, 0xffffffff,
  1066. 0x000020b8, 0x000c0400, 0xffffffff,
  1067. 0x000020bc, 0x000c0400, 0xffffffff,
  1068. 0x000020c0, 0x000c0c80, 0xffffffff,
  1069. 0x0000f4a0, 0x000000c0, 0xffffffff,
  1070. 0x0000f4a4, 0x00680fff, 0xffffffff,
  1071. 0x000004c8, 0x00000001, 0xffffffff,
  1072. 0x000064ec, 0x00000000, 0xffffffff,
  1073. 0x00000c7c, 0x00000000, 0xffffffff,
  1074. 0x00006dfc, 0x00000000, 0xffffffff
  1075. };
  1076. #define TURKS_SYSLS_DEFAULT_LENGTH sizeof(turks_sysls_default) / (3 * sizeof(u32))
  1077. static const u32 turks_sysls_disable[] =
  1078. {
  1079. 0x000055e8, 0x00000000, 0xffffffff,
  1080. 0x0000d0bc, 0x00000000, 0xffffffff,
  1081. 0x000015c0, 0x00041401, 0xffffffff,
  1082. 0x0000264c, 0x00040400, 0xffffffff,
  1083. 0x00002648, 0x00040400, 0xffffffff,
  1084. 0x00002650, 0x00040400, 0xffffffff,
  1085. 0x000020b8, 0x00040400, 0xffffffff,
  1086. 0x000020bc, 0x00040400, 0xffffffff,
  1087. 0x000020c0, 0x00040c80, 0xffffffff,
  1088. 0x0000f4a0, 0x000000c0, 0xffffffff,
  1089. 0x0000f4a4, 0x00680000, 0xffffffff,
  1090. 0x000004c8, 0x00000001, 0xffffffff,
  1091. 0x000064ec, 0x00007ffd, 0xffffffff,
  1092. 0x00000c7c, 0x0000ff00, 0xffffffff,
  1093. 0x00006dfc, 0x0000007f, 0xffffffff
  1094. };
  1095. #define TURKS_SYSLS_DISABLE_LENGTH sizeof(turks_sysls_disable) / (3 * sizeof(u32))
  1096. static const u32 turks_sysls_enable[] =
  1097. {
  1098. 0x000055e8, 0x00000001, 0xffffffff,
  1099. 0x0000d0bc, 0x00000100, 0xffffffff,
  1100. 0x000015c0, 0x000c1401, 0xffffffff,
  1101. 0x0000264c, 0x000c0400, 0xffffffff,
  1102. 0x00002648, 0x000c0400, 0xffffffff,
  1103. 0x00002650, 0x000c0400, 0xffffffff,
  1104. 0x000020b8, 0x000c0400, 0xffffffff,
  1105. 0x000020bc, 0x000c0400, 0xffffffff,
  1106. 0x000020c0, 0x000c0c80, 0xffffffff,
  1107. 0x0000f4a0, 0x000000c0, 0xffffffff,
  1108. 0x0000f4a4, 0x00680fff, 0xffffffff,
  1109. 0x000004c8, 0x00000000, 0xffffffff,
  1110. 0x000064ec, 0x00000000, 0xffffffff,
  1111. 0x00000c7c, 0x00000000, 0xffffffff,
  1112. 0x00006dfc, 0x00000000, 0xffffffff
  1113. };
  1114. #define TURKS_SYSLS_ENABLE_LENGTH sizeof(turks_sysls_enable) / (3 * sizeof(u32))
  1115. #endif
  1116. static void btc_enable_bif_dynamic_pcie_gen2(struct radeon_device *rdev,
  1117. bool enable)
  1118. {
  1119. struct rv7xx_power_info *pi = rv770_get_pi(rdev);
  1120. u32 tmp, bif;
  1121. tmp = RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL);
  1122. if (enable) {
  1123. if ((tmp & LC_OTHER_SIDE_EVER_SENT_GEN2) &&
  1124. (tmp & LC_OTHER_SIDE_SUPPORTS_GEN2)) {
  1125. if (!pi->boot_in_gen2) {
  1126. bif = RREG32(CG_BIF_REQ_AND_RSP) & ~CG_CLIENT_REQ_MASK;
  1127. bif |= CG_CLIENT_REQ(0xd);
  1128. WREG32(CG_BIF_REQ_AND_RSP, bif);
  1129. tmp &= ~LC_HW_VOLTAGE_IF_CONTROL_MASK;
  1130. tmp |= LC_HW_VOLTAGE_IF_CONTROL(1);
  1131. tmp |= LC_GEN2_EN_STRAP;
  1132. tmp |= LC_CLR_FAILED_SPD_CHANGE_CNT;
  1133. WREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL, tmp);
  1134. udelay(10);
  1135. tmp &= ~LC_CLR_FAILED_SPD_CHANGE_CNT;
  1136. WREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL, tmp);
  1137. }
  1138. }
  1139. } else {
  1140. if ((tmp & LC_OTHER_SIDE_EVER_SENT_GEN2) ||
  1141. (tmp & LC_OTHER_SIDE_SUPPORTS_GEN2)) {
  1142. if (!pi->boot_in_gen2) {
  1143. bif = RREG32(CG_BIF_REQ_AND_RSP) & ~CG_CLIENT_REQ_MASK;
  1144. bif |= CG_CLIENT_REQ(0xd);
  1145. WREG32(CG_BIF_REQ_AND_RSP, bif);
  1146. tmp &= ~LC_HW_VOLTAGE_IF_CONTROL_MASK;
  1147. tmp &= ~LC_GEN2_EN_STRAP;
  1148. }
  1149. WREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL, tmp);
  1150. }
  1151. }
  1152. }
  1153. static void btc_enable_dynamic_pcie_gen2(struct radeon_device *rdev,
  1154. bool enable)
  1155. {
  1156. btc_enable_bif_dynamic_pcie_gen2(rdev, enable);
  1157. if (enable)
  1158. WREG32_P(GENERAL_PWRMGT, ENABLE_GEN2PCIE, ~ENABLE_GEN2PCIE);
  1159. else
  1160. WREG32_P(GENERAL_PWRMGT, 0, ~ENABLE_GEN2PCIE);
  1161. }
  1162. static int btc_disable_ulv(struct radeon_device *rdev)
  1163. {
  1164. struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
  1165. if (eg_pi->ulv.supported) {
  1166. if (rv770_send_msg_to_smc(rdev, PPSMC_MSG_DisableULV) != PPSMC_Result_OK)
  1167. return -EINVAL;
  1168. }
  1169. return 0;
  1170. }
  1171. static int btc_populate_ulv_state(struct radeon_device *rdev,
  1172. RV770_SMC_STATETABLE *table)
  1173. {
  1174. int ret = -EINVAL;
  1175. struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
  1176. struct rv7xx_pl *ulv_pl = eg_pi->ulv.pl;
  1177. if (ulv_pl->vddc) {
  1178. ret = cypress_convert_power_level_to_smc(rdev,
  1179. ulv_pl,
  1180. &table->ULVState.levels[0],
  1181. PPSMC_DISPLAY_WATERMARK_LOW);
  1182. if (ret == 0) {
  1183. table->ULVState.levels[0].arbValue = MC_CG_ARB_FREQ_F0;
  1184. table->ULVState.levels[0].ACIndex = 1;
  1185. table->ULVState.levels[1] = table->ULVState.levels[0];
  1186. table->ULVState.levels[2] = table->ULVState.levels[0];
  1187. table->ULVState.flags |= PPSMC_SWSTATE_FLAG_DC;
  1188. WREG32(CG_ULV_CONTROL, BTC_CGULVCONTROL_DFLT);
  1189. WREG32(CG_ULV_PARAMETER, BTC_CGULVPARAMETER_DFLT);
  1190. }
  1191. }
  1192. return ret;
  1193. }
  1194. static int btc_populate_smc_acpi_state(struct radeon_device *rdev,
  1195. RV770_SMC_STATETABLE *table)
  1196. {
  1197. int ret = cypress_populate_smc_acpi_state(rdev, table);
  1198. if (ret == 0) {
  1199. table->ACPIState.levels[0].ACIndex = 0;
  1200. table->ACPIState.levels[1].ACIndex = 0;
  1201. table->ACPIState.levels[2].ACIndex = 0;
  1202. }
  1203. return ret;
  1204. }
  1205. static void btc_program_mgcg_hw_sequence(struct radeon_device *rdev,
  1206. const u32 *sequence, u32 count)
  1207. {
  1208. u32 i, length = count * 3;
  1209. u32 tmp;
  1210. for (i = 0; i < length; i+=3) {
  1211. tmp = RREG32(sequence[i]);
  1212. tmp &= ~sequence[i+2];
  1213. tmp |= sequence[i+1] & sequence[i+2];
  1214. WREG32(sequence[i], tmp);
  1215. }
  1216. }
  1217. static void btc_cg_clock_gating_default(struct radeon_device *rdev)
  1218. {
  1219. u32 count;
  1220. const u32 *p = NULL;
  1221. if (rdev->family == CHIP_BARTS) {
  1222. p = (const u32 *)&barts_cgcg_cgls_default;
  1223. count = BARTS_CGCG_CGLS_DEFAULT_LENGTH;
  1224. } else if (rdev->family == CHIP_TURKS) {
  1225. p = (const u32 *)&turks_cgcg_cgls_default;
  1226. count = TURKS_CGCG_CGLS_DEFAULT_LENGTH;
  1227. } else if (rdev->family == CHIP_CAICOS) {
  1228. p = (const u32 *)&caicos_cgcg_cgls_default;
  1229. count = CAICOS_CGCG_CGLS_DEFAULT_LENGTH;
  1230. } else
  1231. return;
  1232. btc_program_mgcg_hw_sequence(rdev, p, count);
  1233. }
  1234. static void btc_cg_clock_gating_enable(struct radeon_device *rdev,
  1235. bool enable)
  1236. {
  1237. u32 count;
  1238. const u32 *p = NULL;
  1239. if (enable) {
  1240. if (rdev->family == CHIP_BARTS) {
  1241. p = (const u32 *)&barts_cgcg_cgls_enable;
  1242. count = BARTS_CGCG_CGLS_ENABLE_LENGTH;
  1243. } else if (rdev->family == CHIP_TURKS) {
  1244. p = (const u32 *)&turks_cgcg_cgls_enable;
  1245. count = TURKS_CGCG_CGLS_ENABLE_LENGTH;
  1246. } else if (rdev->family == CHIP_CAICOS) {
  1247. p = (const u32 *)&caicos_cgcg_cgls_enable;
  1248. count = CAICOS_CGCG_CGLS_ENABLE_LENGTH;
  1249. } else
  1250. return;
  1251. } else {
  1252. if (rdev->family == CHIP_BARTS) {
  1253. p = (const u32 *)&barts_cgcg_cgls_disable;
  1254. count = BARTS_CGCG_CGLS_DISABLE_LENGTH;
  1255. } else if (rdev->family == CHIP_TURKS) {
  1256. p = (const u32 *)&turks_cgcg_cgls_disable;
  1257. count = TURKS_CGCG_CGLS_DISABLE_LENGTH;
  1258. } else if (rdev->family == CHIP_CAICOS) {
  1259. p = (const u32 *)&caicos_cgcg_cgls_disable;
  1260. count = CAICOS_CGCG_CGLS_DISABLE_LENGTH;
  1261. } else
  1262. return;
  1263. }
  1264. btc_program_mgcg_hw_sequence(rdev, p, count);
  1265. }
  1266. static void btc_mg_clock_gating_default(struct radeon_device *rdev)
  1267. {
  1268. u32 count;
  1269. const u32 *p = NULL;
  1270. if (rdev->family == CHIP_BARTS) {
  1271. p = (const u32 *)&barts_mgcg_default;
  1272. count = BARTS_MGCG_DEFAULT_LENGTH;
  1273. } else if (rdev->family == CHIP_TURKS) {
  1274. p = (const u32 *)&turks_mgcg_default;
  1275. count = TURKS_MGCG_DEFAULT_LENGTH;
  1276. } else if (rdev->family == CHIP_CAICOS) {
  1277. p = (const u32 *)&caicos_mgcg_default;
  1278. count = CAICOS_MGCG_DEFAULT_LENGTH;
  1279. } else
  1280. return;
  1281. btc_program_mgcg_hw_sequence(rdev, p, count);
  1282. }
  1283. static void btc_mg_clock_gating_enable(struct radeon_device *rdev,
  1284. bool enable)
  1285. {
  1286. u32 count;
  1287. const u32 *p = NULL;
  1288. if (enable) {
  1289. if (rdev->family == CHIP_BARTS) {
  1290. p = (const u32 *)&barts_mgcg_enable;
  1291. count = BARTS_MGCG_ENABLE_LENGTH;
  1292. } else if (rdev->family == CHIP_TURKS) {
  1293. p = (const u32 *)&turks_mgcg_enable;
  1294. count = TURKS_MGCG_ENABLE_LENGTH;
  1295. } else if (rdev->family == CHIP_CAICOS) {
  1296. p = (const u32 *)&caicos_mgcg_enable;
  1297. count = CAICOS_MGCG_ENABLE_LENGTH;
  1298. } else
  1299. return;
  1300. } else {
  1301. if (rdev->family == CHIP_BARTS) {
  1302. p = (const u32 *)&barts_mgcg_disable[0];
  1303. count = BARTS_MGCG_DISABLE_LENGTH;
  1304. } else if (rdev->family == CHIP_TURKS) {
  1305. p = (const u32 *)&turks_mgcg_disable[0];
  1306. count = TURKS_MGCG_DISABLE_LENGTH;
  1307. } else if (rdev->family == CHIP_CAICOS) {
  1308. p = (const u32 *)&caicos_mgcg_disable[0];
  1309. count = CAICOS_MGCG_DISABLE_LENGTH;
  1310. } else
  1311. return;
  1312. }
  1313. btc_program_mgcg_hw_sequence(rdev, p, count);
  1314. }
  1315. static void btc_ls_clock_gating_default(struct radeon_device *rdev)
  1316. {
  1317. u32 count;
  1318. const u32 *p = NULL;
  1319. if (rdev->family == CHIP_BARTS) {
  1320. p = (const u32 *)&barts_sysls_default;
  1321. count = BARTS_SYSLS_DEFAULT_LENGTH;
  1322. } else if (rdev->family == CHIP_TURKS) {
  1323. p = (const u32 *)&turks_sysls_default;
  1324. count = TURKS_SYSLS_DEFAULT_LENGTH;
  1325. } else if (rdev->family == CHIP_CAICOS) {
  1326. p = (const u32 *)&caicos_sysls_default;
  1327. count = CAICOS_SYSLS_DEFAULT_LENGTH;
  1328. } else
  1329. return;
  1330. btc_program_mgcg_hw_sequence(rdev, p, count);
  1331. }
  1332. static void btc_ls_clock_gating_enable(struct radeon_device *rdev,
  1333. bool enable)
  1334. {
  1335. u32 count;
  1336. const u32 *p = NULL;
  1337. if (enable) {
  1338. if (rdev->family == CHIP_BARTS) {
  1339. p = (const u32 *)&barts_sysls_enable;
  1340. count = BARTS_SYSLS_ENABLE_LENGTH;
  1341. } else if (rdev->family == CHIP_TURKS) {
  1342. p = (const u32 *)&turks_sysls_enable;
  1343. count = TURKS_SYSLS_ENABLE_LENGTH;
  1344. } else if (rdev->family == CHIP_CAICOS) {
  1345. p = (const u32 *)&caicos_sysls_enable;
  1346. count = CAICOS_SYSLS_ENABLE_LENGTH;
  1347. } else
  1348. return;
  1349. } else {
  1350. if (rdev->family == CHIP_BARTS) {
  1351. p = (const u32 *)&barts_sysls_disable;
  1352. count = BARTS_SYSLS_DISABLE_LENGTH;
  1353. } else if (rdev->family == CHIP_TURKS) {
  1354. p = (const u32 *)&turks_sysls_disable;
  1355. count = TURKS_SYSLS_DISABLE_LENGTH;
  1356. } else if (rdev->family == CHIP_CAICOS) {
  1357. p = (const u32 *)&caicos_sysls_disable;
  1358. count = CAICOS_SYSLS_DISABLE_LENGTH;
  1359. } else
  1360. return;
  1361. }
  1362. btc_program_mgcg_hw_sequence(rdev, p, count);
  1363. }
  1364. static bool btc_dpm_enabled(struct radeon_device *rdev)
  1365. {
  1366. if (rv770_is_smc_running(rdev))
  1367. return true;
  1368. else
  1369. return false;
  1370. }
  1371. static int btc_init_smc_table(struct radeon_device *rdev)
  1372. {
  1373. struct rv7xx_power_info *pi = rv770_get_pi(rdev);
  1374. struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
  1375. struct radeon_ps *radeon_boot_state = rdev->pm.dpm.boot_ps;
  1376. RV770_SMC_STATETABLE *table = &pi->smc_statetable;
  1377. int ret;
  1378. memset(table, 0, sizeof(RV770_SMC_STATETABLE));
  1379. cypress_populate_smc_voltage_tables(rdev, table);
  1380. switch (rdev->pm.int_thermal_type) {
  1381. case THERMAL_TYPE_EVERGREEN:
  1382. case THERMAL_TYPE_EMC2103_WITH_INTERNAL:
  1383. table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_INTERNAL;
  1384. break;
  1385. case THERMAL_TYPE_NONE:
  1386. table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_NONE;
  1387. break;
  1388. default:
  1389. table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_EXTERNAL;
  1390. break;
  1391. }
  1392. if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_HARDWAREDC)
  1393. table->systemFlags |= PPSMC_SYSTEMFLAG_GPIO_DC;
  1394. if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_REGULATOR_HOT)
  1395. table->systemFlags |= PPSMC_SYSTEMFLAG_REGULATOR_HOT;
  1396. if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_STEPVDDC)
  1397. table->systemFlags |= PPSMC_SYSTEMFLAG_STEPVDDC;
  1398. if (pi->mem_gddr5)
  1399. table->systemFlags |= PPSMC_SYSTEMFLAG_GDDR5;
  1400. ret = cypress_populate_smc_initial_state(rdev, radeon_boot_state, table);
  1401. if (ret)
  1402. return ret;
  1403. if (eg_pi->sclk_deep_sleep)
  1404. WREG32_P(SCLK_PSKIP_CNTL, PSKIP_ON_ALLOW_STOP_HI(32),
  1405. ~PSKIP_ON_ALLOW_STOP_HI_MASK);
  1406. ret = btc_populate_smc_acpi_state(rdev, table);
  1407. if (ret)
  1408. return ret;
  1409. if (eg_pi->ulv.supported) {
  1410. ret = btc_populate_ulv_state(rdev, table);
  1411. if (ret)
  1412. eg_pi->ulv.supported = false;
  1413. }
  1414. table->driverState = table->initialState;
  1415. return rv770_copy_bytes_to_smc(rdev,
  1416. pi->state_table_start,
  1417. (u8 *)table,
  1418. sizeof(RV770_SMC_STATETABLE),
  1419. pi->sram_end);
  1420. }
  1421. static int btc_reset_to_default(struct radeon_device *rdev)
  1422. {
  1423. if (rv770_send_msg_to_smc(rdev, PPSMC_MSG_ResetToDefaults) != PPSMC_Result_OK)
  1424. return -EINVAL;
  1425. return 0;
  1426. }
  1427. static void btc_stop_smc(struct radeon_device *rdev)
  1428. {
  1429. int i;
  1430. for (i = 0; i < rdev->usec_timeout; i++) {
  1431. if (((RREG32(LB_SYNC_RESET_SEL) & LB_SYNC_RESET_SEL_MASK) >> LB_SYNC_RESET_SEL_SHIFT) != 1)
  1432. break;
  1433. udelay(1);
  1434. }
  1435. udelay(100);
  1436. r7xx_stop_smc(rdev);
  1437. }
  1438. static void btc_read_arb_registers(struct radeon_device *rdev)
  1439. {
  1440. struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
  1441. struct evergreen_arb_registers *arb_registers =
  1442. &eg_pi->bootup_arb_registers;
  1443. arb_registers->mc_arb_dram_timing = RREG32(MC_ARB_DRAM_TIMING);
  1444. arb_registers->mc_arb_dram_timing2 = RREG32(MC_ARB_DRAM_TIMING2);
  1445. arb_registers->mc_arb_rfsh_rate = RREG32(MC_ARB_RFSH_RATE);
  1446. arb_registers->mc_arb_burst_time = RREG32(MC_ARB_BURST_TIME);
  1447. }
  1448. static void btc_set_arb0_registers(struct radeon_device *rdev,
  1449. struct evergreen_arb_registers *arb_registers)
  1450. {
  1451. u32 val;
  1452. WREG32(MC_ARB_DRAM_TIMING, arb_registers->mc_arb_dram_timing);
  1453. WREG32(MC_ARB_DRAM_TIMING2, arb_registers->mc_arb_dram_timing2);
  1454. val = (arb_registers->mc_arb_rfsh_rate & POWERMODE0_MASK) >>
  1455. POWERMODE0_SHIFT;
  1456. WREG32_P(MC_ARB_RFSH_RATE, POWERMODE0(val), ~POWERMODE0_MASK);
  1457. val = (arb_registers->mc_arb_burst_time & STATE0_MASK) >>
  1458. STATE0_SHIFT;
  1459. WREG32_P(MC_ARB_BURST_TIME, STATE0(val), ~STATE0_MASK);
  1460. }
  1461. static void btc_set_boot_state_timing(struct radeon_device *rdev)
  1462. {
  1463. struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
  1464. if (eg_pi->ulv.supported)
  1465. btc_set_arb0_registers(rdev, &eg_pi->bootup_arb_registers);
  1466. }
  1467. static bool btc_is_state_ulv_compatible(struct radeon_device *rdev,
  1468. struct radeon_ps *radeon_state)
  1469. {
  1470. struct rv7xx_ps *state = rv770_get_ps(radeon_state);
  1471. struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
  1472. struct rv7xx_pl *ulv_pl = eg_pi->ulv.pl;
  1473. if (state->low.mclk != ulv_pl->mclk)
  1474. return false;
  1475. if (state->low.vddci != ulv_pl->vddci)
  1476. return false;
  1477. /* XXX check minclocks, etc. */
  1478. return true;
  1479. }
  1480. static int btc_set_ulv_dram_timing(struct radeon_device *rdev)
  1481. {
  1482. u32 val;
  1483. struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
  1484. struct rv7xx_pl *ulv_pl = eg_pi->ulv.pl;
  1485. radeon_atom_set_engine_dram_timings(rdev,
  1486. ulv_pl->sclk,
  1487. ulv_pl->mclk);
  1488. val = rv770_calculate_memory_refresh_rate(rdev, ulv_pl->sclk);
  1489. WREG32_P(MC_ARB_RFSH_RATE, POWERMODE0(val), ~POWERMODE0_MASK);
  1490. val = cypress_calculate_burst_time(rdev, ulv_pl->sclk, ulv_pl->mclk);
  1491. WREG32_P(MC_ARB_BURST_TIME, STATE0(val), ~STATE0_MASK);
  1492. return 0;
  1493. }
  1494. static int btc_enable_ulv(struct radeon_device *rdev)
  1495. {
  1496. if (rv770_send_msg_to_smc(rdev, PPSMC_MSG_EnableULV) != PPSMC_Result_OK)
  1497. return -EINVAL;
  1498. return 0;
  1499. }
  1500. static int btc_set_power_state_conditionally_enable_ulv(struct radeon_device *rdev)
  1501. {
  1502. int ret = 0;
  1503. struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
  1504. struct radeon_ps *radeon_new_state = rdev->pm.dpm.requested_ps;
  1505. if (eg_pi->ulv.supported) {
  1506. if (btc_is_state_ulv_compatible(rdev, radeon_new_state)) {
  1507. // Set ARB[0] to reflect the DRAM timing needed for ULV.
  1508. ret = btc_set_ulv_dram_timing(rdev);
  1509. if (ret == 0)
  1510. ret = btc_enable_ulv(rdev);
  1511. }
  1512. }
  1513. return ret;
  1514. }
  1515. static bool btc_check_s0_mc_reg_index(u16 in_reg, u16 *out_reg)
  1516. {
  1517. bool result = true;
  1518. switch (in_reg) {
  1519. case MC_SEQ_RAS_TIMING >> 2:
  1520. *out_reg = MC_SEQ_RAS_TIMING_LP >> 2;
  1521. break;
  1522. case MC_SEQ_CAS_TIMING >> 2:
  1523. *out_reg = MC_SEQ_CAS_TIMING_LP >> 2;
  1524. break;
  1525. case MC_SEQ_MISC_TIMING >> 2:
  1526. *out_reg = MC_SEQ_MISC_TIMING_LP >> 2;
  1527. break;
  1528. case MC_SEQ_MISC_TIMING2 >> 2:
  1529. *out_reg = MC_SEQ_MISC_TIMING2_LP >> 2;
  1530. break;
  1531. case MC_SEQ_RD_CTL_D0 >> 2:
  1532. *out_reg = MC_SEQ_RD_CTL_D0_LP >> 2;
  1533. break;
  1534. case MC_SEQ_RD_CTL_D1 >> 2:
  1535. *out_reg = MC_SEQ_RD_CTL_D1_LP >> 2;
  1536. break;
  1537. case MC_SEQ_WR_CTL_D0 >> 2:
  1538. *out_reg = MC_SEQ_WR_CTL_D0_LP >> 2;
  1539. break;
  1540. case MC_SEQ_WR_CTL_D1 >> 2:
  1541. *out_reg = MC_SEQ_WR_CTL_D1_LP >> 2;
  1542. break;
  1543. case MC_PMG_CMD_EMRS >> 2:
  1544. *out_reg = MC_SEQ_PMG_CMD_EMRS_LP >> 2;
  1545. break;
  1546. case MC_PMG_CMD_MRS >> 2:
  1547. *out_reg = MC_SEQ_PMG_CMD_MRS_LP >> 2;
  1548. break;
  1549. case MC_PMG_CMD_MRS1 >> 2:
  1550. *out_reg = MC_SEQ_PMG_CMD_MRS1_LP >> 2;
  1551. break;
  1552. default:
  1553. result = false;
  1554. break;
  1555. }
  1556. return result;
  1557. }
  1558. static void btc_set_valid_flag(struct evergreen_mc_reg_table *table)
  1559. {
  1560. u8 i, j;
  1561. for (i = 0; i < table->last; i++) {
  1562. for (j = 1; j < table->num_entries; j++) {
  1563. if (table->mc_reg_table_entry[j-1].mc_data[i] !=
  1564. table->mc_reg_table_entry[j].mc_data[i]) {
  1565. table->valid_flag |= (1 << i);
  1566. break;
  1567. }
  1568. }
  1569. }
  1570. }
  1571. static int btc_set_mc_special_registers(struct radeon_device *rdev,
  1572. struct evergreen_mc_reg_table *table)
  1573. {
  1574. struct rv7xx_power_info *pi = rv770_get_pi(rdev);
  1575. u8 i, j, k;
  1576. u32 tmp;
  1577. for (i = 0, j = table->last; i < table->last; i++) {
  1578. switch (table->mc_reg_address[i].s1) {
  1579. case MC_SEQ_MISC1 >> 2:
  1580. tmp = RREG32(MC_PMG_CMD_EMRS);
  1581. table->mc_reg_address[j].s1 = MC_PMG_CMD_EMRS >> 2;
  1582. table->mc_reg_address[j].s0 = MC_SEQ_PMG_CMD_EMRS_LP >> 2;
  1583. for (k = 0; k < table->num_entries; k++) {
  1584. table->mc_reg_table_entry[k].mc_data[j] =
  1585. ((tmp & 0xffff0000)) |
  1586. ((table->mc_reg_table_entry[k].mc_data[i] & 0xffff0000) >> 16);
  1587. }
  1588. j++;
  1589. if (j > SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE)
  1590. return -EINVAL;
  1591. tmp = RREG32(MC_PMG_CMD_MRS);
  1592. table->mc_reg_address[j].s1 = MC_PMG_CMD_MRS >> 2;
  1593. table->mc_reg_address[j].s0 = MC_SEQ_PMG_CMD_MRS_LP >> 2;
  1594. for (k = 0; k < table->num_entries; k++) {
  1595. table->mc_reg_table_entry[k].mc_data[j] =
  1596. (tmp & 0xffff0000) |
  1597. (table->mc_reg_table_entry[k].mc_data[i] & 0x0000ffff);
  1598. if (!pi->mem_gddr5)
  1599. table->mc_reg_table_entry[k].mc_data[j] |= 0x100;
  1600. }
  1601. j++;
  1602. if (j > SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE)
  1603. return -EINVAL;
  1604. break;
  1605. case MC_SEQ_RESERVE_M >> 2:
  1606. tmp = RREG32(MC_PMG_CMD_MRS1);
  1607. table->mc_reg_address[j].s1 = MC_PMG_CMD_MRS1 >> 2;
  1608. table->mc_reg_address[j].s0 = MC_SEQ_PMG_CMD_MRS1_LP >> 2;
  1609. for (k = 0; k < table->num_entries; k++) {
  1610. table->mc_reg_table_entry[k].mc_data[j] =
  1611. (tmp & 0xffff0000) |
  1612. (table->mc_reg_table_entry[k].mc_data[i] & 0x0000ffff);
  1613. }
  1614. j++;
  1615. if (j > SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE)
  1616. return -EINVAL;
  1617. break;
  1618. default:
  1619. break;
  1620. }
  1621. }
  1622. table->last = j;
  1623. return 0;
  1624. }
  1625. static void btc_set_s0_mc_reg_index(struct evergreen_mc_reg_table *table)
  1626. {
  1627. u32 i;
  1628. u16 address;
  1629. for (i = 0; i < table->last; i++) {
  1630. table->mc_reg_address[i].s0 =
  1631. btc_check_s0_mc_reg_index(table->mc_reg_address[i].s1, &address) ?
  1632. address : table->mc_reg_address[i].s1;
  1633. }
  1634. }
  1635. static int btc_copy_vbios_mc_reg_table(struct atom_mc_reg_table *table,
  1636. struct evergreen_mc_reg_table *eg_table)
  1637. {
  1638. u8 i, j;
  1639. if (table->last > SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE)
  1640. return -EINVAL;
  1641. if (table->num_entries > MAX_AC_TIMING_ENTRIES)
  1642. return -EINVAL;
  1643. for (i = 0; i < table->last; i++)
  1644. eg_table->mc_reg_address[i].s1 = table->mc_reg_address[i].s1;
  1645. eg_table->last = table->last;
  1646. for (i = 0; i < table->num_entries; i++) {
  1647. eg_table->mc_reg_table_entry[i].mclk_max =
  1648. table->mc_reg_table_entry[i].mclk_max;
  1649. for(j = 0; j < table->last; j++)
  1650. eg_table->mc_reg_table_entry[i].mc_data[j] =
  1651. table->mc_reg_table_entry[i].mc_data[j];
  1652. }
  1653. eg_table->num_entries = table->num_entries;
  1654. return 0;
  1655. }
  1656. static int btc_initialize_mc_reg_table(struct radeon_device *rdev)
  1657. {
  1658. int ret;
  1659. struct atom_mc_reg_table *table;
  1660. struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
  1661. struct evergreen_mc_reg_table *eg_table = &eg_pi->mc_reg_table;
  1662. u8 module_index = rv770_get_memory_module_index(rdev);
  1663. table = kzalloc(sizeof(struct atom_mc_reg_table), GFP_KERNEL);
  1664. if (!table)
  1665. return -ENOMEM;
  1666. /* Program additional LP registers that are no longer programmed by VBIOS */
  1667. WREG32(MC_SEQ_RAS_TIMING_LP, RREG32(MC_SEQ_RAS_TIMING));
  1668. WREG32(MC_SEQ_CAS_TIMING_LP, RREG32(MC_SEQ_CAS_TIMING));
  1669. WREG32(MC_SEQ_MISC_TIMING_LP, RREG32(MC_SEQ_MISC_TIMING));
  1670. WREG32(MC_SEQ_MISC_TIMING2_LP, RREG32(MC_SEQ_MISC_TIMING2));
  1671. WREG32(MC_SEQ_RD_CTL_D0_LP, RREG32(MC_SEQ_RD_CTL_D0));
  1672. WREG32(MC_SEQ_RD_CTL_D1_LP, RREG32(MC_SEQ_RD_CTL_D1));
  1673. WREG32(MC_SEQ_WR_CTL_D0_LP, RREG32(MC_SEQ_WR_CTL_D0));
  1674. WREG32(MC_SEQ_WR_CTL_D1_LP, RREG32(MC_SEQ_WR_CTL_D1));
  1675. WREG32(MC_SEQ_PMG_CMD_EMRS_LP, RREG32(MC_PMG_CMD_EMRS));
  1676. WREG32(MC_SEQ_PMG_CMD_MRS_LP, RREG32(MC_PMG_CMD_MRS));
  1677. WREG32(MC_SEQ_PMG_CMD_MRS1_LP, RREG32(MC_PMG_CMD_MRS1));
  1678. ret = radeon_atom_init_mc_reg_table(rdev, module_index, table);
  1679. if (ret)
  1680. goto init_mc_done;
  1681. ret = btc_copy_vbios_mc_reg_table(table, eg_table);
  1682. if (ret)
  1683. goto init_mc_done;
  1684. btc_set_s0_mc_reg_index(eg_table);
  1685. ret = btc_set_mc_special_registers(rdev, eg_table);
  1686. if (ret)
  1687. goto init_mc_done;
  1688. btc_set_valid_flag(eg_table);
  1689. init_mc_done:
  1690. kfree(table);
  1691. return ret;
  1692. }
  1693. static void btc_init_stutter_mode(struct radeon_device *rdev)
  1694. {
  1695. struct rv7xx_power_info *pi = rv770_get_pi(rdev);
  1696. u32 tmp;
  1697. if (pi->mclk_stutter_mode_threshold) {
  1698. if (pi->mem_gddr5) {
  1699. tmp = RREG32(MC_PMG_AUTO_CFG);
  1700. if ((0x200 & tmp) == 0) {
  1701. tmp = (tmp & 0xfffffc0b) | 0x204;
  1702. WREG32(MC_PMG_AUTO_CFG, tmp);
  1703. }
  1704. }
  1705. }
  1706. }
  1707. void btc_dpm_reset_asic(struct radeon_device *rdev)
  1708. {
  1709. rv770_restrict_performance_levels_before_switch(rdev);
  1710. btc_disable_ulv(rdev);
  1711. btc_set_boot_state_timing(rdev);
  1712. rv770_set_boot_state(rdev);
  1713. }
  1714. int btc_dpm_set_power_state(struct radeon_device *rdev)
  1715. {
  1716. struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
  1717. btc_disable_ulv(rdev);
  1718. btc_set_boot_state_timing(rdev);
  1719. rv770_restrict_performance_levels_before_switch(rdev);
  1720. if (eg_pi->pcie_performance_request)
  1721. cypress_notify_link_speed_change_before_state_change(rdev);
  1722. rv770_halt_smc(rdev);
  1723. cypress_upload_sw_state(rdev);
  1724. if (eg_pi->dynamic_ac_timing)
  1725. cypress_upload_mc_reg_table(rdev);
  1726. cypress_program_memory_timing_parameters(rdev);
  1727. rv770_resume_smc(rdev);
  1728. rv770_set_sw_state(rdev);
  1729. if (eg_pi->pcie_performance_request)
  1730. cypress_notify_link_speed_change_after_state_change(rdev);
  1731. btc_set_power_state_conditionally_enable_ulv(rdev);
  1732. #if 0
  1733. /* XXX */
  1734. rv770_unrestrict_performance_levels_after_switch(rdev);
  1735. #endif
  1736. return 0;
  1737. }
  1738. int btc_dpm_enable(struct radeon_device *rdev)
  1739. {
  1740. struct rv7xx_power_info *pi = rv770_get_pi(rdev);
  1741. struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
  1742. if (pi->gfx_clock_gating)
  1743. btc_cg_clock_gating_default(rdev);
  1744. if (btc_dpm_enabled(rdev))
  1745. return -EINVAL;
  1746. if (pi->mg_clock_gating)
  1747. btc_mg_clock_gating_default(rdev);
  1748. if (eg_pi->ls_clock_gating)
  1749. btc_ls_clock_gating_default(rdev);
  1750. if (pi->voltage_control) {
  1751. rv770_enable_voltage_control(rdev, true);
  1752. cypress_construct_voltage_tables(rdev);
  1753. }
  1754. if (pi->mvdd_control)
  1755. cypress_get_mvdd_configuration(rdev);
  1756. if (eg_pi->dynamic_ac_timing)
  1757. btc_initialize_mc_reg_table(rdev);
  1758. if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_BACKBIAS)
  1759. rv770_enable_backbias(rdev, true);
  1760. if (pi->dynamic_ss)
  1761. cypress_enable_spread_spectrum(rdev, true);
  1762. if (pi->thermal_protection)
  1763. rv770_enable_thermal_protection(rdev, true);
  1764. rv770_setup_bsp(rdev);
  1765. rv770_program_git(rdev);
  1766. rv770_program_tp(rdev);
  1767. rv770_program_tpp(rdev);
  1768. rv770_program_sstp(rdev);
  1769. rv770_program_engine_speed_parameters(rdev);
  1770. cypress_enable_display_gap(rdev);
  1771. rv770_program_vc(rdev);
  1772. if (pi->dynamic_pcie_gen2)
  1773. btc_enable_dynamic_pcie_gen2(rdev, true);
  1774. if (rv770_upload_firmware(rdev))
  1775. return -EINVAL;
  1776. cypress_get_table_locations(rdev);
  1777. btc_init_smc_table(rdev);
  1778. if (eg_pi->dynamic_ac_timing)
  1779. cypress_populate_mc_reg_table(rdev);
  1780. cypress_program_response_times(rdev);
  1781. r7xx_start_smc(rdev);
  1782. cypress_notify_smc_display_change(rdev, false);
  1783. cypress_enable_sclk_control(rdev, true);
  1784. if (eg_pi->memory_transition)
  1785. cypress_enable_mclk_control(rdev, true);
  1786. cypress_start_dpm(rdev);
  1787. if (pi->gfx_clock_gating)
  1788. btc_cg_clock_gating_enable(rdev, true);
  1789. if (pi->mg_clock_gating)
  1790. btc_mg_clock_gating_enable(rdev, true);
  1791. if (eg_pi->ls_clock_gating)
  1792. btc_ls_clock_gating_enable(rdev, true);
  1793. if (rdev->irq.installed &&
  1794. r600_is_internal_thermal_sensor(rdev->pm.int_thermal_type)) {
  1795. PPSMC_Result result;
  1796. rv770_set_thermal_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
  1797. rdev->irq.dpm_thermal = true;
  1798. radeon_irq_set(rdev);
  1799. result = rv770_send_msg_to_smc(rdev, PPSMC_MSG_EnableThermalInterrupt);
  1800. if (result != PPSMC_Result_OK)
  1801. DRM_DEBUG_KMS("Could not enable thermal interrupts.\n");
  1802. }
  1803. rv770_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, true);
  1804. btc_init_stutter_mode(rdev);
  1805. return 0;
  1806. };
  1807. void btc_dpm_disable(struct radeon_device *rdev)
  1808. {
  1809. struct rv7xx_power_info *pi = rv770_get_pi(rdev);
  1810. struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
  1811. if (!btc_dpm_enabled(rdev))
  1812. return;
  1813. rv770_clear_vc(rdev);
  1814. if (pi->thermal_protection)
  1815. rv770_enable_thermal_protection(rdev, false);
  1816. if (pi->dynamic_pcie_gen2)
  1817. btc_enable_dynamic_pcie_gen2(rdev, false);
  1818. if (rdev->irq.installed &&
  1819. r600_is_internal_thermal_sensor(rdev->pm.int_thermal_type)) {
  1820. rdev->irq.dpm_thermal = false;
  1821. radeon_irq_set(rdev);
  1822. }
  1823. if (pi->gfx_clock_gating)
  1824. btc_cg_clock_gating_enable(rdev, false);
  1825. if (pi->mg_clock_gating)
  1826. btc_mg_clock_gating_enable(rdev, false);
  1827. if (eg_pi->ls_clock_gating)
  1828. btc_ls_clock_gating_enable(rdev, false);
  1829. rv770_stop_dpm(rdev);
  1830. btc_reset_to_default(rdev);
  1831. btc_stop_smc(rdev);
  1832. cypress_enable_spread_spectrum(rdev, false);
  1833. }
  1834. void btc_dpm_setup_asic(struct radeon_device *rdev)
  1835. {
  1836. struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
  1837. rv770_get_memory_type(rdev);
  1838. rv740_read_clock_registers(rdev);
  1839. btc_read_arb_registers(rdev);
  1840. rv770_read_voltage_smio_registers(rdev);
  1841. if (eg_pi->pcie_performance_request)
  1842. cypress_advertise_gen2_capability(rdev);
  1843. rv770_get_pcie_gen2_status(rdev);
  1844. rv770_enable_acpi_pm(rdev);
  1845. }
  1846. int btc_dpm_init(struct radeon_device *rdev)
  1847. {
  1848. struct rv7xx_power_info *pi;
  1849. struct evergreen_power_info *eg_pi;
  1850. int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info);
  1851. u16 data_offset, size;
  1852. u8 frev, crev;
  1853. struct atom_clock_dividers dividers;
  1854. int ret;
  1855. eg_pi = kzalloc(sizeof(struct evergreen_power_info), GFP_KERNEL);
  1856. if (eg_pi == NULL)
  1857. return -ENOMEM;
  1858. rdev->pm.dpm.priv = eg_pi;
  1859. pi = &eg_pi->rv7xx;
  1860. rv770_get_max_vddc(rdev);
  1861. eg_pi->ulv.supported = false;
  1862. pi->acpi_vddc = 0;
  1863. eg_pi->acpi_vddci = 0;
  1864. pi->min_vddc_in_table = 0;
  1865. pi->max_vddc_in_table = 0;
  1866. ret = rv7xx_parse_power_table(rdev);
  1867. if (ret)
  1868. return ret;
  1869. if (rdev->pm.dpm.voltage_response_time == 0)
  1870. rdev->pm.dpm.voltage_response_time = R600_VOLTAGERESPONSETIME_DFLT;
  1871. if (rdev->pm.dpm.backbias_response_time == 0)
  1872. rdev->pm.dpm.backbias_response_time = R600_BACKBIASRESPONSETIME_DFLT;
  1873. ret = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM,
  1874. 0, false, &dividers);
  1875. if (ret)
  1876. pi->ref_div = dividers.ref_div + 1;
  1877. else
  1878. pi->ref_div = R600_REFERENCEDIVIDER_DFLT;
  1879. pi->mclk_strobe_mode_threshold = 40000;
  1880. pi->mclk_edc_enable_threshold = 40000;
  1881. eg_pi->mclk_edc_wr_enable_threshold = 40000;
  1882. pi->voltage_control =
  1883. radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC);
  1884. pi->mvdd_control =
  1885. radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC);
  1886. eg_pi->vddci_control =
  1887. radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI);
  1888. if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size,
  1889. &frev, &crev, &data_offset)) {
  1890. pi->sclk_ss = true;
  1891. pi->mclk_ss = true;
  1892. pi->dynamic_ss = true;
  1893. } else {
  1894. pi->sclk_ss = false;
  1895. pi->mclk_ss = false;
  1896. pi->dynamic_ss = true;
  1897. }
  1898. pi->asi = RV770_ASI_DFLT;
  1899. pi->pasi = CYPRESS_HASI_DFLT;
  1900. pi->vrc = CYPRESS_VRC_DFLT;
  1901. pi->power_gating = false;
  1902. pi->gfx_clock_gating = true;
  1903. pi->mg_clock_gating = true;
  1904. pi->mgcgtssm = true;
  1905. eg_pi->ls_clock_gating = false;
  1906. eg_pi->sclk_deep_sleep = false;
  1907. pi->dynamic_pcie_gen2 = true;
  1908. if (pi->gfx_clock_gating &&
  1909. (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE))
  1910. pi->thermal_protection = true;
  1911. else
  1912. pi->thermal_protection = false;
  1913. pi->display_gap = true;
  1914. if (rdev->flags & RADEON_IS_MOBILITY)
  1915. pi->dcodt = true;
  1916. else
  1917. pi->dcodt = false;
  1918. pi->ulps = true;
  1919. eg_pi->dynamic_ac_timing = true;
  1920. eg_pi->abm = true;
  1921. eg_pi->mcls = true;
  1922. eg_pi->light_sleep = true;
  1923. eg_pi->memory_transition = true;
  1924. #if defined(CONFIG_ACPI)
  1925. eg_pi->pcie_performance_request =
  1926. radeon_acpi_is_pcie_performance_request_supported(rdev);
  1927. #else
  1928. eg_pi->pcie_performance_request = false;
  1929. #endif
  1930. if (rdev->family == CHIP_BARTS)
  1931. eg_pi->dll_default_on = true;
  1932. else
  1933. eg_pi->dll_default_on = false;
  1934. eg_pi->sclk_deep_sleep = false;
  1935. if (ASIC_IS_LOMBOK(rdev))
  1936. pi->mclk_stutter_mode_threshold = 30000;
  1937. else
  1938. pi->mclk_stutter_mode_threshold = 0;
  1939. pi->sram_end = SMC_RAM_END;
  1940. return 0;
  1941. }
  1942. void btc_dpm_fini(struct radeon_device *rdev)
  1943. {
  1944. int i;
  1945. for (i = 0; i < rdev->pm.dpm.num_ps; i++) {
  1946. kfree(rdev->pm.dpm.ps[i].ps_priv);
  1947. }
  1948. kfree(rdev->pm.dpm.ps);
  1949. kfree(rdev->pm.dpm.priv);
  1950. }