Skip to content

Commit e67f325

Browse files
clayfacedavem330
authored andcommitted
net: stmmac: explicitly deassert GMAC_AHB_RESET
We are currently assuming that GMAC_AHB_RESET will already be deasserted by the bootloader. However if this has not been done, probing of the GMAC will fail. To remedy this we must ensure GMAC_AHB_RESET has been deasserted prior to probing. v2 changes: - remove NULL condition check for stmmac_ahb_rst in stmmac_main.c - unwrap dev_err() message in stmmac_main.c - add PTR_ERR() around plat->stmmac_ahb_rst in stmmac_platform.c v3 changes: - add error pointer to dev_err() output - add reset_control_assert(stmmac_ahb_rst) in stmmac_dvr_remove - revert PTR_ERR() around plat->stmmac_ahb_rst since this is performed on the returned value of ret by the calling function Signed-off-by: Matthew Hagan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 52481e5 commit e67f325

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6843,6 +6843,11 @@ int stmmac_dvr_probe(struct device *device,
68436843
reset_control_reset(priv->plat->stmmac_rst);
68446844
}
68456845

6846+
ret = reset_control_deassert(priv->plat->stmmac_ahb_rst);
6847+
if (ret == -ENOTSUPP)
6848+
dev_err(priv->device, "unable to bring out of ahb reset: %pe\n",
6849+
ERR_PTR(ret));
6850+
68466851
/* Init MAC and get the capabilities */
68476852
ret = stmmac_hw_init(priv);
68486853
if (ret)
@@ -7086,6 +7091,7 @@ int stmmac_dvr_remove(struct device *dev)
70867091
phylink_destroy(priv->phylink);
70877092
if (priv->plat->stmmac_rst)
70887093
reset_control_assert(priv->plat->stmmac_rst);
7094+
reset_control_assert(priv->plat->stmmac_ahb_rst);
70897095
pm_runtime_put(dev);
70907096
pm_runtime_disable(dev);
70917097
if (priv->hw->pcs != STMMAC_PCS_TBI &&

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,13 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
600600
goto error_hw_init;
601601
}
602602

603+
plat->stmmac_ahb_rst = devm_reset_control_get_optional_shared(
604+
&pdev->dev, "ahb");
605+
if (IS_ERR(plat->stmmac_ahb_rst)) {
606+
ret = plat->stmmac_ahb_rst;
607+
goto error_hw_init;
608+
}
609+
603610
return plat;
604611

605612
error_hw_init:

include/linux/stmmac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ struct plat_stmmacenet_data {
240240
unsigned int mult_fact_100ns;
241241
s32 ptp_max_adj;
242242
struct reset_control *stmmac_rst;
243+
struct reset_control *stmmac_ahb_rst;
243244
struct stmmac_axi *axi;
244245
int has_gmac4;
245246
bool has_sun8i;

0 commit comments

Comments
 (0)