From patchwork Tue Mar 30 19:17:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1460228 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=Ut4xO2VE; 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 4F8zjs3Q72z9sVq for ; Wed, 31 Mar 2021 06:17:53 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 340288295A; Tue, 30 Mar 2021 21:17:41 +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="Ut4xO2VE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A121D82956; Tue, 30 Mar 2021 21:17:35 +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,UPPERCASE_50_75 autolearn=no autolearn_force=no version=3.4.2 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) (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 E02C482952 for ; Tue, 30 Mar 2021 21:17:32 +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-x12c.google.com with SMTP id b4so25422579lfi.6 for ; Tue, 30 Mar 2021 12:17:32 -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=eDmNGR8l48uqqQIOud4GGqMfVh64gM50CSV4bqw2CEw=; b=Ut4xO2VEzWvGiesWW9YeMt+e2bRtgNkDd6/gtAuRmlFBlbvWz+PAG8iMJZK2Pi36du DqL2hE43EgLFsiZTJQMs6xG547ZN9ksrFQJNCgY+JB4LyHbhTx6+czmMexZn82Fk9fCz vQUvgbXNbwltwqrFSk0lqhZVvXx8k69/3epQANE05GjOzpXmD1BXlj+OSpA95WZsVwTA QIUeF1cje0GvH4OSQxVBdqu347AjrzYp0ric6D8dA/+6SRxBUuJsprh6MEub+AWVmUMt rcouiefe9m3hWlxo39haHI9Hq0rch2oOl3YVmt8uiz+rcMLDl8OQLr6aMLdONCaJ11/g kNmg== 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=eDmNGR8l48uqqQIOud4GGqMfVh64gM50CSV4bqw2CEw=; b=tRXh2piYyi6ycZE1Duc8CKU4Bz/JTcROxUk2uU9BOVHlF4aVXpvHE0kae5OpqxHqB+ YlCtrsAWl8Vw978ZzxYs7K9EBmNUbdHJmT9SGs4mecf5HCWh9VtI7iTGOUNyADypnkF3 w3f+QBAhcK6rVRH2EdHAo5yfsS4c5UROJHeavzRFFRdbITsoSaFe5X46TfUi/aySGfve SuWnRAEkGVxprhxUPby7dTK43a1T4eOndBWR8J/KtrMIGkk/OTt3s6YwdTDfXWCnXxJy TQxCAbOMECu67UvFNICQtD6DaV7zD6LSnVdw7FoY9n9rEYNYtpAYEqLEkURbCna2nZfq Vkxg== X-Gm-Message-State: AOAM532bTKlKbV2KyY9iTsVcedUPohmW/Qj5ZS/NZIYo/HhFZZGq7C1p LqK+fNsmNhvl4tw2zGBsZKFWHYlDnSAC6Xu8 X-Google-Smtp-Source: ABdhPJzDln7q69f1IbI4Iqkhv/uVN8FBtexmKrL7zlBICI+0WyuALT4dPKWUdMVe+kzEcUWL11Jr/g== X-Received: by 2002:a19:5213:: with SMTP id m19mr20433739lfb.203.1617131852102; Tue, 30 Mar 2021 12:17:32 -0700 (PDT) Received: from localhost ([109.108.76.111]) by smtp.gmail.com with ESMTPSA id m6sm2363992lfb.150.2021.03.30.12.17.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Mar 2021 12:17:31 -0700 (PDT) From: Igor Opaniuk X-Google-Original-From: Igor Opaniuk To: u-boot@lists.denx.de Cc: tim.anderson@foundries.io, mike@foundries.io, jorge@foundries.io, daiane.angolini@foundries.io, ricardo@foundries.io, vanessa.maegima@foundries.io, Igor Opaniuk , Masahiro Yamada Subject: [RFC PATCH v1 1/3] psci: add v1.0/v1.1 definitions from Linux Date: Tue, 30 Mar 2021 22:17:20 +0300 Message-Id: <20210330191722.1126160-2-igor.opaniuk@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210330191722.1126160-1-igor.opaniuk@gmail.com> References: <20210330191722.1126160-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 Sync and add PSCI API versions 1.0/1.1 definitions from Linux. Signed-off-by: Igor Opaniuk --- include/linux/psci.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/include/linux/psci.h b/include/linux/psci.h index 841dbc8da7..38edde3137 100644 --- a/include/linux/psci.h +++ b/include/linux/psci.h @@ -46,6 +46,14 @@ #define PSCI_0_2_FN64_MIGRATE PSCI_0_2_FN64(5) #define PSCI_0_2_FN64_MIGRATE_INFO_UP_CPU PSCI_0_2_FN64(7) +#define PSCI_1_0_FN_PSCI_FEATURES PSCI_0_2_FN(10) +#define PSCI_1_0_FN_SYSTEM_SUSPEND PSCI_0_2_FN(14) +#define PSCI_1_0_FN_SET_SUSPEND_MODE PSCI_0_2_FN(15) +#define PSCI_1_1_FN_SYSTEM_RESET2 PSCI_0_2_FN(18) + +#define PSCI_1_0_FN64_SYSTEM_SUSPEND PSCI_0_2_FN64(14) +#define PSCI_1_1_FN64_SYSTEM_RESET2 PSCI_0_2_FN64(18) + /* PSCI v0.2 power state encoding for CPU_SUSPEND function */ #define PSCI_0_2_POWER_STATE_ID_MASK 0xffff #define PSCI_0_2_POWER_STATE_ID_SHIFT 0 @@ -56,6 +64,13 @@ #define PSCI_0_2_POWER_STATE_AFFL_MASK \ (0x3 << PSCI_0_2_POWER_STATE_AFFL_SHIFT) +/* PSCI extended power state encoding for CPU_SUSPEND function */ +#define PSCI_1_0_EXT_POWER_STATE_ID_MASK 0xfffffff +#define PSCI_1_0_EXT_POWER_STATE_ID_SHIFT 0 +#define PSCI_1_0_EXT_POWER_STATE_TYPE_SHIFT 30 +#define PSCI_1_0_EXT_POWER_STATE_TYPE_MASK \ + (0x1 << PSCI_1_0_EXT_POWER_STATE_TYPE_SHIFT) + /* PSCI v0.2 affinity level state returned by AFFINITY_INFO */ #define PSCI_0_2_AFFINITY_LEVEL_ON 0 #define PSCI_0_2_AFFINITY_LEVEL_OFF 1 @@ -75,6 +90,18 @@ (((ver) & PSCI_VERSION_MAJOR_MASK) >> PSCI_VERSION_MAJOR_SHIFT) #define PSCI_VERSION_MINOR(ver) \ ((ver) & PSCI_VERSION_MINOR_MASK) +#define PSCI_VERSION(maj, min) \ + ((((maj) << PSCI_VERSION_MAJOR_SHIFT) & PSCI_VERSION_MAJOR_MASK) | \ + ((min) & PSCI_VERSION_MINOR_MASK)) + +/* PSCI features decoding (>=1.0) */ +#define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT 1 +#define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK \ + (0x1 << PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT) + +#define PSCI_1_0_OS_INITIATED BIT(0) +#define PSCI_1_0_SUSPEND_MODE_PC 0 +#define PSCI_1_0_SUSPEND_MODE_OSI 1 /* PSCI return values (inclusive of all PSCI versions) */ #define PSCI_RET_SUCCESS 0 @@ -86,6 +113,7 @@ #define PSCI_RET_INTERNAL_FAILURE -6 #define PSCI_RET_NOT_PRESENT -7 #define PSCI_RET_DISABLED -8 +#define PSCI_RET_INVALID_ADDRESS -9 #ifdef CONFIG_ARM_PSCI_FW unsigned long invoke_psci_fn(unsigned long a0, unsigned long a1, From patchwork Tue Mar 30 19:17:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1460229 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=h15Pvo1+; 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 4F8zk36ltcz9sVq for ; Wed, 31 Mar 2021 06:18:03 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EFF1D8297E; Tue, 30 Mar 2021 21:17:42 +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="h15Pvo1+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2327382967; Tue, 30 Mar 2021 21:17:38 +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-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) (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 C76DF82958 for ; Tue, 30 Mar 2021 21:17:34 +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-x235.google.com with SMTP id u10so21151307lju.7 for ; Tue, 30 Mar 2021 12:17:34 -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=pbjYkrlwutLi8mOzvf2lRLS4J2UoK8/DiCHGcO916Eo=; b=h15Pvo1+xH/B4eUW6k4x+B13wTJvEjl65DbXshJOnnKQ7U22z1ABjFPuwe2yMPswzF gDQs47NFm3xe9Izw2CYL6JApMtt4ZL9ZSjMKU/KUacokqwFLiX2f8dUMnzpepnLX3GRz PNcbVtrGViwe9CkL2uidm50X4Th4JbyxKEXSTebGpfxM5lPPpG92d6VTmcob20RAQ6qg +bd/51cGGYOMl6bP+Y5wCVClgvqfuPCXCoXSAXPIT/KuFlHOf4IMBTfBvqsYEliq1wub RRIbBieF4MQfVjjA5EIh+67FjbRR0rShVJWD+VbTIMmw8TTswQ/rwNfbWlN9LS0N3bNK PQ4w== 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=pbjYkrlwutLi8mOzvf2lRLS4J2UoK8/DiCHGcO916Eo=; b=ZUrxvI79CoLC6NXpVOKQ3nwtHLM8AZTDswkAryuZFYxd3xRmUbGy0wJSo++ZFszfbw 0viLk4xe1Yt4ydKsFtcwD6yF4AfjGRTDlql9FW99DbDaNytKBP+ErC6jI9UnfDu/kO6r K/r1aBJZsqDBwjnN7wSwVCQ8nfsdS2ymEB+/wC2FY3ocWCKUstLu/N8uz6vD8oDDp+V/ ikqmjIEiE3NQ22Fw5RWhaeBkIc6cyuCmVNJXzkidESaBKmo6PUaJF/44otnH70ZZGWs+ 7qHDhuSC7H9zmJOW5UacEIbOqmdqdt1gfTUpP7s5XuFybKuBcETRgItE+mn2jNSeoTW+ GMnw== X-Gm-Message-State: AOAM532kP5GLgiNWybA71Wbr6DQMFaQFwimiuQMWmvi751Z7HTyIWQIm nllATvZaveaXYnlSlBbleovmveQGv3WlwkAh X-Google-Smtp-Source: ABdhPJzeIMO//5xrW7su6LPBXXxQxCuBpuRYIEmth8SeTIMyHR7eXp/jQzehVCsMDmyuEdtSk0BULw== X-Received: by 2002:a2e:9b47:: with SMTP id o7mr22269284ljj.66.1617131853729; Tue, 30 Mar 2021 12:17:33 -0700 (PDT) Received: from localhost ([109.108.76.111]) by smtp.gmail.com with ESMTPSA id w13sm2903042ljw.2.2021.03.30.12.17.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Mar 2021 12:17:33 -0700 (PDT) From: Igor Opaniuk X-Google-Original-From: Igor Opaniuk To: u-boot@lists.denx.de Cc: tim.anderson@foundries.io, mike@foundries.io, jorge@foundries.io, daiane.angolini@foundries.io, ricardo@foundries.io, vanessa.maegima@foundries.io, Igor Opaniuk , Jon Hunter , Masahiro Yamada , Michal Simek , Patrick Delaunay , Simon Glass , Yann Gautier Subject: [RFC PATCH v1 2/3] psci: add features/reset2 support Date: Tue, 30 Mar 2021 22:17:21 +0300 Message-Id: <20210330191722.1126160-3-igor.opaniuk@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210330191722.1126160-1-igor.opaniuk@gmail.com> References: <20210330191722.1126160-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] master/drivers/firmware/psci/psci.c Signed-off-by: Igor Opaniuk --- drivers/firmware/psci.c | 70 +++++++++++++++++++++++++++++++++++++++++ include/linux/psci.h | 3 ++ 2 files changed, 73 insertions(+) diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index 68953cc4f4..8416cd445f 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -26,12 +27,26 @@ #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 int psci_method __attribute__ ((section(".data"))); #endif +static bool reset2_supported; + unsigned long __efi_runtime invoke_psci_fn (unsigned long function_id, unsigned long arg0, unsigned long arg1, unsigned long arg2) @@ -53,6 +68,27 @@ 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 void psci_init_system_reset2(void) +{ + int ret; + + ret = psci_features(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2)); + + if (ret != PSCI_RET_NOT_SUPPORTED) + reset2_supported = true; +} + static int psci_bind(struct udevice *dev) { /* No SYSTEM_RESET support for PSCI 0.1 */ @@ -73,6 +109,7 @@ static int psci_bind(struct udevice *dev) static int psci_probe(struct udevice *dev) { const char *method; + u32 ver; #if defined(CONFIG_ARM64) if (current_el() == 3) @@ -94,6 +131,16 @@ static int psci_probe(struct udevice *dev) return -EINVAL; } + ver = psci_0_2_get_version(); + + pr_debug("PSCIv%d.%d detected in firmware.\n", + PSCI_VERSION_MAJOR(ver), + PSCI_VERSION_MINOR(ver)); + + if (PSCI_VERSION_MAJOR(ver) >= 1) { + psci_init_system_reset2(); + } + return 0; } @@ -141,6 +188,29 @@ void reset_misc(void) } #endif /* CONFIG_PSCI_RESET */ +void psci_sys_reset(u32 type) +{ + do_psci_probe(); + + 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 Tue Mar 30 19:17:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1460230 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=O+lpZumN; 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 4F8zkR5yGfz9sW0 for ; Wed, 31 Mar 2021 06:18:23 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5F5098298A; Tue, 30 Mar 2021 21:17:44 +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="O+lpZumN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AD51682967; Tue, 30 Mar 2021 21:17:38 +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-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) (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 2234F8294C for ; Tue, 30 Mar 2021 21:17:36 +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-x22e.google.com with SMTP id u4so21164116ljo.6 for ; Tue, 30 Mar 2021 12:17:36 -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=YPslFetLybrWkR9e0rsbaXo6raTPc/wLY/q+erZi4i4=; b=O+lpZumNDav/qxI6BGNIEgUa0D+w3fWfsq3j89sXm/HBDmaV9mqGr2ol21C9ynwOIJ vjv3cRtgUgpPiiC4rmA+Kf2SooMgV9XDNG1Hfd72APDl1SXhLclRfH4guUwSrZvUJ+xu kG+q2+PUmzd2vx4pL0/uwDM8lWe82CjRjooP6FSo2nRnYaYIZ4bpPF+GxKjQ4UW5wKgJ s/iwKqhGTgsGMVR4lhW93e8Fucdtubc7pEQOtGFcM/obbYr1ZegQT6Qe32uTpP1oRpXZ HaoIdB/kbYp5RQjOyNYhJh830zpd6RiC/TrcIP9eKMe3FNtfSZhgQpvLB4mU6lmeNx/K 5Enw== 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=YPslFetLybrWkR9e0rsbaXo6raTPc/wLY/q+erZi4i4=; b=pHN+ia5oBxIkdvMQvS/Eemwq5o7oy9zPsByNEb+PxHvZ9Zr2y9BSs/PUjzgsNU5FNm yTZ6wg5MhWdWAcFTYIVgmZnFjv1IfQ0TvOdEbfYuYFl5GfaCxo3vhmmbkCKm1IY59HgG wCBe2h+ra5NgmxU6D5bM5XFiXO3bcW8J+BMFMbauknAvjvNQeKGLb2PBtP0hwI5whxtb W+37m59m/pFgmovo07LPZFaCTLwTUlW6EOz7WUj+Q5N66aJpAsfOg/7luGNz/EN7lRIL B7qTjHqc4ttY89b39Ui1/pribFTQdVJDijFcGIcttOaekS6O7qO83VoOgjJsVj9Yt75N gaWg== X-Gm-Message-State: AOAM533q4lusO6SpmRh1bYuXkzNUqS/wYUG2qhq8DUdqTS1dKAj9ezLf StvOvMfIhqxzq3ruA+7orUhGomsivuZZfV5l X-Google-Smtp-Source: ABdhPJyEQASsD7RGPW1nXLeyNrZV3I1LFMtSCvbLnqVy7P0v/GnmgtbIHNMoDAKTiLZ5nnJdC9jWDw== X-Received: by 2002:a2e:2c13:: with SMTP id s19mr21803623ljs.56.1617131855314; Tue, 30 Mar 2021 12:17:35 -0700 (PDT) Received: from localhost ([109.108.76.111]) by smtp.gmail.com with ESMTPSA id y23sm2895003ljm.53.2021.03.30.12.17.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Mar 2021 12:17:34 -0700 (PDT) From: Igor Opaniuk X-Google-Original-From: Igor Opaniuk To: u-boot@lists.denx.de Cc: tim.anderson@foundries.io, mike@foundries.io, jorge@foundries.io, daiane.angolini@foundries.io, ricardo@foundries.io, vanessa.maegima@foundries.io, Igor Opaniuk Subject: [RFC PATCH v1 3/3] sysreset: psci: use psci driver exported functions Date: Tue, 30 Mar 2021 22:17:22 +0300 Message-Id: <20210330191722.1126160-4-igor.opaniuk@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210330191722.1126160-1-igor.opaniuk@gmail.com> References: <20210330191722.1126160-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; }