aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can/c_can/c_can.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/can/c_can/c_can.h')
-rw-r--r--drivers/net/can/c_can/c_can.h118
1 files changed, 80 insertions, 38 deletions
diff --git a/drivers/net/can/c_can/c_can.h b/drivers/net/can/c_can/c_can.h
index 5f32d34af507..d1e141e3b99c 100644
--- a/drivers/net/can/c_can/c_can.h
+++ b/drivers/net/can/c_can/c_can.h
@@ -22,43 +22,84 @@
22#ifndef C_CAN_H 22#ifndef C_CAN_H
23#define C_CAN_H 23#define C_CAN_H
24 24
25/* c_can IF registers */ 25enum reg {
26struct c_can_if_regs { 26 C_CAN_CTRL_REG = 0,
27 u16 com_req; 27 C_CAN_STS_REG,
28 u16 com_mask; 28 C_CAN_ERR_CNT_REG,
29 u16 mask1; 29 C_CAN_BTR_REG,
30 u16 mask2; 30 C_CAN_INT_REG,
31 u16 arb1; 31 C_CAN_TEST_REG,
32 u16 arb2; 32 C_CAN_BRPEXT_REG,
33 u16 msg_cntrl; 33 C_CAN_IF1_COMREQ_REG,
34 u16 data[4]; 34 C_CAN_IF1_COMMSK_REG,
35 u16 _reserved[13]; 35 C_CAN_IF1_MASK1_REG,
36 C_CAN_IF1_MASK2_REG,
37 C_CAN_IF1_ARB1_REG,
38 C_CAN_IF1_ARB2_REG,
39 C_CAN_IF1_MSGCTRL_REG,
40 C_CAN_IF1_DATA1_REG,
41 C_CAN_IF1_DATA2_REG,
42 C_CAN_IF1_DATA3_REG,
43 C_CAN_IF1_DATA4_REG,
44 C_CAN_IF2_COMREQ_REG,
45 C_CAN_IF2_COMMSK_REG,
46 C_CAN_IF2_MASK1_REG,
47 C_CAN_IF2_MASK2_REG,
48 C_CAN_IF2_ARB1_REG,
49 C_CAN_IF2_ARB2_REG,
50 C_CAN_IF2_MSGCTRL_REG,
51 C_CAN_IF2_DATA1_REG,
52 C_CAN_IF2_DATA2_REG,
53 C_CAN_IF2_DATA3_REG,
54 C_CAN_IF2_DATA4_REG,
55 C_CAN_TXRQST1_REG,
56 C_CAN_TXRQST2_REG,
57 C_CAN_NEWDAT1_REG,
58 C_CAN_NEWDAT2_REG,
59 C_CAN_INTPND1_REG,
60 C_CAN_INTPND2_REG,
61 C_CAN_MSGVAL1_REG,
62 C_CAN_MSGVAL2_REG,
36}; 63};
37 64
38/* c_can hardware registers */ 65static const u16 reg_map_c_can[] = {
39struct c_can_regs { 66 [C_CAN_CTRL_REG] = 0x00,
40 u16 control; 67 [C_CAN_STS_REG] = 0x02,
41 u16 status; 68 [C_CAN_ERR_CNT_REG] = 0x04,
42 u16 err_cnt; 69 [C_CAN_BTR_REG] = 0x06,
43 u16 btr; 70 [C_CAN_INT_REG] = 0x08,
44 u16 interrupt; 71 [C_CAN_TEST_REG] = 0x0A,
45 u16 test; 72 [C_CAN_BRPEXT_REG] = 0x0C,
46 u16 brp_ext; 73 [C_CAN_IF1_COMREQ_REG] = 0x10,
47 u16 _reserved1; 74 [C_CAN_IF1_COMMSK_REG] = 0x12,
48 struct c_can_if_regs ifregs[2]; /* [0] = IF1 and [1] = IF2 */ 75 [C_CAN_IF1_MASK1_REG] = 0x14,
49 u16 _reserved2[8]; 76 [C_CAN_IF1_MASK2_REG] = 0x16,
50 u16 txrqst1; 77 [C_CAN_IF1_ARB1_REG] = 0x18,
51 u16 txrqst2; 78 [C_CAN_IF1_ARB2_REG] = 0x1A,
52 u16 _reserved3[6]; 79 [C_CAN_IF1_MSGCTRL_REG] = 0x1C,
53 u16 newdat1; 80 [C_CAN_IF1_DATA1_REG] = 0x1E,
54 u16 newdat2; 81 [C_CAN_IF1_DATA2_REG] = 0x20,
55 u16 _reserved4[6]; 82 [C_CAN_IF1_DATA3_REG] = 0x22,
56 u16 intpnd1; 83 [C_CAN_IF1_DATA4_REG] = 0x24,
57 u16 intpnd2; 84 [C_CAN_IF2_COMREQ_REG] = 0x40,
58 u16 _reserved5[6]; 85 [C_CAN_IF2_COMMSK_REG] = 0x42,
59 u16 msgval1; 86 [C_CAN_IF2_MASK1_REG] = 0x44,
60 u16 msgval2; 87 [C_CAN_IF2_MASK2_REG] = 0x46,
61 u16 _reserved6[6]; 88 [C_CAN_IF2_ARB1_REG] = 0x48,
89 [C_CAN_IF2_ARB2_REG] = 0x4A,
90 [C_CAN_IF2_MSGCTRL_REG] = 0x4C,
91 [C_CAN_IF2_DATA1_REG] = 0x4E,
92 [C_CAN_IF2_DATA2_REG] = 0x50,
93 [C_CAN_IF2_DATA3_REG] = 0x52,
94 [C_CAN_IF2_DATA4_REG] = 0x54,
95 [C_CAN_TXRQST1_REG] = 0x80,
96 [C_CAN_TXRQST2_REG] = 0x82,
97 [C_CAN_NEWDAT1_REG] = 0x90,
98 [C_CAN_NEWDAT2_REG] = 0x92,
99 [C_CAN_INTPND1_REG] = 0xA0,
100 [C_CAN_INTPND2_REG] = 0xA2,
101 [C_CAN_MSGVAL1_REG] = 0xB0,
102 [C_CAN_MSGVAL2_REG] = 0xB2,
62}; 103};
63 104
64/* c_can private data structure */ 105/* c_can private data structure */
@@ -69,9 +110,10 @@ struct c_can_priv {
69 int tx_object; 110 int tx_object;
70 int current_status; 111 int current_status;
71 int last_status; 112 int last_status;
72 u16 (*read_reg) (struct c_can_priv *priv, void *reg); 113 u16 (*read_reg) (struct c_can_priv *priv, enum reg index);
73 void (*write_reg) (struct c_can_priv *priv, void *reg, u16 val); 114 void (*write_reg) (struct c_can_priv *priv, enum reg index, u16 val);
74 struct c_can_regs __iomem *regs; 115 void __iomem *base;
116 const u16 *regs;
75 unsigned long irq_flags; /* for request_irq() */ 117 unsigned long irq_flags; /* for request_irq() */
76 unsigned int tx_next; 118 unsigned int tx_next;
77 unsigned int tx_echo; 119 unsigned int tx_echo;