micropatch.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  1. /* Microcode patches for the CPM as supplied by Motorola.
  2. * This is the one for IIC/SPI. There is a newer one that
  3. * also relocates SMC2, but this would require additional changes
  4. * to uart.c, so I am holding off on that for a moment.
  5. */
  6. #include <linux/init.h>
  7. #include <linux/errno.h>
  8. #include <linux/sched.h>
  9. #include <linux/kernel.h>
  10. #include <linux/param.h>
  11. #include <linux/string.h>
  12. #include <linux/mm.h>
  13. #include <linux/interrupt.h>
  14. #include <asm/irq.h>
  15. #include <asm/page.h>
  16. #include <asm/pgtable.h>
  17. #include <asm/8xx_immap.h>
  18. #include <asm/cpm.h>
  19. #include <asm/cpm1.h>
  20. /*
  21. * I2C/SPI relocation patch arrays.
  22. */
  23. #ifdef CONFIG_I2C_SPI_UCODE_PATCH
  24. static uint patch_2000[] __initdata = {
  25. 0x7FFFEFD9,
  26. 0x3FFD0000,
  27. 0x7FFB49F7,
  28. 0x7FF90000,
  29. 0x5FEFADF7,
  30. 0x5F89ADF7,
  31. 0x5FEFAFF7,
  32. 0x5F89AFF7,
  33. 0x3A9CFBC8,
  34. 0xE7C0EDF0,
  35. 0x77C1E1BB,
  36. 0xF4DC7F1D,
  37. 0xABAD932F,
  38. 0x4E08FDCF,
  39. 0x6E0FAFF8,
  40. 0x7CCF76CF,
  41. 0xFD1FF9CF,
  42. 0xABF88DC6,
  43. 0xAB5679F7,
  44. 0xB0937383,
  45. 0xDFCE79F7,
  46. 0xB091E6BB,
  47. 0xE5BBE74F,
  48. 0xB3FA6F0F,
  49. 0x6FFB76CE,
  50. 0xEE0DF9CF,
  51. 0x2BFBEFEF,
  52. 0xCFEEF9CF,
  53. 0x76CEAD24,
  54. 0x90B2DF9A,
  55. 0x7FDDD0BF,
  56. 0x4BF847FD,
  57. 0x7CCF76CE,
  58. 0xCFEF7E1F,
  59. 0x7F1D7DFD,
  60. 0xF0B6EF71,
  61. 0x7FC177C1,
  62. 0xFBC86079,
  63. 0xE722FBC8,
  64. 0x5FFFDFFF,
  65. 0x5FB2FFFB,
  66. 0xFBC8F3C8,
  67. 0x94A67F01,
  68. 0x7F1D5F39,
  69. 0xAFE85F5E,
  70. 0xFFDFDF96,
  71. 0xCB9FAF7D,
  72. 0x5FC1AFED,
  73. 0x8C1C5FC1,
  74. 0xAFDD5FC3,
  75. 0xDF9A7EFD,
  76. 0xB0B25FB2,
  77. 0xFFFEABAD,
  78. 0x5FB2FFFE,
  79. 0x5FCE600B,
  80. 0xE6BB600B,
  81. 0x5FCEDFC6,
  82. 0x27FBEFDF,
  83. 0x5FC8CFDE,
  84. 0x3A9CE7C0,
  85. 0xEDF0F3C8,
  86. 0x7F0154CD,
  87. 0x7F1D2D3D,
  88. 0x363A7570,
  89. 0x7E0AF1CE,
  90. 0x37EF2E68,
  91. 0x7FEE10EC,
  92. 0xADF8EFDE,
  93. 0xCFEAE52F,
  94. 0x7D0FE12B,
  95. 0xF1CE5F65,
  96. 0x7E0A4DF8,
  97. 0xCFEA5F72,
  98. 0x7D0BEFEE,
  99. 0xCFEA5F74,
  100. 0xE522EFDE,
  101. 0x5F74CFDA,
  102. 0x0B627385,
  103. 0xDF627E0A,
  104. 0x30D8145B,
  105. 0xBFFFF3C8,
  106. 0x5FFFDFFF,
  107. 0xA7F85F5E,
  108. 0xBFFE7F7D,
  109. 0x10D31450,
  110. 0x5F36BFFF,
  111. 0xAF785F5E,
  112. 0xBFFDA7F8,
  113. 0x5F36BFFE,
  114. 0x77FD30C0,
  115. 0x4E08FDCF,
  116. 0xE5FF6E0F,
  117. 0xAFF87E1F,
  118. 0x7E0FFD1F,
  119. 0xF1CF5F1B,
  120. 0xABF80D5E,
  121. 0x5F5EFFEF,
  122. 0x79F730A2,
  123. 0xAFDD5F34,
  124. 0x47F85F34,
  125. 0xAFED7FDD,
  126. 0x50B24978,
  127. 0x47FD7F1D,
  128. 0x7DFD70AD,
  129. 0xEF717EC1,
  130. 0x6BA47F01,
  131. 0x2D267EFD,
  132. 0x30DE5F5E,
  133. 0xFFFD5F5E,
  134. 0xFFEF5F5E,
  135. 0xFFDF0CA0,
  136. 0xAFED0A9E,
  137. 0xAFDD0C3A,
  138. 0x5F3AAFBD,
  139. 0x7FBDB082,
  140. 0x5F8247F8
  141. };
  142. static uint patch_2f00[] __initdata = {
  143. 0x3E303430,
  144. 0x34343737,
  145. 0xABF7BF9B,
  146. 0x994B4FBD,
  147. 0xBD599493,
  148. 0x349FFF37,
  149. 0xFB9B177D,
  150. 0xD9936956,
  151. 0xBBFDD697,
  152. 0xBDD2FD11,
  153. 0x31DB9BB3,
  154. 0x63139637,
  155. 0x93733693,
  156. 0x193137F7,
  157. 0x331737AF,
  158. 0x7BB9B999,
  159. 0xBB197957,
  160. 0x7FDFD3D5,
  161. 0x73B773F7,
  162. 0x37933B99,
  163. 0x1D115316,
  164. 0x99315315,
  165. 0x31694BF4,
  166. 0xFBDBD359,
  167. 0x31497353,
  168. 0x76956D69,
  169. 0x7B9D9693,
  170. 0x13131979,
  171. 0x79376935
  172. };
  173. #endif
  174. /*
  175. * I2C/SPI/SMC1 relocation patch arrays.
  176. */
  177. #ifdef CONFIG_I2C_SPI_SMC1_UCODE_PATCH
  178. static uint patch_2000[] __initdata = {
  179. 0x3fff0000,
  180. 0x3ffd0000,
  181. 0x3ffb0000,
  182. 0x3ff90000,
  183. 0x5f13eff8,
  184. 0x5eb5eff8,
  185. 0x5f88adf7,
  186. 0x5fefadf7,
  187. 0x3a9cfbc8,
  188. 0x77cae1bb,
  189. 0xf4de7fad,
  190. 0xabae9330,
  191. 0x4e08fdcf,
  192. 0x6e0faff8,
  193. 0x7ccf76cf,
  194. 0xfdaff9cf,
  195. 0xabf88dc8,
  196. 0xab5879f7,
  197. 0xb0925d8d,
  198. 0xdfd079f7,
  199. 0xb090e6bb,
  200. 0xe5bbe74f,
  201. 0x9e046f0f,
  202. 0x6ffb76ce,
  203. 0xee0cf9cf,
  204. 0x2bfbefef,
  205. 0xcfeef9cf,
  206. 0x76cead23,
  207. 0x90b3df99,
  208. 0x7fddd0c1,
  209. 0x4bf847fd,
  210. 0x7ccf76ce,
  211. 0xcfef77ca,
  212. 0x7eaf7fad,
  213. 0x7dfdf0b7,
  214. 0xef7a7fca,
  215. 0x77cafbc8,
  216. 0x6079e722,
  217. 0xfbc85fff,
  218. 0xdfff5fb3,
  219. 0xfffbfbc8,
  220. 0xf3c894a5,
  221. 0xe7c9edf9,
  222. 0x7f9a7fad,
  223. 0x5f36afe8,
  224. 0x5f5bffdf,
  225. 0xdf95cb9e,
  226. 0xaf7d5fc3,
  227. 0xafed8c1b,
  228. 0x5fc3afdd,
  229. 0x5fc5df99,
  230. 0x7efdb0b3,
  231. 0x5fb3fffe,
  232. 0xabae5fb3,
  233. 0xfffe5fd0,
  234. 0x600be6bb,
  235. 0x600b5fd0,
  236. 0xdfc827fb,
  237. 0xefdf5fca,
  238. 0xcfde3a9c,
  239. 0xe7c9edf9,
  240. 0xf3c87f9e,
  241. 0x54ca7fed,
  242. 0x2d3a3637,
  243. 0x756f7e9a,
  244. 0xf1ce37ef,
  245. 0x2e677fee,
  246. 0x10ebadf8,
  247. 0xefdecfea,
  248. 0xe52f7d9f,
  249. 0xe12bf1ce,
  250. 0x5f647e9a,
  251. 0x4df8cfea,
  252. 0x5f717d9b,
  253. 0xefeecfea,
  254. 0x5f73e522,
  255. 0xefde5f73,
  256. 0xcfda0b61,
  257. 0x5d8fdf61,
  258. 0xe7c9edf9,
  259. 0x7e9a30d5,
  260. 0x1458bfff,
  261. 0xf3c85fff,
  262. 0xdfffa7f8,
  263. 0x5f5bbffe,
  264. 0x7f7d10d0,
  265. 0x144d5f33,
  266. 0xbfffaf78,
  267. 0x5f5bbffd,
  268. 0xa7f85f33,
  269. 0xbffe77fd,
  270. 0x30bd4e08,
  271. 0xfdcfe5ff,
  272. 0x6e0faff8,
  273. 0x7eef7e9f,
  274. 0xfdeff1cf,
  275. 0x5f17abf8,
  276. 0x0d5b5f5b,
  277. 0xffef79f7,
  278. 0x309eafdd,
  279. 0x5f3147f8,
  280. 0x5f31afed,
  281. 0x7fdd50af,
  282. 0x497847fd,
  283. 0x7f9e7fed,
  284. 0x7dfd70a9,
  285. 0xef7e7ece,
  286. 0x6ba07f9e,
  287. 0x2d227efd,
  288. 0x30db5f5b,
  289. 0xfffd5f5b,
  290. 0xffef5f5b,
  291. 0xffdf0c9c,
  292. 0xafed0a9a,
  293. 0xafdd0c37,
  294. 0x5f37afbd,
  295. 0x7fbdb081,
  296. 0x5f8147f8,
  297. 0x3a11e710,
  298. 0xedf0ccdd,
  299. 0xf3186d0a,
  300. 0x7f0e5f06,
  301. 0x7fedbb38,
  302. 0x3afe7468,
  303. 0x7fedf4fc,
  304. 0x8ffbb951,
  305. 0xb85f77fd,
  306. 0xb0df5ddd,
  307. 0xdefe7fed,
  308. 0x90e1e74d,
  309. 0x6f0dcbf7,
  310. 0xe7decfed,
  311. 0xcb74cfed,
  312. 0xcfeddf6d,
  313. 0x91714f74,
  314. 0x5dd2deef,
  315. 0x9e04e7df,
  316. 0xefbb6ffb,
  317. 0xe7ef7f0e,
  318. 0x9e097fed,
  319. 0xebdbeffa,
  320. 0xeb54affb,
  321. 0x7fea90d7,
  322. 0x7e0cf0c3,
  323. 0xbffff318,
  324. 0x5fffdfff,
  325. 0xac59efea,
  326. 0x7fce1ee5,
  327. 0xe2ff5ee1,
  328. 0xaffbe2ff,
  329. 0x5ee3affb,
  330. 0xf9cc7d0f,
  331. 0xaef8770f,
  332. 0x7d0fb0c6,
  333. 0xeffbbfff,
  334. 0xcfef5ede,
  335. 0x7d0fbfff,
  336. 0x5ede4cf8,
  337. 0x7fddd0bf,
  338. 0x49f847fd,
  339. 0x7efdf0bb,
  340. 0x7fedfffd,
  341. 0x7dfdf0b7,
  342. 0xef7e7e1e,
  343. 0x5ede7f0e,
  344. 0x3a11e710,
  345. 0xedf0ccab,
  346. 0xfb18ad2e,
  347. 0x1ea9bbb8,
  348. 0x74283b7e,
  349. 0x73c2e4bb,
  350. 0x2ada4fb8,
  351. 0xdc21e4bb,
  352. 0xb2a1ffbf,
  353. 0x5e2c43f8,
  354. 0xfc87e1bb,
  355. 0xe74ffd91,
  356. 0x6f0f4fe8,
  357. 0xc7ba32e2,
  358. 0xf396efeb,
  359. 0x600b4f78,
  360. 0xe5bb760b,
  361. 0x53acaef8,
  362. 0x4ef88b0e,
  363. 0xcfef9e09,
  364. 0xabf8751f,
  365. 0xefef5bac,
  366. 0x741f4fe8,
  367. 0x751e760d,
  368. 0x7fdbf081,
  369. 0x741cafce,
  370. 0xefcc7fce,
  371. 0x751e70ac,
  372. 0x741ce7bb,
  373. 0x3372cfed,
  374. 0xafdbefeb,
  375. 0xe5bb760b,
  376. 0x53f2aef8,
  377. 0xafe8e7eb,
  378. 0x4bf8771e,
  379. 0x7e247fed,
  380. 0x4fcbe2cc,
  381. 0x7fbc30a9,
  382. 0x7b0f7a0f,
  383. 0x34d577fd,
  384. 0x308b5db7,
  385. 0xde553e5f,
  386. 0xaf78741f,
  387. 0x741f30f0,
  388. 0xcfef5e2c,
  389. 0x741f3eac,
  390. 0xafb8771e,
  391. 0x5e677fed,
  392. 0x0bd3e2cc,
  393. 0x741ccfec,
  394. 0xe5ca53cd,
  395. 0x6fcb4f74,
  396. 0x5dadde4b,
  397. 0x2ab63d38,
  398. 0x4bb3de30,
  399. 0x751f741c,
  400. 0x6c42effa,
  401. 0xefea7fce,
  402. 0x6ffc30be,
  403. 0xefec3fca,
  404. 0x30b3de2e,
  405. 0xadf85d9e,
  406. 0xaf7daefd,
  407. 0x5d9ede2e,
  408. 0x5d9eafdd,
  409. 0x761f10ac,
  410. 0x1da07efd,
  411. 0x30adfffe,
  412. 0x4908fb18,
  413. 0x5fffdfff,
  414. 0xafbb709b,
  415. 0x4ef85e67,
  416. 0xadf814ad,
  417. 0x7a0f70ad,
  418. 0xcfef50ad,
  419. 0x7a0fde30,
  420. 0x5da0afed,
  421. 0x3c12780f,
  422. 0xefef780f,
  423. 0xefef790f,
  424. 0xa7f85e0f,
  425. 0xffef790f,
  426. 0xefef790f,
  427. 0x14adde2e,
  428. 0x5d9eadfd,
  429. 0x5e2dfffb,
  430. 0xe79addfd,
  431. 0xeff96079,
  432. 0x607ae79a,
  433. 0xddfceff9,
  434. 0x60795dff,
  435. 0x607acfef,
  436. 0xefefefdf,
  437. 0xefbfef7f,
  438. 0xeeffedff,
  439. 0xebffe7ff,
  440. 0xafefafdf,
  441. 0xafbfaf7f,
  442. 0xaeffadff,
  443. 0xabffa7ff,
  444. 0x6fef6fdf,
  445. 0x6fbf6f7f,
  446. 0x6eff6dff,
  447. 0x6bff67ff,
  448. 0x2fef2fdf,
  449. 0x2fbf2f7f,
  450. 0x2eff2dff,
  451. 0x2bff27ff,
  452. 0x4e08fd1f,
  453. 0xe5ff6e0f,
  454. 0xaff87eef,
  455. 0x7e0ffdef,
  456. 0xf11f6079,
  457. 0xabf8f542,
  458. 0x7e0af11c,
  459. 0x37cfae3a,
  460. 0x7fec90be,
  461. 0xadf8efdc,
  462. 0xcfeae52f,
  463. 0x7d0fe12b,
  464. 0xf11c6079,
  465. 0x7e0a4df8,
  466. 0xcfea5dc4,
  467. 0x7d0befec,
  468. 0xcfea5dc6,
  469. 0xe522efdc,
  470. 0x5dc6cfda,
  471. 0x4e08fd1f,
  472. 0x6e0faff8,
  473. 0x7c1f761f,
  474. 0xfdeff91f,
  475. 0x6079abf8,
  476. 0x761cee24,
  477. 0xf91f2bfb,
  478. 0xefefcfec,
  479. 0xf91f6079,
  480. 0x761c27fb,
  481. 0xefdf5da7,
  482. 0xcfdc7fdd,
  483. 0xd09c4bf8,
  484. 0x47fd7c1f,
  485. 0x761ccfcf,
  486. 0x7eef7fed,
  487. 0x7dfdf093,
  488. 0xef7e7f1e,
  489. 0x771efb18,
  490. 0x6079e722,
  491. 0xe6bbe5bb,
  492. 0xae0ae5bb,
  493. 0x600bae85,
  494. 0xe2bbe2bb,
  495. 0xe2bbe2bb,
  496. 0xaf02e2bb,
  497. 0xe2bb2ff9,
  498. 0x6079e2bb
  499. };
  500. static uint patch_2f00[] __initdata = {
  501. 0x30303030,
  502. 0x3e3e3434,
  503. 0xabbf9b99,
  504. 0x4b4fbdbd,
  505. 0x59949334,
  506. 0x9fff37fb,
  507. 0x9b177dd9,
  508. 0x936956bb,
  509. 0xfbdd697b,
  510. 0xdd2fd113,
  511. 0x1db9f7bb,
  512. 0x36313963,
  513. 0x79373369,
  514. 0x3193137f,
  515. 0x7331737a,
  516. 0xf7bb9b99,
  517. 0x9bb19795,
  518. 0x77fdfd3d,
  519. 0x573b773f,
  520. 0x737933f7,
  521. 0xb991d115,
  522. 0x31699315,
  523. 0x31531694,
  524. 0xbf4fbdbd,
  525. 0x35931497,
  526. 0x35376956,
  527. 0xbd697b9d,
  528. 0x96931313,
  529. 0x19797937,
  530. 0x6935af78,
  531. 0xb9b3baa3,
  532. 0xb8788683,
  533. 0x368f78f7,
  534. 0x87778733,
  535. 0x3ffffb3b,
  536. 0x8e8f78b8,
  537. 0x1d118e13,
  538. 0xf3ff3f8b,
  539. 0x6bd8e173,
  540. 0xd1366856,
  541. 0x68d1687b,
  542. 0x3daf78b8,
  543. 0x3a3a3f87,
  544. 0x8f81378f,
  545. 0xf876f887,
  546. 0x77fd8778,
  547. 0x737de8d6,
  548. 0xbbf8bfff,
  549. 0xd8df87f7,
  550. 0xfd876f7b,
  551. 0x8bfff8bd,
  552. 0x8683387d,
  553. 0xb873d87b,
  554. 0x3b8fd7f8,
  555. 0xf7338883,
  556. 0xbb8ee1f8,
  557. 0xef837377,
  558. 0x3337b836,
  559. 0x817d11f8,
  560. 0x7378b878,
  561. 0xd3368b7d,
  562. 0xed731b7d,
  563. 0x833731f3,
  564. 0xf22f3f23
  565. };
  566. static uint patch_2e00[] __initdata = {
  567. 0x27eeeeee,
  568. 0xeeeeeeee,
  569. 0xeeeeeeee,
  570. 0xeeeeeeee,
  571. 0xee4bf4fb,
  572. 0xdbd259bb,
  573. 0x1979577f,
  574. 0xdfd2d573,
  575. 0xb773f737,
  576. 0x4b4fbdbd,
  577. 0x25b9b177,
  578. 0xd2d17376,
  579. 0x956bbfdd,
  580. 0x697bdd2f,
  581. 0xff9f79ff,
  582. 0xff9ff22f
  583. };
  584. #endif
  585. /*
  586. * USB SOF patch arrays.
  587. */
  588. #ifdef CONFIG_USB_SOF_UCODE_PATCH
  589. static uint patch_2000[] __initdata = {
  590. 0x7fff0000,
  591. 0x7ffd0000,
  592. 0x7ffb0000,
  593. 0x49f7ba5b,
  594. 0xba383ffb,
  595. 0xf9b8b46d,
  596. 0xe5ab4e07,
  597. 0xaf77bffe,
  598. 0x3f7bbf79,
  599. 0xba5bba38,
  600. 0xe7676076,
  601. 0x60750000
  602. };
  603. static uint patch_2f00[] __initdata = {
  604. 0x3030304c,
  605. 0xcab9e441,
  606. 0xa1aaf220
  607. };
  608. #endif
  609. void __init cpm_load_patch(cpm8xx_t *cp)
  610. {
  611. volatile uint *dp; /* Dual-ported RAM. */
  612. volatile cpm8xx_t *commproc;
  613. #if defined(CONFIG_I2C_SPI_UCODE_PATCH) || \
  614. defined(CONFIG_I2C_SPI_SMC1_UCODE_PATCH)
  615. volatile iic_t *iip;
  616. volatile struct spi_pram *spp;
  617. #ifdef CONFIG_I2C_SPI_SMC1_UCODE_PATCH
  618. volatile smc_uart_t *smp;
  619. #endif
  620. #endif
  621. int i;
  622. commproc = cp;
  623. #ifdef CONFIG_USB_SOF_UCODE_PATCH
  624. commproc->cp_rccr = 0;
  625. dp = (uint *)(commproc->cp_dpmem);
  626. for (i=0; i<(sizeof(patch_2000)/4); i++)
  627. *dp++ = patch_2000[i];
  628. dp = (uint *)&(commproc->cp_dpmem[0x0f00]);
  629. for (i=0; i<(sizeof(patch_2f00)/4); i++)
  630. *dp++ = patch_2f00[i];
  631. commproc->cp_rccr = 0x0009;
  632. printk("USB SOF microcode patch installed\n");
  633. #endif /* CONFIG_USB_SOF_UCODE_PATCH */
  634. #if defined(CONFIG_I2C_SPI_UCODE_PATCH) || \
  635. defined(CONFIG_I2C_SPI_SMC1_UCODE_PATCH)
  636. commproc->cp_rccr = 0;
  637. dp = (uint *)(commproc->cp_dpmem);
  638. for (i=0; i<(sizeof(patch_2000)/4); i++)
  639. *dp++ = patch_2000[i];
  640. dp = (uint *)&(commproc->cp_dpmem[0x0f00]);
  641. for (i=0; i<(sizeof(patch_2f00)/4); i++)
  642. *dp++ = patch_2f00[i];
  643. iip = (iic_t *)&commproc->cp_dparam[PROFF_IIC];
  644. # define RPBASE 0x0500
  645. iip->iic_rpbase = RPBASE;
  646. /* Put SPI above the IIC, also 32-byte aligned.
  647. */
  648. i = (RPBASE + sizeof(iic_t) + 31) & ~31;
  649. spp = (struct spi_pram *)&commproc->cp_dparam[PROFF_SPI];
  650. spp->rpbase = i;
  651. # if defined(CONFIG_I2C_SPI_UCODE_PATCH)
  652. commproc->cp_cpmcr1 = 0x802a;
  653. commproc->cp_cpmcr2 = 0x8028;
  654. commproc->cp_cpmcr3 = 0x802e;
  655. commproc->cp_cpmcr4 = 0x802c;
  656. commproc->cp_rccr = 1;
  657. printk("I2C/SPI microcode patch installed.\n");
  658. # endif /* CONFIG_I2C_SPI_UCODE_PATCH */
  659. # if defined(CONFIG_I2C_SPI_SMC1_UCODE_PATCH)
  660. dp = (uint *)&(commproc->cp_dpmem[0x0e00]);
  661. for (i=0; i<(sizeof(patch_2e00)/4); i++)
  662. *dp++ = patch_2e00[i];
  663. commproc->cp_cpmcr1 = 0x8080;
  664. commproc->cp_cpmcr2 = 0x808a;
  665. commproc->cp_cpmcr3 = 0x8028;
  666. commproc->cp_cpmcr4 = 0x802a;
  667. commproc->cp_rccr = 3;
  668. smp = (smc_uart_t *)&commproc->cp_dparam[PROFF_SMC1];
  669. smp->smc_rpbase = 0x1FC0;
  670. printk("I2C/SPI/SMC1 microcode patch installed.\n");
  671. # endif /* CONFIG_I2C_SPI_SMC1_UCODE_PATCH) */
  672. #endif /* some variation of the I2C/SPI patch was selected */
  673. }
  674. /*
  675. * Take this entire routine out, since no one calls it and its
  676. * logic is suspect.
  677. */
  678. #if 0
  679. void
  680. verify_patch(volatile immap_t *immr)
  681. {
  682. volatile uint *dp;
  683. volatile cpm8xx_t *commproc;
  684. int i;
  685. commproc = (cpm8xx_t *)&immr->im_cpm;
  686. printk("cp_rccr %x\n", commproc->cp_rccr);
  687. commproc->cp_rccr = 0;
  688. dp = (uint *)(commproc->cp_dpmem);
  689. for (i=0; i<(sizeof(patch_2000)/4); i++)
  690. if (*dp++ != patch_2000[i]) {
  691. printk("patch_2000 bad at %d\n", i);
  692. dp--;
  693. printk("found 0x%X, wanted 0x%X\n", *dp, patch_2000[i]);
  694. break;
  695. }
  696. dp = (uint *)&(commproc->cp_dpmem[0x0f00]);
  697. for (i=0; i<(sizeof(patch_2f00)/4); i++)
  698. if (*dp++ != patch_2f00[i]) {
  699. printk("patch_2f00 bad at %d\n", i);
  700. dp--;
  701. printk("found 0x%X, wanted 0x%X\n", *dp, patch_2f00[i]);
  702. break;
  703. }
  704. commproc->cp_rccr = 0x0009;
  705. }
  706. #endif