提交 90bb81f3 编写于 作者: D David S. Miller

Merge tag 'linux-can-fixes-for-4.4-20151123' of...

Merge tag 'linux-can-fixes-for-4.4-20151123' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can

Marc Kleine-Budde says:

====================
pull-request: can 2015-11-23

this is a pull request of three patches for the upcoming v4.4 release.

The first patch is by Mirza Krak, it fixes a problem with the sja1000 driver
after resuming from suspend to disk, by clearing all outstanding interrupts.
Oliver Hartkopp contributes two patches targeting almost all driver, they fix
the assignment of the error location in CAN error messages.
====================
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
...@@ -501,8 +501,6 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status) ...@@ -501,8 +501,6 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status)
cf->data[2] |= CAN_ERR_PROT_FORM; cf->data[2] |= CAN_ERR_PROT_FORM;
else if (status & SER) else if (status & SER)
cf->data[2] |= CAN_ERR_PROT_STUFF; cf->data[2] |= CAN_ERR_PROT_STUFF;
else
cf->data[2] |= CAN_ERR_PROT_UNSPEC;
} }
priv->can.state = state; priv->can.state = state;
......
...@@ -962,7 +962,6 @@ static int c_can_handle_bus_err(struct net_device *dev, ...@@ -962,7 +962,6 @@ static int c_can_handle_bus_err(struct net_device *dev,
* type of the last error to occur on the CAN bus * type of the last error to occur on the CAN bus
*/ */
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
cf->data[2] |= CAN_ERR_PROT_UNSPEC;
switch (lec_type) { switch (lec_type) {
case LEC_STUFF_ERROR: case LEC_STUFF_ERROR:
...@@ -975,8 +974,7 @@ static int c_can_handle_bus_err(struct net_device *dev, ...@@ -975,8 +974,7 @@ static int c_can_handle_bus_err(struct net_device *dev,
break; break;
case LEC_ACK_ERROR: case LEC_ACK_ERROR:
netdev_dbg(dev, "ack error\n"); netdev_dbg(dev, "ack error\n");
cf->data[3] |= (CAN_ERR_PROT_LOC_ACK | cf->data[3] = CAN_ERR_PROT_LOC_ACK;
CAN_ERR_PROT_LOC_ACK_DEL);
break; break;
case LEC_BIT1_ERROR: case LEC_BIT1_ERROR:
netdev_dbg(dev, "bit1 error\n"); netdev_dbg(dev, "bit1 error\n");
...@@ -988,8 +986,7 @@ static int c_can_handle_bus_err(struct net_device *dev, ...@@ -988,8 +986,7 @@ static int c_can_handle_bus_err(struct net_device *dev,
break; break;
case LEC_CRC_ERROR: case LEC_CRC_ERROR:
netdev_dbg(dev, "CRC error\n"); netdev_dbg(dev, "CRC error\n");
cf->data[3] |= (CAN_ERR_PROT_LOC_CRC_SEQ | cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
CAN_ERR_PROT_LOC_CRC_DEL);
break; break;
default: default:
break; break;
......
...@@ -578,7 +578,7 @@ static int cc770_err(struct net_device *dev, u8 status) ...@@ -578,7 +578,7 @@ static int cc770_err(struct net_device *dev, u8 status)
cf->data[2] |= CAN_ERR_PROT_BIT0; cf->data[2] |= CAN_ERR_PROT_BIT0;
break; break;
case STAT_LEC_CRC: case STAT_LEC_CRC:
cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ; cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
break; break;
} }
} }
......
...@@ -535,13 +535,13 @@ static void do_bus_err(struct net_device *dev, ...@@ -535,13 +535,13 @@ static void do_bus_err(struct net_device *dev,
if (reg_esr & FLEXCAN_ESR_ACK_ERR) { if (reg_esr & FLEXCAN_ESR_ACK_ERR) {
netdev_dbg(dev, "ACK_ERR irq\n"); netdev_dbg(dev, "ACK_ERR irq\n");
cf->can_id |= CAN_ERR_ACK; cf->can_id |= CAN_ERR_ACK;
cf->data[3] |= CAN_ERR_PROT_LOC_ACK; cf->data[3] = CAN_ERR_PROT_LOC_ACK;
tx_errors = 1; tx_errors = 1;
} }
if (reg_esr & FLEXCAN_ESR_CRC_ERR) { if (reg_esr & FLEXCAN_ESR_CRC_ERR) {
netdev_dbg(dev, "CRC_ERR irq\n"); netdev_dbg(dev, "CRC_ERR irq\n");
cf->data[2] |= CAN_ERR_PROT_BIT; cf->data[2] |= CAN_ERR_PROT_BIT;
cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ; cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
rx_errors = 1; rx_errors = 1;
} }
if (reg_esr & FLEXCAN_ESR_FRM_ERR) { if (reg_esr & FLEXCAN_ESR_FRM_ERR) {
......
...@@ -1096,7 +1096,6 @@ static int ican3_handle_cevtind(struct ican3_dev *mod, struct ican3_msg *msg) ...@@ -1096,7 +1096,6 @@ static int ican3_handle_cevtind(struct ican3_dev *mod, struct ican3_msg *msg)
cf->data[2] |= CAN_ERR_PROT_STUFF; cf->data[2] |= CAN_ERR_PROT_STUFF;
break; break;
default: default:
cf->data[2] |= CAN_ERR_PROT_UNSPEC;
cf->data[3] = ecc & ECC_SEG; cf->data[3] = ecc & ECC_SEG;
break; break;
} }
......
...@@ -487,7 +487,6 @@ static int m_can_handle_lec_err(struct net_device *dev, ...@@ -487,7 +487,6 @@ static int m_can_handle_lec_err(struct net_device *dev,
* type of the last error to occur on the CAN bus * type of the last error to occur on the CAN bus
*/ */
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
cf->data[2] |= CAN_ERR_PROT_UNSPEC;
switch (lec_type) { switch (lec_type) {
case LEC_STUFF_ERROR: case LEC_STUFF_ERROR:
...@@ -500,8 +499,7 @@ static int m_can_handle_lec_err(struct net_device *dev, ...@@ -500,8 +499,7 @@ static int m_can_handle_lec_err(struct net_device *dev,
break; break;
case LEC_ACK_ERROR: case LEC_ACK_ERROR:
netdev_dbg(dev, "ack error\n"); netdev_dbg(dev, "ack error\n");
cf->data[3] |= (CAN_ERR_PROT_LOC_ACK | cf->data[3] = CAN_ERR_PROT_LOC_ACK;
CAN_ERR_PROT_LOC_ACK_DEL);
break; break;
case LEC_BIT1_ERROR: case LEC_BIT1_ERROR:
netdev_dbg(dev, "bit1 error\n"); netdev_dbg(dev, "bit1 error\n");
...@@ -513,8 +511,7 @@ static int m_can_handle_lec_err(struct net_device *dev, ...@@ -513,8 +511,7 @@ static int m_can_handle_lec_err(struct net_device *dev,
break; break;
case LEC_CRC_ERROR: case LEC_CRC_ERROR:
netdev_dbg(dev, "CRC error\n"); netdev_dbg(dev, "CRC error\n");
cf->data[3] |= (CAN_ERR_PROT_LOC_CRC_SEQ | cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
CAN_ERR_PROT_LOC_CRC_DEL);
break; break;
default: default:
break; break;
......
...@@ -559,8 +559,7 @@ static void pch_can_error(struct net_device *ndev, u32 status) ...@@ -559,8 +559,7 @@ static void pch_can_error(struct net_device *ndev, u32 status)
stats->rx_errors++; stats->rx_errors++;
break; break;
case PCH_CRC_ERR: case PCH_CRC_ERR:
cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ | cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
CAN_ERR_PROT_LOC_CRC_DEL;
priv->can.can_stats.bus_error++; priv->can.can_stats.bus_error++;
stats->rx_errors++; stats->rx_errors++;
break; break;
......
...@@ -241,17 +241,16 @@ static void rcar_can_error(struct net_device *ndev) ...@@ -241,17 +241,16 @@ static void rcar_can_error(struct net_device *ndev)
u8 ecsr; u8 ecsr;
netdev_dbg(priv->ndev, "Bus error interrupt:\n"); netdev_dbg(priv->ndev, "Bus error interrupt:\n");
if (skb) { if (skb)
cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT; cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;
cf->data[2] = CAN_ERR_PROT_UNSPEC;
}
ecsr = readb(&priv->regs->ecsr); ecsr = readb(&priv->regs->ecsr);
if (ecsr & RCAR_CAN_ECSR_ADEF) { if (ecsr & RCAR_CAN_ECSR_ADEF) {
netdev_dbg(priv->ndev, "ACK Delimiter Error\n"); netdev_dbg(priv->ndev, "ACK Delimiter Error\n");
tx_errors++; tx_errors++;
writeb(~RCAR_CAN_ECSR_ADEF, &priv->regs->ecsr); writeb(~RCAR_CAN_ECSR_ADEF, &priv->regs->ecsr);
if (skb) if (skb)
cf->data[3] |= CAN_ERR_PROT_LOC_ACK_DEL; cf->data[3] = CAN_ERR_PROT_LOC_ACK_DEL;
} }
if (ecsr & RCAR_CAN_ECSR_BE0F) { if (ecsr & RCAR_CAN_ECSR_BE0F) {
netdev_dbg(priv->ndev, "Bit Error (dominant)\n"); netdev_dbg(priv->ndev, "Bit Error (dominant)\n");
...@@ -272,7 +271,7 @@ static void rcar_can_error(struct net_device *ndev) ...@@ -272,7 +271,7 @@ static void rcar_can_error(struct net_device *ndev)
rx_errors++; rx_errors++;
writeb(~RCAR_CAN_ECSR_CEF, &priv->regs->ecsr); writeb(~RCAR_CAN_ECSR_CEF, &priv->regs->ecsr);
if (skb) if (skb)
cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ; cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
} }
if (ecsr & RCAR_CAN_ECSR_AEF) { if (ecsr & RCAR_CAN_ECSR_AEF) {
netdev_dbg(priv->ndev, "ACK Error\n"); netdev_dbg(priv->ndev, "ACK Error\n");
...@@ -280,7 +279,7 @@ static void rcar_can_error(struct net_device *ndev) ...@@ -280,7 +279,7 @@ static void rcar_can_error(struct net_device *ndev)
writeb(~RCAR_CAN_ECSR_AEF, &priv->regs->ecsr); writeb(~RCAR_CAN_ECSR_AEF, &priv->regs->ecsr);
if (skb) { if (skb) {
cf->can_id |= CAN_ERR_ACK; cf->can_id |= CAN_ERR_ACK;
cf->data[3] |= CAN_ERR_PROT_LOC_ACK; cf->data[3] = CAN_ERR_PROT_LOC_ACK;
} }
} }
if (ecsr & RCAR_CAN_ECSR_FEF) { if (ecsr & RCAR_CAN_ECSR_FEF) {
......
...@@ -218,6 +218,9 @@ static void sja1000_start(struct net_device *dev) ...@@ -218,6 +218,9 @@ static void sja1000_start(struct net_device *dev)
priv->write_reg(priv, SJA1000_RXERR, 0x0); priv->write_reg(priv, SJA1000_RXERR, 0x0);
priv->read_reg(priv, SJA1000_ECC); priv->read_reg(priv, SJA1000_ECC);
/* clear interrupt flags */
priv->read_reg(priv, SJA1000_IR);
/* leave reset mode */ /* leave reset mode */
set_normal_mode(dev); set_normal_mode(dev);
} }
...@@ -446,7 +449,6 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) ...@@ -446,7 +449,6 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
cf->data[2] |= CAN_ERR_PROT_STUFF; cf->data[2] |= CAN_ERR_PROT_STUFF;
break; break;
default: default:
cf->data[2] |= CAN_ERR_PROT_UNSPEC;
cf->data[3] = ecc & ECC_SEG; cf->data[3] = ecc & ECC_SEG;
break; break;
} }
......
...@@ -575,7 +575,6 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status) ...@@ -575,7 +575,6 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status)
cf->data[2] |= CAN_ERR_PROT_STUFF; cf->data[2] |= CAN_ERR_PROT_STUFF;
break; break;
default: default:
cf->data[2] |= CAN_ERR_PROT_UNSPEC;
cf->data[3] = (ecc & SUN4I_STA_ERR_SEG_CODE) cf->data[3] = (ecc & SUN4I_STA_ERR_SEG_CODE)
>> 16; >> 16;
break; break;
......
...@@ -722,7 +722,6 @@ static int ti_hecc_error(struct net_device *ndev, int int_status, ...@@ -722,7 +722,6 @@ static int ti_hecc_error(struct net_device *ndev, int int_status,
if (err_status & HECC_BUS_ERROR) { if (err_status & HECC_BUS_ERROR) {
++priv->can.can_stats.bus_error; ++priv->can.can_stats.bus_error;
cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT; cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;
cf->data[2] |= CAN_ERR_PROT_UNSPEC;
if (err_status & HECC_CANES_FE) { if (err_status & HECC_CANES_FE) {
hecc_set_bit(priv, HECC_CANES, HECC_CANES_FE); hecc_set_bit(priv, HECC_CANES, HECC_CANES_FE);
cf->data[2] |= CAN_ERR_PROT_FORM; cf->data[2] |= CAN_ERR_PROT_FORM;
...@@ -737,13 +736,11 @@ static int ti_hecc_error(struct net_device *ndev, int int_status, ...@@ -737,13 +736,11 @@ static int ti_hecc_error(struct net_device *ndev, int int_status,
} }
if (err_status & HECC_CANES_CRCE) { if (err_status & HECC_CANES_CRCE) {
hecc_set_bit(priv, HECC_CANES, HECC_CANES_CRCE); hecc_set_bit(priv, HECC_CANES, HECC_CANES_CRCE);
cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ | cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
CAN_ERR_PROT_LOC_CRC_DEL;
} }
if (err_status & HECC_CANES_ACKE) { if (err_status & HECC_CANES_ACKE) {
hecc_set_bit(priv, HECC_CANES, HECC_CANES_ACKE); hecc_set_bit(priv, HECC_CANES, HECC_CANES_ACKE);
cf->data[3] |= CAN_ERR_PROT_LOC_ACK | cf->data[3] = CAN_ERR_PROT_LOC_ACK;
CAN_ERR_PROT_LOC_ACK_DEL;
} }
} }
......
...@@ -377,7 +377,6 @@ static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg) ...@@ -377,7 +377,6 @@ static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg)
cf->data[2] |= CAN_ERR_PROT_STUFF; cf->data[2] |= CAN_ERR_PROT_STUFF;
break; break;
default: default:
cf->data[2] |= CAN_ERR_PROT_UNSPEC;
cf->data[3] = ecc & SJA1000_ECC_SEG; cf->data[3] = ecc & SJA1000_ECC_SEG;
break; break;
} }
......
...@@ -282,7 +282,6 @@ static void esd_usb2_rx_event(struct esd_usb2_net_priv *priv, ...@@ -282,7 +282,6 @@ static void esd_usb2_rx_event(struct esd_usb2_net_priv *priv,
cf->data[2] |= CAN_ERR_PROT_STUFF; cf->data[2] |= CAN_ERR_PROT_STUFF;
break; break;
default: default:
cf->data[2] |= CAN_ERR_PROT_UNSPEC;
cf->data[3] = ecc & SJA1000_ECC_SEG; cf->data[3] = ecc & SJA1000_ECC_SEG;
break; break;
} }
......
...@@ -944,10 +944,9 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev, ...@@ -944,10 +944,9 @@ static void kvaser_usb_rx_error(const struct kvaser_usb *dev,
cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT; cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;
if (es->leaf.error_factor & M16C_EF_ACKE) if (es->leaf.error_factor & M16C_EF_ACKE)
cf->data[3] |= (CAN_ERR_PROT_LOC_ACK); cf->data[3] = CAN_ERR_PROT_LOC_ACK;
if (es->leaf.error_factor & M16C_EF_CRCE) if (es->leaf.error_factor & M16C_EF_CRCE)
cf->data[3] |= (CAN_ERR_PROT_LOC_CRC_SEQ | cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
CAN_ERR_PROT_LOC_CRC_DEL);
if (es->leaf.error_factor & M16C_EF_FORME) if (es->leaf.error_factor & M16C_EF_FORME)
cf->data[2] |= CAN_ERR_PROT_FORM; cf->data[2] |= CAN_ERR_PROT_FORM;
if (es->leaf.error_factor & M16C_EF_STFE) if (es->leaf.error_factor & M16C_EF_STFE)
......
...@@ -401,9 +401,7 @@ static void usb_8dev_rx_err_msg(struct usb_8dev_priv *priv, ...@@ -401,9 +401,7 @@ static void usb_8dev_rx_err_msg(struct usb_8dev_priv *priv,
tx_errors = 1; tx_errors = 1;
break; break;
case USB_8DEV_STATUSMSG_CRC: case USB_8DEV_STATUSMSG_CRC:
cf->data[2] |= CAN_ERR_PROT_UNSPEC; cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ |
CAN_ERR_PROT_LOC_CRC_DEL;
rx_errors = 1; rx_errors = 1;
break; break;
case USB_8DEV_STATUSMSG_BIT0: case USB_8DEV_STATUSMSG_BIT0:
......
...@@ -608,17 +608,15 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr) ...@@ -608,17 +608,15 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr)
/* Check for error interrupt */ /* Check for error interrupt */
if (isr & XCAN_IXR_ERROR_MASK) { if (isr & XCAN_IXR_ERROR_MASK) {
if (skb) { if (skb)
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
cf->data[2] |= CAN_ERR_PROT_UNSPEC;
}
/* Check for Ack error interrupt */ /* Check for Ack error interrupt */
if (err_status & XCAN_ESR_ACKER_MASK) { if (err_status & XCAN_ESR_ACKER_MASK) {
stats->tx_errors++; stats->tx_errors++;
if (skb) { if (skb) {
cf->can_id |= CAN_ERR_ACK; cf->can_id |= CAN_ERR_ACK;
cf->data[3] |= CAN_ERR_PROT_LOC_ACK; cf->data[3] = CAN_ERR_PROT_LOC_ACK;
} }
} }
...@@ -654,8 +652,7 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr) ...@@ -654,8 +652,7 @@ static void xcan_err_interrupt(struct net_device *ndev, u32 isr)
stats->rx_errors++; stats->rx_errors++;
if (skb) { if (skb) {
cf->can_id |= CAN_ERR_PROT; cf->can_id |= CAN_ERR_PROT;
cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ | cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
CAN_ERR_PROT_LOC_CRC_DEL;
} }
} }
priv->can.can_stats.bus_error++; priv->can.can_stats.bus_error++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册