driver: net: ldpaa: Add support of new architeture
Subsystems (2)
v4 cover driver: net: ldpaa: Add support of new architeture
Current architecture of Freescale's DPAA2 framework is as below
- Management complex Firmware, DPL and DPC are depolyed during u-boot boot sequence.
- DPAA2 ethernet driver depends upon the static DPL for the DPRC, DPNI, DPBP, DPIO objects
Now new architecture will support
- New DPAA2 commands to manage Management Complex (MC) i.e. start mc, aiop
and apply DPL from u-boot command prompt.
- Create DPNI, DPBP, DPIO objects at run-time, before DPL deployement
- Destroy all objects during DPL deployment.
- boot Linux. Linux will use objects defined in static DPL file
Prabhakar Kushwaha (10):
armv8: lsch3: Fix lane protocol parsing logic
driver: net: fsl-mc: Add create, destroy APIs in flibs
driver: net: fsl-mc: Add APIs for DPMAC objects in FLIB
armv8: ls2085aqds: Print function name during SerDes error
driver: ldpaa: Add api to return linked PHY ID of DPMAC
driver: net: fsl-mc: Increase MC command timeout
driver: net: fsl-mc: Add DPAA2 commands to manage MC
driver: net: fsl-mc: Create DPAA2 object at run-time
driver: net: ldpaa: Use DPMAC as net device
driver: net: ldpaa: Add debug information
arch/arm/cpu/armv8/fsl-lsch3/README | 30 ++ arch/arm/cpu/armv8/fsl-lsch3/fsl_lsch3_serdes.c | 2 +- board/freescale/ls2085aqds/eth.c | 16 +- board/freescale/ls2085aqds/ls2085aqds.c | 1 - board/freescale/ls2085ardb/ls2085ardb.c | 1 - drivers/net/fsl-mc/Makefile | 3 +- drivers/net/fsl-mc/dpbp.c | 41 ++ drivers/net/fsl-mc/dpio/dpio.c | 40 ++ drivers/net/fsl-mc/dpmac.c | 222 ++++++++ drivers/net/fsl-mc/dpni.c | 40 ++ drivers/net/fsl-mc/dprc.c | 46 ++ drivers/net/fsl-mc/mc.c | 652 +++++++++++++++++------- drivers/net/fsl-mc/mc_sys.c | 2 +- drivers/net/ldpaa_eth/ldpaa_eth.c | 274 ++++++++-- drivers/net/ldpaa_eth/ldpaa_eth.h | 17 +- drivers/net/ldpaa_eth/ldpaa_wriop.c | 12 + include/configs/ls2085aqds.h | 12 - include/configs/ls2085ardb.h | 12 - include/fsl-mc/fsl_dpbp.h | 48 ++ include/fsl-mc/fsl_dpio.h | 60 +++ include/fsl-mc/fsl_dpmac.h | 468 +++++++++++++++++ include/fsl-mc/fsl_dpni.h | 189 +++++++ include/fsl-mc/fsl_dprc.h | 84 +++ include/fsl-mc/fsl_mc.h | 6 +- include/fsl-mc/fsl_mc_private.h | 26 +- include/fsl-mc/ldpaa_wriop.h | 3 +- 26 files changed, 2026 insertions(+), 281 deletions(-) create mode 100644 drivers/net/fsl-mc/dpmac.c create mode 100644 include/fsl-mc/fsl_dpmac.h
Signature · 1 line
1.9.1
PATCH v4 1/10 armv8: lsch3: Fix lane protocol parsing logic
Current implementation only consider SGMIIs for dpmac initialization. XFI serdes protocols also uses dpmac.
Also, fix lane protocol parsing logic to consider both XFIs and SGMIIs.
---
Changes for v2: Sending as it is
Changes for v3: Sending as it is
Changes for v4: Update SerDes Parsing logic
.../cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c | 25 ++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)
arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c +23 -2
@@ -18,6 +18,11 @@ static u8 serdes1_prtcl_map[SERDES_PRCTL_COUNT];static u8 serdes2_prtcl_map[SERDES_PRCTL_COUNT ];#endif +#ifdef CONFIG_FSL_MC_ENET +int xfi_dpmac[XFI8 +1 ]; +int sgmii_dpmac[SGMII16 +1 ]; +#endif +int is_serdes_configured (enum srds_prtcl device) {int ret =0 ;
@@ -116,9 +121,15 @@ void serdes_init(u32 sd, u32 sd_addr, u32 sd_prctl_mask, u32 sd_prctl_shift,wriop_init_dpmac (sd,12 , (int )lane_prtcl);break ;default : +if (lane_prtcl >=XFI1 && lane_prtcl <=XFI8 ) +wriop_init_dpmac (sd, + xfi_dpmac[lane_prtcl], + (int )lane_prtcl); +if (lane_prtcl >=SGMII1 && - lane_prtcl <=SGMII16 ) -wriop_init_dpmac (sd, lane +1 , + lane_prtcl <=SGMII16 ) +wriop_init_dpmac (sd, sgmii_dpmac[ + lane_prtcl], (int )lane_prtcl);break ; }
@@ -129,6 +140,16 @@ void serdes_init(u32 sd, u32 sd_addr, u32 sd_prctl_mask, u32 sd_prctl_shift,void fsl_serdes_init (void ) { +#ifdef CONFIG_FSL_MC_ENET +int i , j; + +for (i =XFI1 , j =1 ; i <=XFI8 ; i++, j++) + xfi_dpmac[i] = j; + +for (i =SGMII1 , j =1 ; i <=SGMII16 ; i++, j++) + sgmii_dpmac[i] = j; +#endif +#ifdef CONFIG_SYS_FSL_SRDS_1 serdes_init(FSL_SRDS_1, CONFIG_SYS_FSL_LSCH3_SERDES_ADDR,
Signature · 1 line
1.9.1
PATCH v4 1/10 armv8: lsch3: Fix lane protocol parsing logic
Quoted 5 lines · Prabhakar Kushwaha
Current implementation only consider SGMIIs for dpmac initialization. XFI serdes protocols also uses dpmac.
Also, fix lane protocol parsing logic to consider both XFIs and SGMIIs.
Quoted 8 lines
Signed-off-by Prabhakar Kushwaha <[email protected]>---
Changes for v2: Sending as it is
Changes for v3: Sending as it is
Changes for v4: Update SerDes Parsing logic.../cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c | 25 ++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)
Squashed with patch "driver: net: ldpaa: Update the lane number to DPMAC mapping". Applied to fsl-qoriq master. Thanks.
York
PATCH v4 2/10 driver: net: fsl-mc: Add create, destroy APIs in flibs
In reply to Prabhakar KushwahaCurrent Management Complex Flibs does not support APIs for adding and destroying the objects.
Add APIs to create and destroy objects for DPBP, DPIO, DPNI and DPRC.
---
Changes for v2: Sending as it is
Changes for v3: Sending as it is
Changes for v4: Sending as it is
drivers/net/fsl-mc/dpbp.c | 41 +++++++++ drivers/net/fsl-mc/dpio/dpio.c | 40 +++++++++ drivers/net/fsl-mc/dpni.c | 40 +++++++++ drivers/net/fsl-mc/dprc.c | 46 ++++++++++ include/fsl-mc/fsl_dpbp.h | 48 +++++++++++ include/fsl-mc/fsl_dpio.h | 60 +++++++++++++ include/fsl-mc/fsl_dpni.h | 189 +++++++++++++++++++++++++++++++++++++++++ include/fsl-mc/fsl_dprc.h | 84 ++++++++++++++++++ 8 files changed, 548 insertions(+)
drivers/net/fsl-mc/dpbp.c +41 -0
@@ -49,6 +49,47 @@ int dpbp_close(struct fsl_mc_io *mc_io,return mc_send_command (mc_io, &cmd); } +int dpbp_create (struct fsl_mc_io *mc_io, +uint32_t cmd_flags, +const struct dpbp_cfg *cfg, +uint16_t *token) +{ +struct mc_command cmd = {0 }; +int err; + + (void )(cfg);/* unused */ + +/* prepare command */ + cmd.header =mc_encode_cmd_header (DPBP_CMDID_CREATE , + cmd_flags, +0 ); + +/* send command to mc*/ + err =mc_send_command (mc_io, &cmd); +if (err) +return err; + +/* retrieve response parameters */ + *token =MC_CMD_HDR_READ_TOKEN (cmd.header); + +return 0 ; +} + +int dpbp_destroy (struct fsl_mc_io *mc_io, +uint32_t cmd_flags, +uint16_t token) +{ +struct mc_command cmd = {0 }; + +/* prepare command */ + cmd.header =mc_encode_cmd_header (DPBP_CMDID_DESTROY , + cmd_flags, + token); + +/* send command to mc*/ +return mc_send_command (mc_io, &cmd); +} +int dpbp_enable (struct fsl_mc_io *mc_io,uint32_t cmd_flags,uint16_t token)
drivers/net/fsl-mc/dpio/dpio.c +40 -0
@@ -48,6 +48,46 @@ int dpio_close(struct fsl_mc_io *mc_io,return mc_send_command (mc_io, &cmd); } +int dpio_create (struct fsl_mc_io *mc_io, +uint32_t cmd_flags, +const struct dpio_cfg *cfg, +uint16_t *token) +{ +struct mc_command cmd = {0 }; +int err; + +/* prepare command */ + cmd.header =mc_encode_cmd_header (DPIO_CMDID_CREATE , + cmd_flags, +0 ); +DPIO_CMD_CREATE (cmd, cfg); + +/* send command to mc*/ + err =mc_send_command (mc_io, &cmd); +if (err) +return err; + +/* retrieve response parameters */ + *token =MC_CMD_HDR_READ_TOKEN (cmd.header); + +return 0 ; +} + +int dpio_destroy (struct fsl_mc_io *mc_io, +uint32_t cmd_flags, +uint16_t token) +{ +struct mc_command cmd = {0 }; + +/* prepare command */ + cmd.header =mc_encode_cmd_header (DPIO_CMDID_DESTROY , + cmd_flags, + token); + +/* send command to mc*/ +return mc_send_command (mc_io, &cmd); +} +int dpio_enable (struct fsl_mc_io *mc_io,uint32_t cmd_flags,uint16_t token)
drivers/net/fsl-mc/dpni.c +40 -0
@@ -48,6 +48,46 @@ int dpni_close(struct fsl_mc_io *mc_io,return mc_send_command (mc_io, &cmd); } +int dpni_create (struct fsl_mc_io *mc_io, +uint32_t cmd_flags, +const struct dpni_cfg *cfg, +uint16_t *token) +{ +struct mc_command cmd = {0 }; +int err; + +/* prepare command */ + cmd.header =mc_encode_cmd_header (DPNI_CMDID_CREATE , + cmd_flags, +0 ); +DPNI_CMD_CREATE (cmd, cfg); + +/* send command to mc*/ + err =mc_send_command (mc_io, &cmd); +if (err) +return err; + +/* retrieve response parameters */ + *token =MC_CMD_HDR_READ_TOKEN (cmd.header); + +return 0 ; +} + +int dpni_destroy (struct fsl_mc_io *mc_io, +uint32_t cmd_flags, +uint16_t token) +{ +struct mc_command cmd = {0 }; + +/* prepare command */ + cmd.header =mc_encode_cmd_header (DPNI_CMDID_DESTROY , + cmd_flags, + token); + +/* send command to mc*/ +return mc_send_command (mc_io, &cmd); +} + int dpni_set_pools(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token,
drivers/net/fsl-mc/dprc.c +46 -0
52 lines not on this page · raw message
include/fsl-mc/fsl_dpbp.h +48 -0
60 lines not on this page · raw message
include/fsl-mc/fsl_dpio.h +60 -0
78 lines not on this page · raw message
include/fsl-mc/fsl_dpni.h +189 -0
213 lines not on this page · raw message
include/fsl-mc/fsl_dprc.h +84 -0
106 lines not on this page · raw message
Signature · 1 line
1.9.1
York Sun
AppliedPATCH v4 2/10 driver: net: fsl-mc: Add create, destroy APIs in flibs
Quoted 11 lines · Prabhakar Kushwaha
Current Management Complex Flibs does not support APIs for adding and destroying the objects.
Add APIs to create and destroy objects for DPBP, DPIO, DPNI and DPRC.
Signed-off-by Prabhakar Kushwaha <[email protected]>---
Changes for v2: Sending as it is
Changes for v3: Sending as it is
Changes for v4: Sending as it is
Quoted 9 lines
drivers/net/fsl-mc/dpbp.c | 41 +++++++++ drivers/net/fsl-mc/dpio/dpio.c | 40 +++++++++ drivers/net/fsl-mc/dpni.c | 40 +++++++++ drivers/net/fsl-mc/dprc.c | 46 ++++++++++ include/fsl-mc/fsl_dpbp.h | 48 +++++++++++ include/fsl-mc/fsl_dpio.h | 60 +++++++++++++ include/fsl-mc/fsl_dpni.h | 189 +++++++++++++++++++++++++++++++++++++++++ include/fsl-mc/fsl_dprc.h | 84 ++++++++++++++++++ 8 files changed, 548 insertions(+)
Applied to fsl-qoriq master. Thanks.
York
PATCH v4 3/10 driver: net: fsl-mc: Add APIs for DPMAC objects in FLIB
In reply to Prabhakar KushwahaDPMAC object of Management complex controls Physical MAC and MDIO controller. It provides APIs for MDIO and link state updates. It also provides APIs for PHY/link configuration.
---
Changes for v2: Updated Copyright year
Changes for v3: Sending as it is
Changes for v4: Sending as it is
drivers/net/fsl-mc/Makefile | 3 +- drivers/net/fsl-mc/dpmac.c | 222 +++++++++++++++++++++ include/fsl-mc/fsl_dpmac.h | 468 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 692 insertions(+), 1 deletion(-) create mode 100644 drivers/net/fsl-mc/dpmac.c create mode 100644 include/fsl-mc/fsl_dpmac.h
drivers/net/fsl-mc/Makefile +2 -1
@@ -10,5 +10,6 @@ obj-y += mc.o \ dpmng.o \ dprc.o \ dpbp.o \ - dpni.o + dpni.o \ + dpmac.o obj-y += dpio/
drivers/net/fsl-mc/dpmac.c new file +222 -0
222 lines not on this page · raw message
include/fsl-mc/fsl_dpmac.h new file +468 -0
468 lines not on this page · raw message
Signature · 1 line
1.9.1
York Sun
AppliedPATCH v4 3/10 driver: net: fsl-mc: Add APIs for DPMAC objects in FLIB
Quoted 10 lines · Prabhakar Kushwaha
DPMAC object of Management complex controls Physical MAC and MDIO controller. It provides APIs for MDIO and link state updates. It also provides APIs for PHY/link configuration.
Signed-off-by Prabhakar Kushwaha <[email protected]>---
Changes for v2: Updated Copyright year
Changes for v3: Sending as it is
Changes for v4: Sending as it is
Quoted 6 lines
drivers/net/fsl-mc/Makefile | 3 +- drivers/net/fsl-mc/dpmac.c | 222 +++++++++++++++++++++ include/fsl-mc/fsl_dpmac.h | 468 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 692 insertions(+), 1 deletion(-) create mode 100644 drivers/net/fsl-mc/dpmac.c create mode 100644 include/fsl-mc/fsl_dpmac.h
Applied to fsl-qoriq master. Thanks.
York
PATCH v4 4/10 armv8: ls2085aqds: Print function name during SerDes error
In reply to Prabhakar KushwahaPrint function name along with SerDes Protocol during SerDes Protocol not supported error.
---
Changes for v2: Sending as it is
Changes for v3: Sending as it is
Changes for v4: Sending as it is
board/freescale/ls2085aqds/eth.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
board/freescale/ls2085aqds/eth.c +8 -8
@@ -474,8 +474,8 @@ static void initialize_dpmac_to_slot(void) serdes1_prtcl);break ;default : -printf ("qds: WRIOP: Unsupported SerDes1 Protocol 0x%02x\n" , - serdes1_prtcl); +printf ("%s qds: WRIOP: Unsupported SerDes1 Protocol 0x%02x\n" , + __func__, serdes1_prtcl);break ; }
@@ -505,8 +505,8 @@ static void initialize_dpmac_to_slot(void) }break ;default : -printf ("qds: WRIOP: Unsupported SerDes2 Protocol 0x%02x\n" , - serdes2_prtcl); +printf (" %s qds: WRIOP: Unsupported SerDes2 Protocol 0x%02x\n" , + __func__ , serdes2_prtcl);break ; } }
@@ -580,8 +580,8 @@ void ls2085a_handle_phy_interface_sgmii(int dpmac_id) }break ;default : -printf ("qds: WRIOP: Unsupported SerDes1 Protocol 0x%02x\n" , - serdes1_prtcl); +printf ("%s qds: WRIOP: Unsupported SerDes1 Protocol 0x%02x\n" , + __func__ , serdes1_prtcl);break ; }
@@ -626,8 +626,8 @@ serdes2: }break ;default : -printf ("qds: WRIOP: Unsupported SerDes2 Protocol 0x%02x\n" , - serdes2_prtcl); +printf ("%s qds: WRIOP: Unsupported SerDes2 Protocol 0x%02x\n" , + __func__, serdes2_prtcl);break ; } }
Signature · 1 line
1.9.1
York Sun
AppliedPATCH v4 4/10 armv8: ls2085aqds: Print function name during SerDes error
Quoted 11 lines · Prabhakar Kushwaha
Print function name along with SerDes Protocol during SerDes Protocol not supported error.
Signed-off-by Prabhakar Kushwaha <[email protected]>---
Changes for v2: Sending as it is
Changes for v3: Sending as it is
Changes for v4: Sending as it isboard/freescale/ls2085aqds/eth.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
Applied to fsl-qoriq master. Thanks.
York
PATCH v4 5/10 driver: ldpaa: Add api to return linked PHY ID of DPMAC
In reply to Prabhakar KushwahaDPMAC represents physical line on the board. This physical line eventually asscociate with on-board PHY.
So Add an api to return linked PHY ID of DPMAC object.
---
Changes for v2: Sending as it is
Changes for v3: Sending as it is
Changes for v4: Sending as it is
drivers/net/ldpaa_eth/ldpaa_wriop.c | 12 ++++++++++++ include/fsl-mc/ldpaa_wriop.h | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/net/ldpaa_eth/ldpaa_wriop.c +12 -0
@@ -27,6 +27,7 @@ void wriop_init_dpmac(int sd, int dpmac_id, int lane_prtcl) dpmac_info[index].enabled =0 ; dpmac_info[index].id =0 ; + dpmac_info[index].phy_addr =-1 ; dpmac_info[index].enet_if =PHY_INTERFACE_MODE_NONE ; enet_if =wriop_dpmac_enet_if (index, lane_prtcl);
@@ -72,6 +73,17 @@ void wriop_enable_dpmac(int dpmac_id)wriop_dpmac_enable (dpmac_id); } +u8 wriop_is_enabled_dpmac (int dpmac_id) +{ +int i =wriop_dpmac_to_index (dpmac_id); + +if (i ==-1 ) +return -1 ; + +return dpmac_info[i].enabled; +} + +void wriop_set_mdio (int dpmac_id,struct mii_dev *bus) {int i =wriop_dpmac_to_index (dpmac_id);
include/fsl-mc/ldpaa_wriop.h +2 -1
@@ -40,8 +40,8 @@ enum wriop_port {struct wriop_dpmac_info {u8 enabled;u8 id; -u8 phy_addr;u8 board_mux; +int phy_addr;void *phy_regs;phy_interface_t enet_if;struct phy_device *phydev;
@@ -56,6 +56,7 @@ extern struct wriop_dpmac_info dpmac_info[NUM_WRIOP_PORTS];void wriop_init_dpmac (int ,int ,int );void wriop_disable_dpmac (int );void wriop_enable_dpmac (int ); +u8 wriop_is_enabled_dpmac (int dpmac_id);void wriop_set_mdio (int ,struct mii_dev *);struct mii_dev *wriop_get_mdio (int );void wriop_set_phy_address (int ,int );
Signature · 1 line
1.9.1
York Sun
AppliedPATCH v4 5/10 driver: ldpaa: Add api to return linked PHY ID of DPMAC
Quoted 6 lines · Prabhakar Kushwaha
DPMAC represents physical line on the board. This physical line eventually asscociate with on-board PHY.
So Add an api to return linked PHY ID of DPMAC object.
Signed-off-by Prabhakar Kushwaha <[email protected]>
Quoted 8 lines
---
Changes for v2: Sending as it is
Changes for v3: Sending as it is
Changes for v4: Sending as it isdrivers/net/ldpaa_eth/ldpaa_wriop.c | 12 ++++++++++++ include/fsl-mc/ldpaa_wriop.h | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-)
Applied to fsl-qoriq master. Thanks.
York
PATCH v4 6/10 driver: net: fsl-mc: Increase MC command timeout
In reply to Prabhakar Kushwahadpni_create API take takes more time as comapred to existing supported APIs of MC Flib.
So increase MC command timeout.
---
Changes for v2: Sending as it is
Changes for v3: Sending as it is
Changes for v4: Sending as it is
drivers/net/fsl-mc/mc_sys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/fsl-mc/mc_sys.c +1 -1
@@ -32,7 +32,7 @@ int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd) {enum mc_cmd_status status; -int timeout =6000 ; +int timeout =12000 ;mc_write_command (mc_io->mmio_regs, cmd);
Signature · 1 line
1.9.1
York Sun
AppliedPATCH v4 6/10 driver: net: fsl-mc: Increase MC command timeout
Quoted 4 lines · Prabhakar Kushwaha
dpni_createAPI take takes more time as comapred to existing supported APIs of MC Flib.
So increase MC command timeout.
Quoted 9 lines
Signed-off-by Prabhakar Kushwaha <[email protected]>---
Changes for v2: Sending as it is
Changes for v3: Sending as it is
Changes for v4: Sending as it isdrivers/net/fsl-mc/mc_sys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to fsl-qoriq master. Thanks.
York
PATCH v4 7/10 driver: net: fsl-mc: Add DPAA2 commands to manage MC
In reply to Prabhakar KushwahaManagement complex Firmware, DPL and DPC are depolyed during u-boot boot sequence.
Add new DPAA2 commands to manage Management Complex (MC) i.e. start mc, aiop and apply DPL from u-boot command prompt.
---
Changes for v2: Sending as it is
Changes for v3: fix compilation for ls2085_emu target Changes for v4: Sending as it is
arch/arm/cpu/armv8/fsl-layerscape/README.lsch3 | 30 ++ drivers/net/fsl-mc/mc.c | 382 ++++++++++++------------- include/configs/ls2085aqds.h | 12 - include/configs/ls2085ardb.h | 12 - include/fsl-mc/fsl_mc.h | 5 + include/fsl-mc/fsl_mc_private.h | 2 +- 6 files changed, 220 insertions(+), 223 deletions(-)
arch/arm/cpu/armv8/fsl-layerscape/README.lsch3 +30 -0
@@ -242,3 +242,33 @@ MMU Translation Tables | 0x81_0000_0000 | | 0x08_0080_0000 | ------------------ ------------------ ... ... + + +DPAA2 commands to manage Management complex +------------------------------------------- +Management complex Firmware, DPL and DPC are depolyed during u-boot boot +sequence. + +New DPAA2 commands has been added to manage Management Complex (MC) i.e. +start mc, aiop and apply DPL from command prompt. + +a) fsl_mc start mc [FW_addr] [DPC_addr] - Start Management Complex +b) fsl_mc apply DPL [DPL_addr] - Apply DPL file +c) fsl_mc start aiop [FW_addr] - Start AIOP + +u-boot etherenet support sequence :- +a) fsl_mc start mc [FW_addr] [DPC_addr] - Start Management Complex +b) DPMACs device will be available now for use + +Linux boot sequence :- +a) fsl_mc start mc [FW_addr] [DPC_addr] - Start Management Complex +b) fsl_mc apply DPL [DPL_addr] - Apply DPL file +c) No DPMACs availabe for use in u-boot +c) boot Linux + +AIOP boot sequence :- +a) fsl_mc start mc [FW_addr] [DPC_addr] - Start Management Complex +b) fsl_mc start aiop [FW_addr] - Start AIOP +c) fsl_mc apply DPL [DPL_addr] - Apply DPL file +d) No DPMACs availabe for use in u-boot +Please note actual AIOP start will happen during DPL parsing of Management complex
drivers/net/fsl-mc/mc.c +184 -198
537 lines not on this page · raw message
include/configs/ls2085aqds.h +0 -12
@@ -250,19 +250,7 @@ unsigned long get_board_ddr_clk(void);#define CONFIG_SYS_DEBUG_SERVER_FW_IN_NOR #define CONFIG_SYS_DEBUG_SERVER_FW_ADDR 0x580D00000ULL -/* MC firmware */ -#define CONFIG_SYS_LS_MC_FW_IN_NOR -#define CONFIG_SYS_LS_MC_FW_ADDR 0x580300000ULL - -#define CONFIG_SYS_LS_MC_DPL_IN_NOR -#define CONFIG_SYS_LS_MC_DPL_ADDR 0x580700000ULL - -#define CONFIG_SYS_LS_MC_DPC_IN_NOR -#define CONFIG_SYS_LS_MC_DPC_ADDR 0x580800000ULL -#define CONFIG_SYS_LS_MC_BOOT_TIMEOUT_MS 5000 -#define CONFIG_SYS_LS_MC_AIOP_IMG_IN_NOR -#define CONFIG_SYS_LS_MC_AIOP_IMG_ADDR 0x580900000ULL/* * I2C
include/configs/ls2085ardb.h +0 -12
@@ -223,19 +223,7 @@ unsigned long get_board_sys_clk(void);#define CONFIG_SYS_DEBUG_SERVER_FW_IN_NOR #define CONFIG_SYS_DEBUG_SERVER_FW_ADDR 0x580D00000ULL -/* MC firmware */ -#define CONFIG_SYS_LS_MC_FW_IN_NOR -#define CONFIG_SYS_LS_MC_FW_ADDR 0x580300000ULL - -#define CONFIG_SYS_LS_MC_DPL_IN_NOR -#define CONFIG_SYS_LS_MC_DPL_ADDR 0x580700000ULL - -#define CONFIG_SYS_LS_MC_DPC_IN_NOR -#define CONFIG_SYS_LS_MC_DPC_ADDR 0x580800000ULL -#define CONFIG_SYS_LS_MC_BOOT_TIMEOUT_MS 5000 -#define CONFIG_SYS_LS_MC_AIOP_IMG_IN_NOR -#define CONFIG_SYS_LS_MC_AIOP_IMG_ADDR 0x580900000ULL/* * I2C
include/fsl-mc/fsl_mc.h +5 -0
@@ -50,6 +50,11 @@ struct mc_ccsr_registers { };int get_mc_boot_status (void ); +int get_dpl_apply_status (void ); +#ifdef CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET +int get_aiop_apply_status (void ); +#endif +u64 mc_get_dram_addr (void );unsigned long mc_get_dram_block_size (void );int fsl_mc_ldpaa_init (bd_t *bis);void fsl_mc_ldpaa_exit (bd_t *bis);
include/fsl-mc/fsl_mc_private.h +1 -1
@@ -45,6 +45,6 @@ struct fsl_dpio_obj {extern struct fsl_dpio_obj *dflt_dpio; -int mc_init (void ); +int mc_init (u64 mc_fw_addr,u64 mc_dpc_addr);int ldpaa_eth_init (struct dprc_obj_desc obj_desc);#endif /* _FSL_MC_PRIVATE_H_ */
Signature · 1 line
1.9.1
PATCH v4 7/10 driver: net: fsl-mc: Add DPAA2 commands to manage MC
Quoted 47 lines · Prabhakar Kushwaha
Management complex Firmware, DPL and DPC are depolyed during u-boot boot sequence.
Add new DPAA2 commands to manage Management Complex (MC) i.e. start mc, aiop and apply DPL from u-boot command prompt.
Signed-off-by Prabhakar Kushwaha <[email protected]>---
Changes for v2: Sending as it is
Changes for v3: fix compilation forls2085_emutarget Changes for v4: Sending as it isarch/arm/cpu/armv8/fsl-layerscape/README.lsch3 | 30 ++ drivers/net/fsl-mc/mc.c | 382 ++++++++++++------------- include/configs/ls2085aqds.h | 12 - include/configs/ls2085ardb.h | 12 - include/fsl-mc/fsl_mc.h | 5 + include/fsl-mc/fsl_mc_private.h | 2 +- 6 files changed, 220 insertions(+), 223 deletions(-)arch/arm/cpu/armv8/fsl-layerscape/README.lsch3 +19
-0@@ -242,3 +242,33 @@ MMU Translation Tables | 0x81_0000_0000 | | 0x08_0080_0000 | ------------------ ------------------ ... ... + + +DPAA2 commands to manage Management complex +------------------------------------------- +Management complex Firmware, DPL and DPC are depolyed during u-boot boot +sequence. + +New DPAA2 commands has been added to manage Management Complex (MC) i.e. +start mc, aiop and apply DPL from command prompt. + +a) fsl_mc start mc [FW_addr] [DPC_addr] - Start Management Complex +b) fsl_mc apply DPL [DPL_addr] - Apply DPL file +c) fsl_mc start aiop [FW_addr] - Start AIOP + +u-boot etherenet support sequence :- +a) fsl_mc start mc [FW_addr] [DPC_addr] - Start Management Complex +b) DPMACs device will be available now for use + +Linux boot sequence :-
arch/arm/cpu/armv8/fsl-layerscape/README.lsch3 MMU Translation Tables · line 273
Quoted 10 lines
arch/arm/cpu/armv8/fsl-layerscape/README.lsch3 +10
-0+a) fsl_mc start mc [FW_addr] [DPC_addr] - Start Management Complex +b) fsl_mc apply DPL [DPL_addr] - Apply DPL file +c) No DPMACs availabe for use in u-boot +c) boot Linux + +AIOP boot sequence :- +a) fsl_mc start mc [FW_addr] [DPC_addr] - Start Management Complex +b) fsl_mc start aiop [FW_addr] - Start AIOP +c) fsl_mc apply DPL [DPL_addr] - Apply DPL file +d) No DPMACs availabe for use in u-boot
Prabhakar,
The help message is not accurate. The FW_addr and DPC_addr are not optional, are they? If a user must provide the address, please put the format as
fsl_mc start mc <FW_addr> <DPC_addr>
The [] means optional, <> means mandatory. I am using the old school convention, hopefully the rest of the world agrees with me.
This change is relative big for using MC. I would appreciate some command examples with real address in README and in commit message. It is helpful for the transition.
York
PATCH v4 7/10 driver: net: fsl-mc: Add DPAA2 commands to manage MC
In reply to Prabhakar KushwahaQuoted 12 lines · Prabhakar Kushwaha
Management complex Firmware, DPL and DPC are depolyed during u-boot boot sequence.
Add new DPAA2 commands to manage Management Complex (MC) i.e. start mc, aiop and apply DPL from u-boot command prompt.
Signed-off-by Prabhakar Kushwaha <[email protected]>---
Changes for v2: Sending as it is
Changes for v3: fix compilation forls2085_emutarget Changes for v4: Sending as it is
Quoted 8 lines
arch/arm/cpu/armv8/fsl-layerscape/README.lsch3 | 30 ++ drivers/net/fsl-mc/mc.c | 382 ++++++++++++------------- include/configs/ls2085aqds.h | 12 - include/configs/ls2085ardb.h | 12 - include/fsl-mc/fsl_mc.h | 5 + include/fsl-mc/fsl_mc_private.h | 2 +- 6 files changed, 220 insertions(+), 223 deletions(-)
Squashed with patch "armv8: README: Update README for DPAA2 commands for MC". Applied to fsl-qoriq master. Thanks.
York
PATCH v4 8/10 driver: net: fsl-mc: Create DPAA2 object at run-time
In reply to Prabhakar KushwahaFreescale's DPAA2 ethernet driver depends upon the static DPL for the DPRC, DPNI, DPBP, DPIO objects.
Instead of static objects, Create DPNI, DPBP, DPIO objects at run-time.
---
Changes for v2: Use Child container for object creation Changes for v3:
- Avoid linux boot if MC up and DPL is not deployed
- Boot Linux is MC is not booted
Changes for v4: Sending as it is
board/freescale/ls2085aqds/ls2085aqds.c | 5 +- board/freescale/ls2085ardb/ls2085ardb.c | 5 +- drivers/net/fsl-mc/mc.c | 467 +++++++++++++++++++++++++++++--- drivers/net/ldpaa_eth/ldpaa_eth.c | 4 +- include/fsl-mc/fsl_mc.h | 5 +- include/fsl-mc/fsl_mc_private.h | 23 +- 6 files changed, 468 insertions(+), 41 deletions(-)
board/freescale/ls2085aqds/ls2085aqds.c +4 -1
@@ -294,6 +294,7 @@ void fdt_fixup_board_enet(void *fdt)#ifdef CONFIG_OF_BOARD_SETUP int ft_board_setup (void *blob,bd_t *bd) { +int err;u64 base[CONFIG_NR_DRAM_BANKS ];u64 size[CONFIG_NR_DRAM_BANKS ];
@@ -309,7 +310,9 @@ int ft_board_setup(void *blob, bd_t *bd)#ifdef CONFIG_FSL_MC_ENET fdt_fixup_board_enet (blob); -fsl_mc_ldpaa_exit (bd); + err =fsl_mc_ldpaa_exit (bd); +if (err) +return err;#endif return 0 ;
board/freescale/ls2085ardb/ls2085ardb.c +4 -1
@@ -260,6 +260,7 @@ void fdt_fixup_board_enet(void *fdt)#ifdef CONFIG_OF_BOARD_SETUP int ft_board_setup (void *blob,bd_t *bd) { +int err;u64 base[CONFIG_NR_DRAM_BANKS ];u64 size[CONFIG_NR_DRAM_BANKS ];
@@ -275,7 +276,9 @@ int ft_board_setup(void *blob, bd_t *bd)#ifdef CONFIG_FSL_MC_ENET fdt_fixup_board_enet (blob); -fsl_mc_ldpaa_exit (bd); + err =fsl_mc_ldpaa_exit (bd); +if (err) +return err;#endif return 0 ;
drivers/net/fsl-mc/mc.c +433 -34
552 lines not on this page · raw message
drivers/net/ldpaa_eth/ldpaa_eth.c +2 -2
@@ -601,7 +601,7 @@ static int ldpaa_eth_netdev_init(struct eth_device *net_dev)return 0 ; } -int ldpaa_eth_init (struct dprc_obj_desc obj_desc) +int ldpaa_eth_init (int id) {struct eth_device *net_dev =NULL ;struct ldpaa_eth_priv *priv =NULL ;
@@ -626,7 +626,7 @@ int ldpaa_eth_init(struct dprc_obj_desc obj_desc) net_dev->priv = (void *)priv; priv->net_dev = (struct eth_device *)net_dev; - priv->dpni_id = obj_desc.id; + priv->dpni_id = id; err =ldpaa_eth_netdev_init (net_dev);if (err)
include/fsl-mc/fsl_mc.h +4 -1
@@ -29,6 +29,9 @@ ((void __iomem *)((uintptr_t)SOC_MC_PORTALS_BASE_ADDR + \ (_portal_id) * SOC_MC_PORTAL_STRIDE)) +#define MC_PORTAL_OFFSET_TO_PORTAL_ID (_portal_offset) \ + ((_portal_offset) / SOC_MC_PORTAL_STRIDE) +struct mc_ccsr_registers {u32 reg_gcr1;u32 reserved1;
@@ -57,5 +60,5 @@ int get_aiop_apply_status(void);u64 mc_get_dram_addr (void );unsigned long mc_get_dram_block_size (void );int fsl_mc_ldpaa_init (bd_t *bis); -void fsl_mc_ldpaa_exit (bd_t *bis); +int fsl_mc_ldpaa_exit (bd_t *bd);#endif
include/fsl-mc/fsl_mc_private.h +21 -2
@@ -18,13 +18,14 @@#include <fsl-mc/fsl_mc_cmd.h> #include <fsl-mc/fsl_dprc.h> #include <fsl-mc/fsl_dpbp.h> +#include <fsl-mc/fsl_dpni.h> extern struct fsl_mc_io *dflt_mc_io;/** * struct dpbp_node - DPBP strucuture * @uint16_t handle: DPBP object handle -* @int dpbp_id: DPBP id +* @struct dpbp_attr: DPBP attribute */ struct fsl_dpbp_obj {uint16_t dpbp_handle;
@@ -40,11 +41,29 @@ extern struct fsl_dpbp_obj *dflt_dpbp;*/ struct fsl_dpio_obj {int dpio_id; +uint16_t dpio_handle;struct qbman_swp *sw_portal;/** SW portal object */ };extern struct fsl_dpio_obj *dflt_dpio; +/** +* struct dpni_node - DPNI strucuture +* @int dpni_id: DPNI id +* @uint16_t handle: DPNI object handle +* @struct dpni_attr: DPNI attributes +* @struct dpni_buffer_layout: DPNI buffer layout +*/ +struct fsl_dpni_obj { +int dpni_id; +uint16_t dpni_handle; +struct dpni_attr dpni_attrs; +struct dpni_buffer_layout buf_layout; +}; + +extern struct fsl_dpni_obj *dflt_dpni; +int mc_init (u64 mc_fw_addr,u64 mc_dpc_addr); -int ldpaa_eth_init (struct dprc_obj_desc obj_desc); +int ldpaa_eth_init (int dpmac_id); +int mc_apply_dpl (u64 mc_dpl_addr);#endif /* _FSL_MC_PRIVATE_H_ */
Signature · 1 line
1.9.1
York Sun
AppliedPATCH v4 8/10 driver: net: fsl-mc: Create DPAA2 object at run-time
Quoted 13 lines · Prabhakar Kushwaha
Freescale's DPAA2 ethernet driver depends upon the static DPL for the DPRC, DPNI, DPBP, DPIO objects.
Instead of static objects, Create DPNI, DPBP, DPIO objects at run-time.
Signed-off-by Prabhakar Kushwaha <[email protected]>---
Changes for v2: Use Child container for object creation Changes for v3:
- Avoid linux boot if MC up and DPL is not deployed
- Boot Linux is MC is not booted
Changes for v4: Sending as it is
Quoted 7 lines
board/freescale/ls2085aqds/ls2085aqds.c | 5 +- board/freescale/ls2085ardb/ls2085ardb.c | 5 +- drivers/net/fsl-mc/mc.c | 467 +++++++++++++++++++++++++++++--- drivers/net/ldpaa_eth/ldpaa_eth.c | 4 +- include/fsl-mc/fsl_mc.h | 5 +- include/fsl-mc/fsl_mc_private.h | 23 +- 6 files changed, 468 insertions(+), 41 deletions(-)
Applied to fsl-qoriq master. Thanks.
York
PATCH v4 9/10 driver: net: ldpaa: Use DPMAC as net device
In reply to Prabhakar KushwahaAs per current implementation of DPAA2 ethernet driver DPNI is used as net device. DPNI is tangible objects can be multiple connected to same physical lane.
Use DPMAC as net device where it represents physical lane. Below modification done in driver
- Use global DPNI object
- Connect DPMAC to DPNI
- Create and destroy DPMAC
---
Changes for v2: Use Child container for DPMAC, DPMAC-DPNI connection Changes for v3: Sending as it is
Changes for v4: Set link speed in DPMAC
drivers/net/fsl-mc/mc.c | 6 ++ drivers/net/ldpaa_eth/ldpaa_eth.c | 163 +++++++++++++++++++++++++++++--------- drivers/net/ldpaa_eth/ldpaa_eth.h | 17 ++-- include/fsl-mc/fsl_mc_private.h | 3 +- 4 files changed, 144 insertions(+), 45 deletions(-)
drivers/net/fsl-mc/mc.c +6 -0
@@ -659,6 +659,12 @@ unsigned long mc_get_dram_block_size(void)int fsl_mc_ldpaa_init (bd_t *bis) { +int i; + +for (i =WRIOP1_DPMAC1 ; i <NUM_WRIOP_PORTS ; i++) +if ((wriop_is_enabled_dpmac (i) ==1 ) && + (wriop_get_phy_address (i) !=-1 )) +ldpaa_eth_init (i,wriop_get_enet_if (i));return 0 ; }
drivers/net/ldpaa_eth/ldpaa_eth.c +126 -37
322 lines not on this page · raw message
drivers/net/ldpaa_eth/ldpaa_eth.h +10 -7
@@ -117,13 +117,9 @@ struct ldpaa_fas {struct ldpaa_eth_priv {struct eth_device *net_dev; -int dpni_id; -uint16_t dpni_handle; -struct dpni_attr dpni_attrs; -/* Insofar as the MC is concerned, we're using one layout on all 3 types -* of buffers (Rx, Tx, Tx-Conf). -*/ -struct dpni_buffer_layout buf_layout; +int dpmac_id; +uint16_t dpmac_handle; +uint16_t tx_data_offset;uint32_t rx_dflt_fqid;
@@ -134,9 +130,14 @@ struct ldpaa_eth_priv {struct phy_device *phydev; }; +struct dprc_endpoint dpmac_endpoint; +struct dprc_endpoint dpni_endpoint; +extern struct fsl_mc_io *dflt_mc_io;extern struct fsl_dpbp_obj *dflt_dpbp;extern struct fsl_dpio_obj *dflt_dpio; +extern struct fsl_dpni_obj *dflt_dpni; +extern uint16_t dflt_dprc_handle;static void ldpaa_dpbp_drain_cnt (int count);static void ldpaa_dpbp_drain (void );
@@ -145,4 +146,6 @@ static void ldpaa_dpbp_free(void);static int ldpaa_dpni_setup (struct ldpaa_eth_priv *priv);static int ldpaa_dpbp_setup (void );static int ldpaa_dpni_bind (struct ldpaa_eth_priv *priv); +static int ldpaa_dpmac_setup (struct ldpaa_eth_priv *priv); +static int ldpaa_dpmac_bind (struct ldpaa_eth_priv *priv);#endif /* __LDPAA_H */
include/fsl-mc/fsl_mc_private.h +2 -1
@@ -13,6 +13,7 @@#include <linux/compat.h> #include <linux/types.h> #include <linux/stringify.h> +#include <phy.h> #include <fsl-mc/fsl_mc_sys.h> #include <fsl-mc/fsl_mc_cmd.h>
@@ -64,6 +65,6 @@ struct fsl_dpni_obj {extern struct fsl_dpni_obj *dflt_dpni;int mc_init (u64 mc_fw_addr,u64 mc_dpc_addr); -int ldpaa_eth_init (int dpmac_id); +int ldpaa_eth_init (int dpmac_id,phy_interface_t enet_if);int mc_apply_dpl (u64 mc_dpl_addr);#endif /* _FSL_MC_PRIVATE_H_ */
Signature · 1 line
1.9.1
York Sun
AppliedPATCH v4 9/10 driver: net: ldpaa: Use DPMAC as net device
Quoted 15 lines · Prabhakar Kushwaha
As per current implementation of DPAA2 ethernet driver DPNI is used as net device. DPNI is tangible objects can be multiple connected to same physical lane.
Use DPMAC as net device where it represents physical lane. Below modification done in driver
- Use global DPNI object
- Connect DPMAC to DPNI
- Create and destroy DPMACSigned-off-by Prabhakar Kushwaha <[email protected]>---
Changes for v2: Use Child container for DPMAC, DPMAC-DPNI connection Changes for v3: Sending as it is
Changes for v4: Set link speed in DPMAC
Quoted 5 lines
drivers/net/fsl-mc/mc.c | 6 ++ drivers/net/ldpaa_eth/ldpaa_eth.c | 163 +++++++++++++++++++++++++++++--------- drivers/net/ldpaa_eth/ldpaa_eth.h | 17 ++-- include/fsl-mc/fsl_mc_private.h | 3 +- 4 files changed, 144 insertions(+), 45 deletions(-)
Applied to fsl-qoriq master. Thanks.
York
PATCH v4 10/10 driver: net: ldpaa: Add debug information
In reply to Prabhakar KushwahaAdd following debug information in the driver
- Get various DPNI counter values
- Get link status of DPNI objects
- Get information of both ends of connection (DPMAC - DPNI)
---
Changes for v2: Use child container for DPMAC-DPNI connection Changes for v3: Sending as it is
Changes for v4: Sending as it is
drivers/net/ldpaa_eth/ldpaa_eth.c | 123 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+)
drivers/net/ldpaa_eth/ldpaa_eth.c +123 -0
@@ -24,6 +24,84 @@ static int init_phy(struct eth_device *dev)return 0 ; } +#ifdef DEBUG +static void ldpaa_eth_get_dpni_counter (void ) +{ +int err =0 ; +u64 value; + + err =dpni_get_counter (dflt_mc_io,MC_CMD_NO_FLAGS , + dflt_dpni->dpni_handle, +DPNI_CNT_ING_FRAME , + &value); +if (err <0 ) { +printf ("dpni_get_counter: DPNI_CNT_ING_FRAME failed\n" ); +return ; + } +printf ("DPNI_CNT_ING_FRAME=%lld\n" , value); + + err =dpni_get_counter (dflt_mc_io,MC_CMD_NO_FLAGS , + dflt_dpni->dpni_handle, +DPNI_CNT_ING_BYTE , + &value); +if (err <0 ) { +printf ("dpni_get_counter: DPNI_CNT_ING_BYTE failed\n" ); +return ; + } +printf ("DPNI_CNT_ING_BYTE=%lld\n" , value); + + err =dpni_get_counter (dflt_mc_io,MC_CMD_NO_FLAGS , + dflt_dpni->dpni_handle, +DPNI_CNT_ING_FRAME_DROP , + &value); +if (err <0 ) { +printf ("dpni_get_counter: DPNI_CNT_ING_FRAME_DROP failed\n" ); +return ; + } +printf ("DPNI_CNT_ING_FRAME_DROP =%lld\n" , value); + + err =dpni_get_counter (dflt_mc_io,MC_CMD_NO_FLAGS , + dflt_dpni->dpni_handle, +DPNI_CNT_ING_FRAME_DISCARD , + &value); +if (err <0 ) { +printf ("dpni_get_counter: DPNI_CNT_ING_FRAME_DISCARD failed\n" ); +return ; + } +printf ("DPNI_CNT_ING_FRAME_DISCARD=%lld\n" , value); + + err =dpni_get_counter (dflt_mc_io,MC_CMD_NO_FLAGS , + dflt_dpni->dpni_handle, +DPNI_CNT_EGR_FRAME , + &value); +if (err <0 ) { +printf ("dpni_get_counter: DPNI_CNT_EGR_FRAME failed\n" ); +return ; + } +printf ("DPNI_CNT_EGR_FRAME=%lld\n" , value); + + err =dpni_get_counter (dflt_mc_io,MC_CMD_NO_FLAGS , + dflt_dpni->dpni_handle, +DPNI_CNT_EGR_BYTE , + &value); +if (err <0 ) { +printf ("dpni_get_counter: DPNI_CNT_EGR_BYTE failed\n" ); +return ; + } +printf ("DPNI_CNT_EGR_BYTE =%lld\n" , value); + + err =dpni_get_counter (dflt_mc_io,MC_CMD_NO_FLAGS , + dflt_dpni->dpni_handle, +DPNI_CNT_EGR_FRAME_DISCARD , + &value); +if (err <0 ) { +printf ("dpni_get_counter: DPNI_CNT_EGR_FRAME_DISCARD failed\n" ); +return ; + } +printf ("DPNI_CNT_EGR_FRAME_DISCARD =%lld\n" , value); +} +#endif +static void ldpaa_eth_rx (struct ldpaa_eth_priv *priv,const struct dpaa_fd *fd) {
@@ -222,6 +300,9 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)net_dev->priv;struct dpni_queue_attr rx_queue_attr;struct dpmac_link_state dpmac_link_state = {0 }; +#ifdef DEBUG +struct dpni_link_state link_state; +#endif int err;if (net_dev->state ==ETH_STATE_ACTIVE )
@@ -295,6 +376,20 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)printf ("dpmac_set_link_state() failed\n" );return err; } + +#ifdef DEBUG + err =dpni_get_link_state (dflt_mc_io,MC_CMD_NO_FLAGS , + dflt_dpni->dpni_handle, &link_state); +if (err <0 ) { +printf ("dpni_get_link_state() failed\n" ); +return err; + } + +printf ("link status: %d - " , link_state.up); + link_state.up ==0 ?printf ("down\n" ) : + link_state.up ==1 ?printf ("up\n" ) :printf ("error state\n" ); +#endif +/* TODO: support multiple Rx flows */ err =dpni_get_rx_flow (dflt_mc_io,MC_CMD_NO_FLAGS , dflt_dpni->dpni_handle,0 ,0 , &rx_queue_attr);
@@ -339,6 +434,10 @@ static void ldpaa_eth_stop(struct eth_device *net_dev) (net_dev->state == ETH_STATE_INIT))return ; +#ifdef DEBUG +ldpaa_eth_get_dpni_counter (); +#endif + err =dprc_disconnect (dflt_mc_io,MC_CMD_NO_FLAGS , dflt_dprc_handle, &dpmac_endpoint);if (err <0 )
@@ -523,6 +622,11 @@ static int ldpaa_dpmac_bind(struct ldpaa_eth_priv *priv) .max_rate = 0 }; +#ifdef DEBUG +struct dprc_endpoint dbg_endpoint; +int state =0 ; +#endif +memset (&dpmac_endpoint,0 ,sizeof (struct dprc_endpoint ));sprintf (dpmac_endpoint.type,"dpmac" ); dpmac_endpoint.id = priv->dpmac_id;
@@ -536,6 +640,25 @@ static int ldpaa_dpmac_bind(struct ldpaa_eth_priv *priv) &dpmac_endpoint, &dpni_endpoint, &dprc_connection_cfg); +if (err) +printf ("dprc_connect() failed\n" ); + +#ifdef DEBUG + err =dprc_get_connection (dflt_mc_io,MC_CMD_NO_FLAGS , + dflt_dprc_handle, &dpni_endpoint, + &dbg_endpoint, &state); +printf ("%s, DPMAC Type= %s\n" , __func__, dbg_endpoint.type); +printf ("%s, DPMAC ID= %d\n" , __func__, dbg_endpoint.id); +printf ("%s, DPMAC State= %d\n" , __func__, state); + +memset (&dbg_endpoint,0 ,sizeof (struct dprc_endpoint )); + err =dprc_get_connection (dflt_mc_io,MC_CMD_NO_FLAGS , + dflt_dprc_handle, &dpmac_endpoint, + &dbg_endpoint, &state); +printf ("%s, DPNI Type= %s\n" , __func__, dbg_endpoint.type); +printf ("%s, DPNI ID= %d\n" , __func__, dbg_endpoint.id); +printf ("%s, DPNI State= %d\n" , __func__, state); +#endif return err; }
Signature · 1 line
1.9.1
York Sun
AppliedPATCH v4 10/10 driver: net: ldpaa: Add debug information
Quoted 6 lines · Prabhakar Kushwaha
Add following debug information in the driver
- Get various DPNI counter values
- Get link status of DPNI objects
- Get information of both ends of connection (DPMAC - DPNI)Signed-off-by Prabhakar Kushwaha <[email protected]>
Quoted 9 lines
---
Changes for v2: Use child container for DPMAC-DPNI connection Changes for v3: Sending as it is
Changes for v4: Sending as it isdrivers/net/ldpaa_eth/ldpaa_eth.c | 123 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+)
Applied to fsl-qoriq master. Thanks.
York
PATCH v2 1/1 driver: net: ldpaa: Fix Rx buffer alignment
In reply to Prabhakar KushwahaMC 0.7.1.2 enforces limitation i.e.: "Packets may be corrupted in several combinations of buffer size and frame offsets.
Workaround: Use buffers that are of size that is a multiple of 256, and frame offset that is a multiple of 256"
Updating the DPNI Eth driver to comply with the restriction.
---
Changes for v2: Updated description
drivers/net/ldpaa_eth/ldpaa_eth.c | 11 ++++++++--- drivers/net/ldpaa_eth/ldpaa_eth.h | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-)
drivers/net/ldpaa_eth/ldpaa_eth.c +8 -3
@@ -500,7 +500,7 @@ static int ldpaa_bp_add_7(uint16_t bpid)struct qbman_release_desc rd;for (i =0 ; i <7 ; i++) { - addr =memalign (L1_CACHE_BYTES ,LDPAA_ETH_RX_BUFFER_SIZE ); + addr =memalign (LDPAA_ETH_BUF_ALIGN ,LDPAA_ETH_RX_BUFFER_SIZE );if (!addr) {printf ("addr allocation failed\n" ); goto err_alloc;
@@ -685,10 +685,13 @@ static int ldpaa_dpni_setup(struct ldpaa_eth_priv *priv)/* Configure our buffers' layout */ dflt_dpni->buf_layout.options =DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |DPNI_BUF_LAYOUT_OPT_FRAME_STATUS | -DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE ; +DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE | +DPNI_BUF_LAYOUT_OPT_DATA_ALIGN ; dflt_dpni->buf_layout.pass_parser_result = true; dflt_dpni->buf_layout.pass_frame_status = true; dflt_dpni->buf_layout.private_data_size =LDPAA_ETH_SWA_SIZE ; +/* HW erratum mandates data alignment in multiples of 256 */ + dflt_dpni->buf_layout.data_align =LDPAA_ETH_BUF_ALIGN ;/* ...rx, ... */ err = dpni_set_rx_buffer_layout(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle,
@@ -699,7 +702,9 @@ static int ldpaa_dpni_setup(struct ldpaa_eth_priv *priv) }/* ... tx, ... */ - dflt_dpni->buf_layout.options &= ~DPNI_BUF_LAYOUT_OPT_PARSER_RESULT ; +/* remove Rx-only options */ + dflt_dpni->buf_layout.options &= ~(DPNI_BUF_LAYOUT_OPT_DATA_ALIGN | +DPNI_BUF_LAYOUT_OPT_PARSER_RESULT ); err =dpni_set_tx_buffer_layout (dflt_mc_io,MC_CMD_NO_FLAGS , dflt_dpni->dpni_handle, &dflt_dpni->buf_layout);
drivers/net/ldpaa_eth/ldpaa_eth.h +3 -3
@@ -28,10 +28,10 @@ enum ldpaa_eth_type {#define LDPAA_ETH_REFILL_THRESH (LDPAA_ETH_NUM_BUFS/2)#define LDPAA_ETH_RX_BUFFER_SIZE 2048 -/* Hardware requires alignment for ingress/egress buffer addresses -* and ingress buffer lengths. +/* Hardware requires alignment for buffer address and length: 256-byte +* for ingress, 64-byte for egress. Using 256 for both. */ -#define LDPAA_ETH_BUF_ALIGN 64 +#define LDPAA_ETH_BUF_ALIGN 256/* So far we're only accomodating a skb backpointer in the frame's * software annotation, but the hardware options are either 0 or 64.
Signature · 1 line
1.9.1
York Sun
AppliedPATCH v2 1/1 driver: net: ldpaa: Fix Rx buffer alignment
Quoted 7 lines · Prabhakar Kushwaha
MC 0.7.1.2 enforces limitation i.e.: "Packets may be corrupted in several combinations of buffer size and frame offsets.
Workaround: Use buffers that are of size that is a multiple of 256, and frame offset that is a multiple of 256"Updating the DPNI Eth driver to comply with the restriction.
Quoted 8 lines
Signed-off-by Bogdan Hamciuc <[email protected]>Signed-off-by Prabhakar Kushwaha <[email protected]>---
Changes for v2: Updated descriptiondrivers/net/ldpaa_eth/ldpaa_eth.c | 11 ++++++++--- drivers/net/ldpaa_eth/ldpaa_eth.h | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-)
Applied to fsl-qoriq master. Thanks.
York