Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E4334C00140 for ; Thu, 18 Aug 2022 14:53:50 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 914E984B03; Thu, 18 Aug 2022 16:53:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=edgeble.ai 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=edgeble-ai.20210112.gappssmtp.com header.i=@edgeble-ai.20210112.gappssmtp.com header.b="igO7TeM9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6F3D983AC3; Thu, 18 Aug 2022 16:53:08 +0200 (CEST) Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) (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 1E49583AC3 for ; Thu, 18 Aug 2022 16:53:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=edgeble.ai Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=jagan@edgeble.ai Received: by mail-pj1-x102e.google.com with SMTP id g18so1955649pju.0 for ; Thu, 18 Aug 2022 07:53:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=edgeble-ai.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=i9jfBlOJjaQs/rUntvjrY151NrisjzpE145L3QcZz7U=; b=igO7TeM9NeQM3+HhwdTofc73T97Qxc8ObCCl8mTAQmIF8FwXXObc5UFP3MuzfTBt2z 4uxvKsPugQ9Qzp+mToGmfA6f6lit4p1puNcPmKKdwnn2tybjAz0gV9H2P6zXR3IHC+R5 rJRbkKq18czC8qIBCWtBt99pUKEDzOL/yDp+dXRuVeMBu8902q8jM+UpK5OEkygzEJSv kT301nAols02tpViii34ibGXTJoGc/OuLIt6DBRzn8uGZPwIQ9ZTyQNezPQhRxqAj1lF 9ynwr7W5cHBHauBJJ9rlV2Fc3HsiILf3ePDA4YICpIVXCYNP32A8xt2HFrZ/vW5bTp9W Lqxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=i9jfBlOJjaQs/rUntvjrY151NrisjzpE145L3QcZz7U=; b=RbGPUlV7LP+UUmqYsHwDKLwYM1OUfmgiw5GX53wadQIYSubLLh5HIKoPp3Vn548dpD Q8LurmRu8n7eKbepaiQuXmLpAppPB6K9+HUtrDv/n0VJj6yx5PZzIW4q/MGtP2a8HIvc ZS6vIP4/1E7A9VveK/ndIqkx6hnqm1Rm2Z7uHkahCTotO5tLQUK2AZ6Hi2T6X/Fhl5Xa +X7Ful/ncqcmFYDmNhe8tV4KVQaELOdaCyl0Lh8+kpUFpYAbvkBs9sAixJRRwC72wSSG HRsg6/ih7qQoRONNr1cQ/+z5gt2SazFK+fxvFPcA5NrjuroI2BYWcoRJ7SUy29gCd6/4 95oA== X-Gm-Message-State: ACgBeo3hyZl4VmZUoKok4l8YIgXaUpKot0RmONneHUYjISK3kSGezbSH FDtHP0wd4UgGZQ73osviR15uWw== X-Google-Smtp-Source: AA6agR4XPX2qSwdXiyBfxSTO4hNmBCQOslr3urDm70fCc5QJNKORQz8A20ycHZgVxEbJ5mIXll9alg== X-Received: by 2002:a17:90b:380f:b0:1f5:55ef:a53a with SMTP id mq15-20020a17090b380f00b001f555efa53amr3426627pjb.14.1660834383307; Thu, 18 Aug 2022 07:53:03 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:d1c4:8ea9:aedc:add1]) by smtp.gmail.com with ESMTPSA id i15-20020a17090332cf00b0016dc6243bb2sm1504818plr.143.2022.08.18.07.53.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 07:53:03 -0700 (PDT) From: Jagan Teki To: Kever Yang , Philipp Tomsich , Simon Glass Cc: u-boot@lists.denx.de, Jagan Teki , YouMin Chen Subject: [PATCH v2 04/28] ram: rockchip: Compute ddr capacity based on grf split Date: Thu, 18 Aug 2022 20:22:22 +0530 Message-Id: <20220818145246.201205-5-jagan@edgeble.ai> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220818145246.201205-1-jagan@edgeble.ai> References: <20220818145246.201205-1-jagan@edgeble.ai> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.6 at phobos.denx.de X-Virus-Status: Clean DDR chip capacity is computed based on GRF split in some Rockchip SoC's like PX30 and RV1126. Add split argument in ddr print info so-that the respective ddr driver will pass the grf split. Signed-off-by: YouMin Chen Signed-off-by: Jagan Teki --- Changes for v2: - none arch/arm/include/asm/arch-rockchip/sdram_common.h | 2 +- drivers/ram/rockchip/sdram_common.c | 6 ++++-- drivers/ram/rockchip/sdram_px30.c | 2 +- drivers/ram/rockchip/sdram_rk3328.c | 2 +- drivers/ram/rockchip/sdram_rk3399.c | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/arm/include/asm/arch-rockchip/sdram_common.h b/arch/arm/include/asm/arch-rockchip/sdram_common.h index 5efa6e9445..a14b37cbc5 100644 --- a/arch/arm/include/asm/arch-rockchip/sdram_common.h +++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h @@ -116,7 +116,7 @@ struct sdram_base_params { void sdram_print_dram_type(unsigned char dramtype); void sdram_print_ddr_info(struct sdram_cap_info *cap_info, - struct sdram_base_params *base); + struct sdram_base_params *base, u32 split); void sdram_print_stride(unsigned int stride); void sdram_org_config(struct sdram_cap_info *cap_info, diff --git a/drivers/ram/rockchip/sdram_common.c b/drivers/ram/rockchip/sdram_common.c index b3e7421d08..1c3236746a 100644 --- a/drivers/ram/rockchip/sdram_common.c +++ b/drivers/ram/rockchip/sdram_common.c @@ -36,7 +36,7 @@ void sdram_print_dram_type(unsigned char dramtype) } void sdram_print_ddr_info(struct sdram_cap_info *cap_info, - struct sdram_base_params *base) + struct sdram_base_params *base, u32 split) { u64 cap; u32 bg; @@ -83,6 +83,8 @@ void sdram_print_ddr_info(struct sdram_cap_info *cap_info, cap = sdram_get_cs_cap(cap_info, 3, base->dramtype); if (cap_info->row_3_4) cap = cap * 3 / 4; + else if (split) + cap = cap / 2 + (split << 24) / 2; printascii(" Size="); printdec(cap >> 20); @@ -123,7 +125,7 @@ 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) + struct sdram_base_params *base, u32 split) { } diff --git a/drivers/ram/rockchip/sdram_px30.c b/drivers/ram/rockchip/sdram_px30.c index 357fe2432a..a003893538 100644 --- a/drivers/ram/rockchip/sdram_px30.c +++ b/drivers/ram/rockchip/sdram_px30.c @@ -711,7 +711,7 @@ int sdram_init(void) if (ret) goto error; - sdram_print_ddr_info(&sdram_params->ch.cap_info, &sdram_params->base); + sdram_print_ddr_info(&sdram_params->ch.cap_info, &sdram_params->base, 0); printascii("out\n"); return ret; diff --git a/drivers/ram/rockchip/sdram_rk3328.c b/drivers/ram/rockchip/sdram_rk3328.c index 9c6798f816..efe0049ead 100644 --- a/drivers/ram/rockchip/sdram_rk3328.c +++ b/drivers/ram/rockchip/sdram_rk3328.c @@ -506,7 +506,7 @@ static int sdram_init_detect(struct dram_info *dram, writel(sys_reg3, &dram->grf->os_reg[3]); } - sdram_print_ddr_info(&sdram_params->ch.cap_info, &sdram_params->base); + sdram_print_ddr_info(&sdram_params->ch.cap_info, &sdram_params->base, 0); return 0; } diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index 0a88ee9f93..86f5c06583 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -2983,7 +2983,7 @@ static int sdram_init(struct dram_info *dram, continue; } - sdram_print_ddr_info(cap_info, ¶ms->base); + sdram_print_ddr_info(cap_info, ¶ms->base, 0); set_memory_map(chan, channel, params); cap_info->ddrconfig = calculate_ddrconfig(params, channel); -- 2.25.1