Add support of Ethernet for Aspeed AST2600 SoC
Subsystems (5)
cover Add support of Ethernet for Aspeed AST2600 SoC
This patch series adds support of Ethernet for Aspeed AST2600 SoC. There are 4 MAC controllers (ftgmac100) in AST2600 that can support 10/100/1000T Ethernet. 4 MDIO controllers are used to connect to PHY chips. The MDIO controller has stand-alone hardware block so we introduce DM_MDIO so that we can use external MDIO driver (aspeed_mdio) instead of integrated MDIO drier in ftgmac100.c. The patch series also revises the MII interface delay for better RMII/RGMII timing margin.
Dylan Hung (5):
net: ftgmac100: Add DM_MDIO support
net: ftgmac100: Add Aspeed AST2600 support
ARM: dts: ast2600: Add MDIO devices
configs: ast2600: enable DM_MDIO and MDIO driver
clk: ast2600: Revise MII interface delay
arch/arm/dts/ast2600-evb.dts | 68 ++++++++++++++++++++++++++++++++ arch/arm/dts/ast2600.dtsi | 46 ++++++++++++++++++--- configs/evb-ast2600_defconfig | 2 + drivers/clk/aspeed/clk_ast2600.c | 10 ++--- drivers/net/ftgmac100.c | 21 +++++++--- 5 files changed, 132 insertions(+), 15 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/5 net: ftgmac100: Add DM_MDIO support
Add support for DM_MDIO to connect to PHY. For the systems that have a stand-alone MDIO hardware block, enable CONFIG_DM_MDIO to use driver model for MDIO devices.
--- drivers/net/ftgmac100.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/net/ftgmac100.c +15 -5
@@ -220,7 +220,11 @@ static int ftgmac100_phy_init(struct udevice *dev)struct phy_device *phydev;int ret; - phydev =phy_connect (priv->bus, priv->phy_addr, dev, priv->phy_mode); +if (IS_ENABLED (CONFIG_DM_MDIO )) + phydev =dm_eth_phy_connect (dev); +else + phydev =phy_connect (priv->bus, priv->phy_addr, dev, priv->phy_mode); +if (!phydev)return -ENODEV ;
@@ -589,10 +593,16 @@ static int ftgmac100_probe(struct udevice *dev)if (ret) goto out; - ret =ftgmac100_mdio_init (dev); -if (ret) { -dev_err (dev,"Failed to initialize mdiobus: %d\n" , ret); - goto out; +/* +* If DM MDIO is enabled, the MDIO bus will be initialized later in +* dm_eth_phy_connect +*/ +if (!IS_ENABLED (CONFIG_DM_MDIO )) { + ret =ftgmac100_mdio_init (dev); +if (ret) { +dev_err (dev,"Failed to initialize mdiobus: %d\n" , ret); + goto out; + } } ret =ftgmac100_phy_init (dev);
Signature · 1 line
2.25.1
Re: [next 1/5] net: ftgmac100: Add DM_MDIO support
Quoted 49 lines · Dylan Hung
Add support for
DM_MDIOto connect to PHY. For the systems that have a stand-alone MDIO hardware block, enableCONFIG_DM_MDIOto use driver model for MDIO devices.Signed-off-by Dylan Hung <[email protected]>--- drivers/net/ftgmac100.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)drivers/net/ftgmac100.c +15
-6@@ -220,7 +220,11 @@ static int ftgmac100_phy_init(struct udevice *dev)struct phy_device *phydev;int ret; - phydev =phy_connect (priv->bus, priv->phy_addr, dev, priv->phy_mode); +if (IS_ENABLED (CONFIG_DM_MDIO )) + phydev =dm_eth_phy_connect (dev); +else + phydev =phy_connect (priv->bus, priv->phy_addr, dev, priv->phy_mode); +if (!phydev)return -ENODEV ;@@ -589,10 +593,16 @@ static int ftgmac100_probe(struct udevice *dev)if (ret) goto out; - ret =ftgmac100_mdio_init (dev); -if (ret) { -dev_err (dev,"Failed to initialize mdiobus: %d\n" , ret); - goto out; +/* +* If DM MDIO is enabled, the MDIO bus will be initialized later in +* dm_eth_phy_connect +*/ +if (!IS_ENABLED (CONFIG_DM_MDIO )) { + ret =ftgmac100_mdio_init (dev); +if (ret) { +dev_err (dev,"Failed to initialize mdiobus: %d\n" , ret); + goto out; + } } ret =ftgmac100_phy_init (dev); --
Quoted 2 lines
2.25.1
Re: [next 1/5] net: ftgmac100: Add DM_MDIO support
In reply to Dylan HungQuoted 6 lines · Dylan Hung
Add support for
DM_MDIOto connect to PHY. For the systems that have a stand-alone MDIO hardware block, enableCONFIG_DM_MDIOto use driver model for MDIO devices.Signed-off-by Dylan Hung <[email protected]>Reviewed-by Ramon Fried <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH 2/5 net: ftgmac100: Add Aspeed AST2600 support
In reply to Dylan HungAdd support of the MAC controller of Aspeed AST2600 SOC. The MAC controller is the same with AST2500, except it has stand-alone MDIO hardware block.
--- drivers/net/ftgmac100.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ftgmac100.c +1 -0
@@ -644,6 +644,7 @@ static const struct eth_ops ftgmac100_ops = {static const struct udevice_id ftgmac100_ids[] = { { .compatible ="faraday,ftgmac100" , .data =FTGMAC100_MODEL_FARADAY }, { .compatible ="aspeed,ast2500-mac" , .data =FTGMAC100_MODEL_ASPEED }, + { .compatible ="aspeed,ast2600-mac" , .data =FTGMAC100_MODEL_ASPEED }, { } };
Signature · 1 line
2.25.1
Re: [next 2/5] net: ftgmac100: Add Aspeed AST2600 support
Quoted 23 lines · Dylan Hung
Add support of the MAC controller of Aspeed AST2600 SOC. The MAC controller is the same with AST2500, except it has stand-alone MDIO hardware block.
Signed-off-by Dylan Hung <[email protected]>--- drivers/net/ftgmac100.c | 1 + 1 file changed, 1 insertion(+)drivers/net/ftgmac100.c +1
-1@@ -644,6 +644,7 @@ static const struct eth_ops ftgmac100_ops = {static const struct udevice_id ftgmac100_ids[] = { { .compatible ="faraday,ftgmac100" , .data =FTGMAC100_MODEL_FARADAY }, { .compatible ="aspeed,ast2500-mac" , .data =FTGMAC100_MODEL_ASPEED }, + { .compatible ="aspeed,ast2600-mac" , .data =FTGMAC100_MODEL_ASPEED }, { } }; --
Quoted 2 lines
2.25.1
Re: [next 2/5] net: ftgmac100: Add Aspeed AST2600 support
In reply to Dylan HungQuoted 6 lines · Dylan Hung
Add support of the MAC controller of Aspeed AST2600 SOC. The MAC controller is the same with AST2500, except it has stand-alone MDIO hardware block.
Signed-off-by Dylan Hung <[email protected]>Reviewed-by Ramon Fried <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH 3/5 ARM: dts: ast2600: Add MDIO devices
In reply to Dylan HungThere are 4 MDIO bus controllers in AST2600 SOC. Each of them can connect to one or more PHY chips and is flexible to work with the 4 MAC devices in AST2600. On AST2600 EVB, MDIO 0,1,2,3 connect to the PHY chips used by MAC 0,1,2,3 respectively.
--- arch/arm/dts/ast2600-evb.dts | 68 ++++++++++++++++++++++++++++++++++++ arch/arm/dts/ast2600.dtsi | 46 +++++++++++++++++++++--- 2 files changed, 109 insertions(+), 5 deletions(-)
arch/arm/dts/ast2600-evb.dts +68 -0
@@ -163,6 +163,74 @@ pinctrl-0 = <&pinctrl_i2c9_default>; }; +&mdio0 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + +&mdio1 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + ethphy1: ethernet-phy@0 { + reg = <0>; + }; +}; + +&mdio2 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + ethphy2: ethernet-phy@0 { + reg = <0>; + }; +}; + +&mdio3 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + ethphy3: ethernet-phy@0 { + reg = <0>; + }; +}; + +&mac0 { + status = "okay"; + phy-mode = "rgmii-rxid"; + phy-handle = <ðphy0>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_rgmii1_default>; +}; + +&mac1 { + status = "okay"; + phy-mode = "rgmii-rxid"; + phy-handle = <ðphy1>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_rgmii2_default>; +}; + +&mac2 { + status = "okay"; + phy-mode = "rgmii"; + phy-handle = <ðphy2>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_rgmii3_default>; +}; + +&mac3 { + status = "okay"; + phy-mode = "rgmii"; + phy-handle = <ðphy3>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_rgmii4_default>; +}; + &scu { mac0-clk-delay = <0x1d 0x1c 0x10 0x17
arch/arm/dts/ast2600.dtsi +41 -5
52 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [next 3/5] ARM: dts: ast2600: Add MDIO devices
Quoted 149 lines · Dylan Hung
There are 4 MDIO bus controllers in AST2600 SOC. Each of them can connect to one or more PHY chips and is flexible to work with the 4 MAC devices in AST2600. On AST2600 EVB, MDIO 0,1,2,3 connect to the PHY chips used by MAC 0,1,2,3 respectively.
Signed-off-by Dylan Hung <[email protected]>--- arch/arm/dts/ast2600-evb.dts | 68 ++++++++++++++++++++++++++++++++++++ arch/arm/dts/ast2600.dtsi | 46 +++++++++++++++++++++--- 2 files changed, 109 insertions(+), 5 deletions(-)arch/arm/dts/ast2600-evb.dts +68
-0@@ -163,6 +163,74 @@ pinctrl-0 = <&pinctrl_i2c9_default>; }; +&mdio0 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + +&mdio1 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + ethphy1: ethernet-phy@0 { + reg = <0>; + }; +}; + +&mdio2 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + ethphy2: ethernet-phy@0 { + reg = <0>; + }; +}; + +&mdio3 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + ethphy3: ethernet-phy@0 { + reg = <0>; + }; +}; + +&mac0 { + status = "okay"; + phy-mode = "rgmii-rxid"; + phy-handle = <ðphy0>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_rgmii1_default>; +}; + +&mac1 { + status = "okay"; + phy-mode = "rgmii-rxid"; + phy-handle = <ðphy1>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_rgmii2_default>; +}; + +&mac2 { + status = "okay"; + phy-mode = "rgmii"; + phy-handle = <ðphy2>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_rgmii3_default>; +}; + +&mac3 { + status = "okay"; + phy-mode = "rgmii"; + phy-handle = <ðphy3>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_rgmii4_default>; +}; + &scu { mac0-clk-delay = <0x1d 0x1c 0x10 0x17arch/arm/dts/ast2600.dtsi +41
-6@@ -193,11 +193,47 @@ interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>; }; - mdio: ethernet@1e650000 { - compatible = "aspeed,aspeed-mdio"; - reg = <0x1e650000 0x40>; - resets = <&rst ASPEED_RESET_MII>; - status = "disabled"; + mdio: bus@1e650000 { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x1e650000 0x100>; + + mdio0: mdio@0 { + compatible = "aspeed,ast2600-mdio"; + reg = <0 0x8>; + resets = <&rst ASPEED_RESET_MII>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_mdio1_default>; + status = "disabled"; + }; + + mdio1: mdio@8 { + compatible = "aspeed,ast2600-mdio"; + reg = <0x8 0x8>; + resets = <&rst ASPEED_RESET_MII>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_mdio2_default>; + status = "disabled"; + }; + + mdio2: mdio@10 { + compatible = "aspeed,ast2600-mdio"; + reg = <0x10 0x8>; + resets = <&rst ASPEED_RESET_MII>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_mdio3_default>; + status = "disabled"; + }; + + mdio3: mdio@18 { + compatible = "aspeed,ast2600-mdio"; + reg = <0x18 0x8>; + resets = <&rst ASPEED_RESET_MII>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_mdio4_default>; + status = "disabled"; + }; }; mac0: ftgmac@1e660000 { --
Quoted 2 lines
2.25.1
Re: [next 3/5] ARM: dts: ast2600: Add MDIO devices
In reply to Dylan HungQuoted 7 lines · Dylan Hung
There are 4 MDIO bus controllers in AST2600 SOC. Each of them can connect to one or more PHY chips and is flexible to work with the 4 MAC devices in AST2600. On AST2600 EVB, MDIO 0,1,2,3 connect to the PHY chips used by MAC 0,1,2,3 respectively.
Signed-off-by Dylan Hung <[email protected]>Reviewed-by Ramon Fried <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH 4/5 configs: ast2600: enable DM_MDIO and MDIO driver
In reply to Dylan HungEnable DM_MDIO and Aspeed MDIO driver for AST2600 EVB.
--- configs/evb-ast2600_defconfig | 2 ++ 1 file changed, 2 insertions(+)
configs/evb-ast2600_defconfig +2 -0
@@ -54,7 +54,9 @@ CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ASPEED=y CONFIG_PHY_REALTEK=y CONFIG_DM_ETH=y +CONFIG_DM_MDIO=y CONFIG_FTGMAC100=y +CONFIG_ASPEED_MDIO=y CONFIG_PHY=y CONFIG_PINCTRL=y CONFIG_RAM=y
Signature · 1 line
2.25.1
Re: [next 4/5] configs: ast2600: enable DM_MDIO and MDIO driver
Quoted 23 lines · Dylan Hung
Enable
DM_MDIOand Aspeed MDIO driver for AST2600 EVB.Signed-off-by Dylan Hung <[email protected]>--- configs/evb-ast2600_defconfig | 2 ++ 1 file changed, 2 insertions(+)configs/evb-ast2600_defconfig +2
-1@@ -54,7 +54,9 @@ CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ASPEED=y CONFIG_PHY_REALTEK=y CONFIG_DM_ETH=y +CONFIG_DM_MDIO=y CONFIG_FTGMAC100=y +CONFIG_ASPEED_MDIO=y CONFIG_PHY=y CONFIG_PINCTRL=y CONFIG_RAM=y --
Quoted 2 lines
2.25.1
Re: [next 4/5] configs: ast2600: enable DM_MDIO and MDIO driver
In reply to Dylan HungQuoted 4 lines · Dylan Hung
Enable
DM_MDIOand Aspeed MDIO driver for AST2600 EVB.Signed-off-by Dylan Hung <[email protected]>Reviewed-by Ramon Fried <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH 5/5 clk: ast2600: Revise MII interface delay
In reply to Dylan HungThe clock delay of the RMII/RGMII interface is controlled by SCU340~35C. These values are obtained by measurement and experiments so we simply use macro to define them.
--- drivers/clk/aspeed/clk_ast2600.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/aspeed/clk_ast2600.c +5 -5
@@ -19,11 +19,11 @@ DECLARE_GLOBAL_DATA_PTR;#define CLKIN_25M 25000000UL/* MAC Clock Delay settings */ -#define MAC12_DEF_DELAY_1G 0x0041b75d -#define MAC12_DEF_DELAY_100M 0x00417410 -#define MAC12_DEF_DELAY_10M 0x00417410 -#define MAC34_DEF_DELAY_1G 0x0010438a -#define MAC34_DEF_DELAY_100M 0x00104208 +#define MAC12_DEF_DELAY_1G 0x0028a410 +#define MAC12_DEF_DELAY_100M 0x00410410 +#define MAC12_DEF_DELAY_10M 0x00410410 +#define MAC34_DEF_DELAY_1G 0x00104208 +#define MAC34_DEF_DELAY_100M 0x00104208#define MAC34_DEF_DELAY_10M 0x00104208/*
Signature · 1 line
2.25.1
Re: [next 5/5] clk: ast2600: Revise MII interface delay
Quoted 32 lines · Dylan Hung
The clock delay of the RMII/RGMII interface is controlled by SCU340~35C. These values are obtained by measurement and experiments so we simply use macro to define them.
Signed-off-by Dylan Hung <[email protected]>--- drivers/clk/aspeed/clk_ast2600.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/clk/aspeed/clk_ast2600.c +5
-6@@ -19,11 +19,11 @@ DECLARE_GLOBAL_DATA_PTR;#define CLKIN_25M 25000000UL/* MAC Clock Delay settings */ -#define MAC12_DEF_DELAY_1G 0x0041b75d -#define MAC12_DEF_DELAY_100M 0x00417410 -#define MAC12_DEF_DELAY_10M 0x00417410 -#define MAC34_DEF_DELAY_1G 0x0010438a -#define MAC34_DEF_DELAY_100M 0x00104208 +#define MAC12_DEF_DELAY_1G 0x0028a410 +#define MAC12_DEF_DELAY_100M 0x00410410 +#define MAC12_DEF_DELAY_10M 0x00410410 +#define MAC34_DEF_DELAY_1G 0x00104208 +#define MAC34_DEF_DELAY_100M 0x00104208#define MAC34_DEF_DELAY_10M 0x00104208/* --
Quoted 2 lines
2.25.1
Re: [next 5/5] clk: ast2600: Revise MII interface delay
In reply to Dylan HungQuoted 6 lines · Dylan Hung
The clock delay of the RMII/RGMII interface is controlled by SCU340~35C. These values are obtained by measurement and experiments so we simply use macro to define them.
Signed-off-by Dylan Hung <[email protected]>Reviewed-by Ramon Fried <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom