All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] regmap: Add explict native endian flag to DT bindings
@ 2016-01-26 22:46 Mark Brown
  2016-01-26 22:46 ` [PATCH RFC 2/2] MIPS: dt: Explicitly specify native endian behaviour for syscon Mark Brown
  2016-01-27 11:02 ` [PATCH 1/2] regmap: Add explict native endian flag to DT bindings Arnd Bergmann
  0 siblings, 2 replies; 10+ messages in thread
From: Mark Brown @ 2016-01-26 22:46 UTC (permalink / raw)
  To: Ralf Baechle, Kevin Cernekee
  Cc: linux-kernel, linux-mips, Johannes Berg, Simon Arlott,
	Arnd Bergmann, Mark Brown

Currently the binding document says that if no endianness is configured
we use native endian but this is not in fact true for all binding types
and we do have some devices that really want native endianness such as
Broadcom MIPS SoCs where switching the endianness of the CPU also
switches the endianness of external IPs.

Provide an explicit option for this.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 Documentation/devicetree/bindings/regmap/regmap.txt | 11 +++++++----
 drivers/base/regmap/regmap.c                        |  2 ++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/regmap/regmap.txt b/Documentation/devicetree/bindings/regmap/regmap.txt
index b494f8b8ef72..e98a9652ccc8 100644
--- a/Documentation/devicetree/bindings/regmap/regmap.txt
+++ b/Documentation/devicetree/bindings/regmap/regmap.txt
@@ -5,15 +5,18 @@ Index     Device     Endianness properties
 ---------------------------------------------------
 1         BE         'big-endian'
 2         LE         'little-endian'
+3	  Native     'native-endian'
 
 For one device driver, which will run in different scenarios above
 on different SoCs using the devicetree, we need one way to simplify
 this.
 
-Required properties:
-- {big,little}-endian: these are boolean properties, if absent
-  meaning that the CPU and the Device are in the same endianness mode,
-  these properties are for register values and all the buffers only.
+Optional properties:
+- {big,little,native}-endian: these are boolean properties, if absent
+  then the implementation will choose a default based on the device
+  being controlled.  These properties are for register values and all
+  the buffers only.  Native endian means that the CPU and device have
+  the same endianness.
 
 Examples:
 Scenario 1 : CPU in LE mode & device in LE mode.
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 4ac63c0e50c7..57a7d144e629 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -500,6 +500,8 @@ enum regmap_endian regmap_get_val_endian(struct device *dev,
 			endian = REGMAP_ENDIAN_BIG;
 		else if (of_property_read_bool(np, "little-endian"))
 			endian = REGMAP_ENDIAN_LITTLE;
+		else if (of_property_read_bool(np, "native-endian"))
+			endian = REGMAP_ENDIAN_NATIVE;
 
 		/* If the endianness was specified in DT, use that */
 		if (endian != REGMAP_ENDIAN_DEFAULT)
-- 
2.7.0.rc3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH RFC 2/2] MIPS: dt: Explicitly specify native endian behaviour for syscon
  2016-01-26 22:46 [PATCH 1/2] regmap: Add explict native endian flag to DT bindings Mark Brown
@ 2016-01-26 22:46 ` Mark Brown
  2016-01-26 23:16   ` Florian Fainelli
  2016-01-27 11:02 ` [PATCH 1/2] regmap: Add explict native endian flag to DT bindings Arnd Bergmann
  1 sibling, 1 reply; 10+ messages in thread
From: Mark Brown @ 2016-01-26 22:46 UTC (permalink / raw)
  To: Ralf Baechle, Kevin Cernekee
  Cc: linux-kernel, linux-mips, Johannes Berg, Simon Arlott,
	Arnd Bergmann, Mark Brown

On many MIPS systems the endianness of IP blocks is kept the same as
that of the CPU by the hardware.  This includes the system controllers
on these systems which are controlled via syscon which uses the regmap
API which used readl() and writel() to interact with the hardware,
meaning that all writes are converted to little endian when writing to
the hardware.  This caused a bad interaction with the regmap core in big
endian mode since it was not aware of the byte swapping and so ended up
performing little endian writes.

Unfortunately when this issue was noticed it was addressed by updating
the DT for the affected devices to specify them as little endian.  This
happened to work since it resulted in two endianness swaps which
cancelled each other out and gave little endian behaviour but meant that
the DT was clearly not accurately describing the hardware.

The intention of commit 29bb45f25ff305 (regmap-mmio: Use native
endianness for read/write) was to fix this by making regmap default to
native endianness but this breaks most other MMIO users where the
hardware has a fixed endianness and the implementation uses the __raw
accessors which are not intended to be used outside of architecture
code.  Instead use the newly added native-endian DT property to say
exactly what we want for these systems.

Fixes: 29bb45f25ff305 (regmap-mmio: Use native endianness for read/write)
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
---

Posted for review only, this will interact with some other patches
fixing the implementation of regmap-mmio and will probably need to be
merged along with them.

 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 +
 9 files changed, 9 insertions(+)

diff --git a/arch/mips/boot/dts/brcm/bcm6328.dtsi b/arch/mips/boot/dts/brcm/bcm6328.dtsi
index d52ce3d07f16..04867035ea0e 100644
--- a/arch/mips/boot/dts/brcm/bcm6328.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm6328.dtsi
@@ -73,6 +73,7 @@
 		timer: timer@10000040 {
 			compatible = "syscon";
 			reg = <0x10000040 0x2c>;
+			native-endian;
 		};
 
 		reboot {
diff --git a/arch/mips/boot/dts/brcm/bcm7125.dtsi b/arch/mips/boot/dts/brcm/bcm7125.dtsi
index 4fc7ecee273c..3ae16053a0c9 100644
--- a/arch/mips/boot/dts/brcm/bcm7125.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7125.dtsi
@@ -98,6 +98,7 @@
 		sun_top_ctrl: syscon@404000 {
 			compatible = "brcm,bcm7125-sun-top-ctrl", "syscon";
 			reg = <0x404000 0x60c>;
+			native-endian;
 		};
 
 		reboot {
diff --git a/arch/mips/boot/dts/brcm/bcm7346.dtsi b/arch/mips/boot/dts/brcm/bcm7346.dtsi
index a3039bb53477..be7991917d29 100644
--- a/arch/mips/boot/dts/brcm/bcm7346.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7346.dtsi
@@ -118,6 +118,7 @@
 		sun_top_ctrl: syscon@404000 {
 			compatible = "brcm,bcm7346-sun-top-ctrl", "syscon";
 			reg = <0x404000 0x51c>;
+			native-endian;
 		};
 
 		reboot {
diff --git a/arch/mips/boot/dts/brcm/bcm7358.dtsi b/arch/mips/boot/dts/brcm/bcm7358.dtsi
index 4274ff41ec21..060805be619a 100644
--- a/arch/mips/boot/dts/brcm/bcm7358.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7358.dtsi
@@ -112,6 +112,7 @@
 		sun_top_ctrl: syscon@404000 {
 			compatible = "brcm,bcm7358-sun-top-ctrl", "syscon";
 			reg = <0x404000 0x51c>;
+			native-endian;
 		};
 
 		reboot {
diff --git a/arch/mips/boot/dts/brcm/bcm7360.dtsi b/arch/mips/boot/dts/brcm/bcm7360.dtsi
index 0dcc9163c27b..bcdb09bfe07b 100644
--- a/arch/mips/boot/dts/brcm/bcm7360.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7360.dtsi
@@ -112,6 +112,7 @@
 		sun_top_ctrl: syscon@404000 {
 			compatible = "brcm,bcm7360-sun-top-ctrl", "syscon";
 			reg = <0x404000 0x51c>;
+			native-endian;
 		};
 
 		reboot {
diff --git a/arch/mips/boot/dts/brcm/bcm7362.dtsi b/arch/mips/boot/dts/brcm/bcm7362.dtsi
index 2f3f9fc2c478..d3b1b762e6c3 100644
--- a/arch/mips/boot/dts/brcm/bcm7362.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7362.dtsi
@@ -118,6 +118,7 @@
 		sun_top_ctrl: syscon@404000 {
 			compatible = "brcm,bcm7362-sun-top-ctrl", "syscon";
 			reg = <0x404000 0x51c>;
+			native-endian;
 		};
 
 		reboot {
diff --git a/arch/mips/boot/dts/brcm/bcm7420.dtsi b/arch/mips/boot/dts/brcm/bcm7420.dtsi
index bee221b3b568..3302a1b8a5c9 100644
--- a/arch/mips/boot/dts/brcm/bcm7420.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7420.dtsi
@@ -99,6 +99,7 @@
 		sun_top_ctrl: syscon@404000 {
 			compatible = "brcm,bcm7420-sun-top-ctrl", "syscon";
 			reg = <0x404000 0x60c>;
+			native-endian;
 		};
 
 		reboot {
diff --git a/arch/mips/boot/dts/brcm/bcm7425.dtsi b/arch/mips/boot/dts/brcm/bcm7425.dtsi
index 571f30f52e3f..15b27aae15a9 100644
--- a/arch/mips/boot/dts/brcm/bcm7425.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7425.dtsi
@@ -100,6 +100,7 @@
 		sun_top_ctrl: syscon@404000 {
 			compatible = "brcm,bcm7425-sun-top-ctrl", "syscon";
 			reg = <0x404000 0x51c>;
+			native-endian;
 		};
 
 		reboot {
diff --git a/arch/mips/boot/dts/brcm/bcm7435.dtsi b/arch/mips/boot/dts/brcm/bcm7435.dtsi
index 614ee211f71a..adb33e355043 100644
--- a/arch/mips/boot/dts/brcm/bcm7435.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7435.dtsi
@@ -114,6 +114,7 @@
 		sun_top_ctrl: syscon@404000 {
 			compatible = "brcm,bcm7425-sun-top-ctrl", "syscon";
 			reg = <0x404000 0x51c>;
+			native-endian;
 		};
 
 		reboot {
-- 
2.7.0.rc3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH RFC 2/2] MIPS: dt: Explicitly specify native endian behaviour for syscon
  2016-01-26 22:46 ` [PATCH RFC 2/2] MIPS: dt: Explicitly specify native endian behaviour for syscon Mark Brown
@ 2016-01-26 23:16   ` Florian Fainelli
  2016-01-27  9:37     ` Ralf Baechle
                       ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Florian Fainelli @ 2016-01-26 23:16 UTC (permalink / raw)
  To: Mark Brown, Ralf Baechle, Kevin Cernekee
  Cc: linux-kernel, linux-mips, Johannes Berg, Simon Arlott, Arnd Bergmann

On 26/01/16 14:46, Mark Brown wrote:
> On many MIPS systems the endianness of IP blocks is kept the same as
> that of the CPU by the hardware.  This includes the system controllers
> on these systems which are controlled via syscon which uses the regmap
> API which used readl() and writel() to interact with the hardware,
> meaning that all writes are converted to little endian when writing to
> the hardware.  This caused a bad interaction with the regmap core in big
> endian mode since it was not aware of the byte swapping and so ended up
> performing little endian writes.
> 
> Unfortunately when this issue was noticed it was addressed by updating
> the DT for the affected devices to specify them as little endian.  This
> happened to work since it resulted in two endianness swaps which
> cancelled each other out and gave little endian behaviour but meant that
> the DT was clearly not accurately describing the hardware.
> 
> The intention of commit 29bb45f25ff305 (regmap-mmio: Use native
> endianness for read/write) was to fix this by making regmap default to
> native endianness but this breaks most other MMIO users where the
> hardware has a fixed endianness and the implementation uses the __raw
> accessors which are not intended to be used outside of architecture
> code.  Instead use the newly added native-endian DT property to say
> exactly what we want for these systems.
> 
> Fixes: 29bb45f25ff305 (regmap-mmio: Use native endianness for read/write)
> Reported-by: Johannes Berg <johannes@sipsolutions.net>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
> 
> Posted for review only, this will interact with some other patches
> fixing the implementation of regmap-mmio and will probably need to be
> merged along with them.
> 
>  arch/mips/boot/dts/brcm/bcm6328.dtsi | 1 +

v4.5-rc1 now contains an arch/mips/boot/dts/brcm/bcm6368.dtsi which
copied the 6328.dtsi and therefore needs this hunk to be added to your
patch series:

diff --git a/arch/mips/boot/dts/brcm/bcm6368.dtsi
b/arch/mips/boot/dts/brcm/bcm6368.dtsi
index 9c8d3fe28b31..1f6b9b5cddb4 100644
--- a/arch/mips/boot/dts/brcm/bcm6368.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm6368.dtsi
@@ -54,7 +54,7 @@
                periph_cntl: syscon@10000000 {
                        compatible = "syscon";
                        reg = <0x10000000 0x14>;
-                       little-endian;
+                       native-endian;
                };

                reboot: syscon-reboot@10000008 {
-- 
Florian

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH RFC 2/2] MIPS: dt: Explicitly specify native endian behaviour for syscon
  2016-01-26 23:16   ` Florian Fainelli
@ 2016-01-27  9:37     ` Ralf Baechle
  2016-01-27 10:33     ` Jonas Gorski
  2016-01-27 18:51     ` Mark Brown
  2 siblings, 0 replies; 10+ messages in thread
From: Ralf Baechle @ 2016-01-27  9:37 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Mark Brown, Kevin Cernekee, linux-kernel, linux-mips,
	Johannes Berg, Simon Arlott, Arnd Bergmann

On Tue, Jan 26, 2016 at 03:16:15PM -0800, Florian Fainelli wrote:

> diff --git a/arch/mips/boot/dts/brcm/bcm6368.dtsi
> b/arch/mips/boot/dts/brcm/bcm6368.dtsi
> index 9c8d3fe28b31..1f6b9b5cddb4 100644
> --- a/arch/mips/boot/dts/brcm/bcm6368.dtsi
> +++ b/arch/mips/boot/dts/brcm/bcm6368.dtsi
> @@ -54,7 +54,7 @@
>                 periph_cntl: syscon@10000000 {
>                         compatible = "syscon";
>                         reg = <0x10000000 0x14>;
> -                       little-endian;
> +                       native-endian;
>                 };
> 
>                 reboot: syscon-reboot@10000008 {

Acked-by: Ralf Baechle <ralf@linux-mips.org>

for the combined patch.

  Ralf

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH RFC 2/2] MIPS: dt: Explicitly specify native endian behaviour for syscon
  2016-01-26 23:16   ` Florian Fainelli
  2016-01-27  9:37     ` Ralf Baechle
@ 2016-01-27 10:33     ` Jonas Gorski
  2016-01-27 10:45       ` Johannes Berg
  2016-01-27 11:10       ` Mark Brown
  2016-01-27 18:51     ` Mark Brown
  2 siblings, 2 replies; 10+ messages in thread
From: Jonas Gorski @ 2016-01-27 10:33 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Mark Brown, Ralf Baechle, Kevin Cernekee, linux-kernel,
	MIPS Mailing List, Johannes Berg, Simon Arlott, Arnd Bergmann

Hi,

On 27 January 2016 at 00:16, Florian Fainelli <f.fainelli@gmail.com> wrote:
> On 26/01/16 14:46, Mark Brown wrote:
>> On many MIPS systems the endianness of IP blocks is kept the same as
>> that of the CPU by the hardware.  This includes the system controllers
>> on these systems which are controlled via syscon which uses the regmap
>> API which used readl() and writel() to interact with the hardware,
>> meaning that all writes are converted to little endian when writing to
>> the hardware.  This caused a bad interaction with the regmap core in big
>> endian mode since it was not aware of the byte swapping and so ended up
>> performing little endian writes.
>>
>> Unfortunately when this issue was noticed it was addressed by updating
>> the DT for the affected devices to specify them as little endian.  This
>> happened to work since it resulted in two endianness swaps which
>> cancelled each other out and gave little endian behaviour but meant that
>> the DT was clearly not accurately describing the hardware.
>>
>> The intention of commit 29bb45f25ff305 (regmap-mmio: Use native
>> endianness for read/write) was to fix this by making regmap default to
>> native endianness but this breaks most other MMIO users where the
>> hardware has a fixed endianness and the implementation uses the __raw
>> accessors which are not intended to be used outside of architecture
>> code.  Instead use the newly added native-endian DT property to say
>> exactly what we want for these systems.
>>
>> Fixes: 29bb45f25ff305 (regmap-mmio: Use native endianness for read/write)
>> Reported-by: Johannes Berg <johannes@sipsolutions.net>
>> Signed-off-by: Mark Brown <broonie@kernel.org>
>> ---
>>
>> Posted for review only, this will interact with some other patches
>> fixing the implementation of regmap-mmio and will probably need to be
>> merged along with them.
>>
>>  arch/mips/boot/dts/brcm/bcm6328.dtsi | 1 +
>
> v4.5-rc1 now contains an arch/mips/boot/dts/brcm/bcm6368.dtsi which
> copied the 6328.dtsi and therefore needs this hunk to be added to your
> patch series:
>
> diff --git a/arch/mips/boot/dts/brcm/bcm6368.dtsi
> b/arch/mips/boot/dts/brcm/bcm6368.dtsi
> index 9c8d3fe28b31..1f6b9b5cddb4 100644
> --- a/arch/mips/boot/dts/brcm/bcm6368.dtsi
> +++ b/arch/mips/boot/dts/brcm/bcm6368.dtsi
> @@ -54,7 +54,7 @@
>                 periph_cntl: syscon@10000000 {
>                         compatible = "syscon";
>                         reg = <0x10000000 0x14>;
> -                       little-endian;
> +                       native-endian;

But native-endian == big-endian usually for bcm63xx, so is this
actually a bugfix?


Jonas

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH RFC 2/2] MIPS: dt: Explicitly specify native endian behaviour for syscon
  2016-01-27 10:33     ` Jonas Gorski
@ 2016-01-27 10:45       ` Johannes Berg
  2016-01-27 11:10       ` Mark Brown
  1 sibling, 0 replies; 10+ messages in thread
From: Johannes Berg @ 2016-01-27 10:45 UTC (permalink / raw)
  To: Jonas Gorski, Florian Fainelli
  Cc: Mark Brown, Ralf Baechle, Kevin Cernekee, linux-kernel,
	MIPS Mailing List, Simon Arlott, Arnd Bergmann

On Wed, 2016-01-27 at 11:33 +0100, Jonas Gorski wrote:
> 
> > +++ b/arch/mips/boot/dts/brcm/bcm6368.dtsi
> > @@ -54,7 +54,7 @@
> >                 periph_cntl: syscon@10000000 {
> >                         compatible = "syscon";
> >                         reg = <0x10000000 0x14>;
> > -                       little-endian;
> > +                       native-endian;
> 
> But native-endian == big-endian usually for bcm63xx, so is this
> actually a bugfix?
> 

It's complicated :)

These were originally specified as little-endian because it _worked_,
but that was only because of an issue with the code - it was getting
byteswapped twice.

This was "fixed" in commit 29bb45f25ff3051354ed330c0d0f10418a2b8c7c,
and I assume this DT file was created/copied before that commit and
didn't get that update due to merge delays. So after that commit, this
file couldn't have worked, but that's how it got to this point.

johannes

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] regmap: Add explict native endian flag to DT bindings
  2016-01-26 22:46 [PATCH 1/2] regmap: Add explict native endian flag to DT bindings Mark Brown
  2016-01-26 22:46 ` [PATCH RFC 2/2] MIPS: dt: Explicitly specify native endian behaviour for syscon Mark Brown
@ 2016-01-27 11:02 ` Arnd Bergmann
  2016-01-27 12:19   ` Mark Brown
  1 sibling, 1 reply; 10+ messages in thread
From: Arnd Bergmann @ 2016-01-27 11:02 UTC (permalink / raw)
  To: Mark Brown
  Cc: Ralf Baechle, Kevin Cernekee, linux-kernel, linux-mips,
	Johannes Berg, Simon Arlott

On Tuesday 26 January 2016 22:46:49 Mark Brown wrote:
> -Required properties:
> -- {big,little}-endian: these are boolean properties, if absent
> -  meaning that the CPU and the Device are in the same endianness mode,
> -  these properties are for register values and all the buffers only.
> +Optional properties:
> +- {big,little,native}-endian: these are boolean properties, if absent
> +  then the implementation will choose a default based on the device
> +  being controlled.  These properties are for register values and all
> +  the buffers only.  Native endian means that the CPU and device have
> +  the same endianness.

I think the rest of the file also needs to be changed, and we need some
more explanation about native-endian, which people might think is the
right one for them when it rarely is in reality (Broadcom MIPS being
one notable exception).

How about this version below?

	Arnd


diff --git a/Documentation/devicetree/bindings/regmap/regmap.txt b/Documentation/devicetree/bindings/regmap/regmap.txt
dissimilarity index 91%
index b494f8b8ef72..0127be360fe8 100644
--- a/Documentation/devicetree/bindings/regmap/regmap.txt
+++ b/Documentation/devicetree/bindings/regmap/regmap.txt
@@ -1,47 +1,29 @@
-Device-Tree binding for regmap
-
-The endianness mode of CPU & Device scenarios:
-Index     Device     Endianness properties
----------------------------------------------------
-1         BE         'big-endian'
-2         LE         'little-endian'
-
-For one device driver, which will run in different scenarios above
-on different SoCs using the devicetree, we need one way to simplify
-this.
-
-Required properties:
-- {big,little}-endian: these are boolean properties, if absent
-  meaning that the CPU and the Device are in the same endianness mode,
-  these properties are for register values and all the buffers only.
-
-Examples:
-Scenario 1 : CPU in LE mode & device in LE mode.
-dev: dev@40031000 {
-	      compatible = "name";
-	      reg = <0x40031000 0x1000>;
-	      ...
-};
-
-Scenario 2 : CPU in LE mode & device in BE mode.
-dev: dev@40031000 {
-	      compatible = "name";
-	      reg = <0x40031000 0x1000>;
-	      ...
-	      big-endian;
-};
-
-Scenario 3 : CPU in BE mode & device in BE mode.
-dev: dev@40031000 {
-	      compatible = "name";
-	      reg = <0x40031000 0x1000>;
-	      ...
-};
-
-Scenario 4 : CPU in BE mode & device in LE mode.
-dev: dev@40031000 {
-	      compatible = "name";
-	      reg = <0x40031000 0x1000>;
-	      ...
-	      little-endian;
-};
+Devicetree binding for regmap
+
+Optional properties:
+
+   little-endian,
+   big-endian,
+   native-endian:	See common-properties.txt for a definition
+
+Note:
+Regmap defaults to little-endian register access on MMIO based
+devices, this is by far the most common setting. On CPU
+architectures that typically run big-endian operating systems
+(e.g. PowerPC), registers can be defined as big-endian and must
+be marked that way in the devicetree.
+
+On SoCs that can be operated in both big-endian and little-endian
+modes, with a single hardware switch controlling both the endianess
+of the CPU and a byteswap for MMIO registers (e.g. many Broadcom MIPS
+chips), "native-endian" is used to allow using the same device tree
+blob in both cases.
+
+Examples:
+Scenario 1 : a register set in big-endian mode.
+dev: dev@40031000 {
+	      compatible = "syscon";
+	      reg = <0x40031000 0x1000>;
+	      big-endian;
+	      ...
+};

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH RFC 2/2] MIPS: dt: Explicitly specify native endian behaviour for syscon
  2016-01-27 10:33     ` Jonas Gorski
  2016-01-27 10:45       ` Johannes Berg
@ 2016-01-27 11:10       ` Mark Brown
  1 sibling, 0 replies; 10+ messages in thread
From: Mark Brown @ 2016-01-27 11:10 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: Florian Fainelli, Ralf Baechle, Kevin Cernekee, linux-kernel,
	MIPS Mailing List, Johannes Berg, Simon Arlott, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 524 bytes --]

On Wed, Jan 27, 2016 at 11:33:37AM +0100, Jonas Gorski wrote:

> > -                       little-endian;
> > +                       native-endian;

> But native-endian == big-endian usually for bcm63xx, so is this
> actually a bugfix?

Yes, it's buggy - in v4.5-rc1 we respect the endianness so big endian
just won't work, prior to that this was a hack around another bug which
was done rather than reporting it so it "just" results in a DT that's
obviously incorrect.  This local hack has been causing a lot of
problems.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] regmap: Add explict native endian flag to DT bindings
  2016-01-27 11:02 ` [PATCH 1/2] regmap: Add explict native endian flag to DT bindings Arnd Bergmann
@ 2016-01-27 12:19   ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2016-01-27 12:19 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Ralf Baechle, Kevin Cernekee, linux-kernel, linux-mips,
	Johannes Berg, Simon Arlott

[-- Attachment #1: Type: text/plain, Size: 395 bytes --]

On Wed, Jan 27, 2016 at 12:02:19PM +0100, Arnd Bergmann wrote:

> I think the rest of the file also needs to be changed, and we need some
> more explanation about native-endian, which people might think is the
> right one for them when it rarely is in reality (Broadcom MIPS being
> one notable exception).

I'm not sure it's *that* confusing at this point but this is definitely
a lot clearer.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH RFC 2/2] MIPS: dt: Explicitly specify native endian behaviour for syscon
  2016-01-26 23:16   ` Florian Fainelli
  2016-01-27  9:37     ` Ralf Baechle
  2016-01-27 10:33     ` Jonas Gorski
@ 2016-01-27 18:51     ` Mark Brown
  2 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2016-01-27 18:51 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Ralf Baechle, Kevin Cernekee, linux-kernel, linux-mips,
	Johannes Berg, Simon Arlott, Arnd Bergmann

[-- Attachment #1: Type: text/plain, Size: 251 bytes --]

On Tue, Jan 26, 2016 at 03:16:15PM -0800, Florian Fainelli wrote:

> v4.5-rc1 now contains an arch/mips/boot/dts/brcm/bcm6368.dtsi which
> copied the 6328.dtsi and therefore needs this hunk to be added to your
> patch series:

Folded that in, thanks.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-01-27 18:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-26 22:46 [PATCH 1/2] regmap: Add explict native endian flag to DT bindings Mark Brown
2016-01-26 22:46 ` [PATCH RFC 2/2] MIPS: dt: Explicitly specify native endian behaviour for syscon Mark Brown
2016-01-26 23:16   ` Florian Fainelli
2016-01-27  9:37     ` Ralf Baechle
2016-01-27 10:33     ` Jonas Gorski
2016-01-27 10:45       ` Johannes Berg
2016-01-27 11:10       ` Mark Brown
2016-01-27 18:51     ` Mark Brown
2016-01-27 11:02 ` [PATCH 1/2] regmap: Add explict native endian flag to DT bindings Arnd Bergmann
2016-01-27 12:19   ` Mark Brown

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.