Commit 4dc141f82139b02fe7cf956c1d188141f0a04b60

Authored by Leonard Crestez
1 parent fc2798fc55

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 <leonard.crestez@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 93f302a6642adedfdd6336b22d08f32284539e35)

Showing 4 changed files with 23 additions and 22 deletions Side-by-side Diff

arch/arm/dts/fsl-imx8qm.dtsi
... ... @@ -344,7 +344,7 @@
344 344  
345 345 pd_lsio: PD_LSIO {
346 346 compatible = "nxp,imx8-pd";
347   - reg = <SC_R_LAST>;
  347 + reg = <SC_R_NONE>;
348 348 #power-domain-cells = <0>;
349 349 #address-cells = <1>;
350 350 #size-cells = <0>;
... ... @@ -483,7 +483,7 @@
483 483  
484 484 pd_conn: PD_CONN {
485 485 compatible = "nxp,imx8-pd";
486   - reg = <SC_R_LAST>;
  486 + reg = <SC_R_NONE>;
487 487 #power-domain-cells = <0>;
488 488 #address-cells = <1>;
489 489 #size-cells = <0>;
... ... @@ -579,7 +579,7 @@
579 579  
580 580 pd_hsio: PD_HSIO {
581 581 compatible = "nxp,imx8-pd";
582   - reg = <SC_R_LAST>;
  582 + reg = <SC_R_NONE>;
583 583 #power-domain-cells = <0>;
584 584 #address-cells = <1>;
585 585 #size-cells = <0>;
... ... @@ -624,7 +624,7 @@
624 624  
625 625 pd_audio: PD_AUDIO {
626 626 compatible = "nxp,imx8-pd";
627   - reg = <SC_R_LAST>;
  627 + reg = <SC_R_NONE>;
628 628 #power-domain-cells = <0>;
629 629 #address-cells = <1>;
630 630 #size-cells = <0>;
... ... @@ -773,7 +773,7 @@
773 773  
774 774 pd_dma: PD_DMA {
775 775 compatible = "nxp,imx8-pd";
776   - reg = <SC_R_LAST>;
  776 + reg = <SC_R_NONE>;
777 777 #power-domain-cells = <0>;
778 778 #address-cells = <1>;
779 779 #size-cells = <0>;
... ... @@ -896,7 +896,7 @@
896 896 };
897 897 pd_gpu: PD_GPU {
898 898 compatible = "nxp,imx8-pd";
899   - reg = <SC_R_LAST>;
  899 + reg = <SC_R_NONE>;
900 900 #power-domain-cells = <0>;
901 901 #address-cells = <1>;
902 902 #size-cells = <0>;
arch/arm/dts/fsl-imx8qxp.dtsi
... ... @@ -153,7 +153,7 @@
153 153  
154 154 pd_lsio: PD_LSIO {
155 155 compatible = "nxp,imx8-pd";
156   - reg = <SC_R_LAST>;
  156 + reg = <SC_R_NONE>;
157 157 #power-domain-cells = <0>;
158 158 #address-cells = <1>;
159 159 #size-cells = <0>;
... ... @@ -287,7 +287,7 @@
287 287  
288 288 pd_conn: PD_CONN {
289 289 compatible = "nxp,imx8-pd";
290   - reg = <SC_R_LAST>;
  290 + reg = <SC_R_NONE>;
291 291 #power-domain-cells = <0>;
292 292 #address-cells = <1>;
293 293 #size-cells = <0>;
... ... @@ -381,7 +381,7 @@
381 381  
382 382 pd_audio: PD_AUDIO {
383 383 compatible = "nxp,imx8-pd";
384   - reg = <SC_R_LAST>;
  384 + reg = <SC_R_NONE>;
385 385 #power-domain-cells = <0>;
386 386 #address-cells = <1>;
387 387 #size-cells = <0>;
... ... @@ -520,7 +520,7 @@
520 520  
521 521 pd_dma: PD_DMA {
522 522 compatible = "nxp,imx8-pd";
523   - reg = <SC_R_LAST>;
  523 + reg = <SC_R_NONE>;
524 524 #power-domain-cells = <0>;
525 525 #address-cells = <1>;
526 526 #size-cells = <0>;
... ... @@ -629,7 +629,7 @@
629 629  
630 630 pd_gpu: gpu-power-domain {
631 631 compatible = "nxp,imx8-pd";
632   - reg = <SC_R_LAST>;
  632 + reg = <SC_R_NONE>;
633 633 #power-domain-cells = <0>;
634 634 #address-cells = <1>;
635 635 #size-cells = <0>;
... ... @@ -661,7 +661,7 @@
661 661  
662 662 pd_hsio: hsio-power-domain {
663 663 compatible = "nxp,imx8-pd";
664   - reg = <SC_R_LAST>;
  664 + reg = <SC_R_NONE>;
665 665 #power-domain-cells = <0>;
666 666 #address-cells = <1>;
667 667 #size-cells = <0>;
... ... @@ -688,7 +688,7 @@
688 688  
689 689 pd_cm40: PD_CM40 {
690 690 compatible = "nxp,imx8-pd";
691   - reg = <SC_R_LAST>;
  691 + reg = <SC_R_NONE>;
692 692 #power-domain-cells = <0>;
693 693 #address-cells = <1>;
694 694 #size-cells = <0>;
arch/arm/mach-imx/imx8/cpu.c
... ... @@ -29,6 +29,7 @@
29 29 #include <asm/setup.h>
30 30 #include <asm/arch/lpcg.h>
31 31 #include <asm/mach-imx/imx_vservice.h>
  32 +#include <asm/arch/power-domain.h>
32 33 #include <spl.h>
33 34  
34 35 DECLARE_GLOBAL_DATA_PTR;
... ... @@ -925,8 +926,8 @@
925 926 nodeoff = fdt_node_offset_by_phandle(blob, fdt32_to_cpu(*php));
926 927  
927 928 rsrc_id = fdtdec_get_uint(blob, nodeoff, "reg", 0);
928   - if (rsrc_id == SC_R_LAST) {
929   - debug("%s's power domain use SC_R_LAST\n",
  929 + if (rsrc_id == SC_R_NONE) {
  930 + debug("%s's power domain use SC_R_NONE\n",
930 931 fdt_get_name(blob, nodeoff, NULL));
931 932 break;
932 933 }
... ... @@ -1850,8 +1851,8 @@
1850 1851 }
1851 1852  
1852 1853 /* Get the owner partition for resource*/
1853   - resource_id = (sc_rsrc_t)ofnode_read_u32_default(args.node, "reg", SC_R_LAST);
1854   - if (resource_id == SC_R_LAST) {
  1854 + resource_id = (sc_rsrc_t)ofnode_read_u32_default(args.node, "reg", SC_R_NONE);
  1855 + if (resource_id == SC_R_NONE) {
1855 1856 printf("Can't find the resource id for udev %s\n", dev->name);
1856 1857 return false;
1857 1858 }
... ... @@ -1919,8 +1920,8 @@
1919 1920 }
1920 1921  
1921 1922 /* Get the owner partition for resource*/
1922   - resource_id = (sc_rsrc_t)ofnode_read_u32_default(args.node, "reg", SC_R_LAST);
1923   - if (resource_id == SC_R_LAST) {
  1923 + resource_id = (sc_rsrc_t)ofnode_read_u32_default(args.node, "reg", SC_R_NONE);
  1924 + if (resource_id == SC_R_NONE) {
1924 1925 printf("Can't find the resource id for udev %s\n", dev->name);
1925 1926 return NULL;
1926 1927 }
drivers/power/domain/imx8-power-domain.c
... ... @@ -59,7 +59,7 @@
59 59 if (ppriv->state_on)
60 60 return 0;
61 61  
62   - if (pdata->resource_id != SC_R_LAST) {
  62 + if (pdata->resource_id != SC_R_NONE) {
63 63 if (!sc_rm_is_resource_owned(ipcHndl, pdata->resource_id))
64 64 printf("%s [%d] not owned by curr partition\n", dev->name, pdata->resource_id);
65 65  
... ... @@ -107,7 +107,7 @@
107 107 }
108 108 }
109 109  
110   - if (pdata->resource_id != SC_R_LAST) {
  110 + if (pdata->resource_id != SC_R_NONE) {
111 111 ret = sc_pm_set_resource_power_mode(ipcHndl, pdata->resource_id, SC_PM_PW_MODE_OFF);
112 112 if (ret) {
113 113 if (!sc_rm_is_resource_owned(ipcHndl, pdata->resource_id)) {
... ... @@ -163,7 +163,7 @@
163 163 }
164 164  
165 165 /* power off parent */
166   - if (pdata->resource_id != SC_R_LAST) {
  166 + if (pdata->resource_id != SC_R_NONE) {
167 167 ret = sc_pm_set_resource_power_mode(ipcHndl, pdata->resource_id, SC_PM_PW_MODE_OFF);
168 168 if (ret) {
169 169 printf("Error: %s Power off failed! (error = %d)\n", parent->name, ret);