zynqmp: pm: Add IOCTL to set boot health status
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Tue, 4 Sep 2018 11:42:51 +0000 (17:12 +0530)
committerSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Tue, 4 Sep 2018 11:42:51 +0000 (17:12 +0530)
Since the MMIO read/write APIs are removed from Linux user space,
Linux cannot directly write to the Global General Storage Register 4
any more to set healthy boot status.

Create an IOCTL to allow Linux to set boot health status.

Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Acked-by: Will Wong <willw@xilinx.com>
plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c
plat/xilinx/zynqmp/pm_service/pm_api_ioctl.h
plat/xilinx/zynqmp/zynqmp_def.h

index 17918338d20ecb1bdaaf280019230e58556ff1cd..6f60e47e6138598d5fefff5684b33df54c6d6be3 100644 (file)
@@ -505,6 +505,20 @@ static enum pm_ret_status pm_ioctl_ulpi_reset(void)
        return ret;
 }
 
+/**
+ * pm_ioctl_set_boot_health_status() - Ioctl for setting healthy boot status
+ *
+ * This function sets healthy bit value to indicate boot health status
+ * to firmware.
+ *
+ * @return      Returns status, either success or error+reason
+ */
+static enum pm_ret_status pm_ioctl_set_boot_health_status(unsigned int value)
+{
+       return pm_mmio_write(PM_BOOT_HEALTH_STATUS_REG,
+                            PM_BOOT_HEALTH_STATUS_MASK, value);
+}
+
 /**
  * pm_api_ioctl() -  PM IOCTL API for device control and configs
  * @node_id    Node ID of the device
@@ -577,6 +591,9 @@ enum pm_ret_status pm_api_ioctl(enum pm_node_id nid,
        case IOCTL_ULPI_RESET:
                ret = pm_ioctl_ulpi_reset();
                break;
+       case IOCTL_SET_BOOT_HEALTH_STATUS:
+               ret = pm_ioctl_set_boot_health_status(arg1);
+               break;
        default:
                ret = PM_RET_ERROR_NOTSUPPORTED;
                break;
index bf17117f081a5e7bf3a54a18d852bcd15d42afe6..29cd96ef26db351ea44301dd1e7c373d068913b6 100644 (file)
@@ -34,6 +34,8 @@ enum {
        IOCTL_READ_PGGS,
        /* IOCTL for ULPI reset */
        IOCTL_ULPI_RESET,
+       /* Set healthy bit value */
+       IOCTL_SET_BOOT_HEALTH_STATUS,
 };
 
 //RPU operation mode
index dd26c6c2c27e77d8591a84a2c82424dba327de8d..bfd61976f4b246461bdab5e3034eee32cfc0ca09 100644 (file)
 #define PGGS_BASEADDR          (0xFFD80050U)
 #define PGGS_NUM_REGS          U(4)
 
+/* Warm restart boot health status register and mask */
+#define PM_BOOT_HEALTH_STATUS_REG              (GGS_BASEADDR + U(0x10))
+#define PM_BOOT_HEALTH_STATUS_MASK             U(0x01)
+
 #endif /* __ZYNQMP_DEF_H__ */