101-17-net-mediatek-optimize-the-switch-reset-delay-wait-ti.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. From d9a52701f6677889cc3332ab7a888f35cd69cc76 Mon Sep 17 00:00:00 2001
  2. From: Weijie Gao <[email protected]>
  3. Date: Wed, 19 Jul 2023 17:16:59 +0800
  4. Subject: [PATCH 17/29] net: mediatek: optimize the switch reset delay wait
  5. time
  6. Not all switches requires 1 second delay after deasserting reset.
  7. MT7531 requires only maximum 200ms.
  8. This patch defines dedicated reset wait time for each switch chip, and will
  9. significantly improve the boot time for boards using MT7531.
  10. Signed-off-by: Weijie Gao <[email protected]>
  11. ---
  12. drivers/net/mtk_eth.c | 7 +++++--
  13. 1 file changed, 5 insertions(+), 2 deletions(-)
  14. --- a/drivers/net/mtk_eth.c
  15. +++ b/drivers/net/mtk_eth.c
  16. @@ -127,6 +127,7 @@ struct mtk_eth_priv {
  17. u32 mt753x_smi_addr;
  18. u32 mt753x_phy_base;
  19. u32 mt753x_pmcr;
  20. + u32 mt753x_reset_wait_time;
  21. struct gpio_desc rst_gpio;
  22. int mcm;
  23. @@ -943,12 +944,12 @@ int mt753x_switch_init(struct mtk_eth_pr
  24. reset_assert(&priv->rst_mcm);
  25. udelay(1000);
  26. reset_deassert(&priv->rst_mcm);
  27. - mdelay(1000);
  28. + mdelay(priv->mt753x_reset_wait_time);
  29. } else if (dm_gpio_is_valid(&priv->rst_gpio)) {
  30. dm_gpio_set_value(&priv->rst_gpio, 0);
  31. udelay(1000);
  32. dm_gpio_set_value(&priv->rst_gpio, 1);
  33. - mdelay(1000);
  34. + mdelay(priv->mt753x_reset_wait_time);
  35. }
  36. ret = priv->switch_init(priv);
  37. @@ -1528,11 +1529,13 @@ static int mtk_eth_of_to_plat(struct ude
  38. priv->switch_init = mt7530_setup;
  39. priv->switch_mac_control = mt7530_mac_control;
  40. priv->mt753x_smi_addr = MT753X_DFL_SMI_ADDR;
  41. + priv->mt753x_reset_wait_time = 1000;
  42. } else if (!strcmp(str, "mt7531")) {
  43. priv->sw = SW_MT7531;
  44. priv->switch_init = mt7531_setup;
  45. priv->switch_mac_control = mt7531_mac_control;
  46. priv->mt753x_smi_addr = MT753X_DFL_SMI_ADDR;
  47. + priv->mt753x_reset_wait_time = 200;
  48. } else {
  49. printf("error: unsupported switch\n");
  50. return -EINVAL;