1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef AT91_SPI_H
17#define AT91_SPI_H
18
19#include <asm/arch/at91_pdc.h>
20
21typedef struct at91_spi {
22 u32 cr;
23 u32 mr;
24 u32 rdr;
25 u32 tdr;
26 u32 sr;
27 u32 ier;
28 u32 idr;
29 u32 imr;
30 u32 reserve1[4];
31 u32 csr[4];
32 u32 reserve2[48];
33 at91_pdc_t pdc;
34} at91_spi_t;
35
36#ifdef CONFIG_ATMEL_LEGACY
37
38#define AT91_SPI_CR 0x00
39#define AT91_SPI_SPIEN (1 << 0)
40#define AT91_SPI_SPIDIS (1 << 1)
41#define AT91_SPI_SWRST (1 << 7)
42#define AT91_SPI_LASTXFER (1 << 24)
43
44#define AT91_SPI_MR 0x04
45#define AT91_SPI_MSTR (1 << 0)
46#define AT91_SPI_PS (1 << 1)
47#define AT91_SPI_PS_FIXED (0 << 1)
48#define AT91_SPI_PS_VARIABLE (1 << 1)
49#define AT91_SPI_PCSDEC (1 << 2)
50#define AT91_SPI_DIV32 (1 << 3)
51#define AT91_SPI_MODFDIS (1 << 4)
52#define AT91_SPI_LLB (1 << 7)
53#define AT91_SPI_PCS (0xf << 16)
54#define AT91_SPI_DLYBCS (0xff << 24)
55
56#define AT91_SPI_RDR 0x08
57#define AT91_SPI_RD (0xffff << 0)
58#define AT91_SPI_PCS (0xf << 16)
59
60#define AT91_SPI_TDR 0x0c
61#define AT91_SPI_TD (0xffff << 0)
62#define AT91_SPI_PCS (0xf << 16)
63#define AT91_SPI_LASTXFER (1 << 24)
64
65#define AT91_SPI_SR 0x10
66#define AT91_SPI_RDRF (1 << 0)
67#define AT91_SPI_TDRE (1 << 1)
68#define AT91_SPI_MODF (1 << 2)
69#define AT91_SPI_OVRES (1 << 3)
70#define AT91_SPI_ENDRX (1 << 4)
71#define AT91_SPI_ENDTX (1 << 5)
72#define AT91_SPI_RXBUFF (1 << 6)
73#define AT91_SPI_TXBUFE (1 << 7)
74#define AT91_SPI_NSSR (1 << 8)
75#define AT91_SPI_TXEMPTY (1 << 9)
76#define AT91_SPI_SPIENS (1 << 16)
77
78#define AT91_SPI_IER 0x14
79#define AT91_SPI_IDR 0x18
80#define AT91_SPI_IMR 0x1c
81
82#define AT91_SPI_CSR(n) (0x30 + ((n) * 4))
83#define AT91_SPI_CPOL (1 << 0)
84#define AT91_SPI_NCPHA (1 << 1)
85#define AT91_SPI_CSAAT (1 << 3)
86#define AT91_SPI_BITS (0xf << 4)
87#define AT91_SPI_BITS_8 (0 << 4)
88#define AT91_SPI_BITS_9 (1 << 4)
89#define AT91_SPI_BITS_10 (2 << 4)
90#define AT91_SPI_BITS_11 (3 << 4)
91#define AT91_SPI_BITS_12 (4 << 4)
92#define AT91_SPI_BITS_13 (5 << 4)
93#define AT91_SPI_BITS_14 (6 << 4)
94#define AT91_SPI_BITS_15 (7 << 4)
95#define AT91_SPI_BITS_16 (8 << 4)
96#define AT91_SPI_SCBR (0xff << 8)
97#define AT91_SPI_DLYBS (0xff << 16)
98#define AT91_SPI_DLYBCT (0xff << 24)
99
100#define AT91_SPI_RPR 0x0100
101
102#define AT91_SPI_RCR 0x0104
103
104#define AT91_SPI_TPR 0x0108
105
106#define AT91_SPI_TCR 0x010c
107
108#define AT91_SPI_RNPR 0x0110
109
110#define AT91_SPI_RNCR 0x0114
111
112#define AT91_SPI_TNPR 0x0118
113
114#define AT91_SPI_TNCR 0x011c
115
116#define AT91_SPI_PTCR 0x0120
117#define AT91_SPI_RXTEN (0x1 << 0)
118#define AT91_SPI_RXTDIS (0x1 << 1)
119#define AT91_SPI_TXTEN (0x1 << 8)
120#define AT91_SPI_TXTDIS (0x1 << 9)
121
122#define AT91_SPI_PTSR 0x0124
123
124#endif
125
126#endif
127