From patchwork Sun May 8 06:30:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Beniamino Galvani X-Patchwork-Id: 619626 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 3r2bHl6fJ8z9sdg for ; Sun, 8 May 2016 16:30:58 +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=rsNmG+ff; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4C5B8A752D; Sun, 8 May 2016 08:30:53 +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 Go9ZSZXZcmTY; Sun, 8 May 2016 08:30:53 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 57E1AA74D6; Sun, 8 May 2016 08:30:52 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3DAD1A75D6 for ; Sun, 8 May 2016 08:30:45 +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 S0vRbixinQFw for ; Sun, 8 May 2016 08:30:44 +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 15C66A752D for ; Sun, 8 May 2016 08:30:40 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id w143so15428613wmw.3 for ; Sat, 07 May 2016 23:30:40 -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=rsNmG+ffjxZRokicsJy+ro+6Cg0ATwfRIRTVc8IxICD7dNoZav8l0FwX2bpVmm4zM2 sLtLpNkyj/vF5Hvb3BdMUDe4OzrZirtHS2iI6ormL+mU1dROc0jPPps5eDJIbNlmmR5U Ok6qWEEiuXx/V7eqhhTVfCiAZzMk/P70Tu9Mnndp3p0T1+Z+hN8lnZdo8cVp7YwTqDsb rfzRuZwXNKKRVpCo6QscqiI2haYJV0pardraJN8YZzCT1NEJhnKdPJvx0fsEVcgOUZo4 n5Nqjg77vteQQT/TZAiP0Ho3EzlG3IVLqGW9mrX6rgtA52nBtm9tK7is1aR9Ugz+KpxW 01iA== 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=dT31stRYPJMGUha4q1P6YR0Br4sOg/QyMwNB4tpX2WxXfgr0gogbU2CqzUqO7Tr7EF 0AXInl77yBdyElALzpwHfA5cUnIHpGH9jG9VRmh2xgT1NEzVk05V6PFOIFLmXWEBsRIt 07U7Z+h48Jg/Xsq1OPfSw66r/Wdu8ktZwm+qi2WasASXyEy2YnfO/9aYIaPGfERAXcLk M93Ibhz4dryOSWyV4Kr52VihtuYr/FQPVa20lGzagtHqYMdRAptA1p8oN/FxehALVBqN lXVQVlg5Xp3s8f+RpJF9CDKKCEXj5AK3wc5LqJd7UK7ft3t9aLQT/uoADvc2RwJBuKZ4 Octg== X-Gm-Message-State: AOPr4FXyzicm90x4QtHIweaXFc6xQLdbfbhEn7o6jNRsOmekYysxy5XhsjDGZwuCSpyZ7A== X-Received: by 10.194.142.240 with SMTP id rz16mr26879070wjb.126.1462689040284; Sat, 07 May 2016 23:30:40 -0700 (PDT) Received: from shire.fritz.box (host197-92-dynamic.8-87-r.retail.telecomitalia.it. [87.8.92.197]) by smtp.gmail.com with ESMTPSA id jq1sm23814824wjc.28.2016.05.07.23.30.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 May 2016 23:30:39 -0700 (PDT) From: Beniamino Galvani To: u-boot@lists.denx.de Date: Sun, 8 May 2016 08:30:14 +0200 Message-Id: <1462689017-3160-2-git-send-email-b.galvani@gmail.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1462689017-3160-1-git-send-email-b.galvani@gmail.com> References: <1462689017-3160-1-git-send-email-b.galvani@gmail.com> Cc: Marek Vasut , Tom Rini , Joe Hershberger , Carlo Caione , linux-amlogic@lists.infradead.org Subject: [U-Boot] [PATCH v7 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 Reviewed-by: Simon Glass --- 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 */