Skip to contentSkip to conversation

arm: socpfpga: gen5 clean up ETH RST & PHY mode

PATCH Superseded Simon Goldschmidt 2 participants 14 messages Jan 10, 2019

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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 designware_socfpga net driver and remove the old ad-hoc code.

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              |  3 +
 configs/socfpga_cyclone5_defconfig            |  3 +
 configs/socfpga_dbm_soc1_defconfig            |  3 +
 configs/socfpga_de0_nano_soc_defconfig        |  3 +
 configs/socfpga_de10_nano_defconfig           |  3 +
 configs/socfpga_de1_soc_defconfig             |  3 +
 configs/socfpga_is1_defconfig                 |  3 +
 configs/socfpga_sockit_defconfig              |  3 +
 configs/socfpga_socrates_defconfig            |  3 +
 configs/socfpga_sr1500_defconfig              |  3 +
 configs/socfpga_vining_fpga_defconfig         |  3 +
 drivers/net/dwmac_socfpga.c                   | 14 ++--
 15 files changed, 43 insertions(+), 115 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 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.

Tested on socfpga_socrates (where the 2nd MAC is connected, so a shift offset is required).

---

 drivers/net/dwmac_socfpga.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/dwmac_socfpga.c +9 -5
index 08fc9677c4..309da69647 100644
@@ -27,6 +27,7 @@ struct dwmac_socfpga_platdata {
 	struct dw_eth_pdata	dw_eth_pdata;
 	enum dwmac_type		type;
 	void			*phy_intf;
+	u32			reg_shift;
 };
 
 static int dwmac_socfpga_ofdata_to_platdata(struct udevice *dev)
@@ -63,6 +64,7 @@ static int dwmac_socfpga_ofdata_to_platdata(struct udevice *dev)
 	}
 
 	pdata->phy_intf = range + args.args[0];
+	pdata->reg_shift = args.args[1];
 
 	/*
 	 * Sadly, the Altera DT bindings don't have SoC-specific compatibles,
@@ -88,9 +90,11 @@ static int dwmac_socfpga_probe(struct udevice *dev)
 	struct eth_pdata *edata = &pdata->dw_eth_pdata.eth_pdata;
 	struct reset_ctl_bulk reset_bulk;
 	int ret;
-	u8 modereg;
+	u32 modereg;
+	u32 modemask;
 
-	if (pdata->type == DWMAC_SOCFPGA_ARRIA10) {
+	if (pdata->type == DWMAC_SOCFPGA_ARRIA10 ||
+	    pdata->type == DWMAC_SOCFPGA_GEN5) {
 		switch (edata->phy_interface) {
 		case PHY_INTERFACE_MODE_MII:
 		case PHY_INTERFACE_MODE_GMII:
@@ -115,9 +119,9 @@ static int dwmac_socfpga_probe(struct udevice *dev)
 
 		reset_assert_bulk(&reset_bulk);
 
-		clrsetbits_le32(pdata->phy_intf,
-				SYSMGR_EMACGRP_CTRL_PHYSEL_MASK,
-				modereg);
+		modemask = SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << pdata->reg_shift;
+		clrsetbits_le32(pdata->phy_intf, modemask,
+				modereg << pdata->reg_shift);
 
 		reset_release_bulk(&reset_bulk);
 	}
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/3 net: designware: socfpga: adapt to Gen5

Hi Marek,

Am 10.01.2019 um 20:49 schrieb Simon Goldschmidt:

Quoted 40 lines

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.

Tested on socfpga_socrates (where the 2nd MAC is connected, so a shift offset is required).

---

  drivers/net/dwmac_socfpga.c | 14 +++++++++-----
  1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/dwmac_socfpga.c +2 -0
index 08fc9677c4..309da69647 100644
@@ -27,6 +27,7 @@ struct dwmac_socfpga_platdata {
  	struct dw_eth_pdata	dw_eth_pdata;
  	enum dwmac_type		type;
  	void			*phy_intf;
+	u32			reg_shift;
  };
 
  static int dwmac_socfpga_ofdata_to_platdata(struct udevice *dev)
@@ -63,6 +64,7 @@ static int dwmac_socfpga_ofdata_to_platdata(struct udevice *dev)
  	}
 
  	pdata->phy_intf = range + args.args[0];
+	pdata->reg_shift = args.args[1];
 
  	/*
  	 * Sadly, the Altera DT bindings don't have SoC-specific compatibles,

drivers/net/dwmac_socfpga.c static int dwmac_socfpga_probe(struct udevice *dev) · line 97

Quoted 10 lines
drivers/net/dwmac_socfpga.c +4 -2
@@ -88,9 +90,11 @@ static int dwmac_socfpga_probe(struct udevice *dev)
  	struct eth_pdata *edata = &pdata->dw_eth_pdata.eth_pdata;
  	struct reset_ctl_bulk reset_bulk;
  	int ret;
-	u8 modereg;
+	u32 modereg;
+	u32 modemask;
 
-	if (pdata->type == DWMAC_SOCFPGA_ARRIA10) {
+	if (pdata->type == DWMAC_SOCFPGA_ARRIA10 ||
+	    pdata->type == DWMAC_SOCFPGA_GEN5) {

I just checked: the Linux driver does not seem to have special handling for Gen5/Arria10/Stratix10. Since Gen5 and Arria10 now both work and the registers for Stratix10 seem the same as for Arria10, could we maybe drop this special handling?

That would mean we could drop this whole 'type' and the 'enum dwmac_type'...

Regards,
Simon

Quoted 17 lines
drivers/net/dwmac_socfpga.c +3 -3
  		switch (edata->phy_interface) {
  		case PHY_INTERFACE_MODE_MII:
  		case PHY_INTERFACE_MODE_GMII:
@@ -115,9 +119,9 @@ static int dwmac_socfpga_probe(struct udevice *dev)
 
  		reset_assert_bulk(&reset_bulk);
 
-		clrsetbits_le32(pdata->phy_intf,
-				SYSMGR_EMACGRP_CTRL_PHYSEL_MASK,
-				modereg);
+		modemask = SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << pdata->reg_shift;
+		clrsetbits_le32(pdata->phy_intf, modemask,
+				modereg << pdata->reg_shift);
 
  		reset_release_bulk(&reset_bulk);
  	}
#3 lore raw

PATCH 1/3 net: designware: socfpga: adapt to Gen5

Quoted 57 lines · Simon Goldschmidt

Hi Marek,

Am 10.01.2019 um 20:49 schrieb Simon Goldschmidt:

Quoted 39 lines

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.

Tested on socfpga_socrates (where the 2nd MAC is connected, so a shift offset is required).

---

  drivers/net/dwmac_socfpga.c | 14 +++++++++-----

  1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/dwmac_socfpga.c +2 -0
index 08fc9677c4..309da69647 100644
@@ -27,6 +27,7 @@ struct dwmac_socfpga_platdata {
       struct dw_eth_pdata    dw_eth_pdata;
       enum dwmac_type        type;
       void            *phy_intf;
+    u32            reg_shift;
   };
     static int dwmac_socfpga_ofdata_to_platdata(struct udevice *dev)
@@ -63,6 +64,7 @@ static int dwmac_socfpga_ofdata_to_platdata(struct
 udevice *dev)
       }
         pdata->phy_intf = range + args.args[0];
+    pdata->reg_shift = args.args[1];
         /*
        * Sadly, the Altera DT bindings don't have SoC-specific
 compatibles,

drivers/net/dwmac_socfpga.c static int dwmac_socfpga_probe(struct udevice *dev) · line 97

Quoted 9 lines
drivers/net/dwmac_socfpga.c +4 -1
@@ -88,9 +90,11 @@ static int dwmac_socfpga_probe(struct udevice *dev)
       struct eth_pdata *edata = &pdata->dw_eth_pdata.eth_pdata;
       struct reset_ctl_bulk reset_bulk;
       int ret;
-    u8 modereg;
+    u32 modereg;
+    u32 modemask;
   -    if (pdata->type == DWMAC_SOCFPGA_ARRIA10) {
+    if (pdata->type == DWMAC_SOCFPGA_ARRIA10 ||
+        pdata->type == DWMAC_SOCFPGA_GEN5) {

I just checked: the Linux driver does not seem to have special handling for Gen5/Arria10/Stratix10. Since Gen5 and Arria10 now both work and the registers for Stratix10 seem the same as for Arria10, could we maybe drop this special handling?

Quoted 2 lines

That would mean we could drop this whole 'type' and the 'enum dwmac_type'...

I seem to remember the register layout for selecting the PHY mode on Gen5 and Arria10 was different, please check the datasheets. Of course, the less special-casing, the better.

Signature · 2 lines
Best regards,
Marek Vasut
#4 lore raw

PATCH 1/3 net: designware: socfpga: adapt to Gen5

Am Do., 10. Jan. 2019, 21:38 hat Marek Vasut <[email protected]> geschrieben:

Quoted 58 lines · Simon Goldschmidt
Quoted 57 lines

Hi Marek,

Am 10.01.2019 um 20:49 schrieb Simon Goldschmidt:

Quoted 39 lines

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.

Tested on socfpga_socrates (where the 2nd MAC is connected, so a shift offset is required).

---

  drivers/net/dwmac_socfpga.c | 14 +++++++++-----
  1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/dwmac_socfpga.c +2 -0
index 08fc9677c4..309da69647 100644
@@ -27,6 +27,7 @@ struct dwmac_socfpga_platdata {
      struct dw_eth_pdata    dw_eth_pdata;
      enum dwmac_type        type;
      void            *phy_intf;
+    u32            reg_shift;
  };
    static int dwmac_socfpga_ofdata_to_platdata(struct udevice *dev)
@@ -63,6 +64,7 @@ static int dwmac_socfpga_ofdata_to_platdata(struct
 udevice *dev)
      }
        pdata->phy_intf = range + args.args[0];
+    pdata->reg_shift = args.args[1];
        /*
       * Sadly, the Altera DT bindings don't have SoC-specific
 compatibles,

drivers/net/dwmac_socfpga.c static int dwmac_socfpga_probe(struct udevice *dev) · line 97

Quoted 9 lines
drivers/net/dwmac_socfpga.c +4 -1
@@ -88,9 +90,11 @@ static int dwmac_socfpga_probe(struct udevice *dev)
      struct eth_pdata *edata = &pdata->dw_eth_pdata.eth_pdata;
      struct reset_ctl_bulk reset_bulk;
      int ret;
-    u8 modereg;
+    u32 modereg;
+    u32 modemask;
  -    if (pdata->type == DWMAC_SOCFPGA_ARRIA10) {
+    if (pdata->type == DWMAC_SOCFPGA_ARRIA10 ||
+        pdata->type == DWMAC_SOCFPGA_GEN5) {

I just checked: the Linux driver does not seem to have special handling for Gen5/Arria10/Stratix10. Since Gen5 and Arria10 now both work and the registers for Stratix10 seem the same as for Arria10, could we maybe drop this special handling?

Quoted 7 lines
Quoted 2 lines

That would mean we could drop this whole 'type' and the 'enum dwmac_type'...

I seem to remember the register layout for selecting the PHY mode on Gen5 and Arria10 was different, please check the datasheets. Of course, the less special-casing, the better.

Yes, the register layout is different. But the reg_shift value takes care of that. Luckily, the bits have the same meaning even if the offset is different.

What remains is the special case for Stratix10. Looking at the Linux driver and the register descriptions, I think we can drop the special cases, but someone would need to test it on Stratix10...

Regards,
Simon

#5 lore raw

PATCH 1/3 net: designware: socfpga: adapt to Gen5

Quoted 79 lines · Simon Goldschmidt

Am Do., 10. Jan. 2019, 21:38 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

    On 1/10/19 8:54 PM, Simon Goldschmidt wrote:
    > Hi Marek,
    >
    > Am 10.01.2019 um 20:49 schrieb 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.
    >>
    >> Tested on socfpga_socrates (where the 2nd MAC is connected, so a
    shift
    >> offset is required).
    >>
    >> Signed-off-by: Simon Goldschmidt <[email protected]
    <mailto:[email protected]>>
    >> ---
    >>
    >>   drivers/net/dwmac_socfpga.c | 14 +++++++++-----
    >>   1 file changed, 9 insertions(+), 5 deletions(-)
    >>
    >> diff --git a/drivers/net/dwmac_socfpga.c
    b/drivers/net/dwmac_socfpga.c
    >> index 08fc9677c4..309da69647 100644
    >> --- a/drivers/net/dwmac_socfpga.c
    >> +++ b/drivers/net/dwmac_socfpga.c
    >> @@ -27,6 +27,7 @@ struct dwmac_socfpga_platdata {
    >>       struct dw_eth_pdata    dw_eth_pdata;
    >>       enum dwmac_type        type;
    >>       void            *phy_intf;
    >> +    u32            reg_shift;
    >>   };
    >>     static int dwmac_socfpga_ofdata_to_platdata(struct udevice *dev)
    >> @@ -63,6 +64,7 @@ static int dwmac_socfpga_ofdata_to_platdata(struct
    >> udevice *dev)
    >>       }
    >>         pdata->phy_intf = range + args.args[0];
    >> +    pdata->reg_shift = args.args[1];
    >>         /*
    >>        * Sadly, the Altera DT bindings don't have SoC-specific
    >> compatibles,
    >> @@ -88,9 +90,11 @@ static int dwmac_socfpga_probe(struct udevice
    *dev)
    >>       struct eth_pdata *edata = &pdata->dw_eth_pdata.eth_pdata;
    >>       struct reset_ctl_bulk reset_bulk;
    >>       int ret;
    >> -    u8 modereg;
    >> +    u32 modereg;
    >> +    u32 modemask;
    >>   -    if (pdata->type == DWMAC_SOCFPGA_ARRIA10) {
    >> +    if (pdata->type == DWMAC_SOCFPGA_ARRIA10 ||
    >> +        pdata->type == DWMAC_SOCFPGA_GEN5) {
    >
    > I just checked: the Linux driver does not seem to have special
    handling
    > for Gen5/Arria10/Stratix10. Since Gen5 and Arria10 now both work
    and the
    > registers for Stratix10 seem the same as for Arria10, could we maybe
    > drop this special handling?
    >
    > That would mean we could drop this whole 'type' and the 'enum
    > dwmac_type'...

    I seem to remember the register layout for selecting the PHY mode on
    Gen5 and Arria10 was different, please check the datasheets. Of course,
    the less special-casing, the better.
Quoted 3 lines

Yes, the register layout is different. But the reg_shift value takes care of that. Luckily, the bits have the same meaning even if the offset is different.

Fantastic

Quoted 3 lines

What remains is the special case for Stratix10. Looking at the Linux driver and the register descriptions, I think we can drop the special cases, but someone would need to test it on Stratix10...

+CC Joyce.

Signature · 2 lines
Best regards,
Marek Vasut
#6 lore raw

PATCH 2/3 arm: socfpga: gen5 enable designware_socfpga

In reply to Simon Goldschmidt

Enable the socfpga specific designeware ethernet driver for all Gen5 and Arria10 defconfigs. To make it work, enable REGMAP and SYSCON, too.

This is required to remove the hacky reset and phy mode handling in arch/arm/mach-socfpga.

---

 configs/socfpga_arria5_defconfig       | 3 +++
 configs/socfpga_cyclone5_defconfig     | 3 +++
 configs/socfpga_dbm_soc1_defconfig     | 3 +++
 configs/socfpga_de0_nano_soc_defconfig | 3 +++
 configs/socfpga_de10_nano_defconfig    | 3 +++
 configs/socfpga_de1_soc_defconfig      | 3 +++
 configs/socfpga_is1_defconfig          | 3 +++
 configs/socfpga_sockit_defconfig       | 3 +++
 configs/socfpga_socrates_defconfig     | 3 +++
 configs/socfpga_sr1500_defconfig       | 3 +++
 configs/socfpga_vining_fpga_defconfig  | 3 +++
 11 files changed, 33 insertions(+)
configs/socfpga_arria5_defconfig +3 -0
index 0e5e74a621..15cc16b111 100644
@@ -41,6 +41,8 @@ CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria5_socdk"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
 CONFIG_DFU_MMC=y
 CONFIG_FPGA_SOCFPGA=y
 CONFIG_DM_GPIO=y
@@ -59,6 +61,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 +3 -0
index e8de0f5709..2a432d2007 100644
@@ -41,6 +41,8 @@ CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_socdk"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
 CONFIG_DFU_MMC=y
 CONFIG_FPGA_SOCFPGA=y
 CONFIG_DM_GPIO=y
@@ -60,6 +62,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 +3 -0
index b6f4f8a3dd..e7726dc3cc 100644
@@ -42,6 +42,8 @@ CONFIG_CMD_FS_GENERIC=y
 CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_dbm_soc1"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SPL_DM=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
 CONFIG_DFU_MMC=y
 CONFIG_FPGA_SOCFPGA=y
 CONFIG_DM_GPIO=y
@@ -54,6 +56,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 +3 -0
index 9a89bb5d68..33a412d340 100644
@@ -41,6 +41,8 @@ CONFIG_CMD_UBI=y
 CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_de0_nano_soc"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SPL_DM=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
 CONFIG_DFU_MMC=y
 CONFIG_FPGA_SOCFPGA=y
 CONFIG_DM_GPIO=y
@@ -54,6 +56,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 +3 -0
index db516891ba..662e895af2 100644
@@ -37,6 +37,8 @@ CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0"
 CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_de10_nano"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SPL_DM=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
 CONFIG_DFU_MMC=y
 CONFIG_FPGA_SOCFPGA=y
 CONFIG_DM_GPIO=y
@@ -50,6 +52,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 +3 -0
index 5bed755723..d02bf1c6cf 100644
@@ -37,6 +37,8 @@ CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0"
 CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_de1_soc"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SPL_DM=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
 CONFIG_FPGA_SOCFPGA=y
 CONFIG_DM_GPIO=y
 CONFIG_DWAPB_GPIO=y
@@ -49,6 +51,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 +3 -0
index 682e58fdb8..97125efae4 100644
@@ -38,6 +38,8 @@ CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_is1"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_SYS_BOOTCOUNT_ADDR=0xfffffff8
 CONFIG_FPGA_SOCFPGA=y
@@ -54,6 +56,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 +3 -0
index abbbcb94d3..a1019d12fc 100644
@@ -41,6 +41,8 @@ CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_sockit"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
 CONFIG_DFU_MMC=y
 CONFIG_FPGA_SOCFPGA=y
 CONFIG_DM_GPIO=y
@@ -60,6 +62,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 +3 -0
index 53f8d3c348..4ffce80793 100644
@@ -42,6 +42,8 @@ CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_socrates"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
 CONFIG_DFU_MMC=y
 CONFIG_FPGA_SOCFPGA=y
 CONFIG_DM_GPIO=y
@@ -60,6 +62,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 +3 -0
index 97366cdfff..d4720e5580 100644
@@ -42,6 +42,8 @@ CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_sr1500"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_SYS_BOOTCOUNT_ADDR=0xfffffff8
 CONFIG_FPGA_SOCFPGA=y
@@ -60,6 +62,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 +3 -0
index 3eba09dcb1..c3d4b815f1 100644
@@ -47,6 +47,8 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
@@ -76,6 +78,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
#7 lore raw

PATCH 2/3 arm: socfpga: gen5 enable designware_socfpga

Quoted 6 lines · Simon Goldschmidt

Enable the socfpga specific designeware ethernet driver for all Gen5 and Arria10 defconfigs. To make it work, enable REGMAP and SYSCON, too.

This is required to remove the hacky reset and phy mode handling in arch/arm/mach-socfpga.

Can the Gen5/A10 just "imply" those two options or can the DWMAC driver "select" those two options in Kconfig ?

Signature · 2 lines
Best regards,
Marek Vasut
#8 lore raw

PATCH 2/3 arm: socfpga: gen5 enable designware_socfpga

Am Do., 10. Jan. 2019, 21:40 hat Marek Vasut <[email protected]> geschrieben:

Quoted 11 lines · Simon Goldschmidt
Quoted 6 lines

Enable the socfpga specific designeware ethernet driver for all Gen5 and Arria10 defconfigs. To make it work, enable REGMAP and SYSCON, too.

This is required to remove the hacky reset and phy mode handling in arch/arm/mach-socfpga.

Can the Gen5/A10 just "imply" those two options or can the DWMAC driver "select" those two options in Kconfig ?

Hmm, I'll try that.

Regards,
Simon

Quoted 1 line
#9 lore raw

PATCH 2/3 arm: socfpga: gen5 enable designware_socfpga

Quoted 10 lines · Simon Goldschmidt

Am Do., 10. Jan. 2019, 21:40 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

On 1/10/19 8:49 PM, Simon Goldschmidt wrote:
> Enable the socfpga specific designeware ethernet driver for all Gen5 > and Arria10 defconfigs. To make it work, enable REGMAP and SYSCON, > too.
>

Quoted 8 lines

> This is required to remove the hacky reset and phy mode handling in > arch/arm/mach-socfpga.

Can the Gen5/A10 just "imply" those two options or can the DWMAC driver "select" those two options in Kconfig ?

Hmm, I'll try that.

And if you get bored, you can imply as much common stuff from the defconfigs as possible ;-)

Signature · 2 lines
Best regards,
Marek Vasut
#10 lore raw

PATCH 3/3 arm: socfpga: gen5: remove hacked ETH RST handling

In reply to Simon Goldschmidt

The 'designware_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.

---

 .../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
index d9e0b33c60..42beaecdd6 100644
@@ -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
#11 lore raw

PATCH 3/3 arm: socfpga: gen5: remove hacked ETH RST handling

Quoted 8 lines · Simon Goldschmidt

The 'designware_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.

I very much like this patch, except for the dual SoB line.

Signature · 2 lines
Best regards,
Marek Vasut
#12 lore raw

PATCH 3/3 arm: socfpga: gen5: remove hacked ETH RST handling

Am Do., 10. Jan. 2019, 21:40 hat Marek Vasut <[email protected]> geschrieben:

Quoted 12 lines · Simon Goldschmidt
Quoted 8 lines

The 'designware_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.

I very much like this patch, except for the dual SoB line.

D'oh! The first one was may typo, the 2nd one was by patman.

Seems like I need a V2 anyway...

Regards,
Simon

Quoted 1 line
#13 lore raw

PATCH 3/3 arm: socfpga: gen5: remove hacked ETH RST handling

Quoted 17 lines · Simon Goldschmidt

Am Do., 10. Jan. 2019, 21:40 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

On 1/10/19 8:49 PM, Simon Goldschmidt wrote:
> The 'designware_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 Goldschmdit <[email protected] <mailto:[email protected]>>
> Signed-off-by: Simon Goldschmidt <[email protected] <mailto:[email protected]>>

Quoted 6 lines

I very much like this patch, except for the dual SoB line.

D'oh! The first one was may typo, the 2nd one was by patman.

Seems like I need a V2 anyway...

I usually use git commit -sm "stuff" or git commit --amend -s

Signature · 2 lines
Best regards,
Marek Vasut