Skip to content

Commit

Permalink
Merge tag 'spi-v3.13' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/broonie/spi

Pull spi updates from Mark Brown:
 "As well as the usual driver updates and cleanups there's a few
  improvements to the core here:

   - The start of some improvements to factor out more of the SPI
     message loop into the core.  Right now this is just simplifying the
     code a bit but hopefully next time around we'll also have managed
     to roll out some noticable performance improvements which drivers
     can take advantage of.
   - Support for loading modules for ACPI enumerated SPI devices.
   - Managed registration for SPI controllers.
   - Helper for another common I/O pattern"

* tag 'spi-v3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (116 commits)
  spi/hspi: add device tree support
  spi: atmel: fix return value check in atmel_spi_probe()
  spi: spi-imx: only enable the clocks when we start to transfer a message
  spi/s3c64xx: Fix doubled clock disable on suspend
  spi/s3c64xx: Do not ignore return value of spi_master_resume/suspend
  spi: spi-mxs: Use u32 instead of uint32_t
  spi: spi-mxs: Don't set clock for each xfer
  spi: spi-mxs: Clean up setup_transfer function
  spi: spi-mxs: Remove check of spi mode bits
  spi: spi-mxs: Fix race in setup method
  spi: spi-mxs: Remove bogus setting of ssp clk rate field
  spi: spi-mxs: Remove full duplex check, spi core already does it
  spi: spi-mxs: Fix chip select control bits in DMA mode
  spi: spi-mxs: Fix extra CS pulses and read mode in multi-transfer messages
  spi: spi-mxs: Change flag arguments in txrx functions to bit flags
  spi: spi-mxs: Always clear INGORE_CRC, to keep CS asserted
  spi: spi-mxs: Remove mxs_spi_enable and mxs_spi_disable
  spi: spi-mxs: Always set LOCK_CS
  spi/s3c64xx: Add missing pm_runtime_put on setup fail
  spi/s3c64xx: Add missing pm_runtime_set_active() call in probe()
  ...
  • Loading branch information
Linus Torvalds committed Nov 12, 2013
2 parents c6d65bf + 82f85cf commit f095ca6
Show file tree
Hide file tree
Showing 62 changed files with 1,267 additions and 701 deletions.
7 changes: 7 additions & 0 deletions Documentation/devicetree/bindings/spi/sh-hspi.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Renesas HSPI.

Required properties:
- compatible : "renesas,hspi"
- reg : Offset and length of the register set for the device
- interrupts : interrupt line used by HSPI

3 changes: 3 additions & 0 deletions Documentation/driver-model/devres.txt
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,6 @@ PHY

SLAVE DMA ENGINE
devm_acpi_dma_controller_register()

SPI
devm_spi_register_master()
7 changes: 1 addition & 6 deletions drivers/hwmon/adt7310.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,8 @@ static const u8 adt7310_reg_table[] = {
static int adt7310_spi_read_word(struct device *dev, u8 reg)
{
struct spi_device *spi = to_spi_device(dev);
int ret;

ret = spi_w8r16(spi, AD7310_COMMAND(reg) | ADT7310_CMD_READ);
if (ret < 0)
return ret;

return be16_to_cpu((__force __be16)ret);
return spi_w8r16be(spi, AD7310_COMMAND(reg) | ADT7310_CMD_READ);
}

static int adt7310_spi_write_word(struct device *dev, u8 reg, u16 data)
Expand Down
5 changes: 3 additions & 2 deletions drivers/spi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ config SPI_FSL_SPI
config SPI_FSL_DSPI
tristate "Freescale DSPI controller"
select SPI_BITBANG
depends on SOC_VF610 || COMPILE_TEST
help
This enables support for the Freescale DSPI controller in master
mode. VF610 platform uses the controller.
Expand Down Expand Up @@ -369,7 +370,7 @@ config SPI_PXA2XX_PCI

config SPI_RSPI
tristate "Renesas RSPI controller"
depends on SUPERH && SH_DMAE_BASE
depends on (SUPERH || ARCH_SHMOBILE) && SH_DMAE_BASE
help
SPI driver for Renesas RSPI blocks.

Expand All @@ -393,7 +394,7 @@ config SPI_S3C24XX_FIQ

config SPI_S3C64XX
tristate "Samsung S3C64XX series type SPI"
depends on (ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5P64X0 || ARCH_EXYNOS)
depends on PLAT_SAMSUNG
select S3C64XX_DMA if ARCH_S3C64XX
help
SPI driver for Samsung S3C64XX and newer SoCs.
Expand Down
2 changes: 1 addition & 1 deletion drivers/spi/spi-altera.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ static int altera_spi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, hw);

/* setup the state for the bitbang driver */
hw->bitbang.master = spi_master_get(master);
hw->bitbang.master = master;
if (!hw->bitbang.master)
return err;
hw->bitbang.chipselect = altera_spi_chipsel;
Expand Down
2 changes: 1 addition & 1 deletion drivers/spi/spi-ath79.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ static int ath79_spi_probe(struct platform_device *pdev)
master->num_chipselect = pdata->num_chipselect;
}

sp->bitbang.master = spi_master_get(master);
sp->bitbang.master = master;
sp->bitbang.chipselect = ath79_spi_chipselect;
sp->bitbang.txrx_word[SPI_MODE_0] = ath79_spi_txrx_mode0;
sp->bitbang.setup_transfer = spi_bitbang_setup_transfer;
Expand Down
50 changes: 25 additions & 25 deletions drivers/spi/spi-atmel.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,18 @@
/* Bit manipulation macros */
#define SPI_BIT(name) \
(1 << SPI_##name##_OFFSET)
#define SPI_BF(name,value) \
#define SPI_BF(name, value) \
(((value) & ((1 << SPI_##name##_SIZE) - 1)) << SPI_##name##_OFFSET)
#define SPI_BFEXT(name,value) \
#define SPI_BFEXT(name, value) \
(((value) >> SPI_##name##_OFFSET) & ((1 << SPI_##name##_SIZE) - 1))
#define SPI_BFINS(name,value,old) \
( ((old) & ~(((1 << SPI_##name##_SIZE) - 1) << SPI_##name##_OFFSET)) \
| SPI_BF(name,value))
#define SPI_BFINS(name, value, old) \
(((old) & ~(((1 << SPI_##name##_SIZE) - 1) << SPI_##name##_OFFSET)) \
| SPI_BF(name, value))

/* Register access macros */
#define spi_readl(port,reg) \
#define spi_readl(port, reg) \
__raw_readl((port)->regs + SPI_##reg)
#define spi_writel(port,reg,value) \
#define spi_writel(port, reg, value) \
__raw_writel((value), (port)->regs + SPI_##reg)

/* use PIO for small transfers, avoiding DMA setup/teardown overhead and
Expand Down Expand Up @@ -1401,8 +1401,8 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg)
asd = spi->controller_state;
bits = (asd->csr >> 4) & 0xf;
if (bits != xfer->bits_per_word - 8) {
dev_dbg(&spi->dev, "you can't yet change "
"bits_per_word in transfers\n");
dev_dbg(&spi->dev,
"you can't yet change bits_per_word in transfers\n");
return -ENOPROTOOPT;
}
}
Expand Down Expand Up @@ -1516,7 +1516,7 @@ static int atmel_spi_probe(struct platform_device *pdev)

/* setup spi core then atmel-specific driver state */
ret = -ENOMEM;
master = spi_alloc_master(&pdev->dev, sizeof *as);
master = spi_alloc_master(&pdev->dev, sizeof(*as));
if (!master)
goto out_free;

Expand Down Expand Up @@ -1546,9 +1546,11 @@ static int atmel_spi_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&as->queue);

as->pdev = pdev;
as->regs = ioremap(regs->start, resource_size(regs));
if (!as->regs)
as->regs = devm_ioremap_resource(&pdev->dev, regs);
if (IS_ERR(as->regs)) {
ret = PTR_ERR(as->regs);
goto out_free_buffer;
}
as->phybase = regs->start;
as->irq = irq;
as->clk = clk;
Expand Down Expand Up @@ -1617,7 +1619,6 @@ static int atmel_spi_probe(struct platform_device *pdev)
out_free_irq:
free_irq(irq, master);
out_unmap_regs:
iounmap(as->regs);
out_free_buffer:
if (!as->use_pdc)
tasklet_kill(&as->tasklet);
Expand Down Expand Up @@ -1669,36 +1670,36 @@ static int atmel_spi_remove(struct platform_device *pdev)
clk_disable_unprepare(as->clk);
clk_put(as->clk);
free_irq(as->irq, master);
iounmap(as->regs);

spi_unregister_master(master);

return 0;
}

#ifdef CONFIG_PM

static int atmel_spi_suspend(struct platform_device *pdev, pm_message_t mesg)
#ifdef CONFIG_PM_SLEEP
static int atmel_spi_suspend(struct device *dev)
{
struct spi_master *master = platform_get_drvdata(pdev);
struct spi_master *master = dev_get_drvdata(dev);
struct atmel_spi *as = spi_master_get_devdata(master);

clk_disable_unprepare(as->clk);
return 0;
}

static int atmel_spi_resume(struct platform_device *pdev)
static int atmel_spi_resume(struct device *dev)
{
struct spi_master *master = platform_get_drvdata(pdev);
struct spi_master *master = dev_get_drvdata(dev);
struct atmel_spi *as = spi_master_get_devdata(master);

return clk_prepare_enable(as->clk);
clk_prepare_enable(as->clk);
return 0;
}

static SIMPLE_DEV_PM_OPS(atmel_spi_pm_ops, atmel_spi_suspend, atmel_spi_resume);

#define ATMEL_SPI_PM_OPS (&atmel_spi_pm_ops)
#else
#define atmel_spi_suspend NULL
#define atmel_spi_resume NULL
#define ATMEL_SPI_PM_OPS NULL
#endif

#if defined(CONFIG_OF)
Expand All @@ -1714,10 +1715,9 @@ static struct platform_driver atmel_spi_driver = {
.driver = {
.name = "atmel_spi",
.owner = THIS_MODULE,
.pm = ATMEL_SPI_PM_OPS,
.of_match_table = of_match_ptr(atmel_spi_dt_ids),
},
.suspend = atmel_spi_suspend,
.resume = atmel_spi_resume,
.probe = atmel_spi_probe,
.remove = atmel_spi_remove,
};
Expand Down
5 changes: 3 additions & 2 deletions drivers/spi/spi-au1550.c
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ static int au1550_spi_probe(struct platform_device *pdev)

hw = spi_master_get_devdata(master);

hw->master = spi_master_get(master);
hw->master = master;
hw->pdata = dev_get_platdata(&pdev->dev);
hw->dev = &pdev->dev;

Expand Down Expand Up @@ -985,6 +985,7 @@ static int au1550_spi_remove(struct platform_device *pdev)
MODULE_ALIAS("platform:au1550-spi");

static struct platform_driver au1550_spi_drv = {
.probe = au1550_spi_probe,
.remove = au1550_spi_remove,
.driver = {
.name = "au1550-spi",
Expand All @@ -1004,7 +1005,7 @@ static int __init au1550_spi_init(void)
printk(KERN_ERR "au1550-spi: cannot add memory"
"dbdma device\n");
}
return platform_driver_probe(&au1550_spi_drv, au1550_spi_probe);
return platform_driver_register(&au1550_spi_drv);
}
module_init(au1550_spi_init);

Expand Down
4 changes: 1 addition & 3 deletions drivers/spi/spi-bcm2835.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
bcm2835_wr(bs, BCM2835_SPI_CS,
BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX);

err = spi_register_master(master);
err = devm_spi_register_master(&pdev->dev, master);
if (err) {
dev_err(&pdev->dev, "could not register SPI master: %d\n", err);
goto out_free_irq;
Expand All @@ -381,14 +381,12 @@ static int bcm2835_spi_remove(struct platform_device *pdev)
struct bcm2835_spi *bs = spi_master_get_devdata(master);

free_irq(bs->irq, master);
spi_unregister_master(master);

/* Clear FIFOs, and disable the HW block */
bcm2835_wr(bs, BCM2835_SPI_CS,
BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX);

clk_disable_unprepare(bs->clk);
spi_master_put(master);

return 0;
}
Expand Down
6 changes: 1 addition & 5 deletions drivers/spi/spi-bcm63xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS);

/* register and we are done */
ret = spi_register_master(master);
ret = devm_spi_register_master(dev, master);
if (ret) {
dev_err(dev, "spi register failed\n");
goto out_clk_disable;
Expand All @@ -438,17 +438,13 @@ 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);

spi_unregister_master(master);

/* reset spi block */
bcm_spi_writeb(bs, 0, SPI_INT_MASK);

/* HW shutdown */
clk_disable_unprepare(bs->clk);
clk_put(bs->clk);

spi_master_put(master);

return 0;
}

Expand Down
29 changes: 15 additions & 14 deletions drivers/spi/spi-bfin-sport.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ bfin_sport_spi_setup(struct spi_device *spi)
*/
if (chip_info->ctl_reg || chip_info->enable_dma) {
ret = -EINVAL;
dev_err(&spi->dev, "don't set ctl_reg/enable_dma fields");
dev_err(&spi->dev, "don't set ctl_reg/enable_dma fields\n");
goto error;
}
chip->cs_chg_udelay = chip_info->cs_chg_udelay;
Expand Down Expand Up @@ -879,11 +879,10 @@ static int bfin_sport_spi_remove(struct platform_device *pdev)
return 0;
}

#ifdef CONFIG_PM
static int
bfin_sport_spi_suspend(struct platform_device *pdev, pm_message_t state)
#ifdef CONFIG_PM_SLEEP
static int bfin_sport_spi_suspend(struct device *dev)
{
struct bfin_sport_spi_master_data *drv_data = platform_get_drvdata(pdev);
struct bfin_sport_spi_master_data *drv_data = dev_get_drvdata(dev);
int status;

status = bfin_sport_spi_stop_queue(drv_data);
Expand All @@ -896,10 +895,9 @@ bfin_sport_spi_suspend(struct platform_device *pdev, pm_message_t state)
return status;
}

static int
bfin_sport_spi_resume(struct platform_device *pdev)
static int bfin_sport_spi_resume(struct device *dev)
{
struct bfin_sport_spi_master_data *drv_data = platform_get_drvdata(pdev);
struct bfin_sport_spi_master_data *drv_data = dev_get_drvdata(dev);
int status;

/* Enable the SPI interface */
Expand All @@ -912,19 +910,22 @@ bfin_sport_spi_resume(struct platform_device *pdev)

return status;
}

static SIMPLE_DEV_PM_OPS(bfin_sport_spi_pm_ops, bfin_sport_spi_suspend,
bfin_sport_spi_resume);

#define BFIN_SPORT_SPI_PM_OPS (&bfin_sport_spi_pm_ops)
#else
# define bfin_sport_spi_suspend NULL
# define bfin_sport_spi_resume NULL
#define BFIN_SPORT_SPI_PM_OPS NULL
#endif

static struct platform_driver bfin_sport_spi_driver = {
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,
.name = DRV_NAME,
.owner = THIS_MODULE,
.pm = BFIN_SPORT_SPI_PM_OPS,
},
.probe = bfin_sport_spi_probe,
.remove = bfin_sport_spi_remove,
.suspend = bfin_sport_spi_suspend,
.resume = bfin_sport_spi_resume,
};
module_platform_driver(bfin_sport_spi_driver);
3 changes: 1 addition & 2 deletions drivers/spi/spi-bfin-v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ static int bfin_spi_probe(struct platform_device *pdev)
tasklet_init(&drv_data->pump_transfers,
bfin_spi_pump_transfers, (unsigned long)drv_data);
/* register with the SPI framework */
ret = spi_register_master(master);
ret = devm_spi_register_master(dev, master);
if (ret) {
dev_err(dev, "can not register spi master\n");
goto err_free_peripheral;
Expand Down Expand Up @@ -898,7 +898,6 @@ static int bfin_spi_remove(struct platform_device *pdev)
free_dma(drv_data->rx_dma);
free_dma(drv_data->tx_dma);

spi_unregister_master(drv_data->master);
return 0;
}

Expand Down
Loading

0 comments on commit f095ca6

Please sign in to comment.