From patchwork Tue Jun 16 08:25:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars Povlsen X-Patchwork-Id: 11606843 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 B4AE2618 for ; Tue, 16 Jun 2020 08:26:30 +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 7DE5220739 for ; Tue, 16 Jun 2020 08:26:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nGDj1Ab2"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="1glgbDoO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DE5220739 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=qVV0HkWF0EzUm6jyJX3tT7AZTPRoh6Nijd6JEsOHxqM=; b=nGDj1Ab28AGODG 8GSh5QHmpDB2vRc9upT/85qQqlvc/Am3bFAdphP1xAezlft3ZZMS66jfMuuZO+150gdya77pDuH2I iEVjipRJtk95bM+oMvBYekGbekZsganCV0X78dyWpXIRFsHnJ56FsGqKTS4A0AX81lKKu4M4F2fDY H8KbThYyzsq2ZxkNyj/XLAuQm6PEIdet6PBIF6/XBlo8zavBB4yvPSnTD7/B7HeRBa958o03qSDAj 4fGVbxYBtUQI/d0soROgBqYh3GTwnU/uyiCWMxALb4ZoALJgdHoj4FpMxNR/Rlma0AYrbOB1987ac UvZ/Gh94mIKWqDwsxAvQ==; 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 1jl6vH-000458-CW; Tue, 16 Jun 2020 08:26:23 +0000 Received: from esa5.microchip.iphmx.com ([216.71.150.166]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jl6vB-0003xh-A3 for linux-arm-kernel@lists.infradead.org; Tue, 16 Jun 2020 08:26:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1592295978; x=1623831978; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UXU8xjgeD8uULtQXTbOnbSoc5eRHvFPsywKHip7NVXs=; b=1glgbDoOg8L7Y295yOy9rhoTk55+pCX2+cmc4DPYKFJO/IOXA2FmwnQ7 fGbZ9zRiId4J+OGp6jT9Bqi9HrN8dvPqYu8bN5C2W8Pha71oJd7rkNzG0 tbNUaQYcRyqBLgig5jN7G2fmrQbIbz9xnSxRsothFTdoTiZ7auY0RH7np dh/iuO0TOiLeze0halKVpbTOha2MJzKiTXdAjEV1jLmpPcXtN/oG/46ng 5CHNXrQVVchL1wnkG8EZVMP9m3PRyE+EKHu+RrOeOc1bLRZXCKO8KUgCz xUzTAgwzyB0+JdhVUqV1+IHCMFCBt9GcabB/BWtSMaqzE+9umIXET4zkE g==; IronPort-SDR: oLPrloCPosfK2Oj+eHset1dHFSuEZWYg1KuwFZ15O+1pbC3SH5kkWl+t3yo+FzKpeLQzoMJ3ll ToOOZ+6KHvt3JXQrHeN8zSFIgLqS53+V/xlBWJzX+nxJgMPCOXzfeLmF5Lh0HFdDXhrSsKHw8I 1QACVhyS/a451EcL1Is9HTea94e1WWnvo6TU+7DQcpFWQmdL1h+RiWTqM4BZwlXFe3lW5VbeZ2 ihFnvkxKLuEjV1kBz2Q+ujPb1vvGIqzhBVdL4qN7y4tlJ1RZphSMuyiooz2zAHhKEhkQpcM3Ba 5jQ= X-IronPort-AV: E=Sophos;i="5.73,518,1583218800"; d="scan'208";a="79621908" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 16 Jun 2020 01:26:17 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) 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.1979.3; Tue, 16 Jun 2020 01:26:16 -0700 Received: from soft-dev15.microsemi.net (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Tue, 16 Jun 2020 01:26:14 -0700 From: Lars Povlsen To: Guenter Roeck , Rob Herring Subject: [PATCH v3 1/3] dt-bindings: hwmon: Add Sparx5 temperature sensor Date: Tue, 16 Jun 2020 10:25:54 +0200 Message-ID: <20200616082556.27877-2-lars.povlsen@microchip.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200616082556.27877-1-lars.povlsen@microchip.com> References: <20200616082556.27877-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-20200616_012617_389818_F8B140E3 X-CRM114-Status: GOOD ( 10.31 ) 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 [216.71.150.166 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [216.71.150.166 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -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_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 add the DT binding specification for the Sparx5 temperature sensor. 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 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 16 08:25:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars Povlsen X-Patchwork-Id: 11606847 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 21D716A2 for ; Tue, 16 Jun 2020 08:26:45 +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 0090D20786 for ; Tue, 16 Jun 2020 08:26:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="a39HUzOc"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="v8tXmR+B" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0090D20786 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=FysUfwGeSnn8uQ3XowsqBU5IB2qzXtiHTy1JjXLlmwo=; b=a39HUzOcxEuzZ2 gMKsBbN1oGgPqcP4QMi42qEBn9pYlfyDwTwAA/nhjp8UzMpsIXcYDfQJYIvA/u+ctkcXQz957nF4D 8iuxLRXKrWt0HEXwDKKjoYqfQfBCKlsJmNjLX0QIWjmXDJCYC/AYbYgG5/m34Nb3Jr9005LurWent 7zlBryEV9RvCRmDh4Mli3PXd9EbJXfDtdv+FwVofv0NCUOZL9QlBtwOrf4SuIKCtwFwZuzZu7Bu+y f7so5KCaKHps03zfE1DmOePqPmabaxvpYpu8QwsY9fTKz6w4MaLFUW8q6y2Im2I7mue6MLpiWBaFH s9h67ywF2hjpmbKgrcvA==; 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 1jl6va-0004Os-8I; Tue, 16 Jun 2020 08:26:42 +0000 Received: from esa5.microchip.iphmx.com ([216.71.150.166]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jl6vF-0003xh-Hd for linux-arm-kernel@lists.infradead.org; Tue, 16 Jun 2020 08:26:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1592295982; x=1623831982; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9zgZF5bF0PxY60Zea7h/pZzEv9hjVHtWCRJ66bY+LUo=; b=v8tXmR+BNSU7L4Dq/zFcXfS+RAy8HZ2X47RYTc04mZpGyprzSFwRz8g2 h/k3lafyBLqZoEnjTTqrwApDQatZfS2lM1X5qLU0zvfbxrWvYIMBiCS2y Z7RBu1btksBK1TvL88VmJ2RQR+XEA+UhsOkeAbE5Z/pcFaKmKThoH+/MQ kx3sO2iPnIRjqI1W4SPydgVJEnZOYwddE4CwqOgBsmCHQMU9jCAgISdod LeLWNMsTkAulR0cO9T2FTHh0tz3HRyvxb1njYpjcHdvLlA5qCihJFJQB3 hJz1jmW6x5+Wtp1729C3PFUHWeTQFzvcZtjLVkSRvSI6W1FCfjDjqFWif w==; IronPort-SDR: nQLKe7M2JbKxcSEuN9o9/w/3B80GVtsqVwMNHg/UCcgFRRCfQH0sTMIGeM6Aa13NFsjjKR2Vko Zv1AArKEH1CaF8ZIamKCZYP1VgEtb4/KLVHqik52uqyYwhtFmyNMa609/IRbOTaxcUjp113oiJ nr9mLuyH0Azz5FHI6m/P3jqWuKcdJH5TkA1h+bE4TNT9w8yWYr46WiRqOIQT9Eln7ABDYkbVMd 8IxNrS1VxOKHU3cg76/fJysE6Ov2Jx5uxYB6YRQTK2205YCK/uH6NTgUl0aBQJ1SmnnpWlBQ3y zhY= X-IronPort-AV: E=Sophos;i="5.73,518,1583218800"; d="scan'208";a="79621936" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 16 Jun 2020 01:26:22 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) 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.1979.3; Tue, 16 Jun 2020 01:26:18 -0700 Received: from soft-dev15.microsemi.net (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Tue, 16 Jun 2020 01:26:16 -0700 From: Lars Povlsen To: Guenter Roeck Subject: [PATCH v3 2/3] arm64: dts: sparx5: Add hwmon temperature sensor Date: Tue, 16 Jun 2020 10:25:55 +0200 Message-ID: <20200616082556.27877-3-lars.povlsen@microchip.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200616082556.27877-1-lars.povlsen@microchip.com> References: <20200616082556.27877-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-20200616_012621_666847_A81CE5ED X-CRM114-Status: UNSURE ( 8.22 ) 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 [216.71.150.166 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [216.71.150.166 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -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_SIGNED Message has a DKIM or DK signature, not necessarily valid -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. Signed-off-by: Lars Povlsen --- arch/arm64/boot/dts/microchip/sparx5.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) 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 16 08:25:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars Povlsen X-Patchwork-Id: 11606851 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 0790F618 for ; Tue, 16 Jun 2020 08:27:03 +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 D8A9820739 for ; Tue, 16 Jun 2020 08:27: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="qp7FLUJQ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="u7ES9Sgb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D8A9820739 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=ZTRZjxc5060hyXnKWhDnbpEd5YMqDtxgiFr22KCJw6c=; b=qp7FLUJQuMrmnS zxgKLDsQQ1yE2nsy/m0NpZlkwj5hCgZrOprq4Q1+UCJmYynPYY3NdCkX1wl6q8IgxQ1In2HLyBaPH 86p8DMSVh7GBYJ4jbdDP3eFeg5aBEYxezhsolaEwy50a50D7jYWGwif9NgmRtJLQkU+5ukCiYhjE9 WkQ5GOZYbnTf6uBY9spLF7c3yOtt/962yX9EbwQquIxp54UTgPX3aMK2RjENFtFY1tyKiLsBl45+Y Y2sMX1IYAutVfuhYOVdwy1uXqbBnwtOG1BpI3SY2lg7O2j5IM/4e07k/oPLkQ8/Sqj5WSlJWBploF S6pPkNefzD5FrMWOmclg==; 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 1jl6vp-0004dj-Tp; Tue, 16 Jun 2020 08:26:57 +0000 Received: from esa5.microchip.iphmx.com ([216.71.150.166]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jl6vH-0003xh-0p for linux-arm-kernel@lists.infradead.org; Tue, 16 Jun 2020 08:26:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1592295983; x=1623831983; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tnuVjKf68iQPKV3kfPktS/BFcn/FuHT5VzoKzWI08Qc=; b=u7ES9SgbX4jwrASuuNKS/j2+pS6aWFfUHFwWZiwuwSDe3C5oyi6G0thg PCEoJMT6waQMwj4spNmhD5UdDzMxCP2YaQwpC3cglKpvHCYGp0xyJZW7U reKxSudeYFa7vIJPByGvXLqCPILl8l1wSmbC40P/IR1S3kqBjpxlu0ryA TTy3yKeSoqKSWp3akAeVrUQcXTVVS9a7JfKt6s+5+aQVAKffJWu0qRUAI nSUZS6g6E01jtihZGp/PBit3Ulu7Bg1Z9+Vz/uQkqz8I1GVB6qEiIEr33 BbwNiSXxulsrf1oVRLZd5uEDeTy9ri7PH/YFrdjlr0lO+FzW4kM2M2qBq Q==; IronPort-SDR: 403Vml5SiLZQWr9N4Qe6SHADyH6fj9ZxzF3dkBVEWQ2JiTJzoavxQ25jGaO9NWS5gkBFuM8ikP u6HfRvuoZIsXFhsULnwdn5u8zfFQBQrwsX+eVQXiRH8Kt06V6+sYjjKeKbrrUzqqAGxqD2Dbvj IhEOA36cesYg0EpbkXJPndQJSDAqCPUowxDcJV2TXWWgpw+nRyJbL3KHIWz4NC81b2wPgkVwh9 7tktFypAn7dy3UfevFOQyvI361KNi8GRHbDMben5EgN+dcpI6J13SJLC353r2lJ0xUsqRX3zNn sNU= X-IronPort-AV: E=Sophos;i="5.73,518,1583218800"; d="scan'208";a="79621947" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 16 Jun 2020 01:26:23 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) 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.1979.3; Tue, 16 Jun 2020 01:26:20 -0700 Received: from soft-dev15.microsemi.net (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Tue, 16 Jun 2020 01:26:18 -0700 From: Lars Povlsen To: Guenter Roeck Subject: [PATCH v3 3/3] hwmon: sparx5: Add Sparx5 SoC temperature driver Date: Tue, 16 Jun 2020 10:25:56 +0200 Message-ID: <20200616082556.27877-4-lars.povlsen@microchip.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200616082556.27877-1-lars.povlsen@microchip.com> References: <20200616082556.27877-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-20200616_012623_374004_0C28BBCC X-CRM114-Status: GOOD ( 15.93 ) 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 [216.71.150.166 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [216.71.150.166 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -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_SIGNED Message has a DKIM or DK signature, not necessarily valid -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. Signed-off-by: Lars Povlsen --- drivers/hwmon/Kconfig | 10 +++ drivers/hwmon/Makefile | 1 + drivers/hwmon/sparx5-temp.c | 136 ++++++++++++++++++++++++++++++++++++ 3 files changed, 147 insertions(+) create mode 100644 drivers/hwmon/sparx5-temp.c diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 288ae9f63588c..7fb5e0c6c6306 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 || COMPILE_TEST + 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..857293f650412 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -167,6 +167,7 @@ obj-$(CONFIG_SENSORS_SMM665) += smm665.o obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o +obj-$(CONFIG_SENSORS_SPARX5) += sparx5-temp.o obj-$(CONFIG_SENSORS_STTS751) += stts751.o obj-$(CONFIG_SENSORS_AMC6821) += amc6821.o obj-$(CONFIG_SENSORS_TC74) += tc74.o diff --git a/drivers/hwmon/sparx5-temp.c b/drivers/hwmon/sparx5-temp.c new file mode 100644 index 0000000000000..4ed8a2aec3ae9 --- /dev/null +++ b/drivers/hwmon/sparx5-temp.c @@ -0,0 +1,136 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* Sparx5 SoC temperature sensor driver + * + * Copyright (C) 2020 Lars Povlsen + */ + +#include +#include +#include +#include +#include +#include +#include + +#define TEMP_CTRL 0 +#define TEMP_CFG 4 +#define TEMP_CFG_CYCLES GENMASK(24, 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 |= FIELD_PREP(TEMP_CFG_CYCLES, clk); + 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; + + 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); + + 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");