1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#ifndef __SH_SPI_H__
22#define __SH_SPI_H__
23
24#include <spi.h>
25
26struct sh_spi_regs {
27 unsigned long tbr_rbr;
28 unsigned long resv1;
29 unsigned long cr1;
30 unsigned long resv2;
31 unsigned long cr2;
32 unsigned long resv3;
33 unsigned long cr3;
34 unsigned long resv4;
35 unsigned long cr4;
36};
37
38
39#define SH_SPI_TBE 0x80
40#define SH_SPI_TBF 0x40
41#define SH_SPI_RBE 0x20
42#define SH_SPI_RBF 0x10
43#define SH_SPI_PFONRD 0x08
44#define SH_SPI_SSDB 0x04
45#define SH_SPI_SSD 0x02
46#define SH_SPI_SSA 0x01
47
48
49#define SH_SPI_RSTF 0x80
50#define SH_SPI_LOOPBK 0x40
51#define SH_SPI_CPOL 0x20
52#define SH_SPI_CPHA 0x10
53#define SH_SPI_L1M0 0x08
54
55
56#define SH_SPI_MAX_BYTE 0xFF
57
58
59#define SH_SPI_TBEI 0x80
60#define SH_SPI_TBFI 0x40
61#define SH_SPI_RBEI 0x20
62#define SH_SPI_RBFI 0x10
63#define SH_SPI_WPABRT 0x04
64#define SH_SPI_SSS 0x01
65
66#define SH_SPI_FIFO_SIZE 32
67
68struct sh_spi {
69 struct spi_slave slave;
70 struct sh_spi_regs *regs;
71};
72
73static inline struct sh_spi *to_sh_spi(struct spi_slave *slave)
74{
75 return container_of(slave, struct sh_spi, slave);
76}
77
78#endif
79