Skip to contentSkip to conversation

net: phy: add TSE PCS support to dwmac-socfpga

PATCH Superseded Ooi 2 participants 3 messages Sep 25, 2018

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Ooi

#0 lore raw

PATCH 1/1 net: phy: add TSE PCS support to dwmac-socfpga

This adds support for TSE PCS that uses SGMII adapter when the phy-mode in device tree is set to sgmii.

---
 drivers/net/Makefile           |   3 +-
 drivers/net/designware.c       |   5 ++
 drivers/net/designware.h       |   1 +
 drivers/net/dwmac_socfpga.c    | 121 +++++++++++++++++++++++++
 drivers/net/phy/altr_tse_pcs.c | 197 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/phy/altr_tse_pcs.h |  59 ++++++++++++
 6 files changed, 385 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/phy/altr_tse_pcs.c
 create mode 100644 drivers/net/phy/altr_tse_pcs.h
drivers/net/Makefile +2 -1
index 48a2878..c2333b5 100644
@@ -14,7 +14,7 @@ obj-$(CONFIG_CALXEDA_XGMAC) += calxedaxgmac.o
 obj-$(CONFIG_CS8900) += cs8900.o
 obj-$(CONFIG_TULIP) += dc2114x.o
 obj-$(CONFIG_ETH_DESIGNWARE) += designware.o
-obj-$(CONFIG_ETH_DESIGNWARE_SOCFPGA) += dwmac_socfpga.o
+obj-$(CONFIG_ETH_DESIGNWARE_SOCFPGA) += dwmac-socfpga.o
 obj-$(CONFIG_DRIVER_DM9000) += dm9000x.o
 obj-$(CONFIG_DNET) += dnet.o
 obj-$(CONFIG_E1000) += e1000.o
@@ -73,3 +73,4 @@ obj-$(CONFIG_PIC32_ETH) += pic32_mdio.o pic32_eth.o
 obj-$(CONFIG_DWC_ETH_QOS) += dwc_eth_qos.o
 obj-$(CONFIG_FSL_PFE) += pfe_eth/
 obj-$(CONFIG_SNI_AVE) += sni_ave.o
+dwmac-socfpga-objs := phy/altr_tse_pcs.o dwmac_socfpga.o
drivers/net/designware.c +5 -0
index 19db0a8..666cf41 100644
@@ -235,6 +235,8 @@ 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;
+	struct udevice *dev = priv->phydev->dev;
+	struct dw_eth_pdata *dw_pdata = dev_get_platdata(dev);
 
 	if (!phydev->link) {
 		printf("%s: No link.\n", phydev->dev->name);
@@ -254,6 +256,9 @@ static int dw_adjust_link(struct dw_eth_dev *priv, struct eth_mac_regs *mac_p,
 
 	writel(conf, &mac_p->conf);
 
+	if (dw_pdata->pcs_adjust_link)
+		dw_pdata->pcs_adjust_link(dev, phydev);
+
 	printf("Speed: %d, %s duplex%s\n", phydev->speed,
 	       (phydev->duplex) ? "full" : "half",
 	       (phydev->port == PORT_FIBRE) ? ", fiber mode" : "");
drivers/net/designware.h +1 -0
index dea12b7..3a5a93f 100644
@@ -255,6 +255,7 @@ extern const struct eth_ops designware_eth_ops;
 struct dw_eth_pdata {
 	struct eth_pdata eth_pdata;
 	u32 reset_delays[3];
+	void (*pcs_adjust_link)(struct udevice *dev, struct phy_device *phydev);
 };
 
 int designware_eth_init(struct dw_eth_dev *priv, u8 *enetaddr);
drivers/net/dwmac_socfpga.c +121 -0

153 lines not on this page · raw message

drivers/net/phy/altr_tse_pcs.c new file +197 -0

197 lines not on this page · raw message

drivers/net/phy/altr_tse_pcs.h new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 net: phy: add TSE PCS support to dwmac-socfpga

Quoted 2 lines · Joyce

This adds support for TSE PCS that uses SGMII adapter when the phy-mode in device tree is set to sgmii.

Can you add a bit more description to your commit message? TSE(Triple Speed Ethernet), but what is PCS?

Quoted 18 lines
---
 drivers/net/Makefile           |   3 +-
 drivers/net/designware.c       |   5 ++
 drivers/net/designware.h       |   1 +
 drivers/net/dwmac_socfpga.c    | 121 +++++++++++++++++++++++++
 drivers/net/phy/altr_tse_pcs.c | 197 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/phy/altr_tse_pcs.h |  59 ++++++++++++
 6 files changed, 385 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/phy/altr_tse_pcs.c
 create mode 100644 drivers/net/phy/altr_tse_pcs.h
drivers/net/Makefile +0 -0
index 48a2878..c2333b5 100644

drivers/net/Makefile obj-$(CONFIG_CALXEDA_XGMAC) += calxedaxgmac.o · line 17

Quoted 5 lines
drivers/net/Makefile +1 -1
@@ -14,7 +14,7 @@ obj-$(CONFIG_CALXEDA_XGMAC) += calxedaxgmac.o
 obj-$(CONFIG_CS8900) += cs8900.o
 obj-$(CONFIG_TULIP) += dc2114x.o
 obj-$(CONFIG_ETH_DESIGNWARE) += designware.o
-obj-$(CONFIG_ETH_DESIGNWARE_SOCFPGA) += dwmac_socfpga.o
+obj-$(CONFIG_ETH_DESIGNWARE_SOCFPGA) += dwmac-socfpga.o

Huh? What's this change for?

Also, I'm getting these compile errors against the latest U-Boot, top commit = "284b27cf81da10d55 Merge branch 'master' of
git://git.denx.de/u-boot-mips" :

drivers/net/dwmac_socfpga.c: In function ‘socfpga_dw_tse_pcs_init’:
drivers/net/dwmac_socfpga.c:67:9: warning: implicit declaration of function ‘mbox_get_fpga_config_status’ [-Wimplicit-function-declaration]

   ret = mbox_get_fpga_config_status(MBOX_CONFIG_STATUS);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  LD      common/built-in.o
  LD      drivers/net/dwmac-socfpga.o
  LD      drivers/net/built-in.o
  LD      cmd/built-in.o
  CC      lib/smbios.o
  CC      lib/display_options.o
  CC      lib/efi_loader/efi_reloc.o
  CC      lib/efi_loader/helloworld.o
  LD      lib/efi_loader/helloworld_efi.so

OBJCOPY lib/efi_loader/helloworld.efi
rm lib/efi_loader/helloworld_efi.so lib/efi_loader/helloworld.o
LD lib/built-in.o
LD u-boot
drivers/net/built-in.o: In function `dwmac_socfpga_ofdata_to_platdata':
/home/dinguyen/linux_dev/u-boot/drivers/net/dwmac_socfpga.c:170:
undefined reference to `syscon_node_to_regmap' /home/dinguyen/linux_dev/u-boot/drivers/net/dwmac_socfpga.c:177:
undefined reference to regmap_get_range' drivers/net/built-in.o: In function socfpga_dw_tse_pcs_init':
/home/dinguyen/linux_dev/u-boot/drivers/net/dwmac_socfpga.c:67:
undefined reference to `mbox_get_fpga_config_status'

In the future, please test before submitting patches.

Thanks,
Dinh

#2 lore raw

PATCH 1/1 net: phy: add TSE PCS support to dwmac-socfpga

Quoted 67 lines · Dinh Nguyen
Quoted 2 lines · Joyce

This adds support for TSE PCS that uses SGMII adapter when the phy-mode in device tree is set to sgmii.

Can you add a bit more description to your commit message? TSE(Triple Speed Ethernet), but what is PCS?

Quoted 18 lines
---
 drivers/net/Makefile           |   3 +-
 drivers/net/designware.c       |   5 ++
 drivers/net/designware.h       |   1 +
 drivers/net/dwmac_socfpga.c    | 121 +++++++++++++++++++++++++
 drivers/net/phy/altr_tse_pcs.c | 197 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/phy/altr_tse_pcs.h |  59 ++++++++++++
 6 files changed, 385 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/phy/altr_tse_pcs.c
 create mode 100644 drivers/net/phy/altr_tse_pcs.h
drivers/net/Makefile +0 -0
index 48a2878..c2333b5 100644

drivers/net/Makefile obj-$(CONFIG_CALXEDA_XGMAC) += calxedaxgmac.o · line 17

Quoted 5 lines
drivers/net/Makefile +1 -1
@@ -14,7 +14,7 @@ obj-$(CONFIG_CALXEDA_XGMAC) += calxedaxgmac.o
 obj-$(CONFIG_CS8900) += cs8900.o
 obj-$(CONFIG_TULIP) += dc2114x.o
 obj-$(CONFIG_ETH_DESIGNWARE) += designware.o
-obj-$(CONFIG_ETH_DESIGNWARE_SOCFPGA) += dwmac_socfpga.o
+obj-$(CONFIG_ETH_DESIGNWARE_SOCFPGA) += dwmac-socfpga.o

Huh? What's this change for?

Also, I'm getting these compile errors against the latest U-Boot, top commit = "284b27cf81da10d55 Merge branch 'master' of
git://git.denx.de/u-boot-mips" :

drivers/net/dwmac_socfpga.c: In function ‘socfpga_dw_tse_pcs_init’:
drivers/net/dwmac_socfpga.c:67:9: warning: implicit declaration of function ‘mbox_get_fpga_config_status’ [-Wimplicit-function-declaration]

   ret = mbox_get_fpga_config_status(MBOX_CONFIG_STATUS);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  LD      common/built-in.o
  LD      drivers/net/dwmac-socfpga.o
  LD      drivers/net/built-in.o
  LD      cmd/built-in.o
  CC      lib/smbios.o
  CC      lib/display_options.o
  CC      lib/efi_loader/efi_reloc.o
  CC      lib/efi_loader/helloworld.o
  LD      lib/efi_loader/helloworld_efi.so

OBJCOPY lib/efi_loader/helloworld.efi
rm lib/efi_loader/helloworld_efi.so lib/efi_loader/helloworld.o
LD lib/built-in.o
LD u-boot
drivers/net/built-in.o: In function `dwmac_socfpga_ofdata_to_platdata':
/home/dinguyen/linux_dev/u-boot/drivers/net/dwmac_socfpga.c:170:
undefined reference to `syscon_node_to_regmap' /home/dinguyen/linux_dev/u-boot/drivers/net/dwmac_socfpga.c:177:
undefined reference to regmap_get_range' drivers/net/built-in.o: In function socfpga_dw_tse_pcs_init':
/home/dinguyen/linux_dev/u-boot/drivers/net/dwmac_socfpga.c:67:
undefined reference to `mbox_get_fpga_config_status'

Quoted 2 lines

In the future, please test before submitting patches.

For the arria10 defconfig, I get the following compile error:

drivers/net/dwmac_socfpga.c: In function ‘socfpga_dw_tse_pcs_init’:
drivers/net/dwmac_socfpga.c:67:9: warning: implicit declaration of function ‘mbox_get_fpga_config_status’ [-Wimplicit-function-declaration]

   ret = mbox_get_fpga_config_status(MBOX_CONFIG_STATUS);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/net/dwmac_socfpga.c:74:3: error: too many arguments to function ‘socfpga_bridges_reset’
socfpga_bridges_reset(1);
^~~~~~~~~~~~~~~~~~~~~
In file included from ./arch/arm/include/asm/arch/reset_manager.h:44:0,
from drivers/net/dwmac_socfpga.c:21:
./arch/arm/include/asm/arch/reset_manager_arria10.h:15:5: note: declared here
int socfpga_bridges_reset(void);

Dinh