* [PATCH] MMCI: fetch pinctrl handle and set default state
@ 2012-10-22 7:52 Linus Walleij
2012-10-22 13:23 ` Ulf Hansson
2012-10-29 12:17 ` Russell King - ARM Linux
0 siblings, 2 replies; 4+ messages in thread
From: Linus Walleij @ 2012-10-22 7:52 UTC (permalink / raw)
To: linux-arm-kernel
From: Linus Walleij <linus.walleij@linaro.org>
This fetches the pinctrl resource for the MMCI driver, and if
a "default" state is found, it is activated.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/mmc/host/mmci.c | 18 ++++++++++++++++++
drivers/mmc/host/mmci.h | 4 ++++
2 files changed, 22 insertions(+)
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index edc3e9b..269566d 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -33,6 +33,7 @@
#include <linux/amba/mmci.h>
#include <linux/pm_runtime.h>
#include <linux/types.h>
+#include <linux/pinctrl/consumer.h>
#include <asm/div64.h>
#include <asm/io.h>
@@ -1360,6 +1361,23 @@ static int __devinit mmci_probe(struct amba_device *dev,
mmc->f_max = min(host->mclk, fmax);
dev_dbg(mmc_dev(mmc), "clocking block at %u Hz\n", mmc->f_max);
+ host->pinctrl = devm_pinctrl_get(&dev->dev);
+ if (IS_ERR(host->pinctrl)) {
+ ret = PTR_ERR(host->pinctrl);
+ goto clk_disable;
+ }
+
+ host->pins_default = pinctrl_lookup_state(host->pinctrl,
+ PINCTRL_STATE_DEFAULT);
+
+ /* enable pins to be muxed in and configured */
+ if (!IS_ERR(host->pins_default)) {
+ ret = pinctrl_select_state(host->pinctrl, host->pins_default);
+ if (ret)
+ dev_err(&dev->dev, "could not set default pins\n");
+ } else
+ dev_err(&dev->dev, "could not get default pinstate\n");
+
#ifdef CONFIG_REGULATOR
/* If we're using the regulator framework, try to fetch a regulator */
host->vcc = regulator_get(&dev->dev, "vmmc");
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h
index d437ccf..d34d8c0 100644
--- a/drivers/mmc/host/mmci.h
+++ b/drivers/mmc/host/mmci.h
@@ -195,6 +195,10 @@ struct mmci_host {
unsigned int size;
struct regulator *vcc;
+ /* pinctrl handles */
+ struct pinctrl *pinctrl;
+ struct pinctrl_state *pins_default;
+
#ifdef CONFIG_DMA_ENGINE
/* DMA stuff */
struct dma_chan *dma_current;
--
1.7.11.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] MMCI: fetch pinctrl handle and set default state
2012-10-22 7:52 [PATCH] MMCI: fetch pinctrl handle and set default state Linus Walleij
@ 2012-10-22 13:23 ` Ulf Hansson
2012-10-29 12:17 ` Russell King - ARM Linux
1 sibling, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2012-10-22 13:23 UTC (permalink / raw)
To: linux-arm-kernel
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
On 22 October 2012 09:52, Linus Walleij <linus.walleij@stericsson.com> wrote:
> From: Linus Walleij <linus.walleij@linaro.org>
>
> This fetches the pinctrl resource for the MMCI driver, and if
> a "default" state is found, it is activated.
>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> drivers/mmc/host/mmci.c | 18 ++++++++++++++++++
> drivers/mmc/host/mmci.h | 4 ++++
> 2 files changed, 22 insertions(+)
>
> diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
> index edc3e9b..269566d 100644
> --- a/drivers/mmc/host/mmci.c
> +++ b/drivers/mmc/host/mmci.c
> @@ -33,6 +33,7 @@
> #include <linux/amba/mmci.h>
> #include <linux/pm_runtime.h>
> #include <linux/types.h>
> +#include <linux/pinctrl/consumer.h>
>
> #include <asm/div64.h>
> #include <asm/io.h>
> @@ -1360,6 +1361,23 @@ static int __devinit mmci_probe(struct amba_device *dev,
> mmc->f_max = min(host->mclk, fmax);
> dev_dbg(mmc_dev(mmc), "clocking block at %u Hz\n", mmc->f_max);
>
> + host->pinctrl = devm_pinctrl_get(&dev->dev);
> + if (IS_ERR(host->pinctrl)) {
> + ret = PTR_ERR(host->pinctrl);
> + goto clk_disable;
> + }
> +
> + host->pins_default = pinctrl_lookup_state(host->pinctrl,
> + PINCTRL_STATE_DEFAULT);
> +
> + /* enable pins to be muxed in and configured */
> + if (!IS_ERR(host->pins_default)) {
> + ret = pinctrl_select_state(host->pinctrl, host->pins_default);
> + if (ret)
> + dev_err(&dev->dev, "could not set default pins\n");
> + } else
> + dev_err(&dev->dev, "could not get default pinstate\n");
> +
> #ifdef CONFIG_REGULATOR
> /* If we're using the regulator framework, try to fetch a regulator */
> host->vcc = regulator_get(&dev->dev, "vmmc");
> diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h
> index d437ccf..d34d8c0 100644
> --- a/drivers/mmc/host/mmci.h
> +++ b/drivers/mmc/host/mmci.h
> @@ -195,6 +195,10 @@ struct mmci_host {
> unsigned int size;
> struct regulator *vcc;
>
> + /* pinctrl handles */
> + struct pinctrl *pinctrl;
> + struct pinctrl_state *pins_default;
> +
> #ifdef CONFIG_DMA_ENGINE
> /* DMA stuff */
> struct dma_chan *dma_current;
> --
> 1.7.11.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] MMCI: fetch pinctrl handle and set default state
2012-10-22 7:52 [PATCH] MMCI: fetch pinctrl handle and set default state Linus Walleij
2012-10-22 13:23 ` Ulf Hansson
@ 2012-10-29 12:17 ` Russell King - ARM Linux
1 sibling, 0 replies; 4+ messages in thread
From: Russell King - ARM Linux @ 2012-10-29 12:17 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Oct 22, 2012 at 09:52:06AM +0200, Linus Walleij wrote:
> + /* enable pins to be muxed in and configured */
> + if (!IS_ERR(host->pins_default)) {
> + ret = pinctrl_select_state(host->pinctrl, host->pins_default);
> + if (ret)
> + dev_err(&dev->dev, "could not set default pins\n");
> + } else
> + dev_err(&dev->dev, "could not get default pinstate\n");
Umm, are these errors or warnings? Arguably, because we continue,
these seem to me to be warnings.
In my mind, a warning message is one which is reporting a condition which
we can continue from, whereas an error message is a condition which causes
immediate failure. (Think about GCC... with warnings you still get code,
but the code may not be correct, but if you see an error message you don't
get any code.)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] MMCI: fetch pinctrl handle and set default state
@ 2012-10-29 13:28 Linus Walleij
0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2012-10-29 13:28 UTC (permalink / raw)
To: linux-arm-kernel
This fetches the pinctrl resource for the MMCI driver, and if
a "default" state is found, it is activated.
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Change dev_err() to dev_warn() when grabbing the default pins
since being unable to obtain the default state is not in any
way fatal.
---
drivers/mmc/host/mmci.c | 18 ++++++++++++++++++
drivers/mmc/host/mmci.h | 4 ++++
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index edc3e9b..9a36226 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -33,6 +33,7 @@
#include <linux/amba/mmci.h>
#include <linux/pm_runtime.h>
#include <linux/types.h>
+#include <linux/pinctrl/consumer.h>
#include <asm/div64.h>
#include <asm/io.h>
@@ -1360,6 +1361,23 @@ static int __devinit mmci_probe(struct amba_device *dev,
mmc->f_max = min(host->mclk, fmax);
dev_dbg(mmc_dev(mmc), "clocking block at %u Hz\n", mmc->f_max);
+ host->pinctrl = devm_pinctrl_get(&dev->dev);
+ if (IS_ERR(host->pinctrl)) {
+ ret = PTR_ERR(host->pinctrl);
+ goto clk_disable;
+ }
+
+ host->pins_default = pinctrl_lookup_state(host->pinctrl,
+ PINCTRL_STATE_DEFAULT);
+
+ /* enable pins to be muxed in and configured */
+ if (!IS_ERR(host->pins_default)) {
+ ret = pinctrl_select_state(host->pinctrl, host->pins_default);
+ if (ret)
+ dev_warn(&dev->dev, "could not set default pins\n");
+ } else
+ dev_warn(&dev->dev, "could not get default pinstate\n");
+
#ifdef CONFIG_REGULATOR
/* If we're using the regulator framework, try to fetch a regulator */
host->vcc = regulator_get(&dev->dev, "vmmc");
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h
index d437ccf..d34d8c0 100644
--- a/drivers/mmc/host/mmci.h
+++ b/drivers/mmc/host/mmci.h
@@ -195,6 +195,10 @@ struct mmci_host {
unsigned int size;
struct regulator *vcc;
+ /* pinctrl handles */
+ struct pinctrl *pinctrl;
+ struct pinctrl_state *pins_default;
+
#ifdef CONFIG_DMA_ENGINE
/* DMA stuff */
struct dma_chan *dma_current;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-10-29 13:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-22 7:52 [PATCH] MMCI: fetch pinctrl handle and set default state Linus Walleij
2012-10-22 13:23 ` Ulf Hansson
2012-10-29 12:17 ` Russell King - ARM Linux
-- strict thread matches above, loose matches on Subject: below --
2012-10-29 13:28 Linus Walleij
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).