phone-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sireesh Kodali <sireeshkodali1@gmail.com>
To: phone-devel@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	elder@kernel.org
Cc: Sireesh Kodali <sireeshkodali1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Subject: [RFC PATCH 11/17] net: ipa: Add support for IPA v2.x endpoints
Date: Mon, 20 Sep 2021 08:38:05 +0530	[thread overview]
Message-ID: <20210920030811.57273-12-sireeshkodali1@gmail.com> (raw)
In-Reply-To: <20210920030811.57273-1-sireeshkodali1@gmail.com>

IPA v2.x endpoints are the same as the endpoints on later versions. The
only big change was the addition of the "skip_config" flag. The only
other change is the backlog limit, which is a fixed number for IPA v2.6L

Signed-off-by: Sireesh Kodali <sireeshkodali1@gmail.com>
---
 drivers/net/ipa/ipa_endpoint.c | 65 ++++++++++++++++++++++------------
 1 file changed, 43 insertions(+), 22 deletions(-)

diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c
index 7d3ab61cd890..024cf3a0ded0 100644
--- a/drivers/net/ipa/ipa_endpoint.c
+++ b/drivers/net/ipa/ipa_endpoint.c
@@ -360,8 +360,10 @@ void ipa_endpoint_modem_pause_all(struct ipa *ipa, bool enable)
 {
 	u32 endpoint_id;
 
-	/* DELAY mode doesn't work correctly on IPA v4.2 */
-	if (ipa->version == IPA_VERSION_4_2)
+	/* DELAY mode doesn't work correctly on IPA v4.2
+	 * Pausing is not supported on IPA v2.6L
+	 */
+	if (ipa->version == IPA_VERSION_4_2 || ipa->version <= IPA_VERSION_2_6L)
 		return;
 
 	for (endpoint_id = 0; endpoint_id < IPA_ENDPOINT_MAX; endpoint_id++) {
@@ -383,6 +385,7 @@ int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa)
 {
 	u32 initialized = ipa->initialized;
 	struct ipa_trans *trans;
+	u32 value = 0, value_mask = ~0;
 	u32 count;
 
 	/* We need one command per modem TX endpoint.  We can get an upper
@@ -398,6 +401,11 @@ int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa)
 		return -EBUSY;
 	}
 
+	if (ipa->version <= IPA_VERSION_2_6L) {
+		value = aggr_force_close_fmask(true);
+		value_mask = aggr_force_close_fmask(true);
+	}
+
 	while (initialized) {
 		u32 endpoint_id = __ffs(initialized);
 		struct ipa_endpoint *endpoint;
@@ -416,7 +424,7 @@ int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa)
 		 * means status is disabled on the endpoint, and as a
 		 * result all other fields in the register are ignored.
 		 */
-		ipa_cmd_register_write_add(trans, offset, 0, ~0, false);
+		ipa_cmd_register_write_add(trans, offset, value, value_mask, false);
 	}
 
 	ipa_cmd_pipeline_clear_add(trans);
@@ -1531,8 +1539,10 @@ static void ipa_endpoint_program(struct ipa_endpoint *endpoint)
 	ipa_endpoint_init_mode(endpoint);
 	ipa_endpoint_init_aggr(endpoint);
 	ipa_endpoint_init_deaggr(endpoint);
-	ipa_endpoint_init_rsrc_grp(endpoint);
-	ipa_endpoint_init_seq(endpoint);
+	if (endpoint->ipa->version > IPA_VERSION_2_6L) {
+		ipa_endpoint_init_rsrc_grp(endpoint);
+		ipa_endpoint_init_seq(endpoint);
+	}
 	ipa_endpoint_status(endpoint);
 }
 
@@ -1592,7 +1602,6 @@ void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint)
 {
 	struct device *dev = &endpoint->ipa->pdev->dev;
 	struct ipa_dma *gsi = &endpoint->ipa->dma_subsys;
-	bool stop_channel;
 	int ret;
 
 	if (!(endpoint->ipa->enabled & BIT(endpoint->endpoint_id)))
@@ -1613,7 +1622,6 @@ void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint)
 {
 	struct device *dev = &endpoint->ipa->pdev->dev;
 	struct ipa_dma *gsi = &endpoint->ipa->dma_subsys;
-	bool start_channel;
 	int ret;
 
 	if (!(endpoint->ipa->enabled & BIT(endpoint->endpoint_id)))
@@ -1750,23 +1758,33 @@ int ipa_endpoint_config(struct ipa *ipa)
 	/* Find out about the endpoints supplied by the hardware, and ensure
 	 * the highest one doesn't exceed the number we support.
 	 */
-	val = ioread32(ipa->reg_virt + IPA_REG_FLAVOR_0_OFFSET);
-
-	/* Our RX is an IPA producer */
-	rx_base = u32_get_bits(val, IPA_PROD_LOWEST_FMASK);
-	max = rx_base + u32_get_bits(val, IPA_MAX_PROD_PIPES_FMASK);
-	if (max > IPA_ENDPOINT_MAX) {
-		dev_err(dev, "too many endpoints (%u > %u)\n",
-			max, IPA_ENDPOINT_MAX);
-		return -EINVAL;
-	}
-	rx_mask = GENMASK(max - 1, rx_base);
+	if (ipa->version <= IPA_VERSION_2_6L) {
+		// FIXME Not used anywhere?
+		if (ipa->version == IPA_VERSION_2_6L)
+			val = ioread32(ipa->reg_virt +
+					IPA_REG_V2_ENABLED_PIPES_OFFSET);
+		/* IPA v2.6L supports 20 pipes */
+		ipa->available = ipa->filter_map;
+		return 0;
+	} else {
+		val = ioread32(ipa->reg_virt + IPA_REG_FLAVOR_0_OFFSET);
+
+		/* Our RX is an IPA producer */
+		rx_base = u32_get_bits(val, IPA_PROD_LOWEST_FMASK);
+		max = rx_base + u32_get_bits(val, IPA_MAX_PROD_PIPES_FMASK);
+		if (max > IPA_ENDPOINT_MAX) {
+			dev_err(dev, "too many endpoints (%u > %u)\n",
+					max, IPA_ENDPOINT_MAX);
+			return -EINVAL;
+		}
+		rx_mask = GENMASK(max - 1, rx_base);
 
-	/* Our TX is an IPA consumer */
-	max = u32_get_bits(val, IPA_MAX_CONS_PIPES_FMASK);
-	tx_mask = GENMASK(max - 1, 0);
+		/* Our TX is an IPA consumer */
+		max = u32_get_bits(val, IPA_MAX_CONS_PIPES_FMASK);
+		tx_mask = GENMASK(max - 1, 0);
 
-	ipa->available = rx_mask | tx_mask;
+		ipa->available = rx_mask | tx_mask;
+	}
 
 	/* Check for initialized endpoints not supported by the hardware */
 	if (ipa->initialized & ~ipa->available) {
@@ -1865,6 +1883,9 @@ u32 ipa_endpoint_init(struct ipa *ipa, u32 count,
 			filter_map |= BIT(data->endpoint_id);
 	}
 
+	if (ipa->version <= IPA_VERSION_2_6L)
+		filter_map = 0x1fffff;
+
 	if (!ipa_filter_map_valid(ipa, filter_map))
 		goto err_endpoint_exit;
 
-- 
2.33.0


  parent reply	other threads:[~2021-09-20  3:10 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20  3:07 [RFC PATCH 00/17] net: ipa: Add support for IPA v2.x Sireesh Kodali
2021-09-20  3:07 ` [RFC PATCH 01/17] net: ipa: Correct ipa_status_opcode enumeration Sireesh Kodali
2021-10-13 22:28   ` Alex Elder
2021-10-18 16:12     ` Sireesh Kodali
2021-09-20  3:07 ` [RFC PATCH 02/17] net: ipa: revert to IPA_TABLE_ENTRY_SIZE for 32-bit IPA support Sireesh Kodali
2021-10-13 22:28   ` Alex Elder
2021-10-18 16:16     ` Sireesh Kodali
2021-09-20  3:07 ` [RFC PATCH 04/17] net: ipa: Establish ipa_dma interface Sireesh Kodali
2021-10-13 22:29   ` Alex Elder
2021-10-18 16:45     ` Sireesh Kodali
2021-09-20  3:07 ` [RFC PATCH 05/17] net: ipa: Check interrupts for availability Sireesh Kodali
2021-10-13 22:29   ` Alex Elder
2021-09-20  3:08 ` [RFC PATCH 06/17] net: ipa: Add timeout for ipa_cmd_pipeline_clear_wait Sireesh Kodali
2021-10-13 22:29   ` Alex Elder
2021-10-18 17:02     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 07/17] net: ipa: Add IPA v2.x register definitions Sireesh Kodali
2021-10-13 22:29   ` Alex Elder
2021-10-18 17:25     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 08/17] net: ipa: Add support for IPA v2.x interrupts Sireesh Kodali
2021-10-13 22:29   ` Alex Elder
2021-09-20  3:08 ` [RFC PATCH 09/17] net: ipa: Add support for using BAM as a DMA transport Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-10-18 17:30     ` Sireesh Kodali
2021-09-20  3:08 ` [PATCH 10/17] net: ipa: Add support for IPA v2.x commands and table init Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-10-18 18:13     ` Sireesh Kodali
2021-09-20  3:08 ` Sireesh Kodali [this message]
2021-10-13 22:30   ` [RFC PATCH 11/17] net: ipa: Add support for IPA v2.x endpoints Alex Elder
2021-10-18 18:17     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 12/17] net: ipa: Add support for IPA v2.x memory map Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-10-18 18:19     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 13/17] net: ipa: Add support for IPA v2.x in the driver's QMI interface Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-10-18 18:22     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 14/17] net: ipa: Add support for IPA v2 microcontroller Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-09-20  3:08 ` [RFC PATCH 15/17] net: ipa: Add IPA v2.6L initialization sequence support Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-09-20  3:08 ` [RFC PATCH 16/17] net: ipa: Add hw config describing IPA v2.x hardware Sireesh Kodali
2021-10-13 22:30   ` Alex Elder
2021-10-18 18:35     ` Sireesh Kodali
2021-09-20  3:08 ` [RFC PATCH 17/17] dt-bindings: net: qcom,ipa: Add support for MSM8953 and MSM8996 IPA Sireesh Kodali
2021-09-23 12:42   ` Rob Herring
2021-10-13 22:31   ` Alex Elder
2021-10-13 22:27 ` [RFC PATCH 00/17] net: ipa: Add support for IPA v2.x Alex Elder

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=20210920030811.57273-12-sireeshkodali1@gmail.com \
    --to=sireeshkodali1@gmail.com \
    --cc=davem@davemloft.net \
    --cc=elder@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=phone-devel@vger.kernel.org \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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).