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 B2FC1C4332F for ; Wed, 21 Dec 2022 13:55:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1EDD385456; Wed, 21 Dec 2022 14:54:24 +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="hfIInP00"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D7F3A8548D; Wed, 21 Dec 2022 14:54:01 +0100 (CET) Received: from egress-ip4a.ess.de.barracuda.com (egress-ip4a.ess.de.barracuda.com [18.184.203.227]) (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 18F168543B for ; Wed, 21 Dec 2022 14:53:47 +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-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx-outbound40-158.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 21 Dec 2022 13:53:46 +0000 Received: by mail-pl1-f200.google.com with SMTP id z3-20020a170903018300b0018fb8ca1688so11285615plg.5 for ; Wed, 21 Dec 2022 05:53:46 -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=czRSAIrLHK3dMbralDY5b8yskIyJaggwILQjrtQEem4=; b=hfIInP00Er3Wq1cmoXjDR6COH5K052DsMUwIpzH/yWk795ZQuH1OvaTmoklgheKBoW v03UidKN1i0JSFO5POGPOQt/oxA1l6vovMkOdFED76vD3b1Uz6UurzwIGhOUNO9yiOg5 3en9fN66C6Bvt6ft92KshL7TAoCY70Td3kv44= 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=czRSAIrLHK3dMbralDY5b8yskIyJaggwILQjrtQEem4=; b=b+PIaJ/98LKy6vLQK47hB1sTTzeDpwHExlkl/wWWRc9pYKYzuimtBiXQ1J1cQeO/j3 b+bbGTdtafICJnmdfDeQVPkRbDqVdHx0MJJ7oyLe3johwRXGVkVXbTu3u2epY44VoOWU KEnUVgZd1JHRFZC96fMI0eB2FpuSEy7U9IDnmKfUC+eWPypjnA7PeKbGjbWa2W1ROYBl 2HcnedDRXUKRxn/AJvD+pSsNyrUuYvVouY0KonLFmxx0p7vQV7lxPH1IVkiFH35aL7kG pWYO+QGoF+V5/H177BzMwfTYggfd4A+3quCHoILPlPmWXF4rk4BgaI4WmrlB1DtqG4Jl lRKg== X-Gm-Message-State: AFqh2koler0S+Li4HS560ywe719gEUVGoVbc7zzF6bU21cYJsH0zIeeO A0W6hHfc1+s2DW932s98yai5Jmnf8JD6gn2Knamoz0NM8TUsiJHopBD95kVgLeLO68U+6bMUivZ gwklV7RzlalaBkLELHCYEINtl+09Adm/V8sgkML0FQ90edbLDBQ== X-Received: by 2002:a17:902:740b:b0:191:1a:179e with SMTP id g11-20020a170902740b00b00191001a179emr1984524pll.66.1671630825235; Wed, 21 Dec 2022 05:53:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXtKNK6h3eg+urs70ll39MxHok3OtuOzbnQTyuLrSBb1J9P3YZF/l1od8rE9WM5KpCoBjOvt1Q== X-Received: by 2002:a17:902:740b:b0:191:1a:179e with SMTP id g11-20020a170902740b00b00191001a179emr1984508pll.66.1671630824892; Wed, 21 Dec 2022 05:53:44 -0800 (PST) Received: from LAP568U.mistral.in ([106.51.227.150]) by smtp.gmail.com with ESMTPSA id n15-20020a170902d2cf00b00189f2fdc178sm11474891plc.177.2022.12.21.05.53.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Dec 2022 05:53:44 -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 V2 08/12] board: ti: j721s2: Add board_init and support for selecting DT based on EEPROM Date: Wed, 21 Dec 2022 19:22:15 +0530 Message-Id: <20221221135219.24702-9-sinthu.raja@ti.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221221135219.24702-1-sinthu.raja@ti.com> References: <20221221135219.24702-1-sinthu.raja@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BESS-ID: 1671630808-310398-5383-9988-2 X-BESS-VER: 2019.1_20221214.2106 X-BESS-Apparent-Source-IP: 209.85.214.200 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.244945 [from cloudscan10-74.eu-central-1a.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 X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS91090 scores of KILL_LEVEL=7.0 tests=BSF_SC0_MISMATCH_TO, 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.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 V2: ============= Address review comments: - Move board_init and board detection API to board specific file. board/ti/j721s2/evm.c | 66 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/board/ti/j721s2/evm.c b/board/ti/j721s2/evm.c index 7e448bd51c..7f0ad38b91 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,68 @@ int board_late_init(void) void spl_board_init(void) { } + +#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 && !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(); +#ifdef CONFIG_SPL_OF_LIST + do_dt_magic(); +#endif + k3_mem_init(); + +} +#endif -- 2.36.1