aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/can/bfin_can.c110
1 files changed, 109 insertions, 1 deletions
diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c
index 8039703481a7..27ad312e7abf 100644
--- a/drivers/net/can/bfin_can.c
+++ b/drivers/net/can/bfin_can.c
@@ -20,13 +20,121 @@
20#include <linux/can/dev.h> 20#include <linux/can/dev.h>
21#include <linux/can/error.h> 21#include <linux/can/error.h>
22 22
23#include <asm/bfin_can.h>
24#include <asm/portmux.h> 23#include <asm/portmux.h>
25 24
26#define DRV_NAME "bfin_can" 25#define DRV_NAME "bfin_can"
27#define BFIN_CAN_TIMEOUT 100 26#define BFIN_CAN_TIMEOUT 100
28#define TX_ECHO_SKB_MAX 1 27#define TX_ECHO_SKB_MAX 1
29 28
29/* transmit and receive channels */
30#define TRANSMIT_CHL 24
31#define RECEIVE_STD_CHL 0
32#define RECEIVE_EXT_CHL 4
33#define RECEIVE_RTR_CHL 8
34#define RECEIVE_EXT_RTR_CHL 12
35#define MAX_CHL_NUMBER 32
36
37/* All Blackfin system MMRs are padded to 32bits even if the register
38 * itself is only 16bits. So use a helper macro to streamline this
39 */
40#define __BFP(m) u16 m; u16 __pad_##m
41
42/* bfin can registers layout */
43struct bfin_can_mask_regs {
44 __BFP(aml);
45 __BFP(amh);
46};
47
48struct bfin_can_channel_regs {
49 /* data[0,2,4,6] -> data{0,1,2,3} while data[1,3,5,7] is padding */
50 u16 data[8];
51 __BFP(dlc);
52 __BFP(tsv);
53 __BFP(id0);
54 __BFP(id1);
55};
56
57struct bfin_can_regs {
58 /* global control and status registers */
59 __BFP(mc1); /* offset 0x00 */
60 __BFP(md1); /* offset 0x04 */
61 __BFP(trs1); /* offset 0x08 */
62 __BFP(trr1); /* offset 0x0c */
63 __BFP(ta1); /* offset 0x10 */
64 __BFP(aa1); /* offset 0x14 */
65 __BFP(rmp1); /* offset 0x18 */
66 __BFP(rml1); /* offset 0x1c */
67 __BFP(mbtif1); /* offset 0x20 */
68 __BFP(mbrif1); /* offset 0x24 */
69 __BFP(mbim1); /* offset 0x28 */
70 __BFP(rfh1); /* offset 0x2c */
71 __BFP(opss1); /* offset 0x30 */
72 u32 __pad1[3];
73 __BFP(mc2); /* offset 0x40 */
74 __BFP(md2); /* offset 0x44 */
75 __BFP(trs2); /* offset 0x48 */
76 __BFP(trr2); /* offset 0x4c */
77 __BFP(ta2); /* offset 0x50 */
78 __BFP(aa2); /* offset 0x54 */
79 __BFP(rmp2); /* offset 0x58 */
80 __BFP(rml2); /* offset 0x5c */
81 __BFP(mbtif2); /* offset 0x60 */
82 __BFP(mbrif2); /* offset 0x64 */
83 __BFP(mbim2); /* offset 0x68 */
84 __BFP(rfh2); /* offset 0x6c */
85 __BFP(opss2); /* offset 0x70 */
86 u32 __pad2[3];
87 __BFP(clock); /* offset 0x80 */
88 __BFP(timing); /* offset 0x84 */
89 __BFP(debug); /* offset 0x88 */
90 __BFP(status); /* offset 0x8c */
91 __BFP(cec); /* offset 0x90 */
92 __BFP(gis); /* offset 0x94 */
93 __BFP(gim); /* offset 0x98 */
94 __BFP(gif); /* offset 0x9c */
95 __BFP(control); /* offset 0xa0 */
96 __BFP(intr); /* offset 0xa4 */
97 __BFP(version); /* offset 0xa8 */
98 __BFP(mbtd); /* offset 0xac */
99 __BFP(ewr); /* offset 0xb0 */
100 __BFP(esr); /* offset 0xb4 */
101 u32 __pad3[2];
102 __BFP(ucreg); /* offset 0xc0 */
103 __BFP(uccnt); /* offset 0xc4 */
104 __BFP(ucrc); /* offset 0xc8 */
105 __BFP(uccnf); /* offset 0xcc */
106 u32 __pad4[1];
107 __BFP(version2); /* offset 0xd4 */
108 u32 __pad5[10];
109
110 /* channel(mailbox) mask and message registers */
111 struct bfin_can_mask_regs msk[MAX_CHL_NUMBER]; /* offset 0x100 */
112 struct bfin_can_channel_regs chl[MAX_CHL_NUMBER]; /* offset 0x200 */
113};
114
115#undef __BFP
116
117#define SRS 0x0001 /* Software Reset */
118#define SER 0x0008 /* Stuff Error */
119#define BOIM 0x0008 /* Enable Bus Off Interrupt */
120#define CCR 0x0080 /* CAN Configuration Mode Request */
121#define CCA 0x0080 /* Configuration Mode Acknowledge */
122#define SAM 0x0080 /* Sampling */
123#define AME 0x8000 /* Acceptance Mask Enable */
124#define RMLIM 0x0080 /* Enable RX Message Lost Interrupt */
125#define RMLIS 0x0080 /* RX Message Lost IRQ Status */
126#define RTR 0x4000 /* Remote Frame Transmission Request */
127#define BOIS 0x0008 /* Bus Off IRQ Status */
128#define IDE 0x2000 /* Identifier Extension */
129#define EPIS 0x0004 /* Error-Passive Mode IRQ Status */
130#define EPIM 0x0004 /* Enable Error-Passive Mode Interrupt */
131#define EWTIS 0x0001 /* TX Error Count IRQ Status */
132#define EWRIS 0x0002 /* RX Error Count IRQ Status */
133#define BEF 0x0040 /* Bit Error Flag */
134#define FER 0x0080 /* Form Error Flag */
135#define SMR 0x0020 /* Sleep Mode Request */
136#define SMACK 0x0008 /* Sleep Mode Acknowledge */
137
30/* 138/*
31 * bfin can private data 139 * bfin can private data
32 */ 140 */