0175-net-mediatek-remove-superfluous-pin-setup-for-MT7622.patch 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. From d96cf7e724105dc73f623c2019ab5bc78cef036e Mon Sep 17 00:00:00 2001
  2. From: Sean Wang <[email protected]>
  3. Date: Wed, 20 Dec 2017 17:47:06 +0800
  4. Subject: [PATCH 175/224] net: mediatek: remove superfluous pin setup for
  5. MT7622 SoC
  6. Remove superfluous pin setup to get out of accessing invalid I/O pin
  7. registers because the way for pin configuring tends to be different from
  8. various SoCs and thus it should be better being managed and controlled by
  9. the pinctrl driver which MT7622 already can support.
  10. Signed-off-by: Sean Wang <[email protected]>
  11. Signed-off-by: David S. Miller <[email protected]>
  12. ---
  13. drivers/net/ethernet/mediatek/mtk_eth_soc.c | 35 +++++++++++++++++------------
  14. drivers/net/ethernet/mediatek/mtk_eth_soc.h | 3 +++
  15. 2 files changed, 24 insertions(+), 14 deletions(-)
  16. --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  17. +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  18. @@ -1976,14 +1976,16 @@ static int mtk_hw_init(struct mtk_eth *e
  19. }
  20. regmap_write(eth->ethsys, ETHSYS_SYSCFG0, val);
  21. - /* Set GE2 driving and slew rate */
  22. - regmap_write(eth->pctl, GPIO_DRV_SEL10, 0xa00);
  23. + if (eth->pctl) {
  24. + /* Set GE2 driving and slew rate */
  25. + regmap_write(eth->pctl, GPIO_DRV_SEL10, 0xa00);
  26. - /* set GE2 TDSEL */
  27. - regmap_write(eth->pctl, GPIO_OD33_CTRL8, 0x5);
  28. + /* set GE2 TDSEL */
  29. + regmap_write(eth->pctl, GPIO_OD33_CTRL8, 0x5);
  30. - /* set GE2 TUNE */
  31. - regmap_write(eth->pctl, GPIO_BIAS_CTRL, 0x0);
  32. + /* set GE2 TUNE */
  33. + regmap_write(eth->pctl, GPIO_BIAS_CTRL, 0x0);
  34. + }
  35. /* Set linkdown as the default for each GMAC. Its own MCR would be set
  36. * up with the more appropriate value when mtk_phy_link_adjust call is
  37. @@ -2568,11 +2570,13 @@ static int mtk_probe(struct platform_dev
  38. }
  39. }
  40. - eth->pctl = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
  41. - "mediatek,pctl");
  42. - if (IS_ERR(eth->pctl)) {
  43. - dev_err(&pdev->dev, "no pctl regmap found\n");
  44. - return PTR_ERR(eth->pctl);
  45. + if (eth->soc->required_pctl) {
  46. + eth->pctl = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
  47. + "mediatek,pctl");
  48. + if (IS_ERR(eth->pctl)) {
  49. + dev_err(&pdev->dev, "no pctl regmap found\n");
  50. + return PTR_ERR(eth->pctl);
  51. + }
  52. }
  53. for (i = 0; i < 3; i++) {
  54. @@ -2698,17 +2702,20 @@ static int mtk_remove(struct platform_de
  55. static const struct mtk_soc_data mt2701_data = {
  56. .caps = MTK_GMAC1_TRGMII,
  57. - .required_clks = MT7623_CLKS_BITMAP
  58. + .required_clks = MT7623_CLKS_BITMAP,
  59. + .required_pctl = true,
  60. };
  61. static const struct mtk_soc_data mt7622_data = {
  62. .caps = MTK_DUAL_GMAC_SHARED_SGMII | MTK_GMAC1_ESW,
  63. - .required_clks = MT7622_CLKS_BITMAP
  64. + .required_clks = MT7622_CLKS_BITMAP,
  65. + .required_pctl = false,
  66. };
  67. static const struct mtk_soc_data mt7623_data = {
  68. .caps = MTK_GMAC1_TRGMII,
  69. - .required_clks = MT7623_CLKS_BITMAP
  70. + .required_clks = MT7623_CLKS_BITMAP,
  71. + .required_pctl = true,
  72. };
  73. const struct of_device_id of_mtk_match[] = {
  74. --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
  75. +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
  76. @@ -574,10 +574,13 @@ struct mtk_rx_ring {
  77. * @caps Flags shown the extra capability for the SoC
  78. * @required_clks Flags shown the bitmap for required clocks on
  79. * the target SoC
  80. + * @required_pctl A bool value to show whether the SoC requires
  81. + * the extra setup for those pins used by GMAC.
  82. */
  83. struct mtk_soc_data {
  84. u32 caps;
  85. u32 required_clks;
  86. + bool required_pctl;
  87. };
  88. /* currently no SoC has more than 2 macs */