Skip to content

Commit

Permalink
Merge remote-tracking branches 'spi/topic/dw', 'spi/topic/fsl', 'spi/…
Browse files Browse the repository at this point in the history
…topic/fsl-espi' and 'spi/topic/id-const' into spi-next
  • Loading branch information
Mark Brown committed Jun 2, 2014
5 parents 446fe5e + bf61fb8 + 7a40054 + a2cb1be + b2fb187 commit 8fb3b06
Show file tree
Hide file tree
Showing 15 changed files with 125 additions and 209 deletions.
6 changes: 6 additions & 0 deletions Documentation/devicetree/bindings/spi/fsl-spi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Required properties:
- interrupts : should contain eSPI interrupt, the device has one interrupt.
- fsl,espi-num-chipselects : the number of the chipselect signals.

Optional properties:
- fsl,csbef: chip select assertion time in bits before frame starts
- fsl,csaft: chip select negation time in bits after frame ends

Example:
spi@110000 {
#address-cells = <1>;
Expand All @@ -51,4 +55,6 @@ Example:
interrupts = <53 0x2>;
interrupt-parent = <&mpic>;
fsl,espi-num-chipselects = <4>;
fsl,csbef = <1>;
fsl,csaft = <1>;
};
24 changes: 24 additions & 0 deletions Documentation/devicetree/bindings/spi/spi-dw.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Synopsys DesignWare SPI master

Required properties:
- compatible: should be "snps,designware-spi"
- #address-cells: see spi-bus.txt
- #size-cells: see spi-bus.txt
- reg: address and length of the spi master registers
- interrupts: should contain one interrupt
- clocks: spi clock phandle
- num-cs: see spi-bus.txt

Optional properties:
- cs-gpios: see spi-bus.txt

Example:

spi: spi@4020a000 {
compatible = "snps,designware-spi";
interrupts = <11 1>;
reg = <0x4020a000 0x1000>;
clocks = <&pclk>;
num-cs = <2>;
cs-gpios = <&banka 0 0>;
};
22 changes: 22 additions & 0 deletions drivers/spi/spi-dw-mmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/spi/spi.h>
#include <linux/scatterlist.h>
#include <linux/module.h>
#include <linux/of_gpio.h>

#include "spi-dw.h"

Expand Down Expand Up @@ -70,6 +71,27 @@ static int dw_spi_mmio_probe(struct platform_device *pdev)
dws->num_cs = 4;
dws->max_freq = clk_get_rate(dwsmmio->clk);

if (pdev->dev.of_node) {
int i;

for (i = 0; i < dws->num_cs; i++) {
int cs_gpio = of_get_named_gpio(pdev->dev.of_node,
"cs-gpios", i);

if (cs_gpio == -EPROBE_DEFER) {
ret = cs_gpio;
goto out;
}

if (gpio_is_valid(cs_gpio)) {
ret = devm_gpio_request(&pdev->dev, cs_gpio,
dev_name(&pdev->dev));
if (ret)
goto out;
}
}
}

ret = dw_spi_add_host(&pdev->dev, dws);
if (ret)
goto out;
Expand Down
Loading

0 comments on commit 8fb3b06

Please sign in to comment.