Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 343634
b: refs/heads/master
c: caae070
h: refs/heads/master
v: v3
  • Loading branch information
Laxman Dewangan authored and Mark Brown committed Nov 9, 2012
1 parent 35a6fd7 commit c40b6e2
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 1,548 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: fad8f9c0b28ff1b9c93ea91048c0be701407eb67
refs/heads/master: caae070c48f39b4f7312e7473f6d3576f426e7fb

This file was deleted.

4 changes: 1 addition & 3 deletions trunk/Documentation/devicetree/bindings/spi/omap-spi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ 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: 0 additions & 6 deletions trunk/drivers/spi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,6 @@ 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: 10 additions & 6 deletions trunk/drivers/spi/spi-bcm63xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#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 @@ -169,6 +170,13 @@ 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 @@ -433,8 +441,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)\n",
r->start, irq, bs->fifo_size);
dev_info(dev, "at 0x%08x (irq %d, FIFOs size %d) v%s\n",
r->start, irq, bs->fifo_size, DRV_VER);

return 0;

Expand Down Expand Up @@ -477,8 +485,6 @@ 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 @@ -492,8 +498,6 @@ static int bcm63xx_spi_resume(struct device *dev)

clk_enable(bs->clk);

spi_master_resume(master);

return 0;
}

Expand Down
64 changes: 27 additions & 37 deletions trunk/drivers/spi/spi-omap2-mcspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ 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 @@ -324,13 +323,18 @@ static void omap2_mcspi_tx_dma(struct spi_device *spi,
struct omap2_mcspi *mcspi;
struct omap2_mcspi_dma *mcspi_dma;
unsigned int count;
u8 * rx;
const u8 * tx;
void __iomem *chstat_reg;
struct omap2_mcspi_cs *cs = spi->controller_state;

mcspi = spi_master_get_devdata(spi->master);
mcspi_dma = &mcspi->dma_channels[spi->chip_select];
count = xfer->len;

rx = xfer->rx_buf;
tx = xfer->tx_buf;
chstat_reg = cs->base + OMAP2_MCSPI_CHSTAT0;

if (mcspi_dma->dma_tx) {
struct dma_async_tx_descriptor *tx;
Expand All @@ -355,6 +359,19 @@ static void omap2_mcspi_tx_dma(struct spi_device *spi,
dma_async_issue_pending(mcspi_dma->dma_tx);
omap2_mcspi_set_dma_req(spi, 0, 1);

wait_for_completion(&mcspi_dma->dma_tx_completion);
dma_unmap_single(mcspi->dev, xfer->tx_dma, count,
DMA_TO_DEVICE);

/* for TX_ONLY mode, be sure all words have shifted out */
if (rx == NULL) {
if (mcspi_wait_for_reg_bit(chstat_reg,
OMAP2_MCSPI_CHSTAT_TXS) < 0)
dev_err(&spi->dev, "TXS timed out\n");
else if (mcspi_wait_for_reg_bit(chstat_reg,
OMAP2_MCSPI_CHSTAT_EOT) < 0)
dev_err(&spi->dev, "EOT timed out\n");
}
}

static unsigned
Expand Down Expand Up @@ -475,7 +492,6 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)
struct dma_slave_config cfg;
enum dma_slave_buswidth width;
unsigned es;
void __iomem *chstat_reg;

mcspi = spi_master_get_devdata(spi->master);
mcspi_dma = &mcspi->dma_channels[spi->chip_select];
Expand Down Expand Up @@ -510,24 +526,8 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)
omap2_mcspi_tx_dma(spi, xfer, cfg);

if (rx != NULL)
count = omap2_mcspi_rx_dma(spi, xfer, cfg, es);

if (tx != NULL) {
chstat_reg = cs->base + OMAP2_MCSPI_CHSTAT0;
wait_for_completion(&mcspi_dma->dma_tx_completion);
dma_unmap_single(mcspi->dev, xfer->tx_dma, xfer->len,
DMA_TO_DEVICE);

/* for TX_ONLY mode, be sure all words have shifted out */
if (rx == NULL) {
if (mcspi_wait_for_reg_bit(chstat_reg,
OMAP2_MCSPI_CHSTAT_TXS) < 0)
dev_err(&spi->dev, "TXS timed out\n");
else if (mcspi_wait_for_reg_bit(chstat_reg,
OMAP2_MCSPI_CHSTAT_EOT) < 0)
dev_err(&spi->dev, "EOT timed out\n");
}
}
return omap2_mcspi_rx_dma(spi, xfer, cfg, es);

return count;
}

Expand Down Expand Up @@ -765,15 +765,8 @@ 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.
*/
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;
}
l &= ~(OMAP2_MCSPI_CHCONF_IS|OMAP2_MCSPI_CHCONF_DPE1);
l |= OMAP2_MCSPI_CHCONF_DPE0;

/* wordlength */
l &= ~OMAP2_MCSPI_CHCONF_WL_MASK;
Expand Down Expand Up @@ -1174,11 +1167,6 @@ 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 @@ -1187,17 +1175,19 @@ 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: 16 additions & 36 deletions trunk/drivers/spi/spi-pl022.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ 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 @@ -2117,11 +2116,6 @@ 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 @@ -2252,9 +2246,10 @@ 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 @@ -2308,47 +2303,35 @@ 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, bool runtime)
static void pl022_suspend_resources(struct pl022 *pl022)
{
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(pins_state)) {
ret = pinctrl_select_state(pl022->pinctrl, pins_state);
if (!IS_ERR(pl022->pins_sleep)) {
ret = pinctrl_select_state(pl022->pinctrl,
pl022->pins_sleep);
if (ret)
dev_err(&pl022->adev->dev, "could not set %s pins\n",
runtime ? "idle" : "sleep");
dev_err(&pl022->adev->dev,
"could not set pins to sleep state\n");
}
}

static void pl022_resume_resources(struct pl022 *pl022, bool runtime)
static void pl022_resume_resources(struct pl022 *pl022)
{
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 @@ -2364,9 +2347,7 @@ static int pl022_suspend(struct device *dev)
dev_warn(dev, "cannot suspend master\n");
return ret;
}

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

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

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

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

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

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

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

0 comments on commit c40b6e2

Please sign in to comment.