Skip to content

Commit 07c054d

Browse files
can: flexcan: rename struct flexcan_priv::reg_imask{1,2}_default to rx_mask{1,2}
The flexcan IP core has up to 64 mailboxes, each one has a corresponding interrupt bit in the iflag1 or iflag2 registers and a mask bit in the imask1 or imask2 registers. In the timestamp (i.e. non FIFO) mode the driver needs to mask out all non RX interrupt sources and uses the precomputed values reg_imask1_default and reg_imask2_default of struct flexcan_priv for this. However in the current driver the reg_imask{1,2}_default cannot be used directly to get the pending RX interrupts. The TX interrupt is part of these variables, so it needs to be masked out, too. This is a preparation patch to clean up calculation of the pending RX interrupts, it only renames the variables from reg_imask{1,2}_default to rx_mask{1,2} To better reflect their meaning after the complete conversion. This change is done with the following sed command: sed -i -e "s/reg_imask\(1\|2\)_default/rx_mask\1/" drivers/net/can/flexcan.c Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 4e26598 commit 07c054d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

drivers/net/can/flexcan.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ struct flexcan_priv {
278278
u8 clk_src; /* clock source of CAN Protocol Engine */
279279

280280
u32 reg_ctrl_default;
281-
u32 reg_imask1_default;
282-
u32 reg_imask2_default;
281+
u32 rx_mask1;
282+
u32 rx_mask2;
283283

284284
struct clk *clk_ipg;
285285
struct clk *clk_per;
@@ -878,9 +878,9 @@ static inline u64 flexcan_read_reg_iflag_rx(struct flexcan_priv *priv)
878878
struct flexcan_regs __iomem *regs = priv->regs;
879879
u32 iflag1, iflag2;
880880

881-
iflag2 = priv->read(&regs->iflag2) & priv->reg_imask2_default &
881+
iflag2 = priv->read(&regs->iflag2) & priv->rx_mask2 &
882882
~FLEXCAN_IFLAG2_MB(priv->tx_mb_idx);
883-
iflag1 = priv->read(&regs->iflag1) & priv->reg_imask1_default;
883+
iflag1 = priv->read(&regs->iflag1) & priv->rx_mask1;
884884

885885
return (u64)iflag2 << 32 | iflag1;
886886
}
@@ -1227,8 +1227,8 @@ static int flexcan_chip_start(struct net_device *dev)
12271227
/* enable interrupts atomically */
12281228
disable_irq(dev->irq);
12291229
priv->write(priv->reg_ctrl_default, &regs->ctrl);
1230-
priv->write(priv->reg_imask1_default, &regs->imask1);
1231-
priv->write(priv->reg_imask2_default, &regs->imask2);
1230+
priv->write(priv->rx_mask1, &regs->imask1);
1231+
priv->write(priv->rx_mask2, &regs->imask2);
12321232
enable_irq(dev->irq);
12331233

12341234
/* print chip status */
@@ -1297,8 +1297,8 @@ static int flexcan_open(struct net_device *dev)
12971297
priv->tx_mb_idx = priv->mb_count - 1;
12981298
priv->tx_mb = flexcan_get_mb(priv, priv->tx_mb_idx);
12991299

1300-
priv->reg_imask1_default = 0;
1301-
priv->reg_imask2_default = FLEXCAN_IFLAG2_MB(priv->tx_mb_idx);
1300+
priv->rx_mask1 = 0;
1301+
priv->rx_mask2 = FLEXCAN_IFLAG2_MB(priv->tx_mb_idx);
13021302

13031303
priv->offload.mailbox_read = flexcan_mailbox_read;
13041304

@@ -1310,12 +1310,12 @@ static int flexcan_open(struct net_device *dev)
13101310

13111311
imask = GENMASK_ULL(priv->offload.mb_last,
13121312
priv->offload.mb_first);
1313-
priv->reg_imask1_default |= imask;
1314-
priv->reg_imask2_default |= imask >> 32;
1313+
priv->rx_mask1 |= imask;
1314+
priv->rx_mask2 |= imask >> 32;
13151315

13161316
err = can_rx_offload_add_timestamp(dev, &priv->offload);
13171317
} else {
1318-
priv->reg_imask1_default |= FLEXCAN_IFLAG_RX_FIFO_OVERFLOW |
1318+
priv->rx_mask1 |= FLEXCAN_IFLAG_RX_FIFO_OVERFLOW |
13191319
FLEXCAN_IFLAG_RX_FIFO_AVAILABLE;
13201320
err = can_rx_offload_add_fifo(dev, &priv->offload,
13211321
FLEXCAN_NAPI_WEIGHT);

0 commit comments

Comments
 (0)