Add the internal phy support
Subsystems (8)
v4 cover Add the internal phy support
The rk3228 and rk3328 support internal phy inside, let's enable it to work. And the internal phy need to do some special setting, so register the rockchip internal phy driver.
David Wu (12):
net: phy: Add rockchip phy driver support
multi_v7_defconfig: Make rockchip phy built-in
arm64: defconfig: Enable CONFIG_ROCKCHIP_PHY
net: stmmac: dwmac-rk: Remove unwanted code for rk3328_set_to_rmii()
Documentation: net: phy: Add phy-is-internal binding
net: stmmac: dwmac-rk: Add internal phy support
net: stmmac: dwmac-rk: Add internal phy support for rk3228
net: stmmac: dwmac-rk: Add internal phy supprot for rk3328
ARM: dts: rk322x: Add support internal phy for gmac
ARM: dts: rk3228-evb: Enable the internal phy for gmac
ARM64: dts: rockchip: Add gmac2phy node support for rk3328
ARM64: dts: rockchip: Enable gmac2phy for rk3328-evb
Documentation/devicetree/bindings/net/phy.txt | 3 + .../devicetree/bindings/net/rockchip-dwmac.txt | 4 +- arch/arm/boot/dts/rk3228-evb.dts | 32 +++ arch/arm/boot/dts/rk322x.dtsi | 8 +- arch/arm/configs/multi_v7_defconfig | 1 + arch/arm64/boot/dts/rockchip/rk3328-evb.dts | 17 ++ arch/arm64/boot/dts/rockchip/rk3328.dtsi | 37 ++++ arch/arm64/configs/defconfig | 1 + drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 129 +++++++++++- drivers/net/phy/Kconfig | 5 + drivers/net/phy/Makefile | 1 + drivers/net/phy/rockchip.c | 233 +++++++++++++++++++++ 12 files changed, 460 insertions(+), 11 deletions(-) create mode 100644 drivers/net/phy/rockchip.c
Signature · 1 line
1.9.1
PATCH v4 1/12 net: phy: Add rockchip phy driver support
Support internal ethernet phy currently.
---
changes in v4:
- Remove SUPPORTED_[Asym_]Pause flag
- Some minor fix like defines
drivers/net/phy/Kconfig | 5 + drivers/net/phy/Makefile | 1 + drivers/net/phy/rockchip.c | 233 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 239 insertions(+) create mode 100644 drivers/net/phy/rockchip.c
drivers/net/phy/Kconfig +5 -0
@@ -334,6 +334,11 @@ config REALTEK_PHY ---help--- Supports the Realtek 821x PHY. +config ROCKCHIP_PHY + tristate "Driver for Rockchip Ethernet PHYs" + ---help--- + Currently supports the internal Ethernet PHY. + config SMSC_PHY tristate "SMSC PHYs" ---help---
drivers/net/phy/Makefile +1 -0
@@ -66,6 +66,7 @@ obj-$(CONFIG_MICROSEMI_PHY) += mscc.o obj-$(CONFIG_NATIONAL_PHY) += national.o obj-$(CONFIG_QSEMI_PHY) += qsemi.o obj-$(CONFIG_REALTEK_PHY) += realtek.o +obj-$(CONFIG_ROCKCHIP_PHY) += rockchip.o obj-$(CONFIG_SMSC_PHY) += smsc.o obj-$(CONFIG_STE10XP) += ste10Xp.o obj-$(CONFIG_TERANETICS_PHY) += teranetics.o
drivers/net/phy/rockchip.c new file +233 -0
233 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 3/12 arm64: defconfig: Enable CONFIG_ROCKCHIP_PHY
In reply to David WuMake the rockchip phy driver built into the kernel.
--- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
@@ -203,6 +203,7 @@ CONFIG_MARVELL_PHY=m CONFIG_MESON_GXL_PHY=m CONFIG_MICREL_PHY=y CONFIG_REALTEK_PHY=m +CONFIG_ROCKCHIP_PHY=y CONFIG_USB_PEGASUS=m CONFIG_USB_RTL8150=m CONFIG_USB_RTL8152=m
Signature · 1 line
1.9.1
PATCH v4 4/12 net: stmmac: dwmac-rk: Remove unwanted code for rk3328_set_to_rmii()
In reply to David WuThis is wrong setting for rk3328_set_to_rmii(), so remove it.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +0 -3
@@ -365,9 +365,6 @@ static void rk3328_set_to_rmii(struct rk_priv_data *bsp_priv)regmap_write (bsp_priv->grf,RK3328_GRF_MAC_CON1 ,RK3328_GMAC_PHY_INTF_SEL_RMII |RK3328_GMAC_RMII_MODE ); - -/* set MAC to RMII mode */ -regmap_write (bsp_priv->grf,RK3328_GRF_MAC_CON1 ,GRF_BIT (11 )); }static void rk3328_set_rgmii_speed (struct rk_priv_data *bsp_priv,int speed)
Signature · 1 line
1.9.1
PATCH v4 2/12 multi_v7_defconfig: Make rockchip phy built-in
In reply to David WuEnable the rockchip phy for multi_v7_defconfig builds.
--- arch/arm/configs/multi_v7_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/multi_v7_defconfig +1 -0
@@ -270,6 +270,7 @@ CONFIG_ICPLUS_PHY=y CONFIG_REALTEK_PHY=y CONFIG_MICREL_PHY=y CONFIG_FIXED_PHY=y +CONFIG_ROCKCHIP_PHY=y CONFIG_USB_PEGASUS=y CONFIG_USB_RTL8152=m CONFIG_USB_USBNET=y
Signature · 1 line
1.9.1
PATCH v4 5/12 Documentation: net: phy: Add phy-is-internal binding
In reply to David WuAdd the documentation for internal phy. A boolean property indicates that a internal phy will be used.
--- Documentation/devicetree/bindings/net/phy.txt | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/net/phy.txt +3 -0
@@ -52,6 +52,9 @@ Optional Properties: Mark the corresponding energy efficient ethernet mode as broken and request the ethernet to stop advertising it. +- phy-is-internal: If set, indicates that phy will connect to the MAC as a + internal phy. + Example: ethernet-phy@0 {
Signature · 1 line
1.9.1
PATCH v4 6/12 net: stmmac: dwmac-rk: Add internal phy support
In reply to David WuTo make internal phy work, need to configure the phy_clock, phy cru_reset and related registers.
---
change in v4:
- PHY is internal or not base on the phy-is-internal property via phy node.
.../devicetree/bindings/net/rockchip-dwmac.txt | 4 +- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 88 ++++++++++++++++++++++ 2 files changed, 91 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/rockchip-dwmac.txt +3 -1
@@ -25,7 +25,8 @@ Required properties: - clock-names: One name for each entry in the clocks property. - phy-mode: See ethernet.txt file in the same directory. - pinctrl-names: Names corresponding to the numbered pinctrl states. - - pinctrl-0: pin-control mode. can be <&rgmii_pins> or <&rmii_pins>. + - pinctrl-0: pin-control mode. can be <&rgmii_pins>, <&rmii_pins> or led pins + for internal phy mode. - clock_in_out: For RGMII, it must be "input", means main clock(125MHz) is not sourced from SoC's PLL, but input from PHY; For RMII, "input" means PHY provides the reference clock(50MHz), "output" means GMAC provides the
@@ -40,6 +41,7 @@ Optional properties: - tx_delay: Delay value for TXD timing. Range value is 0~0x7F, 0x30 as default. - rx_delay: Delay value for RXD timing. Range value is 0~0x7F, 0x10 as default. - phy-supply: phandle to a regulator if the PHY needs one + - clocks: <&cru MAC_PHY>: Clock selector for internal macphy Example:
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +88 -0
154 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 7/12 net: stmmac: dwmac-rk: Add internal phy support for rk3228
In reply to David WuThere is only one mac controller in rk3228, which could connect to external phy or internal phy, use the grf_com_mux bit15 to route external/internal phy.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +12 -0
@@ -86,6 +86,8 @@ struct rk_priv_data {#define RK3228_GRF_MAC_CON0 0x0900#define RK3228_GRF_MAC_CON1 0x0904 +#define RK3228_GRF_CON_MUX 0x50 +/* RK3228_GRF_MAC_CON0 */ #define RK3228_GMAC_CLK_RX_DL_CFG (val) HIWORD_UPDATE(val, 0x7F, 7)#define RK3228_GMAC_CLK_TX_DL_CFG (val) HIWORD_UPDATE(val, 0x7F, 0)
@@ -111,6 +113,9 @@ struct rk_priv_data {#define RK3228_GMAC_RXCLK_DLY_ENABLE GRF_BIT(1)#define RK3228_GMAC_RXCLK_DLY_DISABLE GRF_CLR_BIT(1) +/* RK3228_GRF_COM_MUX */ +#define RK3228_GRF_CON_MUX_GMAC_INTERNAL_PHY GRF_BIT(15) +static void rk3228_set_to_rgmii (struct rk_priv_data *bsp_priv,int tx_delay,int rx_delay) {
@@ -191,11 +196,18 @@ static void rk3228_set_rmii_speed(struct rk_priv_data *bsp_priv, int speed)dev_err (dev,"unknown speed value for RMII! speed=%d" , speed); } +static void rk3228_internal_phy_powerup (struct rk_priv_data *priv) +{ +regmap_write (priv->grf,RK3228_GRF_CON_MUX , +RK3228_GRF_CON_MUX_GMAC_INTERNAL_PHY ); +} +static const struct rk_gmac_ops rk3228_ops = { .set_to_rgmii = rk3228_set_to_rgmii, .set_to_rmii = rk3228_set_to_rmii, .set_rgmii_speed = rk3228_set_rgmii_speed, .set_rmii_speed = rk3228_set_rmii_speed, + .internal_phy_powerup = rk3228_internal_phy_powerup, };#define RK3288_GRF_SOC_CON1 0x0248
Signature · 1 line
1.9.1
PATCH v4 8/12 net: stmmac: dwmac-rk: Add internal phy supprot for rk3328
In reply to David WuThere are two mac controllers in the rk3328, the one connects to external phy, and the other one connects to internal phy. Like the mac of external phy, the internal phy's mac also needs to configure the related mac registers at GRF.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +23 -3
@@ -323,6 +323,8 @@ static void rk3288_set_rmii_speed(struct rk_priv_data *bsp_priv, int speed)#define RK3328_GRF_MAC_CON0 0x0900#define RK3328_GRF_MAC_CON1 0x0904 +#define RK3328_GRF_MAC_CON2 0x0908 +#define RK3328_GRF_MACPHY_CON1 0xb04/* RK3328_GRF_MAC_CON0 */ #define RK3328_GMAC_CLK_RX_DL_CFG (val) HIWORD_UPDATE(val, 0x7F, 7)
@@ -349,6 +351,9 @@ static void rk3288_set_rmii_speed(struct rk_priv_data *bsp_priv, int speed)#define RK3328_GMAC_RXCLK_DLY_ENABLE GRF_BIT(1)#define RK3328_GMAC_RXCLK_DLY_DISABLE GRF_CLR_BIT(0) +/* RK3328_GRF_MACPHY_CON1 */ +#define RK3328_MACPHY_RMII_MODE GRF_BIT(9) +static void rk3328_set_to_rgmii (struct rk_priv_data *bsp_priv,int tx_delay,int rx_delay) {
@@ -373,13 +378,17 @@ static void rk3328_set_to_rgmii(struct rk_priv_data *bsp_priv,static void rk3328_set_to_rmii (struct rk_priv_data *bsp_priv) {struct device *dev = &bsp_priv->pdev->dev; +unsigned int reg;if (IS_ERR (bsp_priv->grf)) {dev_err (dev,"Missing rockchip,grf property\n" );return ; } -regmap_write (bsp_priv->grf,RK3328_GRF_MAC_CON1 , + reg = bsp_priv->internal_phy ?RK3328_GRF_MAC_CON2 : +RK3328_GRF_MAC_CON1 ; + +regmap_write (bsp_priv->grf, reg,RK3328_GMAC_PHY_INTF_SEL_RMII |RK3328_GMAC_RMII_MODE ); }
@@ -409,29 +418,40 @@ static void rk3328_set_rgmii_speed(struct rk_priv_data *bsp_priv, int speed)static void rk3328_set_rmii_speed (struct rk_priv_data *bsp_priv,int speed) {struct device *dev = &bsp_priv->pdev->dev; +unsigned int reg;if (IS_ERR (bsp_priv->grf)) {dev_err (dev,"Missing rockchip,grf property\n" );return ; } + reg = bsp_priv->internal_phy ?RK3328_GRF_MAC_CON2 : +RK3328_GRF_MAC_CON1 ; +if (speed ==10 ) -regmap_write (bsp_priv->grf,RK3328_GRF_MAC_CON1 , +regmap_write (bsp_priv->grf, reg,RK3328_GMAC_RMII_CLK_2_5M |RK3328_GMAC_SPEED_10M );else if (speed ==100 ) -regmap_write (bsp_priv->grf,RK3328_GRF_MAC_CON1 , +regmap_write (bsp_priv->grf, reg,RK3328_GMAC_RMII_CLK_25M |RK3328_GMAC_SPEED_100M );else dev_err (dev,"unknown speed value for RMII! speed=%d" , speed); } +static void rk3328_internal_phy_powerup (struct rk_priv_data *priv) +{ +regmap_write (priv->grf,RK3328_GRF_MACPHY_CON1 , +RK3328_MACPHY_RMII_MODE ); +} +static const struct rk_gmac_ops rk3328_ops = { .set_to_rgmii = rk3328_set_to_rgmii, .set_to_rmii = rk3328_set_to_rmii, .set_rgmii_speed = rk3328_set_rgmii_speed, .set_rmii_speed = rk3328_set_rmii_speed, + .internal_phy_powerup = rk3328_internal_phy_powerup, };#define RK3366_GRF_SOC_CON6 0x0418
Signature · 1 line
1.9.1
PATCH v4 9/12 ARM: dts: rk322x: Add support internal phy for gmac
In reply to David WuThis patch adds internal mac phy clock and internal mac phy reset for rk gmac using.
--- arch/arm/boot/dts/rk322x.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/rk322x.dtsi +4 -4
@@ -611,13 +611,13 @@ clocks = <&cru SCLK_MAC>, <&cru SCLK_MAC_RX>, <&cru SCLK_MAC_TX>, <&cru SCLK_MAC_REF>, <&cru SCLK_MAC_REFOUT>, <&cru ACLK_GMAC>, - <&cru PCLK_GMAC>; + <&cru PCLK_GMAC>, <&cru SCLK_MAC_PHY>; clock-names = "stmmaceth", "mac_clk_rx", "mac_clk_tx", "clk_mac_ref", "clk_mac_refout", "aclk_mac", - "pclk_mac"; - resets = <&cru SRST_GMAC>; - reset-names = "stmmaceth"; + "pclk_mac", "clk_macphy"; + resets = <&cru SRST_GMAC>, <&cru SRST_MACPHY>; + reset-names = "stmmaceth", "mac-phy"; rockchip,grf = <&grf>; status = "disabled"; };
Signature · 1 line
1.9.1
PATCH v4 10/12 ARM: dts: rk3228-evb: Enable the internal phy for gmac
In reply to David WuThis patch enables the internal phy for rk3228 evb board by default.
To use the external 1000M phy on evb board, need to make some switch of evb board to be on.
--- arch/arm/boot/dts/rk3228-evb.dts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
arch/arm/boot/dts/rk3228-evb.dts +32 -0
@@ -50,6 +50,16 @@ device_type = "memory"; reg = <0x60000000 0x40000000>; }; + + vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; + enable-active-high; + regulator-name = "vcc_phy"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + }; }; &emmc {
@@ -60,6 +70,28 @@ status = "okay"; }; +&gmac { + assigned-clocks = <&cru SCLK_MAC_SRC>; + assigned-clock-rates = <50000000>; + clock_in_out = "output"; + phy-supply = <&vcc_phy>; + phy-mode = "rmii"; + phy-handle = <&phy0>; + status = "okay"; + + mdio { + compatible = "snps,dwmac-mdio"; + #address-cells = <1>; + #size-cells = <0>; + + phy@0 { + compatible = "ethernet-phy-id1234.d400", "ethernet-phy-802.3-c22"; + reg = <0>; + phy-is-internal; + }; + }; +}; + &tsadc { status = "okay";
Signature · 1 line
1.9.1
PATCH v4 11/12 ARM64: dts: rockchip: Add gmac2phy node support for rk3328
In reply to David WuThe gmac2phy controller of rk3328 is connected to internal phy directly inside, add the node for the internal phy support.
--- arch/arm64/boot/dts/rockchip/rk3328.dtsi | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
arch/arm64/boot/dts/rockchip/rk3328.dtsi +37 -0
@@ -63,6 +63,8 @@ i2c1 = &i2c1; i2c2 = &i2c2; i2c3 = &i2c3; + ethernet0 = &gmac2io; + ethernet1 = &gmac2phy; }; cpus {
@@ -424,6 +426,41 @@ status = "disabled"; }; + gmac2phy: ethernet@ff550000 { + compatible = "rockchip,rk3328-gmac"; + reg = <0x0 0xff550000 0x0 0x10000>; + rockchip,grf = <&grf>; + interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "macirq"; + clocks = <&cru SCLK_MAC2PHY_SRC>, <&cru SCLK_MAC2PHY_RXTX>, + <&cru SCLK_MAC2PHY_RXTX>, <&cru SCLK_MAC2PHY_REF>, + <&cru ACLK_MAC2PHY>, <&cru PCLK_MAC2PHY>, + <&cru SCLK_MAC2PHY_OUT>; + clock-names = "stmmaceth", "mac_clk_rx", + "mac_clk_tx", "clk_mac_ref", + "aclk_mac", "pclk_mac", + "clk_macphy"; + resets = <&cru SRST_GMAC2PHY_A>, <&cru SRST_MACPHY>; + reset-names = "stmmaceth", "mac-phy"; + phy-mode = "rmii"; + pinctrl-names = "default"; + pinctrl-0 = <&fephyled_rxm1 &fephyled_linkm1>; + phy-handle = <&phy>; + status = "disabled"; + + mdio { + compatible = "snps,dwmac-mdio"; + #address-cells = <1>; + #size-cells = <0>; + + phy: phy@0 { + compatible = "ethernet-phy-id1234.d400", "ethernet-phy-802.3-c22"; + reg = <0>; + phy-is-internal; + }; + }; + }; + gic: interrupt-controller@ff811000 { compatible = "arm,gic-400"; #interrupt-cells = <3>;
Signature · 1 line
1.9.1
PATCH v4 12/12 ARM64: dts: rockchip: Enable gmac2phy for rk3328-evb
In reply to David WuEnable the gmac2phy, make the gmac2phy work on
the rk3328-evb board.
--- arch/arm64/boot/dts/rockchip/rk3328-evb.dts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/arm64/boot/dts/rockchip/rk3328-evb.dts +17 -0
@@ -50,6 +50,23 @@ chosen { stdout-path = "serial2:1500000n8"; }; + + vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; + }; +}; + +&gmac2phy { + phy-supply = <&vcc_phy>; + clock_in_out = "output"; + assigned-clocks = <&cru SCLK_MAC2PHY_SRC>; + assigned-clock-rate = <50000000>; + assigned-clocks = <&cru SCLK_MAC2PHY>; + assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>; + status = "okay"; }; &uart2 {
Signature · 1 line
1.9.1
Re: [PATCH v4 05/12] Documentation: net: phy: Add phy-is-internal binding
In reply to David WuQuoted 18 lines · David Wu
Add the documentation for internal phy. A boolean property indicates that a internal phy will be used.
Signed-off-by David Wu <[email protected]>---
Documentation/devicetree/bindings/net/phy.txt| 3 +++1 file changed, 3 insertions(+)Documentation/devicetree/bindings/net/phy.txt +1
-0@@ -52,6 +52,9 @@ Optional Properties: Mark the corresponding energy efficient ethernet mode as broken and request the ethernet to stop advertising it. +- phy-is-internal: If set, indicates that phy will connect to the MAC
Quoted 2 lines
as a
+ internal phy.
Something along the lines of:
If set, indicates that the PHY is integrated into the same physical package as the Ethernet MAC.
Please always capitalize PHY.
Signature · 1 line
Florian
Re: [PATCH v4 10/12] ARM: dts: rk3228-evb: Enable the internal phy for gmac
In reply to David WuQuoted 6 lines · David Wu
This patch enables the internal phy for rk3228 evb board by default.
To use the external 1000M phy on evb board, need to make some switch of evb board to be on.Signed-off-by David Wu <[email protected]>
LGTM
Signature · 1 line
Florian
Andrew Lunn
maintainerRe: [PATCH v4 05/12] Documentation: net: phy: Add phy-is-internal binding
In reply to Florian FainelliQuoted 18 lines · Florian Fainelli
Quoted 17 lines · David Wu
Add the documentation for internal phy. A boolean property indicates that a internal phy will be used.
Signed-off-by David Wu <[email protected]>---
Documentation/devicetree/bindings/net/phy.txt| 3 +++1 file changed, 3 insertions(+)Documentation/devicetree/bindings/net/phy.txt +0
-0@@ -52,6 +52,9 @@ Optional Properties: Mark the corresponding energy efficient ethernet mode as broken and request the ethernet to stop advertising it.
Quoted 7 lines
Quoted 3 lines
Documentation/devicetree/bindings/net/phy.txt +1
-0+- phy-is-internal: If set, indicates that phy will connect to the MACas a
+ internal phy.Something along the lines of:
If set, indicates that the PHY is integrated into the same physical package as the Ethernet MAC.
Hi Florian, David.
I'm happy with the property name. But i think the text needs more description. We deal with Ethernet switches with integrated PHYs. Yet for us, this property is unneeded.
Seeing this property means some bit of software needs to ensure the internal PHY should be used, when given the choice between an internal and external PHY. So i would say something like:
If set, indicates that the PHY is integrated into the same physical package as the Ethernet MAC. If needed, muxers should be configured to ensure the internal PHY is used. The absence of this property indicates the muxers should be configured so that the external PHY is used.
This last part is important. If the bootloader has set the internal PHY to be used, you need to reset it. Otherwise we are going to get into a mess sometime later and need to add a phy-is-external property.
Andrew
Re: [PATCH v4 05/12] Documentation: net: phy: Add phy-is-internal binding
Quoted 43 lines · Andrew Lunn
Quoted 18 lines · Florian Fainelli
Quoted 17 lines · David Wu
Add the documentation for internal phy. A boolean property indicates that a internal phy will be used.
Signed-off-by David Wu <[email protected]>---
Documentation/devicetree/bindings/net/phy.txt| 3 +++1 file changed, 3 insertions(+)Documentation/devicetree/bindings/net/phy.txt +0
-0@@ -52,6 +52,9 @@ Optional Properties: Mark the corresponding energy efficient ethernet mode as broken and request the ethernet to stop advertising it.Quoted 7 lines
Quoted 3 lines
Documentation/devicetree/bindings/net/phy.txt +1
-0+- phy-is-internal: If set, indicates that phy will connect to the MACas a
+ internal phy.Something along the lines of:
If set, indicates that the PHY is integrated into the same physical package as the Ethernet MAC.
Hi Florian, David.
I'm happy with the property name. But i think the text needs more description. We deal with Ethernet switches with integrated PHYs. Yet for us, this property is unneeded.
Seeing this property means some bit of software needs to ensure the internal PHY should be used, when given the choice between an internal and external PHY. So i would say something like:
If set, indicates that the PHY is integrated into the same physical package as the Ethernet MAC. If needed, muxers should be configured to ensure the internal PHY is used. The absence of this property indicates the muxers should be configured so that the external PHY is used.
Quoted 3 lines
This last part is important. If the bootloader has set the internal PHY to be used, you need to reset it. Otherwise we are going to get into a mess sometime later and need to add a phy-is-external property.
Ack.
One other thing. We need to fix our (sunxi) binding which is already in 4.13-rc1. We'd like to see this new property in netdev, i.e. merged for 4.13, so we can use it.
Thanks
ChenYu
Re: [PATCH v4 05/12] Documentation: net: phy: Add phy-is-internal binding
In reply to Andrew LunnHi Andrew, Florian
? 2017/8/10 8:20, Andrew Lunn ??:
Quoted 10 lines
Hi Florian, David.
I'm happy with the property name. But i think the text needs more description. We deal with Ethernet switches with integrated PHYs. Yet for us, this property is unneeded.
Seeing this property means some bit of software needs to ensure the internal PHY should be used, when given the choice between an internal and external PHY. So i would say something like:
Quoted 5 lines
If set, indicates that the PHY is integrated into the same physical package as the Ethernet MAC. If needed, muxers should be configured to ensure the (internal) PHY is used. The absence of this property indicates the muxers should be configured so that the external PHY is used.
Are we supposed to replace the words "internal" with "integrated" here? So we have three kinds of PHY, they are intenal, external and integrated PHYs.
Quoted 4 lines
This last part is important. If the bootloader has set the internal PHY to be used, you need to reset it. Otherwise we are going to get into a mess sometime later and need to add a phy-is-external property.
Rob Herring
maintainerRe: [PATCH v4 05/12] Documentation: net: phy: Add phy-is-internal binding
Quoted 19 lines · David.Wu
Hi Andrew, Florian
? 2017/8/10 8:20, Andrew Lunn ??:
Quoted 10 lines
Hi Florian, David.
I'm happy with the property name. But i think the text needs more description. We deal with Ethernet switches with integrated PHYs. Yet for us, this property is unneeded.
Seeing this property means some bit of software needs to ensure the internal PHY should be used, when given the choice between an internal and external PHY. So i would say something like:
Quoted 5 lines
If set, indicates that the PHY is integrated into the same physical package as the Ethernet MAC. If needed, muxers should be configured to ensure the (internal) PHY is used. The absence of this property indicates the muxers should be configured so that the external PHY is used.
Quoted 3 lines
Are we supposed to replace the words "internal" with "integrated" here? So we have three kinds of PHY, they are intenal, external and integrated PHYs.
And you can have both a XAUI/serdes phy and the ethernet phy. It should be clear this is for the latter.
Rob
Rob Herring
maintainerRe: [PATCH v4 06/12] net: stmmac: dwmac-rk: Add internal phy support
In reply to David WuQuoted 27 lines · David Wu
To make internal phy work, need to configure the
phy_clock, phycru_resetand related registers.Signed-off-by David Wu <[email protected]>---
change in v4:
- PHY is internal or not base on the phy-is-internal property via phy node..../devicetree/bindings/net/rockchip-dwmac.txt | 4 +- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 88 ++++++++++++++++++++++ 2 files changed, 91 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/net/rockchip-dwmac.txt +2
-1@@ -25,7 +25,8 @@ Required properties: - clock-names: One name for each entry in the clocks property. - phy-mode: See ethernet.txt file in the same directory. - pinctrl-names: Names corresponding to the numbered pinctrl states. - - pinctrl-0: pin-control mode. can be <&rgmii_pins> or <&rmii_pins>. + - pinctrl-0: pin-control mode. can be <&rgmii_pins>, <&rmii_pins> or led pins + for internal phy mode. - clock_in_out: For RGMII, it must be "input", means main clock(125MHz) is not sourced from SoC's PLL, but input from PHY; For RMII, "input" means PHY provides the reference clock(50MHz), "output" means GMAC provides the
Documentation/devicetree/bindings/net/rockchip-dwmac.txt Optional properties: · line 44
Quoted 4 lines
Documentation/devicetree/bindings/net/rockchip-dwmac.txt +1
-0@@ -40,6 +41,7 @@ Optional properties: - tx_delay: Delay value for TXD timing. Range value is 0~0x7F, 0x30 as default. - rx_delay: Delay value for RXD timing. Range value is 0~0x7F, 0x10 as default. - phy-supply: phandle to a regulator if the PHY needs one + - clocks: <&cru MAC_PHY>: Clock selector for internal macphy
I assume this is required if internal phy is used. 'clocks' is already documented above, so this needs to be documented with it.
Rob