Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] soc: xilinx: Set CAP_UNUSABLE requirement for versal while powering down domain
@ 2019-08-08 19:00 Jolly Shah
  2019-08-14  7:32 ` Michal Simek
  0 siblings, 1 reply; 2+ messages in thread
From: Jolly Shah @ 2019-08-08 19:00 UTC (permalink / raw)
  To: matthias.bgg, andy.gross, shawnguo, geert+renesas,
	bjorn.andersson, sean.wang, m.szyprowski, michal.simek
  Cc: Tejas Patel, Jolly Shah, rajanv, linux-kernel, linux-arm-kernel

From: Tejas Patel <tejas.patel@xilinx.com>

For "0" requirement which is used to inform firmware that
device is not required currently by master, Versal LibPM disables
clock, power it down and reset the device. genpd_power_off()
is being called during runtime suspend also. So, if any device
goes to runtime suspend state during resumes it needs to be
re-initialized again. It is possible that drivers do not
reinitialize device upon resume from runtime suspend every time.

In LibPM new PM_CAP_UNUSABLE capability is added, which disables
clock only and avoids power down and reset.
So, set CAPABILITY_UNUSABLE requirement during zynqmp_gpd_power_off()
if platform is other than zynqmp.

Signed-off-by: Tejas Patel <tejas.patel@xilinx.com>
Signed-off-by: Jolly Shah <jollys@xilinx.com>
---
 drivers/soc/xilinx/zynqmp_pm_domains.c | 10 ++++++++--
 include/linux/firmware/xlnx-zynqmp.h   |  3 ++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/soc/xilinx/zynqmp_pm_domains.c b/drivers/soc/xilinx/zynqmp_pm_domains.c
index 600f57c..23d90cb 100644
--- a/drivers/soc/xilinx/zynqmp_pm_domains.c
+++ b/drivers/soc/xilinx/zynqmp_pm_domains.c
@@ -2,7 +2,7 @@
 /*
  * ZynqMP Generic PM domain support
  *
- *  Copyright (C) 2015-2018 Xilinx, Inc.
+ *  Copyright (C) 2015-2019 Xilinx, Inc.
  *
  *  Davorin Mista <davorin.mista@aggios.com>
  *  Jolly Shah <jollys@xilinx.com>
@@ -25,6 +25,8 @@
 
 static const struct zynqmp_eemi_ops *eemi_ops;
 
+static int min_capability;
+
 /**
  * struct zynqmp_pm_domain - Wrapper around struct generic_pm_domain
  * @gpd:		Generic power domain
@@ -106,7 +108,7 @@ static int zynqmp_gpd_power_off(struct generic_pm_domain *domain)
 	int ret;
 	struct pm_domain_data *pdd, *tmp;
 	struct zynqmp_pm_domain *pd;
-	u32 capabilities = 0;
+	u32 capabilities = min_capability;
 	bool may_wakeup;
 
 	if (!eemi_ops->set_requirement)
@@ -283,6 +285,10 @@ static int zynqmp_gpd_probe(struct platform_device *pdev)
 	if (!domains)
 		return -ENOMEM;
 
+	if (!of_device_is_compatible(dev->parent->of_node,
+				     "xlnx,zynqmp-firmware"))
+		min_capability = ZYNQMP_PM_CAPABILITY_UNUSABLE;
+
 	for (i = 0; i < ZYNQMP_NUM_DOMAINS; i++, pd++) {
 		pd->node_id = 0;
 		pd->gpd.name = kasprintf(GFP_KERNEL, "domain%d", i);
diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
index 778abbb..b8a7c22 100644
--- a/include/linux/firmware/xlnx-zynqmp.h
+++ b/include/linux/firmware/xlnx-zynqmp.h
@@ -2,7 +2,7 @@
 /*
  * Xilinx Zynq MPSoC Firmware layer
  *
- *  Copyright (C) 2014-2018 Xilinx
+ *  Copyright (C) 2014-2019 Xilinx
  *
  *  Michal Simek <michal.simek@xilinx.com>
  *  Davorin Mista <davorin.mista@aggios.com>
@@ -46,6 +46,7 @@
 #define	ZYNQMP_PM_CAPABILITY_ACCESS	0x1U
 #define	ZYNQMP_PM_CAPABILITY_CONTEXT	0x2U
 #define	ZYNQMP_PM_CAPABILITY_WAKEUP	0x4U
+#define ZYNQMP_PM_CAPABILITY_UNUSABLE	0x8U
 
 /*
  * Firmware FPGA Manager flags
-- 
2.7.4


_______________________________________________
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] 2+ messages in thread

* Re: [PATCH] soc: xilinx: Set CAP_UNUSABLE requirement for versal while powering down domain
  2019-08-08 19:00 [PATCH] soc: xilinx: Set CAP_UNUSABLE requirement for versal while powering down domain Jolly Shah
@ 2019-08-14  7:32 ` Michal Simek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Simek @ 2019-08-14  7:32 UTC (permalink / raw)
  To: Jolly Shah, matthias.bgg, andy.gross, shawnguo, geert+renesas,
	bjorn.andersson, sean.wang, m.szyprowski, michal.simek
  Cc: Tejas Patel, Jolly Shah, rajanv, linux-kernel, linux-arm-kernel

On 08. 08. 19 21:00, Jolly Shah wrote:
> From: Tejas Patel <tejas.patel@xilinx.com>
> 
> For "0" requirement which is used to inform firmware that
> device is not required currently by master, Versal LibPM disables

This could be the first time when LibPM is mentioned in connection to
Versal. That's why you should also say what's that and when it runs to
make it clear.

> clock, power it down and reset the device. genpd_power_off()
> is being called during runtime suspend also. So, if any device
> goes to runtime suspend state during resumes it needs to be
> re-initialized again. It is possible that drivers do not
> reinitialize device upon resume from runtime suspend every time.
> 
> In LibPM new PM_CAP_UNUSABLE capability is added, which disables
> clock only and avoids power down and reset.
> So, set CAPABILITY_UNUSABLE requirement during zynqmp_gpd_power_off()
> if platform is other than zynqmp.
> 
> Signed-off-by: Tejas Patel <tejas.patel@xilinx.com>
> Signed-off-by: Jolly Shah <jollys@xilinx.com>
> ---
>  drivers/soc/xilinx/zynqmp_pm_domains.c | 10 ++++++++--
>  include/linux/firmware/xlnx-zynqmp.h   |  3 ++-
>  2 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/soc/xilinx/zynqmp_pm_domains.c b/drivers/soc/xilinx/zynqmp_pm_domains.c
> index 600f57c..23d90cb 100644
> --- a/drivers/soc/xilinx/zynqmp_pm_domains.c
> +++ b/drivers/soc/xilinx/zynqmp_pm_domains.c
> @@ -2,7 +2,7 @@
>  /*
>   * ZynqMP Generic PM domain support
>   *
> - *  Copyright (C) 2015-2018 Xilinx, Inc.
> + *  Copyright (C) 2015-2019 Xilinx, Inc.
>   *
>   *  Davorin Mista <davorin.mista@aggios.com>
>   *  Jolly Shah <jollys@xilinx.com>
> @@ -25,6 +25,8 @@
>  
>  static const struct zynqmp_eemi_ops *eemi_ops;
>  
> +static int min_capability;
> +
>  /**
>   * struct zynqmp_pm_domain - Wrapper around struct generic_pm_domain
>   * @gpd:		Generic power domain
> @@ -106,7 +108,7 @@ static int zynqmp_gpd_power_off(struct generic_pm_domain *domain)
>  	int ret;
>  	struct pm_domain_data *pdd, *tmp;
>  	struct zynqmp_pm_domain *pd;
> -	u32 capabilities = 0;
> +	u32 capabilities = min_capability;
>  	bool may_wakeup;
>  
>  	if (!eemi_ops->set_requirement)
> @@ -283,6 +285,10 @@ static int zynqmp_gpd_probe(struct platform_device *pdev)
>  	if (!domains)
>  		return -ENOMEM;
>  
> +	if (!of_device_is_compatible(dev->parent->of_node,
> +				     "xlnx,zynqmp-firmware"))
> +		min_capability = ZYNQMP_PM_CAPABILITY_UNUSABLE;
> +
>  	for (i = 0; i < ZYNQMP_NUM_DOMAINS; i++, pd++) {
>  		pd->node_id = 0;
>  		pd->gpd.name = kasprintf(GFP_KERNEL, "domain%d", i);
> diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
> index 778abbb..b8a7c22 100644
> --- a/include/linux/firmware/xlnx-zynqmp.h
> +++ b/include/linux/firmware/xlnx-zynqmp.h
> @@ -2,7 +2,7 @@
>  /*
>   * Xilinx Zynq MPSoC Firmware layer
>   *
> - *  Copyright (C) 2014-2018 Xilinx
> + *  Copyright (C) 2014-2019 Xilinx
>   *
>   *  Michal Simek <michal.simek@xilinx.com>
>   *  Davorin Mista <davorin.mista@aggios.com>
> @@ -46,6 +46,7 @@
>  #define	ZYNQMP_PM_CAPABILITY_ACCESS	0x1U
>  #define	ZYNQMP_PM_CAPABILITY_CONTEXT	0x2U
>  #define	ZYNQMP_PM_CAPABILITY_WAKEUP	0x4U
> +#define ZYNQMP_PM_CAPABILITY_UNUSABLE	0x8U

Please align it with other macros (or fix that macros).

Other then two small nits patch is fine.

Thanks,
Michal

_______________________________________________
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] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-08 19:00 [PATCH] soc: xilinx: Set CAP_UNUSABLE requirement for versal while powering down domain Jolly Shah
2019-08-14  7:32 ` Michal Simek

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org infradead-linux-arm-kernel@archiver.kernel.org
	public-inbox-index linux-arm-kernel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox