fsl_esdhc fixes
cover fsl_esdhc fixes
These are some various fsl_esdhc fixes that we've had around for some time to get SDHC/MMC working on various boards.
- k
PATCH 1/3 fsl_esdhc: Use mmc_set_clock to set initial speed
From: Jerry Huang <[email protected]>
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.
--- drivers/mmc/fsl_esdhc.c | 2 +- include/mmc.h | 1 + 2 files changed, 2 insertions(+), 1 deletions(-)
drivers/mmc/fsl_esdhc.c +1 -1
@@ -398,7 +398,7 @@ static int esdhc_init(struct mmc *mmc)esdhc_write32 (®s->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 (®s->irqstaten,IRQSTATEN_BRR |IRQSTATEN_BWR );
include/mmc.h +1 -0
@@ -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);
Signature · 1 line
1.7.2.3
PATCH 2/3 fsl_esdhc: Fix max clock frequency
From: Jerry Huang <[email protected]>
The max clock of MMC is 52MHz
--- drivers/mmc/fsl_esdhc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/fsl_esdhc.c +1 -1
@@ -477,7 +477,7 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg) mmc->host_caps |= MMC_MODE_HS_52MHz |MMC_MODE_HS ; mmc->f_min =400000 ; - mmc->f_max =MIN (gd->sdhc_clk,50000000 ); + mmc->f_max =MIN (gd->sdhc_clk,52000000 );mmc_register (mmc);
Signature · 1 line
1.7.2.3
PATCH 3/3 fsl_esdhc: Fix the voltage validation process
From: Li Yang <[email protected]>
The current code use all the voltage range support by the host controller to do the validation. This will cause problem when the host supports Low Voltage Range. Change the validation voltage to be based on board setup.
--- drivers/mmc/fsl_esdhc.c | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-)
drivers/mmc/fsl_esdhc.c +15 -5
@@ -444,7 +444,7 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg) {struct fsl_esdhc *regs;struct mmc *mmc; -u32 caps; +u32 caps, voltage_caps;if (!cfg)return -1 ;
@@ -462,14 +462,24 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg) mmc->set_ios = esdhc_set_ios; mmc->init = esdhc_init; + voltage_caps =0 ; caps = regs->hostcapblt; -if (caps &ESDHC_HOSTCAPBLT_VS18 ) - mmc->voltages |=MMC_VDD_165_195 ; + voltage_caps |=MMC_VDD_165_195 ;if (caps &ESDHC_HOSTCAPBLT_VS30 ) - mmc->voltages |=MMC_VDD_29_30 |MMC_VDD_30_31 ; + voltage_caps |=MMC_VDD_29_30 |MMC_VDD_30_31 ;if (caps &ESDHC_HOSTCAPBLT_VS33 ) - mmc->voltages |=MMC_VDD_32_33 |MMC_VDD_33_34 ; + voltage_caps |=MMC_VDD_32_33 |MMC_VDD_33_34 ; + +#ifdef CONFIG_SYS_SD_VOLTAGE + mmc->voltages =CONFIG_SYS_SD_VOLTAGE ; +#else + mmc->voltages =MMC_VDD_32_33 |MMC_VDD_33_34 ; +#endif +if ((mmc->voltages & voltage_caps) ==0 ) { +printf ("voltage not supported by controller\n" ); +return -1 ; + } mmc->host_caps =MMC_MODE_4BIT |MMC_MODE_8BIT ;
Signature · 1 line
1.7.2.3
PATCH 3/3 fsl_esdhc: Fix the voltage validation process
Quoted 9 lines · Kumar Gala
From: Li Yang <[email protected]>
The current code use all the voltage range support by the host controller to do the validation. This will cause problem when the host supports Low Voltage Range. Change the validation voltage to be based on board setup.
Signed-off-by Li Yang <[email protected]>---
Regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH 2/3 fsl_esdhc: Fix max clock frequency
In reply to Kumar GalaQuoted 6 lines · Kumar Gala
From: Jerry Huang <[email protected]>
The max clock of MMC is 52MHz
Signed-off-by Jerry Huang <[email protected]>---
It runs successfully on i.MX51.
Regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH 1/3 fsl_esdhc: Use mmc_set_clock to set initial speed
In reply to Kumar GalaQuoted 7 lines · Kumar Gala
From: Jerry Huang <[email protected]>
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.
Quoted 6 lines
Therefore, we use
mmc_set_clockto setup both the data structure and HW to the initial clock speed of 400000Hz.Signed-off-by Jerry Huang <[email protected]>Signed-off-by Kumar Gala <[email protected]>---
Tested on i.MX51, too.
Regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
cover fsl_esdhc fixes
In reply to Kumar GalaQuoted 2 lines · Kumar Gala
These are some various
fsl_esdhcfixes that we've had around for some time to get SDHC/MMC working on various boards.
Stefano,
Can you take a look at what if any impact these have on the imx side.
thanks
- k
cover fsl_esdhc fixes
Quoted 10 lines · Kumar Gala
Quoted 2 lines · Kumar Gala
These are some various
fsl_esdhcfixes that we've had around for some time to get SDHC/MMC working on various boards.Stefano,
Can you take a look at what if any impact these have on the imx side.
Hi Kumar,
I have tested successfully your patches on a i.MX51 target. I will send now my tested-by.
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================