From patchwork Thu Apr 28 22:10:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Beniamino Galvani X-Patchwork-Id: 616488 X-Patchwork-Delegate: trini@ti.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 3qwrd82ffgz9t7n for ; Fri, 29 Apr 2016 08:11:08 +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=Meu9axsK; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 14D1FA7673; Fri, 29 Apr 2016 00:11:06 +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 XJUr0JYxbRlj; Fri, 29 Apr 2016 00:11:05 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9E3BEA7690; Fri, 29 Apr 2016 00:10:59 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 31747A75CB for ; Fri, 29 Apr 2016 00:10:55 +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 xXWM5gLld2xM for ; Fri, 29 Apr 2016 00:10:55 +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-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by theia.denx.de (Postfix) with ESMTPS id 02C7EA75CA for ; Fri, 29 Apr 2016 00:10:51 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id r12so1122515wme.0 for ; Thu, 28 Apr 2016 15:10:51 -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=Meu9axsKnbUvRJGRhIYPjZFV+3D/AxUBpy1JYUeZG69WAu7A4tfB+tk/CIIAI1UYPN ME0wKlGt5wA7WTHX2IPCXpYvLPtxT7wdfeDZRpHGLWekfZdov3Ow8Lis7YGsyZqYLj7B s9MXUN63PAX+H0yMesdY8lHKlRfubLpSBFcFpLPRqnPbMgOsy54DAQl7UvQgPfX/sgR8 oC8wIQY9Kkpbo3EJHbUFFSX3iWm1VSPm/lnnUB2VbmVc6kaztioO3MKNzKe5nDrI6uQ6 Hb7AU2B2K/hlQn7ud/7Wt/t6M8SUDO1jsnk+ocI/3YDBePRM8rv6CHNm8GiRAfNkQ5nr aurg== 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=GE6TPZUuUsWhHqPEw1R1idrm0sNQJcZfyHa+H6zdUmmz2TvLae0XdCjDBw2gsw0JW9 qC+VXWkc48w95d9B/Tmxgiuc2rAchczr+D+4RQqM9N1dObikyL5OMZN+ygbvWvo3hie5 4zCT4DxvIJUjdrVcvyFpZcNKMcuzAt7g4YXcQHp3Ngb/Z5f7l4GPR+ruDna5F4olbMMM Uaq2Qz+fdrfgnIvEdQwqxEoij9bwGSPwv4pbrbLw87EIZScdv3+WDoe62BfSX2F8hnFi J5amESW32i5Bc803HEv5jwtq5KzYO5Uzn2YoATSCUQNGMUWhfCUn3eUi/7JfjoQONCcG 0Nqg== X-Gm-Message-State: AOPr4FUZH5fu1uiQMoK4NPrbtP8Se7kQ1ansfwRwGEGBVEPopglw6M64Zd+2hUKkSsKjew== X-Received: by 10.28.236.88 with SMTP id k85mr207226wmh.53.1461881451188; Thu, 28 Apr 2016 15:10:51 -0700 (PDT) Received: from shire.fritz.box ([2a01:2000:2001:94a4:92fb:a6ff:feae:db41]) by smtp.gmail.com with ESMTPSA id yr1sm11709055wjc.9.2016.04.28.15.10.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Apr 2016 15:10:50 -0700 (PDT) From: Beniamino Galvani To: u-boot@lists.denx.de Date: Fri, 29 Apr 2016 00:10:20 +0200 Message-Id: <1461881423-12373-2-git-send-email-b.galvani@gmail.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1461881423-12373-1-git-send-email-b.galvani@gmail.com> References: <1461881423-12373-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 v6 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 */