All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Lokesh Vutla" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Lokesh Vutla <lokeshvutla@ti.com>, Marc Zyngier <maz@kernel.org>,
	Nishanth Menon <nm@ti.com>, x86 <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [tip: irq/urgent] firmware: ti_sci: Add support for getting resource with subtype
Date: Tue, 25 Aug 2020 23:41:00 -0000	[thread overview]
Message-ID: <159839886071.389.11629547785320042606.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20200806074826.24607-4-lokeshvutla@ti.com>

The following commit has been merged into the irq/urgent branch of tip:

Commit-ID:     53bf2b0e4e4c1ff0a957474237f9dcd20036ca54
Gitweb:        https://git.kernel.org/tip/53bf2b0e4e4c1ff0a957474237f9dcd20036ca54
Author:        Lokesh Vutla <lokeshvutla@ti.com>
AuthorDate:    Thu, 06 Aug 2020 13:18:16 +05:30
Committer:     Marc Zyngier <maz@kernel.org>
CommitterDate: Sun, 16 Aug 2020 22:00:22 +01:00

firmware: ti_sci: Add support for getting resource with subtype

With SYSFW ABI 3.0 changes, interrupts coming out of an interrupt
controller is identified by a type and it is consistent across SoCs.
Similarly global events for Interrupt aggregator. So add an API to get
resource range using a resource type.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Acked-by: Nishanth Menon <nm@ti.com>
Link: https://lore.kernel.org/r/20200806074826.24607-4-lokeshvutla@ti.com
---
 drivers/firmware/ti_sci.c              | 89 ++++++++++++++++++-------
 include/linux/soc/ti/ti_sci_protocol.h | 13 ++++-
 2 files changed, 80 insertions(+), 22 deletions(-)

diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index 03bd01b..722af9e 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -3208,61 +3208,50 @@ u32 ti_sci_get_num_resources(struct ti_sci_resource *res)
 EXPORT_SYMBOL_GPL(ti_sci_get_num_resources);
 
 /**
- * devm_ti_sci_get_of_resource() - Get a TISCI resource assigned to a device
+ * devm_ti_sci_get_resource_sets() - Get a TISCI resources assigned to a device
  * @handle:	TISCI handle
  * @dev:	Device pointer to which the resource is assigned
  * @dev_id:	TISCI device id to which the resource is assigned
- * @of_prop:	property name by which the resource are represented
+ * @sub_types:	Array of sub_types assigned corresponding to device
+ * @sets:	Number of sub_types
  *
  * Return: Pointer to ti_sci_resource if all went well else appropriate
  *	   error pointer.
  */
-struct ti_sci_resource *
-devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
-			    struct device *dev, u32 dev_id, char *of_prop)
+static struct ti_sci_resource *
+devm_ti_sci_get_resource_sets(const struct ti_sci_handle *handle,
+			      struct device *dev, u32 dev_id, u32 *sub_types,
+			      u32 sets)
 {
 	struct ti_sci_resource *res;
 	bool valid_set = false;
-	u32 resource_subtype;
 	int i, ret;
 
 	res = devm_kzalloc(dev, sizeof(*res), GFP_KERNEL);
 	if (!res)
 		return ERR_PTR(-ENOMEM);
 
-	ret = of_property_count_elems_of_size(dev_of_node(dev), of_prop,
-					      sizeof(u32));
-	if (ret < 0) {
-		dev_err(dev, "%s resource type ids not available\n", of_prop);
-		return ERR_PTR(ret);
-	}
-	res->sets = ret;
-
+	res->sets = sets;
 	res->desc = devm_kcalloc(dev, res->sets, sizeof(*res->desc),
 				 GFP_KERNEL);
 	if (!res->desc)
 		return ERR_PTR(-ENOMEM);
 
 	for (i = 0; i < res->sets; i++) {
-		ret = of_property_read_u32_index(dev_of_node(dev), of_prop, i,
-						 &resource_subtype);
-		if (ret)
-			return ERR_PTR(-EINVAL);
-
 		ret = handle->ops.rm_core_ops.get_range(handle, dev_id,
-							resource_subtype,
+							sub_types[i],
 							&res->desc[i].start,
 							&res->desc[i].num);
 		if (ret) {
 			dev_dbg(dev, "dev = %d subtype %d not allocated for this host\n",
-				dev_id, resource_subtype);
+				dev_id, sub_types[i]);
 			res->desc[i].start = 0;
 			res->desc[i].num = 0;
 			continue;
 		}
 
 		dev_dbg(dev, "dev = %d, subtype = %d, start = %d, num = %d\n",
-			dev_id, resource_subtype, res->desc[i].start,
+			dev_id, sub_types[i], res->desc[i].start,
 			res->desc[i].num);
 
 		valid_set = true;
@@ -3280,6 +3269,62 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
 	return ERR_PTR(-EINVAL);
 }
 
+/**
+ * devm_ti_sci_get_of_resource() - Get a TISCI resource assigned to a device
+ * @handle:	TISCI handle
+ * @dev:	Device pointer to which the resource is assigned
+ * @dev_id:	TISCI device id to which the resource is assigned
+ * @of_prop:	property name by which the resource are represented
+ *
+ * Return: Pointer to ti_sci_resource if all went well else appropriate
+ *	   error pointer.
+ */
+struct ti_sci_resource *
+devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
+			    struct device *dev, u32 dev_id, char *of_prop)
+{
+	struct ti_sci_resource *res;
+	u32 *sub_types;
+	int sets;
+
+	sets = of_property_count_elems_of_size(dev_of_node(dev), of_prop,
+					       sizeof(u32));
+	if (sets < 0) {
+		dev_err(dev, "%s resource type ids not available\n", of_prop);
+		return ERR_PTR(sets);
+	}
+
+	sub_types = kcalloc(sets, sizeof(*sub_types), GFP_KERNEL);
+	if (!sub_types)
+		return ERR_PTR(-ENOMEM);
+
+	of_property_read_u32_array(dev_of_node(dev), of_prop, sub_types, sets);
+	res = devm_ti_sci_get_resource_sets(handle, dev, dev_id, sub_types,
+					    sets);
+
+	kfree(sub_types);
+	return res;
+}
+EXPORT_SYMBOL_GPL(devm_ti_sci_get_of_resource);
+
+/**
+ * devm_ti_sci_get_resource() - Get a resource range assigned to the device
+ * @handle:	TISCI handle
+ * @dev:	Device pointer to which the resource is assigned
+ * @dev_id:	TISCI device id to which the resource is assigned
+ * @suub_type:	TISCI resource subytpe representing the resource.
+ *
+ * Return: Pointer to ti_sci_resource if all went well else appropriate
+ *	   error pointer.
+ */
+struct ti_sci_resource *
+devm_ti_sci_get_resource(const struct ti_sci_handle *handle, struct device *dev,
+			 u32 dev_id, u32 sub_type)
+{
+	return devm_ti_sci_get_resource_sets(handle, dev, dev_id, &sub_type, 1);
+}
+EXPORT_SYMBOL_GPL(devm_ti_sci_get_resource);
+
 static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode,
 				void *cmd)
 {
diff --git a/include/linux/soc/ti/ti_sci_protocol.h b/include/linux/soc/ti/ti_sci_protocol.h
index 49c5d29..cf27b08 100644
--- a/include/linux/soc/ti/ti_sci_protocol.h
+++ b/include/linux/soc/ti/ti_sci_protocol.h
@@ -220,6 +220,9 @@ struct ti_sci_rm_core_ops {
 				    u16 *range_start, u16 *range_num);
 };
 
+#define TI_SCI_RESASG_SUBTYPE_IR_OUTPUT		0
+#define TI_SCI_RESASG_SUBTYPE_IA_VINT		0xa
+#define TI_SCI_RESASG_SUBTYPE_GLOBAL_EVENT_SEVT	0xd
 /**
  * struct ti_sci_rm_irq_ops: IRQ management operations
  * @set_irq:		Set an IRQ route between the requested source
@@ -556,6 +559,9 @@ u32 ti_sci_get_num_resources(struct ti_sci_resource *res);
 struct ti_sci_resource *
 devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
 			    struct device *dev, u32 dev_id, char *of_prop);
+struct ti_sci_resource *
+devm_ti_sci_get_resource(const struct ti_sci_handle *handle, struct device *dev,
+			 u32 dev_id, u32 sub_type);
 
 #else	/* CONFIG_TI_SCI_PROTOCOL */
 
@@ -609,6 +615,13 @@ devm_ti_sci_get_of_resource(const struct ti_sci_handle *handle,
 {
 	return ERR_PTR(-EINVAL);
 }
+
+static inline struct ti_sci_resource *
+devm_ti_sci_get_resource(const struct ti_sci_handle *handle, struct device *dev,
+			 u32 dev_id, u32 sub_type);
+{
+	return ERR_PTR(-EINVAL);
+}
 #endif	/* CONFIG_TI_SCI_PROTOCOL */
 
 #endif	/* __TISCI_PROTOCOL_H */

  reply	other threads:[~2020-08-25 23:41 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-06  7:48 [PATCH v6 00/13] irqchip: ti,sci-intr/inta: Update the dt bindings to accept different interrupt parents Lokesh Vutla
2020-08-06  7:48 ` [PATCH v6 00/13] irqchip: ti, sci-intr/inta: " Lokesh Vutla
2020-08-06  7:48 ` [PATCH v6 01/13] firmware: ti_sci: Drop the device id to resource type translation Lokesh Vutla
2020-08-06  7:48   ` Lokesh Vutla
2020-08-25 23:41   ` [tip: irq/urgent] " tip-bot2 for Lokesh Vutla
2020-08-06  7:48 ` [PATCH v6 02/13] firmware: ti_sci: Drop unused structure ti_sci_rm_type_map Lokesh Vutla
2020-08-06  7:48   ` Lokesh Vutla
2020-08-25 23:41   ` [tip: irq/urgent] " tip-bot2 for Lokesh Vutla
2020-08-06  7:48 ` [PATCH v6 03/13] firmware: ti_sci: Add support for getting resource with subtype Lokesh Vutla
2020-08-06  7:48   ` Lokesh Vutla
2020-08-25 23:41   ` tip-bot2 for Lokesh Vutla [this message]
2020-08-06  7:48 ` [PATCH v6 04/13] dt-bindings: irqchip: ti,sci-intr: Update bindings to drop the usage of gic as parent Lokesh Vutla
2020-08-06  7:48   ` [PATCH v6 04/13] dt-bindings: irqchip: ti, sci-intr: " Lokesh Vutla
2020-08-25 23:41   ` [tip: irq/urgent] " tip-bot2 for Lokesh Vutla
2020-08-06  7:48 ` [PATCH v6 05/13] dt-bindings: irqchip: Convert ti,sci-intr bindings to yaml Lokesh Vutla
2020-08-06  7:48   ` [PATCH v6 05/13] dt-bindings: irqchip: Convert ti, sci-intr " Lokesh Vutla
2020-08-25 23:40   ` [tip: irq/urgent] " tip-bot2 for Lokesh Vutla
2020-08-06  7:48 ` [PATCH v6 06/13] irqchip/ti-sci-intr: Add support for INTR being a parent to INTR Lokesh Vutla
2020-08-06  7:48   ` Lokesh Vutla
2020-08-25 23:40   ` [tip: irq/urgent] " tip-bot2 for Lokesh Vutla
2020-08-06  7:48 ` [PATCH v6 07/13] dt-bindings: irqchip: ti,sci-inta: Update docs to support different parent Lokesh Vutla
2020-08-06  7:48   ` [PATCH v6 07/13] dt-bindings: irqchip: ti, sci-inta: " Lokesh Vutla
2020-08-25 23:40   ` [tip: irq/urgent] " tip-bot2 for Lokesh Vutla
2020-08-06  7:48 ` [PATCH v6 08/13] dt-bindings: irqchip: Convert ti,sci-inta bindings to yaml Lokesh Vutla
2020-08-06  7:48   ` [PATCH v6 08/13] dt-bindings: irqchip: Convert ti, sci-inta " Lokesh Vutla
2020-08-25 23:40   ` [tip: irq/urgent] " tip-bot2 for Lokesh Vutla
2020-08-06  7:48 ` [PATCH v6 09/13] irqchip/ti-sci-inta: Do not store TISCI device id in platform device id field Lokesh Vutla
2020-08-06  7:48   ` Lokesh Vutla
2020-08-25 23:40   ` [tip: irq/urgent] " tip-bot2 for Lokesh Vutla
2020-08-06  7:48 ` [PATCH v6 10/13] irqchip/ti-sci-inta: Add support for INTA directly connecting to GIC Lokesh Vutla
2020-08-06  7:48   ` Lokesh Vutla
2020-08-25 23:40   ` [tip: irq/urgent] " tip-bot2 for Lokesh Vutla
2020-08-06  7:48 ` [PATCH v6 11/13] arm64: dts: k3-j721e: ti-sci-inta/intr: Update to latest bindings Lokesh Vutla
2020-08-06  7:48   ` Lokesh Vutla
2020-08-12 13:35   ` Nishanth Menon
2020-08-12 13:35     ` Nishanth Menon
2020-08-25 23:40   ` [tip: irq/urgent] " tip-bot2 for Lokesh Vutla
2020-08-06  7:48 ` [PATCH v6 12/13] arm64: dts: k3-am65: " Lokesh Vutla
2020-08-06  7:48   ` Lokesh Vutla
2020-08-12 13:35   ` Nishanth Menon
2020-08-12 13:35     ` Nishanth Menon
2020-08-25 23:40   ` [tip: irq/urgent] " tip-bot2 for Lokesh Vutla
2020-08-06  7:48 ` [PATCH v6 13/13] arm64: dts: k3-am65: Update the RM resource types Lokesh Vutla
2020-08-06  7:48   ` Lokesh Vutla
2020-08-12 13:36   ` Nishanth Menon
2020-08-12 13:36     ` Nishanth Menon
2020-08-25 23:40   ` [tip: irq/urgent] " tip-bot2 for Lokesh Vutla
2020-08-07  6:32 ` [PATCH v6 00/13] irqchip: ti,sci-intr/inta: Update the dt bindings to accept different interrupt parents Lokesh Vutla
2020-08-07  6:32   ` Lokesh Vutla
2020-08-12  2:14 ` Lokesh Vutla
2020-08-12  2:14   ` Lokesh Vutla
2020-08-12 13:40 ` Nishanth Menon
2020-08-12 13:40   ` Nishanth Menon
2020-08-13  9:41 ` Peter Ujfalusi
2020-08-13  9:41   ` Peter Ujfalusi
2020-08-13 10:03   ` Sekhar Nori
2020-08-13 10:03     ` Sekhar Nori
2020-08-13 10:20     ` Peter Ujfalusi
2020-08-13 10:20       ` Peter Ujfalusi
2020-08-16 21:03 ` [PATCH v6 00/13] irqchip: ti, sci-intr/inta: " Marc Zyngier
2020-08-16 21:03   ` Marc Zyngier
2020-08-17 17:30   ` Sekhar Nori
2020-08-17 17:30     ` Sekhar Nori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=159839886071.389.11629547785320042606.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=lokeshvutla@ti.com \
    --cc=maz@kernel.org \
    --cc=nm@ti.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.