rockchip: Add gmac Ethernet support
Subsystems (2)
v7 cover rockchip: Add gmac Ethernet support
From Romain:
This is a resent of Simon's v4 series. I have changed what was suggested by David Wu about the driver name (rename gmac_rk3288 to gmac_rockchip). I have also tested the whole series on a rock2 square board, updated the configuration files for rock2 board. I have fixed a build failure caused by recent changes in config_distro_defaults (CMD_PXE is no longer enabled, so I enabled DISTRO_DEFAULTS for Rockchip platforms by default). I have also added few Signed-off-by tags.
From Simon:
This v3 patch is an update on Sjoerd's original v2 series from Feburary. I have dealt with the changes requested at the time, and adjusted the way that the speed change is handled.
Tested on firefly-rk3288, rock2.
Original cover letter:
To add support I've taken a slightly different approach then some of the other boards with a designware IP block, by creating a new driver to take care of the platfrom glue which subclasses the main designware driver instead of adding the compatibility string the designware driver directly and doing the SoC specific setup in the board files. This seems quite a bit more elegant in a device model based world.
I've only tested this series on a Radxa Rock 2 board, it would be great if someone could test this on other boards with the designware IP especially for those with the reset GPIO in devicetree (e.g. some of the Allwinner boards).
Compared to the first one round the pinctrl related bits were dropped as RK3288 now has a full pinctrl driver. Furthermore the started hook in the designware driver was renamed to fix_mac_speed in line with what linux uses and moved to the dw_link_adjust function.
Changes in v7:
- Fixed build failure caused by recent changes in config_distro_defaults.h (CMD_PXE is no longer enabled so BOOTENV_DEV_PXE is expanded to BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE). The fix itself consists in enabling DISTRO_DEFAULTS by default for Rockchip platforms.
- Added a new commit for enabling ETH address randomization on the rock2, otherwise we cannot use ethernet interface and we get an error at bootup.
Changes in v6:
- Changed Acked-by to Signed-off-by for Romain in commits from [PATCH 01/09] to [PATCH 06/09]
Changes in v5:
- Changed the name of the driver gmac_rk3288 to gmac_rockchip, as suggested by David Wu. Also I rewrote the commit message
- Added my Acked-by to commits from [PATCH 01/09] to [PATCH 06/09]
- Updated configuration files for rock2 and firefly with the new Kconfig symbol
Changes in v4:
- Fix commit message to say 'rk3399'
Changes in v3:
- Add a few new patches
- Add comments for struct gmac_rk3288_platdata
- Add new patch to adjust dw_adjust_link() to return an error
- Add new patch to enable networking on evb-rk3399
- Add new patch to export the operation functions
- Add new patch to split the link init into a separate function
- Adjust binding to use r/tx-delay instead of r/tx_delay
- Drop the 'net: designware: Add a fix_mac_speed hook' patch
- Sort includes
- Use debug() instead of printf() for error
- Use function calls instead of fix_mac_speed() hook
- Use new clk interface
Changes in v2:
- Adjust to new hook name
- Fix various coding style nits
Romain Perier (2):
Enable DISTRO_DEFAULTS for Rockchip platforms
rockchip: Enable ETH address randomization for the rock2
Simon Glass (4):
net: designware: Adjust dw_adjust_link() to return an error
net: designware: Split the link init into a separate function
net: designware: Export the operation functions
rockchip: evb-rk3339: Enable DHCP
Sjoerd Simons (5):
net: designware: Export various functions/struct to allow subclassing
net: gmac_rockchip: Add Rockchip GMAC driver
rockchip: Enable networking support on rock2 and firefly
rockchip: Add PXE and DHCP to the default boot targets
rockchip: Drop Ethernet from the TODO
Kconfig | 1 + configs/evb-rk3399_defconfig | 3 + configs/firefly-rk3288_defconfig | 4 + configs/rock2_defconfig | 5 ++ doc/README.rockchip | 1 - drivers/net/Kconfig | 7 ++ drivers/net/Makefile | 1 + drivers/net/designware.c | 57 ++++++++++---- drivers/net/designware.h | 13 ++++ drivers/net/gmac_rockchip.c | 154 ++++++++++++++++++++++++++++++++++++++ include/configs/rockchip-common.h | 4 +- 11 files changed, 232 insertions(+), 18 deletions(-) create mode 100644 drivers/net/gmac_rockchip.c
Signature · 1 line
2.9.3
PATCH v7 1/11 net: designware: Export various functions/struct to allow subclassing
From: Sjoerd Simons <[email protected]>
To allow other DM drivers to subclass the designware driver various functions and structures need to be exported. Export these.
---
Changes in v7: NONE
Changes in v6:
- Acked-by -> Signed-off-by for Romain
Changes in v5:
- Added Acked-by for Romain
drivers/net/designware.c | 6 +++--- drivers/net/designware.h | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/net/designware.c +3 -3
@@ -628,7 +628,7 @@ static int designware_eth_bind(struct udevice *dev)return 0 ; } -static int designware_eth_probe (struct udevice *dev) +int designware_eth_probe (struct udevice *dev) {struct eth_pdata *pdata =dev_get_platdata (dev);struct dw_eth_dev *priv =dev_get_priv (dev);
@@ -678,7 +678,7 @@ static int designware_eth_remove(struct udevice *dev)return 0 ; } -static const struct eth_ops designware_eth_ops = { +const struct eth_ops designware_eth_ops = { .start = designware_eth_start, .send = designware_eth_send, .recv = designware_eth_recv,
@@ -687,7 +687,7 @@ static const struct eth_ops designware_eth_ops = { .write_hwaddr = designware_eth_write_hwaddr, }; -static int designware_eth_ofdata_to_platdata (struct udevice *dev) +int designware_eth_ofdata_to_platdata (struct udevice *dev) {struct dw_eth_pdata *dw_pdata =dev_get_platdata (dev);#ifdef CONFIG_DM_GPIO
drivers/net/designware.h +4 -0
@@ -245,6 +245,10 @@ struct dw_eth_dev { }; #ifdef CONFIG_DM_ETH +int designware_eth_ofdata_to_platdata(struct udevice *dev); +int designware_eth_probe(struct udevice *dev); +extern const struct eth_ops designware_eth_ops; + struct dw_eth_pdata { struct eth_pdata eth_pdata; u32 reset_delays[3];
Signature · 1 line
2.9.3
PATCH v7 2/11 net: designware: Adjust dw_adjust_link() to return an error
In reply to Romain PerierFrom: Simon Glass <[email protected]>
This function can fail, so return the error if there is one.
---
Changes in v7: None
Changes in v6:
- Changed Acked-by to Signed-off-by for Romain Changes in v5:
- Add Acked-by for Romain
Changes in v4: None
Changes in v3:
- Add new patch to adjust dw_adjust_link() to return an error
Changes in v2: None
drivers/net/designware.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/designware.c +8 -4
@@ -230,14 +230,14 @@ static int _dw_write_hwaddr(struct dw_eth_dev *priv, u8 *mac_id)return 0 ; } -static void dw_adjust_link (struct eth_mac_regs *mac_p, -struct phy_device *phydev) +static int dw_adjust_link (struct dw_eth_dev *priv,struct eth_mac_regs *mac_p, +struct phy_device *phydev) {u32 conf =readl (&mac_p->conf) |FRAMEBURSTENABLE |DISABLERXOWN ;if (!phydev->link) {printf ("%s: No link.\n" , phydev->dev->name); -return ; +return 0 ; }if (phydev->speed !=1000 )
@@ -256,6 +256,8 @@ static void dw_adjust_link(struct eth_mac_regs *mac_p,printf ("Speed: %d, %s duplex%s\n" , phydev->speed, (phydev->duplex) ?"full" :"half" , (phydev->port ==PORT_FIBRE ) ?", fiber mode" :"" ); + +return 0 ; }static void _dw_eth_halt (struct dw_eth_dev *priv)
@@ -321,7 +323,9 @@ static int _dw_eth_init(struct dw_eth_dev *priv, u8 *enetaddr)return ret; } -dw_adjust_link (mac_p, priv->phydev); + ret =dw_adjust_link (priv, mac_p, priv->phydev); +if (ret) +return ret;if (!priv->phydev->link)return -EIO ;
Signature · 1 line
2.9.3
PATCH v7 3/11 net: designware: Split the link init into a separate function
In reply to Romain PerierFrom: Simon Glass <[email protected]>
With rockchip we need to make adjustments after the link speed is set but before enabling received/transmit. In preparation for this, split these two pieces into separate functions.
---
Changes in v7: None
Changes in v6:
- Changed Acked-by to Signed-off-by for Romain Changes in v5:
- Added Acked-by for Romain
Changes in v4: None
Changes in v3:
- Add new patch to split the link init into a separate function
Changes in v2: None
drivers/net/designware.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/net/designware.c +24 -2
@@ -327,6 +327,13 @@ static int _dw_eth_init(struct dw_eth_dev *priv, u8 *enetaddr)if (ret)return ret; +return 0 ; +} + +static int designware_eth_enable (struct dw_eth_dev *priv) +{ +struct eth_mac_regs *mac_p = priv->mac_regs_p; +if (!priv->phydev->link)return -EIO ;
@@ -484,7 +491,13 @@ static int dw_phy_init(struct dw_eth_dev *priv, void *dev)#ifndef CONFIG_DM_ETH static int dw_eth_init (struct eth_device *dev,bd_t *bis) { -return _dw_eth_init (dev->priv, dev->enetaddr); +int ret; + + ret =_dw_eth_init (dev->priv, dev->enetaddr); +if (!ret) + ret =designware_eth_enable (dev->priv); + +return ret; }static int dw_eth_send (struct eth_device *dev,void *packet,int length)
@@ -575,8 +588,17 @@ int designware_initialize(ulong base_addr, u32 interface)static int designware_eth_start (struct udevice *dev) {struct eth_pdata *pdata =dev_get_platdata (dev); +struct dw_eth_dev *priv =dev_get_priv (dev); +int ret; -return _dw_eth_init (dev->priv, pdata->enetaddr); + ret =_dw_eth_init (priv, pdata->enetaddr); +if (ret) +return ret; + ret =designware_eth_enable (priv); +if (ret) +return ret; + +return 0 ; }static int designware_eth_send (struct udevice *dev,void *packet,int length)
Signature · 1 line
2.9.3
PATCH v7 4/11 net: designware: Export the operation functions
In reply to Romain PerierFrom: Simon Glass <[email protected]>
Export all functions so that drivers can use them, or not, as the need arises.
---
Changes in v7: None
Changes in v6:
- Changed Acked-by to Signed-off-by for Romain
Changes in v5:
- Add Acked-by for Romain
Changes in v4: None
Changes in v3:
- Add new patch to export the operation functions
Changes in v2: None
drivers/net/designware.c | 19 +++++++++---------- drivers/net/designware.h | 9 +++++++++ 2 files changed, 18 insertions(+), 10 deletions(-)
drivers/net/designware.c +9 -10
@@ -271,7 +271,7 @@ static void _dw_eth_halt(struct dw_eth_dev *priv)phy_shutdown (priv->phydev); } -static int _dw_eth_init (struct dw_eth_dev *priv,u8 *enetaddr) +int designware_eth_init (struct dw_eth_dev *priv,u8 *enetaddr) {struct eth_mac_regs *mac_p = priv->mac_regs_p;struct eth_dma_regs *dma_p = priv->dma_regs_p;
@@ -330,7 +330,7 @@ static int _dw_eth_init(struct dw_eth_dev *priv, u8 *enetaddr)return 0 ; } -static int designware_eth_enable (struct dw_eth_dev *priv) +int designware_eth_enable (struct dw_eth_dev *priv) {struct eth_mac_regs *mac_p = priv->mac_regs_p;
@@ -493,7 +493,7 @@ static int dw_eth_init(struct eth_device *dev, bd_t *bis) {int ret; - ret =_dw_eth_init (dev->priv, dev->enetaddr); + ret =designware_eth_init (dev->priv, dev->enetaddr);if (!ret) ret =designware_eth_enable (dev->priv);
@@ -591,7 +591,7 @@ static int designware_eth_start(struct udevice *dev)struct dw_eth_dev *priv =dev_get_priv (dev);int ret; - ret =_dw_eth_init (priv, pdata->enetaddr); + ret =designware_eth_init (priv, pdata->enetaddr);if (ret)return ret; ret =designware_eth_enable (priv);
@@ -601,36 +601,35 @@ static int designware_eth_start(struct udevice *dev)return 0 ; } -static int designware_eth_send (struct udevice *dev,void *packet,int length) +int designware_eth_send (struct udevice *dev,void *packet,int length) {struct dw_eth_dev *priv =dev_get_priv (dev);return _dw_eth_send (priv, packet, length); } -static int designware_eth_recv (struct udevice *dev,int flags,uchar **packetp) +int designware_eth_recv (struct udevice *dev,int flags,uchar **packetp) {struct dw_eth_dev *priv =dev_get_priv (dev);return _dw_eth_recv (priv, packetp); } -static int designware_eth_free_pkt (struct udevice *dev,uchar *packet, -int length) +int designware_eth_free_pkt (struct udevice *dev,uchar *packet,int length) {struct dw_eth_dev *priv =dev_get_priv (dev);return _dw_free_pkt (priv); } -static void designware_eth_stop (struct udevice *dev) +void designware_eth_stop (struct udevice *dev) {struct dw_eth_dev *priv =dev_get_priv (dev);return _dw_eth_halt (priv); } -static int designware_eth_write_hwaddr (struct udevice *dev) +int designware_eth_write_hwaddr (struct udevice *dev) {struct eth_pdata *pdata =dev_get_platdata (dev);struct dw_eth_dev *priv =dev_get_priv (dev);
drivers/net/designware.h +9 -0
@@ -253,6 +253,15 @@ struct dw_eth_pdata {struct eth_pdata eth_pdata;u32 reset_delays[3 ]; }; + +int designware_eth_init (struct dw_eth_dev *priv,u8 *enetaddr); +int designware_eth_enable (struct dw_eth_dev *priv); +int designware_eth_send (struct udevice *dev,void *packet,int length); +int designware_eth_recv (struct udevice *dev,int flags,uchar **packetp); +int designware_eth_free_pkt (struct udevice *dev,uchar *packet, +int length); +void designware_eth_stop (struct udevice *dev); +int designware_eth_write_hwaddr (struct udevice *dev);#endif #endif
Signature · 1 line
2.9.3
PATCH v7 5/11 net: gmac_rockchip: Add Rockchip GMAC driver
In reply to Romain PerierFrom: Sjoerd Simons <[email protected]>
Add a new driver for the GMAC ethernet interface present in Rockchip RK3288 SOCs. This driver subclasses the generic design-ware driver to add the glue needed specifically for Rockchip.
---
Changes in v7: None
Changes in v6:
- Changed Acked-by to Signed-off-by for Romain Changes in v5:
- Rename the driver to gmac_rockchip as suggested by David Wu
- Rewrote commit message (gmac_rk3288 -> gmac_rockchip)
- Added Acked-by for Romain
Changes in v4: None
Changes in v3:
- Add comments for struct gmac_rk3288_platdata
- Adjust binding to use r/tx-delay instead of r/tx_delay
- Sort includes
- Use debug() instead of printf() for error
- Use function calls instead of fix_mac_speed() hook
- Use new clk interface
drivers/net/Kconfig | 7 ++ drivers/net/Makefile | 1 + drivers/net/gmac_rockchip.c | 154 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 162 insertions(+) create mode 100644 drivers/net/gmac_rockchip.c
drivers/net/Kconfig +7 -0
@@ -215,4 +215,11 @@ config PIC32_ETH This driver implements 10/100 Mbps Ethernet and MAC layer for Microchip PIC32 microcontrollers. +config GMAC_ROCKCHIP + bool "Rockchip Synopsys Designware Ethernet MAC" + depends on DM_ETH && ETH_DESIGNWARE + help + This driver provides Rockchip SoCs network support based on the + Synopsys Designware driver. + endif # NETDEVICES
drivers/net/Makefile +1 -0
@@ -34,6 +34,7 @@ obj-$(CONFIG_FTGMAC100) += ftgmac100.o obj-$(CONFIG_FTMAC110) += ftmac110.o obj-$(CONFIG_FTMAC100) += ftmac100.o obj-$(CONFIG_GRETH) += greth.o +obj-$(CONFIG_GMAC_ROCKCHIP) += gmac_rockchip.o obj-$(CONFIG_DRIVER_TI_KEYSTONE_NET) += keystone_net.o obj-$(CONFIG_KS8851_MLL) += ks8851_mll.o obj-$(CONFIG_LAN91C96) += lan91c96.o
drivers/net/gmac_rockchip.c new file +154 -0
154 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v7 6/11 rockchip: Enable networking support on rock2 and firefly
In reply to Romain PerierFrom: Sjoerd Simons <[email protected]>
Enable the various configuration option required to get the ethernet interface up and running on Radxa Rock2 and Firefly.
---
Changes in v7: None
Changes in v6:
- Changed Acked-by to Signed-off-by for Romain Changes in v5:
- Added Acked-by for Romain
- Replaced CONFIG_GMAC_RK3288 by CONFIG_GMAC_ROCKCHIP Changes in v4: None
Changes in v3: None
Changes in v2: None
configs/firefly-rk3288_defconfig | 4 ++++ configs/rock2_defconfig | 4 ++++ 2 files changed, 8 insertions(+)
configs/firefly-rk3288_defconfig +4 -0
@@ -44,6 +44,10 @@ CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_LED=y CONFIG_LED_GPIO=y CONFIG_ROCKCHIP_DWMMC=y +CONFIG_DM_ETH=y +CONFIG_NETDEVICES=y +CONFIG_ETH_DESIGNWARE=y +CONFIG_GMAC_ROCKCHIP=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y # CONFIG_SPL_PINCTRL_FULL is not set
configs/rock2_defconfig +4 -0
@@ -42,6 +42,10 @@ CONFIG_SPL_CLK=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_ROCKCHIP_DWMMC=y +CONFIG_DM_ETH=y +CONFIG_NETDEVICES=y +CONFIG_ETH_DESIGNWARE=y +CONFIG_GMAC_ROCKCHIP=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y # CONFIG_SPL_PINCTRL_FULL is not set
Signature · 1 line
2.9.3
PATCH v7 7/11 rockchip: evb-rk3339: Enable DHCP
In reply to Romain PerierFrom: Simon Glass <[email protected]>
This is the only RK3399 device without DHCP. Enable it so that we can use a common BOOT_TARGET_DEVICES setting. It is likely useful to be able to use USB networking, at least. Full networking can be enabled when a suitable platform needs it.
---
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4:
- Fix commit message to say 'rk3399'
Changes in v3:
- Add new patch to enable networking on evb-rk3399
Changes in v2: None
configs/evb-rk3399_defconfig | 3 +++ 1 file changed, 3 insertions(+)
configs/evb-rk3399_defconfig +3 -0
@@ -11,6 +11,9 @@ CONFIG_CMD_MMC=y CONFIG_CMD_SF=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set +CONFIG_CMD_DHCP=y +CONFIG_CMD_MII=y +CONFIG_CMD_PING=y CONFIG_CMD_TIME=y CONFIG_CMD_EXT2=y CONFIG_CMD_EXT4=y
Signature · 1 line
2.9.3
PATCH v7 8/11 Enable DISTRO_DEFAULTS for Rockchip platforms
In reply to Romain PerierThis enables suitable commands needed for booting general purpose Linux distribution. This is required for example if we want to use PXE or DHCP as default boot targets, symbols no longer enabled by config_distro_defaults.h .
---
Changes in v7:
- Added this commit to fix build failure introduced by commit 09/11
Kconfig | 1 + 1 file changed, 1 insertion(+)
Kconfig +1 -0
@@ -57,6 +57,7 @@ config DISTRO_DEFAULTS bool "Select defaults suitable for booting general purpose Linux distributions" default y if ARCH_SUNXI || TEGRA default y if ARCH_LS2080A + default y if ARCH_ROCKCHIP default n select CMD_BOOTZ if ARM && !ARM64 select CMD_BOOTI if ARM64
Signature · 1 line
2.9.3
PATCH v7 9/11 rockchip: Add PXE and DHCP to the default boot targets
In reply to Romain PerierFrom: Sjoerd Simons <[email protected]>
Now that at least on the firefly board we have network support, enable PXE and DHCP boot targets by default.
---
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
include/configs/rockchip-common.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/configs/rockchip-common.h +3 -1
@@ -14,7 +14,9 @@/* First try to boot from SD (index 0), then eMMC (index 1 */ #define BOOT_TARGET_DEVICES (func) \ func(MMC, mmc, 0) \ - func(MMC, mmc, 1) + func(MMC, mmc, 1) \ + func(PXE, pxe, na) \ + func(DHCP, dchp, na)/* Enable gpt partition table */ #define CONFIG_CMD_GPT
Signature · 1 line
2.9.3
PATCH v7 10/11 rockchip: Enable ETH address randomization for the rock2
In reply to Romain PerierThis commit enables ethernet MAC address randomization on the rock2. It removes the error at startup 'ethernet at ff290000 address not set'.
---
Changes in v7:
- Added this commit to the series
configs/rock2_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/rock2_defconfig +1 -0
@@ -32,6 +32,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_SPL_OF_CONTROL=y CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent" +CONFIG_NET_RANDOM_ETHADDR=y CONFIG_REGMAP=y CONFIG_SPL_REGMAP=y CONFIG_SYSCON=y
Signature · 1 line
2.9.3
PATCH v7 11/11 rockchip: Drop Ethernet from the TODO
In reply to Romain PerierFrom: Sjoerd Simons <[email protected]>
Now that ethernet support works, it can be dropped from the rockchip TODO
---
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3:
- Add a few new patches
- Drop the 'net: designware: Add a fix_mac_speed hook' patch
doc/README.rockchip | 1 - 1 file changed, 1 deletion(-)
doc/README.rockchip +0 -1
@@ -219,7 +219,6 @@ Immediate priorities are: - USB host - USB device - Run CPU at full speed (code exists but we only see ~60 DMIPS maximum) -- Ethernet - NAND flash - Support for other Rockchip parts - Boot U-Boot proper over USB OTG (at present only SPL works)
Signature · 1 line
2.9.3
v7 cover rockchip: Add gmac Ethernet support
In reply to Romain PerierHi,
Quoted 107 lines · Romain Perier
Quoted 1 line
From Romain:
This is a resent of Simon's v4 series. I have changed what was suggested by David Wu about the driver name (rename
gmac_rk3288togmac_rockchip). I have also tested the whole series on a rock2 square board, updated the configuration files for rock2 board. I have fixed a build failure caused by recent changes inconfig_distro_defaults(CMD_PXEis no longer enabled, so I enabledDISTRO_DEFAULTSfor Rockchip platforms by default). I have also added few Signed-off-by tags.Quoted 1 line
From Simon:
This v3 patch is an update on Sjoerd's original v2 series from Feburary. I have dealt with the changes requested at the time, and adjusted the way that the speed change is handled.
Tested on firefly-rk3288, rock2.
Original cover letter:
To add support I've taken a slightly different approach then some of the other boards with a designware IP block, by creating a new driver to take care of the platfrom glue which subclasses the main designware driver instead of adding the compatibility string the designware driver directly and doing the SoC specific setup in the board files. This seems quite a bit more elegant in a device model based world.I've only tested this series on a Radxa Rock 2 board, it would be great if someone could test this on other boards with the designware IP especially for those with the reset GPIO in devicetree (e.g. some of the Allwinner boards).
Compared to the first one round the pinctrl related bits were dropped as RK3288 now has a full pinctrl driver. Furthermore the started hook in the designware driver was renamed to
fix_mac_speedin line with what linux uses and moved to thedw_link_adjustfunction.Changes in v7:
- Fixed build failure caused by recent changes inconfig_distro_defaults.h(CMD_PXEis no longer enabled soBOOTENV_DEV_PXEis expanded toBOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE). The fix itself consists in enablingDISTRO_DEFAULTSby default for Rockchip platforms.
- Added a new commit for enabling ETH address randomization on the rock2, otherwise we cannot use ethernet interface and we get an error at bootup.Changes in v6:
- Changed Acked-by to Signed-off-by for Romain in commits from [PATCH 01/09] to [PATCH 06/09]Changes in v5:
- Changed the name of the drivergmac_rk3288togmac_rockchip, as suggested by David Wu. Also I rewrote the commit message
- Added my Acked-by to commits from [PATCH 01/09] to [PATCH 06/09]
- Updated configuration files for rock2 and firefly with the newKconfigsymbolChanges in v4:
- Fix commit message to say 'rk3399'Changes in v3:
- Add a few new patches
- Add comments for structgmac_rk3288_platdata
- Add new patch to adjustdw_adjust_link()to return an error
- Add new patch to enable networking on evb-rk3399
- Add new patch to export the operation functions
- Add new patch to split the link init into a separate function
- Adjust binding to use r/tx-delay instead of r/tx_delay
- Drop the 'net: designware: Add afix_mac_speedhook' patch
- Sort includes
- Usedebug()instead ofprintf()for error
- Use function calls instead offix_mac_speed()hook
- Use new clk interfaceChanges in v2:
- Adjust to new hook name
- Fix various coding style nitsRomain Perier (2):
EnableDISTRO_DEFAULTSfor Rockchip platforms
rockchip: Enable ETH address randomization for the rock2Simon Glass (4):
net: designware: Adjustdw_adjust_link()to return an error
net: designware: Split the link init into a separate function
net: designware: Export the operation functions
rockchip: evb-rk3339: Enable DHCPSjoerd Simons (5):
net: designware: Export various functions/struct to allow subclassing
net:gmac_rockchip: Add Rockchip GMAC driver
rockchip: Enable networking support on rock2 and firefly
rockchip: Add PXE and DHCP to the default boot targets
rockchip: Drop Ethernet from the TODOKconfig | 1 + configs/evb-rk3399_defconfig | 3 + configs/firefly-rk3288_defconfig | 4 + configs/rock2_defconfig | 5 ++ doc/README.rockchip | 1 - drivers/net/Kconfig | 7 ++ drivers/net/Makefile | 1 + drivers/net/designware.c | 57 ++++++++++---- drivers/net/designware.h | 13 ++++ drivers/net/gmac_rockchip.c | 154 ++++++++++++++++++++++++++++++++++++++ include/configs/rockchip-common.h | 4 +- 11 files changed, 232 insertions(+), 18 deletions(-) create mode 100644 drivers/net/gmac_rockchip.c
Quoted 3 lines
--
2.9.3
I have tested this on a gigabit link and it does not work. I wonder if the clocks are wrong?
However it works fine on 100Mbps which is better than what we have, so I'm going to apply this. Thank you for your work, Romain.
Regards,
Simon
PATCH v7 1/11 net: designware: Export various functions/struct to allow subclassing
In reply to Romain PerierQuoted 17 lines · Romain Perier
From: Sjoerd Simons <[email protected]>
To allow other DM drivers to subclass the designware driver various functions and structures need to be exported. Export these.
Signed-off-by Sjoerd Simons <[email protected]>Signed-off-by Romain Perier <[email protected]>Reviewed-by Bin Meng <[email protected]>Acked-by Simon Glass <[email protected]>Acked-by Joe Hershberger <[email protected]>---
Changes in v7: NONE
Changes in v6:
- Acked-by -> Signed-off-by for Romain
Quoted 6 lines
Changes in v5:
- Added Acked-by for Romaindrivers/net/designware.c | 6 +++--- drivers/net/designware.h | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-)
Applied to u-boot-rockchip, thanks!
PATCH v7 2/11 net: designware: Adjust dw_adjust_link() to return an error
In reply to Romain PerierQuoted 18 lines · Romain Perier
From: Simon Glass <[email protected]>
This function can fail, so return the error if there is one.
Signed-off-by Simon Glass <[email protected]>Signed-off-by Romain Perier <[email protected]>Acked-by Joe Hershberger <[email protected]>---
Changes in v7: None
Changes in v6:
- Changed Acked-by to Signed-off-by for Romain Changes in v5:
- Add Acked-by for Romain
Changes in v4: None
Changes in v3:
- Add new patch to adjustdw_adjust_link()to return an error
Quoted 4 lines
Changes in v2: None
drivers/net/designware.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
Applied to u-boot-rockchip, thanks!
PATCH v7 3/11 net: designware: Split the link init into a separate function
In reply to Romain PerierQuoted 20 lines · Romain Perier
From: Simon Glass <[email protected]>
With rockchip we need to make adjustments after the link speed is set but before enabling received/transmit. In preparation for this, split these two pieces into separate functions.
Signed-off-by Simon Glass <[email protected]>Signed-off-by Romain Perier <[email protected]>Acked-by Joe Hershberger <[email protected]>---
Changes in v7: None
Changes in v6:
- Changed Acked-by to Signed-off-by for Romain Changes in v5:
- Added Acked-by for Romain
Changes in v4: None
Changes in v3:
- Add new patch to split the link init into a separate function
Quoted 4 lines
Changes in v2: None
drivers/net/designware.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
Applied to u-boot-rockchip, thanks!
PATCH v7 4/11 net: designware: Export the operation functions
In reply to Romain PerierQuoted 19 lines · Romain Perier
From: Simon Glass <[email protected]>
Export all functions so that drivers can use them, or not, as the need arises.
Signed-off-by Simon Glass <[email protected]>Signed-off-by Romain Perier <[email protected]>Acked-by Joe Hershberger <[email protected]>---
Changes in v7: None
Changes in v6:
- Changed Acked-by to Signed-off-by for Romain
Changes in v5:
- Add Acked-by for Romain
Changes in v4: None
Changes in v3:
- Add new patch to export the operation functions
Quoted 5 lines
Changes in v2: None
drivers/net/designware.c | 19 +++++++++---------- drivers/net/designware.h | 9 +++++++++ 2 files changed, 18 insertions(+), 10 deletions(-)
Applied to u-boot-rockchip, thanks!
PATCH v7 5/11 net: gmac_rockchip: Add Rockchip GMAC driver
In reply to Romain PerierQuoted 29 lines · Romain Perier
From: Sjoerd Simons <[email protected]>
Add a new driver for the GMAC ethernet interface present in Rockchip RK3288 SOCs. This driver subclasses the generic design-ware driver to add the glue needed specifically for Rockchip.
Signed-off-by Sjoerd Simons <[email protected]>Signed-off-by Simon Glass <[email protected]>Signed-off-by Romain Perier <[email protected]>Acked-by Joe Hershberger <[email protected]>---
Changes in v7: None
Changes in v6:
- Changed Acked-by to Signed-off-by for Romain Changes in v5:
- Rename the driver togmac_rockchipas suggested by David Wu
- Rewrote commit message (gmac_rk3288->gmac_rockchip)
- Added Acked-by for RomainChanges in v4: None
Changes in v3:
- Add comments for structgmac_rk3288_platdata
- Adjust binding to use r/tx-delay instead of r/tx_delay
- Sort includes
- Usedebug()instead ofprintf()for error
- Use function calls instead offix_mac_speed()hook
- Use new clk interface
Quoted 5 lines
drivers/net/Kconfig | 7 ++ drivers/net/Makefile | 1 + drivers/net/gmac_rockchip.c | 154 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 162 insertions(+) create mode 100644 drivers/net/gmac_rockchip.c
Applied to u-boot-rockchip, thanks!
PATCH v7 6/11 rockchip: Enable networking support on rock2 and firefly
In reply to Romain PerierQuoted 21 lines · Romain Perier
From: Sjoerd Simons <[email protected]>
Enable the various configuration option required to get the ethernet interface up and running on Radxa Rock2 and Firefly.
Signed-off-by Sjoerd Simons <[email protected]>Signed-off-by Romain Perier <[email protected]>Reviewed-by Simon Glass <[email protected]>Acked-by Joe Hershberger <[email protected]>---
Changes in v7: None
Changes in v6:
- Changed Acked-by to Signed-off-by for Romain Changes in v5:
- Added Acked-by for Romain
- ReplacedCONFIG_GMAC_RK3288byCONFIG_GMAC_ROCKCHIPChanges in v4: None
Changes in v3: None
Changes in v2: None
Quoted 3 lines
configs/firefly-rk3288_defconfig | 4 ++++ configs/rock2_defconfig | 4 ++++ 2 files changed, 8 insertions(+)
Applied to u-boot-rockchip, thanks!
PATCH v7 7/11 rockchip: evb-rk3339: Enable DHCP
In reply to Romain PerierQuoted 15 lines · Romain Perier
From: Simon Glass <[email protected]>
This is the only RK3399 device without DHCP. Enable it so that we can use a common
BOOT_TARGET_DEVICESsetting. It is likely useful to be able to use USB networking, at least. Full networking can be enabled when a suitable platform needs it.Signed-off-by Simon Glass <[email protected]>---
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4:
- Fix commit message to say 'rk3399'
Quoted 7 lines
Changes in v3:
- Add new patch to enable networking on evb-rk3399Changes in v2: None
configs/evb-rk3399_defconfig | 3 +++ 1 file changed, 3 insertions(+)
Applied to u-boot-rockchip, thanks!
PATCH v7 8/11 Enable DISTRO_DEFAULTS for Rockchip platforms
In reply to Romain PerierQuoted 5 lines · Romain Perier
This enables suitable commands needed for booting general purpose Linux distribution. This is required for example if we want to use PXE or DHCP as default boot targets, symbols no longer enabled by
config_distro_defaults.h.
Quoted 8 lines
Signed-off-by Romain Perier <[email protected]>---
Changes in v7:
- Added this commit to fix build failure introduced by commit 09/11Kconfig | 1 + 1 file changed, 1 insertion(+)
Applied to u-boot-rockchip, thanks!
PATCH v7 9/11 rockchip: Add PXE and DHCP to the default boot targets
In reply to Romain PerierQuoted 17 lines · Romain Perier
From: Sjoerd Simons <[email protected]>
Now that at least on the firefly board we have network support, enable PXE and DHCP boot targets by default.
Signed-off-by Sjoerd Simons <[email protected]>Acked-by Simon Glass <[email protected]>Acked-by Joe Hershberger <[email protected]>---
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
Quoted 2 lines
include/configs/rockchip-common.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Applied to u-boot-rockchip, thanks!
PATCH v7 10/11 rockchip: Enable ETH address randomization for the rock2
In reply to Romain PerierQuoted 11 lines · Romain Perier
This commit enables ethernet MAC address randomization on the rock2. It removes the error at startup 'ethernet at
ff290000address not set'.Signed-off-by Romain Perier <[email protected]>---
Changes in v7:
- Added this commit to the seriesconfigs/rock2_defconfig | 1 + 1 file changed, 1 insertion(+)
Applied to u-boot-rockchip, thanks!
PATCH v7 11/11 rockchip: Drop Ethernet from the TODO
In reply to Romain PerierQuoted 19 lines · Romain Perier
From: Sjoerd Simons <[email protected]>
Now that ethernet support works, it can be dropped from the rockchip TODO
Signed-off-by Sjoerd Simons <[email protected]>Acked-by Simon Glass <[email protected]>Acked-by Joe Hershberger <[email protected]>Signed-off-by Simon Glass <[email protected]>---
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3:
- Add a few new patches
- Drop the 'net: designware: Add afix_mac_speedhook' patch
Quoted 2 lines
doc/README.rockchip | 1 - 1 file changed, 1 deletion(-)
Applied to u-boot-rockchip, thanks!
v7 cover rockchip: Add gmac Ethernet support
In reply to Simon GlassQuoted 20 lines · Simon Glass
Hi,
Quoted 15 lines · Romain Perier
Quoted 1 line
From Romain:
This is a resent of Simon's v4 series. I have changed what was suggested
by David Wu about the driver name (renamegmac_rk3288togmac_rockchip).
I have also tested the whole series on a rock2 square board, updated the
configuration files for rock2 board. I have fixed a build failure caused
by recent changes inconfig_distro_defaults(CMD_PXEis no longer enabled,
so I enabledDISTRO_DEFAULTSfor Rockchip platforms by default). I have also
added few Signed-off-by tags.
Quoted 7 lines
I have tested this on a gigabit link and it does not work. I wonder if
the clocks are wrong?However it works fine on 100Mbps which is better than what we have, so
I'm going to apply this. Thank you for your work, Romain.
Funny, my initial patchset only worked on gigabit due to a wrong phy clock on 100mbit/s. Hopefully should be an easy fix in a follow-up patch. Thanks for merging!
Signature · 2 lines
Sjoerd Simons Collabora Ltd.
v7 cover rockchip: Add gmac Ethernet support
Hi Sjoerd,
Quoted 25 lines · Sjoerd Simons
Quoted 24 lines · Simon Glass
Hi,
Quoted 15 lines · Romain Perier
Quoted 1 line
From Romain:
This is a resent of Simon's v4 series. I have changed what was suggested
by David Wu about the driver name (renamegmac_rk3288togmac_rockchip).
I have also tested the whole series on a rock2 square board, updated the
configuration files for rock2 board. I have fixed a build failure caused
by recent changes inconfig_distro_defaults(CMD_PXEis no longer enabled,
so I enabledDISTRO_DEFAULTSfor Rockchip platforms by default). I have also
added few Signed-off-by tags.I have tested this on a gigabit link and it does not work. I wonder if
the clocks are wrong?
Quoted 7 lines
Quoted 3 lines
However it works fine on 100Mbps which is better than what we have, so
I'm going to apply this. Thank you for your work, Romain.Funny, my initial patchset only worked on gigabit due to a wrong phy clock on 100mbit/s. Hopefully should be an easy fix in a follow-up patch. Thanks for merging!
Yes, it worked OK for me ages ago when I first tested it, but I did have a different setup. It gives a lot of timeouts for me now. As you say it shouldn't be hard to resolve.
Regards,
Simon