[PATCH 13/14] imx: kontron-sl-mx8mm: Simplify code in spl.c

Frieder Schrempf frieder at fris.de
Wed Jul 13 11:52:24 CEST 2022


From: Frieder Schrempf <frieder.schrempf at kontron.de>

Refactor the code a bit without any functional changes.

Signed-off-by: Frieder Schrempf <frieder.schrempf at kontron.de>
---
 board/kontron/sl-mx8mm/spl.c | 25 +++++--------------------
 1 file changed, 5 insertions(+), 20 deletions(-)

diff --git a/board/kontron/sl-mx8mm/spl.c b/board/kontron/sl-mx8mm/spl.c
index 212d712de6f..28211ae78f3 100644
--- a/board/kontron/sl-mx8mm/spl.c
+++ b/board/kontron/sl-mx8mm/spl.c
@@ -109,41 +109,26 @@ static void spl_dram_init(void)
 		size = 1;
 	}
 
-	printf("Kontron SL i.MX8MM (N801X) module, %u GB RAM detected\n", size);
+	gd->ram_size = size;
 	writel(size, M4_BOOTROM_BASE_ADDR);
 }
 
-static int i2c_detect(u8 bus, u16 addr)
-{
-	struct udevice *udev;
-	int ret;
-
-	/*
-	 * Try to probe the touch controller to check if an LVDS panel is
-	 * connected.
-	 */
-	ret = i2c_get_chip_for_busnum(bus, addr, 0, &udev);
-	if (ret == 0)
-		return 0;
-
-	return 1;
-}
-
 int do_board_detect(void)
 {
+	gd->board_type = BOARD_TYPE_KTN_N801X;
+	printf("Kontron SL i.MX8MM (N801X) module, %u GB RAM detected\n", gd->ram_size);
+
 	/*
 	 * Check the I2C PMIC to detect the deprecated SoM with DA9063.
 	 */
 	imx_iomux_v3_setup_multiple_pads(i2c1_pads, ARRAY_SIZE(i2c1_pads));
 
-	if (i2c_detect(0, 0x58) == 0) {
+	if (i2c_get_chip_for_busnum(0, 0x58, 0, &udev) == 0) {
 		printf("### ATTENTION: DEPRECATED SOM REVISION (N8010 Rev0) DETECTED! ###\n");
 		printf("###  THIS HW IS NOT SUPPORTED AND BOOTING WILL PROBABLY FAIL  ###\n");
 		printf("###             PLEASE UPGRADE TO LATEST MODULE               ###\n");
 	}
 
-	gd->board_type = BOARD_TYPE_KTN_N801X;
-
 	return 0;
 }
 
-- 
2.37.0



More information about the U-Boot mailing list