Skip to content

Commit 750b2d7

Browse files
committed
Merge tag 'spi-v3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi updates from Mark Brown: "A fairly quiet release for the SPI subsystem, the standout changes being: - Core support for implementing bits per word constraints implemented by Stephen Warren, factoring some code out of drivers. - Addition of polling mode support for the s3c64xx driver as some newer Exynos systems have taken the unusual step of removing interrupt support. - Use of the in-IP FIFO and generic dmaengine support for the OMAP2 driver, providing improved performance. - Conversion of the mpc512x driver to use the core message queue infrastructure. The nicest thing being that all the factoring out into common code leads to a negative diffstat overall." * tag 'spi-v3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (42 commits) spi/s3c64xx: Rely on the compiler eliminating the OF ID table spi: s3c64xx: Added support for exynos5440 spi spi: s3c64xx: Added provision for dedicated cs pin spi: omap2-mcspi: add generic DMA request support to the DT binding spi: omap2-mcspi: convert to dma_request_slave_channel_compat() spi/s3c64xx: Make wait_for_timeout() function name less generic spi: s3c64xx: added support for polling mode spi: omap2-mcspi: Add FIFO buffer support spi: omap2-mcspi: Move bytes per word calculation to the function spi: spi-xilinx: cleanup a check in xilinx_spi_txrx_bufs() spi: spi-nuc900: Remove redundant platform_set_drvdata() spi: spi-fsl-lib: Make mpc8xxx_spi_work static spi: spi-topcliff-pch: Fix sparse warnings spi: spi-xilinx: Remove redundant platform_set_drvdata() spi: spi-xilinx: Add run run-time endian detection spi: mpc512x: use the SPI subsystem's message queue spi: mpc512x: improve throughput in the RX/TX func spi: mpc512x: minor prep before feature change spi: atmel: convert to dma_request_slave_channel_compat() spi: sirf: avoid uninitialized-use warning ...
2 parents 3dbde57 + ed89355 commit 750b2d7

50 files changed

Lines changed: 708 additions & 748 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@ Required properties:
1010
input. The default is D0 as input and
1111
D1 as output.
1212

13-
Example:
13+
Optional properties:
14+
- dmas: List of DMA specifiers with the controller specific format
15+
as described in the generic DMA client binding. A tx and rx
16+
specifier is required for each chip select.
17+
- dma-names: List of DMA request names. These strings correspond
18+
1:1 with the DMA specifiers listed in dmas. The string naming
19+
is to be "rxN" and "txN" for RX and TX requests,
20+
respectively, where N equals the chip select number.
21+
22+
Examples:
23+
24+
[hwmod populated DMA resources]
1425

1526
mcspi1: mcspi@1 {
1627
#address-cells = <1>;
@@ -20,3 +31,17 @@ mcspi1: mcspi@1 {
2031
ti,spi-num-cs = <4>;
2132
};
2233

34+
[generic DMA request binding]
35+
36+
mcspi1: mcspi@1 {
37+
#address-cells = <1>;
38+
#size-cells = <0>;
39+
compatible = "ti,omap4-mcspi";
40+
ti,hwmods = "mcspi1";
41+
ti,spi-num-cs = <2>;
42+
dmas = <&edma 42
43+
&edma 43
44+
&edma 44
45+
&edma 45>;
46+
dma-names = "tx0", "rx0", "tx1", "rx1";
47+
};

‎drivers/mfd/timberdale.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ static struct spi_board_info timberdale_spi_8bit_board_info[] = {
145145

146146
static struct xspi_platform_data timberdale_xspi_platform_data = {
147147
.num_chipselect = 3,
148-
.little_endian = true,
149148
/* bits per word and devices will be filled in runtime depending
150149
* on the HW config
151150
*/

‎drivers/spi/spi-altera.c‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,6 @@ static void altera_spi_chipsel(struct spi_device *spi, int value)
103103
}
104104
}
105105

106-
static int altera_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
107-
{
108-
return 0;
109-
}
110-
111-
static int altera_spi_setup(struct spi_device *spi)
112-
{
113-
return 0;
114-
}
115-
116106
static inline unsigned int hw_txbyte(struct altera_spi *hw, int count)
117107
{
118108
if (hw->tx) {
@@ -231,7 +221,6 @@ static int altera_spi_probe(struct platform_device *pdev)
231221
master->bus_num = pdev->id;
232222
master->num_chipselect = 16;
233223
master->mode_bits = SPI_CS_HIGH;
234-
master->setup = altera_spi_setup;
235224

236225
hw = spi_master_get_devdata(master);
237226
platform_set_drvdata(pdev, hw);
@@ -240,7 +229,6 @@ static int altera_spi_probe(struct platform_device *pdev)
240229
hw->bitbang.master = spi_master_get(master);
241230
if (!hw->bitbang.master)
242231
return err;
243-
hw->bitbang.setup_transfer = altera_spi_setupxfer;
244232
hw->bitbang.chipselect = altera_spi_chipsel;
245233
hw->bitbang.txrx_bufs = altera_spi_txrx;
246234

@@ -285,7 +273,6 @@ static int altera_spi_probe(struct platform_device *pdev)
285273
exit_busy:
286274
err = -EBUSY;
287275
exit:
288-
platform_set_drvdata(pdev, NULL);
289276
spi_master_put(master);
290277
return err;
291278
}
@@ -296,7 +283,6 @@ static int altera_spi_remove(struct platform_device *dev)
296283
struct spi_master *master = hw->bitbang.master;
297284

298285
spi_bitbang_stop(&hw->bitbang);
299-
platform_set_drvdata(dev, NULL);
300286
spi_master_put(master);
301287
return 0;
302288
}

‎drivers/spi/spi-ath79.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,6 @@ static int ath79_spi_setup(struct spi_device *spi)
155155
{
156156
int status = 0;
157157

158-
if (spi->bits_per_word > 32)
159-
return -EINVAL;
160-
161158
if (!spi->controller_state) {
162159
status = ath79_spi_setup_cs(spi);
163160
if (status)
@@ -226,6 +223,7 @@ static int ath79_spi_probe(struct platform_device *pdev)
226223

227224
pdata = pdev->dev.platform_data;
228225

226+
master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32);
229227
master->setup = ath79_spi_setup;
230228
master->cleanup = ath79_spi_cleanup;
231229
if (pdata) {
@@ -287,7 +285,6 @@ static int ath79_spi_probe(struct platform_device *pdev)
287285
err_unmap:
288286
iounmap(sp->base);
289287
err_put_master:
290-
platform_set_drvdata(pdev, NULL);
291288
spi_master_put(sp->bitbang.master);
292289

293290
return ret;
@@ -302,7 +299,6 @@ static int ath79_spi_remove(struct platform_device *pdev)
302299
clk_disable(sp->clk);
303300
clk_put(sp->clk);
304301
iounmap(sp->base);
305-
platform_set_drvdata(pdev, NULL);
306302
spi_master_put(sp->bitbang.master);
307303

308304
return 0;

‎drivers/spi/spi-atmel.c‎

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,15 @@ static int atmel_spi_dma_slave_config(struct atmel_spi *as,
424424
return err;
425425
}
426426

427-
static bool filter(struct dma_chan *chan, void *slave)
427+
static bool filter(struct dma_chan *chan, void *pdata)
428428
{
429-
struct at_dma_slave *sl = slave;
429+
struct atmel_spi_dma *sl_pdata = pdata;
430+
struct at_dma_slave *sl;
430431

432+
if (!sl_pdata)
433+
return false;
434+
435+
sl = &sl_pdata->dma_slave;
431436
if (sl->dma_dev == chan->device->dev) {
432437
chan->private = sl;
433438
return true;
@@ -438,24 +443,31 @@ static bool filter(struct dma_chan *chan, void *slave)
438443

439444
static int atmel_spi_configure_dma(struct atmel_spi *as)
440445
{
441-
struct at_dma_slave *sdata = &as->dma.dma_slave;
442446
struct dma_slave_config slave_config;
447+
struct device *dev = &as->pdev->dev;
443448
int err;
444449

445-
if (sdata && sdata->dma_dev) {
446-
dma_cap_mask_t mask;
450+
dma_cap_mask_t mask;
451+
dma_cap_zero(mask);
452+
dma_cap_set(DMA_SLAVE, mask);
447453

448-
/* Try to grab two DMA channels */
449-
dma_cap_zero(mask);
450-
dma_cap_set(DMA_SLAVE, mask);
451-
as->dma.chan_tx = dma_request_channel(mask, filter, sdata);
452-
if (as->dma.chan_tx)
453-
as->dma.chan_rx =
454-
dma_request_channel(mask, filter, sdata);
454+
as->dma.chan_tx = dma_request_slave_channel_compat(mask, filter,
455+
&as->dma,
456+
dev, "tx");
457+
if (!as->dma.chan_tx) {
458+
dev_err(dev,
459+
"DMA TX channel not available, SPI unable to use DMA\n");
460+
err = -EBUSY;
461+
goto error;
455462
}
456-
if (!as->dma.chan_rx || !as->dma.chan_tx) {
457-
dev_err(&as->pdev->dev,
458-
"DMA channel not available, SPI unable to use DMA\n");
463+
464+
as->dma.chan_rx = dma_request_slave_channel_compat(mask, filter,
465+
&as->dma,
466+
dev, "rx");
467+
468+
if (!as->dma.chan_rx) {
469+
dev_err(dev,
470+
"DMA RX channel not available, SPI unable to use DMA\n");
459471
err = -EBUSY;
460472
goto error;
461473
}
@@ -1268,13 +1280,6 @@ static int atmel_spi_setup(struct spi_device *spi)
12681280
return -EINVAL;
12691281
}
12701282

1271-
if (bits < 8 || bits > 16) {
1272-
dev_dbg(&spi->dev,
1273-
"setup: invalid bits_per_word %u (8 to 16)\n",
1274-
bits);
1275-
return -EINVAL;
1276-
}
1277-
12781283
/* see notes above re chipselect */
12791284
if (!atmel_spi_is_v2(as)
12801285
&& spi->chip_select == 0
@@ -1515,7 +1520,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
15151520

15161521
/* the spi->mode bits understood by this driver: */
15171522
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
1518-
1523+
master->bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 16);
15191524
master->dev.of_node = pdev->dev.of_node;
15201525
master->bus_num = pdev->id;
15211526
master->num_chipselect = master->dev.of_node ? 0 : 4;

‎drivers/spi/spi-au1550.c‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,6 @@ static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
248248
hz = t->speed_hz;
249249
}
250250

251-
if (bpw < 4 || bpw > 24) {
252-
dev_err(&spi->dev, "setupxfer: invalid bits_per_word=%d\n",
253-
bpw);
254-
return -EINVAL;
255-
}
256251
if (hz > spi->max_speed_hz || hz > hw->freq_max || hz < hw->freq_min) {
257252
dev_err(&spi->dev, "setupxfer: clock rate=%d out of range\n",
258253
hz);
@@ -296,12 +291,6 @@ static int au1550_spi_setup(struct spi_device *spi)
296291
{
297292
struct au1550_spi *hw = spi_master_get_devdata(spi->master);
298293

299-
if (spi->bits_per_word < 4 || spi->bits_per_word > 24) {
300-
dev_err(&spi->dev, "setup: invalid bits_per_word=%d\n",
301-
spi->bits_per_word);
302-
return -EINVAL;
303-
}
304-
305294
if (spi->max_speed_hz == 0)
306295
spi->max_speed_hz = hw->freq_max;
307296
if (spi->max_speed_hz > hw->freq_max
@@ -782,6 +771,7 @@ static int au1550_spi_probe(struct platform_device *pdev)
782771

783772
/* the spi->mode bits understood by this driver: */
784773
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST;
774+
master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 24);
785775

786776
hw = spi_master_get_devdata(master);
787777

@@ -987,8 +977,6 @@ static int au1550_spi_remove(struct platform_device *pdev)
987977
au1xxx_dbdma_chan_free(hw->dma_tx_ch);
988978
}
989979

990-
platform_set_drvdata(pdev, NULL);
991-
992980
spi_master_put(hw->master);
993981
return 0;
994982
}

‎drivers/spi/spi-bcm2835.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,9 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
331331
goto out_master_put;
332332
}
333333

334-
bs->regs = devm_request_and_ioremap(&pdev->dev, res);
335-
if (!bs->regs) {
336-
dev_err(&pdev->dev, "could not request/map memory region\n");
337-
err = -ENODEV;
334+
bs->regs = devm_ioremap_resource(&pdev->dev, res);
335+
if (IS_ERR(bs->regs)) {
336+
err = PTR_ERR(bs->regs);
338337
goto out_master_put;
339338
}
340339

‎drivers/spi/spi-bcm63xx.c‎

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,6 @@ static void bcm63xx_spi_setup_transfer(struct spi_device *spi,
124124
/* the spi->mode bits understood by this driver: */
125125
#define MODEBITS (SPI_CPOL | SPI_CPHA)
126126

127-
static int bcm63xx_spi_setup(struct spi_device *spi)
128-
{
129-
if (spi->bits_per_word != 8) {
130-
dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
131-
__func__, spi->bits_per_word);
132-
return -EINVAL;
133-
}
134-
135-
return 0;
136-
}
137-
138127
static int bcm63xx_txrx_bufs(struct spi_device *spi, struct spi_transfer *first,
139128
unsigned int num_transfers)
140129
{
@@ -277,13 +266,6 @@ static int bcm63xx_spi_transfer_one(struct spi_master *master,
277266
* full-duplex transfers.
278267
*/
279268
list_for_each_entry(t, &m->transfers, transfer_list) {
280-
if (t->bits_per_word != 8) {
281-
dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
282-
__func__, t->bits_per_word);
283-
status = -EINVAL;
284-
goto exit;
285-
}
286-
287269
if (!first)
288270
first = t;
289271

@@ -430,11 +412,11 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
430412

431413
master->bus_num = pdata->bus_num;
432414
master->num_chipselect = pdata->num_chipselect;
433-
master->setup = bcm63xx_spi_setup;
434415
master->prepare_transfer_hardware = bcm63xx_spi_prepare_transfer;
435416
master->unprepare_transfer_hardware = bcm63xx_spi_unprepare_transfer;
436417
master->transfer_one_message = bcm63xx_spi_transfer_one;
437418
master->mode_bits = MODEBITS;
419+
master->bits_per_word_mask = SPI_BPW_MASK(8);
438420
bs->msg_type_shift = pdata->msg_type_shift;
439421
bs->msg_ctl_width = pdata->msg_ctl_width;
440422
bs->tx_io = (u8 *)(bs->regs + bcm63xx_spireg(SPI_MSG_DATA));
@@ -469,7 +451,6 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
469451
out_clk_disable:
470452
clk_disable_unprepare(clk);
471453
out_err:
472-
platform_set_drvdata(pdev, NULL);
473454
spi_master_put(master);
474455
out_clk:
475456
clk_put(clk);
@@ -491,8 +472,6 @@ static int bcm63xx_spi_remove(struct platform_device *pdev)
491472
clk_disable_unprepare(bs->clk);
492473
clk_put(bs->clk);
493474

494-
platform_set_drvdata(pdev, 0);
495-
496475
spi_master_put(master);
497476

498477
return 0;

‎drivers/spi/spi-bfin-sport.c‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ bfin_sport_spi_pump_transfers(unsigned long data)
417417

418418
/* Bits per word setup */
419419
bits_per_word = transfer->bits_per_word;
420-
if (bits_per_word % 16 == 0)
420+
if (bits_per_word == 16)
421421
drv_data->ops = &bfin_sport_transfer_ops_u16;
422422
else
423423
drv_data->ops = &bfin_sport_transfer_ops_u8;
@@ -600,13 +600,6 @@ bfin_sport_spi_setup(struct spi_device *spi)
600600
}
601601
}
602602

603-
if (spi->bits_per_word % 8) {
604-
dev_err(&spi->dev, "%d bits_per_word is not supported\n",
605-
spi->bits_per_word);
606-
ret = -EINVAL;
607-
goto error;
608-
}
609-
610603
/* translate common spi framework into our register
611604
* following configure contents are same for tx and rx.
612605
*/
@@ -778,6 +771,7 @@ static int bfin_sport_spi_probe(struct platform_device *pdev)
778771
drv_data->pin_req = platform_info->pin_req;
779772

780773
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST;
774+
master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16);
781775
master->bus_num = pdev->id;
782776
master->num_chipselect = platform_info->num_chipselect;
783777
master->cleanup = bfin_sport_spi_cleanup;
@@ -882,9 +876,6 @@ static int bfin_sport_spi_remove(struct platform_device *pdev)
882876

883877
peripheral_free_list(drv_data->pin_req);
884878

885-
/* Prevent double remove */
886-
platform_set_drvdata(pdev, NULL);
887-
888879
return 0;
889880
}
890881

0 commit comments

Comments
 (0)