Lines Matching refs:master
361 for (i = 0; i < spi->master->num_chipselect; i++) { in cs_activate()
422 static bool atmel_spi_can_dma(struct spi_master *master, in atmel_spi_can_dma() argument
426 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_can_dma()
440 struct spi_master *master = platform_get_drvdata(as->pdev); in atmel_spi_dma_slave_config() local
472 if (dmaengine_slave_config(master->dma_tx, slave_config)) { in atmel_spi_dma_slave_config()
487 if (dmaengine_slave_config(master->dma_rx, slave_config)) { in atmel_spi_dma_slave_config()
496 static int atmel_spi_configure_dma(struct spi_master *master, in atmel_spi_configure_dma() argument
507 master->dma_tx = dma_request_chan(dev, "tx"); in atmel_spi_configure_dma()
508 if (IS_ERR(master->dma_tx)) { in atmel_spi_configure_dma()
509 err = dev_err_probe(dev, PTR_ERR(master->dma_tx), in atmel_spi_configure_dma()
514 master->dma_rx = dma_request_chan(dev, "rx"); in atmel_spi_configure_dma()
515 if (IS_ERR(master->dma_rx)) { in atmel_spi_configure_dma()
516 err = PTR_ERR(master->dma_rx); in atmel_spi_configure_dma()
531 dma_chan_name(master->dma_tx), in atmel_spi_configure_dma()
532 dma_chan_name(master->dma_rx)); in atmel_spi_configure_dma()
536 if (!IS_ERR(master->dma_rx)) in atmel_spi_configure_dma()
537 dma_release_channel(master->dma_rx); in atmel_spi_configure_dma()
538 if (!IS_ERR(master->dma_tx)) in atmel_spi_configure_dma()
539 dma_release_channel(master->dma_tx); in atmel_spi_configure_dma()
541 master->dma_tx = master->dma_rx = NULL; in atmel_spi_configure_dma()
545 static void atmel_spi_stop_dma(struct spi_master *master) in atmel_spi_stop_dma() argument
547 if (master->dma_rx) in atmel_spi_stop_dma()
548 dmaengine_terminate_all(master->dma_rx); in atmel_spi_stop_dma()
549 if (master->dma_tx) in atmel_spi_stop_dma()
550 dmaengine_terminate_all(master->dma_tx); in atmel_spi_stop_dma()
553 static void atmel_spi_release_dma(struct spi_master *master) in atmel_spi_release_dma() argument
555 if (master->dma_rx) { in atmel_spi_release_dma()
556 dma_release_channel(master->dma_rx); in atmel_spi_release_dma()
557 master->dma_rx = NULL; in atmel_spi_release_dma()
559 if (master->dma_tx) { in atmel_spi_release_dma()
560 dma_release_channel(master->dma_tx); in atmel_spi_release_dma()
561 master->dma_tx = NULL; in atmel_spi_release_dma()
568 struct spi_master *master = data; in dma_callback() local
569 struct atmel_spi *as = spi_master_get_devdata(master); in dma_callback()
582 static void atmel_spi_next_xfer_single(struct spi_master *master, in atmel_spi_next_xfer_single() argument
585 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_next_xfer_single()
588 dev_vdbg(master->dev.parent, "atmel_spi_next_xfer_pio\n"); in atmel_spi_next_xfer_single()
602 dev_dbg(master->dev.parent, in atmel_spi_next_xfer_single()
614 static void atmel_spi_next_xfer_fifo(struct spi_master *master, in atmel_spi_next_xfer_fifo() argument
617 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_next_xfer_fifo()
625 dev_vdbg(master->dev.parent, "atmel_spi_next_xfer_fifo\n"); in atmel_spi_next_xfer_fifo()
669 dev_dbg(master->dev.parent, in atmel_spi_next_xfer_fifo()
684 static void atmel_spi_next_xfer_pio(struct spi_master *master, in atmel_spi_next_xfer_pio() argument
687 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_next_xfer_pio()
690 atmel_spi_next_xfer_fifo(master, xfer); in atmel_spi_next_xfer_pio()
692 atmel_spi_next_xfer_single(master, xfer); in atmel_spi_next_xfer_pio()
698 static int atmel_spi_next_xfer_dma_submit(struct spi_master *master, in atmel_spi_next_xfer_dma_submit() argument
703 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_next_xfer_dma_submit()
704 struct dma_chan *rxchan = master->dma_rx; in atmel_spi_next_xfer_dma_submit()
705 struct dma_chan *txchan = master->dma_tx; in atmel_spi_next_xfer_dma_submit()
711 dev_vdbg(master->dev.parent, "atmel_spi_next_xfer_dma_submit\n"); in atmel_spi_next_xfer_dma_submit()
765 dev_dbg(master->dev.parent, in atmel_spi_next_xfer_dma_submit()
775 rxdesc->callback_param = master; in atmel_spi_next_xfer_dma_submit()
793 atmel_spi_stop_dma(master); in atmel_spi_next_xfer_dma_submit()
799 static void atmel_spi_next_xfer_data(struct spi_master *master, in atmel_spi_next_xfer_data() argument
807 if (*plen > master->max_dma_len) in atmel_spi_next_xfer_data()
808 *plen = master->max_dma_len; in atmel_spi_next_xfer_data()
863 static void atmel_spi_pdc_next_xfer(struct spi_master *master, in atmel_spi_pdc_next_xfer() argument
866 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_pdc_next_xfer()
873 atmel_spi_next_xfer_data(master, xfer, &tx_dma, &rx_dma, &len); in atmel_spi_pdc_next_xfer()
884 dev_dbg(&master->dev, in atmel_spi_pdc_next_xfer()
892 atmel_spi_next_xfer_data(master, xfer, &tx_dma, &rx_dma, &len); in atmel_spi_pdc_next_xfer()
903 dev_dbg(&master->dev, in atmel_spi_pdc_next_xfer()
963 static void atmel_spi_dma_unmap_xfer(struct spi_master *master, in atmel_spi_dma_unmap_xfer() argument
967 dma_unmap_single(master->dev.parent, xfer->tx_dma, in atmel_spi_dma_unmap_xfer()
970 dma_unmap_single(master->dev.parent, xfer->rx_dma, in atmel_spi_dma_unmap_xfer()
1060 struct spi_master *master = dev_id; in atmel_spi_pio_interrupt() local
1061 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_pio_interrupt()
1073 dev_warn(master->dev.parent, "overrun\n"); in atmel_spi_pio_interrupt()
1118 struct spi_master *master = dev_id; in atmel_spi_pdc_interrupt() local
1119 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_pdc_interrupt()
1173 struct spi_master *master = platform_get_drvdata(as->pdev); in initialize_native_cs_for_gpio() local
1178 if (!master->cs_gpiods) in initialize_native_cs_for_gpio()
1191 if (master->cs_gpiods[i]) in initialize_native_cs_for_gpio()
1207 as = spi_master_get_devdata(spi->master); in atmel_spi_setup()
1275 struct atmel_spi *as = spi_master_get_devdata(spi->master); in atmel_spi_set_cs()
1290 static int atmel_spi_one_transfer(struct spi_master *master, in atmel_spi_one_transfer() argument
1302 as = spi_master_get_devdata(master); in atmel_spi_one_transfer()
1318 if ((!master->cur_msg->is_dma_mapped) in atmel_spi_one_transfer()
1333 atmel_spi_pdc_next_xfer(master, xfer); in atmel_spi_one_transfer()
1336 ret = atmel_spi_next_xfer_dma_submit(master, in atmel_spi_one_transfer()
1349 atmel_spi_next_xfer_pio(master, xfer); in atmel_spi_one_transfer()
1368 dev_warn(master->dev.parent, in atmel_spi_one_transfer()
1384 dev_warn(master->dev.parent, in atmel_spi_one_transfer()
1393 atmel_spi_stop_dma(master); in atmel_spi_one_transfer()
1397 if (!master->cur_msg->is_dma_mapped in atmel_spi_one_transfer()
1399 atmel_spi_dma_unmap_xfer(master, xfer); in atmel_spi_one_transfer()
1464 struct spi_master *master; in atmel_spi_probe() local
1483 master = spi_alloc_master(&pdev->dev, sizeof(*as)); in atmel_spi_probe()
1484 if (!master) in atmel_spi_probe()
1488 master->use_gpio_descriptors = true; in atmel_spi_probe()
1489 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; in atmel_spi_probe()
1490 master->bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 16); in atmel_spi_probe()
1491 master->dev.of_node = pdev->dev.of_node; in atmel_spi_probe()
1492 master->bus_num = pdev->id; in atmel_spi_probe()
1493 master->num_chipselect = 4; in atmel_spi_probe()
1494 master->setup = atmel_spi_setup; in atmel_spi_probe()
1495 master->flags = (SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX | in atmel_spi_probe()
1497 master->transfer_one = atmel_spi_one_transfer; in atmel_spi_probe()
1498 master->set_cs = atmel_spi_set_cs; in atmel_spi_probe()
1499 master->cleanup = atmel_spi_cleanup; in atmel_spi_probe()
1500 master->auto_runtime_pm = true; in atmel_spi_probe()
1501 master->max_dma_len = SPI_MAX_DMA_XFER; in atmel_spi_probe()
1502 master->can_dma = atmel_spi_can_dma; in atmel_spi_probe()
1503 platform_set_drvdata(pdev, master); in atmel_spi_probe()
1505 as = spi_master_get_devdata(master); in atmel_spi_probe()
1526 ret = atmel_spi_configure_dma(master, as); in atmel_spi_probe()
1556 dev_info(master->dev.parent, in atmel_spi_probe()
1565 0, dev_name(&pdev->dev), master); in atmel_spi_probe()
1568 0, dev_name(&pdev->dev), master); in atmel_spi_probe()
1593 ret = devm_spi_register_master(&pdev->dev, master); in atmel_spi_probe()
1609 atmel_spi_release_dma(master); in atmel_spi_probe()
1616 spi_master_put(master); in atmel_spi_probe()
1622 struct spi_master *master = platform_get_drvdata(pdev); in atmel_spi_remove() local
1623 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_remove()
1629 atmel_spi_stop_dma(master); in atmel_spi_remove()
1630 atmel_spi_release_dma(master); in atmel_spi_remove()
1658 struct spi_master *master = dev_get_drvdata(dev); in atmel_spi_runtime_suspend() local
1659 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_runtime_suspend()
1669 struct spi_master *master = dev_get_drvdata(dev); in atmel_spi_runtime_resume() local
1670 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_runtime_resume()
1680 struct spi_master *master = dev_get_drvdata(dev); in atmel_spi_suspend() local
1684 ret = spi_master_suspend(master); in atmel_spi_suspend()
1696 struct spi_master *master = dev_get_drvdata(dev); in atmel_spi_resume() local
1697 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_resume()
1715 return spi_master_resume(master); in atmel_spi_resume()