u32 rxfgmask; /* 0x48 */
u32 rxfir; /* 0x4c */
u32 _reserved3[12]; /* 0x50 */
- u8 mb[1024]; /* 0x80 */
+ u8 mb[2][512]; /* 0x80 */
/* FIFO-mode:
* MB
* 0x080...0x08f 0 RX message buffer
static struct flexcan_mb __iomem *flexcan_get_mb(const struct flexcan_priv *priv,
u8 mb_index)
{
+ u8 bank_size;
+ bool bank;
+
if (WARN_ON(mb_index >= priv->mb_count))
return NULL;
+ bank_size = sizeof(priv->regs->mb[0]) / priv->mb_size;
+
+ bank = mb_index >= bank_size;
+ if (bank)
+ mb_index -= bank_size;
+
return (struct flexcan_mb __iomem *)
- (&priv->regs->mb[priv->mb_size * mb_index]);
+ (&priv->regs->mb[bank][priv->mb_size * mb_index]);
}
static void flexcan_enable_wakeup_irq(struct flexcan_priv *priv, bool enable)
goto out_close;
priv->mb_size = sizeof(struct flexcan_mb) + CAN_MAX_DLEN;
- priv->mb_count = sizeof(priv->regs->mb) / priv->mb_size;
+ priv->mb_count = (sizeof(priv->regs->mb[0]) / priv->mb_size) +
+ (sizeof(priv->regs->mb[1]) / priv->mb_size);
if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP)
priv->tx_mb_reserved =