arm: socpfpga: gen5 clean up ETH RST & PHY mode
v2 cover arm: socpfpga: gen5 clean up ETH RST & PHY mode
Socfpga Gen5 uses ad-hoc code to unreset the ETH MACs and set their PHY mode.
Change this to use the dwmac_socfpga net driver and remove the old ad-hoc code.
Changes in v2:
- remove detection of sub-mach via compatible version and handle all FPGAs the same
- select SYSCON and REGMAP via Kconfig
- only add CONFIG_ETH_DESIGNWARE_SOCFPGA since now REGMAP and SYSCON are selected by this one
Simon Goldschmidt (3):
net: designware: socfpga: adapt to Gen5
arm: socfpga: gen5 enable designware_socfpga
arm: socfpga: gen5: remove hacked ETH RST handling
.../mach-socfpga/include/mach/reset_manager.h | 2 - arch/arm/mach-socfpga/misc.c | 65 -------------- arch/arm/mach-socfpga/misc_gen5.c | 44 +--------- configs/socfpga_arria5_defconfig | 1 + configs/socfpga_cyclone5_defconfig | 1 + configs/socfpga_dbm_soc1_defconfig | 1 + configs/socfpga_de0_nano_soc_defconfig | 1 + configs/socfpga_de10_nano_defconfig | 1 + configs/socfpga_de1_soc_defconfig | 1 + configs/socfpga_is1_defconfig | 1 + configs/socfpga_sockit_defconfig | 1 + configs/socfpga_socrates_defconfig | 1 + configs/socfpga_sr1500_defconfig | 1 + configs/socfpga_vining_fpga_defconfig | 1 + drivers/net/Kconfig | 2 + drivers/net/dwmac_socfpga.c | 87 +++++++------------ 16 files changed, 47 insertions(+), 164 deletions(-)
Signature · 1 line
2.17.1
PATCH v2 1/3 net: designware: socfpga: adapt to Gen5
This driver was written for Arria10, but it applies to Gen5, too.
The main difference is that Gen5 has 2 MACs (Arria10 has 3) and the syscon bits are encoded in the same register, thus an offset is needed.
This offset is already read from the devicetree, but for Arria10 it is always 0, which is probably why it has been ignored. By using this offset when writing the phy mode into the syscon regiter, we can use this driver to set the phy mode for both of the MACs on Gen5.
Since the PHY mode bits in sysmgr are the same even for Stratix10, let's drop the detection of the sub-mach by checking compatible version and just use the same code for all FPGAs.
To work correctly, this driver depends on SYSCON and REGMAP, so select those via Kconfig when it is enabeld.
Tested on socfpga_socrates (where the 2nd MAC is connected, so a shift offset is required).
---
Changes in v2:
- remove detection of sub-mach via compatible version and handle all FPGAs the same
- select SYSCON and REGMAP via Kconfig
drivers/net/Kconfig | 2 + drivers/net/dwmac_socfpga.c | 87 ++++++++++++++----------------------- 2 files changed, 35 insertions(+), 54 deletions(-)
drivers/net/Kconfig +2 -0
@@ -162,6 +162,8 @@ config ETH_DESIGNWARE provide the PHY (physical media interface). config ETH_DESIGNWARE_SOCFPGA + select REGMAP + select SYSCON bool "Altera SoCFPGA extras for Synopsys Designware Ethernet MAC" depends on DM_ETH && ETH_DESIGNWARE help
drivers/net/dwmac_socfpga.c +33 -54
110 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 1/3 net: designware: socfpga: adapt to Gen5
Quoted 14 lines · Simon Goldschmidt
This driver was written for Arria10, but it applies to Gen5, too.
The main difference is that Gen5 has 2 MACs (Arria10 has 3) and the syscon bits are encoded in the same register, thus an offset is needed.
This offset is already read from the devicetree, but for Arria10 it is always 0, which is probably why it has been ignored. By using this offset when writing the phy mode into the syscon regiter, we can use this driver to set the phy mode for both of the MACs on Gen5.
Since the PHY mode bits in sysmgr are the same even for Stratix10, let's drop the detection of the sub-mach by checking compatible version and just use the same code for all FPGAs.
Quoted 7 lines
To work correctly, this driver depends on SYSCON and REGMAP, so select those via
Kconfigwhen it is enabeld.Tested on
socfpga_socrates(where the 2nd MAC is connected, so a shift offset is required).Signed-off-by Simon Goldschmidt <[email protected]>
Signature · 2 lines
Best regards, Marek Vasut
PATCH v2 2/3 arm: socfpga: gen5 enable designware_socfpga
In reply to Simon GoldschmidtEnable the socfpga specific designware ethernet driver for all Gen5 and Arria10 defconfigs.
This is required to remove the hacky reset and phy mode handling in arch/arm/mach-socfpga.
---
Changes in v2:
- only add CONFIG_ETH_DESIGNWARE_SOCFPGA since now REGMAP and SYSCON are selected by this one
configs/socfpga_arria5_defconfig | 1 + configs/socfpga_cyclone5_defconfig | 1 + configs/socfpga_dbm_soc1_defconfig | 1 + configs/socfpga_de0_nano_soc_defconfig | 1 + configs/socfpga_de10_nano_defconfig | 1 + configs/socfpga_de1_soc_defconfig | 1 + configs/socfpga_is1_defconfig | 1 + configs/socfpga_sockit_defconfig | 1 + configs/socfpga_socrates_defconfig | 1 + configs/socfpga_sr1500_defconfig | 1 + configs/socfpga_vining_fpga_defconfig | 1 + 11 files changed, 11 insertions(+)
configs/socfpga_arria5_defconfig +1 -0
@@ -59,6 +59,7 @@ CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y CONFIG_DM_ETH=y CONFIG_ETH_DESIGNWARE=y +CONFIG_ETH_DESIGNWARE_SOCFPGA=y CONFIG_MII=y CONFIG_DM_RESET=y CONFIG_SPI=y
configs/socfpga_cyclone5_defconfig +1 -0
@@ -60,6 +60,7 @@ CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y CONFIG_DM_ETH=y CONFIG_ETH_DESIGNWARE=y +CONFIG_ETH_DESIGNWARE_SOCFPGA=y CONFIG_MII=y CONFIG_DM_RESET=y CONFIG_SPI=y
configs/socfpga_dbm_soc1_defconfig +1 -0
@@ -54,6 +54,7 @@ CONFIG_MTD_DEVICE=y CONFIG_DM_ETH=y CONFIG_PHY_GIGE=y CONFIG_ETH_DESIGNWARE=y +CONFIG_ETH_DESIGNWARE_SOCFPGA=y CONFIG_MII=y CONFIG_DM_RESET=y CONFIG_SPI=y
configs/socfpga_de0_nano_soc_defconfig +1 -0
@@ -54,6 +54,7 @@ CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y CONFIG_DM_ETH=y CONFIG_ETH_DESIGNWARE=y +CONFIG_ETH_DESIGNWARE_SOCFPGA=y CONFIG_MII=y CONFIG_DM_RESET=y CONFIG_SPI=y
configs/socfpga_de10_nano_defconfig +1 -0
@@ -50,6 +50,7 @@ CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y CONFIG_DM_ETH=y CONFIG_ETH_DESIGNWARE=y +CONFIG_ETH_DESIGNWARE_SOCFPGA=y CONFIG_MII=y CONFIG_DM_RESET=y CONFIG_SPI=y
configs/socfpga_de1_soc_defconfig +1 -0
@@ -49,6 +49,7 @@ CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y CONFIG_DM_ETH=y CONFIG_ETH_DESIGNWARE=y +CONFIG_ETH_DESIGNWARE_SOCFPGA=y CONFIG_MII=y CONFIG_DM_RESET=y CONFIG_SPI=y
configs/socfpga_is1_defconfig +1 -0
@@ -54,6 +54,7 @@ CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y CONFIG_DM_ETH=y CONFIG_ETH_DESIGNWARE=y +CONFIG_ETH_DESIGNWARE_SOCFPGA=y CONFIG_MII=y CONFIG_DM_RESET=y CONFIG_SPI=y
configs/socfpga_sockit_defconfig +1 -0
@@ -60,6 +60,7 @@ CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y CONFIG_DM_ETH=y CONFIG_ETH_DESIGNWARE=y +CONFIG_ETH_DESIGNWARE_SOCFPGA=y CONFIG_MII=y CONFIG_DM_RESET=y CONFIG_SPI=y
configs/socfpga_socrates_defconfig +1 -0
@@ -60,6 +60,7 @@ CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y CONFIG_DM_ETH=y CONFIG_ETH_DESIGNWARE=y +CONFIG_ETH_DESIGNWARE_SOCFPGA=y CONFIG_MII=y CONFIG_DM_RESET=y CONFIG_SPI=y
configs/socfpga_sr1500_defconfig +1 -0
@@ -60,6 +60,7 @@ CONFIG_PHY_MARVELL=y CONFIG_DM_ETH=y CONFIG_PHY_GIGE=y CONFIG_ETH_DESIGNWARE=y +CONFIG_ETH_DESIGNWARE_SOCFPGA=y CONFIG_MII=y CONFIG_DM_RESET=y CONFIG_SPI=y
configs/socfpga_vining_fpga_defconfig +1 -0
@@ -76,6 +76,7 @@ CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y CONFIG_DM_ETH=y CONFIG_ETH_DESIGNWARE=y +CONFIG_ETH_DESIGNWARE_SOCFPGA=y CONFIG_MII=y CONFIG_DM_RESET=y CONFIG_SPI=y
Signature · 1 line
2.17.1
PATCH v2 2/3 arm: socfpga: gen5 enable designware_socfpga
Quoted 7 lines · Simon Goldschmidt
Enable the socfpga specific designware ethernet driver for all Gen5 and Arria10 defconfigs.
This is required to remove the hacky reset and phy mode handling in
arch/arm/mach-socfpga.Signed-off-by Simon Goldschmidt <[email protected]>
Can't the designware driver Kconfig entry just imply DESIGNWARE_SOCFPGA if ARCH_SOCFPGA ?
Signature · 2 lines
Best regards, Marek Vasut
PATCH v2 2/3 arm: socfpga: gen5 enable designware_socfpga
Am 11.01.2019 um 23:04 schrieb Marek Vasut:
Quoted 11 lines · Simon Goldschmidt
Quoted 7 lines
Enable the socfpga specific designware ethernet driver for all Gen5 and Arria10 defconfigs.
This is required to remove the hacky reset and phy mode handling in
arch/arm/mach-socfpga.Signed-off-by Simon Goldschmidt <[email protected]>Can't the designware driver
Kconfigentry just implyDESIGNWARE_SOCFPGAifARCH_SOCFPGA?
Yes it can. I just didn't know if that's acceptable. But since those two options are just next to each other in the Kconfig file, maybe it's ok.
Regards,
Simon
PATCH v2 2/3 arm: socfpga: gen5 enable designware_socfpga
Quoted 8 lines · Simon Goldschmidt
Am 11.01.2019 um 23:04 schrieb Marek Vasut:
Quoted 7 lines · Simon Goldschmidt
Quoted 6 lines
Enable the socfpga specific designware ethernet driver for all Gen5 and Arria10 defconfigs.
This is required to remove the hacky reset and phy mode handling in
arch/arm/mach-socfpga.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Simon Goldschmidt <[email protected]>Can't the designware driver
Kconfigentry just implyDESIGNWARE_SOCFPGAifARCH_SOCFPGA?Yes it can. I just didn't know if that's acceptable. But since those two options are just next to each other in the
Kconfigfile, maybe it's ok.
Presumably it's a good idea to declutter defconfigs.
Signature · 2 lines
Best regards, Marek Vasut
PATCH v2 3/3 arm: socfpga: gen5: remove hacked ETH RST handling
In reply to Simon GoldschmidtThe 'dwmac_socfpga' ETH driver can now get the MACs out of reset via the socfpga reset driver and can set PHY mode via syscon.
This means we can now remove the ad-hoc code to do this from arch/arm/mach-socfpga.
---
Changes in v2: None
.../mach-socfpga/include/mach/reset_manager.h | 2 - arch/arm/mach-socfpga/misc.c | 65 ------------------- arch/arm/mach-socfpga/misc_gen5.c | 44 +------------ 3 files changed, 1 insertion(+), 110 deletions(-)
arch/arm/mach-socfpga/include/mach/reset_manager.h +0 -2
@@ -10,8 +10,6 @@ void reset_cpu(ulong addr);void socfpga_per_reset (u32 reset,int set);void socfpga_per_reset_all (void ); -int socfpga_eth_reset_common (void (*resetfn)(const u8 of_reset_id, -const u8 phymode));#define RSTMGR_CTRL_SWWARMRSTREQ_LSB 1
arch/arm/mach-socfpga/misc.c +0 -65
71 lines not on this page · raw message
arch/arm/mach-socfpga/misc_gen5.c +1 -43
56 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 3/3 arm: socfpga: gen5: remove hacked ETH RST handling
Quoted 7 lines · Simon Goldschmidt
The '
dwmac_socfpga' ETH driver can now get the MACs out of reset via the socfpga reset driver and can set PHY mode via syscon.This means we can now remove the ad-hoc code to do this from
arch/arm/mach-socfpga.Signed-off-by Simon Goldschmidt <[email protected]>
Signature · 2 lines
Best regards, Marek Vasut