Commit 5656ab99 authored by Rui Miguel Silva's avatar Rui Miguel Silva Committed by Greg Kroah-Hartman

greybus: sdio: fix defines for older kernels

Some of the options for mmc host, are not defined in older kernels.
MMC_CAP2_HS400_1_2V, MMC_CAP2_HS400_1_8V, MMC_TIMING_MMC_DDR52 and
MMC_TIMING_MMC_HS400.

To not use them for older versions.
Signed-off-by: default avatarRui Miguel Silva <rui.silva@linaro.org>
Tested-by: default avatarMark Greer <mgreer@animalcreek.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 730a2f6d
...@@ -127,4 +127,12 @@ static inline void sysfs_remove_groups(struct kobject *kobj, ...@@ -127,4 +127,12 @@ static inline void sysfs_remove_groups(struct kobject *kobj,
} }
#endif #endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
#define MMC_HS400_SUPPORTED
#define MMC_DDR52_DEFINED
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)
#define MMC_POWER_UNDEFINED_SUPPORTED
#endif
#endif /* __GREYBUS_KERNEL_VER_H */ #endif /* __GREYBUS_KERNEL_VER_H */
...@@ -62,9 +62,11 @@ static void _gb_sdio_set_host_caps(struct gb_sdio_host *host, u32 r) ...@@ -62,9 +62,11 @@ static void _gb_sdio_set_host_caps(struct gb_sdio_host *host, u32 r)
(r & GB_SDIO_CAP_DRIVER_TYPE_D ? MMC_CAP_DRIVER_TYPE_D : 0); (r & GB_SDIO_CAP_DRIVER_TYPE_D ? MMC_CAP_DRIVER_TYPE_D : 0);
caps2 = (r & GB_SDIO_CAP_HS200_1_2V ? MMC_CAP2_HS200_1_2V_SDR : 0) | caps2 = (r & GB_SDIO_CAP_HS200_1_2V ? MMC_CAP2_HS200_1_2V_SDR : 0) |
(r & GB_SDIO_CAP_HS200_1_8V ? MMC_CAP2_HS200_1_8V_SDR : 0) | #ifdef MMC_HS400_SUPPORTED
(r & GB_SDIO_CAP_HS400_1_2V ? MMC_CAP2_HS400_1_2V : 0) | (r & GB_SDIO_CAP_HS400_1_2V ? MMC_CAP2_HS400_1_2V : 0) |
(r & GB_SDIO_CAP_HS400_1_8V ? MMC_CAP2_HS400_1_8V : 0); (r & GB_SDIO_CAP_HS400_1_8V ? MMC_CAP2_HS400_1_8V : 0) |
#endif
(r & GB_SDIO_CAP_HS200_1_8V ? MMC_CAP2_HS200_1_8V_SDR : 0);
host->mmc->caps = caps; host->mmc->caps = caps;
host->mmc->caps2 = caps2; host->mmc->caps2 = caps2;
...@@ -478,6 +480,7 @@ static void gb_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -478,6 +480,7 @@ static void gb_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
switch (ios->power_mode) { switch (ios->power_mode) {
case MMC_POWER_OFF: case MMC_POWER_OFF:
default:
power_mode = GB_SDIO_POWER_OFF; power_mode = GB_SDIO_POWER_OFF;
break; break;
case MMC_POWER_UP: case MMC_POWER_UP:
...@@ -486,10 +489,11 @@ static void gb_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -486,10 +489,11 @@ static void gb_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
case MMC_POWER_ON: case MMC_POWER_ON:
power_mode = GB_SDIO_POWER_ON; power_mode = GB_SDIO_POWER_ON;
break; break;
#ifdef MMC_POWER_UNDEFINED_SUPPORTED
case MMC_POWER_UNDEFINED: case MMC_POWER_UNDEFINED:
default:
power_mode = GB_SDIO_POWER_UNDEFINED; power_mode = GB_SDIO_POWER_UNDEFINED;
break; break;
#endif
} }
request.power_mode = power_mode; request.power_mode = power_mode;
...@@ -533,15 +537,19 @@ static void gb_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -533,15 +537,19 @@ static void gb_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
case MMC_TIMING_UHS_DDR50: case MMC_TIMING_UHS_DDR50:
timing = GB_SDIO_TIMING_UHS_DDR50; timing = GB_SDIO_TIMING_UHS_DDR50;
break; break;
#ifdef MMC_DDR52_DEFINED
case MMC_TIMING_MMC_DDR52: case MMC_TIMING_MMC_DDR52:
timing = GB_SDIO_TIMING_MMC_DDR52; timing = GB_SDIO_TIMING_MMC_DDR52;
break; break;
#endif
case MMC_TIMING_MMC_HS200: case MMC_TIMING_MMC_HS200:
timing = GB_SDIO_TIMING_MMC_HS200; timing = GB_SDIO_TIMING_MMC_HS200;
break; break;
#ifdef MMC_HS400_SUPPORTED
case MMC_TIMING_MMC_HS400: case MMC_TIMING_MMC_HS400:
timing = GB_SDIO_TIMING_MMC_HS400; timing = GB_SDIO_TIMING_MMC_HS400;
break; break;
#endif
} }
request.timing = timing; request.timing = timing;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment