1 #ifndef BCM63XX_DEV_SPI_H
2 #define BCM63XX_DEV_SPI_H
3
4 #include <linux/types.h>
5 #include <bcm63xx_io.h>
6 #include <bcm63xx_regs.h>
7
8 int __init bcm63xx_spi_register(void);
9
10 struct bcm63xx_spi_pdata {
11 unsigned int fifo_size;
12 unsigned int msg_type_shift;
13 unsigned int msg_ctl_width;
14 int bus_num;
15 int num_chipselect;
16 };
17
18 enum bcm63xx_regs_spi {
19 SPI_CMD,
20 SPI_INT_STATUS,
21 SPI_INT_MASK_ST,
22 SPI_INT_MASK,
23 SPI_ST,
24 SPI_CLK_CFG,
25 SPI_FILL_BYTE,
26 SPI_MSG_TAIL,
27 SPI_RX_TAIL,
28 SPI_MSG_CTL,
29 SPI_MSG_DATA,
30 SPI_RX_DATA,
31 };
32
33 #define __GEN_SPI_REGS_TABLE(__cpu) \
34 [SPI_CMD] = SPI_## __cpu ##_CMD, \
35 [SPI_INT_STATUS] = SPI_## __cpu ##_INT_STATUS, \
36 [SPI_INT_MASK_ST] = SPI_## __cpu ##_INT_MASK_ST, \
37 [SPI_INT_MASK] = SPI_## __cpu ##_INT_MASK, \
38 [SPI_ST] = SPI_## __cpu ##_ST, \
39 [SPI_CLK_CFG] = SPI_## __cpu ##_CLK_CFG, \
40 [SPI_FILL_BYTE] = SPI_## __cpu ##_FILL_BYTE, \
41 [SPI_MSG_TAIL] = SPI_## __cpu ##_MSG_TAIL, \
42 [SPI_RX_TAIL] = SPI_## __cpu ##_RX_TAIL, \
43 [SPI_MSG_CTL] = SPI_## __cpu ##_MSG_CTL, \
44 [SPI_MSG_DATA] = SPI_## __cpu ##_MSG_DATA, \
45 [SPI_RX_DATA] = SPI_## __cpu ##_RX_DATA,
46
bcm63xx_spireg(enum bcm63xx_regs_spi reg)47 static inline unsigned long bcm63xx_spireg(enum bcm63xx_regs_spi reg)
48 {
49 extern const unsigned long *bcm63xx_regs_spi;
50
51 return bcm63xx_regs_spi[reg];
52 }
53
54 #endif /* BCM63XX_DEV_SPI_H */
55