DPDK patches and discussions
 help / color / mirror / Atom feed
From: Soumyadeep Hore <soumyadeep.hore@intel.com>
To: bruce.richardson@intel.com, aman.deep.singh@intel.com
Cc: dev@dpdk.org, shaiq.wani@intel.com, Jun Zhang <xuejun.zhang@intel.com>
Subject: [PATCH v1 3/9] common/iavf: add GNSS support over VF
Date: Tue, 10 Sep 2024 10:12:18 +0000	[thread overview]
Message-ID: <20240910101224.497044-4-soumyadeep.hore@intel.com> (raw)
In-Reply-To: <20240910101224.497044-1-soumyadeep.hore@intel.com>

From: Jun Zhang <xuejun.zhang@intel.com>

This patch enables VF access to GNSS Console I2C.

Most of the opcodes in this implementation map directly to the
AQ commands for GNSS Console I2C Read and Write for GNSS status,
configuration, and NMEA messages.

Additionally there is VF and PF negotiation on GNSS Access
Capability through Extended PTP Capability Exchange. VF can
access GNSS Console I2C only if Extended PTP Capability
exchange indicates so.

Signed-off-by: Jun Zhang <xuejun.zhang@intel.com>
Signed-off-by: Soumyadeep Hore <soumyadeep.hore@intel.com>
---
 drivers/common/iavf/virtchnl.h | 66 ++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h
index 5ce9166cb0..a4f3d7724f 100644
--- a/drivers/common/iavf/virtchnl.h
+++ b/drivers/common/iavf/virtchnl.h
@@ -187,6 +187,8 @@ enum virtchnl_ops {
 	VIRTCHNL_OP_SYNCE_SET_CGU_DPLL_CONFIG = 126,
 	VIRTCHNL_OP_SYNCE_GET_CGU_INFO = 127,
 	VIRTCHNL_OP_SYNCE_GET_HW_INFO = 128,
+	VIRTCHNL_OP_GNSS_READ_I2C = 129,
+	VIRTCHNL_OP_GNSS_WRITE_I2C = 130,
 	VIRTCHNL_OP_MAX,
 };
 
@@ -335,6 +337,10 @@ static inline const char *virtchnl_op_str(enum virtchnl_ops v_opcode)
 		return "VIRTCHNL_OP_SYNCE_GET_CGU_INFO";
 	case VIRTCHNL_OP_SYNCE_GET_HW_INFO:
 		return "VIRTCHNL_OP_SYNCE_GET_HW_INFO";
+	case VIRTCHNL_OP_GNSS_READ_I2C:
+		return "VIRTCHNL_OP_GNSS_READ_I2C";
+	case VIRTCHNL_OP_GNSS_WRITE_I2C:
+		return "VIRTCHNL_OP_GNSS_WRITE_I2C";
 	case VIRTCHNL_OP_FLOW_SUBSCRIBE:
 		return "VIRTCHNL_OP_FLOW_SUBSCRIBE";
 	case VIRTCHNL_OP_FLOW_UNSUBSCRIBE:
@@ -2182,6 +2188,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_quanta_cfg);
 #define VIRTCHNL_1588_PTP_CAP_WRITE_PHC		BIT(3)
 #define VIRTCHNL_1588_PTP_CAP_PHC_REGS		BIT(4)
 #define VIRTCHNL_1588_PTP_CAP_SYNCE			BIT(6)
+#define VIRTCHNL_1588_PTP_CAP_GNSS			BIT(7)
 
 struct virtchnl_phc_regs {
 	u32 clock_hi;
@@ -2448,6 +2455,59 @@ struct virtchnl_synce_get_hw_info {
 
 VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_synce_get_hw_info);
 
+struct virtchnl_link_topo_params {
+	u8 lport_num;
+	u8 lport_num_valid;
+	u8 node_type_ctx;
+#define VIRTCHNL_LINK_TOPO_NODE_TYPE_GPS	11
+#define VIRTCHNL_LINK_TOPO_NODE_CTX_S		4
+#define VIRTCHNL_LINK_TOPO_NODE_CTX_M		\
+				(0xF << VIRTCHNL_LINK_TOPO_NODE_CTX_S)
+#define VIRTCHNL_LINK_TOPO_NODE_CTX_GLOBAL	0
+#define VIRTCHNL_LINK_TOPO_NODE_CTX_BOARD	1
+#define VIRTCHNL_LINK_TOPO_NODE_CTX_PORT	2
+#define VIRTCHNL_LINK_TOPO_NODE_CTX_NODE	3
+#define VIRTCHNL_LINK_TOPO_NODE_CTX_PROVIDED	4
+#define VIRTCHNL_LINK_TOPO_NODE_CTX_OVERRIDE	5
+	u8 index;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(4, virtchnl_link_topo_params);
+
+struct virtchnl_link_topo_addr {
+	struct virtchnl_link_topo_params topo_params;
+	u16  handle;
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_link_topo_addr);
+
+struct virtchnl_gnss_i2c {
+	struct virtchnl_link_topo_addr topo_addr;
+	u16 i2c_addr;
+	u8 i2c_params;
+#define VIRTCHNL_I2C_DATA_SIZE_S	0
+#define VIRTCHNL_I2C_DATA_SIZE_M	(0xF << VIRTCHNL_I2C_DATA_SIZE_S)
+#define VIRTCHNL_I2C_ADDR_TYPE_M	BIT(4)
+#define VIRTCHNL_I2C_ADDR_TYPE_7BIT	0
+#define VIRTCHNL_I2C_ADDR_TYPE_10BIT	VIRTCHNL_I2C_ADDR_TYPE_M
+#define VIRTCHNL_I2C_DATA_OFFSET_S	5
+#define VIRTCHNL_I2C_DATA_OFFSET_M	(0x3 << VIRTCHNL_I2C_DATA_OFFSET_S)
+#define VIRTCHNL_I2C_USE_REPEATED_START	BIT(7)
+	u8 rsvd;
+	u16 i2c_bus_addr;
+#define VIRTCHNL_I2C_ADDR_7BIT_MASK	0x7F
+#define VIRTCHNL_I2C_ADDR_10BIT_MASK	0x3FF
+	u8 i2c_data[4]; /* Used only by write command, reserved in read. */
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_gnss_i2c);
+
+struct virtchnl_gnss_read_i2c_resp {
+	u8 i2c_data[16];
+};
+
+VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_gnss_read_i2c_resp);
+
 /* Since VF messages are limited by u16 size, precalculate the maximum possible
  * values of nested elements in virtchnl structures that virtual channel can
  * possibly handle in a single message.
@@ -2825,6 +2885,12 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
 		break;
 	case VIRTCHNL_OP_SYNCE_GET_HW_INFO:
 		break;
+	case VIRTCHNL_OP_GNSS_READ_I2C:
+		valid_len = sizeof(struct virtchnl_gnss_i2c);
+		break;
+	case VIRTCHNL_OP_GNSS_WRITE_I2C:
+		valid_len = sizeof(struct virtchnl_gnss_i2c);
+		break;
 	case VIRTCHNL_OP_ENABLE_QUEUES_V2:
 	case VIRTCHNL_OP_DISABLE_QUEUES_V2:
 		valid_len = sizeof(struct virtchnl_del_ena_dis_queues);
-- 
2.34.1


  parent reply	other threads:[~2024-09-10 11:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-10 10:12 [PATCH v1 0/9] Update IAVF Base Driver Soumyadeep Hore
2024-09-10 10:12 ` [PATCH v1 1/9] common/iavf: update the PTP enablement in virtchnl Soumyadeep Hore
2024-09-10 10:12 ` [PATCH v1 2/9] common/iavf: add SyncE support over VF Soumyadeep Hore
2024-09-10 10:12 ` Soumyadeep Hore [this message]
2024-09-10 10:12 ` [PATCH v1 4/9] common/iavf: define the maximum MSIX index Soumyadeep Hore
2024-09-10 10:12 ` [PATCH v1 5/9] common/iavf: add commands for HQOS management Soumyadeep Hore
2024-09-10 10:12 ` [PATCH v1 6/9] common/iavf: add flex descriptor fields enum Soumyadeep Hore
2024-09-10 10:12 ` [PATCH v1 7/9] common/iavf: add RefSync support Soumyadeep Hore
2024-09-10 10:12 ` [PATCH v1 8/9] common/iavf: introduce QGRP capabilities to replace ADQ caps Soumyadeep Hore
2024-09-10 10:12 ` [PATCH v1 9/9] common/iavf: add RSS CONFIG hash function Soumyadeep Hore
2024-09-16 14:29 ` [PATCH v1 0/9] Update IAVF Base Driver Bruce Richardson
2024-09-17 14:24   ` Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240910101224.497044-4-soumyadeep.hore@intel.com \
    --to=soumyadeep.hore@intel.com \
    --cc=aman.deep.singh@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=shaiq.wani@intel.com \
    --cc=xuejun.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).