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/config.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>
14 #include <linux/interrupt.h>
16 #include <asm/mpc8xx.h>
18 #include <asm/pgtable.h>
19 #include <asm/8xx_immap.h>
20 #include <asm/commproc.h>
23 * I2C/SPI relocation patch arrays.
26 #ifdef CONFIG_I2C_SPI_UCODE_PATCH
147 uint patch_2f00
[] = {
181 * I2C/SPI/SMC1 relocation patch arrays.
184 #ifdef CONFIG_I2C_SPI_SMC1_UCODE_PATCH
186 uint patch_2000
[] = {
509 uint patch_2f00
[] = {
576 uint patch_2e00
[] = {
597 * USB SOF patch arrays.
600 #ifdef CONFIG_USB_SOF_UCODE_PATCH
602 uint patch_2000
[] = {
617 uint patch_2f00
[] = {
625 cpm_load_patch(volatile immap_t
*immr
)
627 volatile uint
*dp
; /* Dual-ported RAM. */
628 volatile cpm8xx_t
*commproc
;
631 volatile smc_uart_t
*smp
;
634 commproc
= (cpm8xx_t
*)&immr
->im_cpm
;
636 #ifdef CONFIG_USB_SOF_UCODE_PATCH
637 commproc
->cp_rccr
= 0;
639 dp
= (uint
*)(commproc
->cp_dpmem
);
640 for (i
=0; i
<(sizeof(patch_2000
)/4); i
++)
641 *dp
++ = patch_2000
[i
];
643 dp
= (uint
*)&(commproc
->cp_dpmem
[0x0f00]);
644 for (i
=0; i
<(sizeof(patch_2f00
)/4); i
++)
645 *dp
++ = patch_2f00
[i
];
647 commproc
->cp_rccr
= 0x0009;
649 printk("USB SOF microcode patch installed\n");
650 #endif /* CONFIG_USB_SOF_UCODE_PATCH */
652 #if defined(CONFIG_I2C_SPI_UCODE_PATCH) || \
653 defined(CONFIG_I2C_SPI_SMC1_UCODE_PATCH)
655 commproc
->cp_rccr
= 0;
657 dp
= (uint
*)(commproc
->cp_dpmem
);
658 for (i
=0; i
<(sizeof(patch_2000
)/4); i
++)
659 *dp
++ = patch_2000
[i
];
661 dp
= (uint
*)&(commproc
->cp_dpmem
[0x0f00]);
662 for (i
=0; i
<(sizeof(patch_2f00
)/4); i
++)
663 *dp
++ = patch_2f00
[i
];
665 iip
= (iic_t
*)&commproc
->cp_dparam
[PROFF_IIC
];
666 # define RPBASE 0x0500
667 iip
->iic_rpbase
= RPBASE
;
669 /* Put SPI above the IIC, also 32-byte aligned.
671 i
= (RPBASE
+ sizeof(iic_t
) + 31) & ~31;
672 spp
= (spi_t
*)&commproc
->cp_dparam
[PROFF_SPI
];
675 # if defined(CONFIG_I2C_SPI_UCODE_PATCH)
676 commproc
->cp_cpmcr1
= 0x802a;
677 commproc
->cp_cpmcr2
= 0x8028;
678 commproc
->cp_cpmcr3
= 0x802e;
679 commproc
->cp_cpmcr4
= 0x802c;
680 commproc
->cp_rccr
= 1;
682 printk("I2C/SPI microcode patch installed.\n");
683 # endif /* CONFIG_I2C_SPI_UCODE_PATCH */
685 # if defined(CONFIG_I2C_SPI_SMC1_UCODE_PATCH)
687 dp
= (uint
*)&(commproc
->cp_dpmem
[0x0e00]);
688 for (i
=0; i
<(sizeof(patch_2e00
)/4); i
++)
689 *dp
++ = patch_2e00
[i
];
691 commproc
->cp_cpmcr1
= 0x8080;
692 commproc
->cp_cpmcr2
= 0x808a;
693 commproc
->cp_cpmcr3
= 0x8028;
694 commproc
->cp_cpmcr4
= 0x802a;
695 commproc
->cp_rccr
= 3;
697 smp
= (smc_uart_t
*)&commproc
->cp_dparam
[PROFF_SMC1
];
698 smp
->smc_rpbase
= 0x1FC0;
700 printk("I2C/SPI/SMC1 microcode patch installed.\n");
701 # endif /* CONFIG_I2C_SPI_SMC1_UCODE_PATCH) */
703 #endif /* some variation of the I2C/SPI patch was selected */
707 * Take this entire routine out, since no one calls it and its
713 verify_patch(volatile immap_t
*immr
)
716 volatile cpm8xx_t
*commproc
;
719 commproc
= (cpm8xx_t
*)&immr
->im_cpm
;
721 printk("cp_rccr %x\n", commproc
->cp_rccr
);
722 commproc
->cp_rccr
= 0;
724 dp
= (uint
*)(commproc
->cp_dpmem
);
725 for (i
=0; i
<(sizeof(patch_2000
)/4); i
++)
726 if (*dp
++ != patch_2000
[i
]) {
727 printk("patch_2000 bad at %d\n", i
);
729 printk("found 0x%X, wanted 0x%X\n", *dp
, patch_2000
[i
]);
733 dp
= (uint
*)&(commproc
->cp_dpmem
[0x0f00]);
734 for (i
=0; i
<(sizeof(patch_2f00
)/4); i
++)
735 if (*dp
++ != patch_2f00
[i
]) {
736 printk("patch_2f00 bad at %d\n", i
);
738 printk("found 0x%X, wanted 0x%X\n", *dp
, patch_2f00
[i
]);
742 commproc
->cp_rccr
= 0x0009;