diff mbox series

[4/4] arm64: dts: rockchip: Enable Ethernet controller on Radxa E20C

Message ID 20250306221402.1704196-5-jonas@kwiboo.se (mailing list archive)
State New
Headers show
Series rockchip: Enable Ethernet controller on Radxa E20C | expand

Commit Message

Jonas Karlman March 6, 2025, 10:13 p.m. UTC
The Radxa E20C has two GbE ports, LAN and WAN. The LAN port is provided
using a GMAC controller and a YT8531C PHY and the WAN port is provided
by an RTL8111H PCIe Ethernet controller.

Enable support for the LAN port on Radxa E20C.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
 .../boot/dts/rockchip/rk3528-radxa-e20c.dts   | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)

Comments

Andrew Lunn March 6, 2025, 10:49 p.m. UTC | #1
> +&mdio1 {
> +	rgmii_phy: ethernet-phy@1 {
> +		compatible = "ethernet-phy-ieee802.3-c22";

The compatible is not needed. That is the default.

	Andrew
Jonas Karlman March 7, 2025, 9:16 a.m. UTC | #2
Hi Andrew,

On 2025-03-06 23:49, Andrew Lunn wrote:
>> +&mdio1 {
>> +	rgmii_phy: ethernet-phy@1 {
>> +		compatible = "ethernet-phy-ieee802.3-c22";
> 
> The compatible is not needed. That is the default.

Interesting, however I rather be explicit to not cause any issue for
U-Boot or any other user of the device trees beside Linux kernel.

Regards,
Jonas

> 
> 	Andrew
Andrew Lunn March 7, 2025, 1:25 p.m. UTC | #3
On Fri, Mar 07, 2025 at 10:16:08AM +0100, Jonas Karlman wrote:
> Hi Andrew,
> 
> On 2025-03-06 23:49, Andrew Lunn wrote:
> >> +&mdio1 {
> >> +	rgmii_phy: ethernet-phy@1 {
> >> +		compatible = "ethernet-phy-ieee802.3-c22";
> > 
> > The compatible is not needed. That is the default.
> 
> Interesting, however I rather be explicit to not cause any issue for
> U-Boot or any other user of the device trees beside Linux kernel.

O.K.  But any system using Linux .dts files should be happy with no
compatible, since that is how the majority are. Because PHYs have ID
registers, generally there is no need for a compatible. The only time
you do need a compatible is:

* The ID registers are wrong
* The ID registers cannot be read, chicken/egg problems the driver needs to solve
* The Clause 22 address space is not implemented and you need to indicate C45
  should be used to get the ID registers.

None of this is specific to Linux.

	Andrew
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/rockchip/rk3528-radxa-e20c.dts b/arch/arm64/boot/dts/rockchip/rk3528-radxa-e20c.dts
index a511e2a2d4a5..61ba0471095a 100644
--- a/arch/arm64/boot/dts/rockchip/rk3528-radxa-e20c.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3528-radxa-e20c.dts
@@ -16,6 +16,7 @@  / {
 	compatible = "radxa,e20c", "rockchip,rk3528";
 
 	aliases {
+		ethernet0 = &gmac1;
 		mmc0 = &sdhci;
 		mmc1 = &sdmmc;
 	};
@@ -123,7 +124,36 @@  vccio_sd: regulator-vccio-sd {
 	};
 };
 
+&gmac1 {
+	clock_in_out = "output";
+	phy-handle = <&rgmii_phy>;
+	phy-mode = "rgmii-id";
+	phy-supply = <&vcc_3v3>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&rgmii_miim>, <&rgmii_tx_bus2>, <&rgmii_rx_bus2>,
+		    <&rgmii_rgmii_clk>, <&rgmii_rgmii_bus>;
+	status = "okay";
+};
+
+&mdio1 {
+	rgmii_phy: ethernet-phy@1 {
+		compatible = "ethernet-phy-ieee802.3-c22";
+		reg = <0x1>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&gmac1_rstn_l>;
+		reset-assert-us = <20000>;
+		reset-deassert-us = <100000>;
+		reset-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_LOW>;
+	};
+};
+
 &pinctrl {
+	ethernet {
+		gmac1_rstn_l: gmac1-rstn-l {
+			rockchip,pins = <4 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+
 	gpio-keys {
 		user_key: user-key {
 			rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;