From patchwork Fri Jul 10 08:52:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rayagonda Kokatanur X-Patchwork-Id: 1326579 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=broadcom.com header.i=@broadcom.com header.a=rsa-sha256 header.s=google header.b=K7coDX92; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B36LZ1PzVz9sRK for ; Fri, 10 Jul 2020 18:55:02 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 13750821C3; Fri, 10 Jul 2020 10:53:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=broadcom.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=broadcom.com header.i=@broadcom.com header.b="K7coDX92"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 893C481F26; Fri, 10 Jul 2020 10:53:28 +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.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (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 648218216B for ; Fri, 10 Jul 2020 10:53:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=rayagonda.kokatanur@broadcom.com Received: by mail-pg1-x543.google.com with SMTP id k27so2246791pgm.2 for ; Fri, 10 Jul 2020 01:53:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sco6eHR8c4l8hBB5bGd6RxldRwBljtZMqvLPEB8uR2k=; b=K7coDX92xRDoQXWC5tcEkZbdDMM4Q4RzhWsYyFF4bw+7z3ORhPBZY8mu0UwQdzKmlB x4PtgbUfjhxJA/PIDT7VTDMwUm9XLyP9T1dkLpwFJVr21A5SYFBcZHLKsrVxVDh+QaSF LGcZQp6AHAR2bxyGHQq5YXO/o/n4eRfX4HP70= 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; bh=sco6eHR8c4l8hBB5bGd6RxldRwBljtZMqvLPEB8uR2k=; b=gB2bZslTUnHIV49g6DQysKCyCcXuJx1Nr/m0PsanHdLOO25aJN7tJrkZOuArDsdizw i0bVqMqVINWc19kxhmP8i5RPdgWKi78SoR9NqPixou8aau8L/8zaxtEQQB+a4E/q2A9Z VUYyllQa1E3BRW2RWEHVCT8geQ9yjUoZYT1qBrU8+GfiuHO/7fbTq4QsVYmxTzklbSuq l3Qda7n2HuhBWXouKA0XJr1+j6vQAQD+gqEHupBpe4IrOGG60zkjgtuRv7v8W4bYYlyC PSE9mk5hrJUYYGiF3jyVWPoEg3d6CWkaa8RTKso1zVRNQoNwl2N2Z3DBofY+o81LJY/c hk2g== X-Gm-Message-State: AOAM530p+tvaAU6La+4blDSw0C45atuq8XOfyXxrMNQ+1JXJm01EpGiD rA/9Co3zQvYTVhitFKDMemJ8oJHDlcBdVGZZ8yYkvECC62IOL+r8k1O6fOCXOkZCc1lkF5/Of8x vgXTcFyGxf+FzSMID102ICUOVgWgFUT2g7cgDL/0ueoGw7zQFpnVVRXxPSRDx4OVgBRhAX649ur 8Z1nI= X-Google-Smtp-Source: ABdhPJz0MG72kQsRFYKwvEHAG3gJebJa59651NfNfdwHs+M5pknO06B0vc12kI2r1CYO0M48x7S3MQ== X-Received: by 2002:a62:8f50:: with SMTP id n77mr36889135pfd.259.1594371201133; Fri, 10 Jul 2020 01:53:21 -0700 (PDT) Received: from rayagonda.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id k26sm5145914pgi.16.2020.07.10.01.53.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 01:53:20 -0700 (PDT) From: Rayagonda Kokatanur To: u-boot@lists.denx.de, Simon Glass , Marek Vasut , Bharat Gooty , Peter Tyser , Thomas Fitzsimmons Cc: Rayagonda Kokatanur Subject: [PATCH v4 11/15] board: ns3: limit U-boot relocation within 16MB memory Date: Fri, 10 Jul 2020 14:22:16 +0530 Message-Id: <20200710085220.32730-12-rayagonda.kokatanur@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200710085220.32730-1-rayagonda.kokatanur@broadcom.com> References: <20200710085220.32730-1-rayagonda.kokatanur@broadcom.com> 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.102.3 at phobos.denx.de X-Virus-Status: Clean From: Bharat Kumar Reddy Gooty By default relocation happens to a higher address of DDR, i.e, DDR start + DDR size. U-Boot shall be used to collect the ramdump. Restrict U-Boot to use only the 16MB memory, so that this memory can be reserved. Limit relocation to happen within 16MB memory, start 0xFF00_0000 and end 0x1_0000_0000 Signed-off-by: Bharat Kumar Reddy Gooty Signed-off-by: Rayagonda Kokatanur Reviewed-by: Simon Glass --- Changes from v3: -Address review comments from Simon, Update the commit message. board/broadcom/bcmns3/ns3.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/board/broadcom/bcmns3/ns3.c b/board/broadcom/bcmns3/ns3.c index 418db67875..33e25376f2 100644 --- a/board/broadcom/bcmns3/ns3.c +++ b/board/broadcom/bcmns3/ns3.c @@ -141,6 +141,11 @@ static int mem_info_parse_fixup(void *fdt) int board_init(void) { + /* Setup memory using "memory" node from DTB */ + if (fdtdec_setup_mem_size_base() != 0) + return -EINVAL; + fdtdec_setup_memory_banksize(); + if (bl33_info->version != BL33_INFO_VERSION) printf("*** warning: ATF BL31 and u-boot not in sync! ***\n"); @@ -154,19 +159,30 @@ int board_late_init(void) int dram_init(void) { - if (fdtdec_setup_mem_size_base() != 0) - return -EINVAL; + /* + * Mark ram base as the last 16MB of 2GB DDR, which is 0xFF00_0000. + * So that relocation happens with in the last 16MB memory. + */ + gd->ram_base = (phys_size_t)(BCM_NS3_MEM_END - SZ_16M); + gd->ram_size = (unsigned long)SZ_16M; return 0; } int dram_init_banksize(void) { - fdtdec_setup_memory_banksize(); + gd->bd->bi_dram[0].start = (BCM_NS3_MEM_END - SZ_16M); + gd->bd->bi_dram[0].size = SZ_16M; return 0; } +/* Limit RAM used by U-Boot to the DDR first bank End region */ +ulong board_get_usable_ram_top(ulong total_size) +{ + return BCM_NS3_MEM_END; +} + void reset_cpu(ulong level) { #define L3_RESET 30