Skip to contentSkip to conversation

staging: fsl-mc: up-rev version of MC interface code

PATCH Superseded J. German Rivera 3 participants 10 messages Sep 22, 2015 – Sep 24, 2015 Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover staging: fsl-mc: up-rev version of MC interface code

The DPAA2 management complex has a versioned binary interface that has to be kept in sync with the DPAA2 drivers. This patch series uprevs the APIs that build MC commands and parse results. This uprev is needed to support object interrupts.

MC binary interface changes
-overall version from 6.0 to 8.0
-dprc version from 3.0 to 4.0
-dpbp and dpmcp versions from 2.0 to 2.1
-new dprc commands -- set/get obj irq, set obj label,
get obj descriptor
-removed commands -- get portal paddr
-object regions are reported as region offsets not physical
addresses

build/parse API changes
-flags arg is added to all APIs for future extensibility,
hardcoded priority bit is now a flag
-IRQ-related args are consolidated into an irq_cfg struct

Changes in v2:
Split single patch into a patch series as requested by Greg K-H. The new patch series consists of the following patches:

Patch 1: Add new flags field to MC command header Patch 2: uprev binary interface for dpmng objects to v8.0 Patch 3: up-rev binary interface for dpbp objects to v2.0 Patch 4: up-rev binary interface for dpmcp objects to v2.0 Patch 5: up-rev binary interface for dpcon objects to v2.0 Patch 6: up-rev binary interface for dprc objects to v4.0

#1 lore raw

PATCH v2 1/6 staging: fsl-mc: Add new flags field to MC command header

The Management Complex (MC) binary interface added a new "flags" field to the command header.
Add the definitions for this field in preparation for adding the new cmd_flags parameter to all MC interface APIs.

---
 drivers/staging/fsl-mc/include/mc-cmd.h | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)
drivers/staging/fsl-mc/include/mc-cmd.h +24 -6
index 32501e0..af7de6e 100644
@@ -67,14 +67,31 @@ enum mc_cmd_status {
 	MC_CMD_STATUS_INVALID_STATE = 0xC /* Invalid state */
 };
 
+/*
+ * MC command flags
+ */
+
+/* High priority flag */
+#define MC_CMD_FLAG_PRI		0x00008000
+/* Command completion flag */
+#define MC_CMD_FLAG_INTR_DIS	0x01000000
+
+/*
+ * TODO Remove following two defines after completion of flib 8.0.0
+ * integration
+ */
+#define MC_CMD_PRI_LOW		0 /*!< Low Priority command indication */
+#define MC_CMD_PRI_HIGH		1 /*!< High Priority command indication */
+
 #define MC_CMD_HDR_CMDID_O	52	/* Command ID field offset */
 #define MC_CMD_HDR_CMDID_S	12	/* Command ID field size */
 #define MC_CMD_HDR_TOKEN_O	38	/* Token field offset */
 #define MC_CMD_HDR_TOKEN_S	10	/* Token field size */
 #define MC_CMD_HDR_STATUS_O	16	/* Status field offset */
 #define MC_CMD_HDR_STATUS_S	8	/* Status field size*/
-#define MC_CMD_HDR_PRI_O	15	/* Priority field offset */
-#define MC_CMD_HDR_PRI_S	1	/* Priority field size */
+#define MC_CMD_HDR_FLAGS_O	0	/* Flags field offset */
+#define MC_CMD_HDR_FLAGS_S	32	/* Flags field size*/
+#define MC_CMD_HDR_FLAGS_MASK	0xFF00FF00 /* Command flags mask */
 
 #define MC_CMD_HDR_READ_STATUS(_hdr) \
 	((enum mc_cmd_status)mc_dec((_hdr), \
@@ -83,8 +100,8 @@ enum mc_cmd_status {
 #define MC_CMD_HDR_READ_TOKEN(_hdr) \
 	((uint16_t)mc_dec((_hdr), MC_CMD_HDR_TOKEN_O, MC_CMD_HDR_TOKEN_S))
 
-#define MC_CMD_PRI_LOW		0 /* Low Priority command indication */
-#define MC_CMD_PRI_HIGH		1 /* High Priority command indication */
+#define MC_CMD_HDR_READ_FLAGS(_hdr) \
+	((uint32_t)mc_dec((_hdr), MC_CMD_HDR_FLAGS_O, MC_CMD_HDR_FLAGS_S))
 
 #define MC_EXT_OP(_ext, _param, _offset, _width, _type, _arg) \
 	((_ext)[_param] |= mc_enc((_offset), (_width), _arg))
@@ -96,14 +113,15 @@ enum mc_cmd_status {
 	(_arg = (_type)mc_dec(_cmd.params[_param], (_offset), (_width)))
 
 static inline uint64_t mc_encode_cmd_header(uint16_t cmd_id,
-					    uint8_t priority,
+					    uint32_t cmd_flags,
 					    uint16_t token)
 {
 	uint64_t hdr;
 
 	hdr = mc_enc(MC_CMD_HDR_CMDID_O, MC_CMD_HDR_CMDID_S, cmd_id);
+	hdr |= mc_enc(MC_CMD_HDR_FLAGS_O, MC_CMD_HDR_FLAGS_S,
+		       (cmd_flags & MC_CMD_HDR_FLAGS_MASK));
 	hdr |= mc_enc(MC_CMD_HDR_TOKEN_O, MC_CMD_HDR_TOKEN_S, token);
-	hdr |= mc_enc(MC_CMD_HDR_PRI_O, MC_CMD_HDR_PRI_S, priority);
 	hdr |= mc_enc(MC_CMD_HDR_STATUS_O, MC_CMD_HDR_STATUS_S,
 		       MC_CMD_STATUS_READY);
 

--
2.3.3

#2 lore raw

PATCH v2 2/6 staging: fsl-mc: uprev dpmng binary interface to v8.0

In reply to J. German Rivera

Add cmd_flags parameter to all dpmng APIs to comply with 8.0 MC firmware interface. Updated MC version major number.

---
 drivers/staging/fsl-mc/bus/dpmng.c     | 14 ++++++++++----
 drivers/staging/fsl-mc/bus/mc-bus.c    |  4 ++--
 drivers/staging/fsl-mc/include/dpmng.h | 14 ++++++++++----
 3 files changed, 22 insertions(+), 10 deletions(-)
drivers/staging/fsl-mc/bus/dpmng.c +10 -4
index 58328e8..1aeca05 100644
@@ -34,14 +34,17 @@
 #include "../include/dpmng.h"
 #include "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);
@@ -56,14 +59,17 @@ int mc_get_version(struct fsl_mc_io *mc_io, struct mc_version *mc_ver_info)
 	return 0;
 }
 
-int dpmng_get_container_id(struct fsl_mc_io *mc_io, int *container_id)
+int dpmng_get_container_id(struct fsl_mc_io *mc_io,
+			   uint32_t cmd_flags,
+			   int *container_id)
 {
 	struct mc_command cmd = { 0 };
 	int err;
 
 	/* prepare command */
 	cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_CONT_ID,
-					  MC_CMD_PRI_LOW, 0);
+					  cmd_flags,
+					  0);
 
 	/* send command to mc*/
 	err = mc_send_command(mc_io, &cmd);
drivers/staging/fsl-mc/bus/mc-bus.c +2 -2
index b3a60a0..f3718a3 100644
@@ -630,7 +630,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
 	if (error < 0)
 		return error;
 
-	error = mc_get_version(mc_io, &mc_version);
+	error = mc_get_version(mc_io, 0, &mc_version);
 	if (error != 0) {
 		dev_err(&pdev->dev,
 			"mc_get_version() failed with error %d\n", error);
@@ -661,7 +661,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
 	if (error < 0)
 		goto error_cleanup_mc_io;
 
-	error = dpmng_get_container_id(mc_io, &container_id);
+	error = dpmng_get_container_id(mc_io, 0, &container_id);
 	if (error < 0) {
 		dev_err(&pdev->dev,
 			"dpmng_get_container_id() failed: %d\n", error);
drivers/staging/fsl-mc/include/dpmng.h +10 -4
index 1b052b8..4a0996c 100644
@@ -41,11 +41,11 @@ struct fsl_mc_io;
 /**
  * Management Complex firmware version information
  */
-#define MC_VER_MAJOR 6
+#define MC_VER_MAJOR 8
 #define MC_VER_MINOR 0
 
 /**
- * struct mc_versoin
+ * struct mc_version
  * @major: Major version number: incremented on API compatibility changes
  * @minor: Minor version number: incremented on API additions (that are
  *		backward compatible); reset when major version is incremented
@@ -62,19 +62,25 @@ 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);
 
 /**
  * dpmng_get_container_id() - Get container ID associated with a given portal.
  * @mc_io:		Pointer to MC portal's I/O object
+ * @cmd_flags:		Command flags; one or more of 'MC_CMD_FLAG_'
  * @container_id:	Requested container ID
  *
  * Return:	'0' on Success; Error code otherwise.
  */
-int dpmng_get_container_id(struct fsl_mc_io *mc_io, int *container_id);
+int dpmng_get_container_id(struct fsl_mc_io	*mc_io,
+			   uint32_t		cmd_flags,
+			   int			*container_id);
 
 #endif /* __FSL_DPMNG_H */

--
2.3.3

#3 lore raw

PATCH v2 3/6 staging: fsl-mc: up-rev dpbp binary interface to v2.0

In reply to J. German Rivera

Add cmd_flags parameter to all dpbp APIs to comply with the dpbp 2.0 MC interface. Updated MC version major number. Pass irq args in struct instead of separate args.

---
 drivers/staging/fsl-mc/bus/dpbp.c         | 136 ++++++++++++++++++++----------
 drivers/staging/fsl-mc/include/dpbp-cmd.h |   2 +-
 drivers/staging/fsl-mc/include/dpbp.h     |  91 +++++++++++++++-----
 3 files changed, 162 insertions(+), 67 deletions(-)
drivers/staging/fsl-mc/bus/dpbp.c +93 -43
index d99ab6d..0004e65 100644
@@ -34,14 +34,19 @@
 #include "../include/dpbp.h"
 #include "../include/dpbp-cmd.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);
+
 	cmd.params[0] |= mc_enc(0, 32, dpbp_id);
 
 	/* send command to mc*/
@@ -56,12 +61,14 @@ int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, uint16_t *token)
 }
 EXPORT_SYMBOL(dpbp_open);
 
-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*/
@@ -70,6 +77,7 @@ int dpbp_close(struct fsl_mc_io *mc_io, uint16_t token)
 EXPORT_SYMBOL(dpbp_close);
 
 int dpbp_create(struct fsl_mc_io *mc_io,
+		uint32_t cmd_flags,
 		const struct dpbp_cfg *cfg,
 		uint16_t *token)
 {
@@ -80,7 +88,8 @@ int dpbp_create(struct fsl_mc_io *mc_io,
 
 	/* prepare command */
 	cmd.header = mc_encode_cmd_header(DPBP_CMDID_CREATE,
-					  MC_CMD_PRI_LOW, 0);
+					  cmd_flags,
+					  0);
 
 	/* send command to mc*/
 	err = mc_send_command(mc_io, &cmd);
@@ -93,24 +102,29 @@ int dpbp_create(struct fsl_mc_io *mc_io,
 	return 0;
 }
 
-int dpbp_destroy(struct fsl_mc_io *mc_io, uint16_t token)
+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,
-					  MC_CMD_PRI_LOW, token);
+					  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*/
@@ -118,25 +132,31 @@ int dpbp_enable(struct fsl_mc_io *mc_io, uint16_t token)
 }
 EXPORT_SYMBOL(dpbp_enable);
 
-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);
 }
 EXPORT_SYMBOL(dpbp_disable);
 
-int dpbp_is_enabled(struct fsl_mc_io *mc_io, uint16_t token, int *en)
+int dpbp_is_enabled(struct fsl_mc_io *mc_io,
+		    uint32_t cmd_flags,
+		    uint16_t token,
+		    int *en)
 {
 	struct mc_command cmd = { 0 };
 	int err;
 	/* prepare command */
-	cmd.header = mc_encode_cmd_header(DPBP_CMDID_IS_ENABLED, MC_CMD_PRI_LOW,
+	cmd.header = mc_encode_cmd_header(DPBP_CMDID_IS_ENABLED, cmd_flags,
 					  token);
 
 	/* send command to mc*/
@@ -150,53 +170,58 @@ int dpbp_is_enabled(struct fsl_mc_io *mc_io, uint16_t token, int *en)
 	return 0;
 }
 
-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_set_irq(struct fsl_mc_io *mc_io,
-		 uint16_t token,
-		 uint8_t irq_index,
-		 uint64_t irq_paddr,
-		 uint32_t irq_val,
-		 int user_irq_id)
+int dpbp_set_irq(struct fsl_mc_io	*mc_io,
+		 uint32_t		cmd_flags,
+		 uint16_t		token,
+		 uint8_t		irq_index,
+		 struct dpbp_irq_cfg	*irq_cfg)
 {
 	struct mc_command cmd = { 0 };
 
 	/* prepare command */
 	cmd.header = mc_encode_cmd_header(DPBP_CMDID_SET_IRQ,
-					  MC_CMD_PRI_LOW, token);
+					  cmd_flags,
+					  token);
+
 	cmd.params[0] |= mc_enc(0, 8, irq_index);
-	cmd.params[0] |= mc_enc(32, 32, irq_val);
-	cmd.params[1] |= mc_enc(0, 64, irq_paddr);
-	cmd.params[2] |= mc_enc(0, 32, user_irq_id);
+	cmd.params[0] |= mc_enc(32, 32, irq_cfg->val);
+	cmd.params[1] |= mc_enc(0, 64, irq_cfg->addr);
+	cmd.params[2] |= mc_enc(0, 32, irq_cfg->user_irq_id);
 
 	/* send command to mc*/
 	return mc_send_command(mc_io, &cmd);
 }
 
-int dpbp_get_irq(struct fsl_mc_io *mc_io,
-		 uint16_t token,
-		 uint8_t irq_index,
-		 int *type,
-		 uint64_t *irq_paddr,
-		 uint32_t *irq_val,
-		 int *user_irq_id)
+int dpbp_get_irq(struct fsl_mc_io	*mc_io,
+		 uint32_t		cmd_flags,
+		 uint16_t		token,
+		 uint8_t		irq_index,
+		 int			*type,
+		 struct dpbp_irq_cfg	*irq_cfg)
 {
 	struct mc_command cmd = { 0 };
 	int err;
 
 	/* prepare command */
 	cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ,
-					  MC_CMD_PRI_LOW, token);
+					  cmd_flags,
+					  token);
+
 	cmd.params[0] |= mc_enc(32, 8, irq_index);
 
 	/* send command to mc*/
@@ -205,14 +230,16 @@ int dpbp_get_irq(struct fsl_mc_io *mc_io,
 		return err;
 
 	/* retrieve response parameters */
-	*irq_val = (uint32_t)mc_dec(cmd.params[0], 0, 32);
-	*irq_paddr = (uint64_t)mc_dec(cmd.params[1], 0, 64);
-	*user_irq_id = (int)mc_dec(cmd.params[2], 0, 32);
+	irq_cfg->val = (uint32_t)mc_dec(cmd.params[0], 0, 32);
+	irq_cfg->addr = (uint64_t)mc_dec(cmd.params[1], 0, 64);
+	irq_cfg->user_irq_id = (int)mc_dec(cmd.params[2], 0, 32);
 	*type = (int)mc_dec(cmd.params[2], 32, 32);
+
 	return 0;
 }
 
 int dpbp_set_irq_enable(struct fsl_mc_io *mc_io,
+			uint32_t cmd_flags,
 			uint16_t token,
 			uint8_t irq_index,
 			uint8_t en)
@@ -221,7 +248,9 @@ int dpbp_set_irq_enable(struct fsl_mc_io *mc_io,
 
 	/* prepare command */
 	cmd.header = mc_encode_cmd_header(DPBP_CMDID_SET_IRQ_ENABLE,
-					  MC_CMD_PRI_LOW, token);
+					  cmd_flags,
+					  token);
+
 	cmd.params[0] |= mc_enc(0, 8, en);
 	cmd.params[0] |= mc_enc(32, 8, irq_index);
 
@@ -230,6 +259,7 @@ int dpbp_set_irq_enable(struct fsl_mc_io *mc_io,
 }
 
 int dpbp_get_irq_enable(struct fsl_mc_io *mc_io,
+			uint32_t cmd_flags,
 			uint16_t token,
 			uint8_t irq_index,
 			uint8_t *en)
@@ -239,7 +269,9 @@ int dpbp_get_irq_enable(struct fsl_mc_io *mc_io,
 
 	/* prepare command */
 	cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ_ENABLE,
-					  MC_CMD_PRI_LOW, token);
+					  cmd_flags,
+					  token);
+
 	cmd.params[0] |= mc_enc(32, 8, irq_index);
 
 	/* send command to mc*/
@@ -249,10 +281,12 @@ int dpbp_get_irq_enable(struct fsl_mc_io *mc_io,
 
 	/* retrieve response parameters */
 	*en = (uint8_t)mc_dec(cmd.params[0], 0, 8);
+
 	return 0;
 }
 
 int dpbp_set_irq_mask(struct fsl_mc_io *mc_io,
+		      uint32_t cmd_flags,
 		      uint16_t token,
 		      uint8_t irq_index,
 		      uint32_t mask)
@@ -261,7 +295,9 @@ int dpbp_set_irq_mask(struct fsl_mc_io *mc_io,
 
 	/* prepare command */
 	cmd.header = mc_encode_cmd_header(DPBP_CMDID_SET_IRQ_MASK,
-					  MC_CMD_PRI_LOW, token);
+					  cmd_flags,
+					  token);
+
 	cmd.params[0] |= mc_enc(0, 32, mask);
 	cmd.params[0] |= mc_enc(32, 8, irq_index);
 
@@ -270,6 +306,7 @@ int dpbp_set_irq_mask(struct fsl_mc_io *mc_io,
 }
 
 int dpbp_get_irq_mask(struct fsl_mc_io *mc_io,
+		      uint32_t cmd_flags,
 		      uint16_t token,
 		      uint8_t irq_index,
 		      uint32_t *mask)
@@ -279,7 +316,9 @@ int dpbp_get_irq_mask(struct fsl_mc_io *mc_io,
 
 	/* prepare command */
 	cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ_MASK,
-					  MC_CMD_PRI_LOW, token);
+					  cmd_flags,
+					  token);
+
 	cmd.params[0] |= mc_enc(32, 8, irq_index);
 
 	/* send command to mc*/
@@ -289,10 +328,12 @@ int dpbp_get_irq_mask(struct fsl_mc_io *mc_io,
 
 	/* retrieve response parameters */
 	*mask = (uint32_t)mc_dec(cmd.params[0], 0, 32);
+
 	return 0;
 }
 
 int dpbp_get_irq_status(struct fsl_mc_io *mc_io,
+			uint32_t cmd_flags,
 			uint16_t token,
 			uint8_t irq_index,
 			uint32_t *status)
@@ -302,7 +343,9 @@ int dpbp_get_irq_status(struct fsl_mc_io *mc_io,
 
 	/* prepare command */
 	cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_IRQ_STATUS,
-					  MC_CMD_PRI_LOW, token);
+					  cmd_flags,
+					  token);
+
 	cmd.params[0] |= mc_enc(32, 8, irq_index);
 
 	/* send command to mc*/
@@ -312,10 +355,12 @@ int dpbp_get_irq_status(struct fsl_mc_io *mc_io,
 
 	/* retrieve response parameters */
 	*status = (uint32_t)mc_dec(cmd.params[0], 0, 32);
+
 	return 0;
 }
 
 int dpbp_clear_irq_status(struct fsl_mc_io *mc_io,
+			  uint32_t cmd_flags,
 			  uint16_t token,
 			  uint8_t irq_index,
 			  uint32_t status)
@@ -324,7 +369,9 @@ int dpbp_clear_irq_status(struct fsl_mc_io *mc_io,
 
 	/* prepare command */
 	cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLEAR_IRQ_STATUS,
-					  MC_CMD_PRI_LOW, token);
+					  cmd_flags,
+					  token);
+
 	cmd.params[0] |= mc_enc(0, 32, status);
 	cmd.params[0] |= mc_enc(32, 8, irq_index);
 
@@ -333,6 +380,7 @@ int dpbp_clear_irq_status(struct fsl_mc_io *mc_io,
 }
 
 int dpbp_get_attributes(struct fsl_mc_io *mc_io,
+			uint32_t cmd_flags,
 			uint16_t token,
 			struct dpbp_attr *attr)
 {
@@ -341,7 +389,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);
@@ -353,6 +402,7 @@ int dpbp_get_attributes(struct fsl_mc_io *mc_io,
 	attr->id = (int)mc_dec(cmd.params[0], 32, 32);
 	attr->version.major = (uint16_t)mc_dec(cmd.params[1], 0, 16);
 	attr->version.minor = (uint16_t)mc_dec(cmd.params[1], 16, 16);
+
 	return 0;
 }
 EXPORT_SYMBOL(dpbp_get_attributes);
drivers/staging/fsl-mc/include/dpbp-cmd.h +1 -1
index 1fd70a21..efa9bf3 100644
@@ -34,7 +34,7 @@
 
 /* DPBP Version */
 #define DPBP_VER_MAJOR				2
-#define DPBP_VER_MINOR				0
+#define DPBP_VER_MINOR				1
 
 /* Command IDs */
 #define DPBP_CMDID_CLOSE				0x800
drivers/staging/fsl-mc/include/dpbp.h +68 -23

278 lines not on this page · raw message

--
2.3.3

maintainer
#4 lore raw

Re: [PATCH v2 3/6] staging: fsl-mc: up-rev dpbp binary interface to v2.0

Quoted 24 lines · J. German Rivera

Add cmd_flags parameter to all dpbp APIs to comply with the dpbp 2.0 MC interface. Updated MC version major number. Pass irq args in struct instead of separate args.

---
 drivers/staging/fsl-mc/bus/dpbp.c         | 136 ++++++++++++++++++++----------
 drivers/staging/fsl-mc/include/dpbp-cmd.h |   2 +-
 drivers/staging/fsl-mc/include/dpbp.h     |  91 +++++++++++++++-----
 3 files changed, 162 insertions(+), 67 deletions(-)
drivers/staging/fsl-mc/bus/dpbp.c +3 -1
index d99ab6d..0004e65 100644
@@ -34,14 +34,19 @@
 #include "../include/dpbp.h"
 #include "../include/dpbp-cmd.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,

drivers/staging/fsl-mc/bus/dpbp.c line 48

Quoted 10 lines
drivers/staging/fsl-mc/bus/dpbp.c +3 -1
+	      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);

Why are you reformatting all of these calls when you don't have to create a new line? Seems wasteful to me, as is:

drivers/staging/fsl-mc/bus/dpbp.c line 49

Quoted 1 line
drivers/staging/fsl-mc/bus/dpbp.c +1 -0
+

That empty line, why?

thanks,

greg k-h

#5 lore raw

PATCH v2 4/6 staging: fsl-mc: up-rev dpmcp binary interface to v2.0

In reply to J. German Rivera

Add cmd_flags parameter to all dpbp APIs to comply with the dpmcp 2.0 MC interface. Updated version major number. Pass irq args in struct instead of separate args.

---
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h    |   2 +-
 drivers/staging/fsl-mc/bus/dpmcp.c        | 123 ++++++++++++++++++------------
 drivers/staging/fsl-mc/bus/dpmcp.h        | 123 +++++++++++++++++++-----------
 drivers/staging/fsl-mc/bus/mc-allocator.c |   6 +-
 4 files changed, 157 insertions(+), 97 deletions(-)
drivers/staging/fsl-mc/bus/dpmcp-cmd.h +1 -1
index 57f326b..6cc0fed 100644
@@ -34,7 +34,7 @@
 
 /* DPMCP Version */
 #define DPMCP_VER_MAJOR				2
-#define DPMCP_VER_MINOR				0
+#define DPMCP_VER_MINOR				1
 
 /* Command IDs */
 #define DPMCP_CMDID_CLOSE				0x800
drivers/staging/fsl-mc/bus/dpmcp.c +76 -47

298 lines not on this page · raw message

drivers/staging/fsl-mc/bus/dpmcp.h +77 -46

286 lines not on this page · raw message

drivers/staging/fsl-mc/bus/mc-allocator.c +3 -3
index e36235d..376ce80 100644
@@ -373,19 +373,19 @@ int fsl_mc_portal_reset(struct fsl_mc_io *mc_io)
 	if (WARN_ON(!mc_dev))
 		return -EINVAL;
 
-	error = dpmcp_open(mc_io, mc_dev->obj_desc.id, &token);
+	error = dpmcp_open(mc_io, 0, mc_dev->obj_desc.id, &token);
 	if (error < 0) {
 		dev_err(&mc_dev->dev, "dpmcp_open() failed: %d\n", error);
 		return error;
 	}
 
-	error = dpmcp_reset(mc_io, token);
+	error = dpmcp_reset(mc_io, 0, token);
 	if (error < 0) {
 		dev_err(&mc_dev->dev, "dpmcp_reset() failed: %d\n", error);
 		return error;
 	}
 
-	error = dpmcp_close(mc_io, token);
+	error = dpmcp_close(mc_io, 0, token);
 	if (error < 0) {
 		dev_err(&mc_dev->dev, "dpmcp_close() failed: %d\n", error);
 		return error;

--
2.3.3

#6 lore raw

PATCH v2 5/6 staging: fsl-mc: up-rev dpcon binary interface to v2.0

In reply to J. German Rivera

dpcon object minor version number updated to match latest MC firmware. This change is needed because the dpcon object binds to the allocator and the current driver match logic uses object version numbers.

---
 drivers/staging/fsl-mc/include/dpcon-cmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fsl-mc/include/dpcon-cmd.h +1 -1
index c878d33..2617024 100644
@@ -34,7 +34,7 @@
 
 /* DPCON Version */
 #define DPCON_VER_MAJOR				2
-#define DPCON_VER_MINOR				0
+#define DPCON_VER_MINOR				1
 
 /* Command IDs */
 #define DPCON_CMDID_CLOSE				0x800

--
2.3.3

#7 lore raw

PATCH v2 6/6 staging: fsl-mc: up-rev dprc binary interface to v4.0

In reply to J. German Rivera

Add cmd_flags parameter to all dprc APIs to comply with the dprc 4.0 MC interface. Updated MC version major number. Pass irq args in struct instead of separate args.

dprc 4.0 uses MC-relative offsets to specify object regions, instead of physical addresses. So, translate_mc_addr() and struct fsl_mc_addr_translation_range need to be updated accordingly.

Update commands for 4.0: add new commands 'set/get obj irq', 'set obj label', 'get obj descriptor'. Remove 'get portal paddr'.

---
 drivers/staging/fsl-mc/bus/dprc-cmd.h       |   7 +-
 drivers/staging/fsl-mc/bus/dprc-driver.c    |   8 +-
 drivers/staging/fsl-mc/bus/dprc.c           | 464 +++++++++++++++++++++++-----
 drivers/staging/fsl-mc/bus/mc-bus.c         |  50 ++-
 drivers/staging/fsl-mc/include/dprc.h       | 313 +++++++++++++++----
 drivers/staging/fsl-mc/include/mc-private.h |  15 +-
 6 files changed, 688 insertions(+), 169 deletions(-)
drivers/staging/fsl-mc/bus/dprc-cmd.h +5 -2
index 0920248..6552c20 100644
@@ -41,7 +41,7 @@
 #define _FSL_DPRC_CMD_H
 
 /* DPRC Version */
-#define DPRC_VER_MAJOR				3
+#define DPRC_VER_MAJOR				4
 #define DPRC_VER_MINOR				0
 
 /* Command IDs */
@@ -72,12 +72,15 @@
 #define DPRC_CMDID_GET_RES_COUNT		0x15B
 #define DPRC_CMDID_GET_RES_IDS			0x15C
 #define DPRC_CMDID_GET_OBJ_REG			0x15E
+#define DPRC_CMDID_SET_OBJ_IRQ			0x15F
+#define DPRC_CMDID_GET_OBJ_IRQ			0x160
+#define DPRC_CMDID_SET_OBJ_LABEL		0x161
+#define DPRC_CMDID_GET_OBJ_DESC			0x162
 
 #define DPRC_CMDID_CONNECT			0x167
 #define DPRC_CMDID_DISCONNECT			0x168
 #define DPRC_CMDID_GET_POOL			0x169
 #define DPRC_CMDID_GET_POOL_COUNT		0x16A
-#define DPRC_CMDID_GET_PORTAL_PADDR		0x16B
 
 #define DPRC_CMDID_GET_CONNECTION		0x16C
 
drivers/staging/fsl-mc/bus/dprc-driver.c +5 -3
index 35c06cf..7faf23b4 100644
@@ -262,6 +262,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev)
 	struct dprc_obj_desc *child_obj_desc_array = NULL;
 
 	error = dprc_get_obj_count(mc_bus_dev->mc_io,
+				   0,
 				   mc_bus_dev->mc_handle,
 				   &num_child_objects);
 	if (error < 0) {
@@ -289,6 +290,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev)
 			    &child_obj_desc_array[i];
 
 			error = dprc_get_obj(mc_bus_dev->mc_io,
+					     0,
 					     mc_bus_dev->mc_handle,
 					     i, obj_desc);
 			if (error < 0) {
@@ -399,7 +401,7 @@ static int dprc_probe(struct fsl_mc_device *mc_dev)
 			return error;
 	}
 
-	error = dprc_open(mc_dev->mc_io, mc_dev->obj_desc.id,
+	error = dprc_open(mc_dev->mc_io, 0, mc_dev->obj_desc.id,
 			  &mc_dev->mc_handle);
 	if (error < 0) {
 		dev_err(&mc_dev->dev, "dprc_open() failed: %d\n", error);
@@ -419,7 +421,7 @@ static int dprc_probe(struct fsl_mc_device *mc_dev)
 	return 0;
 
 error_cleanup_open:
-	(void)dprc_close(mc_dev->mc_io, mc_dev->mc_handle);
+	(void)dprc_close(mc_dev->mc_io, 0, mc_dev->mc_handle);
 
 error_cleanup_mc_io:
 	fsl_destroy_mc_io(mc_dev->mc_io);
@@ -447,7 +449,7 @@ static int dprc_remove(struct fsl_mc_device *mc_dev)
 
 	device_for_each_child(&mc_dev->dev, NULL, __fsl_mc_device_remove);
 	dprc_cleanup_all_resource_pools(mc_dev);
-	error = dprc_close(mc_dev->mc_io, mc_dev->mc_handle);
+	error = dprc_close(mc_dev->mc_io, 0, mc_dev->mc_handle);
 	if (error < 0)
 		dev_err(&mc_dev->dev, "dprc_close() failed: %d\n", error);
 
drivers/staging/fsl-mc/bus/dprc.c +383 -81

887 lines not on this page · raw message

drivers/staging/fsl-mc/bus/mc-bus.c +36 -14

115 lines not on this page · raw message

drivers/staging/fsl-mc/include/dprc.h +250 -63

724 lines not on this page · raw message

drivers/staging/fsl-mc/include/mc-private.h +9 -6
index c045f49..8aef55c 100644
@@ -29,7 +29,8 @@
 /**
  * struct fsl_mc - Private data of a "fsl,qoriq-mc" platform device
  * @root_mc_bus_dev: MC object device representing the root DPRC
- * @addr_translation_ranges: array of bus to system address translation ranges
+ * @num_translation_ranges: number of entries in addr_translation_ranges
+ * @translation_ranges: array of bus to system address translation ranges
  */
 struct fsl_mc {
 	struct fsl_mc_device *root_mc_bus_dev;
@@ -40,14 +41,16 @@ struct fsl_mc {
 /**
  * struct fsl_mc_addr_translation_range - bus to system address translation
  * range
- * @start_mc_addr: Start MC address of the range being translated
- * @end_mc_addr: MC address of the first byte after the range (last MC
- * address of the range is end_mc_addr - 1)
+ * @mc_region_type: Type of MC region for the range being translated
+ * @start_mc_offset: Start MC offset of the range being translated
+ * @end_mc_offset: MC offset of the first byte after the range (last MC
+ * offset of the range is end_mc_offset - 1)
  * @start_phys_addr: system physical address corresponding to start_mc_addr
  */
 struct fsl_mc_addr_translation_range {
-	uint64_t start_mc_addr;
-	uint64_t end_mc_addr;
+	enum dprc_region_type mc_region_type;
+	uint64_t start_mc_offset;
+	uint64_t end_mc_offset;
 	phys_addr_t start_phys_addr;
 };
 

--
2.3.3

#8 lore raw

Re: [PATCH v2 6/6] staging: fsl-mc: up-rev dprc binary interface to v4.0

Quoted 11 lines · J. German Rivera

/**
+ * dprc_set_obj_label() - Set object label.
+ * @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
+ * @obj_type: Object's type
+ * @obj_id: Object's ID
+ * @label: The required label. The maximum length is 16 chars.
+ *
+ * Return: '0' on Success; Error code otherwise.
+ */

drivers/staging/fsl-mc/include/dprc.h int dprc_get_obj_region(struct fsl_mc_io *mc_io, · line 901

Quoted 6 lines
drivers/staging/fsl-mc/include/dprc.h +6 -0
+int dprc_set_obj_label(struct fsl_mc_io	*mc_io,
+		       uint32_t		cmd_flags,
+		       uint16_t		token,
+		       char		*obj_type,
+		       int		obj_id,
+		       char		*label);

You can fix it in a later patch, but this documentation belongs in the .c file instead of the .h file.

regards,
dan carpenter

#9 lore raw

RE: [PATCH v2 6/6] staging: fsl-mc: up-rev dprc binary interface to v4.0

Quoted 27 lines

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Wednesday, September 23, 2015 4:27 AM
To: Rivera Jose-B46482
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Yoder Stuart- B08248; katz Itai-RM05202; Li Yang-Leo-R58472; Wood Scott-B07421; [email protected]; Hamciuc Bogdan-BHAMCIU1; Marginean Alexandru-R89243; Sharma Bhupesh-B45370; Erez Nir-RM30794; Schmitt Richard-B43082
Subject: Re: [PATCH v2 6/6] staging: fsl-mc: up-rev dprc binary interface to v4.0

Quoted 12 lines · J. German Rivera

/**
+ * dprc_set_obj_label() - Set object label.
+ * @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
+ * @obj_type: Object's type
+ * @obj_id: Object's ID
+ * @label: The required label. The maximum length is 16 chars.
+ *
+ * Return: '0' on Success; Error code otherwise.
+ */
+int dprc_set_obj_label(struct fsl_mc_io *mc_io,

Quoted 9 lines

drivers/staging/fsl-mc/include/dprc.h int dprc_get_obj_region(struct fsl_mc_io *mc_io, · line 901

Quoted 5 lines
drivers/staging/fsl-mc/include/dprc.h +5 -0
+		       uint32_t		cmd_flags,
+		       uint16_t		token,
+		       char		*obj_type,
+		       int		obj_id,
+		       char		*label);

You can fix it in a later patch, but this documentation belongs in the .c file instead of the .h file.

Thanks Dan. We will submit a patch for this.

Quoted 2 lines

regards,
dan carpenter