aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/can')
-rw-r--r--drivers/net/can/mscan/mscan.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c
index 839b471cdf5d..ca8b55685ad9 100644
--- a/drivers/net/can/mscan/mscan.c
+++ b/drivers/net/can/mscan/mscan.c
@@ -78,8 +78,7 @@ static int mscan_set_mode(struct net_device *dev, u8 mode)
78 78
79 canctl1 = in_8(&regs->canctl1); 79 canctl1 = in_8(&regs->canctl1);
80 if ((mode & MSCAN_SLPRQ) && !(canctl1 & MSCAN_SLPAK)) { 80 if ((mode & MSCAN_SLPRQ) && !(canctl1 & MSCAN_SLPAK)) {
81 out_8(&regs->canctl0, 81 setbits8(&regs->canctl0, MSCAN_SLPRQ);
82 in_8(&regs->canctl0) | MSCAN_SLPRQ);
83 for (i = 0; i < MSCAN_SET_MODE_RETRIES; i++) { 82 for (i = 0; i < MSCAN_SET_MODE_RETRIES; i++) {
84 if (in_8(&regs->canctl1) & MSCAN_SLPAK) 83 if (in_8(&regs->canctl1) & MSCAN_SLPAK)
85 break; 84 break;
@@ -105,8 +104,7 @@ static int mscan_set_mode(struct net_device *dev, u8 mode)
105 } 104 }
106 105
107 if ((mode & MSCAN_INITRQ) && !(canctl1 & MSCAN_INITAK)) { 106 if ((mode & MSCAN_INITRQ) && !(canctl1 & MSCAN_INITAK)) {
108 out_8(&regs->canctl0, 107 setbits8(&regs->canctl0, MSCAN_INITRQ);
109 in_8(&regs->canctl0) | MSCAN_INITRQ);
110 for (i = 0; i < MSCAN_SET_MODE_RETRIES; i++) { 108 for (i = 0; i < MSCAN_SET_MODE_RETRIES; i++) {
111 if (in_8(&regs->canctl1) & MSCAN_INITAK) 109 if (in_8(&regs->canctl1) & MSCAN_INITAK)
112 break; 110 break;
@@ -118,14 +116,12 @@ static int mscan_set_mode(struct net_device *dev, u8 mode)
118 priv->can.state = CAN_STATE_STOPPED; 116 priv->can.state = CAN_STATE_STOPPED;
119 117
120 if (mode & MSCAN_CSWAI) 118 if (mode & MSCAN_CSWAI)
121 out_8(&regs->canctl0, 119 setbits8(&regs->canctl0, MSCAN_CSWAI);
122 in_8(&regs->canctl0) | MSCAN_CSWAI);
123 120
124 } else { 121 } else {
125 canctl1 = in_8(&regs->canctl1); 122 canctl1 = in_8(&regs->canctl1);
126 if (canctl1 & (MSCAN_SLPAK | MSCAN_INITAK)) { 123 if (canctl1 & (MSCAN_SLPAK | MSCAN_INITAK)) {
127 out_8(&regs->canctl0, in_8(&regs->canctl0) & 124 clrbits8(&regs->canctl0, MSCAN_SLPRQ | MSCAN_INITRQ);
128 ~(MSCAN_SLPRQ | MSCAN_INITRQ));
129 for (i = 0; i < MSCAN_SET_MODE_RETRIES; i++) { 125 for (i = 0; i < MSCAN_SET_MODE_RETRIES; i++) {
130 canctl1 = in_8(&regs->canctl1); 126 canctl1 = in_8(&regs->canctl1);
131 if (!(canctl1 & (MSCAN_INITAK | MSCAN_SLPAK))) 127 if (!(canctl1 & (MSCAN_INITAK | MSCAN_SLPAK)))
@@ -359,8 +355,7 @@ static void mscan_get_err_frame(struct net_device *dev, struct can_frame *frame,
359 */ 355 */
360 out_8(&regs->cantier, 0); 356 out_8(&regs->cantier, 0);
361 out_8(&regs->canrier, 0); 357 out_8(&regs->canrier, 0);
362 out_8(&regs->canctl0, in_8(&regs->canctl0) | 358 setbits8(&regs->canctl0, MSCAN_SLPRQ | MSCAN_INITRQ);
363 MSCAN_SLPRQ | MSCAN_INITRQ);
364 can_bus_off(dev); 359 can_bus_off(dev);
365 break; 360 break;
366 default: 361 default:
@@ -548,7 +543,7 @@ static int mscan_open(struct net_device *dev)
548 543
549 priv->open_time = jiffies; 544 priv->open_time = jiffies;
550 545
551 out_8(&regs->canctl1, in_8(&regs->canctl1) & ~MSCAN_LISTEN); 546 clrbits8(&regs->canctl1, MSCAN_LISTEN);
552 547
553 ret = mscan_start(dev); 548 ret = mscan_start(dev);
554 if (ret) 549 if (ret)
@@ -623,7 +618,7 @@ void unregister_mscandev(struct net_device *dev)
623 struct mscan_priv *priv = netdev_priv(dev); 618 struct mscan_priv *priv = netdev_priv(dev);
624 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base; 619 struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
625 mscan_set_mode(dev, MSCAN_INIT_MODE); 620 mscan_set_mode(dev, MSCAN_INIT_MODE);
626 out_8(&regs->canctl1, in_8(&regs->canctl1) & ~MSCAN_CANE); 621 clrbits8(&regs->canctl1, MSCAN_CANE);
627 unregister_candev(dev); 622 unregister_candev(dev);
628} 623}
629EXPORT_SYMBOL_GPL(unregister_mscandev); 624EXPORT_SYMBOL_GPL(unregister_mscandev);