From bart.tanghe at thomasmore.be  Wed Jan  7 03:00:58 2015
From: bart.tanghe at thomasmore.be (Bart Tanghe)
Date: Wed,  7 Jan 2015 12:00:58 +0100
Subject: [PATCH v2] ARM: dts: add bcm2835-pwm bindings
Message-ID: <1420628458-11459-1-git-send-email-bart.tanghe@thomasmore.be>

To probe the bcm2835-pwm driver properly, this dts bindings has to be added 
to the bcm2835 dtsi file.
In expectation of a bcm2835 clock driver, I've added fixed-clock clock binding.
---
Changes in v2:
 - status set to disabled
 - follow the clock naming convention

Signed-off-by: Bart Tanghe <bart.tanghe at thomasmore.be>

diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
index 3342cb1..ba76bb4 100644
--- a/arch/arm/boot/dts/bcm2835.dtsi
+++ b/arch/arm/boot/dts/bcm2835.dtsi
@@ -146,6 +147,14 @@
 			interrupts = <1 9>;
 		};
 
+		pwm: pwm at 7e20e000 {
+			compatible = "brcm,bcm2835-pwm";
+			reg = <0x7e20c000 0x28>;
+			clocks = <&clk_pwm>;
+			#pwm-cells = <2>;
+			status = "disabled";
+		};
+
 		arm-pmu {
 			compatible = "arm,arm1176-pmu";
 		};
@@ -179,5 +188,13 @@
 			clock-output-names = "spi";
 			clock-frequency = <250000000>;
 		};
+
+		clk_pwm: clock at 3 {
+			compatible = "fixed-clock";
+			reg = <3>;
+			#clock-cells = <0>;
+			clock-output-names = "pwm";
+			clock-frequency = <9200000>;
+		};
 	};
 };


From swarren at wwwdotorg.org  Sat Jan 10 08:34:27 2015
From: swarren at wwwdotorg.org (Stephen Warren)
Date: Sat, 10 Jan 2015 09:34:27 -0700
Subject: [PATCH v2] ARM: dts: add bcm2835-pwm bindings
In-Reply-To: <1420628458-11459-1-git-send-email-bart.tanghe@thomasmore.be>
References: <1420628458-11459-1-git-send-email-bart.tanghe@thomasmore.be>
Message-ID: <54B15493.5030406@wwwdotorg.org>

On 01/07/2015 04:00 AM, Bart Tanghe wrote:
> To probe the bcm2835-pwm driver properly, this dts bindings has to be added 
> to the bcm2835 dtsi file.
> In expectation of a bcm2835 clock driver, I've added fixed-clock clock binding.

> diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi

> +		pwm: pwm at 7e20e000 {
> +			compatible = "brcm,bcm2835-pwm";
> +			reg = <0x7e20c000 0x28>;
> +			clocks = <&clk_pwm>;
> +			#pwm-cells = <2>;
> +			status = "disabled";
> +		};

Can the nodes be kept sorted by reg value; I think this should be added
between the existing i2c at 20205000 and sdhci at 7e300000 nodes.

Aside from that,
Acked-by: Stephen Warren <swarren at wwwdotorg.org>


From info at lategoodbye.de  Tue Jan 13 11:14:11 2015
From: info at lategoodbye.de (Stefan Wahren)
Date: Tue, 13 Jan 2015 20:14:11 +0100
Subject: Question about GPIO as interrupt source
Message-ID: <54B56E83.3030900@lategoodbye.de>

Hi,

i want to define a GPIO (GPIO23 in my example) as an interrupt source 
for a SPI device node. I've looked at [1], but after all i still do not 
known how to define the interrupts property. I know the property must 
have 2 cells.

I don't have a clue, how the mapping between interrupt and GPIO work on 
the Raspberry Pi.

Best regards
Stefan Wahren

[1] - 
http://lxr.free-electrons.com/source/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt


From notro at tronnes.org  Tue Jan 13 12:13:32 2015
From: notro at tronnes.org (Noralf Tronnes)
Date: Tue, 13 Jan 2015 21:13:32 +0100
Subject: Question about GPIO as interrupt source
In-Reply-To: <54B56E83.3030900@lategoodbye.de>
References: <54B56E83.3030900@lategoodbye.de>
Message-ID: <54B57C6C.4040800@tronnes.org>

Den 13.01.2015 20:14, skrev Stefan Wahren:
> Hi,
>
> i want to define a GPIO (GPIO23 in my example) as an interrupt source 
> for a SPI device node. I've looked at [1], but after all i still do 
> not known how to define the interrupts property. I know the property 
> must have 2 cells.
>
> I don't have a clue, how the mapping between interrupt and GPIO work 
> on the Raspberry Pi.
>
Here are two examples of SPI connected touch controllers using gpio irq's:
https://github.com/notro/fbtft/blob/master/dts/overlays/rpi/rpi-display-overlay.dts#L61
https://github.com/notro/fbtft/blob/master/dts/overlays/rpi/pitft-overlay.dts#L60

The files are DT overlays used with the recent support added to the 
VideoCore bootloader: 
http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=93015
For the curious, this DT kernel is still using ARCH_BCM2708, but 
ARCH_BCM2835 is now finally within view.


Regards,
Noralf Tr?nnes



From info at lategoodbye.de  Wed Jan 14 13:44:11 2015
From: info at lategoodbye.de (Stefan Wahren)
Date: Wed, 14 Jan 2015 22:44:11 +0100
Subject: Question about GPIO as interrupt source
In-Reply-To: <54B57C6C.4040800@tronnes.org>
References: <54B56E83.3030900@lategoodbye.de> <54B57C6C.4040800@tronnes.org>
Message-ID: <54B6E32B.8060507@lategoodbye.de>

Hi Noralf,

Am 13.01.2015 um 21:13 schrieb Noralf Tronnes:
> Den 13.01.2015 20:14, skrev Stefan Wahren:
>> Hi,
>>
>> i want to define a GPIO (GPIO23 in my example) as an interrupt source
>> for a SPI device node. I've looked at [1], but after all i still do
>> not known how to define the interrupts property. I know the property
>> must have 2 cells.
>>
>> I don't have a clue, how the mapping between interrupt and GPIO work
>> on the Raspberry Pi.
>>
> Here are two examples of SPI connected touch controllers using gpio irq's:
> https://github.com/notro/fbtft/blob/master/dts/overlays/rpi/rpi-display-overlay.dts#L61
>
> https://github.com/notro/fbtft/blob/master/dts/overlays/rpi/pitft-overlay.dts#L60
>
>
> The files are DT overlays used with the recent support added to the
> VideoCore bootloader:
> http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=93015
> For the curious, this DT kernel is still using ARCH_BCM2708, but
> ARCH_BCM2835 is now finally within view.
>

thanks. I forgot the interrupt parent and now it's working.

Stefan

>
> Regards,
> Noralf Tr?nnes
>



From bart.tanghe at thomasmore.be  Wed Jan 14 01:18:54 2015
From: bart.tanghe at thomasmore.be (Bart Tanghe)
Date: Wed, 14 Jan 2015 10:18:54 +0100
Subject: [PATCH v3] ARM: dts: add bcm2835-pwm bindings
Message-ID: <1421227134-8590-1-git-send-email-bart.tanghe@thomasmore.be>

To probe the bcm2835-pwm driver properly, this dts bindings has to be added 
to the bcm2835 dtsi file.
In expectation of a bcm2835 clock driver, I've added fixed-clock clock binding.
---
Changes in v3:
 - node added by reg value

Signed-off-by: Bart Tanghe <bart.tanghe at thomasmore.be>
Acked-by: Stephen Warren <swarren at wwwdotorg.org>

diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
index 3342cb1..ba76bb4 100644
--- a/arch/arm/boot/dts/bcm2835.dtsi
+++ b/arch/arm/boot/dts/bcm2835.dtsi
@@ -146,6 +147,14 @@
 			interrupts = <1 9>;
 		};
 
+		pwm: pwm at 7e20e000 {
+			compatible = "brcm,bcm2835-pwm";
+			reg = <0x7e20c000 0x28>;
+			clocks = <&clk_pwm>;
+			#pwm-cells = <2>;
+			status = "disabled";
+		};
+
 		arm-pmu {
 			compatible = "arm,arm1176-pmu";
 		};
@@ -179,5 +188,13 @@
 			clock-output-names = "spi";
 			clock-frequency = <250000000>;
 		};
+
+		clk_pwm: clock at 3 {
+			compatible = "fixed-clock";
+			reg = <3>;
+			#clock-cells = <0>;
+			clock-output-names = "pwm";
+			clock-frequency = <9200000>;
+		};
 	};
 };


From swarren at wwwdotorg.org  Wed Jan 14 09:06:08 2015
From: swarren at wwwdotorg.org (Stephen Warren)
Date: Wed, 14 Jan 2015 10:06:08 -0700
Subject: [PATCH v3] ARM: dts: add bcm2835-pwm bindings
In-Reply-To: <1421227134-8590-1-git-send-email-bart.tanghe@thomasmore.be>
References: <1421227134-8590-1-git-send-email-bart.tanghe@thomasmore.be>
Message-ID: <54B6A200.4040209@wwwdotorg.org>

On 01/14/2015 02:18 AM, Bart Tanghe wrote:
> To probe the bcm2835-pwm driver properly, this dts bindings has to be added
> to the bcm2835 dtsi file.
> In expectation of a bcm2835 clock driver, I've added fixed-clock clock binding.
> ---
> Changes in v3:
>   - node added by reg value

The pwm node still seems to be in the wrong place. Sorting by reg value, 
it should be after i2c at 20205000 and before sdhci at 7e300000, as I 
mentioned before.


From bart.tanghe at thomasmore.be  Thu Jan 15 04:29:34 2015
From: bart.tanghe at thomasmore.be (Bart Tanghe)
Date: Thu, 15 Jan 2015 13:29:34 +0100
Subject: [PATCH v3] ARM: dts: add bcm2835-pwm bindings
In-Reply-To: <54B6A200.4040209@wwwdotorg.org>
References: <1421227134-8590-1-git-send-email-bart.tanghe@thomasmore.be>
 <54B6A200.4040209@wwwdotorg.org>
Message-ID: <54B7B2AE.3020309@thomasmore.be>

I'm really sorry. I've used the wrong source. I make v4.

Regards,

Bart

On 01/14/2015 06:06 PM, Stephen Warren wrote:
> On 01/14/2015 02:18 AM, Bart Tanghe wrote:
>> To probe the bcm2835-pwm driver properly, this dts bindings has to be added
>> to the bcm2835 dtsi file.
>> In expectation of a bcm2835 clock driver, I've added fixed-clock clock binding.
>> ---
>> Changes in v3:
>>   - node added by reg value
> 
> The pwm node still seems to be in the wrong place. Sorting by reg value, it should be after i2c at 20205000 and before sdhci at 7e300000, as I mentioned before.


From bart.tanghe at thomasmore.be  Thu Jan 15 04:33:10 2015
From: bart.tanghe at thomasmore.be (Bart Tanghe)
Date: Thu, 15 Jan 2015 13:33:10 +0100
Subject: [PATCH v4] ARM: dts: add bcm2835-pwm bindings
Message-ID: <1421325190-7648-1-git-send-email-bart.tanghe@thomasmore.be>

To probe the bcm2835-pwm driver properly, this dts bindings has to be added 
to the bcm2835 dtsi file.
In expectation of a bcm2835 clock driver, I've added fixed-clock clock binding. 
---
Changes in v4:
 - node added by reg value  

Signed-off-by: Bart Tanghe <bart.tanghe at thomasmore.be>
Acked-by: Stephen Warren <swarren at wwwdotorg.org>

diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
index 3342cb1..e8a0f13 100644
--- a/arch/arm/boot/dts/bcm2835.dtsi
+++ b/arch/arm/boot/dts/bcm2835.dtsi
@@ -122,6 +123,14 @@
 			status = "disabled";
 		};
 
+                pwm: pwm at 7e20c000 {
+                        compatible = "brcm,bcm2835-pwm";
+                        reg = <0x7e20c000 0x28>;
+                        clocks = <&clk_pwm>;
+                        #pwm-cells = <2>;
+                        status = "disabled";
+                };
+
 		sdhci: sdhci at 7e300000 {
 			compatible = "brcm,bcm2835-sdhci";
 			reg = <0x7e300000 0x100>;
@@ -179,5 +188,13 @@
 			clock-output-names = "spi";
 			clock-frequency = <250000000>;
 		};
+
+		clk_pwm: clock at 3 {
+			compatible = "fixed-clock";
+			reg = <3>;
+			#clock-cells = <0>;
+			clock-output-names = "pwm";
+			clock-frequency = <9200000>;
+		};
 	};
 };


From stefan.wahren at i2se.com  Thu Jan 29 10:10:50 2015
From: stefan.wahren at i2se.com (Stefan Wahren)
Date: Thu, 29 Jan 2015 18:10:50 +0000
Subject: [PATCH V2 RESEND 4/4] ARM: bcm2835: Use pinctrl header
In-Reply-To: <1422555050-28509-1-git-send-email-stefan.wahren@i2se.com>
References: <1422555050-28509-1-git-send-email-stefan.wahren@i2se.com>
Message-ID: <1422555050-28509-5-git-send-email-stefan.wahren@i2se.com>

This patch converts all bcm2835 dts and dtsi files to use the pinctrl
header file.

Signed-off-by: Stefan Wahren <stefan.wahren at i2se.com>
---
 arch/arm/boot/dts/bcm2835-rpi-b-plus.dts |    4 ++--
 arch/arm/boot/dts/bcm2835-rpi-b.dts      |    4 ++--
 arch/arm/boot/dts/bcm2835-rpi.dtsi       |    8 ++++----
 arch/arm/boot/dts/bcm2835.dtsi           |    3 ++-
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
index e479515..668442b 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
@@ -1,5 +1,5 @@
 /dts-v1/;
-/include/ "bcm2835-rpi.dtsi"
+#include "bcm2835-rpi.dtsi"
 
 / {
 	compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
@@ -25,6 +25,6 @@
 	/* I2S interface */
 	i2s_alt0: i2s_alt0 {
 		brcm,pins = <18 19 20 21>;
-		brcm,function = <4>; /* alt0 */
+		brcm,function = <BCM2835_FSEL_ALT0>;
 	};
 };
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts
index bafa46f..ee89b79 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts
@@ -1,5 +1,5 @@
 /dts-v1/;
-/include/ "bcm2835-rpi.dtsi"
+#include "bcm2835-rpi.dtsi"
 
 / {
 	compatible = "raspberrypi,model-b", "brcm,bcm2835";
@@ -18,6 +18,6 @@
 	/* I2S interface */
 	i2s_alt2: i2s_alt2 {
 		brcm,pins = <28 29 30 31>;
-		brcm,function = <6>; /* alt2 */
+		brcm,function = <BCM2835_FSEL_ALT2>;
 	};
 };
diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi
index c706448..46780bb 100644
--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi
+++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi
@@ -1,4 +1,4 @@
-/include/ "bcm2835.dtsi"
+#include "bcm2835.dtsi"
 
 / {
 	memory {
@@ -21,17 +21,17 @@
 
 	gpioout: gpioout {
 		brcm,pins = <6>;
-		brcm,function = <1>; /* GPIO out */
+		brcm,function = <BCM2835_FSEL_GPIO_OUT>;
 	};
 
 	alt0: alt0 {
 		brcm,pins = <0 1 2 3 4 5 7 8 9 10 11 14 15 40 45>;
-		brcm,function = <4>; /* alt0 */
+		brcm,function = <BCM2835_FSEL_ALT0>;
 	};
 
 	alt3: alt3 {
 		brcm,pins = <48 49 50 51 52 53>;
-		brcm,function = <7>; /* alt3 */
+		brcm,function = <BCM2835_FSEL_ALT3>;
 	};
 };
 
diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
index 3342cb1..be9c914 100644
--- a/arch/arm/boot/dts/bcm2835.dtsi
+++ b/arch/arm/boot/dts/bcm2835.dtsi
@@ -1,4 +1,5 @@
-/include/ "skeleton.dtsi"
+#include <dt-bindings/pinctrl/bcm2835.h>
+#include "skeleton.dtsi"
 
 / {
 	compatible = "brcm,bcm2835";
-- 
1.7.9.5



From stefan.wahren at i2se.com  Thu Jan 29 10:10:46 2015
From: stefan.wahren at i2se.com (Stefan Wahren)
Date: Thu, 29 Jan 2015 18:10:46 +0000
Subject: [PATCH V2 RESEND 0/4] ARM: bcm2835: DT improvements
Message-ID: <1422555050-28509-1-git-send-email-stefan.wahren@i2se.com>

This patch series contains DT improvements for the Raspberry Pi.

Patch 1,2: Add missing vendor prefix and root compatible properties
Patch 3,4: Use constants for pin function instead of error-prone numbers

Changes in V2:
- add all currently known Raspberry Pi boards to binding documentation 
  as suggested by Stephen Warren

Stefan Wahren (4):
  dt-bindings: Add vendor prefix for Raspberry Pi
  dt-bindings: Add root properties for Raspberry Pi
  ARM: bcm2835: Add header file for pinctrl constants
  ARM: bcm2835: Use pinctrl header

 Documentation/devicetree/bindings/arm/bcm2835.txt  |   31 ++++++++++++++++++--
 .../devicetree/bindings/vendor-prefixes.txt        |    1 +
 arch/arm/boot/dts/bcm2835-rpi-b-plus.dts           |    4 +--
 arch/arm/boot/dts/bcm2835-rpi-b.dts                |    4 +--
 arch/arm/boot/dts/bcm2835-rpi.dtsi                 |    8 ++---
 arch/arm/boot/dts/bcm2835.dtsi                     |    3 +-
 include/dt-bindings/pinctrl/bcm2835.h              |   27 +++++++++++++++++
 7 files changed, 67 insertions(+), 11 deletions(-)
 create mode 100644 include/dt-bindings/pinctrl/bcm2835.h

-- 
1.7.9.5



From stefan.wahren at i2se.com  Thu Jan 29 10:10:47 2015
From: stefan.wahren at i2se.com (Stefan Wahren)
Date: Thu, 29 Jan 2015 18:10:47 +0000
Subject: [PATCH V2 RESEND 1/4] dt-bindings: Add vendor prefix for Raspberry Pi
In-Reply-To: <1422555050-28509-1-git-send-email-stefan.wahren@i2se.com>
References: <1422555050-28509-1-git-send-email-stefan.wahren@i2se.com>
Message-ID: <1422555050-28509-2-git-send-email-stefan.wahren@i2se.com>

Since the prefix is already in use, we need to add it in the
vendor list.

Signed-off-by: Stefan Wahren <stefan.wahren at i2se.com>
---
 .../devicetree/bindings/vendor-prefixes.txt        |    1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 5d2251a..0546f73 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -136,6 +136,7 @@ radxa	Radxa
 raidsonic	RaidSonic Technology GmbH
 ralink	Mediatek/Ralink Technology Corp.
 ramtron	Ramtron International
+raspberrypi	Raspberry Pi Foundation
 realtek Realtek Semiconductor Corp.
 renesas	Renesas Electronics Corporation
 ricoh	Ricoh Co. Ltd.
-- 
1.7.9.5



From stefan.wahren at i2se.com  Thu Jan 29 10:10:48 2015
From: stefan.wahren at i2se.com (Stefan Wahren)
Date: Thu, 29 Jan 2015 18:10:48 +0000
Subject: [PATCH V2 RESEND 2/4] dt-bindings: Add root properties for Raspberry
 Pi
In-Reply-To: <1422555050-28509-1-git-send-email-stefan.wahren@i2se.com>
References: <1422555050-28509-1-git-send-email-stefan.wahren@i2se.com>
Message-ID: <1422555050-28509-3-git-send-email-stefan.wahren@i2se.com>

This patch adds root compatible properties for the following boards:
- Raspberry Pi Model A
- Raspberry Pi Model A+
- Raspberry Pi Model B
- Raspberry Pi Model B (no P5)
- Raspberry Pi Model B rev2
- Raspberry Pi Model B+
- Raspberry Pi Compute Module

Signed-off-by: Stefan Wahren <stefan.wahren at i2se.com>
---
 Documentation/devicetree/bindings/arm/bcm2835.txt |   31 +++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/bcm2835.txt b/Documentation/devicetree/bindings/arm/bcm2835.txt
index ac68348..c78576b 100644
--- a/Documentation/devicetree/bindings/arm/bcm2835.txt
+++ b/Documentation/devicetree/bindings/arm/bcm2835.txt
@@ -1,8 +1,35 @@
 Broadcom BCM2835 device tree bindings
 -------------------------------------------
 
-Boards with the BCM2835 SoC shall have the following properties:
+Raspberry Pi Model A
+Required root node properties:
+compatible = "raspberrypi,model-a", "brcm,bcm2835";
 
-Required root node property:
+Raspberry Pi Model A+
+Required root node properties:
+compatible = "raspberrypi,model-a-plus", "brcm,bcm2835";
 
+Raspberry Pi Model B
+Required root node properties:
+compatible = "raspberrypi,model-b", "brcm,bcm2835";
+
+Raspberry Pi Model B (no P5)
+early model B with I2C0 rather than I2C1 routed to the expansion header
+Required root node properties:
+compatible = "raspberrypi,model-b-i2c0", "brcm,bcm2835";
+
+Raspberry Pi Model B rev2
+Required root node properties:
+compatible = "raspberrypi,model-b-rev2", "brcm,bcm2835";
+
+Raspberry Pi Model B+
+Required root node properties:
+compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
+
+Raspberry Pi Compute Module
+Required root node properties:
+compatible = "raspberrypi,compute-module", "brcm,bcm2835";
+
+Generic BCM2835 board
+Required root node properties:
 compatible = "brcm,bcm2835";
-- 
1.7.9.5



From stefan.wahren at i2se.com  Thu Jan 29 10:10:49 2015
From: stefan.wahren at i2se.com (Stefan Wahren)
Date: Thu, 29 Jan 2015 18:10:49 +0000
Subject: [PATCH V2 RESEND 3/4] ARM: bcm2835: Add header file for pinctrl
 constants
In-Reply-To: <1422555050-28509-1-git-send-email-stefan.wahren@i2se.com>
References: <1422555050-28509-1-git-send-email-stefan.wahren@i2se.com>
Message-ID: <1422555050-28509-4-git-send-email-stefan.wahren@i2se.com>

This new header file defines pincontrol constants to use
from bcm2835 DTS files for pincontrol properties option.

Signed-off-by: Stefan Wahren <stefan.wahren at i2se.com>
---
 include/dt-bindings/pinctrl/bcm2835.h |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 include/dt-bindings/pinctrl/bcm2835.h

diff --git a/include/dt-bindings/pinctrl/bcm2835.h b/include/dt-bindings/pinctrl/bcm2835.h
new file mode 100644
index 0000000..6f0bc37
--- /dev/null
+++ b/include/dt-bindings/pinctrl/bcm2835.h
@@ -0,0 +1,27 @@
+/*
+ * Header providing constants for bcm2835 pinctrl bindings.
+ *
+ * Copyright (C) 2015 Stefan Wahren <stefan.wahren at i2se.com>
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#ifndef __DT_BINDINGS_PINCTRL_BCM2835_H__
+#define __DT_BINDINGS_PINCTRL_BCM2835_H__
+
+/* brcm,function property */
+#define BCM2835_FSEL_GPIO_IN	0
+#define BCM2835_FSEL_GPIO_OUT	1
+#define BCM2835_FSEL_ALT5	2
+#define BCM2835_FSEL_ALT4	3
+#define BCM2835_FSEL_ALT0	4
+#define BCM2835_FSEL_ALT1	5
+#define BCM2835_FSEL_ALT2	6
+#define BCM2835_FSEL_ALT3	7
+
+#endif /* __DT_BINDINGS_PINCTRL_BCM2835_H__ */
-- 
1.7.9.5



From stefan.wahren at i2se.com  Fri Jan 16 08:48:59 2015
From: stefan.wahren at i2se.com (Stefan Wahren)
Date: Fri, 16 Jan 2015 16:48:59 -0000
Subject: [PATCH 1/4] dt-bindings: Add vendor prefix for Raspberry Pi
In-Reply-To: <1421426897-27225-1-git-send-email-stefan.wahren@i2se.com>
References: <1421426897-27225-1-git-send-email-stefan.wahren@i2se.com>
Message-ID: <1421426897-27225-2-git-send-email-stefan.wahren@i2se.com>

Since the prefix is already in use, we need to add it in the
vendor list.

Signed-off-by: Stefan Wahren <stefan.wahren at i2se.com>
---
 .../devicetree/bindings/vendor-prefixes.txt        |    1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 5d2251a..0546f73 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -136,6 +136,7 @@ radxa	Radxa
 raidsonic	RaidSonic Technology GmbH
 ralink	Mediatek/Ralink Technology Corp.
 ramtron	Ramtron International
+raspberrypi	Raspberry Pi Foundation
 realtek Realtek Semiconductor Corp.
 renesas	Renesas Electronics Corporation
 ricoh	Ricoh Co. Ltd.
-- 
1.7.9.5



From stefan.wahren at i2se.com  Fri Jan 16 08:49:07 2015
From: stefan.wahren at i2se.com (Stefan Wahren)
Date: Fri, 16 Jan 2015 16:49:07 -0000
Subject: [PATCH 2/4] dt-bindings: Add root properties for Raspberry Pi B and B+
In-Reply-To: <1421426897-27225-1-git-send-email-stefan.wahren@i2se.com>
References: <1421426897-27225-1-git-send-email-stefan.wahren@i2se.com>
Message-ID: <1421426897-27225-3-git-send-email-stefan.wahren@i2se.com>

This patch adds root compatible properties for the following boards:
- Raspberry Pi Model B
- Raspberry Pi Model B+

Signed-off-by: Stefan Wahren <stefan.wahren at i2se.com>
---
 Documentation/devicetree/bindings/arm/bcm2835.txt |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/bcm2835.txt b/Documentation/devicetree/bindings/arm/bcm2835.txt
index ac68348..789aca2 100644
--- a/Documentation/devicetree/bindings/arm/bcm2835.txt
+++ b/Documentation/devicetree/bindings/arm/bcm2835.txt
@@ -1,8 +1,14 @@
 Broadcom BCM2835 device tree bindings
 -------------------------------------------
 
-Boards with the BCM2835 SoC shall have the following properties:
+Raspberry Pi Model B
+Required root node properties:
+compatible = "raspberrypi,model-b", "brcm,bcm2835";
 
-Required root node property:
+Raspberry Pi Model B+
+Required root node properties:
+compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
 
+Generic BCM2835 board
+Required root node properties:
 compatible = "brcm,bcm2835";
-- 
1.7.9.5



From stefan.wahren at i2se.com  Fri Jan 16 08:49:11 2015
From: stefan.wahren at i2se.com (Stefan Wahren)
Date: Fri, 16 Jan 2015 16:49:11 -0000
Subject: [PATCH 0/4] ARM: bcm2835: DT improvements
Message-ID: <1421426897-27225-1-git-send-email-stefan.wahren@i2se.com>

This patch series contains DT improvements for the Raspberry Pi.

Patch 1,2: Add missing vendor prefix and root compatible properties
Patch 3,4: Use constants for pin function instead of error-prone numbers

Stefan Wahren (4):
  dt-bindings: Add vendor prefix for Raspberry Pi
  dt-bindings: Add root properties for Raspberry Pi B and B+
  ARM: bcm2835: Add header file for pinctrl constants
  ARM: bcm2835: Use pinctrl header

 Documentation/devicetree/bindings/arm/bcm2835.txt  |   10 ++++++--
 .../devicetree/bindings/vendor-prefixes.txt        |    1 +
 arch/arm/boot/dts/bcm2835-rpi-b-plus.dts           |    4 +--
 arch/arm/boot/dts/bcm2835-rpi-b.dts                |    4 +--
 arch/arm/boot/dts/bcm2835-rpi.dtsi                 |    8 +++---
 arch/arm/boot/dts/bcm2835.dtsi                     |    3 ++-
 include/dt-bindings/pinctrl/bcm2835.h              |   27 ++++++++++++++++++++
 7 files changed, 46 insertions(+), 11 deletions(-)
 create mode 100644 include/dt-bindings/pinctrl/bcm2835.h

-- 
1.7.9.5



From stefan.wahren at i2se.com  Fri Jan 16 08:49:12 2015
From: stefan.wahren at i2se.com (Stefan Wahren)
Date: Fri, 16 Jan 2015 16:49:12 -0000
Subject: [PATCH 3/4] ARM: bcm2835: Add header file for pinctrl constants
In-Reply-To: <1421426897-27225-1-git-send-email-stefan.wahren@i2se.com>
References: <1421426897-27225-1-git-send-email-stefan.wahren@i2se.com>
Message-ID: <1421426897-27225-4-git-send-email-stefan.wahren@i2se.com>

This new header file defines pincontrol constants to use
from bcm2835 DTS files for pincontrol properties option.

Signed-off-by: Stefan Wahren <stefan.wahren at i2se.com>
---
 include/dt-bindings/pinctrl/bcm2835.h |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 include/dt-bindings/pinctrl/bcm2835.h

diff --git a/include/dt-bindings/pinctrl/bcm2835.h b/include/dt-bindings/pinctrl/bcm2835.h
new file mode 100644
index 0000000..6f0bc37
--- /dev/null
+++ b/include/dt-bindings/pinctrl/bcm2835.h
@@ -0,0 +1,27 @@
+/*
+ * Header providing constants for bcm2835 pinctrl bindings.
+ *
+ * Copyright (C) 2015 Stefan Wahren <stefan.wahren at i2se.com>
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#ifndef __DT_BINDINGS_PINCTRL_BCM2835_H__
+#define __DT_BINDINGS_PINCTRL_BCM2835_H__
+
+/* brcm,function property */
+#define BCM2835_FSEL_GPIO_IN	0
+#define BCM2835_FSEL_GPIO_OUT	1
+#define BCM2835_FSEL_ALT5	2
+#define BCM2835_FSEL_ALT4	3
+#define BCM2835_FSEL_ALT0	4
+#define BCM2835_FSEL_ALT1	5
+#define BCM2835_FSEL_ALT2	6
+#define BCM2835_FSEL_ALT3	7
+
+#endif /* __DT_BINDINGS_PINCTRL_BCM2835_H__ */
-- 
1.7.9.5



From stefan.wahren at i2se.com  Fri Jan 16 08:50:33 2015
From: stefan.wahren at i2se.com (Stefan Wahren)
Date: Fri, 16 Jan 2015 16:50:33 -0000
Subject: [PATCH 4/4] ARM: bcm2835: Use pinctrl header
Message-ID: <1421426993-27264-1-git-send-email-stefan.wahren@i2se.com>

This patch converts all bcm2835 dts files to use the pinctrl
header file.

Signed-off-by: Stefan Wahren <stefan.wahren at i2se.com>
---
 arch/arm/boot/dts/bcm2835-rpi-b-plus.dts |    4 ++--
 arch/arm/boot/dts/bcm2835-rpi-b.dts      |    4 ++--
 arch/arm/boot/dts/bcm2835-rpi.dtsi       |    8 ++++----
 arch/arm/boot/dts/bcm2835.dtsi           |    3 ++-
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
index e479515..668442b 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
@@ -1,5 +1,5 @@
 /dts-v1/;
-/include/ "bcm2835-rpi.dtsi"
+#include "bcm2835-rpi.dtsi"
 
 / {
 	compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
@@ -25,6 +25,6 @@
 	/* I2S interface */
 	i2s_alt0: i2s_alt0 {
 		brcm,pins = <18 19 20 21>;
-		brcm,function = <4>; /* alt0 */
+		brcm,function = <BCM2835_FSEL_ALT0>;
 	};
 };
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts
index bafa46f..ee89b79 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts
@@ -1,5 +1,5 @@
 /dts-v1/;
-/include/ "bcm2835-rpi.dtsi"
+#include "bcm2835-rpi.dtsi"
 
 / {
 	compatible = "raspberrypi,model-b", "brcm,bcm2835";
@@ -18,6 +18,6 @@
 	/* I2S interface */
 	i2s_alt2: i2s_alt2 {
 		brcm,pins = <28 29 30 31>;
-		brcm,function = <6>; /* alt2 */
+		brcm,function = <BCM2835_FSEL_ALT2>;
 	};
 };
diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi
index c706448..46780bb 100644
--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi
+++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi
@@ -1,4 +1,4 @@
-/include/ "bcm2835.dtsi"
+#include "bcm2835.dtsi"
 
 / {
 	memory {
@@ -21,17 +21,17 @@
 
 	gpioout: gpioout {
 		brcm,pins = <6>;
-		brcm,function = <1>; /* GPIO out */
+		brcm,function = <BCM2835_FSEL_GPIO_OUT>;
 	};
 
 	alt0: alt0 {
 		brcm,pins = <0 1 2 3 4 5 7 8 9 10 11 14 15 40 45>;
-		brcm,function = <4>; /* alt0 */
+		brcm,function = <BCM2835_FSEL_ALT0>;
 	};
 
 	alt3: alt3 {
 		brcm,pins = <48 49 50 51 52 53>;
-		brcm,function = <7>; /* alt3 */
+		brcm,function = <BCM2835_FSEL_ALT3>;
 	};
 };
 
diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
index 3342cb1..be9c914 100644
--- a/arch/arm/boot/dts/bcm2835.dtsi
+++ b/arch/arm/boot/dts/bcm2835.dtsi
@@ -1,4 +1,5 @@
-/include/ "skeleton.dtsi"
+#include <dt-bindings/pinctrl/bcm2835.h>
+#include "skeleton.dtsi"
 
 / {
 	compatible = "brcm,bcm2835";
-- 
1.7.9.5



From swarren at wwwdotorg.org  Sat Jan 17 19:06:07 2015
From: swarren at wwwdotorg.org (Stephen Warren)
Date: Sun, 18 Jan 2015 03:06:07 -0000
Subject: [PATCH 2/4] dt-bindings: Add root properties for Raspberry Pi
 B and B+
In-Reply-To: <1421426897-27225-3-git-send-email-stefan.wahren@i2se.com>
References: <1421426897-27225-1-git-send-email-stefan.wahren@i2se.com>
 <1421426897-27225-3-git-send-email-stefan.wahren@i2se.com>
Message-ID: <54BB2302.9070005@wwwdotorg.org>

On 01/16/2015 09:48 AM, Stefan Wahren wrote:
> This patch adds root compatible properties for the following boards:
> - Raspberry Pi Model B
> - Raspberry Pi Model B+

We may as well add all the models while at it. I think the following is
a complete list so far:

"model-b-i2c0": early model B with I2C0 rather than I2C1 routed to the
expansion header.

model-b

model-a

model-b-rev2

model-b-plus

compute-module

model-a-plus

FWIW, take a look at the following file to see U-Boot's board
identification code for the various models. Ideally we'll create
matching DT files in the kernel for all of the DT filenames there, sometime.

> http://git.denx.de/?p=u-boot.git;a=blob;f=board/raspberrypi/rpi/rpi.c;h=c18271fce823f7523a8958352701bfe3ea7086c7;hb=HEAD#l82



From swarren at wwwdotorg.org  Sat Jan 17 19:06:57 2015
From: swarren at wwwdotorg.org (Stephen Warren)
Date: Sun, 18 Jan 2015 03:06:57 -0000
Subject: [PATCH 4/4] ARM: bcm2835: Use pinctrl header
In-Reply-To: <1421426993-27264-1-git-send-email-stefan.wahren@i2se.com>
References: <1421426993-27264-1-git-send-email-stefan.wahren@i2se.com>
Message-ID: <54BB233A.10902@wwwdotorg.org>

On 01/16/2015 09:49 AM, Stefan Wahren wrote:
> This patch converts all bcm2835 dts files to use the pinctrl
> header file.

Aside from the one comment I made, the series,
Acked-by: Stephen Warren <swarren at wwwdotorg.org>


From stefan.wahren at i2se.com  Mon Jan 19 03:01:40 2015
From: stefan.wahren at i2se.com (Stefan Wahren)
Date: Mon, 19 Jan 2015 11:01:40 -0000
Subject: [PATCH 2/4 V2] dt-bindings: Add root properties for Raspberry Pi
Message-ID: <1421665231-28221-1-git-send-email-stefan.wahren@i2se.com>

This patch adds root compatible properties for the following boards:
- Raspberry Pi Model A
- Raspberry Pi Model A+
- Raspberry Pi Model B
- Raspberry Pi Model B (no P5)
- Raspberry Pi Model B rev2
- Raspberry Pi Model B+
- Raspberry Pi Compute Module

Signed-off-by: Stefan Wahren <stefan.wahren at i2se.com>
---

Changes in V2:
- add all currently known Raspberry Pi boards as suggested by
  Stephen Warren

 Documentation/devicetree/bindings/arm/bcm2835.txt |   31 +++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/bcm2835.txt b/Documentation/devicetree/bindings/arm/bcm2835.txt
index ac68348..c78576b 100644
--- a/Documentation/devicetree/bindings/arm/bcm2835.txt
+++ b/Documentation/devicetree/bindings/arm/bcm2835.txt
@@ -1,8 +1,35 @@
 Broadcom BCM2835 device tree bindings
 -------------------------------------------
 
-Boards with the BCM2835 SoC shall have the following properties:
+Raspberry Pi Model A
+Required root node properties:
+compatible = "raspberrypi,model-a", "brcm,bcm2835";
 
-Required root node property:
+Raspberry Pi Model A+
+Required root node properties:
+compatible = "raspberrypi,model-a-plus", "brcm,bcm2835";
 
+Raspberry Pi Model B
+Required root node properties:
+compatible = "raspberrypi,model-b", "brcm,bcm2835";
+
+Raspberry Pi Model B (no P5)
+early model B with I2C0 rather than I2C1 routed to the expansion header
+Required root node properties:
+compatible = "raspberrypi,model-b-i2c0", "brcm,bcm2835";
+
+Raspberry Pi Model B rev2
+Required root node properties:
+compatible = "raspberrypi,model-b-rev2", "brcm,bcm2835";
+
+Raspberry Pi Model B+
+Required root node properties:
+compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
+
+Raspberry Pi Compute Module
+Required root node properties:
+compatible = "raspberrypi,compute-module", "brcm,bcm2835";
+
+Generic BCM2835 board
+Required root node properties:
 compatible = "brcm,bcm2835";
-- 
1.7.9.5



From swarren at wwwdotorg.org  Mon Jan 19 09:12:58 2015
From: swarren at wwwdotorg.org (Stephen Warren)
Date: Mon, 19 Jan 2015 17:12:58 -0000
Subject: [PATCH 2/4 V2] dt-bindings: Add root properties for Raspberry Pi
In-Reply-To: <1421665231-28221-1-git-send-email-stefan.wahren@i2se.com>
References: <1421665231-28221-1-git-send-email-stefan.wahren@i2se.com>
Message-ID: <54BD3B49.4050203@wwwdotorg.org>

On 01/19/2015 04:00 AM, Stefan Wahren wrote:
> This patch adds root compatible properties for the following boards:
> - Raspberry Pi Model A
> - Raspberry Pi Model A+
> - Raspberry Pi Model B
> - Raspberry Pi Model B (no P5)
> - Raspberry Pi Model B rev2
> - Raspberry Pi Model B+
> - Raspberry Pi Compute Module

Acked-by: Stephen Warren <swarren at wwwdotorg.org>

This seems sane to me. One thing I should have asked: What compatible 
values does the RPi Foundation's downstream for all these cases? 
Aligning with that would be nice if possible.


From stefan.wahren at i2se.com  Mon Jan 19 11:01:59 2015
From: stefan.wahren at i2se.com (Stefan Wahren)
Date: Mon, 19 Jan 2015 19:01:59 -0000
Subject: [PATCH 2/4 V2] dt-bindings: Add root properties for Raspberry Pi
In-Reply-To: <54BD3B49.4050203@wwwdotorg.org>
References: <1421665231-28221-1-git-send-email-stefan.wahren@i2se.com>
 <54BD3B49.4050203@wwwdotorg.org>
Message-ID: <1722146904.386302.1421694080817.JavaMail.open-xchange@oxbaltgw08.schlund.de>

Hi Stephen,

> Stephen Warren <swarren at wwwdotorg.org> hat am 19. Januar 2015 um 18:13
> geschrieben:
>
>
> On 01/19/2015 04:00 AM, Stefan Wahren wrote:
> > This patch adds root compatible properties for the following boards:
> > - Raspberry Pi Model A
> > - Raspberry Pi Model A+
> > - Raspberry Pi Model B
> > - Raspberry Pi Model B (no P5)
> > - Raspberry Pi Model B rev2
> > - Raspberry Pi Model B+
> > - Raspberry Pi Compute Module
>
> Acked-by: Stephen Warren <swarren at wwwdotorg.org>
>
> This seems sane to me. One thing I should have asked: What compatible
> values does the RPi Foundation's downstream for all these cases?

good point. Unfortunately my patches to linux-rpi-kernel are held back because
of too many recipients, so it's possible that someone complain later.

I have looked at chapter 3.1 in [1], but didn't find the any other variants than
B and B+:

  Here, the presence or absence of the "-plus" is the significant thing, not the
"b" -- Model A's and A+'s will 
  use the "b" and "b-plus" variants, respectively.

Also in the newest branch [2]:

bcm2835-rpi-b.dts      -> model = Raspberry Pi Model B
bcm2708-rpi-b.dts      -> model = Raspberry Pi Model B
bcm2708-rpi-b-plus.dts -> model = Raspberry Pi Model B+

Sorry, i don't have any experience with the downstream kernel. So please correct
me if looked at the wrong places.

[1] -
https://github.com/raspberrypi/documentation/blob/master/configuration/device-tree.md
[2] - https://github.com/raspberrypi/linux/tree/rpi-3.18.y/

> Aligning with that would be nice if possible.

Stefan


