diff options
| -rw-r--r-- | Documentation/devicetree/bindings/spi/efm32-spi.txt | 13 | ||||
| -rw-r--r-- | Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.txt | 28 | ||||
| -rw-r--r-- | drivers/spi/spi-dw-mmio.c | 19 | ||||
| -rw-r--r-- | drivers/spi/spi-efm32.c | 8 | ||||
| -rw-r--r-- | drivers/spi/spi-fsl-lib.c | 2 | ||||
| -rw-r--r-- | drivers/spi/spi-omap-uwire.c | 11 |
6 files changed, 65 insertions, 16 deletions
diff --git a/Documentation/devicetree/bindings/spi/efm32-spi.txt b/Documentation/devicetree/bindings/spi/efm32-spi.txt index 130cd17e3680..750e29aff9bc 100644 --- a/Documentation/devicetree/bindings/spi/efm32-spi.txt +++ b/Documentation/devicetree/bindings/spi/efm32-spi.txt | |||
| @@ -10,11 +10,12 @@ Required properties: | |||
| 10 | - cs-gpios: see spi-bus.txt | 10 | - cs-gpios: see spi-bus.txt |
| 11 | 11 | ||
| 12 | Recommended properties : | 12 | Recommended properties : |
| 13 | - efm32,location: Value to write to the ROUTE register's LOCATION bitfield to | 13 | - energymicro,location: Value to write to the ROUTE register's LOCATION |
| 14 | configure the pinmux for the device, see datasheet for values. | 14 | bitfield to configure the pinmux for the device, see |
| 15 | If "efm32,location" property is not provided, keeping what is | 15 | datasheet for values. |
| 16 | already configured in the hardware, so its either the reset | 16 | If this property is not provided, keeping what is |
| 17 | default 0 or whatever the bootloader did. | 17 | already configured in the hardware, so its either the |
| 18 | reset default 0 or whatever the bootloader did. | ||
| 18 | 19 | ||
| 19 | Example: | 20 | Example: |
| 20 | 21 | ||
| @@ -26,7 +27,7 @@ spi1: spi@0x4000c400 { /* USART1 */ | |||
| 26 | interrupts = <15 16>; | 27 | interrupts = <15 16>; |
| 27 | clocks = <&cmu 20>; | 28 | clocks = <&cmu 20>; |
| 28 | cs-gpios = <&gpio 51 1>; // D3 | 29 | cs-gpios = <&gpio 51 1>; // D3 |
| 29 | efm32,location = <1>; | 30 | energymicro,location = <1>; |
| 30 | status = "ok"; | 31 | status = "ok"; |
| 31 | 32 | ||
| 32 | ks8851@0 { | 33 | ks8851@0 { |
diff --git a/Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.txt b/Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.txt new file mode 100644 index 000000000000..bd99193e87b9 --- /dev/null +++ b/Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.txt | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | Synopsys DesignWare AMBA 2.0 Synchronous Serial Interface. | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | - compatible : "snps,dw-apb-ssi" | ||
| 5 | - reg : The register base for the controller. | ||
| 6 | - interrupts : One interrupt, used by the controller. | ||
| 7 | - #address-cells : <1>, as required by generic SPI binding. | ||
| 8 | - #size-cells : <0>, also as required by generic SPI binding. | ||
| 9 | |||
| 10 | Optional properties: | ||
| 11 | - cs-gpios : Specifies the gpio pis to be used for chipselects. | ||
| 12 | - num-cs : The number of chipselects. If omitted, this will default to 4. | ||
| 13 | |||
| 14 | Child nodes as per the generic SPI binding. | ||
| 15 | |||
| 16 | Example: | ||
| 17 | |||
| 18 | spi@fff00000 { | ||
| 19 | compatible = "snps,dw-apb-ssi"; | ||
| 20 | reg = <0xfff00000 0x1000>; | ||
| 21 | interrupts = <0 154 4>; | ||
| 22 | #address-cells = <1>; | ||
| 23 | #size-cells = <0>; | ||
| 24 | num-cs = <2>; | ||
| 25 | cs-gpios = <&gpio0 13 0>, | ||
| 26 | <&gpio0 14 0>; | ||
| 27 | }; | ||
| 28 | |||
diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c index a5cba14ac3d2..21ce0e36fa00 100644 --- a/drivers/spi/spi-dw-mmio.c +++ b/drivers/spi/spi-dw-mmio.c | |||
| @@ -16,7 +16,9 @@ | |||
| 16 | #include <linux/spi/spi.h> | 16 | #include <linux/spi/spi.h> |
| 17 | #include <linux/scatterlist.h> | 17 | #include <linux/scatterlist.h> |
| 18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| 19 | #include <linux/of.h> | ||
| 19 | #include <linux/of_gpio.h> | 20 | #include <linux/of_gpio.h> |
| 21 | #include <linux/of_platform.h> | ||
| 20 | 22 | ||
| 21 | #include "spi-dw.h" | 23 | #include "spi-dw.h" |
| 22 | 24 | ||
| @@ -33,6 +35,7 @@ static int dw_spi_mmio_probe(struct platform_device *pdev) | |||
| 33 | struct dw_spi *dws; | 35 | struct dw_spi *dws; |
| 34 | struct resource *mem; | 36 | struct resource *mem; |
| 35 | int ret; | 37 | int ret; |
| 38 | int num_cs; | ||
| 36 | 39 | ||
| 37 | dwsmmio = devm_kzalloc(&pdev->dev, sizeof(struct dw_spi_mmio), | 40 | dwsmmio = devm_kzalloc(&pdev->dev, sizeof(struct dw_spi_mmio), |
| 38 | GFP_KERNEL); | 41 | GFP_KERNEL); |
| @@ -68,9 +71,16 @@ static int dw_spi_mmio_probe(struct platform_device *pdev) | |||
| 68 | return ret; | 71 | return ret; |
| 69 | 72 | ||
| 70 | dws->bus_num = pdev->id; | 73 | dws->bus_num = pdev->id; |
| 71 | dws->num_cs = 4; | 74 | |
| 72 | dws->max_freq = clk_get_rate(dwsmmio->clk); | 75 | dws->max_freq = clk_get_rate(dwsmmio->clk); |
| 73 | 76 | ||
| 77 | num_cs = 4; | ||
| 78 | |||
| 79 | if (pdev->dev.of_node) | ||
| 80 | of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs); | ||
| 81 | |||
| 82 | dws->num_cs = num_cs; | ||
| 83 | |||
| 74 | if (pdev->dev.of_node) { | 84 | if (pdev->dev.of_node) { |
| 75 | int i; | 85 | int i; |
| 76 | 86 | ||
| @@ -114,12 +124,19 @@ static int dw_spi_mmio_remove(struct platform_device *pdev) | |||
| 114 | return 0; | 124 | return 0; |
| 115 | } | 125 | } |
| 116 | 126 | ||
| 127 | static const struct of_device_id dw_spi_mmio_of_match[] = { | ||
| 128 | { .compatible = "snps,dw-apb-ssi", }, | ||
| 129 | { /* end of table */} | ||
| 130 | }; | ||
| 131 | MODULE_DEVICE_TABLE(of, dw_spi_mmio_of_match); | ||
| 132 | |||
| 117 | static struct platform_driver dw_spi_mmio_driver = { | 133 | static struct platform_driver dw_spi_mmio_driver = { |
| 118 | .probe = dw_spi_mmio_probe, | 134 | .probe = dw_spi_mmio_probe, |
| 119 | .remove = dw_spi_mmio_remove, | 135 | .remove = dw_spi_mmio_remove, |
| 120 | .driver = { | 136 | .driver = { |
| 121 | .name = DRIVER_NAME, | 137 | .name = DRIVER_NAME, |
| 122 | .owner = THIS_MODULE, | 138 | .owner = THIS_MODULE, |
| 139 | .of_match_table = dw_spi_mmio_of_match, | ||
| 123 | }, | 140 | }, |
| 124 | }; | 141 | }; |
| 125 | module_platform_driver(dw_spi_mmio_driver); | 142 | module_platform_driver(dw_spi_mmio_driver); |
diff --git a/drivers/spi/spi-efm32.c b/drivers/spi/spi-efm32.c index be44a3eeb5e8..6caeb1cac0f3 100644 --- a/drivers/spi/spi-efm32.c +++ b/drivers/spi/spi-efm32.c | |||
| @@ -294,10 +294,16 @@ static void efm32_spi_probe_dt(struct platform_device *pdev, | |||
| 294 | u32 location; | 294 | u32 location; |
| 295 | int ret; | 295 | int ret; |
| 296 | 296 | ||
| 297 | ret = of_property_read_u32(np, "efm32,location", &location); | 297 | ret = of_property_read_u32(np, "energymicro,location", &location); |
| 298 | |||
| 299 | if (ret) | ||
| 300 | /* fall back to wrongly namespaced property */ | ||
| 301 | ret = of_property_read_u32(np, "efm32,location", &location); | ||
| 302 | |||
| 298 | if (ret) | 303 | if (ret) |
| 299 | /* fall back to old and (wrongly) generic property "location" */ | 304 | /* fall back to old and (wrongly) generic property "location" */ |
| 300 | ret = of_property_read_u32(np, "location", &location); | 305 | ret = of_property_read_u32(np, "location", &location); |
| 306 | |||
| 301 | if (!ret) { | 307 | if (!ret) { |
| 302 | dev_dbg(&pdev->dev, "using location %u\n", location); | 308 | dev_dbg(&pdev->dev, "using location %u\n", location); |
| 303 | } else { | 309 | } else { |
diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c index 95212ea96c8d..e0b773fc29cb 100644 --- a/drivers/spi/spi-fsl-lib.c +++ b/drivers/spi/spi-fsl-lib.c | |||
| @@ -196,7 +196,7 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev) | |||
| 196 | 196 | ||
| 197 | pinfo = devm_kzalloc(&ofdev->dev, sizeof(*pinfo), GFP_KERNEL); | 197 | pinfo = devm_kzalloc(&ofdev->dev, sizeof(*pinfo), GFP_KERNEL); |
| 198 | if (!pinfo) | 198 | if (!pinfo) |
| 199 | return -ENOMEM; | 199 | return ret; |
| 200 | 200 | ||
| 201 | pdata = &pinfo->pdata; | 201 | pdata = &pinfo->pdata; |
| 202 | dev->platform_data = pdata; | 202 | dev->platform_data = pdata; |
diff --git a/drivers/spi/spi-omap-uwire.c b/drivers/spi/spi-omap-uwire.c index 0f5a0aa3b871..8bca90a19dd1 100644 --- a/drivers/spi/spi-omap-uwire.c +++ b/drivers/spi/spi-omap-uwire.c | |||
| @@ -41,14 +41,15 @@ | |||
| 41 | #include <linux/err.h> | 41 | #include <linux/err.h> |
| 42 | #include <linux/clk.h> | 42 | #include <linux/clk.h> |
| 43 | #include <linux/slab.h> | 43 | #include <linux/slab.h> |
| 44 | #include <linux/device.h> | ||
| 44 | 45 | ||
| 45 | #include <linux/spi/spi.h> | 46 | #include <linux/spi/spi.h> |
| 46 | #include <linux/spi/spi_bitbang.h> | 47 | #include <linux/spi/spi_bitbang.h> |
| 47 | #include <linux/module.h> | 48 | #include <linux/module.h> |
| 49 | #include <linux/io.h> | ||
| 48 | 50 | ||
| 49 | #include <asm/irq.h> | 51 | #include <asm/irq.h> |
| 50 | #include <mach/hardware.h> | 52 | #include <mach/hardware.h> |
| 51 | #include <asm/io.h> | ||
| 52 | #include <asm/mach-types.h> | 53 | #include <asm/mach-types.h> |
| 53 | 54 | ||
| 54 | #include <mach/mux.h> | 55 | #include <mach/mux.h> |
| @@ -447,7 +448,6 @@ static void uwire_off(struct uwire_spi *uwire) | |||
| 447 | { | 448 | { |
| 448 | uwire_write_reg(UWIRE_SR3, 0); | 449 | uwire_write_reg(UWIRE_SR3, 0); |
| 449 | clk_disable(uwire->ck); | 450 | clk_disable(uwire->ck); |
| 450 | clk_put(uwire->ck); | ||
| 451 | spi_master_put(uwire->bitbang.master); | 451 | spi_master_put(uwire->bitbang.master); |
| 452 | } | 452 | } |
| 453 | 453 | ||
| @@ -463,7 +463,7 @@ static int uwire_probe(struct platform_device *pdev) | |||
| 463 | 463 | ||
| 464 | uwire = spi_master_get_devdata(master); | 464 | uwire = spi_master_get_devdata(master); |
| 465 | 465 | ||
| 466 | uwire_base = ioremap(UWIRE_BASE_PHYS, UWIRE_IO_SIZE); | 466 | uwire_base = devm_ioremap(&pdev->dev, UWIRE_BASE_PHYS, UWIRE_IO_SIZE); |
| 467 | if (!uwire_base) { | 467 | if (!uwire_base) { |
| 468 | dev_dbg(&pdev->dev, "can't ioremap UWIRE\n"); | 468 | dev_dbg(&pdev->dev, "can't ioremap UWIRE\n"); |
| 469 | spi_master_put(master); | 469 | spi_master_put(master); |
| @@ -472,12 +472,11 @@ static int uwire_probe(struct platform_device *pdev) | |||
| 472 | 472 | ||
| 473 | platform_set_drvdata(pdev, uwire); | 473 | platform_set_drvdata(pdev, uwire); |
| 474 | 474 | ||
| 475 | uwire->ck = clk_get(&pdev->dev, "fck"); | 475 | uwire->ck = devm_clk_get(&pdev->dev, "fck"); |
| 476 | if (IS_ERR(uwire->ck)) { | 476 | if (IS_ERR(uwire->ck)) { |
| 477 | status = PTR_ERR(uwire->ck); | 477 | status = PTR_ERR(uwire->ck); |
| 478 | dev_dbg(&pdev->dev, "no functional clock?\n"); | 478 | dev_dbg(&pdev->dev, "no functional clock?\n"); |
| 479 | spi_master_put(master); | 479 | spi_master_put(master); |
| 480 | iounmap(uwire_base); | ||
| 481 | return status; | 480 | return status; |
| 482 | } | 481 | } |
| 483 | clk_enable(uwire->ck); | 482 | clk_enable(uwire->ck); |
| @@ -507,7 +506,6 @@ static int uwire_probe(struct platform_device *pdev) | |||
| 507 | status = spi_bitbang_start(&uwire->bitbang); | 506 | status = spi_bitbang_start(&uwire->bitbang); |
| 508 | if (status < 0) { | 507 | if (status < 0) { |
| 509 | uwire_off(uwire); | 508 | uwire_off(uwire); |
| 510 | iounmap(uwire_base); | ||
| 511 | } | 509 | } |
| 512 | return status; | 510 | return status; |
| 513 | } | 511 | } |
| @@ -520,7 +518,6 @@ static int uwire_remove(struct platform_device *pdev) | |||
| 520 | 518 | ||
| 521 | spi_bitbang_stop(&uwire->bitbang); | 519 | spi_bitbang_stop(&uwire->bitbang); |
| 522 | uwire_off(uwire); | 520 | uwire_off(uwire); |
| 523 | iounmap(uwire_base); | ||
| 524 | return 0; | 521 | return 0; |
| 525 | } | 522 | } |
| 526 | 523 | ||
