public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Chris Ball <cjb@laptop.org>
Cc: Simon Baatz <gmbnomis@gmail.com>,
	linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org,
	jason@lakedaemon.net, andrew@lunn.ch,
	thomas.petazzoni@free-electrons.com,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Subject: Re: [PATCH 1/3] mmc: mvsdio: Support inverted CD and WP GPIO lines
Date: Mon, 22 Apr 2013 22:37:23 +0200	[thread overview]
Message-ID: <20130422203723.GI29947@lunn.ch> (raw)
In-Reply-To: <87wqrutjss.fsf@octavius.laptop.org>

On Mon, Apr 22, 2013 at 04:03:15PM -0400, Chris Ball wrote:
> Hi Simon,
> 
> On Mon, Apr 22 2013, Simon Baatz wrote:
> > diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
> > index 145cdaf..d444efd 100644
> > --- a/drivers/mmc/host/mvsdio.c
> > +++ b/drivers/mmc/host/mvsdio.c
> > @@ -691,6 +691,7 @@ static int __init mvsd_probe(struct platform_device *pdev)
> >  	struct resource *r;
> >  	int ret, irq;
> >  	int gpio_card_detect, gpio_write_protect;
> > +	enum of_gpio_flags gpio_flags;
> >  	struct pinctrl *pinctrl;
> >  
> >  	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > @@ -731,8 +732,17 @@ static int __init mvsd_probe(struct platform_device *pdev)
> >  		}
> >  
> >  		host->base_clock = clk_get_rate(host->clk) / 2;
> > -		gpio_card_detect = of_get_named_gpio(np, "cd-gpios", 0);
> > -		gpio_write_protect = of_get_named_gpio(np, "wp-gpios", 0);
> > +		gpio_card_detect = of_get_named_gpio_flags(np, "cd-gpios", 0,
> > +						     &gpio_flags);
> > +		if (gpio_is_valid(gpio_card_detect) &&
> > +		    !(gpio_flags & OF_GPIO_ACTIVE_LOW))
> > +			mmc->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH;
> > +
> > +		gpio_write_protect = of_get_named_gpio_flags(np, "wp-gpios", 0,
> > +						       &gpio_flags);
> > +		if (gpio_is_valid(gpio_write_protect) &&
> > +		    !(gpio_flags & OF_GPIO_ACTIVE_LOW))
> > +			mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH;
> >  	} else {
> >  		const struct mvsdio_platform_data *mvsd_data;
> >  		mvsd_data = pdev->dev.platform_data;
> 
> The core function mmc_of_parse() (new in 3.9) will do all of this DT
> parsing for you, and will also take care of the driver's later calls
> to mmc_gpio_request_{cd,wp}().  Could you try using that function
> instead, please?

Hi Chris, Simon

I have a vague recollection that Thomas Petazzoni already did this
conversion. Take a look in linux-next, or maybe Jason can point you at
a branch.

  Andrew

  reply	other threads:[~2013-04-22 20:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-22 19:54 [PATCH 0/3] ARM: Kirkwood: Add DT support for (eSATA) Sheevaplug Simon Baatz
2013-04-22 19:54 ` [PATCH 1/3] mmc: mvsdio: Support inverted CD and WP GPIO lines Simon Baatz
2013-04-22 20:03   ` Chris Ball
2013-04-22 20:37     ` Andrew Lunn [this message]
2013-04-22 21:09       ` Jason Cooper
2013-04-22 21:45         ` Andrew Lunn
2013-04-22 21:50           ` Chris Ball
2013-04-23  1:48             ` Thomas Petazzoni
2013-04-23 21:22             ` Simon Baatz
2013-04-22 22:54           ` Jason Cooper
2013-04-22 19:54 ` [PATCH 2/3] ARM: Kirkwood: Add dts files for Sheevaplug and eSATA Sheevaplug Simon Baatz
2013-04-22 19:55 ` [PATCH 3/3] ARM: Kirkwood: Add DT support for Sheevaplug and Sheevaplug eSATA Simon Baatz
2013-04-23  5:00 ` [PATCH 0/3] ARM: Kirkwood: Add DT support for (eSATA) Sheevaplug Andrew Lunn
2013-05-13 17:30 ` Jason Cooper

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=20130422203723.GI29947@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=cjb@laptop.org \
    --cc=g.liakhovetski@gmx.de \
    --cc=gmbnomis@gmail.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=thomas.petazzoni@free-electrons.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