Skip to contentSkip to conversation

drivers/fsl-mc: flib changes for mc 8.0.0

PATCH New Prabhakar Kushwaha 2 participants 2 messages Jul 7, 2015 – Aug 4, 2015 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/fsl-mc: flib changes for mc 8.0.0

MC firware version 8.0.0 contains new command flags. This patch contains modifications in FLIB files to support the new command flags.

---
git://git.denx.de/u-boot-fsl-qoriq.git branch next

 drivers/net/fsl-mc/dpbp.c         |  38 +++++++---
 drivers/net/fsl-mc/dpio/dpio.c    |  38 +++++++---
 drivers/net/fsl-mc/dpmng.c        |   7 +-
 drivers/net/fsl-mc/dpni.c         | 126 ++++++++++++++++++++++---------
 drivers/net/fsl-mc/dprc.c         |  70 +++++++++++------
 drivers/net/fsl-mc/mc.c           |  40 ++++++----
 drivers/net/fsl-mc/mc_sys.c       |   2 +-
 drivers/net/ldpaa_eth/ldpaa_eth.c |  69 +++++++++--------
 include/fsl-mc/fsl_dpbp.h         |  49 +++++++++---
 include/fsl-mc/fsl_dpio.h         |  30 ++++++--
 include/fsl-mc/fsl_dpmng.h        |   7 +-
 include/fsl-mc/fsl_dpni.h         | 115 ++++++++++++++++++++++------
 include/fsl-mc/fsl_dprc.h         | 154 +++++++++++++++++++++++++++++---------
 include/fsl-mc/fsl_mc_cmd.h       |  47 +++++++-----
 14 files changed, 571 insertions(+), 221 deletions(-)
drivers/net/fsl-mc/dpbp.c +27 -11
index 3853e58..1517a70 100644
@@ -10,14 +10,18 @@
 #include <fsl-mc/fsl_mc_cmd.h>
 #include <fsl-mc/fsl_dpbp.h>
 
-int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, uint16_t *token)
+int dpbp_open(struct fsl_mc_io *mc_io,
+	      uint32_t cmd_flags,
+	      int dpbp_id,
+	      uint16_t *token)
 {
 	struct mc_command cmd = { 0 };
 	int err;
 
 	/* prepare command */
 	cmd.header = mc_encode_cmd_header(DPBP_CMDID_OPEN,
-					  MC_CMD_PRI_LOW, 0);
+					  cmd_flags,
+					  0);
 	DPBP_CMD_OPEN(cmd, dpbp_id);
 
 	/* send command to mc*/
@@ -31,55 +35,66 @@ int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, uint16_t *token)
 	return err;
 }
 
-int dpbp_close(struct fsl_mc_io *mc_io, uint16_t token)
+int dpbp_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(DPBP_CMDID_CLOSE, MC_CMD_PRI_HIGH,
+	cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLOSE, cmd_flags,
 					  token);
 
 	/* send command to mc*/
 	return mc_send_command(mc_io, &cmd);
 }
 
-int dpbp_enable(struct fsl_mc_io *mc_io, uint16_t token)
+int dpbp_enable(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_ENABLE, MC_CMD_PRI_LOW,
+	cmd.header = mc_encode_cmd_header(DPBP_CMDID_ENABLE, cmd_flags,
 					  token);
 
 	/* send command to mc*/
 	return mc_send_command(mc_io, &cmd);
 }
 
-int dpbp_disable(struct fsl_mc_io *mc_io, uint16_t token)
+int dpbp_disable(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_DISABLE,
-					  MC_CMD_PRI_LOW, token);
+					  cmd_flags,
+					  token);
 
 	/* send command to mc*/
 	return mc_send_command(mc_io, &cmd);
 }
 
-int dpbp_reset(struct fsl_mc_io *mc_io, uint16_t token)
+int dpbp_reset(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_RESET,
-					  MC_CMD_PRI_LOW, token);
+					  cmd_flags,
+					  token);
 
 	/* send command to mc*/
 	return mc_send_command(mc_io, &cmd);
 }
 
 int dpbp_get_attributes(struct fsl_mc_io *mc_io,
+			uint32_t cmd_flags,
 			uint16_t token,
 			struct dpbp_attr *attr)
 {
@@ -88,7 +103,8 @@ int dpbp_get_attributes(struct fsl_mc_io *mc_io,
 
 	/* prepare command */
 	cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_ATTR,
-					  MC_CMD_PRI_LOW, token);
+					  cmd_flags,
+					  token);
 
 	/* send command to mc*/
 	err = mc_send_command(mc_io, &cmd);
drivers/net/fsl-mc/dpio/dpio.c +27 -11
index b07eff7..cd3fd50 100644
@@ -8,14 +8,18 @@
 #include <fsl-mc/fsl_mc_cmd.h>
 #include <fsl-mc/fsl_dpio.h>
 
-int dpio_open(struct fsl_mc_io *mc_io, int dpio_id, uint16_t *token)
+int dpio_open(struct fsl_mc_io *mc_io,
+	      uint32_t cmd_flags,
+	      int dpio_id,
+	      uint16_t *token)
 {
 	struct mc_command cmd = { 0 };
 	int err;
 
 	/* prepare command */
 	cmd.header = mc_encode_cmd_header(DPIO_CMDID_OPEN,
-					  MC_CMD_PRI_LOW, 0);
+					  cmd_flags,
+					  0);
 	DPIO_CMD_OPEN(cmd, dpio_id);
 
 	/* send command to mc*/
@@ -29,56 +33,68 @@ int dpio_open(struct fsl_mc_io *mc_io, int dpio_id, uint16_t *token)
 	return 0;
 }
 
-int dpio_close(struct fsl_mc_io *mc_io, uint16_t token)
+int dpio_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(DPIO_CMDID_CLOSE,
-					  MC_CMD_PRI_HIGH, token);
+					  cmd_flags,
+					  token);
 
 	/* send command to mc*/
 	return mc_send_command(mc_io, &cmd);
 }
 
-int dpio_enable(struct fsl_mc_io *mc_io, uint16_t token)
+int dpio_enable(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_ENABLE,
-					  MC_CMD_PRI_LOW, token);
+					  cmd_flags,
+					  token);
 
 	/* send command to mc*/
 	return mc_send_command(mc_io, &cmd);
 }
 
-int dpio_disable(struct fsl_mc_io *mc_io, uint16_t token)
+int dpio_disable(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_DISABLE,
-					  MC_CMD_PRI_LOW,
+					  cmd_flags,
 					  token);
 
 	/* send command to mc*/
 	return mc_send_command(mc_io, &cmd);
 }
 
-int dpio_reset(struct fsl_mc_io *mc_io, uint16_t token)
+int dpio_reset(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_RESET,
-					  MC_CMD_PRI_LOW, token);
+					  cmd_flags,
+					  token);
 
 	/* send command to mc*/
 	return mc_send_command(mc_io, &cmd);
 }
 
 int dpio_get_attributes(struct fsl_mc_io *mc_io,
+			uint32_t cmd_flags,
 			uint16_t token,
 			struct dpio_attr *attr)
 {
@@ -87,7 +103,7 @@ int dpio_get_attributes(struct fsl_mc_io *mc_io,
 
 	/* prepare command */
 	cmd.header = mc_encode_cmd_header(DPIO_CMDID_GET_ATTR,
-					  MC_CMD_PRI_LOW,
+					  cmd_flags,
 					  token);
 
 	/* send command to mc*/
drivers/net/fsl-mc/dpmng.c +5 -2
index 01ee112..d96e26b 100644
@@ -7,14 +7,17 @@
 #include <fsl-mc/fsl_dpmng.h>
 #include "fsl_dpmng_cmd.h"
 
-int mc_get_version(struct fsl_mc_io *mc_io, struct mc_version *mc_ver_info)
+int mc_get_version(struct fsl_mc_io *mc_io,
+		   uint32_t cmd_flags,
+		   struct mc_version *mc_ver_info)
 {
 	struct mc_command cmd = { 0 };
 	int err;
 
 	/* prepare command */
 	cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION,
-					  MC_CMD_PRI_LOW, 0);
+					  cmd_flags,
+					  0);
 
 	/* send command to mc*/
 	err = mc_send_command(mc_io, &cmd);
drivers/net/fsl-mc/dpni.c +92 -34

445 lines not on this page · raw message

drivers/net/fsl-mc/dprc.c +48 -22

226 lines not on this page · raw message

drivers/net/fsl-mc/mc.c +24 -16
index 2820883..958a620 100644
@@ -547,7 +547,7 @@ int mc_init(void)
 	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);
 
-	error = mc_get_version(dflt_mc_io, &mc_ver_info);
+	error = mc_get_version(dflt_mc_io, MC_CMD_NO_FLAGS, &mc_ver_info);
 	if (error != 0) {
 		printf("fsl-mc: ERROR: Firmware version check failed (error: %d)\n",
 		       error);
@@ -634,19 +634,21 @@ int dpio_init(struct dprc_obj_desc obj_desc)
 
 	dflt_dpio->dpio_id = obj_desc.id;
 
-	err = dpio_open(dflt_mc_io, obj_desc.id, &dflt_dpio_handle);
+	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_get_attributes(dflt_mc_io, dflt_dpio_handle, &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);
 		goto err_get_attr;
 	}
 
-	err = dpio_enable(dflt_mc_io, dflt_dpio_handle);
+	err = dpio_enable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio_handle);
 	if (err) {
 		printf("dpio_enable() failed %d\n", err);
 		goto err_get_enable;
@@ -671,9 +673,9 @@ int dpio_init(struct dprc_obj_desc obj_desc)
 
 err_get_swp_init:
 err_get_enable:
-	dpio_disable(dflt_mc_io, dflt_dpio_handle);
+	dpio_disable(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio_handle);
 err_get_attr:
-	dpio_close(dflt_mc_io, dflt_dpio_handle);
+	dpio_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio_handle);
 err_open:
 	free(dflt_dpio);
 	return err;
@@ -710,8 +712,9 @@ int dprc_init_container_obj(struct dprc_obj_desc obj_desc, uint16_t dprc_handle)
 	} 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, dprc_handle,
-				     &dpni_endpoint, &dpmac_endpoint, &state);
+		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)
@@ -728,7 +731,7 @@ int dprc_scan_container_obj(uint16_t dprc_handle, char *obj_type, int i)
 
 	memset((void *)&obj_desc, 0x00, sizeof(struct dprc_obj_desc));
 
-	error = dprc_get_obj(dflt_mc_io, dprc_handle,
+	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",
@@ -761,7 +764,8 @@ int fsl_mc_ldpaa_init(bd_t *bis)
 	if (error < 0)
 		goto error;
 
-	error = dprc_get_container_id(dflt_mc_io, &container_id);
+	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;
@@ -769,7 +773,8 @@ int fsl_mc_ldpaa_init(bd_t *bis)
 
 	debug("fsl-mc: Container id=0x%x\n", container_id);
 
-	error = dprc_open(dflt_mc_io, container_id, &dflt_dprc_handle);
+	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;
@@ -777,7 +782,7 @@ int fsl_mc_ldpaa_init(bd_t *bis)
 	dprc_opened = true;
 
 	error = dprc_get_obj_count(dflt_mc_io,
-				   dflt_dprc_handle,
+				   MC_CMD_NO_FLAGS, dflt_dprc_handle,
 				   &num_child_objects);
 	if (error < 0) {
 		printf("dprc_get_obj_count() failed: %d\n", error);
@@ -804,7 +809,7 @@ int fsl_mc_ldpaa_init(bd_t *bis)
 	}
 error:
 	if (dprc_opened)
-		dprc_close(dflt_mc_io, dflt_dprc_handle);
+		dprc_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dprc_handle);
 
 	return error;
 }
@@ -814,17 +819,20 @@ void fsl_mc_ldpaa_exit(bd_t *bis)
 	int err;
 
 	if (get_mc_boot_status() == 0) {
-		err = dpio_disable(dflt_mc_io, dflt_dpio_handle);
+		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, dflt_dpio_handle);
+		err = dpio_reset(dflt_mc_io, MC_CMD_NO_FLAGS,
+				 dflt_dpio_handle);
 		if (err < 0) {
 			printf("dpio_reset() failed: %d\n", err);
 			return;
 		}
-		err = dpio_close(dflt_mc_io, dflt_dpio_handle);
+		err = dpio_close(dflt_mc_io, MC_CMD_NO_FLAGS,
+				 dflt_dpio_handle);
 		if (err < 0) {
 			printf("dpio_close() failed: %d\n", err);
 			return;
drivers/net/fsl-mc/mc_sys.c +1 -1
index 3fc1f98..2136670 100644
@@ -14,7 +14,7 @@
 #include <asm/io.h>
 
 #define MC_CMD_HDR_READ_CMDID(_hdr) \
-	((uint16_t)u64_dec((_hdr), MC_CMD_HDR_CMDID_O, MC_CMD_HDR_CMDID_S))
+	((uint16_t)mc_dec((_hdr), MC_CMD_HDR_CMDID_O, MC_CMD_HDR_CMDID_S))
 
 /**
  * mc_send_command - Send MC command and wait for response
drivers/net/ldpaa_eth/ldpaa_eth.c +37 -32

197 lines not on this page · raw message

include/fsl-mc/fsl_dpbp.h +40 -9

123 lines not on this page · raw message

include/fsl-mc/fsl_dpio.h +24 -6
index e779909..9e83a2e 100644
@@ -9,7 +9,7 @@
 
 /* DPIO Version */
 #define DPIO_VER_MAJOR				3
-#define DPIO_VER_MINOR				0
+#define DPIO_VER_MINOR				1
 
 /* Command IDs */
 #define DPIO_CMDID_CLOSE					0x800
@@ -46,6 +46,7 @@ struct fsl_mc_io;
 /**
  * dpio_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_'
  * @dpio_id:	DPIO unique ID
  * @token:	Returned token; use in subsequent API calls
  *
@@ -59,16 +60,22 @@ struct fsl_mc_io;
  *
  * Return:	'0' on Success; Error code otherwise.
  */
-int dpio_open(struct fsl_mc_io *mc_io, int dpio_id, uint16_t *token);
+int dpio_open(struct fsl_mc_io	*mc_io,
+	      uint32_t		cmd_flags,
+	      int		dpio_id,
+	      uint16_t		*token);
 
 /**
  * dpio_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 DPIO object
  *
  * Return:	'0' on Success; Error code otherwise.
  */
-int dpio_close(struct fsl_mc_io *mc_io, uint16_t token);
+int dpio_close(struct fsl_mc_io	*mc_io,
+	       uint32_t		cmd_flags,
+	       uint16_t		token);
 
 /**
  * enum dpio_channel_mode - DPIO notification channel mode
@@ -85,29 +92,38 @@ enum dpio_channel_mode {
 /**
  * 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_'
  * @token:	Token of DPIO object
  *
  * Return:	'0' on Success; Error code otherwise
  */
-int dpio_enable(struct fsl_mc_io *mc_io, uint16_t token);
+int dpio_enable(struct fsl_mc_io	*mc_io,
+		uint32_t		cmd_flags,
+		uint16_t		token);
 
 /**
  * dpio_disable() - Disable the DPIO, stop any I/O portal operation.
  * @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_disable(struct fsl_mc_io *mc_io, uint16_t token);
+int dpio_disable(struct fsl_mc_io	*mc_io,
+		 uint32_t		cmd_flags,
+		 uint16_t		token);
 
 /**
  * dpio_reset() - Reset the DPIO, returns the object to initial state.
  * @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_reset(struct fsl_mc_io *mc_io, uint16_t token);
+int dpio_reset(struct fsl_mc_io	*mc_io,
+	       uint32_t			cmd_flags,
+	       uint16_t		token);
 
 /**
  * struct dpio_attr - Structure representing DPIO attributes
@@ -141,12 +157,14 @@ struct dpio_attr {
 /**
  * dpio_get_attributes() - Retrieve DPIO 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 DPIO object
  * @attr:	Returned object's attributes
  *
  * Return:	'0' on Success; Error code otherwise
  */
 int dpio_get_attributes(struct fsl_mc_io	*mc_io,
+			uint32_t		cmd_flags,
 			uint16_t		token,
 			struct dpio_attr	*attr);
 
include/fsl-mc/fsl_dpmng.h +5 -2
index 6feb292..b0a87a9 100644
@@ -14,7 +14,7 @@ struct fsl_mc_io;
 /**
  * Management Complex firmware version information
  */
-#define MC_VER_MAJOR 7
+#define MC_VER_MAJOR 8
 #define MC_VER_MINOR 0
 
 /**
@@ -35,10 +35,13 @@ struct mc_version {
  * mc_get_version() - Retrieves the Management Complex firmware
  *			version information
  * @mc_io:		Pointer to opaque I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
  * @mc_ver_info:	Returned version information structure
  *
  * Return:	'0' on Success; Error code otherwise.
  */
-int mc_get_version(struct fsl_mc_io *mc_io, struct mc_version *mc_ver_info);
+int mc_get_version(struct fsl_mc_io	*mc_io,
+		   uint32_t		cmd_flags,
+		   struct mc_version	*mc_ver_info);
 
 #endif /* __FSL_DPMNG_H */
include/fsl-mc/fsl_dpni.h +94 -21

478 lines not on this page · raw message

include/fsl-mc/fsl_dprc.h +119 -35

377 lines not on this page · raw message

include/fsl-mc/fsl_mc_cmd.h +28 -19

89 lines not on this page · raw message

Signature · 1 line
1.9.1