diff options
Diffstat (limited to 'arch/arm/mach-k3/common_fdt.c')
-rw-r--r-- | arch/arm/mach-k3/common_fdt.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/arch/arm/mach-k3/common_fdt.c b/arch/arm/mach-k3/common_fdt.c index 867ed173142..2777354c6ab 100644 --- a/arch/arm/mach-k3/common_fdt.c +++ b/arch/arm/mach-k3/common_fdt.c @@ -3,11 +3,11 @@ * Copyright 2023 Toradex - https://www.toradex.com/ */ +#include <asm/arch/k3-common-fdt.h> #include "common.h" #include <dm.h> #include <fdt_support.h> #include <linux/soc/ti/ti_sci_protocol.h> -#include "common_fdt.h" static int fdt_fixup_msmc_ram(void *blob, char *parent_path, char *node_name) { @@ -164,3 +164,39 @@ add_carveout: return 0; } + +static int fdt_fixup_critical_trips(void *blob, int zoneoffset, int maxc) +{ + int node, trip; + + node = fdt_subnode_offset(blob, zoneoffset, "trips"); + if (node < 0) + return -1; + + fdt_for_each_subnode(trip, blob, node) { + const char *type = fdt_getprop(blob, trip, "type", NULL); + + if (!type || (strncmp(type, "critical", 8) != 0)) + continue; + + if (fdt_setprop_u32(blob, trip, "temperature", 1000 * maxc) < 0) + return -1; + } + + return 0; +} + +void fdt_fixup_thermal_critical_trips_k3(void *blob, int maxc) +{ + int node, zone; + + node = fdt_path_offset(blob, "/thermal-zones"); + if (node < 0) + return; + + fdt_for_each_subnode(zone, blob, node) { + if (fdt_fixup_critical_trips(blob, zone, maxc) < 0) + printf("Failed to set temperature in %s critical trips\n", + fdt_get_name(blob, zone, NULL)); + } +} |