From patchwork Tue Jun 30 02:36:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 489468 X-Patchwork-Delegate: sbabic@denx.de 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 0227714076E for ; Tue, 30 Jun 2015 12:37:29 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 339304B6F2; Tue, 30 Jun 2015 04:37:17 +0200 (CEST) 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 FFlqNivYEF-I; Tue, 30 Jun 2015 04:37:17 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 40E1B4B6F4; Tue, 30 Jun 2015 04:37:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0A95C4B6D1 for ; Tue, 30 Jun 2015 04:36:58 +0200 (CEST) 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 UMQp1dbsOUn8 for ; Tue, 30 Jun 2015 04:36:57 +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 na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0140.outbound.protection.outlook.com [157.56.111.140]) by theia.denx.de (Postfix) with ESMTPS id 5F2204B6BB for ; Tue, 30 Jun 2015 04:36:48 +0200 (CEST) Received: from CH1PR03CA003.namprd03.prod.outlook.com (10.255.156.148) by BL2PR03MB242.namprd03.prod.outlook.com (10.255.231.18) with Microsoft SMTP Server (TLS) id 15.1.207.12; Tue, 30 Jun 2015 02:36:46 +0000 Received: from BN1AFFO11FD016.protection.gbl (207.46.163.143) by CH1PR03CA003.outlook.office365.com (10.255.156.148) with Microsoft SMTP Server (TLS) id 15.1.201.16 via Frontend Transport; Tue, 30 Jun 2015 02:36:46 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD016.mail.protection.outlook.com (10.58.52.76) with Microsoft SMTP Server (TLS) id 15.1.201.10 via Frontend Transport; Tue, 30 Jun 2015 02:36:43 +0000 Received: from linux-jyl1.ap.freescale.net (b51431-11.ap.freescale.net [10.193.102.204]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t5U2aMia016710; Mon, 29 Jun 2015 19:36:41 -0700 From: Peng Fan To: Date: Tue, 30 Jun 2015 10:36:15 +0800 Message-ID: <1435631776-9733-5-git-send-email-Peng.Fan@freescale.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1435631776-9733-1-git-send-email-Peng.Fan@freescale.com> References: <1435631776-9733-1-git-send-email-Peng.Fan@freescale.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD016; 1:OjEyGexc6UEUC+5VHD/E/qUJKHJ7x67ayCLxc+2ITuuHXHFwRpnaVA++GZkn3U78lmoj5/4x2VjJu1v8Lu+RB0p/RuFiuGTobqwnfQfmQPNY014KG3p1EeLqkTqkdj8RHUpDH07zUOVdwRp5i3XU1ZD7y30lVHkV51HK8zisvEOJiIv0f+461fvsHcPY4ug9+VYPmPsGdAO0plNvbA1x/7lDbSDszoSetpke/f7txqrLWYcVXyHUhLtPG8QwAL5RxpfFS1XUxt7D7kSLOpBC7a7MMyRQ/mVHpiHuhoPYUBSPVp2+Vi6hbxRiTp91UMf68ouj7C9c8pSy0993+8IqBg== X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(339900001)(199003)(189002)(189998001)(47776003)(104016003)(2351001)(107886002)(5001960100002)(46102003)(110136002)(36756003)(6806004)(105606002)(50986999)(76176999)(85426001)(2950100001)(50226001)(5820100001)(19580395003)(23676002)(19580405001)(87936001)(50466002)(106466001)(62966003)(86362001)(575784001)(77096005)(77156002)(92566002)(32563001)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BL2PR03MB242; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB242; 2:4+Fg2Y+lHWo3Gl557eiozYDuk8xBY+CQocAhAkKFEgM1irsiGSRtsUtn9hnDzvny; 3:h6Y89a5GM8NpCjlBD0FEhMGB5sNGJIE1ZX1lmpylQ3DX3x4SbZ8dtcznxibsCOJFlYaJ4b9oufS2bVDZCozWBKEh+Z3vFJxtpOxPP56xX6RebymIQvbN73eligKc53+jmIyJq/+tNPF+cVJ87eIGA3zNIZxYML7Jpgz0sT/iNNynG0HBd8F9rIs66uBa4/tMWeHOLMI85+wn1zjBHX8fD28N/sdWvGXx/LGvCtskM4I=; 25:uFWDPC46dB6WPKlzy1QherFu+9vlg3+HKfmM04VX5aBL/Ldc9Rls+sdMESSPu5Xdqv5wJ241DnZqfXj1jGMOUCV7lTeRTgXPU+PRiBhAA6sPZqsblrdQsS4B0fu7eQvt8k4IEHxlXsbrNM1ItQ4WhPahp0Ziy4uqGod74y02GXoo9Zh7Zvp5x8xlP4sRHI8sQKFaN2umd1kNAmA1GiPoLYwP8TETMi52MTAqOEB4H6BfjHMorxWIFtmACRk5yMs4mDPzidxvT0aLmWJCpJTWNaXUnY6UkGwPi9+p4OKIq80=; 20:8+nSPM02lR96ZTjqVjkhKKrvKW8cQ9tCy5OGH/EnQJO9GU6J2bhkTaDycKSAGBIr6ZVI9vkrEvLTqeOqTDMIwWapAIMQbK09GSyVWhtQCoUq7gvZHddcGYakoa4NKE76yxcCO+m/se0T8L0jvpXsdOMOaO/O7IDMx2ZsdIh276Wh5X78TpPijFJiFDNa4dgGyrmjrjxwRItEe0LilACjuzZ1RClC491X4YJNidUMdpr4c/H1Ggidmtgcnh7/szN31hlw34iXiJj/WIuAtWhW/DeYS49GBnDYaRyKWvxoLnLKnfQwOA0bgPTr2t4FVWR5qXbOJjFUX1UVQKl+kX/HRq89/UTR4gZBoteyaYsZQbg= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB242; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BL2PR03MB242; BCL:0; PCL:0; RULEID:; SRVR:BL2PR03MB242; X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB242; 4:bFim2xHz9i6Mz0HUfzQKXKc4wdXa/M6Ho3TbmWKm7Yk05N5hrCkeTrd/CBIo7QXWiHbzTkUOhulaLJtib48O9V9+nMvHhuQYANPwS/IeBp0MdtPLZCXGwJyGWuNP3kNr1NFO/EbZceS4MIpIya5+hjZKbhnh0vOIeTqLXmhbewT2UjQ7TbqX+hHd3g57DgzLgk8DmRwjcXKWV5j7vn+YKDSXsaAJKRHiSxNy3kgN+X1CQtAoX288S7MekBxaCaargw+0/0Cb3KP0jlHoBCRsUS5umA+U4mM6DKI4hAFzAlE= X-Forefront-PRVS: 06237E4555 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTDJQUjAzTUIyNDI7MjM6TzlHeDg0S1pCZG9oNnBIYlJ3alJKTHEyZ3BT?= =?utf-8?B?eXQyY3FVNEw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?utf-8?B?cHV6SG05WFZkUXp0ZklBVlU4NnYrd3ZtNER0TnNiYitQU0h6VTJtTnc0SC9r?= =?utf-8?B?VEZpa2VJdEd4Z1lrQjlUeW9MN1ptRFpUenh1cG54UjlMSDlHRDl3ckVNc25p?= =?utf-8?B?cFBvZ0tsbS8xd21qTWRJTDhIa0RCZURTMW16MTErSlMrY2JvS1lqSUJRa29H?= =?utf-8?B?MTMyUi9wQlhOdzY1Tmxpa0xPTzhsTHBqbXo3VzV2eGJyNEFEVG1FSG5HYThn?= =?utf-8?B?bUljUkd3aGhobFFKMzlDYWtScXRnQmVsOWt2Vm5DamJPOVh6d2Y1Rzk4ZVZX?= =?utf-8?B?bVhieEZMWjhuYXdlWHVQQXplVFJTb3JhZmt3Q3k0bEthQ1Fac2U3YjZKTjI3?= =?utf-8?B?S2NXVSsxdTNQZz09?= X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB242; 5:1Ls5pjk+TDEShuiX5wlmZL5SWYDjM2Z2hmoNwuPX4Oib01lZjGhpacHfs9x6RLe/L9ZDlpSmSwaLFZqF5V/ctCXhVDkSE+gU3XRDsKtAjC0VEnCwhL4bI8kDWv358/7hNmGWZ4WpSDeoIVlyeTjorA==; 24:4Y9pgH+YlPHpZPySGTnnRFMDfxmpjW7kdHSSYVJj6Ma4cavvebyKHYfKtf5dKnKBb1aVP1BZv3A65ZYTcO1BuorVkVmaj5DmEmWhX+yWL2Q=; 20:hbfFqwphpFOTdvakn6fVCZHa7xg7Bz+FZo00eENxMwvQzeK/unVRgoUIhaNfx4f3dbV8DqyY3RxcuG6/e+98Dg== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2015 02:36:43.8923 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR03MB242 Cc: fabio.estevam@freescale.com, u-boot@lists.denx.de Subject: [U-Boot] [PATCH V4 5/6] imx: mx6sabresd/sabreauto runtime setting fdt_file X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 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" Detect the SOC and board variant at runtime and change the dtb name, but not hardcoding the fdt_file env variable. Take the following patch as a reference. Íd58699b157df75f1aa0b363ea9c21add21a0c "mx6cuboxi: Load the correct 'fdtfile' variable" Signed-off-by: Peng Fan Reviewed-by: Fabio Estevam Acked-by: Stefano Babic --- Changes v4: Add Fabio's Reviewed-by Changes v3: New patch Changes v2: none board/freescale/mx6qsabreauto/mx6qsabreauto.c | 9 +++++++++ board/freescale/mx6sabresd/mx6sabresd.c | 10 ++++++++++ include/configs/mx6qsabreauto.h | 5 ----- include/configs/mx6sabre_common.h | 21 +++++++++++++++++++-- include/configs/mx6sabresd.h | 5 ----- 5 files changed, 38 insertions(+), 12 deletions(-) diff --git a/board/freescale/mx6qsabreauto/mx6qsabreauto.c b/board/freescale/mx6qsabreauto/mx6qsabreauto.c index b76e4eb..943a4bd 100644 --- a/board/freescale/mx6qsabreauto/mx6qsabreauto.c +++ b/board/freescale/mx6qsabreauto/mx6qsabreauto.c @@ -522,6 +522,15 @@ int board_late_init(void) add_board_boot_modes(board_boot_modes); #endif +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG + setenv("board_name", "SABREAUTO"); + + if (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D)) + setenv("board_rev", "MX6Q"); + else if (is_cpu_type(MXC_CPU_MX6DL) || is_cpu_type(MXC_CPU_MX6SOLO)) + setenv("board_rev", "MX6DL"); +#endif + return 0; } diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c index 23f8f6b..4f0694a 100644 --- a/board/freescale/mx6sabresd/mx6sabresd.c +++ b/board/freescale/mx6sabresd/mx6sabresd.c @@ -679,6 +679,16 @@ int board_late_init(void) #ifdef CONFIG_CMD_BMODE add_board_boot_modes(board_boot_modes); #endif + +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG + setenv("board_name", "SABRESD"); + + if (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D)) + setenv("board_rev", "MX6Q"); + else if (is_cpu_type(MXC_CPU_MX6DL) || is_cpu_type(MXC_CPU_MX6SOLO)) + setenv("board_rev", "MX6DL"); +#endif + return 0; } diff --git a/include/configs/mx6qsabreauto.h b/include/configs/mx6qsabreauto.h index 2260344..11cf538 100644 --- a/include/configs/mx6qsabreauto.h +++ b/include/configs/mx6qsabreauto.h @@ -12,11 +12,6 @@ #define CONFIG_MACH_TYPE 3529 #define CONFIG_MXC_UART_BASE UART4_BASE #define CONFIG_CONSOLE_DEV "ttymxc3" -#if defined CONFIG_MX6Q -#define CONFIG_DEFAULT_FDT_FILE "imx6q-sabreauto.dtb" -#elif defined CONFIG_MX6DL -#define CONFIG_DEFAULT_FDT_FILE "imx6dl-sabreauto.dtb" -#endif #define CONFIG_MMCROOT "/dev/mmcblk0p2" #define PHYS_SDRAM_SIZE (2u * 1024 * 1024 * 1024) diff --git a/include/configs/mx6sabre_common.h b/include/configs/mx6sabre_common.h index c8c9f81..397ad7b 100644 --- a/include/configs/mx6sabre_common.h +++ b/include/configs/mx6sabre_common.h @@ -76,10 +76,12 @@ #define EMMC_ENV "" #endif +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG + #define CONFIG_EXTRA_ENV_SETTINGS \ "script=boot.scr\0" \ "image=zImage\0" \ - "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ + "fdt_file=undefined\0" \ "fdt_addr=0x18000000\0" \ "boot_fdt=try\0" \ "ip_dyn=yes\0" \ @@ -149,9 +151,24 @@ "fi; " \ "else " \ "bootz; " \ - "fi;\0" + "fi;\0" \ + "findfdt="\ + "if test $fdt_file = undefined; then " \ + "if test $board_name = SABREAUTO && test $board_rev = MX6Q; then " \ + "setenv fdt_file imx6q-sabreauto.dtb; fi; " \ + "if test $board_name = SABREAUTO && test $board_rev = MX6DL; then " \ + "setenv fdt_file imx6dl-sabreauto.dtb; fi; " \ + "if test $board_name = SABRESD && test $board_rev = MX6Q; then " \ + "setenv fdt_file imx6q-sabresd.dtb; fi; " \ + "if test $board_name = SABRESD && test $board_rev = MX6DL; then " \ + "setenv fdt_file imx6dl-sabresd.dtb; fi; " \ + "if test $fdt_file = undefined; then " \ + "echo WARNING: Could not determine dtb to use; fi; " \ + "fi;\0" \ + #define CONFIG_BOOTCOMMAND \ + "run findfdt;" \ "mmc dev ${mmcdev};" \ "if mmc rescan; then " \ "if run loadbootscript; then " \ diff --git a/include/configs/mx6sabresd.h b/include/configs/mx6sabresd.h index 41162ca..5f635ca 100644 --- a/include/configs/mx6sabresd.h +++ b/include/configs/mx6sabresd.h @@ -19,11 +19,6 @@ #define CONFIG_MXC_UART_BASE UART1_BASE #define CONFIG_CONSOLE_DEV "ttymxc0" #define CONFIG_MMCROOT "/dev/mmcblk1p2" -#if defined(CONFIG_MX6Q) -#define CONFIG_DEFAULT_FDT_FILE "imx6q-sabresd.dtb" -#elif defined(CONFIG_MX6DL) -#define CONFIG_DEFAULT_FDT_FILE "imx6dl-sabresd.dtb" -#endif #define PHYS_SDRAM_SIZE (1u * 1024 * 1024 * 1024) #define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */