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:36 +0300 |
commit | 53558ac133c0a8d4fd4c81d6c7885dacd3cca557 (patch) | |
tree | 66c4b51ff1761a7e56f66839775230a9ec787351 /drivers/net/can | |
parent | abe1348753b3e062da7e0bfee1da0eef9dffe336 (diff) | |
download | linux-53558ac133c0a8d4fd4c81d6c7885dacd3cca557.tar.xz |
can: at91_can: MMR registers: convert to FIELD_PREP()
Use FIELD_PREP() to access the individual fields of the MMR register.
Link: https://lore.kernel.org/all/20231005-at91_can-rx_offload-v2-6-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 | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index 7597da543348..16a62f649418 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c @@ -75,7 +75,9 @@ enum at91_reg { #define AT91_ECR_REC_MASK GENMASK(8, 0) #define AT91_ECR_TEC_MASK GENMASK(23, 16) -#define AT91_MMR_PRIO_SHIFT (16) +#define AT91_MMR_MTIMEMARK_MASK GENMASK(15, 0) +#define AT91_MMR_PRIOR_MASK GENMASK(19, 16) +#define AT91_MMR_MOT_MASK GENMASK(26, 24) #define AT91_MID_MIDE BIT(29) @@ -299,9 +301,12 @@ static inline void at91_write(const struct at91_priv *priv, enum at91_reg reg, static inline void set_mb_mode_prio(const struct at91_priv *priv, unsigned int mb, enum at91_mb_mode mode, - int prio) + u8 prio) { - at91_write(priv, AT91_MMR(mb), (mode << 24) | (prio << 16)); + const u32 reg_mmr = FIELD_PREP(AT91_MMR_MOT_MASK, mode) | + FIELD_PREP(AT91_MMR_PRIOR_MASK, prio); + + at91_write(priv, AT91_MMR(mb), reg_mmr); } static inline void set_mb_mode(const struct at91_priv *priv, unsigned int mb, |