diff options
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/arm_pl180_mmci.c | 2 | ||||
-rw-r--r-- | drivers/mmc/bcm2835_sdhost.c | 2 | ||||
-rw-r--r-- | drivers/mmc/gen_atmel_mci.c | 2 | ||||
-rw-r--r-- | drivers/mmc/mmc-uclass.c | 2 | ||||
-rw-r--r-- | drivers/mmc/rockchip_dw_mmc.c | 2 | ||||
-rw-r--r-- | drivers/mmc/rockchip_sdhci.c | 1 | ||||
-rw-r--r-- | drivers/mmc/sandbox_mmc.c | 2 | ||||
-rw-r--r-- | drivers/mmc/stm32_sdmmc2.c | 2 | ||||
-rw-r--r-- | drivers/mmc/sunxi_mmc.c | 35 | ||||
-rw-r--r-- | drivers/mmc/tegra_mmc.c | 2 |
10 files changed, 20 insertions, 32 deletions
diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c index 89a7c19242..8664a373a1 100644 --- a/drivers/mmc/arm_pl180_mmci.c +++ b/drivers/mmc/arm_pl180_mmci.c @@ -25,8 +25,6 @@ #ifdef CONFIG_DM_MMC #include <dm.h> -DECLARE_GLOBAL_DATA_PTR; - #define MMC_CLOCK_MAX 48000000 #define MMC_CLOCK_MIN 400000 diff --git a/drivers/mmc/bcm2835_sdhost.c b/drivers/mmc/bcm2835_sdhost.c index bccd182e50..752c660ea7 100644 --- a/drivers/mmc/bcm2835_sdhost.c +++ b/drivers/mmc/bcm2835_sdhost.c @@ -44,8 +44,6 @@ #include <mach/gpio.h> #include <power/regulator.h> -DECLARE_GLOBAL_DATA_PTR; - #define msleep(a) udelay(a * 1000) #define SDCMD 0x00 /* Command to SD card - 16 R/W */ diff --git a/drivers/mmc/gen_atmel_mci.c b/drivers/mmc/gen_atmel_mci.c index 1c108b5470..186b3d7dbf 100644 --- a/drivers/mmc/gen_atmel_mci.c +++ b/drivers/mmc/gen_atmel_mci.c @@ -22,8 +22,6 @@ #include <asm/arch/hardware.h> #include "atmel_mci.h" -DECLARE_GLOBAL_DATA_PTR; - #ifndef CONFIG_SYS_MMC_CLK_OD # define CONFIG_SYS_MMC_CLK_OD 150000 #endif diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index a3536b15ae..0481e276c0 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -12,8 +12,6 @@ #include <dm/lists.h> #include "mmc_private.h" -DECLARE_GLOBAL_DATA_PTR; - int dm_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, struct mmc_data *data) { diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c index 807dc9e72f..4ba1436159 100644 --- a/drivers/mmc/rockchip_dw_mmc.c +++ b/drivers/mmc/rockchip_dw_mmc.c @@ -18,8 +18,6 @@ #include <asm/arch/periph.h> #include <linux/err.h> -DECLARE_GLOBAL_DATA_PTR; - struct rockchip_mmc_plat { #if CONFIG_IS_ENABLED(OF_PLATDATA) struct dtd_rockchip_rk3288_dw_mshc dtplat; diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c index ab89be4764..8868f341f3 100644 --- a/drivers/mmc/rockchip_sdhci.c +++ b/drivers/mmc/rockchip_sdhci.c @@ -15,7 +15,6 @@ #include <sdhci.h> #include <clk.h> -DECLARE_GLOBAL_DATA_PTR; /* 400KHz is max freq for card ID etc. Use that as min */ #define EMMC_MIN_FREQ 400000 diff --git a/drivers/mmc/sandbox_mmc.c b/drivers/mmc/sandbox_mmc.c index 8a5d256c11..0945beb368 100644 --- a/drivers/mmc/sandbox_mmc.c +++ b/drivers/mmc/sandbox_mmc.c @@ -12,8 +12,6 @@ #include <mmc.h> #include <asm/test.h> -DECLARE_GLOBAL_DATA_PTR; - struct sandbox_mmc_plat { struct mmc_config cfg; struct mmc mmc; diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c index f5b21dd097..47afa263ea 100644 --- a/drivers/mmc/stm32_sdmmc2.c +++ b/drivers/mmc/stm32_sdmmc2.c @@ -189,8 +189,6 @@ struct stm32_sdmmc2_ctx { #define SDMMC_CMD_TIMEOUT 0xFFFFFFFF -DECLARE_GLOBAL_DATA_PTR; - static void stm32_sdmmc2_start_data(struct stm32_sdmmc2_priv *priv, struct mmc_data *data, struct stm32_sdmmc2_ctx *ctx) diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c index df6f32850e..5292f2d3cc 100644 --- a/drivers/mmc/sunxi_mmc.c +++ b/drivers/mmc/sunxi_mmc.c @@ -147,19 +147,19 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz) oclk_dly = 0; sclk_dly = 5; #ifdef CONFIG_MACH_SUN9I - } else if (hz <= 50000000) { + } else if (hz <= 52000000) { oclk_dly = 5; sclk_dly = 4; } else { - /* hz > 50000000 */ + /* hz > 52000000 */ oclk_dly = 2; sclk_dly = 4; #else - } else if (hz <= 50000000) { + } else if (hz <= 52000000) { oclk_dly = 3; sclk_dly = 4; } else { - /* hz > 50000000 */ + /* hz > 52000000 */ oclk_dly = 1; sclk_dly = 4; #endif @@ -188,15 +188,16 @@ static int mmc_update_clk(struct sunxi_mmc_priv *priv) { unsigned int cmd; unsigned timeout_msecs = 2000; + unsigned long start = get_timer(0); cmd = SUNXI_MMC_CMD_START | SUNXI_MMC_CMD_UPCLK_ONLY | SUNXI_MMC_CMD_WAIT_PRE_OVER; + writel(cmd, &priv->reg->cmd); while (readl(&priv->reg->cmd) & SUNXI_MMC_CMD_START) { - if (!timeout_msecs--) + if (get_timer(start) > timeout_msecs) return -1; - udelay(1000); } /* clock update sets various irq status bits, clear these */ @@ -277,18 +278,21 @@ static int mmc_trans_data_by_cpu(struct sunxi_mmc_priv *priv, struct mmc *mmc, unsigned i; unsigned *buff = (unsigned int *)(reading ? data->dest : data->src); unsigned byte_cnt = data->blocksize * data->blocks; - unsigned timeout_usecs = (byte_cnt >> 8) * 1000; - if (timeout_usecs < 2000000) - timeout_usecs = 2000000; + unsigned timeout_msecs = byte_cnt >> 8; + unsigned long start; + + if (timeout_msecs < 2000) + timeout_msecs = 2000; /* Always read / write data through the CPU */ setbits_le32(&priv->reg->gctrl, SUNXI_MMC_GCTRL_ACCESS_BY_AHB); + start = get_timer(0); + for (i = 0; i < (byte_cnt >> 2); i++) { while (readl(&priv->reg->status) & status_bit) { - if (!timeout_usecs--) + if (get_timer(start) > timeout_msecs) return -1; - udelay(1); } if (reading) @@ -304,16 +308,16 @@ static int mmc_rint_wait(struct sunxi_mmc_priv *priv, struct mmc *mmc, uint timeout_msecs, uint done_bit, const char *what) { unsigned int status; + unsigned long start = get_timer(0); do { status = readl(&priv->reg->rint); - if (!timeout_msecs-- || + if ((get_timer(start) > timeout_msecs) || (status & SUNXI_MMC_RINT_INTERRUPT_ERROR_BIT)) { debug("%s timeout %x\n", what, status & SUNXI_MMC_RINT_INTERRUPT_ERROR_BIT); return -ETIMEDOUT; } - udelay(1000); } while (!(status & done_bit)); return 0; @@ -405,15 +409,16 @@ static int sunxi_mmc_send_cmd_common(struct sunxi_mmc_priv *priv, } if (cmd->resp_type & MMC_RSP_BUSY) { + unsigned long start = get_timer(0); timeout_msecs = 2000; + do { status = readl(&priv->reg->status); - if (!timeout_msecs--) { + if (get_timer(start) > timeout_msecs) { debug("busy timeout\n"); error = -ETIMEDOUT; goto out; } - udelay(1000); } while (status & SUNXI_MMC_STATUS_CARD_DATA_BUSY); } diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c index 74745296b4..ee63166e55 100644 --- a/drivers/mmc/tegra_mmc.c +++ b/drivers/mmc/tegra_mmc.c @@ -16,8 +16,6 @@ #include <asm/io.h> #include <asm/arch-tegra/tegra_mmc.h> -DECLARE_GLOBAL_DATA_PTR; - struct tegra_mmc_plat { struct mmc_config cfg; struct mmc mmc; |