Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
spi-atmel.c File Reference
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/clk.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/spi/spi.h>
#include <linux/slab.h>
#include <asm/io.h>
#include <mach/board.h>
#include <asm/gpio.h>
#include <mach/cpu.h>

Go to the source code of this file.

Data Structures

struct  atmel_spi
 
struct  atmel_spi_device
 

Macros

#define SPI_CR   0x0000
 
#define SPI_MR   0x0004
 
#define SPI_RDR   0x0008
 
#define SPI_TDR   0x000c
 
#define SPI_SR   0x0010
 
#define SPI_IER   0x0014
 
#define SPI_IDR   0x0018
 
#define SPI_IMR   0x001c
 
#define SPI_CSR0   0x0030
 
#define SPI_CSR1   0x0034
 
#define SPI_CSR2   0x0038
 
#define SPI_CSR3   0x003c
 
#define SPI_RPR   0x0100
 
#define SPI_RCR   0x0104
 
#define SPI_TPR   0x0108
 
#define SPI_TCR   0x010c
 
#define SPI_RNPR   0x0110
 
#define SPI_RNCR   0x0114
 
#define SPI_TNPR   0x0118
 
#define SPI_TNCR   0x011c
 
#define SPI_PTCR   0x0120
 
#define SPI_PTSR   0x0124
 
#define SPI_SPIEN_OFFSET   0
 
#define SPI_SPIEN_SIZE   1
 
#define SPI_SPIDIS_OFFSET   1
 
#define SPI_SPIDIS_SIZE   1
 
#define SPI_SWRST_OFFSET   7
 
#define SPI_SWRST_SIZE   1
 
#define SPI_LASTXFER_OFFSET   24
 
#define SPI_LASTXFER_SIZE   1
 
#define SPI_MSTR_OFFSET   0
 
#define SPI_MSTR_SIZE   1
 
#define SPI_PS_OFFSET   1
 
#define SPI_PS_SIZE   1
 
#define SPI_PCSDEC_OFFSET   2
 
#define SPI_PCSDEC_SIZE   1
 
#define SPI_FDIV_OFFSET   3
 
#define SPI_FDIV_SIZE   1
 
#define SPI_MODFDIS_OFFSET   4
 
#define SPI_MODFDIS_SIZE   1
 
#define SPI_LLB_OFFSET   7
 
#define SPI_LLB_SIZE   1
 
#define SPI_PCS_OFFSET   16
 
#define SPI_PCS_SIZE   4
 
#define SPI_DLYBCS_OFFSET   24
 
#define SPI_DLYBCS_SIZE   8
 
#define SPI_RD_OFFSET   0
 
#define SPI_RD_SIZE   16
 
#define SPI_TD_OFFSET   0
 
#define SPI_TD_SIZE   16
 
#define SPI_RDRF_OFFSET   0
 
#define SPI_RDRF_SIZE   1
 
#define SPI_TDRE_OFFSET   1
 
#define SPI_TDRE_SIZE   1
 
#define SPI_MODF_OFFSET   2
 
#define SPI_MODF_SIZE   1
 
#define SPI_OVRES_OFFSET   3
 
#define SPI_OVRES_SIZE   1
 
#define SPI_ENDRX_OFFSET   4
 
#define SPI_ENDRX_SIZE   1
 
#define SPI_ENDTX_OFFSET   5
 
#define SPI_ENDTX_SIZE   1
 
#define SPI_RXBUFF_OFFSET   6
 
#define SPI_RXBUFF_SIZE   1
 
#define SPI_TXBUFE_OFFSET   7
 
#define SPI_TXBUFE_SIZE   1
 
#define SPI_NSSR_OFFSET   8
 
#define SPI_NSSR_SIZE   1
 
#define SPI_TXEMPTY_OFFSET   9
 
#define SPI_TXEMPTY_SIZE   1
 
#define SPI_SPIENS_OFFSET   16
 
#define SPI_SPIENS_SIZE   1
 
#define SPI_CPOL_OFFSET   0
 
#define SPI_CPOL_SIZE   1
 
#define SPI_NCPHA_OFFSET   1
 
#define SPI_NCPHA_SIZE   1
 
#define SPI_CSAAT_OFFSET   3
 
#define SPI_CSAAT_SIZE   1
 
#define SPI_BITS_OFFSET   4
 
#define SPI_BITS_SIZE   4
 
#define SPI_SCBR_OFFSET   8
 
#define SPI_SCBR_SIZE   8
 
#define SPI_DLYBS_OFFSET   16
 
#define SPI_DLYBS_SIZE   8
 
#define SPI_DLYBCT_OFFSET   24
 
#define SPI_DLYBCT_SIZE   8
 
#define SPI_RXCTR_OFFSET   0
 
#define SPI_RXCTR_SIZE   16
 
#define SPI_TXCTR_OFFSET   0
 
#define SPI_TXCTR_SIZE   16
 
#define SPI_RXNCR_OFFSET   0
 
#define SPI_RXNCR_SIZE   16
 
#define SPI_TXNCR_OFFSET   0
 
#define SPI_TXNCR_SIZE   16
 
#define SPI_RXTEN_OFFSET   0
 
#define SPI_RXTEN_SIZE   1
 
#define SPI_RXTDIS_OFFSET   1
 
#define SPI_RXTDIS_SIZE   1
 
#define SPI_TXTEN_OFFSET   8
 
#define SPI_TXTEN_SIZE   1
 
#define SPI_TXTDIS_OFFSET   9
 
#define SPI_TXTDIS_SIZE   1
 
#define SPI_BITS_8_BPT   0
 
#define SPI_BITS_9_BPT   1
 
#define SPI_BITS_10_BPT   2
 
#define SPI_BITS_11_BPT   3
 
#define SPI_BITS_12_BPT   4
 
#define SPI_BITS_13_BPT   5
 
#define SPI_BITS_14_BPT   6
 
#define SPI_BITS_15_BPT   7
 
#define SPI_BITS_16_BPT   8
 
#define SPI_BIT(name)   (1 << SPI_##name##_OFFSET)
 
#define SPI_BF(name, value)   (((value) & ((1 << SPI_##name##_SIZE) - 1)) << SPI_##name##_OFFSET)
 
#define SPI_BFEXT(name, value)   (((value) >> SPI_##name##_OFFSET) & ((1 << SPI_##name##_SIZE) - 1))
 
#define SPI_BFINS(name, value, old)
 
#define spi_readl(port, reg)   __raw_readl((port)->regs + SPI_##reg)
 
#define spi_writel(port, reg, value)   __raw_writel((value), (port)->regs + SPI_##reg)
 
#define BUFFER_SIZE   PAGE_SIZE
 
#define INVALID_DMA_ADDRESS   0xffffffff
 
#define atmel_spi_suspend   NULL
 
#define atmel_spi_resume   NULL
 

Functions

 module_platform_driver (atmel_spi_driver)
 
 MODULE_DESCRIPTION ("Atmel AT32/AT91 SPI Controller driver")
 
 MODULE_AUTHOR ("Haavard Skinnemoen (Atmel)")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_ALIAS ("platform:atmel_spi")
 

Macro Definition Documentation

#define atmel_spi_resume   NULL

Definition at line 1064 of file spi-atmel.c.

#define atmel_spi_suspend   NULL

Definition at line 1063 of file spi-atmel.c.

#define BUFFER_SIZE   PAGE_SIZE

Definition at line 214 of file spi-atmel.c.

#define INVALID_DMA_ADDRESS   0xffffffff

Definition at line 215 of file spi-atmel.c.

#define SPI_BF (   name,
  value 
)    (((value) & ((1 << SPI_##name##_SIZE) - 1)) << SPI_##name##_OFFSET)

Definition at line 168 of file spi-atmel.c.

#define SPI_BFEXT (   name,
  value 
)    (((value) >> SPI_##name##_OFFSET) & ((1 << SPI_##name##_SIZE) - 1))

Definition at line 170 of file spi-atmel.c.

#define SPI_BFINS (   name,
  value,
  old 
)
Value:
( ((old) & ~(((1 << SPI_##name##_SIZE) - 1) << SPI_##name##_OFFSET)) \

Definition at line 172 of file spi-atmel.c.

#define SPI_BIT (   name)    (1 << SPI_##name##_OFFSET)

Definition at line 166 of file spi-atmel.c.

#define SPI_BITS_10_BPT   2

Definition at line 157 of file spi-atmel.c.

#define SPI_BITS_11_BPT   3

Definition at line 158 of file spi-atmel.c.

#define SPI_BITS_12_BPT   4

Definition at line 159 of file spi-atmel.c.

#define SPI_BITS_13_BPT   5

Definition at line 160 of file spi-atmel.c.

#define SPI_BITS_14_BPT   6

Definition at line 161 of file spi-atmel.c.

#define SPI_BITS_15_BPT   7

Definition at line 162 of file spi-atmel.c.

#define SPI_BITS_16_BPT   8

Definition at line 163 of file spi-atmel.c.

#define SPI_BITS_8_BPT   0

Definition at line 155 of file spi-atmel.c.

#define SPI_BITS_9_BPT   1

Definition at line 156 of file spi-atmel.c.

#define SPI_BITS_OFFSET   4

Definition at line 119 of file spi-atmel.c.

#define SPI_BITS_SIZE   4

Definition at line 120 of file spi-atmel.c.

#define SPI_CPOL_OFFSET   0

Definition at line 113 of file spi-atmel.c.

#define SPI_CPOL_SIZE   1

Definition at line 114 of file spi-atmel.c.

#define SPI_CR   0x0000

Definition at line 29 of file spi-atmel.c.

#define SPI_CSAAT_OFFSET   3

Definition at line 117 of file spi-atmel.c.

#define SPI_CSAAT_SIZE   1

Definition at line 118 of file spi-atmel.c.

#define SPI_CSR0   0x0030

Definition at line 37 of file spi-atmel.c.

#define SPI_CSR1   0x0034

Definition at line 38 of file spi-atmel.c.

#define SPI_CSR2   0x0038

Definition at line 39 of file spi-atmel.c.

#define SPI_CSR3   0x003c

Definition at line 40 of file spi-atmel.c.

#define SPI_DLYBCS_OFFSET   24

Definition at line 77 of file spi-atmel.c.

#define SPI_DLYBCS_SIZE   8

Definition at line 78 of file spi-atmel.c.

#define SPI_DLYBCT_OFFSET   24

Definition at line 125 of file spi-atmel.c.

#define SPI_DLYBCT_SIZE   8

Definition at line 126 of file spi-atmel.c.

#define SPI_DLYBS_OFFSET   16

Definition at line 123 of file spi-atmel.c.

#define SPI_DLYBS_SIZE   8

Definition at line 124 of file spi-atmel.c.

#define SPI_ENDRX_OFFSET   4

Definition at line 97 of file spi-atmel.c.

#define SPI_ENDRX_SIZE   1

Definition at line 98 of file spi-atmel.c.

#define SPI_ENDTX_OFFSET   5

Definition at line 99 of file spi-atmel.c.

#define SPI_ENDTX_SIZE   1

Definition at line 100 of file spi-atmel.c.

#define SPI_FDIV_OFFSET   3

Definition at line 69 of file spi-atmel.c.

#define SPI_FDIV_SIZE   1

Definition at line 70 of file spi-atmel.c.

#define SPI_IDR   0x0018

Definition at line 35 of file spi-atmel.c.

#define SPI_IER   0x0014

Definition at line 34 of file spi-atmel.c.

#define SPI_IMR   0x001c

Definition at line 36 of file spi-atmel.c.

#define SPI_LASTXFER_OFFSET   24

Definition at line 59 of file spi-atmel.c.

#define SPI_LASTXFER_SIZE   1

Definition at line 60 of file spi-atmel.c.

#define SPI_LLB_OFFSET   7

Definition at line 73 of file spi-atmel.c.

#define SPI_LLB_SIZE   1

Definition at line 74 of file spi-atmel.c.

#define SPI_MODF_OFFSET   2

Definition at line 93 of file spi-atmel.c.

#define SPI_MODF_SIZE   1

Definition at line 94 of file spi-atmel.c.

#define SPI_MODFDIS_OFFSET   4

Definition at line 71 of file spi-atmel.c.

#define SPI_MODFDIS_SIZE   1

Definition at line 72 of file spi-atmel.c.

#define SPI_MR   0x0004

Definition at line 30 of file spi-atmel.c.

#define SPI_MSTR_OFFSET   0

Definition at line 63 of file spi-atmel.c.

#define SPI_MSTR_SIZE   1

Definition at line 64 of file spi-atmel.c.

#define SPI_NCPHA_OFFSET   1

Definition at line 115 of file spi-atmel.c.

#define SPI_NCPHA_SIZE   1

Definition at line 116 of file spi-atmel.c.

#define SPI_NSSR_OFFSET   8

Definition at line 105 of file spi-atmel.c.

#define SPI_NSSR_SIZE   1

Definition at line 106 of file spi-atmel.c.

#define SPI_OVRES_OFFSET   3

Definition at line 95 of file spi-atmel.c.

#define SPI_OVRES_SIZE   1

Definition at line 96 of file spi-atmel.c.

#define SPI_PCS_OFFSET   16

Definition at line 75 of file spi-atmel.c.

#define SPI_PCS_SIZE   4

Definition at line 76 of file spi-atmel.c.

#define SPI_PCSDEC_OFFSET   2

Definition at line 67 of file spi-atmel.c.

#define SPI_PCSDEC_SIZE   1

Definition at line 68 of file spi-atmel.c.

#define SPI_PS_OFFSET   1

Definition at line 65 of file spi-atmel.c.

#define SPI_PS_SIZE   1

Definition at line 66 of file spi-atmel.c.

#define SPI_PTCR   0x0120

Definition at line 49 of file spi-atmel.c.

#define SPI_PTSR   0x0124

Definition at line 50 of file spi-atmel.c.

#define SPI_RCR   0x0104

Definition at line 42 of file spi-atmel.c.

#define SPI_RD_OFFSET   0

Definition at line 81 of file spi-atmel.c.

#define SPI_RD_SIZE   16

Definition at line 82 of file spi-atmel.c.

#define SPI_RDR   0x0008

Definition at line 31 of file spi-atmel.c.

#define SPI_RDRF_OFFSET   0

Definition at line 89 of file spi-atmel.c.

#define SPI_RDRF_SIZE   1

Definition at line 90 of file spi-atmel.c.

#define spi_readl (   port,
  reg 
)    __raw_readl((port)->regs + SPI_##reg)

Definition at line 177 of file spi-atmel.c.

#define SPI_RNCR   0x0114

Definition at line 46 of file spi-atmel.c.

#define SPI_RNPR   0x0110

Definition at line 45 of file spi-atmel.c.

#define SPI_RPR   0x0100

Definition at line 41 of file spi-atmel.c.

#define SPI_RXBUFF_OFFSET   6

Definition at line 101 of file spi-atmel.c.

#define SPI_RXBUFF_SIZE   1

Definition at line 102 of file spi-atmel.c.

#define SPI_RXCTR_OFFSET   0

Definition at line 129 of file spi-atmel.c.

#define SPI_RXCTR_SIZE   16

Definition at line 130 of file spi-atmel.c.

#define SPI_RXNCR_OFFSET   0

Definition at line 137 of file spi-atmel.c.

#define SPI_RXNCR_SIZE   16

Definition at line 138 of file spi-atmel.c.

#define SPI_RXTDIS_OFFSET   1

Definition at line 147 of file spi-atmel.c.

#define SPI_RXTDIS_SIZE   1

Definition at line 148 of file spi-atmel.c.

#define SPI_RXTEN_OFFSET   0

Definition at line 145 of file spi-atmel.c.

#define SPI_RXTEN_SIZE   1

Definition at line 146 of file spi-atmel.c.

#define SPI_SCBR_OFFSET   8

Definition at line 121 of file spi-atmel.c.

#define SPI_SCBR_SIZE   8

Definition at line 122 of file spi-atmel.c.

#define SPI_SPIDIS_OFFSET   1

Definition at line 55 of file spi-atmel.c.

#define SPI_SPIDIS_SIZE   1

Definition at line 56 of file spi-atmel.c.

#define SPI_SPIEN_OFFSET   0

Definition at line 53 of file spi-atmel.c.

#define SPI_SPIEN_SIZE   1

Definition at line 54 of file spi-atmel.c.

#define SPI_SPIENS_OFFSET   16

Definition at line 109 of file spi-atmel.c.

#define SPI_SPIENS_SIZE   1

Definition at line 110 of file spi-atmel.c.

#define SPI_SR   0x0010

Definition at line 33 of file spi-atmel.c.

#define SPI_SWRST_OFFSET   7

Definition at line 57 of file spi-atmel.c.

#define SPI_SWRST_SIZE   1

Definition at line 58 of file spi-atmel.c.

#define SPI_TCR   0x010c

Definition at line 44 of file spi-atmel.c.

#define SPI_TD_OFFSET   0

Definition at line 85 of file spi-atmel.c.

#define SPI_TD_SIZE   16

Definition at line 86 of file spi-atmel.c.

#define SPI_TDR   0x000c

Definition at line 32 of file spi-atmel.c.

#define SPI_TDRE_OFFSET   1

Definition at line 91 of file spi-atmel.c.

#define SPI_TDRE_SIZE   1

Definition at line 92 of file spi-atmel.c.

#define SPI_TNCR   0x011c

Definition at line 48 of file spi-atmel.c.

#define SPI_TNPR   0x0118

Definition at line 47 of file spi-atmel.c.

#define SPI_TPR   0x0108

Definition at line 43 of file spi-atmel.c.

#define SPI_TXBUFE_OFFSET   7

Definition at line 103 of file spi-atmel.c.

#define SPI_TXBUFE_SIZE   1

Definition at line 104 of file spi-atmel.c.

#define SPI_TXCTR_OFFSET   0

Definition at line 133 of file spi-atmel.c.

#define SPI_TXCTR_SIZE   16

Definition at line 134 of file spi-atmel.c.

#define SPI_TXEMPTY_OFFSET   9

Definition at line 107 of file spi-atmel.c.

#define SPI_TXEMPTY_SIZE   1

Definition at line 108 of file spi-atmel.c.

#define SPI_TXNCR_OFFSET   0

Definition at line 141 of file spi-atmel.c.

#define SPI_TXNCR_SIZE   16

Definition at line 142 of file spi-atmel.c.

#define SPI_TXTDIS_OFFSET   9

Definition at line 151 of file spi-atmel.c.

#define SPI_TXTDIS_SIZE   1

Definition at line 152 of file spi-atmel.c.

#define SPI_TXTEN_OFFSET   8

Definition at line 149 of file spi-atmel.c.

#define SPI_TXTEN_SIZE   1

Definition at line 150 of file spi-atmel.c.

#define spi_writel (   port,
  reg,
  value 
)    __raw_writel((value), (port)->regs + SPI_##reg)

Definition at line 179 of file spi-atmel.c.

Function Documentation

MODULE_ALIAS ( "platform:atmel_spi"  )
MODULE_AUTHOR ( "Haavard Skinnemoen (Atmel)"  )
MODULE_DESCRIPTION ( "Atmel AT32/AT91 SPI Controller driver )
MODULE_LICENSE ( "GPL"  )
module_platform_driver ( atmel_spi_driver  )