Misc fixes + 8xx CPM relocation
v2 cover Misc fixes + 8xx CPM relocation
This series adds misc fixes for cssi boards and activates CPM relocation in order to enable the use of SCC4 in QMC (QUICC Multi-Channel) mode.
Changes in v2:
- Patch 5: Update r1 at once (From Joakim)
- Patch 6: New to avoid sparse warnings with memcpy_toio()
- Patch 7 and 8: Fixed sparse warnings
Christophe Leroy (11):
board: cssi: Remove duplicated FPGA loading sequence on CMPC885
board: cssi: Remove stale macro from cmpcpro.c
board: cssi: Load CMPC885's motherboard FPGA earlier
powerpc: mpc8xx: CPM parameter RAM can be anywhere
powerpc: mpc8xx: Reorganise init RAM
powerpc: Force cast on memcpy_toio()
powerpc: mpc885: Add CPM USB-SOF microcode for CPM15 ERRATA
powerpc: mpc8xx: Add SMC relocation CPM microcode
spi, mpc8xx: Take parameter RAM relocation into account serial, mpc8xx: Take parameter RAM relocation into account
board: cssi: Activate SMC relocation on CMPC885 board for MIAE device
arch/powerpc/cpu/mpc8xx/Kconfig | 45 ++++++++ arch/powerpc/cpu/mpc8xx/Makefile | 2 + arch/powerpc/cpu/mpc8xx/cpu.c | 2 +- arch/powerpc/cpu/mpc8xx/micropatch_smc.c | 105 +++++++++++++++++++ arch/powerpc/cpu/mpc8xx/micropatch_usb_sof.c | 38 +++++++ arch/powerpc/cpu/mpc8xx/start.S | 8 +- arch/powerpc/include/asm/cpm_8xx.h | 41 +++++--- arch/powerpc/include/asm/immap_8xx.h | 8 +- arch/powerpc/include/asm/io.h | 6 +- board/cssi/cmpc885/cmpc885.c | 43 ++------ board/cssi/cmpcpro/cmpcpro.c | 5 - configs/CMPC885_defconfig | 3 +- drivers/serial/serial_mpc8xx.c | 24 ++--- drivers/spi/mpc8xx_spi.c | 8 +- include/configs/cmpc885.h | 1 + include/configs/mcr3000.h | 1 + 16 files changed, 254 insertions(+), 86 deletions(-) create mode 100644 arch/powerpc/cpu/mpc8xx/micropatch_smc.c create mode 100644 arch/powerpc/cpu/mpc8xx/micropatch_usb_sof.c
Signature · 1 line
2.39.2
PATCH v2 11/11 board: cssi: Activate SMC relocation on CMPC885 board for MIAE device
When CMPC885 board is used for MIAE device, SCC2 SCC3 and SMC2 are used for serial lines. Therefore only SCC4 is available for handling the TDM line.
In order to use SCC4 in QMC mode without loosing SMC2, SMC2 must be relocated.
Activate SMC relocation and relocate SMC2 at offset 0x1fc0 which is unused.
--- board/cssi/cmpc885/cmpc885.c | 4 ++++ configs/CMPC885_defconfig | 2 ++ 2 files changed, 6 insertions(+)
board/cssi/cmpc885/cmpc885.c +4 -0
@@ -11,6 +11,7 @@#include <env.h> #include <common.h> #include <mpc8xx.h> +#include <asm/cpm_8xx.h> #include <asm/io.h> #include <dm.h> #include <stdio.h>
@@ -451,6 +452,9 @@ void iop_setup_miae(void)/* Wait reset on FPGA_F */ udelay (100 ); +/* Load CPM relocation code */ +cpm_load_patch (cp); +/* Set the front panel LED color to red */ clrbits_8 ((unsigned char __iomem *)CONFIG_FPGA_BASE +0x44 ,0x02 );
configs/CMPC885_defconfig +2 -0
@@ -10,6 +10,8 @@ CONFIG_MPC8xx=y # CONFIG_PCI is not set CONFIG_TARGET_CMPC885=y CONFIG_MPC885=y +CONFIG_SMC_UCODE_PATCH=y +CONFIG_SMC2_RPBASE=0x1fc0 CONFIG_CMD_IMMAP=y CONFIG_SYS_SIUMCR=0x00620000 CONFIG_SYS_TBSCR=0x00C3
Signature · 1 line
2.39.2
PATCH v2 5/11 powerpc: mpc8xx: Reorganise init RAM
In reply to Christophe LeroyUsing SMC relocation microcode patch or USB-SOF microcode patch will disable DPRAM memory from 0x2000 to 0x2400 and from 0x2f00 to 0x3000.
At the time being, init RAM is setup to use 0x2800-0x2e00, but the stack pointer goes beyond 0x2800 and even beyond 0x2400.
For the time being we are not going to use any microcode patch that uses memory about 0x3000, so reorganise setup to use:
- 0x2800 - 0x2e00 for init malloc and global data and CPM buffers
- 0x3000 - 0x3c00 for init stack
For more details about CPM dual port ram, see
commit b1d62424cb ("powerpc: mpc8xx: redistribute data in CPM dpram")
--- arch/powerpc/cpu/mpc8xx/start.S | 8 +++++--- arch/powerpc/include/asm/cpm_8xx.h | 16 ++++++++-------- include/configs/cmpc885.h | 1 + include/configs/mcr3000.h | 1 + 4 files changed, 15 insertions(+), 11 deletions(-)
arch/powerpc/cpu/mpc8xx/start.S +5 -3
@@ -141,14 +141,16 @@ in_flash: mtspr DER, r2 /* set up the stack on top of internal DPRAM */ - lis r3, (CFG_SYS_INIT_RAM_ADDR + CFG_SYS_INIT_RAM_SIZE)@h - ori r3, r3, (CFG_SYS_INIT_RAM_ADDR + CFG_SYS_INIT_RAM_SIZE)@l + lis r3, CFG_SYS_INIT_SP@h + ori r3, r3, CFG_SYS_INIT_SP@l stw r0, -4(r3) stw r0, -8(r3) addi r1, r3, -8 + lis r3, (CFG_SYS_INIT_RAM_ADDR + CFG_SYS_INIT_RAM_SIZE)@h + ori r3, r3, (CFG_SYS_INIT_RAM_ADDR + CFG_SYS_INIT_RAM_SIZE)@l + bl board_init_f_alloc_reserve - addi r1, r3, -8 /* Zeroise the CPM dpram */ lis r4, CONFIG_SYS_IMMR@h
arch/powerpc/include/asm/cpm_8xx.h +8 -8
@@ -51,14 +51,14 @@/* * DPRAM defines and allocation functions */ -#define CPM_SERIAL_BASE 0x1800 -#define CPM_I2C_BASE 0x1820 -#define CPM_SPI_BASE 0x1840 -#define CPM_FEC_BASE 0x1860 -#define CPM_SERIAL2_BASE 0x18e0 -#define CPM_SCC_BASE 0x1900 -#define CPM_POST_BASE 0x1980 -#define CPM_WLKBD_BASE 0x1a00 +#define CPM_SERIAL_BASE 0x0800 +#define CPM_I2C_BASE 0x0820 +#define CPM_SPI_BASE 0x0840 +#define CPM_FEC_BASE 0x0860 +#define CPM_SERIAL2_BASE 0x08E0 +#define CPM_SCC_BASE 0x0900 +#define CPM_POST_BASE 0x0980 +#define CPM_WLKBD_BASE 0x0a00#define BD_IIC_START ((uint) 0x0400)/* <- please use CPM_I2C_BASE !! */
include/configs/cmpc885.h +1 -0
@@ -9,6 +9,7 @@/* Definitions for initial stack pointer and data area (in DPRAM) */ #define CFG_SYS_INIT_RAM_ADDR (CONFIG_SYS_IMMR + 0x2800)#define CFG_SYS_INIT_RAM_SIZE (0x2e00 - 0x2800) +#define CFG_SYS_INIT_SP (CONFIG_SYS_IMMR + 0x3c00)/* RAM configuration (note that CFG_SYS_SDRAM_BASE must be zero) */ #define CFG_SYS_SDRAM_BASE 0x00000000
include/configs/mcr3000.h +1 -0
@@ -14,6 +14,7 @@/* Definitions for initial stack pointer and data area (in DPRAM) */ #define CFG_SYS_INIT_RAM_ADDR (CONFIG_SYS_IMMR + 0x2800)#define CFG_SYS_INIT_RAM_SIZE (0x2e00 - 0x2800) +#define CFG_SYS_INIT_SP (CONFIG_SYS_IMMR + 0x3c00)/* RAM configuration (note that CFG_SYS_SDRAM_BASE must be zero) */ #define CFG_SYS_SDRAM_BASE 0x00000000
Signature · 1 line
2.39.2
PATCH v2 4/11 powerpc: mpc8xx: CPM parameter RAM can be anywhere
In reply to Christophe LeroyWith relocation, CPM parameter RAM can be anywhere in the dual port RAM, so don't split dual port RAM.
Remove dparam and dparam16 members of struct comm_proc
PROFF_XXX become offsets from the start of dual port RAM, then they are now consistant with the offsets in RPBASE registers.
--- arch/powerpc/cpu/mpc8xx/cpu.c | 2 +- arch/powerpc/include/asm/cpm_8xx.h | 18 +++++++++--------- arch/powerpc/include/asm/immap_8xx.h | 8 +------- drivers/serial/serial_mpc8xx.c | 2 +- drivers/spi/mpc8xx_spi.c | 2 +- 5 files changed, 13 insertions(+), 19 deletions(-)
arch/powerpc/cpu/mpc8xx/cpu.c +1 -1
@@ -127,7 +127,7 @@ static int check_CPU(long clock, uint pvr, uint immr)return -1 ; k = (immr <<16 ) | -in_be16 (&immap->im_cpm.cp_dparam16[PROFF_REVNUM /sizeof (u16)]); +in_be16 ((u16 __iomem *)&immap->im_cpm.cp_dpmem[PROFF_REVNUM ]);/* * Some boards use sockets so different CPUs can be used.
arch/powerpc/include/asm/cpm_8xx.h +9 -9
@@ -92,15 +92,15 @@ typedef struct cpm_buf_desc {/* Parameter RAM offsets. */ -#define PROFF_SCC1 ((uint)0x0000) -#define PROFF_IIC ((uint)0x0080) -#define PROFF_REVNUM ((uint)0x00b0) -#define PROFF_SCC2 ((uint)0x0100) -#define PROFF_SPI ((uint)0x0180) -#define PROFF_SCC3 ((uint)0x0200) -#define PROFF_SMC1 ((uint)0x0280) -#define PROFF_SCC4 ((uint)0x0300) -#define PROFF_SMC2 ((uint)0x0380) +#define PROFF_SCC1 ((uint)0x1c00) +#define PROFF_IIC ((uint)0x1c80) +#define PROFF_REVNUM ((uint)0x1cb0) +#define PROFF_SCC2 ((uint)0x1d00) +#define PROFF_SPI ((uint)0x1d80) +#define PROFF_SCC3 ((uint)0x1e00) +#define PROFF_SMC1 ((uint)0x1e80) +#define PROFF_SCC4 ((uint)0x1f00) +#define PROFF_SMC2 ((uint)0x1f80)/* Define enough so I can at least use the serial port as a UART. */
arch/powerpc/include/asm/immap_8xx.h +1 -7
@@ -437,13 +437,7 @@ typedef struct comm_proc {* depending upon the devices used and options chosen. * Some processors don't have all of it populated. */ -u_char cp_dpmem[0x1C00 ];/* BD / Data / ucode */ - -/* Parameter RAM */ -union { -u_char cp_dparam[0x400 ]; -u16 cp_dparam16[0x200 ]; - }; +u_char cp_dpmem[0x2000 ];/* BD / Data / ucode / Param RAM */ } cpm8xx_t;/* Internal memory map.
drivers/serial/serial_mpc8xx.c +1 -1
@@ -89,7 +89,7 @@ static int serial_mpc8xx_probe(struct udevice *dev)/* initialize pointers to SMC */ sp = cp->cp_smc +SMC_INDEX ; - up = (smc_uart_t __iomem *)&cp->cp_dparam[PROFF_SMC ]; + up = (smc_uart_t __iomem *)&cp->cp_dpmem[PROFF_SMC ];/* Disable relocation */ out_be16 (&up->smc_rpbase,0 );
drivers/spi/mpc8xx_spi.c +1 -1
@@ -51,7 +51,7 @@ static int mpc8xx_spi_probe(struct udevice *dev) {immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR ;cpm8xx_t __iomem *cp = &immr->im_cpm; -spi_t __iomem *spi = (spi_t __iomem *)&cp->cp_dparam[PROFF_SPI ]; +spi_t __iomem *spi = (spi_t __iomem *)&cp->cp_dpmem[PROFF_SPI ];cbd_t __iomem *tbdf, *rbdf;/* Disable relocation */
Signature · 1 line
2.39.2
PATCH v2 6/11 powerpc: Force cast on memcpy_toio()
In reply to Christophe Leroysparse reports the following warning:
CHECK arch/powerpc/cpu/mpc8xx/micropatch_usb_sof.carch/powerpc/cpu/mpc8xx/micropatch_usb_sof.c:29:9: warning: cast removes address space '<asn:2>' of expression arch/powerpc/cpu/mpc8xx/micropatch_usb_sof.c:30:9: warning: cast removes address space '<asn:2>' of expression
This is because of (void *) casts for using memcpy() as a substitute.
Do like other architectures, __force the cast to silence the warning
--- arch/powerpc/include/asm/io.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/include/asm/io.h +3 -3
@@ -95,9 +95,9 @@ extern void _outsl_ns(volatile u32 *port, const void *buf, int nl);#define IO_SPACE_LIMIT ~0 -#define memset_io (a,b,c) memset((void *)(a),(b),(c)) -#define memcpy_fromio (a,b,c) memcpy((a),(void *)(b),(c)) -#define memcpy_toio (a,b,c) memcpy((void *)(a),(b),(c)) +#define memset_io (a,b,c) memset((void __force *)(a),(b),(c)) +#define memcpy_fromio (a,b,c) memcpy((a),(void __force *)(b),(c)) +#define memcpy_toio (a,b,c) memcpy((void __force *)(a),(b),(c))/* * Enforce In-order Execution of I/O:
Signature · 1 line
2.39.2
PATCH v2 10/11 serial, mpc8xx: Take parameter RAM relocation into account
In reply to Christophe LeroyInstead of inhibiting parameter RAM relacation, take into account the configured one.
It means INIT_TRX command cannot be used and must be done manually as explained in the microcode patch application note.
--- drivers/serial/serial_mpc8xx.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/serial/serial_mpc8xx.c +11 -11
@@ -83,6 +83,7 @@ static int serial_mpc8xx_probe(struct udevice *dev)immap_t __iomem *im = (immap_t __iomem *)CONFIG_SYS_IMMR ;smc_t __iomem *sp;smc_uart_t __iomem *up; +u16 smc_rpbase;cpm8xx_t __iomem *cp = &(im->im_cpm);struct serialbuffer __iomem *rtx;
@@ -90,8 +91,10 @@ static int serial_mpc8xx_probe(struct udevice *dev) sp = cp->cp_smc +SMC_INDEX ; up = (smc_uart_t __iomem *)&cp->cp_dpmem[PROFF_SMC ]; -/* Disable relocation */ -out_be16 (&up->smc_rpbase,0 ); + + smc_rpbase =in_be16 (&up->smc_rpbase); +if (smc_rpbase) + up = (smc_uart_t __iomem *)&cp->cp_dpmem[smc_rpbase];/* Disable transmitter/receiver. */ clrbits_be16 (&sp->smc_smcmr,SMCMR_REN |SMCMR_TEN );
@@ -154,15 +157,12 @@ static int serial_mpc8xx_probe(struct udevice *dev)out_be16 (&up->smc_maxidl,CONFIG_SYS_MAXIDLE );out_be32 (&rtx->rxindex,0 ); -/* Initialize Tx/Rx parameters. */ -while (in_be16 (&cp->cp_cpcr) &CPM_CR_FLG )/* wait if cp is busy */ - ; - -out_be16 (&cp->cp_cpcr, -mk_cr_cmd (CPM_CR_CH_SMC ,CPM_CR_INIT_TRX ) |CPM_CR_FLG ); - -while (in_be16 (&cp->cp_cpcr) &CPM_CR_FLG )/* wait if cp is busy */ - ; +out_be32 (&up->smc_rstate,0 ); +out_be32 (&up->smc_tstate,0 ); +out_be16 (&up->smc_rbptr,CPM_SERIAL_BASE ); +out_be16 (&up->smc_tbptr,CPM_SERIAL_BASE +sizeof (cbd_t)); +out_be16 (&up->smc_brkcr,1 ); +out_be16 (&up->smc_brkec,0 );/* Enable transmitter/receiver. */ setbits_be16 (&sp->smc_smcmr,SMCMR_REN |SMCMR_TEN );
Signature · 1 line
2.39.2
PATCH v2 1/11 board: cssi: Remove duplicated FPGA loading sequence on CMPC885
In reply to Christophe LeroyA duplicated FPGA loading sequence appears after FPGA reset.
Remove it.
--- board/cssi/cmpc885/cmpc885.c | 14 -------------- 1 file changed, 14 deletions(-)
board/cssi/cmpc885/cmpc885.c +0 -14
@@ -896,20 +896,6 @@ int board_early_init_r(void) } } -/* is FPGA firmware loaded ? */ -if (!(in_be32 (&cp->cp_pedat) &0x00000001 )) { -printf ("Reloading FPGA firmware\n" ); - -/* Load FPGA firmware */ -/* Activate PROG_FPGA_FIRMWARE for 1 usec */ -clrbits_be32 (&cp->cp_pedat,0x00000002 ); -udelay (1 ); -setbits_be32 (&cp->cp_pedat,0x00000002 ); - -/* Wait 200ms before checking DONE_FPGA_FIRMWARE */ -mdelay (200 ); - } -iop_setup_common (); }else {iop_setup_cmpc885 ();
Signature · 1 line
2.39.2
PATCH v2 2/11 board: cssi: Remove stale macro from cmpcpro.c
In reply to Christophe LeroyThree unused macros were left over. Remove them.
--- board/cssi/cmpcpro/cmpcpro.c | 5 ----- 1 file changed, 5 deletions(-)
board/cssi/cmpcpro/cmpcpro.c +0 -5
@@ -397,8 +397,3 @@ void ft_board_setup_phy3(void)setbits_be32 (&immr->qepio.ioport[2 ].pdat,0x00000400 ); } - -#define ADDR_FPGA_R_BASE ((unsigned char __iomem *)CONFIG_FPGA_BASE) -#define ADDR_FPGA_R_ALARMES_IN ((unsigned char __iomem *)CONFIG_FPGA_BASE + 0x31) -#define ADDR_FPGA_R_FAV ((unsigned char __iomem *)CONFIG_FPGA_BASE + 0x44) -
Signature · 1 line
2.39.2
PATCH v2 9/11 spi, mpc8xx: Take parameter RAM relocation into account
In reply to Christophe LeroyInstead of inhibiting parameter RAM relocation, take it into account.
--- drivers/spi/mpc8xx_spi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/spi/mpc8xx_spi.c +4 -2
@@ -52,10 +52,12 @@ static int mpc8xx_spi_probe(struct udevice *dev)immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR ;cpm8xx_t __iomem *cp = &immr->im_cpm;spi_t __iomem *spi = (spi_t __iomem *)&cp->cp_dpmem[PROFF_SPI ]; +u16 spi_rpbase;cbd_t __iomem *tbdf, *rbdf; -/* Disable relocation */ -out_be16 (&spi->spi_rpbase,0x1d80 ); + spi_rpbase =in_be16 (&spi->spi_rpbase); +if (spi_rpbase) + spi = (spi_t __iomem *)&cp->cp_dpmem[spi_rpbase];/* 1 */ /* Initialize the parameter ram.
Signature · 1 line
2.39.2
PATCH v2 7/11 powerpc: mpc885: Add CPM USB-SOF microcode for CPM15 ERRATA
In reply to Christophe LeroyMPC885 CPU has the following ERRATA:
When the USB controller is configured in Host mode, and the SOF generation (SFTE=1 in USMOD register) is being used, there may be false CRC error indication in other SCCs. Although the data is received correctly, the CRC result will be corrupted.
Add capability to load the related microcode to fix it. The microcode binary data is copied from Linux kernel.
Other microcode will be added in following patch so make it a Kconfig choice.
--- arch/powerpc/cpu/mpc8xx/Kconfig | 25 +++++++++++++ arch/powerpc/cpu/mpc8xx/Makefile | 1 + arch/powerpc/cpu/mpc8xx/micropatch_usb_sof.c | 38 ++++++++++++++++++++ arch/powerpc/include/asm/cpm_8xx.h | 7 ++++ 4 files changed, 71 insertions(+) create mode 100644 arch/powerpc/cpu/mpc8xx/micropatch_usb_sof.c
arch/powerpc/cpu/mpc8xx/Kconfig +25 -0
@@ -30,6 +30,31 @@ config MPC885 endchoice +choice + prompt "Microcode patch selection" + default NO_UCODE_PATCH + help + This allows loading of CPM microcode. + + Only one microcode can be loaded at a time. + +config NO_UCODE_PATCH + bool "None" + +config USB_SOF_UCODE_PATCH + bool "USB SOF patch" + depends on MPC885 + help + This microcode fixes CPM15 errata: + + When the USB controller is configured in Host mode, and the + SOF generation (SFTE=1 in USMOD register) is being used, + there may be false CRC error indication in other SCCs. + Although the data is received correctly, the CRC result + will be corrupted. + +endchoice + comment "Specific commands" config CMD_IMMAP
arch/powerpc/cpu/mpc8xx/Makefile +1 -0
@@ -12,3 +12,4 @@ obj-$(CONFIG_CMD_IMMAP) += immap.o obj-y += interrupts.o obj-y += speed.o obj-y += cache.o +obj-$(CONFIG_USB_SOF_UCODE_PATCH) += micropatch_usb_sof.o
arch/powerpc/cpu/mpc8xx/micropatch_usb_sof.c new file +38 -0
@@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0 + +/* +* Microcode patches for the CPM as supplied by Motorola. +*/ + +#include <linux/string.h> +#include <linux/io.h> +#include <asm/immap_8xx.h> +#include <asm/cpm_8xx.h> + +/* +* USB SOF patch arrays. +*/ +static uint patch_2000[] = { +0x7fff0000 ,0x7ffd0000 ,0x7ffb0000 ,0x49f7ba5b , +0xba383ffb ,0xf9b8b46d ,0xe5ab4e07 ,0xaf77bffe , +0x3f7bbf79 ,0xba5bba38 ,0xe7676076 ,0x60750000 +}; + +static uint patch_2f00[] = { +0x3030304c ,0xcab9e441 ,0xa1aaf220 +}; + +void cpm_load_patch (cpm8xx_t __iomem *cp) +{ +out_be16 (&cp->cp_rccr,0 ); + +memcpy_toio (cp->cp_dpmem, patch_2000,sizeof (patch_2000)); +memcpy_toio (cp->cp_dpmem +0xf00 , patch_2f00,sizeof (patch_2f00)); + +out_be16 (&cp->cp_cpmcr1,0 ); +out_be16 (&cp->cp_cpmcr2,0 ); +out_be16 (&cp->cp_cpmcr3,0 ); +out_be16 (&cp->cp_cpmcr4,0 ); + +out_be16 (&cp->cp_rccr,9 ); +}
arch/powerpc/include/asm/cpm_8xx.h +7 -0
@@ -684,4 +684,11 @@ void irq_install_handler(int vec, void (*handler)(void *), void *dev_id);#define CICR_HP_MASK ((uint)0x00001f00)/* Hi-pri int. */ #define CICR_IEN ((uint)0x00000080)/* Int. enable */ #define CICR_SPS ((uint)0x00000001)/* SCC Spread */ + +#ifdef CONFIG_NO_UCODE_PATCH +static inline void cpm_load_patch (cpm8xx_t __iomem *cp) { } +#else +void cpm_load_patch (cpm8xx_t __iomem *cp); +#endif +#endif /* __CPM_8XX__ */
Signature · 1 line
2.39.2
PATCH v2 3/11 board: cssi: Load CMPC885's motherboard FPGA earlier
In reply to Christophe LeroyIn order to know the motherboard type earlier, perform I/O ports initialisation and FPGA loading in board_early_init_f() instead of board_early_init_r().
This is needed to be able to load mpc8xx CPM microcode base on motherboard type and before starting to use the CPM.
Console is not available yet so remove the printfs.
--- board/cssi/cmpc885/cmpc885.c | 25 +++++-------------------- configs/CMPC885_defconfig | 1 - 2 files changed, 5 insertions(+), 21 deletions(-)
board/cssi/cmpc885/cmpc885.c +5 -20
@@ -586,13 +586,8 @@ void iop_setup_miae(void)setbits_be32 (&cp->cp_peso,0x00031980 ); } -int board_early_init_f (void ) -{ -return 0 ; -} -/* Specific board initialization */ -int board_early_init_r (void ) +int board_early_init_f (void ) {immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR ;iop8xx_t __iomem *iop = &immr->im_ioport;
@@ -864,8 +859,6 @@ int board_early_init_r(void)/* Check if fpga firmware is loaded */ if (!(in_be32 (&cp->cp_pedat) &0x00000001 )) { -printf ("Reloading FPGA firmware.\n" ); -/* Load fpga firmware */ /* Activate PROG_FPGA_FIRMWARE for 1 usec */ clrbits_be32 (&cp->cp_pedat,0x00000002 );
@@ -874,12 +867,8 @@ int board_early_init_r(void)/* Wait 200 msec and check DONE_FPGA_FIRMWARE */ mdelay (200 ); -if (!(in_be32 (&cp->cp_pedat) &0x00000001 )) { -for (;;) { -printf ("error loading firmware.\n" ); -mdelay (500 ); - } - } +if (!(in_be32 (&cp->cp_pedat) &0x00000001 )) +hang ();/* Send a reset signal and wait for 20 msec */ clrbits_be16 (ADDR_CPLD_R_RESET ,R_RST_STATUS );
@@ -889,12 +878,8 @@ int board_early_init_r(void)/* Wait 300 msec and check the reset state */ mdelay (300 ); -if (!(in_be16 (ADDR_CPLD_R_RESET ) &R_RESET_STATUS )) { -for (;;) { -printf ("Could not reset FPGA.\n" ); -mdelay (500 ); - } - } +if (!(in_be16 (ADDR_CPLD_R_RESET ) &R_RESET_STATUS )) +hang ();iop_setup_common (); }else {
configs/CMPC885_defconfig +0 -1
@@ -31,7 +31,6 @@ CONFIG_AUTOBOOT_STOP_STR_ENABLE=y CONFIG_AUTOBOOT_STOP_STR_SHA256="4813494d137e1631bba301d5acab6e7bb7aa74ce1185d456565ef51d737677b2" CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="run flashboot" -CONFIG_BOARD_EARLY_INIT_R=y CONFIG_MISC_INIT_R=y CONFIG_HUSH_PARSER=y # CONFIG_CMD_BDI is not set
Signature · 1 line
2.39.2
PATCH v2 8/11 powerpc: mpc8xx: Add SMC relocation CPM microcode
In reply to Christophe LeroyIn order to use QMC mode in the CPM, a SCC requires more space in parameter RAM.
After SCC1 there is I2C parameter RAM and after SCC2 there is SPI parameter RAM. MPC866 and MPC885 can already relocate I2C and. SPI parameter RAM.
But in order to free space after SCC3 and SCC4, SMC1 and SMC2 need to be relocated. In order to do so, a CPM microcode patch is required.
Binary data for that patch is copied from Linux kernel.
--- arch/powerpc/cpu/mpc8xx/Kconfig | 20 +++++ arch/powerpc/cpu/mpc8xx/Makefile | 1 + arch/powerpc/cpu/mpc8xx/micropatch_smc.c | 105 +++++++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 arch/powerpc/cpu/mpc8xx/micropatch_smc.c
arch/powerpc/cpu/mpc8xx/Kconfig +20 -0
@@ -53,6 +53,26 @@ config USB_SOF_UCODE_PATCH Although the data is received correctly, the CRC result will be corrupted. +config SMC_UCODE_PATCH + bool "SMC relocation patch" + help + This microcode relocates SMC1 and SMC2 parameter RAMs to allow + extended parameter RAM for SCC3 and SCC4 (ex: for QMC mode) + +config SMC1_RPBASE + hex "SMC1 relocation offset" + depends on SMC_UCODE_PATCH + default 0x1e80 + help + Offset of SMC1 parameter RAM to be written to RPBASE register. + +config SMC2_RPBASE + hex "SMC2 relocation offset" + depends on SMC_UCODE_PATCH + default 0x1f80 + help + Offset of SMC2 parameter RAM to be written to RPBASE register. + endchoice comment "Specific commands"
arch/powerpc/cpu/mpc8xx/Makefile +1 -0
@@ -13,3 +13,4 @@ obj-y += interrupts.o obj-y += speed.o obj-y += cache.o obj-$(CONFIG_USB_SOF_UCODE_PATCH) += micropatch_usb_sof.o +obj-$(CONFIG_SMC_UCODE_PATCH) += micropatch_smc.o
arch/powerpc/cpu/mpc8xx/micropatch_smc.c new file +105 -0
105 lines not on this page · raw message
Signature · 1 line
2.39.2
Quoted 6 lines · Christophe Leroy
This series adds misc fixes for cssi boards and activates CPM relocation in order to enable the use of SCC4 in QMC (QUICC Multi-Channel) mode.
Changes in v2:
- Patch 5: Update r1 at once (From Joakim)
Thanks
Joakim