diff options
author | Ed Maste <emaste@FreeBSD.org> | 2019-04-03 21:01:53 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2019-04-03 21:01:53 +0000 |
commit | 5eb264119ee0ef81b933f62a1df271b5a4250b59 (patch) | |
tree | cc1a34255ad2b27e050f6c13b861912840e750c4 | |
parent | 0a17b9e03e8402aa912c398e98b48c8b3b4ee232 (diff) |
Notes
-rw-r--r-- | sys/arm/ti/cpsw/if_cpsw.c | 18 | ||||
-rw-r--r-- | sys/dev/fdt/fdt_common.c | 3 |
2 files changed, 15 insertions, 6 deletions
diff --git a/sys/arm/ti/cpsw/if_cpsw.c b/sys/arm/ti/cpsw/if_cpsw.c index 8b3a7691a76ab..d48098b40b305 100644 --- a/sys/arm/ti/cpsw/if_cpsw.c +++ b/sys/arm/ti/cpsw/if_cpsw.c @@ -82,6 +82,8 @@ __FBSDID("$FreeBSD$"); #include <dev/ofw/ofw_bus.h> #include <dev/ofw/ofw_bus_subr.h> + +#include <dev/fdt/fdt_common.h> #ifdef CPSW_ETHERSWITCH #include <dev/etherswitch/etherswitch.h> @@ -742,7 +744,7 @@ cpsw_get_fdt_data(struct cpsw_softc *sc, int port) phandle_t child; unsigned long mdio_child_addr; - /* Find any slave with phy_id */ + /* Find any slave with phy-handle/phy_id */ phy = -1; vlan = -1; for (child = OF_child(sc->node); child != 0; child = OF_peer(child)) { @@ -756,11 +758,15 @@ cpsw_get_fdt_data(struct cpsw_softc *sc, int port) if (mdio_child_addr != slave_mdio_addr[port]) continue; - len = OF_getproplen(child, "phy_id"); - if (len / sizeof(pcell_t) == 2) { - /* Get phy address from fdt */ - if (OF_getencprop(child, "phy_id", phy_id, len) > 0) - phy = phy_id[1]; + if (fdt_get_phyaddr(child, NULL, &phy, NULL) != 0){ + /* Users with old DTB will have phy_id instead */ + phy = -1; + len = OF_getproplen(child, "phy_id"); + if (len / sizeof(pcell_t) == 2) { + /* Get phy address from fdt */ + if (OF_getencprop(child, "phy_id", phy_id, len) > 0) + phy = phy_id[1]; + } } len = OF_getproplen(child, "dual_emac_res_vlan"); diff --git a/sys/dev/fdt/fdt_common.c b/sys/dev/fdt/fdt_common.c index 35c32ec403f35..415a7834d6051 100644 --- a/sys/dev/fdt/fdt_common.c +++ b/sys/dev/fdt/fdt_common.c @@ -399,6 +399,9 @@ fdt_get_phyaddr(phandle_t node, device_t dev, int *phy_addr, void **phy_sc) *phy_addr = phy_reg; + if (phy_sc == NULL) + return (0); + /* * Search for softc used to communicate with phy. */ |