From patchwork Tue Jan 3 01:31:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Feng X-Patchwork-Id: 38234 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4387421wrt; Mon, 2 Jan 2023 17:33:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXv1VTQ7pMOZqEn2cTTbB9nlPGgIf4it5GEmQZepXocJ30c66tgdNp2sFmkZ5a5PjxIaKSOA X-Received: by 2002:a17:907:d311:b0:7c4:e7b0:8491 with SMTP id vg17-20020a170907d31100b007c4e7b08491mr37737480ejc.61.1672709607332; Mon, 02 Jan 2023 17:33:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672709607; cv=none; d=google.com; s=arc-20160816; b=DQo3Az/FmGlaWA88ObKNR9hfF0VBPt9ZN/U6Z7iWyDLhitYg3CEupWjgCcu0hsrkM7 OKw9yil8o/vJKr78DbVyBScR23/H+bCHpHc+9IeMkOmuAzAiU3PqdC5ywhy+LT50USD7 +4q28G2MD69EEtlpZ8JRY3fEY1PLm20sjC8miidDiQv/WrMxLLWBmgclL6MLw14XkT1C 5uUB8b/OT6v4bHft33hi2sdkSlkZTpZpr+aljLWdKyMCi62fORmnDxSOmxnDthwAeR/O Ymed5N6olqEBMDPm+UILa+dcjPSZ5Im45uGMWiKRSHAsYe/iCEqJG+oQUIIp2HxKgBe2 yIiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Vh+IAVpscYnfHMFnGLQJ6oXAn3grycw66MXgxt/5MRc=; b=wAQsfRPP+o/RGYPTFB9osFhlht80ATZHTM+mNTQxv1cRrTNyPOq0f/kN/vwNQJM+xM JWRwx6VoxZCtxM5ElykHjvy0dw0g0id51gClNdvbF8wXKXV7245goJ/zp/jm/H9qIJMM JLIZmucf2X5C6SjFhLuE2U2bF1Pfr1RftByuouBcU9dnBLZtIO8L0v6xctxsFwCndFuw T06jtxxsQoEBsdrQK2ge0Qdui58xisJidzPM6MVdqOMHpHpVXy0uWV35WJE8PV9ZuLMH QcX4ekX2KgrGofKObl0lgH8a2UXvHJGNwnTvA10SWUXfTPdRfIbrnGNz9Dsu7h5uNZ9e S2uA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv16-20020a17090760d000b0083b6e04f379si27959571ejc.492.2023.01.02.17.33.04; Mon, 02 Jan 2023 17:33:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236558AbjACBcK convert rfc822-to-8bit (ORCPT + 99 others); Mon, 2 Jan 2023 20:32:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230182AbjACBb5 (ORCPT ); Mon, 2 Jan 2023 20:31:57 -0500 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32DB1199; Mon, 2 Jan 2023 17:31:56 -0800 (PST) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 1239324E0FC; Tue, 3 Jan 2023 09:31:50 +0800 (CST) Received: from EXMBX172.cuchost.com (172.16.6.92) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 3 Jan 2023 09:31:50 +0800 Received: from ubuntu.localdomain (113.72.146.202) by EXMBX172.cuchost.com (172.16.6.92) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 3 Jan 2023 09:31:49 +0800 From: Hal Feng To: , , , CC: Jean Delvare , Guenter Roeck , Jonathan Corbet , Conor Dooley , "Paul Walmsley" , Palmer Dabbelt , Albert Ou , Rob Herring , Krzysztof Kozlowski , Emil Renner Berthing , Hal Feng , Subject: [PATCH v1 1/4] dt-bindings: hwmon: Add starfive,jh71x0-temp Date: Tue, 3 Jan 2023 09:31:42 +0800 Message-ID: <20230103013145.9570-2-hal.feng@starfivetech.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230103013145.9570-1-hal.feng@starfivetech.com> References: <20230103013145.9570-1-hal.feng@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [113.72.146.202] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX172.cuchost.com (172.16.6.92) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753963149254950747?= X-GMAIL-MSGID: =?utf-8?q?1753963149254950747?= From: Emil Renner Berthing Add bindings for the temperature sensor on the StarFive JH7100 and JH7110 SoCs. Signed-off-by: Emil Renner Berthing Signed-off-by: Hal Feng --- .../bindings/hwmon/starfive,jh71x0-temp.yaml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/starfive,jh71x0-temp.yaml diff --git a/Documentation/devicetree/bindings/hwmon/starfive,jh71x0-temp.yaml b/Documentation/devicetree/bindings/hwmon/starfive,jh71x0-temp.yaml new file mode 100644 index 000000000000..2600881e2cdc --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/starfive,jh71x0-temp.yaml @@ -0,0 +1,75 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/starfive,jh71x0-temp.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: StarFive JH71x0 Temperature Sensor + +maintainers: + - Emil Renner Berthing + +description: | + StarFive Technology Co. JH71x0 embedded temperature sensor + +properties: + compatible: + enum: + - starfive,jh7100-temp + - starfive,jh7110-temp + + reg: + maxItems: 1 + + clocks: + minItems: 2 + maxItems: 2 + + clock-names: + items: + - const: "sense" + - const: "bus" + + '#thermal-sensor-cells': + const: 0 + + interrupts: + maxItems: 1 + + resets: + minItems: 2 + maxItems: 2 + + reset-names: + items: + - const: "sense" + - const: "bus" + +required: + - compatible + - reg + - clocks + - clock-names + - interrupts + - resets + - reset-names + +additionalProperties: false + +examples: + - | + #include + #include + + tmon@124a0000 { + compatible = "starfive,jh7100-temp"; + reg = <0x124a0000 0x10000>; + clocks = <&clkgen JH7100_CLK_TEMP_SENSE>, + <&clkgen JH7100_CLK_TEMP_APB>; + clock-names = "sense", "bus"; + #thermal-sensor-cells = <0>; + interrupts = <122>; + resets = <&rstgen JH7100_RSTN_TEMP_SENSE>, + <&rstgen JH7100_RSTN_TEMP_APB>; + reset-names = "sense", "bus"; + }; From patchwork Tue Jan 3 01:31:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Feng X-Patchwork-Id: 38231 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4387134wrt; Mon, 2 Jan 2023 17:32:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXu0hlE96VHMo3FkgRUYuD5tg5NqChrLT9gMUmBPM5T0C4CKCP/WuIUwA9go65F8ZvC+SPzi X-Received: by 2002:a17:90a:448c:b0:226:8d3:7ed6 with SMTP id t12-20020a17090a448c00b0022608d37ed6mr24124205pjg.41.1672709536170; Mon, 02 Jan 2023 17:32:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672709536; cv=none; d=google.com; s=arc-20160816; b=Jfiit5Fmhn7/oG0LBLkyXUPo4OUhW6kPq3cr0HEWFr4d7SAB4B8V46qxYyu2i/XXBm EvuGGz4YAi2V+FrT8kcJG9xBs3zJ8BtN0uMV4eKzDaAmi3fs86R1Xz/vy5eSNqHuq/Aa L6szodMMAbIjMYi3Cki1nqiNokenBoAwNrcnjFKDRd8A6IVYQ+TQ8SBR7alpfWZluZOB 6rHY/JKrn7IHVgZZ4bAYZ76MWGGeEO79aabyr8vc1cjtcoQnU+ziskrtGUoVSk2X1aLG P43OxQh4lEnqMMwe93J3ldHzUix7n4Eu4sehdF4q5KvZ5jIQlkBDIi4Gne3Kf55ANR6M CRUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=P3TdjWYtFKPGA1K9HAHGCyAYZeJDO6OyLaio9cygbsY=; b=Nn8c5HVMYyI57/S3YjzgR6hR0UX3V0Fq/zuHLPaP4KyujGBRk3gLbQ48zKAdjEY/fI Ik8wrwj1hnMTwDVA9tBLNuugpQ3oy3PmPl9cTD2ZdVijQ11CEbu9ULad+zkKGTMWQZT2 gI6ZP7iq50ByItindgqwLUAaLIXU0N9oEpLAWfoYbORhIal7UN0wCUKHiJAmV+uLq/Ha yTnmrp8O4k4KlhfbGS0lQJt6JaHLo0W1SZAQap7tM0wZnKdCKuLFI1wnulsm9a7FjXKr QV667hNIvsnCGJu/2o5a91zDeuDVJhSudAy2sIbtQN6Xa0KHx26ETzRqmMxjnqIrMzps O8Eg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rm11-20020a17090b3ecb00b00218cf92fc62si30908637pjb.89.2023.01.02.17.32.03; Mon, 02 Jan 2023 17:32:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236250AbjACBb6 convert rfc822-to-8bit (ORCPT + 99 others); Mon, 2 Jan 2023 20:31:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232770AbjACBbz (ORCPT ); Mon, 2 Jan 2023 20:31:55 -0500 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D2EBCF4; Mon, 2 Jan 2023 17:31:52 -0800 (PST) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id 116AE24E004; Tue, 3 Jan 2023 09:31:51 +0800 (CST) Received: from EXMBX172.cuchost.com (172.16.6.92) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 3 Jan 2023 09:31:51 +0800 Received: from ubuntu.localdomain (113.72.146.202) by EXMBX172.cuchost.com (172.16.6.92) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 3 Jan 2023 09:31:50 +0800 From: Hal Feng To: , , , CC: Jean Delvare , Guenter Roeck , Jonathan Corbet , Conor Dooley , "Paul Walmsley" , Palmer Dabbelt , Albert Ou , Rob Herring , Krzysztof Kozlowski , Emil Renner Berthing , Hal Feng , Subject: [PATCH v1 2/4] hwmon: (sfctemp) Add StarFive JH71x0 temperature sensor Date: Tue, 3 Jan 2023 09:31:43 +0800 Message-ID: <20230103013145.9570-3-hal.feng@starfivetech.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230103013145.9570-1-hal.feng@starfivetech.com> References: <20230103013145.9570-1-hal.feng@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [113.72.146.202] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX172.cuchost.com (172.16.6.92) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753963074286478296?= X-GMAIL-MSGID: =?utf-8?q?1753963074286478296?= From: Emil Renner Berthing Register definitions and conversion constants based on sfctemp driver by Samin in the StarFive 5.10 kernel. Signed-off-by: Emil Renner Berthing Co-developed-by: Samin Guo Signed-off-by: Samin Guo Signed-off-by: Hal Feng --- Documentation/hwmon/index.rst | 1 + Documentation/hwmon/sfctemp.rst | 33 +++ MAINTAINERS | 8 + drivers/hwmon/Kconfig | 10 + drivers/hwmon/Makefile | 1 + drivers/hwmon/sfctemp.c | 350 ++++++++++++++++++++++++++++++++ 6 files changed, 403 insertions(+) create mode 100644 Documentation/hwmon/sfctemp.rst create mode 100644 drivers/hwmon/sfctemp.c diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst index c1d11cf13eef..f7ede608b6e3 100644 --- a/Documentation/hwmon/index.rst +++ b/Documentation/hwmon/index.rst @@ -179,6 +179,7 @@ Hardware Monitoring Kernel Drivers sch5627 sch5636 scpi-hwmon + sfctemp sht15 sht21 sht3x diff --git a/Documentation/hwmon/sfctemp.rst b/Documentation/hwmon/sfctemp.rst new file mode 100644 index 000000000000..9fbd5bb1f356 --- /dev/null +++ b/Documentation/hwmon/sfctemp.rst @@ -0,0 +1,33 @@ +.. SPDX-License-Identifier: GPL-2.0 + +Kernel driver sfctemp +===================== + +Supported chips: + - StarFive JH7100 + - StarFive JH7110 + +Authors: + - Emil Renner Berthing + +Description +----------- + +This driver adds support for reading the built-in temperature sensor on the +JH7100 and JH7110 RISC-V SoCs by StarFive Technology Co. Ltd. + +``sysfs`` interface +------------------- + +The temperature sensor can be enabled, disabled and queried via the standard +hwmon interface in sysfs under ``/sys/class/hwmon/hwmonX`` for some value of +``X``: + +================ ==== ============================================= +Name Perm Description +================ ==== ============================================= +temp1_enable RW Enable or disable temperature sensor. + Automatically enabled by the driver, + but may be disabled to save power. +temp1_input RO Temperature reading in milli-degrees Celsius. +================ ==== ============================================= diff --git a/MAINTAINERS b/MAINTAINERS index 85e8f83161d7..ab3cd5827b26 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -18661,6 +18661,14 @@ L: netdev@vger.kernel.org S: Supported F: drivers/net/ethernet/sfc/ +SFCTEMP HWMON DRIVER +M: Emil Renner Berthing +L: linux-hwmon@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/hwmon/starfive,jh71x0-temp.yaml +F: Documentation/hwmon/sfctemp.rst +F: drivers/hwmon/sfctemp.c + SFF/SFP/SFP+ MODULE SUPPORT M: Russell King L: netdev@vger.kernel.org diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 7ac3daaf59ce..c6bbfcca3a14 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -1910,6 +1910,16 @@ config SENSORS_STTS751 This driver can also be built as a module. If so, the module will be called stts751. +config SENSORS_SFCTEMP + tristate "Starfive JH71x0 temperature sensor" + depends on SOC_STARFIVE || COMPILE_TEST + help + If you say yes here you get support for temperature sensor + on the Starfive JH71x0 SoCs. + + This driver can also be built as a module. If so, the module + will be called sfctemp. + config SENSORS_SMM665 tristate "Summit Microelectronics SMM665" depends on I2C diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 11d076cad8a2..5a4a02c5535c 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -179,6 +179,7 @@ obj-$(CONFIG_SENSORS_SBRMI) += sbrmi.o obj-$(CONFIG_SENSORS_SCH56XX_COMMON)+= sch56xx-common.o obj-$(CONFIG_SENSORS_SCH5627) += sch5627.o obj-$(CONFIG_SENSORS_SCH5636) += sch5636.o +obj-$(CONFIG_SENSORS_SFCTEMP) += sfctemp.o obj-$(CONFIG_SENSORS_SL28CPLD) += sl28cpld-hwmon.o obj-$(CONFIG_SENSORS_SHT15) += sht15.o obj-$(CONFIG_SENSORS_SHT21) += sht21.o diff --git a/drivers/hwmon/sfctemp.c b/drivers/hwmon/sfctemp.c new file mode 100644 index 000000000000..e56716ad9587 --- /dev/null +++ b/drivers/hwmon/sfctemp.c @@ -0,0 +1,350 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2021 Emil Renner Berthing + * Copyright (C) 2021 Samin Guo + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * TempSensor reset. The RSTN can be de-asserted once the analog core has + * powered up. Trst(min 100ns) + * 0:reset 1:de-assert + */ +#define SFCTEMP_RSTN BIT(0) + +/* + * TempSensor analog core power down. The analog core will be powered up + * Tpu(min 50us) after PD is de-asserted. RSTN should be held low until the + * analog core is powered up. + * 0:power up 1:power down + */ +#define SFCTEMP_PD BIT(1) + +/* + * TempSensor start conversion enable. + * 0:disable 1:enable + */ +#define SFCTEMP_RUN BIT(2) + +/* + * TempSensor conversion value output. + * Temp(C)=DOUT*Y/4094 - K + */ +#define SFCTEMP_DOUT_POS 16 +#define SFCTEMP_DOUT_MSK GENMASK(27, 16) + +/* DOUT to Celcius conversion constants */ +#define SFCTEMP_Y1000 237500L +#define SFCTEMP_Z 4094L +#define SFCTEMP_K1000 81100L + +struct sfctemp { + /* serialize access to hardware register and enabled below */ + struct mutex lock; + struct completion conversion_done; + void __iomem *regs; + struct clk *clk_sense; + struct clk *clk_bus; + struct reset_control *rst_sense; + struct reset_control *rst_bus; + bool enabled; +}; + +static irqreturn_t sfctemp_isr(int irq, void *data) +{ + struct sfctemp *sfctemp = data; + + complete(&sfctemp->conversion_done); + return IRQ_HANDLED; +} + +static void sfctemp_power_up(struct sfctemp *sfctemp) +{ + /* make sure we're powered down first */ + writel(SFCTEMP_PD, sfctemp->regs); + udelay(1); + + writel(0, sfctemp->regs); + /* wait t_pu(50us) + t_rst(100ns) */ + usleep_range(60, 200); + + /* de-assert reset */ + writel(SFCTEMP_RSTN, sfctemp->regs); + udelay(1); /* wait t_su(500ps) */ +} + +static void sfctemp_power_down(struct sfctemp *sfctemp) +{ + writel(SFCTEMP_PD, sfctemp->regs); +} + +static void sfctemp_run_single(struct sfctemp *sfctemp) +{ + writel(SFCTEMP_RSTN | SFCTEMP_RUN, sfctemp->regs); + udelay(1); + writel(SFCTEMP_RSTN, sfctemp->regs); +} + +static int sfctemp_enable(struct sfctemp *sfctemp) +{ + int ret = 0; + + mutex_lock(&sfctemp->lock); + if (sfctemp->enabled) + goto done; + + ret = clk_prepare_enable(sfctemp->clk_bus); + if (ret) + goto err; + ret = reset_control_deassert(sfctemp->rst_bus); + if (ret) + goto err_disable_bus; + + ret = clk_prepare_enable(sfctemp->clk_sense); + if (ret) + goto err_assert_bus; + ret = reset_control_deassert(sfctemp->rst_sense); + if (ret) + goto err_disable_sense; + + sfctemp_power_up(sfctemp); + sfctemp->enabled = true; +done: + mutex_unlock(&sfctemp->lock); + return ret; + +err_disable_sense: + clk_disable_unprepare(sfctemp->clk_sense); +err_assert_bus: + reset_control_assert(sfctemp->rst_bus); +err_disable_bus: + clk_disable_unprepare(sfctemp->clk_bus); +err: + mutex_unlock(&sfctemp->lock); + return ret; +} + +static int sfctemp_disable(struct sfctemp *sfctemp) +{ + mutex_lock(&sfctemp->lock); + if (!sfctemp->enabled) + goto done; + + sfctemp_power_down(sfctemp); + reset_control_assert(sfctemp->rst_sense); + clk_disable_unprepare(sfctemp->clk_sense); + reset_control_assert(sfctemp->rst_bus); + clk_disable_unprepare(sfctemp->clk_bus); + sfctemp->enabled = false; +done: + mutex_unlock(&sfctemp->lock); + return 0; +} + +static void sfctemp_disable_action(void *data) +{ + sfctemp_disable(data); +} + +static int sfctemp_convert(struct sfctemp *sfctemp, long *val) +{ + int ret; + + mutex_lock(&sfctemp->lock); + if (!sfctemp->enabled) { + ret = -ENODATA; + goto out; + } + + sfctemp_run_single(sfctemp); + + ret = wait_for_completion_interruptible_timeout(&sfctemp->conversion_done, + msecs_to_jiffies(10)); + if (ret <= 0) { + if (ret == 0) + ret = -ETIMEDOUT; + goto out; + } + + /* calculate temperature in milli Celcius */ + *val = (long)((readl(sfctemp->regs) & SFCTEMP_DOUT_MSK) >> SFCTEMP_DOUT_POS) + * SFCTEMP_Y1000 / SFCTEMP_Z - SFCTEMP_K1000; + + ret = 0; +out: + mutex_unlock(&sfctemp->lock); + return ret; +} + +static umode_t sfctemp_is_visible(const void *data, enum hwmon_sensor_types type, + u32 attr, int channel) +{ + switch (type) { + case hwmon_temp: + switch (attr) { + case hwmon_temp_enable: + return 0644; + case hwmon_temp_input: + return 0444; + } + return 0; + default: + return 0; + } +} + +static int sfctemp_read(struct device *dev, enum hwmon_sensor_types type, + u32 attr, int channel, long *val) +{ + struct sfctemp *sfctemp = dev_get_drvdata(dev); + + switch (type) { + case hwmon_temp: + switch (attr) { + case hwmon_temp_enable: + *val = sfctemp->enabled; + return 0; + case hwmon_temp_input: + return sfctemp_convert(sfctemp, val); + } + return -EINVAL; + default: + return -EINVAL; + } +} + +static int sfctemp_write(struct device *dev, enum hwmon_sensor_types type, + u32 attr, int channel, long val) +{ + struct sfctemp *sfctemp = dev_get_drvdata(dev); + + switch (type) { + case hwmon_temp: + switch (attr) { + case hwmon_temp_enable: + if (val == 0) + return sfctemp_disable(sfctemp); + if (val == 1) + return sfctemp_enable(sfctemp); + break; + } + return -EINVAL; + default: + return -EINVAL; + } +} + +static const struct hwmon_channel_info *sfctemp_info[] = { + HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ), + HWMON_CHANNEL_INFO(temp, HWMON_T_ENABLE | HWMON_T_INPUT), + NULL +}; + +static const struct hwmon_ops sfctemp_hwmon_ops = { + .is_visible = sfctemp_is_visible, + .read = sfctemp_read, + .write = sfctemp_write, +}; + +static const struct hwmon_chip_info sfctemp_chip_info = { + .ops = &sfctemp_hwmon_ops, + .info = sfctemp_info, +}; + +static int sfctemp_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device *hwmon_dev; + struct sfctemp *sfctemp; + int ret; + + sfctemp = devm_kzalloc(dev, sizeof(*sfctemp), GFP_KERNEL); + if (!sfctemp) + return -ENOMEM; + + dev_set_drvdata(dev, sfctemp); + mutex_init(&sfctemp->lock); + init_completion(&sfctemp->conversion_done); + + sfctemp->regs = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(sfctemp->regs)) + return PTR_ERR(sfctemp->regs); + + sfctemp->clk_sense = devm_clk_get(dev, "sense"); + if (IS_ERR(sfctemp->clk_sense)) + return dev_err_probe(dev, PTR_ERR(sfctemp->clk_sense), + "error getting sense clock\n"); + + sfctemp->clk_bus = devm_clk_get(dev, "bus"); + if (IS_ERR(sfctemp->clk_bus)) + return dev_err_probe(dev, PTR_ERR(sfctemp->clk_bus), + "error getting bus clock\n"); + + sfctemp->rst_sense = devm_reset_control_get_exclusive(dev, "sense"); + if (IS_ERR(sfctemp->rst_sense)) + return dev_err_probe(dev, PTR_ERR(sfctemp->rst_sense), + "error getting sense reset\n"); + + sfctemp->rst_bus = devm_reset_control_get_exclusive(dev, "bus"); + if (IS_ERR(sfctemp->rst_bus)) + return dev_err_probe(dev, PTR_ERR(sfctemp->rst_bus), + "error getting busreset\n"); + + ret = reset_control_assert(sfctemp->rst_sense); + if (ret) + return dev_err_probe(dev, ret, "error asserting sense reset\n"); + + ret = reset_control_assert(sfctemp->rst_bus); + if (ret) + return dev_err_probe(dev, ret, "error asserting bus reset\n"); + + ret = platform_get_irq(pdev, 0); + if (ret < 0) + return ret; + + ret = devm_request_irq(dev, ret, sfctemp_isr, 0, pdev->name, sfctemp); + if (ret) + return dev_err_probe(dev, ret, "error requesting irq\n"); + + ret = devm_add_action(dev, sfctemp_disable_action, sfctemp); + if (ret) + return ret; + + ret = sfctemp_enable(sfctemp); + if (ret) + return dev_err_probe(dev, ret, "error enabling temperature sensor: %d\n", ret); + + hwmon_dev = devm_hwmon_device_register_with_info(dev, pdev->name, sfctemp, + &sfctemp_chip_info, NULL); + return PTR_ERR_OR_ZERO(hwmon_dev); +} + +static const struct of_device_id sfctemp_of_match[] = { + { .compatible = "starfive,jh7100-temp" }, + { .compatible = "starfive,jh7110-temp" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, sfctemp_of_match); + +static struct platform_driver sfctemp_driver = { + .probe = sfctemp_probe, + .driver = { + .name = "sfctemp", + .of_match_table = sfctemp_of_match, + }, +}; +module_platform_driver(sfctemp_driver); + +MODULE_AUTHOR("Emil Renner Berthing"); +MODULE_DESCRIPTION("StarFive JH71x0 temperature sensor driver"); +MODULE_LICENSE("GPL"); From patchwork Tue Jan 3 01:31:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Feng X-Patchwork-Id: 38233 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4387255wrt; Mon, 2 Jan 2023 17:32:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXstyvDclVKBn2/ET/0l7Ytm+OET6No2YW4Lj52j0fc+1EoW+josihaRaZPboWcL1KGHsfXP X-Received: by 2002:a17:906:39d8:b0:7c1:2075:199a with SMTP id i24-20020a17090639d800b007c12075199amr33477125eje.76.1672709566400; Mon, 02 Jan 2023 17:32:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672709566; cv=none; d=google.com; s=arc-20160816; b=Oy3h1oU8VK0rkLiasa7Vg79ZI9FaYp9JN47EjohWNhFviJuKs+lh2YuExwAVJmK2IH eN0B8PSiLMj1K1zAeLxM/EPz3bJQ/DICgfxhkkw7TXr09ISjjGSdGPuM0Qk1EPmlp2MC kzfiTmvmhol/0LQpCBdeunlOHydCFltLea4n1YbRA/UxuNEUuNIK9CN9Agtbk5QciSjM zBJNdWklE4QHmyLXq3d2DnTNgEhqERfEuk2Fk6VTGjPj/yjYBzVbttjUBxNKZzOKh/wA +s7Ge/BSysRMu4dZyCeoGH/QlOlq3Bt7+A2JJAmJnF/HepufVo81BYYKEx2oXaq7sztQ MGyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lT1anIGa/t7uUAxNlX8/I3FJLoUW1pwQJns04AUdGiU=; b=fYSqjovGDt4InK56Ouv1P465l9k7FGEh7ApeXFDi2+ygc1Sg2tVCX83D7QJLMJlVdP Otmo1/xz6xPjJlf5C1ObuvY8gnDEG/mW/ppLkbxVxPobFOoyBVvS58cQ3bOXuW8up186 +Dzo5AvVdZg3SI5kgLUCWgtibhEdexRz/8grPrJr7Zyg9iLwoiHO6WkMDdU7Fs8yo+Qt ApV6HwAkSyp6UdXsHFeX/JSoj/FhHJ9VgTUhoBD6PjDLr4AItU6717NB/dCgAFgJjUAG x4i8kSUOTH0KHl9rRU2SWK13d9RNzpY5clCz2NCBCleTHzY3QS1kx0vg5+IFH7l1x3c+ Q/0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w23-20020a056402071700b00489df3c748csi10349078edx.154.2023.01.02.17.32.22; Mon, 02 Jan 2023 17:32:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236509AbjACBcE convert rfc822-to-8bit (ORCPT + 99 others); Mon, 2 Jan 2023 20:32:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232706AbjACBbz (ORCPT ); Mon, 2 Jan 2023 20:31:55 -0500 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 554DDD44; Mon, 2 Jan 2023 17:31:53 -0800 (PST) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id DDBE324E035; Tue, 3 Jan 2023 09:31:51 +0800 (CST) Received: from EXMBX172.cuchost.com (172.16.6.92) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 3 Jan 2023 09:31:51 +0800 Received: from ubuntu.localdomain (113.72.146.202) by EXMBX172.cuchost.com (172.16.6.92) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 3 Jan 2023 09:31:51 +0800 From: Hal Feng To: , , , CC: Jean Delvare , Guenter Roeck , Jonathan Corbet , Conor Dooley , "Paul Walmsley" , Palmer Dabbelt , Albert Ou , Rob Herring , Krzysztof Kozlowski , Emil Renner Berthing , Hal Feng , Subject: [PATCH v1 3/4] riscv: dts: starfive: jh7110: Add temperature sensor node Date: Tue, 3 Jan 2023 09:31:44 +0800 Message-ID: <20230103013145.9570-4-hal.feng@starfivetech.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230103013145.9570-1-hal.feng@starfivetech.com> References: <20230103013145.9570-1-hal.feng@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [113.72.146.202] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX172.cuchost.com (172.16.6.92) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753963106238492193?= X-GMAIL-MSGID: =?utf-8?q?1753963106238492193?= From: Emil Renner Berthing Add temperature sensor support for StarFive JH7110 SoC. Signed-off-by: Emil Renner Berthing Signed-off-by: Hal Feng --- arch/riscv/boot/dts/starfive/jh7110.dtsi | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/riscv/boot/dts/starfive/jh7110.dtsi b/arch/riscv/boot/dts/starfive/jh7110.dtsi index 64d260ea1f29..793ae26bf72d 100644 --- a/arch/riscv/boot/dts/starfive/jh7110.dtsi +++ b/arch/riscv/boot/dts/starfive/jh7110.dtsi @@ -353,6 +353,19 @@ uart5: serial@12020000 { status = "disabled"; }; + sfctemp: tmon@120e0000 { + compatible = "starfive,jh7110-temp"; + reg = <0x0 0x120e0000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_TEMP_CORE>, + <&syscrg JH7110_SYSCLK_TEMP_APB>; + clock-names = "sense", "bus"; + resets = <&syscrg JH7110_SYSRST_TEMP_CORE>, + <&syscrg JH7110_SYSRST_TEMP_APB>; + reset-names = "sense", "bus"; + interrupts = <81>; + #thermal-sensor-cells = <0>; + }; + syscrg: clock-controller@13020000 { compatible = "starfive,jh7110-syscrg"; reg = <0x0 0x13020000 0x0 0x10000>; From patchwork Tue Jan 3 01:31:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Feng X-Patchwork-Id: 38232 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4387228wrt; Mon, 2 Jan 2023 17:32:42 -0800 (PST) X-Google-Smtp-Source: AMrXdXujAvD/4RIMXiAE7MwLtLTNre2weI0kqXXZ0GsBpxkctRwWIwwGzjdkXedls4Rv2zbr3VXj X-Received: by 2002:a05:6a20:4904:b0:9d:efbf:8156 with SMTP id ft4-20020a056a20490400b0009defbf8156mr60656596pzb.31.1672709561921; Mon, 02 Jan 2023 17:32:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672709561; cv=none; d=google.com; s=arc-20160816; b=AQeFUVyU0wTk42MuFUmWJwNcBpE7zgu8Z/PjoaFH8GGLhxPso21dCrSVap1qMdO2q9 VGcZj/XgGZe8ut//Q6O1Ry04g0UZ8dbcoRWAUI9iCrlhFU7K3K2HYnjVwXl3B0WBAo5P SuPAF7NpubS20ozEQ9zZbjjzGECq8TsmAXBPpIrqW1GEKkD/x2NL3r0QyDhm8BaX2CoD E2tjnYUOq3dO+HQvsrN5PUwZ/A6jyXmjXj3V6nbDZCUT1uhIBWkERAzauFO5DPbUZAEJ PcyHE70bPSB95c5exAlpcAyjI8r3PqIiJ+S16dPybY2RTmBmHHp/2cPUy4wJGujY55c0 Gueg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=fNbwRVdKaA+XI4w7/ga6Qk9jS2SWAnISnIM1FPcgqTg=; b=nx9linMkZ1eWuy3JeM7W9tMEnpVqMjNzXIzHfGRvDQttMPQLztmWgurVxICSQa/5Q/ Qlm/w4LRL3dWLHHafDvDx0McSYHAald/u1hfGZWboYwBkanxo2Yp4Akt6M2x6bmCJ2/z lvAxTkE1m72iYJXknSV3vBJSe1B4PZy2fkzIFiB8vB0YyRyAQh3qpRa6sjmlz5r21ogz fo4MC2I3UsMg21xljwx1+j4v8ExVkPMPjmI37ipOonxAH3gZhFeY/VgG1aROOfyvOJm/ g4VAIqoRg5G8f26iwrc6ZFWDjOxNU4AMZ5rNCo4RQOrZSFh2qzf/p8xWkpA0LGpFl8VS kcNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k69-20020a638448000000b00479433ac8aasi30323575pgd.260.2023.01.02.17.32.29; Mon, 02 Jan 2023 17:32:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236534AbjACBcH convert rfc822-to-8bit (ORCPT + 99 others); Mon, 2 Jan 2023 20:32:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233178AbjACBb4 (ORCPT ); Mon, 2 Jan 2023 20:31:56 -0500 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 222ABDA7; Mon, 2 Jan 2023 17:31:55 -0800 (PST) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id A7F8824E137; Tue, 3 Jan 2023 09:31:52 +0800 (CST) Received: from EXMBX172.cuchost.com (172.16.6.92) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 3 Jan 2023 09:31:52 +0800 Received: from ubuntu.localdomain (113.72.146.202) by EXMBX172.cuchost.com (172.16.6.92) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 3 Jan 2023 09:31:52 +0800 From: Hal Feng To: , , , CC: Jean Delvare , Guenter Roeck , Jonathan Corbet , Conor Dooley , "Paul Walmsley" , Palmer Dabbelt , Albert Ou , Rob Herring , Krzysztof Kozlowski , Emil Renner Berthing , Hal Feng , Subject: [PATCH v1 4/4] riscv: dts: starfive: visionfive-2: Add thermal-zones Date: Tue, 3 Jan 2023 09:31:45 +0800 Message-ID: <20230103013145.9570-5-hal.feng@starfivetech.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230103013145.9570-1-hal.feng@starfivetech.com> References: <20230103013145.9570-1-hal.feng@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [113.72.146.202] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX172.cuchost.com (172.16.6.92) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753963101568937687?= X-GMAIL-MSGID: =?utf-8?q?1753963101568937687?= From: Emil Renner Berthing Add thermal-zones for StarFive VisionFive 2 board. Signed-off-by: Emil Renner Berthing Signed-off-by: Hal Feng --- .../jh7110-starfive-visionfive-2.dtsi | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi index c60280b89c73..c7c7735f021d 100644 --- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi @@ -27,6 +27,34 @@ memory@40000000 { reg = <0x0 0x40000000 0x1 0x0>; }; + thermal-zones { + cpu-thermal { + polling-delay-passive = <250>; + polling-delay = <15000>; + + thermal-sensors = <&sfctemp>; + + cooling-maps { + }; + + trips { + cpu_alert0: cpu_alert0 { + /* milliCelsius */ + temperature = <75000>; + hysteresis = <2000>; + type = "passive"; + }; + + cpu_crit: cpu_crit { + /* milliCelsius */ + temperature = <90000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + }; + gpio-restart { compatible = "gpio-restart"; gpios = <&gpio 35 GPIO_ACTIVE_HIGH>;