RE: [PATCH V3 1/3] can: flexcan: initialize all flexcan memory for ECC function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
> Sent: 2020年9月29日 18:54
> To: Joakim Zhang <qiangqing.zhang@xxxxxxx>; linux-can@xxxxxxxxxxxxxxx
> Cc: netdev@xxxxxxxxxxxxxxx; dl-linux-imx <linux-imx@xxxxxxx>
> Subject: Re: [PATCH V3 1/3] can: flexcan: initialize all flexcan memory for ECC
> function

[...]
> > +	reg_ctrl2 = priv->read(&regs->ctrl2);
> > +	reg_ctrl2 |= FLEXCAN_CTRL2_WRMFRZ;
> > +	priv->write(reg_ctrl2, &regs->ctrl2);
> > +
> > +	/* ranging from 0x0080 to 0x0ADF, ram details as below list:
> > +	 * 0x0080--0x087F:	128 MBs
> > +	 * 0x0880--0x0A7F:	128 RXIMRs
> > +	 * 0x0A80--0x0A97:	6 RXFIRs
> > +	 * 0x0A98--0x0A9F:	Reserved
> > +	 * 0x0AA0--0x0AA3:	RXMGMASK
> > +	 * 0x0AA4--0x0AA7:	RXFGMASK
> > +	 * 0x0AA8--0x0AAB:	RX14MASK
> > +	 * 0x0AAC--0x0AAF:	RX15MASK
> > +	 * 0x0AB0--0x0ABF:	TX_SMB
> > +	 * 0x0AC0--0x0ACF:	RX_SMB0
> > +	 * 0x0AD0--0x0ADF:	RX_SMB1
> 
> I don't like to have the register definition here *again), we have struct
> flexcan_regs for this.

Do you mean still move these register definitions into flexcan_regs, right?

> > +	 */
> > +	memset_io((void __iomem *)regs + 0x80, 0, 0xadf - 0x80 + 1);
> 
> why the cast?

Yes, no need, will remove it.

> Can you use the "&regs->foo - &regs->bar + x" to get the length for the
> memset?

After move above register definition into flexcan_regs, I can change to use this way to get the length for the memset_io.


> > +
> > +	/* ranging from 0x0F28 to 0x0FFF when CAN FD feature is enabled,
> > +	 * ram details as below list:
> > +	 * 0x0F28--0x0F6F:	TX_SMB_FD
> > +	 * 0x0F70--0x0FB7:	RX_SMB0_FD
> > +	 * 0x0FB8--0x0FFF:	RX_SMB0_FD
> > +	 */
> > +	memset_io((void __iomem *)regs + 0xf28, 0, 0xfff - 0xf28 + 1);
> 
> same here

Will change.

Hi Marc, I'm going on holiday from tomorrow, so I would delay to send out a V4 to review until I come back, sorry for this.
Thanks for your comments of "can: flexcan: add CAN wakeup function for i.MX8", will rework the patch later.
 
Best Regards,
Joakim Zhang
> > +
> > +	reg_ctrl2 &= ~FLEXCAN_CTRL2_WRMFRZ;
> > +	priv->write(reg_ctrl2, &regs->ctrl2); }
> > +
> >  /* flexcan_chip_start
> >   *
> >   * this functions is entered with clocks enabled @@ -1316,6 +1363,9
> > @@ static int flexcan_chip_start(struct net_device *dev)
> >  	if (err)
> >  		goto out_chip_disable;
> >
> > +	if (priv->devtype_data->quirks & FLEXCAN_QUIRK_SUPPORT_ECC)
> > +		flexcan_init_ram(dev);
> > +
> >  	flexcan_set_bittiming(dev);
> >
> >  	/* MCR
> >
> 
> Marc
> 
> --
> Pengutronix e.K.                 | Marc Kleine-Budde           |
> Embedded Linux                   | https://www.pengutronix.de  |
> Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
> Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |





[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux