From f8b6a0ea9371ea8d5a3c4c6216510b4052302656 Mon Sep 17 00:00:00 2001 From: Ye Li Date: Mon, 16 Nov 2020 01:14:25 -0800 Subject: MLK-25010 iMX8MN: Update low_drive_gpu_freq for new GPU node path Low drive mode needs to update GPU freq in kernel DTB. But 5.4 and 5.10 kernel are using different GPU node pathes. Update low_drive_gpu_freq to support both two paths. Signed-off-by: Ye Li Reviewed-by: Peng Fan (cherry picked from commit cb1c6e4279030b859133b9e4e4a0fb2c3e3cd45c) --- arch/arm/mach-imx/imx8m/soc.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c index 220af97a9c..c55ea8df7d 100644 --- a/arch/arm/mach-imx/imx8m/soc.c +++ b/arch/arm/mach-imx/imx8m/soc.c @@ -821,30 +821,34 @@ static int low_drive_gpu_freq(void *blob) "/soc@0/gpu@38000000" }; - int nodeoff, cnt, i; + int nodeoff, cnt, i, j; u32 assignedclks[7]; - nodeoff = fdt_path_offset(blob, nodes_path_8mn[0]); - if (nodeoff < 0) - return nodeoff; + for (i = 0; i < ARRAY_SIZE(nodes_path_8mn); i++) { + nodeoff = fdt_path_offset(blob, nodes_path_8mn[i]); + if (nodeoff < 0) + continue; + + cnt = fdtdec_get_int_array_count(blob, nodeoff, "assigned-clock-rates", assignedclks, 7); + if (cnt < 0) + return cnt; - cnt = fdtdec_get_int_array_count(blob, nodeoff, "assigned-clock-rates", assignedclks, 7); - if (cnt < 0) - return cnt; + if (cnt != 7) + printf("Warning: %s, assigned-clock-rates count %d\n", nodes_path_8mn[i], cnt); - if (cnt != 7) - printf("Warning: %s, assigned-clock-rates count %d\n", nodes_path_8mn[0], cnt); + assignedclks[cnt - 1] = 200000000; + assignedclks[cnt - 2] = 200000000; - assignedclks[cnt - 1] = 200000000; - assignedclks[cnt - 2] = 200000000; + for (j = 0; j < cnt; j++) { + debug("<%u>, ", assignedclks[j]); + assignedclks[j] = cpu_to_fdt32(assignedclks[j]); + } + debug("\n"); - for (i = 0; i < cnt; i++) { - debug("<%u>, ", assignedclks[i]); - assignedclks[i] = cpu_to_fdt32(assignedclks[i]); + return fdt_setprop(blob, nodeoff, "assigned-clock-rates", &assignedclks, sizeof(assignedclks)); } - debug("\n"); - return fdt_setprop(blob, nodeoff, "assigned-clock-rates", &assignedclks, sizeof(assignedclks)); + return -ENOENT; } #endif -- cgit v1.2.3