aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 13:32:00 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 13:32:00 -0400
commit5f0e685f316a1de6d3af8b23eaf46651faca32ab (patch)
treeaf1ed231b7fcfc65b146be59a0aee699aa9f6353 /include/linux
parentf8974cb71310a05632aada76be6a27576d61e609 (diff)
parent87bf5ab82884c829366914aaa813cc8b07b9fe58 (diff)
Merge tag 'spi-for-linus' of git://git.secretlab.ca/git/linux-2.6
Pull SPI changes for v3.4 from Grant Likely: "Mostly a bunch of new drivers and driver bug fixes; but this also includes a few patches that create a core message queue infrastructure for the spi subsystem instead of making each driver open code it." * tag 'spi-for-linus' of git://git.secretlab.ca/git/linux-2.6: (34 commits) spi/fsl-espi: Make sure pm is within 2..32 spi/fsl-espi: make the clock computation easier to read spi: sh-hspi: modify write/read method spi: sh-hspi: control spi clock more correctly spi: sh-hspi: convert to using core message queue spi: s3c64xx: Fix build spi: s3c64xx: remove unnecessary callback msg->complete spi: remove redundant variable assignment spi: release lock on error path in spi_pump_messages() spi: Compatibility with direction which is used in samsung DMA operation spi-topcliff-pch: add recovery processing in case wait-event timeout spi-topcliff-pch: supports a spi mode setup and bit order setup by IO control spi-topcliff-pch: Fix issue for transmitting over 4KByte spi-topcliff-pch: Modify pci-bus number dynamically to get DMA device info spi/imx: simplify error handling to free gpios spi: Convert to DEFINE_PCI_DEVICE_TABLE spi: add Broadcom BCM63xx SPI controller driver SPI: add CSR SiRFprimaII SPI controller driver spi-topcliff-pch: fix -Wuninitialized warning spi: Mark spi_register_board_info() __devinit ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/amba/pl022.h3
-rw-r--r--include/linux/spi/sh_hspi.h23
-rw-r--r--include/linux/spi/spi.h53
3 files changed, 78 insertions, 1 deletions
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
index 572f637299c9..3672f40f3455 100644
--- a/include/linux/amba/pl022.h
+++ b/include/linux/amba/pl022.h
@@ -241,6 +241,8 @@ struct dma_chan;
241 * @autosuspend_delay: delay in ms following transfer completion before the 241 * @autosuspend_delay: delay in ms following transfer completion before the
242 * runtime power management system suspends the device. A setting of 0 242 * runtime power management system suspends the device. A setting of 0
243 * indicates no delay and the device will be suspended immediately. 243 * indicates no delay and the device will be suspended immediately.
244 * @rt: indicates the controller should run the message pump with realtime
245 * priority to minimise the transfer latency on the bus.
244 */ 246 */
245struct pl022_ssp_controller { 247struct pl022_ssp_controller {
246 u16 bus_id; 248 u16 bus_id;
@@ -250,6 +252,7 @@ struct pl022_ssp_controller {
250 void *dma_rx_param; 252 void *dma_rx_param;
251 void *dma_tx_param; 253 void *dma_tx_param;
252 int autosuspend_delay; 254 int autosuspend_delay;
255 bool rt;
253}; 256};
254 257
255/** 258/**
diff --git a/include/linux/spi/sh_hspi.h b/include/linux/spi/sh_hspi.h
new file mode 100644
index 000000000000..a1121f872ac1
--- /dev/null
+++ b/include/linux/spi/sh_hspi.h
@@ -0,0 +1,23 @@
1/*
2 * Copyright (C) 2011 Kuninori Morimoto
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17#ifndef SH_HSPI_H
18#define SH_HSPI_H
19
20struct sh_hspi_info {
21};
22
23#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 176fce9cc6b1..98679b061b63 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -22,6 +22,7 @@
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/mod_devicetable.h> 23#include <linux/mod_devicetable.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/kthread.h>
25 26
26/* 27/*
27 * INTERFACES between SPI master-side drivers and SPI infrastructure. 28 * INTERFACES between SPI master-side drivers and SPI infrastructure.
@@ -235,6 +236,27 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
235 * the device whose settings are being modified. 236 * the device whose settings are being modified.
236 * @transfer: adds a message to the controller's transfer queue. 237 * @transfer: adds a message to the controller's transfer queue.
237 * @cleanup: frees controller-specific state 238 * @cleanup: frees controller-specific state
239 * @queued: whether this master is providing an internal message queue
240 * @kworker: thread struct for message pump
241 * @kworker_task: pointer to task for message pump kworker thread
242 * @pump_messages: work struct for scheduling work to the message pump
243 * @queue_lock: spinlock to syncronise access to message queue
244 * @queue: message queue
245 * @cur_msg: the currently in-flight message
246 * @busy: message pump is busy
247 * @running: message pump is running
248 * @rt: whether this queue is set to run as a realtime task
249 * @prepare_transfer_hardware: a message will soon arrive from the queue
250 * so the subsystem requests the driver to prepare the transfer hardware
251 * by issuing this call
252 * @transfer_one_message: the subsystem calls the driver to transfer a single
253 * message while queuing transfers that arrive in the meantime. When the
254 * driver is finished with this message, it must call
255 * spi_finalize_current_message() so the subsystem can issue the next
256 * transfer
257 * @prepare_transfer_hardware: there are currently no more messages on the
258 * queue so the subsystem notifies the driver that it may relax the
259 * hardware by issuing this call
238 * 260 *
239 * Each SPI master controller can communicate with one or more @spi_device 261 * Each SPI master controller can communicate with one or more @spi_device
240 * children. These make a small bus, sharing MOSI, MISO and SCK signals 262 * children. These make a small bus, sharing MOSI, MISO and SCK signals
@@ -318,6 +340,28 @@ struct spi_master {
318 340
319 /* called on release() to free memory provided by spi_master */ 341 /* called on release() to free memory provided by spi_master */
320 void (*cleanup)(struct spi_device *spi); 342 void (*cleanup)(struct spi_device *spi);
343
344 /*
345 * These hooks are for drivers that want to use the generic
346 * master transfer queueing mechanism. If these are used, the
347 * transfer() function above must NOT be specified by the driver.
348 * Over time we expect SPI drivers to be phased over to this API.
349 */
350 bool queued;
351 struct kthread_worker kworker;
352 struct task_struct *kworker_task;
353 struct kthread_work pump_messages;
354 spinlock_t queue_lock;
355 struct list_head queue;
356 struct spi_message *cur_msg;
357 bool busy;
358 bool running;
359 bool rt;
360
361 int (*prepare_transfer_hardware)(struct spi_master *master);
362 int (*transfer_one_message)(struct spi_master *master,
363 struct spi_message *mesg);
364 int (*unprepare_transfer_hardware)(struct spi_master *master);
321}; 365};
322 366
323static inline void *spi_master_get_devdata(struct spi_master *master) 367static inline void *spi_master_get_devdata(struct spi_master *master)
@@ -343,6 +387,13 @@ static inline void spi_master_put(struct spi_master *master)
343 put_device(&master->dev); 387 put_device(&master->dev);
344} 388}
345 389
390/* PM calls that need to be issued by the driver */
391extern int spi_master_suspend(struct spi_master *master);
392extern int spi_master_resume(struct spi_master *master);
393
394/* Calls the driver make to interact with the message queue */
395extern struct spi_message *spi_get_next_queued_message(struct spi_master *master);
396extern void spi_finalize_current_message(struct spi_master *master);
346 397
347/* the spi driver core manages memory for the spi_master classdev */ 398/* the spi driver core manages memory for the spi_master classdev */
348extern struct spi_master * 399extern struct spi_master *
@@ -549,7 +600,7 @@ static inline struct spi_message *spi_message_alloc(unsigned ntrans, gfp_t flags
549 + ntrans * sizeof(struct spi_transfer), 600 + ntrans * sizeof(struct spi_transfer),
550 flags); 601 flags);
551 if (m) { 602 if (m) {
552 int i; 603 unsigned i;
553 struct spi_transfer *t = (struct spi_transfer *)(m + 1); 604 struct spi_transfer *t = (struct spi_transfer *)(m + 1);
554 605
555 INIT_LIST_HEAD(&m->transfers); 606 INIT_LIST_HEAD(&m->transfers);