aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/spi/nvidia,tegra20-sflash.txt2
-rw-r--r--Documentation/devicetree/bindings/spi/nvidia,tegra20-slink.txt2
-rw-r--r--Documentation/devicetree/bindings/spi/spi_atmel.txt26
-rw-r--r--drivers/gpio/Kconfig1
-rw-r--r--drivers/gpio/gpio-ich.c1
-rw-r--r--drivers/gpio/gpio-mvebu.c17
-rw-r--r--drivers/of/base.c2
-rw-r--r--drivers/spi/spi-atmel.c17
-rw-r--r--drivers/spi/spi-s3c64xx.c10
-rw-r--r--drivers/spi/spi-sh-hspi.c2
-rw-r--r--drivers/spi/spi.c5
-rw-r--r--include/linux/of_platform.h1
12 files changed, 57 insertions, 29 deletions
diff --git a/Documentation/devicetree/bindings/spi/nvidia,tegra20-sflash.txt b/Documentation/devicetree/bindings/spi/nvidia,tegra20-sflash.txt
index 8cf24f6f0a99..7b53da5cb75b 100644
--- a/Documentation/devicetree/bindings/spi/nvidia,tegra20-sflash.txt
+++ b/Documentation/devicetree/bindings/spi/nvidia,tegra20-sflash.txt
@@ -13,7 +13,7 @@ Recommended properties:
13 13
14Example: 14Example:
15 15
16spi@7000d600 { 16spi@7000c380 {
17 compatible = "nvidia,tegra20-sflash"; 17 compatible = "nvidia,tegra20-sflash";
18 reg = <0x7000c380 0x80>; 18 reg = <0x7000c380 0x80>;
19 interrupts = <0 39 0x04>; 19 interrupts = <0 39 0x04>;
diff --git a/Documentation/devicetree/bindings/spi/nvidia,tegra20-slink.txt b/Documentation/devicetree/bindings/spi/nvidia,tegra20-slink.txt
index f5b1ad1a1ec3..eefe15e3d95e 100644
--- a/Documentation/devicetree/bindings/spi/nvidia,tegra20-slink.txt
+++ b/Documentation/devicetree/bindings/spi/nvidia,tegra20-slink.txt
@@ -13,7 +13,7 @@ Recommended properties:
13 13
14Example: 14Example:
15 15
16slink@7000d600 { 16spi@7000d600 {
17 compatible = "nvidia,tegra20-slink"; 17 compatible = "nvidia,tegra20-slink";
18 reg = <0x7000d600 0x200>; 18 reg = <0x7000d600 0x200>;
19 interrupts = <0 82 0x04>; 19 interrupts = <0 82 0x04>;
diff --git a/Documentation/devicetree/bindings/spi/spi_atmel.txt b/Documentation/devicetree/bindings/spi/spi_atmel.txt
new file mode 100644
index 000000000000..07e04cdc0c9e
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/spi_atmel.txt
@@ -0,0 +1,26 @@
1Atmel SPI device
2
3Required properties:
4- compatible : should be "atmel,at91rm9200-spi".
5- reg: Address and length of the register set for the device
6- interrupts: Should contain spi interrupt
7- cs-gpios: chipselects
8
9Example:
10
11spi1: spi@fffcc000 {
12 compatible = "atmel,at91rm9200-spi";
13 reg = <0xfffcc000 0x4000>;
14 interrupts = <13 4 5>;
15 #address-cells = <1>;
16 #size-cells = <0>;
17 cs-gpios = <&pioB 3 0>;
18 status = "okay";
19
20 mmc-slot@0 {
21 compatible = "mmc-spi-slot";
22 reg = <0>;
23 gpios = <&pioC 4 0>; /* CD */
24 spi-max-frequency = <25000000>;
25 };
26};
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 8ae1f5b19669..682de754d63f 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -172,6 +172,7 @@ config GPIO_MSM_V2
172config GPIO_MVEBU 172config GPIO_MVEBU
173 def_bool y 173 def_bool y
174 depends on PLAT_ORION 174 depends on PLAT_ORION
175 depends on OF
175 select GPIO_GENERIC 176 select GPIO_GENERIC
176 select GENERIC_IRQ_CHIP 177 select GENERIC_IRQ_CHIP
177 178
diff --git a/drivers/gpio/gpio-ich.c b/drivers/gpio/gpio-ich.c
index 6cc87ac8e019..6f2306db8591 100644
--- a/drivers/gpio/gpio-ich.c
+++ b/drivers/gpio/gpio-ich.c
@@ -390,6 +390,7 @@ static int ichx_gpio_probe(struct platform_device *pdev)
390 return -ENODEV; 390 return -ENODEV;
391 } 391 }
392 392
393 spin_lock_init(&ichx_priv.lock);
393 res_base = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_GPIO); 394 res_base = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_GPIO);
394 ichx_priv.use_gpio = ich_info->use_gpio; 395 ichx_priv.use_gpio = ich_info->use_gpio;
395 err = ichx_gpio_request_regions(res_base, pdev->name, 396 err = ichx_gpio_request_regions(res_base, pdev->name,
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index d767b534c4af..7d9bd94be8d2 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -41,7 +41,6 @@
41#include <linux/io.h> 41#include <linux/io.h>
42#include <linux/of_irq.h> 42#include <linux/of_irq.h>
43#include <linux/of_device.h> 43#include <linux/of_device.h>
44#include <linux/platform_device.h>
45#include <linux/pinctrl/consumer.h> 44#include <linux/pinctrl/consumer.h>
46 45
47/* 46/*
@@ -469,19 +468,6 @@ static void mvebu_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
469 } 468 }
470} 469}
471 470
472static struct platform_device_id mvebu_gpio_ids[] = {
473 {
474 .name = "orion-gpio",
475 }, {
476 .name = "mv78200-gpio",
477 }, {
478 .name = "armadaxp-gpio",
479 }, {
480 /* sentinel */
481 },
482};
483MODULE_DEVICE_TABLE(platform, mvebu_gpio_ids);
484
485static struct of_device_id mvebu_gpio_of_match[] = { 471static struct of_device_id mvebu_gpio_of_match[] = {
486 { 472 {
487 .compatible = "marvell,orion-gpio", 473 .compatible = "marvell,orion-gpio",
@@ -555,9 +541,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
555 mvchip->chip.base = id * MVEBU_MAX_GPIO_PER_BANK; 541 mvchip->chip.base = id * MVEBU_MAX_GPIO_PER_BANK;
556 mvchip->chip.ngpio = ngpios; 542 mvchip->chip.ngpio = ngpios;
557 mvchip->chip.can_sleep = 0; 543 mvchip->chip.can_sleep = 0;
558#ifdef CONFIG_OF
559 mvchip->chip.of_node = np; 544 mvchip->chip.of_node = np;
560#endif
561 545
562 spin_lock_init(&mvchip->lock); 546 spin_lock_init(&mvchip->lock);
563 mvchip->membase = devm_request_and_ioremap(&pdev->dev, res); 547 mvchip->membase = devm_request_and_ioremap(&pdev->dev, res);
@@ -698,7 +682,6 @@ static struct platform_driver mvebu_gpio_driver = {
698 .of_match_table = mvebu_gpio_of_match, 682 .of_match_table = mvebu_gpio_of_match,
699 }, 683 },
700 .probe = mvebu_gpio_probe, 684 .probe = mvebu_gpio_probe,
701 .id_table = mvebu_gpio_ids,
702}; 685};
703 686
704static int __init mvebu_gpio_init(void) 687static int __init mvebu_gpio_init(void)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index db8d211a0d05..2390ddb22d60 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -629,7 +629,7 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from,
629 read_unlock(&devtree_lock); 629 read_unlock(&devtree_lock);
630 return np; 630 return np;
631} 631}
632EXPORT_SYMBOL(of_find_matching_node); 632EXPORT_SYMBOL(of_find_matching_node_and_match);
633 633
634/** 634/**
635 * of_modalias_node - Lookup appropriate modalias for a device node 635 * of_modalias_node - Lookup appropriate modalias for a device node
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 75c0c4f5fdf2..ab34497bcfee 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -20,6 +20,7 @@
20#include <linux/spi/spi.h> 20#include <linux/spi/spi.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/platform_data/atmel.h> 22#include <linux/platform_data/atmel.h>
23#include <linux/of.h>
23 24
24#include <asm/io.h> 25#include <asm/io.h>
25#include <asm/gpio.h> 26#include <asm/gpio.h>
@@ -768,6 +769,10 @@ static int atmel_spi_setup(struct spi_device *spi)
768 769
769 /* chipselect must have been muxed as GPIO (e.g. in board setup) */ 770 /* chipselect must have been muxed as GPIO (e.g. in board setup) */
770 npcs_pin = (unsigned int)spi->controller_data; 771 npcs_pin = (unsigned int)spi->controller_data;
772
773 if (gpio_is_valid(spi->cs_gpio))
774 npcs_pin = spi->cs_gpio;
775
771 asd = spi->controller_state; 776 asd = spi->controller_state;
772 if (!asd) { 777 if (!asd) {
773 asd = kzalloc(sizeof(struct atmel_spi_device), GFP_KERNEL); 778 asd = kzalloc(sizeof(struct atmel_spi_device), GFP_KERNEL);
@@ -937,8 +942,9 @@ static int atmel_spi_probe(struct platform_device *pdev)
937 /* the spi->mode bits understood by this driver: */ 942 /* the spi->mode bits understood by this driver: */
938 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; 943 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
939 944
945 master->dev.of_node = pdev->dev.of_node;
940 master->bus_num = pdev->id; 946 master->bus_num = pdev->id;
941 master->num_chipselect = 4; 947 master->num_chipselect = master->dev.of_node ? 0 : 4;
942 master->setup = atmel_spi_setup; 948 master->setup = atmel_spi_setup;
943 master->transfer = atmel_spi_transfer; 949 master->transfer = atmel_spi_transfer;
944 master->cleanup = atmel_spi_cleanup; 950 master->cleanup = atmel_spi_cleanup;
@@ -1064,11 +1070,20 @@ static int atmel_spi_resume(struct platform_device *pdev)
1064#define atmel_spi_resume NULL 1070#define atmel_spi_resume NULL
1065#endif 1071#endif
1066 1072
1073#if defined(CONFIG_OF)
1074static const struct of_device_id atmel_spi_dt_ids[] = {
1075 { .compatible = "atmel,at91rm9200-spi" },
1076 { /* sentinel */ }
1077};
1078
1079MODULE_DEVICE_TABLE(of, atmel_spi_dt_ids);
1080#endif
1067 1081
1068static struct platform_driver atmel_spi_driver = { 1082static struct platform_driver atmel_spi_driver = {
1069 .driver = { 1083 .driver = {
1070 .name = "atmel_spi", 1084 .name = "atmel_spi",
1071 .owner = THIS_MODULE, 1085 .owner = THIS_MODULE,
1086 .of_match_table = of_match_ptr(atmel_spi_dt_ids),
1072 }, 1087 },
1073 .suspend = atmel_spi_suspend, 1088 .suspend = atmel_spi_suspend,
1074 .resume = atmel_spi_resume, 1089 .resume = atmel_spi_resume,
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 4dd7b7ce5c5a..ad93231a8038 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -215,6 +215,10 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
215 writel(0, regs + S3C64XX_SPI_PACKET_CNT); 215 writel(0, regs + S3C64XX_SPI_PACKET_CNT);
216 216
217 val = readl(regs + S3C64XX_SPI_CH_CFG); 217 val = readl(regs + S3C64XX_SPI_CH_CFG);
218 val &= ~(S3C64XX_SPI_CH_RXCH_ON | S3C64XX_SPI_CH_TXCH_ON);
219 writel(val, regs + S3C64XX_SPI_CH_CFG);
220
221 val = readl(regs + S3C64XX_SPI_CH_CFG);
218 val |= S3C64XX_SPI_CH_SW_RST; 222 val |= S3C64XX_SPI_CH_SW_RST;
219 val &= ~S3C64XX_SPI_CH_HS_EN; 223 val &= ~S3C64XX_SPI_CH_HS_EN;
220 writel(val, regs + S3C64XX_SPI_CH_CFG); 224 writel(val, regs + S3C64XX_SPI_CH_CFG);
@@ -248,10 +252,6 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
248 val = readl(regs + S3C64XX_SPI_MODE_CFG); 252 val = readl(regs + S3C64XX_SPI_MODE_CFG);
249 val &= ~(S3C64XX_SPI_MODE_TXDMA_ON | S3C64XX_SPI_MODE_RXDMA_ON); 253 val &= ~(S3C64XX_SPI_MODE_TXDMA_ON | S3C64XX_SPI_MODE_RXDMA_ON);
250 writel(val, regs + S3C64XX_SPI_MODE_CFG); 254 writel(val, regs + S3C64XX_SPI_MODE_CFG);
251
252 val = readl(regs + S3C64XX_SPI_CH_CFG);
253 val &= ~(S3C64XX_SPI_CH_RXCH_ON | S3C64XX_SPI_CH_TXCH_ON);
254 writel(val, regs + S3C64XX_SPI_CH_CFG);
255} 255}
256 256
257static void s3c64xx_spi_dmacb(void *data) 257static void s3c64xx_spi_dmacb(void *data)
@@ -771,8 +771,6 @@ static int s3c64xx_spi_transfer_one_message(struct spi_master *master,
771 if (list_is_last(&xfer->transfer_list, 771 if (list_is_last(&xfer->transfer_list,
772 &msg->transfers)) 772 &msg->transfers))
773 cs_toggle = 1; 773 cs_toggle = 1;
774 else
775 disable_cs(sdd, spi);
776 } 774 }
777 775
778 msg->actual_length += xfer->len; 776 msg->actual_length += xfer->len;
diff --git a/drivers/spi/spi-sh-hspi.c b/drivers/spi/spi-sh-hspi.c
index 32f7b55fce09..60cfae51c713 100644
--- a/drivers/spi/spi-sh-hspi.c
+++ b/drivers/spi/spi-sh-hspi.c
@@ -290,7 +290,7 @@ static int hspi_probe(struct platform_device *pdev)
290 } 290 }
291 291
292 clk = clk_get(NULL, "shyway_clk"); 292 clk = clk_get(NULL, "shyway_clk");
293 if (!clk) { 293 if (IS_ERR(clk)) {
294 dev_err(&pdev->dev, "shyway_clk is required\n"); 294 dev_err(&pdev->dev, "shyway_clk is required\n");
295 ret = -EINVAL; 295 ret = -EINVAL;
296 goto error0; 296 goto error0;
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index ab095acdb2a8..19ee901577da 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -824,6 +824,7 @@ static void of_register_spi_devices(struct spi_master *master)
824 struct spi_device *spi; 824 struct spi_device *spi;
825 struct device_node *nc; 825 struct device_node *nc;
826 const __be32 *prop; 826 const __be32 *prop;
827 char modalias[SPI_NAME_SIZE + 4];
827 int rc; 828 int rc;
828 int len; 829 int len;
829 830
@@ -887,7 +888,9 @@ static void of_register_spi_devices(struct spi_master *master)
887 spi->dev.of_node = nc; 888 spi->dev.of_node = nc;
888 889
889 /* Register the new device */ 890 /* Register the new device */
890 request_module(spi->modalias); 891 snprintf(modalias, sizeof(modalias), "%s%s", SPI_MODULE_PREFIX,
892 spi->modalias);
893 request_module(modalias);
891 rc = spi_add_device(spi); 894 rc = spi_add_device(spi);
892 if (rc) { 895 if (rc) {
893 dev_err(&master->dev, "spi_device register error %s\n", 896 dev_err(&master->dev, "spi_device register error %s\n",
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index b47d2040c9f2..3863a4dbdf18 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -100,6 +100,7 @@ extern int of_platform_populate(struct device_node *root,
100 100
101#if !defined(CONFIG_OF_ADDRESS) 101#if !defined(CONFIG_OF_ADDRESS)
102struct of_dev_auxdata; 102struct of_dev_auxdata;
103struct device;
103static inline int of_platform_populate(struct device_node *root, 104static inline int of_platform_populate(struct device_node *root,
104 const struct of_device_id *matches, 105 const struct of_device_id *matches,
105 const struct of_dev_auxdata *lookup, 106 const struct of_dev_auxdata *lookup,