Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 343631
b: refs/heads/master
c: 7032449
h: refs/heads/master
i:
  343629: 15856fc
  343627: f13a5ce
  343623: 33dfacf
  343615: c105538
v: v3
  • Loading branch information
Mark Brown committed Nov 6, 2012
1 parent 5ad5867 commit 6fbc0c7
Show file tree
Hide file tree
Showing 13 changed files with 1,526 additions and 52 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: e47a682ace0cd56eb8e09b806c2b0f034b491520
refs/heads/master: 70324494b6f283311c5339fb1795fdec2d8850d9
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
NVIDIA Tegra20/Tegra30 SLINK controller.

Required properties:
- compatible : should be "nvidia,tegra20-slink", "nvidia,tegra30-slink".
- reg: Should contain SLINK registers location and length.
- interrupts: Should contain SLINK interrupts.
- nvidia,dma-request-selector : The Tegra DMA controller's phandle and
request selector for this SLINK controller.

Recommended properties:
- spi-max-frequency: Definition as per
Documentation/devicetree/bindings/spi/spi-bus.txt

Example:

slink@7000d600 {
compatible = "nvidia,tegra20-slink";
reg = <0x7000d600 0x200>;
interrupts = <0 82 0x04>;
nvidia,dma-request-selector = <&apbdma 16>;
spi-max-frequency = <25000000>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};

4 changes: 3 additions & 1 deletion trunk/Documentation/devicetree/bindings/spi/omap-spi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ Required properties:
- "ti,omap4-spi" for OMAP4+.
- ti,spi-num-cs : Number of chipselect supported by the instance.
- ti,hwmods: Name of the hwmod associated to the McSPI

- ti,pindir-d0-in-d1-out: Select the D0 pin as input and D1 as
output. The default is D0 as output and
D1 as input.

Example:

Expand Down
6 changes: 6 additions & 0 deletions trunk/drivers/spi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,12 @@ config SPI_MXS
help
SPI driver for Freescale MXS devices.

config SPI_TEGRA20_SLINK
tristate "Nvidia Tegra20/Tegra30 SLINK Controller"
depends on ARCH_TEGRA && TEGRA20_APB_DMA
help
SPI driver for Nvidia Tegra20/Tegra30 SLINK Controller interface.

config SPI_TI_SSP
tristate "TI Sequencer Serial Port - SPI Support"
depends on MFD_TI_SSP
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/spi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ obj-$(CONFIG_SPI_SH_MSIOF) += spi-sh-msiof.o
obj-$(CONFIG_SPI_SH_SCI) += spi-sh-sci.o
obj-$(CONFIG_SPI_SIRF) += spi-sirf.o
obj-$(CONFIG_SPI_STMP3XXX) += spi-stmp.o
obj-$(CONFIG_SPI_TEGRA20_SLINK) += spi-tegra20-slink.o
obj-$(CONFIG_SPI_TI_SSP) += spi-ti-ssp.o
obj-$(CONFIG_SPI_TLE62X0) += spi-tle62x0.o
obj-$(CONFIG_SPI_TOPCLIFF_PCH) += spi-topcliff-pch.o
obj-$(CONFIG_SPI_TXX9) += spi-txx9.o
obj-$(CONFIG_SPI_XCOMM) += spi-xcomm.o
obj-$(CONFIG_SPI_XILINX) += spi-xilinx.o

16 changes: 6 additions & 10 deletions trunk/drivers/spi/spi-bcm63xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <bcm63xx_dev_spi.h>

#define PFX KBUILD_MODNAME
#define DRV_VER "0.1.2"

struct bcm63xx_spi {
struct completion done;
Expand Down Expand Up @@ -170,13 +169,6 @@ static int bcm63xx_spi_setup(struct spi_device *spi)
return -EINVAL;
}

ret = bcm63xx_spi_check_transfer(spi, NULL);
if (ret < 0) {
dev_err(&spi->dev, "setup: unsupported mode bits %x\n",
spi->mode & ~MODEBITS);
return ret;
}

dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec/bit\n",
__func__, spi->mode & MODEBITS, spi->bits_per_word, 0);

Expand Down Expand Up @@ -441,8 +433,8 @@ static int __devinit bcm63xx_spi_probe(struct platform_device *pdev)
goto out_clk_disable;
}

dev_info(dev, "at 0x%08x (irq %d, FIFOs size %d) v%s\n",
r->start, irq, bs->fifo_size, DRV_VER);
dev_info(dev, "at 0x%08x (irq %d, FIFOs size %d)\n",
r->start, irq, bs->fifo_size);

return 0;

Expand Down Expand Up @@ -485,6 +477,8 @@ static int bcm63xx_spi_suspend(struct device *dev)
platform_get_drvdata(to_platform_device(dev));
struct bcm63xx_spi *bs = spi_master_get_devdata(master);

spi_master_suspend(master);

clk_disable(bs->clk);

return 0;
Expand All @@ -498,6 +492,8 @@ static int bcm63xx_spi_resume(struct device *dev)

clk_enable(bs->clk);

spi_master_resume(master);

return 0;
}

Expand Down
25 changes: 18 additions & 7 deletions trunk/drivers/spi/spi-omap2-mcspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ struct omap2_mcspi {
struct omap2_mcspi_dma *dma_channels;
struct device *dev;
struct omap2_mcspi_regs ctx;
unsigned int pin_dir:1;
};

struct omap2_mcspi_cs {
Expand Down Expand Up @@ -764,8 +765,15 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
/* standard 4-wire master mode: SCK, MOSI/out, MISO/in, nCS
* REVISIT: this controller could support SPI_3WIRE mode.
*/
l &= ~(OMAP2_MCSPI_CHCONF_IS|OMAP2_MCSPI_CHCONF_DPE1);
l |= OMAP2_MCSPI_CHCONF_DPE0;
if (mcspi->pin_dir == MCSPI_PINDIR_D0_OUT_D1_IN) {
l &= ~OMAP2_MCSPI_CHCONF_IS;
l &= ~OMAP2_MCSPI_CHCONF_DPE1;
l |= OMAP2_MCSPI_CHCONF_DPE0;
} else {
l |= OMAP2_MCSPI_CHCONF_IS;
l |= OMAP2_MCSPI_CHCONF_DPE1;
l &= ~OMAP2_MCSPI_CHCONF_DPE0;
}

/* wordlength */
l &= ~OMAP2_MCSPI_CHCONF_WL_MASK;
Expand Down Expand Up @@ -1166,6 +1174,11 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
master->cleanup = omap2_mcspi_cleanup;
master->dev.of_node = node;

dev_set_drvdata(&pdev->dev, master);

mcspi = spi_master_get_devdata(master);
mcspi->master = master;

match = of_match_device(omap_mcspi_of_match, &pdev->dev);
if (match) {
u32 num_cs = 1; /* default number of chipselect */
Expand All @@ -1174,19 +1187,17 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
of_property_read_u32(node, "ti,spi-num-cs", &num_cs);
master->num_chipselect = num_cs;
master->bus_num = bus_num++;
if (of_get_property(node, "ti,pindir-d0-in-d1-out", NULL))
mcspi->pin_dir = MCSPI_PINDIR_D0_IN_D1_OUT;
} else {
pdata = pdev->dev.platform_data;
master->num_chipselect = pdata->num_cs;
if (pdev->id != -1)
master->bus_num = pdev->id;
mcspi->pin_dir = pdata->pin_dir;
}
regs_offset = pdata->regs_offset;

dev_set_drvdata(&pdev->dev, master);

mcspi = spi_master_get_devdata(master);
mcspi->master = master;

r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (r == NULL) {
status = -ENODEV;
Expand Down
52 changes: 36 additions & 16 deletions trunk/drivers/spi/spi-pl022.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ struct pl022 {
/* Two optional pin states - default & sleep */
struct pinctrl *pinctrl;
struct pinctrl_state *pins_default;
struct pinctrl_state *pins_idle;
struct pinctrl_state *pins_sleep;
struct spi_master *master;
struct pl022_ssp_controller *master_info;
Expand Down Expand Up @@ -2116,6 +2117,11 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id)
} else
dev_err(dev, "could not get default pinstate\n");

pl022->pins_idle = pinctrl_lookup_state(pl022->pinctrl,
PINCTRL_STATE_IDLE);
if (IS_ERR(pl022->pins_idle))
dev_dbg(dev, "could not get idle pinstate\n");

pl022->pins_sleep = pinctrl_lookup_state(pl022->pinctrl,
PINCTRL_STATE_SLEEP);
if (IS_ERR(pl022->pins_sleep))
Expand Down Expand Up @@ -2246,10 +2252,9 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id)
pm_runtime_set_autosuspend_delay(dev,
platform_info->autosuspend_delay);
pm_runtime_use_autosuspend(dev);
pm_runtime_put_autosuspend(dev);
} else {
pm_runtime_put(dev);
}
pm_runtime_put(dev);

return 0;

err_spi_register:
Expand Down Expand Up @@ -2303,35 +2308,47 @@ pl022_remove(struct amba_device *adev)
* the runtime counterparts to handle external resources like
* clocks, pins and regulators when going to sleep.
*/
static void pl022_suspend_resources(struct pl022 *pl022)
static void pl022_suspend_resources(struct pl022 *pl022, bool runtime)
{
int ret;
struct pinctrl_state *pins_state;

clk_disable(pl022->clk);

pins_state = runtime ? pl022->pins_idle : pl022->pins_sleep;
/* Optionally let pins go into sleep states */
if (!IS_ERR(pl022->pins_sleep)) {
ret = pinctrl_select_state(pl022->pinctrl,
pl022->pins_sleep);
if (!IS_ERR(pins_state)) {
ret = pinctrl_select_state(pl022->pinctrl, pins_state);
if (ret)
dev_err(&pl022->adev->dev,
"could not set pins to sleep state\n");
dev_err(&pl022->adev->dev, "could not set %s pins\n",
runtime ? "idle" : "sleep");
}
}

static void pl022_resume_resources(struct pl022 *pl022)
static void pl022_resume_resources(struct pl022 *pl022, bool runtime)
{
int ret;

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

if (!runtime) {
/* Then let's idle the pins until the next transfer happens */
if (!IS_ERR(pl022->pins_idle)) {
ret = pinctrl_select_state(pl022->pinctrl,
pl022->pins_idle);
if (ret)
dev_err(&pl022->adev->dev,
"could not set idle pins\n");
}
}

clk_enable(pl022->clk);
}
#endif
Expand All @@ -2347,7 +2364,9 @@ static int pl022_suspend(struct device *dev)
dev_warn(dev, "cannot suspend master\n");
return ret;
}
pl022_suspend_resources(pl022);

pm_runtime_get_sync(dev);
pl022_suspend_resources(pl022, false);

dev_dbg(dev, "suspended\n");
return 0;
Expand All @@ -2358,7 +2377,8 @@ static int pl022_resume(struct device *dev)
struct pl022 *pl022 = dev_get_drvdata(dev);
int ret;

pl022_resume_resources(pl022);
pl022_resume_resources(pl022, false);
pm_runtime_put(dev);

/* Start the queue running */
ret = spi_master_resume(pl022->master);
Expand All @@ -2376,15 +2396,15 @@ static int pl022_runtime_suspend(struct device *dev)
{
struct pl022 *pl022 = dev_get_drvdata(dev);

pl022_suspend_resources(pl022);
pl022_suspend_resources(pl022, true);
return 0;
}

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

pl022_resume_resources(pl022);
pl022_resume_resources(pl022, true);
return 0;
}
#endif
Expand Down
Loading

0 comments on commit 6fbc0c7

Please sign in to comment.