r3721 - developers/sameo/patches/ar6k-ng

sameo at sita.openmoko.org sameo at sita.openmoko.org
Fri Dec 21 16:33:51 CET 2007


Author: sameo
Date: 2007-12-21 16:33:47 +0100 (Fri, 21 Dec 2007)
New Revision: 3721

Modified:
   developers/sameo/patches/ar6k-ng/100-sdio_merge.patch
   developers/sameo/patches/ar6k-ng/110-s3c24xx_sdio_merge.patch
   developers/sameo/patches/ar6k-ng/130-gta02v2.patch
   developers/sameo/patches/ar6k-ng/140-s3c24xx_mci_platform.patch
   developers/sameo/patches/ar6k-ng/150-mmc_powerup_delay.patch
   developers/sameo/patches/ar6k-ng/155-sdio_io_generic_rw.patch
   developers/sameo/patches/ar6k-ng/160-ar6k_ng.patch
   developers/sameo/patches/ar6k-ng/series
Log:
ar6k-ng: First working ar6k driver running on the kernel SDIO stack.

Mainly s3cmci fixes, but we now get to the point where eth0 gets 
registered. Which means that we do PIO rw and get SDIO IRQs properly.


Modified: developers/sameo/patches/ar6k-ng/100-sdio_merge.patch
===================================================================
--- developers/sameo/patches/ar6k-ng/100-sdio_merge.patch	2007-12-21 14:29:14 UTC (rev 3720)
+++ developers/sameo/patches/ar6k-ng/100-sdio_merge.patch	2007-12-21 15:33:47 UTC (rev 3721)
@@ -19,13 +19,13 @@
  drivers/mmc/core/sd_ops.c       |  102 +--
  drivers/mmc/core/sd_ops.h       |    3 
  drivers/mmc/core/sdio.c         |  382 +++++++++++++
- drivers/mmc/core/sdio_bus.c     |  271 +++++++++
+ drivers/mmc/core/sdio_bus.c     |  273 +++++++++
  drivers/mmc/core/sdio_bus.h     |   22 
  drivers/mmc/core/sdio_cis.c     |  404 +++++++++++++
  drivers/mmc/core/sdio_cis.h     |   23 
  drivers/mmc/core/sdio_io.c      |  562 +++++++++++++++++++
  drivers/mmc/core/sdio_irq.c     |  245 ++++++++
- drivers/mmc/core/sdio_ops.c     |  148 +++++
+ drivers/mmc/core/sdio_ops.c     |  150 +++++
  drivers/mmc/core/sdio_ops.h     |   22 
  drivers/mmc/core/sysfs.c        |  347 -----------
  drivers/mmc/core/sysfs.h        |   19 
@@ -50,7 +50,7 @@
  include/linux/mmc/sdio_ids.h    |   23 
  include/linux/mod_devicetable.h |   11 
  scripts/mod/file2alias.c        |   20 
- 51 files changed, 5313 insertions(+), 1049 deletions(-)
+ 51 files changed, 5317 insertions(+), 1049 deletions(-)
 
 Index: linux-2.6.22-atheros-ng/drivers/mmc/card/block.c
 ===================================================================
@@ -1967,7 +1967,7 @@
 Index: linux-2.6.22-atheros-ng/drivers/mmc/core/core.c
 ===================================================================
 --- linux-2.6.22-atheros-ng.orig/drivers/mmc/core/core.c	2007-07-09 01:32:17.000000000 +0200
-+++ linux-2.6.22-atheros-ng/drivers/mmc/core/core.c	2007-11-13 11:35:23.000000000 +0100
++++ linux-2.6.22-atheros-ng/drivers/mmc/core/core.c	2007-12-21 16:19:18.000000000 +0100
 @@ -27,13 +27,36 @@
  #include <linux/mmc/sd.h>
  
@@ -3334,7 +3334,7 @@
 Index: linux-2.6.22-atheros-ng/drivers/mmc/core/sd.c
 ===================================================================
 --- linux-2.6.22-atheros-ng.orig/drivers/mmc/core/sd.c	2007-07-09 01:32:17.000000000 +0200
-+++ linux-2.6.22-atheros-ng/drivers/mmc/core/sd.c	2007-11-13 11:35:23.000000000 +0100
++++ linux-2.6.22-atheros-ng/drivers/mmc/core/sd.c	2007-12-21 16:19:32.000000000 +0100
 @@ -1,5 +1,5 @@
  /*
 - *  linux/drivers/mmc/sd.c
@@ -3760,8 +3760,8 @@
 Index: linux-2.6.22-atheros-ng/drivers/mmc/core/sdio_bus.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22-atheros-ng/drivers/mmc/core/sdio_bus.c	2007-11-13 11:35:23.000000000 +0100
-@@ -0,0 +1,271 @@
++++ linux-2.6.22-atheros-ng/drivers/mmc/core/sdio_bus.c	2007-12-11 01:53:16.000000000 +0100
+@@ -0,0 +1,273 @@
 +/*
 + *  linux/drivers/mmc/core/sdio_bus.c
 + *
@@ -3894,6 +3894,8 @@
 +	const struct sdio_device_id *id;
 +	int ret;
 +
++	printk("##### %s() #########\n", __FUNCTION__);
++
 +	id = sdio_match_device(func, drv);
 +	if (!id)
 +		return -ENODEV;
@@ -4063,7 +4065,7 @@
 Index: linux-2.6.22-atheros-ng/drivers/mmc/core/sdio.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22-atheros-ng/drivers/mmc/core/sdio.c	2007-11-13 11:35:23.000000000 +0100
++++ linux-2.6.22-atheros-ng/drivers/mmc/core/sdio.c	2007-12-21 16:19:32.000000000 +0100
 @@ -0,0 +1,382 @@
 +/*
 + *  linux/drivers/mmc/sdio.c
@@ -4887,7 +4889,7 @@
 Index: linux-2.6.22-atheros-ng/drivers/mmc/core/sdio_io.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22-atheros-ng/drivers/mmc/core/sdio_io.c	2007-11-13 11:35:23.000000000 +0100
++++ linux-2.6.22-atheros-ng/drivers/mmc/core/sdio_io.c	2007-12-21 16:19:14.000000000 +0100
 @@ -0,0 +1,562 @@
 +/*
 + *  linux/drivers/mmc/core/sdio_io.c
@@ -5454,7 +5456,7 @@
 Index: linux-2.6.22-atheros-ng/drivers/mmc/core/sdio_irq.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22-atheros-ng/drivers/mmc/core/sdio_irq.c	2007-11-13 11:35:23.000000000 +0100
++++ linux-2.6.22-atheros-ng/drivers/mmc/core/sdio_irq.c	2007-12-21 15:24:16.000000000 +0100
 @@ -0,0 +1,245 @@
 +/*
 + * linux/drivers/mmc/core/sdio_irq.c
@@ -5704,8 +5706,8 @@
 Index: linux-2.6.22-atheros-ng/drivers/mmc/core/sdio_ops.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22-atheros-ng/drivers/mmc/core/sdio_ops.c	2007-11-13 11:35:23.000000000 +0100
-@@ -0,0 +1,148 @@
++++ linux-2.6.22-atheros-ng/drivers/mmc/core/sdio_ops.c	2007-12-18 00:17:35.000000000 +0100
+@@ -0,0 +1,150 @@
 +/*
 + *  linux/drivers/mmc/sdio_ops.c
 + *
@@ -5773,8 +5775,10 @@
 +	cmd.opcode = SD_IO_RW_DIRECT;
 +	cmd.arg = write ? 0x80000000 : 0x00000000;
 +	cmd.arg |= fn << 28;
++	cmd.arg |= 1 << 26; /* Stuff bit */
 +	cmd.arg |= (write && out) ? 0x08000000 : 0x00000000;
 +	cmd.arg |= addr << 9;
++	cmd.arg |= 1 << 8; /* Stuff bit */
 +	cmd.arg |= in;
 +	cmd.flags = MMC_RSP_R5 | MMC_CMD_AC;
 +
@@ -7405,7 +7409,7 @@
 Index: linux-2.6.22-atheros-ng/drivers/mmc/host/sdhci.c
 ===================================================================
 --- linux-2.6.22-atheros-ng.orig/drivers/mmc/host/sdhci.c	2007-07-09 01:32:17.000000000 +0200
-+++ linux-2.6.22-atheros-ng/drivers/mmc/host/sdhci.c	2007-11-13 11:35:23.000000000 +0100
++++ linux-2.6.22-atheros-ng/drivers/mmc/host/sdhci.c	2007-12-21 16:19:32.000000000 +0100
 @@ -1,5 +1,5 @@
  /*
 - *  linux/drivers/mmc/sdhci.c - Secure Digital Host Controller Interface driver
@@ -8338,7 +8342,7 @@
 Index: linux-2.6.22-atheros-ng/include/linux/mmc/host.h
 ===================================================================
 --- linux-2.6.22-atheros-ng.orig/include/linux/mmc/host.h	2007-07-09 01:32:17.000000000 +0200
-+++ linux-2.6.22-atheros-ng/include/linux/mmc/host.h	2007-11-13 11:35:23.000000000 +0100
++++ linux-2.6.22-atheros-ng/include/linux/mmc/host.h	2007-12-21 16:19:32.000000000 +0100
 @@ -51,6 +51,7 @@
  	void	(*request)(struct mmc_host *host, struct mmc_request *req);
  	void	(*set_ios)(struct mmc_host *host, struct mmc_ios *ios);

Modified: developers/sameo/patches/ar6k-ng/110-s3c24xx_sdio_merge.patch
===================================================================
--- developers/sameo/patches/ar6k-ng/110-s3c24xx_sdio_merge.patch	2007-12-21 14:29:14 UTC (rev 3720)
+++ developers/sameo/patches/ar6k-ng/110-s3c24xx_sdio_merge.patch	2007-12-21 15:33:47 UTC (rev 3721)
@@ -1,7 +1,16 @@
-Index: linux-2.6.22.4/include/linux/mmc/host.h
+---
+ drivers/mmc/core/sd.c        |    7 -
+ drivers/mmc/core/sdio.c      |   37 ++++++--
+ drivers/mmc/host/mmc_debug.c |   14 +--
+ drivers/mmc/host/s3cmci.c    |  197 +++++++++++++++++++++++++++----------------
+ drivers/mmc/host/sdhci.c     |    2 
+ include/linux/mmc/host.h     |   10 +-
+ 6 files changed, 171 insertions(+), 96 deletions(-)
+
+Index: linux-2.6.22-atheros-ng/include/linux/mmc/host.h
 ===================================================================
---- linux-2.6.22.4.orig/include/linux/mmc/host.h	2007-09-29 05:27:44.122600789 +0200
-+++ linux-2.6.22.4/include/linux/mmc/host.h	2007-09-29 05:27:44.358614240 +0200
+--- linux-2.6.22-atheros-ng.orig/include/linux/mmc/host.h	2007-11-13 11:35:23.000000000 +0100
++++ linux-2.6.22-atheros-ng/include/linux/mmc/host.h	2007-11-13 11:36:41.000000000 +0100
 @@ -66,7 +66,14 @@
  	unsigned int		f_max;
  	u32			ocr_avail;
@@ -26,10 +35,10 @@
  	unsigned long		caps;		/* Host capabilities */
  
  #define MMC_CAP_4_BIT_DATA	(1 << 0)	/* Can the host do 4 bit transfers */
-Index: linux-2.6.22.4/drivers/mmc/core/sd.c
+Index: linux-2.6.22-atheros-ng/drivers/mmc/core/sd.c
 ===================================================================
---- linux-2.6.22.4.orig/drivers/mmc/core/sd.c	2007-09-29 05:27:43.202548358 +0200
-+++ linux-2.6.22.4/drivers/mmc/core/sd.c	2007-09-29 05:27:44.362614466 +0200
+--- linux-2.6.22-atheros-ng.orig/drivers/mmc/core/sd.c	2007-11-13 11:35:23.000000000 +0100
++++ linux-2.6.22-atheros-ng/drivers/mmc/core/sd.c	2007-11-13 11:36:41.000000000 +0100
 @@ -633,13 +633,6 @@
  		ocr &= ~0x7F;
  	}
@@ -44,11 +53,82 @@
  	host->ocr = mmc_select_voltage(host, ocr);
  
  	/*
-Index: linux-2.6.22.4/drivers/mmc/core/sdio.c
+Index: linux-2.6.22-atheros-ng/drivers/mmc/core/sdio.c
 ===================================================================
---- linux-2.6.22.4.orig/drivers/mmc/core/sdio.c	2007-09-29 05:27:43.478564088 +0200
-+++ linux-2.6.22.4/drivers/mmc/core/sdio.c	2007-10-07 01:37:32.380757691 +0200
-@@ -245,13 +245,6 @@
+--- linux-2.6.22-atheros-ng.orig/drivers/mmc/core/sdio.c	2007-11-13 11:35:23.000000000 +0100
++++ linux-2.6.22-atheros-ng/drivers/mmc/core/sdio.c	2007-12-18 18:25:18.000000000 +0100
+@@ -109,6 +109,8 @@
+ 	if (ret)
+ 		goto out;
+ 
++	printk("########### CAPS: 0x%x \n #####################\n", data);
++
+ 	if (data & SDIO_CCCR_CAP_SMB)
+ 		card->cccr.multi_block = 1;
+ 	if (data & SDIO_CCCR_CAP_LSC)
+@@ -116,13 +118,30 @@
+ 	if (data & SDIO_CCCR_CAP_4BLS)
+ 		card->cccr.wide_bus = 1;
+ 
++#if 0
++	if (!(data & SDIO_CCCR_CAP_E4MI)) {
++		data |= SDIO_CCCR_CAP_E4MI;
++		ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_CAPS, data, NULL);
++		if (ret)
++			return ret;
++	}
++
++#endif
++
++
+ 	if (cccr_vsn >= SDIO_CCCR_REV_1_10) {
+ 		ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_POWER, 0, &data);
+ 		if (ret)
+ 			goto out;
+ 
+-		if (data & SDIO_POWER_SMPC)
++		if (data & SDIO_POWER_SMPC) {
+ 			card->cccr.high_power = 1;
++			data |= SDIO_POWER_EMPC;
++			ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_POWER, data, NULL);
++			if (ret)
++				return ret;
++
++		}
+ 	}
+ 
+ 	if (cccr_vsn >= SDIO_CCCR_REV_1_20) {
+@@ -141,7 +160,7 @@
+ static int sdio_enable_wide(struct mmc_card *card)
+ {
+ 	int ret;
+-	u8 ctrl;
++	u8 ctrl, data;
+ 
+ 	if (!(card->host->caps & MMC_CAP_4_BIT_DATA))
+ 		return 0;
+@@ -154,6 +173,7 @@
+ 		return ret;
+ 
+ 	ctrl |= SDIO_BUS_WIDTH_4BIT;
++	ctrl |= SDIO_BUS_CD_DISABLE;
+ 
+ 	ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL);
+ 	if (ret)
+@@ -161,6 +181,12 @@
+ 
+ 	mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4);
+ 
++	data = SDIO_CCCR_CAP_E4MI | SDIO_CCCR_CAP_S4MI;
++	data |= SDIO_CCCR_CAP_SDC | SDIO_CCCR_CAP_SMB | SDIO_CCCR_CAP_SRW;
++	ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_CAPS, data, NULL);
++	if (ret)
++		return ret;
++
+ 	return 0;
+ }
+ 
+@@ -245,13 +271,6 @@
  		ocr &= ~0x7F;
  	}
  
@@ -62,10 +142,10 @@
  	host->ocr = mmc_select_voltage(host, ocr);
  
  	/*
-Index: linux-2.6.22.4/drivers/mmc/host/sdhci.c
+Index: linux-2.6.22-atheros-ng/drivers/mmc/host/sdhci.c
 ===================================================================
---- linux-2.6.22.4.orig/drivers/mmc/host/sdhci.c	2007-09-29 05:27:43.938590304 +0200
-+++ linux-2.6.22.4/drivers/mmc/host/sdhci.c	2007-09-29 05:27:44.406616970 +0200
+--- linux-2.6.22-atheros-ng.orig/drivers/mmc/host/sdhci.c	2007-11-13 11:35:23.000000000 +0100
++++ linux-2.6.22-atheros-ng/drivers/mmc/host/sdhci.c	2007-11-13 11:36:41.000000000 +0100
 @@ -679,7 +679,7 @@
  	pwr = SDHCI_POWER_ON;
  
@@ -75,10 +155,10 @@
  		pwr |= SDHCI_POWER_180;
  		break;
  	case MMC_VDD_29_30:
-Index: linux-2.6.22.4/drivers/mmc/host/mmc_debug.c
+Index: linux-2.6.22-atheros-ng/drivers/mmc/host/mmc_debug.c
 ===================================================================
---- linux-2.6.22.4.orig/drivers/mmc/host/mmc_debug.c	2007-09-29 05:27:39.122315835 +0200
-+++ linux-2.6.22.4/drivers/mmc/host/mmc_debug.c	2007-09-29 05:27:44.426618110 +0200
+--- linux-2.6.22-atheros-ng.orig/drivers/mmc/host/mmc_debug.c	2007-11-08 14:56:32.000000000 +0100
++++ linux-2.6.22-atheros-ng/drivers/mmc/host/mmc_debug.c	2007-11-13 11:36:41.000000000 +0100
 @@ -46,15 +46,11 @@
  char *mmc_err2str(int err)
  {
@@ -100,19 +180,33 @@
  		default: return "UNKNOWN";
  	}
  }
-Index: linux-2.6.22.4/drivers/mmc/host/s3cmci.c
+Index: linux-2.6.22-atheros-ng/drivers/mmc/host/s3cmci.c
 ===================================================================
---- linux-2.6.22.4.orig/drivers/mmc/host/s3cmci.c	2007-09-29 05:27:39.366329742 +0200
-+++ linux-2.6.22.4/drivers/mmc/host/s3cmci.c	2007-10-01 21:35:03.637395039 +0200
-@@ -14,6 +14,7 @@
- #include <linux/mmc/mmc.h>
+--- linux-2.6.22-atheros-ng.orig/drivers/mmc/host/s3cmci.c	2007-11-13 11:16:50.000000000 +0100
++++ linux-2.6.22-atheros-ng/drivers/mmc/host/s3cmci.c	2007-12-21 16:16:21.000000000 +0100
+@@ -11,9 +11,11 @@
+ #include <linux/module.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/clk.h>
+-#include <linux/mmc/mmc.h>
++#include <linux/mmc/card.h>
  #include <linux/mmc/host.h>
  #include <linux/platform_device.h>
 +#include <linux/timer.h>
++#include <linux/delay.h>
  #include <linux/irq.h>
  
  #include <asm/dma.h>
-@@ -129,7 +130,7 @@
+@@ -43,7 +45,7 @@
+ 
+ static const int dbgmap_err   = dbg_err | dbg_fail;
+ static const int dbgmap_info  = dbg_info | dbg_conf;
+-static const int dbgmap_debug = dbg_debug;
++static const int dbgmap_debug = dbg_debug | dbg_pio;
+ 
+ #define dbg(host, channels, args...)		 \
+ 	if (dbgmap_err & channels) 		 \
+@@ -129,7 +131,7 @@
  	if (!cmd)
  		return;
  
@@ -121,7 +215,7 @@
  
  		dbg(host, dbglvl, "CMD[OK] %s R0:0x%08x\n",
  			host->dbgmsg_cmd, cmd->resp[0]);
-@@ -142,7 +143,7 @@
+@@ -142,7 +144,7 @@
  	if (!cmd->data)
  		return;
  
@@ -130,16 +224,197 @@
  		dbg(host, dbglvl, "DAT[%s] %s\n",
  			mmc_err2str(cmd->data->error), host->dbgmsg_dat);
  	} else {
-@@ -334,7 +335,7 @@
+@@ -158,7 +160,7 @@
+ 	u32 newmask;
+ 
+ 	newmask = readl(host->base + host->sdiimsk);
+-	newmask|= imask;
++	newmask |= imask;
+ 
+ 	writel(newmask, host->base + host->sdiimsk);
+ 
+@@ -179,11 +181,14 @@
+ 
+ static inline void clear_imask(struct s3cmci_host *host)
+ {
+-	writel(0, host->base + host->sdiimsk);
++	if (host->sdio_int)
++		writel(S3C2410_SDIIMSK_SDIOIRQ, host->base + host->sdiimsk);
++	else
++		writel(0, host->base + host->sdiimsk);
+ }
+ 
+ static inline int get_data_buffer(struct s3cmci_host *host,
+-			volatile u32 *words, volatile u32 **pointer)
++				  volatile u32 *bytes, volatile u8 **pointer)
+ {
+ 	struct scatterlist *sg;
+ 
+@@ -200,7 +205,7 @@
+ 	}
+ 	sg = &host->mrq->data->sg[host->pio_sgptr];
+ 
+-	*words	= sg->length >> 2;
++	*bytes	= sg->length;
+ 	*pointer= page_address(sg->page) + sg->offset;
+ 
+ 	host->pio_sgptr++;
+@@ -211,8 +216,8 @@
+ 	return 0;
+ }
+ 
+-#define FIFO_FILL(host) ((readl(host->base + S3C2410_SDIFSTA) & S3C2410_SDIFSTA_COUNTMASK) >> 2)
+-#define FIFO_FREE(host) ((63 - (readl(host->base + S3C2410_SDIFSTA) & S3C2410_SDIFSTA_COUNTMASK)) >> 2)
++#define FIFO_FILL(host) ((readl(host->base + S3C2410_SDIFSTA) & S3C2410_SDIFSTA_COUNTMASK))
++#define FIFO_FREE(host) ((63 - (readl(host->base + S3C2410_SDIFSTA) & S3C2410_SDIFSTA_COUNTMASK)))
+ 
+ static inline void do_pio_read(struct s3cmci_host *host)
+ {
+@@ -226,9 +231,9 @@
+ 	from_ptr = host->base + host->sdidata;
+ 
+ 	while ((fifo = FIFO_FILL(host))) {
+-		if (!host->pio_words) {
+-			res = get_data_buffer(host, &host->pio_words,
+-							&host->pio_ptr);
++		if (!host->pio_bytes) {
++			res = get_data_buffer(host, &host->pio_bytes,
++					      &host->pio_ptr);
+ 			if (res) {
+ 				host->pio_active = XFER_NONE;
+ 				host->complete_what = COMPLETION_FINALIZE;
+@@ -239,27 +244,26 @@
+ 			}
+ 
+ 			dbg(host, dbg_pio, "pio_read(): new target: [%i]@[%p]\n",
+-			       host->pio_words, host->pio_ptr);
++			       host->pio_bytes, host->pio_ptr);
+ 		}
+ 
+ 		dbg(host, dbg_pio, "pio_read(): fifo:[%02i] "
+ 				   "buffer:[%03i] dcnt:[%08X]\n",
+-				   fifo, host->pio_words,
++				   fifo, host->pio_bytes,
+ 				   readl(host->base + S3C2410_SDIDCNT));
+ 
+-		if (fifo > host->pio_words)
+-			fifo = host->pio_words;
++		if (fifo > host->pio_bytes)
++			fifo = host->pio_bytes;
+ 
+-		host->pio_words-= fifo;
+-		host->pio_count+= fifo;
++		host->pio_bytes -= fifo;
++		host->pio_count += fifo;
+ 
+-		while(fifo--) {
+-			*(host->pio_ptr++) = readl(from_ptr);
+-		}
++		while(fifo--)
++			*(host->pio_ptr++) = readb(from_ptr);
+ 	}
+ 
+-	if (!host->pio_words) {
+-		res = get_data_buffer(host, &host->pio_words, &host->pio_ptr);
++	if (!host->pio_bytes) {
++		res = get_data_buffer(host, &host->pio_bytes, &host->pio_ptr);
+ 		if (res) {
+ 			dbg(host, dbg_pio, "pio_read(): "
+ 				"complete (no more buffers).\n");
+@@ -283,9 +287,9 @@
+ 	to_ptr = host->base + host->sdidata;
+ 
+ 	while ((fifo = FIFO_FREE(host))) {
+-		if (!host->pio_words) {
+-			res = get_data_buffer(host, &host->pio_words,
+-							&host->pio_ptr);
++		if (!host->pio_bytes) {
++			res = get_data_buffer(host, &host->pio_bytes,
++					      &host->pio_ptr);
+ 			if (res) {
+ 				dbg(host, dbg_pio, "pio_write(): "
+ 					"complete (no more data).\n");
+@@ -296,18 +300,18 @@
+ 
+ 			dbg(host, dbg_pio, "pio_write(): "
+ 				"new source: [%i]@[%p]\n",
+-				host->pio_words, host->pio_ptr);
++				host->pio_bytes, host->pio_ptr);
+ 
+ 		}
+ 
+-		if (fifo > host->pio_words)
+-			fifo = host->pio_words;
++		if (fifo > host->pio_bytes)
++			fifo = host->pio_bytes;
+ 
+-		host->pio_words-= fifo;
+-		host->pio_count+= fifo;
++		host->pio_bytes -= fifo;
++		host->pio_count += fifo;
+ 
+ 		while(fifo--) {
+-			writel(*(host->pio_ptr++), to_ptr);
++			writeb(*(host->pio_ptr++), to_ptr);
+ 		}
+ 	}
+ 
+@@ -330,11 +334,11 @@
+ 		clear_imask(host);
+ 		if (host->pio_active != XFER_NONE) {
+ 			dbg(host, dbg_err, "unfinished %s "
+-				"- pio_count:[%u] pio_words:[%u]\n",
++				"- pio_count:[%u] pio_bytes:[%u]\n",
  				(host->pio_active == XFER_READ)?"read":"write",
- 				host->pio_count, host->pio_words);
+-				host->pio_count, host->pio_words);
++				host->pio_count, host->pio_bytes);
  
 -			host->mrq->data->error = MMC_ERR_DMA;
 +			host->mrq->data->error = -EIO;
  		}
  
  		finalize_request(host);
-@@ -431,7 +432,7 @@
+@@ -375,6 +379,7 @@
+ 	struct mmc_command *cmd;
+ 	u32 mci_csta, mci_dsta, mci_fsta, mci_dcnt, mci_imsk;
+ 	u32 mci_cclear, mci_dclear;
++	int cardint = 0;
+ 	unsigned long iflags;
+ 
+ 	host = (struct s3cmci_host *)dev_id;
+@@ -389,8 +394,19 @@
+ 	mci_cclear	= 0;
+ 	mci_dclear	= 0;
+ 
++	if (mci_dsta & S3C2410_SDIDSTA_SDIOIRQDETECT) {
++		if (host->sdio_int) {
++			disable_imask(host, S3C2410_SDIIMSK_SDIOIRQ);
++			cardint = 1;
++			host->sdio_pending_int = 0;
++		} else {
++			host->sdio_pending_int = 1;
++		}
++		mci_dclear |= S3C2410_SDIDSTA_SDIOIRQDETECT;
++	}
++
+ 	if ((host->complete_what == COMPLETION_NONE) ||
+-			(host->complete_what == COMPLETION_FINALIZE)) {
++	    (host->complete_what == COMPLETION_FINALIZE)) {
+ 		host->status = "nothing to complete";
+ 		clear_imask(host);
+ 		goto irq_out;
+@@ -412,8 +428,8 @@
+ 
+ 	if (!host->dodma) {
+ 		if ((host->pio_active == XFER_WRITE) &&
+-				(mci_fsta & S3C2410_SDIFSTA_TFDET)) {
+-
++		    (mci_fsta & S3C2410_SDIFSTA_TFDET)) {
++
+ 			disable_imask(host, S3C2410_SDIIMSK_TXFIFOHALF);
+ 			tasklet_schedule(&host->pio_tasklet);
+ 			host->status = "pio tx";
+@@ -431,7 +447,7 @@
  	}
  
  	if (mci_csta & S3C2410_SDICMDSTAT_CMDTIMEOUT) {
@@ -148,7 +423,7 @@
  		host->status = "error: command timeout";
  		goto fail_transfer;
  	}
-@@ -452,7 +453,7 @@
+@@ -452,7 +468,7 @@
  				    "fixup: ignore CRC fail with long rsp\n");
  			} else {
  #if 0
@@ -157,7 +432,19 @@
  				host->status = "error: bad command crc";
  				goto fail_transfer;
  #endif
-@@ -482,32 +483,32 @@
+@@ -467,8 +483,10 @@
+ 			goto close_transfer;
+ 		}
+ 
+-		if (host->complete_what == COMPLETION_XFERFINISH_RSPFIN)
++		if (host->complete_what == COMPLETION_XFERFINISH_RSPFIN) {
+ 			host->complete_what = COMPLETION_XFERFINISH;
++			host->status = "ok: command response received, xfer to be done";
++		}
+ 
+ 		mci_cclear |= S3C2410_SDICMDSTAT_RSPFIN;
+ 	}
+@@ -482,32 +500,32 @@
  	/* Check for FIFO failure */
  	if (host->is2440) {
  		if (mci_fsta & S3C2440_SDIFSTA_FIFOFAIL) {
@@ -195,16 +482,27 @@
  		host->status = "error: data timeout";
  		goto fail_transfer;
  	}
-@@ -618,7 +628,7 @@
+@@ -549,6 +567,10 @@
+ 				mci_dcnt, host->status);
  
+ 	spin_unlock_irqrestore(&host->complete_lock, iflags);
++
++	/* We have to delay this as it calls back into the driver */
++	if (cardint)
++		mmc_signal_sdio_irq(host->mmc);
+ 	return IRQ_HANDLED;
  
+ }
+@@ -618,7 +640,7 @@
+ 
+ 
  fail_request:
 -	host->mrq->data->error = MMC_ERR_DMA;
 +	host->mrq->data->error = -EIO;
  	host->complete_what = COMPLETION_FINALIZE;
  	writel(0, host->base + host->sdiimsk);
  	goto out;
-@@ -637,8 +647,8 @@
+@@ -637,8 +659,8 @@
  	if (!mrq)
  		return;
  
@@ -215,8 +513,17 @@
  
  		if (host->dodma && (!host->dma_complete)) {
  			dbg(host, dbg_dma, "DMA Missing!\n");
-@@ -687,7 +697,7 @@
+@@ -670,7 +692,7 @@
+ 	writel(0, host->base + S3C2410_SDICMDARG);
+ 	writel(S3C2410_SDIDCON_STOP, host->base + S3C2410_SDIDCON);
+ 	writel(0, host->base + S3C2410_SDICMDCON);
+-	writel(0, host->base + host->sdiimsk);
++	clear_imask(host);
  
+ 	if (cmd->data && cmd->error)
+ 		cmd->data->error = cmd->error;
+@@ -687,7 +709,7 @@
+ 
  	// Calulate the amout of bytes transfer, but only if there was
  	// no error
 -	if (mrq->data->error == MMC_ERR_NONE) {
@@ -224,7 +531,7 @@
  		mrq->data->bytes_xfered =
  			(mrq->data->blocks * mrq->data->blksz);
  	} else {
-@@ -696,7 +706,7 @@
+@@ -696,7 +718,7 @@
  
  	// If we had an error while transfering data we flush the
  	// DMA channel and the fifo to clear out any garbage
@@ -233,7 +540,59 @@
  		if (host->dodma)
  			s3c2410_dma_ctrl(host->dma, S3C2410_DMAOP_FLUSH);
  
-@@ -956,8 +966,8 @@
+@@ -710,7 +732,7 @@
+ 
+ 			//reset fifo
+ 			mci_con = readl(host->base + S3C2410_SDICON);
+-			mci_con|= S3C2410_SDICON_FIFORESET;
++			mci_con |= S3C2410_SDICON_FIFORESET;
+ 
+ 			writel(mci_con, host->base + S3C2410_SDICON);
+ 		}
+@@ -775,6 +797,9 @@
+ 	if (cmd->flags & MMC_RSP_136)
+ 		ccon|= S3C2410_SDICMDCON_LONGRSP;
+ 
++	if (cmd->data)
++		ccon |= S3C2410_SDICMDCON_WITHDATA;
++
+ 	writel(ccon, host->base + S3C2410_SDICMDCON);
+ }
+ 
+@@ -832,7 +857,8 @@
+ 	}
+ 
+ 	if (host->is2440) {
+-		dcon |= S3C2440_SDIDCON_DS_WORD;
++		dcon |= S3C2440_SDIDCON_DS_BYTE;
++//		dcon |= S3C2440_SDIDCON_DS_WORD;
+ 		dcon |= S3C2440_SDIDCON_DATSTART;
+ 	}
+ 
+@@ -857,12 +883,11 @@
+ 
+ 		//FIX: set slow clock to prevent timeouts on read
+ 		if (data->flags & MMC_DATA_READ) {
++			printk("######## FIX ########## \n");
+ 			writel(0xFF, host->base + S3C2410_SDIPRE);
+ 		}
+ 	}
+ 
+-	//debug_dump_registers(host, "Data setup:");
+-
+ 	return 0;
+ }
+ 
+@@ -874,7 +899,7 @@
+ 		return -EINVAL;
+ 
+ 	host->pio_sgptr = 0;
+-	host->pio_words = 0;
++	host->pio_bytes = 0;
+ 	host->pio_count = 0;
+ 	host->pio_active = rw?XFER_WRITE:XFER_READ;
+ 
+@@ -956,8 +981,8 @@
  		host->dcnt++;
  
  		if (res) {
@@ -244,7 +603,7 @@
  
  			mmc_request_done(mmc, mrq);
  			return;
-@@ -971,8 +981,8 @@
+@@ -971,8 +996,8 @@
  		}
  
  		if (res) {
@@ -255,4 +614,103 @@
  
  			mmc_request_done(mmc, mrq);
  			return;
-
+@@ -1018,7 +1043,7 @@
+ 				host->pdata->set_power(ios->power_mode, ios->vdd);
+ 
+ 			if (!host->is2440)
+-				mci_con|=S3C2410_SDICON_FIFORESET;
++				mci_con |= S3C2410_SDICON_FIFORESET;
+ 
+ 			break;
+ 
+@@ -1031,7 +1056,7 @@
+ 				host->pdata->set_power(ios->power_mode, ios->vdd);
+ 
+ 			if (host->is2440)
+-				mci_con|=S3C2440_SDICON_SDRESET;
++				mci_con |= S3C2440_SDICON_SDRESET;
+ 
+ 			break;
+ 	}
+@@ -1059,9 +1084,11 @@
+ 	else
+ 		mci_con &=~S3C2410_SDICON_CLOCKTYPE;
+ 
++	mci_con |= S3C2410_SDICON_SDIOIRQ;
++
+ 	writel(mci_con, host->base + S3C2410_SDICON);
+ 
+-	if ((ios->power_mode==MMC_POWER_ON)
++	if ((ios->power_mode == MMC_POWER_ON)
+ 		|| (ios->power_mode==MMC_POWER_UP)) {
+ 
+ 		dbg(host, dbg_conf, "running at %lukHz (requested: %ukHz).\n",
+@@ -1093,10 +1120,39 @@
+ 	return s3c2410_gpio_getpin(host->pdata->gpio_wprotect);
+ }
+ 
++void s3cmci_enable_sdio_irq(struct mmc_host *mmc, int enable)
++{
++	struct s3cmci_host *host = mmc_priv(mmc);
++	u32 con, imask;
++
++	con = readl(host->base + S3C2410_SDICON);
++	imask = readl(host->base + host->sdiimsk);
++
++	if (enable) {
++		host->sdio_int = 1;
++		con |= S3C2410_SDICON_SDIOIRQ;
++		imask |= S3C2410_SDIIMSK_SDIOIRQ;
++		if (host->sdio_pending_int) {
++			printk("We have a pending INT\n");
++			mmc_signal_sdio_irq(host->mmc);
++			host->sdio_pending_int = 0;
++		}
++	} else {
++
++		host->sdio_int = 0;
++		con &= ~S3C2410_SDICON_SDIOIRQ;
++		imask &= ~S3C2410_SDIIMSK_SDIOIRQ;
++	}
++
++	writel(imask, host->base + host->sdiimsk);
++	writel(con, host->base + S3C2410_SDICON);
++}
++
+ static struct mmc_host_ops s3cmci_ops = {
+-	.request	= s3cmci_request,
+-	.set_ios	= s3cmci_set_ios,
+-	.get_ro		= s3cmci_get_ro,
++	.request		= s3cmci_request,
++	.set_ios		= s3cmci_set_ios,
++	.get_ro			= s3cmci_get_ro,
++	.enable_sdio_irq	= s3cmci_enable_sdio_irq,
+ };
+ 
+ static struct s3c24xx_mci_pdata s3cmci_def_pdata = {
+@@ -1142,6 +1198,7 @@
+ 		host->sdidata	= S3C2410_SDIDATA;
+ 		host->clk_div	= 2;
+ 	}
++	host->sdio_int		= 0;
+ 	host->dodma		= 0;
+ 	host->complete_what 	= COMPLETION_NONE;
+ 	host->pio_active 	= XFER_NONE;
+@@ -1228,7 +1285,7 @@
+ 
+ 	mmc->ops 	= &s3cmci_ops;
+ 	mmc->ocr_avail	= host->pdata->ocr_avail;
+-	mmc->caps	= MMC_CAP_4_BIT_DATA;
++	mmc->caps	= MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ;
+ 	mmc->f_min 	= host->clk_rate / (host->clk_div * 256);
+ 	mmc->f_max 	= host->clk_rate / host->clk_div;
+ 
+@@ -1249,6 +1306,8 @@
+ 		goto free_dmabuf;
+ 	}
+ 
++	mmc_detect_change(host->mmc, 500);
++
+ 	platform_set_drvdata(pdev, mmc);
+ 
+ 	dev_info(&pdev->dev,"initialisation done.\n");

Modified: developers/sameo/patches/ar6k-ng/130-gta02v2.patch
===================================================================
--- developers/sameo/patches/ar6k-ng/130-gta02v2.patch	2007-12-21 14:29:14 UTC (rev 3720)
+++ developers/sameo/patches/ar6k-ng/130-gta02v2.patch	2007-12-21 15:33:47 UTC (rev 3721)
@@ -18,7 +18,7 @@
 Index: linux-2.6.22-atheros-ng/arch/arm/mach-s3c2440/mach-gta02.c
 ===================================================================
 --- linux-2.6.22-atheros-ng.orig/arch/arm/mach-s3c2440/mach-gta02.c	2007-11-13 11:35:09.000000000 +0100
-+++ linux-2.6.22-atheros-ng/arch/arm/mach-s3c2440/mach-gta02.c	2007-12-10 23:24:45.000000000 +0100
++++ linux-2.6.22-atheros-ng/arch/arm/mach-s3c2440/mach-gta02.c	2007-12-21 16:19:23.000000000 +0100
 @@ -310,7 +310,7 @@
  	&s3c_device_wdt,
  	&s3c_device_i2c,

Modified: developers/sameo/patches/ar6k-ng/140-s3c24xx_mci_platform.patch
===================================================================
--- developers/sameo/patches/ar6k-ng/140-s3c24xx_mci_platform.patch	2007-12-21 14:29:14 UTC (rev 3720)
+++ developers/sameo/patches/ar6k-ng/140-s3c24xx_mci_platform.patch	2007-12-21 15:33:47 UTC (rev 3721)
@@ -6,8 +6,8 @@
 
 Index: linux-2.6.22-atheros-ng/arch/arm/plat-s3c24xx/devs.c
 ===================================================================
---- linux-2.6.22-atheros-ng.orig/arch/arm/plat-s3c24xx/devs.c	2007-11-13 11:40:06.000000000 +0100
-+++ linux-2.6.22-atheros-ng/arch/arm/plat-s3c24xx/devs.c	2007-11-13 11:43:31.000000000 +0100
+--- linux-2.6.22-atheros-ng.orig/arch/arm/plat-s3c24xx/devs.c	2007-12-10 23:24:45.000000000 +0100
++++ linux-2.6.22-atheros-ng/arch/arm/plat-s3c24xx/devs.c	2007-12-10 23:24:50.000000000 +0100
 @@ -421,6 +421,16 @@
  
  EXPORT_SYMBOL(s3c_device_sdi);
@@ -27,8 +27,8 @@
  static struct resource s3c_hsmmc_resource[] = {
 Index: linux-2.6.22-atheros-ng/arch/arm/mach-s3c2440/mach-gta02.c
 ===================================================================
---- linux-2.6.22-atheros-ng.orig/arch/arm/mach-s3c2440/mach-gta02.c	2007-11-13 11:42:29.000000000 +0100
-+++ linux-2.6.22-atheros-ng/arch/arm/mach-s3c2440/mach-gta02.c	2007-12-10 21:26:50.000000000 +0100
+--- linux-2.6.22-atheros-ng.orig/arch/arm/mach-s3c2440/mach-gta02.c	2007-12-10 23:24:45.000000000 +0100
++++ linux-2.6.22-atheros-ng/arch/arm/mach-s3c2440/mach-gta02.c	2007-12-10 23:24:50.000000000 +0100
 @@ -305,12 +305,41 @@
  	},
  };
@@ -132,8 +132,8 @@
  	s3c2410_pm_init();
 Index: linux-2.6.22-atheros-ng/include/asm-arm/plat-s3c24xx/devs.h
 ===================================================================
---- linux-2.6.22-atheros-ng.orig/include/asm-arm/plat-s3c24xx/devs.h	2007-11-13 11:45:12.000000000 +0100
-+++ linux-2.6.22-atheros-ng/include/asm-arm/plat-s3c24xx/devs.h	2007-11-13 11:45:16.000000000 +0100
+--- linux-2.6.22-atheros-ng.orig/include/asm-arm/plat-s3c24xx/devs.h	2007-12-10 23:24:45.000000000 +0100
++++ linux-2.6.22-atheros-ng/include/asm-arm/plat-s3c24xx/devs.h	2007-12-10 23:24:50.000000000 +0100
 @@ -29,6 +29,7 @@
  extern struct platform_device s3c_device_rtc;
  extern struct platform_device s3c_device_adc;

Modified: developers/sameo/patches/ar6k-ng/150-mmc_powerup_delay.patch
===================================================================
--- developers/sameo/patches/ar6k-ng/150-mmc_powerup_delay.patch	2007-12-21 14:29:14 UTC (rev 3720)
+++ developers/sameo/patches/ar6k-ng/150-mmc_powerup_delay.patch	2007-12-21 15:33:47 UTC (rev 3721)
@@ -5,7 +5,7 @@
 Index: linux-2.6.22-atheros-ng/drivers/mmc/core/core.c
 ===================================================================
 --- linux-2.6.22-atheros-ng.orig/drivers/mmc/core/core.c	2007-12-10 23:28:26.000000000 +0100
-+++ linux-2.6.22-atheros-ng/drivers/mmc/core/core.c	2007-12-10 23:28:28.000000000 +0100
++++ linux-2.6.22-atheros-ng/drivers/mmc/core/core.c	2007-12-18 14:24:06.000000000 +0100
 @@ -462,13 +462,15 @@
  	host->ios.timing = MMC_TIMING_LEGACY;
  	mmc_set_ios(host);

Modified: developers/sameo/patches/ar6k-ng/155-sdio_io_generic_rw.patch
===================================================================
--- developers/sameo/patches/ar6k-ng/155-sdio_io_generic_rw.patch	2007-12-21 14:29:14 UTC (rev 3720)
+++ developers/sameo/patches/ar6k-ng/155-sdio_io_generic_rw.patch	2007-12-21 15:33:47 UTC (rev 3721)
@@ -1,12 +1,24 @@
 ---
- drivers/mmc/core/sdio_io.c |   60 +++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 60 insertions(+)
+ drivers/mmc/core/sdio_io.c |   64 +++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 64 insertions(+)
 
 Index: linux-2.6.22-atheros-ng/drivers/mmc/core/sdio_io.c
 ===================================================================
 --- linux-2.6.22-atheros-ng.orig/drivers/mmc/core/sdio_io.c	2007-12-11 22:00:41.000000000 +0100
-+++ linux-2.6.22-atheros-ng/drivers/mmc/core/sdio_io.c	2007-12-11 22:01:56.000000000 +0100
-@@ -254,6 +254,66 @@
++++ linux-2.6.22-atheros-ng/drivers/mmc/core/sdio_io.c	2007-12-18 13:59:16.000000000 +0100
+@@ -177,6 +177,11 @@
+ 			512u);
+ 	}
+ 
++
++	blksz = 0x80;
++
++	printk("######## BLOCK size: 0x%x ############## \n", blksz);
++
+ 	ret = mmc_io_rw_direct(func->card, 1, 0,
+ 		SDIO_FBR_BASE(func->num) + SDIO_FBR_BLKSIZE,
+ 		blksz & 0xff, NULL);
+@@ -254,6 +259,65 @@
  	return 0;
  }
  
@@ -34,9 +46,8 @@
 +			}
 +			size = block_count * block_size;
 +
-+			ret = mmc_io_rw_extended(func->card, write,
-+						 func->num, addr, incr_addr, buf,
-+						 block_count, block_size);
++			ret = mmc_io_rw_extended(func->card, write, func->num, addr,
++						 incr_addr, buf, block_count, block_size);
 +			if (ret)
 +				return ret;
 +

Modified: developers/sameo/patches/ar6k-ng/160-ar6k_ng.patch
===================================================================
--- developers/sameo/patches/ar6k-ng/160-ar6k_ng.patch	2007-12-21 14:29:14 UTC (rev 3720)
+++ developers/sameo/patches/ar6k-ng/160-ar6k_ng.patch	2007-12-21 15:33:47 UTC (rev 3721)
@@ -4,15 +4,15 @@
  drivers/net/wireless/ar6k/Kconfig                      |   11 
  drivers/net/wireless/ar6k/Makefile                     |   19 
  drivers/net/wireless/ar6k/ar6k.h                       |   68 
- drivers/net/wireless/ar6k/ar6k_main.c                  | 5580 +++++++++++++++++
+ drivers/net/wireless/ar6k/ar6k_main.c                  | 5579 +++++++++++++++++
  drivers/net/wireless/ar6k/bmi.c                        |  466 +
- drivers/net/wireless/ar6k/hif.c                        |  289 
+ drivers/net/wireless/ar6k/hif.c                        |  306 
  drivers/net/wireless/ar6k/hif.h                        |   87 
  drivers/net/wireless/ar6k/htc/Makefile                 |    5 
- drivers/net/wireless/ar6k/htc/htc.c                    |  445 +
- drivers/net/wireless/ar6k/htc/htc_events.c             |  934 ++
+ drivers/net/wireless/ar6k/htc/htc.c                    |  460 +
+ drivers/net/wireless/ar6k/htc/htc_events.c             |  941 ++
  drivers/net/wireless/ar6k/htc/htc_internal.h           |  456 +
- drivers/net/wireless/ar6k/htc/htc_recv.c               |  205 
+ drivers/net/wireless/ar6k/htc/htc_recv.c               |  204 
  drivers/net/wireless/ar6k/htc/htc_send.c               |  389 +
  drivers/net/wireless/ar6k/htc/htc_utils.c              |  394 +
  drivers/net/wireless/ar6k/include/AR6000_bmi.h         |  136 
@@ -49,7 +49,7 @@
  drivers/net/wireless/ar6k/wlan/wlan_recv_beacon.c      |  169 
  drivers/net/wireless/ar6k/wlan/wlan_utils.c            |   53 
  drivers/net/wireless/ar6k/wmi.c                        | 2834 ++++++++
- 50 files changed, 20738 insertions(+)
+ 50 files changed, 20775 insertions(+)
 
 Index: linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/ar6k.h
 ===================================================================
@@ -127,8 +127,8 @@
 Index: linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/ar6k_main.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/ar6k_main.c	2007-12-11 22:02:08.000000000 +0100
-@@ -0,0 +1,5580 @@
++++ linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/ar6k_main.c	2007-12-19 21:42:39.000000000 +0100
+@@ -0,0 +1,5579 @@
 +/*
 + * Copyright (c) 2004-2006 Atheros Communications Inc.
 + * Copyright (c) 2007 Felix Fietkau <nbd at openwrt.org>
@@ -1016,8 +1016,7 @@
 +	if (!bypasswmi) {
 +		/* Wait for Wmi event to be ready */
 +		timeleft = wait_event_interruptible_timeout(arEvent,
-+													(ar->arWmiReady ==
-+													 TRUE), 1 * HZ);
++							    (ar->arWmiReady == TRUE), 10 * HZ);
 +
 +		if (!timeleft || signal_pending(current)) {
 +			AR_DEBUG_PRINTF("WMI is not ready or wait was interrupted\n");
@@ -5712,7 +5711,7 @@
 Index: linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/bmi.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/bmi.c	2007-12-12 12:32:26.000000000 +0100
++++ linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/bmi.c	2007-12-20 20:11:29.000000000 +0100
 @@ -0,0 +1,466 @@
 +/*
 + * Copyright (c) 2004-2006 Atheros Communications Inc.
@@ -5748,7 +5747,7 @@
 +It shall make HTC state machine relatively simpler
 +*/
 +
-+#define BMI_COMMUNICATION_TIMEOUT       100000
++#define BMI_COMMUNICATION_TIMEOUT       10000
 +
 +/* ------ Static Variables ------ */
 +
@@ -5785,9 +5784,9 @@
 +	bmiDone = TRUE;
 +	cid = BMI_DONE;
 +
-+	sdio_claim_host(device);
++//	sdio_claim_host(device);
 +	status = bmiBufferSend(device, (u8 *) & cid, sizeof(cid));
-+	sdio_release_host(device);
++//	sdio_release_host(device);
 +
 +	if (status != A_OK) {
 +		AR_DEBUG_PRINTF("Unable to write to the device\n");
@@ -5811,18 +5810,18 @@
 +	AR_DEBUG_PRINTF("BMI Get Target ID: Enter (device: 0x%p)\n", device);
 +	cid = BMI_GET_TARGET_ID;
 +
-+	sdio_claim_host(device);
++//	sdio_claim_host(device);
 +	status = bmiBufferSend(device, (u8 *) & cid, sizeof(cid));
-+	sdio_release_host(device);
++//	sdio_release_host(device);
 +	if (status != A_OK) {
 +		AR_DEBUG_PRINTF("Unable to write to the device\n");
 +		return A_ERROR;
 +	}
 +
-+#if 0
-+	sdio_claim_host(device);
++#if 1
++//	sdio_claim_host(device);
 +	status = bmiBufferReceive(device, (u8 *) id, sizeof(*id));
-+	sdio_release_host(device);
++//	sdio_release_host(device);
 +
 +	if (status != A_OK) {
 +		AR_DEBUG_PRINTF("Unable to read from the device\n");
@@ -6183,8 +6182,8 @@
 Index: linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/hif.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/hif.c	2007-12-12 12:07:48.000000000 +0100
-@@ -0,0 +1,289 @@
++++ linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/hif.c	2007-12-20 21:07:46.000000000 +0100
+@@ -0,0 +1,306 @@
 +/*
 + * Copyright (c) 2004-2005 Atheros Communications Inc.
 + *
@@ -6313,7 +6312,6 @@
 +		sdio_release_host(func);
 +		return ret;
 +	}
-+
 +#if 0
 +	ret = sdio_claim_irq(func, hifIRQHandler);
 +	if (ret) {
@@ -6323,7 +6321,6 @@
 +		return ret;
 +	}
 +#endif
-+
 +	sdio_release_host(func);
 +
 +	/*
@@ -6339,7 +6336,8 @@
 +	 * investigate this a bit more - TODO
 +	 */
 +
-+	A_MDELAY(800);
++	mdelay(800);
++//	A_MDELAY(800);
 +
 +	/* Inform HTC */
 +	if ((htcCallbacks.deviceInsertedHandler(func)) != A_OK) {
@@ -6348,7 +6346,21 @@
 +	}
 +
 +
++#if 0
++	sdio_claim_host(func);
 +
++	ret = sdio_claim_irq(func, hifIRQHandler);
++	if (ret) {
++		printk("%s(), claim_irq failed ret %d\n", __FUNCTION__, ret);
++		sdio_disable_func(func);
++		sdio_release_host(func);
++		return ret;
++	}
++
++	sdio_release_host(func);
++#endif
++
++
 +	return 0;
 +}
 +
@@ -6427,6 +6439,7 @@
 +int hif_rw(struct sdio_func *func, u32 write, u32 incr_mode, u32 block_mode,
 +	   u32 address, u8 * buffer, u32 length)
 +{
++	int status;
 +	u32 block, block_size, block_count, rw, incr;
 +
 +	if (block_mode == HIF_BLOCK_BASIS) {
@@ -6470,9 +6483,12 @@
 +		return -EINVAL;
 +	}
 +
++	sdio_claim_host(func);
++	status = sdio_io_rw(func, rw, block, block_size, block_count,
++			    address, incr, buffer, length);
++	sdio_release_host(func);
 +
-+	return sdio_io_rw(func, rw, block, block_size, block_count,
-+			  address, incr, buffer, length);
++	return status;
 +}
 Index: linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/hif.h
 ===================================================================
@@ -6569,8 +6585,8 @@
 Index: linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/htc/htc.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/htc/htc.c	2007-12-11 22:02:08.000000000 +0100
-@@ -0,0 +1,445 @@
++++ linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/htc/htc.c	2007-12-20 21:11:48.000000000 +0100
+@@ -0,0 +1,460 @@
 +/*
 + * Copyright (c) 2004-2006 Atheros Communications Inc.
 + * Copyright (c) 2007 Felix Fietkau <nbd at openwrt.org>
@@ -6653,6 +6669,17 @@
 +
 +	AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HTCStart Enter\n"));
 +
++	sdio_claim_host(target->device);
++
++	status = sdio_claim_irq(target->device, hifIRQHandler);
++	if (status) {
++		printk("%s(), claim_irq failed ret %d\n", __FUNCTION__, status);
++		return status;
++	}
++
++	sdio_release_host(target->device);
++
++
 +	/* Unmask the host controller interrupts */
 +	status = HIFUnMaskInterrupt(target->device);
 +	if (status) {
@@ -6683,8 +6710,10 @@
 +
 +	/* Write to the register */
 +	address = getRegAddr(INT_STATUS_ENABLE_REG, ENDPOINT_UNUSED);
++//	sdio_claim_host(target->device);
 +	status = hif_rw(target->device, HIF_WRITE, HIF_INCREMENTAL_ADDRESS, HIF_BYTE_BASIS,
 +			address, &target->table.int_status_enable, 4);
++//	sdio_release_host(target->device);
 +//	status =
 +//		sdio_memcpy_toio(target->device, address,
 +//						 &target->table.int_status_enable, 4);
@@ -6952,8 +6981,10 @@
 +	window_data = RESET_CONTROL_COLD_RST_MASK;
 +	address = getRegAddr(WINDOW_DATA_REG, ENDPOINT_UNUSED);
 +
++//	sdio_claim_host(target->device);
 +	status = hif_rw(target->device, HIF_WRITE, HIF_INCREMENTAL_ADDRESS, HIF_BYTE_BASIS,
 +			address, (u8 *)&window_data, 4);
++//	sdio_release_host(target->device);
 +
 +//sdio_writel(target->device, window_data, address, &status);
 +	AR_DEBUG_ASSERT(status == 0);
@@ -7019,8 +7050,8 @@
 Index: linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/htc/htc_events.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/htc/htc_events.c	2007-12-11 22:02:08.000000000 +0100
-@@ -0,0 +1,934 @@
++++ linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/htc/htc_events.c	2007-12-20 20:52:46.000000000 +0100
+@@ -0,0 +1,941 @@
 +/*
 + * Copyright (c) 2004-2006 Atheros Communications Inc.
 + *
@@ -7554,6 +7585,7 @@
 +	u8 host_int_status;
 +
 +	printk("%s()\n", __FUNCTION__);
++	sdio_release_host(device);
 +
 +	target = getTargetInstance(device);
 +	AR_DEBUG_ASSERT(target != NULL);
@@ -7573,8 +7605,10 @@
 +	 *             sizeof(counter_int_status_enable);
 +	 */
 +	address = getRegAddr(INT_STATUS_REG, ENDPOINT_UNUSED);
++
 +	status = hif_rw(target->device, HIF_READ, HIF_INCREMENTAL_ADDRESS, HIF_BYTE_BASIS,
 +			address, &target->table.host_int_status, 28);
++
 +//	status =
 +//		sdio_memcpy_fromio(target->device, &target->table.host_int_status,
 +//				   address, 28);
@@ -7617,6 +7651,7 @@
 +		AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("htcDSRHandler - ACK\n"));
 +	}
 +
++	sdio_claim_host(device);
 +	AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("htcDSRHandler: Exit\n"));
 +	return 0;
 +}
@@ -7806,6 +7841,7 @@
 +			(target->endPoint[2].txCreditsIntrEnable << (6)) |
 +			(target->endPoint[3].txCreditsIntrEnable << (7)) | 0x0F);
 +
++	A_MUTEX_UNLOCK(&counterCS);
 +
 +	status = hif_rw(target->device, HIF_WRITE, HIF_FIXED_ADDRESS, HIF_BYTE_BASIS,
 +			address, (u8 *)&((GET_REG_BUFFER(element))->offset), 1);
@@ -7822,7 +7858,7 @@
 +				     0x0F),
 +		    address, &status);
 +#endif
-+	A_MUTEX_UNLOCK(&counterCS);
++//	A_MUTEX_UNLOCK(&counterCS);
 +}
 +
 +void
@@ -7871,6 +7907,8 @@
 +			(target->endPoint[2].txCreditsIntrEnable << (6)) |
 +			(target->endPoint[3].txCreditsIntrEnable << (7)) | 0x0F);
 +
++	A_MUTEX_UNLOCK(&counterCS);
++
 +	status = hif_rw(target->device, HIF_WRITE, HIF_FIXED_ADDRESS, HIF_BYTE_BASIS,
 +			address, (u8 *)&((GET_REG_BUFFER(element))->offset), 1);
 +
@@ -7884,16 +7922,16 @@
 +								     [1].
 +								     txCreditsIntrEnable
 +								     << (5)) |
-+								 (target->endPoint[2].
-+								  txCreditsIntrEnable << (6)) |
++				     (target->endPoint[2].
++				      txCreditsIntrEnable << (6)) |
 +				     (target->
-+												 endPoint
-+												 [3].
-+												 txCreditsIntrEnable
-+												 << (7)) |
++				      endPoint
++				      [3].
++				      txCreditsIntrEnable
++				      << (7)) |
 +				     0x0F), address, &status);
 +#endif
-+	A_MUTEX_UNLOCK(&counterCS);
++//	A_MUTEX_UNLOCK(&counterCS);
 +}
 +
 +void htcServiceMailboxInterrupt(HTC_TARGET * target)
@@ -8419,8 +8457,8 @@
 Index: linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/htc/htc_recv.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/htc/htc_recv.c	2007-12-11 22:02:08.000000000 +0100
-@@ -0,0 +1,205 @@
++++ linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/htc/htc_recv.c	2007-12-20 20:02:01.000000000 +0100
+@@ -0,0 +1,204 @@
 +/*
 + * Copyright (c) 2004-2006 Atheros Communications Inc.
 + *
@@ -8575,7 +8613,6 @@
 +	/* FIXME: async request */
 +	status = hif_rw(target->device, HIF_READ, HIF_INCREMENTAL_ADDRESS, block_mode,
 +			endPoint->address, mboxBuffer->buffer, mboxBuffer->actualLength);
-+
 +//	status = sdio_memcpy_fromio(target->device, mboxBuffer->buffer,
 +//								endPoint->address,
 +//								mboxBuffer->actualLength);
@@ -9023,7 +9060,7 @@
 Index: linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/htc/htc_utils.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/htc/htc_utils.c	2007-12-11 22:02:08.000000000 +0100
++++ linux-2.6.22-atheros-ng/drivers/net/wireless/ar6k/htc/htc_utils.c	2007-12-20 20:17:41.000000000 +0100
 @@ -0,0 +1,394 @@
 +/*
 + * Copyright (c) 2004-2006 Atheros Communications Inc.
@@ -9080,12 +9117,12 @@
 +					("dispatchEvent(endpoint: %d, eventId: 0x%d, handler: 0x%p)\n",
 +					 endPointId, eventElement->id, eventElement->handler));
 +	if (eventElement->handler) {
-+		if (claim)
-+			sdio_claim_host(target->device);
++//		if (claim)
++//			sdio_claim_host(target->device);
 +		eventElement->handler(target, endPointId, eventId, eventInfo,
 +				      eventElement->param);
-+		if (claim)
-+			sdio_release_host(target->device);
++//		if (claim)
++//			sdio_release_host(target->device);
 +	}
 +}
 +

Modified: developers/sameo/patches/ar6k-ng/series
===================================================================
--- developers/sameo/patches/ar6k-ng/series	2007-12-21 14:29:14 UTC (rev 3720)
+++ developers/sameo/patches/ar6k-ng/series	2007-12-21 15:33:47 UTC (rev 3721)
@@ -1,6 +1,7 @@
 s3c2440_wlan_gpio_cfg.patch
 100-sdio_merge.patch
 110-s3c24xx_sdio_merge.patch
+115-s3cmci_sdio.patch
 130-gta02v2.patch
 140-s3c24xx_mci_platform.patch
 150-mmc_powerup_delay.patch





More information about the commitlog mailing list