mirror of
https://github.com/torvalds/linux.git
synced 2024-11-05 11:32:04 +00:00
Merge remote-tracking branches 'spi/topic/altera', 'spi/topic/atmel', 'spi/topic/au1550', 'spi/topic/bcm63xx', 'spi/topic/bcm63xx-hsspi', 'spi/topic/bfin5xx', 'spi/topic/bitbang' and 'spi/topic/bpw' into spi-next
This commit is contained in:
parent
a78389844e
bf2f2f7958
54f4c51cc1
0dd26e53b5
7f8cf088f0
1480916ebd
6e3bc2b7b3
d9721ae149
aa188f90ff
commit
0f38af451f
@ -200,7 +200,6 @@ static irqreturn_t altera_spi_irq(int irq, void *dev)
|
|||||||
|
|
||||||
static int altera_spi_probe(struct platform_device *pdev)
|
static int altera_spi_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct altera_spi_platform_data *platp = dev_get_platdata(&pdev->dev);
|
|
||||||
struct altera_spi *hw;
|
struct altera_spi *hw;
|
||||||
struct spi_master *master;
|
struct spi_master *master;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
@ -214,6 +213,8 @@ static int altera_spi_probe(struct platform_device *pdev)
|
|||||||
master->bus_num = pdev->id;
|
master->bus_num = pdev->id;
|
||||||
master->num_chipselect = 16;
|
master->num_chipselect = 16;
|
||||||
master->mode_bits = SPI_CS_HIGH;
|
master->mode_bits = SPI_CS_HIGH;
|
||||||
|
master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 16);
|
||||||
|
master->dev.of_node = pdev->dev.of_node;
|
||||||
|
|
||||||
hw = spi_master_get_devdata(master);
|
hw = spi_master_get_devdata(master);
|
||||||
platform_set_drvdata(pdev, hw);
|
platform_set_drvdata(pdev, hw);
|
||||||
@ -245,9 +246,6 @@ static int altera_spi_probe(struct platform_device *pdev)
|
|||||||
if (err)
|
if (err)
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
/* find platform data */
|
|
||||||
if (!platp)
|
|
||||||
hw->bitbang.master->dev.of_node = pdev->dev.of_node;
|
|
||||||
|
|
||||||
/* register our spi controller */
|
/* register our spi controller */
|
||||||
err = spi_bitbang_start(&hw->bitbang);
|
err = spi_bitbang_start(&hw->bitbang);
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/gpio.h>
|
#include <linux/gpio.h>
|
||||||
|
#include <linux/pinctrl/consumer.h>
|
||||||
|
|
||||||
/* SPI register offsets */
|
/* SPI register offsets */
|
||||||
#define SPI_CR 0x0000
|
#define SPI_CR 0x0000
|
||||||
@ -1087,14 +1088,6 @@ static int atmel_spi_one_transfer(struct spi_master *master,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xfer->bits_per_word > 8) {
|
|
||||||
if (xfer->len % 2) {
|
|
||||||
dev_dbg(&spi->dev,
|
|
||||||
"buffer len should be 16 bits aligned\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DMA map early, for performance (empties dcache ASAP) and
|
* DMA map early, for performance (empties dcache ASAP) and
|
||||||
* better fault reporting.
|
* better fault reporting.
|
||||||
@ -1221,9 +1214,6 @@ static int atmel_spi_transfer_one_message(struct spi_master *master,
|
|||||||
dev_dbg(&spi->dev, "new message %p submitted for %s\n",
|
dev_dbg(&spi->dev, "new message %p submitted for %s\n",
|
||||||
msg, dev_name(&spi->dev));
|
msg, dev_name(&spi->dev));
|
||||||
|
|
||||||
if (unlikely(list_empty(&msg->transfers)))
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
atmel_spi_lock(as);
|
atmel_spi_lock(as);
|
||||||
cs_activate(as, spi);
|
cs_activate(as, spi);
|
||||||
|
|
||||||
@ -1244,10 +1234,10 @@ static int atmel_spi_transfer_one_message(struct spi_master *master,
|
|||||||
|
|
||||||
list_for_each_entry(xfer, &msg->transfers, transfer_list) {
|
list_for_each_entry(xfer, &msg->transfers, transfer_list) {
|
||||||
dev_dbg(&spi->dev,
|
dev_dbg(&spi->dev,
|
||||||
" xfer %p: len %u tx %p/%08x rx %p/%08x\n",
|
" xfer %p: len %u tx %p/%pad rx %p/%pad\n",
|
||||||
xfer, xfer->len,
|
xfer, xfer->len,
|
||||||
xfer->tx_buf, xfer->tx_dma,
|
xfer->tx_buf, &xfer->tx_dma,
|
||||||
xfer->rx_buf, xfer->rx_dma);
|
xfer->rx_buf, &xfer->rx_dma);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_done:
|
msg_done:
|
||||||
@ -1303,6 +1293,9 @@ static int atmel_spi_probe(struct platform_device *pdev)
|
|||||||
struct spi_master *master;
|
struct spi_master *master;
|
||||||
struct atmel_spi *as;
|
struct atmel_spi *as;
|
||||||
|
|
||||||
|
/* Select default pin state */
|
||||||
|
pinctrl_pm_select_default_state(&pdev->dev);
|
||||||
|
|
||||||
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
if (!regs)
|
if (!regs)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
@ -1465,6 +1458,9 @@ static int atmel_spi_suspend(struct device *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
clk_disable_unprepare(as->clk);
|
clk_disable_unprepare(as->clk);
|
||||||
|
|
||||||
|
pinctrl_pm_select_sleep_state(dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1474,6 +1470,8 @@ static int atmel_spi_resume(struct device *dev)
|
|||||||
struct atmel_spi *as = spi_master_get_devdata(master);
|
struct atmel_spi *as = spi_master_get_devdata(master);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
pinctrl_pm_select_default_state(dev);
|
||||||
|
|
||||||
clk_prepare_enable(as->clk);
|
clk_prepare_enable(as->clk);
|
||||||
|
|
||||||
/* Start the queue running */
|
/* Start the queue running */
|
||||||
|
@ -55,8 +55,6 @@ struct au1550_spi {
|
|||||||
|
|
||||||
volatile psc_spi_t __iomem *regs;
|
volatile psc_spi_t __iomem *regs;
|
||||||
int irq;
|
int irq;
|
||||||
unsigned freq_max;
|
|
||||||
unsigned freq_min;
|
|
||||||
|
|
||||||
unsigned len;
|
unsigned len;
|
||||||
unsigned tx_count;
|
unsigned tx_count;
|
||||||
@ -248,11 +246,8 @@ static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
|
|||||||
hz = t->speed_hz;
|
hz = t->speed_hz;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hz > spi->max_speed_hz || hz > hw->freq_max || hz < hw->freq_min) {
|
if (!hz)
|
||||||
dev_err(&spi->dev, "setupxfer: clock rate=%d out of range\n",
|
|
||||||
hz);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
|
||||||
|
|
||||||
au1550_spi_bits_handlers_set(hw, spi->bits_per_word);
|
au1550_spi_bits_handlers_set(hw, spi->bits_per_word);
|
||||||
|
|
||||||
@ -287,23 +282,6 @@ static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int au1550_spi_setup(struct spi_device *spi)
|
|
||||||
{
|
|
||||||
struct au1550_spi *hw = spi_master_get_devdata(spi->master);
|
|
||||||
|
|
||||||
if (spi->max_speed_hz == 0)
|
|
||||||
spi->max_speed_hz = hw->freq_max;
|
|
||||||
if (spi->max_speed_hz > hw->freq_max
|
|
||||||
|| spi->max_speed_hz < hw->freq_min)
|
|
||||||
return -EINVAL;
|
|
||||||
/*
|
|
||||||
* NOTE: cannot change speed and other hw settings immediately,
|
|
||||||
* otherwise sharing of spi bus is not possible,
|
|
||||||
* so do not call setupxfer(spi, NULL) here
|
|
||||||
*/
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* for dma spi transfers, we have to setup rx channel, otherwise there is
|
* for dma spi transfers, we have to setup rx channel, otherwise there is
|
||||||
* no reliable way how to recognize that spi transfer is done
|
* no reliable way how to recognize that spi transfer is done
|
||||||
@ -838,7 +816,6 @@ static int au1550_spi_probe(struct platform_device *pdev)
|
|||||||
hw->bitbang.master = hw->master;
|
hw->bitbang.master = hw->master;
|
||||||
hw->bitbang.setup_transfer = au1550_spi_setupxfer;
|
hw->bitbang.setup_transfer = au1550_spi_setupxfer;
|
||||||
hw->bitbang.chipselect = au1550_spi_chipsel;
|
hw->bitbang.chipselect = au1550_spi_chipsel;
|
||||||
hw->bitbang.master->setup = au1550_spi_setup;
|
|
||||||
hw->bitbang.txrx_bufs = au1550_spi_txrx_bufs;
|
hw->bitbang.txrx_bufs = au1550_spi_txrx_bufs;
|
||||||
|
|
||||||
if (hw->usedma) {
|
if (hw->usedma) {
|
||||||
@ -909,8 +886,9 @@ static int au1550_spi_probe(struct platform_device *pdev)
|
|||||||
{
|
{
|
||||||
int min_div = (2 << 0) * (2 * (4 + 1));
|
int min_div = (2 << 0) * (2 * (4 + 1));
|
||||||
int max_div = (2 << 3) * (2 * (63 + 1));
|
int max_div = (2 << 3) * (2 * (63 + 1));
|
||||||
hw->freq_max = hw->pdata->mainclk_hz / min_div;
|
master->max_speed_hz = hw->pdata->mainclk_hz / min_div;
|
||||||
hw->freq_min = hw->pdata->mainclk_hz / (max_div + 1) + 1;
|
master->min_speed_hz =
|
||||||
|
hw->pdata->mainclk_hz / (max_div + 1) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
au1550_spi_setup_psc_as_spi(hw);
|
au1550_spi_setup_psc_as_spi(hw);
|
||||||
|
@ -453,9 +453,8 @@ static int bcm63xx_hsspi_resume(struct device *dev)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const struct dev_pm_ops bcm63xx_hsspi_pm_ops = {
|
static SIMPLE_DEV_PM_OPS(bcm63xx_hsspi_pm_ops, bcm63xx_hsspi_suspend,
|
||||||
SET_SYSTEM_SLEEP_PM_OPS(bcm63xx_hsspi_suspend, bcm63xx_hsspi_resume)
|
bcm63xx_hsspi_resume);
|
||||||
};
|
|
||||||
|
|
||||||
static struct platform_driver bcm63xx_hsspi_driver = {
|
static struct platform_driver bcm63xx_hsspi_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
|
@ -35,8 +35,6 @@
|
|||||||
|
|
||||||
#include <bcm63xx_dev_spi.h>
|
#include <bcm63xx_dev_spi.h>
|
||||||
|
|
||||||
#define PFX KBUILD_MODNAME
|
|
||||||
|
|
||||||
#define BCM63XX_SPI_MAX_PREPEND 15
|
#define BCM63XX_SPI_MAX_PREPEND 15
|
||||||
|
|
||||||
struct bcm63xx_spi {
|
struct bcm63xx_spi {
|
||||||
|
@ -822,7 +822,8 @@ static int bfin_spi_probe(struct platform_device *pdev)
|
|||||||
master->cleanup = bfin_spi_cleanup;
|
master->cleanup = bfin_spi_cleanup;
|
||||||
master->setup = bfin_spi_setup;
|
master->setup = bfin_spi_setup;
|
||||||
master->transfer_one_message = bfin_spi_transfer_one_message;
|
master->transfer_one_message = bfin_spi_transfer_one_message;
|
||||||
master->bits_per_word_mask = BIT(32 - 1) | BIT(16 - 1) | BIT(8 - 1);
|
master->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(16) |
|
||||||
|
SPI_BPW_MASK(8);
|
||||||
|
|
||||||
drv_data = spi_master_get_devdata(master);
|
drv_data = spi_master_get_devdata(master);
|
||||||
drv_data->master = master;
|
drv_data->master = master;
|
||||||
|
@ -350,7 +350,6 @@ static void *bfin_spi_next_transfer(struct bfin_spi_master_data *drv_data)
|
|||||||
static void bfin_spi_giveback(struct bfin_spi_master_data *drv_data)
|
static void bfin_spi_giveback(struct bfin_spi_master_data *drv_data)
|
||||||
{
|
{
|
||||||
struct bfin_spi_slave_data *chip = drv_data->cur_chip;
|
struct bfin_spi_slave_data *chip = drv_data->cur_chip;
|
||||||
struct spi_transfer *last_transfer;
|
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
struct spi_message *msg;
|
struct spi_message *msg;
|
||||||
|
|
||||||
@ -362,9 +361,6 @@ static void bfin_spi_giveback(struct bfin_spi_master_data *drv_data)
|
|||||||
queue_work(drv_data->workqueue, &drv_data->pump_messages);
|
queue_work(drv_data->workqueue, &drv_data->pump_messages);
|
||||||
spin_unlock_irqrestore(&drv_data->lock, flags);
|
spin_unlock_irqrestore(&drv_data->lock, flags);
|
||||||
|
|
||||||
last_transfer = list_entry(msg->transfers.prev,
|
|
||||||
struct spi_transfer, transfer_list);
|
|
||||||
|
|
||||||
msg->state = NULL;
|
msg->state = NULL;
|
||||||
|
|
||||||
if (!drv_data->cs_change)
|
if (!drv_data->cs_change)
|
||||||
@ -1030,10 +1026,6 @@ static int bfin_spi_setup(struct spi_device *spi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* translate common spi framework into our register */
|
/* translate common spi framework into our register */
|
||||||
if (spi->mode & ~(SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST)) {
|
|
||||||
dev_err(&spi->dev, "unsupported spi modes detected\n");
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
if (spi->mode & SPI_CPOL)
|
if (spi->mode & SPI_CPOL)
|
||||||
chip->ctl_reg |= BIT_CTL_CPOL;
|
chip->ctl_reg |= BIT_CTL_CPOL;
|
||||||
if (spi->mode & SPI_CPHA)
|
if (spi->mode & SPI_CPHA)
|
||||||
|
@ -467,11 +467,9 @@ EXPORT_SYMBOL_GPL(spi_bitbang_start);
|
|||||||
/**
|
/**
|
||||||
* spi_bitbang_stop - stops the task providing spi communication
|
* spi_bitbang_stop - stops the task providing spi communication
|
||||||
*/
|
*/
|
||||||
int spi_bitbang_stop(struct spi_bitbang *bitbang)
|
void spi_bitbang_stop(struct spi_bitbang *bitbang)
|
||||||
{
|
{
|
||||||
spi_unregister_master(bitbang->master);
|
spi_unregister_master(bitbang->master);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(spi_bitbang_stop);
|
EXPORT_SYMBOL_GPL(spi_bitbang_stop);
|
||||||
|
|
||||||
|
@ -309,7 +309,6 @@ done:
|
|||||||
static void butterfly_detach(struct parport *p)
|
static void butterfly_detach(struct parport *p)
|
||||||
{
|
{
|
||||||
struct butterfly *pp;
|
struct butterfly *pp;
|
||||||
int status;
|
|
||||||
|
|
||||||
/* FIXME this global is ugly ... but, how to quickly get from
|
/* FIXME this global is ugly ... but, how to quickly get from
|
||||||
* the parport to the "struct butterfly" associated with it?
|
* the parport to the "struct butterfly" associated with it?
|
||||||
@ -321,7 +320,7 @@ static void butterfly_detach(struct parport *p)
|
|||||||
butterfly = NULL;
|
butterfly = NULL;
|
||||||
|
|
||||||
/* stop() unregisters child devices too */
|
/* stop() unregisters child devices too */
|
||||||
status = spi_bitbang_stop(&pp->bitbang);
|
spi_bitbang_stop(&pp->bitbang);
|
||||||
|
|
||||||
/* turn off VCC */
|
/* turn off VCC */
|
||||||
parport_write_data(pp->port, 0);
|
parport_write_data(pp->port, 0);
|
||||||
|
@ -503,13 +503,12 @@ 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;
|
||||||
int status;
|
|
||||||
|
|
||||||
spi_gpio = platform_get_drvdata(pdev);
|
spi_gpio = platform_get_drvdata(pdev);
|
||||||
pdata = dev_get_platdata(&pdev->dev);
|
pdata = dev_get_platdata(&pdev->dev);
|
||||||
|
|
||||||
/* stop() unregisters child devices too */
|
/* stop() unregisters child devices too */
|
||||||
status = spi_bitbang_stop(&spi_gpio->bitbang);
|
spi_bitbang_stop(&spi_gpio->bitbang);
|
||||||
|
|
||||||
if (SPI_MISO_GPIO != SPI_GPIO_NO_MISO)
|
if (SPI_MISO_GPIO != SPI_GPIO_NO_MISO)
|
||||||
gpio_free(SPI_MISO_GPIO);
|
gpio_free(SPI_MISO_GPIO);
|
||||||
@ -518,7 +517,7 @@ static int spi_gpio_remove(struct platform_device *pdev)
|
|||||||
gpio_free(SPI_SCK_GPIO);
|
gpio_free(SPI_SCK_GPIO);
|
||||||
spi_master_put(spi_gpio->bitbang.master);
|
spi_master_put(spi_gpio->bitbang.master);
|
||||||
|
|
||||||
return status;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MODULE_ALIAS("platform:" DRIVER_NAME);
|
MODULE_ALIAS("platform:" DRIVER_NAME);
|
||||||
|
@ -539,14 +539,13 @@ static int uwire_probe(struct platform_device *pdev)
|
|||||||
static int uwire_remove(struct platform_device *pdev)
|
static int uwire_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct uwire_spi *uwire = platform_get_drvdata(pdev);
|
struct uwire_spi *uwire = platform_get_drvdata(pdev);
|
||||||
int status;
|
|
||||||
|
|
||||||
// FIXME remove all child devices, somewhere ...
|
// FIXME remove all child devices, somewhere ...
|
||||||
|
|
||||||
status = spi_bitbang_stop(&uwire->bitbang);
|
spi_bitbang_stop(&uwire->bitbang);
|
||||||
uwire_off(uwire);
|
uwire_off(uwire);
|
||||||
iounmap(uwire_base);
|
iounmap(uwire_base);
|
||||||
return status;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* work with hotplug and coldplug */
|
/* work with hotplug and coldplug */
|
||||||
|
@ -435,7 +435,8 @@ static int ti_qspi_probe(struct platform_device *pdev)
|
|||||||
master->auto_runtime_pm = true;
|
master->auto_runtime_pm = true;
|
||||||
master->transfer_one_message = ti_qspi_start_transfer_one;
|
master->transfer_one_message = ti_qspi_start_transfer_one;
|
||||||
master->dev.of_node = pdev->dev.of_node;
|
master->dev.of_node = pdev->dev.of_node;
|
||||||
master->bits_per_word_mask = BIT(32 - 1) | BIT(16 - 1) | BIT(8 - 1);
|
master->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(16) |
|
||||||
|
SPI_BPW_MASK(8);
|
||||||
|
|
||||||
if (!of_property_read_u32(np, "num-cs", &num_cs))
|
if (!of_property_read_u32(np, "num-cs", &num_cs))
|
||||||
master->num_chipselect = num_cs;
|
master->num_chipselect = num_cs;
|
||||||
|
@ -42,6 +42,6 @@ extern int spi_bitbang_setup_transfer(struct spi_device *spi,
|
|||||||
|
|
||||||
/* start or stop queue processing */
|
/* start or stop queue processing */
|
||||||
extern int spi_bitbang_start(struct spi_bitbang *spi);
|
extern int spi_bitbang_start(struct spi_bitbang *spi);
|
||||||
extern int spi_bitbang_stop(struct spi_bitbang *spi);
|
extern void spi_bitbang_stop(struct spi_bitbang *spi);
|
||||||
|
|
||||||
#endif /* __SPI_BITBANG_H */
|
#endif /* __SPI_BITBANG_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user