From patchwork Wed Mar 31 20:16:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1460702 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=Oiq5B3mi; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F9czq6ZT7z9sRf for ; Thu, 1 Apr 2021 07:17:11 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 498C182786; Wed, 31 Mar 2021 22:16:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.b="Oiq5B3mi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8F484828E6; Wed, 31 Mar 2021 22:16:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B772E81FBA for ; Wed, 31 Mar 2021 22:16:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=igor.opaniuk@foundries.io Received: by mail-lj1-x234.google.com with SMTP id s17so25375972ljc.5 for ; Wed, 31 Mar 2021 13:16:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VZuUD3mp+5hJaVkqbjkbiKYtp/TZ9NXPqx5FEKgHYcY=; b=Oiq5B3miXriA0TbM5LtdhzAK/HiupW+YfIkretZKS0ECQDtl/UJeLpid8H9esT2Oou k6LU6TrAWG6qwG7djLMOBEpvxP14raw1Tv9z1W/dH9W44qzFYHirxkqZsXCoxILBYpGa gVMfSxI7fF3Qvo/byV7YhvuOkzqMF4Sj3hfPt9MgCuzoECIyHVi0tEDVFrJxDImq7F32 Rt6tNb2Mxw+PH4ZtzT7cbGJgPpOHMr9Wxi4wkM6qgBcYzitWNVdL3D4B7i0nlrpl46Nw FkHooYHaVOtS+KmXTPjFkH7SKGcDN+xlk2g1mVw2Zal6820Mg4jXYD/qzWG4DF3S6MzI z+jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VZuUD3mp+5hJaVkqbjkbiKYtp/TZ9NXPqx5FEKgHYcY=; b=CQqR+2BLV12OaLFwTWyfjAXq14nVLy9P4f+fbf7JkKDZT0n82dbRpw4rwZ6dhWax10 vh7S04KKYUD6IBR709fmxvquohubuQE5x91VdXvTQELcLLSrDuw6dKBLrZ2RJCN+8kZS wMlt5obpW+YnIaaxgIxcQYlQ/aXab3eFBGN7wOlhBENo/dJl0f2r39+sIgqB0B1kkla8 Zos3dB17XZe3c8YPYz2FjGbzampufwu0YAqw+ZsVbkrYRL7G2p2Te/h3ROjZAUdg7PsY uYXK9vTvWJ7k/LLndTjBDHd4m0+a2mNrO6VSdSbosqi04F9AmxdeoDTpf36Osk1f5uHl iw1g== X-Gm-Message-State: AOAM533XLvhhrgmF8TlwaDoJU663cAClUtBVS+wQ10Q5rzUeqjuL2s38 mRqE9bo6h8yaWiOge+Q6Ir651U8wjE6sKwUO X-Google-Smtp-Source: ABdhPJx89EnfN6cEvcUgOSXOEqxF3RjSdpKGTA7rhXjJu0y1xKZNumow7PEahnteYDp2Y35607yyvg== X-Received: by 2002:a2e:8159:: with SMTP id t25mr3239674ljg.84.1617221806992; Wed, 31 Mar 2021 13:16:46 -0700 (PDT) Received: from localhost ([109.108.76.111]) by smtp.gmail.com with ESMTPSA id c3sm358810ljh.27.2021.03.31.13.16.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Mar 2021 13:16:46 -0700 (PDT) From: Igor Opaniuk X-Google-Original-From: Igor Opaniuk To: u-boot@lists.denx.de Cc: jorge@foundries.io, patrick.delaunay@foss.st.com, daiane.angolini@foundries.io, vanessa.maegima@foundries.io, ricardo@foundries.io, xypron.glpk@gmx.de, mike@foundries.io, tim.anderson@foundries.io, Igor Opaniuk , Jon Hunter , Masahiro Yamada , Michal Simek , Simon Glass , Yann Gautier Subject: [PATCH v3 1/4] psci: add features/reset2 support Date: Wed, 31 Mar 2021 23:16:38 +0300 Message-Id: <20210331201641.1422171-2-igor.opaniuk@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210331201641.1422171-1-igor.opaniuk@gmail.com> References: <20210331201641.1422171-1-igor.opaniuk@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean From: Igor Opaniuk Adds support for: * PSCI_FEATURES, which was introduced in PSCI 1.0. This provides API that allows discovering whether a specific PSCI function is implemented and its features. * SYSTEM_RESET2, which was introduced in PSCI 1.1, which extends existing SYSTEM_RESET. It provides support for vendor-specific resets, providing reset_type as an additional param. For additional details visit [1]. Implementations of some functions were borrowed from Linux PSCI driver code [2]. [1] https://developer.arm.com/documentation/den0022/latest/ [2] drivers/firmware/psci/psci.c Signed-off-by: Igor Opaniuk --- drivers/firmware/psci.c | 68 +++++++++++++++++++++++++++++++++++++++++ include/linux/psci.h | 3 ++ 2 files changed, 71 insertions(+) diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index 68953cc4f4..be57552aba 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -26,6 +27,18 @@ #define PSCI_METHOD_HVC 1 #define PSCI_METHOD_SMC 2 +/* + * While a 64-bit OS can make calls with SMC32 calling conventions, for some + * calls it is necessary to use SMC64 to pass or return 64-bit values. + * For such calls PSCI_FN_NATIVE(version, name) will choose the appropriate + * (native-width) function ID. + */ +#if defined(CONFIG_ARM64) +#define PSCI_FN_NATIVE(version, name) PSCI_##version##_FN64_##name +#else +#define PSCI_FN_NATIVE(version, name) PSCI_##version##_FN_##name +#endif + #if CONFIG_IS_ENABLED(EFI_LOADER) int __efi_runtime_data psci_method; #else @@ -53,6 +66,34 @@ unsigned long __efi_runtime invoke_psci_fn return res.a0; } +static int psci_features(u32 psci_func_id) +{ + return invoke_psci_fn(PSCI_1_0_FN_PSCI_FEATURES, + psci_func_id, 0, 0); +} + +static u32 psci_0_2_get_version(void) +{ + return invoke_psci_fn(PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0); +} + +static bool psci_is_system_reset2_supported(void) +{ + int ret; + u32 ver; + + ver = psci_0_2_get_version(); + + if (PSCI_VERSION_MAJOR(ver) >= 1) { + ret = psci_features(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2)); + + if (ret != PSCI_RET_NOT_SUPPORTED) + return true; + } + + return false; +} + static int psci_bind(struct udevice *dev) { /* No SYSTEM_RESET support for PSCI 0.1 */ @@ -141,6 +182,33 @@ void reset_misc(void) } #endif /* CONFIG_PSCI_RESET */ +void psci_sys_reset(u32 type) +{ + bool reset2_supported; + + do_psci_probe(); + + reset2_supported = psci_is_system_reset2_supported(); + + if (type == SYSRESET_WARM && reset2_supported) { + /* + * reset_type[31] = 0 (architectural) + * reset_type[30:0] = 0 (SYSTEM_WARM_RESET) + * cookie = 0 (ignored by the implementation) + */ + invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), 0, 0, 0); + } else { + invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0); + } +} + +void psci_sys_poweroff(void) +{ + do_psci_probe(); + + invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0); +} + #ifdef CONFIG_CMD_POWEROFF int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { diff --git a/include/linux/psci.h b/include/linux/psci.h index 38edde3137..c78c1079a8 100644 --- a/include/linux/psci.h +++ b/include/linux/psci.h @@ -118,6 +118,9 @@ #ifdef CONFIG_ARM_PSCI_FW unsigned long invoke_psci_fn(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3); +void psci_sys_reset(u32 type); +void psci_sys_poweroff(void); + #else static inline unsigned long invoke_psci_fn(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3) From patchwork Wed Mar 31 20:16:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1460706 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=fp2MaVhp; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F9d0G59SYz9sRf for ; Thu, 1 Apr 2021 07:17:34 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C309082917; Wed, 31 Mar 2021 22:17:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.b="fp2MaVhp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CFE80828EE; Wed, 31 Mar 2021 22:16:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0BAB282786 for ; Wed, 31 Mar 2021 22:16:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=igor.opaniuk@foundries.io Received: by mail-lf1-x12e.google.com with SMTP id b14so30923030lfv.8 for ; Wed, 31 Mar 2021 13:16:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iLoo5aYfVx2Oynit8HtAFdcuqHwi4BRVM84mjFgj40w=; b=fp2MaVhpd+TCet2y5NgBED8Tq2olFAZLonENDCwFxifgWzj94K9JwDA3YlefUQYaWg KXmo/RPCb7O6PD903n3PBgZ0Eq+XUb6tyFUzaz2C2KeCSCT8ZIRq0b4gGDd4zD4vYORG D5en/Ex2wPkXKtKDMNxaQPp1EUW8qVtg+miIbHT5M07/fAbpr8mQENCLvYEZdHaoCmjG 8lA61DA0errgSrXJCTXVX40UegK/jckfbwlW8eah7tpCMo5O3j+av2PJMTZ68LQxIdC8 DFWzIaTGV51bnRCkW+o8EBuGg1MHYTNznXfkKJdrDe6K2qDVUoo9q6KB5+GSCLxzFa6t SLHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iLoo5aYfVx2Oynit8HtAFdcuqHwi4BRVM84mjFgj40w=; b=R6iqnJXjFPWI2b+qDCNSQvf9DA64MR5+ce8jgn686TXymxQuv0gT2EGuvetF3xkk+a NPs0a14R8T4nHmof7RTKqruS5kHqWx+9Rnnli3ksFxUOZbSRMRmyy3925C11s0wDfrrZ WdfVkXIfLBZEPb6m7y6P7XC1dwjR8PspJffIbmY4ZGSx3/AqVClVPV0YalWLkTdurbEP epGCooTP0WSteYSbbT+Xd+DgjdQNiQaTJL+rgwsrlePKyM6dS9sy+IuIVGbTaCWJvmUm q9VbIrplXJ3TtfZQowqg7wAXzJkG3mzpV7qg/0hB/5y8uBXUrl4jKkP78VJQ5inc2h1H 7sjA== X-Gm-Message-State: AOAM532zgdUtHkXpF20pjzrOaTaTzBUrhGyKJ4Ky2eAsodgAVqxTkbpm Q7ZsD/Vu89+6lwOxw+sq71oTfTDQZWiaOOnK X-Google-Smtp-Source: ABdhPJyeIl+7ON4rMe/45JIk8mhhKSki4uNDhIE8x7cPQosqCaxYfquNPmGaokvTyv+mIBgOxwnjJA== X-Received: by 2002:a05:6512:3698:: with SMTP id d24mr3004383lfs.217.1617221808363; Wed, 31 Mar 2021 13:16:48 -0700 (PDT) Received: from localhost ([109.108.76.111]) by smtp.gmail.com with ESMTPSA id r1sm352760ljn.71.2021.03.31.13.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Mar 2021 13:16:47 -0700 (PDT) From: Igor Opaniuk X-Google-Original-From: Igor Opaniuk To: u-boot@lists.denx.de Cc: jorge@foundries.io, patrick.delaunay@foss.st.com, daiane.angolini@foundries.io, vanessa.maegima@foundries.io, ricardo@foundries.io, xypron.glpk@gmx.de, mike@foundries.io, tim.anderson@foundries.io, Igor Opaniuk Subject: [PATCH v3 2/4] sysreset: psci: use psci driver exported functions Date: Wed, 31 Mar 2021 23:16:39 +0300 Message-Id: <20210331201641.1422171-3-igor.opaniuk@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210331201641.1422171-1-igor.opaniuk@gmail.com> References: <20210331201641.1422171-1-igor.opaniuk@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean From: Igor Opaniuk Use psci driver exported functions for reset/poweroff, instead of invoking directly invoke_psci_fn. Signed-off-by: Igor Opaniuk --- drivers/sysreset/sysreset_psci.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/sysreset/sysreset_psci.c b/drivers/sysreset/sysreset_psci.c index c7907b3226..83ecbcb9d2 100644 --- a/drivers/sysreset/sysreset_psci.c +++ b/drivers/sysreset/sysreset_psci.c @@ -11,22 +11,18 @@ static int psci_sysreset_request(struct udevice *dev, enum sysreset_t type) { - unsigned long function_id; - switch (type) { case SYSRESET_WARM: case SYSRESET_COLD: - function_id = PSCI_0_2_FN_SYSTEM_RESET; + psci_sys_reset(type); break; case SYSRESET_POWER_OFF: - function_id = PSCI_0_2_FN_SYSTEM_OFF; + psci_sys_poweroff(); break; default: return -ENOSYS; } - invoke_psci_fn(function_id, 0, 0, 0); - return -EINPROGRESS; } From patchwork Wed Mar 31 20:16:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1460703 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=OyKDkdjA; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F9d032KKKz9sRf for ; Thu, 1 Apr 2021 07:17:23 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2C5C082900; Wed, 31 Mar 2021 22:17:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.b="OyKDkdjA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 715CE828A4; Wed, 31 Mar 2021 22:16:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 77756828A4 for ; Wed, 31 Mar 2021 22:16:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=igor.opaniuk@foundries.io Received: by mail-lj1-x232.google.com with SMTP id u10so25384574lju.7 for ; Wed, 31 Mar 2021 13:16:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=A+zTVYtrqMU3tGEdAWgJ6NWcI6UmlZR3d2orcQu2W/A=; b=OyKDkdjA6r7wEIdxWgDfOBqi6vwvOBtoiIksaBJjzb38Js/uveY2s+xiaNdx3Z3qK1 TcD/1V3GiUgcBmLDthYwYQFKIMd+SLxTxAGmT7IlpOawEzgW/hiRMFmXdr9V894ZAUL8 5n5kegogtEwfBzGIDEEUoVbff/tzOGHq0K53kpLMrKEuih+fRpSFUtIMi2Cld0mY9GMv 3Qud7l2CGrIFui2oeG2WxXs/yvJBD8e6X86gt38vMl+T1krgfYLaoiuUaVO5CMLH07kO dW5+Wxle1JCi50WUX62crl6Nwy/sV8Di1IK6R4Fdy24aO+ZKNu8qej8ZlwsTD250t0Lv cv+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A+zTVYtrqMU3tGEdAWgJ6NWcI6UmlZR3d2orcQu2W/A=; b=RjX8127iuPe7PJNXr9eglUzfG9Wyzmp85T0l/NIROvLRvDuqlF6EB1P4rZGC3SlaQ+ 56dd8LT+e243/CIbimkeV5sul5gWGOzmMkiEXmN9fBDsCrQU7a8DAJ3C+Ix/k2b78xMO e6pnrFYmmgO79ycefgSm/86T9hh/4Cc7QV12/dvux9vVnOdF609I1J9ZrSg9z6OtOwvp xUx3pxW62XecNEDFEp2mfdPVpvL32r3ZAS/uBtTJfqPgOUksQA9BWKBaTOOE7tyWpt5j Rw/JgaWjfklxDTbQI7MqhPZhYwLUKSsVrNos0e2F7jXHmZfvlJ7JHrivdM/273SqNzqn 5xAg== X-Gm-Message-State: AOAM533GvjLcxZRrYRq5UjJ+0vOh+nb2om63JZoV7Vy5w6hZuNXWA2UZ QewLDtFInUqcUkoy9bBaEb+Vor1aW4aFs0li X-Google-Smtp-Source: ABdhPJwiF6vuQ71cO3ckqjtD2yVWQ7a3rg8OgpA4mP6HDh6iX6vWOoEaiNHS+uDegEISxp07ySKnXg== X-Received: by 2002:a2e:958c:: with SMTP id w12mr3183044ljh.117.1617221809583; Wed, 31 Mar 2021 13:16:49 -0700 (PDT) Received: from localhost ([109.108.76.111]) by smtp.gmail.com with ESMTPSA id q26sm359301ljg.90.2021.03.31.13.16.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Mar 2021 13:16:49 -0700 (PDT) From: Igor Opaniuk X-Google-Original-From: Igor Opaniuk To: u-boot@lists.denx.de Cc: jorge@foundries.io, patrick.delaunay@foss.st.com, daiane.angolini@foundries.io, vanessa.maegima@foundries.io, ricardo@foundries.io, xypron.glpk@gmx.de, mike@foundries.io, tim.anderson@foundries.io, Igor Opaniuk , Bin Meng , Priyanka Jain , Simon Glass Subject: [PATCH v3 3/4] sysreset: provide type of reset in do_reset cmd Date: Wed, 31 Mar 2021 23:16:40 +0300 Message-Id: <20210331201641.1422171-4-igor.opaniuk@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210331201641.1422171-1-igor.opaniuk@gmail.com> References: <20210331201641.1422171-1-igor.opaniuk@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean From: Igor Opaniuk Add additional param for reset cmd, which provides type of reset. Signed-off-by: Igor Opaniuk --- cmd/boot.c | 2 +- drivers/sysreset/sysreset-uclass.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cmd/boot.c b/cmd/boot.c index 36aba22b30..b84c0ed89e 100644 --- a/cmd/boot.c +++ b/cmd/boot.c @@ -56,7 +56,7 @@ U_BOOT_CMD( #endif U_BOOT_CMD( - reset, 1, 0, do_reset, + reset, 2, 0, do_reset, "Perform RESET of the CPU", "" ); diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c index 6c9dc7a384..0412c4a29b 100644 --- a/drivers/sysreset/sysreset-uclass.c +++ b/drivers/sysreset/sysreset-uclass.c @@ -122,10 +122,19 @@ void reset_cpu(ulong addr) #if IS_ENABLED(CONFIG_SYSRESET_CMD_RESET) int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + enum sysreset_t reset_type = SYSRESET_COLD; + + if (argc > 2) + return CMD_RET_USAGE; + + if (argc == 2 && argv[1][0] == '-' && argv[1][1] == 'w') { + reset_type = SYSRESET_WARM; + } + printf("resetting ...\n"); mdelay(100); - sysreset_walk_halt(SYSRESET_COLD); + sysreset_walk_halt(reset_type); return 0; } From patchwork Wed Mar 31 20:16:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1460707 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=b9iS++cw; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F9d0T74gdz9sRf for ; Thu, 1 Apr 2021 07:17:45 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7251682927; Wed, 31 Mar 2021 22:17:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.b="b9iS++cw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F179782786; Wed, 31 Mar 2021 22:16:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AB24880462 for ; Wed, 31 Mar 2021 22:16:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=igor.opaniuk@foundries.io Received: by mail-lj1-x230.google.com with SMTP id y1so25326049ljm.10 for ; Wed, 31 Mar 2021 13:16:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zx+14J9P5ZAWkVYYArLclqNITW4x5YiFW5wv3Rsfn3E=; b=b9iS++cw6n30Vj+iFuXSKggF70FgCuX+mbRMc/hT/Dz5xO85KEjYoRPMA97kvPODyw WLOYbwEzk7VmwIV5m5k21z3bXh6/GjZnI3iQp2GpzkKXn7Hn5cNz513UkXxeMwnzWJsK IR9tJCDT2MtQwJcjFLbUhPP10IhyyVkiZ2HG8DpanBH1zKj6jxd7VRfnlKDcIo/UQKSK XXa6IGSIL2DFZ79UmJLBIg/LdXx5+OwqeSaAnI+HQXw29AgZH3lcY7ICN5AOTNDJMhJ6 yaVW5KBWhaK8BHArD2DKM3RlzpPcAsdgKmI5044CaUqYsGzJ7R6zgjVXlymsGEhfgKOd wjVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zx+14J9P5ZAWkVYYArLclqNITW4x5YiFW5wv3Rsfn3E=; b=Dgxub3KzilVFmc6EvgH3aEBGXazmmdvqqbBlxwgT/hNXOCWTkOd5o6lULAbKXDn0HG Ywf43KuTVJZdUEnUkI3pa4zERadgRG1Q+m6HtJNXmdKvV2eDz5X6Z8eKJY//Yzdz5XgI q3vlNcEgquwqYmmUUKfSfl3mjmoll+gYMDGFagCjQYUmeFQ4gWI1ZDr6aPmuuNDY16v3 97kIb2CaFsd3uX9LJUmvKmdkxfmThQxP1h5wiyA6wJQoegYoxf+Tr0OG5qQ+H+KOsaII 7BGb/B6ERo775iYHEtl5SVgIgj7jQAfX8IsFpHEyFfFOA6hUcQQt0LFgFGcTNk3sE+pE r6dw== X-Gm-Message-State: AOAM532XZXCZ5ZXjO89tQ7BQQsynpXFjGSLgYqKisvnswCiB7LTW3PTC W0qQnVHWm9G+/P1kysuX/Rl6BnIAtYqysaJI X-Google-Smtp-Source: ABdhPJxvJqMUGCv4PhVFp7mZpK/6rJnt3ZkiEgJckwZA+I9beJCKwOZCikBdlIOOqU9fq4EsOCjdLw== X-Received: by 2002:a2e:9cd6:: with SMTP id g22mr3000597ljj.32.1617221810818; Wed, 31 Mar 2021 13:16:50 -0700 (PDT) Received: from localhost ([109.108.76.111]) by smtp.gmail.com with ESMTPSA id y16sm319370lfy.252.2021.03.31.13.16.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Mar 2021 13:16:50 -0700 (PDT) From: Igor Opaniuk X-Google-Original-From: Igor Opaniuk To: u-boot@lists.denx.de Cc: jorge@foundries.io, patrick.delaunay@foss.st.com, daiane.angolini@foundries.io, vanessa.maegima@foundries.io, ricardo@foundries.io, xypron.glpk@gmx.de, mike@foundries.io, tim.anderson@foundries.io, Igor Opaniuk , Simon Glass Subject: [PATCH v3 4/4] doc: usage: add usage details for reset cmd Date: Wed, 31 Mar 2021 23:16:41 +0300 Message-Id: <20210331201641.1422171-5-igor.opaniuk@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210331201641.1422171-1-igor.opaniuk@gmail.com> References: <20210331201641.1422171-1-igor.opaniuk@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean From: Igor Opaniuk Add usage details for reset command. Signed-off-by: Igor Opaniuk --- doc/usage/index.rst | 1 + doc/usage/reset.rst | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 doc/usage/reset.rst diff --git a/doc/usage/index.rst b/doc/usage/index.rst index 6c59bbadab..b1181011ae 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -34,3 +34,4 @@ Shell commands qfw sbi true + reset diff --git a/doc/usage/reset.rst b/doc/usage/reset.rst new file mode 100644 index 0000000000..f8cf3579c8 --- /dev/null +++ b/doc/usage/reset.rst @@ -0,0 +1,26 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +reset command +============ + +Synopsis +-------- + +:: + + reset [-w] + +Description +----------- + +Perform reset of the CPU. By default does COLD reset, which resets CPU, +DDR and peripherals, on some boards also resets external PMIC. + +-w + Do warm WARM, reset CPU but keep peripheral/DDR/PMIC active. + + +Return value +------------ + +The return value $? is always set to 0 (true).