From patchwork Wed Nov 2 02:06:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Nelson X-Patchwork-Id: 690230 X-Patchwork-Delegate: sbabic@denx.de 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 3t7s3Z3vqGz9t9b for ; Wed, 2 Nov 2016 13:09:14 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A7FB3A7544; Wed, 2 Nov 2016 03:09:08 +0100 (CET) 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 1MGlmzDQEGab; Wed, 2 Nov 2016 03:09:08 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 94D6DA7558; Wed, 2 Nov 2016 03:09:00 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C50D1A7544 for ; Wed, 2 Nov 2016 03:08:53 +0100 (CET) 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 49-McH5yGyED for ; Wed, 2 Nov 2016 03:08:53 +0100 (CET) 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 fed1rmfepo202.cox.net (fed1rmfepo202.cox.net [68.230.241.147]) by theia.denx.de (Postfix) with ESMTP id 1C7184BF90 for ; Wed, 2 Nov 2016 03:08:49 +0100 (CET) Received: from fed1rmimpo209.cox.net ([68.230.241.160]) by fed1rmfepo202.cox.net (InterMail vM.8.01.05.28 201-2260-151-171-20160122) with ESMTP id <20161102020848.SEHZ4092.fed1rmfepo202.cox.net@fed1rmimpo209.cox.net> for ; Tue, 1 Nov 2016 22:08:48 -0400 Received: from localhost.localdomain ([98.165.102.90]) by fed1rmimpo209.cox.net with cox id 2q8b1u00H1x1f0q01q8nhk; Tue, 01 Nov 2016 22:08:47 -0400 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A090206.58194AAF.00D0, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=2.1 cv=cKFAygqN c=1 sm=1 tr=0 a=i7nT0dqFxmwB8XGI+JTv/g==:117 a=i7nT0dqFxmwB8XGI+JTv/g==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=9_1hYV8uAAAA:8 a=OyUInZPUHWZSPNJ3sCAA:9 a=FKwbt-OhbrkoYuZlCyy7:22 X-CM-Score: 0.00 Authentication-Results: cox.net; auth=pass (CRAM-MD5) smtp.auth=eric.a.nelson@cox.net From: Eric Nelson To: u-boot@lists.denx.de Date: Tue, 1 Nov 2016 19:06:33 -0700 Message-Id: <1478052394-21499-3-git-send-email-eric@nelint.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478052394-21499-1-git-send-email-eric@nelint.com> References: <1478031230-7263-1-git-send-email-eric@nelint.com> <1478052394-21499-1-git-send-email-eric@nelint.com> Cc: marex@denx.de, trini@konsulko.com, otavio.salvador@ossystems.com.br, vincent.stehle@laposte.net, albert.aribaud@3adev.fr, picmaster@mail.bg, fabio.estevam@nxp.com Subject: [U-Boot] [RFC PATCH 2/3] ARM: mx6: ddr: add plugin-utils placeholder 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 entry points for saving the state of the machine at entry from the Boot ROM and for restoring the state before a return. Note that this needs some fixup before it's useful, so I'm forwarding it as an RFC to solicit advice. This placeholder is little more than a setjmp/longjmp that saves the SP, LR and registers 0-9. Disassembling the ROM for i.MX6DL and i.MX6SL shows that these are the only registers used by the ROM on those SOCs. Signed-off-by: Eric Nelson --- arch/arm/cpu/armv7/mx6/Makefile | 2 +- arch/arm/cpu/armv7/mx6/ddr.c | 4 ++++ arch/arm/cpu/armv7/mx6/plugin-utils.S | 24 ++++++++++++++++++++++++ arch/arm/include/asm/arch-mx6/mx6-ddr.h | 19 +++++++++++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 arch/arm/cpu/armv7/mx6/plugin-utils.S diff --git a/arch/arm/cpu/armv7/mx6/Makefile b/arch/arm/cpu/armv7/mx6/Makefile index 8af191d..d0d0103 100644 --- a/arch/arm/cpu/armv7/mx6/Makefile +++ b/arch/arm/cpu/armv7/mx6/Makefile @@ -8,5 +8,5 @@ # obj-y := soc.o clock.o -obj-$(CONFIG_SPL_BUILD) += ddr.o +obj-$(CONFIG_SPL_BUILD) += ddr.o plugin-utils.o obj-$(CONFIG_MP) += mp.o diff --git a/arch/arm/cpu/armv7/mx6/ddr.c b/arch/arm/cpu/armv7/mx6/ddr.c index 0cf391e..7f8e30d 100644 --- a/arch/arm/cpu/armv7/mx6/ddr.c +++ b/arch/arm/cpu/armv7/mx6/ddr.c @@ -1536,3 +1536,7 @@ void mx6_dram_cfg(const struct mx6_ddr_sysinfo *sysinfo, hang(); } } + +#ifdef CONFIG_SPL_BUILD +struct plugin_state plugin_state __attribute__((section(".data"))); +#endif diff --git a/arch/arm/cpu/armv7/mx6/plugin-utils.S b/arch/arm/cpu/armv7/mx6/plugin-utils.S new file mode 100644 index 0000000..c284a76 --- /dev/null +++ b/arch/arm/cpu/armv7/mx6/plugin-utils.S @@ -0,0 +1,24 @@ +/* + * Utility functions for executing as an i.MX plugin + * + * Copyright (c) 2016 Nelson Integration, LLC + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include + +ENTRY(save_boot_params) + ldr r10, =plugin_state + stmia r10, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, fp, sp, lr} + b save_boot_params_ret +ENDPROC(save_boot_params) + +ENTRY(return_to_rom) + ldr r10, =plugin_state + ldmia r10, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, fp, sp, lr} + bx lr +ENDPROC(return_to_rom) diff --git a/arch/arm/include/asm/arch-mx6/mx6-ddr.h b/arch/arm/include/asm/arch-mx6/mx6-ddr.h index 2a8d443..52420da 100644 --- a/arch/arm/include/asm/arch-mx6/mx6-ddr.h +++ b/arch/arm/include/asm/arch-mx6/mx6-ddr.h @@ -528,4 +528,23 @@ void mx6_dram_cfg(const struct mx6_ddr_sysinfo *, #define MX6_MMDC_P1_MPZQLP2CTL 0x021b485C #define MX6_MMDC_P1_MPMUR0 0x021b48b8 +#ifdef CONFIG_SPL_BUILD +struct plugin_state { + uint32_t r0; + uint32_t r1; + uint32_t r2; + uint32_t r3; + uint32_t r4; + uint32_t r5; + uint32_t r6; + uint32_t r7; + uint32_t r8; + uint32_t r9; + uint32_t fp; + uint32_t sp; + uint32_t lr; +}; +void return_to_rom(void); +#endif + #endif /*__ASM_ARCH_MX6_DDR_H__ */