can: flexcan: split the Message Buffer RAM area
The message buffer RAM area is not a contiguous 1KB area but 2 partitions of 512 bytes each. Till now, we used Message buffers with payload size 8 bytes, which translates to 32 MBs per partition and no spare space is left in any partition. However, in upcoming SOC LX2160A the message buffers can have payload size 64 bytes. This results in less than 32 MBs per partition and some empty area is left at the end of each partition.This empty area should not be accessed. Therefore, split the Message Buffer RAM area into two partitions. Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
parent
0517961ccd
commit
6cbf76028d
|
@ -225,7 +225,7 @@ struct flexcan_regs {
|
|||
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
|
||||
|
@ -369,11 +369,20 @@ static inline void flexcan_write_le(u32 val, void __iomem *addr)
|
|||
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)
|
||||
|
@ -1223,7 +1232,8 @@ static int flexcan_open(struct net_device *dev)
|
|||
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 =
|
||||
|
|
Loading…
Reference in New Issue