Lines Matching refs:master
388 static int spi_qup_prep_sg(struct spi_master *master, struct scatterlist *sgl, in spi_qup_prep_sg() argument
392 struct spi_qup *qup = spi_master_get_devdata(master); in spi_qup_prep_sg()
399 chan = master->dma_tx; in spi_qup_prep_sg()
401 chan = master->dma_rx; in spi_qup_prep_sg()
415 static void spi_qup_dma_terminate(struct spi_master *master, in spi_qup_dma_terminate() argument
419 dmaengine_terminate_all(master->dma_tx); in spi_qup_dma_terminate()
421 dmaengine_terminate_all(master->dma_rx); in spi_qup_dma_terminate()
448 struct spi_master *master = spi->master; in spi_qup_do_dma() local
449 struct spi_qup *qup = spi_master_get_devdata(master); in spi_qup_do_dma()
484 ret = spi_qup_prep_sg(master, rx_sgl, rx_nents, in spi_qup_do_dma()
488 dma_async_issue_pending(master->dma_rx); in spi_qup_do_dma()
492 ret = spi_qup_prep_sg(master, tx_sgl, tx_nents, in spi_qup_do_dma()
497 dma_async_issue_pending(master->dma_tx); in spi_qup_do_dma()
516 struct spi_master *master = spi->master; in spi_qup_do_pio() local
517 struct spi_qup *qup = spi_master_get_devdata(master); in spi_qup_do_pio()
632 struct spi_qup *controller = spi_master_get_devdata(spi->master); in spi_qup_io_prep()
653 else if (spi->master->can_dma && in spi_qup_io_prep()
654 spi->master->can_dma(spi->master, spi, xfer) && in spi_qup_io_prep()
655 spi->master->cur_msg_mapped) in spi_qup_io_prep()
666 struct spi_qup *controller = spi_master_get_devdata(spi->master); in spi_qup_io_config()
814 static int spi_qup_transfer_one(struct spi_master *master, in spi_qup_transfer_one() argument
818 struct spi_qup *controller = spi_master_get_devdata(master); in spi_qup_transfer_one()
856 spi_qup_dma_terminate(master, xfer); in spi_qup_transfer_one()
861 static bool spi_qup_can_dma(struct spi_master *master, struct spi_device *spi, in spi_qup_can_dma() argument
864 struct spi_qup *qup = spi_master_get_devdata(master); in spi_qup_can_dma()
870 IS_ERR_OR_NULL(master->dma_rx)) in spi_qup_can_dma()
878 IS_ERR_OR_NULL(master->dma_tx)) in spi_qup_can_dma()
891 static void spi_qup_release_dma(struct spi_master *master) in spi_qup_release_dma() argument
893 if (!IS_ERR_OR_NULL(master->dma_rx)) in spi_qup_release_dma()
894 dma_release_channel(master->dma_rx); in spi_qup_release_dma()
895 if (!IS_ERR_OR_NULL(master->dma_tx)) in spi_qup_release_dma()
896 dma_release_channel(master->dma_tx); in spi_qup_release_dma()
899 static int spi_qup_init_dma(struct spi_master *master, resource_size_t base) in spi_qup_init_dma() argument
901 struct spi_qup *spi = spi_master_get_devdata(master); in spi_qup_init_dma()
908 master->dma_rx = dma_request_slave_channel_reason(dev, "rx"); in spi_qup_init_dma()
909 if (IS_ERR(master->dma_rx)) in spi_qup_init_dma()
910 return PTR_ERR(master->dma_rx); in spi_qup_init_dma()
912 master->dma_tx = dma_request_slave_channel_reason(dev, "tx"); in spi_qup_init_dma()
913 if (IS_ERR(master->dma_tx)) { in spi_qup_init_dma()
914 ret = PTR_ERR(master->dma_tx); in spi_qup_init_dma()
929 ret = dmaengine_slave_config(master->dma_rx, rx_conf); in spi_qup_init_dma()
935 ret = dmaengine_slave_config(master->dma_tx, tx_conf); in spi_qup_init_dma()
944 dma_release_channel(master->dma_tx); in spi_qup_init_dma()
946 dma_release_channel(master->dma_rx); in spi_qup_init_dma()
956 controller = spi_master_get_devdata(spi->master); in spi_qup_set_cs()
970 struct spi_master *master; in spi_qup_probe() local
1019 master = spi_alloc_master(dev, sizeof(struct spi_qup)); in spi_qup_probe()
1020 if (!master) { in spi_qup_probe()
1030 master->num_chipselect = SPI_NUM_CHIPSELECTS; in spi_qup_probe()
1032 master->num_chipselect = num_cs; in spi_qup_probe()
1034 master->bus_num = pdev->id; in spi_qup_probe()
1035 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; in spi_qup_probe()
1036 master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); in spi_qup_probe()
1037 master->max_speed_hz = max_freq; in spi_qup_probe()
1038 master->transfer_one = spi_qup_transfer_one; in spi_qup_probe()
1039 master->dev.of_node = pdev->dev.of_node; in spi_qup_probe()
1040 master->auto_runtime_pm = true; in spi_qup_probe()
1041 master->dma_alignment = dma_get_cache_alignment(); in spi_qup_probe()
1042 master->max_dma_len = SPI_MAX_XFER; in spi_qup_probe()
1044 platform_set_drvdata(pdev, master); in spi_qup_probe()
1046 controller = spi_master_get_devdata(master); in spi_qup_probe()
1054 ret = spi_qup_init_dma(master, res->start); in spi_qup_probe()
1058 master->can_dma = spi_qup_can_dma; in spi_qup_probe()
1063 master->set_cs = spi_qup_set_cs; in spi_qup_probe()
1128 ret = devm_spi_register_master(dev, master); in spi_qup_probe()
1137 spi_qup_release_dma(master); in spi_qup_probe()
1141 spi_master_put(master); in spi_qup_probe()
1148 struct spi_master *master = dev_get_drvdata(device); in spi_qup_pm_suspend_runtime() local
1149 struct spi_qup *controller = spi_master_get_devdata(master); in spi_qup_pm_suspend_runtime()
1165 struct spi_master *master = dev_get_drvdata(device); in spi_qup_pm_resume_runtime() local
1166 struct spi_qup *controller = spi_master_get_devdata(master); in spi_qup_pm_resume_runtime()
1189 struct spi_master *master = dev_get_drvdata(device); in spi_qup_suspend() local
1190 struct spi_qup *controller = spi_master_get_devdata(master); in spi_qup_suspend()
1198 ret = spi_master_suspend(master); in spi_qup_suspend()
1213 struct spi_master *master = dev_get_drvdata(device); in spi_qup_resume() local
1214 struct spi_qup *controller = spi_master_get_devdata(master); in spi_qup_resume()
1229 return spi_master_resume(master); in spi_qup_resume()
1235 struct spi_master *master = dev_get_drvdata(&pdev->dev); in spi_qup_remove() local
1236 struct spi_qup *controller = spi_master_get_devdata(master); in spi_qup_remove()
1247 spi_qup_release_dma(master); in spi_qup_remove()