From: Leonard Crestez Date: Wed, 27 Feb 2019 19:51:26 +0000 (+0200) Subject: MLK-20958-2 imx8: Replace SC_R_LAST with SC_R_NONE in DTB X-Git-Tag: rel_imx_4.19.35_1.1.0~566 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=be563f60e44757afe4ef2b89d2f043b6aa2a1573;p=u-boot.git MLK-20958-2 imx8: Replace SC_R_LAST with SC_R_NONE in DTB 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 Reviewed-by: Peng Fan (cherry picked from commit 93f302a6642adedfdd6336b22d08f32284539e35) --- diff --git a/arch/arm/dts/fsl-imx8dx.dtsi b/arch/arm/dts/fsl-imx8dx.dtsi index 05acda836d..d521f723cd 100644 --- a/arch/arm/dts/fsl-imx8dx.dtsi +++ b/arch/arm/dts/fsl-imx8dx.dtsi @@ -243,7 +243,7 @@ pd_lsio: PD_LSIO { compatible = "nxp,imx8-pd"; - reg = ; + reg = ; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; @@ -382,7 +382,7 @@ pd_conn: PD_CONN { compatible = "nxp,imx8-pd"; - reg = ; + reg = ; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; @@ -490,7 +490,7 @@ pd_audio: PD_AUDIO { compatible = "nxp,imx8-pd"; - reg = ; + reg = ; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; @@ -863,7 +863,7 @@ pd_dma: PD_DMA { compatible = "nxp,imx8-pd"; - reg = ; + reg = ; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; @@ -1046,7 +1046,7 @@ pd_gpu: gpu-power-domain { compatible = "nxp,imx8-pd"; - reg = ; + reg = ; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; @@ -1099,7 +1099,7 @@ pd_hsio: hsio-power-domain { compatible = "nxp,imx8-pd"; - reg = ; + reg = ; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; @@ -1129,7 +1129,7 @@ pd_cm40: PD_CM40 { compatible = "nxp,imx8-pd"; - reg = ; + reg = ; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; @@ -1386,7 +1386,7 @@ }; pd_caam: PD_CAAM { compatible = "nxp,imx8-pd"; - reg = ; + reg = ; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; diff --git a/arch/arm/dts/fsl-imx8qm-device.dtsi b/arch/arm/dts/fsl-imx8qm-device.dtsi index d9bc9c6f40..86a21ecdce 100644 --- a/arch/arm/dts/fsl-imx8qm-device.dtsi +++ b/arch/arm/dts/fsl-imx8qm-device.dtsi @@ -193,7 +193,7 @@ pd_lsio: PD_LSIO { compatible = "nxp,imx8-pd"; - reg = ; + reg = ; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; @@ -342,7 +342,7 @@ pd_conn: PD_CONN { compatible = "nxp,imx8-pd"; - reg = ; + reg = ; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; @@ -449,7 +449,7 @@ pd_hsio: PD_HSIO { compatible = "nxp,imx8-pd"; - reg = ; + reg = ; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; @@ -503,7 +503,7 @@ pd_audio: PD_AUDIO { compatible = "nxp,imx8-pd"; - reg = ; + reg = ; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; @@ -954,7 +954,7 @@ pd_dma: PD_DMA { compatible = "nxp,imx8-pd"; - reg = ; + reg = ; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; @@ -1201,7 +1201,7 @@ }; pd_gpu: PD_GPU { compatible = "nxp,imx8-pd"; - reg = ; + reg = ; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; @@ -1419,7 +1419,7 @@ pd_cm40: PD_CM40 { compatible = "nxp,imx8-pd"; - reg = ; + reg = ; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; @@ -1439,7 +1439,7 @@ pd_cm41: PD_CM41 { compatible = "nxp,imx8-pd"; - reg = ; + reg = ; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; @@ -1462,7 +1462,7 @@ pd_caam: PD_CAAM { compatible = "nxp,imx8-pd"; - reg = ; + reg = ; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c index cbf3e78ed4..51cdb55aa0 100644 --- a/arch/arm/mach-imx/imx8/cpu.c +++ b/arch/arm/mach-imx/imx8/cpu.c @@ -30,6 +30,7 @@ #include #include #include +#include #include 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; } diff --git a/drivers/power/domain/imx8-power-domain.c b/drivers/power/domain/imx8-power-domain.c index 113e916dda..263369d94b 100644 --- a/drivers/power/domain/imx8-power-domain.c +++ b/drivers/power/domain/imx8-power-domain.c @@ -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);