From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Steev Klimaszewski <threeway-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] drm/tegra: dpaux: Fix transfers larger than 4 bytes
Date: Mon, 20 Jul 2015 11:35:59 +0200 [thread overview]
Message-ID: <20150720093558.GT29614@ulmo> (raw)
In-Reply-To: <CAOvMTZiuq=qesVD9PYuePz2zAKqh_m-1FbBZwBa6S4CLHv7mvw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 3009 bytes --]
On Mon, Jul 20, 2015 at 02:39:36AM -0500, Steev Klimaszewski wrote:
> On Mon, Jul 20, 2015 at 1:49 AM, Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> wrote:
>
> > From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> >
> > The DPAUX read/write FIFO registers aren't sequential in the register
> > space, causing transfers larger than 4 bytes to cause accesses to non-
> > existing FIFO registers.
> >
> > Fixes: 6b6b604215c6 ("drm/tegra: Add eDP support")
> > Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> > ---
> > drivers/gpu/drm/tegra/dpaux.c | 18 ++++++++----------
> > 1 file changed, 8 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c
> > index d6b55e3e3716..a43a836e6f88 100644
> > --- a/drivers/gpu/drm/tegra/dpaux.c
> > +++ b/drivers/gpu/drm/tegra/dpaux.c
> > @@ -72,34 +72,32 @@ static inline void tegra_dpaux_writel(struct
> > tegra_dpaux *dpaux,
> > static void tegra_dpaux_write_fifo(struct tegra_dpaux *dpaux, const u8
> > *buffer,
> > size_t size)
> > {
> > - unsigned long offset = DPAUX_DP_AUXDATA_WRITE(0);
> > size_t i, j;
> >
> > - for (i = 0; i < size; i += 4) {
> > - size_t num = min_t(size_t, size - i, 4);
> > + for (i = 0; i < DIV_ROUND_UP(size, 4); i++) {
> > + size_t num = min_t(size_t, size - i * 4, 4);
> > unsigned long value = 0;
> >
> > for (j = 0; j < num; j++)
> > - value |= buffer[i + j] << (j * 8);
> > + value |= buffer[i * 4 + j] << (j * 8);
> >
> > - tegra_dpaux_writel(dpaux, value, offset++);
> > + tegra_dpaux_writel(dpaux, value,
> > DPAUX_DP_AUXDATA_WRITE(i));
> > }
> > }
> >
> > static void tegra_dpaux_read_fifo(struct tegra_dpaux *dpaux, u8 *buffer,
> > size_t size)
> > {
> > - unsigned long offset = DPAUX_DP_AUXDATA_READ(0);
> > size_t i, j;
> >
> > - for (i = 0; i < size; i += 4) {
> > - size_t num = min_t(size_t, size - i, 4);
> > + for (i = 0; i < DIV_ROUND_UP(size, 4); i++) {
> > + size_t num = min_t(size_t, size - i * 4, 4);
> > unsigned long value;
> >
> > - value = tegra_dpaux_readl(dpaux, offset++);
> > + value = tegra_dpaux_readl(dpaux, DPAUX_DP_AUXDATA_READ(i));
> >
> > for (j = 0; j < num; j++)
> > - buffer[i + j] = value >> (j * 8);
> > + buffer[i * 4 + j] = value >> (j * 8);
> > }
> > }
> >
> > --
> > 2.4.5
> >
> >
>
> This fixes the issue that I reported earlier, so feel free to add my
>
> Tested-by: Steev Klimaszewski <steev-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
Great, thanks.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2015-07-20 9:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-20 6:49 [PATCH] drm/tegra: dpaux: Fix transfers larger than 4 bytes Thierry Reding
2015-07-20 7:39 ` Steev Klimaszewski
[not found] ` <CAOvMTZiuq=qesVD9PYuePz2zAKqh_m-1FbBZwBa6S4CLHv7mvw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-20 9:35 ` Thierry Reding [this message]
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=20150720093558.GT29614@ulmo \
--to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=threeway-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.