ls1028a: networking support
Subsystems (2)
v3 cover ls1028a: networking support
This patch set introduces ENETC ethernet and MDIO drivers, integrated in LS1028A NXP device and enables networking on the two existing boards.
The SGMII interface labeled MAC0 is now functional on the reference design board (RDB). The RDB also features four switch ports, not enabled yet. On the development system (QDS) the RGMII port is now functional. Add-on cards are not yet enabled.
Depends on:
- DM MDIO: https://patchwork.ozlabs.org/patch/1109368/
- PCI EA and FLR: https://patchwork.ozlabs.org/patch/1111608/
Changes in v3:
- Added cover letter
- Added serdes (SoC internal PHYs) configuration code
- Use a single config option for ethernet and MDIO drivers as they are cross dependent
- Use net_rx_packets for Rx and set SYS_RX_ETH_BUFFER to 8, minimum BD ring size supported by ENETC
- MDIO driver now resides in its own file, read/write functions are reused by ethernet driver to access serdes
- PCI IDs for our functions are no longer defined in pci_ids.h
- several cosmetic updates, static functions, comments
Alex Marginean (6):
include: configs: ls1028a: set SYS_RX_ETH_BUFFER to 8
drivers: net: add NXP ENETC ethernet driver
drivers: net: add NXP ENETC MDIO driver
drivers: net: apply serdes configuration for ENETC Ethernet interfaces
arm: dts: ls1028a updates for network interfaces
configs: ls1028a: enable networking options in rds, qds defconfig
arch/arm/dts/fsl-ls1028a-qds.dts | 13 + arch/arm/dts/fsl-ls1028a-rdb.dts | 13 + arch/arm/dts/fsl-ls1028a.dtsi | 24 ++ configs/ls1028aqds_tfa_defconfig | 5 +- configs/ls1028ardb_tfa_defconfig | 2 + drivers/net/Kconfig | 7 + drivers/net/Makefile | 1 + drivers/net/fsl_enetc.c | 583 +++++++++++++++++++++++++++++++ drivers/net/fsl_enetc.h | 227 ++++++++++++ drivers/net/fsl_enetc_mdio.c | 149 ++++++++ include/configs/ls1028a_common.h | 4 + 11 files changed, 1027 insertions(+), 1 deletion(-) create mode 100644 drivers/net/fsl_enetc.c create mode 100644 drivers/net/fsl_enetc.h create mode 100644 drivers/net/fsl_enetc_mdio.c
Signature · 1 line
2.17.1
PATCH v3 1/6 include: configs: ls1028a: set SYS_RX_ETH_BUFFER to 8
LS1028A ethernet interfaces work with at least 8 BDs, set number of buffers to match that.
--- include/configs/ls1028a_common.h | 4 ++++ 1 file changed, 4 insertions(+)
include/configs/ls1028a_common.h +4 -0
@@ -197,4 +197,8 @@#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5 +/* Ethernet */ +/* smallest ENETC BD ring has 8 entries */ +#define CONFIG_SYS_RX_ETH_BUFFER 8 +#endif /* __L1028A_COMMON_H */
Signature · 1 line
2.17.1
PATCH v3 1/6 include: configs: ls1028a: set SYS_RX_ETH_BUFFER to 8
Hi Alex,
Quoted 14 lines · Alex Marginean
LS1028A ethernet interfaces work with at least 8 BDs, set number of buffers to match that.
Signed-off-by Alex Marginean <[email protected]>--- include/configs/ls1028a_common.h | 4 ++++ 1 file changed, 4 insertions(+)include/configs/ls1028a_common.h +0
-0
include/configs/ls1028a_common.h line 203
Quoted 7 lines
include/configs/ls1028a_common.h +4
-0@@ -197,4 +197,8 @@#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5 +/* Ethernet */ +/* smallest ENETC BD ring has 8 entries */ +#define CONFIG_SYS_RX_ETH_BUFFER 8 +
We should avoid adding more ad-hoc CONFIG_XXX macros. We should either make this a Kconfig option, or move this macro to the driver header file (eg: fsl_enetc.h) and do not prefix it with CONFIG_. If we move to driver header, this patch can be simply dropped as I see there are already macro defined in patch [2/6].
include/configs/ls1028a_common.h
Quoted 2 lines
include/configs/ls1028a_common.h +0
-1#endif /* __L1028A_COMMON_H */ --
Regards,
Bin
PATCH v3 1/6 include: configs: ls1028a: set SYS_RX_ETH_BUFFER to 8
Hi Bin,
Quoted 21 lines · Bin Meng
Hi Alex,
Quoted 17 lines · Alex Marginean
LS1028A ethernet interfaces work with at least 8 BDs, set number of buffers to match that.
Signed-off-by Alex Marginean <[email protected]>--- include/configs/ls1028a_common.h | 4 ++++ 1 file changed, 4 insertions(+)include/configs/ls1028a_common.h +0
-0@@ -197,4 +197,8 @@#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5
Quoted 10 lines
include/configs/ls1028a_common.h line 203
Quoted 4 lines
include/configs/ls1028a_common.h +4
-0+/* Ethernet */ +/* smallest ENETC BD ring has 8 entries */ +#define CONFIG_SYS_RX_ETH_BUFFER 8 +We should avoid adding more ad-hoc
CONFIG_XXXmacros. We should either make this aKconfigoption, or move this macro to the driver header file (eg:fsl_enetc.h) and do not prefix it withCONFIG_. If we move to driver header, this patch can be simply dropped as I see there are already macro defined in patch [2/6].
This is used in net.h to define PKTBUFSRX which is further used in net.c to define net_pkt_buf. I was actually planning to use net_pkt_buf instead of allocation memory in the driver, that's why I used it. I can use an enetc specific define, but then I either have to allocate packet data in the driver or put more code in to only use up to 4 (default CONFIG_SYS_RX_ETH_BUFFER value) BDs in an 8 entry BDR.
Alex
Quoted 11 lines
include/configs/ls1028a_common.h
Quoted 3 lines
include/configs/ls1028a_common.h +0
-1#endif /* __L1028A_COMMON_H */ --Regards,
Bin
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH v3 1/6 include: configs: ls1028a: set SYS_RX_ETH_BUFFER to 8
Hi Alex,
Quoted 36 lines · Alex Marginean
Hi Bin,
Quoted 21 lines · Bin Meng
Hi Alex,
Quoted 17 lines · Alex Marginean
LS1028A ethernet interfaces work with at least 8 BDs, set number of buffers to match that.
Signed-off-by Alex Marginean <[email protected]>--- include/configs/ls1028a_common.h | 4 ++++ 1 file changed, 4 insertions(+)include/configs/ls1028a_common.h +0
-0@@ -197,4 +197,8 @@#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5Quoted 10 lines
include/configs/ls1028a_common.h line 203
Quoted 4 lines
include/configs/ls1028a_common.h +4
-0+/* Ethernet */ +/* smallest ENETC BD ring has 8 entries */ +#define CONFIG_SYS_RX_ETH_BUFFER 8 +We should avoid adding more ad-hoc
CONFIG_XXXmacros. We should either make this aKconfigoption, or move this macro to the driver header file (eg:fsl_enetc.h) and do not prefix it withCONFIG_. If we move to driver header, this patch can be simply dropped as I see there are already macro defined in patch [2/6].
Quoted 6 lines
This is used in
net.hto define PKTBUFSRX which is further used innet.cto definenet_pkt_buf. I was actually planning to usenet_pkt_bufinstead of allocation memory in the driver, that's why I used it. I can use an enetc specific define, but then I either have to allocate packet data in the driver or put more code in to only use up to 4 (defaultCONFIG_SYS_RX_ETH_BUFFERvalue) BDs in an 8 entry BDR.
Ah, thanks for the clarification. I missed that! Then this looks good to me.
Regards,
Bin
PATCH v3 2/6 drivers: net: add NXP ENETC ethernet driver
In reply to Alex MargineanAdds a driver for NXP ENETC ethernet controller currently integrated in LS1028A. ENETC is a fairly straight-forward BD ring device and interfaces are presented as PCI EPs on the SoC ECAM.
--- drivers/net/Kconfig | 7 + drivers/net/Makefile | 1 + drivers/net/fsl_enetc.c | 380 ++++++++++++++++++++++++++++++++++++++++ drivers/net/fsl_enetc.h | 168 ++++++++++++++++++ 4 files changed, 556 insertions(+) create mode 100644 drivers/net/fsl_enetc.c create mode 100644 drivers/net/fsl_enetc.h
drivers/net/Kconfig +7 -0
@@ -588,4 +588,11 @@ config HIGMACV300_ETH This driver supports HIGMACV300 Ethernet controller found on HiSilicon SoCs. +config FSL_ENETC + bool "NXP ENETC Ethernet controller" + depends on DM_PCI && DM_ETH + help + This driver supports the NXP ENETC Ethernet controller found on some + of the NXP SoCs. + endif # NETDEVICES
drivers/net/Makefile +1 -0
@@ -79,3 +79,4 @@ obj-y += mscc_eswitch/ obj-$(CONFIG_HIGMACV300_ETH) += higmacv300.o obj-$(CONFIG_MDIO_SANDBOX) += mdio_sandbox.o obj-$(CONFIG_MDIO_MUX_SANDBOX) += mdio_mux_sandbox.o +obj-$(CONFIG_FSL_ENETC) += fsl_enetc.o
drivers/net/fsl_enetc.c new file +380 -0
380 lines not on this page · raw message
drivers/net/fsl_enetc.h new file +168 -0
168 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 2/6 drivers: net: add NXP ENETC ethernet driver
Quoted 7 lines · Alex Marginean
Adds a driver for NXP ENETC ethernet controller currently integrated in LS1028A. ENETC is a fairly straight-forward BD ring device and interfaces are presented as PCI EPs on the SoC ECAM.
Signed-off-by Catalin Horghidan <[email protected]>Signed-off-by Alex Marginean <[email protected]>
Quoted 9 lines
--- drivers/net/Kconfig | 7 + drivers/net/Makefile | 1 + drivers/net/fsl_enetc.c | 380 ++++++++++++++++++++++++++++++++++++++++ drivers/net/fsl_enetc.h | 168 ++++++++++++++++++ 4 files changed, 556 insertions(+) create mode 100644 drivers/net/fsl_enetc.c create mode 100644 drivers/net/fsl_enetc.h
PATCH v3 3/6 drivers: net: add NXP ENETC MDIO driver
In reply to Alex MargineanAdds a driver for the MDIO interface currently integrated in LS1028A SoC. This MDIO interface is shared by multiple ethernet interfaces and is presented as a stand-alone PCI function on the SoC ECAM. Ethernet has a functional dependency on MDIO, for simplicity there is a single config option for both.
--- drivers/net/Kconfig | 2 +- drivers/net/Makefile | 2 +- drivers/net/fsl_enetc.c | 57 ++++++++++++++ drivers/net/fsl_enetc.h | 21 +++++ drivers/net/fsl_enetc_mdio.c | 149 +++++++++++++++++++++++++++++++++++ 5 files changed, 229 insertions(+), 2 deletions(-) create mode 100644 drivers/net/fsl_enetc_mdio.c
drivers/net/Kconfig +1 -1
@@ -590,7 +590,7 @@ config HIGMACV300_ETH config FSL_ENETC bool "NXP ENETC Ethernet controller" - depends on DM_PCI && DM_ETH + depends on DM_PCI && DM_ETH && DM_MDIO help This driver supports the NXP ENETC Ethernet controller found on some of the NXP SoCs.
drivers/net/Makefile +1 -1
@@ -79,4 +79,4 @@ obj-y += mscc_eswitch/ obj-$(CONFIG_HIGMACV300_ETH) += higmacv300.o obj-$(CONFIG_MDIO_SANDBOX) += mdio_sandbox.o obj-$(CONFIG_MDIO_MUX_SANDBOX) += mdio_mux_sandbox.o -obj-$(CONFIG_FSL_ENETC) += fsl_enetc.o +obj-$(CONFIG_FSL_ENETC) += fsl_enetc.o fsl_enetc_mdio.o
drivers/net/fsl_enetc.c +57 -0
75 lines not on this page · raw message
drivers/net/fsl_enetc.h +21 -0
@@ -11,6 +11,7 @@/* PCI function IDs */ #define PCI_DEVICE_ID_ENETC_ETH 0xE100 +#define PCI_DEVICE_ID_ENETC_MDIO 0xEE01/* ENETC Ethernet controller registers */ /* Station interface register offsets */
@@ -143,6 +144,8 @@ struct enetc_priv {/* Rx/Tx buffer descriptor rings info */ struct bd_ring tx_bdr;struct bd_ring rx_bdr; + +int if_type; };/* register accessors */
@@ -165,4 +168,22 @@ struct enetc_priv {#define enetc_bdr_write (priv, t, n, off, val) \ enetc_write(priv, ENETC_BDR(t, n, off), val) +/* ENETC external MDIO registers */ +#define ENETC_MDIO_BASE 0x1c00 +#define ENETC_MDIO_CFG 0x00 +#define ENETC_EMDIO_CFG_C22 0x00809508 +#define ENETC_EMDIO_CFG_C45 0x00809548 +#define ENETC_EMDIO_CFG_RD_ER BIT(1) +#define ENETC_EMDIO_CFG_BSY BIT(0) +#define ENETC_MDIO_CTL 0x04 +#define ENETC_MDIO_CTL_READ BIT(15) +#define ENETC_MDIO_DATA 0x08 +#define ENETC_MDIO_STAT 0x0c + +#define ENETC_MDIO_READ_ERR 0xffff + +struct enetc_mdio_priv { +void *regs_base; +}; +#endif /* _ENETC_H */
drivers/net/fsl_enetc_mdio.c new file +149 -0
149 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 3/6 drivers: net: add NXP ENETC MDIO driver
Quoted 8 lines · Alex Marginean
Adds a driver for the MDIO interface currently integrated in LS1028A SoC. This MDIO interface is shared by multiple ethernet interfaces and is presented as a stand-alone PCI function on the SoC ECAM. Ethernet has a functional dependency on MDIO, for simplicity there is a single config option for both.
Signed-off-by Alex Marginean <[email protected]>
Quoted 9 lines
--- drivers/net/Kconfig | 2 +- drivers/net/Makefile | 2 +- drivers/net/fsl_enetc.c | 57 ++++++++++++++ drivers/net/fsl_enetc.h | 21 +++++ drivers/net/fsl_enetc_mdio.c | 149 +++++++++++++++++++++++++++++++++++ 5 files changed, 229 insertions(+), 2 deletions(-) create mode 100644 drivers/net/fsl_enetc_mdio.c
PATCH v3 4/6 drivers: net: apply serdes configuration for ENETC Ethernet interfaces
In reply to Alex MargineanEthernet interfaces using serial protocols go through the serdes block integrated in the SoC. This is accessed over dedicated internal MDIOs which are part of the Ethernet PCI functions. Set up serdes at _start, along with other protocol specific port/MAC configuration. MDIO code is shared with enetc_mdio, read/write functions are exported from fsl_enetc_mdio for this reason.
--- drivers/net/fsl_enetc.c | 148 ++++++++++++++++++++++++++++++++++- drivers/net/fsl_enetc.h | 38 +++++++++ drivers/net/fsl_enetc_mdio.c | 8 +- 3 files changed, 189 insertions(+), 5 deletions(-)
drivers/net/fsl_enetc.c +147 -1
@@ -39,6 +39,152 @@ static int enetc_bind(struct udevice *dev)return 0 ; } +/* MDIO wrappers, we're using these to drive internal MDIO to get to serdes */ +static int enetc_mdio_read (struct mii_dev *bus,int addr,int devad,int reg) +{ +struct enetc_mdio_priv priv; + + priv.regs_base = bus->priv; +return enetc_mdio_read_priv (&priv, addr, devad, reg); +} + +static int enetc_mdio_write (struct mii_dev *bus,int addr,int devad,int reg, +u16 val) +{ +struct enetc_mdio_priv priv; + + priv.regs_base = bus->priv; +return enetc_mdio_write_priv (&priv, addr, devad, reg, val); +} + +/* only interfaces that can pin out through serdes have internal MDIO */ +static bool enetc_has_imdio (struct udevice *dev) +{ +struct enetc_priv *priv =dev_get_priv (dev); + +return !!(priv->imdio.priv); +} + +/* set up serdes for SGMII */ +static int enetc_init_sgmii (struct udevice *dev) +{ +struct enetc_priv *priv =dev_get_priv (dev); + +if (!enetc_has_imdio (dev)) +return 0 ; + +/* Set to SGMII mode, use AN */ +enetc_mdio_write (&priv->imdio,ENETC_PCS_PHY_ADDR ,MDIO_DEVAD_NONE , +ENETC_PCS_IF_MODE ,ENETC_PCS_IF_MODE_SGMII_AN ); + +/* Dev ability - SGMII */ +enetc_mdio_write (&priv->imdio,ENETC_PCS_PHY_ADDR ,MDIO_DEVAD_NONE , +ENETC_PCS_DEV_ABILITY ,ENETC_PCS_DEV_ABILITY_SGMII ); + +/* Adjust link timer for SGMII */ +enetc_mdio_write (&priv->imdio,ENETC_PCS_PHY_ADDR ,MDIO_DEVAD_NONE , +ENETC_PCS_LINK_TIMER1 ,ENETC_PCS_LINK_TIMER1_VAL ); +enetc_mdio_write (&priv->imdio,ENETC_PCS_PHY_ADDR ,MDIO_DEVAD_NONE , +ENETC_PCS_LINK_TIMER2 ,ENETC_PCS_LINK_TIMER2_VAL ); + +/* restart PCS AN */ +enetc_mdio_write (&priv->imdio,ENETC_PCS_PHY_ADDR ,MDIO_DEVAD_NONE , +ENETC_PCS_CR , +ENETC_PCS_CR_RESET_AN |ENETC_PCS_CR_DEF_VAL ); + +return 0 ; +} + +/* set up MAC for RGMII */ +static int enetc_init_rgmii (struct udevice *dev) +{ +struct enetc_priv *priv =dev_get_priv (dev); +u32 if_mode; + +/* enable RGMII AN */ + if_mode =enetc_read_port (priv,ENETC_PM_IF_MODE ); + if_mode |=ENETC_PM_IF_MODE_AN_ENA ; +enetc_write_port (priv,ENETC_PM_IF_MODE , if_mode); + +return 0 ; +} + +/* set up MAC and serdes for SXGMII */ +static int enetc_init_sxgmii (struct udevice *dev) +{ +struct enetc_priv *priv =dev_get_priv (dev); +u32 if_mode; + +/* set ifmode to (US)XGMII */ + if_mode =enetc_read_port (priv,ENETC_PM_IF_MODE ); + if_mode &= ~ENETC_PM_IF_IFMODE_MASK ; +enetc_write_port (priv,ENETC_PM_IF_MODE , if_mode); + +if (!enetc_has_imdio (dev)) +return 0 ; + +/* Dev ability - SXGMII */ +enetc_mdio_write (&priv->imdio,ENETC_PCS_PHY_ADDR ,ENETC_PCS_DEVAD_REPL , +ENETC_PCS_DEV_ABILITY ,ENETC_PCS_DEV_ABILITY_SXGMII ); + +/* Restart PCS AN */ +enetc_mdio_write (&priv->imdio,ENETC_PCS_PHY_ADDR ,ENETC_PCS_DEVAD_REPL , +ENETC_PCS_CR , +ENETC_PCS_CR_LANE_RESET |ENETC_PCS_CR_RESET_AN ); + +return 0 ; +} + +/* Apply protocol specific configuration to MAC, serdes as needed */ +static void enetc_start_pcs (struct udevice *dev) +{ +struct enetc_priv *priv =dev_get_priv (dev); +const char *if_str; + + priv->if_type =PHY_INTERFACE_MODE_NONE ; + +/* check internal mdio capability, not all ports need it */ +if (enetc_read_port (priv,ENETC_PCAPR0 ) &ENETC_PCAPRO_MDIO ) { +/* +* set up internal MDIO, this is part of ETH PCI function and is +* used to access serdes / internal SoC PHYs. +* We don't currently register it as a MDIO bus as it goes away +* when the interface is removed, so it can't practically be +* used in the console. +*/ + priv->imdio.read = enetc_mdio_read; + priv->imdio.write = enetc_mdio_write; + priv->imdio.priv = priv->port_regs +ENETC_PM_IMDIO_BASE ; +strncpy (priv->imdio.name, dev->name,MDIO_NAME_LEN ); + } + +if (!ofnode_valid (dev->node)) { +enetc_dbg (dev,"no enetc ofnode found, skipping PCS set-up\n" ); +return ; + } + + if_str =ofnode_read_string (dev->node,"phy-mode" ); +if (if_str) + priv->if_type =phy_get_interface_by_name (if_str); +else +enetc_dbg (dev, +"phy-mode property not found, defaulting to SGMII\n" ); +if (priv->if_type <0 ) + priv->if_type =PHY_INTERFACE_MODE_NONE ; + +switch (priv->if_type) { +case PHY_INTERFACE_MODE_SGMII : +enetc_init_sgmii (dev); +break ; +case PHY_INTERFACE_MODE_RGMII : +enetc_init_rgmii (dev); +break ; +case PHY_INTERFACE_MODE_XGMII : +enetc_init_sxgmii (dev); +break ; + }; +} +/* Configure the actual/external ethernet PHY, if one is found */ static void enetc_start_phy (struct udevice *dev) {
@@ -303,7 +449,7 @@ static int enetc_start(struct udevice *dev)enetc_setup_tx_bdr (dev);enetc_setup_rx_bdr (dev); - priv->if_type =PHY_INTERFACE_MODE_NONE ; +enetc_start_pcs (dev);enetc_start_phy (dev);return 0 ;
drivers/net/fsl_enetc.h +38 -0
@@ -61,6 +61,8 @@ enum enetc_bdr_type {TX, RX};#define ENETC_PSIPMMR 0x0018#define ENETC_PSIPMAR0 0x0100#define ENETC_PSIPMAR1 0x0104 +#define ENETC_PCAPR0 0x0900 +#define ENETC_PCAPRO_MDIO BIT(11)#define ENETC_PSICFGR (n) (0x0940 + (n) * 0x10)#define ENETC_PSICFGR_SET_TXBDR (val) ((val) & 0xff)#define ENETC_PSICFGR_SET_RXBDR (val) (((val) & 0xff) << 16)
@@ -70,6 +72,11 @@ enum enetc_bdr_type {TX, RX};#define ENETC_PM_CC_RX_TX_EN 0x8813#define ENETC_PM_MAXFRM 0x8014#define ENETC_RX_MAXFRM_SIZE PKTSIZE_ALIGN +#define ENETC_PM_IMDIO_BASE 0x8030 +#define ENETC_PM_IF_MODE 0x8300 +#define ENETC_PM_IF_MODE_RG BIT(2) +#define ENETC_PM_IF_MODE_AN_ENA BIT(15) +#define ENETC_PM_IF_IFMODE_MASK GENMASK(1, 0)/* buffer descriptors count must be multiple of 8 and aligned to 128 bytes */ #define ENETC_BD_CNT CONFIG_SYS_RX_ETH_BUFFER
@@ -146,6 +153,7 @@ struct enetc_priv {struct bd_ring rx_bdr;int if_type; +struct mii_dev imdio; };/* register accessors */
@@ -168,6 +176,27 @@ struct enetc_priv {#define enetc_bdr_write (priv, t, n, off, val) \ enetc_write(priv, ENETC_BDR(t, n, off), val) +/* PCS / internal SoC PHY ID, it defaults to 0 on all interfaces */ +#define ENETC_PCS_PHY_ADDR 0 + +/* PCS registers */ +#define ENETC_PCS_CR 0x00 +#define ENETC_PCS_CR_RESET_AN 0x1200 +#define ENETC_PCS_CR_DEF_VAL 0x0140 +#define ENETC_PCS_CR_LANE_RESET 0x8000 +#define ENETC_PCS_DEV_ABILITY 0x04 +#define ENETC_PCS_DEV_ABILITY_SGMII 0x4001 +#define ENETC_PCS_DEV_ABILITY_SXGMII 0x5001 +#define ENETC_PCS_LINK_TIMER1 0x12 +#define ENETC_PCS_LINK_TIMER1_VAL 0x06a0 +#define ENETC_PCS_LINK_TIMER2 0x13 +#define ENETC_PCS_LINK_TIMER2_VAL 0x0003 +#define ENETC_PCS_IF_MODE 0x14 +#define ENETC_PCS_IF_MODE_SGMII_AN 0x0003 + +/* PCS replicator block for USXGMII */ +#define ENETC_PCS_DEVAD_REPL 0x1f +/* ENETC external MDIO registers */ #define ENETC_MDIO_BASE 0x1c00#define ENETC_MDIO_CFG 0x00
@@ -186,4 +215,13 @@ struct enetc_mdio_priv { void *regs_base; }; +/* +* these functions are implemented by ENETC_MDIO and are re-used by ENETC driver +* to drive serdes / internal SoC PHYs +*/ +int enetc_mdio_read_priv (struct enetc_mdio_priv *priv,int addr,int devad, +int reg); +int enetc_mdio_write_priv (struct enetc_mdio_priv *priv,int addr,int devad, +int reg,u16 val); +#endif /* _ENETC_H */
drivers/net/fsl_enetc_mdio.c +4 -4
@@ -21,8 +21,8 @@ static void enetc_mdio_wait_bsy(struct enetc_mdio_priv *priv)cpu_relax (); } -static int enetc_mdio_read_priv (struct enetc_mdio_priv *priv,int addr, -int devad,int reg) +int enetc_mdio_read_priv (struct enetc_mdio_priv *priv,int addr,int devad, +int reg) {if (devad ==MDIO_DEVAD_NONE )enetc_write (priv,ENETC_MDIO_CFG ,ENETC_EMDIO_CFG_C22 );
@@ -51,8 +51,8 @@ static int enetc_mdio_read_priv(struct enetc_mdio_priv *priv, int addr,return enetc_read (priv,ENETC_MDIO_DATA ); } -static int enetc_mdio_write_priv (struct enetc_mdio_priv *priv,int addr, -int devad,int reg,u16 val) +int enetc_mdio_write_priv (struct enetc_mdio_priv *priv,int addr,int devad, +int reg,u16 val) {if (devad ==MDIO_DEVAD_NONE )enetc_write (priv,ENETC_MDIO_CFG ,ENETC_EMDIO_CFG_C22 );
Signature · 1 line
2.17.1
PATCH v3 4/6 drivers: net: apply serdes configuration for ENETC Ethernet interfaces
Quoted 8 lines · Alex Marginean
Ethernet interfaces using serial protocols go through the serdes block integrated in the SoC. This is accessed over dedicated internal MDIOs which are part of the Ethernet PCI functions. Set up serdes at
_start, along with other protocol specific port/MAC configuration. MDIO code is shared withenetc_mdio, read/write functions are exported fromfsl_enetc_mdiofor this reason.
Quoted 7 lines
Signed-off-by Alex Marginean <[email protected]>--- drivers/net/fsl_enetc.c | 148 ++++++++++++++++++++++++++++++++++- drivers/net/fsl_enetc.h | 38 +++++++++ drivers/net/fsl_enetc_mdio.c | 8 +- 3 files changed, 189 insertions(+), 5 deletions(-)
PATCH v3 5/6 arm: dts: ls1028a updates for network interfaces
In reply to Alex MargineanDefines LS1028A RDB SGMII port, QDS RGMII port.
--- arch/arm/dts/fsl-ls1028a-qds.dts | 13 +++++++++++++ arch/arm/dts/fsl-ls1028a-rdb.dts | 13 +++++++++++++ arch/arm/dts/fsl-ls1028a.dtsi | 24 ++++++++++++++++++++++++ 3 files changed, 50 insertions(+)
arch/arm/dts/fsl-ls1028a-qds.dts +13 -0
@@ -86,3 +86,16 @@ &usb2 { status = "okay"; }; + +&enetc1 { + status = "okay"; + phy-mode = "rgmii"; + phy-handle = <&qds_phy0>; +}; + +&mdio0 { + status = "okay"; + qds_phy0: phy at 5 { + reg = <5>; + }; +};
arch/arm/dts/fsl-ls1028a-rdb.dts +13 -0
@@ -86,3 +86,16 @@ &usb2 { status = "okay"; }; + +&enetc0 { + status = "okay"; + phy-mode = "sgmii"; + phy-handle = <&rdb_phy0>; +}; + +&mdio0 { + status = "okay"; + rdb_phy0: phy at 2 { + reg = <2>; + }; +};
arch/arm/dts/fsl-ls1028a.dtsi +24 -0
@@ -117,6 +117,30 @@ #size-cells = <2>; device_type = "pci"; ranges= <0x82000000 0x0 0x00000000 0x1 0xf8000000 0x0 0x160000>; + enetc0: pci at 0,0 { + reg = <0x000000 0 0 0 0>; + status = "disabled"; + }; + enetc1: pci at 0,1 { + reg = <0x000100 0 0 0 0>; + status = "disabled"; + }; + enetc2: pci at 0,2 { + reg = <0x000200 0 0 0 0>; + status = "okay"; + phy-mode = "internal"; + }; + mdio0: pci at 0,3 { + #address-cells=<0>; + #size-cells=<1>; + reg = <0x000300 0 0 0 0>; + status = "disabled"; + }; + enetc6: pci at 0,6 { + reg = <0x000600 0 0 0 0>; + status = "okay"; + phy-mode = "internal"; + }; }; i2c0: i2c at 2000000 {
Signature · 1 line
2.17.1
PATCH v3 5/6 arm: dts: ls1028a updates for network interfaces
Quoted 10 lines · Alex Marginean
Defines LS1028A RDB SGMII port, QDS RGMII port.
Signed-off-by Alex Marginean <[email protected]>--- arch/arm/dts/fsl-ls1028a-qds.dts | 13 +++++++++++++ arch/arm/dts/fsl-ls1028a-rdb.dts | 13 +++++++++++++ arch/arm/dts/fsl-ls1028a.dtsi | 24 ++++++++++++++++++++++++ 3 files changed, 50 insertions(+)
PATCH v3 6/6 configs: ls1028a: enable networking options in rds, qds defconfig
In reply to Alex MargineanEnables ethernet, MDIO, PHY drivers for LS1028A RDB and QDS.
--- configs/ls1028aqds_tfa_defconfig | 5 ++++- configs/ls1028ardb_tfa_defconfig | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-)
configs/ls1028aqds_tfa_defconfig +4 -1
@@ -41,10 +41,13 @@ CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set CONFIG_PHYLIB=y +CONFIG_PHY_AQUANTIA=y CONFIG_PHY_ATHEROS=y +CONFIG_PHY_VITESSE=y CONFIG_DM_ETH=y -CONFIG_PHY_GIGE=y +CONFIG_DM_MDIO=y CONFIG_E1000=y +CONFIG_FSL_ENETC=y CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y
configs/ls1028ardb_tfa_defconfig +2 -0
@@ -43,8 +43,10 @@ CONFIG_SPI_FLASH_STMICRO=y CONFIG_PHYLIB=y CONFIG_PHY_ATHEROS=y CONFIG_DM_ETH=y +CONFIG_DM_MDIO=y CONFIG_PHY_GIGE=y CONFIG_E1000=y +CONFIG_FSL_ENETC=y CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y
Signature · 1 line
2.17.1
PATCH v3 6/6 configs: ls1028a: enable networking options in rds, qds defconfig
Hi Alex,
Quoted 1 line · Alex Marginean
The commit title says: rds. It should be rdb.
Quoted 8 lines
Enables ethernet, MDIO, PHY drivers for LS1028A RDB and QDS.
Signed-off-by Alex Marginean <[email protected]>--- configs/ls1028aqds_tfa_defconfig | 5 ++++- configs/ls1028ardb_tfa_defconfig | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-)
Other than that,
Regards,
Bin
PATCH v3 6/6 configs: ls1028a: enable networking options in rds, qds defconfig
Quoted 7 lines · Bin Meng
Hi Alex,
Quoted 1 line · Alex Marginean
The commit title says: rds. It should be rdb.
You're right, I'll fix it. You have a really good eye for detail! Thank you!
Alex
Quoted 20 lines
Quoted 9 lines
Enables ethernet, MDIO, PHY drivers for LS1028A RDB and QDS.
Signed-off-by Alex Marginean <[email protected]>--- configs/ls1028aqds_tfa_defconfig | 5 ++++- configs/ls1028ardb_tfa_defconfig | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-)Other than that,
Reviewed-by Bin Meng <[email protected]>Regards,
Bin
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot