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 DF78CC4332F for ; Wed, 4 Jan 2023 09:47:45 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A494D85586; Wed, 4 Jan 2023 10:47:17 +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="VS2rwErb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 051BA8556E; Wed, 4 Jan 2023 10:45:44 +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 97ECF8557C for ; Wed, 4 Jan 2023 10:45:22 +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-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) 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:21 +0000 Received: by mail-pj1-f70.google.com with SMTP id h7-20020a17090a710700b00225b277a376so12114113pjk.0 for ; Wed, 04 Jan 2023 01:45:21 -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=P72bZFtURYSeoBdQnvY/KoDqN3//o+YrHkljllnNhTk=; b=VS2rwErbINPfPTiwTjVUujVy+ohJZDcrutv/wR0x4FK5bjS1YwSCZrOFpqiwOBBsKY 7+oXkj8C/e4aM3NHFz6mliSpuB0sC9t+p4iifUuY01AjjeVpKwWMBYx7IdpjZbDaN7tc KAvWc0a/lEEkFhr+F0hYzvb7pQ8kQiqZItu10= 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=P72bZFtURYSeoBdQnvY/KoDqN3//o+YrHkljllnNhTk=; b=v5QLYSiMPDLe0EyjJc84lujZ2dMfCrE1uZhSlqgmr6D8jFLR7UR9GSmHeswozdX7sy lytrXJGnBAZWfSHnyoEtPat6cmqNL1ua01sAlUJMxlnBZphZG9JFqGu/ZAqd/jYQpQVe 8WkdDg8yjC72cDgZu4rRYVgl2XBxQs7JsZ3x2pwY0wbfiBPSaCXRdieW6XXW2WQho+pu rDqMqlgPL5MS4ygwW4z8I+XCRmgnIao30kpcAi9J0AHit9AqBJ0DsTBE7Cdb1jYI+twk QGrWdFVWHFKJ//5RaGem6WNAcfMYakVAH+JZXxNcFLQN2X6O7/CrBGIBR6lq1lbWTyEX nUBg== X-Gm-Message-State: AFqh2kpzAnDFg6nBO7bWRujDN8dh/0/gh5Jei27ZqCvuIyIuNzvCdbzV N0OobGc4r8R2WlLxkIc9KbayoSM4Gu/JO07Avq84ZnWon7zlpkWRVzGQfWGPqL2C+JOGC4tMJga 7VyS7UyIzve8Avb9D1pbF8dhcvVLhRQq4YNcCBf2x8Wp1p0Xqew== X-Received: by 2002:a17:902:74cc:b0:189:dd9b:66c3 with SMTP id f12-20020a17090274cc00b00189dd9b66c3mr37301966plt.11.1672825519114; Wed, 04 Jan 2023 01:45:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXuKALjxWPRVPbYANQZv6h/eRy0Iz+hENWIAEmV0N5LbqkJMhMnTQWDMLaYPF8YBxNBVpewxMg== X-Received: by 2002:a17:902:74cc:b0:189:dd9b:66c3 with SMTP id f12-20020a17090274cc00b00189dd9b66c3mr37301953plt.11.1672825518782; Wed, 04 Jan 2023 01:45:18 -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.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 01:45:18 -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 08/12] board: ti: j721s2: Add board_init and support for selecting DT based on EEPROM Date: Wed, 4 Jan 2023 15:13:46 +0530 Message-Id: <20230104094350.19394-9-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: 1672825520-304064-5386-8213-1 X-BESS-VER: 2019.1_20221214.2106 X-BESS-Apparent-Source-IP: 209.85.216.70 X-BESS-Outbound-Spam-Score: 0.40 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.245241 [from cloudscan22-14.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 0.40 BSF_SC0_SA085b META: Custom Rule SA085b X-BESS-Outbound-Spam-Status: SCORE=0.40 using account:ESS91090 scores of KILL_LEVEL=7.0 tests=BSF_SC0_MISMATCH_TO, BSF_BESS_OUTBOUND, BSF_SC0_SA085b 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 Add the board_init_f API for SPL and run the platform-required SoC initialization. Add the functionality for board name-based DTB selection from FIT within SPL. This will make it easier to utilise one defconfig for both the EVM and the SK. Signed-off-by: Sinthu Raja --- Changes in V4: ============= Address review comments: - In align wih the macro conditional statement which missed it in the previous version V3: https://patchwork.ozlabs.org/project/uboot/patch/20221227121543.22306-9-sinthu.raja@ti.com/ board/ti/j721s2/evm.c | 64 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/board/ti/j721s2/evm.c b/board/ti/j721s2/evm.c index a7c4082a7a..941b4bd8ae 100644 --- a/board/ti/j721s2/evm.c +++ b/board/ti/j721s2/evm.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "../common/board_detect.h" @@ -202,3 +203,66 @@ int board_late_init(void) void spl_board_init(void) { } + +/* Support for the various EVM / SK families */ +#if defined(CONFIG_SPL_OF_LIST) && defined(CONFIG_TI_I2C_BOARD_DETECT) +void do_dt_magic(void) +{ + int ret, rescan, mmc_dev = -1; + static struct mmc *mmc; + + do_board_detect(); + + /* + * Board detection has been done. + * Let us see if another dtb wouldn't be a better match + * for our board + */ + if (IS_ENABLED(CONFIG_CPU_V7R)) { + ret = fdtdec_resetup(&rescan); + if (!ret && rescan) { + dm_uninit(); + dm_init_and_scan(true); + } + } + + /* + * Because of multi DTB configuration, the MMC device has + * to be re-initialized after reconfiguring FDT inorder to + * boot from MMC. Do this when boot mode is MMC and ROM has + * not loaded SYSFW. + */ + switch (spl_boot_device()) { + case BOOT_DEVICE_MMC1: + mmc_dev = 0; + break; + case BOOT_DEVICE_MMC2: + case BOOT_DEVICE_MMC2_2: + mmc_dev = 1; + break; + } + + if (mmc_dev > 0 && !check_rom_loaded_sysfw()) { + ret = mmc_init_device(mmc_dev); + if (!ret) { + mmc = find_mmc_device(mmc_dev); + if (mmc) { + ret = mmc_init(mmc); + if (ret) + printf("mmc init failed with error: %d\n", ret); + } + } + } +} +#endif + +#ifdef CONFIG_SPL_BUILD +void board_init_f(ulong dummy) +{ + k3_spl_init(); +#if defined(CONFIG_SPL_OF_LIST) && defined(CONFIG_TI_I2C_BOARD_DETECT) + do_dt_magic(); +#endif + k3_mem_init(); +} +#endif -- 2.36.1