]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - drivers/mmc/fsl_esdhc.c
mmc: remove hc_wp_grp_size from struct mmc if not needed
[people/ms/u-boot.git] / drivers / mmc / fsl_esdhc.c
index 0f51d0d896b1f1fcccd70c4b9234a380aee8dd57..cca57f8a79dbc48b75f0b5063751fd65465aec8d 100644 (file)
@@ -171,20 +171,20 @@ static void esdhc_pio_read_write(struct fsl_esdhc_priv *priv,
        uint databuf;
        uint size;
        uint irqstat;
-       uint timeout;
+       ulong start;
 
        if (data->flags & MMC_DATA_READ) {
                blocks = data->blocks;
                buffer = data->dest;
                while (blocks) {
-                       timeout = PIO_TIMEOUT;
+                       start = get_timer(0);
                        size = data->blocksize;
                        irqstat = esdhc_read32(&regs->irqstat);
-                       while (!(esdhc_read32(&regs->prsstat) & PRSSTAT_BREN)
-                               && --timeout);
-                       if (timeout <= 0) {
-                               printf("\nData Read Failed in PIO Mode.");
-                               return;
+                       while (!(esdhc_read32(&regs->prsstat) & PRSSTAT_BREN)) {
+                               if (get_timer(start) > PIO_TIMEOUT) {
+                                       printf("\nData Read Failed in PIO Mode.");
+                                       return;
+                               }
                        }
                        while (size && (!(irqstat & IRQSTAT_TC))) {
                                udelay(100); /* Wait before last byte transfer complete */
@@ -200,14 +200,14 @@ static void esdhc_pio_read_write(struct fsl_esdhc_priv *priv,
                blocks = data->blocks;
                buffer = (char *)data->src;
                while (blocks) {
-                       timeout = PIO_TIMEOUT;
+                       start = get_timer(0);
                        size = data->blocksize;
                        irqstat = esdhc_read32(&regs->irqstat);
-                       while (!(esdhc_read32(&regs->prsstat) & PRSSTAT_BWEN)
-                               && --timeout);
-                       if (timeout <= 0) {
-                               printf("\nData Write Failed in PIO Mode.");
-                               return;
+                       while (!(esdhc_read32(&regs->prsstat) & PRSSTAT_BWEN)) {
+                               if (get_timer(start) > PIO_TIMEOUT) {
+                                       printf("\nData Write Failed in PIO Mode.");
+                                       return;
+                               }
                        }
                        while (size && (!(irqstat & IRQSTAT_TC))) {
                                udelay(100); /* Wait before last byte transfer complete */
@@ -665,7 +665,7 @@ static int esdhc_init_common(struct fsl_esdhc_priv *priv, struct mmc *mmc)
 #endif
 
        /* Set the initial clock speed */
-       mmc_set_clock(mmc, 400000);
+       mmc_set_clock(mmc, 400000, false);
 
        /* Disable the BRR and BWR bits in IRQSTAT */
        esdhc_clrbits32(&regs->irqstaten, IRQSTATEN_BRR | IRQSTATEN_BWR);
@@ -726,7 +726,7 @@ static int esdhc_reset(struct fsl_esdhc *regs)
        return 0;
 }
 
-#if !CONFIG_IS_ENABLED(DM_MMC_OPS)
+#if !CONFIG_IS_ENABLED(DM_MMC)
 static int esdhc_getcd(struct mmc *mmc)
 {
        struct fsl_esdhc_priv *priv = mmc->priv;
@@ -820,7 +820,7 @@ static int fsl_esdhc_init(struct fsl_esdhc_priv *priv,
                voltage_caps |= MMC_VDD_32_33 | MMC_VDD_33_34;
 
        cfg->name = "FSL_SDHC";
-#if !CONFIG_IS_ENABLED(DM_MMC_OPS)
+#if !CONFIG_IS_ENABLED(DM_MMC)
        cfg->ops = &esdhc_ops;
 #endif
 #ifdef CONFIG_SYS_SD_VOLTAGE
@@ -866,7 +866,7 @@ static int fsl_esdhc_init(struct fsl_esdhc_priv *priv,
        return 0;
 }
 
-#ifndef CONFIG_DM_MMC
+#if !CONFIG_IS_ENABLED(DM_MMC)
 static int fsl_esdhc_cfg_to_priv(struct fsl_esdhc_cfg *cfg,
                                 struct fsl_esdhc_priv *priv)
 {
@@ -1127,7 +1127,7 @@ static int fsl_esdhc_probe(struct udevice *dev)
        return esdhc_init_common(priv, mmc);
 }
 
-#if CONFIG_IS_ENABLED(DM_MMC_OPS)
+#if CONFIG_IS_ENABLED(DM_MMC)
 static int fsl_esdhc_get_cd(struct udevice *dev)
 {
        struct fsl_esdhc_priv *priv = dev_get_priv(dev);
@@ -1184,9 +1184,7 @@ U_BOOT_DRIVER(fsl_esdhc) = {
        .name   = "fsl-esdhc-mmc",
        .id     = UCLASS_MMC,
        .of_match = fsl_esdhc_ids,
-#if CONFIG_IS_ENABLED(DM_MMC_OPS)
        .ops    = &fsl_esdhc_ops,
-#endif
 #if CONFIG_IS_ENABLED(BLK)
        .bind   = fsl_esdhc_bind,
 #endif