Skip to content

Commit 243dc5f

Browse files
moore-brosdavem330
authored andcommitted
net: mediatek: remove superfluous pin setup for MT7622 SoC
Remove superfluous pin setup to get out of accessing invalid I/O pin registers because the way for pin configuring tends to be different from various SoCs and thus it should be better being managed and controlled by the pinctrl driver which MT7622 already can support. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0ca30e8 commit 243dc5f

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

drivers/net/ethernet/mediatek/mtk_eth_soc.c

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,14 +1952,16 @@ static int mtk_hw_init(struct mtk_eth *eth)
19521952
}
19531953
regmap_write(eth->ethsys, ETHSYS_SYSCFG0, val);
19541954

1955-
/* Set GE2 driving and slew rate */
1956-
regmap_write(eth->pctl, GPIO_DRV_SEL10, 0xa00);
1955+
if (eth->pctl) {
1956+
/* Set GE2 driving and slew rate */
1957+
regmap_write(eth->pctl, GPIO_DRV_SEL10, 0xa00);
19571958

1958-
/* set GE2 TDSEL */
1959-
regmap_write(eth->pctl, GPIO_OD33_CTRL8, 0x5);
1959+
/* set GE2 TDSEL */
1960+
regmap_write(eth->pctl, GPIO_OD33_CTRL8, 0x5);
19601961

1961-
/* set GE2 TUNE */
1962-
regmap_write(eth->pctl, GPIO_BIAS_CTRL, 0x0);
1962+
/* set GE2 TUNE */
1963+
regmap_write(eth->pctl, GPIO_BIAS_CTRL, 0x0);
1964+
}
19631965

19641966
/* Set linkdown as the default for each GMAC. Its own MCR would be set
19651967
* up with the more appropriate value when mtk_phy_link_adjust call is
@@ -2538,11 +2540,13 @@ static int mtk_probe(struct platform_device *pdev)
25382540
}
25392541
}
25402542

2541-
eth->pctl = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
2542-
"mediatek,pctl");
2543-
if (IS_ERR(eth->pctl)) {
2544-
dev_err(&pdev->dev, "no pctl regmap found\n");
2545-
return PTR_ERR(eth->pctl);
2543+
if (eth->soc->required_pctl) {
2544+
eth->pctl = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
2545+
"mediatek,pctl");
2546+
if (IS_ERR(eth->pctl)) {
2547+
dev_err(&pdev->dev, "no pctl regmap found\n");
2548+
return PTR_ERR(eth->pctl);
2549+
}
25462550
}
25472551

25482552
for (i = 0; i < 3; i++) {
@@ -2668,17 +2672,20 @@ static int mtk_remove(struct platform_device *pdev)
26682672

26692673
static const struct mtk_soc_data mt2701_data = {
26702674
.caps = MTK_GMAC1_TRGMII,
2671-
.required_clks = MT7623_CLKS_BITMAP
2675+
.required_clks = MT7623_CLKS_BITMAP,
2676+
.required_pctl = true,
26722677
};
26732678

26742679
static const struct mtk_soc_data mt7622_data = {
26752680
.caps = MTK_DUAL_GMAC_SHARED_SGMII | MTK_GMAC1_ESW,
2676-
.required_clks = MT7622_CLKS_BITMAP
2681+
.required_clks = MT7622_CLKS_BITMAP,
2682+
.required_pctl = false,
26772683
};
26782684

26792685
static const struct mtk_soc_data mt7623_data = {
26802686
.caps = MTK_GMAC1_TRGMII,
2681-
.required_clks = MT7623_CLKS_BITMAP
2687+
.required_clks = MT7623_CLKS_BITMAP,
2688+
.required_pctl = true,
26822689
};
26832690

26842691
const struct of_device_id of_mtk_match[] = {

drivers/net/ethernet/mediatek/mtk_eth_soc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,10 +573,13 @@ struct mtk_rx_ring {
573573
* @caps Flags shown the extra capability for the SoC
574574
* @required_clks Flags shown the bitmap for required clocks on
575575
* the target SoC
576+
* @required_pctl A bool value to show whether the SoC requires
577+
* the extra setup for those pins used by GMAC.
576578
*/
577579
struct mtk_soc_data {
578580
u32 caps;
579581
u32 required_clks;
582+
bool required_pctl;
580583
};
581584

582585
/* currently no SoC has more than 2 macs */

0 commit comments

Comments
 (0)