arm: i.MX/MX1 SDHC implements SD cards read-only switch read-back
The patch enables to define MMC host get_ro() method through platform data. Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
This commit is contained in:
committed by
Pierre Ossman
parent
af8350c756
commit
faf39ede5e
@@ -116,7 +116,7 @@ static struct platform_device *devices[] __initdata = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_MMC_IMX
|
#ifdef CONFIG_MMC_IMX
|
||||||
static int mx1ads_mmc_card_present(void)
|
static int mx1ads_mmc_card_present(struct device *dev)
|
||||||
{
|
{
|
||||||
/* MMC/SD Card Detect is PB 20 on MX1ADS V1.0.7 */
|
/* MMC/SD Card Detect is PB 20 on MX1ADS V1.0.7 */
|
||||||
return (SSR(1) & (1 << 20) ? 0 : 1);
|
return (SSR(1) & (1 << 20) ? 0 : 1);
|
||||||
|
@@ -884,9 +884,21 @@ static void imxmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int imxmci_get_ro(struct mmc_host *mmc)
|
||||||
|
{
|
||||||
|
struct imxmci_host *host = mmc_priv(mmc);
|
||||||
|
|
||||||
|
if (host->pdata && host->pdata->get_ro)
|
||||||
|
return host->pdata->get_ro(mmc_dev(mmc));
|
||||||
|
/* Host doesn't support read only detection so assume writeable */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static const struct mmc_host_ops imxmci_ops = {
|
static const struct mmc_host_ops imxmci_ops = {
|
||||||
.request = imxmci_request,
|
.request = imxmci_request,
|
||||||
.set_ios = imxmci_set_ios,
|
.set_ios = imxmci_set_ios,
|
||||||
|
.get_ro = imxmci_get_ro,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct resource *platform_device_resource(struct platform_device *dev, unsigned int mask, int nr)
|
static struct resource *platform_device_resource(struct platform_device *dev, unsigned int mask, int nr)
|
||||||
@@ -913,7 +925,7 @@ static void imxmci_check_status(unsigned long data)
|
|||||||
{
|
{
|
||||||
struct imxmci_host *host = (struct imxmci_host *)data;
|
struct imxmci_host *host = (struct imxmci_host *)data;
|
||||||
|
|
||||||
if( host->pdata->card_present() != host->present ) {
|
if( host->pdata->card_present(mmc_dev(host->mmc)) != host->present ) {
|
||||||
host->present ^= 1;
|
host->present ^= 1;
|
||||||
dev_info(mmc_dev(host->mmc), "card %s\n",
|
dev_info(mmc_dev(host->mmc), "card %s\n",
|
||||||
host->present ? "inserted" : "removed");
|
host->present ? "inserted" : "removed");
|
||||||
@@ -1022,7 +1034,7 @@ static int imxmci_probe(struct platform_device *pdev)
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
host->present = host->pdata->card_present();
|
host->present = host->pdata->card_present(mmc_dev(mmc));
|
||||||
init_timer(&host->timer);
|
init_timer(&host->timer);
|
||||||
host->timer.data = (unsigned long)host;
|
host->timer.data = (unsigned long)host;
|
||||||
host->timer.function = imxmci_check_status;
|
host->timer.function = imxmci_check_status;
|
||||||
|
@@ -3,8 +3,11 @@
|
|||||||
|
|
||||||
#include <linux/mmc/host.h>
|
#include <linux/mmc/host.h>
|
||||||
|
|
||||||
|
struct device;
|
||||||
|
|
||||||
struct imxmmc_platform_data {
|
struct imxmmc_platform_data {
|
||||||
int (*card_present)(void);
|
int (*card_present)(struct device *);
|
||||||
|
int (*get_ro)(struct device *);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void imx_set_mmc_info(struct imxmmc_platform_data *info);
|
extern void imx_set_mmc_info(struct imxmmc_platform_data *info);
|
||||||
|
Reference in New Issue
Block a user