diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2023-04-18 17:35:54 +0300 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2023-10-05 22:45:53 +0300 |
commit | 5e9c5bcc017d24fe0e990aa793086d4eb175079c (patch) | |
tree | 6454cba0b7349372db0c5178eae6c281c5f2fd0e /drivers/net/can | |
parent | bdfff1433cd6e2f47155f7bf205bcee32001a075 (diff) | |
download | linux-5e9c5bcc017d24fe0e990aa793086d4eb175079c.tar.xz |
can: at91_can: MCR Register: convert to FIELD_PREP()
Use FIELD_PREP() to access the individual fields of the MCR register.
Link: https://lore.kernel.org/all/20231005-at91_can-rx_offload-v2-9-9987d53600e0@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/at91_can.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index 41dd2ea239b9..0269e2a6508a 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c @@ -90,7 +90,9 @@ enum at91_reg { #define AT91_MSR_MRDY BIT(23) #define AT91_MSR_MMI BIT(24) +#define AT91_MCR_MDLC_MASK GENMASK(19, 16) #define AT91_MCR_MRTR BIT(20) +#define AT91_MCR_MACR BIT(22) #define AT91_MCR_MTCR BIT(23) /* Mailbox Modes */ @@ -490,8 +492,12 @@ static netdev_tx_t at91_start_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_BUSY; } reg_mid = at91_can_id_to_reg_mid(cf->can_id); - reg_mcr = ((cf->can_id & CAN_RTR_FLAG) ? AT91_MCR_MRTR : 0) | - (cf->len << 16) | AT91_MCR_MTCR; + + reg_mcr = FIELD_PREP(AT91_MCR_MDLC_MASK, cf->len) | + AT91_MCR_MTCR; + + if (cf->can_id & CAN_RTR_FLAG) + reg_mcr |= AT91_MCR_MRTR; /* disable MB while writing ID (see datasheet) */ set_mb_mode(priv, mb, AT91_MB_MODE_DISABLED); |