linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: "linux-sh@vger.kernel.org" <linux-sh@vger.kernel.org>,
	Ian Molton <ian@mnementh.co.uk>,
	Samuel Ortiz <sameo@linux.intel.com>,
	linux-mmc@vger.kernel.org
Subject: Re: [PATCH 1/3] tmio: add a platform flag to disable card
Date: Tue, 11 May 2010 12:17:57 +0000	[thread overview]
Message-ID: <AANLkTilDX0gAIbHVaUt7JPZyLvUBLEd_UA1RaMYnvCZY@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1005111414200.6810@axis700.grange>

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

  reply	other threads:[~2010-05-11 12:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTilDX0gAIbHVaUt7JPZyLvUBLEd_UA1RaMYnvCZY@mail.gmail.com \
    --to=magnus.damm@gmail.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=ian@mnementh.co.uk \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).