gpio: mmio: Support 64-bit BE access
PATCH 1/1 gpio: mmio: Support 64-bit BE access
Use ioread64be()/iowrite64be() for 64-bit BE access.
Signed-off-by Andy Shevchenko <[email protected]>
--- drivers/gpio/gpio-mmio.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/gpio/gpio-mmio.c +16 -5
@@ -92,12 +92,12 @@ static unsigned long bgpio_read32(void __iomem *reg)#if BITS_PER_LONG >=64 static void bgpio_write64 (void __iomem *reg,unsigned long data) { -writeq (data, reg); +iowrite64 (data, reg); }static unsigned long bgpio_read64 (void __iomem *reg) { -return readq (reg); +return ioread64 (reg); }#endif /* BITS_PER_LONG >= 64 */
@@ -121,6 +121,18 @@ static unsigned long bgpio_read32be(void __iomem *reg)return ioread32be (reg); } +#if BITS_PER_LONG >=64 +static void bgpio_write64be (void __iomem *reg,unsigned long data) +{ +iowrite64be (data, reg); +} + +static unsigned long bgpio_read64be (void __iomem *reg) +{ +return ioread64be (reg); +} +#endif /* BITS_PER_LONG >= 64 */ +static unsigned long bgpio_line2mask (struct gpio_chip *gc,unsigned int line) {if (gc->be_bits)
@@ -445,9 +457,8 @@ static int bgpio_setup_accessors(struct device *dev,#if BITS_PER_LONG >=64 case 64 :if (byte_be) { -dev_err (dev, -"64 bit big endian byte order unsupported\n" ); -return -EINVAL ; + gc->read_reg = bgpio_read64be; + gc->write_reg = bgpio_write64be; }else { gc->read_reg = bgpio_read64; gc->write_reg = bgpio_write64;
Signature · 1 line
2.43.2
Quoted 3 lines · On Wed, Feb 21, 2024 at 12:23 AM <[email protected]> wrote:
Use ioread64be()/iowrite64be() for 64-bit BE access.
Signed-off-by Andy Shevchenko <[email protected]>
Obviously correct, thanks for fixing this!
Reviewed-by Linus Walleij <[email protected]>
Yours,
Linus Walleij
Bartosz Golaszewski
AppliedQuoted 5 lines · On Wed, Feb 21, 2024 at 12:23 AM <[email protected]> wrote:
Use ioread64be()/iowrite64be() for 64-bit BE access.
Signed-off-by Andy Shevchenko <[email protected]>---
Applied, thanks!
Bart