From patchwork Tue Jul 14 23:03:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 1329443 X-Patchwork-Delegate: ykai007@gmail.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=85.214.62.61; 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=mpivB/Hs; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4B6GJD1CnVz9sTR for ; Wed, 15 Jul 2020 22:03:53 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1152A8006D; Wed, 15 Jul 2020 14:03:45 +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="mpivB/Hs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B9D0C81BD8; Wed, 15 Jul 2020 01:03:41 +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,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) (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 BE36D81BA8 for ; Wed, 15 Jul 2020 01:03:38 +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=knaerzche@gmail.com Received: by mail-ej1-x644.google.com with SMTP id p20so175175ejd.13 for ; Tue, 14 Jul 2020 16:03:38 -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:mime-version :content-transfer-encoding; bh=n4Gn0RhhFB4qwfh3u+kLvqYCRCRmoYNubbiyRl7v1jo=; b=mpivB/HsZ5hzeHv2rCNpAF5KALZvb0sPzn3i3rK0p4/64SQvfqs3T7qzZPx2AfiFIM gfW1Ln6o8Gh0zN3N4GqXXH3iZbpzEZpLKvdxBSPvtEJKIwvbBhN+FtUNc+v7JtDUn3ys YB0YGq6+YJASoRUQXiCRfwAjqnhFQjv1lkifeHiWKCf4HhnoXvl3HqYg+3QQgYLvg9nA BFcHzcG4+sQTaao9LusdlvPyE07xdEfokvXP414abWUL6xI3FAXKSCA6NXPZ0m4BNR00 G/YZEb8c8dGKtk7xTS21Nyv+tIFec7d2MJOrmVM5DQdun++J1ORJxSJlAwkO2kDJjR+V 3gaA== 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:mime-version :content-transfer-encoding; bh=n4Gn0RhhFB4qwfh3u+kLvqYCRCRmoYNubbiyRl7v1jo=; b=Yoi3ie9w9dlE3iTJnXpFuJ5xGNdnDwCncd2HLHi6kDF9poyUJhtICgzbIXJ7cAGcqI gAYFdbR+t4yUEOzZJ0L1NUp4QMVUCqTh9FNy5qnUUC1R7K19+GajyllcQ/q47qRP76nj lnYM96zFys34sEaroJwII+csgY2Wipw4MGay5CyzHTcZer3VUQ6vL9J4BGsnrLEWxN9O 9kFdkcafKDMPCrbqiIVWz4xENMB40k8t/7a5Q1WUwQ+f43+0TgfzpJtlDHbvHPJxQ/d2 Lwe3khDexkr8K42Yi/4heqA3zQcSmJrFUc9U6LBip8TkNentQaZQUTVn35M4JGt8Jd4u rF/A== X-Gm-Message-State: AOAM532AXn7G/A5YEJ8rZqQQiLTLa4rnCWZffFA2YXexiZfeZEw1Fq9q apuU41CyV6QVpy0iAT/TKY1X3k5zTvyr X-Google-Smtp-Source: ABdhPJwr3oinQSCKBS1pbDRQG9SQJLjb92q82xM5iWS3c64RiPPk9NBFOp0OK5MZJjTp6hS5DBQAVg== X-Received: by 2002:a17:906:abd6:: with SMTP id kq22mr6915877ejb.458.1594767817972; Tue, 14 Jul 2020 16:03:37 -0700 (PDT) Received: from localhost.localdomain (ip5b436a54.dynamic.kabel-deutschland.de. [91.67.106.84]) by smtp.googlemail.com with ESMTPSA id gu16sm197158ejb.35.2020.07.14.16.03.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 16:03:37 -0700 (PDT) From: Alex Bee To: u-boot@lists.denx.de, Simon Glass , Philipp Tomsich , Kever Yang Cc: Alex Bee Subject: [PATCH] rockchip: sdram: fix dram_init_banksize Date: Wed, 15 Jul 2020 01:03:31 +0200 Message-Id: <20200714230332.28491-1-knaerzche@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 15 Jul 2020 14:03:43 +0200 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 Currently 2.5 GB is calculated as DRAM size for a 1 GB RK322x board if CONFIG_SPL_OPTEE is set. This is troublesome when booting a linux kernel since this size will be injected in FDT of the kernel. gd->bd->bi_dram[0].start (which is basically CONFIG_SYS_SDRAM_BASE) must not be taken into consideration for calculation of second bank size, since this offset is already included in calculation of "top". After applying this patch 992 MB (1024 MB - 32 MB reserved for optee-os) is correctly calculated and has also been verified on 2 GB boards. Signed-off-by: Alex Bee Reviewed-by: Kever Yang --- arch/arm/mach-rockchip/sdram.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-rockchip/sdram.c b/arch/arm/mach-rockchip/sdram.c index 24fe6cc8f0..4c637b7767 100644 --- a/arch/arm/mach-rockchip/sdram.c +++ b/arch/arm/mach-rockchip/sdram.c @@ -56,16 +56,14 @@ int dram_init_banksize(void) - CONFIG_SYS_SDRAM_BASE; gd->bd->bi_dram[1].start = tos_parameter->tee_mem.phy_addr + tos_parameter->tee_mem.size; - gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start - + top - gd->bd->bi_dram[1].start; + gd->bd->bi_dram[1].size = top - gd->bd->bi_dram[1].start; } else { gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; gd->bd->bi_dram[0].size = 0x8400000; /* Reserve 32M for OPTEE with TA */ gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE + gd->bd->bi_dram[0].size + 0x2000000; - gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start - + top - gd->bd->bi_dram[1].start; + gd->bd->bi_dram[1].size = top - gd->bd->bi_dram[1].start; } #else gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;