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 BC635C433EF for ; Wed, 9 Feb 2022 09:39:15 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1D27383E69; Wed, 9 Feb 2022 10:38:21 +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="oLS7afpQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1553983DBE; Wed, 9 Feb 2022 10:37:48 +0100 (CET) Received: from egress-ip4b.ess.de.barracuda.com (egress-ip4b.ess.de.barracuda.com [18.185.115.208]) (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 0AD6383E23 for ; Wed, 9 Feb 2022 10:37:33 +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-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx-outbound40-219.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 09 Feb 2022 09:37:32 +0000 Received: by mail-pf1-f198.google.com with SMTP id d5-20020a623605000000b004e01ccd08abso1479660pfa.10 for ; Wed, 09 Feb 2022 01:37:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mistralsolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=khH1H1TgqEM1Z6/wM8I+ZUE5ZscFgm8fzCJNlFruDCY=; b=oLS7afpQM7y33LcfnhbH5cKNyAn29tvPYtFYlmsbSvccL8s2MRpyJUIhs+sdfRWYmu Wc0CMyyyzS+obM96kklvePJveXp8le+aZ8mwmSEsb/3CdiJM3JLUDLlovsRxhkRbBCkv HsJW2L9qJM/s7s0SNEYmY9hfbDAk8d5T8aLY8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=khH1H1TgqEM1Z6/wM8I+ZUE5ZscFgm8fzCJNlFruDCY=; b=DZ/hhI6wzeLeyYIXGI0aFxWrgvjLuK+MGIu0JjWmGwM9ahSM5eaPosdJsHmIbGHm+b nOR7EKLNnsHkArvs2xdR3BHEizoK4ndetgh7SAillxBrGxLOtzPvl2Dnw+CHjo9wb5tN G3oWIQmrsOUuZYJdtS0SQFzqR+duU7Poz10epaC8Q6b6jUluGp1YSaAibP4MuuzbG+8b U9b0nPcFx5LUIKAXe3cee95PZQI8HGCRdSMGLP+0/0UA7XcoTXIc0KRs+ca3Px9Vd193 KB2FcErsBojVRWKOjYzrxLn8MKjp8Oouc6C3vvrhHVTFAFkyinundfROhDKNbxUb/k89 JvKw== X-Gm-Message-State: AOAM533Uqtr8H1WtGEj3XR55O208rau5fzvBLGp9Of2Wws1uzuRWDhDI dZw/pXLHsZlO23APVTFiCQmeaksRdqok1JMuTdbZ6rtq806S0tyCpMPVbtSdFYnFRGMWC3POZwX MTmYtttp4p9r/PbwrM+3EG+92344N9oGvgoURcvCRCk69cEZwkw== X-Received: by 2002:a05:6a00:894:: with SMTP id q20mr1364960pfj.79.1644399451099; Wed, 09 Feb 2022 01:37:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzEHU2k7DCVza1E2vLEvIwG2knZ0A0GlsEs6Fxs4Grn2DCiqVselOGkbz+aes+21sEj4lFz3g== X-Received: by 2002:a05:6a00:894:: with SMTP id q20mr1364937pfj.79.1644399450778; Wed, 09 Feb 2022 01:37:30 -0800 (PST) Received: from LAP568U.mistral.in ([106.51.69.35]) by smtp.gmail.com with ESMTPSA id g4sm18964255pfv.63.2022.02.09.01.37.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 01:37:30 -0800 (PST) From: Sinthu Raja X-Google-Original-From: Sinthu Raja To: u-boot@lists.denx.de Cc: Praneeth Bajjuri , Sinthu Raja Subject: [PATCH V3 08/16] arm: j721e: Add support for selecting DT based on board name Date: Wed, 9 Feb 2022 15:06:53 +0530 Message-Id: <20220209093701.16693-9-sinthu.raja@ti.com> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20220209093701.16693-1-sinthu.raja@ti.com> References: <20220209093701.16693-1-sinthu.raja@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BESS-ID: 1644399452-310459-5659-8248-1 X-BESS-VER: 2019.1_20220208.1721 X-BESS-Apparent-Source-IP: 209.85.210.198 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.237841 [from cloudscan21-23.eu-central-1b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 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_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.5 at phobos.denx.de X-Virus-Status: Clean From: Sinthu Raja Enable support for selecting DTB from FIT within SPL based on the board name read from EEPROM. This will help to use single defconfig for both EVM and SK. Signed-off-by: Sinthu Raja --- arch/arm/mach-k3/j721e_init.c | 58 +++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c index 78d80be175..3d99ef0444 100644 --- a/arch/arm/mach-k3/j721e_init.c +++ b/arch/arm/mach-k3/j721e_init.c @@ -21,6 +21,7 @@ #include #include #include +#include #ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW @@ -135,6 +136,59 @@ static void store_boot_info_from_rom(void) sizeof(struct rom_extended_boot_data)); } +#ifdef CONFIG_SPL_OF_LIST +void do_dt_magic(void) +{ + int ret, rescan, mmc_dev = -1; + static struct mmc *mmc; + + if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) + 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 && !is_rom_loaded_sysfw(&bootdata)) { + 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 + void board_init_f(ulong dummy) { #if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW) @@ -180,6 +234,10 @@ void board_init_f(ulong dummy) k3_sysfw_loader(is_rom_loaded_sysfw(&bootdata), k3_mmc_stop_clock, k3_mmc_restart_clock); +#ifdef CONFIG_SPL_OF_LIST + do_dt_magic(); +#endif + /* * Force probe of clk_k3 driver here to ensure basic default clock * configuration is always done. -- 2.35.0