Merge git://git.denx.de/u-boot-dm

master
Tom Rini 7 years ago
commit 8e5f0497c8
  1. 9
      README
  2. 12
      arch/arm/lib/bootm-fdt.c
  3. 51
      board/freescale/ls1046ardb/eth.c
  4. 25
      common/fdt_support.c
  5. 2
      include/configs/ls1046ardb.h
  6. 3
      include/fdt_support.h

@ -1603,6 +1603,15 @@ The following options need to be configured:
See doc/README.link-local for more information.
- MAC address from environment variables
FDT_SEQ_MACADDR_FROM_ENV
Fix-up device tree with MAC addresses fetched sequentially from
environment variables. This config work on assumption that
non-usable ethernet node of device-tree are either not present
or their status has been marked as "disabled".
- CDP Options:
CONFIG_CDP_DEVICE_ID

@ -25,6 +25,13 @@
DECLARE_GLOBAL_DATA_PTR;
#ifdef CONFIG_FMAN_ENET
__weak int fdt_update_ethernet_dt(void *blob)
{
return 0;
}
#endif
int arch_fixup_fdt(void *blob)
{
int ret = 0;
@ -64,5 +71,10 @@ int arch_fixup_fdt(void *blob)
#endif
#endif
#ifdef CONFIG_FMAN_ENET
ret = fdt_update_ethernet_dt(blob);
if (ret)
return ret;
#endif
return 0;
}

@ -75,3 +75,54 @@ int board_eth_init(bd_t *bis)
return pci_eth_init(bis);
}
#ifdef CONFIG_FMAN_ENET
int fdt_update_ethernet_dt(void *blob)
{
u32 srds_s1;
int i, prop;
int offset, nodeoff;
const char *path;
struct ccsr_gur *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
srds_s1 = in_be32(&gur->rcwsr[4]) &
FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_MASK;
srds_s1 >>= FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_SHIFT;
/* Cycle through all aliases */
for (prop = 0; ; prop++) {
const char *name;
/* FDT might have been edited, recompute the offset */
offset = fdt_first_property_offset(blob,
fdt_path_offset(blob,
"/aliases")
);
/* Select property number 'prop' */
for (i = 0; i < prop; i++)
offset = fdt_next_property_offset(blob, offset);
if (offset < 0)
break;
path = fdt_getprop_by_offset(blob, offset, &name, NULL);
nodeoff = fdt_path_offset(blob, path);
switch (srds_s1) {
case 0x1133:
if (!strcmp(name, "ethernet0"))
fdt_status_disabled(blob, nodeoff);
if (!strcmp(name, "ethernet1"))
fdt_status_disabled(blob, nodeoff);
break;
default:
printf("%s: Invalid SerDes prtcl 0x%x for LS1046ARDB\n",
__func__, srds_s1);
break;
}
}
return 0;
}
#endif

@ -508,12 +508,16 @@ int fdt_fixup_memory(void *blob, u64 start, u64 size)
void fdt_fixup_ethernet(void *fdt)
{
int i, j, prop;
int i = 0, j, prop;
char *tmp, *end;
char mac[16];
const char *path;
unsigned char mac_addr[ARP_HLEN];
int offset;
#ifdef FDT_SEQ_MACADDR_FROM_ENV
int nodeoff;
const struct fdt_property *fdt_prop;
#endif
if (fdt_path_offset(fdt, "/aliases") < 0)
return;
@ -526,7 +530,7 @@ void fdt_fixup_ethernet(void *fdt)
offset = fdt_first_property_offset(fdt,
fdt_path_offset(fdt, "/aliases"));
/* Select property number 'prop' */
for (i = 0; i < prop; i++)
for (j = 0; j < prop; j++)
offset = fdt_next_property_offset(fdt, offset);
if (offset < 0)
@ -535,11 +539,16 @@ void fdt_fixup_ethernet(void *fdt)
path = fdt_getprop_by_offset(fdt, offset, &name, NULL);
if (!strncmp(name, "ethernet", 8)) {
/* Treat plain "ethernet" same as "ethernet0". */
if (!strcmp(name, "ethernet"))
if (!strcmp(name, "ethernet")
#ifdef FDT_SEQ_MACADDR_FROM_ENV
|| !strcmp(name, "ethernet0")
#endif
)
i = 0;
#ifndef FDT_SEQ_MACADDR_FROM_ENV
else
i = trailing_strtol(name);
#endif
if (i != -1) {
if (i == 0)
strcpy(mac, "ethaddr");
@ -548,6 +557,14 @@ void fdt_fixup_ethernet(void *fdt)
} else {
continue;
}
#ifdef FDT_SEQ_MACADDR_FROM_ENV
nodeoff = fdt_path_offset(fdt, path);
fdt_prop = fdt_get_property(fdt, nodeoff, "status",
NULL);
if (fdt_prop && !strcmp(fdt_prop->data, "disabled"))
continue;
i++;
#endif
tmp = env_get(mac);
if (!tmp)
continue;

@ -195,6 +195,8 @@
#define FM1_10GEC1_PHY_ADDR 0x0
#define FDT_SEQ_MACADDR_FROM_ENV
#define CONFIG_ETHPRIME "FM1@DTSEC3"
#endif

@ -290,4 +290,7 @@ int fdt_overlay_apply_verbose(void *fdt, void *fdto);
int fdtdec_get_int(const void *blob, int node, const char *prop_name,
int default_val);
#endif
#ifdef CONFIG_FMAN_ENET
int fdt_update_ethernet_dt(void *blob);
#endif
#endif /* ifndef __FDT_SUPPORT_H */

Loading…
Cancel
Save