diff mbox

[v2,7/9] ARM: bcm2835: Add devicetree for the Raspberry Pi 3.

Message ID 1464934708-24769-8-git-send-email-kraxel@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gerd Hoffmann June 3, 2016, 6:18 a.m. UTC
From: Eric Anholt <eric@anholt.net>

While this devicetree also works for booting in 32-bit mode, it's
placed in arm64 since it's a 64-bit CPU (as suggested by Arnd).

v2: Move to arm64/ instead of arm/

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Stephen Warren <swarren@wwwdotorg.org> (v1)

[ kraxel: update bcm2837-rpi-3-b.dtb path in arm(32) Makefile ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 arch/arm/boot/dts/Makefile                       |  3 +-
 arch/arm64/boot/dts/broadcom/Makefile            |  1 +
 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts | 29 ++++++++++
 arch/arm64/boot/dts/broadcom/bcm2837.dtsi        | 74 ++++++++++++++++++++++++
 4 files changed, 106 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts
 create mode 100644 arch/arm64/boot/dts/broadcom/bcm2837.dtsi

Comments

Arnd Bergmann June 3, 2016, 7:38 a.m. UTC | #1
On Friday, June 3, 2016 8:18:26 AM CEST Gerd Hoffmann wrote:
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index 06b6c2d..71e2d36 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -66,7 +66,8 @@ dtb-$(CONFIG_ARCH_BCM2835) += \
>         bcm2835-rpi-b-rev2.dtb \
>         bcm2835-rpi-b-plus.dtb \
>         bcm2835-rpi-a-plus.dtb \
> -       bcm2836-rpi-2-b.dtb
> +       bcm2836-rpi-2-b.dtb \
> +       ../../../arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dtb
>  dtb-$(CONFIG_ARCH_BCM_5301X) += \
>         bcm4708-asus-rt-ac56u.dtb \
>         bcm4708-asus-rt-ac68u.dtb \

Let's make this hunk a separate patch so we can discuss it on its
own. I'm not really happy about the way it looks (in general, using ../../../
anywhere in the kernel looks hacky.

How about a separate

dtb-$(CONFIG_ARCH_BCM2835) +=
	../../../arm64/boot/dts/broadcom/

so at least we don't have to add each board on its own?

	Arnd
Gerd Hoffmann June 3, 2016, 8:45 a.m. UTC | #2
On Fr, 2016-06-03 at 09:38 +0200, Arnd Bergmann wrote:
> On Friday, June 3, 2016 8:18:26 AM CEST Gerd Hoffmann wrote:
> > diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> > index 06b6c2d..71e2d36 100644
> > --- a/arch/arm/boot/dts/Makefile
> > +++ b/arch/arm/boot/dts/Makefile
> > @@ -66,7 +66,8 @@ dtb-$(CONFIG_ARCH_BCM2835) += \
> >         bcm2835-rpi-b-rev2.dtb \
> >         bcm2835-rpi-b-plus.dtb \
> >         bcm2835-rpi-a-plus.dtb \
> > -       bcm2836-rpi-2-b.dtb
> > +       bcm2836-rpi-2-b.dtb \
> > +       ../../../arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dtb
> >  dtb-$(CONFIG_ARCH_BCM_5301X) += \
> >         bcm4708-asus-rt-ac56u.dtb \
> >         bcm4708-asus-rt-ac68u.dtb \
> 
> Let's make this hunk a separate patch so we can discuss it on its
> own.

Hmm, I through we where in agreement to do it this way ...

> I'm not really happy about the way it looks (in general, using ../../../
> anywhere in the kernel looks hacky.
> 
> How about a separate
> 
> dtb-$(CONFIG_ARCH_BCM2835) +=
> 	../../../arm64/boot/dts/broadcom/

Not working.

Tried "subdir-$(CONFIG_ARCH_BCM) += ...".  Didn't work either.
Same for "dts-dirs += ...".

Running out of ideas.  Guess I have to leave this to someone who knows
kbuild better than me.

cheers,
  Gerd
Arnd Bergmann June 3, 2016, 8:55 a.m. UTC | #3
On Friday, June 3, 2016 10:45:46 AM CEST Gerd Hoffmann wrote:
> On Fr, 2016-06-03 at 09:38 +0200, Arnd Bergmann wrote:
> > On Friday, June 3, 2016 8:18:26 AM CEST Gerd Hoffmann wrote:
> > > diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> > > index 06b6c2d..71e2d36 100644
> > > --- a/arch/arm/boot/dts/Makefile
> > > +++ b/arch/arm/boot/dts/Makefile
> > > @@ -66,7 +66,8 @@ dtb-$(CONFIG_ARCH_BCM2835) += \
> > >         bcm2835-rpi-b-rev2.dtb \
> > >         bcm2835-rpi-b-plus.dtb \
> > >         bcm2835-rpi-a-plus.dtb \
> > > -       bcm2836-rpi-2-b.dtb
> > > +       bcm2836-rpi-2-b.dtb \
> > > +       ../../../arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dtb
> > >  dtb-$(CONFIG_ARCH_BCM_5301X) += \
> > >         bcm4708-asus-rt-ac56u.dtb \
> > >         bcm4708-asus-rt-ac68u.dtb \
> > 
> > Let's make this hunk a separate patch so we can discuss it on its
> > own.
> 
> Hmm, I through we where in agreement to do it this way ...

I think it's ok in principle, this is about the specific syntax.

> > I'm not really happy about the way it looks (in general, using ../../../
> > anywhere in the kernel looks hacky.
> > 
> > How about a separate
> > 
> > dtb-$(CONFIG_ARCH_BCM2835) +=
> >       ../../../arm64/boot/dts/broadcom/
> 
> Not working.
> 
> Tried "subdir-$(CONFIG_ARCH_BCM) += ...".  Didn't work either.
> Same for "dts-dirs += ...".
> 
> Running out of ideas.  Guess I have to leave this to someone who knows
> kbuild better than me.

I tried

subdir-y += ../../../arm64/boot/dts/broadcom

and it seemed to work fine, I got

  DTC     arch/arm/boot/dts/../../../arm64/boot/dts/broadcom/ns2-svk.dtb

in an allmodconfig build, which also includes CONFIG_ARCH_BCM_IPROC.

	Arnd
Stefan Wahren June 3, 2016, 9:04 a.m. UTC | #4
Hi,

Am 03.06.2016 um 08:18 schrieb Gerd Hoffmann:
> From: Eric Anholt <eric@anholt.net>
>
> While this devicetree also works for booting in 32-bit mode, it's
> placed in arm64 since it's a 64-bit CPU (as suggested by Arnd).

i'm currently working on a patch series to fix dtc warnings like

Warning (unit_address_vs_reg): Node /memory has a reg or ranges
property, but no unit name

This a copy of affected parts ( look at memory, soc and local_intc node ).

So how should this be handled?

a) fix the issues here
b) extend my patch series after this patch has been applied

Stefan
Gerd Hoffmann June 3, 2016, 10:39 a.m. UTC | #5
Hi,

> I tried
> 
> subdir-y += ../../../arm64/boot/dts/broadcom

Hmm, works for me too now, probably had a typo somewhere.

But it works for "make dtbs" only, "make dtbs_install" ignores it.

cheers,
  Gerd
Arnd Bergmann June 3, 2016, 11:15 a.m. UTC | #6
On Friday, June 3, 2016 12:39:15 PM CEST Gerd Hoffmann wrote:
>   Hi,
> 
> > I tried
> > 
> > subdir-y += ../../../arm64/boot/dts/broadcom
> 
> Hmm, works for me too now, probably had a typo somewhere.
> 
> But it works for "make dtbs" only, "make dtbs_install" ignores it.

Right: this is no good ;-)

make -f /git/arm-soc/scripts/Makefile.dtbinst obj=arch/arm/boot/dts/../../../arm64/boot/dts/broadcom
  mkdir -p /tmp/boot//dtbs/4.7.0-rc1-00345-gd2a060ee0c24-dirty/../../../arm64/boot/dts/broadcom; cp arch/arm/boot/dts/../../../arm64/boot/dts/broadcom/ns2-svk.dtb /tmp/boot//dtbs/4.7.0-rc1-00345-gd2a060ee0c24-dirty/../../../arm64/boot/dts/broadcom

Maybe we can have a symlink there? I've tried that without success too,
but it shouldn't be that hard to get right.

	Arnd
Rob Herring June 3, 2016, 4:17 p.m. UTC | #7
On Fri, Jun 3, 2016 at 5:39 AM, Gerd Hoffmann <kraxel@redhat.com> wrote:
>   Hi,
>
>> I tried
>>
>> subdir-y += ../../../arm64/boot/dts/broadcom
>
> Hmm, works for me too now, probably had a typo somewhere.

What directory does the dtb end up in? Because as it was, it ended up
in arch/arm64/boot/dts/broadcom. I'm not sure all this hackery is
worth it if the dtb doesn't end up in arch/arm/boot/dts/.

> But it works for "make dtbs" only, "make dtbs_install" ignores it.

That will be fun for users to debug...

Rob
Arnd Bergmann June 4, 2016, 9:39 p.m. UTC | #8
On Friday, June 3, 2016 11:17:51 AM CEST Rob Herring wrote:
> On Fri, Jun 3, 2016 at 5:39 AM, Gerd Hoffmann <kraxel@redhat.com> wrote:
> >   Hi,
> >
> >> I tried
> >>
> >> subdir-y += ../../../arm64/boot/dts/broadcom
> >
> > Hmm, works for me too now, probably had a typo somewhere.
> 
> What directory does the dtb end up in? Because as it was, it ended up
> in arch/arm64/boot/dts/broadcom. I'm not sure all this hackery is
> worth it if the dtb doesn't end up in arch/arm/boot/dts/.

I think having the dtb in $(objdir)arch/arm64/boot/dts/broadcom is fine, however
installing the  'make dtbs_install' rule copy it to
/boot/dts/../../../arm64/boot/dts/broadcom is not.

	Arnd
Gerd Hoffmann June 6, 2016, 7:20 a.m. UTC | #9
On Fr, 2016-06-03 at 11:17 -0500, Rob Herring wrote:
> On Fri, Jun 3, 2016 at 5:39 AM, Gerd Hoffmann <kraxel@redhat.com> wrote:
> >   Hi,
> >
> >> I tried
> >>
> >> subdir-y += ../../../arm64/boot/dts/broadcom
> >
> > Hmm, works for me too now, probably had a typo somewhere.
> 
> What directory does the dtb end up in? Because as it was, it ended up
> in arch/arm64/boot/dts/broadcom. I'm not sure all this hackery is
> worth it if the dtb doesn't end up in arch/arm/boot/dts/.

With the 2/7 patch at the start of this subthread the dtb ends up in
arch/arm64/boot/dts/broadcom for both arm and arm64 builds.

make "dtbs_install" places it in /boot/dtbs/$version/ for arm builds and
in /boot/dtbs/$version/broadcom/ for arm64 builds.

cheers,
  Gerd
Arnd Bergmann June 6, 2016, 7:28 a.m. UTC | #10
On Monday, June 6, 2016 9:20:12 AM CEST Gerd Hoffmann wrote:
> On Fr, 2016-06-03 at 11:17 -0500, Rob Herring wrote:
> > On Fri, Jun 3, 2016 at 5:39 AM, Gerd Hoffmann <kraxel@redhat.com> wrote:
> > >   Hi,
> > >
> > >> I tried
> > >>
> > >> subdir-y += ../../../arm64/boot/dts/broadcom
> > >
> > > Hmm, works for me too now, probably had a typo somewhere.
> > 
> > What directory does the dtb end up in? Because as it was, it ended up
> > in arch/arm64/boot/dts/broadcom. I'm not sure all this hackery is
> > worth it if the dtb doesn't end up in arch/arm/boot/dts/.
> 
> With the 2/7 patch at the start of this subthread the dtb ends up in
> arch/arm64/boot/dts/broadcom for both arm and arm64 builds.
> 
> make "dtbs_install" places it in /boot/dtbs/$version/ for arm builds and
> in /boot/dtbs/$version/broadcom/ for arm64 builds.

Ok, let's stay with that for now then, and solve it better when we
need to do more of the same. Are you aware of any other boards using
bcm2837?

	Arnd
Gerd Hoffmann June 6, 2016, 7:47 a.m. UTC | #11
Hi,

> > With the 2/7 patch at the start of this subthread the dtb ends up in
> > arch/arm64/boot/dts/broadcom for both arm and arm64 builds.
> > 
> > make "dtbs_install" places it in /boot/dtbs/$version/ for arm builds and
> > in /boot/dtbs/$version/broadcom/ for arm64 builds.
> 
> Ok, let's stay with that for now then, and solve it better when we
> need to do more of the same. Are you aware of any other boards using
> bcm2837?

No.

As far I know it has been created specifically for the rpi foundation,
so I expect we might see new members of the rpi family using the bcm2837
too, but probably no other devices.

Maybe Eric Anholt knows more details.

cheers,
  Gerd
diff mbox

Patch

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 06b6c2d..71e2d36 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -66,7 +66,8 @@  dtb-$(CONFIG_ARCH_BCM2835) += \
 	bcm2835-rpi-b-rev2.dtb \
 	bcm2835-rpi-b-plus.dtb \
 	bcm2835-rpi-a-plus.dtb \
-	bcm2836-rpi-2-b.dtb
+	bcm2836-rpi-2-b.dtb \
+	../../../arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dtb
 dtb-$(CONFIG_ARCH_BCM_5301X) += \
 	bcm4708-asus-rt-ac56u.dtb \
 	bcm4708-asus-rt-ac68u.dtb \
diff --git a/arch/arm64/boot/dts/broadcom/Makefile b/arch/arm64/boot/dts/broadcom/Makefile
index bec1f8b..05faf2a 100644
--- a/arch/arm64/boot/dts/broadcom/Makefile
+++ b/arch/arm64/boot/dts/broadcom/Makefile
@@ -1,3 +1,4 @@ 
+dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-3-b.dtb
 dtb-$(CONFIG_ARCH_BCM_IPROC) += ns2-svk.dtb
 dtb-$(CONFIG_ARCH_VULCAN) += vulcan-eval.dtb
 
diff --git a/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts
new file mode 100644
index 0000000..223793d
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts
@@ -0,0 +1,29 @@ 
+/dts-v1/;
+#include "bcm2837.dtsi"
+#include "../../../../arm/boot/dts/bcm2835-rpi.dtsi"
+
+/ {
+	compatible = "raspberrypi,3-model-b", "brcm,bcm2837";
+	model = "Raspberry Pi 3 Model B";
+
+	memory {
+		reg = <0 0x40000000>;
+	};
+
+	leds {
+		act {
+			gpios = <&gpio 47 0>;
+		};
+
+		pwr {
+			label = "PWR";
+			gpios = <&gpio 35 0>;
+			default-state = "keep";
+			linux,default-trigger = "default-on";
+		};
+	};
+};
+
+&uart1 {
+	status = "okay";
+};
diff --git a/arch/arm64/boot/dts/broadcom/bcm2837.dtsi b/arch/arm64/boot/dts/broadcom/bcm2837.dtsi
new file mode 100644
index 0000000..2320f8d
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/bcm2837.dtsi
@@ -0,0 +1,74 @@ 
+#include "../../../../arm/boot/dts/bcm283x.dtsi"
+
+/ {
+	compatible = "brcm,bcm2836";
+
+	soc {
+		ranges = <0x7e000000 0x3f000000 0x1000000>,
+			 <0x40000000 0x40000000 0x00001000>;
+		dma-ranges = <0xc0000000 0x00000000 0x3f000000>;
+
+		local_intc: local_intc {
+			compatible = "brcm,bcm2836-l1-intc";
+			reg = <0x40000000 0x100>;
+			interrupt-controller;
+			#interrupt-cells = <1>;
+			interrupt-parent = <&local_intc>;
+		};
+	};
+
+	timer {
+		compatible = "arm,armv7-timer";
+		interrupt-parent = <&local_intc>;
+		interrupts = <0>, // PHYS_SECURE_PPI
+			     <1>, // PHYS_NONSECURE_PPI
+			     <3>, // VIRT_PPI
+			     <2>; // HYP_PPI
+		always-on;
+	};
+
+	cpus: cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu0: cpu@0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0>;
+		};
+
+		cpu1: cpu@1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <1>;
+			enable-method = "spin-table";
+			cpu-release-addr = <0x0 0x000000e0>;
+		};
+
+		cpu2: cpu@2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <2>;
+			enable-method = "spin-table";
+			cpu-release-addr = <0x0 0x000000e8>;
+		};
+
+		cpu3: cpu@3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <3>;
+			enable-method = "spin-table";
+			cpu-release-addr = <0x0 0x000000f0>;
+		};
+	};
+};
+
+/* Make the BCM2835-style global interrupt controller be a child of the
+ * CPU-local interrupt controller.
+ */
+&intc {
+	compatible = "brcm,bcm2836-armctrl-ic";
+	reg = <0x7e00b200 0x200>;
+	interrupt-parent = <&local_intc>;
+	interrupts = <8>;
+};