All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 00/10][v4] driver: net: ldpaa: Add support of new architeture
@ 2015-11-04  6:55 Prabhakar Kushwaha
  2015-11-04  6:55 ` [U-Boot] [PATCH 01/10][v4] armv8: lsch3: Fix lane protocol parsing logic Prabhakar Kushwaha
                   ` (10 more replies)
  0 siblings, 11 replies; 24+ messages in thread
From: Prabhakar Kushwaha @ 2015-11-04  6:55 UTC (permalink / raw)
  To: u-boot

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

-- 
1.9.1

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 01/10][v4] armv8: lsch3: Fix lane protocol parsing logic
  2015-11-04  6:55 [U-Boot] [PATCH 00/10][v4] driver: net: ldpaa: Add support of new architeture Prabhakar Kushwaha
@ 2015-11-04  6:55 ` Prabhakar Kushwaha
  2015-11-30 17:01   ` York Sun
  2015-11-04  6:55 ` [U-Boot] [PATCH 02/10][v4] driver: net: fsl-mc: Add create, destroy APIs in flibs Prabhakar Kushwaha
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Prabhakar Kushwaha @ 2015-11-04  6:55 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
---
 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(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
index 2ab8da6..918e889 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
@@ -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,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 02/10][v4] driver: net: fsl-mc: Add create, destroy APIs in flibs
  2015-11-04  6:55 [U-Boot] [PATCH 00/10][v4] driver: net: ldpaa: Add support of new architeture Prabhakar Kushwaha
  2015-11-04  6:55 ` [U-Boot] [PATCH 01/10][v4] armv8: lsch3: Fix lane protocol parsing logic Prabhakar Kushwaha
@ 2015-11-04  6:55 ` Prabhakar Kushwaha
  2015-11-30 17:02   ` York Sun
  2015-11-04  6:55 ` [U-Boot] [PATCH 03/10][v4] driver: net: fsl-mc: Add APIs for DPMAC objects in FLIB Prabhakar Kushwaha
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Prabhakar Kushwaha @ 2015-11-04  6:55 UTC (permalink / raw)
  To: u-boot

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 <prabhakar@freescale.com>
---
 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(+)

diff --git a/drivers/net/fsl-mc/dpbp.c b/drivers/net/fsl-mc/dpbp.c
index 1517a70..ba9536d 100644
--- a/drivers/net/fsl-mc/dpbp.c
+++ b/drivers/net/fsl-mc/dpbp.c
@@ -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)
diff --git a/drivers/net/fsl-mc/dpio/dpio.c b/drivers/net/fsl-mc/dpio/dpio.c
index cd3fd50..b61df52 100644
--- a/drivers/net/fsl-mc/dpio/dpio.c
+++ b/drivers/net/fsl-mc/dpio/dpio.c
@@ -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)
diff --git a/drivers/net/fsl-mc/dpni.c b/drivers/net/fsl-mc/dpni.c
index 9111f35..eacb3c8 100644
--- a/drivers/net/fsl-mc/dpni.c
+++ b/drivers/net/fsl-mc/dpni.c
@@ -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,
diff --git a/drivers/net/fsl-mc/dprc.c b/drivers/net/fsl-mc/dprc.c
index 357aa48..7d34355 100644
--- a/drivers/net/fsl-mc/dprc.c
+++ b/drivers/net/fsl-mc/dprc.c
@@ -72,6 +72,52 @@ int dprc_close(struct fsl_mc_io *mc_io,
 	return mc_send_command(mc_io, &cmd);
 }
 
+int dprc_create_container(struct fsl_mc_io *mc_io,
+			  uint32_t cmd_flags,
+			  uint16_t token,
+			  struct dprc_cfg *cfg,
+			  int *child_container_id,
+			  uint64_t *child_portal_paddr)
+{
+	struct mc_command cmd = { 0 };
+	int err;
+
+	/* prepare command */
+	DPRC_CMD_CREATE_CONTAINER(cmd, cfg);
+
+	cmd.header = mc_encode_cmd_header(DPRC_CMDID_CREATE_CONT,
+					  cmd_flags,
+					  token);
+
+	/* send command to mc*/
+	err = mc_send_command(mc_io, &cmd);
+	if (err)
+		return err;
+
+	/* retrieve response parameters */
+	DPRC_RSP_CREATE_CONTAINER(cmd, *child_container_id,
+				  *child_portal_paddr);
+
+	return 0;
+}
+
+int dprc_destroy_container(struct fsl_mc_io *mc_io,
+			   uint32_t cmd_flags,
+			   uint16_t token,
+			   int child_container_id)
+{
+	struct mc_command cmd = { 0 };
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPRC_CMDID_DESTROY_CONT,
+					  cmd_flags,
+					  token);
+	DPRC_CMD_DESTROY_CONTAINER(cmd, child_container_id);
+
+	/* send command to mc*/
+	return mc_send_command(mc_io, &cmd);
+}
+
 int dprc_reset_container(struct fsl_mc_io *mc_io,
 			 uint32_t cmd_flags,
 			 uint16_t token,
diff --git a/include/fsl-mc/fsl_dpbp.h b/include/fsl-mc/fsl_dpbp.h
index 3cdc94e..92c5437 100644
--- a/include/fsl-mc/fsl_dpbp.h
+++ b/include/fsl-mc/fsl_dpbp.h
@@ -20,6 +20,8 @@
 /* Command IDs */
 #define DPBP_CMDID_CLOSE				0x800
 #define DPBP_CMDID_OPEN					0x804
+#define DPBP_CMDID_CREATE				0x904
+#define DPBP_CMDID_DESTROY				0x900
 
 #define DPBP_CMDID_ENABLE				0x002
 #define DPBP_CMDID_DISABLE				0x003
@@ -83,6 +85,52 @@ int dpbp_close(struct fsl_mc_io	*mc_io,
 	       uint16_t	token);
 
 /**
+ * struct dpbp_cfg - Structure representing DPBP configuration
+ * @options:	place holder
+ */
+struct dpbp_cfg {
+	uint32_t options;
+};
+
+/**
+ * dpbp_create() - Create the DPBP object.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @cfg:	Configuration structure
+ * @token:	Returned token; use in subsequent API calls
+ *
+ * Create the DPBP object, allocate required resources and
+ * perform required initialization.
+ *
+ * The object can be created either by declaring it in the
+ * DPL file, or by calling this function.
+ * This function returns a unique authentication token,
+ * associated with the specific object ID and the specific MC
+ * portal; this token must be used in all subsequent calls to
+ * this specific object. For objects that are created using the
+ * DPL file, call dpbp_open function to get an authentication
+ * token first.
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpbp_create(struct fsl_mc_io	*mc_io,
+		uint32_t		cmd_flags,
+		const struct dpbp_cfg	*cfg,
+		uint16_t		*token);
+
+/**
+ * dpbp_destroy() - Destroy the DPBP object and release all its resources.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPBP object
+ *
+ * Return:	'0' on Success; error code otherwise.
+ */
+int dpbp_destroy(struct fsl_mc_io	*mc_io,
+		 uint32_t		cmd_flags,
+		 uint16_t		token);
+
+/**
  * dpbp_enable() - Enable the DPBP.
  * @mc_io:	Pointer to MC portal's I/O object
  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
diff --git a/include/fsl-mc/fsl_dpio.h b/include/fsl-mc/fsl_dpio.h
index 9e83a2e..0bc0b44 100644
--- a/include/fsl-mc/fsl_dpio.h
+++ b/include/fsl-mc/fsl_dpio.h
@@ -14,6 +14,8 @@
 /* Command IDs */
 #define DPIO_CMDID_CLOSE					0x800
 #define DPIO_CMDID_OPEN						0x803
+#define DPIO_CMDID_CREATE					0x903
+#define DPIO_CMDID_DESTROY					0x900
 
 #define DPIO_CMDID_ENABLE					0x002
 #define DPIO_CMDID_DISABLE					0x003
@@ -25,6 +27,14 @@
 	MC_CMD_OP(cmd, 0, 0,  32, int,     dpio_id)
 
 /*                cmd, param, offset, width, type, arg_name */
+#define DPIO_CMD_CREATE(cmd, cfg) \
+do { \
+	MC_CMD_OP(cmd, 0, 16, 2,  enum dpio_channel_mode,	\
+					   cfg->channel_mode);\
+	MC_CMD_OP(cmd, 0, 32, 8,  uint8_t, cfg->num_priorities);\
+} while (0)
+
+/*                cmd, param, offset, width, type, arg_name */
 #define DPIO_RSP_GET_ATTR(cmd, attr) \
 do { \
 	MC_RSP_OP(cmd, 0, 0,  32, int,	    attr->id);\
@@ -90,6 +100,56 @@ enum dpio_channel_mode {
 };
 
 /**
+ * struct dpio_cfg - Structure representing DPIO configuration
+ * @channel_mode: Notification channel mode
+ * @num_priorities: Number of priorities for the notification channel (1-8);
+ *			relevant only if 'channel_mode = DPIO_LOCAL_CHANNEL'
+ */
+struct dpio_cfg {
+	enum dpio_channel_mode	channel_mode;
+	uint8_t		num_priorities;
+};
+
+/**
+ * dpio_create() - Create the DPIO object.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @cfg:	Configuration structure
+ * @token:	Returned token; use in subsequent API calls
+ *
+ * Create the DPIO object, allocate required resources and
+ * perform required initialization.
+ *
+ * The object can be created either by declaring it in the
+ * DPL file, or by calling this function.
+ *
+ * This function returns a unique authentication token,
+ * associated with the specific object ID and the specific MC
+ * portal; this token must be used in all subsequent calls to
+ * this specific object. For objects that are created using the
+ * DPL file, call dpio_open() function to get an authentication
+ * token first.
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpio_create(struct fsl_mc_io	*mc_io,
+		uint32_t		cmd_flags,
+		const struct dpio_cfg	*cfg,
+		uint16_t		*token);
+
+/**
+ * dpio_destroy() - Destroy the DPIO object and release all its resources.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPIO object
+ *
+ * Return:	'0' on Success; Error code otherwise
+ */
+int dpio_destroy(struct fsl_mc_io	*mc_io,
+		 uint32_t		cmd_flags,
+		 uint16_t		token);
+
+/**
  * dpio_enable() - Enable the DPIO, allow I/O portal operations.
  * @mc_io:	Pointer to MC portal's I/O object
  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
diff --git a/include/fsl-mc/fsl_dpni.h b/include/fsl-mc/fsl_dpni.h
index e9a4712..140a009 100644
--- a/include/fsl-mc/fsl_dpni.h
+++ b/include/fsl-mc/fsl_dpni.h
@@ -13,6 +13,8 @@
 /* Command IDs */
 #define DPNI_CMDID_OPEN				0x801
 #define DPNI_CMDID_CLOSE			0x800
+#define DPNI_CMDID_CREATE			0x901
+#define DPNI_CMDID_DESTROY			0x900
 
 #define DPNI_CMDID_ENABLE			0x002
 #define DPNI_CMDID_DISABLE			0x003
@@ -48,6 +50,46 @@
 #define DPNI_CMD_OPEN(cmd, dpni_id) \
 	MC_CMD_OP(cmd,	 0,	0,	32,	int,	dpni_id)
 
+/*                cmd, param, offset, width, type, arg_name */
+#define DPNI_CMD_CREATE(cmd, cfg) \
+do { \
+	MC_CMD_OP(cmd, 0, 0,	8,  uint8_t,  cfg->adv.max_tcs); \
+	MC_CMD_OP(cmd, 0, 8,	8,  uint8_t,  cfg->adv.max_senders); \
+	MC_CMD_OP(cmd, 0, 16,	8,  uint8_t,  cfg->mac_addr[5]); \
+	MC_CMD_OP(cmd, 0, 24,	8,  uint8_t,  cfg->mac_addr[4]); \
+	MC_CMD_OP(cmd, 0, 32,	8,  uint8_t,  cfg->mac_addr[3]); \
+	MC_CMD_OP(cmd, 0, 40,	8,  uint8_t,  cfg->mac_addr[2]); \
+	MC_CMD_OP(cmd, 0, 48,	8,  uint8_t,  cfg->mac_addr[1]); \
+	MC_CMD_OP(cmd, 0, 56,	8,  uint8_t,  cfg->mac_addr[0]); \
+	MC_CMD_OP(cmd, 1, 0,	32, uint32_t, cfg->adv.options); \
+	MC_CMD_OP(cmd, 2, 0,	8,  uint8_t,  cfg->adv.max_unicast_filters); \
+	MC_CMD_OP(cmd, 2, 8,	8,  uint8_t,  cfg->adv.max_multicast_filters); \
+	MC_CMD_OP(cmd, 2, 16,	8,  uint8_t,  cfg->adv.max_vlan_filters); \
+	MC_CMD_OP(cmd, 2, 24,	8,  uint8_t,  cfg->adv.max_qos_entries); \
+	MC_CMD_OP(cmd, 2, 32,	8,  uint8_t,  cfg->adv.max_qos_key_size); \
+	MC_CMD_OP(cmd, 2, 48,	8,  uint8_t,  cfg->adv.max_dist_key_size); \
+	MC_CMD_OP(cmd, 2, 56,	8,  enum net_prot, cfg->adv.start_hdr); \
+	MC_CMD_OP(cmd, 3, 0,	8,  uint8_t,  cfg->adv.max_dist_per_tc[0]); \
+	MC_CMD_OP(cmd, 3, 8,	8,  uint8_t,  cfg->adv.max_dist_per_tc[1]); \
+	MC_CMD_OP(cmd, 3, 16,	8,  uint8_t,  cfg->adv.max_dist_per_tc[2]); \
+	MC_CMD_OP(cmd, 3, 24,	8,  uint8_t,  cfg->adv.max_dist_per_tc[3]); \
+	MC_CMD_OP(cmd, 3, 32,	8,  uint8_t,  cfg->adv.max_dist_per_tc[4]); \
+	MC_CMD_OP(cmd, 3, 40,	8,  uint8_t,  cfg->adv.max_dist_per_tc[5]); \
+	MC_CMD_OP(cmd, 3, 48,	8,  uint8_t,  cfg->adv.max_dist_per_tc[6]); \
+	MC_CMD_OP(cmd, 3, 56,	8,  uint8_t,  cfg->adv.max_dist_per_tc[7]); \
+	MC_CMD_OP(cmd, 4, 0,	16, uint16_t, \
+				    cfg->adv.ipr_cfg.max_reass_frm_size); \
+	MC_CMD_OP(cmd, 4, 16,	16, uint16_t, \
+				    cfg->adv.ipr_cfg.min_frag_size_ipv4); \
+	MC_CMD_OP(cmd, 4, 32,	16, uint16_t, \
+				    cfg->adv.ipr_cfg.min_frag_size_ipv6); \
+	MC_CMD_OP(cmd, 4, 48,	8,  uint8_t, cfg->adv.max_policers); \
+	MC_CMD_OP(cmd, 4, 56,	8,  uint8_t, cfg->adv.max_congestion_ctrl); \
+	MC_CMD_OP(cmd, 5, 0,	16, uint16_t, \
+				  cfg->adv.ipr_cfg.max_open_frames_ipv4); \
+	MC_CMD_OP(cmd, 5, 16,	16, uint16_t, \
+				  cfg->adv.ipr_cfg.max_open_frames_ipv6); \
+} while (0)
 
 /*                cmd, param, offset, width, type, arg_name */
 #define DPNI_CMD_SET_POOLS(cmd, cfg) \
@@ -475,6 +517,53 @@ int dpni_close(struct fsl_mc_io	*mc_io,
 	       uint32_t		cmd_flags,
 	       uint16_t		token);
 
+/* DPNI configuration options */
+
+/**
+ * Allow different distribution key profiles for different traffic classes;
+ * if not set, a single key profile is assumed
+ */
+#define DPNI_OPT_ALLOW_DIST_KEY_PER_TC		0x00000001
+
+/**
+ * Disable all non-error transmit confirmation; error frames are reported
+ * back to a common Tx error queue
+ */
+#define DPNI_OPT_TX_CONF_DISABLED		0x00000002
+
+/* Disable per-sender private Tx confirmation/error queue */
+#define DPNI_OPT_PRIVATE_TX_CONF_ERROR_DISABLED	0x00000004
+
+/**
+ * Support distribution based on hashed key;
+ * allows statistical distribution over receive queues in a traffic class
+ */
+#define DPNI_OPT_DIST_HASH			0x00000010
+
+/**
+ * Support distribution based on flow steering;
+ * allows explicit control of distribution over receive queues in a traffic
+ * class
+ */
+#define DPNI_OPT_DIST_FS			0x00000020
+
+/* Unicast filtering support */
+#define DPNI_OPT_UNICAST_FILTER			0x00000080
+/* Multicast filtering support */
+#define DPNI_OPT_MULTICAST_FILTER		0x00000100
+/* VLAN filtering support */
+#define DPNI_OPT_VLAN_FILTER			0x00000200
+/* Support IP reassembly on received packets */
+#define DPNI_OPT_IPR				0x00000800
+/* Support IP fragmentation on transmitted packets */
+#define DPNI_OPT_IPF				0x00001000
+/* VLAN manipulation support */
+#define DPNI_OPT_VLAN_MANIPULATION		0x00010000
+/* Support masking of QoS lookup keys */
+#define DPNI_OPT_QOS_MASK_SUPPORT		0x00020000
+/* Support masking of Flow Steering lookup keys */
+#define DPNI_OPT_FS_MASK_SUPPORT		0x00040000
+
 /**
  * struct dpni_ipr_cfg - Structure representing IP reassembly configuration
  * @max_reass_frm_size: Maximum size of the reassembled frame
@@ -492,6 +581,106 @@ struct dpni_ipr_cfg {
 };
 
 /**
+ * struct dpni_cfg - Structure representing DPNI configuration
+ * @mac_addr: Primary MAC address
+ * @adv: Advanced parameters; default is all zeros;
+ *		use this structure to change default settings
+ */
+struct dpni_cfg {
+	uint8_t mac_addr[6];
+	/**
+	 * struct adv - Advanced parameters
+	 * @options: Mask of available options; use 'DPNI_OPT_<X>' values
+	 * @start_hdr: Selects the packet starting header for parsing;
+	 *		'NET_PROT_NONE' is treated as default: 'NET_PROT_ETH'
+	 * @max_senders: Maximum number of different senders; used as the number
+	 *		of dedicated Tx flows; Non-power-of-2 values are rounded
+	 *		up to the next power-of-2 value as hardware demands it;
+	 *		'0' will be treated as '1'
+	 * @max_tcs: Maximum number of traffic classes (for both Tx and Rx);
+	 *		'0' will e treated as '1'
+	 * @max_dist_per_tc: Maximum distribution size per Rx traffic class;
+	 *			Must be set to the required value minus 1;
+	 *			i.e. 0->1, 1->2, ... ,255->256;
+	 *			Non-power-of-2 values are rounded up to the next
+	 *			power-of-2 value as hardware demands it
+	 * @max_unicast_filters: Maximum number of unicast filters;
+	 *			'0' is treated	as '16'
+	 * @max_multicast_filters: Maximum number of multicast filters;
+	 *			'0' is treated as '64'
+	 * @max_qos_entries: if 'max_tcs > 1', declares the maximum entries in
+	 *			the QoS	table; '0' is treated as '64'
+	 * @max_qos_key_size: Maximum key size for the QoS look-up;
+	 *			'0' is treated as '24' which is enough for IPv4
+	 *			5-tuple
+	 * @max_dist_key_size: Maximum key size for the distribution;
+	 *		'0' is treated as '24' which is enough for IPv4 5-tuple
+	 * @max_policers: Maximum number of policers;
+	 *		should be between '0' and max_tcs
+	 * @max_congestion_ctrl: Maximum number of congestion control groups
+	 *		(CGs); covers early drop and congestion notification
+	 *		requirements for traffic classes;
+	 *		should be between '0' and max_tcs
+	 * @ipr_cfg: IP reassembly configuration
+	 */
+	struct {
+		uint32_t		options;
+		enum net_prot		start_hdr;
+		uint8_t		max_senders;
+		uint8_t		max_tcs;
+		uint8_t			max_dist_per_tc[DPNI_MAX_TC];
+		uint8_t		max_unicast_filters;
+		uint8_t		max_multicast_filters;
+		uint8_t			max_vlan_filters;
+		uint8_t		max_qos_entries;
+		uint8_t		max_qos_key_size;
+		uint8_t		max_dist_key_size;
+		uint8_t		max_policers;
+		uint8_t		max_congestion_ctrl;
+		struct dpni_ipr_cfg	ipr_cfg;
+	} adv;
+};
+
+/**
+ * dpni_create() - Create the DPNI object
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @cfg:	Configuration structure
+ * @token:	Returned token; use in subsequent API calls
+ *
+ * Create the DPNI object, allocate required resources and
+ * perform required initialization.
+ *
+ * The object can be created either by declaring it in the
+ * DPL file, or by calling this function.
+ *
+ * This function returns a unique authentication token,
+ * associated with the specific object ID and the specific MC
+ * portal; this token must be used in all subsequent calls to
+ * this specific object. For objects that are created using the
+ * DPL file, call dpni_open() function to get an authentication
+ * token first.
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpni_create(struct fsl_mc_io	*mc_io,
+		uint32_t		cmd_flags,
+		const struct dpni_cfg	*cfg,
+		uint16_t		*token);
+
+/**
+ * dpni_destroy() - Destroy the DPNI object and release all its resources.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPNI object
+ *
+ * Return:	'0' on Success; error code otherwise.
+ */
+int dpni_destroy(struct fsl_mc_io	*mc_io,
+		 uint32_t		cmd_flags,
+		 uint16_t		token);
+
+/**
  * struct dpni_pools_cfg - Structure representing buffer pools configuration
  * @num_dpbp: Number of DPBPs
  * @pools: Array of buffer pools parameters; The number of valid entries
diff --git a/include/fsl-mc/fsl_dprc.h b/include/fsl-mc/fsl_dprc.h
index b2cd2cb..a87179d 100644
--- a/include/fsl-mc/fsl_dprc.h
+++ b/include/fsl-mc/fsl_dprc.h
@@ -16,10 +16,13 @@
 /* Command IDs */
 #define DPRC_CMDID_CLOSE			0x800
 #define DPRC_CMDID_OPEN				0x805
+#define DPRC_CMDID_CREATE			0x905
 
 #define DPRC_CMDID_GET_ATTR			0x004
 #define DPRC_CMDID_RESET_CONT			0x005
 
+#define DPRC_CMDID_CREATE_CONT			0x151
+#define DPRC_CMDID_DESTROY_CONT			0x152
 #define DPRC_CMDID_GET_CONT_ID			0x830
 #define DPRC_CMDID_GET_OBJ_COUNT		0x159
 #define DPRC_CMDID_GET_OBJ			0x15A
@@ -40,6 +43,41 @@
 	MC_CMD_OP(cmd, 0, 0,  32, int,	    container_id)
 
 /*                cmd, param, offset, width, type, arg_name */
+#define DPRC_CMD_CREATE_CONTAINER(cmd, cfg) \
+do { \
+	MC_CMD_OP(cmd, 0, 32, 16, uint16_t, cfg->icid); \
+	MC_CMD_OP(cmd, 0, 0,  32, uint32_t, cfg->options); \
+	MC_CMD_OP(cmd, 1, 32, 32, int,	    cfg->portal_id); \
+	MC_CMD_OP(cmd, 2, 0,  8,  char,	    cfg->label[0]);\
+	MC_CMD_OP(cmd, 2, 8,  8,  char,	    cfg->label[1]);\
+	MC_CMD_OP(cmd, 2, 16, 8,  char,	    cfg->label[2]);\
+	MC_CMD_OP(cmd, 2, 24, 8,  char,	    cfg->label[3]);\
+	MC_CMD_OP(cmd, 2, 32, 8,  char,	    cfg->label[4]);\
+	MC_CMD_OP(cmd, 2, 40, 8,  char,	    cfg->label[5]);\
+	MC_CMD_OP(cmd, 2, 48, 8,  char,	    cfg->label[6]);\
+	MC_CMD_OP(cmd, 2, 56, 8,  char,	    cfg->label[7]);\
+	MC_CMD_OP(cmd, 3, 0,  8,  char,	    cfg->label[8]);\
+	MC_CMD_OP(cmd, 3, 8,  8,  char,	    cfg->label[9]);\
+	MC_CMD_OP(cmd, 3, 16, 8,  char,	    cfg->label[10]);\
+	MC_CMD_OP(cmd, 3, 24, 8,  char,	    cfg->label[11]);\
+	MC_CMD_OP(cmd, 3, 32, 8,  char,	    cfg->label[12]);\
+	MC_CMD_OP(cmd, 3, 40, 8,  char,	    cfg->label[13]);\
+	MC_CMD_OP(cmd, 3, 48, 8,  char,	    cfg->label[14]);\
+	MC_CMD_OP(cmd, 3, 56, 8,  char,	    cfg->label[15]);\
+} while (0)
+
+/*                cmd, param, offset, width, type, arg_name */
+#define DPRC_RSP_CREATE_CONTAINER(cmd, child_container_id, child_portal_offset)\
+do { \
+	MC_RSP_OP(cmd, 1, 0,  32, int,	   child_container_id); \
+	MC_RSP_OP(cmd, 2, 0,  64, uint64_t, child_portal_offset);\
+} while (0)
+
+/*                cmd, param, offset, width, type, arg_name */
+#define DPRC_CMD_DESTROY_CONTAINER(cmd, child_container_id) \
+	MC_CMD_OP(cmd, 0, 0,  32, int,	    child_container_id)
+
+/*                cmd, param, offset, width, type, arg_name */
 #define DPRC_CMD_RESET_CONTAINER(cmd, child_container_id) \
 	MC_CMD_OP(cmd, 0, 0,  32, int,	    child_container_id)
 
@@ -467,6 +505,52 @@ struct dprc_cfg {
 };
 
 /**
+ * dprc_create_container() - Create child container
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPRC object
+ * @cfg:	Child container configuration
+ * @child_container_id:	Returned child container ID
+ * @child_portal_offset: Returned child portal offset from MC portal base
+ *
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dprc_create_container(struct fsl_mc_io	*mc_io,
+			  uint32_t		cmd_flags,
+			  uint16_t		token,
+			  struct dprc_cfg	*cfg,
+			  int			*child_container_id,
+			  uint64_t		*child_portal_offset);
+
+/**
+ * dprc_destroy_container() - Destroy child container.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPRC object
+ * @child_container_id:	ID of the container to destroy
+ *
+ * This function terminates the child container, so following this call the
+ * child container ID becomes invalid.
+ *
+ * Notes:
+ * - All resources and objects of the destroyed container are returned to the
+ * parent container or destroyed if were created be the destroyed container.
+ * - This function destroy all the child containers of the specified
+ *   container prior to destroying the container itself.
+ *
+ * warning: Only the parent container is allowed to destroy a child policy
+ *		Container 0 can't be destroyed
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ *
+ */
+int dprc_destroy_container(struct fsl_mc_io	*mc_io,
+			   uint32_t		cmd_flags,
+			   uint16_t		token,
+			   int			child_container_id);
+
+/**
  * dprc_reset_container - Reset child container.
  * @mc_io:	Pointer to MC portal's I/O object
  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 03/10][v4] driver: net: fsl-mc: Add APIs for DPMAC objects in FLIB
  2015-11-04  6:55 [U-Boot] [PATCH 00/10][v4] driver: net: ldpaa: Add support of new architeture Prabhakar Kushwaha
  2015-11-04  6:55 ` [U-Boot] [PATCH 01/10][v4] armv8: lsch3: Fix lane protocol parsing logic Prabhakar Kushwaha
  2015-11-04  6:55 ` [U-Boot] [PATCH 02/10][v4] driver: net: fsl-mc: Add create, destroy APIs in flibs Prabhakar Kushwaha
@ 2015-11-04  6:55 ` Prabhakar Kushwaha
  2015-11-30 17:02   ` York Sun
  2015-11-04  6:55 ` [U-Boot] [PATCH 04/10][v4] armv8: ls2085aqds: Print function name during SerDes error Prabhakar Kushwaha
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Prabhakar Kushwaha @ 2015-11-04  6:55 UTC (permalink / raw)
  To: u-boot

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 <prabhakar@freescale.com>
---
 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

diff --git a/drivers/net/fsl-mc/Makefile b/drivers/net/fsl-mc/Makefile
index 7563a5f..a492388 100644
--- a/drivers/net/fsl-mc/Makefile
+++ b/drivers/net/fsl-mc/Makefile
@@ -10,5 +10,6 @@ obj-y += mc.o \
 	dpmng.o	\
 	dprc.o	\
 	dpbp.o	\
-	dpni.o
+	dpni.o	\
+	dpmac.o
 obj-y += dpio/
diff --git a/drivers/net/fsl-mc/dpmac.c b/drivers/net/fsl-mc/dpmac.c
new file mode 100644
index 0000000..072a90d
--- /dev/null
+++ b/drivers/net/fsl-mc/dpmac.c
@@ -0,0 +1,222 @@
+/*
+ * Freescale Layerscape MC I/O wrapper
+ *
+ * Copyright (C) 2015 Freescale Semiconductor, Inc.
+ * Author: Prabhakar Kushwaha <prabhakar@freescale.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <fsl-mc/fsl_mc_sys.h>
+#include <fsl-mc/fsl_mc_cmd.h>
+#include <fsl-mc/fsl_dpmac.h>
+
+int dpmac_open(struct fsl_mc_io *mc_io,
+	       uint32_t cmd_flags,
+	       int dpmac_id,
+	       uint16_t *token)
+{
+	struct mc_command cmd = { 0 };
+	int err;
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPMAC_CMDID_OPEN,
+					  cmd_flags,
+					  0);
+	DPMAC_CMD_OPEN(cmd, dpmac_id);
+
+	/* 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 err;
+}
+
+int dpmac_close(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(DPMAC_CMDID_CLOSE, cmd_flags,
+					  token);
+
+	/* send command to mc*/
+	return mc_send_command(mc_io, &cmd);
+}
+
+int dpmac_create(struct fsl_mc_io *mc_io,
+		 uint32_t cmd_flags,
+		 const struct dpmac_cfg *cfg,
+		 uint16_t *token)
+{
+	struct mc_command cmd = { 0 };
+	int err;
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPMAC_CMDID_CREATE,
+					  cmd_flags,
+					  0);
+	DPMAC_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 dpmac_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(DPMAC_CMDID_DESTROY,
+					  cmd_flags,
+					  token);
+
+	/* send command to mc*/
+	return mc_send_command(mc_io, &cmd);
+}
+
+int dpmac_get_attributes(struct fsl_mc_io *mc_io,
+			 uint32_t cmd_flags,
+			 uint16_t token,
+			 struct dpmac_attr *attr)
+{
+	struct mc_command cmd = { 0 };
+	int err;
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPMAC_CMDID_GET_ATTR,
+					  cmd_flags,
+					  token);
+
+	/* send command to mc*/
+	err = mc_send_command(mc_io, &cmd);
+	if (err)
+		return err;
+
+	/* retrieve response parameters */
+	DPMAC_RSP_GET_ATTRIBUTES(cmd, attr);
+
+	return 0;
+}
+
+int dpmac_mdio_read(struct fsl_mc_io *mc_io,
+		    uint32_t cmd_flags,
+		    uint16_t token,
+		    struct dpmac_mdio_cfg *cfg)
+{
+	struct mc_command cmd = { 0 };
+	int err;
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPMAC_CMDID_MDIO_READ,
+					  cmd_flags,
+					  token);
+	DPMAC_CMD_MDIO_READ(cmd, cfg);
+
+	/* send command to mc*/
+	err = mc_send_command(mc_io, &cmd);
+	if (err)
+		return err;
+
+	/* retrieve response parameters */
+	DPMAC_RSP_MDIO_READ(cmd, cfg->data);
+
+	return 0;
+}
+
+int dpmac_mdio_write(struct fsl_mc_io *mc_io,
+		     uint32_t cmd_flags,
+		     uint16_t token,
+		     struct dpmac_mdio_cfg *cfg)
+{
+	struct mc_command cmd = { 0 };
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPMAC_CMDID_MDIO_WRITE,
+					  cmd_flags,
+					  token);
+	DPMAC_CMD_MDIO_WRITE(cmd, cfg);
+
+	/* send command to mc*/
+	return mc_send_command(mc_io, &cmd);
+}
+
+int dpmac_get_link_cfg(struct fsl_mc_io *mc_io,
+		       uint32_t cmd_flags,
+		       uint16_t token,
+		       struct dpmac_link_cfg *cfg)
+{
+	struct mc_command cmd = { 0 };
+	int err = 0;
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPMAC_CMDID_GET_LINK_CFG,
+					  cmd_flags,
+					  token);
+
+	/* send command to mc*/
+	err = mc_send_command(mc_io, &cmd);
+	if (err)
+		return err;
+
+	DPMAC_RSP_GET_LINK_CFG(cmd, cfg);
+
+	return 0;
+}
+
+int dpmac_set_link_state(struct fsl_mc_io *mc_io,
+			 uint32_t cmd_flags,
+			 uint16_t token,
+			 struct dpmac_link_state *link_state)
+{
+	struct mc_command cmd = { 0 };
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPMAC_CMDID_SET_LINK_STATE,
+					  cmd_flags,
+					  token);
+	DPMAC_CMD_SET_LINK_STATE(cmd, link_state);
+
+	/* send command to mc*/
+	return mc_send_command(mc_io, &cmd);
+}
+
+int dpmac_get_counter(struct fsl_mc_io *mc_io,
+		      uint32_t cmd_flags,
+		      uint16_t token,
+		      enum dpmac_counter type,
+		      uint64_t *counter)
+{
+	struct mc_command cmd = { 0 };
+	int err = 0;
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPMAC_CMDID_GET_COUNTER,
+					  cmd_flags,
+					  token);
+	DPMAC_CMD_GET_COUNTER(cmd, type);
+
+	/* send command to mc*/
+	err = mc_send_command(mc_io, &cmd);
+	if (err)
+		return err;
+
+	DPMAC_RSP_GET_COUNTER(cmd, *counter);
+
+	return 0;
+}
diff --git a/include/fsl-mc/fsl_dpmac.h b/include/fsl-mc/fsl_dpmac.h
new file mode 100644
index 0000000..24f0b48
--- /dev/null
+++ b/include/fsl-mc/fsl_dpmac.h
@@ -0,0 +1,468 @@
+/*
+ * Freescale Layerscape MC I/O wrapper
+ *
+ * Copyright (C) 2015 Freescale Semiconductor, Inc.
+ * Author: Prabhakar Kushwaha <prabhakar@freescale.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __FSL_DPMAC_H
+#define __FSL_DPMAC_H
+
+/* DPMAC Version */
+#define DPMAC_VER_MAJOR				3
+#define DPMAC_VER_MINOR				1
+
+/* Command IDs */
+#define DPMAC_CMDID_CLOSE			0x800
+#define DPMAC_CMDID_OPEN			0x80c
+#define DPMAC_CMDID_CREATE			0x90c
+#define DPMAC_CMDID_DESTROY			0x900
+
+#define DPMAC_CMDID_GET_ATTR			0x004
+#define DPMAC_CMDID_RESET			0x005
+
+#define DPMAC_CMDID_MDIO_READ			0x0c0
+#define DPMAC_CMDID_MDIO_WRITE			0x0c1
+#define DPMAC_CMDID_GET_LINK_CFG		0x0c2
+#define DPMAC_CMDID_SET_LINK_STATE		0x0c3
+#define DPMAC_CMDID_GET_COUNTER			0x0c4
+
+/*                cmd, param, offset, width, type, arg_name */
+#define DPMAC_CMD_CREATE(cmd, cfg) \
+	MC_CMD_OP(cmd, 0, 0,  32, int,      cfg->mac_id)
+
+/*                cmd, param, offset, width, type, arg_name */
+#define DPMAC_CMD_OPEN(cmd, dpmac_id) \
+	MC_CMD_OP(cmd, 0, 0,  32, int,	    dpmac_id)
+
+/*                cmd, param, offset, width, type,	arg_name */
+#define DPMAC_RSP_GET_ATTRIBUTES(cmd, attr) \
+do { \
+	MC_RSP_OP(cmd, 0, 0,  32, int,			attr->phy_id);\
+	MC_RSP_OP(cmd, 0, 32, 32, int,			attr->id);\
+	MC_RSP_OP(cmd, 1, 0,  16, uint16_t,		attr->version.major);\
+	MC_RSP_OP(cmd, 1, 16, 16, uint16_t,		attr->version.minor);\
+	MC_RSP_OP(cmd, 1, 32,  8, enum dpmac_link_type,	attr->link_type);\
+	MC_RSP_OP(cmd, 1, 40,  8, enum dpmac_eth_if,	attr->eth_if);\
+	MC_RSP_OP(cmd, 2, 0,  32, uint32_t,		attr->max_rate);\
+} while (0)
+
+/*                cmd, param, offset, width, type, arg_name */
+#define DPMAC_CMD_MDIO_READ(cmd, cfg) \
+do { \
+	MC_CMD_OP(cmd, 0, 0,  8,  uint8_t,  cfg->phy_addr); \
+	MC_CMD_OP(cmd, 0, 8,  8,  uint8_t,  cfg->reg); \
+} while (0)
+
+/*                cmd, param, offset, width, type, arg_name */
+#define DPMAC_RSP_MDIO_READ(cmd, data) \
+	MC_RSP_OP(cmd, 0, 16, 16, uint16_t, data)
+
+/*                cmd, param, offset, width, type, arg_name */
+#define DPMAC_CMD_MDIO_WRITE(cmd, cfg) \
+do { \
+	MC_CMD_OP(cmd, 0, 0,  8,  uint8_t,  cfg->phy_addr); \
+	MC_CMD_OP(cmd, 0, 8,  8,  uint8_t,  cfg->reg); \
+	MC_CMD_OP(cmd, 0, 16, 16, uint16_t, cfg->data); \
+} while (0)
+
+/*                cmd, param, offset, width, type, arg_name */
+#define DPMAC_RSP_GET_LINK_CFG(cmd, cfg) \
+do { \
+	MC_RSP_OP(cmd, 0, 0,  64, uint64_t, cfg->options); \
+	MC_RSP_OP(cmd, 1, 0,  32, uint32_t, cfg->rate); \
+} while (0)
+
+/*                cmd, param, offset, width, type, arg_name */
+#define DPMAC_CMD_SET_LINK_STATE(cmd, cfg) \
+do { \
+	MC_CMD_OP(cmd, 0, 0,  64, uint64_t, cfg->options); \
+	MC_CMD_OP(cmd, 1, 0,  32, uint32_t, cfg->rate); \
+	MC_CMD_OP(cmd, 2, 0,  1,  int,      cfg->up); \
+} while (0)
+
+/*                cmd, param, offset, width, type, arg_name */
+#define DPMAC_CMD_GET_COUNTER(cmd, type) \
+	MC_CMD_OP(cmd, 0, 0,  8, enum dpmac_counter, type)
+
+/*                cmd, param, offset, width, type, arg_name */
+#define DPMAC_RSP_GET_COUNTER(cmd, counter) \
+	MC_RSP_OP(cmd, 1, 0, 64, uint64_t, counter)
+
+/* Data Path MAC API
+ * Contains initialization APIs and runtime control APIs for DPMAC
+ */
+
+struct fsl_mc_io;
+
+/**
+ * dpmac_open() - Open a control session for the specified object.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @dpmac_id:	DPMAC unique ID
+ * @token:	Returned token; use in subsequent API calls
+ *
+ * This function can be used to open a control session for an
+ * already created object; an object may have been declared in
+ * the DPL or by calling the dpmac_create function.
+ * This function returns a unique authentication token,
+ * associated with the specific object ID and the specific MC
+ * portal; this token must be used in all subsequent commands for
+ * this specific object
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpmac_open(struct fsl_mc_io	*mc_io,
+	       uint32_t		cmd_flags,
+	       int			dpmac_id,
+	       uint16_t		*token);
+
+/**
+ * dpmac_close() - Close the control session of the object
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPMAC object
+ *
+ * After this function is called, no further operations are
+ * allowed on the object without opening a new control session.
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpmac_close(struct fsl_mc_io	*mc_io,
+		uint32_t		cmd_flags,
+		uint16_t		token);
+
+/**
+ * enum dpmac_link_type -  DPMAC link type
+ * @DPMAC_LINK_TYPE_NONE: No link
+ * @DPMAC_LINK_TYPE_FIXED: Link is fixed type
+ * @DPMAC_LINK_TYPE_PHY: Link by PHY ID
+ * @DPMAC_LINK_TYPE_BACKPLANE: Backplane link type
+ */
+enum dpmac_link_type {
+	DPMAC_LINK_TYPE_NONE,
+	DPMAC_LINK_TYPE_FIXED,
+	DPMAC_LINK_TYPE_PHY,
+	DPMAC_LINK_TYPE_BACKPLANE
+};
+
+/**
+ * enum dpmac_eth_if - DPMAC Ethrnet interface
+ * @DPMAC_ETH_IF_MII: MII interface
+ * @DPMAC_ETH_IF_RMII: RMII interface
+ * @DPMAC_ETH_IF_SMII: SMII interface
+ * @DPMAC_ETH_IF_GMII: GMII interface
+ * @DPMAC_ETH_IF_RGMII: RGMII interface
+ * @DPMAC_ETH_IF_SGMII: SGMII interface
+ * @DPMAC_ETH_IF_QSGMII: QSGMII interface
+ * @DPMAC_ETH_IF_XAUI: XAUI interface
+ * @DPMAC_ETH_IF_XFI: XFI interface
+ */
+enum dpmac_eth_if {
+	DPMAC_ETH_IF_MII,
+	DPMAC_ETH_IF_RMII,
+	DPMAC_ETH_IF_SMII,
+	DPMAC_ETH_IF_GMII,
+	DPMAC_ETH_IF_RGMII,
+	DPMAC_ETH_IF_SGMII,
+	DPMAC_ETH_IF_QSGMII,
+	DPMAC_ETH_IF_XAUI,
+	DPMAC_ETH_IF_XFI
+};
+
+/**
+ * struct dpmac_cfg - Structure representing DPMAC configuration
+ * @mac_id:	Represents the Hardware MAC ID; in case of multiple WRIOP,
+ *		the MAC IDs are continuous.
+ *		For example:  2 WRIOPs, 16 MACs in each:
+ *				MAC IDs for the 1st WRIOP: 1-16,
+ *				MAC IDs for the 2nd WRIOP: 17-32.
+ */
+struct dpmac_cfg {
+	int mac_id;
+};
+
+/**
+ * dpmac_create() - Create the DPMAC object.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @cfg:	Configuration structure
+ * @token:	Returned token; use in subsequent API calls
+ *
+ * Create the DPMAC object, allocate required resources and
+ * perform required initialization.
+ *
+ * The object can be created either by declaring it in the
+ * DPL file, or by calling this function.
+ * This function returns a unique authentication token,
+ * associated with the specific object ID and the specific MC
+ * portal; this token must be used in all subsequent calls to
+ * this specific object. For objects that are created using the
+ * DPL file, call dpmac_open function to get an authentication
+ * token first.
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpmac_create(struct fsl_mc_io	*mc_io,
+		 uint32_t		cmd_flags,
+		 const struct dpmac_cfg	*cfg,
+		 uint16_t		*token);
+
+/**
+ * dpmac_destroy() - Destroy the DPMAC object and release all its resources.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPMAC object
+ *
+ * Return:	'0' on Success; error code otherwise.
+ */
+int dpmac_destroy(struct fsl_mc_io	*mc_io,
+		  uint32_t		cmd_flags,
+		  uint16_t		token);
+
+/* DPMAC IRQ Index and Events */
+
+/* IRQ index */
+#define DPMAC_IRQ_INDEX						0
+/* IRQ event - indicates a change in link state */
+#define DPMAC_IRQ_EVENT_LINK_CFG_REQ		0x00000001
+/* irq event - Indicates that the link state changed */
+#define DPMAC_IRQ_EVENT_LINK_CHANGED		0x00000002
+
+/**
+ * struct dpmac_attr - Structure representing DPMAC attributes
+ * @id:		DPMAC object ID
+ * @phy_id:	PHY ID
+ * @link_type: link type
+ * @eth_if: Ethernet interface
+ * @max_rate: Maximum supported rate - in Mbps
+ * @version:	DPMAC version
+ */
+struct dpmac_attr {
+	int			id;
+	int			phy_id;
+	enum dpmac_link_type	link_type;
+	enum dpmac_eth_if	eth_if;
+	uint32_t		max_rate;
+	/**
+	 * struct version - Structure representing DPMAC version
+	 * @major:	DPMAC major version
+	 * @minor:	DPMAC minor version
+	 */
+	struct {
+		uint16_t major;
+		uint16_t minor;
+	} version;
+};
+
+/**
+ * dpmac_get_attributes - Retrieve DPMAC attributes.
+ *
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPMAC object
+ * @attr:	Returned object's attributes
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpmac_get_attributes(struct fsl_mc_io	*mc_io,
+			 uint32_t		cmd_flags,
+			 uint16_t		token,
+			 struct dpmac_attr	*attr);
+
+/**
+ * struct dpmac_mdio_cfg - DPMAC MDIO read/write parameters
+ * @phy_addr: MDIO device address
+ * @reg: Address of the register within the Clause 45 PHY device from which data
+ *	is to be read
+ * @data: Data read/write from/to MDIO
+ */
+struct dpmac_mdio_cfg {
+	uint8_t		phy_addr;
+	uint8_t		reg;
+	uint16_t	data;
+};
+
+/**
+ * dpmac_mdio_read() - Perform MDIO read transaction
+ * @mc_io:	Pointer to opaque I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPMAC object
+ * @cfg:	Structure with MDIO transaction parameters
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpmac_mdio_read(struct fsl_mc_io		*mc_io,
+		    uint32_t			cmd_flags,
+		    uint16_t			token,
+		    struct dpmac_mdio_cfg	*cfg);
+
+/**
+ * dpmac_mdio_write() - Perform MDIO write transaction
+ * @mc_io:	Pointer to opaque I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPMAC object
+ * @cfg:	Structure with MDIO transaction parameters
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpmac_mdio_write(struct fsl_mc_io		*mc_io,
+		     uint32_t			cmd_flags,
+		     uint16_t			token,
+		     struct dpmac_mdio_cfg	*cfg);
+
+/* DPMAC link configuration/state options */
+
+/* Enable auto-negotiation */
+#define DPMAC_LINK_OPT_AUTONEG		0x0000000000000001ULL
+/* Enable half-duplex mode */
+#define DPMAC_LINK_OPT_HALF_DUPLEX	0x0000000000000002ULL
+/* Enable pause frames */
+#define DPMAC_LINK_OPT_PAUSE		0x0000000000000004ULL
+/* Enable a-symmetric pause frames */
+#define DPMAC_LINK_OPT_ASYM_PAUSE	0x0000000000000008ULL
+
+/**
+ * struct dpmac_link_cfg - Structure representing DPMAC link configuration
+ * @rate: Link's rate - in Mbps
+ * @options: Enable/Disable DPMAC link cfg features (bitmap)
+ */
+struct dpmac_link_cfg {
+	uint32_t rate;
+	uint64_t options;
+};
+
+/**
+ * dpmac_get_link_cfg() - Get Ethernet link configuration
+ * @mc_io:	Pointer to opaque I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPMAC object
+ * @cfg:	Returned structure with the link configuration
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpmac_get_link_cfg(struct fsl_mc_io	*mc_io,
+		       uint32_t		cmd_flags,
+		       uint16_t		token,
+		       struct dpmac_link_cfg	*cfg);
+
+/**
+ * struct dpmac_link_state - DPMAC link configuration request
+ * @rate: Rate in Mbps
+ * @options: Enable/Disable DPMAC link cfg features (bitmap)
+ * @up: Link state
+ */
+struct dpmac_link_state {
+	uint32_t	rate;
+	uint64_t	options;
+	int		up;
+};
+
+/**
+ * dpmac_set_link_state() - Set the Ethernet link status
+ * @mc_io:	Pointer to opaque I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPMAC object
+ * @link_state:	Link state configuration
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpmac_set_link_state(struct fsl_mc_io		*mc_io,
+			 uint32_t			cmd_flags,
+			 uint16_t			token,
+			 struct dpmac_link_state	*link_state);
+
+/**
+ * enum dpni_counter - DPNI counter types
+ * @DPMAC_CNT_ING_FRAME_64: counts 64-octet frame, good or bad.
+ * @DPMAC_CNT_ING_FRAME_127: counts 65- to 127-octet frame, good or bad.
+ * @DPMAC_CNT_ING_FRAME_255: counts 128- to 255-octet frame, good or bad.
+ * @DPMAC_CNT_ING_FRAME_511: counts 256- to 511-octet frame, good or bad.
+ * @DPMAC_CNT_ING_FRAME_1023: counts 512- to 1023-octet frame, good or bad.
+ * @DPMAC_CNT_ING_FRAME_1518: counts 1024- to 1518-octet frame, good or bad.
+ * @DPMAC_CNT_ING_FRAME_1519_MAX: counts 1519-octet frame and larger
+ *				  (up to max frame length specified),
+ *				  good or bad.
+ * @DPMAC_CNT_ING_FRAG: counts packet which is shorter than 64 octets received
+ *			with a wrong CRC
+ * @DPMAC_CNT_ING_JABBER: counts packet longer than the maximum frame length
+ *			  specified, with a bad frame check sequence.
+ * @DPMAC_CNT_ING_FRAME_DISCARD: counts dropped packet due to internal errors.
+ *				 Occurs when a receive FIFO overflows.
+ *				 Includes also packets truncated as a result of
+ *				 the receive FIFO overflow.
+ * @DPMAC_CNT_ING_ALIGN_ERR: counts frame with an alignment error
+ *			     (optional used for wrong SFD)
+ * @DPMAC_CNT_EGR_UNDERSIZED: counts packet transmitted that was less than 64
+ *			      octets long with a good CRC.
+ * @DPMAC_CNT_ING_OVERSIZED: counts packet longer than the maximum frame length
+ *			     specified, with a good frame check sequence.
+ * @DPMAC_CNT_ING_VALID_PAUSE_FRAME: counts valid pause frame (regular and PFC).
+ * @DPMAC_CNT_EGR_VALID_PAUSE_FRAME: counts valid pause frame transmitted
+ *				     (regular and PFC).
+ * @DPMAC_CNT_ING_BYTE: counts octet received except preamble for all valid
+ *				frames and valid pause frames.
+ * @DPMAC_CNT_ING_MCAST_FRAME: counts received multicast frame
+ * @DPMAC_CNT_ING_BCAST_FRAME: counts received broadcast frame
+ * @DPMAC_CNT_ING_ALL_FRAME: counts each good or bad packet received.
+ * @DPMAC_CNT_ING_UCAST_FRAME: counts received unicast frame
+ * @DPMAC_CNT_ING_ERR_FRAME: counts frame received with an error
+ *			     (except for undersized/fragment frame)
+ * @DPMAC_CNT_EGR_BYTE: counts octet transmitted except preamble for all valid
+ *			frames and valid pause frames transmitted.
+ * @DPMAC_CNT_EGR_MCAST_FRAME: counts transmitted multicast frame
+ * @DPMAC_CNT_EGR_BCAST_FRAME: counts transmitted broadcast frame
+ * @DPMAC_CNT_EGR_UCAST_FRAME: counts transmitted unicast frame
+ * @DPMAC_CNT_EGR_ERR_FRAME: counts frame transmitted with an error
+ * @DPMAC_CNT_ING_GOOD_FRAME: counts frame received without error, including
+ *			      pause frames.
+ */
+enum dpmac_counter {
+	DPMAC_CNT_ING_FRAME_64,
+	DPMAC_CNT_ING_FRAME_127,
+	DPMAC_CNT_ING_FRAME_255,
+	DPMAC_CNT_ING_FRAME_511,
+	DPMAC_CNT_ING_FRAME_1023,
+	DPMAC_CNT_ING_FRAME_1518,
+	DPMAC_CNT_ING_FRAME_1519_MAX,
+	DPMAC_CNT_ING_FRAG,
+	DPMAC_CNT_ING_JABBER,
+	DPMAC_CNT_ING_FRAME_DISCARD,
+	DPMAC_CNT_ING_ALIGN_ERR,
+	DPMAC_CNT_EGR_UNDERSIZED,
+	DPMAC_CNT_ING_OVERSIZED,
+	DPMAC_CNT_ING_VALID_PAUSE_FRAME,
+	DPMAC_CNT_EGR_VALID_PAUSE_FRAME,
+	DPMAC_CNT_ING_BYTE,
+	DPMAC_CNT_ING_MCAST_FRAME,
+	DPMAC_CNT_ING_BCAST_FRAME,
+	DPMAC_CNT_ING_ALL_FRAME,
+	DPMAC_CNT_ING_UCAST_FRAME,
+	DPMAC_CNT_ING_ERR_FRAME,
+	DPMAC_CNT_EGR_BYTE,
+	DPMAC_CNT_EGR_MCAST_FRAME,
+	DPMAC_CNT_EGR_BCAST_FRAME,
+	DPMAC_CNT_EGR_UCAST_FRAME,
+	DPMAC_CNT_EGR_ERR_FRAME,
+	DPMAC_CNT_ING_GOOD_FRAME
+};
+
+/**
+ * dpmac_get_counter() - Read a specific DPMAC counter
+ * @mc_io:	Pointer to opaque I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPMAC object
+ * @type:	The requested counter
+ * @counter:	Returned counter value
+ *
+ * Return:	The requested counter; '0' otherwise.
+ */
+int dpmac_get_counter(struct fsl_mc_io		*mc_io,
+		      uint32_t			cmd_flags,
+		      uint16_t			token,
+		      enum dpmac_counter	 type,
+		      uint64_t			*counter);
+
+#endif /* __FSL_DPMAC_H */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 04/10][v4] armv8: ls2085aqds: Print function name during SerDes error
  2015-11-04  6:55 [U-Boot] [PATCH 00/10][v4] driver: net: ldpaa: Add support of new architeture Prabhakar Kushwaha
                   ` (2 preceding siblings ...)
  2015-11-04  6:55 ` [U-Boot] [PATCH 03/10][v4] driver: net: fsl-mc: Add APIs for DPMAC objects in FLIB Prabhakar Kushwaha
@ 2015-11-04  6:55 ` Prabhakar Kushwaha
  2015-11-30 17:02   ` York Sun
  2015-11-04  6:55 ` [U-Boot] [PATCH 05/10][v4] driver: ldpaa: Add api to return linked PHY ID of DPMAC Prabhakar Kushwaha
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Prabhakar Kushwaha @ 2015-11-04  6:55 UTC (permalink / raw)
  To: u-boot

Print function name along with SerDes Protocol during SerDes Protocol
not supported error.

Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
---
 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(-)

diff --git a/board/freescale/ls2085aqds/eth.c b/board/freescale/ls2085aqds/eth.c
index b8a2bf4..d116cd5 100644
--- a/board/freescale/ls2085aqds/eth.c
+++ b/board/freescale/ls2085aqds/eth.c
@@ -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;
 	}
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 05/10][v4] driver: ldpaa: Add api to return linked PHY ID of DPMAC
  2015-11-04  6:55 [U-Boot] [PATCH 00/10][v4] driver: net: ldpaa: Add support of new architeture Prabhakar Kushwaha
                   ` (3 preceding siblings ...)
  2015-11-04  6:55 ` [U-Boot] [PATCH 04/10][v4] armv8: ls2085aqds: Print function name during SerDes error Prabhakar Kushwaha
@ 2015-11-04  6:55 ` Prabhakar Kushwaha
  2015-11-30 17:03   ` York Sun
  2015-11-04  6:55 ` [U-Boot] [PATCH 06/10][v4] driver: net: fsl-mc: Increase MC command timeout Prabhakar Kushwaha
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Prabhakar Kushwaha @ 2015-11-04  6:55 UTC (permalink / raw)
  To: u-boot

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 <prabhakar@freescale.com>
---
 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(-)

diff --git a/drivers/net/ldpaa_eth/ldpaa_wriop.c b/drivers/net/ldpaa_eth/ldpaa_wriop.c
index 926057a..357b35a 100644
--- a/drivers/net/ldpaa_eth/ldpaa_wriop.c
+++ b/drivers/net/ldpaa_eth/ldpaa_wriop.c
@@ -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);
diff --git a/include/fsl-mc/ldpaa_wriop.h b/include/fsl-mc/ldpaa_wriop.h
index ca8e440..6dc159d 100644
--- a/include/fsl-mc/ldpaa_wriop.h
+++ b/include/fsl-mc/ldpaa_wriop.h
@@ -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);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 06/10][v4] driver: net: fsl-mc: Increase MC command timeout
  2015-11-04  6:55 [U-Boot] [PATCH 00/10][v4] driver: net: ldpaa: Add support of new architeture Prabhakar Kushwaha
                   ` (4 preceding siblings ...)
  2015-11-04  6:55 ` [U-Boot] [PATCH 05/10][v4] driver: ldpaa: Add api to return linked PHY ID of DPMAC Prabhakar Kushwaha
@ 2015-11-04  6:55 ` Prabhakar Kushwaha
  2015-11-30 17:06   ` York Sun
  2015-11-04  6:55 ` [U-Boot] [PATCH 07/10][v4] driver: net: fsl-mc: Add DPAA2 commands to manage MC Prabhakar Kushwaha
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Prabhakar Kushwaha @ 2015-11-04  6:55 UTC (permalink / raw)
  To: u-boot

dpni_create API take takes more time as comapred to existing supported
APIs of MC Flib.
So increase MC command timeout.

Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
---
 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(-)

diff --git a/drivers/net/fsl-mc/mc_sys.c b/drivers/net/fsl-mc/mc_sys.c
index 2136670..71e1456 100644
--- a/drivers/net/fsl-mc/mc_sys.c
+++ b/drivers/net/fsl-mc/mc_sys.c
@@ -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);
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 07/10][v4] driver: net: fsl-mc: Add DPAA2 commands to manage MC
  2015-11-04  6:55 [U-Boot] [PATCH 00/10][v4] driver: net: ldpaa: Add support of new architeture Prabhakar Kushwaha
                   ` (5 preceding siblings ...)
  2015-11-04  6:55 ` [U-Boot] [PATCH 06/10][v4] driver: net: fsl-mc: Increase MC command timeout Prabhakar Kushwaha
@ 2015-11-04  6:55 ` Prabhakar Kushwaha
  2015-11-26  4:50   ` York Sun
  2015-11-30 17:07   ` York Sun
  2015-11-04  6:55 ` [U-Boot] [PATCH 08/10][v4] driver: net: fsl-mc: Create DPAA2 object at run-time Prabhakar Kushwaha
                   ` (3 subsequent siblings)
  10 siblings, 2 replies; 24+ messages in thread
From: Prabhakar Kushwaha @ 2015-11-04  6:55 UTC (permalink / raw)
  To: u-boot

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 <prabhakar@freescale.com>
---
 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(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/README.lsch3 b/arch/arm/cpu/armv8/fsl-layerscape/README.lsch3
index 03e18f6..d1f92c4 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/README.lsch3
+++ b/arch/arm/cpu/armv8/fsl-layerscape/README.lsch3
@@ -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
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index ea987d7..d2ca5c6 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -14,7 +14,9 @@
 #include <fsl-mc/fsl_dpmng.h>
 #include <fsl-mc/fsl_dprc.h>
 #include <fsl-mc/fsl_dpio.h>
+#include <fsl-mc/fsl_dpni.h>
 #include <fsl-mc/fsl_qbman_portal.h>
+#include <fsl-mc/ldpaa_wriop.h>
 
 #define MC_RAM_BASE_ADDR_ALIGNMENT  (512UL * 1024 * 1024)
 #define MC_RAM_BASE_ADDR_ALIGNMENT_MASK	(~(MC_RAM_BASE_ADDR_ALIGNMENT - 1))
@@ -24,7 +26,11 @@
 #define MC_BOOT_TIMEOUT_ENV_VAR	"mcboottimeout"
 
 DECLARE_GLOBAL_DATA_PTR;
-static int mc_boot_status;
+static int mc_boot_status = -1;
+static int mc_dpl_applied = -1;
+#ifdef CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET
+static int mc_aiop_applied = -1;
+#endif
 struct fsl_mc_io *dflt_mc_io = NULL;
 uint16_t dflt_dprc_handle = 0;
 struct fsl_dpbp_obj *dflt_dpbp = NULL;
@@ -93,7 +99,8 @@ static int mc_copy_image(const char *title,
  * Returns 0 on success and a negative errno on error.
  * task fail.
  **/
-int parse_mc_firmware_fit_image(const void **raw_image_addr,
+int parse_mc_firmware_fit_image(u64 mc_fw_addr,
+				const void **raw_image_addr,
 				size_t *raw_image_size)
 {
 	int format;
@@ -103,36 +110,31 @@ int parse_mc_firmware_fit_image(const void **raw_image_addr,
 	size_t size;
 	const char *uname = "firmware";
 
-	/* Check if the image is in NOR flash */
-#ifdef CONFIG_SYS_LS_MC_FW_IN_NOR
-	fit_hdr = (void *)CONFIG_SYS_LS_MC_FW_ADDR;
-#else
-#error "No CONFIG_SYS_LS_MC_FW_IN_xxx defined"
-#endif
+	fit_hdr = (void *)mc_fw_addr;
 
 	/* Check if Image is in FIT format */
 	format = genimg_get_format(fit_hdr);
 
 	if (format != IMAGE_FORMAT_FIT) {
-		printf("fsl-mc: ERROR: Bad firmware image (not a FIT image)\n");
+		printf("fsl-mc: ERR: Bad firmware image (not a FIT image)\n");
 		return -EINVAL;
 	}
 
 	if (!fit_check_format(fit_hdr)) {
-		printf("fsl-mc: ERROR: Bad firmware image (bad FIT header)\n");
+		printf("fsl-mc: ERR: Bad firmware image (bad FIT header)\n");
 		return -EINVAL;
 	}
 
 	node_offset = fit_image_get_node(fit_hdr, uname);
 
 	if (node_offset < 0) {
-		printf("fsl-mc: ERROR: Bad firmware image (missing subimage)\n");
+		printf("fsl-mc: ERR: Bad firmware image (missing subimage)\n");
 		return -ENOENT;
 	}
 
 	/* Verify MC firmware image */
 	if (!(fit_image_verify(fit_hdr, node_offset))) {
-		printf("fsl-mc: ERROR: Bad firmware image (bad CRC)\n");
+		printf("fsl-mc: ERR: Bad firmware image (bad CRC)\n");
 		return -EINVAL;
 	}
 
@@ -218,7 +220,7 @@ static int mc_fixup_dpc(u64 dpc_addr)
 	return 0;
 }
 
-static int load_mc_dpc(u64 mc_ram_addr, size_t mc_ram_size)
+static int load_mc_dpc(u64 mc_ram_addr, size_t mc_ram_size, u64 mc_dpc_addr)
 {
 	u64 mc_dpc_offset;
 #ifndef CONFIG_SYS_LS_MC_DPC_IN_DDR
@@ -245,11 +247,7 @@ static int load_mc_dpc(u64 mc_ram_addr, size_t mc_ram_size)
 	/*
 	 * Get address and size of the DPC blob stored in flash:
 	 */
-#ifdef CONFIG_SYS_LS_MC_DPC_IN_NOR
-	dpc_fdt_hdr = (void *)CONFIG_SYS_LS_MC_DPC_ADDR;
-#else
-#error "No CONFIG_SYS_LS_MC_DPC_IN_xxx defined"
-#endif
+	dpc_fdt_hdr = (void *)mc_dpc_addr;
 
 	error = fdt_check_header(dpc_fdt_hdr);
 	if (error != 0) {
@@ -279,7 +277,7 @@ static int load_mc_dpc(u64 mc_ram_addr, size_t mc_ram_size)
 	return 0;
 }
 
-static int load_mc_dpl(u64 mc_ram_addr, size_t mc_ram_size)
+static int load_mc_dpl(u64 mc_ram_addr, size_t mc_ram_size, u64 mc_dpl_addr)
 {
 	u64 mc_dpl_offset;
 #ifndef CONFIG_SYS_LS_MC_DPL_IN_DDR
@@ -306,11 +304,7 @@ static int load_mc_dpl(u64 mc_ram_addr, size_t mc_ram_size)
 	/*
 	 * Get address and size of the DPL blob stored in flash:
 	 */
-#ifdef CONFIG_SYS_LS_MC_DPL_IN_NOR
-	dpl_fdt_hdr = (void *)CONFIG_SYS_LS_MC_DPL_ADDR;
-#else
-#error "No CONFIG_SYS_LS_MC_DPL_IN_xxx defined"
-#endif
+	dpl_fdt_hdr = (void *)mc_dpl_addr;
 
 	error = fdt_check_header(dpl_fdt_hdr);
 	if (error != 0) {
@@ -357,23 +351,33 @@ static unsigned long get_mc_boot_timeout_ms(void)
 	return timeout_ms;
 }
 
-#ifdef CONFIG_SYS_LS_MC_AIOP_IMG_IN_NOR
-static int load_mc_aiop_img(u64 mc_ram_addr, size_t mc_ram_size)
+#ifdef CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET
+static int load_mc_aiop_img(u64 aiop_fw_addr)
 {
+	u64 mc_ram_addr = mc_get_dram_addr();
+#ifndef CONFIG_SYS_LS_MC_DPC_IN_DDR
 	void *aiop_img;
+#endif
 
 	/*
 	 * Load the MC AIOP image in the MC private DRAM block:
 	 */
 
-	aiop_img = (void *)CONFIG_SYS_LS_MC_AIOP_IMG_ADDR;
+#ifdef CONFIG_SYS_LS_MC_DPC_IN_DDR
+	printf("MC AIOP is preloaded to %#llx\n", mc_ram_addr +
+	       CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET);
+#else
+	aiop_img = (void *)aiop_fw_addr;
 	mc_copy_image("MC AIOP image",
 		      (u64)aiop_img, CONFIG_SYS_LS_MC_AIOP_IMG_MAX_LENGTH,
 		      mc_ram_addr + CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET);
+#endif
+	mc_aiop_applied = 0;
 
 	return 0;
 }
 #endif
+
 static int wait_for_mc(bool booting_mc, u32 *final_reg_gsr)
 {
 	u32 reg_gsr;
@@ -420,12 +424,12 @@ static int wait_for_mc(bool booting_mc, u32 *final_reg_gsr)
 	return 0;
 }
 
-int mc_init(void)
+int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr)
 {
 	int error = 0;
 	int portal_id = 0;
 	struct mc_ccsr_registers __iomem *mc_ccsr_regs = MC_CCSR_BASE_ADDR;
-	u64 mc_ram_addr;
+	u64 mc_ram_addr = mc_get_dram_addr();
 	u32 reg_gsr;
 	u32 reg_mcfbalr;
 #ifndef CONFIG_SYS_LS_MC_FW_IN_DDR
@@ -437,17 +441,6 @@ int mc_init(void)
 	u8 mc_ram_num_256mb_blocks;
 	size_t mc_ram_size = mc_get_dram_block_size();
 
-	/*
-	 * The MC private DRAM block was already carved@the end of DRAM
-	 * by board_init_f() using CONFIG_SYS_MEM_TOP_HIDE:
-	 */
-	if (gd->bd->bi_dram[1].start) {
-		mc_ram_addr =
-			gd->bd->bi_dram[1].start + gd->bd->bi_dram[1].size;
-	} else {
-		mc_ram_addr =
-			gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size;
-	}
 
 	error = calculate_mc_private_ram_params(mc_ram_addr,
 						mc_ram_size,
@@ -474,7 +467,8 @@ int mc_init(void)
 #ifdef CONFIG_SYS_LS_MC_FW_IN_DDR
 	printf("MC firmware is preloaded to %#llx\n", mc_ram_addr);
 #else
-	error = parse_mc_firmware_fit_image(&raw_image_addr, &raw_image_size);
+	error = parse_mc_firmware_fit_image(mc_fw_addr, &raw_image_addr,
+					    &raw_image_size);
 	if (error != 0)
 		goto out;
 	/*
@@ -485,20 +479,10 @@ int mc_init(void)
 #endif
 	dump_ram_words("firmware", (void *)mc_ram_addr);
 
-	error = load_mc_dpc(mc_ram_addr, mc_ram_size);
-	if (error != 0)
-		goto out;
-
-	error = load_mc_dpl(mc_ram_addr, mc_ram_size);
+	error = load_mc_dpc(mc_ram_addr, mc_ram_size, mc_dpc_addr);
 	if (error != 0)
 		goto out;
 
-#ifdef CONFIG_SYS_LS_MC_AIOP_IMG_IN_NOR
-	error = load_mc_aiop_img(mc_ram_addr, mc_ram_size);
-	if (error != 0)
-		goto out;
-#endif
-
 	debug("mc_ccsr_regs %p\n", mc_ccsr_regs);
 	dump_mc_ccsr_regs(mc_ccsr_regs);
 
@@ -571,20 +555,36 @@ int mc_init(void)
 	       mc_ver_info.major, mc_ver_info.minor, mc_ver_info.revision,
 	       reg_gsr & GSR_FS_MASK);
 
+out:
+	if (error != 0)
+		mc_boot_status = error;
+	else
+		mc_boot_status = 0;
+
+	return error;
+}
+
+int mc_apply_dpl(u64 mc_dpl_addr)
+{
+	struct mc_ccsr_registers __iomem *mc_ccsr_regs = MC_CCSR_BASE_ADDR;
+	int error = 0;
+	u32 reg_gsr;
+	u64 mc_ram_addr = mc_get_dram_addr();
+	size_t mc_ram_size = mc_get_dram_block_size();
+
+	error = load_mc_dpl(mc_ram_addr, mc_ram_size, mc_dpl_addr);
+	if (error != 0)
+		return error;
+
 	/*
 	 * Tell the MC to deploy the DPL:
 	 */
 	out_le32(&mc_ccsr_regs->reg_gsr, 0x0);
 	printf("fsl-mc: Deploying data path layout ... ");
 	error = wait_for_mc(false, &reg_gsr);
-	if (error != 0)
-		goto out;
 
-out:
-	if (error != 0)
-		mc_boot_status = error;
-	else
-		mc_boot_status = 0;
+	if (!error)
+		mc_dpl_applied = 0;
 
 	return error;
 }
@@ -594,6 +594,40 @@ int get_mc_boot_status(void)
 	return mc_boot_status;
 }
 
+#ifdef CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET
+int get_aiop_apply_status(void)
+{
+	return mc_aiop_applied;
+}
+#endif
+
+int get_dpl_apply_status(void)
+{
+	return mc_dpl_applied;
+}
+
+/**
+ * Return the MC address of private DRAM block.
+ */
+u64 mc_get_dram_addr(void)
+{
+	u64 mc_ram_addr;
+
+	/*
+	 * The MC private DRAM block was already carved at the end of DRAM
+	 * by board_init_f() using CONFIG_SYS_MEM_TOP_HIDE:
+	 */
+	if (gd->bd->bi_dram[1].start) {
+		mc_ram_addr =
+			gd->bd->bi_dram[1].start + gd->bd->bi_dram[1].size;
+	} else {
+		mc_ram_addr =
+			gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size;
+	}
+
+	return mc_ram_addr;
+}
+
 /**
  * Return the actual size of the MC private DRAM block.
  */
@@ -693,155 +727,107 @@ int dpbp_init(struct dprc_obj_desc obj_desc)
 	return 0;
 }
 
-int dprc_init_container_obj(struct dprc_obj_desc obj_desc, uint16_t dprc_handle)
+int fsl_mc_ldpaa_init(bd_t *bis)
 {
-	int error = 0, state = 0;
-	struct dprc_endpoint dpni_endpoint, dpmac_endpoint;
-	if (!strcmp(obj_desc.type, "dpbp")) {
-		if (!dflt_dpbp) {
-			error = dpbp_init(obj_desc);
-			if (error < 0)
-				printf("dpbp_init failed\n");
-		}
-	} else if (!strcmp(obj_desc.type, "dpio")) {
-		if (!dflt_dpio) {
-			error = dpio_init(obj_desc);
-			if (error < 0)
-				printf("dpio_init failed\n");
-		}
-	} else if (!strcmp(obj_desc.type, "dpni")) {
-		strcpy(dpni_endpoint.type, obj_desc.type);
-		dpni_endpoint.id = obj_desc.id;
-		error = dprc_get_connection(dflt_mc_io, MC_CMD_NO_FLAGS,
-					    dprc_handle, &dpni_endpoint,
-					    &dpmac_endpoint, &state);
-		if (!strcmp(dpmac_endpoint.type, "dpmac"))
-			error = ldpaa_eth_init(obj_desc);
-		if (error < 0)
-			printf("ldpaa_eth_init failed\n");
-	}
 
-	return error;
+	return 0;
 }
 
-int dprc_scan_container_obj(uint16_t dprc_handle, char *obj_type, int i)
+void fsl_mc_ldpaa_exit(bd_t *bis)
 {
-	int error = 0;
-	struct dprc_obj_desc obj_desc;
-
-	memset((void *)&obj_desc, 0x00, sizeof(struct dprc_obj_desc));
-
-	error = dprc_get_obj(dflt_mc_io, MC_CMD_NO_FLAGS, dprc_handle,
-			     i, &obj_desc);
-	if (error < 0) {
-		printf("dprc_get_obj(i=%d) failed: %d\n",
-		       i, error);
-		return error;
-	}
-
-	if (!strcmp(obj_desc.type, obj_type)) {
-		debug("Discovered object: type %s, id %d, req %s\n",
-		      obj_desc.type, obj_desc.id, obj_type);
-
-		error = dprc_init_container_obj(obj_desc, dprc_handle);
-		if (error < 0) {
-			printf("dprc_init_container_obj(i=%d) failed: %d\n",
-			       i, error);
-			return error;
-		}
-	}
-
-	return error;
+	return;
 }
 
-int fsl_mc_ldpaa_init(bd_t *bis)
+static int do_fsl_mc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-	int i, error = 0;
-	int dprc_opened = 0, container_id;
-	int num_child_objects = 0;
-
-	error = mc_init();
-	if (error < 0)
-		goto error;
-
-	error = dprc_get_container_id(dflt_mc_io, MC_CMD_NO_FLAGS,
-				      &container_id);
-	if (error < 0) {
-		printf("dprc_get_container_id() failed: %d\n", error);
-		goto error;
-	}
-
-	debug("fsl-mc: Container id=0x%x\n", container_id);
-
-	error = dprc_open(dflt_mc_io, MC_CMD_NO_FLAGS, container_id,
-			  &dflt_dprc_handle);
-	if (error < 0) {
-		printf("dprc_open() failed: %d\n", error);
-		goto error;
-	}
-	dprc_opened = true;
-
-	error = dprc_get_obj_count(dflt_mc_io,
-				   MC_CMD_NO_FLAGS, dflt_dprc_handle,
-				   &num_child_objects);
-	if (error < 0) {
-		printf("dprc_get_obj_count() failed: %d\n", error);
-		goto error;
-	}
-	debug("Total child in container %d = %d\n", container_id,
-	      num_child_objects);
-
-	if (num_child_objects != 0) {
-		/*
-		 * Discover objects currently in the DPRC container in the MC:
-		 */
-		for (i = 0; i < num_child_objects; i++)
-			error = dprc_scan_container_obj(dflt_dprc_handle,
-							"dpbp", i);
-
-		for (i = 0; i < num_child_objects; i++)
-			error = dprc_scan_container_obj(dflt_dprc_handle,
-							"dpio", i);
-
-		for (i = 0; i < num_child_objects; i++)
-			error = dprc_scan_container_obj(dflt_dprc_handle,
-							"dpni", i);
-	}
-error:
-	if (dprc_opened)
-		dprc_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dprc_handle);
-
-	return error;
-}
+	int err = 0;
+	if (argc < 3)
+		goto usage;
+
+	switch (argv[1][0]) {
+	case 's': {
+			char sub_cmd;
+			u64 mc_fw_addr, mc_dpc_addr, aiop_fw_addr;
+
+			sub_cmd = argv[2][0];
+			switch (sub_cmd) {
+			case 'm':
+				if (argc < 5)
+					goto usage;
+
+				if (get_mc_boot_status() == 0) {
+					printf("fsl-mc: MC is already booted");
+					printf("\n");
+					return err;
+				}
+				mc_fw_addr = simple_strtoull(argv[3], NULL, 16);
+				mc_dpc_addr = simple_strtoull(argv[4], NULL,
+							      16);
+				err = mc_init(mc_fw_addr, mc_dpc_addr);
+				break;
+
+#ifdef CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET
+			case 'a':
+				if (argc < 4)
+					goto usage;
+				if (get_aiop_apply_status() == 0) {
+					printf("fsl-mc: AIOP FW is already");
+					printf(" applied\n");
+					return err;
+				}
+
+				aiop_fw_addr = simple_strtoull(argv[3], NULL,
+							       16);
+
+				err = load_mc_aiop_img(aiop_fw_addr);
+				if (!err)
+					printf("fsl-mc: AIOP FW applied\n");
+				break;
+#endif
+			default:
+				printf("Invalid option: %s\n", argv[2]);
+				goto usage;
 
-void fsl_mc_ldpaa_exit(bd_t *bis)
-{
-	int err;
-
-	if (get_mc_boot_status() == 0) {
-		err = dpio_disable(dflt_mc_io, MC_CMD_NO_FLAGS,
-				   dflt_dpio_handle);
-		if (err < 0) {
-			printf("dpio_disable() failed: %d\n", err);
-			return;
-		}
-		err = dpio_reset(dflt_mc_io, MC_CMD_NO_FLAGS,
-				 dflt_dpio_handle);
-		if (err < 0) {
-			printf("dpio_reset() failed: %d\n", err);
-			return;
+				break;
+			}
 		}
-		err = dpio_close(dflt_mc_io, MC_CMD_NO_FLAGS,
-				 dflt_dpio_handle);
-		if (err < 0) {
-			printf("dpio_close() failed: %d\n", err);
-			return;
+		break;
+
+	case 'a': {
+			u64 mc_dpl_addr;
+
+			if (argc < 4)
+				goto usage;
+
+			if (get_dpl_apply_status() == 0) {
+				printf("fsl-mc: DPL already applied\n");
+				return err;
+			}
+
+			mc_dpl_addr = simple_strtoull(argv[3], NULL,
+							      16);
+			if (get_mc_boot_status() != 0) {
+				printf("fsl-mc: Deploying data path layout ..");
+				printf("ERROR (MC is not booted)\n");
+				return -ENODEV;
+			}
+			err = mc_apply_dpl(mc_dpl_addr);
+			break;
 		}
-
-		free(dflt_dpio);
-		free(dflt_dpbp);
+	default:
+		printf("Invalid option: %s\n", argv[1]);
+		goto usage;
+		break;
 	}
-
-	if (dflt_mc_io)
-		free(dflt_mc_io);
+	return err;
+ usage:
+	return CMD_RET_USAGE;
 }
+
+U_BOOT_CMD(
+	fsl_mc,  CONFIG_SYS_MAXARGS,  1,   do_fsl_mc,
+	"DPAA2 command to manage Management Complex (MC)",
+	"start mc [FW_addr] [DPC_addr] - Start Management Complex\n"
+	"fsl_mc apply DPL [DPL_addr] - Apply DPL file\n"
+	"fsl_mc start aiop [FW_addr] - Start AIOP\n"
+);
diff --git a/include/configs/ls2085aqds.h b/include/configs/ls2085aqds.h
index 406d0e6..99690ef 100644
--- a/include/configs/ls2085aqds.h
+++ b/include/configs/ls2085aqds.h
@@ -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
diff --git a/include/configs/ls2085ardb.h b/include/configs/ls2085ardb.h
index f95d7b2..f36253d 100644
--- a/include/configs/ls2085ardb.h
+++ b/include/configs/ls2085ardb.h
@@ -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
diff --git a/include/fsl-mc/fsl_mc.h b/include/fsl-mc/fsl_mc.h
index 9517a4a..c8f168a 100644
--- a/include/fsl-mc/fsl_mc.h
+++ b/include/fsl-mc/fsl_mc.h
@@ -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);
diff --git a/include/fsl-mc/fsl_mc_private.h b/include/fsl-mc/fsl_mc_private.h
index 9f06978..9421362 100644
--- a/include/fsl-mc/fsl_mc_private.h
+++ b/include/fsl-mc/fsl_mc_private.h
@@ -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_ */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 08/10][v4] driver: net: fsl-mc: Create DPAA2 object at run-time
  2015-11-04  6:55 [U-Boot] [PATCH 00/10][v4] driver: net: ldpaa: Add support of new architeture Prabhakar Kushwaha
                   ` (6 preceding siblings ...)
  2015-11-04  6:55 ` [U-Boot] [PATCH 07/10][v4] driver: net: fsl-mc: Add DPAA2 commands to manage MC Prabhakar Kushwaha
@ 2015-11-04  6:55 ` Prabhakar Kushwaha
  2015-11-30 17:07   ` York Sun
  2015-11-04  6:56 ` [U-Boot] [PATCH 09/10][v4] driver: net: ldpaa: Use DPMAC as net device Prabhakar Kushwaha
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: Prabhakar Kushwaha @ 2015-11-04  6:55 UTC (permalink / raw)
  To: u-boot

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 <prabhakar@freescale.com>
---
 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(-)

diff --git a/board/freescale/ls2085aqds/ls2085aqds.c b/board/freescale/ls2085aqds/ls2085aqds.c
index b02d6e8..36b059f 100644
--- a/board/freescale/ls2085aqds/ls2085aqds.c
+++ b/board/freescale/ls2085aqds/ls2085aqds.c
@@ -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;
diff --git a/board/freescale/ls2085ardb/ls2085ardb.c b/board/freescale/ls2085ardb/ls2085ardb.c
index 18953b8..761d7c8 100644
--- a/board/freescale/ls2085ardb/ls2085ardb.c
+++ b/board/freescale/ls2085ardb/ls2085ardb.c
@@ -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;
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index d2ca5c6..d80be1c 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -31,11 +31,14 @@ static int mc_dpl_applied = -1;
 #ifdef CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET
 static int mc_aiop_applied = -1;
 #endif
-struct fsl_mc_io *dflt_mc_io = NULL;
+struct fsl_mc_io *root_mc_io = NULL;
+struct fsl_mc_io *dflt_mc_io = NULL; /* child container */
+uint16_t root_dprc_handle = 0;
 uint16_t dflt_dprc_handle = 0;
+int child_dprc_id;
 struct fsl_dpbp_obj *dflt_dpbp = NULL;
 struct fsl_dpio_obj *dflt_dpio = NULL;
-uint16_t dflt_dpio_handle = 0;
+struct fsl_dpni_obj *dflt_dpni = NULL;
 
 #ifdef DEBUG
 void dump_ram_words(const char *title, void *addr)
@@ -521,17 +524,17 @@ int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr)
 	 * Initialize the global default MC portal
 	 * And check that the MC firmware is responding portal commands:
 	 */
-	dflt_mc_io = (struct fsl_mc_io *)malloc(sizeof(struct fsl_mc_io));
-	if (!dflt_mc_io) {
+	root_mc_io = (struct fsl_mc_io *)malloc(sizeof(struct fsl_mc_io));
+	if (!root_mc_io) {
 		printf(" No memory: malloc() failed\n");
 		return -ENOMEM;
 	}
 
-	dflt_mc_io->mmio_regs = SOC_MC_PORTAL_ADDR(portal_id);
+	root_mc_io->mmio_regs = SOC_MC_PORTAL_ADDR(portal_id);
 	debug("Checking access to MC portal of root DPRC container (portal_id %d, portal physical addr %p)\n",
-	      portal_id, dflt_mc_io->mmio_regs);
+	      portal_id, root_mc_io->mmio_regs);
 
-	error = mc_get_version(dflt_mc_io, MC_CMD_NO_FLAGS, &mc_ver_info);
+	error = mc_get_version(root_mc_io, MC_CMD_NO_FLAGS, &mc_ver_info);
 	if (error != 0) {
 		printf("fsl-mc: ERROR: Firmware version check failed (error: %d)\n",
 		       error);
@@ -654,36 +657,51 @@ unsigned long mc_get_dram_block_size(void)
 	return dram_block_size;
 }
 
-int dpio_init(struct dprc_obj_desc obj_desc)
+int fsl_mc_ldpaa_init(bd_t *bis)
+{
+	return 0;
+}
+
+static int dpio_init(void)
 {
 	struct qbman_swp_desc p_des;
 	struct dpio_attr attr;
+	struct dpio_cfg dpio_cfg;
 	int err = 0;
 
 	dflt_dpio = (struct fsl_dpio_obj *)malloc(sizeof(struct fsl_dpio_obj));
 	if (!dflt_dpio) {
-		printf(" No memory: malloc() failed\n");
-		return -ENOMEM;
+		printf("No memory: malloc() failed\n");
+		err = -ENOMEM;
+		goto err_malloc;
 	}
 
-	dflt_dpio->dpio_id = obj_desc.id;
+	dpio_cfg.channel_mode = DPIO_LOCAL_CHANNEL;
+	dpio_cfg.num_priorities = 8;
 
-	err = dpio_open(dflt_mc_io, MC_CMD_NO_FLAGS, obj_desc.id,
-			&dflt_dpio_handle);
-	if (err) {
-		printf("dpio_open() failed\n");
-		goto err_open;
+	err = dpio_create(dflt_mc_io, MC_CMD_NO_FLAGS, &dpio_cfg,
+			  &dflt_dpio->dpio_handle);
+	if (err < 0) {
+		printf("dpio_create() failed: %d\n", err);
+		err = -ENODEV;
+		goto err_create;
 	}
 
+	memset(&attr, 0, sizeof(struct dpio_attr));
 	err = dpio_get_attributes(dflt_mc_io, MC_CMD_NO_FLAGS,
-				  dflt_dpio_handle, &attr);
-	if (err) {
-		printf("dpio_get_attributes() failed %d\n", err);
+				  dflt_dpio->dpio_handle, &attr);
+	if (err < 0) {
+		printf("dpio_get_attributes() failed: %d\n", err);
 		goto err_get_attr;
 	}
 
-	err = dpio_enable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio_handle);
-	if (err) {
+	dflt_dpio->dpio_id = attr.id;
+#ifdef DEBUG
+	printf("Init: DPIO id=0x%d\n", dflt_dpio->dpio_id);
+#endif
+
+	err = dpio_enable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio->dpio_handle);
+	if (err < 0) {
 		printf("dpio_enable() failed %d\n", err);
 		goto err_get_enable;
 	}
@@ -706,36 +724,412 @@ int dpio_init(struct dprc_obj_desc obj_desc)
 	return 0;
 
 err_get_swp_init:
+	dpio_disable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio->dpio_handle);
 err_get_enable:
-	dpio_disable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio_handle);
-err_get_attr:
-	dpio_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio_handle);
-err_open:
 	free(dflt_dpio);
+err_get_attr:
+	dpio_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio->dpio_handle);
+	dpio_destroy(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio->dpio_handle);
+err_create:
+err_malloc:
+	return err;
+}
+
+static int dpio_exit(void)
+{
+	int err;
+
+	err = dpio_disable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio->dpio_handle);
+	if (err < 0) {
+		printf("dpio_disable() failed: %d\n", err);
+		goto err;
+	}
+
+	err = dpio_destroy(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio->dpio_handle);
+	if (err < 0) {
+		printf("dpio_destroy() failed: %d\n", err);
+		goto err;
+	}
+
+#ifdef DEBUG
+	printf("Exit: DPIO id=0x%d\n", dflt_dpio->dpio_id);
+#endif
+
+	if (dflt_dpio)
+		free(dflt_dpio);
+
+	return 0;
+err:
+	return err;
+}
+
+static int dprc_init(void)
+{
+	int err, child_portal_id, container_id;
+	struct dprc_cfg cfg;
+	uint64_t mc_portal_offset;
+
+	/* Open root container */
+	err = dprc_get_container_id(root_mc_io, MC_CMD_NO_FLAGS, &container_id);
+	if (err < 0) {
+		printf("dprc_get_container_id(): Root failed: %d\n", err);
+		goto err_root_container_id;
+	}
+
+#ifdef DEBUG
+	printf("Root container id = %d\n", container_id);
+#endif
+	err = dprc_open(root_mc_io, MC_CMD_NO_FLAGS, container_id,
+			&root_dprc_handle);
+	if (err < 0) {
+		printf("dprc_open(): Root Container failed: %d\n", err);
+		goto err_root_open;
+	}
+
+	if (!root_dprc_handle) {
+		printf("dprc_open(): Root Container Handle is not valid\n");
+		goto err_root_open;
+	}
+
+	cfg.options = DPRC_CFG_OPT_TOPOLOGY_CHANGES_ALLOWED |
+		      DPRC_CFG_OPT_OBJ_CREATE_ALLOWED |
+		      DPRC_CFG_OPT_ALLOC_ALLOWED;
+	cfg.icid = DPRC_GET_ICID_FROM_POOL;
+	cfg.portal_id = 250;
+	err = dprc_create_container(root_mc_io, MC_CMD_NO_FLAGS,
+			root_dprc_handle,
+			&cfg,
+			&child_dprc_id,
+			&mc_portal_offset);
+	if (err < 0) {
+		printf("dprc_create_container() failed: %d\n", err);
+		goto err_create;
+	}
+
+	dflt_mc_io = (struct fsl_mc_io *)malloc(sizeof(struct fsl_mc_io));
+	if (!dflt_mc_io) {
+		err  = -ENOMEM;
+		printf(" No memory: malloc() failed\n");
+		goto err_malloc;
+	}
+
+	child_portal_id = MC_PORTAL_OFFSET_TO_PORTAL_ID(mc_portal_offset);
+	dflt_mc_io->mmio_regs = SOC_MC_PORTAL_ADDR(child_portal_id);
+#ifdef DEBUG
+	printf("MC portal of child DPRC container: %d, physical addr %p)\n",
+	       child_dprc_id, dflt_mc_io->mmio_regs);
+#endif
+
+	err = dprc_open(dflt_mc_io, MC_CMD_NO_FLAGS, child_dprc_id,
+			&dflt_dprc_handle);
+	if (err < 0) {
+		printf("dprc_open(): Child container failed: %d\n", err);
+		goto err_child_open;
+	}
+
+	if (!dflt_dprc_handle) {
+		printf("dprc_open(): Child container Handle is not valid\n");
+		goto err_child_open;
+	}
+
+	return 0;
+err_child_open:
+	free(dflt_mc_io);
+err_malloc:
+	dprc_destroy_container(root_mc_io, MC_CMD_NO_FLAGS,
+			       root_dprc_handle, child_dprc_id);
+err_create:
+	dprc_close(root_mc_io, MC_CMD_NO_FLAGS, root_dprc_handle);
+err_root_open:
+err_root_container_id:
+	return err;
+}
+
+static int dprc_exit(void)
+{
+	int err;
+
+	err = dprc_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dprc_handle);
+	if (err < 0) {
+		printf("dprc_close(): Child failed: %d\n", err);
+		goto err;
+	}
+
+	err = dprc_destroy_container(root_mc_io, MC_CMD_NO_FLAGS,
+				     root_dprc_handle, child_dprc_id);
+	if (err < 0) {
+		printf("dprc_destroy_container() failed: %d\n", err);
+		goto err;
+	}
+
+	err = dprc_close(root_mc_io, MC_CMD_NO_FLAGS, root_dprc_handle);
+	if (err < 0) {
+		printf("dprc_close(): Root failed: %d\n", err);
+		goto err;
+	}
+
+	if (dflt_mc_io)
+		free(dflt_mc_io);
+
+	if (root_mc_io)
+		free(root_mc_io);
+
+	return 0;
+
+err:
 	return err;
 }
 
-int dpbp_init(struct dprc_obj_desc obj_desc)
+static int dpbp_init(void)
 {
+	int err;
+	struct dpbp_attr dpbp_attr;
+	struct dpbp_cfg dpbp_cfg;
+
 	dflt_dpbp = (struct fsl_dpbp_obj *)malloc(sizeof(struct fsl_dpbp_obj));
 	if (!dflt_dpbp) {
-		printf(" No memory: malloc() failed\n");
-		return -ENOMEM;
+		printf("No memory: malloc() failed\n");
+		err = -ENOMEM;
+		goto err_malloc;
+	}
+
+	dpbp_cfg.options = 512;
+
+	err = dpbp_create(dflt_mc_io, MC_CMD_NO_FLAGS, &dpbp_cfg,
+			  &dflt_dpbp->dpbp_handle);
+
+	if (err < 0) {
+		err = -ENODEV;
+		printf("dpbp_create() failed: %d\n", err);
+		goto err_create;
+	}
+
+	memset(&dpbp_attr, 0, sizeof(struct dpbp_attr));
+	err = dpbp_get_attributes(dflt_mc_io, MC_CMD_NO_FLAGS,
+				  dflt_dpbp->dpbp_handle,
+				  &dpbp_attr);
+	if (err < 0) {
+		printf("dpbp_get_attributes() failed: %d\n", err);
+		goto err_get_attr;
+	}
+
+	dflt_dpbp->dpbp_attr.id = dpbp_attr.id;
+#ifdef DEBUG
+	printf("Init: DPBP id=0x%d\n", dflt_dpbp->dpbp_attr.id);
+#endif
+
+	err = dpbp_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpbp->dpbp_handle);
+	if (err < 0) {
+		printf("dpbp_close() failed: %d\n", err);
+		goto err_close;
 	}
-	dflt_dpbp->dpbp_attr.id = obj_desc.id;
 
 	return 0;
+
+err_close:
+	free(dflt_dpbp);
+err_get_attr:
+	dpbp_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpbp->dpbp_handle);
+	dpbp_destroy(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpbp->dpbp_handle);
+err_create:
+err_malloc:
+	return err;
 }
 
-int fsl_mc_ldpaa_init(bd_t *bis)
+static int dpbp_exit(void)
+{
+	int err;
+
+	err = dpbp_open(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpbp->dpbp_attr.id,
+			&dflt_dpbp->dpbp_handle);
+	if (err < 0) {
+		printf("dpbp_open() failed: %d\n", err);
+		goto err;
+	}
+
+	err = dpbp_destroy(dflt_mc_io, MC_CMD_NO_FLAGS,
+			   dflt_dpbp->dpbp_handle);
+	if (err < 0) {
+		printf("dpbp_destroy() failed: %d\n", err);
+		goto err;
+	}
+
+#ifdef DEBUG
+	printf("Exit: DPBP id=0x%d\n", dflt_dpbp->dpbp_attr.id);
+#endif
+
+	if (dflt_dpbp)
+		free(dflt_dpbp);
+	return 0;
+
+err:
+	return err;
+}
+
+static int dpni_init(void)
+{
+	int err;
+	struct dpni_attr dpni_attr;
+	struct dpni_cfg dpni_cfg;
+
+	dflt_dpni = (struct fsl_dpni_obj *)malloc(sizeof(struct fsl_dpni_obj));
+	if (!dflt_dpni) {
+		printf("No memory: malloc() failed\n");
+		err = -ENOMEM;
+		goto err_malloc;
+	}
+
+	memset(&dpni_cfg, 0, sizeof(dpni_cfg));
+	dpni_cfg.adv.options = DPNI_OPT_UNICAST_FILTER |
+			       DPNI_OPT_MULTICAST_FILTER;
+
+	err = dpni_create(dflt_mc_io, MC_CMD_NO_FLAGS, &dpni_cfg,
+			  &dflt_dpni->dpni_handle);
+
+	if (err < 0) {
+		err = -ENODEV;
+		printf("dpni_create() failed: %d\n", err);
+		goto err_create;
+	}
+
+	memset(&dpni_attr, 0, sizeof(struct dpni_attr));
+	err = dpni_get_attributes(dflt_mc_io, MC_CMD_NO_FLAGS,
+				  dflt_dpni->dpni_handle,
+				  &dpni_attr);
+	if (err < 0) {
+		printf("dpni_get_attributes() failed: %d\n", err);
+		goto err_get_attr;
+	}
+
+	dflt_dpni->dpni_id = dpni_attr.id;
+#ifdef DEBUG
+	printf("Init: DPNI id=0x%d\n", dflt_dpni->dpni_id);
+#endif
+
+	err = dpni_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle);
+	if (err < 0) {
+		printf("dpni_close() failed: %d\n", err);
+		goto err_close;
+	}
+
+	return 0;
+
+err_close:
+	free(dflt_dpni);
+err_get_attr:
+	dpni_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle);
+	dpni_destroy(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle);
+err_create:
+err_malloc:
+	return err;
+}
+
+static int dpni_exit(void)
+{
+	int err;
+
+	err = dpni_open(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_id,
+			&dflt_dpni->dpni_handle);
+	if (err < 0) {
+		printf("dpni_open() failed: %d\n", err);
+		goto err;
+	}
+
+	err = dpni_destroy(dflt_mc_io, MC_CMD_NO_FLAGS,
+			   dflt_dpni->dpni_handle);
+	if (err < 0) {
+		printf("dpni_destroy() failed: %d\n", err);
+		goto err;
+	}
+
+#ifdef DEBUG
+	printf("Exit: DPNI id=0x%d\n", dflt_dpni->dpni_id);
+#endif
+
+	if (dflt_dpni)
+		free(dflt_dpni);
+	return 0;
+
+err:
+	return err;
+}
+
+static int mc_init_object(void)
 {
+	int err = 0;
+
+	err = dprc_init();
+	if (err < 0) {
+		printf("dprc_init() failed: %d\n", err);
+		goto err;
+	}
+
+	err = dpbp_init();
+	if (err < 0) {
+		printf("dpbp_init() failed: %d\n", err);
+		goto err;
+	}
+
+	err = dpio_init();
+	if (err < 0) {
+		printf("dpio_init() failed: %d\n", err);
+		goto err;
+	}
+
+	err = dpni_init();
+	if (err < 0) {
+		printf("dpni_init() failed: %d\n", err);
+		goto err;
+	}
 
 	return 0;
+err:
+	return err;
 }
 
-void fsl_mc_ldpaa_exit(bd_t *bis)
+int fsl_mc_ldpaa_exit(bd_t *bd)
 {
-	return;
+	int err = 0;
+
+	if (bd && get_mc_boot_status() == -1)
+		return 0;
+
+	if (bd && !get_mc_boot_status() && get_dpl_apply_status() == -1) {
+		printf("ERROR: fsl-mc: DPL is not applied\n");
+		err = -ENODEV;
+		return err;
+	}
+
+	if (bd && !get_mc_boot_status() && !get_dpl_apply_status())
+		return err;
+
+	err = dpbp_exit();
+	if (err < 0) {
+		printf("dpni_exit() failed: %d\n", err);
+		goto err;
+	}
+
+	err = dpio_exit();
+	if (err < 0) {
+		printf("dpio_exit() failed: %d\n", err);
+		goto err;
+	}
+
+	err = dpni_exit();
+	if (err < 0) {
+		printf("dpni_exit() failed: %d\n", err);
+		goto err;
+	}
+
+	err = dprc_exit();
+	if (err < 0) {
+		printf("dprc_exit() failed: %d\n", err);
+		goto err;
+	}
+
+	return 0;
+err:
+	return err;
 }
 
 static int do_fsl_mc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
@@ -763,7 +1157,9 @@ static int do_fsl_mc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 				mc_fw_addr = simple_strtoull(argv[3], NULL, 16);
 				mc_dpc_addr = simple_strtoull(argv[4], NULL,
 							      16);
-				err = mc_init(mc_fw_addr, mc_dpc_addr);
+
+				if (!mc_init(mc_fw_addr, mc_dpc_addr))
+					err = mc_init_object();
 				break;
 
 #ifdef CONFIG_SYS_LS_MC_DRAM_AIOP_IMG_OFFSET
@@ -806,12 +1202,15 @@ static int do_fsl_mc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 			mc_dpl_addr = simple_strtoull(argv[3], NULL,
 							      16);
+
 			if (get_mc_boot_status() != 0) {
 				printf("fsl-mc: Deploying data path layout ..");
 				printf("ERROR (MC is not booted)\n");
 				return -ENODEV;
 			}
-			err = mc_apply_dpl(mc_dpl_addr);
+
+			if (!fsl_mc_ldpaa_exit(NULL))
+				err = mc_apply_dpl(mc_dpl_addr);
 			break;
 		}
 	default:
diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c
index 99acb7a..cfeb45f 100644
--- a/drivers/net/ldpaa_eth/ldpaa_eth.c
+++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
@@ -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)
diff --git a/include/fsl-mc/fsl_mc.h b/include/fsl-mc/fsl_mc.h
index c8f168a..ffe6da5 100644
--- a/include/fsl-mc/fsl_mc.h
+++ b/include/fsl-mc/fsl_mc.h
@@ -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
diff --git a/include/fsl-mc/fsl_mc_private.h b/include/fsl-mc/fsl_mc_private.h
index 9421362..191783a 100644
--- a/include/fsl-mc/fsl_mc_private.h
+++ b/include/fsl-mc/fsl_mc_private.h
@@ -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_ */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 09/10][v4] driver: net: ldpaa: Use DPMAC as net device
  2015-11-04  6:55 [U-Boot] [PATCH 00/10][v4] driver: net: ldpaa: Add support of new architeture Prabhakar Kushwaha
                   ` (7 preceding siblings ...)
  2015-11-04  6:55 ` [U-Boot] [PATCH 08/10][v4] driver: net: fsl-mc: Create DPAA2 object at run-time Prabhakar Kushwaha
@ 2015-11-04  6:56 ` Prabhakar Kushwaha
  2015-11-30 17:08   ` York Sun
  2015-11-04  6:56 ` [U-Boot] [PATCH 10/10][v4] driver: net: ldpaa: Add debug information Prabhakar Kushwaha
  2015-11-04  6:56 ` [U-Boot] [PATCH][v2] driver: net: ldpaa: Fix Rx buffer alignment Prabhakar Kushwaha
  10 siblings, 1 reply; 24+ messages in thread
From: Prabhakar Kushwaha @ 2015-11-04  6:56 UTC (permalink / raw)
  To: u-boot

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 DPMAC

Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
---
 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(-)

diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index d80be1c..5168b99 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -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;
 }
 
diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c
index cfeb45f..3d4c0f5 100644
--- a/drivers/net/ldpaa_eth/ldpaa_eth.c
+++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
@@ -12,6 +12,7 @@
 #include <hwconfig.h>
 #include <phy.h>
 #include <linux/compat.h>
+#include <fsl-mc/fsl_dpmac.h>
 
 #include "ldpaa_eth.h"
 
@@ -46,7 +47,7 @@ static void ldpaa_eth_rx(struct ldpaa_eth_priv *priv,
 		/* Read the frame annotation status word and check for errors */
 		fas = (struct ldpaa_fas *)
 				((uint8_t *)(fd_addr) +
-				priv->buf_layout.private_data_size);
+				dflt_dpni->buf_layout.private_data_size);
 		status = le32_to_cpu(fas->status);
 		if (status & LDPAA_ETH_RX_ERR_MASK) {
 			printf("Rx frame error(s): 0x%08x\n",
@@ -220,11 +221,31 @@ 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 };
 	int err;
 
 	if (net_dev->state == ETH_STATE_ACTIVE)
 		return 0;
 
+	if (get_mc_boot_status() != 0) {
+		printf("ERROR (MC is not booted)\n");
+		return -ENODEV;
+	}
+
+	if (get_dpl_apply_status() == 0) {
+		printf("ERROR (DPL is deployed. No device available)\n");
+		return -ENODEV;
+	}
+	/* DPMAC initialization */
+	err = ldpaa_dpmac_setup(priv);
+	if (err < 0)
+		goto err_dpmac_setup;
+
+	/* DPMAC binding DPNI */
+	err = ldpaa_dpmac_bind(priv);
+	if (err)
+		goto err_dpamc_bind;
+
 	/* DPNI initialization */
 	err = ldpaa_dpni_setup(priv);
 	if (err < 0)
@@ -237,10 +258,10 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)
 	/* DPNI binding DPBP */
 	err = ldpaa_dpni_bind(priv);
 	if (err)
-		goto err_bind;
+		goto err_dpni_bind;
 
 	err = dpni_add_mac_addr(dflt_mc_io, MC_CMD_NO_FLAGS,
-				priv->dpni_handle, net_dev->enetaddr);
+				dflt_dpni->dpni_handle, net_dev->enetaddr);
 	if (err) {
 		printf("dpni_add_mac_addr() failed\n");
 		return err;
@@ -259,15 +280,24 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)
 	priv->phydev->duplex = DUPLEX_FULL;
 #endif
 
-	err = dpni_enable(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle);
+	err = dpni_enable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle);
 	if (err < 0) {
 		printf("dpni_enable() failed\n");
 		return err;
 	}
 
+	dpmac_link_state.rate = SPEED_1000;
+	dpmac_link_state.options = DPMAC_LINK_OPT_AUTONEG;
+	dpmac_link_state.up = 1;
+	err = dpmac_set_link_state(dflt_mc_io, MC_CMD_NO_FLAGS,
+				  priv->dpmac_handle, &dpmac_link_state);
+	if (err < 0) {
+		printf("dpmac_set_link_state() failed\n");
+		return err;
+	}
 	/* TODO: support multiple Rx flows */
-	err = dpni_get_rx_flow(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle,
-			       0, 0, &rx_queue_attr);
+	err = dpni_get_rx_flow(dflt_mc_io, MC_CMD_NO_FLAGS,
+			       dflt_dpni->dpni_handle, 0, 0, &rx_queue_attr);
 	if (err) {
 		printf("dpni_get_rx_flow() failed\n");
 		goto err_rx_flow;
@@ -275,7 +305,7 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)
 
 	priv->rx_dflt_fqid = rx_queue_attr.fqid;
 
-	err = dpni_get_qdid(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle,
+	err = dpni_get_qdid(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle,
 			    &priv->tx_qdid);
 	if (err) {
 		printf("dpni_get_qdid() failed\n");
@@ -289,12 +319,14 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)
 
 err_qdid:
 err_rx_flow:
-	dpni_disable(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle);
-err_bind:
+	dpni_disable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle);
+err_dpni_bind:
 	ldpaa_dpbp_free();
 err_dpbp_setup:
-	dpni_close(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle);
+err_dpamc_bind:
+	dpni_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle);
 err_dpni_setup:
+err_dpmac_setup:
 	return err;
 }
 
@@ -306,8 +338,18 @@ static void ldpaa_eth_stop(struct eth_device *net_dev)
 	if ((net_dev->state == ETH_STATE_PASSIVE) ||
 	    (net_dev->state == ETH_STATE_INIT))
 		return;
+
+	err = dprc_disconnect(dflt_mc_io, MC_CMD_NO_FLAGS,
+			      dflt_dprc_handle, &dpmac_endpoint);
+	if (err < 0)
+		printf("dprc_disconnect() failed dpmac_endpoint\n");
+
+	err = dpmac_destroy(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpmac_handle);
+	if (err < 0)
+		printf("dpmac_destroy() failed\n");
+
 	/* Stop Tx and Rx traffic */
-	err = dpni_disable(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle);
+	err = dpni_disable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle);
 	if (err < 0)
 		printf("dpni_disable() failed\n");
 
@@ -316,8 +358,8 @@ static void ldpaa_eth_stop(struct eth_device *net_dev)
 #endif
 
 	ldpaa_dpbp_free();
-	dpni_reset(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle);
-	dpni_close(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle);
+	dpni_reset(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle);
+	dpni_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle);
 }
 
 static void ldpaa_dpbp_drain_cnt(int count)
@@ -458,54 +500,96 @@ static void ldpaa_dpbp_free(void)
 	dpbp_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpbp->dpbp_handle);
 }
 
+static int ldpaa_dpmac_setup(struct ldpaa_eth_priv *priv)
+{
+	int err = 0;
+	struct dpmac_cfg dpmac_cfg;
+
+	dpmac_cfg.mac_id = priv->dpmac_id;
+	err = dpmac_create(dflt_mc_io, MC_CMD_NO_FLAGS, &dpmac_cfg,
+			  &priv->dpmac_handle);
+	if (err)
+		printf("dpmac_create() failed\n");
+	return err;
+}
+
+static int ldpaa_dpmac_bind(struct ldpaa_eth_priv *priv)
+{
+	int err = 0;
+	struct dprc_connection_cfg dprc_connection_cfg = {
+		/* If both rates are zero the connection */
+		/* will be configured in "best effort" mode. */
+		.committed_rate = 0,
+		.max_rate = 0
+	};
+
+	memset(&dpmac_endpoint, 0, sizeof(struct dprc_endpoint));
+	sprintf(dpmac_endpoint.type, "dpmac");
+	dpmac_endpoint.id = priv->dpmac_id;
+
+	memset(&dpni_endpoint, 0, sizeof(struct dprc_endpoint));
+	sprintf(dpni_endpoint.type, "dpni");
+	dpni_endpoint.id = dflt_dpni->dpni_id;
+
+	err = dprc_connect(dflt_mc_io, MC_CMD_NO_FLAGS,
+			     dflt_dprc_handle,
+			     &dpmac_endpoint,
+			     &dpni_endpoint,
+			     &dprc_connection_cfg);
+	return err;
+}
+
 static int ldpaa_dpni_setup(struct ldpaa_eth_priv *priv)
 {
 	int err;
 
 	/* and get a handle for the DPNI this interface is associate with */
-	err = dpni_open(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_id,
-			&priv->dpni_handle);
+	err = dpni_open(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_id,
+			&dflt_dpni->dpni_handle);
 	if (err) {
 		printf("dpni_open() failed\n");
 		goto err_open;
 	}
 
 	err = dpni_get_attributes(dflt_mc_io, MC_CMD_NO_FLAGS,
-				  priv->dpni_handle, &priv->dpni_attrs);
+				  dflt_dpni->dpni_handle,
+				  &dflt_dpni->dpni_attrs);
 	if (err) {
 		printf("dpni_get_attributes() failed (err=%d)\n", err);
 		goto err_get_attr;
 	}
 
 	/* Configure our buffers' layout */
-	priv->buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
+	dflt_dpni->buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
 				   DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
 				   DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE;
-	priv->buf_layout.pass_parser_result = true;
-	priv->buf_layout.pass_frame_status = true;
-	priv->buf_layout.private_data_size = LDPAA_ETH_SWA_SIZE;
+	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;
 	/* ...rx, ... */
 	err = dpni_set_rx_buffer_layout(dflt_mc_io, MC_CMD_NO_FLAGS,
-					priv->dpni_handle, &priv->buf_layout);
+					dflt_dpni->dpni_handle,
+					&dflt_dpni->buf_layout);
 	if (err) {
 		printf("dpni_set_rx_buffer_layout() failed");
 		goto err_buf_layout;
 	}
 
 	/* ... tx, ... */
-	priv->buf_layout.options &= ~DPNI_BUF_LAYOUT_OPT_PARSER_RESULT;
+	dflt_dpni->buf_layout.options &= ~DPNI_BUF_LAYOUT_OPT_PARSER_RESULT;
 	err = dpni_set_tx_buffer_layout(dflt_mc_io, MC_CMD_NO_FLAGS,
-					priv->dpni_handle, &priv->buf_layout);
+					dflt_dpni->dpni_handle,
+					&dflt_dpni->buf_layout);
 	if (err) {
 		printf("dpni_set_tx_buffer_layout() failed");
 		goto err_buf_layout;
 	}
 
 	/* ... tx-confirm. */
-	priv->buf_layout.options &= ~DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE;
+	dflt_dpni->buf_layout.options &= ~DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE;
 	err = dpni_set_tx_conf_buffer_layout(dflt_mc_io, MC_CMD_NO_FLAGS,
-					     priv->dpni_handle,
-					     &priv->buf_layout);
+					     dflt_dpni->dpni_handle,
+					     &dflt_dpni->buf_layout);
 	if (err) {
 		printf("dpni_set_tx_conf_buffer_layout() failed");
 		goto err_buf_layout;
@@ -515,7 +599,8 @@ static int ldpaa_dpni_setup(struct ldpaa_eth_priv *priv)
 	 * required tx data offset.
 	 */
 	err = dpni_get_tx_data_offset(dflt_mc_io, MC_CMD_NO_FLAGS,
-				      priv->dpni_handle, &priv->tx_data_offset);
+				      dflt_dpni->dpni_handle,
+				      &priv->tx_data_offset);
 	if (err) {
 		printf("dpni_get_tx_data_offset() failed\n");
 		goto err_data_offset;
@@ -533,7 +618,7 @@ static int ldpaa_dpni_setup(struct ldpaa_eth_priv *priv)
 err_data_offset:
 err_buf_layout:
 err_get_attr:
-	dpni_close(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle);
+	dpni_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle);
 err_open:
 	return err;
 }
@@ -547,8 +632,8 @@ static int ldpaa_dpni_bind(struct ldpaa_eth_priv *priv)
 	pools_params.num_dpbp = 1;
 	pools_params.pools[0].dpbp_id = (uint16_t)dflt_dpbp->dpbp_attr.id;
 	pools_params.pools[0].buffer_size = LDPAA_ETH_RX_BUFFER_SIZE;
-	err = dpni_set_pools(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle,
-			     &pools_params);
+	err = dpni_set_pools(dflt_mc_io, MC_CMD_NO_FLAGS,
+			     dflt_dpni->dpni_handle, &pools_params);
 	if (err) {
 		printf("dpni_set_pools() failed\n");
 		return err;
@@ -560,8 +645,9 @@ static int ldpaa_dpni_bind(struct ldpaa_eth_priv *priv)
 	dflt_tx_flow.options = DPNI_TX_FLOW_OPT_ONLY_TX_ERROR;
 	dflt_tx_flow.conf_err_cfg.use_default_queue = 0;
 	dflt_tx_flow.conf_err_cfg.errors_only = 1;
-	err = dpni_set_tx_flow(dflt_mc_io, MC_CMD_NO_FLAGS, priv->dpni_handle,
-			       &priv->tx_flow_id, &dflt_tx_flow);
+	err = dpni_set_tx_flow(dflt_mc_io, MC_CMD_NO_FLAGS,
+			       dflt_dpni->dpni_handle, &priv->tx_flow_id,
+			       &dflt_tx_flow);
 	if (err) {
 		printf("dpni_set_tx_flow() failed\n");
 		return err;
@@ -570,12 +656,14 @@ static int ldpaa_dpni_bind(struct ldpaa_eth_priv *priv)
 	return 0;
 }
 
-static int ldpaa_eth_netdev_init(struct eth_device *net_dev)
+static int ldpaa_eth_netdev_init(struct eth_device *net_dev,
+				 phy_interface_t enet_if)
 {
 	int err;
 	struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)net_dev->priv;
 
-	sprintf(net_dev->name, "DPNI%d", priv->dpni_id);
+	sprintf(net_dev->name, "DPMAC%d@%s", priv->dpmac_id,
+		phy_interface_strings[enet_if]);
 
 	net_dev->iobase = 0;
 	net_dev->init = ldpaa_eth_open;
@@ -601,7 +689,7 @@ static int ldpaa_eth_netdev_init(struct eth_device *net_dev)
 	return 0;
 }
 
-int ldpaa_eth_init(int id)
+int ldpaa_eth_init(int dpmac_id, phy_interface_t enet_if)
 {
 	struct eth_device		*net_dev = NULL;
 	struct ldpaa_eth_priv		*priv = NULL;
@@ -626,9 +714,10 @@ int ldpaa_eth_init(int id)
 
 	net_dev->priv = (void *)priv;
 	priv->net_dev = (struct eth_device *)net_dev;
-	priv->dpni_id = id;
+	priv->dpmac_id = dpmac_id;
+	debug("%s dpmac_id=%d\n", __func__, dpmac_id);
 
-	err = ldpaa_eth_netdev_init(net_dev);
+	err = ldpaa_eth_netdev_init(net_dev, enet_if);
 	if (err)
 		goto err_netdev_init;
 
diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.h b/drivers/net/ldpaa_eth/ldpaa_eth.h
index b4ef700..b86a695 100644
--- a/drivers/net/ldpaa_eth/ldpaa_eth.h
+++ b/drivers/net/ldpaa_eth/ldpaa_eth.h
@@ -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 */
diff --git a/include/fsl-mc/fsl_mc_private.h b/include/fsl-mc/fsl_mc_private.h
index 191783a..17e0611 100644
--- a/include/fsl-mc/fsl_mc_private.h
+++ b/include/fsl-mc/fsl_mc_private.h
@@ -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_ */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 10/10][v4] driver: net: ldpaa: Add debug information
  2015-11-04  6:55 [U-Boot] [PATCH 00/10][v4] driver: net: ldpaa: Add support of new architeture Prabhakar Kushwaha
                   ` (8 preceding siblings ...)
  2015-11-04  6:56 ` [U-Boot] [PATCH 09/10][v4] driver: net: ldpaa: Use DPMAC as net device Prabhakar Kushwaha
@ 2015-11-04  6:56 ` Prabhakar Kushwaha
  2015-11-30 17:08   ` York Sun
  2015-11-04  6:56 ` [U-Boot] [PATCH][v2] driver: net: ldpaa: Fix Rx buffer alignment Prabhakar Kushwaha
  10 siblings, 1 reply; 24+ messages in thread
From: Prabhakar Kushwaha @ 2015-11-04  6:56 UTC (permalink / raw)
  To: u-boot

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 <prabhakar@freescale.com>
---
 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(+)

diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c
index 3d4c0f5..5ddc9fe 100644
--- a/drivers/net/ldpaa_eth/ldpaa_eth.c
+++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
@@ -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;
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH][v2] driver: net: ldpaa: Fix Rx buffer alignment
  2015-11-04  6:55 [U-Boot] [PATCH 00/10][v4] driver: net: ldpaa: Add support of new architeture Prabhakar Kushwaha
                   ` (9 preceding siblings ...)
  2015-11-04  6:56 ` [U-Boot] [PATCH 10/10][v4] driver: net: ldpaa: Add debug information Prabhakar Kushwaha
@ 2015-11-04  6:56 ` Prabhakar Kushwaha
  2015-11-30 17:09   ` York Sun
  10 siblings, 1 reply; 24+ messages in thread
From: Prabhakar Kushwaha @ 2015-11-04  6:56 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@freescale.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
---
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(-)

diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c
index 5ddc9fe..69530b1 100644
--- a/drivers/net/ldpaa_eth/ldpaa_eth.c
+++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
@@ -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);
diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.h b/drivers/net/ldpaa_eth/ldpaa_eth.h
index b86a695..af41b27 100644
--- a/drivers/net/ldpaa_eth/ldpaa_eth.h
+++ b/drivers/net/ldpaa_eth/ldpaa_eth.h
@@ -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.
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 07/10][v4] driver: net: fsl-mc: Add DPAA2 commands to manage MC
  2015-11-04  6:55 ` [U-Boot] [PATCH 07/10][v4] driver: net: fsl-mc: Add DPAA2 commands to manage MC Prabhakar Kushwaha
@ 2015-11-26  4:50   ` York Sun
  2015-11-30 17:07   ` York Sun
  1 sibling, 0 replies; 24+ messages in thread
From: York Sun @ 2015-11-26  4:50 UTC (permalink / raw)
  To: u-boot



On 11/03/2015 10:55 PM, Prabhakar Kushwaha wrote:
> 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 <prabhakar@freescale.com>
> ---
>  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(-)
> 
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/README.lsch3 b/arch/arm/cpu/armv8/fsl-layerscape/README.lsch3
> index 03e18f6..d1f92c4 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/README.lsch3
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/README.lsch3
> @@ -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

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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 01/10][v4] armv8: lsch3: Fix lane protocol parsing logic
  2015-11-04  6:55 ` [U-Boot] [PATCH 01/10][v4] armv8: lsch3: Fix lane protocol parsing logic Prabhakar Kushwaha
@ 2015-11-30 17:01   ` York Sun
  0 siblings, 0 replies; 24+ messages in thread
From: York Sun @ 2015-11-30 17:01 UTC (permalink / raw)
  To: u-boot



On 11/03/2015 10:55 PM, Prabhakar Kushwaha wrote:
> 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.
> 
> Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 02/10][v4] driver: net: fsl-mc: Add create, destroy APIs in flibs
  2015-11-04  6:55 ` [U-Boot] [PATCH 02/10][v4] driver: net: fsl-mc: Add create, destroy APIs in flibs Prabhakar Kushwaha
@ 2015-11-30 17:02   ` York Sun
  0 siblings, 0 replies; 24+ messages in thread
From: York Sun @ 2015-11-30 17:02 UTC (permalink / raw)
  To: u-boot



On 11/03/2015 10:55 PM, Prabhakar Kushwaha wrote:
> 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 <prabhakar@freescale.com>
> ---
>  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(+)

Applied to fsl-qoriq master. Thanks.

York

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 03/10][v4] driver: net: fsl-mc: Add APIs for DPMAC objects in FLIB
  2015-11-04  6:55 ` [U-Boot] [PATCH 03/10][v4] driver: net: fsl-mc: Add APIs for DPMAC objects in FLIB Prabhakar Kushwaha
@ 2015-11-30 17:02   ` York Sun
  0 siblings, 0 replies; 24+ messages in thread
From: York Sun @ 2015-11-30 17:02 UTC (permalink / raw)
  To: u-boot



On 11/03/2015 10:55 PM, Prabhakar Kushwaha wrote:
> 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 <prabhakar@freescale.com>
> ---
>  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

Applied to fsl-qoriq master. Thanks.

York

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 04/10][v4] armv8: ls2085aqds: Print function name during SerDes error
  2015-11-04  6:55 ` [U-Boot] [PATCH 04/10][v4] armv8: ls2085aqds: Print function name during SerDes error Prabhakar Kushwaha
@ 2015-11-30 17:02   ` York Sun
  0 siblings, 0 replies; 24+ messages in thread
From: York Sun @ 2015-11-30 17:02 UTC (permalink / raw)
  To: u-boot



On 11/03/2015 10:55 PM, Prabhakar Kushwaha wrote:
> Print function name along with SerDes Protocol during SerDes Protocol
> not supported error.
> 
> Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
> ---
>  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(-)

Applied to fsl-qoriq master. Thanks.

York

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 05/10][v4] driver: ldpaa: Add api to return linked PHY ID of DPMAC
  2015-11-04  6:55 ` [U-Boot] [PATCH 05/10][v4] driver: ldpaa: Add api to return linked PHY ID of DPMAC Prabhakar Kushwaha
@ 2015-11-30 17:03   ` York Sun
  0 siblings, 0 replies; 24+ messages in thread
From: York Sun @ 2015-11-30 17:03 UTC (permalink / raw)
  To: u-boot



On 11/03/2015 10:55 PM, Prabhakar Kushwaha wrote:
> 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 <prabhakar@freescale.com>
> ---
>  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(-)

Applied to fsl-qoriq master. Thanks.

York

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 06/10][v4] driver: net: fsl-mc: Increase MC command timeout
  2015-11-04  6:55 ` [U-Boot] [PATCH 06/10][v4] driver: net: fsl-mc: Increase MC command timeout Prabhakar Kushwaha
@ 2015-11-30 17:06   ` York Sun
  0 siblings, 0 replies; 24+ messages in thread
From: York Sun @ 2015-11-30 17:06 UTC (permalink / raw)
  To: u-boot



On 11/03/2015 10:55 PM, Prabhakar Kushwaha wrote:
> dpni_create API take takes more time as comapred to existing supported
> APIs of MC Flib.
> So increase MC command timeout.
> 
> Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
> ---
>  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(-)
> 

Applied to fsl-qoriq master. Thanks.

York

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 07/10][v4] driver: net: fsl-mc: Add DPAA2 commands to manage MC
  2015-11-04  6:55 ` [U-Boot] [PATCH 07/10][v4] driver: net: fsl-mc: Add DPAA2 commands to manage MC Prabhakar Kushwaha
  2015-11-26  4:50   ` York Sun
@ 2015-11-30 17:07   ` York Sun
  1 sibling, 0 replies; 24+ messages in thread
From: York Sun @ 2015-11-30 17:07 UTC (permalink / raw)
  To: u-boot



On 11/03/2015 10:55 PM, Prabhakar Kushwaha wrote:
> 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 <prabhakar@freescale.com>
> ---
>  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(-)
> 

Squashed with patch "armv8: README: Update README for DPAA2 commands for MC".
Applied to fsl-qoriq master. Thanks.

York

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 08/10][v4] driver: net: fsl-mc: Create DPAA2 object at run-time
  2015-11-04  6:55 ` [U-Boot] [PATCH 08/10][v4] driver: net: fsl-mc: Create DPAA2 object at run-time Prabhakar Kushwaha
@ 2015-11-30 17:07   ` York Sun
  0 siblings, 0 replies; 24+ messages in thread
From: York Sun @ 2015-11-30 17:07 UTC (permalink / raw)
  To: u-boot



On 11/03/2015 10:55 PM, Prabhakar Kushwaha wrote:
> 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 <prabhakar@freescale.com>
> ---
>  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(-)

Applied to fsl-qoriq master. Thanks.

York

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 09/10][v4] driver: net: ldpaa: Use DPMAC as net device
  2015-11-04  6:56 ` [U-Boot] [PATCH 09/10][v4] driver: net: ldpaa: Use DPMAC as net device Prabhakar Kushwaha
@ 2015-11-30 17:08   ` York Sun
  0 siblings, 0 replies; 24+ messages in thread
From: York Sun @ 2015-11-30 17:08 UTC (permalink / raw)
  To: u-boot



On 11/03/2015 10:56 PM, Prabhakar Kushwaha wrote:
> 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 DPMAC
> 
> Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
> ---
>  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(-)

Applied to fsl-qoriq master. Thanks.

York

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH 10/10][v4] driver: net: ldpaa: Add debug information
  2015-11-04  6:56 ` [U-Boot] [PATCH 10/10][v4] driver: net: ldpaa: Add debug information Prabhakar Kushwaha
@ 2015-11-30 17:08   ` York Sun
  0 siblings, 0 replies; 24+ messages in thread
From: York Sun @ 2015-11-30 17:08 UTC (permalink / raw)
  To: u-boot



On 11/03/2015 10:56 PM, Prabhakar Kushwaha wrote:
> 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 <prabhakar@freescale.com>
> ---
>  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(+)
> 

Applied to fsl-qoriq master. Thanks.

York

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [U-Boot] [PATCH][v2] driver: net: ldpaa: Fix Rx buffer alignment
  2015-11-04  6:56 ` [U-Boot] [PATCH][v2] driver: net: ldpaa: Fix Rx buffer alignment Prabhakar Kushwaha
@ 2015-11-30 17:09   ` York Sun
  0 siblings, 0 replies; 24+ messages in thread
From: York Sun @ 2015-11-30 17:09 UTC (permalink / raw)
  To: u-boot



On 11/03/2015 10:56 PM, Prabhakar Kushwaha wrote:
> 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.
> 
> Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@freescale.com>
> Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
> ---
> 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(-)

Applied to fsl-qoriq master. Thanks.

York

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2015-11-30 17:09 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-04  6:55 [U-Boot] [PATCH 00/10][v4] driver: net: ldpaa: Add support of new architeture Prabhakar Kushwaha
2015-11-04  6:55 ` [U-Boot] [PATCH 01/10][v4] armv8: lsch3: Fix lane protocol parsing logic Prabhakar Kushwaha
2015-11-30 17:01   ` York Sun
2015-11-04  6:55 ` [U-Boot] [PATCH 02/10][v4] driver: net: fsl-mc: Add create, destroy APIs in flibs Prabhakar Kushwaha
2015-11-30 17:02   ` York Sun
2015-11-04  6:55 ` [U-Boot] [PATCH 03/10][v4] driver: net: fsl-mc: Add APIs for DPMAC objects in FLIB Prabhakar Kushwaha
2015-11-30 17:02   ` York Sun
2015-11-04  6:55 ` [U-Boot] [PATCH 04/10][v4] armv8: ls2085aqds: Print function name during SerDes error Prabhakar Kushwaha
2015-11-30 17:02   ` York Sun
2015-11-04  6:55 ` [U-Boot] [PATCH 05/10][v4] driver: ldpaa: Add api to return linked PHY ID of DPMAC Prabhakar Kushwaha
2015-11-30 17:03   ` York Sun
2015-11-04  6:55 ` [U-Boot] [PATCH 06/10][v4] driver: net: fsl-mc: Increase MC command timeout Prabhakar Kushwaha
2015-11-30 17:06   ` York Sun
2015-11-04  6:55 ` [U-Boot] [PATCH 07/10][v4] driver: net: fsl-mc: Add DPAA2 commands to manage MC Prabhakar Kushwaha
2015-11-26  4:50   ` York Sun
2015-11-30 17:07   ` York Sun
2015-11-04  6:55 ` [U-Boot] [PATCH 08/10][v4] driver: net: fsl-mc: Create DPAA2 object at run-time Prabhakar Kushwaha
2015-11-30 17:07   ` York Sun
2015-11-04  6:56 ` [U-Boot] [PATCH 09/10][v4] driver: net: ldpaa: Use DPMAC as net device Prabhakar Kushwaha
2015-11-30 17:08   ` York Sun
2015-11-04  6:56 ` [U-Boot] [PATCH 10/10][v4] driver: net: ldpaa: Add debug information Prabhakar Kushwaha
2015-11-30 17:08   ` York Sun
2015-11-04  6:56 ` [U-Boot] [PATCH][v2] driver: net: ldpaa: Fix Rx buffer alignment Prabhakar Kushwaha
2015-11-30 17:09   ` York Sun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.