mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "open list:BAREBOX" <barebox@lists.infradead.org>
Subject: [PATCH 3/4] firmware: ti_sci: handle Asel
Date: Tue, 29 Apr 2025 16:14:22 +0200	[thread overview]
Message-ID: <20250429-k3-asel-v1-3-6f39afaa2dfe@pengutronix.de> (raw)
In-Reply-To: <20250429-k3-asel-v1-0-6f39afaa2dfe@pengutronix.de>

This adds support for the Asel aka "Address selection" bits to ti_sci.

These bits become important when the DDR firewalls are enabled. With DDR
firewalls the buffer addresses used by the PKTDMA engine need to be
tagged with the correct Asel value, otherwise they will be blocked by
the firewall.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/firmware/ti_sci.c         | 2 ++
 drivers/firmware/ti_sci.h         | 5 +++++
 drivers/soc/ti/k3-navss-ringacc.c | 2 ++
 include/soc/ti/ti_sci_protocol.h  | 9 ++++++++-
 4 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index ddbaf0bc1f..a874599fe6 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -2172,6 +2172,8 @@ static int ti_sci_cmd_ring_config(const struct ti_sci_handle *handle,
 	req.mode = params->mode;
 	req.size = params->size;
 	req.order_id = params->order_id;
+	req.virtid = params->virtid;
+	req.asel = params->asel;
 
 	ret = ti_sci_do_xfer(info, xfer);
 	if (ret)
diff --git a/drivers/firmware/ti_sci.h b/drivers/firmware/ti_sci.h
index bb8bc7beea..15c7d55d43 100644
--- a/drivers/firmware/ti_sci.h
+++ b/drivers/firmware/ti_sci.h
@@ -848,6 +848,9 @@ struct ti_sci_msg_req_wait_proc_boot_status {
  *	the formula (log2(size_bytes) - 2), where size_bytes cannot be
  *	greater than 256.
  * @order_id: Specifies the ring's bus order ID.
+ * @virtid: Ring virt ID value
+ * @asel: Ring ASEL (address select) value to be set into the ASEL field of the
+ *	ring's RING_BA_HI register.
  */
 struct ti_sci_msg_rm_ring_cfg_req {
 	struct ti_sci_msg_hdr hdr;
@@ -860,6 +863,8 @@ struct ti_sci_msg_rm_ring_cfg_req {
 	u8 mode;
 	u8 size;
 	u8 order_id;
+	u16 virtid;
+	u8 asel;
 } __packed;
 
 /**
diff --git a/drivers/soc/ti/k3-navss-ringacc.c b/drivers/soc/ti/k3-navss-ringacc.c
index e07cbec898..2d61f63761 100644
--- a/drivers/soc/ti/k3-navss-ringacc.c
+++ b/drivers/soc/ti/k3-navss-ringacc.c
@@ -642,6 +642,8 @@ static int k3_ringacc_ring_cfg_sci(struct k3_ring *ring)
 	ring_cfg.addr_hi = upper_32_bits(ring->ring_mem_dma);
 	ring_cfg.count = ring->size;
 	ring_cfg.mode = ring->mode;
+	ring_cfg.size = ring->elm_size;
+	ring_cfg.asel = ring->asel;
 
 	ret = ringacc->tisci_ring_ops->set_cfg(ringacc->tisci, &ring_cfg);
 	if (ret)
diff --git a/include/soc/ti/ti_sci_protocol.h b/include/soc/ti/ti_sci_protocol.h
index ecc23089d5..a080051dc5 100644
--- a/include/soc/ti/ti_sci_protocol.h
+++ b/include/soc/ti/ti_sci_protocol.h
@@ -319,13 +319,18 @@ struct ti_sci_proc_ops {
 #define TI_SCI_MSG_VALUE_RM_RING_SIZE_VALID	BIT(4)
 /* RA config.order_id parameter is valid for RM ring configure TISCI message */
 #define TI_SCI_MSG_VALUE_RM_RING_ORDER_ID_VALID	BIT(5)
+/* RA config.virtid parameter is valid for RM ring configure TISCI message */
+#define TI_SCI_MSG_VALUE_RM_RING_VIRTID_VALID   BIT(6)
+/* RA config.asel parameter is valid for RM ring configure TISCI message */
+#define TI_SCI_MSG_VALUE_RM_RING_ASEL_VALID     BIT(7)
 
 #define TI_SCI_MSG_VALUE_RM_ALL_NO_ORDER \
 	(TI_SCI_MSG_VALUE_RM_RING_ADDR_LO_VALID | \
 	TI_SCI_MSG_VALUE_RM_RING_ADDR_HI_VALID | \
 	TI_SCI_MSG_VALUE_RM_RING_COUNT_VALID | \
 	TI_SCI_MSG_VALUE_RM_RING_MODE_VALID | \
-	TI_SCI_MSG_VALUE_RM_RING_SIZE_VALID)
+	TI_SCI_MSG_VALUE_RM_RING_SIZE_VALID | \
+	TI_SCI_MSG_VALUE_RM_RING_ASEL_VALID)
 
 /**
  * struct ti_sci_msg_rm_ring_cfg - Ring configuration
@@ -343,6 +348,8 @@ struct ti_sci_msg_rm_ring_cfg {
 	u8 mode;
 	u8 size;
 	u8 order_id;
+	u16 virtid;
+	u8 asel;
 };
 
 /**

-- 
2.39.5




  parent reply	other threads:[~2025-04-29 14:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-29 14:14 [PATCH 0/4] K3: Add Asel support to the DMA driver Sascha Hauer
2025-04-29 14:14 ` [PATCH 1/4] ti/k3-navss-ringacc: switch to Linux code base Sascha Hauer
2025-04-29 14:14 ` [PATCH 2/4] firmware: ti_sci: pass struct to ti_sci_rm_ringacc_ops::config Sascha Hauer
2025-04-29 14:14 ` Sascha Hauer [this message]
2025-04-29 14:14 ` [PATCH 4/4] dma: k3-udma: Handle Asel Sascha Hauer

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=20250429-k3-asel-v1-3-6f39afaa2dfe@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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