r4744 - in developers/werner/wlan-spi/patches-tracking: . attic
werner at docs.openmoko.org
werner at docs.openmoko.org
Mon Nov 3 02:48:42 CET 2008
Author: werner
Date: 2008-11-03 02:48:41 +0100 (Mon, 03 Nov 2008)
New Revision: 4744
Added:
developers/werner/wlan-spi/patches-tracking/attic/gta02-mmc-spi-bitbang.patch
developers/werner/wlan-spi/patches-tracking/attic/hack-dont-poll-irq.patch
developers/werner/wlan-spi/patches-tracking/attic/hif-direct-interrupt.patch
Removed:
developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi-bitbang.patch
developers/werner/wlan-spi/patches-tracking/hack-dont-poll-irq.patch
developers/werner/wlan-spi/patches-tracking/hif-direct-interrupt.patch
Modified:
developers/werner/wlan-spi/patches-tracking/gta02-mmc-mci.patch
developers/werner/wlan-spi/patches-tracking/hif-linux-sdio.patch
developers/werner/wlan-spi/patches-tracking/series
Log:
More cleanup and a little priority boost for the io task.
- moved hif-direct-interrupt.patch and hack-dont-poll-irq.patch to the attic as
well
- gta02-mmc-spi-bitbang.patch, last of the SPI drivers, to the attic
- gta02-mmc-mci.patch: since S3C MCI is now the only SDIO low-level driver, we
don't have to be able to select it by configuration
- arch/arm/mach-s3c2440/mach-gta02.c: remove obsolete gta02_mmc_cfg, remove the
experimental registration of s3c_device_sdi, and re-enable s3c_device_sdi in
the list of platform devices
- drivers/ar6000/hif/hif2.c: boost priority of io task to one level below
ksdioirqd
Copied: developers/werner/wlan-spi/patches-tracking/attic/gta02-mmc-spi-bitbang.patch (from rev 4737, developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi-bitbang.patch)
===================================================================
--- developers/werner/wlan-spi/patches-tracking/attic/gta02-mmc-spi-bitbang.patch (rev 0)
+++ developers/werner/wlan-spi/patches-tracking/attic/gta02-mmc-spi-bitbang.patch 2008-11-03 01:48:41 UTC (rev 4744)
@@ -0,0 +1,151 @@
+gta02-mmc-spio-bitbang.patch
+
+This patch adds the platform definitions for using the AR6000 driver
+with MMC-SPI and the S3C SPI GPIO (bit-banging) driver.
+
+This configuration should work with all GTA02 models. No rework
+required.
+
+Note that this patch disables the acceleration sensors, because they
+also use the SPI GPIO driver. This needs a bit more integration.
+
+Not-Yet-Signed-off-by: Werner Almesberger <werner at openmoko.org>
+
+Index: ktrack/arch/arm/mach-s3c2440/Kconfig
+===================================================================
+--- ktrack.orig/arch/arm/mach-s3c2440/Kconfig 2008-11-02 02:50:01.000000000 -0200
++++ ktrack/arch/arm/mach-s3c2440/Kconfig 2008-11-02 04:29:34.000000000 -0200
+@@ -101,6 +101,20 @@
+ Say Y here if you are using an early hardware revision
+ of the FIC/Openmoko Neo1973 GTA02 GSM Phone.
+
++# @@@ Not a great place for this, but still better than dragging platform
++# details into driver land.
++
++choice
++ prompt "AR6K interface"
++ default AR6K_SPI_S3C24XX_GPIO
++ depends on MACH_NEO1973_GTA02 && AR6000_WLAN
++
++ config AR6K_SPI_S3C24XX_GPIO
++ bool "GPIO bit-banging SPI"
++ select MMC_SPI
++ select SPI_S3C24XX_GPIO
++endchoice
++
+ endmenu
+
+ #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-11-02 04:29:28.000000000 -0200
++++ ktrack/arch/arm/mach-s3c2440/mach-gta02.c 2008-11-02 04:29:34.000000000 -0200
+@@ -37,6 +37,7 @@
+ #include <linux/spi/spi.h>
+ #include <linux/spi/glamo.h>
+ #include <linux/spi/spi_bitbang.h>
++#include <linux/spi/mmc_spi.h>
+ #include <linux/mmc/host.h>
+
+ #include <linux/mtd/mtd.h>
+@@ -1238,6 +1239,87 @@
+ },
+ };
+
++
++/* ----- AR6000 WLAN interface --------------------------------------------- */
++
++
++/* shared by all SPI drivers */
++
++#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,
++ }
++};
++
++#endif /* CONFIG_AR6K_SPI_S3C24XX_GPIO */
++
++
++#ifdef CONFIG_AR6K_SPI_S3C24XX_GPIO
++
++static void spi_wlan_cs(struct s3c2410_spigpio_info *spigpio_info,
++ int csid, int cs)
++{
++ switch (cs) {
++ case BITBANG_CS_ACTIVE:
++ s3c2410_gpio_setpin(S3C2410_GPE10, 0);
++ break;
++ case BITBANG_CS_INACTIVE:
++ s3c2410_gpio_setpin(S3C2410_GPE10, 1);
++ break;
++ }
++}
++
++static struct s3c2410_spigpio_info spi_gpio_wlan_cfg = {
++ .pin_clk = S3C2410_GPE5,
++ .pin_mosi = S3C2410_GPE6,
++ .pin_miso = S3C2410_GPE7,
++ .board_size = ARRAY_SIZE(gta02_spi_mmc_bdinfo),
++ .board_info = gta02_spi_mmc_bdinfo,
++ .chip_select = &spi_wlan_cs,
++ .num_chipselect = 1,
++};
++
++static struct resource gta02_spi_wlan_resource[] = {
++ [0] = {
++ .start = S3C2410_GPE5,
++ .end = S3C2410_GPE5,
++ },
++ [1] = {
++ .start = S3C2410_GPE6,
++ .end = S3C2410_GPE6,
++ },
++ [2] = {
++ .start = S3C2410_GPE7,
++ .end = S3C2410_GPE7,
++ },
++ [3] = {
++ .start = S3C2410_GPE10,
++ .end = S3C2410_GPE10,
++ },
++};
++
++static struct platform_device gta02_spi_wlan = {
++ .name = "spi_s3c24xx_gpio",
++ .id = 1,
++ .num_resources = ARRAY_SIZE(gta02_spi_wlan_resource),
++ .resource = gta02_spi_wlan_resource,
++ .dev = {
++ .platform_data = &spi_gpio_wlan_cfg,
++ },
++};
++
++#endif /* CONFIG_AR6K_SPI_S3C2410_GPIO */
++
++
++/* ------------------------------------------------------------------------- */
++
+ static struct resource gta02_led_resources[] = {
+ {
+ .name = "gta02-power:orange",
+@@ -1632,6 +1714,12 @@
+
+ mangle_pmu_pdata_by_system_rev();
+
++#ifdef CONFIG_AR6K_SPI_S3C24XX_GPIO
++ s3c2410_gpio_setpin(S3C2410_GPE10, 1); /* nSS */
++ s3c2410_gpio_cfgpin(S3C2410_GPE10, S3C2410_GPIO_OUTPUT);
++ platform_device_register(>a02_spi_wlan);
++#endif /* CONFIG_AR6K_SPI_S3C24XX_GPIO */
++
+ platform_add_devices(gta02_devices, ARRAY_SIZE(gta02_devices));
+
+ s3c2410_pm_init();
Copied: developers/werner/wlan-spi/patches-tracking/attic/hack-dont-poll-irq.patch (from rev 4716, developers/werner/wlan-spi/patches-tracking/hack-dont-poll-irq.patch)
===================================================================
--- developers/werner/wlan-spi/patches-tracking/attic/hack-dont-poll-irq.patch (rev 0)
+++ developers/werner/wlan-spi/patches-tracking/attic/hack-dont-poll-irq.patch 2008-11-03 01:48:41 UTC (rev 4744)
@@ -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, ¶m);
++// sched_setscheduler(current, SCHED_FIFO, ¶m);
+
+ /*
+ * 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);
Copied: developers/werner/wlan-spi/patches-tracking/attic/hif-direct-interrupt.patch (from rev 4733, developers/werner/wlan-spi/patches-tracking/hif-direct-interrupt.patch)
===================================================================
--- developers/werner/wlan-spi/patches-tracking/attic/hif-direct-interrupt.patch (rev 0)
+++ developers/werner/wlan-spi/patches-tracking/attic/hif-direct-interrupt.patch 2008-11-03 01:48:41 UTC (rev 4744)
@@ -0,0 +1,259 @@
+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-29 23:48:33.000000000 -0200
++++ ktrack/drivers/ar6000/hif/hif2.c 2008-10-29 23:50:44.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,32 @@
+ 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 */
++
+ /* Set SDIO_BUS_CD_DISABLE in SDIO_CCCR_IF ? */
+ #if 0
+ sdio_f0_writeb(func, SDIO_CCCR_CAP_E4MI, SDIO_CCCR_CAPS, &ret);
+Index: ktrack/drivers/spi/spi_bitbang.c
+===================================================================
+--- ktrack.orig/drivers/spi/spi_bitbang.c 2008-10-29 23:48:33.000000000 -0200
++++ ktrack/drivers/spi/spi_bitbang.c 2008-10-29 23:49:18.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-29 23:48:33.000000000 -0200
++++ ktrack/drivers/ar6000/Kconfig 2008-10-29 23:49:18.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
Modified: developers/werner/wlan-spi/patches-tracking/gta02-mmc-mci.patch
===================================================================
--- developers/werner/wlan-spi/patches-tracking/gta02-mmc-mci.patch 2008-11-02 21:41:59 UTC (rev 4743)
+++ developers/werner/wlan-spi/patches-tracking/gta02-mmc-mci.patch 2008-11-03 01:48:41 UTC (rev 4744)
@@ -1,34 +1,46 @@
Use S3C SDI on GTA02.
-Index: ktrack/arch/arm/mach-s3c2440/Kconfig
-===================================================================
---- ktrack.orig/arch/arm/mach-s3c2440/Kconfig 2008-11-02 11:04:06.000000000 -0200
-+++ ktrack/arch/arm/mach-s3c2440/Kconfig 2008-11-02 11:04:06.000000000 -0200
-@@ -113,6 +113,11 @@
- bool "GPIO bit-banging SPI"
- select MMC_SPI
- select SPI_S3C24XX_GPIO
-+
-+ 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-11-02 11:04:06.000000000 -0200
-+++ ktrack/arch/arm/mach-s3c2440/mach-gta02.c 2008-11-02 11:04:06.000000000 -0200
-@@ -1720,6 +1720,11 @@
- platform_device_register(>a02_spi_wlan);
- #endif /* CONFIG_AR6K_SPI_S3C24XX_GPIO */
+--- ktrack.orig/arch/arm/mach-s3c2440/mach-gta02.c 2008-11-02 22:49:21.000000000 -0200
++++ ktrack/arch/arm/mach-s3c2440/mach-gta02.c 2008-11-02 22:53:59.000000000 -0200
+@@ -902,12 +902,6 @@
+ .software_ecc = 1,
+ };
-+#ifdef CONFIG_AR6K_S3CMCI
-+ s3c_device_sdi.dev.platform_data = NULL;
-+ platform_device_register(&s3c_device_sdi); /* @@@ just for testing */
-+#endif /* CONFIG_AR6K_S3CMCI */
-+
- platform_add_devices(gta02_devices, ARRAY_SIZE(gta02_devices));
+-static struct s3c24xx_mci_pdata gta02_mmc_cfg = {
+- .gpio_detect = GTA02v1_GPIO_nSD_DETECT,
+- .set_power = NULL,
+- .ocr_avail = MMC_VDD_32_33,
+-};
+-
+ static void gta02_udc_command(enum s3c2410_udc_cmd_e cmd)
+ {
+ printk(KERN_DEBUG "%s(%d)\n", __func__, cmd);
+@@ -1529,7 +1523,7 @@
+ &s3c_device_usb,
+ &s3c_device_wdt,
+ >a02_memconfig_device,
+- // &s3c_device_sdi, /* FIXME: temporary disable to avoid s3cmci bind */
++ &s3c_device_sdi,
+ &s3c_device_usbgadget,
+ &s3c_device_nand,
+ >a02_nor_flash,
+@@ -1607,17 +1601,6 @@
- s3c2410_pm_init();
+ s3c_device_usb.dev.platform_data = >a02_usb_info;
+ s3c_device_nand.dev.platform_data = >a02_nand_info;
+- s3c_device_sdi.dev.platform_data = >a02_mmc_cfg;
+-
+- /* Only GTA02v1 has a SD_DETECT GPIO. Since the slot is not
+- * hot-pluggable, this is not required anyway */
+- switch (system_rev) {
+- case GTA02v1_SYSTEM_REV:
+- break;
+- default:
+- gta02_mmc_cfg.gpio_detect = 0;
+- break;
+- }
+
+ /* acc sensor chip selects */
+ s3c2410_gpio_setpin(S3C2410_GPD12, 1);
Deleted: developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi-bitbang.patch
===================================================================
--- developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi-bitbang.patch 2008-11-02 21:41:59 UTC (rev 4743)
+++ developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi-bitbang.patch 2008-11-03 01:48:41 UTC (rev 4744)
@@ -1,151 +0,0 @@
-gta02-mmc-spio-bitbang.patch
-
-This patch adds the platform definitions for using the AR6000 driver
-with MMC-SPI and the S3C SPI GPIO (bit-banging) driver.
-
-This configuration should work with all GTA02 models. No rework
-required.
-
-Note that this patch disables the acceleration sensors, because they
-also use the SPI GPIO driver. This needs a bit more integration.
-
-Not-Yet-Signed-off-by: Werner Almesberger <werner at openmoko.org>
-
-Index: ktrack/arch/arm/mach-s3c2440/Kconfig
-===================================================================
---- ktrack.orig/arch/arm/mach-s3c2440/Kconfig 2008-11-02 02:50:01.000000000 -0200
-+++ ktrack/arch/arm/mach-s3c2440/Kconfig 2008-11-02 04:29:34.000000000 -0200
-@@ -101,6 +101,20 @@
- Say Y here if you are using an early hardware revision
- of the FIC/Openmoko Neo1973 GTA02 GSM Phone.
-
-+# @@@ Not a great place for this, but still better than dragging platform
-+# details into driver land.
-+
-+choice
-+ prompt "AR6K interface"
-+ default AR6K_SPI_S3C24XX_GPIO
-+ depends on MACH_NEO1973_GTA02 && AR6000_WLAN
-+
-+ config AR6K_SPI_S3C24XX_GPIO
-+ bool "GPIO bit-banging SPI"
-+ select MMC_SPI
-+ select SPI_S3C24XX_GPIO
-+endchoice
-+
- endmenu
-
- #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-11-02 04:29:28.000000000 -0200
-+++ ktrack/arch/arm/mach-s3c2440/mach-gta02.c 2008-11-02 04:29:34.000000000 -0200
-@@ -37,6 +37,7 @@
- #include <linux/spi/spi.h>
- #include <linux/spi/glamo.h>
- #include <linux/spi/spi_bitbang.h>
-+#include <linux/spi/mmc_spi.h>
- #include <linux/mmc/host.h>
-
- #include <linux/mtd/mtd.h>
-@@ -1238,6 +1239,87 @@
- },
- };
-
-+
-+/* ----- AR6000 WLAN interface --------------------------------------------- */
-+
-+
-+/* shared by all SPI drivers */
-+
-+#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,
-+ }
-+};
-+
-+#endif /* CONFIG_AR6K_SPI_S3C24XX_GPIO */
-+
-+
-+#ifdef CONFIG_AR6K_SPI_S3C24XX_GPIO
-+
-+static void spi_wlan_cs(struct s3c2410_spigpio_info *spigpio_info,
-+ int csid, int cs)
-+{
-+ switch (cs) {
-+ case BITBANG_CS_ACTIVE:
-+ s3c2410_gpio_setpin(S3C2410_GPE10, 0);
-+ break;
-+ case BITBANG_CS_INACTIVE:
-+ s3c2410_gpio_setpin(S3C2410_GPE10, 1);
-+ break;
-+ }
-+}
-+
-+static struct s3c2410_spigpio_info spi_gpio_wlan_cfg = {
-+ .pin_clk = S3C2410_GPE5,
-+ .pin_mosi = S3C2410_GPE6,
-+ .pin_miso = S3C2410_GPE7,
-+ .board_size = ARRAY_SIZE(gta02_spi_mmc_bdinfo),
-+ .board_info = gta02_spi_mmc_bdinfo,
-+ .chip_select = &spi_wlan_cs,
-+ .num_chipselect = 1,
-+};
-+
-+static struct resource gta02_spi_wlan_resource[] = {
-+ [0] = {
-+ .start = S3C2410_GPE5,
-+ .end = S3C2410_GPE5,
-+ },
-+ [1] = {
-+ .start = S3C2410_GPE6,
-+ .end = S3C2410_GPE6,
-+ },
-+ [2] = {
-+ .start = S3C2410_GPE7,
-+ .end = S3C2410_GPE7,
-+ },
-+ [3] = {
-+ .start = S3C2410_GPE10,
-+ .end = S3C2410_GPE10,
-+ },
-+};
-+
-+static struct platform_device gta02_spi_wlan = {
-+ .name = "spi_s3c24xx_gpio",
-+ .id = 1,
-+ .num_resources = ARRAY_SIZE(gta02_spi_wlan_resource),
-+ .resource = gta02_spi_wlan_resource,
-+ .dev = {
-+ .platform_data = &spi_gpio_wlan_cfg,
-+ },
-+};
-+
-+#endif /* CONFIG_AR6K_SPI_S3C2410_GPIO */
-+
-+
-+/* ------------------------------------------------------------------------- */
-+
- static struct resource gta02_led_resources[] = {
- {
- .name = "gta02-power:orange",
-@@ -1632,6 +1714,12 @@
-
- mangle_pmu_pdata_by_system_rev();
-
-+#ifdef CONFIG_AR6K_SPI_S3C24XX_GPIO
-+ s3c2410_gpio_setpin(S3C2410_GPE10, 1); /* nSS */
-+ s3c2410_gpio_cfgpin(S3C2410_GPE10, S3C2410_GPIO_OUTPUT);
-+ platform_device_register(>a02_spi_wlan);
-+#endif /* CONFIG_AR6K_SPI_S3C24XX_GPIO */
-+
- platform_add_devices(gta02_devices, ARRAY_SIZE(gta02_devices));
-
- s3c2410_pm_init();
Deleted: developers/werner/wlan-spi/patches-tracking/hack-dont-poll-irq.patch
===================================================================
--- developers/werner/wlan-spi/patches-tracking/hack-dont-poll-irq.patch 2008-11-02 21:41:59 UTC (rev 4743)
+++ developers/werner/wlan-spi/patches-tracking/hack-dont-poll-irq.patch 2008-11-03 01:48:41 UTC (rev 4744)
@@ -1,33 +0,0 @@
-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, ¶m);
-+// sched_setscheduler(current, SCHED_FIFO, ¶m);
-
- /*
- * 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);
Deleted: developers/werner/wlan-spi/patches-tracking/hif-direct-interrupt.patch
===================================================================
--- developers/werner/wlan-spi/patches-tracking/hif-direct-interrupt.patch 2008-11-02 21:41:59 UTC (rev 4743)
+++ developers/werner/wlan-spi/patches-tracking/hif-direct-interrupt.patch 2008-11-03 01:48:41 UTC (rev 4744)
@@ -1,259 +0,0 @@
-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-29 23:48:33.000000000 -0200
-+++ ktrack/drivers/ar6000/hif/hif2.c 2008-10-29 23:50:44.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,32 @@
- 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 */
-+
- /* Set SDIO_BUS_CD_DISABLE in SDIO_CCCR_IF ? */
- #if 0
- sdio_f0_writeb(func, SDIO_CCCR_CAP_E4MI, SDIO_CCCR_CAPS, &ret);
-Index: ktrack/drivers/spi/spi_bitbang.c
-===================================================================
---- ktrack.orig/drivers/spi/spi_bitbang.c 2008-10-29 23:48:33.000000000 -0200
-+++ ktrack/drivers/spi/spi_bitbang.c 2008-10-29 23:49:18.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-29 23:48:33.000000000 -0200
-+++ ktrack/drivers/ar6000/Kconfig 2008-10-29 23:49:18.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
Modified: developers/werner/wlan-spi/patches-tracking/hif-linux-sdio.patch
===================================================================
--- developers/werner/wlan-spi/patches-tracking/hif-linux-sdio.patch 2008-11-02 21:41:59 UTC (rev 4743)
+++ developers/werner/wlan-spi/patches-tracking/hif-linux-sdio.patch 2008-11-03 01:48:41 UTC (rev 4744)
@@ -11,8 +11,8 @@
Index: ktrack/drivers/ar6000/Makefile
===================================================================
---- ktrack.orig/drivers/ar6000/Makefile 2008-11-02 08:01:22.000000000 -0200
-+++ ktrack/drivers/ar6000/Makefile 2008-11-02 08:04:17.000000000 -0200
+--- ktrack.orig/drivers/ar6000/Makefile 2008-11-02 23:09:13.000000000 -0200
++++ ktrack/drivers/ar6000/Makefile 2008-11-02 23:09:15.000000000 -0200
@@ -21,7 +21,7 @@
htc/htc_recv.o \
htc/htc_services.o \
@@ -25,8 +25,8 @@
Index: ktrack/drivers/ar6000/hif/hif2.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ ktrack/drivers/ar6000/hif/hif2.c 2008-11-02 12:01:30.000000000 -0200
-@@ -0,0 +1,593 @@
++++ ktrack/drivers/ar6000/hif/hif2.c 2008-11-02 23:46:53.000000000 -0200
+@@ -0,0 +1,598 @@
+/*
+ * hif2.c - HIF layer re-implementation for the Linux SDIO stack
+ *
@@ -50,6 +50,7 @@
+#include <linux/list.h>
+#include <linux/wait.h>
+#include <linux/spinlock.h>
++#include <linux/sched.h>
+#include <linux/mmc/sdio_func.h>
+#include <linux/mmc/sdio.h>
+#include <linux/mmc/sdio_ids.h>
@@ -213,9 +214,13 @@
+static int io(void *data)
+{
+ struct hif_device *hif = data;
++ struct sched_param param = { .sched_priority = 2 };
++ /* one priority level slower than ksdioirqd (which is at 1) */
+ DEFINE_WAIT(wait);
+ struct hif_request *req;
+
++ sched_setscheduler(current, SCHED_FIFO, ¶m);
++
+ while (1) {
+ while (1) {
+ /*
Modified: developers/werner/wlan-spi/patches-tracking/series
===================================================================
--- developers/werner/wlan-spi/patches-tracking/series 2008-11-02 21:41:59 UTC (rev 4743)
+++ developers/werner/wlan-spi/patches-tracking/series 2008-11-03 01:48:41 UTC (rev 4744)
@@ -19,15 +19,11 @@
gta02-remove-sdio.patch
sdio-add-atheros-ar6k.patch
hif-linux-sdio.patch
-gta02-mmc-spi-bitbang.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
# still needs a bit more love ...
More information about the commitlog
mailing list