Skip to contentSkip to conversation

imx8mm-cl-iot-gate: Add SPL EEPROM support

PATCH Superseded Fabio Estevam 7 participants 16 messages Mar 19, 2022 – Apr 12, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/5 imx8mm-cl-iot-gate: Add SPL EEPROM support

From: Fabio Estevam <[email protected]>

imx8mm-cl-iot-gate supports multiple DDR sizes and models.

The DDR type can be retrieved from the EEPROM, so add SPL code that can be used to get the DDR information.

Based on the original code from Compulab's U-Boot.

---
 board/compulab/imx8mm-cl-iot-gate/Makefile    |   2 +-
 .../compulab/imx8mm-cl-iot-gate/eeprom_spl.c  | 130 ++++++++++++++++++
 2 files changed, 131 insertions(+), 1 deletion(-)
 create mode 100644 board/compulab/imx8mm-cl-iot-gate/eeprom_spl.c
board/compulab/imx8mm-cl-iot-gate/Makefile +1 -1
index 3a2bfc4dc4b1..3800b21a6fd0 100644
@@ -8,6 +8,6 @@
 obj-y += imx8mm-cl-iot-gate.o
 
 ifdef CONFIG_SPL_BUILD
-obj-y += spl.o
+obj-y += spl.o eeprom_spl.o
 obj-y += ddr/
 endif
board/compulab/imx8mm-cl-iot-gate/eeprom_spl.c new file +130 -0

130 lines not on this page · raw message

Signature · 1 line
2.25.1
author reviewer
#1 lore raw

PATCH 2/5 imx8mm-cl-iot-gate: Retrieve the DDR type from EEPROM

From: Fabio Estevam <[email protected]>

Currently, the DDR type is retrieved by iteracting inside an array of possible DDR types.

This may take saveral attempts, which slows the overall U-Boot process and does not provide a good user experience:

U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 1/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0x5000010 ]
resetting ...

U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 2/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0x1061010 ]
resetting ...

U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 3/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0xff000010 ]
Normal Boot
WDT: Not starting
Trying to boot from MMC2

NOTICE:  BL31: v2.5(release):v2.5
NOTICE:  BL31: Built : 07:12:44, Jan 24 2022

Improve the boot time by retrieving the correct DDR information from the EEPROM:

U-Boot SPL 2022.04-rc4-00045-g6d02bc40d58c (Mar 19 2022 - 08:22:29 -0300) DDRINFO(D): Kingston 4096G
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(E): mr5-8 [ 0xff000010 ]
Normal Boot
WDT: Started watchdog@30280000 with servicing (60s timeout)
Trying to boot from MMC2

NOTICE:  BL31: v2.5(release):v2.5
NOTICE:  BL31: Built : 22:28:11, Mar 15 2022

Based on the original code from Compulab's U-Boot.

Tested on a imx8mm-cl-iot-gate board populated with 4GB of RAM.

---
 board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c | 24 ++++++++++++++++++---
 board/compulab/imx8mm-cl-iot-gate/ddr/ddr.h |  5 +++++
 2 files changed, 26 insertions(+), 3 deletions(-)
board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c +21 -3
index 42dd0dbf18fa..5b93491923e9 100644
@@ -22,6 +22,8 @@
 #include <asm/mach-imx/gpio.h>
 #include "ddr.h"
 
+#include <linux/delay.h>
+
 static unsigned int lpddr4_mr_read(unsigned int mr_rank, unsigned int mr_addr)
 {
 	unsigned int tmp;
@@ -137,10 +139,11 @@ void spl_dram_init_compulab(void)
 		(struct lpddr4_tcm_desc *)SPL_TCM_DATA;
 
 	if (lpddr4_tcm_desc->sign != DEFAULT) {
-		/* if not in tcm scan mode */
+		/* get ddr type from the eeprom if not in tcm scan mode */
+		ddr_info = cl_eeprom_get_ddrinfo();
 		for (i = 0; i < ARRAY_SIZE(lpddr4_array); i++) {
 			if (lpddr4_array[i].id == ddr_info &&
-			    lpddr4_array[i].subind == 0xff) {
+			lpddr4_array[i].subind == cl_eeprom_get_subind()) {
 				ddr_found = 1;
 				break;
 			}
@@ -198,10 +201,25 @@ void spl_dram_init_compulab(void)
 
 	SPL_TCM_FINI;
 
+	if (ddr_found == 0) {
+		/* Update eeprom */
+		cl_eeprom_set_ddrinfo(ddr_info_mrr);
+		mdelay(10);
+		ddr_info = cl_eeprom_get_ddrinfo();
+		mdelay(10);
+		cl_eeprom_set_subind(lpddr4_array[i].subind);
+		/* make sure that the ddr_info has reached the eeprom */
+		printf("DDRINFO(E): mr5-8 [ 0x%x ], read back\n", ddr_info);
+		if (ddr_info_mrr != ddr_info || cl_eeprom_get_subind() != lpddr4_array[i].subind) {
+			printf("DDRINFO(EEPROM): make sure that the eeprom is accessible\n");
+			printf("DDRINFO(EEPROM): i2c dev 1; i2c md 0x51 0x40 0x50\n");
+		}
+	}
+
 	/* Pass the dram size to th U-Boot through the tcm memory */
 	{ /* To figure out what to store into the TCM buffer */
 	  /* For debug purpouse only. To override the real memsize */
-		unsigned int ddr_tcm_size = 0;
+		unsigned int ddr_tcm_size = cl_eeprom_get_osize();
 
 		if (ddr_tcm_size == 0 || ddr_tcm_size == -1)
 			ddr_tcm_size = lpddr4_array[i].size;
board/compulab/imx8mm-cl-iot-gate/ddr/ddr.h +5 -0
index 59c18911592e..f7d4fdc1016a 100644
@@ -23,4 +23,9 @@ struct lpddr4_tcm_desc {
 	unsigned int count;
 };
 
+u32 cl_eeprom_get_ddrinfo(void);
+u32 cl_eeprom_set_ddrinfo(u32 ddrinfo);
+u32 cl_eeprom_get_subind(void);
+u32 cl_eeprom_set_subind(u32 subind);
+u32 cl_eeprom_get_osize(void);
 #endif
Signature · 1 line
2.25.1
author reviewer
#6 lore raw

PATCH 3/5 imx8mm-cl-iot-gate: Retrieve the MAC address from EEPROM

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Currently the eth0 MAC address is randomly assigned.

Retrieve the MAC address from EEPROM.

---
 arch/arm/dts/imx8mm-cl-iot-gate.dts           | 12 ++++-
 .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c   | 51 +++++++++++++++++++
 configs/imx8mm-cl-iot-gate_defconfig          |  2 +
 3 files changed, 64 insertions(+), 1 deletion(-)
arch/arm/dts/imx8mm-cl-iot-gate.dts +11 -1
index 62e8d0394933..425701204a0c 100644
@@ -17,6 +17,11 @@
 		stdout-path = &uart3;
 	};
 
+	aliases {
+		eeprom0 = &i2c_eeprom0;
+		eeprom1 = &i2c_eeprom1;
+	};
+
 	reg_vusb_5v: regulator-usdhc2 {
 		compatible = "regulator-fixed";
 		regulator-name = "VUSB_5V";
@@ -79,7 +84,7 @@
 	pinctrl-0 = <&pinctrl_i2c1>;
 	status = "okay";
 
-	eeprom@54 {
+	i2c_eeprom0: eeprom@54 {
 		  compatible = "atmel,24c08";
 		  reg = <0x54>;
 		  pagesize = <16>;
@@ -92,6 +97,11 @@
 	pinctrl-0 = <&pinctrl_i2c2>;
 	status = "okay";
 
+	i2c_eeprom1: eeprom@50 {
+		  compatible = "atmel,24c08";
+		  reg = <0x50>;
+		  pagesize = <16>;
+	};
 	rtc@69 {
 		compatible = "abracon,ab1805";
 		reg = <0x69>;
board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c +51 -0

69 lines not on this page · raw message

configs/imx8mm-cl-iot-gate_defconfig +2 -0
index b72f219c786c..ee171f704ed9 100644
@@ -84,6 +84,8 @@ CONFIG_FASTBOOT_FLASH_MMC_DEV=2
 CONFIG_MXC_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_DM_KEYBOARD=y
+CONFIG_MISC=y
+CONFIG_I2C_EEPROM=y
 CONFIG_SUPPORT_EMMC_RPMB=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
Signature · 1 line
2.25.1
author reviewer
#12 lore raw

PATCH 4/5 imx8mm-cl-iot-gate: Retrieve the serial number from EEPROM

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

The serial number is located at offset 0x14 of the EEPROM under i2c0 bus at address 0x54.

To print the serial number in Linux:

SERNUM=$(cat /proc/device-tree/serial-number)
echo $SERNUM

---
 .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c   | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c +50 -0
index 779b64b140ad..27200f728efe 100644
@@ -463,6 +463,52 @@ static int setup_mac_address(void)
 	return 0;
 }
 
+static int read_serial_number(void)
+{
+	unsigned char serialnumber[6];
+	unsigned char reversed[6];
+	char serial_string[12];
+	struct udevice *dev;
+	int ret, off, i;
+
+	off = fdt_path_offset(gd->fdt_blob, "eeprom0");
+	if (off < 0) {
+		printf("No eeprom0 path offset found in DT\n");
+		return off;
+	}
+
+	ret = uclass_get_device_by_of_offset(UCLASS_I2C_EEPROM, off, &dev);
+	if (ret) {
+		printf("%s: Could not find EEPROM\n", __func__);
+		return ret;
+	}
+
+	ret = i2c_set_chip_offset_len(dev, 1);
+	if (ret)
+		return ret;
+
+	ret = i2c_eeprom_read(dev, 0x14, serialnumber, sizeof(serialnumber));
+	if (ret) {
+		printf("%s: Could not read EEPROM\n", __func__);
+		return ret;
+	}
+
+	for (i = sizeof(serialnumber) - 1; i >= 0; i--)
+		reversed[i] = serialnumber[sizeof(serialnumber) - 1 - i];
+
+	for (i = 0; i < sizeof(reversed); i++) {
+		serial_string[i * 2] = (reversed[i] >> 4) & 0xf;
+		serial_string[i * 2 + 1] = reversed[i] & 0xf;
+	}
+
+	for (i = 0; i < sizeof(serial_string); i++)
+		serial_string[i] += '0';
+
+	env_set("serial#", serial_string);
+
+	return 0;
+}
+
 int board_late_init(void)
 {
 	int ret;
@@ -476,5 +522,9 @@ int board_late_init(void)
 	if (ret < 0)
 		printf("Cannot set MAC address from EEPROM\n");
 
+	ret = read_serial_number();
+	if (ret < 0)
+		printf("Cannot read serial number from EEPROM\n");
+
 	return 0;
 }
Signature · 1 line
2.25.1
author reviewer
#13 lore raw

PATCH 5/5 imx8mm-cl-iot-gate: Add redundand environment support

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Add redundand environment support as it is required by SWUpdate.

While at it, also adjust the CONFIG_ENV_OFFSET to a more appropriate larger offset as done on other i.MX8M defconfigs.

---
 configs/imx8mm-cl-iot-gate_defconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
configs/imx8mm-cl-iot-gate_defconfig +3 -1
index ee171f704ed9..8125f53e50f3 100644
@@ -9,7 +9,9 @@ CONFIG_SPL_GPIO=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_ENV_SIZE=0x4000
-CONFIG_ENV_OFFSET=0x4400
+CONFIG_ENV_OFFSET=0x200000
+CONFIG_ENV_OFFSET_REDUND=0x204000
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="imx8mm-cl-iot-gate"
 CONFIG_SPL_TEXT_BASE=0x7E1000
Signature · 1 line
2.25.1
Tested-by on v1 2/5
#2 lore raw

Re: [PATCH 2/5] imx8mm-cl-iot-gate: Retrieve the DDR type from EEPROM

In reply to Fabio Estevam
Quoted 40 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Currently, the DDR type is retrieved by iteracting inside an array of possible DDR types.

This may take saveral attempts, which slows the overall U-Boot process and does not provide a good user experience:

U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 1/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0x5000010 ]
resetting ...

U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 2/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0x1061010 ]
resetting ...

U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 3/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0xff000010 ]
Normal Boot
WDT: Not starting
Trying to boot from MMC2

NOTICE:  BL31: v2.5(release):v2.5
NOTICE:  BL31: Built : 07:12:44, Jan 24 2022

Improve the boot time by retrieving the correct DDR information from the EEPROM:

U-Boot SPL 2022.04-rc4-00045-g6d02bc40d58c (Mar 19 2022 - 08:22:29 -0300) DDRINFO(D): Kingston 4096G
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(E): mr5-8 [ 0xff000010 ]
Normal Boot
WDT: Started watchdog@30280000 with servicing (60s timeout)
Trying to boot from MMC2

Quoted 8 lines
NOTICE:  BL31: v2.5(release):v2.5
NOTICE:  BL31: Built : 22:28:11, Mar 15 2022

Based on the original code from Compulab's U-Boot.

Tested on a imx8mm-cl-iot-gate board populated with 4GB of RAM.

Quoted 73 lines
---
 board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c | 24 ++++++++++++++++++---
 board/compulab/imx8mm-cl-iot-gate/ddr/ddr.h |  5 +++++
 2 files changed, 26 insertions(+), 3 deletions(-)
board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c +21 -3
index 42dd0dbf18fa..5b93491923e9 100644
@@ -22,6 +22,8 @@
 #include <asm/mach-imx/gpio.h>
 #include "ddr.h"
 
+#include <linux/delay.h>
+
 static unsigned int lpddr4_mr_read(unsigned int mr_rank, unsigned int mr_addr)
 {
 	unsigned int tmp;
@@ -137,10 +139,11 @@ void spl_dram_init_compulab(void)
 		(struct lpddr4_tcm_desc *)SPL_TCM_DATA;
 
 	if (lpddr4_tcm_desc->sign != DEFAULT) {
-		/* if not in tcm scan mode */
+		/* get ddr type from the eeprom if not in tcm scan mode */
+		ddr_info = cl_eeprom_get_ddrinfo();
 		for (i = 0; i < ARRAY_SIZE(lpddr4_array); i++) {
 			if (lpddr4_array[i].id == ddr_info &&
-			    lpddr4_array[i].subind == 0xff) {
+			lpddr4_array[i].subind == cl_eeprom_get_subind()) {
 				ddr_found = 1;
 				break;
 			}
@@ -198,10 +201,25 @@ void spl_dram_init_compulab(void)
 
 	SPL_TCM_FINI;
 
+	if (ddr_found == 0) {
+		/* Update eeprom */
+		cl_eeprom_set_ddrinfo(ddr_info_mrr);
+		mdelay(10);
+		ddr_info = cl_eeprom_get_ddrinfo();
+		mdelay(10);
+		cl_eeprom_set_subind(lpddr4_array[i].subind);
+		/* make sure that the ddr_info has reached the eeprom */
+		printf("DDRINFO(E): mr5-8 [ 0x%x ], read back\n", ddr_info);
+		if (ddr_info_mrr != ddr_info || cl_eeprom_get_subind() != lpddr4_array[i].subind) {
+			printf("DDRINFO(EEPROM): make sure that the eeprom is accessible\n");
+			printf("DDRINFO(EEPROM): i2c dev 1; i2c md 0x51 0x40 0x50\n");
+		}
+	}
+
 	/* Pass the dram size to th U-Boot through the tcm memory */
 	{ /* To figure out what to store into the TCM buffer */
 	  /* For debug purpouse only. To override the real memsize */
-		unsigned int ddr_tcm_size = 0;
+		unsigned int ddr_tcm_size = cl_eeprom_get_osize();
 
 		if (ddr_tcm_size == 0 || ddr_tcm_size == -1)
 			ddr_tcm_size = lpddr4_array[i].size;
board/compulab/imx8mm-cl-iot-gate/ddr/ddr.h +5 -0
index 59c18911592e..f7d4fdc1016a 100644
@@ -23,4 +23,9 @@ struct lpddr4_tcm_desc {
 	unsigned int count;
 };
 
+u32 cl_eeprom_get_ddrinfo(void);
+u32 cl_eeprom_set_ddrinfo(u32 ddrinfo);
+u32 cl_eeprom_get_subind(void);
+u32 cl_eeprom_set_subind(u32 subind);
+u32 cl_eeprom_get_osize(void);
 #endif
Signature · 5 lines
Harald

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-62  Fax: +49-8142-66989-80   Email: [email protected]
#3 lore raw

Re: [PATCH 2/5] imx8mm-cl-iot-gate: Retrieve the DDR type from EEPROM

In reply to Fabio Estevam
Quoted 123 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Currently, the DDR type is retrieved by iteracting inside an array of possible DDR types.

This may take saveral attempts, which slows the overall U-Boot process and does not provide a good user experience:

U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 1/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0x5000010 ]
resetting ...

U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 2/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0x1061010 ]
resetting ...

U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 3/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0xff000010 ]
Normal Boot
WDT: Not starting
Trying to boot from MMC2

NOTICE:  BL31: v2.5(release):v2.5
NOTICE:  BL31: Built : 07:12:44, Jan 24 2022

Improve the boot time by retrieving the correct DDR information from the EEPROM:

U-Boot SPL 2022.04-rc4-00045-g6d02bc40d58c (Mar 19 2022 - 08:22:29 -0300) DDRINFO(D): Kingston 4096G
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(E): mr5-8 [ 0xff000010 ]
Normal Boot
WDT: Started watchdog@30280000 with servicing (60s timeout)
Trying to boot from MMC2

NOTICE:  BL31: v2.5(release):v2.5
NOTICE:  BL31: Built : 22:28:11, Mar 15 2022

Based on the original code from Compulab's U-Boot.

Tested on a imx8mm-cl-iot-gate board populated with 4GB of RAM.

---
 board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c | 24 ++++++++++++++++++---
 board/compulab/imx8mm-cl-iot-gate/ddr/ddr.h |  5 +++++
 2 files changed, 26 insertions(+), 3 deletions(-)
board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c +21 -3
index 42dd0dbf18fa..5b93491923e9 100644
@@ -22,6 +22,8 @@
 #include <asm/mach-imx/gpio.h>
 #include "ddr.h"
 
+#include <linux/delay.h>
+
 static unsigned int lpddr4_mr_read(unsigned int mr_rank, unsigned int mr_addr)
 {
        unsigned int tmp;
@@ -137,10 +139,11 @@ void spl_dram_init_compulab(void)
                (struct lpddr4_tcm_desc *)SPL_TCM_DATA;
 
        if (lpddr4_tcm_desc->sign != DEFAULT) {
-               /* if not in tcm scan mode */
+               /* get ddr type from the eeprom if not in tcm scan mode */
+               ddr_info = cl_eeprom_get_ddrinfo();
                for (i = 0; i < ARRAY_SIZE(lpddr4_array); i++) {
                        if (lpddr4_array[i].id == ddr_info &&
-                           lpddr4_array[i].subind == 0xff) {
+                       lpddr4_array[i].subind == cl_eeprom_get_subind()) {
                                ddr_found = 1;
                                break;
                        }
@@ -198,10 +201,25 @@ void spl_dram_init_compulab(void)
 
        SPL_TCM_FINI;
 
+       if (ddr_found == 0) {
+               /* Update eeprom */
+               cl_eeprom_set_ddrinfo(ddr_info_mrr);
+               mdelay(10);
+               ddr_info = cl_eeprom_get_ddrinfo();
+               mdelay(10);
+               cl_eeprom_set_subind(lpddr4_array[i].subind);
+               /* make sure that the ddr_info has reached the eeprom */
+               printf("DDRINFO(E): mr5-8 [ 0x%x ], read back\n", ddr_info);
+               if (ddr_info_mrr != ddr_info || cl_eeprom_get_subind() != lpddr4_array[i].subind) {
+                       printf("DDRINFO(EEPROM): make sure that the eeprom is accessible\n");
+                       printf("DDRINFO(EEPROM): i2c dev 1; i2c md 0x51 0x40 0x50\n");
+               }
+       }
+
        /* Pass the dram size to th U-Boot through the tcm memory */
        { /* To figure out what to store into the TCM buffer */
          /* For debug purpouse only. To override the real memsize */
-               unsigned int ddr_tcm_size = 0;
+               unsigned int ddr_tcm_size = cl_eeprom_get_osize();
 
                if (ddr_tcm_size == 0 || ddr_tcm_size == -1)
                        ddr_tcm_size = lpddr4_array[i].size;
board/compulab/imx8mm-cl-iot-gate/ddr/ddr.h +5 -1
index 59c18911592e..f7d4fdc1016a 100644
@@ -23,4 +23,9 @@ struct lpddr4_tcm_desc {
        unsigned int count;
 };
 
+u32 cl_eeprom_get_ddrinfo(void);
+u32 cl_eeprom_set_ddrinfo(u32 ddrinfo);
+u32 cl_eeprom_get_subind(void);
+u32 cl_eeprom_set_subind(u32 subind);
+u32 cl_eeprom_get_osize(void);
 #endif
--
Quoted 2 lines

2.25.1

Fabio,

This seems like a strange approach if you have an EEPROM that tells you which memory you have. If you know which memory why don't you just use the correct struct dram_timing_info directly from the lpddr4_array instead of looping through the array?

For imx8mm_venice boards the EEPROM on the board provides me with DRAM details. Currently I only need DRAM size to be able to pick from several dram_timing_info options [1].

Best Regards,

Tim
[1] https://elixir.bootlin.com/u-boot/latest/source/board/gateworks/venice/spl.c#L39

#4 lore raw

Re: [PATCH 2/5] imx8mm-cl-iot-gate: Retrieve the DDR type from EEPROM

Hi Tim,

It seems to me the correct logic is.
If EEPROM provides information, we use that information directly. Pick a dram setting and test the ram if it works.
If it is not working, then that means EEPROM has wrong data or someone clean it wrongly.
So we loop the table, try to find the correct setting, and update the EEPROM.

Yours,
Paul

Quoted 153 lines · Tim Harvey
Quoted 48 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Currently, the DDR type is retrieved by iteracting inside an array of possible DDR types.

This may take saveral attempts, which slows the overall U-Boot process and does not provide a good user experience:

U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 1/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0x5000010 ]
resetting ...

U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 2/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0x1061010 ]
resetting ...

U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 3/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0xff000010 ]
Normal Boot
WDT: Not starting
Trying to boot from MMC2

NOTICE:  BL31: v2.5(release):v2.5
NOTICE:  BL31: Built : 07:12:44, Jan 24 2022

Improve the boot time by retrieving the correct DDR information from the EEPROM:

U-Boot SPL 2022.04-rc4-00045-g6d02bc40d58c (Mar 19 2022 - 08:22:29 -0300) DDRINFO(D): Kingston 4096G
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(E): mr5-8 [ 0xff000010 ]
Normal Boot
WDT: Started watchdog@30280000 with servicing (60s timeout)
Trying to boot from MMC2

NOTICE:  BL31: v2.5(release):v2.5
NOTICE:  BL31: Built : 22:28:11, Mar 15 2022

Based on the original code from Compulab's U-Boot.

Tested on a imx8mm-cl-iot-gate board populated with 4GB of RAM.

Review

Quoted 7 lines
---
 board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c | 24 ++++++++++++++++++---
 board/compulab/imx8mm-cl-iot-gate/ddr/ddr.h |  5 +++++
 2 files changed, 26 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c

board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c line 27

Quoted 10 lines

index 42dd0dbf18fa..5b93491923e9 100644

board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c +2 -0
@@ -22,6 +22,8 @@
 #include <asm/mach-imx/gpio.h>
 #include "ddr.h"
 
+#include <linux/delay.h>
+
 static unsigned int lpddr4_mr_read(unsigned int mr_rank, unsigned int

mr_addr)

board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c void spl_dram_init_compulab(void) · line 142

Quoted 8 lines
board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c +1 -1
 {
        unsigned int tmp;
@@ -137,10 +139,11 @@ void spl_dram_init_compulab(void)
                (struct lpddr4_tcm_desc *)SPL_TCM_DATA;
 
        if (lpddr4_tcm_desc->sign != DEFAULT) {
-               /* if not in tcm scan mode */
+               /* get ddr type from the eeprom if not in tcm scan mode

*/

board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c void spl_dram_init_compulab(void)

Quoted 5 lines
board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c +2 -1
+               ddr_info = cl_eeprom_get_ddrinfo();
                for (i = 0; i < ARRAY_SIZE(lpddr4_array); i++) {
                        if (lpddr4_array[i].id == ddr_info &&
-                           lpddr4_array[i].subind == 0xff) {
+                       lpddr4_array[i].subind ==

cl_eeprom_get_subind()) {

Quoted 6 lines
board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c +0 -0
                                ddr_found = 1;
                                break;
                        }
@@ -198,10 +201,25 @@ void spl_dram_init_compulab(void)
 
        SPL_TCM_FINI;

board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c void spl_dram_init_compulab(void) · line 212

Quoted 10 lines
board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c +9 -0
 
+       if (ddr_found == 0) {
+               /* Update eeprom */
+               cl_eeprom_set_ddrinfo(ddr_info_mrr);
+               mdelay(10);
+               ddr_info = cl_eeprom_get_ddrinfo();
+               mdelay(10);
+               cl_eeprom_set_subind(lpddr4_array[i].subind);
+               /* make sure that the ddr_info has reached the eeprom */
+               printf("DDRINFO(E): mr5-8 [ 0x%x ], read back\n",

ddr_info);

board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c void spl_dram_init_compulab(void) · line 213

Quoted 1 line
board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c +1 -0
+               if (ddr_info_mrr != ddr_info || cl_eeprom_get_subind()

!= lpddr4_array[i].subind) {

board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c void spl_dram_init_compulab(void) · line 214

Quoted 1 line
board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c +1 -0
+                       printf("DDRINFO(EEPROM): make sure that the

eeprom is accessible\n");

board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c void spl_dram_init_compulab(void) · line 215

Quoted 1 line
board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c +1 -0
+                       printf("DDRINFO(EEPROM): i2c dev 1; i2c md 0x51

0x40 0x50\n");

Review

Quoted 12 lines
board/compulab/imx8mm-cl-iot-gate/ddr/ddr.c +4 -1
+               }
+       }
+
        /* Pass the dram size to th U-Boot through the tcm memory */
        { /* To figure out what to store into the TCM buffer */
          /* For debug purpouse only. To override the real memsize */
-               unsigned int ddr_tcm_size = 0;
+               unsigned int ddr_tcm_size = cl_eeprom_get_osize();
 
                if (ddr_tcm_size == 0 || ddr_tcm_size == -1)
                        ddr_tcm_size = lpddr4_array[i].size;
(quoted diff) +0 -0

b/board/compulab/imx8mm-cl-iot-gate/ddr/ddr.h

Quoted 14 lines

index 59c18911592e..f7d4fdc1016a 100644

board/compulab/imx8mm-cl-iot-gate/ddr/ddr.h +5 -1
@@ -23,4 +23,9 @@ struct lpddr4_tcm_desc {
        unsigned int count;
 };
 
+u32 cl_eeprom_get_ddrinfo(void);
+u32 cl_eeprom_set_ddrinfo(u32 ddrinfo);
+u32 cl_eeprom_get_subind(void);
+u32 cl_eeprom_set_subind(u32 subind);
+u32 cl_eeprom_get_osize(void);
 #endif
--
Quoted 2 lines

2.25.1

Fabio,

This seems like a strange approach if you have an EEPROM that tells you which memory you have. If you know which memory why don't you just use the correct struct dram_timing_info directly from the lpddr4_array instead of looping through the array?

For imx8mm_venice boards the EEPROM on the board provides me with DRAM details. Currently I only need DRAM size to be able to pick from several dram_timing_info options [1].

Best Regards,

Tim
[1]
https://elixir.bootlin.com/u-boot/latest/source/board/gateworks/venice/spl.c#L39

#7 lore raw

Re: [PATCH 3/5] imx8mm-cl-iot-gate: Retrieve the MAC address from EEPROM

In reply to Fabio Estevam

Hi Fabio,

I get an error by applying your patches:

aarch64: + imx8mm-cl-iot-gate-optee
+===================== WARNING ======================
+This board does not use CONFIG_DM_SERIAL (Driver Model
+for Serial drivers). Please update the board to use
+CONFIG_DM_SERIAL before the v2023.04 release. Failure to
+update by the deadline may result in board removal.
+See doc/develop/driver-model/migration.rst for more info.
+====================================================
+aarch64-linux-ld.bfd: board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.o: in function `setup_mac_address':
+board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c:449: undefined reference to i2c_eeprom_read' +aarch64-linux-ld.bfd: board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.o: in function read_serial_number':
+board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c:490: undefined reference to `i2c_eeprom_read' +make[1]: *** [Makefile:1810: u-boot] Error 139
+make[1]: *** Deleting file 'u-boot'
+make: *** [Makefile:177: sub-make] Error 2

Can you check and repost, please ?

Best regards,
Stefano

Quoted 138 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Currently the eth0 MAC address is randomly assigned.

Retrieve the MAC address from EEPROM.

---
  arch/arm/dts/imx8mm-cl-iot-gate.dts           | 12 ++++-
  .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c   | 51 +++++++++++++++++++
  configs/imx8mm-cl-iot-gate_defconfig          |  2 +
  3 files changed, 64 insertions(+), 1 deletion(-)
arch/arm/dts/imx8mm-cl-iot-gate.dts +11 -1
index 62e8d0394933..425701204a0c 100644
@@ -17,6 +17,11 @@
  		stdout-path = &uart3;
  	};
 
+	aliases {
+		eeprom0 = &i2c_eeprom0;
+		eeprom1 = &i2c_eeprom1;
+	};
+
  	reg_vusb_5v: regulator-usdhc2 {
  		compatible = "regulator-fixed";
  		regulator-name = "VUSB_5V";
@@ -79,7 +84,7 @@
  	pinctrl-0 = <&pinctrl_i2c1>;
  	status = "okay";
 
-	eeprom@54 {
+	i2c_eeprom0: eeprom@54 {
  		  compatible = "atmel,24c08";
  		  reg = <0x54>;
  		  pagesize = <16>;
@@ -92,6 +97,11 @@
  	pinctrl-0 = <&pinctrl_i2c2>;
  	status = "okay";
 
+	i2c_eeprom1: eeprom@50 {
+		  compatible = "atmel,24c08";
+		  reg = <0x50>;
+		  pagesize = <16>;
+	};
  	rtc@69 {
  		compatible = "abracon,ab1805";
  		reg = <0x69>;
board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c +51 -0
index 7e2d88f449ce..779b64b140ad 100644
@@ -12,6 +12,8 @@
  #include <init.h>
  #include <miiphy.h>
  #include <netdev.h>
+#include <i2c_eeprom.h>
+#include <i2c.h>
 
  #include <asm/arch/clock.h>
  #include <asm/arch/imx8mm_pins.h>
@@ -418,12 +420,61 @@ int extension_board_scan(struct list_head *extension_list)
          return ret;
  }
 
+static int setup_mac_address(void)
+{
+	unsigned char enetaddr[6];
+	struct udevice *dev;
+	int ret, off;
+
+	ret = eth_env_get_enetaddr("ethaddr", enetaddr);
+	if (ret)
+		return 0;
+
+	off = fdt_path_offset(gd->fdt_blob, "eeprom1");
+	if (off < 0) {
+		printf("No eeprom0 path offset found in DT\n");
+		return off;
+	}
+
+	ret = uclass_get_device_by_of_offset(UCLASS_I2C_EEPROM, off, &dev);
+	if (ret) {
+		printf("%s: Could not find EEPROM\n", __func__);
+		return ret;
+	}
+
+	ret = i2c_set_chip_offset_len(dev, 1);
+	if (ret)
+		return ret;
+
+	ret = i2c_eeprom_read(dev, 4, enetaddr, sizeof(enetaddr));
+	if (ret) {
+		printf("%s: Could not read EEPROM\n", __func__);
+		return ret;
+	}
+
+	ret = is_valid_ethaddr(enetaddr);
+	if (!ret)
+		return -EINVAL;
+
+	ret = eth_env_set_enetaddr("ethaddr", enetaddr);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
  int board_late_init(void)
  {
+	int ret;
+
  	if (IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG)) {
  		env_set("board_name", "IOT-GATE-IMX8");
  		env_set("board_rev", "SBC-IOTMX8");
  	}
 
+	ret = setup_mac_address();
+	if (ret < 0)
+		printf("Cannot set MAC address from EEPROM\n");
+
  	return 0;
  }
configs/imx8mm-cl-iot-gate_defconfig +2 -0
index b72f219c786c..ee171f704ed9 100644
@@ -84,6 +84,8 @@ CONFIG_FASTBOOT_FLASH_MMC_DEV=2
  CONFIG_MXC_GPIO=y
  CONFIG_DM_I2C=y
  CONFIG_DM_KEYBOARD=y
+CONFIG_MISC=y
+CONFIG_I2C_EEPROM=y
  CONFIG_SUPPORT_EMMC_RPMB=y
  CONFIG_SUPPORT_EMMC_BOOT=y
  CONFIG_FSL_USDHC=y
Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#9 lore raw

Re: [PATCH 3/5] imx8mm-cl-iot-gate: Retrieve the MAC address from EEPROM

In reply to Fabio Estevam

Hi Fabio,

Quoted 5 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Currently the eth0 MAC address is randomly assigned.

Retrieve the MAC address from EEPROM.

A bit of a plug, but can you try [1]? For your board, I believe your device tree would be something like

	&fec1 {
		nvmem-cells = <&fec1_addr>;
		nvmem-cell-names = "mac-address";
	};
		

	i2c_eeprom1: eeprom@50 {
		compatible = "atmel,24c08";
		reg = <0x50>;
		pagesize = <16>;

		fec1_addr: mac-address@4 {
			reg = <4 6>;
		};
			
	};

And you would need to enable CONFIG_NVMEM

[1] https://lore.kernel.org/u-boot/[email protected]/

Quoted 134 lines
---
 arch/arm/dts/imx8mm-cl-iot-gate.dts           | 12 ++++-
 .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c   | 51 +++++++++++++++++++
 configs/imx8mm-cl-iot-gate_defconfig          |  2 +
 3 files changed, 64 insertions(+), 1 deletion(-)
arch/arm/dts/imx8mm-cl-iot-gate.dts +11 -1
index 62e8d0394933..425701204a0c 100644
@@ -17,6 +17,11 @@
 		stdout-path = &uart3;
 	};
 
+	aliases {
+		eeprom0 = &i2c_eeprom0;
+		eeprom1 = &i2c_eeprom1;
+	};
+
 	reg_vusb_5v: regulator-usdhc2 {
 		compatible = "regulator-fixed";
 		regulator-name = "VUSB_5V";
@@ -79,7 +84,7 @@
 	pinctrl-0 = <&pinctrl_i2c1>;
 	status = "okay";
 
-	eeprom@54 {
+	i2c_eeprom0: eeprom@54 {
 		  compatible = "atmel,24c08";
 		  reg = <0x54>;
 		  pagesize = <16>;
@@ -92,6 +97,11 @@
 	pinctrl-0 = <&pinctrl_i2c2>;
 	status = "okay";
 
+	i2c_eeprom1: eeprom@50 {
+		  compatible = "atmel,24c08";
+		  reg = <0x50>;
+		  pagesize = <16>;
+	};
 	rtc@69 {
 		compatible = "abracon,ab1805";
 		reg = <0x69>;
board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c +51 -0
index 7e2d88f449ce..779b64b140ad 100644
@@ -12,6 +12,8 @@
 #include <init.h>
 #include <miiphy.h>
 #include <netdev.h>
+#include <i2c_eeprom.h>
+#include <i2c.h>
 
 #include <asm/arch/clock.h>
 #include <asm/arch/imx8mm_pins.h>
@@ -418,12 +420,61 @@ int extension_board_scan(struct list_head *extension_list)
         return ret;
 }
 
+static int setup_mac_address(void)
+{
+	unsigned char enetaddr[6];
+	struct udevice *dev;
+	int ret, off;
+
+	ret = eth_env_get_enetaddr("ethaddr", enetaddr);
+	if (ret)
+		return 0;
+
+	off = fdt_path_offset(gd->fdt_blob, "eeprom1");
+	if (off < 0) {
+		printf("No eeprom0 path offset found in DT\n");
+		return off;
+	}
+
+	ret = uclass_get_device_by_of_offset(UCLASS_I2C_EEPROM, off, &dev);
+	if (ret) {
+		printf("%s: Could not find EEPROM\n", __func__);
+		return ret;
+	}
+
+	ret = i2c_set_chip_offset_len(dev, 1);
+	if (ret)
+		return ret;
+
+	ret = i2c_eeprom_read(dev, 4, enetaddr, sizeof(enetaddr));
+	if (ret) {
+		printf("%s: Could not read EEPROM\n", __func__);
+		return ret;
+	}
+
+	ret = is_valid_ethaddr(enetaddr);
+	if (!ret)
+		return -EINVAL;
+
+	ret = eth_env_set_enetaddr("ethaddr", enetaddr);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
 int board_late_init(void)
 {
+	int ret;
+
 	if (IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG)) {
 		env_set("board_name", "IOT-GATE-IMX8");
 		env_set("board_rev", "SBC-IOTMX8");
 	}
 
+	ret = setup_mac_address();
+	if (ret < 0)
+		printf("Cannot set MAC address from EEPROM\n");
+
 	return 0;
 }
configs/imx8mm-cl-iot-gate_defconfig +2 -0
index b72f219c786c..ee171f704ed9 100644
@@ -84,6 +84,8 @@ CONFIG_FASTBOOT_FLASH_MMC_DEV=2
 CONFIG_MXC_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_DM_KEYBOARD=y
+CONFIG_MISC=y
+CONFIG_I2C_EEPROM=y
 CONFIG_SUPPORT_EMMC_RPMB=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
#8 lore raw

Re: [PATCH 3/5] imx8mm-cl-iot-gate: Retrieve the MAC address from EEPROM

In reply to Stefano Babic

Hi Stefano,

Quoted 5 lines · Stefano Babic

Hi Fabio,

I get an error by applying your patches:

aarch64: + imx8mm-cl-iot-gate-optee

Ops, I missed to update imx8mm-cl-iot-gate-optee_defconfig.

I have sent v2 with the correction.

Thanks,

Fabio Estevam

#10 lore raw

Re: [PATCH 3/5] imx8mm-cl-iot-gate: Retrieve the MAC address from EEPROM

In reply to Sean Anderson

Hi Sean,

Quoted 11 lines · Sean Anderson

Hi Fabio,

Quoted 5 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Currently the eth0 MAC address is randomly assigned.

Retrieve the MAC address from EEPROM.

A bit of a plug, but can you try [1]? For your board, I believe your device tree would be something like

That's a good idea.

I will send a follow-up patch with your suggestion after this series gets applied.

Thanks,

Fabio Estevam

#14 lore raw

PATCH 5/5 imx8mm-cl-iot-gate: Add redundand environment support

In reply to Fabio Estevam
Quoted 6 lines

From: Fabio Estevam <[email protected]>
Add redundand environment support as it is required
by SWUpdate.
While at it, also adjust the CONFIG_ENV_OFFSET to a more appropriate larger offset as done on other i.MX8M defconfigs.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#11 lore raw

PATCH 3/5 imx8mm-cl-iot-gate: Retrieve the MAC address from EEPROM

In reply to Fabio Estevam
Quoted 4 lines

From: Fabio Estevam <[email protected]> Currently the eth0 MAC address is randomly assigned. Retrieve the MAC address from EEPROM.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#5 lore raw

PATCH 2/5 imx8mm-cl-iot-gate: Retrieve the DDR type from EEPROM

In reply to Fabio Estevam
Quoted 33 lines

From: Fabio Estevam <[email protected]>
Currently, the DDR type is retrieved by iteracting inside an array of possible DDR types.
This may take saveral attempts, which slows the overall U-Boot process and does not provide a good user experience:
U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 1/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0x5000010 ]
resetting ...
U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 2/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0x1061010 ]
resetting ...
U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 3/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0xff000010 ]
Normal Boot
WDT: Not starting
Trying to boot from MMC2

NOTICE:  BL31: v2.5(release):v2.5
NOTICE:  BL31: Built : 07:12:44, Jan 24 2022

Improve the boot time by retrieving the correct DDR information from the EEPROM:
U-Boot SPL 2022.04-rc4-00045-g6d02bc40d58c (Mar 19 2022 - 08:22:29 -0300) DDRINFO(D): Kingston 4096G
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(E): mr5-8 [ 0xff000010 ]
Normal Boot
WDT: Started watchdog@30280000 with servicing (60s timeout)
Trying to boot from MMC2

Quoted 6 lines
NOTICE:  BL31: v2.5(release):v2.5
NOTICE:  BL31: Built : 22:28:11, Mar 15 2022

Based on the original code from Compulab's U-Boot. Tested on a imx8mm-cl-iot-gate board populated with 4GB of RAM.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#15 lore raw

PATCH 1/5 imx8mm-cl-iot-gate: Add SPL EEPROM support

In reply to Fabio Estevam
Quoted 6 lines

From: Fabio Estevam <[email protected]> imx8mm-cl-iot-gate supports multiple DDR sizes and models. The DDR type can be retrieved from the EEPROM, so add SPL code that can be used to get the DDR information.
Based on the original code from Compulab's U-Boot.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================