aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-08-31 18:55:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-08-31 18:55:49 -0400
commite5aeced6bcec5a110e6dfcb78acc203dbe895b59 (patch)
tree9f1523e0c6829c327ea8d26fc04f46756ddb5eb1 /include/linux
parentcf9d615f7f5842ca1ef0f28ed9f67a97d20cf6fc (diff)
parentc5992f610f78e6c9d0a78e8fef1066ad640e17e8 (diff)
Merge tag 'spi-v4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi updates from Mark Brown: "A few core tweaks this time together with the usual collection of driver specific updates and fixes plus a larger than average selection of new device support: - fix DMA mapping of unaligned vmalloc() buffers - statistics tracking transfer volumes exposed via sysfs - new drivers for Freescale MPC5125, Intel Sunrise Point, Mediatek SoCs, and Netlogic XLP SoCs" * tag 'spi-v4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (66 commits) spi: sh-msiof: Fix FIFO size to 64 word from 256 word spi: fsl-(e)spi: Fix checking return value of devm_ioremap_resource spi: Add DT bindings documentation for Netlogic XLP SPI controller spi/xlp: SPI controller driver for Netlogic XLP SoCs spi: fsl-espi: add runtime PM spi: fsl-(e)spi: simplify cleanup code spi: fsl-(e)spi: migrate to using devm_ functions to simplify cleanup spi: mediatek: fix SPI_CMD_PAUSE_IE macro error spi: check bits_per_word in spi_setup spi: mediatek: replace *_time name spi: mediatek: add PM clk_prepare_enable fail flow spi: mediatek: replace int with u32, delete TAB and define MTK_SPI_PAUSE_INT_STATUS marco spi: mediatek: add linux/io.h include file spi/bcm63xx-hsspi: add support for dual spi read/write spi: dw: Allow interface drivers to limit data I/O to word sizes dt: snps,dw-apb-ssi: Document new I/O data register width property spi: Fall back to master maximum speed if no slave speed specified spi: mediatek: use BIT() to instead of SPI_CMD_*_OFFSET spi: medaitek: revise quirks compatibility style spi: mediatek: fix spi incorrect endian usage ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/platform_data/spi-davinci.h1
-rw-r--r--include/linux/platform_data/spi-mt65xx.h20
-rw-r--r--include/linux/pxa2xx_ssp.h1
-rw-r--r--include/linux/spi/spi.h64
4 files changed, 86 insertions, 0 deletions
diff --git a/include/linux/platform_data/spi-davinci.h b/include/linux/platform_data/spi-davinci.h
index 8dc2fa47a2aa..f4edcb03c40c 100644
--- a/include/linux/platform_data/spi-davinci.h
+++ b/include/linux/platform_data/spi-davinci.h
@@ -49,6 +49,7 @@ struct davinci_spi_platform_data {
49 u8 num_chipselect; 49 u8 num_chipselect;
50 u8 intr_line; 50 u8 intr_line;
51 u8 *chip_sel; 51 u8 *chip_sel;
52 u8 prescaler_limit;
52 bool cshold_bug; 53 bool cshold_bug;
53 enum dma_event_q dma_event_q; 54 enum dma_event_q dma_event_q;
54}; 55};
diff --git a/include/linux/platform_data/spi-mt65xx.h b/include/linux/platform_data/spi-mt65xx.h
new file mode 100644
index 000000000000..54b04483976c
--- /dev/null
+++ b/include/linux/platform_data/spi-mt65xx.h
@@ -0,0 +1,20 @@
1/*
2 * MTK SPI bus driver definitions
3 *
4 * Copyright (c) 2015 MediaTek Inc.
5 * Author: Leilk Liu <leilk.liu@mediatek.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef ____LINUX_PLATFORM_DATA_SPI_MTK_H
13#define ____LINUX_PLATFORM_DATA_SPI_MTK_H
14
15/* Board specific platform_data */
16struct mtk_chip_config {
17 u32 tx_mlsb;
18 u32 rx_mlsb;
19};
20#endif
diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h
index 0485bab061fd..92273776bce6 100644
--- a/include/linux/pxa2xx_ssp.h
+++ b/include/linux/pxa2xx_ssp.h
@@ -197,6 +197,7 @@ enum pxa_ssp_type {
197 QUARK_X1000_SSP, 197 QUARK_X1000_SSP,
198 LPSS_LPT_SSP, /* Keep LPSS types sorted with lpss_platforms[] */ 198 LPSS_LPT_SSP, /* Keep LPSS types sorted with lpss_platforms[] */
199 LPSS_BYT_SSP, 199 LPSS_BYT_SSP,
200 LPSS_SPT_SSP,
200}; 201};
201 202
202struct ssp_device { 203struct ssp_device {
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index d673072346f2..269e8afd3e2a 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -23,6 +23,8 @@
23#include <linux/scatterlist.h> 23#include <linux/scatterlist.h>
24 24
25struct dma_chan; 25struct dma_chan;
26struct spi_master;
27struct spi_transfer;
26 28
27/* 29/*
28 * INTERFACES between SPI master-side drivers and SPI infrastructure. 30 * INTERFACES between SPI master-side drivers and SPI infrastructure.
@@ -31,6 +33,59 @@ struct dma_chan;
31extern struct bus_type spi_bus_type; 33extern struct bus_type spi_bus_type;
32 34
33/** 35/**
36 * struct spi_statistics - statistics for spi transfers
37 * @clock: lock protecting this structure
38 *
39 * @messages: number of spi-messages handled
40 * @transfers: number of spi_transfers handled
41 * @errors: number of errors during spi_transfer
42 * @timedout: number of timeouts during spi_transfer
43 *
44 * @spi_sync: number of times spi_sync is used
45 * @spi_sync_immediate:
46 * number of times spi_sync is executed immediately
47 * in calling context without queuing and scheduling
48 * @spi_async: number of times spi_async is used
49 *
50 * @bytes: number of bytes transferred to/from device
51 * @bytes_tx: number of bytes sent to device
52 * @bytes_rx: number of bytes received from device
53 *
54 */
55struct spi_statistics {
56 spinlock_t lock; /* lock for the whole structure */
57
58 unsigned long messages;
59 unsigned long transfers;
60 unsigned long errors;
61 unsigned long timedout;
62
63 unsigned long spi_sync;
64 unsigned long spi_sync_immediate;
65 unsigned long spi_async;
66
67 unsigned long long bytes;
68 unsigned long long bytes_rx;
69 unsigned long long bytes_tx;
70
71};
72
73void spi_statistics_add_transfer_stats(struct spi_statistics *stats,
74 struct spi_transfer *xfer,
75 struct spi_master *master);
76
77#define SPI_STATISTICS_ADD_TO_FIELD(stats, field, count) \
78 do { \
79 unsigned long flags; \
80 spin_lock_irqsave(&(stats)->lock, flags); \
81 (stats)->field += count; \
82 spin_unlock_irqrestore(&(stats)->lock, flags); \
83 } while (0)
84
85#define SPI_STATISTICS_INCREMENT_FIELD(stats, field) \
86 SPI_STATISTICS_ADD_TO_FIELD(stats, field, 1)
87
88/**
34 * struct spi_device - Master side proxy for an SPI slave device 89 * struct spi_device - Master side proxy for an SPI slave device
35 * @dev: Driver model representation of the device. 90 * @dev: Driver model representation of the device.
36 * @master: SPI controller used with the device. 91 * @master: SPI controller used with the device.
@@ -60,6 +115,8 @@ extern struct bus_type spi_bus_type;
60 * @cs_gpio: gpio number of the chipselect line (optional, -ENOENT when 115 * @cs_gpio: gpio number of the chipselect line (optional, -ENOENT when
61 * when not using a GPIO line) 116 * when not using a GPIO line)
62 * 117 *
118 * @statistics: statistics for the spi_device
119 *
63 * A @spi_device is used to interchange data between an SPI slave 120 * A @spi_device is used to interchange data between an SPI slave
64 * (usually a discrete chip) and CPU memory. 121 * (usually a discrete chip) and CPU memory.
65 * 122 *
@@ -98,6 +155,9 @@ struct spi_device {
98 char modalias[SPI_NAME_SIZE]; 155 char modalias[SPI_NAME_SIZE];
99 int cs_gpio; /* chip select gpio */ 156 int cs_gpio; /* chip select gpio */
100 157
158 /* the statistics */
159 struct spi_statistics statistics;
160
101 /* 161 /*
102 * likely need more hooks for more protocol options affecting how 162 * likely need more hooks for more protocol options affecting how
103 * the controller talks to each chip, like: 163 * the controller talks to each chip, like:
@@ -296,6 +356,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
296 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS 356 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
297 * number. Any individual value may be -ENOENT for CS lines that 357 * number. Any individual value may be -ENOENT for CS lines that
298 * are not GPIOs (driven by the SPI controller itself). 358 * are not GPIOs (driven by the SPI controller itself).
359 * @statistics: statistics for the spi_master
299 * @dma_tx: DMA transmit channel 360 * @dma_tx: DMA transmit channel
300 * @dma_rx: DMA receive channel 361 * @dma_rx: DMA receive channel
301 * @dummy_rx: dummy receive buffer for full-duplex devices 362 * @dummy_rx: dummy receive buffer for full-duplex devices
@@ -452,6 +513,9 @@ struct spi_master {
452 /* gpio chip select */ 513 /* gpio chip select */
453 int *cs_gpios; 514 int *cs_gpios;
454 515
516 /* statistics */
517 struct spi_statistics statistics;
518
455 /* DMA channels for use with core dmaengine helpers */ 519 /* DMA channels for use with core dmaengine helpers */
456 struct dma_chan *dma_tx; 520 struct dma_chan *dma_tx;
457 struct dma_chan *dma_rx; 521 struct dma_chan *dma_rx;