> -----Original Message----- > From: Marc Kleine-Budde [mailto:mkl@xxxxxxxxxxxxxx] > Sent: Tuesday, July 31, 2018 12:26 PM > To: Pankaj Bansal <pankaj.bansal@xxxxxxx>; linux-can@xxxxxxxxxxxxxxx > Subject: Re: [PATCH 5/6] net: can: flexcan: split the Message Buffer RAM > area > > On 07/31/2018 08:30 AM, Pankaj Bansal wrote: > > > >> -----Original Message----- > >> From: Marc Kleine-Budde [mailto:mkl@xxxxxxxxxxxxxx] > >> Sent: Monday, July 30, 2018 8:21 PM > >> To: Pankaj Bansal <pankaj.bansal@xxxxxxx>; linux-can@xxxxxxxxxxxxxxx > >> Subject: Re: [PATCH 5/6] net: can: flexcan: split the Message Buffer > >> RAM area > >> > >> On 07/30/2018 06:07 PM, Pankaj Bansal wrote: > >>> 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 greater than 8 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@xxxxxxx> > >>> --- > >>> drivers/net/can/flexcan.c | 66 > >>> ++++++++++++++++++++++++++++--------- > >>> 1 file changed, 50 insertions(+), 16 deletions(-) > >>> > >>> diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c > >>> index 15fa983a8237..147405e703f0 100644 > >>> --- a/drivers/net/can/flexcan.c > >>> +++ b/drivers/net/can/flexcan.c > >>> @@ -223,7 +223,8 @@ struct flexcan_regs { > >>> u32 rxfgmask; /* 0x48 */ > >>> u32 rxfir; /* 0x4c */ > >>> u32 _reserved3[12]; /* 0x50 */ > >>> - u32 mb[256]; /* 0x80 */ > >>> + u32 mb1[128]; /* 0x80 */ > >>> + u32 mb2[128]; /* 0x280 */ > >>> /* FIFO-mode: > >>> * MB > >>> * 0x080...0x08f 0 RX message buffer > >>> @@ -262,6 +263,8 @@ struct flexcan_priv { > >>> struct flexcan_mb __iomem *tx_mb; > >>> struct flexcan_mb __iomem *tx_mb_reserved; > >>> u8 tx_mb_idx; > >>> + u8 mb_count_block1; > >>> + u8 mb_count_block2; > >> > >> What's the difference between these two? > > > > This tells the number of Message Buffers in each RAM block. > > > > suppose Block0 is configured to 8 bytes payload, Block1 to 16 bytes, > > than the following table indicates how the Message Buffers will be > > arranged into RAM. > > Does this make any sense in a real world scenario? How do you plan to > configure these partitions? I will send a RFC patch for CAN FD protocol changes that I am still working on (NOT ready yet). It should help in understanding the context of these patches and how I plan to use these changes in FD mode. > > > RAM partition example > > > __________________________________________________________ > ____________ > > __________ RAM block | Payload size | Number of MBs in the RAM > block | > > Message Buffer range > > 0 | 8 | 32 | 0 to 31 > > 1 | 16 | 21 |32 to 52 > > ---------------------------------------------------------------------- > > ---------- > > Marc > > -- > Pengutronix e.K. | Marc Kleine-Budde | > Industrial Linux Solutions | Phone: +49-231-2826-924 | > Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | > Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | ��.n��������+%������w��{.n�����{����*jg��������ݢj����G�������j:+v���w�m������w�������h�����٥