From patchwork Fri Oct 5 12:09:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Vernier X-Patchwork-Id: 189464 X-Patchwork-Delegate: albert.aribaud@free.fr 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 AC3532C0086 for ; Fri, 5 Oct 2012 22:11:44 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A382628090; Fri, 5 Oct 2012 14:11:42 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 tL-pbspHA0gz; Fri, 5 Oct 2012 14:11:42 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2F00D280A9; Fri, 5 Oct 2012 14:10:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3A5772808A for ; Fri, 5 Oct 2012 14:10:33 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 CXkO-dSdz3K8 for ; Fri, 5 Oct 2012 14:10:32 +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-la0-f44.google.com (mail-la0-f44.google.com [209.85.215.44]) by theia.denx.de (Postfix) with ESMTPS id 3F85A2808B for ; Fri, 5 Oct 2012 14:10:20 +0200 (CEST) Received: by mail-la0-f44.google.com with SMTP id b11so862214lam.3 for ; Fri, 05 Oct 2012 05:10:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references:x-gm-message-state; bh=dCCeSJQaJ1HKI5f//uNwYKQLme5XKCY4Vg/imkoVSRY=; b=WBQUvlwUVITQeawNkEaRtpUD2UJHIZpcNmVlARqBw542lIbdJ+nUZ0fH24FKHQVo82 ePC6PGItxd3VvFFoIleci6SxRoXIgzdyVvnVNMPzfKj/9uVDR5PsGlxzzhZb5GIyXSW/ EbR7u0QNgTDNB4qQGa0x8hvppv3vD3O8WnW2AI+ai/ipjmv/9eqtav8b0XLPTQ0yxeqB 60q0krmuqci6A8L4nxP0eSrV+hJ9apXVA4ZZCDqI3XC8p3UXMAIayU8swjvnzuKRC8bm BScE2Ones2G11Sdcm+k2ODTxeUBnpSjPt9OmKZw26Zqo7VVnZCRixcYmjMYCzBieQeNi ns5Q== Received: by 10.112.51.195 with SMTP id m3mr3873221lbo.17.1349439020806; Fri, 05 Oct 2012 05:10:20 -0700 (PDT) Received: from latmask.orsoc.lan (c213-89-175-97.bredband.comhem.se. [213.89.175.97]) by mx.google.com with ESMTPS id fp7sm1102794lab.4.2012.10.05.05.10.19 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 05 Oct 2012 05:10:20 -0700 (PDT) From: Yann Vernier To: u-boot@lists.denx.de Date: Fri, 5 Oct 2012 14:09:53 +0200 Message-Id: <1349438998-10954-7-git-send-email-yann.vernier@orsoc.se> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1349438998-10954-1-git-send-email-yann.vernier@orsoc.se> References: <1349438998-10954-1-git-send-email-yann.vernier@orsoc.se> In-Reply-To: <20121004111506.1777a119@lilith> References: <20121004111506.1777a119@lilith> X-Gm-Message-State: ALoCoQnSiDV5zFs5KSRTrHsUuhFOJXVks8ylSlf0EG6E2hUvA2qFqEbmuZyysOqLA0Ef3/t5/neQ Subject: [U-Boot] [PATCH 06/11] arm: cm4008, cm41xx: Fix ROM relocation X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Changed CONFIG_SYS_TEXT_BASE to actual address (required for board_init_f) and moved it into cm4{008,1xx}.h, along with a warning that it must match CONFIG_SYS_FLASH_BASE (since lowlevel_init relocates there). lowlevel_init now uses CONFIG_SYS_RCS0_BASE to map ROM. --- Changes for v2: - Update to use CONFIG_SYS_FLASH_ constants only (no PHYS_FLASH) - Use tabs where appropriate - Update cm41xx also - Explain the lowlevel_init change Changes for v3: - Use memory mappings per defined macros - Change the final adjustment of lr and ip - Verified mapping flash at 0x3000000 on KS8695X demo board --- arch/arm/cpu/arm920t/ks8695/lowlevel_init.S | 63 +++++++++++++++++++-------- board/cm4008/config.mk | 1 - board/cm41xx/config.mk | 1 - 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/arch/arm/cpu/arm920t/ks8695/lowlevel_init.S b/arch/arm/cpu/arm920t/ks8695/lowlevel_init.S index 1bba571..74579ed 100644 --- a/arch/arm/cpu/arm920t/ks8695/lowlevel_init.S +++ b/arch/arm/cpu/arm920t/ks8695/lowlevel_init.S @@ -25,6 +25,7 @@ #include #include #include +#include #ifndef CONFIG_SKIP_LOWLEVEL_INIT @@ -91,12 +92,31 @@ lowlevel_init: * remap the memory and flash regions. we want to end up with * ram from address 0, and flash at 32MB. */ +#if CONFIG_SYS_RCS0_BASE!=CONFIG_SYS_TEXT_BASE +#error CONFIG_SYS_RCS0_BASE and CONFIG_SYS_TEXT_BASE must match for highflash address to work + /* Also needed for pointers in board_init_f() */ +#endif +#if CONFIG_SYS_RCS0_BASE>=KS8695_IO_BASE +#error Cannot relocate ROM past IO registers + /* Firstly, the IO registers are at the top supported address. + Secondly, as we grow the ROM region it must not overlap the registers. */ +#endif +#if CONFIG_SYS_RCS0_BASE&0xffff +#error Cannot map memory to addresses not divisible by 64K +#endif ldr r1, =(KS8695_IO_BASE+KS8695_MEM_CTRL0) - ldr r2, =0xbfc00040 + /* The default ROM mapping is at 0x0 - 0x01ffffff. + Remap it to 0x0 - 0x03feffff so that it covers 0x02000000, + where CONFIG_SYS_FLASH_BASE maps it, as well as 0. + Relies on the limited address lines to repeat ROM images + on every multiple of the real ROM size. */ + ldr r2, =(KS8695_MEM_RANGE(0,0x03ff0000)|(CONFIG_KS8695_ROMCON0_VALUE&0xfff)) str r2, [r1] /* large flash map */ - ldr pc, =(highflash+0x02000000-0x00f00000) /* jump to high flash address */ + /* Relies on CONFIG_SYS_RCS0_BASE==CONFIG_SYS_TEXT_BASE */ + ldr pc, =(highflash) /* jump to high flash address */ highflash: - ldr r2, =0x8fe00040 + /* Move ROM to high address, and reconfigure to 4MiB size */ + ldr r2, =CONFIG_KS8695_ROMCON0_VALUE str r2, [r1] /* remap flash range */ /* @@ -105,28 +125,35 @@ highflash: * then you can have it all mapped nicely. Has no effect if you * only have a 4Mb or smaller flash. */ +#if CONFIG_SYS_RCS1_WIDTH ldr r1, =(KS8695_IO_BASE+KS8695_MEM_CTRL1) - ldr r2, =0x9fe40040 + ldr r2, =CONFIG_KS8695_ROMCON1_VALUE str r2, [r1] /* remap flash2 region, contiguous */ - ldr r1, =(KS8695_IO_BASE+KS8695_MEM_GENERAL) - ldr r2, =0x30000005 - str r2, [r1] /* enable both flash selects */ +#endif -#ifdef CONFIG_CM41xx /* - * map the second flash chip, using the external IO lines. + * map additional flash chip, using the external IO lines. */ +#if CONFIG_SYS_ECS0_WIDTH ldr r1, =(KS8695_IO_BASE+KS8695_IO_CTRL0) - ldr r2, =0xafe80b6d - str r2, [r1] /* remap io0 region, contiguous */ + ldr r2, =CONFIG_KS8695_EXTACON0_VALUE + str r2, [r1] /* map io0 region */ +#endif +#if CONFIG_SYS_ECS1_WIDTH ldr r1, =(KS8695_IO_BASE+KS8695_IO_CTRL1) - ldr r2, =0xbfec0b6d - str r2, [r1] /* remap io1 region, contiguous */ - ldr r1, =(KS8695_IO_BASE+KS8695_MEM_GENERAL) - ldr r2, =0x30050005 - str r2, [r1] /* enable second flash */ + ldr r2, =CONFIG_KS8695_EXTACON1_VALUE + str r2, [r1] /* map io1 region */ +#endif +#if CONFIG_SYS_ECS2_WIDTH + ldr r1, =(KS8695_IO_BASE+KS8695_IO_CTRL2) + ldr r2, =CONFIG_KS8695_EXTACON2_VALUE + str r2, [r1] /* map io2 region */ #endif + ldr r1, =(KS8695_IO_BASE+KS8695_MEM_GENERAL) + ldr r2, =CONFIG_KS8695_ERGCON_VALUE + str r2, [r1] /* enable relevant flash selects */ + /* * before relocating, we have to setup RAM timing */ @@ -198,8 +225,8 @@ highflash: nobutton: #endif - add lr, lr, #0x02000000 /* flash is now mapped high */ - add ip, ip, #0x02000000 /* this is a hack */ + add lr, lr, #CONFIG_SYS_TEXT_BASE /* flash is now mapped high */ + add ip, ip, #CONFIG_SYS_TEXT_BASE /* this is a hack */ mov pc, lr /* all done, return */ #endif /* CONFIG_SKIP_LOWLEVEL_INIT */ diff --git a/board/cm4008/config.mk b/board/cm4008/config.mk deleted file mode 100644 index 0d5923b..0000000 --- a/board/cm4008/config.mk +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SYS_TEXT_BASE = 0x00f00000 diff --git a/board/cm41xx/config.mk b/board/cm41xx/config.mk deleted file mode 100644 index 0d5923b..0000000 --- a/board/cm41xx/config.mk +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SYS_TEXT_BASE = 0x00f00000