All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] soc: ti: k3-am654: Allow for exclsive request of devices
@ 2019-02-18  5:15 ` Lokesh Vutla
  0 siblings, 0 replies; 13+ messages in thread
From: Lokesh Vutla @ 2019-02-18  5:15 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring
  Cc: Lokesh Vutla, Device Tree Mailing List, Sekhar Nori,
	Linux ARM Mailing List

Sysfw provides an option for requesting exclusive access for a
device using the flags MSG_FLAG_DEVICE_EXCLUSIVE. Once a device
is requested from a host with this flag set, any request to this
device from a different host will be nacked by sysfw. Current tisci
driver enables this flag for every device requests. But this may not
be true for all the devices. This series adds support for providing
an option to enable or disable exclusive permissions.

Lokesh Vutla (4):
  firmware: ti_sci: (Dis)Allow for device exclusive permissions
  soc: ti: ti_sci_pm_domains: Add support for exclusive access
  soc: ti: ti_sci_pm_domains: Switch to SPDX Licensing
  arm64: dts: ti: k3-am654: Update the power domain cells

 .../bindings/soc/ti/sci-pm-domain.txt         |  7 ++-
 arch/arm64/boot/dts/ti/k3-am65-main.dtsi      | 26 +++++------
 arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi       | 10 ++---
 arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi    |  6 +--
 drivers/firmware/ti_sci.c                     | 45 ++++++++++++++++++-
 drivers/soc/ti/ti_sci_pm_domains.c            | 32 ++++++++-----
 include/linux/soc/ti/ti_sci_protocol.h        |  3 ++
 7 files changed, 93 insertions(+), 36 deletions(-)

-- 
2.19.2

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

* [PATCH 0/4] soc: ti: k3-am654: Allow for exclsive request of devices
@ 2019-02-18  5:15 ` Lokesh Vutla
  0 siblings, 0 replies; 13+ messages in thread
From: Lokesh Vutla @ 2019-02-18  5:15 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring
  Cc: Lokesh Vutla, Device Tree Mailing List, Sekhar Nori,
	Linux ARM Mailing List

Sysfw provides an option for requesting exclusive access for a
device using the flags MSG_FLAG_DEVICE_EXCLUSIVE. Once a device
is requested from a host with this flag set, any request to this
device from a different host will be nacked by sysfw. Current tisci
driver enables this flag for every device requests. But this may not
be true for all the devices. This series adds support for providing
an option to enable or disable exclusive permissions.

Lokesh Vutla (4):
  firmware: ti_sci: (Dis)Allow for device exclusive permissions
  soc: ti: ti_sci_pm_domains: Add support for exclusive access
  soc: ti: ti_sci_pm_domains: Switch to SPDX Licensing
  arm64: dts: ti: k3-am654: Update the power domain cells

 .../bindings/soc/ti/sci-pm-domain.txt         |  7 ++-
 arch/arm64/boot/dts/ti/k3-am65-main.dtsi      | 26 +++++------
 arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi       | 10 ++---
 arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi    |  6 +--
 drivers/firmware/ti_sci.c                     | 45 ++++++++++++++++++-
 drivers/soc/ti/ti_sci_pm_domains.c            | 32 ++++++++-----
 include/linux/soc/ti/ti_sci_protocol.h        |  3 ++
 7 files changed, 93 insertions(+), 36 deletions(-)

-- 
2.19.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 1/4] firmware: ti_sci: (Dis)Allow for device exclusive permissions
  2019-02-18  5:15 ` Lokesh Vutla
@ 2019-02-18  5:15   ` Lokesh Vutla
  -1 siblings, 0 replies; 13+ messages in thread
From: Lokesh Vutla @ 2019-02-18  5:15 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring
  Cc: Lokesh Vutla, Device Tree Mailing List, Sekhar Nori,
	Linux ARM Mailing List

Sysfw provides an option for requesting exclusive access for a
device using the flags MSG_FLAG_DEVICE_EXCLUSIVE. Once a device
is requested from a host with this flag set, any request to this
device from a different host will be nacked by sysfw. Current tisci
driver enables this flag for every device requests. But this may not
be true for all the devices. So provide a separate command in driver
for exclusive and non-exclusive device requests.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 drivers/firmware/ti_sci.c              | 45 ++++++++++++++++++++++++--
 include/linux/soc/ti/ti_sci_protocol.h |  3 ++
 2 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index 69ed1464175c..8c6f21ceb6f2 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -634,6 +634,7 @@ static int ti_sci_get_device_state(const struct ti_sci_handle *handle,
 
 /**
  * ti_sci_cmd_get_device() - command to request for device managed by TISCI
+ *			     that can be shared with other hosts.
  * @handle:	Pointer to TISCI handle as retrieved by *ti_sci_get_handle
  * @id:		Device Identifier
  *
@@ -641,11 +642,29 @@ static int ti_sci_get_device_state(const struct ti_sci_handle *handle,
  * usage count by balancing get_device with put_device. No refcounting is
  * managed by driver for that purpose.
  *
- * NOTE: The request is for exclusive access for the processor.
- *
  * Return: 0 if all went fine, else return appropriate error.
  */
 static int ti_sci_cmd_get_device(const struct ti_sci_handle *handle, u32 id)
+{
+	return ti_sci_set_device_state(handle, id, 0,
+				       MSG_DEVICE_SW_STATE_ON);
+}
+
+/**
+ * ti_sci_cmd_get_device_exclusive() - command to request for device managed by
+ *				       TISCI that is exclusively owned by the
+ *				       requesting host.
+ * @handle:	Pointer to TISCI handle as retrieved by *ti_sci_get_handle
+ * @id:		Device Identifier
+ *
+ * Request for the device - NOTE: the client MUST maintain integrity of
+ * usage count by balancing get_device with put_device. No refcounting is
+ * managed by driver for that purpose.
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_cmd_get_device_exclusive(const struct ti_sci_handle *handle,
+					   u32 id)
 {
 	return ti_sci_set_device_state(handle, id,
 				       MSG_FLAG_DEVICE_EXCLUSIVE,
@@ -664,6 +683,26 @@ static int ti_sci_cmd_get_device(const struct ti_sci_handle *handle, u32 id)
  * Return: 0 if all went fine, else return appropriate error.
  */
 static int ti_sci_cmd_idle_device(const struct ti_sci_handle *handle, u32 id)
+{
+	return ti_sci_set_device_state(handle, id, 0,
+				       MSG_DEVICE_SW_STATE_RETENTION);
+}
+
+/**
+ * ti_sci_cmd_idle_device_exclusive() - Command to idle a device managed by
+ *					TISCI that is exclusively owned by
+ *					requesting host.
+ * @handle:	Pointer to TISCI handle as retrieved by *ti_sci_get_handle
+ * @id:		Device Identifier
+ *
+ * Request for the device - NOTE: the client MUST maintain integrity of
+ * usage count by balancing get_device with put_device. No refcounting is
+ * managed by driver for that purpose.
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_cmd_idle_device_exclusive(const struct ti_sci_handle *handle,
+					    u32 id)
 {
 	return ti_sci_set_device_state(handle, id,
 				       MSG_FLAG_DEVICE_EXCLUSIVE,
@@ -1631,7 +1670,9 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
 	core_ops->reboot_device = ti_sci_cmd_core_reboot;
 
 	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;
diff --git a/include/linux/soc/ti/ti_sci_protocol.h b/include/linux/soc/ti/ti_sci_protocol.h
index 18435e5c6364..5d704bb33989 100644
--- a/include/linux/soc/ti/ti_sci_protocol.h
+++ b/include/linux/soc/ti/ti_sci_protocol.h
@@ -97,7 +97,10 @@ struct ti_sci_core_ops {
  */
 struct ti_sci_dev_ops {
 	int (*get_device)(const struct ti_sci_handle *handle, u32 id);
+	int (*get_device_exclusive)(const struct ti_sci_handle *handle, u32 id);
 	int (*idle_device)(const struct ti_sci_handle *handle, u32 id);
+	int (*idle_device_exclusive)(const struct ti_sci_handle *handle,
+				     u32 id);
 	int (*put_device)(const struct ti_sci_handle *handle, u32 id);
 	int (*is_valid)(const struct ti_sci_handle *handle, u32 id);
 	int (*get_context_loss_count)(const struct ti_sci_handle *handle,
-- 
2.19.2

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

* [PATCH 1/4] firmware: ti_sci: (Dis)Allow for device exclusive permissions
@ 2019-02-18  5:15   ` Lokesh Vutla
  0 siblings, 0 replies; 13+ messages in thread
From: Lokesh Vutla @ 2019-02-18  5:15 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring
  Cc: Lokesh Vutla, Device Tree Mailing List, Sekhar Nori,
	Linux ARM Mailing List

Sysfw provides an option for requesting exclusive access for a
device using the flags MSG_FLAG_DEVICE_EXCLUSIVE. Once a device
is requested from a host with this flag set, any request to this
device from a different host will be nacked by sysfw. Current tisci
driver enables this flag for every device requests. But this may not
be true for all the devices. So provide a separate command in driver
for exclusive and non-exclusive device requests.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 drivers/firmware/ti_sci.c              | 45 ++++++++++++++++++++++++--
 include/linux/soc/ti/ti_sci_protocol.h |  3 ++
 2 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index 69ed1464175c..8c6f21ceb6f2 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -634,6 +634,7 @@ static int ti_sci_get_device_state(const struct ti_sci_handle *handle,
 
 /**
  * ti_sci_cmd_get_device() - command to request for device managed by TISCI
+ *			     that can be shared with other hosts.
  * @handle:	Pointer to TISCI handle as retrieved by *ti_sci_get_handle
  * @id:		Device Identifier
  *
@@ -641,11 +642,29 @@ static int ti_sci_get_device_state(const struct ti_sci_handle *handle,
  * usage count by balancing get_device with put_device. No refcounting is
  * managed by driver for that purpose.
  *
- * NOTE: The request is for exclusive access for the processor.
- *
  * Return: 0 if all went fine, else return appropriate error.
  */
 static int ti_sci_cmd_get_device(const struct ti_sci_handle *handle, u32 id)
+{
+	return ti_sci_set_device_state(handle, id, 0,
+				       MSG_DEVICE_SW_STATE_ON);
+}
+
+/**
+ * ti_sci_cmd_get_device_exclusive() - command to request for device managed by
+ *				       TISCI that is exclusively owned by the
+ *				       requesting host.
+ * @handle:	Pointer to TISCI handle as retrieved by *ti_sci_get_handle
+ * @id:		Device Identifier
+ *
+ * Request for the device - NOTE: the client MUST maintain integrity of
+ * usage count by balancing get_device with put_device. No refcounting is
+ * managed by driver for that purpose.
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_cmd_get_device_exclusive(const struct ti_sci_handle *handle,
+					   u32 id)
 {
 	return ti_sci_set_device_state(handle, id,
 				       MSG_FLAG_DEVICE_EXCLUSIVE,
@@ -664,6 +683,26 @@ static int ti_sci_cmd_get_device(const struct ti_sci_handle *handle, u32 id)
  * Return: 0 if all went fine, else return appropriate error.
  */
 static int ti_sci_cmd_idle_device(const struct ti_sci_handle *handle, u32 id)
+{
+	return ti_sci_set_device_state(handle, id, 0,
+				       MSG_DEVICE_SW_STATE_RETENTION);
+}
+
+/**
+ * ti_sci_cmd_idle_device_exclusive() - Command to idle a device managed by
+ *					TISCI that is exclusively owned by
+ *					requesting host.
+ * @handle:	Pointer to TISCI handle as retrieved by *ti_sci_get_handle
+ * @id:		Device Identifier
+ *
+ * Request for the device - NOTE: the client MUST maintain integrity of
+ * usage count by balancing get_device with put_device. No refcounting is
+ * managed by driver for that purpose.
+ *
+ * Return: 0 if all went fine, else return appropriate error.
+ */
+static int ti_sci_cmd_idle_device_exclusive(const struct ti_sci_handle *handle,
+					    u32 id)
 {
 	return ti_sci_set_device_state(handle, id,
 				       MSG_FLAG_DEVICE_EXCLUSIVE,
@@ -1631,7 +1670,9 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
 	core_ops->reboot_device = ti_sci_cmd_core_reboot;
 
 	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;
diff --git a/include/linux/soc/ti/ti_sci_protocol.h b/include/linux/soc/ti/ti_sci_protocol.h
index 18435e5c6364..5d704bb33989 100644
--- a/include/linux/soc/ti/ti_sci_protocol.h
+++ b/include/linux/soc/ti/ti_sci_protocol.h
@@ -97,7 +97,10 @@ struct ti_sci_core_ops {
  */
 struct ti_sci_dev_ops {
 	int (*get_device)(const struct ti_sci_handle *handle, u32 id);
+	int (*get_device_exclusive)(const struct ti_sci_handle *handle, u32 id);
 	int (*idle_device)(const struct ti_sci_handle *handle, u32 id);
+	int (*idle_device_exclusive)(const struct ti_sci_handle *handle,
+				     u32 id);
 	int (*put_device)(const struct ti_sci_handle *handle, u32 id);
 	int (*is_valid)(const struct ti_sci_handle *handle, u32 id);
 	int (*get_context_loss_count)(const struct ti_sci_handle *handle,
-- 
2.19.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/4] soc: ti: ti_sci_pm_domains: Add support for exclusive access
  2019-02-18  5:15 ` Lokesh Vutla
@ 2019-02-18  5:15   ` Lokesh Vutla
  -1 siblings, 0 replies; 13+ messages in thread
From: Lokesh Vutla @ 2019-02-18  5:15 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring
  Cc: Lokesh Vutla, Device Tree Mailing List, Sekhar Nori,
	Linux ARM Mailing List

TISCI protocol supports for enabling the device with exclusive
permissions. Certain remoteproc devices or some shared devices
across VM doesn't wants to request devices with this flag set.
So add support for getting this information from DT. With this
power-domain-cells are increased to 2.

For keeping the DT backward compatibility intact, defaulting the
device permissions to set the exclusive flag set. In this case the
power-domain-cells is 1.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 .../bindings/soc/ti/sci-pm-domain.txt         |  7 ++++--
 drivers/soc/ti/ti_sci_pm_domains.c            | 22 +++++++++++++++++--
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt b/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
index f7b00a7c0f68..5fdda7475023 100644
--- a/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
+++ b/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
@@ -19,8 +19,11 @@ child of the pmmc node.
 Required Properties:
 --------------------
 - compatible: should be "ti,sci-pm-domain"
-- #power-domain-cells: Must be 1 so that an id can be provided in each
-		       device node.
+- #power-domain-cells: Can be one of the following:
+			1: Containing the device id of each node
+			2: First entry should be device id
+			   Second entry should be 1 or 0. Use 1 for enabling
+			   the device with exclusive permissions set else 0.
 
 Example (K2G):
 -------------
diff --git a/drivers/soc/ti/ti_sci_pm_domains.c b/drivers/soc/ti/ti_sci_pm_domains.c
index de31b9389e2e..4dae42651212 100644
--- a/drivers/soc/ti/ti_sci_pm_domains.c
+++ b/drivers/soc/ti/ti_sci_pm_domains.c
@@ -24,6 +24,8 @@
 #include <linux/slab.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
 
+#define PD_REQUEST_EXCLUSIVE BIT(0)
+
 /**
  * struct ti_sci_genpd_dev_data: holds data needed for every device attached
  *				 to this genpd
@@ -32,6 +34,7 @@
  */
 struct ti_sci_genpd_dev_data {
 	int idx;
+	u8 exclusive;
 };
 
 /**
@@ -63,6 +66,14 @@ static int ti_sci_dev_id(struct device *dev)
 	return sci_dev_data->idx;
 }
 
+static u8 is_ti_sci_dev_exclusive(struct device *dev)
+{
+	struct generic_pm_domain_data *genpd_data = dev_gpd_data(dev);
+	struct ti_sci_genpd_dev_data *sci_dev_data = genpd_data->data;
+
+	return sci_dev_data->exclusive & PD_REQUEST_EXCLUSIVE;
+}
+
 /**
  * ti_sci_dev_to_sci_handle(): get pointer to ti_sci_handle
  * @dev: pointer to device associated with this genpd
@@ -87,7 +98,10 @@ static int ti_sci_dev_start(struct device *dev)
 	const struct ti_sci_handle *ti_sci = ti_sci_dev_to_sci_handle(dev);
 	int idx = ti_sci_dev_id(dev);
 
-	return ti_sci->ops.dev_ops.get_device(ti_sci, idx);
+	if (is_ti_sci_dev_exclusive(dev))
+		return ti_sci->ops.dev_ops.get_device_exclusive(ti_sci, idx);
+	else
+		return ti_sci->ops.dev_ops.get_device(ti_sci, idx);
 }
 
 /**
@@ -118,7 +132,7 @@ static int ti_sci_pd_attach_dev(struct generic_pm_domain *domain,
 	if (ret < 0)
 		return ret;
 
-	if (pd_args.args_count != 1)
+	if (pd_args.args_count != 1 && pd_args.args_count != 2)
 		return -EINVAL;
 
 	idx = pd_args.args[0];
@@ -136,6 +150,10 @@ static int ti_sci_pd_attach_dev(struct generic_pm_domain *domain,
 		return -ENOMEM;
 
 	sci_dev_data->idx = idx;
+	/* Enable the exclusive permissions by default */
+	sci_dev_data->exclusive = PD_REQUEST_EXCLUSIVE;
+	if (pd_args.args_count == 2)
+		sci_dev_data->exclusive = pd_args.args[1];
 
 	genpd_data = dev_gpd_data(dev);
 	genpd_data->data = sci_dev_data;
-- 
2.19.2

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

* [PATCH 2/4] soc: ti: ti_sci_pm_domains: Add support for exclusive access
@ 2019-02-18  5:15   ` Lokesh Vutla
  0 siblings, 0 replies; 13+ messages in thread
From: Lokesh Vutla @ 2019-02-18  5:15 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring
  Cc: Lokesh Vutla, Device Tree Mailing List, Sekhar Nori,
	Linux ARM Mailing List

TISCI protocol supports for enabling the device with exclusive
permissions. Certain remoteproc devices or some shared devices
across VM doesn't wants to request devices with this flag set.
So add support for getting this information from DT. With this
power-domain-cells are increased to 2.

For keeping the DT backward compatibility intact, defaulting the
device permissions to set the exclusive flag set. In this case the
power-domain-cells is 1.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 .../bindings/soc/ti/sci-pm-domain.txt         |  7 ++++--
 drivers/soc/ti/ti_sci_pm_domains.c            | 22 +++++++++++++++++--
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt b/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
index f7b00a7c0f68..5fdda7475023 100644
--- a/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
+++ b/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
@@ -19,8 +19,11 @@ child of the pmmc node.
 Required Properties:
 --------------------
 - compatible: should be "ti,sci-pm-domain"
-- #power-domain-cells: Must be 1 so that an id can be provided in each
-		       device node.
+- #power-domain-cells: Can be one of the following:
+			1: Containing the device id of each node
+			2: First entry should be device id
+			   Second entry should be 1 or 0. Use 1 for enabling
+			   the device with exclusive permissions set else 0.
 
 Example (K2G):
 -------------
diff --git a/drivers/soc/ti/ti_sci_pm_domains.c b/drivers/soc/ti/ti_sci_pm_domains.c
index de31b9389e2e..4dae42651212 100644
--- a/drivers/soc/ti/ti_sci_pm_domains.c
+++ b/drivers/soc/ti/ti_sci_pm_domains.c
@@ -24,6 +24,8 @@
 #include <linux/slab.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
 
+#define PD_REQUEST_EXCLUSIVE BIT(0)
+
 /**
  * struct ti_sci_genpd_dev_data: holds data needed for every device attached
  *				 to this genpd
@@ -32,6 +34,7 @@
  */
 struct ti_sci_genpd_dev_data {
 	int idx;
+	u8 exclusive;
 };
 
 /**
@@ -63,6 +66,14 @@ static int ti_sci_dev_id(struct device *dev)
 	return sci_dev_data->idx;
 }
 
+static u8 is_ti_sci_dev_exclusive(struct device *dev)
+{
+	struct generic_pm_domain_data *genpd_data = dev_gpd_data(dev);
+	struct ti_sci_genpd_dev_data *sci_dev_data = genpd_data->data;
+
+	return sci_dev_data->exclusive & PD_REQUEST_EXCLUSIVE;
+}
+
 /**
  * ti_sci_dev_to_sci_handle(): get pointer to ti_sci_handle
  * @dev: pointer to device associated with this genpd
@@ -87,7 +98,10 @@ static int ti_sci_dev_start(struct device *dev)
 	const struct ti_sci_handle *ti_sci = ti_sci_dev_to_sci_handle(dev);
 	int idx = ti_sci_dev_id(dev);
 
-	return ti_sci->ops.dev_ops.get_device(ti_sci, idx);
+	if (is_ti_sci_dev_exclusive(dev))
+		return ti_sci->ops.dev_ops.get_device_exclusive(ti_sci, idx);
+	else
+		return ti_sci->ops.dev_ops.get_device(ti_sci, idx);
 }
 
 /**
@@ -118,7 +132,7 @@ static int ti_sci_pd_attach_dev(struct generic_pm_domain *domain,
 	if (ret < 0)
 		return ret;
 
-	if (pd_args.args_count != 1)
+	if (pd_args.args_count != 1 && pd_args.args_count != 2)
 		return -EINVAL;
 
 	idx = pd_args.args[0];
@@ -136,6 +150,10 @@ static int ti_sci_pd_attach_dev(struct generic_pm_domain *domain,
 		return -ENOMEM;
 
 	sci_dev_data->idx = idx;
+	/* Enable the exclusive permissions by default */
+	sci_dev_data->exclusive = PD_REQUEST_EXCLUSIVE;
+	if (pd_args.args_count == 2)
+		sci_dev_data->exclusive = pd_args.args[1];
 
 	genpd_data = dev_gpd_data(dev);
 	genpd_data->data = sci_dev_data;
-- 
2.19.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 3/4] soc: ti: ti_sci_pm_domains: Switch to SPDX Licensing
  2019-02-18  5:15 ` Lokesh Vutla
@ 2019-02-18  5:15   ` Lokesh Vutla
  -1 siblings, 0 replies; 13+ messages in thread
From: Lokesh Vutla @ 2019-02-18  5:15 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring
  Cc: Lokesh Vutla, Device Tree Mailing List, Sekhar Nori,
	Linux ARM Mailing List

Switch to SPDX licensing and drop the redundant GPL text.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 drivers/soc/ti/ti_sci_pm_domains.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/soc/ti/ti_sci_pm_domains.c b/drivers/soc/ti/ti_sci_pm_domains.c
index 4dae42651212..9cc4f663a29b 100644
--- a/drivers/soc/ti/ti_sci_pm_domains.c
+++ b/drivers/soc/ti/ti_sci_pm_domains.c
@@ -1,18 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * TI SCI Generic Power Domain Driver
  *
  * Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/
  *	J Keerthy <j-keerthy@ti.com>
  *	Dave Gerlach <d-gerlach@ti.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <linux/err.h>
-- 
2.19.2

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

* [PATCH 3/4] soc: ti: ti_sci_pm_domains: Switch to SPDX Licensing
@ 2019-02-18  5:15   ` Lokesh Vutla
  0 siblings, 0 replies; 13+ messages in thread
From: Lokesh Vutla @ 2019-02-18  5:15 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring
  Cc: Lokesh Vutla, Device Tree Mailing List, Sekhar Nori,
	Linux ARM Mailing List

Switch to SPDX licensing and drop the redundant GPL text.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 drivers/soc/ti/ti_sci_pm_domains.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/soc/ti/ti_sci_pm_domains.c b/drivers/soc/ti/ti_sci_pm_domains.c
index 4dae42651212..9cc4f663a29b 100644
--- a/drivers/soc/ti/ti_sci_pm_domains.c
+++ b/drivers/soc/ti/ti_sci_pm_domains.c
@@ -1,18 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * TI SCI Generic Power Domain Driver
  *
  * Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/
  *	J Keerthy <j-keerthy@ti.com>
  *	Dave Gerlach <d-gerlach@ti.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <linux/err.h>
-- 
2.19.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 4/4] arm64: dts: ti: k3-am654: Update the power domain cells
  2019-02-18  5:15 ` Lokesh Vutla
@ 2019-02-18  5:15   ` Lokesh Vutla
  -1 siblings, 0 replies; 13+ messages in thread
From: Lokesh Vutla @ 2019-02-18  5:15 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring
  Cc: Lokesh Vutla, Device Tree Mailing List, Sekhar Nori,
	Linux ARM Mailing List

Update the power-domain cells to 2 and mark all devices as
exclusive for now.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am65-main.dtsi   | 26 +++++++++++-----------
 arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi    | 10 ++++-----
 arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi |  6 ++---
 3 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/arch/arm64/boot/dts/ti/k3-am65-main.dtsi b/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
index 272cf8fc8d30..0156cf0e7205 100644
--- a/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
@@ -48,7 +48,7 @@
 		interrupts = <GIC_SPI 192 IRQ_TYPE_LEVEL_HIGH>;
 		clock-frequency = <48000000>;
 		current-speed = <115200>;
-		power-domains = <&k3_pds 146>;
+		power-domains = <&k3_pds 146 1>;
 	};
 
 	main_uart1: serial@2810000 {
@@ -58,7 +58,7 @@
 		reg-io-width = <4>;
 		interrupts = <GIC_SPI 193 IRQ_TYPE_LEVEL_HIGH>;
 		clock-frequency = <48000000>;
-		power-domains = <&k3_pds 147>;
+		power-domains = <&k3_pds 147 1>;
 	};
 
 	main_uart2: serial@2820000 {
@@ -68,7 +68,7 @@
 		reg-io-width = <4>;
 		interrupts = <GIC_SPI 194 IRQ_TYPE_LEVEL_HIGH>;
 		clock-frequency = <48000000>;
-		power-domains = <&k3_pds 148>;
+		power-domains = <&k3_pds 148 1>;
 	};
 
 	main_pmx0: pinmux@11c000 {
@@ -95,7 +95,7 @@
 		#size-cells = <0>;
 		clock-names = "fck";
 		clocks = <&k3_clks 110 1>;
-		power-domains = <&k3_pds 110>;
+		power-domains = <&k3_pds 110 1>;
 	};
 
 	main_i2c1: i2c@2010000 {
@@ -106,7 +106,7 @@
 		#size-cells = <0>;
 		clock-names = "fck";
 		clocks = <&k3_clks 111 1>;
-		power-domains = <&k3_pds 111>;
+		power-domains = <&k3_pds 111 1>;
 	};
 
 	main_i2c2: i2c@2020000 {
@@ -117,7 +117,7 @@
 		#size-cells = <0>;
 		clock-names = "fck";
 		clocks = <&k3_clks 112 1>;
-		power-domains = <&k3_pds 112>;
+		power-domains = <&k3_pds 112 1>;
 	};
 
 	main_i2c3: i2c@2030000 {
@@ -128,14 +128,14 @@
 		#size-cells = <0>;
 		clock-names = "fck";
 		clocks = <&k3_clks 113 1>;
-		power-domains = <&k3_pds 113>;
+		power-domains = <&k3_pds 113 1>;
 	};
 
 	ecap0: pwm@3100000 {
 		compatible = "ti,am654-ecap", "ti,am3352-ecap";
 		#pwm-cells = <3>;
 		reg = <0x0 0x03100000 0x0 0x60>;
-		power-domains = <&k3_pds 39>;
+		power-domains = <&k3_pds 39 1>;
 		clocks = <&k3_clks 39 0>;
 		clock-names = "fck";
 	};
@@ -145,7 +145,7 @@
 		reg = <0x0 0x2100000 0x0 0x400>;
 		interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&k3_clks 137 1>;
-		power-domains = <&k3_pds 137>;
+		power-domains = <&k3_pds 137 1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 	};
@@ -155,7 +155,7 @@
 		reg = <0x0 0x2110000 0x0 0x400>;
 		interrupts = <GIC_SPI 185 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&k3_clks 138 1>;
-		power-domains = <&k3_pds 138>;
+		power-domains = <&k3_pds 138 1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 		assigned-clocks = <&k3_clks 137 1>;
@@ -167,7 +167,7 @@
 		reg = <0x0 0x2120000 0x0 0x400>;
 		interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&k3_clks 139 1>;
-		power-domains = <&k3_pds 139>;
+		power-domains = <&k3_pds 139 1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 	};
@@ -177,7 +177,7 @@
 		reg = <0x0 0x2130000 0x0 0x400>;
 		interrupts = <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&k3_clks 140 1>;
-		power-domains = <&k3_pds 140>;
+		power-domains = <&k3_pds 140 1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 	};
@@ -187,7 +187,7 @@
 		reg = <0x0 0x2140000 0x0 0x400>;
 		interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&k3_clks 141 1>;
-		power-domains = <&k3_pds 141>;
+		power-domains = <&k3_pds 141 1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 	};
diff --git a/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi b/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
index 593f718e8fb5..f2f54d80cf39 100644
--- a/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
@@ -14,7 +14,7 @@
 			interrupts = <GIC_SPI 565 IRQ_TYPE_LEVEL_HIGH>;
 			clock-frequency = <96000000>;
 			current-speed = <115200>;
-			power-domains = <&k3_pds 149>;
+			power-domains = <&k3_pds 149 1>;
 	};
 
 	mcu_i2c0: i2c@40b00000 {
@@ -25,7 +25,7 @@
 		#size-cells = <0>;
 		clock-names = "fck";
 		clocks = <&k3_clks 114 1>;
-		power-domains = <&k3_pds 114>;
+		power-domains = <&k3_pds 114 1>;
 	};
 
 	mcu_spi0: spi@40300000 {
@@ -33,7 +33,7 @@
 		reg = <0x0 0x40300000 0x0 0x400>;
 		interrupts = <GIC_SPI 560 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&k3_clks 142 1>;
-		power-domains = <&k3_pds 142>;
+		power-domains = <&k3_pds 142 1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 	};
@@ -43,7 +43,7 @@
 		reg = <0x0 0x40310000 0x0 0x400>;
 		interrupts = <GIC_SPI 561 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&k3_clks 143 1>;
-		power-domains = <&k3_pds 143>;
+		power-domains = <&k3_pds 143 1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 	};
@@ -53,7 +53,7 @@
 		reg = <0x0 0x40320000 0x0 0x400>;
 		interrupts = <GIC_SPI 562 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&k3_clks 144 1>;
-		power-domains = <&k3_pds 144>;
+		power-domains = <&k3_pds 144 1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 	};
diff --git a/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
index 7cbdc0912ab7..68fd833c130a 100644
--- a/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
@@ -20,7 +20,7 @@
 
 		k3_pds: power-controller {
 			compatible = "ti,sci-pm-domain";
-			#power-domain-cells = <1>;
+			#power-domain-cells = <2>;
 		};
 
 		k3_clks: clocks {
@@ -50,7 +50,7 @@
 		interrupts = <GIC_SPI 697 IRQ_TYPE_LEVEL_HIGH>;
 		clock-frequency = <48000000>;
 		current-speed = <115200>;
-		power-domains = <&k3_pds 150>;
+		power-domains = <&k3_pds 150 1>;
 	};
 
 	wkup_i2c0: i2c@42120000 {
@@ -61,6 +61,6 @@
 		#size-cells = <0>;
 		clock-names = "fck";
 		clocks = <&k3_clks 115 1>;
-		power-domains = <&k3_pds 115>;
+		power-domains = <&k3_pds 115 1>;
 	};
 };
-- 
2.19.2

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

* [PATCH 4/4] arm64: dts: ti: k3-am654: Update the power domain cells
@ 2019-02-18  5:15   ` Lokesh Vutla
  0 siblings, 0 replies; 13+ messages in thread
From: Lokesh Vutla @ 2019-02-18  5:15 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring
  Cc: Lokesh Vutla, Device Tree Mailing List, Sekhar Nori,
	Linux ARM Mailing List

Update the power-domain cells to 2 and mark all devices as
exclusive for now.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am65-main.dtsi   | 26 +++++++++++-----------
 arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi    | 10 ++++-----
 arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi |  6 ++---
 3 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/arch/arm64/boot/dts/ti/k3-am65-main.dtsi b/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
index 272cf8fc8d30..0156cf0e7205 100644
--- a/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
@@ -48,7 +48,7 @@
 		interrupts = <GIC_SPI 192 IRQ_TYPE_LEVEL_HIGH>;
 		clock-frequency = <48000000>;
 		current-speed = <115200>;
-		power-domains = <&k3_pds 146>;
+		power-domains = <&k3_pds 146 1>;
 	};
 
 	main_uart1: serial@2810000 {
@@ -58,7 +58,7 @@
 		reg-io-width = <4>;
 		interrupts = <GIC_SPI 193 IRQ_TYPE_LEVEL_HIGH>;
 		clock-frequency = <48000000>;
-		power-domains = <&k3_pds 147>;
+		power-domains = <&k3_pds 147 1>;
 	};
 
 	main_uart2: serial@2820000 {
@@ -68,7 +68,7 @@
 		reg-io-width = <4>;
 		interrupts = <GIC_SPI 194 IRQ_TYPE_LEVEL_HIGH>;
 		clock-frequency = <48000000>;
-		power-domains = <&k3_pds 148>;
+		power-domains = <&k3_pds 148 1>;
 	};
 
 	main_pmx0: pinmux@11c000 {
@@ -95,7 +95,7 @@
 		#size-cells = <0>;
 		clock-names = "fck";
 		clocks = <&k3_clks 110 1>;
-		power-domains = <&k3_pds 110>;
+		power-domains = <&k3_pds 110 1>;
 	};
 
 	main_i2c1: i2c@2010000 {
@@ -106,7 +106,7 @@
 		#size-cells = <0>;
 		clock-names = "fck";
 		clocks = <&k3_clks 111 1>;
-		power-domains = <&k3_pds 111>;
+		power-domains = <&k3_pds 111 1>;
 	};
 
 	main_i2c2: i2c@2020000 {
@@ -117,7 +117,7 @@
 		#size-cells = <0>;
 		clock-names = "fck";
 		clocks = <&k3_clks 112 1>;
-		power-domains = <&k3_pds 112>;
+		power-domains = <&k3_pds 112 1>;
 	};
 
 	main_i2c3: i2c@2030000 {
@@ -128,14 +128,14 @@
 		#size-cells = <0>;
 		clock-names = "fck";
 		clocks = <&k3_clks 113 1>;
-		power-domains = <&k3_pds 113>;
+		power-domains = <&k3_pds 113 1>;
 	};
 
 	ecap0: pwm@3100000 {
 		compatible = "ti,am654-ecap", "ti,am3352-ecap";
 		#pwm-cells = <3>;
 		reg = <0x0 0x03100000 0x0 0x60>;
-		power-domains = <&k3_pds 39>;
+		power-domains = <&k3_pds 39 1>;
 		clocks = <&k3_clks 39 0>;
 		clock-names = "fck";
 	};
@@ -145,7 +145,7 @@
 		reg = <0x0 0x2100000 0x0 0x400>;
 		interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&k3_clks 137 1>;
-		power-domains = <&k3_pds 137>;
+		power-domains = <&k3_pds 137 1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 	};
@@ -155,7 +155,7 @@
 		reg = <0x0 0x2110000 0x0 0x400>;
 		interrupts = <GIC_SPI 185 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&k3_clks 138 1>;
-		power-domains = <&k3_pds 138>;
+		power-domains = <&k3_pds 138 1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 		assigned-clocks = <&k3_clks 137 1>;
@@ -167,7 +167,7 @@
 		reg = <0x0 0x2120000 0x0 0x400>;
 		interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&k3_clks 139 1>;
-		power-domains = <&k3_pds 139>;
+		power-domains = <&k3_pds 139 1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 	};
@@ -177,7 +177,7 @@
 		reg = <0x0 0x2130000 0x0 0x400>;
 		interrupts = <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&k3_clks 140 1>;
-		power-domains = <&k3_pds 140>;
+		power-domains = <&k3_pds 140 1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 	};
@@ -187,7 +187,7 @@
 		reg = <0x0 0x2140000 0x0 0x400>;
 		interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&k3_clks 141 1>;
-		power-domains = <&k3_pds 141>;
+		power-domains = <&k3_pds 141 1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 	};
diff --git a/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi b/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
index 593f718e8fb5..f2f54d80cf39 100644
--- a/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
@@ -14,7 +14,7 @@
 			interrupts = <GIC_SPI 565 IRQ_TYPE_LEVEL_HIGH>;
 			clock-frequency = <96000000>;
 			current-speed = <115200>;
-			power-domains = <&k3_pds 149>;
+			power-domains = <&k3_pds 149 1>;
 	};
 
 	mcu_i2c0: i2c@40b00000 {
@@ -25,7 +25,7 @@
 		#size-cells = <0>;
 		clock-names = "fck";
 		clocks = <&k3_clks 114 1>;
-		power-domains = <&k3_pds 114>;
+		power-domains = <&k3_pds 114 1>;
 	};
 
 	mcu_spi0: spi@40300000 {
@@ -33,7 +33,7 @@
 		reg = <0x0 0x40300000 0x0 0x400>;
 		interrupts = <GIC_SPI 560 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&k3_clks 142 1>;
-		power-domains = <&k3_pds 142>;
+		power-domains = <&k3_pds 142 1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 	};
@@ -43,7 +43,7 @@
 		reg = <0x0 0x40310000 0x0 0x400>;
 		interrupts = <GIC_SPI 561 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&k3_clks 143 1>;
-		power-domains = <&k3_pds 143>;
+		power-domains = <&k3_pds 143 1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 	};
@@ -53,7 +53,7 @@
 		reg = <0x0 0x40320000 0x0 0x400>;
 		interrupts = <GIC_SPI 562 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&k3_clks 144 1>;
-		power-domains = <&k3_pds 144>;
+		power-domains = <&k3_pds 144 1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 	};
diff --git a/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
index 7cbdc0912ab7..68fd833c130a 100644
--- a/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
@@ -20,7 +20,7 @@
 
 		k3_pds: power-controller {
 			compatible = "ti,sci-pm-domain";
-			#power-domain-cells = <1>;
+			#power-domain-cells = <2>;
 		};
 
 		k3_clks: clocks {
@@ -50,7 +50,7 @@
 		interrupts = <GIC_SPI 697 IRQ_TYPE_LEVEL_HIGH>;
 		clock-frequency = <48000000>;
 		current-speed = <115200>;
-		power-domains = <&k3_pds 150>;
+		power-domains = <&k3_pds 150 1>;
 	};
 
 	wkup_i2c0: i2c@42120000 {
@@ -61,6 +61,6 @@
 		#size-cells = <0>;
 		clock-names = "fck";
 		clocks = <&k3_clks 115 1>;
-		power-domains = <&k3_pds 115>;
+		power-domains = <&k3_pds 115 1>;
 	};
 };
-- 
2.19.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/4] soc: ti: ti_sci_pm_domains: Add support for exclusive access
  2019-02-18  5:15   ` Lokesh Vutla
@ 2019-02-18  8:10     ` Tero Kristo
  -1 siblings, 0 replies; 13+ messages in thread
From: Tero Kristo @ 2019-02-18  8:10 UTC (permalink / raw)
  To: Lokesh Vutla, Nishanth Menon, Santosh Shilimkar, Rob Herring
  Cc: Device Tree Mailing List, Sekhar Nori, Linux ARM Mailing List

On 18/02/2019 07:15, Lokesh Vutla wrote:
> TISCI protocol supports for enabling the device with exclusive
> permissions. Certain remoteproc devices or some shared devices
> across VM doesn't wants to request devices with this flag set.
> So add support for getting this information from DT. With this
> power-domain-cells are increased to 2.
> 
> For keeping the DT backward compatibility intact, defaulting the
> device permissions to set the exclusive flag set. In this case the
> power-domain-cells is 1.
> 
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
> ---
>   .../bindings/soc/ti/sci-pm-domain.txt         |  7 ++++--
>   drivers/soc/ti/ti_sci_pm_domains.c            | 22 +++++++++++++++++--

Please split the dt-binding change into a separate patch.

-Tero

>   2 files changed, 25 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt b/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
> index f7b00a7c0f68..5fdda7475023 100644
> --- a/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
> +++ b/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
> @@ -19,8 +19,11 @@ child of the pmmc node.
>   Required Properties:
>   --------------------
>   - compatible: should be "ti,sci-pm-domain"
> -- #power-domain-cells: Must be 1 so that an id can be provided in each
> -		       device node.
> +- #power-domain-cells: Can be one of the following:
> +			1: Containing the device id of each node
> +			2: First entry should be device id
> +			   Second entry should be 1 or 0. Use 1 for enabling
> +			   the device with exclusive permissions set else 0.
>   
>   Example (K2G):
>   -------------
> diff --git a/drivers/soc/ti/ti_sci_pm_domains.c b/drivers/soc/ti/ti_sci_pm_domains.c
> index de31b9389e2e..4dae42651212 100644
> --- a/drivers/soc/ti/ti_sci_pm_domains.c
> +++ b/drivers/soc/ti/ti_sci_pm_domains.c
> @@ -24,6 +24,8 @@
>   #include <linux/slab.h>
>   #include <linux/soc/ti/ti_sci_protocol.h>
>   
> +#define PD_REQUEST_EXCLUSIVE BIT(0)
> +
>   /**
>    * struct ti_sci_genpd_dev_data: holds data needed for every device attached
>    *				 to this genpd
> @@ -32,6 +34,7 @@
>    */
>   struct ti_sci_genpd_dev_data {
>   	int idx;
> +	u8 exclusive;
>   };
>   
>   /**
> @@ -63,6 +66,14 @@ static int ti_sci_dev_id(struct device *dev)
>   	return sci_dev_data->idx;
>   }
>   
> +static u8 is_ti_sci_dev_exclusive(struct device *dev)
> +{
> +	struct generic_pm_domain_data *genpd_data = dev_gpd_data(dev);
> +	struct ti_sci_genpd_dev_data *sci_dev_data = genpd_data->data;
> +
> +	return sci_dev_data->exclusive & PD_REQUEST_EXCLUSIVE;
> +}
> +
>   /**
>    * ti_sci_dev_to_sci_handle(): get pointer to ti_sci_handle
>    * @dev: pointer to device associated with this genpd
> @@ -87,7 +98,10 @@ static int ti_sci_dev_start(struct device *dev)
>   	const struct ti_sci_handle *ti_sci = ti_sci_dev_to_sci_handle(dev);
>   	int idx = ti_sci_dev_id(dev);
>   
> -	return ti_sci->ops.dev_ops.get_device(ti_sci, idx);
> +	if (is_ti_sci_dev_exclusive(dev))
> +		return ti_sci->ops.dev_ops.get_device_exclusive(ti_sci, idx);
> +	else
> +		return ti_sci->ops.dev_ops.get_device(ti_sci, idx);
>   }
>   
>   /**
> @@ -118,7 +132,7 @@ static int ti_sci_pd_attach_dev(struct generic_pm_domain *domain,
>   	if (ret < 0)
>   		return ret;
>   
> -	if (pd_args.args_count != 1)
> +	if (pd_args.args_count != 1 && pd_args.args_count != 2)
>   		return -EINVAL;
>   
>   	idx = pd_args.args[0];
> @@ -136,6 +150,10 @@ static int ti_sci_pd_attach_dev(struct generic_pm_domain *domain,
>   		return -ENOMEM;
>   
>   	sci_dev_data->idx = idx;
> +	/* Enable the exclusive permissions by default */
> +	sci_dev_data->exclusive = PD_REQUEST_EXCLUSIVE;
> +	if (pd_args.args_count == 2)
> +		sci_dev_data->exclusive = pd_args.args[1];
>   
>   	genpd_data = dev_gpd_data(dev);
>   	genpd_data->data = sci_dev_data;
> 

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH 2/4] soc: ti: ti_sci_pm_domains: Add support for exclusive access
@ 2019-02-18  8:10     ` Tero Kristo
  0 siblings, 0 replies; 13+ messages in thread
From: Tero Kristo @ 2019-02-18  8:10 UTC (permalink / raw)
  To: Lokesh Vutla, Nishanth Menon, Santosh Shilimkar, Rob Herring
  Cc: Device Tree Mailing List, Sekhar Nori, Linux ARM Mailing List

On 18/02/2019 07:15, Lokesh Vutla wrote:
> TISCI protocol supports for enabling the device with exclusive
> permissions. Certain remoteproc devices or some shared devices
> across VM doesn't wants to request devices with this flag set.
> So add support for getting this information from DT. With this
> power-domain-cells are increased to 2.
> 
> For keeping the DT backward compatibility intact, defaulting the
> device permissions to set the exclusive flag set. In this case the
> power-domain-cells is 1.
> 
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
> ---
>   .../bindings/soc/ti/sci-pm-domain.txt         |  7 ++++--
>   drivers/soc/ti/ti_sci_pm_domains.c            | 22 +++++++++++++++++--

Please split the dt-binding change into a separate patch.

-Tero

>   2 files changed, 25 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt b/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
> index f7b00a7c0f68..5fdda7475023 100644
> --- a/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
> +++ b/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
> @@ -19,8 +19,11 @@ child of the pmmc node.
>   Required Properties:
>   --------------------
>   - compatible: should be "ti,sci-pm-domain"
> -- #power-domain-cells: Must be 1 so that an id can be provided in each
> -		       device node.
> +- #power-domain-cells: Can be one of the following:
> +			1: Containing the device id of each node
> +			2: First entry should be device id
> +			   Second entry should be 1 or 0. Use 1 for enabling
> +			   the device with exclusive permissions set else 0.
>   
>   Example (K2G):
>   -------------
> diff --git a/drivers/soc/ti/ti_sci_pm_domains.c b/drivers/soc/ti/ti_sci_pm_domains.c
> index de31b9389e2e..4dae42651212 100644
> --- a/drivers/soc/ti/ti_sci_pm_domains.c
> +++ b/drivers/soc/ti/ti_sci_pm_domains.c
> @@ -24,6 +24,8 @@
>   #include <linux/slab.h>
>   #include <linux/soc/ti/ti_sci_protocol.h>
>   
> +#define PD_REQUEST_EXCLUSIVE BIT(0)
> +
>   /**
>    * struct ti_sci_genpd_dev_data: holds data needed for every device attached
>    *				 to this genpd
> @@ -32,6 +34,7 @@
>    */
>   struct ti_sci_genpd_dev_data {
>   	int idx;
> +	u8 exclusive;
>   };
>   
>   /**
> @@ -63,6 +66,14 @@ static int ti_sci_dev_id(struct device *dev)
>   	return sci_dev_data->idx;
>   }
>   
> +static u8 is_ti_sci_dev_exclusive(struct device *dev)
> +{
> +	struct generic_pm_domain_data *genpd_data = dev_gpd_data(dev);
> +	struct ti_sci_genpd_dev_data *sci_dev_data = genpd_data->data;
> +
> +	return sci_dev_data->exclusive & PD_REQUEST_EXCLUSIVE;
> +}
> +
>   /**
>    * ti_sci_dev_to_sci_handle(): get pointer to ti_sci_handle
>    * @dev: pointer to device associated with this genpd
> @@ -87,7 +98,10 @@ static int ti_sci_dev_start(struct device *dev)
>   	const struct ti_sci_handle *ti_sci = ti_sci_dev_to_sci_handle(dev);
>   	int idx = ti_sci_dev_id(dev);
>   
> -	return ti_sci->ops.dev_ops.get_device(ti_sci, idx);
> +	if (is_ti_sci_dev_exclusive(dev))
> +		return ti_sci->ops.dev_ops.get_device_exclusive(ti_sci, idx);
> +	else
> +		return ti_sci->ops.dev_ops.get_device(ti_sci, idx);
>   }
>   
>   /**
> @@ -118,7 +132,7 @@ static int ti_sci_pd_attach_dev(struct generic_pm_domain *domain,
>   	if (ret < 0)
>   		return ret;
>   
> -	if (pd_args.args_count != 1)
> +	if (pd_args.args_count != 1 && pd_args.args_count != 2)
>   		return -EINVAL;
>   
>   	idx = pd_args.args[0];
> @@ -136,6 +150,10 @@ static int ti_sci_pd_attach_dev(struct generic_pm_domain *domain,
>   		return -ENOMEM;
>   
>   	sci_dev_data->idx = idx;
> +	/* Enable the exclusive permissions by default */
> +	sci_dev_data->exclusive = PD_REQUEST_EXCLUSIVE;
> +	if (pd_args.args_count == 2)
> +		sci_dev_data->exclusive = pd_args.args[1];
>   
>   	genpd_data = dev_gpd_data(dev);
>   	genpd_data->data = sci_dev_data;
> 

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/4] soc: ti: ti_sci_pm_domains: Add support for exclusive access
  2019-02-18  8:10     ` Tero Kristo
  (?)
@ 2019-02-18 13:46     ` Lokesh Vutla
  -1 siblings, 0 replies; 13+ messages in thread
From: Lokesh Vutla @ 2019-02-18 13:46 UTC (permalink / raw)
  To: Tero Kristo, Nishanth Menon, Santosh Shilimkar, Rob Herring
  Cc: Device Tree Mailing List, Sekhar Nori, Linux ARM Mailing List



On 18/02/19 1:40 PM, Tero Kristo wrote:
> On 18/02/2019 07:15, Lokesh Vutla wrote:
>> TISCI protocol supports for enabling the device with exclusive
>> permissions. Certain remoteproc devices or some shared devices
>> across VM doesn't wants to request devices with this flag set.
>> So add support for getting this information from DT. With this
>> power-domain-cells are increased to 2.
>>
>> For keeping the DT backward compatibility intact, defaulting the
>> device permissions to set the exclusive flag set. In this case the
>> power-domain-cells is 1.
>>
>> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
>> ---
>>   .../bindings/soc/ti/sci-pm-domain.txt         |  7 ++++--
>>   drivers/soc/ti/ti_sci_pm_domains.c            | 22 +++++++++++++++++--
> 
> Please split the dt-binding change into a separate patch.

Sure, will fix in v2. Will wait for some more time before posting v2.

Thanks and regards,
Lokesh

> 
> -Tero
> 
>>   2 files changed, 25 insertions(+), 4 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
>> b/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
>> index f7b00a7c0f68..5fdda7475023 100644
>> --- a/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
>> +++ b/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
>> @@ -19,8 +19,11 @@ child of the pmmc node.
>>   Required Properties:
>>   --------------------
>>   - compatible: should be "ti,sci-pm-domain"
>> -- #power-domain-cells: Must be 1 so that an id can be provided in each
>> -               device node.
>> +- #power-domain-cells: Can be one of the following:
>> +            1: Containing the device id of each node
>> +            2: First entry should be device id
>> +               Second entry should be 1 or 0. Use 1 for enabling
>> +               the device with exclusive permissions set else 0.
>>     Example (K2G):
>>   -------------
>> diff --git a/drivers/soc/ti/ti_sci_pm_domains.c
>> b/drivers/soc/ti/ti_sci_pm_domains.c
>> index de31b9389e2e..4dae42651212 100644
>> --- a/drivers/soc/ti/ti_sci_pm_domains.c
>> +++ b/drivers/soc/ti/ti_sci_pm_domains.c
>> @@ -24,6 +24,8 @@
>>   #include <linux/slab.h>
>>   #include <linux/soc/ti/ti_sci_protocol.h>
>>   +#define PD_REQUEST_EXCLUSIVE BIT(0)
>> +
>>   /**
>>    * struct ti_sci_genpd_dev_data: holds data needed for every device attached
>>    *                 to this genpd
>> @@ -32,6 +34,7 @@
>>    */
>>   struct ti_sci_genpd_dev_data {
>>       int idx;
>> +    u8 exclusive;
>>   };
>>     /**
>> @@ -63,6 +66,14 @@ static int ti_sci_dev_id(struct device *dev)
>>       return sci_dev_data->idx;
>>   }
>>   +static u8 is_ti_sci_dev_exclusive(struct device *dev)
>> +{
>> +    struct generic_pm_domain_data *genpd_data = dev_gpd_data(dev);
>> +    struct ti_sci_genpd_dev_data *sci_dev_data = genpd_data->data;
>> +
>> +    return sci_dev_data->exclusive & PD_REQUEST_EXCLUSIVE;
>> +}
>> +
>>   /**
>>    * ti_sci_dev_to_sci_handle(): get pointer to ti_sci_handle
>>    * @dev: pointer to device associated with this genpd
>> @@ -87,7 +98,10 @@ static int ti_sci_dev_start(struct device *dev)
>>       const struct ti_sci_handle *ti_sci = ti_sci_dev_to_sci_handle(dev);
>>       int idx = ti_sci_dev_id(dev);
>>   -    return ti_sci->ops.dev_ops.get_device(ti_sci, idx);
>> +    if (is_ti_sci_dev_exclusive(dev))
>> +        return ti_sci->ops.dev_ops.get_device_exclusive(ti_sci, idx);
>> +    else
>> +        return ti_sci->ops.dev_ops.get_device(ti_sci, idx);
>>   }
>>     /**
>> @@ -118,7 +132,7 @@ static int ti_sci_pd_attach_dev(struct generic_pm_domain
>> *domain,
>>       if (ret < 0)
>>           return ret;
>>   -    if (pd_args.args_count != 1)
>> +    if (pd_args.args_count != 1 && pd_args.args_count != 2)
>>           return -EINVAL;
>>         idx = pd_args.args[0];
>> @@ -136,6 +150,10 @@ static int ti_sci_pd_attach_dev(struct generic_pm_domain
>> *domain,
>>           return -ENOMEM;
>>         sci_dev_data->idx = idx;
>> +    /* Enable the exclusive permissions by default */
>> +    sci_dev_data->exclusive = PD_REQUEST_EXCLUSIVE;
>> +    if (pd_args.args_count == 2)
>> +        sci_dev_data->exclusive = pd_args.args[1];
>>         genpd_data = dev_gpd_data(dev);
>>       genpd_data->data = sci_dev_data;
>>
> 
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-02-18 13:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-18  5:15 [PATCH 0/4] soc: ti: k3-am654: Allow for exclsive request of devices Lokesh Vutla
2019-02-18  5:15 ` Lokesh Vutla
2019-02-18  5:15 ` [PATCH 1/4] firmware: ti_sci: (Dis)Allow for device exclusive permissions Lokesh Vutla
2019-02-18  5:15   ` Lokesh Vutla
2019-02-18  5:15 ` [PATCH 2/4] soc: ti: ti_sci_pm_domains: Add support for exclusive access Lokesh Vutla
2019-02-18  5:15   ` Lokesh Vutla
2019-02-18  8:10   ` Tero Kristo
2019-02-18  8:10     ` Tero Kristo
2019-02-18 13:46     ` Lokesh Vutla
2019-02-18  5:15 ` [PATCH 3/4] soc: ti: ti_sci_pm_domains: Switch to SPDX Licensing Lokesh Vutla
2019-02-18  5:15   ` Lokesh Vutla
2019-02-18  5:15 ` [PATCH 4/4] arm64: dts: ti: k3-am654: Update the power domain cells Lokesh Vutla
2019-02-18  5:15   ` Lokesh Vutla

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.