summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorTeresa Remmet <t.remmet@phytec.de>2019-02-13 09:34:27 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-02-13 15:43:19 +0100
commite8498ecf29c4238336294817efdf4b3551370679 (patch)
tree4facd3792146042c64289b7266531a124a177d59 /drivers/net
parent760916cb65ca318809cd755a7ad0b40c5a0c7b9a (diff)
downloadbarebox-e8498ecf29c4238336294817efdf4b3551370679.tar.gz
barebox-e8498ecf29c4238336294817efdf4b3551370679.tar.xz
net: ethernet: cpsw: cpsw-phy-sel: Use phandle for phy sel
With the usage of the interconnect target module hierarchy in device tree the cpsw-phy-sel node moved to the system control module. An phandle has been added instead to the device tree include. Try to use the cpsw-phy-sel phandle first then fall back looking for the cpsw-phy-sel child. This patch is based on the upstream kernel patch: 18eb8aea7fb2 ("net: ethernet: cpsw-phy-sel: prefer phandle for phy sel") Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/cpsw.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index 432004ec9c..65f71c6fce 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -1053,6 +1053,7 @@ static int cpsw_probe_dt(struct cpsw_priv *priv)
{
struct device_d *dev = priv->dev;
struct device_node *np = dev->device_node, *child;
+ struct device_node *physel;
int ret, i = 0;
ret = of_property_read_u32(np, "slaves", &priv->num_slaves);
@@ -1061,13 +1062,17 @@ static int cpsw_probe_dt(struct cpsw_priv *priv)
priv->slaves = xzalloc(sizeof(struct cpsw_slave) * priv->num_slaves);
- for_each_child_of_node(np, child) {
- if (of_device_is_compatible(child, "ti,am3352-cpsw-phy-sel")) {
- ret = cpsw_phy_sel_init(priv, child);
- if (ret)
- return ret;
- }
+ physel = of_parse_phandle(dev->device_node, "cpsw-phy-sel", 0);
+ if (!physel) {
+ physel = of_get_child_by_name(dev->device_node, "cpsw-phy-sel");
+ if (!physel)
+ dev_err(dev, "Phy mode node not found\n");
+ }
+ ret = cpsw_phy_sel_init(priv, physel);
+ if (ret)
+ return ret;
+ for_each_child_of_node(np, child) {
if (of_device_is_compatible(child, "ti,davinci_mdio")) {
ret = of_pinctrl_select_state_default(child);
if (ret)