Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 03A61C4332F for ; Wed, 4 Jan 2023 09:47:12 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6DE248558C; Wed, 4 Jan 2023 10:46:54 +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="VW6byooz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2C86F8557F; Wed, 4 Jan 2023 10:45:36 +0100 (CET) Received: from egress-ip33a.ess.de.barracuda.com (egress-ip33a.ess.de.barracuda.com [18.185.115.192]) (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 325F28558B for ; Wed, 4 Jan 2023 10:45:19 +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-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx-outbound15-224.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 04 Jan 2023 09:45:13 +0000 Received: by mail-pj1-f69.google.com with SMTP id h7-20020a17090a710700b00225b277a376so12113973pjk.0 for ; Wed, 04 Jan 2023 01:45:13 -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=k0t1UgGrwObR+u8szyClk+91FtYnWLK4LxFJBTUd484=; b=VW6byoozMy5bwoNv4dl93fmf+lwr/iFAU/KSzWV/yWyadccwd3XosBl4ZdtQc9F9Uy Ecz43xBfMqe81b9ntffjwoaLdXMdqjErDOyESPzp2HZsNRpGR4s0yWvH47dI3aLC1SnI KnpJX8Wpl3YSDC/6jnYIe/43bVWIuk8RVRT54= 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=k0t1UgGrwObR+u8szyClk+91FtYnWLK4LxFJBTUd484=; b=rqs73zgAlOoC/O7ysckPtSzy5XwpJ3RTgLBHXz8W57xeRHzA8aln0SqIvWtRl4jrX3 4mhRz/MFA+EcFmHpnv8eorDVLGZuH2opy6IqVQWamYqSn/W/wUOPiuQ5YUi7KTvilfSC Kig4Y97wc2AzXJ6vTqtIihWJx8fhDVfW0w5SsmznaJ0dFirsNLKIDBnUZM6NBN+/wW43 D55E9YJPs546ie74YBpyzMnECPN1bF+YYdbq7ogdSZXQWeRQ2b+xDreFcAWlb0NGxP4A ytePKSakkQsPGFFG7cLX4OhmQjGpwO2k/wwxGjxUQ9fYXZNkEEdMrPmkNDb6wbXMITYM Rtew== X-Gm-Message-State: AFqh2kpGwnuwrvXKgV6H8XL0p8799gOgR/lOJxXbyrKX407uho34IACP Phla+ti9jyrI54ce7aWmjk2wvZK971L8WEh2GSTKUHTdzxq1rV5HbIOIYdw8e9DBXj9YjUs7y2C wHxU0XraWZ5HDTB3vSqkb5L1z6IlZ7ke1bhnirBC2tL79E/ETCg== X-Received: by 2002:a17:902:efd4:b0:189:8329:dba8 with SMTP id ja20-20020a170902efd400b001898329dba8mr58926596plb.39.1672825512372; Wed, 04 Jan 2023 01:45:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXtCDHmnzy7TU2Nd6ZTMIv84bHMGmN3yNNufNsA1ehFmTk4oZHw8/rB8QAFEcn4TGTukKRiNig== X-Received: by 2002:a17:902:efd4:b0:189:8329:dba8 with SMTP id ja20-20020a170902efd400b001898329dba8mr58926587plb.39.1672825512129; Wed, 04 Jan 2023 01:45:12 -0800 (PST) Received: from LAP568U.mistral.in ([106.51.227.150]) by smtp.gmail.com with ESMTPSA id n13-20020a170903110d00b00189f2fdbdd0sm23669651plh.234.2023.01.04.01.45.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 01:45:11 -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 V4 06/12] board: ti: j721s2: Add support for detecting multiple device trees Date: Wed, 4 Jan 2023 15:13:44 +0530 Message-Id: <20230104094350.19394-7-sinthu.raja@ti.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20230104094350.19394-1-sinthu.raja@ti.com> References: <20230104094350.19394-1-sinthu.raja@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BESS-ID: 1672825506-304064-5390-8200-2 X-BESS-VER: 2019.1_20221214.2106 X-BESS-Apparent-Source-IP: 209.85.216.69 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.245241 [from cloudscan17-152.eu-central-1b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound 0.00 BSF_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS91090 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND, BSF_SC0_MISMATCH_TO 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 --- 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)) { -- 2.36.1