From patchwork Tue Dec 20 18:38:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martyn Welch X-Patchwork-Id: 1717990 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=FazFLQAl; dkim-atps=neutral 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nc5280nH5z1ydd for ; Wed, 21 Dec 2022 05:38:56 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 025ED852ED; Tue, 20 Dec 2022 19:38:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=collabora.com 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=collabora.com header.i=@collabora.com header.b="FazFLQAl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4D3B185174; Tue, 20 Dec 2022 19:38:36 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B5842851A2 for ; Tue, 20 Dec 2022 19:38:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=martyn.welch@collabora.com Received: from pan.home (unknown [IPv6:2a00:23c6:c311:3401:be81:c5f8:bf74:3e79]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: martyn) by madras.collabora.co.uk (Postfix) with ESMTPSA id 22CFA6602CAD; Tue, 20 Dec 2022 18:38:33 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1671561513; bh=dl35GayrfjsLtgnMcrpAYzEb7a4jzAIwrNv6yxVj5UE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FazFLQAl3BDKniN9xS0QU40UToO+t0tPkQjfSR3pBVhephp6ceXiaOZsTJbWMxGVB RpHx8M4OnD87Kup2UbO2NuW8h0TwcigkhZ1+MOXK1Dls5ToItQlIoZEQ1exASJ/cAh kihTK41KZ1NatTjSl4QRMvwpPdfF1V/aWfG0bqgnBpPwXe69SIwH4shISUTPbSvVst 7Cl3DBE+43nY+8M/kWUC1MSM4LQPxaIMzEUagdIZJBCiLiW7RySINRS1rSilHGYmO/ bh/MJpgW6slAwL77MLLmniUn15iwY+8png8R9Xm6sxk7JjyXit9IJvmea1SPEkHlS6 NiMrCqdydfwrQ== From: Martyn Welch To: Dave Gerlach Cc: u-boot@lists.denx.de, Martyn Welch Subject: [PATCH 1/2] arm64:mach-k3 am625_init: Correct boot mode detection Date: Tue, 20 Dec 2022 18:38:18 +0000 Message-Id: <20221220183819.515667-2-martyn.welch@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221220183819.515667-1-martyn.welch@collabora.com> References: <20221220183819.515667-1-martyn.welch@collabora.com> 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 The boot mode detection assumes that BOOT_DEVICE_MMC2 should always result in MMCSD_MODE_FS, but MMCSD_MODE_RAW is also a valid option for this port. The current logic also avoids looking at the bootmode pin strapping, which should be the primary means of determining whether a device is being booted in MMCSD_MODE_EMMCBOOT mode. Switch around the logic to check the boot mode to determine whether the eMMC boot mode is expected or MMC/SD boot mode. From there we can look at the boot mode config if in MMC/SD boot mode to determine whether to attempt RAW or FS based booting. This change allows U-Boot to also be successfully booted from RAW offsets in addition to from a filesystem. Signed-off-by: Martyn Welch --- arch/arm/mach-k3/am625_init.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-k3/am625_init.c b/arch/arm/mach-k3/am625_init.c index da2229d0bf..a91c15ca4e 100644 --- a/arch/arm/mach-k3/am625_init.c +++ b/arch/arm/mach-k3/am625_init.c @@ -173,21 +173,20 @@ void board_init_f(ulong dummy) u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device) { u32 devstat = readl(CTRLMMR_MAIN_DEVSTAT); + u32 bootmode = (devstat & MAIN_DEVSTAT_PRIMARY_BOOTMODE_MASK) >> + MAIN_DEVSTAT_PRIMARY_BOOTMODE_SHIFT; u32 bootmode_cfg = (devstat & MAIN_DEVSTAT_PRIMARY_BOOTMODE_CFG_MASK) >> MAIN_DEVSTAT_PRIMARY_BOOTMODE_CFG_SHIFT; - switch (boot_device) { - case BOOT_DEVICE_MMC1: - if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK) >> - MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_SHIFT) - return MMCSD_MODE_EMMCBOOT; - return MMCSD_MODE_FS; - - case BOOT_DEVICE_MMC2: - return MMCSD_MODE_FS; + switch (bootmode) { + case BOOT_DEVICE_EMMC: + return MMCSD_MODE_EMMCBOOT; + case BOOT_DEVICE_MMC: + if (bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_FS_RAW_MASK) + return MMCSD_MODE_RAW; default: - return MMCSD_MODE_RAW; + return MMCSD_MODE_FS; } } From patchwork Tue Dec 20 18:38:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martyn Welch X-Patchwork-Id: 1717991 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=F2goqzdr; dkim-atps=neutral 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nc52X45k4z1ydd for ; Wed, 21 Dec 2022 05:39:16 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8C173852F8; Tue, 20 Dec 2022 19:38:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=collabora.com 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=collabora.com header.i=@collabora.com header.b="F2goqzdr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7F03F853B9; Tue, 20 Dec 2022 19:38:38 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E6A92851E4 for ; Tue, 20 Dec 2022 19:38:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=martyn.welch@collabora.com Received: from pan.home (unknown [IPv6:2a00:23c6:c311:3401:be81:c5f8:bf74:3e79]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: martyn) by madras.collabora.co.uk (Postfix) with ESMTPSA id 5CEDF6602CAE; Tue, 20 Dec 2022 18:38:33 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1671561513; bh=l3dsqDgfrJgXTpeEpIcccS1OvAnKJgaiF5E569F0IqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F2goqzdrmeQyCk1v/fjt4gp6f9v3VQH8xHPMzllR6vl+LcDddXQO14pvkCx2nSdB7 xUE64jTFRyuO79Z3+Lc7Coott8rXK97DGdvFhMTQrTXLo01kcdRHKkpWayK35KJ3lz 041DcaFlc9c4X8OUUXz7uOfS6X0eYzMWRo04O2kDDkLC7jP2hyFAGKTVAaAtNjM2yL EU1osT/ErtsGoOrRUjH70QWPL33amgbVBUgVpLcNE8Cdap4xmm2G/pqNmnEZ2+s38I 4xc/MOpGcpHf8LrUkXhS1H9LbxgGvH78PGK23SQjWwWmKXLWZDCiFHlazdb4Gd0pLS 0TpQ/7C72ToYA== From: Martyn Welch To: Dave Gerlach Cc: u-boot@lists.denx.de, Martyn Welch Subject: [PATCH 2/2] configs: Enable distroboot on am625 Date: Tue, 20 Dec 2022 18:38:19 +0000 Message-Id: <20221220183819.515667-3-martyn.welch@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221220183819.515667-1-martyn.welch@collabora.com> References: <20221220183819.515667-1-martyn.welch@collabora.com> 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 TI boards use a custom (though faily common to TI boards) mechanism for booting Linux. We would like to use the "distroboot" approach. Enable distroboot as a further option to use for booting on am625 should the existing options fail. Signed-off-by: Martyn Welch --- configs/am62x_evm_a53_defconfig | 2 +- include/configs/am62x_evm.h | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig index ff258bcbc1..ea248090e4 100644 --- a/configs/am62x_evm_a53_defconfig +++ b/configs/am62x_evm_a53_defconfig @@ -20,7 +20,7 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80480000 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000 -CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern" +CONFIG_BOOTCOMMAND="run findfdt; run envboot; run init_${boot}; run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern; setenv fdtfile ti/${name_fdt}; run distro_bootcmd" CONFIG_SPL_MAX_SIZE=0x58000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y CONFIG_SPL_BSS_START_ADDR=0x80a00000 diff --git a/include/configs/am62x_evm.h b/include/configs/am62x_evm.h index 78201adc07..335c27c5cb 100644 --- a/include/configs/am62x_evm.h +++ b/include/configs/am62x_evm.h @@ -15,6 +15,29 @@ /* DDR Configuration */ #define CONFIG_SYS_SDRAM_BASE1 0x880000000 +#ifdef CONFIG_CMD_MMC +#define DISTRO_BOOT_DEV_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1) +#else +#define DISTRO_BOOT_DEV_MMC(func) +#endif + +#ifdef CONFIG_CMD_PXE +#define DISTRO_BOOT_DEV_PXE(func) func(PXE, pxe, na) +#else +#define DISTRO_BOOT_DEV_PXE(func) +#endif + +#ifdef CONFIG_CMD_DHCP +#define DISTRO_BOOT_DEV_DHCP(func) func(DHCP, dhcp, na) +#else +#define DISTRO_BOOT_DEV_DHCP(func) +#endif + +#define BOOT_TARGET_DEVICES(func) \ + DISTRO_BOOT_DEV_MMC(func) \ + DISTRO_BOOT_DEV_PXE(func) \ + DISTRO_BOOT_DEV_DHCP(func) + #define PARTS_DEFAULT \ /* Linux partitions */ \ "name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}\0" @@ -59,7 +82,8 @@ DEFAULT_LINUX_BOOT_ENV \ DEFAULT_MMC_TI_ARGS \ EXTRA_ENV_AM625_BOARD_SETTINGS \ - EXTRA_ENV_AM625_BOARD_SETTINGS_MMC + EXTRA_ENV_AM625_BOARD_SETTINGS_MMC \ + BOOTENV /* Now for the remaining common defines */ #include