Commit 5434603dc85553f353a127594ca764c06e54de0a
1 parent
05af9ac080
Exists in
smarc-8m-android-10.0.0_2.6.0
and in
1 other branch
MLK-25003-2 iMX8M: Update thermal and PMU kernel nodes for dual/single cores
For dual core and single core iMX8M parts, the thermal node and PMU node in kernel DTB also needs update to remove the refers to deleted core nodes. Otherwise both driver will fail to work. Signed-off-by: Ye Li <ye.li@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com>
Showing 1 changed file with 73 additions and 0 deletions Side-by-side Diff
arch/arm/mach-imx/imx8m/soc.c
... | ... | @@ -886,6 +886,76 @@ |
886 | 886 | return disable_fdt_nodes(blob, nodes_path_8mp, ARRAY_SIZE(nodes_path_8mp)); |
887 | 887 | } |
888 | 888 | |
889 | +static void disable_thermal_cpu_nodes(void *blob, u32 disabled_cores) | |
890 | +{ | |
891 | + const char *thermal_path[] = { | |
892 | + "/thermal-zones/cpu-thermal/cooling-maps/map0" | |
893 | + }; | |
894 | + | |
895 | + int nodeoff, cnt, i, ret, j; | |
896 | + u32 cooling_dev[12]; | |
897 | + | |
898 | + for (i = 0; i < ARRAY_SIZE(thermal_path); i++) { | |
899 | + nodeoff = fdt_path_offset(blob, thermal_path[i]); | |
900 | + if (nodeoff < 0) | |
901 | + continue; /* Not found, skip it */ | |
902 | + | |
903 | + cnt = fdtdec_get_int_array_count(blob, nodeoff, "cooling-device", cooling_dev, 12); | |
904 | + if (cnt < 0) | |
905 | + continue; | |
906 | + | |
907 | + if (cnt != 12) | |
908 | + printf("Warning: %s, cooling-device count %d\n", thermal_path[i], cnt); | |
909 | + | |
910 | + for (j = 0; j < cnt; j++) { | |
911 | + cooling_dev[j] = cpu_to_fdt32(cooling_dev[j]); | |
912 | + } | |
913 | + | |
914 | + ret= fdt_setprop(blob, nodeoff, "cooling-device", &cooling_dev, sizeof(u32) * (12 - disabled_cores * 3)); | |
915 | + if (ret < 0) { | |
916 | + printf("Warning: %s, cooling-device setprop failed %d\n", thermal_path[i], ret); | |
917 | + continue; | |
918 | + } | |
919 | + | |
920 | + printf("Update node %s, cooling-device prop\n", thermal_path[i]); | |
921 | + } | |
922 | +} | |
923 | + | |
924 | +static void disable_pmu_cpu_nodes(void *blob, u32 disabled_cores) | |
925 | +{ | |
926 | + const char *pmu_path[] = { | |
927 | + "/pmu" | |
928 | + }; | |
929 | + | |
930 | + int nodeoff, cnt, i, ret, j; | |
931 | + u32 irq_affinity[4]; | |
932 | + | |
933 | + for (i = 0; i < ARRAY_SIZE(pmu_path); i++) { | |
934 | + nodeoff = fdt_path_offset(blob, pmu_path[i]); | |
935 | + if (nodeoff < 0) | |
936 | + continue; /* Not found, skip it */ | |
937 | + | |
938 | + cnt = fdtdec_get_int_array_count(blob, nodeoff, "interrupt-affinity", irq_affinity, 4); | |
939 | + if (cnt < 0) | |
940 | + continue; | |
941 | + | |
942 | + if (cnt != 4) | |
943 | + printf("Warning: %s, interrupt-affinity count %d\n", pmu_path[i], cnt); | |
944 | + | |
945 | + for (j = 0; j < cnt; j++) { | |
946 | + irq_affinity[j] = cpu_to_fdt32(irq_affinity[j]); | |
947 | + } | |
948 | + | |
949 | + ret= fdt_setprop(blob, nodeoff, "interrupt-affinity", &irq_affinity, sizeof(u32) * (4 - disabled_cores)); | |
950 | + if (ret < 0) { | |
951 | + printf("Warning: %s, interrupt-affinity setprop failed %d\n", pmu_path[i], ret); | |
952 | + continue; | |
953 | + } | |
954 | + | |
955 | + printf("Update node %s, interrupt-affinity prop\n", pmu_path[i]); | |
956 | + } | |
957 | +} | |
958 | + | |
889 | 959 | static int disable_cpu_nodes(void *blob, u32 disabled_cores) |
890 | 960 | { |
891 | 961 | const char *nodes_path[] = { |
... | ... | @@ -918,6 +988,9 @@ |
918 | 988 | printf("Delete node %s\n", nodes_path[i]); |
919 | 989 | } |
920 | 990 | } |
991 | + | |
992 | + disable_thermal_cpu_nodes(blob, disabled_cores); | |
993 | + disable_pmu_cpu_nodes(blob, disabled_cores); | |
921 | 994 | |
922 | 995 | return 0; |
923 | 996 | } |