Skip to content

Commit 0dd532e

Browse files
committed
Merge branch 'rockchip-internal-phy'
David Wu says: ==================== rockchip: Add the integrated PHY support The rk3228 and rk3328 support integrated PHY inside, let's enable it to work. And the integrated PHY need to do some special setting, so register the rockchip integrated PHY driver. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents d24d39d + 4b05bc6 commit 0dd532e

File tree

10 files changed

+466
-10
lines changed

10 files changed

+466
-10
lines changed

Documentation/devicetree/bindings/net/phy.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ Optional Properties:
5252
Mark the corresponding energy efficient ethernet mode as broken and
5353
request the ethernet to stop advertising it.
5454

55+
- phy-is-integrated: If set, indicates that the PHY is integrated into the same
56+
physical package as the Ethernet MAC. If needed, muxers should be configured
57+
to ensure the integrated PHY is used. The absence of this property indicates
58+
the muxers should be configured so that the external PHY is used.
59+
5560
Example:
5661

5762
ethernet-phy@0 {

arch/arm/boot/dts/rk3228-evb.dts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@
5050
device_type = "memory";
5151
reg = <0x60000000 0x40000000>;
5252
};
53+
54+
vcc_phy: vcc-phy-regulator {
55+
compatible = "regulator-fixed";
56+
enable-active-high;
57+
regulator-name = "vcc_phy";
58+
regulator-min-microvolt = <1800000>;
59+
regulator-max-microvolt = <1800000>;
60+
regulator-always-on;
61+
regulator-boot-on;
62+
};
5363
};
5464

5565
&emmc {
@@ -60,6 +70,30 @@
6070
status = "okay";
6171
};
6272

73+
&gmac {
74+
assigned-clocks = <&cru SCLK_MAC_SRC>;
75+
assigned-clock-rates = <50000000>;
76+
clock_in_out = "output";
77+
phy-supply = <&vcc_phy>;
78+
phy-mode = "rmii";
79+
phy-handle = <&phy0>;
80+
status = "okay";
81+
82+
mdio {
83+
compatible = "snps,dwmac-mdio";
84+
#address-cells = <1>;
85+
#size-cells = <0>;
86+
87+
phy@0 {
88+
compatible = "ethernet-phy-id1234.d400", "ethernet-phy-ieee802.3-c22";
89+
reg = <0>;
90+
clocks = <&cru SCLK_MAC_PHY>;
91+
resets = <&cru SRST_MACPHY>;
92+
phy-is-integrated;
93+
};
94+
};
95+
};
96+
6397
&tsadc {
6498
status = "okay";
6599

arch/arm/configs/multi_v7_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ CONFIG_ICPLUS_PHY=y
270270
CONFIG_REALTEK_PHY=y
271271
CONFIG_MICREL_PHY=y
272272
CONFIG_FIXED_PHY=y
273+
CONFIG_ROCKCHIP_PHY=y
273274
CONFIG_USB_PEGASUS=y
274275
CONFIG_USB_RTL8152=m
275276
CONFIG_USB_USBNET=y

arch/arm64/boot/dts/rockchip/rk3328-evb.dts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,23 @@
5050
chosen {
5151
stdout-path = "serial2:1500000n8";
5252
};
53+
54+
vcc_phy: vcc-phy-regulator {
55+
compatible = "regulator-fixed";
56+
regulator-name = "vcc_phy";
57+
regulator-always-on;
58+
regulator-boot-on;
59+
};
60+
};
61+
62+
&gmac2phy {
63+
phy-supply = <&vcc_phy>;
64+
clock_in_out = "output";
65+
assigned-clocks = <&cru SCLK_MAC2PHY_SRC>;
66+
assigned-clock-rate = <50000000>;
67+
assigned-clocks = <&cru SCLK_MAC2PHY>;
68+
assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>;
69+
status = "okay";
5370
};
5471

5572
&uart2 {

arch/arm64/boot/dts/rockchip/rk3328.dtsi

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
i2c1 = &i2c1;
6464
i2c2 = &i2c2;
6565
i2c3 = &i2c3;
66+
ethernet0 = &gmac2io;
67+
ethernet1 = &gmac2phy;
6668
};
6769

6870
cpus {
@@ -424,6 +426,43 @@
424426
status = "disabled";
425427
};
426428

429+
gmac2phy: ethernet@ff550000 {
430+
compatible = "rockchip,rk3328-gmac";
431+
reg = <0x0 0xff550000 0x0 0x10000>;
432+
rockchip,grf = <&grf>;
433+
interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
434+
interrupt-names = "macirq";
435+
clocks = <&cru SCLK_MAC2PHY_SRC>, <&cru SCLK_MAC2PHY_RXTX>,
436+
<&cru SCLK_MAC2PHY_RXTX>, <&cru SCLK_MAC2PHY_REF>,
437+
<&cru ACLK_MAC2PHY>, <&cru PCLK_MAC2PHY>,
438+
<&cru SCLK_MAC2PHY_OUT>;
439+
clock-names = "stmmaceth", "mac_clk_rx",
440+
"mac_clk_tx", "clk_mac_ref",
441+
"aclk_mac", "pclk_mac",
442+
"clk_macphy";
443+
resets = <&cru SRST_GMAC2PHY_A>, <&cru SRST_MACPHY>;
444+
reset-names = "stmmaceth", "mac-phy";
445+
phy-mode = "rmii";
446+
phy-handle = <&phy>;
447+
status = "disabled";
448+
449+
mdio {
450+
compatible = "snps,dwmac-mdio";
451+
#address-cells = <1>;
452+
#size-cells = <0>;
453+
454+
phy: phy@0 {
455+
compatible = "ethernet-phy-id1234.d400", "ethernet-phy-ieee802.3-c22";
456+
reg = <0>;
457+
clocks = <&cru SCLK_MAC2PHY_OUT>;
458+
resets = <&cru SRST_MACPHY>;
459+
pinctrl-names = "default";
460+
pinctrl-0 = <&fephyled_rxm1 &fephyled_linkm1>;
461+
phy-is-integrated;
462+
};
463+
};
464+
};
465+
427466
gic: interrupt-controller@ff811000 {
428467
compatible = "arm,gic-400";
429468
#interrupt-cells = <3>;

arch/arm64/configs/defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ CONFIG_MARVELL_PHY=m
203203
CONFIG_MESON_GXL_PHY=m
204204
CONFIG_MICREL_PHY=y
205205
CONFIG_REALTEK_PHY=m
206+
CONFIG_ROCKCHIP_PHY=y
206207
CONFIG_USB_PEGASUS=m
207208
CONFIG_USB_RTL8150=m
208209
CONFIG_USB_RTL8152=m

0 commit comments

Comments
 (0)