Linux Audio

Check our new training course

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