aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDinh Nguyen <dinguyen@kernel.org>2018-06-19 11:35:38 -0400
committerDavid S. Miller <davem@davemloft.net>2018-06-20 01:34:26 -0400
commitbc8a2d9bcbf1ca548b1deb315d14e1da81945bea (patch)
treef3199c5520ea0e318526763c4386abe40725ed7b
parent12b03558cef6d655d0d394f5e98a6fd07c1f6c0f (diff)
net: stmmac: socfpga: add additional ocp reset line for Stratix10
The Stratix10 platform has an additional reset line, OCP(Open Core Protocol), that also needs to get deasserted for the stmmac ethernet controller to work. Thus we need to update the Kconfig to include ARCH_STRATIX10 in order to build dwmac-socfpga. Also, remove the redundant check for the reset controller pointer. The reset driver already checks for the pointer and returns 0 if the pointer is NULL. Signed-off-by: Dinh Nguyen <dinguyen@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/Kconfig2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c18
2 files changed, 15 insertions, 5 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index cb5b0f58c395..edf20361ea5f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -111,7 +111,7 @@ config DWMAC_ROCKCHIP
111config DWMAC_SOCFPGA 111config DWMAC_SOCFPGA
112 tristate "SOCFPGA dwmac support" 112 tristate "SOCFPGA dwmac support"
113 default ARCH_SOCFPGA 113 default ARCH_SOCFPGA
114 depends on OF && (ARCH_SOCFPGA || COMPILE_TEST) 114 depends on OF && (ARCH_SOCFPGA || ARCH_STRATIX10 || COMPILE_TEST)
115 select MFD_SYSCON 115 select MFD_SYSCON
116 help 116 help
117 Support for ethernet controller on Altera SOCFPGA 117 Support for ethernet controller on Altera SOCFPGA
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 6e359572b9f0..5b3b06a0a3bf 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -55,6 +55,7 @@ struct socfpga_dwmac {
55 struct device *dev; 55 struct device *dev;
56 struct regmap *sys_mgr_base_addr; 56 struct regmap *sys_mgr_base_addr;
57 struct reset_control *stmmac_rst; 57 struct reset_control *stmmac_rst;
58 struct reset_control *stmmac_ocp_rst;
58 void __iomem *splitter_base; 59 void __iomem *splitter_base;
59 bool f2h_ptp_ref_clk; 60 bool f2h_ptp_ref_clk;
60 struct tse_pcs pcs; 61 struct tse_pcs pcs;
@@ -262,8 +263,8 @@ static int socfpga_dwmac_set_phy_mode(struct socfpga_dwmac *dwmac)
262 val = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII; 263 val = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII;
263 264
264 /* Assert reset to the enet controller before changing the phy mode */ 265 /* Assert reset to the enet controller before changing the phy mode */
265 if (dwmac->stmmac_rst) 266 reset_control_assert(dwmac->stmmac_ocp_rst);
266 reset_control_assert(dwmac->stmmac_rst); 267 reset_control_assert(dwmac->stmmac_rst);
267 268
268 regmap_read(sys_mgr_base_addr, reg_offset, &ctrl); 269 regmap_read(sys_mgr_base_addr, reg_offset, &ctrl);
269 ctrl &= ~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift); 270 ctrl &= ~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift);
@@ -288,8 +289,8 @@ static int socfpga_dwmac_set_phy_mode(struct socfpga_dwmac *dwmac)
288 /* Deassert reset for the phy configuration to be sampled by 289 /* Deassert reset for the phy configuration to be sampled by
289 * the enet controller, and operation to start in requested mode 290 * the enet controller, and operation to start in requested mode
290 */ 291 */
291 if (dwmac->stmmac_rst) 292 reset_control_deassert(dwmac->stmmac_ocp_rst);
292 reset_control_deassert(dwmac->stmmac_rst); 293 reset_control_deassert(dwmac->stmmac_rst);
293 if (phymode == PHY_INTERFACE_MODE_SGMII) { 294 if (phymode == PHY_INTERFACE_MODE_SGMII) {
294 if (tse_pcs_init(dwmac->pcs.tse_pcs_base, &dwmac->pcs) != 0) { 295 if (tse_pcs_init(dwmac->pcs.tse_pcs_base, &dwmac->pcs) != 0) {
295 dev_err(dwmac->dev, "Unable to initialize TSE PCS"); 296 dev_err(dwmac->dev, "Unable to initialize TSE PCS");
@@ -324,6 +325,15 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
324 goto err_remove_config_dt; 325 goto err_remove_config_dt;
325 } 326 }
326 327
328 dwmac->stmmac_ocp_rst = devm_reset_control_get_optional(dev, "stmmaceth-ocp");
329 if (IS_ERR(dwmac->stmmac_ocp_rst)) {
330 ret = PTR_ERR(dwmac->stmmac_ocp_rst);
331 dev_err(dev, "error getting reset control of ocp %d\n", ret);
332 goto err_remove_config_dt;
333 }
334
335 reset_control_deassert(dwmac->stmmac_ocp_rst);
336
327 ret = socfpga_dwmac_parse_data(dwmac, dev); 337 ret = socfpga_dwmac_parse_data(dwmac, dev);
328 if (ret) { 338 if (ret) {
329 dev_err(dev, "Unable to parse OF data\n"); 339 dev_err(dev, "Unable to parse OF data\n");