Commit d3b43e12 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'spi-for-linus' of git://git.secretlab.ca/git/linux-2.6

Pull SPI updates from Grant Likely:
 "Primarily SPI device driver bug fixes, one removal of an old driver,
  and some new tegra support.  There is some core code change too, but
  all in all pretty small stuff.

  The new features to note are:
   - Common code for describing GPIO CS lines in the device tree
   - Remove the SPI_BUFSIZ limitation on spi_write_the_read()
   - core spi ensures bits_per_word is set correctly
   - SPARC can now use SPI"

* tag 'spi-for-linus' of git://git.secretlab.ca/git/linux-2.6: (36 commits)
  spi/sparc: Allow of_register_spi_devices for sparc
  spi: Remove HOTPLUG section attributes
  spi: Add support for specifying 3-wire mode via device tree
  spi: Fix comparison of different integer types
  spi/orion: Add SPI_CHPA and SPI_CPOL support to kirkwood driver.
  spi/sh: Add SH Mobile series as dependency to MSIOF controller
  spi/sh-msiof: Remove unneeded clock name
  spi: Remove SPI_BUFSIZ restriction on spi_write_then_read()
  spi/stmp: remove obsolete driver
  spi/clps711x: New SPI master driver
  spi: omap2-mcspi: remove duplicate inclusion of linux/err.h
  spi: omap2-mcspi: Fix the redifine warning
  spi/sh-hspi: add CS manual control support
  of_spi: add generic binding support to specify cs gpio
  spi: omap2-mcspi: remove duplicated include from spi-omap2-mcspi.c
  spi/bitbang: (cosmetic) simplify list manipulation
  spi/bitbang: avoid needless loop flow manipulations
  spi/omap: fix D0/D1 direction confusion
  spi: tegra: add spi driver for sflash controller
  spi: Dont call master->setup if not populated
  ...
parents 15de0599 7cb94361
NVIDIA Tegra20 SFLASH controller.
Required properties:
- compatible : should be "nvidia,tegra20-sflash".
- reg: Should contain SFLASH registers location and length.
- interrupts: Should contain SFLASH interrupts.
- nvidia,dma-request-selector : The Tegra DMA controller's phandle and
request selector for this SFLASH controller.
Recommended properties:
- spi-max-frequency: Definition as per
Documentation/devicetree/bindings/spi/spi-bus.txt
Example:
spi@7000d600 {
compatible = "nvidia,tegra20-sflash";
reg = <0x7000c380 0x80>;
interrupts = <0 39 0x04>;
nvidia,dma-request-selector = <&apbdma 16>;
spi-max-frequency = <25000000>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};
NVIDIA Tegra20/Tegra30 SLINK controller.
Required properties:
- compatible : should be "nvidia,tegra20-slink", "nvidia,tegra30-slink".
- reg: Should contain SLINK registers location and length.
- interrupts: Should contain SLINK interrupts.
- nvidia,dma-request-selector : The Tegra DMA controller's phandle and
request selector for this SLINK controller.
Recommended properties:
- spi-max-frequency: Definition as per
Documentation/devicetree/bindings/spi/spi-bus.txt
Example:
slink@7000d600 {
compatible = "nvidia,tegra20-slink";
reg = <0x7000d600 0x200>;
interrupts = <0 82 0x04>;
nvidia,dma-request-selector = <&apbdma 16>;
spi-max-frequency = <25000000>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};
...@@ -6,7 +6,9 @@ Required properties: ...@@ -6,7 +6,9 @@ Required properties:
- "ti,omap4-spi" for OMAP4+. - "ti,omap4-spi" for OMAP4+.
- ti,spi-num-cs : Number of chipselect supported by the instance. - ti,spi-num-cs : Number of chipselect supported by the instance.
- ti,hwmods: Name of the hwmod associated to the McSPI - ti,hwmods: Name of the hwmod associated to the McSPI
- ti,pindir-d0-out-d1-in: Select the D0 pin as output and D1 as
input. The default is D0 as input and
D1 as output.
Example: Example:
......
...@@ -12,6 +12,7 @@ The SPI master node requires the following properties: ...@@ -12,6 +12,7 @@ The SPI master node requires the following properties:
- #size-cells - should be zero. - #size-cells - should be zero.
- compatible - name of SPI bus controller following generic names - compatible - name of SPI bus controller following generic names
recommended practice. recommended practice.
- cs-gpios - (optional) gpios chip select.
No other properties are required in the SPI bus node. It is assumed No other properties are required in the SPI bus node. It is assumed
that a driver for an SPI bus device will understand that it is an SPI bus. that a driver for an SPI bus device will understand that it is an SPI bus.
However, the binding does not attempt to define the specific method for However, the binding does not attempt to define the specific method for
...@@ -24,6 +25,22 @@ support describing the chip select layout. ...@@ -24,6 +25,22 @@ support describing the chip select layout.
Optional property: Optional property:
- num-cs : total number of chipselects - num-cs : total number of chipselects
If cs-gpios is used the number of chip select will automatically increased
with max(cs-gpios > hw cs)
So if for example the controller has 2 CS lines, and the cs-gpios
property looks like this:
cs-gpios = <&gpio1 0 0> <0> <&gpio1 1 0> <&gpio1 2 0>;
Then it should be configured so that num_chipselect = 4 with the
following mapping:
cs0 : &gpio1 0 0
cs1 : native
cs2 : &gpio1 1 0
cs3 : &gpio1 2 0
SPI slave nodes must be children of the SPI master node and can SPI slave nodes must be children of the SPI master node and can
contain the following properties. contain the following properties.
- reg - (required) chip select address of device. - reg - (required) chip select address of device.
...@@ -36,6 +53,11 @@ contain the following properties. ...@@ -36,6 +53,11 @@ contain the following properties.
shifted clock phase (CPHA) mode shifted clock phase (CPHA) mode
- spi-cs-high - (optional) Empty property indicating device requires - spi-cs-high - (optional) Empty property indicating device requires
chip select active high chip select active high
- spi-3wire - (optional) Empty property indicating device requires
3-wire mode.
If a gpio chipselect is used for the SPI slave the gpio number will be passed
via the cs_gpio
SPI example for an MPC5200 SPI bus: SPI example for an MPC5200 SPI bus:
spi@f00 { spi@f00 {
......
...@@ -123,6 +123,13 @@ config SPI_BUTTERFLY ...@@ -123,6 +123,13 @@ config SPI_BUTTERFLY
inexpensive battery powered microcontroller evaluation board. inexpensive battery powered microcontroller evaluation board.
This same cable can be used to flash new firmware. This same cable can be used to flash new firmware.
config SPI_CLPS711X
tristate "CLPS711X host SPI controller"
depends on ARCH_CLPS711X
help
This enables dedicated general purpose SPI/Microwire1-compatible
master mode interface (SSI1) for CLPS711X-based CPUs.
config SPI_COLDFIRE_QSPI config SPI_COLDFIRE_QSPI
tristate "Freescale Coldfire QSPI controller" tristate "Freescale Coldfire QSPI controller"
depends on (M520x || M523x || M5249 || M525x || M527x || M528x || M532x) depends on (M520x || M523x || M5249 || M525x || M527x || M528x || M532x)
...@@ -341,10 +348,10 @@ config SPI_SC18IS602 ...@@ -341,10 +348,10 @@ config SPI_SC18IS602
config SPI_SH_MSIOF config SPI_SH_MSIOF
tristate "SuperH MSIOF SPI controller" tristate "SuperH MSIOF SPI controller"
depends on SUPERH && HAVE_CLK depends on (SUPERH || ARCH_SHMOBILE) && HAVE_CLK
select SPI_BITBANG select SPI_BITBANG
help help
SPI driver for SuperH MSIOF blocks. SPI driver for SuperH and SH Mobile MSIOF blocks.
config SPI_SH config SPI_SH
tristate "SuperH SPI controller" tristate "SuperH SPI controller"
...@@ -372,12 +379,6 @@ config SPI_SIRF ...@@ -372,12 +379,6 @@ config SPI_SIRF
help help
SPI driver for CSR SiRFprimaII SoCs SPI driver for CSR SiRFprimaII SoCs
config SPI_STMP3XXX
tristate "Freescale STMP37xx/378x SPI/SSP controller"
depends on ARCH_STMP3XXX
help
SPI driver for Freescale STMP37xx/378x SoC SSP interface
config SPI_MXS config SPI_MXS
tristate "Freescale MXS SPI controller" tristate "Freescale MXS SPI controller"
depends on ARCH_MXS depends on ARCH_MXS
...@@ -385,6 +386,20 @@ config SPI_MXS ...@@ -385,6 +386,20 @@ config SPI_MXS
help help
SPI driver for Freescale MXS devices. SPI driver for Freescale MXS devices.
config SPI_TEGRA20_SFLASH
tristate "Nvidia Tegra20 Serial flash Controller"
depends on ARCH_TEGRA
help
SPI driver for Nvidia Tegra20 Serial flash Controller interface.
The main usecase of this controller is to use spi flash as boot
device.
config SPI_TEGRA20_SLINK
tristate "Nvidia Tegra20/Tegra30 SLINK Controller"
depends on ARCH_TEGRA && TEGRA20_APB_DMA
help
SPI driver for Nvidia Tegra20/Tegra30 SLINK Controller interface.
config SPI_TI_SSP config SPI_TI_SSP
tristate "TI Sequencer Serial Port - SPI Support" tristate "TI Sequencer Serial Port - SPI Support"
depends on MFD_TI_SSP depends on MFD_TI_SSP
......
...@@ -19,6 +19,7 @@ obj-$(CONFIG_SPI_BFIN5XX) += spi-bfin5xx.o ...@@ -19,6 +19,7 @@ obj-$(CONFIG_SPI_BFIN5XX) += spi-bfin5xx.o
obj-$(CONFIG_SPI_BFIN_SPORT) += spi-bfin-sport.o obj-$(CONFIG_SPI_BFIN_SPORT) += spi-bfin-sport.o
obj-$(CONFIG_SPI_BITBANG) += spi-bitbang.o obj-$(CONFIG_SPI_BITBANG) += spi-bitbang.o
obj-$(CONFIG_SPI_BUTTERFLY) += spi-butterfly.o obj-$(CONFIG_SPI_BUTTERFLY) += spi-butterfly.o
obj-$(CONFIG_SPI_CLPS711X) += spi-clps711x.o
obj-$(CONFIG_SPI_COLDFIRE_QSPI) += spi-coldfire-qspi.o obj-$(CONFIG_SPI_COLDFIRE_QSPI) += spi-coldfire-qspi.o
obj-$(CONFIG_SPI_DAVINCI) += spi-davinci.o obj-$(CONFIG_SPI_DAVINCI) += spi-davinci.o
obj-$(CONFIG_SPI_DESIGNWARE) += spi-dw.o obj-$(CONFIG_SPI_DESIGNWARE) += spi-dw.o
...@@ -59,11 +60,11 @@ obj-$(CONFIG_SPI_SH_HSPI) += spi-sh-hspi.o ...@@ -59,11 +60,11 @@ obj-$(CONFIG_SPI_SH_HSPI) += spi-sh-hspi.o
obj-$(CONFIG_SPI_SH_MSIOF) += spi-sh-msiof.o obj-$(CONFIG_SPI_SH_MSIOF) += spi-sh-msiof.o
obj-$(CONFIG_SPI_SH_SCI) += spi-sh-sci.o obj-$(CONFIG_SPI_SH_SCI) += spi-sh-sci.o
obj-$(CONFIG_SPI_SIRF) += spi-sirf.o obj-$(CONFIG_SPI_SIRF) += spi-sirf.o
obj-$(CONFIG_SPI_STMP3XXX) += spi-stmp.o obj-$(CONFIG_SPI_TEGRA20_SFLASH) += spi-tegra20-sflash.o
obj-$(CONFIG_SPI_TEGRA20_SLINK) += spi-tegra20-slink.o
obj-$(CONFIG_SPI_TI_SSP) += spi-ti-ssp.o obj-$(CONFIG_SPI_TI_SSP) += spi-ti-ssp.o
obj-$(CONFIG_SPI_TLE62X0) += spi-tle62x0.o obj-$(CONFIG_SPI_TLE62X0) += spi-tle62x0.o
obj-$(CONFIG_SPI_TOPCLIFF_PCH) += spi-topcliff-pch.o obj-$(CONFIG_SPI_TOPCLIFF_PCH) += spi-topcliff-pch.o
obj-$(CONFIG_SPI_TXX9) += spi-txx9.o obj-$(CONFIG_SPI_TXX9) += spi-txx9.o
obj-$(CONFIG_SPI_XCOMM) += spi-xcomm.o obj-$(CONFIG_SPI_XCOMM) += spi-xcomm.o
obj-$(CONFIG_SPI_XILINX) += spi-xilinx.o obj-$(CONFIG_SPI_XILINX) += spi-xilinx.o
...@@ -215,7 +215,7 @@ static irqreturn_t altera_spi_irq(int irq, void *dev) ...@@ -215,7 +215,7 @@ static irqreturn_t altera_spi_irq(int irq, void *dev)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int __devinit altera_spi_probe(struct platform_device *pdev) static int altera_spi_probe(struct platform_device *pdev)
{ {
struct altera_spi_platform_data *platp = pdev->dev.platform_data; struct altera_spi_platform_data *platp = pdev->dev.platform_data;
struct altera_spi *hw; struct altera_spi *hw;
...@@ -290,7 +290,7 @@ static int __devinit altera_spi_probe(struct platform_device *pdev) ...@@ -290,7 +290,7 @@ static int __devinit altera_spi_probe(struct platform_device *pdev)
return err; return err;
} }
static int __devexit altera_spi_remove(struct platform_device *dev) static int altera_spi_remove(struct platform_device *dev)
{ {
struct altera_spi *hw = platform_get_drvdata(dev); struct altera_spi *hw = platform_get_drvdata(dev);
struct spi_master *master = hw->bitbang.master; struct spi_master *master = hw->bitbang.master;
...@@ -311,7 +311,7 @@ MODULE_DEVICE_TABLE(of, altera_spi_match); ...@@ -311,7 +311,7 @@ MODULE_DEVICE_TABLE(of, altera_spi_match);
static struct platform_driver altera_spi_driver = { static struct platform_driver altera_spi_driver = {
.probe = altera_spi_probe, .probe = altera_spi_probe,
.remove = __devexit_p(altera_spi_remove), .remove = altera_spi_remove,
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -192,7 +192,7 @@ static u32 ath79_spi_txrx_mode0(struct spi_device *spi, unsigned nsecs, ...@@ -192,7 +192,7 @@ static u32 ath79_spi_txrx_mode0(struct spi_device *spi, unsigned nsecs,
return ath79_spi_rr(sp, AR71XX_SPI_REG_RDS); return ath79_spi_rr(sp, AR71XX_SPI_REG_RDS);
} }
static __devinit int ath79_spi_probe(struct platform_device *pdev) static int ath79_spi_probe(struct platform_device *pdev)
{ {
struct spi_master *master; struct spi_master *master;
struct ath79_spi *sp; struct ath79_spi *sp;
...@@ -251,7 +251,7 @@ static __devinit int ath79_spi_probe(struct platform_device *pdev) ...@@ -251,7 +251,7 @@ static __devinit int ath79_spi_probe(struct platform_device *pdev)
return ret; return ret;
} }
static __devexit int ath79_spi_remove(struct platform_device *pdev) static int ath79_spi_remove(struct platform_device *pdev)
{ {
struct ath79_spi *sp = platform_get_drvdata(pdev); struct ath79_spi *sp = platform_get_drvdata(pdev);
...@@ -265,7 +265,7 @@ static __devexit int ath79_spi_remove(struct platform_device *pdev) ...@@ -265,7 +265,7 @@ static __devexit int ath79_spi_remove(struct platform_device *pdev)
static struct platform_driver ath79_spi_driver = { static struct platform_driver ath79_spi_driver = {
.probe = ath79_spi_probe, .probe = ath79_spi_probe,
.remove = __devexit_p(ath79_spi_remove), .remove = ath79_spi_remove,
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -907,7 +907,7 @@ static void atmel_spi_cleanup(struct spi_device *spi) ...@@ -907,7 +907,7 @@ static void atmel_spi_cleanup(struct spi_device *spi)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static int __devinit atmel_spi_probe(struct platform_device *pdev) static int atmel_spi_probe(struct platform_device *pdev)
{ {
struct resource *regs; struct resource *regs;
int irq; int irq;
...@@ -1003,7 +1003,7 @@ static int __devinit atmel_spi_probe(struct platform_device *pdev) ...@@ -1003,7 +1003,7 @@ static int __devinit atmel_spi_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit atmel_spi_remove(struct platform_device *pdev) static int atmel_spi_remove(struct platform_device *pdev)
{ {
struct spi_master *master = platform_get_drvdata(pdev); struct spi_master *master = platform_get_drvdata(pdev);
struct atmel_spi *as = spi_master_get_devdata(master); struct atmel_spi *as = spi_master_get_devdata(master);
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include <bcm63xx_dev_spi.h> #include <bcm63xx_dev_spi.h>
#define PFX KBUILD_MODNAME #define PFX KBUILD_MODNAME
#define DRV_VER "0.1.2"
struct bcm63xx_spi { struct bcm63xx_spi {
struct completion done; struct completion done;
...@@ -170,13 +169,6 @@ static int bcm63xx_spi_setup(struct spi_device *spi) ...@@ -170,13 +169,6 @@ static int bcm63xx_spi_setup(struct spi_device *spi)
return -EINVAL; return -EINVAL;
} }
ret = bcm63xx_spi_check_transfer(spi, NULL);
if (ret < 0) {
dev_err(&spi->dev, "setup: unsupported mode bits %x\n",
spi->mode & ~MODEBITS);
return ret;
}
dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec/bit\n", dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec/bit\n",
__func__, spi->mode & MODEBITS, spi->bits_per_word, 0); __func__, spi->mode & MODEBITS, spi->bits_per_word, 0);
...@@ -337,7 +329,7 @@ static irqreturn_t bcm63xx_spi_interrupt(int irq, void *dev_id) ...@@ -337,7 +329,7 @@ static irqreturn_t bcm63xx_spi_interrupt(int irq, void *dev_id)
} }
static int __devinit bcm63xx_spi_probe(struct platform_device *pdev) static int bcm63xx_spi_probe(struct platform_device *pdev)
{ {
struct resource *r; struct resource *r;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
...@@ -441,8 +433,8 @@ static int __devinit bcm63xx_spi_probe(struct platform_device *pdev) ...@@ -441,8 +433,8 @@ static int __devinit bcm63xx_spi_probe(struct platform_device *pdev)
goto out_clk_disable; goto out_clk_disable;
} }
dev_info(dev, "at 0x%08x (irq %d, FIFOs size %d) v%s\n", dev_info(dev, "at 0x%08x (irq %d, FIFOs size %d)\n",
r->start, irq, bs->fifo_size, DRV_VER); r->start, irq, bs->fifo_size);
return 0; return 0;
...@@ -457,7 +449,7 @@ static int __devinit bcm63xx_spi_probe(struct platform_device *pdev) ...@@ -457,7 +449,7 @@ static int __devinit bcm63xx_spi_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit bcm63xx_spi_remove(struct platform_device *pdev) static int bcm63xx_spi_remove(struct platform_device *pdev)
{ {
struct spi_master *master = spi_master_get(platform_get_drvdata(pdev)); struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
struct bcm63xx_spi *bs = spi_master_get_devdata(master); struct bcm63xx_spi *bs = spi_master_get_devdata(master);
...@@ -485,6 +477,8 @@ static int bcm63xx_spi_suspend(struct device *dev) ...@@ -485,6 +477,8 @@ static int bcm63xx_spi_suspend(struct device *dev)
platform_get_drvdata(to_platform_device(dev)); platform_get_drvdata(to_platform_device(dev));
struct bcm63xx_spi *bs = spi_master_get_devdata(master); struct bcm63xx_spi *bs = spi_master_get_devdata(master);
spi_master_suspend(master);
clk_disable(bs->clk); clk_disable(bs->clk);
return 0; return 0;
...@@ -498,6 +492,8 @@ static int bcm63xx_spi_resume(struct device *dev) ...@@ -498,6 +492,8 @@ static int bcm63xx_spi_resume(struct device *dev)
clk_enable(bs->clk); clk_enable(bs->clk);
spi_master_resume(master);
return 0; return 0;
} }
...@@ -518,7 +514,7 @@ static struct platform_driver bcm63xx_spi_driver = { ...@@ -518,7 +514,7 @@ static struct platform_driver bcm63xx_spi_driver = {
.pm = BCM63XX_SPI_PM_OPS, .pm = BCM63XX_SPI_PM_OPS,
}, },
.probe = bcm63xx_spi_probe, .probe = bcm63xx_spi_probe,
.remove = __devexit_p(bcm63xx_spi_remove), .remove = bcm63xx_spi_remove,
}; };
module_platform_driver(bcm63xx_spi_driver); module_platform_driver(bcm63xx_spi_driver);
......
...@@ -755,8 +755,7 @@ bfin_sport_spi_destroy_queue(struct bfin_sport_spi_master_data *drv_data) ...@@ -755,8 +755,7 @@ bfin_sport_spi_destroy_queue(struct bfin_sport_spi_master_data *drv_data)
return 0; return 0;
} }
static int __devinit static int bfin_sport_spi_probe(struct platform_device *pdev)
bfin_sport_spi_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct bfin5xx_spi_master *platform_info; struct bfin5xx_spi_master *platform_info;
...@@ -863,8 +862,7 @@ bfin_sport_spi_probe(struct platform_device *pdev) ...@@ -863,8 +862,7 @@ bfin_sport_spi_probe(struct platform_device *pdev)
} }
/* stop hardware and remove the driver */ /* stop hardware and remove the driver */
static int __devexit static int bfin_sport_spi_remove(struct platform_device *pdev)
bfin_sport_spi_remove(struct platform_device *pdev)
{ {
struct bfin_sport_spi_master_data *drv_data = platform_get_drvdata(pdev); struct bfin_sport_spi_master_data *drv_data = platform_get_drvdata(pdev);
int status = 0; int status = 0;
...@@ -935,7 +933,7 @@ static struct platform_driver bfin_sport_spi_driver = { ...@@ -935,7 +933,7 @@ static struct platform_driver bfin_sport_spi_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = bfin_sport_spi_probe, .probe = bfin_sport_spi_probe,
.remove = __devexit_p(bfin_sport_spi_remove), .remove = bfin_sport_spi_remove,
.suspend = bfin_sport_spi_suspend, .suspend = bfin_sport_spi_suspend,
.resume = bfin_sport_spi_resume, .resume = bfin_sport_spi_resume,
}; };
......
...@@ -1387,7 +1387,7 @@ static int __init bfin_spi_probe(struct platform_device *pdev) ...@@ -1387,7 +1387,7 @@ static int __init bfin_spi_probe(struct platform_device *pdev)
} }
/* stop hardware and remove the driver */ /* stop hardware and remove the driver */
static int __devexit bfin_spi_remove(struct platform_device *pdev) static int bfin_spi_remove(struct platform_device *pdev)
{ {
struct bfin_spi_master_data *drv_data = platform_get_drvdata(pdev); struct bfin_spi_master_data *drv_data = platform_get_drvdata(pdev);
int status = 0; int status = 0;
...@@ -1477,7 +1477,7 @@ static struct platform_driver bfin_spi_driver = { ...@@ -1477,7 +1477,7 @@ static struct platform_driver bfin_spi_driver = {
}, },
.suspend = bfin_spi_suspend, .suspend = bfin_spi_suspend,
.resume = bfin_spi_resume, .resume = bfin_spi_resume,
.remove = __devexit_p(bfin_spi_remove), .remove = bfin_spi_remove,
}; };
static int __init bfin_spi_init(void) static int __init bfin_spi_init(void)
......
...@@ -260,11 +260,11 @@ static void bitbang_work(struct work_struct *work) ...@@ -260,11 +260,11 @@ static void bitbang_work(struct work_struct *work)
struct spi_bitbang *bitbang = struct spi_bitbang *bitbang =
container_of(work, struct spi_bitbang, work); container_of(work, struct spi_bitbang, work);
unsigned long flags; unsigned long flags;
struct spi_message *m, *_m;
spin_lock_irqsave(&bitbang->lock, flags); spin_lock_irqsave(&bitbang->lock, flags);
bitbang->busy = 1; bitbang->busy = 1;
while (!list_empty(&bitbang->queue)) { list_for_each_entry_safe(m, _m, &bitbang->queue, queue) {
struct spi_message *m;
struct spi_device *spi; struct spi_device *spi;
unsigned nsecs; unsigned nsecs;
struct spi_transfer *t = NULL; struct spi_transfer *t = NULL;
...@@ -273,9 +273,7 @@ static void bitbang_work(struct work_struct *work) ...@@ -273,9 +273,7 @@ static void bitbang_work(struct work_struct *work)
int status; int status;
int do_setup = -1; int do_setup = -1;
m = container_of(bitbang->queue.next, struct spi_message, list_del(&m->queue);
queue);
list_del_init(&m->queue);
spin_unlock_irqrestore(&bitbang->lock, flags); spin_unlock_irqrestore(&bitbang->lock, flags);
/* FIXME this is made-up ... the correct value is known to /* FIXME this is made-up ... the correct value is known to
...@@ -346,11 +344,7 @@ static void bitbang_work(struct work_struct *work) ...@@ -346,11 +344,7 @@ static void bitbang_work(struct work_struct *work)
if (t->delay_usecs) if (t->delay_usecs)
udelay(t->delay_usecs); udelay(t->delay_usecs);
if (!cs_change) if (cs_change && !list_is_last(&t->transfer_list, &m->transfers)) {
continue;
if (t->transfer_list.next == &m->transfers)
break;
/* sometimes a short mid-message deselect of the chip /* sometimes a short mid-message deselect of the chip
* may be needed to terminate a mode or command * may be needed to terminate a mode or command
*/ */
...@@ -358,6 +352,7 @@ static void bitbang_work(struct work_struct *work) ...@@ -358,6 +352,7 @@ static void bitbang_work(struct work_struct *work)
bitbang->chipselect(spi, BITBANG_CS_INACTIVE); bitbang->chipselect(spi, BITBANG_CS_INACTIVE);
ndelay(nsecs); ndelay(nsecs);
} }
}
m->status = status; m->status = status;
m->complete(m->context); m->complete(m->context);
......
/*
* CLPS711X SPI bus driver
*
* Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/init.h>
#include <linux/gpio.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <linux/platform_data/spi-clps711x.h>
#include <mach/hardware.h>
#define DRIVER_NAME "spi-clps711x"
struct spi_clps711x_data {
struct completion done;
struct clk *spi_clk;
u32 max_speed_hz;
u8 *tx_buf;
u8 *rx_buf;
int count;
int len;
int chipselect[0];
};
static int spi_clps711x_setup(struct spi_device *spi)
{
struct spi_clps711x_data *hw = spi_master_get_devdata(spi->master);
if (spi->bits_per_word != 8) {
dev_err(&spi->dev, "Unsupported master bus width %i\n",
spi->bits_per_word);
return -EINVAL;
}
/* We are expect that SPI-device is not selected */
gpio_direction_output(hw->chipselect[spi->chip_select],
!(spi->mode & SPI_CS_HIGH));
return 0;
}
static void spi_clps711x_setup_mode(struct spi_device *spi)
{
/* Setup edge for transfer */
if (spi->mode & SPI_CPHA)
clps_writew(clps_readw(SYSCON3) | SYSCON3_ADCCKNSEN, SYSCON3);
else
clps_writew(clps_readw(SYSCON3) & ~SYSCON3_ADCCKNSEN, SYSCON3);
}
static int spi_clps711x_setup_xfer(struct spi_device *spi,
struct spi_transfer *xfer)
{
u32 speed = xfer->speed_hz ? : spi->max_speed_hz;
u8 bpw = xfer->bits_per_word ? : spi->bits_per_word;
struct spi_clps711x_data *hw = spi_master_get_devdata(spi->master);
if (bpw != 8) {
dev_err(&spi->dev, "Unsupported master bus width %i\n", bpw);
return -EINVAL;
}
/* Setup SPI frequency divider */
if (!speed || (speed >= hw->max_speed_hz))
clps_writel((clps_readl(SYSCON1) & ~SYSCON1_ADCKSEL_MASK) |
SYSCON1_ADCKSEL(3), SYSCON1);
else if (speed >= (hw->max_speed_hz / 2))
clps_writel((clps_readl(SYSCON1) & ~SYSCON1_ADCKSEL_MASK) |
SYSCON1_ADCKSEL(2), SYSCON1);
else if (speed >= (hw->max_speed_hz / 8))
clps_writel((clps_readl(SYSCON1) & ~SYSCON1_ADCKSEL_MASK) |
SYSCON1_ADCKSEL(1), SYSCON1);
else
clps_writel((clps_readl(SYSCON1) & ~SYSCON1_ADCKSEL_MASK) |
SYSCON1_ADCKSEL(0), SYSCON1);
return 0;
}
static int spi_clps711x_transfer_one_message(struct spi_master *master,
struct spi_message *msg)
{
struct spi_clps711x_data *hw = spi_master_get_devdata(master);
struct spi_transfer *xfer;
int status = 0, cs = hw->chipselect[msg->spi->chip_select];
u32 data;
spi_clps711x_setup_mode(msg->spi);
list_for_each_entry(xfer, &msg->transfers, transfer_list) {
if (spi_clps711x_setup_xfer(msg->spi, xfer)) {
status = -EINVAL;
goto out_xfr;
}
gpio_set_value(cs, !!(msg->spi->mode & SPI_CS_HIGH));
INIT_COMPLETION(hw->done);
hw->count = 0;
hw->len = xfer->len;
hw->tx_buf = (u8 *)xfer->tx_buf;
hw->rx_buf = (u8 *)xfer->rx_buf;
/* Initiate transfer */
data = hw->tx_buf ? hw->tx_buf[hw->count] : 0;
clps_writel(data | SYNCIO_FRMLEN(8) | SYNCIO_TXFRMEN, SYNCIO);
wait_for_completion(&hw->done);
if (xfer->delay_usecs)
udelay(xfer->delay_usecs);
if (xfer->cs_change ||
list_is_last(&xfer->transfer_list, &msg->transfers))
gpio_set_value(cs, !(msg->spi->mode & SPI_CS_HIGH));
msg->actual_length += xfer->len;
}
out_xfr:
msg->status = status;
spi_finalize_current_message(master);
return 0;
}
static irqreturn_t spi_clps711x_isr(int irq, void *dev_id)
{
struct spi_clps711x_data *hw = (struct spi_clps711x_data *)dev_id;
u32 data;
/* Handle RX */
data = clps_readb(SYNCIO);
if (hw->rx_buf)
hw->rx_buf[hw->count] = (u8)data;
hw->count++;
/* Handle TX */
if (hw->count < hw->len) {
data = hw->tx_buf ? hw->tx_buf[hw->count] : 0;
clps_writel(data | SYNCIO_FRMLEN(8) | SYNCIO_TXFRMEN, SYNCIO);
} else
complete(&hw->done);
return IRQ_HANDLED;
}
static int spi_clps711x_probe(struct platform_device *pdev)
{
int i, ret;
struct spi_master *master;
struct spi_clps711x_data *hw;
struct spi_clps711x_pdata *pdata = dev_get_platdata(&pdev->dev);
if (!pdata) {
dev_err(&pdev->dev, "No platform data supplied\n");
return -EINVAL;
}
if (pdata->num_chipselect < 1) {
dev_err(&pdev->dev, "At least one CS must be defined\n");
return -EINVAL;
}
master = spi_alloc_master(&pdev->dev,
sizeof(struct spi_clps711x_data) +
sizeof(int) * pdata->num_chipselect);
if (!master) {
dev_err(&pdev->dev, "SPI allocating memory error\n");
return -ENOMEM;
}
master->bus_num = pdev->id;
master->mode_bits = SPI_CPHA | SPI_CS_HIGH;
master->num_chipselect = pdata->num_chipselect;
master->setup = spi_clps711x_setup;
master->transfer_one_message = spi_clps711x_transfer_one_message;
hw = spi_master_get_devdata(master);
for (i = 0; i < master->num_chipselect; i++) {
hw->chipselect[i] = pdata->chipselect[i];
if (!gpio_is_valid(hw->chipselect[i])) {
dev_err(&pdev->dev, "Invalid CS GPIO %i\n", i);
ret = -EINVAL;
goto err_out;
}
if (gpio_request(hw->chipselect[i], DRIVER_NAME)) {
dev_err(&pdev->dev, "Can't get CS GPIO %i\n", i);
ret = -EINVAL;
goto err_out;
}
}
hw->spi_clk = devm_clk_get(&pdev->dev, "spi");
if (IS_ERR(hw->spi_clk)) {
dev_err(&pdev->dev, "Can't get clocks\n");
ret = PTR_ERR(hw->spi_clk);
goto err_out;
}
hw->max_speed_hz = clk_get_rate(hw->spi_clk);
init_completion(&hw->done);
platform_set_drvdata(pdev, master);
/* Disable extended mode due hardware problems */
clps_writew(clps_readw(SYSCON3) & ~SYSCON3_ADCCON, SYSCON3);
/* Clear possible pending interrupt */
clps_readl(SYNCIO);
ret = devm_request_irq(&pdev->dev, IRQ_SSEOTI, spi_clps711x_isr, 0,
dev_name(&pdev->dev), hw);
if (ret) {
dev_err(&pdev->dev, "Can't request IRQ\n");
clk_put(hw->spi_clk);
goto clk_out;
}
ret = spi_register_master(master);
if (!ret) {
dev_info(&pdev->dev,
"SPI bus driver initialized. Master clock %u Hz\n",
hw->max_speed_hz);
return 0;
}
dev_err(&pdev->dev, "Failed to register master\n");
devm_free_irq(&pdev->dev, IRQ_SSEOTI, hw);
clk_out:
devm_clk_put(&pdev->dev, hw->spi_clk);
err_out:
while (--i >= 0)
if (gpio_is_valid(hw->chipselect[i]))
gpio_free(hw->chipselect[i]);
platform_set_drvdata(pdev, NULL);
spi_master_put(master);
kfree(master);
return ret;
}
static int spi_clps711x_remove(struct platform_device *pdev)
{
int i;
struct spi_master *master = platform_get_drvdata(pdev);
struct spi_clps711x_data *hw = spi_master_get_devdata(master);
devm_free_irq(&pdev->dev, IRQ_SSEOTI, hw);
for (i = 0; i < master->num_chipselect; i++)
if (gpio_is_valid(hw->chipselect[i]))
gpio_free(hw->chipselect[i]);
devm_clk_put(&pdev->dev, hw->spi_clk);
platform_set_drvdata(pdev, NULL);
spi_unregister_master(master);
kfree(master);
return 0;
}
static struct platform_driver clps711x_spi_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
},
.probe = spi_clps711x_probe,
.remove = spi_clps711x_remove,
};
module_platform_driver(clps711x_spi_driver);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Alexander Shiyan <shc_work@mail.ru>");
MODULE_DESCRIPTION("CLPS711X SPI bus driver");
...@@ -401,7 +401,7 @@ static int mcfqspi_setup(struct spi_device *spi) ...@@ -401,7 +401,7 @@ static int mcfqspi_setup(struct spi_device *spi)
return 0; return 0;
} }
static int __devinit mcfqspi_probe(struct platform_device *pdev) static int mcfqspi_probe(struct platform_device *pdev)
{ {
struct spi_master *master; struct spi_master *master;
struct mcfqspi *mcfqspi; struct mcfqspi *mcfqspi;
...@@ -515,7 +515,7 @@ static int __devinit mcfqspi_probe(struct platform_device *pdev) ...@@ -515,7 +515,7 @@ static int __devinit mcfqspi_probe(struct platform_device *pdev)
return status; return status;
} }
static int __devexit mcfqspi_remove(struct platform_device *pdev) static int mcfqspi_remove(struct platform_device *pdev)
{ {
struct spi_master *master = platform_get_drvdata(pdev); struct spi_master *master = platform_get_drvdata(pdev);
struct mcfqspi *mcfqspi = spi_master_get_devdata(master); struct mcfqspi *mcfqspi = spi_master_get_devdata(master);
...@@ -594,7 +594,7 @@ static struct platform_driver mcfqspi_driver = { ...@@ -594,7 +594,7 @@ static struct platform_driver mcfqspi_driver = {
.driver.owner = THIS_MODULE, .driver.owner = THIS_MODULE,
.driver.pm = &mcfqspi_pm, .driver.pm = &mcfqspi_pm,
.probe = mcfqspi_probe, .probe = mcfqspi_probe,
.remove = __devexit_p(mcfqspi_remove), .remove = mcfqspi_remove,
}; };
module_platform_driver(mcfqspi_driver); module_platform_driver(mcfqspi_driver);
......
...@@ -769,7 +769,7 @@ static int davinci_spi_request_dma(struct davinci_spi *dspi) ...@@ -769,7 +769,7 @@ static int davinci_spi_request_dma(struct davinci_spi *dspi)
* It will invoke spi_bitbang_start to create work queue so that client driver * It will invoke spi_bitbang_start to create work queue so that client driver
* can register transfer method to work queue. * can register transfer method to work queue.
*/ */
static int __devinit davinci_spi_probe(struct platform_device *pdev) static int davinci_spi_probe(struct platform_device *pdev)
{ {
struct spi_master *master; struct spi_master *master;
struct davinci_spi *dspi; struct davinci_spi *dspi;
...@@ -952,7 +952,7 @@ static int __devinit davinci_spi_probe(struct platform_device *pdev) ...@@ -952,7 +952,7 @@ static int __devinit davinci_spi_probe(struct platform_device *pdev)
* It will also call spi_bitbang_stop to destroy the work queue which was * It will also call spi_bitbang_stop to destroy the work queue which was
* created by spi_bitbang_start. * created by spi_bitbang_start.
*/ */
static int __devexit davinci_spi_remove(struct platform_device *pdev) static int davinci_spi_remove(struct platform_device *pdev)
{ {
struct davinci_spi *dspi; struct davinci_spi *dspi;
struct spi_master *master; struct spi_master *master;
...@@ -980,7 +980,7 @@ static struct platform_driver davinci_spi_driver = { ...@@ -980,7 +980,7 @@ static struct platform_driver davinci_spi_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = davinci_spi_probe, .probe = davinci_spi_probe,
.remove = __devexit_p(davinci_spi_remove), .remove = davinci_spi_remove,
}; };
module_platform_driver(davinci_spi_driver); module_platform_driver(davinci_spi_driver);
......
...@@ -26,7 +26,7 @@ struct dw_spi_mmio { ...@@ -26,7 +26,7 @@ struct dw_spi_mmio {
struct clk *clk; struct clk *clk;
}; };
static int __devinit dw_spi_mmio_probe(struct platform_device *pdev) static int dw_spi_mmio_probe(struct platform_device *pdev)
{ {
struct dw_spi_mmio *dwsmmio; struct dw_spi_mmio *dwsmmio;
struct dw_spi *dws; struct dw_spi *dws;
...@@ -106,7 +106,7 @@ static int __devinit dw_spi_mmio_probe(struct platform_device *pdev) ...@@ -106,7 +106,7 @@ static int __devinit dw_spi_mmio_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit dw_spi_mmio_remove(struct platform_device *pdev) static int dw_spi_mmio_remove(struct platform_device *pdev)
{ {
struct dw_spi_mmio *dwsmmio = platform_get_drvdata(pdev); struct dw_spi_mmio *dwsmmio = platform_get_drvdata(pdev);
struct resource *mem; struct resource *mem;
...@@ -129,7 +129,7 @@ static int __devexit dw_spi_mmio_remove(struct platform_device *pdev) ...@@ -129,7 +129,7 @@ static int __devexit dw_spi_mmio_remove(struct platform_device *pdev)
static struct platform_driver dw_spi_mmio_driver = { static struct platform_driver dw_spi_mmio_driver = {
.probe = dw_spi_mmio_probe, .probe = dw_spi_mmio_probe,
.remove = __devexit_p(dw_spi_mmio_remove), .remove = dw_spi_mmio_remove,
.driver = { .driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -32,7 +32,7 @@ struct dw_spi_pci { ...@@ -32,7 +32,7 @@ struct dw_spi_pci {
struct dw_spi dws; struct dw_spi dws;
}; };
static int __devinit spi_pci_probe(struct pci_dev *pdev, static int spi_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
struct dw_spi_pci *dwpci; struct dw_spi_pci *dwpci;
...@@ -105,7 +105,7 @@ static int __devinit spi_pci_probe(struct pci_dev *pdev, ...@@ -105,7 +105,7 @@ static int __devinit spi_pci_probe(struct pci_dev *pdev,
return ret; return ret;
} }
static void __devexit spi_pci_remove(struct pci_dev *pdev) static void spi_pci_remove(struct pci_dev *pdev)
{ {
struct dw_spi_pci *dwpci = pci_get_drvdata(pdev); struct dw_spi_pci *dwpci = pci_get_drvdata(pdev);
...@@ -159,7 +159,7 @@ static struct pci_driver dw_spi_driver = { ...@@ -159,7 +159,7 @@ static struct pci_driver dw_spi_driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.id_table = pci_ids, .id_table = pci_ids,
.probe = spi_pci_probe, .probe = spi_pci_probe,
.remove = __devexit_p(spi_pci_remove), .remove = spi_pci_remove,
.suspend = spi_suspend, .suspend = spi_suspend,
.resume = spi_resume, .resume = spi_resume,
}; };
......
...@@ -696,7 +696,7 @@ static void dw_spi_cleanup(struct spi_device *spi) ...@@ -696,7 +696,7 @@ static void dw_spi_cleanup(struct spi_device *spi)
kfree(chip); kfree(chip);
} }
static int __devinit init_queue(struct dw_spi *dws) static int init_queue(struct dw_spi *dws)
{ {
INIT_LIST_HEAD(&dws->queue); INIT_LIST_HEAD(&dws->queue);
spin_lock_init(&dws->lock); spin_lock_init(&dws->lock);
...@@ -795,7 +795,7 @@ static void spi_hw_init(struct dw_spi *dws) ...@@ -795,7 +795,7 @@ static void spi_hw_init(struct dw_spi *dws)
} }
} }
int __devinit dw_spi_add_host(struct dw_spi *dws) int dw_spi_add_host(struct dw_spi *dws)
{ {
struct spi_master *master; struct spi_master *master;
int ret; int ret;
...@@ -877,7 +877,7 @@ int __devinit dw_spi_add_host(struct dw_spi *dws) ...@@ -877,7 +877,7 @@ int __devinit dw_spi_add_host(struct dw_spi *dws)
} }
EXPORT_SYMBOL_GPL(dw_spi_add_host); EXPORT_SYMBOL_GPL(dw_spi_add_host);
void __devexit dw_spi_remove_host(struct dw_spi *dws) void dw_spi_remove_host(struct dw_spi *dws)
{ {
int status = 0; int status = 0;
......
...@@ -1023,7 +1023,7 @@ static void ep93xx_spi_release_dma(struct ep93xx_spi *espi) ...@@ -1023,7 +1023,7 @@ static void ep93xx_spi_release_dma(struct ep93xx_spi *espi)
free_page((unsigned long)espi->zeropage); free_page((unsigned long)espi->zeropage);
} }
static int __devinit ep93xx_spi_probe(struct platform_device *pdev) static int ep93xx_spi_probe(struct platform_device *pdev)
{ {
struct spi_master *master; struct spi_master *master;
struct ep93xx_spi_info *info; struct ep93xx_spi_info *info;
...@@ -1138,7 +1138,7 @@ static int __devinit ep93xx_spi_probe(struct platform_device *pdev) ...@@ -1138,7 +1138,7 @@ static int __devinit ep93xx_spi_probe(struct platform_device *pdev)
return error; return error;
} }
static int __devexit ep93xx_spi_remove(struct platform_device *pdev) static int ep93xx_spi_remove(struct platform_device *pdev)
{ {
struct spi_master *master = platform_get_drvdata(pdev); struct spi_master *master = platform_get_drvdata(pdev);
struct ep93xx_spi *espi = spi_master_get_devdata(master); struct ep93xx_spi *espi = spi_master_get_devdata(master);
...@@ -1180,7 +1180,7 @@ static struct platform_driver ep93xx_spi_driver = { ...@@ -1180,7 +1180,7 @@ static struct platform_driver ep93xx_spi_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = ep93xx_spi_probe, .probe = ep93xx_spi_probe,
.remove = __devexit_p(ep93xx_spi_remove), .remove = ep93xx_spi_remove,
}; };
module_platform_driver(ep93xx_spi_driver); module_platform_driver(ep93xx_spi_driver);
......
...@@ -403,7 +403,7 @@ static int falcon_sflash_xfer_one(struct spi_master *master, ...@@ -403,7 +403,7 @@ static int falcon_sflash_xfer_one(struct spi_master *master,
return 0; return 0;
} }
static int __devinit falcon_sflash_probe(struct platform_device *pdev) static int falcon_sflash_probe(struct platform_device *pdev)
{ {
struct falcon_sflash *priv; struct falcon_sflash *priv;
struct spi_master *master; struct spi_master *master;
...@@ -438,7 +438,7 @@ static int __devinit falcon_sflash_probe(struct platform_device *pdev) ...@@ -438,7 +438,7 @@ static int __devinit falcon_sflash_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit falcon_sflash_remove(struct platform_device *pdev) static int falcon_sflash_remove(struct platform_device *pdev)
{ {
struct falcon_sflash *priv = platform_get_drvdata(pdev); struct falcon_sflash *priv = platform_get_drvdata(pdev);
...@@ -455,7 +455,7 @@ MODULE_DEVICE_TABLE(of, falcon_sflash_match); ...@@ -455,7 +455,7 @@ MODULE_DEVICE_TABLE(of, falcon_sflash_match);
static struct platform_driver falcon_sflash_driver = { static struct platform_driver falcon_sflash_driver = {
.probe = falcon_sflash_probe, .probe = falcon_sflash_probe,
.remove = __devexit_p(falcon_sflash_remove), .remove = falcon_sflash_remove,
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -587,7 +587,7 @@ static void fsl_espi_remove(struct mpc8xxx_spi *mspi) ...@@ -587,7 +587,7 @@ static void fsl_espi_remove(struct mpc8xxx_spi *mspi)
iounmap(mspi->reg_base); iounmap(mspi->reg_base);
} }
static struct spi_master * __devinit fsl_espi_probe(struct device *dev, static struct spi_master * fsl_espi_probe(struct device *dev,
struct resource *mem, unsigned int irq) struct resource *mem, unsigned int irq)
{ {
struct fsl_spi_platform_data *pdata = dev->platform_data; struct fsl_spi_platform_data *pdata = dev->platform_data;
...@@ -686,7 +686,7 @@ static int of_fsl_espi_get_chipselects(struct device *dev) ...@@ -686,7 +686,7 @@ static int of_fsl_espi_get_chipselects(struct device *dev)
return 0; return 0;
} }
static int __devinit of_fsl_espi_probe(struct platform_device *ofdev) static int of_fsl_espi_probe(struct platform_device *ofdev)
{ {
struct device *dev = &ofdev->dev; struct device *dev = &ofdev->dev;
struct device_node *np = ofdev->dev.of_node; struct device_node *np = ofdev->dev.of_node;
...@@ -725,7 +725,7 @@ static int __devinit of_fsl_espi_probe(struct platform_device *ofdev) ...@@ -725,7 +725,7 @@ static int __devinit of_fsl_espi_probe(struct platform_device *ofdev)
return ret; return ret;
} }
static int __devexit of_fsl_espi_remove(struct platform_device *dev) static int of_fsl_espi_remove(struct platform_device *dev)
{ {
return mpc8xxx_spi_remove(&dev->dev); return mpc8xxx_spi_remove(&dev->dev);
} }
...@@ -743,7 +743,7 @@ static struct platform_driver fsl_espi_driver = { ...@@ -743,7 +743,7 @@ static struct platform_driver fsl_espi_driver = {
.of_match_table = of_fsl_espi_match, .of_match_table = of_fsl_espi_match,
}, },
.probe = of_fsl_espi_probe, .probe = of_fsl_espi_probe,
.remove = __devexit_p(of_fsl_espi_remove), .remove = of_fsl_espi_remove,
}; };
module_platform_driver(fsl_espi_driver); module_platform_driver(fsl_espi_driver);
......
...@@ -169,7 +169,7 @@ int mpc8xxx_spi_probe(struct device *dev, struct resource *mem, ...@@ -169,7 +169,7 @@ int mpc8xxx_spi_probe(struct device *dev, struct resource *mem,
return ret; return ret;
} }
int __devexit mpc8xxx_spi_remove(struct device *dev) int mpc8xxx_spi_remove(struct device *dev)
{ {
struct mpc8xxx_spi *mpc8xxx_spi; struct mpc8xxx_spi *mpc8xxx_spi;
struct spi_master *master; struct spi_master *master;
...@@ -189,7 +189,7 @@ int __devexit mpc8xxx_spi_remove(struct device *dev) ...@@ -189,7 +189,7 @@ int __devexit mpc8xxx_spi_remove(struct device *dev)
return 0; return 0;
} }
int __devinit of_mpc8xxx_spi_probe(struct platform_device *ofdev) int of_mpc8xxx_spi_probe(struct platform_device *ofdev)
{ {
struct device *dev = &ofdev->dev; struct device *dev = &ofdev->dev;
struct device_node *np = ofdev->dev.of_node; struct device_node *np = ofdev->dev.of_node;
......
...@@ -843,7 +843,7 @@ static void fsl_spi_remove(struct mpc8xxx_spi *mspi) ...@@ -843,7 +843,7 @@ static void fsl_spi_remove(struct mpc8xxx_spi *mspi)
fsl_spi_cpm_free(mspi); fsl_spi_cpm_free(mspi);
} }
static struct spi_master * __devinit fsl_spi_probe(struct device *dev, static struct spi_master * fsl_spi_probe(struct device *dev,
struct resource *mem, unsigned int irq) struct resource *mem, unsigned int irq)
{ {
struct fsl_spi_platform_data *pdata = dev->platform_data; struct fsl_spi_platform_data *pdata = dev->platform_data;
...@@ -1041,7 +1041,7 @@ static int of_fsl_spi_free_chipselects(struct device *dev) ...@@ -1041,7 +1041,7 @@ static int of_fsl_spi_free_chipselects(struct device *dev)
return 0; return 0;
} }
static int __devinit of_fsl_spi_probe(struct platform_device *ofdev) static int of_fsl_spi_probe(struct platform_device *ofdev)
{ {
struct device *dev = &ofdev->dev; struct device *dev = &ofdev->dev;
struct device_node *np = ofdev->dev.of_node; struct device_node *np = ofdev->dev.of_node;
...@@ -1081,7 +1081,7 @@ static int __devinit of_fsl_spi_probe(struct platform_device *ofdev) ...@@ -1081,7 +1081,7 @@ static int __devinit of_fsl_spi_probe(struct platform_device *ofdev)
return ret; return ret;
} }
static int __devexit of_fsl_spi_remove(struct platform_device *ofdev) static int of_fsl_spi_remove(struct platform_device *ofdev)
{ {
int ret; int ret;
...@@ -1105,7 +1105,7 @@ static struct platform_driver of_fsl_spi_driver = { ...@@ -1105,7 +1105,7 @@ static struct platform_driver of_fsl_spi_driver = {
.of_match_table = of_fsl_spi_match, .of_match_table = of_fsl_spi_match,
}, },
.probe = of_fsl_spi_probe, .probe = of_fsl_spi_probe,
.remove = __devexit_p(of_fsl_spi_remove), .remove = of_fsl_spi_remove,
}; };
#ifdef CONFIG_MPC832x_RDB #ifdef CONFIG_MPC832x_RDB
...@@ -1116,7 +1116,7 @@ static struct platform_driver of_fsl_spi_driver = { ...@@ -1116,7 +1116,7 @@ static struct platform_driver of_fsl_spi_driver = {
* tree can work with OpenFirmware driver. But for now we support old trees * tree can work with OpenFirmware driver. But for now we support old trees
* as well. * as well.
*/ */
static int __devinit plat_mpc8xxx_spi_probe(struct platform_device *pdev) static int plat_mpc8xxx_spi_probe(struct platform_device *pdev)
{ {
struct resource *mem; struct resource *mem;
int irq; int irq;
...@@ -1139,7 +1139,7 @@ static int __devinit plat_mpc8xxx_spi_probe(struct platform_device *pdev) ...@@ -1139,7 +1139,7 @@ static int __devinit plat_mpc8xxx_spi_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int __devexit plat_mpc8xxx_spi_remove(struct platform_device *pdev) static int plat_mpc8xxx_spi_remove(struct platform_device *pdev)
{ {
return mpc8xxx_spi_remove(&pdev->dev); return mpc8xxx_spi_remove(&pdev->dev);
} }
...@@ -1147,7 +1147,7 @@ static int __devexit plat_mpc8xxx_spi_remove(struct platform_device *pdev) ...@@ -1147,7 +1147,7 @@ static int __devexit plat_mpc8xxx_spi_remove(struct platform_device *pdev)
MODULE_ALIAS("platform:mpc8xxx_spi"); MODULE_ALIAS("platform:mpc8xxx_spi");
static struct platform_driver mpc8xxx_spi_driver = { static struct platform_driver mpc8xxx_spi_driver = {
.probe = plat_mpc8xxx_spi_probe, .probe = plat_mpc8xxx_spi_probe,
.remove = __devexit_p(plat_mpc8xxx_spi_remove), .remove = plat_mpc8xxx_spi_remove,
.driver = { .driver = {
.name = "mpc8xxx_spi", .name = "mpc8xxx_spi",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -287,7 +287,7 @@ static void spi_gpio_cleanup(struct spi_device *spi) ...@@ -287,7 +287,7 @@ static void spi_gpio_cleanup(struct spi_device *spi)
spi_bitbang_cleanup(spi); spi_bitbang_cleanup(spi);
} }
static int __devinit spi_gpio_alloc(unsigned pin, const char *label, bool is_in) static int spi_gpio_alloc(unsigned pin, const char *label, bool is_in)
{ {
int value; int value;
...@@ -301,9 +301,8 @@ static int __devinit spi_gpio_alloc(unsigned pin, const char *label, bool is_in) ...@@ -301,9 +301,8 @@ static int __devinit spi_gpio_alloc(unsigned pin, const char *label, bool is_in)
return value; return value;
} }
static int __devinit static int spi_gpio_request(struct spi_gpio_platform_data *pdata,
spi_gpio_request(struct spi_gpio_platform_data *pdata, const char *label, const char *label, u16 *res_flags)
u16 *res_flags)
{ {
int value; int value;
...@@ -392,7 +391,7 @@ static inline int spi_gpio_probe_dt(struct platform_device *pdev) ...@@ -392,7 +391,7 @@ static inline int spi_gpio_probe_dt(struct platform_device *pdev)
} }
#endif #endif
static int __devinit spi_gpio_probe(struct platform_device *pdev) static int spi_gpio_probe(struct platform_device *pdev)
{ {
int status; int status;
struct spi_master *master; struct spi_master *master;
...@@ -485,7 +484,7 @@ static int __devinit spi_gpio_probe(struct platform_device *pdev) ...@@ -485,7 +484,7 @@ static int __devinit spi_gpio_probe(struct platform_device *pdev)
return status; return status;
} }
static int __devexit spi_gpio_remove(struct platform_device *pdev) static int spi_gpio_remove(struct platform_device *pdev)
{ {
struct spi_gpio *spi_gpio; struct spi_gpio *spi_gpio;
struct spi_gpio_platform_data *pdata; struct spi_gpio_platform_data *pdata;
...@@ -518,7 +517,7 @@ static struct platform_driver spi_gpio_driver = { ...@@ -518,7 +517,7 @@ static struct platform_driver spi_gpio_driver = {
.of_match_table = of_match_ptr(spi_gpio_dt_ids), .of_match_table = of_match_ptr(spi_gpio_dt_ids),
}, },
.probe = spi_gpio_probe, .probe = spi_gpio_probe,
.remove = __devexit_p(spi_gpio_remove), .remove = spi_gpio_remove,
}; };
module_platform_driver(spi_gpio_driver); module_platform_driver(spi_gpio_driver);
......
...@@ -750,7 +750,7 @@ static void spi_imx_cleanup(struct spi_device *spi) ...@@ -750,7 +750,7 @@ static void spi_imx_cleanup(struct spi_device *spi)
{ {
} }
static int __devinit spi_imx_probe(struct platform_device *pdev) static int spi_imx_probe(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
const struct of_device_id *of_id = const struct of_device_id *of_id =
...@@ -906,7 +906,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) ...@@ -906,7 +906,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit spi_imx_remove(struct platform_device *pdev) static int spi_imx_remove(struct platform_device *pdev)
{ {
struct spi_master *master = platform_get_drvdata(pdev); struct spi_master *master = platform_get_drvdata(pdev);
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
...@@ -942,7 +942,7 @@ static struct platform_driver spi_imx_driver = { ...@@ -942,7 +942,7 @@ static struct platform_driver spi_imx_driver = {
}, },
.id_table = spi_imx_devtype, .id_table = spi_imx_devtype,
.probe = spi_imx_probe, .probe = spi_imx_probe,
.remove = __devexit_p(spi_imx_remove), .remove = spi_imx_remove,
}; };
module_platform_driver(spi_imx_driver); module_platform_driver(spi_imx_driver);
......
...@@ -406,7 +406,7 @@ static irqreturn_t mpc512x_psc_spi_isr(int irq, void *dev_id) ...@@ -406,7 +406,7 @@ static irqreturn_t mpc512x_psc_spi_isr(int irq, void *dev_id)
} }
/* bus_num is used only for the case dev->platform_data == NULL */ /* bus_num is used only for the case dev->platform_data == NULL */
static int __devinit mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
u32 size, unsigned int irq, u32 size, unsigned int irq,
s16 bus_num) s16 bus_num)
{ {
...@@ -492,7 +492,7 @@ static int __devinit mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, ...@@ -492,7 +492,7 @@ static int __devinit mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
return ret; return ret;
} }
static int __devexit mpc512x_psc_spi_do_remove(struct device *dev) static int mpc512x_psc_spi_do_remove(struct device *dev)
{ {
struct spi_master *master = spi_master_get(dev_get_drvdata(dev)); struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
struct mpc512x_psc_spi *mps = spi_master_get_devdata(master); struct mpc512x_psc_spi *mps = spi_master_get_devdata(master);
...@@ -508,7 +508,7 @@ static int __devexit mpc512x_psc_spi_do_remove(struct device *dev) ...@@ -508,7 +508,7 @@ static int __devexit mpc512x_psc_spi_do_remove(struct device *dev)
return 0; return 0;
} }
static int __devinit mpc512x_psc_spi_of_probe(struct platform_device *op) static int mpc512x_psc_spi_of_probe(struct platform_device *op)
{ {
const u32 *regaddr_p; const u32 *regaddr_p;
u64 regaddr64, size64; u64 regaddr64, size64;
...@@ -539,7 +539,7 @@ static int __devinit mpc512x_psc_spi_of_probe(struct platform_device *op) ...@@ -539,7 +539,7 @@ static int __devinit mpc512x_psc_spi_of_probe(struct platform_device *op)
irq_of_parse_and_map(op->dev.of_node, 0), id); irq_of_parse_and_map(op->dev.of_node, 0), id);
} }
static int __devexit mpc512x_psc_spi_of_remove(struct platform_device *op) static int mpc512x_psc_spi_of_remove(struct platform_device *op)
{ {
return mpc512x_psc_spi_do_remove(&op->dev); return mpc512x_psc_spi_do_remove(&op->dev);
} }
...@@ -553,7 +553,7 @@ MODULE_DEVICE_TABLE(of, mpc512x_psc_spi_of_match); ...@@ -553,7 +553,7 @@ MODULE_DEVICE_TABLE(of, mpc512x_psc_spi_of_match);
static struct platform_driver mpc512x_psc_spi_of_driver = { static struct platform_driver mpc512x_psc_spi_of_driver = {
.probe = mpc512x_psc_spi_of_probe, .probe = mpc512x_psc_spi_of_probe,
.remove = __devexit_p(mpc512x_psc_spi_of_remove), .remove = mpc512x_psc_spi_of_remove,
.driver = { .driver = {
.name = "mpc512x-psc-spi", .name = "mpc512x-psc-spi",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -363,7 +363,7 @@ static irqreturn_t mpc52xx_psc_spi_isr(int irq, void *dev_id) ...@@ -363,7 +363,7 @@ static irqreturn_t mpc52xx_psc_spi_isr(int irq, void *dev_id)
} }
/* bus_num is used only for the case dev->platform_data == NULL */ /* bus_num is used only for the case dev->platform_data == NULL */
static int __devinit mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr, static int mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr,
u32 size, unsigned int irq, s16 bus_num) u32 size, unsigned int irq, s16 bus_num)
{ {
struct fsl_spi_platform_data *pdata = dev->platform_data; struct fsl_spi_platform_data *pdata = dev->platform_data;
...@@ -450,7 +450,7 @@ static int __devinit mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr, ...@@ -450,7 +450,7 @@ static int __devinit mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr,
return ret; return ret;
} }
static int __devinit mpc52xx_psc_spi_of_probe(struct platform_device *op) static int mpc52xx_psc_spi_of_probe(struct platform_device *op)
{ {
const u32 *regaddr_p; const u32 *regaddr_p;
u64 regaddr64, size64; u64 regaddr64, size64;
...@@ -479,7 +479,7 @@ static int __devinit mpc52xx_psc_spi_of_probe(struct platform_device *op) ...@@ -479,7 +479,7 @@ static int __devinit mpc52xx_psc_spi_of_probe(struct platform_device *op)
irq_of_parse_and_map(op->dev.of_node, 0), id); irq_of_parse_and_map(op->dev.of_node, 0), id);
} }
static int __devexit mpc52xx_psc_spi_of_remove(struct platform_device *op) static int mpc52xx_psc_spi_of_remove(struct platform_device *op)
{ {
struct spi_master *master = spi_master_get(dev_get_drvdata(&op->dev)); struct spi_master *master = spi_master_get(dev_get_drvdata(&op->dev));
struct mpc52xx_psc_spi *mps = spi_master_get_devdata(master); struct mpc52xx_psc_spi *mps = spi_master_get_devdata(master);
...@@ -505,7 +505,7 @@ MODULE_DEVICE_TABLE(of, mpc52xx_psc_spi_of_match); ...@@ -505,7 +505,7 @@ MODULE_DEVICE_TABLE(of, mpc52xx_psc_spi_of_match);
static struct platform_driver mpc52xx_psc_spi_of_driver = { static struct platform_driver mpc52xx_psc_spi_of_driver = {
.probe = mpc52xx_psc_spi_of_probe, .probe = mpc52xx_psc_spi_of_probe,
.remove = __devexit_p(mpc52xx_psc_spi_of_remove), .remove = mpc52xx_psc_spi_of_remove,
.driver = { .driver = {
.name = "mpc52xx-psc-spi", .name = "mpc52xx-psc-spi",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -390,7 +390,7 @@ static int mpc52xx_spi_transfer(struct spi_device *spi, struct spi_message *m) ...@@ -390,7 +390,7 @@ static int mpc52xx_spi_transfer(struct spi_device *spi, struct spi_message *m)
/* /*
* OF Platform Bus Binding * OF Platform Bus Binding
*/ */
static int __devinit mpc52xx_spi_probe(struct platform_device *op) static int mpc52xx_spi_probe(struct platform_device *op)
{ {
struct spi_master *master; struct spi_master *master;
struct mpc52xx_spi *ms; struct mpc52xx_spi *ms;
...@@ -527,7 +527,7 @@ static int __devinit mpc52xx_spi_probe(struct platform_device *op) ...@@ -527,7 +527,7 @@ static int __devinit mpc52xx_spi_probe(struct platform_device *op)
return rc; return rc;
} }
static int __devexit mpc52xx_spi_remove(struct platform_device *op) static int mpc52xx_spi_remove(struct platform_device *op)
{ {
struct spi_master *master = spi_master_get(dev_get_drvdata(&op->dev)); struct spi_master *master = spi_master_get(dev_get_drvdata(&op->dev));
struct mpc52xx_spi *ms = spi_master_get_devdata(master); struct mpc52xx_spi *ms = spi_master_get_devdata(master);
...@@ -547,7 +547,7 @@ static int __devexit mpc52xx_spi_remove(struct platform_device *op) ...@@ -547,7 +547,7 @@ static int __devexit mpc52xx_spi_remove(struct platform_device *op)
return 0; return 0;
} }
static const struct of_device_id mpc52xx_spi_match[] __devinitconst = { static const struct of_device_id mpc52xx_spi_match[] = {
{ .compatible = "fsl,mpc5200-spi", }, { .compatible = "fsl,mpc5200-spi", },
{} {}
}; };
...@@ -560,6 +560,6 @@ static struct platform_driver mpc52xx_spi_of_driver = { ...@@ -560,6 +560,6 @@ static struct platform_driver mpc52xx_spi_of_driver = {
.of_match_table = mpc52xx_spi_match, .of_match_table = mpc52xx_spi_match,
}, },
.probe = mpc52xx_spi_probe, .probe = mpc52xx_spi_probe,
.remove = __devexit_p(mpc52xx_spi_remove), .remove = mpc52xx_spi_remove,
}; };
module_platform_driver(mpc52xx_spi_of_driver); module_platform_driver(mpc52xx_spi_of_driver);
...@@ -509,7 +509,7 @@ static const struct of_device_id mxs_spi_dt_ids[] = { ...@@ -509,7 +509,7 @@ static const struct of_device_id mxs_spi_dt_ids[] = {
}; };
MODULE_DEVICE_TABLE(of, mxs_spi_dt_ids); MODULE_DEVICE_TABLE(of, mxs_spi_dt_ids);
static int __devinit mxs_spi_probe(struct platform_device *pdev) static int mxs_spi_probe(struct platform_device *pdev)
{ {
const struct of_device_id *of_id = const struct of_device_id *of_id =
of_match_device(mxs_spi_dt_ids, &pdev->dev); of_match_device(mxs_spi_dt_ids, &pdev->dev);
...@@ -636,7 +636,7 @@ static int __devinit mxs_spi_probe(struct platform_device *pdev) ...@@ -636,7 +636,7 @@ static int __devinit mxs_spi_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit mxs_spi_remove(struct platform_device *pdev) static int mxs_spi_remove(struct platform_device *pdev)
{ {
struct spi_master *master; struct spi_master *master;
struct mxs_spi *spi; struct mxs_spi *spi;
...@@ -659,7 +659,7 @@ static int __devexit mxs_spi_remove(struct platform_device *pdev) ...@@ -659,7 +659,7 @@ static int __devexit mxs_spi_remove(struct platform_device *pdev)
static struct platform_driver mxs_spi_driver = { static struct platform_driver mxs_spi_driver = {
.probe = mxs_spi_probe, .probe = mxs_spi_probe,
.remove = __devexit_p(mxs_spi_remove), .remove = mxs_spi_remove,
.driver = { .driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -346,7 +346,7 @@ static void nuc900_init_spi(struct nuc900_spi *hw) ...@@ -346,7 +346,7 @@ static void nuc900_init_spi(struct nuc900_spi *hw)
nuc900_enable_int(hw); nuc900_enable_int(hw);
} }
static int __devinit nuc900_spi_probe(struct platform_device *pdev) static int nuc900_spi_probe(struct platform_device *pdev)
{ {
struct nuc900_spi *hw; struct nuc900_spi *hw;
struct spi_master *master; struct spi_master *master;
...@@ -453,7 +453,7 @@ static int __devinit nuc900_spi_probe(struct platform_device *pdev) ...@@ -453,7 +453,7 @@ static int __devinit nuc900_spi_probe(struct platform_device *pdev)
return err; return err;
} }
static int __devexit nuc900_spi_remove(struct platform_device *dev) static int nuc900_spi_remove(struct platform_device *dev)
{ {
struct nuc900_spi *hw = platform_get_drvdata(dev); struct nuc900_spi *hw = platform_get_drvdata(dev);
...@@ -477,7 +477,7 @@ static int __devexit nuc900_spi_remove(struct platform_device *dev) ...@@ -477,7 +477,7 @@ static int __devexit nuc900_spi_remove(struct platform_device *dev)
static struct platform_driver nuc900_spi_driver = { static struct platform_driver nuc900_spi_driver = {
.probe = nuc900_spi_probe, .probe = nuc900_spi_probe,
.remove = __devexit_p(nuc900_spi_remove), .remove = nuc900_spi_remove,
.driver = { .driver = {
.name = "nuc900-spi", .name = "nuc900-spi",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -243,7 +243,7 @@ static irqreturn_t tiny_spi_irq(int irq, void *dev) ...@@ -243,7 +243,7 @@ static irqreturn_t tiny_spi_irq(int irq, void *dev)
#ifdef CONFIG_OF #ifdef CONFIG_OF
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
static int __devinit tiny_spi_of_probe(struct platform_device *pdev) static int tiny_spi_of_probe(struct platform_device *pdev)
{ {
struct tiny_spi *hw = platform_get_drvdata(pdev); struct tiny_spi *hw = platform_get_drvdata(pdev);
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
...@@ -277,13 +277,13 @@ static int __devinit tiny_spi_of_probe(struct platform_device *pdev) ...@@ -277,13 +277,13 @@ static int __devinit tiny_spi_of_probe(struct platform_device *pdev)
return 0; return 0;
} }
#else /* !CONFIG_OF */ #else /* !CONFIG_OF */
static int __devinit tiny_spi_of_probe(struct platform_device *pdev) static int tiny_spi_of_probe(struct platform_device *pdev)
{ {
return 0; return 0;
} }
#endif /* CONFIG_OF */ #endif /* CONFIG_OF */
static int __devinit tiny_spi_probe(struct platform_device *pdev) static int tiny_spi_probe(struct platform_device *pdev)
{ {
struct tiny_spi_platform_data *platp = pdev->dev.platform_data; struct tiny_spi_platform_data *platp = pdev->dev.platform_data;
struct tiny_spi *hw; struct tiny_spi *hw;
...@@ -373,7 +373,7 @@ static int __devinit tiny_spi_probe(struct platform_device *pdev) ...@@ -373,7 +373,7 @@ static int __devinit tiny_spi_probe(struct platform_device *pdev)
return err; return err;
} }
static int __devexit tiny_spi_remove(struct platform_device *pdev) static int tiny_spi_remove(struct platform_device *pdev)
{ {
struct tiny_spi *hw = platform_get_drvdata(pdev); struct tiny_spi *hw = platform_get_drvdata(pdev);
struct spi_master *master = hw->bitbang.master; struct spi_master *master = hw->bitbang.master;
...@@ -399,7 +399,7 @@ MODULE_DEVICE_TABLE(of, tiny_spi_match); ...@@ -399,7 +399,7 @@ MODULE_DEVICE_TABLE(of, tiny_spi_match);
static struct platform_driver tiny_spi_driver = { static struct platform_driver tiny_spi_driver = {
.probe = tiny_spi_probe, .probe = tiny_spi_probe,
.remove = __devexit_p(tiny_spi_remove), .remove = tiny_spi_remove,
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -266,7 +266,7 @@ static int octeon_spi_nop_transfer_hardware(struct spi_master *master) ...@@ -266,7 +266,7 @@ static int octeon_spi_nop_transfer_hardware(struct spi_master *master)
return 0; return 0;
} }
static int __devinit octeon_spi_probe(struct platform_device *pdev) static int octeon_spi_probe(struct platform_device *pdev)
{ {
struct resource *res_mem; struct resource *res_mem;
...@@ -326,7 +326,7 @@ static int __devinit octeon_spi_probe(struct platform_device *pdev) ...@@ -326,7 +326,7 @@ static int __devinit octeon_spi_probe(struct platform_device *pdev)
return err; return err;
} }
static int __devexit octeon_spi_remove(struct platform_device *pdev) static int octeon_spi_remove(struct platform_device *pdev)
{ {
struct octeon_spi *p = platform_get_drvdata(pdev); struct octeon_spi *p = platform_get_drvdata(pdev);
u64 register_base = p->register_base; u64 register_base = p->register_base;
...@@ -352,7 +352,7 @@ static struct platform_driver octeon_spi_driver = { ...@@ -352,7 +352,7 @@ static struct platform_driver octeon_spi_driver = {
.of_match_table = octeon_spi_match, .of_match_table = octeon_spi_match,
}, },
.probe = octeon_spi_probe, .probe = octeon_spi_probe,
.remove = __devexit_p(octeon_spi_remove), .remove = octeon_spi_remove,
}; };
module_platform_driver(octeon_spi_driver); module_platform_driver(octeon_spi_driver);
......
...@@ -486,7 +486,7 @@ static int __init omap1_spi100k_reset(struct omap1_spi100k *spi100k) ...@@ -486,7 +486,7 @@ static int __init omap1_spi100k_reset(struct omap1_spi100k *spi100k)
return 0; return 0;
} }
static int __devinit omap1_spi100k_probe(struct platform_device *pdev) static int omap1_spi100k_probe(struct platform_device *pdev)
{ {
struct spi_master *master; struct spi_master *master;
struct omap1_spi100k *spi100k; struct omap1_spi100k *spi100k;
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
#include <linux/err.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
...@@ -130,6 +129,7 @@ struct omap2_mcspi { ...@@ -130,6 +129,7 @@ struct omap2_mcspi {
struct omap2_mcspi_dma *dma_channels; struct omap2_mcspi_dma *dma_channels;
struct device *dev; struct device *dev;
struct omap2_mcspi_regs ctx; struct omap2_mcspi_regs ctx;
unsigned int pin_dir:1;
}; };
struct omap2_mcspi_cs { struct omap2_mcspi_cs {
...@@ -323,19 +323,11 @@ static void omap2_mcspi_tx_dma(struct spi_device *spi, ...@@ -323,19 +323,11 @@ static void omap2_mcspi_tx_dma(struct spi_device *spi,
struct omap2_mcspi *mcspi; struct omap2_mcspi *mcspi;
struct omap2_mcspi_dma *mcspi_dma; struct omap2_mcspi_dma *mcspi_dma;
unsigned int count; unsigned int count;
u8 * rx;
const u8 * tx;
void __iomem *chstat_reg;
struct omap2_mcspi_cs *cs = spi->controller_state;
mcspi = spi_master_get_devdata(spi->master); mcspi = spi_master_get_devdata(spi->master);
mcspi_dma = &mcspi->dma_channels[spi->chip_select]; mcspi_dma = &mcspi->dma_channels[spi->chip_select];
count = xfer->len; count = xfer->len;
rx = xfer->rx_buf;
tx = xfer->tx_buf;
chstat_reg = cs->base + OMAP2_MCSPI_CHSTAT0;
if (mcspi_dma->dma_tx) { if (mcspi_dma->dma_tx) {
struct dma_async_tx_descriptor *tx; struct dma_async_tx_descriptor *tx;
struct scatterlist sg; struct scatterlist sg;
...@@ -359,19 +351,6 @@ static void omap2_mcspi_tx_dma(struct spi_device *spi, ...@@ -359,19 +351,6 @@ static void omap2_mcspi_tx_dma(struct spi_device *spi,
dma_async_issue_pending(mcspi_dma->dma_tx); dma_async_issue_pending(mcspi_dma->dma_tx);
omap2_mcspi_set_dma_req(spi, 0, 1); omap2_mcspi_set_dma_req(spi, 0, 1);
wait_for_completion(&mcspi_dma->dma_tx_completion);
dma_unmap_single(mcspi->dev, xfer->tx_dma, count,
DMA_TO_DEVICE);
/* for TX_ONLY mode, be sure all words have shifted out */
if (rx == NULL) {
if (mcspi_wait_for_reg_bit(chstat_reg,
OMAP2_MCSPI_CHSTAT_TXS) < 0)
dev_err(&spi->dev, "TXS timed out\n");
else if (mcspi_wait_for_reg_bit(chstat_reg,
OMAP2_MCSPI_CHSTAT_EOT) < 0)
dev_err(&spi->dev, "EOT timed out\n");
}
} }
static unsigned static unsigned
...@@ -492,6 +471,7 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer) ...@@ -492,6 +471,7 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)
struct dma_slave_config cfg; struct dma_slave_config cfg;
enum dma_slave_buswidth width; enum dma_slave_buswidth width;
unsigned es; unsigned es;
void __iomem *chstat_reg;
mcspi = spi_master_get_devdata(spi->master); mcspi = spi_master_get_devdata(spi->master);
mcspi_dma = &mcspi->dma_channels[spi->chip_select]; mcspi_dma = &mcspi->dma_channels[spi->chip_select];
...@@ -526,8 +506,24 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer) ...@@ -526,8 +506,24 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)
omap2_mcspi_tx_dma(spi, xfer, cfg); omap2_mcspi_tx_dma(spi, xfer, cfg);
if (rx != NULL) if (rx != NULL)
return omap2_mcspi_rx_dma(spi, xfer, cfg, es); count = omap2_mcspi_rx_dma(spi, xfer, cfg, es);
if (tx != NULL) {
chstat_reg = cs->base + OMAP2_MCSPI_CHSTAT0;
wait_for_completion(&mcspi_dma->dma_tx_completion);
dma_unmap_single(mcspi->dev, xfer->tx_dma, xfer->len,
DMA_TO_DEVICE);
/* for TX_ONLY mode, be sure all words have shifted out */
if (rx == NULL) {
if (mcspi_wait_for_reg_bit(chstat_reg,
OMAP2_MCSPI_CHSTAT_TXS) < 0)
dev_err(&spi->dev, "TXS timed out\n");
else if (mcspi_wait_for_reg_bit(chstat_reg,
OMAP2_MCSPI_CHSTAT_EOT) < 0)
dev_err(&spi->dev, "EOT timed out\n");
}
}
return count; return count;
} }
...@@ -765,8 +761,15 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi, ...@@ -765,8 +761,15 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
/* standard 4-wire master mode: SCK, MOSI/out, MISO/in, nCS /* standard 4-wire master mode: SCK, MOSI/out, MISO/in, nCS
* REVISIT: this controller could support SPI_3WIRE mode. * REVISIT: this controller could support SPI_3WIRE mode.
*/ */
l &= ~(OMAP2_MCSPI_CHCONF_IS|OMAP2_MCSPI_CHCONF_DPE1); if (mcspi->pin_dir == MCSPI_PINDIR_D0_IN_D1_OUT) {
l &= ~OMAP2_MCSPI_CHCONF_IS;
l &= ~OMAP2_MCSPI_CHCONF_DPE1;
l |= OMAP2_MCSPI_CHCONF_DPE0; l |= OMAP2_MCSPI_CHCONF_DPE0;
} else {
l |= OMAP2_MCSPI_CHCONF_IS;
l |= OMAP2_MCSPI_CHCONF_DPE1;
l &= ~OMAP2_MCSPI_CHCONF_DPE0;
}
/* wordlength */ /* wordlength */
l &= ~OMAP2_MCSPI_CHCONF_WL_MASK; l &= ~OMAP2_MCSPI_CHCONF_WL_MASK;
...@@ -1085,7 +1088,7 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master, ...@@ -1085,7 +1088,7 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master,
return 0; return 0;
} }
static int __devinit omap2_mcspi_master_setup(struct omap2_mcspi *mcspi) static int omap2_mcspi_master_setup(struct omap2_mcspi *mcspi)
{ {
struct spi_master *master = mcspi->master; struct spi_master *master = mcspi->master;
struct omap2_mcspi_regs *ctx = &mcspi->ctx; struct omap2_mcspi_regs *ctx = &mcspi->ctx;
...@@ -1138,7 +1141,7 @@ static const struct of_device_id omap_mcspi_of_match[] = { ...@@ -1138,7 +1141,7 @@ static const struct of_device_id omap_mcspi_of_match[] = {
}; };
MODULE_DEVICE_TABLE(of, omap_mcspi_of_match); MODULE_DEVICE_TABLE(of, omap_mcspi_of_match);
static int __devinit omap2_mcspi_probe(struct platform_device *pdev) static int omap2_mcspi_probe(struct platform_device *pdev)
{ {
struct spi_master *master; struct spi_master *master;
const struct omap2_mcspi_platform_config *pdata; const struct omap2_mcspi_platform_config *pdata;
...@@ -1167,6 +1170,11 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev) ...@@ -1167,6 +1170,11 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
master->cleanup = omap2_mcspi_cleanup; master->cleanup = omap2_mcspi_cleanup;
master->dev.of_node = node; master->dev.of_node = node;
dev_set_drvdata(&pdev->dev, master);
mcspi = spi_master_get_devdata(master);
mcspi->master = master;
match = of_match_device(omap_mcspi_of_match, &pdev->dev); match = of_match_device(omap_mcspi_of_match, &pdev->dev);
if (match) { if (match) {
u32 num_cs = 1; /* default number of chipselect */ u32 num_cs = 1; /* default number of chipselect */
...@@ -1175,19 +1183,17 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev) ...@@ -1175,19 +1183,17 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
of_property_read_u32(node, "ti,spi-num-cs", &num_cs); of_property_read_u32(node, "ti,spi-num-cs", &num_cs);
master->num_chipselect = num_cs; master->num_chipselect = num_cs;
master->bus_num = bus_num++; master->bus_num = bus_num++;
if (of_get_property(node, "ti,pindir-d0-out-d1-in", NULL))
mcspi->pin_dir = MCSPI_PINDIR_D0_OUT_D1_IN;
} else { } else {
pdata = pdev->dev.platform_data; pdata = pdev->dev.platform_data;
master->num_chipselect = pdata->num_cs; master->num_chipselect = pdata->num_cs;
if (pdev->id != -1) if (pdev->id != -1)
master->bus_num = pdev->id; master->bus_num = pdev->id;
mcspi->pin_dir = pdata->pin_dir;
} }
regs_offset = pdata->regs_offset; regs_offset = pdata->regs_offset;
dev_set_drvdata(&pdev->dev, master);
mcspi = spi_master_get_devdata(master);
mcspi->master = master;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (r == NULL) { if (r == NULL) {
status = -ENODEV; status = -ENODEV;
...@@ -1272,7 +1278,7 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev) ...@@ -1272,7 +1278,7 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
return status; return status;
} }
static int __devexit omap2_mcspi_remove(struct platform_device *pdev) static int omap2_mcspi_remove(struct platform_device *pdev)
{ {
struct spi_master *master; struct spi_master *master;
struct omap2_mcspi *mcspi; struct omap2_mcspi *mcspi;
...@@ -1341,7 +1347,7 @@ static struct platform_driver omap2_mcspi_driver = { ...@@ -1341,7 +1347,7 @@ static struct platform_driver omap2_mcspi_driver = {
.of_match_table = omap_mcspi_of_match, .of_match_table = omap_mcspi_of_match,
}, },
.probe = omap2_mcspi_probe, .probe = omap2_mcspi_probe,
.remove = __devexit_p(omap2_mcspi_remove), .remove = omap2_mcspi_remove,
}; };
module_platform_driver(omap2_mcspi_driver); module_platform_driver(omap2_mcspi_driver);
......
...@@ -32,8 +32,12 @@ ...@@ -32,8 +32,12 @@
#define ORION_SPI_DATA_IN_REG 0x0c #define ORION_SPI_DATA_IN_REG 0x0c
#define ORION_SPI_INT_CAUSE_REG 0x10 #define ORION_SPI_INT_CAUSE_REG 0x10
#define ORION_SPI_MODE_CPOL (1 << 11)
#define ORION_SPI_MODE_CPHA (1 << 12)
#define ORION_SPI_IF_8_16_BIT_MODE (1 << 5) #define ORION_SPI_IF_8_16_BIT_MODE (1 << 5)
#define ORION_SPI_CLK_PRESCALE_MASK 0x1F #define ORION_SPI_CLK_PRESCALE_MASK 0x1F
#define ORION_SPI_MODE_MASK (ORION_SPI_MODE_CPOL | \
ORION_SPI_MODE_CPHA)
struct orion_spi { struct orion_spi {
struct spi_master *master; struct spi_master *master;
...@@ -123,6 +127,23 @@ static int orion_spi_baudrate_set(struct spi_device *spi, unsigned int speed) ...@@ -123,6 +127,23 @@ static int orion_spi_baudrate_set(struct spi_device *spi, unsigned int speed)
return 0; return 0;
} }
static void
orion_spi_mode_set(struct spi_device *spi)
{
u32 reg;
struct orion_spi *orion_spi;
orion_spi = spi_master_get_devdata(spi->master);
reg = readl(spi_reg(orion_spi, ORION_SPI_IF_CONFIG_REG));
reg &= ~ORION_SPI_MODE_MASK;
if (spi->mode & SPI_CPOL)
reg |= ORION_SPI_MODE_CPOL;
if (spi->mode & SPI_CPHA)
reg |= ORION_SPI_MODE_CPHA;
writel(reg, spi_reg(orion_spi, ORION_SPI_IF_CONFIG_REG));
}
/* /*
* called only when no transfer is active on the bus * called only when no transfer is active on the bus
*/ */
...@@ -142,6 +163,8 @@ orion_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t) ...@@ -142,6 +163,8 @@ orion_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
if ((t != NULL) && t->bits_per_word) if ((t != NULL) && t->bits_per_word)
bits_per_word = t->bits_per_word; bits_per_word = t->bits_per_word;
orion_spi_mode_set(spi);
rc = orion_spi_baudrate_set(spi, speed); rc = orion_spi_baudrate_set(spi, speed);
if (rc) if (rc)
return rc; return rc;
...@@ -399,7 +422,7 @@ static int __init orion_spi_probe(struct platform_device *pdev) ...@@ -399,7 +422,7 @@ static int __init orion_spi_probe(struct platform_device *pdev)
} }
/* we support only mode 0, and no options */ /* we support only mode 0, and no options */
master->mode_bits = 0; master->mode_bits = SPI_CPHA | SPI_CPOL;
master->setup = orion_spi_setup; master->setup = orion_spi_setup;
master->transfer_one_message = orion_spi_transfer_one_message; master->transfer_one_message = orion_spi_transfer_one_message;
...@@ -478,7 +501,7 @@ static int __exit orion_spi_remove(struct platform_device *pdev) ...@@ -478,7 +501,7 @@ static int __exit orion_spi_remove(struct platform_device *pdev)
MODULE_ALIAS("platform:" DRIVER_NAME); MODULE_ALIAS("platform:" DRIVER_NAME);
static const struct of_device_id orion_spi_of_match_table[] __devinitdata = { static const struct of_device_id orion_spi_of_match_table[] = {
{ .compatible = "marvell,orion-spi", }, { .compatible = "marvell,orion-spi", },
{} {}
}; };
......
...@@ -371,6 +371,7 @@ struct pl022 { ...@@ -371,6 +371,7 @@ struct pl022 {
/* Two optional pin states - default & sleep */ /* Two optional pin states - default & sleep */
struct pinctrl *pinctrl; struct pinctrl *pinctrl;
struct pinctrl_state *pins_default; struct pinctrl_state *pins_default;
struct pinctrl_state *pins_idle;
struct pinctrl_state *pins_sleep; struct pinctrl_state *pins_sleep;
struct spi_master *master; struct spi_master *master;
struct pl022_ssp_controller *master_info; struct pl022_ssp_controller *master_info;
...@@ -1088,7 +1089,7 @@ static int configure_dma(struct pl022 *pl022) ...@@ -1088,7 +1089,7 @@ static int configure_dma(struct pl022 *pl022)
return -ENOMEM; return -ENOMEM;
} }
static int __devinit pl022_dma_probe(struct pl022 *pl022) static int pl022_dma_probe(struct pl022 *pl022)
{ {
dma_cap_mask_t mask; dma_cap_mask_t mask;
...@@ -2057,8 +2058,7 @@ pl022_platform_data_dt_get(struct device *dev) ...@@ -2057,8 +2058,7 @@ pl022_platform_data_dt_get(struct device *dev)
return pd; return pd;
} }
static int __devinit static int pl022_probe(struct amba_device *adev, const struct amba_id *id)
pl022_probe(struct amba_device *adev, const struct amba_id *id)
{ {
struct device *dev = &adev->dev; struct device *dev = &adev->dev;
struct pl022_ssp_controller *platform_info = adev->dev.platform_data; struct pl022_ssp_controller *platform_info = adev->dev.platform_data;
...@@ -2116,6 +2116,11 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -2116,6 +2116,11 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id)
} else } else
dev_err(dev, "could not get default pinstate\n"); dev_err(dev, "could not get default pinstate\n");
pl022->pins_idle = pinctrl_lookup_state(pl022->pinctrl,
PINCTRL_STATE_IDLE);
if (IS_ERR(pl022->pins_idle))
dev_dbg(dev, "could not get idle pinstate\n");
pl022->pins_sleep = pinctrl_lookup_state(pl022->pinctrl, pl022->pins_sleep = pinctrl_lookup_state(pl022->pinctrl,
PINCTRL_STATE_SLEEP); PINCTRL_STATE_SLEEP);
if (IS_ERR(pl022->pins_sleep)) if (IS_ERR(pl022->pins_sleep))
...@@ -2246,10 +2251,9 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -2246,10 +2251,9 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id)
pm_runtime_set_autosuspend_delay(dev, pm_runtime_set_autosuspend_delay(dev,
platform_info->autosuspend_delay); platform_info->autosuspend_delay);
pm_runtime_use_autosuspend(dev); pm_runtime_use_autosuspend(dev);
pm_runtime_put_autosuspend(dev);
} else {
pm_runtime_put(dev);
} }
pm_runtime_put(dev);
return 0; return 0;
err_spi_register: err_spi_register:
...@@ -2270,7 +2274,7 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -2270,7 +2274,7 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id)
return status; return status;
} }
static int __devexit static int
pl022_remove(struct amba_device *adev) pl022_remove(struct amba_device *adev)
{ {
struct pl022 *pl022 = amba_get_drvdata(adev); struct pl022 *pl022 = amba_get_drvdata(adev);
...@@ -2303,35 +2307,47 @@ pl022_remove(struct amba_device *adev) ...@@ -2303,35 +2307,47 @@ pl022_remove(struct amba_device *adev)
* the runtime counterparts to handle external resources like * the runtime counterparts to handle external resources like
* clocks, pins and regulators when going to sleep. * clocks, pins and regulators when going to sleep.
*/ */
static void pl022_suspend_resources(struct pl022 *pl022) static void pl022_suspend_resources(struct pl022 *pl022, bool runtime)
{ {
int ret; int ret;
struct pinctrl_state *pins_state;
clk_disable(pl022->clk); clk_disable(pl022->clk);
pins_state = runtime ? pl022->pins_idle : pl022->pins_sleep;
/* Optionally let pins go into sleep states */ /* Optionally let pins go into sleep states */
if (!IS_ERR(pl022->pins_sleep)) { if (!IS_ERR(pins_state)) {
ret = pinctrl_select_state(pl022->pinctrl, ret = pinctrl_select_state(pl022->pinctrl, pins_state);
pl022->pins_sleep);
if (ret) if (ret)
dev_err(&pl022->adev->dev, dev_err(&pl022->adev->dev, "could not set %s pins\n",
"could not set pins to sleep state\n"); runtime ? "idle" : "sleep");
} }
} }
static void pl022_resume_resources(struct pl022 *pl022) static void pl022_resume_resources(struct pl022 *pl022, bool runtime)
{ {
int ret; int ret;
/* Optionaly enable pins to be muxed in and configured */ /* Optionaly enable pins to be muxed in and configured */
/* First go to the default state */
if (!IS_ERR(pl022->pins_default)) { if (!IS_ERR(pl022->pins_default)) {
ret = pinctrl_select_state(pl022->pinctrl, ret = pinctrl_select_state(pl022->pinctrl, pl022->pins_default);
pl022->pins_default);
if (ret) if (ret)
dev_err(&pl022->adev->dev, dev_err(&pl022->adev->dev,
"could not set default pins\n"); "could not set default pins\n");
} }
if (!runtime) {
/* Then let's idle the pins until the next transfer happens */
if (!IS_ERR(pl022->pins_idle)) {
ret = pinctrl_select_state(pl022->pinctrl,
pl022->pins_idle);
if (ret)
dev_err(&pl022->adev->dev,
"could not set idle pins\n");
}
}
clk_enable(pl022->clk); clk_enable(pl022->clk);
} }
#endif #endif
...@@ -2347,7 +2363,9 @@ static int pl022_suspend(struct device *dev) ...@@ -2347,7 +2363,9 @@ static int pl022_suspend(struct device *dev)
dev_warn(dev, "cannot suspend master\n"); dev_warn(dev, "cannot suspend master\n");
return ret; return ret;
} }
pl022_suspend_resources(pl022);
pm_runtime_get_sync(dev);
pl022_suspend_resources(pl022, false);
dev_dbg(dev, "suspended\n"); dev_dbg(dev, "suspended\n");
return 0; return 0;
...@@ -2358,7 +2376,8 @@ static int pl022_resume(struct device *dev) ...@@ -2358,7 +2376,8 @@ static int pl022_resume(struct device *dev)
struct pl022 *pl022 = dev_get_drvdata(dev); struct pl022 *pl022 = dev_get_drvdata(dev);
int ret; int ret;
pl022_resume_resources(pl022); pl022_resume_resources(pl022, false);
pm_runtime_put(dev);
/* Start the queue running */ /* Start the queue running */
ret = spi_master_resume(pl022->master); ret = spi_master_resume(pl022->master);
...@@ -2376,7 +2395,7 @@ static int pl022_runtime_suspend(struct device *dev) ...@@ -2376,7 +2395,7 @@ static int pl022_runtime_suspend(struct device *dev)
{ {
struct pl022 *pl022 = dev_get_drvdata(dev); struct pl022 *pl022 = dev_get_drvdata(dev);
pl022_suspend_resources(pl022); pl022_suspend_resources(pl022, true);
return 0; return 0;
} }
...@@ -2384,7 +2403,7 @@ static int pl022_runtime_resume(struct device *dev) ...@@ -2384,7 +2403,7 @@ static int pl022_runtime_resume(struct device *dev)
{ {
struct pl022 *pl022 = dev_get_drvdata(dev); struct pl022 *pl022 = dev_get_drvdata(dev);
pl022_resume_resources(pl022); pl022_resume_resources(pl022, true);
return 0; return 0;
} }
#endif #endif
...@@ -2464,7 +2483,7 @@ static struct amba_driver pl022_driver = { ...@@ -2464,7 +2483,7 @@ static struct amba_driver pl022_driver = {
}, },
.id_table = pl022_ids, .id_table = pl022_ids,
.probe = pl022_probe, .probe = pl022_probe,
.remove = __devexit_p(pl022_remove), .remove = pl022_remove,
}; };
static int __init pl022_init(void) static int __init pl022_init(void)
......
...@@ -51,7 +51,7 @@ void pxa_ssp_free(struct ssp_device *ssp) ...@@ -51,7 +51,7 @@ void pxa_ssp_free(struct ssp_device *ssp)
} }
EXPORT_SYMBOL_GPL(pxa_ssp_free); EXPORT_SYMBOL_GPL(pxa_ssp_free);
static int __devinit ce4100_spi_probe(struct pci_dev *dev, static int ce4100_spi_probe(struct pci_dev *dev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
int ret; int ret;
...@@ -129,7 +129,7 @@ static int __devinit ce4100_spi_probe(struct pci_dev *dev, ...@@ -129,7 +129,7 @@ static int __devinit ce4100_spi_probe(struct pci_dev *dev,
return ret; return ret;
} }
static void __devexit ce4100_spi_remove(struct pci_dev *dev) static void ce4100_spi_remove(struct pci_dev *dev)
{ {
struct ce4100_info *spi_info; struct ce4100_info *spi_info;
struct ssp_device *ssp; struct ssp_device *ssp;
...@@ -161,7 +161,7 @@ static struct pci_driver ce4100_spi_driver = { ...@@ -161,7 +161,7 @@ static struct pci_driver ce4100_spi_driver = {
.name = "ce4100_spi", .name = "ce4100_spi",
.id_table = ce4100_spi_devices, .id_table = ce4100_spi_devices,
.probe = ce4100_spi_probe, .probe = ce4100_spi_probe,
.remove = __devexit_p(ce4100_spi_remove), .remove = ce4100_spi_remove,
}; };
module_pci_driver(ce4100_spi_driver); module_pci_driver(ce4100_spi_driver);
......
...@@ -1438,7 +1438,7 @@ static void cleanup(struct spi_device *spi) ...@@ -1438,7 +1438,7 @@ static void cleanup(struct spi_device *spi)
kfree(chip); kfree(chip);
} }
static int __devinit init_queue(struct driver_data *drv_data) static int init_queue(struct driver_data *drv_data)
{ {
INIT_LIST_HEAD(&drv_data->queue); INIT_LIST_HEAD(&drv_data->queue);
spin_lock_init(&drv_data->lock); spin_lock_init(&drv_data->lock);
...@@ -1526,7 +1526,7 @@ static int destroy_queue(struct driver_data *drv_data) ...@@ -1526,7 +1526,7 @@ static int destroy_queue(struct driver_data *drv_data)
return 0; return 0;
} }
static int __devinit pxa2xx_spi_probe(struct platform_device *pdev) static int pxa2xx_spi_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct pxa2xx_spi_master *platform_info; struct pxa2xx_spi_master *platform_info;
......
...@@ -661,7 +661,7 @@ static irqreturn_t rspi_irq(int irq, void *_sr) ...@@ -661,7 +661,7 @@ static irqreturn_t rspi_irq(int irq, void *_sr)
return ret; return ret;
} }
static int __devinit rspi_request_dma(struct rspi_data *rspi, static int rspi_request_dma(struct rspi_data *rspi,
struct platform_device *pdev) struct platform_device *pdev)
{ {
struct rspi_plat_data *rspi_pd = pdev->dev.platform_data; struct rspi_plat_data *rspi_pd = pdev->dev.platform_data;
...@@ -709,7 +709,7 @@ static int __devinit rspi_request_dma(struct rspi_data *rspi, ...@@ -709,7 +709,7 @@ static int __devinit rspi_request_dma(struct rspi_data *rspi,
return 0; return 0;
} }
static void __devexit rspi_release_dma(struct rspi_data *rspi) static void rspi_release_dma(struct rspi_data *rspi)
{ {
if (rspi->chan_tx) if (rspi->chan_tx)
dma_release_channel(rspi->chan_tx); dma_release_channel(rspi->chan_tx);
...@@ -717,7 +717,7 @@ static void __devexit rspi_release_dma(struct rspi_data *rspi) ...@@ -717,7 +717,7 @@ static void __devexit rspi_release_dma(struct rspi_data *rspi)
dma_release_channel(rspi->chan_rx); dma_release_channel(rspi->chan_rx);
} }
static int __devexit rspi_remove(struct platform_device *pdev) static int rspi_remove(struct platform_device *pdev)
{ {
struct rspi_data *rspi = dev_get_drvdata(&pdev->dev); struct rspi_data *rspi = dev_get_drvdata(&pdev->dev);
...@@ -731,7 +731,7 @@ static int __devexit rspi_remove(struct platform_device *pdev) ...@@ -731,7 +731,7 @@ static int __devexit rspi_remove(struct platform_device *pdev)
return 0; return 0;
} }
static int __devinit rspi_probe(struct platform_device *pdev) static int rspi_probe(struct platform_device *pdev)
{ {
struct resource *res; struct resource *res;
struct spi_master *master; struct spi_master *master;
...@@ -827,7 +827,7 @@ static int __devinit rspi_probe(struct platform_device *pdev) ...@@ -827,7 +827,7 @@ static int __devinit rspi_probe(struct platform_device *pdev)
static struct platform_driver rspi_driver = { static struct platform_driver rspi_driver = {
.probe = rspi_probe, .probe = rspi_probe,
.remove = __devexit_p(rspi_remove), .remove = rspi_remove,
.driver = { .driver = {
.name = "rspi", .name = "rspi",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -506,7 +506,7 @@ static void s3c24xx_spi_initialsetup(struct s3c24xx_spi *hw) ...@@ -506,7 +506,7 @@ static void s3c24xx_spi_initialsetup(struct s3c24xx_spi *hw)
} }
} }
static int __devinit s3c24xx_spi_probe(struct platform_device *pdev) static int s3c24xx_spi_probe(struct platform_device *pdev)
{ {
struct s3c2410_spi_info *pdata; struct s3c2410_spi_info *pdata;
struct s3c24xx_spi *hw; struct s3c24xx_spi *hw;
...@@ -663,7 +663,7 @@ static int __devinit s3c24xx_spi_probe(struct platform_device *pdev) ...@@ -663,7 +663,7 @@ static int __devinit s3c24xx_spi_probe(struct platform_device *pdev)
return err; return err;
} }
static int __devexit s3c24xx_spi_remove(struct platform_device *dev) static int s3c24xx_spi_remove(struct platform_device *dev)
{ {
struct s3c24xx_spi *hw = platform_get_drvdata(dev); struct s3c24xx_spi *hw = platform_get_drvdata(dev);
...@@ -722,7 +722,7 @@ static const struct dev_pm_ops s3c24xx_spi_pmops = { ...@@ -722,7 +722,7 @@ static const struct dev_pm_ops s3c24xx_spi_pmops = {
MODULE_ALIAS("platform:s3c2410-spi"); MODULE_ALIAS("platform:s3c2410-spi");
static struct platform_driver s3c24xx_spi_driver = { static struct platform_driver s3c24xx_spi_driver = {
.probe = s3c24xx_spi_probe, .probe = s3c24xx_spi_probe,
.remove = __devexit_p(s3c24xx_spi_remove), .remove = s3c24xx_spi_remove,
.driver = { .driver = {
.name = "s3c2410-spi", .name = "s3c2410-spi",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -516,7 +516,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd) ...@@ -516,7 +516,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
/* Disable Clock */ /* Disable Clock */
if (sdd->port_conf->clk_from_cmu) { if (sdd->port_conf->clk_from_cmu) {
clk_disable(sdd->src_clk); clk_disable_unprepare(sdd->src_clk);
} else { } else {
val = readl(regs + S3C64XX_SPI_CLK_CFG); val = readl(regs + S3C64XX_SPI_CLK_CFG);
val &= ~S3C64XX_SPI_ENCLK_ENABLE; val &= ~S3C64XX_SPI_ENCLK_ENABLE;
...@@ -564,7 +564,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd) ...@@ -564,7 +564,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
/* There is half-multiplier before the SPI */ /* There is half-multiplier before the SPI */
clk_set_rate(sdd->src_clk, sdd->cur_speed * 2); clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);
/* Enable Clock */ /* Enable Clock */
clk_enable(sdd->src_clk); clk_prepare_enable(sdd->src_clk);
} else { } else {
/* Configure Clock */ /* Configure Clock */
val = readl(regs + S3C64XX_SPI_CLK_CFG); val = readl(regs + S3C64XX_SPI_CLK_CFG);
...@@ -1056,7 +1056,7 @@ static void s3c64xx_spi_hwinit(struct s3c64xx_spi_driver_data *sdd, int channel) ...@@ -1056,7 +1056,7 @@ static void s3c64xx_spi_hwinit(struct s3c64xx_spi_driver_data *sdd, int channel)
flush_fifo(sdd); flush_fifo(sdd);
} }
static int __devinit s3c64xx_spi_get_dmares( static int s3c64xx_spi_get_dmares(
struct s3c64xx_spi_driver_data *sdd, bool tx) struct s3c64xx_spi_driver_data *sdd, bool tx)
{ {
struct platform_device *pdev = sdd->pdev; struct platform_device *pdev = sdd->pdev;
...@@ -1112,7 +1112,7 @@ static int s3c64xx_spi_parse_dt_gpio(struct s3c64xx_spi_driver_data *sdd) ...@@ -1112,7 +1112,7 @@ static int s3c64xx_spi_parse_dt_gpio(struct s3c64xx_spi_driver_data *sdd)
dev_err(dev, "invalid gpio[%d]: %d\n", idx, gpio); dev_err(dev, "invalid gpio[%d]: %d\n", idx, gpio);
goto free_gpio; goto free_gpio;
} }
sdd->gpios[idx] = gpio;
ret = gpio_request(gpio, "spi-bus"); ret = gpio_request(gpio, "spi-bus");
if (ret) { if (ret) {
dev_err(dev, "gpio [%d] request failed: %d\n", dev_err(dev, "gpio [%d] request failed: %d\n",
...@@ -1135,7 +1135,7 @@ static void s3c64xx_spi_dt_gpio_free(struct s3c64xx_spi_driver_data *sdd) ...@@ -1135,7 +1135,7 @@ static void s3c64xx_spi_dt_gpio_free(struct s3c64xx_spi_driver_data *sdd)
gpio_free(sdd->gpios[idx]); gpio_free(sdd->gpios[idx]);
} }
static struct __devinit s3c64xx_spi_info * s3c64xx_spi_parse_dt( static struct s3c64xx_spi_info * s3c64xx_spi_parse_dt(
struct device *dev) struct device *dev)
{ {
struct s3c64xx_spi_info *sci; struct s3c64xx_spi_info *sci;
...@@ -1302,7 +1302,7 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev) ...@@ -1302,7 +1302,7 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
goto err3; goto err3;
} }
if (clk_enable(sdd->clk)) { if (clk_prepare_enable(sdd->clk)) {
dev_err(&pdev->dev, "Couldn't enable clock 'spi'\n"); dev_err(&pdev->dev, "Couldn't enable clock 'spi'\n");
ret = -EBUSY; ret = -EBUSY;
goto err4; goto err4;
...@@ -1317,7 +1317,7 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev) ...@@ -1317,7 +1317,7 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
goto err5; goto err5;
} }
if (clk_enable(sdd->src_clk)) { if (clk_prepare_enable(sdd->src_clk)) {
dev_err(&pdev->dev, "Couldn't enable clock '%s'\n", clk_name); dev_err(&pdev->dev, "Couldn't enable clock '%s'\n", clk_name);
ret = -EBUSY; ret = -EBUSY;
goto err6; goto err6;
...@@ -1361,11 +1361,11 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev) ...@@ -1361,11 +1361,11 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
err8: err8:
free_irq(irq, sdd); free_irq(irq, sdd);
err7: err7:
clk_disable(sdd->src_clk); clk_disable_unprepare(sdd->src_clk);
err6: err6:
clk_put(sdd->src_clk); clk_put(sdd->src_clk);
err5: err5:
clk_disable(sdd->clk); clk_disable_unprepare(sdd->clk);
err4: err4:
clk_put(sdd->clk); clk_put(sdd->clk);
err3: err3:
...@@ -1393,10 +1393,10 @@ static int s3c64xx_spi_remove(struct platform_device *pdev) ...@@ -1393,10 +1393,10 @@ static int s3c64xx_spi_remove(struct platform_device *pdev)
free_irq(platform_get_irq(pdev, 0), sdd); free_irq(platform_get_irq(pdev, 0), sdd);
clk_disable(sdd->src_clk); clk_disable_unprepare(sdd->src_clk);
clk_put(sdd->src_clk); clk_put(sdd->src_clk);
clk_disable(sdd->clk); clk_disable_unprepare(sdd->clk);
clk_put(sdd->clk); clk_put(sdd->clk);
if (!sdd->cntrlr_info->cfg_gpio && pdev->dev.of_node) if (!sdd->cntrlr_info->cfg_gpio && pdev->dev.of_node)
...@@ -1417,8 +1417,8 @@ static int s3c64xx_spi_suspend(struct device *dev) ...@@ -1417,8 +1417,8 @@ static int s3c64xx_spi_suspend(struct device *dev)
spi_master_suspend(master); spi_master_suspend(master);
/* Disable the clock */ /* Disable the clock */
clk_disable(sdd->src_clk); clk_disable_unprepare(sdd->src_clk);
clk_disable(sdd->clk); clk_disable_unprepare(sdd->clk);
if (!sdd->cntrlr_info->cfg_gpio && dev->of_node) if (!sdd->cntrlr_info->cfg_gpio && dev->of_node)
s3c64xx_spi_dt_gpio_free(sdd); s3c64xx_spi_dt_gpio_free(sdd);
...@@ -1440,8 +1440,8 @@ static int s3c64xx_spi_resume(struct device *dev) ...@@ -1440,8 +1440,8 @@ static int s3c64xx_spi_resume(struct device *dev)
sci->cfg_gpio(); sci->cfg_gpio();
/* Enable the clock */ /* Enable the clock */
clk_enable(sdd->src_clk); clk_prepare_enable(sdd->src_clk);
clk_enable(sdd->clk); clk_prepare_enable(sdd->clk);
s3c64xx_spi_hwinit(sdd, sdd->port_id); s3c64xx_spi_hwinit(sdd, sdd->port_id);
...@@ -1457,8 +1457,8 @@ static int s3c64xx_spi_runtime_suspend(struct device *dev) ...@@ -1457,8 +1457,8 @@ static int s3c64xx_spi_runtime_suspend(struct device *dev)
struct spi_master *master = dev_get_drvdata(dev); struct spi_master *master = dev_get_drvdata(dev);
struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
clk_disable(sdd->clk); clk_disable_unprepare(sdd->clk);
clk_disable(sdd->src_clk); clk_disable_unprepare(sdd->src_clk);
return 0; return 0;
} }
...@@ -1468,8 +1468,8 @@ static int s3c64xx_spi_runtime_resume(struct device *dev) ...@@ -1468,8 +1468,8 @@ static int s3c64xx_spi_runtime_resume(struct device *dev)
struct spi_master *master = dev_get_drvdata(dev); struct spi_master *master = dev_get_drvdata(dev);
struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
clk_enable(sdd->src_clk); clk_prepare_enable(sdd->src_clk);
clk_enable(sdd->clk); clk_prepare_enable(sdd->clk);
return 0; return 0;
} }
......
...@@ -68,6 +68,16 @@ static u32 hspi_read(struct hspi_priv *hspi, int reg) ...@@ -68,6 +68,16 @@ static u32 hspi_read(struct hspi_priv *hspi, int reg)
return ioread32(hspi->addr + reg); return ioread32(hspi->addr + reg);
} }
static void hspi_bit_set(struct hspi_priv *hspi, int reg, u32 mask, u32 set)
{
u32 val = hspi_read(hspi, reg);
val &= ~mask;
val |= set & mask;
hspi_write(hspi, reg, val);
}
/* /*
* transfer function * transfer function
*/ */
...@@ -105,6 +115,13 @@ static int hspi_unprepare_transfer(struct spi_master *master) ...@@ -105,6 +115,13 @@ static int hspi_unprepare_transfer(struct spi_master *master)
return 0; return 0;
} }
#define hspi_hw_cs_enable(hspi) hspi_hw_cs_ctrl(hspi, 0)
#define hspi_hw_cs_disable(hspi) hspi_hw_cs_ctrl(hspi, 1)
static void hspi_hw_cs_ctrl(struct hspi_priv *hspi, int hi)
{
hspi_bit_set(hspi, SPSCR, (1 << 6), (hi) << 6);
}
static void hspi_hw_setup(struct hspi_priv *hspi, static void hspi_hw_setup(struct hspi_priv *hspi,
struct spi_message *msg, struct spi_message *msg,
struct spi_transfer *t) struct spi_transfer *t)
...@@ -155,7 +172,7 @@ static void hspi_hw_setup(struct hspi_priv *hspi, ...@@ -155,7 +172,7 @@ static void hspi_hw_setup(struct hspi_priv *hspi,
hspi_write(hspi, SPCR, spcr); hspi_write(hspi, SPCR, spcr);
hspi_write(hspi, SPSR, 0x0); hspi_write(hspi, SPSR, 0x0);
hspi_write(hspi, SPSCR, 0x1); /* master mode */ hspi_write(hspi, SPSCR, 0x21); /* master mode / CS control */
} }
static int hspi_transfer_one_message(struct spi_master *master, static int hspi_transfer_one_message(struct spi_master *master,
...@@ -166,12 +183,21 @@ static int hspi_transfer_one_message(struct spi_master *master, ...@@ -166,12 +183,21 @@ static int hspi_transfer_one_message(struct spi_master *master,
u32 tx; u32 tx;
u32 rx; u32 rx;
int ret, i; int ret, i;
unsigned int cs_change;
const int nsecs = 50;
dev_dbg(hspi->dev, "%s\n", __func__); dev_dbg(hspi->dev, "%s\n", __func__);
cs_change = 1;
ret = 0; ret = 0;
list_for_each_entry(t, &msg->transfers, transfer_list) { list_for_each_entry(t, &msg->transfers, transfer_list) {
if (cs_change) {
hspi_hw_setup(hspi, msg, t); hspi_hw_setup(hspi, msg, t);
hspi_hw_cs_enable(hspi);
ndelay(nsecs);
}
cs_change = t->cs_change;
for (i = 0; i < t->len; i++) { for (i = 0; i < t->len; i++) {
...@@ -198,9 +224,22 @@ static int hspi_transfer_one_message(struct spi_master *master, ...@@ -198,9 +224,22 @@ static int hspi_transfer_one_message(struct spi_master *master,
} }
msg->actual_length += t->len; msg->actual_length += t->len;
if (t->delay_usecs)
udelay(t->delay_usecs);
if (cs_change) {
ndelay(nsecs);
hspi_hw_cs_disable(hspi);
ndelay(nsecs);
}
} }
msg->status = ret; msg->status = ret;
if (!cs_change) {
ndelay(nsecs);
hspi_hw_cs_disable(hspi);
}
spi_finalize_current_message(master); spi_finalize_current_message(master);
return ret; return ret;
...@@ -229,7 +268,7 @@ static void hspi_cleanup(struct spi_device *spi) ...@@ -229,7 +268,7 @@ static void hspi_cleanup(struct spi_device *spi)
dev_dbg(dev, "%s cleanup\n", spi->modalias); dev_dbg(dev, "%s cleanup\n", spi->modalias);
} }
static int __devinit hspi_probe(struct platform_device *pdev) static int hspi_probe(struct platform_device *pdev)
{ {
struct resource *res; struct resource *res;
struct spi_master *master; struct spi_master *master;
...@@ -300,7 +339,7 @@ static int __devinit hspi_probe(struct platform_device *pdev) ...@@ -300,7 +339,7 @@ static int __devinit hspi_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit hspi_remove(struct platform_device *pdev) static int hspi_remove(struct platform_device *pdev)
{ {
struct hspi_priv *hspi = dev_get_drvdata(&pdev->dev); struct hspi_priv *hspi = dev_get_drvdata(&pdev->dev);
...@@ -314,7 +353,7 @@ static int __devexit hspi_remove(struct platform_device *pdev) ...@@ -314,7 +353,7 @@ static int __devexit hspi_remove(struct platform_device *pdev)
static struct platform_driver hspi_driver = { static struct platform_driver hspi_driver = {
.probe = hspi_probe, .probe = hspi_probe,
.remove = __devexit_p(hspi_remove), .remove = hspi_remove,
.driver = { .driver = {
.name = "sh-hspi", .name = "sh-hspi",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -597,7 +597,6 @@ static int sh_msiof_spi_probe(struct platform_device *pdev) ...@@ -597,7 +597,6 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
struct resource *r; struct resource *r;
struct spi_master *master; struct spi_master *master;
struct sh_msiof_spi_priv *p; struct sh_msiof_spi_priv *p;
char clk_name[16];
int i; int i;
int ret; int ret;
...@@ -614,10 +613,9 @@ static int sh_msiof_spi_probe(struct platform_device *pdev) ...@@ -614,10 +613,9 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
p->info = pdev->dev.platform_data; p->info = pdev->dev.platform_data;
init_completion(&p->done); init_completion(&p->done);
snprintf(clk_name, sizeof(clk_name), "msiof%d", pdev->id); p->clk = clk_get(&pdev->dev, NULL);
p->clk = clk_get(&pdev->dev, clk_name);
if (IS_ERR(p->clk)) { if (IS_ERR(p->clk)) {
dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name); dev_err(&pdev->dev, "cannot get clock\n");
ret = PTR_ERR(p->clk); ret = PTR_ERR(p->clk);
goto err1; goto err1;
} }
......
...@@ -432,7 +432,7 @@ static irqreturn_t spi_sh_irq(int irq, void *_ss) ...@@ -432,7 +432,7 @@ static irqreturn_t spi_sh_irq(int irq, void *_ss)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int __devexit spi_sh_remove(struct platform_device *pdev) static int spi_sh_remove(struct platform_device *pdev)
{ {
struct spi_sh_data *ss = dev_get_drvdata(&pdev->dev); struct spi_sh_data *ss = dev_get_drvdata(&pdev->dev);
...@@ -444,7 +444,7 @@ static int __devexit spi_sh_remove(struct platform_device *pdev) ...@@ -444,7 +444,7 @@ static int __devexit spi_sh_remove(struct platform_device *pdev)
return 0; return 0;
} }
static int __devinit spi_sh_probe(struct platform_device *pdev) static int spi_sh_probe(struct platform_device *pdev)
{ {
struct resource *res; struct resource *res;
struct spi_master *master; struct spi_master *master;
...@@ -539,7 +539,7 @@ static int __devinit spi_sh_probe(struct platform_device *pdev) ...@@ -539,7 +539,7 @@ static int __devinit spi_sh_probe(struct platform_device *pdev)
static struct platform_driver spi_sh_driver = { static struct platform_driver spi_sh_driver = {
.probe = spi_sh_probe, .probe = spi_sh_probe,
.remove = __devexit_p(spi_sh_remove), .remove = spi_sh_remove,
.driver = { .driver = {
.name = "sh_spi", .name = "sh_spi",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -479,7 +479,7 @@ static int spi_sirfsoc_setup(struct spi_device *spi) ...@@ -479,7 +479,7 @@ static int spi_sirfsoc_setup(struct spi_device *spi)
return spi_sirfsoc_setup_transfer(spi, NULL); return spi_sirfsoc_setup_transfer(spi, NULL);
} }
static int __devinit spi_sirfsoc_probe(struct platform_device *pdev) static int spi_sirfsoc_probe(struct platform_device *pdev)
{ {
struct sirfsoc_spi *sspi; struct sirfsoc_spi *sspi;
struct spi_master *master; struct spi_master *master;
...@@ -604,7 +604,7 @@ static int __devinit spi_sirfsoc_probe(struct platform_device *pdev) ...@@ -604,7 +604,7 @@ static int __devinit spi_sirfsoc_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit spi_sirfsoc_remove(struct platform_device *pdev) static int spi_sirfsoc_remove(struct platform_device *pdev)
{ {
struct spi_master *master; struct spi_master *master;
struct sirfsoc_spi *sspi; struct sirfsoc_spi *sspi;
...@@ -673,7 +673,7 @@ static struct platform_driver spi_sirfsoc_driver = { ...@@ -673,7 +673,7 @@ static struct platform_driver spi_sirfsoc_driver = {
.of_match_table = spi_sirfsoc_of_match, .of_match_table = spi_sirfsoc_of_match,
}, },
.probe = spi_sirfsoc_probe, .probe = spi_sirfsoc_probe,
.remove = __devexit_p(spi_sirfsoc_remove), .remove = spi_sirfsoc_remove,
}; };
module_platform_driver(spi_sirfsoc_driver); module_platform_driver(spi_sirfsoc_driver);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -289,7 +289,7 @@ static int ti_ssp_spi_transfer(struct spi_device *spi, struct spi_message *m) ...@@ -289,7 +289,7 @@ static int ti_ssp_spi_transfer(struct spi_device *spi, struct spi_message *m)
return error; return error;
} }
static int __devinit ti_ssp_spi_probe(struct platform_device *pdev) static int ti_ssp_spi_probe(struct platform_device *pdev)
{ {
const struct ti_ssp_spi_data *pdata; const struct ti_ssp_spi_data *pdata;
struct ti_ssp_spi *hw; struct ti_ssp_spi *hw;
...@@ -357,7 +357,7 @@ static int __devinit ti_ssp_spi_probe(struct platform_device *pdev) ...@@ -357,7 +357,7 @@ static int __devinit ti_ssp_spi_probe(struct platform_device *pdev)
return error; return error;
} }
static int __devexit ti_ssp_spi_remove(struct platform_device *pdev) static int ti_ssp_spi_remove(struct platform_device *pdev)
{ {
struct ti_ssp_spi *hw = platform_get_drvdata(pdev); struct ti_ssp_spi *hw = platform_get_drvdata(pdev);
int error; int error;
...@@ -378,7 +378,7 @@ static int __devexit ti_ssp_spi_remove(struct platform_device *pdev) ...@@ -378,7 +378,7 @@ static int __devexit ti_ssp_spi_remove(struct platform_device *pdev)
static struct platform_driver ti_ssp_spi_driver = { static struct platform_driver ti_ssp_spi_driver = {
.probe = ti_ssp_spi_probe, .probe = ti_ssp_spi_probe,
.remove = __devexit_p(ti_ssp_spi_remove), .remove = ti_ssp_spi_remove,
.driver = { .driver = {
.name = "ti-ssp-spi", .name = "ti-ssp-spi",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -240,7 +240,7 @@ static int to_gpio_num(struct device_attribute *attr) ...@@ -240,7 +240,7 @@ static int to_gpio_num(struct device_attribute *attr)
return -1; return -1;
} }
static int __devinit tle62x0_probe(struct spi_device *spi) static int tle62x0_probe(struct spi_device *spi)
{ {
struct tle62x0_state *st; struct tle62x0_state *st;
struct tle62x0_pdata *pdata; struct tle62x0_pdata *pdata;
...@@ -294,7 +294,7 @@ static int __devinit tle62x0_probe(struct spi_device *spi) ...@@ -294,7 +294,7 @@ static int __devinit tle62x0_probe(struct spi_device *spi)
return ret; return ret;
} }
static int __devexit tle62x0_remove(struct spi_device *spi) static int tle62x0_remove(struct spi_device *spi)
{ {
struct tle62x0_state *st = spi_get_drvdata(spi); struct tle62x0_state *st = spi_get_drvdata(spi);
int ptr; int ptr;
...@@ -313,7 +313,7 @@ static struct spi_driver tle62x0_driver = { ...@@ -313,7 +313,7 @@ static struct spi_driver tle62x0_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = tle62x0_probe, .probe = tle62x0_probe,
.remove = __devexit_p(tle62x0_remove), .remove = tle62x0_remove,
}; };
module_spi_driver(tle62x0_driver); module_spi_driver(tle62x0_driver);
......
...@@ -1401,7 +1401,7 @@ static void pch_alloc_dma_buf(struct pch_spi_board_data *board_dat, ...@@ -1401,7 +1401,7 @@ static void pch_alloc_dma_buf(struct pch_spi_board_data *board_dat,
PCH_BUF_SIZE, &dma->rx_buf_dma, GFP_KERNEL); PCH_BUF_SIZE, &dma->rx_buf_dma, GFP_KERNEL);
} }
static int __devinit pch_spi_pd_probe(struct platform_device *plat_dev) static int pch_spi_pd_probe(struct platform_device *plat_dev)
{ {
int ret; int ret;
struct spi_master *master; struct spi_master *master;
...@@ -1498,7 +1498,7 @@ static int __devinit pch_spi_pd_probe(struct platform_device *plat_dev) ...@@ -1498,7 +1498,7 @@ static int __devinit pch_spi_pd_probe(struct platform_device *plat_dev)
return ret; return ret;
} }
static int __devexit pch_spi_pd_remove(struct platform_device *plat_dev) static int pch_spi_pd_remove(struct platform_device *plat_dev)
{ {
struct pch_spi_board_data *board_dat = dev_get_platdata(&plat_dev->dev); struct pch_spi_board_data *board_dat = dev_get_platdata(&plat_dev->dev);
struct pch_spi_data *data = platform_get_drvdata(plat_dev); struct pch_spi_data *data = platform_get_drvdata(plat_dev);
...@@ -1619,12 +1619,12 @@ static struct platform_driver pch_spi_pd_driver = { ...@@ -1619,12 +1619,12 @@ static struct platform_driver pch_spi_pd_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = pch_spi_pd_probe, .probe = pch_spi_pd_probe,
.remove = __devexit_p(pch_spi_pd_remove), .remove = pch_spi_pd_remove,
.suspend = pch_spi_pd_suspend, .suspend = pch_spi_pd_suspend,
.resume = pch_spi_pd_resume .resume = pch_spi_pd_resume
}; };
static int __devinit pch_spi_probe(struct pci_dev *pdev, static int pch_spi_probe(struct pci_dev *pdev,
const struct pci_device_id *id) const struct pci_device_id *id)
{ {
struct pch_spi_board_data *board_dat; struct pch_spi_board_data *board_dat;
...@@ -1705,7 +1705,7 @@ static int __devinit pch_spi_probe(struct pci_dev *pdev, ...@@ -1705,7 +1705,7 @@ static int __devinit pch_spi_probe(struct pci_dev *pdev,
return retval; return retval;
} }
static void __devexit pch_spi_remove(struct pci_dev *pdev) static void pch_spi_remove(struct pci_dev *pdev)
{ {
int i; int i;
struct pch_pd_dev_save *pd_dev_save = pci_get_drvdata(pdev); struct pch_pd_dev_save *pd_dev_save = pci_get_drvdata(pdev);
...@@ -1776,7 +1776,7 @@ static struct pci_driver pch_spi_pcidev_driver = { ...@@ -1776,7 +1776,7 @@ static struct pci_driver pch_spi_pcidev_driver = {
.name = "pch_spi", .name = "pch_spi",
.id_table = pch_spi_pcidev_id, .id_table = pch_spi_pcidev_id,
.probe = pch_spi_probe, .probe = pch_spi_probe,
.remove = __devexit_p(pch_spi_remove), .remove = pch_spi_remove,
.suspend = pch_spi_suspend, .suspend = pch_spi_suspend,
.resume = pch_spi_resume, .resume = pch_spi_resume,
}; };
......
...@@ -217,7 +217,7 @@ static int spi_xcomm_setup(struct spi_device *spi) ...@@ -217,7 +217,7 @@ static int spi_xcomm_setup(struct spi_device *spi)
return 0; return 0;
} }
static int __devinit spi_xcomm_probe(struct i2c_client *i2c, static int spi_xcomm_probe(struct i2c_client *i2c,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
struct spi_xcomm *spi_xcomm; struct spi_xcomm *spi_xcomm;
...@@ -246,7 +246,7 @@ static int __devinit spi_xcomm_probe(struct i2c_client *i2c, ...@@ -246,7 +246,7 @@ static int __devinit spi_xcomm_probe(struct i2c_client *i2c,
return ret; return ret;
} }
static int __devexit spi_xcomm_remove(struct i2c_client *i2c) static int spi_xcomm_remove(struct i2c_client *i2c)
{ {
struct spi_master *master = i2c_get_clientdata(i2c); struct spi_master *master = i2c_get_clientdata(i2c);
...@@ -267,7 +267,7 @@ static struct i2c_driver spi_xcomm_driver = { ...@@ -267,7 +267,7 @@ static struct i2c_driver spi_xcomm_driver = {
}, },
.id_table = spi_xcomm_ids, .id_table = spi_xcomm_ids,
.probe = spi_xcomm_probe, .probe = spi_xcomm_probe,
.remove = __devexit_p(spi_xcomm_remove), .remove = spi_xcomm_remove,
}; };
module_i2c_driver(spi_xcomm_driver); module_i2c_driver(spi_xcomm_driver);
......
...@@ -462,7 +462,7 @@ void xilinx_spi_deinit(struct spi_master *master) ...@@ -462,7 +462,7 @@ void xilinx_spi_deinit(struct spi_master *master)
} }
EXPORT_SYMBOL(xilinx_spi_deinit); EXPORT_SYMBOL(xilinx_spi_deinit);
static int __devinit xilinx_spi_probe(struct platform_device *dev) static int xilinx_spi_probe(struct platform_device *dev)
{ {
struct xspi_platform_data *pdata; struct xspi_platform_data *pdata;
struct resource *r; struct resource *r;
...@@ -518,7 +518,7 @@ static int __devinit xilinx_spi_probe(struct platform_device *dev) ...@@ -518,7 +518,7 @@ static int __devinit xilinx_spi_probe(struct platform_device *dev)
return 0; return 0;
} }
static int __devexit xilinx_spi_remove(struct platform_device *dev) static int xilinx_spi_remove(struct platform_device *dev)
{ {
xilinx_spi_deinit(platform_get_drvdata(dev)); xilinx_spi_deinit(platform_get_drvdata(dev));
platform_set_drvdata(dev, 0); platform_set_drvdata(dev, 0);
...@@ -531,7 +531,7 @@ MODULE_ALIAS("platform:" XILINX_SPI_NAME); ...@@ -531,7 +531,7 @@ MODULE_ALIAS("platform:" XILINX_SPI_NAME);
static struct platform_driver xilinx_spi_driver = { static struct platform_driver xilinx_spi_driver = {
.probe = xilinx_spi_probe, .probe = xilinx_spi_probe,
.remove = __devexit_p(xilinx_spi_remove), .remove = xilinx_spi_remove,
.driver = { .driver = {
.name = XILINX_SPI_NAME, .name = XILINX_SPI_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
This diff is collapsed.
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/compat.h> #include <linux/compat.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/spidev.h> #include <linux/spi/spidev.h>
...@@ -571,7 +573,7 @@ static struct class *spidev_class; ...@@ -571,7 +573,7 @@ static struct class *spidev_class;
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static int __devinit spidev_probe(struct spi_device *spi) static int spidev_probe(struct spi_device *spi)
{ {
struct spidev_data *spidev; struct spidev_data *spidev;
int status; int status;
...@@ -620,7 +622,7 @@ static int __devinit spidev_probe(struct spi_device *spi) ...@@ -620,7 +622,7 @@ static int __devinit spidev_probe(struct spi_device *spi)
return status; return status;
} }
static int __devexit spidev_remove(struct spi_device *spi) static int spidev_remove(struct spi_device *spi)
{ {
struct spidev_data *spidev = spi_get_drvdata(spi); struct spidev_data *spidev = spi_get_drvdata(spi);
...@@ -642,13 +644,21 @@ static int __devexit spidev_remove(struct spi_device *spi) ...@@ -642,13 +644,21 @@ static int __devexit spidev_remove(struct spi_device *spi)
return 0; return 0;
} }
static const struct of_device_id spidev_dt_ids[] = {
{ .compatible = "rohm,dh2228fv" },
{},
};
MODULE_DEVICE_TABLE(of, spidev_dt_ids);
static struct spi_driver spidev_spi_driver = { static struct spi_driver spidev_spi_driver = {
.driver = { .driver = {
.name = "spidev", .name = "spidev",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = of_match_ptr(spidev_dt_ids),
}, },
.probe = spidev_probe, .probe = spidev_probe,
.remove = __devexit_p(spidev_remove), .remove = spidev_remove,
/* NOTE: suspend/resume methods are not necessary here. /* NOTE: suspend/resume methods are not necessary here.
* We don't do anything except pass the requests to/from * We don't do anything except pass the requests to/from
......
/*
* CLPS711X SPI bus driver definitions
*
* Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef ____LINUX_PLATFORM_DATA_SPI_CLPS711X_H
#define ____LINUX_PLATFORM_DATA_SPI_CLPS711X_H
/* Board specific platform_data */
struct spi_clps711x_pdata {
int *chipselect; /* Array of GPIO-numbers */
int num_chipselect; /* Total count of GPIOs */
};
#endif
...@@ -7,9 +7,13 @@ ...@@ -7,9 +7,13 @@
#define OMAP4_MCSPI_REG_OFFSET 0x100 #define OMAP4_MCSPI_REG_OFFSET 0x100
#define MCSPI_PINDIR_D0_IN_D1_OUT 0
#define MCSPI_PINDIR_D0_OUT_D1_IN 1
struct omap2_mcspi_platform_config { struct omap2_mcspi_platform_config {
unsigned short num_cs; unsigned short num_cs;
unsigned int regs_offset; unsigned int regs_offset;
unsigned int pin_dir:1;
}; };
struct omap2_mcspi_dev_attr { struct omap2_mcspi_dev_attr {
......
/*
* spi-tegra.h: SPI interface for Nvidia Tegra20 SLINK controller.
*
* Copyright (C) 2011 NVIDIA Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _LINUX_SPI_TEGRA_H
#define _LINUX_SPI_TEGRA_H
struct tegra_spi_platform_data {
int dma_req_sel;
unsigned int spi_max_frequency;
};
/*
* Controller data from device to pass some info like
* hw based chip select can be used or not and if yes
* then CS hold and setup time.
*/
struct tegra_spi_device_controller_data {
bool is_hw_based_cs;
int cs_setup_clk_count;
int cs_hold_clk_count;
};
#endif /* _LINUX_SPI_TEGRA_H */
...@@ -90,6 +90,7 @@ struct spi_device { ...@@ -90,6 +90,7 @@ struct spi_device {
void *controller_state; void *controller_state;
void *controller_data; void *controller_data;
char modalias[SPI_NAME_SIZE]; char modalias[SPI_NAME_SIZE];
int cs_gpio; /* chip select gpio */
/* /*
* likely need more hooks for more protocol options affecting how * likely need more hooks for more protocol options affecting how
...@@ -362,6 +363,8 @@ struct spi_master { ...@@ -362,6 +363,8 @@ struct spi_master {
int (*transfer_one_message)(struct spi_master *master, int (*transfer_one_message)(struct spi_master *master,
struct spi_message *mesg); struct spi_message *mesg);
int (*unprepare_transfer_hardware)(struct spi_master *master); int (*unprepare_transfer_hardware)(struct spi_master *master);
/* gpio chip select */
int *cs_gpios;
}; };
static inline void *spi_master_get_devdata(struct spi_master *master) static inline void *spi_master_get_devdata(struct spi_master *master)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment