SDMMC: for RK3188, support new iomux API
authorxbw <xbw@rock-chips.com>
Thu, 17 Jan 2013 09:56:07 +0000 (17:56 +0800)
committerxbw <xbw@rock-chips.com>
Thu, 17 Jan 2013 09:56:07 +0000 (17:56 +0800)
arch/arm/mach-rk30/board-rk30-sdk-sdmmc.c

index 144208a4f230f14e2aad60487d76dd5ed22915e0..ff904aaaaa4b80c240d614b23994640f99f5b53d 100755 (executable)
@@ -15,6 +15,7 @@
  * History:
  * ver1.0 add combo-wifi operateions. such as commit e049351a09c78db8a08aa5c49ce8eba0a3d6824e, at 2012-09-16
  * ver2.0 Unify all the file versions of board_xxxx_sdmmc.c, at 2012-11-05
+ * ver3.0 Unify the interface functions of new-iomux-API due to the modify in IOMUX module, at 2013-01-17
  *
  * Content:
  * Part 1: define the gpio for SD-MMC-SDIO-Wifi functions according to your own projects.
         ***********************************************************************************
  *
  */
+//use the new iomux-API
+#if defined(CONFIG_ARCH_RK3066B)||defined(CONFIG_ARCH_RK3168)||defined(CONFIG_ARCH_RK3188)
+#define SDMMC_USE_NEW_IOMUX_API 1
+#else
+#define SDMMC_USE_NEW_IOMUX_API 0
+#endif
 
 //1.Part 1: define the gpio for SD-MMC-SDIO-Wifi functions  according to your own projects.
 
 #define RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO      GPIO3_B0
 #define RK29SDK_SD_CARD_DETECT_IOMUX_FMUX       MMC0_DETN
 
-#elif defined(CONFIG_ARCH_RK30)&& !defined(CONFIG_ARCH_RK3066B) //for RK30,RK3066 SDK
-//refer to file /arch/arm/mach-rk30/include/mach/Iomux.h
-//define reset-pin
-#define RK29SDK_SD_CARD_DETECT_N                RK30_PIN3_PB6  //According to your own project to set the value of card-detect-pin.
-#define RK29SDK_SD_CARD_INSERT_LEVEL            GPIO_LOW         // set the voltage of insert-card. Please pay attention to the default setting.
-#define RK29SDK_SD_CARD_DETECT_PIN_NAME         GPIO3B6_SDMMC0DETECTN_NAME
-#define RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO      GPIO3B_GPIO3B6
-#define RK29SDK_SD_CARD_DETECT_IOMUX_FMUX       GPIO3B_SDMMC0_DETECT_N
 
 #elif defined(CONFIG_ARCH_RK2928)
 //refer to file ./arch/arm/mach-rk2928/include/mach/iomux.h
     #define RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO      GPIO1C_GPIO1C1
     #define RK29SDK_SD_CARD_DETECT_IOMUX_FMUX       GPIO1C_MMC0_DETN
     #endif
+
+#else //default for RK30,RK3066 SDK
+//refer to file /arch/arm/mach-rk30/include/mach/Iomux.h
+//define reset-pin
+#define RK29SDK_SD_CARD_DETECT_N                RK30_PIN3_PB6  //According to your own project to set the value of card-detect-pin.
+#define RK29SDK_SD_CARD_INSERT_LEVEL            GPIO_LOW         // set the voltage of insert-card. Please pay attention to the default setting.
+#define RK29SDK_SD_CARD_DETECT_PIN_NAME         GPIO3B6_SDMMC0DETECTN_NAME
+#define RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO      GPIO3B_GPIO3B6
+#define RK29SDK_SD_CARD_DETECT_IOMUX_FMUX       GPIO3B_SDMMC0_DETECT_N
+    
 #endif
 
 
 // Define wifi module's power and reset gpio, and gpio sensitive level.
 // Please set the value according to your own project.
 //
-#if defined(CONFIG_ARCH_RK30) && !defined(CONFIG_ARCH_RK3066B) //for RK30,RK3066 SDK
+
+#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)//refer to file /arch/arm/mach-rk30/include/mach/iomux-rk3066b.h
+    #define WIFI_HOST_WAKE RK30_PIN3_PD2
+         
+    #if defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) 
+        #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN3_PD0            
+        #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_LOW//GPIO_HIGH        
+        #define RK30SDK_WIFI_GPIO_POWER_PIN_NAME        "wifi_power"
+        #define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO     GPIO3_D0
+        
+    #elif defined(CONFIG_BCM4329) || defined(CONFIG_BCM4319) || defined(CONFIG_RK903) || defined(CONFIG_RK901)
+        #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN3_PD0                 
+        #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH                   
+        #define RK30SDK_WIFI_GPIO_POWER_PIN_NAME        "wifi_power"
+        #define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO     GPIO3_D0
+
+        #define RK30SDK_WIFI_GPIO_RESET_N               RK30_PIN2_PA7
+        #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH 
+        #define RK30SDK_WIFI_GPIO_RESET_PIN_NAME        "wifi_reset"
+        #define RK30SDK_WIFI_GPIO_RESET_IOMUX_FGPIO     GPIO2_A7
+    
+    #elif defined(CONFIG_MT5931_MT6622) || defined(CONFIG_MT5931)
+
+               #ifdef  CONFIG_MACH_RK3168_LR097 
+               #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN3_PD0 
+               #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH
+               #define RK30SDK_WIFI_GPIO_POWER_PIN_NAME        "wifi_power"
+               #define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO     GPIO3_D0
+               //#define RK30SDK_WIFI_GPIO_RESET_N                 RK30_PIN3_PD1
+               //#define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH
+               //#define RK30SDK_WIFI_GPIO_RESET_PIN_NAME        "wifi_reset"
+               //#define RK30SDK_WIFI_GPIO_RESET_IOMUX_FGPIO     GPIO3_D1
+
+               #else
+               #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN0_PA5
+               #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH
+               //#define RK30SDK_WIFI_GPIO_POWER_PIN_NAME        "wifi_power"
+               //#define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO     GPIO3_D0
+               #define RK30SDK_WIFI_GPIO_RESET_N               RK30_PIN3_PD1
+               #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH
+               #define RK30SDK_WIFI_GPIO_RESET_PIN_NAME        "wifi_reset"
+               #define RK30SDK_WIFI_GPIO_RESET_IOMUX_FGPIO     GPIO3_D1        
+               #endif
+
+    #endif   
+#elif defined(CONFIG_ARCH_RK2928) //refer to file ./arch/arm/mach-rk2928/include/mach/iomux.h
+    #define WIFI_HOST_WAKE RK2928_PIN3_PC0 
+
+       #if defined(CONFIG_RK903) || defined(CONFIG_RK901) || defined(CONFIG_BCM4329) || defined(CONFIG_BCM4319)
+        #define RK30SDK_WIFI_GPIO_POWER_N               RK2928_PIN0_PD6
+        #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH
+        #define RK30SDK_WIFI_GPIO_POWER_PIN_NAME        GPIO0D6_MMC1_PWREN_NAME
+        #define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO     GPIO0D_GPIO0D6
+
+        #define RK30SDK_WIFI_GPIO_RESET_N               RK2928_PIN3_PC2
+        #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH
+        //You need not define the pin-iomux-name due to the pin only used gpio.
+        //#define RK30SDK_WIFI_GPIO_RESET_PIN_NAME        GPIO3C2_SDMMC1DATA1_NAME 
+        //#define RK30SDK_WIFI_GPIO_RESET_IOMUX_FGPIO     GPIO3C_GPIO3C2
+       
+    #elif  defined(CONFIG_RDA5990)
+        #define RK30SDK_WIFI_GPIO_POWER_N               INVALID_GPIO//RK2928_PIN0_PD6
+        #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH
+        //#define RK30SDK_WIFI_GPIO_POWER_PIN_NAME        GPIO0B6_MMC1_PWREN_NAME
+        //#define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO     GPIO0B_GPIO0B6
+        
+        #define RK30SDK_WIFI_GPIO_RESET_N               INVALID_GPIO//RK2928_PIN3_PC2
+        #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH
+        //#define RK30SDK_WIFI_GPIO_RESET_PIN_NAME        GPIO3C2_SDMMC1DATA1_NAME
+        //#define RK30SDK_WIFI_GPIO_RESET_IOMUX_FGPIO     GPIO3C_GPIO3C2
+
+
+        #elif defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) 
+        #define RK30SDK_WIFI_GPIO_POWER_N               RK2928_PIN0_PD6
+        #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_LOW
+        #define RK30SDK_WIFI_GPIO_POWER_PIN_NAME        GPIO0D6_MMC1_PWREN_NAME
+        #define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO     GPIO0D_GPIO0D6
+
+    #endif
+    
+#else //default for RK30,RK3066 SDK
     // refer to file /arch/arm/mach-rk30/include/mach/Iomux.h
     #define WIFI_HOST_WAKE RK30_PIN3_PD2
 
                 #endif // #if COMBO_MODULE_MT6620_CDT--#endif
             #endif
         #endif// #endif --#if !defined(CONFIG_USE_SDMMC0_FOR_WIFI_DEVELOP_BOARD)
-    #endif 
-#elif defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)//refer to file /arch/arm/mach-rk30/include/mach/iomux-rk3066b.h
-    #define WIFI_HOST_WAKE RK30_PIN3_PD2
-         
-    #if defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) 
-        #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN3_PD0            
-        #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_LOW//GPIO_HIGH        
-        #define RK30SDK_WIFI_GPIO_POWER_PIN_NAME        "wifi_power"
-        #define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO     GPIO3_D0
-        
-    #elif defined(CONFIG_BCM4329) || defined(CONFIG_BCM4319) || defined(CONFIG_RK903) || defined(CONFIG_RK901)
-        #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN3_PD0                 
-        #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH                   
-        #define RK30SDK_WIFI_GPIO_POWER_PIN_NAME        "wifi_power"
-        #define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO     GPIO3_D0
-
-        #define RK30SDK_WIFI_GPIO_RESET_N               RK30_PIN2_PA7
-        #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH 
-        #define RK30SDK_WIFI_GPIO_RESET_PIN_NAME        "wifi_reset"
-        #define RK30SDK_WIFI_GPIO_RESET_IOMUX_FGPIO     GPIO2_A7
-    
-    #elif defined(CONFIG_MT5931_MT6622) || defined(CONFIG_MT5931)
-
-               #ifdef  CONFIG_MACH_RK3168_LR097 
-               #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN3_PD0 
-               #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH
-               #define RK30SDK_WIFI_GPIO_POWER_PIN_NAME        "wifi_power"
-               #define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO     GPIO3_D0
-               //#define RK30SDK_WIFI_GPIO_RESET_N                 RK30_PIN3_PD1
-               //#define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH
-               //#define RK30SDK_WIFI_GPIO_RESET_PIN_NAME        "wifi_reset"
-               //#define RK30SDK_WIFI_GPIO_RESET_IOMUX_FGPIO     GPIO3_D1
-
-               #else
-               #define RK30SDK_WIFI_GPIO_POWER_N               RK30_PIN0_PA5
-               #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH
-               //#define RK30SDK_WIFI_GPIO_POWER_PIN_NAME        "wifi_power"
-               //#define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO     GPIO3_D0
-               #define RK30SDK_WIFI_GPIO_RESET_N               RK30_PIN3_PD1
-               #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH
-               #define RK30SDK_WIFI_GPIO_RESET_PIN_NAME        "wifi_reset"
-               #define RK30SDK_WIFI_GPIO_RESET_IOMUX_FGPIO     GPIO3_D1
-               #endif
-
-    #endif   
-#elif defined(CONFIG_ARCH_RK2928) //refer to file ./arch/arm/mach-rk2928/include/mach/iomux.h
-    #define WIFI_HOST_WAKE RK2928_PIN3_PC0 
-
-       #if defined(CONFIG_RK903) || defined(CONFIG_RK901) || defined(CONFIG_BCM4329) || defined(CONFIG_BCM4319)
-        #define RK30SDK_WIFI_GPIO_POWER_N               RK2928_PIN0_PD6
-        #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH
-        #define RK30SDK_WIFI_GPIO_POWER_PIN_NAME        GPIO0D6_MMC1_PWREN_NAME
-        #define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO     GPIO0D_GPIO0D6
-
-        #define RK30SDK_WIFI_GPIO_RESET_N               RK2928_PIN3_PC2
-        #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH
-        //You need not define the pin-iomux-name due to the pin only used gpio.
-        //#define RK30SDK_WIFI_GPIO_RESET_PIN_NAME        GPIO3C2_SDMMC1DATA1_NAME 
-        //#define RK30SDK_WIFI_GPIO_RESET_IOMUX_FGPIO     GPIO3C_GPIO3C2
-       
-    #elif  defined(CONFIG_RDA5990)
-        #define RK30SDK_WIFI_GPIO_POWER_N               INVALID_GPIO//RK2928_PIN0_PD6
-        #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_HIGH
-        //#define RK30SDK_WIFI_GPIO_POWER_PIN_NAME        GPIO0B6_MMC1_PWREN_NAME
-        //#define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO     GPIO0B_GPIO0B6
-        
-        #define RK30SDK_WIFI_GPIO_RESET_N               INVALID_GPIO//RK2928_PIN3_PC2
-        #define RK30SDK_WIFI_GPIO_RESET_ENABLE_VALUE    GPIO_HIGH
-        //#define RK30SDK_WIFI_GPIO_RESET_PIN_NAME        GPIO3C2_SDMMC1DATA1_NAME
-        //#define RK30SDK_WIFI_GPIO_RESET_IOMUX_FGPIO     GPIO3C_GPIO3C2
-
-
-        #elif defined(CONFIG_RTL8192CU) || defined(CONFIG_RTL8188EU) 
-        #define RK30SDK_WIFI_GPIO_POWER_N               RK2928_PIN0_PD6
-        #define RK30SDK_WIFI_GPIO_POWER_ENABLE_VALUE    GPIO_LOW
-        #define RK30SDK_WIFI_GPIO_POWER_PIN_NAME        GPIO0D6_MMC1_PWREN_NAME
-        #define RK30SDK_WIFI_GPIO_POWER_IOMUX_FGPIO     GPIO0D_GPIO0D6
-
-    #endif
+    #endif     
 #endif
 
     
 #define RK29SDK_SD_CARD_PWR_EN_IOMUX_FGPIO      GPIO5H_GPIO5D5
 #define RK29SDK_SD_CARD_PWR_EN_IOMUX_FMUX       GPIO5H_SDMMC0_PWR_EN
 
-#elif defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)
-//refer to file /arch/arm/mach-rk30/include/mach/iomux-rk3066b.h
-//define PowerEn-pin
-#define RK29SDK_SD_CARD_PWR_EN                  RK30_PIN3_PA1
-#define RK29SDK_SD_CARD_PWR_EN_LEVEL            GPIO_LOW 
-#define RK29SDK_SD_CARD_PWR_EN_PIN_NAME         "mmc0_pwren"
-#define RK29SDK_SD_CARD_PWR_EN_IOMUX_FGPIO      GPIO3_A1
-#define RK29SDK_SD_CARD_PWR_EN_IOMUX_FMUX       MMC0_PWREN
-
-#elif defined(CONFIG_ARCH_RK30)&& !defined(CONFIG_ARCH_RK3066B) //for RK30,RK3066 SDK
-//refer to file /arch/arm/mach-rk30/include/mach/Iomux.h
-//define PowerEn-pin
-#define RK29SDK_SD_CARD_PWR_EN                  RK30_PIN3_PA7 
-#define RK29SDK_SD_CARD_PWR_EN_LEVEL            GPIO_LOW
-#define RK29SDK_SD_CARD_PWR_EN_PIN_NAME         GPIO3A7_SDMMC0PWREN_NAME
-#define RK29SDK_SD_CARD_PWR_EN_IOMUX_FGPIO      GPIO3A_GPIO3A7
-#define RK29SDK_SD_CARD_PWR_EN_IOMUX_FMUX       GPIO3A_SDMMC0_PWR_EN
-
-#elif defined(CONFIG_ARCH_RK2928)
-//refer to file ./arch/arm/mach-rk2928/include/mach/iomux.h
-//define PowerEn-pin
-#define RK29SDK_SD_CARD_PWR_EN                  RK2928_PIN1_PB6
-#define RK29SDK_SD_CARD_PWR_EN_LEVEL            GPIO_LOW 
-#define RK29SDK_SD_CARD_PWR_EN_PIN_NAME         GPIO1B6_MMC0_PWREN_NAME
-#define RK29SDK_SD_CARD_PWR_EN_IOMUX_FGPIO      GPIO1B_GPIO1B6
-#define RK29SDK_SD_CARD_PWR_EN_IOMUX_FMUX       GPIO1B_MMC0_PWREN
-
-#endif
-
-#if defined(CONFIG_ARCH_RK30)&& !defined(CONFIG_ARCH_RK3066B)//for RK30,RK3066 SDK
-/*
-* define the gpio for sdmmc0
-*/
-struct rksdmmc_gpio_board rksdmmc0_gpio_init = {
-
-     .clk_gpio       = {
-        .io             = RK30_PIN3_PB0,
-        .enable         = GPIO_HIGH,
-        .iomux          = {
-            .name       = GPIO3B0_SDMMC0CLKOUT_NAME,
-            .fgpio      = GPIO3B_GPIO3B0,
-            .fmux       = GPIO3B_SDMMC0_CLKOUT,
-        },
-    },   
-
-    .cmd_gpio           = {
-        .io             = RK30_PIN3_PB1,
-        .enable         = GPIO_HIGH,
-        .iomux          = {
-            .name       = GPIO3B1_SDMMC0CMD_NAME,
-            .fgpio      = GPIO3B_GPIO3B1,
-            .fmux       = GPIO3B_SDMMC0_CMD,
-        },
-    },      
-
-   .data0_gpio       = {
-        .io             = RK30_PIN3_PB2,
-        .enable         = GPIO_HIGH,
-        .iomux          = {
-            .name       = GPIO3B2_SDMMC0DATA0_NAME,
-            .fgpio      = GPIO3B_GPIO3B2,
-            .fmux       = GPIO3B_SDMMC0_DATA0,
-        },
-    },      
-
-    .data1_gpio       = {
-        .io             = RK30_PIN3_PB3,
-        .enable         = GPIO_HIGH,
-        .iomux          = {
-            .name       = GPIO3B3_SDMMC0DATA1_NAME,
-            .fgpio      = GPIO3B_GPIO3B3,
-            .fmux       = GPIO3B_SDMMC0_DATA1,
-        },
-    },      
-
-    .data2_gpio       = {
-        .io             = RK30_PIN3_PB4,
-        .enable         = GPIO_HIGH,
-        .iomux          = {
-            .name       = GPIO3B4_SDMMC0DATA2_NAME,
-            .fgpio      = GPIO3B_GPIO3B4,
-            .fmux       = GPIO3B_SDMMC0_DATA2,
-        },
-    }, 
-
-    .data3_gpio       = {
-        .io             = RK30_PIN3_PB5,
-        .enable         = GPIO_HIGH,
-        .iomux          = {
-            .name       = GPIO3B5_SDMMC0DATA3_NAME,
-            .fgpio      = GPIO3B_GPIO3B5,
-            .fmux       = GPIO3B_SDMMC0_DATA3,
-        },
-    }, 
-    
-    .power_en_gpio      = {   
-#if defined(RK29SDK_SD_CARD_PWR_EN) || (INVALID_GPIO != RK29SDK_SD_CARD_PWR_EN)
-        .io             = RK29SDK_SD_CARD_PWR_EN,
-        .enable         = RK29SDK_SD_CARD_PWR_EN_LEVEL,
-        #ifdef RK29SDK_SD_CARD_PWR_EN_PIN_NAME
-        .iomux          = {
-            .name       = RK29SDK_SD_CARD_PWR_EN_PIN_NAME,
-            #ifdef RK29SDK_SD_CARD_PWR_EN_IOMUX_FGPIO
-            .fgpio      = RK29SDK_SD_CARD_PWR_EN_IOMUX_FGPIO,
-            #endif
-            #ifdef RK29SDK_SD_CARD_PWR_EN_IOMUX_FMUX
-            .fmux       = RK29SDK_SD_CARD_PWR_EN_IOMUX_FMUX,
-            #endif
-        },
-        #endif
-#else
-        .io             = INVALID_GPIO,
-        .enable         = GPIO_LOW,
-#endif
-    }, 
-
-    .detect_irq       = {
-#if defined(RK29SDK_SD_CARD_DETECT_N) || (INVALID_GPIO != RK29SDK_SD_CARD_DETECT_N)  
-        .io             = RK29SDK_SD_CARD_DETECT_N,
-        .enable         = RK29SDK_SD_CARD_INSERT_LEVEL,
-        #ifdef RK29SDK_SD_CARD_DETECT_PIN_NAME
-        .iomux          = {
-            .name       = RK29SDK_SD_CARD_DETECT_PIN_NAME,
-            #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO
-            .fgpio      = RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO,
-            #endif
-            #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FMUX
-            .fmux       = RK29SDK_SD_CARD_DETECT_IOMUX_FMUX,
-            #endif
-        },
-        #endif
-#else
-        .io             = INVALID_GPIO,
-        .enable         = GPIO_LOW,
-#endif            
-    },
-};
-
-
-/*
-* define the gpio for sdmmc1
-*/
-static struct rksdmmc_gpio_board rksdmmc1_gpio_init = {
-
-     .clk_gpio       = {
-        .io             = RK30_PIN3_PC5,
-        .enable         = GPIO_HIGH,
-        .iomux          = {
-            .name       = GPIO3C5_SDMMC1CLKOUT_NAME,
-            .fgpio      = GPIO3C_GPIO3C5,
-            .fmux       = GPIO3B_SDMMC0_CLKOUT,
-        },
-    },   
-
-    .cmd_gpio           = {
-        .io             = RK30_PIN3_PC0,
-        .enable         = GPIO_HIGH,
-        .iomux          = {
-            .name       = GPIO3C0_SMMC1CMD_NAME,
-            .fgpio      = GPIO3C_GPIO3C0,
-            .fmux       = GPIO3B_SDMMC0_CMD,
-        },
-    },      
-
-   .data0_gpio       = {
-        .io             = RK30_PIN3_PC1,
-        .enable         = GPIO_HIGH,
-        .iomux          = {
-            .name       = GPIO3C1_SDMMC1DATA0_NAME,
-            .fgpio      = GPIO3C_GPIO3C1,
-            .fmux       = GPIO3B_SDMMC0_DATA0,
-        },
-    },      
+#elif defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)
+//refer to file /arch/arm/mach-rk30/include/mach/iomux-rk3066b.h
+//define PowerEn-pin
+#define RK29SDK_SD_CARD_PWR_EN                  RK30_PIN3_PA1
+#define RK29SDK_SD_CARD_PWR_EN_LEVEL            GPIO_LOW 
+#define RK29SDK_SD_CARD_PWR_EN_PIN_NAME         "mmc0_pwren"
+#define RK29SDK_SD_CARD_PWR_EN_IOMUX_FGPIO      GPIO3_A1
+#define RK29SDK_SD_CARD_PWR_EN_IOMUX_FMUX       MMC0_PWREN
 
-    .data1_gpio       = {
-        .io             = RK30_PIN3_PC2,
-        .enable         = GPIO_HIGH,
-        .iomux          = {
-            .name       = GPIO3C2_SDMMC1DATA1_NAME,
-            .fgpio      = GPIO3C_GPIO3C2,
-            .fmux       = GPIO3B_SDMMC0_DATA1,
-        },
-    },      
+#elif defined(CONFIG_ARCH_RK2928)
+//refer to file ./arch/arm/mach-rk2928/include/mach/iomux.h
+//define PowerEn-pin
+#define RK29SDK_SD_CARD_PWR_EN                  RK2928_PIN1_PB6
+#define RK29SDK_SD_CARD_PWR_EN_LEVEL            GPIO_LOW 
+#define RK29SDK_SD_CARD_PWR_EN_PIN_NAME         GPIO1B6_MMC0_PWREN_NAME
+#define RK29SDK_SD_CARD_PWR_EN_IOMUX_FGPIO      GPIO1B_GPIO1B6
+#define RK29SDK_SD_CARD_PWR_EN_IOMUX_FMUX       GPIO1B_MMC0_PWREN
 
-    .data2_gpio       = {
-        .io             = RK30_PIN3_PC3,
-        .enable         = GPIO_HIGH,
-        .iomux          = {
-            .name       = GPIO3C3_SDMMC1DATA2_NAME,
-            .fgpio      = GPIO3C_GPIO3C3,
-            .fmux       = GPIO3B_SDMMC0_DATA2,
-        },
-    }, 
+#else //defaul for RK30,RK3066 SDK
+//refer to file /arch/arm/mach-rk30/include/mach/Iomux.h
+//define PowerEn-pin
+#define RK29SDK_SD_CARD_PWR_EN                  RK30_PIN3_PA7 
+#define RK29SDK_SD_CARD_PWR_EN_LEVEL            GPIO_LOW
+#define RK29SDK_SD_CARD_PWR_EN_PIN_NAME         GPIO3A7_SDMMC0PWREN_NAME
+#define RK29SDK_SD_CARD_PWR_EN_IOMUX_FGPIO      GPIO3A_GPIO3A7
+#define RK29SDK_SD_CARD_PWR_EN_IOMUX_FMUX       GPIO3A_SDMMC0_PWR_EN
 
-    .data3_gpio       = {
-        .io             = RK30_PIN3_PC4,
-        .enable         = GPIO_HIGH,
-        .iomux          = {
-            .name       = GPIO3C4_SDMMC1DATA3_NAME,
-            .fgpio      = GPIO3C_GPIO3C4,
-            .fmux       = GPIO3B_SDMMC0_DATA3,
-        },
-    }, 
-};
- // ---end -#if defined(CONFIG_ARCH_RK30)&& !defined(CONFIG_ARCH_RK3066B)
+#endif
 
-#elif defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)
 
+#if defined(CONFIG_ARCH_RK3066B) || defined(CONFIG_ARCH_RK3188)
 /*
 * define the gpio for sdmmc0
 */
@@ -703,7 +537,7 @@ static struct rksdmmc_gpio_board rksdmmc0_gpio_init = {
         .io             = RK30_PIN3_PA6,
         .enable         = GPIO_HIGH,
         .iomux          = {
-            .name       = "mmc_d2",
+            .name       = "mmc0_d2",
             .fgpio      = GPIO3_A6,
             .fmux       = MMC0_D2,
         },
@@ -713,7 +547,7 @@ static struct rksdmmc_gpio_board rksdmmc0_gpio_init = {
         .io             = RK30_PIN3_PA7,
         .enable         = GPIO_HIGH,
         .iomux          = {
-            .name       = "mmc_d3",
+            .name       = "mmc0_d3",
             .fgpio      = GPIO3_A7,
             .fmux       = MMC0_D3,
         },
@@ -1011,6 +845,184 @@ static struct rksdmmc_gpio_board rksdmmc1_gpio_init = {
 
 };
 // ---end -#if defined(CONFIG_ARCH_RK2928)
+
+#else //default for RK30,RK3066 SDK
+/*
+* define the gpio for sdmmc0
+*/
+struct rksdmmc_gpio_board rksdmmc0_gpio_init = {
+
+     .clk_gpio       = {
+        .io             = RK30_PIN3_PB0,
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = GPIO3B0_SDMMC0CLKOUT_NAME,
+            .fgpio      = GPIO3B_GPIO3B0,
+            .fmux       = GPIO3B_SDMMC0_CLKOUT,
+        },
+    },   
+
+    .cmd_gpio           = {
+        .io             = RK30_PIN3_PB1,
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = GPIO3B1_SDMMC0CMD_NAME,
+            .fgpio      = GPIO3B_GPIO3B1,
+            .fmux       = GPIO3B_SDMMC0_CMD,
+        },
+    },      
+
+   .data0_gpio       = {
+        .io             = RK30_PIN3_PB2,
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = GPIO3B2_SDMMC0DATA0_NAME,
+            .fgpio      = GPIO3B_GPIO3B2,
+            .fmux       = GPIO3B_SDMMC0_DATA0,
+        },
+    },      
+
+    .data1_gpio       = {
+        .io             = RK30_PIN3_PB3,
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = GPIO3B3_SDMMC0DATA1_NAME,
+            .fgpio      = GPIO3B_GPIO3B3,
+            .fmux       = GPIO3B_SDMMC0_DATA1,
+        },
+    },      
+
+    .data2_gpio       = {
+        .io             = RK30_PIN3_PB4,
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = GPIO3B4_SDMMC0DATA2_NAME,
+            .fgpio      = GPIO3B_GPIO3B4,
+            .fmux       = GPIO3B_SDMMC0_DATA2,
+        },
+    }, 
+
+    .data3_gpio       = {
+        .io             = RK30_PIN3_PB5,
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = GPIO3B5_SDMMC0DATA3_NAME,
+            .fgpio      = GPIO3B_GPIO3B5,
+            .fmux       = GPIO3B_SDMMC0_DATA3,
+        },
+    }, 
+    
+    .power_en_gpio      = {   
+#if defined(RK29SDK_SD_CARD_PWR_EN) || (INVALID_GPIO != RK29SDK_SD_CARD_PWR_EN)
+        .io             = RK29SDK_SD_CARD_PWR_EN,
+        .enable         = RK29SDK_SD_CARD_PWR_EN_LEVEL,
+        #ifdef RK29SDK_SD_CARD_PWR_EN_PIN_NAME
+        .iomux          = {
+            .name       = RK29SDK_SD_CARD_PWR_EN_PIN_NAME,
+            #ifdef RK29SDK_SD_CARD_PWR_EN_IOMUX_FGPIO
+            .fgpio      = RK29SDK_SD_CARD_PWR_EN_IOMUX_FGPIO,
+            #endif
+            #ifdef RK29SDK_SD_CARD_PWR_EN_IOMUX_FMUX
+            .fmux       = RK29SDK_SD_CARD_PWR_EN_IOMUX_FMUX,
+            #endif
+        },
+        #endif
+#else
+        .io             = INVALID_GPIO,
+        .enable         = GPIO_LOW,
+#endif
+    }, 
+
+    .detect_irq       = {
+#if defined(RK29SDK_SD_CARD_DETECT_N) || (INVALID_GPIO != RK29SDK_SD_CARD_DETECT_N)  
+        .io             = RK29SDK_SD_CARD_DETECT_N,
+        .enable         = RK29SDK_SD_CARD_INSERT_LEVEL,
+        #ifdef RK29SDK_SD_CARD_DETECT_PIN_NAME
+        .iomux          = {
+            .name       = RK29SDK_SD_CARD_DETECT_PIN_NAME,
+            #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO
+            .fgpio      = RK29SDK_SD_CARD_DETECT_IOMUX_FGPIO,
+            #endif
+            #ifdef RK29SDK_SD_CARD_DETECT_IOMUX_FMUX
+            .fmux       = RK29SDK_SD_CARD_DETECT_IOMUX_FMUX,
+            #endif
+        },
+        #endif
+#else
+        .io             = INVALID_GPIO,
+        .enable         = GPIO_LOW,
+#endif            
+    },
+};
+
+
+/*
+* define the gpio for sdmmc1
+*/
+static struct rksdmmc_gpio_board rksdmmc1_gpio_init = {
+
+     .clk_gpio       = {
+        .io             = RK30_PIN3_PC5,
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = GPIO3C5_SDMMC1CLKOUT_NAME,
+            .fgpio      = GPIO3C_GPIO3C5,
+            .fmux       = GPIO3B_SDMMC0_CLKOUT,
+        },
+    },   
+
+    .cmd_gpio           = {
+        .io             = RK30_PIN3_PC0,
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = GPIO3C0_SMMC1CMD_NAME,
+            .fgpio      = GPIO3C_GPIO3C0,
+            .fmux       = GPIO3B_SDMMC0_CMD,
+        },
+    },      
+
+   .data0_gpio       = {
+        .io             = RK30_PIN3_PC1,
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = GPIO3C1_SDMMC1DATA0_NAME,
+            .fgpio      = GPIO3C_GPIO3C1,
+            .fmux       = GPIO3B_SDMMC0_DATA0,
+        },
+    },      
+
+    .data1_gpio       = {
+        .io             = RK30_PIN3_PC2,
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = GPIO3C2_SDMMC1DATA1_NAME,
+            .fgpio      = GPIO3C_GPIO3C2,
+            .fmux       = GPIO3B_SDMMC0_DATA1,
+        },
+    },      
+
+    .data2_gpio       = {
+        .io             = RK30_PIN3_PC3,
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = GPIO3C3_SDMMC1DATA2_NAME,
+            .fgpio      = GPIO3C_GPIO3C3,
+            .fmux       = GPIO3B_SDMMC0_DATA2,
+        },
+    }, 
+
+    .data3_gpio       = {
+        .io             = RK30_PIN3_PC4,
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = GPIO3C4_SDMMC1DATA3_NAME,
+            .fgpio      = GPIO3C_GPIO3C4,
+            .fmux       = GPIO3B_SDMMC0_DATA3,
+        },
+    }, 
+};
+ // ---end -defualt rk30sdk,rk3066sdk
+
 #endif
 
 
@@ -1042,27 +1054,51 @@ static void rk29_sdmmc_gpio_open(int device_id, int on)
             }
             else
             {
+                #if SDMMC_USE_NEW_IOMUX_API
+                iomux_set_gpio_mode(rksdmmc0_gpio_init.clk_gpio.io);
+                #else
                 rk30_mux_api_set(rksdmmc0_gpio_init.clk_gpio.iomux.name, rksdmmc0_gpio_init.clk_gpio.iomux.fgpio);
+                #endif
                 gpio_request(rksdmmc0_gpio_init.clk_gpio.io, "mmc0-clk");
                 gpio_direction_output(rksdmmc0_gpio_init.clk_gpio.io,GPIO_LOW);//set mmc0-clk to low.
 
+                #if SDMMC_USE_NEW_IOMUX_API
+                iomux_set_gpio_mode(rksdmmc0_gpio_init.cmd_gpio.io);
+                #else
                 rk30_mux_api_set(rksdmmc0_gpio_init.cmd_gpio.iomux.name, rksdmmc0_gpio_init.cmd_gpio.iomux.fgpio);
+                #endif
                 gpio_request(rksdmmc0_gpio_init.cmd_gpio.io, "mmc0-cmd");
                 gpio_direction_output(rksdmmc0_gpio_init.cmd_gpio.io,GPIO_LOW);//set mmc0-cmd to low.
 
+                #if SDMMC_USE_NEW_IOMUX_API
+                iomux_set_gpio_mode(rksdmmc0_gpio_init.data0_gpio.io);
+                #else
                 rk30_mux_api_set(rksdmmc0_gpio_init.data0_gpio.iomux.name, rksdmmc0_gpio_init.data0_gpio.iomux.fgpio);
+                #endif
                 gpio_request(rksdmmc0_gpio_init.data0_gpio.io, "mmc0-data0");
                 gpio_direction_output(rksdmmc0_gpio_init.data0_gpio.io,GPIO_LOW);//set mmc0-data0 to low.
 
+                #if SDMMC_USE_NEW_IOMUX_API
+                iomux_set_gpio_mode(rksdmmc0_gpio_init.data1_gpio.io);
+                #else
                 rk30_mux_api_set(rksdmmc0_gpio_init.data1_gpio.iomux.name, rksdmmc0_gpio_init.data1_gpio.iomux.fgpio);
+                #endif
                 gpio_request(rksdmmc0_gpio_init.data1_gpio.io, "mmc0-data1");
                 gpio_direction_output(rksdmmc0_gpio_init.data1_gpio.io,GPIO_LOW);//set mmc0-data1 to low.
 
+                #if SDMMC_USE_NEW_IOMUX_API
+                iomux_set_gpio_mode(rksdmmc0_gpio_init.data2_gpio.io);
+                #else
                 rk30_mux_api_set(rksdmmc0_gpio_init.data2_gpio.iomux.name, rksdmmc0_gpio_init.data2_gpio.iomux.fgpio);
+                #endif
                 gpio_request(rksdmmc0_gpio_init.data2_gpio.io, "mmc0-data2");
                 gpio_direction_output(rksdmmc0_gpio_init.data2_gpio.io,GPIO_LOW);//set mmc0-data2 to low.
 
+                #if SDMMC_USE_NEW_IOMUX_API
+                iomux_set_gpio_mode(rksdmmc0_gpio_init.data3_gpio.io);
+                #else
                 rk30_mux_api_set(rksdmmc0_gpio_init.data3_gpio.iomux.name, rksdmmc0_gpio_init.data3_gpio.iomux.fgpio);
+                #endif
                 gpio_request(rksdmmc0_gpio_init.data3_gpio.io, "mmc0-data3");
                 gpio_direction_output(rksdmmc0_gpio_init.data3_gpio.io,GPIO_LOW);//set mmc0-data3 to low.
 
@@ -1087,28 +1123,52 @@ static void rk29_sdmmc_gpio_open(int device_id, int on)
             }
             else
             {
+                #if SDMMC_USE_NEW_IOMUX_API
+                iomux_set_gpio_mode(rksdmmc1_gpio_init.clk_gpio.io);
+                #else
                 rk30_mux_api_set(rksdmmc1_gpio_init.clk_gpio.iomux.name, rksdmmc1_gpio_init.clk_gpio.iomux.fgpio);
+                #endif
                 gpio_request(rksdmmc1_gpio_init.clk_gpio.io, "mmc1-clk");
                 gpio_direction_output(rksdmmc1_gpio_init.clk_gpio.io,GPIO_LOW);//set mmc1-clk to low.
 
+                #if SDMMC_USE_NEW_IOMUX_API
+                iomux_set_gpio_mode(rksdmmc1_gpio_init.cmd_gpio.io);
+                #else
                 rk30_mux_api_set(rksdmmc1_gpio_init.cmd_gpio.iomux.name, rksdmmc1_gpio_init.cmd_gpio.iomux.fgpio);
+                #endif
                 gpio_request(rksdmmc1_gpio_init.cmd_gpio.io, "mmc1-cmd");
                 gpio_direction_output(rksdmmc1_gpio_init.cmd_gpio.io,GPIO_LOW);//set mmc1-cmd to low.
 
+                #if SDMMC_USE_NEW_IOMUX_API
+                iomux_set_gpio_mode(rksdmmc1_gpio_init.data0_gpio.io);
+                #else
                 rk30_mux_api_set(rksdmmc1_gpio_init.data0_gpio.iomux.name, rksdmmc1_gpio_init.data0_gpio.iomux.fgpio);
+                #endif
                 gpio_request(rksdmmc1_gpio_init.data0_gpio.io, "mmc1-data0");
                 gpio_direction_output(rksdmmc1_gpio_init.data0_gpio.io,GPIO_LOW);//set mmc1-data0 to low.
                 
             #if defined(CONFIG_WIFI_COMBO_MODULE_CONTROL_FUNC) || defined(CONFIG_MT5931) || defined(CONFIG_MT5931_MT6622)
+                #if SDMMC_USE_NEW_IOMUX_API
+                iomux_set_gpio_mode(rksdmmc1_gpio_init.data1_gpio.io);
+                #else
                 rk29_mux_api_set(rksdmmc1_gpio_init.data1_gpio.iomux.name, rksdmmc1_gpio_init.data1_gpio.iomux.fgpio);
+                #endif
                 gpio_request(rksdmmc1_gpio_init.data1_gpio.io, "mmc1-data1");
                 gpio_direction_output(rksdmmc1_gpio_init.data1_gpio.io,GPIO_LOW);//set mmc1-data1 to low.
 
+                #if SDMMC_USE_NEW_IOMUX_API
+                iomux_set_gpio_mode(rksdmmc1_gpio_init.data2_gpio.io);
+                #else
                 rk29_mux_api_set(rksdmmc1_gpio_init.data2_gpio.iomux.name, rksdmmc1_gpio_init.data2_gpio.iomux.fgpio);
+                #endif
                 gpio_request(rksdmmc1_gpio_init.data2_gpio.io, "mmc1-data2");
                 gpio_direction_output(rksdmmc1_gpio_init.data2_gpio.io,GPIO_LOW);//set mmc1-data2 to low.
 
+                #if SDMMC_USE_NEW_IOMUX_API
+                iomux_set_gpio_mode(rksdmmc1_gpio_init.data3_gpio.io);
+                #else
                 rk29_mux_api_set(rksdmmc1_gpio_init.data3_gpio.iomux.name, rksdmmc1_gpio_init.data3_gpio.iomux.fgpio);
+                #endif
                 gpio_request(rksdmmc1_gpio_init.data3_gpio.io, "mmc1-data3");
                 gpio_direction_output(rksdmmc1_gpio_init.data3_gpio.io,GPIO_LOW);//set mmc1-data3 to low.
            #endif
@@ -1133,9 +1193,15 @@ static void rk29_sdmmc_set_iomux_mmc0(unsigned int bus_width)
         
        case 1://SDMMC_CTYPE_4BIT:
        {
+           #if SDMMC_USE_NEW_IOMUX_API
+            iomux_set(rksdmmc0_gpio_init.data1_gpio.iomux.fmux);
+            iomux_set(rksdmmc0_gpio_init.data2_gpio.iomux.fmux);
+            iomux_set(rksdmmc0_gpio_init.data3_gpio.iomux.fmux);
+           #else
                rk30_mux_api_set(rksdmmc0_gpio_init.data1_gpio.iomux.name, rksdmmc0_gpio_init.data1_gpio.iomux.fmux);
                rk30_mux_api_set(rksdmmc0_gpio_init.data2_gpio.iomux.name, rksdmmc0_gpio_init.data2_gpio.iomux.fmux);
                rk30_mux_api_set(rksdmmc0_gpio_init.data3_gpio.iomux.name, rksdmmc0_gpio_init.data3_gpio.iomux.fmux);
+               #endif
        }
        break;
 
@@ -1143,7 +1209,11 @@ static void rk29_sdmmc_set_iomux_mmc0(unsigned int bus_width)
            break;
        case 0xFFFF: //gpio_reset
        {
+           #if SDMMC_USE_NEW_IOMUX_API
+            iomux_set_gpio_mode(rksdmmc0_gpio_init.power_en_gpio.io);
+            #else
             rk30_mux_api_set(rksdmmc0_gpio_init.power_en_gpio.iomux.name, rksdmmc0_gpio_init.power_en_gpio.iomux.fgpio);
+            #endif
             gpio_request(rksdmmc0_gpio_init.power_en_gpio.io,"sdmmc-power");
             gpio_direction_output(rksdmmc0_gpio_init.power_en_gpio.io, !(rksdmmc0_gpio_init.power_en_gpio.enable)); //power-off
 
@@ -1159,19 +1229,37 @@ static void rk29_sdmmc_set_iomux_mmc0(unsigned int bus_width)
 
        default: //case 0://SDMMC_CTYPE_1BIT:
         {
+            #if SDMMC_USE_NEW_IOMUX_API
+               iomux_set(rksdmmc0_gpio_init.cmd_gpio.iomux.fmux);
+               iomux_set(rksdmmc0_gpio_init.clk_gpio.iomux.fmux);
+               iomux_set(rksdmmc0_gpio_init.data0_gpio.iomux.fmux);
+            #else
                rk30_mux_api_set(rksdmmc0_gpio_init.cmd_gpio.iomux.name, rksdmmc0_gpio_init.cmd_gpio.iomux.fmux);
                rk30_mux_api_set(rksdmmc0_gpio_init.clk_gpio.iomux.name, rksdmmc0_gpio_init.clk_gpio.iomux.fmux);
                rk30_mux_api_set(rksdmmc0_gpio_init.data0_gpio.iomux.name, rksdmmc0_gpio_init.data0_gpio.iomux.fmux);
+               #endif
 
+            #if SDMMC_USE_NEW_IOMUX_API
+            iomux_set_gpio_mode(rksdmmc0_gpio_init.data1_gpio.io);
+            #else
             rk30_mux_api_set(rksdmmc0_gpio_init.data1_gpio.iomux.name, rksdmmc0_gpio_init.data1_gpio.iomux.fgpio);
+            #endif
             gpio_request(rksdmmc0_gpio_init.data1_gpio.io, "mmc0-data1");
             gpio_direction_output(rksdmmc0_gpio_init.data1_gpio.io,GPIO_HIGH);//set mmc0-data1 to high.
 
+            #if SDMMC_USE_NEW_IOMUX_API
+            iomux_set_gpio_mode(rksdmmc0_gpio_init.data2_gpio.io);
+            #else
             rk30_mux_api_set(rksdmmc0_gpio_init.data2_gpio.iomux.name, rksdmmc0_gpio_init.data2_gpio.iomux.fgpio);
+            #endif
             gpio_request(rksdmmc0_gpio_init.data2_gpio.io, "mmc0-data2");
             gpio_direction_output(rksdmmc0_gpio_init.data2_gpio.io,GPIO_HIGH);//set mmc0-data2 to high.
 
+            #if SDMMC_USE_NEW_IOMUX_API
+            iomux_set_gpio_mode(rksdmmc0_gpio_init.data3_gpio.io);
+            #else
             rk30_mux_api_set(rksdmmc0_gpio_init.data3_gpio.iomux.name, rksdmmc0_gpio_init.data3_gpio.iomux.fgpio);
+            #endif
             gpio_request(rksdmmc0_gpio_init.data3_gpio.io, "mmc0-data3");
             gpio_direction_output(rksdmmc0_gpio_init.data3_gpio.io,GPIO_HIGH);//set mmc0-data3 to high.
        }
@@ -1181,12 +1269,21 @@ static void rk29_sdmmc_set_iomux_mmc0(unsigned int bus_width)
 
 static void rk29_sdmmc_set_iomux_mmc1(unsigned int bus_width)
 {
+    #if SDMMC_USE_NEW_IOMUX_API
+    iomux_set(rksdmmc1_gpio_init.cmd_gpio.iomux.fmux);
+    iomux_set(rksdmmc1_gpio_init.clk_gpio.iomux.fmux);
+    iomux_set(rksdmmc1_gpio_init.data0_gpio.iomux.fmux);
+    iomux_set(rksdmmc1_gpio_init.data1_gpio.iomux.fmux);
+    iomux_set(rksdmmc1_gpio_init.data2_gpio.iomux.fmux);
+    iomux_set(rksdmmc1_gpio_init.data3_gpio.iomux.fmux);
+    #else
     rk30_mux_api_set(rksdmmc1_gpio_init.cmd_gpio.iomux.name, rksdmmc1_gpio_init.cmd_gpio.iomux.fmux);
     rk30_mux_api_set(rksdmmc1_gpio_init.clk_gpio.iomux.name, rksdmmc1_gpio_init.clk_gpio.iomux.fmux);
     rk30_mux_api_set(rksdmmc1_gpio_init.data0_gpio.iomux.name, rksdmmc1_gpio_init.data0_gpio.iomux.fmux);
     rk30_mux_api_set(rksdmmc1_gpio_init.data1_gpio.iomux.name, rksdmmc1_gpio_init.data1_gpio.iomux.fmux);
     rk30_mux_api_set(rksdmmc1_gpio_init.data2_gpio.iomux.name, rksdmmc1_gpio_init.data2_gpio.iomux.fmux);
     rk30_mux_api_set(rksdmmc1_gpio_init.data3_gpio.iomux.name, rksdmmc1_gpio_init.data3_gpio.iomux.fmux);
+    #endif
 }
 
 static void rk29_sdmmc_set_iomux_mmc2(unsigned int bus_width)