Commit d887087c authored by Biju Das's avatar Biju Das Committed by Marc Kleine-Budde

can: rcar_canfd: fix channel specific IRQ handling for RZ/G2L

RZ/G2L has separate channel specific IRQs for transmit and error
interrupts. But the IRQ handler processes both channels, even if there
no interrupt occurred on one of the channels.

This patch fixes the issue by passing a channel specific context
parameter instead of global one for the IRQ register and the IRQ
handler, it just handles the channel which is triggered the interrupt.

Fixes: 76e9353a ("can: rcar_canfd: Add support for RZ/G2L family")
Signed-off-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/all/20221025155657.1426948-3-biju.das.jz@bp.renesas.com
Cc: stable@vger.kernel.org
[mkl: adjust commit message]
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 702de2c2
...@@ -1246,11 +1246,9 @@ static void rcar_canfd_handle_channel_tx(struct rcar_canfd_global *gpriv, u32 ch ...@@ -1246,11 +1246,9 @@ static void rcar_canfd_handle_channel_tx(struct rcar_canfd_global *gpriv, u32 ch
static irqreturn_t rcar_canfd_channel_tx_interrupt(int irq, void *dev_id) static irqreturn_t rcar_canfd_channel_tx_interrupt(int irq, void *dev_id)
{ {
struct rcar_canfd_global *gpriv = dev_id; struct rcar_canfd_channel *priv = dev_id;
u32 ch;
for_each_set_bit(ch, &gpriv->channels_mask, gpriv->max_channels) rcar_canfd_handle_channel_tx(priv->gpriv, priv->channel);
rcar_canfd_handle_channel_tx(gpriv, ch);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -1278,11 +1276,9 @@ static void rcar_canfd_handle_channel_err(struct rcar_canfd_global *gpriv, u32 c ...@@ -1278,11 +1276,9 @@ static void rcar_canfd_handle_channel_err(struct rcar_canfd_global *gpriv, u32 c
static irqreturn_t rcar_canfd_channel_err_interrupt(int irq, void *dev_id) static irqreturn_t rcar_canfd_channel_err_interrupt(int irq, void *dev_id)
{ {
struct rcar_canfd_global *gpriv = dev_id; struct rcar_canfd_channel *priv = dev_id;
u32 ch;
for_each_set_bit(ch, &gpriv->channels_mask, gpriv->max_channels) rcar_canfd_handle_channel_err(priv->gpriv, priv->channel);
rcar_canfd_handle_channel_err(gpriv, ch);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -1723,6 +1719,7 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch, ...@@ -1723,6 +1719,7 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
priv->ndev = ndev; priv->ndev = ndev;
priv->base = gpriv->base; priv->base = gpriv->base;
priv->channel = ch; priv->channel = ch;
priv->gpriv = gpriv;
priv->can.clock.freq = fcan_freq; priv->can.clock.freq = fcan_freq;
dev_info(&pdev->dev, "can_clk rate is %u\n", priv->can.clock.freq); dev_info(&pdev->dev, "can_clk rate is %u\n", priv->can.clock.freq);
...@@ -1751,7 +1748,7 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch, ...@@ -1751,7 +1748,7 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
} }
err = devm_request_irq(&pdev->dev, err_irq, err = devm_request_irq(&pdev->dev, err_irq,
rcar_canfd_channel_err_interrupt, 0, rcar_canfd_channel_err_interrupt, 0,
irq_name, gpriv); irq_name, priv);
if (err) { if (err) {
dev_err(&pdev->dev, "devm_request_irq CH Err(%d) failed, error %d\n", dev_err(&pdev->dev, "devm_request_irq CH Err(%d) failed, error %d\n",
err_irq, err); err_irq, err);
...@@ -1765,7 +1762,7 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch, ...@@ -1765,7 +1762,7 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
} }
err = devm_request_irq(&pdev->dev, tx_irq, err = devm_request_irq(&pdev->dev, tx_irq,
rcar_canfd_channel_tx_interrupt, 0, rcar_canfd_channel_tx_interrupt, 0,
irq_name, gpriv); irq_name, priv);
if (err) { if (err) {
dev_err(&pdev->dev, "devm_request_irq Tx (%d) failed, error %d\n", dev_err(&pdev->dev, "devm_request_irq Tx (%d) failed, error %d\n",
tx_irq, err); tx_irq, err);
...@@ -1791,7 +1788,6 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch, ...@@ -1791,7 +1788,6 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
priv->can.do_set_mode = rcar_canfd_do_set_mode; priv->can.do_set_mode = rcar_canfd_do_set_mode;
priv->can.do_get_berr_counter = rcar_canfd_get_berr_counter; priv->can.do_get_berr_counter = rcar_canfd_get_berr_counter;
priv->gpriv = gpriv;
SET_NETDEV_DEV(ndev, &pdev->dev); SET_NETDEV_DEV(ndev, &pdev->dev);
netif_napi_add_weight(ndev, &priv->napi, rcar_canfd_rx_poll, netif_napi_add_weight(ndev, &priv->napi, rcar_canfd_rx_poll,
......
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