devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] Documentation : can : flexcan : Add big-endian property to device tree
@ 2017-11-10 10:17 Pankaj Bansal
  2017-11-10 10:17 ` [PATCH 2/3] powerpc: dts: P1010: Add endianness property to flexcan node Pankaj Bansal
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pankaj Bansal @ 2017-11-10 10:17 UTC (permalink / raw)
  To: wg, mkl, linux-can, robh+dt, mark.rutland, devicetree
  Cc: V.Sethi, poonam.aggrwal, Pankaj Bansal

The FlexCAN controller can be modelled as little or big endian
depending on SOC design. This device tree property identifies the
controller endianness and the driver reads/writes controller registers
based on that.

This is optional property. i.e. if this property is not present in
device tree node then controller is assumed to be little endian. if
this property is present then controller is assumed to be big endian.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Reviewed-by: Poonam Aggrwal <poonam.aggrwal@nxp.com>
---
 Documentation/devicetree/bindings/net/can/fsl-flexcan.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
index 56d6cc3..b9693c7 100644
--- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
+++ b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
@@ -18,6 +18,8 @@ Optional properties:
 
 - xceiver-supply: Regulator that powers the CAN transceiver
 
+- big-endian: This means the registers of FlexCAN controller are big endian
+
 Example:
 
 	can@1c000 {
@@ -26,4 +28,5 @@ Example:
 		interrupts = <48 0x2>;
 		interrupt-parent = <&mpic>;
 		clock-frequency = <200000000>; // filled in by bootloader
+		big-endian;
 	};
-- 
2.7.4


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

* [PATCH 2/3] powerpc: dts: P1010: Add endianness property to flexcan node
  2017-11-10 10:17 [PATCH 1/3] Documentation : can : flexcan : Add big-endian property to device tree Pankaj Bansal
@ 2017-11-10 10:17 ` Pankaj Bansal
  2017-11-10 10:17 ` [PATCH 3/3] arm/dts: Add nodes for flexcan devices present on LS1021A-Rev2 SoC Pankaj Bansal
       [not found] ` <1510309043-16777-1-git-send-email-pankaj.bansal-3arQi8VN3Tc@public.gmane.org>
  2 siblings, 0 replies; 4+ messages in thread
From: Pankaj Bansal @ 2017-11-10 10:17 UTC (permalink / raw)
  To: wg, mkl, linux-can, robh+dt, mark.rutland, devicetree
  Cc: V.Sethi, poonam.aggrwal, Pankaj Bansal

The flexcan driver assumed that flexcan controller is big endian for
powerpc architecture and little endian for other architectures.

But this is not universally true. flexcan controller can be little or
big endian on any architecture.

Therefore the flexcan driver has been modified to check for "big-endian"
device tree property for controllers that are big endian.

consequently add the property to freescale P1010 SOC device tree.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Reviewed-by: Poonam Aggrwal <poonam.aggrwal@nxp.com>
---
 arch/powerpc/boot/dts/fsl/p1010si-post.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi b/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi
index af12ead..1b4aafc 100644
--- a/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1010si-post.dtsi
@@ -137,12 +137,14 @@
 		compatible = "fsl,p1010-flexcan";
 		reg = <0x1c000 0x1000>;
 		interrupts = <48 0x2 0 0>;
+		big-endian;
 	};
 
 	can1: can@1d000 {
 		compatible = "fsl,p1010-flexcan";
 		reg = <0x1d000 0x1000>;
 		interrupts = <61 0x2 0 0>;
+		big-endian;
 	};
 
 	L2: l2-cache-controller@20000 {
-- 
2.7.4


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

* [PATCH 3/3] arm/dts: Add nodes for flexcan devices present on LS1021A-Rev2 SoC
  2017-11-10 10:17 [PATCH 1/3] Documentation : can : flexcan : Add big-endian property to device tree Pankaj Bansal
  2017-11-10 10:17 ` [PATCH 2/3] powerpc: dts: P1010: Add endianness property to flexcan node Pankaj Bansal
@ 2017-11-10 10:17 ` Pankaj Bansal
       [not found] ` <1510309043-16777-1-git-send-email-pankaj.bansal-3arQi8VN3Tc@public.gmane.org>
  2 siblings, 0 replies; 4+ messages in thread
From: Pankaj Bansal @ 2017-11-10 10:17 UTC (permalink / raw)
  To: wg, mkl, linux-can, robh+dt, mark.rutland, devicetree
  Cc: V.Sethi, poonam.aggrwal, Pankaj Bansal, Bhupesh Sharma, Sakar Arora

This patch adds the device nodes for flexcan controller(s) present
on LS1021A-Rev2 SoC.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Signed-off-by: Bhupesh Sharma <bhupesh.sharma@freescale.com>
Signed-off-by: Sakar Arora <Sakar.Arora@freescale.com>
Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
Reviewed-by: Poonam Aggrwal <poonam.aggrwal@nxp.com>
---
 arch/arm/boot/dts/ls1021a-qds.dts | 16 +++++++++++++
 arch/arm/boot/dts/ls1021a-twr.dts | 16 +++++++++++++
 arch/arm/boot/dts/ls1021a.dtsi    | 36 +++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+)

diff --git a/arch/arm/boot/dts/ls1021a-qds.dts b/arch/arm/boot/dts/ls1021a-qds.dts
index 9408753..4f211e3 100644
--- a/arch/arm/boot/dts/ls1021a-qds.dts
+++ b/arch/arm/boot/dts/ls1021a-qds.dts
@@ -331,3 +331,19 @@
 &uart1 {
 	status = "okay";
 };
+
+&can0 {
+	status = "okay";
+};
+
+&can1 {
+	status = "okay";
+};
+
+&can2 {
+	status = "disabled";
+};
+
+&can3 {
+	status = "disabled";
+};
diff --git a/arch/arm/boot/dts/ls1021a-twr.dts b/arch/arm/boot/dts/ls1021a-twr.dts
index a8b148a..7202d9c 100644
--- a/arch/arm/boot/dts/ls1021a-twr.dts
+++ b/arch/arm/boot/dts/ls1021a-twr.dts
@@ -243,3 +243,19 @@
 &uart1 {
 	status = "okay";
 };
+
+&can0 {
+	status = "okay";
+};
+
+&can1 {
+	status = "okay";
+};
+
+&can2 {
+	status = "disabled";
+};
+
+&can3 {
+	status = "disabled";
+};
diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi
index 9319e1f..7789031 100644
--- a/arch/arm/boot/dts/ls1021a.dtsi
+++ b/arch/arm/boot/dts/ls1021a.dtsi
@@ -730,5 +730,41 @@
 					<0000 0 0 3 &gic GIC_SPI 191 IRQ_TYPE_LEVEL_HIGH>,
 					<0000 0 0 4 &gic GIC_SPI 193 IRQ_TYPE_LEVEL_HIGH>;
 		};
+
+		can0: can@2a70000 {
+			compatible = "fsl,ls1021ar2-flexcan";
+			reg = <0x0 0x2a70000 0x0 0x1000>;
+			interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&clockgen 4 1>, <&clockgen 4 1>;
+			clock-names = "ipg", "per";
+			big-endian;
+		};
+
+		can1: can@2a80000 {
+			compatible = "fsl,ls1021ar2-flexcan";
+			reg = <0x0 0x2a80000 0x0 0x1000>;
+			interrupts = <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&clockgen 4 1>, <&clockgen 4 1>;
+			clock-names = "ipg", "per";
+			big-endian;
+		};
+
+		can2: can@2a90000 {
+			compatible = "fsl,ls1021ar2-flexcan";
+			reg = <0x0 0x2a90000 0x0 0x1000>;
+			interrupts = <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&clockgen 4 1>, <&clockgen 4 1>;
+			clock-names = "ipg", "per";
+			big-endian;
+		};
+
+		can3: can@2aa0000 {
+			compatible = "fsl,ls1021ar2-flexcan";
+			reg = <0x0 0x2aa0000 0x0 0x1000>;
+			interrupts = <GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&clockgen 4 1>, <&clockgen 4 1>;
+			clock-names = "ipg", "per";
+			big-endian;
+		};
 	};
 };
-- 
2.7.4


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

* Re: [PATCH 1/3] Documentation : can : flexcan : Add big-endian property to device tree
       [not found] ` <1510309043-16777-1-git-send-email-pankaj.bansal-3arQi8VN3Tc@public.gmane.org>
@ 2017-11-10 10:36   ` Marc Kleine-Budde
  0 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2017-11-10 10:36 UTC (permalink / raw)
  To: Pankaj Bansal, wg-5Yr1BZd7O62+XT7JhA+gdA,
	linux-can-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: V.Sethi-3arQi8VN3Tc, poonam.aggrwal-3arQi8VN3Tc


[-- Attachment #1.1: Type: text/plain, Size: 1868 bytes --]

On 11/10/2017 11:17 AM, Pankaj Bansal wrote:
> The FlexCAN controller can be modelled as little or big endian
> depending on SOC design. This device tree property identifies the
> controller endianness and the driver reads/writes controller registers
> based on that.
> 
> This is optional property. i.e. if this property is not present in
> device tree node then controller is assumed to be little endian. if
> this property is present then controller is assumed to be big endian.
> 
> Signed-off-by: Pankaj Bansal <pankaj.bansal-3arQi8VN3Tc@public.gmane.org>
> Reviewed-by: Poonam Aggrwal <poonam.aggrwal-3arQi8VN3Tc@public.gmane.org>

NACK, this is not backwards compatible.

See mail on linux-can for better solution.

Marc

> ---
>  Documentation/devicetree/bindings/net/can/fsl-flexcan.txt | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
> index 56d6cc3..b9693c7 100644
> --- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
> +++ b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
> @@ -18,6 +18,8 @@ Optional properties:
>  
>  - xceiver-supply: Regulator that powers the CAN transceiver
>  
> +- big-endian: This means the registers of FlexCAN controller are big endian
> +
>  Example:
>  
>  	can@1c000 {
> @@ -26,4 +28,5 @@ Example:
>  		interrupts = <48 0x2>;
>  		interrupt-parent = <&mpic>;
>  		clock-frequency = <200000000>; // filled in by bootloader
> +		big-endian;
>  	};
> 


-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2017-11-10 10:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-10 10:17 [PATCH 1/3] Documentation : can : flexcan : Add big-endian property to device tree Pankaj Bansal
2017-11-10 10:17 ` [PATCH 2/3] powerpc: dts: P1010: Add endianness property to flexcan node Pankaj Bansal
2017-11-10 10:17 ` [PATCH 3/3] arm/dts: Add nodes for flexcan devices present on LS1021A-Rev2 SoC Pankaj Bansal
     [not found] ` <1510309043-16777-1-git-send-email-pankaj.bansal-3arQi8VN3Tc@public.gmane.org>
2017-11-10 10:36   ` [PATCH 1/3] Documentation : can : flexcan : Add big-endian property to device tree Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).