From 6520700fdb2cc07ed86e893a2e88c491e04d6b75 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Thu, 27 Dec 2012 14:29:05 -0700 Subject: [PATCH 1/4] ARM: bcm2835 rpi: remove hard-coded memreserve from DT The Raspberry Pi has either 256MB or 512MB of RAM. However, a portion is reserved for use by the VideoCore co-processor. The RPi DT contained a /memreserve/ statement to reserve that RAM. However, the exact amount of RAM used by the VideoCore is dynamic at boot-time; a firmware config file specifies the amount. As such, we can't hard-code the size in the DT. Remove the /memreserve/ statement. The bootloader is expected to adjust the /memory properties to reflect the RAM size the ARM CPU can use. Upstream U-Boot certainly does this, although I'm not sure that the basic firmware does if it boots the kernel directly; users may need to manually adjust their DT if not using U-Boot. Signed-off-by: Stephen Warren --- arch/arm/boot/dts/bcm2835-rpi-b.dts | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts index 9b72054a0bc0..6ff26f99cacd 100644 --- a/arch/arm/boot/dts/bcm2835-rpi-b.dts +++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts @@ -1,5 +1,4 @@ /dts-v1/; -/memreserve/ 0x0c000000 0x04000000; /include/ "bcm2835.dtsi" / { From 5186bf287aa4393b78c36f548d9b06001046b65e Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 24 Dec 2012 21:58:56 -0700 Subject: [PATCH 2/4] ARM: bcm2835: add SDHCI node to DT Add the SDHCI device node to the SoC DT file. Add a dummy fixed-clock to satisfy the SDHCI driver's clock lookup; eventually this should be replaced by a real clock implementation. Add board specific properties to the Raspberry Pi board file. Signed-off-by: Stephen Warren --- arch/arm/boot/dts/bcm2835-rpi-b.dts | 5 +++++ arch/arm/boot/dts/bcm2835.dtsi | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts index 6ff26f99cacd..0544ef860623 100644 --- a/arch/arm/boot/dts/bcm2835-rpi-b.dts +++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts @@ -24,3 +24,8 @@ brcm,function = <7>; /* alt3 */ }; }; + +&sdhci { + status = "okay"; + bus-width = <4>; +}; diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi index 8917550fd1bb..1d7e4f5c0b1e 100644 --- a/arch/arm/boot/dts/bcm2835.dtsi +++ b/arch/arm/boot/dts/bcm2835.dtsi @@ -63,5 +63,19 @@ interrupt-controller; #interrupt-cells = <2>; }; + + sdhci: sdhci { + compatible = "brcm,bcm2835-sdhci"; + reg = <0x7e300000 0x100>; + interrupts = <2 30>; + clocks = <&clk_mmc>; + status = "disabled"; + }; + }; + + clk_mmc: clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <100000000>; }; }; From 232fed4825e832c89b1d47a24c7836918063fb3e Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 31 Dec 2012 23:26:45 -0700 Subject: [PATCH 3/4] ARM: bcm2835: add I2C controllers to DT The BCM2835 has 3 identical I2C controllers. Instantiate them all in the SoC .dtsi file, and enable the relevant two in the Raspberry Pi board .dts file. Note that on the Raspberry Pi Model B revision 1, I2C0 is connected to the general-purpose expansion header, and I2C1 is connected to the camera connector. Revision 2 of the board swaps these assignments:-( Signed-off-by: Stephen Warren --- arch/arm/boot/dts/bcm2835-rpi-b.dts | 10 ++++++++++ arch/arm/boot/dts/bcm2835.dtsi | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts index 0544ef860623..aafda174a605 100644 --- a/arch/arm/boot/dts/bcm2835-rpi-b.dts +++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts @@ -25,6 +25,16 @@ }; }; +&i2c0 { + status = "okay"; + clock-frequency = <100000>; +}; + +&i2c1 { + status = "okay"; + clock-frequency = <100000>; +}; + &sdhci { status = "okay"; bus-width = <4>; diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi index 1d7e4f5c0b1e..c69a591631b8 100644 --- a/arch/arm/boot/dts/bcm2835.dtsi +++ b/arch/arm/boot/dts/bcm2835.dtsi @@ -64,6 +64,22 @@ #interrupt-cells = <2>; }; + i2c0: i2c@20205000 { + compatible = "brcm,bcm2835-i2c"; + reg = <0x7e205000 0x1000>; + interrupts = <2 21>; + clocks = <&clk_i2c>; + status = "disabled"; + }; + + i2c1: i2c@20804000 { + compatible = "brcm,bcm2835-i2c"; + reg = <0x7e804000 0x1000>; + interrupts = <2 21>; + clocks = <&clk_i2c>; + status = "disabled"; + }; + sdhci: sdhci { compatible = "brcm,bcm2835-sdhci"; reg = <0x7e300000 0x100>; @@ -73,6 +89,12 @@ }; }; + clk_i2c: clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <150000000>; + }; + clk_mmc: clock { compatible = "fixed-clock"; #clock-cells = <0>; From 9692c191ffffbd5255bec222b8f0f2854932a408 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 14 Jan 2013 21:07:20 -0700 Subject: [PATCH 4/4] ARM: bcm2835: fix clock node aliasing in device tree Both clock nodes in the current device tree are named "clock" and hence end up being the same node. Rename the nodes to different names to avoid this. In fact, fixed-clock uses the node name as the clock name, so name the nodes after the clock they represent. Move the clocks into a "clocks" sub-node to group them and avoid any possible naming conflicts with other nodes also named after the device type. Signed-off-by: Stephen Warren --- arch/arm/boot/dts/bcm2835.dtsi | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi index c69a591631b8..4bf2a8774aa7 100644 --- a/arch/arm/boot/dts/bcm2835.dtsi +++ b/arch/arm/boot/dts/bcm2835.dtsi @@ -89,15 +89,23 @@ }; }; - clk_i2c: clock { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <150000000>; - }; + clocks { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <0>; - clk_mmc: clock { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <100000000>; + clk_mmc: mmc { + compatible = "fixed-clock"; + reg = <0>; + #clock-cells = <0>; + clock-frequency = <100000000>; + }; + + clk_i2c: i2c { + compatible = "fixed-clock"; + reg = <1>; + #clock-cells = <0>; + clock-frequency = <150000000>; + }; }; };