0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <linux/gpio.h>
0012 #include <linux/platform_device.h>
0013 #include <linux/platform_data/gpio-omap.h>
0014 #include <linux/mfd/tps65010.h>
0015
0016 #include "board-h2.h"
0017 #include "mmc.h"
0018
0019 #if IS_ENABLED(CONFIG_MMC_OMAP)
0020
0021 static int mmc_set_power(struct device *dev, int slot, int power_on,
0022 int vdd)
0023 {
0024 gpio_set_value(H2_TPS_GPIO_MMC_PWR_EN, power_on);
0025 return 0;
0026 }
0027
0028 static int mmc_late_init(struct device *dev)
0029 {
0030 int ret = gpio_request(H2_TPS_GPIO_MMC_PWR_EN, "MMC power");
0031 if (ret < 0)
0032 return ret;
0033
0034 gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 0);
0035
0036 return ret;
0037 }
0038
0039 static void mmc_cleanup(struct device *dev)
0040 {
0041 gpio_free(H2_TPS_GPIO_MMC_PWR_EN);
0042 }
0043
0044
0045
0046
0047
0048
0049 static struct omap_mmc_platform_data mmc1_data = {
0050 .nr_slots = 1,
0051 .init = mmc_late_init,
0052 .cleanup = mmc_cleanup,
0053 .slots[0] = {
0054 .set_power = mmc_set_power,
0055 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
0056 .name = "mmcblk",
0057 },
0058 };
0059
0060 static struct omap_mmc_platform_data *mmc_data[OMAP16XX_NR_MMC];
0061
0062 void __init h2_mmc_init(void)
0063 {
0064 mmc_data[0] = &mmc1_data;
0065 omap1_init_mmc(mmc_data, OMAP16XX_NR_MMC);
0066 }
0067
0068 #else
0069
0070 void __init h2_mmc_init(void)
0071 {
0072 }
0073
0074 #endif