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 8EBA3C04A68 for ; Wed, 27 Jul 2022 18:24:32 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C96D58414F; Wed, 27 Jul 2022 20:23:47 +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="Y8LKkxSp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 02FD583FFF; Wed, 27 Jul 2022 19:41:10 +0200 (CEST) Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) (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 3EBF983FFF for ; Wed, 27 Jul 2022 19:41:07 +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-pl1-x635.google.com with SMTP id v18so3528751plo.8 for ; Wed, 27 Jul 2022 10:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=edgeble-ai.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n//NurLGLHUkzOaVx3tMbVvXoncL9mJPM8jrI64sd6k=; b=Y8LKkxSp2rv5I7If729DAl44FkM1lQdBP77PbT7mKVbG16N6Eqc+rD8t6V2pHkcre0 oKcpX2PqwuJAXK/tTmXanSvx0mW3QbCGLfAdeRCPHeg+aiRSuOqU1I6p5TymYSNyu+Zh l4ravZmavVFFBTa/G8/cS9ti92nIvV3cSeqFW1Kcfk4FE2rmZAP5XncFSj/VleoN/6BM d7DvMoHHfXmg+s8q3jEDiNKMIJDK2cuNawLa9Dpl287ak2JfifGv/UZYhj5N9KyM2sVJ OyGb2G7kcH2zzImq1dVzidkxCOnzBZZ5nLkhBka8w15107IcfTyMe8iPE8JX43+0z+xB aeAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n//NurLGLHUkzOaVx3tMbVvXoncL9mJPM8jrI64sd6k=; b=7pb8Ut6cmexqc6eFntOkGDwo5XEMvIIrDYxRnZsL2rM5aUyl0iyb+r/PhN2U2a1XmE sT5Y0TMTp5uiNVotJogpjCDCfC7Mu1rTtxAJ5hMy4PQhMFdxOgcRg+UlO/3JLjp/yNwt eKoWPFuDhVK9kzLvqnVGvUJ1oH9x5uhZ4oQRrrykA2pjr67wfGvkll36mCiCTUFTWuz+ IWIucBBjKf8EgKvZzFKBU75uNqc4EdkYkEbUCrPiNF8GrN+e54vgz8GGoqRIdC0fd2Vp tkrGd9qevFChs3nxDDL0KssZ7GV3Hu68urYLQ6PX9G1VzVPXctE7JL3vU8Ox5tGfd6n5 3YYg== X-Gm-Message-State: AJIora+7Hx9WX7gHTFSZMsthS465+V+9xxLij03canqxzTPTrfFu21UE GNvluQN0RL7e7zLPW0uaPjd3UA== X-Google-Smtp-Source: AGRyM1u3sWECxBWZ2ufHaoA76+XYswL39c+sxC9bKaCY3WmdgLzaDq46gD72wCERsWBy4tGCDpslDA== X-Received: by 2002:a17:90b:1c0a:b0:1f3:1848:591c with SMTP id oc10-20020a17090b1c0a00b001f31848591cmr1007316pjb.24.1658943665528; Wed, 27 Jul 2022 10:41:05 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:7b77:efa3:a08f:c6d8]) by smtp.gmail.com with ESMTPSA id d4-20020a621d04000000b00528c8ed356dsm14492958pfd.96.2022.07.27.10.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jul 2022 10:41:05 -0700 (PDT) From: Jagan Teki To: Kever Yang , Philipp Tomsich , Simon Glass Cc: u-boot@lists.denx.de, Jagan Teki , YouMin Chen Subject: [PATCH 04/28] ram: rockchip: Compute ddr capacity based on grf split Date: Wed, 27 Jul 2022 23:10:26 +0530 Message-Id: <20220727174050.2214617-5-jagan@edgeble.ai> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220727174050.2214617-1-jagan@edgeble.ai> References: <20220727174050.2214617-1-jagan@edgeble.ai> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Wed, 27 Jul 2022 20:23:40 +0200 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 --- 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