Skip to contentSkip to conversation

net: wwan: t7xx: Add AP CLDMA and GNSS port

PATCH Superseded Moises Veleta 5 participants 12 messages Jun 14, 2022 – Jun 22, 2022

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: wwan: t7xx: Add AP CLDMA and GNSS port

From: Haijun Liu <[email protected]>

The t7xx device contains two Cross Layer DMA (CLDMA) interfaces to communicate with AP and Modem processors respectively. So far only MD-CLDMA was being used, this patch enables AP-CLDMA and the GNSS port which requires such channel.

---
 drivers/net/wwan/t7xx/t7xx_hif_cldma.c     | 17 +++--
 drivers/net/wwan/t7xx/t7xx_hif_cldma.h     |  2 +-
 drivers/net/wwan/t7xx/t7xx_mhccif.h        |  1 +
 drivers/net/wwan/t7xx/t7xx_modem_ops.c     | 85 ++++++++++++++++++----
 drivers/net/wwan/t7xx/t7xx_modem_ops.h     |  3 +
 drivers/net/wwan/t7xx/t7xx_port.h          | 10 ++-
 drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c |  8 +-
 drivers/net/wwan/t7xx/t7xx_port_proxy.c    | 21 ++++++
 drivers/net/wwan/t7xx/t7xx_reg.h           |  2 +-
 drivers/net/wwan/t7xx/t7xx_state_monitor.c | 13 +++-
 drivers/net/wwan/t7xx/t7xx_state_monitor.h |  2 +
 11 files changed, 136 insertions(+), 28 deletions(-)
drivers/net/wwan/t7xx/t7xx_hif_cldma.c +11 -6
index 6ff30cb8eb16..37cd63d20b45 100644
@@ -1064,13 +1064,18 @@ static void t7xx_hw_info_init(struct cldma_ctrl *md_ctrl)
 	struct t7xx_cldma_hw *hw_info = &md_ctrl->hw_info;
 	u32 phy_ao_base, phy_pd_base;
 
-	if (md_ctrl->hif_id != CLDMA_ID_MD)
-		return;
-
-	phy_ao_base = CLDMA1_AO_BASE;
-	phy_pd_base = CLDMA1_PD_BASE;
-	hw_info->phy_interrupt_id = CLDMA1_INT;
 	hw_info->hw_mode = MODE_BIT_64;
+
+	if (md_ctrl->hif_id == CLDMA_ID_MD) {
+		phy_ao_base = CLDMA1_AO_BASE;
+		phy_pd_base = CLDMA1_PD_BASE;
+		hw_info->phy_interrupt_id = CLDMA1_INT;
+	} else {
+		phy_ao_base = CLDMA0_AO_BASE;
+		phy_pd_base = CLDMA0_PD_BASE;
+		hw_info->phy_interrupt_id = CLDMA0_INT;
+	}
+
 	hw_info->ap_ao_base = t7xx_pcie_addr_transfer(pbase->pcie_ext_reg_base,
 						      pbase->pcie_dev_reg_trsl_addr, phy_ao_base);
 	hw_info->ap_pdn_base = t7xx_pcie_addr_transfer(pbase->pcie_ext_reg_base,
drivers/net/wwan/t7xx/t7xx_hif_cldma.h +1 -1
index 47a35e552da7..4410bac6993a 100644
@@ -34,7 +34,7 @@
 /**
  * enum cldma_id - Identifiers for CLDMA HW units.
  * @CLDMA_ID_MD: Modem control channel.
- * @CLDMA_ID_AP: Application Processor control channel (not used at the moment).
+ * @CLDMA_ID_AP: Application Processor control channel.
  * @CLDMA_NUM:   Number of CLDMA HW units available.
  */
 enum cldma_id {
drivers/net/wwan/t7xx/t7xx_mhccif.h +1 -0
index 209b386bc088..20c50dce9fc3 100644
@@ -25,6 +25,7 @@
 			 D2H_INT_EXCEPTION_CLEARQ_DONE |	\
 			 D2H_INT_EXCEPTION_ALLQ_RESET |		\
 			 D2H_INT_PORT_ENUM |			\
+			 D2H_INT_ASYNC_AP_HK |			\
 			 D2H_INT_ASYNC_MD_HK)
 
 void t7xx_mhccif_mask_set(struct t7xx_pci_dev *t7xx_dev, u32 val);
drivers/net/wwan/t7xx/t7xx_modem_ops.c +70 -15

192 lines not on this page · raw message

drivers/net/wwan/t7xx/t7xx_modem_ops.h +3 -0
index 7469ed636ae8..c93e870ce696 100644
@@ -66,10 +66,13 @@ struct t7xx_modem {
 	struct cldma_ctrl		*md_ctrl[CLDMA_NUM];
 	struct t7xx_pci_dev		*t7xx_dev;
 	struct t7xx_sys_info		core_md;
+	struct t7xx_sys_info		core_ap;
 	bool				md_init_finish;
 	bool				rgu_irq_asserted;
 	struct workqueue_struct		*handshake_wq;
 	struct work_struct		handshake_work;
+	struct workqueue_struct		*ap_handshake_wq;
+	struct work_struct		ap_handshake_work;
 	struct t7xx_fsm_ctl		*fsm_ctl;
 	struct port_proxy		*port_prox;
 	unsigned int			exp_id;
drivers/net/wwan/t7xx/t7xx_port.h +9 -1
index dc4133eb433a..3d27f04e2a1f 100644
@@ -36,9 +36,17 @@
 /* Channel ID and Message ID definitions.
  * The channel number consists of peer_id(15:12) , channel_id(11:0)
  * peer_id:
- * 0:reserved, 1: to sAP, 2: to MD
+ * 0:reserved, 1: to AP, 2: to MD
  */
 enum port_ch {
+	/* to AP */
+	PORT_CH_AP_CONTROL_RX = 0X1000,
+	PORT_CH_AP_CONTROL_TX = 0X1001,
+	PORT_CH_AP_GNSS_RX = 0x1004,
+	PORT_CH_AP_GNSS_TX = 0x1005,
+	PORT_CH_AP_LOG_RX = 0x1008,
+	PORT_CH_AP_LOG_TX = 0x1009,
+
 	/* to MD */
 	PORT_CH_CONTROL_RX = 0x2000,
 	PORT_CH_CONTROL_TX = 0x2001,
drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c +6 -2
index 68430b130a67..ae632ef96698 100644
@@ -167,8 +167,12 @@ static int control_msg_handler(struct t7xx_port *port, struct sk_buff *skb)
 	case CTL_ID_HS2_MSG:
 		skb_pull(skb, sizeof(*ctrl_msg_h));
 
-		if (port_conf->rx_ch == PORT_CH_CONTROL_RX) {
-			ret = t7xx_fsm_append_event(ctl, FSM_EVENT_MD_HS2, skb->data,
+		if (port_conf->rx_ch == PORT_CH_CONTROL_RX ||
+		    port_conf->rx_ch == PORT_CH_AP_CONTROL_RX) {
+			int event = port_conf->rx_ch == PORT_CH_CONTROL_RX ?
+				    FSM_EVENT_MD_HS2 : FSM_EVENT_AP_HS2;
+
+			ret = t7xx_fsm_append_event(ctl, event, skb->data,
 						    le32_to_cpu(ctrl_msg_h->data_length));
 			if (ret)
 				dev_err(port->dev, "Failed to append Handshake 2 event");
drivers/net/wwan/t7xx/t7xx_port_proxy.c +21 -0
index d4de047ff0d4..ef18bcfb649b 100644
@@ -50,6 +50,15 @@
 
 static const struct t7xx_port_conf t7xx_md_port_conf[] = {
 	{
+		.tx_ch = PORT_CH_AP_GNSS_TX,
+		.rx_ch = PORT_CH_AP_GNSS_RX,
+		.txq_index = Q_IDX_CTRL,
+		.rxq_index = Q_IDX_CTRL,
+		.path_id = CLDMA_ID_AP,
+		.ops = &wwan_sub_port_ops,
+		.name = "t7xx_ap_gnss",
+		.port_type = WWAN_PORT_AT,
+	}, {
 		.tx_ch = PORT_CH_UART2_TX,
 		.rx_ch = PORT_CH_UART2_RX,
 		.txq_index = Q_IDX_AT_CMD,
@@ -77,6 +86,14 @@ static const struct t7xx_port_conf t7xx_md_port_conf[] = {
 		.path_id = CLDMA_ID_MD,
 		.ops = &ctl_port_ops,
 		.name = "t7xx_ctrl",
+	}, {
+		.tx_ch = PORT_CH_AP_CONTROL_TX,
+		.rx_ch = PORT_CH_AP_CONTROL_RX,
+		.txq_index = Q_IDX_CTRL,
+		.rxq_index = Q_IDX_CTRL,
+		.path_id = CLDMA_ID_AP,
+		.ops = &ctl_port_ops,
+		.name = "t7xx_ap_ctrl",
 	},
 };
 
@@ -416,6 +433,9 @@ static void t7xx_proxy_init_all_ports(struct t7xx_modem *md)
 		if (port_conf->tx_ch == PORT_CH_CONTROL_TX)
 			md->core_md.ctl_port = port;
 
+		if (port_conf->tx_ch == PORT_CH_AP_CONTROL_TX)
+			md->core_ap.ctl_port = port;
+
 		port->t7xx_dev = md->t7xx_dev;
 		port->dev = &md->t7xx_dev->pdev->dev;
 		spin_lock_init(&port->port_update_lock);
@@ -469,6 +489,7 @@ int t7xx_port_proxy_init(struct t7xx_modem *md)
 	if (ret)
 		return ret;
 
+	t7xx_cldma_set_recv_skb(md->md_ctrl[CLDMA_ID_AP], t7xx_port_proxy_recv_skb);
 	t7xx_cldma_set_recv_skb(md->md_ctrl[CLDMA_ID_MD], t7xx_port_proxy_recv_skb);
 	return 0;
 }
drivers/net/wwan/t7xx/t7xx_reg.h +1 -1
index 7c1b81091a0f..c41d7d094c08 100644
@@ -56,7 +56,7 @@
 #define D2H_INT_RESUME_ACK			BIT(12)
 #define D2H_INT_SUSPEND_ACK_AP			BIT(13)
 #define D2H_INT_RESUME_ACK_AP			BIT(14)
-#define D2H_INT_ASYNC_SAP_HK			BIT(15)
+#define D2H_INT_ASYNC_AP_HK			BIT(15)
 #define D2H_INT_ASYNC_MD_HK			BIT(16)
 
 /* Register base */
drivers/net/wwan/t7xx/t7xx_state_monitor.c +11 -2
index 0bcca08ff2bd..80edb8e75a6a 100644
@@ -285,8 +285,9 @@ static int fsm_routine_starting(struct t7xx_fsm_ctl *ctl)
 	t7xx_fsm_broadcast_state(ctl, MD_STATE_WAITING_FOR_HS1);
 	t7xx_md_event_notify(md, FSM_START);
 
-	wait_event_interruptible_timeout(ctl->async_hk_wq, md->core_md.ready || ctl->exp_flg,
-					 HZ * 60);
+	wait_event_interruptible_timeout(ctl->async_hk_wq,
+					 (md->core_md.ready && md->core_ap.ready) ||
+					  ctl->exp_flg, HZ * 60);
 	dev = &md->t7xx_dev->pdev->dev;
 
 	if (ctl->exp_flg)
@@ -297,6 +298,13 @@ static int fsm_routine_starting(struct t7xx_fsm_ctl *ctl)
 		if (md->core_md.handshake_ongoing)
 			t7xx_fsm_append_event(ctl, FSM_EVENT_MD_HS2_EXIT, NULL, 0);
 
+		fsm_routine_exception(ctl, NULL, EXCEPTION_HS_TIMEOUT);
+		return -ETIMEDOUT;
+	} else if (!md->core_ap.ready) {
+		dev_err(dev, "AP handshake timeout\n");
+		if (md->core_ap.handshake_ongoing)
+			t7xx_fsm_append_event(ctl, FSM_EVENT_AP_HS2_EXIT, NULL, 0);
+
 		fsm_routine_exception(ctl, NULL, EXCEPTION_HS_TIMEOUT);
 		return -ETIMEDOUT;
 	}
@@ -335,6 +343,7 @@ static void fsm_routine_start(struct t7xx_fsm_ctl *ctl, struct t7xx_fsm_command
 		return;
 	}
 
+	t7xx_cldma_hif_hw_init(md->md_ctrl[CLDMA_ID_AP]);
 	t7xx_cldma_hif_hw_init(md->md_ctrl[CLDMA_ID_MD]);
 	fsm_finish_command(ctl, cmd, fsm_routine_starting(ctl));
 }
drivers/net/wwan/t7xx/t7xx_state_monitor.h +2 -0
index b1af0259d4c5..b6e76f3903c8 100644
@@ -38,10 +38,12 @@ enum t7xx_fsm_state {
 enum t7xx_fsm_event_state {
 	FSM_EVENT_INVALID,
 	FSM_EVENT_MD_HS2,
+	FSM_EVENT_AP_HS2,
 	FSM_EVENT_MD_EX,
 	FSM_EVENT_MD_EX_REC_OK,
 	FSM_EVENT_MD_EX_PASS,
 	FSM_EVENT_MD_HS2_EXIT,
+	FSM_EVENT_AP_HS2_EXIT,
 	FSM_EVENT_MAX
 };
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 6 lines · Moises Veleta

From: Haijun Liu <[email protected]>

The t7xx device contains two Cross Layer DMA (CLDMA) interfaces to communicate with AP and Modem processors respectively. So far only MD-CLDMA was being used, this patch enables AP-CLDMA and the GNSS port which requires such channel.

This doesn't explain the sAP -> AP renaming in a several cases. If that renaming is needed, it perhaps requires a separate patch or at least a good paragraph to explain why.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 11 lines · Andy Shevchenko
Quoted 6 lines · Moises Veleta

From: Haijun Liu <[email protected]>

The t7xx device contains two Cross Layer DMA (CLDMA) interfaces to communicate with AP and Modem processors respectively. So far only MD-CLDMA was being used, this patch enables AP-CLDMA and the GNSS port which requires such channel.

This doesn't explain the sAP -> AP renaming in a several cases. If that renaming is needed, it perhaps requires a separate patch or at least a good paragraph to explain why.

The renaming was done since sAP (small Application Processor) represents Application Processor succinctly. The word "small" only adds unnecessary word that would confuse readers if we kept both "sAP" and "AP". I will add that information as an additional paragraph.

Reviewed-by on v1 1/1
#3 lore raw
In reply to Moises Veleta
Quoted 7 lines · Moises Veleta

From: Haijun Liu <[email protected]>

The t7xx device contains two Cross Layer DMA (CLDMA) interfaces to communicate with AP and Modem processors respectively. So far only MD-CLDMA was being used, this patch enables AP-CLDMA and the GNSS port which requires such channel.

Quoted 5 lines

---

Look fine to me. One nit below.

Quoted 5 lines
drivers/net/wwan/t7xx/t7xx_port.h +0 -0
index dc4133eb433a..3d27f04e2a1f 100644

drivers/net/wwan/t7xx/t7xx_port.h line 44

Quoted 10 lines
drivers/net/wwan/t7xx/t7xx_port.h +4 -1
@@ -36,9 +36,17 @@
 /* Channel ID and Message ID definitions.
  * The channel number consists of peer_id(15:12) , channel_id(11:0)
  * peer_id:
- * 0:reserved, 1: to sAP, 2: to MD
+ * 0:reserved, 1: to AP, 2: to MD
  */
 enum port_ch {
+	/* to AP */
+	PORT_CH_AP_CONTROL_RX = 0X1000,
+	PORT_CH_AP_CONTROL_TX = 0X1001,

Please use lowercase x.

Signature · 1 line
 i.
#4 lore raw
Quoted 18 lines · Ilpo Järvinen
Quoted 7 lines · Moises Veleta

From: Haijun Liu <[email protected]>

The t7xx device contains two Cross Layer DMA (CLDMA) interfaces to communicate with AP and Modem processors respectively. So far only MD-CLDMA was being used, this patch enables AP-CLDMA and the GNSS port which requires such channel.

Quoted 5 lines

---

Look fine to me. One nit below.

Quoted 18 lines
Quoted 5 lines
drivers/net/wwan/t7xx/t7xx_port.h +0 -0
index dc4133eb433a..3d27f04e2a1f 100644

drivers/net/wwan/t7xx/t7xx_port.h line 44

Quoted 10 lines
drivers/net/wwan/t7xx/t7xx_port.h +4 -1
@@ -36,9 +36,17 @@
  /* Channel ID and Message ID definitions.
   * The channel number consists of peer_id(15:12) , channel_id(11:0)
   * peer_id:
- * 0:reserved, 1: to sAP, 2: to MD
+ * 0:reserved, 1: to AP, 2: to MD
   */
  enum port_ch {
+	/* to AP */
+	PORT_CH_AP_CONTROL_RX = 0X1000,
+	PORT_CH_AP_CONTROL_TX = 0X1001,

Please use lowercase x.

Will make these changes. Thanks

Regards,
Moises

#5 lore raw
In reply to Moises Veleta

Hi Moises,

Quoted 13 lines · Moises Veleta

From: Haijun Liu <[email protected]>

The t7xx device contains two Cross Layer DMA (CLDMA) interfaces to communicate with AP and Modem processors respectively. So far only MD-CLDMA was being used, this patch enables AP-CLDMA and the GNSS port which requires such channel.

---

[...]

drivers/net/wwan/t7xx/t7xx_port_proxy.c line 60

Quoted 11 lines
 static const struct t7xx_port_conf t7xx_md_port_conf[] = {
        {
drivers/net/wwan/t7xx/t7xx_port_proxy.c +8 -0
+               .tx_ch = PORT_CH_AP_GNSS_TX,
+               .rx_ch = PORT_CH_AP_GNSS_RX,
+               .txq_index = Q_IDX_CTRL,
+               .rxq_index = Q_IDX_CTRL,
+               .path_id = CLDMA_ID_AP,
+               .ops = &wwan_sub_port_ops,
+               .name = "t7xx_ap_gnss",
+               .port_type = WWAN_PORT_AT,

Is it really AT protocol here? wouldn't it be possible to expose it via the existing GNSS susbsystem?

Regards,
Looic

#6 lore raw
Quoted 27 lines · Loic Poulain

Hi Moises,

Quoted 12 lines · Moises Veleta

From: Haijun Liu <[email protected]>

The t7xx device contains two Cross Layer DMA (CLDMA) interfaces to communicate with AP and Modem processors respectively. So far only MD-CLDMA was being used, this patch enables AP-CLDMA and the GNSS port which requires such channel.

---

[...]

drivers/net/wwan/t7xx/t7xx_port_proxy.c line 60

Quoted 10 lines
  static const struct t7xx_port_conf t7xx_md_port_conf[] = {
         {
drivers/net/wwan/t7xx/t7xx_port_proxy.c +8 -0
+               .tx_ch = PORT_CH_AP_GNSS_TX,
+               .rx_ch = PORT_CH_AP_GNSS_RX,
+               .txq_index = Q_IDX_CTRL,
+               .rxq_index = Q_IDX_CTRL,
+               .path_id = CLDMA_ID_AP,
+               .ops = &wwan_sub_port_ops,
+               .name = "t7xx_ap_gnss",
+               .port_type = WWAN_PORT_AT,
Quoted 5 lines

Is it really AT protocol here? wouldn't it be possible to expose it via the existing GNSS susbsystem?

Regards,
Looic

The protocol is AT.
It is not possible to using the GNSS subsystem as it is meant for stand-alone GNSS receivers without a control path. In this case, GNSS can used for different use cases, such as Assisted GNSS, Cell ID positioning, Geofence, etc. Hence, this requires the use of the AT channel on the WWAN subsystem.

Regards,
Moises

#7 lore raw
Quoted 36 lines · moises.veleta
Quoted 27 lines · Loic Poulain

Hi Moises,

Quoted 12 lines · Moises Veleta

From: Haijun Liu <[email protected]>

The t7xx device contains two Cross Layer DMA (CLDMA) interfaces to communicate with AP and Modem processors respectively. So far only MD-CLDMA was being used, this patch enables AP-CLDMA and the GNSS port which requires such channel.

---

[...]

drivers/net/wwan/t7xx/t7xx_port_proxy.c line 60

Quoted 10 lines
  static const struct t7xx_port_conf t7xx_md_port_conf[] = {
         {
drivers/net/wwan/t7xx/t7xx_port_proxy.c +8 -0
+               .tx_ch = PORT_CH_AP_GNSS_TX,
+               .rx_ch = PORT_CH_AP_GNSS_RX,
+               .txq_index = Q_IDX_CTRL,
+               .rxq_index = Q_IDX_CTRL,
+               .path_id = CLDMA_ID_AP,
+               .ops = &wwan_sub_port_ops,
+               .name = "t7xx_ap_gnss",
+               .port_type = WWAN_PORT_AT,
Quoted 5 lines

Is it really AT protocol here? wouldn't it be possible to expose it via the existing GNSS susbsystem?

Regards,
Looic

Quoted 6 lines

The protocol is AT.
It is not possible to using the GNSS subsystem as it is meant for stand-alone GNSS receivers without a control path. In this case, GNSS can used for different use cases, such as Assisted GNSS, Cell ID positioning, Geofence, etc. Hence, this requires the use of the AT channel on the WWAN subsystem.

Ok, fair enough!

Loic

maintainer
#8 lore raw
In reply to moises.veleta

Hello Moises,

Quoted 31 lines · moises.veleta
Quoted 27 lines · Loic Poulain

Hi Moises,

Quoted 12 lines · Moises Veleta

From: Haijun Liu <[email protected]>

The t7xx device contains two Cross Layer DMA (CLDMA) interfaces to communicate with AP and Modem processors respectively. So far only MD-CLDMA was being used, this patch enables AP-CLDMA and the GNSS port which requires such channel.

---

[...]

drivers/net/wwan/t7xx/t7xx_port_proxy.c line 60

Quoted 10 lines
  static const struct t7xx_port_conf t7xx_md_port_conf[] = {
         {
drivers/net/wwan/t7xx/t7xx_port_proxy.c +8 -0
+               .tx_ch = PORT_CH_AP_GNSS_TX,
+               .rx_ch = PORT_CH_AP_GNSS_RX,
+               .txq_index = Q_IDX_CTRL,
+               .rxq_index = Q_IDX_CTRL,
+               .path_id = CLDMA_ID_AP,
+               .ops = &wwan_sub_port_ops,
+               .name = "t7xx_ap_gnss",
+               .port_type = WWAN_PORT_AT,
Quoted 2 lines

Is it really AT protocol here? wouldn't it be possible to expose it via the existing GNSS susbsystem?

Quoted 6 lines

The protocol is AT.
It is not possible to using the GNSS subsystem as it is meant for stand-alone GNSS receivers without a control path. In this case, GNSS can used for different use cases, such as Assisted GNSS, Cell ID positioning, Geofence, etc. Hence, this requires the use of the AT channel on the WWAN subsystem.

To make it clear. When you talking about a control path, did you mean that this GNSS port is not a simple NMEA port? Or did you mean that this port is NMEA, but the user is required to activate GPS functionality using the separate AT-commands port?

In other words, what is the format of the data that are transmitted over the GNSS port of the modem?

Signature · 1 line
Sergey
#9 lore raw
Quoted 40 lines · Sergey Ryazanov

Hello Moises,

Quoted 28 lines · moises.veleta
Quoted 27 lines · Loic Poulain

Hi Moises,

Quoted 12 lines · Moises Veleta

From: Haijun Liu <[email protected]>

The t7xx device contains two Cross Layer DMA (CLDMA) interfaces to communicate with AP and Modem processors respectively. So far only MD-CLDMA was being used, this patch enables AP-CLDMA and the GNSS port which requires such channel.

---

[...]

Quoted 10 lines
   static const struct t7xx_port_conf t7xx_md_port_conf[] = {
          {
drivers/net/wwan/t7xx/t7xx_port_proxy.c +8 -0
+               .tx_ch = PORT_CH_AP_GNSS_TX,
+               .rx_ch = PORT_CH_AP_GNSS_RX,
+               .txq_index = Q_IDX_CTRL,
+               .rxq_index = Q_IDX_CTRL,
+               .path_id = CLDMA_ID_AP,
+               .ops = &wwan_sub_port_ops,
+               .name = "t7xx_ap_gnss",
+               .port_type = WWAN_PORT_AT,
Quoted 8 lines
Quoted 2 lines

Is it really AT protocol here? wouldn't it be possible to expose it via the existing GNSS susbsystem?

The protocol is AT.
It is not possible to using the GNSS subsystem as it is meant for stand-alone GNSS receivers without a control path. In this case, GNSS can used for different use cases, such as Assisted GNSS, Cell ID positioning, Geofence, etc. Hence, this requires the use of the AT channel on the WWAN subsystem.

Quoted 8 lines

To make it clear. When you talking about a control path, did you mean that this GNSS port is not a simple NMEA port? Or did you mean that this port is NMEA, but the user is required to activate GPS functionality using the separate AT-commands port?

In other words, what is the format of the data that are transmitted over the GNSS port of the modem?

It is an AT port where MTK GNSS AT commands can be sent and received. Not a simple NMEA port, but NMEA data can be sent to Host via an AT command. Control port is exposed for Modem Manager to send GNSS comands, which may include disable/enable GPS functionality (enabled by default).

These are MTK GNSS AT commands, which follow the syntax as defined by 3GPP TS 27.007.  These are not standard AT commands.

Regards,
Moises

maintainer
#10 lore raw
Quoted 43 lines · moises.veleta
Quoted 34 lines · Sergey Ryazanov
Quoted 24 lines · moises.veleta
Quoted 23 lines · Loic Poulain
Quoted 10 lines · Moises Veleta

The t7xx device contains two Cross Layer DMA (CLDMA) interfaces to communicate with AP and Modem processors respectively. So far only MD-CLDMA was being used, this patch enables AP-CLDMA and the GNSS port which requires such channel.

---

[...]

Quoted 10 lines
   static const struct t7xx_port_conf t7xx_md_port_conf[] = {
          {
drivers/net/wwan/t7xx/t7xx_port_proxy.c +8 -0
+               .tx_ch = PORT_CH_AP_GNSS_TX,
+               .rx_ch = PORT_CH_AP_GNSS_RX,
+               .txq_index = Q_IDX_CTRL,
+               .rxq_index = Q_IDX_CTRL,
+               .path_id = CLDMA_ID_AP,
+               .ops = &wwan_sub_port_ops,
+               .name = "t7xx_ap_gnss",
+               .port_type = WWAN_PORT_AT,
Quoted 8 lines
Quoted 2 lines

Is it really AT protocol here? wouldn't it be possible to expose it via the existing GNSS susbsystem?

The protocol is AT.
It is not possible to using the GNSS subsystem as it is meant for stand-alone GNSS receivers without a control path. In this case, GNSS can used for different use cases, such as Assisted GNSS, Cell ID positioning, Geofence, etc. Hence, this requires the use of the AT channel on the WWAN subsystem.

Quoted 8 lines

To make it clear. When you talking about a control path, did you mean that this GNSS port is not a simple NMEA port? Or did you mean that this port is NMEA, but the user is required to activate GPS functionality using the separate AT-commands port?

In other words, what is the format of the data that are transmitted over the GNSS port of the modem?

Quoted 7 lines

It is an AT port where MTK GNSS AT commands can be sent and received. Not a simple NMEA port, but NMEA data can be sent to Host via an AT command. Control port is exposed for Modem Manager to send GNSS comands, which may include disable/enable GPS functionality (enabled by default).

These are MTK GNSS AT commands, which follow the syntax as defined by 3GPP TS 27.007. These are not standard AT commands.

Now it is pretty clear. Thank you for your explanation. Please add this info somewhere near the GNSS port static configuration. This will help avoid similar confusion in the future.

BTW, does the regular AT port of this modem support the MTK GNSS AT commands? Or maybe the GNSS port supports regular modem management AT commands (PDP, RSSI, SMS, etc.)? In other words, are these GNSS and AT ports interchangeable or does each have a specific purpose?

If both ports are interchangeable, then it is ok to expose each as a WWAN AT port. But if the GNSS port only supports the MTK GNSS AT commands, then I am afraid we should not expose it via the WWAN subsystem at least as a regular AT port. This probably will confuse a user a lot.

It is not the format of the command used, it is a matter of the interface nature. There will be different controlling daemons. E.g., the AT port will be used by ModemManager or something similar and the GNSS port will be used by gpsd. And a user will have a hard time to figure out which WWAN AT port should be used for what purpose if we expose these ports simply as wwan0at0 and wwan0at1.

Signature · 1 line
Sergey
#11 lore raw
Quoted 67 lines · Sergey Ryazanov
Quoted 43 lines · moises.veleta
Quoted 34 lines · Sergey Ryazanov
Quoted 24 lines · moises.veleta
Quoted 23 lines · Loic Poulain
Quoted 10 lines · Moises Veleta

The t7xx device contains two Cross Layer DMA (CLDMA) interfaces to communicate with AP and Modem processors respectively. So far only MD-CLDMA was being used, this patch enables AP-CLDMA and the GNSS port which requires such channel.

---

[...]

Quoted 10 lines
    static const struct t7xx_port_conf t7xx_md_port_conf[] = {
           {
drivers/net/wwan/t7xx/t7xx_port_proxy.c +8 -0
+               .tx_ch = PORT_CH_AP_GNSS_TX,
+               .rx_ch = PORT_CH_AP_GNSS_RX,
+               .txq_index = Q_IDX_CTRL,
+               .rxq_index = Q_IDX_CTRL,
+               .path_id = CLDMA_ID_AP,
+               .ops = &wwan_sub_port_ops,
+               .name = "t7xx_ap_gnss",
+               .port_type = WWAN_PORT_AT,
Quoted 8 lines
Quoted 2 lines

Is it really AT protocol here? wouldn't it be possible to expose it via the existing GNSS susbsystem?

The protocol is AT.
It is not possible to using the GNSS subsystem as it is meant for stand-alone GNSS receivers without a control path. In this case, GNSS can used for different use cases, such as Assisted GNSS, Cell ID positioning, Geofence, etc. Hence, this requires the use of the AT channel on the WWAN subsystem.

Quoted 8 lines

To make it clear. When you talking about a control path, did you mean that this GNSS port is not a simple NMEA port? Or did you mean that this port is NMEA, but the user is required to activate GPS functionality using the separate AT-commands port?

In other words, what is the format of the data that are transmitted over the GNSS port of the modem?

Quoted 7 lines

It is an AT port where MTK GNSS AT commands can be sent and received. Not a simple NMEA port, but NMEA data can be sent to Host via an AT command. Control port is exposed for Modem Manager to send GNSS comands, which may include disable/enable GPS functionality (enabled by default).

These are MTK GNSS AT commands, which follow the syntax as defined by 3GPP TS 27.007. These are not standard AT commands.

Now it is pretty clear. Thank you for your explanation. Please add this info somewhere near the GNSS port static configuration. This will help avoid similar confusion in the future.

BTW, does the regular AT port of this modem support the MTK GNSS AT commands? Or maybe the GNSS port supports regular modem management AT commands (PDP, RSSI, SMS, etc.)? In other words, are these GNSS and AT ports interchangeable or does each have a specific purpose?

If both ports are interchangeable, then it is ok to expose each as a WWAN AT port. But if the GNSS port only supports the MTK GNSS AT commands, then I am afraid we should not expose it via the WWAN subsystem at least as a regular AT port. This probably will confuse a user a lot.

Quoted 7 lines

It is not the format of the command used, it is a matter of the interface nature. There will be different controlling daemons. E.g., the AT port will be used by ModemManager or something similar and the GNSS port will be used by gpsd. And a user will have a hard time to figure out which WWAN AT port should be used for what purpose if we expose these ports simply as wwan0at0 and wwan0at1.

The ports are not interchangeable. Each has a specific purpose. Modem port is used for sending Modem commands and GNSS port for GNSS commands.

MTK architecture is defined to have Modem as part of the base-band processor and GNSS chip part of the Application Processor. MTK wanted to keep the architecture simple and common for SKU's that have GNSS solution or not. One example is the MTK's M70 which did not have a GNSS solution.

We have different architectures, some fully AT based WWAN modems, or fully MBIM, and composite Modems (where Modem interfaces go on MBIM and GNSS on AT). This falls under the third category where GPS control port (over AT) supports GNSS functionality. There are not standard MBIM commands for GNSS and thus GNSS is only supported over AT via MTK proprietary commands.

This has been discussed with ModemManager maintainer (Aleksander) who introduced MM_PORT_SERIAL_AT_FLAG_GPS_CONTROL, an AT port that is used purely for GPS control.  See Gerrit https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/753/diffs?commit_id=343f27a5e7b0226e10aec025c502703d0be9d1ac#0dbbdd1ea5ff4bb4ee5b3bd70e9bb0502e02eeea

Since the GNSS solution is part of the M.2 WWAN module, we believe that the GNSS port should be exposed by the WWAN subsystem and that ModemManager treats this AT port as a GPS control port.

Note that the GNSS port helps supports functionalities such as:
1. Start/Stop GNSS sessions
2. Configuration commands to support Assisted GNSS positioning
3. Crash & reboot (notifications when device is reset (AP) & host is reset)
4. Settings to Enable/Disable GNSS solution
5. Geofencing

Regards,
Moises