[U-Boot,1/3] fsl_esdhc: Use mmc_set_clock to set initial speed

Submitted by Kumar Gala on Dec. 15, 2010, 8:20 a.m.

Details

Message ID 1292401217-21154-2-git-send-email-galak@kernel.crashing.org
State Accepted
Delegated to: Andy Fleming
Headers show

Commit Message

Kumar Gala Dec. 15, 2010, 8:20 a.m.
From: Jerry Huang <Chang-Ming.Huang@freescale.com>

After booting the u-boot, and first using some SD card (such as Sandisk 2G SD
card), because the field 'clock' of struct mmc is zero, this will cause
the read transfer is always active and SDHC DATA line is always active,
therefore, driver can't handle the next command.

Therefore, we use mmc_set_clock to setup both the data structure and HW
to the initial clock speed of 400000Hz.

Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 drivers/mmc/fsl_esdhc.c |    2 +-
 include/mmc.h           |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

Comments

Stefano Babic Dec. 16, 2010, 5:40 p.m.
On 12/15/2010 09:20 AM, Kumar Gala wrote:
> From: Jerry Huang <Chang-Ming.Huang@freescale.com>
> 
> After booting the u-boot, and first using some SD card (such as Sandisk 2G SD
> card), because the field 'clock' of struct mmc is zero, this will cause
> the read transfer is always active and SDHC DATA line is always active,
> therefore, driver can't handle the next command.
> 
> Therefore, we use mmc_set_clock to setup both the data structure and HW
> to the initial clock speed of 400000Hz.
> 
> Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> ---

Tested on i.MX51, too.

Tested-by: Stefano Babic <sbabic@denx.de>

Regards,
Stefano Babic

Patch hide | download patch | download mbox

diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index 57cd4ee..73d5cd3 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -398,7 +398,7 @@  static int esdhc_init(struct mmc *mmc)
 	esdhc_write32(&regs->sysctl, SYSCTL_HCKEN | SYSCTL_IPGEN);
 
 	/* Set the initial clock speed */
-	set_sysctl(mmc, 400000);
+	mmc_set_clock(mmc, 400000);
 
 	/* Disable the BRR and BWR bits in IRQSTAT */
 	esdhc_clrbits32(&regs->irqstaten, IRQSTATEN_BRR | IRQSTATEN_BWR);
diff --git a/include/mmc.h b/include/mmc.h
index 9f94f42..cc4aa36 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -280,6 +280,7 @@  int mmc_register(struct mmc *mmc);
 int mmc_initialize(bd_t *bis);
 int mmc_init(struct mmc *mmc);
 int mmc_read(struct mmc *mmc, u64 src, uchar *dst, int size);
+void mmc_set_clock(struct mmc *mmc, uint clock);
 struct mmc *find_mmc_device(int dev_num);
 int mmc_set_dev(int dev_num);
 void print_mmc_devices(char separator);