From patchwork Thu Aug 11 20:27:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1665691 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=XYxo2q0A; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M3dfZ0rjDz9sGG for ; Fri, 12 Aug 2022 06:28:04 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 498C284A54; Thu, 11 Aug 2022 22:27:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="XYxo2q0A"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8112C84A71; Thu, 11 Aug 2022 22:27:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 962BF841EE for ; Thu, 11 Aug 2022 22:27:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9F97661314 for ; Thu, 11 Aug 2022 20:27:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D58EEC433D7 for ; Thu, 11 Aug 2022 20:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660249663; bh=Q/BjtAP5kUvMKvaxzB6teJkicCMz1+6qhHVo+Mx5gak=; h=From:To:Subject:Date:From; b=XYxo2q0AQdccLgxbVnYP9m6knEB9bqo8ldUFK4GgkJtR+4qCp/Irj060X3pJDe6Ce sX3ZKiznr+R9DHz+a0Ti2MZ9r7hxbZ7LJ1eVvfWO+mGoASiePYhjI2zpAqU+CCZGzO /MW8YeEfcvqfJgBo6Vw4fVx4AjuTMkY+v6taejtBHJPux5KuahWYXVIxKrSV+NVPJL UqyP03CUgYPuO84oLUgWpCMskzmloz2g+thhZGb4Zjf1VUVySPPolpBwPd9iNJeYYf v+KfgXbgTf0h7xrfJ/JkLD2VPiW3XH9zj5u/sybDbIIDBNAUUkOKiB6387qfbBhwkY wjE02gnCJoFJw== Received: by pali.im (Postfix) id B1701C06; Thu, 11 Aug 2022 22:27:39 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: u-boot@lists.denx.de Subject: [PATCH 1/5] Nokia RX-51: Fix invalidating zImage kernel format Date: Thu, 11 Aug 2022 22:27:21 +0200 Message-Id: <20220811202725.24752-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Prior starting copy of kernel image to target location, invalidate also zImage magic header. This ensures that on target location would be image with valid header only in the case valid header was also in the source location and copy from source to target finished successfully. Copy is always skipped when kernel image in source location is invalid. Add also comment to the code which explain what is the code doing. Fixes: cc434fccba4c ("Nokia RX-51: Add support for booting kernel in zImage format") Signed-off-by: Pali Rohár --- board/nokia/rx51/lowlevel_init.S | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S index 11c2cbef89a6..632595f83785 100644 --- a/board/nokia/rx51/lowlevel_init.S +++ b/board/nokia/rx51/lowlevel_init.S @@ -72,7 +72,8 @@ copy_kernel_start: /* remove header in target kernel */ mov r5, #0 - str r5, [r3] + str r5, [r3] /* remove 4 bytes header of kernel uImage */ + str r5, [r3, #36] /* remove 4 bytes header of kernel zImage */ /* check for valid kernel uImage */ ldr r4, [r0] /* r4 - 4 bytes header of kernel */ @@ -93,6 +94,8 @@ copy_kernel_loop: bhi copy_kernel_loop copy_kernel_end: + + /* remove header in source kernel image */ mov r5, #0 str r5, [r0] /* remove 4 bytes header of kernel uImage */ str r5, [r0, #36] /* remove 4 bytes header of kernel zImage */ From patchwork Thu Aug 11 20:27:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1665694 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=cEsFeytn; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M3dg56978z9sGG for ; Fri, 12 Aug 2022 06:28:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 47F1B84A80; Thu, 11 Aug 2022 22:27:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="cEsFeytn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4430E84A71; Thu, 11 Aug 2022 22:27:51 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2D44B84A5C for ; Thu, 11 Aug 2022 22:27:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BFC1E6131A for ; Thu, 11 Aug 2022 20:27:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF10EC433D7 for ; Thu, 11 Aug 2022 20:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660249664; bh=G8ABiEV191tXo1RQe5QzzSaBxthW2dDFPvCXZ4y2CSw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cEsFeytnpZkP3J98RLocBfqrvCMXA3U3RQ/whFKiNL/gbS92cZXTnb2yWHc0pKDOZ Hreo/iEVchvaR8J5ixudCGM0yiebh6zv0rdhAn8hLgv5i2M3yyP/iLpRJAWmL1J4rA LcNhbb23Zck/C/cUuIAhJGXHYDBohTn/Ij8o39VJ+vQ2XWzAW6eF5G4HbDgmKN8yQJ lHRTONOJ5jk08OlpCJdPlFa/HNJUJzZTnffPEQr/qydj8EtTWIaQO7lrQO2KB+bvFN NYJ21hJu5b7TrML+Skujw2F9kmgeSQKWBeXV/33uKbRhlut1X7dYVARFNbrB1SMl1D 71L+wNWFb85pg== Received: by pali.im (Postfix) id BD1332763; Thu, 11 Aug 2022 22:27:40 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: u-boot@lists.denx.de Subject: [PATCH 2/5] Nokia RX-51: Use U-Boot generic position independent code Date: Thu, 11 Aug 2022 22:27:22 +0200 Message-Id: <20220811202725.24752-2-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220811202725.24752-1-pali@kernel.org> References: <20220811202725.24752-1-pali@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Switch from custom board specific fixup/copy code to U-Boot generic position independent code provided by config option POSITION_INDEPENDENT. This also slightly decrease size of u-boot.bin binary (by 52 bytes). Note that option POSITION_INDEPENDENT increase size but not more than custom board fixup/copy code which is being deleted (as it is not needed anymore). Signed-off-by: Pali Rohár --- arch/arm/mach-omap2/omap3/Kconfig | 1 + board/nokia/rx51/lowlevel_init.S | 127 ++++-------------------------- configs/nokia_rx51_defconfig | 1 - 3 files changed, 16 insertions(+), 113 deletions(-) diff --git a/arch/arm/mach-omap2/omap3/Kconfig b/arch/arm/mach-omap2/omap3/Kconfig index 81c898b66e34..18574ab2b2ea 100644 --- a/arch/arm/mach-omap2/omap3/Kconfig +++ b/arch/arm/mach-omap2/omap3/Kconfig @@ -107,6 +107,7 @@ config TARGET_OMAP3_LOGIC config TARGET_NOKIA_RX51 bool "Nokia RX51" + select POSITION_INDEPENDENT config TARGET_TAO3530 bool "TAO3530" diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S index 632595f83785..dd3c830cc2e2 100644 --- a/board/nokia/rx51/lowlevel_init.S +++ b/board/nokia/rx51/lowlevel_init.S @@ -33,16 +33,24 @@ z_magic: /* LINUX_ARM_ZIMAGE_MAGIC */ /* * Routine: save_boot_params (called after reset from start.S) * Description: Copy attached kernel to address KERNEL_ADDRESS - * Copy u-boot to address CONFIG_SYS_TEXT_BASE - * Return to copied u-boot address */ .global save_boot_params save_boot_params: - /* Get return address */ - ldr lr, =save_boot_params_ret -/* Copy valid attached kernel to address KERNEL_ADDRESS */ +/* + * Copy valid attached kernel to absolute address KERNEL_ADDRESS + * + * Nokia X-Loader is loading secondary image to address 0x80400000. + * NOLO is loading boot image to random place, so it doesn't really + * matter what is set in CONFIG_SYS_TEXT_BASE. We have to detect + * KERNEL_OFFSET from the current execution address and copy it to + * absolute address KERNEL_ADDRESS. + * + * Note that U-Boot has to be compiled with CONFIG_POSITION_INDEPENDENT + * because it is loaded at random address and not to the fixed address + * (CONFIG_SYS_TEXT_BASE). + */ copy_kernel_start: adr r0, relocaddr /* r0 - address of section relocaddr */ @@ -100,110 +108,5 @@ copy_kernel_end: str r5, [r0] /* remove 4 bytes header of kernel uImage */ str r5, [r0, #36] /* remove 4 bytes header of kernel zImage */ - -/* Fix u-boot code */ - -fix_start: - adr r0, relocaddr /* r0 - address of section relocaddr */ - ldr r1, relocaddr /* r1 - address of relocaddr after relocation */ - cmp r0, r1 - - beq copy_uboot_end /* skip if u-boot is on correct address */ - - /* r5 - calculated offset */ - subhi r5, r0, r1 - sublo r5, r1, r0 - - /* r6 - maximal u-boot size */ - ldr r6, imagesize - - /* r1 - start of u-boot after */ - ldr r1, startaddr - - /* r0 - start of u-boot before */ - addhi r0, r1, r5 - sublo r0, r1, r5 - - /* check if we need to move uboot copy code before calling it */ - cmp r5, r6 - bhi copy_uboot_start /* now coping u-boot code directly is safe */ - - -copy_code_start: - /* r0 - start of u-boot before */ - /* r1 - start of u-boot after */ - /* r6 - maximal u-boot size */ - - /* r7 - maximal kernel size */ - ldr r7, kernsize - - /* r4 - end of kernel before */ - add r4, r0, r6 - add r4, r4, r7 - - /* r5 - end of u-boot after */ - ldr r5, startaddr - add r5, r5, r6 - - /* r2 - start of loop code after */ - cmp r4, r5 /* higher address (r4 or r5) */ - movhs r2, r4 - movlo r2, r5 - - /* r3 - end of loop code before */ - adr r3, end - - /* r4 - end of loop code after */ - adr r4, copy_uboot_start - sub r4, r3, r4 - add r4, r2, r4 - -copy_code_loop: - ldmdb r3!, {r7 - r10} - stmdb r4!, {r7 - r10} - cmp r4, r2 - bhi copy_code_loop - -copy_code_end: - mov pc, r2 - - -/* - * Copy u-boot to address CONFIG_SYS_TEXT_BASE - * - * Nokia X-Loader loading secondary image to address 0x80400000 - * NOLO loading boot image to random place, so it doesn't really - * matter what is set in CONFIG_SYS_TEXT_BASE. We have to copy - * u-boot to CONFIG_SYS_TEXT_BASE address. - */ - -copy_uboot_start: - /* r0 - start of u-boot before */ - /* r1 - start of u-boot after */ - /* r6 - maximal u-boot size */ - - /* r2 - end of u-boot after */ - add r2, r1, r6 - - /* condition for copying from left to right */ - cmp r0, r1 - addlo r1, r0, r6 /* r1 - end of u-boot before */ - blo copy_uboot_loop_right - -copy_uboot_loop_left: - ldmia r0!, {r3 - r10} - stmia r1!, {r3 - r10} - cmp r1, r2 - blo copy_uboot_loop_left - b copy_uboot_end - -copy_uboot_loop_right: - ldmdb r1!, {r3 - r10} - stmdb r2!, {r3 - r10} - cmp r1, r0 - bhi copy_uboot_loop_right - -copy_uboot_end: - bx lr - -end: + /* Returns */ + b save_boot_params_ret diff --git a/configs/nokia_rx51_defconfig b/configs/nokia_rx51_defconfig index 309cf28269c1..3365f7ae58df 100644 --- a/configs/nokia_rx51_defconfig +++ b/configs/nokia_rx51_defconfig @@ -9,7 +9,6 @@ CONFIG_INITRD_TAG=y CONFIG_REVISION_TAG=y CONFIG_STATIC_MACH_TYPE=y CONFIG_MACH_TYPE=1955 -CONFIG_SYS_TEXT_BASE=0x80008000 CONFIG_SYS_MALLOC_LEN=0xc0000 CONFIG_NR_DRAM_BANKS=2 CONFIG_TARGET_NOKIA_RX51=y From patchwork Thu Aug 11 20:27:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1665695 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=kaXydHrl; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M3dgM5Hckz9sGG for ; Fri, 12 Aug 2022 06:28:47 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 13FB284A95; Thu, 11 Aug 2022 22:28:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="kaXydHrl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 741C984A5C; Thu, 11 Aug 2022 22:27:51 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7A71584A69 for ; Thu, 11 Aug 2022 22:27:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5317A6131D for ; Thu, 11 Aug 2022 20:27:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F03FC433D6 for ; Thu, 11 Aug 2022 20:27:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660249664; bh=IBibWuYr9IGYq/2GPyz4mD7xEz/nwV4W9S7DhWCGXHw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=kaXydHrlZjEejiop7mSyzAMsu8x7iiDqT8Q4DJH78suN9KkyzEb5qX+Vf0k3VR2z+ CPsOJZdU/Rq1MbdJw/Z8/1C3nGTAjap8ZJPGvUB3saCNSHwXToLjZjtVHoyaC/jJcT z3DdfqlNzLdu0rxNciSz+fibsnU9VmVLgn34N7jBKzd82SP+nj9SdYUdwqcif4qv0g hLuNAKhnCoIv1rZEU8bhe3+UavUAfEUIvEHaBjoZ9dRndn0ozSOVH7pyd63E4gINlq zoh6F4ujacioMANEa50xoI0fZQ3vvY52OfvaovoqkQWKgLD/pcLx83hr0H/P5o4eiY U4RjzZ0UE+Ghg== Received: by pali.im (Postfix) id D3CB52765; Thu, 11 Aug 2022 22:27:41 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: u-boot@lists.denx.de Subject: [PATCH 3/5] Nokia RX-51: Simplify copy kernel code Date: Thu, 11 Aug 2022 22:27:23 +0200 Message-Id: <20220811202725.24752-3-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220811202725.24752-1-pali@kernel.org> References: <20220811202725.24752-1-pali@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Expression (r + (r0 - r1)) produce same result as (r - (r1 - r0)). So it does not matter which one is called. Always call the first option and remove second one. Signed-off-by: Pali Rohár --- board/nokia/rx51/lowlevel_init.S | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S index dd3c830cc2e2..4f76e80b20f1 100644 --- a/board/nokia/rx51/lowlevel_init.S +++ b/board/nokia/rx51/lowlevel_init.S @@ -55,16 +55,13 @@ save_boot_params: copy_kernel_start: adr r0, relocaddr /* r0 - address of section relocaddr */ ldr r1, relocaddr /* r1 - address of relocaddr after relocation */ - cmp r0, r1 /* r4 - calculated offset */ - subhi r4, r0, r1 - sublo r4, r1, r0 + sub r4, r0, r1 /* r0 - start of kernel before */ ldr r0, startaddr - addhi r0, r0, r4 - sublo r0, r0, r4 + add r0, r0, r4 ldr r1, kernoffs add r0, r0, r1 From patchwork Thu Aug 11 20:27:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1665693 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=faT5f//d; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M3dft5T08z9sGG for ; Fri, 12 Aug 2022 06:28:22 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 493BD84A6D; Thu, 11 Aug 2022 22:27:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="faT5f//d"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 84D2184A65; Thu, 11 Aug 2022 22:27:51 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9D1FE84A6C for ; Thu, 11 Aug 2022 22:27:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 51355612EA for ; Thu, 11 Aug 2022 20:27:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92111C433C1 for ; Thu, 11 Aug 2022 20:27:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660249665; bh=DnryPHEnSOquBwqMUontn7a2DjM1CfHmjd2YoML09Rs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=faT5f//dOHW7NX7fGtMyfLUzZz6MJJEEAq7pY50eqDmlLHID8qO/4gaeJWKwVmJRr oe+MFsG/jvWy0xn+wKdr2MVs7rHxSf1fp6UqHCyRzgwOoG7TapUSBZTicf4u0Em0na GOAMl/+j6qJSvLmL05OGnFoCYbS7VoGUR0i6vRGRzcYlmAOqqc19oDGjFPabb8hk/Y JSr/h1K8kE60y9QhRe9+7tJfgRAMReFg9zppbmkZ1SAgPysC3XDkaqg6X6TIIZ0C6m HTslq4qfKvwqlIOLtZuMu0XrQ/nsULLJMOJHYRmx2SpsU+R+CBcwWVFL7Y//iRgoEE gX+B+gJwJHDSQ== Received: by pali.im (Postfix) id 06B832777; Thu, 11 Aug 2022 22:27:43 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: u-boot@lists.denx.de Subject: [PATCH 4/5] Nokia RX-51: Simplify calculation of attached kernel image address Date: Thu, 11 Aug 2022 22:27:24 +0200 Message-Id: <20220811202725.24752-4-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220811202725.24752-1-pali@kernel.org> References: <20220811202725.24752-1-pali@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Now when board starup code does not copy image to CONFIG_SYS_TEXT_BASE address there is no need to calculate all addresses from base address at runtime. The only address which needs to be calculated is attached kernel image address which can be simplified at compile time without need to know CONFIG_SYS_TEXT_BASE address or relocation address at the runtime. Signed-off-by: Pali Rohár --- board/nokia/rx51/lowlevel_init.S | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/board/nokia/rx51/lowlevel_init.S b/board/nokia/rx51/lowlevel_init.S index 4f76e80b20f1..c1785bc3f72f 100644 --- a/board/nokia/rx51/lowlevel_init.S +++ b/board/nokia/rx51/lowlevel_init.S @@ -6,11 +6,8 @@ #include -relocaddr: /* address of this relocaddr section after coping */ - .word . /* address of section (calculated at compile time) */ - -startaddr: /* address of u-boot after copying */ - .word CONFIG_SYS_TEXT_BASE +kernoffs: /* offset of kernel image from this address */ + .word KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE) kernaddr: /* address of kernel after copying */ .word KERNEL_ADDRESS @@ -18,9 +15,6 @@ kernaddr: /* address of kernel after copying */ kernsize: /* maximal size of kernel image */ .word KERNEL_MAXSIZE -kernoffs: /* offset of kernel image in loaded u-boot */ - .word KERNEL_OFFSET - imagesize: /* maximal size of image */ .word IMAGE_MAXSIZE @@ -53,16 +47,9 @@ save_boot_params: */ copy_kernel_start: - adr r0, relocaddr /* r0 - address of section relocaddr */ - ldr r1, relocaddr /* r1 - address of relocaddr after relocation */ - - /* r4 - calculated offset */ - sub r4, r0, r1 - /* r0 - start of kernel before */ - ldr r0, startaddr - add r0, r0, r4 - ldr r1, kernoffs + adr r0, kernoffs /* r0 - current address of kernoffs section */ + ldr r1, kernoffs /* r1 - offset of kernel image from kernoffs section */ add r0, r0, r1 /* r3 - start of kernel after */ From patchwork Thu Aug 11 20:27:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1665692 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Y4wavpuu; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M3dff3QqPz9sGp for ; Fri, 12 Aug 2022 06:28:10 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 09F0E80E94; Thu, 11 Aug 2022 22:27:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="Y4wavpuu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 71D21841EE; Thu, 11 Aug 2022 22:27:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4385E84A62 for ; Thu, 11 Aug 2022 22:27:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2D7EA6131C for ; Thu, 11 Aug 2022 20:27:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CF63C433B5 for ; Thu, 11 Aug 2022 20:27:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660249664; bh=lKzI1naBswY0h4qLY5oXZM9OSt/9M8l5e/L5YKiTUxU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Y4wavpuutAsSo2e9Zg8vl/LfMduI779r53+5tiz6acV3dSOX0DchuZbR7ZjprSUXw LrmojjK7sA0wlqFF+F1ytbT7nppm2zTnSg5Q3plM3Tes8vUZ4c0VS3kGrgYG+HsDAv wRTPli/9WbCqKJzhAlp5ngB+KQHGs9ZpLID/yqaXcam6rejL2BjtbKHZnq+uyEXNYn EG6NFNsc4aPR5Y07VcdJ9R7vDjZKnVBLD7lX+QyQSkWIVC9NHKNiRWQBDTvhnba/6v kS5ikOetNsBKPIeHBQuSwl6ycnnudy8icw0wnTUujgQpiwmg7djcDxS4eCBIxxo3lb KtYhLNF+lfdFw== Received: by pali.im (Postfix) id 2421BC06; Thu, 11 Aug 2022 22:27:44 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: u-boot@lists.denx.de Subject: [PATCH 5/5] Nokia RX-51: Move board required options from defconfig to Kconfig Date: Thu, 11 Aug 2022 22:27:25 +0200 Message-Id: <20220811202725.24752-5-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220811202725.24752-1-pali@kernel.org> References: <20220811202725.24752-1-pali@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Some of config options are board specific and should be set in into their default values automatically. So move them from defconfig file to Kconfig definitions to ensure that possible user custom defconfig files would have these required options also enabled. Signed-off-by: Pali Rohár --- arch/arm/mach-omap2/omap3/Kconfig | 5 +++++ board/nokia/rx51/Kconfig | 6 ++++++ configs/nokia_rx51_defconfig | 7 ------- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-omap2/omap3/Kconfig b/arch/arm/mach-omap2/omap3/Kconfig index 18574ab2b2ea..3e97ec262951 100644 --- a/arch/arm/mach-omap2/omap3/Kconfig +++ b/arch/arm/mach-omap2/omap3/Kconfig @@ -108,6 +108,11 @@ config TARGET_OMAP3_LOGIC config TARGET_NOKIA_RX51 bool "Nokia RX51" select POSITION_INDEPENDENT + select SKIP_LOWLEVEL_INIT + select SUPPORT_PASSING_ATAGS + select CMDLINE_TAG + select INITRD_TAG + select REVISION_TAG config TARGET_TAO3530 bool "TAO3530" diff --git a/board/nokia/rx51/Kconfig b/board/nokia/rx51/Kconfig index ec6a571a2263..7cf05077dad1 100644 --- a/board/nokia/rx51/Kconfig +++ b/board/nokia/rx51/Kconfig @@ -1,5 +1,8 @@ if TARGET_NOKIA_RX51 +config NR_DRAM_BANKS + default 2 + config SYS_BOARD default "rx51" @@ -9,4 +12,7 @@ config SYS_VENDOR config SYS_CONFIG_NAME default "nokia_rx51" +config SYS_PROMPT + default "Nokia RX-51 # " + endif diff --git a/configs/nokia_rx51_defconfig b/configs/nokia_rx51_defconfig index 3365f7ae58df..4414ebc25e36 100644 --- a/configs/nokia_rx51_defconfig +++ b/configs/nokia_rx51_defconfig @@ -1,16 +1,10 @@ CONFIG_ARM=y -CONFIG_SKIP_LOWLEVEL_INIT=y # CONFIG_SYS_THUMB_BUILD is not set CONFIG_SYS_L2CACHE_OFF=y CONFIG_ARCH_OMAP2PLUS=y -CONFIG_SUPPORT_PASSING_ATAGS=y -CONFIG_CMDLINE_TAG=y -CONFIG_INITRD_TAG=y -CONFIG_REVISION_TAG=y CONFIG_STATIC_MACH_TYPE=y CONFIG_MACH_TYPE=1955 CONFIG_SYS_MALLOC_LEN=0xc0000 -CONFIG_NR_DRAM_BANKS=2 CONFIG_TARGET_NOKIA_RX51=y CONFIG_SYS_LOAD_ADDR=0x80000000 CONFIG_OPTIMIZE_INLINING=y @@ -26,7 +20,6 @@ CONFIG_USE_PREBOOT=y CONFIG_PREBOOT="run preboot" # CONFIG_SYS_DEVICE_NULLDEV is not set CONFIG_HUSH_PARSER=y -CONFIG_SYS_PROMPT="Nokia RX-51 # " # CONFIG_CMD_BDI is not set CONFIG_CMD_BOOTZ=y # CONFIG_BOOTM_NETBSD is not set