aus               107 drivers/spi/spi-at91-usart.c 	struct at91_usart_spi   *aus = spi_master_get_devdata(ctlr);
aus               109 drivers/spi/spi-at91-usart.c 	at91_usart_spi_writel(aus, IER, US_IR_RXRDY);
aus               110 drivers/spi/spi-at91-usart.c 	aus->current_rx_remaining_bytes = 0;
aus               111 drivers/spi/spi-at91-usart.c 	complete(&aus->xfer_completion);
aus               118 drivers/spi/spi-at91-usart.c 	struct at91_usart_spi *aus = spi_master_get_devdata(ctrl);
aus               120 drivers/spi/spi-at91-usart.c 	return aus->use_dma && xfer->len >= US_DMA_MIN_BYTES;
aus               124 drivers/spi/spi-at91-usart.c 					struct at91_usart_spi *aus)
aus               127 drivers/spi/spi-at91-usart.c 	struct device *dev = &aus->mpdev->dev;
aus               128 drivers/spi/spi-at91-usart.c 	phys_addr_t phybase = aus->phybase;
aus               185 drivers/spi/spi-at91-usart.c 	aus->use_dma = true;
aus               219 drivers/spi/spi-at91-usart.c 	struct at91_usart_spi *aus = spi_master_get_devdata(ctlr);
aus               227 drivers/spi/spi-at91-usart.c 	at91_usart_spi_writel(aus, IDR, US_IR_RXRDY);
aus               265 drivers/spi/spi-at91-usart.c 	at91_usart_spi_writel(aus, IER, US_IR_RXRDY);
aus               271 drivers/spi/spi-at91-usart.c static unsigned long at91_usart_spi_dma_timeout(struct at91_usart_spi *aus)
aus               273 drivers/spi/spi-at91-usart.c 	return wait_for_completion_timeout(&aus->xfer_completion,
aus               277 drivers/spi/spi-at91-usart.c static inline u32 at91_usart_spi_tx_ready(struct at91_usart_spi *aus)
aus               279 drivers/spi/spi-at91-usart.c 	return aus->status & US_IR_TXRDY;
aus               282 drivers/spi/spi-at91-usart.c static inline u32 at91_usart_spi_rx_ready(struct at91_usart_spi *aus)
aus               284 drivers/spi/spi-at91-usart.c 	return aus->status & US_IR_RXRDY;
aus               287 drivers/spi/spi-at91-usart.c static inline u32 at91_usart_spi_check_overrun(struct at91_usart_spi *aus)
aus               289 drivers/spi/spi-at91-usart.c 	return aus->status & US_IR_OVRE;
aus               292 drivers/spi/spi-at91-usart.c static inline u32 at91_usart_spi_read_status(struct at91_usart_spi *aus)
aus               294 drivers/spi/spi-at91-usart.c 	aus->status = at91_usart_spi_readl(aus, CSR);
aus               295 drivers/spi/spi-at91-usart.c 	return aus->status;
aus               298 drivers/spi/spi-at91-usart.c static inline void at91_usart_spi_tx(struct at91_usart_spi *aus)
aus               300 drivers/spi/spi-at91-usart.c 	unsigned int len = aus->current_transfer->len;
aus               301 drivers/spi/spi-at91-usart.c 	unsigned int remaining = aus->current_tx_remaining_bytes;
aus               302 drivers/spi/spi-at91-usart.c 	const u8  *tx_buf = aus->current_transfer->tx_buf;
aus               307 drivers/spi/spi-at91-usart.c 	if (at91_usart_spi_tx_ready(aus)) {
aus               308 drivers/spi/spi-at91-usart.c 		at91_usart_spi_writeb(aus, THR, tx_buf[len - remaining]);
aus               309 drivers/spi/spi-at91-usart.c 		aus->current_tx_remaining_bytes--;
aus               313 drivers/spi/spi-at91-usart.c static inline void at91_usart_spi_rx(struct at91_usart_spi *aus)
aus               315 drivers/spi/spi-at91-usart.c 	int len = aus->current_transfer->len;
aus               316 drivers/spi/spi-at91-usart.c 	int remaining = aus->current_rx_remaining_bytes;
aus               317 drivers/spi/spi-at91-usart.c 	u8  *rx_buf = aus->current_transfer->rx_buf;
aus               322 drivers/spi/spi-at91-usart.c 	rx_buf[len - remaining] = at91_usart_spi_readb(aus, RHR);
aus               323 drivers/spi/spi-at91-usart.c 	aus->current_rx_remaining_bytes--;
aus               327 drivers/spi/spi-at91-usart.c at91_usart_spi_set_xfer_speed(struct at91_usart_spi *aus,
aus               330 drivers/spi/spi-at91-usart.c 	at91_usart_spi_writel(aus, BRGR,
aus               331 drivers/spi/spi-at91-usart.c 			      DIV_ROUND_UP(aus->spi_clk, xfer->speed_hz));
aus               337 drivers/spi/spi-at91-usart.c 	struct at91_usart_spi *aus = spi_master_get_devdata(controller);
aus               339 drivers/spi/spi-at91-usart.c 	spin_lock(&aus->lock);
aus               340 drivers/spi/spi-at91-usart.c 	at91_usart_spi_read_status(aus);
aus               342 drivers/spi/spi-at91-usart.c 	if (at91_usart_spi_check_overrun(aus)) {
aus               343 drivers/spi/spi-at91-usart.c 		aus->xfer_failed = true;
aus               344 drivers/spi/spi-at91-usart.c 		at91_usart_spi_writel(aus, IDR, US_IR_OVRE | US_IR_RXRDY);
aus               345 drivers/spi/spi-at91-usart.c 		spin_unlock(&aus->lock);
aus               349 drivers/spi/spi-at91-usart.c 	if (at91_usart_spi_rx_ready(aus)) {
aus               350 drivers/spi/spi-at91-usart.c 		at91_usart_spi_rx(aus);
aus               351 drivers/spi/spi-at91-usart.c 		spin_unlock(&aus->lock);
aus               355 drivers/spi/spi-at91-usart.c 	spin_unlock(&aus->lock);
aus               362 drivers/spi/spi-at91-usart.c 	struct at91_usart_spi *aus = spi_master_get_devdata(spi->controller);
aus               364 drivers/spi/spi-at91-usart.c 	unsigned int mr = at91_usart_spi_readl(aus, MR);
aus               402 drivers/spi/spi-at91-usart.c 	struct at91_usart_spi *aus = spi_master_get_devdata(ctlr);
aus               406 drivers/spi/spi-at91-usart.c 	at91_usart_spi_set_xfer_speed(aus, xfer);
aus               407 drivers/spi/spi-at91-usart.c 	aus->xfer_failed = false;
aus               408 drivers/spi/spi-at91-usart.c 	aus->current_transfer = xfer;
aus               409 drivers/spi/spi-at91-usart.c 	aus->current_tx_remaining_bytes = xfer->len;
aus               410 drivers/spi/spi-at91-usart.c 	aus->current_rx_remaining_bytes = xfer->len;
aus               412 drivers/spi/spi-at91-usart.c 	while ((aus->current_tx_remaining_bytes ||
aus               413 drivers/spi/spi-at91-usart.c 		aus->current_rx_remaining_bytes) && !aus->xfer_failed) {
aus               414 drivers/spi/spi-at91-usart.c 		reinit_completion(&aus->xfer_completion);
aus               421 drivers/spi/spi-at91-usart.c 			dma_timeout = at91_usart_spi_dma_timeout(aus);
aus               427 drivers/spi/spi-at91-usart.c 			aus->current_tx_remaining_bytes = 0;
aus               429 drivers/spi/spi-at91-usart.c 			at91_usart_spi_read_status(aus);
aus               430 drivers/spi/spi-at91-usart.c 			at91_usart_spi_tx(aus);
aus               436 drivers/spi/spi-at91-usart.c 	if (aus->xfer_failed) {
aus               437 drivers/spi/spi-at91-usart.c 		dev_err(aus->dev, "Overrun!\n");
aus               447 drivers/spi/spi-at91-usart.c 	struct at91_usart_spi *aus = spi_master_get_devdata(ctlr);
aus               451 drivers/spi/spi-at91-usart.c 	at91_usart_spi_writel(aus, CR, US_ENABLE);
aus               452 drivers/spi/spi-at91-usart.c 	at91_usart_spi_writel(aus, IER, US_OVRE_RXRDY_IRQS);
aus               453 drivers/spi/spi-at91-usart.c 	at91_usart_spi_writel(aus, MR, *ausd);
aus               461 drivers/spi/spi-at91-usart.c 	struct at91_usart_spi *aus = spi_master_get_devdata(ctlr);
aus               463 drivers/spi/spi-at91-usart.c 	at91_usart_spi_writel(aus, CR, US_RESET | US_DISABLE);
aus               464 drivers/spi/spi-at91-usart.c 	at91_usart_spi_writel(aus, IDR, US_OVRE_RXRDY_IRQS);
aus               477 drivers/spi/spi-at91-usart.c static void at91_usart_spi_init(struct at91_usart_spi *aus)
aus               479 drivers/spi/spi-at91-usart.c 	at91_usart_spi_writel(aus, MR, US_INIT);
aus               480 drivers/spi/spi-at91-usart.c 	at91_usart_spi_writel(aus, CR, US_RESET | US_DISABLE);
aus               516 drivers/spi/spi-at91-usart.c 	struct at91_usart_spi *aus;
aus               535 drivers/spi/spi-at91-usart.c 	controller = spi_alloc_master(&pdev->dev, sizeof(*aus));
aus               559 drivers/spi/spi-at91-usart.c 	aus = spi_master_get_devdata(controller);
aus               561 drivers/spi/spi-at91-usart.c 	aus->dev = &pdev->dev;
aus               562 drivers/spi/spi-at91-usart.c 	aus->regs = devm_ioremap_resource(&pdev->dev, regs);
aus               563 drivers/spi/spi-at91-usart.c 	if (IS_ERR(aus->regs)) {
aus               564 drivers/spi/spi-at91-usart.c 		ret = PTR_ERR(aus->regs);
aus               568 drivers/spi/spi-at91-usart.c 	aus->irq = irq;
aus               569 drivers/spi/spi-at91-usart.c 	aus->clk = clk;
aus               580 drivers/spi/spi-at91-usart.c 	aus->spi_clk = clk_get_rate(clk);
aus               581 drivers/spi/spi-at91-usart.c 	at91_usart_spi_init(aus);
aus               583 drivers/spi/spi-at91-usart.c 	aus->phybase = regs->start;
aus               585 drivers/spi/spi-at91-usart.c 	aus->mpdev = to_platform_device(pdev->dev.parent);
aus               587 drivers/spi/spi-at91-usart.c 	ret = at91_usart_spi_configure_dma(controller, aus);
aus               591 drivers/spi/spi-at91-usart.c 	spin_lock_init(&aus->lock);
aus               592 drivers/spi/spi-at91-usart.c 	init_completion(&aus->xfer_completion);
aus               600 drivers/spi/spi-at91-usart.c 		 at91_usart_spi_readl(aus, VERSION),
aus               617 drivers/spi/spi-at91-usart.c 	struct at91_usart_spi *aus = spi_master_get_devdata(ctlr);
aus               619 drivers/spi/spi-at91-usart.c 	clk_disable_unprepare(aus->clk);
aus               628 drivers/spi/spi-at91-usart.c 	struct at91_usart_spi *aus = spi_master_get_devdata(ctrl);
aus               632 drivers/spi/spi-at91-usart.c 	return clk_prepare_enable(aus->clk);
aus               653 drivers/spi/spi-at91-usart.c 	struct at91_usart_spi *aus = spi_master_get_devdata(ctrl);
aus               662 drivers/spi/spi-at91-usart.c 	at91_usart_spi_init(aus);
aus               670 drivers/spi/spi-at91-usart.c 	struct at91_usart_spi *aus = spi_master_get_devdata(ctlr);
aus               673 drivers/spi/spi-at91-usart.c 	clk_disable_unprepare(aus->clk);