Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 328607
b: refs/heads/master
c: 4f5e1b3
h: refs/heads/master
i:
  328605: 09ccad9
  328603: 0e1c78a
  328599: da88b99
  328591: b177993
  328575: 1b6d99a
v: v3
  • Loading branch information
Patrice Chotard authored and Mark Brown committed Sep 20, 2012
1 parent f4169af commit df58c5f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d7b4394e780b02511c8a7a499380cdd56316c770
refs/heads/master: 4f5e1b370845a0a5789ff7271004ca49e5baa46f
3 changes: 0 additions & 3 deletions trunk/arch/arm/mach-u300/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1604,9 +1604,6 @@ static struct u300_mux_hog u300_mux_hogs[] = {
{
.dev = &uart0_device.dev,
},
{
.dev = &pl022_device.dev,
},
{
.dev = &mmcsd_device.dev,
},
Expand Down
46 changes: 46 additions & 0 deletions trunk/drivers/spi/spi-pl022.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <linux/pm_runtime.h>
#include <linux/gpio.h>
#include <linux/of_gpio.h>
#include <linux/pinctrl/consumer.h>

/*
* This macro is used to define some register default values.
Expand Down Expand Up @@ -367,6 +368,10 @@ struct pl022 {
resource_size_t phybase;
void __iomem *virtbase;
struct clk *clk;
/* Two optional pin states - default & sleep */
struct pinctrl *pinctrl;
struct pinctrl_state *pins_default;
struct pinctrl_state *pins_sleep;
struct spi_master *master;
struct pl022_ssp_controller *master_info;
/* Message per-transfer pump */
Expand Down Expand Up @@ -2068,6 +2073,28 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id)
pl022->chipselects = devm_kzalloc(dev, num_cs * sizeof(int),
GFP_KERNEL);

pl022->pinctrl = devm_pinctrl_get(dev);
if (IS_ERR(pl022->pinctrl)) {
status = PTR_ERR(pl022->pinctrl);
goto err_no_pinctrl;
}

pl022->pins_default = pinctrl_lookup_state(pl022->pinctrl,
PINCTRL_STATE_DEFAULT);
/* enable pins to be muxed in and configured */
if (!IS_ERR(pl022->pins_default)) {
status = pinctrl_select_state(pl022->pinctrl,
pl022->pins_default);
if (status)
dev_err(dev, "could not set default pins\n");
} else
dev_err(dev, "could not get default pinstate\n");

pl022->pins_sleep = pinctrl_lookup_state(pl022->pinctrl,
PINCTRL_STATE_SLEEP);
if (IS_ERR(pl022->pins_sleep))
dev_dbg(dev, "could not get sleep pinstate\n");

/*
* Bus Number Which has been Assigned to this SSP controller
* on this board
Expand Down Expand Up @@ -2218,6 +2245,7 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id)
amba_release_regions(adev);
err_no_ioregion:
err_no_gpio:
err_no_pinctrl:
spi_master_put(master);
err_no_master:
err_no_pdata:
Expand Down Expand Up @@ -2291,15 +2319,33 @@ static int pl022_resume(struct device *dev)
static int pl022_runtime_suspend(struct device *dev)
{
struct pl022 *pl022 = dev_get_drvdata(dev);
int status = 0;

clk_disable(pl022->clk);

/* Optionally let pins go into sleep states */
if (!IS_ERR(pl022->pins_sleep)) {
status = pinctrl_select_state(pl022->pinctrl,
pl022->pins_sleep);
if (status)
dev_err(dev, "could not set pins to sleep state\n");
}

return 0;
}

static int pl022_runtime_resume(struct device *dev)
{
struct pl022 *pl022 = dev_get_drvdata(dev);
int status = 0;

/* Optionaly enable pins to be muxed in and configured */
if (!IS_ERR(pl022->pins_default)) {
status = pinctrl_select_state(pl022->pinctrl,
pl022->pins_default);
if (status)
dev_err(dev, "could not set default pins\n");
}

clk_enable(pl022->clk);

Expand Down

0 comments on commit df58c5f

Please sign in to comment.