Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 214B1C49EA5 for ; Sat, 26 Jun 2021 15:06:50 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A0E5761C3A for ; Sat, 26 Jun 2021 15:06:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0E5761C3A Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=mistralsolutions.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DA09182C63; Sat, 26 Jun 2021 17:05:37 +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="ospiuq99"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EDA3082C2A; Sat, 26 Jun 2021 16:59:31 +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 358FA82C24 for ; Sat, 26 Jun 2021 16:59:29 +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-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by mx-outbound47-108.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 26 Jun 2021 14:59:28 +0000 Received: by mail-pg1-f199.google.com with SMTP id w38-20020a6347660000b029022342ce1f8bso8175314pgk.2 for ; Sat, 26 Jun 2021 07:59:28 -0700 (PDT) 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=hRplC7Jai/SMuNJOERsC7bPlfkc/J1lPtIpxt7y4j0w=; b=ospiuq99sufFzjKTjR0NypUyvpGPjjoVRGuRPU2VyxJ8Uitrm3Q4jIoNSZRY1Eynw3 8Lj/kd0zjt+NzGGz9EIKWTXqoTv/sskfNHs7kK4BRFb42Em9tq8DazRSpdJRQFBb+pVy ic+UNyS0DFg0QPDDs+kH1aewmaWBviV94M9QU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hRplC7Jai/SMuNJOERsC7bPlfkc/J1lPtIpxt7y4j0w=; b=DoyacgTcu+SUNMVA1ctunOuUu+PsHPZputFkrQzvzxruljXbJwQ0oSRS8FkvzaVbDE +bBFlfWA2Kq7ySdVJKDjrTRdVkrXgKEv98wIkvOItIBe4RGKsREiwHSyr7KBKzoDzG+7 4Hk4S4uQ0dyYtlZzUvLYNX9pRFpjDebrm0zWcyKjgeGWlCRSSw+V/rB7e3QIHFPKFEld Ueu49kqjbhlnpSsaAbpKoOGSiKSAziU5LUd/oqVp0BzWWG2Mv75uuMUgbprYDdBuQ4QX qb1t3Ejp5ktaDhXx0jE36q0LzINZIMlOm8h1Q9oFKxmu5Wao7hGFeT5gZy8DAtiNpBof IuYQ== X-Gm-Message-State: AOAM532FnDr5JGRaLep7ZPIRrZ6bEee/eh8a4UX99mhd9DWpQCgfGoUE LhSlbiJDcJeUd+ikMwr9bfkbLIyQs/GsS1joeqqxs+XS8TkrMe/4nH0JYQ9kUvtX00561DlVXIe nIDJ1M8QhGnVxnhf83s6owcE/EuHKFLuZhdv9kktk2H8gtmgpcA== X-Received: by 2002:a17:90b:300c:: with SMTP id hg12mr27018621pjb.46.1624719567126; Sat, 26 Jun 2021 07:59:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdUOdj0AXbVMv8hc3jRUsnuhadsn7CJZ526CiCxYF/UXenigGqlafCKL7PkET4+MXfuHKpgw== X-Received: by 2002:a17:90b:300c:: with SMTP id hg12mr27018612pjb.46.1624719566944; Sat, 26 Jun 2021 07:59:26 -0700 (PDT) Received: from localhost.localdomain ([49.207.221.44]) by smtp.gmail.com with ESMTPSA id g18sm8769245pfi.199.2021.06.26.07.59.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Jun 2021 07:59:26 -0700 (PDT) From: Sinthu Raja X-Google-Original-From: Sinthu Raja To: u-boot@lists.denx.de Cc: Praneeth Bajjuri , Vutla Lokesh , Amarnath MB , Sinthu Raja Subject: [PATCH 09/17] arm: j721e: Add support for selecting DT based on EEPROM Date: Sat, 26 Jun 2021 20:25:54 +0530 Message-Id: <20210626145602.15702-10-sinthu.raja@ti.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210626145602.15702-1-sinthu.raja@ti.com> References: <20210626145602.15702-1-sinthu.raja@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BESS-ID: 1624719567-312140-3415-28683-1 X-BESS-VER: 2019.1_20210623.1648 X-BESS-Apparent-Source-IP: 209.85.215.199 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.233199 [from cloudscan11-203.eu-central-1a.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-Mailman-Approved-At: Sat, 26 Jun 2021 17:05:02 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean From: Amarnath MB 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 EAIK. Also print FDT model name and board name read from EEPROM on SPL debug console. This is useful to verify that right dtb is loaded in each boot stage. Signed-off-by: Amarnath MB Signed-off-by: Sinthu Raja --- arch/arm/mach-k3/j721e_init.c | 62 +++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c index e9e076c9e7..5e85189e06 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. @@ -210,6 +268,10 @@ void board_init_f(ulong dummy) preloader_console_init(); #endif +#if defined(CONFIG_DISPLAY_BOARDINFO) + show_board_info(); +#endif + /* Output System Firmware version info */ k3_sysfw_print_ver(); -- 2.31.1