Lines Matching refs:master

100 	struct spi_master	*master;  member
184 struct sun6i_spi *sspi = spi_master_get_devdata(spi->master); in sun6i_spi_set_cs()
215 struct spi_master *master = sspi->master; in sun6i_spi_prepare_dma() local
226 dmaengine_slave_config(master->dma_rx, &rxconf); in sun6i_spi_prepare_dma()
228 rxdesc = dmaengine_prep_slave_sg(master->dma_rx, in sun6i_spi_prepare_dma()
248 dmaengine_slave_config(master->dma_tx, &txconf); in sun6i_spi_prepare_dma()
250 txdesc = dmaengine_prep_slave_sg(master->dma_tx, in sun6i_spi_prepare_dma()
257 dmaengine_terminate_sync(master->dma_rx); in sun6i_spi_prepare_dma()
264 dma_async_issue_pending(master->dma_rx); in sun6i_spi_prepare_dma()
269 dma_async_issue_pending(master->dma_tx); in sun6i_spi_prepare_dma()
275 static int sun6i_spi_transfer_one(struct spi_master *master, in sun6i_spi_transfer_one() argument
279 struct sun6i_spi *sspi = spi_master_get_devdata(master); in sun6i_spi_transfer_one()
296 use_dma = master->can_dma ? master->can_dma(master, spi, tfr) : false; in sun6i_spi_transfer_one()
466 dev_warn(&master->dev, in sun6i_spi_transfer_one()
489 tx_time = spi_controller_xfer_timeout(master, tfr); in sun6i_spi_transfer_one()
505 dev_warn(&master->dev, "RX DMA timeout\n"); in sun6i_spi_transfer_one()
511 dev_warn(&master->dev, in sun6i_spi_transfer_one()
521 dmaengine_terminate_sync(master->dma_rx); in sun6i_spi_transfer_one()
522 dmaengine_terminate_sync(master->dma_tx); in sun6i_spi_transfer_one()
567 struct spi_master *master = dev_get_drvdata(dev); in sun6i_spi_runtime_resume() local
568 struct sun6i_spi *sspi = spi_master_get_devdata(master); in sun6i_spi_runtime_resume()
604 struct spi_master *master = dev_get_drvdata(dev); in sun6i_spi_runtime_suspend() local
605 struct sun6i_spi *sspi = spi_master_get_devdata(master); in sun6i_spi_runtime_suspend()
614 static bool sun6i_spi_can_dma(struct spi_master *master, in sun6i_spi_can_dma() argument
618 struct sun6i_spi *sspi = spi_master_get_devdata(master); in sun6i_spi_can_dma()
630 struct spi_master *master; in sun6i_spi_probe() local
635 master = spi_alloc_master(&pdev->dev, sizeof(struct sun6i_spi)); in sun6i_spi_probe()
636 if (!master) { in sun6i_spi_probe()
641 platform_set_drvdata(pdev, master); in sun6i_spi_probe()
642 sspi = spi_master_get_devdata(master); in sun6i_spi_probe()
663 sspi->master = master; in sun6i_spi_probe()
666 master->max_speed_hz = 100 * 1000 * 1000; in sun6i_spi_probe()
667 master->min_speed_hz = 3 * 1000; in sun6i_spi_probe()
668 master->use_gpio_descriptors = true; in sun6i_spi_probe()
669 master->set_cs = sun6i_spi_set_cs; in sun6i_spi_probe()
670 master->transfer_one = sun6i_spi_transfer_one; in sun6i_spi_probe()
671 master->num_chipselect = 4; in sun6i_spi_probe()
672 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST | in sun6i_spi_probe()
674 master->bits_per_word_mask = SPI_BPW_MASK(8); in sun6i_spi_probe()
675 master->dev.of_node = pdev->dev.of_node; in sun6i_spi_probe()
676 master->auto_runtime_pm = true; in sun6i_spi_probe()
677 master->max_transfer_size = sun6i_spi_max_transfer_size; in sun6i_spi_probe()
703 master->dma_tx = dma_request_chan(&pdev->dev, "tx"); in sun6i_spi_probe()
704 if (IS_ERR(master->dma_tx)) { in sun6i_spi_probe()
706 if (PTR_ERR(master->dma_tx) == -EPROBE_DEFER) { in sun6i_spi_probe()
711 master->dma_tx = NULL; in sun6i_spi_probe()
714 master->dma_rx = dma_request_chan(&pdev->dev, "rx"); in sun6i_spi_probe()
715 if (IS_ERR(master->dma_rx)) { in sun6i_spi_probe()
716 if (PTR_ERR(master->dma_rx) == -EPROBE_DEFER) { in sun6i_spi_probe()
721 master->dma_rx = NULL; in sun6i_spi_probe()
724 if (master->dma_tx && master->dma_rx) { in sun6i_spi_probe()
727 master->can_dma = sun6i_spi_can_dma; in sun6i_spi_probe()
745 ret = devm_spi_register_master(&pdev->dev, master); in sun6i_spi_probe()
757 if (master->dma_rx) in sun6i_spi_probe()
758 dma_release_channel(master->dma_rx); in sun6i_spi_probe()
760 if (master->dma_tx) in sun6i_spi_probe()
761 dma_release_channel(master->dma_tx); in sun6i_spi_probe()
763 spi_master_put(master); in sun6i_spi_probe()
769 struct spi_master *master = platform_get_drvdata(pdev); in sun6i_spi_remove() local
773 if (master->dma_tx) in sun6i_spi_remove()
774 dma_release_channel(master->dma_tx); in sun6i_spi_remove()
775 if (master->dma_rx) in sun6i_spi_remove()
776 dma_release_channel(master->dma_rx); in sun6i_spi_remove()