arm64: dts: qcom: enable EMAC1 on sa8775p
Subsystems (5)
v2 cover arm64: dts: qcom: enable EMAC1 on sa8775p
From: Bartosz Golaszewski <[email protected]>
This series contains changes required to enable EMAC1 on sa8775p-ride. This iteration no longer depends on any changes to the stmmac driver to be functional. It turns out I was mistaken in thinking that the two MACs' MDIO masters share the MDIO clock and data lines. In reality, only one MAC is connected to an MDIO bus and it controlls PHYs for both MAC0 and MAC1. The MDIO master on MAC1 is not connected to anything.
v1 -> v2:
- remove pin functions for MDIO signals and don't assign them to MAC1
- add a delay after asserting the PHY's reset signal, not only when it's released
- remove the entire concept of shared-mdio property
- add aliases for ethernet nodes in order to avoid MDIO bus name conflicts in stmmac
Bartosz Golaszewski (8):
arm64: dts: qcom: sa8775p: add a node for the second serdes PHY
arm64: dts: qcom: sa8775p: add a node for EMAC1
arm64: dts: qcom: sa8775p-ride: enable the second SerDes PHY
arm64: dts: qcom: sa8775p-ride: move the reset-gpios property of the
PHY
arm64: dts: qcom: sa8775p-ride: index the first SGMII PHY
arm64: dts: qcom: sa8775p-ride: add the second SGMII PHY
arm64: dts: qcom: sa8775p-ride: add an alias for ethernet0
arm64: dts: qcom: sa8775p-ride: enable EMAC1
arch/arm64/boot/dts/qcom/sa8775p-ride.dts | 98 +++++++++++++++++++++-- arch/arm64/boot/dts/qcom/sa8775p.dtsi | 43 ++++++++++ 2 files changed, 135 insertions(+), 6 deletions(-)
Signature · 1 line
2.39.2
PATCH v2 1/8 arm64: dts: qcom: sa8775p: add a node for the second serdes PHY
From: Bartosz Golaszewski <[email protected]>
Add a node for the SerDes PHY used by EMAC1 on sa8775p-ride.
--- arch/arm64/boot/dts/qcom/sa8775p.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/qcom/sa8775p.dtsi +9 -0
@@ -1846,6 +1846,15 @@ serdes0: phy@8901000 { status = "disabled"; }; + serdes1: phy@8902000 { + compatible = "qcom,sa8775p-dwmac-sgmii-phy"; + reg = <0x0 0x08902000 0x0 0xe10>; + clocks = <&gcc GCC_SGMI_CLKREF_EN>; + clock-names = "sgmi_ref"; + #phy-cells = <0>; + status = "disabled"; + }; + pdc: interrupt-controller@b220000 { compatible = "qcom,sa8775p-pdc", "qcom,pdc"; reg = <0x0 0x0b220000 0x0 0x30000>,
Signature · 1 line
2.39.2
Re: [PATCH v2 1/8] arm64: dts: qcom: sa8775p: add a node for the second serdes PHY
Quoted 7 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Add a node for the SerDes PHY used by EMAC1 on sa8775p-ride.
Signed-off-by Bartosz Golaszewski <[email protected]>Reviewed-by Andrew Halaney <[email protected]>---
Konrad
PATCH v2 2/8 arm64: dts: qcom: sa8775p: add a node for EMAC1
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Add a node for the second MAC on sa8775p platforms.
--- arch/arm64/boot/dts/qcom/sa8775p.dtsi | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
arch/arm64/boot/dts/qcom/sa8775p.dtsi +34 -0
@@ -2325,6 +2325,40 @@ cpufreq_hw: cpufreq@18591000 { #freq-domain-cells = <1>; }; + ethernet1: ethernet@23000000 { + compatible = "qcom,sa8775p-ethqos"; + reg = <0x0 0x23000000 0x0 0x10000>, + <0x0 0x23016000 0x0 0x100>; + reg-names = "stmmaceth", "rgmii"; + + interrupts = <GIC_SPI 929 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "macirq"; + + clocks = <&gcc GCC_EMAC1_AXI_CLK>, + <&gcc GCC_EMAC1_SLV_AHB_CLK>, + <&gcc GCC_EMAC1_PTP_CLK>, + <&gcc GCC_EMAC1_PHY_AUX_CLK>; + + clock-names = "stmmaceth", + "pclk", + "ptp_ref", + "phyaux"; + + power-domains = <&gcc EMAC1_GDSC>; + + phys = <&serdes1>; + phy-names = "serdes"; + + iommus = <&apps_smmu 0x140 0xf>; + + snps,tso; + snps,pbl = <32>; + rx-fifo-depth = <16384>; + tx-fifo-depth = <16384>; + + status = "disabled"; + }; + ethernet0: ethernet@23040000 { compatible = "qcom,sa8775p-ethqos"; reg = <0x0 0x23040000 0x0 0x10000>,
Signature · 1 line
2.39.2
Re: [PATCH v2 2/8] arm64: dts: qcom: sa8775p: add a node for EMAC1
Quoted 26 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Add a node for the second MAC on sa8775p platforms.
Signed-off-by Bartosz Golaszewski <[email protected]>Reviewed-by Andrew Halaney <[email protected]>--- arch/arm64/boot/dts/qcom/sa8775p.dtsi | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)arch/arm64/boot/dts/qcom/sa8775p.dtsi +8
-0@@ -2325,6 +2325,40 @@ cpufreq_hw: cpufreq@18591000 { #freq-domain-cells = <1>; }; + ethernet1: ethernet@23000000 { + compatible = "qcom,sa8775p-ethqos"; + reg = <0x0 0x23000000 0x0 0x10000>, + <0x0 0x23016000 0x0 0x100>; + reg-names = "stmmaceth", "rgmii"; + + interrupts = <GIC_SPI 929 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "macirq";
arch/arm64/boot/dts/qcom/sa8775p.dtsi cpufreq_hw: cpufreq@18591000 { · line 2345
Quoted 10 lines
arch/arm64/boot/dts/qcom/sa8775p.dtsi +10
-0+ + clocks = <&gcc GCC_EMAC1_AXI_CLK>, + <&gcc GCC_EMAC1_SLV_AHB_CLK>, + <&gcc GCC_EMAC1_PTP_CLK>, + <&gcc GCC_EMAC1_PHY_AUX_CLK>; + + clock-names = "stmmaceth", + "pclk", + "ptp_ref", + "phyaux";
This is a very nitty nit, but if there's going to be a v3, please remove the newline between clocks and clock-names
Konrad
PATCH v2 3/8 arm64: dts: qcom: sa8775p-ride: enable the second SerDes PHY
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Enable the second SerDes PHY on sa8775p-ride development board.
--- arch/arm64/boot/dts/qcom/sa8775p-ride.dts | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/qcom/sa8775p-ride.dts +5 -0
@@ -448,6 +448,11 @@ &serdes0 { status = "okay"; }; +&serdes1 { + phy-supply = <&vreg_l5a>; + status = "okay"; +}; + &sleep_clk { clock-frequency = <32764>; };
Signature · 1 line
2.39.2
Re: [PATCH v2 3/8] arm64: dts: qcom: sa8775p-ride: enable the second SerDes PHY
Quoted 7 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Enable the second SerDes PHY on sa8775p-ride development board.
Signed-off-by Bartosz Golaszewski <[email protected]>Reviewed-by Andrew Halaney <[email protected]>---
Konrad
PATCH v2 4/8 arm64: dts: qcom: sa8775p-ride: move the reset-gpios property of the PHY
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Device-tree bindings for MDIO define per-PHY reset-gpios as well as a global reset-gpios property at the MDIO node level which controls all devices on the bus. The latter is most likely a workaround for the chicken-and-egg problem where we cannot read the ID of the PHY before bringing it out of reset but we cannot bring it out of reset until we've read its ID.
I have proposed a comprehensive solution for this problem in 2020 but it never got upstream. We do however have workaround in place which allows us to hard-code the PHY id in the compatible property, thus skipping the ID scanning.
Let's make the device-tree for sa8775p-ride slightly more correct by moving the reset-gpios property to the PHY node with its ID put into the PHY node's compatible.
--- arch/arm64/boot/dts/qcom/sa8775p-ride.dts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sa8775p-ride.dts +4 -4
@@ -279,13 +279,13 @@ mdio { #address-cells = <1>; #size-cells = <0>; - reset-gpios = <&pmm8654au_2_gpios 8 GPIO_ACTIVE_LOW>; - reset-delay-us = <11000>; - reset-post-delay-us = <70000>; - sgmii_phy: phy@8 { + compatible = "ethernet-phy-id0141.0dd4"; reg = <0x8>; device_type = "ethernet-phy"; + reset-gpios = <&pmm8654au_2_gpios 8 GPIO_ACTIVE_LOW>; + reset-assert-us = <11000>; + reset-deassert-us = <70000>; }; };
Signature · 1 line
2.39.2
Re: [PATCH v2 4/8] arm64: dts: qcom: sa8775p-ride: move the reset-gpios property of the PHY
Quoted 14 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Device-tree bindings for MDIO define per-PHY reset-gpios as well as a global reset-gpios property at the MDIO node level which controls all devices on the bus. The latter is most likely a workaround for the chicken-and-egg problem where we cannot read the ID of the PHY before bringing it out of reset but we cannot bring it out of reset until we've read its ID.
I have proposed a comprehensive solution for this problem in 2020 but it never got upstream. We do however have workaround in place which allows us to hard-code the PHY id in the compatible property, thus skipping the ID scanning.
Quoted 7 lines
Let's make the device-tree for sa8775p-ride slightly more correct by moving the reset-gpios property to the PHY node with its ID put into the PHY node's compatible.
Signed-off-by Bartosz Golaszewski <[email protected]>---
Konrad
PATCH v2 5/8 arm64: dts: qcom: sa8775p-ride: index the first SGMII PHY
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
We'll be adding a second SGMII PHY on the same MDIO bus, so let's index the first one for better readability.
--- arch/arm64/boot/dts/qcom/sa8775p-ride.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sa8775p-ride.dts +2 -2
@@ -263,7 +263,7 @@ vreg_l8e: ldo8 { ðernet0 { phy-mode = "sgmii"; - phy-handle = <&sgmii_phy>; + phy-handle = <&sgmii_phy0>; pinctrl-0 = <ðernet0_default>; pinctrl-names = "default";
@@ -279,7 +279,7 @@ mdio { #address-cells = <1>; #size-cells = <0>; - sgmii_phy: phy@8 { + sgmii_phy0: phy@8 { compatible = "ethernet-phy-id0141.0dd4"; reg = <0x8>; device_type = "ethernet-phy";
Signature · 1 line
2.39.2
Re: [PATCH v2 5/8] arm64: dts: qcom: sa8775p-ride: index the first SGMII PHY
Quoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
We'll be adding a second SGMII PHY on the same MDIO bus, so let's index the first one for better readability.
Signed-off-by Bartosz Golaszewski <[email protected]>Reviewed-by Andrew Halaney <[email protected]>---
Konrad
PATCH v2 6/8 arm64: dts: qcom: sa8775p-ride: add the second SGMII PHY
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Add a second SGMII PHY that will be used by EMAC1 on sa8775p-ride.
--- arch/arm64/boot/dts/qcom/sa8775p-ride.dts | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/qcom/sa8775p-ride.dts +9 -0
@@ -287,6 +287,15 @@ sgmii_phy0: phy@8 { reset-assert-us = <11000>; reset-deassert-us = <70000>; }; + + sgmii_phy1: phy@a { + compatible = "ethernet-phy-id0141.0dd4"; + reg = <0xa>; + device_type = "ethernet-phy"; + reset-gpios = <&pmm8654au_2_gpios 9 GPIO_ACTIVE_LOW>; + reset-assert-us = <11000>; + reset-deassert-us = <70000>; + }; }; mtl_rx_setup: rx-queues-config {
Signature · 1 line
2.39.2
Re: [PATCH v2 6/8] arm64: dts: qcom: sa8775p-ride: add the second SGMII PHY
Quoted 6 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Add a second SGMII PHY that will be used by EMAC1 on sa8775p-ride.
Signed-off-by Bartosz Golaszewski <[email protected]>---
Konrad
PATCH v2 7/8 arm64: dts: qcom: sa8775p-ride: add an alias for ethernet0
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Once we add a second ethernet node, the MDIO bus names will conflict unless we provide aliases. Add one for the existing ethernet node.
--- arch/arm64/boot/dts/qcom/sa8775p-ride.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/sa8775p-ride.dts +1 -0
@@ -23,6 +23,7 @@ aliases { i2c18 = &i2c18; spi16 = &spi16; ufshc1 = &ufs_mem_hc; + ethernet0 = ðernet0; }; chosen {
Signature · 1 line
2.39.2
Re: [PATCH v2 7/8] arm64: dts: qcom: sa8775p-ride: add an alias for ethernet0
Quoted 7 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Once we add a second ethernet node, the MDIO bus names will conflict unless we provide aliases. Add one for the existing ethernet node.
Signed-off-by Bartosz Golaszewski <[email protected]>---
ideally this would be sorted
PATCH v2 8/8 arm64: dts: qcom: sa8775p-ride: enable EMAC1
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Enable the second MAC on sa8775p-ride.
--- arch/arm64/boot/dts/qcom/sa8775p-ride.dts | 71 +++++++++++++++++++++++ 1 file changed, 71 insertions(+)
arch/arm64/boot/dts/qcom/sa8775p-ride.dts +71 -0
@@ -24,6 +24,7 @@ aliases { spi16 = &spi16; ufshc1 = &ufs_mem_hc; ethernet0 = ðernet0; + ethernet1 = ðernet1; }; chosen {
@@ -359,6 +360,76 @@ queue3 { }; }; +ðernet1 { + phy-mode = "sgmii"; + phy-handle = <&sgmii_phy1>; + + snps,mtl-rx-config = <&mtl_rx_setup1>; + snps,mtl-tx-config = <&mtl_tx_setup1>; + snps,ps-speed = <1000>; + + status = "okay"; + + mtl_rx_setup1: rx-queues-config { + snps,rx-queues-to-use = <4>; + snps,rx-sched-sp; + + queue0 { + snps,dcb-algorithm; + snps,map-to-dma-channel = <0x0>; + snps,route-up; + snps,priority = <0x1>; + }; + + queue1 { + snps,dcb-algorithm; + snps,map-to-dma-channel = <0x1>; + snps,route-ptp; + }; + + queue2 { + snps,avb-algorithm; + snps,map-to-dma-channel = <0x2>; + snps,route-avcp; + }; + + queue3 { + snps,avb-algorithm; + snps,map-to-dma-channel = <0x3>; + snps,priority = <0xc>; + }; + }; + + mtl_tx_setup1: tx-queues-config { + snps,tx-queues-to-use = <4>; + snps,tx-sched-sp; + + queue0 { + snps,dcb-algorithm; + }; + + queue1 { + snps,dcb-algorithm; + }; + + queue2 { + snps,avb-algorithm; + snps,send_slope = <0x1000>; + snps,idle_slope = <0x1000>; + snps,high_credit = <0x3e800>; + snps,low_credit = <0xffc18000>; + }; + + queue3 { + snps,avb-algorithm; + snps,send_slope = <0x1000>; + snps,idle_slope = <0x1000>; + snps,high_credit = <0x3e800>; + snps,low_credit = <0xffc18000>; + }; + }; +}; + &i2c11 { clock-frequency = <400000>; pinctrl-0 = <&qup_i2c11_default>;
Signature · 1 line
2.39.2