* [PATCH 0/3] tmio: let platforms decide upon write-protection
@ 2010-05-11 9:52 Guennadi Liakhovetski
2010-05-11 9:52 ` [PATCH 1/3] tmio: add a platform flag to disable card write-protection Guennadi Liakhovetski
` (3 more replies)
0 siblings, 4 replies; 16+ messages in thread
From: Guennadi Liakhovetski @ 2010-05-11 9:52 UTC (permalink / raw)
To: linux-sh@vger.kernel.org; +Cc: Ian Molton, Samuel Ortiz, linux-mmc
Some platforms and card-formats do not have a write-protect detection. Let
tmio_mmc users switch WP-detection off, if desired, switch it off for the
micro-SD slot on the kfr2r09 SuperH board.
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/3] tmio: add a platform flag to disable card write-protection
2010-05-11 9:52 [PATCH 0/3] tmio: let platforms decide upon write-protection Guennadi Liakhovetski
@ 2010-05-11 9:52 ` Guennadi Liakhovetski
2010-05-11 12:04 ` [PATCH 1/3] tmio: add a platform flag to disable card Magnus Damm
2010-05-11 9:52 ` [PATCH 2/3] mfd: pass platform flags down to the tmio_mmc driver Guennadi Liakhovetski
` (2 subsequent siblings)
3 siblings, 1 reply; 16+ messages in thread
From: Guennadi Liakhovetski @ 2010-05-11 9:52 UTC (permalink / raw)
To: linux-sh@vger.kernel.org; +Cc: Ian Molton, Samuel Ortiz, linux-mmc
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 <g.liakhovetski@gmx.de>
---
drivers/mmc/host/tmio_mmc.c | 5 ++++-
include/linux/mfd/tmio.h | 4 ++++
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index 7e79ba4..11c19b0 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -640,8 +640,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 = {
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 360fc95..feeed0b 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -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);
@@ -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);
--
1.6.2.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/3] mfd: pass platform flags down to the tmio_mmc driver
2010-05-11 9:52 [PATCH 0/3] tmio: let platforms decide upon write-protection Guennadi Liakhovetski
2010-05-11 9:52 ` [PATCH 1/3] tmio: add a platform flag to disable card write-protection Guennadi Liakhovetski
@ 2010-05-11 9:52 ` Guennadi Liakhovetski
2010-05-13 16:08 ` [PATCH 2/3 v2] " Guennadi Liakhovetski
2010-05-11 9:52 ` [PATCH 3/3] sh: disable SD-card write-protection detection on kfr2r09 Guennadi Liakhovetski
2010-05-19 18:35 ` [PATCH 0/3] tmio: let platforms decide upon write-protection Guennadi Liakhovetski
3 siblings, 1 reply; 16+ messages in thread
From: Guennadi Liakhovetski @ 2010-05-11 9:52 UTC (permalink / raw)
To: linux-sh@vger.kernel.org; +Cc: Ian Molton, Samuel Ortiz, linux-mmc
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
drivers/mfd/sh_mobile_sdhi.c | 1 +
include/linux/mfd/sh_mobile_sdhi.h | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/sh_mobile_sdhi.c b/drivers/mfd/sh_mobile_sdhi.c
index dafa988..d977982 100644
--- a/drivers/mfd/sh_mobile_sdhi.c
+++ b/drivers/mfd/sh_mobile_sdhi.c
@@ -106,6 +106,7 @@ static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
mmc_data->hclk = clk_get_rate(priv->clk);
mmc_data->set_pwr = sh_mobile_sdhi_set_pwr;
mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
+ mmc_data->flags = p->tmio_flags;
if (p && p->dma_slave_tx >= 0 && p->dma_slave_rx >= 0) {
priv->param_tx.slave_id = p->dma_slave_tx;
diff --git a/include/linux/mfd/sh_mobile_sdhi.h b/include/linux/mfd/sh_mobile_sdhi.h
index c305461..c7b47f8 100644
--- a/include/linux/mfd/sh_mobile_sdhi.h
+++ b/include/linux/mfd/sh_mobile_sdhi.h
@@ -4,6 +4,7 @@
struct sh_mobile_sdhi_info {
int dma_slave_tx;
int dma_slave_rx;
+ unsigned long tmio_flags;
void (*set_pwr)(struct platform_device *pdev, int state);
};
--
1.6.2.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/3] sh: disable SD-card write-protection detection on kfr2r09
2010-05-11 9:52 [PATCH 0/3] tmio: let platforms decide upon write-protection Guennadi Liakhovetski
2010-05-11 9:52 ` [PATCH 1/3] tmio: add a platform flag to disable card write-protection Guennadi Liakhovetski
2010-05-11 9:52 ` [PATCH 2/3] mfd: pass platform flags down to the tmio_mmc driver Guennadi Liakhovetski
@ 2010-05-11 9:52 ` Guennadi Liakhovetski
2010-05-19 18:35 ` [PATCH 0/3] tmio: let platforms decide upon write-protection Guennadi Liakhovetski
3 siblings, 0 replies; 16+ messages in thread
From: Guennadi Liakhovetski @ 2010-05-11 9:52 UTC (permalink / raw)
To: linux-sh@vger.kernel.org; +Cc: Ian Molton, Samuel Ortiz, linux-mmc
kfr2r09 board has a micro-SD card slot, therefore card write-protection
detection cannot work there, disable it.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
arch/sh/boards/mach-kfr2r09/setup.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
index 95850aa..68994a1 100644
--- a/arch/sh/boards/mach-kfr2r09/setup.c
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -11,6 +11,7 @@
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/mfd/sh_mobile_sdhi.h>
+#include <linux/mfd/tmio.h>
#include <linux/mtd/physmap.h>
#include <linux/mtd/onenand.h>
#include <linux/delay.h>
@@ -358,8 +359,9 @@ static struct resource kfr2r09_sh_sdhi0_resources[] = {
};
static struct sh_mobile_sdhi_info sh7724_sdhi0_data = {
- .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
- .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
+ .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
+ .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
+ .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
};
static struct platform_device kfr2r09_sh_sdhi0_device = {
--
1.6.2.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] tmio: add a platform flag to disable card
2010-05-11 9:52 ` [PATCH 1/3] tmio: add a platform flag to disable card write-protection Guennadi Liakhovetski
@ 2010-05-11 12:04 ` Magnus Damm
2010-05-11 12:15 ` Guennadi Liakhovetski
0 siblings, 1 reply; 16+ messages in thread
From: Magnus Damm @ 2010-05-11 12:04 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: linux-sh@vger.kernel.org, Ian Molton, Samuel Ortiz, linux-mmc
Hi Guennadi,
Many thanks for your work on this!
On Tue, May 11, 2010 at 6:52 PM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:
> 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 <g.liakhovetski@gmx.de>
> ---
> drivers/mmc/host/tmio_mmc.c | 5 ++++-
> include/linux/mfd/tmio.h | 4 ++++
> 2 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
> index 7e79ba4..11c19b0 100644
> --- a/drivers/mmc/host/tmio_mmc.c
> +++ b/drivers/mmc/host/tmio_mmc.c
> @@ -640,8 +640,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;
> }
It's a bit late so perhaps I'm thinking backwards, but isn't this
logic inverted?
Fact: The WP signal is missing from the micro-sd slot on the kfr2r09
board, and the card incorrectly comes up write protected.
Solution: TMIO_MMC_WRPROTECT_DISABLE is set to make sure the card is
_not_ write protected by mistake.
But: The code using the ->reg_ro() callback assumes that the card is
read-only if 1 is returned according to drivers/mmc/core/sd.c. The
code above returns 1 if TMIO_MMC_WRPROTECT_DISABLE is set. So the card
will be forced read-only on kfr2r09 unless i'm mistaken, and this does
not help so much. =)
This seems backwards to me. Can you please double check?
/ magnus
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] tmio: add a platform flag to disable card
2010-05-11 12:04 ` [PATCH 1/3] tmio: add a platform flag to disable card Magnus Damm
@ 2010-05-11 12:15 ` Guennadi Liakhovetski
2010-05-11 12:17 ` Magnus Damm
0 siblings, 1 reply; 16+ messages in thread
From: Guennadi Liakhovetski @ 2010-05-11 12:15 UTC (permalink / raw)
To: Magnus Damm; +Cc: linux-sh@vger.kernel.org, Ian Molton, Samuel Ortiz, linux-mmc
On Tue, 11 May 2010, Magnus Damm wrote:
> Hi Guennadi,
>
> Many thanks for your work on this!
>
> On Tue, May 11, 2010 at 6:52 PM, Guennadi Liakhovetski
> <g.liakhovetski@gmx.de> wrote:
> > 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 <g.liakhovetski@gmx.de>
> > ---
> > drivers/mmc/host/tmio_mmc.c | 5 ++++-
> > include/linux/mfd/tmio.h | 4 ++++
> > 2 files changed, 8 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
> > index 7e79ba4..11c19b0 100644
> > --- a/drivers/mmc/host/tmio_mmc.c
> > +++ b/drivers/mmc/host/tmio_mmc.c
> > @@ -640,8 +640,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;
> > }
>
> It's a bit late so perhaps I'm thinking backwards, but isn't this
> logic inverted?
>
> Fact: The WP signal is missing from the micro-sd slot on the kfr2r09
> board, and the card incorrectly comes up write protected.
>
> Solution: TMIO_MMC_WRPROTECT_DISABLE is set to make sure the card is
> _not_ write protected by mistake.
>
> But: The code using the ->reg_ro() callback assumes that the card is
> read-only if 1 is returned according to drivers/mmc/core/sd.c. The
> code above returns 1 if TMIO_MMC_WRPROTECT_DISABLE is set. So the card
> will be forced read-only on kfr2r09 unless i'm mistaken, and this does
> not help so much. =)
I think above is right, please, look again. If TMIO_MMC_WRPROTECT_DISABLE
is set, the function returns 0.
> This seems backwards to me. Can you please double check?
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] tmio: add a platform flag to disable card
2010-05-11 12:15 ` Guennadi Liakhovetski
@ 2010-05-11 12:17 ` Magnus Damm
0 siblings, 0 replies; 16+ messages in thread
From: Magnus Damm @ 2010-05-11 12:17 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: linux-sh@vger.kernel.org, Ian Molton, Samuel Ortiz, linux-mmc
On Tue, May 11, 2010 at 9:15 PM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:
> On Tue, 11 May 2010, Magnus Damm wrote:
>
>> Hi Guennadi,
>>
>> Many thanks for your work on this!
>>
>> On Tue, May 11, 2010 at 6:52 PM, Guennadi Liakhovetski
>> <g.liakhovetski@gmx.de> wrote:
>> > 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 <g.liakhovetski@gmx.de>
>> > ---
>> > drivers/mmc/host/tmio_mmc.c | 5 ++++-
>> > include/linux/mfd/tmio.h | 4 ++++
>> > 2 files changed, 8 insertions(+), 1 deletions(-)
>> >
>> > diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
>> > index 7e79ba4..11c19b0 100644
>> > --- a/drivers/mmc/host/tmio_mmc.c
>> > +++ b/drivers/mmc/host/tmio_mmc.c
>> > @@ -640,8 +640,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;
>> > }
>>
>> It's a bit late so perhaps I'm thinking backwards, but isn't this
>> logic inverted?
>>
>> Fact: The WP signal is missing from the micro-sd slot on the kfr2r09
>> board, and the card incorrectly comes up write protected.
>>
>> Solution: TMIO_MMC_WRPROTECT_DISABLE is set to make sure the card is
>> _not_ write protected by mistake.
>>
>> But: The code using the ->reg_ro() callback assumes that the card is
>> read-only if 1 is returned according to drivers/mmc/core/sd.c. The
>> code above returns 1 if TMIO_MMC_WRPROTECT_DISABLE is set. So the card
>> will be forced read-only on kfr2r09 unless i'm mistaken, and this does
>> not help so much. =)
>
> I think above is right, please, look again. If TMIO_MMC_WRPROTECT_DISABLE
> is set, the function returns 0.
Err, yeah, you are correct. I overlooked the "?" part... Looking good!
Thanks,
/ magnus
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 2/3 v2] mfd: pass platform flags down to the tmio_mmc driver
2010-05-11 9:52 ` [PATCH 2/3] mfd: pass platform flags down to the tmio_mmc driver Guennadi Liakhovetski
@ 2010-05-13 16:08 ` Guennadi Liakhovetski
0 siblings, 0 replies; 16+ messages in thread
From: Guennadi Liakhovetski @ 2010-05-13 16:08 UTC (permalink / raw)
To: linux-sh@vger.kernel.org; +Cc: Ian Molton, Samuel Ortiz, linux-mmc
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
v1 -> v2:
it's better without a NULL dereference
drivers/mfd/sh_mobile_sdhi.c | 2 ++
include/linux/mfd/sh_mobile_sdhi.h | 1 +
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/sh_mobile_sdhi.c b/drivers/mfd/sh_mobile_sdhi.c
index dafa988..7970fe8 100644
--- a/drivers/mfd/sh_mobile_sdhi.c
+++ b/drivers/mfd/sh_mobile_sdhi.c
@@ -106,6 +106,8 @@ static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
mmc_data->hclk = clk_get_rate(priv->clk);
mmc_data->set_pwr = sh_mobile_sdhi_set_pwr;
mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
+ if (p)
+ mmc_data->flags = p->tmio_flags;
if (p && p->dma_slave_tx >= 0 && p->dma_slave_rx >= 0) {
priv->param_tx.slave_id = p->dma_slave_tx;
diff --git a/include/linux/mfd/sh_mobile_sdhi.h b/include/linux/mfd/sh_mobile_sdhi.h
index c305461..c7b47f8 100644
--- a/include/linux/mfd/sh_mobile_sdhi.h
+++ b/include/linux/mfd/sh_mobile_sdhi.h
@@ -4,6 +4,7 @@
struct sh_mobile_sdhi_info {
int dma_slave_tx;
int dma_slave_rx;
+ unsigned long tmio_flags;
void (*set_pwr)(struct platform_device *pdev, int state);
};
--
1.6.2.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 0/3] tmio: let platforms decide upon write-protection
2010-05-11 9:52 [PATCH 0/3] tmio: let platforms decide upon write-protection Guennadi Liakhovetski
` (2 preceding siblings ...)
2010-05-11 9:52 ` [PATCH 3/3] sh: disable SD-card write-protection detection on kfr2r09 Guennadi Liakhovetski
@ 2010-05-19 18:35 ` Guennadi Liakhovetski
2010-05-19 18:36 ` [PATCH 1/3] tmio: add a platform flag to disable card write-protection Guennadi Liakhovetski
` (3 more replies)
3 siblings, 4 replies; 16+ messages in thread
From: Guennadi Liakhovetski @ 2010-05-19 18:35 UTC (permalink / raw)
To: linux-sh@vger.kernel.org
Cc: Ian Molton, Samuel Ortiz, linux-mmc, Andrew Morton
No changes to patches themselves, just re-sending with an ack added.
Applies on top of the
"[PATCH 0/10] add DMA support to tmio_mmc, using dmaengine API, use it on SH"
patch series.
Andrew, please, apply.
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/3] tmio: add a platform flag to disable card write-protection
2010-05-19 18:35 ` [PATCH 0/3] tmio: let platforms decide upon write-protection Guennadi Liakhovetski
@ 2010-05-19 18:36 ` Guennadi Liakhovetski
2010-05-19 18:36 ` [PATCH 2/3 v2] mfd: pass platform flags down to the tmio_mmc driver Guennadi Liakhovetski
` (2 subsequent siblings)
3 siblings, 0 replies; 16+ messages in thread
From: Guennadi Liakhovetski @ 2010-05-19 18:36 UTC (permalink / raw)
To: linux-sh@vger.kernel.org
Cc: Ian Molton, Samuel Ortiz, linux-mmc, Andrew Morton
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 <g.liakhovetski@gmx.de>
Acked-by: Ian Molton <ian@mnementh.co.uk>
---
drivers/mmc/host/tmio_mmc.c | 5 ++++-
include/linux/mfd/tmio.h | 4 ++++
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index 7e79ba4..11c19b0 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -640,8 +640,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 = {
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 360fc95..feeed0b 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -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);
@@ -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);
--
1.6.2.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/3 v2] mfd: pass platform flags down to the tmio_mmc driver
2010-05-19 18:35 ` [PATCH 0/3] tmio: let platforms decide upon write-protection Guennadi Liakhovetski
2010-05-19 18:36 ` [PATCH 1/3] tmio: add a platform flag to disable card write-protection Guennadi Liakhovetski
@ 2010-05-19 18:36 ` Guennadi Liakhovetski
2010-05-19 18:36 ` [PATCH 3/3] sh: disable SD-card write-protection detection on kfr2r09 Guennadi Liakhovetski
2010-05-21 19:38 ` [PATCH 0/3] tmio: let platforms decide upon write-protection Andrew Morton
3 siblings, 0 replies; 16+ messages in thread
From: Guennadi Liakhovetski @ 2010-05-19 18:36 UTC (permalink / raw)
To: linux-sh@vger.kernel.org
Cc: Ian Molton, Samuel Ortiz, linux-mmc, Andrew Morton
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Ian Molton <ian@mnementh.co.uk>
---
drivers/mfd/sh_mobile_sdhi.c | 2 ++
include/linux/mfd/sh_mobile_sdhi.h | 1 +
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/sh_mobile_sdhi.c b/drivers/mfd/sh_mobile_sdhi.c
index dafa988..7970fe8 100644
--- a/drivers/mfd/sh_mobile_sdhi.c
+++ b/drivers/mfd/sh_mobile_sdhi.c
@@ -106,6 +106,8 @@ static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
mmc_data->hclk = clk_get_rate(priv->clk);
mmc_data->set_pwr = sh_mobile_sdhi_set_pwr;
mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
+ if (p)
+ mmc_data->flags = p->tmio_flags;
if (p && p->dma_slave_tx >= 0 && p->dma_slave_rx >= 0) {
priv->param_tx.slave_id = p->dma_slave_tx;
diff --git a/include/linux/mfd/sh_mobile_sdhi.h b/include/linux/mfd/sh_mobile_sdhi.h
index c305461..c7b47f8 100644
--- a/include/linux/mfd/sh_mobile_sdhi.h
+++ b/include/linux/mfd/sh_mobile_sdhi.h
@@ -4,6 +4,7 @@
struct sh_mobile_sdhi_info {
int dma_slave_tx;
int dma_slave_rx;
+ unsigned long tmio_flags;
void (*set_pwr)(struct platform_device *pdev, int state);
};
--
1.6.2.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/3] sh: disable SD-card write-protection detection on kfr2r09
2010-05-19 18:35 ` [PATCH 0/3] tmio: let platforms decide upon write-protection Guennadi Liakhovetski
2010-05-19 18:36 ` [PATCH 1/3] tmio: add a platform flag to disable card write-protection Guennadi Liakhovetski
2010-05-19 18:36 ` [PATCH 2/3 v2] mfd: pass platform flags down to the tmio_mmc driver Guennadi Liakhovetski
@ 2010-05-19 18:36 ` Guennadi Liakhovetski
2010-05-21 19:38 ` [PATCH 0/3] tmio: let platforms decide upon write-protection Andrew Morton
3 siblings, 0 replies; 16+ messages in thread
From: Guennadi Liakhovetski @ 2010-05-19 18:36 UTC (permalink / raw)
To: linux-sh@vger.kernel.org
Cc: Ian Molton, Samuel Ortiz, linux-mmc, Andrew Morton
kfr2r09 board has a micro-SD card slot, therefore card write-protection
detection cannot work there, disable it.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Ian Molton <ian@mnementh.co.uk>
---
arch/sh/boards/mach-kfr2r09/setup.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
index 95850aa..68994a1 100644
--- a/arch/sh/boards/mach-kfr2r09/setup.c
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -11,6 +11,7 @@
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/mfd/sh_mobile_sdhi.h>
+#include <linux/mfd/tmio.h>
#include <linux/mtd/physmap.h>
#include <linux/mtd/onenand.h>
#include <linux/delay.h>
@@ -358,8 +359,9 @@ static struct resource kfr2r09_sh_sdhi0_resources[] = {
};
static struct sh_mobile_sdhi_info sh7724_sdhi0_data = {
- .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
- .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
+ .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
+ .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
+ .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
};
static struct platform_device kfr2r09_sh_sdhi0_device = {
--
1.6.2.4
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 0/3] tmio: let platforms decide upon write-protection
2010-05-19 18:35 ` [PATCH 0/3] tmio: let platforms decide upon write-protection Guennadi Liakhovetski
` (2 preceding siblings ...)
2010-05-19 18:36 ` [PATCH 3/3] sh: disable SD-card write-protection detection on kfr2r09 Guennadi Liakhovetski
@ 2010-05-21 19:38 ` Andrew Morton
2010-05-22 7:33 ` [PATCH 0/3] tmio: let platforms decide upon write-protection availability Paul Mundt
3 siblings, 1 reply; 16+ messages in thread
From: Andrew Morton @ 2010-05-21 19:38 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: linux-sh@vger.kernel.org, Ian Molton, Samuel Ortiz, linux-mmc,
Paul Mundt
On Wed, 19 May 2010 20:35:57 +0200 (CEST)
Guennadi Liakhovetski <g.liakhovetski@gmx.de> wrote:
> No changes to patches themselves, just re-sending with an ack added.
>
> Applies on top of the
>
> "[PATCH 0/10] add DMA support to tmio_mmc, using dmaengine API, use it on SH"
>
> patch series.
>
Paul, are you planning on merging the tem patches in the
above-mentioned series for 2.6.35-rc1?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/3] tmio: let platforms decide upon write-protection availability
2010-05-21 19:38 ` [PATCH 0/3] tmio: let platforms decide upon write-protection Andrew Morton
@ 2010-05-22 7:33 ` Paul Mundt
2010-05-22 8:10 ` Paul Mundt
0 siblings, 1 reply; 16+ messages in thread
From: Paul Mundt @ 2010-05-22 7:33 UTC (permalink / raw)
To: Andrew Morton
Cc: Guennadi Liakhovetski, linux-sh@vger.kernel.org, Ian Molton,
Samuel Ortiz, linux-mmc
On Fri, May 21, 2010 at 12:38:27PM -0700, Andrew Morton wrote:
> On Wed, 19 May 2010 20:35:57 +0200 (CEST)
> Guennadi Liakhovetski <g.liakhovetski@gmx.de> wrote:
>
> > No changes to patches themselves, just re-sending with an ack added.
> >
> > Applies on top of the
> >
> > "[PATCH 0/10] add DMA support to tmio_mmc, using dmaengine API, use it on SH"
> >
> > patch series.
> >
>
> Paul, are you planning on merging the tem patches in the
> above-mentioned series for 2.6.35-rc1?
>
Yes, they'll be in my next round of updates for -rc1. Since I don't have
much else, I'll send those out today or tomorrow.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/3] tmio: let platforms decide upon write-protection availability
2010-05-22 7:33 ` [PATCH 0/3] tmio: let platforms decide upon write-protection availability Paul Mundt
@ 2010-05-22 8:10 ` Paul Mundt
2010-05-25 19:09 ` [PATCH 0/3] tmio: let platforms decide upon write-protection Ian Molton
0 siblings, 1 reply; 16+ messages in thread
From: Paul Mundt @ 2010-05-22 8:10 UTC (permalink / raw)
To: Andrew Morton
Cc: Guennadi Liakhovetski, linux-sh@vger.kernel.org, Ian Molton,
Samuel Ortiz, linux-mmc
On Sat, May 22, 2010 at 04:33:33PM +0900, Paul Mundt wrote:
> On Fri, May 21, 2010 at 12:38:27PM -0700, Andrew Morton wrote:
> > On Wed, 19 May 2010 20:35:57 +0200 (CEST)
> > Guennadi Liakhovetski <g.liakhovetski@gmx.de> wrote:
> >
> > > No changes to patches themselves, just re-sending with an ack added.
> > >
> > > Applies on top of the
> > >
> > > "[PATCH 0/10] add DMA support to tmio_mmc, using dmaengine API, use it on SH"
> > >
> > > patch series.
> > >
> >
> > Paul, are you planning on merging the tem patches in the
> > above-mentioned series for 2.6.35-rc1?
> >
> Yes, they'll be in my next round of updates for -rc1. Since I don't have
> much else, I'll send those out today or tomorrow.
Since the 0/3 and 0/2 series also had all of the acked-bys and so on I
also took those. This at least lets us merge all of the sh platform
patches at the same time without any odd dependency ordering. The ARM
stuff I'll take care of separately after these have been merged.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/3] tmio: let platforms decide upon write-protection
2010-05-22 8:10 ` Paul Mundt
@ 2010-05-25 19:09 ` Ian Molton
0 siblings, 0 replies; 16+ messages in thread
From: Ian Molton @ 2010-05-25 19:09 UTC (permalink / raw)
To: Paul Mundt
Cc: Andrew Morton, Guennadi Liakhovetski, linux-sh@vger.kernel.org,
Samuel Ortiz, linux-mmc, Magnus Damm
Hey,
I know I'm probably not the worlds promptest or easiest maintainer to
work with, but I'd just like to say a quick thanks to everyone
involved with the tmio-mmc driver. You've all put in a lot of effort
to make it what it is today.
Its really nice to see it being used in such a huge array of devices -
something which was my goal since the very beginning when I helped
author the MFD core. Back then ASIC3 was the only similar device I
knew of, and tmio-mmc owes some thanks to the early ASIC3 work as well
as a couple of people in Toshiba who were willing to stick their necks
out enough to get me what little documentation (register specs and
little more) that they could.
Cheers guys!
--
Ian Molton
Linux, Automotive, and other hacking:
http://www.mnementh.co.uk/
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2010-05-25 19:09 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-11 9:52 [PATCH 0/3] tmio: let platforms decide upon write-protection Guennadi Liakhovetski
2010-05-11 9:52 ` [PATCH 1/3] tmio: add a platform flag to disable card write-protection Guennadi Liakhovetski
2010-05-11 12:04 ` [PATCH 1/3] tmio: add a platform flag to disable card Magnus Damm
2010-05-11 12:15 ` Guennadi Liakhovetski
2010-05-11 12:17 ` Magnus Damm
2010-05-11 9:52 ` [PATCH 2/3] mfd: pass platform flags down to the tmio_mmc driver Guennadi Liakhovetski
2010-05-13 16:08 ` [PATCH 2/3 v2] " Guennadi Liakhovetski
2010-05-11 9:52 ` [PATCH 3/3] sh: disable SD-card write-protection detection on kfr2r09 Guennadi Liakhovetski
2010-05-19 18:35 ` [PATCH 0/3] tmio: let platforms decide upon write-protection Guennadi Liakhovetski
2010-05-19 18:36 ` [PATCH 1/3] tmio: add a platform flag to disable card write-protection Guennadi Liakhovetski
2010-05-19 18:36 ` [PATCH 2/3 v2] mfd: pass platform flags down to the tmio_mmc driver Guennadi Liakhovetski
2010-05-19 18:36 ` [PATCH 3/3] sh: disable SD-card write-protection detection on kfr2r09 Guennadi Liakhovetski
2010-05-21 19:38 ` [PATCH 0/3] tmio: let platforms decide upon write-protection Andrew Morton
2010-05-22 7:33 ` [PATCH 0/3] tmio: let platforms decide upon write-protection availability Paul Mundt
2010-05-22 8:10 ` Paul Mundt
2010-05-25 19:09 ` [PATCH 0/3] tmio: let platforms decide upon write-protection Ian Molton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).