From patchwork Mon Jul 15 18:28:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11044689 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EDE11112C for ; Mon, 15 Jul 2019 18:29:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0367284CE for ; Mon, 15 Jul 2019 18:29:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3D87284E8; Mon, 15 Jul 2019 18:29:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6E2C8284CE for ; Mon, 15 Jul 2019 18:29:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/MgUu0T744qYNDMRJlMvLGwY1YXWJmoP91W2ecUn6nY=; b=YdVZPwM03xqjp3 oRcyL7LTYmahVchevhX62R7tIXXrljCAXTf0uGXnybQ05tVv2RasDtCN1e7/noL1CJn4PrYjYTQpy 51ajWiGhxZb39/o7kAPgyepDvzht+Pi2KNULTGWJNPZTxLM+b5kvKAEfqLAE+RqJf6Mm7G6znZAnm OfmX7GpEJB9V0dWE0j5jvvcFiN95FYnTAzNS4R5/oxCA8OgkOo/64mZmQhkZormdT1fSRimPaMwfI k9lVOaByD+S02A8ELEZ0C5X7YxBgWQNg1zDLJvufxltq96ZD4FKTAe71h6wUAz9tDVK7zgPQMOInS ydfq2eb3EBh/Xfdew1LQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5iu-0000mL-B1; Mon, 15 Jul 2019 18:29:16 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5ir-0000k6-50 for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:29:14 +0000 Received: by mail-pl1-x644.google.com with SMTP id az7so8714949plb.5 for ; Mon, 15 Jul 2019 11:29:13 -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=wYr3H4NqDFc/O2LGsyHmfdZ6Y7oIQaZKfQb5LA2PnRg=; b=Lk3c/LzCKc4U2NcRRSH/eCMs0cFQKEMCiEqh35Xr/Y69FxHFfpkw7WUQ4No+WaAOVP dN793jB2U85HAcAj7ObgyIvNm6T4RawEJRZ9pkXYIGmKOnbCpcki6CLdJgeByCrEA7GD dqBdHUjbOf+kKYeFGPPrXAidIaat8qfW1kDZE= 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=wYr3H4NqDFc/O2LGsyHmfdZ6Y7oIQaZKfQb5LA2PnRg=; b=CMThq5viEwbCXUPMqMWBrE4U9FpY50YVJE0P/tpFXv9sw4985k4F8sU1dt8A2dFZel pU9WV92l3OO+BlgCGENbfe00ijTD/0fL/YR5SZ1d70V6HdIscTLzTwxN6KbQ0OzzJGTC tWq1PjRQWns53W0G6FbkiOQmkyCMdfrwfMJa1X6hXbtCXrveGUhZu75KksbPLbUKUj7x xtdizoPnfUiY1Ptem10UwiO7zRuNKfBSdfZUCqW18M3APNepsmATk793gRP6KPbieqsr gtcsyWcenouPrYerSMuIAhAsMjdMrkiI2Tyz+uQlBM4nmSf5ceAdJe9zAcBgdiM0ONOz vdxQ== X-Gm-Message-State: APjAAAUDB6OV+eB8Dy+vB2/CaGBK0UdkE1krL6R6V3pQgX7lIgNYz6Vf nZlfPk2nZJh0VCnesOgK2tZgzw== X-Google-Smtp-Source: APXvYqx3I/yUJQRHxlghHMPEX3Qm5lxr6ux/TMUHHh0t1nkEM/e2gBKbcVIn9Y5YBVtHNdkOLtCclA== X-Received: by 2002:a17:902:6ac6:: with SMTP id i6mr30109616plt.233.1563215352628; Mon, 15 Jul 2019 11:29:12 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.29.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:29:12 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v3 01/18] ram: rk3399: Handle data training return types Date: Mon, 15 Jul 2019 23:58:39 +0530 Message-Id: <20190715182856.21688-2-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_112913_195128_A143B926 X-CRM114-Status: GOOD ( 12.70 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP data trainings calls like ca, wl, rg, rl, wdql have proper return types with -EIO and the return type missed to handle in data_training function. This patch, add proper return type checks along with useful debug statement on each data training calls. Incidentally this would help to prevent the sdram initialization hang for single channel dram and when the code is trying to initialize second channel with proper return type of relevant data training call might failed. Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- drivers/ram/rockchip/sdram_rk3399.c | 50 ++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index 492b0975dd..e9c0fdf2d4 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -887,6 +887,7 @@ static int data_training(const struct chan_info *chan, u32 channel, u32 training_flag) { u32 *denali_phy = chan->publ->denali_phy; + int ret; /* PHY_927 PHY_PAD_DQS_DRIVE RPULL offset_22 */ setbits_le32(&denali_phy[927], (1 << 22)); @@ -907,24 +908,49 @@ static int data_training(const struct chan_info *chan, u32 channel, } /* ca training(LPDDR4,LPDDR3 support) */ - if ((training_flag & PI_CA_TRAINING) == PI_CA_TRAINING) - data_training_ca(chan, channel, params); + if ((training_flag & PI_CA_TRAINING) == PI_CA_TRAINING) { + ret = data_training_ca(chan, channel, params); + if (ret < 0) { + debug("%s: data training ca failed\n", __func__); + return ret; + } + } /* write leveling(LPDDR4,LPDDR3,DDR3 support) */ - if ((training_flag & PI_WRITE_LEVELING) == PI_WRITE_LEVELING) - data_training_wl(chan, channel, params); + if ((training_flag & PI_WRITE_LEVELING) == PI_WRITE_LEVELING) { + ret = data_training_wl(chan, channel, params); + if (ret < 0) { + debug("%s: data training wl failed\n", __func__); + return ret; + } + } /* read gate training(LPDDR4,LPDDR3,DDR3 support) */ - if ((training_flag & PI_READ_GATE_TRAINING) == PI_READ_GATE_TRAINING) - data_training_rg(chan, channel, params); + if ((training_flag & PI_READ_GATE_TRAINING) == PI_READ_GATE_TRAINING) { + ret = data_training_rg(chan, channel, params); + if (ret < 0) { + debug("%s: data training rg failed\n", __func__); + return ret; + } + } /* read leveling(LPDDR4,LPDDR3,DDR3 support) */ - if ((training_flag & PI_READ_LEVELING) == PI_READ_LEVELING) - data_training_rl(chan, channel, params); + if ((training_flag & PI_READ_LEVELING) == PI_READ_LEVELING) { + ret = data_training_rl(chan, channel, params); + if (ret < 0) { + debug("%s: data training rl failed\n", __func__); + return ret; + } + } /* wdq leveling(LPDDR4 support) */ - if ((training_flag & PI_WDQ_LEVELING) == PI_WDQ_LEVELING) - data_training_wdql(chan, channel, params); + if ((training_flag & PI_WDQ_LEVELING) == PI_WDQ_LEVELING) { + ret = data_training_wdql(chan, channel, params); + if (ret < 0) { + debug("%s: data training wdql failed\n", __func__); + return ret; + } + } /* PHY_927 PHY_PAD_DQS_DRIVE RPULL offset_22 */ clrbits_le32(&denali_phy[927], (1 << 22)); @@ -1062,7 +1088,7 @@ static int switch_to_phy_index1(struct dram_info *dram, clrsetbits_le32(&denali_phy[896], (0x3 << 8) | 1, 1 << 8); ret = data_training(&dram->chan[channel], channel, params, PI_FULL_TRAINING); - if (ret) { + if (ret < 0) { debug("index1 training failed\n"); return ret; } @@ -1108,7 +1134,7 @@ static int sdram_init(struct dram_info *dram, udelay(10); if (data_training(chan, channel, params, PI_FULL_TRAINING)) { - printf("SDRAM initialization failed, reset\n"); + printf("%s: data training failed\n", __func__); return -EIO; } From patchwork Mon Jul 15 18:28:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11044691 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EEC61112C for ; Mon, 15 Jul 2019 18:29:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF6D6284CE for ; Mon, 15 Jul 2019 18:29:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D39AA284E8; Mon, 15 Jul 2019 18:29:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7CF92284CE for ; Mon, 15 Jul 2019 18:29:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4ECdD8M8DzZ22k6P/mQGjmmbXvS1RJ00leK0kTdm/cg=; b=WvtrTOq/3oI10L 1+5jve1J8lgv5LIpDuvzREuiE6d5XiuYnxt6bXDhm3eXU4NrBER+FJVwXKGWFb8UTgZkClVVNbNqd s6+t4CGtK0T2e4qKCDTw0MYQIForHerbn4GUJC25Bhomd7H/jJvvTQAo1KxtBppZo8uSuMAL16vZR oD+50dm0IQ3ih9AN70904sFpBCz/ft9EDqekzpKIrq+fD9SGCwlLgm5D3/BktLVyJzKgjLDIFW1bd 9TlIGO5C2ZL7PTYfIOis7IqkiWIFn6ujo8lptMmGsIl1t/2Q64IyfB/knCOz2RLXOQl1dS5KMwCGt yr6/ZJLETe0DXF2v7miw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5ix-0000p8-O4; Mon, 15 Jul 2019 18:29:19 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5iu-0000mS-IR for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:29:17 +0000 Received: by mail-pl1-x644.google.com with SMTP id ay6so8716791plb.9 for ; Mon, 15 Jul 2019 11:29:16 -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=DN7dbp/suL0eklOT4cOrJU8AKImrdUW67r8rQCwhI+w=; b=Dm2snpusG/9L2Gc+QCg1EzVAt468mtvVQHB8hXtCbCJQWdjlytrdKM7iw4MXBwkfL3 3E/4Tn4uRMqHKPOzQXvSjJnhNKlcRSQ7Lyolr88K3Dj0r2eC1MXkylSwaJnwfpU27/7q 477uimbMVra6GRJMhz3Ie0yCXMC6rdmXBRRh0= 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=DN7dbp/suL0eklOT4cOrJU8AKImrdUW67r8rQCwhI+w=; b=aOOS9dmN6SN5EFOr9os0mufVmQJleDeig0vB8GWCncHBDvuXYGywNxvJ68w/UmlD4B 0uO9Yaj3TUHxPl9r5ikqyZhJ8QLh+Xfqjc6QvKjgcqwIwdNoNLa+6sg7ogiS8ihYxGJh Ty3GeWasfEclkMtiRTFj8lgav5IdaHX4BoiKdxtNMpOMG3sWESAnaCN6IQQB/aBpTlzk uLN9mRYpW7HjZqzBM3pNTsPHxtzJM/B2Ge8OdRtTxVZPwwU9bnHr/XCjte7FXcIjZbKx z9kEk8FbvbQEkia3jyGK3HyQ0UPZRAp0D9uZj6igYRCQotaPor7nno7Ckhv4ausGe+Of UUDQ== X-Gm-Message-State: APjAAAXWy23EPZekXDWA6cyNft+TAn4tu5WP2mYKUh0RzHG55rgPtydL 6QcjMwSQ69UZaN6VmZIHfRIgzg== X-Google-Smtp-Source: APXvYqyQcF9BDZXPZ4f9H2qobrmdfz3nmMBajCSgkZOhQCYnKMYEPCQ8oC2cyxvwemi+ffVCyaYKhg== X-Received: by 2002:a17:902:5998:: with SMTP id p24mr29643545pli.110.1563215356029; Mon, 15 Jul 2019 11:29:16 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.29.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:29:15 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v3 02/18] ram: rk3399: Clear PI_175 interrupts in data training Date: Mon, 15 Jul 2019 23:58:40 +0530 Message-Id: <20190715182856.21688-3-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_112916_640471_C54E40C1 X-CRM114-Status: UNSURE ( 9.45 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Clear the PI_175 interrupts before processing actual data training in all relevant calls. This would help to clear interrupt from previous training. Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen Reviewed-by: Kever Yang --- drivers/ram/rockchip/sdram_rk3399.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index e9c0fdf2d4..fe26144f27 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -627,6 +627,9 @@ static int data_training_ca(const struct chan_info *chan, u32 channel, u32 obs_0, obs_1, obs_2, obs_err = 0; u32 rank = params->ch[channel].cap_info.rank; + /* clear interrupt,PI_175 PI_INT_ACK:WR:0:17 */ + writel(0x00003f7c, (&denali_pi[175])); + for (i = 0; i < rank; i++) { select_per_cs_training_index(chan, i); @@ -681,6 +684,9 @@ static int data_training_wl(const struct chan_info *chan, u32 channel, u32 obs_0, obs_1, obs_2, obs_3, obs_err = 0; u32 rank = params->ch[channel].cap_info.rank; + /* clear interrupt,PI_175 PI_INT_ACK:WR:0:17 */ + writel(0x00003f7c, (&denali_pi[175])); + for (i = 0; i < rank; i++) { select_per_cs_training_index(chan, i); @@ -740,6 +746,9 @@ static int data_training_rg(const struct chan_info *chan, u32 channel, u32 obs_0, obs_1, obs_2, obs_3, obs_err = 0; u32 rank = params->ch[channel].cap_info.rank; + /* clear interrupt,PI_175 PI_INT_ACK:WR:0:17 */ + writel(0x00003f7c, (&denali_pi[175])); + for (i = 0; i < rank; i++) { select_per_cs_training_index(chan, i); @@ -799,6 +808,9 @@ static int data_training_rl(const struct chan_info *chan, u32 channel, u32 i, tmp; u32 rank = params->ch[channel].cap_info.rank; + /* clear interrupt,PI_175 PI_INT_ACK:WR:0:17 */ + writel(0x00003f7c, (&denali_pi[175])); + for (i = 0; i < rank; i++) { select_per_cs_training_index(chan, i); @@ -844,6 +856,9 @@ static int data_training_wdql(const struct chan_info *chan, u32 channel, u32 i, tmp; u32 rank = params->ch[channel].cap_info.rank; + /* clear interrupt,PI_175 PI_INT_ACK:WR:0:17 */ + writel(0x00003f7c, (&denali_pi[175])); + for (i = 0; i < rank; i++) { select_per_cs_training_index(chan, i); From patchwork Mon Jul 15 18:28:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11044693 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E4FD138D for ; Mon, 15 Jul 2019 18:29:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FD8F284CE for ; Mon, 15 Jul 2019 18:29:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43B04284E8; Mon, 15 Jul 2019 18:29:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EAE1E284CE for ; Mon, 15 Jul 2019 18:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AA1/KJy7M6sGH3Hmo38yfkgB8SiSEzoxG0dMrO7jeUQ=; b=tmzCRdR01jrOz8 u7Ek1T2WsgQ8YQfMP3twASH7AHxCUYCF+t16uv4KQbMMiAX8GChB2H1EK8Y0NJQDsKiDVTjDPw9kL Cj61JTDTlj9WdszqC3BMn+IleBLRMkY4hxsIvJxFzvhZSBwPeizpwz19xmkHsiTOksUpAUTtCZkVn AoThox8WAKvT74GI9sjiyNNzCSmivsFz4MJ8dhtymp++Z+E1qageslHfJqgHamfFtacmsFuHBeZxv roAgLufHtiwu1O/cxhclcl3r1wrH0dwFfo5lQrSCdF8rDQa/y5PZ1sEl8x72IHzElzjJZU0kZDmqG QZ09jT0lqpafwky6aWPg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5j1-0000rg-2q; Mon, 15 Jul 2019 18:29:23 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5iy-0000pI-TV for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:29:22 +0000 Received: by mail-pg1-x544.google.com with SMTP id m4so8126875pgk.0 for ; Mon, 15 Jul 2019 11:29:20 -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=6YcwdqbfN/fN4UE6eAEHodKdaNOFzJ1BoEfhJmEKtss=; b=U6sp09yQROlfxGcBxmLg/OVMiIy9cCKTHFDGroLkoDxMPBJvTrj4nm5IluSNV61huT rA9t/Cb4U08T246yMfRx9PcRMBOkygThuTwsQxwMLMUDae5dsAik8w6NG3Rq+bh2toQQ Z//uQ9eg1dZ3gxeTx2OM/0bW3MISFCQRD1dyU= 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=6YcwdqbfN/fN4UE6eAEHodKdaNOFzJ1BoEfhJmEKtss=; b=Qyut+7neoT8kxwH8PffXEveof0VbeO+7puiqiVfrZo1mbtTsyjgO4QC2nVdtdQG9pe 3VqijEiFgVMB2M4zKlur1/Tqn63Yabbj/wgHj3ji7kCn2pu8EoUP25XFYwM2jsVu3k7d rAJv34KTQJ7E2FqvzHpS4s/v/FMDufnlGRoxpzLnaVco2eejPMwVZQP+2JeA72r++r3a rUcPgBEB4kb83UhBkutsV7YRioYcuxbuPREP+qzXF9Z8gR8yrwuJXMIRG0XVHyBsOu2e pn2QeSgSbDQ/fj6HsWIFOLWPQuDDS/Bx6/wDNZiubdxh2aXyqF+dXn3XSvJ2+XOw/i9X RPMw== X-Gm-Message-State: APjAAAWZfP7Fb1KS2docD1KUonC7EPmLx22CqJ9xNeinvpACmOllSc0E ar7A0KklUnA8tahbjwI+BgIZmg== X-Google-Smtp-Source: APXvYqxCnl2bLJAe9azA/V8kvtW9F0VN/Kchjs2sYYRhaHinXIyZB9V9fg3QxAjqL6hLOOo6KYWtTQ== X-Received: by 2002:a63:e24c:: with SMTP id y12mr27612919pgj.81.1563215359423; Mon, 15 Jul 2019 11:29:19 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.29.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:29:19 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v3 03/18] ram: rk3399: Use rank mask in ca data training Date: Mon, 15 Jul 2019 23:58:41 +0530 Message-Id: <20190715182856.21688-4-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_112920_964637_9FACCAD5 X-CRM114-Status: GOOD ( 10.77 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add rank_mask based on the rank number, this would keep the ca data training loop based on the desired rank mask value instead of looping for all values. Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen Reviewed-by: Kever Yang --- drivers/ram/rockchip/sdram_rk3399.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index fe26144f27..b98df20fa5 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -626,11 +626,17 @@ static int data_training_ca(const struct chan_info *chan, u32 channel, u32 i, tmp; u32 obs_0, obs_1, obs_2, obs_err = 0; u32 rank = params->ch[channel].cap_info.rank; + u32 rank_mask; /* clear interrupt,PI_175 PI_INT_ACK:WR:0:17 */ writel(0x00003f7c, (&denali_pi[175])); - for (i = 0; i < rank; i++) { + rank_mask = (rank == 1) ? 0x1 : 0x3; + + for (i = 0; i < 4; i++) { + if (!(rank_mask & (1 << i))) + continue; + select_per_cs_training_index(chan, i); /* PI_100 PI_CALVL_EN:RW:8:2 */ From patchwork Mon Jul 15 18:28:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11044695 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 70A60138D for ; Mon, 15 Jul 2019 18:29:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 635D1284CE for ; Mon, 15 Jul 2019 18:29:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57167284E8; Mon, 15 Jul 2019 18:29:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 03A96284CE for ; Mon, 15 Jul 2019 18:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HcbtckUwdaSd+YMbLWol0JwfJBbg9aBXAQzYlZsaJQk=; b=t4r+lPETcOVS3z nizdvYlU7AczOpPVskKN+TYGK6nE3FCn4oqJI+KE8kumEPzALt3lJkdkyNAYYNMw8a5KmRPJJ7p1F jMh1ZhJ2QziJYuWhwsCH5UpUhfA5kJzsTr/X8f6vABmmclikBdCXKC/5rN1FDWmoE6+22DZvJk84g oP9lub0JwB32k8uG7zvDH7WvrhovkxRGfp8yBZ34gjqEh8k3f9Ctl47+nM9MieGbL3MjSKKL6M6Ly fc/gQD6IFiKJUvO3d38M7rkEC3jBxD3+OiDc+PN0YHP2/HswvAXeDOA0i2awJOICSZkE2u7tt6hT4 wZhdiMnrMc6nzRaUlLiA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5j4-0000u7-8w; Mon, 15 Jul 2019 18:29:26 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5j1-0000rr-Fg for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:29:24 +0000 Received: by mail-pg1-x543.google.com with SMTP id l21so8121019pgm.3 for ; Mon, 15 Jul 2019 11:29:23 -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=4Bs78cyfY3NVUOTscJFg+EkWdj0SkzHYhqOkdIflyNc=; b=C8OkKD3XJkG628hopmTctl20OvVdEQeVGzQHRiiwUAsOpdNZHczmFb5YflXdrlmDjd wvLEdZTF/6nthdhrb98UdMKyou9tpmwYhPEd0XLS0W1ndpykq1T7rYnPPIgdvbx0ajKe eMihoLAnMsQycntWf0mNy8EVlPgK/5k5/ETcs= 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=4Bs78cyfY3NVUOTscJFg+EkWdj0SkzHYhqOkdIflyNc=; b=BNcNquTXaasyIsts25XpOFf9qXTRFUghhYbVlA1018tI7CJIfSjqhEq6ZARUX1yEtO ELMvDULtv53lbwxne+ZoYQl3fr/Ggw9dMyuzjsEANUnH91qRvWWtMYMEZ9axzOxH41qx FlFwI6ssgt3+KTIN37/tbUrIduxMdYR66MJtKPSnnTcFHZSBzlJ0Y1Oxqk2b3rL2MNeF K0Y4bX9wgUsak6/WgC5l5SCWr7TrRbczC+0PK5S5Cvc3zmmhP3f6Gfhgl2IR+E0muWyi fLtnSopZO1swgwSbFZ5fsBt6P9dQb2SAOgMcpbRhSndSgQAWahZ+gCT8bmDoi8uSUFBX KVVg== X-Gm-Message-State: APjAAAUEuxzMTCZb8DxH6Oz88aEjCpcEud4McnMKbS7735xu2E91Folo hFfDi3slPdMDhSHJqO8wF/u9ew== X-Google-Smtp-Source: APXvYqyldXGeWmdEa2FjCCFoWj5ALWeGYaw5pBp2qf9ArVnEvETkm1LIWFn7K6+zkIoXhXYfIgGs7w== X-Received: by 2002:a17:90a:ff17:: with SMTP id ce23mr30679911pjb.47.1563215362898; Mon, 15 Jul 2019 11:29:22 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.29.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:29:22 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v3 04/18] ram: rk3399: Use rank mask in wdql data training Date: Mon, 15 Jul 2019 23:58:42 +0530 Message-Id: <20190715182856.21688-5-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_112923_690497_3486FC9E X-CRM114-Status: GOOD ( 10.84 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add rank_mask based on the rank number, this would keep the wdql data training loop based on the desired rank mask value instead of looping for all values. Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen Reviewed-by: Kever Yang --- drivers/ram/rockchip/sdram_rk3399.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index b98df20fa5..16bd9427a6 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -861,11 +861,17 @@ static int data_training_wdql(const struct chan_info *chan, u32 channel, u32 *denali_pi = chan->pi->denali_pi; u32 i, tmp; u32 rank = params->ch[channel].cap_info.rank; + u32 rank_mask; /* clear interrupt,PI_175 PI_INT_ACK:WR:0:17 */ writel(0x00003f7c, (&denali_pi[175])); - for (i = 0; i < rank; i++) { + rank_mask = (rank == 1) ? 0x1 : 0x3; + + for (i = 0; i < 4; i++) { + if (!(rank_mask & (1 << i))) + continue; + select_per_cs_training_index(chan, i); /* From patchwork Mon Jul 15 18:28:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11044697 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DAA79112C for ; Mon, 15 Jul 2019 18:29:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAA94284CE for ; Mon, 15 Jul 2019 18:29:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBF8C284E8; Mon, 15 Jul 2019 18:29:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 650B4284CE for ; Mon, 15 Jul 2019 18:29:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2V7IrZFfp+WNpBigBSxmqKLnqoQz82yMn61IBnsE9P4=; b=kQUbY8rtIRskyV NwO0FShmOJ65Qw/eU+BjYL1NXVJJAzczQm+eh+LRu7bn+K6TglN0wWdkuOg4Q1tWl4rl7oRABx0Kx nSXB+rhfkTxGL1YWjdpXFENzp9spdl40yDvYP94lHlcy/I68HPArxGBdP4ZBACVB8zuj8ZKfXyVpJ 9+WTJLJa6Z6MJEupkp5sNPh5KMi8pwF+puJ/R2WO8oqDrJgJ/bcORnuisIi96yVnnGl5afF4CfDBm 7qJMNn8TUldfQyp6xpksA7E+AHwRIrmq6kGvJ7c+tKP+ACkUFomFZhX5w9T1NsyloyzQICpPmY8ez xR2OXotcz3r6VU/97X+w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5j9-0000xC-C3; Mon, 15 Jul 2019 18:29:31 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5j7-0000ub-08 for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:29:30 +0000 Received: by mail-pl1-x641.google.com with SMTP id c2so8696545plz.13 for ; Mon, 15 Jul 2019 11:29:26 -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=uXXBkPZwOdhHsGqVX2Jarm/YH+B2FAJpIkLEG7ZU9Pk=; b=Tat/u98oIRVrXpu8ybaXNPGtci+fCUSX60eYyIgVKHFBBc0si7i0Q1ABrbFbrYuQm8 oOrQZsJFHoWjkv2SSol6u85Keuvc/ITsh4Ei6ZR7pi2r/r1br2E34Y50e7dEUk0tD6Wq S1PspMwgZLhsFa8kYOHRVOrHyqjTHea0Umri0= 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=uXXBkPZwOdhHsGqVX2Jarm/YH+B2FAJpIkLEG7ZU9Pk=; b=EoEvBW9hitOO3D63Ql2OOO2tZKJrPwFe3Cyn8KEc+NzVJZv2KYTXdCjbNddCcXCztM u4kGw7yzSlcwcSwR+DLEiZ+WU29RMJ7mBgPsYieLzW4PY7WnezSPLep0j40t5ScoxiMI KcswIS6Qp5SbNVHqLBBoEpql3oyg/ejOIzZ6b4C1t5eRj1OAYwFgyvmk0ggeVQsxBrGn JLQoo4c8rdjdDPW4EYTY/1NYuvCeaYT9ny7fkjCET/jj0rgPy4XBKnKzh+0eE1zlOKd7 mMqJGl1Bfy7ZjNSXpo4mJ7cD3THcCshyXwmitg62dnZkJEBpy43Id6smgUnG96s3CxXt hlrA== X-Gm-Message-State: APjAAAVJTTKEM8lyNoCLXvzureYam/Odx+nA4d0LgCRZmWw1HANPCTS3 pMIAUWih6d186qPbMiWZgtVHMA== X-Google-Smtp-Source: APXvYqwMxlzQKfXPhDiRG+goYd3+BLwB4CqCzb/UKqs6Vu2L8XjvFsFVyrVqPNu5xkFJhM5RYGLq4w== X-Received: by 2002:a17:902:744c:: with SMTP id e12mr29734884plt.287.1563215366319; Mon, 15 Jul 2019 11:29:26 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.29.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:29:25 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v3 05/18] ram: rk3399: Add phy pctrl reset support Date: Mon, 15 Jul 2019 23:58:43 +0530 Message-Id: <20190715182856.21688-6-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_112929_066967_6686B060 X-CRM114-Status: GOOD ( 11.17 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add support for phy pctrl reset support for both channel 0, 1. Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen Reviewed-by: Kever Yang --- drivers/ram/rockchip/sdram_rk3399.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index 16bd9427a6..a5da985e1a 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -35,6 +35,10 @@ #define PHY_DRV_ODT_40 0xe #define PHY_DRV_ODT_34_3 0xf +#define CRU_SFTRST_DDR_CTRL(ch, n) ((0x1 << (8 + 16 + (ch) * 4)) | \ + ((n) << (8 + (ch) * 4))) +#define CRU_SFTRST_DDR_PHY(ch, n) ((0x1 << (9 + 16 + (ch) * 4)) | \ + ((n) << (9 + (ch) * 4))) struct chan_info { struct rk3399_ddr_pctl_regs *pctl; struct rk3399_ddr_pi_regs *pi; @@ -79,6 +83,29 @@ static void copy_to_reg(u32 *dest, const u32 *src, u32 n) } } +static void rkclk_ddr_reset(struct rk3399_cru *cru, u32 channel, u32 ctl, + u32 phy) +{ + channel &= 0x1; + ctl &= 0x1; + phy &= 0x1; + writel(CRU_SFTRST_DDR_CTRL(channel, ctl) | + CRU_SFTRST_DDR_PHY(channel, phy), + &cru->softrst_con[4]); +} + +static void phy_pctrl_reset(struct rk3399_cru *cru, u32 channel) +{ + rkclk_ddr_reset(cru, channel, 1, 1); + udelay(10); + + rkclk_ddr_reset(cru, channel, 1, 0); + udelay(10); + + rkclk_ddr_reset(cru, channel, 0, 0); + udelay(10); +} + static void phy_dll_bypass_set(struct rk3399_ddr_publ_regs *ddr_publ_regs, u32 freq) { @@ -1129,6 +1156,7 @@ static int sdram_init(struct dram_info *dram, { unsigned char dramtype = params->base.dramtype; unsigned int ddr_freq = params->base.ddr_freq; + struct rk3399_cru *cru = dram->cru; int channel; int ret; @@ -1145,6 +1173,7 @@ static int sdram_init(struct dram_info *dram, const struct chan_info *chan = &dram->chan[channel]; struct rk3399_ddr_publ_regs *publ = chan->publ; + phy_pctrl_reset(cru, channel); phy_dll_bypass_set(publ, ddr_freq); if (channel >= params->base.num_channels) From patchwork Mon Jul 15 18:28: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: 11044699 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 05DC5138D for ; Mon, 15 Jul 2019 18:29:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAA8D284CE for ; Mon, 15 Jul 2019 18:29:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE377284E8; Mon, 15 Jul 2019 18:29:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 77E8D284CE for ; Mon, 15 Jul 2019 18:29:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tXy6XxNMGMvBZSNygHnw0PHLt3l9GTz16JVDeayCDeo=; b=Xph7hmsxFzZtOo zMWv5OsCPi6yQ8QXZ+f5LFBJHnPjec5OfG6YzWoyDJQZKsKBagU1m8kJUOVh02b8KUiY2+GPNPCOK +DbDbsdxGSq1/0StOP+xy03NVYPNqIovKN1aOkAZhHr1pMOj8SRWQLeUzSv7y2Prrm38fKr/4XcQ3 su0FTVnSAO4HaglTj/Abxu5CxXj47N13s4ggj+HbwjnXmdlW4dSXjgDgdS4V7JwHKouBmvQPvD8FJ dR5vkM1cwyM0NDuj0e6H+lKfJAex3vRv/oeVNR267+2PQYgOrSrzZ5hR2TZtytUjHwAkkRjPuOaVN AcekAT51dlyTNf69VelA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jD-0000zX-DK; Mon, 15 Jul 2019 18:29:35 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5j8-0000wm-PE for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:29:32 +0000 Received: by mail-pl1-x643.google.com with SMTP id b7so8723780pls.6 for ; Mon, 15 Jul 2019 11:29:30 -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=Rl7swlURdE/LDJNQb1LtixpuiUQXln+fnRJTxC/bfZU=; b=J1G/MjaF9osA/dykMM3zLN7Lsd09KYCmrkw1oVfOOQLiA/+ZJlDsaJps0+lf7GKiv/ 1Fe8xEwdQEFZzA3Cq03k/o6FNb5nXYPO8+5bPK/6MpbgD6hSgoIY3B/nNWCggL7Psdkc g6EY+91ifqTPrGT/XbPUNiiYSQcVoqvX1X1sY= 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=Rl7swlURdE/LDJNQb1LtixpuiUQXln+fnRJTxC/bfZU=; b=Oym14o5cBUVS/qiVF1D8rIlTjgFSklpR2pfjb6hYE1tvANDhWlvaQmL9u909LVLz16 +bPCovsE7BTPRMuPk+uU2Bd2Jks3ca15fAc3V3bO52xn/CWoMdwRC0mI8fiHyUXDEJ+s 0Ae3QsAodI7gmyLlvzx+oWfO2CP94AyJCZ/HgQveyfd6wLCwBZlnjoPlzrSvTPmC8YfF UC21jSlNkPetued6h7Esms/9HbKGiw0uq3WDLnWu9ziAtybfUOAm0/iCeABK4L5I1olK QnU0pkXBnsq0xJmyFUyzjUU1drmsD75Ily4JB9KN1N5l22nAhOXOnHitxGZQH10AYm7X hD0A== X-Gm-Message-State: APjAAAUIbQZfBUeq/MCamq3gK2zQzSW2WI2j8FRtDS7ealBfH8PXYHXm RLwGQeW8igtjlTCUQ25wjEPNxA== X-Google-Smtp-Source: APXvYqxUnOROp2lmy9/CpfkO5SbwUXkTB/QQE8yTejmG6c00cnCdaU5y1K+sAMcm13nNOCuZS8BTGQ== X-Received: by 2002:a17:902:2868:: with SMTP id e95mr27967021plb.319.1563215369738; Mon, 15 Jul 2019 11:29:29 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.29.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:29:29 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v3 06/18] ram: rk3399: Move pwrup_srefresh_exit to dram_info Date: Mon, 15 Jul 2019 23:58:44 +0530 Message-Id: <20190715182856.21688-7-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_112930_816293_487A6D8D X-CRM114-Status: GOOD ( 10.81 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add pwrup_srefresh_exit to be part of dram_info so-that the it can help to support pwrup_srefresh_exit in individual channels while starting pctl in future. No functionality change. Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- drivers/ram/rockchip/sdram_rk3399.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index a5da985e1a..6e944cafd9 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -49,6 +49,7 @@ struct chan_info { struct dram_info { #if defined(CONFIG_TPL_BUILD) || \ (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) + u32 pwrup_srefresh_exit; struct chan_info chan[2]; struct clk ddr_clk; struct rk3399_cru *cru; @@ -487,8 +488,8 @@ static int phy_io_config(const struct chan_info *chan, return 0; } -static int pctl_cfg(const struct chan_info *chan, u32 channel, - const struct rk3399_sdram_params *params) +static int pctl_cfg(struct dram_info *dram, const struct chan_info *chan, + u32 channel, const struct rk3399_sdram_params *params) { u32 *denali_ctl = chan->pctl->denali_ctl; u32 *denali_pi = chan->pi->denali_pi; @@ -496,7 +497,6 @@ static int pctl_cfg(const struct chan_info *chan, u32 channel, const u32 *params_ctl = params->pctl_regs.denali_ctl; const u32 *params_phy = params->phy_regs.denali_phy; u32 tmp, tmp1, tmp2; - u32 pwrup_srefresh_exit; int ret; const ulong timeout_ms = 200; @@ -518,7 +518,8 @@ static int pctl_cfg(const struct chan_info *chan, u32 channel, writel(params->phy_regs.denali_phy[911], &denali_phy[911]); writel(params->phy_regs.denali_phy[912], &denali_phy[912]); - pwrup_srefresh_exit = readl(&denali_ctl[68]) & PWRUP_SREFRESH_EXIT; + dram->pwrup_srefresh_exit = readl(&denali_ctl[68]) & + PWRUP_SREFRESH_EXIT; clrbits_le32(&denali_ctl[68], PWRUP_SREFRESH_EXIT); /* PHY_DLL_RST_EN */ @@ -594,7 +595,7 @@ static int pctl_cfg(const struct chan_info *chan, u32 channel, debug("DRAM (%s): phy locked after %ld ms\n", __func__, get_timer(tmp)); clrsetbits_le32(&denali_ctl[68], PWRUP_SREFRESH_EXIT, - pwrup_srefresh_exit); + dram->pwrup_srefresh_exit); return 0; } @@ -1179,7 +1180,7 @@ static int sdram_init(struct dram_info *dram, if (channel >= params->base.num_channels) continue; - ret = pctl_cfg(chan, channel, params); + ret = pctl_cfg(dram, chan, channel, params); if (ret < 0) { printf("%s: pctl config failed\n", __func__); return ret; From patchwork Mon Jul 15 18:28:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11044701 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A0C00138D for ; Mon, 15 Jul 2019 18:29:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92877284D2 for ; Mon, 15 Jul 2019 18:29:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 85E4A284F0; Mon, 15 Jul 2019 18:29:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EF902284D2 for ; Mon, 15 Jul 2019 18:29:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ltFH9Fi31DiCTjfw2Bl5WymXAz+OJeXAspQ/ILW5RRU=; b=eQn4ScyGlo+9L6 Cwf1ffNWyeemSik9PBypnCJTckZpGB9PFUGJEOJTG0zbPDTFaBtqYveTe/A/ULY/SzGpsaextxXOv MuWqLAYkaApgXPIxe6x0G7dMj9n/ufTIFzeKZqF738JhFoobf8IX1lEQsmrkdB/iS/hGSe9AFYIFZ ivP/T8JYGE3405I3OzTuODCYF+c6PM4E5Y/0FdC7g+jSqWPcSFgaNzD4ggnOW8YddsllAdiv/KLuv uMGcX+Nu7L64gCFOUYjsKJsWSU7Ry2EnHgWtsXsIr976sNfVZc9fjrgEra6lKuR4TBuYERCmZVDyG hobbSOjvzCQ82FFdccqg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jF-00011R-KB; Mon, 15 Jul 2019 18:29:37 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jB-0000yH-Pz for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:29:35 +0000 Received: by mail-pg1-x542.google.com with SMTP id i18so8110553pgl.11 for ; Mon, 15 Jul 2019 11:29:33 -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=Cdy1dxv9t+oHKqeWpvE9O/P4Jm0ldwmB6m0flnPmlmM=; b=ab8ad8HeA/rIazW2Hr8sjikzhjjOaiOPsG8U7+0nkn8iA9kMXdpMMfUnOqvL3TJAVY xVvuzffYrKGD3u7dMMAqF+hx0iES8tKkqqbNtm+5hxjPl/d3BJvLF9UYwSvCADewR+lt HB+yv4Mg9hOzyfqfevZJzyiE6Vw8v4TgMYMXY= 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=Cdy1dxv9t+oHKqeWpvE9O/P4Jm0ldwmB6m0flnPmlmM=; b=MdGmPwgJ2JnOShYgPvgz9pXutBAoXECnIsFQfTUz3FOcEVZMjsZ+i5WIvBb14UWTW5 lcy6FtAkG9GqeDU8EQ1jpls6/IYUiEFyRUXgl/3sCoi+qpiilJV/lB8nhCZ/8Msyo7Nk I5ZtSi7u0Zxh76hFEGCD10iYxdGSvVQdzN2Sv7RDD7/LAyZzfikESroBVbaPz6tzsvBH DkftPhUwJWqtaGmU+duwmuQGwGuv/5q2GOHXx/I06yhMW9S0Gn45sO3odIl0xsGtx1lL XV0MnCrwwbXMXmOltHwQk+nZO7o2+KBurqeb7Yww3Td1Vg5L6bqQPtPjY1HfZdAsosdq b+Hw== X-Gm-Message-State: APjAAAX3D5f4GXnrUwXOk5fj1Xwv4BtwGC3PM1x3YDl9QpgQy5MYUcoT HfiJRQTnFbn7nZ1goC2UcXVNkQ== X-Google-Smtp-Source: APXvYqwo5zstpG6kDfKbHc2egHCQm/+c9TRLrpD/gcFfrIuqaCgDq1DTO0M+Zp6y32qY6Qfg1C9fvg== X-Received: by 2002:a17:90a:b387:: with SMTP id e7mr31826321pjr.113.1563215373177; Mon, 15 Jul 2019 11:29:33 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.29.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:29:32 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v3 07/18] ram: rk3399: Add pctl start support Date: Mon, 15 Jul 2019 23:58:45 +0530 Message-Id: <20190715182856.21688-8-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_112934_125176_E1CE23B5 X-CRM114-Status: GOOD ( 16.67 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add support for pctl start for both channel 0, 1 control and phy registers. This would also handle pwrup_srefresh_exit init based on the channel number. Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen Reviewed-by: Kever Yang --- drivers/ram/rockchip/sdram_rk3399.c | 75 +++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 20 deletions(-) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index 6e944cafd9..084c949728 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -49,10 +49,11 @@ struct chan_info { struct dram_info { #if defined(CONFIG_TPL_BUILD) || \ (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) - u32 pwrup_srefresh_exit; + u32 pwrup_srefresh_exit[2]; struct chan_info chan[2]; struct clk ddr_clk; struct rk3399_cru *cru; + struct rk3399_grf_regs *grf; struct rk3399_pmucru *pmucru; struct rk3399_pmusgrf_regs *pmusgrf; struct rk3399_ddr_cic_regs *cic; @@ -73,6 +74,11 @@ struct rockchip_dmc_plat { struct regmap *map; }; +static void *get_ddrc0_con(struct dram_info *dram, u8 channel) +{ + return (channel == 0) ? &dram->grf->ddrc0_con0 : &dram->grf->ddrc0_con1; +} + static void copy_to_reg(u32 *dest, const u32 *src, u32 n) { int i; @@ -328,6 +334,48 @@ static void set_ds_odt(const struct chan_info *chan, clrsetbits_le32(&denali_phy[930], 0x1 << 17, reg_value); } +static void pctl_start(struct dram_info *dram, u8 channel) +{ + const struct chan_info *chan = &dram->chan[channel]; + u32 *denali_ctl = chan->pctl->denali_ctl; + u32 *denali_phy = chan->publ->denali_phy; + u32 *ddrc0_con = get_ddrc0_con(dram, channel); + u32 count = 0; + u32 byte, tmp; + + writel(0x01000000, &ddrc0_con); + + clrsetbits_le32(&denali_phy[957], 0x3 << 24, 0x2 << 24); + + while (!(readl(&denali_ctl[203]) & (1 << 3))) { + if (count > 1000) { + printf("%s: Failed to init pctl for channel %d\n", + __func__, channel); + while (1) + ; + } + + udelay(1); + count++; + } + + writel(0x01000100, &ddrc0_con); + + for (byte = 0; byte < 4; byte++) { + tmp = 0x820; + writel((tmp << 16) | tmp, &denali_phy[53 + (128 * byte)]); + writel((tmp << 16) | tmp, &denali_phy[54 + (128 * byte)]); + writel((tmp << 16) | tmp, &denali_phy[55 + (128 * byte)]); + writel((tmp << 16) | tmp, &denali_phy[56 + (128 * byte)]); + writel((tmp << 16) | tmp, &denali_phy[57 + (128 * byte)]); + + clrsetbits_le32(&denali_phy[58 + (128 * byte)], 0xffff, tmp); + } + + clrsetbits_le32(&denali_ctl[68], PWRUP_SREFRESH_EXIT, + dram->pwrup_srefresh_exit[channel]); +} + static int phy_io_config(const struct chan_info *chan, const struct rk3399_sdram_params *params) { @@ -498,7 +546,6 @@ static int pctl_cfg(struct dram_info *dram, const struct chan_info *chan, const u32 *params_phy = params->phy_regs.denali_phy; u32 tmp, tmp1, tmp2; int ret; - const ulong timeout_ms = 200; /* * work around controller bug: @@ -518,8 +565,8 @@ static int pctl_cfg(struct dram_info *dram, const struct chan_info *chan, writel(params->phy_regs.denali_phy[911], &denali_phy[911]); writel(params->phy_regs.denali_phy[912], &denali_phy[912]); - dram->pwrup_srefresh_exit = readl(&denali_ctl[68]) & - PWRUP_SREFRESH_EXIT; + dram->pwrup_srefresh_exit[channel] = readl(&denali_ctl[68]) & + PWRUP_SREFRESH_EXIT; clrbits_le32(&denali_ctl[68], PWRUP_SREFRESH_EXIT); /* PHY_DLL_RST_EN */ @@ -580,22 +627,6 @@ static int pctl_cfg(struct dram_info *dram, const struct chan_info *chan, if (ret) return ret; - /* PHY_DLL_RST_EN */ - clrsetbits_le32(&denali_phy[957], 0x3 << 24, 0x2 << 24); - - /* Waiting for PHY and DRAM init complete */ - tmp = get_timer(0); - do { - if (get_timer(tmp) > timeout_ms) { - pr_err("DRAM (%s): phy failed to lock within %ld ms\n", - __func__, timeout_ms); - return -ETIME; - } - } while (!(readl(&denali_ctl[203]) & (1 << 3))); - debug("DRAM (%s): phy locked after %ld ms\n", __func__, get_timer(tmp)); - - clrsetbits_le32(&denali_ctl[68], PWRUP_SREFRESH_EXIT, - dram->pwrup_srefresh_exit); return 0; } @@ -1186,6 +1217,9 @@ static int sdram_init(struct dram_info *dram, return ret; } + /* start to trigger initialization */ + pctl_start(dram, channel); + /* LPDDR2/LPDDR3 need to wait DAI complete, max 10us */ if (dramtype == LPDDR3) udelay(10); @@ -1262,6 +1296,7 @@ static int rk3399_dmc_init(struct udevice *dev) #endif priv->cic = syscon_get_first_range(ROCKCHIP_SYSCON_CIC); + priv->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); priv->pmugrf = syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF); priv->pmusgrf = syscon_get_first_range(ROCKCHIP_SYSCON_PMUSGRF); priv->pmucru = rockchip_get_pmucru(); From patchwork Mon Jul 15 18:28:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11044703 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2A331510 for ; Mon, 15 Jul 2019 18:29:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5904284CE for ; Mon, 15 Jul 2019 18:29:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 995D5284E8; Mon, 15 Jul 2019 18:29:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4015A284D2 for ; Mon, 15 Jul 2019 18:29:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8uJVHr7VcqT6VB3trx08NNaavzZ3dn6s8W+si1lpzy8=; b=hbX8gpPQZG68Zt goUfkEw3Lo+yLrLWg+97N7D+0BuHlKWJ07whg4HxEgwuJwTO/0es0uYgN4uGj9L9Xk06syzCNtz1O M4/S8N9HyK0MQKRW73LoshR07TStlKIcHOXodz63yciaYTNe8pAmKiu3CZJqjLPuxc1y37+z/6+yi 8YRyrgvNYz/t4cotgTyz4hhUKVdJnEBbgfgpOCab7i3bavUC9PQIWIp+fTYc/pFWmzQFVHUU/vYD6 K1FvrIBgHHQpjYjBw8v6aDI9kkbgdhfwIC3o1n4zsQRJS+NJp0JNfeMMyik/1TbEp8y+8whUQtqgD Mz7JKTOxl1MNr5/8tXcg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jK-00014y-Md; Mon, 15 Jul 2019 18:29:42 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jF-00011C-5t for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:29:39 +0000 Received: by mail-pg1-x541.google.com with SMTP id q4so8114156pgj.8 for ; Mon, 15 Jul 2019 11:29:37 -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=H4/nKsiczNmGqfi/dZQpnKSiemWR24mun0ufWG0UjA4=; b=ETd3iRA+aWh+LipfKFbW/B8EbOhQIcSn1txlPLfeUGSavjdw9hAxYT3mdtTCBptBRu l1L9Y+TT//alWBC2T8+2Y1U7D6wNeCx07CLhnLXD2aaQDLzI+o3ww8oSIutE6xS3vmKv Y4Rnd6hNKqE0taj4QrYsI9H+zhlMYhfGDFpEM= 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=H4/nKsiczNmGqfi/dZQpnKSiemWR24mun0ufWG0UjA4=; b=nalbYGWa3vz9hraM0zZ0kx7X70oxGMoObhud7RbhvxppziE+DfyDZW9X/+XMH7/6i+ JLZbTxwPAecXxCf7gD27nv7xcO7tcNHFjGgjmWhtNf3Zwxa2FlBbZbkOLukUNfYOdXJP UHRI72vCUNx384t3ZaNUE/NqPH0sHe/seKYK77zUVWICyl6WlLnqJOQCKr9JN3xQU0Qw w8dvzBGZ8WzVsSAR5WxzdrB5ZU6askxo3q7CeC+trqOSaEtVYDfoJ7KbD+OsSinga1pt 5Ls2bZwvt7GG2BrkzM4F1m79QVR2g3D73K1ffhbsw3T1Ggdkav1fD56usNkY30kGwXP8 IYbA== X-Gm-Message-State: APjAAAV6Z2SOrO5Rt7wogwRas//L6Mo2yMoeslXBO85qB45CDfKu3tGr Ml22NYSokRbqqpMflE+H+unsgw== X-Google-Smtp-Source: APXvYqx1X+xlccTe2GWoOeTgYnVdkP9gk3SN7kv/KaNFULXp0eETUrCzmTNKJnem68px3tyDZhBCQw== X-Received: by 2002:a17:90a:ac14:: with SMTP id o20mr31168937pjq.114.1563215376573; Mon, 15 Jul 2019 11:29:36 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.29.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:29:36 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v3 08/18] ram: rockchip: Add initial Kconfig Date: Mon, 15 Jul 2019 23:58:46 +0530 Message-Id: <20190715182856.21688-9-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_112937_326402_F86765A5 X-CRM114-Status: GOOD ( 13.91 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Right now sdram drivers in rockchip SoC are built based on the SoC configs which may not be an adequate solutions while adding common or debug driver. So, add meaningful Kconfig options start with rk3399. Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- drivers/ram/Kconfig | 1 + drivers/ram/rockchip/Kconfig | 17 +++++++++++++++++ drivers/ram/rockchip/Makefile | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 drivers/ram/rockchip/Kconfig diff --git a/drivers/ram/Kconfig b/drivers/ram/Kconfig index fbf7d7b20f..568d8f2c6a 100644 --- a/drivers/ram/Kconfig +++ b/drivers/ram/Kconfig @@ -54,4 +54,5 @@ config K3_AM654_DDRSS config add support for the initialization of the external SDRAM devices connected to DDR subsystem. +source "drivers/ram/rockchip/Kconfig" source "drivers/ram/stm32mp1/Kconfig" diff --git a/drivers/ram/rockchip/Kconfig b/drivers/ram/rockchip/Kconfig new file mode 100644 index 0000000000..995cb487b8 --- /dev/null +++ b/drivers/ram/rockchip/Kconfig @@ -0,0 +1,17 @@ +config RAM_ROCKCHIP + bool "Ram drivers support for Rockchip SoCs" + depends on RAM && ARCH_ROCKCHIP + default y + help + This enables support for ram drivers Rockchip SoCs. + +if RAM_ROCKCHIP + +config RAM_RK3399 + bool "Ram driver for Rockchip RK3399" + default ROCKCHIP_RK3399 + help + This enables ram drivers support for the platforms based on + Rockchip RK3399 SoC. + +endif # RAM_ROCKCHIP diff --git a/drivers/ram/rockchip/Makefile b/drivers/ram/rockchip/Makefile index 5df196066d..07d4b62a9d 100644 --- a/drivers/ram/rockchip/Makefile +++ b/drivers/ram/rockchip/Makefile @@ -9,4 +9,4 @@ obj-$(CONFIG_ROCKCHIP_RK3188) = sdram_rk3188.o obj-$(CONFIG_ROCKCHIP_RK322X) = sdram_rk322x.o obj-$(CONFIG_ROCKCHIP_RK3288) = sdram_rk3288.o obj-$(CONFIG_ROCKCHIP_RK3328) = sdram_rk3328.o -obj-$(CONFIG_ROCKCHIP_RK3399) = sdram_rk3399.o +obj-$(CONFIG_RAM_RK3399) += sdram_rk3399.o From patchwork Mon Jul 15 18:28:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11044705 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8FE481510 for ; Mon, 15 Jul 2019 18:29:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 822EB284CE for ; Mon, 15 Jul 2019 18:29:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 762C9284D2; Mon, 15 Jul 2019 18:29:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2F1F3284E9 for ; Mon, 15 Jul 2019 18:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zJavpoCR5e08++zN/pne00JhDFQVEHQP5X4uYrVIcOA=; b=OuMslqCYAWqvAh xqg7WLRYfJqmtQu7noMvfaE/o7N3TdUuabUnV0OPE3TUUaHiU2Qq+5iGKJnNHGGR6hMLk/jMH9+9m WTMUwpjiFwE6x5G/w/V2JoXEfdku9wEYrYwXX0fO72dCjqkaeW2mXcoxjRoQLuGSyPO/WY+yfAkrP TDSGBj9Tps3U+M94qbxkBfRle6KVNJ1NVNmv33gUTHjI8DsgHBLmhnnyqQnAvZDU7La/ZHYkm8aXA qUhxJYgp4LDM0cVnEQzRomqDesbaaMgIESJvAW3tvWuukG5aIBPojzwBo7gVh9ksdWgT3UliPOdY1 ROfGR7Hrzfih79GRPDAw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jN-00018M-RZ; Mon, 15 Jul 2019 18:29:45 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jI-000139-DL for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:29:42 +0000 Received: by mail-pg1-x541.google.com with SMTP id s1so1807918pgr.2 for ; Mon, 15 Jul 2019 11:29:40 -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=7B3tbjY3n0ai6z9ObJzMBT9vy+XRoJe3mWhFKoigG/c=; b=qkxC6tw9q/iE5Q/wGcgr4yNQUnfn3SNT9ms/lMZ/JVJ02uYS6SpPVqo2hJlU4Fn5hv oFtkDd28/41jyg0UypB0ty4rgr7xnFJLRA+u6t0VhzjPzn0/ERexpt0BYPiUrMYjkRV7 m7pEbtl986q2r0GCMxx3ckV/Uk33eMKXviO1w= 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=7B3tbjY3n0ai6z9ObJzMBT9vy+XRoJe3mWhFKoigG/c=; b=o5yAy77I06xxpa+gDfNQYeJ5Nn1cqW59NWkaA+mqF5jAZKigwyIrkOL+kRzJcu6g6P wSybi15n9oomH63t9K8Eam0VxMyoQeWuuD0PMak4qW7f4AFzsK3+a/Mw01LVtw/W4GE0 2AjKkpwxHZSGorm1dHOm88EHBiDoScaI3HnYDyOxHsFWkM7vciZloK1l74w7ZuD0DqKC FQsUDlYv/2diuWkJZOhxThFqsyR6ClT36ZCwB13kuLM2vinJh4KQhAt4llZydhZrTd9x XIxvlGL1L1EvEMYIVzXB6LWGEItp7OkNwT6v/02L5/OqIvE9MCwkcyabaa4adfnNqO6c JboQ== X-Gm-Message-State: APjAAAWLMLvcHWSoXah3jWudl9G35Jtdhippz/wyJ6fcnCYG75nHqJ81 X+5Iw0cQD5kLnFYXcLr8K7SfIw== X-Google-Smtp-Source: APXvYqz1ots+2vOOVy/KYB7tHZX3DH1JfKKXKm1GTY86M6Bq4k3WY69/eZemTRam3Al0V7T+3v4j5g== X-Received: by 2002:a17:90a:c58e:: with SMTP id l14mr30620239pjt.104.1563215379950; Mon, 15 Jul 2019 11:29:39 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.29.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:29:39 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v3 09/18] debug_uart: Add printdec Date: Mon, 15 Jul 2019 23:58:47 +0530 Message-Id: <20190715182856.21688-10-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_112941_186262_85F2E0D2 X-CRM114-Status: UNSURE ( 9.98 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add printdec, this would help to print an output a decimalism value. Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen Reviewed-by: Kever Yang --- include/debug_uart.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/include/debug_uart.h b/include/debug_uart.h index 34e8b2fc81..cd70ae1a04 100644 --- a/include/debug_uart.h +++ b/include/debug_uart.h @@ -104,6 +104,13 @@ void printhex4(uint value); */ void printhex8(uint value); +/** + * printdec() - Output a decimalism value + * + * @value: Value to output + */ +void printdec(uint value); + #ifdef CONFIG_DEBUG_UART_ANNOUNCE #define _DEBUG_UART_ANNOUNCE printascii(" "); #else @@ -170,6 +177,18 @@ void printhex8(uint value); { \ printhex(value, 8); \ } \ +\ + void printdec(uint value) \ + { \ + if (value > 10) { \ + printdec(value / 10); \ + value %= 10; \ + } else if (value == 10) { \ + _debug_uart_putc('1'); \ + value = 0; \ + } \ + _debug_uart_putc('0' + value); \ + } \ \ void debug_uart_init(void) \ { \ From patchwork Mon Jul 15 18:28:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11044707 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F2F8138D for ; Mon, 15 Jul 2019 18:29:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CF82284CE for ; Mon, 15 Jul 2019 18:29:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 214C2284E8; Mon, 15 Jul 2019 18:29:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AA259284CE for ; Mon, 15 Jul 2019 18:29:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=m7Bl56U5wHjOI6lJEY0P2hubuaxaMGClo/7dDooNHlw=; b=YNyt2tUAqBqGfM wskWs2gRAPIjUizsTtGyX9Mg4Z1xJlNbaTmhFxukQN9skBe7fimb7Tj/2yKfi5iG1Z/BAOon0gIH+ gtMQgbdSuJ6MFpleF6d36pTqA5lU5YjM58+EskC46F09a5Mq/daqUgLnbK7YvRGgcbBNyeLV+AHXV nAhPugEe45aEa3c65ZlVwEzoBdY35/PpJUqRjesmC9Qj1chv6PoazitYn21308+k679IhdQYNcmzP Fd8I4T06sVxKn/2SBvJYIvlDNbYspQe/lTnzVQSn1PXvAHtnmdvXUJaOa1GzIlFlgjdkOMOlxtN0v BkCroZ2XSwY2EqkV6Tpg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jQ-0001AS-SA; Mon, 15 Jul 2019 18:29:48 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jM-00016K-Ii for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:29:46 +0000 Received: by mail-pf1-x441.google.com with SMTP id m30so7813361pff.8 for ; Mon, 15 Jul 2019 11:29:44 -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=vaHztGW3hwCuSUcDRVrDyfWmbZxTrQqSnJP6VTuJxYA=; b=J2nMrr7GPAsyzK8AyAfZbPMH1gv499SWrM+aFfASRgCHmpFlAqvxqQXuhh0K6dQh6P /mNi2hiT6E7kpxxhq+c+7+t8fRkPd4papFRi+ganNlOWDPHyu2HBW+7hXxPTE+f5opOw IbcUx8KVyY1wFbLIWSag90Vk05euyKu6m4cNk= 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=vaHztGW3hwCuSUcDRVrDyfWmbZxTrQqSnJP6VTuJxYA=; b=hyAi0lkCSCapZAPzZInF22RUeYJay4Sr9YYDoTLxYpt9X+Z1gUrlrFwf2RcVecv6Mk RpQnivA9K3IGHe3eur+qtPM/r6+0vSZuknBsthNmylwjQqpDIoPFd0P1BnMbT5+/XVyf tStsnAaMXzNi7EwzdkR/+m78NfEnnLvGTPrVGhFAek2ogkfds16YCZTmasPuBLGvCUsS cCG1sTqTM9RFoXbO5EyG5OVD39am46T8HYzPMMUbMVIAJVkSSUAfpKbFIIPt3qoZOFUV GRkYSjCBli9d6Oqd6F0weV/n+G0QXeT26kd6nvs3HuZg+ed6JF3zjDEwEQLdjDlHMDnj Vr4g== X-Gm-Message-State: APjAAAV1ZD520EmU21bIBxb/DGFzmHc774tS6ZLcaQFat4A7C/f7LtjI K7zdK4Mco6CsVk8KTWaGBSei7g== X-Google-Smtp-Source: APXvYqyqOQtF9slL0TfWtKFa1A776o+9glHpp5VN/xk/tbrQY5tmfyPrwJcVg8WCaHjah2SVXtNK2A== X-Received: by 2002:a17:90a:7148:: with SMTP id g8mr31135109pjs.51.1563215383427; Mon, 15 Jul 2019 11:29:43 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.29.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:29:43 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v3 10/18] ram: rockchip: Add debug sdram driver Date: Mon, 15 Jul 2019 23:58:48 +0530 Message-Id: <20190715182856.21688-11-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_112944_756617_10AD53DE X-CRM114-Status: GOOD ( 14.58 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add sdram driver to handle debug across rockchip SoCs. This would help to improve code debugging feature for sdram drivers in rockchip family, whoever wants to debug the driver should call these core debug code on their respective platform sdram drivers. Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen Reviewed-by: Kever Yang --- .../include/asm/arch-rockchip/sdram_common.h | 9 +++++ drivers/ram/rockchip/Kconfig | 9 +++++ drivers/ram/rockchip/Makefile | 1 + drivers/ram/rockchip/sdram_debug.c | 34 +++++++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 drivers/ram/rockchip/sdram_debug.c diff --git a/arch/arm/include/asm/arch-rockchip/sdram_common.h b/arch/arm/include/asm/arch-rockchip/sdram_common.h index 7ac25af327..171b233f95 100644 --- a/arch/arm/include/asm/arch-rockchip/sdram_common.h +++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h @@ -92,4 +92,13 @@ size_t rockchip_sdram_size(phys_addr_t reg); /* Called by U-Boot board_init_r for Rockchip SoCs */ int dram_init(void); + +#if !defined(CONFIG_RAM_ROCKCHIP_DEBUG) +inline void sdram_print_dram_type(unsigned char dramtype) +{ +} +#else +void sdram_print_dram_type(unsigned char dramtype); +#endif /* CONFIG_RAM_ROCKCHIP_DEBUG */ + #endif diff --git a/drivers/ram/rockchip/Kconfig b/drivers/ram/rockchip/Kconfig index 995cb487b8..151ffb684d 100644 --- a/drivers/ram/rockchip/Kconfig +++ b/drivers/ram/rockchip/Kconfig @@ -7,6 +7,15 @@ config RAM_ROCKCHIP if RAM_ROCKCHIP +config RAM_ROCKCHIP_DEBUG + bool "Rockchip ram drivers debugging" + help + This enables debugging ram driver API's for the platforms + based on Rockchip SoCs. + + This is an option for developers to understand the ram drivers + initialization, configurations and etc. + config RAM_RK3399 bool "Ram driver for Rockchip RK3399" default ROCKCHIP_RK3399 diff --git a/drivers/ram/rockchip/Makefile b/drivers/ram/rockchip/Makefile index 07d4b62a9d..feb1f82d00 100644 --- a/drivers/ram/rockchip/Makefile +++ b/drivers/ram/rockchip/Makefile @@ -3,6 +3,7 @@ # Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH # +obj-$(CONFIG_RAM_ROCKCHIP_DEBUG) += sdram_debug.o obj-$(CONFIG_ROCKCHIP_RK3368) = dmc-rk3368.o obj-$(CONFIG_ROCKCHIP_RK3128) = sdram_rk3128.o obj-$(CONFIG_ROCKCHIP_RK3188) = sdram_rk3188.o diff --git a/drivers/ram/rockchip/sdram_debug.c b/drivers/ram/rockchip/sdram_debug.c new file mode 100644 index 0000000000..c13e140fa5 --- /dev/null +++ b/drivers/ram/rockchip/sdram_debug.c @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * (C) Copyright 2019 Rockchip Electronics Co., Ltd + * (C) Copyright 2019 Amarula Solutions. + * Author: Jagan Teki + */ + +#include +#include +#include + +void sdram_print_dram_type(unsigned char dramtype) +{ + switch (dramtype) { + case DDR3: + printascii("DDR3"); + break; + case DDR4: + printascii("DDR4"); + break; + case LPDDR2: + printascii("LPDDR2"); + break; + case LPDDR3: + printascii("LPDDR3"); + break; + case LPDDR4: + printascii("LPDDR4"); + break; + default: + printascii("Unknown Device"); + break; + } +} From patchwork Mon Jul 15 18:28:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11044709 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2DD2B138D for ; Mon, 15 Jul 2019 18:29:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F848284CE for ; Mon, 15 Jul 2019 18:29:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1328D284E8; Mon, 15 Jul 2019 18:29:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AFFF2284CE for ; Mon, 15 Jul 2019 18:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ytU7J9bgztlpdmdd55GcTuVx6cNvZaawBPS9XJiwF04=; b=UO1nXCORSoGvcQ e4OS16l7CAY9cnp5+C0RRkHBVivhpIcDSsM+Zr9oaruZaNGXiY7jImTleMlrdfP4Gyt2jERgX31Vk zTppGQe09oZLDvvPVhdtYb7qG7H8+ft/zvdCocxVBnVfl0C6l2KBqxSpuPolTfGzVtvALxzQdkMYt eJVBOkmaQ5kHWAZC324sW0HBoWn7sQ+qOOd3CNaJVMd2q7LbDCraClsLNYKjjlV3aUqCa8h295LDQ 53pZjAqB/5NLNmu4lFy6DHOGSdIhZG/Ey6aV9tHB+4zvOoqEhysmMHvqByq1HVgDiqq7shAUPMHaV WSHMu6Lbb3qvcYnlwrbw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jU-0001DX-GS; Mon, 15 Jul 2019 18:29:52 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jP-00019T-JO for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:29:49 +0000 Received: by mail-pl1-x643.google.com with SMTP id b7so8724146pls.6 for ; Mon, 15 Jul 2019 11:29:47 -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=wljUduZ1j0xBQtRG6+5UBc7WpND1xlvxojNK7TDmbCM=; b=Z3vRidoKmueOLsFF11jS/LUOBsUYAp3fqeejKXOUd4qIfc2BIMCicqBcFVTKnkh1RH vm5QA6jhZE61WhiSRNLs1tEqBEmBdQkNiRgnDhHj/Y20NM7avJtmZxS5fgvEcpCOjLjs 93S0PfWgxEOS9AskZfuxNaBem3aNt3gs11VNc= 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=wljUduZ1j0xBQtRG6+5UBc7WpND1xlvxojNK7TDmbCM=; b=caAPyzMeKjovX1iu5BwR3GGGw3Mu7BYNGtXU4uHckmao4qwHEz3Sbq4J6tO26S0T3X 3W35bshYuQLXzLU2GSV00oI0UL3k0TrEJbti+wY6rMyZ8H8K/+Ymjajk0NEqgkOLW/xT efzk3/M+oa8ZClEJMTAXUnOgnCPlf1yJubjye92AUaD3skj7bKhz55aTEcc6e9KdZrRk SZvp/hHEjH3LxPJMLXEyc6ioqw+9A8aKk9urWmCUAENbpJaxP3gmAwGN+BZ5rj9TReFi XSZ6W9ooU6np+KY0NmA6N8MrjZFDb7vqODRmKvozF9n7TWRUlS/ucqJQBTbsmTlkNVku +hzw== X-Gm-Message-State: APjAAAXXkZtqz+/MX5jwksYhKioGGbb7Mzkyvx62O+jsCBBNsNJuT0NP ea2xpA96Wf2JVfg7YKlj/ITfMA== X-Google-Smtp-Source: APXvYqzRdMCI2QTTAHVwXwuV4fq5K9ZG341PiANYoYEvGAucLGVxGkl6zq/9d02MhON0HHXW8QioRw== X-Received: by 2002:a17:902:be15:: with SMTP id r21mr29254803pls.293.1563215387057; Mon, 15 Jul 2019 11:29:47 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.29.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:29:46 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v3 11/18] ram: rockchip: debug: Add sdram_print_ddr_info Date: Mon, 15 Jul 2019 23:58:49 +0530 Message-Id: <20190715182856.21688-12-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_112947_710505_C467E789 X-CRM114-Status: UNSURE ( 9.53 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add sdram ddr info print support, this would help to observe the sdram base parameters. 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 Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen Reviewed-by: Kever Yang --- .../include/asm/arch-rockchip/sdram_common.h | 7 ++++ drivers/ram/rockchip/sdram_debug.c | 40 +++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/arch/arm/include/asm/arch-rockchip/sdram_common.h b/arch/arm/include/asm/arch-rockchip/sdram_common.h index 171b233f95..cfbb511843 100644 --- a/arch/arm/include/asm/arch-rockchip/sdram_common.h +++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h @@ -97,8 +97,15 @@ int dram_init(void); 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) +{ +} #else void sdram_print_dram_type(unsigned char dramtype); +void sdram_print_ddr_info(struct sdram_cap_info *cap_info, + struct sdram_base_params *base); #endif /* CONFIG_RAM_ROCKCHIP_DEBUG */ #endif diff --git a/drivers/ram/rockchip/sdram_debug.c b/drivers/ram/rockchip/sdram_debug.c index c13e140fa5..69a6f94a73 100644 --- a/drivers/ram/rockchip/sdram_debug.c +++ b/drivers/ram/rockchip/sdram_debug.c @@ -32,3 +32,43 @@ void sdram_print_dram_type(unsigned char dramtype) break; } } + +void sdram_print_ddr_info(struct sdram_cap_info *cap_info, + struct sdram_base_params *base) +{ + u32 bg; + + bg = (cap_info->dbw == 0) ? 2 : 1; + + sdram_print_dram_type(base->dramtype); + + printascii(", "); + printdec(base->ddr_freq); + printascii("MHz\n"); + + printascii("BW="); + printdec(8 << cap_info->bw); + + printascii(" Col="); + printdec(cap_info->col); + + printascii(" Bk="); + printdec(0x1 << cap_info->bk); + if (base->dramtype == DDR4) { + printascii(" BG="); + printdec(1 << bg); + } + + printascii(" CS0 Row="); + printdec(cap_info->cs0_row); + if (cap_info->rank > 1) { + printascii(" CS1 Row="); + printdec(cap_info->cs1_row); + } + + printascii(" CS="); + printdec(cap_info->rank); + + printascii(" Die BW="); + printdec(8 << cap_info->dbw); +} 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: 11044711 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 585EA112C for ; Mon, 15 Jul 2019 18:29:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A79A284CE for ; Mon, 15 Jul 2019 18:29:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E421284E8; Mon, 15 Jul 2019 18:29:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CE653284CE for ; Mon, 15 Jul 2019 18:29:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DsYTBx/L5vYAXBPrc+oQZ3ooRCrRMNBlPVOPFWfVMr0=; b=DUzko0Ckacww6k cTiL4Xrdofm+VQQ1liV9c6j2doZuvdDuON660P8EtNxE3mIe/nzrenoedTO71MVDw/BT4thYWOGOC zPuJh1dJf6CGiH/YWIs4zD5IXqgOyFBi8jo4QfHCJdaJP5vftMsMo2HAufK6hHEBqng24AEUlkI+s mJradFHNarKiHVBbt4liXAfU3ljQqBXS0hAosTqvt8gUffRE5kD5zff6aargDmMKXHNrh6Nb+HHVq /AxpGwp5s4DkT0jGr0gjoxsrXZX058QlCGN7AqmFppaV4sGpvkD2fqsZCWzXRHUGEGfEgE0GjdHza DNQTUfsF5z7PZZe8SJpQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jW-0001FQ-SC; Mon, 15 Jul 2019 18:29:54 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jT-0001CK-1u for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:29:52 +0000 Received: by mail-pg1-x541.google.com with SMTP id o13so8099679pgp.12 for ; Mon, 15 Jul 2019 11:29:51 -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=kw/++CuXx6mQuiTZ6aAWPkhA635XZSGQPzWMsqf+2Gk=; b=k7wlHWZdkoxcCel3F5cqCw7p7xxQ+M/gQVp0KlPMU5aqW/KfGOZzqXaqW5kdS3IZk4 GIpK9VJhcHMxrOZLurRvnSwdmMV6NZELbwqkNQF2fefEMkWijf1ZoOqG8cjHpryEl1HZ kAHpX8aQc60Ak9jiVCgzHmpr2I5d2HA1PYhtQ= 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=kw/++CuXx6mQuiTZ6aAWPkhA635XZSGQPzWMsqf+2Gk=; b=pMgt3YU7YV/4xXJimcD+wLVYCMGNUFwZCWEzXz7nqyG5q1+RXTLCvK0NXqIoix62+5 Jouf7SH2qbOE3nyFcanR50P9cJpcEYzWrJFt+eUgLnJprP6aI71FHN50TgVyLnmVDbQo XAQ10dUYk2WJUP0X+f21Ce1T/l+bJLV0FGTPI3myLR22unWqY6Y1bCU1mzKtCD0oaGB/ pRzMBOMEk8IhfvhP94OvEveDrf2LdhQxbKuws+C2gm7iypD9Ugw5DJBPNgytqglEju7V 72GnG0otGnH2CvF35SZ0f4ur+sSDQ1/9qNbUrP/8SW97cYP22754Qxl4VqKzENY/KM6m p71A== X-Gm-Message-State: APjAAAUF1hKprgikrPM/mGmT9bpQtBNQi0IhBVl48+jDbjd2ev7iEO0x b/DySxhd+w5hFDha6dwG+buMrA== X-Google-Smtp-Source: APXvYqzjKoy2m05TK9g7ghOrDVYBD2b8wt3KIKbneT3Ym3yt3MijoNWxaSysY2Cngpd1zRJFv5NbMg== 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_112951_236418_06C4FF0F X-CRM114-Status: GOOD ( 11.85 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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"); } From patchwork Mon Jul 15 18:28:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11044713 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B547E138D for ; Mon, 15 Jul 2019 18:30:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7BC6284CE for ; Mon, 15 Jul 2019 18:30:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B9AD284E8; Mon, 15 Jul 2019 18:30:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4810B284CE for ; Mon, 15 Jul 2019 18:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=U5fMSIoXOec0YCqtuspt4vMdUbjGU63p4vaPmhWPx/Y=; b=cuUAmVKR3u7ZNI FzUPQlNg63ZcFpL0mnzpbmSXgfxATXF2uQjmQWXY4HPkjS2uvYYklv7xFK5R14PqnvSOL2Dk+7G2D owraYvubfnOHcoQQoBeq+yrCJmrOZ86B581WPfLUfhDzUL7S6jHUB5Ad9cJ48PME4GhuVtD1MxoXS QGKJqpsaE9iUJ4dTMYS5LoGIYWQX7oWzF2XKX/yjudJiq++AJzgIkb70TCOXhx6or1vxCx2BQNxF5 gEWKvorao2J9OWN7RD3danjQOrCd+o2u8pLwDSbYEbUF/L1vGxvMq2h9UakaNfaeVMB9GOuYHWd/M vlmDKHb6/Bc4L0uZRBnA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5ja-0001JI-BH; Mon, 15 Jul 2019 18:29:58 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jW-0001FK-KU for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:29:56 +0000 Received: by mail-pg1-x541.google.com with SMTP id i8so8099839pgm.13 for ; Mon, 15 Jul 2019 11:29:54 -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=pIDTnUfr0djUpkT1BNeINgQLdbC0j9OQ9/2h48Y8nMY=; b=P2AJyQUDnuNznXrP8Pz4e98HGmOa/ojChabMl2WigfgC2TiAOp0dx7mWRfX4m7DF21 wmcTQwMVcyD6kES+cy8GqowGh+JfYOIRo6vBdQMnjaic3ybKZgSOg6MUVdw/Vf6jx8Z5 EjtT8xx6ricfvASqn4b+qZLY7b8c+t6xz1/CU= 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=pIDTnUfr0djUpkT1BNeINgQLdbC0j9OQ9/2h48Y8nMY=; b=kDySZPUmsfCVKtfdpWDKyMFoKVl1yO2KBurVejMer5fNyknuEVgstPcOhNor0oglHn zKbBNfqldiZ57yMOXt5gEklrx4bRIClR4I6ZFqijfUkgVSkotWRvg4CXMNZ6mx53wzgc 2Y4GaJW72UJC3WvILGd4rB1nGCIwaHm8lgRrlrIZFPhmQLuizYKsEJQBYLAwNuURCHNc jc0B+OQNHbG7VWCp7ZQSsnE3j8uqmcdRV3tUYBI+w8BR9xKXBDa14kV572rYx1HPn3fu r3FCQSJrBuBqpRB9VAccmT7HyLPbWAGEt4eirAogz/k10ZUvNscV0LzO+i4z3+HcNI1x lSag== X-Gm-Message-State: APjAAAWtRfY6o3lZYImh1GkNUFfaftBc1tfcPRVV55fNjA5F7eHUrLtr gtogmtBzajCyFSaaDZ7nmxHN/w== X-Google-Smtp-Source: APXvYqwUHRsmreZ2GD5zTWUj3OnV25Jsn+WU20OiN/Q7Ps7+kiuytPuz6nWN7hDHrVOLKlU9HXD/dA== X-Received: by 2002:a63:f510:: with SMTP id w16mr28980694pgh.0.1563215393933; Mon, 15 Jul 2019 11:29:53 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.29.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:29:53 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v3 13/18] ram: rk3399: debug: Add sdram_print_stride Date: Mon, 15 Jul 2019 23:58:51 +0530 Message-Id: <20190715182856.21688-14-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_112954_799824_64D09BDE X-CRM114-Status: UNSURE ( 9.60 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add code to print the channel stride, this would help to print the stride of associated channel. Here is sample print on LPDDR4, 50MHz. 256B stride Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen Reviewed-by: Kever Yang --- .../include/asm/arch-rockchip/sdram_common.h | 5 ++++ drivers/ram/rockchip/sdram_debug.c | 29 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/arch/arm/include/asm/arch-rockchip/sdram_common.h b/arch/arm/include/asm/arch-rockchip/sdram_common.h index cfbb511843..b7549f5d8a 100644 --- a/arch/arm/include/asm/arch-rockchip/sdram_common.h +++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h @@ -102,10 +102,15 @@ inline void sdram_print_ddr_info(struct sdram_cap_info *cap_info, struct sdram_base_params *base) { } + +inline void sdram_print_stride(unsigned int stride) +{ +} #else void sdram_print_dram_type(unsigned char dramtype); void sdram_print_ddr_info(struct sdram_cap_info *cap_info, struct sdram_base_params *base); +void sdram_print_stride(unsigned int stride); #endif /* CONFIG_RAM_ROCKCHIP_DEBUG */ #endif diff --git a/drivers/ram/rockchip/sdram_debug.c b/drivers/ram/rockchip/sdram_debug.c index 19e9225c12..9cf662675b 100644 --- a/drivers/ram/rockchip/sdram_debug.c +++ b/drivers/ram/rockchip/sdram_debug.c @@ -116,3 +116,32 @@ void sdram_print_ddr_info(struct sdram_cap_info *cap_info, printdec(cap >> 20); printascii("MB\n"); } + +void sdram_print_stride(unsigned int stride) +{ + switch (stride) { + case 0xc: + printf("128B stride\n"); + break; + case 5: + case 9: + case 0xd: + case 0x11: + case 0x19: + printf("256B stride\n"); + break; + case 0xa: + case 0xe: + case 0x12: + printf("512B stride\n"); + break; + case 0xf: + printf("4K stride\n"); + break; + case 0x1f: + printf("32MB + 256B stride\n"); + break; + default: + printf("no stride\n"); + } +} From patchwork Mon Jul 15 18:28:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11044715 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BAAF01395 for ; Mon, 15 Jul 2019 18:30:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A90A8284CE for ; Mon, 15 Jul 2019 18:30:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 970A6284E8; Mon, 15 Jul 2019 18:30:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 25B0A284CE for ; Mon, 15 Jul 2019 18:30:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IN2rDz136bW46/A3UlpPHmW+TCVFYIeH3Gp+WnOuTvM=; b=MWZyuII8Tlglhh yvli6BA2D7PMXzDUD7Vh8TIlxB4Ye1ltlAn0ZLf7C/ys5JhELp/zJtLhcJlJHEE7edHMSOfjeYlbQ agH/RDTt/+YhqM07olCSiEhAST/tMt4Hj6fHIm2PmhGss1cG7jERENZmaABol6KOeNvDm9r6hWhwa nq/6SA+Q075y26+F+43RAyNgR5Ksg2RbjTJ1cr4HhOUvkfPk79IQ0SD7vnZDl2bsjtT02X+2f0Tiz JaidZCb/NK8alR+SHfM6lIUIw37vtKfbyw6enG53KgsL0rTcTny0tdKRXf+TfMwfH2xHQ+ikwh75I kescMoi/C1vufkPyFxsA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jc-0001M4-Tn; Mon, 15 Jul 2019 18:30:00 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5ja-0001In-3y for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:29:59 +0000 Received: by mail-pf1-x443.google.com with SMTP id b13so7819720pfo.1 for ; Mon, 15 Jul 2019 11:29:58 -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=AsLLPwLnBovdXkNi9P5ImLX7S8wEFQBRTIIMJmHhUWg=; b=Coa1qETYaxDUm8uiAG14zdZbsHjqMda5bm2SHZgWGv/slXP9hsxR481YYp24tsSSc/ 7JBJ2eeyXDoRIsmMgkKWFJG0xN5XmYCOEnlgipbKuYak6TxxWPPg6cRndyfpNsPVNLV9 QaBciVXMCGlpZoa+IJp3g2CwmZhhjbCMuJBbA= 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=AsLLPwLnBovdXkNi9P5ImLX7S8wEFQBRTIIMJmHhUWg=; b=QWSxugFc6hYqpnXSqPahxT6ZnV2keiX8mETgMofW+7FFlCxlpui5sQ76WLD/Zhi4Tl dwT3HwHbeAA4xOKK6ffro1CWd49nSOYmeisGGg79oKoJbWT+Upd4pXIutLGvEq+SdeVe jT81uETSmzxtT60NTc6wd1Q9WyTUL+gIKSDH+0CkGNjnZ1lD/Hfo09tnzKo88+O7fOYI VfeTZ0v9dV4xNr53wvKn08pJdYwOEGcDyEvbqoxcNkED9QmPugoWKMls9Dh88+H6IotW TtlhrxLyyPfedKaItuM9aC59RKJZn9upAeP7sXcfANbliM2VqTAenw23gk5wyqdHMXxH EmIA== X-Gm-Message-State: APjAAAW7AER7Bk8rDXWgyLJETrAPWp0Y2WAtbzHb9j76se5RyDrbe8hI awbgmbeV1+8waOGjqc3yKcqnng== X-Google-Smtp-Source: APXvYqyBRQMYorqyvfi6aIXugZxyrflH5vgQZzW3mnTdn64P9LtM1GYxU9JiH3WHsIbv3ZZoJ5/suQ== X-Received: by 2002:a63:4845:: with SMTP id x5mr27631710pgk.155.1563215397471; Mon, 15 Jul 2019 11:29:57 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.29.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:29:57 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v3 14/18] ram: rk3399: Compute stride for 2 channels Date: Mon, 15 Jul 2019 23:58:52 +0530 Message-Id: <20190715182856.21688-15-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_112958_179843_339F2FEE X-CRM114-Status: GOOD ( 16.72 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP stride value from sdram timings can be computed dynamically based on the determined capacity for the given channel. Right now these stride values are taken as part of sdram timings via dtsi, but it possible to use same timings dtsi for given frequency even though the configured board sdram do support single channel with different size by dynamically detect the stride value. Example, NanoPi NEO4 do have DDR3-1866, but with single channel and 1GB size with dynamic stride detection it is possible to use existing rk3399-sdram-ddr3-1866.dtsi whose stride, number of channels and capacity it support is d efferent. So, add initial support to calculate the stride value for 2 channels sdram, which is available by default on existing boards. Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen Reviewed-by: Kever Yang --- drivers/ram/rockchip/sdram_rk3399.c | 71 ++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index 084c949728..c626ef602c 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -1183,8 +1183,75 @@ static int switch_to_phy_index1(struct dram_info *dram, return 0; } +static unsigned char calculate_stride(struct rk3399_sdram_params *params) +{ + unsigned int stride = params->base.stride; + unsigned int channel, chinfo = 0; + unsigned int ch_cap[2] = {0, 0}; + u64 cap; + + for (channel = 0; channel < 2; channel++) { + unsigned int cs0_cap = 0; + unsigned int cs1_cap = 0; + struct sdram_cap_info *cap_info = ¶ms->ch[channel].cap_info; + + if (cap_info->col == 0) + continue; + + cs0_cap = (1 << (cap_info->cs0_row + cap_info->col + + cap_info->bk + cap_info->bw - 20)); + if (cap_info->rank > 1) + cs1_cap = cs0_cap >> (cap_info->cs0_row + - cap_info->cs1_row); + if (cap_info->row_3_4) { + cs0_cap = cs0_cap * 3 / 4; + cs1_cap = cs1_cap * 3 / 4; + } + ch_cap[channel] = cs0_cap + cs1_cap; + chinfo |= 1 << channel; + } + + /* stride calculation for 2 channels, default gstride type is 256B */ + if (ch_cap[0] == ch_cap[1]) { + cap = ch_cap[0] + ch_cap[1]; + switch (cap) { + /* 512MB */ + case 512: + stride = 0; + break; + /* 1GB */ + case 1024: + stride = 0x5; + break; + /* + * 768MB + 768MB same as total 2GB memory + * useful space: 0-768MB 1GB-1792MB + */ + case 1536: + /* 2GB */ + case 2048: + stride = 0x9; + break; + /* 1536MB + 1536MB */ + case 3072: + stride = 0x11; + break; + /* 4GB */ + case 4096: + stride = 0xD; + break; + default: + printf("%s: Unable to calculate stride for ", __func__); + print_size((cap * (1 << 20)), " capacity\n"); + break; + } + } + + return stride; +} + static int sdram_init(struct dram_info *dram, - const struct rk3399_sdram_params *params) + struct rk3399_sdram_params *params) { unsigned char dramtype = params->base.dramtype; unsigned int ddr_freq = params->base.ddr_freq; @@ -1232,6 +1299,8 @@ static int sdram_init(struct dram_info *dram, set_ddrconfig(chan, params, channel, params->ch[channel].cap_info.ddrconfig); } + + params->base.stride = calculate_stride(params); dram_all_config(dram, params); switch_to_phy_index1(dram, params); From patchwork Mon Jul 15 18:28:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11044717 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB84A112C for ; Mon, 15 Jul 2019 18:30:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE2BF284CE for ; Mon, 15 Jul 2019 18:30:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B24E3284E8; Mon, 15 Jul 2019 18:30:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 64262284CE for ; Mon, 15 Jul 2019 18:30:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NXiUIUvao4NmSI2ID9zjNr3+B4ZJUwonauocXsAbViI=; b=o64T4HY/1EuFMt EqsGbcpmeVrbThnTO9eEIZc5t6LiRh6djO9fyvaVN6ay5K6Ra/ScTxHV0TAadQOvKni9Qz2UGrNQ1 PQS0LdI24qSR5fZKSi5jwnXNokwZjPycvFpv9xixGrLBfwirz8sCmvtDiVuUhVKQvPe3xBOx03yR4 2eqMJmQdVvY2XX5kRd2ERtC0VQh7iTGvOv3xXrFaKEh1Q8qZEpDP/c3Orahq7JoclE2VDFeBjOkKA /xg0MPssS0gUEZ3Xu3OUOo3x1f7g9XtVBa2bJ9z9tu9XEDa8smC2bo7oy/XuUBrCaHnu9SycOxcFw 53R7f8OFuyYmseuKznzw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jk-00028t-An; Mon, 15 Jul 2019 18:30:08 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jg-0001MW-FE for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:30:05 +0000 Received: by mail-pl1-x642.google.com with SMTP id t14so8697177plr.11 for ; Mon, 15 Jul 2019 11:30:01 -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=RByc4KuNwswp3759wv/08UvlM/GeZhHFfJFldIHINB0=; b=kFVq7vbrs9VR7bXKgd9vZRDPlT44EKHZ44s5ZxIT1QIBffEEm4NcDZOm5qU2cUuVov TK7xPnLxJtQzmcjhr/pOQxgluMCCTBSALGziII16Qqu0cY0PBHYaj35pNR0WqkR3gDd+ NpOS6/h9pVRWD8dBcBzDR/twoyeBxMJi0oy7U= 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=RByc4KuNwswp3759wv/08UvlM/GeZhHFfJFldIHINB0=; b=qra8rt1IRRWx188y2tU9elbIn1/HsflCWRrZrEKwdYD750qFBu4At8S0XHvQOdFCT9 99npV3nRf+iQLuutihlI7VeM/JAm7Vp0vjrQXSLvT5Fmor1/IW+cxi+mQGa1gN4WhQTd RSTYtvogm3pFFN4dPqxzEAYSMlxcsMe2bFEBYJJM4DzehX3bzQNA+35AYBDS+g8CGVaK vrYG0NRP+fsIFwdf+2UobrKCtETRx5U6ZXmFBZhpbIwjDC6AK+FAwhfOQTXqEZ/+j9Ts rmjJBdOJ6FmfQlOZgPd1Xyg5MChZw3Bto2vgkic6MqOzkDERogpbD5pUO8ccTPV+4hYM n4/g== X-Gm-Message-State: APjAAAUET4YZHFdCaWHK3SB7g/XQY6t1OCGHwuo1RGjMDzccvaafvj60 hvjK+Yg++uGn3VvKm3qh0qE27Q== X-Google-Smtp-Source: APXvYqywsgSt58m+LvDm24277DQXJEksXD52HDqNZDFYDQT4q6xQokVMhQVKkTDj/UXPFeechT2nFA== X-Received: by 2002:a17:902:be0a:: with SMTP id r10mr28259146pls.51.1563215401031; Mon, 15 Jul 2019 11:30:01 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.29.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:30:00 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v3 15/18] ram: rk3399: Compute stride for 1 channel a Date: Mon, 15 Jul 2019 23:58:53 +0530 Message-Id: <20190715182856.21688-16-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_113004_527556_0B632CC0 X-CRM114-Status: GOOD ( 10.90 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add stride computation for the sdram which support single channel a This configuration available in NanoPi NEO4 and the same can work with existing rk3399-sdram-ddr3-1866.dtsi Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen Reviewed-by: Kever Yang --- drivers/ram/rockchip/sdram_rk3399.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index c626ef602c..8bbacb5275 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -1211,6 +1211,10 @@ static unsigned char calculate_stride(struct rk3399_sdram_params *params) chinfo |= 1 << channel; } + /* stride calculation for 1 channel */ + if (params->base.num_channels == 1 && chinfo & 1) + return 0x17; /* channel a */ + /* stride calculation for 2 channels, default gstride type is 256B */ if (ch_cap[0] == ch_cap[1]) { cap = ch_cap[0] + ch_cap[1]; From patchwork Mon Jul 15 18:28:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11044719 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2C9481395 for ; Mon, 15 Jul 2019 18:30:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E8E7284CE for ; Mon, 15 Jul 2019 18:30:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11E59284E8; Mon, 15 Jul 2019 18:30:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8870D284CE for ; Mon, 15 Jul 2019 18:30:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MOK6gW9pOKC8ErbhHqKjLJ6XwD+DNJAwMLJVKcAk+uE=; b=oXIIqRuRlYNgS1 Qb4RR952fF1MJvdb5v7OAV5LRuobNy0krM62ZZ1vm9t7anwDeA+cZTpaL7wdul1exhREKleRP3L/q z8AUzi4EspgT9TT8If/+fjdURehpefP2NU4q8/ilmBwnqlRdPmnwEfZokCt8RQFwJPrhkRmfpSmwf dRR2WU7I6TDRZQv/84yzCyNK+QuoQvc8xMsqIlYqL/GfAbPoYfPmtctmOHsMINr1yMtGZAAJqfNkF yrQJFCsY6ErweSmoCLf7tTpHBLSnWygtJPxjDtFTe8vCZj7sRLWLQ1QQhusTSl7ommVB6HFBjLS0O LF4ZhICKH4RVhfvn9eYw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jm-0002PR-ND; Mon, 15 Jul 2019 18:30:11 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jh-0001iZ-7W for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:30:07 +0000 Received: by mail-pf1-x442.google.com with SMTP id i189so7809660pfg.10 for ; Mon, 15 Jul 2019 11:30:05 -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=sqbrOYwvlaoeOAcZLAQeQHRuttDiSnuSC+eoRb7//98=; b=F9mZj79uQ/4vbxriBi3/a5DIfCaPwC33hGnbenaHD2AKqeP9pNvkHxk8bW1amvGuIh 22gmbfttALShfo5TyY8rVql1kfjwiT2NrCJ5Txxd0oJdhocrTuu+hRcmz40UPCWtBivd xJ8WHOLBdPasxZ6LIp2aph04xlYUZtOGs9EpI= 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=sqbrOYwvlaoeOAcZLAQeQHRuttDiSnuSC+eoRb7//98=; b=tl0XyT/HP5YlD8ZlAOWj5Hc6nlsvwgrGkPDEQ+9N9mGmBbqJ4B9XpAbBKZRQA49eZT nJBVX1dVBT4KpFFAlIgrx0t1daDO9seWZAXVNp+wZG6gE9Dc36T2Dy99FcoZ+Pzkpgss nsQpqPTJambYogkGgqiLHIYWi0ZOHuKnSHhJsNqcomj7i3siQ2HGeDnpNaBw/FsHkFhd iKSouRZMjH4veLfp96UUdoeiGF8Y8w+hq8MijsrjT69rJUfaEFNDEXBcaJxXuFLzPbfj /GuIEHqfcl+03goTePlfQGGUcdn4Tbm5OphRV9bN0ptXxLxs4eAYIYCaJ2nSPIAqEV+L hmyQ== X-Gm-Message-State: APjAAAWKmMA+ZEqJKHYFpMqPAafSOgRaGg+ukgIbUHJNs5uyGykPR+ac BUcqC02hEuQaWiQml+GVbyNJ7w== X-Google-Smtp-Source: APXvYqyX5FW1HrlEjn0zT84YqgHPFNR+S1tf2IaigsXYUWm5iHrzzNBg4QWDWqZRqERJe8WBuvcAVw== X-Received: by 2002:a17:90a:35e6:: with SMTP id r93mr31007925pjb.20.1563215404504; Mon, 15 Jul 2019 11:30:04 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.30.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:30:04 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v3 16/18] ram: rk3399: Add rank detection support Date: Mon, 15 Jul 2019 23:58:54 +0530 Message-Id: <20190715182856.21688-17-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_113005_311076_A03E73EE X-CRM114-Status: GOOD ( 19.54 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Right now the rk3399 sdram driver assume that the board has configured with 2 channels, so any possibility to enable single channel on the same driver will encounter channel #1 data training failure. Log: U-Boot TPL board init sdram_init: data training failed rk3399_dmc_init DRAM init failed -5 So, add an algorithm that can capable to compute the active or configured rank with associated channel like a) do rank loop to compute the active rank, with associated channel numbers b) then, succeed the data training only for configured channel c) preserve the rank for given channel d) do channel loop for setting the active channel e) if given rank is zero or inactive on the specific channel, clear the timings for the associated channel f) finally, return error if number of channels is zero Tested in NanoPI-NEO4 since it support single channel sdram configuration. Signed-off-by: Jagan Teki Signed-off-by: YouMin Chen Reviewed-by: Kever Yang --- drivers/ram/rockchip/sdram_rk3399.c | 110 ++++++++++++++++++++++------ 1 file changed, 86 insertions(+), 24 deletions(-) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index 8bbacb5275..b83955f94e 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -1254,13 +1254,52 @@ static unsigned char calculate_stride(struct rk3399_sdram_params *params) return stride; } +static void clear_channel_params(struct rk3399_sdram_params *params, u8 channel) +{ + params->ch[channel].cap_info.rank = 0; + params->ch[channel].cap_info.col = 0; + params->ch[channel].cap_info.bk = 0; + params->ch[channel].cap_info.bw = 32; + params->ch[channel].cap_info.dbw = 32; + params->ch[channel].cap_info.row_3_4 = 0; + params->ch[channel].cap_info.cs0_row = 0; + params->ch[channel].cap_info.cs1_row = 0; + params->ch[channel].cap_info.ddrconfig = 0; +} + +static int pctl_init(struct dram_info *dram, struct rk3399_sdram_params *params) +{ + int channel; + int ret; + + for (channel = 0; channel < 2; channel++) { + const struct chan_info *chan = &dram->chan[channel]; + struct rk3399_cru *cru = dram->cru; + struct rk3399_ddr_publ_regs *publ = chan->publ; + + phy_pctrl_reset(cru, channel); + phy_dll_bypass_set(publ, params->base.ddr_freq); + + ret = pctl_cfg(dram, chan, channel, params); + if (ret < 0) { + printf("%s: pctl config failed\n", __func__); + return ret; + } + + /* start to trigger initialization */ + pctl_start(dram, channel); + } + + return 0; +} + static int sdram_init(struct dram_info *dram, struct rk3399_sdram_params *params) { unsigned char dramtype = params->base.dramtype; unsigned int ddr_freq = params->base.ddr_freq; - struct rk3399_cru *cru = dram->cru; - int channel; + u32 training_flag = PI_READ_GATE_TRAINING; + int channel, ch, rank; int ret; debug("Starting SDRAM initialization...\n"); @@ -1272,36 +1311,59 @@ static int sdram_init(struct dram_info *dram, return -E2BIG; } - for (channel = 0; channel < 2; channel++) { - const struct chan_info *chan = &dram->chan[channel]; - struct rk3399_ddr_publ_regs *publ = chan->publ; + for (ch = 0; ch < 2; ch++) { + params->ch[ch].cap_info.rank = 2; + for (rank = 2; rank != 0; rank--) { + ret = pctl_init(dram, params); + if (ret < 0) { + printf("%s: pctl init failed\n", __func__); + return ret; + } - phy_pctrl_reset(cru, channel); - phy_dll_bypass_set(publ, ddr_freq); + /* LPDDR2/LPDDR3 need to wait DAI complete, max 10us */ + if (dramtype == LPDDR3) + udelay(10); - if (channel >= params->base.num_channels) - continue; + params->ch[ch].cap_info.rank = rank; - ret = pctl_cfg(dram, chan, channel, params); - if (ret < 0) { - printf("%s: pctl config failed\n", __func__); - return ret; - } + /* + * LPDDR3 CA training msut be trigger before + * other training. + * DDR3 is not have CA training. + */ + if (params->base.dramtype == LPDDR3) + training_flag |= PI_CA_TRAINING; - /* start to trigger initialization */ - pctl_start(dram, channel); + if (!(data_training(&dram->chan[ch], ch, + params, training_flag))) + break; + } + /* Computed rank with associated channel number */ + params->ch[ch].cap_info.rank = rank; + } - /* LPDDR2/LPDDR3 need to wait DAI complete, max 10us */ - if (dramtype == LPDDR3) - udelay(10); + params->base.num_channels = 0; + for (channel = 0; channel < 2; channel++) { + const struct chan_info *chan = &dram->chan[channel]; + struct sdram_cap_info *cap_info = ¶ms->ch[channel].cap_info; - if (data_training(chan, channel, params, PI_FULL_TRAINING)) { - printf("%s: data training failed\n", __func__); - return -EIO; + if (cap_info->rank == 0) { + clear_channel_params(params, channel); + continue; + } else { + params->base.num_channels++; } - set_ddrconfig(chan, params, channel, - params->ch[channel].cap_info.ddrconfig); + debug("Channel "); + debug(channel ? "1: " : "0: "); + + set_ddrconfig(chan, params, channel, cap_info->ddrconfig); + } + + if (params->base.num_channels == 0) { + printf("%s: ", __func__); + printf(" - %dMHz failed!\n", params->base.ddr_freq); + return -EINVAL; } params->base.stride = calculate_stride(params); From patchwork Mon Jul 15 18:28:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11044721 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 108C51395 for ; Mon, 15 Jul 2019 18:30:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0238E284CE for ; Mon, 15 Jul 2019 18:30:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA9DB284E8; Mon, 15 Jul 2019 18:30:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A354E284CE for ; Mon, 15 Jul 2019 18:30:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=d+zLeTENMO/cgAVYFUfrc4AJBCMKsV3Irf5ARbsGhIg=; b=nUHpzZmTpUK/kw 4WDTe47zb4TtSqQTx3clih3vflNr4yRyLZ1yvLP1nxJI0sh3tXOqdzK8CxDzsIdd+5rB1/q/1zXxF zkutAkhwA2aPhl3cED3veCbkug1zkBaCg9hEsleJ7ojGRLJYNkJOp6LA6Cn0sL03wuwGJvQdjD1gu xfp15/yQswLTHbuSAUSi1N4RK+A4425i5SxozdtEvdDqt7TAs5HAWU8ci0zCIdinf1dg2fhFuqRMW HPYhKcdYMuFk532MZ9zxIcbXBX7cVoFR0/pQead5Bb+4hiWs9wNi4VvMgznP4n7mb3RrJDaqnRxL4 mKrCFFCnxn7RL0zKgDzQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jp-0002gc-O0; Mon, 15 Jul 2019 18:30:13 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jk-00028X-Cg for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:30:09 +0000 Received: by mail-pl1-x643.google.com with SMTP id m9so8679622pls.8 for ; Mon, 15 Jul 2019 11:30:08 -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=gYf4E6KmEJMpnMow4hpC6iE9+FOQ3+Z1CgoYtUkZWOg=; b=rvikxEPLkz2503wcJyoyqBLful11DQcvNNfV+wrHDRBrT9rD1W8tc6fItigFPO9vHa TPILa7dyl2nRzY11UFZ1dvHL+C2eArzABZRRRcGtLI/9VVAKD/6+Qf8icJhBUXVo3+FP PQLBeqFczphwAtjeGjsz2OTV5zNI3YGgCSlc0= 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=gYf4E6KmEJMpnMow4hpC6iE9+FOQ3+Z1CgoYtUkZWOg=; b=k/QRNffRrnz1zfhxUgYJLmdQExFwjqkGmaveywH9tH7We49fKEHYr7m0umDZ9DT9dv 6GWgYZfKekeMt4cU9H7/S0p6NLinGD+NF2IAv3kNyByZMsS6Z7EujkXTemcWbTxU2O+4 yYIr3xdN0hn6vYxXQg3BiyMAynUl3duFbTBQEb5YLZC6Cpvq0JT/rJ8M3URpUeJaLpNb GuqNCWOzYvzoeLeBbtZSAf3sTaMHgTnt+MERsyA7zd9k/qdL+O9XkMfXT9HehZCHWAuo zZ4w98Qp9ugmkBIiftNg5Psph5wfqUuOjEwsfJZQabpht8q/pqLTqhwwopP2vwWL2F/s jfMA== X-Gm-Message-State: APjAAAW/wD1FRvtb8H1su3EmEuO49InKC1lpzBZ301K4AYpHKUpEFKhH yiei9Yfg9pKqoibH2bC8J3avuw== X-Google-Smtp-Source: APXvYqw2evLoNu65Hm6lRS0sZD1C2SNhy3Hvj0UnygXE+cFE24hprtFDrWkS0NhU06ecxS0iXqWW5Q== X-Received: by 2002:a17:902:b608:: with SMTP id b8mr30342008pls.303.1563215407898; Mon, 15 Jul 2019 11:30:07 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.30.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:30:07 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v3 17/18] ram: rk3399: Enable sdram debug functions Date: Mon, 15 Jul 2019 23:58:55 +0530 Message-Id: <20190715182856.21688-18-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_113008_443813_879BA54F X-CRM114-Status: GOOD ( 10.18 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This would help to debug the sdram base parameters while debugging existing chip or while supporting new sdram type. It require explicit enablement of CONFIG_RAM_ROCKCHIP_DEBUG for showing the debug prints. Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- drivers/ram/rockchip/sdram_rk3399.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c index b83955f94e..9a60c24135 100644 --- a/drivers/ram/rockchip/sdram_rk3399.c +++ b/drivers/ram/rockchip/sdram_rk3399.c @@ -1251,6 +1251,8 @@ static unsigned char calculate_stride(struct rk3399_sdram_params *params) } } + sdram_print_stride(stride); + return stride; } @@ -1357,11 +1359,14 @@ static int sdram_init(struct dram_info *dram, debug("Channel "); debug(channel ? "1: " : "0: "); + sdram_print_ddr_info(cap_info, ¶ms->base); + set_ddrconfig(chan, params, channel, cap_info->ddrconfig); } if (params->base.num_channels == 0) { printf("%s: ", __func__); + sdram_print_dram_type(params->base.dramtype); printf(" - %dMHz failed!\n", params->base.ddr_freq); return -EINVAL; } From patchwork Mon Jul 15 18:28:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11044723 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0E9B1112C for ; Mon, 15 Jul 2019 18:30:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00C31284CE for ; Mon, 15 Jul 2019 18:30:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E934C284E8; Mon, 15 Jul 2019 18:30:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9BA24284CE for ; Mon, 15 Jul 2019 18:30:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MlQEbnLONhyr/GB2CYERtksHvm7NKlpILXfNHUywjp8=; b=k1cK9K2/SGhUEf AlEGaY6mK6i5D8Y3LW5yYTmIEL0FgzgGhEj2ehGE49BtxTgAe5tV+EoPXBBkDu5YqkAzv8tiF1wxN bBQMJUUaMhr4i6wnZaYiV4BQlG+jBYU1a47qDK5sUnGFb5Iqe4FslZThe6GWTE+cD1H9HRIZYejsB RMRAvUt4yB1wptQf3PXxR4rHqIAVavgnPOqgYqzYw3ckzmtDCaa4hxDygcux8lte0HIvy4IW82i/Q SiZyUJUsqHF6e/F1TBEcM1HnH98Eaeq4fHOeKsv50FwyUOSwXkEPgAMAyWRDTtk5U1XQ/Kj8WU64A NSVOtoIbexWL1gvQp62A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jr-0002id-O2; Mon, 15 Jul 2019 18:30:15 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hn5jn-0002bP-UX for linux-rockchip@lists.infradead.org; Mon, 15 Jul 2019 18:30:13 +0000 Received: by mail-pf1-x442.google.com with SMTP id i189so7809830pfg.10 for ; Mon, 15 Jul 2019 11:30:11 -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=wTBXweD1R6wZJRqFVMEPyWutx8ndp9xyM4VkgFPZiDk=; b=lON59up1rqoAuUl1YwGncjQfeOQTy2UBDIi8zy1+mZpchdUUephNWefENe1Ick/KmT ix+4+yNfhKvX1ktixSYepm82W9tkcXgH7JB+azV2uMlkxpVZ+G5LaIpYPq9N8kcL5DHK kiLoRiX1G7b/uL/9IRO9TKeU8UNmNZvEIHkyk= 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=wTBXweD1R6wZJRqFVMEPyWutx8ndp9xyM4VkgFPZiDk=; b=UhgamgMej0suc+lewwrcR1JlmLKIQrfpxm5JeTV0KSreS6m8EiXs2k3zq+5wsU1LjS ike/NdndMyAlSm+DpBWW7KNTM5hxl2PRBJvBgjnnICAFyQ74jce3PCpzk/EpNdE/vHOw NmUx2Ag8ikM3Jeu6TAJgJRi9wqeMSw2agO3jm3TJdpmWFAjSHCfgyiXjAnXZvN8Msnux OMiIOq1ekHiNxpromDDVWG9eGwFYLewObXIYsjKXx+LnPxKZ77yRXYt4lBwsJ77zWLGN RV/kweaoMAMOoXfB+9BiqUPOYq15kTvJU/Pu33gslohC2E+dFQm+lm45bPQ6hud3sa0R xrDQ== X-Gm-Message-State: APjAAAW95nlcrUFTDT3+bIqJcHZ5SCtFEb/T7cmwTlK1h+NwczofMhU9 MpG+xWvRTqqo++PyIMpHt6a+YA== X-Google-Smtp-Source: APXvYqwCRT5i64OhuDmqJk0PGWYpu7tXTDPPQRZFCGZ5c6XTlN9orY0DAC0widfwl6XvKRDvDWHKVg== X-Received: by 2002:a63:5920:: with SMTP id n32mr27438776pgb.352.1563215411338; Mon, 15 Jul 2019 11:30:11 -0700 (PDT) Received: from localhost.localdomain ([49.206.201.107]) by smtp.gmail.com with ESMTPSA id y133sm20250075pfb.28.2019.07.15.11.30.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 11:30:10 -0700 (PDT) From: Jagan Teki To: Simon Glass , Philipp Tomsich , Kever Yang , YouMin Chen , u-boot@lists.denx.de Subject: [PATCH v3 18/18] rockchip: dts: rk3399: nanopi-neo4: Use DDR3-1866 dtsi Date: Mon, 15 Jul 2019 23:58:56 +0530 Message-Id: <20190715182856.21688-19-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190715_113012_098350_7346F13D X-CRM114-Status: UNSURE ( 9.81 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rockchip@lists.infradead.org, gajjar04akash@gmail.com, linux-amarula@amarulasolutions.com, Jagan Teki , Manivannan Sadhasivam Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use DDR3-1866 2GB ddr timings dtsi for 1GB NanoPi Neo4 board. Since sdram rk3399 support dynamic stride and rank detection it can able to detect 1GB ddr eventough the timings are meant for dual channel, 2GB size. Bootchain after and before this change are: TPL -> SPL -> U-Boot proper rkbin -> SPL -> U-Boot proper This certainly fix the second channel data training initialization since we have dynamic rank, stride where second channel capabilities are clear or memset to 0. Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- arch/arm/dts/rk3399-nanopi-neo4-u-boot.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/dts/rk3399-nanopi-neo4-u-boot.dtsi b/arch/arm/dts/rk3399-nanopi-neo4-u-boot.dtsi index 7d22528f49..eb0aca4758 100644 --- a/arch/arm/dts/rk3399-nanopi-neo4-u-boot.dtsi +++ b/arch/arm/dts/rk3399-nanopi-neo4-u-boot.dtsi @@ -4,3 +4,4 @@ */ #include "rk3399-nanopi4-u-boot.dtsi" +#include "rk3399-sdram-ddr3-1866.dtsi"