Lines Matching full:dspi

6 // Freescale DSPI driver
7 // This file contains a driver for the Freescale DSPI
21 #include <linux/spi/spi-fsl-dspi.h>
23 #define DRIVER_NAME "fsl-dspi"
245 void (*host_to_dev)(struct fsl_dspi *dspi, u32 *txdata);
246 void (*dev_to_host)(struct fsl_dspi *dspi, u32 rxdata);
249 static void dspi_native_host_to_dev(struct fsl_dspi *dspi, u32 *txdata) in dspi_native_host_to_dev() argument
251 switch (dspi->oper_word_size) { in dspi_native_host_to_dev()
253 *txdata = *(u8 *)dspi->tx; in dspi_native_host_to_dev()
256 *txdata = *(u16 *)dspi->tx; in dspi_native_host_to_dev()
259 *txdata = *(u32 *)dspi->tx; in dspi_native_host_to_dev()
262 dspi->tx += dspi->oper_word_size; in dspi_native_host_to_dev()
265 static void dspi_native_dev_to_host(struct fsl_dspi *dspi, u32 rxdata) in dspi_native_dev_to_host() argument
267 switch (dspi->oper_word_size) { in dspi_native_dev_to_host()
269 *(u8 *)dspi->rx = rxdata; in dspi_native_dev_to_host()
272 *(u16 *)dspi->rx = rxdata; in dspi_native_dev_to_host()
275 *(u32 *)dspi->rx = rxdata; in dspi_native_dev_to_host()
278 dspi->rx += dspi->oper_word_size; in dspi_native_dev_to_host()
281 static void dspi_8on32_host_to_dev(struct fsl_dspi *dspi, u32 *txdata) in dspi_8on32_host_to_dev() argument
283 *txdata = cpu_to_be32(*(u32 *)dspi->tx); in dspi_8on32_host_to_dev()
284 dspi->tx += sizeof(u32); in dspi_8on32_host_to_dev()
287 static void dspi_8on32_dev_to_host(struct fsl_dspi *dspi, u32 rxdata) in dspi_8on32_dev_to_host() argument
289 *(u32 *)dspi->rx = be32_to_cpu(rxdata); in dspi_8on32_dev_to_host()
290 dspi->rx += sizeof(u32); in dspi_8on32_dev_to_host()
293 static void dspi_8on16_host_to_dev(struct fsl_dspi *dspi, u32 *txdata) in dspi_8on16_host_to_dev() argument
295 *txdata = cpu_to_be16(*(u16 *)dspi->tx); in dspi_8on16_host_to_dev()
296 dspi->tx += sizeof(u16); in dspi_8on16_host_to_dev()
299 static void dspi_8on16_dev_to_host(struct fsl_dspi *dspi, u32 rxdata) in dspi_8on16_dev_to_host() argument
301 *(u16 *)dspi->rx = be16_to_cpu(rxdata); in dspi_8on16_dev_to_host()
302 dspi->rx += sizeof(u16); in dspi_8on16_dev_to_host()
305 static void dspi_16on32_host_to_dev(struct fsl_dspi *dspi, u32 *txdata) in dspi_16on32_host_to_dev() argument
307 u16 hi = *(u16 *)dspi->tx; in dspi_16on32_host_to_dev()
308 u16 lo = *(u16 *)(dspi->tx + 2); in dspi_16on32_host_to_dev()
311 dspi->tx += sizeof(u32); in dspi_16on32_host_to_dev()
314 static void dspi_16on32_dev_to_host(struct fsl_dspi *dspi, u32 rxdata) in dspi_16on32_dev_to_host() argument
319 *(u16 *)dspi->rx = lo; in dspi_16on32_dev_to_host()
320 *(u16 *)(dspi->rx + 2) = hi; in dspi_16on32_dev_to_host()
321 dspi->rx += sizeof(u32); in dspi_16on32_dev_to_host()
328 static u32 dspi_pop_tx(struct fsl_dspi *dspi) in dspi_pop_tx() argument
332 if (dspi->tx) in dspi_pop_tx()
333 dspi->host_to_dev(dspi, &txdata); in dspi_pop_tx()
334 dspi->len -= dspi->oper_word_size; in dspi_pop_tx()
339 static u32 dspi_pop_tx_pushr(struct fsl_dspi *dspi) in dspi_pop_tx_pushr() argument
341 u16 cmd = dspi->tx_cmd, data = dspi_pop_tx(dspi); in dspi_pop_tx_pushr()
343 if (spi_controller_is_target(dspi->ctlr)) in dspi_pop_tx_pushr()
346 if (dspi->len > 0) in dspi_pop_tx_pushr()
352 static void dspi_push_rx(struct fsl_dspi *dspi, u32 rxdata) in dspi_push_rx() argument
354 if (!dspi->rx) in dspi_push_rx()
356 dspi->dev_to_host(dspi, rxdata); in dspi_push_rx()
361 struct fsl_dspi *dspi = arg; in dspi_tx_dma_callback() local
362 struct fsl_dspi_dma *dma = dspi->dma; in dspi_tx_dma_callback()
369 struct fsl_dspi *dspi = arg; in dspi_rx_dma_callback() local
370 struct fsl_dspi_dma *dma = dspi->dma; in dspi_rx_dma_callback()
373 if (dspi->rx) { in dspi_rx_dma_callback()
374 for (i = 0; i < dspi->words_in_flight; i++) in dspi_rx_dma_callback()
375 dspi_push_rx(dspi, dspi->dma->rx_dma_buf[i]); in dspi_rx_dma_callback()
381 static int dspi_next_xfer_dma_submit(struct fsl_dspi *dspi) in dspi_next_xfer_dma_submit() argument
383 struct device *dev = &dspi->pdev->dev; in dspi_next_xfer_dma_submit()
384 struct fsl_dspi_dma *dma = dspi->dma; in dspi_next_xfer_dma_submit()
388 for (i = 0; i < dspi->words_in_flight; i++) in dspi_next_xfer_dma_submit()
389 dspi->dma->tx_dma_buf[i] = dspi_pop_tx_pushr(dspi); in dspi_next_xfer_dma_submit()
393 dspi->words_in_flight * in dspi_next_xfer_dma_submit()
403 dma->tx_desc->callback_param = dspi; in dspi_next_xfer_dma_submit()
411 dspi->words_in_flight * in dspi_next_xfer_dma_submit()
421 dma->rx_desc->callback_param = dspi; in dspi_next_xfer_dma_submit()
427 reinit_completion(&dspi->dma->cmd_rx_complete); in dspi_next_xfer_dma_submit()
428 reinit_completion(&dspi->dma->cmd_tx_complete); in dspi_next_xfer_dma_submit()
433 if (spi_controller_is_target(dspi->ctlr)) { in dspi_next_xfer_dma_submit()
434 wait_for_completion_interruptible(&dspi->dma->cmd_rx_complete); in dspi_next_xfer_dma_submit()
438 time_left = wait_for_completion_timeout(&dspi->dma->cmd_tx_complete, in dspi_next_xfer_dma_submit()
447 time_left = wait_for_completion_timeout(&dspi->dma->cmd_rx_complete, in dspi_next_xfer_dma_submit()
459 static void dspi_setup_accel(struct fsl_dspi *dspi);
461 static int dspi_dma_xfer(struct fsl_dspi *dspi) in dspi_dma_xfer() argument
463 struct spi_message *message = dspi->cur_msg; in dspi_dma_xfer()
464 struct device *dev = &dspi->pdev->dev; in dspi_dma_xfer()
468 * dspi->len gets decremented by dspi_pop_tx_pushr in in dspi_dma_xfer()
471 while (dspi->len) { in dspi_dma_xfer()
473 dspi_setup_accel(dspi); in dspi_dma_xfer()
475 dspi->words_in_flight = dspi->len / dspi->oper_word_size; in dspi_dma_xfer()
476 if (dspi->words_in_flight > dspi->devtype_data->fifo_size) in dspi_dma_xfer()
477 dspi->words_in_flight = dspi->devtype_data->fifo_size; in dspi_dma_xfer()
479 message->actual_length += dspi->words_in_flight * in dspi_dma_xfer()
480 dspi->oper_word_size; in dspi_dma_xfer()
482 ret = dspi_next_xfer_dma_submit(dspi); in dspi_dma_xfer()
492 static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr) in dspi_request_dma() argument
494 int dma_bufsize = dspi->devtype_data->fifo_size * 2; in dspi_request_dma()
495 struct device *dev = &dspi->pdev->dev; in dspi_request_dma()
552 dspi->dma = dma; in dspi_request_dma()
570 dspi->dma = NULL; in dspi_request_dma()
575 static void dspi_release_dma(struct fsl_dspi *dspi) in dspi_release_dma() argument
577 int dma_bufsize = dspi->devtype_data->fifo_size * 2; in dspi_release_dma()
578 struct fsl_dspi_dma *dma = dspi->dma; in dspi_release_dma()
667 static void dspi_pushr_cmd_write(struct fsl_dspi *dspi, u16 cmd) in dspi_pushr_cmd_write() argument
672 * dspi_pop_tx (the function that decrements dspi->len) _after_ in dspi_pushr_cmd_write()
679 if (dspi->len > dspi->oper_word_size) in dspi_pushr_cmd_write()
681 regmap_write(dspi->regmap_pushr, dspi->pushr_cmd, cmd); in dspi_pushr_cmd_write()
684 static void dspi_pushr_txdata_write(struct fsl_dspi *dspi, u16 txdata) in dspi_pushr_txdata_write() argument
686 regmap_write(dspi->regmap_pushr, dspi->pushr_tx, txdata); in dspi_pushr_txdata_write()
689 static void dspi_xspi_fifo_write(struct fsl_dspi *dspi, int num_words) in dspi_xspi_fifo_write() argument
691 int num_bytes = num_words * dspi->oper_word_size; in dspi_xspi_fifo_write()
692 u16 tx_cmd = dspi->tx_cmd; in dspi_xspi_fifo_write()
702 if (!(dspi->tx_cmd & SPI_PUSHR_CMD_CONT) && num_bytes == dspi->len) in dspi_xspi_fifo_write()
706 regmap_write(dspi->regmap, SPI_CTARE(0), in dspi_xspi_fifo_write()
707 SPI_FRAME_EBITS(dspi->oper_bits_per_word) | in dspi_xspi_fifo_write()
714 dspi_pushr_cmd_write(dspi, tx_cmd); in dspi_xspi_fifo_write()
718 u32 data = dspi_pop_tx(dspi); in dspi_xspi_fifo_write()
720 dspi_pushr_txdata_write(dspi, data & 0xFFFF); in dspi_xspi_fifo_write()
721 if (dspi->oper_bits_per_word > 16) in dspi_xspi_fifo_write()
722 dspi_pushr_txdata_write(dspi, data >> 16); in dspi_xspi_fifo_write()
726 static u32 dspi_popr_read(struct fsl_dspi *dspi) in dspi_popr_read() argument
730 regmap_read(dspi->regmap, SPI_POPR, &rxdata); in dspi_popr_read()
734 static void dspi_fifo_read(struct fsl_dspi *dspi) in dspi_fifo_read() argument
736 int num_fifo_entries = dspi->words_in_flight; in dspi_fifo_read()
740 dspi_push_rx(dspi, dspi_popr_read(dspi)); in dspi_fifo_read()
743 static void dspi_setup_accel(struct fsl_dspi *dspi) in dspi_setup_accel() argument
745 struct spi_transfer *xfer = dspi->cur_transfer; in dspi_setup_accel()
746 bool odd = !!(dspi->len & 1); in dspi_setup_accel()
752 if (!odd && dspi->len <= dspi->devtype_data->fifo_size * 2) { in dspi_setup_accel()
753 dspi->oper_bits_per_word = 16; in dspi_setup_accel()
754 } else if (odd && dspi->len <= dspi->devtype_data->fifo_size) { in dspi_setup_accel()
755 dspi->oper_bits_per_word = 8; in dspi_setup_accel()
758 if (dspi->devtype_data->trans_mode == DSPI_XSPI_MODE) in dspi_setup_accel()
759 dspi->oper_bits_per_word = 32; in dspi_setup_accel()
761 dspi->oper_bits_per_word = 16; in dspi_setup_accel()
768 if (dspi->len >= DIV_ROUND_UP(dspi->oper_bits_per_word, 8)) in dspi_setup_accel()
771 dspi->oper_bits_per_word /= 2; in dspi_setup_accel()
772 } while (dspi->oper_bits_per_word > 8); in dspi_setup_accel()
775 if (xfer->bits_per_word == 8 && dspi->oper_bits_per_word == 32) { in dspi_setup_accel()
776 dspi->dev_to_host = dspi_8on32_dev_to_host; in dspi_setup_accel()
777 dspi->host_to_dev = dspi_8on32_host_to_dev; in dspi_setup_accel()
778 } else if (xfer->bits_per_word == 8 && dspi->oper_bits_per_word == 16) { in dspi_setup_accel()
779 dspi->dev_to_host = dspi_8on16_dev_to_host; in dspi_setup_accel()
780 dspi->host_to_dev = dspi_8on16_host_to_dev; in dspi_setup_accel()
781 } else if (xfer->bits_per_word == 16 && dspi->oper_bits_per_word == 32) { in dspi_setup_accel()
782 dspi->dev_to_host = dspi_16on32_dev_to_host; in dspi_setup_accel()
783 dspi->host_to_dev = dspi_16on32_host_to_dev; in dspi_setup_accel()
786 dspi->dev_to_host = dspi_native_dev_to_host; in dspi_setup_accel()
787 dspi->host_to_dev = dspi_native_host_to_dev; in dspi_setup_accel()
788 dspi->oper_bits_per_word = xfer->bits_per_word; in dspi_setup_accel()
791 dspi->oper_word_size = DIV_ROUND_UP(dspi->oper_bits_per_word, 8); in dspi_setup_accel()
798 regmap_write(dspi->regmap, SPI_CTAR(0), in dspi_setup_accel()
799 dspi->cur_chip->ctar_val | in dspi_setup_accel()
800 SPI_FRAME_BITS(dspi->oper_bits_per_word)); in dspi_setup_accel()
803 static void dspi_fifo_write(struct fsl_dspi *dspi) in dspi_fifo_write() argument
805 int num_fifo_entries = dspi->devtype_data->fifo_size; in dspi_fifo_write()
806 struct spi_transfer *xfer = dspi->cur_transfer; in dspi_fifo_write()
807 struct spi_message *msg = dspi->cur_msg; in dspi_fifo_write()
810 dspi_setup_accel(dspi); in dspi_fifo_write()
813 if (dspi->oper_word_size == 4) in dspi_fifo_write()
821 num_words = dspi->len / dspi->oper_word_size; in dspi_fifo_write()
826 num_bytes = num_words * dspi->oper_word_size; in dspi_fifo_write()
828 dspi->progress += num_bytes / DIV_ROUND_UP(xfer->bits_per_word, 8); in dspi_fifo_write()
834 dspi->words_in_flight = num_words; in dspi_fifo_write()
836 spi_take_timestamp_pre(dspi->ctlr, xfer, dspi->progress, !dspi->irq); in dspi_fifo_write()
838 dspi_xspi_fifo_write(dspi, num_words); in dspi_fifo_write()
841 * interrupt, so we must never use dspi->words_in_flight again since it in dspi_fifo_write()
845 spi_take_timestamp_post(dspi->ctlr, dspi->cur_transfer, in dspi_fifo_write()
846 dspi->progress, !dspi->irq); in dspi_fifo_write()
849 static int dspi_rxtx(struct fsl_dspi *dspi) in dspi_rxtx() argument
851 dspi_fifo_read(dspi); in dspi_rxtx()
853 if (!dspi->len) in dspi_rxtx()
857 dspi_fifo_write(dspi); in dspi_rxtx()
862 static int dspi_poll(struct fsl_dspi *dspi) in dspi_poll() argument
868 regmap_read(dspi->regmap, SPI_SR, &spi_sr); in dspi_poll()
869 regmap_write(dspi->regmap, SPI_SR, spi_sr); in dspi_poll()
878 return dspi_rxtx(dspi); in dspi_poll()
883 struct fsl_dspi *dspi = (struct fsl_dspi *)dev_id; in dspi_interrupt() local
886 regmap_read(dspi->regmap, SPI_SR, &spi_sr); in dspi_interrupt()
887 regmap_write(dspi->regmap, SPI_SR, spi_sr); in dspi_interrupt()
892 if (dspi_rxtx(dspi) == 0) in dspi_interrupt()
893 complete(&dspi->xfer_done); in dspi_interrupt()
919 struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr); in dspi_transfer_one_message() local
928 dspi->cur_transfer = transfer; in dspi_transfer_one_message()
929 dspi->cur_msg = message; in dspi_transfer_one_message()
930 dspi->cur_chip = spi_get_ctldata(spi); in dspi_transfer_one_message()
935 dspi->tx_cmd = SPI_PUSHR_CMD_CTAS(0); in dspi_transfer_one_message()
937 dspi->tx_cmd |= SPI_PUSHR_CMD_PCS(spi_get_chipselect(spi, 0)); in dspi_transfer_one_message()
939 if (list_is_last(&dspi->cur_transfer->transfer_list, in dspi_transfer_one_message()
940 &dspi->cur_msg->transfers)) { in dspi_transfer_one_message()
945 dspi->tx_cmd |= SPI_PUSHR_CMD_CONT; in dspi_transfer_one_message()
953 dspi->tx_cmd |= SPI_PUSHR_CMD_CONT; in dspi_transfer_one_message()
956 dspi->tx = transfer->tx_buf; in dspi_transfer_one_message()
957 dspi->rx = transfer->rx_buf; in dspi_transfer_one_message()
958 dspi->len = transfer->len; in dspi_transfer_one_message()
959 dspi->progress = 0; in dspi_transfer_one_message()
961 regmap_update_bits(dspi->regmap, SPI_MCR, in dspi_transfer_one_message()
965 spi_take_timestamp_pre(dspi->ctlr, dspi->cur_transfer, in dspi_transfer_one_message()
966 dspi->progress, !dspi->irq); in dspi_transfer_one_message()
968 if (dspi->devtype_data->trans_mode == DSPI_DMA_MODE) { in dspi_transfer_one_message()
969 status = dspi_dma_xfer(dspi); in dspi_transfer_one_message()
971 dspi_fifo_write(dspi); in dspi_transfer_one_message()
973 if (dspi->irq) { in dspi_transfer_one_message()
974 wait_for_completion(&dspi->xfer_done); in dspi_transfer_one_message()
975 reinit_completion(&dspi->xfer_done); in dspi_transfer_one_message()
978 status = dspi_poll(dspi); in dspi_transfer_one_message()
987 if (!(dspi->tx_cmd & SPI_PUSHR_CMD_CONT)) in dspi_transfer_one_message()
999 struct fsl_dspi *dspi = spi_controller_get_devdata(spi->controller); in dspi_setup() local
1020 pdata = dev_get_platdata(&dspi->pdev->dev); in dspi_setup()
1051 "DSPI controller timing params: CS-to-SCK delay %u ns, SCK-to-CS delay %u ns\n", in dspi_setup()
1054 clkrate = clk_get_rate(dspi->clk); in dspi_setup()
1069 if (!spi_controller_is_target(dspi->ctlr)) { in dspi_setup()
1104 .compatible = "fsl,vf610-dspi",
1107 .compatible = "fsl,ls1021a-v1.0-dspi",
1110 .compatible = "fsl,ls1012a-dspi",
1113 .compatible = "fsl,ls1028a-dspi",
1116 .compatible = "fsl,ls1043a-dspi",
1119 .compatible = "fsl,ls1046a-dspi",
1122 .compatible = "fsl,ls2080a-dspi",
1125 .compatible = "fsl,ls2085a-dspi",
1128 .compatible = "fsl,lx2160a-dspi",
1138 struct fsl_dspi *dspi = dev_get_drvdata(dev); in dspi_suspend() local
1140 if (dspi->irq) in dspi_suspend()
1141 disable_irq(dspi->irq); in dspi_suspend()
1142 spi_controller_suspend(dspi->ctlr); in dspi_suspend()
1143 clk_disable_unprepare(dspi->clk); in dspi_suspend()
1152 struct fsl_dspi *dspi = dev_get_drvdata(dev); in dspi_resume() local
1157 ret = clk_prepare_enable(dspi->clk); in dspi_resume()
1160 spi_controller_resume(dspi->ctlr); in dspi_resume()
1161 if (dspi->irq) in dspi_resume()
1162 enable_irq(dspi->irq); in dspi_resume()
1218 static int dspi_init(struct fsl_dspi *dspi) in dspi_init() argument
1223 mcr = SPI_MCR_PCSIS(GENMASK(dspi->ctlr->max_native_cs - 1, 0)); in dspi_init()
1225 if (dspi->devtype_data->trans_mode == DSPI_XSPI_MODE) in dspi_init()
1227 if (!spi_controller_is_target(dspi->ctlr)) in dspi_init()
1230 regmap_write(dspi->regmap, SPI_MCR, mcr); in dspi_init()
1231 regmap_write(dspi->regmap, SPI_SR, SPI_SR_CLEAR); in dspi_init()
1233 switch (dspi->devtype_data->trans_mode) { in dspi_init()
1235 regmap_write(dspi->regmap, SPI_RSER, SPI_RSER_CMDTCFE); in dspi_init()
1238 regmap_write(dspi->regmap, SPI_RSER, in dspi_init()
1243 dev_err(&dspi->pdev->dev, "unsupported trans_mode %u\n", in dspi_init()
1244 dspi->devtype_data->trans_mode); in dspi_init()
1253 struct fsl_dspi *dspi = spi_controller_get_devdata(host); in dspi_target_abort() local
1259 if (dspi->devtype_data->trans_mode == DSPI_DMA_MODE) { in dspi_target_abort()
1260 dmaengine_terminate_sync(dspi->dma->chan_rx); in dspi_target_abort()
1261 dmaengine_terminate_sync(dspi->dma->chan_tx); in dspi_target_abort()
1264 /* Clear the internal DSPI RX and TX FIFO buffers */ in dspi_target_abort()
1265 regmap_update_bits(dspi->regmap, SPI_MCR, in dspi_target_abort()
1279 struct fsl_dspi *dspi; in dspi_probe() local
1284 dspi = devm_kzalloc(&pdev->dev, sizeof(*dspi), GFP_KERNEL); in dspi_probe()
1285 if (!dspi) in dspi_probe()
1292 spi_controller_set_devdata(ctlr, dspi); in dspi_probe()
1293 platform_set_drvdata(pdev, dspi); in dspi_probe()
1295 dspi->pdev = pdev; in dspi_probe()
1296 dspi->ctlr = ctlr; in dspi_probe()
1313 dspi->devtype_data = &devtype_data[MCF5441X]; in dspi_probe()
1330 dspi->devtype_data = of_device_get_match_data(&pdev->dev); in dspi_probe()
1331 if (!dspi->devtype_data) { in dspi_probe()
1340 dspi->pushr_cmd = 0; in dspi_probe()
1341 dspi->pushr_tx = 2; in dspi_probe()
1343 dspi->pushr_cmd = 2; in dspi_probe()
1344 dspi->pushr_tx = 0; in dspi_probe()
1347 if (dspi->devtype_data->trans_mode == DSPI_XSPI_MODE) in dspi_probe()
1358 if (dspi->devtype_data->trans_mode == DSPI_XSPI_MODE) in dspi_probe()
1362 dspi->regmap = devm_regmap_init_mmio(&pdev->dev, base, regmap_config); in dspi_probe()
1363 if (IS_ERR(dspi->regmap)) { in dspi_probe()
1365 PTR_ERR(dspi->regmap)); in dspi_probe()
1366 ret = PTR_ERR(dspi->regmap); in dspi_probe()
1370 if (dspi->devtype_data->trans_mode == DSPI_XSPI_MODE) { in dspi_probe()
1371 dspi->regmap_pushr = devm_regmap_init_mmio( in dspi_probe()
1374 if (IS_ERR(dspi->regmap_pushr)) { in dspi_probe()
1377 PTR_ERR(dspi->regmap_pushr)); in dspi_probe()
1378 ret = PTR_ERR(dspi->regmap_pushr); in dspi_probe()
1383 dspi->clk = devm_clk_get_enabled(&pdev->dev, "dspi"); in dspi_probe()
1384 if (IS_ERR(dspi->clk)) { in dspi_probe()
1385 ret = PTR_ERR(dspi->clk); in dspi_probe()
1390 ret = dspi_init(dspi); in dspi_probe()
1394 dspi->irq = platform_get_irq(pdev, 0); in dspi_probe()
1395 if (dspi->irq <= 0) { in dspi_probe()
1398 dspi->irq = 0; in dspi_probe()
1402 init_completion(&dspi->xfer_done); in dspi_probe()
1404 ret = request_threaded_irq(dspi->irq, dspi_interrupt, NULL, in dspi_probe()
1405 IRQF_SHARED, pdev->name, dspi); in dspi_probe()
1407 dev_err(&pdev->dev, "Unable to attach DSPI interrupt\n"); in dspi_probe()
1413 if (dspi->devtype_data->trans_mode == DSPI_DMA_MODE) { in dspi_probe()
1414 ret = dspi_request_dma(dspi, res->start); in dspi_probe()
1422 clk_get_rate(dspi->clk) / dspi->devtype_data->max_clock_factor; in dspi_probe()
1424 if (dspi->devtype_data->trans_mode != DSPI_DMA_MODE) in dspi_probe()
1429 dev_err(&pdev->dev, "Problem registering DSPI ctlr\n"); in dspi_probe()
1436 dspi_release_dma(dspi); in dspi_probe()
1438 if (dspi->irq) in dspi_probe()
1439 free_irq(dspi->irq, dspi); in dspi_probe()
1448 struct fsl_dspi *dspi = platform_get_drvdata(pdev); in dspi_remove() local
1451 spi_unregister_controller(dspi->ctlr); in dspi_remove()
1454 regmap_update_bits(dspi->regmap, SPI_MCR, in dspi_remove()
1459 regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_HALT, SPI_MCR_HALT); in dspi_remove()
1461 dspi_release_dma(dspi); in dspi_remove()
1462 if (dspi->irq) in dspi_remove()
1463 free_irq(dspi->irq, dspi); in dspi_remove()
1481 MODULE_DESCRIPTION("Freescale DSPI Controller Driver");