From patchwork Sun Apr 24 06:49:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Beniamino Galvani X-Patchwork-Id: 614118 X-Patchwork-Delegate: promsoft@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3qt0Nq45Q4z9t3t for ; Sun, 24 Apr 2016 16:50:35 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=rXD325GZ; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 45333A768D; Sun, 24 Apr 2016 08:50:32 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ciO96Fv5KEUy; Sun, 24 Apr 2016 08:50:31 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 80075A75CA; Sun, 24 Apr 2016 08:50:25 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 38E38A74DB for ; Sun, 24 Apr 2016 08:50:21 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AJReQSEyk3Ep for ; Sun, 24 Apr 2016 08:50:21 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by theia.denx.de (Postfix) with ESMTPS id 14728A748F for ; Sun, 24 Apr 2016 08:50:17 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id r12so14134070wme.0 for ; Sat, 23 Apr 2016 23:50:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sa6xM2fOgoUYzB7lEnZF8Q+P0UCcSwe7wjPkcDJzTuE=; b=rXD325GZV+vLd4v9Jd9lUhP2z0KWI/Suk6jH6Y9Fv4m2iboUCsFgxbWQ/0DzbVTFnj LDBsokEvy26NFlGMyAUPdowBspGuYetd3YiIbZZ7+RlqiF2BNLSa7NgNze3u4Frr7TV7 IjEZoBHRzZWVyjIiOeU/2cNieYI0WWYjrVWiDAQfIhSqxG+Rp6chJisYNcDOmd5wVPh9 AvYWfMlG7GTLDQn472pQXS7qUiFH77ftkXkarWYBAYYyTnUszO6GAnvWcBJp/pSVd28K LtPGJTNuDDGLwOvGRZJt1UpchsYoYPTM46CQaZIh2kwNuyOi3bXKZ1T4WwRePhRTBVZ1 O3Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sa6xM2fOgoUYzB7lEnZF8Q+P0UCcSwe7wjPkcDJzTuE=; b=cXCZylHl3SALl/uiY5WxfSDdKnxjEGBL0p1n5eokc+H3ZrF5x6ktxza4upLYepa4n5 qkh4TpfeTUa3RrCdOiX2ggLsaaYmRU/9j0bI0DMvLS7RXyoyECQ9noc8SJAqMZg6ttFR L2qmCqsTAe+x6aunIDGcoz/FBsYlDzqZefg9yML6wnuuOZCIoQLV5LilQEfrRpJ+61hW wydOliHGdA1QeiolxGNMvzcQmdf175gYmeINiXEwKMjQHLQYL/zyb8/Na6zLE5IHgLtv PkOHzVXyAWaf2uE0bU0F8XL8GHr9dc4G88fbf101FiAFx+766MxHvL7QRWcG0kVmvTXI Y/AA== X-Gm-Message-State: AOPr4FUqNf7WdKa5QPjQtbRo+os7LxkXyqKNo+CJFdAkE60MMuPhH6zfZgpbCgGpRsOp9A== X-Received: by 10.194.186.242 with SMTP id fn18mr30072647wjc.65.1461480617276; Sat, 23 Apr 2016 23:50:17 -0700 (PDT) Received: from shire.fritz.box (host240-93-dynamic.21-79-r.retail.telecomitalia.it. [79.21.93.240]) by smtp.gmail.com with ESMTPSA id 188sm12090868wmk.6.2016.04.23.23.50.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Apr 2016 23:50:16 -0700 (PDT) From: Beniamino Galvani To: u-boot@lists.denx.de Date: Sun, 24 Apr 2016 08:49:59 +0200 Message-Id: <1461480602-2932-2-git-send-email-b.galvani@gmail.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1461480602-2932-1-git-send-email-b.galvani@gmail.com> References: <1461480602-2932-1-git-send-email-b.galvani@gmail.com> Cc: Marek Vasut , Tom Rini , linux-meson@googlegroups.com, Joe Hershberger , Carlo Caione Subject: [U-Boot] [PATCH v5 1/4] arm: implement generic PSCI reset call for armv8 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add a psci_system_reset() which calls the SYSTEM_RESET function of PSCI 0.2 and can be used by boards that support it to implement reset_cpu(). Signed-off-by: Beniamino Galvani --- arch/arm/cpu/armv8/fwcall.c | 16 ++++++++++++++++ arch/arm/include/asm/psci.h | 17 ++++++++++++++++- arch/arm/include/asm/system.h | 2 ++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/arch/arm/cpu/armv8/fwcall.c b/arch/arm/cpu/armv8/fwcall.c index 9efcc5a..079e250 100644 --- a/arch/arm/cpu/armv8/fwcall.c +++ b/arch/arm/cpu/armv8/fwcall.c @@ -8,6 +8,7 @@ #include #include #include +#include #include /* @@ -73,3 +74,18 @@ void smc_call(struct pt_regs *args) "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17"); } + +void __noreturn psci_system_reset(bool conduit_smc) +{ + struct pt_regs regs; + + regs.regs[0] = ARM_PSCI_0_2_FN_SYSTEM_RESET; + + if (conduit_smc) + smc_call(®s); + else + hvc_call(®s); + + while (1) + ; +} diff --git a/arch/arm/include/asm/psci.h b/arch/arm/include/asm/psci.h index 128a606..3704f07 100644 --- a/arch/arm/include/asm/psci.h +++ b/arch/arm/include/asm/psci.h @@ -18,7 +18,7 @@ #ifndef __ARM_PSCI_H__ #define __ARM_PSCI_H__ -/* PSCI interface */ +/* PSCI 0.1 interface */ #define ARM_PSCI_FN_BASE 0x95c1ba5e #define ARM_PSCI_FN(n) (ARM_PSCI_FN_BASE + (n)) @@ -32,6 +32,21 @@ #define ARM_PSCI_RET_INVAL (-2) #define ARM_PSCI_RET_DENIED (-3) +/* PSCI 0.2 interface */ +#define ARM_PSCI_0_2_FN_BASE 0x84000000 +#define ARM_PSCI_0_2_FN(n) (ARM_PSCI_0_2_FN_BASE + (n)) + +#define ARM_PSCI_0_2_FN_PSCI_VERSION ARM_PSCI_0_2_FN(0) +#define ARM_PSCI_0_2_FN_CPU_SUSPEND ARM_PSCI_0_2_FN(1) +#define ARM_PSCI_0_2_FN_CPU_OFF ARM_PSCI_0_2_FN(2) +#define ARM_PSCI_0_2_FN_CPU_ON ARM_PSCI_0_2_FN(3) +#define ARM_PSCI_0_2_FN_AFFINITY_INFO ARM_PSCI_0_2_FN(4) +#define ARM_PSCI_0_2_FN_MIGRATE ARM_PSCI_0_2_FN(5) +#define ARM_PSCI_0_2_FN_MIGRATE_INFO_TYPE ARM_PSCI_0_2_FN(6) +#define ARM_PSCI_0_2_FN_MIGRATE_INFO_UP_CPU ARM_PSCI_0_2_FN(7) +#define ARM_PSCI_0_2_FN_SYSTEM_OFF ARM_PSCI_0_2_FN(8) +#define ARM_PSCI_0_2_FN_SYSTEM_RESET ARM_PSCI_0_2_FN(9) + #ifndef __ASSEMBLY__ int psci_update_dt(void *fdt); void psci_board_init(void); diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h index 9ae890a..2bdc0be 100644 --- a/arch/arm/include/asm/system.h +++ b/arch/arm/include/asm/system.h @@ -128,6 +128,8 @@ void hvc_call(struct pt_regs *args); */ void smc_call(struct pt_regs *args); +void __noreturn psci_system_reset(bool smc); + #endif /* __ASSEMBLY__ */ #else /* CONFIG_ARM64 */