mmc: exynos_dw_mmc: add tizen specific bind codes
authorJaehoon Chung <jh80.chung@samsung.com>
Mon, 18 Nov 2019 11:32:11 +0000 (20:32 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Tue, 20 Oct 2020 06:13:48 +0000 (15:13 +0900)
Add tizen specific bind codes.
Device number is defined according to boot from SD or eMMC.

Change-Id: I05876b0600d2e19e2642fd46742183d0d8cbe5c4
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
drivers/mmc/exynos_dw_mmc.c

index b960f72..2a32bbe 100644 (file)
@@ -347,8 +347,44 @@ static int exynos_dwmmc_probe(struct udevice *dev)
 static int exynos_dwmmc_bind(struct udevice *dev)
 {
        struct exynos_mmc_plat *plat = dev_get_platdata(dev);
+#ifdef CONFIG_TIZEN_XU3
+       struct blk_desc *bdesc;
+       struct udevice *bdev;
+       int ret, devnum = -1;
+
+       ret = dev_read_alias_seq(dev, &devnum);
+       if (get_boot_mode() == BOOT_MODE_SD) {
+               if (devnum == 0)
+                       devnum = 1;
+               else if (devnum == 2)
+                       devnum = 0;
+       }
+
+       ret = blk_create_devicef(dev, "mmc_blk", "blk", IF_TYPE_MMC,
+                       devnum, 512, 0, &bdev);
+       if (ret) {
+               printf("Cannot create block device\n");
+               return ret;
+       }
+       bdesc = dev_get_uclass_platdata(bdev);
+       plat->mmc.cfg = &plat->cfg;
+       plat->mmc.priv = dev;
+
+       /* the following chunk was from mmc_register() */
 
+       /* Setup dsr related values */
+       plat->mmc.dsr_imp = 0;
+       plat->mmc.dsr = 0xffffffff;
+       /* Setup the universal parts of the block interface just once */
+       bdesc->removable = 1;
+
+       /* setup initial part type */
+       bdesc->part_type = plat->cfg.part_type;
+       plat->mmc.dev = dev;
+       return 0;
+#else
        return dwmci_bind(dev, &plat->mmc, &plat->cfg);
+#endif
 }
 
 static const struct udevice_id exynos_dwmmc_ids[] = {