Commit 4b23c6ec authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'spi-fix-v5.17-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
 "A few small driver specific fixes"

* tag 'spi-fix-v5.17-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: rockchip: terminate dma transmission when slave abort
  spi: rockchip: Fix error in getting num-cs property
  spi: spi-zynq-qspi: Fix a NULL pointer dereference in zynq_qspi_exec_mem_op()
parents 64b5132b 80808768
...@@ -585,6 +585,12 @@ static int rockchip_spi_slave_abort(struct spi_controller *ctlr) ...@@ -585,6 +585,12 @@ static int rockchip_spi_slave_abort(struct spi_controller *ctlr)
{ {
struct rockchip_spi *rs = spi_controller_get_devdata(ctlr); struct rockchip_spi *rs = spi_controller_get_devdata(ctlr);
if (atomic_read(&rs->state) & RXDMA)
dmaengine_terminate_sync(ctlr->dma_rx);
if (atomic_read(&rs->state) & TXDMA)
dmaengine_terminate_sync(ctlr->dma_tx);
atomic_set(&rs->state, 0);
spi_enable_chip(rs, false);
rs->slave_abort = true; rs->slave_abort = true;
spi_finalize_current_transfer(ctlr); spi_finalize_current_transfer(ctlr);
...@@ -654,7 +660,7 @@ static int rockchip_spi_probe(struct platform_device *pdev) ...@@ -654,7 +660,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
struct spi_controller *ctlr; struct spi_controller *ctlr;
struct resource *mem; struct resource *mem;
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
u32 rsd_nsecs; u32 rsd_nsecs, num_cs;
bool slave_mode; bool slave_mode;
slave_mode = of_property_read_bool(np, "spi-slave"); slave_mode = of_property_read_bool(np, "spi-slave");
...@@ -764,8 +770,9 @@ static int rockchip_spi_probe(struct platform_device *pdev) ...@@ -764,8 +770,9 @@ static int rockchip_spi_probe(struct platform_device *pdev)
* rk spi0 has two native cs, spi1..5 one cs only * rk spi0 has two native cs, spi1..5 one cs only
* if num-cs is missing in the dts, default to 1 * if num-cs is missing in the dts, default to 1
*/ */
if (of_property_read_u16(np, "num-cs", &ctlr->num_chipselect)) if (of_property_read_u32(np, "num-cs", &num_cs))
ctlr->num_chipselect = 1; num_cs = 1;
ctlr->num_chipselect = num_cs;
ctlr->use_gpio_descriptors = true; ctlr->use_gpio_descriptors = true;
} }
ctlr->dev.of_node = pdev->dev.of_node; ctlr->dev.of_node = pdev->dev.of_node;
......
...@@ -570,6 +570,9 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem, ...@@ -570,6 +570,9 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem,
if (op->dummy.nbytes) { if (op->dummy.nbytes) {
tmpbuf = kzalloc(op->dummy.nbytes, GFP_KERNEL); tmpbuf = kzalloc(op->dummy.nbytes, GFP_KERNEL);
if (!tmpbuf)
return -ENOMEM;
memset(tmpbuf, 0xff, op->dummy.nbytes); memset(tmpbuf, 0xff, op->dummy.nbytes);
reinit_completion(&xqspi->data_completion); reinit_completion(&xqspi->data_completion);
xqspi->txbuf = tmpbuf; xqspi->txbuf = tmpbuf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment