Skip to contentSkip to conversation

Miscellaneous fixes

PATCH Superseded Jerome Forissier 6 participants 34 messages Aug 28, 2024 – Sep 10, 2024

Subsystems (9)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover Miscellaneous fixes

Miscellaneous fixes made when developing the lwIP series [1].

[1] http://patchwork.ozlabs.org/project/uboot/list/?series=420712&state=%2A&archive=both

Jerome Forissier (13):
Makefile: detect HOST_ARCH properly when CROSS_COMPILE is multi-word
flash: prefix error codes with FL_
at91: rename mem_init() to at91_mem_init()
arm: omap2: add missing #include <netdev.h>
net: fm: call dtsec_init_phy() only when it is defined
net: wget: removed unused function wget_success()
net: phy: ncsi: depend on NET
net: ftgmac100: depend on NET
net: wget: allow EFI boot
net: fec_mxc_init(): do not ignore return status of fec_open() test/py: net_boot: fix comment
test/py: test_efi_loader: add missing dependency on cmd_tftpboot test/py: test_efi_loader: add HTTP (wget) test for the EFI loader

 Makefile                                      |  2 +-
 arch/arm/mach-at91/include/mach/at91_common.h |  2 +-
 arch/arm/mach-at91/spl_at91.c                 |  2 +-
 arch/arm/mach-at91/spl_atmel.c                |  2 +-
 arch/arm/mach-omap2/omap3/emac.c              |  1 +
 .../atmel/at91sam9m10g45ek/at91sam9m10g45ek.c |  2 +-
 board/atmel/at91sam9n12ek/at91sam9n12ek.c     |  2 +-
 board/atmel/at91sam9x5ek/at91sam9x5ek.c       |  2 +-
 .../atmel/sama5d27_som1_ek/sama5d27_som1_ek.c |  2 +-
 .../sama5d27_wlsom1_ek/sama5d27_wlsom1_ek.c   |  2 +-
 board/atmel/sama5d2_icp/sama5d2_icp.c         |  2 +-
 .../atmel/sama5d2_xplained/sama5d2_xplained.c |  2 +-
 .../atmel/sama5d3_xplained/sama5d3_xplained.c |  2 +-
 board/atmel/sama5d3xek/sama5d3xek.c           |  2 +-
 .../atmel/sama5d4_xplained/sama5d4_xplained.c |  2 +-
 board/atmel/sama5d4ek/sama5d4ek.c             |  2 +-
 board/cobra5272/flash.c                       | 26 ++++----
 .../conclusive/kstr-sama5d27/kstr-sama5d27.c  |  2 +-
 board/freescale/m5253demo/flash.c             |  6 +-
 board/gardena/smart-gateway-at91sam/spl.c     |  2 +-
 board/siemens/corvus/board.c                  |  2 +-
 board/siemens/smartweb/smartweb.c             |  2 +-
 board/siemens/taurus/taurus.c                 |  2 +-
 common/flash.c                                | 44 ++++++-------
 drivers/mtd/cfi_flash.c                       | 36 +++++------
 drivers/net/Kconfig                           |  1 +
 drivers/net/fec_mxc.c                         |  3 +-
 drivers/net/fm/eth.c                          |  2 +
 drivers/net/phy/Kconfig                       |  1 +
 include/flash.h                               | 20 +++---
 net/wget.c                                    | 11 ++--
 test/py/tests/test_efi_loader.py              | 62 ++++++++++++++-----
 test/py/tests/test_net_boot.py                |  2 +-
 33 files changed, 144 insertions(+), 111 deletions(-)
Signature · 1 line
2.40.1
#1 lore raw

PATCH 1/13 Makefile: detect HOST_ARCH properly when CROSS_COMPILE is multi-word

When CROSS_COMPILE contains multiple words, HOST_ARCH is not properly detected and the sandbox build fail. It typically happens when using ccache. For example:

 $ make sandbox_defconfig
 $ make CROSS_COMPILE="ccache x86_64-linux-gnu-" \
        CC="ccache x86_64-linux-gnu-gcc"
 [...]
 In file included from boot/bootmeth_efi.c:16:
 include/efi_default_filename.h:33:2: error: #error Unsupported UEFI architecture
    33 | #error Unsupported UEFI architecture
       |  ^~~~~

A similar error occurs when the build is done via buildman and ~/.buildman contains:

[toolchain-wrapper]
wrapper = ccache

Fix the issue by considering only the last word in $(CROSS_COMPILE).

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index f90e48f58a..dc7bdd7942 100644
@@ -21,7 +21,7 @@ include include/host_arch.h
 ifeq ("", "$(CROSS_COMPILE)")
   MK_ARCH="${shell uname -m}"
 else
-  MK_ARCH="${shell echo $(CROSS_COMPILE) | sed -n 's/^[[:space:]]*\([^\/]*\/\)*\([^-]*\)-[^[:space:]]*/\2/p'}"
+  MK_ARCH="${shell echo ${lastword $(CROSS_COMPILE)} | sed -n 's/^[[:space:]]*\([^\/]*\/\)*\([^-]*\)-[^[:space:]]*/\2/p'}"
 endif
 unexport HOST_ARCH
 ifeq ("x86_64", $(MK_ARCH))
Signature · 1 line
2.40.1
#3 lore raw

PATCH 2/13 flash: prefix error codes with FL_

In reply to Jerome Forissier

Prefix the flash status codes (ERR_*) with FL_ in order to avoid clashes with third-party libraries. Case in point: including the lwIP library header file <lwip/err.h> which defines err_enum_t as an enum with values being ERR_*.

---
 board/cobra5272/flash.c           | 26 +++++++++---------
 board/freescale/m5253demo/flash.c |  6 ++---
 common/flash.c                    | 44 +++++++++++++++----------------
 drivers/mtd/cfi_flash.c           | 36 ++++++++++++-------------
 include/flash.h                   | 20 +++++++-------
 5 files changed, 66 insertions(+), 66 deletions(-)
board/cobra5272/flash.c +13 -13
index 616842e62f..d324aa6ac1 100644
@@ -135,22 +135,22 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 {
 	ulong result;
 	int iflag, cflag, prot, sect;
-	int rc = ERR_OK;
+	int rc = FL_ERR_OK;
 	int chip1;
 	ulong start;
 
 	/* first look for protection bits */
 
 	if (info->flash_id == FLASH_UNKNOWN)
-		return ERR_UNKNOWN_FLASH_TYPE;
+		return FL_ERR_UNKNOWN_FLASH_TYPE;
 
 	if ((s_first < 0) || (s_first > s_last)) {
-		return ERR_INVAL;
+		return FL_ERR_INVAL;
 	}
 
 	if ((info->flash_id & FLASH_VENDMASK) !=
 	    (AMD_MANUFACT & FLASH_VENDMASK)) {
-		return ERR_UNKNOWN_FLASH_VENDOR;
+		return FL_ERR_UNKNOWN_FLASH_VENDOR;
 	}
 
 	prot = 0;
@@ -160,7 +160,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 		}
 	}
 	if (prot)
-		return ERR_PROTECTED;
+		return FL_ERR_PROTECTED;
 
 	/*
 	 * Disable interrupts which might cause a timeout
@@ -217,11 +217,11 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 			MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
 
 			if (chip1 == ERR) {
-				rc = ERR_PROG_ERROR;
+				rc = FL_ERR_PROG_ERROR;
 				goto outahere;
 			}
 			if (chip1 == TMO) {
-				rc = ERR_TIMEOUT;
+				rc = FL_ERR_TIMEOUT;
 				goto outahere;
 			}
 
@@ -252,7 +252,7 @@ static int write_word(flash_info_t *info, ulong dest, ulong data)
 {
 	volatile u16 *addr = (volatile u16 *) dest;
 	ulong result;
-	int rc = ERR_OK;
+	int rc = FL_ERR_OK;
 	int cflag, iflag;
 	int chip1;
 	ulong start;
@@ -262,7 +262,7 @@ static int write_word(flash_info_t *info, ulong dest, ulong data)
 	 */
 	result = *addr;
 	if ((result & data) != data)
-		return ERR_NOT_ERASED;
+		return FL_ERR_NOT_ERASED;
 
 	/*
 	 * Disable interrupts which might cause a timeout
@@ -302,7 +302,7 @@ static int write_word(flash_info_t *info, ulong dest, ulong data)
 	*addr = CMD_READ_ARRAY;
 
 	if (chip1 == ERR || *addr != data)
-		rc = ERR_PROG_ERROR;
+		rc = FL_ERR_PROG_ERROR;
 
 	if (iflag)
 		enable_interrupts();
@@ -320,13 +320,13 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
 
 	if (addr & 1) {
 		printf ("unaligned destination not supported\n");
-		return ERR_ALIGN;
+		return FL_ERR_ALIGN;
 	}
 
 #if 0
 	if (cnt & 1) {
 		printf ("odd transfer sizes not supported\n");
-		return ERR_ALIGN;
+		return FL_ERR_ALIGN;
 	}
 #endif
 
@@ -364,5 +364,5 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
 		cnt -= 1;
 	}
 
-	return ERR_OK;
+	return FL_ERR_OK;
 }
board/freescale/m5253demo/flash.c +3 -3
index 334518a4bc..ab5d2ebff6 100644
@@ -72,7 +72,7 @@ int flash_get_offsets(ulong base, flash_info_t * info)
 		}
 	}
 
-	return ERR_OK;
+	return FL_ERR_OK;
 }
 
 void flash_print_info(flash_info_t * info)
@@ -369,9 +369,9 @@ int write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt)
 	}
 
 	if (cnt == 0)
-		return ERR_OK;
+		return FL_ERR_OK;
 
-	return ERR_OK;
+	return FL_ERR_OK;
 }
 
 /*-----------------------------------------------------------------------
common/flash.c +22 -22

97 lines not on this page · raw message

drivers/mtd/cfi_flash.c +18 -18
index a7826e81c1..e50502824a 100644
@@ -593,11 +593,11 @@ static int flash_status_check(flash_info_t *info, flash_sect_t sector,
 			       flash_read_long(info, sector, 0));
 			flash_write_cmd(info, sector, 0, info->cmd_reset);
 			udelay(1);
-			return ERR_TIMEOUT;
+			return FL_ERR_TIMEOUT;
 		}
 		udelay(1);		/* also triggers watchdog */
 	}
-	return ERR_OK;
+	return FL_ERR_OK;
 }
 
 /*-----------------------------------------------------------------------
@@ -616,9 +616,9 @@ static int flash_full_status_check(flash_info_t *info, flash_sect_t sector,
 	case CFI_CMDSET_INTEL_PROG_REGIONS:
 	case CFI_CMDSET_INTEL_EXTENDED:
 	case CFI_CMDSET_INTEL_STANDARD:
-		if (retcode == ERR_OK &&
+		if (retcode == FL_ERR_OK &&
 		    !flash_isset(info, sector, 0, FLASH_STATUS_DONE)) {
-			retcode = ERR_INVAL;
+			retcode = FL_ERR_INVAL;
 			printf("Flash %s error at address %lx\n", prompt,
 			       info->start[sector]);
 			if (flash_isset(info, sector, 0, FLASH_STATUS_ECLBS |
@@ -627,14 +627,14 @@ static int flash_full_status_check(flash_info_t *info, flash_sect_t sector,
 			} else if (flash_isset(info, sector, 0,
 						FLASH_STATUS_ECLBS)) {
 				puts("Block Erase Error.\n");
-				retcode = ERR_NOT_ERASED;
+				retcode = FL_ERR_NOT_ERASED;
 			} else if (flash_isset(info, sector, 0,
 						FLASH_STATUS_PSLBS)) {
 				puts("Locking Error\n");
 			}
 			if (flash_isset(info, sector, 0, FLASH_STATUS_DPS)) {
 				puts("Block locked.\n");
-				retcode = ERR_PROTECTED;
+				retcode = FL_ERR_PROTECTED;
 			}
 			if (flash_isset(info, sector, 0, FLASH_STATUS_VPENS))
 				puts("Vpp Low Error.\n");
@@ -702,12 +702,12 @@ static int flash_status_poll(flash_info_t *info, void *src, void *dst,
 		if (get_timer(start) > tout) {
 			printf("Flash %s timeout at address %lx data %lx\n",
 			       prompt, (ulong)dst, (ulong)flash_read8(dst));
-			return ERR_TIMEOUT;
+			return FL_ERR_TIMEOUT;
 		}
 		udelay(1);		/* also triggers watchdog */
 	}
 #endif /* CONFIG_SYS_CFI_FLASH_STATUS_POLL */
-	return ERR_OK;
+	return FL_ERR_OK;
 }
 
 /*-----------------------------------------------------------------------
@@ -810,7 +810,7 @@ static int flash_write_cfiword(flash_info_t *info, ulong dest, cfiword_t cword)
 		break;
 	}
 	if (!flag)
-		return ERR_NOT_ERASED;
+		return FL_ERR_NOT_ERASED;
 
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts();
@@ -899,7 +899,7 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp,
 		shift = 3;
 		break;
 	default:
-		retcode = ERR_INVAL;
+		retcode = FL_ERR_INVAL;
 		goto out_unmap;
 	}
 
@@ -930,7 +930,7 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp,
 		}
 	}
 	if (!flag) {
-		retcode = ERR_NOT_ERASED;
+		retcode = FL_ERR_NOT_ERASED;
 		goto out_unmap;
 	}
 
@@ -950,7 +950,7 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp,
 		retcode = flash_status_check(info, sector,
 					     info->buffer_write_tout,
 					     "write to buffer");
-		if (retcode == ERR_OK) {
+		if (retcode == FL_ERR_OK) {
 			/* reduce the number of loops by the width of
 			 * the port
 			 */
@@ -975,7 +975,7 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp,
 					src += 8, dst += 8;
 					break;
 				default:
-					retcode = ERR_INVAL;
+					retcode = FL_ERR_INVAL;
 					goto out_unmap;
 				}
 			}
@@ -1025,7 +1025,7 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp,
 			}
 			break;
 		default:
-			retcode = ERR_INVAL;
+			retcode = FL_ERR_INVAL;
 			goto out_unmap;
 		}
 
@@ -1043,7 +1043,7 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp,
 
 	default:
 		debug("Unknown Command Set\n");
-		retcode = ERR_INVAL;
+		retcode = FL_ERR_INVAL;
 		break;
 	}
 
@@ -1389,7 +1389,7 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
 		if (i > cnt)
 			i = cnt;
 		rc = flash_write_cfibuffer(info, wp, src, i);
-		if (rc != ERR_OK)
+		if (rc != FL_ERR_OK)
 			return rc;
 		i -= i & (info->portwidth - 1);
 		wp += i;
@@ -1398,7 +1398,7 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
 		FLASH_SHOW_PROGRESS(scale, dots, digit, i);
 		/* Only check every once in a while */
 		if ((cnt & 0xFFFF) < buffered_size && ctrlc())
-			return ERR_ABORTED;
+			return FL_ERR_ABORTED;
 	}
 #else
 	while (cnt >= info->portwidth) {
@@ -1413,7 +1413,7 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
 		FLASH_SHOW_PROGRESS(scale, dots, digit, info->portwidth);
 		/* Only check every once in a while */
 		if ((cnt & 0xFFFF) < info->portwidth && ctrlc())
-			return ERR_ABORTED;
+			return FL_ERR_ABORTED;
 	}
 #endif /* CONFIG_SYS_FLASH_USE_BUFFER_WRITE */
 
include/flash.h +10 -10
index 60babe8a80..32bc65e7b6 100644
@@ -127,16 +127,16 @@ void flash_perror(int err);
 /*-----------------------------------------------------------------------
  * return codes from flash_write():
  */
-#define ERR_OK				0
-#define ERR_TIMEOUT			1
-#define ERR_NOT_ERASED			2
-#define ERR_PROTECTED			4
-#define ERR_INVAL			8
-#define ERR_ALIGN			16
-#define ERR_UNKNOWN_FLASH_VENDOR	32
-#define ERR_UNKNOWN_FLASH_TYPE		64
-#define ERR_PROG_ERROR			128
-#define ERR_ABORTED			256
+#define FL_ERR_OK			0
+#define FL_ERR_TIMEOUT			1
+#define FL_ERR_NOT_ERASED		2
+#define FL_ERR_PROTECTED		4
+#define FL_ERR_INVAL			8
+#define FL_ERR_ALIGN			16
+#define FL_ERR_UNKNOWN_FLASH_VENDOR	32
+#define FL_ERR_UNKNOWN_FLASH_TYPE	64
+#define FL_ERR_PROG_ERROR		128
+#define FL_ERR_ABORTED			256
 
 /*-----------------------------------------------------------------------
  * Protection Flags for flash_protect():
Signature · 1 line
2.40.1
#4 lore raw

PATCH 3/13 at91: rename mem_init() to at91_mem_init()

In reply to Jerome Forissier

THe AT91-based platforms have a mem_init() function declared in arch/arm/mach-at91/include/mach/at91_common.h and implemented in various places. In preparation of the introduction of the lwIP networking library which also has a global mem_init() function, rename the AT91 one to at91_mem_init().

---
 arch/arm/mach-at91/include/mach/at91_common.h       | 2 +-
 arch/arm/mach-at91/spl_at91.c                       | 2 +-
 arch/arm/mach-at91/spl_atmel.c                      | 2 +-
 board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c     | 2 +-
 board/atmel/at91sam9n12ek/at91sam9n12ek.c           | 2 +-
 board/atmel/at91sam9x5ek/at91sam9x5ek.c             | 2 +-
 board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c     | 2 +-
 board/atmel/sama5d27_wlsom1_ek/sama5d27_wlsom1_ek.c | 2 +-
 board/atmel/sama5d2_icp/sama5d2_icp.c               | 2 +-
 board/atmel/sama5d2_xplained/sama5d2_xplained.c     | 2 +-
 board/atmel/sama5d3_xplained/sama5d3_xplained.c     | 2 +-
 board/atmel/sama5d3xek/sama5d3xek.c                 | 2 +-
 board/atmel/sama5d4_xplained/sama5d4_xplained.c     | 2 +-
 board/atmel/sama5d4ek/sama5d4ek.c                   | 2 +-
 board/conclusive/kstr-sama5d27/kstr-sama5d27.c      | 2 +-
 board/gardena/smart-gateway-at91sam/spl.c           | 2 +-
 board/siemens/corvus/board.c                        | 2 +-
 board/siemens/smartweb/smartweb.c                   | 2 +-
 board/siemens/taurus/taurus.c                       | 2 +-
 19 files changed, 19 insertions(+), 19 deletions(-)
arch/arm/mach-at91/include/mach/at91_common.h +1 -1
index 683e539b1b..8fec346c1e 100644
@@ -28,7 +28,7 @@ void at91_pllb_init(u32 pllar);
 void at91_mck_init(u32 mckr);
 void at91_mck_init_down(u32 mckr);
 void at91_pmc_init(void);
-void mem_init(void);
+void at91_mem_init(void);
 void at91_phy_reset(void);
 void at91_sdram_hw_init(void);
 void at91_mck_init(u32 mckr);
arch/arm/mach-at91/spl_at91.c +1 -1
index cde1700a28..0d1233cd10 100644
@@ -142,7 +142,7 @@ void board_init_f(ulong dummy)
 	preloader_console_init();
 #endif
 
-	mem_init();
+	at91_mem_init();
 
 	at91_spl_board_init();
 }
arch/arm/mach-at91/spl_atmel.c +1 -1
index 62a7df8a19..7bfbadf048 100644
@@ -134,7 +134,7 @@ void board_init_f(ulong dummy)
 
 	board_early_init_f();
 
-	mem_init();
+	at91_mem_init();
 
 	ret = spl_init();
 	if (ret) {
board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c +1 -1
index 3bd94d0889..af486e977e 100644
@@ -125,7 +125,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
 		      2 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
 	struct atmel_mpddrc_config ddr2;
 
board/atmel/at91sam9n12ek/at91sam9n12ek.c +1 -1
index afc0c0520e..6f9abcbb12 100644
@@ -167,7 +167,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
 		      2 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
 	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 	struct at91_matrix *matrix = (struct at91_matrix *)ATMEL_BASE_MATRIX;
board/atmel/at91sam9x5ek/at91sam9x5ek.c +1 -1
index e5688c6cf1..f52b9a9773 100644
@@ -181,7 +181,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
 		      2 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
 	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 	struct at91_matrix *matrix = (struct at91_matrix *)ATMEL_BASE_MATRIX;
board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c +1 -1
index 36995a927c..cb3cd7ac9a 100644
@@ -146,7 +146,7 @@ static void ddrc_conf(struct atmel_mpddrc_config *ddrc)
 		      (8 << ATMEL_MPDDRC_TPR2_TFAW_OFFSET));
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
 	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 	struct atmel_mpddr *mpddrc = (struct atmel_mpddr *)ATMEL_BASE_MPDDRC;
board/atmel/sama5d27_wlsom1_ek/sama5d27_wlsom1_ek.c +1 -1
index c775d593e5..15cbd0daa6 100644
@@ -208,7 +208,7 @@ static void ddrc_conf(struct atmel_mpddrc_config *ddrc)
 	ddrc->cal_mr4 |= ATMEL_MPDDRC_CAL_MR4_MR4R(0xFFFE);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
 	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 	struct atmel_mpddr *mpddrc = (struct atmel_mpddr *)ATMEL_BASE_MPDDRC;
board/atmel/sama5d2_icp/sama5d2_icp.c +1 -1
index 986da01639..6f0d578abf 100644
@@ -180,7 +180,7 @@ static void ddrc_conf(struct atmel_mpddrc_config *ddrc)
 		      (7 << ATMEL_MPDDRC_TPR2_TFAW_OFFSET));
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
 	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 	struct atmel_mpddr *mpddrc = (struct atmel_mpddr *)ATMEL_BASE_MPDDRC;
board/atmel/sama5d2_xplained/sama5d2_xplained.c +1 -1
index c8a8eb4982..d104736fa7 100644
@@ -146,7 +146,7 @@ static void ddrc_conf(struct atmel_mpddrc_config *ddrc)
 		      7 << ATMEL_MPDDRC_TPR2_TFAW_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
 	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 	struct atmel_mpddr *mpddrc = (struct atmel_mpddr *)ATMEL_BASE_MPDDRC;
board/atmel/sama5d3_xplained/sama5d3_xplained.c +1 -1
index 54cc3c4d90..f98322fb54 100644
@@ -175,7 +175,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
 		      8 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
 	struct atmel_mpddrc_config ddr2;
 
board/atmel/sama5d3xek/sama5d3xek.c +1 -1
index f2e1242fcb..28079a8151 100644
@@ -241,7 +241,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
 		      8 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
 	struct atmel_mpddrc_config ddr2;
 
board/atmel/sama5d4_xplained/sama5d4_xplained.c +1 -1
index 09ca16ca88..f9112fc532 100644
@@ -184,7 +184,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
 		      8 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
 	struct atmel_mpddrc_config ddr2;
 
board/atmel/sama5d4ek/sama5d4ek.c +1 -1
index 1f8b85f061..0bdc6adbdc 100644
@@ -169,7 +169,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
 		      8 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
 	struct atmel_mpddrc_config ddr2;
 	const struct atmel_mpddr *mpddr = (struct atmel_mpddr *)ATMEL_BASE_MPDDRC;
board/conclusive/kstr-sama5d27/kstr-sama5d27.c +1 -1
index 64282ae9dc..37750137ad 100644
@@ -182,7 +182,7 @@ static void ddrc_conf(struct atmel_mpddrc_config *ddrc)
 		      (8 << ATMEL_MPDDRC_TPR2_TFAW_OFFSET));
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
 	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 	struct atmel_mpddr *mpddrc = (struct atmel_mpddr *)ATMEL_BASE_MPDDRC;
board/gardena/smart-gateway-at91sam/spl.c +1 -1
index fb3ec48f9c..db9ba88188 100644
@@ -110,7 +110,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
 		      2 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
 	struct at91_matrix *matrix = (struct at91_matrix *)ATMEL_BASE_MATRIX;
 	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
board/siemens/corvus/board.c +1 -1
index 7d73d1f2b3..cd27fc1cc3 100644
@@ -187,7 +187,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
 		      2 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
 	struct atmel_mpddrc_config ddr2;
 
board/siemens/smartweb/smartweb.c +1 -1
index 946fbc3f22..e9e4bc348c 100644
@@ -238,7 +238,7 @@ void at91_spl_board_init(void)
 			 | AT91_SDRAMC_TRP_VAL(2) | AT91_SDRAMC_TRCD_VAL(2) \
 			 | AT91_SDRAMC_TRAS_VAL(5) | AT91_SDRAMC_TXSR_VAL(8))
 
-void mem_init(void)
+void at91_mem_init(void)
 {
 	struct at91_matrix *ma = (struct at91_matrix *)ATMEL_BASE_MATRIX;
 	struct at91_port *port = (struct at91_port *)ATMEL_BASE_PIOC;
board/siemens/taurus/taurus.c +1 -1
index bda12a9770..3764ab48ab 100644
@@ -177,7 +177,7 @@ void sdramc_configure(unsigned int mask)
 	sdramc_initialize(ATMEL_BASE_CS1, &setting);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
 	unsigned int ram_size = 0;
 
Signature · 1 line
2.40.1
#7 lore raw

PATCH 4/13 arm: omap2: add missing #include <netdev.h>

In reply to Jerome Forissier

emac.c implements cpu_eth_init() so it needs to pull the corresponding header file.

---
 arch/arm/mach-omap2/omap3/emac.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-omap2/omap3/emac.c +1 -0
index 7348e92cab..1e30a06361 100644
@@ -9,6 +9,7 @@
 #include <net.h>
 #include <asm/io.h>
 #include <asm/arch/am35x_def.h>
+#include <netdev.h>
 
 /*
  * Initializes on-chip ethernet controllers.
Signature · 1 line
2.40.1
#9 lore raw

PATCH 5/13 net: fm: call dtsec_init_phy() only when it is defined

In reply to Jerome Forissier

dtsec_init_phy() is defined only with MII so add the proper conditional in the caller code.

---
 drivers/net/fm/eth.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/fm/eth.c +2 -0
index 19f3f0fef0..e4ec769693 100644
@@ -701,8 +701,10 @@ static int init_phy(struct fm_eth *fm_eth)
 		supported |= SUPPORTED_2500baseX_Full;
 #endif
 
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) && !defined(BITBANGMII)
 	if (fm_eth->type == FM_ETH_1G_E)
 		dtsec_init_phy(fm_eth);
+#endif
 
 #ifdef CONFIG_PHYLIB
 #ifdef CONFIG_DM_MDIO
Signature · 1 line
2.40.1
#13 lore raw

PATCH 6/13 net: wget: removed unused function wget_success()

In reply to Jerome Forissier

wget_success() is used nowhere so remove it.

---
 net/wget.c | 7 -------
 1 file changed, 7 deletions(-)
net/wget.c +0 -7
index f1dd7abeff..0e4dc5159d 100644
@@ -199,13 +199,6 @@ void wget_fail(char *error_message, unsigned int tcp_seq_num,
 	wget_send(action, tcp_seq_num, tcp_ack_num, 0);
 }
 
-void wget_success(u8 action, unsigned int tcp_seq_num,
-		  unsigned int tcp_ack_num, int len, int packets)
-{
-	printf("Packets received %d, Transfer Successful\n", packets);
-	wget_send(action, tcp_seq_num, tcp_ack_num, len);
-}
-
 /*
  * Interfaces of U-BOOT
  */
Signature · 1 line
2.40.1
#14 lore raw

PATCH 7/13 net: phy: ncsi: depend on NET

In reply to Jerome Forissier

PHY_NCSI enables drivers/net/phy/ncsi.c which calls net_loop() and net_set_timeout_handler(). That's the legacy NET stack (as opposed to NET_LWIP). Therefore add the dependency to Kconfig.

---
 drivers/net/phy/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/net/phy/Kconfig +1 -0
index 73064b2af6..a9efc50981 100644
@@ -368,6 +368,7 @@ config PHY_FIXED
 
 config PHY_NCSI
 	bool "NC-SI based PHY"
+	depends on NET
 
 endif #PHYLIB
 
Signature · 1 line
2.40.1
#16 lore raw

PATCH 8/13 net: ftgmac100: depend on NET

In reply to Jerome Forissier

FTGMAC100 enables drivers/net/ftgmac100.c which uses PHY_INTERFACE_MODE_NCSI, which is defined only when PHY_NCSI is enabled. Therefore FTGMAC100 depends on PHY_NCSI. However adding such a dependency causes a "recursive dependency detected!" message, so add a dependency on NET instead (PHY_NCSI depends on NET). All in all, either the stack is NET and FTGMAC100 can be enabled, or it is NET_LWIP (or NO_NET) and it cannot.

---
 drivers/net/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/net/Kconfig +1 -0
index 69ae7c0750..3382e533f4 100644
@@ -461,6 +461,7 @@ config FTMAC100
 config FTGMAC100
 	bool "Ftgmac100 Ethernet Support"
 	select PHYLIB
+	depends on NET
 	help
 	  This driver supports the Faraday's FTGMAC100 Gigabit SoC
 	  Ethernet controller that can be found on Aspeed SoCs (which
Signature · 1 line
2.40.1
#18 lore raw

PATCH 9/13 net: wget: allow EFI boot

In reply to Jerome Forissier

wget followed by bootefi currently fails as follows:

U-Boot> wget 200000 192.168.0.30:helloworld.efi
Waiting for Ethernet connection... done.
HTTP/1.0 200 OK
Packets received 13, Transfer Successful
Bytes transferred = 12720 (31b0 hex)
U-Boot> bootefi 200000
No UEFI binary known at 200000
U-Boot>

Fix the problem by adding the missing efi_set_bootdev() call.

---
 net/wget.c | 4 ++++
 1 file changed, 4 insertions(+)
net/wget.c +4 -0
index 0e4dc5159d..cf7681a4e7 100644
@@ -8,6 +8,7 @@
 #include <command.h>
 #include <display_options.h>
 #include <env.h>
+#include <efi_loader.h>
 #include <image.h>
 #include <lmb.h>
 #include <mapmem.h>
@@ -429,6 +430,9 @@ static void wget_handler(uchar *pkt, u16 dport,
 	case WGET_TRANSFERRED:
 		printf("Packets received %d, Transfer Successful\n", packets);
 		net_set_state(wget_loop_state);
+		efi_set_bootdev("Net", "", image_url,
+				map_sysmem(image_load_addr, 0),
+				net_boot_file_size);
 		break;
 	}
 }
Signature · 1 line
2.40.1
#26 lore raw

PATCH 10/13 net: fec_mxc_init(): do not ignore return status of fec_open()

In reply to Jerome Forissier

The fec_mxc_init() function currently always returns 0. This does not allow the callers to detect when for instance the PHY initialization failed due to the port being unconnected. Fix that by returning the status of fec_open().

---
 drivers/net/fec_mxc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/fec_mxc.c +1 -2
index 0a0d92bc2c..2dc1364bee 100644
@@ -615,8 +615,7 @@ static int fecmxc_init(struct udevice *dev)
 	if (fec->xcv_type != SEVENWIRE)
 		miiphy_restart_aneg(dev);
 #endif
-	fec_open(dev);
-	return 0;
+	return fec_open(dev);
 }
 
 /**
Signature · 1 line
2.40.1
#28 lore raw

PATCH 11/13 test/py: net_boot: fix comment

In reply to Jerome Forissier

If env__pxe_boot_test_skip is not present, it defaults to True not False. Therefore fix the comment.

---
 test/py/tests/test_net_boot.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
test/py/tests/test_net_boot.py +1 -1
index 63309fe82e..d7d7435692 100644
@@ -75,7 +75,7 @@ env__net_pxe_bootable_file = {
     'check_pattern': 'ERROR',
 }
 
-# False or omitted if a PXE boot test should be tested.
+# False if a PXE boot test should be tested.
 # If PXE boot testing is not possible or desired, set this variable to True.
 # For example: If pxe configuration file is not proper to boot
 env__pxe_boot_test_skip = False
Signature · 1 line
2.40.1
#30 lore raw

PATCH 12/13 test/py: test_efi_loader: add missing dependency on cmd_tftpboot

In reply to Jerome Forissier

test_efi_helloworld_net() and test_efi_grub_net() depend on cmd_tftpboot so add the missing annotations.

---
 test/py/tests/test_efi_loader.py | 2 ++
 1 file changed, 2 insertions(+)
test/py/tests/test_efi_loader.py +2 -0
index 85473a9049..7c1e0ffa59 100644
@@ -149,6 +149,7 @@ def fetch_tftp_file(u_boot_console, env_conf):
 
 @pytest.mark.buildconfigspec('of_control')
 @pytest.mark.buildconfigspec('cmd_bootefi_hello_compile')
[email protected]('cmd_tftpboot')
 def test_efi_helloworld_net(u_boot_console):
     """Run the helloworld.efi binary via TFTP.
 
@@ -178,6 +179,7 @@ def test_efi_helloworld_builtin(u_boot_console):
 
 @pytest.mark.buildconfigspec('of_control')
 @pytest.mark.buildconfigspec('cmd_bootefi')
[email protected]('cmd_tftpboot')
 def test_efi_grub_net(u_boot_console):
     """Run the grub.efi binary via TFTP.
 
Signature · 1 line
2.40.1
#32 lore raw

PATCH 13/13 test/py: test_efi_loader: add HTTP (wget) test for the EFI loader

In reply to Jerome Forissier

Add a test to test_efi_loader.py similar to the TFTP test but for HTTP with the wget command.

---
 test/py/tests/test_efi_loader.py | 62 +++++++++++++++++++++++---------
 1 file changed, 46 insertions(+), 16 deletions(-)
test/py/tests/test_efi_loader.py +46 -16
index 7c1e0ffa59..5f3b448a06 100644
@@ -45,11 +45,18 @@ env__efi_loader_helloworld_file = {
     'crc32': 'c2244b26',                   # CRC32 check sum
     'addr': 0x40400000,                    # load address
 }
+
+# False if the helloworld EFI over HTTP boot test should be performed.
+# If HTTP boot testing is not possible or desired, set this variable to True or
+# ommit it.
+env__efi_helloworld_net_http_test_skip = True
 """
 
 import pytest
 import u_boot_utils
 
+PROTO_TFTP, PROTO_HTTP = range(0, 2)
+
 net_set_up = False
 
 def test_efi_pre_commands(u_boot_console):
@@ -110,10 +117,10 @@ def test_efi_setup_static(u_boot_console):
     global net_set_up
     net_set_up = True
 
-def fetch_tftp_file(u_boot_console, env_conf):
-    """Grab an env described file via TFTP and return its address
+def fetch_file(u_boot_console, env_conf, proto):
+    """Grab an env described file via TFTP or HTTP and return its address
 
-    A file as described by an env config <env_conf> is downloaded from the TFTP
+    A file as described by an env config <env_conf> is downloaded from the
     server. The address to that file is returned.
     """
     if not net_set_up:
@@ -128,7 +135,13 @@ def fetch_tftp_file(u_boot_console, env_conf):
         addr = u_boot_utils.find_ram_base(u_boot_console)
 
     fn = f['fn']
-    output = u_boot_console.run_command('tftpboot %x %s' % (addr, fn))
+    if proto == PROTO_TFTP:
+        cmd = 'tftpboot'
+    elif proto == PROTO_HTTP:
+        cmd = 'wget'
+    else:
+        assert False
+    output = u_boot_console.run_command('%s %x %s' % (cmd, addr, fn))
     expected_text = 'Bytes transferred = '
     sz = f.get('size', None)
     if sz:
@@ -147,17 +160,8 @@ def fetch_tftp_file(u_boot_console, env_conf):
 
     return addr
 
[email protected]('of_control')
[email protected]('cmd_bootefi_hello_compile')
[email protected]('cmd_tftpboot')
-def test_efi_helloworld_net(u_boot_console):
-    """Run the helloworld.efi binary via TFTP.
-
-    The helloworld.efi file is downloaded from the TFTP server and is executed
-    using the fallback device tree at $fdtcontroladdr.
-    """
-
-    addr = fetch_tftp_file(u_boot_console, 'env__efi_loader_helloworld_file')
+def do_test_efi_helloworld_net(u_boot_console, proto):
+    addr = fetch_file(u_boot_console, 'env__efi_loader_helloworld_file', proto)
 
     output = u_boot_console.run_command('bootefi %x' % addr)
     expected_text = 'Hello, world'
@@ -165,6 +169,32 @@ def test_efi_helloworld_net(u_boot_console):
     expected_text = '## Application failed'
     assert expected_text not in output
 
[email protected]('of_control')
[email protected]('cmd_bootefi_hello_compile')
[email protected]('cmd_tftpboot')
+def test_efi_helloworld_net_tftp(u_boot_console):
+    """Run the helloworld.efi binary via TFTP.
+
+    The helloworld.efi file is downloaded from the TFTP server and is executed
+    using the fallback device tree at $fdtcontroladdr.
+    """
+
+    do_test_efi_helloworld_net(u_boot_console, PROTO_TFTP);
+
[email protected]('of_control')
[email protected]('cmd_bootefi_hello_compile')
[email protected]('cmd_wget')
+def test_efi_helloworld_net_http(u_boot_console):
+    """Run the helloworld.efi binary via HTTP.
+
+    The helloworld.efi file is downloaded from the HTTP server and is executed
+    using the fallback device tree at $fdtcontroladdr.
+    """
+    if u_boot_console.config.env.get('env__efi_helloworld_net_http_test_skip', True):
+        pytest.skip('helloworld.efi HTTP test is not enabled!')
+
+    do_test_efi_helloworld_net(u_boot_console, PROTO_HTTP);
+
 @pytest.mark.buildconfigspec('cmd_bootefi_hello')
 def test_efi_helloworld_builtin(u_boot_console):
     """Run the builtin helloworld.efi binary.
@@ -187,7 +217,7 @@ def test_efi_grub_net(u_boot_console):
     executed.
     """
 
-    addr = fetch_tftp_file(u_boot_console, 'env__efi_loader_grub_file')
+    addr = fetch_file(u_boot_console, 'env__efi_loader_grub_file', PROTO_TFTP)
 
     u_boot_console.run_command('bootefi %x' % addr, wait_for_prompt=False)
 
Signature · 1 line
2.40.1
Reviewed-by on the v1 series
#33 lore raw
In reply to Jerome Forissier
Quoted 5 lines · Jerome Forissier

Miscellaneous fixes made when developing the lwIP series [1].

[1] http://patchwork.ozlabs.org/project/uboot/list/?series=420712&state=%2A&archive=both

Quoted 14 lines

Jerome Forissier (13):
Makefile: detect HOST_ARCH properly when CROSS_COMPILE is multi-word
flash: prefix error codes with FL_
at91: rename mem_init() to at91_mem_init()
arm: omap2: add missing #include <netdev.h>
net: fm: call dtsec_init_phy() only when it is defined
net: wget: removed unused function wget_success()
net: phy: ncsi: depend on NET
net: ftgmac100: depend on NET
net: wget: allow EFI boot
net: fec_mxc_init(): do not ignore return status of fec_open() test/py: net_boot: fix comment
test/py: test_efi_loader: add missing dependency on cmd_tftpboot test/py: test_efi_loader: add HTTP (wget) test for the EFI loader

For the series:

Quoted 38 lines
 Makefile                                      |  2 +-
 arch/arm/mach-at91/include/mach/at91_common.h |  2 +-
 arch/arm/mach-at91/spl_at91.c                 |  2 +-
 arch/arm/mach-at91/spl_atmel.c                |  2 +-
 arch/arm/mach-omap2/omap3/emac.c              |  1 +
 .../atmel/at91sam9m10g45ek/at91sam9m10g45ek.c |  2 +-
 board/atmel/at91sam9n12ek/at91sam9n12ek.c     |  2 +-
 board/atmel/at91sam9x5ek/at91sam9x5ek.c       |  2 +-
 .../atmel/sama5d27_som1_ek/sama5d27_som1_ek.c |  2 +-
 .../sama5d27_wlsom1_ek/sama5d27_wlsom1_ek.c   |  2 +-
 board/atmel/sama5d2_icp/sama5d2_icp.c         |  2 +-
 .../atmel/sama5d2_xplained/sama5d2_xplained.c |  2 +-
 .../atmel/sama5d3_xplained/sama5d3_xplained.c |  2 +-
 board/atmel/sama5d3xek/sama5d3xek.c           |  2 +-
 .../atmel/sama5d4_xplained/sama5d4_xplained.c |  2 +-
 board/atmel/sama5d4ek/sama5d4ek.c             |  2 +-
 board/cobra5272/flash.c                       | 26 ++++----
 .../conclusive/kstr-sama5d27/kstr-sama5d27.c  |  2 +-
 board/freescale/m5253demo/flash.c             |  6 +-
 board/gardena/smart-gateway-at91sam/spl.c     |  2 +-
 board/siemens/corvus/board.c                  |  2 +-
 board/siemens/smartweb/smartweb.c             |  2 +-
 board/siemens/taurus/taurus.c                 |  2 +-
 common/flash.c                                | 44 ++++++-------
 drivers/mtd/cfi_flash.c                       | 36 +++++------
 drivers/net/Kconfig                           |  1 +
 drivers/net/fec_mxc.c                         |  3 +-
 drivers/net/fm/eth.c                          |  2 +
 drivers/net/phy/Kconfig                       |  1 +
 include/flash.h                               | 20 +++---
 net/wget.c                                    | 11 ++--
 test/py/tests/test_efi_loader.py              | 62 ++++++++++++++-----
 test/py/tests/test_net_boot.py                |  2 +-
 33 files changed, 144 insertions(+), 111 deletions(-)

--
2.40.1

Reviewed-by on v1 1/13
#2 lore raw

Re: [PATCH 01/13] Makefile: detect HOST_ARCH properly when CROSS_COMPILE is multi-word

In reply to Jerome Forissier
Quoted 41 lines · Jerome Forissier

When CROSS_COMPILE contains multiple words, HOST_ARCH is not properly detected and the sandbox build fail. It typically happens when using ccache. For example:

 $ make sandbox_defconfig
 $ make CROSS_COMPILE="ccache x86_64-linux-gnu-" \
        CC="ccache x86_64-linux-gnu-gcc"
 [...]
 In file included from boot/bootmeth_efi.c:16:
 include/efi_default_filename.h:33:2: error: #error Unsupported UEFI architecture
    33 | #error Unsupported UEFI architecture
       |  ^~~~~

A similar error occurs when the build is done via buildman and ~/.buildman contains:

[toolchain-wrapper]
wrapper = ccache

Fix the issue by considering only the last word in $(CROSS_COMPILE).

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -2
index f90e48f58a..dc7bdd7942 100644
@@ -21,7 +21,7 @@ include include/host_arch.h
 ifeq ("", "$(CROSS_COMPILE)")
   MK_ARCH="${shell uname -m}"
 else
-  MK_ARCH="${shell echo $(CROSS_COMPILE) | sed -n 's/^[[:space:]]*\([^\/]*\/\)*\([^-]*\)-[^[:space:]]*/\2/p'}"
+  MK_ARCH="${shell echo ${lastword $(CROSS_COMPILE)} | sed -n 's/^[[:space:]]*\([^\/]*\/\)*\([^-]*\)-[^[:space:]]*/\2/p'}"
 endif
 unexport HOST_ARCH
 ifeq ("x86_64", $(MK_ARCH))
--
Quoted 2 lines

2.40.1

Reviewed-by on v1 3/13
#5 lore raw

Re: [PATCH 03/13] at91: rename mem_init() to at91_mem_init()

In reply to Jerome Forissier
Quoted 278 lines · Jerome Forissier

THe AT91-based platforms have a mem_init() function declared in arch/arm/mach-at91/include/mach/at91_common.h and implemented in various places. In preparation of the introduction of the lwIP networking library which also has a global mem_init() function, rename the AT91 one to at91_mem_init().

---
 arch/arm/mach-at91/include/mach/at91_common.h       | 2 +-
 arch/arm/mach-at91/spl_at91.c                       | 2 +-
 arch/arm/mach-at91/spl_atmel.c                      | 2 +-
 board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c     | 2 +-
 board/atmel/at91sam9n12ek/at91sam9n12ek.c           | 2 +-
 board/atmel/at91sam9x5ek/at91sam9x5ek.c             | 2 +-
 board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c     | 2 +-
 board/atmel/sama5d27_wlsom1_ek/sama5d27_wlsom1_ek.c | 2 +-
 board/atmel/sama5d2_icp/sama5d2_icp.c               | 2 +-
 board/atmel/sama5d2_xplained/sama5d2_xplained.c     | 2 +-
 board/atmel/sama5d3_xplained/sama5d3_xplained.c     | 2 +-
 board/atmel/sama5d3xek/sama5d3xek.c                 | 2 +-
 board/atmel/sama5d4_xplained/sama5d4_xplained.c     | 2 +-
 board/atmel/sama5d4ek/sama5d4ek.c                   | 2 +-
 board/conclusive/kstr-sama5d27/kstr-sama5d27.c      | 2 +-
 board/gardena/smart-gateway-at91sam/spl.c           | 2 +-
 board/siemens/corvus/board.c                        | 2 +-
 board/siemens/smartweb/smartweb.c                   | 2 +-
 board/siemens/taurus/taurus.c                       | 2 +-
 19 files changed, 19 insertions(+), 19 deletions(-)
arch/arm/mach-at91/include/mach/at91_common.h +1 -1
index 683e539b1b..8fec346c1e 100644
@@ -28,7 +28,7 @@ void at91_pllb_init(u32 pllar);
 void at91_mck_init(u32 mckr);
 void at91_mck_init_down(u32 mckr);
 void at91_pmc_init(void);
-void mem_init(void);
+void at91_mem_init(void);
 void at91_phy_reset(void);
 void at91_sdram_hw_init(void);
 void at91_mck_init(u32 mckr);
arch/arm/mach-at91/spl_at91.c +1 -1
index cde1700a28..0d1233cd10 100644
@@ -142,7 +142,7 @@ void board_init_f(ulong dummy)
        preloader_console_init();
 #endif
 
-       mem_init();
+       at91_mem_init();
 
        at91_spl_board_init();
 }
arch/arm/mach-at91/spl_atmel.c +1 -1
index 62a7df8a19..7bfbadf048 100644
@@ -134,7 +134,7 @@ void board_init_f(ulong dummy)
 
        board_early_init_f();
 
-       mem_init();
+       at91_mem_init();
 
        ret = spl_init();
        if (ret) {
board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c +1 -1
index 3bd94d0889..af486e977e 100644
@@ -125,7 +125,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
                      2 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
        struct atmel_mpddrc_config ddr2;
 
board/atmel/at91sam9n12ek/at91sam9n12ek.c +1 -1
index afc0c0520e..6f9abcbb12 100644
@@ -167,7 +167,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
                      2 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
        struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
        struct at91_matrix *matrix = (struct at91_matrix *)ATMEL_BASE_MATRIX;
board/atmel/at91sam9x5ek/at91sam9x5ek.c +1 -1
index e5688c6cf1..f52b9a9773 100644
@@ -181,7 +181,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
                      2 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
        struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
        struct at91_matrix *matrix = (struct at91_matrix *)ATMEL_BASE_MATRIX;
board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c +1 -1
index 36995a927c..cb3cd7ac9a 100644
@@ -146,7 +146,7 @@ static void ddrc_conf(struct atmel_mpddrc_config *ddrc)
                      (8 << ATMEL_MPDDRC_TPR2_TFAW_OFFSET));
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
        struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
        struct atmel_mpddr *mpddrc = (struct atmel_mpddr *)ATMEL_BASE_MPDDRC;
board/atmel/sama5d27_wlsom1_ek/sama5d27_wlsom1_ek.c +1 -1
index c775d593e5..15cbd0daa6 100644
@@ -208,7 +208,7 @@ static void ddrc_conf(struct atmel_mpddrc_config *ddrc)
        ddrc->cal_mr4 |= ATMEL_MPDDRC_CAL_MR4_MR4R(0xFFFE);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
        struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
        struct atmel_mpddr *mpddrc = (struct atmel_mpddr *)ATMEL_BASE_MPDDRC;
board/atmel/sama5d2_icp/sama5d2_icp.c +1 -1
index 986da01639..6f0d578abf 100644
@@ -180,7 +180,7 @@ static void ddrc_conf(struct atmel_mpddrc_config *ddrc)
                      (7 << ATMEL_MPDDRC_TPR2_TFAW_OFFSET));
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
        struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
        struct atmel_mpddr *mpddrc = (struct atmel_mpddr *)ATMEL_BASE_MPDDRC;
board/atmel/sama5d2_xplained/sama5d2_xplained.c +1 -1
index c8a8eb4982..d104736fa7 100644
@@ -146,7 +146,7 @@ static void ddrc_conf(struct atmel_mpddrc_config *ddrc)
                      7 << ATMEL_MPDDRC_TPR2_TFAW_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
        struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
        struct atmel_mpddr *mpddrc = (struct atmel_mpddr *)ATMEL_BASE_MPDDRC;
board/atmel/sama5d3_xplained/sama5d3_xplained.c +1 -1
index 54cc3c4d90..f98322fb54 100644
@@ -175,7 +175,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
                      8 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
        struct atmel_mpddrc_config ddr2;
 
board/atmel/sama5d3xek/sama5d3xek.c +1 -1
index f2e1242fcb..28079a8151 100644
@@ -241,7 +241,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
                      8 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
        struct atmel_mpddrc_config ddr2;
 
board/atmel/sama5d4_xplained/sama5d4_xplained.c +1 -1
index 09ca16ca88..f9112fc532 100644
@@ -184,7 +184,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
                      8 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
        struct atmel_mpddrc_config ddr2;
 
board/atmel/sama5d4ek/sama5d4ek.c +1 -1
index 1f8b85f061..0bdc6adbdc 100644
@@ -169,7 +169,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
                      8 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
        struct atmel_mpddrc_config ddr2;
        const struct atmel_mpddr *mpddr = (struct atmel_mpddr *)ATMEL_BASE_MPDDRC;
board/conclusive/kstr-sama5d27/kstr-sama5d27.c +1 -1
index 64282ae9dc..37750137ad 100644
@@ -182,7 +182,7 @@ static void ddrc_conf(struct atmel_mpddrc_config *ddrc)
                      (8 << ATMEL_MPDDRC_TPR2_TFAW_OFFSET));
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
        struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
        struct atmel_mpddr *mpddrc = (struct atmel_mpddr *)ATMEL_BASE_MPDDRC;
board/gardena/smart-gateway-at91sam/spl.c +1 -1
index fb3ec48f9c..db9ba88188 100644
@@ -110,7 +110,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
                      2 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
        struct at91_matrix *matrix = (struct at91_matrix *)ATMEL_BASE_MATRIX;
        struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
board/siemens/corvus/board.c +1 -1
index 7d73d1f2b3..cd27fc1cc3 100644
@@ -187,7 +187,7 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2)
                      2 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
        struct atmel_mpddrc_config ddr2;
 
board/siemens/smartweb/smartweb.c +1 -1
index 946fbc3f22..e9e4bc348c 100644
@@ -238,7 +238,7 @@ void at91_spl_board_init(void)
                         | AT91_SDRAMC_TRP_VAL(2) | AT91_SDRAMC_TRCD_VAL(2) \
                         | AT91_SDRAMC_TRAS_VAL(5) | AT91_SDRAMC_TXSR_VAL(8))
 
-void mem_init(void)
+void at91_mem_init(void)
 {
        struct at91_matrix *ma = (struct at91_matrix *)ATMEL_BASE_MATRIX;
        struct at91_port *port = (struct at91_port *)ATMEL_BASE_PIOC;
board/siemens/taurus/taurus.c +1 -2
index bda12a9770..3764ab48ab 100644
@@ -177,7 +177,7 @@ void sdramc_configure(unsigned int mask)
        sdramc_initialize(ATMEL_BASE_CS1, &setting);
 }
 
-void mem_init(void)
+void at91_mem_init(void)
 {
        unsigned int ram_size = 0;
 
--
Quoted 2 lines

2.40.1

Reviewed-by on v1 4/13
#8 lore raw

Re: [PATCH 04/13] arm: omap2: add missing #include <netdev.h>

In reply to Jerome Forissier
Quoted 23 lines · Jerome Forissier

emac.c implements cpu_eth_init() so it needs to pull the corresponding header file.

---
 arch/arm/mach-omap2/omap3/emac.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-omap2/omap3/emac.c +1 -1
index 7348e92cab..1e30a06361 100644
@@ -9,6 +9,7 @@
 #include <net.h>
 #include <asm/io.h>
 #include <asm/arch/am35x_def.h>
+#include <netdev.h>
 
 /*
  * Initializes on-chip ethernet controllers.
--
Quoted 2 lines

2.40.1

Reviewed-by on v1 7/13
#15 lore raw

Re: [PATCH 07/13] net: phy: ncsi: depend on NET

In reply to Jerome Forissier
Quoted 23 lines · Jerome Forissier

PHY_NCSI enables drivers/net/phy/ncsi.c which calls net_loop() and net_set_timeout_handler(). That's the legacy NET stack (as opposed to NET_LWIP). Therefore add the dependency to Kconfig.

---
 drivers/net/phy/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/net/phy/Kconfig +1 -1
index 73064b2af6..a9efc50981 100644
@@ -368,6 +368,7 @@ config PHY_FIXED
 
 config PHY_NCSI
        bool "NC-SI based PHY"
+       depends on NET
 
 endif #PHYLIB
 
--
Quoted 2 lines

2.40.1

This sounds like that should be fixed on the phy driver if we want to use LWIP

Reviewed-by on v1 9/13
#19 lore raw

Re: [PATCH 09/13] net: wget: allow EFI boot

In reply to Jerome Forissier
Quoted 42 lines · Jerome Forissier

wget followed by bootefi currently fails as follows:

U-Boot> wget 200000 192.168.0.30:helloworld.efi
Waiting for Ethernet connection... done.
HTTP/1.0 200 OK
Packets received 13, Transfer Successful
Bytes transferred = 12720 (31b0 hex)
U-Boot> bootefi 200000
No UEFI binary known at 200000
U-Boot>

Fix the problem by adding the missing efi_set_bootdev() call.

---
 net/wget.c | 4 ++++
 1 file changed, 4 insertions(+)
net/wget.c +4 -1
index 0e4dc5159d..cf7681a4e7 100644
@@ -8,6 +8,7 @@
 #include <command.h>
 #include <display_options.h>
 #include <env.h>
+#include <efi_loader.h>
 #include <image.h>
 #include <lmb.h>
 #include <mapmem.h>
@@ -429,6 +430,9 @@ static void wget_handler(uchar *pkt, u16 dport,
        case WGET_TRANSFERRED:
                printf("Packets received %d, Transfer Successful\n", packets);
                net_set_state(wget_loop_state);
+               efi_set_bootdev("Net", "", image_url,
+                               map_sysmem(image_load_addr, 0),
+                               net_boot_file_size);
                break;
        }
 }
--
Quoted 2 lines

2.40.1

Reviewed-by on v1 10/13
#27 lore raw

Re: [PATCH 10/13] net: fec_mxc_init(): do not ignore return status of fec_open()

In reply to Jerome Forissier
Quoted 27 lines · Jerome Forissier

The fec_mxc_init() function currently always returns 0. This does not allow the callers to detect when for instance the PHY initialization failed due to the port being unconnected. Fix that by returning the status of fec_open().

---
 drivers/net/fec_mxc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/fec_mxc.c +1 -3
index 0a0d92bc2c..2dc1364bee 100644
@@ -615,8 +615,7 @@ static int fecmxc_init(struct udevice *dev)
        if (fec->xcv_type != SEVENWIRE)
                miiphy_restart_aneg(dev);
 #endif
-       fec_open(dev);
-       return 0;
+       return fec_open(dev);
 }
 
 /**
--
Quoted 2 lines

2.40.1

Reviewed-by on v1 11/13
#29 lore raw

Re: [PATCH 11/13] test/py: net_boot: fix comment

In reply to Jerome Forissier
Quoted 23 lines · Jerome Forissier

If env__pxe_boot_test_skip is not present, it defaults to True not False. Therefore fix the comment.

---
 test/py/tests/test_net_boot.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
test/py/tests/test_net_boot.py +1 -2
index 63309fe82e..d7d7435692 100644
@@ -75,7 +75,7 @@ env__net_pxe_bootable_file = {
     'check_pattern': 'ERROR',
 }
 
-# False or omitted if a PXE boot test should be tested.
+# False if a PXE boot test should be tested.
 # If PXE boot testing is not possible or desired, set this variable to True.
 # For example: If pxe configuration file is not proper to boot
 env__pxe_boot_test_skip = False
--
Quoted 2 lines

2.40.1

Reviewed-by on v1 12/13
#31 lore raw

Re: [PATCH 12/13] test/py: test_efi_loader: add missing dependency on cmd_tftpboot

In reply to Jerome Forissier
Quoted 31 lines · Jerome Forissier

test_efi_helloworld_net() and test_efi_grub_net() depend on cmd_tftpboot so add the missing annotations.

---
 test/py/tests/test_efi_loader.py | 2 ++
 1 file changed, 2 insertions(+)
test/py/tests/test_efi_loader.py +2 -1
index 85473a9049..7c1e0ffa59 100644
@@ -149,6 +149,7 @@ def fetch_tftp_file(u_boot_console, env_conf):
 
 @pytest.mark.buildconfigspec('of_control')
 @pytest.mark.buildconfigspec('cmd_bootefi_hello_compile')
[email protected]('cmd_tftpboot')
 def test_efi_helloworld_net(u_boot_console):
     """Run the helloworld.efi binary via TFTP.
 
@@ -178,6 +179,7 @@ def test_efi_helloworld_builtin(u_boot_console):
 
 @pytest.mark.buildconfigspec('of_control')
 @pytest.mark.buildconfigspec('cmd_bootefi')
[email protected]('cmd_tftpboot')
 def test_efi_grub_net(u_boot_console):
     """Run the grub.efi binary via TFTP.
 
--
Quoted 2 lines

2.40.1

Reviewed-by on v1 3/13
#6 lore raw

Re: [PATCH 03/13] at91: rename mem_init() to at91_mem_init()

In reply to Jerome Forissier

Hello Jerome,

Quoted 20 lines · Jerome Forissier

THe AT91-based platforms have a mem_init() function declared in arch/arm/mach-at91/include/mach/at91_common.h and implemented in various places. In preparation of the introduction of the lwIP networking library which also has a global mem_init() function, rename the AT91 one to at91_mem_init().

---
  arch/arm/mach-at91/include/mach/at91_common.h       | 2 +-
  arch/arm/mach-at91/spl_at91.c                       | 2 +-
  arch/arm/mach-at91/spl_atmel.c                      | 2 +-
  board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c     | 2 +-
  board/atmel/at91sam9n12ek/at91sam9n12ek.c           | 2 +-
  board/atmel/at91sam9x5ek/at91sam9x5ek.c             | 2 +-
  board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c     | 2 +-
  board/atmel/sama5d27_wlsom1_ek/sama5d27_wlsom1_ek.c | 2 +-
  board/atmel/sama5d2_icp/sama5d2_icp.c               | 2 +-
  board/atmel/sama5d2_xplained/sama5d2_xplained.c     | 2 +-
  board/atmel/sama5d3_xplained/sama5d3_xplained.c     | 2 +-
  board/atmel/sama5d3xek/sama5d3xek.c                 | 2 +-
Quoted 8 lines
  board/atmel/sama5d4_xplained/sama5d4_xplained.c     | 2 +-
  board/atmel/sama5d4ek/sama5d4ek.c                   | 2 +-
  board/conclusive/kstr-sama5d27/kstr-sama5d27.c      | 2 +-
  board/gardena/smart-gateway-at91sam/spl.c           | 2 +-
  board/siemens/corvus/board.c                        | 2 +-
  board/siemens/smartweb/smartweb.c                   | 2 +-
  board/siemens/taurus/taurus.c                       | 2 +-
  19 files changed, 19 insertions(+), 19 deletions(-)

Thanks!

bye,
Heiko

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

Re: [PATCH 05/13] net: fm: call dtsec_init_phy() only when it is defined

In reply to Jerome Forissier

Hi Jerome,

Quoted 14 lines · Jerome Forissier

dtsec_init_phy() is defined only with MII so add the proper conditional in the caller code.

---
 drivers/net/fm/eth.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/fm/eth.c +0 -0
index 19f3f0fef0..e4ec769693 100644

drivers/net/fm/eth.c static int init_phy(struct fm_eth *fm_eth) · line 707

Quoted 7 lines
drivers/net/fm/eth.c +2 -0
@@ -701,8 +701,10 @@ static int init_phy(struct fm_eth *fm_eth)
                supported |= SUPPORTED_2500baseX_Full;
 #endif
 
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) && !defined(BITBANGMII)
        if (fm_eth->type == FM_ETH_1G_E)
                dtsec_init_phy(fm_eth);
+#endif

We really want to avoid #ifdefs in the code as they create different build paths. Can you use if (IS_ENABLED) ? Also BITBANGMII seems liike it needs a CONFIG_ prefix.

Quoted 6 lines
drivers/net/fm/eth.c +0 -1
 #ifdef CONFIG_PHYLIB
 #ifdef CONFIG_DM_MDIO
--

2.40.1

Regards,
Simon

Reviewed-by
#20 lore raw

Re: [PATCH 09/13] net: wget: allow EFI boot

In reply to Ilias Apalodimas
Quoted 15 lines · Ilias Apalodimas
Quoted 12 lines · Jerome Forissier

wget followed by bootefi currently fails as follows:

U-Boot> wget 200000 192.168.0.30:helloworld.efi
Waiting for Ethernet connection... done.
HTTP/1.0 200 OK
Packets received 13, Transfer Successful
Bytes transferred = 12720 (31b0 hex)
U-Boot> bootefi 200000
No UEFI binary known at 200000
U-Boot>

Quoted 6 lines
Quoted 6 lines

Fix the problem by adding the missing efi_set_bootdev() call.

---
 net/wget.c | 4 ++++
 1 file changed, 4 insertions(+)

OMG the hack never dies. I hope I will someday create a series to tidy this up.

Quoted 28 lines
Quoted 24 lines
net/wget.c +4 -1
index 0e4dc5159d..cf7681a4e7 100644
@@ -8,6 +8,7 @@
 #include <command.h>
 #include <display_options.h>
 #include <env.h>
+#include <efi_loader.h>
 #include <image.h>
 #include <lmb.h>
 #include <mapmem.h>
@@ -429,6 +430,9 @@ static void wget_handler(uchar *pkt, u16 dport,
        case WGET_TRANSFERRED:
                printf("Packets received %d, Transfer Successful\n", packets);
                net_set_state(wget_loop_state);
+               efi_set_bootdev("Net", "", image_url,
+                               map_sysmem(image_load_addr, 0),
+                               net_boot_file_size);
                break;
        }
 }
--
Quoted 2 lines

2.40.1

Reviewed-by on v1 8/13
#17 lore raw

Re: [PATCH 08/13] net: ftgmac100: depend on NET

In reply to Jerome Forissier
Quoted 9 lines · Jerome Forissier

FTGMAC100 enables drivers/net/ftgmac100.c which uses PHY_INTERFACE_MODE_NCSI, which is defined only when PHY_NCSI is enabled. Therefore FTGMAC100 depends on PHY_NCSI. However adding such a dependency causes a "recursive dependency detected!" message, so add a dependency on NET instead (PHY_NCSI depends on NET). All in all, either the stack is NET and FTGMAC100 can be enabled, or it is NET_LWIP (or NO_NET) and it cannot.

Quoted 5 lines
---
 drivers/net/Kconfig | 1 +
 1 file changed, 1 insertion(+)
Quoted 15 lines
drivers/net/Kconfig +1 -1
index 69ae7c0750..3382e533f4 100644
@@ -461,6 +461,7 @@ config FTMAC100
 config FTGMAC100
        bool "Ftgmac100 Ethernet Support"
        select PHYLIB
+       depends on NET
        help
          This driver supports the Faraday's FTGMAC100 Gigabit SoC
          Ethernet controller that can be found on Aspeed SoCs (which
--

2.40.1

#11 lore raw

Re: [PATCH 05/13] net: fm: call dtsec_init_phy() only when it is defined

In reply to Simon Glass
Quoted 21 lines · Simon Glass

Hi Jerome,

Quoted 17 lines · Jerome Forissier

dtsec_init_phy() is defined only with MII so add the proper conditional in the caller code.

---
 drivers/net/fm/eth.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/fm/eth.c +0 -0
index 19f3f0fef0..e4ec769693 100644
@@ -701,8 +701,10 @@ static int init_phy(struct fm_eth *fm_eth)
                supported |= SUPPORTED_2500baseX_Full;
 #endif
 
Quoted 7 lines

drivers/net/fm/eth.c static int init_phy(struct fm_eth *fm_eth) · line 707

Quoted 4 lines
drivers/net/fm/eth.c +2 -0
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) && !defined(BITBANGMII)
        if (fm_eth->type == FM_ETH_1G_E)
                dtsec_init_phy(fm_eth);
+#endif

We really want to avoid #ifdefs in the code as they create different build paths. Can you use if (IS_ENABLED) ?

Sure.

Quoted 2 lines

Also BITBANGMII seems liike
it needs a CONFIG_ prefix.

I agree. I have copied the line verbatim from line 29 because the condition needs to be the same. And I suspect there is another issue with the operator precedence. Do we want "MII || (CMD_MII && !BITBANGMII)" or
do we rather want "(MII || CMD_MII) && !BITBANGMII"? I guess the latter.

So how about:

drivers/net/fm/eth.c +7 -3
index 19f3f0fef0..22025b6a27 100644
@@ -26,7 +26,8 @@
 
 #include "fm.h"
 
-#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) && !defined(BITBANGMII)
+#if ((defined(CONFIG_MII) || defined(CONFIG_CMD_MII)) && \
+     !defined(CONFIG_BITBANGMII))
 
 #define TBIANA_SETTINGS (TBIANA_ASYMMETRIC_PAUSE | TBIANA_SYMMETRIC_PAUSE | \
 			 TBIANA_FULL_DUPLEX)
@@ -701,8 +702,11 @@ static int init_phy(struct fm_eth *fm_eth)
 		supported |= SUPPORTED_2500baseX_Full;
 #endif
 
-	if (fm_eth->type == FM_ETH_1G_E)
-		dtsec_init_phy(fm_eth);
+	if ((IS_ENABLED(CONFIG_MII) || IS_ENABLED(CONFIG_CMD_MII)) &&
+	    !IS_ENABLED(CONFIG_BITBANGMII)) {
+		if (fm_eth->type == FM_ETH_1G_E)
+			dtsec_init_phy(fm_eth);
+	}
 
 #ifdef CONFIG_PHYLIB
 #ifdef CONFIG_DM_MDIO

???

Thanks,

Signature · 1 line
Jerome
#12 lore raw

Re: [PATCH 05/13] net: fm: call dtsec_init_phy() only when it is defined

Hi Jerome,

Quoted 61 lines · Jerome Forissier
Quoted 21 lines · Simon Glass

Hi Jerome,

Quoted 17 lines · Jerome Forissier

dtsec_init_phy() is defined only with MII so add the proper conditional in the caller code.

---
 drivers/net/fm/eth.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/fm/eth.c +0 -0
index 19f3f0fef0..e4ec769693 100644
@@ -701,8 +701,10 @@ static int init_phy(struct fm_eth *fm_eth)
                supported |= SUPPORTED_2500baseX_Full;
 #endif
 
Quoted 7 lines

drivers/net/fm/eth.c static int init_phy(struct fm_eth *fm_eth) · line 707

Quoted 4 lines
drivers/net/fm/eth.c +2 -0
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) && !defined(BITBANGMII)
        if (fm_eth->type == FM_ETH_1G_E)
                dtsec_init_phy(fm_eth);
+#endif

We really want to avoid #ifdefs in the code as they create different build paths. Can you use if (IS_ENABLED) ?

Sure.

Quoted 2 lines

Also BITBANGMII seems liike
it needs a CONFIG_ prefix.

I agree. I have copied the line verbatim from line 29 because the condition needs to be the same. And I suspect there is another issue with the operator precedence. Do we want "MII || (CMD_MII && !BITBANGMII)" or
do we rather want "(MII || CMD_MII) && !BITBANGMII"? I guess the latter.

So how about:

drivers/net/fm/eth.c +2 -1
index 19f3f0fef0..22025b6a27 100644
@@ -26,7 +26,8 @@
 
 #include "fm.h"
 
-#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) && !defined(BITBANGMII)
+#if ((defined(CONFIG_MII) || defined(CONFIG_CMD_MII)) && \
+     !defined(CONFIG_BITBANGMII))
 
 #define TBIANA_SETTINGS (TBIANA_ASYMMETRIC_PAUSE | TBIANA_SYMMETRIC_PAUSE | \
                         TBIANA_FULL_DUPLEX)
@@ -701,8 +702,11 @@ static int init_phy(struct fm_eth *fm_eth)
                supported |= SUPPORTED_2500baseX_Full;

drivers/net/fm/eth.c static int init_phy(struct fm_eth *fm_eth) · line 710

Quoted 10 lines
drivers/net/fm/eth.c +5 -2
 #endif
 
-       if (fm_eth->type == FM_ETH_1G_E)
-               dtsec_init_phy(fm_eth);
+       if ((IS_ENABLED(CONFIG_MII) || IS_ENABLED(CONFIG_CMD_MII)) &&
+           !IS_ENABLED(CONFIG_BITBANGMII)) {
+               if (fm_eth->type == FM_ETH_1G_E)
+                       dtsec_init_phy(fm_eth);
+       }
 

That's good

Quoted 5 lines
drivers/net/fm/eth.c +0 -0
 #ifdef CONFIG_PHYLIB
 #ifdef CONFIG_DM_MDIO

???

You don't have to fix every #ifdef in every file you touch...it's just that if you are already touching code, you might as well bring it up to newer standards.

Regards,
Simon

#21 lore raw

Re: [PATCH 09/13] net: wget: allow EFI boot

In reply to Simon Glass

Hi Jerome,

Quoted 18 lines · Simon Glass
Quoted 15 lines · Ilias Apalodimas
Quoted 12 lines · Jerome Forissier

wget followed by bootefi currently fails as follows:

U-Boot> wget 200000 192.168.0.30:helloworld.efi
Waiting for Ethernet connection... done.
HTTP/1.0 200 OK
Packets received 13, Transfer Successful
Bytes transferred = 12720 (31b0 hex)
U-Boot> bootefi 200000
No UEFI binary known at 200000
U-Boot>

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

Fix the problem by adding the missing efi_set_bootdev() call.

---
 net/wget.c | 4 ++++
 1 file changed, 4 insertions(+)

OMG the hack never dies. I hope I will someday create a series to tidy this up.

I'm sorry for that remark, not helpful to collaboration.

Regards,
Simon

#22 lore raw

Re: [PATCH 09/13] net: wget: allow EFI boot

Hi Simon

Quoted 24 lines · Simon Glass

Hi Jerome,

Quoted 20 lines · Simon Glass
Quoted 17 lines · Ilias Apalodimas
Quoted 14 lines · Jerome Forissier

wget followed by bootefi currently fails as follows:

U-Boot> wget 200000 192.168.0.30:helloworld.efi
Waiting for Ethernet connection... done.
HTTP/1.0 200 OK
Packets received 13, Transfer Successful
Bytes transferred = 12720 (31b0 hex)
U-Boot> bootefi 200000
No UEFI binary known at 200000
U-Boot>

Fix the problem by adding the missing efi_set_bootdev() call.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
---
 net/wget.c | 4 ++++
 1 file changed, 4 insertions(+)

OMG the hack never dies. I hope I will someday create a series to tidy this up.

I'm sorry for that remark, not helpful to collaboration.

If you've figured out what needs to be done to remove it, I can deal with it. If not I'll put it on my backlog and have a look

Thanks
/Ilias

Quoted 3 lines

Regards,
Simon

#23 lore raw

Re: [PATCH 09/13] net: wget: allow EFI boot

Hi Ilias,

Quoted 33 lines · Ilias Apalodimas

Hi Simon

Quoted 29 lines · Simon Glass

Hi Jerome,

Quoted 25 lines · Simon Glass
Quoted 21 lines · Ilias Apalodimas
Quoted 18 lines · Jerome Forissier

wget followed by bootefi currently fails as follows:

U-Boot> wget 200000 192.168.0.30:helloworld.efi
Waiting for Ethernet connection... done.
HTTP/1.0 200 OK
Packets received 13, Transfer Successful
Bytes transferred = 12720 (31b0 hex)
U-Boot> bootefi 200000
No UEFI binary known at 200000
U-Boot>

Fix the problem by adding the missing efi_set_bootdev() call.

---
 net/wget.c | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

OMG the hack never dies. I hope I will someday create a series to tidy this up.

I'm sorry for that remark, not helpful to collaboration.

If you've figured out what needs to be done to remove it, I can deal with it. If not I'll put it on my backlog and have a look

Mostly...my idea is to track loads within bootstd, adding a way for bootmeths to record files they load, in struct bootflow. Then when booting EFI, we just pass that info from distro_efi_boot() to efi_binary_run().

Regards,
Simon

#24 lore raw

Re: [PATCH 09/13] net: wget: allow EFI boot

Quoted 41 lines · Simon Glass

Hi Ilias,

Quoted 37 lines · Ilias Apalodimas

Hi Simon

Quoted 32 lines · Simon Glass

Hi Jerome,

Quoted 18 lines · Simon Glass
Quoted 15 lines · Ilias Apalodimas
Quoted 12 lines · Jerome Forissier

wget followed by bootefi currently fails as follows:

U-Boot> wget 200000 192.168.0.30:helloworld.efi
Waiting for Ethernet connection... done.
HTTP/1.0 200 OK
Packets received 13, Transfer Successful
Bytes transferred = 12720 (31b0 hex)
U-Boot> bootefi 200000
No UEFI binary known at 200000
U-Boot>

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

Fix the problem by adding the missing efi_set_bootdev() call.

---
 net/wget.c | 4 ++++
 1 file changed, 4 insertions(+)

OMG the hack never dies. I hope I will someday create a series to tidy this up.

I'm sorry for that remark, not helpful to collaboration.

Quoted 7 lines
Quoted 2 lines

If you've figured out what needs to be done to remove it, I can deal with it. If not I'll put it on my backlog and have a look

Mostly...my idea is to track loads within bootstd, adding a way for bootmeths to record files they load, in struct bootflow. Then when booting EFI, we just pass that info from distro_efi_boot() to efi_binary_run().

I worry about conflating "loaded something" with "need to boot thing thing". Maybe it's not a problem in the end, but there is not a 1:1 between "loaded something" and "will boot this thing".

Signature · 1 line
Tom
#25 lore raw

Re: [PATCH 09/13] net: wget: allow EFI boot

Hi Tom,

Quoted 46 lines · Tom Rini
Quoted 44 lines · Simon Glass

Hi Ilias,

Quoted 39 lines · Ilias Apalodimas

Hi Simon

Quoted 24 lines · Simon Glass

Hi Jerome,

Quoted 20 lines · Simon Glass
Quoted 17 lines · Ilias Apalodimas
Quoted 14 lines · Jerome Forissier

wget followed by bootefi currently fails as follows:

U-Boot> wget 200000 192.168.0.30:helloworld.efi
Waiting for Ethernet connection... done.
HTTP/1.0 200 OK
Packets received 13, Transfer Successful
Bytes transferred = 12720 (31b0 hex)
U-Boot> bootefi 200000
No UEFI binary known at 200000
U-Boot>

Fix the problem by adding the missing efi_set_bootdev() call.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
---
 net/wget.c | 4 ++++
 1 file changed, 4 insertions(+)

OMG the hack never dies. I hope I will someday create a series to tidy this up.

I'm sorry for that remark, not helpful to collaboration.

If you've figured out what needs to be done to remove it, I can deal with it. If not I'll put it on my backlog and have a look

Quoted 8 lines
Quoted 4 lines

Mostly...my idea is to track loads within bootstd, adding a way for bootmeths to record files they load, in struct bootflow. Then when booting EFI, we just pass that info from distro_efi_boot() to efi_binary_run().

I worry about conflating "loaded something" with "need to boot thing thing". Maybe it's not a problem in the end, but there is not a 1:1 between "loaded something" and "will boot this thing".

Yes, exactly. Bootstd tries to search for things and build a table of what is there. Only when something is booted does it go ahead and set it up to boot. In fact, some bootmeths delay kernel loading until needed.

Regards,
Simon