Merge branch 'master' of git://gitorious.org/linux-can/linux-can
This commit is contained in:
commit
3ab2cdd028
3 changed files with 11 additions and 8 deletions
|
@ -686,7 +686,7 @@ static int c_can_get_berr_counter(const struct net_device *dev,
|
||||||
*
|
*
|
||||||
* We iterate from priv->tx_echo to priv->tx_next and check if the
|
* We iterate from priv->tx_echo to priv->tx_next and check if the
|
||||||
* packet has been transmitted, echo it back to the CAN framework.
|
* packet has been transmitted, echo it back to the CAN framework.
|
||||||
* If we discover a not yet transmitted package, stop looking for more.
|
* If we discover a not yet transmitted packet, stop looking for more.
|
||||||
*/
|
*/
|
||||||
static void c_can_do_tx(struct net_device *dev)
|
static void c_can_do_tx(struct net_device *dev)
|
||||||
{
|
{
|
||||||
|
@ -698,7 +698,7 @@ static void c_can_do_tx(struct net_device *dev)
|
||||||
for (/* nix */; (priv->tx_next - priv->tx_echo) > 0; priv->tx_echo++) {
|
for (/* nix */; (priv->tx_next - priv->tx_echo) > 0; priv->tx_echo++) {
|
||||||
msg_obj_no = get_tx_echo_msg_obj(priv);
|
msg_obj_no = get_tx_echo_msg_obj(priv);
|
||||||
val = c_can_read_reg32(priv, &priv->regs->txrqst1);
|
val = c_can_read_reg32(priv, &priv->regs->txrqst1);
|
||||||
if (!(val & (1 << msg_obj_no))) {
|
if (!(val & (1 << (msg_obj_no - 1)))) {
|
||||||
can_get_echo_skb(dev,
|
can_get_echo_skb(dev,
|
||||||
msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST);
|
msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST);
|
||||||
stats->tx_bytes += priv->read_reg(priv,
|
stats->tx_bytes += priv->read_reg(priv,
|
||||||
|
@ -706,6 +706,8 @@ static void c_can_do_tx(struct net_device *dev)
|
||||||
& IF_MCONT_DLC_MASK;
|
& IF_MCONT_DLC_MASK;
|
||||||
stats->tx_packets++;
|
stats->tx_packets++;
|
||||||
c_can_inval_msg_object(dev, 0, msg_obj_no);
|
c_can_inval_msg_object(dev, 0, msg_obj_no);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -950,7 +952,7 @@ static int c_can_poll(struct napi_struct *napi, int quota)
|
||||||
struct net_device *dev = napi->dev;
|
struct net_device *dev = napi->dev;
|
||||||
struct c_can_priv *priv = netdev_priv(dev);
|
struct c_can_priv *priv = netdev_priv(dev);
|
||||||
|
|
||||||
irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
|
irqstatus = priv->irqstatus;
|
||||||
if (!irqstatus)
|
if (!irqstatus)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
@ -1028,12 +1030,11 @@ end:
|
||||||
|
|
||||||
static irqreturn_t c_can_isr(int irq, void *dev_id)
|
static irqreturn_t c_can_isr(int irq, void *dev_id)
|
||||||
{
|
{
|
||||||
u16 irqstatus;
|
|
||||||
struct net_device *dev = (struct net_device *)dev_id;
|
struct net_device *dev = (struct net_device *)dev_id;
|
||||||
struct c_can_priv *priv = netdev_priv(dev);
|
struct c_can_priv *priv = netdev_priv(dev);
|
||||||
|
|
||||||
irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
|
priv->irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
|
||||||
if (!irqstatus)
|
if (!priv->irqstatus)
|
||||||
return IRQ_NONE;
|
return IRQ_NONE;
|
||||||
|
|
||||||
/* disable all interrupts and schedule the NAPI */
|
/* disable all interrupts and schedule the NAPI */
|
||||||
|
@ -1063,10 +1064,11 @@ static int c_can_open(struct net_device *dev)
|
||||||
goto exit_irq_fail;
|
goto exit_irq_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
napi_enable(&priv->napi);
|
||||||
|
|
||||||
/* start the c_can controller */
|
/* start the c_can controller */
|
||||||
c_can_start(dev);
|
c_can_start(dev);
|
||||||
|
|
||||||
napi_enable(&priv->napi);
|
|
||||||
netif_start_queue(dev);
|
netif_start_queue(dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -76,6 +76,7 @@ struct c_can_priv {
|
||||||
unsigned int tx_next;
|
unsigned int tx_next;
|
||||||
unsigned int tx_echo;
|
unsigned int tx_echo;
|
||||||
void *priv; /* for board-specific data */
|
void *priv; /* for board-specific data */
|
||||||
|
u16 irqstatus;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct net_device *alloc_c_can_dev(void);
|
struct net_device *alloc_c_can_dev(void);
|
||||||
|
|
|
@ -154,7 +154,7 @@ static int __devinit cc770_get_platform_data(struct platform_device *pdev,
|
||||||
struct cc770_platform_data *pdata = pdev->dev.platform_data;
|
struct cc770_platform_data *pdata = pdev->dev.platform_data;
|
||||||
|
|
||||||
priv->can.clock.freq = pdata->osc_freq;
|
priv->can.clock.freq = pdata->osc_freq;
|
||||||
if (priv->cpu_interface | CPUIF_DSC)
|
if (priv->cpu_interface & CPUIF_DSC)
|
||||||
priv->can.clock.freq /= 2;
|
priv->can.clock.freq /= 2;
|
||||||
priv->clkout = pdata->cor;
|
priv->clkout = pdata->cor;
|
||||||
priv->bus_config = pdata->bcr;
|
priv->bus_config = pdata->bcr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue