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 3741FC433F5 for ; Sat, 7 May 2022 12:05:02 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 63CC9830A0; Sat, 7 May 2022 14:04:59 +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="EPnAIjfS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 72F3D83542; Sat, 7 May 2022 14:04:57 +0200 (CEST) Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) (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 7412D830A0 for ; Sat, 7 May 2022 14:04:54 +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-xd29.google.com with SMTP id f2so10651819ioh.7 for ; Sat, 07 May 2022 05:04:54 -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=wzlnRjYKOthL6Hcrf03uV4Cm2byyEMPK/ZZh7Jbd788=; b=EPnAIjfS4tSbTg6ApFxLUGmIsrLflHptMj45k+liV1LcaWMGS0y4WAigLa1VO1mbtJ RwEoVZ0TUiqAcUUUE7VCOgzMqUBLtlIldAiadHHEDcxgOT+LhICs1Z1+RhjiMW5ppCyx pWEoSOf8DrgKSKO7g4CfT5Zyc6sr7BVz3k6XsMjIx5MhYQKBpDLdjbuG2foKW5xfC1rK 5enKjJDAkidSWuEoXfwXHmVmqndV5vVe4zZDkrqBSyrZkcHt1j8ABTNtdlI8p3mhkBU6 GCg9o9w4ThA6GnNaUmeQPBbW9CuJaBlT1Wfhq9Ba4e4kZ+mh8y5C2NwzD51SLIq/95De Qoww== 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=wzlnRjYKOthL6Hcrf03uV4Cm2byyEMPK/ZZh7Jbd788=; b=SuoEm7+/+ajHXVt9yBVdITaluNucv3gG4kEBSRwKwOxf1f2betaPGbhrSgm1+XffmU EsAjP9wc7dgR4K3A0O7GWPPpwgRCQlcytt/iUWAVAKUlOpIpWFx6wFMxNAtbCepyZN+e oEuMrxJkV0ACurcpdJBcqEjb55x/pyUZuboC8nVdj9IqhmaaJY4JAmtIMiGIibBJbyAe ipX5mHy8oriW27FBZSkzW3J7oQMXIJe2Zw1+U2PVxQxIuhKvNuT8NAjqMZyBBS2gwTJR hMWC/awBsIwFzS18TGQGaWEj1JCPoqh+neIdz6B7mhV7I3aGd28GL8svRPeE67mCqies /O0A== X-Gm-Message-State: AOAM531CkPPeWiv1vPoDmJroT1BN6NlLrCm+VWhEyXqojMnvyhiOQqhx LL78Nkg1NXLe74RynaXWIS/iCK+ripo= X-Google-Smtp-Source: ABdhPJwOOSfgYHUJbcZwxqoAUXKeHUViH6arNAv0rtPW8OPhtUfhnpmO024U1T5qm+X6LIFha0eOJQ== X-Received: by 2002:a05:6602:20d9:b0:657:b18c:4a33 with SMTP id 25-20020a05660220d900b00657b18c4a33mr3169243ioz.82.1651925092709; Sat, 07 May 2022 05:04:52 -0700 (PDT) Received: from aford-IdeaCentre-A730.lan ([2601:448:8400:9e8:cfa7:3bb4:fc44:4064]) by smtp.gmail.com with ESMTPSA id q19-20020a02c8d3000000b0032b3a781744sm2070222jao.8.2022.05.07.05.04.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 05:04:52 -0700 (PDT) From: Adam Ford To: u-boot@lists.denx.de Cc: tharvey@gateworks.com, andrejs.cainikovs@toradex.com, francesco.dolcini@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 V2] ARM: imx: imx8m: Adjust thermal trip points for Industrial parts Date: Sat, 7 May 2022 07:04:40 -0500 Message-Id: <20220507120440.24240-1-aford173@gmail.com> X-Mailer: git-send-email 2.34.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. This should apply to 8MQ, 8MM, 8MN, and 8MP. Signed-off-by: Adam Ford Reviewed-by: Tim Harvey --- V2: Switch the check from looking for industrial or checkoing for anything but commerical. This expands the trip point updates other grades as well. diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c index 8e23e6da32..7175295c3c 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 non-Commerical grade parts */ + if (get_cpu_temp_grade(&minc, &maxc) != TEMP_COMMERCIAL) { + 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.34.1