From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AECF1C433F5 for ; Thu, 5 May 2022 18:10:49 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 179A283FE3; Thu, 5 May 2022 20:10:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="oru8o3z/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2306583FC8; Thu, 5 May 2022 20:10:45 +0200 (CEST) Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AA30683FE3 for ; Thu, 5 May 2022 20:10:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=aford173@gmail.com Received: by mail-io1-xd35.google.com with SMTP id h85so5583683iof.12 for ; Thu, 05 May 2022 11:10:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+os+MuKW3c2rGjvwo0me1xnxPETzHcBAr5GO+ruTmpQ=; b=oru8o3z/LWFDNd1nzVSRfTZgXLLMz7nYi+BWmOYkeDsm0s+U5cNiDPnZ8gBEqp37bd tkCBZTJTzNtMjYEwsieKuKx6GwxpgDV6Wlp/cGGDqebAuBQj36MW/geY8vwVaP8G8aS1 9wR2Z26DMQRosmTzaQ+8Oc3/qlHJ6fKMixBHQRED4GgwWTYnvZKg7XIJOjBLcrquRYlF Gpv+6Ax5dgX03IfBQCsRUbFCARCeE0cZ6A4SthPJFwLWR2/k9jRBW9sntYyjKy2BXIBf X8fGS16eFVWD9qcLiGIjZPEJokT9T+BMYdt9c24x+3ihuzD+GsjHuU+9KN66I0jb8tT4 pyxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+os+MuKW3c2rGjvwo0me1xnxPETzHcBAr5GO+ruTmpQ=; b=0DnAjMf5HGfh7NhMyV1FZv1R0TYMpzOnrGx+Vb1pmLkzVOj4JvR71JxrcMBSJE2YB8 isIwZTTnbq/n4HNmXxct5pkHuiXJi/9UV0xq4GrvzDzPdtgNQnKUGsuzUfP8GYDuFyEc YrxDXek10x+1KGfAItc1k9Att2EBHvkCESnrl0C0UBfM34T4pUUy8B63kInkrZcLiWql AvoubyLa2VqbvhmbHEOTJnXuTS9Nk1LKtQxVIdjSvjwHVDN6bDakDzmaYcgMDLNV+XR1 wZXGcskxd2EyRSrsUgh3k3HYSC5M9DnlvQYIOPViig3ZiI6lYIkC6el4Ii2lE6MUpgYQ w3WA== X-Gm-Message-State: AOAM530qexR44BkiG8vv4XrkQY83gSm+ybvUOXbBcYsVsodDnRjqxtgC 4beOGZNcdDNvQ6BEmjvOcTyosAiycKc= X-Google-Smtp-Source: ABdhPJw1nKkJ9XNQyDtPJS7uftCnEPdo9GX34Ua2LQv8Zj5CPHdwb5fcswzVxyO/KQwuQwGEOsmNPw== X-Received: by 2002:a6b:3b8d:0:b0:657:c346:95b1 with SMTP id i135-20020a6b3b8d000000b00657c34695b1mr10523880ioa.70.1651774240763; Thu, 05 May 2022 11:10:40 -0700 (PDT) Received: from aford-OptiPlex-7050.logicpd.com ([174.46.170.158]) by smtp.gmail.com with ESMTPSA id w9-20020a92d2c9000000b002cde6e35301sm583013ilg.75.2022.05.05.11.10.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 May 2022 11:10:40 -0700 (PDT) From: Adam Ford To: u-boot@lists.denx.de Cc: aford@beaconembedded.com, tharvey@gateworks.com, andrejs.cainikovs@toradex.com, Adam Ford , Stefano Babic , Fabio Estevam , "NXP i.MX U-Boot Team" , Peng Fan , Marek Vasut , Ye Li , Frieder Schrempf , Ricardo Salveti , Michael Trimarchi Subject: [PATCH] ARM: imx: imx8m: Adjust thermal trip points for Industrial parts Date: Thu, 5 May 2022 13:10:27 -0500 Message-Id: <20220505181027.3028136-1-aford173@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean If the thermal sensor is enabled in U-Boot, adjust the cpu-thermal trip points for industrial rated parts. Signed-off-by: Adam Ford diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c index 8e23e6da32..619e04a602 100644 --- a/arch/arm/mach-imx/imx8m/soc.c +++ b/arch/arm/mach-imx/imx8m/soc.c @@ -30,6 +30,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -1207,10 +1208,10 @@ static int cleanup_nodes_for_efi(void *blob) int ft_system_setup(void *blob, struct bd_info *bd) { + __maybe_unused int nodeoff; #ifdef CONFIG_IMX8MQ int i = 0; int rc; - int nodeoff; if (get_boot_device() == USB_BOOT) { disable_dcss_nodes(blob); @@ -1346,6 +1347,24 @@ usb_modify_speed: disable_cpu_nodes(blob, 2); #endif +#if defined(CONFIG_IMX_TMU) + int minc, maxc, prop; + + nodeoff = fdt_path_offset(blob, "/thermal-zones/cpu-thermal/trips"); + + /* Only update Industrial grade parts */ + if (get_cpu_temp_grade(&minc, &maxc) == TEMP_INDUSTRIAL) { + fdt_for_each_subnode(prop, blob, nodeoff) { + const char *type = fdt_getprop(blob, prop, "type", NULL); + + if (type && (!strcmp("critical", type))) + fdt_setprop_u32(blob, prop, "temperature", maxc * 1000); + else if (type && (!strcmp("passive", type))) + fdt_setprop_u32(blob, prop, "temperature", (maxc - 10) * 1000); + } + } +#endif + cleanup_nodes_for_efi(blob); return 0; } -- 2.25.1