rk30: add basic support for sdmmc
author黄涛 <huangtao@rock-chips.com>
Mon, 27 Feb 2012 06:31:27 +0000 (14:31 +0800)
committer黄涛 <huangtao@rock-chips.com>
Mon, 27 Feb 2012 06:31:27 +0000 (14:31 +0800)
arch/arm/mach-rk29/include/mach/board.h
arch/arm/mach-rk30/devices.c
arch/arm/mach-rk30/include/mach/board.h
arch/arm/mach-rk30/include/mach/dma-pl330.h [new file with mode: 0644]
arch/arm/plat-rk/include/plat/board.h
drivers/mmc/host/Kconfig
drivers/mmc/host/rk29_sdmmc.c

index c63f3f6dfe1b6a293f23d3b21ada8e3e77d5b58e..71a8a9a4fd74f6ccc21a43065fc379cca292d514 100755 (executable)
@@ -97,20 +97,6 @@ struct wifi_platform_data {
 };
 #endif
 
-struct rk29_sdmmc_platform_data {
-       unsigned int host_caps;
-       unsigned int host_ocr_avail;
-       unsigned int use_dma:1;
-       char dma_name[8];
-       int (*io_init)(void);
-       int (*io_deinit)(void);
-       void (*set_iomux)(int device_id, unsigned int bus_width);//added by xbw at 2011-10-13
-       int (*status)(struct device *);
-       int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id);
-        int detect_irq;
-               int enable_sd_wakeup;
-       int write_prt;
-};
 struct rk29_i2c_platform_data {
        int     bus_num;        
        unsigned int    flags;     
index 48431859e9b6d4b35e7370062136e93a89ba3603..980661efa256f2efba9ebf8efea78daac9643334 100755 (executable)
@@ -801,6 +801,66 @@ static struct platform_device device_keys = {
 };
 #endif
 
+#ifdef CONFIG_SDMMC0_RK29
+static struct resource resources_sdmmc0[] = {
+       {
+               .start  = IRQ_SDMMC,
+               .end    = IRQ_SDMMC,
+               .flags  = IORESOURCE_IRQ,
+       },
+       {
+               .start  = RK30_SDMMC0_PHYS,
+               .end    = RK30_SDMMC0_PHYS + RK30_SDMMC0_SIZE -1,
+               .flags  = IORESOURCE_MEM,
+       }
+};
+
+static struct platform_device device_sdmmc0 = {
+       .name           = "rk29_sdmmc",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(resources_sdmmc0),
+       .resource       = resources_sdmmc0,
+       .dev            = {
+               .platform_data = &default_sdmmc0_data,
+       },
+};
+#endif
+
+#ifdef CONFIG_SDMMC1_RK29
+static struct resource resources_sdmmc1[] = {
+       {
+               .start  = IRQ_SDIO,
+               .end    = IRQ_SDIO,
+               .flags  = IORESOURCE_IRQ,
+       },
+       {
+               .start  = RK30_SDIO_PHYS,
+               .end    = RK30_SDIO_PHYS + RK30_SDIO_SIZE - 1,
+               .flags  = IORESOURCE_MEM,
+       }
+};
+
+static struct platform_device device_sdmmc1 = {
+       .name           = "rk29_sdmmc",
+       .id             = 1,
+       .num_resources  = ARRAY_SIZE(resources_sdmmc1),
+       .resource       = resources_sdmmc1,
+       .dev            = {
+               .platform_data = &default_sdmmc1_data,
+       },
+};
+#endif
+
+static void __init rk30_init_sdmmc(void)
+{
+#ifdef CONFIG_SDMMC0_RK29
+       platform_device_register(&device_sdmmc0);
+#endif
+#ifdef CONFIG_SDMMC1_RK29
+       platform_device_register(&device_sdmmc1);
+#endif
+}
+
 static int __init rk30_init_devices(void)
 {
        rk30_init_dma();
@@ -825,6 +885,7 @@ static int __init rk30_init_devices(void)
 #ifdef CONFIG_TSADC_RK30
        platform_device_register(&device_tsadc);
 #endif
+       rk30_init_sdmmc();
 
         return 0;
 }
index ac4e3026bfbfba05d5a07595187bd4a1f345754b..07d71ef0ee1cc9df5bf96220135dbe6131b48e34 100755 (executable)
@@ -34,6 +34,8 @@ struct mma8452_platform_data {
        void    (*exit_platform_hw)(void);
 };
 
+extern struct rk29_sdmmc_platform_data default_sdmmc0_data;
+extern struct rk29_sdmmc_platform_data default_sdmmc1_data;
 
 void __init rk30_map_common_io(void);
 void __init rk30_init_irq(void);
diff --git a/arch/arm/mach-rk30/include/mach/dma-pl330.h b/arch/arm/mach-rk30/include/mach/dma-pl330.h
new file mode 100644 (file)
index 0000000..9afde65
--- /dev/null
@@ -0,0 +1 @@
+#include <plat/dma-pl330.h>
index 7a071c58a6221d1978ccafb8e8ff4d1ef32ccc02..8c70dd5e0445f9bd7b853a8bd7785d8882a2b3c1 100644 (file)
@@ -1,7 +1,9 @@
 #ifndef __PLAT_BOARD_H
 #define __PLAT_BOARD_H
+
 #include <linux/types.h>
 #include <linux/init.h>
+#include <linux/device.h>
 
 /*spi*/
 struct spi_cs_gpio {
@@ -31,15 +33,6 @@ struct rk29_bl_info {
        unsigned int delay_ms;  /* in milliseconds */
 };
 
-#define BOOT_MODE_NORMAL               0
-#define BOOT_MODE_FACTORY2             1
-#define BOOT_MODE_RECOVERY             2
-#define BOOT_MODE_CHARGE               3
-#define BOOT_MODE_POWER_TEST           4
-#define BOOT_MODE_OFFMODE_CHARGING     5
-#define BOOT_MODE_REBOOT               6
-#define BOOT_MODE_PANIC                        7
-
 struct rk29lcd_info {
        u32 lcd_id;
        u32 txd_pin;
@@ -68,6 +61,29 @@ struct rk29fb_info {
        int (*io_disable)(void);
 };
 
+struct rk29_sdmmc_platform_data {
+       unsigned int host_caps;
+       unsigned int host_ocr_avail;
+       unsigned int use_dma:1;
+       char dma_name[8];
+       int (*io_init)(void);
+       int (*io_deinit)(void);
+       void (*set_iomux)(int device_id, unsigned int bus_width);//added by xbw at 2011-10-13
+       int (*status)(struct device *);
+       int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id);
+       int detect_irq;
+       int enable_sd_wakeup;
+       int write_prt;
+};
+
+#define BOOT_MODE_NORMAL               0
+#define BOOT_MODE_FACTORY2             1
+#define BOOT_MODE_RECOVERY             2
+#define BOOT_MODE_CHARGE               3
+#define BOOT_MODE_POWER_TEST           4
+#define BOOT_MODE_OFFMODE_CHARGING     5
+#define BOOT_MODE_REBOOT               6
+#define BOOT_MODE_PANIC                        7
 int board_boot_mode(void);
 
 /* for USB detection */
index 919144060c9cd1b923e1ec7ce1c153f04dfaaf7c..bb2c399c89b95d72d30567d88e4d7dfdff473471 100755 (executable)
@@ -6,7 +6,7 @@ comment "MMC/SD/SDIO Host Controller Drivers"
 
 config SDMMC_RK29
        tristate "RK29 SDMMC controller suppport"
-       depends on ARCH_RK29
+       depends on PLAT_RK
        help
                This selects the RK29 SDMMC controller.
                SDMMC0 used for sd/mmc card, and SDMMC1 used for sdio.
@@ -21,7 +21,6 @@ if SDMMC_RK29
        config SDMMC0_RK29
                tristate "RK29 SDMMC0 controller support(sdmmc)"
                default y
-               depends on ARCH_RK29 
                help
                        This supports the use of the SDMMC0 controller on Rk29 processors.
                        
@@ -45,7 +44,6 @@ if SDMMC_RK29
        config SDMMC1_RK29
                tristate "RK29 SDMMC1 controller support(sdio)"
                default y
-               depends on ARCH_RK29
                help
                        This supports the use of the SDMMC1 controller on Rk29 processors.
        config SDMMC1_RK29_WRITE_PROTECT
index cd26fc9e85ae26c8093845bfa1513d0153a56463..708cc8bbb59cbb2267cc215d1af2ccb5f691aa67 100755 (executable)
 #include <linux/mmc/card.h>
 
 #include <mach/board.h>
-#include <mach/rk29_iomap.h>
+#include <mach/io.h>
 #include <mach/gpio.h>
 #include <mach/iomux.h>
 
 #include <asm/dma.h>
-#include <mach/rk29-dma-pl330.h>
+#include <mach/dma-pl330.h>
 #include <asm/scatterlist.h>
 
 #include "rk29_sdmmc.h"