···99 "rockchip,rk3066-spi" for rk3066.1010 "rockchip,rk3188-spi", "rockchip,rk3066-spi" for rk3188.1111 "rockchip,rk3288-spi", "rockchip,rk3066-spi" for rk3288.1212+ "rockchip,rk3399-spi", "rockchip,rk3066-spi" for rk3399.1213- reg: physical base address of the controller and length of memory mapped1314 region.1415- interrupts: The interrupt number to the cpu. The interrupt specifier format
···11+Xilinx SPI controller Device Tree Bindings22+-------------------------------------------------33+44+Required properties:55+- compatible : Should be "xlnx,xps-spi-2.00.a" or "xlnx,xps-spi-2.00.b"66+- reg : Physical base address and size of SPI registers map.77+- interrupts : Property with a value describing the interrupt88+ number.99+- interrupt-parent : Must be core interrupt controller1010+1111+Optional properties:1212+- xlnx,num-ss-bits : Number of chip selects used.1313+1414+Example:1515+ axi_quad_spi@41e00000 {1616+ compatible = "xlnx,xps-spi-2.00.a";1717+ interrupt-parent = <&intc>;1818+ interrupts = <0 31 1>;1919+ reg = <0x41e00000 0x10000>;2020+ xlnx,num-ss-bits = <0x1>;2121+ };2222+
+3-3
drivers/spi/Kconfig
···487487488488config SPI_RSPI489489 tristate "Renesas RSPI/QSPI controller"490490- depends on SUPERH || ARCH_SHMOBILE || COMPILE_TEST490490+ depends on SUPERH || ARCH_RENESAS || COMPILE_TEST491491 help492492 SPI driver for Renesas RSPI and QSPI blocks.493493···537537config SPI_SH_MSIOF538538 tristate "SuperH MSIOF SPI controller"539539 depends on HAVE_CLK && HAS_DMA540540- depends on SUPERH || ARCH_SHMOBILE || COMPILE_TEST540540+ depends on SUPERH || ARCH_RENESAS || COMPILE_TEST541541 help542542 SPI driver for SuperH and SH Mobile MSIOF blocks.543543···556556557557config SPI_SH_HSPI558558 tristate "SuperH HSPI controller"559559- depends on ARCH_SHMOBILE || COMPILE_TEST559559+ depends on ARCH_RENESAS || COMPILE_TEST560560 help561561 SPI driver for SuperH HSPI blocks.562562
+37-23
drivers/spi/spi-rockchip.c
···1313 *1414 */15151616-#include <linux/init.h>1717-#include <linux/module.h>1816#include <linux/clk.h>1919-#include <linux/err.h>2020-#include <linux/delay.h>2121-#include <linux/interrupt.h>2222-#include <linux/platform_device.h>2323-#include <linux/slab.h>2424-#include <linux/spi/spi.h>2525-#include <linux/scatterlist.h>2626-#include <linux/of.h>2727-#include <linux/pm_runtime.h>2828-#include <linux/io.h>2917#include <linux/dmaengine.h>1818+#include <linux/module.h>1919+#include <linux/of.h>2020+#include <linux/platform_device.h>2121+#include <linux/spi/spi.h>2222+#include <linux/pm_runtime.h>2323+#include <linux/scatterlist.h>30243125#define DRIVER_NAME "rockchip-spi"3226···173179 u8 tmode;174180 u8 bpw;175181 u8 n_bytes;176176- u8 rsd_nsecs;182182+ u32 rsd_nsecs;177183 unsigned len;178184 u32 speed;179185···185191 u32 state;186192 /* protect state */187193 spinlock_t lock;188188-189189- struct completion xfer_completion;190194191195 u32 use_dma;192196 struct sg_table tx_sg;···257265static void rockchip_spi_set_cs(struct spi_device *spi, bool enable)258266{259267 u32 ser;260260- struct rockchip_spi *rs = spi_master_get_devdata(spi->master);268268+ struct spi_master *master = spi->master;269269+ struct rockchip_spi *rs = spi_master_get_devdata(master);270270+271271+ pm_runtime_get_sync(rs->dev);261272262273 ser = readl_relaxed(rs->regs + ROCKCHIP_SPI_SER) & SER_MASK;263274···285290 ser &= ~(1 << spi->chip_select);286291287292 writel_relaxed(ser, rs->regs + ROCKCHIP_SPI_SER);293293+294294+ pm_runtime_put_sync(rs->dev);288295}289296290297static int rockchip_spi_prepare_message(struct spi_master *master,···316319 */317320 if (rs->use_dma) {318321 if (rs->state & RXBUSY) {319319- dmaengine_terminate_all(rs->dma_rx.ch);322322+ dmaengine_terminate_async(rs->dma_rx.ch);320323 flush_fifo(rs);321324 }322325323326 if (rs->state & TXBUSY)324324- dmaengine_terminate_all(rs->dma_tx.ch);327327+ dmaengine_terminate_async(rs->dma_tx.ch);325328 }326329327330 spin_unlock_irqrestore(&rs->lock, flags);···430433 spin_unlock_irqrestore(&rs->lock, flags);431434}432435433433-static void rockchip_spi_prepare_dma(struct rockchip_spi *rs)436436+static int rockchip_spi_prepare_dma(struct rockchip_spi *rs)434437{435438 unsigned long flags;436439 struct dma_slave_config rxconf, txconf;···453456 rs->dma_rx.ch,454457 rs->rx_sg.sgl, rs->rx_sg.nents,455458 rs->dma_rx.direction, DMA_PREP_INTERRUPT);459459+ if (!rxdesc)460460+ return -EINVAL;456461457462 rxdesc->callback = rockchip_spi_dma_rxcb;458463 rxdesc->callback_param = rs;···472473 rs->dma_tx.ch,473474 rs->tx_sg.sgl, rs->tx_sg.nents,474475 rs->dma_tx.direction, DMA_PREP_INTERRUPT);476476+ if (!txdesc) {477477+ if (rxdesc)478478+ dmaengine_terminate_sync(rs->dma_rx.ch);479479+ return -EINVAL;480480+ }475481476482 txdesc->callback = rockchip_spi_dma_txcb;477483 txdesc->callback_param = rs;···498494 dmaengine_submit(txdesc);499495 dma_async_issue_pending(rs->dma_tx.ch);500496 }497497+498498+ return 0;501499}502500503501static void rockchip_spi_config(struct rockchip_spi *rs)···509503 int rsd = 0;510504511505 u32 cr0 = (CR0_BHT_8BIT << CR0_BHT_OFFSET)512512- | (CR0_SSD_ONE << CR0_SSD_OFFSET);506506+ | (CR0_SSD_ONE << CR0_SSD_OFFSET)507507+ | (CR0_EM_BIG << CR0_EM_OFFSET);513508514509 cr0 |= (rs->n_bytes << CR0_DFS_OFFSET);515510 cr0 |= ((rs->mode & 0x3) << CR0_SCPH_OFFSET);···613606 if (rs->use_dma) {614607 if (rs->tmode == CR0_XFM_RO) {615608 /* rx: dma must be prepared first */616616- rockchip_spi_prepare_dma(rs);609609+ ret = rockchip_spi_prepare_dma(rs);617610 spi_enable_chip(rs, 1);618611 } else {619612 /* tx or tr: spi must be enabled first */620613 spi_enable_chip(rs, 1);621621- rockchip_spi_prepare_dma(rs);614614+ ret = rockchip_spi_prepare_dma(rs);622615 }623616 } else {624617 spi_enable_chip(rs, 1);···724717 master->handle_err = rockchip_spi_handle_err;725718726719 rs->dma_tx.ch = dma_request_slave_channel(rs->dev, "tx");727727- if (!rs->dma_tx.ch)720720+ if (IS_ERR_OR_NULL(rs->dma_tx.ch)) {721721+ /* Check tx to see if we need defer probing driver */722722+ if (PTR_ERR(rs->dma_tx.ch) == -EPROBE_DEFER) {723723+ ret = -EPROBE_DEFER;724724+ goto err_get_fifo_len;725725+ }728726 dev_warn(rs->dev, "Failed to request TX DMA channel\n");727727+ }729728730729 rs->dma_rx.ch = dma_request_slave_channel(rs->dev, "rx");731730 if (!rs->dma_rx.ch) {···884871 { .compatible = "rockchip,rk3066-spi", },885872 { .compatible = "rockchip,rk3188-spi", },886873 { .compatible = "rockchip,rk3288-spi", },874874+ { .compatible = "rockchip,rk3399-spi", },887875 { },888876};889877MODULE_DEVICE_TABLE(of, rockchip_spi_dt_match);