From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mmc: pwrseq_simple: Fix regression with optional GPIOs
Date: Mon, 7 Dec 2015 14:54:05 -0800 [thread overview]
Message-ID: <1449528845-25189-1-git-send-email-tony@atomide.com> (raw)
Commit ce037275861e ("mmc: pwrseq_simple: use GPIO descriptors array API")
changed the handling MMC power sequence so GPIOs no longer are optional.
This broke SDIO WLAN at least for omap5 that can't yet use the reset GPIOs
with pwrseq_simple as a wait is needed after enabling the SDIO device.
Let's fix the problem by allocating the GPIO values array during init
depending on the optional GPIOs found.
Note that depending on the board specific configuration, some of the GPIOs
can be permanently set up with pulls, so we want to keep pwrseq_simple
GPIOs optional.
Cc: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/mmc/core/pwrseq_simple.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
--- a/drivers/mmc/core/pwrseq_simple.c
+++ b/drivers/mmc/core/pwrseq_simple.c
@@ -24,6 +24,7 @@ struct mmc_pwrseq_simple {
bool clk_enabled;
struct clk *ext_clk;
struct gpio_descs *reset_gpios;
+ int *values;
};
static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq,
@@ -31,13 +32,15 @@ static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq,
{
int i;
struct gpio_descs *reset_gpios = pwrseq->reset_gpios;
- int values[reset_gpios->ndescs];
+
+ if (!reset_gpios || !reset_gpios->ndescs)
+ return;
for (i = 0; i < reset_gpios->ndescs; i++)
- values[i] = value;
+ pwrseq->values[i] = value;
gpiod_set_array_value_cansleep(reset_gpios->ndescs, reset_gpios->desc,
- values);
+ pwrseq->values);
}
static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host)
@@ -84,6 +87,7 @@ static void mmc_pwrseq_simple_free(struct mmc_host *host)
if (!IS_ERR(pwrseq->ext_clk))
clk_put(pwrseq->ext_clk);
+ kfree(pwrseq->values);
kfree(pwrseq);
}
@@ -111,12 +115,20 @@ struct mmc_pwrseq *mmc_pwrseq_simple_alloc(struct mmc_host *host,
goto free;
}
- pwrseq->reset_gpios = gpiod_get_array(dev, "reset", GPIOD_OUT_HIGH);
+ pwrseq->reset_gpios = gpiod_get_array_optional(dev, "reset",
+ GPIOD_OUT_HIGH);
if (IS_ERR(pwrseq->reset_gpios)) {
ret = PTR_ERR(pwrseq->reset_gpios);
goto clk_put;
}
+ if (pwrseq->reset_gpios && pwrseq->reset_gpios->ndescs) {
+ pwrseq->values = kzalloc(pwrseq->reset_gpios->ndescs *
+ sizeof(int), GFP_KERNEL);
+ if (!pwrseq->values)
+ goto clk_put;
+ }
+
pwrseq->pwrseq.ops = &mmc_pwrseq_simple_ops;
return &pwrseq->pwrseq;
--
2.6.2
next reply other threads:[~2015-12-07 22:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-07 22:54 Tony Lindgren [this message]
2015-12-08 0:19 ` [PATCH] mmc: pwrseq_simple: Fix regression with optional GPIOs Ulf Hansson
2015-12-08 0:32 ` Tony Lindgren
2015-12-08 1:53 ` Javier Martinez Canillas
2015-12-08 13:17 ` Ulf Hansson
2015-12-08 15:57 ` Tony Lindgren
2015-12-18 16:14 ` Tony Lindgren
2015-12-18 22:19 ` Ulf Hansson
2015-12-18 22:31 ` Tony Lindgren
2015-12-28 12:18 ` Ulf Hansson
2015-12-28 21:28 ` Tony Lindgren
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=1449528845-25189-1-git-send-email-tony@atomide.com \
--to=tony@atomide.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).