]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/mmc/bfin_sdh.c
Merge branch 'u-boot-samsung/master' into 'u-boot-arm/master'
[karo-tx-uboot.git] / drivers / mmc / bfin_sdh.c
index 0f98b961fd4418b5ac676473a8ee9d0d0bd4671c..bcd6a3e52fd0d8fd7dbfca59278724f2046ba0db 100644 (file)
@@ -15,6 +15,7 @@
 #include <asm/errno.h>
 #include <asm/byteorder.h>
 #include <asm/blackfin.h>
+#include <asm/clock.h>
 #include <asm/portmux.h>
 #include <asm/mach-common/bits/sdh.h>
 #include <asm/mach-common/bits/dma.h>
@@ -273,29 +274,30 @@ static int bfin_sdh_init(struct mmc *mmc)
        return 0;
 }
 
+static const struct mmc_ops bfin_mmc_ops = {
+       .send_cmd       = bfin_sdh_request,
+       .set_ios        = bfin_sdh_set_ios,
+       .init           = bfin_sdh_init,
+};
+
+static struct mmc_config bfin_mmc_cfg = {
+       .name           = "Blackfin SDH",
+       .ops            = &bfin_mmc_ops,
+       .host_caps      = MMC_MODE_4BIT,
+       .voltages       = MMC_VDD_32_33 | MMC_VDD_33_34,
+       .b_max          = CONFIG_SYS_MMC_MAX_BLK_COUNT,
+};
 
 int bfin_mmc_init(bd_t *bis)
 {
-       struct mmc *mmc = NULL;
-
-       mmc = malloc(sizeof(struct mmc));
-
-       if (!mmc)
-               return -ENOMEM;
-       sprintf(mmc->name, "Blackfin SDH");
-       mmc->send_cmd = bfin_sdh_request;
-       mmc->set_ios = bfin_sdh_set_ios;
-       mmc->init = bfin_sdh_init;
-       mmc->getcd = NULL;
-       mmc->host_caps = MMC_MODE_4BIT;
-
-       mmc->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
-       mmc->f_max = get_sclk();
-       mmc->f_min = mmc->f_max >> 9;
+       struct mmc *mmc;
 
-       mmc->b_max = 0;
+       bfin_mmc_cfg.f_max = get_sclk();
+       bfin_mmc_cfg.f_min = bfin_mmc_cfg.f_max >> 9;
 
-       mmc_register(mmc);
+       mmc = mmc_create(&bfin_mmc_cfg, NULL);
+       if (mmc == NULL)
+               return -1;
 
        return 0;
 }