2 * CAN bus driver for the alone generic (as possible as) MSCAN controller.
4 * Copyright (C) 2005-2006 Andrey Volkov <avolkov@varma-el.com>,
6 * Copyright (C) 2008-2009 Wolfgang Grandegger <wg@grandegger.com>
7 * Copyright (C) 2008-2009 Pengutronix <kernel@pengutronix.de>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the version 2 of the GNU General Public License
11 * as published by the Free Software Foundation
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <linux/kernel.h>
24 #include <linux/module.h>
25 #include <linux/interrupt.h>
26 #include <linux/delay.h>
27 #include <linux/netdevice.h>
28 #include <linux/if_arp.h>
29 #include <linux/if_ether.h>
30 #include <linux/list.h>
31 #include <socketcan/can.h>
32 #include <socketcan/can/dev.h>
33 #include <socketcan/can/error.h>
34 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
42 #include <socketcan/can/version.h> /* for RCSID. Removed by mkpatch script */
45 static struct can_bittiming_const mscan_bittiming_const = {
63 static enum can_state state_map[] = {
64 CAN_STATE_ERROR_ACTIVE,
65 CAN_STATE_ERROR_WARNING,
66 CAN_STATE_ERROR_PASSIVE,
70 static int mscan_set_mode(struct net_device *dev, u8 mode)
72 struct mscan_priv *priv = netdev_priv(dev);
73 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
78 if (mode != MSCAN_NORMAL_MODE) {
79 if (priv->tx_active) {
80 /* Abort transfers before going to sleep */#
81 out_8(®s->cantarq, priv->tx_active);
82 /* Suppress TX done interrupts */
83 out_8(®s->cantier, 0);
86 canctl1 = in_8(®s->canctl1);
87 if ((mode & MSCAN_SLPRQ) && !(canctl1 & MSCAN_SLPAK)) {
88 setbits8(®s->canctl0, MSCAN_SLPRQ);
89 for (i = 0; i < MSCAN_SET_MODE_RETRIES; i++) {
90 if (in_8(®s->canctl1) & MSCAN_SLPAK)
95 * The mscan controller will fail to enter sleep mode,
96 * while there are irregular activities on bus, like
97 * somebody keeps retransmitting. This behavior is
98 * undocumented and seems to differ between mscan built
99 * in mpc5200b and mpc5200. We proceed in that case,
100 * since otherwise the slprq will be kept set and the
101 * controller will get stuck. NOTE: INITRQ or CSWAI
102 * will abort all active transmit actions, if still
105 if (i >= MSCAN_SET_MODE_RETRIES)
107 "device failed to enter sleep mode. "
108 "We proceed anyhow.\n");
110 priv->can.state = CAN_STATE_SLEEPING;
113 if ((mode & MSCAN_INITRQ) && !(canctl1 & MSCAN_INITAK)) {
114 setbits8(®s->canctl0, MSCAN_INITRQ);
115 for (i = 0; i < MSCAN_SET_MODE_RETRIES; i++) {
116 if (in_8(®s->canctl1) & MSCAN_INITAK)
119 if (i >= MSCAN_SET_MODE_RETRIES)
123 priv->can.state = CAN_STATE_STOPPED;
125 if (mode & MSCAN_CSWAI)
126 setbits8(®s->canctl0, MSCAN_CSWAI);
129 canctl1 = in_8(®s->canctl1);
130 if (canctl1 & (MSCAN_SLPAK | MSCAN_INITAK)) {
131 clrbits8(®s->canctl0, MSCAN_SLPRQ | MSCAN_INITRQ);
132 for (i = 0; i < MSCAN_SET_MODE_RETRIES; i++) {
133 canctl1 = in_8(®s->canctl1);
134 if (!(canctl1 & (MSCAN_INITAK | MSCAN_SLPAK)))
137 if (i >= MSCAN_SET_MODE_RETRIES)
140 priv->can.state = CAN_STATE_ERROR_ACTIVE;
146 static int mscan_start(struct net_device *dev)
148 struct mscan_priv *priv = netdev_priv(dev);
149 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
153 out_8(®s->canrier, 0);
155 INIT_LIST_HEAD(&priv->tx_head);
156 priv->prev_buf_id = 0;
159 priv->shadow_canrier = 0;
162 if (priv->type == MSCAN_TYPE_MPC5121) {
163 /* Clear pending bus-off condition */
164 if (in_8(®s->canmisc) & MSCAN_BOHOLD)
165 out_8(®s->canmisc, MSCAN_BOHOLD);
168 err = mscan_set_mode(dev, MSCAN_NORMAL_MODE);
172 canrflg = in_8(®s->canrflg);
173 priv->shadow_statflg = canrflg & MSCAN_STAT_MSK;
174 priv->can.state = state_map[max(MSCAN_STATE_RX(canrflg),
175 MSCAN_STATE_TX(canrflg))];
176 out_8(®s->cantier, 0);
178 /* Enable receive interrupts. */
179 out_8(®s->canrier, MSCAN_RX_INTS_ENABLE);
184 static int mscan_restart(struct net_device *dev)
186 struct mscan_priv *priv = netdev_priv(dev);
188 if (priv->type == MSCAN_TYPE_MPC5121) {
189 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
191 priv->can.state = CAN_STATE_ERROR_ACTIVE;
192 WARN(!(in_8(®s->canmisc) & MSCAN_BOHOLD),
193 "bus-off state expected");
194 out_8(®s->canmisc, MSCAN_BOHOLD);
195 /* Re-enable receive interrupts. */
196 out_8(®s->canrier, MSCAN_RX_INTS_ENABLE);
198 if (priv->can.state <= CAN_STATE_BUS_OFF)
199 mscan_set_mode(dev, MSCAN_INIT_MODE);
200 return mscan_start(dev);
206 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
207 static int mscan_start_xmit(struct sk_buff *skb, struct net_device *dev)
209 static netdev_tx_t mscan_start_xmit(struct sk_buff *skb, struct net_device *dev)
212 struct can_frame *frame = (struct can_frame *)skb->data;
213 struct mscan_priv *priv = netdev_priv(dev);
214 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
218 if (can_dropped_invalid_skb(dev, skb))
221 out_8(®s->cantier, 0);
223 i = ~priv->tx_active & MSCAN_TXE;
225 switch (hweight8(i)) {
227 netif_stop_queue(dev);
228 dev_err(ND2D(dev), "Tx Ring full when queue awake!\n");
229 return NETDEV_TX_BUSY;
232 * if buf_id < 3, then current frame will be send out of order,
233 * since buffer with lower id have higher priority (hell..)
235 netif_stop_queue(dev);
237 if (buf_id < priv->prev_buf_id) {
239 if (priv->cur_pri == 0xff) {
240 set_bit(F_TX_WAIT_ALL, &priv->flags);
241 netif_stop_queue(dev);
244 set_bit(F_TX_PROGRESS, &priv->flags);
247 priv->prev_buf_id = buf_id;
248 out_8(®s->cantbsel, i);
250 rtr = frame->can_id & CAN_RTR_FLAG;
252 /* RTR is always the lowest bit of interest, then IDs follow */
253 if (frame->can_id & CAN_EFF_FLAG) {
254 can_id = (frame->can_id & CAN_EFF_MASK)
255 << (MSCAN_EFF_RTR_SHIFT + 1);
257 can_id |= 1 << MSCAN_EFF_RTR_SHIFT;
258 out_be16(®s->tx.idr3_2, can_id);
261 /* EFF_FLAGS are between the IDs :( */
262 can_id = (can_id & 0x7) | ((can_id << 2) & 0xffe0)
265 can_id = (frame->can_id & CAN_SFF_MASK)
266 << (MSCAN_SFF_RTR_SHIFT + 1);
268 can_id |= 1 << MSCAN_SFF_RTR_SHIFT;
270 out_be16(®s->tx.idr1_0, can_id);
273 void __iomem *data = ®s->tx.dsr1_0;
274 u16 *payload = (u16 *)frame->data;
276 /* It is safe to write into dsr[dlc+1] */
277 for (i = 0; i < (frame->can_dlc + 1) / 2; i++) {
278 out_be16(data, *payload++);
279 data += 2 + _MSCAN_RESERVED_DSR_SIZE;
283 out_8(®s->tx.dlr, frame->can_dlc);
284 out_8(®s->tx.tbpr, priv->cur_pri);
286 /* Start transmission. */
287 out_8(®s->cantflg, 1 << buf_id);
289 if (!test_bit(F_TX_PROGRESS, &priv->flags))
290 dev->trans_start = jiffies;
292 list_add_tail(&priv->tx_queue[buf_id].list, &priv->tx_head);
294 can_put_echo_skb(skb, dev, buf_id);
296 /* Enable interrupt. */
297 priv->tx_active |= 1 << buf_id;
298 out_8(®s->cantier, priv->tx_active);
303 /* This function returns the old state to see where we came from */
304 static enum can_state check_set_state(struct net_device *dev, u8 canrflg)
306 struct mscan_priv *priv = netdev_priv(dev);
307 enum can_state state, old_state = priv->can.state;
309 if (canrflg & MSCAN_CSCIF && old_state <= CAN_STATE_BUS_OFF) {
310 state = state_map[max(MSCAN_STATE_RX(canrflg),
311 MSCAN_STATE_TX(canrflg))];
312 priv->can.state = state;
317 static void mscan_get_rx_frame(struct net_device *dev, struct can_frame *frame)
319 struct mscan_priv *priv = netdev_priv(dev);
320 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
324 can_id = in_be16(®s->rx.idr1_0);
325 if (can_id & (1 << 3)) {
326 frame->can_id = CAN_EFF_FLAG;
327 can_id = ((can_id << 16) | in_be16(®s->rx.idr3_2));
328 can_id = ((can_id & 0xffe00000) |
329 ((can_id & 0x7ffff) << 2)) >> 2;
335 frame->can_id |= can_id >> 1;
337 frame->can_id |= CAN_RTR_FLAG;
339 frame->can_dlc = get_can_dlc(in_8(®s->rx.dlr) & 0xf);
341 if (!(frame->can_id & CAN_RTR_FLAG)) {
342 void __iomem *data = ®s->rx.dsr1_0;
343 u16 *payload = (u16 *)frame->data;
345 for (i = 0; i < (frame->can_dlc + 1) / 2; i++) {
346 *payload++ = in_be16(data);
347 data += 2 + _MSCAN_RESERVED_DSR_SIZE;
351 out_8(®s->canrflg, MSCAN_RXF);
354 static void mscan_get_err_frame(struct net_device *dev, struct can_frame *frame,
357 struct mscan_priv *priv = netdev_priv(dev);
358 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
359 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
360 struct net_device_stats *stats = can_get_stats(dev);
362 struct net_device_stats *stats = &dev->stats;
364 enum can_state old_state;
366 dev_dbg(ND2D(dev), "error interrupt (canrflg=%#x)\n", canrflg);
367 frame->can_id = CAN_ERR_FLAG;
369 if (canrflg & MSCAN_OVRIF) {
370 frame->can_id |= CAN_ERR_CRTL;
371 frame->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
372 stats->rx_over_errors++;
378 old_state = check_set_state(dev, canrflg);
380 if (old_state != priv->can.state) {
381 switch (priv->can.state) {
382 case CAN_STATE_ERROR_WARNING:
383 frame->can_id |= CAN_ERR_CRTL;
384 priv->can.can_stats.error_warning++;
385 if ((priv->shadow_statflg & MSCAN_RSTAT_MSK) <
386 (canrflg & MSCAN_RSTAT_MSK))
387 frame->data[1] |= CAN_ERR_CRTL_RX_WARNING;
388 if ((priv->shadow_statflg & MSCAN_TSTAT_MSK) <
389 (canrflg & MSCAN_TSTAT_MSK))
390 frame->data[1] |= CAN_ERR_CRTL_TX_WARNING;
392 case CAN_STATE_ERROR_PASSIVE:
393 frame->can_id |= CAN_ERR_CRTL;
394 priv->can.can_stats.error_passive++;
395 frame->data[1] |= CAN_ERR_CRTL_RX_PASSIVE;
397 case CAN_STATE_BUS_OFF:
398 frame->can_id |= CAN_ERR_BUSOFF;
400 * The MSCAN on the MPC5200 does recover from bus-off
401 * automatically. To avoid that we stop the chip doing
402 * a light-weight stop (we are in irq-context).
404 if (priv->type != MSCAN_TYPE_MPC5121) {
405 out_8(®s->cantier, 0);
406 out_8(®s->canrier, 0);
407 setbits8(®s->canctl0,
408 MSCAN_SLPRQ | MSCAN_INITRQ);
416 priv->shadow_statflg = canrflg & MSCAN_STAT_MSK;
417 frame->can_dlc = CAN_ERR_DLC;
418 out_8(®s->canrflg, MSCAN_ERR_IF);
421 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
422 static int mscan_rx_poll(struct napi_struct *napi, int quota)
424 static int mscan_rx_poll(struct net_device *dev, int *budget)
427 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)
428 struct mscan_priv *priv = container_of(napi, struct mscan_priv, napi);
429 struct net_device *dev = napi->dev;
430 #elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
431 struct mscan_priv *priv = container_of(napi, struct mscan_priv, napi);
432 struct net_device *dev = priv->dev;
434 struct mscan_priv *priv = netdev_priv(dev);
435 int quota = min(dev->quota, *budget);
437 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
438 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
439 struct net_device_stats *stats = can_get_stats(dev);
441 struct net_device_stats *stats = &dev->stats;
446 struct can_frame *frame;
449 while (npackets < quota) {
450 canrflg = in_8(®s->canrflg);
451 if (!(canrflg & (MSCAN_RXF | MSCAN_ERR_IF)))
454 skb = alloc_can_skb(dev, &frame);
456 if (printk_ratelimit())
457 dev_notice(ND2D(dev), "packet dropped\n");
459 out_8(®s->canrflg, canrflg);
463 if (canrflg & MSCAN_RXF)
464 mscan_get_rx_frame(dev, frame);
465 else if (canrflg & MSCAN_ERR_IF)
466 mscan_get_err_frame(dev, frame, canrflg);
468 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
469 dev->last_rx = jiffies;
472 stats->rx_bytes += frame->can_dlc;
474 netif_receive_skb(skb);
477 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23)
479 dev->quota -= npackets;
482 if (!(in_8(®s->canrflg) & (MSCAN_RXF | MSCAN_ERR_IF))) {
483 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)
484 napi_complete(&priv->napi);
485 #elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
486 netif_rx_complete(dev, &priv->napi);
488 netif_rx_complete(dev);
490 clear_bit(F_RX_PROGRESS, &priv->flags);
491 if (priv->can.state < CAN_STATE_BUS_OFF)
492 out_8(®s->canrier, priv->shadow_canrier);
498 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
499 static irqreturn_t mscan_isr(int irq, void *dev_id, struct pt_regs *r)
501 static irqreturn_t mscan_isr(int irq, void *dev_id)
504 struct net_device *dev = (struct net_device *)dev_id;
505 struct mscan_priv *priv = netdev_priv(dev);
506 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
507 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
508 struct net_device_stats *stats = can_get_stats(dev);
510 struct net_device_stats *stats = &dev->stats;
512 u8 cantier, cantflg, canrflg;
513 irqreturn_t ret = IRQ_NONE;
515 cantier = in_8(®s->cantier) & MSCAN_TXE;
516 cantflg = in_8(®s->cantflg) & cantier;
518 if (cantier && cantflg) {
519 struct list_head *tmp, *pos;
521 list_for_each_safe(pos, tmp, &priv->tx_head) {
522 struct tx_queue_entry *entry =
523 list_entry(pos, struct tx_queue_entry, list);
524 u8 mask = entry->mask;
526 if (!(cantflg & mask))
529 out_8(®s->cantbsel, mask);
530 stats->tx_bytes += in_8(®s->tx.dlr);
532 can_get_echo_skb(dev, entry->id);
533 priv->tx_active &= ~mask;
537 if (list_empty(&priv->tx_head)) {
538 clear_bit(F_TX_WAIT_ALL, &priv->flags);
539 clear_bit(F_TX_PROGRESS, &priv->flags);
542 dev->trans_start = jiffies;
545 if (!test_bit(F_TX_WAIT_ALL, &priv->flags))
546 netif_wake_queue(dev);
548 out_8(®s->cantier, priv->tx_active);
552 canrflg = in_8(®s->canrflg);
553 if ((canrflg & ~MSCAN_STAT_MSK) &&
554 !test_and_set_bit(F_RX_PROGRESS, &priv->flags)) {
555 if (canrflg & ~MSCAN_STAT_MSK) {
556 priv->shadow_canrier = in_8(®s->canrier);
557 out_8(®s->canrier, 0);
558 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)
559 napi_schedule(&priv->napi);
560 #elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
561 netif_rx_schedule(dev, &priv->napi);
563 netif_rx_schedule(dev);
567 clear_bit(F_RX_PROGRESS, &priv->flags);
573 static int mscan_do_set_mode(struct net_device *dev, enum can_mode mode)
575 struct mscan_priv *priv = netdev_priv(dev);
578 if (!priv->open_time)
583 ret = mscan_restart(dev);
586 if (netif_queue_stopped(dev))
587 netif_wake_queue(dev);
597 static int mscan_do_set_bittiming(struct net_device *dev)
599 struct mscan_priv *priv = netdev_priv(dev);
600 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
601 struct can_bittiming *bt = &priv->can.bittiming;
604 btr0 = BTR0_SET_BRP(bt->brp) | BTR0_SET_SJW(bt->sjw);
605 btr1 = (BTR1_SET_TSEG1(bt->prop_seg + bt->phase_seg1) |
606 BTR1_SET_TSEG2(bt->phase_seg2) |
607 BTR1_SET_SAM(priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES));
609 dev_info(ND2D(dev), "setting BTR0=0x%02x BTR1=0x%02x\n",
612 out_8(®s->canbtr0, btr0);
613 out_8(®s->canbtr1, btr1);
618 static int mscan_open(struct net_device *dev)
621 struct mscan_priv *priv = netdev_priv(dev);
622 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
625 ret = open_candev(dev);
629 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
630 napi_enable(&priv->napi);
633 ret = request_irq(dev->irq, mscan_isr, 0, dev->name, dev);
635 dev_err(ND2D(dev), "failed to attach interrupt\n");
636 goto exit_napi_disable;
639 priv->open_time = jiffies;
641 clrbits8(®s->canctl1, MSCAN_LISTEN);
643 ret = mscan_start(dev);
647 netif_start_queue(dev);
653 free_irq(dev->irq, dev);
655 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
656 napi_disable(&priv->napi);
662 static int mscan_close(struct net_device *dev)
664 struct mscan_priv *priv = netdev_priv(dev);
665 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
667 netif_stop_queue(dev);
668 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
669 napi_disable(&priv->napi);
672 out_8(®s->cantier, 0);
673 out_8(®s->canrier, 0);
674 mscan_set_mode(dev, MSCAN_INIT_MODE);
676 free_irq(dev->irq, dev);
682 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)
683 static const struct net_device_ops mscan_netdev_ops = {
684 .ndo_open = mscan_open,
685 .ndo_stop = mscan_close,
686 .ndo_start_xmit = mscan_start_xmit,
690 int register_mscandev(struct net_device *dev, int mscan_clksrc)
692 struct mscan_priv *priv = netdev_priv(dev);
693 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
696 ctl1 = in_8(®s->canctl1);
698 ctl1 |= MSCAN_CLKSRC;
700 ctl1 &= ~MSCAN_CLKSRC;
702 if (priv->type == MSCAN_TYPE_MPC5121)
703 ctl1 |= MSCAN_BORM; /* bus-off recovery upon request */
706 out_8(®s->canctl1, ctl1);
709 /* acceptance mask/acceptance code (accept everything) */
710 out_be16(®s->canidar1_0, 0);
711 out_be16(®s->canidar3_2, 0);
712 out_be16(®s->canidar5_4, 0);
713 out_be16(®s->canidar7_6, 0);
715 out_be16(®s->canidmr1_0, 0xffff);
716 out_be16(®s->canidmr3_2, 0xffff);
717 out_be16(®s->canidmr5_4, 0xffff);
718 out_be16(®s->canidmr7_6, 0xffff);
719 /* Two 32 bit Acceptance Filters */
720 out_8(®s->canidac, MSCAN_AF_32BIT);
722 mscan_set_mode(dev, MSCAN_INIT_MODE);
724 return register_candev(dev);
727 void unregister_mscandev(struct net_device *dev)
729 struct mscan_priv *priv = netdev_priv(dev);
730 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
731 mscan_set_mode(dev, MSCAN_INIT_MODE);
732 clrbits8(®s->canctl1, MSCAN_CANE);
733 unregister_candev(dev);
736 struct net_device *alloc_mscandev(void)
738 struct net_device *dev;
739 struct mscan_priv *priv;
742 dev = alloc_candev(sizeof(struct mscan_priv), MSCAN_ECHO_SKB_MAX);
745 priv = netdev_priv(dev);
747 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)
748 dev->netdev_ops = &mscan_netdev_ops;
750 dev->open = mscan_open;
751 dev->stop = mscan_close;
752 dev->hard_start_xmit = mscan_start_xmit;
755 dev->flags |= IFF_ECHO; /* we support local echo */
757 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)
758 netif_napi_add(dev, &priv->napi, mscan_rx_poll, 8);
759 #elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)
761 netif_napi_add(dev, &priv->napi, mscan_rx_poll, 8);
763 dev->poll = mscan_rx_poll;
767 priv->can.bittiming_const = &mscan_bittiming_const;
768 priv->can.do_set_bittiming = mscan_do_set_bittiming;
769 priv->can.do_set_mode = mscan_do_set_mode;
770 priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES;
772 for (i = 0; i < TX_QUEUE_SIZE; i++) {
773 priv->tx_queue[i].id = i;
774 priv->tx_queue[i].mask = 1 << i;
780 MODULE_AUTHOR("Andrey Volkov <avolkov@varma-el.com>");
781 MODULE_LICENSE("GPL v2");
782 MODULE_DESCRIPTION("CAN port driver for a MSCAN based chips");