From patchwork Thu May 19 11:08:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Oberfichtner X-Patchwork-Id: 1633159 X-Patchwork-Delegate: sbabic@denx.de 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=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=ny4bzMpi; 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)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L3nG563fBz9tkb for ; Thu, 19 May 2022 21:10:37 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 693C183F48; Thu, 19 May 2022 13:09:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1652958575; bh=MxmPtlJdC3cWpNDpRRSxfyHi7OoQb5Xze2gxlvsvCqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ny4bzMpiqVC2QxmczcMvWViOmvdXA2qw35cJbFmuCT1fcLz4kQBnMBhQbtn67jo+I wvWQGMcZLcyCXcV+YzXdHSUzKSOvtrN4U+kc9bHMA5/gsabmBxRRdIYq/9mtqsa7r1 n7k5LTisniCc2rFCkSNTsb4UQ+qRbhEt40CtAbus6d9jxYwNOmVhOQjW0F1P1X/JCs p4XMnSic84Vny+GRGtevpIlWGt7EMyKI32x+u0A0V7xF1X6dTcsTexIgMVlZL5LRGX /4upbxr7GP9cU1w9MzPADw+Ut6JjvymoqQTWShLRIwFC68z/Rrva5WNxyDYtPvCl9u eSzD7ssNajxwA== Received: by phobos.denx.de (Postfix, from userid 109) id ECE3C83D53; Thu, 19 May 2022 13:09:21 +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=-0.3 required=5.0 tests=BAYES_00,RDNS_NONE, SPF_HELO_NONE,SPF_NEUTRAL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from xpert.denx.de (unknown [62.91.23.180]) (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 BE4A9842A9 for ; Thu, 19 May 2022 13:09:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=pro@denx.de Received: by xpert.denx.de (Postfix, from userid 535) id EA58F3E0EBB; Thu, 19 May 2022 13:09:09 +0200 (CEST) From: Philip Oberfichtner To: u-boot@lists.denx.de Cc: Fabio Estevam , Christoph Niedermaier , Stefano Babic , Peng Fan , Philip Oberfichtner , Andreas Geisreiter , Tom Rini , u-boot@dh-electronics.com Subject: [PATCH 8/8] ARM: imx6: Adapt device tree selection in DH board file Date: Thu, 19 May 2022 13:08:37 +0200 Message-Id: <20220519110837.245488-9-pro@denx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220519110837.245488-1-pro@denx.de> References: <20220519110837.245488-1-pro@denx.de> 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.5 at phobos.denx.de X-Virus-Status: Clean Before this commit device tree selection could rely solely on differentiating the iMX6 processor variant Q and DL. After adding two new carrier boards, the DRC02 and the picoITX, the interchangeability of SoMs makes this approach infeasible. It is now required to specify the carrier board (dhcom-drc02, dhcom-picoitx or dhcom-pdk2) at compile time using CONFIG_DEFAULT_DEVICETREE. The SoM is determined at runtime as before. Signed-off-by: Philip Oberfichtner --- board/dhelectronics/dh_imx6/dh_imx6.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/board/dhelectronics/dh_imx6/dh_imx6.c b/board/dhelectronics/dh_imx6/dh_imx6.c index 6059f96e80..c63fc1dd8a 100644 --- a/board/dhelectronics/dh_imx6/dh_imx6.c +++ b/board/dhelectronics/dh_imx6/dh_imx6.c @@ -227,14 +227,20 @@ int checkboard(void) #ifdef CONFIG_MULTI_DTB_FIT int board_fit_config_name_match(const char *name) { - if (is_mx6dq()) { - if (!strcmp(name, "imx6q-dhcom-pdk2")) - return 0; - } else if (is_mx6sdl()) { - if (!strcmp(name, "imx6dl-dhcom-pdk2")) - return 0; - } + /* Determine carrier board at compile time and SoM at runtime */ + const size_t size = 32; + char *car, *som, dt[size]; + + car = strchr(CONFIG_DEFAULT_DEVICE_TREE, '-'); /* i.e. -dhcom-drc02 */ + + som = is_mx6dq() ? "imx6q" : + is_mx6dl() ? "imx6dl" : + is_mx6solo() ? "imx6s" : NULL; + + if (!(car && som)) + return -1; - return -1; + snprintf(dt, size, "%s%s", som, car); + return strcmp(name, dt); } #endif