2015-12-16 23:55:22

by Eric Anholt

[permalink] [raw]
Subject: [PATCH v2 0/8] Raspberry Pi 2 support.

This is a major rewrite of the previous Raspberry Pi 2 submission.
SMP support is now included, and the DT includes are cleaned up to
avoid massive duplication.

The branch (based on 4.4-rc5, to get the USB regression fixes) can be
found at:

https://github.com/anholt/linux/tree/bcm2836-4.4

Andrea Merello (1):
irq: bcm2836: Add SMP support for the 2836

Eric Anholt (7):
irq: bcm2836: Fix initialization of the LOCAL_IRQ_CNT*IRQ timers
dt-bindings: Add root properties for Raspberry Pi 2
ARM: bcm2835: Split the DT for peripherals from the DT for the CPU
ARM: bcm2835: Move the CPU/peripheral include out of common RPi DT.
ARM: bcm2835: Add devicetree for bcm2836 and Raspberry Pi 2 B
ARM: bcm2835: Add a compat string for bcm2836 machine probe
ARM: bcm2835: Add Kconfig support for bcm2836

.../devicetree/bindings/arm/bcm/brcm,bcm2835.txt | 4 +
arch/arm/Kconfig.debug | 10 +-
arch/arm/boot/dts/Makefile | 3 +-
arch/arm/boot/dts/bcm2835-rpi-a-plus.dts | 1 +
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 1 +
arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 1 +
arch/arm/boot/dts/bcm2835-rpi-b.dts | 1 +
arch/arm/boot/dts/bcm2835-rpi.dtsi | 2 -
arch/arm/boot/dts/bcm2835.dtsi | 194 +--------------------
...{bcm2835-rpi-b-plus.dts => bcm2836-rpi-2-b.dts} | 9 +-
arch/arm/boot/dts/bcm2836.dtsi | 77 ++++++++
arch/arm/boot/dts/{bcm2835.dtsi => bcm283x.dtsi} | 7 +-
arch/arm/mach-bcm/Kconfig | 8 +-
arch/arm/mach-bcm/board_bcm2835.c | 5 +
drivers/irqchip/irq-bcm2836.c | 53 +++++-
15 files changed, 168 insertions(+), 208 deletions(-)
copy arch/arm/boot/dts/{bcm2835-rpi-b-plus.dts => bcm2836-rpi-2-b.dts} (72%)
create mode 100644 arch/arm/boot/dts/bcm2836.dtsi
copy arch/arm/boot/dts/{bcm2835.dtsi => bcm283x.dtsi} (96%)

--
2.6.2


2015-12-16 23:55:24

by Eric Anholt

[permalink] [raw]
Subject: [PATCH v2 1/8] irq: bcm2836: Fix initialization of the LOCAL_IRQ_CNT*IRQ timers

The irqchip's register area includes the the setup for the timer's
scaling factors, and for the platform we want a fixed configuration of
these registers.

Signed-off-by: Eric Anholt <[email protected]>
---
drivers/irqchip/irq-bcm2836.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c
index f687082..6ec125e 100644
--- a/drivers/irqchip/irq-bcm2836.c
+++ b/drivers/irqchip/irq-bcm2836.c
@@ -21,6 +21,9 @@
#include <linux/irqdomain.h>
#include <asm/exception.h>

+#define LOCAL_CONTROL 0x000
+#define LOCAL_PRESCALER 0x008
+
/*
* The low 2 bits identify the CPU that the GPU IRQ goes to, and the
* next 2 bits identify the CPU that the GPU FIQ goes to.
@@ -237,6 +240,27 @@ bcm2836_arm_irqchip_smp_init(void)
#endif
}

+/*
+ * The LOCAL_IRQ_CNT* timer firings are based off of the external
+ * oscillator with some scaling. The firmware sets up CNTFRQ to
+ * report 19.2Mhz, but doesn't set up the scaling registers.
+ */
+static void bcm2835_init_local_timer_frequency(void)
+{
+ /*
+ * Set the timer to source from the 19.2Mhz crystal clock (bit
+ * 8 unset), and only increment by 1 instead of 2 (bit 9
+ * unset).
+ */
+ writel(0, intc.base + LOCAL_CONTROL);
+
+ /*
+ * Set the timer prescaler to 1:1 (timer freq = input freq *
+ * 2**31 / prescaler)
+ */
+ writel(0x80000000, intc.base + LOCAL_PRESCALER);
+}
+
static int __init bcm2836_arm_irqchip_l1_intc_of_init(struct device_node *node,
struct device_node *parent)
{
@@ -246,6 +270,8 @@ static int __init bcm2836_arm_irqchip_l1_intc_of_init(struct device_node *node,
node->full_name);
}

+ bcm2835_init_local_timer_frequency();
+
intc.domain = irq_domain_add_linear(node, LAST_IRQ + 1,
&bcm2836_arm_irqchip_intc_ops,
NULL);
--
2.6.2

2015-12-16 23:55:20

by Eric Anholt

[permalink] [raw]
Subject: [PATCH v2 2/8] irq: bcm2836: Add SMP support for the 2836

From: Andrea Merello <[email protected]>

The firmware sets the secondaries spinning waiting for a non-NULL
value to show up in the last IPI mailbox.

The original SMP port from the downstream tree was done by Andrea, and
Eric cleaned it up/rewrote it a few times from there.

Signed-off-by: Andrea Merello <[email protected]>
Signed-off-by: Eric Anholt <[email protected]>
---
drivers/irqchip/irq-bcm2836.c | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c
index 6ec125e..c5ef4df 100644
--- a/drivers/irqchip/irq-bcm2836.c
+++ b/drivers/irqchip/irq-bcm2836.c
@@ -53,14 +53,16 @@
/* Same status bits as above, but for FIQ. */
#define LOCAL_FIQ_PENDING0 0x070
/*
- * Mailbox0 write-to-set bits. There are 16 mailboxes, 4 per CPU, and
+ * Mailbox write-to-set bits. There are 16 mailboxes, 4 per CPU, and
* these bits are organized by mailbox number and then CPU number. We
* use mailbox 0 for IPIs. The mailbox's interrupt is raised while
* any bit is set.
*/
#define LOCAL_MAILBOX0_SET0 0x080
-/* Mailbox0 write-to-clear bits. */
+#define LOCAL_MAILBOX3_SET0 0x08c
+/* Mailbox write-to-clear bits. */
#define LOCAL_MAILBOX0_CLR0 0x0c0
+#define LOCAL_MAILBOX3_CLR0 0x0cc

#define LOCAL_IRQ_CNTPSIRQ 0
#define LOCAL_IRQ_CNTPNSIRQ 1
@@ -226,6 +228,26 @@ static const struct irq_domain_ops bcm2836_arm_irqchip_intc_ops = {
.xlate = irq_domain_xlate_onecell
};

+#ifdef CONFIG_SMP
+int __init bcm2836_smp_boot_secondary(unsigned int cpu,
+ struct task_struct *idle)
+{
+ unsigned long secondary_startup_phys =
+ (unsigned long)virt_to_phys((void *)secondary_startup);
+
+ dsb();
+ writel(secondary_startup_phys,
+ intc.base + LOCAL_MAILBOX3_SET0 + 16 * cpu);
+
+ return 0;
+}
+
+static const struct smp_operations bcm2836_smp_ops __initconst = {
+ .smp_boot_secondary = bcm2836_smp_boot_secondary,
+};
+
+#endif
+
static void
bcm2836_arm_irqchip_smp_init(void)
{
@@ -237,6 +259,7 @@ bcm2836_arm_irqchip_smp_init(void)
register_cpu_notifier(&bcm2836_arm_irqchip_cpu_notifier);

set_smp_cross_call(bcm2836_arm_irqchip_send_ipi);
+ smp_set_ops(&bcm2836_smp_ops);
#endif
}

--
2.6.2

2015-12-16 23:56:13

by Eric Anholt

[permalink] [raw]
Subject: [PATCH v2 3/8] dt-bindings: Add root properties for Raspberry Pi 2

Signed-off-by: Eric Anholt <[email protected]>
---
Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt b/Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt
index c78576b..11d3056 100644
--- a/Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt
+++ b/Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt
@@ -26,6 +26,10 @@ Raspberry Pi Model B+
Required root node properties:
compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";

+Raspberry Pi 2 Model B
+Required root node properties:
+compatible = "raspberrypi,2-model-b", "brcm,bcm2836";
+
Raspberry Pi Compute Module
Required root node properties:
compatible = "raspberrypi,compute-module", "brcm,bcm2835";
--
2.6.2

2015-12-16 23:56:17

by Eric Anholt

[permalink] [raw]
Subject: [PATCH v2 4/8] ARM: bcm2835: Split the DT for peripherals from the DT for the CPU

The set of peripherals remained constant across bcm2835 (Raspberry Pi
1) and bcm2836 (Raspberry Pi 2), but the CPU was swapped out. Split
the files so that we can include just peripheral setup in 2836.

Signed-off-by: Eric Anholt <[email protected]>
---
arch/arm/boot/dts/bcm2835.dtsi | 194 +----------------------
arch/arm/boot/dts/{bcm2835.dtsi => bcm283x.dtsi} | 7 +-
2 files changed, 6 insertions(+), 195 deletions(-)
copy arch/arm/boot/dts/{bcm2835.dtsi => bcm283x.dtsi} (96%)

diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
index aef64de..b83b326 100644
--- a/arch/arm/boot/dts/bcm2835.dtsi
+++ b/arch/arm/boot/dts/bcm2835.dtsi
@@ -1,206 +1,14 @@
-#include <dt-bindings/pinctrl/bcm2835.h>
-#include <dt-bindings/clock/bcm2835.h>
-#include "skeleton.dtsi"
+#include "bcm283x.dtsi"

/ {
compatible = "brcm,bcm2835";
- model = "BCM2835";
- interrupt-parent = <&intc>;
-
- chosen {
- bootargs = "earlyprintk console=ttyAMA0";
- };

soc {
- compatible = "simple-bus";
- #address-cells = <1>;
- #size-cells = <1>;
ranges = <0x7e000000 0x20000000 0x02000000>;
dma-ranges = <0x40000000 0x00000000 0x20000000>;

- timer@7e003000 {
- compatible = "brcm,bcm2835-system-timer";
- reg = <0x7e003000 0x1000>;
- interrupts = <1 0>, <1 1>, <1 2>, <1 3>;
- /* This could be a reference to BCM2835_CLOCK_TIMER,
- * but we don't have the driver using the common clock
- * support yet.
- */
- 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@7e00b200 {
- compatible = "brcm,bcm2835-armctrl-ic";
- reg = <0x7e00b200 0x200>;
- interrupt-controller;
- #interrupt-cells = <2>;
- };
-
- watchdog@7e100000 {
- compatible = "brcm,bcm2835-pm-wdt";
- reg = <0x7e100000 0x28>;
- };
-
- clocks: cprman@7e101000 {
- compatible = "brcm,bcm2835-cprman";
- #clock-cells = <1>;
- reg = <0x7e101000 0x2000>;
-
- /* CPRMAN derives everything from the platform's
- * oscillator.
- */
- clocks = <&clk_osc>;
- };
-
- rng@7e104000 {
- compatible = "brcm,bcm2835-rng";
- reg = <0x7e104000 0x10>;
- };
-
- mailbox: mailbox@7e00b800 {
- compatible = "brcm,bcm2835-mbox";
- reg = <0x7e00b880 0x40>;
- interrupts = <0 1>;
- #mbox-cells = <0>;
- };
-
- gpio: gpio@7e200000 {
- compatible = "brcm,bcm2835-gpio";
- reg = <0x7e200000 0xb4>;
- /*
- * The GPIO IP block is designed for 3 banks of GPIOs.
- * Each bank has a GPIO interrupt for itself.
- * There is an overall "any bank" interrupt.
- * In order, these are GIC interrupts 17, 18, 19, 20.
- * Since the BCM2835 only has 2 banks, the 2nd bank
- * interrupt output appears to be mirrored onto the
- * 3rd bank's interrupt signal.
- * So, a bank0 interrupt shows up on 17, 20, and
- * a bank1 interrupt shows up on 18, 19, 20!
- */
- interrupts = <2 17>, <2 18>, <2 19>, <2 20>;
-
- gpio-controller;
- #gpio-cells = <2>;
-
- interrupt-controller;
- #interrupt-cells = <2>;
- };
-
- uart0: uart@7e201000 {
- compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell";
- reg = <0x7e201000 0x1000>;
- interrupts = <2 25>;
- clocks = <&clocks BCM2835_CLOCK_UART>,
- <&clocks BCM2835_CLOCK_VPU>;
- clock-names = "uartclk", "apb_pclk";
- arm,primecell-periphid = <0x00241011>;
- };
-
- i2s: i2s@7e203000 {
- compatible = "brcm,bcm2835-i2s";
- reg = <0x7e203000 0x20>,
- <0x7e101098 0x02>;
-
- dmas = <&dma 2>,
- <&dma 3>;
- dma-names = "tx", "rx";
- status = "disabled";
- };
-
- spi: spi@7e204000 {
- compatible = "brcm,bcm2835-spi";
- reg = <0x7e204000 0x1000>;
- interrupts = <2 22>;
- clocks = <&clocks BCM2835_CLOCK_VPU>;
- #address-cells = <1>;
- #size-cells = <0>;
- status = "disabled";
- };
-
- i2c0: i2c@7e205000 {
- compatible = "brcm,bcm2835-i2c";
- reg = <0x7e205000 0x1000>;
- interrupts = <2 21>;
- clocks = <&clocks BCM2835_CLOCK_VPU>;
- #address-cells = <1>;
- #size-cells = <0>;
- status = "disabled";
- };
-
- sdhci: sdhci@7e300000 {
- compatible = "brcm,bcm2835-sdhci";
- reg = <0x7e300000 0x100>;
- interrupts = <2 30>;
- clocks = <&clocks BCM2835_CLOCK_EMMC>;
- status = "disabled";
- };
-
- i2c1: i2c@7e804000 {
- compatible = "brcm,bcm2835-i2c";
- reg = <0x7e804000 0x1000>;
- interrupts = <2 21>;
- clocks = <&clocks BCM2835_CLOCK_VPU>;
- #address-cells = <1>;
- #size-cells = <0>;
- status = "disabled";
- };
-
- i2c2: i2c@7e805000 {
- compatible = "brcm,bcm2835-i2c";
- reg = <0x7e805000 0x1000>;
- interrupts = <2 21>;
- clocks = <&clocks BCM2835_CLOCK_VPU>;
- #address-cells = <1>;
- #size-cells = <0>;
- status = "disabled";
- };
-
- usb@7e980000 {
- compatible = "brcm,bcm2835-usb";
- reg = <0x7e980000 0x10000>;
- interrupts = <1 9>;
- };
-
arm-pmu {
compatible = "arm,arm1176-pmu";
};
};
-
- clocks {
- compatible = "simple-bus";
- #address-cells = <1>;
- #size-cells = <0>;
-
- /* The oscillator is the root of the clock tree. */
- clk_osc: clock@3 {
- compatible = "fixed-clock";
- reg = <3>;
- #clock-cells = <0>;
- clock-output-names = "osc";
- clock-frequency = <19200000>;
- };
-
- };
};
diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm283x.dtsi
similarity index 96%
copy from arch/arm/boot/dts/bcm2835.dtsi
copy to arch/arm/boot/dts/bcm283x.dtsi
index aef64de..bf74e8a 100644
--- a/arch/arm/boot/dts/bcm2835.dtsi
+++ b/arch/arm/boot/dts/bcm283x.dtsi
@@ -2,6 +2,11 @@
#include <dt-bindings/clock/bcm2835.h>
#include "skeleton.dtsi"

+/* This include file covers the common peripherals and configuration between
+ * bcm2835 and bcm2836 implementations, leaving the CPU configuration to
+ * bcm2835.dtsi and bcm2836.dtsi.
+ */
+
/ {
compatible = "brcm,bcm2835";
model = "BCM2835";
@@ -15,8 +20,6 @@
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <1>;
- ranges = <0x7e000000 0x20000000 0x02000000>;
- dma-ranges = <0x40000000 0x00000000 0x20000000>;

timer@7e003000 {
compatible = "brcm,bcm2835-system-timer";
--
2.6.2

2015-12-16 23:56:15

by Eric Anholt

[permalink] [raw]
Subject: [PATCH v2 5/8] ARM: bcm2835: Move the CPU/peripheral include out of common RPi DT.

For Raspberry Pi 2, we want to use the same general pin assignment
bits, but need to use bcm2836.dtsi for the CPU instead.

Signed-off-by: Eric Anholt <[email protected]>
---
arch/arm/boot/dts/bcm2835-rpi-a-plus.dts | 1 +
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 1 +
arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 1 +
arch/arm/boot/dts/bcm2835-rpi-b.dts | 1 +
arch/arm/boot/dts/bcm2835-rpi.dtsi | 2 --
5 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
index b2bff43..228614f 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
@@ -1,4 +1,5 @@
/dts-v1/;
+#include "bcm2835.dtsi"
#include "bcm2835-rpi.dtsi"

/ {
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
index 668442b..ef54050 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
@@ -1,4 +1,5 @@
/dts-v1/;
+#include "bcm2835.dtsi"
#include "bcm2835-rpi.dtsi"

/ {
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
index eab8b591..86f1f2f 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
@@ -1,4 +1,5 @@
/dts-v1/;
+#include "bcm2835.dtsi"
#include "bcm2835-rpi.dtsi"

/ {
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts
index ff6b2d1..4859e9d 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts
@@ -1,4 +1,5 @@
/dts-v1/;
+#include "bcm2835.dtsi"
#include "bcm2835-rpi.dtsi"

/ {
diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi
index 3572f03..3afb9fe 100644
--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi
+++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi
@@ -1,5 +1,3 @@
-#include "bcm2835.dtsi"
-
/ {
memory {
reg = <0 0x10000000>;
--
2.6.2

2015-12-16 23:56:08

by Eric Anholt

[permalink] [raw]
Subject: [PATCH v2 6/8] ARM: bcm2835: Add devicetree for bcm2836 and Raspberry Pi 2 B

The Pi 2 B ends up like a Pi 1 B+, with the same peripherals and
pinout, but the CPU and memory layout changed to use the 2836.

Signed-off-by: Eric Anholt <[email protected]>
---
arch/arm/boot/dts/bcm2836-rpi-2-b.dts | 35 ++++++++++++++++
arch/arm/boot/dts/bcm2836.dtsi | 77 +++++++++++++++++++++++++++++++++++
2 files changed, 112 insertions(+)
create mode 100644 arch/arm/boot/dts/bcm2836-rpi-2-b.dts
create mode 100644 arch/arm/boot/dts/bcm2836.dtsi

diff --git a/arch/arm/boot/dts/bcm2836-rpi-2-b.dts b/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
new file mode 100644
index 0000000..ff94666
--- /dev/null
+++ b/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
@@ -0,0 +1,35 @@
+/dts-v1/;
+#include "bcm2836.dtsi"
+#include "bcm2835-rpi.dtsi"
+
+/ {
+ compatible = "raspberrypi,2-model-b", "brcm,bcm2836";
+ model = "Raspberry Pi 2 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";
+ };
+ };
+};
+
+&gpio {
+ pinctrl-0 = <&gpioout &alt0 &i2s_alt0 &alt3>;
+
+ /* I2S interface */
+ i2s_alt0: i2s_alt0 {
+ brcm,pins = <18 19 20 21>;
+ brcm,function = <BCM2835_FSEL_ALT0>;
+ };
+};
diff --git a/arch/arm/boot/dts/bcm2836.dtsi b/arch/arm/boot/dts/bcm2836.dtsi
new file mode 100644
index 0000000..6693118
--- /dev/null
+++ b/arch/arm/boot/dts/bcm2836.dtsi
@@ -0,0 +1,77 @@
+#include "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>;
+ };
+
+ arm-pmu {
+ compatible = "arm,cortex-a7-pmu";
+ interrupt-parent = <&local_intc>;
+ interrupts = <9>;
+ };
+ };
+
+ 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>;
+
+ v7_cpu0: cpu@0 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a7";
+ reg = <0xf00>;
+ clock-frequency = <800000000>;
+ };
+
+ v7_cpu1: cpu@1 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a7";
+ reg = <0xf01>;
+ clock-frequency = <800000000>;
+ };
+
+ v7_cpu2: cpu@2 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a7";
+ reg = <0xf02>;
+ clock-frequency = <800000000>;
+ };
+
+ v7_cpu3: cpu@3 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a7";
+ reg = <0xf03>;
+ clock-frequency = <800000000>;
+ };
+ };
+};
+
+/* Make the BCM2835-style global interrupt controller be a child of the
+ * CPU-local interrupt controller.
+ */
+&intc {
+ compatible = "brcm,bcm2836-armctrl-ic";
+ interrupt-parent = <&local_intc>;
+ interrupts = <8>;
+};
--
2.6.2

2015-12-16 23:56:10

by Eric Anholt

[permalink] [raw]
Subject: [PATCH v2 7/8] ARM: bcm2835: Add a compat string for bcm2836 machine probe

Supporting the 2836 requires using the new interrupt controller, which
we have support for.

Signed-off-by: Eric Anholt <[email protected]>
---
arch/arm/mach-bcm/board_bcm2835.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c
index 0f7b9ea..834d676 100644
--- a/arch/arm/mach-bcm/board_bcm2835.c
+++ b/arch/arm/mach-bcm/board_bcm2835.c
@@ -36,7 +36,12 @@ static void __init bcm2835_init(void)
}

static const char * const bcm2835_compat[] = {
+#ifdef CONFIG_ARCH_MULTI_V6
"brcm,bcm2835",
+#endif
+#ifdef CONFIG_ARCH_MULTI_V7
+ "brcm,bcm2836",
+#endif
NULL
};

--
2.6.2

2015-12-16 23:56:12

by Eric Anholt

[permalink] [raw]
Subject: [PATCH v2 8/8] ARM: bcm2835: Add Kconfig support for bcm2836

This should be a complete port of bcm2835 functionality to bcm2836
(Raspberry Pi 2).

Signed-off-by: Eric Anholt <[email protected]>
---

v2: Implement Arnd's feedback to not split to ARCH_BCM2836, and
instead use more conditionals in ARCH_BCM2835. Also reduce diff
between 2835 and 2836.

arch/arm/Kconfig.debug | 10 ++++++++--
arch/arm/boot/dts/Makefile | 3 ++-
arch/arm/mach-bcm/Kconfig | 8 ++++----
3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 259c0ca..957b876 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -143,7 +143,12 @@ choice

config DEBUG_BCM2835
bool "Kernel low-level debugging on BCM2835 PL011 UART"
- depends on ARCH_BCM2835
+ depends on ARCH_BCM2835 && ARCH_MULTI_V6
+ select DEBUG_UART_PL01X
+
+ config DEBUG_BCM2836
+ bool "Kernel low-level debugging on BCM2836 PL011 UART"
+ depends on ARCH_BCM2835 && ARCH_MULTI_V7
select DEBUG_UART_PL01X

config DEBUG_BCM_5301X
@@ -1402,6 +1407,7 @@ config DEBUG_UART_PHYS
default 0x20064000 if DEBUG_RK29_UART1 || DEBUG_RK3X_UART2
default 0x20068000 if DEBUG_RK29_UART2 || DEBUG_RK3X_UART3
default 0x20201000 if DEBUG_BCM2835
+ default 0x3f201000 if DEBUG_BCM2836
default 0x3e000000 if DEBUG_BCM_KONA_UART
default 0x4000e400 if DEBUG_LL_UART_EFM32
default 0x40081000 if DEBUG_LPC18XX_UART0
@@ -1485,7 +1491,7 @@ config DEBUG_UART_VIRT
default 0xf0000be0 if ARCH_EBSA110
default 0xf0010000 if DEBUG_ASM9260_UART
default 0xf01fb000 if DEBUG_NOMADIK_UART
- default 0xf0201000 if DEBUG_BCM2835
+ default 0xf0201000 if DEBUG_BCM2835 || DEBUG_BCM2836
default 0xf1000300 if DEBUG_BCM_5301X
default 0xf1002000 if DEBUG_MT8127_UART0
default 0xf1006000 if DEBUG_MT6589_UART0
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 30bbc37..54e8f6b 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -60,7 +60,8 @@ dtb-$(CONFIG_ARCH_BCM2835) += \
bcm2835-rpi-b.dtb \
bcm2835-rpi-b-rev2.dtb \
bcm2835-rpi-b-plus.dtb \
- bcm2835-rpi-a-plus.dtb
+ bcm2835-rpi-a-plus.dtb \
+ bcm2836-rpi-2-b.dtb
dtb-$(CONFIG_ARCH_BCM_5301X) += \
bcm4708-asus-rt-ac56u.dtb \
bcm4708-asus-rt-ac68u.dtb \
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index 8c53c55..d7cada9 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -122,17 +122,17 @@ config ARCH_BCM_MOBILE_SMP
comment "Other Architectures"

config ARCH_BCM2835
- bool "Broadcom BCM2835 family" if ARCH_MULTI_V6
+ bool "Broadcom BCM2835 family" if ARCH_MULTI_V6 || ARCH_MULTI_V7
select ARCH_REQUIRE_GPIOLIB
select ARM_AMBA
- select ARM_ERRATA_411920
+ select ARM_ERRATA_411920 if ARCH_MULTI_V6
select ARM_TIMER_SP804
select CLKSRC_OF
select PINCTRL
select PINCTRL_BCM2835
help
- This enables support for the Broadcom BCM2835 SoC. This SoC is
- used in the Raspberry Pi and Roku 2 devices.
+ This enables support for the Broadcom BCM2835 and BCM2836 SoCs.
+ This SoC is used in the Raspberry Pi and Roku 2 devices.

config ARCH_BCM_63XX
bool "Broadcom BCM63xx DSL SoC" if ARCH_MULTI_V7
--
2.6.2

2015-12-17 00:04:57

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] Raspberry Pi 2 support.

On Wednesday 16 December 2015 15:55:07 Eric Anholt wrote:
> This is a major rewrite of the previous Raspberry Pi 2 submission.
> SMP support is now included, and the DT includes are cleaned up to
> avoid massive duplication.
>
> The branch (based on 4.4-rc5, to get the USB regression fixes) can be
> found at:
>
> https://github.com/anholt/linux/tree/bcm2836-4.4

Looks all good to me, but when we get the pull request, I'd strongly
prefer to have that based on -rc3 or earlier.

What commit is the USB regression fix you refer to above? Is that in a
branch that is -rc3 based? Maybe you can rebase the changes on top
of that branch, to minimize the amount of backmerges?

Arnd

2015-12-17 00:37:47

by Eric Anholt

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] Raspberry Pi 2 support.

Arnd Bergmann <[email protected]> writes:

> On Wednesday 16 December 2015 15:55:07 Eric Anholt wrote:
>> This is a major rewrite of the previous Raspberry Pi 2 submission.
>> SMP support is now included, and the DT includes are cleaned up to
>> avoid massive duplication.
>>
>> The branch (based on 4.4-rc5, to get the USB regression fixes) can be
>> found at:
>>
>> https://github.com/anholt/linux/tree/bcm2836-4.4
>
> Looks all good to me, but when we get the pull request, I'd strongly
> prefer to have that based on -rc3 or earlier.
>
> What commit is the USB regression fix you refer to above? Is that in a
> branch that is -rc3 based? Maybe you can rebase the changes on top
> of that branch, to minimize the amount of backmerges?

Top 4 commits of drivers/usb/dwc2 for 4.4-rc5 (possibly not all of them
are required, but it's what I've been using). I've been using
cherry-picks of them on top of my various branches for testing, but pi2
was going to be rebased so many times in the process of cleanup that I
put it underneath my development branch instead.

I've been doing pull requests for my stuff on -rc1 tags. It sucks for
bisecting any breakage I produce when I can't boot that directly, but I
don't see a good way to avoid this kind of pain other than getting some
Pis into kernel-ci.org so we can catch regressions earlier.


Attachments:
signature.asc (818.00 B)

2015-12-17 05:26:28

by Baruch Siach

[permalink] [raw]
Subject: Re: [PATCH v2 2/8] irq: bcm2836: Add SMP support for the 2836

Hi Eric,

On Wed, Dec 16, 2015 at 03:55:09PM -0800, Eric Anholt wrote:
> @@ -226,6 +228,26 @@ static const struct irq_domain_ops bcm2836_arm_irqchip_intc_ops = {
> .xlate = irq_domain_xlate_onecell
> };
>
> +#ifdef CONFIG_SMP

Why not put this section under the existing '#ifdef CONFIG_SMP' just a few
lines above?

> +int __init bcm2836_smp_boot_secondary(unsigned int cpu,
> + struct task_struct *idle)
> +{
> + unsigned long secondary_startup_phys =
> + (unsigned long)virt_to_phys((void *)secondary_startup);
> +
> + dsb();
> + writel(secondary_startup_phys,
> + intc.base + LOCAL_MAILBOX3_SET0 + 16 * cpu);
> +
> + return 0;
> +}
> +
> +static const struct smp_operations bcm2836_smp_ops __initconst = {
> + .smp_boot_secondary = bcm2836_smp_boot_secondary,
> +};
> +
> +#endif

baruch

--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- [email protected] - tel: +972.2.679.5364, http://www.tkos.co.il -

2015-12-17 08:50:08

by Stefan Wahren

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] Raspberry Pi 2 support.

Am 17.12.2015 um 01:37 schrieb Eric Anholt:
> Arnd Bergmann <[email protected]> writes:
>
>> On Wednesday 16 December 2015 15:55:07 Eric Anholt wrote:
>>> This is a major rewrite of the previous Raspberry Pi 2 submission.
>>> SMP support is now included, and the DT includes are cleaned up to
>>> avoid massive duplication.
>>>
>>> The branch (based on 4.4-rc5, to get the USB regression fixes) can be
>>> found at:
>>>
>>> https://github.com/anholt/linux/tree/bcm2836-4.4
>> Looks all good to me, but when we get the pull request, I'd strongly
>> prefer to have that based on -rc3 or earlier.
>>
>> What commit is the USB regression fix you refer to above? Is that in a
>> branch that is -rc3 based? Maybe you can rebase the changes on top
>> of that branch, to minimize the amount of backmerges?
> Top 4 commits of drivers/usb/dwc2 for 4.4-rc5 (possibly not all of them
> are required, but it's what I've been using).
>

Unfortunately all 4 of them are required:

d0464bcf12af ("usb: dwc2: Make PHY optional")

6c2dad69163f ("usb: dwc2: Return errors from PHY")

8aa90cf2a286 ("usb: dwc2: make otg clk optional")

f74875dc3613 ("usb: dwc2: fix kernel oops during driver probe")

But they should apply to -rc3 too.

Stefan

2015-12-17 10:27:39

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] Raspberry Pi 2 support.

On Thursday 17 December 2015 09:48:57 Stefan Wahren wrote:
> Am 17.12.2015 um 01:37 schrieb Eric Anholt:
> > Arnd Bergmann <[email protected]> writes:
> >
> >> On Wednesday 16 December 2015 15:55:07 Eric Anholt wrote:
> >>> This is a major rewrite of the previous Raspberry Pi 2 submission.
> >>> SMP support is now included, and the DT includes are cleaned up to
> >>> avoid massive duplication.
> >>>
> >>> The branch (based on 4.4-rc5, to get the USB regression fixes) can be
> >>> found at:
> >>>
> >>> https://github.com/anholt/linux/tree/bcm2836-4.4
> >> Looks all good to me, but when we get the pull request, I'd strongly
> >> prefer to have that based on -rc3 or earlier.
> >>
> >> What commit is the USB regression fix you refer to above? Is that in a
> >> branch that is -rc3 based? Maybe you can rebase the changes on top
> >> of that branch, to minimize the amount of backmerges?
> > Top 4 commits of drivers/usb/dwc2 for 4.4-rc5 (possibly not all of them
> > are required, but it's what I've been using).
> >
>
> Unfortunately all 4 of them are required:
>
> d0464bcf12af ("usb: dwc2: Make PHY optional")
>
> 6c2dad69163f ("usb: dwc2: Return errors from PHY")
>
> 8aa90cf2a286 ("usb: dwc2: make otg clk optional")
>
> f74875dc3613 ("usb: dwc2: fix kernel oops during driver probe")

Ok, that's good. They are all based on -rc1, so you you can just rebase
on top of f74875dc3613, which was pulled by GregKH.

> But they should apply to -rc3 too.

Please don't rebase them, use the commits that got merged, otherwise we'd
get duplicate commits and that would be worse than the backmerge.

Arnd

2015-12-18 10:00:57

by Alexander Aring

[permalink] [raw]
Subject: Re: [PATCH v2 4/8] ARM: bcm2835: Split the DT for peripherals from the DT for the CPU

Hi Eric,

On Wed, Dec 16, 2015 at 03:55:11PM -0800, Eric Anholt wrote:
> The set of peripherals remained constant across bcm2835 (Raspberry Pi
> 1) and bcm2836 (Raspberry Pi 2), but the CPU was swapped out. Split
> the files so that we can include just peripheral setup in 2836.
>
> Signed-off-by: Eric Anholt <[email protected]>
> ---
> -
> arm-pmu {
> compatible = "arm,arm1176-pmu";
> };
> };

This is bcm2835 related only? It's still inside bcm283x.dtsi, see [0].
The rename here makes it a little hard to review.

I suppose it should be removed from [0].

- Alex

[0] https://github.com/anholt/linux/blob/bcm2836-4.4/arch/arm/boot/dts/bcm283x.dtsi#L189

2015-12-18 10:08:41

by Alexander Aring

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] Raspberry Pi 2 support.

Hi Eric,

On Wed, Dec 16, 2015 at 03:55:07PM -0800, Eric Anholt wrote:
> This is a major rewrite of the previous Raspberry Pi 2 submission.
> SMP support is now included, and the DT includes are cleaned up to
> avoid massive duplication.
>
> The branch (based on 4.4-rc5, to get the USB regression fixes) can be
> found at:
>
> https://github.com/anholt/linux/tree/bcm2836-4.4
>

thanks. :-)

I tried it via booting with the RPi firmware and your branch, but it
doesn't boot on my side:

I get:

Uncompressing Linux... done, booting the kernel.
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 4.4.0-rc5+ (alex@omega) (gcc version 4.9.2 (OSELAS.Toolchain-2014.12.1) ) #989 Fri Dec 18 10:54:40 CET 2015
[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c53c7d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine model: Raspberry Pi 2 Model B Rev 1.1
[ 0.000000] bootconsole [earlycon0] enabled
[ 0.000000] Truncating RAM at 0x00000000-0x3e000000 to -0x30000000
[ 0.000000] Consider using a HIGHMEM enabled kernel.
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] BUG: mapping for 0x3f201000 at 0xf0201000 out of vmalloc space
[ 0.000000] ------------[ cut here ]------------
[ 0.000000] WARNING: CPU: 0 PID: 0 at arch/arm/kernel/devtree.c:149 arm_dt_init_cpu_maps+0x100/0x1a4()
[ 0.000000] DT /cpu 2 nodes greater than max cores 1, capping them
[ 0.000000] Modules linked in:
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.4.0-rc5+ #989
[ 0.000000] Hardware name: BCM2835
[ 0.000000] [<c0016c4c>] (unwind_backtrace) from [<c0013e58>] (show_stack+0x20/0x24)
[ 0.000000] [<c0013e58>] (show_stack) from [<c0247620>] (dump_stack+0x20/0x28)
[ 0.000000] [<c0247620>] (dump_stack) from [<c0023a84>] (warn_slowpath_common+0x9c/0xc4)
[ 0.000000] [<c0023a84>] (warn_slowpath_common) from [<c0023aec>] (warn_slowpath_fmt+0x40/0x48)
[ 0.000000] [<c0023aec>] (warn_slowpath_fmt) from [<c074ef94>] (arm_dt_init_cpu_maps+0x100/0x1a4)
[ 0.000000] [<c074ef94>] (arm_dt_init_cpu_maps) from [<c074e60c>] (setup_arch+0x6f4/0x89c)
[ 0.000000] [<c074e60c>] (setup_arch) from [<c074b9cc>] (start_kernel+0x74/0x3a4)
[ 0.000000] [<c074b9cc>] (start_kernel) from [<00008078>] (0x8078)
[ 0.000000] ---[ end trace cb88537fdc8fa200 ]---
[ 0.000000] DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map
[ 0.000000] CPU: All CPU(s) started in SVC mode.
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 195072
[ 0.000000] Kernel command line: earlyprintk console=ttyAMA0 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=720 bcm2708_fb.fbheight=576 bcm2709.boardrev=0xa01041 bcm2709.serial=0x3449476 smsc95xx.macaddr=B8:27:EB:44:94:76 bcm2708_fb.fbswap=1 bcm2709.disk_led_gpio=47 bcm2709.disk_led_active_low=0 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0x3ea00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait consoleblank=0 rw
[ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Memory: 770408K/786432K available (5713K kernel code, 426K rwdata, 1720K rodata, 420K init, 687K bss, 16024K reserved, 0K cma-reserved)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xf0800000 - 0xff800000 ( 240 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xf0000000 ( 768 MB)
[ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
[ 0.000000] .text : 0xc0008000 - 0xc074a7cc (7434 kB)
[ 0.000000] .init : 0xc074b000 - 0xc07b4000 ( 420 kB)
[ 0.000000] .data : 0xc07b4000 - 0xc081e910 ( 427 kB)
[ 0.000000] .bss : 0xc081e910 - 0xc08ca80c ( 688 kB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000000] Kernel panic - not syncing: /soc/local_intc: unable to map local interrupt registers
[ 0.000000]
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Tainted: G W 4.4.0-rc5+ #989
[ 0.000000] Hardware name: BCM2835
[ 0.000000] [<c0016c4c>] (unwind_backtrace) from [<c0013e58>] (show_stack+0x20/0x24)
[ 0.000000] [<c0013e58>] (show_stack) from [<c0247620>] (dump_stack+0x20/0x28)
[ 0.000000] [<c0247620>] (dump_stack) from [<c00c17c0>] (panic+0x84/0x210)
[ 0.000000] [<c00c17c0>] (panic) from [<c0771d5c>] (bcm2836_arm_irqchip_l1_intc_of_init+0x94/0x110)
[ 0.000000] [<c0771d5c>] (bcm2836_arm_irqchip_l1_intc_of_init) from [<c0779f04>] (of_irq_init+0x1a0/0x2a8)
[ 0.000000] [<c0779f04>] (of_irq_init) from [<c0771af4>] (irqchip_init+0x14/0x1c)
[ 0.000000] [<c0771af4>] (irqchip_init) from [<c074d7a8>] (init_IRQ+0x28/0x88)
[ 0.000000] [<c074d7a8>] (init_IRQ) from [<c074bb64>] (start_kernel+0x20c/0x3a4)
[ 0.000000] [<c074bb64>] (start_kernel) from [<00008078>] (0x8078)
[ 0.000000] ---[ end Kernel panic - not syncing: /soc/local_intc: unable to map local interrupt registers


Any ideas why I get this message?

- Alex

2015-12-18 10:55:31

by Alexander Aring

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] Raspberry Pi 2 support.

On Fri, Dec 18, 2015 at 11:08:26AM +0100, Alexander Aring wrote:
> Hi Eric,
>
> On Wed, Dec 16, 2015 at 03:55:07PM -0800, Eric Anholt wrote:
> > This is a major rewrite of the previous Raspberry Pi 2 submission.
> > SMP support is now included, and the DT includes are cleaned up to
> > avoid massive duplication.
> >
> > The branch (based on 4.4-rc5, to get the USB regression fixes) can be
> > found at:
> >
> > https://github.com/anholt/linux/tree/bcm2836-4.4
> >
>
> thanks. :-)
>
> I tried it via booting with the RPi firmware and your branch, but it
> doesn't boot on my side:
>
> I get:
>
> Uncompressing Linux... done, booting the kernel.
> [ 0.000000] Booting Linux on physical CPU 0x0
> [ 0.000000] Initializing cgroup subsys cpuset
> [ 0.000000] Initializing cgroup subsys cpu
> [ 0.000000] Initializing cgroup subsys cpuacct
> [ 0.000000] Linux version 4.4.0-rc5+ (alex@omega) (gcc version 4.9.2 (OSELAS.Toolchain-2014.12.1) ) #989 Fri Dec 18 10:54:40 CET 2015
> [ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c53c7d
> [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
> [ 0.000000] Machine model: Raspberry Pi 2 Model B Rev 1.1
> [ 0.000000] bootconsole [earlycon0] enabled
> [ 0.000000] Truncating RAM at 0x00000000-0x3e000000 to -0x30000000
> [ 0.000000] Consider using a HIGHMEM enabled kernel.
> [ 0.000000] Memory policy: Data cache writeback
> [ 0.000000] BUG: mapping for 0x3f201000 at 0xf0201000 out of vmalloc space
> [ 0.000000] ------------[ cut here ]------------
> [ 0.000000] WARNING: CPU: 0 PID: 0 at arch/arm/kernel/devtree.c:149 arm_dt_init_cpu_maps+0x100/0x1a4()
> [ 0.000000] DT /cpu 2 nodes greater than max cores 1, capping them
> [ 0.000000] Modules linked in:
> [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.4.0-rc5+ #989
> [ 0.000000] Hardware name: BCM2835

Because this, I thought I boot with the wrong devicetree. But then I saw
[0].

Can this not set to BCM2836 when I include "bcm2836.dtsi" and BCM2835,
when I include "bcm2835.dtsi"?

- Alex

https://github.com/anholt/linux/blob/bcm2836-4.4/arch/arm/boot/dts/bcm283x.dtsi#L12

2015-12-19 04:18:43

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v2 3/8] dt-bindings: Add root properties for Raspberry Pi 2

On Wed, Dec 16, 2015 at 03:55:10PM -0800, Eric Anholt wrote:
> Signed-off-by: Eric Anholt <[email protected]>
> ---
> Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt | 4 ++++
> 1 file changed, 4 insertions(+)

Acked-by: Rob Herring <[email protected]>

2015-12-20 22:12:11

by Alexander Aring

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] Raspberry Pi 2 support.

On Fri, Dec 18, 2015 at 11:08:26AM +0100, Alexander Aring wrote:
...
> Uncompressing Linux... done, booting the kernel.
> [ 0.000000] Booting Linux on physical CPU 0x0
> [ 0.000000] Initializing cgroup subsys cpuset
> [ 0.000000] Initializing cgroup subsys cpu
> [ 0.000000] Initializing cgroup subsys cpuacct
> [ 0.000000] Linux version 4.4.0-rc5+ (alex@omega) (gcc version 4.9.2 (OSELAS.Toolchain-2014.12.1) ) #989 Fri Dec 18 10:54:40 CET 2015
> [ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c53c7d
> [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
> [ 0.000000] Machine model: Raspberry Pi 2 Model B Rev 1.1
> [ 0.000000] bootconsole [earlycon0] enabled
> [ 0.000000] Truncating RAM at 0x00000000-0x3e000000 to -0x30000000
> [ 0.000000] Consider using a HIGHMEM enabled kernel.

I can remove this "note" when I enable CONFIG_HIGHMEM.

> [ 0.000000] Memory policy: Data cache writeback
> [ 0.000000] BUG: mapping for 0x3f201000 at 0xf0201000 out of vmalloc space
> [ 0.000000] ------------[ cut here ]------------
> [ 0.000000] WARNING: CPU: 0 PID: 0 at arch/arm/kernel/devtree.c:149 arm_dt_init_cpu_maps+0x100/0x1a4()
> [ 0.000000] DT /cpu 2 nodes greater than max cores 1, capping them
> [ 0.000000] Modules linked in:
> [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.4.0-rc5+ #989
> [ 0.000000] Hardware name: BCM2835
> [ 0.000000] [<c0016c4c>] (unwind_backtrace) from [<c0013e58>] (show_stack+0x20/0x24)
> [ 0.000000] [<c0013e58>] (show_stack) from [<c0247620>] (dump_stack+0x20/0x28)
> [ 0.000000] [<c0247620>] (dump_stack) from [<c0023a84>] (warn_slowpath_common+0x9c/0xc4)
> [ 0.000000] [<c0023a84>] (warn_slowpath_common) from [<c0023aec>] (warn_slowpath_fmt+0x40/0x48)
> [ 0.000000] [<c0023aec>] (warn_slowpath_fmt) from [<c074ef94>] (arm_dt_init_cpu_maps+0x100/0x1a4)
> [ 0.000000] [<c074ef94>] (arm_dt_init_cpu_maps) from [<c074e60c>] (setup_arch+0x6f4/0x89c)
> [ 0.000000] [<c074e60c>] (setup_arch) from [<c074b9cc>] (start_kernel+0x74/0x3a4)
> [ 0.000000] [<c074b9cc>] (start_kernel) from [<00008078>] (0x8078)
> [ 0.000000] ---[ end trace cb88537fdc8fa200 ]---
> [ 0.000000] DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map
> [ 0.000000] CPU: All CPU(s) started in SVC mode.

I can remove this WARNING when I enable CONFIG_SMP.

> [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 195072
> [ 0.000000] Kernel command line: earlyprintk console=ttyAMA0 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=720 bcm2708_fb.fbheight=576 bcm2709.boardrev=0xa01041 bcm2709.serial=0x3449476 smsc95xx.macaddr=B8:27:EB:44:94:76 bcm2708_fb.fbswap=1 bcm2709.disk_led_gpio=47 bcm2709.disk_led_active_low=0 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0x3ea00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait consoleblank=0 rw
> [ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
> [ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
> [ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
> [ 0.000000] Memory: 770408K/786432K available (5713K kernel code, 426K rwdata, 1720K rodata, 420K init, 687K bss, 16024K reserved, 0K cma-reserved)
> [ 0.000000] Virtual kernel memory layout:
> [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
> [ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
> [ 0.000000] vmalloc : 0xf0800000 - 0xff800000 ( 240 MB)
> [ 0.000000] lowmem : 0xc0000000 - 0xf0000000 ( 768 MB)
> [ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
> [ 0.000000] .text : 0xc0008000 - 0xc074a7cc (7434 kB)
> [ 0.000000] .init : 0xc074b000 - 0xc07b4000 ( 420 kB)
> [ 0.000000] .data : 0xc07b4000 - 0xc081e910 ( 427 kB)
> [ 0.000000] .bss : 0xc081e910 - 0xc08ca80c ( 688 kB)
> [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
> [ 0.000000] NR_IRQS:16 nr_irqs:16 16
> [ 0.000000] Kernel panic - not syncing: /soc/local_intc: unable to map local interrupt registers
> [ 0.000000]
> [ 0.000000] CPU: 0 PID: 0 Comm: swapper Tainted: G W 4.4.0-rc5+ #989
> [ 0.000000] Hardware name: BCM2835
> [ 0.000000] [<c0016c4c>] (unwind_backtrace) from [<c0013e58>] (show_stack+0x20/0x24)
> [ 0.000000] [<c0013e58>] (show_stack) from [<c0247620>] (dump_stack+0x20/0x28)
> [ 0.000000] [<c0247620>] (dump_stack) from [<c00c17c0>] (panic+0x84/0x210)
> [ 0.000000] [<c00c17c0>] (panic) from [<c0771d5c>] (bcm2836_arm_irqchip_l1_intc_of_init+0x94/0x110)
> [ 0.000000] [<c0771d5c>] (bcm2836_arm_irqchip_l1_intc_of_init) from [<c0779f04>] (of_irq_init+0x1a0/0x2a8)
> [ 0.000000] [<c0779f04>] (of_irq_init) from [<c0771af4>] (irqchip_init+0x14/0x1c)
> [ 0.000000] [<c0771af4>] (irqchip_init) from [<c074d7a8>] (init_IRQ+0x28/0x88)
> [ 0.000000] [<c074d7a8>] (init_IRQ) from [<c074bb64>] (start_kernel+0x20c/0x3a4)
> [ 0.000000] [<c074bb64>] (start_kernel) from [<00008078>] (0x8078)
> [ 0.000000] ---[ end Kernel panic - not syncing: /soc/local_intc: unable to map local interrupt registers
>

But still getting this panic, your patches does not contain some
defconfig, so I still try to figure out what I need to enable to get it
working. Maybe it is some missing config entry which should be enabled.

But, for me it looks like some devicetree issue, because of_iomem returns
NULL, at [0]. Don't know what I am doing wrong.

- Alex

[0] https://github.com/anholt/linux/blob/bcm2836-4.4/drivers/irqchip/irq-bcm2836.c#L290

2015-12-21 23:07:50

by Eric Anholt

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] Raspberry Pi 2 support.

Alexander Aring <[email protected]> writes:

> On Fri, Dec 18, 2015 at 11:08:26AM +0100, Alexander Aring wrote:
> ...
>> Uncompressing Linux... done, booting the kernel.
>> [ 0.000000] Booting Linux on physical CPU 0x0
>> [ 0.000000] Initializing cgroup subsys cpuset
>> [ 0.000000] Initializing cgroup subsys cpu
>> [ 0.000000] Initializing cgroup subsys cpuacct
>> [ 0.000000] Linux version 4.4.0-rc5+ (alex@omega) (gcc version 4.9.2 (OSELAS.Toolchain-2014.12.1) ) #989 Fri Dec 18 10:54:40 CET 2015
>> [ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c53c7d
>> [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
>> [ 0.000000] Machine model: Raspberry Pi 2 Model B Rev 1.1
>> [ 0.000000] bootconsole [earlycon0] enabled
>> [ 0.000000] Truncating RAM at 0x00000000-0x3e000000 to -0x30000000
>> [ 0.000000] Consider using a HIGHMEM enabled kernel.
>
> I can remove this "note" when I enable CONFIG_HIGHMEM.
>
>> [ 0.000000] Memory policy: Data cache writeback
>> [ 0.000000] BUG: mapping for 0x3f201000 at 0xf0201000 out of vmalloc space
>> [ 0.000000] ------------[ cut here ]------------
>> [ 0.000000] WARNING: CPU: 0 PID: 0 at arch/arm/kernel/devtree.c:149 arm_dt_init_cpu_maps+0x100/0x1a4()
>> [ 0.000000] DT /cpu 2 nodes greater than max cores 1, capping them
>> [ 0.000000] Modules linked in:
>> [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.4.0-rc5+ #989
>> [ 0.000000] Hardware name: BCM2835
>> [ 0.000000] [<c0016c4c>] (unwind_backtrace) from [<c0013e58>] (show_stack+0x20/0x24)
>> [ 0.000000] [<c0013e58>] (show_stack) from [<c0247620>] (dump_stack+0x20/0x28)
>> [ 0.000000] [<c0247620>] (dump_stack) from [<c0023a84>] (warn_slowpath_common+0x9c/0xc4)
>> [ 0.000000] [<c0023a84>] (warn_slowpath_common) from [<c0023aec>] (warn_slowpath_fmt+0x40/0x48)
>> [ 0.000000] [<c0023aec>] (warn_slowpath_fmt) from [<c074ef94>] (arm_dt_init_cpu_maps+0x100/0x1a4)
>> [ 0.000000] [<c074ef94>] (arm_dt_init_cpu_maps) from [<c074e60c>] (setup_arch+0x6f4/0x89c)
>> [ 0.000000] [<c074e60c>] (setup_arch) from [<c074b9cc>] (start_kernel+0x74/0x3a4)
>> [ 0.000000] [<c074b9cc>] (start_kernel) from [<00008078>] (0x8078)
>> [ 0.000000] ---[ end trace cb88537fdc8fa200 ]---
>> [ 0.000000] DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map
>> [ 0.000000] CPU: All CPU(s) started in SVC mode.
>
> I can remove this WARNING when I enable CONFIG_SMP.
>
>> [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 195072
>> [ 0.000000] Kernel command line: earlyprintk console=ttyAMA0 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=720 bcm2708_fb.fbheight=576 bcm2709.boardrev=0xa01041 bcm2709.serial=0x3449476 smsc95xx.macaddr=B8:27:EB:44:94:76 bcm2708_fb.fbswap=1 bcm2709.disk_led_gpio=47 bcm2709.disk_led_active_low=0 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0x3ea00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait consoleblank=0 rw
>> [ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
>> [ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
>> [ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
>> [ 0.000000] Memory: 770408K/786432K available (5713K kernel code, 426K rwdata, 1720K rodata, 420K init, 687K bss, 16024K reserved, 0K cma-reserved)
>> [ 0.000000] Virtual kernel memory layout:
>> [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
>> [ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
>> [ 0.000000] vmalloc : 0xf0800000 - 0xff800000 ( 240 MB)
>> [ 0.000000] lowmem : 0xc0000000 - 0xf0000000 ( 768 MB)
>> [ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
>> [ 0.000000] .text : 0xc0008000 - 0xc074a7cc (7434 kB)
>> [ 0.000000] .init : 0xc074b000 - 0xc07b4000 ( 420 kB)
>> [ 0.000000] .data : 0xc07b4000 - 0xc081e910 ( 427 kB)
>> [ 0.000000] .bss : 0xc081e910 - 0xc08ca80c ( 688 kB)
>> [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
>> [ 0.000000] NR_IRQS:16 nr_irqs:16 16
>> [ 0.000000] Kernel panic - not syncing: /soc/local_intc: unable to map local interrupt registers
>> [ 0.000000]
>> [ 0.000000] CPU: 0 PID: 0 Comm: swapper Tainted: G W 4.4.0-rc5+ #989
>> [ 0.000000] Hardware name: BCM2835
>> [ 0.000000] [<c0016c4c>] (unwind_backtrace) from [<c0013e58>] (show_stack+0x20/0x24)
>> [ 0.000000] [<c0013e58>] (show_stack) from [<c0247620>] (dump_stack+0x20/0x28)
>> [ 0.000000] [<c0247620>] (dump_stack) from [<c00c17c0>] (panic+0x84/0x210)
>> [ 0.000000] [<c00c17c0>] (panic) from [<c0771d5c>] (bcm2836_arm_irqchip_l1_intc_of_init+0x94/0x110)
>> [ 0.000000] [<c0771d5c>] (bcm2836_arm_irqchip_l1_intc_of_init) from [<c0779f04>] (of_irq_init+0x1a0/0x2a8)
>> [ 0.000000] [<c0779f04>] (of_irq_init) from [<c0771af4>] (irqchip_init+0x14/0x1c)
>> [ 0.000000] [<c0771af4>] (irqchip_init) from [<c074d7a8>] (init_IRQ+0x28/0x88)
>> [ 0.000000] [<c074d7a8>] (init_IRQ) from [<c074bb64>] (start_kernel+0x20c/0x3a4)
>> [ 0.000000] [<c074bb64>] (start_kernel) from [<00008078>] (0x8078)
>> [ 0.000000] ---[ end Kernel panic - not syncing: /soc/local_intc: unable to map local interrupt registers
>>
>
> But still getting this panic, your patches does not contain some
> defconfig, so I still try to figure out what I need to enable to get it
> working. Maybe it is some missing config entry which should be enabled.
>
> But, for me it looks like some devicetree issue, because of_iomem returns
> NULL, at [0]. Don't know what I am doing wrong.

My best guess is that since you're not using U-Boot, the firmware's
mangling the DT in some way that breaks us. Notably, in my current
firmware checkout, set /soc/ranges to just the first entry that we're
using, which would break the mapping. However,
rpi/rpi-4.4.y:arch/arm/boot/dts/bcm2709.dtsi uses the same /soc/ranges
setup that we do, so I'm not sure what's going on. Perhaps
bcm2709_io_desc[]'s initialization covers for it?


Attachments:
signature.asc (818.00 B)

2015-12-21 23:09:43

by Eric Anholt

[permalink] [raw]
Subject: Re: [PATCH v2 4/8] ARM: bcm2835: Split the DT for peripherals from the DT for the CPU

Alexander Aring <[email protected]> writes:

> Hi Eric,
>
> On Wed, Dec 16, 2015 at 03:55:11PM -0800, Eric Anholt wrote:
>> The set of peripherals remained constant across bcm2835 (Raspberry Pi
>> 1) and bcm2836 (Raspberry Pi 2), but the CPU was swapped out. Split
>> the files so that we can include just peripheral setup in 2836.
>>
>> Signed-off-by: Eric Anholt <[email protected]>
>> ---
>> -
>> arm-pmu {
>> compatible = "arm,arm1176-pmu";
>> };
>> };
>
> This is bcm2835 related only? It's still inside bcm283x.dtsi, see [0].
> The rename here makes it a little hard to review.

Good catch. Thanks!


Attachments:
signature.asc (818.00 B)

2015-12-21 23:12:31

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] Raspberry Pi 2 support.

On Sunday 20 December 2015, Alexander Aring wrote:
> On Fri, Dec 18, 2015 at 11:08:26AM +0100, Alexander Aring wrote:
> > [ 0.000000] Memory policy: Data cache writeback
> > [ 0.000000] BUG: mapping for 0x3f201000 at 0xf0201000 out of vmalloc space

This is a separate bug, right?

> > [ 0.000000] ------------[ cut here ]------------
> > [ 0.000000] WARNING: CPU: 0 PID: 0 at arch/arm/kernel/devtree.c:149 arm_dt_init_cpu_maps+0x100/0x1a4()
> > [ 0.000000] DT /cpu 2 nodes greater than max cores 1, capping them
> > [ 0.000000] Modules linked in:
> > [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.4.0-rc5+ #989
> > [ 0.000000] Hardware name: BCM2835
> > [ 0.000000] [<c0016c4c>] (unwind_backtrace) from [<c0013e58>] (show_stack+0x20/0x24)
> > [ 0.000000] [<c0013e58>] (show_stack) from [<c0247620>] (dump_stack+0x20/0x28)
> > [ 0.000000] [<c0247620>] (dump_stack) from [<c0023a84>] (warn_slowpath_common+0x9c/0xc4)
> > [ 0.000000] [<c0023a84>] (warn_slowpath_common) from [<c0023aec>] (warn_slowpath_fmt+0x40/0x48)
> > [ 0.000000] [<c0023aec>] (warn_slowpath_fmt) from [<c074ef94>] (arm_dt_init_cpu_maps+0x100/0x1a4)
> > [ 0.000000] [<c074ef94>] (arm_dt_init_cpu_maps) from [<c074e60c>] (setup_arch+0x6f4/0x89c)
> > [ 0.000000] [<c074e60c>] (setup_arch) from [<c074b9cc>] (start_kernel+0x74/0x3a4)
> > [ 0.000000] [<c074b9cc>] (start_kernel) from [<00008078>] (0x8078)
> > [ 0.000000] ---[ end trace cb88537fdc8fa200 ]---
> > [ 0.000000] DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map
> > [ 0.000000] CPU: All CPU(s) started in SVC mode.
>
> I can remove this WARNING when I enable CONFIG_SMP.

I think we should try to change this in the code.

> > [ 0.000000] Virtual kernel memory layout:
> > [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
> > [ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
> > [ 0.000000] vmalloc : 0xf0800000 - 0xff800000 ( 240 MB)
> > [ 0.000000] lowmem : 0xc0000000 - 0xf0000000 ( 768 MB)
> > [ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
> > [ 0.000000] .text : 0xc0008000 - 0xc074a7cc (7434 kB)
> > [ 0.000000] .init : 0xc074b000 - 0xc07b4000 ( 420 kB)
> > [ 0.000000] .data : 0xc07b4000 - 0xc081e910 ( 427 kB)
> > [ 0.000000] .bss : 0xc081e910 - 0xc08ca80c ( 688 kB)
> > [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
> > [ 0.000000] NR_IRQS:16 nr_irqs:16 16
> > [ 0.000000] Kernel panic - not syncing: /soc/local_intc: unable to map local interrupt registers
> > [ 0.000000]
> > [ 0.000000] CPU: 0 PID: 0 Comm: swapper Tainted: G W 4.4.0-rc5+ #989
> > [ 0.000000] Hardware name: BCM2835
> > [ 0.000000] [<c0016c4c>] (unwind_backtrace) from [<c0013e58>] (show_stack+0x20/0x24)
> > [ 0.000000] [<c0013e58>] (show_stack) from [<c0247620>] (dump_stack+0x20/0x28)
> > [ 0.000000] [<c0247620>] (dump_stack) from [<c00c17c0>] (panic+0x84/0x210)
> > [ 0.000000] [<c00c17c0>] (panic) from [<c0771d5c>] (bcm2836_arm_irqchip_l1_intc_of_init+0x94/0x110)
> > [ 0.000000] [<c0771d5c>] (bcm2836_arm_irqchip_l1_intc_of_init) from [<c0779f04>] (of_irq_init+0x1a0/0x2a8)
> > [ 0.000000] [<c0779f04>] (of_irq_init) from [<c0771af4>] (irqchip_init+0x14/0x1c)
> > [ 0.000000] [<c0771af4>] (irqchip_init) from [<c074d7a8>] (init_IRQ+0x28/0x88)
> > [ 0.000000] [<c074d7a8>] (init_IRQ) from [<c074bb64>] (start_kernel+0x20c/0x3a4)
> > [ 0.000000] [<c074bb64>] (start_kernel) from [<00008078>] (0x8078)
> > [ 0.000000] ---[ end Kernel panic - not syncing: /soc/local_intc: unable to map local interrupt registers
> >
>
> But still getting this panic, your patches does not contain some
> defconfig, so I still try to figure out what I need to enable to get it
> working. Maybe it is some missing config entry which should be enabled.
>
> But, for me it looks like some devicetree issue, because of_iomem returns
> NULL, at [0]. Don't know what I am doing wrong.

That is the most likely cause, yes. You can try replacing it with an ioremap with a
hardcoded physical address to see if that works.

Arnd

2015-12-22 10:11:43

by Alexander Aring

[permalink] [raw]
Subject: Re: [PATCH v2 6/8] ARM: bcm2835: Add devicetree for bcm2836 and Raspberry Pi 2 B

On Wed, Dec 16, 2015 at 03:55:13PM -0800, Eric Anholt wrote:
> The Pi 2 B ends up like a Pi 1 B+, with the same peripherals and
> pinout, but the CPU and memory layout changed to use the 2836.
>
> Signed-off-by: Eric Anholt <[email protected]>
> ---
> arch/arm/boot/dts/bcm2836-rpi-2-b.dts | 35 ++++++++++++++++
> arch/arm/boot/dts/bcm2836.dtsi | 77 +++++++++++++++++++++++++++++++++++
> 2 files changed, 112 insertions(+)
> create mode 100644 arch/arm/boot/dts/bcm2836-rpi-2-b.dts
> create mode 100644 arch/arm/boot/dts/bcm2836.dtsi
>
> diff --git a/arch/arm/boot/dts/bcm2836-rpi-2-b.dts b/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
> new file mode 100644
> index 0000000..ff94666
> --- /dev/null
> +++ b/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
> @@ -0,0 +1,35 @@
> +/dts-v1/;
> +#include "bcm2836.dtsi"
> +#include "bcm2835-rpi.dtsi"
> +
> +/ {
> + compatible = "raspberrypi,2-model-b", "brcm,bcm2836";
> + model = "Raspberry Pi 2 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";
> + };
> + };
> +};
> +
> +&gpio {
> + pinctrl-0 = <&gpioout &alt0 &i2s_alt0 &alt3>;
> +
> + /* I2S interface */
> + i2s_alt0: i2s_alt0 {
> + brcm,pins = <18 19 20 21>;
> + brcm,function = <BCM2835_FSEL_ALT0>;
> + };
> +};
> diff --git a/arch/arm/boot/dts/bcm2836.dtsi b/arch/arm/boot/dts/bcm2836.dtsi
> new file mode 100644
> index 0000000..6693118
> --- /dev/null
> +++ b/arch/arm/boot/dts/bcm2836.dtsi
> @@ -0,0 +1,77 @@
> +#include "bcm283x.dtsi"
> +
> +/ {
> + compatible = "brcm,bcm2836";
> +
> + soc {
> + ranges = <0x7e000000 0x3f000000 0x1000000>,

nitpik, I would change it here to 0x01000000 for the size parameter,
like below: 8-byte filled with zeroes.

> + <0x40000000 0x40000000 0x00001000>;

Is 0x00001000 correct here? I currently debug this part because the
devicetree issues which I mentioned. I looked into some bcm2836
datasheet. See [0], section "4 Registers", I assume this should be 0x00000100.
Or are there more than these registers which need to be accessable?

- Alex

[0] https://github.com/raspberrypi/documentation/blob/master/hardware/raspberrypi/bcm2836/QA7_rev3.4.pdf

2015-12-22 14:20:56

by Alexander Aring

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] Raspberry Pi 2 support.

On Tue, Dec 22, 2015 at 12:11:32AM +0100, Arnd Bergmann wrote:
> On Sunday 20 December 2015, Alexander Aring wrote:
> > On Fri, Dec 18, 2015 at 11:08:26AM +0100, Alexander Aring wrote:
> > > [ 0.000000] Memory policy: Data cache writeback
> > > [ 0.000000] BUG: mapping for 0x3f201000 at 0xf0201000 out of vmalloc space
>
> This is a separate bug, right?
>

Yes, I can remove this BUG when setting:

VMSPLIT_2G

or some other option, was "VMSPLIT_3G" before and with this option I
will get the above message.

> > > [ 0.000000] ------------[ cut here ]------------
> > > [ 0.000000] WARNING: CPU: 0 PID: 0 at arch/arm/kernel/devtree.c:149 arm_dt_init_cpu_maps+0x100/0x1a4()
> > > [ 0.000000] DT /cpu 2 nodes greater than max cores 1, capping them
> > > [ 0.000000] Modules linked in:
> > > [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.4.0-rc5+ #989
> > > [ 0.000000] Hardware name: BCM2835
> > > [ 0.000000] [<c0016c4c>] (unwind_backtrace) from [<c0013e58>] (show_stack+0x20/0x24)
> > > [ 0.000000] [<c0013e58>] (show_stack) from [<c0247620>] (dump_stack+0x20/0x28)
> > > [ 0.000000] [<c0247620>] (dump_stack) from [<c0023a84>] (warn_slowpath_common+0x9c/0xc4)
> > > [ 0.000000] [<c0023a84>] (warn_slowpath_common) from [<c0023aec>] (warn_slowpath_fmt+0x40/0x48)
> > > [ 0.000000] [<c0023aec>] (warn_slowpath_fmt) from [<c074ef94>] (arm_dt_init_cpu_maps+0x100/0x1a4)
> > > [ 0.000000] [<c074ef94>] (arm_dt_init_cpu_maps) from [<c074e60c>] (setup_arch+0x6f4/0x89c)
> > > [ 0.000000] [<c074e60c>] (setup_arch) from [<c074b9cc>] (start_kernel+0x74/0x3a4)
> > > [ 0.000000] [<c074b9cc>] (start_kernel) from [<00008078>] (0x8078)
> > > [ 0.000000] ---[ end trace cb88537fdc8fa200 ]---
> > > [ 0.000000] DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map
> > > [ 0.000000] CPU: All CPU(s) started in SVC mode.
> >
> > I can remove this WARNING when I enable CONFIG_SMP.
>
> I think we should try to change this in the code.
>

mhhh, okay... I am not sure I think there is some missing
IS_ENABLED(CONFIG_SMP) check.

> > > [ 0.000000] Virtual kernel memory layout:
> > > [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
> > > [ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
> > > [ 0.000000] vmalloc : 0xf0800000 - 0xff800000 ( 240 MB)
> > > [ 0.000000] lowmem : 0xc0000000 - 0xf0000000 ( 768 MB)
> > > [ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
> > > [ 0.000000] .text : 0xc0008000 - 0xc074a7cc (7434 kB)
> > > [ 0.000000] .init : 0xc074b000 - 0xc07b4000 ( 420 kB)
> > > [ 0.000000] .data : 0xc07b4000 - 0xc081e910 ( 427 kB)
> > > [ 0.000000] .bss : 0xc081e910 - 0xc08ca80c ( 688 kB)
> > > [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
> > > [ 0.000000] NR_IRQS:16 nr_irqs:16 16
> > > [ 0.000000] Kernel panic - not syncing: /soc/local_intc: unable to map local interrupt registers
> > > [ 0.000000]
> > > [ 0.000000] CPU: 0 PID: 0 Comm: swapper Tainted: G W 4.4.0-rc5+ #989
> > > [ 0.000000] Hardware name: BCM2835
> > > [ 0.000000] [<c0016c4c>] (unwind_backtrace) from [<c0013e58>] (show_stack+0x20/0x24)
> > > [ 0.000000] [<c0013e58>] (show_stack) from [<c0247620>] (dump_stack+0x20/0x28)
> > > [ 0.000000] [<c0247620>] (dump_stack) from [<c00c17c0>] (panic+0x84/0x210)
> > > [ 0.000000] [<c00c17c0>] (panic) from [<c0771d5c>] (bcm2836_arm_irqchip_l1_intc_of_init+0x94/0x110)
> > > [ 0.000000] [<c0771d5c>] (bcm2836_arm_irqchip_l1_intc_of_init) from [<c0779f04>] (of_irq_init+0x1a0/0x2a8)
> > > [ 0.000000] [<c0779f04>] (of_irq_init) from [<c0771af4>] (irqchip_init+0x14/0x1c)
> > > [ 0.000000] [<c0771af4>] (irqchip_init) from [<c074d7a8>] (init_IRQ+0x28/0x88)
> > > [ 0.000000] [<c074d7a8>] (init_IRQ) from [<c074bb64>] (start_kernel+0x20c/0x3a4)
> > > [ 0.000000] [<c074bb64>] (start_kernel) from [<00008078>] (0x8078)
> > > [ 0.000000] ---[ end Kernel panic - not syncing: /soc/local_intc: unable to map local interrupt registers
> > >
> >
> > But still getting this panic, your patches does not contain some
> > defconfig, so I still try to figure out what I need to enable to get it
> > working. Maybe it is some missing config entry which should be enabled.
> >
> > But, for me it looks like some devicetree issue, because of_iomem returns
> > NULL, at [0]. Don't know what I am doing wrong.
>
> That is the most likely cause, yes. You can try replacing it with an ioremap with a
> hardcoded physical address to see if that works.
>

When I changed to "VMSPLIT_2G" the above issue doesn't occur anymore.

Later while booting the kernel hangs forever, the solution on my side
was to enable:

CONFIG_HAVE_ARM_ARCH_TIMER

I think this doesn't use the BCM2835 timer anymore and some cortex-a7
related "generic timer", or?

btw:

After the RPi is booted succesful I get several:

[ 35.048513] unexpected IRQ trap at vector 00

When I type something via uart (after each character).


Any ideas?

- Alex

2015-12-22 14:26:54

by Alexander Aring

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] Raspberry Pi 2 support.

On Mon, Dec 21, 2015 at 03:07:44PM -0800, Eric Anholt wrote:
...
> >
> > But still getting this panic, your patches does not contain some
> > defconfig, so I still try to figure out what I need to enable to get it
> > working. Maybe it is some missing config entry which should be enabled.
> >
> > But, for me it looks like some devicetree issue, because of_iomem returns
> > NULL, at [0]. Don't know what I am doing wrong.
>
> My best guess is that since you're not using U-Boot, the firmware's
> mangling the DT in some way that breaks us. Notably, in my current
> firmware checkout, set /soc/ranges to just the first entry that we're
> using, which would break the mapping. However,
> rpi/rpi-4.4.y:arch/arm/boot/dts/bcm2709.dtsi uses the same /soc/ranges
> setup that we do, so I'm not sure what's going on. Perhaps
> bcm2709_io_desc[]'s initialization covers for it?

I boot here with two different bootloaders, both ends in the same panic.

Finally I figured out if I do a user/kernel split (2G/2G) then the
issue is gone.

Later I need to enable "CONFIG_HAVE_ARM_ARCH_TIMER" so the kernel
doesn't hang forever.

After finally booting the RPi2 I get several messages of:

unexpected IRQ trap at vector 00

while typing _one_ character over uart.

Can you provide somehow your RPi2 kernelconfig?

- Alex

2015-12-22 19:01:36

by Eric Anholt

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] Raspberry Pi 2 support.

Alexander Aring <[email protected]> writes:

> On Mon, Dec 21, 2015 at 03:07:44PM -0800, Eric Anholt wrote:
> ...
>> >
>> > But still getting this panic, your patches does not contain some
>> > defconfig, so I still try to figure out what I need to enable to get it
>> > working. Maybe it is some missing config entry which should be enabled.
>> >
>> > But, for me it looks like some devicetree issue, because of_iomem returns
>> > NULL, at [0]. Don't know what I am doing wrong.
>>
>> My best guess is that since you're not using U-Boot, the firmware's
>> mangling the DT in some way that breaks us. Notably, in my current
>> firmware checkout, set /soc/ranges to just the first entry that we're
>> using, which would break the mapping. However,
>> rpi/rpi-4.4.y:arch/arm/boot/dts/bcm2709.dtsi uses the same /soc/ranges
>> setup that we do, so I'm not sure what's going on. Perhaps
>> bcm2709_io_desc[]'s initialization covers for it?
>
> I boot here with two different bootloaders, both ends in the same panic.
>
> Finally I figured out if I do a user/kernel split (2G/2G) then the
> issue is gone.

Huh. Not sure what's going on there.

> Later I need to enable "CONFIG_HAVE_ARM_ARCH_TIMER" so the kernel
> doesn't hang forever.

I'll add a dependency for that -- we definitely want the arch timer. I
would have thought that the 2835 timer would still be able to make
things work, though.

> After finally booting the RPi2 I get several messages of:
>
> unexpected IRQ trap at vector 00
>
> while typing _one_ character over uart.

We were doing some debugging of that recently. It seems that every once
in a while we get woken up but nothing shows up in the top-level status
register. We need to just make the irqchip ignore instead of trying to
look up a handler in that case, but I haven't prioritized it because it
makes me worry that I'm just papering over a problem in our IRQ masking
or something.

I haven't seen any problems other than the printk, though.

> Can you provide somehow your RPi2 kernelconfig?

http://people.freedesktop.org/~anholt/dotconfig-bcm2836-2015-12-22.txt


Attachments:
signature.asc (818.00 B)

2015-12-22 21:25:07

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] Raspberry Pi 2 support.

On Tuesday 22 December 2015, Alexander Aring wrote:
> On Tue, Dec 22, 2015 at 12:11:32AM +0100, Arnd Bergmann wrote:
> > On Sunday 20 December 2015, Alexander Aring wrote:
> > > On Fri, Dec 18, 2015 at 11:08:26AM +0100, Alexander Aring wrote:
> > > > [ 0.000000] Memory policy: Data cache writeback
> > > > [ 0.000000] BUG: mapping for 0x3f201000 at 0xf0201000 out of vmalloc space
> >
> > This is a separate bug, right?
> >
>
> Yes, I can remove this BUG when setting:
>
> VMSPLIT_2G
>
> or some other option, was "VMSPLIT_3G" before and with this option I
> will get the above message.

Please try to figure out why this happened, it should really work with any
vmsplit, in particular the one that everyone uses.

> > > > [ 0.000000] ------------[ cut here ]------------
> > > > [ 0.000000] WARNING: CPU: 0 PID: 0 at arch/arm/kernel/devtree.c:149 arm_dt_init_cpu_maps+0x100/0x1a4()
> > > > [ 0.000000] DT /cpu 2 nodes greater than max cores 1, capping them
> > > > [ 0.000000] Modules linked in:
> > > > [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.4.0-rc5+ #989
> > > > [ 0.000000] Hardware name: BCM2835
> > > > [ 0.000000] [<c0016c4c>] (unwind_backtrace) from [<c0013e58>] (show_stack+0x20/0x24)
> > > > [ 0.000000] [<c0013e58>] (show_stack) from [<c0247620>] (dump_stack+0x20/0x28)
> > > > [ 0.000000] [<c0247620>] (dump_stack) from [<c0023a84>] (warn_slowpath_common+0x9c/0xc4)
> > > > [ 0.000000] [<c0023a84>] (warn_slowpath_common) from [<c0023aec>] (warn_slowpath_fmt+0x40/0x48)
> > > > [ 0.000000] [<c0023aec>] (warn_slowpath_fmt) from [<c074ef94>] (arm_dt_init_cpu_maps+0x100/0x1a4)
> > > > [ 0.000000] [<c074ef94>] (arm_dt_init_cpu_maps) from [<c074e60c>] (setup_arch+0x6f4/0x89c)
> > > > [ 0.000000] [<c074e60c>] (setup_arch) from [<c074b9cc>] (start_kernel+0x74/0x3a4)
> > > > [ 0.000000] [<c074b9cc>] (start_kernel) from [<00008078>] (0x8078)
> > > > [ 0.000000] ---[ end trace cb88537fdc8fa200 ]---
> > > > [ 0.000000] DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map
> > > > [ 0.000000] CPU: All CPU(s) started in SVC mode.
> > >
> > > I can remove this WARNING when I enable CONFIG_SMP.
> >
> > I think we should try to change this in the code.
> >
>
> mhhh, okay... I am not sure I think there is some missing
> IS_ENABLED(CONFIG_SMP) check.

Makes sense.

> > > > [ 0.000000] Virtual kernel memory layout:
> > > > [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
> > > > [ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
> > > > [ 0.000000] vmalloc : 0xf0800000 - 0xff800000 ( 240 MB)
> > > > [ 0.000000] lowmem : 0xc0000000 - 0xf0000000 ( 768 MB)
> > > > [ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
> > > > [ 0.000000] .text : 0xc0008000 - 0xc074a7cc (7434 kB)
> > > > [ 0.000000] .init : 0xc074b000 - 0xc07b4000 ( 420 kB)
> > > > [ 0.000000] .data : 0xc07b4000 - 0xc081e910 ( 427 kB)
> > > > [ 0.000000] .bss : 0xc081e910 - 0xc08ca80c ( 688 kB)
> > > > [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
> > > > [ 0.000000] NR_IRQS:16 nr_irqs:16 16
> > > > [ 0.000000] Kernel panic - not syncing: /soc/local_intc: unable to map local interrupt registers
> > > > [ 0.000000]
> > > > [ 0.000000] CPU: 0 PID: 0 Comm: swapper Tainted: G W 4.4.0-rc5+ #989
> > > > [ 0.000000] Hardware name: BCM2835
> > > > [ 0.000000] [<c0016c4c>] (unwind_backtrace) from [<c0013e58>] (show_stack+0x20/0x24)
> > > > [ 0.000000] [<c0013e58>] (show_stack) from [<c0247620>] (dump_stack+0x20/0x28)
> > > > [ 0.000000] [<c0247620>] (dump_stack) from [<c00c17c0>] (panic+0x84/0x210)
> > > > [ 0.000000] [<c00c17c0>] (panic) from [<c0771d5c>] (bcm2836_arm_irqchip_l1_intc_of_init+0x94/0x110)
> > > > [ 0.000000] [<c0771d5c>] (bcm2836_arm_irqchip_l1_intc_of_init) from [<c0779f04>] (of_irq_init+0x1a0/0x2a8)
> > > > [ 0.000000] [<c0779f04>] (of_irq_init) from [<c0771af4>] (irqchip_init+0x14/0x1c)
> > > > [ 0.000000] [<c0771af4>] (irqchip_init) from [<c074d7a8>] (init_IRQ+0x28/0x88)
> > > > [ 0.000000] [<c074d7a8>] (init_IRQ) from [<c074bb64>] (start_kernel+0x20c/0x3a4)
> > > > [ 0.000000] [<c074bb64>] (start_kernel) from [<00008078>] (0x8078)
> > > > [ 0.000000] ---[ end Kernel panic - not syncing: /soc/local_intc: unable to map local interrupt registers
> > > >
> > >
> > > But still getting this panic, your patches does not contain some
> > > defconfig, so I still try to figure out what I need to enable to get it
> > > working. Maybe it is some missing config entry which should be enabled.
> > >
> > > But, for me it looks like some devicetree issue, because of_iomem returns
> > > NULL, at [0]. Don't know what I am doing wrong.
> >
> > That is the most likely cause, yes. You can try replacing it with an ioremap with a
> > hardcoded physical address to see if that works.
> >
>
> When I changed to "VMSPLIT_2G" the above issue doesn't occur anymore.

Someone recently had a similar bug on some freescale platform, but unfortunately I don't
remember the details. As above, it should really not depend on that option.

> Later while booting the kernel hangs forever, the solution on my side
> was to enable:
>
> CONFIG_HAVE_ARM_ARCH_TIMER
>
> I think this doesn't use the BCM2835 timer anymore and some cortex-a7
> related "generic timer", or?

Right, but I don't see how that relates to the irqchip. Is the BCM2835 timer
connected to a secondary irqchip, while the arch timer connects to the primary GIC?

> btw:
>
> After the RPi is booted succesful I get several:
>
> [ 35.048513] unexpected IRQ trap at vector 00
>
> When I type something via uart (after each character).
>
>
> Any ideas?

That also indicates that there is something wrong with the irqchip.

Arnd

2015-12-25 00:01:45

by Eric Anholt

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] Raspberry Pi 2 support.

Arnd Bergmann <[email protected]> writes:

> On Tuesday 22 December 2015, Alexander Aring wrote:
>> Later while booting the kernel hangs forever, the solution on my side
>> was to enable:
>>
>> CONFIG_HAVE_ARM_ARCH_TIMER
>>
>> I think this doesn't use the BCM2835 timer anymore and some cortex-a7
>> related "generic timer", or?
>
> Right, but I don't see how that relates to the irqchip. Is the BCM2835 timer
> connected to a secondary irqchip, while the arch timer connects to the primary GIC?

The 2835 timer is a "peripheral", and connects to the second level
irqchip, while the arm arch timer can give us per-cpu interrupts in the
first level controller.


Attachments:
signature.asc (818.00 B)

2015-12-26 21:44:23

by Noralf Trønnes

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] Raspberry Pi 2 support.


Den 22.12.2015 20:01, skrev Eric Anholt:

>
>> After finally booting the RPi2 I get several messages of:
>>
>> unexpected IRQ trap at vector 00
>>
>> while typing _one_ character over uart.
> We were doing some debugging of that recently. It seems that every once
> in a while we get woken up but nothing shows up in the top-level status
> register. We need to just make the irqchip ignore instead of trying to
> look up a handler in that case, but I haven't prioritized it because it
> makes me worry that I'm just papering over a problem in our IRQ masking
> or something.
>
> I haven't seen any problems other than the printk, though.

Downstream has this patch[1]:
irq-bcm2836: Prevent spurious interrupts, and trap them early

It has been used in the nightly build of OpenELEC[2] for 5 days now without
any complaints (used with the downstream ARCH_BCM2709).

[1]
https://github.com/raspberrypi/linux/commit/688a5f2ada4fbd16547b574a17e6d359ab2364d0
[2] http://forum.kodi.tv/showthread.php?tid=250817&pid=2192054#pid2192054

2015-12-26 22:38:14

by Eric Anholt

[permalink] [raw]
Subject: Re: [PATCH v2 8/8] ARM: bcm2835: Add Kconfig support for bcm2836

Eric Anholt <[email protected]> writes:

> This should be a complete port of bcm2835 functionality to bcm2836
> (Raspberry Pi 2).
>
> Signed-off-by: Eric Anholt <[email protected]>
> ---
>
> v2: Implement Arnd's feedback to not split to ARCH_BCM2836, and
> instead use more conditionals in ARCH_BCM2835. Also reduce diff
> between 2835 and 2836.
>
> arch/arm/Kconfig.debug | 10 ++++++++--
> arch/arm/boot/dts/Makefile | 3 ++-
> arch/arm/mach-bcm/Kconfig | 8 ++++----
> 3 files changed, 14 insertions(+), 7 deletions(-)

I noticed a minor bug in this commit, that the dts/Makefile hunk should
be in the Pi2 DT patch, instead. Otherwise the -soc branch for
submitting this doesn't build on its own before the merge of all the
branches together.


Attachments:
signature.asc (818.00 B)