mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Wahren <stefan.wahren@i2se.com>
To: Marek Vasut <marex@denx.de>
Cc: linux-kernel@vger.kernel.org, festevam@gmail.com,
	shawn.guo@linaro.org, mturquette@linaro.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH RFC] clk: mxs: Fix invalid 32-bit access to frac registers
Date: Sun, 14 Dec 2014 18:16:17 +0100 (CET)	[thread overview]
Message-ID: <1638147247.144508.1418577377536.JavaMail.open-xchange@oxbaltgw03.schlund.de> (raw)
In-Reply-To: <201412141712.12589.marex@denx.de>

Hi Marek,

> Marek Vasut <marex@denx.de> hat am 14. Dezember 2014 um 17:12 geschrieben:
>
> >
> > static void __iomem *digctrl;
> > #define DIGCTRL digctrl
> > @@ -118,11 +119,12 @@ static void __init clk_misc_init(void)
> > /*
> > * 480 MHz seems too high to be ssp clock source directly,
> > * so set frac0 to get a 288 MHz ref_io0 and ref_io1.
> > + * According to reference manual we must access frac0 bytewise.
> > */
> > - val = readl_relaxed(FRAC0);
> > - val &= ~((0x3f << BP_FRAC0_IO0FRAC) | (0x3f << BP_FRAC0_IO1FRAC));
> > - val |= (30 << BP_FRAC0_IO0FRAC) | (30 << BP_FRAC0_IO1FRAC);
> > - writel_relaxed(val, FRAC0);
> > + writeb_relaxed(0x3f, FRAC0 + FRAC0_IO0 + CLR);
> > + writeb_relaxed(30, FRAC0 + FRAC0_IO0 + SET);
> > + writeb_relaxed(0x3f, FRAC0 + FRAC0_IO1 + CLR);
> > + writeb_relaxed(30, FRAC0 + FRAC0_IO1 + SET);
>
> This used to be a R-M-W sequence, but now it's changed to multiple writes.
> This
> changes the behavior and seeing you use the CLR register, I am worried this
> might be prone to clock glitches. What do you think please ?

you are right. I adapt the imx23 init to the imx28 to make code simple. But it
would be better to avoid glitches.
I hope it's okay for this bugfix to introduce a R-M-W sequence for the imx23
init. So it's consequent.

>
> [...]
>
> Also, it might be a good idea to zap the 0x3f mask and use HEX and DEC numbers
> consistently, but this is an idea for another patch.

Yes.

Btw i hope this patch also fixes a SPI communication issue with our hardware
which forces us to bypass ref_io1 for ssp2.
But i will have access to that hardware tomorrow.

Thanks

Stefan

>
> Best regards,
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2014-12-14 17:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-14 15:28 Stefan Wahren
2014-12-14 16:12 ` Marek Vasut
2014-12-14 17:16   ` Stefan Wahren [this message]
2014-12-14 19:19     ` Marek Vasut
2014-12-15  7:19       ` Stefan Wahren
2014-12-17  2:44     ` Fabio Estevam
2014-12-17  7:58       ` Stefan Wahren
2014-12-17 16:00         ` Marek Vasut
2014-12-18 15:58           ` Stefan Wahren
2014-12-18 16:19             ` Marek Vasut

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=1638147247.144508.1418577377536.JavaMail.open-xchange@oxbaltgw03.schlund.de \
    --to=stefan.wahren@i2se.com \
    --cc=festevam@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=mturquette@linaro.org \
    --cc=shawn.guo@linaro.org \
    /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

all inboxes | Powered by JetHome®