diff mbox series

[03/10] board: cssi: Load CMPC885's motherboard FPGA earlier

Message ID 85fe09e819ec9a1887dd45a162cf78a6c00c2d1b.1683190404.git.christophe.leroy@csgroup.eu
State Superseded
Delegated to: Tom Rini
Headers show
Series Misc fixes + 8xx CPM relocation | expand

Commit Message

Christophe Leroy May 4, 2023, 8:56 a.m. UTC
In 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.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 board/cssi/cmpc885/cmpc885.c | 25 +++++--------------------
 configs/CMPC885_defconfig    |  1 -
 2 files changed, 5 insertions(+), 21 deletions(-)
diff mbox series

Patch

diff --git a/board/cssi/cmpc885/cmpc885.c b/board/cssi/cmpc885/cmpc885.c
index 02da4d9a87..40128f170a 100644
--- a/board/cssi/cmpc885/cmpc885.c
+++ b/board/cssi/cmpc885/cmpc885.c
@@ -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 {
diff --git a/configs/CMPC885_defconfig b/configs/CMPC885_defconfig
index b1df954bee..c1031b7e3a 100644
--- a/configs/CMPC885_defconfig
+++ b/configs/CMPC885_defconfig
@@ -30,7 +30,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