From patchwork Wed Jun 26 23:48:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 2789241 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CFCC39F3A0 for ; Wed, 26 Jun 2013 23:48:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E41F8201D5 for ; Wed, 26 Jun 2013 23:48:53 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DE302201D4 for ; Wed, 26 Jun 2013 23:48:52 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UrzS1-0001oh-SF; Wed, 26 Jun 2013 23:48:38 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UrzRz-0002Ml-A8; Wed, 26 Jun 2013 23:48:35 +0000 Received: from mail-pb0-x22c.google.com ([2607:f8b0:400e:c01::22c]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UrzRv-0002MH-Ia for linux-arm-kernel@lists.infradead.org; Wed, 26 Jun 2013 23:48:33 +0000 Received: by mail-pb0-f44.google.com with SMTP id uo1so100749pbc.3 for ; Wed, 26 Jun 2013 16:48:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:subject; bh=2K3XSAhKwf4lwPyWZunUM3X19ChnntUAwnseF4GX37U=; b=svwQ1sM0xOE8aKg4KgqKSjGsqIzgPgUkth0lMjcWoOhHcFtyrJ9/WfMotAOJ2Kexig czu1zZdXgwRR5cXvD4cUKhKDzADx68p2eSBVclkgDxzQdWvLtNEtlH2aQQTGKUambreS EOfXvxAacrKLSpw9SxOfQJpwgxlpvFOr3ywWLlYAxB3MehZmzPQhExis4qdO5NtzyDSx 4Y3tVbiZTlTTQN35OME/9aFCSfdPyQgNKCco6RVyi3YDdU2L1mVnySvvUF82JK7ZVA0B LvxdBBFCaJTPHQ/hIBfPEjVMyzoPvMamIdkzmK8N4hXPu8JStPeeYL77MM3USqCTfHK0 Cjrw== X-Received: by 10.66.191.137 with SMTP id gy9mr3136674pac.37.1372290486496; Wed, 26 Jun 2013 16:48:06 -0700 (PDT) Received: from [127.0.0.1] (ac230065.ppp.asahi-net.or.jp. [183.77.230.65]) by mx.google.com with ESMTPSA id iq6sm260805pbc.1.2013.06.26.16.48.03 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Jun 2013 16:48:05 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Date: Thu, 27 Jun 2013 08:48:07 +0900 Message-Id: <20130626234807.11425.24645.sendpatchset@w520> Subject: [PATCH] ARM: shmobile: Update romImage to relocate appended DTB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130626_194831_723318_8B4E6093 X-CRM114-Status: GOOD ( 11.79 ) X-Spam-Score: -2.0 (--) Cc: arnd@arndb.de, Magnus Damm , horms@verge.net.au, laurent.pinchart@ideasonboard.com, olof@lixom.net, nobuhiro.iwamatsu.yj@renesas.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Magnus Damm Instead of relying of MACH_TYPE for board identification, update the romImage code to relocate an appended DTB to the beginning of RAM. This implementation is independent of ARM_APPENDED_DTB, this because it is necessary to copy the DTB to memory so the kernel can access it. Without this patch Mackerel does not boot via the Mask ROM over USB (r_usb_boot) - this since non-DT boot was broken ages ago in commit: 0ce53cd ARM: mach-shmobile: Use DT_MACHINE for mackerel Signed-off-by: Magnus Damm --- Written against renesas-next-20130620 arch/arm/boot/compressed/head-shmobile.S | 43 ++++++++++++++++++++++++--- arch/arm/mach-shmobile/include/mach/zboot.h | 2 - 2 files changed, 39 insertions(+), 6 deletions(-) --- 0001/arch/arm/boot/compressed/head-shmobile.S +++ work/arch/arm/boot/compressed/head-shmobile.S 2013-06-26 13:27:39.000000000 +0900 @@ -55,12 +55,47 @@ __tmp_stack: __continue: #endif /* CONFIG_ZBOOT_ROM_MMC || CONFIG_ZBOOT_ROM_SH_MOBILE_SDHI */ - /* Set board ID necessary for boot */ - ldr r7, 1f @ Set machine type register - mov r8, #0 @ pass null pointer as atag + adr r0, dtb_info + ldmia r0, {r1, r3, r4, r5, r7} + + sub r0, r0, r1 @ calculate the delta offset + add r5, r5, r0 @ _edata + + ldr lr, [r5, #0] @ check if valid DTB is present + cmp lr, r3 + bne 0f + + add r9, r7, #31 @ rounded up to a multiple + bic r9, r9, #31 @ ... of 32 bytes + + add r6, r9, r5 @ copy from _edata + add r9, r9, r4 @ to MEMORY_START + +1: ldmdb r6!, {r0 - r3, r10 - r12, lr} + cmp r6, r5 + stmdb r9!, {r0 - r3, r10 - r12, lr} + bhi 1b + + /* Success: Zero board ID, pointer to start of memory for atag/dtb */ + mov r7, #0 + mov r8, r4 b 2f -1 : .long MACH_TYPE + .align 2 +dtb_info: + .word dtb_info +#ifndef __ARMEB__ + .word 0xedfe0dd0 @ sig is 0xd00dfeed big endian +#else + .word 0xd00dfeed +#endif + .word MEMORY_START + .word _edata + .word 0x4000 @ maximum DTB size +0: + /* Failure: Zero board ID, NULL atag/dtb */ + mov r7, #0 + mov r8, #0 @ pass null pointer as atag 2 : #endif /* CONFIG_ZBOOT_ROM */ --- 0001/arch/arm/mach-shmobile/include/mach/zboot.h +++ work/arch/arm/mach-shmobile/include/mach/zboot.h 2013-06-26 13:23:03.000000000 +0900 @@ -1,7 +1,6 @@ #ifndef ZBOOT_H #define ZBOOT_H -#include #include /************************************************** @@ -11,7 +10,6 @@ **************************************************/ #ifdef CONFIG_MACH_MACKEREL -#define MACH_TYPE MACH_TYPE_MACKEREL #define MEMORY_START 0x40000000 #include "mach/head-mackerel.txt" #else