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.
34 * Newer controllers, marked with "new_1" flag, have:
36 * - SPI_MR.DIV32 may become FDIV or must-be-zero (here: always zero)
37 * - SPI_SR.TXEMPTY, SPI_SR.NSSR (and corresponding irqs)
39 * - SPI_CSRx.SBCR allows faster clocking
47 struct platform_device *pdev;
49 struct spi_device *stay;
52 struct list_head queue;
53 struct spi_transfer *current_transfer;
54 unsigned long current_remaining_bytes;
55 struct spi_transfer *next_transfer;
56 unsigned long next_remaining_bytes;
59 dma_addr_t buffer_dma;
62 #define BUFFER_SIZE PAGE_SIZE
63 #define INVALID_DMA_ADDRESS 0xffffffff
66 * Earlier SPI controllers (e.g. on at91rm9200) have a design bug whereby
67 * they assume that spi slave device state will not change on deselect, so
68 * that automagic deselection is OK. ("NPCSx rises if no data is to be
69 * transmitted") Not so! Workaround uses nCSx pins as GPIOs; or newer
70 * controllers have CSAAT and friends.
72 * Since the CSAAT functionality is a bit weird on newer controllers as
73 * well, we use GPIO to control nCSx pins on all controllers, updating
74 * MR.PCS to avoid confusing the controller. Using GPIOs also lets us
75 * support active-high chipselects despite the controller's belief that
76 * only active-low devices/systems exists.
78 * However, at91rm9200 has a second erratum whereby nCS0 doesn't work
79 * right when driven with GPIO. ("Mode Fault does not allow more than one
80 * Master on Chip Select 0.") No workaround exists for that ... so for
81 * nCS0 on that chip, we (a) don't use the GPIO, (b) can't support CS_HIGH,
82 * and (c) will trigger that first erratum in some cases.
85 static void cs_activate(struct atmel_spi *as, struct spi_device *spi)
87 unsigned gpio = (unsigned) spi->controller_data;
88 unsigned active = spi->mode & SPI_CS_HIGH;
92 u32 cpol = (spi->mode & SPI_CPOL) ? SPI_BIT(CPOL) : 0;
94 /* Make sure clock polarity is correct */
95 for (i = 0; i < spi->master->num_chipselect; i++) {
96 csr = spi_readl(as, CSR0 + 4 * i);
97 if ((csr ^ cpol) & SPI_BIT(CPOL))
98 spi_writel(as, CSR0 + 4 * i, csr ^ SPI_BIT(CPOL));
101 mr = spi_readl(as, MR);
102 mr = SPI_BFINS(PCS, ~(1 << spi->chip_select), mr);
104 dev_dbg(&spi->dev, "activate %u%s, mr %08x\n",
105 gpio, active ? " (high)" : "",
108 if (!(cpu_is_at91rm9200() && spi->chip_select == 0))
109 gpio_set_value(gpio, active);
110 spi_writel(as, MR, mr);
113 static void cs_deactivate(struct atmel_spi *as, struct spi_device *spi)
115 unsigned gpio = (unsigned) spi->controller_data;
116 unsigned active = spi->mode & SPI_CS_HIGH;
119 /* only deactivate *this* device; sometimes transfers to
120 * another device may be active when this routine is called.
122 mr = spi_readl(as, MR);
123 if (~SPI_BFEXT(PCS, mr) & (1 << spi->chip_select)) {
124 mr = SPI_BFINS(PCS, 0xf, mr);
125 spi_writel(as, MR, mr);
128 dev_dbg(&spi->dev, "DEactivate %u%s, mr %08x\n",
129 gpio, active ? " (low)" : "",
132 if (!(cpu_is_at91rm9200() && spi->chip_select == 0))
133 gpio_set_value(gpio, !active);
136 static inline int atmel_spi_xfer_is_last(struct spi_message *msg,
137 struct spi_transfer *xfer)
139 return msg->transfers.prev == &xfer->transfer_list;
142 static inline int atmel_spi_xfer_can_be_chained(struct spi_transfer *xfer)
144 return xfer->delay_usecs == 0 && !xfer->cs_change;
147 static void atmel_spi_next_xfer_data(struct spi_master *master,
148 struct spi_transfer *xfer,
153 struct atmel_spi *as = spi_master_get_devdata(master);
156 /* use scratch buffer only when rx or tx data is unspecified */
158 *rx_dma = xfer->rx_dma + xfer->len - len;
160 *rx_dma = as->buffer_dma;
161 if (len > BUFFER_SIZE)
165 *tx_dma = xfer->tx_dma + xfer->len - len;
167 *tx_dma = as->buffer_dma;
168 if (len > BUFFER_SIZE)
170 memset(as->buffer, 0, len);
171 dma_sync_single_for_device(&as->pdev->dev,
172 as->buffer_dma, len, DMA_TO_DEVICE);
179 * Submit next transfer for DMA.
180 * lock is held, spi irq is blocked
182 static void atmel_spi_next_xfer(struct spi_master *master,
183 struct spi_message *msg)
185 struct atmel_spi *as = spi_master_get_devdata(master);
186 struct spi_transfer *xfer;
189 dma_addr_t tx_dma, rx_dma;
191 if (!as->current_transfer)
192 xfer = list_entry(msg->transfers.next,
193 struct spi_transfer, transfer_list);
194 else if (!as->next_transfer)
195 xfer = list_entry(as->current_transfer->transfer_list.next,
196 struct spi_transfer, transfer_list);
201 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS));
204 atmel_spi_next_xfer_data(master, xfer, &tx_dma, &rx_dma, &len);
205 remaining = xfer->len - len;
207 spi_writel(as, RPR, rx_dma);
208 spi_writel(as, TPR, tx_dma);
210 if (msg->spi->bits_per_word > 8)
212 spi_writel(as, RCR, len);
213 spi_writel(as, TCR, len);
215 dev_dbg(&msg->spi->dev,
216 " start xfer %p: len %u tx %p/%08x rx %p/%08x\n",
217 xfer, xfer->len, xfer->tx_buf, xfer->tx_dma,
218 xfer->rx_buf, xfer->rx_dma);
220 xfer = as->next_transfer;
221 remaining = as->next_remaining_bytes;
224 as->current_transfer = xfer;
225 as->current_remaining_bytes = remaining;
229 else if (!atmel_spi_xfer_is_last(msg, xfer)
230 && atmel_spi_xfer_can_be_chained(xfer)) {
231 xfer = list_entry(xfer->transfer_list.next,
232 struct spi_transfer, transfer_list);
237 as->next_transfer = xfer;
243 atmel_spi_next_xfer_data(master, xfer, &tx_dma, &rx_dma, &len);
244 as->next_remaining_bytes = total - len;
246 spi_writel(as, RNPR, rx_dma);
247 spi_writel(as, TNPR, tx_dma);
249 if (msg->spi->bits_per_word > 8)
251 spi_writel(as, RNCR, len);
252 spi_writel(as, TNCR, len);
254 dev_dbg(&msg->spi->dev,
255 " next xfer %p: len %u tx %p/%08x rx %p/%08x\n",
256 xfer, xfer->len, xfer->tx_buf, xfer->tx_dma,
257 xfer->rx_buf, xfer->rx_dma);
258 ieval = SPI_BIT(ENDRX) | SPI_BIT(OVRES);
260 spi_writel(as, RNCR, 0);
261 spi_writel(as, TNCR, 0);
262 ieval = SPI_BIT(RXBUFF) | SPI_BIT(ENDRX) | SPI_BIT(OVRES);
265 /* REVISIT: We're waiting for ENDRX before we start the next
266 * transfer because we need to handle some difficult timing
267 * issues otherwise. If we wait for ENDTX in one transfer and
268 * then starts waiting for ENDRX in the next, it's difficult
269 * to tell the difference between the ENDRX interrupt we're
270 * actually waiting for and the ENDRX interrupt of the
273 * It should be doable, though. Just not now...
275 spi_writel(as, IER, ieval);
276 spi_writel(as, PTCR, SPI_BIT(TXTEN) | SPI_BIT(RXTEN));
279 static void atmel_spi_next_message(struct spi_master *master)
281 struct atmel_spi *as = spi_master_get_devdata(master);
282 struct spi_message *msg;
283 struct spi_device *spi;
285 BUG_ON(as->current_transfer);
287 msg = list_entry(as->queue.next, struct spi_message, queue);
290 dev_dbg(master->dev.parent, "start message %p for %s\n",
291 msg, spi->dev.bus_id);
293 /* select chip if it's not still active */
295 if (as->stay != spi) {
296 cs_deactivate(as, as->stay);
297 cs_activate(as, spi);
301 cs_activate(as, spi);
303 atmel_spi_next_xfer(master, msg);
307 * For DMA, tx_buf/tx_dma have the same relationship as rx_buf/rx_dma:
308 * - The buffer is either valid for CPU access, else NULL
309 * - If the buffer is valid, so is its DMA addresss
311 * This driver manages the dma addresss unless message->is_dma_mapped.
314 atmel_spi_dma_map_xfer(struct atmel_spi *as, struct spi_transfer *xfer)
316 struct device *dev = &as->pdev->dev;
318 xfer->tx_dma = xfer->rx_dma = INVALID_DMA_ADDRESS;
320 xfer->tx_dma = dma_map_single(dev,
321 (void *) xfer->tx_buf, xfer->len,
323 if (dma_mapping_error(dev, xfer->tx_dma))
327 xfer->rx_dma = dma_map_single(dev,
328 xfer->rx_buf, xfer->len,
330 if (dma_mapping_error(dev, xfer->rx_dma)) {
332 dma_unmap_single(dev,
333 xfer->tx_dma, xfer->len,
341 static void atmel_spi_dma_unmap_xfer(struct spi_master *master,
342 struct spi_transfer *xfer)
344 if (xfer->tx_dma != INVALID_DMA_ADDRESS)
345 dma_unmap_single(master->dev.parent, xfer->tx_dma,
346 xfer->len, DMA_TO_DEVICE);
347 if (xfer->rx_dma != INVALID_DMA_ADDRESS)
348 dma_unmap_single(master->dev.parent, xfer->rx_dma,
349 xfer->len, DMA_FROM_DEVICE);
353 atmel_spi_msg_done(struct spi_master *master, struct atmel_spi *as,
354 struct spi_message *msg, int status, int stay)
356 if (!stay || status < 0)
357 cs_deactivate(as, msg->spi);
361 list_del(&msg->queue);
362 msg->status = status;
364 dev_dbg(master->dev.parent,
365 "xfer complete: %u bytes transferred\n",
368 spin_unlock(&as->lock);
369 msg->complete(msg->context);
370 spin_lock(&as->lock);
372 as->current_transfer = NULL;
373 as->next_transfer = NULL;
375 /* continue if needed */
376 if (list_empty(&as->queue) || as->stopping)
377 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS));
379 atmel_spi_next_message(master);
383 atmel_spi_interrupt(int irq, void *dev_id)
385 struct spi_master *master = dev_id;
386 struct atmel_spi *as = spi_master_get_devdata(master);
387 struct spi_message *msg;
388 struct spi_transfer *xfer;
389 u32 status, pending, imr;
392 spin_lock(&as->lock);
394 xfer = as->current_transfer;
395 msg = list_entry(as->queue.next, struct spi_message, queue);
397 imr = spi_readl(as, IMR);
398 status = spi_readl(as, SR);
399 pending = status & imr;
401 if (pending & SPI_BIT(OVRES)) {
406 spi_writel(as, IDR, (SPI_BIT(RXBUFF) | SPI_BIT(ENDRX)
410 * When we get an overrun, we disregard the current
411 * transfer. Data will not be copied back from any
412 * bounce buffer and msg->actual_len will not be
413 * updated with the last xfer.
415 * We will also not process any remaning transfers in
418 * First, stop the transfer and unmap the DMA buffers.
420 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS));
421 if (!msg->is_dma_mapped)
422 atmel_spi_dma_unmap_xfer(master, xfer);
424 /* REVISIT: udelay in irq is unfriendly */
425 if (xfer->delay_usecs)
426 udelay(xfer->delay_usecs);
428 dev_warn(master->dev.parent, "overrun (%u/%u remaining)\n",
429 spi_readl(as, TCR), spi_readl(as, RCR));
432 * Clean up DMA registers and make sure the data
433 * registers are empty.
435 spi_writel(as, RNCR, 0);
436 spi_writel(as, TNCR, 0);
437 spi_writel(as, RCR, 0);
438 spi_writel(as, TCR, 0);
439 for (timeout = 1000; timeout; timeout--)
440 if (spi_readl(as, SR) & SPI_BIT(TXEMPTY))
443 dev_warn(master->dev.parent,
444 "timeout waiting for TXEMPTY");
445 while (spi_readl(as, SR) & SPI_BIT(RDRF))
448 /* Clear any overrun happening while cleaning up */
451 atmel_spi_msg_done(master, as, msg, -EIO, 0);
452 } else if (pending & (SPI_BIT(RXBUFF) | SPI_BIT(ENDRX))) {
455 spi_writel(as, IDR, pending);
457 if (as->current_remaining_bytes == 0) {
458 msg->actual_length += xfer->len;
460 if (!msg->is_dma_mapped)
461 atmel_spi_dma_unmap_xfer(master, xfer);
463 /* REVISIT: udelay in irq is unfriendly */
464 if (xfer->delay_usecs)
465 udelay(xfer->delay_usecs);
467 if (atmel_spi_xfer_is_last(msg, xfer)) {
468 /* report completed message */
469 atmel_spi_msg_done(master, as, msg, 0,
472 if (xfer->cs_change) {
473 cs_deactivate(as, msg->spi);
475 cs_activate(as, msg->spi);
479 * Not done yet. Submit the next transfer.
481 * FIXME handle protocol options for xfer
483 atmel_spi_next_xfer(master, msg);
487 * Keep going, we still have data to send in
488 * the current transfer.
490 atmel_spi_next_xfer(master, msg);
494 spin_unlock(&as->lock);
499 /* the spi->mode bits understood by this driver: */
500 #define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH)
502 static int atmel_spi_setup(struct spi_device *spi)
504 struct atmel_spi *as;
506 unsigned int bits = spi->bits_per_word;
507 unsigned long bus_hz;
508 unsigned int npcs_pin;
511 as = spi_master_get_devdata(spi->master);
516 if (spi->chip_select > spi->master->num_chipselect) {
518 "setup: invalid chipselect %u (%u defined)\n",
519 spi->chip_select, spi->master->num_chipselect);
525 if (bits < 8 || bits > 16) {
527 "setup: invalid bits_per_word %u (8 to 16)\n",
532 if (spi->mode & ~MODEBITS) {
533 dev_dbg(&spi->dev, "setup: unsupported mode bits %x\n",
534 spi->mode & ~MODEBITS);
538 /* see notes above re chipselect */
539 if (cpu_is_at91rm9200()
540 && spi->chip_select == 0
541 && (spi->mode & SPI_CS_HIGH)) {
542 dev_dbg(&spi->dev, "setup: can't be active-high\n");
547 * Pre-new_1 chips start out at half the peripheral
550 bus_hz = clk_get_rate(as->clk);
554 if (spi->max_speed_hz) {
556 * Calculate the lowest divider that satisfies the
557 * constraint, assuming div32/fdiv/mbz == 0.
559 scbr = DIV_ROUND_UP(bus_hz, spi->max_speed_hz);
562 * If the resulting divider doesn't fit into the
563 * register bitfield, we can't satisfy the constraint.
565 if (scbr >= (1 << SPI_SCBR_SIZE)) {
567 "setup: %d Hz too slow, scbr %u; min %ld Hz\n",
568 spi->max_speed_hz, scbr, bus_hz/255);
572 /* speed zero means "as slow as possible" */
575 csr = SPI_BF(SCBR, scbr) | SPI_BF(BITS, bits - 8);
576 if (spi->mode & SPI_CPOL)
577 csr |= SPI_BIT(CPOL);
578 if (!(spi->mode & SPI_CPHA))
579 csr |= SPI_BIT(NCPHA);
581 /* DLYBS is mostly irrelevant since we manage chipselect using GPIOs.
583 * DLYBCT would add delays between words, slowing down transfers.
584 * It could potentially be useful to cope with DMA bottlenecks, but
585 * in those cases it's probably best to just use a lower bitrate.
587 csr |= SPI_BF(DLYBS, 0);
588 csr |= SPI_BF(DLYBCT, 0);
590 /* chipselect must have been muxed as GPIO (e.g. in board setup) */
591 npcs_pin = (unsigned int)spi->controller_data;
592 if (!spi->controller_state) {
593 ret = gpio_request(npcs_pin, spi->dev.bus_id);
596 spi->controller_state = (void *)npcs_pin;
597 gpio_direction_output(npcs_pin, !(spi->mode & SPI_CS_HIGH));
601 spin_lock_irqsave(&as->lock, flags);
604 cs_deactivate(as, spi);
605 spin_unlock_irqrestore(&as->lock, flags);
609 "setup: %lu Hz bpw %u mode 0x%x -> csr%d %08x\n",
610 bus_hz / scbr, bits, spi->mode, spi->chip_select, csr);
612 spi_writel(as, CSR0 + 4 * spi->chip_select, csr);
617 static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg)
619 struct atmel_spi *as;
620 struct spi_transfer *xfer;
622 struct device *controller = spi->master->dev.parent;
624 as = spi_master_get_devdata(spi->master);
626 dev_dbg(controller, "new message %p submitted for %s\n",
627 msg, spi->dev.bus_id);
629 if (unlikely(list_empty(&msg->transfers)
630 || !spi->max_speed_hz))
636 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
637 if (!(xfer->tx_buf || xfer->rx_buf) && xfer->len) {
638 dev_dbg(&spi->dev, "missing rx or tx buf\n");
642 /* FIXME implement these protocol options!! */
643 if (xfer->bits_per_word || xfer->speed_hz) {
644 dev_dbg(&spi->dev, "no protocol options yet\n");
649 * DMA map early, for performance (empties dcache ASAP) and
650 * better fault reporting. This is a DMA-only driver.
652 * NOTE that if dma_unmap_single() ever starts to do work on
653 * platforms supported by this driver, we would need to clean
654 * up mappings for previously-mapped transfers.
656 if (!msg->is_dma_mapped) {
657 if (atmel_spi_dma_map_xfer(as, xfer) < 0)
663 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
665 " xfer %p: len %u tx %p/%08x rx %p/%08x\n",
667 xfer->tx_buf, xfer->tx_dma,
668 xfer->rx_buf, xfer->rx_dma);
672 msg->status = -EINPROGRESS;
673 msg->actual_length = 0;
675 spin_lock_irqsave(&as->lock, flags);
676 list_add_tail(&msg->queue, &as->queue);
677 if (!as->current_transfer)
678 atmel_spi_next_message(spi->master);
679 spin_unlock_irqrestore(&as->lock, flags);
684 static void atmel_spi_cleanup(struct spi_device *spi)
686 struct atmel_spi *as = spi_master_get_devdata(spi->master);
687 unsigned gpio = (unsigned) spi->controller_data;
690 if (!spi->controller_state)
693 spin_lock_irqsave(&as->lock, flags);
694 if (as->stay == spi) {
696 cs_deactivate(as, spi);
698 spin_unlock_irqrestore(&as->lock, flags);
703 /*-------------------------------------------------------------------------*/
705 static int __init atmel_spi_probe(struct platform_device *pdev)
707 struct resource *regs;
711 struct spi_master *master;
712 struct atmel_spi *as;
714 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
718 irq = platform_get_irq(pdev, 0);
722 clk = clk_get(&pdev->dev, "spi_clk");
726 /* setup spi core then atmel-specific driver state */
728 master = spi_alloc_master(&pdev->dev, sizeof *as);
732 master->bus_num = pdev->id;
733 master->num_chipselect = 4;
734 master->setup = atmel_spi_setup;
735 master->transfer = atmel_spi_transfer;
736 master->cleanup = atmel_spi_cleanup;
737 platform_set_drvdata(pdev, master);
739 as = spi_master_get_devdata(master);
742 * Scratch buffer is used for throwaway rx and tx data.
743 * It's coherent to minimize dcache pollution.
745 as->buffer = dma_alloc_coherent(&pdev->dev, BUFFER_SIZE,
746 &as->buffer_dma, GFP_KERNEL);
750 spin_lock_init(&as->lock);
751 INIT_LIST_HEAD(&as->queue);
753 as->regs = ioremap(regs->start, (regs->end - regs->start) + 1);
755 goto out_free_buffer;
758 if (!cpu_is_at91rm9200())
761 ret = request_irq(irq, atmel_spi_interrupt, 0,
762 pdev->dev.bus_id, master);
766 /* Initialize the hardware */
768 spi_writel(as, CR, SPI_BIT(SWRST));
769 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
770 spi_writel(as, MR, SPI_BIT(MSTR) | SPI_BIT(MODFDIS));
771 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS));
772 spi_writel(as, CR, SPI_BIT(SPIEN));
775 dev_info(&pdev->dev, "Atmel SPI Controller at 0x%08lx (irq %d)\n",
776 (unsigned long)regs->start, irq);
778 ret = spi_register_master(master);
785 spi_writel(as, CR, SPI_BIT(SWRST));
786 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
788 free_irq(irq, master);
792 dma_free_coherent(&pdev->dev, BUFFER_SIZE, as->buffer,
796 spi_master_put(master);
800 static int __exit atmel_spi_remove(struct platform_device *pdev)
802 struct spi_master *master = platform_get_drvdata(pdev);
803 struct atmel_spi *as = spi_master_get_devdata(master);
804 struct spi_message *msg;
806 /* reset the hardware and block queue progress */
807 spin_lock_irq(&as->lock);
809 spi_writel(as, CR, SPI_BIT(SWRST));
810 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
812 spin_unlock_irq(&as->lock);
814 /* Terminate remaining queued transfers */
815 list_for_each_entry(msg, &as->queue, queue) {
816 /* REVISIT unmapping the dma is a NOP on ARM and AVR32
817 * but we shouldn't depend on that...
819 msg->status = -ESHUTDOWN;
820 msg->complete(msg->context);
823 dma_free_coherent(&pdev->dev, BUFFER_SIZE, as->buffer,
826 clk_disable(as->clk);
828 free_irq(as->irq, master);
831 spi_unregister_master(master);
838 static int atmel_spi_suspend(struct platform_device *pdev, pm_message_t mesg)
840 struct spi_master *master = platform_get_drvdata(pdev);
841 struct atmel_spi *as = spi_master_get_devdata(master);
843 clk_disable(as->clk);
847 static int atmel_spi_resume(struct platform_device *pdev)
849 struct spi_master *master = platform_get_drvdata(pdev);
850 struct atmel_spi *as = spi_master_get_devdata(master);
857 #define atmel_spi_suspend NULL
858 #define atmel_spi_resume NULL
862 static struct platform_driver atmel_spi_driver = {
865 .owner = THIS_MODULE,
867 .suspend = atmel_spi_suspend,
868 .resume = atmel_spi_resume,
869 .remove = __exit_p(atmel_spi_remove),
872 static int __init atmel_spi_init(void)
874 return platform_driver_probe(&atmel_spi_driver, atmel_spi_probe);
876 module_init(atmel_spi_init);
878 static void __exit atmel_spi_exit(void)
880 platform_driver_unregister(&atmel_spi_driver);
882 module_exit(atmel_spi_exit);
884 MODULE_DESCRIPTION("Atmel AT32/AT91 SPI Controller driver");
885 MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>");
886 MODULE_LICENSE("GPL");
887 MODULE_ALIAS("platform:atmel_spi");