summaryrefslogtreecommitdiff
path: root/board/dhelectronics/dh_stm32mp1/board.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-08-13 08:11:27 -0400
committerTom Rini <trini@konsulko.com>2020-08-13 08:11:27 -0400
commit6808dc62d75de706c5aabc24e36caf52ead30fc7 (patch)
treea4bc8b1852fc82f0b2703085f9c9199c07bef9cd /board/dhelectronics/dh_stm32mp1/board.c
parentdbfca734d0e2b36a966be066cb2dc15e0fc71c85 (diff)
parentd0a3c4f9dbf0d661d3b91f46f0fa4db2dc33bb78 (diff)
Merge tag 'u-boot-stm32-20200813' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm
- Use IS_ENABLED to prevent ifdef in board_key_check for STM32MP - Add STM32 FMC2 EBI controller driver - Fix dwc3-sti-glue which allows STiH410-B2260 to boot again - Add fitImage its entry for 587-200 DHCOR SoM - Add both PDK2 and DRC02 DT into DHCOM fitImage its - Fix DHCOM KS8851 ethernet MAC address - Remove stm32mp1 board.c file - Use const for struct node_info in board stm32mp1.c file
Diffstat (limited to 'board/dhelectronics/dh_stm32mp1/board.c')
-rw-r--r--board/dhelectronics/dh_stm32mp1/board.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/board/dhelectronics/dh_stm32mp1/board.c b/board/dhelectronics/dh_stm32mp1/board.c
index 17dbf20d76a..c9abe3cc6df 100644
--- a/board/dhelectronics/dh_stm32mp1/board.c
+++ b/board/dhelectronics/dh_stm32mp1/board.c
@@ -84,11 +84,26 @@ DECLARE_GLOBAL_DATA_PTR;
int setup_mac_address(void)
{
unsigned char enetaddr[6];
+ bool skip_eth0 = false;
+ bool skip_eth1 = false;
struct udevice *dev;
int off, ret;
ret = eth_env_get_enetaddr("ethaddr", enetaddr);
if (ret) /* ethaddr is already set */
+ skip_eth0 = true;
+
+ off = fdt_path_offset(gd->fdt_blob, "ethernet1");
+ if (off < 0) {
+ /* ethernet1 is not present in the system */
+ skip_eth1 = true;
+ } else {
+ ret = eth_env_get_enetaddr("eth1addr", enetaddr);
+ if (ret) /* eth1addr is already set */
+ skip_eth1 = true;
+ }
+
+ if (skip_eth0 && skip_eth1)
return 0;
off = fdt_path_offset(gd->fdt_blob, "eeprom0");
@@ -109,8 +124,14 @@ int setup_mac_address(void)
return ret;
}
- if (is_valid_ethaddr(enetaddr))
- eth_env_set_enetaddr("ethaddr", enetaddr);
+ if (is_valid_ethaddr(enetaddr)) {
+ if (!skip_eth0)
+ eth_env_set_enetaddr("ethaddr", enetaddr);
+
+ enetaddr[5]++;
+ if (!skip_eth1)
+ eth_env_set_enetaddr("eth1addr", enetaddr);
+ }
return 0;
}
@@ -216,9 +237,13 @@ int board_early_init_f(void)
#ifdef CONFIG_SPL_LOAD_FIT
int board_fit_config_name_match(const char *name)
{
- char test[20];
+ const char *compat;
+ char test[128];
+
+ compat = fdt_getprop(gd->fdt_blob, 0, "compatible", NULL);
- snprintf(test, sizeof(test), "somrev%d_boardrev%d", somcode, brdcode);
+ snprintf(test, sizeof(test), "%s_somrev%d_boardrev%d",
+ compat, somcode, brdcode);
if (!strcmp(name, test))
return 0;