Commit d5a169c8 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc

* '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
parents 5212c555 3373c0ae
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/mmc/host.h> #include <linux/mmc/host.h>
#include <linux/mmc/card.h> #include <linux/mmc/card.h>
#include <linux/mmc/mmc.h> #include <linux/mmc/mmc.h>
#include <linux/mmc/sd.h>
#include "core.h" #include "core.h"
#include "sysfs.h" #include "sysfs.h"
...@@ -192,6 +193,16 @@ static int mmc_read_switch(struct mmc_card *card) ...@@ -192,6 +193,16 @@ static int mmc_read_switch(struct mmc_card *card)
int err; int err;
u8 *status; 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; err = MMC_ERR_FAILED;
status = kmalloc(64, GFP_KERNEL); status = kmalloc(64, GFP_KERNEL);
...@@ -204,10 +215,9 @@ static int mmc_read_switch(struct mmc_card *card) ...@@ -204,10 +215,9 @@ static int mmc_read_switch(struct mmc_card *card)
err = mmc_sd_switch(card, 0, 0, 1, status); err = mmc_sd_switch(card, 0, 0, 1, status);
if (err != MMC_ERR_NONE) { if (err != MMC_ERR_NONE) {
/* printk(KERN_WARNING "%s: problem reading switch "
* Card not supporting high-speed will ignore the "capabilities, performance might suffer.\n",
* command. mmc_hostname(card->host));
*/
err = MMC_ERR_NONE; err = MMC_ERR_NONE;
goto out; goto out;
} }
...@@ -229,6 +239,12 @@ static int mmc_switch_hs(struct mmc_card *card) ...@@ -229,6 +239,12 @@ static int mmc_switch_hs(struct mmc_card *card)
int err; int err;
u8 *status; 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)) if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED))
return MMC_ERR_NONE; return MMC_ERR_NONE;
...@@ -402,7 +418,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, ...@@ -402,7 +418,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
/* /*
* Switch to wider bus (if supported). * 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)) { (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4); err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4);
if (err != MMC_ERR_NONE) if (err != MMC_ERR_NONE)
......
...@@ -417,7 +417,7 @@ static unsigned int at91_mci_send_command(struct at91mci_host *host, struct mmc_ ...@@ -417,7 +417,7 @@ static unsigned int at91_mci_send_command(struct at91mci_host *host, struct mmc_
blocks = 0; blocks = 0;
} }
if (cmd->opcode == MMC_STOP_TRANSMISSION) if (host->flags & FL_SENT_STOP)
cmdr |= AT91_MCI_TRCMD_STOP; cmdr |= AT91_MCI_TRCMD_STOP;
if (host->bus_mode == MMC_BUSMODE_OPENDRAIN) if (host->bus_mode == MMC_BUSMODE_OPENDRAIN)
...@@ -563,8 +563,7 @@ static void at91mci_completed_command(struct at91mci_host *host) ...@@ -563,8 +563,7 @@ static void at91mci_completed_command(struct at91mci_host *host)
if (status & (AT91_MCI_RINDE | AT91_MCI_RDIRE | AT91_MCI_RCRCE | if (status & (AT91_MCI_RINDE | AT91_MCI_RDIRE | AT91_MCI_RCRCE |
AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE | AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE |
AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)) { AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)) {
if ((status & AT91_MCI_RCRCE) && if ((status & AT91_MCI_RCRCE) && !(mmc_resp_type(cmd) & MMC_RSP_CRC)) {
((cmd->opcode == MMC_SEND_OP_COND) || (cmd->opcode == SD_APP_OP_COND))) {
cmd->error = MMC_ERR_NONE; cmd->error = MMC_ERR_NONE;
} }
else { else {
......
...@@ -76,8 +76,7 @@ const struct { ...@@ -76,8 +76,7 @@ const struct {
#endif #endif
}; };
#define AU1XMMC_CONTROLLER_COUNT \ #define AU1XMMC_CONTROLLER_COUNT (ARRAY_SIZE(au1xmmc_card_table))
(sizeof(au1xmmc_card_table) / sizeof(au1xmmc_card_table[0]))
/* This array stores pointers for the hosts (used by the IRQ handler) */ /* This array stores pointers for the hosts (used by the IRQ handler) */
struct au1xmmc_host *au1xmmc_hosts[AU1XMMC_CONTROLLER_COUNT]; struct au1xmmc_host *au1xmmc_hosts[AU1XMMC_CONTROLLER_COUNT];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment