Skip to content

Commit bc8a2d9

Browse files
Dinh Nguyendavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 12b0355 commit bc8a2d9

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

drivers/net/ethernet/stmicro/stmmac/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ config DWMAC_ROCKCHIP
111111
config DWMAC_SOCFPGA
112112
tristate "SOCFPGA dwmac support"
113113
default ARCH_SOCFPGA
114-
depends on OF && (ARCH_SOCFPGA || COMPILE_TEST)
114+
depends on OF && (ARCH_SOCFPGA || ARCH_STRATIX10 || COMPILE_TEST)
115115
select MFD_SYSCON
116116
help
117117
Support for ethernet controller on Altera SOCFPGA

drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ struct socfpga_dwmac {
5555
struct device *dev;
5656
struct regmap *sys_mgr_base_addr;
5757
struct reset_control *stmmac_rst;
58+
struct reset_control *stmmac_ocp_rst;
5859
void __iomem *splitter_base;
5960
bool f2h_ptp_ref_clk;
6061
struct tse_pcs pcs;
@@ -262,8 +263,8 @@ static int socfpga_dwmac_set_phy_mode(struct socfpga_dwmac *dwmac)
262263
val = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII;
263264

264265
/* Assert reset to the enet controller before changing the phy mode */
265-
if (dwmac->stmmac_rst)
266-
reset_control_assert(dwmac->stmmac_rst);
266+
reset_control_assert(dwmac->stmmac_ocp_rst);
267+
reset_control_assert(dwmac->stmmac_rst);
267268

268269
regmap_read(sys_mgr_base_addr, reg_offset, &ctrl);
269270
ctrl &= ~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift);
@@ -288,8 +289,8 @@ static int socfpga_dwmac_set_phy_mode(struct socfpga_dwmac *dwmac)
288289
/* Deassert reset for the phy configuration to be sampled by
289290
* the enet controller, and operation to start in requested mode
290291
*/
291-
if (dwmac->stmmac_rst)
292-
reset_control_deassert(dwmac->stmmac_rst);
292+
reset_control_deassert(dwmac->stmmac_ocp_rst);
293+
reset_control_deassert(dwmac->stmmac_rst);
293294
if (phymode == PHY_INTERFACE_MODE_SGMII) {
294295
if (tse_pcs_init(dwmac->pcs.tse_pcs_base, &dwmac->pcs) != 0) {
295296
dev_err(dwmac->dev, "Unable to initialize TSE PCS");
@@ -324,6 +325,15 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
324325
goto err_remove_config_dt;
325326
}
326327

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+
327337
ret = socfpga_dwmac_parse_data(dwmac, dev);
328338
if (ret) {
329339
dev_err(dev, "Unable to parse OF data\n");

0 commit comments

Comments
 (0)