netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Joakim Zhang <qiangqing.zhang@nxp.com>, linux-can@vger.kernel.org
Cc: linux-imx@nxp.com, netdev@vger.kernel.org
Subject: Re: [PATCH V2 1/3] can: flexcan: initialize all flexcan memory for ECC function
Date: Sun, 27 Sep 2020 21:57:54 +0200	[thread overview]
Message-ID: <34240503-1d9e-9b8c-cdd0-28482ea60fbf@pengutronix.de> (raw)
In-Reply-To: <20200927160801.28569-2-qiangqing.zhang@nxp.com>


[-- Attachment #1.1: Type: text/plain, Size: 1374 bytes --]

On 9/27/20 6:07 PM, Joakim Zhang wrote:
[...]

> +static void flexcan_init_ram(struct net_device *dev)
> +{
> +	struct flexcan_priv *priv = netdev_priv(dev);
> +	struct flexcan_regs __iomem *regs = priv->regs;
> +	u32 reg_ctrl2;
> +	int i;
> +
> +	/* 11.8.3.13 Detection and correction of memory errors:
> +	 * CTRL2[WRMFRZ] grants write access to all memory positions that
> +	 * require initialization, ranging from 0x080 to 0xADF and
> +	 * from 0xF28 to 0xFFF when the CAN FD feature is enabled.
> +	 * The RXMGMASK, RX14MASK, RX15MASK, and RXFGMASK registers need to
> +	 * be initialized as well. MCR[RFEN] must not be set during memory
> +	 * initialization.
> +	 */
> +	reg_ctrl2 = priv->read(&regs->ctrl2);
> +	reg_ctrl2 |= FLEXCAN_CTRL2_WRMFRZ;
> +	priv->write(reg_ctrl2, &regs->ctrl2);
> +
> +	for (i = 0; i < ram_init[0].len; i++)
> +		priv->write(0, (void __iomem *)regs + ram_init[0].offset + sizeof(u32) * i);

As the write function only does endian conversion, and you're writing 0 here.
What about using iowrite32_rep() and get rid of the for loop?

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 |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2020-09-27 19:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-27 16:07 [PATCH V2 0/3] patch set for flexcan Joakim Zhang
2020-09-27 16:07 ` [PATCH V2 1/3] can: flexcan: initialize all flexcan memory for ECC function Joakim Zhang
2020-09-27 19:51   ` Marc Kleine-Budde
2020-09-28  2:00     ` Joakim Zhang
2020-09-27 19:57   ` Marc Kleine-Budde [this message]
2020-09-28  2:29     ` Joakim Zhang
2020-09-28  5:23       ` Joakim Zhang
2020-09-28  6:20         ` Marc Kleine-Budde
2020-09-27 16:08 ` [PATCH V2 2/3] can: flexcan: add flexcan driver for i.MX8MP Joakim Zhang
2020-09-27 16:08 ` [PATCH V2 3/3] can: flexcan: disable runtime PM if register flexcandev failed Joakim Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=34240503-1d9e-9b8c-cdd0-28482ea60fbf@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=qiangqing.zhang@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).