]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
xilinx: firmware: Introduce zynqmp_pmufw_node() for loading PMU fragments
authorMichal Simek <michal.simek@xilinx.com>
Thu, 4 Nov 2021 10:32:46 +0000 (11:32 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 6 Dec 2021 12:32:48 +0000 (13:32 +0100)
Introduce zynqmp_pmufw_node() for loading PMU configuration fragment for
enabling IPs. Firmware driver has small overlay where NODE id is added and
config fragment is sent to PMUFW. There is a need to build PMUFW with
fragment support.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/firmware/firmware-zynqmp.c
include/zynqmp_firmware.h

index aa20e33b4046f708530e90f27d0f7a40a457daa3..53c0ae8d70caeff6ab804e343b51383f1af1730a 100644 (file)
@@ -26,6 +26,38 @@ struct zynqmp_power {
        struct mbox_chan rx_chan;
 } zynqmp_power;
 
+#define NODE_ID_LOCATION       5
+
+static unsigned int xpm_configobject[] = {
+       /**********************************************************************/
+       /* HEADER */
+       2,      /* Number of remaining words in the header */
+       1,      /* Number of sections included in config object */
+       PM_CONFIG_OBJECT_TYPE_OVERLAY,  /* Type of Config object as overlay */
+       /**********************************************************************/
+       /* SLAVE SECTION */
+
+       PM_CONFIG_SLAVE_SECTION_ID,     /* Section ID */
+       1,                              /* Number of slaves */
+
+       0, /* Node ID which will be changed below */
+       PM_SLAVE_FLAG_IS_SHAREABLE,
+       PM_CONFIG_IPI_PSU_CORTEXA53_0_MASK |
+       PM_CONFIG_IPI_PSU_CORTEXR5_0_MASK |
+       PM_CONFIG_IPI_PSU_CORTEXR5_1_MASK, /* IPI Mask */
+};
+
+int zynqmp_pmufw_node(u32 id)
+{
+       /* Record power domain id */
+       xpm_configobject[NODE_ID_LOCATION] = id;
+
+       zynqmp_pmufw_load_config_object(xpm_configobject,
+                                       sizeof(xpm_configobject));
+
+       return 0;
+}
+
 static int ipi_req(const u32 *req, size_t req_len, u32 *res, size_t res_maxlen)
 {
        struct zynqmp_ipi_msg msg;
index 8e054d137094d2e30453bee7bc0e09752d387b6c..f005dca887c61a6430b429f675d456aceec3db51 100644 (file)
@@ -427,8 +427,26 @@ enum zynqmp_pm_request_ack {
 #define PAYLOAD_ARG_CNT        5U
 
 unsigned int zynqmp_firmware_version(void);
+int zynqmp_pmufw_node(u32 id);
 void zynqmp_pmufw_load_config_object(const void *cfg_obj, size_t size);
 int xilinx_pm_request(u32 api_id, u32 arg0, u32 arg1, u32 arg2,
                      u32 arg3, u32 *ret_payload);
 
+/* Type of Config Object */
+#define PM_CONFIG_OBJECT_TYPE_BASE     0x1U
+#define PM_CONFIG_OBJECT_TYPE_OVERLAY  0x2U
+
+/* Section Id */
+#define PM_CONFIG_SLAVE_SECTION_ID     0x102U
+#define PM_CONFIG_SET_CONFIG_SECTION_ID        0x107U
+
+/* Flag Option */
+#define PM_SLAVE_FLAG_IS_SHAREABLE     0x1U
+#define PM_MASTER_USING_SLAVE_MASK     0x2U
+
+/* IPI Mask for Master */
+#define PM_CONFIG_IPI_PSU_CORTEXA53_0_MASK     0x00000001
+#define PM_CONFIG_IPI_PSU_CORTEXR5_0_MASK      0x00000100
+#define PM_CONFIG_IPI_PSU_CORTEXR5_1_MASK      0x00000200
+
 #endif /* _ZYNQMP_FIRMWARE_H_ */