public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/4] ARM: mx6: ddr: Configure all SDQS pullups using loop
Date: Tue, 26 Nov 2019 09:34:51 +0100	[thread overview]
Message-ID: <20191126083452.4605-3-marex@denx.de> (raw)
In-Reply-To: <20191126083452.4605-1-marex@denx.de>

Instead of explicitly setting up each SDQS register, use a loop.
No functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Eric Nelson <eric@nelint.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 arch/arm/mach-imx/mx6/ddr.c | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-imx/mx6/ddr.c b/arch/arm/mach-imx/mx6/ddr.c
index e917b04f3d..b2402f75db 100644
--- a/arch/arm/mach-imx/mx6/ddr.c
+++ b/arch/arm/mach-imx/mx6/ddr.c
@@ -249,25 +249,14 @@ static void mmdc_set_sdqs(bool set)
 {
 	struct mx6dq_iomux_ddr_regs *mx6_ddr_iomux =
 		(struct mx6dq_iomux_ddr_regs *)MX6DQ_IOM_DDR_BASE;
-
-	if (set) {
-		setbits_le32(&mx6_ddr_iomux->dram_sdqs0, 0x7000);
-		setbits_le32(&mx6_ddr_iomux->dram_sdqs1, 0x7000);
-		setbits_le32(&mx6_ddr_iomux->dram_sdqs2, 0x7000);
-		setbits_le32(&mx6_ddr_iomux->dram_sdqs3, 0x7000);
-		setbits_le32(&mx6_ddr_iomux->dram_sdqs4, 0x7000);
-		setbits_le32(&mx6_ddr_iomux->dram_sdqs5, 0x7000);
-		setbits_le32(&mx6_ddr_iomux->dram_sdqs6, 0x7000);
-		setbits_le32(&mx6_ddr_iomux->dram_sdqs7, 0x7000);
-	} else {
-		clrbits_le32(&mx6_ddr_iomux->dram_sdqs0, 0x7000);
-		clrbits_le32(&mx6_ddr_iomux->dram_sdqs1, 0x7000);
-		clrbits_le32(&mx6_ddr_iomux->dram_sdqs2, 0x7000);
-		clrbits_le32(&mx6_ddr_iomux->dram_sdqs3, 0x7000);
-		clrbits_le32(&mx6_ddr_iomux->dram_sdqs4, 0x7000);
-		clrbits_le32(&mx6_ddr_iomux->dram_sdqs5, 0x7000);
-		clrbits_le32(&mx6_ddr_iomux->dram_sdqs6, 0x7000);
-		clrbits_le32(&mx6_ddr_iomux->dram_sdqs7, 0x7000);
+	u32 sdqs = (u32)(&mx6_ddr_iomux->dram_sdqs0);
+	int i;
+
+	for (i = 0; i < 8; i++) {
+		if (set)
+			setbits_le32(sdqs + (4 * i), 0x7000);
+		else
+			clrbits_le32(sdqs + (4 * i), 0x7000);
 	}
 }
 
-- 
2.24.0

  parent reply	other threads:[~2019-11-26  8:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26  8:34 [U-Boot] [PATCH 1/4] ARM: mx6: ddr: Make debug prints work with tiny printf Marek Vasut
2019-11-26  8:34 ` [U-Boot] [PATCH 2/4] ARM: mx6: ddr: Factor out SDQS configuration code Marek Vasut
2019-11-26 16:26   ` Eric Nelson
2019-12-29 10:27   ` sbabic at denx.de
2019-11-26  8:34 ` Marek Vasut [this message]
2019-11-26 16:26   ` [U-Boot] [PATCH 3/4] ARM: mx6: ddr: Configure all SDQS pullups using loop Eric Nelson
2019-12-29 10:26   ` sbabic at denx.de
2019-11-26  8:34 ` [U-Boot] [PATCH 4/4] ARM: mx6: ddr: Add support for iMX6SX Marek Vasut
2019-11-26 16:26   ` Eric Nelson
2019-12-29 10:24   ` sbabic at denx.de
2019-11-26 16:19 ` [U-Boot] [PATCH 1/4] ARM: mx6: ddr: Make debug prints work with tiny printf Eric Nelson
2019-12-29 10:25 ` sbabic at denx.de

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191126083452.4605-3-marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox