The patch

   regmap-mmio: Use native endianness for read/write

has been applied to the regmap tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 4a98da2164cf514d2ae17d350a65bc76ee0a4823 Mon Sep 17 00:00:00 2001
From: Simon Arlott <si...@fire.lp0.eu>
Date: Thu, 29 Oct 2015 19:58:47 +0000
Subject: [PATCH] regmap-mmio: Use native endianness for read/write

The regmap API has an endianness setting for formatting reads and writes.
This can be set by the usual DT "little-endian" and "big-endian" properties.
To work properly the associated regmap_bus needs to read/write in native
endian.

The "syscon" DT device binding creates an mmio-based regmap_bus which
performs all reads/writes as little-endian. These values are then converted
again by regmap, which means that all of the MIPS BCM boards (which are
big-endian) have been declared as "little-endian" to get regmap to convert
them back to big-endian.

Modify regmap-mmio to use the native-endian functions __raw_read*() and
__raw_write*() instead of the little-endian functions read*() and
write*().

Modify the big-endian MIPS BCM boards to use what will now be the correct
endianness instead of pretending that the devices are little-endian.

Signed-off-by: Simon Arlott <si...@fire.lp0.eu>
Signed-off-by: Mark Brown <broo...@kernel.org>
---
 arch/mips/boot/dts/brcm/bcm6328.dtsi |  1 -
 arch/mips/boot/dts/brcm/bcm7125.dtsi |  1 -
 arch/mips/boot/dts/brcm/bcm7346.dtsi |  1 -
 arch/mips/boot/dts/brcm/bcm7358.dtsi |  1 -
 arch/mips/boot/dts/brcm/bcm7360.dtsi |  1 -
 arch/mips/boot/dts/brcm/bcm7362.dtsi |  1 -
 arch/mips/boot/dts/brcm/bcm7420.dtsi |  1 -
 arch/mips/boot/dts/brcm/bcm7425.dtsi |  1 -
 arch/mips/boot/dts/brcm/bcm7435.dtsi |  1 -
 drivers/base/regmap/regmap-mmio.c    | 16 ++++++++--------
 10 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/arch/mips/boot/dts/brcm/bcm6328.dtsi 
b/arch/mips/boot/dts/brcm/bcm6328.dtsi
index 41891c1..d52ce3d 100644
--- a/arch/mips/boot/dts/brcm/bcm6328.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm6328.dtsi
@@ -73,7 +73,6 @@
                timer: timer@10000040 {
                        compatible = "syscon";
                        reg = <0x10000040 0x2c>;
-                       little-endian;
                };
 
                reboot {
diff --git a/arch/mips/boot/dts/brcm/bcm7125.dtsi 
b/arch/mips/boot/dts/brcm/bcm7125.dtsi
index 1a7efa8..4fc7ece 100644
--- a/arch/mips/boot/dts/brcm/bcm7125.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7125.dtsi
@@ -98,7 +98,6 @@
                sun_top_ctrl: syscon@404000 {
                        compatible = "brcm,bcm7125-sun-top-ctrl", "syscon";
                        reg = <0x404000 0x60c>;
-                       little-endian;
                };
 
                reboot {
diff --git a/arch/mips/boot/dts/brcm/bcm7346.dtsi 
b/arch/mips/boot/dts/brcm/bcm7346.dtsi
index d817bb4..01592f1 100644
--- a/arch/mips/boot/dts/brcm/bcm7346.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7346.dtsi
@@ -100,7 +100,6 @@
                sun_top_ctrl: syscon@404000 {
                        compatible = "brcm,bcm7346-sun-top-ctrl", "syscon";
                        reg = <0x404000 0x51c>;
-                       little-endian;
                };
 
                reboot {
diff --git a/arch/mips/boot/dts/brcm/bcm7358.dtsi 
b/arch/mips/boot/dts/brcm/bcm7358.dtsi
index 277a90a..46be971 100644
--- a/arch/mips/boot/dts/brcm/bcm7358.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7358.dtsi
@@ -94,7 +94,6 @@
                sun_top_ctrl: syscon@404000 {
                        compatible = "brcm,bcm7358-sun-top-ctrl", "syscon";
                        reg = <0x404000 0x51c>;
-                       little-endian;
                };
 
                reboot {
diff --git a/arch/mips/boot/dts/brcm/bcm7360.dtsi 
b/arch/mips/boot/dts/brcm/bcm7360.dtsi
index 9e1e571..ed728e7 100644
--- a/arch/mips/boot/dts/brcm/bcm7360.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7360.dtsi
@@ -94,7 +94,6 @@
                sun_top_ctrl: syscon@404000 {
                        compatible = "brcm,bcm7360-sun-top-ctrl", "syscon";
                        reg = <0x404000 0x51c>;
-                       little-endian;
                };
 
                reboot {
diff --git a/arch/mips/boot/dts/brcm/bcm7362.dtsi 
b/arch/mips/boot/dts/brcm/bcm7362.dtsi
index 6e65db8..f0ca134 100644
--- a/arch/mips/boot/dts/brcm/bcm7362.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7362.dtsi
@@ -100,7 +100,6 @@
                sun_top_ctrl: syscon@404000 {
                        compatible = "brcm,bcm7362-sun-top-ctrl", "syscon";
                        reg = <0x404000 0x51c>;
-                       little-endian;
                };
 
                reboot {
diff --git a/arch/mips/boot/dts/brcm/bcm7420.dtsi 
b/arch/mips/boot/dts/brcm/bcm7420.dtsi
index 5f55d0a..bee221b 100644
--- a/arch/mips/boot/dts/brcm/bcm7420.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7420.dtsi
@@ -99,7 +99,6 @@
                sun_top_ctrl: syscon@404000 {
                        compatible = "brcm,bcm7420-sun-top-ctrl", "syscon";
                        reg = <0x404000 0x60c>;
-                       little-endian;
                };
 
                reboot {
diff --git a/arch/mips/boot/dts/brcm/bcm7425.dtsi 
b/arch/mips/boot/dts/brcm/bcm7425.dtsi
index 5b660b6..c8ab17a 100644
--- a/arch/mips/boot/dts/brcm/bcm7425.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7425.dtsi
@@ -100,7 +100,6 @@
                sun_top_ctrl: syscon@404000 {
                        compatible = "brcm,bcm7425-sun-top-ctrl", "syscon";
                        reg = <0x404000 0x51c>;
-                       little-endian;
                };
 
                reboot {
diff --git a/arch/mips/boot/dts/brcm/bcm7435.dtsi 
b/arch/mips/boot/dts/brcm/bcm7435.dtsi
index 8b9432c..614ee21 100644
--- a/arch/mips/boot/dts/brcm/bcm7435.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7435.dtsi
@@ -114,7 +114,6 @@
                sun_top_ctrl: syscon@404000 {
                        compatible = "brcm,bcm7425-sun-top-ctrl", "syscon";
                        reg = <0x404000 0x51c>;
-                       little-endian;
                };
 
                reboot {
diff --git a/drivers/base/regmap/regmap-mmio.c 
b/drivers/base/regmap/regmap-mmio.c
index 426a57e..8a77876 100644
--- a/drivers/base/regmap/regmap-mmio.c
+++ b/drivers/base/regmap/regmap-mmio.c
@@ -106,17 +106,17 @@ static int regmap_mmio_gather_write(void *context,
        while (val_size) {
                switch (ctx->val_bytes) {
                case 1:
-                       writeb(*(u8 *)val, ctx->regs + offset);
+                       __raw_writeb(*(u8 *)val, ctx->regs + offset);
                        break;
                case 2:
-                       writew(*(u16 *)val, ctx->regs + offset);
+                       __raw_writew(*(u16 *)val, ctx->regs + offset);
                        break;
                case 4:
-                       writel(*(u32 *)val, ctx->regs + offset);
+                       __raw_writel(*(u32 *)val, ctx->regs + offset);
                        break;
 #ifdef CONFIG_64BIT
                case 8:
-                       writeq(*(u64 *)val, ctx->regs + offset);
+                       __raw_writeq(*(u64 *)val, ctx->regs + offset);
                        break;
 #endif
                default:
@@ -166,17 +166,17 @@ static int regmap_mmio_read(void *context,
        while (val_size) {
                switch (ctx->val_bytes) {
                case 1:
-                       *(u8 *)val = readb(ctx->regs + offset);
+                       *(u8 *)val = __raw_readb(ctx->regs + offset);
                        break;
                case 2:
-                       *(u16 *)val = readw(ctx->regs + offset);
+                       *(u16 *)val = __raw_readw(ctx->regs + offset);
                        break;
                case 4:
-                       *(u32 *)val = readl(ctx->regs + offset);
+                       *(u32 *)val = __raw_readl(ctx->regs + offset);
                        break;
 #ifdef CONFIG_64BIT
                case 8:
-                       *(u64 *)val = readq(ctx->regs + offset);
+                       *(u64 *)val = __raw_readq(ctx->regs + offset);
                        break;
 #endif
                default:
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to