Skip to content

Commit 50ae833

Browse files
committed
Merge tag 'spi-v4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi updates from Mark Brown: "A quiet release for SPI, not even many driver updates: - Add a dummy loopback driver for use in exercising framework features during development. - Move the test utilities to tools/ and add support for transferring data to and from a file instead of stdin and stdout to spidev_test. - Support for Mediatek MT2701 and Renesas AG5 deices" * tag 'spi-v4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (69 commits) spi: loopback: fix typo in MODULE_PARM_DESC spi: sun4i: Prevent chip-select from being activated twice before a transfer spi: loopback-test: spi_check_rx_ranges can get always done spi: loopback-test: rename method spi_test_fill_tx to spi_test_fill_pattern spi: loopback-test: write rx pattern also when running without tx_buf spi: fsl-espi: expose maximum transfer size limit spi: expose master transfer size limitation. spi: zynq: use to_platform_device() spi: cadence: use to_platform_device() spi: mediatek: Add spi support for mt2701 IC spi: mediatek: merge all identical compat to mtk_common_compat spi: mtk: Add bindings for mediatek MT2701 soc platform spi: mediatek: Prevent overflows in FIFO transfers spi: s3c64xx: Remove unused platform_device_id entries spi: use to_spi_device spi: dw: Use SPI_TMOD_TR rather than magic const 0 to set tmode spi: imx: defer spi initialization, if DMA engine is spi: imx: return error from dma channel request spi: imx: enable loopback only for ECSPI controller family spi: imx: fix loopback mode setup after controller reset ...
2 parents ac53b2e + cabeea9 commit 50ae833

36 files changed

Lines changed: 1536 additions & 232 deletions

‎Documentation/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
subdir-y := accounting auxdisplay blackfin connector \
22
filesystems filesystems ia64 laptops mic misc-devices \
3-
networking pcmcia prctl ptp spi timers vDSO video4linux \
3+
networking pcmcia prctl ptp timers vDSO video4linux \
44
watchdog

‎Documentation/devicetree/bindings/spi/sh-msiof.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Required properties:
1010
"renesas,msiof-r8a7792" (R-Car V2H)
1111
"renesas,msiof-r8a7793" (R-Car M2-N)
1212
"renesas,msiof-r8a7794" (R-Car E2)
13+
"renesas,msiof-sh73a0" (SH-Mobile AG5)
1314
- reg : A list of offsets and lengths of the register sets for
1415
the device.
1516
If only one register set is present, it is to be used

‎Documentation/devicetree/bindings/spi/spi-mt65xx.txt‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ Binding for MTK SPI controller
22

33
Required properties:
44
- compatible: should be one of the following.
5-
- mediatek,mt8173-spi: for mt8173 platforms
6-
- mediatek,mt8135-spi: for mt8135 platforms
5+
- mediatek,mt2701-spi: for mt2701 platforms
76
- mediatek,mt6589-spi: for mt6589 platforms
7+
- mediatek,mt8135-spi: for mt8135 platforms
8+
- mediatek,mt8173-spi: for mt8173 platforms
89

910
- #address-cells: should be 1.
1011

@@ -29,10 +30,10 @@ Required properties:
2930
muxes clock, and "spi-clk" for the clock gate.
3031

3132
Optional properties:
32-
-cs-gpios: see spi-bus.txt, only required for MT8173.
33+
-cs-gpios: see spi-bus.txt.
3334

3435
- mediatek,pad-select: specify which pins group(ck/mi/mo/cs) spi
35-
controller used. This is a array, the element value should be 0~3,
36+
controller used. This is an array, the element value should be 0~3,
3637
only required for MT8173.
3738
0: specify GPIO69,70,71,72 for spi pins.
3839
1: specify GPIO102,103,104,105 for spi pins.

‎Documentation/spi/00-INDEX‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@ pxa2xx
1010
- PXA2xx SPI master controller build by spi_message fifo wq
1111
spidev
1212
- Intro to the userspace API for spi devices
13-
spidev_fdx.c
14-
- spidev example file
1513
spi-lm70llp
1614
- Connecting an LM70-LLP sensor to the kernel via the SPI subsys.
1715
spi-sc18is602
1816
- NXP SC18IS602/603 I2C-bus to SPI bridge
1917
spi-summary
2018
- (Linux) SPI overview. If unsure about SPI or SPI in Linux, start here.
21-
spidev_test.c
22-
- SPI testing utility.

‎Documentation/spi/Makefile‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎arch/arm/plat-samsung/devs.c‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,9 +1100,7 @@ struct platform_device s3c_device_wdt = {
11001100
#ifdef CONFIG_S3C64XX_DEV_SPI0
11011101
static struct resource s3c64xx_spi0_resource[] = {
11021102
[0] = DEFINE_RES_MEM(S3C_PA_SPI0, SZ_256),
1103-
[1] = DEFINE_RES_DMA(DMACH_SPI0_TX),
1104-
[2] = DEFINE_RES_DMA(DMACH_SPI0_RX),
1105-
[3] = DEFINE_RES_IRQ(IRQ_SPI0),
1103+
[1] = DEFINE_RES_IRQ(IRQ_SPI0),
11061104
};
11071105

11081106
struct platform_device s3c64xx_device_spi0 = {
@@ -1130,6 +1128,8 @@ void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
11301128
pd.num_cs = num_cs;
11311129
pd.src_clk_nr = src_clk_nr;
11321130
pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio;
1131+
pd.dma_tx = (void *)DMACH_SPI0_TX;
1132+
pd.dma_rx = (void *)DMACH_SPI0_RX;
11331133
#if defined(CONFIG_PL330_DMA)
11341134
pd.filter = pl330_filter;
11351135
#elif defined(CONFIG_S3C64XX_PL080)
@@ -1145,9 +1145,7 @@ void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
11451145
#ifdef CONFIG_S3C64XX_DEV_SPI1
11461146
static struct resource s3c64xx_spi1_resource[] = {
11471147
[0] = DEFINE_RES_MEM(S3C_PA_SPI1, SZ_256),
1148-
[1] = DEFINE_RES_DMA(DMACH_SPI1_TX),
1149-
[2] = DEFINE_RES_DMA(DMACH_SPI1_RX),
1150-
[3] = DEFINE_RES_IRQ(IRQ_SPI1),
1148+
[1] = DEFINE_RES_IRQ(IRQ_SPI1),
11511149
};
11521150

11531151
struct platform_device s3c64xx_device_spi1 = {
@@ -1175,22 +1173,23 @@ void __init s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
11751173
pd.num_cs = num_cs;
11761174
pd.src_clk_nr = src_clk_nr;
11771175
pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio;
1176+
pd.dma_tx = (void *)DMACH_SPI1_TX;
1177+
pd.dma_rx = (void *)DMACH_SPI1_RX;
11781178
#if defined(CONFIG_PL330_DMA)
11791179
pd.filter = pl330_filter;
11801180
#elif defined(CONFIG_S3C64XX_PL080)
11811181
pd.filter = pl08x_filter_id;
11821182
#endif
11831183

1184+
11841185
s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1);
11851186
}
11861187
#endif /* CONFIG_S3C64XX_DEV_SPI1 */
11871188

11881189
#ifdef CONFIG_S3C64XX_DEV_SPI2
11891190
static struct resource s3c64xx_spi2_resource[] = {
11901191
[0] = DEFINE_RES_MEM(S3C_PA_SPI2, SZ_256),
1191-
[1] = DEFINE_RES_DMA(DMACH_SPI2_TX),
1192-
[2] = DEFINE_RES_DMA(DMACH_SPI2_RX),
1193-
[3] = DEFINE_RES_IRQ(IRQ_SPI2),
1192+
[1] = DEFINE_RES_IRQ(IRQ_SPI2),
11941193
};
11951194

11961195
struct platform_device s3c64xx_device_spi2 = {
@@ -1218,6 +1217,8 @@ void __init s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
12181217
pd.num_cs = num_cs;
12191218
pd.src_clk_nr = src_clk_nr;
12201219
pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio;
1220+
pd.dma_tx = (void *)DMACH_SPI2_TX;
1221+
pd.dma_rx = (void *)DMACH_SPI2_RX;
12211222
#if defined(CONFIG_PL330_DMA)
12221223
pd.filter = pl330_filter;
12231224
#elif defined(CONFIG_S3C64XX_PL080)

‎drivers/spi/Kconfig‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ config SPI_TEGRA20_SLINK
585585

586586
config SPI_TOPCLIFF_PCH
587587
tristate "Intel EG20T PCH/LAPIS Semicon IOH(ML7213/ML7223/ML7831) SPI"
588-
depends on PCI && (X86_32 || COMPILE_TEST)
588+
depends on PCI && (X86_32 || MIPS || COMPILE_TEST)
589589
help
590590
SPI driver for the Topcliff PCH (Platform Controller Hub) SPI bus
591591
used in some x86 embedded processors.
@@ -689,6 +689,15 @@ config SPI_SPIDEV
689689
Note that this application programming interface is EXPERIMENTAL
690690
and hence SUBJECT TO CHANGE WITHOUT NOTICE while it stabilizes.
691691

692+
config SPI_LOOPBACK_TEST
693+
tristate "spi loopback test framework support"
694+
depends on m
695+
help
696+
This enables the SPI loopback testing framework driver
697+
698+
primarily used for development of spi_master drivers
699+
and to detect regressions
700+
692701
config SPI_TLE62X0
693702
tristate "Infineon TLE62X0 (for power switching)"
694703
depends on SYSFS

‎drivers/spi/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ ccflags-$(CONFIG_SPI_DEBUG) := -DDEBUG
88
# config declarations into driver model code
99
obj-$(CONFIG_SPI_MASTER) += spi.o
1010
obj-$(CONFIG_SPI_SPIDEV) += spidev.o
11+
obj-$(CONFIG_SPI_LOOPBACK_TEST) += spi-loopback-test.o
1112

1213
# SPI master controller drivers (bus)
1314
obj-$(CONFIG_SPI_ALTERA) += spi-altera.o

‎drivers/spi/spi-bcm63xx.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ static void bcm63xx_spi_setup_transfer(struct spi_device *spi,
207207
u8 clk_cfg, reg;
208208
int i;
209209

210+
/* Default to lowest clock configuration */
211+
clk_cfg = SPI_CLK_0_391MHZ;
212+
210213
/* Find the closest clock configuration */
211214
for (i = 0; i < SPI_CLK_MASK; i++) {
212215
if (t->speed_hz >= bcm63xx_spi_freq_table[i][0]) {
@@ -215,10 +218,6 @@ static void bcm63xx_spi_setup_transfer(struct spi_device *spi,
215218
}
216219
}
217220

218-
/* No matching configuration found, default to lowest */
219-
if (i == SPI_CLK_MASK)
220-
clk_cfg = SPI_CLK_0_391MHZ;
221-
222221
/* clear existing clock configuration bits of the register */
223222
reg = bcm_spi_readb(bs, SPI_CLK_CFG);
224223
reg &= ~SPI_CLK_MASK;

‎drivers/spi/spi-butterfly.c‎

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
#include <linux/mtd/partitions.h>
2929

30-
3130
/*
3231
* This uses SPI to talk with an "AVR Butterfly", which is a $US20 card
3332
* with a battery powered AVR microcontroller and lots of goodies. You
@@ -37,7 +36,6 @@
3736
* and use this custom parallel port cable.
3837
*/
3938

40-
4139
/* DATA output bits (pins 2..9 == D0..D7) */
4240
#define butterfly_nreset (1 << 1) /* pin 3 */
4341

@@ -52,14 +50,11 @@
5250
/* CONTROL output bits */
5351
#define spi_cs_bit PARPORT_CONTROL_SELECT /* pin 17 */
5452

55-
56-
5753
static inline struct butterfly *spidev_to_pp(struct spi_device *spi)
5854
{
5955
return spi->controller_data;
6056
}
6157

62-
6358
struct butterfly {
6459
/* REVISIT ... for now, this must be first */
6560
struct spi_bitbang bitbang;
@@ -140,7 +135,6 @@ static void butterfly_chipselect(struct spi_device *spi, int value)
140135
parport_frob_control(pp->port, spi_cs_bit, value ? spi_cs_bit : 0);
141136
}
142137

143-
144138
/* we only needed to implement one mode here, and choose SPI_MODE_0 */
145139

146140
#define spidelay(X) do { } while (0)
@@ -149,9 +143,8 @@ static void butterfly_chipselect(struct spi_device *spi, int value)
149143
#include "spi-bitbang-txrx.h"
150144

151145
static u32
152-
butterfly_txrx_word_mode0(struct spi_device *spi,
153-
unsigned nsecs,
154-
u32 word, u8 bits)
146+
butterfly_txrx_word_mode0(struct spi_device *spi, unsigned nsecs, u32 word,
147+
u8 bits)
155148
{
156149
return bitbang_txrx_be_cpha0(spi, nsecs, 0, 0, word, bits);
157150
}
@@ -186,7 +179,6 @@ static struct flash_platform_data flash = {
186179
.nr_parts = ARRAY_SIZE(partitions),
187180
};
188181

189-
190182
/* REVISIT remove this ugly global and its "only one" limitation */
191183
static struct butterfly *butterfly;
192184

@@ -197,6 +189,7 @@ static void butterfly_attach(struct parport *p)
197189
struct butterfly *pp;
198190
struct spi_master *master;
199191
struct device *dev = p->physport->dev;
192+
struct pardev_cb butterfly_cb;
200193

201194
if (butterfly || !dev)
202195
return;
@@ -229,9 +222,9 @@ static void butterfly_attach(struct parport *p)
229222
* parport hookup
230223
*/
231224
pp->port = p;
232-
pd = parport_register_device(p, "spi_butterfly",
233-
NULL, NULL, NULL,
234-
0 /* FLAGS */, pp);
225+
memset(&butterfly_cb, 0, sizeof(butterfly_cb));
226+
butterfly_cb.private = pp;
227+
pd = parport_register_dev_model(p, "spi_butterfly", &butterfly_cb, 0);
235228
if (!pd) {
236229
status = -ENOMEM;
237230
goto clean0;
@@ -262,7 +255,6 @@ static void butterfly_attach(struct parport *p)
262255
parport_write_data(pp->port, pp->lastbyte);
263256
msleep(100);
264257

265-
266258
/*
267259
* Start SPI ... for now, hide that we're two physical busses.
268260
*/
@@ -283,7 +275,7 @@ static void butterfly_attach(struct parport *p)
283275
pp->dataflash = spi_new_device(pp->bitbang.master, &pp->info[0]);
284276
if (pp->dataflash)
285277
pr_debug("%s: dataflash at %s\n", p->name,
286-
dev_name(&pp->dataflash->dev));
278+
dev_name(&pp->dataflash->dev));
287279

288280
pr_info("%s: AVR Butterfly\n", p->name);
289281
butterfly = pp;
@@ -297,7 +289,7 @@ static void butterfly_attach(struct parport *p)
297289
clean1:
298290
parport_unregister_device(pd);
299291
clean0:
300-
(void) spi_master_put(pp->bitbang.master);
292+
spi_master_put(pp->bitbang.master);
301293
done:
302294
pr_debug("%s: butterfly probe, fail %d\n", p->name, status);
303295
}
@@ -325,16 +317,16 @@ static void butterfly_detach(struct parport *p)
325317
parport_release(pp->pd);
326318
parport_unregister_device(pp->pd);
327319

328-
(void) spi_master_put(pp->bitbang.master);
320+
spi_master_put(pp->bitbang.master);
329321
}
330322

331323
static struct parport_driver butterfly_driver = {
332324
.name = "spi_butterfly",
333-
.attach = butterfly_attach,
325+
.match_port = butterfly_attach,
334326
.detach = butterfly_detach,
327+
.devmodel = true,
335328
};
336329

337-
338330
static int __init butterfly_init(void)
339331
{
340332
return parport_register_driver(&butterfly_driver);

0 commit comments

Comments
 (0)