From patchwork Mon May 4 11:44:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rayagonda Kokatanur X-Patchwork-Id: 1282490 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=Ox9P1o5z; 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 49G1LP2Zdcz9sP7 for ; Mon, 4 May 2020 21:47:25 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DBF6381FCC; Mon, 4 May 2020 13:45:59 +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="Ox9P1o5z"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BC36C81FCC; Mon, 4 May 2020 13:45:58 +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-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) (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 C099181F7A for ; Mon, 4 May 2020 13:45:55 +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=rayagonda.kokatanur@broadcom.com Received: by mail-pl1-x642.google.com with SMTP id f8so6658767plt.2 for ; Mon, 04 May 2020 04:45:55 -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=/+jv+1ByzE2PgCrmjDzP7YS9BpjG5jYkykSyXc6FPTU=; b=Ox9P1o5z2qHHGa/HYEWb3Qbxj+fYE4fk7ifiLWI5US8d9Tov2QIWzTX4QGCrlS1hNe /sD2SSAJ2neylkyuiTC4TYmxGlSlG2dxlU34oQDYnnHehFxOTscDhUKlMt2qrv2ATeXl 5xGaa9vcbHQ3evOqBGS4fxT+XieiNT5oZFQZo= 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=/+jv+1ByzE2PgCrmjDzP7YS9BpjG5jYkykSyXc6FPTU=; b=RRdAn1nbgg1MGq+R6LvOdoImMXEzIl8Upn/r4cdlrpGks/C651ONz6JeYm4qKdkDBX J5/dw3QVtH1etaLFVJYt9NlJn82P6BRH5mQBqZWbenRaBHeKXd8hlTGHo5d2JMKiALFP cIHPLKjSxOiimUa2sCJmq5DBJHCRJLOIvPwLoO2y+XMIQEG8ORDeviB0peyCZ6iu4yno OhQ7IFbwu0e3X4F4AusBvDdXiBwJKOl+txfYrX8ibFJtlGsZMZ6MUkw/f4AIelgl3bbt gJ8a7EiDbJGrbuJ33FaCBaL9YV0LqPto0YsiLztXwaah836vyLpG/Z1eVz5wSK3vP3Cd N2Zg== X-Gm-Message-State: AGi0PuZv7YaMEsLkmGvjGzuzuvVOKRlCIJJdyrh2g0fFU9ICJsecF8W5 K/L0k9lB9stvSuBF53ofZjH5saz12cimpwLhzh3LQHgrEqMBs/mb4ocZT7VBF9grBIP5RxkCG4X 0MXtbxKjask+WnjXl7kO5B+yOMnX9vJYqe6LLlwUvsMZ95nd+QncPzjkh5RMKG2zwRfh+ounbDz c/FTJ8Eg== X-Google-Smtp-Source: APiQypKxABaVj7PUzUX+CBipz7fMW80x992ixyYpmxNICYljyE9AVKtOEkIXy6DojtAcSVlGehrztA== X-Received: by 2002:a17:902:8697:: with SMTP id g23mr17299235plo.306.1588592753637; Mon, 04 May 2020 04:45:53 -0700 (PDT) Received: from rayagonda.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id t20sm6712962pjo.13.2020.05.04.04.45.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 04:45:53 -0700 (PDT) From: Rayagonda Kokatanur To: u-boot@lists.denx.de, Simon Glass , Marek Vasut , Bharat Kumar Reddy Gooty Cc: Rayagonda Kokatanur Subject: [PATCH v2 13/16] board: ns3: limit U-boot relocation within 16MB memory Date: Mon, 4 May 2020 17:14:29 +0530 Message-Id: <20200504114432.10886-14-rayagonda.kokatanur@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200504114432.10886-1-rayagonda.kokatanur@broadcom.com> References: <20200504114432.10886-1-rayagonda.kokatanur@broadcom.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean From: Bharat Kumar Reddy Gooty By default re-location happens to higher address of DDR, i.e, DDR start + DDR size. Limit re-location 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 --- 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 514c2050b2..51cab1aad3 100644 --- a/board/broadcom/bcmns3/ns3.c +++ b/board/broadcom/bcmns3/ns3.c @@ -121,6 +121,11 @@ static void 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"); @@ -134,19 +139,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