diff options
author | Arnd Hannemann <arnd@arndnet.de> | 2010-09-10 12:54:20 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-10-28 18:29:14 -0400 |
commit | 68accd7370a90b899ea6563ba9032e5a102ec1b5 (patch) | |
tree | 8b4df083ccea7a30f90f18b0858e7299c1089040 /arch/arm/mach-shmobile | |
parent | 777271d0f33da306575ef776c75f66fc27246bf0 (diff) |
ARM: mach-shmobile: ap4evb: Fix hotplug for SDHI1
On AP4EVB the card detect pin of the top SD/MMC slot is not directly
connected to the tmio/mmcif controller but to a GPIO pin, so polling
needs to be done for SDHI1 and MMCIF in order to support hotplug for
that slot. SHDI1 and MMCIF share that slot, and the used controller
is selected by a DIP switch.
This patch adds a helper function to check if a card is present in that
particular slot, registers this function with SDHI1 and MMCIF and enables
polling for SDHI1.
Signed-off-by: Arnd Hannemann <arnd@arndnet.de>
Tested-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r-- | arch/arm/mach-shmobile/board-ap4evb.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 14923989ea05..22a2b44ddb7b 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c | |||
@@ -235,6 +235,18 @@ static struct platform_device smc911x_device = { | |||
235 | }, | 235 | }, |
236 | }; | 236 | }; |
237 | 237 | ||
238 | /* | ||
239 | * The card detect pin of the top SD/MMC slot (CN7) is active low and is | ||
240 | * connected to GPIO A22 of SH7372 (GPIO_PORT41). | ||
241 | */ | ||
242 | static int slot_cn7_get_cd(struct platform_device *pdev) | ||
243 | { | ||
244 | if (gpio_is_valid(GPIO_PORT41)) | ||
245 | return !gpio_get_value(GPIO_PORT41); | ||
246 | else | ||
247 | return -ENXIO; | ||
248 | } | ||
249 | |||
238 | /* SH_MMCIF */ | 250 | /* SH_MMCIF */ |
239 | static struct resource sh_mmcif_resources[] = { | 251 | static struct resource sh_mmcif_resources[] = { |
240 | [0] = { | 252 | [0] = { |
@@ -261,6 +273,7 @@ static struct sh_mmcif_plat_data sh_mmcif_plat = { | |||
261 | .caps = MMC_CAP_4_BIT_DATA | | 273 | .caps = MMC_CAP_4_BIT_DATA | |
262 | MMC_CAP_8_BIT_DATA | | 274 | MMC_CAP_8_BIT_DATA | |
263 | MMC_CAP_NEEDS_POLL, | 275 | MMC_CAP_NEEDS_POLL, |
276 | .get_cd = slot_cn7_get_cd, | ||
264 | }; | 277 | }; |
265 | 278 | ||
266 | static struct platform_device sh_mmcif_device = { | 279 | static struct platform_device sh_mmcif_device = { |
@@ -310,6 +323,8 @@ static struct sh_mobile_sdhi_info sdhi1_info = { | |||
310 | .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, | 323 | .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, |
311 | .tmio_ocr_mask = MMC_VDD_165_195, | 324 | .tmio_ocr_mask = MMC_VDD_165_195, |
312 | .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE, | 325 | .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE, |
326 | .tmio_caps = MMC_CAP_NEEDS_POLL, | ||
327 | .get_cd = slot_cn7_get_cd, | ||
313 | }; | 328 | }; |
314 | 329 | ||
315 | static struct resource sdhi1_resources[] = { | 330 | static struct resource sdhi1_resources[] = { |
@@ -948,6 +963,10 @@ static void __init ap4evb_init(void) | |||
948 | gpio_no_direction(GPIO_PORT9CR); /* FSIAOBT needs no direction */ | 963 | gpio_no_direction(GPIO_PORT9CR); /* FSIAOBT needs no direction */ |
949 | gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */ | 964 | gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */ |
950 | 965 | ||
966 | /* card detect pin for MMC slot (CN7) */ | ||
967 | gpio_request(GPIO_PORT41, NULL); | ||
968 | gpio_direction_input(GPIO_PORT41); | ||
969 | |||
951 | /* set SPU2 clock to 119.6 MHz */ | 970 | /* set SPU2 clock to 119.6 MHz */ |
952 | clk = clk_get(NULL, "spu_clk"); | 971 | clk = clk_get(NULL, "spu_clk"); |
953 | if (!IS_ERR(clk)) { | 972 | if (!IS_ERR(clk)) { |