DDRInit.c 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290
  1. #include "headers.h"
  2. #define DDR_DUMP_INTERNAL_DEVICE_MEMORY 0xBFC02B00
  3. #define MIPS_CLOCK_REG 0x0f000820
  4. //DDR INIT-133Mhz
  5. #define T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 12 //index for 0x0F007000
  6. static DDR_SET_NODE asT3_DDRSetting133MHz[]= {// # DPLL Clock Setting
  7. {0x0F000800,0x00007212},
  8. {0x0f000820,0x07F13FFF},
  9. {0x0f000810,0x00000F95},
  10. {0x0f000860,0x00000000},
  11. {0x0f000880,0x000003DD},
  12. // Changed source for X-bar and MIPS clock to APLL
  13. {0x0f000840,0x0FFF1B00},
  14. {0x0f000870,0x00000002},
  15. {0x0F00a044,0x1fffffff},
  16. {0x0F00a040,0x1f000000},
  17. {0x0F00a084,0x1Cffffff},
  18. {0x0F00a080,0x1C000000},
  19. {0x0F00a04C,0x0000000C},
  20. //Memcontroller Default values
  21. {0x0F007000,0x00010001},
  22. {0x0F007004,0x01010100},
  23. {0x0F007008,0x01000001},
  24. {0x0F00700c,0x00000000},
  25. {0x0F007010,0x01000000},
  26. {0x0F007014,0x01000100},
  27. {0x0F007018,0x01000000},
  28. {0x0F00701c,0x01020001},// POP - 0x00020001 Normal 0x01020001
  29. {0x0F007020,0x04030107}, //Normal - 0x04030107 POP - 0x05030107
  30. {0x0F007024,0x02000007},
  31. {0x0F007028,0x02020202},
  32. {0x0F00702c,0x0206060a},//ROB- 0x0205050a,//0x0206060a
  33. {0x0F007030,0x05000000},
  34. {0x0F007034,0x00000003},
  35. {0x0F007038,0x110a0200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200
  36. {0x0F00703C,0x02101010},//ROB - 0x02101010,//0x02101018},
  37. {0x0F007040,0x45751200},//ROB - 0x45751200,//0x450f1200},
  38. {0x0F007044,0x110a0d00},//ROB - 0x110a0d00//0x111f0d00
  39. {0x0F007048,0x081b0306},
  40. {0x0F00704c,0x00000000},
  41. {0x0F007050,0x0000001c},
  42. {0x0F007054,0x00000000},
  43. {0x0F007058,0x00000000},
  44. {0x0F00705c,0x00000000},
  45. {0x0F007060,0x0010246c},
  46. {0x0F007064,0x00000010},
  47. {0x0F007068,0x00000000},
  48. {0x0F00706c,0x00000001},
  49. {0x0F007070,0x00007000},
  50. {0x0F007074,0x00000000},
  51. {0x0F007078,0x00000000},
  52. {0x0F00707C,0x00000000},
  53. {0x0F007080,0x00000000},
  54. {0x0F007084,0x00000000},
  55. //# Enable BW improvement within memory controller
  56. {0x0F007094,0x00000104},
  57. //# Enable 2 ports within X-bar
  58. {0x0F00A000,0x00000016},
  59. //# Enable start bit within memory controller
  60. {0x0F007018,0x01010000}
  61. };
  62. //80Mhz
  63. #define T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 10 //index for 0x0F007000
  64. static DDR_SET_NODE asT3_DDRSetting80MHz[]= {// # DPLL Clock Setting
  65. {0x0f000810,0x00000F95},
  66. {0x0f000820,0x07f1ffff},
  67. {0x0f000860,0x00000000},
  68. {0x0f000880,0x000003DD},
  69. {0x0F00a044,0x1fffffff},
  70. {0x0F00a040,0x1f000000},
  71. {0x0F00a084,0x1Cffffff},
  72. {0x0F00a080,0x1C000000},
  73. {0x0F00a000,0x00000016},
  74. {0x0F00a04C,0x0000000C},
  75. //Memcontroller Default values
  76. {0x0F007000,0x00010001},
  77. {0x0F007004,0x01000000},
  78. {0x0F007008,0x01000001},
  79. {0x0F00700c,0x00000000},
  80. {0x0F007010,0x01000000},
  81. {0x0F007014,0x01000100},
  82. {0x0F007018,0x01000000},
  83. {0x0F00701c,0x01020000},
  84. {0x0F007020,0x04020107},
  85. {0x0F007024,0x00000007},
  86. {0x0F007028,0x02020201},
  87. {0x0F00702c,0x0204040a},
  88. {0x0F007030,0x04000000},
  89. {0x0F007034,0x00000002},
  90. {0x0F007038,0x1F060200},
  91. {0x0F00703C,0x1C22221F},
  92. {0x0F007040,0x8A006600},
  93. {0x0F007044,0x221a0800},
  94. {0x0F007048,0x02690204},
  95. {0x0F00704c,0x00000000},
  96. {0x0F007050,0x0000001c},
  97. {0x0F007054,0x00000000},
  98. {0x0F007058,0x00000000},
  99. {0x0F00705c,0x00000000},
  100. {0x0F007060,0x000A15D6},
  101. {0x0F007064,0x0000000A},
  102. {0x0F007068,0x00000000},
  103. {0x0F00706c,0x00000001},
  104. {0x0F007070,0x00004000},
  105. {0x0F007074,0x00000000},
  106. {0x0F007078,0x00000000},
  107. {0x0F00707C,0x00000000},
  108. {0x0F007080,0x00000000},
  109. {0x0F007084,0x00000000},
  110. {0x0F007094,0x00000104},
  111. //# Enable start bit within memory controller
  112. {0x0F007018,0x01010000}
  113. };
  114. //100Mhz
  115. #define T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 13 //index for 0x0F007000
  116. static DDR_SET_NODE asT3_DDRSetting100MHz[]= {// # DPLL Clock Setting
  117. {0x0F000800,0x00007008},
  118. {0x0f000810,0x00000F95},
  119. {0x0f000820,0x07F13E3F},
  120. {0x0f000860,0x00000000},
  121. {0x0f000880,0x000003DD},
  122. // Changed source for X-bar and MIPS clock to APLL
  123. //0x0f000840,0x0FFF1800,
  124. {0x0f000840,0x0FFF1B00},
  125. {0x0f000870,0x00000002},
  126. {0x0F00a044,0x1fffffff},
  127. {0x0F00a040,0x1f000000},
  128. {0x0F00a084,0x1Cffffff},
  129. {0x0F00a080,0x1C000000},
  130. {0x0F00a04C,0x0000000C},
  131. //# Enable 2 ports within X-bar
  132. {0x0F00A000,0x00000016},
  133. //Memcontroller Default values
  134. {0x0F007000,0x00010001},
  135. {0x0F007004,0x01010100},
  136. {0x0F007008,0x01000001},
  137. {0x0F00700c,0x00000000},
  138. {0x0F007010,0x01000000},
  139. {0x0F007014,0x01000100},
  140. {0x0F007018,0x01000000},
  141. {0x0F00701c,0x01020001}, // POP - 0x00020000 Normal 0x01020000
  142. {0x0F007020,0x04020107},//Normal - 0x04030107 POP - 0x05030107
  143. {0x0F007024,0x00000007},
  144. {0x0F007028,0x01020201},
  145. {0x0F00702c,0x0204040A},
  146. {0x0F007030,0x06000000},
  147. {0x0F007034,0x00000004},
  148. {0x0F007038,0x20080200},
  149. {0x0F00703C,0x02030320},
  150. {0x0F007040,0x6E7F1200},
  151. {0x0F007044,0x01190A00},
  152. {0x0F007048,0x06120305},//0x02690204 // 0x06120305
  153. {0x0F00704c,0x00000000},
  154. {0x0F007050,0x0000001C},
  155. {0x0F007054,0x00000000},
  156. {0x0F007058,0x00000000},
  157. {0x0F00705c,0x00000000},
  158. {0x0F007060,0x00082ED6},
  159. {0x0F007064,0x0000000A},
  160. {0x0F007068,0x00000000},
  161. {0x0F00706c,0x00000001},
  162. {0x0F007070,0x00005000},
  163. {0x0F007074,0x00000000},
  164. {0x0F007078,0x00000000},
  165. {0x0F00707C,0x00000000},
  166. {0x0F007080,0x00000000},
  167. {0x0F007084,0x00000000},
  168. //# Enable BW improvement within memory controller
  169. {0x0F007094,0x00000104},
  170. //# Enable start bit within memory controller
  171. {0x0F007018,0x01010000}
  172. };
  173. //Net T3B DDR Settings
  174. //DDR INIT-133Mhz
  175. static DDR_SET_NODE asDPLL_266MHZ[] = {
  176. {0x0F000800,0x00007212},
  177. {0x0f000820,0x07F13FFF},
  178. {0x0f000810,0x00000F95},
  179. {0x0f000860,0x00000000},
  180. {0x0f000880,0x000003DD},
  181. // Changed source for X-bar and MIPS clock to APLL
  182. {0x0f000840,0x0FFF1B00},
  183. {0x0f000870,0x00000002}
  184. };
  185. #define T3B_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 11 //index for 0x0F007000
  186. static DDR_SET_NODE asT3B_DDRSetting133MHz[] = {// # DPLL Clock Setting
  187. {0x0f000810,0x00000F95},
  188. {0x0f000810,0x00000F95},
  189. {0x0f000810,0x00000F95},
  190. {0x0f000820,0x07F13652},
  191. {0x0f000840,0x0FFF0800},
  192. // Changed source for X-bar and MIPS clock to APLL
  193. {0x0f000880,0x000003DD},
  194. {0x0f000860,0x00000000},
  195. // Changed source for X-bar and MIPS clock to APLL
  196. {0x0F00a044,0x1fffffff},
  197. {0x0F00a040,0x1f000000},
  198. {0x0F00a084,0x1Cffffff},
  199. {0x0F00a080,0x1C000000},
  200. //# Enable 2 ports within X-bar
  201. {0x0F00A000,0x00000016},
  202. //Memcontroller Default values
  203. {0x0F007000,0x00010001},
  204. {0x0F007004,0x01010100},
  205. {0x0F007008,0x01000001},
  206. {0x0F00700c,0x00000000},
  207. {0x0F007010,0x01000000},
  208. {0x0F007014,0x01000100},
  209. {0x0F007018,0x01000000},
  210. {0x0F00701c,0x01020001},// POP - 0x00020001 Normal 0x01020001
  211. {0x0F007020,0x04030107}, //Normal - 0x04030107 POP - 0x05030107
  212. {0x0F007024,0x02000007},
  213. {0x0F007028,0x02020202},
  214. {0x0F00702c,0x0206060a},//ROB- 0x0205050a,//0x0206060a
  215. {0x0F007030,0x05000000},
  216. {0x0F007034,0x00000003},
  217. {0x0F007038,0x130a0200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200
  218. {0x0F00703C,0x02101012},//ROB - 0x02101010,//0x02101018},
  219. {0x0F007040,0x457D1200},//ROB - 0x45751200,//0x450f1200},
  220. {0x0F007044,0x11130d00},//ROB - 0x110a0d00//0x111f0d00
  221. {0x0F007048,0x040D0306},
  222. {0x0F00704c,0x00000000},
  223. {0x0F007050,0x0000001c},
  224. {0x0F007054,0x00000000},
  225. {0x0F007058,0x00000000},
  226. {0x0F00705c,0x00000000},
  227. {0x0F007060,0x0010246c},
  228. {0x0F007064,0x00000012},
  229. {0x0F007068,0x00000000},
  230. {0x0F00706c,0x00000001},
  231. {0x0F007070,0x00007000},
  232. {0x0F007074,0x00000000},
  233. {0x0F007078,0x00000000},
  234. {0x0F00707C,0x00000000},
  235. {0x0F007080,0x00000000},
  236. {0x0F007084,0x00000000},
  237. //# Enable BW improvement within memory controller
  238. {0x0F007094,0x00000104},
  239. //# Enable start bit within memory controller
  240. {0x0F007018,0x01010000},
  241. };
  242. #define T3B_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 9 //index for 0x0F007000
  243. static DDR_SET_NODE asT3B_DDRSetting80MHz[] = {// # DPLL Clock Setting
  244. {0x0f000810,0x00000F95},
  245. {0x0f000820,0x07F13FFF},
  246. {0x0f000840,0x0FFF1F00},
  247. {0x0f000880,0x000003DD},
  248. {0x0f000860,0x00000000},
  249. {0x0F00a044,0x1fffffff},
  250. {0x0F00a040,0x1f000000},
  251. {0x0F00a084,0x1Cffffff},
  252. {0x0F00a080,0x1C000000},
  253. {0x0F00a000,0x00000016},
  254. //Memcontroller Default values
  255. {0x0F007000,0x00010001},
  256. {0x0F007004,0x01000000},
  257. {0x0F007008,0x01000001},
  258. {0x0F00700c,0x00000000},
  259. {0x0F007010,0x01000000},
  260. {0x0F007014,0x01000100},
  261. {0x0F007018,0x01000000},
  262. {0x0F00701c,0x01020000},
  263. {0x0F007020,0x04020107},
  264. {0x0F007024,0x00000007},
  265. {0x0F007028,0x02020201},
  266. {0x0F00702c,0x0204040a},
  267. {0x0F007030,0x04000000},
  268. {0x0F007034,0x02000002},
  269. {0x0F007038,0x1F060202},
  270. {0x0F00703C,0x1C22221F},
  271. {0x0F007040,0x8A006600},
  272. {0x0F007044,0x221a0800},
  273. {0x0F007048,0x02690204},
  274. {0x0F00704c,0x00000000},
  275. {0x0F007050,0x0100001c},
  276. {0x0F007054,0x00000000},
  277. {0x0F007058,0x00000000},
  278. {0x0F00705c,0x00000000},
  279. {0x0F007060,0x000A15D6},
  280. {0x0F007064,0x0000000A},
  281. {0x0F007068,0x00000000},
  282. {0x0F00706c,0x00000001},
  283. {0x0F007070,0x00004000},
  284. {0x0F007074,0x00000000},
  285. {0x0F007078,0x00000000},
  286. {0x0F00707C,0x00000000},
  287. {0x0F007080,0x00000000},
  288. {0x0F007084,0x00000000},
  289. {0x0F007094,0x00000104},
  290. //# Enable start bit within memory controller
  291. {0x0F007018,0x01010000}
  292. };
  293. //100Mhz
  294. #define T3B_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 9 //index for 0x0F007000
  295. static DDR_SET_NODE asT3B_DDRSetting100MHz[] = {// # DPLL Clock Setting
  296. {0x0f000810,0x00000F95},
  297. {0x0f000820,0x07F1369B},
  298. {0x0f000840,0x0FFF0800},
  299. {0x0f000880,0x000003DD},
  300. {0x0f000860,0x00000000},
  301. {0x0F00a044,0x1fffffff},
  302. {0x0F00a040,0x1f000000},
  303. {0x0F00a084,0x1Cffffff},
  304. {0x0F00a080,0x1C000000},
  305. //# Enable 2 ports within X-bar
  306. {0x0F00A000,0x00000016},
  307. //Memcontroller Default values
  308. {0x0F007000,0x00010001},
  309. {0x0F007004,0x01010100},
  310. {0x0F007008,0x01000001},
  311. {0x0F00700c,0x00000000},
  312. {0x0F007010,0x01000000},
  313. {0x0F007014,0x01000100},
  314. {0x0F007018,0x01000000},
  315. {0x0F00701c,0x01020000}, // POP - 0x00020000 Normal 0x01020000
  316. {0x0F007020,0x04020107},//Normal - 0x04030107 POP - 0x05030107
  317. {0x0F007024,0x00000007},
  318. {0x0F007028,0x01020201},
  319. {0x0F00702c,0x0204040A},
  320. {0x0F007030,0x06000000},
  321. {0x0F007034,0x02000004},
  322. {0x0F007038,0x20080200},
  323. {0x0F00703C,0x02030320},
  324. {0x0F007040,0x6E7F1200},
  325. {0x0F007044,0x01190A00},
  326. {0x0F007048,0x06120305},//0x02690204 // 0x06120305
  327. {0x0F00704c,0x00000000},
  328. {0x0F007050,0x0100001C},
  329. {0x0F007054,0x00000000},
  330. {0x0F007058,0x00000000},
  331. {0x0F00705c,0x00000000},
  332. {0x0F007060,0x00082ED6},
  333. {0x0F007064,0x0000000A},
  334. {0x0F007068,0x00000000},
  335. {0x0F00706c,0x00000001},
  336. {0x0F007070,0x00005000},
  337. {0x0F007074,0x00000000},
  338. {0x0F007078,0x00000000},
  339. {0x0F00707C,0x00000000},
  340. {0x0F007080,0x00000000},
  341. {0x0F007084,0x00000000},
  342. //# Enable BW improvement within memory controller
  343. {0x0F007094,0x00000104},
  344. //# Enable start bit within memory controller
  345. {0x0F007018,0x01010000}
  346. };
  347. #define T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 9 //index for 0x0F007000
  348. static DDR_SET_NODE asT3LP_DDRSetting133MHz[]= {// # DPLL Clock Setting
  349. {0x0f000820,0x03F1365B},
  350. {0x0f000810,0x00002F95},
  351. {0x0f000880,0x000003DD},
  352. // Changed source for X-bar and MIPS clock to APLL
  353. {0x0f000840,0x0FFF0000},
  354. {0x0f000860,0x00000000},
  355. {0x0F00a044,0x1fffffff},
  356. {0x0F00a040,0x1f000000},
  357. {0x0F00a084,0x1Cffffff},
  358. {0x0F00a080,0x1C000000},
  359. {0x0F00A000,0x00000016},
  360. //Memcontroller Default values
  361. {0x0F007000,0x00010001},
  362. {0x0F007004,0x01010100},
  363. {0x0F007008,0x01000001},
  364. {0x0F00700c,0x00000000},
  365. {0x0F007010,0x01000000},
  366. {0x0F007014,0x01000100},
  367. {0x0F007018,0x01000000},
  368. {0x0F00701c,0x01020001},// POP - 0x00020001 Normal 0x01020001
  369. {0x0F007020,0x04030107}, //Normal - 0x04030107 POP - 0x05030107
  370. {0x0F007024,0x02000007},
  371. {0x0F007028,0x02020200},
  372. {0x0F00702c,0x0206060a},//ROB- 0x0205050a,//0x0206060a
  373. {0x0F007030,0x05000000},
  374. {0x0F007034,0x00000003},
  375. {0x0F007038,0x200a0200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200
  376. {0x0F00703C,0x02101020},//ROB - 0x02101010,//0x02101018,
  377. {0x0F007040,0x45711200},//ROB - 0x45751200,//0x450f1200,
  378. {0x0F007044,0x110D0D00},//ROB - 0x110a0d00//0x111f0d00
  379. {0x0F007048,0x04080306},
  380. {0x0F00704c,0x00000000},
  381. {0x0F007050,0x0100001c},
  382. {0x0F007054,0x00000000},
  383. {0x0F007058,0x00000000},
  384. {0x0F00705c,0x00000000},
  385. {0x0F007060,0x0010245F},
  386. {0x0F007064,0x00000010},
  387. {0x0F007068,0x00000000},
  388. {0x0F00706c,0x00000001},
  389. {0x0F007070,0x00007000},
  390. {0x0F007074,0x00000000},
  391. {0x0F007078,0x00000000},
  392. {0x0F00707C,0x00000000},
  393. {0x0F007080,0x00000000},
  394. {0x0F007084,0x00000000},
  395. {0x0F007088,0x01000001},
  396. {0x0F00708c,0x00000101},
  397. {0x0F007090,0x00000000},
  398. //# Enable BW improvement within memory controller
  399. {0x0F007094,0x00040000},
  400. {0x0F007098,0x00000000},
  401. {0x0F0070c8,0x00000104},
  402. //# Enable 2 ports within X-bar
  403. //# Enable start bit within memory controller
  404. {0x0F007018,0x01010000}
  405. };
  406. #define T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 11 //index for 0x0F007000
  407. static DDR_SET_NODE asT3LP_DDRSetting100MHz[]= {// # DPLL Clock Setting
  408. {0x0f000810,0x00002F95},
  409. {0x0f000820,0x03F1369B},
  410. {0x0f000840,0x0fff0000},
  411. {0x0f000860,0x00000000},
  412. {0x0f000880,0x000003DD},
  413. // Changed source for X-bar and MIPS clock to APLL
  414. {0x0f000840,0x0FFF0000},
  415. {0x0F00a044,0x1fffffff},
  416. {0x0F00a040,0x1f000000},
  417. {0x0F00a084,0x1Cffffff},
  418. {0x0F00a080,0x1C000000},
  419. //Memcontroller Default values
  420. {0x0F007000,0x00010001},
  421. {0x0F007004,0x01010100},
  422. {0x0F007008,0x01000001},
  423. {0x0F00700c,0x00000000},
  424. {0x0F007010,0x01000000},
  425. {0x0F007014,0x01000100},
  426. {0x0F007018,0x01000000},
  427. {0x0F00701c,0x01020000},// POP - 0x00020001 Normal 0x01020001
  428. {0x0F007020,0x04020107}, //Normal - 0x04030107 POP - 0x05030107
  429. {0x0F007024,0x00000007},
  430. {0x0F007028,0x01020200},
  431. {0x0F00702c,0x0204040a},//ROB- 0x0205050a,//0x0206060a
  432. {0x0F007030,0x06000000},
  433. {0x0F007034,0x00000004},
  434. {0x0F007038,0x1F080200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200
  435. {0x0F00703C,0x0203031F},//ROB - 0x02101010,//0x02101018,
  436. {0x0F007040,0x6e001200},//ROB - 0x45751200,//0x450f1200,
  437. {0x0F007044,0x011a0a00},//ROB - 0x110a0d00//0x111f0d00
  438. {0x0F007048,0x03000305},
  439. {0x0F00704c,0x00000000},
  440. {0x0F007050,0x0100001c},
  441. {0x0F007054,0x00000000},
  442. {0x0F007058,0x00000000},
  443. {0x0F00705c,0x00000000},
  444. {0x0F007060,0x00082ED6},
  445. {0x0F007064,0x0000000A},
  446. {0x0F007068,0x00000000},
  447. {0x0F00706c,0x00000001},
  448. {0x0F007070,0x00005000},
  449. {0x0F007074,0x00000000},
  450. {0x0F007078,0x00000000},
  451. {0x0F00707C,0x00000000},
  452. {0x0F007080,0x00000000},
  453. {0x0F007084,0x00000000},
  454. {0x0F007088,0x01000001},
  455. {0x0F00708c,0x00000101},
  456. {0x0F007090,0x00000000},
  457. {0x0F007094,0x00010000},
  458. {0x0F007098,0x00000000},
  459. {0x0F0070C8,0x00000104},
  460. //# Enable 2 ports within X-bar
  461. {0x0F00A000,0x00000016},
  462. //# Enable start bit within memory controller
  463. {0x0F007018,0x01010000}
  464. };
  465. #define T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 9 //index for 0x0F007000
  466. static DDR_SET_NODE asT3LP_DDRSetting80MHz[]= {// # DPLL Clock Setting
  467. {0x0f000820,0x07F13FFF},
  468. {0x0f000810,0x00002F95},
  469. {0x0f000860,0x00000000},
  470. {0x0f000880,0x000003DD},
  471. {0x0f000840,0x0FFF1F00},
  472. {0x0F00a044,0x1fffffff},
  473. {0x0F00a040,0x1f000000},
  474. {0x0F00a084,0x1Cffffff},
  475. {0x0F00a080,0x1C000000},
  476. {0x0F00A000,0x00000016},
  477. {0x0f007000,0x00010001},
  478. {0x0f007004,0x01000000},
  479. {0x0f007008,0x01000001},
  480. {0x0f00700c,0x00000000},
  481. {0x0f007010,0x01000000},
  482. {0x0f007014,0x01000100},
  483. {0x0f007018,0x01000000},
  484. {0x0f00701c,0x01020000},
  485. {0x0f007020,0x04020107},
  486. {0x0f007024,0x00000007},
  487. {0x0f007028,0x02020200},
  488. {0x0f00702c,0x0204040a},
  489. {0x0f007030,0x04000000},
  490. {0x0f007034,0x00000002},
  491. {0x0f007038,0x1d060200},
  492. {0x0f00703c,0x1c22221d},
  493. {0x0f007040,0x8A116600},
  494. {0x0f007044,0x222d0800},
  495. {0x0f007048,0x02690204},
  496. {0x0f00704c,0x00000000},
  497. {0x0f007050,0x0100001c},
  498. {0x0f007054,0x00000000},
  499. {0x0f007058,0x00000000},
  500. {0x0f00705c,0x00000000},
  501. {0x0f007060,0x000A15D6},
  502. {0x0f007064,0x0000000A},
  503. {0x0f007068,0x00000000},
  504. {0x0f00706c,0x00000001},
  505. {0x0f007070,0x00004000},
  506. {0x0f007074,0x00000000},
  507. {0x0f007078,0x00000000},
  508. {0x0f00707c,0x00000000},
  509. {0x0f007080,0x00000000},
  510. {0x0f007084,0x00000000},
  511. {0x0f007088,0x01000001},
  512. {0x0f00708c,0x00000101},
  513. {0x0f007090,0x00000000},
  514. {0x0f007094,0x00010000},
  515. {0x0f007098,0x00000000},
  516. {0x0F0070C8,0x00000104},
  517. {0x0F007018,0x01010000}
  518. };
  519. ///T3 LP-B (UMA-B)
  520. #define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_160MHZ 7 //index for 0x0F007000
  521. static DDR_SET_NODE asT3LPB_DDRSetting160MHz[]= {// # DPLL Clock Setting
  522. {0x0f000820,0x03F137DB},
  523. {0x0f000810,0x01842795},
  524. {0x0f000860,0x00000000},
  525. {0x0f000880,0x000003DD},
  526. {0x0f000840,0x0FFF0400},
  527. {0x0F00a044,0x1fffffff},
  528. {0x0F00a040,0x1f000000},
  529. {0x0f003050,0x00000021},//this is flash/eeprom clock divisor which set the flash clock to 20 MHz
  530. {0x0F00a084,0x1Cffffff},//Now dump from her in internal memory
  531. {0x0F00a080,0x1C000000},
  532. {0x0F00A000,0x00000016},
  533. {0x0f007000,0x00010001},
  534. {0x0f007004,0x01000001},
  535. {0x0f007008,0x01000101},
  536. {0x0f00700c,0x00000000},
  537. {0x0f007010,0x01000100},
  538. {0x0f007014,0x01000100},
  539. {0x0f007018,0x01000000},
  540. {0x0f00701c,0x01020000},
  541. {0x0f007020,0x04030107},
  542. {0x0f007024,0x02000007},
  543. {0x0f007028,0x02020200},
  544. {0x0f00702c,0x0206060a},
  545. {0x0f007030,0x050d0d00},
  546. {0x0f007034,0x00000003},
  547. {0x0f007038,0x170a0200},
  548. {0x0f00703c,0x02101012},
  549. {0x0f007040,0x45161200},
  550. {0x0f007044,0x11250c00},
  551. {0x0f007048,0x04da0307},
  552. {0x0f00704c,0x00000000},
  553. {0x0f007050,0x0000001c},
  554. {0x0f007054,0x00000000},
  555. {0x0f007058,0x00000000},
  556. {0x0f00705c,0x00000000},
  557. {0x0f007060,0x00142bb6},
  558. {0x0f007064,0x20430014},
  559. {0x0f007068,0x00000000},
  560. {0x0f00706c,0x00000001},
  561. {0x0f007070,0x00009000},
  562. {0x0f007074,0x00000000},
  563. {0x0f007078,0x00000000},
  564. {0x0f00707c,0x00000000},
  565. {0x0f007080,0x00000000},
  566. {0x0f007084,0x00000000},
  567. {0x0f007088,0x01000001},
  568. {0x0f00708c,0x00000101},
  569. {0x0f007090,0x00000000},
  570. {0x0f007094,0x00040000},
  571. {0x0f007098,0x00000000},
  572. {0x0F0070C8,0x00000104},
  573. {0x0F007018,0x01010000}
  574. };
  575. #define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ 7 //index for 0x0F007000
  576. static DDR_SET_NODE asT3LPB_DDRSetting133MHz[]= {// # DPLL Clock Setting
  577. {0x0f000820,0x03F1365B},
  578. {0x0f000810,0x00002F95},
  579. {0x0f000880,0x000003DD},
  580. // Changed source for X-bar and MIPS clock to APLL
  581. {0x0f000840,0x0FFF0000},
  582. {0x0f000860,0x00000000},
  583. {0x0F00a044,0x1fffffff},
  584. {0x0F00a040,0x1f000000},
  585. {0x0f003050,0x00000021},//flash/eeprom clock divisor which set the flash clock to 20 MHz
  586. {0x0F00a084,0x1Cffffff},//dump from here in internal memory
  587. {0x0F00a080,0x1C000000},
  588. {0x0F00A000,0x00000016},
  589. //Memcontroller Default values
  590. {0x0F007000,0x00010001},
  591. {0x0F007004,0x01010100},
  592. {0x0F007008,0x01000001},
  593. {0x0F00700c,0x00000000},
  594. {0x0F007010,0x01000000},
  595. {0x0F007014,0x01000100},
  596. {0x0F007018,0x01000000},
  597. {0x0F00701c,0x01020001},// POP - 0x00020001 Normal 0x01020001
  598. {0x0F007020,0x04030107}, //Normal - 0x04030107 POP - 0x05030107
  599. {0x0F007024,0x02000007},
  600. {0x0F007028,0x02020200},
  601. {0x0F00702c,0x0206060a},//ROB- 0x0205050a,//0x0206060a
  602. {0x0F007030,0x05000000},
  603. {0x0F007034,0x00000003},
  604. {0x0F007038,0x190a0200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200
  605. {0x0F00703C,0x02101017},//ROB - 0x02101010,//0x02101018,
  606. {0x0F007040,0x45171200},//ROB - 0x45751200,//0x450f1200,
  607. {0x0F007044,0x11290D00},//ROB - 0x110a0d00//0x111f0d00
  608. {0x0F007048,0x04080306},
  609. {0x0F00704c,0x00000000},
  610. {0x0F007050,0x0100001c},
  611. {0x0F007054,0x00000000},
  612. {0x0F007058,0x00000000},
  613. {0x0F00705c,0x00000000},
  614. {0x0F007060,0x0010245F},
  615. {0x0F007064,0x00000010},
  616. {0x0F007068,0x00000000},
  617. {0x0F00706c,0x00000001},
  618. {0x0F007070,0x00007000},
  619. {0x0F007074,0x00000000},
  620. {0x0F007078,0x00000000},
  621. {0x0F00707C,0x00000000},
  622. {0x0F007080,0x00000000},
  623. {0x0F007084,0x00000000},
  624. {0x0F007088,0x01000001},
  625. {0x0F00708c,0x00000101},
  626. {0x0F007090,0x00000000},
  627. //# Enable BW improvement within memory controller
  628. {0x0F007094,0x00040000},
  629. {0x0F007098,0x00000000},
  630. {0x0F0070c8,0x00000104},
  631. //# Enable 2 ports within X-bar
  632. //# Enable start bit within memory controller
  633. {0x0F007018,0x01010000}
  634. };
  635. #define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ 8 //index for 0x0F007000
  636. static DDR_SET_NODE asT3LPB_DDRSetting100MHz[]= {// # DPLL Clock Setting
  637. {0x0f000810,0x00002F95},
  638. {0x0f000820,0x03F1369B},
  639. {0x0f000840,0x0fff0000},
  640. {0x0f000860,0x00000000},
  641. {0x0f000880,0x000003DD},
  642. // Changed source for X-bar and MIPS clock to APLL
  643. {0x0f000840,0x0FFF0000},
  644. {0x0F00a044,0x1fffffff},
  645. {0x0F00a040,0x1f000000},
  646. {0x0f003050,0x00000021},//flash/eeprom clock divisor which set the flash clock to 20 MHz
  647. {0x0F00a084,0x1Cffffff}, //dump from here in internal memory
  648. {0x0F00a080,0x1C000000},
  649. //Memcontroller Default values
  650. {0x0F007000,0x00010001},
  651. {0x0F007004,0x01010100},
  652. {0x0F007008,0x01000001},
  653. {0x0F00700c,0x00000000},
  654. {0x0F007010,0x01000000},
  655. {0x0F007014,0x01000100},
  656. {0x0F007018,0x01000000},
  657. {0x0F00701c,0x01020000},// POP - 0x00020001 Normal 0x01020001
  658. {0x0F007020,0x04020107}, //Normal - 0x04030107 POP - 0x05030107
  659. {0x0F007024,0x00000007},
  660. {0x0F007028,0x01020200},
  661. {0x0F00702c,0x0204040a},//ROB- 0x0205050a,//0x0206060a
  662. {0x0F007030,0x06000000},
  663. {0x0F007034,0x00000004},
  664. {0x0F007038,0x1F080200},//ROB - 0x110a0200,//0x180a0200,// 0x1f0a0200
  665. {0x0F00703C,0x0203031F},//ROB - 0x02101010,//0x02101018,
  666. {0x0F007040,0x6e001200},//ROB - 0x45751200,//0x450f1200,
  667. {0x0F007044,0x011a0a00},//ROB - 0x110a0d00//0x111f0d00
  668. {0x0F007048,0x03000305},
  669. {0x0F00704c,0x00000000},
  670. {0x0F007050,0x0100001c},
  671. {0x0F007054,0x00000000},
  672. {0x0F007058,0x00000000},
  673. {0x0F00705c,0x00000000},
  674. {0x0F007060,0x00082ED6},
  675. {0x0F007064,0x0000000A},
  676. {0x0F007068,0x00000000},
  677. {0x0F00706c,0x00000001},
  678. {0x0F007070,0x00005000},
  679. {0x0F007074,0x00000000},
  680. {0x0F007078,0x00000000},
  681. {0x0F00707C,0x00000000},
  682. {0x0F007080,0x00000000},
  683. {0x0F007084,0x00000000},
  684. {0x0F007088,0x01000001},
  685. {0x0F00708c,0x00000101},
  686. {0x0F007090,0x00000000},
  687. {0x0F007094,0x00010000},
  688. {0x0F007098,0x00000000},
  689. {0x0F0070C8,0x00000104},
  690. //# Enable 2 ports within X-bar
  691. {0x0F00A000,0x00000016},
  692. //# Enable start bit within memory controller
  693. {0x0F007018,0x01010000}
  694. };
  695. #define T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ 7 //index for 0x0F007000
  696. static DDR_SET_NODE asT3LPB_DDRSetting80MHz[]= {// # DPLL Clock Setting
  697. {0x0f000820,0x07F13FFF},
  698. {0x0f000810,0x00002F95},
  699. {0x0f000860,0x00000000},
  700. {0x0f000880,0x000003DD},
  701. {0x0f000840,0x0FFF1F00},
  702. {0x0F00a044,0x1fffffff},
  703. {0x0F00a040,0x1f000000},
  704. {0x0f003050,0x00000021},//flash/eeprom clock divisor which set the flash clock to 20 MHz
  705. {0x0F00a084,0x1Cffffff},// dump from here in internal memory
  706. {0x0F00a080,0x1C000000},
  707. {0x0F00A000,0x00000016},
  708. {0x0f007000,0x00010001},
  709. {0x0f007004,0x01000000},
  710. {0x0f007008,0x01000001},
  711. {0x0f00700c,0x00000000},
  712. {0x0f007010,0x01000000},
  713. {0x0f007014,0x01000100},
  714. {0x0f007018,0x01000000},
  715. {0x0f00701c,0x01020000},
  716. {0x0f007020,0x04020107},
  717. {0x0f007024,0x00000007},
  718. {0x0f007028,0x02020200},
  719. {0x0f00702c,0x0204040a},
  720. {0x0f007030,0x04000000},
  721. {0x0f007034,0x00000002},
  722. {0x0f007038,0x1d060200},
  723. {0x0f00703c,0x1c22221d},
  724. {0x0f007040,0x8A116600},
  725. {0x0f007044,0x222d0800},
  726. {0x0f007048,0x02690204},
  727. {0x0f00704c,0x00000000},
  728. {0x0f007050,0x0100001c},
  729. {0x0f007054,0x00000000},
  730. {0x0f007058,0x00000000},
  731. {0x0f00705c,0x00000000},
  732. {0x0f007060,0x000A15D6},
  733. {0x0f007064,0x0000000A},
  734. {0x0f007068,0x00000000},
  735. {0x0f00706c,0x00000001},
  736. {0x0f007070,0x00004000},
  737. {0x0f007074,0x00000000},
  738. {0x0f007078,0x00000000},
  739. {0x0f00707c,0x00000000},
  740. {0x0f007080,0x00000000},
  741. {0x0f007084,0x00000000},
  742. {0x0f007088,0x01000001},
  743. {0x0f00708c,0x00000101},
  744. {0x0f007090,0x00000000},
  745. {0x0f007094,0x00010000},
  746. {0x0f007098,0x00000000},
  747. {0x0F0070C8,0x00000104},
  748. {0x0F007018,0x01010000}
  749. };
  750. int ddr_init(MINI_ADAPTER *Adapter)
  751. {
  752. PDDR_SETTING psDDRSetting=NULL;
  753. ULONG RegCount=0;
  754. UINT value = 0;
  755. UINT uiResetValue = 0;
  756. UINT uiClockSetting = 0;
  757. int retval = STATUS_SUCCESS;
  758. switch (Adapter->chip_id)
  759. {
  760. case 0xbece3200:
  761. switch (Adapter->DDRSetting)
  762. {
  763. case DDR_80_MHZ:
  764. psDDRSetting=asT3LP_DDRSetting80MHz;
  765. RegCount=(sizeof(asT3LP_DDRSetting80MHz)/
  766. sizeof(DDR_SETTING));
  767. break;
  768. case DDR_100_MHZ:
  769. psDDRSetting=asT3LP_DDRSetting100MHz;
  770. RegCount=(sizeof(asT3LP_DDRSetting100MHz)/
  771. sizeof(DDR_SETTING));
  772. break;
  773. case DDR_133_MHZ:
  774. psDDRSetting=asT3LP_DDRSetting133MHz;
  775. RegCount=(sizeof(asT3LP_DDRSetting133MHz)/
  776. sizeof(DDR_SETTING));
  777. if(Adapter->bMipsConfig == MIPS_200_MHZ)
  778. {
  779. uiClockSetting = 0x03F13652;
  780. }
  781. else
  782. {
  783. uiClockSetting = 0x03F1365B;
  784. }
  785. break;
  786. default:
  787. return -EINVAL;
  788. }
  789. break;
  790. case T3LPB:
  791. case BCS220_2:
  792. case BCS220_2BC:
  793. case BCS250_BC:
  794. case BCS220_3 :
  795. /* Set bit 2 and bit 6 to 1 for BBIC 2mA drive
  796. * (please check current value and additionally set these bits)
  797. */
  798. if( (Adapter->chip_id != BCS220_2) &&
  799. (Adapter->chip_id != BCS220_2BC) &&
  800. (Adapter->chip_id != BCS220_3) )
  801. {
  802. retval= rdmalt(Adapter,(UINT)0x0f000830, &uiResetValue, sizeof(uiResetValue));
  803. if(retval < 0) {
  804. BCM_DEBUG_PRINT(Adapter,CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __FUNCTION__, __LINE__);
  805. return retval;
  806. }
  807. uiResetValue |= 0x44;
  808. retval = wrmalt(Adapter,(UINT)0x0f000830, &uiResetValue, sizeof(uiResetValue));
  809. if(retval < 0) {
  810. BCM_DEBUG_PRINT(Adapter,CMHOST, WRM, DBG_LVL_ALL, "%s:%d WRM failed\n", __FUNCTION__, __LINE__);
  811. return retval;
  812. }
  813. }
  814. switch(Adapter->DDRSetting)
  815. {
  816. case DDR_80_MHZ:
  817. psDDRSetting = asT3LPB_DDRSetting80MHz;
  818. RegCount=(sizeof(asT3B_DDRSetting80MHz)/
  819. sizeof(DDR_SETTING));
  820. break;
  821. case DDR_100_MHZ:
  822. psDDRSetting=asT3LPB_DDRSetting100MHz;
  823. RegCount=(sizeof(asT3B_DDRSetting100MHz)/
  824. sizeof(DDR_SETTING));
  825. break;
  826. case DDR_133_MHZ:
  827. psDDRSetting = asT3LPB_DDRSetting133MHz;
  828. RegCount=(sizeof(asT3B_DDRSetting133MHz)/
  829. sizeof(DDR_SETTING));
  830. if(Adapter->bMipsConfig == MIPS_200_MHZ)
  831. {
  832. uiClockSetting = 0x03F13652;
  833. }
  834. else
  835. {
  836. uiClockSetting = 0x03F1365B;
  837. }
  838. break;
  839. case DDR_160_MHZ:
  840. psDDRSetting = asT3LPB_DDRSetting160MHz;
  841. RegCount = sizeof(asT3LPB_DDRSetting160MHz)/sizeof(DDR_SETTING);
  842. if(Adapter->bMipsConfig == MIPS_200_MHZ)
  843. {
  844. uiClockSetting = 0x03F137D2;
  845. }
  846. else
  847. {
  848. uiClockSetting = 0x03F137DB;
  849. }
  850. }
  851. break;
  852. case 0xbece0110:
  853. case 0xbece0120:
  854. case 0xbece0121:
  855. case 0xbece0130:
  856. case 0xbece0300:
  857. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "DDR Setting: %x\n", Adapter->DDRSetting);
  858. switch (Adapter->DDRSetting)
  859. {
  860. case DDR_80_MHZ:
  861. psDDRSetting = asT3_DDRSetting80MHz;
  862. RegCount = (sizeof(asT3_DDRSetting80MHz)/
  863. sizeof(DDR_SETTING));
  864. break;
  865. case DDR_100_MHZ:
  866. psDDRSetting = asT3_DDRSetting100MHz;
  867. RegCount = (sizeof(asT3_DDRSetting100MHz)/
  868. sizeof(DDR_SETTING));
  869. break;
  870. case DDR_133_MHZ:
  871. psDDRSetting = asT3_DDRSetting133MHz;
  872. RegCount = (sizeof(asT3_DDRSetting133MHz)/
  873. sizeof(DDR_SETTING));
  874. break;
  875. default:
  876. return -EINVAL;
  877. }
  878. case 0xbece0310:
  879. {
  880. switch (Adapter->DDRSetting)
  881. {
  882. case DDR_80_MHZ:
  883. psDDRSetting = asT3B_DDRSetting80MHz;
  884. RegCount=(sizeof(asT3B_DDRSetting80MHz)/
  885. sizeof(DDR_SETTING));
  886. break;
  887. case DDR_100_MHZ:
  888. psDDRSetting=asT3B_DDRSetting100MHz;
  889. RegCount=(sizeof(asT3B_DDRSetting100MHz)/
  890. sizeof(DDR_SETTING));
  891. break;
  892. case DDR_133_MHZ:
  893. if(Adapter->bDPLLConfig == PLL_266_MHZ)//266Mhz PLL selected.
  894. {
  895. memcpy(asT3B_DDRSetting133MHz, asDPLL_266MHZ,
  896. sizeof(asDPLL_266MHZ));
  897. psDDRSetting = asT3B_DDRSetting133MHz;
  898. RegCount=(sizeof(asT3B_DDRSetting133MHz)/
  899. sizeof(DDR_SETTING));
  900. }
  901. else
  902. {
  903. psDDRSetting = asT3B_DDRSetting133MHz;
  904. RegCount=(sizeof(asT3B_DDRSetting133MHz)/
  905. sizeof(DDR_SETTING));
  906. if(Adapter->bMipsConfig == MIPS_200_MHZ)
  907. {
  908. uiClockSetting = 0x07F13652;
  909. }
  910. else
  911. {
  912. uiClockSetting = 0x07F1365B;
  913. }
  914. }
  915. break;
  916. default:
  917. return -EINVAL;
  918. }
  919. break;
  920. }
  921. default:
  922. return -EINVAL;
  923. }
  924. value=0;
  925. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_INITEXIT, DRV_ENTRY, DBG_LVL_ALL, "Register Count is =%lu\n", RegCount);
  926. while(RegCount && !retval)
  927. {
  928. if(uiClockSetting && psDDRSetting->ulRegAddress == MIPS_CLOCK_REG)
  929. {
  930. value = uiClockSetting;
  931. }
  932. else
  933. {
  934. value = psDDRSetting->ulRegValue;
  935. }
  936. retval = wrmalt(Adapter, psDDRSetting->ulRegAddress, &value, sizeof(value));
  937. if(STATUS_SUCCESS != retval) {
  938. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"%s:%d\n", __FUNCTION__, __LINE__);
  939. break;
  940. }
  941. RegCount--;
  942. psDDRSetting++;
  943. }
  944. if(Adapter->chip_id >= 0xbece3300 )
  945. {
  946. mdelay(3);
  947. if( (Adapter->chip_id != BCS220_2)&&
  948. (Adapter->chip_id != BCS220_2BC)&&
  949. (Adapter->chip_id != BCS220_3))
  950. {
  951. /* drive MDDR to half in case of UMA-B: */
  952. uiResetValue = 0x01010001;
  953. retval = wrmalt(Adapter, (UINT)0x0F007018, &uiResetValue, sizeof(uiResetValue));
  954. if(retval < 0) {
  955. BCM_DEBUG_PRINT(Adapter,CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __FUNCTION__, __LINE__);
  956. return retval;
  957. }
  958. uiResetValue = 0x00040020;
  959. retval = wrmalt(Adapter, (UINT)0x0F007094, &uiResetValue, sizeof(uiResetValue));
  960. if(retval < 0) {
  961. BCM_DEBUG_PRINT(Adapter,CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __FUNCTION__, __LINE__);
  962. return retval;
  963. }
  964. uiResetValue = 0x01020101;
  965. retval = wrmalt(Adapter, (UINT)0x0F00701c, &uiResetValue, sizeof(uiResetValue));
  966. if(retval < 0) {
  967. BCM_DEBUG_PRINT(Adapter,CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __FUNCTION__, __LINE__);
  968. return retval;
  969. }
  970. uiResetValue = 0x01010000;
  971. retval = wrmalt(Adapter, (UINT)0x0F007018, &uiResetValue, sizeof(uiResetValue));
  972. if(retval < 0) {
  973. BCM_DEBUG_PRINT(Adapter,CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __FUNCTION__, __LINE__);
  974. return retval;
  975. }
  976. }
  977. mdelay(3);
  978. /* DC/DC standby change...
  979. * This is to be done only for Hybrid PMU mode.
  980. * with the current h/w there is no way to detect this.
  981. * and since we dont have internal PMU lets do it under UMA-B chip id.
  982. * we will change this when we will have internal PMU.
  983. */
  984. if(Adapter->PmuMode == HYBRID_MODE_7C)
  985. {
  986. retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue));
  987. if(retval < 0) {
  988. BCM_DEBUG_PRINT(Adapter,CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __FUNCTION__, __LINE__);
  989. return retval;
  990. }
  991. retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue));
  992. if(retval < 0) {
  993. BCM_DEBUG_PRINT(Adapter,CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __FUNCTION__, __LINE__);
  994. return retval;
  995. }
  996. uiResetValue = 0x1322a8;
  997. retval = wrmalt(Adapter, (UINT)0x0f000d1c, &uiResetValue, sizeof(uiResetValue));
  998. if(retval < 0) {
  999. BCM_DEBUG_PRINT(Adapter,CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __FUNCTION__, __LINE__);
  1000. return retval;
  1001. }
  1002. retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue));
  1003. if(retval < 0) {
  1004. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __FUNCTION__, __LINE__);
  1005. return retval;
  1006. }
  1007. retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue));
  1008. if(retval < 0) {
  1009. BCM_DEBUG_PRINT(Adapter,CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __FUNCTION__, __LINE__);
  1010. return retval;
  1011. }
  1012. uiResetValue = 0x132296;
  1013. retval = wrmalt(Adapter, (UINT)0x0f000d14, &uiResetValue, sizeof(uiResetValue));
  1014. if(retval < 0) {
  1015. BCM_DEBUG_PRINT(Adapter,CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __FUNCTION__, __LINE__);
  1016. return retval;
  1017. }
  1018. }
  1019. else if(Adapter->PmuMode == HYBRID_MODE_6 )
  1020. {
  1021. retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue));
  1022. if(retval < 0) {
  1023. BCM_DEBUG_PRINT(Adapter,CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __FUNCTION__, __LINE__);
  1024. return retval;
  1025. }
  1026. retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue));
  1027. if(retval < 0) {
  1028. BCM_DEBUG_PRINT(Adapter,CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __FUNCTION__, __LINE__);
  1029. return retval;
  1030. }
  1031. uiResetValue = 0x6003229a;
  1032. retval = wrmalt(Adapter, (UINT)0x0f000d14, &uiResetValue, sizeof(uiResetValue));
  1033. if(retval < 0) {
  1034. BCM_DEBUG_PRINT(Adapter,CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __FUNCTION__, __LINE__);
  1035. return retval;
  1036. }
  1037. retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue));
  1038. if(retval < 0) {
  1039. BCM_DEBUG_PRINT(Adapter,CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __FUNCTION__, __LINE__);
  1040. return retval;
  1041. }
  1042. retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue));
  1043. if(retval < 0) {
  1044. BCM_DEBUG_PRINT(Adapter,CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __FUNCTION__, __LINE__);
  1045. return retval;
  1046. }
  1047. uiResetValue = 0x1322a8;
  1048. retval = wrmalt(Adapter, (UINT)0x0f000d1c, &uiResetValue, sizeof(uiResetValue));
  1049. if(retval < 0) {
  1050. BCM_DEBUG_PRINT(Adapter,CMHOST, RDM, DBG_LVL_ALL, "%s:%d RDM failed\n", __FUNCTION__, __LINE__);
  1051. return retval;
  1052. }
  1053. }
  1054. }
  1055. Adapter->bDDRInitDone = TRUE;
  1056. return retval;
  1057. }
  1058. int download_ddr_settings(PMINI_ADAPTER Adapter)
  1059. {
  1060. PDDR_SET_NODE psDDRSetting=NULL;
  1061. ULONG RegCount=0;
  1062. unsigned long ul_ddr_setting_load_addr = DDR_DUMP_INTERNAL_DEVICE_MEMORY;
  1063. UINT value = 0;
  1064. int retval = STATUS_SUCCESS;
  1065. BOOLEAN bOverrideSelfRefresh = FALSE;
  1066. switch (Adapter->chip_id)
  1067. {
  1068. case 0xbece3200:
  1069. switch (Adapter->DDRSetting)
  1070. {
  1071. case DDR_80_MHZ:
  1072. psDDRSetting = asT3LP_DDRSetting80MHz;
  1073. RegCount = (sizeof(asT3LP_DDRSetting80MHz)/sizeof(DDR_SET_NODE));
  1074. RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ;
  1075. psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
  1076. break;
  1077. case DDR_100_MHZ:
  1078. psDDRSetting = asT3LP_DDRSetting100MHz;
  1079. RegCount = (sizeof(asT3LP_DDRSetting100MHz)/sizeof(DDR_SET_NODE));
  1080. RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ;
  1081. psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
  1082. break;
  1083. case DDR_133_MHZ:
  1084. bOverrideSelfRefresh = TRUE;
  1085. psDDRSetting = asT3LP_DDRSetting133MHz;
  1086. RegCount = (sizeof(asT3LP_DDRSetting133MHz)/sizeof(DDR_SET_NODE));
  1087. RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
  1088. psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
  1089. break;
  1090. default:
  1091. return -EINVAL;
  1092. }
  1093. break;
  1094. case T3LPB:
  1095. case BCS220_2:
  1096. case BCS220_2BC:
  1097. case BCS250_BC:
  1098. case BCS220_3 :
  1099. switch (Adapter->DDRSetting)
  1100. {
  1101. case DDR_80_MHZ:
  1102. psDDRSetting = asT3LPB_DDRSetting80MHz;
  1103. RegCount=(sizeof(asT3LPB_DDRSetting80MHz)/sizeof(DDR_SET_NODE));
  1104. RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ;
  1105. psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
  1106. break;
  1107. case DDR_100_MHZ:
  1108. psDDRSetting = asT3LPB_DDRSetting100MHz;
  1109. RegCount = (sizeof(asT3LPB_DDRSetting100MHz)/sizeof(DDR_SET_NODE));
  1110. RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ;
  1111. psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
  1112. break;
  1113. case DDR_133_MHZ:
  1114. bOverrideSelfRefresh = TRUE;
  1115. psDDRSetting = asT3LPB_DDRSetting133MHz;
  1116. RegCount = (sizeof(asT3LPB_DDRSetting133MHz)/sizeof(DDR_SET_NODE));
  1117. RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
  1118. psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
  1119. break;
  1120. case DDR_160_MHZ:
  1121. bOverrideSelfRefresh = TRUE;
  1122. psDDRSetting = asT3LPB_DDRSetting160MHz;
  1123. RegCount = sizeof(asT3LPB_DDRSetting160MHz)/sizeof(DDR_SET_NODE);
  1124. RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_160MHZ;
  1125. psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_160MHZ;
  1126. break;
  1127. default:
  1128. return -EINVAL;
  1129. }
  1130. break;
  1131. case 0xbece0300:
  1132. switch (Adapter->DDRSetting)
  1133. {
  1134. case DDR_80_MHZ:
  1135. psDDRSetting = asT3_DDRSetting80MHz;
  1136. RegCount = (sizeof(asT3_DDRSetting80MHz)/sizeof(DDR_SET_NODE));
  1137. RegCount-=T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ;
  1138. psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
  1139. break;
  1140. case DDR_100_MHZ:
  1141. psDDRSetting = asT3_DDRSetting100MHz;
  1142. RegCount = (sizeof(asT3_DDRSetting100MHz)/sizeof(DDR_SET_NODE));
  1143. RegCount-=T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ;
  1144. psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
  1145. break;
  1146. case DDR_133_MHZ:
  1147. psDDRSetting = asT3_DDRSetting133MHz;
  1148. RegCount = (sizeof(asT3_DDRSetting133MHz)/sizeof(DDR_SET_NODE));
  1149. RegCount-=T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
  1150. psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
  1151. break;
  1152. default:
  1153. return -EINVAL;
  1154. }
  1155. break;
  1156. case 0xbece0310:
  1157. {
  1158. switch (Adapter->DDRSetting)
  1159. {
  1160. case DDR_80_MHZ:
  1161. psDDRSetting = asT3B_DDRSetting80MHz;
  1162. RegCount = (sizeof(asT3B_DDRSetting80MHz)/sizeof(DDR_SET_NODE));
  1163. RegCount -= T3B_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ;
  1164. psDDRSetting += T3B_SKIP_CLOCK_PROGRAM_DUMP_80MHZ;
  1165. break;
  1166. case DDR_100_MHZ:
  1167. psDDRSetting = asT3B_DDRSetting100MHz;
  1168. RegCount = (sizeof(asT3B_DDRSetting100MHz)/sizeof(DDR_SET_NODE));
  1169. RegCount -= T3B_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ;
  1170. psDDRSetting += T3B_SKIP_CLOCK_PROGRAM_DUMP_100MHZ;
  1171. break;
  1172. case DDR_133_MHZ:
  1173. bOverrideSelfRefresh = TRUE;
  1174. psDDRSetting = asT3B_DDRSetting133MHz;
  1175. RegCount = (sizeof(asT3B_DDRSetting133MHz)/sizeof(DDR_SET_NODE));
  1176. RegCount -= T3B_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ;
  1177. psDDRSetting += T3B_SKIP_CLOCK_PROGRAM_DUMP_133MHZ;
  1178. break;
  1179. }
  1180. break;
  1181. }
  1182. default:
  1183. return -EINVAL;
  1184. }
  1185. //total number of Register that has to be dumped
  1186. value =RegCount ;
  1187. retval = wrmalt(Adapter, ul_ddr_setting_load_addr, &value, sizeof(value));
  1188. if(retval)
  1189. {
  1190. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"%s:%d\n", __FUNCTION__, __LINE__);
  1191. return retval;
  1192. }
  1193. ul_ddr_setting_load_addr+=sizeof(ULONG);
  1194. /*signature */
  1195. value =(0x1d1e0dd0);
  1196. retval = wrmalt(Adapter, ul_ddr_setting_load_addr, &value, sizeof(value));
  1197. if(retval)
  1198. {
  1199. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"%s:%d\n", __FUNCTION__, __LINE__);
  1200. return retval;
  1201. }
  1202. ul_ddr_setting_load_addr+=sizeof(ULONG);
  1203. RegCount*=(sizeof(DDR_SETTING)/sizeof(ULONG));
  1204. while(RegCount && !retval)
  1205. {
  1206. value = psDDRSetting->ulRegAddress ;
  1207. retval = wrmalt( Adapter, ul_ddr_setting_load_addr, &value, sizeof(value));
  1208. ul_ddr_setting_load_addr+=sizeof(ULONG);
  1209. if(!retval)
  1210. {
  1211. if(bOverrideSelfRefresh && (psDDRSetting->ulRegAddress == 0x0F007018))
  1212. {
  1213. value = (psDDRSetting->ulRegValue |(1<<8));
  1214. if(STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr,
  1215. &value, sizeof(value))){
  1216. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"%s:%d\n", __FUNCTION__, __LINE__);
  1217. break;
  1218. }
  1219. }
  1220. else
  1221. {
  1222. value = psDDRSetting->ulRegValue;
  1223. if(STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr ,
  1224. &value, sizeof(value))){
  1225. BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"%s:%d\n", __FUNCTION__, __LINE__);
  1226. break;
  1227. }
  1228. }
  1229. }
  1230. ul_ddr_setting_load_addr+=sizeof(ULONG);
  1231. RegCount--;
  1232. psDDRSetting++;
  1233. }
  1234. return retval;
  1235. }