Skip to content

Commit

Permalink
tmio: add a platform flag to disable card write-protection detection
Browse files Browse the repository at this point in the history
Write-protection status is not always available, e.g., micro-SD cards do not
have a write-protection switch at all. This patch adds a flag to let platforms
force tmio_mmc to consider the card writable.

Signed-off-by: Guennadi Liakhovetski <[email protected]>
Acked-by: Ian Molton <[email protected]>
Signed-off-by: Paul Mundt <[email protected]>
  • Loading branch information
lyakh authored and pmundt committed May 22, 2010
1 parent 65a1b03 commit ac8fb3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/mmc/host/tmio_mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -748,8 +748,11 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
static int tmio_mmc_get_ro(struct mmc_host *mmc)
{
struct tmio_mmc_host *host = mmc_priv(mmc);
struct mfd_cell *cell = host->pdev->dev.platform_data;
struct tmio_mmc_data *pdata = cell->driver_data;

return (sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT) ? 0 : 1;
return ((pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) ||
(sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT)) ? 0 : 1;
}

static const struct mmc_host_ops tmio_mmc_ops = {
Expand Down
4 changes: 4 additions & 0 deletions include/linux/mfd/tmio.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
tmio_iowrite16((val) >> 16, (base) + ((reg + 2) << (shift))); \
} while (0)

/* tmio MMC platform flags */
#define TMIO_MMC_WRPROTECT_DISABLE (1 << 0)

int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
Expand All @@ -66,6 +69,7 @@ struct tmio_mmc_dma {
struct tmio_mmc_data {
unsigned int hclk;
unsigned long capabilities;
unsigned long flags;
struct tmio_mmc_dma *dma;
void (*set_pwr)(struct platform_device *host, int state);
void (*set_clk_div)(struct platform_device *host, int state);
Expand Down

0 comments on commit ac8fb3e

Please sign in to comment.