Skip to contentSkip to conversation

remoteproc: Add zynqmp_r5 driver

PATCH Superseded Ben Levinsky 4 participants 12 messages Apr 20, 2020 – Apr 22, 2020

Subsystems (3)

v3 of 26 Superseded Latest is v26 →

lore
Share & tools
lore
#0 lore raw

v3 cover remoteproc: Add zynqmp_r5 driver

There are Cortex-R5 processors on Xilinx ZynqMP UltraScale+ MPSoC.
This patch is to add an Xilinx ZynqMP R5 remoteproc driver to enable Linux kernel to bringup R5, and enable communication between Linux kernel and R5.

There are Cortex-R5 processors on the Xilinx ZynqMP UltraScale+ MPSoC. This patch adds a Xilinx ZynqMP R5 remoteproc driver to enable the Linux kernel to bring up the R5s, and to enable communication between the Linux kernel and R5s.

Ben Levinsky (5):
firmware: xilinx: Add ZynqMP firmware ioctl enums for RPU
configuration.
firmware: xilinx: Add shutdown/wakeup APIs
firmware: xilinx: Add RPU configuration APIs
dt-bindings: remoteproc: Add documentation for ZynqMP R5 rproc
bindings
remoteproc: Add initial zynqmp R5 remoteproc driver

Changes since v1:
- remove domain struct as pre review from Matheiu

Changes since v2:
- update zynqmp_r5 yaml parsing to not raise warnings for extra information in children of R5 node. The warning "node has a unit name, but no reg or ranges property" will still be raised though as this particular node is needed to describe the '#address-cells' and '#size-cells' information.
- add xilinx-related platform mgmt fn's instead of wrapping around function pointer in xilinx eemi ops struct

 .../remoteproc/xilinx,zynqmp-r5-remoteproc.yaml    | 126 +++
 drivers/firmware/xilinx/zynqmp.c                   | 136 ++++
 drivers/remoteproc/Kconfig                         |  10 +
 drivers/remoteproc/Makefile                        |   1 +
 drivers/remoteproc/zynqmp_r5_remoteproc.c          | 902 +++++++++++++++++++++
 include/linux/firmware/xlnx-zynqmp.h               |  69 ++
 6 files changed, 1244 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/xilinx,zynqmp-r5-remoteproc.yaml
 create mode 100644 drivers/remoteproc/zynqmp_r5_remoteproc.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/5 firmware: xilinx: Add ZynqMP firmware ioctl enums for RPU configuration.

Add ZynqMP firmware ioctl enums for RPU configuration.

---
 include/linux/firmware/xlnx-zynqmp.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
include/linux/firmware/xlnx-zynqmp.h +19 -0
index 5968df8..074ad71 100644
@@ -104,6 +104,10 @@ enum pm_ret_status {
 };
 
 enum pm_ioctl_id {
+	IOCTL_GET_RPU_OPER_MODE = 0,
+	IOCTL_SET_RPU_OPER_MODE,
+	IOCTL_RPU_BOOT_ADDR_CONFIG,
+	IOCTL_TCM_COMB_CONFIG,
 	IOCTL_SD_DLL_RESET = 6,
 	IOCTL_SET_SD_TAPDELAY,
 	IOCTL_SET_PLL_FRAC_MODE,
@@ -129,6 +133,21 @@ enum pm_query_id {
 	PM_QID_CLOCK_GET_MAX_DIVISOR,
 };
 
+enum rpu_oper_mode {
+	PM_RPU_MODE_LOCKSTEP,
+	PM_RPU_MODE_SPLIT,
+};
+
+enum rpu_boot_mem {
+	PM_RPU_BOOTMEM_LOVEC,
+	PM_RPU_BOOTMEM_HIVEC,
+};
+
+enum rpu_tcm_comb {
+	PM_RPU_TCM_SPLIT,
+	PM_RPU_TCM_COMB,
+};
+
 enum zynqmp_pm_reset_action {
 	PM_RESET_ACTION_RELEASE,
 	PM_RESET_ACTION_ASSERT,
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH v3 1/5] firmware: xilinx: Add ZynqMP firmware ioctl enums for RPU configuration.

Quoted 35 lines · Ben Levinsky

Add ZynqMP firmware ioctl enums for RPU configuration.

---
 include/linux/firmware/xlnx-zynqmp.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
include/linux/firmware/xlnx-zynqmp.h +12 -0
index 5968df8..074ad71 100644
@@ -104,6 +104,10 @@ enum pm_ret_status {
 };
 
 enum pm_ioctl_id {
+	IOCTL_GET_RPU_OPER_MODE = 0,
+	IOCTL_SET_RPU_OPER_MODE,
+	IOCTL_RPU_BOOT_ADDR_CONFIG,
+	IOCTL_TCM_COMB_CONFIG,
 	IOCTL_SD_DLL_RESET = 6,
 	IOCTL_SET_SD_TAPDELAY,
 	IOCTL_SET_PLL_FRAC_MODE,
@@ -129,6 +133,21 @@ enum pm_query_id {
 	PM_QID_CLOCK_GET_MAX_DIVISOR,
 };
 
+enum rpu_oper_mode {
+	PM_RPU_MODE_LOCKSTEP,
+	PM_RPU_MODE_SPLIT,
+};
+
+enum rpu_boot_mem {
+	PM_RPU_BOOTMEM_LOVEC,
+	PM_RPU_BOOTMEM_HIVEC,

include/linux/firmware/xlnx-zynqmp.h enum pm_query_id { · line 153

Quoted 10 lines
include/linux/firmware/xlnx-zynqmp.h +7 -0
+};
+
+enum rpu_tcm_comb {
+	PM_RPU_TCM_SPLIT,
+	PM_RPU_TCM_COMB,
+};
+
 enum zynqmp_pm_reset_action {
 	PM_RESET_ACTION_RELEASE,
 	PM_RESET_ACTION_ASSERT,

Greg has been asking to assign values to all enums.

Take a look at this thread.
https://lore.kernel.org/linux-arm-kernel/[email protected]/

Thanks,
Michal

#3 lore raw

PATCH v3 2/5 firmware: xilinx: Add shutdown/wakeup APIs

In reply to Ben Levinsky

Add shutdown/wakeup a resource eemi operations to shutdown or bringup a resource.

---
changes since v2:
- add xilinx-related platform mgmt fn's instead of wrapping around function pointer in xilinx eemi ops struct

---
 drivers/firmware/xilinx/zynqmp.c     | 35 +++++++++++++++++++++++++++++++++++
 include/linux/firmware/xlnx-zynqmp.h | 20 ++++++++++++++++++++
 2 files changed, 55 insertions(+)
drivers/firmware/xilinx/zynqmp.c +35 -0
index bfaf29a..b0d140f 100644
@@ -845,6 +845,41 @@ int zynqmp_pm_release_node(const u32 node)
 EXPORT_SYMBOL_GPL(zynqmp_pm_release_node);
 
 /**
+ * zynqmp_pm_force_powerdown - PM call to request for another PU or subsystem to
+ *             be powered down forcefully
+ * @target:    Node ID of the targeted PU or subsystem
+ * @ack:   Flag to specify whether acknowledge is requested
+ *
+ * Return: Returns status, either success or error+reason
+ */
+int zynqmp_pm_force_powerdown(const u32 target,
+                  const enum zynqmp_pm_request_ack ack)
+{
+   return zynqmp_pm_invoke_fn(PM_FORCE_POWERDOWN, target, ack, 0, 0, NULL);
+}
+EXPORT_SYMBOL_GPL(zynqmp_pm_force_powerdown);
+
+/**
+ * zynqmp_pm_request_wakeup - PM call to wake up selected master or subsystem
+ * @node:  Node ID of the master or subsystem
+ * @set_addr:  Specifies whether the address argument is relevant
+ * @address:   Address from which to resume when woken up
+ * @ack:   Flag to specify whether acknowledge requested
+ *
+ * Return: Returns status, either success or error+reason
+ */
+int zynqmp_pm_request_wakeup(const u32 node,
+                  const bool set_addr,
+                  const u64 address,
+                  const enum zynqmp_pm_request_ack ack)
+{
+   /* set_addr flag is encoded into 1st bit of address */
+   return zynqmp_pm_invoke_fn(PM_REQUEST_WAKEUP, node, address | set_addr,
+                   address >> 32, ack, NULL);
+}
+EXPORT_SYMBOL_GPL(zynqmp_pm_request_wakeup);
+
+/**
  * zynqmp_pm_set_requirement() - PM call to set requirement for PM slaves
  * @node:		Node ID of the slave
  * @capabilities:	Requested capabilities of the slave
include/linux/firmware/xlnx-zynqmp.h +20 -0
index 074ad71..1235923 100644
@@ -64,6 +64,8 @@
 
 enum pm_api_id {
 	PM_GET_API_VERSION = 1,
+	PM_FORCE_POWERDOWN = 8,
+	PM_REQUEST_WAKEUP = 10,
 	PM_SYSTEM_SHUTDOWN = 12,
 	PM_REQUEST_NODE = 13,
 	PM_RELEASE_NODE,
@@ -376,6 +378,12 @@ int zynqmp_pm_write_pggs(u32 index, u32 value);
 int zynqmp_pm_read_pggs(u32 index, u32 *value);
 int zynqmp_pm_system_shutdown(const u32 type, const u32 subtype);
 int zynqmp_pm_set_boot_health_status(u32 value);
+int zynqmp_pm_force_powerdown(const u32 target,
+			const enum zynqmp_pm_request_ack ack);
+int zynqmp_pm_request_wakeup(const u32 node,
+			const bool set_addr,
+			const u64 address,
+			const enum zynqmp_pm_request_ack ack);
 #else
 static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void)
 {
@@ -526,6 +534,18 @@ static inline int zynqmp_pm_set_boot_health_status(u32 value)
 {
 	return -ENODEV;
 }
+static inline int zynqmp_pm_force_powerdown(const u32 target,
+			const enum zynqmp_pm_request_ack ack)
+{
+	return -ENODEV;
+}
+static inline int zynqmp_pm_request_wakeup(const u32 node,
+			const bool set_addr,
+			const u64 address,
+			const enum zynqmp_pm_request_ack ack)
+{
+	return -ENODEV;
+}
 #endif
 
 #endif /* __FIRMWARE_ZYNQMP_H__ */
Signature · 1 line
2.7.4
#4 lore raw

Re: [PATCH v3 2/5] firmware: xilinx: Add shutdown/wakeup APIs

Quoted 19 lines · Ben Levinsky

Add shutdown/wakeup a resource eemi operations to shutdown or bringup a resource.

---
changes since v2:
- add xilinx-related platform mgmt fn's instead of wrapping around function pointer in xilinx eemi ops struct

---
 drivers/firmware/xilinx/zynqmp.c     | 35 +++++++++++++++++++++++++++++++++++
 include/linux/firmware/xlnx-zynqmp.h | 20 ++++++++++++++++++++
 2 files changed, 55 insertions(+)
drivers/firmware/xilinx/zynqmp.c +0 -0
index bfaf29a..b0d140f 100644

drivers/firmware/xilinx/zynqmp.c int zynqmp_pm_release_node(const u32 node) · line 853

Quoted 9 lines
drivers/firmware/xilinx/zynqmp.c +6 -0
@@ -845,6 +845,41 @@ int zynqmp_pm_release_node(const u32 node)
 EXPORT_SYMBOL_GPL(zynqmp_pm_release_node);
 
 /**
+ * zynqmp_pm_force_powerdown - PM call to request for another PU or subsystem to
+ *             be powered down forcefully
+ * @target:    Node ID of the targeted PU or subsystem
+ * @ack:   Flag to specify whether acknowledge is requested
+ *
+ * Return: Returns status, either success or error+reason

This looks weird - two "Return" words doesn't look right.

drivers/firmware/xilinx/zynqmp.c int zynqmp_pm_release_node(const u32 node) · line 856

Quoted 3 lines
drivers/firmware/xilinx/zynqmp.c +3 -0
+ */
+int zynqmp_pm_force_powerdown(const u32 target,
+                  const enum zynqmp_pm_request_ack ack)

This should be aligned - run checkpatch --strict. And fix it globally.

drivers/firmware/xilinx/zynqmp.c int zynqmp_pm_release_node(const u32 node) · line 858

Quoted 2 lines
drivers/firmware/xilinx/zynqmp.c +2 -0
+{
+   return zynqmp_pm_invoke_fn(PM_FORCE_POWERDOWN, target, ack, 0, 0, NULL);

Also no spaces at the start of line is reported here.

Thanks,
Michal

#5 lore raw

PATCH v3 3/5 firmware: xilinx: Add RPU configuration APIs

In reply to Ben Levinsky

This patch adds APIs to provide access and a configuration interface to the current power state of a sub-system on Zynqmp sub-system.

---
changes since v2:
- add xilinx-related platform mgmt fn's instead of wrapping around function pointer in xilinx eemi ops struct

---
 drivers/firmware/xilinx/zynqmp.c     | 101 +++++++++++++++++++++++++++++++++++
 include/linux/firmware/xlnx-zynqmp.h |  30 +++++++++++
 2 files changed, 131 insertions(+)
drivers/firmware/xilinx/zynqmp.c +101 -0
index b0d140f..e0a906e 100644
@@ -845,6 +845,63 @@ int zynqmp_pm_release_node(const u32 node)
 EXPORT_SYMBOL_GPL(zynqmp_pm_release_node);
 
 /**
+ * zynqmp_pm_get_rpu_mode() - Get RPU mode
+ * @node_id:	Node ID of the device
+ * @arg1:	Argument 1 to requested IOCTL call
+ * @arg2:	Argument 2 to requested IOCTL call
+ * @out:	Returned output value
+ *
+ * Return: Returns RPU mode
+ */
+int zynqmp_pm_get_rpu_mode(u32 node_id,
+			u32 arg1, u32 arg2, u32 *out)
+{
+	return zynqmp_pm_invoke_fn(PM_IOCTL, node_id,
+				IOCTL_GET_RPU_OPER_MODE, 0, 0, out);
+}
+EXPORT_SYMBOL_GPL(zynqmp_pm_get_rpu_mode);
+
+/**
+ * zynqmp_pm_set_rpu_mode() - Set RPU mode
+ * @node_id:	Node ID of the device
+ * @ioctl_id:	ID of the requested IOCTL
+ * @arg2:	Argument 2 to requested IOCTL call
+ * @out:	Returned output value
+ *
+ * This function is used to set RPU mode.
+ *
+ * Return: Returns status, either success or error+reason
+ */
+int zynqmp_pm_set_rpu_mode(u32 node_id,
+			u32 arg1, u32 arg2, u32 *out)
+{
+	return zynqmp_pm_invoke_fn(PM_IOCTL, node_id,
+				IOCTL_SET_RPU_OPER_MODE, 0, 0, out);
+}
+EXPORT_SYMBOL_GPL(zynqmp_pm_set_rpu_mode);
+
+/**
+ * zynqmp_pm_tcm_comb_config - configure TCM
+ * @node_id:	Node ID of the device
+ * @arg1:	Argument 1 to requested IOCTL call
+ * @arg2:	Argument 2 to requested IOCTL call
+ * @out:	Returned output value
+ *
+ * This function is used to set RPU mode.
+ *
+ * Return: Returns status, either success or error+reason
+ */
+int zynqmp_pm_set_tcm_config(u32 node_id,
+			u32 arg1, u32 arg2, u32 *out)
+{
+	return zynqmp_pm_invoke_fn(PM_IOCTL, node_id,
+				IOCTL_TCM_COMB_CONFIG, 0, 0, out);
+
+}
+EXPORT_SYMBOL_GPL(zynqmp_pm_set_tcm_config);
+
+
+/**
  * zynqmp_pm_force_powerdown - PM call to request for another PU or subsystem to
  *             be powered down forcefully
  * @target:    Node ID of the targeted PU or subsystem
@@ -880,6 +937,50 @@ int zynqmp_pm_request_wakeup(const u32 node,
 EXPORT_SYMBOL_GPL(zynqmp_pm_request_wakeup);
 
 /**
+ * zynqmp_pm_get_node_status - PM call to request a node's current power state
+ * @node:      ID of the component or sub-system in question
+ * @status:        Current operating state of the requested node
+ * @requirements:  Current requirements asserted on the node,
+ *         used for slave nodes only.
+ * @usage:     Usage information, used for slave nodes only:
+ *         PM_USAGE_NO_MASTER  - No master is currently using
+ *                       the node
+ *         PM_USAGE_CURRENT_MASTER - Only requesting master is
+ *                       currently using the node
+ *         PM_USAGE_OTHER_MASTER   - Only other masters are
+ *                       currently using the node
+ *         PM_USAGE_BOTH_MASTERS   - Both the current and at least
+ *                       one other master is currently
+ *                       using the node
+ *
+ * Return:     Returns status, either success or error+reason
+ */
+int zynqmp_pm_get_node_status(const u32 node,
+			u32 *status, u32 *requirements,
+			u32 *usage)
+
+{
+   u32 ret_payload[PAYLOAD_ARG_CNT];
+   int ret;
+
+   if (!status)
+       return -EINVAL;
+
+   ret = zynqmp_pm_invoke_fn(PM_GET_NODE_STATUS, node, 0, 0,
+                 0, ret_payload);
+   if (ret_payload[0] == XST_PM_SUCCESS) {
+       *status = ret_payload[1];
+       if (requirements)
+           *requirements = ret_payload[2];
+       if (usage)
+           *usage = ret_payload[3];
+   }
+
+   return ret;
+}
+EXPORT_SYMBOL_GPL(zynqmp_pm_get_node_status);
+
+/**
  * zynqmp_pm_set_requirement() - PM call to set requirement for PM slaves
  * @node:		Node ID of the slave
  * @capabilities:	Requested capabilities of the slave
include/linux/firmware/xlnx-zynqmp.h +30 -0
index 1235923..c123d1b 100644
@@ -64,6 +64,7 @@
 
 enum pm_api_id {
 	PM_GET_API_VERSION = 1,
+	PM_GET_NODE_STATUS = 3,
 	PM_FORCE_POWERDOWN = 8,
 	PM_REQUEST_WAKEUP = 10,
 	PM_SYSTEM_SHUTDOWN = 12,
@@ -384,6 +385,14 @@ int zynqmp_pm_request_wakeup(const u32 node,
 			const bool set_addr,
 			const u64 address,
 			const enum zynqmp_pm_request_ack ack);
+int zynqmp_pm_get_node_status(const u32 node, u32 *status,
+			u32 *requirements, u32 *usage);
+int zynqmp_pm_get_rpu_mode(u32 node_id,
+            u32 arg1, u32 arg2, u32 *out);
+int zynqmp_pm_set_rpu_mode(u32 node_id,
+            u32 arg1, u32 arg2, u32 *out);
+int zynqmp_pm_set_tcm_config(u32 node_id,
+            u32 arg1, u32 arg2, u32 *out);
 #else
 static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void)
 {
@@ -546,6 +555,27 @@ static inline int zynqmp_pm_request_wakeup(const u32 node,
 {
 	return -ENODEV;
 }
+static inline int zynqmp_pm_get_node_status(const u32 node,
+			u32 *status, u32 *requirements,
+			u32 *usage)
+{
+	return -ENODEV;
+}
+static inline int zynqmp_pm_get_rpu_mode(u32 node_id,
+            u32 arg1, u32 arg2, u32 *out)
+{
+	return -ENODEV;
+}
+static inline int zynqmp_pm_set_rpu_mode(u32 node_id,
+            u32 arg1, u32 arg2, u32 *out)
+{
+	return -ENODEV;
+}
+static inline int zynqmp_pm_set_tcm_config(u32 node_id,
+            u32 arg1, u32 arg2, u32 *out)
+{
+	return -ENODEV;
+}
 #endif
 
 #endif /* __FIRMWARE_ZYNQMP_H__ */
Signature · 1 line
2.7.4
#6 lore raw

Re: [PATCH v3 3/5] firmware: xilinx: Add RPU configuration APIs

Quoted 18 lines · Ben Levinsky

This patch adds APIs to provide access and a configuration interface to the current power state of a sub-system on Zynqmp sub-system.

---
changes since v2:
- add xilinx-related platform mgmt fn's instead of wrapping around function pointer in xilinx eemi ops struct

---
 drivers/firmware/xilinx/zynqmp.c     | 101 +++++++++++++++++++++++++++++++++++
 include/linux/firmware/xlnx-zynqmp.h |  30 +++++++++++
 2 files changed, 131 insertions(+)
drivers/firmware/xilinx/zynqmp.c +0 -0
index b0d140f..e0a906e 100644

drivers/firmware/xilinx/zynqmp.c int zynqmp_pm_release_node(const u32 node) · line 854

Quoted 10 lines
drivers/firmware/xilinx/zynqmp.c +7 -0
@@ -845,6 +845,63 @@ int zynqmp_pm_release_node(const u32 node)
 EXPORT_SYMBOL_GPL(zynqmp_pm_release_node);
 
 /**
+ * zynqmp_pm_get_rpu_mode() - Get RPU mode
+ * @node_id:	Node ID of the device
+ * @arg1:	Argument 1 to requested IOCTL call
+ * @arg2:	Argument 2 to requested IOCTL call
+ * @out:	Returned output value
+ *
+ * Return: Returns RPU mode

ditto.

Quoted 39 lines
drivers/firmware/xilinx/zynqmp.c +39 -0
+ */
+int zynqmp_pm_get_rpu_mode(u32 node_id,
+			u32 arg1, u32 arg2, u32 *out)
+{
+	return zynqmp_pm_invoke_fn(PM_IOCTL, node_id,
+				IOCTL_GET_RPU_OPER_MODE, 0, 0, out);
+}
+EXPORT_SYMBOL_GPL(zynqmp_pm_get_rpu_mode);
+
+/**
+ * zynqmp_pm_set_rpu_mode() - Set RPU mode
+ * @node_id:	Node ID of the device
+ * @ioctl_id:	ID of the requested IOCTL
+ * @arg2:	Argument 2 to requested IOCTL call
+ * @out:	Returned output value
+ *
+ * This function is used to set RPU mode.
+ *
+ * Return: Returns status, either success or error+reason
+ */
+int zynqmp_pm_set_rpu_mode(u32 node_id,
+			u32 arg1, u32 arg2, u32 *out)
+{
+	return zynqmp_pm_invoke_fn(PM_IOCTL, node_id,
+				IOCTL_SET_RPU_OPER_MODE, 0, 0, out);
+}
+EXPORT_SYMBOL_GPL(zynqmp_pm_set_rpu_mode);
+
+/**
+ * zynqmp_pm_tcm_comb_config - configure TCM
+ * @node_id:	Node ID of the device
+ * @arg1:	Argument 1 to requested IOCTL call
+ * @arg2:	Argument 2 to requested IOCTL call
+ * @out:	Returned output value
+ *
+ * This function is used to set RPU mode.
+ *
+ * Return: Returns status, either success or error+reason
+ */

drivers/firmware/xilinx/zynqmp.c int zynqmp_pm_release_node(const u32 node) · line 903

Quoted 10 lines
drivers/firmware/xilinx/zynqmp.c +10 -0
+int zynqmp_pm_set_tcm_config(u32 node_id,
+			u32 arg1, u32 arg2, u32 *out)
+{
+	return zynqmp_pm_invoke_fn(PM_IOCTL, node_id,
+				IOCTL_TCM_COMB_CONFIG, 0, 0, out);
+
+}
+EXPORT_SYMBOL_GPL(zynqmp_pm_set_tcm_config);
+
+

double space here.

Quoted 38 lines
drivers/firmware/xilinx/zynqmp.c +31 -0
+/**
  * zynqmp_pm_force_powerdown - PM call to request for another PU or subsystem to
  *             be powered down forcefully
  * @target:    Node ID of the targeted PU or subsystem
@@ -880,6 +937,50 @@ int zynqmp_pm_request_wakeup(const u32 node,
 EXPORT_SYMBOL_GPL(zynqmp_pm_request_wakeup);
 
 /**
+ * zynqmp_pm_get_node_status - PM call to request a node's current power state
+ * @node:      ID of the component or sub-system in question
+ * @status:        Current operating state of the requested node
+ * @requirements:  Current requirements asserted on the node,
+ *         used for slave nodes only.
+ * @usage:     Usage information, used for slave nodes only:
+ *         PM_USAGE_NO_MASTER  - No master is currently using
+ *                       the node
+ *         PM_USAGE_CURRENT_MASTER - Only requesting master is
+ *                       currently using the node
+ *         PM_USAGE_OTHER_MASTER   - Only other masters are
+ *                       currently using the node
+ *         PM_USAGE_BOTH_MASTERS   - Both the current and at least
+ *                       one other master is currently
+ *                       using the node
+ *
+ * Return:     Returns status, either success or error+reason
+ */
+int zynqmp_pm_get_node_status(const u32 node,
+			u32 *status, u32 *requirements,
+			u32 *usage)
+
+{
+   u32 ret_payload[PAYLOAD_ARG_CNT];
+   int ret;
+
+   if (!status)
+       return -EINVAL;
+
+   ret = zynqmp_pm_invoke_fn(PM_GET_NODE_STATUS, node, 0, 0,

drivers/firmware/xilinx/zynqmp.c int zynqmp_pm_request_wakeup(const u32 node, · line 979

Quoted 10 lines
drivers/firmware/xilinx/zynqmp.c +10 -0
+                 0, ret_payload);
+   if (ret_payload[0] == XST_PM_SUCCESS) {
+       *status = ret_payload[1];
+       if (requirements)
+           *requirements = ret_payload[2];
+       if (usage)
+           *usage = ret_payload[3];
+   }
+
+   return ret;

indentation.

M

#7 lore raw

PATCH v3 4/5 dt-bindings: remoteproc: Add documentation for ZynqMP R5 rproc bindings

In reply to Ben Levinsky

Add binding for ZynqMP R5 OpenAMP.

Represent the RPU domain resources in one device node. Each RPU processor is a subnode of the top RPU domain node.

---
Changes since v2:
- update zynqmp_r5 yaml parsing to not raise warnings for extra information in children of R5 node. The warning "node has a unit name, but no reg or ranges property" will still be raised though as this particular node is needed to describe the '#address-cells' and '#size-cells' information.

---
 .../remoteproc/xilinx,zynqmp-r5-remoteproc.yaml    | 126 +++++++++++++++++++++
 1 file changed, 126 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/xilinx,zynqmp-r5-remoteproc.yaml
Documentation/devicetree/bindings/remoteproc/xilinx,zynqmp-r5-remoteproc.yaml new file +126 -0
new file mode 100644
index 0000000..e7d1496
@@ -0,0 +1,126 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/remoteproc/xilinx,zynqmp-r5-remoteproc.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Xilinx R5 remote processor controller bindings
+
+description:
+  This document defines the binding for the remoteproc component that loads and
+  boots firmwares on the Xilinx Zynqmp and Versal family chipset.
+
+maintainers:
+  - Ed Mooring <[email protected]>
+  - Ben Levinsky <[email protected]>
+
+properties:
+  compatible:
+    const: "xlnx,zynqmp-r5-remoteproc-1.0"
+
+  core_conf:
+    description:
+      R5 core configuration (valid string - split or lock-step)
+    maxItems: 1
+
+  interrupts:
+    description:
+      Interrupt mapping for remoteproc IPI. It is required if the
+      user uses the remoteproc driver with the RPMsg kernel driver.
+    maxItems: 6
+
+  memory-region:
+    maxItems: 4
+    minItems: 4
+  pnode-id:
+    maxItems: 1
+  mboxes:
+    maxItems: 2
+  mbox-names:
+    maxItems: 2
+
+  r5@0:
+    type: object
+    required:
+        - '#address-cells'
+        - '#size-cells'
+        - pnode-id
+examples:
+  - |
+     reserved-memory {
+          #address-cells = <1>;
+          #size-cells = <1>;
+          ranges;
+          rpu0vdev0vring0: rpu0vdev0vring0@3ed40000 {
+               no-map;
+               reg = <0x3ed40000 0x4000>;
+          };
+          rpu0vdev0vring1: rpu0vdev0vring1@3ed44000 {
+               no-map;
+               reg = <0x3ed44000 0x4000>;
+          };
+          rpu0vdev0buffer: rpu0vdev0buffer@3ed48000 {
+               no-map;
+               reg = <0x3ed48000 0x100000>;
+          };
+          rproc_0_reserved: rproc@3ed000000 {
+               no-map;
+               reg = <0x3ed00000 0x40000>;
+          };
+     };
+     rpu: rpu@ff9a0000 {
+          compatible = "xlnx,zynqmp-r5-remoteproc-1.0";
+          #address-cells = <1>;
+          #size-cells = <1>;
+          ranges;
+          core_conf = "split";
+          reg = <0xFF9A0000 0x10000>;
+          r5_0: r5@0 {
+               ranges;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               memory-region = <&rproc_0_reserved>, <&rpu0vdev0buffer>, <&rpu0vdev0vring0>, <&rpu0vdev0vring1>;
+               pnode-id = <0x7>;
+               mboxes = <&ipi_mailbox_rpu0 0>, <&ipi_mailbox_rpu0 1>;
+               mbox-names = "tx", "rx";
+               tcm_0_a: tcm_0@0 {
+                    #address-cells = <1>;
+                    #size-cells = <1>;
+                    reg = <0xFFE00000 0x10000>;
+                    pnode-id = <0xf>;
+               };
+               tcm_0_b: tcm_0@1 {
+                    #address-cells = <2>;
+                    #size-cells = <2>;
+                    reg = <0xFFE20000 0x10000>;
+                    pnode-id = <0x10>;
+               };
+          };
+     };
+
+
+     zynqmp_ipi1 {
+          compatible = "xlnx,zynqmp-ipi-mailbox";
+          interrupt-parent = <&gic>;
+          interrupts = <0 29 4>;
+          xlnx,ipi-id = <7>;
+          #address-cells = <1>;
+          #size-cells = <1>;
+          ranges;
+
+          /* APU<->RPU0 IPI mailbox controller */
+          ipi_mailbox_rpu0: mailbox@ff90000 {
+               reg = <0xff990600 0x20>,
+                     <0xff990620 0x20>,
+                     <0xff9900c0 0x20>,
+                     <0xff9900e0 0x20>;
+               reg-names = "local_request_region",
+                        "local_response_region",
+                        "remote_request_region",
+                        "remote_response_region";
+               #mbox-cells = <1>;
+               xlnx,ipi-id = <1>;
+          };
+     };
+
+...
Signature · 1 line
2.7.4
maintainer
#8 lore raw

Re: [PATCH v3 4/5] dt-bindings: remoteproc: Add documentation for ZynqMP R5 rproc bindings

Quoted 16 lines · Ben Levinsky

Add binding for ZynqMP R5 OpenAMP.

Represent the RPU domain resources in one device node. Each RPU processor is a subnode of the top RPU domain node.

---
Changes since v2:
- update zynqmp_r5 yaml parsing to not raise warnings for extra information in children of R5 node. The warning "node has a unit name, but no reg or ranges property" will still be raised though as this particular node is needed to describe the '#address-cells' and '#size-cells' information.

Quoted 5 lines
---
 .../remoteproc/xilinx,zynqmp-r5-remoteproc.yaml    | 126 +++++++++++++++++++++
 1 file changed, 126 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/xilinx,zynqmp-r5-remoteproc.yaml

My bot found errors running 'make dt_binding_check' on your patch:

Documentation/devicetree/bindings/remoteproc/xilinx,zynqmp-r5-remoteproc.example.dts:45.25-65.16: Warning (unit_address_vs_reg): /example-0/rpu@ff9a0000/r5@0: node has a unit name, but no reg or ranges property

See https://patchwork.ozlabs.org/patch/1273784

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure dt-schema is up to date:

pip3 install git+https://github.com/devicetree-org/dt-schema.git@master --upgrade

Please check and re-submit.

#9 lore raw

RE: [PATCH v3 4/5] dt-bindings: remoteproc: Add documentation for ZynqMP R5 rproc bindings

Hi Rob,

Please see my replies inline.

Best Regards
Ben

-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Wednesday, April 22, 2020 12:38 PM
To: Ben Levinsky <[email protected]>
Cc: [email protected]; [email protected]; Michal Simek <[email protected]>; Jolly Shah <[email protected]>; Rajan Vaja <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jason Wu <[email protected]>; Jiaying Liang <[email protected]>
Subject: Re: [PATCH v3 4/5] dt-bindings: remoteproc: Add documentation for ZynqMP R5 rproc bindings

Quoted 16 lines · Ben Levinsky

Add binding for ZynqMP R5 OpenAMP.

Represent the RPU domain resources in one device node. Each RPU processor is a subnode of the top RPU domain node.

---
Changes since v2:
- update zynqmp_r5 yaml parsing to not raise warnings for extra information in children of R5 node. The warning "node has a unit name, but no reg or ranges property" will still be raised though as this particular node is needed to describe the '#address-cells' and '#size-cells' information.

Quoted 7 lines
---
 .../remoteproc/xilinx,zynqmp-r5-remoteproc.yaml    | 126 +++++++++++++++++++++
 1 file changed, 126 insertions(+)
 create mode 100644 

Documentation/devicetree/bindings/remoteproc/xilinx,zynqmp-r5-remotepr oc.yaml

My bot found errors running 'make dt_binding_check' on your patch:

Documentation/devicetree/bindings/remoteproc/xilinx,zynqmp-r5-remoteproc.example.dts:45.25-65.16: Warning (unit_address_vs_reg): /example-0/rpu@ff9a0000/r5@0: node has a unit name, but no reg or ranges property [Ben Levinsky] Yes the following warning is expected. As the node in question has to describe the address-cells and size-cells. As these are needed for its children to then also have address-cells, size-cells and reg values without raising more warnings.

See https://patchwork.ozlabs.org/patch/1273784

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure dt-schema is up to date:

pip3 install git+https://github.com/devicetree-org/dt-schema.git@master --upgrade

Please check and re-submit.

#10 lore raw

PATCH v3 5/5 remoteproc: Add initial zynqmp R5 remoteproc driver

In reply to Ben Levinsky

R5 is included in Xilinx Zynq UltraScale MPSoC so by adding this remotproc driver, we can boot the R5 sub-system in different configurations.

---
Changes since v1:
- remove domain struct as per review from Mathieu Changes since 2:
- add xilinx-related platform mgmt fn's instead of wrapping around function pointer in xilinx eemi ops struct

---
 drivers/remoteproc/Kconfig                |  10 +
 drivers/remoteproc/Makefile               |   1 +
 drivers/remoteproc/zynqmp_r5_remoteproc.c | 902 ++++++++++++++++++++++++++++++
 3 files changed, 913 insertions(+)
 create mode 100644 drivers/remoteproc/zynqmp_r5_remoteproc.c
drivers/remoteproc/Kconfig +10 -0
index fbaed07..f094c84 100644
@@ -222,6 +222,16 @@ config ST_REMOTEPROC
 	  processor framework.
 	  This can be either built-in or a loadable module.
 
+config ZYNQMP_R5_REMOTEPROC
+	tristate "ZynqMP_r5 remoteproc support"
+	depends on ARM64 && PM && ARCH_ZYNQMP
+	select RPMSG_VIRTIO
+	select MAILBOX
+	select ZYNQMP_IPI_MBOX
+	help
+	  Say y here to support ZynqMP R5 remote processors via the remote
+	  processor framework.
+
 config ST_SLIM_REMOTEPROC
 	tristate
 
drivers/remoteproc/Makefile +1 -0
index 0effd38..806ac3f 100644
@@ -27,5 +27,6 @@ obj-$(CONFIG_QCOM_WCNSS_PIL)		+= qcom_wcnss_pil.o
 qcom_wcnss_pil-y			+= qcom_wcnss.o
 qcom_wcnss_pil-y			+= qcom_wcnss_iris.o
 obj-$(CONFIG_ST_REMOTEPROC)		+= st_remoteproc.o
+obj-$(CONFIG_ZYNQMP_R5_REMOTEPROC)	+= zynqmp_r5_remoteproc.o
 obj-$(CONFIG_ST_SLIM_REMOTEPROC)	+= st_slim_rproc.o
 obj-$(CONFIG_STM32_RPROC)		+= stm32_rproc.o
drivers/remoteproc/zynqmp_r5_remoteproc.c new file +902 -0

902 lines not on this page · raw message

Signature · 1 line
2.7.4
#11 lore raw
In reply to Ben Levinsky
Quoted 11 lines · Ben Levinsky

There are Cortex-R5 processors on Xilinx ZynqMP UltraScale+ MPSoC.
This patch is to add an Xilinx ZynqMP R5 remoteproc driver to enable Linux kernel to bringup R5, and enable communication between Linux kernel and R5.

There are Cortex-R5 processors on the Xilinx ZynqMP UltraScale+ MPSoC. This patch adds a Xilinx ZynqMP R5 remoteproc driver to enable the Linux kernel to bring up the R5s, and to enable communication between the Linux kernel and R5s.

This is based on any code which is not upstream. It means you need to say what it is your base here.

Thanks,
Michal