From patchwork Tue Dec 27 12:15:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinthu Raja X-Patchwork-Id: 1719652 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 (1024-bit key; unprotected) header.d=mistralsolutions.com header.i=@mistralsolutions.com header.a=rsa-sha256 header.s=google header.b=inrjfCBs; 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)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NhDF62SyCz23dZ for ; Tue, 27 Dec 2022 23:17:46 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1394885551; Tue, 27 Dec 2022 13:16:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=mistralsolutions.com 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=mistralsolutions.com header.i=@mistralsolutions.com header.b="inrjfCBs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6A86C85515; Tue, 27 Dec 2022 13:16:30 +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,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from egress-ip33b.ess.de.barracuda.com (egress-ip33b.ess.de.barracuda.com [18.185.115.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 89D7C85518 for ; Tue, 27 Dec 2022 13:16:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=mistralsolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sinthu.raja@mistralsolutions.com Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx-outbound21-102.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 27 Dec 2022 12:16:26 +0000 Received: by mail-pj1-f71.google.com with SMTP id l21-20020a17090aec1500b00225e3da1786so2180813pjy.7 for ; Tue, 27 Dec 2022 04:16:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mistralsolutions.com; s=google; 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=FghrzsBJkM1sg4EGBul2sZ1oDr3GtqlxN/pjXF2sbK0=; b=inrjfCBsf92qeaStEArhvirpD/PdMme2/QlabHAwZw5W9BbFik6OZsvpJDn9M20SDd UJdDYJCbLERncAMnHj6uw1ZIh7XSPplZzuwEE/PxRS+NI4f7uVYlqAYArnntmTB5QT1X NcQdYFG5l6plYEyjS1QApEkTm9+13HugEW+Xg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=FghrzsBJkM1sg4EGBul2sZ1oDr3GtqlxN/pjXF2sbK0=; b=asQc3Jj3d50ErcxFphk6yvWPyYNTPSy3LmlOYmdkbyW4Doi8BobzC3VkQMo9Z/0kxg i6J8SyZzot+7Vc+NBjyBdnbIyaFLJ+nzLKO8enECKRnyUKVtuw476mgpC0TbzYScb5Bz y2dMR+wUZgtnSsxZPqi9oQKqn+y9QfEhsJEHNK8jrKVlcuSBGApsf6Vlrto9qJ1zTp7D KRVVbdTHPmOSDBCGRDmb3QBAeMieiW9ovIJ5jD2p5sk6DOjBxu9bnVzJOiYV5bD76bIH 2XN6jMfUIJw4XW6nwS/RRvMKKrmVzdi+gli6m3KoXK6eghvKQgNPQeXvVpCQSDSA6T4v 3QGg== X-Gm-Message-State: AFqh2kqtLVFuIkp0oReBRO8B7wEw+BWNN0tQC7FiLl7cQV/5Qq0YK4Mr yzwk/ASzBPvAjveIWU8jRhC+dldi9wZe0jzcxXZSXiZXhHNbMR3iTlVl+AAYDl1y98utidraEWw Vi0COTVTP5EQLC0Jgvp20yGTOx5yPoZx79eTHn49A03M1VMhxHg== X-Received: by 2002:a05:6a20:cc59:b0:9d:efbf:48cb with SMTP id hq25-20020a056a20cc5900b0009defbf48cbmr21575432pzb.15.1672143384905; Tue, 27 Dec 2022 04:16:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXueUdxGs5bxgXiaetDjBKXahKiT3gDa5SkEirg95m8eLPeoPbKBzNa8tDTiaQBQoQ5+PGU0wg== X-Received: by 2002:a05:6a20:cc59:b0:9d:efbf:48cb with SMTP id hq25-20020a056a20cc5900b0009defbf48cbmr21575414pzb.15.1672143384564; Tue, 27 Dec 2022 04:16:24 -0800 (PST) Received: from LAP568U.mistral.in ([106.51.227.150]) by smtp.gmail.com with ESMTPSA id h19-20020a17090adb9300b0021806f631ccsm7975892pjv.30.2022.12.27.04.16.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Dec 2022 04:16:24 -0800 (PST) From: Sinthu Raja X-Google-Original-From: Sinthu Raja To: u-boot@lists.denx.de, Tom Rini , Marcel Ziswiler , Marek Vasut , Vignesh Raghavendra Cc: Sinthu Raja Subject: [PATCH V3 06/12] board: ti: j721s2: Add support for detecting multiple device trees Date: Tue, 27 Dec 2022 17:45:37 +0530 Message-Id: <20221227121543.22306-7-sinthu.raja@ti.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221227121543.22306-1-sinthu.raja@ti.com> References: <20221227121543.22306-1-sinthu.raja@ti.com> MIME-Version: 1.0 X-BESS-ID: 1672143385-305478-5378-183058-1 X-BESS-VER: 2019.1_20221214.2106 X-BESS-Apparent-Source-IP: 209.85.216.71 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.245076 [from cloudscan18-254.eu-central-1b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS91090 scores of KILL_LEVEL=7.0 tests=BSF_SC0_MISMATCH_TO, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 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 From: Sinthu Raja Update the board_fit_config_name_match() to choose the right dtb based on the board name read from EEPROM. Also restrict multpile EEPROM reads by verifying if EEPROM is already read Signed-off-by: Sinthu Raja Reviewed-by: Tom Rini --- board/ti/j721s2/evm.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/board/ti/j721s2/evm.c b/board/ti/j721s2/evm.c index a3adb8704e..a7c4082a7a 100644 --- a/board/ti/j721s2/evm.c +++ b/board/ti/j721s2/evm.c @@ -72,16 +72,6 @@ int dram_init_banksize(void) return 0; } -#ifdef CONFIG_SPL_LOAD_FIT -int board_fit_config_name_match(const char *name) -{ - if (!strcmp(name, "k3-j721s2-common-proc-board")) - return 0; - - return -1; -} -#endif - #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) int ft_board_setup(void *blob, struct bd_info *bd) { @@ -111,6 +101,9 @@ int do_board_detect(void) { int ret; + if (board_ti_was_eeprom_read()) + return 0; + ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS, CONFIG_EEPROM_CHIP_ADDRESS); if (ret) { @@ -179,6 +172,23 @@ static void setup_serial(void) } #endif +#ifdef CONFIG_SPL_LOAD_FIT +int board_fit_config_name_match(const char *name) +{ + bool eeprom_read = board_ti_was_eeprom_read(); + + if (!eeprom_read || board_is_j721s2_som()) { + if (!strcmp(name, "k3-j721s2-common-proc-board")) + return 0; + } else if (!eeprom_read || board_is_am68_sk_som()) { + if (!strcmp(name, "k3-am68-sk-base-board")) + return 0; + } + + return -1; +} +#endif + int board_late_init(void) { if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) {