From patchwork Tue Jul 16 11:57:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 788 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3D1C43F08F for ; Tue, 16 Jul 2019 14:00:17 +0200 (CEST) Received: by mail-pf1-f197.google.com with SMTP id z1sf12218900pfb.7 for ; Tue, 16 Jul 2019 05:00:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1563278416; cv=pass; d=google.com; s=arc-20160816; b=I9LhCiplUzP11CPf6BL/vkgdXQPUfnU+l/t52//00SVkkarOcrziOjdbNeOwz3JHIH SRPN/zpdxIZTNzwDouY3YdK8/GF9yQSo7Mj5nJdg3DUdpzJTt99Ee1ANzv5Bj1nz1TIv +F5GKvTSVH3KNGU6J01hMA+OMtqBujYNfbLK8Qv6MaZaFUIEm1H9xOoM3BNQO7uMmgRH ta2GfQ6MwvO+BAKt3Gq+qDAcDVKh8JqYRTuULT50y7C5X0KRjvtfep/SjWPRxddIBwU3 THmrR16rSf8txAbZ4inhHIEXDvtfoYYymaV2AQoUfj+RnN+6Kv0AqW/PVvDb3F2Pfuvf 0obg== 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=m0r7sUwRVeH9pW+xTLW6InhOJuuQe8JNt2pT1N8rJAI=; b=IhdvSUAemrKPmUuo9i9Oq5pAugeFsES2vNgxYseJUEiaocjD/Ywg5bPDVbxB0m0iXv aizjQFBohD5xGQeNnvy5DvVvYYhSzEdxe24Ii61fo3Crs9QL9g7WWY9oQgKNP26iY3qT 13wlGkqPBeBlJerYVe01CVIsxv7eFOBkBT8WwEJGN4XtYy2Jh9l3jqeFm5RRRcwDd8po fDh6Qt3PB5XzlgD4wNufM5kDGd3Fb1elgPSAhJAvRKnoBjB2l7b9LGuVZ/knr894IvcD p1g9NU/idzTXP9i+B04MX/0Q2NmnlN/zcF5IQoQ7EZc+kImmmBBpz4PSgCe3CB58UXg0 znLQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="iW/MVogV"; 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=m0r7sUwRVeH9pW+xTLW6InhOJuuQe8JNt2pT1N8rJAI=; b=NNa6wsz4hrpYc973G1TR+mO0CjJ/lNnEU7px98CjOqjpp/d1vY+81tRTUCUKuUa7w9 HYFJZAoaGPP1swXZQ+ZNQeQ0kZYgCkp0Xz1DwdwTVAT5K1Z7x/4yaZvdryj8CMm15IhA /IQWe0SYYwga17ztXeXQmD/luYEo1SLc1rFe0= 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=m0r7sUwRVeH9pW+xTLW6InhOJuuQe8JNt2pT1N8rJAI=; b=Wb06uEsgYuQaqlXlLhSbZRkSCJ43g5VDA3yvQ7Pt2h6ziCP+n1Z71I26zktfbN6fXC o90pM2tvwlwLv0AsGY9rLpElkIL2Od9RAlRGBhBJnhz+j3vkjUM/hUxZL6CG7LiZHa9r DFACeL/h2JwkzdlZmKSUBCUvQsh6VX2zsC1aQpr7ek3hKNT7lUVpNq9uZHd7p6WniBgw MnLSUzJ69oUDKRisvjY1aIQ+huUIL8sV9/gzHSMSvKio6kBwG0F/8gF9x1w0j5XUvUca 6UI3OlTh4y+SFsjrX3x+HyoPr2g+BF3Sa+rmDBNsZnqtMhWolawmukKNRjn2bdUh1OXA JwHw== X-Gm-Message-State: APjAAAXjlC0jaHS8UohtDHIiSJzrX35Lpywt+/ItLqLea+hvr5ywcv76 MGL8zOMYG/5j2SGLLSyTxYjc9Jxq X-Google-Smtp-Source: APXvYqxqf/EgQASScujS4gUOAZWrXkK9cs1yWYMpC1q9oARov5I3S21hta2unzCg8Il/ZJdoLv14lg== X-Received: by 2002:a17:902:106:: with SMTP id 6mr35557688plb.64.1563278416089; Tue, 16 Jul 2019 05:00:16 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:7a43:: with SMTP id j3ls1755948pgn.0.gmail; Tue, 16 Jul 2019 05:00:15 -0700 (PDT) X-Received: by 2002:a63:fc52:: with SMTP id r18mr32909662pgk.378.1563278415616; Tue, 16 Jul 2019 05:00:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563278415; cv=none; d=google.com; s=arc-20160816; b=ITa4qA4hBvaSbc1Cm0TVRHnEbefAKRLTe0PE9NQm4bQnZeLzgY7+/836mBgU3S+O// cWy/WqPjkARGQkB1bbez1ebs0CA1i7PmOorpZpvJadenmc9+3oAkePhlKdNoYzBQt56I iMq0vhWfUcmPD57Tlp2dNHnAUHah39ODaC1z6sk7HWvr5Lew4gXtvFj4fVMGQV/Rfg4g m/dDBsghw6RpYdjgSU18Ddy2t8qEhGeUKsoRuD33zUVyvyFascFvWpnIOuCa1tpNCJ0P EN+9pbwJnNafoKp/RHUWIOq39xXOVAPSZd7/NaVVhL0aZieftYuaO7dA/DAaytrr5ye/ TY3Q== 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=tI7Xr7ZfX4sDLFzoWb7sq8otoJ97peIqf/+DbSw/Gug=; b=Q145bVe9xDaRgWxJljMoilKeXRDRJq4maOphCD85ktw9+oVc20dwgjxf7Hsl/b7Hil qnGMM+5AjgAkyqyJq2V/Wq6OFxRPr/ugg3f8jFaoDXXUxFaZkWXKfjTspCr+HnTKSPZE pq8W+tVJFRNj+ORMlXTM1qxFk0gFzHh2YFN0QlhnceG0vWfZzaCbzQlap8CGZVtUUYw8 C7+sRETmY3HYZB++o3v7J1wMuMLfUQBBZWYe+k913iNStaJdZcgDLfA4qmJEGkfdmlFE SZTwfA9/Q4zZBv/tex7R1tQW6RrloegLWNkl356Mgzuon6V3l9JU8/LBAUAwwH/jODSm vpqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="iW/MVogV"; 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 e7sor10571567pgs.66.2019.07.16.05.00.15 for (Google Transport Security); Tue, 16 Jul 2019 05:00:15 -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:550e:: with SMTP id j14mr29995154pgb.302.1563278415278; Tue, 16 Jul 2019 05:00:15 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id z24sm36269566pfr.51.2019.07.16.05.00.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jul 2019 05:00:14 -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 39/57] ram: rk3399: Update lpddr4 mode_sel based on io settings Date: Tue, 16 Jul 2019 17:27:27 +0530 Message-Id: <20190716115745.12585-40-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190716115745.12585-1-jagan@amarulasolutions.com> References: <20190716115745.12585-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="iW/MVogV"; 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: , The mode_sel on lpddr4 value is depending on IO settings of rd_vref. Add support for it. Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen Reviewed-by: Kever Yang --- drivers/ram/rockchip/sdram_rk3399.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index 4a2622a440..63763062f9 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -347,7 +347,7 @@ static int phy_io_config(const struct chan_info *chan, u32 drv_value, odt_value; u32 speed; - /* vref setting */ + /* vref setting & mode setting */ if (params->base.dramtype == LPDDR4) { struct io_setting *io = lpddr4_get_io_settings(params, mr5); u32 rd_vref = io->rd_vref * 1000; @@ -355,15 +355,18 @@ static int phy_io_config(const struct chan_info *chan, if (rd_vref < 36700) { /* MODE_LV[2:0] = LPDDR4 (Range 2)*/ vref_mode_dq = 0x7; + /* MODE[2:0]= LPDDR4 Range 2(0.4*VDDQ) */ + mode_sel = 0x5; vref_value_dq = (rd_vref - 3300) / 521; } else { /* MODE_LV[2:0] = LPDDR4 (Range 1)*/ vref_mode_dq = 0x6; + /* MODE[2:0]= LPDDR4 Range 1(0.33*VDDQ) */ + mode_sel = 0x4; vref_value_dq = (rd_vref - 15300) / 521; } vref_mode_ac = 0x6; vref_value_ac = 0x1f; - mode_sel = 0x6; } else if (params->base.dramtype == LPDDR3) { if (params->base.odt == 1) { vref_mode_dq = 0x5; /* LPDDR3 ODT */