summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWeijie Gao <[email protected]>2023-07-19 17:16:59 +0800
committerTom Rini <[email protected]>2023-08-03 09:40:50 -0400
commitc41a058fb2a3405a36d70274d8415957e46fa0d6 (patch)
treea98955f2fc1af7744d70b520fd076482243b69dd
parentc73d38719fad3548b6931cc9555d4420584e9a4d (diff)
net: mediatek: optimize the switch reset delay wait time
Not all switches requires 1 second delay after deasserting reset. MT7531 requires only maximum 200ms. This patch defines dedicated reset wait time for each switch chip, and will significantly improve the boot time for boards using MT7531. Signed-off-by: Weijie Gao <[email protected]>
-rw-r--r--drivers/net/mtk_eth.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c
index 90f1d2591b6..cd72070ff62 100644
--- a/drivers/net/mtk_eth.c
+++ b/drivers/net/mtk_eth.c
@@ -127,6 +127,7 @@ struct mtk_eth_priv {
u32 mt753x_smi_addr;
u32 mt753x_phy_base;
u32 mt753x_pmcr;
+ u32 mt753x_reset_wait_time;
struct gpio_desc rst_gpio;
int mcm;
@@ -943,12 +944,12 @@ int mt753x_switch_init(struct mtk_eth_priv *priv)
reset_assert(&priv->rst_mcm);
udelay(1000);
reset_deassert(&priv->rst_mcm);
- mdelay(1000);
+ mdelay(priv->mt753x_reset_wait_time);
} else if (dm_gpio_is_valid(&priv->rst_gpio)) {
dm_gpio_set_value(&priv->rst_gpio, 0);
udelay(1000);
dm_gpio_set_value(&priv->rst_gpio, 1);
- mdelay(1000);
+ mdelay(priv->mt753x_reset_wait_time);
}
ret = priv->switch_init(priv);
@@ -1528,11 +1529,13 @@ static int mtk_eth_of_to_plat(struct udevice *dev)
priv->switch_init = mt7530_setup;
priv->switch_mac_control = mt7530_mac_control;
priv->mt753x_smi_addr = MT753X_DFL_SMI_ADDR;
+ priv->mt753x_reset_wait_time = 1000;
} else if (!strcmp(str, "mt7531")) {
priv->sw = SW_MT7531;
priv->switch_init = mt7531_setup;
priv->switch_mac_control = mt7531_mac_control;
priv->mt753x_smi_addr = MT753X_DFL_SMI_ADDR;
+ priv->mt753x_reset_wait_time = 200;
} else {
printf("error: unsupported switch\n");
return -EINVAL;