diff options
Diffstat (limited to 'arch/arm/mach-omap2/msdi.c')
-rw-r--r-- | arch/arm/mach-omap2/msdi.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/msdi.c b/arch/arm/mach-omap2/msdi.c index ef2a6924731a..fb5bc6cf3773 100644 --- a/arch/arm/mach-omap2/msdi.c +++ b/arch/arm/mach-omap2/msdi.c | |||
@@ -22,11 +22,15 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
25 | #include <linux/err.h> | ||
25 | 26 | ||
26 | #include <plat/omap_hwmod.h> | 27 | #include <plat/omap_hwmod.h> |
28 | #include <plat/omap_device.h> | ||
27 | #include <plat/mmc.h> | 29 | #include <plat/mmc.h> |
28 | 30 | ||
29 | #include "common.h" | 31 | #include "common.h" |
32 | #include "control.h" | ||
33 | #include "mux.h" | ||
30 | 34 | ||
31 | /* | 35 | /* |
32 | * MSDI_CON_OFFSET: offset in bytes of the MSDI IP block's CON register | 36 | * MSDI_CON_OFFSET: offset in bytes of the MSDI IP block's CON register |
@@ -86,3 +90,72 @@ int omap_msdi_reset(struct omap_hwmod *oh) | |||
86 | 90 | ||
87 | return 0; | 91 | return 0; |
88 | } | 92 | } |
93 | |||
94 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) | ||
95 | |||
96 | static inline void omap242x_mmc_mux(struct omap_mmc_platform_data | ||
97 | *mmc_controller) | ||
98 | { | ||
99 | if ((mmc_controller->slots[0].switch_pin > 0) && \ | ||
100 | (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES)) | ||
101 | omap_mux_init_gpio(mmc_controller->slots[0].switch_pin, | ||
102 | OMAP_PIN_INPUT_PULLUP); | ||
103 | if ((mmc_controller->slots[0].gpio_wp > 0) && \ | ||
104 | (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES)) | ||
105 | omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp, | ||
106 | OMAP_PIN_INPUT_PULLUP); | ||
107 | |||
108 | omap_mux_init_signal("sdmmc_cmd", 0); | ||
109 | omap_mux_init_signal("sdmmc_clki", 0); | ||
110 | omap_mux_init_signal("sdmmc_clko", 0); | ||
111 | omap_mux_init_signal("sdmmc_dat0", 0); | ||
112 | omap_mux_init_signal("sdmmc_dat_dir0", 0); | ||
113 | omap_mux_init_signal("sdmmc_cmd_dir", 0); | ||
114 | if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) { | ||
115 | omap_mux_init_signal("sdmmc_dat1", 0); | ||
116 | omap_mux_init_signal("sdmmc_dat2", 0); | ||
117 | omap_mux_init_signal("sdmmc_dat3", 0); | ||
118 | omap_mux_init_signal("sdmmc_dat_dir1", 0); | ||
119 | omap_mux_init_signal("sdmmc_dat_dir2", 0); | ||
120 | omap_mux_init_signal("sdmmc_dat_dir3", 0); | ||
121 | } | ||
122 | |||
123 | /* | ||
124 | * Use internal loop-back in MMC/SDIO Module Input Clock | ||
125 | * selection | ||
126 | */ | ||
127 | if (mmc_controller->slots[0].internal_clock) { | ||
128 | u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); | ||
129 | v |= (1 << 24); | ||
130 | omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data) | ||
135 | { | ||
136 | struct platform_device *pdev; | ||
137 | struct omap_hwmod *oh; | ||
138 | int id = 0; | ||
139 | char *oh_name = "msdi1"; | ||
140 | char *dev_name = "mmci-omap"; | ||
141 | |||
142 | if (!mmc_data[0]) { | ||
143 | pr_err("%s fails: Incomplete platform data\n", __func__); | ||
144 | return; | ||
145 | } | ||
146 | |||
147 | omap242x_mmc_mux(mmc_data[0]); | ||
148 | |||
149 | oh = omap_hwmod_lookup(oh_name); | ||
150 | if (!oh) { | ||
151 | pr_err("Could not look up %s\n", oh_name); | ||
152 | return; | ||
153 | } | ||
154 | pdev = omap_device_build(dev_name, id, oh, mmc_data[0], | ||
155 | sizeof(struct omap_mmc_platform_data), NULL, 0, 0); | ||
156 | if (IS_ERR(pdev)) | ||
157 | WARN(1, "Can'd build omap_device for %s:%s.\n", | ||
158 | dev_name, oh->name); | ||
159 | } | ||
160 | |||
161 | #endif | ||