From patchwork Fri Oct 15 13:19:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Shubin X-Patchwork-Id: 1541666 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=pnsm9jOU; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=maquefel.me header.i=@maquefel.me header.a=rsa-sha256 header.s=mail header.b=nCKIOsaH; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HW6Ln5w2lz9shx for ; Sat, 16 Oct 2021 00:19:45 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BFJB4/ilZiDjoEVHocSKJTE7EffNx4QmnD/EKkxPtoM=; b=pnsm9jOUzbLpPf 9kXWSLKx/UQI90Uue8ZooPo6Q9EZUfi9EVODtFguQ8XC5QFVuRvKRFczRBhi71xoti6Us7ZciIDUL 5BKWOxosiyd1rpYhctc2waGdmUi7+y1m7TokOzwC4SYUrQ82pSMfUvZ8qos/NsuO6zDnd+S3N5QAl 7LmLUY/lES2w24oJYBSSVXG0gHKXAVXh0DnSuufQNho4hPJd84tW9Oyx9oDjxecRUdW+Vm8f4msHp T4koA5pdyrpsz7lnq9OXpL0cl3UnZBADmFRLMYIVuV/puQxepkESNrA1TF7EP9dxlUxOnShO04++W VpE9ft9XlOb+DmUH4kwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbN7c-007B71-A0; Fri, 15 Oct 2021 13:19:40 +0000 Received: from forward501o.mail.yandex.net ([2a02:6b8:0:1a2d::611]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbN7X-007B44-H3 for opensbi@lists.infradead.org; Fri, 15 Oct 2021 13:19:38 +0000 Received: from iva3-d53c26eb10e1.qloud-c.yandex.net (iva3-d53c26eb10e1.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:4987:0:640:d53c:26eb]) by forward501o.mail.yandex.net (Yandex) with ESMTP id CE55645C410B; Fri, 15 Oct 2021 16:19:27 +0300 (MSK) Received: from iva6-2d18925256a6.qloud-c.yandex.net (2a02:6b8:c0c:7594:0:640:2d18:9252 [2a02:6b8:c0c:7594:0:640:2d18:9252]) by iva3-d53c26eb10e1.qloud-c.yandex.net (mxback/Yandex) with ESMTP id cxuNbHWosy-JREe16aW; Fri, 15 Oct 2021 16:19:27 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maquefel.me; s=mail; t=1634303967; bh=9r2kpABH04LFT3Kdz7lSEbQPkaahmO9QiuieYR7PJ5g=; h=In-Reply-To:References:Date:Subject:To:From:Message-Id:Cc; b=nCKIOsaH7XLVkLMJlkYOrav0kQqvC4Qi+XC3oztyZQ0qADZIU9CxpiawwnGooP4JA lUlF6hLXBOTMIbG4CO8RNzu2410bPER7jxmO0Y+43jJOTZ3K+39UzABECAJ0LWJ5aS SpxQIhFgyTyVqTIV1v9FEQk+KYqzXgi+7bGtZsCc= Authentication-Results: iva3-d53c26eb10e1.qloud-c.yandex.net; dkim=pass header.i=@maquefel.me Received: by iva6-2d18925256a6.qloud-c.yandex.net (smtp/Yandex) with ESMTPS id hfsYCHEyeQ-JQ1GvtWQ; Fri, 15 Oct 2021 16:19:26 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Yandex-Fwd: 2 From: Nikita Shubin To: opensbi@lists.infradead.org Cc: linux@yadro.com, anup.patel@wdc.com, Nikita Shubin Subject: [PATCH v2 1/5] lib: utils/reset: add priority to gpio reset Date: Fri, 15 Oct 2021 16:19:21 +0300 Message-Id: <20211015131925.22585-2-nikita.shubin@maquefel.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211015131925.22585-1-nikita.shubin@maquefel.me> References: <20211015131925.22585-1-nikita.shubin@maquefel.me> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211015_061935_984873_FE441DF6 X-CRM114-Status: GOOD ( 11.73 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Nikita Shubin Make gpio_system_reset_check return priority instead of just true/false. Make default 128 priority for reset/shutdown and ability to specify priority in device tree. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -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.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 X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Nikita Shubin Make gpio_system_reset_check return priority instead of just true/false. Make default 128 priority for reset/shutdown and ability to specify priority in device tree. Signed-off-by: Nikita Shubin --- lib/utils/reset/fdt_reset_gpio.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/utils/reset/fdt_reset_gpio.c b/lib/utils/reset/fdt_reset_gpio.c index 4da1450..44b67d8 100644 --- a/lib/utils/reset/fdt_reset_gpio.c +++ b/lib/utils/reset/fdt_reset_gpio.c @@ -23,16 +23,19 @@ struct gpio_reset { struct gpio_pin pin; u32 active_delay; u32 inactive_delay; + u8 priority; }; static struct gpio_reset poweroff = { .active_delay = 100, - .inactive_delay = 100 + .inactive_delay = 100, + .priority = 128 }; static struct gpio_reset restart = { .active_delay = 100, - .inactive_delay = 100 + .inactive_delay = 100, + .priority = 128 }; static struct gpio_reset *gpio_get_reset_settings(u32 type) @@ -59,7 +62,12 @@ static struct gpio_reset *gpio_get_reset_settings(u32 type) static int gpio_system_reset_check(u32 type, u32 reason) { - return !!gpio_get_reset_settings(type); + struct gpio_reset *reset = gpio_get_reset_settings(type); + + if (reset) + return reset->priority; + + return 0; } static void gpio_system_reset(u32 type, u32 reason) @@ -115,6 +123,10 @@ static int gpio_reset_init(void *fdt, int nodeoff, if (len > 0) reset->inactive_delay = fdt32_to_cpu(*val); + val = fdt_getprop(fdt, nodeoff, "priority", &len); + if (len > 0) + reset->priority = fdt32_to_cpu(*val); + sbi_system_reset_add_device(&gpio_reset); return 0;