Replace Trout specific parts with Pandora specific stuff
authorGrazvydas Ignotas <notasas@gmail.com>
Wed, 14 Jan 2009 13:25:43 +0000 (15:25 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Sat, 24 Jan 2009 21:53:58 +0000 (23:53 +0200)
sta_dk_4_0_4_32/pform/linux/inc/esta_drv.h
sta_dk_4_0_4_32/pform/linux/src/esta_drv.c
sta_dk_4_0_4_32/pform/linux/src/osapi.c

index a1d27c9..14a5dd4 100644 (file)
@@ -79,13 +79,15 @@ void *wifi_kernel_prealloc(int section, unsigned long size);
 #include <linux/wifi_tiwlan.h>
 int msm_wifi_power(int on);
 int msm_wifi_reset(int on);
-#else
+#elif 0
 extern int trout_wifi_power(int on);
 extern int trout_wifi_reset(int on);
 extern int trout_wifi_set_carddetect(int val);
 #define msm_wifi_power(a)      trout_wifi_power(a)
 #define msm_wifi_reset(a)      trout_wifi_reset(a)
 #endif
+#define PANDORA_WIFI_GPIO 23
+extern void omap_mmc_fake_detect_mmc3(int is_in);
 #endif
 
 #ifndef TIWLAN_OMAP1610_REGBASE
index 8999333..1829b90 100644 (file)
@@ -443,7 +443,7 @@ static int tiwlan_deb_write_proc(struct file *file, const char *buffer,
     return buflen;
 }
 
-#ifdef TIWLAN_MSM7000
+#if 0 /* def TIWLAN_MSM7000 */
 #define WIFI_NVS_LEN_OFFSET     0x0C
 #define WIFI_NVS_DATA_OFFSET    0x40
 #define WIFI_NVS_MAX_SIZE       0x800UL
@@ -1741,7 +1741,9 @@ int omap1610_drv_create(void)
 
 #ifdef TIWLAN_MSM7000
 
-#define TROUT_IRQ MSM_GPIO_TO_INT(29)
+#include <mach/gpio.h>
+
+#define PANDORA_WIFI_IRQ OMAP_GPIO_IRQ(21)
 
 static void tiwlan_sdio_irq(struct sdio_func *func)
 {
@@ -1798,7 +1800,7 @@ static int tiwlan_sdio_probe(struct sdio_func *func, const struct sdio_device_id
 
        SDIO_SetFunc( func );
 
-       rc = tiwlan_create_drv(0, 0, 0, 0, 0, TROUT_IRQ, NULL, NULL);
+       rc = tiwlan_create_drv(0, 0, 0, 0, 0, PANDORA_WIFI_IRQ, NULL, NULL);
 
        printk(KERN_INFO "TIWLAN: Driver initialized (rc %d)\n", rc);
        complete(&sdio_wait);
@@ -1945,11 +1947,27 @@ static int __init tiwlan_module_init(void)
 #elif defined(TIWLAN_MSM7000)
 #ifdef CONFIG_WIFI_CONTROL_FUNC
     wifi_add_dev();
-#else
+#elif 0
     trout_wifi_power(1);          /* Power On */
     trout_wifi_reset(0);          /* Reset clear */
     trout_wifi_set_carddetect(1); /* CardDetect (0->1) */
 #endif
+    rc = gpio_request(PANDORA_WIFI_GPIO, "wifi");
+    if (rc != 0) {
+        printk(KERN_ERR "can't get wifi GPIO\n");
+        return rc;
+    }
+
+    rc = gpio_direction_output(PANDORA_WIFI_GPIO, 1);
+    if (rc != 0) {
+        gpio_free(PANDORA_WIFI_GPIO);
+        printk(KERN_ERR "can't set wifi GPIO out\n");
+        return rc;
+    }
+
+    msleep(50);
+
+    omap_mmc_fake_detect_mmc3(1);
 
     /* Register ourselves as an SDIO driver */
     rc = sdio_register_driver(&tiwlan_sdio_drv);
@@ -1959,24 +1977,30 @@ static int __init tiwlan_module_init(void)
     }
     /* rc = tiwlan_create_drv(0, 0, 0, 0, 0, TROUT_IRQ, NULL, NULL); -- Called in probe */
 
+#if 0
     tiwlan_calibration = create_proc_entry("calibration", 0644, NULL);
     if (tiwlan_calibration == NULL)
        return -EINVAL;
     tiwlan_calibration->size = tiwlan_get_nvs_size();
     tiwlan_calibration->read_proc = tiwlan_calibration_read_proc;
     tiwlan_calibration->write_proc = tiwlan_calibration_write_proc;
+#endif
 
     if (!wait_for_completion_timeout(&sdio_wait, msecs_to_jiffies(10000))) {
         printk(KERN_ERR "%s: Timed out waiting for device detect\n", __func__);
+#if 0
         remove_proc_entry("calibration", NULL);
+#endif
         sdio_unregister_driver(&tiwlan_sdio_drv);
 #ifdef CONFIG_WIFI_CONTROL_FUNC
                wifi_del_dev();
-#else  
+#elif 0
         trout_wifi_set_carddetect(0); /* CardDetect (1->0) */
         trout_wifi_reset(1);          /* Reset active */
         trout_wifi_power(0);          /* Power Off */
-#endif 
+#endif
+        gpio_set_value(PANDORA_WIFI_GPIO, 0);
+        gpio_free(PANDORA_WIFI_GPIO);
         return -ENODEV;
     }
     printk(KERN_INFO "TIWLAN: Driver loaded\n");
@@ -2010,11 +2034,15 @@ static void __exit tiwlan_module_cleanup(void)
     sdio_unregister_driver(&tiwlan_sdio_drv);
 #ifdef CONFIG_WIFI_CONTROL_FUNC
     wifi_del_dev();
-#else    
+#elif 0
     trout_wifi_set_carddetect(0); /* CardDetect (1->0) */
     trout_wifi_reset(1);          /* Reset active */
     trout_wifi_power(0);          /* Power Off */
 #endif    
+    gpio_set_value(PANDORA_WIFI_GPIO, 0);
+    gpio_free(PANDORA_WIFI_GPIO);
+    msleep(50);
+    omap_mmc_fake_detect_mmc3(0);
 #endif
     printk(KERN_INFO "TIWLAN: Driver unloaded\n");
 }
index ee7c270..86d3d2c 100644 (file)
@@ -849,12 +849,17 @@ os_hardResetTnetw( void )
     /* wait for 50msec */
     mdelay(50);
 #endif /* Dm: */
-#ifdef TIWLAN_MSM7000
+#if 0 /* def TIWLAN_MSM7000 */
     msm_wifi_reset(1); /* Reset active */
     msm_wifi_power(0); /* Power disable */
     msm_wifi_power(1); /* Power enable */
     msm_wifi_reset(0); /* Reset clear */
 #endif
+    gpio_set_value(PANDORA_WIFI_GPIO, 0);
+    mdelay(50);
+    gpio_set_value(PANDORA_WIFI_GPIO, 1);
+    mdelay(50);
+    omap_mmc_fake_detect_mmc3(1);
 }