[linux-next-v2,2/5] arm64: dts: rockchip: Add support of external clock to ethernet node on Rock 3A SBC

Message ID 20221116200150.4657-3-linux.amoon@gmail.com
State New
Headers
Series [linux-next-v2,1/5] arm64: dts: rockchip: Fix gmac phy mode to rgmii on Rock 3A SBC. |

Commit Message

Anand Moon Nov. 16, 2022, 8:01 p.m. UTC
  Add support of external clock gmac1_clkin which is used as input clock
to ethernet node.

Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
V2: None
---
 arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
  

Comments

Michael Riesch Nov. 22, 2022, 11:18 a.m. UTC | #1
Hi Anand,

On 11/16/22 21:01, Anand Moon wrote:
> Add support of external clock gmac1_clkin which is used as input clock
> to ethernet node.

Indeed this operating mode is defined in the schematics, thanks for the fix.

> 
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>

Reviewed-by: Michael Riesch <michael.riesch@wolfvision.net>
Tested-by: Michael Riesch <michael.riesch@wolfvision.net>

Best regards,
Michael

> ---
> V2: None
> ---
>  arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts
> index e1c75532dcee..b848282ea005 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts
> +++ b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts
> @@ -32,6 +32,13 @@ hdmi_con_in: endpoint {
>  		};
>  	};
>  
> +	gmac1_clkin: external-gmac1-clock {
> +		compatible = "fixed-clock";
> +		clock-frequency = <125000000>;
> +		clock-output-names = "gmac1_clkin";
> +		#clock-cells = <0>;
> +	};
> +
>  	leds {
>  		compatible = "gpio-leds";
>  
> @@ -249,9 +256,8 @@ &cpu3 {
>  
>  &gmac1 {
>  	assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>;
> -	assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>;
> -	assigned-clock-rates = <0>, <125000000>;
> -	clock_in_out = "output";
> +	assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&gmac1_clkin>;
> +	clock_in_out = "input";
>  	phy-handle = <&rgmii_phy1>;
>  	phy-mode = "rgmii";
>  	pinctrl-names = "default";
> @@ -259,6 +265,7 @@ &gmac1 {
>  		     &gmac1m1_tx_bus2
>  		     &gmac1m1_rx_bus2
>  		     &gmac1m1_rgmii_clk
> +		     &gmac1m1_clkinout
>  		     &gmac1m1_rgmii_bus>;
>  
>  	tx_delay = <0x4f>;
  
Anand Moon Nov. 23, 2022, 1 p.m. UTC | #2
Hi Michael, Heiko

On Tue, 22 Nov 2022 at 16:48, Michael Riesch
<michael.riesch@wolfvision.net> wrote:
>
> Hi Anand,
>
> On 11/16/22 21:01, Anand Moon wrote:
> > Add support of external clock gmac1_clkin which is used as input clock
> > to ethernet node.
>
> Indeed this operating mode is defined in the schematics, thanks for the fix.
>
> >
> > Signed-off-by: Anand Moon <linux.amoon@gmail.com>
>
> Reviewed-by: Michael Riesch <michael.riesch@wolfvision.net>
> Tested-by: Michael Riesch <michael.riesch@wolfvision.net>
>

Actually, I wanted to drop these changes since looking into clk_summary
gmac1 CLK gets wrongly configured with PLL and the reference count is
not correct.

Plz do the patches, I will send the correct changes next version.

> Best regards,
> Michael
>
Thanks

-Anand
  
Heiko Stübner Nov. 23, 2022, 1:47 p.m. UTC | #3
Hi,

Am Mittwoch, 23. November 2022, 14:00:50 CET schrieb Anand Moon:
> Hi Michael, Heiko
> 
> On Tue, 22 Nov 2022 at 16:48, Michael Riesch
> <michael.riesch@wolfvision.net> wrote:
> >
> > Hi Anand,
> >
> > On 11/16/22 21:01, Anand Moon wrote:
> > > Add support of external clock gmac1_clkin which is used as input clock
> > > to ethernet node.
> >
> > Indeed this operating mode is defined in the schematics, thanks for the fix.
> >
> > >
> > > Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> >
> > Reviewed-by: Michael Riesch <michael.riesch@wolfvision.net>
> > Tested-by: Michael Riesch <michael.riesch@wolfvision.net>
> >
> 
> Actually, I wanted to drop these changes since looking into clk_summary
> gmac1 CLK gets wrongly configured with PLL and the reference count is
> not correct.
> 
> Plz do the patches, I will send the correct changes next version.

as you might've seen, I've applied this patch yesterday.

When doing patches also please always take into account, that devicetree
describes the hardware situation, not what the Linux-kernel does.

But assigned-clock* fixups in a next version are ok to do.

Thanks
Heiko
  

Patch

diff --git a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts
index e1c75532dcee..b848282ea005 100644
--- a/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts
@@ -32,6 +32,13 @@  hdmi_con_in: endpoint {
 		};
 	};
 
+	gmac1_clkin: external-gmac1-clock {
+		compatible = "fixed-clock";
+		clock-frequency = <125000000>;
+		clock-output-names = "gmac1_clkin";
+		#clock-cells = <0>;
+	};
+
 	leds {
 		compatible = "gpio-leds";
 
@@ -249,9 +256,8 @@  &cpu3 {
 
 &gmac1 {
 	assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>;
-	assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>;
-	assigned-clock-rates = <0>, <125000000>;
-	clock_in_out = "output";
+	assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&gmac1_clkin>;
+	clock_in_out = "input";
 	phy-handle = <&rgmii_phy1>;
 	phy-mode = "rgmii";
 	pinctrl-names = "default";
@@ -259,6 +265,7 @@  &gmac1 {
 		     &gmac1m1_tx_bus2
 		     &gmac1m1_rx_bus2
 		     &gmac1m1_rgmii_clk
+		     &gmac1m1_clkinout
 		     &gmac1m1_rgmii_bus>;
 
 	tx_delay = <0x4f>;