Skip to contentSkip to conversation

dts: stm32mp157c-odyssey: set PLL4_P to 125Mhz for ETH_CLK

PATCH In review Heesub Shin 2 participants 16 messages Apr 28, 2024 – Jun 14, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/5 dts: stm32mp157c-odyssey: set PLL4_P to 125Mhz for ETH_CLK

Odyssey board requires ETH_CLK of 125Mhz. This commit sets PLL4_P/Q/R to 125, 62.5 and 62.5Mhz in respectively.

---
 arch/arm/dts/stm32mp157c-odyssey-som-u-boot.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/dts/stm32mp157c-odyssey-som-u-boot.dtsi +2 -2
index b780dbd95e..d07fdcf4bc 100644
@@ -115,11 +115,11 @@
 		bootph-all;
 	};
 
-	/* VCO = 594.0 MHz => P = 99, Q = 74, R = 74 */
+	/* VCO = 750.0 MHz => P = 125, Q = 62.5, R = 62.5 */
 	pll4: st,pll@3 {
 		compatible = "st,stm32mp1-pll";
 		reg = <3>;
-		cfg = < 3 98 5 7 7 PQR(1,1,1) >;
+		cfg = < 3 124 5 9 9 PQR(1,1,1) >;
 		bootph-all;
 	};
 };
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/5 dts: stm32mp157c-odyssey: use internal clock for Tx

In Odyssey board, we should use the internal clock from RCC as the transmit clock, instead of the external clock from ETH_CLK125 pad. This commit adds a property, st,eth-clk-sel, so that the ETH_CLK_SEL mux selects ETH_CLK.

---
 arch/arm/dts/stm32mp157c-odyssey.dts | 1 +
 1 file changed, 1 insertion(+)
arch/arm/dts/stm32mp157c-odyssey.dts +1 -0
index 17bcf56f74..53ba018197 100644
@@ -75,6 +75,7 @@
 	phy-mode = "rgmii-id";
 	max-speed = <1000>;
 	phy-handle = <&phy0>;
+	st,ext-phyclk;
 
 	mdio0 {
 		#address-cells = <1>;
Signature · 1 line
2.34.1
#4 lore raw

PATCH 3/5 dts: stm32mp157c-odyssey: fix incorrect PHY address

In reply to Heesub Shin

In Odyssey board, KSZ9031 is at the PHY address 0x7, not 0x0. This commit fixes it.

---
 arch/arm/dts/stm32mp157c-odyssey.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/dts/stm32mp157c-odyssey.dts +2 -2
index 53ba018197..b6210cf8b2 100644
@@ -81,8 +81,8 @@
 		#address-cells = <1>;
 		#size-cells = <0>;
 		compatible = "snps,dwmac-mdio";
-		phy0: ethernet-phy@0 {
-			reg = <0>;
+		phy0: ethernet-phy@7 {
+			reg = <7>;
 		};
 	};
 };
Signature · 1 line
2.34.1
#8 lore raw

PATCH 4/5 net: dwc_eth_qos: add support for phy-reset-gpios property

In reply to Heesub Shin

This commit adds support for a property 'phy-reset-gpios' to reset PHY chipset.

---
 drivers/net/dwc_eth_qos_stm32.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
drivers/net/dwc_eth_qos_stm32.c +22 -1
index fbc08bba1d..cffaa10b70 100644
@@ -266,6 +266,12 @@ static int eqos_probe_resources_stm32(struct udevice *dev)
 	if (ret)
 		dev_warn(dev, "No phy clock provided %d\n", ret);
 
+	/* Get reset gpio pin (optional) */
+	ret = gpio_request_by_name(dev, "phy-reset-gpios", 0,
+				   &eqos->phy_reset_gpio, GPIOD_IS_OUT);
+	if (ret)
+		pr_warn("No phy reset gpio provided: %d\n", ret);
+
 	dev_dbg(dev, "%s: OK\n", __func__);
 
 	return 0;
@@ -277,6 +283,21 @@ err_probe:
 	return ret;
 }
 
+static int eqos_start_resets_stm32(struct udevice *dev)
+{
+	struct eqos_priv *eqos = dev_get_priv(dev);
+
+	debug("%s(dev=%p):\n", __func__, dev);
+
+	if (dm_gpio_is_valid(&eqos->phy_reset_gpio)) {
+		dm_gpio_set_value(&eqos->phy_reset_gpio, 1);
+		udelay(2);
+		dm_gpio_set_value(&eqos->phy_reset_gpio, 0);
+	}
+
+	return 0;
+}
+
 static int eqos_remove_resources_stm32(struct udevice *dev)
 {
 	dev_dbg(dev, "%s:\n", __func__);
@@ -292,7 +313,7 @@ static struct eqos_ops eqos_stm32_ops = {
 	.eqos_probe_resources = eqos_probe_resources_stm32,
 	.eqos_remove_resources = eqos_remove_resources_stm32,
 	.eqos_stop_resets = eqos_null_ops,
-	.eqos_start_resets = eqos_null_ops,
+	.eqos_start_resets = eqos_start_resets_stm32,
 	.eqos_stop_clks = eqos_stop_clks_stm32,
 	.eqos_start_clks = eqos_start_clks_stm32,
 	.eqos_calibrate_pads = eqos_null_ops,
Signature · 1 line
2.34.1
#11 lore raw

PATCH 5/5 dts: stm32mp157c-odyssey: add phy-reset-gpios property to ethernet node

In reply to Heesub Shin

In Odyssey board, we should reset the PHY chipset, toggling G0 pin.

---
 arch/arm/dts/stm32mp157c-odyssey.dts | 1 +
 1 file changed, 1 insertion(+)
arch/arm/dts/stm32mp157c-odyssey.dts +1 -0
index b6210cf8b2..4cc5e07683 100644
@@ -75,6 +75,7 @@
 	phy-mode = "rgmii-id";
 	max-speed = <1000>;
 	phy-handle = <&phy0>;
+	phy-reset-gpios = <&gpiog 0 GPIO_ACTIVE_LOW>;
 	st,ext-phyclk;
 
 	mdio0 {
Signature · 1 line
2.34.1
Reviewed-by on v1 1/5
#14 lore raw
In reply to Heesub Shin
Quoted 16 lines · Heesub Shin

Odyssey board requires ETH_CLK of 125Mhz. This commit sets PLL4_P/Q/R to 125, 62.5 and 62.5Mhz in respectively.

---
 arch/arm/dts/stm32mp157c-odyssey-som-u-boot.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/dts/stm32mp157c-odyssey-som-u-boot.dtsi +0 -0
index b780dbd95e..d07fdcf4bc 100644
@@ -115,11 +115,11 @@
 		bootph-all;
 	};
 

arch/arm/dts/stm32mp157c-odyssey-som-u-boot.dtsi line 125

Quoted 10 lines
arch/arm/dts/stm32mp157c-odyssey-som-u-boot.dtsi +2 -2
-	/* VCO = 594.0 MHz => P = 99, Q = 74, R = 74 */
+	/* VCO = 750.0 MHz => P = 125, Q = 62.5, R = 62.5 */
 	pll4: st,pll@3 {
 		compatible = "st,stm32mp1-pll";
 		reg = <3>;
-		cfg = < 3 98 5 7 7 PQR(1,1,1) >;
+		cfg = < 3 124 5 9 9 PQR(1,1,1) >;
 		bootph-all;
 	};
 };

Thanks
Patrice

Reviewed-by on v1 2/5
#2 lore raw

Re: [PATCH 2/5] dts: stm32mp157c-odyssey: use internal clock for Tx

In reply to Heesub Shin
Quoted 15 lines · Heesub Shin

In Odyssey board, we should use the internal clock from RCC as the transmit clock, instead of the external clock from ETH_CLK125 pad. This commit adds a property, st,eth-clk-sel, so that the ETH_CLK_SEL mux selects ETH_CLK.

---
 arch/arm/dts/stm32mp157c-odyssey.dts | 1 +
 1 file changed, 1 insertion(+)
arch/arm/dts/stm32mp157c-odyssey.dts +0 -0
index 17bcf56f74..53ba018197 100644

arch/arm/dts/stm32mp157c-odyssey.dts line 81

Quoted 7 lines
arch/arm/dts/stm32mp157c-odyssey.dts +1 -0
@@ -75,6 +75,7 @@
 	phy-mode = "rgmii-id";
 	max-speed = <1000>;
 	phy-handle = <&phy0>;
+	st,ext-phyclk;
 
 	mdio0 {
 		#address-cells = <1>;

Thanks
Patrice

Reviewed-by on v1 3/5
#5 lore raw

Re: [PATCH 3/5] dts: stm32mp157c-odyssey: fix incorrect PHY address

In reply to Heesub Shin
Quoted 13 lines · Heesub Shin

In Odyssey board, KSZ9031 is at the PHY address 0x7, not 0x0. This commit fixes it.

---
 arch/arm/dts/stm32mp157c-odyssey.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/dts/stm32mp157c-odyssey.dts +0 -0
index 53ba018197..b6210cf8b2 100644

arch/arm/dts/stm32mp157c-odyssey.dts line 88

Quoted 10 lines
arch/arm/dts/stm32mp157c-odyssey.dts +2 -2
@@ -81,8 +81,8 @@
 		#address-cells = <1>;
 		#size-cells = <0>;
 		compatible = "snps,dwmac-mdio";
-		phy0: ethernet-phy@0 {
-			reg = <0>;
+		phy0: ethernet-phy@7 {
+			reg = <7>;
 		};
 	};
 };

Thanks
Patrice

Reviewed-by on v1 4/5
#9 lore raw

Re: [PATCH 4/5] net: dwc_eth_qos: add support for phy-reset-gpios property

In reply to Heesub Shin
Quoted 48 lines · Heesub Shin

This commit adds support for a property 'phy-reset-gpios' to reset PHY chipset.

---
 drivers/net/dwc_eth_qos_stm32.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
drivers/net/dwc_eth_qos_stm32.c +21 -0
index fbc08bba1d..cffaa10b70 100644
@@ -266,6 +266,12 @@ static int eqos_probe_resources_stm32(struct udevice *dev)
 	if (ret)
 		dev_warn(dev, "No phy clock provided %d\n", ret);
 
+	/* Get reset gpio pin (optional) */
+	ret = gpio_request_by_name(dev, "phy-reset-gpios", 0,
+				   &eqos->phy_reset_gpio, GPIOD_IS_OUT);
+	if (ret)
+		pr_warn("No phy reset gpio provided: %d\n", ret);
+
 	dev_dbg(dev, "%s: OK\n", __func__);
 
 	return 0;
@@ -277,6 +283,21 @@ err_probe:
 	return ret;
 }
 
+static int eqos_start_resets_stm32(struct udevice *dev)
+{
+	struct eqos_priv *eqos = dev_get_priv(dev);
+
+	debug("%s(dev=%p):\n", __func__, dev);
+
+	if (dm_gpio_is_valid(&eqos->phy_reset_gpio)) {
+		dm_gpio_set_value(&eqos->phy_reset_gpio, 1);
+		udelay(2);
+		dm_gpio_set_value(&eqos->phy_reset_gpio, 0);
+	}
+
+	return 0;
+}
+
 static int eqos_remove_resources_stm32(struct udevice *dev)
 {
 	dev_dbg(dev, "%s:\n", __func__);

drivers/net/dwc_eth_qos_stm32.c static struct eqos_ops eqos_stm32_ops = { · line 319

Quoted 8 lines
drivers/net/dwc_eth_qos_stm32.c +1 -1
@@ -292,7 +313,7 @@ static struct eqos_ops eqos_stm32_ops = {
 	.eqos_probe_resources = eqos_probe_resources_stm32,
 	.eqos_remove_resources = eqos_remove_resources_stm32,
 	.eqos_stop_resets = eqos_null_ops,
-	.eqos_start_resets = eqos_null_ops,
+	.eqos_start_resets = eqos_start_resets_stm32,
 	.eqos_stop_clks = eqos_stop_clks_stm32,
 	.eqos_start_clks = eqos_start_clks_stm32,
 	.eqos_calibrate_pads = eqos_null_ops,

Thanks
Patrice

Reviewed-by on v1 5/5
#12 lore raw

Re: [PATCH 5/5] dts: stm32mp157c-odyssey: add phy-reset-gpios property to ethernet node

In reply to Heesub Shin
Quoted 12 lines · Heesub Shin

In Odyssey board, we should reset the PHY chipset, toggling G0 pin.

---
 arch/arm/dts/stm32mp157c-odyssey.dts | 1 +
 1 file changed, 1 insertion(+)
arch/arm/dts/stm32mp157c-odyssey.dts +0 -0
index b6210cf8b2..4cc5e07683 100644

arch/arm/dts/stm32mp157c-odyssey.dts line 81

Quoted 7 lines
arch/arm/dts/stm32mp157c-odyssey.dts +1 -0
@@ -75,6 +75,7 @@
 	phy-mode = "rgmii-id";
 	max-speed = <1000>;
 	phy-handle = <&phy0>;
+	phy-reset-gpios = <&gpiog 0 GPIO_ACTIVE_LOW>;
 	st,ext-phyclk;
 
 	mdio0 {

Thanks
Patrice

#15 lore raw
In reply to Heesub Shin
Quoted 16 lines · Heesub Shin

Odyssey board requires ETH_CLK of 125Mhz. This commit sets PLL4_P/Q/R to 125, 62.5 and 62.5Mhz in respectively.

---
 arch/arm/dts/stm32mp157c-odyssey-som-u-boot.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/dts/stm32mp157c-odyssey-som-u-boot.dtsi +0 -0
index b780dbd95e..d07fdcf4bc 100644
@@ -115,11 +115,11 @@
 		bootph-all;
 	};
 

arch/arm/dts/stm32mp157c-odyssey-som-u-boot.dtsi line 125

Quoted 10 lines
arch/arm/dts/stm32mp157c-odyssey-som-u-boot.dtsi +2 -2
-	/* VCO = 594.0 MHz => P = 99, Q = 74, R = 74 */
+	/* VCO = 750.0 MHz => P = 125, Q = 62.5, R = 62.5 */
 	pll4: st,pll@3 {
 		compatible = "st,stm32mp1-pll";
 		reg = <3>;
-		cfg = < 3 98 5 7 7 PQR(1,1,1) >;
+		cfg = < 3 124 5 9 9 PQR(1,1,1) >;
 		bootph-all;
 	};
 };

Applied to u-boot-stm32/next

Thanks
Patrice

#3 lore raw

Re: [PATCH 2/5] dts: stm32mp157c-odyssey: use internal clock for Tx

In reply to Patrice CHOTARD
Quoted 23 lines · Patrice CHOTARD
Quoted 20 lines · Heesub Shin

In Odyssey board, we should use the internal clock from RCC as the transmit clock, instead of the external clock from ETH_CLK125 pad. This commit adds a property, st,eth-clk-sel, so that the ETH_CLK_SEL mux selects ETH_CLK.

---
 arch/arm/dts/stm32mp157c-odyssey.dts | 1 +
 1 file changed, 1 insertion(+)
arch/arm/dts/stm32mp157c-odyssey.dts +1 -0
index 17bcf56f74..53ba018197 100644
@@ -75,6 +75,7 @@
 	phy-mode = "rgmii-id";
 	max-speed = <1000>;
 	phy-handle = <&phy0>;
+	st,ext-phyclk;
 
Quoted 7 lines

arch/arm/dts/stm32mp157c-odyssey.dts line 81

Quoted 2 lines
arch/arm/dts/stm32mp157c-odyssey.dts +0 -0
 	mdio0 {
 		#address-cells = <1>;

Thanks
Patrice

Applied to u-boot-stm32/next

Thanks
Patrice

#6 lore raw

Re: [PATCH 3/5] dts: stm32mp157c-odyssey: fix incorrect PHY address

In reply to Heesub Shin
Quoted 13 lines · Heesub Shin

In Odyssey board, KSZ9031 is at the PHY address 0x7, not 0x0. This commit fixes it.

---
 arch/arm/dts/stm32mp157c-odyssey.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/dts/stm32mp157c-odyssey.dts +0 -0
index 53ba018197..b6210cf8b2 100644

arch/arm/dts/stm32mp157c-odyssey.dts line 88

Quoted 10 lines
arch/arm/dts/stm32mp157c-odyssey.dts +2 -2
@@ -81,8 +81,8 @@
 		#address-cells = <1>;
 		#size-cells = <0>;
 		compatible = "snps,dwmac-mdio";
-		phy0: ethernet-phy@0 {
-			reg = <0>;
+		phy0: ethernet-phy@7 {
+			reg = <7>;
 		};
 	};
 };

Applied to u-boot-stm32/next

Thanks
Patrice

#10 lore raw

Re: [PATCH 4/5] net: dwc_eth_qos: add support for phy-reset-gpios property

In reply to Heesub Shin
Quoted 48 lines · Heesub Shin

This commit adds support for a property 'phy-reset-gpios' to reset PHY chipset.

---
 drivers/net/dwc_eth_qos_stm32.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
drivers/net/dwc_eth_qos_stm32.c +21 -0
index fbc08bba1d..cffaa10b70 100644
@@ -266,6 +266,12 @@ static int eqos_probe_resources_stm32(struct udevice *dev)
 	if (ret)
 		dev_warn(dev, "No phy clock provided %d\n", ret);
 
+	/* Get reset gpio pin (optional) */
+	ret = gpio_request_by_name(dev, "phy-reset-gpios", 0,
+				   &eqos->phy_reset_gpio, GPIOD_IS_OUT);
+	if (ret)
+		pr_warn("No phy reset gpio provided: %d\n", ret);
+
 	dev_dbg(dev, "%s: OK\n", __func__);
 
 	return 0;
@@ -277,6 +283,21 @@ err_probe:
 	return ret;
 }
 
+static int eqos_start_resets_stm32(struct udevice *dev)
+{
+	struct eqos_priv *eqos = dev_get_priv(dev);
+
+	debug("%s(dev=%p):\n", __func__, dev);
+
+	if (dm_gpio_is_valid(&eqos->phy_reset_gpio)) {
+		dm_gpio_set_value(&eqos->phy_reset_gpio, 1);
+		udelay(2);
+		dm_gpio_set_value(&eqos->phy_reset_gpio, 0);
+	}
+
+	return 0;
+}
+
 static int eqos_remove_resources_stm32(struct udevice *dev)
 {
 	dev_dbg(dev, "%s:\n", __func__);

drivers/net/dwc_eth_qos_stm32.c static struct eqos_ops eqos_stm32_ops = { · line 319

Quoted 8 lines
drivers/net/dwc_eth_qos_stm32.c +1 -1
@@ -292,7 +313,7 @@ static struct eqos_ops eqos_stm32_ops = {
 	.eqos_probe_resources = eqos_probe_resources_stm32,
 	.eqos_remove_resources = eqos_remove_resources_stm32,
 	.eqos_stop_resets = eqos_null_ops,
-	.eqos_start_resets = eqos_null_ops,
+	.eqos_start_resets = eqos_start_resets_stm32,
 	.eqos_stop_clks = eqos_stop_clks_stm32,
 	.eqos_start_clks = eqos_start_clks_stm32,
 	.eqos_calibrate_pads = eqos_null_ops,

Applied to u-boot-stm32/next

Thanks
Patrice

#13 lore raw

Re: [PATCH 5/5] dts: stm32mp157c-odyssey: add phy-reset-gpios property to ethernet node

In reply to Heesub Shin
Quoted 12 lines · Heesub Shin

In Odyssey board, we should reset the PHY chipset, toggling G0 pin.

---
 arch/arm/dts/stm32mp157c-odyssey.dts | 1 +
 1 file changed, 1 insertion(+)
arch/arm/dts/stm32mp157c-odyssey.dts +0 -0
index b6210cf8b2..4cc5e07683 100644

arch/arm/dts/stm32mp157c-odyssey.dts line 81

Quoted 7 lines
arch/arm/dts/stm32mp157c-odyssey.dts +1 -0
@@ -75,6 +75,7 @@
 	phy-mode = "rgmii-id";
 	max-speed = <1000>;
 	phy-handle = <&phy0>;
+	phy-reset-gpios = <&gpiog 0 GPIO_ACTIVE_LOW>;
 	st,ext-phyclk;
 
 	mdio0 {

Applied to u-boot-stm32/next

Thanks
Patrice

#7 lore raw

Re: [PATCH 3/5] dts: stm32mp157c-odyssey: fix incorrect PHY address

In reply to Heesub Shin
Quoted 13 lines · Heesub Shin

In Odyssey board, KSZ9031 is at the PHY address 0x7, not 0x0. This commit fixes it.

---
 arch/arm/dts/stm32mp157c-odyssey.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/dts/stm32mp157c-odyssey.dts +0 -0
index 53ba018197..b6210cf8b2 100644

arch/arm/dts/stm32mp157c-odyssey.dts line 88

Quoted 10 lines
arch/arm/dts/stm32mp157c-odyssey.dts +2 -2
@@ -81,8 +81,8 @@
 		#address-cells = <1>;
 		#size-cells = <0>;
 		compatible = "snps,dwmac-mdio";
-		phy0: ethernet-phy@0 {
-			reg = <0>;
+		phy0: ethernet-phy@7 {
+			reg = <7>;
 		};
 	};
 };

Applied to u-boot-stm32/next

Thanks
Patrice