diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-24 16:56:24 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-24 16:56:24 -0400 |
| commit | be122abe4bcd6d39b37892daae28c8bf5e4030fc (patch) | |
| tree | e8ad84c41c2acde27c77fa212b8865cd3acfe6fb /drivers/of | |
| parent | b343c8beec664ef6f0e9964d3001c7c7966331ae (diff) | |
| parent | 1e8a52e18cfb381bc9cc1f0b720540364d2a6edd (diff) | |
Merge tag 'spi-for-linus' of git://git.secretlab.ca/git/linux-2.6
Pull SPI changes from Grant Likely:
"Bug fixes and new features for SPI device drivers. Also move device
tree support code out of drivers/of and into drivers/spi/spi.c where
it makes more sense."
* tag 'spi-for-linus' of git://git.secretlab.ca/git/linux-2.6:
spi: By default setup spi_masters with 1 chipselect and dynamics bus number
SPI: PRIMA2: use the newest APIs of PINCTRL to fix compiling errors
spi/spi-fsl-spi: reference correct pdata in fsl_spi_cs_control
spi: refactor spi-coldfire-qspi to use SPI queue framework.
spi/omap2-mcspi: convert to the pump message infrastructure
spi/rspi: add dmaengine support
spi/topcliff: use correct __devexit_p annotation
spi: Dont call prepare/unprepare transfer if not populated
spi/ep93xx: clean probe/remove routines
spi/devicetree: Move devicetree support code into spi directory
spi: use module_pci_driver
spi/omap2-mcspi: Trivial optimisation
spi: omap2-mcspi: add support for pm_runtime autosuspend
spi/omap: Remove bus_num usage for instance index
OMAP : SPI : use devm_* functions
spi: omap2-mcspi: convert to module_platform_driver
spi: omap2-mcspi: make it behave as a module
Diffstat (limited to 'drivers/of')
| -rw-r--r-- | drivers/of/Kconfig | 6 | ||||
| -rw-r--r-- | drivers/of/Makefile | 1 | ||||
| -rw-r--r-- | drivers/of/of_spi.c | 99 |
3 files changed, 0 insertions, 106 deletions
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig index 8e84ce9765a9..f623f17a0b9f 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig | |||
| @@ -67,12 +67,6 @@ config OF_NET | |||
| 67 | depends on NETDEVICES | 67 | depends on NETDEVICES |
| 68 | def_bool y | 68 | def_bool y |
| 69 | 69 | ||
| 70 | config OF_SPI | ||
| 71 | def_tristate SPI | ||
| 72 | depends on SPI && !SPARC | ||
| 73 | help | ||
| 74 | OpenFirmware SPI accessors | ||
| 75 | |||
| 76 | config OF_MDIO | 70 | config OF_MDIO |
| 77 | def_tristate PHYLIB | 71 | def_tristate PHYLIB |
| 78 | depends on PHYLIB | 72 | depends on PHYLIB |
diff --git a/drivers/of/Makefile b/drivers/of/Makefile index aa90e602c8a7..0040d1858665 100644 --- a/drivers/of/Makefile +++ b/drivers/of/Makefile | |||
| @@ -7,7 +7,6 @@ obj-$(CONFIG_OF_DEVICE) += device.o platform.o | |||
| 7 | obj-$(CONFIG_OF_GPIO) += gpio.o | 7 | obj-$(CONFIG_OF_GPIO) += gpio.o |
| 8 | obj-$(CONFIG_OF_I2C) += of_i2c.o | 8 | obj-$(CONFIG_OF_I2C) += of_i2c.o |
| 9 | obj-$(CONFIG_OF_NET) += of_net.o | 9 | obj-$(CONFIG_OF_NET) += of_net.o |
| 10 | obj-$(CONFIG_OF_SPI) += of_spi.o | ||
| 11 | obj-$(CONFIG_OF_SELFTEST) += selftest.o | 10 | obj-$(CONFIG_OF_SELFTEST) += selftest.o |
| 12 | obj-$(CONFIG_OF_MDIO) += of_mdio.o | 11 | obj-$(CONFIG_OF_MDIO) += of_mdio.o |
| 13 | obj-$(CONFIG_OF_PCI) += of_pci.o | 12 | obj-$(CONFIG_OF_PCI) += of_pci.o |
diff --git a/drivers/of/of_spi.c b/drivers/of/of_spi.c deleted file mode 100644 index 6dbc074e4876..000000000000 --- a/drivers/of/of_spi.c +++ /dev/null | |||
| @@ -1,99 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * SPI OF support routines | ||
| 3 | * Copyright (C) 2008 Secret Lab Technologies Ltd. | ||
| 4 | * | ||
| 5 | * Support routines for deriving SPI device attachments from the device | ||
| 6 | * tree. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include <linux/module.h> | ||
| 10 | #include <linux/of.h> | ||
| 11 | #include <linux/device.h> | ||
| 12 | #include <linux/spi/spi.h> | ||
| 13 | #include <linux/of_irq.h> | ||
| 14 | #include <linux/of_spi.h> | ||
| 15 | |||
| 16 | /** | ||
| 17 | * of_register_spi_devices - Register child devices onto the SPI bus | ||
| 18 | * @master: Pointer to spi_master device | ||
| 19 | * | ||
| 20 | * Registers an spi_device for each child node of master node which has a 'reg' | ||
| 21 | * property. | ||
| 22 | */ | ||
| 23 | void of_register_spi_devices(struct spi_master *master) | ||
| 24 | { | ||
| 25 | struct spi_device *spi; | ||
| 26 | struct device_node *nc; | ||
| 27 | const __be32 *prop; | ||
| 28 | int rc; | ||
| 29 | int len; | ||
| 30 | |||
| 31 | if (!master->dev.of_node) | ||
| 32 | return; | ||
| 33 | |||
| 34 | for_each_child_of_node(master->dev.of_node, nc) { | ||
| 35 | /* Alloc an spi_device */ | ||
| 36 | spi = spi_alloc_device(master); | ||
| 37 | if (!spi) { | ||
| 38 | dev_err(&master->dev, "spi_device alloc error for %s\n", | ||
| 39 | nc->full_name); | ||
| 40 | spi_dev_put(spi); | ||
| 41 | continue; | ||
| 42 | } | ||
| 43 | |||
| 44 | /* Select device driver */ | ||
| 45 | if (of_modalias_node(nc, spi->modalias, | ||
| 46 | sizeof(spi->modalias)) < 0) { | ||
| 47 | dev_err(&master->dev, "cannot find modalias for %s\n", | ||
| 48 | nc->full_name); | ||
| 49 | spi_dev_put(spi); | ||
| 50 | continue; | ||
| 51 | } | ||
| 52 | |||
| 53 | /* Device address */ | ||
| 54 | prop = of_get_property(nc, "reg", &len); | ||
| 55 | if (!prop || len < sizeof(*prop)) { | ||
| 56 | dev_err(&master->dev, "%s has no 'reg' property\n", | ||
| 57 | nc->full_name); | ||
| 58 | spi_dev_put(spi); | ||
| 59 | continue; | ||
| 60 | } | ||
| 61 | spi->chip_select = be32_to_cpup(prop); | ||
| 62 | |||
| 63 | /* Mode (clock phase/polarity/etc.) */ | ||
| 64 | if (of_find_property(nc, "spi-cpha", NULL)) | ||
| 65 | spi->mode |= SPI_CPHA; | ||
| 66 | if (of_find_property(nc, "spi-cpol", NULL)) | ||
| 67 | spi->mode |= SPI_CPOL; | ||
| 68 | if (of_find_property(nc, "spi-cs-high", NULL)) | ||
| 69 | spi->mode |= SPI_CS_HIGH; | ||
| 70 | |||
| 71 | /* Device speed */ | ||
| 72 | prop = of_get_property(nc, "spi-max-frequency", &len); | ||
| 73 | if (!prop || len < sizeof(*prop)) { | ||
| 74 | dev_err(&master->dev, "%s has no 'spi-max-frequency' property\n", | ||
| 75 | nc->full_name); | ||
| 76 | spi_dev_put(spi); | ||
| 77 | continue; | ||
| 78 | } | ||
| 79 | spi->max_speed_hz = be32_to_cpup(prop); | ||
| 80 | |||
| 81 | /* IRQ */ | ||
| 82 | spi->irq = irq_of_parse_and_map(nc, 0); | ||
| 83 | |||
| 84 | /* Store a pointer to the node in the device structure */ | ||
| 85 | of_node_get(nc); | ||
| 86 | spi->dev.of_node = nc; | ||
| 87 | |||
| 88 | /* Register the new device */ | ||
| 89 | request_module(spi->modalias); | ||
| 90 | rc = spi_add_device(spi); | ||
| 91 | if (rc) { | ||
| 92 | dev_err(&master->dev, "spi_device register error %s\n", | ||
| 93 | nc->full_name); | ||
| 94 | spi_dev_put(spi); | ||
| 95 | } | ||
| 96 | |||
| 97 | } | ||
| 98 | } | ||
| 99 | EXPORT_SYMBOL(of_register_spi_devices); | ||
