Send commitlog mailing list submissions to
        commitlog@lists.openmoko.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r4715 - developers/werner/wlan-spi/patches-tracking
      ([EMAIL PROTECTED])
   2. r4716 - developers/werner/wlan-spi/patches-tracking
      ([EMAIL PROTECTED])
--- Begin Message ---
Author: werner
Date: 2008-10-16 03:19:51 +0200 (Thu, 16 Oct 2008)
New Revision: 4715

Added:
   developers/werner/wlan-spi/patches-tracking/s3c-spi-fix-int-mode.patch
Modified:
   developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi-bitbang.patch
   developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi.patch
   developers/werner/wlan-spi/patches-tracking/series
Log:
- rebasing continues ...
- gta02-mmc-spi-bitbang.patch: make arch/arm/mach-s3c2440/mach-gta02.c
  (gta02_spi_mmc_bdinfo) an array, to better match style of similar uses
- gta02-mmc-spi.patch: added board and driver registration and updated for new
  style



Modified: 
developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi-bitbang.patch
===================================================================
--- developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi-bitbang.patch     
2008-10-16 00:50:32 UTC (rev 4714)
+++ developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi-bitbang.patch     
2008-10-16 01:19:51 UTC (rev 4715)
@@ -13,8 +13,8 @@
 
 Index: ktrack/arch/arm/mach-s3c2440/Kconfig
 ===================================================================
---- ktrack.orig/arch/arm/mach-s3c2440/Kconfig  2008-10-15 22:15:23.000000000 
-0200
-+++ ktrack/arch/arm/mach-s3c2440/Kconfig       2008-10-15 22:27:33.000000000 
-0200
+--- ktrack.orig/arch/arm/mach-s3c2440/Kconfig  2008-10-15 22:30:39.000000000 
-0200
++++ ktrack/arch/arm/mach-s3c2440/Kconfig       2008-10-15 23:09:15.000000000 
-0200
 @@ -99,6 +99,20 @@
           Say Y here if you are using an early hardware revision
           of the FIC/Openmoko Neo1973 GTA02 GSM Phone.
@@ -38,8 +38,8 @@
  #source "arch/arm/mach-s3c2440/camera/Kconfig"
 Index: ktrack/arch/arm/mach-s3c2440/mach-gta02.c
 ===================================================================
---- ktrack.orig/arch/arm/mach-s3c2440/mach-gta02.c     2008-10-15 
22:15:23.000000000 -0200
-+++ ktrack/arch/arm/mach-s3c2440/mach-gta02.c  2008-10-15 22:27:52.000000000 
-0200
+--- ktrack.orig/arch/arm/mach-s3c2440/mach-gta02.c     2008-10-15 
22:30:39.000000000 -0200
++++ ktrack/arch/arm/mach-s3c2440/mach-gta02.c  2008-10-15 23:09:56.000000000 
-0200
 @@ -37,6 +37,7 @@
  #include <linux/spi/spi.h>
  #include <linux/spi/glamo.h>
@@ -48,7 +48,7 @@
  #include <linux/mmc/host.h>
  
  #include <linux/mtd/mtd.h>
-@@ -1223,6 +1224,85 @@
+@@ -1223,6 +1224,87 @@
        },
  };
  
@@ -60,13 +60,15 @@
 +
 +#if defined(CONFIG_AR6K_SPI_S3C24XX_GPIO)
 +
-+static struct spi_board_info gta02_spi_mmc_bdinfo = {
-+      .modalias       = "mmc_spi",
-+      .irq            = IRQ_EINT3,    /* unused ? */
-+      .max_speed_hz   = 12 * 1000 * 1000,
-+      .bus_num        = 0,
-+      .chip_select    = 0,
-+      .mode           = SPI_MODE_0,
++static struct spi_board_info gta02_spi_mmc_bdinfo[] = {
++      {
++              .modalias       = "mmc_spi",
++              .irq            = IRQ_EINT3,    /* unused ? */
++              .max_speed_hz   = 12 * 1000 * 1000,
++              .bus_num        = 0,
++              .chip_select    = 0,
++              .mode           = SPI_MODE_0,
++      }
 +};
 +
 +#endif /* CONFIG_AR6K_SPI_S3C24XX_GPIO */
@@ -91,8 +93,8 @@
 +      .pin_clk        = S3C2410_GPE5,
 +      .pin_mosi       = S3C2410_GPE6,
 +      .pin_miso       = S3C2410_GPE7,
-+      .board_size     = 1,
-+      .board_info     = &gta02_spi_mmc_bdinfo,
++      .board_size     = ARRAY_SIZE(gta02_spi_mmc_bdinfo),
++      .board_info     = gta02_spi_mmc_bdinfo,
 +      .chip_select    = &spi_wlan_cs,
 +      .num_chipselect = 1,
 +};
@@ -134,7 +136,7 @@
  static struct resource gta02_led_resources[] = {
        {
                .name   = "gta02-power:orange",
-@@ -1638,7 +1718,13 @@
+@@ -1638,7 +1720,13 @@
        s3c2410_gpio_pullup(S3C2410_GPF3, 1);
        s3c2410_gpio_pullup(S3C2410_GPG2, 1);
  

Modified: developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi.patch
===================================================================
--- developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi.patch     
2008-10-16 00:50:32 UTC (rev 4714)
+++ developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi.patch     
2008-10-16 01:19:51 UTC (rev 4715)
@@ -12,8 +12,8 @@
 
 Index: ktrack/arch/arm/mach-s3c2440/Kconfig
 ===================================================================
---- ktrack.orig/arch/arm/mach-s3c2440/Kconfig  2008-10-15 22:04:35.000000000 
-0200
-+++ ktrack/arch/arm/mach-s3c2440/Kconfig       2008-10-15 22:05:19.000000000 
-0200
+--- ktrack.orig/arch/arm/mach-s3c2440/Kconfig  2008-10-15 23:09:15.000000000 
-0200
++++ ktrack/arch/arm/mach-s3c2440/Kconfig       2008-10-15 23:10:08.000000000 
-0200
 @@ -111,6 +111,15 @@
                  bool "GPIO bit-banging SPI"
                  select MMC_SPI
@@ -32,8 +32,8 @@
  endmenu
 Index: ktrack/arch/arm/mach-s3c2440/mach-gta02.c
 ===================================================================
---- ktrack.orig/arch/arm/mach-s3c2440/mach-gta02.c     2008-10-15 
22:04:35.000000000 -0200
-+++ ktrack/arch/arm/mach-s3c2440/mach-gta02.c  2008-10-15 22:06:25.000000000 
-0200
+--- ktrack.orig/arch/arm/mach-s3c2440/mach-gta02.c     2008-10-15 
23:09:56.000000000 -0200
++++ ktrack/arch/arm/mach-s3c2440/mach-gta02.c  2008-10-15 23:10:08.000000000 
-0200
 @@ -1228,9 +1228,7 @@
  /* ----- AR6000 WLAN interface --------------------------------------------- 
*/
  
@@ -43,10 +43,10 @@
 -#if defined(CONFIG_AR6K_SPI_S3C24XX_GPIO)
 +#if defined(CONFIG_AR6K_SPI_S3C24XX) || defined(CONFIG_AR6K_SPI_S3C24XX_GPIO)
  
- static struct spi_board_info gta02_spi_mmc_bdinfo = {
-       .modalias       = "mmc_spi",
-@@ -1241,7 +1239,18 @@
-       .mode           = SPI_MODE_0,
+ static struct spi_board_info gta02_spi_mmc_bdinfo[] = {
+       {
+@@ -1243,7 +1241,18 @@
+       }
  };
  
 -#endif /* CONFIG_AR6K_SPI_S3C24XX_GPIO */
@@ -57,11 +57,25 @@
 +
 +static struct s3c2410_spi_info spi_wlan_cfg = {
 +      .pin_cs         = S3C2410_GPG2,
-+      .board_size     = 1,
-+      .board_info     = &gta02_spi_mmc_bdinfo,
++      .num_cs         = 1,
++      .bus_num        = 0, /* link to gta02_spi_mmc_bdinfo */
 +};
 +
 +#endif /* CONFIG_AR6K_SPI_S3C24XX */
  
  
  #ifdef CONFIG_AR6K_SPI_S3C24XX_GPIO
+@@ -1750,6 +1759,13 @@
+       }
+ #endif
+ 
++#ifdef CONFIG_AR6K_SPI_S3C24XX
++      spi_register_board_info(gta02_spi_mmc_bdinfo,
++          ARRAY_SIZE(gta02_spi_mmc_bdinfo));
++      s3c_device_spi0.dev.platform_data = &spi_wlan_cfg;
++      platform_device_register(&s3c_device_spi0);
++#endif /* CONFIG_AR6K_SPI_S3C24XX */
++
+         i2c_register_board_info(0, gta02_i2c_devs,
+                 ARRAY_SIZE(gta02_i2c_devs));
+ 

Added: developers/werner/wlan-spi/patches-tracking/s3c-spi-fix-int-mode.patch
===================================================================
--- developers/werner/wlan-spi/patches-tracking/s3c-spi-fix-int-mode.patch      
                        (rev 0)
+++ developers/werner/wlan-spi/patches-tracking/s3c-spi-fix-int-mode.patch      
2008-10-16 01:19:51 UTC (rev 4715)
@@ -0,0 +1,63 @@
+Work in progress. Makes spi_s3c24xx.c work for up to 12MHz.
+
+At speeds of 13MHz or higher, we have setup time issues. I.e., the
+SPI host sees the data coming from the device delayed by one bit,
+even though things look fine on the scope.
+
+This 12MHz/13MHz "barrier" exists with or without probes attached,
+suggesting capacitative loading plays only a minor role in this.
+
+Index: ktrack/drivers/spi/spi_s3c24xx.c
+===================================================================
+--- ktrack.orig/drivers/spi/spi_s3c24xx.c      2008-10-10 10:52:14.000000000 
-0200
++++ ktrack/drivers/spi/spi_s3c24xx.c   2008-10-15 23:14:27.000000000 -0200
+@@ -199,6 +199,27 @@
+ 
+       wait_for_completion(&hw->done);
+ 
++      /*
++       * Get the last byte. Since we don't have more data we can send in
++       * order to clock the byte out of the SPI system, we need to wait.
++       *
++       * Duh, I'm just handwaving here about possible explanations of what's
++       * going on in the hardware. This is the voodoo ritual that makes it
++       * work while anything else fails.
++       */
++      if (hw->rx && hw->count) {
++              udelay(1+10*1000000/spi->max_speed_hz);
++              hw->rx[hw->count-1] = readb(hw->regs + S3C2410_SPRDAT);
++      }
++
++      if (0&&t->rx_buf && t->len > 18) {
++              int i;
++
++              printk(KERN_INFO "RX (%p):", t->rx_buf);
++              for (i = 0; i != t->len; i++)
++                      printk(" %02x", ((u8 *) t->rx_buf)[i]);
++              printk("\n");
++      }
+       return hw->count;
+ }
+ 
+@@ -222,8 +243,19 @@
+ 
+       hw->count++;
+ 
+-      if (hw->rx)
+-              hw->rx[count] = readb(hw->regs + S3C2410_SPRDAT);
++      /*
++       * Misfeature #1: the first byte received can only be read after
++       * writing the second byte to send to the shifter.
++       *
++       * Misfeature #2: we need to consume the byte preceding the first byte
++       * or the SPI engine gets upset.
++       */
++      if (hw->rx) {
++              u8 b = readb(hw->regs + S3C2410_SPRDAT);
++
++              if (count)
++                      hw->rx[count-1] = b;
++      }
+ 
+       count++;
+ 

Modified: developers/werner/wlan-spi/patches-tracking/series
===================================================================
--- developers/werner/wlan-spi/patches-tracking/series  2008-10-16 00:50:32 UTC 
(rev 4714)
+++ developers/werner/wlan-spi/patches-tracking/series  2008-10-16 01:19:51 UTC 
(rev 4715)
@@ -14,3 +14,4 @@
 hif-linux-sdio.patch
 gta02-mmc-spi-bitbang.patch
 gta02-mmc-spi.patch
+s3c-spi-fix-int-mode.patch 




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2008-10-16 05:55:15 +0200 (Thu, 16 Oct 2008)
New Revision: 4716

Added:
   developers/werner/wlan-spi/patches-tracking/gta02-mmc-mci.patch
   developers/werner/wlan-spi/patches-tracking/hack-dont-poll-irq.patch
   developers/werner/wlan-spi/patches-tracking/hif-can-do-async.patch
   developers/werner/wlan-spi/patches-tracking/hif-direct-interrupt.patch
   developers/werner/wlan-spi/patches-tracking/s3c-spi-from-int-to-poll.patch
Modified:
   developers/werner/wlan-spi/patches-tracking/series
Log:
- ... rebasing finishes
- hif-can-do-async.patch: only enable async if we're using direct interrupts



Added: developers/werner/wlan-spi/patches-tracking/gta02-mmc-mci.patch
===================================================================
--- developers/werner/wlan-spi/patches-tracking/gta02-mmc-mci.patch             
                (rev 0)
+++ developers/werner/wlan-spi/patches-tracking/gta02-mmc-mci.patch     
2008-10-16 03:55:15 UTC (rev 4716)
@@ -0,0 +1,36 @@
+Almost there !
+
+In two successive tries, enabling this driver killed I2C.
+Nothing like that happened after a rebuild. Odd.
+
+Index: ktrack/arch/arm/mach-s3c2440/Kconfig
+===================================================================
+--- ktrack.orig/arch/arm/mach-s3c2440/Kconfig  2008-10-15 23:10:08.000000000 
-0200
++++ ktrack/arch/arm/mach-s3c2440/Kconfig       2008-10-16 01:31:08.000000000 
-0200
+@@ -120,6 +120,10 @@
+                 This functionality requires that SPI0 is wired to
+                 the WLAN SDIO interface.
+ 
++      config AR6K_S3CMCI
++              bool "S3C MMC/SD/SDIO driver"
++              select MMC_S3C
++
+ endchoice
+ 
+ endmenu
+Index: ktrack/arch/arm/mach-s3c2440/mach-gta02.c
+===================================================================
+--- ktrack.orig/arch/arm/mach-s3c2440/mach-gta02.c     2008-10-15 
23:10:08.000000000 -0200
++++ ktrack/arch/arm/mach-s3c2440/mach-gta02.c  2008-10-16 01:31:08.000000000 
-0200
+@@ -1693,6 +1693,11 @@
+       mangle_glamo_res_by_system_rev();
+       platform_device_register(&gta02_glamo_dev);
+ 
++#ifdef CONFIG_AR6K_S3CMCI
++      s3c_device_sdi.dev.platform_data = NULL;
++      platform_device_register(&s3c_device_sdi); /* @@@ just for testing */
++#endif /* CONFIG_AR6K_S3CMCI */
++
+ #ifdef CONFIG_AR6K_SPI_S3C24XX
+ 
+       printk(KERN_INFO "SPI/MMC co-existence: disabling SD/MMC\n");

Added: developers/werner/wlan-spi/patches-tracking/hack-dont-poll-irq.patch
===================================================================
--- developers/werner/wlan-spi/patches-tracking/hack-dont-poll-irq.patch        
                        (rev 0)
+++ developers/werner/wlan-spi/patches-tracking/hack-dont-poll-irq.patch        
2008-10-16 03:55:15 UTC (rev 4716)
@@ -0,0 +1,33 @@
+The interrupt polling interferes with monitoring of the SDIO transactions.
+Disable it when debugging.
+
+Index: ktrack/drivers/mmc/core/sdio_irq.c
+===================================================================
+--- ktrack.orig/drivers/mmc/core/sdio_irq.c    2008-10-10 10:52:06.000000000 
-0200
++++ ktrack/drivers/mmc/core/sdio_irq.c 2008-10-16 01:15:05.000000000 -0200
+@@ -70,7 +70,7 @@
+       unsigned long period, idle_period;
+       int ret;
+ 
+-      sched_setscheduler(current, SCHED_FIFO, &param);
++//    sched_setscheduler(current, SCHED_FIFO, &param);
+ 
+       /*
+        * We want to allow for SDIO cards to work even on non SDIO
+@@ -102,7 +102,7 @@
+               ret = __mmc_claim_host(host, &host->sdio_irq_thread_abort);
+               if (ret)
+                       break;
+-              ret = process_sdio_pending_irqs(host->card);
++//            ret = process_sdio_pending_irqs(host->card);
+               mmc_release_host(host);
+ 
+               /*
+@@ -128,6 +128,7 @@
+                       }
+               }
+ 
++yield();
+               set_current_state(TASK_INTERRUPTIBLE);
+               if (host->caps & MMC_CAP_SDIO_IRQ)
+                       host->ops->enable_sdio_irq(host, 1);

Added: developers/werner/wlan-spi/patches-tracking/hif-can-do-async.patch
===================================================================
--- developers/werner/wlan-spi/patches-tracking/hif-can-do-async.patch          
                (rev 0)
+++ developers/werner/wlan-spi/patches-tracking/hif-can-do-async.patch  
2008-10-16 03:55:15 UTC (rev 4716)
@@ -0,0 +1,23 @@
+After going to direct interrupts, our HIF can also handle asynchronous
+requests. Not entirely sure what kept them from working before. Most
+likely, there is some synchronization problem that we're now avoiding
+by also going through the system's main workqueue and thus implicitly
+synchronize with SPI.
+
+Index: ktrack/drivers/ar6000/hif/hif2.c
+===================================================================
+--- ktrack.orig/drivers/ar6000/hif/hif2.c      2008-10-16 01:01:08.000000000 
-0200
++++ ktrack/drivers/ar6000/hif/hif2.c   2008-10-16 01:01:28.000000000 -0200
+@@ -279,8 +279,11 @@
+                       mbs_cfg[i] = HIF_MBOX_START_ADDR(i);
+               break;
+       case HIF_DEVICE_GET_IRQ_PROC_MODE:
++#ifdef CONFIG_AR6000_GTA02_DIRECT_IRQ
++              *ipm_cfg = HIF_DEVICE_IRQ_ASYNC_SYNC;
++#else
+               *ipm_cfg = HIF_DEVICE_IRQ_SYNC_ONLY;
+-//            *ipm_cfg = HIF_DEVICE_IRQ_ASYNC_SYNC;
++#endif
+               break;
+       default:
+               return A_ERROR;

Added: developers/werner/wlan-spi/patches-tracking/hif-direct-interrupt.patch
===================================================================
--- developers/werner/wlan-spi/patches-tracking/hif-direct-interrupt.patch      
                        (rev 0)
+++ developers/werner/wlan-spi/patches-tracking/hif-direct-interrupt.patch      
2008-10-16 03:55:15 UTC (rev 4716)
@@ -0,0 +1,258 @@
+Proof-of-concept hack to directly use the interrupt coming from the card.
+
+The performance improvement isn't quite what I expected, only a meager
+4-5%, but perhaps more can be gained if we find a way to strip off some
+of the execution contexts. Right now, interrupts go through a workqueue,
+the AR6k driver, then the SDIO stack gets called from a kernel thread,
+and spi_bitbang uses a workqueue as well. It's almost surprising that we
+still get something done at all with those context switches.
+
+Index: ktrack/drivers/ar6000/hif/hif2.c
+===================================================================
+--- ktrack.orig/drivers/ar6000/hif/hif2.c      2008-10-16 01:13:51.000000000 
-0200
++++ ktrack/drivers/ar6000/hif/hif2.c   2008-10-16 01:21:50.000000000 -0200
+@@ -21,9 +21,13 @@
+ #include <linux/list.h>
+ #include <linux/wait.h>
+ #include <linux/spinlock.h>
++#include <linux/irq.h>
++#include <linux/workqueue.h>
+ #include <linux/mmc/sdio_func.h>
+ #include <linux/mmc/sdio.h>
++
+ #include <asm/gpio.h>
++#include <mach/regs-gpio.h>
+ 
+ #include "athdefs.h"
+ #include "a_types.h"
+@@ -59,6 +63,9 @@
+       void *htc_handle;
+       struct sdio_func *func;
+ 
++      int irq;
++      struct work_struct work;
++
+       /*
+        * @@@ our sweet little bit of bogosity - the mechanism that lets us
+        * use the SDIO stack from softirqs. This really wants to use skbs.
+@@ -99,6 +106,18 @@
+ }
+ 
+ 
++/*
++ * @@@ The slave select games below don't quite work, I think because SPI sets
++ * it to inactive _after_ telling its caller that the operation is complete
++ * (which it is, after all).
++ *
++ * Doing this properly will be a bit of fun, I suppose, because the SPI stack
++ * doesn't have the concept of briefly disabling slave select right before a
++ * transmission.
++ *
++ * For some yet unexplained reason, hacking the SPI driver isn't enough, and 
we
++ * need to force SS low with the s3c2410_gpio_setpin here.
++ */
+ static A_STATUS process_request(struct hif_request *req)
+ {
+       int ret;
+@@ -106,10 +125,12 @@
+ 
+       dev_dbg(&req->func->dev, "process_request(req %p)\n", req);
+       sdio_claim_host(req->func);
++      //s3c2410_gpio_setpin(S3C2410_GPG2, 1); /* raise SS */
+       if (req->read)
+               ret = req->read(req->func, req->buf, req->addr, req->len);
+       else
+               ret = req->write(req->func, req->addr, req->buf, req->len);
++      s3c2410_gpio_setpin(S3C2410_GPG2, 0); /* lower SS to allow interrupts */
+       sdio_release_host(req->func);
+       status = ret ? A_ERROR : A_OK;
+       if (req->completion)
+@@ -278,7 +299,7 @@
+ 
+ /* ========================================================================= 
*/
+ 
+-#if 1
++#ifndef CONFIG_AR6000_GTA02_DIRECT_IRQ
+ 
+ /*
+  * Volatile ought to be good enough to make gcc do the right thing on S3C24xx.
+@@ -386,78 +407,76 @@
+               yield();
+ }
+ 
+-#endif
++#endif /* !CONFIG_AR6000_GTA02_DIRECT_IRQ */
+ 
+ /* ========================================================================= 
*/
+ 
+ /*
+  * The code below is for handling interrupts signalled out-of-band.
+  */
+-#if 0
+-#define IRQ_GPIO S3C2410_GPE8 /* SDDAT1 */
+ 
++#ifdef CONFIG_AR6000_GTA02_DIRECT_IRQ
+ 
+-static atomic_t mask = ATOMIC_INIT(1);
+ 
+-
+-static void sdio_ar6000_irq(struct sdio_func *func)
++static void sdio_ar6000_work(struct work_struct *work)
+ {
+-      HIF_DEVICE *hif = sdio_get_drvdata(func);
++      HIF_DEVICE *hif = container_of(work, struct hif_device, work);
++      struct device *dev = HIFGetOSDevice(hif);
++      A_STATUS status;
+ 
+-      printk(KERN_DEBUG "sdio_ar6000_irq -> %p\n", htcCallbacks.dsrHandler);
+-      BUG();
++      dev_dbg(dev, "sdio_ar6000_work-> %p\n", htcCallbacks.dsrHandler);
++
++      /* absorb the usual initial stray interrupt */
++      if (!hif->htc_handle) {
++              HIFAckInterrupt(hif);
++              return;
++      }
++      status = htcCallbacks.dsrHandler(hif->htc_handle);
++      BUG_ON(status != A_OK);
+ }
+ 
+ 
+-static void sdio_ar6000_poll(void *context)
++static irqreturn_t sdio_ar6000_irq(int irq, void *arg)
+ {
+-      HIF_DEVICE *hif = context;
+-      A_STATUS status;
++      HIF_DEVICE *hif = arg;
++      struct device *dev = HIFGetOSDevice(hif);
+ 
+-      while (1) {
+-              yield();
+-              if (!gpio_get_value(IRQ_GPIO))
+-                      continue;
+-              if (!atomic_add_unless(&mask, 1, 1))
+-                      continue;
+-              status = htcCallbacks.dsrHandler(hif->htc_handle);
+-              BUG_ON(status != A_OK);
+-      }
++      dev_dbg(dev, "sdio_ar6000_irq\n");
++      disable_irq(hif->irq);
++      if (!schedule_work(&hif->work))
++              dev_err(dev, "work already queued");
++      return IRQ_HANDLED;
+ }
+ 
+ 
+ void HIFAckInterrupt(HIF_DEVICE *hif)
+ {
+       struct device *dev = HIFGetOSDevice(hif);
+-      int ret;
+ 
+-      ret = atomic_dec_return(&mask);
+-      BUG_ON(ret < 0);
+-      dev_dbg(dev, "HIFAckInterrupt (%d)\n", ret);
++      dev_dbg(dev, "HIFAckInterrupt)\n");
++      enable_irq(hif->irq);
+ }
+ 
+ 
+ void HIFUnMaskInterrupt(HIF_DEVICE *hif)
+ {
+       struct device *dev = HIFGetOSDevice(hif);
+-      int ret;
+ 
+-      ret = atomic_dec_return(&mask);
+-      BUG_ON(ret < 0);
+-      dev_dbg(dev, "HIFUnMaskInterrupt (%d)\n", ret);
++      dev_dbg(dev, "HIFUnMaskInterrupt)\n");
++      enable_irq(hif->irq);
+ }
+ 
+ 
+ void HIFMaskInterrupt(HIF_DEVICE *hif)
+ {
+       struct device *dev = HIFGetOSDevice(hif);
+-      int ret;
+ 
+-      ret = atomic_inc_return(&mask);
+-      BUG_ON(ret > 1);
+-      dev_dbg(dev, "HIFMaskInterrupt (%d)\n", ret);
++      dev_dbg(dev, "HIFMaskInterrupt\n");
++      disable_irq(hif->irq);
+ }
+-#endif
++
++#endif /* CONFIG_AR6000_GTA02_DIRECT_IRQ */
++
+ 
+ /* ========================================================================= 
*/
+ 
+@@ -521,11 +540,31 @@
+               dev_err(dev, "sdio_set_block_size returns %d\n", ret);
+               /* @@@ cleanup */
+       }
++#ifndef CONFIG_AR6000_GTA02_DIRECT_IRQ
+       ret = sdio_claim_irq(func, sdio_ar6000_irq);
+       if (ret) {
+               dev_err(dev, "sdio_claim_irq returns %d\n", ret);
+               /* @@@ cleanup */
+       }
++#else /* !CONFIG_AR6000_GTA02_DIRECT_IRQ */
++      hif_device.irq = IRQ_EINT3;
++      INIT_WORK(&hif_device.work, sdio_ar6000_work);
++      ret = request_irq(hif_device.irq, sdio_ar6000_irq,
++          IRQF_TRIGGER_LOW, "ar6000", &hif_device);
++      if (ret) {
++              dev_err(dev, "request_irq returns %d\n", ret);
++              /* @@@ cleanup */
++      }
++      /* driver wants to be in charge of enabling the interrupt */
++      disable_irq(hif_device.irq);
++      sdio_f0_writeb(func, 3, SDIO_CCCR_IENx, &ret);
++      if (ret) {
++              dev_err(dev, "sdio_f0_writeb(SDIO_CCCR_IENx) returns %d\n",
++                  ret);
++              /* @@@ cleanup */
++      }
++#endif /* CONFIG_AR6000_GTA02_DIRECT_IRQ */
++
+ #if 0 /* only for hw SDIO */
+       sdio_f0_writeb(func, SDIO_BUS_CD_DISABLE | SDIO_BUS_WIDTH_4BIT,
+           SDIO_CCCR_IF, &ret);
+Index: ktrack/drivers/spi/spi_bitbang.c
+===================================================================
+--- ktrack.orig/drivers/spi/spi_bitbang.c      2008-10-16 01:13:51.000000000 
-0200
++++ ktrack/drivers/spi/spi_bitbang.c   2008-10-16 01:15:26.000000000 -0200
+@@ -323,6 +323,9 @@
+                        * selected ...)
+                        */
+                       if (cs_change) {
++                              /* @@@ AR6k SPI hack */
++                              bitbang->chipselect(spi, BITBANG_CS_INACTIVE);
++                              ndelay(nsecs);
+                               bitbang->chipselect(spi, BITBANG_CS_ACTIVE);
+                               ndelay(nsecs);
+                       }
+@@ -382,7 +385,8 @@
+                * cs_change has hinted that the next message will probably
+                * be for this chip too.
+                */
+-              if (!(status == 0 && cs_change)) {
++              /* @@@ AR6k SPI hack */
++              if (0&&!(status == 0 && cs_change)) {
+                       ndelay(nsecs);
+                       bitbang->chipselect(spi, BITBANG_CS_INACTIVE);
+                       ndelay(nsecs);
+Index: ktrack/drivers/ar6000/Kconfig
+===================================================================
+--- ktrack.orig/drivers/ar6000/Kconfig 2008-10-16 01:13:51.000000000 -0200
++++ ktrack/drivers/ar6000/Kconfig      2008-10-16 01:15:26.000000000 -0200
+@@ -5,3 +5,8 @@
+         default m
+         help
+           good luck.
++
++config AR6000_GTA02_DIRECT_IRQ
++      bool "Hack: use direct interrupt on GTA02"
++      depends on AR6000_WLAN && !AR6K_S3CMCI
++      default n

Added: 
developers/werner/wlan-spi/patches-tracking/s3c-spi-from-int-to-poll.patch
===================================================================
--- developers/werner/wlan-spi/patches-tracking/s3c-spi-from-int-to-poll.patch  
                        (rev 0)
+++ developers/werner/wlan-spi/patches-tracking/s3c-spi-from-int-to-poll.patch  
2008-10-16 03:55:15 UTC (rev 4716)
@@ -0,0 +1,105 @@
+Change the S3C SPI driver to use poll mode instead of interrupt mode.
+This reduces the gap between bytes from about 2.25us [1] to 100ns [2].
+
+[1] http://people.openmoko.org/werner/wlan-spi/spi-int.png
+[2] http://people.openmoko.org/werner/wlan-spi/spi-poll.png
+
+Index: ktrack/drivers/spi/spi_s3c24xx.c
+===================================================================
+--- ktrack.orig/drivers/spi/spi_s3c24xx.c      2008-10-15 23:14:27.000000000 
-0200
++++ ktrack/drivers/spi/spi_s3c24xx.c   2008-10-16 00:36:32.000000000 -0200
+@@ -56,7 +56,7 @@
+       struct s3c2410_spi_info *pdata;
+ };
+ 
+-#define SPCON_DEFAULT (S3C2410_SPCON_MSTR | S3C2410_SPCON_SMOD_INT)
++#define SPCON_DEFAULT (S3C2410_SPCON_MSTR | S3C2410_SPCON_SMOD_POLL)
+ #define SPPIN_DEFAULT (S3C2410_SPPIN_KEEP)
+ 
+ static inline struct s3c24xx_spi *to_hw(struct spi_device *sdev)
+@@ -183,6 +183,7 @@
+ static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t)
+ {
+       struct s3c24xx_spi *hw = to_hw(spi);
++      int i;
+ 
+       dev_dbg(&spi->dev, "txrx: tx %p, rx %p, len %d\n",
+               t->tx_buf, t->rx_buf, t->len);
+@@ -194,10 +195,19 @@
+ 
+       init_completion(&hw->done);
+ 
+-      /* send the first byte */
+-      writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT);
++      for (i = 0; i != t->len; i++) {
++              u8 spsta;
+ 
+-      wait_for_completion(&hw->done);
++              writeb(hw_txbyte(hw, i), hw->regs + S3C2410_SPTDAT);
++              do spsta = readb(hw->regs + S3C2410_SPSTA);
++              while (!(spsta & S3C2410_SPSTA_READY));
++              if (hw->rx) {
++                      u8 b = readb(hw->regs + S3C2410_SPRDAT);
++
++                      if (i)
++                              hw->rx[i-1] = b;
++              }
++      }
+ 
+       /*
+        * Get the last byte. Since we don't have more data we can send in
+@@ -207,9 +217,9 @@
+        * going on in the hardware. This is the voodoo ritual that makes it
+        * work while anything else fails.
+        */
+-      if (hw->rx && hw->count) {
++      if (hw->rx && i) {
+               udelay(1+10*1000000/spi->max_speed_hz);
+-              hw->rx[hw->count-1] = readb(hw->regs + S3C2410_SPRDAT);
++              hw->rx[i-1] = readb(hw->regs + S3C2410_SPRDAT);
+       }
+ 
+       if (0&&t->rx_buf && t->len > 18) {
+@@ -220,7 +230,7 @@
+                       printk(" %02x", ((u8 *) t->rx_buf)[i]);
+               printk("\n");
+       }
+-      return hw->count;
++      return t->len;
+ }
+ 
+ static irqreturn_t s3c24xx_spi_irq(int irq, void *dev)
+@@ -352,6 +362,7 @@
+               goto err_no_iomap;
+       }
+ 
++#if 0
+       hw->irq = platform_get_irq(pdev, 0);
+       if (hw->irq < 0) {
+               dev_err(&pdev->dev, "No IRQ specified\n");
+@@ -364,6 +375,7 @@
+               dev_err(&pdev->dev, "Cannot claim IRQ\n");
+               goto err_no_irq;
+       }
++#endif
+ 
+       hw->clk = clk_get(&pdev->dev, "spi");
+       if (IS_ERR(hw->clk)) {
+@@ -399,7 +411,7 @@
+       clk_put(hw->clk);
+ 
+  err_no_clk:
+-      free_irq(hw->irq, hw);
++      //free_irq(hw->irq, hw);
+ 
+  err_no_irq:
+       iounmap(hw->regs);
+@@ -427,7 +439,7 @@
+       clk_disable(hw->clk);
+       clk_put(hw->clk);
+ 
+-      free_irq(hw->irq, hw);
++      //free_irq(hw->irq, hw);
+       iounmap(hw->regs);
+ 
+       release_resource(hw->ioarea);

Modified: developers/werner/wlan-spi/patches-tracking/series
===================================================================
--- developers/werner/wlan-spi/patches-tracking/series  2008-10-16 01:19:51 UTC 
(rev 4715)
+++ developers/werner/wlan-spi/patches-tracking/series  2008-10-16 03:55:15 UTC 
(rev 4716)
@@ -15,3 +15,12 @@
 gta02-mmc-spi-bitbang.patch
 gta02-mmc-spi.patch
 s3c-spi-fix-int-mode.patch 
+s3c-spi-from-int-to-poll.patch
+gta02-mmc-mci.patch
+
+# dirty experimental stuff follows
+
+# didn't survive the move to 2.6.27 :-(
+#hack-dont-poll-irq.patch 
+#hif-direct-interrupt.patch
+#hif-can-do-async.patch




--- End Message ---
_______________________________________________
commitlog mailing list
commitlog@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to