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 24438C4332F for ; Thu, 3 Nov 2022 06:37:01 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 58C7E850D1; Thu, 3 Nov 2022 07:36:42 +0100 (CET) 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="dmy6Brbj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A0ECD850DD; Thu, 3 Nov 2022 07:36:40 +0100 (CET) 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 8F51E84FC0 for ; Thu, 3 Nov 2022 07:36:37 +0100 (CET) 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 k7so1031639pll.6 for ; Wed, 02 Nov 2022 23:36:37 -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:subject:date :message-id:reply-to; bh=Sg/BqilGDiiLovGSwa/gr8PYj3F3nG5Bk2HrDSAFutc=; b=dmy6Brbjtb1M/yxAcISnUnCVAAFH5hA77Sb/YZ6dmjN4laJrrReMD3oNQby3LiwXdy iSV1BfTxHYGJodwvHxFQdOryOLRFyly2OxMDu1paVLfz9OmRYDJ2QGHzWFnVYV8nU/XI u8j3PbQyDzsJWAgh0aIg/utUMn4Z/jku/Cyamv+ercVrliqXisqkbx+GrClApHaqK2/x Lur5yVyyFqVEa95d/2GdstLqy4AO90Ci25uHdMitZDUDZQKkBbwb95Njs1hldIB5MOXZ M6ZX9YEcw7SnEKzkeUm+Y1Ap9PHFhrAudszspnxgxSUP7OJ56N1AiZdra49Xm7MMEqXo rJ3w== 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 :subject:date:message-id:reply-to; bh=Sg/BqilGDiiLovGSwa/gr8PYj3F3nG5Bk2HrDSAFutc=; b=Y8OLUv47LYyM7degAp7AIPW6zsqGeL6rSQXrx98RXB10dztI7HBv8mbyqRDTDJHFkC wdrmExgXjmSshYrqi84j2CVTJz8FaOj4C8lJ6n0eXlB74o3lyI1fYNYsf/I6H2SpiyHd KG40aCm043/24ZvP0P5WX4zMvFqLomgmWHdAi1byPA5NYSP5bO27ct2Y60KCD6DveJBM JEuKGhGN/iTNRz/VPjnKNwRFTTBm3CwOJfnDT5lhClQKiPf/eCijtupOCqsGUPnY3YEi oU0Chbf9sP/aagiaXueo4WhUAOpFPfjDEuUF9Ckx4ExI1gnQKt95nyqWjWJUUoRWSPus FD8Q== X-Gm-Message-State: ACrzQf3zKhuZjmTRXmaRvVHm0+uM3s5CjiszuE8w+Nk7dVDEhbZpbsFy TkXnaGp8QHB6+c+P/a3KxQzy3Q== X-Google-Smtp-Source: AMsMyM5lPbCoyt4nnZQVei5xXFxItsH08GNkIPx63paXkNFa67dbteiVWju8NpQhQzr/ssvn//ncWA== X-Received: by 2002:a17:90b:1a84:b0:213:e8b5:2d16 with SMTP id ng4-20020a17090b1a8400b00213e8b52d16mr19469297pjb.9.1667457390809; Wed, 02 Nov 2022 23:36:30 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a809:3a79:b5a5:9718:3f91]) by smtp.gmail.com with ESMTPSA id q2-20020aa79822000000b0056bd59eaef0sm9149156pfl.4.2022.11.02.23.36.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 23:36:30 -0700 (PDT) From: Jagan Teki To: Kever Yang , Simon Glass , Philipp Tomsich Cc: u-boot@lists.denx.de, Jagan Teki , YouMin Chen Subject: [PATCH v3 03/25] ram: rockchip: Compute ddr capacity based on grf split Date: Thu, 3 Nov 2022 12:05:25 +0530 Message-Id: <20221103063531.854326-4-jagan@edgeble.ai> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221103063531.854326-1-jagan@edgeble.ai> References: <20221103063531.854326-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 Reviewed-by: Kever Yang --- Changes for v3: - collect Kever r-b 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 ce49a91393..1cb67cf14a 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -2986,7 +2986,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