From mboxrd@z Thu Jan 1 00:00:00 1970 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 1695BFA3742 for ; Thu, 27 Oct 2022 11:15:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5E80F850D7; Thu, 27 Oct 2022 13:14:31 +0200 (CEST) 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="DTf50JTL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 31EF5850B8; Thu, 27 Oct 2022 12:49:23 +0200 (CEST) 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 D0AED850B5 for ; Thu, 27 Oct 2022 12:49:20 +0200 (CEST) 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-outbound9-203.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 27 Oct 2022 10:49:19 +0000 Received: by mail-pf1-f198.google.com with SMTP id bd33-20020a056a0027a100b005665e548115so659991pfb.10 for ; Thu, 27 Oct 2022 03:49:19 -0700 (PDT) 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=d9/0r5cyd7mv9k8c2T4JPEBUgu2bDxhfaA0CaReH53k=; b=DTf50JTLlfXW37/J4vDg9ax7Ou8Q4jAbHndcS0he8Gf2X6y265wBykgK6sFE1P/HE6 We4absx7q9ZjwxNepLvOJFPcraz5SKRs1WPp8dwGLJcmzGYnszJtmuqd8OVm7X5V9aLo 93pGOBaMrrNqPkwAN6umtfnK2aPwOP8HbPNqY= 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=d9/0r5cyd7mv9k8c2T4JPEBUgu2bDxhfaA0CaReH53k=; b=6Cg3IM96nWw5YcxSz0STrBUq920FfP4gHTReDJrCo4KyHzSy0vMB6bxBkT7Fn49nNt RMVZoAYaX07HdN0R4A/kanVSyNTK0Wvhn2uSdFe4tdhLfALDD4q3/jxRyLeHBGZX4jUy NeCbUyrSI/BrJQzoLV9RHn9cGEdFUdQkSvXH6/kd2RxFHotWvOkYm9+WEGeYesQAMbJi ZPqMZ5O1G/LfdTHkJif1EzURDMieIdib0khmHJzpiE3vYOHzli8X8zm18sBHDG1XVrnK 9Zb43jXWJp9wRXiCGVzTVU7aitzfFaBfipndDYoqxLoTF8gP2J4v4tvfT2QV6sZr+0N1 lOBQ== X-Gm-Message-State: ACrzQf0FjrBG9THY0urlQWaSDLbLI84nEnUJmmCM1uGFM5tb5KZZkfpg IO5UKhnVeIvz5svMw8ZrYPwNO07EYhp0jq3rtgKGDGoK6RwgB9GAevR5v6uKfKokfe58J8OIezn yHZSjhAkp0nSU6Yt20rnMqdCrCWBsM+jUS9v01y2uEKPE1chy9w== X-Received: by 2002:a17:902:ce8f:b0:186:b051:1caa with SMTP id f15-20020a170902ce8f00b00186b0511caamr18963500plg.12.1666867757668; Thu, 27 Oct 2022 03:49:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gOBel3F+7aLrAAy9lNma1BIR2ZEEQSKWxRORgNjuFuDuhTFIJNQJH5x37ELYtjHbponegwQ== X-Received: by 2002:a17:902:ce8f:b0:186:b051:1caa with SMTP id f15-20020a170902ce8f00b00186b0511caamr18963472plg.12.1666867757371; Thu, 27 Oct 2022 03:49:17 -0700 (PDT) Received: from LAP568U.mistral.in ([106.51.69.35]) by smtp.gmail.com with ESMTPSA id 20-20020a630e54000000b0045ccc30e469sm815370pgo.25.2022.10.27.03.49.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 03:49:16 -0700 (PDT) From: Sinthu Raja X-Google-Original-From: Sinthu Raja To: u-boot@lists.denx.de, Simon Glass , Marcel Ziswiler , Marek Vasut , Vignesh Raghavendra Cc: Sinthu Raja Subject: [PATCH 07/11] arm: j721s2: Add support for selecting DT based on EEPROM Date: Thu, 27 Oct 2022 16:18:42 +0530 Message-Id: <20221027104846.11820-8-sinthu.raja@ti.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221027104846.11820-1-sinthu.raja@ti.com> References: <20221027104846.11820-1-sinthu.raja@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BESS-ID: 1666867759-302507-5377-6002-1 X-BESS-VER: 2019.1_20221024.2147 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.243747 [from cloudscan12-223.eu-central-1a.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-Mailman-Approved-At: Thu, 27 Oct 2022 13:13:53 +0200 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 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/j721s2_init.c | 59 ++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/arch/arm/mach-k3/j721s2_init.c b/arch/arm/mach-k3/j721s2_init.c index 12da8136f9..fc5eee03b6 100644 --- a/arch/arm/mach-k3/j721s2_init.c +++ b/arch/arm/mach-k3/j721s2_init.c @@ -19,8 +19,10 @@ #include #include #include +#include #include #include +#include static void ctrl_mmr_unlock(void) { @@ -93,6 +95,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) { struct udevice *dev; @@ -139,6 +194,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 + if (IS_ENABLED(CONFIG_SPL_CLK_K3)) { /* * Force probe of clk_k3 driver here to ensure basic default clock -- 2.36.1