You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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 ...
This commit is contained in:
+23
-8
@@ -123,6 +123,13 @@ config SPI_BUTTERFLY
|
||||
inexpensive battery powered microcontroller evaluation board.
|
||||
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
|
||||
tristate "Freescale Coldfire QSPI controller"
|
||||
depends on (M520x || M523x || M5249 || M525x || M527x || M528x || M532x)
|
||||
@@ -341,10 +348,10 @@ config SPI_SC18IS602
|
||||
|
||||
config SPI_SH_MSIOF
|
||||
tristate "SuperH MSIOF SPI controller"
|
||||
depends on SUPERH && HAVE_CLK
|
||||
depends on (SUPERH || ARCH_SHMOBILE) && HAVE_CLK
|
||||
select SPI_BITBANG
|
||||
help
|
||||
SPI driver for SuperH MSIOF blocks.
|
||||
SPI driver for SuperH and SH Mobile MSIOF blocks.
|
||||
|
||||
config SPI_SH
|
||||
tristate "SuperH SPI controller"
|
||||
@@ -372,12 +379,6 @@ config SPI_SIRF
|
||||
help
|
||||
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
|
||||
tristate "Freescale MXS SPI controller"
|
||||
depends on ARCH_MXS
|
||||
@@ -385,6 +386,20 @@ config SPI_MXS
|
||||
help
|
||||
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
|
||||
tristate "TI Sequencer Serial Port - SPI Support"
|
||||
depends on MFD_TI_SSP
|
||||
|
||||
@@ -19,6 +19,7 @@ obj-$(CONFIG_SPI_BFIN5XX) += spi-bfin5xx.o
|
||||
obj-$(CONFIG_SPI_BFIN_SPORT) += spi-bfin-sport.o
|
||||
obj-$(CONFIG_SPI_BITBANG) += spi-bitbang.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_DAVINCI) += spi-davinci.o
|
||||
obj-$(CONFIG_SPI_DESIGNWARE) += spi-dw.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_SCI) += spi-sh-sci.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_TLE62X0) += spi-tle62x0.o
|
||||
obj-$(CONFIG_SPI_TOPCLIFF_PCH) += spi-topcliff-pch.o
|
||||
obj-$(CONFIG_SPI_TXX9) += spi-txx9.o
|
||||
obj-$(CONFIG_SPI_XCOMM) += spi-xcomm.o
|
||||
obj-$(CONFIG_SPI_XILINX) += spi-xilinx.o
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ static irqreturn_t altera_spi_irq(int irq, void *dev)
|
||||
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 *hw;
|
||||
@@ -290,7 +290,7 @@ exit:
|
||||
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 spi_master *master = hw->bitbang.master;
|
||||
@@ -311,7 +311,7 @@ MODULE_DEVICE_TABLE(of, altera_spi_match);
|
||||
|
||||
static struct platform_driver altera_spi_driver = {
|
||||
.probe = altera_spi_probe,
|
||||
.remove = __devexit_p(altera_spi_remove),
|
||||
.remove = altera_spi_remove,
|
||||
.driver = {
|
||||
.name = DRV_NAME,
|
||||
.owner = THIS_MODULE,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
static __devinit int ath79_spi_probe(struct platform_device *pdev)
|
||||
static int ath79_spi_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct spi_master *master;
|
||||
struct ath79_spi *sp;
|
||||
@@ -251,7 +251,7 @@ err_put_master:
|
||||
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);
|
||||
|
||||
@@ -265,7 +265,7 @@ static __devexit int ath79_spi_remove(struct platform_device *pdev)
|
||||
|
||||
static struct platform_driver ath79_spi_driver = {
|
||||
.probe = ath79_spi_probe,
|
||||
.remove = __devexit_p(ath79_spi_remove),
|
||||
.remove = ath79_spi_remove,
|
||||
.driver = {
|
||||
.name = DRV_NAME,
|
||||
.owner = THIS_MODULE,
|
||||
|
||||
@@ -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;
|
||||
int irq;
|
||||
@@ -1003,7 +1003,7 @@ out_free:
|
||||
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 atmel_spi *as = spi_master_get_devdata(master);
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <bcm63xx_dev_spi.h>
|
||||
|
||||
#define PFX KBUILD_MODNAME
|
||||
#define DRV_VER "0.1.2"
|
||||
|
||||
struct bcm63xx_spi {
|
||||
struct completion done;
|
||||
@@ -170,13 +169,6 @@ static int bcm63xx_spi_setup(struct spi_device *spi)
|
||||
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",
|
||||
__func__, spi->mode & MODEBITS, spi->bits_per_word, 0);
|
||||
|
||||
@@ -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 device *dev = &pdev->dev;
|
||||
@@ -441,8 +433,8 @@ static int __devinit bcm63xx_spi_probe(struct platform_device *pdev)
|
||||
goto out_clk_disable;
|
||||
}
|
||||
|
||||
dev_info(dev, "at 0x%08x (irq %d, FIFOs size %d) v%s\n",
|
||||
r->start, irq, bs->fifo_size, DRV_VER);
|
||||
dev_info(dev, "at 0x%08x (irq %d, FIFOs size %d)\n",
|
||||
r->start, irq, bs->fifo_size);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -457,7 +449,7 @@ out:
|
||||
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 bcm63xx_spi *bs = spi_master_get_devdata(master);
|
||||
@@ -485,6 +477,8 @@ static int bcm63xx_spi_suspend(struct device *dev)
|
||||
platform_get_drvdata(to_platform_device(dev));
|
||||
struct bcm63xx_spi *bs = spi_master_get_devdata(master);
|
||||
|
||||
spi_master_suspend(master);
|
||||
|
||||
clk_disable(bs->clk);
|
||||
|
||||
return 0;
|
||||
@@ -498,6 +492,8 @@ static int bcm63xx_spi_resume(struct device *dev)
|
||||
|
||||
clk_enable(bs->clk);
|
||||
|
||||
spi_master_resume(master);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -518,7 +514,7 @@ static struct platform_driver bcm63xx_spi_driver = {
|
||||
.pm = BCM63XX_SPI_PM_OPS,
|
||||
},
|
||||
.probe = bcm63xx_spi_probe,
|
||||
.remove = __devexit_p(bcm63xx_spi_remove),
|
||||
.remove = bcm63xx_spi_remove,
|
||||
};
|
||||
|
||||
module_platform_driver(bcm63xx_spi_driver);
|
||||
|
||||
@@ -755,8 +755,7 @@ bfin_sport_spi_destroy_queue(struct bfin_sport_spi_master_data *drv_data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __devinit
|
||||
bfin_sport_spi_probe(struct platform_device *pdev)
|
||||
static int bfin_sport_spi_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct bfin5xx_spi_master *platform_info;
|
||||
@@ -863,8 +862,7 @@ bfin_sport_spi_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
/* stop hardware and remove the driver */
|
||||
static int __devexit
|
||||
bfin_sport_spi_remove(struct platform_device *pdev)
|
||||
static int bfin_sport_spi_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct bfin_sport_spi_master_data *drv_data = platform_get_drvdata(pdev);
|
||||
int status = 0;
|
||||
@@ -935,7 +933,7 @@ static struct platform_driver bfin_sport_spi_driver = {
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = bfin_sport_spi_probe,
|
||||
.remove = __devexit_p(bfin_sport_spi_remove),
|
||||
.remove = bfin_sport_spi_remove,
|
||||
.suspend = bfin_sport_spi_suspend,
|
||||
.resume = bfin_sport_spi_resume,
|
||||
};
|
||||
|
||||
@@ -1387,7 +1387,7 @@ out_error_get_res:
|
||||
}
|
||||
|
||||
/* 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);
|
||||
int status = 0;
|
||||
@@ -1477,7 +1477,7 @@ static struct platform_driver bfin_spi_driver = {
|
||||
},
|
||||
.suspend = bfin_spi_suspend,
|
||||
.resume = bfin_spi_resume,
|
||||
.remove = __devexit_p(bfin_spi_remove),
|
||||
.remove = bfin_spi_remove,
|
||||
};
|
||||
|
||||
static int __init bfin_spi_init(void)
|
||||
|
||||
+11
-16
@@ -260,11 +260,11 @@ static void bitbang_work(struct work_struct *work)
|
||||
struct spi_bitbang *bitbang =
|
||||
container_of(work, struct spi_bitbang, work);
|
||||
unsigned long flags;
|
||||
struct spi_message *m, *_m;
|
||||
|
||||
spin_lock_irqsave(&bitbang->lock, flags);
|
||||
bitbang->busy = 1;
|
||||
while (!list_empty(&bitbang->queue)) {
|
||||
struct spi_message *m;
|
||||
list_for_each_entry_safe(m, _m, &bitbang->queue, queue) {
|
||||
struct spi_device *spi;
|
||||
unsigned nsecs;
|
||||
struct spi_transfer *t = NULL;
|
||||
@@ -273,9 +273,7 @@ static void bitbang_work(struct work_struct *work)
|
||||
int status;
|
||||
int do_setup = -1;
|
||||
|
||||
m = container_of(bitbang->queue.next, struct spi_message,
|
||||
queue);
|
||||
list_del_init(&m->queue);
|
||||
list_del(&m->queue);
|
||||
spin_unlock_irqrestore(&bitbang->lock, flags);
|
||||
|
||||
/* FIXME this is made-up ... the correct value is known to
|
||||
@@ -346,17 +344,14 @@ static void bitbang_work(struct work_struct *work)
|
||||
if (t->delay_usecs)
|
||||
udelay(t->delay_usecs);
|
||||
|
||||
if (!cs_change)
|
||||
continue;
|
||||
if (t->transfer_list.next == &m->transfers)
|
||||
break;
|
||||
|
||||
/* sometimes a short mid-message deselect of the chip
|
||||
* may be needed to terminate a mode or command
|
||||
*/
|
||||
ndelay(nsecs);
|
||||
bitbang->chipselect(spi, BITBANG_CS_INACTIVE);
|
||||
ndelay(nsecs);
|
||||
if (cs_change && !list_is_last(&t->transfer_list, &m->transfers)) {
|
||||
/* sometimes a short mid-message deselect of the chip
|
||||
* may be needed to terminate a mode or command
|
||||
*/
|
||||
ndelay(nsecs);
|
||||
bitbang->chipselect(spi, BITBANG_CS_INACTIVE);
|
||||
ndelay(nsecs);
|
||||
}
|
||||
}
|
||||
|
||||
m->status = status;
|
||||
|
||||
@@ -0,0 +1,296 @@
|
||||
/*
|
||||
* 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)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __devinit mcfqspi_probe(struct platform_device *pdev)
|
||||
static int mcfqspi_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct spi_master *master;
|
||||
struct mcfqspi *mcfqspi;
|
||||
@@ -515,7 +515,7 @@ fail0:
|
||||
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 mcfqspi *mcfqspi = spi_master_get_devdata(master);
|
||||
@@ -594,7 +594,7 @@ static struct platform_driver mcfqspi_driver = {
|
||||
.driver.owner = THIS_MODULE,
|
||||
.driver.pm = &mcfqspi_pm,
|
||||
.probe = mcfqspi_probe,
|
||||
.remove = __devexit_p(mcfqspi_remove),
|
||||
.remove = mcfqspi_remove,
|
||||
};
|
||||
module_platform_driver(mcfqspi_driver);
|
||||
|
||||
|
||||
@@ -769,7 +769,7 @@ rx_dma_failed:
|
||||
* It will invoke spi_bitbang_start to create work queue so that client driver
|
||||
* 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 davinci_spi *dspi;
|
||||
@@ -952,7 +952,7 @@ err:
|
||||
* It will also call spi_bitbang_stop to destroy the work queue which was
|
||||
* 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 spi_master *master;
|
||||
@@ -980,7 +980,7 @@ static struct platform_driver davinci_spi_driver = {
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = davinci_spi_probe,
|
||||
.remove = __devexit_p(davinci_spi_remove),
|
||||
.remove = davinci_spi_remove,
|
||||
};
|
||||
module_platform_driver(davinci_spi_driver);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ struct dw_spi_mmio {
|
||||
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 *dws;
|
||||
@@ -106,7 +106,7 @@ err_end:
|
||||
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 resource *mem;
|
||||
@@ -129,7 +129,7 @@ static int __devexit dw_spi_mmio_remove(struct platform_device *pdev)
|
||||
|
||||
static struct platform_driver dw_spi_mmio_driver = {
|
||||
.probe = dw_spi_mmio_probe,
|
||||
.remove = __devexit_p(dw_spi_mmio_remove),
|
||||
.remove = dw_spi_mmio_remove,
|
||||
.driver = {
|
||||
.name = DRIVER_NAME,
|
||||
.owner = THIS_MODULE,
|
||||
|
||||
@@ -32,7 +32,7 @@ struct dw_spi_pci {
|
||||
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)
|
||||
{
|
||||
struct dw_spi_pci *dwpci;
|
||||
@@ -105,7 +105,7 @@ err_disable:
|
||||
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);
|
||||
|
||||
@@ -159,7 +159,7 @@ static struct pci_driver dw_spi_driver = {
|
||||
.name = DRIVER_NAME,
|
||||
.id_table = pci_ids,
|
||||
.probe = spi_pci_probe,
|
||||
.remove = __devexit_p(spi_pci_remove),
|
||||
.remove = spi_pci_remove,
|
||||
.suspend = spi_suspend,
|
||||
.resume = spi_resume,
|
||||
};
|
||||
|
||||
@@ -696,7 +696,7 @@ static void dw_spi_cleanup(struct spi_device *spi)
|
||||
kfree(chip);
|
||||
}
|
||||
|
||||
static int __devinit init_queue(struct dw_spi *dws)
|
||||
static int init_queue(struct dw_spi *dws)
|
||||
{
|
||||
INIT_LIST_HEAD(&dws->queue);
|
||||
spin_lock_init(&dws->lock);
|
||||
@@ -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;
|
||||
int ret;
|
||||
@@ -877,7 +877,7 @@ exit:
|
||||
}
|
||||
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;
|
||||
|
||||
|
||||
@@ -1023,7 +1023,7 @@ static void ep93xx_spi_release_dma(struct ep93xx_spi *espi)
|
||||
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 ep93xx_spi_info *info;
|
||||
@@ -1138,7 +1138,7 @@ fail_release_master:
|
||||
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 ep93xx_spi *espi = spi_master_get_devdata(master);
|
||||
@@ -1180,7 +1180,7 @@ static struct platform_driver ep93xx_spi_driver = {
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = ep93xx_spi_probe,
|
||||
.remove = __devexit_p(ep93xx_spi_remove),
|
||||
.remove = ep93xx_spi_remove,
|
||||
};
|
||||
module_platform_driver(ep93xx_spi_driver);
|
||||
|
||||
|
||||
@@ -403,7 +403,7 @@ static int falcon_sflash_xfer_one(struct spi_master *master,
|
||||
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 spi_master *master;
|
||||
@@ -438,7 +438,7 @@ static int __devinit falcon_sflash_probe(struct platform_device *pdev)
|
||||
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);
|
||||
|
||||
@@ -455,7 +455,7 @@ MODULE_DEVICE_TABLE(of, falcon_sflash_match);
|
||||
|
||||
static struct platform_driver falcon_sflash_driver = {
|
||||
.probe = falcon_sflash_probe,
|
||||
.remove = __devexit_p(falcon_sflash_remove),
|
||||
.remove = falcon_sflash_remove,
|
||||
.driver = {
|
||||
.name = DRV_NAME,
|
||||
.owner = THIS_MODULE,
|
||||
|
||||
@@ -587,7 +587,7 @@ static void fsl_espi_remove(struct mpc8xxx_spi *mspi)
|
||||
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 fsl_spi_platform_data *pdata = dev->platform_data;
|
||||
@@ -686,7 +686,7 @@ static int of_fsl_espi_get_chipselects(struct device *dev)
|
||||
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_node *np = ofdev->dev.of_node;
|
||||
@@ -725,7 +725,7 @@ err:
|
||||
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);
|
||||
}
|
||||
@@ -743,7 +743,7 @@ static struct platform_driver fsl_espi_driver = {
|
||||
.of_match_table = of_fsl_espi_match,
|
||||
},
|
||||
.probe = of_fsl_espi_probe,
|
||||
.remove = __devexit_p(of_fsl_espi_remove),
|
||||
.remove = of_fsl_espi_remove,
|
||||
};
|
||||
module_platform_driver(fsl_espi_driver);
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int __devexit mpc8xxx_spi_remove(struct device *dev)
|
||||
int mpc8xxx_spi_remove(struct device *dev)
|
||||
{
|
||||
struct mpc8xxx_spi *mpc8xxx_spi;
|
||||
struct spi_master *master;
|
||||
@@ -189,7 +189,7 @@ int __devexit mpc8xxx_spi_remove(struct device *dev)
|
||||
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_node *np = ofdev->dev.of_node;
|
||||
|
||||
@@ -843,7 +843,7 @@ static void fsl_spi_remove(struct mpc8xxx_spi *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 fsl_spi_platform_data *pdata = dev->platform_data;
|
||||
@@ -1041,7 +1041,7 @@ static int of_fsl_spi_free_chipselects(struct device *dev)
|
||||
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_node *np = ofdev->dev.of_node;
|
||||
@@ -1081,7 +1081,7 @@ err:
|
||||
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;
|
||||
|
||||
@@ -1105,7 +1105,7 @@ static struct platform_driver of_fsl_spi_driver = {
|
||||
.of_match_table = of_fsl_spi_match,
|
||||
},
|
||||
.probe = of_fsl_spi_probe,
|
||||
.remove = __devexit_p(of_fsl_spi_remove),
|
||||
.remove = of_fsl_spi_remove,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_MPC832x_RDB
|
||||
@@ -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
|
||||
* 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;
|
||||
int irq;
|
||||
@@ -1139,7 +1139,7 @@ static int __devinit plat_mpc8xxx_spi_probe(struct platform_device *pdev)
|
||||
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);
|
||||
}
|
||||
@@ -1147,7 +1147,7 @@ static int __devexit plat_mpc8xxx_spi_remove(struct platform_device *pdev)
|
||||
MODULE_ALIAS("platform:mpc8xxx_spi");
|
||||
static struct platform_driver mpc8xxx_spi_driver = {
|
||||
.probe = plat_mpc8xxx_spi_probe,
|
||||
.remove = __devexit_p(plat_mpc8xxx_spi_remove),
|
||||
.remove = plat_mpc8xxx_spi_remove,
|
||||
.driver = {
|
||||
.name = "mpc8xxx_spi",
|
||||
.owner = THIS_MODULE,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user