add mu509 for rk30
author赵子初 <zzc@rock-chips.com>
Mon, 9 Jul 2012 07:15:54 +0000 (15:15 +0800)
committer赵子初 <zzc@rock-chips.com>
Mon, 9 Jul 2012 07:15:54 +0000 (15:15 +0800)
arch/arm/mach-rk30/board-rk30-sdk.c
drivers/misc/mu509.c

index 55fa1c7fce37b05574d07a34b29c9441363d26a5..9d9e8aabfd09137ea9d161b316c6eee775b21ee5 100755 (executable)
@@ -51,6 +51,9 @@
 #if defined(CONFIG_SPIM_RK29)
 #include "../../../drivers/spi/rk29_spim.h"
 #endif
+#if defined(CONFIG_MU509)
+#include <linux/mu509.h>
+#endif
 #if defined(CONFIG_ANDROID_TIMED_GPIO)
 #include "../../../drivers/staging/android/timed_gpio.h"
 #endif
@@ -680,6 +683,40 @@ static struct platform_device rk30_device_modem = {
        }
 };
 #endif
+#if defined(CONFIG_MU509)
+static int mu509_io_init(void)
+{
+
+       rk30_mux_api_set(GPIO2B6_LCDC1DATA14_SMCADDR18_TSSYNC_NAME, GPIO2B_GPIO2B6);
+        rk30_mux_api_set(GPIO4D2_SMCDATA10_TRACEDATA10_NAME, GPIO4D_GPIO4D2);
+       rk30_mux_api_set(GPIO2B7_LCDC1DATA15_SMCADDR19_HSADCDATA7_NAME, GPIO2B_GPIO2B7);
+       rk30_mux_api_set(GPIO2C0_LCDCDATA16_GPSCLK_HSADCCLKOUT_NAME, GPIO2C_GPIO2C0);
+       return 0;
+}
+
+static int mu509_io_deinit(void)
+{
+       
+       return 0;
+}
+struct rk29_mu509_data rk29_mu509_info = {
+       .io_init = mu509_io_init,
+       .io_deinit = mu509_io_deinit,
+       .modem_power_en = RK30_PIN6_PB2,//RK30_PIN4_PD1,
+       .bp_power = RK30_PIN2_PB6,//RK30_PIN4_PD1,
+       .bp_reset = RK30_PIN4_PD2,
+       .ap_wakeup_bp = RK30_PIN2_PB7,
+       .bp_wakeup_ap = RK30_PIN6_PA0, 
+};
+struct platform_device rk29_device_mu509 = {   
+        .name = "mu509",       
+       .id = -1,       
+       .dev            = {
+               .platform_data = &rk29_mu509_info,
+       }       
+    };
+#endif
 
 /*MMA8452 gsensor*/
 #if defined (CONFIG_GS_MMA8452)
@@ -1279,6 +1316,9 @@ static struct platform_device *devices[] __initdata = {
 #ifdef CONFIG_RK29_SUPPORT_MODEM
        &rk30_device_modem,
 #endif
+#if defined(CONFIG_MU509)
+       &rk29_device_mu509,
+#endif
 #ifdef CONFIG_BATTERY_RK30_ADC
        &rk30_device_adc_battery,
 #endif
index 7391fa636e8a435ae193c1526baa0da44dcf2f67..6c951b069bd3f8824a6c9c99254010385ad3e8b3 100755 (executable)
@@ -36,7 +36,12 @@ MODULE_LICENSE("GPL");
 static struct wake_lock modem_wakelock;
 #define IRQ_BB_WAKEUP_AP_TRIGGER    IRQF_TRIGGER_FALLING
 //#define IRQ_BB_WAKEUP_AP_TRIGGER    IRQF_TRIGGER_RISING
+#if defined(CONFIG_ARCH_RK29)
 #define airplane_mode RK29_PIN6_PC1
+#endif
+#if defined(CONFIG_ARCH_RK30)
+#define airplane_mode  RK30_PIN2_PC0
+#endif
 #define MU509_RESET 0x01
 #define AIRPLANE_MODE_OFF 0x03
 #define AIRPLANE_MODE_ON 0x00
@@ -307,8 +312,13 @@ int mu509_suspend(struct platform_device *pdev, pm_message_t state)
        //MODEMDBG("-------------%s\n",__FUNCTION__);
        if(!online)
        ap_wakeup_bp(pdev, 1);
+#if defined(CONFIG_ARCH_RK29)
        rk29_mux_api_set(GPIO1C1_UART0RTSN_SDMMC1WRITEPRT_NAME, GPIO1H_GPIO1C1);
        //gpio_direction_output(RK29_PIN1_PC1, 1);
+#endif
+#if defined(CONFIG_ARCH_RK30)
+       rk30_mux_api_set(GPIO1A7_UART1RTSN_SPI0TXD_NAME, GPIO1A_GPIO1A7);
+#endif 
        return 0;
 }
 
@@ -316,7 +326,12 @@ int mu509_resume(struct platform_device *pdev)
 {
        //MODEMDBG("-------------%s\n",__FUNCTION__);
        //ap_wakeup_bp(pdev, 0);
+#if defined(CONFIG_ARCH_RK29)
        rk29_mux_api_set(GPIO1C1_UART0RTSN_SDMMC1WRITEPRT_NAME, GPIO1H_UART0_RTS_N);
+#endif
+#if defined(CONFIG_ARCH_RK30)
+       rk30_mux_api_set(GPIO1A7_UART1RTSN_SPI0TXD_NAME, GPIO1A_UART1_RTS_N);
+#endif
        if(gpio_get_value(gpdata->bp_wakeup_ap))
        {
                schedule_delayed_work(&wakeup_work, 2*HZ);