Skip to content

Commit 9c9330c

Browse files
committed
Merge tag 'spi-fix-v7.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "A small set of fixes that came in since -rc1, we have one core fix for shutting down target mode properly if the system suspends while it's running plus a small set of fairly unremarkable device specific fixes. There's also a couple of pure DT binding changes for Renesas SoCs, the power domains one allows some SoCs to be correctly described with existing code" * tag 'spi-fix-v7.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: rzv2h-rspi: Fix DMA transfer error handling for signal interruption spi: dt-bindings: snps,dw-apb-ssi: add 'power-domains' property spi: dt-bindings: snps,dw-apb-ssi: drop superfluous RZ/N1 entry spi: dw: use the correct error msg if request_irq() fails spi: dw: fix first spi transfer with dma always fallback to PIO spi: core: Abort active target transfer on controller suspend spi: sh-msiof: abort transfers when reset times out
2 parents 7404ce5 + 7fc2c3d commit 9c9330c

6 files changed

Lines changed: 17 additions & 9 deletions

File tree

Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ properties:
5050
- enum:
5151
- mscc,ocelot-spi
5252
- mscc,jaguar2-spi
53-
- renesas,rzn1-spi
5453
- sophgo,sg2042-spi
5554
- thead,th1520-spi
5655
- const: snps,dw-apb-ssi
@@ -94,6 +93,9 @@ properties:
9493
- const: ssi_clk
9594
- const: pclk
9695

96+
power-domains:
97+
maxItems: 1
98+
9799
resets:
98100
maxItems: 1
99101

drivers/spi/spi-dw-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ int dw_spi_add_controller(struct device *dev, struct dw_spi *dws)
949949
ret = request_irq(dws->irq, dw_spi_irq, IRQF_SHARED, dev_name(dev),
950950
ctlr);
951951
if (ret < 0 && ret != -ENOTCONN) {
952-
dev_err(dev, "can not get IRQ\n");
952+
dev_err(dev, "can not request IRQ\n");
953953
goto err_free_ctlr;
954954
}
955955

drivers/spi/spi-dw-dma.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,12 @@ static bool dw_spi_can_dma(struct spi_controller *ctlr,
247247
{
248248
struct dw_spi *dws = spi_controller_get_devdata(ctlr);
249249
enum dma_slave_buswidth dma_bus_width;
250+
u8 n_bytes = roundup_pow_of_two(BITS_TO_BYTES(xfer->bits_per_word));
250251

251252
if (xfer->len <= dws->fifo_len)
252253
return false;
253254

254-
dma_bus_width = dw_spi_dma_convert_width(dws->n_bytes);
255+
dma_bus_width = dw_spi_dma_convert_width(n_bytes);
255256

256257
return dws->dma_addr_widths & BIT(dma_bus_width);
257258
}

drivers/spi/spi-rzv2h-rspi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,14 +366,14 @@ static int rzv2h_rspi_transfer_dma(struct rzv2h_rspi_priv *rspi,
366366
rzv2h_rspi_clear_all_irqs(rspi);
367367

368368
ret = wait_event_interruptible_timeout(rspi->wait, rspi->dma_callbacked, HZ);
369-
if (ret) {
369+
if (ret > 0) {
370370
dmaengine_synchronize(rspi->controller->dma_tx);
371371
dmaengine_synchronize(rspi->controller->dma_rx);
372372
ret = 0;
373373
} else {
374374
dmaengine_terminate_sync(rspi->controller->dma_tx);
375375
dmaengine_terminate_sync(rspi->controller->dma_rx);
376-
ret = -ETIMEDOUT;
376+
ret = ret ?: -ETIMEDOUT;
377377
}
378378

379379
enable_irq(rspi->irq_rx);

drivers/spi/spi-sh-msiof.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ static irqreturn_t sh_msiof_spi_irq(int irq, void *data)
114114
return IRQ_HANDLED;
115115
}
116116

117-
static void sh_msiof_spi_reset_regs(struct sh_msiof_spi_priv *p)
117+
static int sh_msiof_spi_reset_regs(struct sh_msiof_spi_priv *p)
118118
{
119119
u32 mask = SICTR_TXRST | SICTR_RXRST;
120120
u32 data;
@@ -123,8 +123,8 @@ static void sh_msiof_spi_reset_regs(struct sh_msiof_spi_priv *p)
123123
data |= mask;
124124
sh_msiof_write(p, SICTR, data);
125125

126-
readl_poll_timeout_atomic(p->mapbase + SICTR, data, !(data & mask), 1,
127-
100);
126+
return readl_poll_timeout_atomic(p->mapbase + SICTR, data,
127+
!(data & mask), 1, 100);
128128
}
129129

130130
static void sh_msiof_spi_set_clk_regs(struct sh_msiof_spi_priv *p,
@@ -834,7 +834,9 @@ static int sh_msiof_transfer_one(struct spi_controller *ctlr,
834834
int ret;
835835

836836
/* reset registers */
837-
sh_msiof_spi_reset_regs(p);
837+
ret = sh_msiof_spi_reset_regs(p);
838+
if (ret)
839+
return ret;
838840

839841
/* setup clocks (clock already enabled in chipselect()) */
840842
if (!spi_controller_is_target(p->ctlr))

drivers/spi/spi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3670,6 +3670,9 @@ int spi_controller_suspend(struct spi_controller *ctlr)
36703670
{
36713671
int ret = 0;
36723672

3673+
if (ctlr->cur_msg && spi_controller_is_target(ctlr) && ctlr->target_abort)
3674+
ctlr->target_abort(ctlr);
3675+
36733676
/* Basically no-ops for non-queued controllers */
36743677
if (ctlr->queued) {
36753678
ret = spi_stop_queue(ctlr);

0 commit comments

Comments
 (0)