mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/6] Enhance TI-SCI FFI with ABI5.0 support
@ 2026-09-30 19:41 Beleswar Padhi
  2026-09-30 19:41 ` [PATCH 1/6] dt-bindings: arm: keystone: ti,sci: Update nodename pattern Beleswar Padhi
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Beleswar Padhi @ 2026-09-30 19:41 UTC (permalink / raw)
  To: nm, kristo, ssantosh
  Cc: linux-arm-kernel, linux-kernel, afd, u-kumar1, vigneshr, b-padhi,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree

The previous TI K2G and K3 architectures were tightly coupled systems in
terms of Safety and Security. All the TI-SCI messages from HLOS (Linux)
were sent to a single sec proxy thread terminating at the core running
Safety service (DM). In K2G systems, DM handled both Safety & Security
requests by itself. Whereas in K3 systems, DM serviced the Safety
requests itself, and forwarded the Security requests to core running
Security service (TIFS) on the HLOS's behalf. This posed various
limitations:
   a. Increased latency: An extra forwarding hop through DM adds latency
      in requests and responses.
   b. Freedom From Interference (FFI) concerns: Having Safety service
      proxy Security's requests (& vice versa) undermines the isolation
      and FFI of the system.
   c. Potential Dealock Scenario: Forwarding messages between Safety and
      Security cores can result in a deadlock if there are circular
      dependencies.

To eliminate all the above limitations, the TI TDA54 class of SoCs
introduce an architectural change: Isolation of Security and Safety
services. To realize this enhanced isolation in hardware, two
independent sec proxy threads are now provided for HLOS to communicate
separately with the Security and Safety cores respectively. And the
TI-SCI message forwarding has been eliminated in Software. The System
Firmware ABI5.0 version necessitates this improved isolation and FFI
change.

This series adds the support for TI TDA54 PDM System Controller across
Devicetree bindings and TI-SCI Driver to support the ABI 5.0 change.

Note:
a. The first half of the series i.e, patches
   [PATCH 01/06] - [PATCH 02/06] are independent and can be applied
   directly.

b. The second half of the series i.e, patches
   [PATCH 03/06] - [PATCH 06/06] is dependent on the following 2 series
   1. https://lore.kernel.org/all/20260930172948.2901336-1-b-padhi@ti.com/
   2. https://lore.kernel.org/all/20260930160607.2674980-1-b-padhi@ti.com/

Testing done:
 - Build and Boot tested on all Keystone and K3 platforms.
 - Verified ABI5.0 core and device operations on TI TDA54 platform.
   (after applying an out-of-tree patch to add DTS support)
 - Verified that none of the patches in the series generate any warnings
   or errors.

Logs:
https://gist.github.com/3V3RYONE/d821cea46f5dc1e70a759c97878fa487

Cc: Nishanth Menon <nm@ti.com>
Cc: Tero Kristo <kristo@kernel.org>
Cc: Santosh Shilimkar <ssantosh@kernel.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Beleswar Padhi (6):
  dt-bindings: arm: keystone: ti,sci: Update nodename pattern
  dt-bindings: arm: keystone: ti,sci: Add ti,tda54-sci-pdm compatible
  firmware: ti: ti_sci_core: Add ABI5.0 Enhancements and TDA54 PDM SCI
    support
  firmware: ti: ti_sci_device: Add ABI5.0 compliant Device and Reset
    APIs
  firmware: ti: ti_sci_clock: Add ABI5.0 compliant Clock APIs
  firmware: ti: ti_sci_rm: Add ABI5.0 compliant basic RM APIs

 .../bindings/arm/keystone/ti,sci.yaml         |  48 ++-
 drivers/firmware/ti/ti_sci.h                  | 233 +++++++++++
 drivers/firmware/ti/ti_sci_clock.c            | 380 ++++++++++++++++++
 drivers/firmware/ti/ti_sci_core.c             | 204 ++++++++--
 drivers/firmware/ti/ti_sci_device.c           |  62 +++
 drivers/firmware/ti/ti_sci_rm.c               | 148 +++++++
 6 files changed, 1039 insertions(+), 36 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/6] dt-bindings: arm: keystone: ti,sci: Update nodename pattern
  2026-09-30 19:41 [PATCH 0/6] Enhance TI-SCI FFI with ABI5.0 support Beleswar Padhi
@ 2026-09-30 19:41 ` Beleswar Padhi
  2026-09-30 19:41 ` [PATCH 2/6] dt-bindings: arm: keystone: ti,sci: Add ti,tda54-sci-pdm compatible Beleswar Padhi
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Beleswar Padhi @ 2026-09-30 19:41 UTC (permalink / raw)
  To: nm, kristo, ssantosh
  Cc: linux-arm-kernel, linux-kernel, afd, u-kumar1, vigneshr, b-padhi,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree

The $nodename pattern for TI-SCI controllers mandates specifying a unit
address, which in turn requires a 'reg' property. This 'reg' is only
used to describe an optional memory-mapped debug-messages region.

Some controllers may not implement this debug region, so it has no 'reg'
and unit address. Therefore, relax the $nodename pattern to allow the
unit address to be omitted for such controllers. Keep the unit address
mandatory for the existing ti,k2g-sci and ti,am654-sci controllers.

Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
---
Note: This patch is independent can be applied directly.

Cc: Nishanth Menon <nm@ti.com>
Cc: Tero Kristo <kristo@kernel.org>
Cc: Santosh Shilimkar <ssantosh@kernel.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

 .../devicetree/bindings/arm/keystone/ti,sci.yaml  | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml b/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
index 25a2b42105e54..67acce8a559a1 100644
--- a/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
+++ b/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
@@ -30,7 +30,7 @@ description: |
 
 properties:
   $nodename:
-    pattern: "^system-controller@[0-9a-f]+$"
+    pattern: "^system-controller(@[0-9a-f]+)?$"
 
   compatible:
     oneOf:
@@ -84,6 +84,19 @@ required:
   - mbox-names
   - mboxes
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - ti,k2g-sci
+              - ti,am654-sci
+    then:
+      properties:
+        $nodename:
+          pattern: "^system-controller@[0-9a-f]+$"
+
 additionalProperties: false
 
 examples:
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/6] dt-bindings: arm: keystone: ti,sci: Add ti,tda54-sci-pdm compatible
  2026-09-30 19:41 [PATCH 0/6] Enhance TI-SCI FFI with ABI5.0 support Beleswar Padhi
  2026-09-30 19:41 ` [PATCH 1/6] dt-bindings: arm: keystone: ti,sci: Update nodename pattern Beleswar Padhi
@ 2026-09-30 19:41 ` Beleswar Padhi
  2026-09-30 19:41 ` [PATCH 3/6] firmware: ti: ti_sci_core: Add ABI5.0 Enhancements and TDA54 PDM SCI support Beleswar Padhi
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Beleswar Padhi @ 2026-09-30 19:41 UTC (permalink / raw)
  To: nm, kristo, ssantosh
  Cc: linux-arm-kernel, linux-kernel, afd, u-kumar1, vigneshr, b-padhi,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree

The previous TI K2G and K3 architectures were tightly coupled systems in
terms of Safety and Security. All the TI-SCI messages from HLOS (Linux)
were sent to a single sec proxy thread terminating at the core running
Safety service (DM). In K2G systems, DM handled both Safety & Security
requests by itself. Whereas in K3 systems, DM serviced the Safety
requests itself, and forwarded the Security requests to core running
Security service (TIFS) on the HLOS's behalf. This posed various
limitations:
   a. Increased latency: An extra forwarding hop through DM adds latency
      in requests and responses.
   b. Freedom From Interference (FFI) concerns: Having Safety service
      proxy Security's requests (& vice versa) undermines the isolation
      and FFI of the system.
   c. Potential Deadlock Scenario: Forwarding messages between Safety
      and Security cores can result in a deadlock if there are circular
      dependencies.

To eliminate all the above limitations, the TI TDA54 class of SoCs
introduce an architectural change: Isolation of Security and Safety
services. To realize this enhanced isolation in hardware, two
independent sec proxy threads are now provided for HLOS to communicate
separately with the Security and Safety cores respectively. And the
TI-SCI message forwarding has been eliminated in Software. The System
Firmware ABI5.0 version necessitates this improved isolation and FFI
change.

Add the compatible string for TI TDA54 SoC PDM system controller to
support ABI5.0 communication protocol.

Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
---
Note: This patch is independent and can be applied directly.

Cc: Nishanth Menon <nm@ti.com>
Cc: Tero Kristo <kristo@kernel.org>
Cc: Santosh Shilimkar <ssantosh@kernel.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

 .../bindings/arm/keystone/ti,sci.yaml         | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml b/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
index 67acce8a559a1..f0548382f7d52 100644
--- a/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
+++ b/Documentation/devicetree/bindings/arm/keystone/ti,sci.yaml
@@ -20,6 +20,11 @@ description: |
   initialized early into boot process and provides services to Operating Systems
   on multiple processors including ones running Linux.
 
+  The TI TDA54 SoC, however, has two independent system controller instances - a
+  PDM (Power and Device Management) system controller, which handles Power,
+  Device, Clock, and Reset Management, and a separate SMS (Security Management
+  Subsystem) system controller, which handles security services.
+
   See https://software-dl.ti.com/tisci/esd/latest/index.html for protocol definition.
 
   The TI-SCI node describes the Texas Instrument's System Controller entity node.
@@ -40,6 +45,10 @@ properties:
       - description: System controller on TI AM654 SoC
         items:
           - const: ti,am654-sci
+      - description: |
+          System controller for Power and Device Management on TI TDA54 SoC
+        items:
+          - const: ti,tda54-sci-pdm
 
   reg-names:
     description: |
@@ -135,3 +144,27 @@ examples:
         #reset-cells = <2>;
       };
     };
+
+  - |
+    pdm: system-controller {
+      compatible = "ti,tda54-sci-pdm";
+      mbox-names = "rx", "tx";
+      mboxes = <&main_secure_proxy1 4>,
+               <&main_secure_proxy1 435>;
+      ti,host-id = <66>;
+
+      k3_pdm_pds: power-controller {
+        compatible = "ti,sci-pm-domain";
+        #power-domain-cells = <2>;
+      };
+
+      k3_pdm_clks: clock-controller {
+        compatible = "ti,k2g-sci-clk";
+        #clock-cells = <2>;
+      };
+
+      k3_pdm_reset: reset-controller {
+        compatible = "ti,sci-reset";
+        #reset-cells = <2>;
+      };
+    };
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/6] firmware: ti: ti_sci_core: Add ABI5.0 Enhancements and TDA54 PDM SCI support
  2026-09-30 19:41 [PATCH 0/6] Enhance TI-SCI FFI with ABI5.0 support Beleswar Padhi
  2026-09-30 19:41 ` [PATCH 1/6] dt-bindings: arm: keystone: ti,sci: Update nodename pattern Beleswar Padhi
  2026-09-30 19:41 ` [PATCH 2/6] dt-bindings: arm: keystone: ti,sci: Add ti,tda54-sci-pdm compatible Beleswar Padhi
@ 2026-09-30 19:41 ` Beleswar Padhi
  2026-09-30 19:41 ` [PATCH 4/6] firmware: ti: ti_sci_device: Add ABI5.0 compliant Device and Reset APIs Beleswar Padhi
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Beleswar Padhi @ 2026-09-30 19:41 UTC (permalink / raw)
  To: nm, kristo, ssantosh
  Cc: linux-arm-kernel, linux-kernel, afd, u-kumar1, vigneshr, b-padhi

The previous TI K2G and K3 architectures were tightly coupled systems in
terms of Safety and Security. All the TI-SCI messages from HLOS (Linux)
were sent to a single sec proxy thread terminating at the core running
Safety service (DM). In K2G systems, DM handled both Safety & Security
requests by itself. Whereas in K3 systems, DM serviced the Safety
requests itself, and forwarded the Security requests to core running
Security service (TIFS) on the HLOS's behalf. This posed various
limitations:
   a. Increased latency: An extra forwarding hop through DM adds latency
      in requests and responses.
   b. Freedom From Interference (FFI) concerns: Having Safety service
      proxy Security's requests (& vice versa) undermines the isolation
      and FFI of the system.
   c. Potential Deadlock Scenario: Forwarding messages between Safety
      and Security cores can result in a deadlock if there are circular
      dependencies.

To eliminate all the above limitations, the TI TDA54 class of SoCs
introduce an architectural change: Isolation of Security and Safety
services. To realize this enhanced isolation in hardware, two
independent sec proxy threads are now provided for HLOS to communicate
separately with the Security and Safety cores respectively. And the
TI-SCI message forwarding has been eliminated in Software.

The System Firmware ABI5.0 version necessitates this improved isolation
and FFI change by splitting the TI-SCI message IDs into two distinct
address spaces differing in the MSB. As a result, the system reset
message has been re-assigned an ID from the Safety address space:
TI_SCI_MSG_SYS_RESET_ABI5_PDM.

Add support in the driver to probe PDM system controller and add new
ABI5 compliant APIs for Generic system control (Version, System reset).
Existing system controller's support remain unaffected with this change.

Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
---
Note:
This patch is dependent on the following 2 series
1. https://lore.kernel.org/all/20260930172948.2901336-1-b-padhi@ti.com/
2. https://lore.kernel.org/all/20260930160607.2674980-1-b-padhi@ti.com/

 drivers/firmware/ti/ti_sci.h      |  36 ++++++
 drivers/firmware/ti/ti_sci_core.c | 184 ++++++++++++++++++++++++------
 2 files changed, 185 insertions(+), 35 deletions(-)

diff --git a/drivers/firmware/ti/ti_sci.h b/drivers/firmware/ti/ti_sci.h
index 8f9f0b1aa767d..708cc95dfc48c 100644
--- a/drivers/firmware/ti/ti_sci.h
+++ b/drivers/firmware/ti/ti_sci.h
@@ -12,6 +12,7 @@
 #ifndef __TI_SCI_H
 #define __TI_SCI_H
 
+#include <linux/bits.h>
 #include <linux/compiler_types.h>
 #include <linux/completion.h>
 #include <linux/container_of.h>
@@ -63,12 +64,14 @@ struct ti_sci_xfers_info {
  * @max_msgs: Maximum number of messages that can be pending
  *		  simultaneously in the system
  * @max_msg_size: Maximum size of data per message that can be handled.
+ * @sci_services: bitmap representing services supported by SCI
  */
 struct ti_sci_desc {
 	u8 default_host_id;
 	int max_rx_timeout_ms;
 	int max_msgs;
 	int max_msg_size;
+	u8 sci_services;
 };
 
 /**
@@ -115,6 +118,9 @@ struct ti_sci_info {
 #define cl_to_ti_sci_info(c)	container_of(c, struct ti_sci_info, cl)
 #define handle_to_ti_sci_info(h) container_of(h, struct ti_sci_info, handle)
 
+#define TI_SCI_SUPPORTS_PDM_OPS	BIT(0)
+#define TI_SCI_SUPPORTS_SEC_OPS	BIT(1)
+
 /* Generic Messages */
 #define TI_SCI_MSG_ENABLE_WDT	0x0000
 #define TI_SCI_MSG_WAKE_RESET	0x0001
@@ -122,7 +128,11 @@ struct ti_sci_info {
 #define TI_SCI_MSG_WAKE_REASON	0x0003
 #define TI_SCI_MSG_GOODBYE	0x0004
 #define TI_SCI_MSG_SYS_RESET	0x0005
+/* ABI5.0 PDM Generic Message */
+#define TI_SCI_MSG_VERSION_ABI5_PDM	0x000F
 #define TI_SCI_MSG_QUERY_FW_CAPS	0x0022
+/* ABI5.0 PDM System Reset Message */
+#define TI_SCI_MSG_SYS_RESET_ABI5_PDM	0x0400
 
 /* Device requests */
 #define TI_SCI_MSG_SET_DEVICE_STATE	0x0200
@@ -233,6 +243,32 @@ struct ti_sci_msg_resp_version {
 	u8 abi_minor;
 } __packed;
 
+/**
+ * struct ti_sci_msg_resp_version_abi5_pdm - Response for a PDM get_version msg
+ * @hdr:		Generic header
+ * @version:		Version number of the PDM firmware
+ * @sub_version:	Sub-version number of the PDM firmware
+ * @patch_version:	Patch version number of the PDM firmware
+ * @abi_major:		Major version of the ABI that PDM firmware supports
+ * @abi_minor:		Minor version of the ABI that PDM firmware supports
+ * @sci_server_version:	String describing the PDM SCI server version
+ *
+ * In general, ABI version changes follow the rule that minor version increments
+ * are backward compatible. Major revision changes in ABI may not be
+ * backward compatible.
+ *
+ * Response to a message with message type TI_SCI_MSG_VERSION_ABI5_PDM
+ */
+struct ti_sci_msg_resp_version_abi5_pdm {
+	struct	ti_sci_msg_hdr hdr;
+	u16	version;
+	u8	sub_version;
+	u8	patch_version;
+	u8	abi_major;
+	u8	abi_minor;
+	char	sci_server_version[26];
+} __packed;
+
 /**
  * struct ti_sci_msg_req_reboot - Reboot the SoC
  * @hdr:	Generic Header
diff --git a/drivers/firmware/ti/ti_sci_core.c b/drivers/firmware/ti/ti_sci_core.c
index 1f7484b118375..00c43d699e64c 100644
--- a/drivers/firmware/ti/ti_sci_core.c
+++ b/drivers/firmware/ti/ti_sci_core.c
@@ -80,6 +80,8 @@ static int ti_sci_debugfs_create(struct platform_device *pdev,
 	/* Debug region is optional */
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
 					   "debug_messages");
+	if (!res)
+		return 0;
 	info->debug_region = devm_ioremap_resource(dev, res);
 	if (IS_ERR(info->debug_region))
 		return 0;
@@ -459,6 +461,36 @@ static int ti_sci_cmd_get_revision(struct ti_sci_info *info)
 	return 0;
 }
 
+/*
+ * ti_sci_cmd_get_revision_abi5_pdm() - command to get version of PDM SCI
+ * @info:	Pointer to SCI entity information
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_cmd_get_revision_abi5_pdm(struct ti_sci_info *info)
+{
+	struct ti_sci_handle *handle = &info->handle;
+	struct ti_sci_version_info *ver = &handle->version;
+	struct ti_sci_msg_hdr req;
+	struct ti_sci_msg_resp_version_abi5_pdm resp;
+	int ret;
+
+	ret = ti_sci_do_xfer(handle, TI_SCI_MSG_VERSION_ABI5_PDM,
+			     TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+			     &req, sizeof(req),
+			     &resp, sizeof(resp));
+	if (ret)
+		return ret;
+
+	ver->abi_major = resp.abi_major;
+	ver->abi_minor = resp.abi_minor;
+	ver->firmware_revision = resp.version;
+	strscpy(ver->firmware_description, resp.sci_server_version,
+		sizeof(resp.sci_server_version));
+
+	return 0;
+}
+
 /**
  * ti_sci_cmd_prepare_sleep() - Prepare system for system suspend
  * @handle:		pointer to TI SCI handle
@@ -620,6 +652,28 @@ static int ti_sci_cmd_core_reboot(const struct ti_sci_handle *handle)
 	return 0;
 }
 
+/**
+ * ti_sci_cmd_core_reboot_abi5() - Command to request system reset (ABI5)
+ * @handle:	Pointer to TI SCI handle
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_core_reboot_abi5(const struct ti_sci_handle *handle)
+{
+	struct ti_sci_msg_req_reboot req;
+	struct ti_sci_msg_hdr resp;
+	int ret = 0;
+
+	ret = ti_sci_do_xfer(handle, TI_SCI_MSG_SYS_RESET_ABI5_PDM,
+			     TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+			     &req, sizeof(req),
+			     &resp, sizeof(resp));
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
 /*
  * ti_sci_setup_ops() - Setup the operations structures
  * @info:	pointer to TISCI pointer
@@ -937,6 +991,24 @@ static int tisci_reboot_handler(struct sys_off_data *data)
 	return NOTIFY_BAD;
 }
 
+/**
+ * tisci_reboot_handler_abi5() - Restart handler for ABI5 system controllers
+ * @data:	sys-off data, with @data->cb_data pointing to the TISCI info
+ *
+ * Return: NOTIFY_BAD, as control is not expected to return here once the
+ * system reset request has been accepted.
+ */
+static int tisci_reboot_handler_abi5(struct sys_off_data *data)
+{
+	struct ti_sci_info *info = data->cb_data;
+	const struct ti_sci_handle *handle = &info->handle;
+
+	ti_sci_cmd_core_reboot_abi5(handle);
+
+	/* call fail OR pass, we should not be here in the first place */
+	return NOTIFY_BAD;
+}
+
 static int ti_sci_prepare_system_suspend(struct ti_sci_info *info)
 {
 	/*
@@ -1122,6 +1194,7 @@ static const struct ti_sci_desc ti_sci_pmmc_k2g_desc = {
 	/* Limited by MBOX_TX_QUEUE_LEN. K2G can handle up to 128 messages! */
 	.max_msgs = 20,
 	.max_msg_size = 64,
+	.sci_services = TI_SCI_SUPPORTS_PDM_OPS | TI_SCI_SUPPORTS_SEC_OPS,
 };
 
 /* Description for AM654 */
@@ -1132,11 +1205,24 @@ static const struct ti_sci_desc ti_sci_pmmc_am654_desc = {
 	/* Limited by MBOX_TX_QUEUE_LEN. K2G can handle up to 128 messages! */
 	.max_msgs = 20,
 	.max_msg_size = 60,
+	.sci_services = TI_SCI_SUPPORTS_PDM_OPS | TI_SCI_SUPPORTS_SEC_OPS,
+};
+
+/* Description for TDA54 PDM System controller */
+static const struct ti_sci_desc ti_sci_pdm_tda54_desc = {
+	.default_host_id = 66,
+	/* Conservative duration */
+	.max_rx_timeout_ms = 10000,
+	/* Limited by MBOX_TX_QUEUE_LEN. TDA54 can handle up to 444 messages! */
+	.max_msgs = 20,
+	.max_msg_size = 60,
+	.sci_services = TI_SCI_SUPPORTS_PDM_OPS,
 };
 
 static const struct of_device_id ti_sci_of_match[] = {
 	{.compatible = "ti,k2g-sci", .data = &ti_sci_pmmc_k2g_desc},
 	{.compatible = "ti,am654-sci", .data = &ti_sci_pmmc_am654_desc},
+	{.compatible = "ti,tda54-sci-pdm", .data = &ti_sci_pdm_tda54_desc},
 	{ /* Sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, ti_sci_of_match);
@@ -1151,6 +1237,7 @@ static int ti_sci_probe(struct platform_device *pdev)
 	int ret = -EINVAL;
 	int i;
 	u32 h_id;
+	u64 fw_caps;
 
 	desc = device_get_match_data(dev);
 
@@ -1228,43 +1315,73 @@ static int ti_sci_probe(struct platform_device *pdev)
 		ret = PTR_ERR(info->chan_tx);
 		goto out;
 	}
-	ret = ti_sci_cmd_get_revision(info);
-	if (ret) {
-		dev_err(dev, "Unable to communicate with TISCI(%d)\n", ret);
-		goto out;
-	}
 
-	ti_sci_msg_cmd_query_fw_caps(&info->handle, &info->fw_caps);
-	dev_dbg(dev, "Detected firmware capabilities: %s%s%s%s%s%s%s%s\n",
-		info->fw_caps & MSG_FLAG_CAPS_GENERIC ? "Generic" : "",
-		info->fw_caps & MSG_FLAG_CAPS_LPM_PARTIAL_IO ? " Partial-IO" : "",
-		info->fw_caps & MSG_FLAG_CAPS_LPM_DM_MANAGED ? " DM-Managed" : "",
-		info->fw_caps & MSG_FLAG_CAPS_LPM_ABORT ? " LPM-Abort" : "",
-		info->fw_caps & MSG_FLAG_CAPS_IO_ISOLATION ? " IO-Isolation" : "",
-		info->fw_caps & MSG_FLAG_CAPS_LPM_BOARDCFG_MANAGED ? " BoardConfig-Managed" : "",
-		info->fw_caps & MSG_FLAG_CAPS_LPM_IRQ_CONTEXT_LOST ? " IRQ-Context-Lost" : "",
-		info->fw_caps & MSG_FLAG_CAPS_LPM_CLK_CONTEXT_LOST ? " Clk-Context-Lost" : ""
-	);
-
-	ti_sci_setup_ops(info);
-
-	ret = devm_register_restart_handler(dev, tisci_reboot_handler, info);
-	if (ret) {
-		dev_err(dev, "reboot registration fail(%d)\n", ret);
-		goto out;
-	}
+	/* Handle System Controller specific probe routine */
+	switch (info->desc->sci_services) {
+	case TI_SCI_SUPPORTS_PDM_OPS | TI_SCI_SUPPORTS_SEC_OPS:
+		ret = ti_sci_cmd_get_revision(info);
+		if (ret) {
+			dev_err(dev, "Unable to communicate with TISCI(%d)\n", ret);
+			goto out;
+		}
+
+		ti_sci_msg_cmd_query_fw_caps(&info->handle, &info->fw_caps);
+		fw_caps = info->fw_caps;
+		dev_dbg(dev, "Detected firmware capabilities: %s%s%s%s%s%s%s%s\n",
+			fw_caps & MSG_FLAG_CAPS_GENERIC ? "Generic" : "",
+			fw_caps & MSG_FLAG_CAPS_LPM_PARTIAL_IO ? " Partial-IO" : "",
+			fw_caps & MSG_FLAG_CAPS_LPM_DM_MANAGED ? " DM-Managed" : "",
+			fw_caps & MSG_FLAG_CAPS_LPM_ABORT ? " LPM-Abort" : "",
+			fw_caps & MSG_FLAG_CAPS_IO_ISOLATION ? " IO-Isolation" : "",
+			fw_caps & MSG_FLAG_CAPS_LPM_BOARDCFG_MANAGED ? " BoardConfig-Managed" : "",
+			fw_caps & MSG_FLAG_CAPS_LPM_IRQ_CONTEXT_LOST ? " IRQ-Context-Lost" : "",
+			fw_caps & MSG_FLAG_CAPS_LPM_CLK_CONTEXT_LOST ? " Clk-Context-Lost" : ""
+			);
+
+		ti_sci_setup_ops(info);
+
+		ret = devm_register_restart_handler(dev, tisci_reboot_handler, info);
+		if (ret) {
+			dev_err(dev, "reboot registration fail(%d)\n", ret);
+			goto out;
+		}
+
+		if (info->fw_caps & MSG_FLAG_CAPS_LPM_PARTIAL_IO) {
+			ret = devm_register_sys_off_handler(dev,
+							    SYS_OFF_MODE_POWER_OFF,
+							    SYS_OFF_PRIO_FIRMWARE,
+							    ti_sci_sys_off_handler,
+							    info);
+
+			if (ret) {
+				dev_err(dev, "Failed to register sys_off_handler %pe\n",
+					ERR_PTR(ret));
+				goto out;
+			}
+		}
 
-	if (info->fw_caps & MSG_FLAG_CAPS_LPM_PARTIAL_IO) {
-		ret = devm_register_sys_off_handler(dev,
-						    SYS_OFF_MODE_POWER_OFF,
-						    SYS_OFF_PRIO_FIRMWARE,
-						    ti_sci_sys_off_handler,
-						    info);
+		if (info->fw_caps & MSG_FLAG_CAPS_LPM_IRQ_CONTEXT_LOST)
+			hash_init(info->irqs);
+		break;
+
+	case TI_SCI_SUPPORTS_PDM_OPS:
+		ret = ti_sci_cmd_get_revision_abi5_pdm(info);
+		if (ret) {
+			dev_err(dev, "Unable to communicate with PDM(%d)\n", ret);
+			goto out;
+		}
+
+		ret = devm_register_restart_handler(dev, tisci_reboot_handler_abi5, info);
 		if (ret) {
-			dev_err(dev, "Failed to register sys_off_handler %pe\n",
-				ERR_PTR(ret));
+			dev_err(dev, "reboot registration fail(%d)\n", ret);
 			goto out;
 		}
+		break;
+
+	default:
+		dev_err(dev, "Unsupported System Controller\n");
+		ret = -EINVAL;
+		goto out;
 	}
 
 	dev_info(dev, "ABI: %d.%d (firmware rev 0x%04x '%s')\n",
@@ -1280,9 +1397,6 @@ static int ti_sci_probe(struct platform_device *pdev)
 	if (ret)
 		goto out;
 
-	if (info->fw_caps & MSG_FLAG_CAPS_LPM_IRQ_CONTEXT_LOST)
-		hash_init(info->irqs);
-
 	ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
 	if (ret) {
 		dev_err(dev, "platform_populate failed %pe\n", ERR_PTR(ret));
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 4/6] firmware: ti: ti_sci_device: Add ABI5.0 compliant Device and Reset APIs
  2026-09-30 19:41 [PATCH 0/6] Enhance TI-SCI FFI with ABI5.0 support Beleswar Padhi
                   ` (2 preceding siblings ...)
  2026-09-30 19:41 ` [PATCH 3/6] firmware: ti: ti_sci_core: Add ABI5.0 Enhancements and TDA54 PDM SCI support Beleswar Padhi
@ 2026-09-30 19:41 ` Beleswar Padhi
  2026-09-30 19:41 ` [PATCH 5/6] firmware: ti: ti_sci_clock: Add ABI5.0 compliant Clock APIs Beleswar Padhi
  2026-09-30 19:41 ` [PATCH 6/6] firmware: ti: ti_sci_rm: Add ABI5.0 compliant basic RM APIs Beleswar Padhi
  5 siblings, 0 replies; 7+ messages in thread
From: Beleswar Padhi @ 2026-09-30 19:41 UTC (permalink / raw)
  To: nm, kristo, ssantosh
  Cc: linux-arm-kernel, linux-kernel, afd, u-kumar1, vigneshr, b-padhi

The previous TI K2G and K3 architectures were tightly coupled systems in
terms of Safety and Security. All the TI-SCI messages from HLOS (Linux)
were sent to a single sec proxy thread terminating at the core running
Safety service (DM). In K2G systems, DM handled both Safety & Security
requests by itself. Whereas in K3 systems, DM serviced the Safety
requests itself, and forwarded the Security requests to core running
Security service (TIFS) on the HLOS's behalf. This posed various
limitations:
   a. Increased latency: An extra forwarding hop through DM adds latency
      in requests and responses.
   b. Freedom From Interference (FFI) concerns: Having Safety service
      proxy Security's requests (& vice versa) undermines the isolation
      and FFI of the system.
   c. Potential Deadlock Scenario: Forwarding messages between Safety
      and Security cores can result in a deadlock if there are circular
      dependencies.

To eliminate all the above limitations, the TI TDA54 class of SoCs
introduce an architectural change: Isolation of Security and Safety
services. To realize this enhanced isolation in hardware, two
independent sec proxy threads are now provided for HLOS to communicate
separately with the Security and Safety cores respectively. And the
TI-SCI message forwarding has been eliminated in Software. The System
Firmware ABI5.0 version necessitates this improved isolation
and FFI change.

In ABI5.0, the request message structure for set_device_resets API has
been updated to split the existing single reset bitmap variable into
explicit local_reset and module_reset variables. Add a new API to
extract the module reset and local reset values from reset_state
function parameter and populate them separately in the request. Any
other reset bit cannot be expressed in ABI5.0, so reject it with
-EINVAL.

ABI5.0 also exposes the exclusive status of a device in the response of
get_device_state request. But the layout of the remaining fields (like
'resets') is unchanged. Since there is no user of the exclusive status
info in Linux, reuse this same API for ABI5 and ignore the trailing 8
bytes containing it.

Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
---
Note:
This patch is dependent on the following 2 series
1. https://lore.kernel.org/all/20260930172948.2901336-1-b-padhi@ti.com/
2. https://lore.kernel.org/all/20260930160607.2674980-1-b-padhi@ti.com/

 drivers/firmware/ti/ti_sci.h        | 25 ++++++++++++
 drivers/firmware/ti/ti_sci_core.c   | 14 +++++++
 drivers/firmware/ti/ti_sci_device.c | 62 +++++++++++++++++++++++++++++
 3 files changed, 101 insertions(+)

diff --git a/drivers/firmware/ti/ti_sci.h b/drivers/firmware/ti/ti_sci.h
index 708cc95dfc48c..2f633aeab70b1 100644
--- a/drivers/firmware/ti/ti_sci.h
+++ b/drivers/firmware/ti/ti_sci.h
@@ -120,6 +120,8 @@ struct ti_sci_info {
 
 #define TI_SCI_SUPPORTS_PDM_OPS	BIT(0)
 #define TI_SCI_SUPPORTS_SEC_OPS	BIT(1)
+#define TI_SCI_LRESET_MASK	BIT(0)
+#define TI_SCI_MRESET_MASK	BIT(1)
 
 /* Generic Messages */
 #define TI_SCI_MSG_ENABLE_WDT	0x0000
@@ -407,6 +409,28 @@ struct ti_sci_msg_req_set_device_resets {
 	u32 resets;
 } __packed;
 
+/**
+ * struct ti_sci_msg_req_set_device_resets_abi5_pdm - Set the desired resets
+ *						      configuration of the device
+ * @hdr:		Generic header
+ * @id:			Indicates which device to modify
+ * @local_reset:	State of the PSC local reset of the device. 0 indicates
+ *			releasing the local reset while 1 indicates keeping it
+ *			held.
+ * @module_reset:	State of the PSC module reset of the device. 0
+ *			indicates releasing the module reset while 1 indicates
+ *			keeping it held.
+ *
+ * Request type is TI_SCI_MSG_SET_DEVICE_RESETS, responded with a generic
+ * ACK/NACK message.
+ */
+struct ti_sci_msg_req_set_device_resets_abi5_pdm {
+	struct ti_sci_msg_hdr hdr;
+	u32 id;
+	u32 local_reset;
+	u32 module_reset;
+} __packed;
+
 /**
  * struct ti_sci_msg_req_set_clock_state - Request to setup a Clock state
  * @hdr:	Generic Header, Certain flags can be set specific to the clocks:
@@ -1712,6 +1736,7 @@ int ti_sci_do_xfer(const struct ti_sci_handle *handle,
 		   void *rx_message, size_t rx_message_size);
 
 void ti_sci_setup_device_ops(struct ti_sci_dev_ops *dops);
+void ti_sci_setup_device_ops_abi5(struct ti_sci_dev_ops *dops);
 void ti_sci_setup_clock_ops(struct ti_sci_clk_ops *cops);
 void ti_sci_setup_pm_ops(struct ti_sci_pm_ops *pmops);
 void ti_sci_setup_rm_core_ops(struct ti_sci_rm_core_ops *rm_core_ops);
diff --git a/drivers/firmware/ti/ti_sci_core.c b/drivers/firmware/ti/ti_sci_core.c
index 00c43d699e64c..cea4339ac0af2 100644
--- a/drivers/firmware/ti/ti_sci_core.c
+++ b/drivers/firmware/ti/ti_sci_core.c
@@ -707,6 +707,18 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
 	ti_sci_setup_proc_ops(pops);
 }
 
+/*
+ * ti_sci_setup_ops_abi5() - Setup the operations structures (ABI5)
+ * @info:	pointer to TISCI pointer
+ */
+static void ti_sci_setup_ops_abi5(struct ti_sci_info *info)
+{
+	struct ti_sci_ops *ops = &info->handle.ops;
+	struct ti_sci_dev_ops *dops = &ops->dev_ops;
+
+	ti_sci_setup_device_ops_abi5(dops);
+}
+
 /**
  * ti_sci_get_handle() - Get the TI SCI handle for a device
  * @dev:	Pointer to device for which we want SCI handle
@@ -1371,6 +1383,8 @@ static int ti_sci_probe(struct platform_device *pdev)
 			goto out;
 		}
 
+		ti_sci_setup_ops_abi5(info);
+
 		ret = devm_register_restart_handler(dev, tisci_reboot_handler_abi5, info);
 		if (ret) {
 			dev_err(dev, "reboot registration fail(%d)\n", ret);
diff --git a/drivers/firmware/ti/ti_sci_device.c b/drivers/firmware/ti/ti_sci_device.c
index cb9888ca54a35..06f5a4b3f24bd 100644
--- a/drivers/firmware/ti/ti_sci_device.c
+++ b/drivers/firmware/ti/ti_sci_device.c
@@ -48,6 +48,11 @@ static int ti_sci_set_device_state(const struct ti_sci_handle *handle,
  * @p_state:	pointer to p_state
  * @c_state:	pointer to c_state
  *
+ * Note: PDM ABI5 returns an additional 'exclusive_status' device info along with
+ * the above ones. However, since there is no user of the 'exclusive_status'
+ * info in Linux, reuse this same API for ABI5 and ignore the trailing 8 bytes
+ * containing exclusive status info.
+ *
  * Return: 0 if all went fine, else return appropriate error.
  */
 static int ti_sci_get_device_state(const struct ti_sci_handle *handle,
@@ -349,6 +354,41 @@ static int ti_sci_cmd_set_device_resets(const struct ti_sci_handle *handle,
 	return 0;
 }
 
+/**
+ * ti_sci_cmd_set_device_resets_abi5_pdm() - command to set resets for device
+ *					     managed by TISCI
+ * @handle:	Pointer to TISCI handle as retrieved by *ti_sci_get_handle
+ * @id:		Device Identifier
+ * @reset_state: Device reset bit field. Only the PSC local reset (bit 0) and
+ *		 module reset (bit 1) are supported.
+ *
+ * Return: 0 if all went fine, -EINVAL if @reset_state has any other bit set,
+ * else return appropriate error.
+ */
+static int ti_sci_cmd_set_device_resets_abi5_pdm(const struct ti_sci_handle *handle,
+						 u32 id, u32 reset_state)
+{
+	struct ti_sci_msg_req_set_device_resets_abi5_pdm req;
+	struct ti_sci_msg_hdr resp;
+	int ret = 0;
+
+	if (reset_state & ~(TI_SCI_LRESET_MASK | TI_SCI_MRESET_MASK))
+		return -EINVAL;
+
+	req.id = id;
+	req.local_reset = !!(reset_state & TI_SCI_LRESET_MASK);
+	req.module_reset = !!(reset_state & TI_SCI_MRESET_MASK);
+
+	ret = ti_sci_do_xfer(handle, TI_SCI_MSG_SET_DEVICE_RESETS,
+			     TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+			     &req, sizeof(req),
+			     &resp, sizeof(resp));
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
 /**
  * ti_sci_cmd_get_device_resets() - Get reset state for device managed
  *				    by TISCI
@@ -386,3 +426,25 @@ void ti_sci_setup_device_ops(struct ti_sci_dev_ops *dops)
 	dops->set_device_resets = ti_sci_cmd_set_device_resets;
 	dops->get_device_resets = ti_sci_cmd_get_device_resets;
 }
+
+/*
+ * ti_sci_setup_device_ops_abi5() - Setup the device operations structures (ABI5)
+ * @dops:	pointer to TISCI device ops structure
+ */
+void ti_sci_setup_device_ops_abi5(struct ti_sci_dev_ops *dops)
+{
+	dops->get_device = ti_sci_cmd_get_device;
+	dops->get_device_exclusive = ti_sci_cmd_get_device_exclusive;
+	dops->idle_device = ti_sci_cmd_idle_device;
+	dops->idle_device_exclusive = ti_sci_cmd_idle_device_exclusive;
+	dops->put_device = ti_sci_cmd_put_device;
+
+	dops->is_valid = ti_sci_cmd_dev_is_valid;
+	dops->get_context_loss_count = ti_sci_cmd_dev_get_clcnt;
+	dops->is_idle = ti_sci_cmd_dev_is_idle;
+	dops->is_stop = ti_sci_cmd_dev_is_stop;
+	dops->is_on = ti_sci_cmd_dev_is_on;
+	dops->is_transitioning = ti_sci_cmd_dev_is_trans;
+	dops->set_device_resets = ti_sci_cmd_set_device_resets_abi5_pdm;
+	dops->get_device_resets = ti_sci_cmd_get_device_resets;
+}
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 5/6] firmware: ti: ti_sci_clock: Add ABI5.0 compliant Clock APIs
  2026-09-30 19:41 [PATCH 0/6] Enhance TI-SCI FFI with ABI5.0 support Beleswar Padhi
                   ` (3 preceding siblings ...)
  2026-09-30 19:41 ` [PATCH 4/6] firmware: ti: ti_sci_device: Add ABI5.0 compliant Device and Reset APIs Beleswar Padhi
@ 2026-09-30 19:41 ` Beleswar Padhi
  2026-09-30 19:41 ` [PATCH 6/6] firmware: ti: ti_sci_rm: Add ABI5.0 compliant basic RM APIs Beleswar Padhi
  5 siblings, 0 replies; 7+ messages in thread
From: Beleswar Padhi @ 2026-09-30 19:41 UTC (permalink / raw)
  To: nm, kristo, ssantosh
  Cc: linux-arm-kernel, linux-kernel, afd, u-kumar1, vigneshr, b-padhi

The previous TI K2G and K3 architectures were tightly coupled systems in
terms of Safety and Security. All the TI-SCI messages from HLOS (Linux)
were sent to a single sec proxy thread terminating at the core running
Safety service (DM). In K2G systems, DM handled both Safety & Security
requests by itself. Whereas in K3 systems, DM serviced the Safety
requests itself, and forwarded the Security requests to core running
Security service (TIFS) on the HLOS's behalf. This posed various
limitations:
   a. Increased latency: An extra forwarding hop through DM adds latency
      in requests and responses.
   b. Freedom From Interference (FFI) concerns: Having Safety service
      proxy Security's requests (& vice versa) undermines the isolation
      and FFI of the system.
   c. Potential Deadlock Scenario: Forwarding messages between Safety
      and Security cores can result in a deadlock if there are circular
      dependencies.

To eliminate all the above limitations, the TI TDA54 class of SoCs
introduce an architectural change: Isolation of Security and Safety
services. To realize this enhanced isolation in hardware, two
independent sec proxy threads are now provided for HLOS to communicate
separately with the Security and Safety cores respectively. And the
TI-SCI message forwarding has been eliminated in Software. The System
Firmware ABI5.0 version necessitates this improved isolation and FFI
change.

In ABI5.0, the message structures for set_clock_state, get_clock_state,
query_clock_freq, set_clock_freq, and get_clock_freq APIs have been
updated to combine the existing u8 clk_id and u32 clk_id_32 into a
single u32 clk_id. This is a good cleanup that came as a by-product of
the major ABI update. So, add new ABI5.0 compliant APIs to account for
this change.

Note: The following TI-SCI messages are not supported with ABI5.0, since
parent clock configuration is done internally by PDM firmware:
TI_SCI_MSG_SET_CLOCK_PARENT, TI_SCI_MSG_GET_CLOCK_PARENT, and
TI_SCI_MSG_GET_NUM_CLOCK_PARENTS. Hence, the corresponding clock parent
ops are left unset. Also, SSC support is not enabled in hardware on the
TDA54 SoC, so the needs_ssc argument of get_clock is ignored.

Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
---
Note:
This patch is dependent on the following 2 series
1. https://lore.kernel.org/all/20260930172948.2901336-1-b-padhi@ti.com/
2. https://lore.kernel.org/all/20260930160607.2674980-1-b-padhi@ti.com/

 drivers/firmware/ti/ti_sci.h       | 138 +++++++++++
 drivers/firmware/ti/ti_sci_clock.c | 380 +++++++++++++++++++++++++++++
 drivers/firmware/ti/ti_sci_core.c  |   2 +
 3 files changed, 520 insertions(+)

diff --git a/drivers/firmware/ti/ti_sci.h b/drivers/firmware/ti/ti_sci.h
index 2f633aeab70b1..5e0a35b394d19 100644
--- a/drivers/firmware/ti/ti_sci.h
+++ b/drivers/firmware/ti/ti_sci.h
@@ -483,6 +483,34 @@ struct ti_sci_msg_req_set_clock_state {
 	u32 clk_id_32;
 } __packed;
 
+/**
+ * struct ti_sci_msg_req_set_clock_state_abi5_pdm - Request to setup a Clock state
+ * @hdr:	Generic Header, Certain flags can be set specific to the clocks.
+ *		Uses the MSG_FLAG_CLOCK_* flags defined for
+ *		&struct ti_sci_msg_req_set_clock_state.
+ * @dev_id:	Device identifier this request is for
+ * @clk_id:	Clock identifier for the device for this request.
+ *		Each device has it's own set of clock inputs. This indexes
+ *		which clock input to modify.
+ * @request_state: Request the state for the clock to be set to.
+ *		Uses the MSG_CLOCK_SW_STATE_* values defined for
+ *		&struct ti_sci_msg_req_set_clock_state.
+ *
+ * Normally, all required clocks are managed by TISCI entity, this is used
+ * only for specific control *IF* required. Auto managed state is
+ * MSG_CLOCK_SW_STATE_AUTO, in other states, TISCI entity assume remote
+ * will explicitly control.
+ *
+ * Request type is TI_SCI_MSG_SET_CLOCK_STATE, response is a generic
+ * ACK or NACK message.
+ */
+struct ti_sci_msg_req_set_clock_state_abi5_pdm {
+	struct ti_sci_msg_hdr hdr;
+	u32 dev_id;
+	u32 clk_id;
+	u8 request_state;
+} __packed;
+
 /**
  * struct ti_sci_msg_req_get_clock_state - Request for clock state
  * @hdr:	Generic Header
@@ -505,6 +533,23 @@ struct ti_sci_msg_req_get_clock_state {
 	u32 clk_id_32;
 } __packed;
 
+/**
+ * struct ti_sci_msg_req_get_clock_state_abi5_pdm - Request for clock state
+ * @hdr:	Generic Header
+ * @dev_id:	Device identifier this request is for
+ * @clk_id:	Clock identifier for the device for this request.
+ *		Each device has it's own set of clock inputs. This indexes
+ *		which clock input to get state of.
+ *
+ * Request type is TI_SCI_MSG_GET_CLOCK_STATE, response is state
+ * of the clock
+ */
+struct ti_sci_msg_req_get_clock_state_abi5_pdm {
+	struct ti_sci_msg_hdr hdr;
+	u32 dev_id;
+	u32 clk_id;
+} __packed;
+
 /**
  * struct ti_sci_msg_resp_get_clock_state - Response to get clock state
  * @hdr:	Generic Header
@@ -659,6 +704,37 @@ struct ti_sci_msg_req_query_clock_freq {
 	u32 clk_id_32;
 } __packed;
 
+/**
+ * struct ti_sci_msg_req_query_clock_freq_abi5_pdm - Request to query a frequency
+ * @hdr:	Generic Header
+ * @dev_id:	Device identifier this request is for
+ * @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum
+ *		allowable programmed frequency and does not account for clock
+ *		tolerances and jitter.
+ * @target_freq_hz: The target clock frequency. A frequency will be found
+ *		as close to this target frequency as possible.
+ * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum
+ *		allowable programmed frequency and does not account for clock
+ *		tolerances and jitter.
+ * @clk_id:	Clock identifier for the device for this request.
+ *
+ * NOTE: Normally clock frequency management is automatically done by TISCI
+ * entity. In case of specific requests, TISCI evaluates capability to achieve
+ * requested frequency within provided range and responds with
+ * result message.
+ *
+ * Request type is TI_SCI_MSG_QUERY_CLOCK_FREQ, response is appropriate message,
+ * or NACK in case of inability to satisfy request.
+ */
+struct ti_sci_msg_req_query_clock_freq_abi5_pdm {
+	struct ti_sci_msg_hdr hdr;
+	u32 dev_id;
+	u64 min_freq_hz;
+	u64 target_freq_hz;
+	u64 max_freq_hz;
+	u32 clk_id;
+} __packed;
+
 /**
  * struct ti_sci_msg_resp_query_clock_freq - Response to a clock frequency query
  * @hdr:	Generic Header
@@ -718,6 +794,49 @@ struct ti_sci_msg_req_set_clock_freq {
 	u32 clk_id_32;
 } __packed;
 
+/**
+ * struct ti_sci_msg_req_set_clock_freq_abi5_pdm - Request to setup a clock frequency
+ * @hdr:	Generic Header
+ * @dev_id:	Device identifier this request is for
+ * @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum
+ *		allowable programmed frequency and does not account for clock
+ *		tolerances and jitter.
+ * @target_freq_hz: The target clock frequency. The clock will be programmed
+ *		at a rate as close to this target frequency as possible.
+ * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum
+ *		allowable programmed frequency and does not account for clock
+ *		tolerances and jitter.
+ * @clk_id:	Clock identifier for the device for this request.
+ *
+ * NOTE: Normally clock frequency management is automatically done by TISCI
+ * entity. In case of specific requests, TISCI evaluates capability to achieve
+ * requested range and responds with success/failure message.
+ *
+ * This sets the desired frequency for a clock within an allowable
+ * range. This message will fail on an enabled clock unless
+ * MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE is set for the clock. Additionally,
+ * if other clocks have their frequency modified due to this message,
+ * they also must have the MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE or be disabled.
+ *
+ * Calling set frequency on a clock input to the SoC pseudo-device will
+ * inform the PMMC of that clock's frequency. Setting a frequency of
+ * zero will indicate the clock is disabled.
+ *
+ * Calling set frequency on clock outputs from the SoC pseudo-device will
+ * function similarly to setting the clock frequency on a device.
+ *
+ * Request type is TI_SCI_MSG_SET_CLOCK_FREQ, response is a generic ACK/NACK
+ * message.
+ */
+struct ti_sci_msg_req_set_clock_freq_abi5_pdm {
+	struct ti_sci_msg_hdr hdr;
+	u32 dev_id;
+	u64 min_freq_hz;
+	u64 target_freq_hz;
+	u64 max_freq_hz;
+	u32 clk_id;
+} __packed;
+
 /**
  * struct ti_sci_msg_req_get_clock_freq - Request to get the clock frequency
  * @hdr:	Generic Header
@@ -739,6 +858,24 @@ struct ti_sci_msg_req_get_clock_freq {
 	u32 clk_id_32;
 } __packed;
 
+/**
+ * struct ti_sci_msg_req_get_clock_freq_abi5_pdm - Request to get the clock frequency
+ * @hdr:	Generic Header
+ * @dev_id:	Device identifier this request is for
+ * @clk_id:	Clock identifier for the device for this request.
+ *
+ * NOTE: Normally clock frequency management is automatically done by TISCI
+ * entity. In some cases, clock frequencies are configured by host.
+ *
+ * Request type is TI_SCI_MSG_GET_CLOCK_FREQ, responded with clock frequency
+ * that the clock is currently at.
+ */
+struct ti_sci_msg_req_get_clock_freq_abi5_pdm {
+	struct ti_sci_msg_hdr hdr;
+	u32 dev_id;
+	u32 clk_id;
+} __packed;
+
 /**
  * struct ti_sci_msg_resp_get_clock_freq - Response of clock frequency request
  * @hdr:	Generic Header
@@ -1738,6 +1875,7 @@ int ti_sci_do_xfer(const struct ti_sci_handle *handle,
 void ti_sci_setup_device_ops(struct ti_sci_dev_ops *dops);
 void ti_sci_setup_device_ops_abi5(struct ti_sci_dev_ops *dops);
 void ti_sci_setup_clock_ops(struct ti_sci_clk_ops *cops);
+void ti_sci_setup_clock_ops_abi5(struct ti_sci_clk_ops *cops);
 void ti_sci_setup_pm_ops(struct ti_sci_pm_ops *pmops);
 void ti_sci_setup_rm_core_ops(struct ti_sci_rm_core_ops *rm_core_ops);
 void ti_sci_setup_rm_irq_ops(struct ti_sci_rm_irq_ops *iops);
diff --git a/drivers/firmware/ti/ti_sci_clock.c b/drivers/firmware/ti/ti_sci_clock.c
index f266522fb7d08..faf37cc6df8d2 100644
--- a/drivers/firmware/ti/ti_sci_clock.c
+++ b/drivers/firmware/ti/ti_sci_clock.c
@@ -50,6 +50,40 @@ static int ti_sci_set_clock_state(const struct ti_sci_handle *handle,
 	return 0;
 }
 
+/**
+ * ti_sci_set_clock_state_abi5_pdm() - Set clock state helper
+ * @handle:	pointer to TI SCI handle
+ * @dev_id:	Device identifier this request is for
+ * @clk_id:	Clock identifier for the device for this request.
+ *		Each device has it's own set of clock inputs. This indexes
+ *		which clock input to modify.
+ * @flags:	Header flags as needed
+ * @state:	State to request for the clock.
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_set_clock_state_abi5_pdm(const struct ti_sci_handle *handle,
+					   u32 dev_id, u32 clk_id,
+					   u32 flags, u8 state)
+{
+	struct ti_sci_msg_req_set_clock_state_abi5_pdm req;
+	struct ti_sci_msg_hdr resp;
+	int ret = 0;
+
+	req.dev_id = dev_id;
+	req.clk_id = clk_id;
+	req.request_state = state;
+
+	ret = ti_sci_do_xfer(handle, TI_SCI_MSG_SET_CLOCK_STATE,
+			     flags | TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+			     &req, sizeof(req),
+			     &resp, sizeof(resp));
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
 /**
  * ti_sci_cmd_get_clock_state() - Get clock state helper
  * @handle:	pointer to TI SCI handle
@@ -96,6 +130,47 @@ static int ti_sci_cmd_get_clock_state(const struct ti_sci_handle *handle,
 	return 0;
 }
 
+/**
+ * ti_sci_cmd_get_clock_state_abi5_pdm() - Get clock state helper
+ * @handle:	pointer to TI SCI handle
+ * @dev_id:	Device identifier this request is for
+ * @clk_id:	Clock identifier for the device for this request.
+ *		Each device has it's own set of clock inputs. This indexes
+ *		which clock input to modify.
+ * @programmed_state:	State requested for clock to move to
+ * @current_state:	State that the clock is currently in
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_get_clock_state_abi5_pdm(const struct ti_sci_handle *handle,
+					       u32 dev_id, u32 clk_id,
+					       u8 *programmed_state, u8 *current_state)
+{
+	struct ti_sci_msg_req_get_clock_state_abi5_pdm req;
+	struct ti_sci_msg_resp_get_clock_state resp;
+	int ret = 0;
+
+	if (!programmed_state && !current_state)
+		return -EINVAL;
+
+	req.dev_id = dev_id;
+	req.clk_id = clk_id;
+
+	ret = ti_sci_do_xfer(handle, TI_SCI_MSG_GET_CLOCK_STATE,
+			     TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+			     &req, sizeof(req),
+			     &resp, sizeof(resp));
+	if (ret)
+		return ret;
+
+	if (programmed_state)
+		*programmed_state = resp.programmed_state;
+	if (current_state)
+		*current_state = resp.current_state;
+
+	return 0;
+}
+
 /**
  * ti_sci_cmd_get_clock() - Get control of a clock from TI SCI
  * @handle:	pointer to TI SCI handle
@@ -123,6 +198,32 @@ static int ti_sci_cmd_get_clock(const struct ti_sci_handle *handle, u32 dev_id,
 				      MSG_CLOCK_SW_STATE_REQ);
 }
 
+/**
+ * ti_sci_cmd_get_clock_abi5_pdm() - Get control of a clock from TI SCI
+ * @handle:	pointer to TI SCI handle
+ * @dev_id:	Device identifier this request is for
+ * @clk_id:	Clock identifier for the device for this request.
+ *		Each device has it's own set of clock inputs. This indexes
+ *		which clock input to modify.
+ * @needs_ssc:	unused, SSC is not supported with ABI5
+ * @can_change_freq: 'true' if frequency change is desired, else 'false'
+ * @enable_input_term: 'true' if input termination is desired, else 'false'
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_get_clock_abi5_pdm(const struct ti_sci_handle *handle, u32 dev_id,
+					 u32 clk_id, bool needs_ssc,
+					 bool can_change_freq, bool enable_input_term)
+{
+	u32 flags = 0;
+
+	flags |= can_change_freq ? MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE : 0;
+	flags |= enable_input_term ? MSG_FLAG_CLOCK_INPUT_TERM : 0;
+
+	return ti_sci_set_clock_state_abi5_pdm(handle, dev_id, clk_id, flags,
+					       MSG_CLOCK_SW_STATE_REQ);
+}
+
 /**
  * ti_sci_cmd_idle_clock() - Idle a clock which is in our control
  * @handle:	pointer to TI SCI handle
@@ -143,6 +244,26 @@ static int ti_sci_cmd_idle_clock(const struct ti_sci_handle *handle,
 				      MSG_CLOCK_SW_STATE_UNREQ);
 }
 
+/**
+ * ti_sci_cmd_idle_clock_abi5_pdm() - Idle a clock which is in our control
+ * @handle:	pointer to TI SCI handle
+ * @dev_id:	Device identifier this request is for
+ * @clk_id:	Clock identifier for the device for this request.
+ *		Each device has it's own set of clock inputs. This indexes
+ *		which clock input to modify.
+ *
+ * NOTE: This clock must have been requested by get_clock previously.
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_idle_clock_abi5_pdm(const struct ti_sci_handle *handle,
+					  u32 dev_id, u32 clk_id)
+{
+	return ti_sci_set_clock_state_abi5_pdm(handle, dev_id, clk_id,
+					       MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE,
+					       MSG_CLOCK_SW_STATE_UNREQ);
+}
+
 /**
  * ti_sci_cmd_put_clock() - Release a clock from our control back to TISCI
  * @handle:	pointer to TI SCI handle
@@ -163,6 +284,26 @@ static int ti_sci_cmd_put_clock(const struct ti_sci_handle *handle,
 				      MSG_CLOCK_SW_STATE_AUTO);
 }
 
+/**
+ * ti_sci_cmd_put_clock_abi5_pdm() - Release a clock from our control back to TISCI
+ * @handle:	pointer to TI SCI handle
+ * @dev_id:	Device identifier this request is for
+ * @clk_id:	Clock identifier for the device for this request.
+ *		Each device has it's own set of clock inputs. This indexes
+ *		which clock input to modify.
+ *
+ * NOTE: This clock must have been requested by get_clock previously.
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_put_clock_abi5_pdm(const struct ti_sci_handle *handle,
+					 u32 dev_id, u32 clk_id)
+{
+	return ti_sci_set_clock_state_abi5_pdm(handle, dev_id, clk_id,
+					       MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE,
+					       MSG_CLOCK_SW_STATE_AUTO);
+}
+
 /**
  * ti_sci_cmd_clk_is_auto() - Is the clock being auto managed
  * @handle:	pointer to TI SCI handle
@@ -191,6 +332,34 @@ static int ti_sci_cmd_clk_is_auto(const struct ti_sci_handle *handle,
 	return 0;
 }
 
+/**
+ * ti_sci_cmd_clk_is_auto_abi5_pdm() - Is the clock being auto managed
+ * @handle:	pointer to TI SCI handle
+ * @dev_id:	Device identifier this request is for
+ * @clk_id:	Clock identifier for the device for this request.
+ *		Each device has it's own set of clock inputs. This indexes
+ *		which clock input to modify.
+ * @req_state: state indicating if the clock is auto managed
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_clk_is_auto_abi5_pdm(const struct ti_sci_handle *handle,
+					   u32 dev_id, u32 clk_id, bool *req_state)
+{
+	u8 state = 0;
+	int ret;
+
+	if (!req_state)
+		return -EINVAL;
+
+	ret = ti_sci_cmd_get_clock_state_abi5_pdm(handle, dev_id, clk_id, &state, NULL);
+	if (ret)
+		return ret;
+
+	*req_state = (state == MSG_CLOCK_SW_STATE_AUTO);
+	return 0;
+}
+
 /**
  * ti_sci_cmd_clk_is_on() - Is the clock ON
  * @handle:	pointer to TI SCI handle
@@ -224,6 +393,39 @@ static int ti_sci_cmd_clk_is_on(const struct ti_sci_handle *handle, u32 dev_id,
 	return 0;
 }
 
+/**
+ * ti_sci_cmd_clk_is_on_abi5_pdm() - Is the clock ON
+ * @handle:	pointer to TI SCI handle
+ * @dev_id:	Device identifier this request is for
+ * @clk_id:	Clock identifier for the device for this request.
+ *		Each device has it's own set of clock inputs. This indexes
+ *		which clock input to modify.
+ * @req_state: state indicating if the clock is managed by us and enabled
+ * @curr_state: state indicating if the clock is ready for operation
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_clk_is_on_abi5_pdm(const struct ti_sci_handle *handle, u32 dev_id,
+					 u32 clk_id, bool *req_state, bool *curr_state)
+{
+	u8 c_state = 0, r_state = 0;
+	int ret;
+
+	if (!req_state && !curr_state)
+		return -EINVAL;
+
+	ret = ti_sci_cmd_get_clock_state_abi5_pdm(handle, dev_id, clk_id,
+						  &r_state, &c_state);
+	if (ret)
+		return ret;
+
+	if (req_state)
+		*req_state = (r_state == MSG_CLOCK_SW_STATE_REQ);
+	if (curr_state)
+		*curr_state = (c_state == MSG_CLOCK_HW_STATE_READY);
+	return 0;
+}
+
 /**
  * ti_sci_cmd_clk_is_off() - Is the clock OFF
  * @handle:	pointer to TI SCI handle
@@ -257,6 +459,39 @@ static int ti_sci_cmd_clk_is_off(const struct ti_sci_handle *handle, u32 dev_id,
 	return 0;
 }
 
+/**
+ * ti_sci_cmd_clk_is_off_abi5_pdm() - Is the clock OFF
+ * @handle:	pointer to TI SCI handle
+ * @dev_id:	Device identifier this request is for
+ * @clk_id:	Clock identifier for the device for this request.
+ *		Each device has it's own set of clock inputs. This indexes
+ *		which clock input to modify.
+ * @req_state: state indicating if the clock is managed by us and disabled
+ * @curr_state: state indicating if the clock is NOT ready for operation
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_clk_is_off_abi5_pdm(const struct ti_sci_handle *handle, u32 dev_id,
+					  u32 clk_id, bool *req_state, bool *curr_state)
+{
+	u8 c_state = 0, r_state = 0;
+	int ret;
+
+	if (!req_state && !curr_state)
+		return -EINVAL;
+
+	ret = ti_sci_cmd_get_clock_state_abi5_pdm(handle, dev_id, clk_id,
+						  &r_state, &c_state);
+	if (ret)
+		return ret;
+
+	if (req_state)
+		*req_state = (r_state == MSG_CLOCK_SW_STATE_UNREQ);
+	if (curr_state)
+		*curr_state = (c_state == MSG_CLOCK_HW_STATE_NOT_READY);
+	return 0;
+}
+
 /**
  * ti_sci_cmd_clk_set_parent() - Set the clock source of a specific device clock
  * @handle:	pointer to TI SCI handle
@@ -442,6 +677,55 @@ static int ti_sci_cmd_clk_get_match_freq(const struct ti_sci_handle *handle,
 	return 0;
 }
 
+/**
+ * ti_sci_cmd_clk_get_match_freq_abi5_pdm() - Find a good match for frequency
+ * @handle:	pointer to TI SCI handle
+ * @dev_id:	Device identifier this request is for
+ * @clk_id:	Clock identifier for the device for this request.
+ *		Each device has it's own set of clock inputs. This indexes
+ *		which clock input to modify.
+ * @min_freq:	The minimum allowable frequency in Hz. This is the minimum
+ *		allowable programmed frequency and does not account for clock
+ *		tolerances and jitter.
+ * @target_freq: The target clock frequency in Hz. A frequency will be
+ *		processed as close to this target frequency as possible.
+ * @max_freq:	The maximum allowable frequency in Hz. This is the maximum
+ *		allowable programmed frequency and does not account for clock
+ *		tolerances and jitter.
+ * @match_freq:	Frequency match in Hz response.
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_clk_get_match_freq_abi5_pdm(const struct ti_sci_handle *handle,
+						  u32 dev_id, u32 clk_id, u64 min_freq,
+						  u64 target_freq, u64 max_freq,
+						  u64 *match_freq)
+{
+	struct ti_sci_msg_req_query_clock_freq_abi5_pdm req;
+	struct ti_sci_msg_resp_query_clock_freq resp;
+	int ret = 0;
+
+	if (!match_freq)
+		return -EINVAL;
+
+	req.dev_id = dev_id;
+	req.clk_id = clk_id;
+	req.min_freq_hz = min_freq;
+	req.target_freq_hz = target_freq;
+	req.max_freq_hz = max_freq;
+
+	ret = ti_sci_do_xfer(handle, TI_SCI_MSG_QUERY_CLOCK_FREQ,
+			     TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+			     &req, sizeof(req),
+			     &resp, sizeof(resp));
+	if (ret)
+		return ret;
+
+	*match_freq = resp.freq_hz;
+
+	return 0;
+}
+
 /**
  * ti_sci_cmd_clk_set_freq() - Set a frequency for clock
  * @handle:	pointer to TI SCI handle
@@ -489,6 +773,48 @@ static int ti_sci_cmd_clk_set_freq(const struct ti_sci_handle *handle,
 	return 0;
 }
 
+/**
+ * ti_sci_cmd_clk_set_freq_abi5_pdm() - Set a frequency for clock
+ * @handle:	pointer to TI SCI handle
+ * @dev_id:	Device identifier this request is for
+ * @clk_id:	Clock identifier for the device for this request.
+ *		Each device has it's own set of clock inputs. This indexes
+ *		which clock input to modify.
+ * @min_freq:	The minimum allowable frequency in Hz. This is the minimum
+ *		allowable programmed frequency and does not account for clock
+ *		tolerances and jitter.
+ * @target_freq: The target clock frequency in Hz. A frequency will be
+ *		processed as close to this target frequency as possible.
+ * @max_freq:	The maximum allowable frequency in Hz. This is the maximum
+ *		allowable programmed frequency and does not account for clock
+ *		tolerances and jitter.
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_clk_set_freq_abi5_pdm(const struct ti_sci_handle *handle,
+					    u32 dev_id, u32 clk_id, u64 min_freq,
+					    u64 target_freq, u64 max_freq)
+{
+	struct ti_sci_msg_req_set_clock_freq_abi5_pdm req;
+	struct ti_sci_msg_hdr resp;
+	int ret = 0;
+
+	req.dev_id = dev_id;
+	req.clk_id = clk_id;
+	req.min_freq_hz = min_freq;
+	req.target_freq_hz = target_freq;
+	req.max_freq_hz = max_freq;
+
+	ret = ti_sci_do_xfer(handle, TI_SCI_MSG_SET_CLOCK_FREQ,
+			     TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+			     &req, sizeof(req),
+			     &resp, sizeof(resp));
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
 /**
  * ti_sci_cmd_clk_get_freq() - Get current frequency
  * @handle:	pointer to TI SCI handle
@@ -530,6 +856,42 @@ static int ti_sci_cmd_clk_get_freq(const struct ti_sci_handle *handle,
 	return 0;
 }
 
+/**
+ * ti_sci_cmd_clk_get_freq_abi5_pdm() - Get current frequency
+ * @handle:	pointer to TI SCI handle
+ * @dev_id:	Device identifier this request is for
+ * @clk_id:	Clock identifier for the device for this request.
+ *		Each device has it's own set of clock inputs. This indexes
+ *		which clock input to modify.
+ * @freq:	Currently frequency in Hz
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+static int ti_sci_cmd_clk_get_freq_abi5_pdm(const struct ti_sci_handle *handle,
+					    u32 dev_id, u32 clk_id, u64 *freq)
+{
+	struct ti_sci_msg_req_get_clock_freq_abi5_pdm req;
+	struct ti_sci_msg_resp_get_clock_freq resp;
+	int ret = 0;
+
+	if (!freq)
+		return -EINVAL;
+
+	req.dev_id = dev_id;
+	req.clk_id = clk_id;
+
+	ret = ti_sci_do_xfer(handle, TI_SCI_MSG_GET_CLOCK_FREQ,
+			     TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+			     &req, sizeof(req),
+			     &resp, sizeof(resp));
+	if (ret)
+		return ret;
+
+	*freq = resp.freq_hz;
+
+	return 0;
+}
+
 /*
  * ti_sci_setup_clock_ops() - Setup the clock operations structures
  * @cops:	pointer to TISCI clock operations structure
@@ -551,3 +913,21 @@ void ti_sci_setup_clock_ops(struct ti_sci_clk_ops *cops)
 	cops->set_freq = ti_sci_cmd_clk_set_freq;
 	cops->get_freq = ti_sci_cmd_clk_get_freq;
 }
+
+/*
+ * ti_sci_setup_clock_ops_abi5() - Setup the clock operations structures (ABI5)
+ * @cops:	pointer to TISCI clock operations structure
+ */
+void ti_sci_setup_clock_ops_abi5(struct ti_sci_clk_ops *cops)
+{
+	cops->get_clock = ti_sci_cmd_get_clock_abi5_pdm;
+	cops->idle_clock = ti_sci_cmd_idle_clock_abi5_pdm;
+	cops->put_clock = ti_sci_cmd_put_clock_abi5_pdm;
+	cops->is_auto = ti_sci_cmd_clk_is_auto_abi5_pdm;
+	cops->is_on = ti_sci_cmd_clk_is_on_abi5_pdm;
+	cops->is_off = ti_sci_cmd_clk_is_off_abi5_pdm;
+
+	cops->get_best_match_freq = ti_sci_cmd_clk_get_match_freq_abi5_pdm;
+	cops->set_freq = ti_sci_cmd_clk_set_freq_abi5_pdm;
+	cops->get_freq = ti_sci_cmd_clk_get_freq_abi5_pdm;
+}
diff --git a/drivers/firmware/ti/ti_sci_core.c b/drivers/firmware/ti/ti_sci_core.c
index cea4339ac0af2..a8135e611a515 100644
--- a/drivers/firmware/ti/ti_sci_core.c
+++ b/drivers/firmware/ti/ti_sci_core.c
@@ -715,8 +715,10 @@ static void ti_sci_setup_ops_abi5(struct ti_sci_info *info)
 {
 	struct ti_sci_ops *ops = &info->handle.ops;
 	struct ti_sci_dev_ops *dops = &ops->dev_ops;
+	struct ti_sci_clk_ops *cops = &ops->clk_ops;
 
 	ti_sci_setup_device_ops_abi5(dops);
+	ti_sci_setup_clock_ops_abi5(cops);
 }
 
 /**
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 6/6] firmware: ti: ti_sci_rm: Add ABI5.0 compliant basic RM APIs
  2026-09-30 19:41 [PATCH 0/6] Enhance TI-SCI FFI with ABI5.0 support Beleswar Padhi
                   ` (4 preceding siblings ...)
  2026-09-30 19:41 ` [PATCH 5/6] firmware: ti: ti_sci_clock: Add ABI5.0 compliant Clock APIs Beleswar Padhi
@ 2026-09-30 19:41 ` Beleswar Padhi
  5 siblings, 0 replies; 7+ messages in thread
From: Beleswar Padhi @ 2026-09-30 19:41 UTC (permalink / raw)
  To: nm, kristo, ssantosh
  Cc: linux-arm-kernel, linux-kernel, afd, u-kumar1, vigneshr, b-padhi

The previous TI K2G and K3 architectures were tightly coupled systems in
terms of Safety and Security. All the TI-SCI messages from HLOS (Linux)
were sent to a single sec proxy thread terminating at the core running
Safety service (DM). In K2G systems, DM handled both Safety & Security
requests by itself. Whereas in K3 systems, DM serviced the Safety
requests itself, and forwarded the Security requests to core running
Security service (TIFS) on the HLOS's behalf. This posed various
limitations:
   a. Increased latency: An extra forwarding hop through DM adds latency
      in requests and responses.
   b. Freedom From Interference (FFI) concerns: Having Safety service
      proxy Security's requests (& vice versa) undermines the isolation
      and FFI of the system.
   c. Potential Deadlock Scenario: Forwarding messages between Safety
      and Security cores can result in a deadlock if there are circular
      dependencies.

To eliminate all the above limitations, the TI TDA54 class of SoCs
introduce an architectural change: Isolation of Security and Safety
services. To realize this enhanced isolation in hardware, two
independent sec proxy threads are now provided for HLOS to communicate
separately with the Security and Safety cores respectively. And the
TI-SCI message forwarding has been eliminated in Software. The System
Firmware ABI5.0 version necessitates this improved isolation and FFI
change.

In ABI5.0, the message structure for manage_irq has been updated to
remove the existing ia_id, vint, global_event, vint_status_bit fields as
they are not supported in hardware with TDA54 SoC. Therefore, remove
those fields and flags from the ABI5.0 structure definition and add new
APIs and wrappers to send the manage_irq message with this updated
structure. The TI TDA54 SoC has no Interrupt Aggregator in hardware, so
the event map related ops are invalid in ABI5.0

Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
---
Note:
This patch is dependent on the following 2 series
1. https://lore.kernel.org/all/20260930172948.2901336-1-b-padhi@ti.com/
2. https://lore.kernel.org/all/20260930160607.2674980-1-b-padhi@ti.com/

 drivers/firmware/ti/ti_sci.h      |  34 +++++++
 drivers/firmware/ti/ti_sci_core.c |   4 +
 drivers/firmware/ti/ti_sci_rm.c   | 148 ++++++++++++++++++++++++++++++
 3 files changed, 186 insertions(+)

diff --git a/drivers/firmware/ti/ti_sci.h b/drivers/firmware/ti/ti_sci.h
index 5e0a35b394d19..32276a66bb8b4 100644
--- a/drivers/firmware/ti/ti_sci.h
+++ b/drivers/firmware/ti/ti_sci.h
@@ -1104,6 +1104,39 @@ struct ti_sci_msg_req_manage_irq {
 	u8 secondary_host;
 } __packed;
 
+/**
+ * struct ti_sci_msg_req_manage_irq_abi5_pdm - Request to configure/release the route
+ *					       between the dev and the host.
+ * @hdr:		Generic Header
+ * @valid_params:	Bit fields defining the validity of interrupt source
+ *			parameters. If a bit is not set, then corresponding
+ *			field is not valid and will not be used for route set.
+ *			Bit field definitions:
+ *			0 - Valid bit for @dst_id
+ *			1 - Valid bit for @dst_host_irq
+ *			31 - Valid bit for @secondary_host
+ * @src_id:		IRQ source peripheral ID.
+ * @src_index:		IRQ source index within the peripheral
+ * @dst_id:		IRQ Destination ID. Based on the architecture it can be
+ *			IRQ controller or host processor ID.
+ * @dst_host_irq:	IRQ number of the destination host IRQ controller
+ * @secondary_host:	Host ID of the IRQ destination computing entity. This is
+ *			required only when destination host id is different
+ *			from ti sci interface host id.
+ *
+ * Request type is TI_SCI_MSG_SET/RELEASE_IRQ.
+ * Response is generic ACK / NACK message.
+ */
+struct ti_sci_msg_req_manage_irq_abi5_pdm {
+	struct ti_sci_msg_hdr hdr;
+	u32 valid_params;
+	u16 src_id;
+	u16 src_index;
+	u16 dst_id;
+	u16 dst_host_irq;
+	u8 secondary_host;
+} __packed;
+
 /**
  * struct ti_sci_irq - Description of allocated irqs
  * @node: Link to hash table
@@ -1879,6 +1912,7 @@ void ti_sci_setup_clock_ops_abi5(struct ti_sci_clk_ops *cops);
 void ti_sci_setup_pm_ops(struct ti_sci_pm_ops *pmops);
 void ti_sci_setup_rm_core_ops(struct ti_sci_rm_core_ops *rm_core_ops);
 void ti_sci_setup_rm_irq_ops(struct ti_sci_rm_irq_ops *iops);
+void ti_sci_setup_rm_irq_ops_abi5(struct ti_sci_rm_irq_ops *iops);
 void ti_sci_setup_rm_ringacc_ops(struct ti_sci_rm_ringacc_ops *rops);
 void ti_sci_setup_rm_psil_ops(struct ti_sci_rm_psil_ops *psilops);
 void ti_sci_setup_rm_udmap_ops(struct ti_sci_rm_udmap_ops *udmap_ops);
diff --git a/drivers/firmware/ti/ti_sci_core.c b/drivers/firmware/ti/ti_sci_core.c
index a8135e611a515..cb83ba99631c6 100644
--- a/drivers/firmware/ti/ti_sci_core.c
+++ b/drivers/firmware/ti/ti_sci_core.c
@@ -716,9 +716,13 @@ static void ti_sci_setup_ops_abi5(struct ti_sci_info *info)
 	struct ti_sci_ops *ops = &info->handle.ops;
 	struct ti_sci_dev_ops *dops = &ops->dev_ops;
 	struct ti_sci_clk_ops *cops = &ops->clk_ops;
+	struct ti_sci_rm_core_ops *rm_core_ops = &ops->rm_core_ops;
+	struct ti_sci_rm_irq_ops *iops = &ops->rm_irq_ops;
 
 	ti_sci_setup_device_ops_abi5(dops);
 	ti_sci_setup_clock_ops_abi5(cops);
+	ti_sci_setup_rm_core_ops(rm_core_ops);
+	ti_sci_setup_rm_irq_ops_abi5(iops);
 }
 
 /**
diff --git a/drivers/firmware/ti/ti_sci_rm.c b/drivers/firmware/ti/ti_sci_rm.c
index 87f2ef5785e09..23535cb25f051 100644
--- a/drivers/firmware/ti/ti_sci_rm.c
+++ b/drivers/firmware/ti/ti_sci_rm.c
@@ -155,6 +155,45 @@ int ti_sci_manage_irq(const struct ti_sci_handle *handle,
 	return 0;
 }
 
+/**
+ * ti_sci_manage_irq_abi5_pdm() - Helper api to configure/release the irq route between
+ *				  the requested source and destination
+ * @handle:		Pointer to TISCI handle.
+ * @valid_params:	Bit fields defining the validity of certain params
+ * @src_id:		Device ID of the IRQ source
+ * @src_index:		IRQ source index within the source device
+ * @dst_id:		Device ID of the IRQ destination
+ * @dst_host_irq:	IRQ number of the destination device
+ * @s_host:		Secondary host ID to which the irq/event is being
+ *			requested for.
+ * @type:		Request type irq set or release.
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_manage_irq_abi5_pdm(const struct ti_sci_handle *handle,
+				      u32 valid_params, u16 src_id, u16 src_index,
+				      u16 dst_id, u16 dst_host_irq, u8 s_host, u16 type)
+{
+	struct ti_sci_msg_req_manage_irq_abi5_pdm req;
+	struct ti_sci_msg_hdr resp;
+	int ret = 0;
+
+	req.valid_params = valid_params;
+	req.src_id = src_id;
+	req.src_index = src_index;
+	req.dst_id = dst_id;
+	req.dst_host_irq = dst_host_irq;
+	req.secondary_host = s_host;
+
+	ret = ti_sci_do_xfer(handle, type, TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+			     &req, sizeof(req),
+			     &resp, sizeof(resp));
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
 /**
  * ti_sci_irq_hash() - Helper API to compute irq hash for the hash table.
  * @irq:	irq to hash
@@ -253,6 +292,35 @@ static int ti_sci_set_irq(const struct ti_sci_handle *handle, u32 valid_params,
 	return ret;
 }
 
+/**
+ * ti_sci_set_irq_abi5_pdm() - Helper api to configure the irq route between the
+ *			       requested source and destination
+ * @handle:		Pointer to TISCI handle.
+ * @valid_params:	Bit fields defining the validity of certain params
+ * @src_id:		Device ID of the IRQ source
+ * @src_index:		IRQ source index within the source device
+ * @dst_id:		Device ID of the IRQ destination
+ * @dst_host_irq:	IRQ number of the destination device
+ * @s_host:		Secondary host ID to which the irq/event is being
+ *			requested for.
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_set_irq_abi5_pdm(const struct ti_sci_handle *handle, u32 valid_params,
+				   u16 src_id, u16 src_index, u16 dst_id,
+				   u16 dst_host_irq, u8 s_host)
+{
+	int ret;
+
+	pr_debug("%s: IRQ set with valid_params = 0x%x from src = %d, index = %d, to dst = %d, irq = %d\n",
+		 __func__, valid_params, src_id, src_index, dst_id, dst_host_irq);
+
+	ret = ti_sci_manage_irq_abi5_pdm(handle, valid_params, src_id, src_index,
+					 dst_id, dst_host_irq, s_host, TI_SCI_MSG_SET_IRQ);
+
+	return ret;
+}
+
 /**
  * ti_sci_free_irq() - Helper api to free the irq route between the
  *			   requested source and destination
@@ -325,6 +393,36 @@ static int ti_sci_free_irq(const struct ti_sci_handle *handle, u32 valid_params,
 	return ret;
 }
 
+/**
+ * ti_sci_free_irq_abi5_pdm() - Helper api to free the irq route between the
+ *                              requested source and destination
+ * @handle:		Pointer to TISCI handle.
+ * @valid_params:	Bit fields defining the validity of certain params
+ * @src_id:		Device ID of the IRQ source
+ * @src_index:		IRQ source index within the source device
+ * @dst_id:		Device ID of the IRQ destination
+ * @dst_host_irq:	IRQ number of the destination device
+ * @s_host:		Secondary host ID to which the irq/event is being
+ *			requested for.
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_free_irq_abi5_pdm(const struct ti_sci_handle *handle, u32 valid_params,
+				    u16 src_id, u16 src_index, u16 dst_id,
+				    u16 dst_host_irq, u8 s_host)
+{
+	int ret;
+
+	pr_debug("%s: IRQ release with valid_params = 0x%x from src = %d, index = %d, to dst = %d, irq = %d\n",
+		 __func__, valid_params, src_id, src_index, dst_id, dst_host_irq);
+
+	ret = ti_sci_manage_irq_abi5_pdm(handle, valid_params, src_id, src_index,
+					 dst_id, dst_host_irq, s_host,
+					 TI_SCI_MSG_FREE_IRQ);
+
+	return ret;
+}
+
 /**
  * ti_sci_cmd_set_irq() - Configure a host irq route between the requested
  *			  source and destination.
@@ -345,6 +443,26 @@ static int ti_sci_cmd_set_irq(const struct ti_sci_handle *handle, u16 src_id,
 			      dst_host_irq, 0, 0, 0, 0, 0);
 }
 
+/**
+ * ti_sci_cmd_set_irq_abi5_pdm() - Configure a host irq route between the requested
+ *				   source and destination.
+ * @handle:		Pointer to TISCI handle.
+ * @src_id:		Device ID of the IRQ source
+ * @src_index:		IRQ source index within the source device
+ * @dst_id:		Device ID of the IRQ destination
+ * @dst_host_irq:	IRQ number of the destination device
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_cmd_set_irq_abi5_pdm(const struct ti_sci_handle *handle, u16 src_id,
+				       u16 src_index, u16 dst_id, u16 dst_host_irq)
+{
+	u32 valid_params = MSG_FLAG_DST_ID_VALID | MSG_FLAG_DST_HOST_IRQ_VALID;
+
+	return ti_sci_set_irq_abi5_pdm(handle, valid_params, src_id, src_index, dst_id,
+				       dst_host_irq, 0);
+}
+
 /**
  * ti_sci_cmd_set_event_map() - Configure an event based irq route between the
  *				requested source and Interrupt Aggregator.
@@ -391,6 +509,26 @@ static int ti_sci_cmd_free_irq(const struct ti_sci_handle *handle, u16 src_id,
 			       dst_host_irq, 0, 0, 0, 0, 0);
 }
 
+/**
+ * ti_sci_cmd_free_irq_abi5_pdm() - Free a host irq route between the requested
+ *				    source and destination.
+ * @handle:		Pointer to TISCI handle.
+ * @src_id:		Device ID of the IRQ source
+ * @src_index:		IRQ source index within the source device
+ * @dst_id:		Device ID of the IRQ destination
+ * @dst_host_irq:	IRQ number of the destination device
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_cmd_free_irq_abi5_pdm(const struct ti_sci_handle *handle, u16 src_id,
+					u16 src_index, u16 dst_id, u16 dst_host_irq)
+{
+	u32 valid_params = MSG_FLAG_DST_ID_VALID | MSG_FLAG_DST_HOST_IRQ_VALID;
+
+	return ti_sci_free_irq_abi5_pdm(handle, valid_params, src_id, src_index, dst_id,
+					dst_host_irq, 0);
+}
+
 /**
  * ti_sci_cmd_free_event_map() - Free an event map between the requested source
  *				 and Interrupt Aggregator.
@@ -879,6 +1017,16 @@ void ti_sci_setup_rm_irq_ops(struct ti_sci_rm_irq_ops *iops)
 	iops->free_event_map = ti_sci_cmd_free_event_map;
 }
 
+/*
+ * ti_sci_setup_rm_irq_ops_abi5() - Setup the Resource Management IRQ operations structures (ABI5)
+ * @iops:	pointer to TISCI rm irq ops structure
+ */
+void ti_sci_setup_rm_irq_ops_abi5(struct ti_sci_rm_irq_ops *iops)
+{
+	iops->set_irq = ti_sci_cmd_set_irq_abi5_pdm;
+	iops->free_irq = ti_sci_cmd_free_irq_abi5_pdm;
+}
+
 /*
  * ti_sci_setup_rm_ringacc_ops() - Setup the Resource Management RINGACC operations structures
  * @rops:	pointer to TISCI rm ringacc ops structure
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-09-30 19:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-30 19:41 [PATCH 0/6] Enhance TI-SCI FFI with ABI5.0 support Beleswar Padhi
2026-09-30 19:41 ` [PATCH 1/6] dt-bindings: arm: keystone: ti,sci: Update nodename pattern Beleswar Padhi
2026-09-30 19:41 ` [PATCH 2/6] dt-bindings: arm: keystone: ti,sci: Add ti,tda54-sci-pdm compatible Beleswar Padhi
2026-09-30 19:41 ` [PATCH 3/6] firmware: ti: ti_sci_core: Add ABI5.0 Enhancements and TDA54 PDM SCI support Beleswar Padhi
2026-09-30 19:41 ` [PATCH 4/6] firmware: ti: ti_sci_device: Add ABI5.0 compliant Device and Reset APIs Beleswar Padhi
2026-09-30 19:41 ` [PATCH 5/6] firmware: ti: ti_sci_clock: Add ABI5.0 compliant Clock APIs Beleswar Padhi
2026-09-30 19:41 ` [PATCH 6/6] firmware: ti: ti_sci_rm: Add ABI5.0 compliant basic RM APIs Beleswar Padhi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®