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.
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>
13 #include <linux/interrupt.h>
15 #include <asm/mpc8xx.h>
17 #include <asm/pgtable.h>
18 #include <asm/8xx_immap.h>
19 #include <asm/commproc.h>
22 * I2C/SPI relocation patch arrays.
25 #ifdef CONFIG_I2C_SPI_UCODE_PATCH
146 uint patch_2f00[] = {
180 * I2C/SPI/SMC1 relocation patch arrays.
183 #ifdef CONFIG_I2C_SPI_SMC1_UCODE_PATCH
185 uint patch_2000[] = {
508 uint patch_2f00[] = {
575 uint patch_2e00[] = {
596 * USB SOF patch arrays.
599 #ifdef CONFIG_USB_SOF_UCODE_PATCH
601 uint patch_2000[] = {
616 uint patch_2f00[] = {
624 cpm_load_patch(cpm8xx_t *cp)
626 volatile uint *dp; /* Dual-ported RAM. */
627 volatile cpm8xx_t *commproc;
630 volatile smc_uart_t *smp;
635 #ifdef CONFIG_USB_SOF_UCODE_PATCH
636 commproc->cp_rccr = 0;
638 dp = (uint *)(commproc->cp_dpmem);
639 for (i=0; i<(sizeof(patch_2000)/4); i++)
640 *dp++ = patch_2000[i];
642 dp = (uint *)&(commproc->cp_dpmem[0x0f00]);
643 for (i=0; i<(sizeof(patch_2f00)/4); i++)
644 *dp++ = patch_2f00[i];
646 commproc->cp_rccr = 0x0009;
648 printk("USB SOF microcode patch installed\n");
649 #endif /* CONFIG_USB_SOF_UCODE_PATCH */
651 #if defined(CONFIG_I2C_SPI_UCODE_PATCH) || \
652 defined(CONFIG_I2C_SPI_SMC1_UCODE_PATCH)
654 commproc->cp_rccr = 0;
656 dp = (uint *)(commproc->cp_dpmem);
657 for (i=0; i<(sizeof(patch_2000)/4); i++)
658 *dp++ = patch_2000[i];
660 dp = (uint *)&(commproc->cp_dpmem[0x0f00]);
661 for (i=0; i<(sizeof(patch_2f00)/4); i++)
662 *dp++ = patch_2f00[i];
664 iip = (iic_t *)&commproc->cp_dparam[PROFF_IIC];
665 # define RPBASE 0x0500
666 iip->iic_rpbase = RPBASE;
668 /* Put SPI above the IIC, also 32-byte aligned.
670 i = (RPBASE + sizeof(iic_t) + 31) & ~31;
671 spp = (spi_t *)&commproc->cp_dparam[PROFF_SPI];
674 # if defined(CONFIG_I2C_SPI_UCODE_PATCH)
675 commproc->cp_cpmcr1 = 0x802a;
676 commproc->cp_cpmcr2 = 0x8028;
677 commproc->cp_cpmcr3 = 0x802e;
678 commproc->cp_cpmcr4 = 0x802c;
679 commproc->cp_rccr = 1;
681 printk("I2C/SPI microcode patch installed.\n");
682 # endif /* CONFIG_I2C_SPI_UCODE_PATCH */
684 # if defined(CONFIG_I2C_SPI_SMC1_UCODE_PATCH)
686 dp = (uint *)&(commproc->cp_dpmem[0x0e00]);
687 for (i=0; i<(sizeof(patch_2e00)/4); i++)
688 *dp++ = patch_2e00[i];
690 commproc->cp_cpmcr1 = 0x8080;
691 commproc->cp_cpmcr2 = 0x808a;
692 commproc->cp_cpmcr3 = 0x8028;
693 commproc->cp_cpmcr4 = 0x802a;
694 commproc->cp_rccr = 3;
696 smp = (smc_uart_t *)&commproc->cp_dparam[PROFF_SMC1];
697 smp->smc_rpbase = 0x1FC0;
699 printk("I2C/SPI/SMC1 microcode patch installed.\n");
700 # endif /* CONFIG_I2C_SPI_SMC1_UCODE_PATCH) */
702 #endif /* some variation of the I2C/SPI patch was selected */
706 * Take this entire routine out, since no one calls it and its
712 verify_patch(volatile immap_t *immr)
715 volatile cpm8xx_t *commproc;
718 commproc = (cpm8xx_t *)&immr->im_cpm;
720 printk("cp_rccr %x\n", commproc->cp_rccr);
721 commproc->cp_rccr = 0;
723 dp = (uint *)(commproc->cp_dpmem);
724 for (i=0; i<(sizeof(patch_2000)/4); i++)
725 if (*dp++ != patch_2000[i]) {
726 printk("patch_2000 bad at %d\n", i);
728 printk("found 0x%X, wanted 0x%X\n", *dp, patch_2000[i]);
732 dp = (uint *)&(commproc->cp_dpmem[0x0f00]);
733 for (i=0; i<(sizeof(patch_2f00)/4); i++)
734 if (*dp++ != patch_2f00[i]) {
735 printk("patch_2f00 bad at %d\n", i);
737 printk("found 0x%X, wanted 0x%X\n", *dp, patch_2f00[i]);
741 commproc->cp_rccr = 0x0009;