Re: [PATCH] Samsung S3C24xx SD/MMC driver

2007-12-19 Thread Harald Welte
Hi Pierre,

thanks for your comments.

On Wed, Dec 19, 2007 at 05:54:33PM +0100, Pierre Ossman wrote:
> Well, my biggest beef with this driver is the excessive debug code. I
> did a cleanup in an older version of the driver, but it shouldn't be
> to difficult to do the same for this one. I've included my patch for
> reference.

ok, I'll re-work the patch according to your sample and re-submit.

The debugging was needed during development, and might still be needed
to debug some weird issues.

btw: OpenMoko is currently working on an ar6k wifi driver on top of the 
new mainline kernel SDIO support using the s3c_mci host controller
driver as basis.  So within not-too-distant-time we should also be able
to have SDIO working and tested on s3c_mci.

> > Index: linux-2.6/drivers/mmc/host/s3cmci.c
> > ===
> > --- /dev/null
> > +++ linux-2.6/drivers/mmc/host/s3cmci.c
> 
> > +#include 
> 
> This is always a warning sign. It should never be needed in a host driver.

ok, will see how to remove it.

> > +   *words = sg->length >> 2;
> > +   *pointer = page_address(sg_page(sg)) + sg->offset;
> > +
> 
> The length might not be a multiple of four. And it might also be
> completely unaligned. Make sure you can either handle such requests,
> or fail them with -EINVAL.

ok, will update before submitting the next version.
-- 
- Harald Welte <[EMAIL PROTECTED]>  http://openmoko.org/

Software for the world's first truly open Free Software mobile phone
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Samsung S3C24xx SD/MMC driver

2007-12-19 Thread Pierre Ossman
On Wed, 19 Dec 2007 15:22:13 +0100
Harald Welte <[EMAIL PROTECTED]> wrote:

> Hi!
> 
> This is a MMC/SD driver for the Samsung S3C24xx SD/MMC controller, originally
> developed years ago by Thomas Kleffel <[EMAIL PROTECTED]>.
> 
> Due to time constraints, he had no time to further maintain the driver
> and follow the mainline Linux changes in the SD/MMC stack.
> 
> With his authorization, I have taken over the task of making it
> compliant to the current mainline SD/MMC API and take care of the
> mainline kernel merge.
> 
> So please advise on whatever changes you deem neccessary and I'll try to
> do my best to incorporate them for a hopefully not-too-distant mainline
> merge.
> 
> After a potential kernel inclusion, we would co-maintain the driver.
> 
> Acked-by: Thomas Kleffel <[EMAIL PROTECTED]>
> Signed-off-by: Harald Welte <[EMAIL PROTECTED]>
> 
> ---

Well, my biggest beef with this driver is the excessive debug code. I did a 
cleanup in an older version of the driver, but it shouldn't be to difficult to 
do the same for this one. I've included my patch for reference.

> Index: linux-2.6/drivers/mmc/host/s3cmci.c
> ===
> --- /dev/null
> +++ linux-2.6/drivers/mmc/host/s3cmci.c

> +#include 

This is always a warning sign. It should never be needed in a host driver.


> +
> +static inline int get_data_buffer(struct s3cmci_host *host,
> +   u32 *words, u32 **pointer)
> +{
> + struct scatterlist *sg;
> +
> + if (host->pio_active == XFER_NONE)
> + return -EINVAL;
> +
> + if ((!host->mrq) || (!host->mrq->data))
> + return -EINVAL;
> +
> + if (host->pio_sgptr >= host->mrq->data->sg_len) {
> + dbg(host, dbg_debug, "no more buffers (%i/%i)\n",
> +   host->pio_sgptr, host->mrq->data->sg_len);
> + return -EBUSY;
> + }
> + sg = >mrq->data->sg[host->pio_sgptr];
> +
> + *words = sg->length >> 2;
> + *pointer = page_address(sg_page(sg)) + sg->offset;
> +

The length might not be a multiple of four. And it might also be completely 
unaligned. Make sure you can either handle such requests, or fail them with 
-EINVAL.

Rgds
-- 
 -- Pierre Ossman

  Linux kernel, MMC maintainerhttp://www.kernel.org
  PulseAudio, core developer  http://pulseaudio.org
  rdesktop, core developer  http://www.rdesktop.org
commit 4e47c91b7ca45940af384d3c9919a0eb160a2fb9
Author: Pierre Ossman <[EMAIL PROTECTED]>
Date:   Fri Jun 1 08:19:15 2007 +0200

s3mci: remove extra debug info

Remove excessive and unmaintained debug strings. This kind of debug
info should also be in the MMC layer, not drivers.

Signed-off-by: Pierre Ossman <[EMAIL PROTECTED]>

diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index 7c2eb45..42fa90f 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -30,6 +30,5 @@ mmc_core-y := mmc.o mmc_sysfs.o
 mmc_core-$(CONFIG_BLOCK) += mmc_queue.o
 
 ifeq ($(CONFIG_MMC_DEBUG),y)
-obj-$(CONFIG_MMC)		+= mmc_debug.o
 EXTRA_CFLAGS += -DDEBUG
 endif
diff --git a/drivers/mmc/mmc_debug.c b/drivers/mmc/mmc_debug.c
deleted file mode 100644
index f13e223..000
--- a/drivers/mmc/mmc_debug.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  linux/drivers/mmc/mmc_debug.c
- *
- *  Copyright (C) 2003 maintech GmbH, Thomas Kleffel <[EMAIL PROTECTED]>
- *
- * This file contains debug helper functions for the MMC/SD stack
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
-
-#include 
-#include "mmc_debug.h"
-
-char *mmc_cmd2str(int cmd)
-{
-	switch(cmd) {
-		case  0: return "GO_IDLE_STATE";
-		case  1: return "ALL_SEND_OCR";
-		case  2: return "ALL_SEND_CID";
-		case  3: return "ALL_SEND_RELATIVE_ADD";
-		case  6: return "ACMD: SD_SET_BUSWIDTH";
-		case  7: return "SEL_DESEL_CARD";
-		case  9: return "SEND_CSD";
-		case 10: return "SEND_CID";
-		case 11: return "READ_UNTIL_STOP";
-		case 12: return "STOP_TRANSMISSION";
-		case 13: return "SEND_STATUS";
-		case 15: return "GO_INACTIVE_STATE";
-		case 16: return "SET_BLOCKLEN";
-		case 17: return "READ_SINGLE_BLOCK";
-		case 18: return "READ_MULTIPLE_BLOCK";
-		case 24: return "WRITE_SINGLE_BLOCK";
-		case 25: return "WRITE_MULTIPLE_BLOCK";
-		case 41: return "ACMD: SD_APP_OP_COND";
-		case 55: return "APP_CMD";
-		default: return "UNKNOWN";
-	}
-}
-EXPORT_SYMBOL(mmc_cmd2str);
-
-char *mmc_err2str(int err)
-{
-	switch(err) {
-		case MMC_ERR_NONE:	return "OK";
-		case MMC_ERR_TIMEOUT:	return "TIMEOUT";
-		case MMC_ERR_BADCRC: 	return "BADCRC";
-		case MMC_ERR_FIFO: 	return "FIFO";
-		case MMC_ERR_FAILED: 	return "FAILED";
-		case MMC_ERR_INVALID: 	return "INVALID";
-		case MMC_ERR_BUSY:	return "BUSY";
-		case MMC_ERR_DMA:	return "DMA";
-		case MMC_ERR_CANCELED:	return "CANCELED";
-		default: return 

[PATCH] Samsung S3C24xx SD/MMC driver

2007-12-19 Thread Harald Welte
Hi!

This is a MMC/SD driver for the Samsung S3C24xx SD/MMC controller, originally
developed years ago by Thomas Kleffel <[EMAIL PROTECTED]>.

Due to time constraints, he had no time to further maintain the driver
and follow the mainline Linux changes in the SD/MMC stack.

With his authorization, I have taken over the task of making it
compliant to the current mainline SD/MMC API and take care of the
mainline kernel merge.

So please advise on whatever changes you deem neccessary and I'll try to
do my best to incorporate them for a hopefully not-too-distant mainline
merge.

After a potential kernel inclusion, we would co-maintain the driver.

Acked-by: Thomas Kleffel <[EMAIL PROTECTED]>
Signed-off-by: Harald Welte <[EMAIL PROTECTED]>

---

Index: linux-2.6/include/asm-arm/arch-s3c2410/regs-sdi.h
===
--- linux-2.6.orig/include/asm-arm/arch-s3c2410/regs-sdi.h
+++ linux-2.6/include/asm-arm/arch-s3c2410/regs-sdi.h
@@ -28,9 +28,15 @@
 #define S3C2410_SDIDCNT   (0x30)
 #define S3C2410_SDIDSTA   (0x34)
 #define S3C2410_SDIFSTA   (0x38)
+
 #define S3C2410_SDIDATA   (0x3C)
 #define S3C2410_SDIIMSK   (0x40)
 
+#define S3C2440_SDIDATA   (0x40)
+#define S3C2440_SDIIMSK   (0x3C)
+
+#define S3C2440_SDICON_SDRESET(1<<8)
+#define S3C2440_SDICON_MMCCLOCK   (1<<5)
 #define S3C2410_SDICON_BYTEORDER  (1<<4)
 #define S3C2410_SDICON_SDIOIRQ(1<<3)
 #define S3C2410_SDICON_RWAITEN(1<<2)
@@ -42,7 +48,8 @@
 #define S3C2410_SDICMDCON_LONGRSP (1<<10)
 #define S3C2410_SDICMDCON_WAITRSP (1<<9)
 #define S3C2410_SDICMDCON_CMDSTART(1<<8)
-#define S3C2410_SDICMDCON_INDEX   (0xff)
+#define S3C2410_SDICMDCON_SENDERHOST  (1<<6)
+#define S3C2410_SDICMDCON_INDEX   (0x3f)
 
 #define S3C2410_SDICMDSTAT_CRCFAIL(1<<12)
 #define S3C2410_SDICMDSTAT_CMDSENT(1<<11)
@@ -51,6 +58,9 @@
 #define S3C2410_SDICMDSTAT_XFERING(1<<8)
 #define S3C2410_SDICMDSTAT_INDEX  (0xff)
 
+#define S3C2440_SDIDCON_DS_BYTE   (0<<22)
+#define S3C2440_SDIDCON_DS_HALFWORD   (1<<22)
+#define S3C2440_SDIDCON_DS_WORD   (2<<22)
 #define S3C2410_SDIDCON_IRQPERIOD (1<<21)
 #define S3C2410_SDIDCON_TXAFTERRESP   (1<<20)
 #define S3C2410_SDIDCON_RXAFTERCMD(1<<19)
@@ -59,6 +69,7 @@
 #define S3C2410_SDIDCON_WIDEBUS   (1<<16)
 #define S3C2410_SDIDCON_DMAEN (1<<15)
 #define S3C2410_SDIDCON_STOP  (1<<14)
+#define S3C2440_SDIDCON_DATSTART  (1<<14)
 #define S3C2410_SDIDCON_DATMODE  (3<<12)
 #define S3C2410_SDIDCON_BLKNUM(0x7ff)
 
@@ -68,6 +79,7 @@
 #define S3C2410_SDIDCON_XFER_RXSTART  (2<<12)
 #define S3C2410_SDIDCON_XFER_TXSTART  (3<<12)
 
+#define S3C2410_SDIDCON_BLKNUM_MASK   (0xFFF)
 #define S3C2410_SDIDCNT_BLKNUM_SHIFT  (12)
 
 #define S3C2410_SDIDSTA_RDYWAITREQ(1<<10)
@@ -82,10 +94,12 @@
 #define S3C2410_SDIDSTA_TXDATAON  (1<<1)
 #define S3C2410_SDIDSTA_RXDATAON  (1<<0)
 
+#define S3C2440_SDIFSTA_FIFORESET  (1<<16)
+#define S3C2440_SDIFSTA_FIFOFAIL   (3<<14)  /* 3 is correct (2 bits) */
 #define S3C2410_SDIFSTA_TFDET  (1<<13)
 #define S3C2410_SDIFSTA_RFDET  (1<<12)
-#define S3C2410_SDIFSTA_TXHALF (1<<11)
-#define S3C2410_SDIFSTA_TXEMPTY(1<<10)
+#define S3C2410_SDIFSTA_TFHALF (1<<11)
+#define S3C2410_SDIFSTA_TFEMPTY(1<<10)
 #define S3C2410_SDIFSTA_RFLAST (1<<9)
 #define S3C2410_SDIFSTA_RFFULL (1<<8)
 #define S3C2410_SDIFSTA_RFHALF (1<<7)
Index: linux-2.6/drivers/mmc/host/s3cmci.c
===
--- /dev/null
+++ linux-2.6/drivers/mmc/host/s3cmci.c
@@ -0,0 +1,1409 @@
+/*
+ *  linux/drivers/mmc/s3cmci.h - Samsung S3C MCI driver
+ *
+ *  Copyright (C) 2004-2006 maintech GmbH, Thomas Kleffel <[EMAIL PROTECTED]>
+ *  Copyright (C) 2007 OpenMoko, Inc., Harald Welte <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "s3cmci.h"
+
+#define DRIVER_NAME "s3c-mci"
+
+enum dbg_channels {
+   dbg_err   = (1 << 0),
+   dbg_debug = (1 << 1),
+   dbg_info  = (1 << 2),
+   dbg_irq   = (1 << 3),
+   dbg_sg= (1 << 4),
+   dbg_dma   = (1 << 5),
+   dbg_pio   = (1 << 6),
+   dbg_fail  = (1 << 7),
+   dbg_conf  = (1 << 8),
+};
+
+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;
+
+#define dbg(host, channels, args...)\
+   do { \
+   if (dbgmap_err & channels)   \
+   

[PATCH] Samsung S3C24xx SD/MMC driver

2007-12-19 Thread Harald Welte
Hi!

This is a MMC/SD driver for the Samsung S3C24xx SD/MMC controller, originally
developed years ago by Thomas Kleffel [EMAIL PROTECTED].

Due to time constraints, he had no time to further maintain the driver
and follow the mainline Linux changes in the SD/MMC stack.

With his authorization, I have taken over the task of making it
compliant to the current mainline SD/MMC API and take care of the
mainline kernel merge.

So please advise on whatever changes you deem neccessary and I'll try to
do my best to incorporate them for a hopefully not-too-distant mainline
merge.

After a potential kernel inclusion, we would co-maintain the driver.

Acked-by: Thomas Kleffel [EMAIL PROTECTED]
Signed-off-by: Harald Welte [EMAIL PROTECTED]

---

Index: linux-2.6/include/asm-arm/arch-s3c2410/regs-sdi.h
===
--- linux-2.6.orig/include/asm-arm/arch-s3c2410/regs-sdi.h
+++ linux-2.6/include/asm-arm/arch-s3c2410/regs-sdi.h
@@ -28,9 +28,15 @@
 #define S3C2410_SDIDCNT   (0x30)
 #define S3C2410_SDIDSTA   (0x34)
 #define S3C2410_SDIFSTA   (0x38)
+
 #define S3C2410_SDIDATA   (0x3C)
 #define S3C2410_SDIIMSK   (0x40)
 
+#define S3C2440_SDIDATA   (0x40)
+#define S3C2440_SDIIMSK   (0x3C)
+
+#define S3C2440_SDICON_SDRESET(18)
+#define S3C2440_SDICON_MMCCLOCK   (15)
 #define S3C2410_SDICON_BYTEORDER  (14)
 #define S3C2410_SDICON_SDIOIRQ(13)
 #define S3C2410_SDICON_RWAITEN(12)
@@ -42,7 +48,8 @@
 #define S3C2410_SDICMDCON_LONGRSP (110)
 #define S3C2410_SDICMDCON_WAITRSP (19)
 #define S3C2410_SDICMDCON_CMDSTART(18)
-#define S3C2410_SDICMDCON_INDEX   (0xff)
+#define S3C2410_SDICMDCON_SENDERHOST  (16)
+#define S3C2410_SDICMDCON_INDEX   (0x3f)
 
 #define S3C2410_SDICMDSTAT_CRCFAIL(112)
 #define S3C2410_SDICMDSTAT_CMDSENT(111)
@@ -51,6 +58,9 @@
 #define S3C2410_SDICMDSTAT_XFERING(18)
 #define S3C2410_SDICMDSTAT_INDEX  (0xff)
 
+#define S3C2440_SDIDCON_DS_BYTE   (022)
+#define S3C2440_SDIDCON_DS_HALFWORD   (122)
+#define S3C2440_SDIDCON_DS_WORD   (222)
 #define S3C2410_SDIDCON_IRQPERIOD (121)
 #define S3C2410_SDIDCON_TXAFTERRESP   (120)
 #define S3C2410_SDIDCON_RXAFTERCMD(119)
@@ -59,6 +69,7 @@
 #define S3C2410_SDIDCON_WIDEBUS   (116)
 #define S3C2410_SDIDCON_DMAEN (115)
 #define S3C2410_SDIDCON_STOP  (114)
+#define S3C2440_SDIDCON_DATSTART  (114)
 #define S3C2410_SDIDCON_DATMODE  (312)
 #define S3C2410_SDIDCON_BLKNUM(0x7ff)
 
@@ -68,6 +79,7 @@
 #define S3C2410_SDIDCON_XFER_RXSTART  (212)
 #define S3C2410_SDIDCON_XFER_TXSTART  (312)
 
+#define S3C2410_SDIDCON_BLKNUM_MASK   (0xFFF)
 #define S3C2410_SDIDCNT_BLKNUM_SHIFT  (12)
 
 #define S3C2410_SDIDSTA_RDYWAITREQ(110)
@@ -82,10 +94,12 @@
 #define S3C2410_SDIDSTA_TXDATAON  (11)
 #define S3C2410_SDIDSTA_RXDATAON  (10)
 
+#define S3C2440_SDIFSTA_FIFORESET  (116)
+#define S3C2440_SDIFSTA_FIFOFAIL   (314)  /* 3 is correct (2 bits) */
 #define S3C2410_SDIFSTA_TFDET  (113)
 #define S3C2410_SDIFSTA_RFDET  (112)
-#define S3C2410_SDIFSTA_TXHALF (111)
-#define S3C2410_SDIFSTA_TXEMPTY(110)
+#define S3C2410_SDIFSTA_TFHALF (111)
+#define S3C2410_SDIFSTA_TFEMPTY(110)
 #define S3C2410_SDIFSTA_RFLAST (19)
 #define S3C2410_SDIFSTA_RFFULL (18)
 #define S3C2410_SDIFSTA_RFHALF (17)
Index: linux-2.6/drivers/mmc/host/s3cmci.c
===
--- /dev/null
+++ linux-2.6/drivers/mmc/host/s3cmci.c
@@ -0,0 +1,1409 @@
+/*
+ *  linux/drivers/mmc/s3cmci.h - Samsung S3C MCI driver
+ *
+ *  Copyright (C) 2004-2006 maintech GmbH, Thomas Kleffel [EMAIL PROTECTED]
+ *  Copyright (C) 2007 OpenMoko, Inc., Harald Welte [EMAIL PROTECTED]
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/module.h
+#include linux/dma-mapping.h
+#include linux/clk.h
+#include linux/mmc/mmc.h
+#include linux/mmc/host.h
+#include linux/platform_device.h
+#include linux/irq.h
+
+#include asm/dma.h
+#include asm/dma-mapping.h
+
+#include asm/io.h
+#include asm/arch/regs-sdi.h
+#include asm/arch/regs-gpio.h
+#include asm/arch/mci.h
+
+#include s3cmci.h
+
+#define DRIVER_NAME s3c-mci
+
+enum dbg_channels {
+   dbg_err   = (1  0),
+   dbg_debug = (1  1),
+   dbg_info  = (1  2),
+   dbg_irq   = (1  3),
+   dbg_sg= (1  4),
+   dbg_dma   = (1  5),
+   dbg_pio   = (1  6),
+   dbg_fail  = (1  7),
+   dbg_conf  = (1  8),
+};
+
+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;
+
+#define dbg(host, channels, args...)\
+   do {

Re: [PATCH] Samsung S3C24xx SD/MMC driver

2007-12-19 Thread Pierre Ossman
On Wed, 19 Dec 2007 15:22:13 +0100
Harald Welte [EMAIL PROTECTED] wrote:

 Hi!
 
 This is a MMC/SD driver for the Samsung S3C24xx SD/MMC controller, originally
 developed years ago by Thomas Kleffel [EMAIL PROTECTED].
 
 Due to time constraints, he had no time to further maintain the driver
 and follow the mainline Linux changes in the SD/MMC stack.
 
 With his authorization, I have taken over the task of making it
 compliant to the current mainline SD/MMC API and take care of the
 mainline kernel merge.
 
 So please advise on whatever changes you deem neccessary and I'll try to
 do my best to incorporate them for a hopefully not-too-distant mainline
 merge.
 
 After a potential kernel inclusion, we would co-maintain the driver.
 
 Acked-by: Thomas Kleffel [EMAIL PROTECTED]
 Signed-off-by: Harald Welte [EMAIL PROTECTED]
 
 ---

Well, my biggest beef with this driver is the excessive debug code. I did a 
cleanup in an older version of the driver, but it shouldn't be to difficult to 
do the same for this one. I've included my patch for reference.

 Index: linux-2.6/drivers/mmc/host/s3cmci.c
 ===
 --- /dev/null
 +++ linux-2.6/drivers/mmc/host/s3cmci.c

 +#include linux/mmc/mmc.h

This is always a warning sign. It should never be needed in a host driver.


 +
 +static inline int get_data_buffer(struct s3cmci_host *host,
 +   u32 *words, u32 **pointer)
 +{
 + struct scatterlist *sg;
 +
 + if (host-pio_active == XFER_NONE)
 + return -EINVAL;
 +
 + if ((!host-mrq) || (!host-mrq-data))
 + return -EINVAL;
 +
 + if (host-pio_sgptr = host-mrq-data-sg_len) {
 + dbg(host, dbg_debug, no more buffers (%i/%i)\n,
 +   host-pio_sgptr, host-mrq-data-sg_len);
 + return -EBUSY;
 + }
 + sg = host-mrq-data-sg[host-pio_sgptr];
 +
 + *words = sg-length  2;
 + *pointer = page_address(sg_page(sg)) + sg-offset;
 +

The length might not be a multiple of four. And it might also be completely 
unaligned. Make sure you can either handle such requests, or fail them with 
-EINVAL.

Rgds
-- 
 -- Pierre Ossman

  Linux kernel, MMC maintainerhttp://www.kernel.org
  PulseAudio, core developer  http://pulseaudio.org
  rdesktop, core developer  http://www.rdesktop.org
commit 4e47c91b7ca45940af384d3c9919a0eb160a2fb9
Author: Pierre Ossman [EMAIL PROTECTED]
Date:   Fri Jun 1 08:19:15 2007 +0200

s3mci: remove extra debug info

Remove excessive and unmaintained debug strings. This kind of debug
info should also be in the MMC layer, not drivers.

Signed-off-by: Pierre Ossman [EMAIL PROTECTED]

diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index 7c2eb45..42fa90f 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -30,6 +30,5 @@ mmc_core-y := mmc.o mmc_sysfs.o
 mmc_core-$(CONFIG_BLOCK) += mmc_queue.o
 
 ifeq ($(CONFIG_MMC_DEBUG),y)
-obj-$(CONFIG_MMC)		+= mmc_debug.o
 EXTRA_CFLAGS += -DDEBUG
 endif
diff --git a/drivers/mmc/mmc_debug.c b/drivers/mmc/mmc_debug.c
deleted file mode 100644
index f13e223..000
--- a/drivers/mmc/mmc_debug.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  linux/drivers/mmc/mmc_debug.c
- *
- *  Copyright (C) 2003 maintech GmbH, Thomas Kleffel [EMAIL PROTECTED]
- *
- * This file contains debug helper functions for the MMC/SD stack
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
-
-#include linux/mmc/mmc.h
-#include mmc_debug.h
-
-char *mmc_cmd2str(int cmd)
-{
-	switch(cmd) {
-		case  0: return GO_IDLE_STATE;
-		case  1: return ALL_SEND_OCR;
-		case  2: return ALL_SEND_CID;
-		case  3: return ALL_SEND_RELATIVE_ADD;
-		case  6: return ACMD: SD_SET_BUSWIDTH;
-		case  7: return SEL_DESEL_CARD;
-		case  9: return SEND_CSD;
-		case 10: return SEND_CID;
-		case 11: return READ_UNTIL_STOP;
-		case 12: return STOP_TRANSMISSION;
-		case 13: return SEND_STATUS;
-		case 15: return GO_INACTIVE_STATE;
-		case 16: return SET_BLOCKLEN;
-		case 17: return READ_SINGLE_BLOCK;
-		case 18: return READ_MULTIPLE_BLOCK;
-		case 24: return WRITE_SINGLE_BLOCK;
-		case 25: return WRITE_MULTIPLE_BLOCK;
-		case 41: return ACMD: SD_APP_OP_COND;
-		case 55: return APP_CMD;
-		default: return UNKNOWN;
-	}
-}
-EXPORT_SYMBOL(mmc_cmd2str);
-
-char *mmc_err2str(int err)
-{
-	switch(err) {
-		case MMC_ERR_NONE:	return OK;
-		case MMC_ERR_TIMEOUT:	return TIMEOUT;
-		case MMC_ERR_BADCRC: 	return BADCRC;
-		case MMC_ERR_FIFO: 	return FIFO;
-		case MMC_ERR_FAILED: 	return FAILED;
-		case MMC_ERR_INVALID: 	return INVALID;
-		case MMC_ERR_BUSY:	return BUSY;
-		case MMC_ERR_DMA:	return DMA;
-		case MMC_ERR_CANCELED:	return CANCELED;
-		default: return UNKNOWN;
-	}
-}
-EXPORT_SYMBOL(mmc_err2str);
diff --git a/drivers/mmc/mmc_debug.h b/drivers/mmc/mmc_debug.h
deleted 

Re: [PATCH] Samsung S3C24xx SD/MMC driver

2007-12-19 Thread Harald Welte
Hi Pierre,

thanks for your comments.

On Wed, Dec 19, 2007 at 05:54:33PM +0100, Pierre Ossman wrote:
 Well, my biggest beef with this driver is the excessive debug code. I
 did a cleanup in an older version of the driver, but it shouldn't be
 to difficult to do the same for this one. I've included my patch for
 reference.

ok, I'll re-work the patch according to your sample and re-submit.

The debugging was needed during development, and might still be needed
to debug some weird issues.

btw: OpenMoko is currently working on an ar6k wifi driver on top of the 
new mainline kernel SDIO support using the s3c_mci host controller
driver as basis.  So within not-too-distant-time we should also be able
to have SDIO working and tested on s3c_mci.

  Index: linux-2.6/drivers/mmc/host/s3cmci.c
  ===
  --- /dev/null
  +++ linux-2.6/drivers/mmc/host/s3cmci.c
 
  +#include linux/mmc/mmc.h
 
 This is always a warning sign. It should never be needed in a host driver.

ok, will see how to remove it.

  +   *words = sg-length  2;
  +   *pointer = page_address(sg_page(sg)) + sg-offset;
  +
 
 The length might not be a multiple of four. And it might also be
 completely unaligned. Make sure you can either handle such requests,
 or fail them with -EINVAL.

ok, will update before submitting the next version.
-- 
- Harald Welte [EMAIL PROTECTED]  http://openmoko.org/

Software for the world's first truly open Free Software mobile phone
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/