Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 16 Jul 2008 22:11:07 +0000 (15:11 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 16 Jul 2008 22:17:52 +0000 (15:17 -0700)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc: (68 commits)
  sdio_uart: Fix SDIO break control to now return success or an error
  mmc: host driver for Ricoh Bay1Controllers
  sdio: sdio_io.c Fix sparse warnings
  sdio: fix the use of hard coded timeout value.
  mmc: OLPC: update vdd/powerup quirk comment
  mmc: fix spares errors of sdhci.c
  mmc: remove multiwrite capability
  wbsd: fix bad dma_addr_t conversion
  atmel-mci: Driver for Atmel on-chip MMC controllers
  mmc: fix sdio_io sparse errors
  mmc: wbsd.c fix shadowing of 'dma' variable
  MMC: S3C24XX: Refuse incorrectly aligned transfers
  MMC: S3C24XX: Add maintainer entry
  MMC: S3C24XX: Update error debugging.
  MMC: S3C24XX: Add media presence test to request handling.
  MMC: S3C24XX: Fix use of msecs where jiffies are needed
  MMC: S3C24XX: Add MODULE_ALIAS() entries for the platform devices
  MMC: S3C24XX: Fix s3c2410_dma_request() return code check.
  MMC: S3C24XX: Allow card-detect on non-IRQ capable pin
  MMC: S3C24XX: Ensure host->mrq->data is valid
  ...

Manually fixed up bogus executable bits on drivers/mmc/core/sdio_io.c
and include/linux/mmc/sdio_func.h when merging.

1  2 
MAINTAINERS
drivers/mmc/core/sdio_io.c
include/linux/mmc/sdio_func.h
include/linux/pci_ids.h

diff --combined MAINTAINERS
index 2e535e8de44bb5b80fb148be52158253b4596702,c16b986d7e0a859cbeafc57438cd4644bfa82b56..2b9212f90446f288ab1d5f9bf7b1067946790626
@@@ -216,8 -216,8 +216,8 @@@ W: http://code.google.com/p/aceracp
  S:    Maintained
  
  ACPI
 -P:    Len Brown
 -M:    len.brown@intel.com
 +P:    Andi Kleen
 +M:    ak@linux.intel.com
  M:    lenb@kernel.org
  L:    linux-acpi@vger.kernel.org
  W:    http://www.lesswatts.org/projects/acpi/
@@@ -239,8 -239,8 +239,8 @@@ W: http://www.lesswatts.org/projects/ac
  S:    Supported
  
  ACPI FAN DRIVER
 -P:    Len Brown
 -M:    len.brown@intel.com
 +P:    Zhang Rui
 +M:    rui.zhang@intel.com
  L:    linux-acpi@vger.kernel.org
  W:    http://www.lesswatts.org/projects/acpi/
  S:    Supported
@@@ -252,14 -252,14 +252,14 @@@ L:      pcihpd-discuss@lists.sourceforge.ne
  S:    Supported
  
  ACPI THERMAL DRIVER
 -P:    Len Brown
 -M:    len.brown@intel.com
 +P:    Zhang Rui
 +M:    rui.zhang@intel.com
  L:    linux-acpi@vger.kernel.org
  W:    http://www.lesswatts.org/projects/acpi/
  S:    Supported
  
  ACPI VIDEO DRIVER
 -P:    Rui Zhang
 +P:    Zhang Rui
  M:    rui.zhang@intel.com
  L:    linux-acpi@vger.kernel.org
  W:    http://www.lesswatts.org/projects/acpi/
@@@ -348,7 -348,9 +348,9 @@@ W: http://www.linux-usb.org/SpeedTouch
  S:    Maintained
  
  ALCHEMY AU1XX0 MMC DRIVER
- S:    Orphan
+ P:    Manuel Lauss
+ M:    manuel.lauss@gmail.com
+ S:    Maintained
  
  ALI1563 I2C DRIVER
  P:    Rudolf Marek
@@@ -1160,11 -1162,6 +1162,11 @@@ M:    scott@spiteful.or
  L:    pcihpd-discuss@lists.sourceforge.net
  S:    Supported
  
 +COMPAL LAPTOP SUPPORT
 +P:    Cezary Jackiewicz
 +M:    cezary.jackiewicz@gmail.com
 +S:    Maintained
 +
  COMPUTONE INTELLIPORT MULTIPORT CARD
  P:    Michael H. Warfield
  M:    mhw@wittsend.com
@@@ -1691,13 -1688,6 +1693,13 @@@ L:    linuxppc-embedded@ozlabs.or
  L:    linux-kernel@vger.kernel.org
  S:    Maintained
  
 +FREESCALE I2C CPM DRIVER
 +P:    Jochen Friedrich
 +M:    jochen@scram.de
 +L:    linuxppc-dev@ozlabs.org
 +L:    i2c@lm-sensors.org
 +S:    Maintained
 +
  FREESCALE SOC FS_ENET DRIVER
  P:    Pantelis Antoniou
  M:    pantelis.antoniou@gmail.com
@@@ -1782,22 -1772,11 +1784,22 @@@ M:   hch@infradead.or
  W:    ftp://ftp.openlinux.org/pub/people/hch/vxfs
  S:    Maintained
  
 +FTRACE
 +P:    Steven Rostedt
 +M:    srostedt@redhat.com
 +S:    Maintained
 +
  FUJITSU FR-V (FRV) PORT
  P:    David Howells
  M:    dhowells@redhat.com
  S:    Maintained
  
 +FUJITSU LAPTOP EXTRAS
 +P:    Jonathan Woithe
 +M:    jwoithe@physics.adelaide.edu.au
 +L:    linux-acpi@vger.kernel.org
 +S:    Maintained
 +
  FUSE: FILESYSTEM IN USERSPACE
  P:    Miklos Szeredi
  M:    miklos@szeredi.hu
@@@ -2336,16 -2315,6 +2338,16 @@@ L:    linux-mtd@lists.infradead.or
  W:    http://www.linux-mtd.infradead.org/doc/jffs2.html
  S:    Maintained
  
 +UBI FILE SYSTEM (UBIFS)
 +P:    Artem Bityutskiy
 +M:    dedekind@infradead.org
 +P:    Adrian Hunter
 +M:    ext-adrian.hunter@nokia.com
 +L:    linux-mtd@lists.infradead.org
 +T:    git git://git.infradead.org/~dedekind/ubifs-2.6.git
 +W:    http://www.linux-mtd.infradead.org/doc/ubifs.html
 +S:    Maintained
 +
  JFS FILESYSTEM
  P:    Dave Kleikamp
  M:    shaggy@austin.ibm.com
@@@ -2542,11 -2511,13 +2544,11 @@@ W:   http://www.penguinppc.org
  L:    linuxppc-dev@ozlabs.org
  S:    Maintained
  
 -LINUX FOR POWERPC EMBEDDED MPC52XX
 +LINUX FOR POWERPC EMBEDDED MPC5XXX
  P:    Sylvain Munaut
  M:    tnt@246tNt.com
  P:    Grant Likely
  M:    grant.likely@secretlab.ca
 -W:    http://www.246tNt.com/mpc52xx/
 -W:    http://www.penguinppc.org/
  L:    linuxppc-dev@ozlabs.org
  S:    Maintained
  
@@@ -3559,6 -3530,13 +3561,13 @@@ L:    linux-s390@vger.kernel.or
  W:    http://www.ibm.com/developerworks/linux/linux390/
  S:    Supported
  
+ S3C24XX SD/MMC Driver
+ P:    Ben Dooks
+ M:    ben-linux@fluff.org
+ L:    linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
+ L:    linux-kernel@vger.kernel.org
+ S:    Supported
  SAA7146 VIDEO4LINUX-2 DRIVER
  P:    Michael Hunold
  M:    michael@mihu.de
@@@ -3631,6 -3609,12 +3640,12 @@@ P:    Jim Cromi
  M:    jim.cromie@gmail.com
  S:    Maintained
  
+ SDRICOH_CS MMC/SD HOST CONTROLLER INTERFACE DRIVER
+ P:    Sascha Sommer
+ M:    saschasommer@freenet.de
+ L:    sdricohcs-devel@lists.sourceforge.net (subscribers-only)
+ S:    Maintained
  SECURITY CONTACT
  P:    Security Officers
  M:    security@kernel.org
index 625b92ce9cef2abedbaf853f2e0d2ba6dc7a7314,f61fc2d4cd0a649a02e8e2acc10da53a7ffe7c2a..f61fc2d4cd0a649a02e8e2acc10da53a7ffe7c2a
mode 100644,100755..100644
@@@ -1,7 -1,7 +1,7 @@@
  /*
   *  linux/drivers/mmc/core/sdio_io.c
   *
-  *  Copyright 2007 Pierre Ossman
+  *  Copyright 2007-2008 Pierre Ossman
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
@@@ -76,11 -76,7 +76,7 @@@ int sdio_enable_func(struct sdio_func *
        if (ret)
                goto err;
  
-       /*
-        * FIXME: This should timeout based on information in the CIS,
-        * but we don't have card to parse that yet.
-        */
-       timeout = jiffies + HZ;
+       timeout = jiffies + msecs_to_jiffies(func->enable_timeout);
  
        while (1) {
                ret = mmc_io_rw_direct(func->card, 0, 0, SDIO_CCCR_IORx, 0, &reg);
@@@ -167,10 -163,8 +163,8 @@@ int sdio_set_block_size(struct sdio_fun
                return -EINVAL;
  
        if (blksz == 0) {
-               blksz = min(min(
-                       func->max_blksize,
-                       func->card->host->max_blk_size),
-                       512u);
+               blksz = min(func->max_blksize, func->card->host->max_blk_size);
+               blksz = min(blksz, 512u);
        }
  
        ret = mmc_io_rw_direct(func->card, 1, 0,
        func->cur_blksize = blksz;
        return 0;
  }
  EXPORT_SYMBOL_GPL(sdio_set_block_size);
  
+ /*
+  * Calculate the maximum byte mode transfer size
+  */
+ static inline unsigned int sdio_max_byte_size(struct sdio_func *func)
+ {
+       unsigned mval = min(func->card->host->max_seg_size,
+                           func->card->host->max_blk_size);
+       mval = min(mval, func->max_blksize);
+       return min(mval, 512u); /* maximum size for byte mode */
+ }
+ /**
+  *    sdio_align_size - pads a transfer size to a more optimal value
+  *    @func: SDIO function
+  *    @sz: original transfer size
+  *
+  *    Pads the original data size with a number of extra bytes in
+  *    order to avoid controller bugs and/or performance hits
+  *    (e.g. some controllers revert to PIO for certain sizes).
+  *
+  *    If possible, it will also adjust the size so that it can be
+  *    handled in just a single request.
+  *
+  *    Returns the improved size, which might be unmodified.
+  */
+ unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz)
+ {
+       unsigned int orig_sz;
+       unsigned int blk_sz, byte_sz;
+       unsigned chunk_sz;
+       orig_sz = sz;
+       /*
+        * Do a first check with the controller, in case it
+        * wants to increase the size up to a point where it
+        * might need more than one block.
+        */
+       sz = mmc_align_data_size(func->card, sz);
+       /*
+        * If we can still do this with just a byte transfer, then
+        * we're done.
+        */
+       if (sz <= sdio_max_byte_size(func))
+               return sz;
+       if (func->card->cccr.multi_block) {
+               /*
+                * Check if the transfer is already block aligned
+                */
+               if ((sz % func->cur_blksize) == 0)
+                       return sz;
+               /*
+                * Realign it so that it can be done with one request,
+                * and recheck if the controller still likes it.
+                */
+               blk_sz = ((sz + func->cur_blksize - 1) /
+                       func->cur_blksize) * func->cur_blksize;
+               blk_sz = mmc_align_data_size(func->card, blk_sz);
+               /*
+                * This value is only good if it is still just
+                * one request.
+                */
+               if ((blk_sz % func->cur_blksize) == 0)
+                       return blk_sz;
+               /*
+                * We failed to do one request, but at least try to
+                * pad the remainder properly.
+                */
+               byte_sz = mmc_align_data_size(func->card,
+                               sz % func->cur_blksize);
+               if (byte_sz <= sdio_max_byte_size(func)) {
+                       blk_sz = sz / func->cur_blksize;
+                       return blk_sz * func->cur_blksize + byte_sz;
+               }
+       } else {
+               /*
+                * We need multiple requests, so first check that the
+                * controller can handle the chunk size;
+                */
+               chunk_sz = mmc_align_data_size(func->card,
+                               sdio_max_byte_size(func));
+               if (chunk_sz == sdio_max_byte_size(func)) {
+                       /*
+                        * Fix up the size of the remainder (if any)
+                        */
+                       byte_sz = orig_sz % chunk_sz;
+                       if (byte_sz) {
+                               byte_sz = mmc_align_data_size(func->card,
+                                               byte_sz);
+                       }
+                       return (orig_sz / chunk_sz) * chunk_sz + byte_sz;
+               }
+       }
+       /*
+        * The controller is simply incapable of transferring the size
+        * we want in decent manner, so just return the original size.
+        */
+       return orig_sz;
+ }
+ EXPORT_SYMBOL_GPL(sdio_align_size);
  /* Split an arbitrarily sized data transfer into several
   * IO_RW_EXTENDED commands. */
  static int sdio_io_rw_ext_helper(struct sdio_func *func, int write,
        int ret;
  
        /* Do the bulk of the transfer using block mode (if supported). */
-       if (func->card->cccr.multi_block) {
+       if (func->card->cccr.multi_block && (size > sdio_max_byte_size(func))) {
                /* Blocks per command is limited by host count, host transfer
                 * size (we only use a single sg entry) and the maximum for
                 * IO_RW_EXTENDED of 511 blocks. */
-               max_blocks = min(min(
-                       func->card->host->max_blk_count,
-                       func->card->host->max_seg_size / func->cur_blksize),
-                       511u);
+               max_blocks = min(func->card->host->max_blk_count,
+                       func->card->host->max_seg_size / func->cur_blksize);
+               max_blocks = min(max_blocks, 511u);
  
                while (remainder > func->cur_blksize) {
                        unsigned blocks;
  
        /* Write the remainder using byte mode. */
        while (remainder > 0) {
-               size = remainder;
-               if (size > func->cur_blksize)
-                       size = func->cur_blksize;
-               if (size > 512)
-                       size = 512; /* maximum size for byte mode */
+               size = min(remainder, sdio_max_byte_size(func));
  
                ret = mmc_io_rw_extended(func->card, write, func->num, addr,
                         incr_addr, buf, 1, size);
   *    function. If there is a problem reading the address, 0xff
   *    is returned and @err_ret will contain the error code.
   */
- unsigned char sdio_readb(struct sdio_func *func, unsigned int addr,
-       int *err_ret)
+ u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret)
  {
        int ret;
-       unsigned char val;
+       u8 val;
  
        BUG_ON(!func);
  
@@@ -293,8 -388,7 +388,7 @@@ EXPORT_SYMBOL_GPL(sdio_readb)
   *    function. @err_ret will contain the status of the actual
   *    transfer.
   */
- void sdio_writeb(struct sdio_func *func, unsigned char b, unsigned int addr,
-       int *err_ret)
+ void sdio_writeb(struct sdio_func *func, u8 b, unsigned int addr, int *err_ret)
  {
        int ret;
  
@@@ -355,7 -449,6 +449,6 @@@ int sdio_readsb(struct sdio_func *func
  {
        return sdio_io_rw_ext_helper(func, 0, addr, 0, dst, count);
  }
  EXPORT_SYMBOL_GPL(sdio_readsb);
  
  /**
@@@ -385,8 -478,7 +478,7 @@@ EXPORT_SYMBOL_GPL(sdio_writesb)
   *    function. If there is a problem reading the address, 0xffff
   *    is returned and @err_ret will contain the error code.
   */
- unsigned short sdio_readw(struct sdio_func *func, unsigned int addr,
-       int *err_ret)
+ u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret)
  {
        int ret;
  
                return 0xFFFF;
        }
  
-       return le16_to_cpu(*(u16*)func->tmpbuf);
+       return le16_to_cpup((__le16 *)func->tmpbuf);
  }
  EXPORT_SYMBOL_GPL(sdio_readw);
  
   *    function. @err_ret will contain the status of the actual
   *    transfer.
   */
- void sdio_writew(struct sdio_func *func, unsigned short b, unsigned int addr,
-       int *err_ret)
+ void sdio_writew(struct sdio_func *func, u16 b, unsigned int addr, int *err_ret)
  {
        int ret;
  
-       *(u16*)func->tmpbuf = cpu_to_le16(b);
+       *(__le16 *)func->tmpbuf = cpu_to_le16(b);
  
        ret = sdio_memcpy_toio(func, addr, func->tmpbuf, 2);
        if (err_ret)
@@@ -439,8 -530,7 +530,7 @@@ EXPORT_SYMBOL_GPL(sdio_writew)
   *    0xffffffff is returned and @err_ret will contain the error
   *    code.
   */
- unsigned long sdio_readl(struct sdio_func *func, unsigned int addr,
-       int *err_ret)
+ u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret)
  {
        int ret;
  
                return 0xFFFFFFFF;
        }
  
-       return le32_to_cpu(*(u32*)func->tmpbuf);
+       return le32_to_cpup((__le32 *)func->tmpbuf);
  }
  EXPORT_SYMBOL_GPL(sdio_readl);
  
   *    function. @err_ret will contain the status of the actual
   *    transfer.
   */
- void sdio_writel(struct sdio_func *func, unsigned long b, unsigned int addr,
-       int *err_ret)
+ void sdio_writel(struct sdio_func *func, u32 b, unsigned int addr, int *err_ret)
  {
        int ret;
  
-       *(u32*)func->tmpbuf = cpu_to_le32(b);
+       *(__le32 *)func->tmpbuf = cpu_to_le32(b);
  
        ret = sdio_memcpy_toio(func, addr, func->tmpbuf, 4);
        if (err_ret)
index b050f4d7b41f05af47bf98c342c0b4528d110e19,07bee4a0d457e71c50eb9a7bbded7f69fd3d8d94..07bee4a0d457e71c50eb9a7bbded7f69fd3d8d94
mode 100644,100755..100644
@@@ -1,7 -1,7 +1,7 @@@
  /*
   *  include/linux/mmc/sdio_func.h
   *
-  *  Copyright 2007 Pierre Ossman
+  *  Copyright 2007-2008 Pierre Ossman
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
@@@ -46,6 -46,8 +46,8 @@@ struct sdio_func 
        unsigned                max_blksize;    /* maximum block size */
        unsigned                cur_blksize;    /* current block size */
  
+       unsigned                enable_timeout; /* max enable timeout in msec */
        unsigned int            state;          /* function state */
  #define SDIO_STATE_PRESENT    (1<<0)          /* present in sysfs */
  
@@@ -120,23 -122,22 +122,22 @@@ extern int sdio_set_block_size(struct s
  extern int sdio_claim_irq(struct sdio_func *func, sdio_irq_handler_t *handler);
  extern int sdio_release_irq(struct sdio_func *func);
  
- extern unsigned char sdio_readb(struct sdio_func *func,
-       unsigned int addr, int *err_ret);
- extern unsigned short sdio_readw(struct sdio_func *func,
-       unsigned int addr, int *err_ret);
- extern unsigned long sdio_readl(struct sdio_func *func,
-       unsigned int addr, int *err_ret);
+ extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz);
+ extern u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret);
+ extern u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret);
+ extern u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret);
  
  extern int sdio_memcpy_fromio(struct sdio_func *func, void *dst,
        unsigned int addr, int count);
  extern int sdio_readsb(struct sdio_func *func, void *dst,
        unsigned int addr, int count);
  
- extern void sdio_writeb(struct sdio_func *func, unsigned char b,
+ extern void sdio_writeb(struct sdio_func *func, u8 b,
        unsigned int addr, int *err_ret);
- extern void sdio_writew(struct sdio_func *func, unsigned short b,
+ extern void sdio_writew(struct sdio_func *func, u16 b,
        unsigned int addr, int *err_ret);
- extern void sdio_writel(struct sdio_func *func, unsigned long b,
+ extern void sdio_writel(struct sdio_func *func, u32 b,
        unsigned int addr, int *err_ret);
  
  extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr,
diff --combined include/linux/pci_ids.h
index 1cf4084b51e82edf9442903c1050d7c2d7c1378e,30153473bc3720e9990f3cd5639d26da93fce6c9..6be6a7943d8b9a02bc466fb6500e09b38b8df3c0
  #define PCI_DEVICE_ID_MPC8544         0x0033
  #define PCI_DEVICE_ID_MPC8572E                0x0040
  #define PCI_DEVICE_ID_MPC8572         0x0041
 +#define PCI_DEVICE_ID_MPC8536E                0x0050
 +#define PCI_DEVICE_ID_MPC8536         0x0051
  #define PCI_DEVICE_ID_MPC8641         0x7010
  #define PCI_DEVICE_ID_MPC8641D                0x7011
  #define PCI_DEVICE_ID_MPC8610         0x7018
  #define PCI_DEVICE_ID_JMICRON_JMB366  0x2366
  #define PCI_DEVICE_ID_JMICRON_JMB368  0x2368
  #define PCI_DEVICE_ID_JMICRON_JMB38X_SD       0x2381
+ #define PCI_DEVICE_ID_JMICRON_JMB38X_MMC 0x2382
  #define PCI_DEVICE_ID_JMICRON_JMB38X_MS       0x2383
  
  #define PCI_VENDOR_ID_KORENIX         0x1982