From: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
To: Jisheng Zhang <jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
Mika Westerberg
<mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: "linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH] i2c: designware: use {readl|writel}_relaxed instead of readl/writel
Date: Tue, 13 Jan 2015 12:52:05 +0100 [thread overview]
Message-ID: <20150113115205.GE7660@katana> (raw)
In-Reply-To: <20141219104315.0ccbba9c@xhacker>
[-- Attachment #1: Type: text/plain, Size: 2323 bytes --]
On Fri, Dec 19, 2014 at 10:43:15AM +0800, Jisheng Zhang wrote:
> Dear all,
>
> Is there any issue I need to resolve so that the patch can be merged?
Adding Mika to the loop. He uses the driver a lot (and knows other
people who do)...
> On Wed, 10 Dec 2014 22:26:41 -0800
> Jisheng Zhang <jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org> wrote:
>
> > readl/writel is too expensive especially on Cortex A9 w/ outer L2 cache.
> > This introduces i2c read/write errors on Marvell BG2/BG2Q SoCs when there
> > are heavy L2 cache maintenance operations at the same time.
> >
> > The driver does not perform DMA, so it's safe to use the relaxed version.
> > From another side, the relaxed io accessor macros are available on all
> > architectures now, so we can use the relaxed versions instead.
> >
> > Signed-off-by: Jisheng Zhang <jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
> > ---
> > drivers/i2c/busses/i2c-designware-core.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-designware-core.c
> > b/drivers/i2c/busses/i2c-designware-core.c index 23628b7..e279948 100644
> > --- a/drivers/i2c/busses/i2c-designware-core.c
> > +++ b/drivers/i2c/busses/i2c-designware-core.c
> > @@ -170,10 +170,10 @@ u32 dw_readl(struct dw_i2c_dev *dev, int offset)
> > u32 value;
> >
> > if (dev->accessor_flags & ACCESS_16BIT)
> > - value = readw(dev->base + offset) |
> > - (readw(dev->base + offset + 2) << 16);
> > + value = readw_relaxed(dev->base + offset) |
> > + (readw_relaxed(dev->base + offset + 2) << 16);
> > else
> > - value = readl(dev->base + offset);
> > + value = readl_relaxed(dev->base + offset);
> >
> > if (dev->accessor_flags & ACCESS_SWAP)
> > return swab32(value);
> > @@ -187,10 +187,10 @@ void dw_writel(struct dw_i2c_dev *dev, u32 b, int
> > offset) b = swab32(b);
> >
> > if (dev->accessor_flags & ACCESS_16BIT) {
> > - writew((u16)b, dev->base + offset);
> > - writew((u16)(b >> 16), dev->base + offset + 2);
> > + writew_relaxed((u16)b, dev->base + offset);
> > + writew_relaxed((u16)(b >> 16), dev->base + offset + 2);
> > } else {
> > - writel(b, dev->base + offset);
> > + writel_relaxed(b, dev->base + offset);
> > }
> > }
> >
>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: wsa@the-dreams.de (Wolfram Sang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] i2c: designware: use {readl|writel}_relaxed instead of readl/writel
Date: Tue, 13 Jan 2015 12:52:05 +0100 [thread overview]
Message-ID: <20150113115205.GE7660@katana> (raw)
In-Reply-To: <20141219104315.0ccbba9c@xhacker>
On Fri, Dec 19, 2014 at 10:43:15AM +0800, Jisheng Zhang wrote:
> Dear all,
>
> Is there any issue I need to resolve so that the patch can be merged?
Adding Mika to the loop. He uses the driver a lot (and knows other
people who do)...
> On Wed, 10 Dec 2014 22:26:41 -0800
> Jisheng Zhang <jszhang@marvell.com> wrote:
>
> > readl/writel is too expensive especially on Cortex A9 w/ outer L2 cache.
> > This introduces i2c read/write errors on Marvell BG2/BG2Q SoCs when there
> > are heavy L2 cache maintenance operations at the same time.
> >
> > The driver does not perform DMA, so it's safe to use the relaxed version.
> > From another side, the relaxed io accessor macros are available on all
> > architectures now, so we can use the relaxed versions instead.
> >
> > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > ---
> > drivers/i2c/busses/i2c-designware-core.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-designware-core.c
> > b/drivers/i2c/busses/i2c-designware-core.c index 23628b7..e279948 100644
> > --- a/drivers/i2c/busses/i2c-designware-core.c
> > +++ b/drivers/i2c/busses/i2c-designware-core.c
> > @@ -170,10 +170,10 @@ u32 dw_readl(struct dw_i2c_dev *dev, int offset)
> > u32 value;
> >
> > if (dev->accessor_flags & ACCESS_16BIT)
> > - value = readw(dev->base + offset) |
> > - (readw(dev->base + offset + 2) << 16);
> > + value = readw_relaxed(dev->base + offset) |
> > + (readw_relaxed(dev->base + offset + 2) << 16);
> > else
> > - value = readl(dev->base + offset);
> > + value = readl_relaxed(dev->base + offset);
> >
> > if (dev->accessor_flags & ACCESS_SWAP)
> > return swab32(value);
> > @@ -187,10 +187,10 @@ void dw_writel(struct dw_i2c_dev *dev, u32 b, int
> > offset) b = swab32(b);
> >
> > if (dev->accessor_flags & ACCESS_16BIT) {
> > - writew((u16)b, dev->base + offset);
> > - writew((u16)(b >> 16), dev->base + offset + 2);
> > + writew_relaxed((u16)b, dev->base + offset);
> > + writew_relaxed((u16)(b >> 16), dev->base + offset + 2);
> > } else {
> > - writel(b, dev->base + offset);
> > + writel_relaxed(b, dev->base + offset);
> > }
> > }
> >
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150113/e21dd833/attachment.sig>
WARNING: multiple messages have this Message-ID (diff)
From: Wolfram Sang <wsa@the-dreams.de>
To: Jisheng Zhang <jszhang@marvell.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: "linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] i2c: designware: use {readl|writel}_relaxed instead of readl/writel
Date: Tue, 13 Jan 2015 12:52:05 +0100 [thread overview]
Message-ID: <20150113115205.GE7660@katana> (raw)
In-Reply-To: <20141219104315.0ccbba9c@xhacker>
[-- Attachment #1: Type: text/plain, Size: 2267 bytes --]
On Fri, Dec 19, 2014 at 10:43:15AM +0800, Jisheng Zhang wrote:
> Dear all,
>
> Is there any issue I need to resolve so that the patch can be merged?
Adding Mika to the loop. He uses the driver a lot (and knows other
people who do)...
> On Wed, 10 Dec 2014 22:26:41 -0800
> Jisheng Zhang <jszhang@marvell.com> wrote:
>
> > readl/writel is too expensive especially on Cortex A9 w/ outer L2 cache.
> > This introduces i2c read/write errors on Marvell BG2/BG2Q SoCs when there
> > are heavy L2 cache maintenance operations at the same time.
> >
> > The driver does not perform DMA, so it's safe to use the relaxed version.
> > From another side, the relaxed io accessor macros are available on all
> > architectures now, so we can use the relaxed versions instead.
> >
> > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > ---
> > drivers/i2c/busses/i2c-designware-core.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-designware-core.c
> > b/drivers/i2c/busses/i2c-designware-core.c index 23628b7..e279948 100644
> > --- a/drivers/i2c/busses/i2c-designware-core.c
> > +++ b/drivers/i2c/busses/i2c-designware-core.c
> > @@ -170,10 +170,10 @@ u32 dw_readl(struct dw_i2c_dev *dev, int offset)
> > u32 value;
> >
> > if (dev->accessor_flags & ACCESS_16BIT)
> > - value = readw(dev->base + offset) |
> > - (readw(dev->base + offset + 2) << 16);
> > + value = readw_relaxed(dev->base + offset) |
> > + (readw_relaxed(dev->base + offset + 2) << 16);
> > else
> > - value = readl(dev->base + offset);
> > + value = readl_relaxed(dev->base + offset);
> >
> > if (dev->accessor_flags & ACCESS_SWAP)
> > return swab32(value);
> > @@ -187,10 +187,10 @@ void dw_writel(struct dw_i2c_dev *dev, u32 b, int
> > offset) b = swab32(b);
> >
> > if (dev->accessor_flags & ACCESS_16BIT) {
> > - writew((u16)b, dev->base + offset);
> > - writew((u16)(b >> 16), dev->base + offset + 2);
> > + writew_relaxed((u16)b, dev->base + offset);
> > + writew_relaxed((u16)(b >> 16), dev->base + offset + 2);
> > } else {
> > - writel(b, dev->base + offset);
> > + writel_relaxed(b, dev->base + offset);
> > }
> > }
> >
>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-01-13 11:52 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-11 6:26 [PATCH] i2c: designware: use {readl|writel}_relaxed instead of readl/writel Jisheng Zhang
2014-12-11 6:26 ` Jisheng Zhang
2014-12-11 6:26 ` Jisheng Zhang
[not found] ` <1418279201-3886-1-git-send-email-jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2014-12-19 2:43 ` Jisheng Zhang
2014-12-19 2:43 ` Jisheng Zhang
2014-12-19 2:43 ` Jisheng Zhang
2015-01-13 11:52 ` Wolfram Sang [this message]
2015-01-13 11:52 ` Wolfram Sang
2015-01-13 11:52 ` Wolfram Sang
2015-01-13 14:29 ` Mika Westerberg
2015-01-13 14:29 ` Mika Westerberg
2015-01-13 14:29 ` Mika Westerberg
2015-01-13 14:36 ` Wolfram Sang
2015-01-13 14:36 ` Wolfram Sang
2015-01-13 14:36 ` Wolfram Sang
2015-01-13 16:28 ` Baruch Siach
2015-01-13 16:28 ` Baruch Siach
2015-01-14 4:05 ` Jisheng Zhang
2015-01-14 4:05 ` Jisheng Zhang
2015-01-14 4:05 ` Jisheng Zhang
2015-01-23 16:09 ` Wolfram Sang
2015-01-23 16:09 ` Wolfram Sang
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=20150113115205.GE7660@katana \
--to=wsa-z923lk4zbo2bacvfa/9k2g@public.gmane.org \
--cc=jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mika.westerberg-VuQAYsv1563Yd54FQh9/CA@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.