aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/can')
-rw-r--r--drivers/net/can/at91_can.c4
-rw-r--r--drivers/net/can/dev.c10
-rw-r--r--drivers/net/can/flexcan.c14
3 files changed, 17 insertions, 11 deletions
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 3b1ff6148702..693d8ffe4653 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -1405,10 +1405,10 @@ static int at91_can_remove(struct platform_device *pdev)
1405 1405
1406static const struct platform_device_id at91_can_id_table[] = { 1406static const struct platform_device_id at91_can_id_table[] = {
1407 { 1407 {
1408 .name = "at91_can", 1408 .name = "at91sam9x5_can",
1409 .driver_data = (kernel_ulong_t)&at91_at91sam9x5_data, 1409 .driver_data = (kernel_ulong_t)&at91_at91sam9x5_data,
1410 }, { 1410 }, {
1411 .name = "at91sam9x5_can", 1411 .name = "at91_can",
1412 .driver_data = (kernel_ulong_t)&at91_at91sam9263_data, 1412 .driver_data = (kernel_ulong_t)&at91_at91sam9263_data,
1413 }, { 1413 }, {
1414 /* sentinel */ 1414 /* sentinel */
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index f9cba4123c66..1870c4731a57 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -705,14 +705,14 @@ static size_t can_get_size(const struct net_device *dev)
705 size_t size; 705 size_t size;
706 706
707 size = nla_total_size(sizeof(u32)); /* IFLA_CAN_STATE */ 707 size = nla_total_size(sizeof(u32)); /* IFLA_CAN_STATE */
708 size += sizeof(struct can_ctrlmode); /* IFLA_CAN_CTRLMODE */ 708 size += nla_total_size(sizeof(struct can_ctrlmode)); /* IFLA_CAN_CTRLMODE */
709 size += nla_total_size(sizeof(u32)); /* IFLA_CAN_RESTART_MS */ 709 size += nla_total_size(sizeof(u32)); /* IFLA_CAN_RESTART_MS */
710 size += sizeof(struct can_bittiming); /* IFLA_CAN_BITTIMING */ 710 size += nla_total_size(sizeof(struct can_bittiming)); /* IFLA_CAN_BITTIMING */
711 size += sizeof(struct can_clock); /* IFLA_CAN_CLOCK */ 711 size += nla_total_size(sizeof(struct can_clock)); /* IFLA_CAN_CLOCK */
712 if (priv->do_get_berr_counter) /* IFLA_CAN_BERR_COUNTER */ 712 if (priv->do_get_berr_counter) /* IFLA_CAN_BERR_COUNTER */
713 size += sizeof(struct can_berr_counter); 713 size += nla_total_size(sizeof(struct can_berr_counter));
714 if (priv->bittiming_const) /* IFLA_CAN_BITTIMING_CONST */ 714 if (priv->bittiming_const) /* IFLA_CAN_BITTIMING_CONST */
715 size += sizeof(struct can_bittiming_const); 715 size += nla_total_size(sizeof(struct can_bittiming_const));
716 716
717 return size; 717 return size;
718} 718}
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 3f21142138b7..8f5ce747feb5 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -62,7 +62,7 @@
62#define FLEXCAN_MCR_BCC BIT(16) 62#define FLEXCAN_MCR_BCC BIT(16)
63#define FLEXCAN_MCR_LPRIO_EN BIT(13) 63#define FLEXCAN_MCR_LPRIO_EN BIT(13)
64#define FLEXCAN_MCR_AEN BIT(12) 64#define FLEXCAN_MCR_AEN BIT(12)
65#define FLEXCAN_MCR_MAXMB(x) ((x) & 0xf) 65#define FLEXCAN_MCR_MAXMB(x) ((x) & 0x1f)
66#define FLEXCAN_MCR_IDAM_A (0 << 8) 66#define FLEXCAN_MCR_IDAM_A (0 << 8)
67#define FLEXCAN_MCR_IDAM_B (1 << 8) 67#define FLEXCAN_MCR_IDAM_B (1 << 8)
68#define FLEXCAN_MCR_IDAM_C (2 << 8) 68#define FLEXCAN_MCR_IDAM_C (2 << 8)
@@ -735,9 +735,11 @@ static int flexcan_chip_start(struct net_device *dev)
735 * 735 *
736 */ 736 */
737 reg_mcr = flexcan_read(&regs->mcr); 737 reg_mcr = flexcan_read(&regs->mcr);
738 reg_mcr &= ~FLEXCAN_MCR_MAXMB(0xff);
738 reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_FEN | FLEXCAN_MCR_HALT | 739 reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_FEN | FLEXCAN_MCR_HALT |
739 FLEXCAN_MCR_SUPV | FLEXCAN_MCR_WRN_EN | 740 FLEXCAN_MCR_SUPV | FLEXCAN_MCR_WRN_EN |
740 FLEXCAN_MCR_IDAM_C | FLEXCAN_MCR_SRX_DIS; 741 FLEXCAN_MCR_IDAM_C | FLEXCAN_MCR_SRX_DIS |
742 FLEXCAN_MCR_MAXMB(FLEXCAN_TX_BUF_ID);
741 netdev_dbg(dev, "%s: writing mcr=0x%08x", __func__, reg_mcr); 743 netdev_dbg(dev, "%s: writing mcr=0x%08x", __func__, reg_mcr);
742 flexcan_write(reg_mcr, &regs->mcr); 744 flexcan_write(reg_mcr, &regs->mcr);
743 745
@@ -771,6 +773,10 @@ static int flexcan_chip_start(struct net_device *dev)
771 netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl); 773 netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl);
772 flexcan_write(reg_ctrl, &regs->ctrl); 774 flexcan_write(reg_ctrl, &regs->ctrl);
773 775
776 /* Abort any pending TX, mark Mailbox as INACTIVE */
777 flexcan_write(FLEXCAN_MB_CNT_CODE(0x4),
778 &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl);
779
774 /* acceptance mask/acceptance code (accept everything) */ 780 /* acceptance mask/acceptance code (accept everything) */
775 flexcan_write(0x0, &regs->rxgmask); 781 flexcan_write(0x0, &regs->rxgmask);
776 flexcan_write(0x0, &regs->rx14mask); 782 flexcan_write(0x0, &regs->rx14mask);
@@ -979,9 +985,9 @@ static void unregister_flexcandev(struct net_device *dev)
979} 985}
980 986
981static const struct of_device_id flexcan_of_match[] = { 987static const struct of_device_id flexcan_of_match[] = {
982 { .compatible = "fsl,p1010-flexcan", .data = &fsl_p1010_devtype_data, },
983 { .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, },
984 { .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, }, 988 { .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, },
989 { .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, },
990 { .compatible = "fsl,p1010-flexcan", .data = &fsl_p1010_devtype_data, },
985 { /* sentinel */ }, 991 { /* sentinel */ },
986}; 992};
987MODULE_DEVICE_TABLE(of, flexcan_of_match); 993MODULE_DEVICE_TABLE(of, flexcan_of_match);