Merge tag 'spi-for-linus' of git://git.secretlab.ca/git/linux
Pull SPI changes from Grant Likely: "Changes to both core spi code and spi device drivers. The driver changes are the usual set of bug fixes and platform enablement. Core code changes include: - More intelligent assignment of SPI bus numbers when using DT - Common mechanism for using gpios as CS lines - Pull checks for bits_per_word and transfer speed out of drivers and into core code - Ensure temporary DMA buffers are DMA safe" * tag 'spi-for-linus' of git://git.secretlab.ca/git/linux: (50 commits) spi: Document cs_gpios and cs_gpio in kernel-doc spi/of: Fix initialization of cs_gpios array spi/pxa2xx: add support for Lynxpoint SPI controllers spi/pxa2xx: add support for Intel Low Power Subsystem SPI spi/pxa2xx: add support for SPI_LOOP spi/pxa2xx: add support for runtime PM spi/pxa2xx: add support for DMA engine spi/pxa2xx: break out the private DMA API usage into a separate file spi/ath79: add shutdown handler spi/mips-lantiq: set SPI_MASTER_HALF_DUPLEX flag spi/mips-lantiq: make use of spi_finalize_current_message spi/bcm63xx: work around inability to keep CS up spi/davinci: use request_threaded_irq() to fix deadlock spi/orion: Use module_platform_driver() spi/bcm63xx: reject transfers unable to transfer spi: Ensure memory used for spi_write_then_read() is DMA safe spi/spi-mpc512x-psc: init mode bits supported by the driver spi/mpc512x-psc: don't use obsolet cell-index property spi: Remove erroneous __init, __exit and __exit_p() references in drivers spi/s3c64xx: fix checkpatch warnings and error ...
This commit is contained in:
@@ -1080,7 +1080,8 @@ static int of_spi_register_master(struct spi_master *master)
|
||||
if (!master->cs_gpios)
|
||||
return -ENOMEM;
|
||||
|
||||
memset(cs, -EINVAL, master->num_chipselect);
|
||||
for (i = 0; i < master->num_chipselect; i++)
|
||||
cs[i] = -EINVAL;
|
||||
|
||||
for (i = 0; i < nb; i++)
|
||||
cs[i] = of_get_named_gpio(np, "cs-gpios", i);
|
||||
@@ -1135,6 +1136,9 @@ int spi_register_master(struct spi_master *master)
|
||||
if (master->num_chipselect == 0)
|
||||
return -EINVAL;
|
||||
|
||||
if ((master->bus_num < 0) && master->dev.of_node)
|
||||
master->bus_num = of_alias_get_id(master->dev.of_node, "spi");
|
||||
|
||||
/* convention: dynamically assigned bus IDs count down from the max */
|
||||
if (master->bus_num < 0) {
|
||||
/* FIXME switch to an IDR based scheme, something like
|
||||
@@ -1366,12 +1370,14 @@ static int __spi_async(struct spi_device *spi, struct spi_message *message)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set transfer bits_per_word as spi device default if it is not
|
||||
* set for this transfer.
|
||||
* Set transfer bits_per_word and max speed as spi device default if
|
||||
* it is not set for this transfer.
|
||||
*/
|
||||
list_for_each_entry(xfer, &message->transfers, transfer_list) {
|
||||
if (!xfer->bits_per_word)
|
||||
xfer->bits_per_word = spi->bits_per_word;
|
||||
if (!xfer->speed_hz)
|
||||
xfer->speed_hz = spi->max_speed_hz;
|
||||
}
|
||||
|
||||
message->spi = spi;
|
||||
@@ -1656,7 +1662,8 @@ int spi_write_then_read(struct spi_device *spi,
|
||||
* using the pre-allocated buffer or the transfer is too large.
|
||||
*/
|
||||
if ((n_tx + n_rx) > SPI_BUFSIZ || !mutex_trylock(&lock)) {
|
||||
local_buf = kmalloc(max((unsigned)SPI_BUFSIZ, n_tx + n_rx), GFP_KERNEL);
|
||||
local_buf = kmalloc(max((unsigned)SPI_BUFSIZ, n_tx + n_rx),
|
||||
GFP_KERNEL | GFP_DMA);
|
||||
if (!local_buf)
|
||||
return -ENOMEM;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user