From patchwork Mon Dec 26 11:45:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 636933 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03544C4708D for ; Mon, 26 Dec 2022 11:58:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231738AbiLZL6I (ORCPT ); Mon, 26 Dec 2022 06:58:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229686AbiLZL6G (ORCPT ); Mon, 26 Dec 2022 06:58:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E2C16179; Mon, 26 Dec 2022 03:58:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3AA24B80C75; Mon, 26 Dec 2022 11:58:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 895F8C433EF; Mon, 26 Dec 2022 11:58:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672055882; bh=BCmdieMBicJXuI4/ZzBxG2C09Q8TUmVSKdBVNnqsWpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=te4U/bKJZYL4EQq81SVivnn5sAAcIlPZSoc8sgbMclBd6VwxkgzF/U449dFkQGQy+ c6fLeqQ1NzSM2BW0L3AD0BhSaV+h7beqCBfjXtXDjzGCVfYh9IW/nXXSDdy4sax1yy QXyXhpZXX+KeyY93fGKGpgtWJveehZdNgZ+BNKJY3Ki/CUQLyw9UuddKrLtXZtoBrx N56P9F1qyQuPWFyvmRhTXjmakqk4bB5mpKoEe3SlQTofARTV4vzWfSElvPWRPBnLld KKCHDiVjimTxpRFN7nVBYDzwoaa4GcNpHAP4vKns7souAh0XrUWjJEiJixhyIAMUMq +EyBEB9UvCr5Q== Received: by pali.im (Postfix) id A794D77D; Mon, 26 Dec 2022 12:57:59 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: "Krzysztof Kozlowski" , Rob Herring , Sebastian Reichel Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/3] dt-bindings: reset: syscon-reboot: Add priority property Date: Mon, 26 Dec 2022 12:45:11 +0100 Message-Id: <20221226114513.4569-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220820102925.29476-1-pali@kernel.org> References: <20220820102925.29476-1-pali@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This new optional priority property allows to specify custom priority level of reset device. Prior this change priority level was hardcoded to 192 and not possible to specify or change. Specifying other value is needed for some boards. Default level when not specified stays at 192 as before. Signed-off-by: Pali Rohár --- Changes in v4: * Use restart-handler.yaml Changes in v3: * Add explanation into commit message Changes in v2: * Change sint32 to int32 * Add default --- .../devicetree/bindings/power/reset/syscon-reboot.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml b/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml index da2509724812..f721bdf63a98 100644 --- a/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml +++ b/Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml @@ -19,6 +19,9 @@ description: |+ sub-node of a "syscon", "simple-mfd" node. Though the regmap property pointing to the system controller node is also supported. +allOf: + - $ref: restart-handler.yaml# + properties: compatible: const: syscon-reboot @@ -42,6 +45,9 @@ properties: $ref: /schemas/types.yaml#/definitions/uint32 description: The reset value written to the reboot register (32 bit access). + priority: + default: 192 + required: - compatible - offset From patchwork Mon Dec 26 11:45:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 637216 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F91AC3DA79 for ; Mon, 26 Dec 2022 11:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229960AbiLZL6H (ORCPT ); Mon, 26 Dec 2022 06:58:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229569AbiLZL6G (ORCPT ); Mon, 26 Dec 2022 06:58:06 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B09BB25FA; Mon, 26 Dec 2022 03:58:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 33DE860DCA; Mon, 26 Dec 2022 11:58:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74F43C433D2; Mon, 26 Dec 2022 11:58:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672055883; bh=WsFP+jr/JWJOetQbqvy3jJUBEs3QY1vpJJXVmKgr98I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SPhgl4RU6jthJy/x7ww039oDqdqKN2VeORoJT+D/++dRBWv4P3w6x7wouwjnsKp6B OcfUt/rj9Hu8mibqX7r7P8dQmIcJkZ4i3wn5WbWkjIHM6chaqaE2CH1//Jbjm87v/G pm/P3p0dqKffg0opH6s1j1L/trMGJhdxz2t5D78UtMuC62EzK/dJbawzb8OOFY+H+y cgssy/zyOaevyXsnf9M/NrFqY6vYt5IQGCdMp8tUQjQOoO9mqW++jJL1hvw2PAxyg4 yRjoN5mX50CIhTaTDGYOxQ/o6eQZBO2W+qBd05+I08G4/k1+YRv6dY8YLPn1e/Dm2v nW6WG29jFUuxw== Received: by pali.im (Postfix) id AC3709D7; Mon, 26 Dec 2022 12:58:00 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: "Krzysztof Kozlowski" , Rob Herring , Sebastian Reichel Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/3] power: reset: syscon-reboot: Add support for specifying priority Date: Mon, 26 Dec 2022 12:45:12 +0100 Message-Id: <20221226114513.4569-2-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221226114513.4569-1-pali@kernel.org> References: <20220820102925.29476-1-pali@kernel.org> <20221226114513.4569-1-pali@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Read new optional device tree property priority for specifying priority level of reset handler. Default value is 192 as before. Signed-off-by: Pali Rohár --- drivers/power/reset/syscon-reboot.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/power/reset/syscon-reboot.c b/drivers/power/reset/syscon-reboot.c index 510e363381ca..45e34e6885f7 100644 --- a/drivers/power/reset/syscon-reboot.c +++ b/drivers/power/reset/syscon-reboot.c @@ -44,6 +44,7 @@ static int syscon_reboot_probe(struct platform_device *pdev) struct syscon_reboot_context *ctx; struct device *dev = &pdev->dev; int mask_err, value_err; + int priority; int err; ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); @@ -57,6 +58,9 @@ static int syscon_reboot_probe(struct platform_device *pdev) return PTR_ERR(ctx->map); } + if (of_property_read_s32(pdev->dev.of_node, "priority", &priority)) + priority = 192; + if (of_property_read_u32(pdev->dev.of_node, "offset", &ctx->offset)) return -EINVAL; @@ -77,7 +81,7 @@ static int syscon_reboot_probe(struct platform_device *pdev) } ctx->restart_handler.notifier_call = syscon_restart_handle; - ctx->restart_handler.priority = 192; + ctx->restart_handler.priority = priority; err = register_restart_handler(&ctx->restart_handler); if (err) dev_err(dev, "can't register restart notifier (err=%d)\n", err); From patchwork Mon Dec 26 11:45:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 637215 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6597C46467 for ; Mon, 26 Dec 2022 11:58:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231979AbiLZL6R (ORCPT ); Mon, 26 Dec 2022 06:58:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231883AbiLZL6N (ORCPT ); Mon, 26 Dec 2022 06:58:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39DA26305; Mon, 26 Dec 2022 03:58:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D21F5B80D18; Mon, 26 Dec 2022 11:58:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53192C433D2; Mon, 26 Dec 2022 11:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672055889; bh=wSULAFQ9o5Qp1ccx8+zFcSC7eqa2jblW+biQlW4dd/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qQZGATooaviZFEzyHo6BhgpTzbgiQvZ3C+MdkxcjwL86SBfGoTwvj709nXOGCuQOZ PrWV/ykpvtM+Pvf9xI4MiyoYs2ChMDqNvO4cW6NNV8yhEkwfSppjiVBj/kEaE81st5 8XLNa+GSNckqD38g2ALoU0XBYAUSYXIyHOoCkp5ritRa6vG8iBg7ycGvuH53cQBnNl 0IbVpB2NEeC5+27UuzP8hPRfQQs7QfvKgXNFo4RbekuFnUVeS1/27c0k+qhPp3LmZh GhJAlsvmLNuovjJMWK0LAGNmYr3BuK0eUkwHbQfBnhiY1IOvjz7MJt0xcbSwDyUZbt zYD/nAkxvbl7g== Received: by pali.im (Postfix) id CE4AA77D; Mon, 26 Dec 2022 12:58:06 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: "Krzysztof Kozlowski" , Rob Herring , Sebastian Reichel Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Ellerman , linuxppc-dev@lists.ozlabs.org Subject: [PATCH v4 3/3] powerpc: dts: turris1x.dts: Set lower priority for CPLD syscon-reboot Date: Mon, 26 Dec 2022 12:45:13 +0100 Message-Id: <20221226114513.4569-3-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221226114513.4569-1-pali@kernel.org> References: <20220820102925.29476-1-pali@kernel.org> <20221226114513.4569-1-pali@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Due to CPLD firmware bugs, set CPLD syscon-reboot priority level to 64 (between rstcr and watchdog) to ensure that rstcr's global-utilities reset method which is preferred stay as default one, and to ensure that CPLD syscon-reboot is more preferred than watchdog reset method. Fixes: 0531a4abd1c6 ("powerpc: dts: turris1x.dts: Add CPLD reboot node") Signed-off-by: Pali Rohár --- arch/powerpc/boot/dts/turris1x.dts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/arch/powerpc/boot/dts/turris1x.dts b/arch/powerpc/boot/dts/turris1x.dts index e9cda34a140e..c9b619f6ed5c 100644 --- a/arch/powerpc/boot/dts/turris1x.dts +++ b/arch/powerpc/boot/dts/turris1x.dts @@ -367,11 +367,34 @@ }; reboot@d { + /* + * CPLD firmware which manages system reset and + * watchdog registers has bugs. It does not + * autoclear system reset register after change + * and watchdog ignores reset line on immediate + * succeeding reset cycle triggered by watchdog. + * These bugs have to be workarounded in U-Boot + * bootloader. So use system reset via syscon as + * a last resort because older U-Boot versions + * do not have workaround for watchdog. + * + * Reset method via rstcr's global-utilities + * (the preferred one) has priority level 128, + * watchdog has priority level 0 and default + * syscon-reboot priority level is 192. + * + * So define syscon-reboot with custom priority + * level 64 (between rstcr and watchdog) because + * rstcr should stay as default preferred reset + * method and reset via watchdog is more broken + * than system reset via syscon. + */ compatible = "syscon-reboot"; reg = <0x0d 0x01>; offset = <0x0d>; mask = <0x01>; value = <0x01>; + priority = <64>; }; led-controller@13 {