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, in atmel_spi_dma_slave_config() argument
440 struct spi_master *master = platform_get_drvdata(as->pdev); in atmel_spi_dma_slave_config()
451 slave_config->dst_addr = (dma_addr_t)as->phybase + SPI_TDR; in atmel_spi_dma_slave_config()
452 slave_config->src_addr = (dma_addr_t)as->phybase + SPI_RDR; in atmel_spi_dma_slave_config()
473 dev_err(&as->pdev->dev, in atmel_spi_dma_slave_config()
488 dev_err(&as->pdev->dev, in atmel_spi_dma_slave_config()
497 struct atmel_spi *as) in atmel_spi_configure_dma() argument
500 struct device *dev = &as->pdev->dev; in atmel_spi_configure_dma()
521 err = atmel_spi_dma_slave_config(as, &slave_config, 8); in atmel_spi_configure_dma()
525 dev_info(&as->pdev->dev, in atmel_spi_configure_dma()
565 struct atmel_spi *as = spi_master_get_devdata(master); in dma_callback() local
567 if (is_vmalloc_addr(as->current_transfer->rx_buf) && in dma_callback()
569 memcpy(as->current_transfer->rx_buf, as->addr_rx_bbuf, in dma_callback()
570 as->current_transfer->len); in dma_callback()
572 complete(&as->xfer_completion); in dma_callback()
581 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_next_xfer_single() local
582 unsigned long xfer_pos = xfer->len - as->current_remaining_bytes; in atmel_spi_next_xfer_single()
587 spi_readl(as, RDR); in atmel_spi_next_xfer_single()
588 while (spi_readl(as, SR) & SPI_BIT(RDRF)) { in atmel_spi_next_xfer_single()
589 spi_readl(as, RDR); in atmel_spi_next_xfer_single()
594 spi_writel(as, TDR, *(u16 *)(xfer->tx_buf + xfer_pos)); in atmel_spi_next_xfer_single()
596 spi_writel(as, TDR, *(u8 *)(xfer->tx_buf + xfer_pos)); in atmel_spi_next_xfer_single()
604 spi_writel(as, IER, SPI_BIT(RDRF) | SPI_BIT(OVRES)); in atmel_spi_next_xfer_single()
613 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_next_xfer_fifo() local
615 u32 offset = xfer->len - as->current_remaining_bytes; in atmel_spi_next_xfer_fifo()
625 ((u32)as->current_remaining_bytes >> 1) : in atmel_spi_next_xfer_fifo()
626 (u32)as->current_remaining_bytes); in atmel_spi_next_xfer_fifo()
627 num_data = min(current_remaining_data, as->fifo_size); in atmel_spi_next_xfer_fifo()
630 spi_writel(as, CR, SPI_BIT(RXFCLR) | SPI_BIT(TXFCLR)); in atmel_spi_next_xfer_fifo()
631 while (spi_readl(as, FLR)) in atmel_spi_next_xfer_fifo()
635 fifomr = spi_readl(as, FMR); in atmel_spi_next_xfer_fifo()
636 spi_writel(as, FMR, SPI_BFINS(RXFTHRES, num_data, fifomr)); in atmel_spi_next_xfer_fifo()
639 (void)spi_readl(as, SR); in atmel_spi_next_xfer_fifo()
651 spi_writel(as, TDR, (td1 << 16) | td0); in atmel_spi_next_xfer_fifo()
661 spi_writew(as, TDR, td0); in atmel_spi_next_xfer_fifo()
674 spi_writel(as, IER, SPI_BIT(RXFTHF) | SPI_BIT(OVRES)); in atmel_spi_next_xfer_fifo()
683 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_next_xfer_pio() local
685 if (as->fifo_size) in atmel_spi_next_xfer_pio()
698 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_next_xfer_dma_submit() local
715 if (atmel_spi_dma_slave_config(as, &slave_config, in atmel_spi_next_xfer_dma_submit()
723 as->dma_addr_rx_bbuf, in atmel_spi_next_xfer_dma_submit()
741 memcpy(as->addr_tx_bbuf, xfer->tx_buf, xfer->len); in atmel_spi_next_xfer_dma_submit()
743 as->dma_addr_tx_bbuf, in atmel_spi_next_xfer_dma_submit()
764 spi_writel(as, IER, SPI_BIT(OVRES)); in atmel_spi_next_xfer_dma_submit()
783 spi_writel(as, IDR, SPI_BIT(OVRES)); in atmel_spi_next_xfer_dma_submit()
801 static int atmel_spi_set_xfer_speed(struct atmel_spi *as, in atmel_spi_set_xfer_speed() argument
810 chip_select = as->native_cs_for_gpio; in atmel_spi_set_xfer_speed()
815 bus_hz = as->spi_clk; in atmel_spi_set_xfer_speed()
816 if (!atmel_spi_is_v2(as)) in atmel_spi_set_xfer_speed()
841 csr = spi_readl(as, CSR0 + 4 * chip_select); in atmel_spi_set_xfer_speed()
843 spi_writel(as, CSR0 + 4 * chip_select, csr); in atmel_spi_set_xfer_speed()
856 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_pdc_next_xfer() local
860 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS)); in atmel_spi_pdc_next_xfer()
862 len = as->current_remaining_bytes; in atmel_spi_pdc_next_xfer()
864 as->current_remaining_bytes -= len; in atmel_spi_pdc_next_xfer()
866 spi_writel(as, RPR, rx_dma); in atmel_spi_pdc_next_xfer()
867 spi_writel(as, TPR, tx_dma); in atmel_spi_pdc_next_xfer()
871 spi_writel(as, RCR, len); in atmel_spi_pdc_next_xfer()
872 spi_writel(as, TCR, len); in atmel_spi_pdc_next_xfer()
880 if (as->current_remaining_bytes) { in atmel_spi_pdc_next_xfer()
881 len = as->current_remaining_bytes; in atmel_spi_pdc_next_xfer()
883 as->current_remaining_bytes -= len; in atmel_spi_pdc_next_xfer()
885 spi_writel(as, RNPR, rx_dma); in atmel_spi_pdc_next_xfer()
886 spi_writel(as, TNPR, tx_dma); in atmel_spi_pdc_next_xfer()
890 spi_writel(as, RNCR, len); in atmel_spi_pdc_next_xfer()
891 spi_writel(as, TNCR, len); in atmel_spi_pdc_next_xfer()
910 spi_writel(as, IER, SPI_BIT(RXBUFF) | SPI_BIT(OVRES)); in atmel_spi_pdc_next_xfer()
911 spi_writel(as, PTCR, SPI_BIT(TXTEN) | SPI_BIT(RXTEN)); in atmel_spi_pdc_next_xfer()
922 atmel_spi_dma_map_xfer(struct atmel_spi *as, struct spi_transfer *xfer) in atmel_spi_dma_map_xfer() argument
924 struct device *dev = &as->pdev->dev; in atmel_spi_dma_map_xfer()
964 static void atmel_spi_disable_pdc_transfer(struct atmel_spi *as) in atmel_spi_disable_pdc_transfer() argument
966 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS)); in atmel_spi_disable_pdc_transfer()
970 atmel_spi_pump_single_data(struct atmel_spi *as, struct spi_transfer *xfer) in atmel_spi_pump_single_data() argument
974 unsigned long xfer_pos = xfer->len - as->current_remaining_bytes; in atmel_spi_pump_single_data()
978 *rxp16 = spi_readl(as, RDR); in atmel_spi_pump_single_data()
981 *rxp = spi_readl(as, RDR); in atmel_spi_pump_single_data()
984 if (as->current_remaining_bytes > 2) in atmel_spi_pump_single_data()
985 as->current_remaining_bytes -= 2; in atmel_spi_pump_single_data()
987 as->current_remaining_bytes = 0; in atmel_spi_pump_single_data()
989 as->current_remaining_bytes--; in atmel_spi_pump_single_data()
994 atmel_spi_pump_fifo_data(struct atmel_spi *as, struct spi_transfer *xfer) in atmel_spi_pump_fifo_data() argument
996 u32 fifolr = spi_readl(as, FLR); in atmel_spi_pump_fifo_data()
998 u32 offset = xfer->len - as->current_remaining_bytes; in atmel_spi_pump_fifo_data()
1008 if (as->current_remaining_bytes > num_bytes) in atmel_spi_pump_fifo_data()
1009 as->current_remaining_bytes -= num_bytes; in atmel_spi_pump_fifo_data()
1011 as->current_remaining_bytes = 0; in atmel_spi_pump_fifo_data()
1015 as->current_remaining_bytes &= ~0x1; in atmel_spi_pump_fifo_data()
1019 rd = spi_readl(as, RDR); in atmel_spi_pump_fifo_data()
1034 atmel_spi_pump_pio_data(struct atmel_spi *as, struct spi_transfer *xfer) in atmel_spi_pump_pio_data() argument
1036 if (as->fifo_size) in atmel_spi_pump_pio_data()
1037 atmel_spi_pump_fifo_data(as, xfer); in atmel_spi_pump_pio_data()
1039 atmel_spi_pump_single_data(as, xfer); in atmel_spi_pump_pio_data()
1049 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_pio_interrupt() local
1054 imr = spi_readl(as, IMR); in atmel_spi_pio_interrupt()
1055 status = spi_readl(as, SR); in atmel_spi_pio_interrupt()
1060 spi_writel(as, IDR, SPI_BIT(OVRES)); in atmel_spi_pio_interrupt()
1072 as->done_status = -EIO; in atmel_spi_pio_interrupt()
1076 spi_readl(as, SR); in atmel_spi_pio_interrupt()
1078 complete(&as->xfer_completion); in atmel_spi_pio_interrupt()
1081 atmel_spi_lock(as); in atmel_spi_pio_interrupt()
1083 if (as->current_remaining_bytes) { in atmel_spi_pio_interrupt()
1085 xfer = as->current_transfer; in atmel_spi_pio_interrupt()
1086 atmel_spi_pump_pio_data(as, xfer); in atmel_spi_pio_interrupt()
1087 if (!as->current_remaining_bytes) in atmel_spi_pio_interrupt()
1088 spi_writel(as, IDR, pending); in atmel_spi_pio_interrupt()
1090 complete(&as->xfer_completion); in atmel_spi_pio_interrupt()
1093 atmel_spi_unlock(as); in atmel_spi_pio_interrupt()
1097 spi_writel(as, IDR, pending); in atmel_spi_pio_interrupt()
1107 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_pdc_interrupt() local
1111 imr = spi_readl(as, IMR); in atmel_spi_pdc_interrupt()
1112 status = spi_readl(as, SR); in atmel_spi_pdc_interrupt()
1119 spi_writel(as, IDR, (SPI_BIT(RXBUFF) | SPI_BIT(ENDRX) in atmel_spi_pdc_interrupt()
1123 spi_readl(as, SR); in atmel_spi_pdc_interrupt()
1125 as->done_status = -EIO; in atmel_spi_pdc_interrupt()
1127 complete(&as->xfer_completion); in atmel_spi_pdc_interrupt()
1132 spi_writel(as, IDR, pending); in atmel_spi_pdc_interrupt()
1134 complete(&as->xfer_completion); in atmel_spi_pdc_interrupt()
1140 static int atmel_word_delay_csr(struct spi_device *spi, struct atmel_spi *as) in atmel_word_delay_csr() argument
1155 return (as->spi_clk / 1000000 * value) >> 5; in atmel_word_delay_csr()
1158 static void initialize_native_cs_for_gpio(struct atmel_spi *as) in initialize_native_cs_for_gpio() argument
1161 struct spi_master *master = platform_get_drvdata(as->pdev); in initialize_native_cs_for_gpio()
1163 if (!as->native_cs_free) in initialize_native_cs_for_gpio()
1173 if (atmel_spi_is_v2(as)) in initialize_native_cs_for_gpio()
1180 as->native_cs_free |= BIT(i); in initialize_native_cs_for_gpio()
1182 if (as->native_cs_free) in initialize_native_cs_for_gpio()
1183 as->native_cs_for_gpio = ffs(as->native_cs_free); in initialize_native_cs_for_gpio()
1188 struct atmel_spi *as; in atmel_spi_setup() local
1195 as = spi_master_get_devdata(spi->master); in atmel_spi_setup()
1208 initialize_native_cs_for_gpio(as); in atmel_spi_setup()
1210 if (spi->cs_gpiod && as->native_cs_free) { in atmel_spi_setup()
1217 chip_select = as->native_cs_for_gpio; in atmel_spi_setup()
1231 word_delay_csr = atmel_word_delay_csr(spi, as); in atmel_spi_setup()
1255 if (!atmel_spi_is_v2(as)) in atmel_spi_setup()
1256 spi_writel(as, CSR0 + 4 * chip_select, csr); in atmel_spi_setup()
1263 struct atmel_spi *as = spi_master_get_devdata(spi->master); in atmel_spi_set_cs() local
1271 cs_activate(as, spi); in atmel_spi_set_cs()
1273 cs_deactivate(as, spi); in atmel_spi_set_cs()
1282 struct atmel_spi *as; in atmel_spi_one_transfer() local
1290 as = spi_master_get_devdata(master); in atmel_spi_one_transfer()
1305 && as->use_pdc) { in atmel_spi_one_transfer()
1306 if (atmel_spi_dma_map_xfer(as, xfer) < 0) in atmel_spi_one_transfer()
1310 atmel_spi_set_xfer_speed(as, spi, xfer); in atmel_spi_one_transfer()
1312 as->done_status = 0; in atmel_spi_one_transfer()
1313 as->current_transfer = xfer; in atmel_spi_one_transfer()
1314 as->current_remaining_bytes = xfer->len; in atmel_spi_one_transfer()
1315 while (as->current_remaining_bytes) { in atmel_spi_one_transfer()
1316 reinit_completion(&as->xfer_completion); in atmel_spi_one_transfer()
1318 if (as->use_pdc) { in atmel_spi_one_transfer()
1319 atmel_spi_lock(as); in atmel_spi_one_transfer()
1321 atmel_spi_unlock(as); in atmel_spi_one_transfer()
1322 } else if (atmel_spi_use_dma(as, xfer)) { in atmel_spi_one_transfer()
1323 len = as->current_remaining_bytes; in atmel_spi_one_transfer()
1329 as->done_status = ret; in atmel_spi_one_transfer()
1332 as->current_remaining_bytes -= len; in atmel_spi_one_transfer()
1333 if (as->current_remaining_bytes < 0) in atmel_spi_one_transfer()
1334 as->current_remaining_bytes = 0; in atmel_spi_one_transfer()
1337 atmel_spi_lock(as); in atmel_spi_one_transfer()
1339 atmel_spi_unlock(as); in atmel_spi_one_transfer()
1342 dma_timeout = wait_for_completion_timeout(&as->xfer_completion, in atmel_spi_one_transfer()
1346 as->done_status = -EIO; in atmel_spi_one_transfer()
1349 if (as->done_status) in atmel_spi_one_transfer()
1353 if (as->done_status) { in atmel_spi_one_transfer()
1354 if (as->use_pdc) { in atmel_spi_one_transfer()
1357 spi_readl(as, TCR), spi_readl(as, RCR)); in atmel_spi_one_transfer()
1363 spi_writel(as, RNCR, 0); in atmel_spi_one_transfer()
1364 spi_writel(as, TNCR, 0); in atmel_spi_one_transfer()
1365 spi_writel(as, RCR, 0); in atmel_spi_one_transfer()
1366 spi_writel(as, TCR, 0); in atmel_spi_one_transfer()
1368 if (spi_readl(as, SR) & SPI_BIT(TXEMPTY)) in atmel_spi_one_transfer()
1373 while (spi_readl(as, SR) & SPI_BIT(RDRF)) in atmel_spi_one_transfer()
1374 spi_readl(as, RDR); in atmel_spi_one_transfer()
1377 spi_readl(as, SR); in atmel_spi_one_transfer()
1379 } else if (atmel_spi_use_dma(as, xfer)) { in atmel_spi_one_transfer()
1385 && as->use_pdc) in atmel_spi_one_transfer()
1388 if (as->use_pdc) in atmel_spi_one_transfer()
1389 atmel_spi_disable_pdc_transfer(as); in atmel_spi_one_transfer()
1391 return as->done_status; in atmel_spi_one_transfer()
1405 static inline unsigned int atmel_get_version(struct atmel_spi *as) in atmel_get_version() argument
1407 return spi_readl(as, VERSION) & 0x00000fff; in atmel_get_version()
1410 static void atmel_get_caps(struct atmel_spi *as) in atmel_get_caps() argument
1414 version = atmel_get_version(as); in atmel_get_caps()
1416 as->caps.is_spi2 = version > 0x121; in atmel_get_caps()
1417 as->caps.has_wdrbt = version >= 0x210; in atmel_get_caps()
1418 as->caps.has_dma_support = version >= 0x212; in atmel_get_caps()
1419 as->caps.has_pdc_support = version < 0x212; in atmel_get_caps()
1422 static void atmel_spi_init(struct atmel_spi *as) in atmel_spi_init() argument
1424 spi_writel(as, CR, SPI_BIT(SWRST)); in atmel_spi_init()
1425 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ in atmel_spi_init()
1428 if (as->fifo_size) in atmel_spi_init()
1429 spi_writel(as, CR, SPI_BIT(FIFOEN)); in atmel_spi_init()
1431 if (as->caps.has_wdrbt) { in atmel_spi_init()
1432 spi_writel(as, MR, SPI_BIT(WDRBT) | SPI_BIT(MODFDIS) in atmel_spi_init()
1435 spi_writel(as, MR, SPI_BIT(MSTR) | SPI_BIT(MODFDIS)); in atmel_spi_init()
1438 if (as->use_pdc) in atmel_spi_init()
1439 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS)); in atmel_spi_init()
1440 spi_writel(as, CR, SPI_BIT(SPIEN)); in atmel_spi_init()
1450 struct atmel_spi *as; in atmel_spi_probe() local
1468 master = spi_alloc_master(&pdev->dev, sizeof(*as)); in atmel_spi_probe()
1490 as = spi_master_get_devdata(master); in atmel_spi_probe()
1492 spin_lock_init(&as->lock); in atmel_spi_probe()
1494 as->pdev = pdev; in atmel_spi_probe()
1495 as->regs = devm_ioremap_resource(&pdev->dev, regs); in atmel_spi_probe()
1496 if (IS_ERR(as->regs)) { in atmel_spi_probe()
1497 ret = PTR_ERR(as->regs); in atmel_spi_probe()
1500 as->phybase = regs->start; in atmel_spi_probe()
1501 as->irq = irq; in atmel_spi_probe()
1502 as->clk = clk; in atmel_spi_probe()
1504 init_completion(&as->xfer_completion); in atmel_spi_probe()
1506 atmel_get_caps(as); in atmel_spi_probe()
1508 as->use_dma = false; in atmel_spi_probe()
1509 as->use_pdc = false; in atmel_spi_probe()
1510 if (as->caps.has_dma_support) { in atmel_spi_probe()
1511 ret = atmel_spi_configure_dma(master, as); in atmel_spi_probe()
1513 as->use_dma = true; in atmel_spi_probe()
1517 } else if (as->caps.has_pdc_support) { in atmel_spi_probe()
1518 as->use_pdc = true; in atmel_spi_probe()
1522 as->addr_rx_bbuf = dma_alloc_coherent(&pdev->dev, in atmel_spi_probe()
1524 &as->dma_addr_rx_bbuf, in atmel_spi_probe()
1526 if (!as->addr_rx_bbuf) { in atmel_spi_probe()
1527 as->use_dma = false; in atmel_spi_probe()
1529 as->addr_tx_bbuf = dma_alloc_coherent(&pdev->dev, in atmel_spi_probe()
1531 &as->dma_addr_tx_bbuf, in atmel_spi_probe()
1533 if (!as->addr_tx_bbuf) { in atmel_spi_probe()
1534 as->use_dma = false; in atmel_spi_probe()
1536 as->addr_rx_bbuf, in atmel_spi_probe()
1537 as->dma_addr_rx_bbuf); in atmel_spi_probe()
1540 if (!as->use_dma) in atmel_spi_probe()
1545 if (as->caps.has_dma_support && !as->use_dma) in atmel_spi_probe()
1548 if (as->use_pdc) { in atmel_spi_probe()
1563 as->spi_clk = clk_get_rate(clk); in atmel_spi_probe()
1565 as->fifo_size = 0; in atmel_spi_probe()
1567 &as->fifo_size)) { in atmel_spi_probe()
1568 dev_info(&pdev->dev, "Using FIFO (%u data)\n", as->fifo_size); in atmel_spi_probe()
1571 atmel_spi_init(as); in atmel_spi_probe()
1584 atmel_get_version(as), (unsigned long)regs->start, in atmel_spi_probe()
1593 if (as->use_dma) in atmel_spi_probe()
1596 spi_writel(as, CR, SPI_BIT(SWRST)); in atmel_spi_probe()
1597 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ in atmel_spi_probe()
1608 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_remove() local
1613 if (as->use_dma) { in atmel_spi_remove()
1618 as->addr_tx_bbuf, in atmel_spi_remove()
1619 as->dma_addr_tx_bbuf); in atmel_spi_remove()
1621 as->addr_rx_bbuf, in atmel_spi_remove()
1622 as->dma_addr_rx_bbuf); in atmel_spi_remove()
1626 spin_lock_irq(&as->lock); in atmel_spi_remove()
1627 spi_writel(as, CR, SPI_BIT(SWRST)); in atmel_spi_remove()
1628 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ in atmel_spi_remove()
1629 spi_readl(as, SR); in atmel_spi_remove()
1630 spin_unlock_irq(&as->lock); in atmel_spi_remove()
1632 clk_disable_unprepare(as->clk); in atmel_spi_remove()
1644 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_runtime_suspend() local
1646 clk_disable_unprepare(as->clk); in atmel_spi_runtime_suspend()
1655 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_runtime_resume() local
1659 return clk_prepare_enable(as->clk); in atmel_spi_runtime_resume()
1682 struct atmel_spi *as = spi_master_get_devdata(master); in atmel_spi_resume() local
1685 ret = clk_prepare_enable(as->clk); in atmel_spi_resume()
1689 atmel_spi_init(as); in atmel_spi_resume()
1691 clk_disable_unprepare(as->clk); in atmel_spi_resume()