driver: net: ldpaa: Add support of new architeture
Subsystems (2)
v2 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 v2 1/10 armv8: lsch3: Fix lane protocol parsing logic
Current implementation only consider SGMIIs for dpmac initialization. XFI serdes protocols also uses dpmac.
So fix lan protocol parsing logic to consider both XFIs and SGMIIs.
---
Changes for v2: Sending as it is.
arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c +1 -1
@@ -116,7 +116,7 @@ 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 >=SGMII1 && +if (lane_prtcl >=XFI1 && lane_prtcl <=SGMII16 )wriop_init_dpmac (sd, lane +1 , (int )lane_prtcl);
Signature · 1 line
1.9.1
PATCH v2 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.
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
PATCH v2 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
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
PATCH v2 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.
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
PATCH v2 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.
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
PATCH v2 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.
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
PATCH v2 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.
arch/arm/cpu/armv8/fsl-layerscape/README.lsch3 | 30 ++ drivers/net/fsl-mc/mc.c | 376 ++++++++++++------------- 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, 214 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 +178 -198
531 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 v2 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
board/freescale/ls2085aqds/ls2085aqds.c | 1 - board/freescale/ls2085ardb/ls2085ardb.c | 1 - drivers/net/fsl-mc/mc.c | 455 +++++++++++++++++++++++++++++--- drivers/net/ldpaa_eth/ldpaa_eth.c | 4 +- include/fsl-mc/fsl_mc.h | 4 +- include/fsl-mc/fsl_mc_private.h | 23 +- 6 files changed, 447 insertions(+), 41 deletions(-)
board/freescale/ls2085aqds/ls2085aqds.c +0 -1
@@ -309,7 +309,6 @@ int ft_board_setup(void *blob, bd_t *bd)#ifdef CONFIG_FSL_MC_ENET fdt_fixup_board_enet (blob); -fsl_mc_ldpaa_exit (bd);#endif return 0 ;
board/freescale/ls2085ardb/ls2085ardb.c +0 -1
@@ -275,7 +275,6 @@ int ft_board_setup(void *blob, bd_t *bd)#ifdef CONFIG_FSL_MC_ENET fdt_fixup_board_enet (blob); -fsl_mc_ldpaa_exit (bd);#endif return 0 ;
drivers/net/fsl-mc/mc.c +421 -34
540 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 +3 -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,4 @@ 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);#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
PATCH v2 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
drivers/net/fsl-mc/mc.c | 6 ++ drivers/net/ldpaa_eth/ldpaa_eth.c | 153 +++++++++++++++++++++++++++++--------- drivers/net/ldpaa_eth/ldpaa_eth.h | 17 +++-- include/fsl-mc/fsl_mc_private.h | 3 +- 4 files changed, 134 insertions(+), 45 deletions(-)
drivers/net/fsl-mc/mc.c +6 -0
@@ -653,6 +653,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 +116 -37
307 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
PATCH v2 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.
drivers/net/ldpaa_eth/ldpaa_eth.c | 121 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+)
drivers/net/ldpaa_eth/ldpaa_eth.c +121 -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) {
@@ -221,6 +299,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; +#ifdef DEBUG +struct dpni_link_state link_state; +#endif int err;if (net_dev->state ==ETH_STATE_ACTIVE )
@@ -285,6 +366,18 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)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);
@@ -329,6 +422,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 )
@@ -513,6 +610,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;
@@ -526,6 +628,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