Lines Matching refs:ctlr
106 struct spi_controller *ctlr = data; in dma_callback() local
107 struct at91_usart_spi *aus = spi_master_get_devdata(ctlr); in dma_callback()
123 static int at91_usart_spi_configure_dma(struct spi_controller *ctlr, in at91_usart_spi_configure_dma() argument
135 ctlr->dma_tx = dma_request_chan(dev, "tx"); in at91_usart_spi_configure_dma()
136 if (IS_ERR_OR_NULL(ctlr->dma_tx)) { in at91_usart_spi_configure_dma()
137 if (IS_ERR(ctlr->dma_tx)) { in at91_usart_spi_configure_dma()
138 err = PTR_ERR(ctlr->dma_tx); in at91_usart_spi_configure_dma()
148 ctlr->dma_rx = dma_request_chan(dev, "rx"); in at91_usart_spi_configure_dma()
149 if (IS_ERR_OR_NULL(ctlr->dma_rx)) { in at91_usart_spi_configure_dma()
150 if (IS_ERR(ctlr->dma_rx)) { in at91_usart_spi_configure_dma()
151 err = PTR_ERR(ctlr->dma_rx); in at91_usart_spi_configure_dma()
170 if (dmaengine_slave_config(ctlr->dma_rx, &slave_config)) { in at91_usart_spi_configure_dma()
171 dev_err(&ctlr->dev, in at91_usart_spi_configure_dma()
178 if (dmaengine_slave_config(ctlr->dma_tx, &slave_config)) { in at91_usart_spi_configure_dma()
179 dev_err(&ctlr->dev, in at91_usart_spi_configure_dma()
189 if (!IS_ERR_OR_NULL(ctlr->dma_tx)) in at91_usart_spi_configure_dma()
190 dma_release_channel(ctlr->dma_tx); in at91_usart_spi_configure_dma()
191 if (!IS_ERR_OR_NULL(ctlr->dma_rx)) in at91_usart_spi_configure_dma()
192 dma_release_channel(ctlr->dma_rx); in at91_usart_spi_configure_dma()
193 ctlr->dma_tx = NULL; in at91_usart_spi_configure_dma()
194 ctlr->dma_rx = NULL; in at91_usart_spi_configure_dma()
200 static void at91_usart_spi_release_dma(struct spi_controller *ctlr) in at91_usart_spi_release_dma() argument
202 if (ctlr->dma_rx) in at91_usart_spi_release_dma()
203 dma_release_channel(ctlr->dma_rx); in at91_usart_spi_release_dma()
204 if (ctlr->dma_tx) in at91_usart_spi_release_dma()
205 dma_release_channel(ctlr->dma_tx); in at91_usart_spi_release_dma()
208 static void at91_usart_spi_stop_dma(struct spi_controller *ctlr) in at91_usart_spi_stop_dma() argument
210 if (ctlr->dma_rx) in at91_usart_spi_stop_dma()
211 dmaengine_terminate_all(ctlr->dma_rx); in at91_usart_spi_stop_dma()
212 if (ctlr->dma_tx) in at91_usart_spi_stop_dma()
213 dmaengine_terminate_all(ctlr->dma_tx); in at91_usart_spi_stop_dma()
216 static int at91_usart_spi_dma_transfer(struct spi_controller *ctlr, in at91_usart_spi_dma_transfer() argument
219 struct at91_usart_spi *aus = spi_master_get_devdata(ctlr); in at91_usart_spi_dma_transfer()
220 struct dma_chan *rxchan = ctlr->dma_rx; in at91_usart_spi_dma_transfer()
221 struct dma_chan *txchan = ctlr->dma_tx; in at91_usart_spi_dma_transfer()
248 rxdesc->callback_param = ctlr; in at91_usart_spi_dma_transfer()
266 at91_usart_spi_stop_dma(ctlr); in at91_usart_spi_dma_transfer()
398 static int at91_usart_spi_transfer_one(struct spi_controller *ctlr, in at91_usart_spi_transfer_one() argument
402 struct at91_usart_spi *aus = spi_master_get_devdata(ctlr); in at91_usart_spi_transfer_one()
415 if (at91_usart_spi_can_dma(ctlr, spi, xfer) && in at91_usart_spi_transfer_one()
417 ret = at91_usart_spi_dma_transfer(ctlr, xfer); in at91_usart_spi_transfer_one()
444 static int at91_usart_spi_prepare_message(struct spi_controller *ctlr, in at91_usart_spi_prepare_message() argument
447 struct at91_usart_spi *aus = spi_master_get_devdata(ctlr); in at91_usart_spi_prepare_message()
458 static int at91_usart_spi_unprepare_message(struct spi_controller *ctlr, in at91_usart_spi_unprepare_message() argument
461 struct at91_usart_spi *aus = spi_master_get_devdata(ctlr); in at91_usart_spi_unprepare_message()
599 struct spi_controller *ctlr = dev_get_drvdata(dev); in at91_usart_spi_runtime_suspend() local
600 struct at91_usart_spi *aus = spi_master_get_devdata(ctlr); in at91_usart_spi_runtime_suspend()
652 struct spi_controller *ctlr = platform_get_drvdata(pdev); in at91_usart_spi_remove() local
653 struct at91_usart_spi *aus = spi_master_get_devdata(ctlr); in at91_usart_spi_remove()
655 at91_usart_spi_release_dma(ctlr); in at91_usart_spi_remove()