Skip to content

Commit

Permalink
Merge tag 'spi-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/…
Browse files Browse the repository at this point in the history
…broonie/misc

Pull spi updates from Mark Brown:
 "Since Grant is even more specacularly busy than usual for the time
  being I've been collecting SPI patches for him for this release -
  probably things will revert back to Grant before the next release.

  There's nothing too exciting here, mostly it's simple driver specific
  stuff:

   - Add spi: to the modaliases of SPI devices to provide namespacing.
   - A driver for AD-FMCOMMS1-EBZ.
   - DT binding for Orion.
   - Fixes and cleanups for i.MX, PL0022, OMAP and bitbang drivers.

   There may be a few more fixes I've missed, people keep sending me new
   things."

* tag 'spi-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc:
  spi/orion: remove uneeded spi_info
  spi/bcm63xx: fix clock configuration selection
  spi/orion: add device tree binding
  spi/omap2: mark omap2_mcspi_master_setup as __devinit
  spi: omap2-mcspi: Fix the below warning
  spi: Add AD-FMCOMMS1-EBZ I2C-SPI bridge driver
  spi/imx: use gpio_is_valid to determine if a gpio is valid
  spi/imx: remove redundant config.speed_hz setting
  spi/gpio: start with CS non-active
  spi: tegra: use dmaengine based dma driver
  spi/pl022: cleanup pl022 header documentation
  spi/pl022: enable runtime PM
  spi/pl022: delete DB5500 support
  spi/pl022: disable port when unused
  spi: Add "spi:" prefix to modalias attribute of spi devices
  • Loading branch information
torvalds committed Jul 26, 2012
2 parents 1f03bf0 + 8ceffa7 commit 0082c16
Show file tree
Hide file tree
Showing 13 changed files with 430 additions and 47 deletions.
19 changes: 19 additions & 0 deletions Documentation/devicetree/bindings/spi/spi-orion.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Marvell Orion SPI device

Required properties:
- compatible : should be "marvell,orion-spi".
- reg : offset and length of the register set for the device
- cell-index : Which of multiple SPI controllers is this.
Optional properties:
- interrupts : Is currently not used.

Example:
spi@10600 {
compatible = "marvell,orion-spi";
#address-cells = <1>;
#size-cells = <0>;
cell-index = <0>;
reg = <0x10600 0x28>;
interrupts = <23>;
status = "disabled";
};
9 changes: 8 additions & 1 deletion drivers/spi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ config SPI_STMP3XXX

config SPI_TEGRA
tristate "Nvidia Tegra SPI controller"
depends on ARCH_TEGRA && TEGRA_SYSTEM_DMA
depends on ARCH_TEGRA && (TEGRA_SYSTEM_DMA || TEGRA20_APB_DMA)
help
SPI driver for NVidia Tegra SoCs

Expand All @@ -384,6 +384,13 @@ config SPI_TXX9
help
SPI driver for Toshiba TXx9 MIPS SoCs

config SPI_XCOMM
tristate "Analog Devices AD-FMCOMMS1-EBZ SPI-I2C-bridge driver"
depends on I2C
help
Support for the SPI-I2C bridge found on the Analog Devices
AD-FMCOMMS1-EBZ board.

config SPI_XILINX
tristate "Xilinx SPI controller common module"
depends on HAS_IOMEM && EXPERIMENTAL
Expand Down
1 change: 1 addition & 0 deletions drivers/spi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,6 @@ 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

2 changes: 1 addition & 1 deletion drivers/spi/spi-bcm63xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static void bcm63xx_spi_setup_transfer(struct spi_device *spi,

/* Find the closest clock configuration */
for (i = 0; i < SPI_CLK_MASK; i++) {
if (hz <= bcm63xx_spi_freq_table[i][0]) {
if (hz >= bcm63xx_spi_freq_table[i][0]) {
clk_cfg = bcm63xx_spi_freq_table[i][1];
break;
}
Expand Down
3 changes: 2 additions & 1 deletion drivers/spi/spi-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ static int spi_gpio_setup(struct spi_device *spi)
status = gpio_request(cs, dev_name(&spi->dev));
if (status)
return status;
status = gpio_direction_output(cs, spi->mode & SPI_CS_HIGH);
status = gpio_direction_output(cs,
!(spi->mode & SPI_CS_HIGH));
}
}
if (!status)
Expand Down
14 changes: 6 additions & 8 deletions drivers/spi/spi-imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ static void spi_imx_chipselect(struct spi_device *spi, int is_active)
int active = is_active != BITBANG_CS_INACTIVE;
int dev_is_lowactive = !(spi->mode & SPI_CS_HIGH);

if (gpio < 0)
if (!gpio_is_valid(gpio))
return;

gpio_set_value(gpio, dev_is_lowactive ^ active);
Expand Down Expand Up @@ -688,8 +688,6 @@ static int spi_imx_setupxfer(struct spi_device *spi,
config.speed_hz = spi->max_speed_hz;
if (!config.bpw)
config.bpw = spi->bits_per_word;
if (!config.speed_hz)
config.speed_hz = spi->max_speed_hz;

/* Initialize the functions for transfer */
if (config.bpw <= 8) {
Expand Down Expand Up @@ -738,7 +736,7 @@ static int spi_imx_setup(struct spi_device *spi)
dev_dbg(&spi->dev, "%s: mode %d, %u bpw, %d hz\n", __func__,
spi->mode, spi->bits_per_word, spi->max_speed_hz);

if (gpio >= 0)
if (gpio_is_valid(gpio))
gpio_direction_output(gpio, spi->mode & SPI_CS_HIGH ? 0 : 1);

spi_imx_chipselect(spi, BITBANG_CS_INACTIVE);
Expand Down Expand Up @@ -791,11 +789,11 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)

for (i = 0; i < master->num_chipselect; i++) {
int cs_gpio = of_get_named_gpio(np, "cs-gpios", i);
if (cs_gpio < 0 && mxc_platform_info)
if (!gpio_is_valid(cs_gpio) && mxc_platform_info)
cs_gpio = mxc_platform_info->chipselect[i];

spi_imx->chipselect[i] = cs_gpio;
if (cs_gpio < 0)
if (!gpio_is_valid(cs_gpio))
continue;

ret = gpio_request(spi_imx->chipselect[i], DRIVER_NAME);
Expand Down Expand Up @@ -897,7 +895,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
release_mem_region(res->start, resource_size(res));
out_gpio_free:
while (--i >= 0) {
if (spi_imx->chipselect[i] >= 0)
if (gpio_is_valid(spi_imx->chipselect[i]))
gpio_free(spi_imx->chipselect[i]);
}
spi_master_put(master);
Expand All @@ -922,7 +920,7 @@ static int __devexit spi_imx_remove(struct platform_device *pdev)
iounmap(spi_imx->base);

for (i = 0; i < master->num_chipselect; i++)
if (spi_imx->chipselect[i] >= 0)
if (gpio_is_valid(spi_imx->chipselect[i]))
gpio_free(spi_imx->chipselect[i]);

spi_master_put(master);
Expand Down
8 changes: 5 additions & 3 deletions drivers/spi/spi-omap2-mcspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,8 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)

if (tx != NULL) {
wait_for_completion(&mcspi_dma->dma_tx_completion);
dma_unmap_single(&spi->dev, xfer->tx_dma, count, DMA_TO_DEVICE);
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) {
Expand All @@ -403,7 +404,8 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)

if (rx != NULL) {
wait_for_completion(&mcspi_dma->dma_rx_completion);
dma_unmap_single(&spi->dev, xfer->rx_dma, count, DMA_FROM_DEVICE);
dma_unmap_single(mcspi->dev, xfer->rx_dma, count,
DMA_FROM_DEVICE);
omap2_mcspi_set_enable(spi, 0);

if (l & OMAP2_MCSPI_CHCONF_TURBO) {
Expand Down Expand Up @@ -1032,7 +1034,7 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master,
return 0;
}

static int __init omap2_mcspi_master_setup(struct omap2_mcspi *mcspi)
static int __devinit omap2_mcspi_master_setup(struct omap2_mcspi *mcspi)
{
struct spi_master *master = mcspi->master;
struct omap2_mcspi_regs *ctx = &mcspi->ctx;
Expand Down
22 changes: 17 additions & 5 deletions drivers/spi/spi-orion.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/io.h>
#include <linux/spi/spi.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/clk.h>
#include <asm/unaligned.h>

Expand Down Expand Up @@ -45,7 +46,6 @@ struct orion_spi {
void __iomem *base;
unsigned int max_speed;
unsigned int min_speed;
struct orion_spi_info *spi_info;
struct clk *clk;
};

Expand Down Expand Up @@ -450,11 +450,10 @@ static int __init orion_spi_probe(struct platform_device *pdev)
struct spi_master *master;
struct orion_spi *spi;
struct resource *r;
struct orion_spi_info *spi_info;
unsigned long tclk_hz;
int status = 0;

spi_info = pdev->dev.platform_data;
const u32 *iprop;
int size;

master = spi_alloc_master(&pdev->dev, sizeof *spi);
if (master == NULL) {
Expand All @@ -464,6 +463,12 @@ static int __init orion_spi_probe(struct platform_device *pdev)

if (pdev->id != -1)
master->bus_num = pdev->id;
if (pdev->dev.of_node) {
iprop = of_get_property(pdev->dev.of_node, "cell-index",
&size);
if (iprop && size == sizeof(*iprop))
master->bus_num = *iprop;
}

/* we support only mode 0, and no options */
master->mode_bits = 0;
Expand All @@ -476,7 +481,6 @@ static int __init orion_spi_probe(struct platform_device *pdev)

spi = spi_master_get_devdata(master);
spi->master = master;
spi->spi_info = spi_info;

spi->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(spi->clk)) {
Expand Down Expand Up @@ -511,6 +515,7 @@ static int __init orion_spi_probe(struct platform_device *pdev)
if (orion_spi_reset(spi) < 0)
goto out_rel_mem;

master->dev.of_node = pdev->dev.of_node;
status = spi_register_master(master);
if (status < 0)
goto out_rel_mem;
Expand Down Expand Up @@ -552,10 +557,17 @@ static int __exit orion_spi_remove(struct platform_device *pdev)

MODULE_ALIAS("platform:" DRIVER_NAME);

static const struct of_device_id orion_spi_of_match_table[] __devinitdata = {
{ .compatible = "marvell,orion-spi", },
{}
};
MODULE_DEVICE_TABLE(of, orion_spi_of_match_table);

static struct platform_driver orion_spi_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(orion_spi_of_match_table),
},
.remove = __exit_p(orion_spi_remove),
};
Expand Down
23 changes: 9 additions & 14 deletions drivers/spi/spi-pl022.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,11 @@ static void giveback(struct pl022 *pl022)
pl022->cur_transfer = NULL;
pl022->cur_chip = NULL;
spi_finalize_current_message(pl022->master);

/* disable the SPI/SSP operation */
writew((readw(SSP_CR1(pl022->virtbase)) &
(~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase));

}

/**
Expand Down Expand Up @@ -2048,6 +2053,9 @@ 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 = clk_get(&adev->dev, NULL);
if (IS_ERR(pl022->clk)) {
status = PTR_ERR(pl022->clk);
Expand Down Expand Up @@ -2158,6 +2166,7 @@ pl022_remove(struct amba_device *adev)
clk_disable(pl022->clk);
clk_unprepare(pl022->clk);
clk_put(pl022->clk);
pm_runtime_disable(&adev->dev);
iounmap(pl022->virtbase);
amba_release_regions(adev);
tasklet_disable(&pl022->pump_transfers);
Expand Down Expand Up @@ -2251,15 +2260,6 @@ static struct vendor_data vendor_st_pl023 = {
.loopback = false,
};

static struct vendor_data vendor_db5500_pl023 = {
.fifodepth = 32,
.max_bpw = 32,
.unidir = false,
.extended_cr = true,
.pl023 = true,
.loopback = true,
};

static struct amba_id pl022_ids[] = {
{
/*
Expand Down Expand Up @@ -2291,11 +2291,6 @@ static struct amba_id pl022_ids[] = {
.mask = 0xffffffff,
.data = &vendor_st_pl023,
},
{
.id = 0x10080023,
.mask = 0xffffffff,
.data = &vendor_db5500_pl023,
},
{ 0, 0 },
};

Expand Down
Loading

0 comments on commit 0082c16

Please sign in to comment.