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: 1676996 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=LreumIrE; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MRCfJ1rKmz1yhR for ; Tue, 13 Sep 2022 03:05:44 +1000 (AEST) 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-Google-Smtp-Source: AA6agR66UJhH/F7sqWxn91F1NfPMkhtmZCECGrw2kdFEZAIJWQ87u+nfnBOuZvJ+fjjDr2a+STfjQg== 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)