From 104e51af79a0dbb80627d4db5e1421dd2a2f590c Mon Sep 17 00:00:00 2001 From: Jarkko Nikula Date: Fri, 9 Feb 2018 16:31:07 +0200 Subject: spi: pxa2xx: Move SSP idle waiting to cs_deassert() Move SSP idle waiting before CS deassert from error and end of message handling function giveback() to cs_deassert(). This ensures idle waiting is done also if there is CS change between transfers. Signed-off-by: Jarkko Nikula Signed-off-by: Mark Brown --- drivers/spi/spi-pxa2xx.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/spi') diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index b0822d1dba29..31117f9985ea 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -415,10 +415,17 @@ static void cs_deassert(struct driver_data *drv_data) { struct chip_data *chip = spi_get_ctldata(drv_data->master->cur_msg->spi); + unsigned long timeout; if (drv_data->ssp_type == CE4100_SSP) return; + /* Wait until SSP becomes idle before deasserting the CS */ + timeout = jiffies + msecs_to_jiffies(10); + while (pxa2xx_spi_read(drv_data, SSSR) & SSSR_BSY && + !time_after(jiffies, timeout)) + cpu_relax(); + if (chip->cs_control) { chip->cs_control(PXA2XX_CS_DEASSERT); return; @@ -563,7 +570,6 @@ static void giveback(struct driver_data *drv_data) { struct spi_transfer* last_transfer; struct spi_message *msg; - unsigned long timeout; msg = drv_data->master->cur_msg; drv_data->cur_transfer = NULL; @@ -575,12 +581,6 @@ static void giveback(struct driver_data *drv_data) if (last_transfer->delay_usecs) udelay(last_transfer->delay_usecs); - /* Wait until SSP becomes idle before deasserting the CS */ - timeout = jiffies + msecs_to_jiffies(10); - while (pxa2xx_spi_read(drv_data, SSSR) & SSSR_BSY && - !time_after(jiffies, timeout)) - cpu_relax(); - /* Drop chip select UNLESS cs_change is true or we are returning * a message with an error, or next message is for another chip */ -- cgit v1.2.3 From e3d001a0c29d6c9a87dd9e86bcb84fc66c2ddbe8 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Thu, 8 Feb 2018 23:00:16 +0100 Subject: spi: kconfig: Remove AVR32 dep. from SPI_ATMEL The AVR32 symbol was removed in commit 26202873bb51 ("avr32: remove support for AVR32 architecture"). Signed-off-by: Ulf Magnusson Signed-off-by: Mark Brown --- drivers/spi/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/spi') diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 603783976b81..6fb0347a24f2 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -72,10 +72,10 @@ config SPI_ARMADA_3700 config SPI_ATMEL tristate "Atmel SPI Controller" depends on HAS_DMA - depends on (ARCH_AT91 || AVR32 || COMPILE_TEST) + depends on (ARCH_AT91 || COMPILE_TEST) help This selects a driver for the Atmel SPI Controller, present on - many AT32 (AVR32) and AT91 (ARM) chips. + many AT91 (ARM) chips. config SPI_AU1550 tristate "Au1550/Au1200/Au1300 SPI Controller" -- cgit v1.2.3 From 3cc7b0e35745ae4e153f174038df34a79a385b32 Mon Sep 17 00:00:00 2001 From: Jarkko Nikula Date: Thu, 1 Feb 2018 17:17:30 +0200 Subject: spi: pxa2xx: Convert to generalized SPI controller API Convert to generalized SPI controller API introduced by the commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller""). Inside driver variable name "master" is still used to indicate the driver is master only. While at it, change "unsigned cs" to "unsigned int cs" in pxa2xx_spi_fw_translate_cs() to suppress checkpatch warning. Signed-off-by: Jarkko Nikula Signed-off-by: Mark Brown --- drivers/spi/spi-pxa2xx-dma.c | 4 ++-- drivers/spi/spi-pxa2xx.c | 40 ++++++++++++++++++++++------------------ drivers/spi/spi-pxa2xx.h | 2 +- 3 files changed, 25 insertions(+), 21 deletions(-) (limited to 'drivers/spi') diff --git a/drivers/spi/spi-pxa2xx-dma.c b/drivers/spi/spi-pxa2xx-dma.c index 04f3eecf5cf3..3d7f66080c57 100644 --- a/drivers/spi/spi-pxa2xx-dma.c +++ b/drivers/spi/spi-pxa2xx-dma.c @@ -191,7 +191,7 @@ int pxa2xx_spi_dma_setup(struct driver_data *drv_data) { struct pxa2xx_spi_master *pdata = drv_data->master_info; struct device *dev = &drv_data->pdev->dev; - struct spi_master *master = drv_data->master; + struct spi_controller *master = drv_data->master; dma_cap_mask_t mask; dma_cap_zero(mask); @@ -215,7 +215,7 @@ int pxa2xx_spi_dma_setup(struct driver_data *drv_data) void pxa2xx_spi_dma_release(struct driver_data *drv_data) { - struct spi_master *master = drv_data->master; + struct spi_controller *master = drv_data->master; if (master->dma_rx) { dmaengine_terminate_sync(master->dma_rx); diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 31117f9985ea..713506eff07d 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -962,7 +962,7 @@ static unsigned int pxa2xx_ssp_get_clk_div(struct driver_data *drv_data, return clk_div << 8; } -static bool pxa2xx_spi_can_dma(struct spi_master *master, +static bool pxa2xx_spi_can_dma(struct spi_controller *master, struct spi_device *spi, struct spi_transfer *xfer) { @@ -976,7 +976,7 @@ static bool pxa2xx_spi_can_dma(struct spi_master *master, static void pump_transfers(unsigned long data) { struct driver_data *drv_data = (struct driver_data *)data; - struct spi_master *master = drv_data->master; + struct spi_controller *master = drv_data->master; struct spi_message *message = master->cur_msg; struct chip_data *chip = spi_get_ctldata(message->spi); u32 dma_thresh = chip->dma_threshold; @@ -1182,10 +1182,10 @@ static void pump_transfers(unsigned long data) pxa2xx_spi_write(drv_data, SSCR1, cr1); } -static int pxa2xx_spi_transfer_one_message(struct spi_master *master, +static int pxa2xx_spi_transfer_one_message(struct spi_controller *master, struct spi_message *msg) { - struct driver_data *drv_data = spi_master_get_devdata(master); + struct driver_data *drv_data = spi_controller_get_devdata(master); /* Initial message state*/ msg->state = START_STATE; @@ -1198,9 +1198,9 @@ static int pxa2xx_spi_transfer_one_message(struct spi_master *master, return 0; } -static int pxa2xx_spi_unprepare_transfer(struct spi_master *master) +static int pxa2xx_spi_unprepare_transfer(struct spi_controller *master) { - struct driver_data *drv_data = spi_master_get_devdata(master); + struct driver_data *drv_data = spi_controller_get_devdata(master); /* Disable the SSP now */ pxa2xx_spi_write(drv_data, SSCR0, @@ -1212,7 +1212,8 @@ static int pxa2xx_spi_unprepare_transfer(struct spi_master *master) static int setup_cs(struct spi_device *spi, struct chip_data *chip, struct pxa2xx_spi_chip *chip_info) { - struct driver_data *drv_data = spi_master_get_devdata(spi->master); + struct driver_data *drv_data = + spi_controller_get_devdata(spi->controller); struct gpio_desc *gpiod; int err = 0; @@ -1270,7 +1271,8 @@ static int setup(struct spi_device *spi) struct pxa2xx_spi_chip *chip_info; struct chip_data *chip; const struct lpss_config *config; - struct driver_data *drv_data = spi_master_get_devdata(spi->master); + struct driver_data *drv_data = + spi_controller_get_devdata(spi->controller); uint tx_thres, tx_hi_thres, rx_thres; switch (drv_data->ssp_type) { @@ -1410,7 +1412,8 @@ static int setup(struct spi_device *spi) static void cleanup(struct spi_device *spi) { struct chip_data *chip = spi_get_ctldata(spi); - struct driver_data *drv_data = spi_master_get_devdata(spi->master); + struct driver_data *drv_data = + spi_controller_get_devdata(spi->controller); if (!chip) return; @@ -1575,9 +1578,10 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) } #endif -static int pxa2xx_spi_fw_translate_cs(struct spi_master *master, unsigned cs) +static int pxa2xx_spi_fw_translate_cs(struct spi_controller *master, + unsigned int cs) { - struct driver_data *drv_data = spi_master_get_devdata(master); + struct driver_data *drv_data = spi_controller_get_devdata(master); if (has_acpi_companion(&drv_data->pdev->dev)) { switch (drv_data->ssp_type) { @@ -1602,7 +1606,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct pxa2xx_spi_master *platform_info; - struct spi_master *master; + struct spi_controller *master; struct driver_data *drv_data; struct ssp_device *ssp; const struct lpss_config *config; @@ -1633,7 +1637,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) pxa_ssp_free(ssp); return -ENOMEM; } - drv_data = spi_master_get_devdata(master); + drv_data = spi_controller_get_devdata(master); drv_data->master = master; drv_data->master_info = platform_info; drv_data->pdev = pdev; @@ -1651,7 +1655,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) master->unprepare_transfer_hardware = pxa2xx_spi_unprepare_transfer; master->fw_translate_cs = pxa2xx_spi_fw_translate_cs; master->auto_runtime_pm = true; - master->flags = SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX; + master->flags = SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX; drv_data->ssp_type = ssp->type; @@ -1793,7 +1797,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) /* Register with the SPI framework */ platform_set_drvdata(pdev, drv_data); - status = devm_spi_register_master(&pdev->dev, master); + status = devm_spi_register_controller(&pdev->dev, master); if (status != 0) { dev_err(&pdev->dev, "problem registering spi master\n"); goto out_error_clock_enabled; @@ -1807,7 +1811,7 @@ out_error_clock_enabled: free_irq(ssp->irq, drv_data); out_error_master_alloc: - spi_master_put(master); + spi_controller_put(master); pxa_ssp_free(ssp); return status; } @@ -1858,7 +1862,7 @@ static int pxa2xx_spi_suspend(struct device *dev) struct ssp_device *ssp = drv_data->ssp; int status; - status = spi_master_suspend(drv_data->master); + status = spi_controller_suspend(drv_data->master); if (status != 0) return status; pxa2xx_spi_write(drv_data, SSCR0, 0); @@ -1884,7 +1888,7 @@ static int pxa2xx_spi_resume(struct device *dev) lpss_ssp_setup(drv_data); /* Start the queue running */ - status = spi_master_resume(drv_data->master); + status = spi_controller_resume(drv_data->master); if (status != 0) { dev_err(dev, "problem starting queue (%d)\n", status); return status; diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h index 94f7b0713281..513ec6c6e25b 100644 --- a/drivers/spi/spi-pxa2xx.h +++ b/drivers/spi/spi-pxa2xx.h @@ -31,7 +31,7 @@ struct driver_data { /* SPI framework hookup */ enum pxa_ssp_type ssp_type; - struct spi_master *master; + struct spi_controller *master; /* PXA hookup */ struct pxa2xx_spi_master *master_info; -- cgit v1.2.3 From 544248623b95eefbe4bea5fa5c68ab0da495eaae Mon Sep 17 00:00:00 2001 From: Jan Kundrát Date: Fri, 26 Jan 2018 23:56:10 +0100 Subject: spi: orion: Rework GPIO CS handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Claim the GPIO from the driver, not via DT bindings or through the platform code - Find an unused HW CS signal because Orion needs to drive one for each SPI transaction The spi-orion.c was the only driver which supported (or cared about) the CS GPIO, while it wasn't actually requesting it. This change means that the DT bindings should stop hogging the GPIO CS pins because it's now being handled by the driver. Signed-off-by: Jan Kundrát Signed-off-by: Mark Brown --- drivers/spi/spi-orion.c | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) (limited to 'drivers/spi') diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index deca63e82ff6..b341235d2947 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -96,6 +96,7 @@ struct orion_spi { struct clk *clk; struct clk *axi_clk; const struct orion_spi_dev *devdata; + int unused_hw_gpio; struct orion_direct_acc direct_access[ORION_NUM_CHIPSELECTS]; }; @@ -324,13 +325,13 @@ static void orion_spi_set_cs(struct spi_device *spi, bool enable) struct orion_spi *orion_spi; int cs; + orion_spi = spi_master_get_devdata(spi->master); + if (gpio_is_valid(spi->cs_gpio)) - cs = 0; + cs = orion_spi->unused_hw_gpio; else cs = spi->chip_select; - orion_spi = spi_master_get_devdata(spi->master); - orion_spi_clrbits(orion_spi, ORION_SPI_IF_CTRL_REG, ORION_SPI_CS_MASK); orion_spi_setbits(orion_spi, ORION_SPI_IF_CTRL_REG, ORION_SPI_CS(cs)); @@ -498,6 +499,9 @@ static int orion_spi_transfer_one(struct spi_master *master, static int orion_spi_setup(struct spi_device *spi) { + if (gpio_is_valid(spi->cs_gpio)) { + gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); + } return orion_spi_setup_transfer(spi, NULL); } @@ -620,6 +624,7 @@ static int orion_spi_probe(struct platform_device *pdev) spi = spi_master_get_devdata(master); spi->master = master; + spi->unused_hw_gpio = -1; of_id = of_match_device(orion_spi_of_match_table, &pdev->dev); devdata = (of_id) ? of_id->data : &orion_spi_dev_data; @@ -731,8 +736,44 @@ static int orion_spi_probe(struct platform_device *pdev) if (status < 0) goto out_rel_pm; + if (master->cs_gpios) { + int i; + for (i = 0; i < master->num_chipselect; ++i) { + char *gpio_name; + + if (!gpio_is_valid(master->cs_gpios[i])) { + continue; + } + + gpio_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, + "%s-CS%d", dev_name(&pdev->dev), i); + if (!gpio_name) { + status = -ENOMEM; + goto out_rel_master; + } + + status = devm_gpio_request(&pdev->dev, + master->cs_gpios[i], gpio_name); + if (status) { + dev_err(&pdev->dev, + "Can't request GPIO for CS %d\n", + master->cs_gpios[i]); + goto out_rel_master; + } + if (spi->unused_hw_gpio == -1) { + dev_info(&pdev->dev, + "Selected unused HW CS#%d " + "for any GPIO CSes\n", i); + spi->unused_hw_gpio = i; + } + } + } + + return status; +out_rel_master: + spi_unregister_master(master); out_rel_pm: pm_runtime_disable(&pdev->dev); out_rel_axi_clk: -- cgit v1.2.3 From 64aa3bd32c2679ed51401cb32fe6b387a1e6b51b Mon Sep 17 00:00:00 2001 From: Jan Kundrát Date: Thu, 15 Feb 2018 15:15:07 +0100 Subject: spi: orion: Make the error message greppable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 544248623b95 introduced a new user-visible string which was however split into two chunks. Thanks to Mark Brown for noticing. Signed-off-by: Jan Kundrát Signed-off-by: Mark Brown --- drivers/spi/spi-orion.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/spi') diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index b341235d2947..ca52300baeb1 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -762,8 +762,8 @@ static int orion_spi_probe(struct platform_device *pdev) } if (spi->unused_hw_gpio == -1) { dev_info(&pdev->dev, - "Selected unused HW CS#%d " - "for any GPIO CSes\n", i); + "Selected unused HW CS#%d for any GPIO CSes\n", + i); spi->unused_hw_gpio = i; } } -- cgit v1.2.3 From 5c22af7eeb265413b80eb8e03ae708e1b222728c Mon Sep 17 00:00:00 2001 From: Jan Kundrát Date: Sat, 10 Feb 2018 12:20:23 +0100 Subject: spi: orion: Prepare space for per-child options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Aggregating all options for a particular child underneath a common struct looks cleaner compared to having a separate array for each per-child option. Signed-off-by: Jan Kundrát Signed-off-by: Mark Brown --- drivers/spi/spi-orion.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'drivers/spi') diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index ca52300baeb1..d01a6adc726e 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -90,6 +90,10 @@ struct orion_direct_acc { u32 size; }; +struct orion_child_options { + struct orion_direct_acc direct_access; +}; + struct orion_spi { struct spi_master *master; void __iomem *base; @@ -98,7 +102,7 @@ struct orion_spi { const struct orion_spi_dev *devdata; int unused_hw_gpio; - struct orion_direct_acc direct_access[ORION_NUM_CHIPSELECTS]; + struct orion_child_options child[ORION_NUM_CHIPSELECTS]; }; static inline void __iomem *spi_reg(struct orion_spi *orion_spi, u32 reg) @@ -436,7 +440,7 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer) * Use SPI direct write mode if base address is available. Otherwise * fall back to PIO mode for this transfer. */ - if ((orion_spi->direct_access[cs].vaddr) && (xfer->tx_buf) && + if ((orion_spi->child[cs].direct_access.vaddr) && (xfer->tx_buf) && (word_len == 8)) { unsigned int cnt = count / 4; unsigned int rem = count % 4; @@ -445,12 +449,12 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer) * Send the TX-data to the SPI device via the direct * mapped address window */ - iowrite32_rep(orion_spi->direct_access[cs].vaddr, + iowrite32_rep(orion_spi->child[cs].direct_access.vaddr, xfer->tx_buf, cnt); if (rem) { u32 *buf = (u32 *)xfer->tx_buf; - iowrite8_rep(orion_spi->direct_access[cs].vaddr, + iowrite8_rep(orion_spi->child[cs].direct_access.vaddr, &buf[cnt], rem); } @@ -707,14 +711,14 @@ static int orion_spi_probe(struct platform_device *pdev) * This needs to get extended for the direct SPI-NOR / SPI-NAND * support, once this gets implemented. */ - spi->direct_access[cs].vaddr = devm_ioremap(&pdev->dev, + spi->child[cs].direct_access.vaddr = devm_ioremap(&pdev->dev, r->start, PAGE_SIZE); - if (!spi->direct_access[cs].vaddr) { + if (!spi->child[cs].direct_access.vaddr) { status = -ENOMEM; goto out_rel_axi_clk; } - spi->direct_access[cs].size = PAGE_SIZE; + spi->child[cs].direct_access.size = PAGE_SIZE; dev_info(&pdev->dev, "CS%d configured for direct access\n", cs); } -- cgit v1.2.3 From 7c2861a6fb2c502d7b7aa85415e178f3c527a468 Mon Sep 17 00:00:00 2001 From: Alexey Khoroshilov Date: Sat, 17 Mar 2018 13:05:44 +0300 Subject: spi: jcore: disable ref_clk after getting its rate The driver does not disable ref_clk on remove. According to the comment, the only reason to enable the clock is to get its rate. So, it should be safe to disable clk just after that. By the way, clk_prepare_enable() looks to be more appropriate than clk_enable() here. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Signed-off-by: Mark Brown --- drivers/spi/spi-jcore.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'drivers/spi') diff --git a/drivers/spi/spi-jcore.c b/drivers/spi/spi-jcore.c index dafed6280df3..702fe573a47b 100644 --- a/drivers/spi/spi-jcore.c +++ b/drivers/spi/spi-jcore.c @@ -184,10 +184,11 @@ static int jcore_spi_probe(struct platform_device *pdev) */ clock_freq = 50000000; clk = devm_clk_get(&pdev->dev, "ref_clk"); - if (!IS_ERR_OR_NULL(clk)) { - if (clk_enable(clk) == 0) + if (!IS_ERR(clk)) { + if (clk_prepare_enable(clk) == 0) { clock_freq = clk_get_rate(clk); - else + clk_disable_unprepare(clk); + } else dev_warn(&pdev->dev, "could not enable ref_clk\n"); } hw->clock_freq = clock_freq; @@ -198,10 +199,8 @@ static int jcore_spi_probe(struct platform_device *pdev) /* Register our spi controller */ err = devm_spi_register_master(&pdev->dev, master); - if (err) { - clk_disable(clk); + if (err) goto exit; - } return 0; -- cgit v1.2.3 From 768d59f5d0139a6ff09e4430ec29cdc8b436421a Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Mon, 19 Mar 2018 23:16:22 +0100 Subject: spi: rspi: use correct enum for DMA transfer direction Use enum dma_transfer_direction as required by dmaengine_prep_slave_sg instead of enum dma_data_direction. This won't change behavior in practice as the enum values are equivalent. This fixes two warnings when building with clang: drivers/spi/spi-rspi.c:538:26: warning: implicit conversion from enumeration type 'enum dma_data_direction' to different enumeration type 'enum dma_transfer_direction' [-Wenum-conversion] rx->sgl, rx->nents, DMA_FROM_DEVICE, ^~~~~~~~~~~~~~~ drivers/spi/spi-rspi.c:558:26: warning: implicit conversion from enumeration type 'enum dma_data_direction' to different enumeration type 'enum dma_transfer_direction' [-Wenum-conversion] tx->sgl, tx->nents, DMA_TO_DEVICE, ^~~~~~~~~~~~~ Signed-off-by: Stefan Agner Signed-off-by: Mark Brown --- drivers/spi/spi-rspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/spi') diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 0835a8d88fb8..95dc4d78618d 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c @@ -535,7 +535,7 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx, /* First prepare and submit the DMA request(s), as this may fail */ if (rx) { desc_rx = dmaengine_prep_slave_sg(rspi->master->dma_rx, - rx->sgl, rx->nents, DMA_FROM_DEVICE, + rx->sgl, rx->nents, DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); if (!desc_rx) { ret = -EAGAIN; @@ -555,7 +555,7 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx, if (tx) { desc_tx = dmaengine_prep_slave_sg(rspi->master->dma_tx, - tx->sgl, tx->nents, DMA_TO_DEVICE, + tx->sgl, tx->nents, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); if (!desc_tx) { ret = -EAGAIN; -- cgit v1.2.3