aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/ti/cpsw.c
diff options
context:
space:
mode:
authorFaiz Abbas2019-03-18 13:54:35 +0530
committerTom Rini2019-04-12 08:05:53 -0400
commitc3b460a516c93ff43194a88d8675598a33bae1aa (patch)
treefbe161e94dad371d33bf976be4a3cab95e1cdeab /drivers/net/ti/cpsw.c
parenta58d222df9be560e7fdba0300ca57b02b1362ded (diff)
net: ti: cpsw: Block off ofdata_to_platdata with OF_CONTROL
The ofdata_to_platdata function should not be called if OF_CONTROL is not enabled because fdtdec_* calls will fail. Block the function with OF_CONTROL Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Diffstat (limited to 'drivers/net/ti/cpsw.c')
-rw-r--r--drivers/net/ti/cpsw.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/net/ti/cpsw.c b/drivers/net/ti/cpsw.c
index d9d25a629fb..403c9b98dd8 100644
--- a/drivers/net/ti/cpsw.c
+++ b/drivers/net/ti/cpsw.c
@@ -1193,6 +1193,7 @@ static int cpsw_eth_probe(struct udevice *dev)
return _cpsw_register(priv);
}
+#if CONFIG_IS_ENABLED(OF_CONTROL)
static int cpsw_eth_ofdata_to_platdata(struct udevice *dev)
{
struct eth_pdata *pdata = dev_get_platdata(dev);
@@ -1352,6 +1353,13 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev)
return 0;
}
+static const struct udevice_id cpsw_eth_ids[] = {
+ { .compatible = "ti,cpsw" },
+ { .compatible = "ti,am335x-cpsw" },
+ { }
+};
+#endif
+
int cpsw_get_slave_phy_addr(struct udevice *dev, int slave)
{
struct cpsw_priv *priv = dev_get_priv(dev);
@@ -1360,21 +1368,17 @@ int cpsw_get_slave_phy_addr(struct udevice *dev, int slave)
return data->slave_data[slave].phy_addr;
}
-static const struct udevice_id cpsw_eth_ids[] = {
- { .compatible = "ti,cpsw" },
- { .compatible = "ti,am335x-cpsw" },
- { }
-};
-
U_BOOT_DRIVER(eth_cpsw) = {
.name = "eth_cpsw",
.id = UCLASS_ETH,
+#if CONFIG_IS_ENABLED(OF_CONTROL)
.of_match = cpsw_eth_ids,
.ofdata_to_platdata = cpsw_eth_ofdata_to_platdata,
+ .platdata_auto_alloc_size = sizeof(struct eth_pdata),
+#endif
.probe = cpsw_eth_probe,
.ops = &cpsw_eth_ops,
.priv_auto_alloc_size = sizeof(struct cpsw_priv),
- .platdata_auto_alloc_size = sizeof(struct eth_pdata),
.flags = DM_FLAG_ALLOC_PRIV_DMA,
};
#endif /* CONFIG_DM_ETH */