From patchwork Mon Sep 12 17:05:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jassi Brar X-Patchwork-Id: 604991 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:2213:b0:1da:4c02:b5e7 with SMTP id z19csp2732170ltw; Mon, 12 Sep 2022 10:05:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR4dJe+diDIZ4StWgMByVzyyhO9Bs3XDTS0b9oit7NfoDYAp2EcsALsTEOpiId5O2J+3LMTP X-Received: by 2002:a17:907:7621:b0:741:6656:bd14 with SMTP id jy1-20020a170907762100b007416656bd14mr18829712ejc.298.1663002341486; Mon, 12 Sep 2022 10:05:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663002341; cv=none; d=google.com; s=arc-20160816; b=u++uDp48Nifol7CWeTjMJVMIHQ+uxisGBcLhwWlKQEOkYNqCVqesKfYZJW1C7jdh81 WIp5/72qRiyzCSmhVwwqjy8C+n3lpngBHPQvvKh8Wwob0D/DBaM9BO0q9oXhl9/aLGjD BcSTV9Jh572bNrUbrckLNjUoFVgJNuc7S6TRLjSx883yh+bAdsaOz9ibB+2HXdC8MvOc Bw6aOvv8QXEdEcV/A9MwxQWilXu3maBkzf/9ZKjs7orcJJbCxOX4Mj51iEc7oNt/3Qeb Vpqj+bCN5F412ma2kjqNaxtBmqwqpLTfTkIkkerwl4fL0IyIIC8UT0jMwRVs7qwWEFLN rP/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=o91WJ0rjG0Wpot+iXXdGthvZyC5h2f8E3lxv7FocqJM=; b=Ld5/i7wlbBxN3VWbyLsNCBeuHIoRJ3xzHELpd7T8MZ7OXiOoQnz9mHSuaYiSXoh6T5 jDihWXcsAV2P8ezbZDj97WYrjIOdckalAGzkkqYAfnduOSEiXX4+jiJycqGX8i1tDMAB ZiaWdt3AhNX5f88s2Ci5CCH0RkOjbSwLcUmWcmpGHY+fql5pPSNdqKip037YV4crDeTB y/DYKQSaT7RsIH7Y4eRMyMj0p9g4ZTAVjZDBQvSJpiNbx+Cbl/HZjNFxQ31dKO3z1HPq VWyXlN7sB0Rkukgfof2gM3A3xnP4fMIqcX50fzMJy4znpsa4TKZhQzWqzPRU8oiGzguI naAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LreumIrE; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id h12-20020a05640250cc00b0044eae9d65c4si8503166edb.75.2022.09.12.10.05.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 10:05:41 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LreumIrE; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9668084B82; Mon, 12 Sep 2022 19:05:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="LreumIrE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 664ED84B7A; Mon, 12 Sep 2022 19:05:38 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1791784B7A for ; Mon, 12 Sep 2022 19:05:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jassisinghbrar@gmail.com Received: by mail-il1-x133.google.com with SMTP id h14so4851304ilh.10 for ; Mon, 12 Sep 2022 10:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=o91WJ0rjG0Wpot+iXXdGthvZyC5h2f8E3lxv7FocqJM=; b=LreumIrE5MgqAZCajg3sGfBGI8dOWvgsjRXON6LkW/YNtMSdBTBLv9cNpmi55ceJea ZuFEgtm4ZTHWdqmE+TP627o0O8LuJ+iL8jnNAnuCuBE+GiN2XMnDNpazDXH54jRCDkYg 9jwtUeqtt1ub8C1EQJ89LznqUZFhfCi4UKR+MbfsuIj+5bn+qSClQpxr7WOupU1uC6HW 2L7/h1DvqS4m9Yf48oiJ20MOLQ2sJEl6GBtyFV1s8OtSJ2J+xGe2CUdXHsyZh9zv/9+5 DAX0bQJ0abtvUhHMhONzU6AzgAELVUqhCwKCoDNFnuDSTbH49kYQ+b1o8qA2XkZgUCJL QPEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=o91WJ0rjG0Wpot+iXXdGthvZyC5h2f8E3lxv7FocqJM=; b=C5qstv6++qyzVw3UDYAILYG53waNWRoRWh3y+yUK9IPZHvYsLJhM866IPGSNsWmO4v 8yPh+048P4kPyibJCbyu195cDObt5eabzv2vZ0YVL6SRqbSWDX1iLPXDvWwIk1cIF2xM 8pzuzAWSufrSVm+UfUhZ3s8Qsb05E0Fxfu2JKYxtKE3VFsYQmzzrsGFxFek9uXZKIvVv 2TKa5tMKKU/W4IhlRJIHBjOyYRby0R3QcSJDXNEXKLUz3jKFDWEI2z3zXjCZMHSWUYgh yzVMlUgctBNku6sHkq6A/2J/5mWYJenybthdEs7N8YhBLr4YP1WTnCoqINhVT5xj0gv4 nOHw== X-Gm-Message-State: ACgBeo0lKGZ9QMq0OZ9ZJVt1yd8Tdt0dGTxUQvOyeEKux2YQyXf60o/e mhqYBnfh3X4j5apbYipBoUU= X-Received: by 2002:a92:da4b:0:b0:2f1:525a:90e7 with SMTP id p11-20020a92da4b000000b002f1525a90e7mr10925599ilq.307.1663002333511; Mon, 12 Sep 2022 10:05:33 -0700 (PDT) Received: from localhost.localdomain (wnpgmb0311w-ds01-45-179-115.dynamic.bellmts.net. [206.45.179.115]) by smtp.gmail.com with ESMTPSA id g71-20020a025b4a000000b00349bd096a82sm3946062jab.109.2022.09.12.10.05.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 10:05:33 -0700 (PDT) From: jassisinghbrar@gmail.com To: trini@konsulko.com, u-boot@lists.denx.de Cc: kojima.masahisa@socionext.com, ilias.apalodimas@linaro.org, Jassi Brar Subject: [PATCH 2/2] board: developerbox: move mem_map setup later Date: Mon, 12 Sep 2022 12:05:29 -0500 Message-Id: <20220912170529.719048-1-jassisinghbrar@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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: Jassi Brar dram_init() can't modify global/static variables, so move the mem_map setup later when bss is available. Signed-off-by: Jassi Brar --- board/socionext/developerbox/developerbox.c | 57 ++++++++++++--------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/board/socionext/developerbox/developerbox.c b/board/socionext/developerbox/developerbox.c index b680f77d80..412c811c12 100644 --- a/board/socionext/developerbox/developerbox.c +++ b/board/socionext/developerbox/developerbox.c @@ -56,8 +56,6 @@ struct draminfo { struct draminfo_entry entry[3]; }; -struct draminfo *synquacer_draminfo = (void *)SQ_DRAMINFO_BASE; - DECLARE_GLOBAL_DATA_PTR; #define LOAD_OFFSET 0x100 @@ -104,21 +102,44 @@ int ft_board_setup(void *blob, struct bd_info *bd) int dram_init(void) { + struct draminfo *synquacer_draminfo = (void *)SQ_DRAMINFO_BASE; + struct draminfo_entry *ent = synquacer_draminfo->entry; + + gd->ram_size = ent[0].size; + gd->ram_base = ent[0].base; + + return 0; +} + +int dram_init_banksize(void) +{ + struct draminfo *synquacer_draminfo = (void *)SQ_DRAMINFO_BASE; + struct draminfo_entry *ent = synquacer_draminfo->entry; + int i; + + for (i = 0; i < ARRAY_SIZE(gd->bd->bi_dram); i++) { + if (i < synquacer_draminfo->nr_regions) { + debug("%s: dram[%d] = %llx@%llx\n", __func__, i, ent[i].size, ent[i].base); + gd->bd->bi_dram[i].start = ent[i].base; + gd->bd->bi_dram[i].size = ent[i].size; + } + } + + return 0; +} + +void build_mem_map(void) +{ + struct draminfo *synquacer_draminfo = (void *)SQ_DRAMINFO_BASE; struct draminfo_entry *ent = synquacer_draminfo->entry; struct mm_region *mr; int i, ri; if (synquacer_draminfo->nr_regions < 1) { log_err("Failed to get correct DRAM information\n"); - return -1; + return; } - /* - * U-Boot RAM size must be under the first DRAM region so that it doesn't - * access secure memory which is at the end of the first DRAM region. - */ - gd->ram_size = ent[0].size; - /* Update memory region maps */ for (i = 0; i < synquacer_draminfo->nr_regions; i++) { if (i >= MAX_DDR_REGIONS) @@ -134,24 +155,14 @@ int dram_init(void) mr = &mem_map[DDR_REGION_INDEX(0)]; mem_map[ri].attrs = mr->attrs; } - - return 0; } -int dram_init_banksize(void) +void enable_caches(void) { - struct draminfo_entry *ent = synquacer_draminfo->entry; - int i; - - for (i = 0; i < ARRAY_SIZE(gd->bd->bi_dram); i++) { - if (i < synquacer_draminfo->nr_regions) { - debug("%s: dram[%d] = %llx@%llx\n", __func__, i, ent[i].size, ent[i].base); - gd->bd->bi_dram[i].start = ent[i].base; - gd->bd->bi_dram[i].size = ent[i].size; - } - } + build_mem_map(); - return 0; + icache_enable(); + dcache_enable(); } int print_cpuinfo(void)