MLK-20958-2 imx8: Replace SC_R_LAST with SC_R_NONE in DTB
authorLeonard Crestez <leonard.crestez@nxp.com>
Wed, 27 Feb 2019 19:51:26 +0000 (21:51 +0200)
committerYe Li <ye.li@nxp.com>
Fri, 24 May 2019 11:28:20 +0000 (04:28 -0700)
We are currently using SC_R_LAST as a marker for imx8 power domain tree
nodes without a resource attached. This value is compiled into dtb as
part of the linux build and used by uboot.

The SC_R_LAST constant changes frequently as SCFW resources are added
(by design) and every time we need to update linux and uboot headers
together or boot can fail.

Fix this by replacing SC_R_LAST usage with a new constant SC_R_NONE
defined to be 0xFFF0.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 93f302a6642adedfdd6336b22d08f32284539e35)

arch/arm/dts/fsl-imx8dx.dtsi
arch/arm/dts/fsl-imx8qm-device.dtsi
arch/arm/mach-imx/imx8/cpu.c
drivers/power/domain/imx8-power-domain.c

index 05acda8..d521f72 100644 (file)
 
                pd_lsio: PD_LSIO {
                        compatible = "nxp,imx8-pd";
-                       reg = <SC_R_LAST>;
+                       reg = <SC_R_NONE>;
                        #power-domain-cells = <0>;
                        #address-cells = <1>;
                        #size-cells = <0>;
 
                pd_conn: PD_CONN {
                        compatible = "nxp,imx8-pd";
-                       reg = <SC_R_LAST>;
+                       reg = <SC_R_NONE>;
                        #power-domain-cells = <0>;
                        #address-cells = <1>;
                        #size-cells = <0>;
 
                pd_audio: PD_AUDIO {
                        compatible = "nxp,imx8-pd";
-                       reg = <SC_R_LAST>;
+                       reg = <SC_R_NONE>;
                        #power-domain-cells = <0>;
                        #address-cells = <1>;
                        #size-cells = <0>;
 
                pd_dma: PD_DMA {
                        compatible = "nxp,imx8-pd";
-                       reg = <SC_R_LAST>;
+                       reg = <SC_R_NONE>;
                        #power-domain-cells = <0>;
                        #address-cells = <1>;
                        #size-cells = <0>;
 
                pd_gpu: gpu-power-domain {
                        compatible = "nxp,imx8-pd";
-                       reg = <SC_R_LAST>;
+                       reg = <SC_R_NONE>;
                        #power-domain-cells = <0>;
                        #address-cells = <1>;
                        #size-cells = <0>;
 
                pd_hsio: hsio-power-domain {
                        compatible = "nxp,imx8-pd";
-                       reg = <SC_R_LAST>;
+                       reg = <SC_R_NONE>;
                        #power-domain-cells = <0>;
                        #address-cells = <1>;
                        #size-cells = <0>;
 
                pd_cm40: PD_CM40 {
                        compatible = "nxp,imx8-pd";
-                       reg = <SC_R_LAST>;
+                       reg = <SC_R_NONE>;
                        #power-domain-cells = <0>;
                        #address-cells = <1>;
                        #size-cells = <0>;
                };
                pd_caam: PD_CAAM {
                        compatible = "nxp,imx8-pd";
-                       reg = <SC_R_LAST>;
+                       reg = <SC_R_NONE>;
                        #power-domain-cells = <0>;
                        #address-cells = <1>;
                        #size-cells = <0>;
index d9bc9c6..86a21ec 100644 (file)
 
                pd_lsio: PD_LSIO {
                        compatible = "nxp,imx8-pd";
-                       reg = <SC_R_LAST>;
+                       reg = <SC_R_NONE>;
                        #power-domain-cells = <0>;
                        #address-cells = <1>;
                        #size-cells = <0>;
 
                pd_conn: PD_CONN {
                        compatible = "nxp,imx8-pd";
-                       reg = <SC_R_LAST>;
+                       reg = <SC_R_NONE>;
                        #power-domain-cells = <0>;
                        #address-cells = <1>;
                        #size-cells = <0>;
 
                pd_hsio: PD_HSIO {
                        compatible = "nxp,imx8-pd";
-                       reg = <SC_R_LAST>;
+                       reg = <SC_R_NONE>;
                        #power-domain-cells = <0>;
                        #address-cells = <1>;
                        #size-cells = <0>;
 
                pd_audio: PD_AUDIO {
                        compatible = "nxp,imx8-pd";
-                       reg = <SC_R_LAST>;
+                       reg = <SC_R_NONE>;
                        #power-domain-cells = <0>;
                        #address-cells = <1>;
                        #size-cells = <0>;
 
                pd_dma: PD_DMA {
                        compatible = "nxp,imx8-pd";
-                       reg = <SC_R_LAST>;
+                       reg = <SC_R_NONE>;
                        #power-domain-cells = <0>;
                        #address-cells = <1>;
                        #size-cells = <0>;
                };
                pd_gpu: PD_GPU {
                        compatible = "nxp,imx8-pd";
-                       reg = <SC_R_LAST>;
+                       reg = <SC_R_NONE>;
                        #power-domain-cells = <0>;
                        #address-cells = <1>;
                        #size-cells = <0>;
 
                pd_cm40: PD_CM40 {
                        compatible = "nxp,imx8-pd";
-                       reg = <SC_R_LAST>;
+                       reg = <SC_R_NONE>;
                        #power-domain-cells = <0>;
                        #address-cells = <1>;
                        #size-cells = <0>;
 
                pd_cm41: PD_CM41 {
                        compatible = "nxp,imx8-pd";
-                       reg = <SC_R_LAST>;
+                       reg = <SC_R_NONE>;
                        #power-domain-cells = <0>;
                        #address-cells = <1>;
                        #size-cells = <0>;
 
                pd_caam: PD_CAAM {
                        compatible = "nxp,imx8-pd";
-                       reg = <SC_R_LAST>;
+                       reg = <SC_R_NONE>;
                        #power-domain-cells = <0>;
                        #address-cells = <1>;
                        #size-cells = <0>;
index cbf3e78..51cdb55 100644 (file)
@@ -30,6 +30,7 @@
 #include <fdtdec.h>
 #include <generated/version_autogenerated.h>
 #include <asm/mach-imx/imx_vservice.h>
+#include <asm/arch/power-domain.h>
 #include <spl.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -627,8 +628,8 @@ static bool check_owned_resources_in_pd_tree(void *blob, int nodeoff,
                nodeoff = fdt_node_offset_by_phandle(blob, fdt32_to_cpu(*php));
 
                rsrc_id = fdtdec_get_uint(blob, nodeoff, "reg", 0);
-               if (rsrc_id == SC_R_LAST) {
-                       debug("%s's power domain use SC_R_LAST\n",
+               if (rsrc_id == SC_R_NONE) {
+                       debug("%s's power domain use SC_R_NONE\n",
                                fdt_get_name(blob, nodeoff, NULL));
                        break;
                }
@@ -1742,8 +1743,8 @@ bool check_owned_udevice(struct udevice *dev)
        }
 
        /* Get the owner partition for resource*/
-       resource_id = (sc_rsrc_t)ofnode_read_u32_default(args.node, "reg", SC_R_LAST);
-       if (resource_id == SC_R_LAST) {
+       resource_id = (sc_rsrc_t)ofnode_read_u32_default(args.node, "reg", SC_R_NONE);
+       if (resource_id == SC_R_NONE) {
                printf("Can't find the resource id for udev %s\n", dev->name);
                return false;
        }
@@ -1805,8 +1806,8 @@ struct udevice * board_imx_vservice_find_mu(struct udevice *dev)
        }
 
        /* Get the owner partition for resource*/
-       resource_id = (sc_rsrc_t)ofnode_read_u32_default(args.node, "reg", SC_R_LAST);
-       if (resource_id == SC_R_LAST) {
+       resource_id = (sc_rsrc_t)ofnode_read_u32_default(args.node, "reg", SC_R_NONE);
+       if (resource_id == SC_R_NONE) {
                printf("Can't find the resource id for udev %s\n", dev->name);
                return NULL;
        }
index 113e916..263369d 100644 (file)
@@ -61,7 +61,7 @@ static int imx8_power_domain_on(struct power_domain *power_domain)
        if (ppriv->state_on)
                return 0;
 
-       if (pdata->resource_id != SC_R_LAST) {
+       if (pdata->resource_id != SC_R_NONE) {
                if (!sc_rm_is_resource_owned(-1, pdata->resource_id))
                        printf("%s [%d] not owned by curr partition\n", dev->name, pdata->resource_id);
 
@@ -110,7 +110,7 @@ static int imx8_power_domain_off_node(struct power_domain *power_domain)
                }
        }
 
-       if (pdata->resource_id != SC_R_LAST) {
+       if (pdata->resource_id != SC_R_NONE) {
                ret = sc_pm_set_resource_power_mode(-1, pdata->resource_id,
                                                    SC_PM_PW_MODE_OFF);
                if (ret) {
@@ -173,7 +173,7 @@ static int imx8_power_domain_off_parentnodes(struct power_domain *power_domain)
                }
 
                /* power off parent */
-               if (pdata->resource_id != SC_R_LAST) {
+               if (pdata->resource_id != SC_R_NONE) {
                        ret = sc_pm_set_resource_power_mode(-1,
                                                            pdata->resource_id,
                                                            SC_PM_PW_MODE_OFF);