drivers: esdhc: add support for coldfire mcf5441x family
PATCH 1/1 drivers: esdhc: add support for coldfire mcf5441x family
Signed-off-by Angelo Dureghello <[email protected]>
--- drivers/mmc/fsl_esdhc.c | 21 ++++++++++++++++----- include/fsl_esdhc.h | 1 + 2 files changed, 17 insertions(+), 5 deletions(-)
drivers/mmc/fsl_esdhc.c +16 -5
@@ -26,6 +26,12 @@DECLARE_GLOBAL_DATA_PTR ; +#ifdef CONFIG_MCF5441x +#ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO +#define CONFIG_SYS_FSL_ESDHC_USE_PIO +#endif +#endif +#define SDHCI_IRQ_EN_BITS (IRQSTATEN_CC | IRQSTATEN_TC | \ IRQSTATEN_CINT | \ IRQSTATEN_CTOE | IRQSTATEN_CCE | IRQSTATEN_CEBE | \
@@ -399,7 +405,6 @@ static int esdhc_send_cmd_common(struct fsl_esdhc_priv *priv, struct mmc *mmc,if (cmd->cmdidx ==MMC_CMD_STOP_TRANSMISSION )return 0 ;#endif -esdhc_write32 (®s->irqstat,-1 );sync ();
@@ -987,8 +992,12 @@ static int esdhc_init_common(struct fsl_esdhc_priv *priv, struct mmc *mmc)/* Disable the BRR and BWR bits in IRQSTAT */ esdhc_clrbits32 (®s->irqstaten,IRQSTATEN_BRR |IRQSTATEN_BWR ); +#ifdef CONFIG_MCF5441x +esdhc_write32 (®s->proctl,PROCTL_INIT |PROCTL_D3CD ); +#else /* Put the PROCTL reg back to the default */ esdhc_write32 (®s->proctl,PROCTL_INIT ); +#endif /* Set timout to the maximum value */ esdhc_clrsetbits32 (®s->sysctl,SYSCTL_TIMEOUT_MASK ,14 <<16 );
@@ -1014,7 +1023,6 @@ static int esdhc_getcd_common(struct fsl_esdhc_priv *priv)return dm_gpio_get_value (&priv->cd_gpio);#endif #endif -while (!(esdhc_read32 (®s->prsstat) &PRSSTAT_CINS ) && --timeout)udelay (1000 );
@@ -1112,11 +1120,16 @@ static int fsl_esdhc_init(struct fsl_esdhc_priv *priv,esdhc_setbits32 (®s->vendorspec,ESDHC_VENDORSPEC_VSELECT );writel (SDHCI_IRQ_EN_BITS , ®s->irqstaten); + +#ifdef CONFIG_MCF5441x +/* ColdFire, using SDHC_DATA[3] for card detection */ +esdhc_write32 (®s->proctl,esdhc_read32 (®s->proctl) |PROCTL_D3CD ); +#endif + cfg = &plat->cfg;#ifndef CONFIG_DM_MMC memset (cfg,'\0' ,sizeof (*cfg));#endif - voltage_caps =0 ; caps =esdhc_read32 (®s->hostcapblt);
@@ -1129,7 +1142,6 @@ static int fsl_esdhc_init(struct fsl_esdhc_priv *priv,#ifdef CONFIG_SYS_FSL_MMC_HAS_CAPBLT_VS33 caps = caps |ESDHC_HOSTCAPBLT_VS33 ;#endif -if (caps &ESDHC_HOSTCAPBLT_VS18 ) voltage_caps |=MMC_VDD_165_195 ;if (caps &ESDHC_HOSTCAPBLT_VS30 )
@@ -1150,7 +1162,6 @@ static int fsl_esdhc_init(struct fsl_esdhc_priv *priv,printf ("voltage not supported by controller\n" );return -1 ; } -if (priv->bus_width ==8 ) cfg->host_caps =MMC_MODE_4BIT |MMC_MODE_8BIT ;else if (priv->bus_width ==4 )
include/fsl_esdhc.h +1 -0
@@ -106,6 +106,7 @@#define PROCTL_INIT 0x00000020#define PROCTL_DTW_4 0x00000002#define PROCTL_DTW_8 0x00000004 +#define PROCTL_D3CD 0x00000008#define CMDARG 0x0002e008
Signature · 1 line
2.18.0
PATCH 1/1 drivers: esdhc: add support for coldfire mcf5441x family
Hi Antoniou,
plese trash this patch, found additional points,
will send a v2 in short.
Many thanks,
Angelo Dureghello