From patchwork Tue Jan 9 21:01:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Spinrath X-Patchwork-Id: 857733 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zGPjt4TF0z9s0g for ; Wed, 10 Jan 2018 08:02:58 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 4B3F2C22044; Tue, 9 Jan 2018 21:02:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id BDE89C21F88; Tue, 9 Jan 2018 21:01:58 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 47CD7C21F74; Tue, 9 Jan 2018 21:01:56 +0000 (UTC) Received: from mail-out-1.itc.rwth-aachen.de (mail-out-1.itc.rwth-aachen.de [134.130.5.46]) by lists.denx.de (Postfix) with ESMTPS id C2521C21F74 for ; Tue, 9 Jan 2018 21:01:55 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2CGCADtLFVa/6EagoZeHQEBBQELAYNAggEHnQKBW5lqCoU7hDxDFAEBAQEBAQEBAWsohiMwbiABDQWKMQSxPoo4AQEBAQEFAQEBAQEBIgkBhBaCFYNpDIYph2oFo1+BFqBFh29IliQCAgICCQIagTw2IoFQcIJ7glQcgWh3ihwBgRYBAQE X-IPAS-Result: A2CGCADtLFVa/6EagoZeHQEBBQELAYNAggEHnQKBW5lqCoU7hDxDFAEBAQEBAQEBAWsohiMwbiABDQWKMQSxPoo4AQEBAQEFAQEBAQEBIgkBhBaCFYNpDIYph2oFo1+BFqBFh29IliQCAgICCQIagTw2IoFQcIJ7glQcgWh3ihwBgRYBAQE X-IronPort-AV: E=Sophos;i="5.46,336,1511823600"; d="scan'208";a="32844364" Received: from rwthex-s3-b.rwth-ad.de ([134.130.26.161]) by mail-in-1.itc.rwth-aachen.de with ESMTP; 09 Jan 2018 22:01:55 +0100 Received: from snowflake.lan (37.24.154.84) by rwthex-s3-b.rwth-ad.de (2002:8682:1aa1::8682:1aa1) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26; Tue, 9 Jan 2018 22:01:51 +0100 From: To: , , Date: Tue, 9 Jan 2018 22:01:35 +0100 X-Mailer: git-send-email 2.15.1 MIME-Version: 1.0 X-Originating-IP: [37.24.154.84] X-ClientProxiedBy: rwthex-s2-a.rwth-ad.de (2002:8682:1a9a::8682:1a9a) To rwthex-s3-b.rwth-ad.de (2002:8682:1aa1::8682:1aa1) Message-ID: Cc: u-boot@lists.denx.de, christopher.spinrath@rwth-aachen.de Subject: [U-Boot] [PATCH 1/2] ARM: imx: cm_fx6: export board and soc info to env X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" From: Christopher Spinrath Like many other i.MX6 based boards, there are multiple variants of the cm-fx6 module featuring different SoC variants. Furthermore, the module can be paired with multiple baseboards. At the same time modern distribution like Fedora require U-Boot to select a proper devicetree which depends on the SoC variant and the baseboard. Thus, export the SoC variant and the actual board to the environment following the conventions of other i.MX6 devices (e.g. the NXP boards) such that the environment can select a devicetree file to load. For now, we only know for sure that the cm-fx6 module and the SB-fx6m baseboard amount to a Utilite Computer variant (depending on the SoC). Further combinations may be added in the future; e.g. CompuLab's evaluation board once someone can verify the identification string stored in its eeprom. Signed-off-by: Christopher Spinrath Reviewed-by: Stefano Babic --- arch/arm/mach-imx/mx6/Kconfig | 1 + board/compulab/cm_fx6/cm_fx6.c | 21 +++++++++++++++++++++ include/configs/cm_fx6.h | 1 + 3 files changed, 23 insertions(+) diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig index 567a6a6bf5..057fca31ea 100644 --- a/arch/arm/mach-imx/mx6/Kconfig +++ b/arch/arm/mach-imx/mx6/Kconfig @@ -130,6 +130,7 @@ config TARGET_CM_FX6 bool "CM-FX6" select SUPPORT_SPL select MX6QDL + select BOARD_LATE_INIT select DM select DM_SERIAL select DM_GPIO diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c index 620c3f2d0d..673de03071 100644 --- a/board/compulab/cm_fx6/cm_fx6.c +++ b/board/compulab/cm_fx6/cm_fx6.c @@ -621,6 +621,27 @@ int board_init(void) return 0; } +int board_late_init(void) +{ +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG + char baseboard_name[16]; + int err; + + if (is_mx6dq()) + env_set("board_rev", "MX6Q"); + else if (is_mx6dl()) + env_set("board_rev", "MX6DL"); + + err = cl_eeprom_get_product_name((uchar *)baseboard_name, 0); + if (err) + return 0; + + if (!strncmp("SB-FX6m", baseboard_name, 7)) + env_set("board_name", "Utilite"); +#endif + return 0; +} + int checkboard(void) { puts("Board: CM-FX6\n"); diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h index ec3e6e6ca5..cb71ea8811 100644 --- a/include/configs/cm_fx6.h +++ b/include/configs/cm_fx6.h @@ -67,6 +67,7 @@ #define CONFIG_ENV_OFFSET (768 * 1024) #ifndef CONFIG_SPL_BUILD +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG #define CONFIG_EXTRA_ENV_SETTINGS \ "fdt_high=0xffffffff\0" \ "initrd_high=0xffffffff\0" \ From patchwork Tue Jan 9 21:01:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Spinrath X-Patchwork-Id: 857730 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zGPj03y0Rz9s0g for ; Wed, 10 Jan 2018 08:02:11 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 9EABAC22056; Tue, 9 Jan 2018 21:02:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id DDFB6C21FB1; Tue, 9 Jan 2018 21:01:57 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3DD3BC21F88; Tue, 9 Jan 2018 21:01:56 +0000 (UTC) Received: from mail-out-1.itc.rwth-aachen.de (mail-out-1.itc.rwth-aachen.de [134.130.5.46]) by lists.denx.de (Postfix) with ESMTPS id C73A8C21FA6 for ; Tue, 9 Jan 2018 21:01:55 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2BSBwDtLFVa/6EagoZeHAEBAQQBAQoBAYMQMIIBB50CgVsnmUMKhTsChDpDFAEBAQEBAQEBAWsohSQGeRAgMT0aBgENBYoxBLE+ijgBAQEBAQEEAQEBAQEBAQEgCQGEFoIVg2kMhimBN4YzBZImkTmBFqBFh29IliQCAgICCQIagTw2IoFQcIJ7hFh3iGiBNAGBFgEBAQ X-IPAS-Result: A2BSBwDtLFVa/6EagoZeHAEBAQQBAQoBAYMQMIIBB50CgVsnmUMKhTsChDpDFAEBAQEBAQEBAWsohSQGeRAgMT0aBgENBYoxBLE+ijgBAQEBAQEEAQEBAQEBAQEgCQGEFoIVg2kMhimBN4YzBZImkTmBFqBFh29IliQCAgICCQIagTw2IoFQcIJ7hFh3iGiBNAGBFgEBAQ X-IronPort-AV: E=Sophos;i="5.46,336,1511823600"; d="scan'208";a="32844365" Received: from rwthex-s3-b.rwth-ad.de ([134.130.26.161]) by mail-in-1.itc.rwth-aachen.de with ESMTP; 09 Jan 2018 22:01:55 +0100 Received: from snowflake.lan (37.24.154.84) by rwthex-s3-b.rwth-ad.de (2002:8682:1aa1::8682:1aa1) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26; Tue, 9 Jan 2018 22:01:51 +0100 From: To: , , Date: Tue, 9 Jan 2018 22:01:36 +0100 X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180109210136.561-1-christopher.spinrath@rwth-aachen.de> References: <20180109210136.561-1-christopher.spinrath@rwth-aachen.de> MIME-Version: 1.0 X-Originating-IP: [37.24.154.84] X-ClientProxiedBy: rwthex-s2-a.rwth-ad.de (2002:8682:1a9a::8682:1a9a) To rwthex-s3-b.rwth-ad.de (2002:8682:1aa1::8682:1aa1) Message-ID: Cc: u-boot@lists.denx.de, christopher.spinrath@rwth-aachen.de Subject: [U-Boot] [PATCH 2/2] ARM: imx: cm_fx6: env: try to determine dtb to use X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" From: Christopher Spinrath Some distributions like Fedora expect U-Boot to select a proper devicetree. Since there are several variants of the cm-fx6 module featuring different SoC variants and the module can be paired with several baseboards, it is not viable to hardcode a filename. Instead, follow the lead of other i.MX6 based devices and try to determine the devicetree to use with the help of the board name and the SoC variant exported by the board code, before calling the distro bootcommand. For now, only for the Utilite Pro a proper devicetree filename is known but further variants of the Utilite Computer or other devices based on the cm-fx6 module may be added in the future. Signed-off-by: Christopher Spinrath --- configs/cm_fx6_defconfig | 2 +- include/configs/cm_fx6.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig index 33e610ccb4..6b1c0a823c 100644 --- a/configs/cm_fx6_defconfig +++ b/configs/cm_fx6_defconfig @@ -16,7 +16,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" CONFIG_BOOTDELAY=3 -CONFIG_BOOTCOMMAND="run distro_bootcmd; run legacy_bootcmd" +CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd; run legacy_bootcmd" CONFIG_SPL=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x80 CONFIG_SPL_I2C_SUPPORT=y diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h index cb71ea8811..da870b9baa 100644 --- a/include/configs/cm_fx6.h +++ b/include/configs/cm_fx6.h @@ -76,6 +76,7 @@ "kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \ "pxefile_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \ "scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \ + "fdtfile=undefined\0" \ "stdin=serial,usbkbd\0" \ "stdout=serial,vga\0" \ "stderr=serial,vga\0" \ @@ -153,6 +154,11 @@ "fi;" \ "run setupnandboot;" \ "run nandboot;\0" \ + "findfdt="\ + "if test $board_name = Utilite && test $board_rev = MX6Q ; then " \ + "setenv fdtfile imx6q-utilite-pro.dtb; fi; " \ + "if test $fdtfile = undefined; then " \ + "echo WARNING: Could not determine dtb to use; fi; \0" \ BOOTENV #define CONFIG_PREBOOT "usb start;sf probe"