Skip to content

Commit

Permalink
ARM: 7562/2: MMCI: fetch pinctrl handle and set default state
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Linus Walleij authored and Russell King committed Nov 4, 2012
1 parent 70ac093 commit a9a8378
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
18 changes: 18 additions & 0 deletions drivers/mmc/host/mmci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -1366,6 +1367,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");
Expand Down
4 changes: 4 additions & 0 deletions drivers/mmc/host/mmci.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a9a8378

Please sign in to comment.