Skip to content

Commit

Permalink
mmc: dw_mmc: add quirks for unreliable card detect, and capabilities
Browse files Browse the repository at this point in the history
This patch adds quirks and capabilities to platdata.

Some cards don't use the CDn pin; in that case, we assume the card's
inserted. Some boards need other capabilities. So, we add capabilities
in the board's platdata.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Will Newton <will.newton@imgtec.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
  • Loading branch information
Jaehoon Chung authored and Chris Ball committed Mar 17, 2011
1 parent 860cfe7 commit fc3d772
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 8 additions & 2 deletions drivers/mmc/host/dw_mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,9 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
struct dw_mci_board *brd = slot->host->pdata;

/* Use platform get_cd function, else try onboard card detect */
if (brd->get_cd)
if (brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION)
present = 1;
else if (brd->get_cd)
present = !brd->get_cd(slot->id);
else
present = (mci_readl(slot->host, CDETECT) & (1 << slot->id))
Expand Down Expand Up @@ -1403,7 +1405,11 @@ static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id)
if (host->pdata->setpower)
host->pdata->setpower(id, 0);

mmc->caps = 0;
if (host->pdata->caps)
mmc->caps = host->pdata->caps;
else
mmc->caps = 0;

if (host->pdata->get_bus_wd)
if (host->pdata->get_bus_wd(slot->id) >= 4)
mmc->caps |= MMC_CAP_4_BIT_DATA;
Expand Down
10 changes: 7 additions & 3 deletions include/linux/mmc/dw_mmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,13 @@ struct dw_mci_dma_ops {

/* IP Quirks/flags. */
/* DTO fix for command transmission with IDMAC configured */
#define DW_MCI_QUIRK_IDMAC_DTO BIT(0)
#define DW_MCI_QUIRK_IDMAC_DTO BIT(0)
/* delay needed between retries on some 2.11a implementations */
#define DW_MCI_QUIRK_RETRY_DELAY BIT(1)
#define DW_MCI_QUIRK_RETRY_DELAY BIT(1)
/* High Speed Capable - Supports HS cards (upto 50MHz) */
#define DW_MCI_QUIRK_HIGHSPEED BIT(2)
#define DW_MCI_QUIRK_HIGHSPEED BIT(2)
/* Unreliable card detection */
#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3)


struct dma_pdata;
Expand All @@ -190,6 +192,8 @@ struct dw_mci_board {
u32 quirks; /* Workaround / Quirk flags */
unsigned int bus_hz; /* Bus speed */

unsigned int caps; /* Capabilities */

/* delay in mS before detecting cards after interrupt */
u32 detect_delay_ms;

Expand Down

0 comments on commit fc3d772

Please sign in to comment.