Skip to content

Commit

Permalink
Merge tag 'spi-v3.14-rc5' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/git/broonie/spi

Pull spi fixes from Mark Brown:
 "A scattering of driver specific fixes here.

  The fixes from Axel cover bitrot in apparently unmaintained drivers,
  the at79 bug is fixing a glitch on /CS during initialisation of some
  devices which could break some slaves and the remainder are fixes for
  recently introduced bugs from the past release cycle or so"

* tag 'spi-v3.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: atmel: add missing spi_master_{resume,suspend} calls to PM callbacks
  spi: coldfire-qspi: Fix getting correct address for *mcfqspi
  spi: fsl-dspi: Fix getting correct address for master
  spi: spi-ath79: fix initial GPIO CS line setup
  spi: spi-imx: spi_imx_remove: do not disable disabled clocks
  spi-topcliff-pch: Fix probing when DMA mode is used
  spi/topcliff-pch: Fix DMA channel
  • Loading branch information
torvalds committed Mar 9, 2014
2 parents 66a523d + d930acf commit 4aa41ba
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 17 deletions.
4 changes: 2 additions & 2 deletions drivers/spi/spi-ath79.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ static int ath79_spi_setup_cs(struct spi_device *spi)

flags = GPIOF_DIR_OUT;
if (spi->mode & SPI_CS_HIGH)
flags |= GPIOF_INIT_HIGH;
else
flags |= GPIOF_INIT_LOW;
else
flags |= GPIOF_INIT_HIGH;

status = gpio_request_one(cdata->gpio, flags,
dev_name(&spi->dev));
Expand Down
17 changes: 16 additions & 1 deletion drivers/spi/spi-atmel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1455,6 +1455,14 @@ static int atmel_spi_suspend(struct device *dev)
{
struct spi_master *master = dev_get_drvdata(dev);
struct atmel_spi *as = spi_master_get_devdata(master);
int ret;

/* Stop the queue running */
ret = spi_master_suspend(master);
if (ret) {
dev_warn(dev, "cannot suspend master\n");
return ret;
}

clk_disable_unprepare(as->clk);
return 0;
Expand All @@ -1464,9 +1472,16 @@ static int atmel_spi_resume(struct device *dev)
{
struct spi_master *master = dev_get_drvdata(dev);
struct atmel_spi *as = spi_master_get_devdata(master);
int ret;

clk_prepare_enable(as->clk);
return 0;

/* Start the queue running */
ret = spi_master_resume(master);
if (ret)
dev_err(dev, "problem starting queue (%d)\n", ret);

return ret;
}

static SIMPLE_DEV_PM_OPS(atmel_spi_pm_ops, atmel_spi_suspend, atmel_spi_resume);
Expand Down
6 changes: 4 additions & 2 deletions drivers/spi/spi-coldfire-qspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,8 @@ static int mcfqspi_resume(struct device *dev)
#ifdef CONFIG_PM_RUNTIME
static int mcfqspi_runtime_suspend(struct device *dev)
{
struct mcfqspi *mcfqspi = dev_get_drvdata(dev);
struct spi_master *master = dev_get_drvdata(dev);
struct mcfqspi *mcfqspi = spi_master_get_devdata(master);

clk_disable(mcfqspi->clk);

Expand All @@ -523,7 +524,8 @@ static int mcfqspi_runtime_suspend(struct device *dev)

static int mcfqspi_runtime_resume(struct device *dev)
{
struct mcfqspi *mcfqspi = dev_get_drvdata(dev);
struct spi_master *master = dev_get_drvdata(dev);
struct mcfqspi *mcfqspi = spi_master_get_devdata(master);

clk_enable(mcfqspi->clk);

Expand Down
6 changes: 3 additions & 3 deletions drivers/spi/spi-fsl-dspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@ static int dspi_suspend(struct device *dev)

static int dspi_resume(struct device *dev)
{

struct spi_master *master = dev_get_drvdata(dev);
struct fsl_dspi *dspi = spi_master_get_devdata(master);

Expand Down Expand Up @@ -504,7 +503,7 @@ static int dspi_probe(struct platform_device *pdev)
clk_prepare_enable(dspi->clk);

init_waitqueue_head(&dspi->waitq);
platform_set_drvdata(pdev, dspi);
platform_set_drvdata(pdev, master);

ret = spi_bitbang_start(&dspi->bitbang);
if (ret != 0) {
Expand All @@ -525,7 +524,8 @@ static int dspi_probe(struct platform_device *pdev)

static int dspi_remove(struct platform_device *pdev)
{
struct fsl_dspi *dspi = platform_get_drvdata(pdev);
struct spi_master *master = platform_get_drvdata(pdev);
struct fsl_dspi *dspi = spi_master_get_devdata(master);

/* Disconnect from the SPI framework */
spi_bitbang_stop(&dspi->bitbang);
Expand Down
4 changes: 2 additions & 2 deletions drivers/spi/spi-imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,8 +948,8 @@ static int spi_imx_remove(struct platform_device *pdev)
spi_bitbang_stop(&spi_imx->bitbang);

writel(0, spi_imx->base + MXC_CSPICTRL);
clk_disable_unprepare(spi_imx->clk_ipg);
clk_disable_unprepare(spi_imx->clk_per);
clk_unprepare(spi_imx->clk_ipg);
clk_unprepare(spi_imx->clk_per);
spi_master_put(master);

return 0;
Expand Down
15 changes: 8 additions & 7 deletions drivers/spi/spi-topcliff-pch.c
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ static void pch_spi_request_dma(struct pch_spi_data *data, int bpw)
/* Set Tx DMA */
param = &dma->param_tx;
param->dma_dev = &dma_dev->dev;
param->chan_id = data->master->bus_num * 2; /* Tx = 0, 2 */
param->chan_id = data->ch * 2; /* Tx = 0, 2 */;
param->tx_reg = data->io_base_addr + PCH_SPDWR;
param->width = width;
chan = dma_request_channel(mask, pch_spi_filter, param);
Expand All @@ -930,7 +930,7 @@ static void pch_spi_request_dma(struct pch_spi_data *data, int bpw)
/* Set Rx DMA */
param = &dma->param_rx;
param->dma_dev = &dma_dev->dev;
param->chan_id = data->master->bus_num * 2 + 1; /* Rx = Tx + 1 */
param->chan_id = data->ch * 2 + 1; /* Rx = Tx + 1 */;
param->rx_reg = data->io_base_addr + PCH_SPDRR;
param->width = width;
chan = dma_request_channel(mask, pch_spi_filter, param);
Expand Down Expand Up @@ -1452,21 +1452,22 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev)

pch_spi_set_master_mode(master);

if (use_dma) {
dev_info(&plat_dev->dev, "Use DMA for data transfers\n");
pch_alloc_dma_buf(board_dat, data);
}

ret = spi_register_master(master);
if (ret != 0) {
dev_err(&plat_dev->dev,
"%s spi_register_master FAILED\n", __func__);
goto err_spi_register_master;
}

if (use_dma) {
dev_info(&plat_dev->dev, "Use DMA for data transfers\n");
pch_alloc_dma_buf(board_dat, data);
}

return 0;

err_spi_register_master:
pch_free_dma_buf(board_dat, data);
free_irq(board_dat->pdev->irq, data);
err_request_irq:
pch_spi_free_resources(board_dat, data);
Expand Down

0 comments on commit 4aa41ba

Please sign in to comment.