X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fmmc%2Fbcm2835_sdhci.c;h=29c2a85812fc4a0ad3a44f70d9caefd88d0af56b;hb=3b19c1dbe0464d1cdf3b3006042cc75bc439321f;hp=4ec2968ece203db94bfb59539ce531cb4775150e;hpb=9da7e3daf31d7c0c8478a57544bfdd6245e53ff3;p=u-boot diff --git a/drivers/mmc/bcm2835_sdhci.c b/drivers/mmc/bcm2835_sdhci.c index 4ec2968ece..29c2a85812 100644 --- a/drivers/mmc/bcm2835_sdhci.c +++ b/drivers/mmc/bcm2835_sdhci.c @@ -69,11 +69,11 @@ static inline void bcm2835_sdhci_raw_writel(struct sdhci_host *host, u32 val, * (Which is just as well - otherwise we'd have to nobble the DMA engine * too) */ - while (get_timer_us(bcm_host->last_write) < bcm_host->twoticks_delay) + while (timer_get_us() - bcm_host->last_write < bcm_host->twoticks_delay) ; writel(val, host->ioaddr + reg); - bcm_host->last_write = get_timer_us(0); + bcm_host->last_write = timer_get_us(); } static inline u32 bcm2835_sdhci_raw_readl(struct sdhci_host *host, int reg) @@ -154,10 +154,10 @@ int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq) struct bcm2835_sdhci_host *bcm_host; struct sdhci_host *host; - bcm_host = malloc(sizeof(*bcm_host)); + bcm_host = calloc(1, sizeof(*bcm_host)); if (!bcm_host) { - printf("sdhci_host malloc fail!\n"); - return 1; + printf("sdhci_host calloc fail!\n"); + return -ENOMEM; } /* @@ -178,14 +178,14 @@ int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq) host = &bcm_host->host; host->name = "bcm2835_sdhci"; - host->ioaddr = (void *)regbase; + host->ioaddr = (void *)(unsigned long)regbase; host->quirks = SDHCI_QUIRK_BROKEN_VOLTAGE | SDHCI_QUIRK_BROKEN_R1B | SDHCI_QUIRK_WAIT_SEND_CMD | SDHCI_QUIRK_NO_HISPD_BIT; + host->max_clk = emmc_freq; host->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195; host->ops = &bcm2835_ops; - host->version = sdhci_readw(host, SDHCI_HOST_VERSION); - add_sdhci(host, emmc_freq, MIN_FREQ); + add_sdhci(host, 0, MIN_FREQ); return 0; }