micropatch.c
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:12k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

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