Go to the documentation of this file.
24 #include <linux/types.h>
27 #define MSCAN_RXFRM 0x80
28 #define MSCAN_RXACT 0x40
29 #define MSCAN_CSWAI 0x20
30 #define MSCAN_SYNCH 0x10
31 #define MSCAN_TIME 0x08
32 #define MSCAN_WUPE 0x04
33 #define MSCAN_SLPRQ 0x02
34 #define MSCAN_INITRQ 0x01
37 #define MSCAN_CANE 0x80
38 #define MSCAN_CLKSRC 0x40
39 #define MSCAN_LOOPB 0x20
40 #define MSCAN_LISTEN 0x10
41 #define MSCAN_BORM 0x08
42 #define MSCAN_WUPM 0x04
43 #define MSCAN_SLPAK 0x02
44 #define MSCAN_INITAK 0x01
48 #define MSCAN_FOR_MPC5XXX
51 #ifdef MSCAN_FOR_MPC5XXX
52 #define MSCAN_CLKSRC_BUS 0
53 #define MSCAN_CLKSRC_XTAL MSCAN_CLKSRC
54 #define MSCAN_CLKSRC_IPS MSCAN_CLKSRC
56 #define MSCAN_CLKSRC_BUS MSCAN_CLKSRC
57 #define MSCAN_CLKSRC_XTAL 0
61 #define MSCAN_WUPIF 0x80
62 #define MSCAN_CSCIF 0x40
63 #define MSCAN_RSTAT1 0x20
64 #define MSCAN_RSTAT0 0x10
65 #define MSCAN_TSTAT1 0x08
66 #define MSCAN_TSTAT0 0x04
67 #define MSCAN_OVRIF 0x02
68 #define MSCAN_RXF 0x01
69 #define MSCAN_ERR_IF (MSCAN_OVRIF | MSCAN_CSCIF)
70 #define MSCAN_RSTAT_MSK (MSCAN_RSTAT1 | MSCAN_RSTAT0)
71 #define MSCAN_TSTAT_MSK (MSCAN_TSTAT1 | MSCAN_TSTAT0)
72 #define MSCAN_STAT_MSK (MSCAN_RSTAT_MSK | MSCAN_TSTAT_MSK)
74 #define MSCAN_STATE_BUS_OFF (MSCAN_RSTAT1 | MSCAN_RSTAT0 | \
75 MSCAN_TSTAT1 | MSCAN_TSTAT0)
76 #define MSCAN_STATE_TX(canrflg) (((canrflg)&MSCAN_TSTAT_MSK)>>2)
77 #define MSCAN_STATE_RX(canrflg) (((canrflg)&MSCAN_RSTAT_MSK)>>4)
78 #define MSCAN_STATE_ACTIVE 0
79 #define MSCAN_STATE_WARNING 1
80 #define MSCAN_STATE_PASSIVE 2
81 #define MSCAN_STATE_BUSOFF 3
84 #define MSCAN_WUPIE 0x80
85 #define MSCAN_CSCIE 0x40
86 #define MSCAN_RSTATE1 0x20
87 #define MSCAN_RSTATE0 0x10
88 #define MSCAN_TSTATE1 0x08
89 #define MSCAN_TSTATE0 0x04
90 #define MSCAN_OVRIE 0x02
91 #define MSCAN_RXFIE 0x01
94 #define MSCAN_TXE2 0x04
95 #define MSCAN_TXE1 0x02
96 #define MSCAN_TXE0 0x01
97 #define MSCAN_TXE (MSCAN_TXE2 | MSCAN_TXE1 | MSCAN_TXE0)
100 #define MSCAN_TXIE2 0x04
101 #define MSCAN_TXIE1 0x02
102 #define MSCAN_TXIE0 0x01
103 #define MSCAN_TXIE (MSCAN_TXIE2 | MSCAN_TXIE1 | MSCAN_TXIE0)
106 #define MSCAN_ABTRQ2 0x04
107 #define MSCAN_ABTRQ1 0x02
108 #define MSCAN_ABTRQ0 0x01
111 #define MSCAN_ABTAK2 0x04
112 #define MSCAN_ABTAK1 0x02
113 #define MSCAN_ABTAK0 0x01
116 #define MSCAN_TX2 0x04
117 #define MSCAN_TX1 0x02
118 #define MSCAN_TX0 0x01
121 #define MSCAN_IDAM1 0x20
122 #define MSCAN_IDAM0 0x10
123 #define MSCAN_IDHIT2 0x04
124 #define MSCAN_IDHIT1 0x02
125 #define MSCAN_IDHIT0 0x01
127 #define MSCAN_AF_32BIT 0x00
128 #define MSCAN_AF_16BIT MSCAN_IDAM0
129 #define MSCAN_AF_8BIT MSCAN_IDAM1
130 #define MSCAN_AF_CLOSED (MSCAN_IDAM0|MSCAN_IDAM1)
131 #define MSCAN_AF_MASK (~(MSCAN_IDAM0|MSCAN_IDAM1))
134 #define MSCAN_BOHOLD 0x01
137 #define MSCAN_SFF_RTR_SHIFT 4
138 #define MSCAN_EFF_RTR_SHIFT 0
139 #define MSCAN_EFF_FLAGS 0x18
141 #ifdef MSCAN_FOR_MPC5XXX
142 #define _MSCAN_RESERVED_(n, num) u8 _res##n[num]
143 #define _MSCAN_RESERVED_DSR_SIZE 2
145 #define _MSCAN_RESERVED_(n, num)
146 #define _MSCAN_RESERVED_DSR_SIZE 0
232 #undef _MSCAN_RESERVED_
233 #define MSCAN_REGION sizeof(struct mscan)
235 #define MSCAN_NORMAL_MODE 0
236 #define MSCAN_SLEEP_MODE MSCAN_SLPRQ
237 #define MSCAN_INIT_MODE (MSCAN_INITRQ | MSCAN_SLPRQ)
238 #define MSCAN_POWEROFF_MODE (MSCAN_CSWAI | MSCAN_SLPRQ)
239 #define MSCAN_SET_MODE_RETRIES 255
240 #define MSCAN_ECHO_SKB_MAX 3
241 #define MSCAN_RX_INTS_ENABLE (MSCAN_OVRIE | MSCAN_RXFIE | MSCAN_CSCIE | \
242 MSCAN_RSTATE1 | MSCAN_RSTATE0 | \
243 MSCAN_TSTATE1 | MSCAN_TSTATE0)
251 #define BTR0_BRP_MASK 0x3f
252 #define BTR0_SJW_SHIFT 6
253 #define BTR0_SJW_MASK (0x3 << BTR0_SJW_SHIFT)
255 #define BTR1_TSEG1_MASK 0xf
256 #define BTR1_TSEG2_SHIFT 4
257 #define BTR1_TSEG2_MASK (0x7 << BTR1_TSEG2_SHIFT)
258 #define BTR1_SAM_SHIFT 7
260 #define BTR0_SET_BRP(brp) (((brp) - 1) & BTR0_BRP_MASK)
261 #define BTR0_SET_SJW(sjw) ((((sjw) - 1) << BTR0_SJW_SHIFT) & \
264 #define BTR1_SET_TSEG1(tseg1) (((tseg1) - 1) & BTR1_TSEG1_MASK)
265 #define BTR1_SET_TSEG2(tseg2) ((((tseg2) - 1) << BTR1_TSEG2_SHIFT) & \
267 #define BTR1_SET_SAM(sam) ((sam) ? 1 << BTR1_SAM_SHIFT : 0)
269 #define F_RX_PROGRESS 0
270 #define F_TX_PROGRESS 1
271 #define F_TX_WAIT_ALL 2
273 #define TX_QUEUE_SIZE 3