mmc: s5p_sdhci: add Tizen specific bind codes 38/233838/4 accepted/tizen/unified/20200528.132817 submit/tizen/20200528.065747
authorMarek Szyprowski <m.szyprowski@samsung.com>
Tue, 19 May 2020 12:46:43 +0000 (14:46 +0200)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Sat, 23 May 2020 06:10:17 +0000 (15:10 +0900)
Add Tizen specific bind codes for OdroidU3. When device is booted from SD,
SDHCI MMC controller is registered as MMC0, like it is done for DWMMC for OdroidXU3.
Based on commit 76f4fcf ("mmc: exynos_dw_mmc: add tizen specific bind codes").

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I624be4f0c6f7b1ce5a392249d73e36785649fd35

drivers/mmc/exynos_dw_mmc.c
drivers/mmc/s5p_sdhci.c

index f280b550c8c67e7afe67cf94f2b9dfab7bcf5812..5aef4d3f65542bec03a9b3930c7a653669be012f 100644 (file)
@@ -305,7 +305,7 @@ 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
+#if defined(CONFIG_TIZEN_XU3) || defined(CONFIG_TARGET_TIZEN)
        struct blk_desc *bdesc;
        struct udevice *bdev;
        int ret, devnum = -1;
index b5fe828dd60a566337f2a4403300cdc9507d149a..e0d2bfe4b62a2487c4b230c0c591eb9956e2b25f 100644 (file)
@@ -15,6 +15,7 @@
 #include <asm/arch/clk.h>
 #include <errno.h>
 #include <asm/arch/pinmux.h>
+#include <asm/arch/power.h>
 
 #ifdef CONFIG_DM_MMC
 struct s5p_sdhci_plat {
@@ -225,11 +226,41 @@ static int s5p_sdhci_bind(struct udevice *dev)
 {
        struct s5p_sdhci_plat *plat = dev_get_platdata(dev);
        int ret;
+#ifdef CONFIG_TARGET_TIZEN
+       struct blk_desc *bdesc;
+       struct udevice *bdev;
+       int devnum = -1;
 
+       ret = dev_read_alias_seq(dev, &devnum);
+       if (get_boot_mode() == BOOT_MODE_SD)
+               devnum = 0;
+
+       ret = blk_create_devicef(dev, "mmc_blk", "blk", IF_TYPE_MMC,
+                       devnum, 512, 0, &bdev);
+       if (ret) {
+               debug("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;
+#else
        ret = sdhci_bind(dev, &plat->mmc, &plat->cfg);
        if (ret)
                return ret;
-
+#endif
        return 0;
 }