From 14ac652b67fe08b0dca78995a4298aad38345a31 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 31 Dec 2013 16:54:16 -0500 Subject: [PATCH 1/6] ARM: bcm2835: perf_event support for Raspberry-Pi The following patch enables performance counter support on Raspberry-Pi. We have this working on the 2708 based rasp-pi kernels by manually putting the device registration in the platform files. This change does things properly in a device tree. The boot messages look proper, but my rasp-pi hangs somewhere in USB enabling when running a stock 3.13-rc6 kernel so I have been unable to fully test this change. I also understand that the rasp-pi 1176 pmu support is missing the overflow interrupt. I'm not sure if that's true of all 2835 implementations. If not, then this patch will need to be changed a bit. Signed-off-by: Vince Weaver [swarren, fixed DT node sort order] Signed-off-by: Stephen Warren --- arch/arm/boot/dts/bcm2835.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi index b021c96d3ba1..beb8659813b2 100644 --- a/arch/arm/boot/dts/bcm2835.dtsi +++ b/arch/arm/boot/dts/bcm2835.dtsi @@ -113,6 +113,10 @@ reg = <0x7e980000 0x10000>; interrupts = <1 9>; }; + + arm-pmu { + compatible = "arm,arm1176-pmu"; + }; }; clocks { From 890723395fc73e8dfb3b7da0f5717750cfae83a0 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Mon, 13 Jan 2014 12:11:43 +0100 Subject: [PATCH 2/6] ARM: bcm2835: add dmaengine driver to device tree This adds the definitions for the BCM2835 dmaengine driver to the device tree. The dma-channel-mask is currently fixed. Later it should be set via the firmware. Signed-off-by: Florian Meier [swarren, fixed DT node sort order] Signed-off-by: Stephen Warren --- arch/arm/boot/dts/bcm2835.dtsi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi index beb8659813b2..b17694066140 100644 --- a/arch/arm/boot/dts/bcm2835.dtsi +++ b/arch/arm/boot/dts/bcm2835.dtsi @@ -22,6 +22,27 @@ clock-frequency = <1000000>; }; + dma: dma@7e007000 { + compatible = "brcm,bcm2835-dma"; + reg = <0x7e007000 0xf00>; + interrupts = <1 16>, + <1 17>, + <1 18>, + <1 19>, + <1 20>, + <1 21>, + <1 22>, + <1 23>, + <1 24>, + <1 25>, + <1 26>, + <1 27>, + <1 28>; + + #dma-cells = <1>; + brcm,dma-channel-mask = <0x7f35>; + }; + intc: interrupt-controller { compatible = "brcm,bcm2835-armctrl-ic"; reg = <0x7e00b200 0x200>; From 9511cc4df0072df9e6d55c212711d4c103ac917d Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Mon, 13 Jan 2014 12:16:40 +0100 Subject: [PATCH 3/6] ARM: bcm2835: add I2S driver to device tree This adds the definitions for the BCM2835 I2S driver to the device tree. Some GPIO settings are needed for the correct pin functions. Signed-off-by: Florian Meier [swarren: fixed DT node sort order, simplified DT label name, removed RPI .dts file changs, since use of I2S is a user-added option.] Signed-off-by: Stephen Warren --- arch/arm/boot/dts/bcm2835.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi index b17694066140..398eac377e3c 100644 --- a/arch/arm/boot/dts/bcm2835.dtsi +++ b/arch/arm/boot/dts/bcm2835.dtsi @@ -91,6 +91,16 @@ #interrupt-cells = <2>; }; + i2s: i2s@7e203000 { + compatible = "brcm,bcm2835-i2s"; + reg = <0x7e203000 0x20>, + <0x7e101098 0x02>; + + dmas = <&dma 2>, + <&dma 3>; + dma-names = "tx", "rx"; + }; + spi: spi@20204000 { compatible = "brcm,bcm2835-spi"; reg = <0x7e204000 0x1000>; From ef3c690cde1e9e42baa20bb5ce9196c371593f60 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Tue, 11 Feb 2014 21:44:35 -0700 Subject: [PATCH 4/6] ARM: bcm2835: fix DT node sort order Re-order all the DT nodes so that they're ordered by their reg address. Signed-off-by: Stephen Warren --- arch/arm/boot/dts/bcm2835.dtsi | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi index 398eac377e3c..5ceba45b884a 100644 --- a/arch/arm/boot/dts/bcm2835.dtsi +++ b/arch/arm/boot/dts/bcm2835.dtsi @@ -60,14 +60,6 @@ reg = <0x7e104000 0x10>; }; - uart@20201000 { - compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell"; - reg = <0x7e201000 0x1000>; - interrupts = <2 25>; - clock-frequency = <3000000>; - arm,primecell-periphid = <0x00241011>; - }; - gpio: gpio { compatible = "brcm,bcm2835-gpio"; reg = <0x7e200000 0xb4>; @@ -91,6 +83,14 @@ #interrupt-cells = <2>; }; + uart@20201000 { + compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell"; + reg = <0x7e201000 0x1000>; + interrupts = <2 25>; + clock-frequency = <3000000>; + arm,primecell-periphid = <0x00241011>; + }; + i2s: i2s@7e203000 { compatible = "brcm,bcm2835-i2s"; reg = <0x7e203000 0x20>, @@ -121,6 +121,14 @@ status = "disabled"; }; + sdhci: sdhci { + compatible = "brcm,bcm2835-sdhci"; + reg = <0x7e300000 0x100>; + interrupts = <2 30>; + clocks = <&clk_mmc>; + status = "disabled"; + }; + i2c1: i2c@20804000 { compatible = "brcm,bcm2835-i2c"; reg = <0x7e804000 0x1000>; @@ -131,14 +139,6 @@ status = "disabled"; }; - sdhci: sdhci { - compatible = "brcm,bcm2835-sdhci"; - reg = <0x7e300000 0x100>; - interrupts = <2 30>; - clocks = <&clk_mmc>; - status = "disabled"; - }; - usb { compatible = "brcm,bcm2835-usb"; reg = <0x7e980000 0x10000>; From 25b2f1bd0b7e060b1671c28be40b63cc9fed2b4e Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Tue, 11 Feb 2014 21:48:47 -0700 Subject: [PATCH 5/6] ARM: bcm2835: node name unit address cleanup DT nodes that contain a reg property should include a unit address in their name. Add the missing unit addresses. The unit address in a node name must match the value in the reg property. Fix the cases where they don't match. Don't fix the /clocks/* node names yet; that causes problems the clock driver to attempt to register multiple clocks with the same name, which fails. Signed-off-by: Stephen Warren --- arch/arm/boot/dts/bcm2835.dtsi | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi index 5ceba45b884a..a2d48893230c 100644 --- a/arch/arm/boot/dts/bcm2835.dtsi +++ b/arch/arm/boot/dts/bcm2835.dtsi @@ -15,7 +15,7 @@ #size-cells = <1>; ranges = <0x7e000000 0x20000000 0x02000000>; - timer { + timer@7e003000 { compatible = "brcm,bcm2835-system-timer"; reg = <0x7e003000 0x1000>; interrupts = <1 0>, <1 1>, <1 2>, <1 3>; @@ -43,24 +43,24 @@ brcm,dma-channel-mask = <0x7f35>; }; - intc: interrupt-controller { + intc: interrupt-controller@7e00b200 { compatible = "brcm,bcm2835-armctrl-ic"; reg = <0x7e00b200 0x200>; interrupt-controller; #interrupt-cells = <2>; }; - watchdog { + watchdog@7e100000 { compatible = "brcm,bcm2835-pm-wdt"; reg = <0x7e100000 0x28>; }; - rng { + rng@7e104000 { compatible = "brcm,bcm2835-rng"; reg = <0x7e104000 0x10>; }; - gpio: gpio { + gpio: gpio@7e200000 { compatible = "brcm,bcm2835-gpio"; reg = <0x7e200000 0xb4>; /* @@ -83,7 +83,7 @@ #interrupt-cells = <2>; }; - uart@20201000 { + uart@7e201000 { compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell"; reg = <0x7e201000 0x1000>; interrupts = <2 25>; @@ -101,7 +101,7 @@ dma-names = "tx", "rx"; }; - spi: spi@20204000 { + spi: spi@7e204000 { compatible = "brcm,bcm2835-spi"; reg = <0x7e204000 0x1000>; interrupts = <2 22>; @@ -121,7 +121,7 @@ status = "disabled"; }; - sdhci: sdhci { + sdhci: sdhci@7e300000 { compatible = "brcm,bcm2835-sdhci"; reg = <0x7e300000 0x100>; interrupts = <2 30>; @@ -129,7 +129,7 @@ status = "disabled"; }; - i2c1: i2c@20804000 { + i2c1: i2c@7e804000 { compatible = "brcm,bcm2835-i2c"; reg = <0x7e804000 0x1000>; interrupts = <2 21>; @@ -139,7 +139,7 @@ status = "disabled"; }; - usb { + usb@7e980000 { compatible = "brcm,bcm2835-usb"; reg = <0x7e980000 0x10000>; interrupts = <1 9>; From b7c6c1760685f7d3a3eecc19f4b792881bf1d907 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Thu, 13 Feb 2014 23:12:39 -0700 Subject: [PATCH 6/6] ARM: bcm2835: fix clock DT node names DT nodes should be named according to the type of object that they represent rather than the identity. DT nodes that contain a reg property should include a unit address in their name. Fix these issues. Add clock-output-names properties to the nodes so that the clocks get named something meaningful. This works around the fact that the fixed clock driver names clocks after the short node name, i.e. not including the unit address. Signed-off-by: Stephen Warren --- arch/arm/boot/dts/bcm2835.dtsi | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi index a2d48893230c..b8473c43e888 100644 --- a/arch/arm/boot/dts/bcm2835.dtsi +++ b/arch/arm/boot/dts/bcm2835.dtsi @@ -155,24 +155,27 @@ #address-cells = <1>; #size-cells = <0>; - clk_mmc: mmc { + clk_mmc: clock@0 { compatible = "fixed-clock"; reg = <0>; #clock-cells = <0>; + clock-output-names = "mmc"; clock-frequency = <100000000>; }; - clk_i2c: i2c { + clk_i2c: clock@1 { compatible = "fixed-clock"; reg = <1>; #clock-cells = <0>; + clock-output-names = "i2c"; clock-frequency = <250000000>; }; - clk_spi: spi { + clk_spi: clock@2 { compatible = "fixed-clock"; reg = <2>; #clock-cells = <0>; + clock-output-names = "spi"; clock-frequency = <250000000>; }; };