Skip to content

Commit b36eb6e

Browse files
committed
Merge tag 'spi-fix-v7.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "A couple of device ID and quirk updates, plus a bunch of small fixes most of which (other than the Cadence one) are unremarkable error handling fixes" * tag 'spi-fix-v7.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: atcspi200: Handle invalid buswidth and fix compiler warning spi: dt-bindings: sun6i: Allow Dual SPI and Quad SPI for newer SoCs spi: intel-pci: Add support for Nova Lake mobile SPI flash spi: cadence-qspi: Fix requesting of APB and AHB clocks on JH7110 spi: rockchip-sfc: Fix double-free in remove() callback spi: atcspi200: Fix double-free in atcspi_configure_dma() spi: amlogic: spifc-a4: Fix DMA mapping error handling
2 parents ff30ea1 + f879365 commit b36eb6e

6 files changed

Lines changed: 50 additions & 31 deletions

File tree

Documentation/devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
66

77
title: Allwinner A31 SPI Controller
88

9-
allOf:
10-
- $ref: spi-controller.yaml
11-
129
maintainers:
1310
- Chen-Yu Tsai <wens@csie.org>
1411
- Maxime Ripard <mripard@kernel.org>
@@ -82,11 +79,11 @@ patternProperties:
8279

8380
spi-rx-bus-width:
8481
items:
85-
- const: 1
82+
enum: [0, 1, 2, 4]
8683

8784
spi-tx-bus-width:
8885
items:
89-
- const: 1
86+
enum: [0, 1, 2, 4]
9087

9188
required:
9289
- compatible
@@ -95,6 +92,28 @@ required:
9592
- clocks
9693
- clock-names
9794

95+
allOf:
96+
- $ref: spi-controller.yaml
97+
- if:
98+
not:
99+
properties:
100+
compatible:
101+
contains:
102+
enum:
103+
- allwinner,sun50i-r329-spi
104+
- allwinner,sun55i-a523-spi
105+
then:
106+
patternProperties:
107+
"^.*@[0-9a-f]+":
108+
properties:
109+
spi-rx-bus-width:
110+
items:
111+
enum: [0, 1]
112+
113+
spi-tx-bus-width:
114+
items:
115+
enum: [0, 1]
116+
98117
unevaluatedProperties: false
99118

100119
examples:

drivers/spi/spi-amlogic-spifc-a4.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ static int aml_sfc_dma_buffer_setup(struct aml_sfc *sfc, void *databuf,
411411
ret = dma_mapping_error(sfc->dev, sfc->daddr);
412412
if (ret) {
413413
dev_err(sfc->dev, "DMA mapping error\n");
414-
goto out_map_data;
414+
return ret;
415415
}
416416

417417
cmd = CMD_DATA_ADDRL(sfc->daddr);
@@ -429,7 +429,6 @@ static int aml_sfc_dma_buffer_setup(struct aml_sfc *sfc, void *databuf,
429429
ret = dma_mapping_error(sfc->dev, sfc->iaddr);
430430
if (ret) {
431431
dev_err(sfc->dev, "DMA mapping error\n");
432-
dma_unmap_single(sfc->dev, sfc->daddr, datalen, dir);
433432
goto out_map_data;
434433
}
435434

@@ -448,7 +447,7 @@ static int aml_sfc_dma_buffer_setup(struct aml_sfc *sfc, void *databuf,
448447
return 0;
449448

450449
out_map_info:
451-
dma_unmap_single(sfc->dev, sfc->iaddr, datalen, dir);
450+
dma_unmap_single(sfc->dev, sfc->iaddr, infolen, dir);
452451
out_map_data:
453452
dma_unmap_single(sfc->dev, sfc->daddr, datalen, dir);
454453

drivers/spi/spi-atcspi200.c

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,15 @@ static void atcspi_set_trans_ctl(struct atcspi_dev *spi,
195195
if (op->addr.buswidth > 1)
196196
tc |= TRANS_ADDR_FMT;
197197
if (op->data.nbytes) {
198-
tc |= TRANS_DUAL_QUAD(ffs(op->data.buswidth) - 1);
198+
unsigned int width_code;
199+
200+
width_code = ffs(op->data.buswidth) - 1;
201+
if (unlikely(width_code > 3)) {
202+
WARN_ON_ONCE(1);
203+
width_code = 0;
204+
}
205+
tc |= TRANS_DUAL_QUAD(width_code);
206+
199207
if (op->data.dir == SPI_MEM_DATA_IN) {
200208
if (op->dummy.nbytes)
201209
tc |= TRANS_MODE_DMY_READ |
@@ -497,31 +505,17 @@ static int atcspi_init_resources(struct platform_device *pdev,
497505

498506
static int atcspi_configure_dma(struct atcspi_dev *spi)
499507
{
500-
struct dma_chan *dma_chan;
501-
int ret = 0;
508+
spi->host->dma_rx = devm_dma_request_chan(spi->dev, "rx");
509+
if (IS_ERR(spi->host->dma_rx))
510+
return PTR_ERR(spi->host->dma_rx);
502511

503-
dma_chan = devm_dma_request_chan(spi->dev, "rx");
504-
if (IS_ERR(dma_chan)) {
505-
ret = PTR_ERR(dma_chan);
506-
goto err_exit;
507-
}
508-
spi->host->dma_rx = dma_chan;
512+
spi->host->dma_tx = devm_dma_request_chan(spi->dev, "tx");
513+
if (IS_ERR(spi->host->dma_tx))
514+
return PTR_ERR(spi->host->dma_tx);
509515

510-
dma_chan = devm_dma_request_chan(spi->dev, "tx");
511-
if (IS_ERR(dma_chan)) {
512-
ret = PTR_ERR(dma_chan);
513-
goto free_rx;
514-
}
515-
spi->host->dma_tx = dma_chan;
516516
init_completion(&spi->dma_completion);
517517

518-
return ret;
519-
520-
free_rx:
521-
dma_release_channel(spi->host->dma_rx);
522-
spi->host->dma_rx = NULL;
523-
err_exit:
524-
return ret;
518+
return 0;
525519
}
526520

527521
static int atcspi_enable_clk(struct atcspi_dev *spi)

drivers/spi/spi-cadence-quadspi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ struct cqspi_flash_pdata {
7676
u8 cs;
7777
};
7878

79+
static const struct clk_bulk_data cqspi_clks[CLK_QSPI_NUM] = {
80+
[CLK_QSPI_APB] = { .id = "apb" },
81+
[CLK_QSPI_AHB] = { .id = "ahb" },
82+
};
83+
7984
struct cqspi_st {
8085
struct platform_device *pdev;
8186
struct spi_controller *host;
@@ -1823,6 +1828,7 @@ static int cqspi_probe(struct platform_device *pdev)
18231828
}
18241829

18251830
/* Obtain QSPI clocks. */
1831+
memcpy(&cqspi->clks, &cqspi_clks, sizeof(cqspi->clks));
18261832
ret = devm_clk_bulk_get_optional(dev, CLK_QSPI_NUM, cqspi->clks);
18271833
if (ret)
18281834
return dev_err_probe(dev, ret, "Failed to get clocks\n");

drivers/spi/spi-intel-pci.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ static const struct pci_device_id intel_spi_pci_ids[] = {
9696
{ PCI_VDEVICE(INTEL, 0xa324), (unsigned long)&cnl_info },
9797
{ PCI_VDEVICE(INTEL, 0xa3a4), (unsigned long)&cnl_info },
9898
{ PCI_VDEVICE(INTEL, 0xa823), (unsigned long)&cnl_info },
99+
{ PCI_VDEVICE(INTEL, 0xd323), (unsigned long)&cnl_info },
99100
{ PCI_VDEVICE(INTEL, 0xe323), (unsigned long)&cnl_info },
100101
{ PCI_VDEVICE(INTEL, 0xe423), (unsigned long)&cnl_info },
101102
{ },

drivers/spi/spi-rockchip-sfc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ static int rockchip_sfc_probe(struct platform_device *pdev)
711711
}
712712
}
713713

714-
ret = devm_spi_register_controller(dev, host);
714+
ret = spi_register_controller(host);
715715
if (ret)
716716
goto err_register;
717717

0 commit comments

Comments
 (0)