Skip to content

Commit 7e7ba58

Browse files
andy-shevbroonie
authored andcommitted
regmap: mmio: Fix MMIO accessors to avoid talking to IO port
Currently regmap MMIO is inconsistent with IO accessors. I.e. the Big Endian counterparts are using ioreadXXbe() / iowriteXXbe() which are not clean implementations of readXXbe(). That said, reimplement current Big Endian MMIO accessors by replacing ioread()/iowrite() with respective read()/write() and swab() calls. Note, there are no current in-kernel users that may utilize the functionality of the IO ports on Big Endian hardware. All drivers that use regmap MMIO either Little Endian, or they don't map IO ports in a way that ioreadXX()/iowriteXX() may be utilized. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 93ce557 commit 7e7ba58

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/base/regmap/regmap-mmio.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static void regmap_mmio_write16be(struct regmap_mmio_context *ctx,
104104
unsigned int reg,
105105
unsigned int val)
106106
{
107-
iowrite16be(val, ctx->regs + reg);
107+
writew(swab16(val), ctx->regs + reg);
108108
}
109109

110110
static void regmap_mmio_iowrite16be(struct regmap_mmio_context *ctx,
@@ -137,7 +137,7 @@ static void regmap_mmio_write32be(struct regmap_mmio_context *ctx,
137137
unsigned int reg,
138138
unsigned int val)
139139
{
140-
iowrite32be(val, ctx->regs + reg);
140+
writel(swab32(val), ctx->regs + reg);
141141
}
142142

143143
static void regmap_mmio_iowrite32be(struct regmap_mmio_context *ctx,
@@ -204,7 +204,7 @@ static unsigned int regmap_mmio_ioread16le(struct regmap_mmio_context *ctx,
204204
static unsigned int regmap_mmio_read16be(struct regmap_mmio_context *ctx,
205205
unsigned int reg)
206206
{
207-
return ioread16be(ctx->regs + reg);
207+
return swab16(readw(ctx->regs + reg));
208208
}
209209

210210
static unsigned int regmap_mmio_ioread16be(struct regmap_mmio_context *ctx,
@@ -234,7 +234,7 @@ static unsigned int regmap_mmio_ioread32le(struct regmap_mmio_context *ctx,
234234
static unsigned int regmap_mmio_read32be(struct regmap_mmio_context *ctx,
235235
unsigned int reg)
236236
{
237-
return ioread32be(ctx->regs + reg);
237+
return swab32(readl(ctx->regs + reg));
238238
}
239239

240240
static unsigned int regmap_mmio_ioread32be(struct regmap_mmio_context *ctx,

0 commit comments

Comments
 (0)