public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/9] mmc: sdhci: Clear SDHCI_CLOCK_CONTROL before configuring the new value
Date: Thu, 19 Jan 2017 08:39:33 +0100	[thread overview]
Message-ID: <20170119073941.8057-1-sr@denx.de> (raw)

This patch completely clears the SDHCI_CLOCK_CONTROL register before the
new value is configured instead of just clearing the 2 bits
SDHCI_CLOCK_CARD_EN and SDHCI_CLOCK_INT_EN. Without this change, some
clock configurations will lead to the "Internal clock never stabilised."
error message on the Xenon SDHCI controller used on the Marvell Armada
3700 and 7k/8k ARM64 SoCs.

The Linux SDHCI core driver also writes 0 to this register before
the new value is configured. So this patch simplifies the driver a bit
and brings the U-Boot driver more in-line with the Linux one.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Cc: Michal Simek <michal.simek@xilinx.com>
---
 drivers/mmc/sdhci.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 5b404ff4a3..081b014a17 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -295,7 +295,7 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
 static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
 {
 	struct sdhci_host *host = mmc->priv;
-	unsigned int div, clk = 0, timeout, reg;
+	unsigned int div, clk = 0, timeout;
 
 	/* Wait max 20 ms */
 	timeout = 200;
@@ -311,9 +311,7 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
 		udelay(100);
 	}
 
-	reg = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
-	reg &= ~(SDHCI_CLOCK_CARD_EN | SDHCI_CLOCK_INT_EN);
-	sdhci_writew(host, reg, SDHCI_CLOCK_CONTROL);
+	sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
 
 	if (clock == 0)
 		return 0;
-- 
2.11.0

             reply	other threads:[~2017-01-19  7:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170119074123epcas4p41de3533e3465771004b7d800684021db@epcas4p4.samsung.com>
2017-01-19  7:39 ` Stefan Roese [this message]
2017-01-19  7:39   ` [U-Boot] [PATCH 2/9] mmc: sdhci: Add support for optional controller specific set_ios_post() Stefan Roese
2017-01-24  6:55     ` Jaehoon Chung
2017-01-19  7:39   ` [U-Boot] [PATCH 3/9] mmc: Add Marvell Xenon SDHCI controller driver Stefan Roese
2017-01-19 23:16     ` Masahiro Yamada
2017-01-20  5:48       ` Stefan Roese
2017-01-19  7:39   ` [U-Boot] [PATCH 4/9] arm64: mvebu: Armada 3700: Add SDHCI device tree nodes Stefan Roese
2017-01-19  7:39   ` [U-Boot] [PATCH 5/9] arm64: mvebu: Armada 3720-db: " Stefan Roese
2017-01-19  7:39   ` [U-Boot] [PATCH 6/9] arm64: mvebu: Enable SDHCI/MMC support for the db-88f3720 Stefan Roese
2017-01-19  7:39   ` [U-Boot] [PATCH 7/9] arm64: mvebu: Armada 7k/8k: Add SDHCI device tree nodes Stefan Roese
2017-01-19  7:39   ` [U-Boot] [PATCH 8/9] arm64: mvebu: Armada 7040-db: " Stefan Roese
2017-01-19  7:39   ` [U-Boot] [PATCH 9/9] arm64: mvebu: Enable SDHCI/MMC support for the db-88f7040/8040 Stefan Roese
2017-01-24  6:55   ` [U-Boot] [PATCH 1/9] mmc: sdhci: Clear SDHCI_CLOCK_CONTROL before configuring the new value Jaehoon Chung
2017-01-25  7:43   ` Stefan Roese

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=20170119073941.8057-1-sr@denx.de \
    --to=sr@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