Skip to contentSkip to conversation

J72xx: R5 SPL DMA support post HSM Rearch

PATCH Superseded Vignesh Raghavendra 3 participants 18 messages May 10, 2021 – May 12, 2021

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Vignesh Raghavendra

author maintainer
#0 lore raw

cover J72xx: R5 SPL DMA support post HSM Rearch

This series add DMA support for R5 SPL on J721e/J7200 SoCs post HSM Rearch.

Depends on Tero's base HSM rearch support series.

Vignesh Raghavendra (7):
mailbox: k3-sec-proxy: Add DM to DMSC communication thread
firmware: ti_sci: Implement GET_RANGE with static data
firmware: ti_sci: Add support for Resoure Management at R5 SPL stage.
ARM: dts: j72xx-r5-common-proc-board: Add DM firmware node
ARM: dts: k3: Add cfg register space for ringacc and udmap
soc: ti: k3-navss-ringacc: Add support for native configuration of
rings
dma: ti: k3-udma: Add support for native configuration of chan/flow

 arch/arm/dts/k3-am654-base-board-u-boot.dtsi  |  14 ++
 .../k3-j7200-common-proc-board-u-boot.dtsi    |  26 +++
 .../arm/dts/k3-j7200-r5-common-proc-board.dts |  17 ++
 .../k3-j721e-common-proc-board-u-boot.dtsi    |  14 ++
 .../arm/dts/k3-j721e-r5-common-proc-board.dts |  18 ++
 .../firmware/ti,j721e-dm-sci.txt              |  32 ++++
 drivers/dma/ti/k3-udma-u-boot.c               | 177 ++++++++++++++++++
 drivers/dma/ti/k3-udma.c                      |  42 ++++-
 drivers/firmware/ti_sci.c                     | 107 +++++++++++
 drivers/firmware/ti_sci_static_data.h         |  92 +++++++++
 drivers/mailbox/k3-sec-proxy.c                |   2 +-
 drivers/soc/ti/k3-navss-ringacc-u-boot.c      |  61 ++++++
 drivers/soc/ti/k3-navss-ringacc.c             |  36 +++-
 13 files changed, 630 insertions(+), 8 deletions(-)
 create mode 100644 doc/device-tree-bindings/firmware/ti,j721e-dm-sci.txt
 create mode 100644 drivers/dma/ti/k3-udma-u-boot.c
 create mode 100644 drivers/firmware/ti_sci_static_data.h
 create mode 100644 drivers/soc/ti/k3-navss-ringacc-u-boot.c
Signature · 1 line
2.31.1
author maintainer
#1 lore raw

PATCH 1/7 mailbox: k3-sec-proxy: Add DM to DMSC communication thread

R5 SPL would need to talk to DMSC using DM to DMSC sec-proxy threads. Mark these as valid threads in the driver.

---
 drivers/mailbox/k3-sec-proxy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mailbox/k3-sec-proxy.c +1 -1
index 88f320515a..20fdb09f31 100644
@@ -409,7 +409,7 @@ static int k3_sec_proxy_remove(struct udevice *dev)
 	return 0;
 }
 
-static const u32 am6x_valid_threads[] = { 0, 1, 4, 5, 6, 7, 8, 9, 11, 12, 13 };
+static const u32 am6x_valid_threads[] = { 0, 1, 4, 5, 6, 7, 8, 9, 11, 12, 13, 20, 21, 22, 23 };
 
 static const struct k3_sec_proxy_desc am654_desc = {
 	.thread_count = 90,
Signature · 1 line
2.31.1
author maintainer
#2 lore raw

PATCH 2/7 firmware: ti_sci: Implement GET_RANGE with static data

In reply to Vignesh Raghavendra

In case of R5 SPL, GET_RANGE API service is not available (as DM services are not yet up), therefore service such calls locally using per SoC static data.

---
 drivers/firmware/ti_sci.c             | 36 +++++++++++
 drivers/firmware/ti_sci_static_data.h | 92 +++++++++++++++++++++++++++
 2 files changed, 128 insertions(+)
 create mode 100644 drivers/firmware/ti_sci_static_data.h
drivers/firmware/ti_sci.c +36 -0
index 2aec2e34d3..c27fbc682a 100644
@@ -23,6 +23,7 @@
 #include <linux/soc/ti/ti_sci_protocol.h>
 
 #include "ti_sci.h"
+#include "ti_sci_static_data.h"
 
 /* List of all TI SCI devices active in system */
 static LIST_HEAD(ti_sci_list);
@@ -1667,6 +1668,33 @@ fail:
 	return ret;
 }
 
+static int __maybe_unused
+ti_sci_get_resource_range_static(u32 dev_id, u8 subtype, u16 *range_start,
+				 u16 *range_num)
+{
+	struct ti_sci_resource_static_data *data;
+	int i = 0;
+
+	while (1) {
+		data = &rm_static_data[i];
+
+		if (!data->dev_id)
+			return -EINVAL;
+
+		if (data->dev_id != dev_id || data->subtype != subtype) {
+			i++;
+			continue;
+		}
+
+		*range_start = data->range_start;
+		*range_num = data->range_num;
+
+		return 0;
+	}
+
+	return -EINVAL;
+}
+
 /**
  * ti_sci_cmd_get_resource_range - Get a range of resources assigned to host
  *				   that is same as ti sci interface host.
@@ -1683,6 +1711,11 @@ static int ti_sci_cmd_get_resource_range(const struct ti_sci_handle *handle,
 					 u32 dev_id, u8 subtype,
 					 u16 *range_start, u16 *range_num)
 {
+	if (CONFIG_IS_ENABLED(TI_K3_RAW_RM))
+		return ti_sci_get_resource_range_static(dev_id, subtype,
+							range_start,
+							range_num);
+
 	return ti_sci_get_resource_range(handle, dev_id, subtype,
 					 TI_SCI_IRQ_SECONDARY_HOST_INVALID,
 					 range_start, range_num);
@@ -1706,6 +1739,9 @@ int ti_sci_cmd_get_resource_range_from_shost(const struct ti_sci_handle *handle,
 					     u32 dev_id, u8 subtype, u8 s_host,
 					     u16 *range_start, u16 *range_num)
 {
+	if (CONFIG_IS_ENABLED(TI_K3_RAW_RM))
+		return -EINVAL;
+
 	return ti_sci_get_resource_range(handle, dev_id, subtype, s_host,
 					 range_start, range_num);
 }
drivers/firmware/ti_sci_static_data.h new file +92 -0

92 lines not on this page · raw message

Signature · 1 line
2.31.1
#3 lore raw

PATCH 2/7 firmware: ti_sci: Implement GET_RANGE with static data

Quoted 94 lines · Vignesh Raghavendra

In case of R5 SPL, GET_RANGE API service is not available (as DM services are not yet up), therefore service such calls locally using per SoC static data.

---
 drivers/firmware/ti_sci.c             | 36 +++++++++++
 drivers/firmware/ti_sci_static_data.h | 92 +++++++++++++++++++++++++++
 2 files changed, 128 insertions(+)
 create mode 100644 drivers/firmware/ti_sci_static_data.h
drivers/firmware/ti_sci.c +36 -0
index 2aec2e34d3..c27fbc682a 100644
@@ -23,6 +23,7 @@
 #include <linux/soc/ti/ti_sci_protocol.h>
 
 #include "ti_sci.h"
+#include "ti_sci_static_data.h"
 
 /* List of all TI SCI devices active in system */
 static LIST_HEAD(ti_sci_list);
@@ -1667,6 +1668,33 @@ fail:
 	return ret;
 }
 
+static int __maybe_unused
+ti_sci_get_resource_range_static(u32 dev_id, u8 subtype, u16 *range_start,
+				 u16 *range_num)
+{
+	struct ti_sci_resource_static_data *data;
+	int i = 0;
+
+	while (1) {
+		data = &rm_static_data[i];
+
+		if (!data->dev_id)
+			return -EINVAL;
+
+		if (data->dev_id != dev_id || data->subtype != subtype) {
+			i++;
+			continue;
+		}
+
+		*range_start = data->range_start;
+		*range_num = data->range_num;
+
+		return 0;
+	}
+
+	return -EINVAL;
+}
+
 /**
  * ti_sci_cmd_get_resource_range - Get a range of resources assigned to host
  *				   that is same as ti sci interface host.
@@ -1683,6 +1711,11 @@ static int ti_sci_cmd_get_resource_range(const struct ti_sci_handle *handle,
 					 u32 dev_id, u8 subtype,
 					 u16 *range_start, u16 *range_num)
 {
+	if (CONFIG_IS_ENABLED(TI_K3_RAW_RM))
+		return ti_sci_get_resource_range_static(dev_id, subtype,
+							range_start,
+							range_num);
+
 	return ti_sci_get_resource_range(handle, dev_id, subtype,
 					 TI_SCI_IRQ_SECONDARY_HOST_INVALID,
 					 range_start, range_num);
@@ -1706,6 +1739,9 @@ int ti_sci_cmd_get_resource_range_from_shost(const struct ti_sci_handle *handle,
 					     u32 dev_id, u8 subtype, u8 s_host,
 					     u16 *range_start, u16 *range_num)
 {
+	if (CONFIG_IS_ENABLED(TI_K3_RAW_RM))
+		return -EINVAL;
+
 	return ti_sci_get_resource_range(handle, dev_id, subtype, s_host,
 					 range_start, range_num);
 }
drivers/firmware/ti_sci_static_data.h new file +9 -0
new file mode 100644
index 0000000000..2816cb2827
@@ -0,0 +1,92 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Copyright (C)  2021 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ */
+
+#ifndef __TI_SCI_STATIC_DATA_H
+#define __TI_SCI_STATIC_DATA_H
+

drivers/firmware/ti_sci_static_data.h line 19

Quoted 10 lines
drivers/firmware/ti_sci_static_data.h new file +10 -0
+struct ti_sci_resource_static_data {
+	u32 dev_id;
+	u16 range_start;
+	u16 range_num;
+	u8 subtype;
+};
+
+#if IS_ENABLED(CONFIG_K3_DM_FW)
+
+#ifdef CONFIG_TARGET_J721E_R5_EVM

want to be consistent across #if IS_ENABLED() or #ifdef?

Quoted 19 lines
drivers/firmware/ti_sci_static_data.h new file +19 -0
+static struct ti_sci_resource_static_data rm_static_data[] = {
+	/* Free rings */
+	{
+		.dev_id = 235,
+		.subtype = 1,
+		.range_start = 124,
+		.range_num = 32,
+	},
+	/* TX channels */
+	{
+		.dev_id = 236,
+		.subtype = 13,
+		.range_start = 6,
+		.range_num = 2,
+	},
+	/* RX channels */
+	{
+		.dev_id = 236,
+		.subtype = 10,

drivers/firmware/ti_sci_static_data.h line 48

Quoted 10 lines
drivers/firmware/ti_sci_static_data.h new file +10 -0
+		.range_start = 6,
+		.range_num = 2,
+	},
+	/* RX Free flows */
+	{
+		.dev_id = 236,
+		.subtype = 0,
+		.range_start = 60,
+		.range_num = 8,
+	},

For my understanding, does this need to be in sync with RM board config or this can be independent?

Thanks and regards,
Lokesh

author maintainer
#4 lore raw

PATCH 2/7 firmware: ti_sci: Implement GET_RANGE with static data

Quoted 101 lines · Lokesh Vutla
Quoted 98 lines · Vignesh Raghavendra

In case of R5 SPL, GET_RANGE API service is not available (as DM services are not yet up), therefore service such calls locally using per SoC static data.

---
 drivers/firmware/ti_sci.c             | 36 +++++++++++
 drivers/firmware/ti_sci_static_data.h | 92 +++++++++++++++++++++++++++
 2 files changed, 128 insertions(+)
 create mode 100644 drivers/firmware/ti_sci_static_data.h
drivers/firmware/ti_sci.c +36 -0
index 2aec2e34d3..c27fbc682a 100644
@@ -23,6 +23,7 @@
 #include <linux/soc/ti/ti_sci_protocol.h>
 
 #include "ti_sci.h"
+#include "ti_sci_static_data.h"
 
 /* List of all TI SCI devices active in system */
 static LIST_HEAD(ti_sci_list);
@@ -1667,6 +1668,33 @@ fail:
 	return ret;
 }
 
+static int __maybe_unused
+ti_sci_get_resource_range_static(u32 dev_id, u8 subtype, u16 *range_start,
+				 u16 *range_num)
+{
+	struct ti_sci_resource_static_data *data;
+	int i = 0;
+
+	while (1) {
+		data = &rm_static_data[i];
+
+		if (!data->dev_id)
+			return -EINVAL;
+
+		if (data->dev_id != dev_id || data->subtype != subtype) {
+			i++;
+			continue;
+		}
+
+		*range_start = data->range_start;
+		*range_num = data->range_num;
+
+		return 0;
+	}
+
+	return -EINVAL;
+}
+
 /**
  * ti_sci_cmd_get_resource_range - Get a range of resources assigned to host
  *				   that is same as ti sci interface host.
@@ -1683,6 +1711,11 @@ static int ti_sci_cmd_get_resource_range(const struct ti_sci_handle *handle,
 					 u32 dev_id, u8 subtype,
 					 u16 *range_start, u16 *range_num)
 {
+	if (CONFIG_IS_ENABLED(TI_K3_RAW_RM))
+		return ti_sci_get_resource_range_static(dev_id, subtype,
+							range_start,
+							range_num);
+
 	return ti_sci_get_resource_range(handle, dev_id, subtype,
 					 TI_SCI_IRQ_SECONDARY_HOST_INVALID,
 					 range_start, range_num);
@@ -1706,6 +1739,9 @@ int ti_sci_cmd_get_resource_range_from_shost(const struct ti_sci_handle *handle,
 					     u32 dev_id, u8 subtype, u8 s_host,
 					     u16 *range_start, u16 *range_num)
 {
+	if (CONFIG_IS_ENABLED(TI_K3_RAW_RM))
+		return -EINVAL;
+
 	return ti_sci_get_resource_range(handle, dev_id, subtype, s_host,
 					 range_start, range_num);
 }
drivers/firmware/ti_sci_static_data.h new file +13 -0
new file mode 100644
index 0000000000..2816cb2827
@@ -0,0 +1,92 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Copyright (C)  2021 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ */
+
+#ifndef __TI_SCI_STATIC_DATA_H
+#define __TI_SCI_STATIC_DATA_H
+
+struct ti_sci_resource_static_data {
+	u32 dev_id;
+	u16 range_start;
+	u16 range_num;
Quoted 8 lines

drivers/firmware/ti_sci_static_data.h line 19

Quoted 6 lines
drivers/firmware/ti_sci_static_data.h new file +6 -0
+	u8 subtype;
+};
+
+#if IS_ENABLED(CONFIG_K3_DM_FW)
+
+#ifdef CONFIG_TARGET_J721E_R5_EVM

want to be consistent across #if IS_ENABLED() or #ifdef?

Right, will fix

Quoted 25 lines
Quoted 25 lines
drivers/firmware/ti_sci_static_data.h new file +24 -0
+static struct ti_sci_resource_static_data rm_static_data[] = {
+	/* Free rings */
+	{
+		.dev_id = 235,
+		.subtype = 1,
+		.range_start = 124,
+		.range_num = 32,
+	},
+	/* TX channels */
+	{
+		.dev_id = 236,
+		.subtype = 13,
+		.range_start = 6,
+		.range_num = 2,
+	},
+	/* RX channels */
+	{
+		.dev_id = 236,
+		.subtype = 10,
+		.range_start = 6,
+		.range_num = 2,
+	},
+	/* RX Free flows */
+	{
Quoted 8 lines

drivers/firmware/ti_sci_static_data.h line 48

Quoted 5 lines
drivers/firmware/ti_sci_static_data.h new file +5 -0
+		.dev_id = 236,
+		.subtype = 0,
+		.range_start = 60,
+		.range_num = 8,
+	},

For my understanding, does this need to be in sync with RM board config or this can be independent?

No, this needs to be in sync with RM board cfg data.

Regards
Vignesh

author maintainer
#5 lore raw

PATCH 3/7 firmware: ti_sci: Add support for Resoure Management at R5 SPL stage.

In reply to Vignesh Raghavendra

On J721e and J7200, MCU R5 core (boot master) itself would run Device Manager (DM) Firmware and interact with TI Foundational Security (TIFS) firmware to enable DMA and such other Resource Management (RM) services. So, during R5 SPL stage there is no such RM service available and ti_sci driver will have to directly interact with TIFS using DM to DMSC channels to request RM resources.

Therefore add DT binding and driver for the same. This driver will handle Resource Management services at R5 SPL stage.

---
 .../firmware/ti,j721e-dm-sci.txt              | 32 +++++++
 drivers/firmware/ti_sci.c                     | 91 +++++++++++++++++--
 2 files changed, 113 insertions(+), 10 deletions(-)
 create mode 100644 doc/device-tree-bindings/firmware/ti,j721e-dm-sci.txt
doc/device-tree-bindings/firmware/ti,j721e-dm-sci.txt new file +32 -0
new file mode 100644
index 0000000000..0217341f0c
@@ -0,0 +1,32 @@
+Bindings for Texas Instruments System Control Interface (TI-SCI) Message
+Protocol for Device Manager(DM) to TI Foundational Security(TIFS)
+Firmware communication
+
+Required properties:
+--------------------
+- compatible: should be "ti,j721e-dm-sci"
+- mbox-names:
+	"rx" - Mailbox corresponding to receive path
+	"tx" - Mailbox corresponding to transmit path
+
+- mboxes: Mailboxes corresponding to the mbox-names. Each value of the mboxes
+	  property should contain a phandle to the mailbox controller device
+	  node and an args specifier that will be the phandle to the intended
+	  sub-mailbox child node to be used for communication.
+
+- ti,host-id: Host ID to use for communication.
+
+Optional Properties:
+--------------------
+- ti,secure-host: If the host is defined as secure.
+
+Example:
+--------
+	dm_tifs: dm-tifs {
+		compatible = "ti,j721e-dm-sci";
+		ti,host-id = <3>;
+		ti,secure-host;
+		mbox-names = "rx", "tx";
+		mboxes= <&mcu_secproxy 21>,
+			<&mcu_secproxy 23>;
+	};
drivers/firmware/ti_sci.c +81 -10

130 lines not on this page · raw message

Signature · 1 line
2.31.1
#6 lore raw

PATCH 3/7 firmware: ti_sci: Add support for Resoure Management at R5 SPL stage.

Quoted 6 lines · Vignesh Raghavendra

On J721e and J7200, MCU R5 core (boot master) itself would run Device Manager (DM) Firmware and interact with TI Foundational Security (TIFS) firmware to enable DMA and such other Resource Management (RM) services. So, during R5 SPL stage there is no such RM service available and ti_sci driver will have to directly interact with TIFS using DM to DMSC channels to request RM resources.

So, PM services are also not available at R5 and I do not see a new compatible for PM services. Can you help me understand why we cannot follow the same as being done in PM services.

One of my worry is ti_sci driver already needs a heavy cleanup. Now adding more stuff to it will just keep increase the burden

Thanks and regards,
Lokesh

Quoted 191 lines

Therefore add DT binding and driver for the same. This driver will handle Resource Management services at R5 SPL stage.

---
 .../firmware/ti,j721e-dm-sci.txt              | 32 +++++++
 drivers/firmware/ti_sci.c                     | 91 +++++++++++++++++--
 2 files changed, 113 insertions(+), 10 deletions(-)
 create mode 100644 doc/device-tree-bindings/firmware/ti,j721e-dm-sci.txt
doc/device-tree-bindings/firmware/ti,j721e-dm-sci.txt new file +32 -0
new file mode 100644
index 0000000000..0217341f0c
@@ -0,0 +1,32 @@
+Bindings for Texas Instruments System Control Interface (TI-SCI) Message
+Protocol for Device Manager(DM) to TI Foundational Security(TIFS)
+Firmware communication
+
+Required properties:
+--------------------
+- compatible: should be "ti,j721e-dm-sci"
+- mbox-names:
+	"rx" - Mailbox corresponding to receive path
+	"tx" - Mailbox corresponding to transmit path
+
+- mboxes: Mailboxes corresponding to the mbox-names. Each value of the mboxes
+	  property should contain a phandle to the mailbox controller device
+	  node and an args specifier that will be the phandle to the intended
+	  sub-mailbox child node to be used for communication.
+
+- ti,host-id: Host ID to use for communication.
+
+Optional Properties:
+--------------------
+- ti,secure-host: If the host is defined as secure.
+
+Example:
+--------
+	dm_tifs: dm-tifs {
+		compatible = "ti,j721e-dm-sci";
+		ti,host-id = <3>;
+		ti,secure-host;
+		mbox-names = "rx", "tx";
+		mboxes= <&mcu_secproxy 21>,
+			<&mcu_secproxy 23>;
+	};
drivers/firmware/ti_sci.c +81 -10
index c27fbc682a..f75ad5db67 100644
@@ -1669,8 +1669,9 @@ fail:
 }
 
 static int __maybe_unused
-ti_sci_get_resource_range_static(u32 dev_id, u8 subtype, u16 *range_start,
-				 u16 *range_num)
+ti_sci_cmd_get_resource_range_static(const struct ti_sci_handle *handle,
+				     u32 dev_id, u8 subtype,
+				     u16 *range_start, u16 *range_num)
 {
 	struct ti_sci_resource_static_data *data;
 	int i = 0;
@@ -1711,11 +1712,6 @@ static int ti_sci_cmd_get_resource_range(const struct ti_sci_handle *handle,
 					 u32 dev_id, u8 subtype,
 					 u16 *range_start, u16 *range_num)
 {
-	if (CONFIG_IS_ENABLED(TI_K3_RAW_RM))
-		return ti_sci_get_resource_range_static(dev_id, subtype,
-							range_start,
-							range_num);
-
 	return ti_sci_get_resource_range(handle, dev_id, subtype,
 					 TI_SCI_IRQ_SECONDARY_HOST_INVALID,
 					 range_start, range_num);
@@ -1739,9 +1735,6 @@ int ti_sci_cmd_get_resource_range_from_shost(const struct ti_sci_handle *handle,
 					     u32 dev_id, u8 subtype, u8 s_host,
 					     u16 *range_start, u16 *range_num)
 {
-	if (CONFIG_IS_ENABLED(TI_K3_RAW_RM))
-		return -EINVAL;
-
 	return ti_sci_get_resource_range(handle, dev_id, subtype, s_host,
 					 range_start, range_num);
 }
@@ -3051,6 +3044,58 @@ static int ti_sci_probe(struct udevice *dev)
 	return ret;
 }
 
+/**
+ * ti_sci_dm_probe() - Basic probe for DM to TIFS SCI
+ * @dev:	corresponding system controller interface device
+ *
+ * Return: 0 if all goes good, else appropriate error message.
+ */
+static __maybe_unused int ti_sci_dm_probe(struct udevice *dev)
+{
+	struct ti_sci_rm_core_ops *rm_core_ops;
+	struct ti_sci_rm_udmap_ops *udmap_ops;
+	struct ti_sci_rm_ringacc_ops *rops;
+	struct ti_sci_rm_psil_ops *psilops;
+	struct ti_sci_ops *ops;
+	struct ti_sci_info *info;
+	int ret;
+
+	debug("%s(dev=%p)\n", __func__, dev);
+
+	info = dev_get_priv(dev);
+	info->desc = (void *)dev_get_driver_data(dev);
+
+	ret = ti_sci_of_to_info(dev, info);
+	if (ret) {
+		dev_err(dev, "%s: Probe failed with error %d\n", __func__, ret);
+		return ret;
+	}
+
+	info->dev = dev;
+	info->seq = 0xA;
+
+	list_add_tail(&info->list, &ti_sci_list);
+
+	ops = &info->handle.ops;
+
+	rm_core_ops = &ops->rm_core_ops;
+	rm_core_ops->get_range = ti_sci_cmd_get_resource_range_static;
+
+	rops = &ops->rm_ring_ops;
+	rops->config = ti_sci_cmd_ring_config;
+
+	psilops = &ops->rm_psil_ops;
+	psilops->pair = ti_sci_cmd_rm_psil_pair;
+	psilops->unpair = ti_sci_cmd_rm_psil_unpair;
+
+	udmap_ops = &ops->rm_udmap_ops;
+	udmap_ops->tx_ch_cfg = ti_sci_cmd_rm_udmap_tx_ch_cfg;
+	udmap_ops->rx_ch_cfg = ti_sci_cmd_rm_udmap_rx_ch_cfg;
+	udmap_ops->rx_flow_cfg = ti_sci_cmd_rm_udmap_rx_flow_cfg;
+
+	return ret;
+}
+
 /*
  * ti_sci_get_free_resource() - Get a free resource from TISCI resource.
  * @res:	Pointer to the TISCI resource
@@ -3188,6 +3233,14 @@ static const struct ti_sci_desc ti_sci_pmmc_am654_desc = {
 	.max_msg_size = 60,
 };
 
+/* Description for J721e DM to DMSC communication */
+static const struct ti_sci_desc ti_sci_dm_j721e_desc = {
+	.default_host_id = 3,
+	.max_rx_timeout_ms = 10000,
+	.max_msgs = 20,
+	.max_msg_size = 60,
+};
+
 static const struct udevice_id ti_sci_ids[] = {
 	{
 		.compatible = "ti,k2g-sci",
@@ -3200,6 +3253,14 @@ static const struct udevice_id ti_sci_ids[] = {
 	{ /* Sentinel */ },
 };
 
+static __maybe_unused const struct udevice_id ti_sci_dm_ids[] = {
+	{
+		.compatible = "ti,j721e-dm-sci",
+		.data = (ulong)&ti_sci_dm_j721e_desc
+	},
+	{ /* Sentinel */ },
+};
+
 U_BOOT_DRIVER(ti_sci) = {
 	.name = "ti_sci",
 	.id = UCLASS_FIRMWARE,
@@ -3207,3 +3268,13 @@ U_BOOT_DRIVER(ti_sci) = {
 	.probe = ti_sci_probe,
 	.priv_auto	= sizeof(struct ti_sci_info),
 };
+
+#if IS_ENABLED(CONFIG_K3_DM_FW)
+U_BOOT_DRIVER(ti_sci_dm) = {
+	.name = "ti_sci_dm",
+	.id = UCLASS_FIRMWARE,
+	.of_match = ti_sci_dm_ids,
+	.probe = ti_sci_dm_probe,
+	.priv_auto = sizeof(struct ti_sci_info),
+};
+#endif
author maintainer
#7 lore raw

PATCH 3/7 firmware: ti_sci: Add support for Resoure Management at R5 SPL stage.

Quoted 10 lines · Lokesh Vutla
Quoted 6 lines · Vignesh Raghavendra

On J721e and J7200, MCU R5 core (boot master) itself would run Device Manager (DM) Firmware and interact with TI Foundational Security (TIFS) firmware to enable DMA and such other Resource Management (RM) services. So, during R5 SPL stage there is no such RM service available and ti_sci driver will have to directly interact with TIFS using DM to DMSC channels to request RM resources.

Quoted 4 lines

So, PM services are also not available at R5 and I do not see a new compatible for PM services. Can you help me understand why we cannot follow the same as being done in PM services.

PM services can be handled entirely within R5 SPL. But RM service requests need to forwarded to TIFS for openinng up channelized firewall and ISC configuration (Message forwarding). These messages have to be sent on a different secproxy channel than regular messages (DM to TIFS channel) and the host ID used is R5's non secure host ID. All these differences make RM service provider a different entity than existing one.

Quoted 3 lines

One of my worry is ti_sci driver already needs a heavy cleanup. Now adding more stuff to it will just keep increase the burden

This patch adds new probe function (ti_sci_dm_probe()) which reassigns RM GET_RANGE API to function that does static table look up instead of API call to TIFS. I don't think its adding ady significant code to existing driver and should not come in the way of any future cleanups.

Regards
Vignesh

author maintainer
#8 lore raw

PATCH 4/7 ARM: dts: j72xx-r5-common-proc-board: Add DM firmware node

In reply to Vignesh Raghavendra

Add DM firmware node which will provide DM services during R5 SPL stage.

---
 arch/arm/dts/k3-j7200-r5-common-proc-board.dts | 17 +++++++++++++++++
 arch/arm/dts/k3-j721e-r5-common-proc-board.dts | 18 ++++++++++++++++++
 2 files changed, 35 insertions(+)
arch/arm/dts/k3-j7200-r5-common-proc-board.dts +17 -0
index 0491432060..9963746c1d 100644
@@ -79,6 +79,16 @@
 		mboxes= <&mcu_secproxy 4>, <&mcu_secproxy 5>;
 		mbox-names = "tx", "rx";
 	};
+
+	dm_tifs: dm-tifs {
+		compatible = "ti,j721e-dm-sci";
+		ti,host-id = <3>;
+		ti,secure-host;
+		mbox-names = "rx", "tx";
+		mboxes= <&mcu_secproxy 21>,
+			<&mcu_secproxy 23>;
+		u-boot,dm-spl;
+	};
 };
 
 &dmsc {
@@ -276,4 +286,11 @@
 	};
 };
 
+&mcu_ringacc {
+	ti,sci = <&dm_tifs>;
+};
+
+&mcu_udmap {
+	ti,sci = <&dm_tifs>;
+};
 #include "k3-j7200-common-proc-board-u-boot.dtsi"
arch/arm/dts/k3-j721e-r5-common-proc-board.dts +18 -0
index 4e8422e662..0542b2f8b8 100644
@@ -76,6 +76,16 @@
 		power-domains = <&k3_pds 154 TI_SCI_PD_EXCLUSIVE>;
 		#thermal-sensor-cells = <1>;
 	};
+
+	dm_tifs: dm-tifs {
+		compatible = "ti,j721e-dm-sci";
+		ti,host-id = <3>;
+		ti,secure-host;
+		mbox-names = "rx", "tx";
+		mboxes= <&mcu_secproxy 21>,
+			<&mcu_secproxy 23>;
+		u-boot,dm-spl;
+	};
 };
 
 &cbass_main {
@@ -345,3 +355,11 @@
 		u-boot,dm-spl;
 	};
 };
+
+&mcu_ringacc {
+	ti,sci = <&dm_tifs>;
+};
+
+&mcu_udmap {
+	ti,sci = <&dm_tifs>;
+};
Signature · 1 line
2.31.1
author maintainer
#9 lore raw

PATCH 5/7 ARM: dts: k3: Add cfg register space for ringacc and udmap

In reply to Vignesh Raghavendra

R5 SPL needs access to cfg space of Rings and UDMAP, therefore add RING CFG, TCHAN CFG and RCHAN CFG address ranges.

---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi  | 14 ++++++++++
 .../k3-j7200-common-proc-board-u-boot.dtsi    | 26 +++++++++++++++++++
 .../k3-j721e-common-proc-board-u-boot.dtsi    | 14 ++++++++++
 3 files changed, 54 insertions(+)
arch/arm/dts/k3-am654-base-board-u-boot.dtsi +14 -0
index b0602d1dad..2840258518 100644
@@ -35,11 +35,25 @@
 		u-boot,dm-spl;
 
 		ringacc at 2b800000 {
+			reg =	<0x0 0x2b800000 0x0 0x400000>,
+				<0x0 0x2b000000 0x0 0x400000>,
+				<0x0 0x28590000 0x0 0x100>,
+				<0x0 0x2a500000 0x0 0x40000>,
+				<0x0 0x28440000 0x0 0x40000>;
+			reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target", "cfg";
 			u-boot,dm-spl;
 			ti,dma-ring-reset-quirk;
 		};
 
 		dma-controller at 285c0000 {
+			reg =	<0x0 0x285c0000 0x0 0x100>,
+				<0x0 0x284c0000 0x0 0x4000>,
+				<0x0 0x2a800000 0x0 0x40000>,
+				<0x0 0x284a0000 0x0 0x4000>,
+				<0x0 0x2aa00000 0x0 0x40000>,
+				<0x0 0x28400000 0x0 0x2000>;
+			reg-names = "gcfg", "rchan", "rchanrt", "tchan",
+					    "tchanrt", "rflow";
 			u-boot,dm-spl;
 		};
 	};
arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi +26 -0
index c3aae65b39..41ce9fcb59 100644
@@ -40,6 +40,32 @@
 	chipid at 43000014 {
 		u-boot,dm-spl;
 	};
+
+	mcu-navss{
+		u-boot,dm-spl;
+
+		ringacc at 2b800000 {
+			reg =	<0x0 0x2b800000 0x0 0x400000>,
+				<0x0 0x2b000000 0x0 0x400000>,
+				<0x0 0x28590000 0x0 0x100>,
+				<0x0 0x2a500000 0x0 0x40000>,
+				<0x0 0x28440000 0x0 0x40000>;
+			reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target", "cfg";
+			u-boot,dm-spl;
+		};
+
+		dma-controller at 285c0000 {
+			reg =	<0x0 0x285c0000 0x0 0x100>,
+				<0x0 0x284c0000 0x0 0x4000>,
+				<0x0 0x2a800000 0x0 0x40000>,
+				<0x0 0x284a0000 0x0 0x4000>,
+				<0x0 0x2aa00000 0x0 0x40000>,
+				<0x0 0x28400000 0x0 0x2000>;
+			reg-names = "gcfg", "rchan", "rchanrt", "tchan",
+					    "tchanrt", "rflow";
+			u-boot,dm-spl;
+		};
+	};
 };
 
 &secure_proxy_main {
arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi +14 -0
index 1135de5a92..ed64f2720d 100644
@@ -54,10 +54,24 @@
 		u-boot,dm-spl;
 
 		ringacc at 2b800000 {
+			reg =	<0x0 0x2b800000 0x0 0x400000>,
+				<0x0 0x2b000000 0x0 0x400000>,
+				<0x0 0x28590000 0x0 0x100>,
+				<0x0 0x2a500000 0x0 0x40000>,
+				<0x0 0x28440000 0x0 0x40000>;
+			reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target", "cfg";
 			u-boot,dm-spl;
 		};
 
 		dma-controller at 285c0000 {
+			reg =	<0x0 0x285c0000 0x0 0x100>,
+				<0x0 0x284c0000 0x0 0x4000>,
+				<0x0 0x2a800000 0x0 0x40000>,
+				<0x0 0x284a0000 0x0 0x4000>,
+				<0x0 0x2aa00000 0x0 0x40000>,
+				<0x0 0x28400000 0x0 0x2000>;
+			reg-names = "gcfg", "rchan", "rchanrt", "tchan",
+					    "tchanrt", "rflow";
 			u-boot,dm-spl;
 		};
 	};
Signature · 1 line
2.31.1
#10 lore raw

PATCH 5/7 ARM: dts: k3: Add cfg register space for ringacc and udmap

Quoted 8 lines · Vignesh Raghavendra

R5 SPL needs access to cfg space of Rings and UDMAP, therefore add RING CFG, TCHAN CFG and RCHAN CFG address ranges.

---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi  | 14 ++++++++++
 .../k3-j7200-common-proc-board-u-boot.dtsi    | 26 +++++++++++++++++++
 .../k3-j721e-common-proc-board-u-boot.dtsi    | 14 ++++++++++

If these are specific to R5, then it should be moved to R5 dts no? -u-boot.dtsi will be applied to A53 dts as well.

Thanks and regards,
Lokesh

Quoted 99 lines
 3 files changed, 54 insertions(+)
arch/arm/dts/k3-am654-base-board-u-boot.dtsi +14 -0
index b0602d1dad..2840258518 100644
@@ -35,11 +35,25 @@
 		u-boot,dm-spl;
 
 		ringacc at 2b800000 {
+			reg =	<0x0 0x2b800000 0x0 0x400000>,
+				<0x0 0x2b000000 0x0 0x400000>,
+				<0x0 0x28590000 0x0 0x100>,
+				<0x0 0x2a500000 0x0 0x40000>,
+				<0x0 0x28440000 0x0 0x40000>;
+			reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target", "cfg";
 			u-boot,dm-spl;
 			ti,dma-ring-reset-quirk;
 		};
 
 		dma-controller at 285c0000 {
+			reg =	<0x0 0x285c0000 0x0 0x100>,
+				<0x0 0x284c0000 0x0 0x4000>,
+				<0x0 0x2a800000 0x0 0x40000>,
+				<0x0 0x284a0000 0x0 0x4000>,
+				<0x0 0x2aa00000 0x0 0x40000>,
+				<0x0 0x28400000 0x0 0x2000>;
+			reg-names = "gcfg", "rchan", "rchanrt", "tchan",
+					    "tchanrt", "rflow";
 			u-boot,dm-spl;
 		};
 	};
arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi +26 -0
index c3aae65b39..41ce9fcb59 100644
@@ -40,6 +40,32 @@
 	chipid at 43000014 {
 		u-boot,dm-spl;
 	};
+
+	mcu-navss{
+		u-boot,dm-spl;
+
+		ringacc at 2b800000 {
+			reg =	<0x0 0x2b800000 0x0 0x400000>,
+				<0x0 0x2b000000 0x0 0x400000>,
+				<0x0 0x28590000 0x0 0x100>,
+				<0x0 0x2a500000 0x0 0x40000>,
+				<0x0 0x28440000 0x0 0x40000>;
+			reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target", "cfg";
+			u-boot,dm-spl;
+		};
+
+		dma-controller at 285c0000 {
+			reg =	<0x0 0x285c0000 0x0 0x100>,
+				<0x0 0x284c0000 0x0 0x4000>,
+				<0x0 0x2a800000 0x0 0x40000>,
+				<0x0 0x284a0000 0x0 0x4000>,
+				<0x0 0x2aa00000 0x0 0x40000>,
+				<0x0 0x28400000 0x0 0x2000>;
+			reg-names = "gcfg", "rchan", "rchanrt", "tchan",
+					    "tchanrt", "rflow";
+			u-boot,dm-spl;
+		};
+	};
 };
 
 &secure_proxy_main {
arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi +14 -0
index 1135de5a92..ed64f2720d 100644
@@ -54,10 +54,24 @@
 		u-boot,dm-spl;
 
 		ringacc at 2b800000 {
+			reg =	<0x0 0x2b800000 0x0 0x400000>,
+				<0x0 0x2b000000 0x0 0x400000>,
+				<0x0 0x28590000 0x0 0x100>,
+				<0x0 0x2a500000 0x0 0x40000>,
+				<0x0 0x28440000 0x0 0x40000>;
+			reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target", "cfg";
 			u-boot,dm-spl;
 		};
 
 		dma-controller at 285c0000 {
+			reg =	<0x0 0x285c0000 0x0 0x100>,
+				<0x0 0x284c0000 0x0 0x4000>,
+				<0x0 0x2a800000 0x0 0x40000>,
+				<0x0 0x284a0000 0x0 0x4000>,
+				<0x0 0x2aa00000 0x0 0x40000>,
+				<0x0 0x28400000 0x0 0x2000>;
+			reg-names = "gcfg", "rchan", "rchanrt", "tchan",
+					    "tchanrt", "rflow";
 			u-boot,dm-spl;
 		};
 	};
author maintainer
#11 lore raw

PATCH 5/7 ARM: dts: k3: Add cfg register space for ringacc and udmap

Quoted 6 lines · Lokesh Vutla
Quoted 3 lines · Vignesh Raghavendra

R5 SPL needs access to cfg space of Rings and UDMAP, therefore add RING CFG, TCHAN CFG and RCHAN CFG address ranges.

Quoted 9 lines
Quoted 5 lines
---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi  | 14 ++++++++++
 .../k3-j7200-common-proc-board-u-boot.dtsi    | 26 +++++++++++++++++++
 .../k3-j721e-common-proc-board-u-boot.dtsi    | 14 ++++++++++

If these are specific to R5, then it should be moved to R5 dts no? -u-boot.dtsi will be applied to A53 dts as well.

Not really.. There registers are present within respective IPs. A53/A72 use DM APIs to configure these registers whereas R5 does direct programming. I intend to add these ranges to kernel DT as well. Until then, will be in -u-boot.dtsi.

Quoted 102 lines

Thanks and regards,
Lokesh

Quoted 99 lines
 3 files changed, 54 insertions(+)
arch/arm/dts/k3-am654-base-board-u-boot.dtsi +14 -0
index b0602d1dad..2840258518 100644
@@ -35,11 +35,25 @@
 		u-boot,dm-spl;
 
 		ringacc at 2b800000 {
+			reg =	<0x0 0x2b800000 0x0 0x400000>,
+				<0x0 0x2b000000 0x0 0x400000>,
+				<0x0 0x28590000 0x0 0x100>,
+				<0x0 0x2a500000 0x0 0x40000>,
+				<0x0 0x28440000 0x0 0x40000>;
+			reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target", "cfg";
 			u-boot,dm-spl;
 			ti,dma-ring-reset-quirk;
 		};
 
 		dma-controller at 285c0000 {
+			reg =	<0x0 0x285c0000 0x0 0x100>,
+				<0x0 0x284c0000 0x0 0x4000>,
+				<0x0 0x2a800000 0x0 0x40000>,
+				<0x0 0x284a0000 0x0 0x4000>,
+				<0x0 0x2aa00000 0x0 0x40000>,
+				<0x0 0x28400000 0x0 0x2000>;
+			reg-names = "gcfg", "rchan", "rchanrt", "tchan",
+					    "tchanrt", "rflow";
 			u-boot,dm-spl;
 		};
 	};
arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi +26 -0
index c3aae65b39..41ce9fcb59 100644
@@ -40,6 +40,32 @@
 	chipid at 43000014 {
 		u-boot,dm-spl;
 	};
+
+	mcu-navss{
+		u-boot,dm-spl;
+
+		ringacc at 2b800000 {
+			reg =	<0x0 0x2b800000 0x0 0x400000>,
+				<0x0 0x2b000000 0x0 0x400000>,
+				<0x0 0x28590000 0x0 0x100>,
+				<0x0 0x2a500000 0x0 0x40000>,
+				<0x0 0x28440000 0x0 0x40000>;
+			reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target", "cfg";
+			u-boot,dm-spl;
+		};
+
+		dma-controller at 285c0000 {
+			reg =	<0x0 0x285c0000 0x0 0x100>,
+				<0x0 0x284c0000 0x0 0x4000>,
+				<0x0 0x2a800000 0x0 0x40000>,
+				<0x0 0x284a0000 0x0 0x4000>,
+				<0x0 0x2aa00000 0x0 0x40000>,
+				<0x0 0x28400000 0x0 0x2000>;
+			reg-names = "gcfg", "rchan", "rchanrt", "tchan",
+					    "tchanrt", "rflow";
+			u-boot,dm-spl;
+		};
+	};
 };
 
 &secure_proxy_main {
arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi +14 -0
index 1135de5a92..ed64f2720d 100644
@@ -54,10 +54,24 @@
 		u-boot,dm-spl;
 
 		ringacc at 2b800000 {
+			reg =	<0x0 0x2b800000 0x0 0x400000>,
+				<0x0 0x2b000000 0x0 0x400000>,
+				<0x0 0x28590000 0x0 0x100>,
+				<0x0 0x2a500000 0x0 0x40000>,
+				<0x0 0x28440000 0x0 0x40000>;
+			reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target", "cfg";
 			u-boot,dm-spl;
 		};
 
 		dma-controller at 285c0000 {
+			reg =	<0x0 0x285c0000 0x0 0x100>,
+				<0x0 0x284c0000 0x0 0x4000>,
+				<0x0 0x2a800000 0x0 0x40000>,
+				<0x0 0x284a0000 0x0 0x4000>,
+				<0x0 0x2aa00000 0x0 0x40000>,
+				<0x0 0x28400000 0x0 0x2000>;
+			reg-names = "gcfg", "rchan", "rchanrt", "tchan",
+					    "tchanrt", "rflow";
 			u-boot,dm-spl;
 		};
 	};
#12 lore raw

PATCH 5/7 ARM: dts: k3: Add cfg register space for ringacc and udmap

Quoted 15 lines · Vignesh Raghavendra
Quoted 12 lines · Lokesh Vutla
Quoted 8 lines · Vignesh Raghavendra

R5 SPL needs access to cfg space of Rings and UDMAP, therefore add RING CFG, TCHAN CFG and RCHAN CFG address ranges.

---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi  | 14 ++++++++++
 .../k3-j7200-common-proc-board-u-boot.dtsi    | 26 +++++++++++++++++++
 .../k3-j721e-common-proc-board-u-boot.dtsi    | 14 ++++++++++
Quoted 9 lines
Quoted 3 lines

If these are specific to R5, then it should be moved to R5 dts no? -u-boot.dtsi will be applied to A53 dts as well.

Not really.. There registers are present within respective IPs. A53/A72 use DM APIs to configure these registers whereas R5 does direct programming. I intend to add these ranges to kernel DT as well. Until then, will be in -u-boot.dtsi.

You intend to add mcu-navss ringacc to kernel dts as well. I am fine with this. But please remember to update u-boot dts once you update kernel dts

Thanks and regards,
Lokesh

Quoted 102 lines
Quoted 102 lines

Thanks and regards,
Lokesh

Quoted 99 lines
 3 files changed, 54 insertions(+)
arch/arm/dts/k3-am654-base-board-u-boot.dtsi +14 -0
index b0602d1dad..2840258518 100644
@@ -35,11 +35,25 @@
 		u-boot,dm-spl;
 
 		ringacc at 2b800000 {
+			reg =	<0x0 0x2b800000 0x0 0x400000>,
+				<0x0 0x2b000000 0x0 0x400000>,
+				<0x0 0x28590000 0x0 0x100>,
+				<0x0 0x2a500000 0x0 0x40000>,
+				<0x0 0x28440000 0x0 0x40000>;
+			reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target", "cfg";
 			u-boot,dm-spl;
 			ti,dma-ring-reset-quirk;
 		};
 
 		dma-controller at 285c0000 {
+			reg =	<0x0 0x285c0000 0x0 0x100>,
+				<0x0 0x284c0000 0x0 0x4000>,
+				<0x0 0x2a800000 0x0 0x40000>,
+				<0x0 0x284a0000 0x0 0x4000>,
+				<0x0 0x2aa00000 0x0 0x40000>,
+				<0x0 0x28400000 0x0 0x2000>;
+			reg-names = "gcfg", "rchan", "rchanrt", "tchan",
+					    "tchanrt", "rflow";
 			u-boot,dm-spl;
 		};
 	};
arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi +26 -0
index c3aae65b39..41ce9fcb59 100644
@@ -40,6 +40,32 @@
 	chipid at 43000014 {
 		u-boot,dm-spl;
 	};
+
+	mcu-navss{
+		u-boot,dm-spl;
+
+		ringacc at 2b800000 {
+			reg =	<0x0 0x2b800000 0x0 0x400000>,
+				<0x0 0x2b000000 0x0 0x400000>,
+				<0x0 0x28590000 0x0 0x100>,
+				<0x0 0x2a500000 0x0 0x40000>,
+				<0x0 0x28440000 0x0 0x40000>;
+			reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target", "cfg";
+			u-boot,dm-spl;
+		};
+
+		dma-controller at 285c0000 {
+			reg =	<0x0 0x285c0000 0x0 0x100>,
+				<0x0 0x284c0000 0x0 0x4000>,
+				<0x0 0x2a800000 0x0 0x40000>,
+				<0x0 0x284a0000 0x0 0x4000>,
+				<0x0 0x2aa00000 0x0 0x40000>,
+				<0x0 0x28400000 0x0 0x2000>;
+			reg-names = "gcfg", "rchan", "rchanrt", "tchan",
+					    "tchanrt", "rflow";
+			u-boot,dm-spl;
+		};
+	};
 };
 
 &secure_proxy_main {
arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi +14 -0
index 1135de5a92..ed64f2720d 100644
@@ -54,10 +54,24 @@
 		u-boot,dm-spl;
 
 		ringacc at 2b800000 {
+			reg =	<0x0 0x2b800000 0x0 0x400000>,
+				<0x0 0x2b000000 0x0 0x400000>,
+				<0x0 0x28590000 0x0 0x100>,
+				<0x0 0x2a500000 0x0 0x40000>,
+				<0x0 0x28440000 0x0 0x40000>;
+			reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target", "cfg";
 			u-boot,dm-spl;
 		};
 
 		dma-controller at 285c0000 {
+			reg =	<0x0 0x285c0000 0x0 0x100>,
+				<0x0 0x284c0000 0x0 0x4000>,
+				<0x0 0x2a800000 0x0 0x40000>,
+				<0x0 0x284a0000 0x0 0x4000>,
+				<0x0 0x2aa00000 0x0 0x40000>,
+				<0x0 0x28400000 0x0 0x2000>;
+			reg-names = "gcfg", "rchan", "rchanrt", "tchan",
+					    "tchanrt", "rflow";
 			u-boot,dm-spl;
 		};
 	};
author maintainer
#13 lore raw

PATCH 5/7 ARM: dts: k3: Add cfg register space for ringacc and udmap

Quoted 22 lines · Lokesh Vutla
Quoted 19 lines · Vignesh Raghavendra
Quoted 15 lines · Lokesh Vutla
Quoted 8 lines · Vignesh Raghavendra

R5 SPL needs access to cfg space of Rings and UDMAP, therefore add RING CFG, TCHAN CFG and RCHAN CFG address ranges.

---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi  | 14 ++++++++++
 .../k3-j7200-common-proc-board-u-boot.dtsi    | 26 +++++++++++++++++++
 .../k3-j721e-common-proc-board-u-boot.dtsi    | 14 ++++++++++

If these are specific to R5, then it should be moved to R5 dts no? -u-boot.dtsi will be applied to A53 dts as well.

Quoted 7 lines
Quoted 5 lines

Not really.. There registers are present within respective IPs. A53/A72 use DM APIs to configure these registers whereas R5 does direct programming. I intend to add these ranges to kernel DT as well. Until then, will be in -u-boot.dtsi.

You intend to add mcu-navss ringacc to kernel dts as well. I am fine with this.

MCU RINGACC node itself is present in kernel dts, its just cfg register ranges that are not populated.

Quoted 2 lines

But please remember to update u-boot dts once you update kernel dts

Sure will do...

Regards
Vignesh

Quoted 105 lines

Thanks and regards,
Lokesh

Quoted 102 lines
Quoted 102 lines

Thanks and regards,
Lokesh

Quoted 99 lines
 3 files changed, 54 insertions(+)
arch/arm/dts/k3-am654-base-board-u-boot.dtsi +14 -0
index b0602d1dad..2840258518 100644
@@ -35,11 +35,25 @@
 		u-boot,dm-spl;
 
 		ringacc at 2b800000 {
+			reg =	<0x0 0x2b800000 0x0 0x400000>,
+				<0x0 0x2b000000 0x0 0x400000>,
+				<0x0 0x28590000 0x0 0x100>,
+				<0x0 0x2a500000 0x0 0x40000>,
+				<0x0 0x28440000 0x0 0x40000>;
+			reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target", "cfg";
 			u-boot,dm-spl;
 			ti,dma-ring-reset-quirk;
 		};
 
 		dma-controller at 285c0000 {
+			reg =	<0x0 0x285c0000 0x0 0x100>,
+				<0x0 0x284c0000 0x0 0x4000>,
+				<0x0 0x2a800000 0x0 0x40000>,
+				<0x0 0x284a0000 0x0 0x4000>,
+				<0x0 0x2aa00000 0x0 0x40000>,
+				<0x0 0x28400000 0x0 0x2000>;
+			reg-names = "gcfg", "rchan", "rchanrt", "tchan",
+					    "tchanrt", "rflow";
 			u-boot,dm-spl;
 		};
 	};
arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi +26 -0
index c3aae65b39..41ce9fcb59 100644
@@ -40,6 +40,32 @@
 	chipid at 43000014 {
 		u-boot,dm-spl;
 	};
+
+	mcu-navss{
+		u-boot,dm-spl;
+
+		ringacc at 2b800000 {
+			reg =	<0x0 0x2b800000 0x0 0x400000>,
+				<0x0 0x2b000000 0x0 0x400000>,
+				<0x0 0x28590000 0x0 0x100>,
+				<0x0 0x2a500000 0x0 0x40000>,
+				<0x0 0x28440000 0x0 0x40000>;
+			reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target", "cfg";
+			u-boot,dm-spl;
+		};
+
+		dma-controller at 285c0000 {
+			reg =	<0x0 0x285c0000 0x0 0x100>,
+				<0x0 0x284c0000 0x0 0x4000>,
+				<0x0 0x2a800000 0x0 0x40000>,
+				<0x0 0x284a0000 0x0 0x4000>,
+				<0x0 0x2aa00000 0x0 0x40000>,
+				<0x0 0x28400000 0x0 0x2000>;
+			reg-names = "gcfg", "rchan", "rchanrt", "tchan",
+					    "tchanrt", "rflow";
+			u-boot,dm-spl;
+		};
+	};
 };
 
 &secure_proxy_main {
arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi +14 -0
index 1135de5a92..ed64f2720d 100644
@@ -54,10 +54,24 @@
 		u-boot,dm-spl;
 
 		ringacc at 2b800000 {
+			reg =	<0x0 0x2b800000 0x0 0x400000>,
+				<0x0 0x2b000000 0x0 0x400000>,
+				<0x0 0x28590000 0x0 0x100>,
+				<0x0 0x2a500000 0x0 0x40000>,
+				<0x0 0x28440000 0x0 0x40000>;
+			reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target", "cfg";
 			u-boot,dm-spl;
 		};
 
 		dma-controller at 285c0000 {
+			reg =	<0x0 0x285c0000 0x0 0x100>,
+				<0x0 0x284c0000 0x0 0x4000>,
+				<0x0 0x2a800000 0x0 0x40000>,
+				<0x0 0x284a0000 0x0 0x4000>,
+				<0x0 0x2aa00000 0x0 0x40000>,
+				<0x0 0x28400000 0x0 0x2000>;
+			reg-names = "gcfg", "rchan", "rchanrt", "tchan",
+					    "tchanrt", "rflow";
 			u-boot,dm-spl;
 		};
 	};
#14 lore raw

PATCH 5/7 ARM: dts: k3: Add cfg register space for ringacc and udmap

Quoted 31 lines · Vignesh Raghavendra
Quoted 28 lines · Lokesh Vutla
Quoted 24 lines · Vignesh Raghavendra
Quoted 6 lines · Lokesh Vutla
Quoted 3 lines · Vignesh Raghavendra

R5 SPL needs access to cfg space of Rings and UDMAP, therefore add RING CFG, TCHAN CFG and RCHAN CFG address ranges.

Quoted 9 lines
Quoted 5 lines
---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi  | 14 ++++++++++
 .../k3-j7200-common-proc-board-u-boot.dtsi    | 26 +++++++++++++++++++
 .../k3-j721e-common-proc-board-u-boot.dtsi    | 14 ++++++++++

If these are specific to R5, then it should be moved to R5 dts no? -u-boot.dtsi will be applied to A53 dts as well.

Not really.. There registers are present within respective IPs. A53/A72 use DM APIs to configure these registers whereas R5 does direct programming. I intend to add these ranges to kernel DT as well. Until then, will be in -u-boot.dtsi.

Quoted 4 lines
Quoted 1 line

You intend to add mcu-navss ringacc to kernel dts as well. I am fine with this.

MCU RINGACC node itself is present in kernel dts, its just cfg register ranges that are not populated.

okay, please mention this intention in commit description. It says needed only for R5 but code is in u-boot.dtsi with the intention of being added in kernel dts. It is confusing.

Thanks and regards,
Lokesh

author maintainer
#15 lore raw

PATCH 6/7 soc: ti: k3-navss-ringacc: Add support for native configuration of rings

In reply to Vignesh Raghavendra

In absence of Device Manager (DM) services such as at R5 SPL stage, driver will have to natively setup Ring Cfg registers. Add support for the same.

Note that we still need to send RING_CFG message to TIFS via TISCI client driver in order to open up firewalls around Rings.

U-Boot specific code is in a separate file included in main driver so as to maintain similarity with kernel driver in order to ease porting of code in future.

---
 drivers/soc/ti/k3-navss-ringacc-u-boot.c | 61 ++++++++++++++++++++++++
 drivers/soc/ti/k3-navss-ringacc.c        | 36 ++++++++++++--
 2 files changed, 94 insertions(+), 3 deletions(-)
 create mode 100644 drivers/soc/ti/k3-navss-ringacc-u-boot.c
drivers/soc/ti/k3-navss-ringacc-u-boot.c new file +61 -0
new file mode 100644
index 0000000000..f958239c2a
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * U-Boot specific helpers for TI K3 AM65x NAVSS Ring accelerator
+ * Manager (RA) subsystem driver
+ *
+ * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com
+ */
+
+struct k3_nav_ring_cfg_regs {
+	u32	resv_64[16];
+	u32	ba_lo;		/* Ring Base Address Lo Register */
+	u32	ba_hi;		/* Ring Base Address Hi Register */
+	u32	size;		/* Ring Size Register */
+	u32	event;		/* Ring Event Register */
+	u32	orderid;	/* Ring OrderID Register */
+};
+
+#define KNAV_RINGACC_CFG_REGS_STEP	0x100
+
+#define KNAV_RINGACC_CFG_RING_BA_HI_ADDR_HI_MASK	GENMASK(15, 0)
+
+#define KNAV_RINGACC_CFG_RING_SIZE_QMODE_MASK		GENMASK(31, 30)
+#define KNAV_RINGACC_CFG_RING_SIZE_QMODE_SHIFT		(30)
+
+#define KNAV_RINGACC_CFG_RING_SIZE_ELSIZE_MASK		GENMASK(26, 24)
+#define KNAV_RINGACC_CFG_RING_SIZE_ELSIZE_SHIFT		(24)
+
+static void k3_ringacc_ring_reset_raw(struct k3_nav_ring *ring)
+{
+	writel(0, &ring->cfg->size);
+}
+
+static void k3_ringacc_ring_reconfig_qmode_raw(struct k3_nav_ring *ring, enum k3_nav_ring_mode mode)
+{
+	u32 val;
+
+	val = readl(&ring->cfg->size);
+	val &= KNAV_RINGACC_CFG_RING_SIZE_QMODE_MASK;
+	val |= mode << KNAV_RINGACC_CFG_RING_SIZE_QMODE_SHIFT;
+	writel(val, &ring->cfg->size);
+}
+
+static void k3_ringacc_ring_free_raw(struct k3_nav_ring *ring)
+{
+	writel(0, &ring->cfg->ba_hi);
+	writel(0, &ring->cfg->ba_lo);
+	writel(0, &ring->cfg->size);
+}
+
+static void k3_nav_ringacc_ring_cfg_raw(struct k3_nav_ring *ring)
+{
+	u32 val;
+
+	writel(lower_32_bits(ring->ring_mem_dma), &ring->cfg->ba_lo);
+	writel(upper_32_bits(ring->ring_mem_dma), &ring->cfg->ba_hi);
+
+	val = ring->mode << KNAV_RINGACC_CFG_RING_SIZE_QMODE_SHIFT |
+	      ring->elm_size << KNAV_RINGACC_CFG_RING_SIZE_ELSIZE_SHIFT |
+	      ring->size;
+	writel(val, &ring->cfg->size);
+}
drivers/soc/ti/k3-navss-ringacc.c +33 -3
index b5a5c9da98..f110d78ce1 100644
@@ -124,6 +124,7 @@ struct k3_nav_ring_state {
 /**
  * struct k3_nav_ring - RA Ring descriptor
  *
+ * @cfg - Ring configuration registers
  * @rt - Ring control/status registers
  * @fifos - Ring queues registers
  * @ring_mem_dma - Ring buffer dma address
@@ -138,6 +139,7 @@ struct k3_nav_ring_state {
  * @use_count - Use count for shared rings
  */
 struct k3_nav_ring {
+	struct k3_nav_ring_cfg_regs __iomem *cfg;
 	struct k3_nav_ring_rt_regs __iomem *rt;
 	struct k3_nav_ring_fifo_regs __iomem *fifos;
 	dma_addr_t	ring_mem_dma;
@@ -195,6 +197,8 @@ struct k3_nav_ringacc {
 	bool dual_ring;
 };
 
+#include "k3-navss-ringacc-u-boot.c"
+
 static int k3_nav_ringacc_ring_read_occ(struct k3_nav_ring *ring)
 {
 	return readl(&ring->rt->occ) & KNAV_RINGACC_RT_OCC_MASK;
@@ -330,6 +334,9 @@ static void k3_ringacc_ring_reset_sci(struct k3_nav_ring *ring)
 	struct k3_nav_ringacc *ringacc = ring->parent;
 	int ret;
 
+	if (IS_ENABLED(CONFIG_K3_DM_FW))
+		return k3_ringacc_ring_reset_raw(ring);
+
 	ret = ringacc->tisci_ring_ops->config(
 			ringacc->tisci,
 			TI_SCI_MSG_VALUE_RM_RING_COUNT_VALID,
@@ -362,6 +369,9 @@ static void k3_ringacc_ring_reconfig_qmode_sci(struct k3_nav_ring *ring,
 	struct k3_nav_ringacc *ringacc = ring->parent;
 	int ret;
 
+	if (IS_ENABLED(CONFIG_K3_DM_FW))
+		return k3_ringacc_ring_reconfig_qmode_raw(ring, mode);
+
 	ret = ringacc->tisci_ring_ops->config(
 			ringacc->tisci,
 			TI_SCI_MSG_VALUE_RM_RING_MODE_VALID,
@@ -442,6 +452,9 @@ static void k3_ringacc_ring_free_sci(struct k3_nav_ring *ring)
 	struct k3_nav_ringacc *ringacc = ring->parent;
 	int ret;
 
+	if (IS_ENABLED(CONFIG_K3_DM_FW))
+		return k3_ringacc_ring_free_raw(ring);
+
 	ret = ringacc->tisci_ring_ops->config(
 			ringacc->tisci,
 			TI_SCI_MSG_VALUE_RM_ALL_NO_ORDER,
@@ -531,11 +544,21 @@ static int k3_nav_ringacc_ring_cfg_sci(struct k3_nav_ring *ring)
 			ring->mode,
 			ring->elm_size,
 			0);
-	if (ret)
+	if (ret) {
 		dev_err(ringacc->dev, "TISCI config ring fail (%d) ring_idx %d\n",
 			ret, ring_idx);
+		return ret;
+	}
 
-	return ret;
+	/*
+	 * Above TI SCI call handles firewall configuration, cfg
+	 * register configuration still has to be done locally in
+	 * absence of RM services.
+	 */
+	if (IS_ENABLED(CONFIG_K3_DM_FW))
+		k3_nav_ringacc_ring_cfg_raw(ring);
+
+	return 0;
 }
 
 static int k3_dmaring_ring_cfg(struct k3_nav_ring *ring, struct k3_nav_ring_cfg *cfg)
@@ -951,13 +974,18 @@ static int k3_nav_ringacc_probe_dt(struct k3_nav_ringacc *ringacc)
 
 static int k3_nav_ringacc_init(struct udevice *dev, struct k3_nav_ringacc *ringacc)
 {
-	void __iomem *base_rt;
+	void __iomem *base_cfg, *base_rt;
 	int ret, i;
 
 	ret = k3_nav_ringacc_probe_dt(ringacc);
 	if (ret)
 		return ret;
 
+	base_cfg = dev_remap_addr_name(dev, "cfg");
+	pr_debug("cfg %p\n", base_cfg);
+	if (!base_cfg)
+		return -EINVAL;
+
 	base_rt = (uint32_t *)devfdt_get_addr_name(dev, "rt");
 	pr_debug("rt %p\n", base_rt);
 	if (IS_ERR(base_rt))
@@ -975,6 +1003,8 @@ static int k3_nav_ringacc_init(struct udevice *dev, struct k3_nav_ringacc *ringa
 		return -ENOMEM;
 
 	for (i = 0; i < ringacc->num_rings; i++) {
+		ringacc->rings[i].cfg = base_cfg +
+					KNAV_RINGACC_CFG_REGS_STEP * i;
 		ringacc->rings[i].rt = base_rt +
 				       KNAV_RINGACC_RT_REGS_STEP * i;
 		ringacc->rings[i].parent = ringacc;
Signature · 1 line
2.31.1
author maintainer
#16 lore raw

PATCH 7/7 dma: ti: k3-udma: Add support for native configuration of chan/flow

In reply to Vignesh Raghavendra

In absence of Device Manager (DM) services such as at R5 SPL stage, driver will have to natively setup TCHAN/RCHAN/RFLOW cfg registers. Add support for the same.

Note that we still need to send chan/flow cfg message to TIFS via TISCI client driver in order to open up firewalls around chan/flow but setting up of cfg registers is handled locally.

U-Boot specific code is in a separate file included in main driver so as to maintain similarity with kernel driver in order to ease porting of code in future.

---
 drivers/dma/ti/k3-udma-u-boot.c | 177 ++++++++++++++++++++++++++++++++
 drivers/dma/ti/k3-udma.c        |  42 +++++++-
 2 files changed, 215 insertions(+), 4 deletions(-)
 create mode 100644 drivers/dma/ti/k3-udma-u-boot.c
drivers/dma/ti/k3-udma-u-boot.c new file +177 -0
new file mode 100644
index 0000000000..3e04f551e2
@@ -0,0 +1,177 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ *  Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com
+ */
+
+#define UDMA_RCHAN_RFLOW_RNG_FLOWID_CNT_SHIFT	(16)
+
+/* How SRC/DST tag should be updated by UDMA in the descriptor's Word 3 */
+#define UDMA_RFLOW_SRCTAG_NONE		0
+#define UDMA_RFLOW_SRCTAG_CFG_TAG	1
+#define UDMA_RFLOW_SRCTAG_FLOW_ID	2
+#define UDMA_RFLOW_SRCTAG_SRC_TAG	4
+
+#define UDMA_RFLOW_DSTTAG_NONE		0
+#define UDMA_RFLOW_DSTTAG_CFG_TAG	1
+#define UDMA_RFLOW_DSTTAG_FLOW_ID	2
+#define UDMA_RFLOW_DSTTAG_DST_TAG_LO	4
+#define UDMA_RFLOW_DSTTAG_DST_TAG_HI	5
+
+#define UDMA_RFLOW_RFC_DEFAULT	\
+	((UDMA_RFLOW_SRCTAG_NONE <<  UDMA_RFLOW_RFC_SRC_TAG_HI_SEL_SHIFT) | \
+	 (UDMA_RFLOW_SRCTAG_SRC_TAG << UDMA_RFLOW_RFC_SRC_TAG_LO_SEL_SHIFT) | \
+	 (UDMA_RFLOW_DSTTAG_DST_TAG_HI << UDMA_RFLOW_RFC_DST_TAG_HI_SEL_SHIFT) | \
+	 (UDMA_RFLOW_DSTTAG_DST_TAG_LO << UDMA_RFLOW_RFC_DST_TAG_LO_SE_SHIFT))
+
+#define UDMA_RFLOW_RFx_REG_FDQ_SIZE_SHIFT	(16)
+
+/* TCHAN */
+static inline u32 udma_tchan_read(struct udma_tchan *tchan, int reg)
+{
+	if (!tchan)
+		return 0;
+	return udma_read(tchan->reg_chan, reg);
+}
+
+static inline void udma_tchan_write(struct udma_tchan *tchan, int reg, u32 val)
+{
+	if (!tchan)
+		return;
+	udma_write(tchan->reg_chan, reg, val);
+}
+
+static inline void udma_tchan_update_bits(struct udma_tchan *tchan, int reg,
+					  u32 mask, u32 val)
+{
+	if (!tchan)
+		return;
+	udma_update_bits(tchan->reg_chan, reg, mask, val);
+}
+
+/* RCHAN */
+static inline u32 udma_rchan_read(struct udma_rchan *rchan, int reg)
+{
+	if (!rchan)
+		return 0;
+	return udma_read(rchan->reg_chan, reg);
+}
+
+static inline void udma_rchan_write(struct udma_rchan *rchan, int reg, u32 val)
+{
+	if (!rchan)
+		return;
+	udma_write(rchan->reg_chan, reg, val);
+}
+
+static inline void udma_rchan_update_bits(struct udma_rchan *rchan, int reg,
+					  u32 mask, u32 val)
+{
+	if (!rchan)
+		return;
+	udma_update_bits(rchan->reg_chan, reg, mask, val);
+}
+
+/* RFLOW */
+static inline u32 udma_rflow_read(struct udma_rflow *rflow, int reg)
+{
+	if (!rflow)
+		return 0;
+	return udma_read(rflow->reg_rflow, reg);
+}
+
+static inline void udma_rflow_write(struct udma_rflow *rflow, int reg, u32 val)
+{
+	if (!rflow)
+		return;
+	udma_write(rflow->reg_rflow, reg, val);
+}
+
+static inline void udma_rflow_update_bits(struct udma_rflow *rflow, int reg,
+					  u32 mask, u32 val)
+{
+	if (!rflow)
+		return;
+	udma_update_bits(rflow->reg_rflow, reg, mask, val);
+}
+
+static void udma_alloc_tchan_raw(struct udma_chan *uc)
+{
+	u32 mode, fetch_size;
+
+	if (uc->config.pkt_mode)
+		mode = UDMA_CHAN_CFG_CHAN_TYPE_PACKET_PBRR;
+	else
+		mode = UDMA_CHAN_CFG_CHAN_TYPE_3RDP_BC_PBRR;
+
+	udma_tchan_update_bits(uc->tchan, UDMA_TCHAN_TCFG_REG,
+			       UDMA_CHAN_CFG_CHAN_TYPE_MASK, mode);
+
+	if (uc->config.dir == DMA_MEM_TO_MEM)
+		fetch_size = sizeof(struct cppi5_desc_hdr_t) >> 2;
+	else
+		fetch_size = cppi5_hdesc_calc_size(uc->config.needs_epib,
+						   uc->config.psd_size, 0) >> 2;
+
+	udma_tchan_update_bits(uc->tchan, UDMA_TCHAN_TCFG_REG,
+			       UDMA_CHAN_CFG_FETCH_SIZE_MASK, fetch_size);
+	udma_tchan_write(uc->tchan, UDMA_TCHAN_TCQ_REG,
+			 k3_nav_ringacc_get_ring_id(uc->tchan->tc_ring));
+}
+
+static void udma_alloc_rchan_raw(struct udma_chan *uc)
+{
+	struct udma_dev *ud = uc->ud;
+	int fd_ring = k3_nav_ringacc_get_ring_id(uc->rflow->fd_ring);
+	int rx_ring = k3_nav_ringacc_get_ring_id(uc->rflow->r_ring);
+	int tc_ring = k3_nav_ringacc_get_ring_id(uc->tchan->tc_ring);
+	u32 rx_einfo_present = 0, rx_psinfo_present = 0;
+	u32 mode, fetch_size, rxcq_num;
+
+	if (uc->config.pkt_mode)
+		mode = UDMA_CHAN_CFG_CHAN_TYPE_PACKET_PBRR;
+	else
+		mode = UDMA_CHAN_CFG_CHAN_TYPE_3RDP_BC_PBRR;
+
+	udma_rchan_update_bits(uc->rchan, UDMA_RCHAN_RCFG_REG,
+			       UDMA_CHAN_CFG_CHAN_TYPE_MASK, mode);
+
+	if (uc->config.dir == DMA_MEM_TO_MEM) {
+		fetch_size = sizeof(struct cppi5_desc_hdr_t) >> 2;
+		rxcq_num = tc_ring;
+	} else {
+		fetch_size = cppi5_hdesc_calc_size(uc->config.needs_epib,
+						   uc->config.psd_size, 0) >> 2;
+		rxcq_num = rx_ring;
+	}
+
+	udma_rchan_update_bits(uc->rchan, UDMA_RCHAN_RCFG_REG,
+			       UDMA_CHAN_CFG_FETCH_SIZE_MASK, fetch_size);
+	udma_rchan_write(uc->rchan, UDMA_RCHAN_RCQ_REG, rxcq_num);
+
+	if (uc->config.dir == DMA_MEM_TO_MEM)
+		return;
+
+	if (ud->match_data->type == DMA_TYPE_UDMA &&
+	    uc->rflow->id != uc->rchan->id &&
+	    uc->config.dir != DMA_MEM_TO_MEM)
+		udma_rchan_write(uc->rchan, UDMA_RCHAN_RFLOW_RNG_REG, uc->rflow->id |
+				 1 << UDMA_RCHAN_RFLOW_RNG_FLOWID_CNT_SHIFT);
+
+	if (uc->config.needs_epib)
+		rx_einfo_present = UDMA_RFLOW_RFA_EINFO;
+
+	if (uc->config.psd_size)
+		rx_psinfo_present = UDMA_RFLOW_RFA_PSINFO;
+
+	udma_rflow_write(uc->rflow, UDMA_RFLOW_REG(A),
+			 rx_einfo_present | rx_psinfo_present | rxcq_num);
+
+	udma_rflow_write(uc->rflow, UDMA_RFLOW_REG(C), UDMA_RFLOW_RFC_DEFAULT);
+	udma_rflow_write(uc->rflow, UDMA_RFLOW_REG(D),
+			 fd_ring | fd_ring << UDMA_RFLOW_RFx_REG_FDQ_SIZE_SHIFT);
+	udma_rflow_write(uc->rflow, UDMA_RFLOW_REG(E),
+			 fd_ring | fd_ring << UDMA_RFLOW_RFx_REG_FDQ_SIZE_SHIFT);
+	udma_rflow_write(uc->rflow, UDMA_RFLOW_REG(G), fd_ring);
+	udma_rflow_write(uc->rflow, UDMA_RFLOW_REG(H),
+			 fd_ring | fd_ring << UDMA_RFLOW_RFx_REG_FDQ_SIZE_SHIFT);
+}
drivers/dma/ti/k3-udma.c +38 -4

110 lines not on this page · raw message

Signature · 1 line
2.31.1
#17 lore raw

cover J72xx: R5 SPL DMA support post HSM Rearch

In reply to Vignesh Raghavendra
Quoted 25 lines · Vignesh Raghavendra

This series add DMA support for R5 SPL on J721e/J7200 SoCs post HSM Rearch.

Depends on Tero's base HSM rearch support series.

Vignesh Raghavendra (7):
mailbox: k3-sec-proxy: Add DM to DMSC communication thread
firmware: ti_sci: Implement GET_RANGE with static data
firmware: ti_sci: Add support for Resoure Management at R5 SPL stage.
ARM: dts: j72xx-r5-common-proc-board: Add DM firmware node
ARM: dts: k3: Add cfg register space for ringacc and udmap
soc: ti: k3-navss-ringacc: Add support for native configuration of
rings
dma: ti: k3-udma: Add support for native configuration of chan/flow

 arch/arm/dts/k3-am654-base-board-u-boot.dtsi  |  14 ++
 .../k3-j7200-common-proc-board-u-boot.dtsi    |  26 +++
 .../arm/dts/k3-j7200-r5-common-proc-board.dts |  17 ++
 .../k3-j721e-common-proc-board-u-boot.dtsi    |  14 ++
 .../arm/dts/k3-j721e-r5-common-proc-board.dts |  18 ++
 .../firmware/ti,j721e-dm-sci.txt              |  32 ++++
 drivers/dma/ti/k3-udma-u-boot.c               | 177 ++++++++++++++++++
 drivers/dma/ti/k3-udma.c                      |  42 ++++-
 drivers/firmware/ti_sci.c                     | 107 +++++++++++
 drivers/firmware/ti_sci_static_data.h         |  92 +++++++++
Quoted 8 lines
 drivers/mailbox/k3-sec-proxy.c                |   2 +-
 drivers/soc/ti/k3-navss-ringacc-u-boot.c      |  61 ++++++
 drivers/soc/ti/k3-navss-ringacc.c             |  36 +++-
 13 files changed, 630 insertions(+), 8 deletions(-)
 create mode 100644 doc/device-tree-bindings/firmware/ti,j721e-dm-sci.txt
 create mode 100644 drivers/dma/ti/k3-udma-u-boot.c
 create mode 100644 drivers/firmware/ti_sci_static_data.h
 create mode 100644 drivers/soc/ti/k3-navss-ringacc-u-boot.c

Seems fine to me, thanks.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210511/7c518498/attachment.sig>