提交 67105c5a 编写于 作者: J Jisheng Zhang 提交者: Wolfram Sang

i2c: designware: use {readl|writel}_relaxed instead of readl/writel

readl/writel is too expensive especially on Cortex A9 w/ outer L2 cache.
This introduces i2c read/write delays 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: NJisheng Zhang <jszhang@marvell.com>
Acked-by: NMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
上级 c99d49a9
...@@ -170,10 +170,10 @@ u32 dw_readl(struct dw_i2c_dev *dev, int offset) ...@@ -170,10 +170,10 @@ u32 dw_readl(struct dw_i2c_dev *dev, int offset)
u32 value; u32 value;
if (dev->accessor_flags & ACCESS_16BIT) if (dev->accessor_flags & ACCESS_16BIT)
value = readw(dev->base + offset) | value = readw_relaxed(dev->base + offset) |
(readw(dev->base + offset + 2) << 16); (readw_relaxed(dev->base + offset + 2) << 16);
else else
value = readl(dev->base + offset); value = readl_relaxed(dev->base + offset);
if (dev->accessor_flags & ACCESS_SWAP) if (dev->accessor_flags & ACCESS_SWAP)
return swab32(value); return swab32(value);
...@@ -187,10 +187,10 @@ void dw_writel(struct dw_i2c_dev *dev, u32 b, int offset) ...@@ -187,10 +187,10 @@ void dw_writel(struct dw_i2c_dev *dev, u32 b, int offset)
b = swab32(b); b = swab32(b);
if (dev->accessor_flags & ACCESS_16BIT) { if (dev->accessor_flags & ACCESS_16BIT) {
writew((u16)b, dev->base + offset); writew_relaxed((u16)b, dev->base + offset);
writew((u16)(b >> 16), dev->base + offset + 2); writew_relaxed((u16)(b >> 16), dev->base + offset + 2);
} else { } else {
writel(b, dev->base + offset); writel_relaxed(b, dev->base + offset);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册