From patchwork Tue Nov 20 12:04:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1000422 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nic.cz Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=nic.cz header.i=@nic.cz header.b="GhowxTEH"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42zkyC4Tbtz9s3l for ; Tue, 20 Nov 2018 23:08:51 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id F2D6CC2202E; Tue, 20 Nov 2018 12:07:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 061AEC22054; Tue, 20 Nov 2018 12:04:22 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3E5EDC22027; Tue, 20 Nov 2018 12:04:11 +0000 (UTC) Received: from mail.nic.cz (mail.nic.cz [217.31.204.67]) by lists.denx.de (Postfix) with ESMTPS id 608B2C2203C for ; Tue, 20 Nov 2018 12:04:11 +0000 (UTC) Received: from dellmb.labs.office.nic.cz (unknown [IPv6:2001:1488:fffe:6:cac7:3539:7f1f:463]) by mail.nic.cz (Postfix) with ESMTP id 0C27363FDB; Tue, 20 Nov 2018 13:04:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1542715451; bh=sqjB99K7wm+Q1xuv3qePTNm3BGIRcSgHfv8bKHX9w1E=; h=From:To:Date; b=GhowxTEH2GOnrDqjLEV7sKeM4EN6x4yzaMe/vIVkIfJHOcyrHRCrfKw4Zb+bcWIYu 2NW1xUJmvK5mKN0hyr5Aks54LOIOdBI1DBEr3nU+oeN3SQZakz72V2rHZWe1Y0V7Mg Se5OUo8Xn22mMzaHY2cExuLQQKxq84VF6juAMaMo= From: =?utf-8?q?Marek_Beh=C3=BAn?= To: u-boot@lists.denx.de Date: Tue, 20 Nov 2018 13:04:08 +0100 Message-Id: <20181120120409.12822-9-marek.behun@nic.cz> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20181120120409.12822-1-marek.behun@nic.cz> References: <20181120120409.12822-1-marek.behun@nic.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at mail X-Virus-Status: Clean Cc: Stefan Roese Subject: [U-Boot] [PATCH u-boot-marvell v3 09/10] board: turris_mox: Support 1 GB version of Turris Mox X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" Depending on the data in the OTP memory, differentiate between the 512 MiB and 1 GiB versions of Turris Mox and report these RAM sizes in dram_init and dram_init_banksize. Signed-off-by: Marek BehĂșn --- arch/arm/mach-mvebu/arm64-common.c | 7 ++++++- board/CZ.NIC/turris_mox/turris_mox.c | 27 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-mvebu/arm64-common.c b/arch/arm/mach-mvebu/arm64-common.c index f47273fde9..5e6ac9fc4a 100644 --- a/arch/arm/mach-mvebu/arm64-common.c +++ b/arch/arm/mach-mvebu/arm64-common.c @@ -43,8 +43,12 @@ const struct mbus_dram_target_info *mvebu_mbus_dram_info(void) return NULL; } -/* DRAM init code ... */ +/* + * DRAM init code ... + * Turris Mox defines this itself, depending on data in burned eFuses + */ +#ifndef CONFIG_TARGET_TURRIS_MOX int dram_init_banksize(void) { fdtdec_setup_memory_banksize(); @@ -59,6 +63,7 @@ int dram_init(void) return 0; } +#endif /* !CONFIG_TARGET_TURRIS_MOX */ int arch_cpu_init(void) { diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c index 89b3cd2ce0..9aa2fc004d 100644 --- a/board/CZ.NIC/turris_mox/turris_mox.c +++ b/board/CZ.NIC/turris_mox/turris_mox.c @@ -14,6 +14,7 @@ #include #include #include +#include #ifdef CONFIG_WDT_ARMADA_37XX #include @@ -40,6 +41,32 @@ DECLARE_GLOBAL_DATA_PTR; +int dram_init(void) +{ + int ret, ram_size; + + gd->ram_base = 0; + gd->ram_size = (phys_size_t)0x20000000; + + ret = mbox_sp_get_board_info(NULL, NULL, NULL, NULL, &ram_size); + if (ret < 0) { + puts("Cannot read RAM size from OTP, defaulting to 512 MiB"); + } else { + if (ram_size == 1024) + gd->ram_size = (phys_size_t)0x40000000; + } + + return 0; +} + +int dram_init_banksize(void) +{ + gd->bd->bi_dram[0].start = (phys_addr_t)0; + gd->bd->bi_dram[0].size = gd->ram_size; + + return 0; +} + #if defined(CONFIG_OF_BOARD_FIXUP) int board_fix_fdt(void *blob) {