Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC91FC76196 for ; Sun, 2 Apr 2023 20:29:45 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A4F7085BF8; Sun, 2 Apr 2023 22:29:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="PGaayVUq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 538AB858FF; Sun, 2 Apr 2023 22:29:20 +0200 (CEST) Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AA54885CD8 for ; Sun, 2 Apr 2023 22:29:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pj1-x1035.google.com with SMTP id fy10-20020a17090b020a00b0023b4bcf0727so28527724pjb.0 for ; Sun, 02 Apr 2023 13:29:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1680467353; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RKODaPaX0en5q5e2N6NL8mj28SrBw5SvucDILcjBDJM=; b=PGaayVUq4zoolJEzDkmErBax3gyrouWPf9S6gvwTwFh+hJpD58Zy7h2N7MNwHe4xRa e0Kfjp9UuqmLsyfZyUoOfk8HXlmlQvT74q/wSKiPeMaNEk25okSZnbO3neD0b8GFgRNo BuJdhAql2Gv+wwtWve5BZlAv33Fp7T//cMaC4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680467353; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RKODaPaX0en5q5e2N6NL8mj28SrBw5SvucDILcjBDJM=; b=xGUostwPPaAAigwlHxzz5hbiqGs2Y7xvTTtMGISB8DbWhUBIVzZWu8l3i9x7uCZyhX i9b1YRyhwl229NZrzpVOVa8pLFopWMfe1ODOt0jKPFLk9RcjLMjlAq8prSX4UVo7+2ei r8FZ5C7ydU77wC3jNImkMZhaaViAOjT99H5V2ZEsYcL7svQCYAXMZfp003qJgW70G1Pv HGc/gj4eeIhJACV6OfjBiPyYPYhS7w51BFDSB89dF7bwMrTTlYrTqabAydJo+nLxnDam G6XD1ZC0tgpgk1IfXFVhcGmi6daUlk/UGMvXzsuPdWQ5hnrqQ8LCgWrGm3SFf6+JrAqZ 32zA== X-Gm-Message-State: AAQBX9cWqJuMJ+K5CI72toyXiCN0daVeqxbiNsnzuMVXSFvXPmPJxS9q 0WpnKNKQ01X6Qo3uCIP2sdycqdsXPZQlPMoZKZ8= X-Google-Smtp-Source: AKy350ZKkz5egNhZSUhd4C/ShP1qzcdzImFk8DH02Wy+V1/itZGNfgvBr9R4TfxrtSPzr/No+JFufg== X-Received: by 2002:a05:6a20:cd5a:b0:e4:d395:5ce6 with SMTP id hn26-20020a056a20cd5a00b000e4d3955ce6mr6404978pzb.25.1680467352764; Sun, 02 Apr 2023 13:29:12 -0700 (PDT) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id k9-20020aa78209000000b0062505afff9fsm4951635pfi.126.2023.04.02.13.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Apr 2023 13:29:12 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Albert Aribaud , Matthias Brugger , Peter Robinson , Stephen Warren , Stephen Warren Subject: [PATCH v2 3/3] arm: rpi: Switch to a text environment Date: Mon, 3 Apr 2023 08:28:48 +1200 Message-Id: <20230402202848.2342265-4-sjg@chromium.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230402202848.2342265-1-sjg@chromium.org> References: <20230402202848.2342265-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.8 at phobos.denx.de X-Virus-Status: Clean Use the new environment format so we can drop most of the config.h file. Signed-off-by: Simon Glass --- (no changes since v1) board/raspberrypi/rpi/rpi.env | 77 ++++++++++++++++++++++++++ include/configs/rpi.h | 100 ---------------------------------- 2 files changed, 77 insertions(+), 100 deletions(-) create mode 100644 board/raspberrypi/rpi/rpi.env diff --git a/board/raspberrypi/rpi/rpi.env b/board/raspberrypi/rpi/rpi.env new file mode 100644 index 000000000000..30228285edde --- /dev/null +++ b/board/raspberrypi/rpi/rpi.env @@ -0,0 +1,77 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +/* environment for Raspberry Pi boards */ + +dhcpuboot=usb start; dhcp u-boot.uimg; bootm + +/* Environment */ +stdin=serial,usbkbd +stdout=serial,vidconsole +stderr=serial,vidconsole + +/* DFU over USB/UDC */ +#ifdef CONFIG_CMD_DFU +dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1; + config.txt fat 0 1; +#ifdef CONFIG_ARM64 +dfu_alt_info+=Image fat 0 1 +#else +dfu_alt_info+=zImage fat 0 1 +#endif +#endif /* CONFIG_CMD_DFU */ + +/* + * Memory layout for where various images get loaded by boot scripts: + * + * I suspect address 0 is used as the SMP pen on the RPi2, so avoid this. + * + * Older versions of the boot firmware place the firmware-loaded DTB at 0x100, + * newer versions place it in high memory. So prevent U-Boot from doing its own + * DTB + initrd relocation so that we won't accidentally relocate the initrd + * over the firmware-loaded DTB and generally try to lay out things starting + * from the bottom of RAM. + * + * kernel_addr_r has different constraints on ARM and Aarch64. For 32-bit ARM, + * it must be within the first 128M of RAM in order for the kernel's + * CONFIG_AUTO_ZRELADDR option to work. The kernel itself will be decompressed + * to 0x8000 but the decompressor clobbers 0x4000-0x8000 as well. The + * decompressor also likes to relocate itself to right past the end of the + * decompressed kernel, so in total the sum of the compressed and + * decompressed kernel needs to be reserved. + * + * For Aarch64, the kernel image is uncompressed and must be loaded at + * text_offset bytes (specified in the header of the Image) into a 2MB + * boundary. The 'booti' command relocates the image if necessary. Linux uses + * a default text_offset of 0x80000. In summary, loading at 0x80000 + * satisfies all these constraints and reserving memory up to 0x02400000 + * permits fairly large (roughly 36M) kernels. + * + * scriptaddr and pxefile_addr_r can be pretty much anywhere that doesn't + * conflict with something else. Reserving 1M for each of them at + * 0x02400000-0x02500000 and 0x02500000-0x02600000 should be plenty. + * + * On ARM, both the DTB and any possible initrd must be loaded such that they + * fit inside the lowmem mapping in Linux. In practice, this usually means not + * more than ~700M away from the start of the kernel image but this number can + * be larger OR smaller depending on e.g. the 'vmalloc=xxxM' command line + * parameter given to the kernel. So reserving memory from low to high + * satisfies this constraint again. Reserving 1M at 0x02600000-0x02700000 for + * the DTB leaves rest of the free RAM to the initrd starting at 0x02700000. + * Even with the smallest possible CPU-GPU memory split of the CPU getting + * only 64M, the remaining 25M starting at 0x02700000 should allow quite + * large initrds before they start colliding with U-Boot. + */ +#ifdef CONFIG_ARM64 +fdt_high=ffffffffffffffff +initrd_high=ffffffffffffffff +#else +fdt_high=ffffffff +initrd_high=ffffffff +#endif +kernel_addr_r=0x00080000 +scriptaddr=0x02400000 +pxefile_addr_r=0x02500000 +fdt_addr_r=0x02600000 +ramdisk_addr_r=0x02700000 + +boot_targets=mmc usb pxe dhcp diff --git a/include/configs/rpi.h b/include/configs/rpi.h index 4160db2d8e14..8e56bdc84a89 100644 --- a/include/configs/rpi.h +++ b/include/configs/rpi.h @@ -13,8 +13,6 @@ #include #endif -/* Architecture, CPU, etc.*/ - /* Use SoC timer for AArch32, but architected timer for AArch64 */ #ifndef CONFIG_ARM64 #define CFG_SYS_TIMER_RATE 1000000 @@ -33,102 +31,4 @@ */ #define CFG_SYS_SDRAM_SIZE SZ_128M -/* Devices */ -/* LCD */ - -/* DFU over USB/UDC */ -#ifdef CONFIG_CMD_DFU -#ifdef CONFIG_ARM64 -#define KERNEL_FILENAME "Image" -#else -#define KERNEL_FILENAME "zImage" -#endif - -#define ENV_DFU_SETTINGS \ - "dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1;" \ - "config.txt fat 0 1;" \ - KERNEL_FILENAME " fat 0 1\0" -#else -#define ENV_DFU_SETTINGS "" -#endif - -/* Console configuration */ - -/* Environment */ - -/* Shell */ - -/* Environment */ -#define ENV_DEVICE_SETTINGS \ - "stdin=serial,usbkbd\0" \ - "stdout=serial,vidconsole\0" \ - "stderr=serial,vidconsole\0" - -#ifdef CONFIG_ARM64 -#define FDT_HIGH "ffffffffffffffff" -#define INITRD_HIGH "ffffffffffffffff" -#else -#define FDT_HIGH "ffffffff" -#define INITRD_HIGH "ffffffff" -#endif - -/* - * Memory layout for where various images get loaded by boot scripts: - * - * I suspect address 0 is used as the SMP pen on the RPi2, so avoid this. - * - * Older versions of the boot firmware place the firmware-loaded DTB at 0x100, - * newer versions place it in high memory. So prevent U-Boot from doing its own - * DTB + initrd relocation so that we won't accidentally relocate the initrd - * over the firmware-loaded DTB and generally try to lay out things starting - * from the bottom of RAM. - * - * kernel_addr_r has different constraints on ARM and Aarch64. For 32-bit ARM, - * it must be within the first 128M of RAM in order for the kernel's - * CONFIG_AUTO_ZRELADDR option to work. The kernel itself will be decompressed - * to 0x8000 but the decompressor clobbers 0x4000-0x8000 as well. The - * decompressor also likes to relocate itself to right past the end of the - * decompressed kernel, so in total the sum of the compressed and and - * decompressed kernel needs to be reserved. - * - * For Aarch64, the kernel image is uncompressed and must be loaded at - * text_offset bytes (specified in the header of the Image) into a 2MB - * boundary. The 'booti' command relocates the image if necessary. Linux uses - * a default text_offset of 0x80000. In summary, loading at 0x80000 - * satisfies all these constraints and reserving memory up to 0x02400000 - * permits fairly large (roughly 36M) kernels. - * - * scriptaddr and pxefile_addr_r can be pretty much anywhere that doesn't - * conflict with something else. Reserving 1M for each of them at - * 0x02400000-0x02500000 and 0x02500000-0x02600000 should be plenty. - * - * On ARM, both the DTB and any possible initrd must be loaded such that they - * fit inside the lowmem mapping in Linux. In practice, this usually means not - * more than ~700M away from the start of the kernel image but this number can - * be larger OR smaller depending on e.g. the 'vmalloc=xxxM' command line - * parameter given to the kernel. So reserving memory from low to high - * satisfies this constraint again. Reserving 1M at 0x02600000-0x02700000 for - * the DTB leaves rest of the free RAM to the initrd starting at 0x02700000. - * Even with the smallest possible CPU-GPU memory split of the CPU getting - * only 64M, the remaining 25M starting at 0x02700000 should allow quite - * large initrds before they start colliding with U-Boot. - */ -#define ENV_MEM_LAYOUT_SETTINGS \ - "fdt_high=" FDT_HIGH "\0" \ - "initrd_high=" INITRD_HIGH "\0" \ - "kernel_addr_r=0x00080000\0" \ - "scriptaddr=0x02400000\0" \ - "pxefile_addr_r=0x02500000\0" \ - "fdt_addr_r=0x02600000\0" \ - "ramdisk_addr_r=0x02700000\0" - -#define BOOT_TARGETS "mmc usb pxe dhcp" - -#define CFG_EXTRA_ENV_SETTINGS \ - "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \ - ENV_DEVICE_SETTINGS \ - ENV_DFU_SETTINGS \ - ENV_MEM_LAYOUT_SETTINGS \ - "boot_targets=" BOOT_TARGETS "\0" - #endif -- 2.40.0.348.gf938b09366-goog