Lines Matching refs:as

301 static bool atmel_spi_is_v2(struct atmel_spi *as)  in atmel_spi_is_v2()  argument
303 return as->caps.is_spi2; in atmel_spi_is_v2()
324 static void cs_activate(struct atmel_spi *as, struct spi_device *spi) in cs_activate() argument
331 chip_select = as->native_cs_for_gpio; in cs_activate()
335 if (atmel_spi_is_v2(as)) { in cs_activate()
336 spi_writel(as, CSR0 + 4 * chip_select, asd->csr); in cs_activate()
340 spi_writel(as, CSR0, asd->csr); in cs_activate()
341 if (as->caps.has_wdrbt) { in cs_activate()
342 spi_writel(as, MR, in cs_activate()
348 spi_writel(as, MR, in cs_activate()
354 mr = spi_readl(as, MR); in cs_activate()
362 csr = spi_readl(as, CSR0 + 4 * i); in cs_activate()
364 spi_writel(as, CSR0 + 4 * i, in cs_activate()
368 mr = spi_readl(as, MR); in cs_activate()
370 spi_writel(as, MR, mr); in cs_activate()
376 static void cs_deactivate(struct atmel_spi *as, struct spi_device *spi) in cs_deactivate() argument
382 chip_select = as->native_cs_for_gpio; in cs_deactivate()
389 mr = spi_readl(as, MR); in cs_deactivate()
392 spi_writel(as, MR, mr); in cs_deactivate()
398 spi_writel(as, CR, SPI_BIT(LASTXFER)); in cs_deactivate()
401 static void atmel_spi_lock(struct atmel_spi *as) __acquires(&as->lock) in atmel_spi_lock() argument
403 spin_lock_irqsave(&as->lock, as->flags); in atmel_spi_lock()
406 static void atmel_spi_unlock(struct atmel_spi *as) __releases(&as->lock) in atmel_spi_unlock() argument
408 spin_unlock_irqrestore(&as->lock, as->flags); in atmel_spi_unlock()
416 static inline bool atmel_spi_use_dma(struct atmel_spi *as, in atmel_spi_use_dma() argument
419 return as->use_dma && xfer->len >= DMA_MIN_BYTES; in atmel_spi_use_dma()
426 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_can_dma() local
429 return atmel_spi_use_dma(as, xfer) && in atmel_spi_can_dma()
432 return atmel_spi_use_dma(as, xfer); in atmel_spi_can_dma()
436 static int atmel_spi_dma_slave_config(struct atmel_spi *as, u8 bits_per_word) in atmel_spi_dma_slave_config() argument
438 struct spi_master *master = platform_get_drvdata(as->pdev); in atmel_spi_dma_slave_config()
450 slave_config.dst_addr = (dma_addr_t)as->phybase + SPI_TDR; in atmel_spi_dma_slave_config()
451 slave_config.src_addr = (dma_addr_t)as->phybase + SPI_RDR; in atmel_spi_dma_slave_config()
471 dev_err(&as->pdev->dev, in atmel_spi_dma_slave_config()
485 dev_err(&as->pdev->dev, in atmel_spi_dma_slave_config()
494 struct atmel_spi *as) in atmel_spi_configure_dma() argument
496 struct device *dev = &as->pdev->dev; in atmel_spi_configure_dma()
517 err = atmel_spi_dma_slave_config(as, 8); in atmel_spi_configure_dma()
521 dev_info(&as->pdev->dev, in atmel_spi_configure_dma()
561 struct atmel_spi *as = spi_master_get_devdata(master); in dma_callback() local
563 if (is_vmalloc_addr(as->current_transfer->rx_buf) && in dma_callback()
565 memcpy(as->current_transfer->rx_buf, as->addr_rx_bbuf, in dma_callback()
566 as->current_transfer->len); in dma_callback()
568 complete(&as->xfer_completion); in dma_callback()
577 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_next_xfer_single() local
578 unsigned long xfer_pos = xfer->len - as->current_remaining_bytes; in atmel_spi_next_xfer_single()
583 spi_readl(as, RDR); in atmel_spi_next_xfer_single()
584 while (spi_readl(as, SR) & SPI_BIT(RDRF)) { in atmel_spi_next_xfer_single()
585 spi_readl(as, RDR); in atmel_spi_next_xfer_single()
590 spi_writel(as, TDR, *(u16 *)(xfer->tx_buf + xfer_pos)); in atmel_spi_next_xfer_single()
592 spi_writel(as, TDR, *(u8 *)(xfer->tx_buf + xfer_pos)); in atmel_spi_next_xfer_single()
600 spi_writel(as, IER, SPI_BIT(RDRF) | SPI_BIT(OVRES)); in atmel_spi_next_xfer_single()
609 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_next_xfer_fifo() local
611 u32 offset = xfer->len - as->current_remaining_bytes; in atmel_spi_next_xfer_fifo()
621 ((u32)as->current_remaining_bytes >> 1) : in atmel_spi_next_xfer_fifo()
622 (u32)as->current_remaining_bytes); in atmel_spi_next_xfer_fifo()
623 num_data = min(current_remaining_data, as->fifo_size); in atmel_spi_next_xfer_fifo()
626 spi_writel(as, CR, SPI_BIT(RXFCLR) | SPI_BIT(TXFCLR)); in atmel_spi_next_xfer_fifo()
627 while (spi_readl(as, FLR)) in atmel_spi_next_xfer_fifo()
631 fifomr = spi_readl(as, FMR); in atmel_spi_next_xfer_fifo()
632 spi_writel(as, FMR, SPI_BFINS(RXFTHRES, num_data, fifomr)); in atmel_spi_next_xfer_fifo()
635 (void)spi_readl(as, SR); in atmel_spi_next_xfer_fifo()
647 spi_writel(as, TDR, (td1 << 16) | td0); in atmel_spi_next_xfer_fifo()
657 spi_writew(as, TDR, td0); in atmel_spi_next_xfer_fifo()
670 spi_writel(as, IER, SPI_BIT(RXFTHF) | SPI_BIT(OVRES)); in atmel_spi_next_xfer_fifo()
679 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_next_xfer_pio() local
681 if (as->fifo_size) in atmel_spi_next_xfer_pio()
694 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_next_xfer_dma_submit() local
710 if (atmel_spi_dma_slave_config(as, xfer->bits_per_word)) in atmel_spi_next_xfer_dma_submit()
717 as->dma_addr_rx_bbuf, in atmel_spi_next_xfer_dma_submit()
735 memcpy(as->addr_tx_bbuf, xfer->tx_buf, xfer->len); in atmel_spi_next_xfer_dma_submit()
737 as->dma_addr_tx_bbuf, in atmel_spi_next_xfer_dma_submit()
758 spi_writel(as, IER, SPI_BIT(OVRES)); in atmel_spi_next_xfer_dma_submit()
777 spi_writel(as, IDR, SPI_BIT(OVRES)); in atmel_spi_next_xfer_dma_submit()
795 static int atmel_spi_set_xfer_speed(struct atmel_spi *as, in atmel_spi_set_xfer_speed() argument
804 chip_select = as->native_cs_for_gpio; in atmel_spi_set_xfer_speed()
809 bus_hz = as->spi_clk; in atmel_spi_set_xfer_speed()
810 if (!atmel_spi_is_v2(as)) in atmel_spi_set_xfer_speed()
835 csr = spi_readl(as, CSR0 + 4 * chip_select); in atmel_spi_set_xfer_speed()
837 spi_writel(as, CSR0 + 4 * chip_select, csr); in atmel_spi_set_xfer_speed()
850 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_pdc_next_xfer() local
854 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS)); in atmel_spi_pdc_next_xfer()
856 len = as->current_remaining_bytes; in atmel_spi_pdc_next_xfer()
858 as->current_remaining_bytes -= len; in atmel_spi_pdc_next_xfer()
860 spi_writel(as, RPR, rx_dma); in atmel_spi_pdc_next_xfer()
861 spi_writel(as, TPR, tx_dma); in atmel_spi_pdc_next_xfer()
865 spi_writel(as, RCR, len); in atmel_spi_pdc_next_xfer()
866 spi_writel(as, TCR, len); in atmel_spi_pdc_next_xfer()
874 if (as->current_remaining_bytes) { in atmel_spi_pdc_next_xfer()
875 len = as->current_remaining_bytes; in atmel_spi_pdc_next_xfer()
877 as->current_remaining_bytes -= len; in atmel_spi_pdc_next_xfer()
879 spi_writel(as, RNPR, rx_dma); in atmel_spi_pdc_next_xfer()
880 spi_writel(as, TNPR, tx_dma); in atmel_spi_pdc_next_xfer()
884 spi_writel(as, RNCR, len); in atmel_spi_pdc_next_xfer()
885 spi_writel(as, TNCR, len); in atmel_spi_pdc_next_xfer()
904 spi_writel(as, IER, SPI_BIT(RXBUFF) | SPI_BIT(OVRES)); in atmel_spi_pdc_next_xfer()
905 spi_writel(as, PTCR, SPI_BIT(TXTEN) | SPI_BIT(RXTEN)); in atmel_spi_pdc_next_xfer()
916 atmel_spi_dma_map_xfer(struct atmel_spi *as, struct spi_transfer *xfer) in atmel_spi_dma_map_xfer() argument
918 struct device *dev = &as->pdev->dev; in atmel_spi_dma_map_xfer()
958 static void atmel_spi_disable_pdc_transfer(struct atmel_spi *as) in atmel_spi_disable_pdc_transfer() argument
960 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS)); in atmel_spi_disable_pdc_transfer()
964 atmel_spi_pump_single_data(struct atmel_spi *as, struct spi_transfer *xfer) in atmel_spi_pump_single_data() argument
968 unsigned long xfer_pos = xfer->len - as->current_remaining_bytes; in atmel_spi_pump_single_data()
972 *rxp16 = spi_readl(as, RDR); in atmel_spi_pump_single_data()
975 *rxp = spi_readl(as, RDR); in atmel_spi_pump_single_data()
978 if (as->current_remaining_bytes > 2) in atmel_spi_pump_single_data()
979 as->current_remaining_bytes -= 2; in atmel_spi_pump_single_data()
981 as->current_remaining_bytes = 0; in atmel_spi_pump_single_data()
983 as->current_remaining_bytes--; in atmel_spi_pump_single_data()
988 atmel_spi_pump_fifo_data(struct atmel_spi *as, struct spi_transfer *xfer) in atmel_spi_pump_fifo_data() argument
990 u32 fifolr = spi_readl(as, FLR); in atmel_spi_pump_fifo_data()
992 u32 offset = xfer->len - as->current_remaining_bytes; in atmel_spi_pump_fifo_data()
1002 if (as->current_remaining_bytes > num_bytes) in atmel_spi_pump_fifo_data()
1003 as->current_remaining_bytes -= num_bytes; in atmel_spi_pump_fifo_data()
1005 as->current_remaining_bytes = 0; in atmel_spi_pump_fifo_data()
1009 as->current_remaining_bytes &= ~0x1; in atmel_spi_pump_fifo_data()
1013 rd = spi_readl(as, RDR); in atmel_spi_pump_fifo_data()
1028 atmel_spi_pump_pio_data(struct atmel_spi *as, struct spi_transfer *xfer) in atmel_spi_pump_pio_data() argument
1030 if (as->fifo_size) in atmel_spi_pump_pio_data()
1031 atmel_spi_pump_fifo_data(as, xfer); in atmel_spi_pump_pio_data()
1033 atmel_spi_pump_single_data(as, xfer); in atmel_spi_pump_pio_data()
1043 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_pio_interrupt() local
1048 imr = spi_readl(as, IMR); in atmel_spi_pio_interrupt()
1049 status = spi_readl(as, SR); in atmel_spi_pio_interrupt()
1054 spi_writel(as, IDR, SPI_BIT(OVRES)); in atmel_spi_pio_interrupt()
1066 as->done_status = -EIO; in atmel_spi_pio_interrupt()
1070 spi_readl(as, SR); in atmel_spi_pio_interrupt()
1072 complete(&as->xfer_completion); in atmel_spi_pio_interrupt()
1075 atmel_spi_lock(as); in atmel_spi_pio_interrupt()
1077 if (as->current_remaining_bytes) { in atmel_spi_pio_interrupt()
1079 xfer = as->current_transfer; in atmel_spi_pio_interrupt()
1080 atmel_spi_pump_pio_data(as, xfer); in atmel_spi_pio_interrupt()
1081 if (!as->current_remaining_bytes) in atmel_spi_pio_interrupt()
1082 spi_writel(as, IDR, pending); in atmel_spi_pio_interrupt()
1084 complete(&as->xfer_completion); in atmel_spi_pio_interrupt()
1087 atmel_spi_unlock(as); in atmel_spi_pio_interrupt()
1091 spi_writel(as, IDR, pending); in atmel_spi_pio_interrupt()
1101 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_pdc_interrupt() local
1105 imr = spi_readl(as, IMR); in atmel_spi_pdc_interrupt()
1106 status = spi_readl(as, SR); in atmel_spi_pdc_interrupt()
1113 spi_writel(as, IDR, (SPI_BIT(RXBUFF) | SPI_BIT(ENDRX) in atmel_spi_pdc_interrupt()
1117 spi_readl(as, SR); in atmel_spi_pdc_interrupt()
1119 as->done_status = -EIO; in atmel_spi_pdc_interrupt()
1121 complete(&as->xfer_completion); in atmel_spi_pdc_interrupt()
1126 spi_writel(as, IDR, pending); in atmel_spi_pdc_interrupt()
1128 complete(&as->xfer_completion); in atmel_spi_pdc_interrupt()
1134 static int atmel_word_delay_csr(struct spi_device *spi, struct atmel_spi *as) in atmel_word_delay_csr() argument
1149 return (as->spi_clk / 1000000 * value) >> 5; in atmel_word_delay_csr()
1152 static void initialize_native_cs_for_gpio(struct atmel_spi *as) in initialize_native_cs_for_gpio() argument
1155 struct spi_master *master = platform_get_drvdata(as->pdev); in initialize_native_cs_for_gpio()
1157 if (!as->native_cs_free) in initialize_native_cs_for_gpio()
1167 if (atmel_spi_is_v2(as)) in initialize_native_cs_for_gpio()
1174 as->native_cs_free |= BIT(i); in initialize_native_cs_for_gpio()
1176 if (as->native_cs_free) in initialize_native_cs_for_gpio()
1177 as->native_cs_for_gpio = ffs(as->native_cs_free); in initialize_native_cs_for_gpio()
1182 struct atmel_spi *as; in atmel_spi_setup() local
1189 as = spi_master_get_devdata(spi->master); in atmel_spi_setup()
1202 initialize_native_cs_for_gpio(as); in atmel_spi_setup()
1204 if (spi->cs_gpiod && as->native_cs_free) { in atmel_spi_setup()
1211 chip_select = as->native_cs_for_gpio; in atmel_spi_setup()
1225 word_delay_csr = atmel_word_delay_csr(spi, as); in atmel_spi_setup()
1249 if (!atmel_spi_is_v2(as)) in atmel_spi_setup()
1250 spi_writel(as, CSR0 + 4 * chip_select, csr); in atmel_spi_setup()
1257 struct atmel_spi *as = spi_master_get_devdata(spi->master); in atmel_spi_set_cs() local
1265 cs_activate(as, spi); in atmel_spi_set_cs()
1267 cs_deactivate(as, spi); in atmel_spi_set_cs()
1276 struct atmel_spi *as; in atmel_spi_one_transfer() local
1284 as = spi_master_get_devdata(master); in atmel_spi_one_transfer()
1299 && as->use_pdc) { in atmel_spi_one_transfer()
1300 if (atmel_spi_dma_map_xfer(as, xfer) < 0) in atmel_spi_one_transfer()
1304 atmel_spi_set_xfer_speed(as, spi, xfer); in atmel_spi_one_transfer()
1306 as->done_status = 0; in atmel_spi_one_transfer()
1307 as->current_transfer = xfer; in atmel_spi_one_transfer()
1308 as->current_remaining_bytes = xfer->len; in atmel_spi_one_transfer()
1309 while (as->current_remaining_bytes) { in atmel_spi_one_transfer()
1310 reinit_completion(&as->xfer_completion); in atmel_spi_one_transfer()
1312 if (as->use_pdc) { in atmel_spi_one_transfer()
1313 atmel_spi_lock(as); in atmel_spi_one_transfer()
1315 atmel_spi_unlock(as); in atmel_spi_one_transfer()
1316 } else if (atmel_spi_use_dma(as, xfer)) { in atmel_spi_one_transfer()
1317 len = as->current_remaining_bytes; in atmel_spi_one_transfer()
1323 as->done_status = ret; in atmel_spi_one_transfer()
1326 as->current_remaining_bytes -= len; in atmel_spi_one_transfer()
1327 if (as->current_remaining_bytes < 0) in atmel_spi_one_transfer()
1328 as->current_remaining_bytes = 0; in atmel_spi_one_transfer()
1331 atmel_spi_lock(as); in atmel_spi_one_transfer()
1333 atmel_spi_unlock(as); in atmel_spi_one_transfer()
1336 dma_timeout = wait_for_completion_timeout(&as->xfer_completion, in atmel_spi_one_transfer()
1340 as->done_status = -EIO; in atmel_spi_one_transfer()
1343 if (as->done_status) in atmel_spi_one_transfer()
1347 if (as->done_status) { in atmel_spi_one_transfer()
1348 if (as->use_pdc) { in atmel_spi_one_transfer()
1351 spi_readl(as, TCR), spi_readl(as, RCR)); in atmel_spi_one_transfer()
1357 spi_writel(as, RNCR, 0); in atmel_spi_one_transfer()
1358 spi_writel(as, TNCR, 0); in atmel_spi_one_transfer()
1359 spi_writel(as, RCR, 0); in atmel_spi_one_transfer()
1360 spi_writel(as, TCR, 0); in atmel_spi_one_transfer()
1362 if (spi_readl(as, SR) & SPI_BIT(TXEMPTY)) in atmel_spi_one_transfer()
1367 while (spi_readl(as, SR) & SPI_BIT(RDRF)) in atmel_spi_one_transfer()
1368 spi_readl(as, RDR); in atmel_spi_one_transfer()
1371 spi_readl(as, SR); in atmel_spi_one_transfer()
1373 } else if (atmel_spi_use_dma(as, xfer)) { in atmel_spi_one_transfer()
1379 && as->use_pdc) in atmel_spi_one_transfer()
1382 if (as->use_pdc) in atmel_spi_one_transfer()
1383 atmel_spi_disable_pdc_transfer(as); in atmel_spi_one_transfer()
1385 return as->done_status; in atmel_spi_one_transfer()
1399 static inline unsigned int atmel_get_version(struct atmel_spi *as) in atmel_get_version() argument
1401 return spi_readl(as, VERSION) & 0x00000fff; in atmel_get_version()
1404 static void atmel_get_caps(struct atmel_spi *as) in atmel_get_caps() argument
1408 version = atmel_get_version(as); in atmel_get_caps()
1410 as->caps.is_spi2 = version > 0x121; in atmel_get_caps()
1411 as->caps.has_wdrbt = version >= 0x210; in atmel_get_caps()
1412 as->caps.has_dma_support = version >= 0x212; in atmel_get_caps()
1413 as->caps.has_pdc_support = version < 0x212; in atmel_get_caps()
1416 static void atmel_spi_init(struct atmel_spi *as) in atmel_spi_init() argument
1418 spi_writel(as, CR, SPI_BIT(SWRST)); in atmel_spi_init()
1419 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ in atmel_spi_init()
1422 if (as->fifo_size) in atmel_spi_init()
1423 spi_writel(as, CR, SPI_BIT(FIFOEN)); in atmel_spi_init()
1425 if (as->caps.has_wdrbt) { in atmel_spi_init()
1426 spi_writel(as, MR, SPI_BIT(WDRBT) | SPI_BIT(MODFDIS) in atmel_spi_init()
1429 spi_writel(as, MR, SPI_BIT(MSTR) | SPI_BIT(MODFDIS)); in atmel_spi_init()
1432 if (as->use_pdc) in atmel_spi_init()
1433 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS)); in atmel_spi_init()
1434 spi_writel(as, CR, SPI_BIT(SPIEN)); in atmel_spi_init()
1444 struct atmel_spi *as; in atmel_spi_probe() local
1462 master = spi_alloc_master(&pdev->dev, sizeof(*as)); in atmel_spi_probe()
1484 as = spi_master_get_devdata(master); in atmel_spi_probe()
1486 spin_lock_init(&as->lock); in atmel_spi_probe()
1488 as->pdev = pdev; in atmel_spi_probe()
1489 as->regs = devm_ioremap_resource(&pdev->dev, regs); in atmel_spi_probe()
1490 if (IS_ERR(as->regs)) { in atmel_spi_probe()
1491 ret = PTR_ERR(as->regs); in atmel_spi_probe()
1494 as->phybase = regs->start; in atmel_spi_probe()
1495 as->irq = irq; in atmel_spi_probe()
1496 as->clk = clk; in atmel_spi_probe()
1498 init_completion(&as->xfer_completion); in atmel_spi_probe()
1500 atmel_get_caps(as); in atmel_spi_probe()
1502 as->use_dma = false; in atmel_spi_probe()
1503 as->use_pdc = false; in atmel_spi_probe()
1504 if (as->caps.has_dma_support) { in atmel_spi_probe()
1505 ret = atmel_spi_configure_dma(master, as); in atmel_spi_probe()
1507 as->use_dma = true; in atmel_spi_probe()
1511 } else if (as->caps.has_pdc_support) { in atmel_spi_probe()
1512 as->use_pdc = true; in atmel_spi_probe()
1516 as->addr_rx_bbuf = dma_alloc_coherent(&pdev->dev, in atmel_spi_probe()
1518 &as->dma_addr_rx_bbuf, in atmel_spi_probe()
1520 if (!as->addr_rx_bbuf) { in atmel_spi_probe()
1521 as->use_dma = false; in atmel_spi_probe()
1523 as->addr_tx_bbuf = dma_alloc_coherent(&pdev->dev, in atmel_spi_probe()
1525 &as->dma_addr_tx_bbuf, in atmel_spi_probe()
1527 if (!as->addr_tx_bbuf) { in atmel_spi_probe()
1528 as->use_dma = false; in atmel_spi_probe()
1530 as->addr_rx_bbuf, in atmel_spi_probe()
1531 as->dma_addr_rx_bbuf); in atmel_spi_probe()
1534 if (!as->use_dma) in atmel_spi_probe()
1539 if (as->caps.has_dma_support && !as->use_dma) in atmel_spi_probe()
1542 if (as->use_pdc) { in atmel_spi_probe()
1557 as->spi_clk = clk_get_rate(clk); in atmel_spi_probe()
1559 as->fifo_size = 0; in atmel_spi_probe()
1561 &as->fifo_size)) { in atmel_spi_probe()
1562 dev_info(&pdev->dev, "Using FIFO (%u data)\n", as->fifo_size); in atmel_spi_probe()
1565 atmel_spi_init(as); in atmel_spi_probe()
1578 atmel_get_version(as), (unsigned long)regs->start, in atmel_spi_probe()
1587 if (as->use_dma) in atmel_spi_probe()
1590 spi_writel(as, CR, SPI_BIT(SWRST)); in atmel_spi_probe()
1591 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ in atmel_spi_probe()
1602 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_remove() local
1607 if (as->use_dma) { in atmel_spi_remove()
1612 as->addr_tx_bbuf, in atmel_spi_remove()
1613 as->dma_addr_tx_bbuf); in atmel_spi_remove()
1615 as->addr_rx_bbuf, in atmel_spi_remove()
1616 as->dma_addr_rx_bbuf); in atmel_spi_remove()
1620 spin_lock_irq(&as->lock); in atmel_spi_remove()
1621 spi_writel(as, CR, SPI_BIT(SWRST)); in atmel_spi_remove()
1622 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ in atmel_spi_remove()
1623 spi_readl(as, SR); in atmel_spi_remove()
1624 spin_unlock_irq(&as->lock); in atmel_spi_remove()
1626 clk_disable_unprepare(as->clk); in atmel_spi_remove()
1637 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_runtime_suspend() local
1639 clk_disable_unprepare(as->clk); in atmel_spi_runtime_suspend()
1648 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_runtime_resume() local
1652 return clk_prepare_enable(as->clk); in atmel_spi_runtime_resume()
1674 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_resume() local
1677 ret = clk_prepare_enable(as->clk); in atmel_spi_resume()
1681 atmel_spi_init(as); in atmel_spi_resume()
1683 clk_disable_unprepare(as->clk); in atmel_spi_resume()