aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomoya <tomoya-linux@dsn.okisemi.com>2010-11-16 20:13:16 -0500
committerDavid S. Miller <davem@davemloft.net>2010-11-18 15:05:35 -0500
commit086b5650dcdaae7c4aa60a5d0724f775e733610e (patch)
tree6473aa19ab7c66032c0d7ec66f11576858142b6e
parent30dfe2c05037fbc021121c037872c09956938c2f (diff)
can: EG20T PCH: add prefix to macro
For easy to readable/identifiable, add prefix "PCH_" to all of #define macros. Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com> Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/can/pch_can.c391
1 files changed, 189 insertions, 202 deletions
diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c
index 672718261c68..c523e3dd5d10 100644
--- a/drivers/net/can/pch_can.c
+++ b/drivers/net/can/pch_can.c
@@ -32,49 +32,47 @@
32#include <linux/can/dev.h> 32#include <linux/can/dev.h>
33#include <linux/can/error.h> 33#include <linux/can/error.h>
34 34
35#define MAX_MSG_OBJ 32 35#define PCH_MAX_MSG_OBJ 32
36#define MSG_OBJ_RX 0 /* The receive message object flag. */ 36#define PCH_MSG_OBJ_RX 0 /* The receive message object flag. */
37#define MSG_OBJ_TX 1 /* The transmit message object flag. */ 37#define PCH_MSG_OBJ_TX 1 /* The transmit message object flag. */
38 38
39#define ENABLE 1 /* The enable flag */ 39#define PCH_ENABLE 1 /* The enable flag */
40#define DISABLE 0 /* The disable flag */ 40#define PCH_DISABLE 0 /* The disable flag */
41#define CAN_CTRL_INIT 0x0001 /* The INIT bit of CANCONT register. */ 41#define PCH_CTRL_INIT 0x0001 /* The INIT bit of CANCONT register. */
42#define CAN_CTRL_IE 0x0002 /* The IE bit of CAN control register */ 42#define PCH_CTRL_IE 0x0002 /* The IE bit of CAN control register */
43#define CAN_CTRL_IE_SIE_EIE 0x000e 43#define PCH_CTRL_IE_SIE_EIE 0x000e
44#define CAN_CTRL_CCE 0x0040 44#define PCH_CTRL_CCE 0x0040
45#define CAN_CTRL_OPT 0x0080 /* The OPT bit of CANCONT register. */ 45#define PCH_CTRL_OPT 0x0080 /* The OPT bit of CANCONT register. */
46#define CAN_OPT_SILENT 0x0008 /* The Silent bit of CANOPT reg. */ 46#define PCH_OPT_SILENT 0x0008 /* The Silent bit of CANOPT reg. */
47#define CAN_OPT_LBACK 0x0010 /* The LoopBack bit of CANOPT reg. */ 47#define PCH_OPT_LBACK 0x0010 /* The LoopBack bit of CANOPT reg. */
48#define CAN_CMASK_RX_TX_SET 0x00f3 48#define PCH_CMASK_RX_TX_SET 0x00f3
49#define CAN_CMASK_RX_TX_GET 0x0073 49#define PCH_CMASK_RX_TX_GET 0x0073
50#define CAN_CMASK_ALL 0xff 50#define PCH_CMASK_ALL 0xff
51#define CAN_CMASK_RDWR 0x80 51#define PCH_CMASK_RDWR 0x80
52#define CAN_CMASK_ARB 0x20 52#define PCH_CMASK_ARB 0x20
53#define CAN_CMASK_CTRL 0x10 53#define PCH_CMASK_CTRL 0x10
54#define CAN_CMASK_MASK 0x40 54#define PCH_CMASK_MASK 0x40
55#define CAN_CMASK_NEWDAT 0x04 55#define PCH_CMASK_NEWDAT 0x04
56#define CAN_CMASK_CLRINTPND 0x08 56#define PCH_CMASK_CLRINTPND 0x08
57 57#define PCH_IF_MCONT_NEWDAT 0x8000
58#define CAN_IF_MCONT_NEWDAT 0x8000 58#define PCH_IF_MCONT_INTPND 0x2000
59#define CAN_IF_MCONT_INTPND 0x2000 59#define PCH_IF_MCONT_UMASK 0x1000
60#define CAN_IF_MCONT_UMASK 0x1000 60#define PCH_IF_MCONT_TXIE 0x0800
61#define CAN_IF_MCONT_TXIE 0x0800 61#define PCH_IF_MCONT_RXIE 0x0400
62#define CAN_IF_MCONT_RXIE 0x0400 62#define PCH_IF_MCONT_RMTEN 0x0200
63#define CAN_IF_MCONT_RMTEN 0x0200 63#define PCH_IF_MCONT_TXRQXT 0x0100
64#define CAN_IF_MCONT_TXRQXT 0x0100 64#define PCH_IF_MCONT_EOB 0x0080
65#define CAN_IF_MCONT_EOB 0x0080 65#define PCH_IF_MCONT_DLC 0x000f
66#define CAN_IF_MCONT_DLC 0x000f 66#define PCH_IF_MCONT_MSGLOST 0x4000
67#define CAN_IF_MCONT_MSGLOST 0x4000 67#define PCH_MASK2_MDIR_MXTD 0xc000
68#define CAN_MASK2_MDIR_MXTD 0xc000 68#define PCH_ID2_DIR 0x2000
69#define CAN_ID2_DIR 0x2000 69#define PCH_ID2_XTD 0x4000
70#define CAN_ID_MSGVAL 0x8000 70#define PCH_ID_MSGVAL 0x8000
71 71#define PCH_IF_CREQ_BUSY 0x8000
72#define CAN_STATUS_INT 0x8000 72
73#define CAN_IF_CREQ_BUSY 0x8000 73#define PCH_STATUS_INT 0x8000
74#define CAN_ID2_XTD 0x4000 74#define PCH_REC 0x00007f00
75 75#define PCH_TEC 0x000000ff
76#define CAN_REC 0x00007f00
77#define CAN_TEC 0x000000ff
78 76
79#define PCH_RX_OK 0x00000010 77#define PCH_RX_OK 0x00000010
80#define PCH_TX_OK 0x00000008 78#define PCH_TX_OK 0x00000008
@@ -93,26 +91,15 @@
93#define PCH_CRC_ERR (PCH_LEC1 | PCH_LEC2) 91#define PCH_CRC_ERR (PCH_LEC1 | PCH_LEC2)
94 92
95/* bit position of certain controller bits. */ 93/* bit position of certain controller bits. */
96#define BIT_BITT_BRP 0 94#define PCH_BIT_BRP 0
97#define BIT_BITT_SJW 6 95#define PCH_BIT_SJW 6
98#define BIT_BITT_TSEG1 8 96#define PCH_BIT_TSEG1 8
99#define BIT_BITT_TSEG2 12 97#define PCH_BIT_TSEG2 12
100#define BIT_IF1_MCONT_RXIE 10 98#define PCH_BIT_BRPE_BRPE 6
101#define BIT_IF2_MCONT_TXIE 11 99#define PCH_MSK_BITT_BRP 0x3f
102#define BIT_BRPE_BRPE 6 100#define PCH_MSK_BRPE_BRPE 0x3c0
103#define BIT_ES_TXERRCNT 0 101#define PCH_MSK_CTRL_IE_SIE_EIE 0x07
104#define BIT_ES_RXERRCNT 8 102#define PCH_COUNTER_LIMIT 10
105#define MSK_BITT_BRP 0x3f
106#define MSK_BITT_SJW 0xc0
107#define MSK_BITT_TSEG1 0xf00
108#define MSK_BITT_TSEG2 0x7000
109#define MSK_BRPE_BRPE 0x3c0
110#define MSK_BRPE_GET 0x0f
111#define MSK_CTRL_IE_SIE_EIE 0x07
112#define MSK_MCONT_TXIE 0x08
113#define MSK_MCONT_RXIE 0x10
114#define PCH_CAN_NO_TX_BUFF 1
115#define COUNTER_LIMIT 10
116 103
117#define PCH_CAN_CLK 50000000 /* 50MHz */ 104#define PCH_CAN_CLK 50000000 /* 50MHz */
118 105
@@ -181,14 +168,14 @@ struct pch_can_priv {
181 struct can_priv can; 168 struct can_priv can;
182 unsigned int can_num; 169 unsigned int can_num;
183 struct pci_dev *dev; 170 struct pci_dev *dev;
184 unsigned int tx_enable[MAX_MSG_OBJ]; 171 unsigned int tx_enable[PCH_MAX_MSG_OBJ];
185 unsigned int rx_enable[MAX_MSG_OBJ]; 172 unsigned int rx_enable[PCH_MAX_MSG_OBJ];
186 unsigned int rx_link[MAX_MSG_OBJ]; 173 unsigned int rx_link[PCH_MAX_MSG_OBJ];
187 unsigned int int_enables; 174 unsigned int int_enables;
188 unsigned int int_stat; 175 unsigned int int_stat;
189 struct net_device *ndev; 176 struct net_device *ndev;
190 spinlock_t msgif_reg_lock; /* Message Interface Registers Access Lock*/ 177 spinlock_t msgif_reg_lock; /* Message Interface Registers Access Lock*/
191 unsigned int msg_obj[MAX_MSG_OBJ]; 178 unsigned int msg_obj[PCH_MAX_MSG_OBJ];
192 struct pch_can_regs __iomem *regs; 179 struct pch_can_regs __iomem *regs;
193 struct napi_struct napi; 180 struct napi_struct napi;
194 unsigned int tx_obj; /* Point next Tx Obj index */ 181 unsigned int tx_obj; /* Point next Tx Obj index */
@@ -228,11 +215,11 @@ static void pch_can_set_run_mode(struct pch_can_priv *priv,
228{ 215{
229 switch (mode) { 216 switch (mode) {
230 case PCH_CAN_RUN: 217 case PCH_CAN_RUN:
231 pch_can_bit_clear(&priv->regs->cont, CAN_CTRL_INIT); 218 pch_can_bit_clear(&priv->regs->cont, PCH_CTRL_INIT);
232 break; 219 break;
233 220
234 case PCH_CAN_STOP: 221 case PCH_CAN_STOP:
235 pch_can_bit_set(&priv->regs->cont, CAN_CTRL_INIT); 222 pch_can_bit_set(&priv->regs->cont, PCH_CTRL_INIT);
236 break; 223 break;
237 224
238 default: 225 default:
@@ -246,30 +233,30 @@ static void pch_can_set_optmode(struct pch_can_priv *priv)
246 u32 reg_val = ioread32(&priv->regs->opt); 233 u32 reg_val = ioread32(&priv->regs->opt);
247 234
248 if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) 235 if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)
249 reg_val |= CAN_OPT_SILENT; 236 reg_val |= PCH_OPT_SILENT;
250 237
251 if (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK) 238 if (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK)
252 reg_val |= CAN_OPT_LBACK; 239 reg_val |= PCH_OPT_LBACK;
253 240
254 pch_can_bit_set(&priv->regs->cont, CAN_CTRL_OPT); 241 pch_can_bit_set(&priv->regs->cont, PCH_CTRL_OPT);
255 iowrite32(reg_val, &priv->regs->opt); 242 iowrite32(reg_val, &priv->regs->opt);
256} 243}
257 244
258static void pch_can_set_int_custom(struct pch_can_priv *priv) 245static void pch_can_set_int_custom(struct pch_can_priv *priv)
259{ 246{
260 /* Clearing the IE, SIE and EIE bits of Can control register. */ 247 /* Clearing the IE, SIE and EIE bits of Can control register. */
261 pch_can_bit_clear(&priv->regs->cont, CAN_CTRL_IE_SIE_EIE); 248 pch_can_bit_clear(&priv->regs->cont, PCH_CTRL_IE_SIE_EIE);
262 249
263 /* Appropriately setting them. */ 250 /* Appropriately setting them. */
264 pch_can_bit_set(&priv->regs->cont, 251 pch_can_bit_set(&priv->regs->cont,
265 ((priv->int_enables & MSK_CTRL_IE_SIE_EIE) << 1)); 252 ((priv->int_enables & PCH_MSK_CTRL_IE_SIE_EIE) << 1));
266} 253}
267 254
268/* This function retrieves interrupt enabled for the CAN device. */ 255/* This function retrieves interrupt enabled for the CAN device. */
269static void pch_can_get_int_enables(struct pch_can_priv *priv, u32 *enables) 256static void pch_can_get_int_enables(struct pch_can_priv *priv, u32 *enables)
270{ 257{
271 /* Obtaining the status of IE, SIE and EIE interrupt bits. */ 258 /* Obtaining the status of IE, SIE and EIE interrupt bits. */
272 *enables = ((ioread32(&priv->regs->cont) & CAN_CTRL_IE_SIE_EIE) >> 1); 259 *enables = ((ioread32(&priv->regs->cont) & PCH_CTRL_IE_SIE_EIE) >> 1);
273} 260}
274 261
275static void pch_can_set_int_enables(struct pch_can_priv *priv, 262static void pch_can_set_int_enables(struct pch_can_priv *priv,
@@ -277,19 +264,19 @@ static void pch_can_set_int_enables(struct pch_can_priv *priv,
277{ 264{
278 switch (interrupt_no) { 265 switch (interrupt_no) {
279 case PCH_CAN_ENABLE: 266 case PCH_CAN_ENABLE:
280 pch_can_bit_set(&priv->regs->cont, CAN_CTRL_IE); 267 pch_can_bit_set(&priv->regs->cont, PCH_CTRL_IE);
281 break; 268 break;
282 269
283 case PCH_CAN_DISABLE: 270 case PCH_CAN_DISABLE:
284 pch_can_bit_clear(&priv->regs->cont, CAN_CTRL_IE); 271 pch_can_bit_clear(&priv->regs->cont, PCH_CTRL_IE);
285 break; 272 break;
286 273
287 case PCH_CAN_ALL: 274 case PCH_CAN_ALL:
288 pch_can_bit_set(&priv->regs->cont, CAN_CTRL_IE_SIE_EIE); 275 pch_can_bit_set(&priv->regs->cont, PCH_CTRL_IE_SIE_EIE);
289 break; 276 break;
290 277
291 case PCH_CAN_NONE: 278 case PCH_CAN_NONE:
292 pch_can_bit_clear(&priv->regs->cont, CAN_CTRL_IE_SIE_EIE); 279 pch_can_bit_clear(&priv->regs->cont, PCH_CTRL_IE_SIE_EIE);
293 break; 280 break;
294 281
295 default: 282 default:
@@ -300,12 +287,12 @@ static void pch_can_set_int_enables(struct pch_can_priv *priv,
300 287
301static void pch_can_check_if_busy(u32 __iomem *creq_addr, u32 num) 288static void pch_can_check_if_busy(u32 __iomem *creq_addr, u32 num)
302{ 289{
303 u32 counter = COUNTER_LIMIT; 290 u32 counter = PCH_COUNTER_LIMIT;
304 u32 ifx_creq; 291 u32 ifx_creq;
305 292
306 iowrite32(num, creq_addr); 293 iowrite32(num, creq_addr);
307 while (counter) { 294 while (counter) {
308 ifx_creq = ioread32(creq_addr) & CAN_IF_CREQ_BUSY; 295 ifx_creq = ioread32(creq_addr) & PCH_IF_CREQ_BUSY;
309 if (!ifx_creq) 296 if (!ifx_creq)
310 break; 297 break;
311 counter--; 298 counter--;
@@ -322,22 +309,22 @@ static void pch_can_set_rx_enable(struct pch_can_priv *priv, u32 buff_num,
322 309
323 spin_lock_irqsave(&priv->msgif_reg_lock, flags); 310 spin_lock_irqsave(&priv->msgif_reg_lock, flags);
324 /* Reading the receive buffer data from RAM to Interface1 registers */ 311 /* Reading the receive buffer data from RAM to Interface1 registers */
325 iowrite32(CAN_CMASK_RX_TX_GET, &priv->regs->if1_cmask); 312 iowrite32(PCH_CMASK_RX_TX_GET, &priv->regs->if1_cmask);
326 pch_can_check_if_busy(&priv->regs->if1_creq, buff_num); 313 pch_can_check_if_busy(&priv->regs->if1_creq, buff_num);
327 314
328 /* Setting the IF1MASK1 register to access MsgVal and RxIE bits */ 315 /* Setting the IF1MASK1 register to access MsgVal and RxIE bits */
329 iowrite32(CAN_CMASK_RDWR | CAN_CMASK_ARB | CAN_CMASK_CTRL, 316 iowrite32(PCH_CMASK_RDWR | PCH_CMASK_ARB | PCH_CMASK_CTRL,
330 &priv->regs->if1_cmask); 317 &priv->regs->if1_cmask);
331 318
332 if (set == ENABLE) { 319 if (set == PCH_ENABLE) {
333 /* Setting the MsgVal and RxIE bits */ 320 /* Setting the MsgVal and RxIE bits */
334 pch_can_bit_set(&priv->regs->if1_mcont, CAN_IF_MCONT_RXIE); 321 pch_can_bit_set(&priv->regs->if1_mcont, PCH_IF_MCONT_RXIE);
335 pch_can_bit_set(&priv->regs->if1_id2, CAN_ID_MSGVAL); 322 pch_can_bit_set(&priv->regs->if1_id2, PCH_ID_MSGVAL);
336 323
337 } else if (set == DISABLE) { 324 } else if (set == PCH_DISABLE) {
338 /* Resetting the MsgVal and RxIE bits */ 325 /* Resetting the MsgVal and RxIE bits */
339 pch_can_bit_clear(&priv->regs->if1_mcont, CAN_IF_MCONT_RXIE); 326 pch_can_bit_clear(&priv->regs->if1_mcont, PCH_IF_MCONT_RXIE);
340 pch_can_bit_clear(&priv->regs->if1_id2, CAN_ID_MSGVAL); 327 pch_can_bit_clear(&priv->regs->if1_id2, PCH_ID_MSGVAL);
341 } 328 }
342 329
343 pch_can_check_if_busy(&priv->regs->if1_creq, buff_num); 330 pch_can_check_if_busy(&priv->regs->if1_creq, buff_num);
@@ -350,8 +337,8 @@ static void pch_can_rx_enable_all(struct pch_can_priv *priv)
350 337
351 /* Traversing to obtain the object configured as receivers. */ 338 /* Traversing to obtain the object configured as receivers. */
352 for (i = 0; i < PCH_OBJ_NUM; i++) { 339 for (i = 0; i < PCH_OBJ_NUM; i++) {
353 if (priv->msg_obj[i] == MSG_OBJ_RX) 340 if (priv->msg_obj[i] == PCH_MSG_OBJ_RX)
354 pch_can_set_rx_enable(priv, i + 1, ENABLE); 341 pch_can_set_rx_enable(priv, i + 1, PCH_ENABLE);
355 } 342 }
356} 343}
357 344
@@ -361,8 +348,8 @@ static void pch_can_rx_disable_all(struct pch_can_priv *priv)
361 348
362 /* Traversing to obtain the object configured as receivers. */ 349 /* Traversing to obtain the object configured as receivers. */
363 for (i = 0; i < PCH_OBJ_NUM; i++) { 350 for (i = 0; i < PCH_OBJ_NUM; i++) {
364 if (priv->msg_obj[i] == MSG_OBJ_RX) 351 if (priv->msg_obj[i] == PCH_MSG_OBJ_RX)
365 pch_can_set_rx_enable(priv, i + 1, DISABLE); 352 pch_can_set_rx_enable(priv, i + 1, PCH_DISABLE);
366 } 353 }
367} 354}
368 355
@@ -373,22 +360,22 @@ static void pch_can_set_tx_enable(struct pch_can_priv *priv, u32 buff_num,
373 360
374 spin_lock_irqsave(&priv->msgif_reg_lock, flags); 361 spin_lock_irqsave(&priv->msgif_reg_lock, flags);
375 /* Reading the Msg buffer from Message RAM to Interface2 registers. */ 362 /* Reading the Msg buffer from Message RAM to Interface2 registers. */
376 iowrite32(CAN_CMASK_RX_TX_GET, &priv->regs->if2_cmask); 363 iowrite32(PCH_CMASK_RX_TX_GET, &priv->regs->if2_cmask);
377 pch_can_check_if_busy(&priv->regs->if2_creq, buff_num); 364 pch_can_check_if_busy(&priv->regs->if2_creq, buff_num);
378 365
379 /* Setting the IF2CMASK register for accessing the 366 /* Setting the IF2CMASK register for accessing the
380 MsgVal and TxIE bits */ 367 MsgVal and TxIE bits */
381 iowrite32(CAN_CMASK_RDWR | CAN_CMASK_ARB | CAN_CMASK_CTRL, 368 iowrite32(PCH_CMASK_RDWR | PCH_CMASK_ARB | PCH_CMASK_CTRL,
382 &priv->regs->if2_cmask); 369 &priv->regs->if2_cmask);
383 370
384 if (set == ENABLE) { 371 if (set == PCH_ENABLE) {
385 /* Setting the MsgVal and TxIE bits */ 372 /* Setting the MsgVal and TxIE bits */
386 pch_can_bit_set(&priv->regs->if2_mcont, CAN_IF_MCONT_TXIE); 373 pch_can_bit_set(&priv->regs->if2_mcont, PCH_IF_MCONT_TXIE);
387 pch_can_bit_set(&priv->regs->if2_id2, CAN_ID_MSGVAL); 374 pch_can_bit_set(&priv->regs->if2_id2, PCH_ID_MSGVAL);
388 } else if (set == DISABLE) { 375 } else if (set == PCH_DISABLE) {
389 /* Resetting the MsgVal and TxIE bits. */ 376 /* Resetting the MsgVal and TxIE bits. */
390 pch_can_bit_clear(&priv->regs->if2_mcont, CAN_IF_MCONT_TXIE); 377 pch_can_bit_clear(&priv->regs->if2_mcont, PCH_IF_MCONT_TXIE);
391 pch_can_bit_clear(&priv->regs->if2_id2, CAN_ID_MSGVAL); 378 pch_can_bit_clear(&priv->regs->if2_id2, PCH_ID_MSGVAL);
392 } 379 }
393 380
394 pch_can_check_if_busy(&priv->regs->if2_creq, buff_num); 381 pch_can_check_if_busy(&priv->regs->if2_creq, buff_num);
@@ -401,8 +388,8 @@ static void pch_can_tx_enable_all(struct pch_can_priv *priv)
401 388
402 /* Traversing to obtain the object configured as transmit object. */ 389 /* Traversing to obtain the object configured as transmit object. */
403 for (i = 0; i < PCH_OBJ_NUM; i++) { 390 for (i = 0; i < PCH_OBJ_NUM; i++) {
404 if (priv->msg_obj[i] == MSG_OBJ_TX) 391 if (priv->msg_obj[i] == PCH_MSG_OBJ_TX)
405 pch_can_set_tx_enable(priv, i + 1, ENABLE); 392 pch_can_set_tx_enable(priv, i + 1, PCH_ENABLE);
406 } 393 }
407} 394}
408 395
@@ -412,8 +399,8 @@ static void pch_can_tx_disable_all(struct pch_can_priv *priv)
412 399
413 /* Traversing to obtain the object configured as transmit object. */ 400 /* Traversing to obtain the object configured as transmit object. */
414 for (i = 0; i < PCH_OBJ_NUM; i++) { 401 for (i = 0; i < PCH_OBJ_NUM; i++) {
415 if (priv->msg_obj[i] == MSG_OBJ_TX) 402 if (priv->msg_obj[i] == PCH_MSG_OBJ_TX)
416 pch_can_set_tx_enable(priv, i + 1, DISABLE); 403 pch_can_set_tx_enable(priv, i + 1, PCH_DISABLE);
417 } 404 }
418} 405}
419 406
@@ -423,15 +410,15 @@ static void pch_can_get_rx_enable(struct pch_can_priv *priv, u32 buff_num,
423 unsigned long flags; 410 unsigned long flags;
424 411
425 spin_lock_irqsave(&priv->msgif_reg_lock, flags); 412 spin_lock_irqsave(&priv->msgif_reg_lock, flags);
426 iowrite32(CAN_CMASK_RX_TX_GET, &priv->regs->if1_cmask); 413 iowrite32(PCH_CMASK_RX_TX_GET, &priv->regs->if1_cmask);
427 pch_can_check_if_busy(&priv->regs->if1_creq, buff_num); 414 pch_can_check_if_busy(&priv->regs->if1_creq, buff_num);
428 415
429 if (((ioread32(&priv->regs->if1_id2)) & CAN_ID_MSGVAL) && 416 if (((ioread32(&priv->regs->if1_id2)) & PCH_ID_MSGVAL) &&
430 ((ioread32(&priv->regs->if1_mcont)) & 417 ((ioread32(&priv->regs->if1_mcont)) &
431 CAN_IF_MCONT_RXIE)) 418 PCH_IF_MCONT_RXIE))
432 *enable = ENABLE; 419 *enable = PCH_ENABLE;
433 else 420 else
434 *enable = DISABLE; 421 *enable = PCH_DISABLE;
435 spin_unlock_irqrestore(&priv->msgif_reg_lock, flags); 422 spin_unlock_irqrestore(&priv->msgif_reg_lock, flags);
436} 423}
437 424
@@ -441,15 +428,15 @@ static void pch_can_get_tx_enable(struct pch_can_priv *priv, u32 buff_num,
441 unsigned long flags; 428 unsigned long flags;
442 429
443 spin_lock_irqsave(&priv->msgif_reg_lock, flags); 430 spin_lock_irqsave(&priv->msgif_reg_lock, flags);
444 iowrite32(CAN_CMASK_RX_TX_GET, &priv->regs->if2_cmask); 431 iowrite32(PCH_CMASK_RX_TX_GET, &priv->regs->if2_cmask);
445 pch_can_check_if_busy(&priv->regs->if2_creq, buff_num); 432 pch_can_check_if_busy(&priv->regs->if2_creq, buff_num);
446 433
447 if (((ioread32(&priv->regs->if2_id2)) & CAN_ID_MSGVAL) && 434 if (((ioread32(&priv->regs->if2_id2)) & PCH_ID_MSGVAL) &&
448 ((ioread32(&priv->regs->if2_mcont)) & 435 ((ioread32(&priv->regs->if2_mcont)) &
449 CAN_IF_MCONT_TXIE)) { 436 PCH_IF_MCONT_TXIE)) {
450 *enable = ENABLE; 437 *enable = PCH_ENABLE;
451 } else { 438 } else {
452 *enable = DISABLE; 439 *enable = PCH_DISABLE;
453 } 440 }
454 spin_unlock_irqrestore(&priv->msgif_reg_lock, flags); 441 spin_unlock_irqrestore(&priv->msgif_reg_lock, flags);
455} 442}
@@ -465,13 +452,13 @@ static void pch_can_set_rx_buffer_link(struct pch_can_priv *priv,
465 unsigned long flags; 452 unsigned long flags;
466 453
467 spin_lock_irqsave(&priv->msgif_reg_lock, flags); 454 spin_lock_irqsave(&priv->msgif_reg_lock, flags);
468 iowrite32(CAN_CMASK_RX_TX_GET, &priv->regs->if1_cmask); 455 iowrite32(PCH_CMASK_RX_TX_GET, &priv->regs->if1_cmask);
469 pch_can_check_if_busy(&priv->regs->if1_creq, buffer_num); 456 pch_can_check_if_busy(&priv->regs->if1_creq, buffer_num);
470 iowrite32(CAN_CMASK_RDWR | CAN_CMASK_CTRL, &priv->regs->if1_cmask); 457 iowrite32(PCH_CMASK_RDWR | PCH_CMASK_CTRL, &priv->regs->if1_cmask);
471 if (set == ENABLE) 458 if (set == PCH_ENABLE)
472 pch_can_bit_clear(&priv->regs->if1_mcont, CAN_IF_MCONT_EOB); 459 pch_can_bit_clear(&priv->regs->if1_mcont, PCH_IF_MCONT_EOB);
473 else 460 else
474 pch_can_bit_set(&priv->regs->if1_mcont, CAN_IF_MCONT_EOB); 461 pch_can_bit_set(&priv->regs->if1_mcont, PCH_IF_MCONT_EOB);
475 462
476 pch_can_check_if_busy(&priv->regs->if1_creq, buffer_num); 463 pch_can_check_if_busy(&priv->regs->if1_creq, buffer_num);
477 spin_unlock_irqrestore(&priv->msgif_reg_lock, flags); 464 spin_unlock_irqrestore(&priv->msgif_reg_lock, flags);
@@ -483,13 +470,13 @@ static void pch_can_get_rx_buffer_link(struct pch_can_priv *priv,
483 unsigned long flags; 470 unsigned long flags;
484 471
485 spin_lock_irqsave(&priv->msgif_reg_lock, flags); 472 spin_lock_irqsave(&priv->msgif_reg_lock, flags);
486 iowrite32(CAN_CMASK_RX_TX_GET, &priv->regs->if1_cmask); 473 iowrite32(PCH_CMASK_RX_TX_GET, &priv->regs->if1_cmask);
487 pch_can_check_if_busy(&priv->regs->if1_creq, buffer_num); 474 pch_can_check_if_busy(&priv->regs->if1_creq, buffer_num);
488 475
489 if (ioread32(&priv->regs->if1_mcont) & CAN_IF_MCONT_EOB) 476 if (ioread32(&priv->regs->if1_mcont) & PCH_IF_MCONT_EOB)
490 *link = DISABLE; 477 *link = PCH_DISABLE;
491 else 478 else
492 *link = ENABLE; 479 *link = PCH_ENABLE;
493 spin_unlock_irqrestore(&priv->msgif_reg_lock, flags); 480 spin_unlock_irqrestore(&priv->msgif_reg_lock, flags);
494} 481}
495 482
@@ -498,7 +485,7 @@ static void pch_can_clear_buffers(struct pch_can_priv *priv)
498 int i; 485 int i;
499 486
500 for (i = 0; i < PCH_RX_OBJ_NUM; i++) { 487 for (i = 0; i < PCH_RX_OBJ_NUM; i++) {
501 iowrite32(CAN_CMASK_RX_TX_SET, &priv->regs->if1_cmask); 488 iowrite32(PCH_CMASK_RX_TX_SET, &priv->regs->if1_cmask);
502 iowrite32(0xffff, &priv->regs->if1_mask1); 489 iowrite32(0xffff, &priv->regs->if1_mask1);
503 iowrite32(0xffff, &priv->regs->if1_mask2); 490 iowrite32(0xffff, &priv->regs->if1_mask2);
504 iowrite32(0x0, &priv->regs->if1_id1); 491 iowrite32(0x0, &priv->regs->if1_id1);
@@ -508,14 +495,14 @@ static void pch_can_clear_buffers(struct pch_can_priv *priv)
508 iowrite32(0x0, &priv->regs->if1_dataa2); 495 iowrite32(0x0, &priv->regs->if1_dataa2);
509 iowrite32(0x0, &priv->regs->if1_datab1); 496 iowrite32(0x0, &priv->regs->if1_datab1);
510 iowrite32(0x0, &priv->regs->if1_datab2); 497 iowrite32(0x0, &priv->regs->if1_datab2);
511 iowrite32(CAN_CMASK_RDWR | CAN_CMASK_MASK | 498 iowrite32(PCH_CMASK_RDWR | PCH_CMASK_MASK |
512 CAN_CMASK_ARB | CAN_CMASK_CTRL, 499 PCH_CMASK_ARB | PCH_CMASK_CTRL,
513 &priv->regs->if1_cmask); 500 &priv->regs->if1_cmask);
514 pch_can_check_if_busy(&priv->regs->if1_creq, i+1); 501 pch_can_check_if_busy(&priv->regs->if1_creq, i+1);
515 } 502 }
516 503
517 for (i = i; i < PCH_OBJ_NUM; i++) { 504 for (i = i; i < PCH_OBJ_NUM; i++) {
518 iowrite32(CAN_CMASK_RX_TX_SET, &priv->regs->if2_cmask); 505 iowrite32(PCH_CMASK_RX_TX_SET, &priv->regs->if2_cmask);
519 iowrite32(0xffff, &priv->regs->if2_mask1); 506 iowrite32(0xffff, &priv->regs->if2_mask1);
520 iowrite32(0xffff, &priv->regs->if2_mask2); 507 iowrite32(0xffff, &priv->regs->if2_mask2);
521 iowrite32(0x0, &priv->regs->if2_id1); 508 iowrite32(0x0, &priv->regs->if2_id1);
@@ -525,8 +512,8 @@ static void pch_can_clear_buffers(struct pch_can_priv *priv)
525 iowrite32(0x0, &priv->regs->if2_dataa2); 512 iowrite32(0x0, &priv->regs->if2_dataa2);
526 iowrite32(0x0, &priv->regs->if2_datab1); 513 iowrite32(0x0, &priv->regs->if2_datab1);
527 iowrite32(0x0, &priv->regs->if2_datab2); 514 iowrite32(0x0, &priv->regs->if2_datab2);
528 iowrite32(CAN_CMASK_RDWR | CAN_CMASK_MASK | 515 iowrite32(PCH_CMASK_RDWR | PCH_CMASK_MASK |
529 CAN_CMASK_ARB | CAN_CMASK_CTRL, 516 PCH_CMASK_ARB | PCH_CMASK_CTRL,
530 &priv->regs->if2_cmask); 517 &priv->regs->if2_cmask);
531 pch_can_check_if_busy(&priv->regs->if2_creq, i+1); 518 pch_can_check_if_busy(&priv->regs->if2_creq, i+1);
532 } 519 }
@@ -540,8 +527,8 @@ static void pch_can_config_rx_tx_buffers(struct pch_can_priv *priv)
540 spin_lock_irqsave(&priv->msgif_reg_lock, flags); 527 spin_lock_irqsave(&priv->msgif_reg_lock, flags);
541 528
542 for (i = 0; i < PCH_OBJ_NUM; i++) { 529 for (i = 0; i < PCH_OBJ_NUM; i++) {
543 if (priv->msg_obj[i] == MSG_OBJ_RX) { 530 if (priv->msg_obj[i] == PCH_MSG_OBJ_RX) {
544 iowrite32(CAN_CMASK_RX_TX_GET, 531 iowrite32(PCH_CMASK_RX_TX_GET,
545 &priv->regs->if1_cmask); 532 &priv->regs->if1_cmask);
546 pch_can_check_if_busy(&priv->regs->if1_creq, i+1); 533 pch_can_check_if_busy(&priv->regs->if1_creq, i+1);
547 534
@@ -549,48 +536,48 @@ static void pch_can_config_rx_tx_buffers(struct pch_can_priv *priv)
549 iowrite32(0x0, &priv->regs->if1_id2); 536 iowrite32(0x0, &priv->regs->if1_id2);
550 537
551 pch_can_bit_set(&priv->regs->if1_mcont, 538 pch_can_bit_set(&priv->regs->if1_mcont,
552 CAN_IF_MCONT_UMASK); 539 PCH_IF_MCONT_UMASK);
553 540
554 /* Set FIFO mode set to 0 except last Rx Obj*/ 541 /* Set FIFO mode set to 0 except last Rx Obj*/
555 pch_can_bit_clear(&priv->regs->if1_mcont, 542 pch_can_bit_clear(&priv->regs->if1_mcont,
556 CAN_IF_MCONT_EOB); 543 PCH_IF_MCONT_EOB);
557 /* In case FIFO mode, Last EoB of Rx Obj must be 1 */ 544 /* In case FIFO mode, Last EoB of Rx Obj must be 1 */
558 if (i == (PCH_RX_OBJ_NUM - 1)) 545 if (i == (PCH_RX_OBJ_NUM - 1))
559 pch_can_bit_set(&priv->regs->if1_mcont, 546 pch_can_bit_set(&priv->regs->if1_mcont,
560 CAN_IF_MCONT_EOB); 547 PCH_IF_MCONT_EOB);
561 548
562 iowrite32(0, &priv->regs->if1_mask1); 549 iowrite32(0, &priv->regs->if1_mask1);
563 pch_can_bit_clear(&priv->regs->if1_mask2, 550 pch_can_bit_clear(&priv->regs->if1_mask2,
564 0x1fff | CAN_MASK2_MDIR_MXTD); 551 0x1fff | PCH_MASK2_MDIR_MXTD);
565 552
566 /* Setting CMASK for writing */ 553 /* Setting CMASK for writing */
567 iowrite32(CAN_CMASK_RDWR | CAN_CMASK_MASK | 554 iowrite32(PCH_CMASK_RDWR | PCH_CMASK_MASK |
568 CAN_CMASK_ARB | CAN_CMASK_CTRL, 555 PCH_CMASK_ARB | PCH_CMASK_CTRL,
569 &priv->regs->if1_cmask); 556 &priv->regs->if1_cmask);
570 557
571 pch_can_check_if_busy(&priv->regs->if1_creq, i+1); 558 pch_can_check_if_busy(&priv->regs->if1_creq, i+1);
572 } else if (priv->msg_obj[i] == MSG_OBJ_TX) { 559 } else if (priv->msg_obj[i] == PCH_MSG_OBJ_TX) {
573 iowrite32(CAN_CMASK_RX_TX_GET, 560 iowrite32(PCH_CMASK_RX_TX_GET,
574 &priv->regs->if2_cmask); 561 &priv->regs->if2_cmask);
575 pch_can_check_if_busy(&priv->regs->if2_creq, i+1); 562 pch_can_check_if_busy(&priv->regs->if2_creq, i+1);
576 563
577 /* Resetting DIR bit for reception */ 564 /* Resetting DIR bit for reception */
578 iowrite32(0x0, &priv->regs->if2_id1); 565 iowrite32(0x0, &priv->regs->if2_id1);
579 iowrite32(0x0, &priv->regs->if2_id2); 566 iowrite32(0x0, &priv->regs->if2_id2);
580 pch_can_bit_set(&priv->regs->if2_id2, CAN_ID2_DIR); 567 pch_can_bit_set(&priv->regs->if2_id2, PCH_ID2_DIR);
581 568
582 /* Setting EOB bit for transmitter */ 569 /* Setting EOB bit for transmitter */
583 iowrite32(CAN_IF_MCONT_EOB, &priv->regs->if2_mcont); 570 iowrite32(PCH_IF_MCONT_EOB, &priv->regs->if2_mcont);
584 571
585 pch_can_bit_set(&priv->regs->if2_mcont, 572 pch_can_bit_set(&priv->regs->if2_mcont,
586 CAN_IF_MCONT_UMASK); 573 PCH_IF_MCONT_UMASK);
587 574
588 iowrite32(0, &priv->regs->if2_mask1); 575 iowrite32(0, &priv->regs->if2_mask1);
589 pch_can_bit_clear(&priv->regs->if2_mask2, 0x1fff); 576 pch_can_bit_clear(&priv->regs->if2_mask2, 0x1fff);
590 577
591 /* Setting CMASK for writing */ 578 /* Setting CMASK for writing */
592 iowrite32(CAN_CMASK_RDWR | CAN_CMASK_MASK | 579 iowrite32(PCH_CMASK_RDWR | PCH_CMASK_MASK |
593 CAN_CMASK_ARB | CAN_CMASK_CTRL, 580 PCH_CMASK_ARB | PCH_CMASK_CTRL,
594 &priv->regs->if2_cmask); 581 &priv->regs->if2_cmask);
595 582
596 pch_can_check_if_busy(&priv->regs->if2_creq, i+1); 583 pch_can_check_if_busy(&priv->regs->if2_creq, i+1);
@@ -632,39 +619,39 @@ static void pch_can_release(struct pch_can_priv *priv)
632/* This function clears interrupt(s) from the CAN device. */ 619/* This function clears interrupt(s) from the CAN device. */
633static void pch_can_int_clr(struct pch_can_priv *priv, u32 mask) 620static void pch_can_int_clr(struct pch_can_priv *priv, u32 mask)
634{ 621{
635 if (mask == CAN_STATUS_INT) { 622 if (mask == PCH_STATUS_INT) {
636 ioread32(&priv->regs->stat); 623 ioread32(&priv->regs->stat);
637 return; 624 return;
638 } 625 }
639 626
640 /* Clear interrupt for transmit object */ 627 /* Clear interrupt for transmit object */
641 if (priv->msg_obj[mask - 1] == MSG_OBJ_TX) { 628 if (priv->msg_obj[mask - 1] == PCH_MSG_OBJ_TX) {
642 /* Setting CMASK for clearing interrupts for 629 /* Setting CMASK for clearing interrupts for
643 frame transmission. */ 630 frame transmission. */
644 iowrite32(CAN_CMASK_RDWR | CAN_CMASK_CTRL | CAN_CMASK_ARB, 631 iowrite32(PCH_CMASK_RDWR | PCH_CMASK_CTRL | PCH_CMASK_ARB,
645 &priv->regs->if2_cmask); 632 &priv->regs->if2_cmask);
646 633
647 /* Resetting the ID registers. */ 634 /* Resetting the ID registers. */
648 pch_can_bit_set(&priv->regs->if2_id2, 635 pch_can_bit_set(&priv->regs->if2_id2,
649 CAN_ID2_DIR | (0x7ff << 2)); 636 PCH_ID2_DIR | (0x7ff << 2));
650 iowrite32(0x0, &priv->regs->if2_id1); 637 iowrite32(0x0, &priv->regs->if2_id1);
651 638
652 /* Claring NewDat, TxRqst & IntPnd */ 639 /* Claring NewDat, TxRqst & IntPnd */
653 pch_can_bit_clear(&priv->regs->if2_mcont, 640 pch_can_bit_clear(&priv->regs->if2_mcont,
654 CAN_IF_MCONT_NEWDAT | CAN_IF_MCONT_INTPND | 641 PCH_IF_MCONT_NEWDAT | PCH_IF_MCONT_INTPND |
655 CAN_IF_MCONT_TXRQXT); 642 PCH_IF_MCONT_TXRQXT);
656 pch_can_check_if_busy(&priv->regs->if2_creq, mask); 643 pch_can_check_if_busy(&priv->regs->if2_creq, mask);
657 } else if (priv->msg_obj[mask - 1] == MSG_OBJ_RX) { 644 } else if (priv->msg_obj[mask - 1] == PCH_MSG_OBJ_RX) {
658 /* Setting CMASK for clearing the reception interrupts. */ 645 /* Setting CMASK for clearing the reception interrupts. */
659 iowrite32(CAN_CMASK_RDWR | CAN_CMASK_CTRL | CAN_CMASK_ARB, 646 iowrite32(PCH_CMASK_RDWR | PCH_CMASK_CTRL | PCH_CMASK_ARB,
660 &priv->regs->if1_cmask); 647 &priv->regs->if1_cmask);
661 648
662 /* Clearing the Dir bit. */ 649 /* Clearing the Dir bit. */
663 pch_can_bit_clear(&priv->regs->if1_id2, CAN_ID2_DIR); 650 pch_can_bit_clear(&priv->regs->if1_id2, PCH_ID2_DIR);
664 651
665 /* Clearing NewDat & IntPnd */ 652 /* Clearing NewDat & IntPnd */
666 pch_can_bit_clear(&priv->regs->if1_mcont, 653 pch_can_bit_clear(&priv->regs->if1_mcont,
667 CAN_IF_MCONT_NEWDAT | CAN_IF_MCONT_INTPND); 654 PCH_IF_MCONT_NEWDAT | PCH_IF_MCONT_INTPND);
668 655
669 pch_can_check_if_busy(&priv->regs->if1_creq, mask); 656 pch_can_check_if_busy(&priv->regs->if1_creq, mask);
670 } 657 }
@@ -712,9 +699,9 @@ static void pch_can_error(struct net_device *ndev, u32 status)
712 priv->can.can_stats.error_warning++; 699 priv->can.can_stats.error_warning++;
713 cf->can_id |= CAN_ERR_CRTL; 700 cf->can_id |= CAN_ERR_CRTL;
714 errc = ioread32(&priv->regs->errc); 701 errc = ioread32(&priv->regs->errc);
715 if (((errc & CAN_REC) >> 8) > 96) 702 if (((errc & PCH_REC) >> 8) > 96)
716 cf->data[1] |= CAN_ERR_CRTL_RX_WARNING; 703 cf->data[1] |= CAN_ERR_CRTL_RX_WARNING;
717 if ((errc & CAN_TEC) > 96) 704 if ((errc & PCH_TEC) > 96)
718 cf->data[1] |= CAN_ERR_CRTL_TX_WARNING; 705 cf->data[1] |= CAN_ERR_CRTL_TX_WARNING;
719 dev_warn(&ndev->dev, 706 dev_warn(&ndev->dev,
720 "%s -> Error Counter is more than 96.\n", __func__); 707 "%s -> Error Counter is more than 96.\n", __func__);
@@ -725,9 +712,9 @@ static void pch_can_error(struct net_device *ndev, u32 status)
725 state = CAN_STATE_ERROR_PASSIVE; 712 state = CAN_STATE_ERROR_PASSIVE;
726 cf->can_id |= CAN_ERR_CRTL; 713 cf->can_id |= CAN_ERR_CRTL;
727 errc = ioread32(&priv->regs->errc); 714 errc = ioread32(&priv->regs->errc);
728 if (((errc & CAN_REC) >> 8) > 127) 715 if (((errc & PCH_REC) >> 8) > 127)
729 cf->data[1] |= CAN_ERR_CRTL_RX_PASSIVE; 716 cf->data[1] |= CAN_ERR_CRTL_RX_PASSIVE;
730 if ((errc & CAN_TEC) > 127) 717 if ((errc & PCH_TEC) > 127)
731 cf->data[1] |= CAN_ERR_CRTL_TX_PASSIVE; 718 cf->data[1] |= CAN_ERR_CRTL_TX_PASSIVE;
732 dev_err(&ndev->dev, 719 dev_err(&ndev->dev,
733 "%s -> CAN controller is ERROR PASSIVE .\n", __func__); 720 "%s -> CAN controller is ERROR PASSIVE .\n", __func__);
@@ -795,20 +782,20 @@ static int pch_can_rx_normal(struct net_device *ndev, u32 int_stat)
795 struct net_device_stats *stats = &(priv->ndev->stats); 782 struct net_device_stats *stats = &(priv->ndev->stats);
796 783
797 /* Reading the messsage object from the Message RAM */ 784 /* Reading the messsage object from the Message RAM */
798 iowrite32(CAN_CMASK_RX_TX_GET, &priv->regs->if1_cmask); 785 iowrite32(PCH_CMASK_RX_TX_GET, &priv->regs->if1_cmask);
799 pch_can_check_if_busy(&priv->regs->if1_creq, int_stat); 786 pch_can_check_if_busy(&priv->regs->if1_creq, int_stat);
800 787
801 /* Reading the MCONT register. */ 788 /* Reading the MCONT register. */
802 reg = ioread32(&priv->regs->if1_mcont); 789 reg = ioread32(&priv->regs->if1_mcont);
803 reg &= 0xffff; 790 reg &= 0xffff;
804 791
805 for (k = int_stat; !(reg & CAN_IF_MCONT_EOB); k++) { 792 for (k = int_stat; !(reg & PCH_IF_MCONT_EOB); k++) {
806 /* If MsgLost bit set. */ 793 /* If MsgLost bit set. */
807 if (reg & CAN_IF_MCONT_MSGLOST) { 794 if (reg & PCH_IF_MCONT_MSGLOST) {
808 dev_err(&priv->ndev->dev, "Msg Obj is overwritten.\n"); 795 dev_err(&priv->ndev->dev, "Msg Obj is overwritten.\n");
809 pch_can_bit_clear(&priv->regs->if1_mcont, 796 pch_can_bit_clear(&priv->regs->if1_mcont,
810 CAN_IF_MCONT_MSGLOST); 797 PCH_IF_MCONT_MSGLOST);
811 iowrite32(CAN_CMASK_RDWR | CAN_CMASK_CTRL, 798 iowrite32(PCH_CMASK_RDWR | PCH_CMASK_CTRL,
812 &priv->regs->if1_cmask); 799 &priv->regs->if1_cmask);
813 pch_can_check_if_busy(&priv->regs->if1_creq, k); 800 pch_can_check_if_busy(&priv->regs->if1_creq, k);
814 801
@@ -828,7 +815,7 @@ static int pch_can_rx_normal(struct net_device *ndev, u32 int_stat)
828 rcv_pkts++; 815 rcv_pkts++;
829 goto RX_NEXT; 816 goto RX_NEXT;
830 } 817 }
831 if (!(reg & CAN_IF_MCONT_NEWDAT)) 818 if (!(reg & PCH_IF_MCONT_NEWDAT))
832 goto RX_NEXT; 819 goto RX_NEXT;
833 820
834 skb = alloc_can_skb(priv->ndev, &cf); 821 skb = alloc_can_skb(priv->ndev, &cf);
@@ -836,7 +823,7 @@ static int pch_can_rx_normal(struct net_device *ndev, u32 int_stat)
836 return -ENOMEM; 823 return -ENOMEM;
837 824
838 /* Get Received data */ 825 /* Get Received data */
839 ide = ((ioread32(&priv->regs->if1_id2)) & CAN_ID2_XTD) >> 14; 826 ide = ((ioread32(&priv->regs->if1_id2)) & PCH_ID2_XTD) >> 14;
840 if (ide) { 827 if (ide) {
841 id = (ioread32(&priv->regs->if1_id1) & 0xffff); 828 id = (ioread32(&priv->regs->if1_id1) & 0xffff);
842 id |= (((ioread32(&priv->regs->if1_id2)) & 829 id |= (((ioread32(&priv->regs->if1_id2)) &
@@ -848,7 +835,7 @@ static int pch_can_rx_normal(struct net_device *ndev, u32 int_stat)
848 cf->can_id = (id & CAN_SFF_MASK); 835 cf->can_id = (id & CAN_SFF_MASK);
849 } 836 }
850 837
851 rtr = (ioread32(&priv->regs->if1_id2) & CAN_ID2_DIR); 838 rtr = (ioread32(&priv->regs->if1_id2) & PCH_ID2_DIR);
852 if (rtr) { 839 if (rtr) {
853 cf->can_dlc = 0; 840 cf->can_dlc = 0;
854 cf->can_id |= CAN_RTR_FLAG; 841 cf->can_id |= CAN_RTR_FLAG;
@@ -871,15 +858,15 @@ static int pch_can_rx_normal(struct net_device *ndev, u32 int_stat)
871 stats->rx_bytes += cf->can_dlc; 858 stats->rx_bytes += cf->can_dlc;
872 859
873 if (k < PCH_FIFO_THRESH) { 860 if (k < PCH_FIFO_THRESH) {
874 iowrite32(CAN_CMASK_RDWR | CAN_CMASK_CTRL | 861 iowrite32(PCH_CMASK_RDWR | PCH_CMASK_CTRL |
875 CAN_CMASK_ARB, &priv->regs->if1_cmask); 862 PCH_CMASK_ARB, &priv->regs->if1_cmask);
876 863
877 /* Clearing the Dir bit. */ 864 /* Clearing the Dir bit. */
878 pch_can_bit_clear(&priv->regs->if1_id2, CAN_ID2_DIR); 865 pch_can_bit_clear(&priv->regs->if1_id2, PCH_ID2_DIR);
879 866
880 /* Clearing NewDat & IntPnd */ 867 /* Clearing NewDat & IntPnd */
881 pch_can_bit_clear(&priv->regs->if1_mcont, 868 pch_can_bit_clear(&priv->regs->if1_mcont,
882 CAN_IF_MCONT_INTPND); 869 PCH_IF_MCONT_INTPND);
883 pch_can_check_if_busy(&priv->regs->if1_creq, k); 870 pch_can_check_if_busy(&priv->regs->if1_creq, k);
884 } else if (k > PCH_FIFO_THRESH) { 871 } else if (k > PCH_FIFO_THRESH) {
885 pch_can_int_clr(priv, k); 872 pch_can_int_clr(priv, k);
@@ -890,7 +877,7 @@ static int pch_can_rx_normal(struct net_device *ndev, u32 int_stat)
890 } 877 }
891RX_NEXT: 878RX_NEXT:
892 /* Reading the messsage object from the Message RAM */ 879 /* Reading the messsage object from the Message RAM */
893 iowrite32(CAN_CMASK_RX_TX_GET, &priv->regs->if1_cmask); 880 iowrite32(PCH_CMASK_RX_TX_GET, &priv->regs->if1_cmask);
894 pch_can_check_if_busy(&priv->regs->if1_creq, k + 1); 881 pch_can_check_if_busy(&priv->regs->if1_creq, k + 1);
895 reg = ioread32(&priv->regs->if1_mcont); 882 reg = ioread32(&priv->regs->if1_mcont);
896 } 883 }
@@ -913,7 +900,7 @@ static int pch_can_rx_poll(struct napi_struct *napi, int quota)
913 return 0; 900 return 0;
914 901
915INT_STAT: 902INT_STAT:
916 if (int_stat == CAN_STATUS_INT) { 903 if (int_stat == PCH_STATUS_INT) {
917 reg_stat = ioread32(&priv->regs->stat); 904 reg_stat = ioread32(&priv->regs->stat);
918 if (reg_stat & (PCH_BUS_OFF | PCH_LEC_ALL)) { 905 if (reg_stat & (PCH_BUS_OFF | PCH_LEC_ALL)) {
919 if ((reg_stat & PCH_LEC_ALL) != PCH_LEC_ALL) 906 if ((reg_stat & PCH_LEC_ALL) != PCH_LEC_ALL)
@@ -922,7 +909,7 @@ INT_STAT:
922 909
923 if (reg_stat & PCH_TX_OK) { 910 if (reg_stat & PCH_TX_OK) {
924 spin_lock_irqsave(&priv->msgif_reg_lock, flags); 911 spin_lock_irqsave(&priv->msgif_reg_lock, flags);
925 iowrite32(CAN_CMASK_RX_TX_GET, &priv->regs->if2_cmask); 912 iowrite32(PCH_CMASK_RX_TX_GET, &priv->regs->if2_cmask);
926 pch_can_check_if_busy(&priv->regs->if2_creq, 913 pch_can_check_if_busy(&priv->regs->if2_creq,
927 ioread32(&priv->regs->intr)); 914 ioread32(&priv->regs->intr));
928 spin_unlock_irqrestore(&priv->msgif_reg_lock, flags); 915 spin_unlock_irqrestore(&priv->msgif_reg_lock, flags);
@@ -933,7 +920,7 @@ INT_STAT:
933 pch_can_bit_clear(&priv->regs->stat, PCH_RX_OK); 920 pch_can_bit_clear(&priv->regs->stat, PCH_RX_OK);
934 921
935 int_stat = pch_can_int_pending(priv); 922 int_stat = pch_can_int_pending(priv);
936 if (int_stat == CAN_STATUS_INT) 923 if (int_stat == PCH_STATUS_INT)
937 goto INT_STAT; 924 goto INT_STAT;
938 } 925 }
939 926
@@ -945,14 +932,14 @@ MSG_OBJ:
945 if (rcv_pkts < 0) 932 if (rcv_pkts < 0)
946 return 0; 933 return 0;
947 } else if ((int_stat > PCH_RX_OBJ_NUM) && (int_stat <= PCH_OBJ_NUM)) { 934 } else if ((int_stat > PCH_RX_OBJ_NUM) && (int_stat <= PCH_OBJ_NUM)) {
948 if (priv->msg_obj[int_stat - 1] == MSG_OBJ_TX) { 935 if (priv->msg_obj[int_stat - 1] == PCH_MSG_OBJ_TX) {
949 /* Handle transmission interrupt */ 936 /* Handle transmission interrupt */
950 can_get_echo_skb(ndev, int_stat - PCH_RX_OBJ_NUM - 1); 937 can_get_echo_skb(ndev, int_stat - PCH_RX_OBJ_NUM - 1);
951 spin_lock_irqsave(&priv->msgif_reg_lock, flags); 938 spin_lock_irqsave(&priv->msgif_reg_lock, flags);
952 iowrite32(CAN_CMASK_RX_TX_GET | CAN_CMASK_CLRINTPND, 939 iowrite32(PCH_CMASK_RX_TX_GET | PCH_CMASK_CLRINTPND,
953 &priv->regs->if2_cmask); 940 &priv->regs->if2_cmask);
954 dlc = ioread32(&priv->regs->if2_mcont) & 941 dlc = ioread32(&priv->regs->if2_mcont) &
955 CAN_IF_MCONT_DLC; 942 PCH_IF_MCONT_DLC;
956 pch_can_check_if_busy(&priv->regs->if2_creq, int_stat); 943 pch_can_check_if_busy(&priv->regs->if2_creq, int_stat);
957 spin_unlock_irqrestore(&priv->msgif_reg_lock, flags); 944 spin_unlock_irqrestore(&priv->msgif_reg_lock, flags);
958 if (dlc > 8) 945 if (dlc > 8)
@@ -963,7 +950,7 @@ MSG_OBJ:
963 } 950 }
964 951
965 int_stat = pch_can_int_pending(priv); 952 int_stat = pch_can_int_pending(priv);
966 if (int_stat == CAN_STATUS_INT) 953 if (int_stat == PCH_STATUS_INT)
967 goto INT_STAT; 954 goto INT_STAT;
968 else if (int_stat >= 1 && int_stat <= 32) 955 else if (int_stat >= 1 && int_stat <= 32)
969 goto MSG_OBJ; 956 goto MSG_OBJ;
@@ -983,17 +970,17 @@ static int pch_set_bittiming(struct net_device *ndev)
983 u32 brp; 970 u32 brp;
984 971
985 /* Setting the CCE bit for accessing the Can Timing register. */ 972 /* Setting the CCE bit for accessing the Can Timing register. */
986 pch_can_bit_set(&priv->regs->cont, CAN_CTRL_CCE); 973 pch_can_bit_set(&priv->regs->cont, PCH_CTRL_CCE);
987 974
988 brp = (bt->tq) / (1000000000/PCH_CAN_CLK) - 1; 975 brp = (bt->tq) / (1000000000/PCH_CAN_CLK) - 1;
989 canbit = brp & MSK_BITT_BRP; 976 canbit = brp & PCH_MSK_BITT_BRP;
990 canbit |= (bt->sjw - 1) << BIT_BITT_SJW; 977 canbit |= (bt->sjw - 1) << PCH_BIT_SJW;
991 canbit |= (bt->phase_seg1 + bt->prop_seg - 1) << BIT_BITT_TSEG1; 978 canbit |= (bt->phase_seg1 + bt->prop_seg - 1) << PCH_BIT_TSEG1;
992 canbit |= (bt->phase_seg2 - 1) << BIT_BITT_TSEG2; 979 canbit |= (bt->phase_seg2 - 1) << PCH_BIT_TSEG2;
993 bepe = (brp & MSK_BRPE_BRPE) >> BIT_BRPE_BRPE; 980 bepe = (brp & PCH_MSK_BRPE_BRPE) >> PCH_BIT_BRPE_BRPE;
994 iowrite32(canbit, &priv->regs->bitt); 981 iowrite32(canbit, &priv->regs->bitt);
995 iowrite32(bepe, &priv->regs->brpe); 982 iowrite32(bepe, &priv->regs->brpe);
996 pch_can_bit_clear(&priv->regs->cont, CAN_CTRL_CCE); 983 pch_can_bit_clear(&priv->regs->cont, PCH_CTRL_CCE);
997 984
998 return 0; 985 return 0;
999} 986}
@@ -1137,19 +1124,19 @@ static netdev_tx_t pch_xmit(struct sk_buff *skb, struct net_device *ndev)
1137 spin_lock_irqsave(&priv->msgif_reg_lock, flags); 1124 spin_lock_irqsave(&priv->msgif_reg_lock, flags);
1138 1125
1139 /* Reading the Msg Obj from the Msg RAM to the Interface register. */ 1126 /* Reading the Msg Obj from the Msg RAM to the Interface register. */
1140 iowrite32(CAN_CMASK_RX_TX_GET, &priv->regs->if2_cmask); 1127 iowrite32(PCH_CMASK_RX_TX_GET, &priv->regs->if2_cmask);
1141 pch_can_check_if_busy(&priv->regs->if2_creq, tx_buffer_avail); 1128 pch_can_check_if_busy(&priv->regs->if2_creq, tx_buffer_avail);
1142 1129
1143 /* Setting the CMASK register. */ 1130 /* Setting the CMASK register. */
1144 pch_can_bit_set(&priv->regs->if2_cmask, CAN_CMASK_ALL); 1131 pch_can_bit_set(&priv->regs->if2_cmask, PCH_CMASK_ALL);
1145 1132
1146 /* If ID extended is set. */ 1133 /* If ID extended is set. */
1147 pch_can_bit_clear(&priv->regs->if2_id1, 0xffff); 1134 pch_can_bit_clear(&priv->regs->if2_id1, 0xffff);
1148 pch_can_bit_clear(&priv->regs->if2_id2, 0x1fff | CAN_ID2_XTD); 1135 pch_can_bit_clear(&priv->regs->if2_id2, 0x1fff | PCH_ID2_XTD);
1149 if (cf->can_id & CAN_EFF_FLAG) { 1136 if (cf->can_id & CAN_EFF_FLAG) {
1150 pch_can_bit_set(&priv->regs->if2_id1, cf->can_id & 0xffff); 1137 pch_can_bit_set(&priv->regs->if2_id1, cf->can_id & 0xffff);
1151 pch_can_bit_set(&priv->regs->if2_id2, 1138 pch_can_bit_set(&priv->regs->if2_id2,
1152 ((cf->can_id >> 16) & 0x1fff) | CAN_ID2_XTD); 1139 ((cf->can_id >> 16) & 0x1fff) | PCH_ID2_XTD);
1153 } else { 1140 } else {
1154 pch_can_bit_set(&priv->regs->if2_id1, 0); 1141 pch_can_bit_set(&priv->regs->if2_id1, 0);
1155 pch_can_bit_set(&priv->regs->if2_id2, 1142 pch_can_bit_set(&priv->regs->if2_id2,
@@ -1158,7 +1145,7 @@ static netdev_tx_t pch_xmit(struct sk_buff *skb, struct net_device *ndev)
1158 1145
1159 /* If remote frame has to be transmitted.. */ 1146 /* If remote frame has to be transmitted.. */
1160 if (cf->can_id & CAN_RTR_FLAG) 1147 if (cf->can_id & CAN_RTR_FLAG)
1161 pch_can_bit_clear(&priv->regs->if2_id2, CAN_ID2_DIR); 1148 pch_can_bit_clear(&priv->regs->if2_id2, PCH_ID2_DIR);
1162 1149
1163 for (i = 0, j = 0; i < cf->can_dlc; j++) { 1150 for (i = 0, j = 0; i < cf->can_dlc; j++) {
1164 iowrite32(le32_to_cpu(cf->data[i++]), 1151 iowrite32(le32_to_cpu(cf->data[i++]),
@@ -1177,12 +1164,12 @@ static netdev_tx_t pch_xmit(struct sk_buff *skb, struct net_device *ndev)
1177 1164
1178 /* Clearing IntPend, NewDat & TxRqst */ 1165 /* Clearing IntPend, NewDat & TxRqst */
1179 pch_can_bit_clear(&priv->regs->if2_mcont, 1166 pch_can_bit_clear(&priv->regs->if2_mcont,
1180 CAN_IF_MCONT_NEWDAT | CAN_IF_MCONT_INTPND | 1167 PCH_IF_MCONT_NEWDAT | PCH_IF_MCONT_INTPND |
1181 CAN_IF_MCONT_TXRQXT); 1168 PCH_IF_MCONT_TXRQXT);
1182 1169
1183 /* Setting NewDat, TxRqst bits */ 1170 /* Setting NewDat, TxRqst bits */
1184 pch_can_bit_set(&priv->regs->if2_mcont, 1171 pch_can_bit_set(&priv->regs->if2_mcont,
1185 CAN_IF_MCONT_NEWDAT | CAN_IF_MCONT_TXRQXT); 1172 PCH_IF_MCONT_NEWDAT | PCH_IF_MCONT_TXRQXT);
1186 1173
1187 pch_can_check_if_busy(&priv->regs->if2_creq, tx_buffer_avail); 1174 pch_can_check_if_busy(&priv->regs->if2_creq, tx_buffer_avail);
1188 1175
@@ -1245,7 +1232,7 @@ static int pch_can_suspend(struct pci_dev *pdev, pm_message_t state)
1245 1232
1246 /* Save Tx buffer enable state */ 1233 /* Save Tx buffer enable state */
1247 for (i = 0; i < PCH_OBJ_NUM; i++) { 1234 for (i = 0; i < PCH_OBJ_NUM; i++) {
1248 if (priv->msg_obj[i] == MSG_OBJ_TX) 1235 if (priv->msg_obj[i] == PCH_MSG_OBJ_TX)
1249 pch_can_get_tx_enable(priv, i + 1, 1236 pch_can_get_tx_enable(priv, i + 1,
1250 &(priv->tx_enable[i])); 1237 &(priv->tx_enable[i]));
1251 } 1238 }
@@ -1255,7 +1242,7 @@ static int pch_can_suspend(struct pci_dev *pdev, pm_message_t state)
1255 1242
1256 /* Save Rx buffer enable state */ 1243 /* Save Rx buffer enable state */
1257 for (i = 0; i < PCH_OBJ_NUM; i++) { 1244 for (i = 0; i < PCH_OBJ_NUM; i++) {
1258 if (priv->msg_obj[i] == MSG_OBJ_RX) { 1245 if (priv->msg_obj[i] == PCH_MSG_OBJ_RX) {
1259 pch_can_get_rx_enable(priv, i + 1, 1246 pch_can_get_rx_enable(priv, i + 1,
1260 &(priv->rx_enable[i])); 1247 &(priv->rx_enable[i]));
1261 pch_can_get_rx_buffer_link(priv, i + 1, 1248 pch_can_get_rx_buffer_link(priv, i + 1,
@@ -1313,7 +1300,7 @@ static int pch_can_resume(struct pci_dev *pdev)
1313 1300
1314 /* Enabling the transmit buffer. */ 1301 /* Enabling the transmit buffer. */
1315 for (i = 0; i < PCH_OBJ_NUM; i++) { 1302 for (i = 0; i < PCH_OBJ_NUM; i++) {
1316 if (priv->msg_obj[i] == MSG_OBJ_TX) { 1303 if (priv->msg_obj[i] == PCH_MSG_OBJ_TX) {
1317 pch_can_set_tx_enable(priv, i + 1, 1304 pch_can_set_tx_enable(priv, i + 1,
1318 priv->tx_enable[i]); 1305 priv->tx_enable[i]);
1319 } 1306 }
@@ -1321,7 +1308,7 @@ static int pch_can_resume(struct pci_dev *pdev)
1321 1308
1322 /* Configuring the receive buffer and enabling them. */ 1309 /* Configuring the receive buffer and enabling them. */
1323 for (i = 0; i < PCH_OBJ_NUM; i++) { 1310 for (i = 0; i < PCH_OBJ_NUM; i++) {
1324 if (priv->msg_obj[i] == MSG_OBJ_RX) { 1311 if (priv->msg_obj[i] == PCH_MSG_OBJ_RX) {
1325 /* Restore buffer link */ 1312 /* Restore buffer link */
1326 pch_can_set_rx_buffer_link(priv, i + 1, 1313 pch_can_set_rx_buffer_link(priv, i + 1,
1327 priv->rx_link[i]); 1314 priv->rx_link[i]);
@@ -1349,8 +1336,8 @@ static int pch_can_get_berr_counter(const struct net_device *dev,
1349{ 1336{
1350 struct pch_can_priv *priv = netdev_priv(dev); 1337 struct pch_can_priv *priv = netdev_priv(dev);
1351 1338
1352 bec->txerr = ioread32(&priv->regs->errc) & CAN_TEC; 1339 bec->txerr = ioread32(&priv->regs->errc) & PCH_TEC;
1353 bec->rxerr = (ioread32(&priv->regs->errc) & CAN_REC) >> 8; 1340 bec->rxerr = (ioread32(&priv->regs->errc) & PCH_REC) >> 8;
1354 1341
1355 return 0; 1342 return 0;
1356} 1343}
@@ -1410,10 +1397,10 @@ static int __devinit pch_can_probe(struct pci_dev *pdev,
1410 1397
1411 priv->can.clock.freq = PCH_CAN_CLK; /* Hz */ 1398 priv->can.clock.freq = PCH_CAN_CLK; /* Hz */
1412 for (index = 0; index < PCH_RX_OBJ_NUM;) 1399 for (index = 0; index < PCH_RX_OBJ_NUM;)
1413 priv->msg_obj[index++] = MSG_OBJ_RX; 1400 priv->msg_obj[index++] = PCH_MSG_OBJ_RX;
1414 1401
1415 for (index = index; index < PCH_OBJ_NUM;) 1402 for (index = index; index < PCH_OBJ_NUM;)
1416 priv->msg_obj[index++] = MSG_OBJ_TX; 1403 priv->msg_obj[index++] = PCH_MSG_OBJ_TX;
1417 1404
1418 netif_napi_add(ndev, &priv->napi, pch_can_rx_poll, PCH_RX_OBJ_NUM); 1405 netif_napi_add(ndev, &priv->napi, pch_can_rx_poll, PCH_RX_OBJ_NUM);
1419 1406