]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
soc: xilinx: Set CAP_UNUSABLE requirement for versal while powering down domain
authorTejas Patel <tejas.patel@xilinx.com>
Mon, 26 Aug 2019 20:30:44 +0000 (13:30 -0700)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 16 Oct 2019 10:49:41 +0000 (12:49 +0200)
For "0" requirement which is used to inform firmware that device is
not required currently by master, Versal PLM (Platform Loader and
Manager) which runs on Platform Management Controller and is responsible
platform management of devices that 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 ans so dont want it to be powered down or get reset
during runtime suspend.

In Versal PLM new PM_CAP_UNUSABLE capability is added, which disables
clock only and avoids power down and reset during runtime suspend. Power
and reset will be gated with core suspend.So, this patch sets
CAPABILITY_UNUSABLE requirement during gpd_power_off()
if platform is other than zynqmp.

Signed-off-by: Tejas Patel <tejas.patel@xilinx.com>
Signed-off-by: Jolly Shah <jolly.shah@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/soc/xilinx/zynqmp_pm_domains.c
include/linux/firmware/xlnx-zynqmp.h

index 600f57cf0c2e5014e14a09001609cb8cfc4eeb85..23d90cb12ba917a3d8a0e12ba86ffe90c9d2447b 100644 (file)
@@ -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);
index 778abbbc7d9407f6418f370920fc06b6482bfba7..adb14bcedca257cac111ecb0f80adbdf400e9df8 100644 (file)
@@ -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