From patchwork Sat Aug 6 18:21:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 656387 X-Patchwork-Delegate: iwamatsu@nigauri.org 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 3s6BrC07Gbz9t0G for ; Sun, 7 Aug 2016 04:23:23 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AA9C1A75D5; Sat, 6 Aug 2016 20:22:26 +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 b2V3t8QQ2Vxk; Sat, 6 Aug 2016 20:22:26 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D9780A7541; Sat, 6 Aug 2016 20:21:52 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4EA664BE95 for ; Sat, 6 Aug 2016 20:21:25 +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 nI4RvRgZIyxG for ; Sat, 6 Aug 2016 20:21:25 +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.mleia.com (mleia.com [178.79.152.223]) by theia.denx.de (Postfix) with ESMTPS id 1ADDC4BFB2 for ; Sat, 6 Aug 2016 20:21:21 +0200 (CEST) Received: from mail.mleia.com (localhost [127.0.0.1]) by mail.mleia.com (Postfix) with ESMTP id 1F6AF433F1A; Sat, 6 Aug 2016 19:21:21 +0100 (BST) From: Vladimir Zapolskiy To: Nobuhiro Iwamatsu Date: Sat, 6 Aug 2016 21:21:08 +0300 Message-Id: <1470507672-1188-9-git-send-email-vz@mleia.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1470507672-1188-1-git-send-email-vz@mleia.com> References: <1470507672-1188-1-git-send-email-vz@mleia.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-49551924 X-CRM114-CacheID: sfid-20160806_192121_152022_F75AC497 X-CRM114-Status: GOOD ( 10.52 ) Cc: u-boot@lists.denx.de, Mark Jonas Subject: [U-Boot] [PATCH 08/12] sh: add shared relocate_code() function and call board_init_r() 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" Commits b61e90e6fd83 ("sh: Drop the arch-specific board init") and f41e6088eb1a ("sh: Fix build errors for generic board") left code and data relocation done in start.S, however further actual U-boot configuration is not started anymore. Practically SH boards with the code relocated into the expected position by start.S still can be booted, so the change adds this option and provides an option how to relocate code for board_init_r() execution. Signed-off-by: Vladimir Zapolskiy --- arch/sh/cpu/sh2/cpu.c | 6 ------ arch/sh/cpu/sh3/cpu.c | 6 ------ arch/sh/cpu/sh4/cpu.c | 6 ------ arch/sh/lib/board.c | 18 ++++++++++++++++++ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/arch/sh/cpu/sh2/cpu.c b/arch/sh/cpu/sh2/cpu.c index 9a93cf5..a2f856f 100644 --- a/arch/sh/cpu/sh2/cpu.c +++ b/arch/sh/cpu/sh2/cpu.c @@ -83,9 +83,3 @@ int dcache_status(void) { return 0; } - -void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaaddr) -{ - /* TODO(sh maintainer): Implement this */ - while (1); -} diff --git a/arch/sh/cpu/sh3/cpu.c b/arch/sh/cpu/sh3/cpu.c index 494f908..ea0006a 100644 --- a/arch/sh/cpu/sh3/cpu.c +++ b/arch/sh/cpu/sh3/cpu.c @@ -66,9 +66,3 @@ int dcache_status(void) { return 0; } - -void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaaddr) -{ - /* TODO(sh maintainer): Implement this */ - while (1); -} diff --git a/arch/sh/cpu/sh4/cpu.c b/arch/sh/cpu/sh4/cpu.c index de90ca7..e8ee0a4 100644 --- a/arch/sh/cpu/sh4/cpu.c +++ b/arch/sh/cpu/sh4/cpu.c @@ -75,9 +75,3 @@ int cpu_eth_init(bd_t *bis) #endif return 0; } - -void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaaddr) -{ - /* TODO(sh maintainer): Implement this */ - while (1); -} diff --git a/arch/sh/lib/board.c b/arch/sh/lib/board.c index 7cb594e..aa967c0 100644 --- a/arch/sh/lib/board.c +++ b/arch/sh/lib/board.c @@ -15,3 +15,21 @@ int dram_init(void) return 0; } + +void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaddr) +{ + void (*reloc_board_init_r)(gd_t *gd, ulong dest) = board_init_r; + + if (new_gd->reloc_off) { + memcpy((void *)new_gd->relocaddr, + (void *)(new_gd->relocaddr - new_gd->reloc_off), + new_gd->mon_len); + + reloc_board_init_r += new_gd->reloc_off; + } + + __asm__ __volatile__("mov.l %0, r15\n" : : "m" (new_gd->start_addr_sp)); + + while (1) + reloc_board_init_r(new_gd, 0x0); +}