Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 343620
b: refs/heads/master
c: 0df3499
h: refs/heads/master
v: v3
  • Loading branch information
Ulf Hansson authored and Mark Brown committed Oct 17, 2012
1 parent 776a1e6 commit c013887
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 88 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: ef5347c63f9d19c4185fe06d73ffb8f4d55606bf
refs/heads/master: 0df349945752bf04cee52babf266bbf1f4812193
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
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
3 changes: 1 addition & 2 deletions trunk/drivers/spi/spi-mxs.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ static int mxs_spi_txrx_dma(struct mxs_spi *spi, int cs,
if (!ret) {
dev_err(ssp->dev, "DMA transfer timeout\n");
ret = -ETIMEDOUT;
dmaengine_terminate_all(ssp->dmach);
goto err_vmalloc;
}

Expand Down Expand Up @@ -481,7 +480,7 @@ static int mxs_spi_transfer_one(struct spi_master *master,
first = last = 0;
}

m->status = status;
m->status = 0;
spi_finalize_current_message(master);

return status;
Expand Down
25 changes: 7 additions & 18 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 @@ -766,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 @@ -1175,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 @@ -1188,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
6 changes: 2 additions & 4 deletions trunk/drivers/spi/spi-pl022.c
Original file line number Diff line number Diff line change
Expand Up @@ -2186,7 +2186,6 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id)
printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n",
adev->res.start, pl022->virtbase);

pm_runtime_enable(dev);
pm_runtime_resume(dev);

pl022->clk = devm_clk_get(&adev->dev, NULL);
Expand Down Expand Up @@ -2249,10 +2248,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
56 changes: 22 additions & 34 deletions trunk/drivers/spi/spi-rspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ struct rspi_data {
unsigned char spsr;

/* for dmaengine */
struct sh_dmae_slave dma_tx;
struct sh_dmae_slave dma_rx;
struct dma_chan *chan_tx;
struct dma_chan *chan_rx;
int irq;
Expand Down Expand Up @@ -661,52 +663,42 @@ static irqreturn_t rspi_irq(int irq, void *_sr)
return ret;
}

static int __devinit rspi_request_dma(struct rspi_data *rspi,
struct platform_device *pdev)
static bool rspi_filter(struct dma_chan *chan, void *filter_param)
{
chan->private = filter_param;
return true;
}

static void __devinit rspi_request_dma(struct rspi_data *rspi,
struct platform_device *pdev)
{
struct rspi_plat_data *rspi_pd = pdev->dev.platform_data;
dma_cap_mask_t mask;
struct dma_slave_config cfg;
int ret;

if (!rspi_pd)
return 0; /* The driver assumes no error. */
return;

rspi->dma_width_16bit = rspi_pd->dma_width_16bit;

/* If the module receives data by DMAC, it also needs TX DMAC */
if (rspi_pd->dma_rx_id && rspi_pd->dma_tx_id) {
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
rspi->chan_rx = dma_request_channel(mask, shdma_chan_filter,
(void *)rspi_pd->dma_rx_id);
if (rspi->chan_rx) {
cfg.slave_id = rspi_pd->dma_rx_id;
cfg.direction = DMA_DEV_TO_MEM;
ret = dmaengine_slave_config(rspi->chan_rx, &cfg);
if (!ret)
dev_info(&pdev->dev, "Use DMA when rx.\n");
else
return ret;
}
rspi->dma_rx.slave_id = rspi_pd->dma_rx_id;
rspi->chan_rx = dma_request_channel(mask, rspi_filter,
&rspi->dma_rx);
if (rspi->chan_rx)
dev_info(&pdev->dev, "Use DMA when rx.\n");
}
if (rspi_pd->dma_tx_id) {
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
rspi->chan_tx = dma_request_channel(mask, shdma_chan_filter,
(void *)rspi_pd->dma_tx_id);
if (rspi->chan_tx) {
cfg.slave_id = rspi_pd->dma_tx_id;
cfg.direction = DMA_MEM_TO_DEV;
ret = dmaengine_slave_config(rspi->chan_tx, &cfg);
if (!ret)
dev_info(&pdev->dev, "Use DMA when tx\n");
else
return ret;
}
rspi->dma_tx.slave_id = rspi_pd->dma_tx_id;
rspi->chan_tx = dma_request_channel(mask, rspi_filter,
&rspi->dma_tx);
if (rspi->chan_tx)
dev_info(&pdev->dev, "Use DMA when tx\n");
}

return 0;
}

static void __devexit rspi_release_dma(struct rspi_data *rspi)
Expand Down Expand Up @@ -796,11 +788,7 @@ static int __devinit rspi_probe(struct platform_device *pdev)
}

rspi->irq = irq;
ret = rspi_request_dma(rspi, pdev);
if (ret < 0) {
dev_err(&pdev->dev, "rspi_request_dma failed.\n");
goto error4;
}
rspi_request_dma(rspi, pdev);

ret = spi_register_master(master);
if (ret < 0) {
Expand Down
32 changes: 16 additions & 16 deletions trunk/drivers/spi/spi-s3c64xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)

/* Disable Clock */
if (sdd->port_conf->clk_from_cmu) {
clk_disable_unprepare(sdd->src_clk);
clk_disable(sdd->src_clk);
} else {
val = readl(regs + S3C64XX_SPI_CLK_CFG);
val &= ~S3C64XX_SPI_ENCLK_ENABLE;
Expand Down Expand Up @@ -564,7 +564,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
/* There is half-multiplier before the SPI */
clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);
/* Enable Clock */
clk_prepare_enable(sdd->src_clk);
clk_enable(sdd->src_clk);
} else {
/* Configure Clock */
val = readl(regs + S3C64XX_SPI_CLK_CFG);
Expand Down Expand Up @@ -1302,7 +1302,7 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
goto err3;
}

if (clk_prepare_enable(sdd->clk)) {
if (clk_enable(sdd->clk)) {
dev_err(&pdev->dev, "Couldn't enable clock 'spi'\n");
ret = -EBUSY;
goto err4;
Expand All @@ -1317,7 +1317,7 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
goto err5;
}

if (clk_prepare_enable(sdd->src_clk)) {
if (clk_enable(sdd->src_clk)) {
dev_err(&pdev->dev, "Couldn't enable clock '%s'\n", clk_name);
ret = -EBUSY;
goto err6;
Expand Down Expand Up @@ -1361,11 +1361,11 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
err8:
free_irq(irq, sdd);
err7:
clk_disable_unprepare(sdd->src_clk);
clk_disable(sdd->src_clk);
err6:
clk_put(sdd->src_clk);
err5:
clk_disable_unprepare(sdd->clk);
clk_disable(sdd->clk);
err4:
clk_put(sdd->clk);
err3:
Expand Down Expand Up @@ -1393,10 +1393,10 @@ static int s3c64xx_spi_remove(struct platform_device *pdev)

free_irq(platform_get_irq(pdev, 0), sdd);

clk_disable_unprepare(sdd->src_clk);
clk_disable(sdd->src_clk);
clk_put(sdd->src_clk);

clk_disable_unprepare(sdd->clk);
clk_disable(sdd->clk);
clk_put(sdd->clk);

if (!sdd->cntrlr_info->cfg_gpio && pdev->dev.of_node)
Expand All @@ -1417,8 +1417,8 @@ static int s3c64xx_spi_suspend(struct device *dev)
spi_master_suspend(master);

/* Disable the clock */
clk_disable_unprepare(sdd->src_clk);
clk_disable_unprepare(sdd->clk);
clk_disable(sdd->src_clk);
clk_disable(sdd->clk);

if (!sdd->cntrlr_info->cfg_gpio && dev->of_node)
s3c64xx_spi_dt_gpio_free(sdd);
Expand All @@ -1440,8 +1440,8 @@ static int s3c64xx_spi_resume(struct device *dev)
sci->cfg_gpio();

/* Enable the clock */
clk_prepare_enable(sdd->src_clk);
clk_prepare_enable(sdd->clk);
clk_enable(sdd->src_clk);
clk_enable(sdd->clk);

s3c64xx_spi_hwinit(sdd, sdd->port_id);

Expand All @@ -1457,8 +1457,8 @@ static int s3c64xx_spi_runtime_suspend(struct device *dev)
struct spi_master *master = dev_get_drvdata(dev);
struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);

clk_disable_unprepare(sdd->clk);
clk_disable_unprepare(sdd->src_clk);
clk_disable(sdd->clk);
clk_disable(sdd->src_clk);

return 0;
}
Expand All @@ -1468,8 +1468,8 @@ static int s3c64xx_spi_runtime_resume(struct device *dev)
struct spi_master *master = dev_get_drvdata(dev);
struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);

clk_prepare_enable(sdd->src_clk);
clk_prepare_enable(sdd->clk);
clk_enable(sdd->src_clk);
clk_enable(sdd->clk);

return 0;
}
Expand Down
4 changes: 0 additions & 4 deletions trunk/include/linux/platform_data/spi-omap2-mcspi.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@

#define OMAP4_MCSPI_REG_OFFSET 0x100

#define MCSPI_PINDIR_D0_OUT_D1_IN 0
#define MCSPI_PINDIR_D0_IN_D1_OUT 1

struct omap2_mcspi_platform_config {
unsigned short num_cs;
unsigned int regs_offset;
unsigned int pin_dir:1;
};

struct omap2_mcspi_dev_attr {
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/spi/tsc2005.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
* Copyright (C) 2009-2010 Nokia Corporation
*
* Contact: Aaro Koskinen <aaro.koskinen@nokia.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
Expand Down

0 comments on commit c013887

Please sign in to comment.