From patchwork Fri Mar 27 10:28:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1262706 X-Patchwork-Delegate: sbabic@denx.de 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=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=L6CIwJZR; 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 48pdQY0Cc6z9sSL for ; Fri, 27 Mar 2020 21:29:56 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8792981850; Fri, 27 Mar 2020 11:29:30 +0100 (CET) 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="L6CIwJZR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B4C2A818C1; Fri, 27 Mar 2020 11:28:48 +0100 (CET) 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,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) (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 3F55C818A4 for ; Fri, 27 Mar 2020 11:28:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=igor.opaniuk@gmail.com Received: by mail-lj1-x243.google.com with SMTP id 19so9607741ljj.7 for ; Fri, 27 Mar 2020 03:28:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=104rpwl92nXx5x0eqW/MV0nOSTQqX2wc5zO27OWTvgs=; b=L6CIwJZRCmmAT3aOVAx7wRhHxfpNalVf5/Ik4rDdou3wAWj08bXnFl47pEyq6dULYk V7R2wrfIDEBuBoSI4A/UVYpvBK84lfwEJ973KX/ejrYoXesj+fw3FY1GHrEyHlQtfcjt CrO16ZRmjeJgNEkVLNT2bxsJUBMSE4G4hx2QE1OfzT9gk27v4mczIUzJb5zAQ9AW1W9q GcVBTIM9ngWjanO46v6CNIReHKx0Yr/tmk1xBwr4q1OydaaKTYy7+ICLogvMpsRELjRG fRsqoiJV0A0v1YsrUG2PStA9pYgGlVU9n2V0Ah37mTE7hyDeOd0qMZc8TnRmkBq1bY+H 5NsA== 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=104rpwl92nXx5x0eqW/MV0nOSTQqX2wc5zO27OWTvgs=; b=kh+bGFJpjMRfozEtx9UBIA5vvVgUHZR8Z+eq1W4YWtnHS1Ji3EjGqZzztoZbj31I8F zqAxEm87tZAdbrUsfp0eSMh5modK3/MXaiTaAmOlhKVJYkEFnwuyER3qWhGme/DjVYnR f3LAt4EmM+/Y/Goy0gnqyUPFX3CNg+X1RI1j7euCNuIWy4yxOuApsC4/a1pvXmtxjYeV RcTsY9JjiNhGMQbFaV0mVIRtXlWy7bnHKYDtXDhR3Wb5EocEg+ag65AgUxvDYTbfrJDB I/8JE/NCBtmE9ewIp6/7+VIZZePLGyb7sOX9O5E3vhdiXlJhOANVxCMSd1PGmW3zmrva /7ew== X-Gm-Message-State: AGi0PuZPzfeIXsDv3TLLi7OzkcCGqiTqpKQznEIByiDIU8gGZPNojG30 LqLdjgEn2/DLGlidRHXWvmZoC/8Sud0= X-Google-Smtp-Source: APiQypIpQ2ja9Uw4Rx8C2E4HV2jri54nvcjxWMIyn55q4BLNSe7G59hnGmVUw5dXqDFCSJvgxl/YQg== X-Received: by 2002:a2e:8ec2:: with SMTP id e2mr783354ljl.252.1585304920234; Fri, 27 Mar 2020 03:28:40 -0700 (PDT) Received: from localhost (host-176-37-176-139.la.net.ua. [176.37.176.139]) by smtp.gmail.com with ESMTPSA id v12sm2553644ljh.6.2020.03.27.03.28.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Mar 2020 03:28:39 -0700 (PDT) From: Igor Opaniuk To: u-boot@lists.denx.de Cc: Marcel Ziswiler , Stefano Babic , Oleksandr Suvorov , Max Krummenacher , Philippe Schenker , Igor Opaniuk Subject: [PATCH v2 06/13] verdin-imx8mm: adjust dram size in case bl32 is used Date: Fri, 27 Mar 2020 12:28:18 +0200 Message-Id: <20200327102825.10230-7-igor.opaniuk@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200327102825.10230-1-igor.opaniuk@gmail.com> References: <20200327102825.10230-1-igor.opaniuk@gmail.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: Igor Opaniuk Adjust DRAM size in case BL32 secure payload is loaded (OP-TEE/Trusty), so during MMU initialization U-Boot won't touch this mem area. BL32 is loaded to the end of DRAM, bl32 payload size is read from rom_pointer[1]. This relates to the issue described in 59efa6b52b("imx8m: Fix MMU table issue for OPTEE memory"). Signed-off-by: Igor Opaniuk --- board/toradex/verdin-imx8mm/verdin-imx8mm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c b/board/toradex/verdin-imx8mm/verdin-imx8mm.c index 16b9fa1ec1..cb9b4e3b0a 100644 --- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c +++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -13,7 +14,11 @@ DECLARE_GLOBAL_DATA_PTR; int dram_init(void) { - gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE); + /* rom_pointer[1] contains the size of TEE occupies */ + if (rom_pointer[1]) + gd->ram_size = PHYS_SDRAM_SIZE - rom_pointer[1]; + else + gd->ram_size = PHYS_SDRAM_SIZE; return 0; }