2 * linux/arch/arm/mach-s5pv310/board-storage.c
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/platform_device.h>
12 #include <linux/mmc/host.h>
14 #include <mach/gpio.h>
16 #include <plat/devs.h>
17 #include <plat/gpio-cfg.h>
18 #include <plat/sdhci.h>
21 #include "gpio-mobile.h"
24 #ifndef CONFIG_S3C_DEV_HSMMC4
25 static struct s3c_sdhci_platdata hsmmc0_data __initdata = {
27 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
28 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
29 MMC_CAP_DISABLE | MMC_CAP_ERASE),
30 .cd_type = S3C_SDHCI_CD_PERMANENT,
31 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
36 static struct s3c_sdhci_platdata hsmmc2_data __initdata = {
38 .host_caps = MMC_CAP_4_BIT_DATA |
39 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
41 .ext_cd_gpio = S5PV310_GPX3(4), /* XEINT_28 */
42 .ext_cd_gpio_invert = 1,
44 .cd_type = S3C_SDHCI_CD_GPIO,
45 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
49 static void (*wlan_notify_change_cb)(struct platform_device *dev, int state);
51 static int wlan_ext_cd_init(void (*cb)(struct platform_device *dev, int state))
53 wlan_notify_change_cb = cb;
57 static int wlan_ext_cd_cleanup(void (*cb)(struct platform_device *dev, int state))
59 wlan_notify_change_cb = NULL;
63 int wlan_host_enable(int on)
65 if (wlan_notify_change_cb)
66 (*wlan_notify_change_cb)(&s3c_device_hsmmc3, on);
70 static struct s3c_sdhci_platdata hsmmc3_data __initdata = {
72 .host_caps = (MMC_CAP_4_BIT_DATA |
73 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
74 .pm_caps = MMC_PM_KEEP_POWER,
75 .cd_type = S3C_SDHCI_CD_EXTERNAL,
76 .ext_cd_init = &wlan_ext_cd_init,
77 .ext_cd_cleanup = &wlan_ext_cd_cleanup,
78 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
81 void __init s5pv310_sdhci_init(void)
85 #ifndef CONFIG_S3C_DEV_HSMMC4
86 s3c_sdhci0_set_platdata(&hsmmc0_data);
88 s3c_sdhci3_set_platdata(&hsmmc3_data);
90 /* T-Flash card detect pin - XEINT_28 */
91 gpio = hsmmc2_data.ext_cd_gpio;
92 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
93 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
95 s3c_sdhci2_set_platdata(&hsmmc2_data);