arm64: dts: mt8195: Add Ethernet controller
Subsystems (5)
v6 cover arm64: dts: mt8195: Add Ethernet controller
Changes in v6:
1. add reviewed-by as Angelo's comments
2. remove fix_mac_speed in driver as Andrew's comments.
Changes in v5:
1. reorder the clocks as Angelo's comments
2. add a driver patch to fix rgmii-id issue, then we can use a ususal way rgmii/rgmii-id as Andrew's comments.
Changes in v4:
1. remove {address,size}-cells = <0> to avoid warning as Angelo's feedback.
2. Add reviewd-by as Angelo's comments.
Changes in v3:
1. move stmmac-axi-config, rx-queues-config, tx-queues-configs inside ethernet node as Angelo's comments.
2. add {address,size}-cells = <0> in ethernet node as Angelo's comments.
Changes in v2:
1. modify pinctrl node used by ethernet to match rules in pinctrl-mt8195.yaml, which is pointed by Krzysztof.
2. remove "mac-address" property in ethernet node as comments of Krzysztof.
Changes in v1:
add dts node for MT8195 Ethernet controller
Biao Huang (2):
stmmac: dwmac-mediatek: remove the dwmac_fix_mac_speed
arm64: dts: mt8195: Add Ethernet controller
arch/arm64/boot/dts/mediatek/mt8195-demo.dts | 81 +++++++++++++++++ arch/arm64/boot/dts/mediatek/mt8195.dtsi | 86 +++++++++++++++++++ .../ethernet/stmicro/stmmac/dwmac-mediatek.c | 26 ------ 3 files changed, 167 insertions(+), 26 deletions(-)
Signature · 1 line
2.18.0
PATCH v6 1/2 stmmac: dwmac-mediatek: remove the dwmac_fix_mac_speed
In current driver, MAC will always enable 2ns delay in RGMII mode, but that's not the correct usage.
Remove the dwmac_fix_mac_speed() in driver, and recommend "rgmii-id" for phy-mode in device tree.
--- .../ethernet/stmicro/stmmac/dwmac-mediatek.c | 26 ------------------- 1 file changed, 26 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c +0 -26
@@ -90,7 +90,6 @@ struct mediatek_dwmac_plat_data {struct mediatek_dwmac_variant {int (*dwmac_set_phy_interface)(struct mediatek_dwmac_plat_data *plat);int (*dwmac_set_delay)(struct mediatek_dwmac_plat_data *plat); -void (*dwmac_fix_mac_speed)(void *priv,unsigned int speed);/* clock ids to be requested */ const char *const *clk_list;
@@ -443,32 +442,9 @@ static int mt8195_set_delay(struct mediatek_dwmac_plat_data *plat)return 0 ; } -static void mt8195_fix_mac_speed (void *priv,unsigned int speed) -{ -struct mediatek_dwmac_plat_data *priv_plat = priv; - -if ((phy_interface_mode_is_rgmii (priv_plat->phy_mode))) { -/* prefer 2ns fixed delay which is controlled by TXC_PHASE_CTRL, -* when link speed is 1Gbps with RGMII interface, -* Fall back to delay macro circuit for 10/100Mbps link speed. -*/ -if (speed ==SPEED_1000 ) -regmap_update_bits (priv_plat->peri_regmap, -MT8195_PERI_ETH_CTRL0 , -MT8195_RGMII_TXC_PHASE_CTRL | -MT8195_DLY_GTXC_ENABLE | -MT8195_DLY_GTXC_INV | -MT8195_DLY_GTXC_STAGES , -MT8195_RGMII_TXC_PHASE_CTRL ); -else -mt8195_set_delay (priv_plat); - } -} -static const struct mediatek_dwmac_variant mt8195_gmac_variant = { .dwmac_set_phy_interface = mt8195_set_interface, .dwmac_set_delay = mt8195_set_delay, - .dwmac_fix_mac_speed = mt8195_fix_mac_speed, .clk_list = mt8195_dwmac_clk_l, .num_clks =ARRAY_SIZE (mt8195_dwmac_clk_l), .dma_bit_mask =35 ,
@@ -619,8 +595,6 @@ static int mediatek_dwmac_common_data(struct platform_device *pdev, plat->bsp_priv = priv_plat; plat->init = mediatek_dwmac_init; plat->clks_config = mediatek_dwmac_clks_config; -if (priv_plat->variant->dwmac_fix_mac_speed) - plat->fix_mac_speed = priv_plat->variant->dwmac_fix_mac_speed; plat->safety_feat_cfg = devm_kzalloc(&pdev->dev, sizeof(*plat->safety_feat_cfg),
Signature · 1 line
2.25.1
PATCH v6 2/2 arm64: dts: mt8195: Add Ethernet controller
In reply to Biao HuangAdd Ethernet controller node for mt8195.
--- arch/arm64/boot/dts/mediatek/mt8195-demo.dts | 81 ++++++++++++++++++ arch/arm64/boot/dts/mediatek/mt8195.dtsi | 86 ++++++++++++++++++++ 2 files changed, 167 insertions(+)
arch/arm64/boot/dts/mediatek/mt8195-demo.dts +81 -0
@@ -258,6 +258,66 @@ &mt6359_vsram_others_ldo_reg { }; &pio { + eth_default_pins: eth-default-pins { + pins-txd { + pinmux = <PINMUX_GPIO77__FUNC_GBE_TXD3>, + <PINMUX_GPIO78__FUNC_GBE_TXD2>, + <PINMUX_GPIO79__FUNC_GBE_TXD1>, + <PINMUX_GPIO80__FUNC_GBE_TXD0>; + drive-strength = <MTK_DRIVE_8mA>; + }; + pins-cc { + pinmux = <PINMUX_GPIO85__FUNC_GBE_TXC>, + <PINMUX_GPIO88__FUNC_GBE_TXEN>, + <PINMUX_GPIO87__FUNC_GBE_RXDV>, + <PINMUX_GPIO86__FUNC_GBE_RXC>; + drive-strength = <MTK_DRIVE_8mA>; + }; + pins-rxd { + pinmux = <PINMUX_GPIO81__FUNC_GBE_RXD3>, + <PINMUX_GPIO82__FUNC_GBE_RXD2>, + <PINMUX_GPIO83__FUNC_GBE_RXD1>, + <PINMUX_GPIO84__FUNC_GBE_RXD0>; + }; + pins-mdio { + pinmux = <PINMUX_GPIO89__FUNC_GBE_MDC>, + <PINMUX_GPIO90__FUNC_GBE_MDIO>; + input-enable; + }; + pins-power { + pinmux = <PINMUX_GPIO91__FUNC_GPIO91>, + <PINMUX_GPIO92__FUNC_GPIO92>; + output-high; + }; + }; + + eth_sleep_pins: eth-sleep-pins { + pins-txd { + pinmux = <PINMUX_GPIO77__FUNC_GPIO77>, + <PINMUX_GPIO78__FUNC_GPIO78>, + <PINMUX_GPIO79__FUNC_GPIO79>, + <PINMUX_GPIO80__FUNC_GPIO80>; + }; + pins-cc { + pinmux = <PINMUX_GPIO85__FUNC_GPIO85>, + <PINMUX_GPIO88__FUNC_GPIO88>, + <PINMUX_GPIO87__FUNC_GPIO87>, + <PINMUX_GPIO86__FUNC_GPIO86>; + }; + pins-rxd { + pinmux = <PINMUX_GPIO81__FUNC_GPIO81>, + <PINMUX_GPIO82__FUNC_GPIO82>, + <PINMUX_GPIO83__FUNC_GPIO83>, + <PINMUX_GPIO84__FUNC_GPIO84>; + }; + pins-mdio { + pinmux = <PINMUX_GPIO89__FUNC_GPIO89>, + <PINMUX_GPIO90__FUNC_GPIO90>; + input-disable; + bias-disable; + }; + }; + gpio_keys_pins: gpio-keys-pins { pins { pinmux = <PINMUX_GPIO106__FUNC_GPIO106>;
@@ -434,6 +494,27 @@ &xhci0 { status = "okay"; }; +ð { + phy-mode ="rgmii-id"; + phy-handle = <ðernet_phy0>; + snps,reset-gpio = <&pio 93 GPIO_ACTIVE_HIGH>; + snps,reset-delays-us = <0 10000 10000>; + pinctrl-names = "default", "sleep"; + pinctrl-0 = <ð_default_pins>; + pinctrl-1 = <ð_sleep_pins>; + status = "okay"; + + mdio { + compatible = "snps,dwmac-mdio"; + #address-cells = <1>; + #size-cells = <0>; + ethernet_phy0: ethernet-phy@1 { + compatible = "ethernet-phy-id001c.c916"; + reg = <0x1>; + }; + }; +}; + &xhci1 { vusb33-supply = <&mt6359_vusb_ldo_reg>; status = "okay";
arch/arm64/boot/dts/mediatek/mt8195.dtsi +86 -0
92 lines not on this page · raw message
Signature · 1 line
2.25.1
Quoted 9 lines
arch/arm64/boot/dts/mediatek/mt8195-demo.dts +4
-0@@ -258,6 +258,66 @@ &mt6359_vsram_others_ldo_reg { }; +ð { + phy-mode ="rgmii-id"; + phy-handle = <ðernet_phy0>; + snps,reset-gpio = <&pio 93 GPIO_ACTIVE_HIGH>;
arch/arm64/boot/dts/mediatek/mt8195-demo.dts &mt6359_vsram_others_ldo_reg { · line 273
Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8195-demo.dts +10
-0+ snps,reset-delays-us = <0 10000 10000>; + pinctrl-names = "default", "sleep"; + pinctrl-0 = <ð_default_pins>; + pinctrl-1 = <ð_sleep_pins>; + status = "okay"; + + mdio { + compatible = "snps,dwmac-mdio"; + #address-cells = <1>; + #size-cells = <0>;
The mdio bus master is a property of the SoC, not the board. So i would expect it be in the .dtsi file.
arch/arm64/boot/dts/mediatek/mt8195-demo.dts &xhci0 { · line 514
Quoted 4 lines
arch/arm64/boot/dts/mediatek/mt8195-demo.dts +4
-0+ ethernet_phy0: ethernet-phy@1 { + compatible = "ethernet-phy-id001c.c916"; + reg = <0x1>; + };
Is the PHY integrated into the SoC, or on the board?
You also don't need the compatible, if the PHY correctly implements the ID registers.
Andrew
Quoted 14 lines · Andrew Lunn
Quoted 14 lines
arch/arm64/boot/dts/mediatek/mt8195-demo.dts +9
-0@@ -258,6 +258,66 @@ &mt6359_vsram_others_ldo_reg { }; +ð { + phy-mode ="rgmii-id"; + phy-handle = <ðernet_phy0>; + snps,reset-gpio = <&pio 93 GPIO_ACTIVE_HIGH>; + snps,reset-delays-us = <0 10000 10000>; + pinctrl-names = "default", "sleep"; + pinctrl-0 = <ð_default_pins>; + pinctrl-1 = <ð_sleep_pins>; + status = "okay";
Quoted 8 lines
arch/arm64/boot/dts/mediatek/mt8195-demo.dts &xhci0 { · line 510
Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8195-demo.dts +5
-0+ + mdio { + compatible = "snps,dwmac-mdio"; + #address-cells = <1>; + #size-cells = <0>;The mdio bus master is a property of the SoC, not the board. So i would expect it be in the .dtsi file.
OK, will move mdio to .dtsi.
Quoted 7 lines
arch/arm64/boot/dts/mediatek/mt8195-demo.dts &xhci0 { · line 514
Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8195-demo.dts +4
-0+ ethernet_phy0: ethernet-phy@1 { + compatible = "ethernet-phy-id001c.c916"; + reg = <0x1>; + };Is the PHY integrated into the SoC, or on the board?
The PHY is on the board, an external device as to SoC.
Quoted 3 lines
You also don't need the compatible, if the PHY correctly implements the ID registers.
But without the compatible, it seems PHY driver will not be attached. How should I do? Thanks in advance.
Quoted 2 lines
Andrew
Best Regards!
Biao
Quoted 7 lines
Quoted 1 line
Is the PHY integrated into the SoC, or on the board?
The PHY is on the board, an external device as to SoC.
Quoted 3 lines
You also don't need the compatible, if the PHY correctly implements the ID registers.
But without the compatible, it seems PHY driver will not be attached. How should I do? Thanks in advance.
Check what happens in mdiobus_scan() and get_phy_device(). When it reads registers 2 and 3, does it get valid ID register contents?
Andrew
Quoted 8 lines · Andrew Lunn
Quoted 8 lines
Quoted 1 line
Is the PHY integrated into the SoC, or on the board?
The PHY is on the board, an external device as to SoC.
Quoted 4 lines
You also don't need the compatible, if the PHY correctly implements
the ID registers.
Quoted 6 lines
Quoted 3 lines
But without the compatible, it seems PHY driver will not be attached.
How should I do? Thanks in advance.Check what happens in
mdiobus_scan()andget_phy_device(). When it reads registers 2 and 3, does it get valid ID register contents?
Yes, I tried remove the compatible, and PHY driver is attached as expected. I'll remove the phy compatible in next send.
Quoted 2 lines
Andrew
As to the "Confidentiality Notice", I have asked our IT to handle it. Hope no such notice now.
Best Regards!
Biao
Jakub Kicinski
maintainerQuoted 18 lines · On Wed, 28 Dec 2022 14:33:28 +0800 Biao Huang wrote:
Changes in v6:
1. add reviewed-by as Angelo's comments
2. removefix_mac_speedin driver as Andrew's comments.Changes in v5:
1. reorder the clocks as Angelo's comments
2. add a driver patch to fix rgmii-id issue, then we can use a ususal way rgmii/rgmii-id as Andrew's comments.Changes in v4:
1. remove {address,size}-cells = <0> to avoid warning as Angelo's feedback.
2. Add reviewd-by as Angelo's comments.Changes in v3:
1. move stmmac-axi-config, rx-queues-config, tx-queues-configs inside ethernet node as Angelo's comments.
2. add {address,size}-cells = <0> in ethernet node as Angelo's comments.
Quoted 4 lines
Changes in v2:
1. modify pinctrl node used by ethernet to match rules inpinctrl-mt8195.yaml, which is pointed by Krzysztof.
2. remove "mac-address" property in ethernet node as comments of Krzysztof.
Please make sure to CC netdev@ on the next version of the patches.
Quoted 22 lines · Jakub Kicinski
Quoted 21 lines · On Wed, 28 Dec 2022 14:33:28 +0800 Biao Huang wrote:
Changes in v6:
1. add reviewed-by as Angelo's comments
2. removefix_mac_speedin driver as Andrew's comments.Changes in v5:
1. reorder the clocks as Angelo's comments
2. add a driver patch to fix rgmii-id issue, then we can use a ususal way rgmii/rgmii-id as Andrew's comments.Changes in v4:
1. remove {address,size}-cells = <0> to avoid warning as Angelo's feedback.
2. Add reviewd-by as Angelo's comments.Changes in v3:
1. move stmmac-axi-config, rx-queues-config, tx-queues-configs inside ethernet
node as Angelo's comments.
2. add {address,size}-cells = <0> in ethernet node as Angelo's comments.
Quoted 8 lines
Quoted 6 lines
Changes in v2:
1. modify pinctrl node used by ethernet to match rules in pinctrl-mt8195.yaml,
which is pointed by Krzysztof.
2. remove "mac-address" property in ethernet node as comments of Krzysztof.Please make sure to CC netdev@ on the next version of the patches.
Thanks for your kindly reminder.
Best Regards!
Biao