summaryrefslogtreecommitdiffstats
path: root/drivers/net/designware_socfpga.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/designware_socfpga.c')
-rw-r--r--drivers/net/designware_socfpga.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/drivers/net/designware_socfpga.c b/drivers/net/designware_socfpga.c
index ce3ac38ebe..a39c945c81 100644
--- a/drivers/net/designware_socfpga.c
+++ b/drivers/net/designware_socfpga.c
@@ -77,8 +77,7 @@ static int socfpga_gen5_set_phy_mode(struct socfpga_dwc_dev *dwc_dev)
}
/* Assert reset to the enet controller before changing the phy mode */
- if (eth_dev->rst)
- reset_control_assert(eth_dev->rst);
+ reset_control_assert(eth_dev->rst);
ctrl = readl(dwc_dev->sys_mgr_base + reg_offset);
ctrl &= ~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift);
@@ -104,8 +103,7 @@ static int socfpga_gen5_set_phy_mode(struct socfpga_dwc_dev *dwc_dev)
/* Deassert reset for the phy configuration to be sampled by
* the enet controller, and operation to start in requested mode
*/
- if (eth_dev->rst)
- reset_control_deassert(eth_dev->rst);
+ reset_control_deassert(eth_dev->rst);
return 0;
}
@@ -124,8 +122,7 @@ static int socfpga_gen10_set_phy_mode(struct socfpga_dwc_dev *dwc_dev)
}
/* Assert reset to the enet controller before changing the phy mode */
- if (eth_dev->rst)
- reset_control_assert(eth_dev->rst);
+ reset_control_assert(eth_dev->rst);
ctrl = readl(dwc_dev->sys_mgr_base + reg_offset);
ctrl &= ~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift);
@@ -151,14 +148,14 @@ static int socfpga_gen10_set_phy_mode(struct socfpga_dwc_dev *dwc_dev)
/* Deassert reset for the phy configuration to be sampled by
* the enet controller, and operation to start in requested mode
*/
- if (eth_dev->rst)
- reset_control_deassert(eth_dev->rst);
+ reset_control_deassert(eth_dev->rst);
return 0;
}
-static int socfpga_dwc_probe_dt(struct device_d *dev, struct socfpga_dwc_dev *priv)
+static int socfpga_dwc_probe_dt(struct device *dev,
+ struct socfpga_dwc_dev *priv)
{
u32 reg_offset, reg_shift;
int ret;
@@ -166,7 +163,7 @@ static int socfpga_dwc_probe_dt(struct device_d *dev, struct socfpga_dwc_dev *pr
if (!IS_ENABLED(CONFIG_OFTREE))
return -ENODEV;
- ret = of_property_read_u32_index(dev->device_node, "altr,sysmgr-syscon",
+ ret = of_property_read_u32_index(dev->of_node, "altr,sysmgr-syscon",
1, &reg_offset);
if (ret) {
dev_err(dev, "Could not read reg_offset from sysmgr-syscon! Please update the devicetree.\n");
@@ -174,14 +171,15 @@ static int socfpga_dwc_probe_dt(struct device_d *dev, struct socfpga_dwc_dev *pr
return -EINVAL;
}
- ret = of_property_read_u32_index(dev->device_node, "altr,sysmgr-syscon",
+ ret = of_property_read_u32_index(dev->of_node, "altr,sysmgr-syscon",
2, &reg_shift);
if (ret) {
dev_err(dev, "Could not read reg_shift from sysmgr-syscon! Please update the devicetree.\n");
return -EINVAL;
}
- priv->f2h_ptp_ref_clk = of_property_read_bool(dev->device_node, "altr,f2h_ptp_ref_clk");
+ priv->f2h_ptp_ref_clk = of_property_read_bool(dev->of_node,
+ "altr,f2h_ptp_ref_clk");
priv->reg_offset = reg_offset;
priv->reg_shift = reg_shift;
@@ -189,7 +187,7 @@ static int socfpga_dwc_probe_dt(struct device_d *dev, struct socfpga_dwc_dev *pr
return 0;
}
-static int socfpga_dwc_ether_probe(struct device_d *dev)
+static int socfpga_dwc_ether_probe(struct device *dev)
{
struct socfpga_dwc_dev *dwc_dev;
struct dw_eth_dev *priv;
@@ -212,12 +210,14 @@ static int socfpga_dwc_ether_probe(struct device_d *dev)
return PTR_ERR(priv);
priv->rst = reset_control_get(dev, NULL);
- if (IS_ERR(priv->rst))
- dev_warn(dev, "No reset lines.\n");
+ if (IS_ERR(priv->rst)) {
+ dev_err(dev, "Invalid reset lines.\n");
+ return PTR_ERR(priv->rst);
+ }
dwc_dev->priv = priv;
- dwc_dev->sys_mgr_base = syscon_base_lookup_by_phandle(dev->device_node,
+ dwc_dev->sys_mgr_base = syscon_base_lookup_by_phandle(dev->of_node,
"altr,sysmgr-syscon");
if (IS_ERR(dwc_dev->sys_mgr_base)) {
dev_err(dev, "Could not get sysmgr-syscon node\n");
@@ -261,8 +261,9 @@ static __maybe_unused struct of_device_id socfpga_dwc_ether_compatible[] = {
/* sentinel */
}
};
+MODULE_DEVICE_TABLE(of, socfpga_dwc_ether_compatible);
-static struct driver_d socfpga_dwc_ether_driver = {
+static struct driver socfpga_dwc_ether_driver = {
.name = "socfpga_designware_eth",
.probe = socfpga_dwc_ether_probe,
.remove = dwc_drv_remove,