From patchwork Mon Jul 15 18:28:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 742 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 6A3233F08F for ; Mon, 15 Jul 2019 20:29:52 +0200 (CEST) Received: by mail-pg1-f197.google.com with SMTP id p29sf2751706pgm.10 for ; Mon, 15 Jul 2019 11:29:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1563215391; cv=pass; d=google.com; s=arc-20160816; b=yUkfqjeeqE6Un/WJBnYDnmiYCke/+O7UZ5H+SDtyyU7Un81ng7ujeNbC1aWtQpmpao 8dW5/eKzHT/uagYKQbnGBqIMkQEDscUp6Kq+LofhERWAbnJv2TJ2GCO3YJ79Y1M8WPtq rBITHff4sAkVQI0G+YmemO+McqHj6DILH5yT+n+GuRGVmNN5jLB7ENlYHt51xGghMZeH Hb3GpTcIVlOmN2MbEfqNaSnvEmpECcUOOpO0ADBDTKjq5AXre+xcSUOv4CZ8fw9PSbSt yZp/OJy6g6422abut4+5BqwCssEslVu/s0DoWBnIhywHwduqBVlpjpx0N8YDD93v4aHQ MxlA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=mpyBy1M4sHzD+ljCjlmfvmkVck6x13avomdxTD1rC2g=; b=PRn0SmL8ULNW92n4uIBCtJci+3Bi2AcRMRIEvsgXpEQY/8gtX0XmLL6XfBhALZjwJi K2eS9MyLachTg8xhB9x+PhaM/fm6uf6o9VpAxB7Koz/7xZ9QjSep13f5n3ej1SK75UmS hXI4csCey30O7RfsqIRMwHNxFTvU1SGCJ+P6Xz0XZnzuVgnYwGx42+mPxV/ZB09cW1XU tq1pt6gnBHv844CoS4oM+XfJvsPe0XefTNY5PcgQnotDUAL2bvFGlPkYG+5SHCvAWPnd 4eu1YHt4upZmBIhR6qRFUK0zuU1pp5rrFoBAyJIlIRVm+wFsg2kiqn6kBFEWgBY5pYGy m9TA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=k7wlHWZd; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=mpyBy1M4sHzD+ljCjlmfvmkVck6x13avomdxTD1rC2g=; b=Li7Uty53BPF3HCIs9Ztw972T01VlUcAW1H/lSLJ0TwR945UhoR3G2O1CNqqVB4gR8z isaJhINQRN2FvZN9TwnJVn1gqpnf8sx5DH5Luzua5zjh14BnA5m80CMdG9UG6n6RBzHT sVAhlCY/yyr03uO5X4adFAyQq39LuGW89SE2A= 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=mpyBy1M4sHzD+ljCjlmfvmkVck6x13avomdxTD1rC2g=; b=pu5T1G3aYtYRfi9/SUilLyljICOnu29sgatW51coGb1g3Evwad/Qsre4udNSKU8sEx hW2bmIQruycfWvw7XC2+Foc+r5Pc8tzE2qXWA1NDg7uxLDYHsP+4pRpaHOIVH3kZJTiJ CluY4M4Cc2jz01CYcfzxg+SrCkfP6k4++T1jSnbXOqWawUE0sUeCvNlypu3Ml50h+X1w FZlzXD12uO0/W3S6GJHKu5ohdQPg0BFRkEHQiYR5VwO12R1jxGa1YxGXneJnGbZuqE/X Rjqh50J8Vv2jLFeexZJPpo9uc0/AfolFo//fIt+bsT6PlYDrQToPxlBbiPkKF09VeFGO hyeQ== X-Gm-Message-State: APjAAAUvVnUFDfIeyA9rnT5mXj6rEW7dMoSmuXOrOJ7sRSxoSus7Q6nH z95zI3eJdzruhtQI2zDMQalyavXR X-Google-Smtp-Source: APXvYqzpZZFBrzPBTZszQCezG178v/dxLHnpKT9Ex8cFsJ6djkfJR40AUrPSrkNIDy5H/Lzn7N6Llw== X-Received: by 2002:a63:4006:: with SMTP id n6mr26831576pga.403.1563215391203; Mon, 15 Jul 2019 11:29:51 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a65:580d:: with SMTP id g13ls1901067pgr.5.gmail; Mon, 15 Jul 2019 11:29:51 -0700 (PDT) X-Received: by 2002:a63:7245:: with SMTP id c5mr13955950pgn.11.1563215390840; Mon, 15 Jul 2019 11:29:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563215390; cv=none; d=google.com; s=arc-20160816; b=U5WPzoPB1PpZCObB31blPZXBm3Iz3Rj5QAshSBCPlrnKpG/nlnHJO7n+b2GP+CKDHV 6WLDC4lLwnYQooOdMsOkiVCEhaHPMC7sL3aGcFDl7BWcbkX2gH80TxxZ9HDE9j5nArew tF0DvqIKByI8pTY4nCa4R26UEhEiwRqQfShxeZaNXpLrLlR1Hl0YAN30jqdGhsFBmysB nOdfuSBrehPD7/ncFCZTTZNc7IsYhtBOtJyudaL8N5dUUH05Fc6cU1/p4yy91Q8mViFA E8OcEvFwJlOQSk6qQzRQitCqNu/79pqE9mKkUJEipahZf/V8iPyH3p1JH4bhvPtApyl8 nlpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=kw/++CuXx6mQuiTZ6aAWPkhA635XZSGQPzWMsqf+2Gk=; b=XXlUE40tk22lMOHvF82SnLp48ynbVxJKhySLSNJwZMXme0q1cNwDpXxi5FhnxWRfjV wwl36MoNkcw1XIyT/Lf5IqUQCrluuOxqQ33bhMc/AxEWWBQwI6GBQpb0ztW1NbDWjpkV kkptc0/6bgyTb2BM95CqvncMr2D75CyGpX/gYWFpg/3HdDKuilnkcZS4V9olRa7WGcGJ 4h2SssMLwqoSXOEWliw88mKq4mohxmJ23YCHC9Qg62jFfMs26Y0GEcQcNkCiu+mYKsy0 41iGT5uPEY7VtLuUm9NjNfEzzy81lh6ebJgES6CW1WRYLJbdfykIsW3b6yiIpxPGDNHh mnBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=k7wlHWZd; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id c16sor9542676pfr.5.2019.07.15.11.29.50 for (Google Transport Security); Mon, 15 Jul 2019 11:29:50 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a63:1a03:: with SMTP id a3mr26939638pga.397.1563215390465; Mon, 15 Jul 2019 11:29:50 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.29.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:29:50 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Cc: Manivannan Sadhasivam , gajjar04akash@gmail.com, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v3 12/18] ram: rockchip: debug: Get the cs capacity Date: Mon, 15 Jul 2019 23:58:50 +0530 Message-Id: <20190715182856.21688-13-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190715182856.21688-1-jagan@amarulasolutions.com> References: <20190715182856.21688-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=k7wlHWZd; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add code to get the channel capacity, this would help to print the capacity of specific channel. 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 Size=2048MB Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen Reviewed-by: Kever Yang --- drivers/ram/rockchip/sdram_debug.c | 46 +++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/drivers/ram/rockchip/sdram_debug.c b/drivers/ram/rockchip/sdram_debug.c index 69a6f94a73..19e9225c12 100644 --- a/drivers/ram/rockchip/sdram_debug.c +++ b/drivers/ram/rockchip/sdram_debug.c @@ -33,10 +33,46 @@ void sdram_print_dram_type(unsigned char dramtype) } } +/** + * cs = 0, cs0 + * cs = 1, cs1 + * cs => 2, cs0+cs1 + * note: it didn't consider about row_3_4 + */ +u64 sdram_get_cs_cap(struct sdram_cap_info *cap_info, u32 cs, u32 dram_type) +{ + u32 bg; + u64 cap[2]; + + if (dram_type == DDR4) + /* DDR4 8bit dram BG = 2(4bank groups), + * 16bit dram BG = 1 (2 bank groups) + */ + bg = (cap_info->dbw == 0) ? 2 : 1; + else + bg = 0; + + cap[0] = 1llu << (cap_info->bw + cap_info->col + + bg + cap_info->bk + cap_info->cs0_row); + + if (cap_info->rank == 2) + cap[1] = 1llu << (cap_info->bw + cap_info->col + + bg + cap_info->bk + cap_info->cs1_row); + else + cap[1] = 0; + + if (cs == 0) + return cap[0]; + else if (cs == 1) + return cap[1]; + else + return (cap[0] + cap[1]); +} + void sdram_print_ddr_info(struct sdram_cap_info *cap_info, struct sdram_base_params *base) { - u32 bg; + u32 bg, cap; bg = (cap_info->dbw == 0) ? 2 : 1; @@ -71,4 +107,12 @@ void sdram_print_ddr_info(struct sdram_cap_info *cap_info, printascii(" Die BW="); printdec(8 << cap_info->dbw); + + cap = sdram_get_cs_cap(cap_info, 3, base->dramtype); + if (cap_info->row_3_4) + cap = cap * 3 / 4; + + printascii(" Size="); + printdec(cap >> 20); + printascii("MB\n"); }