emmc: refixed how to get host->data variable in M8bab
authorLong Yu <long.yu@amlogic.com>
Mon, 25 Dec 2017 08:56:21 +0000 (16:56 +0800)
committerLong Yu <long.yu@amlogic.com>
Mon, 25 Dec 2017 08:56:35 +0000 (16:56 +0800)
PD#154260: emmc: refixed how to get host->data variable for M8b

    1. refixed how to get host->data variable

    2. Compatible m8b and 905

Change-Id: I647fb191f71a3a4b6b63eee29be1a91e6581af12
Signed-off-by: Long Yu <long.yu@amlogic.com>
drivers/amlogic/mmc/aml_sdhc_m8.c
drivers/amlogic/mmc/aml_sdio.c
drivers/amlogic/mmc/amlsd_of.c

index 341fb1e..4e38457 100644 (file)
@@ -2253,6 +2253,7 @@ static int aml_sdhc_probe(struct platform_device *pdev)
                of_device_get_match_data(&pdev->dev);
        if (!host->data) {
                ret = -EINVAL;
+               pr_info("host->data null\n");
                goto probe_free_host;
        }
 
@@ -2420,9 +2421,14 @@ int aml_sdhc_remove(struct platform_device *pdev)
        return 0;
 }
 
+static struct meson_mmc_data mmc_data_m8b = {
+       .chip_type = MMC_CHIP_M8B,
+};
+
 static const struct of_device_id aml_sdhc_dt_match[] = {
        {
                .compatible = "amlogic, aml_sdhc",
+               .data = &mmc_data_m8b,
        },
        {},
 };
index 0487d01..e2269e5 100644 (file)
@@ -1335,9 +1335,14 @@ fail_init_host:
                return 0;
        }
 
+       static struct meson_mmc_data mmc_data_m8b = {
+               .chip_type = MMC_CHIP_M8B,
+       };
+
        static const struct of_device_id aml_sdio_dt_match[] = {
                {
                        .compatible = "amlogic, aml_sdio",
+                       .data = &mmc_data_m8b,
                },
                {},
        };
index b0f224b..03fd717 100644 (file)
@@ -126,14 +126,16 @@ int amlsd_get_platform_data(struct platform_device *pdev,
        struct device_node *child;
        u32 i, prop;
        const char *str = "none";
-       struct amlsd_host *host = mmc_priv(mmc);
+       struct amlsd_host *host = NULL;
 
 #ifdef CONFIG_AMLOGIC_M8B_MMC
        of_node = pdev->dev.of_node;
+       host = platform_get_drvdata(pdev);
 #else
        if (!mmc->parent)
                return 0;
        of_node = mmc->parent->of_node;
+       host = mmc_priv(mmc);
 #endif
        if (of_node) {
                child = of_node->child;