From patchwork Mon Jun 17 07:32:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 662 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 0B6C63F353 for ; Mon, 17 Jun 2019 09:41:25 +0200 (CEST) Received: by mail-pf1-f197.google.com with SMTP id i2sf6579673pfe.1 for ; Mon, 17 Jun 2019 00:41:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1560757283; cv=pass; d=google.com; s=arc-20160816; b=amNG7fXC65ChYJZ9/mnSxFey7Og+rTUgPuCKRHynIYOWUPwtHWWvZBPFh3I5+fVWYu 5F+UEaD3RnU2aea8uYNx8O8yrdOpgn5uU9IIdxBaFiIyDVvY2zQFwcLhS3i0Lu5eEfp4 CQAy6xRy3XtlpGb8BfrfQJN6mu2ISgRgTonWkzxxSjZ0K3lNhed8vSM/WYhAI2EGFLIn oLflBdMgzDHAabrI+nBrnecszdGI5gOIEMlYBKLqC3jKFxLKtrqhR5W41oav9ll0bj1m Ha2zKaey7y2kdIIcQ67MV84WJEZ6hqaTTe4z8DCYsFvK2oQFuKMXwZEvAljJNWRqhB9d OSsA== 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=yERu9I5YmKUuAHGhfv46mIxL521P2jyXxQ4EJcuRnEM=; b=kfiAljFy2fbiacsE3SmKl0X0LW4CfFQf0IK72ILYTL00WsL4D4bdkezgQfFxmXnFdl Jy6Bhb9bhkJfHoX4TOdcI2t2gen8tN2/8WlHPIy6VRqPo0GBkJLN0cka47E1mcPemQFR K7XicvqujvPig3oPkyGpPE7RlrmkzVxM1Um89eXYdi9qVJuzfTkAl1y190YswsgmLIQk tK74LThr5cwE23vHAwxZDKykbExOR8+GL7qZp11bX5KsS4+WZbK5vuyHIVysh79ixcVP tXBmhIH0Wuh1uv3SS1uAMWuXMOWak3WV0mxxO8iNfzapw11b9hCo0DdIFX9Y6Rpy9mVl nxQw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=CSFXUt+a; 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=yERu9I5YmKUuAHGhfv46mIxL521P2jyXxQ4EJcuRnEM=; b=hC/wpDiJ8HP/YkZOGZhhV6fVrYnBLXJv5xHqWe7FpD8TGeBgnRloykN/OzOlfzCEkN kbVPSIl1oRizaL6uEEJf4+O/7GygPHGwNUIHu7TkXLaiG/vj3scsdnj9oXfRGPsrH0LR 69Ey/kh1Z0yweobzGQR3eq9021mcNPjD3PM5w= 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=yERu9I5YmKUuAHGhfv46mIxL521P2jyXxQ4EJcuRnEM=; b=D/dG92f49fyAg4Oi6+zSrRN9/cwa0v347yrsvsk2BeazERVIe6vk0S4SW0CH6+CSNK uhei6gBwT2HAa9fdqpcuS2KakDQ3f7qJcOdhl5EYvJLfd1PBWFwqpV75k+pclQjvjhYJ Rl4a0lrfhAer4e16Tqb0AMtw5RGvaJwlUqsRfhprfLThOymUc1WKjq4D/4t78dFNI7TT 75uxVFPsJ9xToVHFfid+O4XIBw9eJ4KFXTJV3lV2aCPFn5N9Q6tbhB3le6T46PDipJQs nWR4xHYhMw39Uv2fHxMiO740fDpZWn/rN5fWuaFm+bxdA1e5af5OJKn2v+3r5QLDIMwX jyzQ== X-Gm-Message-State: APjAAAUzeoie0pDxxrhPNDifY9IxMbyrdExBb6o23KsFcok+ZKAGBKd3 MJFdWK78MtzRRip1Jkdlib410dal X-Google-Smtp-Source: APXvYqwbC15E6RDmh+Wt/OQU06tj0xp1VhO3iU2glZFupnI20VAak8o8qSMBMCnyIDEefdPlR4AIOA== X-Received: by 2002:a63:292:: with SMTP id 140mr16333875pgc.88.1560757283808; Mon, 17 Jun 2019 00:41:23 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:9694:: with SMTP id n20ls3750337plp.6.gmail; Mon, 17 Jun 2019 00:41:23 -0700 (PDT) X-Received: by 2002:a17:90a:5288:: with SMTP id w8mr25010016pjh.61.1560757283473; Mon, 17 Jun 2019 00:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560757283; cv=none; d=google.com; s=arc-20160816; b=fELbCuvNjHXk3B01JcLk1+7AdTk63OkwFYjc2pDoVU2JnKTFdRRQrDHxQzNcLxhkad 5oNBLUc/FR0QEXBUcb0osvAMZnrFlL/RqLO8yiMtBg0DfGbaU5OwqTstJpdqXQ7SNO2C b+3RlNb9YFUD+WGXFzek35cFPMEJays3q7ppu7NHxfvegj6ZcM7P7jd5YgOdxYbxMF3c CASXkCBx/FG8I1PCg9c04mgGm2+gSKdPRgJTcJ1ErOJEa3nYVUwJ8pP+WYT6rjZrRsk0 iqQ82ScTSnGLcNtmsWPw5LmsCghk4DD0zbC8Cy82fWOhRS8ClDG2dQGpeZjuB0FkJo1r H9CQ== 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=u/TB85VEaFs2QbI7DRyda0G4olL7uWDeg8+9hDnais4=; b=ycLEcKHkssnqOHeUZsWK8F83oTahj2CE51gJuj7+CHBohMzJezya4D/d4jcrFzH6rX eChf8prYScRO8+ovuEBrTTLtscnc+fJDwnXifstaVQ1TZTyUIFNIm0VTm9uCNS1Hy56k u6DwYSvvjXkEn5CD/p8wdgknM9FJcQklVh0yFidkETDq1mIsrbjrGjd6h/+LIdlohz3q CXCnG62elVO0+mftHmbH5djLVssF58SQvEXQsxwEUrfBHG9f4MRE/3lgJiIRXRv344rK gfe6Zd1zUmiKULVg8gPG3zeQCBdLyTfVP8ueCgpGX2pJ9xk9kiv30CydYkuEkYAeUuJR VUBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=CSFXUt+a; 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 h3sor12724439pld.23.2019.06.17.00.41.23 for (Google Transport Security); Mon, 17 Jun 2019 00:41:23 -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:a17:902:b115:: with SMTP id q21mr45770174plr.36.1560757283200; Mon, 17 Jun 2019 00:41:23 -0700 (PDT) Received: from localhost.localdomain ([49.206.203.245]) by smtp.gmail.com with ESMTPSA id m41sm15205998pje.18.2019.06.17.00.41.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 00:41:22 -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 v2 91/99] ram: rk3399: Set lpddr4 ca odt Date: Mon, 17 Jun 2019 13:02:44 +0530 Message-Id: <20190617073252.27810-92-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190617073252.27810-1-jagan@amarulasolutions.com> References: <20190617073252.27810-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=CSFXUt+a; 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: , Set CA ODT based identified controller in lpddr4 as part of LPDDR set rate initialization phase. Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen --- drivers/ram/rockchip/sdram_rk3399.c | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index ddda6f8ebd..c5521e730d 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -1845,6 +1845,54 @@ static void set_lpddr4_dq_odt(const struct chan_info *chan, } } +static void set_lpddr4_ca_odt(const struct chan_info *chan, + struct rk3399_sdram_params *params, u32 ctl, + bool en, bool ctl_phy_reg, u32 mr5) +{ + u32 *denali_ctl = get_denali_ctl(chan, params, ctl_phy_reg); + u32 *denali_pi = get_denali_pi(chan, params, ctl_phy_reg); + struct io_setting *io; + u32 reg_value; + + if (!en) + return; + + io = lpddr4_get_io_settings(params, mr5); + + reg_value = io->ca_odt; + + switch (ctl) { + case 0: + clrsetbits_le32(&denali_ctl[139], 0x7 << 28, reg_value << 28); + clrsetbits_le32(&denali_ctl[153], 0x7 << 28, reg_value << 28); + + clrsetbits_le32(&denali_pi[132], 0x7 << 4, reg_value << 4); + clrsetbits_le32(&denali_pi[139], 0x7 << 20, reg_value << 20); + clrsetbits_le32(&denali_pi[147], 0x7 << 4, reg_value << 4); + clrsetbits_le32(&denali_pi[154], 0x7 << 20, reg_value << 20); + break; + case 1: + clrsetbits_le32(&denali_ctl[140], 0x7 << 4, reg_value << 4); + clrsetbits_le32(&denali_ctl[154], 0x7 << 4, reg_value << 4); + + clrsetbits_le32(&denali_pi[129], 0x7 << 20, reg_value << 20); + clrsetbits_le32(&denali_pi[137], 0x7 << 4, reg_value << 4); + clrsetbits_le32(&denali_pi[144], 0x7 << 20, reg_value << 20); + clrsetbits_le32(&denali_pi[152], 0x7 << 4, reg_value << 4); + break; + case 2: + default: + clrsetbits_le32(&denali_ctl[140], 0x7 << 12, (reg_value << 12)); + clrsetbits_le32(&denali_ctl[154], 0x7 << 12, (reg_value << 12)); + + clrsetbits_le32(&denali_pi[127], 0x7 << 4, reg_value << 4); + clrsetbits_le32(&denali_pi[134], 0x7 << 20, reg_value << 20); + clrsetbits_le32(&denali_pi[142], 0x7 << 4, reg_value << 4); + clrsetbits_le32(&denali_pi[149], 0x7 << 20, reg_value << 20); + break; + } +} + static void lpddr4_copy_phy(struct dram_info *dram, struct rk3399_sdram_params *params, u32 phy, struct rk3399_sdram_params *timings, @@ -2092,6 +2140,7 @@ static void lpddr4_copy_phy(struct dram_info *dram, ctl = lpddr4_get_ctl(timings, phy); set_lpddr4_dq_odt(&dram->chan[channel], timings, ctl, true, true, mr5); + set_lpddr4_ca_odt(&dram->chan[channel], timings, ctl, true, true, mr5); /* * if phy_sw_master_mode_x not bypass mode,