From patchwork Tue Jun 11 14:50:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1113958 X-Patchwork-Delegate: jagannadh.teki@gmail.com 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=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="ByS6AL9F"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45NYgg1Hsxz9s5c for ; Wed, 12 Jun 2019 01:23:59 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id C6AD7C22180; Tue, 11 Jun 2019 15:12:06 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 67265C2214B; Tue, 11 Jun 2019 15:08:08 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CD6C5C2211B; Tue, 11 Jun 2019 14:54:56 +0000 (UTC) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by lists.denx.de (Postfix) with ESMTPS id 961FBC21DF9 for ; Tue, 11 Jun 2019 14:54:52 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id 196so7117341pgc.6 for ; Tue, 11 Jun 2019 07:54:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YkuVVRMXiZIA/m7cVW93c891hOorYukwdD8YcfXRjME=; b=ByS6AL9F8rihuRX+7JCs1LPEQBMVQN7XZYRU8nxu7gU9s54TpPCXb2S+gBql58oruc fcwcYkyWVZfBUBeaYJCKDYNuhmuD1g/YvcZWGNchjghr0yhVw95jzt11CP1N2wTfB/Xg Xpwp1W0nHKEu31sDdBJbbnN6zQl5V150Ugt+k= 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:mime-version:content-transfer-encoding; bh=YkuVVRMXiZIA/m7cVW93c891hOorYukwdD8YcfXRjME=; b=FzeR6kdyvjot1WB48ah0gJ41wZOpE8j1dGIrigBaCzdjvn0+o63BgmyBkemWpn5PHy 9NuW79UPI4cGru6qjvde3GMoRWuNpi7fxMxsk2GKGZGRlaQKKZmxyiXvTm5uWu/m5PUw bQZIeJ5P7gewy4y+RDKrZ19uj0aOsFTuQTVQvrv5nELuZsLA3FrMimgxd2rXcZo9bZdd DOd3a5MrGMHw7K2B02+e2rbNcOJLlkDxWxrM0sarPwGsZIFqY3V66KFvb1hfMV+SJOMC 1BlEfmFEWJbEfX9039u3KoLKApeYkpsS5t/bYgFVltf7i53slO64TmPFK87uX9P2xdaZ Mneg== X-Gm-Message-State: APjAAAW1pkn+YuqtMGyqrwxfAJ+6f/pZ0KeyUi815bxQIGHx8W03YpCc tqniScroD7Y70RfjXrDohMii0A== X-Google-Smtp-Source: APXvYqwu0CelnaIOq3vHDryWyxU6kCmJwonGdT36q+TamS92+j1++iOG3ykVK749XDwRnvzzTTpnXg== X-Received: by 2002:aa7:921a:: with SMTP id 26mr37534014pfo.99.1560264891166; Tue, 11 Jun 2019 07:54:51 -0700 (PDT) Received: from localhost.localdomain ([115.97.180.18]) by smtp.gmail.com with ESMTPSA id e9sm16206208pfn.154.2019.06.11.07.54.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 07:54:50 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Date: Tue, 11 Jun 2019 20:20:48 +0530 Message-Id: <20190611145135.21399-46-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190611145135.21399-1-jagan@amarulasolutions.com> References: <20190611145135.21399-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Cc: linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, gajjar04akash@gmail.com Subject: [U-Boot] [PATCH 45/92] ram: rockchip: debug: Add sdram_print_ddr_info 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" Add sdram ddr info print support, this would help to observe the sdram base parameters. Here is sample print on LPDDR4, 50MHz channel 0 BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen --- .../include/asm/arch-rockchip/sdram_common.h | 7 ++++ drivers/ram/rockchip/sdram_debug.c | 40 +++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/arch/arm/include/asm/arch-rockchip/sdram_common.h b/arch/arm/include/asm/arch-rockchip/sdram_common.h index ebf4148b4d..3935733871 100644 --- a/arch/arm/include/asm/arch-rockchip/sdram_common.h +++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h @@ -127,8 +127,15 @@ int dram_init(void); inline void sdram_print_dram_type(unsigned char dramtype) { } + +inline void sdram_print_ddr_info(struct sdram_cap_info *cap_info, + struct sdram_base_params *base) +{ +} #else void sdram_print_dram_type(unsigned char dramtype); +void sdram_print_ddr_info(struct sdram_cap_info *cap_info, + struct sdram_base_params *base); #endif /* CONFIG_RAM_ROCKCHIP_DEBUG */ #endif diff --git a/drivers/ram/rockchip/sdram_debug.c b/drivers/ram/rockchip/sdram_debug.c index c13e140fa5..69a6f94a73 100644 --- a/drivers/ram/rockchip/sdram_debug.c +++ b/drivers/ram/rockchip/sdram_debug.c @@ -32,3 +32,43 @@ void sdram_print_dram_type(unsigned char dramtype) break; } } + +void sdram_print_ddr_info(struct sdram_cap_info *cap_info, + struct sdram_base_params *base) +{ + u32 bg; + + bg = (cap_info->dbw == 0) ? 2 : 1; + + sdram_print_dram_type(base->dramtype); + + printascii(", "); + printdec(base->ddr_freq); + printascii("MHz\n"); + + printascii("BW="); + printdec(8 << cap_info->bw); + + printascii(" Col="); + printdec(cap_info->col); + + printascii(" Bk="); + printdec(0x1 << cap_info->bk); + if (base->dramtype == DDR4) { + printascii(" BG="); + printdec(1 << bg); + } + + printascii(" CS0 Row="); + printdec(cap_info->cs0_row); + if (cap_info->rank > 1) { + printascii(" CS1 Row="); + printdec(cap_info->cs1_row); + } + + printascii(" CS="); + printdec(cap_info->rank); + + printascii(" Die BW="); + printdec(8 << cap_info->dbw); +}