diff options
-rw-r--r-- | drivers/spi/Kconfig | 7 | ||||
-rw-r--r-- | drivers/spi/Makefile | 1 | ||||
-rw-r--r-- | drivers/spi/xilinx_spi.c | 79 | ||||
-rw-r--r-- | drivers/spi/xilinx_spi_pltfm.c | 104 |
4 files changed, 73 insertions, 118 deletions
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 78f9fd02c1b..58ad21c700d 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -368,13 +368,6 @@ config SPI_XILINX_OF | |||
368 | help | 368 | help |
369 | This is the OF driver for the SPI controller IP from the Xilinx EDK. | 369 | This is the OF driver for the SPI controller IP from the Xilinx EDK. |
370 | 370 | ||
371 | config SPI_XILINX_PLTFM | ||
372 | tristate "Xilinx SPI controller platform device" | ||
373 | depends on SPI_XILINX | ||
374 | help | ||
375 | This is the platform driver for the SPI controller IP | ||
376 | from the Xilinx EDK. | ||
377 | |||
378 | config SPI_NUC900 | 371 | config SPI_NUC900 |
379 | tristate "Nuvoton NUC900 series SPI" | 372 | tristate "Nuvoton NUC900 series SPI" |
380 | depends on ARCH_W90X900 && EXPERIMENTAL | 373 | depends on ARCH_W90X900 && EXPERIMENTAL |
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index 8bc1a5abac1..0d03159b566 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile | |||
@@ -44,7 +44,6 @@ obj-$(CONFIG_SPI_TOPCLIFF_PCH) += spi_topcliff_pch.o | |||
44 | obj-$(CONFIG_SPI_TXX9) += spi_txx9.o | 44 | obj-$(CONFIG_SPI_TXX9) += spi_txx9.o |
45 | obj-$(CONFIG_SPI_XILINX) += xilinx_spi.o | 45 | obj-$(CONFIG_SPI_XILINX) += xilinx_spi.o |
46 | obj-$(CONFIG_SPI_XILINX_OF) += xilinx_spi_of.o | 46 | obj-$(CONFIG_SPI_XILINX_OF) += xilinx_spi_of.o |
47 | obj-$(CONFIG_SPI_XILINX_PLTFM) += xilinx_spi_pltfm.o | ||
48 | obj-$(CONFIG_SPI_SH_SCI) += spi_sh_sci.o | 47 | obj-$(CONFIG_SPI_SH_SCI) += spi_sh_sci.o |
49 | obj-$(CONFIG_SPI_SH_MSIOF) += spi_sh_msiof.o | 48 | obj-$(CONFIG_SPI_SH_MSIOF) += spi_sh_msiof.o |
50 | obj-$(CONFIG_SPI_STMP3XXX) += spi_stmp.o | 49 | obj-$(CONFIG_SPI_STMP3XXX) += spi_stmp.o |
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index efb28ba4a4e..bb3b520df9d 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c | |||
@@ -1,20 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | * xilinx_spi.c | ||
3 | * | ||
4 | * Xilinx SPI controller driver (master mode only) | 2 | * Xilinx SPI controller driver (master mode only) |
5 | * | 3 | * |
6 | * Author: MontaVista Software, Inc. | 4 | * Author: MontaVista Software, Inc. |
7 | * source@mvista.com | 5 | * source@mvista.com |
8 | * | 6 | * |
9 | * 2002-2007 (c) MontaVista Software, Inc. This file is licensed under the | 7 | * Copyright (c) 2010 Secret Lab Technologies, Ltd. |
10 | * terms of the GNU General Public License version 2. This program is licensed | 8 | * Copyright (c) 2009 Intel Corporation |
11 | * "as is" without any warranty of any kind, whether express or implied. | 9 | * 2002-2007 (c) MontaVista Software, Inc. |
10 | |||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
12 | */ | 14 | */ |
13 | 15 | ||
14 | #include <linux/module.h> | 16 | #include <linux/module.h> |
15 | #include <linux/init.h> | 17 | #include <linux/init.h> |
16 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
17 | 19 | #include <linux/platform_device.h> | |
18 | #include <linux/spi/spi.h> | 20 | #include <linux/spi/spi.h> |
19 | #include <linux/spi/spi_bitbang.h> | 21 | #include <linux/spi/spi_bitbang.h> |
20 | #include <linux/io.h> | 22 | #include <linux/io.h> |
@@ -456,6 +458,71 @@ void xilinx_spi_deinit(struct spi_master *master) | |||
456 | } | 458 | } |
457 | EXPORT_SYMBOL(xilinx_spi_deinit); | 459 | EXPORT_SYMBOL(xilinx_spi_deinit); |
458 | 460 | ||
461 | static int __devinit xilinx_spi_probe(struct platform_device *dev) | ||
462 | { | ||
463 | struct xspi_platform_data *pdata; | ||
464 | struct resource *r; | ||
465 | int irq; | ||
466 | struct spi_master *master; | ||
467 | u8 i; | ||
468 | |||
469 | pdata = dev->dev.platform_data; | ||
470 | if (!pdata) | ||
471 | return -ENODEV; | ||
472 | |||
473 | r = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
474 | if (!r) | ||
475 | return -ENODEV; | ||
476 | |||
477 | irq = platform_get_irq(dev, 0); | ||
478 | if (irq < 0) | ||
479 | return -ENXIO; | ||
480 | |||
481 | master = xilinx_spi_init(&dev->dev, r, irq, dev->id, | ||
482 | pdata->num_chipselect, pdata->little_endian, | ||
483 | pdata->bits_per_word); | ||
484 | if (!master) | ||
485 | return -ENODEV; | ||
486 | |||
487 | for (i = 0; i < pdata->num_devices; i++) | ||
488 | spi_new_device(master, pdata->devices + i); | ||
489 | |||
490 | platform_set_drvdata(dev, master); | ||
491 | return 0; | ||
492 | } | ||
493 | |||
494 | static int __devexit xilinx_spi_remove(struct platform_device *dev) | ||
495 | { | ||
496 | xilinx_spi_deinit(platform_get_drvdata(dev)); | ||
497 | platform_set_drvdata(dev, 0); | ||
498 | |||
499 | return 0; | ||
500 | } | ||
501 | |||
502 | /* work with hotplug and coldplug */ | ||
503 | MODULE_ALIAS("platform:" XILINX_SPI_NAME); | ||
504 | |||
505 | static struct platform_driver xilinx_spi_driver = { | ||
506 | .probe = xilinx_spi_probe, | ||
507 | .remove = __devexit_p(xilinx_spi_remove), | ||
508 | .driver = { | ||
509 | .name = XILINX_SPI_NAME, | ||
510 | .owner = THIS_MODULE, | ||
511 | }, | ||
512 | }; | ||
513 | |||
514 | static int __init xilinx_spi_pltfm_init(void) | ||
515 | { | ||
516 | return platform_driver_register(&xilinx_spi_driver); | ||
517 | } | ||
518 | module_init(xilinx_spi_pltfm_init); | ||
519 | |||
520 | static void __exit xilinx_spi_pltfm_exit(void) | ||
521 | { | ||
522 | platform_driver_unregister(&xilinx_spi_driver); | ||
523 | } | ||
524 | module_exit(xilinx_spi_pltfm_exit); | ||
525 | |||
459 | MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>"); | 526 | MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>"); |
460 | MODULE_DESCRIPTION("Xilinx SPI driver"); | 527 | MODULE_DESCRIPTION("Xilinx SPI driver"); |
461 | MODULE_LICENSE("GPL"); | 528 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/spi/xilinx_spi_pltfm.c b/drivers/spi/xilinx_spi_pltfm.c deleted file mode 100644 index a16722acafe..00000000000 --- a/drivers/spi/xilinx_spi_pltfm.c +++ /dev/null | |||
@@ -1,104 +0,0 @@ | |||
1 | /* | ||
2 | * Support for Xilinx SPI platform devices | ||
3 | * Copyright (c) 2009 Intel Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
17 | */ | ||
18 | |||
19 | /* Supports: | ||
20 | * Xilinx SPI devices as platform devices | ||
21 | * | ||
22 | * Inspired by xilinx_spi.c, 2002-2007 (c) MontaVista Software, Inc. | ||
23 | */ | ||
24 | |||
25 | #include <linux/module.h> | ||
26 | #include <linux/init.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/io.h> | ||
29 | #include <linux/platform_device.h> | ||
30 | |||
31 | #include <linux/spi/spi.h> | ||
32 | #include <linux/spi/spi_bitbang.h> | ||
33 | #include <linux/spi/xilinx_spi.h> | ||
34 | |||
35 | #include "xilinx_spi.h" | ||
36 | |||
37 | static int __devinit xilinx_spi_probe(struct platform_device *dev) | ||
38 | { | ||
39 | struct xspi_platform_data *pdata; | ||
40 | struct resource *r; | ||
41 | int irq; | ||
42 | struct spi_master *master; | ||
43 | u8 i; | ||
44 | |||
45 | pdata = dev->dev.platform_data; | ||
46 | if (!pdata) | ||
47 | return -ENODEV; | ||
48 | |||
49 | r = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
50 | if (!r) | ||
51 | return -ENODEV; | ||
52 | |||
53 | irq = platform_get_irq(dev, 0); | ||
54 | if (irq < 0) | ||
55 | return -ENXIO; | ||
56 | |||
57 | master = xilinx_spi_init(&dev->dev, r, irq, dev->id, | ||
58 | pdata->num_chipselect, pdata->little_endian, | ||
59 | pdata->bits_per_word); | ||
60 | if (!master) | ||
61 | return -ENODEV; | ||
62 | |||
63 | for (i = 0; i < pdata->num_devices; i++) | ||
64 | spi_new_device(master, pdata->devices + i); | ||
65 | |||
66 | platform_set_drvdata(dev, master); | ||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | static int __devexit xilinx_spi_remove(struct platform_device *dev) | ||
71 | { | ||
72 | xilinx_spi_deinit(platform_get_drvdata(dev)); | ||
73 | platform_set_drvdata(dev, 0); | ||
74 | |||
75 | return 0; | ||
76 | } | ||
77 | |||
78 | /* work with hotplug and coldplug */ | ||
79 | MODULE_ALIAS("platform:" XILINX_SPI_NAME); | ||
80 | |||
81 | static struct platform_driver xilinx_spi_driver = { | ||
82 | .probe = xilinx_spi_probe, | ||
83 | .remove = __devexit_p(xilinx_spi_remove), | ||
84 | .driver = { | ||
85 | .name = XILINX_SPI_NAME, | ||
86 | .owner = THIS_MODULE, | ||
87 | }, | ||
88 | }; | ||
89 | |||
90 | static int __init xilinx_spi_pltfm_init(void) | ||
91 | { | ||
92 | return platform_driver_register(&xilinx_spi_driver); | ||
93 | } | ||
94 | module_init(xilinx_spi_pltfm_init); | ||
95 | |||
96 | static void __exit xilinx_spi_pltfm_exit(void) | ||
97 | { | ||
98 | platform_driver_unregister(&xilinx_spi_driver); | ||
99 | } | ||
100 | module_exit(xilinx_spi_pltfm_exit); | ||
101 | |||
102 | MODULE_AUTHOR("Mocean Laboratories <info@mocean-labs.com>"); | ||
103 | MODULE_DESCRIPTION("Xilinx SPI platform driver"); | ||
104 | MODULE_LICENSE("GPL v2"); | ||