Lines Matching refs:ctlr

42 	struct spi_controller *ctlr;  member
301 if (!(p->ctlr->flags & SPI_CONTROLLER_MUST_TX)) in sh_msiof_spi_set_clk_regs()
365 if (spi_controller_is_slave(p->ctlr)) { in sh_msiof_spi_set_pin_regs()
372 if (p->ctlr->flags & SPI_CONTROLLER_MUST_TX) { in sh_msiof_spi_set_pin_regs()
396 if (tx_buf || (p->ctlr->flags & SPI_CONTROLLER_MUST_TX)) in sh_msiof_spi_set_mode_regs()
557 if (spi->cs_gpiod || spi_controller_is_slave(p->ctlr)) in sh_msiof_spi_setup()
582 static int sh_msiof_prepare_message(struct spi_controller *ctlr, in sh_msiof_prepare_message() argument
585 struct sh_msiof_spi_priv *p = spi_controller_get_devdata(ctlr); in sh_msiof_prepare_message()
591 ss = ctlr->unused_native_cs; in sh_msiof_prepare_message()
606 bool slave = spi_controller_is_slave(p->ctlr); in sh_msiof_spi_start()
626 bool slave = spi_controller_is_slave(p->ctlr); in sh_msiof_spi_stop()
642 static int sh_msiof_slave_abort(struct spi_controller *ctlr) in sh_msiof_slave_abort() argument
644 struct sh_msiof_spi_priv *p = spi_controller_get_devdata(ctlr); in sh_msiof_slave_abort()
655 if (spi_controller_is_slave(p->ctlr)) { in sh_msiof_wait_for_completion()
755 desc_rx = dmaengine_prep_slave_single(p->ctlr->dma_rx, in sh_msiof_dma_once()
770 dma_sync_single_for_device(p->ctlr->dma_tx->device->dev, in sh_msiof_dma_once()
772 desc_tx = dmaengine_prep_slave_single(p->ctlr->dma_tx, in sh_msiof_dma_once()
804 dma_async_issue_pending(p->ctlr->dma_rx); in sh_msiof_dma_once()
806 dma_async_issue_pending(p->ctlr->dma_tx); in sh_msiof_dma_once()
846 dma_sync_single_for_cpu(p->ctlr->dma_rx->device->dev, in sh_msiof_dma_once()
856 dmaengine_terminate_sync(p->ctlr->dma_tx); in sh_msiof_dma_once()
859 dmaengine_terminate_sync(p->ctlr->dma_rx); in sh_msiof_dma_once()
907 static int sh_msiof_transfer_one(struct spi_controller *ctlr, in sh_msiof_transfer_one() argument
911 struct sh_msiof_spi_priv *p = spi_controller_get_devdata(ctlr); in sh_msiof_transfer_one()
929 if (!spi_controller_is_slave(p->ctlr)) in sh_msiof_transfer_one()
932 while (ctlr->dma_tx && len > 15) { in sh_msiof_transfer_one()
1174 struct spi_controller *ctlr; in sh_msiof_request_dma() local
1194 ctlr = p->ctlr; in sh_msiof_request_dma()
1195 ctlr->dma_tx = sh_msiof_request_dma_chan(dev, DMA_MEM_TO_DEV, in sh_msiof_request_dma()
1197 if (!ctlr->dma_tx) in sh_msiof_request_dma()
1200 ctlr->dma_rx = sh_msiof_request_dma_chan(dev, DMA_DEV_TO_MEM, in sh_msiof_request_dma()
1202 if (!ctlr->dma_rx) in sh_msiof_request_dma()
1213 tx_dev = ctlr->dma_tx->device->dev; in sh_msiof_request_dma()
1219 rx_dev = ctlr->dma_rx->device->dev; in sh_msiof_request_dma()
1235 dma_release_channel(ctlr->dma_rx); in sh_msiof_request_dma()
1237 dma_release_channel(ctlr->dma_tx); in sh_msiof_request_dma()
1238 ctlr->dma_tx = NULL; in sh_msiof_request_dma()
1244 struct spi_controller *ctlr = p->ctlr; in sh_msiof_release_dma() local
1246 if (!ctlr->dma_tx) in sh_msiof_release_dma()
1249 dma_unmap_single(ctlr->dma_rx->device->dev, p->rx_dma_addr, PAGE_SIZE, in sh_msiof_release_dma()
1251 dma_unmap_single(ctlr->dma_tx->device->dev, p->tx_dma_addr, PAGE_SIZE, in sh_msiof_release_dma()
1255 dma_release_channel(ctlr->dma_rx); in sh_msiof_release_dma()
1256 dma_release_channel(ctlr->dma_tx); in sh_msiof_release_dma()
1261 struct spi_controller *ctlr; in sh_msiof_spi_probe() local
1283 ctlr = spi_alloc_slave(&pdev->dev, in sh_msiof_spi_probe()
1286 ctlr = spi_alloc_master(&pdev->dev, in sh_msiof_spi_probe()
1288 if (ctlr == NULL) in sh_msiof_spi_probe()
1291 p = spi_controller_get_devdata(ctlr); in sh_msiof_spi_probe()
1294 p->ctlr = ctlr; in sh_msiof_spi_probe()
1339 ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; in sh_msiof_spi_probe()
1340 ctlr->mode_bits |= SPI_LSB_FIRST | SPI_3WIRE; in sh_msiof_spi_probe()
1342 ctlr->min_speed_hz = DIV_ROUND_UP(clksrc, 1024); in sh_msiof_spi_probe()
1343 ctlr->max_speed_hz = DIV_ROUND_UP(clksrc, 1 << p->min_div_pow); in sh_msiof_spi_probe()
1344 ctlr->flags = chipdata->ctlr_flags; in sh_msiof_spi_probe()
1345 ctlr->bus_num = pdev->id; in sh_msiof_spi_probe()
1346 ctlr->num_chipselect = p->info->num_chipselect; in sh_msiof_spi_probe()
1347 ctlr->dev.of_node = pdev->dev.of_node; in sh_msiof_spi_probe()
1348 ctlr->setup = sh_msiof_spi_setup; in sh_msiof_spi_probe()
1349 ctlr->prepare_message = sh_msiof_prepare_message; in sh_msiof_spi_probe()
1350 ctlr->slave_abort = sh_msiof_slave_abort; in sh_msiof_spi_probe()
1351 ctlr->bits_per_word_mask = chipdata->bits_per_word_mask; in sh_msiof_spi_probe()
1352 ctlr->auto_runtime_pm = true; in sh_msiof_spi_probe()
1353 ctlr->transfer_one = sh_msiof_transfer_one; in sh_msiof_spi_probe()
1354 ctlr->use_gpio_descriptors = true; in sh_msiof_spi_probe()
1355 ctlr->max_native_cs = MAX_SS; in sh_msiof_spi_probe()
1361 ret = devm_spi_register_controller(&pdev->dev, ctlr); in sh_msiof_spi_probe()
1373 spi_controller_put(ctlr); in sh_msiof_spi_probe()
1397 return spi_controller_suspend(p->ctlr); in sh_msiof_spi_suspend()
1404 return spi_controller_resume(p->ctlr); in sh_msiof_spi_resume()