mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-03-16 23:07:00 +00:00
drivers: net: fsl-mc: fix MAC address fixup procedure
In the process of adopting CONFIG_DM_ETH on the DPAA2 based platforms, interfaces which were previously defined as "xgmii" were transitioned to be defined as "xfi" in the DTS. See the commit below for reference: commit87274918f2
("arm: dts: ls2088ardb: add DPMAC and PHY nodes") Then Vladimir's commit replaced all occurrences of "xfi" with "10gbase-r" in an effort to make U-Boot work with the same device tree as Linux. commit77b11f7604
("net: replace the "xfi" phy-mode with "10gbase-r"") These changes to the phy_interface_t of an Ethernet port meant that the mc_fixup_mac_addrs() function was no longer capable to properly fixup the MAC addresses. The problem arises from the fact that the hardcoded information about an interface (wriop_get_enet_if()) was no longer matching any actual device. For example, the function tried to search for "DPMAC1@xgmii1" by name using eth_get_dev_by_name() when only "DPMAC1@10gbase-r" was available. This function removes the need to rely on the hardcoded information by iterating through all the UCLASS_ETH devices which are DPAA2 and request a fixup for each of them. Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
This commit is contained in:
parent
3f1983d460
commit
8491a7e4ed
1 changed files with 12 additions and 17 deletions
|
@ -29,6 +29,7 @@
|
|||
#include <fsl-mc/fsl_dpsparser.h>
|
||||
#include <fsl-mc/fsl_qbman_portal.h>
|
||||
#include <fsl-mc/ldpaa_wriop.h>
|
||||
#include <net/ldpaa_eth.h>
|
||||
|
||||
#define MC_RAM_BASE_ADDR_ALIGNMENT (512UL * 1024 * 1024)
|
||||
#define MC_RAM_BASE_ADDR_ALIGNMENT_MASK (~(MC_RAM_BASE_ADDR_ALIGNMENT - 1))
|
||||
|
@ -383,37 +384,31 @@ static int mc_fixup_dpc_mac_addr(void *blob, int dpmac_id,
|
|||
|
||||
static int mc_fixup_mac_addrs(void *blob, enum mc_fixup_type type)
|
||||
{
|
||||
int i, err = 0, ret = 0;
|
||||
#define ETH_NAME_LEN 20
|
||||
struct udevice *eth_dev;
|
||||
char ethname[ETH_NAME_LEN];
|
||||
int err = 0, ret = 0;
|
||||
struct uclass *uc;
|
||||
uint32_t dpmac_id;
|
||||
|
||||
for (i = WRIOP1_DPMAC1; i < NUM_WRIOP_PORTS; i++) {
|
||||
/* port not enabled */
|
||||
if (wriop_is_enabled_dpmac(i) != 1)
|
||||
continue;
|
||||
|
||||
snprintf(ethname, ETH_NAME_LEN, "DPMAC%d@%s", i,
|
||||
phy_interface_strings[wriop_get_enet_if(i)]);
|
||||
|
||||
eth_dev = eth_get_dev_by_name(ethname);
|
||||
if (eth_dev == NULL)
|
||||
uclass_get(UCLASS_ETH, &uc);
|
||||
uclass_foreach_dev(eth_dev, uc) {
|
||||
if (!eth_dev->driver || !eth_dev->driver->name ||
|
||||
strcmp(eth_dev->driver->name, LDPAA_ETH_DRIVER_NAME))
|
||||
continue;
|
||||
|
||||
dpmac_id = ldpaa_eth_get_dpmac_id(eth_dev);
|
||||
switch (type) {
|
||||
case MC_FIXUP_DPL:
|
||||
err = mc_fixup_dpl_mac_addr(blob, i, eth_dev);
|
||||
err = mc_fixup_dpl_mac_addr(blob, dpmac_id, eth_dev);
|
||||
break;
|
||||
case MC_FIXUP_DPC:
|
||||
err = mc_fixup_dpc_mac_addr(blob, i, eth_dev);
|
||||
err = mc_fixup_dpc_mac_addr(blob, dpmac_id, eth_dev);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (err)
|
||||
printf("fsl-mc: ERROR fixing mac address for %s\n",
|
||||
ethname);
|
||||
printf("fsl-mc: ERROR fixing mac address for %s\n", eth_dev->name);
|
||||
ret |= err;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue