Commit d07d4c23 authored by David S. Miller's avatar David S. Miller

Merge branch 'master' of git://gitorious.org/linux-can/linux-can-next

Conflicts:
	drivers/net/can/usb/ems_usb.c

Minor dev_warn --> netdev_warn conversion conflicts.
parents dd48dc34 aabdfd6a
...@@ -103,11 +103,11 @@ config CAN_FLEXCAN ...@@ -103,11 +103,11 @@ config CAN_FLEXCAN
Say Y here if you want to support for Freescale FlexCAN. Say Y here if you want to support for Freescale FlexCAN.
config PCH_CAN config PCH_CAN
tristate "PCH CAN" tristate "Intel EG20T PCH CAN controller"
depends on CAN_DEV && PCI depends on CAN_DEV && PCI
---help--- ---help---
This driver is for PCH CAN of Topcliff which is an IOH for x86 This driver is for PCH CAN of Topcliff (Intel EG20T PCH) which
embedded processor. is an IOH for x86 embedded processor (Intel Atom E6xx series).
This driver can access CAN bus. This driver can access CAN bus.
source "drivers/net/can/mscan/Kconfig" source "drivers/net/can/mscan/Kconfig"
......
...@@ -82,8 +82,7 @@ static int bfin_can_set_bittiming(struct net_device *dev) ...@@ -82,8 +82,7 @@ static int bfin_can_set_bittiming(struct net_device *dev)
bfin_write(&reg->clock, clk); bfin_write(&reg->clock, clk);
bfin_write(&reg->timing, timing); bfin_write(&reg->timing, timing);
dev_info(dev->dev.parent, "setting CLOCK=0x%04x TIMING=0x%04x\n", netdev_info(dev, "setting CLOCK=0x%04x TIMING=0x%04x\n", clk, timing);
clk, timing);
return 0; return 0;
} }
...@@ -108,8 +107,7 @@ static void bfin_can_set_reset_mode(struct net_device *dev) ...@@ -108,8 +107,7 @@ static void bfin_can_set_reset_mode(struct net_device *dev)
while (!(bfin_read(&reg->control) & CCA)) { while (!(bfin_read(&reg->control) & CCA)) {
udelay(10); udelay(10);
if (--timeout == 0) { if (--timeout == 0) {
dev_err(dev->dev.parent, netdev_err(dev, "fail to enter configuration mode\n");
"fail to enter configuration mode\n");
BUG(); BUG();
} }
} }
...@@ -165,8 +163,7 @@ static void bfin_can_set_normal_mode(struct net_device *dev) ...@@ -165,8 +163,7 @@ static void bfin_can_set_normal_mode(struct net_device *dev)
while (bfin_read(&reg->status) & CCA) { while (bfin_read(&reg->status) & CCA) {
udelay(10); udelay(10);
if (--timeout == 0) { if (--timeout == 0) {
dev_err(dev->dev.parent, netdev_err(dev, "fail to leave configuration mode\n");
"fail to leave configuration mode\n");
BUG(); BUG();
} }
} }
...@@ -224,6 +221,20 @@ static int bfin_can_set_mode(struct net_device *dev, enum can_mode mode) ...@@ -224,6 +221,20 @@ static int bfin_can_set_mode(struct net_device *dev, enum can_mode mode)
return 0; return 0;
} }
static int bfin_can_get_berr_counter(const struct net_device *dev,
struct can_berr_counter *bec)
{
struct bfin_can_priv *priv = netdev_priv(dev);
struct bfin_can_regs __iomem *reg = priv->membase;
u16 cec = bfin_read(&reg->cec);
bec->txerr = cec >> 8;
bec->rxerr = cec;
return 0;
}
static int bfin_can_start_xmit(struct sk_buff *skb, struct net_device *dev) static int bfin_can_start_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct bfin_can_priv *priv = netdev_priv(dev); struct bfin_can_priv *priv = netdev_priv(dev);
...@@ -331,7 +342,7 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status) ...@@ -331,7 +342,7 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status)
if (isrc & RMLIS) { if (isrc & RMLIS) {
/* data overrun interrupt */ /* data overrun interrupt */
dev_dbg(dev->dev.parent, "data overrun interrupt\n"); netdev_dbg(dev, "data overrun interrupt\n");
cf->can_id |= CAN_ERR_CRTL; cf->can_id |= CAN_ERR_CRTL;
cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
stats->rx_over_errors++; stats->rx_over_errors++;
...@@ -339,7 +350,7 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status) ...@@ -339,7 +350,7 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status)
} }
if (isrc & BOIS) { if (isrc & BOIS) {
dev_dbg(dev->dev.parent, "bus-off mode interrupt\n"); netdev_dbg(dev, "bus-off mode interrupt\n");
state = CAN_STATE_BUS_OFF; state = CAN_STATE_BUS_OFF;
cf->can_id |= CAN_ERR_BUSOFF; cf->can_id |= CAN_ERR_BUSOFF;
can_bus_off(dev); can_bus_off(dev);
...@@ -347,13 +358,12 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status) ...@@ -347,13 +358,12 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status)
if (isrc & EPIS) { if (isrc & EPIS) {
/* error passive interrupt */ /* error passive interrupt */
dev_dbg(dev->dev.parent, "error passive interrupt\n"); netdev_dbg(dev, "error passive interrupt\n");
state = CAN_STATE_ERROR_PASSIVE; state = CAN_STATE_ERROR_PASSIVE;
} }
if ((isrc & EWTIS) || (isrc & EWRIS)) { if ((isrc & EWTIS) || (isrc & EWRIS)) {
dev_dbg(dev->dev.parent, netdev_dbg(dev, "Error Warning Transmit/Receive Interrupt\n");
"Error Warning Transmit/Receive Interrupt\n");
state = CAN_STATE_ERROR_WARNING; state = CAN_STATE_ERROR_WARNING;
} }
...@@ -509,6 +519,7 @@ struct net_device *alloc_bfin_candev(void) ...@@ -509,6 +519,7 @@ struct net_device *alloc_bfin_candev(void)
priv->can.bittiming_const = &bfin_can_bittiming_const; priv->can.bittiming_const = &bfin_can_bittiming_const;
priv->can.do_set_bittiming = bfin_can_set_bittiming; priv->can.do_set_bittiming = bfin_can_set_bittiming;
priv->can.do_set_mode = bfin_can_set_mode; priv->can.do_set_mode = bfin_can_set_mode;
priv->can.do_get_berr_counter = bfin_can_get_berr_counter;
priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES; priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES;
return dev; return dev;
...@@ -636,8 +647,7 @@ static int bfin_can_suspend(struct platform_device *pdev, pm_message_t mesg) ...@@ -636,8 +647,7 @@ static int bfin_can_suspend(struct platform_device *pdev, pm_message_t mesg)
while (!(bfin_read(&reg->intr) & SMACK)) { while (!(bfin_read(&reg->intr) & SMACK)) {
udelay(10); udelay(10);
if (--timeout == 0) { if (--timeout == 0) {
dev_err(dev->dev.parent, netdev_err(dev, "fail to enter sleep mode\n");
"fail to enter sleep mode\n");
BUG(); BUG();
} }
} }
......
...@@ -130,13 +130,13 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt) ...@@ -130,13 +130,13 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt)
/* Error in one-tenth of a percent */ /* Error in one-tenth of a percent */
error = (best_error * 1000) / bt->bitrate; error = (best_error * 1000) / bt->bitrate;
if (error > CAN_CALC_MAX_ERROR) { if (error > CAN_CALC_MAX_ERROR) {
dev_err(dev->dev.parent, netdev_err(dev,
"bitrate error %ld.%ld%% too high\n", "bitrate error %ld.%ld%% too high\n",
error / 10, error % 10); error / 10, error % 10);
return -EDOM; return -EDOM;
} else { } else {
dev_warn(dev->dev.parent, "bitrate error %ld.%ld%%\n", netdev_warn(dev, "bitrate error %ld.%ld%%\n",
error / 10, error % 10); error / 10, error % 10);
} }
} }
...@@ -172,7 +172,7 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt) ...@@ -172,7 +172,7 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt)
#else /* !CONFIG_CAN_CALC_BITTIMING */ #else /* !CONFIG_CAN_CALC_BITTIMING */
static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt) static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt)
{ {
dev_err(dev->dev.parent, "bit-timing calculation not available\n"); netdev_err(dev, "bit-timing calculation not available\n");
return -EINVAL; return -EINVAL;
} }
#endif /* CONFIG_CAN_CALC_BITTIMING */ #endif /* CONFIG_CAN_CALC_BITTIMING */
...@@ -313,8 +313,7 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, ...@@ -313,8 +313,7 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
priv->echo_skb[idx] = skb; priv->echo_skb[idx] = skb;
} else { } else {
/* locking problem with netif_stop_queue() ?? */ /* locking problem with netif_stop_queue() ?? */
dev_err(dev->dev.parent, "%s: BUG! echo_skb is occupied!\n", netdev_err(dev, "%s: BUG! echo_skb is occupied!\n", __func__);
__func__);
kfree_skb(skb); kfree_skb(skb);
} }
} }
...@@ -327,16 +326,24 @@ EXPORT_SYMBOL_GPL(can_put_echo_skb); ...@@ -327,16 +326,24 @@ EXPORT_SYMBOL_GPL(can_put_echo_skb);
* is handled in the device driver. The driver must protect * is handled in the device driver. The driver must protect
* access to priv->echo_skb, if necessary. * access to priv->echo_skb, if necessary.
*/ */
void can_get_echo_skb(struct net_device *dev, unsigned int idx) unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx)
{ {
struct can_priv *priv = netdev_priv(dev); struct can_priv *priv = netdev_priv(dev);
BUG_ON(idx >= priv->echo_skb_max); BUG_ON(idx >= priv->echo_skb_max);
if (priv->echo_skb[idx]) { if (priv->echo_skb[idx]) {
struct sk_buff *skb = priv->echo_skb[idx];
struct can_frame *cf = (struct can_frame *)skb->data;
u8 dlc = cf->can_dlc;
netif_rx(priv->echo_skb[idx]); netif_rx(priv->echo_skb[idx]);
priv->echo_skb[idx] = NULL; priv->echo_skb[idx] = NULL;
return dlc;
} }
return 0;
} }
EXPORT_SYMBOL_GPL(can_get_echo_skb); EXPORT_SYMBOL_GPL(can_get_echo_skb);
...@@ -392,7 +399,7 @@ void can_restart(unsigned long data) ...@@ -392,7 +399,7 @@ void can_restart(unsigned long data)
stats->rx_bytes += cf->can_dlc; stats->rx_bytes += cf->can_dlc;
restart: restart:
dev_dbg(dev->dev.parent, "restarted\n"); netdev_dbg(dev, "restarted\n");
priv->can_stats.restarts++; priv->can_stats.restarts++;
/* Now restart the device */ /* Now restart the device */
...@@ -400,7 +407,7 @@ void can_restart(unsigned long data) ...@@ -400,7 +407,7 @@ void can_restart(unsigned long data)
netif_carrier_on(dev); netif_carrier_on(dev);
if (err) if (err)
dev_err(dev->dev.parent, "Error %d during restart", err); netdev_err(dev, "Error %d during restart", err);
} }
int can_restart_now(struct net_device *dev) int can_restart_now(struct net_device *dev)
...@@ -433,7 +440,7 @@ void can_bus_off(struct net_device *dev) ...@@ -433,7 +440,7 @@ void can_bus_off(struct net_device *dev)
{ {
struct can_priv *priv = netdev_priv(dev); struct can_priv *priv = netdev_priv(dev);
dev_dbg(dev->dev.parent, "bus-off\n"); netdev_dbg(dev, "bus-off\n");
netif_carrier_off(dev); netif_carrier_off(dev);
priv->can_stats.bus_off++; priv->can_stats.bus_off++;
...@@ -545,7 +552,7 @@ int open_candev(struct net_device *dev) ...@@ -545,7 +552,7 @@ int open_candev(struct net_device *dev)
struct can_priv *priv = netdev_priv(dev); struct can_priv *priv = netdev_priv(dev);
if (!priv->bittiming.tq && !priv->bittiming.bitrate) { if (!priv->bittiming.tq && !priv->bittiming.bitrate) {
dev_err(dev->dev.parent, "bit-timing not yet defined\n"); netdev_err(dev, "bit-timing not yet defined\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -272,7 +272,6 @@ static int flexcan_get_berr_counter(const struct net_device *dev, ...@@ -272,7 +272,6 @@ static int flexcan_get_berr_counter(const struct net_device *dev,
static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev) static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
const struct flexcan_priv *priv = netdev_priv(dev); const struct flexcan_priv *priv = netdev_priv(dev);
struct net_device_stats *stats = &dev->stats;
struct flexcan_regs __iomem *regs = priv->base; struct flexcan_regs __iomem *regs = priv->base;
struct can_frame *cf = (struct can_frame *)skb->data; struct can_frame *cf = (struct can_frame *)skb->data;
u32 can_id; u32 can_id;
...@@ -302,14 +301,11 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -302,14 +301,11 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)
flexcan_write(data, &regs->cantxfg[FLEXCAN_TX_BUF_ID].data[1]); flexcan_write(data, &regs->cantxfg[FLEXCAN_TX_BUF_ID].data[1]);
} }
can_put_echo_skb(skb, dev, 0);
flexcan_write(can_id, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_id); flexcan_write(can_id, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_id);
flexcan_write(ctrl, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); flexcan_write(ctrl, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl);
kfree_skb(skb);
/* tx_packets is incremented in flexcan_irq */
stats->tx_bytes += cf->can_dlc;
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
...@@ -322,34 +318,34 @@ static void do_bus_err(struct net_device *dev, ...@@ -322,34 +318,34 @@ static void do_bus_err(struct net_device *dev,
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
if (reg_esr & FLEXCAN_ESR_BIT1_ERR) { if (reg_esr & FLEXCAN_ESR_BIT1_ERR) {
dev_dbg(dev->dev.parent, "BIT1_ERR irq\n"); netdev_dbg(dev, "BIT1_ERR irq\n");
cf->data[2] |= CAN_ERR_PROT_BIT1; cf->data[2] |= CAN_ERR_PROT_BIT1;
tx_errors = 1; tx_errors = 1;
} }
if (reg_esr & FLEXCAN_ESR_BIT0_ERR) { if (reg_esr & FLEXCAN_ESR_BIT0_ERR) {
dev_dbg(dev->dev.parent, "BIT0_ERR irq\n"); netdev_dbg(dev, "BIT0_ERR irq\n");
cf->data[2] |= CAN_ERR_PROT_BIT0; cf->data[2] |= CAN_ERR_PROT_BIT0;
tx_errors = 1; tx_errors = 1;
} }
if (reg_esr & FLEXCAN_ESR_ACK_ERR) { if (reg_esr & FLEXCAN_ESR_ACK_ERR) {
dev_dbg(dev->dev.parent, "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) {
dev_dbg(dev->dev.parent, "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) {
dev_dbg(dev->dev.parent, "FRM_ERR irq\n"); netdev_dbg(dev, "FRM_ERR irq\n");
cf->data[2] |= CAN_ERR_PROT_FORM; cf->data[2] |= CAN_ERR_PROT_FORM;
rx_errors = 1; rx_errors = 1;
} }
if (reg_esr & FLEXCAN_ESR_STF_ERR) { if (reg_esr & FLEXCAN_ESR_STF_ERR) {
dev_dbg(dev->dev.parent, "STF_ERR irq\n"); netdev_dbg(dev, "STF_ERR irq\n");
cf->data[2] |= CAN_ERR_PROT_STUFF; cf->data[2] |= CAN_ERR_PROT_STUFF;
rx_errors = 1; rx_errors = 1;
} }
...@@ -396,7 +392,7 @@ static void do_state(struct net_device *dev, ...@@ -396,7 +392,7 @@ static void do_state(struct net_device *dev,
*/ */
if (new_state >= CAN_STATE_ERROR_WARNING && if (new_state >= CAN_STATE_ERROR_WARNING &&
new_state <= CAN_STATE_BUS_OFF) { new_state <= CAN_STATE_BUS_OFF) {
dev_dbg(dev->dev.parent, "Error Warning IRQ\n"); netdev_dbg(dev, "Error Warning IRQ\n");
priv->can.can_stats.error_warning++; priv->can.can_stats.error_warning++;
cf->can_id |= CAN_ERR_CRTL; cf->can_id |= CAN_ERR_CRTL;
...@@ -412,7 +408,7 @@ static void do_state(struct net_device *dev, ...@@ -412,7 +408,7 @@ static void do_state(struct net_device *dev,
*/ */
if (new_state >= CAN_STATE_ERROR_PASSIVE && if (new_state >= CAN_STATE_ERROR_PASSIVE &&
new_state <= CAN_STATE_BUS_OFF) { new_state <= CAN_STATE_BUS_OFF) {
dev_dbg(dev->dev.parent, "Error Passive IRQ\n"); netdev_dbg(dev, "Error Passive IRQ\n");
priv->can.can_stats.error_passive++; priv->can.can_stats.error_passive++;
cf->can_id |= CAN_ERR_CRTL; cf->can_id |= CAN_ERR_CRTL;
...@@ -422,8 +418,8 @@ static void do_state(struct net_device *dev, ...@@ -422,8 +418,8 @@ static void do_state(struct net_device *dev,
} }
break; break;
case CAN_STATE_BUS_OFF: case CAN_STATE_BUS_OFF:
dev_err(dev->dev.parent, netdev_err(dev, "BUG! "
"BUG! hardware recovered automatically from BUS_OFF\n"); "hardware recovered automatically from BUS_OFF\n");
break; break;
default: default:
break; break;
...@@ -432,7 +428,7 @@ static void do_state(struct net_device *dev, ...@@ -432,7 +428,7 @@ static void do_state(struct net_device *dev,
/* process state changes depending on the new state */ /* process state changes depending on the new state */
switch (new_state) { switch (new_state) {
case CAN_STATE_ERROR_ACTIVE: case CAN_STATE_ERROR_ACTIVE:
dev_dbg(dev->dev.parent, "Error Active\n"); netdev_dbg(dev, "Error Active\n");
cf->can_id |= CAN_ERR_PROT; cf->can_id |= CAN_ERR_PROT;
cf->data[2] = CAN_ERR_PROT_ACTIVE; cf->data[2] = CAN_ERR_PROT_ACTIVE;
break; break;
...@@ -614,7 +610,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) ...@@ -614,7 +610,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
/* transmission complete interrupt */ /* transmission complete interrupt */
if (reg_iflag1 & (1 << FLEXCAN_TX_BUF_ID)) { if (reg_iflag1 & (1 << FLEXCAN_TX_BUF_ID)) {
/* tx_bytes is incremented in flexcan_start_xmit */ stats->tx_bytes += can_get_echo_skb(dev, 0);
stats->tx_packets++; stats->tx_packets++;
flexcan_write((1 << FLEXCAN_TX_BUF_ID), &regs->iflag1); flexcan_write((1 << FLEXCAN_TX_BUF_ID), &regs->iflag1);
netif_wake_queue(dev); netif_wake_queue(dev);
...@@ -653,12 +649,12 @@ static void flexcan_set_bittiming(struct net_device *dev) ...@@ -653,12 +649,12 @@ static void flexcan_set_bittiming(struct net_device *dev)
if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES)
reg |= FLEXCAN_CTRL_SMP; reg |= FLEXCAN_CTRL_SMP;
dev_info(dev->dev.parent, "writing ctrl=0x%08x\n", reg); netdev_info(dev, "writing ctrl=0x%08x\n", reg);
flexcan_write(reg, &regs->ctrl); flexcan_write(reg, &regs->ctrl);
/* print chip status */ /* print chip status */
dev_dbg(dev->dev.parent, "%s: mcr=0x%08x ctrl=0x%08x\n", __func__, netdev_dbg(dev, "%s: mcr=0x%08x ctrl=0x%08x\n", __func__,
flexcan_read(&regs->mcr), flexcan_read(&regs->ctrl)); flexcan_read(&regs->mcr), flexcan_read(&regs->ctrl));
} }
/* /*
...@@ -684,9 +680,8 @@ static int flexcan_chip_start(struct net_device *dev) ...@@ -684,9 +680,8 @@ static int flexcan_chip_start(struct net_device *dev)
reg_mcr = flexcan_read(&regs->mcr); reg_mcr = flexcan_read(&regs->mcr);
if (reg_mcr & FLEXCAN_MCR_SOFTRST) { if (reg_mcr & FLEXCAN_MCR_SOFTRST) {
dev_err(dev->dev.parent, netdev_err(dev, "Failed to softreset can module (mcr=0x%08x)\n",
"Failed to softreset can module (mcr=0x%08x)\n", reg_mcr);
reg_mcr);
err = -ENODEV; err = -ENODEV;
goto out; goto out;
} }
...@@ -702,13 +697,14 @@ static int flexcan_chip_start(struct net_device *dev) ...@@ -702,13 +697,14 @@ static int flexcan_chip_start(struct net_device *dev)
* only supervisor access * only supervisor access
* enable warning int * enable warning int
* choose format C * choose format C
* disable local echo
* *
*/ */
reg_mcr = flexcan_read(&regs->mcr); reg_mcr = flexcan_read(&regs->mcr);
reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_FEN | FLEXCAN_MCR_HALT | reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_FEN | FLEXCAN_MCR_HALT |
FLEXCAN_MCR_SUPV | FLEXCAN_MCR_WRN_EN | FLEXCAN_MCR_SUPV | FLEXCAN_MCR_WRN_EN |
FLEXCAN_MCR_IDAM_C; FLEXCAN_MCR_IDAM_C | FLEXCAN_MCR_SRX_DIS;
dev_dbg(dev->dev.parent, "%s: writing mcr=0x%08x", __func__, reg_mcr); netdev_dbg(dev, "%s: writing mcr=0x%08x", __func__, reg_mcr);
flexcan_write(reg_mcr, &regs->mcr); flexcan_write(reg_mcr, &regs->mcr);
/* /*
...@@ -734,7 +730,7 @@ static int flexcan_chip_start(struct net_device *dev) ...@@ -734,7 +730,7 @@ static int flexcan_chip_start(struct net_device *dev)
/* save for later use */ /* save for later use */
priv->reg_ctrl_default = reg_ctrl; priv->reg_ctrl_default = reg_ctrl;
dev_dbg(dev->dev.parent, "%s: writing ctrl=0x%08x", __func__, reg_ctrl); netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl);
flexcan_write(reg_ctrl, &regs->ctrl); flexcan_write(reg_ctrl, &regs->ctrl);
for (i = 0; i < ARRAY_SIZE(regs->cantxfg); i++) { for (i = 0; i < ARRAY_SIZE(regs->cantxfg); i++) {
...@@ -766,8 +762,8 @@ static int flexcan_chip_start(struct net_device *dev) ...@@ -766,8 +762,8 @@ static int flexcan_chip_start(struct net_device *dev)
flexcan_write(FLEXCAN_IFLAG_DEFAULT, &regs->imask1); flexcan_write(FLEXCAN_IFLAG_DEFAULT, &regs->imask1);
/* print chip status */ /* print chip status */
dev_dbg(dev->dev.parent, "%s: reading mcr=0x%08x ctrl=0x%08x\n", netdev_dbg(dev, "%s: reading mcr=0x%08x ctrl=0x%08x\n", __func__,
__func__, flexcan_read(&regs->mcr), flexcan_read(&regs->ctrl)); flexcan_read(&regs->mcr), flexcan_read(&regs->ctrl));
return 0; return 0;
...@@ -905,8 +901,7 @@ static int __devinit register_flexcandev(struct net_device *dev) ...@@ -905,8 +901,7 @@ static int __devinit register_flexcandev(struct net_device *dev)
*/ */
reg = flexcan_read(&regs->mcr); reg = flexcan_read(&regs->mcr);
if (!(reg & FLEXCAN_MCR_FEN)) { if (!(reg & FLEXCAN_MCR_FEN)) {
dev_err(dev->dev.parent, netdev_err(dev, "Could not enable RX FIFO, unsupported core\n");
"Could not enable RX FIFO, unsupported core\n");
err = -ENODEV; err = -ENODEV;
goto out; goto out;
} }
...@@ -975,7 +970,7 @@ static int __devinit flexcan_probe(struct platform_device *pdev) ...@@ -975,7 +970,7 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
goto failed_map; goto failed_map;
} }
dev = alloc_candev(sizeof(struct flexcan_priv), 0); dev = alloc_candev(sizeof(struct flexcan_priv), 1);
if (!dev) { if (!dev) {
err = -ENOMEM; err = -ENOMEM;
goto failed_alloc; goto failed_alloc;
...@@ -983,7 +978,7 @@ static int __devinit flexcan_probe(struct platform_device *pdev) ...@@ -983,7 +978,7 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
dev->netdev_ops = &flexcan_netdev_ops; dev->netdev_ops = &flexcan_netdev_ops;
dev->irq = irq; dev->irq = irq;
dev->flags |= IFF_ECHO; /* we support local echo in hardware */ dev->flags |= IFF_ECHO;
priv = netdev_priv(dev); priv = netdev_priv(dev);
priv->can.clock.freq = clock_freq; priv->can.clock.freq = clock_freq;
......
...@@ -712,8 +712,7 @@ static void mcp251x_error_skb(struct net_device *net, int can_id, int data1) ...@@ -712,8 +712,7 @@ static void mcp251x_error_skb(struct net_device *net, int can_id, int data1)
frame->data[1] = data1; frame->data[1] = data1;
netif_rx_ni(skb); netif_rx_ni(skb);
} else { } else {
dev_err(&net->dev, netdev_err(net, "cannot allocate error skb\n");
"cannot allocate error skb\n");
} }
} }
......
...@@ -95,9 +95,9 @@ static int mscan_set_mode(struct net_device *dev, u8 mode) ...@@ -95,9 +95,9 @@ static int mscan_set_mode(struct net_device *dev, u8 mode)
* any, at once. * any, at once.
*/ */
if (i >= MSCAN_SET_MODE_RETRIES) if (i >= MSCAN_SET_MODE_RETRIES)
dev_dbg(dev->dev.parent, netdev_dbg(dev,
"device failed to enter sleep mode. " "device failed to enter sleep mode. "
"We proceed anyhow.\n"); "We proceed anyhow.\n");
else else
priv->can.state = CAN_STATE_SLEEPING; priv->can.state = CAN_STATE_SLEEPING;
} }
...@@ -213,7 +213,7 @@ static netdev_tx_t mscan_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -213,7 +213,7 @@ static netdev_tx_t mscan_start_xmit(struct sk_buff *skb, struct net_device *dev)
switch (hweight8(i)) { switch (hweight8(i)) {
case 0: case 0:
netif_stop_queue(dev); netif_stop_queue(dev);
dev_err(dev->dev.parent, "Tx Ring full when queue awake!\n"); netdev_err(dev, "Tx Ring full when queue awake!\n");
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
case 1: case 1:
/* /*
...@@ -352,7 +352,7 @@ static void mscan_get_err_frame(struct net_device *dev, struct can_frame *frame, ...@@ -352,7 +352,7 @@ static void mscan_get_err_frame(struct net_device *dev, struct can_frame *frame,
struct net_device_stats *stats = &dev->stats; struct net_device_stats *stats = &dev->stats;
enum can_state old_state; enum can_state old_state;
dev_dbg(dev->dev.parent, "error interrupt (canrflg=%#x)\n", canrflg); netdev_dbg(dev, "error interrupt (canrflg=%#x)\n", canrflg);
frame->can_id = CAN_ERR_FLAG; frame->can_id = CAN_ERR_FLAG;
if (canrflg & MSCAN_OVRIF) { if (canrflg & MSCAN_OVRIF) {
...@@ -427,7 +427,7 @@ static int mscan_rx_poll(struct napi_struct *napi, int quota) ...@@ -427,7 +427,7 @@ static int mscan_rx_poll(struct napi_struct *napi, int quota)
skb = alloc_can_skb(dev, &frame); skb = alloc_can_skb(dev, &frame);
if (!skb) { if (!skb) {
if (printk_ratelimit()) if (printk_ratelimit())
dev_notice(dev->dev.parent, "packet dropped\n"); netdev_notice(dev, "packet dropped\n");
stats->rx_dropped++; stats->rx_dropped++;
out_8(&regs->canrflg, canrflg); out_8(&regs->canrflg, canrflg);
continue; continue;
...@@ -551,8 +551,7 @@ static int mscan_do_set_bittiming(struct net_device *dev) ...@@ -551,8 +551,7 @@ static int mscan_do_set_bittiming(struct net_device *dev)
BTR1_SET_TSEG2(bt->phase_seg2) | BTR1_SET_TSEG2(bt->phase_seg2) |
BTR1_SET_SAM(priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES)); BTR1_SET_SAM(priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES));
dev_info(dev->dev.parent, "setting BTR0=0x%02x BTR1=0x%02x\n", netdev_info(dev, "setting BTR0=0x%02x BTR1=0x%02x\n", btr0, btr1);
btr0, btr1);
out_8(&regs->canbtr0, btr0); out_8(&regs->canbtr0, btr0);
out_8(&regs->canbtr1, btr1); out_8(&regs->canbtr1, btr1);
...@@ -560,6 +559,18 @@ static int mscan_do_set_bittiming(struct net_device *dev) ...@@ -560,6 +559,18 @@ static int mscan_do_set_bittiming(struct net_device *dev)
return 0; return 0;
} }
static int mscan_get_berr_counter(const struct net_device *dev,
struct can_berr_counter *bec)
{
struct mscan_priv *priv = netdev_priv(dev);
struct mscan_regs __iomem *regs = priv->reg_base;
bec->txerr = in_8(&regs->cantxerr);
bec->rxerr = in_8(&regs->canrxerr);
return 0;
}
static int mscan_open(struct net_device *dev) static int mscan_open(struct net_device *dev)
{ {
int ret; int ret;
...@@ -575,7 +586,7 @@ static int mscan_open(struct net_device *dev) ...@@ -575,7 +586,7 @@ static int mscan_open(struct net_device *dev)
ret = request_irq(dev->irq, mscan_isr, 0, dev->name, dev); ret = request_irq(dev->irq, mscan_isr, 0, dev->name, dev);
if (ret < 0) { if (ret < 0) {
dev_err(dev->dev.parent, "failed to attach interrupt\n"); netdev_err(dev, "failed to attach interrupt\n");
goto exit_napi_disable; goto exit_napi_disable;
} }
...@@ -639,8 +650,10 @@ int register_mscandev(struct net_device *dev, int mscan_clksrc) ...@@ -639,8 +650,10 @@ int register_mscandev(struct net_device *dev, int mscan_clksrc)
else else
ctl1 &= ~MSCAN_CLKSRC; ctl1 &= ~MSCAN_CLKSRC;
if (priv->type == MSCAN_TYPE_MPC5121) if (priv->type == MSCAN_TYPE_MPC5121) {
priv->can.do_get_berr_counter = mscan_get_berr_counter;
ctl1 |= MSCAN_BORM; /* bus-off recovery upon request */ ctl1 |= MSCAN_BORM; /* bus-off recovery upon request */
}
ctl1 |= MSCAN_CANE; ctl1 |= MSCAN_CANE;
out_8(&regs->canctl1, ctl1); out_8(&regs->canctl1, ctl1);
......
/* /*
* Copyright (C) 1999 - 2010 Intel Corporation. * Copyright (C) 1999 - 2010 Intel Corporation.
* Copyright (C) 2010 OKI SEMICONDUCTOR CO., LTD. * Copyright (C) 2010 LAPIS SEMICONDUCTOR CO., LTD.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
......
...@@ -71,6 +71,7 @@ config CAN_PLX_PCI ...@@ -71,6 +71,7 @@ config CAN_PLX_PCI
- esd CAN-PCIe/2000 - esd CAN-PCIe/2000
- Marathon CAN-bus-PCI card (http://www.marathon.ru/) - Marathon CAN-bus-PCI card (http://www.marathon.ru/)
- TEWS TECHNOLOGIES TPMC810 card (http://www.tews.com/) - TEWS TECHNOLOGIES TPMC810 card (http://www.tews.com/)
- IXXAT Automation PC-I 04/PCI card (http://www.ixxat.com/)
config CAN_TSCAN1 config CAN_TSCAN1
tristate "TS-CAN1 PC104 boards" tristate "TS-CAN1 PC104 boards"
......
...@@ -43,7 +43,8 @@ MODULE_SUPPORTED_DEVICE("Adlink PCI-7841/cPCI-7841, " ...@@ -43,7 +43,8 @@ MODULE_SUPPORTED_DEVICE("Adlink PCI-7841/cPCI-7841, "
"TEWS TECHNOLOGIES TPMC810, " "TEWS TECHNOLOGIES TPMC810, "
"esd CAN-PCI/CPCI/PCI104/200, " "esd CAN-PCI/CPCI/PCI104/200, "
"esd CAN-PCI/PMC/266, " "esd CAN-PCI/PMC/266, "
"esd CAN-PCIe/2000") "esd CAN-PCIe/2000, "
"IXXAT PC-I 04/PCI")
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
#define PLX_PCI_MAX_CHAN 2 #define PLX_PCI_MAX_CHAN 2
...@@ -121,6 +122,10 @@ struct plx_pci_card { ...@@ -121,6 +122,10 @@ struct plx_pci_card {
#define ESD_PCI_SUB_SYS_ID_PCIE2000 0x0200 #define ESD_PCI_SUB_SYS_ID_PCIE2000 0x0200
#define ESD_PCI_SUB_SYS_ID_PCI104200 0x0501 #define ESD_PCI_SUB_SYS_ID_PCI104200 0x0501
#define IXXAT_PCI_VENDOR_ID 0x10b5
#define IXXAT_PCI_DEVICE_ID 0x9050
#define IXXAT_PCI_SUB_SYS_ID 0x2540
#define MARATHON_PCI_DEVICE_ID 0x2715 #define MARATHON_PCI_DEVICE_ID 0x2715
#define TEWS_PCI_VENDOR_ID 0x1498 #define TEWS_PCI_VENDOR_ID 0x1498
...@@ -193,6 +198,14 @@ static struct plx_pci_card_info plx_pci_card_info_esd2000 __devinitdata = { ...@@ -193,6 +198,14 @@ static struct plx_pci_card_info plx_pci_card_info_esd2000 __devinitdata = {
/* based on PEX8311 */ /* based on PEX8311 */
}; };
static struct plx_pci_card_info plx_pci_card_info_ixxat __devinitdata = {
"IXXAT PC-I 04/PCI", 2,
PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR,
{0, 0x00, 0x00}, { {2, 0x00, 0x80}, {2, 0x200, 0x80} },
&plx_pci_reset_common
/* based on PLX9050 */
};
static struct plx_pci_card_info plx_pci_card_info_marathon __devinitdata = { static struct plx_pci_card_info plx_pci_card_info_marathon __devinitdata = {
"Marathon CAN-bus-PCI", 2, "Marathon CAN-bus-PCI", 2,
PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR, PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR,
...@@ -266,6 +279,13 @@ static DEFINE_PCI_DEVICE_TABLE(plx_pci_tbl) = { ...@@ -266,6 +279,13 @@ static DEFINE_PCI_DEVICE_TABLE(plx_pci_tbl) = {
0, 0, 0, 0,
(kernel_ulong_t)&plx_pci_card_info_esd2000 (kernel_ulong_t)&plx_pci_card_info_esd2000
}, },
{
/* IXXAT PC-I 04/PCI card */
IXXAT_PCI_VENDOR_ID, IXXAT_PCI_DEVICE_ID,
PCI_ANY_ID, IXXAT_PCI_SUB_SYS_ID,
0, 0,
(kernel_ulong_t)&plx_pci_card_info_ixxat
},
{ {
/* Marathon CAN-bus-PCI card */ /* Marathon CAN-bus-PCI card */
PCI_VENDOR_ID_PLX, MARATHON_PCI_DEVICE_ID, PCI_VENDOR_ID_PLX, MARATHON_PCI_DEVICE_ID,
......
...@@ -128,7 +128,7 @@ static void set_reset_mode(struct net_device *dev) ...@@ -128,7 +128,7 @@ static void set_reset_mode(struct net_device *dev)
status = priv->read_reg(priv, REG_MOD); status = priv->read_reg(priv, REG_MOD);
} }
dev_err(dev->dev.parent, "setting SJA1000 into reset mode failed!\n"); netdev_err(dev, "setting SJA1000 into reset mode failed!\n");
} }
static void set_normal_mode(struct net_device *dev) static void set_normal_mode(struct net_device *dev)
...@@ -156,7 +156,7 @@ static void set_normal_mode(struct net_device *dev) ...@@ -156,7 +156,7 @@ static void set_normal_mode(struct net_device *dev)
status = priv->read_reg(priv, REG_MOD); status = priv->read_reg(priv, REG_MOD);
} }
dev_err(dev->dev.parent, "setting SJA1000 into normal mode failed!\n"); netdev_err(dev, "setting SJA1000 into normal mode failed!\n");
} }
static void sja1000_start(struct net_device *dev) static void sja1000_start(struct net_device *dev)
...@@ -209,8 +209,7 @@ static int sja1000_set_bittiming(struct net_device *dev) ...@@ -209,8 +209,7 @@ static int sja1000_set_bittiming(struct net_device *dev)
if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES)
btr1 |= 0x80; btr1 |= 0x80;
dev_info(dev->dev.parent, netdev_info(dev, "setting BTR0=0x%02x BTR1=0x%02x\n", btr0, btr1);
"setting BTR0=0x%02x BTR1=0x%02x\n", btr0, btr1);
priv->write_reg(priv, REG_BTR0, btr0); priv->write_reg(priv, REG_BTR0, btr0);
priv->write_reg(priv, REG_BTR1, btr1); priv->write_reg(priv, REG_BTR1, btr1);
...@@ -378,7 +377,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) ...@@ -378,7 +377,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
if (isrc & IRQ_DOI) { if (isrc & IRQ_DOI) {
/* data overrun interrupt */ /* data overrun interrupt */
dev_dbg(dev->dev.parent, "data overrun interrupt\n"); netdev_dbg(dev, "data overrun interrupt\n");
cf->can_id |= CAN_ERR_CRTL; cf->can_id |= CAN_ERR_CRTL;
cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
stats->rx_over_errors++; stats->rx_over_errors++;
...@@ -388,7 +387,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) ...@@ -388,7 +387,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
if (isrc & IRQ_EI) { if (isrc & IRQ_EI) {
/* error warning interrupt */ /* error warning interrupt */
dev_dbg(dev->dev.parent, "error warning interrupt\n"); netdev_dbg(dev, "error warning interrupt\n");
if (status & SR_BS) { if (status & SR_BS) {
state = CAN_STATE_BUS_OFF; state = CAN_STATE_BUS_OFF;
...@@ -429,7 +428,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) ...@@ -429,7 +428,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
} }
if (isrc & IRQ_EPI) { if (isrc & IRQ_EPI) {
/* error passive interrupt */ /* error passive interrupt */
dev_dbg(dev->dev.parent, "error passive interrupt\n"); netdev_dbg(dev, "error passive interrupt\n");
if (status & SR_ES) if (status & SR_ES)
state = CAN_STATE_ERROR_PASSIVE; state = CAN_STATE_ERROR_PASSIVE;
else else
...@@ -437,7 +436,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) ...@@ -437,7 +436,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
} }
if (isrc & IRQ_ALI) { if (isrc & IRQ_ALI) {
/* arbitration lost interrupt */ /* arbitration lost interrupt */
dev_dbg(dev->dev.parent, "arbitration lost interrupt\n"); netdev_dbg(dev, "arbitration lost interrupt\n");
alc = priv->read_reg(priv, REG_ALC); alc = priv->read_reg(priv, REG_ALC);
priv->can.can_stats.arbitration_lost++; priv->can.can_stats.arbitration_lost++;
stats->tx_errors++; stats->tx_errors++;
...@@ -495,7 +494,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) ...@@ -495,7 +494,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
status = priv->read_reg(priv, REG_SR); status = priv->read_reg(priv, REG_SR);
if (isrc & IRQ_WUI) if (isrc & IRQ_WUI)
dev_warn(dev->dev.parent, "wakeup interrupt\n"); netdev_warn(dev, "wakeup interrupt\n");
if (isrc & IRQ_TI) { if (isrc & IRQ_TI) {
/* transmission complete interrupt */ /* transmission complete interrupt */
...@@ -522,7 +521,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) ...@@ -522,7 +521,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
priv->post_irq(priv); priv->post_irq(priv);
if (n >= SJA1000_MAX_IRQ) if (n >= SJA1000_MAX_IRQ)
dev_dbg(dev->dev.parent, "%d messages handled in ISR", n); netdev_dbg(dev, "%d messages handled in ISR", n);
return (n) ? IRQ_HANDLED : IRQ_NONE; return (n) ? IRQ_HANDLED : IRQ_NONE;
} }
......
...@@ -306,7 +306,7 @@ static int ti_hecc_set_btc(struct ti_hecc_priv *priv) ...@@ -306,7 +306,7 @@ static int ti_hecc_set_btc(struct ti_hecc_priv *priv)
if (bit_timing->brp > 4) if (bit_timing->brp > 4)
can_btc |= HECC_CANBTC_SAM; can_btc |= HECC_CANBTC_SAM;
else else
dev_warn(priv->ndev->dev.parent, "WARN: Triple" \ netdev_warn(priv->ndev, "WARN: Triple"
"sampling not set due to h/w limitations"); "sampling not set due to h/w limitations");
} }
can_btc |= ((bit_timing->sjw - 1) & 0x3) << 8; can_btc |= ((bit_timing->sjw - 1) & 0x3) << 8;
...@@ -315,7 +315,7 @@ static int ti_hecc_set_btc(struct ti_hecc_priv *priv) ...@@ -315,7 +315,7 @@ static int ti_hecc_set_btc(struct ti_hecc_priv *priv)
/* ERM being set to 0 by default meaning resync at falling edge */ /* ERM being set to 0 by default meaning resync at falling edge */
hecc_write(priv, HECC_CANBTC, can_btc); hecc_write(priv, HECC_CANBTC, can_btc);
dev_info(priv->ndev->dev.parent, "setting CANBTC=%#x\n", can_btc); netdev_info(priv->ndev, "setting CANBTC=%#x\n", can_btc);
return 0; return 0;
} }
...@@ -332,7 +332,7 @@ static void ti_hecc_reset(struct net_device *ndev) ...@@ -332,7 +332,7 @@ static void ti_hecc_reset(struct net_device *ndev)
u32 cnt; u32 cnt;
struct ti_hecc_priv *priv = netdev_priv(ndev); struct ti_hecc_priv *priv = netdev_priv(ndev);
dev_dbg(ndev->dev.parent, "resetting hecc ...\n"); netdev_dbg(ndev, "resetting hecc ...\n");
hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_SRES); hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_SRES);
/* Set change control request and wait till enabled */ /* Set change control request and wait till enabled */
...@@ -458,6 +458,17 @@ static int ti_hecc_do_set_mode(struct net_device *ndev, enum can_mode mode) ...@@ -458,6 +458,17 @@ static int ti_hecc_do_set_mode(struct net_device *ndev, enum can_mode mode)
return ret; return ret;
} }
static int ti_hecc_get_berr_counter(const struct net_device *ndev,
struct can_berr_counter *bec)
{
struct ti_hecc_priv *priv = netdev_priv(ndev);
bec->txerr = hecc_read(priv, HECC_CANTEC);
bec->rxerr = hecc_read(priv, HECC_CANREC);
return 0;
}
/* /*
* ti_hecc_xmit: HECC Transmit * ti_hecc_xmit: HECC Transmit
* *
...@@ -496,7 +507,7 @@ static netdev_tx_t ti_hecc_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -496,7 +507,7 @@ static netdev_tx_t ti_hecc_xmit(struct sk_buff *skb, struct net_device *ndev)
if (unlikely(hecc_read(priv, HECC_CANME) & mbx_mask)) { if (unlikely(hecc_read(priv, HECC_CANME) & mbx_mask)) {
spin_unlock_irqrestore(&priv->mbx_lock, flags); spin_unlock_irqrestore(&priv->mbx_lock, flags);
netif_stop_queue(ndev); netif_stop_queue(ndev);
dev_err(priv->ndev->dev.parent, netdev_err(priv->ndev,
"BUG: TX mbx not ready tx_head=%08X, tx_tail=%08X\n", "BUG: TX mbx not ready tx_head=%08X, tx_tail=%08X\n",
priv->tx_head, priv->tx_tail); priv->tx_head, priv->tx_tail);
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
...@@ -550,7 +561,7 @@ static int ti_hecc_rx_pkt(struct ti_hecc_priv *priv, int mbxno) ...@@ -550,7 +561,7 @@ static int ti_hecc_rx_pkt(struct ti_hecc_priv *priv, int mbxno)
skb = alloc_can_skb(priv->ndev, &cf); skb = alloc_can_skb(priv->ndev, &cf);
if (!skb) { if (!skb) {
if (printk_ratelimit()) if (printk_ratelimit())
dev_err(priv->ndev->dev.parent, netdev_err(priv->ndev,
"ti_hecc_rx_pkt: alloc_can_skb() failed\n"); "ti_hecc_rx_pkt: alloc_can_skb() failed\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -668,7 +679,7 @@ static int ti_hecc_error(struct net_device *ndev, int int_status, ...@@ -668,7 +679,7 @@ static int ti_hecc_error(struct net_device *ndev, int int_status,
skb = alloc_can_err_skb(ndev, &cf); skb = alloc_can_err_skb(ndev, &cf);
if (!skb) { if (!skb) {
if (printk_ratelimit()) if (printk_ratelimit())
dev_err(priv->ndev->dev.parent, netdev_err(priv->ndev,
"ti_hecc_error: alloc_can_err_skb() failed\n"); "ti_hecc_error: alloc_can_err_skb() failed\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -684,7 +695,7 @@ static int ti_hecc_error(struct net_device *ndev, int int_status, ...@@ -684,7 +695,7 @@ static int ti_hecc_error(struct net_device *ndev, int int_status,
cf->data[1] |= CAN_ERR_CRTL_RX_WARNING; cf->data[1] |= CAN_ERR_CRTL_RX_WARNING;
} }
hecc_set_bit(priv, HECC_CANES, HECC_CANES_EW); hecc_set_bit(priv, HECC_CANES, HECC_CANES_EW);
dev_dbg(priv->ndev->dev.parent, "Error Warning interrupt\n"); netdev_dbg(priv->ndev, "Error Warning interrupt\n");
hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR); hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR);
} }
...@@ -699,7 +710,7 @@ static int ti_hecc_error(struct net_device *ndev, int int_status, ...@@ -699,7 +710,7 @@ static int ti_hecc_error(struct net_device *ndev, int int_status,
cf->data[1] |= CAN_ERR_CRTL_RX_PASSIVE; cf->data[1] |= CAN_ERR_CRTL_RX_PASSIVE;
} }
hecc_set_bit(priv, HECC_CANES, HECC_CANES_EP); hecc_set_bit(priv, HECC_CANES, HECC_CANES_EP);
dev_dbg(priv->ndev->dev.parent, "Error passive interrupt\n"); netdev_dbg(priv->ndev, "Error passive interrupt\n");
hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR); hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR);
} }
...@@ -825,7 +836,7 @@ static int ti_hecc_open(struct net_device *ndev) ...@@ -825,7 +836,7 @@ static int ti_hecc_open(struct net_device *ndev)
err = request_irq(ndev->irq, ti_hecc_interrupt, IRQF_SHARED, err = request_irq(ndev->irq, ti_hecc_interrupt, IRQF_SHARED,
ndev->name, ndev); ndev->name, ndev);
if (err) { if (err) {
dev_err(ndev->dev.parent, "error requesting interrupt\n"); netdev_err(ndev, "error requesting interrupt\n");
return err; return err;
} }
...@@ -834,7 +845,7 @@ static int ti_hecc_open(struct net_device *ndev) ...@@ -834,7 +845,7 @@ static int ti_hecc_open(struct net_device *ndev)
/* Open common can device */ /* Open common can device */
err = open_candev(ndev); err = open_candev(ndev);
if (err) { if (err) {
dev_err(ndev->dev.parent, "open_candev() failed %d\n", err); netdev_err(ndev, "open_candev() failed %d\n", err);
ti_hecc_transceiver_switch(priv, 0); ti_hecc_transceiver_switch(priv, 0);
free_irq(ndev->irq, ndev); free_irq(ndev->irq, ndev);
return err; return err;
...@@ -923,6 +934,7 @@ static int ti_hecc_probe(struct platform_device *pdev) ...@@ -923,6 +934,7 @@ static int ti_hecc_probe(struct platform_device *pdev)
priv->can.bittiming_const = &ti_hecc_bittiming_const; priv->can.bittiming_const = &ti_hecc_bittiming_const;
priv->can.do_set_mode = ti_hecc_do_set_mode; priv->can.do_set_mode = ti_hecc_do_set_mode;
priv->can.do_get_state = ti_hecc_get_state; priv->can.do_get_state = ti_hecc_get_state;
priv->can.do_get_berr_counter = ti_hecc_get_berr_counter;
priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES; priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES;
spin_lock_init(&priv->mbx_lock); spin_lock_init(&priv->mbx_lock);
......
...@@ -288,8 +288,7 @@ static void ems_usb_read_interrupt_callback(struct urb *urb) ...@@ -288,8 +288,7 @@ static void ems_usb_read_interrupt_callback(struct urb *urb)
return; return;
default: default:
dev_info(netdev->dev.parent, "Rx interrupt aborted %d\n", netdev_info(netdev, "Rx interrupt aborted %d\n", urb->status);
urb->status);
break; break;
} }
...@@ -298,8 +297,7 @@ static void ems_usb_read_interrupt_callback(struct urb *urb) ...@@ -298,8 +297,7 @@ static void ems_usb_read_interrupt_callback(struct urb *urb)
if (err == -ENODEV) if (err == -ENODEV)
netif_device_detach(netdev); netif_device_detach(netdev);
else if (err) else if (err)
dev_err(netdev->dev.parent, netdev_err(netdev, "failed resubmitting intr urb: %d\n", err);
"failed resubmitting intr urb: %d\n", err);
} }
static void ems_usb_rx_can_msg(struct ems_usb *dev, struct ems_cpc_msg *msg) static void ems_usb_rx_can_msg(struct ems_usb *dev, struct ems_cpc_msg *msg)
...@@ -431,8 +429,7 @@ static void ems_usb_read_bulk_callback(struct urb *urb) ...@@ -431,8 +429,7 @@ static void ems_usb_read_bulk_callback(struct urb *urb)
return; return;
default: default:
dev_info(netdev->dev.parent, "Rx URB aborted (%d)\n", netdev_info(netdev, "Rx URB aborted (%d)\n", urb->status);
urb->status);
goto resubmit_urb; goto resubmit_urb;
} }
...@@ -477,7 +474,7 @@ static void ems_usb_read_bulk_callback(struct urb *urb) ...@@ -477,7 +474,7 @@ static void ems_usb_read_bulk_callback(struct urb *urb)
msg_count--; msg_count--;
if (start > urb->transfer_buffer_length) { if (start > urb->transfer_buffer_length) {
dev_err(netdev->dev.parent, "format error\n"); netdev_err(netdev, "format error\n");
break; break;
} }
} }
...@@ -493,8 +490,8 @@ static void ems_usb_read_bulk_callback(struct urb *urb) ...@@ -493,8 +490,8 @@ static void ems_usb_read_bulk_callback(struct urb *urb)
if (retval == -ENODEV) if (retval == -ENODEV)
netif_device_detach(netdev); netif_device_detach(netdev);
else if (retval) else if (retval)
dev_err(netdev->dev.parent, netdev_err(netdev,
"failed resubmitting read bulk urb: %d\n", retval); "failed resubmitting read bulk urb: %d\n", retval);
} }
/* /*
...@@ -521,8 +518,7 @@ static void ems_usb_write_bulk_callback(struct urb *urb) ...@@ -521,8 +518,7 @@ static void ems_usb_write_bulk_callback(struct urb *urb)
return; return;
if (urb->status) if (urb->status)
dev_info(netdev->dev.parent, "Tx URB aborted (%d)\n", netdev_info(netdev, "Tx URB aborted (%d)\n", urb->status);
urb->status);
netdev->trans_start = jiffies; netdev->trans_start = jiffies;
...@@ -605,18 +601,18 @@ static int ems_usb_start(struct ems_usb *dev) ...@@ -605,18 +601,18 @@ static int ems_usb_start(struct ems_usb *dev)
/* create a URB, and a buffer for it */ /* create a URB, and a buffer for it */
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb) { if (!urb) {
dev_err(netdev->dev.parent, netdev_err(netdev, "No memory left for URBs\n");
"No memory left for URBs\n"); err = -ENOMEM;
return -ENOMEM; break;
} }
buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL, buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL,
&urb->transfer_dma); &urb->transfer_dma);
if (!buf) { if (!buf) {
dev_err(netdev->dev.parent, netdev_err(netdev, "No memory left for USB buffer\n");
"No memory left for USB buffer\n");
usb_free_urb(urb); usb_free_urb(urb);
return -ENOMEM; err = -ENOMEM;
break;
} }
usb_fill_bulk_urb(urb, dev->udev, usb_rcvbulkpipe(dev->udev, 2), usb_fill_bulk_urb(urb, dev->udev, usb_rcvbulkpipe(dev->udev, 2),
...@@ -639,13 +635,13 @@ static int ems_usb_start(struct ems_usb *dev) ...@@ -639,13 +635,13 @@ static int ems_usb_start(struct ems_usb *dev)
/* Did we submit any URBs */ /* Did we submit any URBs */
if (i == 0) { if (i == 0) {
dev_warn(netdev->dev.parent, "couldn't setup read URBs\n"); netdev_warn(netdev, "couldn't setup read URBs\n");
return err; return err;
} }
/* Warn if we've couldn't transmit all the URBs */ /* Warn if we've couldn't transmit all the URBs */
if (i < MAX_RX_URBS) if (i < MAX_RX_URBS)
dev_warn(netdev->dev.parent, "rx performance may be slow\n"); netdev_warn(netdev, "rx performance may be slow\n");
/* Setup and start interrupt URB */ /* Setup and start interrupt URB */
usb_fill_int_urb(dev->intr_urb, dev->udev, usb_fill_int_urb(dev->intr_urb, dev->udev,
...@@ -656,8 +652,7 @@ static int ems_usb_start(struct ems_usb *dev) ...@@ -656,8 +652,7 @@ static int ems_usb_start(struct ems_usb *dev)
err = usb_submit_urb(dev->intr_urb, GFP_KERNEL); err = usb_submit_urb(dev->intr_urb, GFP_KERNEL);
if (err) { if (err) {
dev_warn(netdev->dev.parent, "intr URB submit failed: %d\n", netdev_warn(netdev, "intr URB submit failed: %d\n", err);
err);
return err; return err;
} }
...@@ -686,7 +681,7 @@ static int ems_usb_start(struct ems_usb *dev) ...@@ -686,7 +681,7 @@ static int ems_usb_start(struct ems_usb *dev)
return 0; return 0;
failed: failed:
dev_warn(netdev->dev.parent, "couldn't submit control: %d\n", err); netdev_warn(netdev, "couldn't submit control: %d\n", err);
return err; return err;
} }
...@@ -726,8 +721,7 @@ static int ems_usb_open(struct net_device *netdev) ...@@ -726,8 +721,7 @@ static int ems_usb_open(struct net_device *netdev)
if (err == -ENODEV) if (err == -ENODEV)
netif_device_detach(dev->netdev); netif_device_detach(dev->netdev);
dev_warn(netdev->dev.parent, "couldn't start device: %d\n", netdev_warn(netdev, "couldn't start device: %d\n", err);
err);
close_candev(netdev); close_candev(netdev);
...@@ -760,13 +754,13 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne ...@@ -760,13 +754,13 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
/* create a URB, and a buffer for it, and copy the data to the URB */ /* create a URB, and a buffer for it, and copy the data to the URB */
urb = usb_alloc_urb(0, GFP_ATOMIC); urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) { if (!urb) {
dev_err(netdev->dev.parent, "No memory left for URBs\n"); netdev_err(netdev, "No memory left for URBs\n");
goto nomem; goto nomem;
} }
buf = usb_alloc_coherent(dev->udev, size, GFP_ATOMIC, &urb->transfer_dma); buf = usb_alloc_coherent(dev->udev, size, GFP_ATOMIC, &urb->transfer_dma);
if (!buf) { if (!buf) {
dev_err(netdev->dev.parent, "No memory left for USB buffer\n"); netdev_err(netdev, "No memory left for USB buffer\n");
usb_free_urb(urb); usb_free_urb(urb);
goto nomem; goto nomem;
} }
...@@ -809,7 +803,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne ...@@ -809,7 +803,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
usb_unanchor_urb(urb); usb_unanchor_urb(urb);
usb_free_coherent(dev->udev, size, buf, urb->transfer_dma); usb_free_coherent(dev->udev, size, buf, urb->transfer_dma);
dev_warn(netdev->dev.parent, "couldn't find free context\n"); netdev_warn(netdev, "couldn't find free context\n");
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
...@@ -840,7 +834,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne ...@@ -840,7 +834,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
if (err == -ENODEV) { if (err == -ENODEV) {
netif_device_detach(netdev); netif_device_detach(netdev);
} else { } else {
dev_warn(netdev->dev.parent, "failed tx_urb %d\n", err); netdev_warn(netdev, "failed tx_urb %d\n", err);
stats->tx_dropped++; stats->tx_dropped++;
} }
...@@ -880,7 +874,7 @@ static int ems_usb_close(struct net_device *netdev) ...@@ -880,7 +874,7 @@ static int ems_usb_close(struct net_device *netdev)
/* Set CAN controller to reset mode */ /* Set CAN controller to reset mode */
if (ems_usb_write_mode(dev, SJA1000_MOD_RM)) if (ems_usb_write_mode(dev, SJA1000_MOD_RM))
dev_warn(netdev->dev.parent, "couldn't stop device"); netdev_warn(netdev, "couldn't stop device");
close_candev(netdev); close_candev(netdev);
...@@ -917,7 +911,7 @@ static int ems_usb_set_mode(struct net_device *netdev, enum can_mode mode) ...@@ -917,7 +911,7 @@ static int ems_usb_set_mode(struct net_device *netdev, enum can_mode mode)
switch (mode) { switch (mode) {
case CAN_MODE_START: case CAN_MODE_START:
if (ems_usb_write_mode(dev, SJA1000_MOD_NORMAL)) if (ems_usb_write_mode(dev, SJA1000_MOD_NORMAL))
dev_warn(netdev->dev.parent, "couldn't start device"); netdev_warn(netdev, "couldn't start device");
if (netif_queue_stopped(netdev)) if (netif_queue_stopped(netdev))
netif_wake_queue(netdev); netif_wake_queue(netdev);
...@@ -942,8 +936,7 @@ static int ems_usb_set_bittiming(struct net_device *netdev) ...@@ -942,8 +936,7 @@ static int ems_usb_set_bittiming(struct net_device *netdev)
if (dev->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) if (dev->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES)
btr1 |= 0x80; btr1 |= 0x80;
dev_info(netdev->dev.parent, "setting BTR0=0x%02x BTR1=0x%02x\n", netdev_info(netdev, "setting BTR0=0x%02x BTR1=0x%02x\n", btr0, btr1);
btr0, btr1);
dev->active_params.msg.can_params.cc_params.sja1000.btr0 = btr0; dev->active_params.msg.can_params.cc_params.sja1000.btr0 = btr0;
dev->active_params.msg.can_params.cc_params.sja1000.btr1 = btr1; dev->active_params.msg.can_params.cc_params.sja1000.btr1 = btr1;
...@@ -1048,15 +1041,13 @@ static int ems_usb_probe(struct usb_interface *intf, ...@@ -1048,15 +1041,13 @@ static int ems_usb_probe(struct usb_interface *intf,
err = ems_usb_command_msg(dev, &dev->active_params); err = ems_usb_command_msg(dev, &dev->active_params);
if (err) { if (err) {
dev_err(netdev->dev.parent, netdev_err(netdev, "couldn't initialize controller: %d\n", err);
"couldn't initialize controller: %d\n", err);
goto cleanup_tx_msg_buffer; goto cleanup_tx_msg_buffer;
} }
err = register_candev(netdev); err = register_candev(netdev);
if (err) { if (err) {
dev_err(netdev->dev.parent, netdev_err(netdev, "couldn't register CAN device: %d\n", err);
"couldn't register CAN device: %d\n", err);
goto cleanup_tx_msg_buffer; goto cleanup_tx_msg_buffer;
} }
......
...@@ -470,8 +470,7 @@ static void esd_usb2_write_bulk_callback(struct urb *urb) ...@@ -470,8 +470,7 @@ static void esd_usb2_write_bulk_callback(struct urb *urb)
return; return;
if (urb->status) if (urb->status)
dev_info(netdev->dev.parent, "Tx URB aborted (%d)\n", netdev_info(netdev, "Tx URB aborted (%d)\n", urb->status);
urb->status);
netdev->trans_start = jiffies; netdev->trans_start = jiffies;
} }
...@@ -651,7 +650,7 @@ static int esd_usb2_start(struct esd_usb2_net_priv *priv) ...@@ -651,7 +650,7 @@ static int esd_usb2_start(struct esd_usb2_net_priv *priv)
if (err == -ENODEV) if (err == -ENODEV)
netif_device_detach(netdev); netif_device_detach(netdev);
dev_err(netdev->dev.parent, "couldn't start device: %d\n", err); netdev_err(netdev, "couldn't start device: %d\n", err);
return err; return err;
} }
...@@ -687,8 +686,7 @@ static int esd_usb2_open(struct net_device *netdev) ...@@ -687,8 +686,7 @@ static int esd_usb2_open(struct net_device *netdev)
/* finally start device */ /* finally start device */
err = esd_usb2_start(priv); err = esd_usb2_start(priv);
if (err) { if (err) {
dev_warn(netdev->dev.parent, netdev_warn(netdev, "couldn't start device: %d\n", err);
"couldn't start device: %d\n", err);
close_candev(netdev); close_candev(netdev);
return err; return err;
} }
...@@ -721,7 +719,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb, ...@@ -721,7 +719,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb,
/* create a URB, and a buffer for it, and copy the data to the URB */ /* create a URB, and a buffer for it, and copy the data to the URB */
urb = usb_alloc_urb(0, GFP_ATOMIC); urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) { if (!urb) {
dev_err(netdev->dev.parent, "No memory left for URBs\n"); netdev_err(netdev, "No memory left for URBs\n");
stats->tx_dropped++; stats->tx_dropped++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
goto nourbmem; goto nourbmem;
...@@ -730,7 +728,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb, ...@@ -730,7 +728,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb,
buf = usb_alloc_coherent(dev->udev, size, GFP_ATOMIC, buf = usb_alloc_coherent(dev->udev, size, GFP_ATOMIC,
&urb->transfer_dma); &urb->transfer_dma);
if (!buf) { if (!buf) {
dev_err(netdev->dev.parent, "No memory left for USB buffer\n"); netdev_err(netdev, "No memory left for USB buffer\n");
stats->tx_dropped++; stats->tx_dropped++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
goto nobufmem; goto nobufmem;
...@@ -766,7 +764,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb, ...@@ -766,7 +764,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb,
* This may never happen. * This may never happen.
*/ */
if (!context) { if (!context) {
dev_warn(netdev->dev.parent, "couldn't find free context\n"); netdev_warn(netdev, "couldn't find free context\n");
ret = NETDEV_TX_BUSY; ret = NETDEV_TX_BUSY;
goto releasebuf; goto releasebuf;
} }
...@@ -806,7 +804,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb, ...@@ -806,7 +804,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb,
if (err == -ENODEV) if (err == -ENODEV)
netif_device_detach(netdev); netif_device_detach(netdev);
else else
dev_warn(netdev->dev.parent, "failed tx_urb %d\n", err); netdev_warn(netdev, "failed tx_urb %d\n", err);
goto releasebuf; goto releasebuf;
} }
...@@ -845,7 +843,7 @@ static int esd_usb2_close(struct net_device *netdev) ...@@ -845,7 +843,7 @@ static int esd_usb2_close(struct net_device *netdev)
for (i = 0; i <= ESD_MAX_ID_SEGMENT; i++) for (i = 0; i <= ESD_MAX_ID_SEGMENT; i++)
msg.msg.filter.mask[i] = 0; msg.msg.filter.mask[i] = 0;
if (esd_usb2_send_msg(priv->usb2, &msg) < 0) if (esd_usb2_send_msg(priv->usb2, &msg) < 0)
dev_err(netdev->dev.parent, "sending idadd message failed\n"); netdev_err(netdev, "sending idadd message failed\n");
/* set CAN controller to reset mode */ /* set CAN controller to reset mode */
msg.msg.hdr.len = 2; msg.msg.hdr.len = 2;
...@@ -854,7 +852,7 @@ static int esd_usb2_close(struct net_device *netdev) ...@@ -854,7 +852,7 @@ static int esd_usb2_close(struct net_device *netdev)
msg.msg.setbaud.rsvd = 0; msg.msg.setbaud.rsvd = 0;
msg.msg.setbaud.baud = cpu_to_le32(ESD_USB2_NO_BAUDRATE); msg.msg.setbaud.baud = cpu_to_le32(ESD_USB2_NO_BAUDRATE);
if (esd_usb2_send_msg(priv->usb2, &msg) < 0) if (esd_usb2_send_msg(priv->usb2, &msg) < 0)
dev_err(netdev->dev.parent, "sending setbaud message failed\n"); netdev_err(netdev, "sending setbaud message failed\n");
priv->can.state = CAN_STATE_STOPPED; priv->can.state = CAN_STATE_STOPPED;
...@@ -910,7 +908,7 @@ static int esd_usb2_set_bittiming(struct net_device *netdev) ...@@ -910,7 +908,7 @@ static int esd_usb2_set_bittiming(struct net_device *netdev)
msg.msg.setbaud.rsvd = 0; msg.msg.setbaud.rsvd = 0;
msg.msg.setbaud.baud = cpu_to_le32(canbtr); msg.msg.setbaud.baud = cpu_to_le32(canbtr);
dev_info(netdev->dev.parent, "setting BTR=%#x\n", canbtr); netdev_info(netdev, "setting BTR=%#x\n", canbtr);
return esd_usb2_send_msg(priv->usb2, &msg); return esd_usb2_send_msg(priv->usb2, &msg);
} }
...@@ -988,15 +986,14 @@ static int esd_usb2_probe_one_net(struct usb_interface *intf, int index) ...@@ -988,15 +986,14 @@ static int esd_usb2_probe_one_net(struct usb_interface *intf, int index)
err = register_candev(netdev); err = register_candev(netdev);
if (err) { if (err) {
dev_err(&intf->dev, dev_err(&intf->dev, "couldn't register CAN device: %d\n", err);
"couldn't register CAN device: %d\n", err);
free_candev(netdev); free_candev(netdev);
err = -ENOMEM; err = -ENOMEM;
goto done; goto done;
} }
dev->nets[index] = priv; dev->nets[index] = priv;
dev_info(netdev->dev.parent, "device %s registered\n", netdev->name); netdev_info(netdev, "device %s registered\n", netdev->name);
done: done:
return err; return err;
......
...@@ -92,7 +92,7 @@ void can_bus_off(struct net_device *dev); ...@@ -92,7 +92,7 @@ void can_bus_off(struct net_device *dev);
void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
unsigned int idx); unsigned int idx);
void can_get_echo_skb(struct net_device *dev, unsigned int idx); unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx);
void can_free_echo_skb(struct net_device *dev, unsigned int idx); void can_free_echo_skb(struct net_device *dev, unsigned int idx);
struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf); struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment