Skip to content

Commit

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

Pull spi updates from Mark Brown:
 "A quiet release, more bug fixes than anything else.  A few things do
  stand out though:

   - updates to several drivers to move towards the standard GPIO chip
     select handling in the core.
   - DMA support for the SH MSIOF driver.
   - support for Rockchip SPI controllers (their first mainline
     submission)"

* tag 'spi-v3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (64 commits)
  spi: davinci: use spi_device.cs_gpio to store gpio cs per spi device
  spi: davinci: add support to configure gpio cs through dt
  spi/pl022: Explicitly truncate large bitmask
  spi/atmel: Fix pointer to int conversion warnings on 64 bit builds
  spi: davinci: fix to support more than 2 chip selects
  spi: topcliff-pch: don't hardcode PCI slot to get DMA device
  spi: orion: fix incorrect handling of cell-index DT property
  spi: orion: Fix error return code in orion_spi_probe()
  spi/rockchip: fix error return code in rockchip_spi_probe()
  spi/rockchip: remove redundant dev_err call in rockchip_spi_probe()
  spi/rockchip: remove duplicated include from spi-rockchip.c
  ARM: dts: fix the chip select gpios definition in the SPI nodes
  spi: s3c64xx: Update binding documentation
  spi: s3c64xx: use the generic SPI "cs-gpios" property
  spi: s3c64xx: Revert "spi: s3c64xx: Added provision for dedicated cs pin"
  spi: atmel: Use dmaengine_prep_slave_sg() API
  spi: topcliff-pch: Update error messages for dmaengine_prep_slave_sg() API
  spi: sh-msiof: Use correct device for DMA mapping with IOMMU
  spi: sh-msiof: Handle dmaengine_prep_slave_single() failures gracefully
  spi: rspi: Handle dmaengine_prep_slave_sg() failures gracefully
  ...
  • Loading branch information
Linus Torvalds committed Aug 5, 2014
2 parents dc7aafb + fab6a04 commit 1325b65
Show file tree
Hide file tree
Showing 38 changed files with 1,725 additions and 245 deletions.
13 changes: 7 additions & 6 deletions Documentation/devicetree/bindings/spi/efm32-spi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ Required properties:
- cs-gpios: see spi-bus.txt

Recommended properties :
- efm32,location: Value to write to the ROUTE register's LOCATION bitfield to
configure the pinmux for the device, see datasheet for values.
If "efm32,location" property is not provided, keeping what is
already configured in the hardware, so its either the reset
default 0 or whatever the bootloader did.
- energymicro,location: Value to write to the ROUTE register's LOCATION
bitfield to configure the pinmux for the device, see
datasheet for values.
If this property is not provided, keeping what is
already configured in the hardware, so its either the
reset default 0 or whatever the bootloader did.

Example:

Expand All @@ -26,7 +27,7 @@ spi1: spi@0x4000c400 { /* USART1 */
interrupts = <15 16>;
clocks = <&cmu 20>;
cs-gpios = <&gpio 51 1>; // D3
efm32,location = <1>;
energymicro,location = <1>;
status = "ok";

ks8851@0 {
Expand Down
6 changes: 5 additions & 1 deletion Documentation/devicetree/bindings/spi/qcom,spi-qup.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ SPI in master mode supports up to 50MHz, up to four chip selects, programmable
data path from 4 bits to 32 bits and numerous protocol variants.

Required properties:
- compatible: Should contain "qcom,spi-qup-v2.1.1" or "qcom,spi-qup-v2.2.1"
- compatible: Should contain:
"qcom,spi-qup-v1.1.1" for 8660, 8960 and 8064.
"qcom,spi-qup-v2.1.1" for 8974 and later
"qcom,spi-qup-v2.2.1" for 8974 v2 and later.

- reg: Should contain base register location and length
- interrupts: Interrupt number used by this controller

Expand Down
28 changes: 28 additions & 0 deletions Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Synopsys DesignWare AMBA 2.0 Synchronous Serial Interface.

Required properties:
- compatible : "snps,dw-apb-ssi"
- reg : The register base for the controller.
- interrupts : One interrupt, used by the controller.
- #address-cells : <1>, as required by generic SPI binding.
- #size-cells : <0>, also as required by generic SPI binding.

Optional properties:
- cs-gpios : Specifies the gpio pis to be used for chipselects.
- num-cs : The number of chipselects. If omitted, this will default to 4.

Child nodes as per the generic SPI binding.

Example:

spi@fff00000 {
compatible = "snps,dw-apb-ssi";
reg = <0xfff00000 0x1000>;
interrupts = <0 154 4>;
#address-cells = <1>;
#size-cells = <0>;
num-cs = <2>;
cs-gpios = <&gpio0 13 0>,
<&gpio0 14 0>;
};

9 changes: 8 additions & 1 deletion Documentation/devicetree/bindings/spi/spi-davinci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Required properties:
- "ti,dm6441-spi" for SPI used similar to that on DM644x SoC family
- "ti,da830-spi" for SPI used similar to that on DA8xx SoC family
- reg: Offset and length of SPI controller register space
- num-cs: Number of chip selects
- num-cs: Number of chip selects. This includes internal as well as
GPIO chip selects.
- ti,davinci-spi-intr-line: interrupt line used to connect the SPI
IP to the interrupt controller within the SoC. Possible values
are 0 and 1. Manual says one of the two possible interrupt
Expand All @@ -17,6 +18,12 @@ Required properties:
- interrupts: interrupt number mapped to CPU.
- clocks: spi clk phandle

Optional:
- cs-gpios: gpio chip selects
For example to have 3 internal CS and 2 GPIO CS, user could define
cs-gpios = <0>, <0>, <0>, <&gpio1 30 0>, <&gpio1 31 0>;
where first three are internal CS and last two are GPIO CS.

Example of a NOR flash slave device (n25q032) connected to DaVinci
SPI controller device over the SPI bus.

Expand Down
37 changes: 37 additions & 0 deletions Documentation/devicetree/bindings/spi/spi-rockchip.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
* Rockchip SPI Controller

The Rockchip SPI controller is used to interface with various devices such as flash
and display controllers using the SPI communication interface.

Required Properties:

- compatible: should be one of the following.
"rockchip,rk3066-spi" for rk3066.
"rockchip,rk3188-spi", "rockchip,rk3066-spi" for rk3188.
"rockchip,rk3288-spi", "rockchip,rk3066-spi" for rk3288.
- reg: physical base address of the controller and length of memory mapped
region.
- interrupts: The interrupt number to the cpu. The interrupt specifier format
depends on the interrupt controller.
- clocks: Must contain an entry for each entry in clock-names.
- clock-names: Shall be "spiclk" for the transfer-clock, and "apb_pclk" for
the peripheral clock.
- dmas: DMA specifiers for tx and rx dma. See the DMA client binding,
Documentation/devicetree/bindings/dma/dma.txt
- dma-names: DMA request names should include "tx" and "rx" if present.
- #address-cells: should be 1.
- #size-cells: should be 0.

Example:

spi0: spi@ff110000 {
compatible = "rockchip,rk3066-spi";
reg = <0xff110000 0x1000>;
dmas = <&pdma1 11>, <&pdma1 12>;
dma-names = "tx", "rx";
#address-cells = <1>;
#size-cells = <0>;
interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&cru SCLK_SPI0>, <&cru PCLK_SPI0>;
clock-names = "spiclk", "apb_pclk";
};
26 changes: 12 additions & 14 deletions Documentation/devicetree/bindings/spi/spi-samsung.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ Required SoC Specific Properties:
- interrupts: The interrupt number to the cpu. The interrupt specifier format
depends on the interrupt controller.

[PRELIMINARY: the dma channel allocation will change once there are
official DMA bindings]
- dmas : Two or more DMA channel specifiers following the convention outlined
in bindings/dma/dma.txt

- tx-dma-channel: The dma channel specifier for tx operations. The format of
the dma specifier depends on the dma controller.

- rx-dma-channel: The dma channel specifier for rx operations. The format of
the dma specifier depends on the dma controller.
- dma-names: Names for the dma channels. There must be at least one channel
named "tx" for transmit and named "rx" for receive.

Required Board Specific Properties:

Expand All @@ -42,15 +39,13 @@ Optional Board Specific Properties:
- num-cs: Specifies the number of chip select lines supported. If
not specified, the default number of chip select lines is set to 1.

- cs-gpios: should specify GPIOs used for chipselects (see spi-bus.txt)

SPI Controller specific data in SPI slave nodes:

- The spi slave nodes should provide the following information which is required
by the spi controller.

- cs-gpio: A gpio specifier that specifies the gpio line used as
the slave select line by the spi controller. The format of the gpio
specifier depends on the gpio controller.

- samsung,spi-feedback-delay: The sampling phase shift to be applied on the
miso line (to account for any lag in the miso line). The following are the
valid values.
Expand All @@ -74,8 +69,11 @@ Example:
compatible = "samsung,exynos4210-spi";
reg = <0x12d20000 0x100>;
interrupts = <0 66 0>;
tx-dma-channel = <&pdma0 5>;
rx-dma-channel = <&pdma0 4>;
dmas = <&pdma0 5
&pdma0 4>;
dma-names = "tx", "rx";
#address-cells = <1>;
#size-cells = <0>;
};

- Board Specific Portion:
Expand All @@ -85,6 +83,7 @@ Example:
#size-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&spi0_bus>;
cs-gpios = <&gpa2 5 0>;

w25q80bw@0 {
#address-cells = <1>;
Expand All @@ -94,7 +93,6 @@ Example:
spi-max-frequency = <10000>;

controller-data {
cs-gpio = <&gpa2 5 1 0 3>;
samsung,spi-feedback-delay = <0>;
};

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/boot/dts/exynos4210-smdkv310.dts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
};

spi_2: spi@13940000 {
cs-gpios = <&gpc1 2 0>;
status = "okay";

w25x80@0 {
Expand All @@ -178,7 +179,6 @@
spi-max-frequency = <1000000>;

controller-data {
cs-gpio = <&gpc1 2 0>;
samsung,spi-feedback-delay = <0>;
};

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/boot/dts/exynos4412-trats2.dts
Original file line number Diff line number Diff line change
Expand Up @@ -589,14 +589,14 @@
spi_1: spi@13930000 {
pinctrl-names = "default";
pinctrl-0 = <&spi1_bus>;
cs-gpios = <&gpb 5 0>;
status = "okay";

s5c73m3_spi: s5c73m3 {
compatible = "samsung,s5c73m3";
spi-max-frequency = <50000000>;
reg = <0>;
controller-data {
cs-gpio = <&gpb 5 0>;
samsung,spi-feedback-delay = <2>;
};
};
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/boot/dts/exynos5250-smdk5250.dts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@
};

spi_1: spi@12d30000 {
cs-gpios = <&gpa2 5 0>;
status = "okay";

w25q80bw@0 {
Expand All @@ -326,7 +327,6 @@
spi-max-frequency = <1000000>;

controller-data {
cs-gpio = <&gpa2 5 0>;
samsung,spi-feedback-delay = <0>;
};

Expand Down
16 changes: 14 additions & 2 deletions drivers/spi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,21 @@ config SPI_PXA2XX
config SPI_PXA2XX_PCI
def_tristate SPI_PXA2XX && PCI

config SPI_ROCKCHIP
tristate "Rockchip SPI controller driver"
depends on ARM || ARM64 || AVR32 || HEXAGON || MIPS || SUPERH
help
This selects a driver for Rockchip SPI controller.

If you say yes to this option, support will be included for
RK3066, RK3188 and RK3288 families of SPI controller.
Rockchip SPI controller support DMA transport and PIO mode.
The main usecase of this controller is to use spi flash as boot
device.

config SPI_RSPI
tristate "Renesas RSPI/QSPI controller"
depends on (SUPERH && SH_DMAE_BASE) || ARCH_SHMOBILE
depends on SUPERH || ARCH_SHMOBILE || COMPILE_TEST
help
SPI driver for Renesas RSPI and QSPI blocks.

Expand Down Expand Up @@ -434,7 +446,7 @@ config SPI_SC18IS602

config SPI_SH_MSIOF
tristate "SuperH MSIOF SPI controller"
depends on HAVE_CLK
depends on HAVE_CLK && HAS_DMA
depends on SUPERH || ARCH_SHMOBILE || COMPILE_TEST
help
SPI driver for SuperH and SH Mobile MSIOF blocks.
Expand Down
1 change: 1 addition & 0 deletions drivers/spi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ spi-pxa2xx-platform-$(CONFIG_SPI_PXA2XX_DMA) += spi-pxa2xx-dma.o
obj-$(CONFIG_SPI_PXA2XX) += spi-pxa2xx-platform.o
obj-$(CONFIG_SPI_PXA2XX_PCI) += spi-pxa2xx-pci.o
obj-$(CONFIG_SPI_QUP) += spi-qup.o
obj-$(CONFIG_SPI_ROCKCHIP) += spi-rockchip.o
obj-$(CONFIG_SPI_RSPI) += spi-rspi.o
obj-$(CONFIG_SPI_S3C24XX) += spi-s3c24xx-hw.o
spi-s3c24xx-hw-y := spi-s3c24xx.o
Expand Down
5 changes: 2 additions & 3 deletions drivers/spi/spi-adi-v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -660,10 +660,9 @@ static int adi_spi_setup(struct spi_device *spi)
struct adi_spi3_chip *chip_info = spi->controller_data;

chip = kzalloc(sizeof(*chip), GFP_KERNEL);
if (!chip) {
dev_err(&spi->dev, "can not allocate chip data\n");
if (!chip)
return -ENOMEM;
}

if (chip_info) {
if (chip_info->control & ~ctl_reg) {
dev_err(&spi->dev,
Expand Down
22 changes: 8 additions & 14 deletions drivers/spi/spi-atmel.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,21 +597,15 @@ static int atmel_spi_next_xfer_dma_submit(struct spi_master *master,
goto err_exit;

/* Send both scatterlists */
rxdesc = rxchan->device->device_prep_slave_sg(rxchan,
&as->dma.sgrx,
1,
DMA_FROM_DEVICE,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK,
NULL);
rxdesc = dmaengine_prep_slave_sg(rxchan, &as->dma.sgrx, 1,
DMA_FROM_DEVICE,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!rxdesc)
goto err_dma;

txdesc = txchan->device->device_prep_slave_sg(txchan,
&as->dma.sgtx,
1,
DMA_TO_DEVICE,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK,
NULL);
txdesc = dmaengine_prep_slave_sg(txchan, &as->dma.sgtx, 1,
DMA_TO_DEVICE,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!txdesc)
goto err_dma;

Expand Down Expand Up @@ -1018,7 +1012,7 @@ static int atmel_spi_setup(struct spi_device *spi)
csr |= SPI_BF(DLYBCT, 0);

/* chipselect must have been muxed as GPIO (e.g. in board setup) */
npcs_pin = (unsigned int)spi->controller_data;
npcs_pin = (unsigned long)spi->controller_data;

if (gpio_is_valid(spi->cs_gpio))
npcs_pin = spi->cs_gpio;
Expand Down Expand Up @@ -1253,7 +1247,7 @@ static int atmel_spi_transfer_one_message(struct spi_master *master,
static void atmel_spi_cleanup(struct spi_device *spi)
{
struct atmel_spi_device *asd = spi->controller_state;
unsigned gpio = (unsigned) spi->controller_data;
unsigned gpio = (unsigned long) spi->controller_data;

if (!asd)
return;
Expand Down
6 changes: 2 additions & 4 deletions drivers/spi/spi-au1550.c
Original file line number Diff line number Diff line change
Expand Up @@ -925,8 +925,7 @@ static int au1550_spi_probe(struct platform_device *pdev)
iounmap((void __iomem *)hw->regs);

err_ioremap:
release_resource(hw->ioarea);
kfree(hw->ioarea);
release_mem_region(r->start, sizeof(psc_spi_t));

err_no_iores:
err_no_pdata:
Expand All @@ -946,8 +945,7 @@ static int au1550_spi_remove(struct platform_device *pdev)
spi_bitbang_stop(&hw->bitbang);
free_irq(hw->irq, hw);
iounmap((void __iomem *)hw->regs);
release_resource(hw->ioarea);
kfree(hw->ioarea);
release_mem_region(r->start, sizeof(psc_spi_t));

if (hw->usedma) {
au1550_spi_dma_rxtmp_free(hw);
Expand Down
Loading

0 comments on commit 1325b65

Please sign in to comment.