]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc
authorLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 11 Jun 2007 18:31:18 +0000 (11:31 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 11 Jun 2007 18:31:18 +0000 (11:31 -0700)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc:
  mmc: don't call switch on old cards
  mmc: fix broken if clause
  au1xmmc: Replace C code with call to ARRAY_SIZE() macro.
  mmc-atmel: remove linux/mmc/protocol.h dependencies

drivers/mmc/core/sd.c
drivers/mmc/host/at91_mci.c
drivers/mmc/host/au1xmmc.c

index c1dfd03d559ae27f0a246256ce4babbb3cffdc17..41bfb5dfe6ff1351d1c5845d753c6da3f4bd84e5 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/mmc/host.h>
 #include <linux/mmc/card.h>
 #include <linux/mmc/mmc.h>
+#include <linux/mmc/sd.h>
 
 #include "core.h"
 #include "sysfs.h"
@@ -192,6 +193,16 @@ static int mmc_read_switch(struct mmc_card *card)
        int err;
        u8 *status;
 
+       if (card->scr.sda_vsn < SCR_SPEC_VER_1)
+               return MMC_ERR_NONE;
+
+       if (!(card->csd.cmdclass & CCC_SWITCH)) {
+               printk(KERN_WARNING "%s: card lacks mandatory switch "
+                       "function, performance might suffer.\n",
+                       mmc_hostname(card->host));
+               return MMC_ERR_NONE;
+       }
+
        err = MMC_ERR_FAILED;
 
        status = kmalloc(64, GFP_KERNEL);
@@ -204,10 +215,9 @@ static int mmc_read_switch(struct mmc_card *card)
 
        err = mmc_sd_switch(card, 0, 0, 1, status);
        if (err != MMC_ERR_NONE) {
-               /*
-                * Card not supporting high-speed will ignore the
-                * command.
-                */
+               printk(KERN_WARNING "%s: problem reading switch "
+                       "capabilities, performance might suffer.\n",
+                       mmc_hostname(card->host));
                err = MMC_ERR_NONE;
                goto out;
        }
@@ -229,6 +239,12 @@ static int mmc_switch_hs(struct mmc_card *card)
        int err;
        u8 *status;
 
+       if (card->scr.sda_vsn < SCR_SPEC_VER_1)
+               return MMC_ERR_NONE;
+
+       if (!(card->csd.cmdclass & CCC_SWITCH))
+               return MMC_ERR_NONE;
+
        if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED))
                return MMC_ERR_NONE;
 
@@ -402,7 +418,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
        /*
         * Switch to wider bus (if supported).
         */
-       if ((host->caps && MMC_CAP_4_BIT_DATA) &&
+       if ((host->caps & MMC_CAP_4_BIT_DATA) &&
                (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
                err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4);
                if (err != MMC_ERR_NONE)
index e37943c314cbd7c954208130921349501db8cb18..5b00c194b6285a0bb76e7101765bf60bedceaf55 100644 (file)
@@ -417,7 +417,7 @@ static unsigned int at91_mci_send_command(struct at91mci_host *host, struct mmc_
                blocks = 0;
        }
 
-       if (cmd->opcode == MMC_STOP_TRANSMISSION)
+       if (host->flags & FL_SENT_STOP)
                cmdr |= AT91_MCI_TRCMD_STOP;
 
        if (host->bus_mode == MMC_BUSMODE_OPENDRAIN)
@@ -563,8 +563,7 @@ static void at91mci_completed_command(struct at91mci_host *host)
        if (status & (AT91_MCI_RINDE | AT91_MCI_RDIRE | AT91_MCI_RCRCE |
                        AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE |
                        AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)) {
-               if ((status & AT91_MCI_RCRCE) &&
-                       ((cmd->opcode == MMC_SEND_OP_COND) || (cmd->opcode == SD_APP_OP_COND))) {
+               if ((status & AT91_MCI_RCRCE) && !(mmc_resp_type(cmd) & MMC_RSP_CRC)) {
                        cmd->error = MMC_ERR_NONE;
                }
                else {
index f967226d7505fcc5ac49961241e8116aca8acbee..52b63f11ddd6498000003049ce95f67306e80ab7 100644 (file)
@@ -76,8 +76,7 @@ const struct {
 #endif
 };
 
-#define AU1XMMC_CONTROLLER_COUNT \
-       (sizeof(au1xmmc_card_table) / sizeof(au1xmmc_card_table[0]))
+#define AU1XMMC_CONTROLLER_COUNT (ARRAY_SIZE(au1xmmc_card_table))
 
 /* This array stores pointers for the hosts (used by the IRQ handler) */
 struct au1xmmc_host *au1xmmc_hosts[AU1XMMC_CONTROLLER_COUNT];