From patchwork Tue Jun 9 07:48:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars Povlsen X-Patchwork-Id: 11594821 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F8F160D for ; Tue, 9 Jun 2020 07:49:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 59A12207F9 for ; Tue, 9 Jun 2020 07:49:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Hq94ulYc"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="Zw7gR6yc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 59A12207F9 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eQ2AKotpcC1WxcdK0N5HCP5xu84wCWLj2EOckJpDk4U=; b=Hq94ulYcKp2n44 fqCjqaqZ5MY+mhVf04T0g2n26BTdIbF0SjyRsJuEuVWPNnDSvcZy/zn+8b+H3owDNaWs/50GXcwbE yCXdtDSHttFZxh7J2cQk5sbNAEG55z1PGWBM6fEoGYzxDT8Asa9wzRCHNkci9YpjzKqblJYZOL+Zo PhAnELZ2WfA3jqxTfKzrPAMfY6egz0/wPMsmMM993aLZe1KZVzI/OSyaA6JSsSsrcpiOX30Zm1hoH jC/Stf0ZxqXXI7IKIEV+R166lkAyMpRlSAui0gwHiKIaEHNAIzS1wy1CIJ8HGn/4pvw6Pz0ii5v78 AN7I/Z3luXo4kmQM08pQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiZ0Q-0002Us-EV; Tue, 09 Jun 2020 07:49:10 +0000 Received: from esa4.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiZ0N-0002Ty-Lw for linux-arm-kernel@lists.infradead.org; Tue, 09 Jun 2020 07:49:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1591688947; x=1623224947; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z9fxhQY3z4ehjLCF3109NrNvK62lTfFTjodG2LyrA/M=; b=Zw7gR6yc9IM3FBGzB+jGHFY/DqFb108rA/toHTVZvV8YRcNMheeBbg81 hvjapV83HX0RddGKlJknpdLDylI7Zt7fIVPEw09kRY/yqAmOxsVXZpIyr 4dS+nPRoK/+S+spUSEfkEr1AWQ5TPPoGg8ZY3McfMAo6lQjmd4z66lneL F2dOn05tXG4/V+yWe3taJ0kgZBbEIwRfGImAWTMsuuWO8FjKrlpjwuJ4D 1Ywpq9lvtNCEzuugsQnnDk9q6E3WE+lFqyY+zwWG5uEAwePuLzVQLW8jC OdaZHz8IAgY6CoDEIPrnmlOMHQRJklEM1SQDoNWkHQtvzLDTe28VMryxr w==; IronPort-SDR: TpvI0lSXmxb1sJfVs+cknweLXfAeBY11r03cwlBbUzm2OmL6NKuCWYbAxk5p32STuoT4DuO+Uk i21lDVrdXXdqWM8KQ8jw7My8fchB8Tbda4OPlIJk/BLHx/qyjN4+VJcMYcDzkIi7rEuLQZQqL3 u6JEnr+zgelXlloQ0u/EAtr0/UcLHKu8fagNvwabOX8FOdJ87cI2dK/a6L0smKCSTZnTIH1mIi 0zplBDVzwFZ5nlJygP+A+Jpo5WZ979uss4aHAtu9Gko/3aOgTsVi2Ri58w43sMDnyCTJB5vwK9 36o= X-IronPort-AV: E=Sophos;i="5.73,490,1583218800"; d="scan'208";a="75943736" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Jun 2020 00:49:06 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1847.3; Tue, 9 Jun 2020 00:49:06 -0700 Received: from soft-dev15.microsemi.net (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Tue, 9 Jun 2020 00:49:03 -0700 From: Lars Povlsen To: Rob Herring , Guenter Roeck Subject: [PATCH v2 1/3] dt-bindings: hwmon: Add Sparx5 temperature sensor Date: Tue, 9 Jun 2020 09:48:59 +0200 Message-ID: <20200609074859.9385-1-lars.povlsen@microchip.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609072828.9088-1-lars.povlsen@microchip.com> References: <20200609072828.9088-1-lars.povlsen@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200609_004907_786483_510241E0 X-CRM114-Status: GOOD ( 10.71 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.154.123 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, Alexandre Belloni , Jean Delvare , linux-kernel@vger.kernel.org, Microchip Linux Driver Support , Lars Povlsen , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This add the DT binding specification for the Sparx5 temperature sensor. Reviewed-by: Alexandre Belloni Signed-off-by: Lars Povlsen --- .../bindings/hwmon/microchip,sparx5-temp.yaml | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/microchip,sparx5-temp.yaml -- 2.27.0 diff --git a/Documentation/devicetree/bindings/hwmon/microchip,sparx5-temp.yaml b/Documentation/devicetree/bindings/hwmon/microchip,sparx5-temp.yaml new file mode 100644 index 0000000000000..0df4813fd7b24 --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/microchip,sparx5-temp.yaml @@ -0,0 +1,39 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/microchip,sparx5-temp.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Microchip Sparx5 Temperature Monitor + +maintainers: + - Lars Povlsen + +description: | + Microchip Sparx5 embedded temperature monitor + +properties: + compatible: + enum: + - microchip,sparx5-temp + + reg: + maxItems: 1 + + '#thermal-sensor-cells': + const: 0 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + tmon0: tmon@610508110 { + compatible = "microchip,sparx5-temp"; + reg = <0x10508110 0xc>; + #thermal-sensor-cells = <0>; + }; + From patchwork Tue Jun 9 07:49:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars Povlsen X-Patchwork-Id: 11594843 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6582590 for ; Tue, 9 Jun 2020 07:51:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 37E3C207ED for ; Tue, 9 Jun 2020 07:51:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NF89favK"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="awCXjBNV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 37E3C207ED Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=trSIpxmTg+KKYcY+pe1NeCOVSEVv6qgXcffFyeKA8mQ=; b=NF89favKjIMsLh +Vq28TZEyIlq4lJ6/z53h7oeI0l3rqD8sI8BXjF7Mdm94kVsHCH7hl5/CZUVAKFM8fzZjaiAmhD4k Gy+nA5EgubN/vJ4WXIt7XnhyuT1uzJrVPlYkNtWE3sbs+0cbkSOTRo9+xGcXoVdX6HBELkmfZyOOJ aOiqyXmpC+Cil7K2wqiVDysTdz31TI8M580fw0UDK49dvBkZ3Rc2yTLGlkNaxo5vWo3T4jmo3wCJm oAWbGFwJgvCiKKpk3kzmW0lm4rPP5Ksqp5YQXLo1HGgAmVWV28LoQA+DP4VzBtjBM78Xoj8LHoCg/ HkzSqEhCyRNggQtOogFg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiZ2v-0007KU-OT; Tue, 09 Jun 2020 07:51:45 +0000 Received: from esa3.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiZ0r-0002sj-Mu for linux-arm-kernel@lists.infradead.org; Tue, 09 Jun 2020 07:49:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1591688977; x=1623224977; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=riLN+R9+iea9la5DRgv4JxkKdYjJMTBI001pP1e5cEU=; b=awCXjBNVfoh9tEoeAXZkRE60S5zFgRhmM2IzgkqYniLWw825xGdl4hqF PXluU5udUJ/Z0+zmuEnNxGpdt8PxnzVRX4mdm6zbJePhHJGuLuBwFhPOc /6Bf9LZ/aHG3gLMOjYWbF3icQabHDZsUyAgsNqG61XM64iZ/pt1VoAEUd Gw9MT0cxq212BV4w4hpa0x1gTx5B6AJ/g2vSv5bhOkltw0fNc6EuVgBsQ rq4/o4GxwuHPBhCQuPojyedjFsFguz5cj0elWmy27fFg65MOZKMFYcWF9 HzuoV2c5gPH3QQppCLYU9bY+9OT8c7NWODRpOQMo/EW0V9cyjeULM+io0 Q==; IronPort-SDR: u/jmM1FPykEZ1aKwXTZLWoWTz4ttUjy+gONedKqZpbf7ePKo0mEHe5gM2FCBb0ige6IbnJA9Fo wT13tW373AwExbPjqRO/Fui/+wO+xfNT6SiwZo4cL8vnWdAMtJBDbAz21+rNkZHwKusytjfR2w Qr7T2fznQ8z6/gViSMb6jyyZFb1A3Ii0FfdkW7NF6DlLs3Br60EZa/tUO5gihGfDe4AnUGvFni ygs9hWkLdGHmQx5ir4bunlz2UeCyUUvk04cveyQmN4jo8Nigupb2XY3k8VlCigBUbLGH2FMeEI YW8= X-IronPort-AV: E=Sophos;i="5.73,490,1583218800"; d="scan'208";a="79410256" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Jun 2020 00:49:31 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1847.3; Tue, 9 Jun 2020 00:49:30 -0700 Received: from soft-dev15.microsemi.net (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1847.3 via Frontend Transport; Tue, 9 Jun 2020 00:49:28 -0700 From: Lars Povlsen To: Guenter Roeck Subject: [PATCH v2 2/3] arm64: dts: sparx5: Add hwmon temperature sensor Date: Tue, 9 Jun 2020 09:49:25 +0200 Message-ID: <20200609074925.9481-1-lars.povlsen@microchip.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609072828.9088-1-lars.povlsen@microchip.com> References: <20200609072828.9088-1-lars.povlsen@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200609_004937_770992_47B122AB X-CRM114-Status: UNSURE ( 8.74 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, Alexandre Belloni , Jean Delvare , linux-kernel@vger.kernel.org, Microchip Linux Driver Support , Lars Povlsen , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This adds a hwmon temperature node sensor to the Sparx5 SoC. Reviewed-by: Alexandre Belloni Signed-off-by: Lars Povlsen --- arch/arm64/boot/dts/microchip/sparx5.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.27.0 diff --git a/arch/arm64/boot/dts/microchip/sparx5.dtsi b/arch/arm64/boot/dts/microchip/sparx5.dtsi index c9dbd1a8b22b6..49d4f289b9026 100644 --- a/arch/arm64/boot/dts/microchip/sparx5.dtsi +++ b/arch/arm64/boot/dts/microchip/sparx5.dtsi @@ -244,5 +244,11 @@ i2c1: i2c@600103000 { clock-frequency = <100000>; clocks = <&ahb_clk>; }; + + tmon0: tmon@610508110 { + compatible = "microchip,sparx5-temp"; + reg = <0x6 0x10508110 0xc>; + #thermal-sensor-cells = <0>; + }; }; }; From patchwork Tue Jun 9 07:49:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars Povlsen X-Patchwork-Id: 11594845 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B125E90 for ; Tue, 9 Jun 2020 07:52:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 62C48207ED for ; Tue, 9 Jun 2020 07:52:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="c7RakJC3"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="sj308Y3h" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 62C48207ED Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=reL/Nsqp9A7ah3QJlFw3eNkzmp+NOsCOrwdNgWOzjaA=; b=c7RakJC3lOqiyN N/MnlwB979FO1ZUmzYIKKZSxo0O2mmIuz6c9pNWdd1G/lzAxhmY3aVE76iVGSlGaBfV5+UcvdLD9+ Ua1D/sOLXO+oFoIqaTLJAQjx4ZazqWWR2AKvH9v3vUZkLGnBoJGz2eR2F9oJJKP0/4X40TDZJ/tps HIwZaurvSR5Kf49MUH0kNAXFR12j/H2xknIK94vK1XLsj2/SV6/783K00Ud4HJlrcjW22A09vkogj VMmYwdDfanir/A8KUF/0zCz8f6462V9UIG5OuZktK22bBi8nWy65CVh78OfzlE6G0QfY38nOxIKJ4 sbB/rolS/eqBFoPSHfKA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiZ3B-0007Zq-06; Tue, 09 Jun 2020 07:52:01 +0000 Received: from esa1.microchip.iphmx.com ([68.232.147.91]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiZ1O-0003PJ-OT for linux-arm-kernel@lists.infradead.org; Tue, 09 Jun 2020 07:50:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1591689010; x=1623225010; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZcGaO2/tWr5J2B2HMgfBUkK6QCzhyaoN0iV8PYhCSJM=; b=sj308Y3hClNUSk/rbSx20Vy+QBDguXrjD5+6XExieWt6BnwVqHWEWKzL zsUZTXMte5MWqELb0uhTEt4QUcMtr04SkEmyJAZi7WtD32pc6INOQxoCj 7ge3T6r0GCQeNdKwQ3FcLYQFol5nsYxmb4z3Fvkgmts+EOWaKDsUyDGRz SYqDN3lE7VTns7aRqASe2w1WtNB78kqKvdeG+ytlZp+3kgG4CVO5SLYKx 8Fl7csxHtC44+o1erX8MeUp0m8PcSgG0XiAujmw+vxzDXppQpgrB3aLB8 JmJCsXuSpPjrDCCAHv3Do2eD0Ibjt/WcMDqsuDJBGruXrCaNwxVaK2e8B w==; IronPort-SDR: UsP1x2YXQYCUEaF3/YOKAlRNiQa0DDIrg1U/dGllPm+yOSwAapQ3AhG/43z8ok/XdnagbVr6ko yFD/9yEKfXIx5QocxGE9Cmx+Epvk6tqq/Vvqiv4pmEzVCAbKfRc/yvoSgfDhJ5urnz1z+LfoIb QpcfGoyNRnI6LWK+BdOgbbwA4ghewIxO1f318jeJEciz11GMP0plxvO1i5ywR2iwViVDN1vSGa TlrJOMu9SIt8OyDWGJnL+Yee9p4p1QIM3cF98Ph/QIQDdn6UPhppKSATsjV/CTHoH/m6fiXn+A /8Q= X-IronPort-AV: E=Sophos;i="5.73,490,1583218800"; d="scan'208";a="82786973" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Jun 2020 00:49:46 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1847.3; Tue, 9 Jun 2020 00:49:45 -0700 Received: from soft-dev15.microsemi.net (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Tue, 9 Jun 2020 00:49:43 -0700 From: Lars Povlsen To: Guenter Roeck Subject: [PATCH v2 3/3] hwmon: sparx5: Add Sparx5 SoC temperature driver Date: Tue, 9 Jun 2020 09:49:40 +0200 Message-ID: <20200609074940.9529-1-lars.povlsen@microchip.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609072828.9088-1-lars.povlsen@microchip.com> References: <20200609072828.9088-1-lars.povlsen@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200609_005010_822626_17839B70 X-CRM114-Status: GOOD ( 16.55 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.147.91 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.147.91 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, Alexandre Belloni , Jean Delvare , linux-kernel@vger.kernel.org, Microchip Linux Driver Support , Lars Povlsen , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This patch adds a temperature sensor driver to the Sparx5 SoC. Reviewed-by: Alexandre Belloni Signed-off-by: Lars Povlsen --- drivers/hwmon/Kconfig | 10 +++ drivers/hwmon/Makefile | 2 +- drivers/hwmon/sparx5-temp.c | 152 ++++++++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 drivers/hwmon/sparx5-temp.c -- 2.27.0 diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 288ae9f63588c..ec6bb8b8b12df 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -515,6 +515,16 @@ config SENSORS_I5K_AMB This driver can also be built as a module. If so, the module will be called i5k_amb. +config SENSORS_SPARX5 + tristate "Sparx5 SoC temperature sensor" + depends on ARCH_SPARX5 + help + If you say yes here you get support for temperature monitoring + with the Microchip Sparx5 SoC. + + This driver can also be built as a module. If so, the module + will be called sparx5-temp. + config SENSORS_F71805F tristate "Fintek F71805F/FG, F71806F/FG and F71872F/FG" depends on !PPC diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 3e32c21f5efe3..144f09993a3f4 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -66,6 +66,7 @@ obj-$(CONFIG_SENSORS_DS1621) += ds1621.o obj-$(CONFIG_SENSORS_EMC1403) += emc1403.o obj-$(CONFIG_SENSORS_EMC2103) += emc2103.o obj-$(CONFIG_SENSORS_EMC6W201) += emc6w201.o +obj-$(CONFIG_SENSORS_SPARX5) += sparx5-temp.o obj-$(CONFIG_SENSORS_F71805F) += f71805f.o obj-$(CONFIG_SENSORS_F71882FG) += f71882fg.o obj-$(CONFIG_SENSORS_F75375S) += f75375s.o @@ -193,4 +194,3 @@ obj-$(CONFIG_SENSORS_OCC) += occ/ obj-$(CONFIG_PMBUS) += pmbus/ ccflags-$(CONFIG_HWMON_DEBUG_CHIP) := -DDEBUG - diff --git a/drivers/hwmon/sparx5-temp.c b/drivers/hwmon/sparx5-temp.c new file mode 100644 index 0000000000000..2e754462b6010 --- /dev/null +++ b/drivers/hwmon/sparx5-temp.c @@ -0,0 +1,152 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* Sparx5 SoC temperature sensor driver + * + * Copyright (C) 2020 Lars Povlsen + */ + +#include +#include +#include +#include +#include + +#define TEMP_CTRL 0 +#define TEMP_CFG 4 +#define TEMP_CFG_CYCLES GENMASK(24, 15) +#define TEMP_CFG_CYCLES_OFF 15 +#define TEMP_CFG_ENA BIT(0) +#define TEMP_STAT 8 +#define TEMP_STAT_VALID BIT(12) +#define TEMP_STAT_TEMP GENMASK(11, 0) + +struct s5_hwmon { + void __iomem *base; +}; + +static void s5_temp_enable(struct s5_hwmon *hwmon) +{ + u32 val = readl(hwmon->base + TEMP_CFG); + u32 clk = 250; + + val &= ~TEMP_CFG_CYCLES; + val |= (clk << TEMP_CFG_CYCLES_OFF); + val |= TEMP_CFG_ENA; + + writel(val, hwmon->base + TEMP_CFG); +} + +static void s5_temp_disable(void *data) +{ + struct s5_hwmon *hwmon = data; + u32 val = readl(hwmon->base + TEMP_CFG); + + val &= ~TEMP_CFG_ENA; + + writel(val, hwmon->base + TEMP_CFG); +} + +static int s5_read(struct device *dev, enum hwmon_sensor_types type, + u32 attr, int channel, long *temp) +{ + struct s5_hwmon *hwmon = dev_get_drvdata(dev); + int rc = 0, value; + u32 stat; + + switch (attr) { + case hwmon_temp_input: + stat = readl_relaxed(hwmon->base + TEMP_STAT); + if (!(stat & TEMP_STAT_VALID)) + return -EIO; + value = stat & TEMP_STAT_TEMP; + value = DIV_ROUND_CLOSEST(value * 3522, 4096) - 1094; + value *= 100; + *temp = value; + break; + default: + rc = -EOPNOTSUPP; + break; + } + + return rc; +} + +static umode_t s5_is_visible(const void *_data, enum hwmon_sensor_types type, + u32 attr, int channel) +{ + if (type != hwmon_temp) + return 0; + + switch (attr) { + case hwmon_temp_input: + return 0444; + default: + return 0; + } +} + +static const struct hwmon_channel_info *s5_info[] = { + HWMON_CHANNEL_INFO(chip, + HWMON_C_REGISTER_TZ), + HWMON_CHANNEL_INFO(temp, + HWMON_T_INPUT), + NULL +}; + +static const struct hwmon_ops s5_hwmon_ops = { + .is_visible = s5_is_visible, + .read = s5_read, +}; + +static const struct hwmon_chip_info s5_chip_info = { + .ops = &s5_hwmon_ops, + .info = s5_info, +}; + +static int s5_temp_probe(struct platform_device *pdev) +{ + struct device *hwmon_dev; + struct s5_hwmon *hwmon; + int err; + + hwmon = devm_kzalloc(&pdev->dev, sizeof(*hwmon), GFP_KERNEL); + if (!hwmon) + return -ENOMEM; + + hwmon->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(hwmon->base)) + return PTR_ERR(hwmon->base); + + err = devm_add_action(&pdev->dev, s5_temp_disable, hwmon); + if (err) + return err; + + s5_temp_enable(hwmon); + + hwmon_dev = devm_hwmon_device_register_with_info(&pdev->dev, + "s5_temp", + hwmon, + &s5_chip_info, + NULL); + + return PTR_ERR_OR_ZERO(hwmon_dev); +} + +const struct of_device_id s5_temp_match[] = { + { .compatible = "microchip,sparx5-temp" }, + {}, +}; +MODULE_DEVICE_TABLE(of, s5_temp_match); + +static struct platform_driver s5_temp_driver = { + .probe = s5_temp_probe, + .driver = { + .name = "sparx5-temp", + .of_match_table = s5_temp_match, + }, +}; + +module_platform_driver(s5_temp_driver); + +MODULE_AUTHOR("Lars Povlsen "); +MODULE_DESCRIPTION("Sparx5 SoC temperature sensor driver"); +MODULE_LICENSE("GPL");