From patchwork Tue Jun 11 14:51:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1113954 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="otUXCN6C"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45NYcj64ssz9s5c for ; Wed, 12 Jun 2019 01:21:25 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 5633CC2215B; Tue, 11 Jun 2019 15:11:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 8A810C22157; Tue, 11 Jun 2019 15:07:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B3CF9C2216C; Tue, 11 Jun 2019 14:56:57 +0000 (UTC) Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by lists.denx.de (Postfix) with ESMTPS id 2F988C21E02 for ; Tue, 11 Jun 2019 14:56:53 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id go2so5219181plb.9 for ; Tue, 11 Jun 2019 07:56:53 -0700 (PDT) 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:content-transfer-encoding; bh=EVzetAd1OkF45Ou1v8dASP8ipKtVAWLCo38xLJGywqU=; b=otUXCN6CTvScnJmh/5u8TExnE43aWbUu7FdLSLjfYppiL5jD5JW69qss05nlwaMwhn GZtWOPTLMI66NED4hgQwjTtDqXeY+cC1czC2vKkaHQ5ZvAJtTykxzob/yRcpi7GmOeFw OheDpWATvh7scl2ZfC+rOieDWye7DqPq5SXDQ= 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:content-transfer-encoding; bh=EVzetAd1OkF45Ou1v8dASP8ipKtVAWLCo38xLJGywqU=; b=Io9EjeVrHzPlNV38GLFEAFUL8pGqOIBtbdZPFVyrylRjk+f8XN5Qyz0SMOdgaWhb+j OA3QAhLRxly8AE1hvbuI9m7ZO2SqH+3GE10MoW6mb1hDWN6ByPJGi7DbvYX1X+PsNYwI M444e6rqemzzuhkbElD1QaFU7SryBMs9G5aFqFAOTowzw0Z+i0MT6QS6EEVe/1jGOPjx UA4ymQGRfReaMtecIBhpJTlRgyBnJohjqVpEAzH5r0KjF0FDvDd2fRercGa5px++yU3Q neIRPk0lhNuntL96gDPWxIvTpTg3knA2serkrcfkmMoCnGglmj69b8APtqAdHeB3TGbl RDOw== X-Gm-Message-State: APjAAAWO27J7y6W5Dcb51oqgnLZMfm7kvaQnPcqCT8pyUkumJSrBP+p4 kYqkPiVYKt3uDNurJFfdqh8Hwg== X-Google-Smtp-Source: APXvYqwsqfnhN2oVeWx547srYR+bas8YNRYCsze9HmngNQsRNCZHe5wTqkmG4i/eTulgNw+Bo5MlPg== X-Received: by 2002:a17:902:988a:: with SMTP id s10mr76940856plp.304.1560265011799; Tue, 11 Jun 2019 07:56:51 -0700 (PDT) Received: from localhost.localdomain ([115.97.180.18]) by smtp.gmail.com with ESMTPSA id e9sm16206208pfn.154.2019.06.11.07.56.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 07:56:51 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Date: Tue, 11 Jun 2019 20:21:19 +0530 Message-Id: <20190611145135.21399-77-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190611145135.21399-1-jagan@amarulasolutions.com> References: <20190611145135.21399-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Cc: linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, gajjar04akash@gmail.com Subject: [U-Boot] [PATCH 76/92] ram: rk3399: Update lpddr4 mode_sel based on io settings X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" 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 --- 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 413469f4cc..618327983a 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -349,7 +349,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 (sdram_params->base.dramtype == LPDDR4) { struct io_setting *io = lpddr4_get_io_settings(sdram_params, mr5); @@ -358,15 +358,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 (sdram_params->base.dramtype == LPDDR3) { if (sdram_params->base.odt == 1) { vref_mode_dq = 0x5; /* LPDDR3 ODT */