Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
[pandora-kernel.git] / arch / arm / mach-shmobile / board-ap4evb.c
index f5d55ef..46ca4d4 100644 (file)
@@ -238,6 +238,18 @@ static struct platform_device smc911x_device = {
        },
 };
 
+/*
+ * The card detect pin of the top SD/MMC slot (CN7) is active low and is
+ * connected to GPIO A22 of SH7372 (GPIO_PORT41).
+ */
+static int slot_cn7_get_cd(struct platform_device *pdev)
+{
+       if (gpio_is_valid(GPIO_PORT41))
+               return !gpio_get_value(GPIO_PORT41);
+       else
+               return -ENXIO;
+}
+
 /* SH_MMCIF */
 static struct resource sh_mmcif_resources[] = {
        [0] = {
@@ -264,6 +276,7 @@ static struct sh_mmcif_plat_data sh_mmcif_plat = {
        .caps           = MMC_CAP_4_BIT_DATA |
                          MMC_CAP_8_BIT_DATA |
                          MMC_CAP_NEEDS_POLL,
+       .get_cd         = slot_cn7_get_cd,
 };
 
 static struct platform_device sh_mmcif_device = {
@@ -313,6 +326,8 @@ static struct sh_mobile_sdhi_info sdhi1_info = {
        .dma_slave_rx   = SHDMA_SLAVE_SDHI1_RX,
        .tmio_ocr_mask  = MMC_VDD_165_195,
        .tmio_flags     = TMIO_MMC_WRPROTECT_DISABLE,
+       .tmio_caps      = MMC_CAP_NEEDS_POLL,
+       .get_cd         = slot_cn7_get_cd,
 };
 
 static struct resource sdhi1_resources[] = {
@@ -1060,6 +1075,10 @@ static void __init ap4evb_init(void)
        gpio_no_direction(GPIO_PORT9CR);  /* FSIAOBT needs no direction */
        gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */
 
+       /* card detect pin for MMC slot (CN7) */
+       gpio_request(GPIO_PORT41, NULL);
+       gpio_direction_input(GPIO_PORT41);
+
        /* set SPU2 clock to 119.6 MHz */
        clk = clk_get(NULL, "spu_clk");
        if (!IS_ERR(clk)) {