From patchwork Thu Jun 2 08:07:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: macro.wave.z@gmail.com X-Patchwork-Id: 629101 X-Patchwork-Delegate: yorksun@freescale.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 3rL0G81yrxz9t2p for ; Thu, 2 Jun 2016 18:08:00 +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=dUI6rhZO; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C2F50A74FF; Thu, 2 Jun 2016 10:07: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 K4mMofXWs-Qu; Thu, 2 Jun 2016 10:07:55 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5A07BA755D; Thu, 2 Jun 2016 10:07:55 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DF490A74FB for ; Thu, 2 Jun 2016 10:07:51 +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 7WkV3jc68ZaP for ; Thu, 2 Jun 2016 10:07:51 +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-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) by theia.denx.de (Postfix) with ESMTPS id 44621A7541 for ; Thu, 2 Jun 2016 10:07:44 +0200 (CEST) Received: by mail-pf0-f194.google.com with SMTP id f144so7140911pfa.2 for ; Thu, 02 Jun 2016 01:07:44 -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=fwORcQ9PQqGxN1EPgZ2LfYYYc1ibnsybf+tPQ4y9Z8w=; b=dUI6rhZOKJoL9TUmVJ1r5TuGGoG9QJrfSCDKWsXabIcjVnxr4me9wN0VEVQ4fUkbGf hGVU4U1H4y1A/z2becFNAQtCo665JEyIUPDWGXY7huGFC/CRzXjaJbPjkfkZGdsBuzLT oqcdGQY8p3omUce5hKgAIJIKUuCGIV/wdO/6E5a20+O/S5xYwO01tQ7QAyTZor7l3j47 pkEoc+kOonMER1RdLWOcSy46ZB9EioKvd4zmRCBOZm1kMv690btrE9xWZfGYazdEOJ+I y8vmQC1ZlehP25vACzSAWYKVeCmp6ODQyStAMre0kR9nr1nPJLSP9cGRNLGhJ19ZdkNY WmBw== 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=fwORcQ9PQqGxN1EPgZ2LfYYYc1ibnsybf+tPQ4y9Z8w=; b=DQ9CIY/DLyEO13LaJrorlZLGtahCJEz3z0s+z8aM6+ZSnC2YYATj8HIvpV5tJUWvm+ J7Rt4RyCdDmPdpJG0RWuXe9vsUJYQMw1krWObb33zmFCD1hqZVGWAgAnefOhv7b5gjR9 GmKZNCEpL5i0bibP8dY9OFrQRBiY99KsXY6dnUjPDaCSklQLAuWnqNOIU++78Mx18d6x oR5q+FCCz0kEdEhmgHsFmNvabXtUd9YfZvxxBm7KU1y5baLKBKnfCivbA+A0JGNiR7J6 T0QEBgU4xUnmTuM1syeyNvuCSwgxOOz9TTYtPrUAl7Cm6czUw0A5YWU0RfF2y66EcxYO i9tA== X-Gm-Message-State: ALyK8tJELFmIkjGw7F4EDtmTj7XChZl0z1h/espsv9CrOdopKWDY2oFygrvfYOGLBawbKw== X-Received: by 10.98.149.20 with SMTP id p20mr2065299pfd.95.1464854863188; Thu, 02 Jun 2016 01:07:43 -0700 (PDT) Received: from ubuntu1504.ap.freescale.net (gate-zmy3.freescale.com. [192.88.167.1]) by smtp.gmail.com with ESMTPSA id x186sm19017129pfb.88.2016.06.02.01.07.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Jun 2016 01:07:42 -0700 (PDT) From: macro.wave.z@gmail.com X-Google-Original-From: hongbo.zhang@nxp.com To: u-boot@lists.denx.de, albert.u.boot@aribaud.net, marc.zyngier@arm.com, jan.kiszka@siemens.com, trini@konsulko.com, wens@csie.org, frank.li@freescale.com, peng.fan@freescale.com Date: Thu, 2 Jun 2016 16:07:08 +0800 Message-Id: <1464854836-26103-2-git-send-email-hongbo.zhang@nxp.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1464854836-26103-1-git-send-email-hongbo.zhang@nxp.com> References: <1464854836-26103-1-git-send-email-hongbo.zhang@nxp.com> Cc: lorenzo.pieralisi@arm.com, chenhui.zhao@nxp.com, jason.jin@nxp.com, alison.wang@nxp.com, sudeep.holla@arm.com, oss@buserror.net, dongsheng.wang@nufront.com, twarren@nvidia.com, ijc@hellion.org.uk Subject: [U-Boot] [PATCH v4 1/9] ARMv7: PSCI: add PSCI v1.0 functions skeleton 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" From: Hongbo Zhang This patch adds all the PSCI v1.0 functions in to the common framework, with all the functions returning "not implemented" by default, as a common framework all the dummy functions are added here, it is up to every platform developer to decide which version of PSCI and which functions to implement. Signed-off-by: Hongbo Zhang Signed-off-by: Wang Dongsheng --- arch/arm/cpu/armv7/psci.S | 78 ++++++++++++++++++++++++++++++++++++++++++++ arch/arm/cpu/armv7/virt-dt.c | 10 +++++- arch/arm/include/asm/psci.h | 16 +++++++++ 3 files changed, 103 insertions(+), 1 deletion(-) diff --git a/arch/arm/cpu/armv7/psci.S b/arch/arm/cpu/armv7/psci.S index 87c0c0b..8e25300 100644 --- a/arch/arm/cpu/armv7/psci.S +++ b/arch/arm/cpu/armv7/psci.S @@ -46,20 +46,62 @@ ENTRY(default_psci_vector) ENDPROC(default_psci_vector) .weak default_psci_vector +ENTRY(psci_version) ENTRY(psci_cpu_suspend) ENTRY(psci_cpu_off) ENTRY(psci_cpu_on) +ENTRY(psci_affinity_info) ENTRY(psci_migrate) +ENTRY(psci_migrate_info_type) +ENTRY(psci_migrate_info_up_cpu) +ENTRY(psci_system_off) +ENTRY(psci_system_reset) +ENTRY(psci_features) +ENTRY(psci_cpu_freeze) +ENTRY(psci_cpu_default_suspend) +ENTRY(psci_node_hw_state) +ENTRY(psci_system_suspend) +ENTRY(psci_set_suspend_mode) +ENTRY(psi_stat_residency) +ENTRY(psci_stat_count) mov r0, #ARM_PSCI_RET_NI @ Return -1 (Not Implemented) mov pc, lr +ENDPROC(psci_stat_count) +ENDPROC(psi_stat_residency) +ENDPROC(psci_set_suspend_mode) +ENDPROC(psci_system_suspend) +ENDPROC(psci_node_hw_state) +ENDPROC(psci_cpu_default_suspend) +ENDPROC(psci_cpu_freeze) +ENDPROC(psci_features) +ENDPROC(psci_system_reset) +ENDPROC(psci_system_off) +ENDPROC(psci_migrate_info_up_cpu) +ENDPROC(psci_migrate_info_type) ENDPROC(psci_migrate) +ENDPROC(psci_affinity_info) ENDPROC(psci_cpu_on) ENDPROC(psci_cpu_off) ENDPROC(psci_cpu_suspend) +ENDPROC(psci_version) +.weak psci_version .weak psci_cpu_suspend .weak psci_cpu_off .weak psci_cpu_on +.weak psci_affinity_info .weak psci_migrate +.weak psci_migrate_info_type +.weak psci_migrate_info_up_cpu +.weak psci_system_off +.weak psci_system_reset +.weak psci_features +.weak psci_cpu_freeze +.weak psci_cpu_default_suspend +.weak psci_node_hw_state +.weak psci_system_suspend +.weak psci_set_suspend_mode +.weak psi_stat_residency +.weak psci_stat_count _psci_table: .word ARM_PSCI_FN_CPU_SUSPEND @@ -70,6 +112,42 @@ _psci_table: .word psci_cpu_on .word ARM_PSCI_FN_MIGRATE .word psci_migrate + .word ARM_PSCI_0_2_FN_PSCI_VERSION + .word psci_version + .word ARM_PSCI_0_2_FN_CPU_SUSPEND + .word psci_cpu_suspend + .word ARM_PSCI_0_2_FN_CPU_OFF + .word psci_cpu_off + .word ARM_PSCI_0_2_FN_CPU_ON + .word psci_cpu_on + .word ARM_PSCI_0_2_FN_AFFINITY_INFO + .word psci_affinity_info + .word ARM_PSCI_0_2_FN_MIGRATE + .word psci_migrate + .word ARM_PSCI_0_2_FN_MIGRATE_INFO_TYPE + .word psci_migrate_info_type + .word ARM_PSCI_0_2_FN_MIGRATE_INFO_UP_CPU + .word psci_migrate_info_up_cpu + .word ARM_PSCI_0_2_FN_SYSTEM_OFF + .word psci_system_off + .word ARM_PSCI_0_2_FN_SYSTEM_RESET + .word psci_system_reset + .word ARM_PSCI_1_0_FN_PSCI_FEATURES + .word psci_features + .word ARM_PSCI_1_0_FN_CPU_FREEZE + .word psci_cpu_freeze + .word ARM_PSCI_1_0_FN_CPU_DEFAULT_SUSPEND + .word psci_cpu_default_suspend + .word ARM_PSCI_1_0_FN_NODE_HW_STATE + .word psci_node_hw_state + .word ARM_PSCI_1_0_FN_SYSTEM_SUSPEND + .word psci_system_suspend + .word ARM_PSCI_1_0_FN_SET_SUSPEND_MODE + .word psci_set_suspend_mode + .word ARM_PSCI_1_0_FN_STAT_RESIDENCY + .word psi_stat_residency + .word ARM_PSCI_1_0_FN_STAT_COUNT + .word psci_stat_count .word 0 .word 0 diff --git a/arch/arm/cpu/armv7/virt-dt.c b/arch/arm/cpu/armv7/virt-dt.c index 32c368f..5e31891 100644 --- a/arch/arm/cpu/armv7/virt-dt.c +++ b/arch/arm/cpu/armv7/virt-dt.c @@ -67,7 +67,15 @@ static int fdt_psci(void *fdt) return nodeoff; } - tmp = fdt_setprop_string(fdt, nodeoff, "compatible", "arm,psci"); +#ifdef CONFIG_ARMV7_PSCI_1_0 + tmp = fdt_setprop_string(fdt, nodeoff, "compatible", "arm,psci-1.0"); + if (tmp) + return tmp; + tmp = fdt_appendprop_string(fdt, nodeoff, "compatible", "arm,psci-0.2"); + if (tmp) + return tmp; +#endif + tmp = fdt_appendprop_string(fdt, nodeoff, "compatible", "arm,psci"); if (tmp) return tmp; tmp = fdt_setprop_string(fdt, nodeoff, "method", "smc"); diff --git a/arch/arm/include/asm/psci.h b/arch/arm/include/asm/psci.h index 3704f07..2367ec0 100644 --- a/arch/arm/include/asm/psci.h +++ b/arch/arm/include/asm/psci.h @@ -31,6 +31,12 @@ #define ARM_PSCI_RET_NI (-1) #define ARM_PSCI_RET_INVAL (-2) #define ARM_PSCI_RET_DENIED (-3) +#define ARM_PSCI_RET_ALREADY_ON (-4) +#define ARM_PSCI_RET_ON_PENDING (-5) +#define ARM_PSCI_RET_INTERNAL_FAILURE (-6) +#define ARM_PSCI_RET_NOT_PRESENT (-7) +#define ARM_PSCI_RET_DISABLED (-8) +#define ARM_PSCI_RET_INVALID_ADDRESS (-9) /* PSCI 0.2 interface */ #define ARM_PSCI_0_2_FN_BASE 0x84000000 @@ -47,6 +53,16 @@ #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) +/* PSCI 1.0 interface */ +#define ARM_PSCI_1_0_FN_PSCI_FEATURES ARM_PSCI_0_2_FN(10) +#define ARM_PSCI_1_0_FN_CPU_FREEZE ARM_PSCI_0_2_FN(11) +#define ARM_PSCI_1_0_FN_CPU_DEFAULT_SUSPEND ARM_PSCI_0_2_FN(12) +#define ARM_PSCI_1_0_FN_NODE_HW_STATE ARM_PSCI_0_2_FN(13) +#define ARM_PSCI_1_0_FN_SYSTEM_SUSPEND ARM_PSCI_0_2_FN(14) +#define ARM_PSCI_1_0_FN_SET_SUSPEND_MODE ARM_PSCI_0_2_FN(15) +#define ARM_PSCI_1_0_FN_STAT_RESIDENCY ARM_PSCI_0_2_FN(16) +#define ARM_PSCI_1_0_FN_STAT_COUNT ARM_PSCI_0_2_FN(17) + #ifndef __ASSEMBLY__ int psci_update_dt(void *fdt); void psci_board_init(void);