2 * Driver for Atmel AT32 and AT91 SPI Controllers
4 * Copyright (C) 2006 Atmel Corporation
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/clk.h>
14 #include <linux/module.h>
15 #include <linux/platform_device.h>
16 #include <linux/delay.h>
17 #include <linux/dma-mapping.h>
18 #include <linux/err.h>
19 #include <linux/interrupt.h>
20 #include <linux/spi/spi.h>
23 #include <mach/board.h>
24 #include <mach/gpio.h>
27 #include "atmel_spi.h"
30 * The core SPI transfer engine just talks to a register bank to set up
31 * DMA transfers; transfer queue progress is driven by IRQs. The clock
32 * framework provides the base clock, subdivided for each spi_device.
40 struct platform_device *pdev;
41 struct spi_device *stay;
44 struct list_head queue;
45 struct spi_transfer *current_transfer;
46 unsigned long current_remaining_bytes;
47 struct spi_transfer *next_transfer;
48 unsigned long next_remaining_bytes;
51 dma_addr_t buffer_dma;
54 #define BUFFER_SIZE PAGE_SIZE
55 #define INVALID_DMA_ADDRESS 0xffffffff
58 * Version 2 of the SPI controller has
60 * - SPI_MR.DIV32 may become FDIV or must-be-zero (here: always zero)
61 * - SPI_SR.TXEMPTY, SPI_SR.NSSR (and corresponding irqs)
63 * - SPI_CSRx.SBCR allows faster clocking
65 * We can determine the controller version by reading the VERSION
66 * register, but I haven't checked that it exists on all chips, and
67 * this is cheaper anyway.
69 static bool atmel_spi_is_v2(void)
71 return !cpu_is_at91rm9200();
75 * Earlier SPI controllers (e.g. on at91rm9200) have a design bug whereby
76 * they assume that spi slave device state will not change on deselect, so
77 * that automagic deselection is OK. ("NPCSx rises if no data is to be
78 * transmitted") Not so! Workaround uses nCSx pins as GPIOs; or newer
79 * controllers have CSAAT and friends.
81 * Since the CSAAT functionality is a bit weird on newer controllers as
82 * well, we use GPIO to control nCSx pins on all controllers, updating
83 * MR.PCS to avoid confusing the controller. Using GPIOs also lets us
84 * support active-high chipselects despite the controller's belief that
85 * only active-low devices/systems exists.
87 * However, at91rm9200 has a second erratum whereby nCS0 doesn't work
88 * right when driven with GPIO. ("Mode Fault does not allow more than one
89 * Master on Chip Select 0.") No workaround exists for that ... so for
90 * nCS0 on that chip, we (a) don't use the GPIO, (b) can't support CS_HIGH,
91 * and (c) will trigger that first erratum in some cases.
94 static void cs_activate(struct atmel_spi *as, struct spi_device *spi)
96 unsigned gpio = (unsigned) spi->controller_data;
97 unsigned active = spi->mode & SPI_CS_HIGH;
101 u32 cpol = (spi->mode & SPI_CPOL) ? SPI_BIT(CPOL) : 0;
103 /* Make sure clock polarity is correct */
104 for (i = 0; i < spi->master->num_chipselect; i++) {
105 csr = spi_readl(as, CSR0 + 4 * i);
106 if ((csr ^ cpol) & SPI_BIT(CPOL))
107 spi_writel(as, CSR0 + 4 * i, csr ^ SPI_BIT(CPOL));
110 mr = spi_readl(as, MR);
111 mr = SPI_BFINS(PCS, ~(1 << spi->chip_select), mr);
113 dev_dbg(&spi->dev, "activate %u%s, mr %08x\n",
114 gpio, active ? " (high)" : "",
117 if (atmel_spi_is_v2() || spi->chip_select != 0)
118 gpio_set_value(gpio, active);
119 spi_writel(as, MR, mr);
122 static void cs_deactivate(struct atmel_spi *as, struct spi_device *spi)
124 unsigned gpio = (unsigned) spi->controller_data;
125 unsigned active = spi->mode & SPI_CS_HIGH;
128 /* only deactivate *this* device; sometimes transfers to
129 * another device may be active when this routine is called.
131 mr = spi_readl(as, MR);
132 if (~SPI_BFEXT(PCS, mr) & (1 << spi->chip_select)) {
133 mr = SPI_BFINS(PCS, 0xf, mr);
134 spi_writel(as, MR, mr);
137 dev_dbg(&spi->dev, "DEactivate %u%s, mr %08x\n",
138 gpio, active ? " (low)" : "",
141 if (atmel_spi_is_v2() || spi->chip_select != 0)
142 gpio_set_value(gpio, !active);
145 static inline int atmel_spi_xfer_is_last(struct spi_message *msg,
146 struct spi_transfer *xfer)
148 return msg->transfers.prev == &xfer->transfer_list;
151 static inline int atmel_spi_xfer_can_be_chained(struct spi_transfer *xfer)
153 return xfer->delay_usecs == 0 && !xfer->cs_change;
156 static void atmel_spi_next_xfer_data(struct spi_master *master,
157 struct spi_transfer *xfer,
162 struct atmel_spi *as = spi_master_get_devdata(master);
165 /* use scratch buffer only when rx or tx data is unspecified */
167 *rx_dma = xfer->rx_dma + xfer->len - len;
169 *rx_dma = as->buffer_dma;
170 if (len > BUFFER_SIZE)
174 *tx_dma = xfer->tx_dma + xfer->len - len;
176 *tx_dma = as->buffer_dma;
177 if (len > BUFFER_SIZE)
179 memset(as->buffer, 0, len);
180 dma_sync_single_for_device(&as->pdev->dev,
181 as->buffer_dma, len, DMA_TO_DEVICE);
188 * Submit next transfer for DMA.
189 * lock is held, spi irq is blocked
191 static void atmel_spi_next_xfer(struct spi_master *master,
192 struct spi_message *msg)
194 struct atmel_spi *as = spi_master_get_devdata(master);
195 struct spi_transfer *xfer;
198 dma_addr_t tx_dma, rx_dma;
200 if (!as->current_transfer)
201 xfer = list_entry(msg->transfers.next,
202 struct spi_transfer, transfer_list);
203 else if (!as->next_transfer)
204 xfer = list_entry(as->current_transfer->transfer_list.next,
205 struct spi_transfer, transfer_list);
210 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS));
213 atmel_spi_next_xfer_data(master, xfer, &tx_dma, &rx_dma, &len);
214 remaining = xfer->len - len;
216 spi_writel(as, RPR, rx_dma);
217 spi_writel(as, TPR, tx_dma);
219 if (msg->spi->bits_per_word > 8)
221 spi_writel(as, RCR, len);
222 spi_writel(as, TCR, len);
224 dev_dbg(&msg->spi->dev,
225 " start xfer %p: len %u tx %p/%08x rx %p/%08x\n",
226 xfer, xfer->len, xfer->tx_buf, xfer->tx_dma,
227 xfer->rx_buf, xfer->rx_dma);
229 xfer = as->next_transfer;
230 remaining = as->next_remaining_bytes;
233 as->current_transfer = xfer;
234 as->current_remaining_bytes = remaining;
238 else if (!atmel_spi_xfer_is_last(msg, xfer)
239 && atmel_spi_xfer_can_be_chained(xfer)) {
240 xfer = list_entry(xfer->transfer_list.next,
241 struct spi_transfer, transfer_list);
246 as->next_transfer = xfer;
252 atmel_spi_next_xfer_data(master, xfer, &tx_dma, &rx_dma, &len);
253 as->next_remaining_bytes = total - len;
255 spi_writel(as, RNPR, rx_dma);
256 spi_writel(as, TNPR, tx_dma);
258 if (msg->spi->bits_per_word > 8)
260 spi_writel(as, RNCR, len);
261 spi_writel(as, TNCR, len);
263 dev_dbg(&msg->spi->dev,
264 " next xfer %p: len %u tx %p/%08x rx %p/%08x\n",
265 xfer, xfer->len, xfer->tx_buf, xfer->tx_dma,
266 xfer->rx_buf, xfer->rx_dma);
267 ieval = SPI_BIT(ENDRX) | SPI_BIT(OVRES);
269 spi_writel(as, RNCR, 0);
270 spi_writel(as, TNCR, 0);
271 ieval = SPI_BIT(RXBUFF) | SPI_BIT(ENDRX) | SPI_BIT(OVRES);
274 /* REVISIT: We're waiting for ENDRX before we start the next
275 * transfer because we need to handle some difficult timing
276 * issues otherwise. If we wait for ENDTX in one transfer and
277 * then starts waiting for ENDRX in the next, it's difficult
278 * to tell the difference between the ENDRX interrupt we're
279 * actually waiting for and the ENDRX interrupt of the
282 * It should be doable, though. Just not now...
284 spi_writel(as, IER, ieval);
285 spi_writel(as, PTCR, SPI_BIT(TXTEN) | SPI_BIT(RXTEN));
288 static void atmel_spi_next_message(struct spi_master *master)
290 struct atmel_spi *as = spi_master_get_devdata(master);
291 struct spi_message *msg;
292 struct spi_device *spi;
294 BUG_ON(as->current_transfer);
296 msg = list_entry(as->queue.next, struct spi_message, queue);
299 dev_dbg(master->dev.parent, "start message %p for %s\n",
300 msg, spi->dev.bus_id);
302 /* select chip if it's not still active */
304 if (as->stay != spi) {
305 cs_deactivate(as, as->stay);
306 cs_activate(as, spi);
310 cs_activate(as, spi);
312 atmel_spi_next_xfer(master, msg);
316 * For DMA, tx_buf/tx_dma have the same relationship as rx_buf/rx_dma:
317 * - The buffer is either valid for CPU access, else NULL
318 * - If the buffer is valid, so is its DMA addresss
320 * This driver manages the dma addresss unless message->is_dma_mapped.
323 atmel_spi_dma_map_xfer(struct atmel_spi *as, struct spi_transfer *xfer)
325 struct device *dev = &as->pdev->dev;
327 xfer->tx_dma = xfer->rx_dma = INVALID_DMA_ADDRESS;
329 xfer->tx_dma = dma_map_single(dev,
330 (void *) xfer->tx_buf, xfer->len,
332 if (dma_mapping_error(dev, xfer->tx_dma))
336 xfer->rx_dma = dma_map_single(dev,
337 xfer->rx_buf, xfer->len,
339 if (dma_mapping_error(dev, xfer->rx_dma)) {
341 dma_unmap_single(dev,
342 xfer->tx_dma, xfer->len,
350 static void atmel_spi_dma_unmap_xfer(struct spi_master *master,
351 struct spi_transfer *xfer)
353 if (xfer->tx_dma != INVALID_DMA_ADDRESS)
354 dma_unmap_single(master->dev.parent, xfer->tx_dma,
355 xfer->len, DMA_TO_DEVICE);
356 if (xfer->rx_dma != INVALID_DMA_ADDRESS)
357 dma_unmap_single(master->dev.parent, xfer->rx_dma,
358 xfer->len, DMA_FROM_DEVICE);
362 atmel_spi_msg_done(struct spi_master *master, struct atmel_spi *as,
363 struct spi_message *msg, int status, int stay)
365 if (!stay || status < 0)
366 cs_deactivate(as, msg->spi);
370 list_del(&msg->queue);
371 msg->status = status;
373 dev_dbg(master->dev.parent,
374 "xfer complete: %u bytes transferred\n",
377 spin_unlock(&as->lock);
378 msg->complete(msg->context);
379 spin_lock(&as->lock);
381 as->current_transfer = NULL;
382 as->next_transfer = NULL;
384 /* continue if needed */
385 if (list_empty(&as->queue) || as->stopping)
386 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS));
388 atmel_spi_next_message(master);
392 atmel_spi_interrupt(int irq, void *dev_id)
394 struct spi_master *master = dev_id;
395 struct atmel_spi *as = spi_master_get_devdata(master);
396 struct spi_message *msg;
397 struct spi_transfer *xfer;
398 u32 status, pending, imr;
401 spin_lock(&as->lock);
403 xfer = as->current_transfer;
404 msg = list_entry(as->queue.next, struct spi_message, queue);
406 imr = spi_readl(as, IMR);
407 status = spi_readl(as, SR);
408 pending = status & imr;
410 if (pending & SPI_BIT(OVRES)) {
415 spi_writel(as, IDR, (SPI_BIT(RXBUFF) | SPI_BIT(ENDRX)
419 * When we get an overrun, we disregard the current
420 * transfer. Data will not be copied back from any
421 * bounce buffer and msg->actual_len will not be
422 * updated with the last xfer.
424 * We will also not process any remaning transfers in
427 * First, stop the transfer and unmap the DMA buffers.
429 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS));
430 if (!msg->is_dma_mapped)
431 atmel_spi_dma_unmap_xfer(master, xfer);
433 /* REVISIT: udelay in irq is unfriendly */
434 if (xfer->delay_usecs)
435 udelay(xfer->delay_usecs);
437 dev_warn(master->dev.parent, "overrun (%u/%u remaining)\n",
438 spi_readl(as, TCR), spi_readl(as, RCR));
441 * Clean up DMA registers and make sure the data
442 * registers are empty.
444 spi_writel(as, RNCR, 0);
445 spi_writel(as, TNCR, 0);
446 spi_writel(as, RCR, 0);
447 spi_writel(as, TCR, 0);
448 for (timeout = 1000; timeout; timeout--)
449 if (spi_readl(as, SR) & SPI_BIT(TXEMPTY))
452 dev_warn(master->dev.parent,
453 "timeout waiting for TXEMPTY");
454 while (spi_readl(as, SR) & SPI_BIT(RDRF))
457 /* Clear any overrun happening while cleaning up */
460 atmel_spi_msg_done(master, as, msg, -EIO, 0);
461 } else if (pending & (SPI_BIT(RXBUFF) | SPI_BIT(ENDRX))) {
464 spi_writel(as, IDR, pending);
466 if (as->current_remaining_bytes == 0) {
467 msg->actual_length += xfer->len;
469 if (!msg->is_dma_mapped)
470 atmel_spi_dma_unmap_xfer(master, xfer);
472 /* REVISIT: udelay in irq is unfriendly */
473 if (xfer->delay_usecs)
474 udelay(xfer->delay_usecs);
476 if (atmel_spi_xfer_is_last(msg, xfer)) {
477 /* report completed message */
478 atmel_spi_msg_done(master, as, msg, 0,
481 if (xfer->cs_change) {
482 cs_deactivate(as, msg->spi);
484 cs_activate(as, msg->spi);
488 * Not done yet. Submit the next transfer.
490 * FIXME handle protocol options for xfer
492 atmel_spi_next_xfer(master, msg);
496 * Keep going, we still have data to send in
497 * the current transfer.
499 atmel_spi_next_xfer(master, msg);
503 spin_unlock(&as->lock);
508 /* the spi->mode bits understood by this driver: */
509 #define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH)
511 static int atmel_spi_setup(struct spi_device *spi)
513 struct atmel_spi *as;
515 unsigned int bits = spi->bits_per_word;
516 unsigned long bus_hz;
517 unsigned int npcs_pin;
520 as = spi_master_get_devdata(spi->master);
525 if (spi->chip_select > spi->master->num_chipselect) {
527 "setup: invalid chipselect %u (%u defined)\n",
528 spi->chip_select, spi->master->num_chipselect);
534 if (bits < 8 || bits > 16) {
536 "setup: invalid bits_per_word %u (8 to 16)\n",
541 if (spi->mode & ~MODEBITS) {
542 dev_dbg(&spi->dev, "setup: unsupported mode bits %x\n",
543 spi->mode & ~MODEBITS);
547 /* see notes above re chipselect */
548 if (!atmel_spi_is_v2()
549 && spi->chip_select == 0
550 && (spi->mode & SPI_CS_HIGH)) {
551 dev_dbg(&spi->dev, "setup: can't be active-high\n");
555 /* v1 chips start out at half the peripheral bus speed. */
556 bus_hz = clk_get_rate(as->clk);
557 if (!atmel_spi_is_v2())
560 if (spi->max_speed_hz) {
562 * Calculate the lowest divider that satisfies the
563 * constraint, assuming div32/fdiv/mbz == 0.
565 scbr = DIV_ROUND_UP(bus_hz, spi->max_speed_hz);
568 * If the resulting divider doesn't fit into the
569 * register bitfield, we can't satisfy the constraint.
571 if (scbr >= (1 << SPI_SCBR_SIZE)) {
573 "setup: %d Hz too slow, scbr %u; min %ld Hz\n",
574 spi->max_speed_hz, scbr, bus_hz/255);
578 /* speed zero means "as slow as possible" */
581 csr = SPI_BF(SCBR, scbr) | SPI_BF(BITS, bits - 8);
582 if (spi->mode & SPI_CPOL)
583 csr |= SPI_BIT(CPOL);
584 if (!(spi->mode & SPI_CPHA))
585 csr |= SPI_BIT(NCPHA);
587 /* DLYBS is mostly irrelevant since we manage chipselect using GPIOs.
589 * DLYBCT would add delays between words, slowing down transfers.
590 * It could potentially be useful to cope with DMA bottlenecks, but
591 * in those cases it's probably best to just use a lower bitrate.
593 csr |= SPI_BF(DLYBS, 0);
594 csr |= SPI_BF(DLYBCT, 0);
596 /* chipselect must have been muxed as GPIO (e.g. in board setup) */
597 npcs_pin = (unsigned int)spi->controller_data;
598 if (!spi->controller_state) {
599 ret = gpio_request(npcs_pin, spi->dev.bus_id);
602 spi->controller_state = (void *)npcs_pin;
603 gpio_direction_output(npcs_pin, !(spi->mode & SPI_CS_HIGH));
607 spin_lock_irqsave(&as->lock, flags);
610 cs_deactivate(as, spi);
611 spin_unlock_irqrestore(&as->lock, flags);
615 "setup: %lu Hz bpw %u mode 0x%x -> csr%d %08x\n",
616 bus_hz / scbr, bits, spi->mode, spi->chip_select, csr);
618 spi_writel(as, CSR0 + 4 * spi->chip_select, csr);
623 static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg)
625 struct atmel_spi *as;
626 struct spi_transfer *xfer;
628 struct device *controller = spi->master->dev.parent;
630 as = spi_master_get_devdata(spi->master);
632 dev_dbg(controller, "new message %p submitted for %s\n",
633 msg, spi->dev.bus_id);
635 if (unlikely(list_empty(&msg->transfers)
636 || !spi->max_speed_hz))
642 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
643 if (!(xfer->tx_buf || xfer->rx_buf) && xfer->len) {
644 dev_dbg(&spi->dev, "missing rx or tx buf\n");
648 /* FIXME implement these protocol options!! */
649 if (xfer->bits_per_word || xfer->speed_hz) {
650 dev_dbg(&spi->dev, "no protocol options yet\n");
655 * DMA map early, for performance (empties dcache ASAP) and
656 * better fault reporting. This is a DMA-only driver.
658 * NOTE that if dma_unmap_single() ever starts to do work on
659 * platforms supported by this driver, we would need to clean
660 * up mappings for previously-mapped transfers.
662 if (!msg->is_dma_mapped) {
663 if (atmel_spi_dma_map_xfer(as, xfer) < 0)
669 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
671 " xfer %p: len %u tx %p/%08x rx %p/%08x\n",
673 xfer->tx_buf, xfer->tx_dma,
674 xfer->rx_buf, xfer->rx_dma);
678 msg->status = -EINPROGRESS;
679 msg->actual_length = 0;
681 spin_lock_irqsave(&as->lock, flags);
682 list_add_tail(&msg->queue, &as->queue);
683 if (!as->current_transfer)
684 atmel_spi_next_message(spi->master);
685 spin_unlock_irqrestore(&as->lock, flags);
690 static void atmel_spi_cleanup(struct spi_device *spi)
692 struct atmel_spi *as = spi_master_get_devdata(spi->master);
693 unsigned gpio = (unsigned) spi->controller_data;
696 if (!spi->controller_state)
699 spin_lock_irqsave(&as->lock, flags);
700 if (as->stay == spi) {
702 cs_deactivate(as, spi);
704 spin_unlock_irqrestore(&as->lock, flags);
709 /*-------------------------------------------------------------------------*/
711 static int __init atmel_spi_probe(struct platform_device *pdev)
713 struct resource *regs;
717 struct spi_master *master;
718 struct atmel_spi *as;
720 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
724 irq = platform_get_irq(pdev, 0);
728 clk = clk_get(&pdev->dev, "spi_clk");
732 /* setup spi core then atmel-specific driver state */
734 master = spi_alloc_master(&pdev->dev, sizeof *as);
738 master->bus_num = pdev->id;
739 master->num_chipselect = 4;
740 master->setup = atmel_spi_setup;
741 master->transfer = atmel_spi_transfer;
742 master->cleanup = atmel_spi_cleanup;
743 platform_set_drvdata(pdev, master);
745 as = spi_master_get_devdata(master);
748 * Scratch buffer is used for throwaway rx and tx data.
749 * It's coherent to minimize dcache pollution.
751 as->buffer = dma_alloc_coherent(&pdev->dev, BUFFER_SIZE,
752 &as->buffer_dma, GFP_KERNEL);
756 spin_lock_init(&as->lock);
757 INIT_LIST_HEAD(&as->queue);
759 as->regs = ioremap(regs->start, (regs->end - regs->start) + 1);
761 goto out_free_buffer;
765 ret = request_irq(irq, atmel_spi_interrupt, 0,
766 pdev->dev.bus_id, master);
770 /* Initialize the hardware */
772 spi_writel(as, CR, SPI_BIT(SWRST));
773 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
774 spi_writel(as, MR, SPI_BIT(MSTR) | SPI_BIT(MODFDIS));
775 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS));
776 spi_writel(as, CR, SPI_BIT(SPIEN));
779 dev_info(&pdev->dev, "Atmel SPI Controller at 0x%08lx (irq %d)\n",
780 (unsigned long)regs->start, irq);
782 ret = spi_register_master(master);
789 spi_writel(as, CR, SPI_BIT(SWRST));
790 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
792 free_irq(irq, master);
796 dma_free_coherent(&pdev->dev, BUFFER_SIZE, as->buffer,
800 spi_master_put(master);
804 static int __exit atmel_spi_remove(struct platform_device *pdev)
806 struct spi_master *master = platform_get_drvdata(pdev);
807 struct atmel_spi *as = spi_master_get_devdata(master);
808 struct spi_message *msg;
810 /* reset the hardware and block queue progress */
811 spin_lock_irq(&as->lock);
813 spi_writel(as, CR, SPI_BIT(SWRST));
814 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
816 spin_unlock_irq(&as->lock);
818 /* Terminate remaining queued transfers */
819 list_for_each_entry(msg, &as->queue, queue) {
820 /* REVISIT unmapping the dma is a NOP on ARM and AVR32
821 * but we shouldn't depend on that...
823 msg->status = -ESHUTDOWN;
824 msg->complete(msg->context);
827 dma_free_coherent(&pdev->dev, BUFFER_SIZE, as->buffer,
830 clk_disable(as->clk);
832 free_irq(as->irq, master);
835 spi_unregister_master(master);
842 static int atmel_spi_suspend(struct platform_device *pdev, pm_message_t mesg)
844 struct spi_master *master = platform_get_drvdata(pdev);
845 struct atmel_spi *as = spi_master_get_devdata(master);
847 clk_disable(as->clk);
851 static int atmel_spi_resume(struct platform_device *pdev)
853 struct spi_master *master = platform_get_drvdata(pdev);
854 struct atmel_spi *as = spi_master_get_devdata(master);
861 #define atmel_spi_suspend NULL
862 #define atmel_spi_resume NULL
866 static struct platform_driver atmel_spi_driver = {
869 .owner = THIS_MODULE,
871 .suspend = atmel_spi_suspend,
872 .resume = atmel_spi_resume,
873 .remove = __exit_p(atmel_spi_remove),
876 static int __init atmel_spi_init(void)
878 return platform_driver_probe(&atmel_spi_driver, atmel_spi_probe);
880 module_init(atmel_spi_init);
882 static void __exit atmel_spi_exit(void)
884 platform_driver_unregister(&atmel_spi_driver);
886 module_exit(atmel_spi_exit);
888 MODULE_DESCRIPTION("Atmel AT32/AT91 SPI Controller driver");
889 MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>");
890 MODULE_LICENSE("GPL");
891 MODULE_ALIAS("platform:atmel_spi");