diff options
author | Victor Rodriguez <vm.rod25@gmail.com> | 2010-12-27 17:43:11 -0500 |
---|---|---|
committer | Kevin Hilman <khilman@ti.com> | 2011-02-28 17:53:28 -0500 |
commit | ef782d8d4e80b25a56d8cb93d648dd125e6ea95e (patch) | |
tree | ff4b9ba060703e2b49f5b1744728ec6fee78f1d1 /arch/arm/mach-davinci | |
parent | fe358d6a049dcd7cd52b0eb6ae5c8bddf223d41b (diff) |
davinci: MMC/SD support for Omapl138-Hawkboard
This patch adds MMC/SD support for the Hawkboard-L138 system
Signed-off-by: Victor Rodriguez <vm.rod25@gmail.com>
Tested-by: Rene Gonzalez <renegs.2378@gmail.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r-- | arch/arm/mach-davinci/board-omapl138-hawk.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c index cefff9b86f72..eeb1cad02503 100644 --- a/arch/arm/mach-davinci/board-omapl138-hawk.c +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include <mach/mux.h> | 22 | #include <mach/mux.h> |
23 | 23 | ||
24 | #define HAWKBOARD_PHY_ID "0:07" | 24 | #define HAWKBOARD_PHY_ID "0:07" |
25 | #define DA850_HAWK_MMCSD_CD_PIN GPIO_TO_PIN(3, 12) | ||
26 | #define DA850_HAWK_MMCSD_WP_PIN GPIO_TO_PIN(3, 13) | ||
25 | 27 | ||
26 | static short omapl138_hawk_mii_pins[] __initdata = { | 28 | static short omapl138_hawk_mii_pins[] __initdata = { |
27 | DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3, | 29 | DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3, |
@@ -110,6 +112,74 @@ static struct edma_rsv_info *da850_edma_rsv[2] = { | |||
110 | &da850_edma_cc1_rsv, | 112 | &da850_edma_cc1_rsv, |
111 | }; | 113 | }; |
112 | 114 | ||
115 | static const short hawk_mmcsd0_pins[] = { | ||
116 | DA850_MMCSD0_DAT_0, DA850_MMCSD0_DAT_1, DA850_MMCSD0_DAT_2, | ||
117 | DA850_MMCSD0_DAT_3, DA850_MMCSD0_CLK, DA850_MMCSD0_CMD, | ||
118 | DA850_GPIO3_12, DA850_GPIO3_13, | ||
119 | -1 | ||
120 | }; | ||
121 | |||
122 | static int da850_hawk_mmc_get_ro(int index) | ||
123 | { | ||
124 | return gpio_get_value(DA850_HAWK_MMCSD_WP_PIN); | ||
125 | } | ||
126 | |||
127 | static int da850_hawk_mmc_get_cd(int index) | ||
128 | { | ||
129 | return !gpio_get_value(DA850_HAWK_MMCSD_CD_PIN); | ||
130 | } | ||
131 | |||
132 | static struct davinci_mmc_config da850_mmc_config = { | ||
133 | .get_ro = da850_hawk_mmc_get_ro, | ||
134 | .get_cd = da850_hawk_mmc_get_cd, | ||
135 | .wires = 4, | ||
136 | .max_freq = 50000000, | ||
137 | .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED, | ||
138 | .version = MMC_CTLR_VERSION_2, | ||
139 | }; | ||
140 | |||
141 | static __init void omapl138_hawk_mmc_init(void) | ||
142 | { | ||
143 | int ret; | ||
144 | |||
145 | ret = davinci_cfg_reg_list(hawk_mmcsd0_pins); | ||
146 | if (ret) { | ||
147 | pr_warning("%s: MMC/SD0 mux setup failed: %d\n", | ||
148 | __func__, ret); | ||
149 | return; | ||
150 | } | ||
151 | |||
152 | ret = gpio_request_one(DA850_HAWK_MMCSD_CD_PIN, | ||
153 | GPIOF_DIR_IN, "MMC CD"); | ||
154 | if (ret < 0) { | ||
155 | pr_warning("%s: can not open GPIO %d\n", | ||
156 | __func__, DA850_HAWK_MMCSD_CD_PIN); | ||
157 | return; | ||
158 | } | ||
159 | |||
160 | ret = gpio_request_one(DA850_HAWK_MMCSD_WP_PIN, | ||
161 | GPIOF_DIR_IN, "MMC WP"); | ||
162 | if (ret < 0) { | ||
163 | pr_warning("%s: can not open GPIO %d\n", | ||
164 | __func__, DA850_HAWK_MMCSD_WP_PIN); | ||
165 | goto mmc_setup_wp_fail; | ||
166 | } | ||
167 | |||
168 | ret = da8xx_register_mmcsd0(&da850_mmc_config); | ||
169 | if (ret) { | ||
170 | pr_warning("%s: MMC/SD0 registration failed: %d\n", | ||
171 | __func__, ret); | ||
172 | goto mmc_setup_mmcsd_fail; | ||
173 | } | ||
174 | |||
175 | return; | ||
176 | |||
177 | mmc_setup_mmcsd_fail: | ||
178 | gpio_free(DA850_HAWK_MMCSD_WP_PIN); | ||
179 | mmc_setup_wp_fail: | ||
180 | gpio_free(DA850_HAWK_MMCSD_CD_PIN); | ||
181 | } | ||
182 | |||
113 | static struct davinci_uart_config omapl138_hawk_uart_config __initdata = { | 183 | static struct davinci_uart_config omapl138_hawk_uart_config __initdata = { |
114 | .enabled_uarts = 0x7, | 184 | .enabled_uarts = 0x7, |
115 | }; | 185 | }; |
@@ -127,6 +197,8 @@ static __init void omapl138_hawk_init(void) | |||
127 | pr_warning("%s: EDMA registration failed: %d\n", | 197 | pr_warning("%s: EDMA registration failed: %d\n", |
128 | __func__, ret); | 198 | __func__, ret); |
129 | 199 | ||
200 | omapl138_hawk_mmc_init(); | ||
201 | |||
130 | ret = da8xx_register_watchdog(); | 202 | ret = da8xx_register_watchdog(); |
131 | if (ret) | 203 | if (ret) |
132 | pr_warning("omapl138_hawk_init: " | 204 | pr_warning("omapl138_hawk_init: " |