2013-10-08 12:24:46

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 0/8] ARM: Initial support for Marvell Berlin SoCs

This patch set add initial support for Marvell Berlin SoCs (88DE3xxx),
e.g. Armada 1000, Armada 1500, Armada 1500-mini. It is based on two
RFCs [1][2] sent earlier.

Currently, initial support just means that the kernel boots on one
CPU, sets up irq, timers, and UART. As Berlin SoCs share some amount
of IP with Marvell PXA/MMP[23] SoCs plus some Synopsys DW IP, I expect
functionality to grow quite quickly.

Compared to last RFC sent, this patch set now depends on ARM's arch-wide
call to of_clk_init [3] plus some fixes already pulled for Synopsys DW
timers [4]. It is based on v3.12-rc4 with those two dependencies pulled
in.

I also prepared a branch for those able to test on a jail-broken GoogleTV
or similar with open boot loader at
https://github.com/shesselba/linux-berlin.git berlin-v1

[1] https://lkml.org/lkml/2013/8/16/626
[2] https://lkml.org/lkml/2013/8/27/608
[3] http://www.spinics.net/lists/arm-kernel/msg276175.html
[4] http://www.spinics.net/lists/arm-kernel/msg277763.html

Sebastian Hesselbarth (8):
irqchip: add DesignWare APB ICTL interrupt controller
MAINTAINERS: add ARM Marvell Berlin SoC
ARM: l2x0: add Marvell Tauros3 compatible
ARM: add Marvell Berlin SoC familiy to Marvell doc
ARM: add Marvell Berlin and Armada 1500 to multi_v7_defconfig
ARM: add Marvell Berlin UART0 lowlevel debug
ARM: add Armada 1500 and Sony NSZ-GS7 device tree files
ARM: add initial support for Marvell Berlin SoCs

Documentation/arm/Marvell/README | 29 +++
Documentation/devicetree/bindings/arm/l2cc.txt | 22 +-
.../devicetree/bindings/arm/marvell,berlin.txt | 23 ++
.../interrupt-controller/snps,dw-apb-ictl.txt | 29 +++
MAINTAINERS | 6 +
arch/arm/Kconfig | 2 +
arch/arm/Kconfig.debug | 10 +
arch/arm/Makefile | 1 +
arch/arm/boot/dts/Makefile | 2 +
arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts | 29 +++
arch/arm/boot/dts/mv88de3100.dtsi | 227 ++++++++++++++++++++
arch/arm/configs/multi_v7_defconfig | 2 +
arch/arm/mach-berlin/Kconfig | 24 +++
arch/arm/mach-berlin/Makefile | 1 +
arch/arm/mach-berlin/berlin.c | 39 ++++
arch/arm/mm/cache-l2x0.c | 1 +
drivers/irqchip/Kconfig | 4 +
drivers/irqchip/Makefile | 1 +
drivers/irqchip/irq-dw-apb-ictl.c | 142 ++++++++++++
19 files changed, 583 insertions(+), 11 deletions(-)
create mode 100644 Documentation/devicetree/bindings/arm/marvell,berlin.txt
create mode 100644 Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
create mode 100644 arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts
create mode 100644 arch/arm/boot/dts/mv88de3100.dtsi
create mode 100644 arch/arm/mach-berlin/Kconfig
create mode 100644 arch/arm/mach-berlin/Makefile
create mode 100644 arch/arm/mach-berlin/berlin.c
create mode 100644 drivers/irqchip/irq-dw-apb-ictl.c

---
Cc: Jason Cooper <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: [email protected]
Cc: [email protected]
--
1.7.10.4


2013-10-08 12:24:50

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 6/8] ARM: add Marvell Berlin UART0 lowlevel debug

This adds UART0 as found on Marvell 88DE3xxx SoCs, e.g. Armada 1500
to the list of possible lowlevel debug options.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Reviewed-by: Jason Cooper <[email protected]>
Reviewed-by: Thomas Petazzoni <[email protected]>
Reviewed-by: Arnd Bergmann <[email protected]>
---
Changelog:
RFCv1->RFCv2:
- have separate DEBUG option due to separate mach- directory

Cc: Jason Cooper <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/Kconfig.debug | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 9762c84..712a96a 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -94,6 +94,14 @@ choice
depends on ARCH_BCM2835
select DEBUG_UART_PL01X

+ config DEBUG_BERLIN_UART
+ bool "Marvell Berlin (88DE3xxx) Debug UART"
+ depends on ARCH_BERLIN
+ select DEBUG_UART_8250
+ help
+ Say Y here if you want kernel low-level debugging support
+ on Marvell Berlin (88DE3xxx) based platforms.
+
config DEBUG_CLPS711X_UART1
bool "Kernel low-level debugging messages via UART1"
depends on ARCH_CLPS711X
@@ -973,6 +981,7 @@ config DEBUG_UART_PHYS
default 0xf1012000 if DEBUG_MVEBU_UART_ALTERNATE
default 0xf1012000 if ARCH_DOVE || ARCH_KIRKWOOD || ARCH_MV78XX0 || \
ARCH_ORION5X
+ default 0xf7fc9000 if DEBUG_BERLIN_UART
default 0xf8b00000 if DEBUG_HI3716_UART
default 0xfcb00000 if DEBUG_HI3620_UART
default 0xfe800000 if ARCH_IOP32X
@@ -997,6 +1006,7 @@ config DEBUG_UART_VIRT
default 0xf2100000 if DEBUG_PXA_UART1
default 0xf4090000 if ARCH_LPC32XX
default 0xf4200000 if ARCH_GEMINI
+ default 0xf7fc9000 if DEBUG_BERLIN_UART
default 0xf8009000 if DEBUG_VEXPRESS_UART0_CA9
default 0xf8090000 if DEBUG_VEXPRESS_UART0_RS1
default 0xfb009000 if DEBUG_REALVIEW_STD_PORT
--
1.7.10.4

2013-10-08 12:24:53

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 5/8] ARM: add Marvell Berlin and Armada 1500 to multi_v7_defconfig

This adds the Marvell Berlin (88DE3xxx) SoC family and Marvell Armada 1500
(88DE3100) to the multi_v7_defconfig.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Reviewed-by: Jason Cooper <[email protected]>
Reviewed-by: Thomas Petazzoni <[email protected]>
Reviewed-by: Arnd Bergmann <[email protected]>
---
Cc: Jason Cooper <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Russell King <[email protected]>
Cc: Olof Johansson <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/configs/multi_v7_defconfig | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 119fc37..bc12fc3 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -6,6 +6,8 @@ CONFIG_ARCH_MVEBU=y
CONFIG_MACH_ARMADA_370=y
CONFIG_MACH_ARMADA_XP=y
CONFIG_ARCH_BCM=y
+CONFIG_ARCH_BERLIN=y
+CONFIG_MACH_MV88DE3100=y
CONFIG_GPIO_PCA953X=y
CONFIG_ARCH_HIGHBANK=y
CONFIG_ARCH_KEYSTONE=y
--
1.7.10.4

2013-10-08 12:25:25

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 8/8] ARM: add initial support for Marvell Berlin SoCs

This adds initial support for the Marvell Berlin (88DE3xxx) SoC family
and basic machine setup for Armada 1500 (88DE3100) SoCs.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Reviewed-by: Jason Cooper <[email protected]>
Reviewed-by: Thomas Petazzoni <[email protected]>
Reviewed-by: Arnd Bergmann <[email protected]>
---
Changelog:
RFCv2->v1:
- remove custom .init_time, adds dependency for arch-wide of_clk_init call
RFCv1->RFCv2:
- nuke .map_io (Reported by Arnd Bergmann)
- add copyright reference
- switch to mach-berlin instead of mach-mvebu

Cc: Jason Cooper <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Russell King <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/Kconfig | 2 ++
arch/arm/Makefile | 1 +
arch/arm/mach-berlin/Kconfig | 24 ++++++++++++++++++++++++
arch/arm/mach-berlin/Makefile | 1 +
arch/arm/mach-berlin/berlin.c | 39 +++++++++++++++++++++++++++++++++++++++
5 files changed, 67 insertions(+)
create mode 100644 arch/arm/mach-berlin/Kconfig
create mode 100644 arch/arm/mach-berlin/Makefile
create mode 100644 arch/arm/mach-berlin/berlin.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1ad6fb6..5692426 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -932,6 +932,8 @@ source "arch/arm/mach-bcm/Kconfig"

source "arch/arm/mach-bcm2835/Kconfig"

+source "arch/arm/mach-berlin/Kconfig"
+
source "arch/arm/mach-clps711x/Kconfig"

source "arch/arm/mach-cns3xxx/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index a37a50f..3ba332b 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -147,6 +147,7 @@ textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
machine-$(CONFIG_ARCH_AT91) += at91
machine-$(CONFIG_ARCH_BCM) += bcm
machine-$(CONFIG_ARCH_BCM2835) += bcm2835
+machine-$(CONFIG_ARCH_BERLIN) += berlin
machine-$(CONFIG_ARCH_CLPS711X) += clps711x
machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx
machine-$(CONFIG_ARCH_DAVINCI) += davinci
diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig
new file mode 100644
index 0000000..56a671e
--- /dev/null
+++ b/arch/arm/mach-berlin/Kconfig
@@ -0,0 +1,24 @@
+config ARCH_BERLIN
+ bool "Marvell Berlin (88DE3xxx) SoCs" if ARCH_MULTI_V7
+ select GENERIC_CLOCKEVENTS
+ select GENERIC_IRQ_CHIP
+ select COMMON_CLK
+ select DW_APB_ICTL
+ select DW_APB_TIMER_OF
+
+if ARCH_BERLIN
+
+menu "Marvell Berlin (88DE3xxx) SoC variants"
+
+config MACH_MV88DE3100
+ bool "Marvell 88DE3100 (Armada 1500)"
+ select ARM_GIC
+ select CACHE_L2X0
+ select CPU_PJ4B
+ select HAVE_ARM_TWD if LOCAL_TIMERS
+ select HAVE_SMP
+ select LOCAL_TIMERS if SMP
+
+endmenu
+
+endif
diff --git a/arch/arm/mach-berlin/Makefile b/arch/arm/mach-berlin/Makefile
new file mode 100644
index 0000000..ab69fe9
--- /dev/null
+++ b/arch/arm/mach-berlin/Makefile
@@ -0,0 +1 @@
+obj-y += berlin.o
diff --git a/arch/arm/mach-berlin/berlin.c b/arch/arm/mach-berlin/berlin.c
new file mode 100644
index 0000000..54b3ba7
--- /dev/null
+++ b/arch/arm/mach-berlin/berlin.c
@@ -0,0 +1,39 @@
+/*
+ * Device Tree support for Marvell Berlin (88DE3xxx) platforms.
+ *
+ * Sebastian Hesselbarth <[email protected]>
+ *
+ * based on GPL'ed 2.6 kernel sources
+ * (c) Marvell International Ltd.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/of_platform.h>
+#include <asm/hardware/cache-l2x0.h>
+#include <asm/mach/arch.h>
+
+static void __init berlin_init_machine(void)
+{
+ /*
+ * with DT probing for L2CCs, berlin_init_machine can be removed.
+ * Note: 88DE3005 (Armada 1500-mini) uses pl310 l2cc
+ */
+ l2x0_of_init(0x70c00000, 0xfeffffff);
+ of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char * const berlin_dt_compat[] = {
+ "marvell,berlin",
+ NULL,
+};
+
+DT_MACHINE_START(BERLIN_DT, "Marvell Berlin (88DE3xxx)")
+ .dt_compat = berlin_dt_compat,
+ .init_machine = berlin_init_machine,
+MACHINE_END
--
1.7.10.4

2013-10-08 12:25:23

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 7/8] ARM: add Armada 1500 and Sony NSZ-GS7 device tree files

This adds very basic device tree files for the Marvell Armada 1500 SoC
(88DE3100) and the Sony NSZ-GS7 GoogleTV board. Currently, SoC only has
nodes for cpus, some clocks, l2 cache controller, local timer, apb timers,
uart, and interrupt controllers. The Sony NSZ-GS7 is a GoogleTV consumer
device comprising the Armada 1500 SoC above.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Reviewed-by: Jason Cooper <[email protected]>
Reviewed-by: Thomas Petazzoni <[email protected]>
Reviewed-by: Arnd Bergmann <[email protected]>
---
Changelog:
RCFv2->v1:
- switch to (soon to be) correct "marvell,pj4b" cpu compatible
- reference fixed-clock for uarts instead of hard-coded clock-frequency
- disable timers except two for clksrc and clkevt
RFCv1->RFCv2:
- add binding documentation (Reported by Jason Cooper)
- change l2cc from aurora to tauros3 (Reported by Thomas Petazzoni)
- add copyright reference
- adapt compatibles to mach-berlin instead of mach-mvebu

Cc: Jason Cooper <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
.../devicetree/bindings/arm/marvell,berlin.txt | 23 ++
arch/arm/boot/dts/Makefile | 2 +
arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts | 29 +++
arch/arm/boot/dts/mv88de3100.dtsi | 227 ++++++++++++++++++++
4 files changed, 281 insertions(+)
create mode 100644 Documentation/devicetree/bindings/arm/marvell,berlin.txt
create mode 100644 arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts
create mode 100644 arch/arm/boot/dts/mv88de3100.dtsi

diff --git a/Documentation/devicetree/bindings/arm/marvell,berlin.txt b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
new file mode 100644
index 0000000..e389cba
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
@@ -0,0 +1,23 @@
+Marvell Berlin (88DE3xxx) family SoCs Device Tree Bindings
+---------------------------------------------------------------
+
+Boards with a SoC of the Marvell Berlin (88DE3xxx) family, e.g. Armada 1500
+shall have the following properties:
+
+* Required root node properties:
+compatible: must contain "marvell,berlin"
+
+In addition, the above compatible shall be extended with the specific
+SoC and board used. Currently known SoC compatibles are:
+ "marvell,88de3100" for Marvell 88DE3100 (Armada 1500),
+ "marvell,88de3010" for Marvell 88DE3010 (Armada 1000),
+ "marvell,88de3005" for Marvell 88DE3005 (Armada 1500-mini)
+
+* Example:
+
+/ {
+ model = "Sony NSZ-GS7";
+ compatible = "sony,nsz-gs7", "marvell,88de3100", "marvell,berlin";
+
+ ...
+}
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 802720e..e86933a 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -46,6 +46,8 @@ dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb
dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
dtb-$(CONFIG_ARCH_BCM) += bcm11351-brt.dtb \
bcm28155-ap.dtb
+dtb-$(CONFIG_ARCH_BERLIN) += \
+ mv88de3100-sony-nsz-gs7.dtb
dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \
da850-evm.dtb
dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \
diff --git a/arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts b/arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts
new file mode 100644
index 0000000..81025ce
--- /dev/null
+++ b/arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts
@@ -0,0 +1,29 @@
+/*
+ * Device Tree file for Sony NSZ-GS7
+ *
+ * Sebastian Hesselbarth <[email protected]>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+/dts-v1/;
+
+#include "mv88de3100.dtsi"
+
+/ {
+ model = "Sony NSZ-GS7";
+ compatible = "sony,nsz-gs7", "marvell,88de3100", "marvell,berlin";
+
+ chosen {
+ bootargs = "console=ttyS0,115200 earlyprintk";
+ };
+
+ memory {
+ device_type = "memory";
+ reg = <0x00000000 0x40000000>; /* 1 GB */
+ };
+};
+
+&uart0 { status = "okay"; };
diff --git a/arch/arm/boot/dts/mv88de3100.dtsi b/arch/arm/boot/dts/mv88de3100.dtsi
new file mode 100644
index 0000000..d434015
--- /dev/null
+++ b/arch/arm/boot/dts/mv88de3100.dtsi
@@ -0,0 +1,227 @@
+/*
+ * Device Tree Include file for Marvell 88DE3100 (Armada 1500) SoC
+ *
+ * Sebastian Hesselbarth <[email protected]>
+ *
+ * based on GPL'ed 2.6 kernel sources
+ * (c) Marvell International Ltd.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include "skeleton.dtsi"
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+ model = "Marvell 88DE3100 (Armada 1500) SoC";
+ compatible = "marvell,88de3100", "marvell,berlin";
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ cpu@0 {
+ compatible = "marvell,pj4b";
+ device_type = "cpu";
+ next-level-cache = <&l2>;
+ reg = <0>;
+ };
+
+ cpu@1 {
+ compatible = "marvell,pj4b";
+ device_type = "cpu";
+ next-level-cache = <&l2>;
+ reg = <1>;
+ };
+ };
+
+ clocks {
+ smclk: sysmgr-clock {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <25000000>;
+ };
+
+ cfgclk: cfg-clock {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <100000000>;
+ };
+
+ sysclk: system-clock {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <400000000>;
+ };
+ };
+
+ soc {
+ compatible = "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ interrupt-parent = <&gic>;
+
+ ranges = <0 0xf7000000 0x1000000>;
+
+ l2: l2-cache-controller@ac0000 {
+ compatible = "marvell,tauros3-cache";
+ reg = <0xac0000 0x1000>;
+ cache-unified;
+ cache-level = <2>;
+ };
+
+ gic: interrupt-controller@ad1000 {
+ compatible = "arm,cortex-a9-gic";
+ reg = <0xad1000 0x1000>, <0xad0100 0x0100>;
+ interrupt-controller;
+ #interrupt-cells = <3>;
+ };
+
+ local-timer@ad0600 {
+ compatible = "arm,cortex-a9-twd-timer";
+ reg = <0xad0600 0x20>;
+ interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&sysclk>;
+ };
+
+ apb@e80000 {
+ compatible = "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ ranges = <0 0xe80000 0x10000>;
+ interrupt-parent = <&aic>;
+
+ timer0: timer@2c00 {
+ compatible = "snps,dw-apb-timer";
+ reg = <0x2c00 0x14>;
+ interrupts = <8>;
+ clocks = <&cfgclk>;
+ clock-names = "timer";
+ status = "okay";
+ };
+
+ timer1: timer@2c14 {
+ compatible = "snps,dw-apb-timer";
+ reg = <0x2c14 0x14>;
+ interrupts = <9>;
+ clocks = <&cfgclk>;
+ clock-names = "timer";
+ status = "okay";
+ };
+
+ timer2: timer@2c28 {
+ compatible = "snps,dw-apb-timer";
+ reg = <0x2c28 0x14>;
+ interrupts = <10>;
+ clocks = <&cfgclk>;
+ clock-names = "timer";
+ status = "disabled";
+ };
+
+ timer3: timer@2c3c {
+ compatible = "snps,dw-apb-timer";
+ reg = <0x2c3c 0x14>;
+ interrupts = <11>;
+ clocks = <&cfgclk>;
+ clock-names = "timer";
+ status = "disabled";
+ };
+
+ timer4: timer@2c50 {
+ compatible = "snps,dw-apb-timer";
+ reg = <0x2c50 0x14>;
+ interrupts = <12>;
+ clocks = <&cfgclk>;
+ clock-names = "timer";
+ status = "disabled";
+ };
+
+ timer5: timer@2c64 {
+ compatible = "snps,dw-apb-timer";
+ reg = <0x2c64 0x14>;
+ interrupts = <13>;
+ clocks = <&cfgclk>;
+ clock-names = "timer";
+ status = "disabled";
+ };
+
+ timer6: timer@2c78 {
+ compatible = "snps,dw-apb-timer";
+ reg = <0x2c78 0x14>;
+ interrupts = <14>;
+ clocks = <&cfgclk>;
+ clock-names = "timer";
+ status = "disabled";
+ };
+
+ timer7: timer@2c8c {
+ compatible = "snps,dw-apb-timer";
+ reg = <0x2c8c 0x14>;
+ interrupts = <15>;
+ clocks = <&cfgclk>;
+ clock-names = "timer";
+ status = "disabled";
+ };
+
+ aic: interrupt-controller@3000 {
+ compatible = "snps,dw-apb-ictl";
+ reg = <0x3000 0xc00>;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ interrupt-parent = <&gic>;
+ interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
+ };
+ };
+
+ apb@fc0000 {
+ compatible = "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ ranges = <0 0xfc0000 0x10000>;
+ interrupt-parent = <&sic>;
+
+ uart0: serial@9000 {
+ compatible = "snps,dw-apb-uart";
+ reg = <0x9000 0x100>;
+ reg-shift = <2>;
+ reg-io-width = <1>;
+ interrupts = <8>;
+ clocks = <&smclk>;
+ status = "disabled";
+ };
+
+ uart1: serial@a000 {
+ compatible = "snps,dw-apb-uart";
+ reg = <0xa000 0x100>;
+ reg-shift = <2>;
+ reg-io-width = <1>;
+ interrupts = <9>;
+ clocks = <&smclk>;
+ status = "disabled";
+ };
+
+ uart2: serial@b000 {
+ compatible = "snps,dw-apb-uart";
+ reg = <0xb000 0x100>;
+ reg-shift = <2>;
+ reg-io-width = <1>;
+ interrupts = <10>;
+ clocks = <&smclk>;
+ status = "disabled";
+ };
+
+ sic: interrupt-controller@e000 {
+ compatible = "snps,dw-apb-ictl";
+ reg = <0xe000 0x400>;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ interrupt-parent = <&gic>;
+ interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
+ };
+ };
+ };
+};
--
1.7.10.4

2013-10-08 12:25:56

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 4/8] ARM: add Marvell Berlin SoC familiy to Marvell doc

This adds known facts and rumors about the Marvell Berlin (88DE3xxx) SoC
family to the Marvell SoC documentation.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Reviewed-by: Jason Cooper <[email protected]>
Reviewed-by: Thomas Petazzoni <[email protected]>
Reviewed-by: Arnd Bergmann <[email protected]>
---
Changelog:
RFCv2->v1:
- move Berlin below PXA/MMP[23] where it belongs to
- add note about IP (re-)used in Berlin SoCs
RFCv1->RFCv2:
- initial patch

Cc: Jason Cooper <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Rob Landley <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
Documentation/arm/Marvell/README | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)

diff --git a/Documentation/arm/Marvell/README b/Documentation/arm/Marvell/README
index 8f08a86..993c45d 100644
--- a/Documentation/arm/Marvell/README
+++ b/Documentation/arm/Marvell/README
@@ -210,6 +210,35 @@ MMP/MMP2 family (communication processor)
Linux kernel mach directory: arch/arm/mach-mmp
Linux kernel plat directory: arch/arm/plat-pxa

+Berlin family (Digital Entertainment)
+-------------------------------------
+
+ Flavors:
+ 88DE3005, Armada 1500-mini
+ Design name: BG2CD(A0)
+ Core: ARM Cortex-A9, PL310 L2CC
+ Homepage: http://www.marvell.com/digital-entertainment/armada-1500-mini/
+ 88DE3010, Armada 1000
+ Design name: BG2(?)
+ Core: Marvell PJ4B (ARMv7), Tauros3 L2CC
+ Product Brief: http://www.marvell.com/digital-entertainment/assets/armada_1000_pb.pdf
+ 88DE3100, Armada 1500
+ Design name: BG2(A0)
+ Core: Marvell PJ4B (ARMv7), Tauros3 L2CC
+ Homepage: http://www.marvell.com/digital-entertainment/armada-1500/
+ Product Brief: http://www.marvell.com/digital-entertainment/armada-1500/assets/Marvell-ARMADA-1500-Product-Brief.pdf
+ 88DE????
+ Design name: BG3
+ Core: ARM Cortex-A15, CA15 integrated L2CC
+
+ Homepage: http://www.marvell.com/digital-entertainment/
+ Directory: arch/arm/mach-berlin
+
+ Comments:
+ * This line of SoCs is based on Marvell Sheeva or ARM Cortex CPUs
+ with Synopsys DesignWare (IRQ, GPIO, Timers, ...) and PXA IP (SDHCI, USB, ETH, ...).
+ * Currently known design names are: C2, BG2(Z1), BG2(A0), BG2CD(A0), BG2CT(A0)
+
Long-term plans
---------------

--
1.7.10.4

2013-10-08 12:26:18

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 1/8] irqchip: add DesignWare APB ICTL interrupt controller

This adds an irqchip driver and corresponding devicetree binding for the
secondary interrupt controllers based on Synopsys DesignWare IP dw_apb_ictl.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Changelog:
RFCv1->RFCv2:
- added copyright reference

Cc: Jason Cooper <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
.../interrupt-controller/snps,dw-apb-ictl.txt | 29 ++++
drivers/irqchip/Kconfig | 4 +
drivers/irqchip/Makefile | 1 +
drivers/irqchip/irq-dw-apb-ictl.c | 142 ++++++++++++++++++++
4 files changed, 176 insertions(+)
create mode 100644 Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
create mode 100644 drivers/irqchip/irq-dw-apb-ictl.c

diff --git a/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt b/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
new file mode 100644
index 0000000..7ccd1ba
--- /dev/null
+++ b/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
@@ -0,0 +1,29 @@
+Synopsys DesignWare APB interrupt controller (dw_apb_ictl)
+
+Synopsys DesignWare provides interrupt controller IP for APB known as
+dw_apb_ictl. The IP is used as secondary interrupt controller in some SoCs with
+APB bus, e.g. Marvell Armada 1500.
+
+Required properties:
+- compatible: shall be "snps,dw-apb-ictl"
+- reg: base address of interrupt registers starting with ENABLE_LOW register
+- interrupt-controller: identifies the node as an interrupt controller
+- #interrupt-cells: number of cells to encode an interrupt source, shall be 1
+- interrupts: interrupt reference to primary interrupt controller
+- interrupt-parent: (optional) reference specific primary interrupt controller
+
+The interrupt sources map to the corresponding bits in the interrupt
+registers, i.e.
+- 0 maps to bit 0 of low interrupts,
+- 1 maps to bit 1 of low interrupts,
+- 32 maps to bit 0 of high interrupts, and so on.
+
+Example:
+ aic: interrupt-controller@3000 {
+ compatible = "snps,dw-apb-ictl";
+ reg = <0x3000 0xc00>;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ interrupt-parent = <&gic>;
+ interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
+ };
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 3792a1a..940638d 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -30,6 +30,10 @@ config ARM_VIC_NR
The maximum number of VICs available in the system, for
power management.

+config DW_APB_ICTL
+ bool
+ select IRQ_DOMAIN
+
config IMGPDC_IRQ
bool
select GENERIC_IRQ_CHIP
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index c60b901..6427323 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_ARCH_MMP) += irq-mmp.o
obj-$(CONFIG_ARCH_MVEBU) += irq-armada-370-xp.o
obj-$(CONFIG_ARCH_MXS) += irq-mxs.o
obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o
+obj-$(CONFIG_DW_APB_ICTL) += irq-dw-apb-ictl.o
obj-$(CONFIG_METAG) += irq-metag-ext.o
obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o
obj-$(CONFIG_ARCH_MOXART) += irq-moxart.o
diff --git a/drivers/irqchip/irq-dw-apb-ictl.c b/drivers/irqchip/irq-dw-apb-ictl.c
new file mode 100644
index 0000000..bbcacee
--- /dev/null
+++ b/drivers/irqchip/irq-dw-apb-ictl.c
@@ -0,0 +1,142 @@
+/*
+ * Synopsys DW APB ICTL irqchip driver.
+ *
+ * Sebastian Hesselbarth <[email protected]>
+ *
+ * based on GPL'ed 2.6 kernel sources
+ * (c) Marvell International Ltd.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+
+#include "irqchip.h"
+
+#define APB_INT_ENABLE_L 0x00
+#define APB_INT_ENABLE_H 0x04
+#define APB_INT_MASK_L 0x08
+#define APB_INT_MASK_H 0x0c
+#define APB_INT_FINALSTATUS_L 0x30
+#define APB_INT_FINALSTATUS_H 0x34
+
+static void dw_apb_ictl_handler(unsigned int irq, struct irq_desc *desc)
+{
+ struct irq_chip *chip = irq_get_chip(irq);
+ struct irq_chip_generic *gc = irq_get_handler_data(irq);
+ struct irq_domain *d = gc->private;
+ u32 stat;
+ int n;
+
+ chained_irq_enter(chip, desc);
+
+ for (n = 0; n < gc->num_ct; n++) {
+ stat = readl_relaxed(gc->reg_base +
+ APB_INT_FINALSTATUS_L + 4 * n);
+ while (stat) {
+ u32 hwirq = ffs(stat) - 1;
+ generic_handle_irq(irq_find_mapping(d,
+ gc->irq_base + hwirq + 32 * n));
+ stat &= ~(1 << hwirq);
+ }
+ }
+
+ chained_irq_exit(chip, desc);
+}
+
+static int __init dw_apb_ictl_init(struct device_node *np,
+ struct device_node *parent)
+{
+ unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
+ struct resource r;
+ struct irq_domain *domain;
+ struct irq_chip_generic *gc;
+ void __iomem *iobase;
+ int ret, nrirqs, irq;
+ u32 reg;
+
+ /* Map the parent interrupt for the chained handler */
+ irq = irq_of_parse_and_map(np, 0);
+ if (irq <= 0) {
+ pr_err("%s: unable to parse irq\n", np->name);
+ return -EINVAL;
+ }
+
+ ret = of_address_to_resource(np, 0, &r);
+ if (ret) {
+ pr_err("%s: unable to get resource\n", np->name);
+ return ret;
+ }
+
+ if (!request_mem_region(r.start, resource_size(&r), np->name)) {
+ pr_err("%s: unable to request mem region\n", np->name);
+ return -ENOMEM;
+ }
+
+ iobase = ioremap(r.start, resource_size(&r));
+ if (!iobase) {
+ pr_err("%s: unable to map resource\n", np->name);
+ return -ENOMEM;
+ }
+
+ /*
+ * DW IP can be configured to allow 2-64 irqs. We can determine
+ * the number of irqs supported by writing into enable register
+ * and look for bits not set, as corresponding flip-flops will
+ * have been removed by sythesis tool.
+ */
+
+ /* mask and enable all interrupts */
+ writel(~0, iobase + APB_INT_MASK_L);
+ writel(~0, iobase + APB_INT_MASK_H);
+ writel(~0, iobase + APB_INT_ENABLE_L);
+ writel(~0, iobase + APB_INT_ENABLE_H);
+
+ reg = readl(iobase + APB_INT_ENABLE_H);
+ if (reg)
+ nrirqs = 32 + fls(reg);
+ else
+ nrirqs = fls(readl(iobase + APB_INT_ENABLE_L));
+
+ domain = irq_domain_add_linear(np, nrirqs,
+ &irq_generic_chip_ops, NULL);
+ if (!domain) {
+ pr_err("%s: unable to add irq domain\n", np->name);
+ return -ENOMEM;
+ }
+
+ ret = irq_alloc_domain_generic_chips(domain, 32, (nrirqs > 32) ? 2 : 1,
+ np->name, handle_level_irq, clr, 0,
+ IRQ_GC_INIT_MASK_CACHE);
+ if (ret) {
+ pr_err("%s: unable to alloc irq domain gc\n", np->name);
+ return ret;
+ }
+
+ gc = irq_get_domain_generic_chip(domain, 0);
+ gc->private = domain;
+ gc->reg_base = iobase;
+
+ gc->chip_types[0].regs.mask = APB_INT_MASK_L;
+ gc->chip_types[0].chip.irq_mask = irq_gc_mask_set_bit;
+ gc->chip_types[0].chip.irq_unmask = irq_gc_mask_clr_bit;
+
+ if (nrirqs > 32) {
+ gc->chip_types[1].regs.mask = APB_INT_MASK_H;
+ gc->chip_types[1].chip.irq_mask = irq_gc_mask_set_bit;
+ gc->chip_types[1].chip.irq_unmask = irq_gc_mask_clr_bit;
+ }
+
+ irq_set_handler_data(irq, gc);
+ irq_set_chained_handler(irq, dw_apb_ictl_handler);
+
+ return 0;
+}
+IRQCHIP_DECLARE(dw_apb_ictl,
+ "snps,dw-apb-ictl", dw_apb_ictl_init);
--
1.7.10.4

2013-10-08 12:26:15

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 3/8] ARM: l2x0: add Marvell Tauros3 compatible

This add a compatible for the Marvell Tauros3 cache controller which
is compatible with l2x0 cache controllers. While updating the binding
documentation, clean up the list of possible compatibles.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Jason Cooper <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
Documentation/devicetree/bindings/arm/l2cc.txt | 22 +++++++++++-----------
arch/arm/mm/cache-l2x0.c | 1 +
2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2cc.txt
index c0c7626..a1d0cbd 100644
--- a/Documentation/devicetree/bindings/arm/l2cc.txt
+++ b/Documentation/devicetree/bindings/arm/l2cc.txt
@@ -7,20 +7,20 @@ The ARM L2 cache representation in the device tree should be done as follows:
Required properties:

- compatible : should be one of:
- "arm,pl310-cache"
- "arm,l220-cache"
- "arm,l210-cache"
- "marvell,aurora-system-cache": Marvell Controller designed to be
+ "arm,pl310-cache"
+ "arm,l220-cache"
+ "arm,l210-cache"
+ "bcm,bcm11351-a2-pl310-cache": DEPRECATED by "brcm,bcm11351-a2-pl310-cache"
+ "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
+ offset needs to be added to the address before passing down to the L2
+ cache controller
+ "marvell,aurora-system-cache": Marvell Controller designed to be
compatible with the ARM one, with system cache mode (meaning
maintenance operations on L1 are broadcasted to the L2 and L2
performs the same operation).
- "marvell,"aurora-outer-cache: Marvell Controller designed to be
- compatible with the ARM one with outer cache mode.
- "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
- offset needs to be added to the address before passing down to the L2
- cache controller
- "bcm,bcm11351-a2-pl310-cache": DEPRECATED by
- "brcm,bcm11351-a2-pl310-cache"
+ "marvell,aurora-outer-cache": Marvell Controller designed to be
+ compatible with the ARM one with outer cache mode.
+ "marvell,tauros3-cache": Marvell Tauros3 cache controller.
- cache-unified : Specifies the cache is a unified cache.
- cache-level : Should be set to 2 for a level 2 cache.
- reg : Physical base address and size of cache controller's memory mapped
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 447da6f..90c776e 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -929,6 +929,7 @@ static const struct of_device_id l2x0_ids[] __initconst = {
.data = (void *)&aurora_no_outer_data},
{ .compatible = "marvell,aurora-outer-cache",
.data = (void *)&aurora_with_outer_data},
+ { .compatible = "marvell,tauros3-cache", .data = (void *)&l2x0_data },
{ .compatible = "brcm,bcm11351-a2-pl310-cache",
.data = (void *)&bcm_l2x0_data},
{ .compatible = "bcm,bcm11351-a2-pl310-cache", /* deprecated name */
--
1.7.10.4

2013-10-08 12:26:44

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH 2/8] MAINTAINERS: add ARM Marvell Berlin SoC

This adds Marvell Berlin SoC to the list of maintainers. I am taking
maintainership for arch/arm/mach-berlin/.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Cc: Jason Cooper <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
MAINTAINERS | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8a0cbf3..7964fe4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1013,6 +1013,12 @@ L: [email protected] (moderated for non-subscribers)
S: Maintained
F: arch/arm/mach-mvebu/

+ARM/Marvell Berlin SoC support
+M: Sebastian Hesselbarth <[email protected]>
+L: [email protected] (moderated for non-subscribers)
+S: Maintained
+F: arch/arm/mach-berlin/
+
ARM/Marvell Dove/Kirkwood/MV78xx0/Orion SOC support
M: Jason Cooper <[email protected]>
M: Andrew Lunn <[email protected]>
--
1.7.10.4

2013-10-08 13:25:01

by Mark Rutland

[permalink] [raw]
Subject: Re: [PATCH 1/8] irqchip: add DesignWare APB ICTL interrupt controller

On Tue, Oct 08, 2013 at 01:24:26PM +0100, Sebastian Hesselbarth wrote:
> This adds an irqchip driver and corresponding devicetree binding for the
> secondary interrupt controllers based on Synopsys DesignWare IP dw_apb_ictl.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> ---
> Changelog:
> RFCv1->RFCv2:
> - added copyright reference
>
> Cc: Jason Cooper <[email protected]>
> Cc: Thomas Petazzoni <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Thomas Gleixner <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> ---
> .../interrupt-controller/snps,dw-apb-ictl.txt | 29 ++++
> drivers/irqchip/Kconfig | 4 +
> drivers/irqchip/Makefile | 1 +
> drivers/irqchip/irq-dw-apb-ictl.c | 142 ++++++++++++++++++++
> 4 files changed, 176 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
> create mode 100644 drivers/irqchip/irq-dw-apb-ictl.c
>
> diff --git a/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt b/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
> new file mode 100644
> index 0000000..7ccd1ba
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
> @@ -0,0 +1,29 @@
> +Synopsys DesignWare APB interrupt controller (dw_apb_ictl)
> +
> +Synopsys DesignWare provides interrupt controller IP for APB known as
> +dw_apb_ictl. The IP is used as secondary interrupt controller in some SoCs with
> +APB bus, e.g. Marvell Armada 1500.
> +
> +Required properties:
> +- compatible: shall be "snps,dw-apb-ictl"
> +- reg: base address of interrupt registers starting with ENABLE_LOW register

Is ENABLE_LOW the first register? Or are there registers before?

Is there only one bank of registers that needs to be defined?

This isn't just a base address, as it has a size too. The terminology's
rather inconsistent for reg properties in general...

> +- interrupt-controller: identifies the node as an interrupt controller
> +- #interrupt-cells: number of cells to encode an interrupt source, shall be 1

s/interrupt source/interrupt-specifier/

> +- interrupts: interrupt reference to primary interrupt controller

- interrupts: interrupts specifier for the sole interrupt fed to the
parent interrupt controller.

Is there only a single output interrupt?

Is this required? Is it possible for this to be wired directly into a
CPU rather than another interrupt controller?

> +- interrupt-parent: (optional) reference specific primary interrupt controller
> +
> +The interrupt sources map to the corresponding bits in the interrupt
> +registers, i.e.
> +- 0 maps to bit 0 of low interrupts,
> +- 1 maps to bit 1 of low interrupts,
> +- 32 maps to bit 0 of high interrupts, and so on.

I couldn't see any public documentation for this, so I can't really
follow the "and so on", but I saw that this had optional FIQ support so
I assume there are more interrupt values that can be encoded?

> +
> +Example:
> + aic: interrupt-controller@3000 {
> + compatible = "snps,dw-apb-ictl";
> + reg = <0x3000 0xc00>;
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + interrupt-parent = <&gic>;
> + interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
> + };
> diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
> index 3792a1a..940638d 100644
> --- a/drivers/irqchip/Kconfig
> +++ b/drivers/irqchip/Kconfig
> @@ -30,6 +30,10 @@ config ARM_VIC_NR
> The maximum number of VICs available in the system, for
> power management.
>
> +config DW_APB_ICTL
> + bool
> + select IRQ_DOMAIN
> +
> config IMGPDC_IRQ
> bool
> select GENERIC_IRQ_CHIP
> diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
> index c60b901..6427323 100644
> --- a/drivers/irqchip/Makefile
> +++ b/drivers/irqchip/Makefile
> @@ -6,6 +6,7 @@ obj-$(CONFIG_ARCH_MMP) += irq-mmp.o
> obj-$(CONFIG_ARCH_MVEBU) += irq-armada-370-xp.o
> obj-$(CONFIG_ARCH_MXS) += irq-mxs.o
> obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o
> +obj-$(CONFIG_DW_APB_ICTL) += irq-dw-apb-ictl.o
> obj-$(CONFIG_METAG) += irq-metag-ext.o
> obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o
> obj-$(CONFIG_ARCH_MOXART) += irq-moxart.o
> diff --git a/drivers/irqchip/irq-dw-apb-ictl.c b/drivers/irqchip/irq-dw-apb-ictl.c
> new file mode 100644
> index 0000000..bbcacee
> --- /dev/null
> +++ b/drivers/irqchip/irq-dw-apb-ictl.c
> @@ -0,0 +1,142 @@
> +/*
> + * Synopsys DW APB ICTL irqchip driver.
> + *
> + * Sebastian Hesselbarth <[email protected]>
> + *
> + * based on GPL'ed 2.6 kernel sources
> + * (c) Marvell International Ltd.
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2. This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +#include <linux/io.h>
> +#include <linux/irq.h>
> +#include <linux/irqchip/chained_irq.h>
> +#include <linux/of_address.h>
> +#include <linux/of_irq.h>
> +
> +#include "irqchip.h"
> +
> +#define APB_INT_ENABLE_L 0x00
> +#define APB_INT_ENABLE_H 0x04
> +#define APB_INT_MASK_L 0x08
> +#define APB_INT_MASK_H 0x0c
> +#define APB_INT_FINALSTATUS_L 0x30
> +#define APB_INT_FINALSTATUS_H 0x34
> +
> +static void dw_apb_ictl_handler(unsigned int irq, struct irq_desc *desc)
> +{
> + struct irq_chip *chip = irq_get_chip(irq);
> + struct irq_chip_generic *gc = irq_get_handler_data(irq);
> + struct irq_domain *d = gc->private;
> + u32 stat;
> + int n;
> +
> + chained_irq_enter(chip, desc);
> +
> + for (n = 0; n < gc->num_ct; n++) {
> + stat = readl_relaxed(gc->reg_base +
> + APB_INT_FINALSTATUS_L + 4 * n);
> + while (stat) {
> + u32 hwirq = ffs(stat) - 1;
> + generic_handle_irq(irq_find_mapping(d,
> + gc->irq_base + hwirq + 32 * n));
> + stat &= ~(1 << hwirq);
> + }
> + }
> +
> + chained_irq_exit(chip, desc);
> +}
> +
> +static int __init dw_apb_ictl_init(struct device_node *np,
> + struct device_node *parent)
> +{
> + unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
> + struct resource r;
> + struct irq_domain *domain;
> + struct irq_chip_generic *gc;
> + void __iomem *iobase;
> + int ret, nrirqs, irq;
> + u32 reg;
> +
> + /* Map the parent interrupt for the chained handler */
> + irq = irq_of_parse_and_map(np, 0);
> + if (irq <= 0) {
> + pr_err("%s: unable to parse irq\n", np->name);
> + return -EINVAL;
> + }
> +
> + ret = of_address_to_resource(np, 0, &r);
> + if (ret) {
> + pr_err("%s: unable to get resource\n", np->name);
> + return ret;
> + }
> +
> + if (!request_mem_region(r.start, resource_size(&r), np->name)) {
> + pr_err("%s: unable to request mem region\n", np->name);
> + return -ENOMEM;
> + }
> +
> + iobase = ioremap(r.start, resource_size(&r));
> + if (!iobase) {
> + pr_err("%s: unable to map resource\n", np->name);
> + return -ENOMEM;
> + }

Could you not use of_iomap?

Also, I'd recommend using np->full_name for error messages, as that
gives you the full path for the node, which is far more helpful for
debugging than just the unqualified node name.

> +
> + /*
> + * DW IP can be configured to allow 2-64 irqs. We can determine
> + * the number of irqs supported by writing into enable register
> + * and look for bits not set, as corresponding flip-flops will
> + * have been removed by sythesis tool.
> + */

Is that always true?

Cheers,
Mark.

2013-10-08 13:41:34

by Mark Rutland

[permalink] [raw]
Subject: Re: [PATCH 3/8] ARM: l2x0: add Marvell Tauros3 compatible

On Tue, Oct 08, 2013 at 01:24:28PM +0100, Sebastian Hesselbarth wrote:
> This add a compatible for the Marvell Tauros3 cache controller which
> is compatible with l2x0 cache controllers. While updating the binding
> documentation, clean up the list of possible compatibles.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> ---
> Cc: Jason Cooper <[email protected]>
> Cc: Thomas Petazzoni <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> ---
> Documentation/devicetree/bindings/arm/l2cc.txt | 22 +++++++++++-----------
> arch/arm/mm/cache-l2x0.c | 1 +
> 2 files changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2cc.txt
> index c0c7626..a1d0cbd 100644
> --- a/Documentation/devicetree/bindings/arm/l2cc.txt
> +++ b/Documentation/devicetree/bindings/arm/l2cc.txt
> @@ -7,20 +7,20 @@ The ARM L2 cache representation in the device tree should be done as follows:
> Required properties:
>
> - compatible : should be one of:
> - "arm,pl310-cache"
> - "arm,l220-cache"
> - "arm,l210-cache"
> - "marvell,aurora-system-cache": Marvell Controller designed to be
> + "arm,pl310-cache"
> + "arm,l220-cache"
> + "arm,l210-cache"
> + "bcm,bcm11351-a2-pl310-cache": DEPRECATED by "brcm,bcm11351-a2-pl310-cache"
> + "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
> + offset needs to be added to the address before passing down to the L2
> + cache controller
> + "marvell,aurora-system-cache": Marvell Controller designed to be
> compatible with the ARM one, with system cache mode (meaning
> maintenance operations on L1 are broadcasted to the L2 and L2
> performs the same operation).
> - "marvell,"aurora-outer-cache: Marvell Controller designed to be
> - compatible with the ARM one with outer cache mode.
> - "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
> - offset needs to be added to the address before passing down to the L2
> - cache controller
> - "bcm,bcm11351-a2-pl310-cache": DEPRECATED by
> - "brcm,bcm11351-a2-pl310-cache"
> + "marvell,aurora-outer-cache": Marvell Controller designed to be
> + compatible with the ARM one with outer cache mode.
> + "marvell,tauros3-cache": Marvell Tauros3 cache controller.

How does the tauros3 cache differ from the other caches supported by the
l2x0 driver?

> - cache-unified : Specifies the cache is a unified cache.
> - cache-level : Should be set to 2 for a level 2 cache.
> - reg : Physical base address and size of cache controller's memory mapped
> diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
> index 447da6f..90c776e 100644
> --- a/arch/arm/mm/cache-l2x0.c
> +++ b/arch/arm/mm/cache-l2x0.c
> @@ -929,6 +929,7 @@ static const struct of_device_id l2x0_ids[] __initconst = {
> .data = (void *)&aurora_no_outer_data},
> { .compatible = "marvell,aurora-outer-cache",
> .data = (void *)&aurora_with_outer_data},
> + { .compatible = "marvell,tauros3-cache", .data = (void *)&l2x0_data },

Are we intending to handle this differently later?

Or is it 100% compatible with the pl210 or pl220? We could just require
an entry later in the compatible string list instead...

Cheers,
Mark.

2013-10-08 13:57:54

by Jason Cooper

[permalink] [raw]
Subject: Re: [PATCH 2/8] MAINTAINERS: add ARM Marvell Berlin SoC

On Tue, Oct 08, 2013 at 02:24:27PM +0200, Sebastian Hesselbarth wrote:
> This adds Marvell Berlin SoC to the list of maintainers. I am taking
> maintainership for arch/arm/mach-berlin/.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> ---
> Cc: Jason Cooper <[email protected]>
> Cc: Thomas Petazzoni <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
> MAINTAINERS | 6 ++++++
> 1 file changed, 6 insertions(+)

Acked-by: Jason Cooper <[email protected]>

thx,

Jason.

2013-10-08 15:51:51

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 1/8] irqchip: add DesignWare APB ICTL interrupt controller

On 10/08/2013 03:24 PM, Mark Rutland wrote:
> On Tue, Oct 08, 2013 at 01:24:26PM +0100, Sebastian Hesselbarth wrote:
>> This adds an irqchip driver and corresponding devicetree binding for the
>> secondary interrupt controllers based on Synopsys DesignWare IP dw_apb_ictl.
>>
>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>> ---
[...]
>> diff --git a/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt b/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
>> new file mode 100644
>> index 0000000..7ccd1ba
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
>> @@ -0,0 +1,29 @@
>> +Synopsys DesignWare APB interrupt controller (dw_apb_ictl)
>> +
>> +Synopsys DesignWare provides interrupt controller IP for APB known as
>> +dw_apb_ictl. The IP is used as secondary interrupt controller in some SoCs with
>> +APB bus, e.g. Marvell Armada 1500.
>> +
>> +Required properties:
>> +- compatible: shall be "snps,dw-apb-ictl"
>> +- reg: base address of interrupt registers starting with ENABLE_LOW register
>
> Is ENABLE_LOW the first register? Or are there registers before?

ENABLE_LOW is the first register.

> Is there only one bank of registers that needs to be defined?

The u-boot sources which this driver is based on have registers from
0x00 to 0xe0. So, yes it is one register block.

> This isn't just a base address, as it has a size too. The terminology's
> rather inconsistent for reg properties in general...

Ok, I will reword the reg related property descriptions.

>> +- interrupt-controller: identifies the node as an interrupt controller
>> +- #interrupt-cells: number of cells to encode an interrupt source, shall be 1
>
> s/interrupt source/interrupt-specifier/

Ok.

>> +- interrupts: interrupt reference to primary interrupt controller
>
> - interrupts: interrupts specifier for the sole interrupt fed to the
> parent interrupt controller.
>
> Is there only a single output interrupt?

At least for the SoC I am working with, yes.

> Is this required? Is it possible for this to be wired directly into a
> CPU rather than another interrupt controller?

Again, possible.

In general, for me it is impossible to foresee all possible scenarios
where this DW (!) IP is used in. Based on my current knowledge, this IP
is a secondary interrupt controller with 2-64 normal IRQs and one
upstream irq, FIQs are optional.

Synopsys website isn't a real chatterbox about their IP, googling
"dw_apb_ictl" gives e.g. [1]

[1]
http://kona.ee.pitt.edu/socvlsi/lib/exe/fetch.php?media=dw_digital_ip_quickref.pdf

>> +- interrupt-parent: (optional) reference specific primary interrupt controller
>> +
>> +The interrupt sources map to the corresponding bits in the interrupt
>> +registers, i.e.
>> +- 0 maps to bit 0 of low interrupts,
>> +- 1 maps to bit 1 of low interrupts,
>> +- 32 maps to bit 0 of high interrupts, and so on.
>
> I couldn't see any public documentation for this, so I can't really
> follow the "and so on", but I saw that this had optional FIQ support so
> I assume there are more interrupt values that can be encoded?

Well, there is no public documentation.

As there can be 2-64 normal IRQs, I have chosen to number them according
to their bit position, starting with lower register bit 0 as hwirq 0.
Bit 0 of higher register gives hwirq 32 "and so on".

If FIQs are configured on a specific irq controller, that may give more
than 64 normal IRQs. If someone ever finds this IP with FIQs enabled,
I suggest to put them on 64+n. According to [1], it allows 1-8 optional
FIQs.

>> +Example:
>> + aic: interrupt-controller@3000 {
>> + compatible = "snps,dw-apb-ictl";
>> + reg = <0x3000 0xc00>;
>> + interrupt-controller;
>> + #interrupt-cells = <1>;
>> + interrupt-parent = <&gic>;
>> + interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
>> + };
[...]
>> diff --git a/drivers/irqchip/irq-dw-apb-ictl.c b/drivers/irqchip/irq-dw-apb-ictl.c
>> new file mode 100644
>> index 0000000..bbcacee
>> --- /dev/null
>> +++ b/drivers/irqchip/irq-dw-apb-ictl.c
>> @@ -0,0 +1,142 @@
>> +/*
>> + * Synopsys DW APB ICTL irqchip driver.
>> + *
>> + * Sebastian Hesselbarth <[email protected]>
>> + *
>> + * based on GPL'ed 2.6 kernel sources
>> + * (c) Marvell International Ltd.
>> + *
>> + * This file is licensed under the terms of the GNU General Public
>> + * License version 2. This program is licensed "as is" without any
>> + * warranty of any kind, whether express or implied.
>> + */
>> +
[...]
>> +static int __init dw_apb_ictl_init(struct device_node *np,
>> + struct device_node *parent)
>> +{
>> + unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
>> + struct resource r;
>> + struct irq_domain *domain;
>> + struct irq_chip_generic *gc;
>> + void __iomem *iobase;
>> + int ret, nrirqs, irq;
>> + u32 reg;
>> +
>> + /* Map the parent interrupt for the chained handler */
>> + irq = irq_of_parse_and_map(np, 0);
>> + if (irq <= 0) {
>> + pr_err("%s: unable to parse irq\n", np->name);
>> + return -EINVAL;
>> + }
>> +
>> + ret = of_address_to_resource(np, 0, &r);
>> + if (ret) {
>> + pr_err("%s: unable to get resource\n", np->name);
>> + return ret;
>> + }
>> +
>> + if (!request_mem_region(r.start, resource_size(&r), np->name)) {
>> + pr_err("%s: unable to request mem region\n", np->name);
>> + return -ENOMEM;
>> + }
>> +
>> + iobase = ioremap(r.start, resource_size(&r));
>> + if (!iobase) {
>> + pr_err("%s: unable to map resource\n", np->name);
>> + return -ENOMEM;
>> + }
>
> Could you not use of_iomap?

Sure, but - correct me if I am wrong - while of_iomap just translates
and maps the resource, the above additionally protects the resource
from others mapping it.

> Also, I'd recommend using np->full_name for error messages, as that
> gives you the full path for the node, which is far more helpful for
> debugging than just the unqualified node name.

Ok.

>> +
>> + /*
>> + * DW IP can be configured to allow 2-64 irqs. We can determine
>> + * the number of irqs supported by writing into enable register
>> + * and look for bits not set, as corresponding flip-flops will
>> + * have been removed by sythesis tool.
>> + */
>
> Is that always true?

From my personal experience with hardware description and synthesis
tools, I'd say "yes, it is always true".

Even if it is not true, you register some irqs more than neccessary
and those will never trigger. What you know is, this number will never
be less than the real number of irqs supported.

Usually, for DW IP the number of configured features is somewhere in
the IPs registers. But without any documentation it is really not that
easy to guess the meaning of those bits.

Sebastian

2013-10-08 16:06:06

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 3/8] ARM: l2x0: add Marvell Tauros3 compatible

On 10/08/2013 03:41 PM, Mark Rutland wrote:
> On Tue, Oct 08, 2013 at 01:24:28PM +0100, Sebastian Hesselbarth wrote:
>> This add a compatible for the Marvell Tauros3 cache controller which
>> is compatible with l2x0 cache controllers. While updating the binding
>> documentation, clean up the list of possible compatibles.
>>
>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>> ---
[...]
>> diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2cc.txt
>> index c0c7626..a1d0cbd 100644
>> --- a/Documentation/devicetree/bindings/arm/l2cc.txt
>> +++ b/Documentation/devicetree/bindings/arm/l2cc.txt
>> @@ -7,20 +7,20 @@ The ARM L2 cache representation in the device tree should be done as follows:
>> Required properties:
>>
>> - compatible : should be one of:
>> - "arm,pl310-cache"
>> - "arm,l220-cache"
>> - "arm,l210-cache"
>> - "marvell,aurora-system-cache": Marvell Controller designed to be
>> + "arm,pl310-cache"
>> + "arm,l220-cache"
>> + "arm,l210-cache"
>> + "bcm,bcm11351-a2-pl310-cache": DEPRECATED by "brcm,bcm11351-a2-pl310-cache"
>> + "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
>> + offset needs to be added to the address before passing down to the L2
>> + cache controller
>> + "marvell,aurora-system-cache": Marvell Controller designed to be
>> compatible with the ARM one, with system cache mode (meaning
>> maintenance operations on L1 are broadcasted to the L2 and L2
>> performs the same operation).
>> - "marvell,"aurora-outer-cache: Marvell Controller designed to be
>> - compatible with the ARM one with outer cache mode.
>> - "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
>> - offset needs to be added to the address before passing down to the L2
>> - cache controller
>> - "bcm,bcm11351-a2-pl310-cache": DEPRECATED by
>> - "brcm,bcm11351-a2-pl310-cache"
>> + "marvell,aurora-outer-cache": Marvell Controller designed to be
>> + compatible with the ARM one with outer cache mode.
>> + "marvell,tauros3-cache": Marvell Tauros3 cache controller.
>
> How does the tauros3 cache differ from the other caches supported by the
> l2x0 driver?

[added Gregory to Cc]

Good question. I cannot say at this time. I would have guessed that l2cc
on Armada 1500 and Armada 370/XP are more or less the same, as both use
Marvell's PJ4B CPU. Maybe, Gregory or Thomas can shed some light into
this.

>> - cache-unified : Specifies the cache is a unified cache.
>> - cache-level : Should be set to 2 for a level 2 cache.
>> - reg : Physical base address and size of cache controller's memory mapped
>> diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
>> index 447da6f..90c776e 100644
>> --- a/arch/arm/mm/cache-l2x0.c
>> +++ b/arch/arm/mm/cache-l2x0.c
>> @@ -929,6 +929,7 @@ static const struct of_device_id l2x0_ids[] __initconst = {
>> .data = (void *)&aurora_no_outer_data},
>> { .compatible = "marvell,aurora-outer-cache",
>> .data = (void *)&aurora_with_outer_data},
>> + { .compatible = "marvell,tauros3-cache", .data = (void *)&l2x0_data },
>
> Are we intending to handle this differently later?
>
> Or is it 100% compatible with the pl210 or pl220? We could just require
> an entry later in the compatible string list instead...

No public documentation, no clear answer.

Tauros3 isn't 100% compatible with any of the ARM l2cc above, it has
additional "features" or "bugs" - call it whatever you want.

I am not an l2cc expert, but basically I see two options:
a) use (possibly) wrong existing compatible in current mv88de3100.dtsi
now and fix later.
b) add tauros3 compatible now and add (possible) quirks/marvell-specific
properties later.

IMHO b) is very likely to happen as l2x0_of_init in patch 8/8 already
sets bits, I wasn't able to verify in public ARM l2cc docu.

But again, I am very open for suggestions here.

Sebastian

2013-10-08 16:33:32

by Gregory CLEMENT

[permalink] [raw]
Subject: Re: [PATCH 3/8] ARM: l2x0: add Marvell Tauros3 compatible

On 08/10/2013 18:05, Sebastian Hesselbarth wrote:
> On 10/08/2013 03:41 PM, Mark Rutland wrote:
>> On Tue, Oct 08, 2013 at 01:24:28PM +0100, Sebastian Hesselbarth wrote:
>>> This add a compatible for the Marvell Tauros3 cache controller which
>>> is compatible with l2x0 cache controllers. While updating the binding
>>> documentation, clean up the list of possible compatibles.
>>>
>>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>>> ---
> [...]
>>> diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2cc.txt
>>> index c0c7626..a1d0cbd 100644
>>> --- a/Documentation/devicetree/bindings/arm/l2cc.txt
>>> +++ b/Documentation/devicetree/bindings/arm/l2cc.txt
>>> @@ -7,20 +7,20 @@ The ARM L2 cache representation in the device tree should be done as follows:
>>> Required properties:
>>>
>>> - compatible : should be one of:
>>> - "arm,pl310-cache"
>>> - "arm,l220-cache"
>>> - "arm,l210-cache"
>>> - "marvell,aurora-system-cache": Marvell Controller designed to be
>>> + "arm,pl310-cache"
>>> + "arm,l220-cache"
>>> + "arm,l210-cache"
>>> + "bcm,bcm11351-a2-pl310-cache": DEPRECATED by "brcm,bcm11351-a2-pl310-cache"
>>> + "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
>>> + offset needs to be added to the address before passing down to the L2
>>> + cache controller
>>> + "marvell,aurora-system-cache": Marvell Controller designed to be
>>> compatible with the ARM one, with system cache mode (meaning
>>> maintenance operations on L1 are broadcasted to the L2 and L2
>>> performs the same operation).
>>> - "marvell,"aurora-outer-cache: Marvell Controller designed to be
>>> - compatible with the ARM one with outer cache mode.
>>> - "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
>>> - offset needs to be added to the address before passing down to the L2
>>> - cache controller
>>> - "bcm,bcm11351-a2-pl310-cache": DEPRECATED by
>>> - "brcm,bcm11351-a2-pl310-cache"
>>> + "marvell,aurora-outer-cache": Marvell Controller designed to be
>>> + compatible with the ARM one with outer cache mode.
>>> + "marvell,tauros3-cache": Marvell Tauros3 cache controller.
>>
>> How does the tauros3 cache differ from the other caches supported by the
>> l2x0 driver?
>
> [added Gregory to Cc]
>
> Good question. I cannot say at this time. I would have guessed that l2cc
> on Armada 1500 and Armada 370/XP are more or less the same, as both use
> Marvell's PJ4B CPU. Maybe, Gregory or Thomas can shed some light into
> this.
>
>>> - cache-unified : Specifies the cache is a unified cache.
>>> - cache-level : Should be set to 2 for a level 2 cache.
>>> - reg : Physical base address and size of cache controller's memory mapped
>>> diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
>>> index 447da6f..90c776e 100644
>>> --- a/arch/arm/mm/cache-l2x0.c
>>> +++ b/arch/arm/mm/cache-l2x0.c
>>> @@ -929,6 +929,7 @@ static const struct of_device_id l2x0_ids[] __initconst = {
>>> .data = (void *)&aurora_no_outer_data},
>>> { .compatible = "marvell,aurora-outer-cache",
>>> .data = (void *)&aurora_with_outer_data},
>>> + { .compatible = "marvell,tauros3-cache", .data = (void *)&l2x0_data },
>>
>> Are we intending to handle this differently later?
>>
>> Or is it 100% compatible with the pl210 or pl220? We could just require
>> an entry later in the compatible string list instead...
>
> No public documentation, no clear answer.
>
> Tauros3 isn't 100% compatible with any of the ARM l2cc above, it has
> additional "features" or "bugs" - call it whatever you want.
>
> I am not an l2cc expert, but basically I see two options:
> a) use (possibly) wrong existing compatible in current mv88de3100.dtsi
> now and fix later.
> b) add tauros3 compatible now and add (possible) quirks/marvell-specific
> properties later.
>
> IMHO b) is very likely to happen as l2x0_of_init in patch 8/8 already
> sets bits, I wasn't able to verify in public ARM l2cc docu.

I agree with Sebastian. I don't have more information that Sebastian, but
as it is definitely a different controller of the ones from ARM, it should
have its own compatible string. Then latter when we will discover new feature
and/or bugs, we will be able to manage them without requiring people to update
their dtb. If I understood well it is the philosophy behind the device tree.

Regards,

>
> But again, I am very open for suggestions here.
>
> Sebastian
>


--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

2013-10-08 23:25:06

by Dinh Nguyen

[permalink] [raw]
Subject: Re: [PATCH 8/8] ARM: add initial support for Marvell Berlin SoCs

Hi Sebastian,

On Tue, 2013-10-08 at 14:24 +0200, Sebastian Hesselbarth wrote:
> This adds initial support for the Marvell Berlin (88DE3xxx) SoC family
> and basic machine setup for Armada 1500 (88DE3100) SoCs.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> Reviewed-by: Jason Cooper <[email protected]>
> Reviewed-by: Thomas Petazzoni <[email protected]>
> Reviewed-by: Arnd Bergmann <[email protected]>
> ---
> Changelog:
> RFCv2->v1:
> - remove custom .init_time, adds dependency for arch-wide of_clk_init call
> RFCv1->RFCv2:
> - nuke .map_io (Reported by Arnd Bergmann)
> - add copyright reference
> - switch to mach-berlin instead of mach-mvebu
>
> Cc: Jason Cooper <[email protected]>
> Cc: Thomas Petazzoni <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
> arch/arm/Kconfig | 2 ++
> arch/arm/Makefile | 1 +
> arch/arm/mach-berlin/Kconfig | 24 ++++++++++++++++++++++++
> arch/arm/mach-berlin/Makefile | 1 +
> arch/arm/mach-berlin/berlin.c | 39 +++++++++++++++++++++++++++++++++++++++
> 5 files changed, 67 insertions(+)
> create mode 100644 arch/arm/mach-berlin/Kconfig
> create mode 100644 arch/arm/mach-berlin/Makefile
> create mode 100644 arch/arm/mach-berlin/berlin.c
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 1ad6fb6..5692426 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -932,6 +932,8 @@ source "arch/arm/mach-bcm/Kconfig"
>
> source "arch/arm/mach-bcm2835/Kconfig"
>
> +source "arch/arm/mach-berlin/Kconfig"
> +
> source "arch/arm/mach-clps711x/Kconfig"
>
> source "arch/arm/mach-cns3xxx/Kconfig"
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index a37a50f..3ba332b 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -147,6 +147,7 @@ textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
> machine-$(CONFIG_ARCH_AT91) += at91
> machine-$(CONFIG_ARCH_BCM) += bcm
> machine-$(CONFIG_ARCH_BCM2835) += bcm2835
> +machine-$(CONFIG_ARCH_BERLIN) += berlin
> machine-$(CONFIG_ARCH_CLPS711X) += clps711x
> machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx
> machine-$(CONFIG_ARCH_DAVINCI) += davinci
> diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig
> new file mode 100644
> index 0000000..56a671e
> --- /dev/null
> +++ b/arch/arm/mach-berlin/Kconfig
> @@ -0,0 +1,24 @@
> +config ARCH_BERLIN
> + bool "Marvell Berlin (88DE3xxx) SoCs" if ARCH_MULTI_V7
> + select GENERIC_CLOCKEVENTS
> + select GENERIC_IRQ_CHIP
> + select COMMON_CLK
> + select DW_APB_ICTL
> + select DW_APB_TIMER_OF
> +
> +if ARCH_BERLIN
> +
> +menu "Marvell Berlin (88DE3xxx) SoC variants"
> +
> +config MACH_MV88DE3100
> + bool "Marvell 88DE3100 (Armada 1500)"
> + select ARM_GIC
> + select CACHE_L2X0
> + select CPU_PJ4B
> + select HAVE_ARM_TWD if LOCAL_TIMERS
> + select HAVE_SMP
> + select LOCAL_TIMERS if SMP

I think because of commit:

a894fcc2d [ARM: smp_twd: Divorce smp_twd from local timer API]

you can remove the LOCAL_TIMERS for HAVE_ARM_TWD.

Dinh

2013-10-09 03:23:25

by Jisheng Zhang

[permalink] [raw]
Subject: Re: [PATCH 8/8] ARM: add initial support for Marvell Berlin SoCs

Dear Sebastian,

On Tue, 8 Oct 2013 05:24:33 -0700
Sebastian Hesselbarth <[email protected]> wrote:

> This adds initial support for the Marvell Berlin (88DE3xxx) SoC family
> and basic machine setup for Armada 1500 (88DE3100) SoCs.

First of all, thanks for these patches. I worked and is still working on Marvell
Berlin Linux kernel BSP at Marvell. As the person who brought up Linux kernel for
various Berlin SoCs since BG2, I have some comments to share with you.

>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> Reviewed-by: Jason Cooper <[email protected]>
> Reviewed-by: Thomas Petazzoni <[email protected]>
> Reviewed-by: Arnd Bergmann <[email protected]>
> ---
> Changelog:
> RFCv2->v1:
> - remove custom .init_time, adds dependency for arch-wide of_clk_init call
> RFCv1->RFCv2:
> - nuke .map_io (Reported by Arnd Bergmann)
> - add copyright reference
> - switch to mach-berlin instead of mach-mvebu
>
> Cc: Jason Cooper <[email protected]>
> Cc: Thomas Petazzoni <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
> arch/arm/Kconfig | 2 ++
> arch/arm/Makefile | 1 +
> arch/arm/mach-berlin/Kconfig | 24 ++++++++++++++++++++++++
> arch/arm/mach-berlin/Makefile | 1 +
> arch/arm/mach-berlin/berlin.c | 39
> +++++++++++++++++++++++++++++++++++++++ 5 files changed, 67 insertions(+)
> create mode 100644 arch/arm/mach-berlin/Kconfig
> create mode 100644 arch/arm/mach-berlin/Makefile
> create mode 100644 arch/arm/mach-berlin/berlin.c
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 1ad6fb6..5692426 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -932,6 +932,8 @@ source "arch/arm/mach-bcm/Kconfig"
>
> source "arch/arm/mach-bcm2835/Kconfig"
>
> +source "arch/arm/mach-berlin/Kconfig"
> +
> source "arch/arm/mach-clps711x/Kconfig"
>
> source "arch/arm/mach-cns3xxx/Kconfig"
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index a37a50f..3ba332b 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -147,6 +147,7 @@ textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
> machine-$(CONFIG_ARCH_AT91) += at91
> machine-$(CONFIG_ARCH_BCM) += bcm
> machine-$(CONFIG_ARCH_BCM2835) += bcm2835
> +machine-$(CONFIG_ARCH_BERLIN) += berlin
> machine-$(CONFIG_ARCH_CLPS711X) += clps711x
> machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx
> machine-$(CONFIG_ARCH_DAVINCI) += davinci
> diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig
> new file mode 100644
> index 0000000..56a671e
> --- /dev/null
> +++ b/arch/arm/mach-berlin/Kconfig
> @@ -0,0 +1,24 @@
> +config ARCH_BERLIN
> + bool "Marvell Berlin (88DE3xxx) SoCs" if ARCH_MULTI_V7
> + select GENERIC_CLOCKEVENTS
> + select GENERIC_IRQ_CHIP
> + select COMMON_CLK
> + select DW_APB_ICTL
> + select DW_APB_TIMER_OF
> +
> +if ARCH_BERLIN
> +
> +menu "Marvell Berlin (88DE3xxx) SoC variants"
It would be better to s/88DE3xxx/88DExxxx or remove 88DE3xxx totally
> +
> +config MACH_MV88DE3100
Can you please use MACH_BERLIN2? This is what we used internally in latest BSP
> + bool "Marvell 88DE3100 (Armada 1500)"
> + select ARM_GIC
> + select CACHE_L2X0
The tauros3 and PL310 are different although the programming interface are
compatible. In PJ4B and Tauros3, the CP15 cache maintenance commands include
both L1 and L2, memory mapped PA-based maintenance operations in L2 are not needed.
How to handle this in cache-l2x0.c?
> + select CPU_PJ4B
> + select HAVE_ARM_TWD if LOCAL_TIMERS
> + select HAVE_SMP
> + select LOCAL_TIMERS if SMP
> +
> +endmenu
> +
> +endif
> diff --git a/arch/arm/mach-berlin/Makefile b/arch/arm/mach-berlin/Makefile
> new file mode 100644
> index 0000000..ab69fe9
> --- /dev/null
> +++ b/arch/arm/mach-berlin/Makefile
> @@ -0,0 +1 @@
> +obj-y += berlin.o
> diff --git a/arch/arm/mach-berlin/berlin.c b/arch/arm/mach-berlin/berlin.c
> new file mode 100644
> index 0000000..54b3ba7
> --- /dev/null
> +++ b/arch/arm/mach-berlin/berlin.c
> @@ -0,0 +1,39 @@
> +/*
> + * Device Tree support for Marvell Berlin (88DE3xxx) platforms.
ditto
> + *
> + * Sebastian Hesselbarth <[email protected]>
> + *
> + * based on GPL'ed 2.6 kernel sources
> + * (c) Marvell International Ltd.
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2. This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +#include <linux/init.h>
> +#include <linux/io.h>
> +#include <linux/kernel.h>
> +#include <linux/of_platform.h>
> +#include <asm/hardware/cache-l2x0.h>
> +#include <asm/mach/arch.h>
> +
> +static void __init berlin_init_machine(void)
> +{
> + /*
> + * with DT probing for L2CCs, berlin_init_machine can be removed.
> + * Note: 88DE3005 (Armada 1500-mini) uses pl310 l2cc
> + */
> + l2x0_of_init(0x70c00000, 0xfeffffff);
> + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
> +}
> +
> +static const char * const berlin_dt_compat[] = {
> + "marvell,berlin",
> + NULL,
> +};
> +
> +DT_MACHINE_START(BERLIN_DT, "Marvell Berlin (88DE3xxx)")
ditto
> + .dt_compat = berlin_dt_compat,
> + .init_machine = berlin_init_machine,
> +MACHINE_END


> create mode 100644 arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts
> create mode 100644 arch/arm/boot/dts/mv88de3100.dtsi

Armada 1500 == mv88de3100 == BG2

We always call BGx internally, so s/mv88de3100/berlin2 in all patches except
patch 4 would be better. IOW, I prefer to call berlin2/berlin2ct/berlin2cd etc
and never use mv88dexxxx or armada xxxx in code, dt bindings except documents.
This would remove unnecessary confusions. What do you think?


Thanks,
Jisheng

2013-10-09 07:08:20

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 8/8] ARM: add initial support for Marvell Berlin SoCs

On 10/09/2013 01:24 AM, Dinh Nguyen wrote:
> Hi Sebastian,
>
> On Tue, 2013-10-08 at 14:24 +0200, Sebastian Hesselbarth wrote:
>> This adds initial support for the Marvell Berlin (88DE3xxx) SoC family
>> and basic machine setup for Armada 1500 (88DE3100) SoCs.
[...]
>> +config MACH_MV88DE3100
>> + bool "Marvell 88DE3100 (Armada 1500)"
>> + select ARM_GIC
>> + select CACHE_L2X0
>> + select CPU_PJ4B
>> + select HAVE_ARM_TWD if LOCAL_TIMERS
>> + select HAVE_SMP
>> + select LOCAL_TIMERS if SMP
>
> I think because of commit:
>
> a894fcc2d [ARM: smp_twd: Divorce smp_twd from local timer API]
>
> you can remove the LOCAL_TIMERS for HAVE_ARM_TWD.

Thanks, Dinh, I will have a look at this.

2013-10-09 07:20:37

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 8/8] ARM: add initial support for Marvell Berlin SoCs

On 10/09/2013 05:20 AM, Jisheng Zhang wrote:
> On Tue, 8 Oct 2013 05:24:33 -0700
> Sebastian Hesselbarth <[email protected]> wrote:
>
>> This adds initial support for the Marvell Berlin (88DE3xxx) SoC family
>> and basic machine setup for Armada 1500 (88DE3100) SoCs.
>
> First of all, thanks for these patches. I worked and is still working on Marvell
> Berlin Linux kernel BSP at Marvell. As the person who brought up Linux kernel for
> various Berlin SoCs since BG2, I have some comments to share with you.

Jisheng,

great to finally have someone in the discussion who actually "knows" and
is not just "guessing" as I am ;)

[...]
>> diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig
>> new file mode 100644
>> index 0000000..56a671e
>> --- /dev/null
>> +++ b/arch/arm/mach-berlin/Kconfig
>> @@ -0,0 +1,24 @@
>> +config ARCH_BERLIN
>> + bool "Marvell Berlin (88DE3xxx) SoCs" if ARCH_MULTI_V7
>> + select GENERIC_CLOCKEVENTS
>> + select GENERIC_IRQ_CHIP
>> + select COMMON_CLK
>> + select DW_APB_ICTL
>> + select DW_APB_TIMER_OF
>> +
>> +if ARCH_BERLIN
>> +
>> +menu "Marvell Berlin (88DE3xxx) SoC variants"
> It would be better to s/88DE3xxx/88DExxxx or remove 88DE3xxx totally

Ok, we can get rid of the numbers.

>> +
>> +config MACH_MV88DE3100
> Can you please use MACH_BERLIN2? This is what we used internally in latest BSP

Ok.

>> + bool "Marvell 88DE3100 (Armada 1500)"
>> + select ARM_GIC
>> + select CACHE_L2X0
> The tauros3 and PL310 are different although the programming interface are
> compatible. In PJ4B and Tauros3, the CP15 cache maintenance commands include
> both L1 and L2, memory mapped PA-based maintenance operations in L2 are not needed.
> How to handle this in cache-l2x0.c?

TBH, I haven't really looked into l2cc, yet. I will assemble some people
and move this discussion over to the corresponding patch later this day.

>> + select CPU_PJ4B
>> + select HAVE_ARM_TWD if LOCAL_TIMERS
>> + select HAVE_SMP
>> + select LOCAL_TIMERS if SMP
>> +
>> +endmenu
>> +
>> +endif
>> diff --git a/arch/arm/mach-berlin/Makefile b/arch/arm/mach-berlin/Makefile
>> new file mode 100644
>> index 0000000..ab69fe9
>> --- /dev/null
>> +++ b/arch/arm/mach-berlin/Makefile
>> @@ -0,0 +1 @@
>> +obj-y += berlin.o
>> diff --git a/arch/arm/mach-berlin/berlin.c b/arch/arm/mach-berlin/berlin.c
>> new file mode 100644
>> index 0000000..54b3ba7
>> --- /dev/null
>> +++ b/arch/arm/mach-berlin/berlin.c
>> @@ -0,0 +1,39 @@
>> +/*
>> + * Device Tree support for Marvell Berlin (88DE3xxx) platforms.
> ditto

Ok.

>> + *
>> + * Sebastian Hesselbarth <[email protected]>
>> + *
>> + * based on GPL'ed 2.6 kernel sources
>> + * (c) Marvell International Ltd.
>> + *
>> + * This file is licensed under the terms of the GNU General Public
>> + * License version 2. This program is licensed "as is" without any
>> + * warranty of any kind, whether express or implied.
>> + */
>> +
>> +#include <linux/init.h>
>> +#include <linux/io.h>
>> +#include <linux/kernel.h>
>> +#include <linux/of_platform.h>
>> +#include <asm/hardware/cache-l2x0.h>
>> +#include <asm/mach/arch.h>
>> +
>> +static void __init berlin_init_machine(void)
>> +{
>> + /*
>> + * with DT probing for L2CCs, berlin_init_machine can be removed.
>> + * Note: 88DE3005 (Armada 1500-mini) uses pl310 l2cc
>> + */
>> + l2x0_of_init(0x70c00000, 0xfeffffff);
>> + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
>> +}
>> +
>> +static const char * const berlin_dt_compat[] = {
>> + "marvell,berlin",
>> + NULL,
>> +};
>> +
>> +DT_MACHINE_START(BERLIN_DT, "Marvell Berlin (88DE3xxx)")
> ditto

Ok.

>> + .dt_compat = berlin_dt_compat,
>> + .init_machine = berlin_init_machine,
>> +MACHINE_END
>
>
>> create mode 100644 arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts
>> create mode 100644 arch/arm/boot/dts/mv88de3100.dtsi
>
> Armada 1500 == mv88de3100 == BG2
>
> We always call BGx internally, so s/mv88de3100/berlin2 in all patches except
> patch 4 would be better. IOW, I prefer to call berlin2/berlin2ct/berlin2cd etc
> and never use mv88dexxxx or armada xxxx in code, dt bindings except documents.
> This would remove unnecessary confusions. What do you think?

I am fine with berlin2 instead of mv88de3100 where possible. But I
think it would be good to have berlin2 <> Armada 1500 somewhere,
possibly in all user visible places. Armada 1500 is the marketing
name you have chosen, and that is what people will look for.

Feel free to also directly comment on all the other patches, I am
in no hurry to mainline this patch set. The more we can work out
now, the better. But please keep it close to this patch set feature-
wise, I prefer to get it first and add more features later.

Sebastian

2013-10-09 08:51:10

by Mark Rutland

[permalink] [raw]
Subject: Re: [PATCH 3/8] ARM: l2x0: add Marvell Tauros3 compatible

On Tue, Oct 08, 2013 at 05:33:23PM +0100, Gregory CLEMENT wrote:
> On 08/10/2013 18:05, Sebastian Hesselbarth wrote:
> > On 10/08/2013 03:41 PM, Mark Rutland wrote:
> >> On Tue, Oct 08, 2013 at 01:24:28PM +0100, Sebastian Hesselbarth wrote:
> >>> This add a compatible for the Marvell Tauros3 cache controller which
> >>> is compatible with l2x0 cache controllers. While updating the binding
> >>> documentation, clean up the list of possible compatibles.
> >>>
> >>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> >>> ---
> > [...]
> >>> diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2cc.txt
> >>> index c0c7626..a1d0cbd 100644
> >>> --- a/Documentation/devicetree/bindings/arm/l2cc.txt
> >>> +++ b/Documentation/devicetree/bindings/arm/l2cc.txt
> >>> @@ -7,20 +7,20 @@ The ARM L2 cache representation in the device tree should be done as follows:
> >>> Required properties:
> >>>
> >>> - compatible : should be one of:
> >>> - "arm,pl310-cache"
> >>> - "arm,l220-cache"
> >>> - "arm,l210-cache"
> >>> - "marvell,aurora-system-cache": Marvell Controller designed to be
> >>> + "arm,pl310-cache"
> >>> + "arm,l220-cache"
> >>> + "arm,l210-cache"
> >>> + "bcm,bcm11351-a2-pl310-cache": DEPRECATED by "brcm,bcm11351-a2-pl310-cache"
> >>> + "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
> >>> + offset needs to be added to the address before passing down to the L2
> >>> + cache controller
> >>> + "marvell,aurora-system-cache": Marvell Controller designed to be
> >>> compatible with the ARM one, with system cache mode (meaning
> >>> maintenance operations on L1 are broadcasted to the L2 and L2
> >>> performs the same operation).
> >>> - "marvell,"aurora-outer-cache: Marvell Controller designed to be
> >>> - compatible with the ARM one with outer cache mode.
> >>> - "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
> >>> - offset needs to be added to the address before passing down to the L2
> >>> - cache controller
> >>> - "bcm,bcm11351-a2-pl310-cache": DEPRECATED by
> >>> - "brcm,bcm11351-a2-pl310-cache"
> >>> + "marvell,aurora-outer-cache": Marvell Controller designed to be
> >>> + compatible with the ARM one with outer cache mode.
> >>> + "marvell,tauros3-cache": Marvell Tauros3 cache controller.
> >>
> >> How does the tauros3 cache differ from the other caches supported by the
> >> l2x0 driver?
> >
> > [added Gregory to Cc]
> >
> > Good question. I cannot say at this time. I would have guessed that l2cc
> > on Armada 1500 and Armada 370/XP are more or less the same, as both use
> > Marvell's PJ4B CPU. Maybe, Gregory or Thomas can shed some light into
> > this.
> >
> >>> - cache-unified : Specifies the cache is a unified cache.
> >>> - cache-level : Should be set to 2 for a level 2 cache.
> >>> - reg : Physical base address and size of cache controller's memory mapped
> >>> diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
> >>> index 447da6f..90c776e 100644
> >>> --- a/arch/arm/mm/cache-l2x0.c
> >>> +++ b/arch/arm/mm/cache-l2x0.c
> >>> @@ -929,6 +929,7 @@ static const struct of_device_id l2x0_ids[] __initconst = {
> >>> .data = (void *)&aurora_no_outer_data},
> >>> { .compatible = "marvell,aurora-outer-cache",
> >>> .data = (void *)&aurora_with_outer_data},
> >>> + { .compatible = "marvell,tauros3-cache", .data = (void *)&l2x0_data },
> >>
> >> Are we intending to handle this differently later?
> >>
> >> Or is it 100% compatible with the pl210 or pl220? We could just require
> >> an entry later in the compatible string list instead...
> >
> > No public documentation, no clear answer.
> >
> > Tauros3 isn't 100% compatible with any of the ARM l2cc above, it has
> > additional "features" or "bugs" - call it whatever you want.
> >
> > I am not an l2cc expert, but basically I see two options:
> > a) use (possibly) wrong existing compatible in current mv88de3100.dtsi
> > now and fix later.
> > b) add tauros3 compatible now and add (possible) quirks/marvell-specific
> > properties later.
> >
> > IMHO b) is very likely to happen as l2x0_of_init in patch 8/8 already
> > sets bits, I wasn't able to verify in public ARM l2cc docu.
>
> I agree with Sebastian. I don't have more information that Sebastian, but
> as it is definitely a different controller of the ones from ARM, it should
> have its own compatible string. Then latter when we will discover new feature
> and/or bugs, we will be able to manage them without requiring people to update
> their dtb. If I understood well it is the philosophy behind the device tree.

Please note that I wasn't arguing for people to have to update their
dtb. I was only suggesting that we'd have something like:

compatible = "marvell,tauros3-cache", "arm,l220-cache";

Which would function now, and later the driver could choose to check for
"marvell,tauros3-cache" and do something different.

However, given that we don't have sufficient documentation to tell how
close the tauros3 cache is to any ARM l2x0 variant, having just the
"marvell,tauros3-cache" string in dts and supporting this in the driver
makes sense to me.

Cheers,
Mark.

2013-10-09 09:14:15

by Gregory CLEMENT

[permalink] [raw]
Subject: Re: [PATCH 3/8] ARM: l2x0: add Marvell Tauros3 compatible

On 09/10/2013 10:50, Mark Rutland wrote:
> On Tue, Oct 08, 2013 at 05:33:23PM +0100, Gregory CLEMENT wrote:
>> On 08/10/2013 18:05, Sebastian Hesselbarth wrote:
>>> On 10/08/2013 03:41 PM, Mark Rutland wrote:
>>>> On Tue, Oct 08, 2013 at 01:24:28PM +0100, Sebastian Hesselbarth wrote:
>>>>> This add a compatible for the Marvell Tauros3 cache controller which
>>>>> is compatible with l2x0 cache controllers. While updating the binding
>>>>> documentation, clean up the list of possible compatibles.
>>>>>
>>>>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>>>>> ---
>>> [...]
>>>>> diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2cc.txt
>>>>> index c0c7626..a1d0cbd 100644
>>>>> --- a/Documentation/devicetree/bindings/arm/l2cc.txt
>>>>> +++ b/Documentation/devicetree/bindings/arm/l2cc.txt
>>>>> @@ -7,20 +7,20 @@ The ARM L2 cache representation in the device tree should be done as follows:
>>>>> Required properties:
>>>>>
>>>>> - compatible : should be one of:
>>>>> - "arm,pl310-cache"
>>>>> - "arm,l220-cache"
>>>>> - "arm,l210-cache"
>>>>> - "marvell,aurora-system-cache": Marvell Controller designed to be
>>>>> + "arm,pl310-cache"
>>>>> + "arm,l220-cache"
>>>>> + "arm,l210-cache"
>>>>> + "bcm,bcm11351-a2-pl310-cache": DEPRECATED by "brcm,bcm11351-a2-pl310-cache"
>>>>> + "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
>>>>> + offset needs to be added to the address before passing down to the L2
>>>>> + cache controller
>>>>> + "marvell,aurora-system-cache": Marvell Controller designed to be
>>>>> compatible with the ARM one, with system cache mode (meaning
>>>>> maintenance operations on L1 are broadcasted to the L2 and L2
>>>>> performs the same operation).
>>>>> - "marvell,"aurora-outer-cache: Marvell Controller designed to be
>>>>> - compatible with the ARM one with outer cache mode.
>>>>> - "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
>>>>> - offset needs to be added to the address before passing down to the L2
>>>>> - cache controller
>>>>> - "bcm,bcm11351-a2-pl310-cache": DEPRECATED by
>>>>> - "brcm,bcm11351-a2-pl310-cache"
>>>>> + "marvell,aurora-outer-cache": Marvell Controller designed to be
>>>>> + compatible with the ARM one with outer cache mode.
>>>>> + "marvell,tauros3-cache": Marvell Tauros3 cache controller.
>>>>
>>>> How does the tauros3 cache differ from the other caches supported by the
>>>> l2x0 driver?
>>>
>>> [added Gregory to Cc]
>>>
>>> Good question. I cannot say at this time. I would have guessed that l2cc
>>> on Armada 1500 and Armada 370/XP are more or less the same, as both use
>>> Marvell's PJ4B CPU. Maybe, Gregory or Thomas can shed some light into
>>> this.
>>>
>>>>> - cache-unified : Specifies the cache is a unified cache.
>>>>> - cache-level : Should be set to 2 for a level 2 cache.
>>>>> - reg : Physical base address and size of cache controller's memory mapped
>>>>> diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
>>>>> index 447da6f..90c776e 100644
>>>>> --- a/arch/arm/mm/cache-l2x0.c
>>>>> +++ b/arch/arm/mm/cache-l2x0.c
>>>>> @@ -929,6 +929,7 @@ static const struct of_device_id l2x0_ids[] __initconst = {
>>>>> .data = (void *)&aurora_no_outer_data},
>>>>> { .compatible = "marvell,aurora-outer-cache",
>>>>> .data = (void *)&aurora_with_outer_data},
>>>>> + { .compatible = "marvell,tauros3-cache", .data = (void *)&l2x0_data },
>>>>
>>>> Are we intending to handle this differently later?
>>>>
>>>> Or is it 100% compatible with the pl210 or pl220? We could just require
>>>> an entry later in the compatible string list instead...
>>>
>>> No public documentation, no clear answer.
>>>
>>> Tauros3 isn't 100% compatible with any of the ARM l2cc above, it has
>>> additional "features" or "bugs" - call it whatever you want.
>>>
>>> I am not an l2cc expert, but basically I see two options:
>>> a) use (possibly) wrong existing compatible in current mv88de3100.dtsi
>>> now and fix later.
>>> b) add tauros3 compatible now and add (possible) quirks/marvell-specific
>>> properties later.
>>>
>>> IMHO b) is very likely to happen as l2x0_of_init in patch 8/8 already
>>> sets bits, I wasn't able to verify in public ARM l2cc docu.
>>
>> I agree with Sebastian. I don't have more information that Sebastian, but
>> as it is definitely a different controller of the ones from ARM, it should
>> have its own compatible string. Then latter when we will discover new feature
>> and/or bugs, we will be able to manage them without requiring people to update
>> their dtb. If I understood well it is the philosophy behind the device tree.
>
> Please note that I wasn't arguing for people to have to update their
> dtb. I was only suggesting that we'd have something like:
>
> compatible = "marvell,tauros3-cache", "arm,l220-cache";
>
> Which would function now, and later the driver could choose to check for
> "marvell,tauros3-cache" and do something different.
>

Oh you're right, I didn't think about it

> However, given that we don't have sufficient documentation to tell how
> close the tauros3 cache is to any ARM l2x0 variant, having just the
> "marvell,tauros3-cache" string in dts and supporting this in the driver
> makes sense to me.

Given the information we get from Jisheng "The tauros3 and PL310 are
different although the programming interface are compatible" something like:

compatible = "marvell,tauros3-cache", "arm,pl310-cache";

should work.

Regards,
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

2013-10-09 09:24:17

by Gregory CLEMENT

[permalink] [raw]
Subject: Re: [PATCH 8/8] ARM: add initial support for Marvell Berlin SoCs

Hello Jisheng,

[...]

>> +config MACH_MV88DE3100
> Can you please use MACH_BERLIN2? This is what we used internally in latest BSP
>> + bool "Marvell 88DE3100 (Armada 1500)"
>> + select ARM_GIC
>> + select CACHE_L2X0
> The tauros3 and PL310 are different although the programming interface are
> compatible. In PJ4B and Tauros3, the CP15 cache maintenance commands include
> both L1 and L2, memory mapped PA-based maintenance operations in L2 are not needed.
> How to handle this in cache-l2x0.c?

In this case you can do the same things we have done for Aurora when we use
the "aurora-system-cache" compatible string.

[...]

Regards,
Gregory

--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

2013-10-09 19:27:25

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 3/8] ARM: l2x0: add Marvell Tauros3 compatible

On 10/09/2013 10:50 AM, Mark Rutland wrote:
> On Tue, Oct 08, 2013 at 05:33:23PM +0100, Gregory CLEMENT wrote:
>> On 08/10/2013 18:05, Sebastian Hesselbarth wrote:
>>> On 10/08/2013 03:41 PM, Mark Rutland wrote:
>>>> On Tue, Oct 08, 2013 at 01:24:28PM +0100, Sebastian Hesselbarth wrote:
>>>>> This add a compatible for the Marvell Tauros3 cache controller which
>>>>> is compatible with l2x0 cache controllers. While updating the binding
>>>>> documentation, clean up the list of possible compatibles.
>>>>>
>>>>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>>>>> ---

Added Jisheng and Lennert to Cc.

Lennert, while looking for differences between ARM PL310 and
Marvell Tauros3 cache controller in a GPL'ed 2.6 kernel source
from Asus, I found arch/arm/mm/cache-tauros3.c which states you
as the original author. If that is wrong, please ignore this.

>>> [...]
>>>>> diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2cc.txt
>>>>> index c0c7626..a1d0cbd 100644
>>>>> --- a/Documentation/devicetree/bindings/arm/l2cc.txt
>>>>> +++ b/Documentation/devicetree/bindings/arm/l2cc.txt
>>>>> @@ -7,20 +7,20 @@ The ARM L2 cache representation in the device tree should be done as follows:
>>>>> Required properties:
>>>>>
>>>>> - compatible : should be one of:
>>>>> - "arm,pl310-cache"
>>>>> - "arm,l220-cache"
>>>>> - "arm,l210-cache"
>>>>> - "marvell,aurora-system-cache": Marvell Controller designed to be
>>>>> + "arm,pl310-cache"
>>>>> + "arm,l220-cache"
>>>>> + "arm,l210-cache"
>>>>> + "bcm,bcm11351-a2-pl310-cache": DEPRECATED by "brcm,bcm11351-a2-pl310-cache"
>>>>> + "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
>>>>> + offset needs to be added to the address before passing down to the L2
>>>>> + cache controller
>>>>> + "marvell,aurora-system-cache": Marvell Controller designed to be
>>>>> compatible with the ARM one, with system cache mode (meaning
>>>>> maintenance operations on L1 are broadcasted to the L2 and L2
>>>>> performs the same operation).
>>>>> - "marvell,"aurora-outer-cache: Marvell Controller designed to be
>>>>> - compatible with the ARM one with outer cache mode.
>>>>> - "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
>>>>> - offset needs to be added to the address before passing down to the L2
>>>>> - cache controller
>>>>> - "bcm,bcm11351-a2-pl310-cache": DEPRECATED by
>>>>> - "brcm,bcm11351-a2-pl310-cache"
>>>>> + "marvell,aurora-outer-cache": Marvell Controller designed to be
>>>>> + compatible with the ARM one with outer cache mode.
>>>>> + "marvell,tauros3-cache": Marvell Tauros3 cache controller.
>>>>
>>>> How does the tauros3 cache differ from the other caches supported by the
>>>> l2x0 driver?
>>>
>>> [added Gregory to Cc]
>>>
>>> Good question. I cannot say at this time. I would have guessed that l2cc
>>> on Armada 1500 and Armada 370/XP are more or less the same, as both use
>>> Marvell's PJ4B CPU. Maybe, Gregory or Thomas can shed some light into
>>> this.

As stated above, I did some research on the differences. I think I can
prepare a patch providing tauros3 specific callbacks for .inv_all,
.flush_all, .resume, and .save.

For full .setup, I need to do more research on the CTRL/AUX_CTRL bits.

Up to now, I think pl310 specific callbacks (.resume, .save, .setup)
are _not_ suitable for tauros3. In the source from above, there are
no TAG_LATENCY_CTRL, DATA_LATENCY_CTRL, ADDR_FILTER_*, nor POWER_CTRL
registers.

>>>>> - cache-unified : Specifies the cache is a unified cache.
>>>>> - cache-level : Should be set to 2 for a level 2 cache.
>>>>> - reg : Physical base address and size of cache controller's memory mapped
>>>>> diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
>>>>> index 447da6f..90c776e 100644
>>>>> --- a/arch/arm/mm/cache-l2x0.c
>>>>> +++ b/arch/arm/mm/cache-l2x0.c
>>>>> @@ -929,6 +929,7 @@ static const struct of_device_id l2x0_ids[] __initconst = {
>>>>> .data = (void *)&aurora_no_outer_data},
>>>>> { .compatible = "marvell,aurora-outer-cache",
>>>>> .data = (void *)&aurora_with_outer_data},
>>>>> + { .compatible = "marvell,tauros3-cache", .data = (void *)&l2x0_data },
>>>>
>>>> Are we intending to handle this differently later?
>>>>
>>>> Or is it 100% compatible with the pl210 or pl220? We could just require
>>>> an entry later in the compatible string list instead...
>>>
>>> No public documentation, no clear answer.
>>>
>>> Tauros3 isn't 100% compatible with any of the ARM l2cc above, it has
>>> additional "features" or "bugs" - call it whatever you want.
>>>
>>> I am not an l2cc expert, but basically I see two options:
>>> a) use (possibly) wrong existing compatible in current mv88de3100.dtsi
>>> now and fix later.
>>> b) add tauros3 compatible now and add (possible) quirks/marvell-specific
>>> properties later.
>>>
>>> IMHO b) is very likely to happen as l2x0_of_init in patch 8/8 already
>>> sets bits, I wasn't able to verify in public ARM l2cc docu.
>>
>> I agree with Sebastian. I don't have more information that Sebastian, but
>> as it is definitely a different controller of the ones from ARM, it should
>> have its own compatible string. Then latter when we will discover new feature
>> and/or bugs, we will be able to manage them without requiring people to update
>> their dtb. If I understood well it is the philosophy behind the device tree.
>
> Please note that I wasn't arguing for people to have to update their
> dtb. I was only suggesting that we'd have something like:
>
> compatible = "marvell,tauros3-cache", "arm,l220-cache";
>
> Which would function now, and later the driver could choose to check for
> "marvell,tauros3-cache" and do something different.

Agree, we really should use above compatible style more often.

> However, given that we don't have sufficient documentation to tell how
> close the tauros3 cache is to any ARM l2x0 variant, having just the
> "marvell,tauros3-cache" string in dts and supporting this in the driver
> makes sense to me.

I found some source, which is possibly enough documentation. Also, I am
counting on Jisheng or Lennert to comment on the hidden magic in
Tauros3.

Sebastian

2013-10-11 09:15:46

by Lennert Buytenhek

[permalink] [raw]
Subject: Re: [PATCH 3/8] ARM: l2x0: add Marvell Tauros3 compatible

On Wed, Oct 09, 2013 at 09:27:14PM +0200, Sebastian Hesselbarth wrote:

> >>>>>This add a compatible for the Marvell Tauros3 cache controller which
> >>>>>is compatible with l2x0 cache controllers. While updating the binding
> >>>>>documentation, clean up the list of possible compatibles.
> >>>>>
> >>>>>Signed-off-by: Sebastian Hesselbarth <[email protected]>
> >>>>>---
>
> Added Jisheng and Lennert to Cc.
>
> Lennert, while looking for differences between ARM PL310 and
> Marvell Tauros3 cache controller in a GPL'ed 2.6 kernel source
> from Asus, I found arch/arm/mm/cache-tauros3.c which states you
> as the original author. If that is wrong, please ignore this.

I'm the original author of cache-tauros2.c, but I've never heard of
Tauros3, and my name probably ended up in there via cp(1).

2013-10-11 09:32:30

by Jisheng Zhang

[permalink] [raw]
Subject: Re: [PATCH 1/8] irqchip: add DesignWare APB ICTL interrupt controller

On Tue, 8 Oct 2013 05:24:26 -0700
Sebastian Hesselbarth <[email protected]> wrote:

> This adds an irqchip driver and corresponding devicetree binding for the
> secondary interrupt controllers based on Synopsys DesignWare IP dw_apb_ictl.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> ---
> Changelog:
> RFCv1->RFCv2:
> - added copyright reference
>
> Cc: Jason Cooper <[email protected]>
> Cc: Thomas Petazzoni <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Thomas Gleixner <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> ---
> .../interrupt-controller/snps,dw-apb-ictl.txt | 29 ++++
> drivers/irqchip/Kconfig | 4 +
> drivers/irqchip/Makefile | 1 +
> drivers/irqchip/irq-dw-apb-ictl.c | 142
> ++++++++++++++++++++ 4 files changed, 176 insertions(+)
> create mode 100644
> Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
> create mode 100644 drivers/irqchip/irq-dw-apb-ictl.c
>
> diff --git
> a/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
> b/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
> new file mode 100644 index 0000000..7ccd1ba --- /dev/null
> +++
> b/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
> @@ -0,0 +1,29 @@ +Synopsys DesignWare APB interrupt controller (dw_apb_ictl)
> +
> +Synopsys DesignWare provides interrupt controller IP for APB known as
> +dw_apb_ictl. The IP is used as secondary interrupt controller in some SoCs
> with +APB bus, e.g. Marvell Armada 1500.
> +
> +Required properties:
> +- compatible: shall be "snps,dw-apb-ictl"
> +- reg: base address of interrupt registers starting with ENABLE_LOW
> register +- interrupt-controller: identifies the node as an interrupt
> controller +- #interrupt-cells: number of cells to encode an interrupt
> source, shall be 1 +- interrupts: interrupt reference to primary interrupt
> controller +- interrupt-parent: (optional) reference specific primary
> interrupt controller +
> +The interrupt sources map to the corresponding bits in the interrupt
> +registers, i.e.
> +- 0 maps to bit 0 of low interrupts,
> +- 1 maps to bit 1 of low interrupts,
> +- 32 maps to bit 0 of high interrupts, and so on.
> +
> +Example:
> + aic: interrupt-controller@3000 {
> + compatible = "snps,dw-apb-ictl";
> + reg = <0x3000 0xc00>;
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + interrupt-parent = <&gic>;
> + interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
> + };
> diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
> index 3792a1a..940638d 100644
> --- a/drivers/irqchip/Kconfig
> +++ b/drivers/irqchip/Kconfig
> @@ -30,6 +30,10 @@ config ARM_VIC_NR
> The maximum number of VICs available in the system, for
> power management.
>
> +config DW_APB_ICTL
> + bool
> + select IRQ_DOMAIN
> +
> config IMGPDC_IRQ
> bool
> select GENERIC_IRQ_CHIP
> diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
> index c60b901..6427323 100644
> --- a/drivers/irqchip/Makefile
> +++ b/drivers/irqchip/Makefile
> @@ -6,6 +6,7 @@ obj-$(CONFIG_ARCH_MMP) += irq-mmp.o
> obj-$(CONFIG_ARCH_MVEBU) += irq-armada-370-xp.o
> obj-$(CONFIG_ARCH_MXS) += irq-mxs.o
> obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o
> +obj-$(CONFIG_DW_APB_ICTL) += irq-dw-apb-ictl.o
> obj-$(CONFIG_METAG) += irq-metag-ext.o
> obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o
> obj-$(CONFIG_ARCH_MOXART) += irq-moxart.o
> diff --git a/drivers/irqchip/irq-dw-apb-ictl.c
> b/drivers/irqchip/irq-dw-apb-ictl.c new file mode 100644
> index 0000000..bbcacee
> --- /dev/null
> +++ b/drivers/irqchip/irq-dw-apb-ictl.c
> @@ -0,0 +1,142 @@
> +/*
> + * Synopsys DW APB ICTL irqchip driver.
> + *
> + * Sebastian Hesselbarth <[email protected]>
> + *
> + * based on GPL'ed 2.6 kernel sources
> + * (c) Marvell International Ltd.
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2. This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +#include <linux/io.h>
> +#include <linux/irq.h>
> +#include <linux/irqchip/chained_irq.h>
> +#include <linux/of_address.h>
> +#include <linux/of_irq.h>
> +
> +#include "irqchip.h"
> +
> +#define APB_INT_ENABLE_L 0x00
> +#define APB_INT_ENABLE_H 0x04
> +#define APB_INT_MASK_L 0x08
> +#define APB_INT_MASK_H 0x0c
> +#define APB_INT_FINALSTATUS_L 0x30
> +#define APB_INT_FINALSTATUS_H 0x34
> +
> +static void dw_apb_ictl_handler(unsigned int irq, struct irq_desc *desc)
> +{
> + struct irq_chip *chip = irq_get_chip(irq);
> + struct irq_chip_generic *gc = irq_get_handler_data(irq);
> + struct irq_domain *d = gc->private;
> + u32 stat;
> + int n;
> +
> + chained_irq_enter(chip, desc);
> +
> + for (n = 0; n < gc->num_ct; n++) {
> + stat = readl_relaxed(gc->reg_base +
> + APB_INT_FINALSTATUS_L + 4 * n);
> + while (stat) {
> + u32 hwirq = ffs(stat) - 1;
> + generic_handle_irq(irq_find_mapping(d,
> + gc->irq_base + hwirq + 32 * n));
> + stat &= ~(1 << hwirq);
> + }
> + }
> +
> + chained_irq_exit(chip, desc);
> +}
> +
> +static int __init dw_apb_ictl_init(struct device_node *np,
> + struct device_node *parent)
> +{
> + unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
> + struct resource r;
> + struct irq_domain *domain;
> + struct irq_chip_generic *gc;
> + void __iomem *iobase;
> + int ret, nrirqs, irq;
> + u32 reg;
> +
> + /* Map the parent interrupt for the chained handler */
> + irq = irq_of_parse_and_map(np, 0);
> + if (irq <= 0) {
> + pr_err("%s: unable to parse irq\n", np->name);
> + return -EINVAL;
> + }
> +
> + ret = of_address_to_resource(np, 0, &r);
> + if (ret) {
> + pr_err("%s: unable to get resource\n", np->name);
> + return ret;
> + }
> +
> + if (!request_mem_region(r.start, resource_size(&r), np->name)) {
> + pr_err("%s: unable to request mem region\n", np->name);
> + return -ENOMEM;
> + }
> +
> + iobase = ioremap(r.start, resource_size(&r));
> + if (!iobase) {
> + pr_err("%s: unable to map resource\n", np->name);
release_mem_region() is missing
> + return -ENOMEM;
> + }
> +
> + /*
> + * DW IP can be configured to allow 2-64 irqs. We can determine
> + * the number of irqs supported by writing into enable register
> + * and look for bits not set, as corresponding flip-flops will
> + * have been removed by sythesis tool.
> + */
> +
> + /* mask and enable all interrupts */
> + writel(~0, iobase + APB_INT_MASK_L);
> + writel(~0, iobase + APB_INT_MASK_H);
> + writel(~0, iobase + APB_INT_ENABLE_L);
> + writel(~0, iobase + APB_INT_ENABLE_H);
> +
> + reg = readl(iobase + APB_INT_ENABLE_H);
> + if (reg)
> + nrirqs = 32 + fls(reg);
> + else
> + nrirqs = fls(readl(iobase + APB_INT_ENABLE_L));
> +
> + domain = irq_domain_add_linear(np, nrirqs,
> + &irq_generic_chip_ops, NULL);
> + if (!domain) {
> + pr_err("%s: unable to add irq domain\n", np->name);
iounmap() and release_mem_region() is missing
> + return -ENOMEM;
> + }
> +
> + ret = irq_alloc_domain_generic_chips(domain, 32, (nrirqs > 32) ?
> 2 : 1,
> + np->name, handle_level_irq,
> clr, 0,
> + IRQ_GC_INIT_MASK_CACHE);
> + if (ret) {
> + pr_err("%s: unable to alloc irq domain gc\n", np->name);
> + return ret;
> + }
> +
> + gc = irq_get_domain_generic_chip(domain, 0);
> + gc->private = domain;
> + gc->reg_base = iobase;
> +
> + gc->chip_types[0].regs.mask = APB_INT_MASK_L;
> + gc->chip_types[0].chip.irq_mask = irq_gc_mask_set_bit;
> + gc->chip_types[0].chip.irq_unmask = irq_gc_mask_clr_bit;
> +
> + if (nrirqs > 32) {
> + gc->chip_types[1].regs.mask = APB_INT_MASK_H;
> + gc->chip_types[1].chip.irq_mask = irq_gc_mask_set_bit;
> + gc->chip_types[1].chip.irq_unmask = irq_gc_mask_clr_bit;
> + }
> +
> + irq_set_handler_data(irq, gc);
> + irq_set_chained_handler(irq, dw_apb_ictl_handler);
> +
> + return 0;
> +}
> +IRQCHIP_DECLARE(dw_apb_ictl,
> + "snps,dw-apb-ictl", dw_apb_ictl_init);
> --
> 1.7.10.4
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

2013-10-14 23:09:16

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 4/8] ARM: add Marvell Berlin SoC familiy to Marvell doc

On 10/08/2013 02:24 PM, Sebastian Hesselbarth wrote:
> This adds known facts and rumors about the Marvell Berlin (88DE3xxx) SoC
> family to the Marvell SoC documentation.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> Reviewed-by: Jason Cooper <[email protected]>
> Reviewed-by: Thomas Petazzoni <[email protected]>
> Reviewed-by: Arnd Bergmann <[email protected]>
> ---
> Changelog:
> RFCv2->v1:
> - move Berlin below PXA/MMP[23] where it belongs to
> - add note about IP (re-)used in Berlin SoCs
> RFCv1->RFCv2:
> - initial patch
>
> Cc: Jason Cooper <[email protected]>
> Cc: Thomas Petazzoni <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Rob Landley <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> ---
> Documentation/arm/Marvell/README | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/Documentation/arm/Marvell/README b/Documentation/arm/Marvell/README
> index 8f08a86..993c45d 100644
> --- a/Documentation/arm/Marvell/README
> +++ b/Documentation/arm/Marvell/README
> @@ -210,6 +210,35 @@ MMP/MMP2 family (communication processor)
> Linux kernel mach directory: arch/arm/mach-mmp
> Linux kernel plat directory: arch/arm/plat-pxa
>
> +Berlin family (Digital Entertainment)
> +-------------------------------------
> +
> + Flavors:
> + 88DE3005, Armada 1500-mini
> + Design name: BG2CD(A0)
> + Core: ARM Cortex-A9, PL310 L2CC
> + Homepage: http://www.marvell.com/digital-entertainment/armada-1500-mini/
> + 88DE3010, Armada 1000
> + Design name: BG2(?)
> + Core: Marvell PJ4B (ARMv7), Tauros3 L2CC
> + Product Brief: http://www.marvell.com/digital-entertainment/assets/armada_1000_pb.pdf
> + 88DE3100, Armada 1500
> + Design name: BG2(A0)
> + Core: Marvell PJ4B (ARMv7), Tauros3 L2CC
> + Homepage: http://www.marvell.com/digital-entertainment/armada-1500/
> + Product Brief: http://www.marvell.com/digital-entertainment/armada-1500/assets/Marvell-ARMADA-1500-Product-Brief.pdf
> + 88DE????
> + Design name: BG3
> + Core: ARM Cortex-A15, CA15 integrated L2CC

Jisheng,

can you comment on the above and fill in the missing pieces?

Especially, if we want to base device tree compatibles later, we should
make it right in the first place.

Sebastian

> + Homepage: http://www.marvell.com/digital-entertainment/
> + Directory: arch/arm/mach-berlin
> +
> + Comments:
> + * This line of SoCs is based on Marvell Sheeva or ARM Cortex CPUs
> + with Synopsys DesignWare (IRQ, GPIO, Timers, ...) and PXA IP (SDHCI, USB, ETH, ...).
> + * Currently known design names are: C2, BG2(Z1), BG2(A0), BG2CD(A0), BG2CT(A0)
> +
> Long-term plans
> ---------------
>
>

2013-10-14 23:13:30

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 7/8] ARM: add Armada 1500 and Sony NSZ-GS7 device tree files

On 10/08/2013 02:24 PM, Sebastian Hesselbarth wrote:
> This adds very basic device tree files for the Marvell Armada 1500 SoC
> (88DE3100) and the Sony NSZ-GS7 GoogleTV board. Currently, SoC only has
> nodes for cpus, some clocks, l2 cache controller, local timer, apb timers,
> uart, and interrupt controllers. The Sony NSZ-GS7 is a GoogleTV consumer
> device comprising the Armada 1500 SoC above.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> Reviewed-by: Jason Cooper <[email protected]>
> Reviewed-by: Thomas Petazzoni <[email protected]>
> Reviewed-by: Arnd Bergmann <[email protected]>
> ---
> Changelog:
> RCFv2->v1:
> - switch to (soon to be) correct "marvell,pj4b" cpu compatible
> - reference fixed-clock for uarts instead of hard-coded clock-frequency
> - disable timers except two for clksrc and clkevt
> RFCv1->RFCv2:
> - add binding documentation (Reported by Jason Cooper)
> - change l2cc from aurora to tauros3 (Reported by Thomas Petazzoni)
> - add copyright reference
> - adapt compatibles to mach-berlin instead of mach-mvebu
>
> Cc: Jason Cooper <[email protected]>
> Cc: Thomas Petazzoni <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> ---
> .../devicetree/bindings/arm/marvell,berlin.txt | 23 ++
> arch/arm/boot/dts/Makefile | 2 +
> arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts | 29 +++
> arch/arm/boot/dts/mv88de3100.dtsi | 227 ++++++++++++++++++++
> 4 files changed, 281 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/arm/marvell,berlin.txt
> create mode 100644 arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts
> create mode 100644 arch/arm/boot/dts/mv88de3100.dtsi
>
> diff --git a/Documentation/devicetree/bindings/arm/marvell,berlin.txt b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
> new file mode 100644
> index 0000000..e389cba
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
> @@ -0,0 +1,23 @@
> +Marvell Berlin (88DE3xxx) family SoCs Device Tree Bindings
> +---------------------------------------------------------------
> +
> +Boards with a SoC of the Marvell Berlin (88DE3xxx) family, e.g. Armada 1500
> +shall have the following properties:
> +
> +* Required root node properties:
> +compatible: must contain "marvell,berlin"
> +
> +In addition, the above compatible shall be extended with the specific
> +SoC and board used. Currently known SoC compatibles are:
> + "marvell,88de3100" for Marvell 88DE3100 (Armada 1500),
> + "marvell,88de3010" for Marvell 88DE3010 (Armada 1000),
> + "marvell,88de3005" for Marvell 88DE3005 (Armada 1500-mini)

Jisheng,

I am trying to follow your request to get rid of 88DExxxx numbering and
replace it where possible with berlin type-of names.

For the above, I have:
"marvell,berlin-bg2" for Marvell Armada 1500 (BG2, 88DE3100)
"marvell,berlin-bg2cd" for Marvell Armada 1500-mini (BG2CD, 88DE3005)

I cannot pin down Armada 1000 in the BG naming scheme. It would be great
if you provide info here on how Marvell would like to see the
compatibles.

Sebastian

2013-10-14 23:18:24

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 7/8] ARM: add Armada 1500 and Sony NSZ-GS7 device tree files

On 10/15/2013 01:13 AM, Sebastian Hesselbarth wrote:
> On 10/08/2013 02:24 PM, Sebastian Hesselbarth wrote:
>> This adds very basic device tree files for the Marvell Armada 1500 SoC
>> (88DE3100) and the Sony NSZ-GS7 GoogleTV board. Currently, SoC only has
>> nodes for cpus, some clocks, l2 cache controller, local timer, apb
>> timers,
>> uart, and interrupt controllers. The Sony NSZ-GS7 is a GoogleTV consumer
>> device comprising the Armada 1500 SoC above.
>>
>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>> Reviewed-by: Jason Cooper <[email protected]>
>> Reviewed-by: Thomas Petazzoni <[email protected]>
>> Reviewed-by: Arnd Bergmann <[email protected]>
>> ---
>> Changelog:
>> RCFv2->v1:
>> - switch to (soon to be) correct "marvell,pj4b" cpu compatible
>> - reference fixed-clock for uarts instead of hard-coded clock-frequency
>> - disable timers except two for clksrc and clkevt
>> RFCv1->RFCv2:
>> - add binding documentation (Reported by Jason Cooper)
>> - change l2cc from aurora to tauros3 (Reported by Thomas Petazzoni)
>> - add copyright reference
>> - adapt compatibles to mach-berlin instead of mach-mvebu
>>
>> Cc: Jason Cooper <[email protected]>
>> Cc: Thomas Petazzoni <[email protected]>
>> Cc: Arnd Bergmann <[email protected]>
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> ---
>> .../devicetree/bindings/arm/marvell,berlin.txt | 23 ++
>> arch/arm/boot/dts/Makefile | 2 +
>> arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts | 29 +++
>> arch/arm/boot/dts/mv88de3100.dtsi | 227
>> ++++++++++++++++++++
>> 4 files changed, 281 insertions(+)
>> create mode 100644
>> Documentation/devicetree/bindings/arm/marvell,berlin.txt
>> create mode 100644 arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts
>> create mode 100644 arch/arm/boot/dts/mv88de3100.dtsi
>>
>> diff --git a/Documentation/devicetree/bindings/arm/marvell,berlin.txt
>> b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
>> new file mode 100644
>> index 0000000..e389cba
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
>> @@ -0,0 +1,23 @@
>> +Marvell Berlin (88DE3xxx) family SoCs Device Tree Bindings
>> +---------------------------------------------------------------
>> +
>> +Boards with a SoC of the Marvell Berlin (88DE3xxx) family, e.g.
>> Armada 1500
>> +shall have the following properties:
>> +
>> +* Required root node properties:
>> +compatible: must contain "marvell,berlin"
>> +
>> +In addition, the above compatible shall be extended with the specific
>> +SoC and board used. Currently known SoC compatibles are:
>> + "marvell,88de3100" for Marvell 88DE3100 (Armada 1500),
>> + "marvell,88de3010" for Marvell 88DE3010 (Armada 1000),
>> + "marvell,88de3005" for Marvell 88DE3005 (Armada 1500-mini)
>
> Jisheng,

(adding Jisheng to Cc, missed that)

> I am trying to follow your request to get rid of 88DExxxx numbering and
> replace it where possible with berlin type-of names.
>
> For the above, I have:
> "marvell,berlin-bg2" for Marvell Armada 1500 (BG2, 88DE3100)
> "marvell,berlin-bg2cd" for Marvell Armada 1500-mini (BG2CD, 88DE3005)
>
> I cannot pin down Armada 1000 in the BG naming scheme. It would be great
> if you provide info here on how Marvell would like to see the
> compatibles.
>
> Sebastian
>

2013-10-15 03:09:00

by Jisheng Zhang

[permalink] [raw]
Subject: Re: [PATCH 7/8] ARM: add Armada 1500 and Sony NSZ-GS7 device tree files

Hi Sebastian,

On Mon, 14 Oct 2013 16:13:21 -0700
Sebastian Hesselbarth <[email protected]> wrote:

> On 10/08/2013 02:24 PM, Sebastian Hesselbarth wrote:
> > This adds very basic device tree files for the Marvell Armada 1500 SoC
> > (88DE3100) and the Sony NSZ-GS7 GoogleTV board. Currently, SoC only has
> > nodes for cpus, some clocks, l2 cache controller, local timer, apb timers,
> > uart, and interrupt controllers. The Sony NSZ-GS7 is a GoogleTV consumer
> > device comprising the Armada 1500 SoC above.
> >
> > Signed-off-by: Sebastian Hesselbarth <[email protected]>
> > Reviewed-by: Jason Cooper <[email protected]>
> > Reviewed-by: Thomas Petazzoni <[email protected]>
> > Reviewed-by: Arnd Bergmann <[email protected]>
> > ---
> > Changelog:
> > RCFv2->v1:
> > - switch to (soon to be) correct "marvell,pj4b" cpu compatible
> > - reference fixed-clock for uarts instead of hard-coded clock-frequency
> > - disable timers except two for clksrc and clkevt
> > RFCv1->RFCv2:
> > - add binding documentation (Reported by Jason Cooper)
> > - change l2cc from aurora to tauros3 (Reported by Thomas Petazzoni)
> > - add copyright reference
> > - adapt compatibles to mach-berlin instead of mach-mvebu
> >
> > Cc: Jason Cooper <[email protected]>
> > Cc: Thomas Petazzoni <[email protected]>
> > Cc: Arnd Bergmann <[email protected]>
> > Cc: [email protected]
> > Cc: [email protected]
> > Cc: [email protected]
> > Cc: [email protected]
> > ---
> > .../devicetree/bindings/arm/marvell,berlin.txt | 23 ++
> > arch/arm/boot/dts/Makefile | 2 +
> > arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts | 29 +++
> > arch/arm/boot/dts/mv88de3100.dtsi | 227
> > ++++++++++++++++++++ 4 files changed, 281 insertions(+)
> > create mode 100644
> > Documentation/devicetree/bindings/arm/marvell,berlin.txt create mode
> > 100644 arch/arm/boot/dts/mv88de3100-sony-nsz-gs7.dts create mode 100644
> > arch/arm/boot/dts/mv88de3100.dtsi
> >
> > diff --git a/Documentation/devicetree/bindings/arm/marvell,berlin.txt
> > b/Documentation/devicetree/bindings/arm/marvell,berlin.txt new file mode
> > 100644 index 0000000..e389cba
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
> > @@ -0,0 +1,23 @@
> > +Marvell Berlin (88DE3xxx) family SoCs Device Tree Bindings
> > +---------------------------------------------------------------
> > +
> > +Boards with a SoC of the Marvell Berlin (88DE3xxx) family, e.g. Armada
> > 1500 +shall have the following properties:
> > +
> > +* Required root node properties:
> > +compatible: must contain "marvell,berlin"
> > +
> > +In addition, the above compatible shall be extended with the specific
> > +SoC and board used. Currently known SoC compatibles are:
> > + "marvell,88de3100" for Marvell 88DE3100 (Armada 1500),
> > + "marvell,88de3010" for Marvell 88DE3010 (Armada 1000),
> > + "marvell,88de3005" for Marvell 88DE3005 (Armada 1500-mini)
>
> Jisheng,
>
> I am trying to follow your request to get rid of 88DExxxx numbering and
> replace it where possible with berlin type-of names.
Thanks for your help.
>
> For the above, I have:
> "marvell,berlin-bg2" for Marvell Armada 1500 (BG2, 88DE3100)
We prefer "marvell,berlin2" for BG2
> "marvell,berlin-bg2cd" for Marvell Armada 1500-mini (BG2CD, 88DE3005)
we prefer "marvell,berlin2cd" for BG2CD, "marvell,berlin2ct" for BG2CT,
and "marvell,berlin3" for BG3, etc.


Thanks,
Jisheng

2013-10-15 03:12:44

by Jisheng Zhang

[permalink] [raw]
Subject: Re: [PATCH 4/8] ARM: add Marvell Berlin SoC familiy to Marvell doc

Hi Sebastian,

On Mon, 14 Oct 2013 16:09:07 -0700
Sebastian Hesselbarth <[email protected]> wrote:

> On 10/08/2013 02:24 PM, Sebastian Hesselbarth wrote:
> > This adds known facts and rumors about the Marvell Berlin (88DE3xxx) SoC
> > family to the Marvell SoC documentation.
> >
> > Signed-off-by: Sebastian Hesselbarth <[email protected]>
> > Reviewed-by: Jason Cooper <[email protected]>
> > Reviewed-by: Thomas Petazzoni <[email protected]>
> > Reviewed-by: Arnd Bergmann <[email protected]>
> > ---
> > Changelog:
> > RFCv2->v1:
> > - move Berlin below PXA/MMP[23] where it belongs to
> > - add note about IP (re-)used in Berlin SoCs
> > RFCv1->RFCv2:
> > - initial patch
> >
> > Cc: Jason Cooper <[email protected]>
> > Cc: Thomas Petazzoni <[email protected]>
> > Cc: Arnd Bergmann <[email protected]>
> > Cc: Rob Landley <[email protected]>
> > Cc: [email protected]
> > Cc: [email protected]
> > Cc: [email protected]
> > ---
> > Documentation/arm/Marvell/README | 29 +++++++++++++++++++++++++++++
> > 1 file changed, 29 insertions(+)
> >
> > diff --git a/Documentation/arm/Marvell/README
> > b/Documentation/arm/Marvell/README index 8f08a86..993c45d 100644
> > --- a/Documentation/arm/Marvell/README
> > +++ b/Documentation/arm/Marvell/README
> > @@ -210,6 +210,35 @@ MMP/MMP2 family (communication processor)
> > Linux kernel mach directory: arch/arm/mach-mmp
> > Linux kernel plat directory: arch/arm/plat-pxa
> >
> > +Berlin family (Digital Entertainment)
> > +-------------------------------------
> > +
> > + Flavors:
> > + 88DE3005, Armada 1500-mini
> > + Design name: BG2CD(A0)
> > + Core: ARM Cortex-A9, PL310 L2CC
> > + Homepage:
> > http://www.marvell.com/digital-entertainment/armada-1500-mini/
> > + 88DE3010, Armada 1000
> > + Design name: BG2(?)
> > + Core: Marvell PJ4B (ARMv7), Tauros3 L2CC
> > + Product Brief:
> > http://www.marvell.com/digital-entertainment/assets/armada_1000_pb.pdf
> > + 88DE3100, Armada 1500
> > + Design name: BG2(A0)
> > + Core: Marvell PJ4B (ARMv7), Tauros3 L2CC
> > + Homepage:
> > http://www.marvell.com/digital-entertainment/armada-1500/
> > + Product Brief:
> > http://www.marvell.com/digital-entertainment/armada-1500/assets/Marvell-ARMADA-1500-Product-Brief.pdf
> > + 88DE????
> > + Design name: BG3
> > + Core: ARM Cortex-A15, CA15 integrated L2CC
>
> Jisheng,
>
> can you comment on the above and fill in the missing pieces?
>
> Especially, if we want to base device tree compatibles later, we should
> make it right in the first place.
>

Sorry, I can't leak some information now. So could we remove the BG3 and 88DE3010 sections?
I promise I will update those information when I submit BG3 enable patches in near future.

Thanks,
Jisheng

2013-10-15 17:09:32

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH 4/8] ARM: add Marvell Berlin SoC familiy to Marvell doc

On 10/15/2013 05:10 AM, Jisheng Zhang wrote:
> Hi Sebastian,
>
> On Mon, 14 Oct 2013 16:09:07 -0700
> Sebastian Hesselbarth <[email protected]> wrote:
>
>> On 10/08/2013 02:24 PM, Sebastian Hesselbarth wrote:
>>> This adds known facts and rumors about the Marvell Berlin (88DE3xxx) SoC
>>> family to the Marvell SoC documentation.
>>>
>>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>>> Reviewed-by: Jason Cooper <[email protected]>
>>> Reviewed-by: Thomas Petazzoni <[email protected]>
>>> Reviewed-by: Arnd Bergmann <[email protected]>
>>> ---
>>> Changelog:
>>> RFCv2->v1:
>>> - move Berlin below PXA/MMP[23] where it belongs to
>>> - add note about IP (re-)used in Berlin SoCs
>>> RFCv1->RFCv2:
>>> - initial patch
>>>
>>> Cc: Jason Cooper <[email protected]>
>>> Cc: Thomas Petazzoni <[email protected]>
>>> Cc: Arnd Bergmann <[email protected]>
>>> Cc: Rob Landley <[email protected]>
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> ---
>>> Documentation/arm/Marvell/README | 29 +++++++++++++++++++++++++++++
>>> 1 file changed, 29 insertions(+)
>>>
>>> diff --git a/Documentation/arm/Marvell/README
>>> b/Documentation/arm/Marvell/README index 8f08a86..993c45d 100644
>>> --- a/Documentation/arm/Marvell/README
>>> +++ b/Documentation/arm/Marvell/README
>>> @@ -210,6 +210,35 @@ MMP/MMP2 family (communication processor)
>>> Linux kernel mach directory: arch/arm/mach-mmp
>>> Linux kernel plat directory: arch/arm/plat-pxa
>>>
>>> +Berlin family (Digital Entertainment)
>>> +-------------------------------------
>>> +
>>> + Flavors:
>>> + 88DE3005, Armada 1500-mini
>>> + Design name: BG2CD(A0)
>>> + Core: ARM Cortex-A9, PL310 L2CC
>>> + Homepage:
>>> http://www.marvell.com/digital-entertainment/armada-1500-mini/
>>> + 88DE3010, Armada 1000
>>> + Design name: BG2(?)
>>> + Core: Marvell PJ4B (ARMv7), Tauros3 L2CC
>>> + Product Brief:
>>> http://www.marvell.com/digital-entertainment/assets/armada_1000_pb.pdf
>>> + 88DE3100, Armada 1500
>>> + Design name: BG2(A0)
>>> + Core: Marvell PJ4B (ARMv7), Tauros3 L2CC
>>> + Homepage:
>>> http://www.marvell.com/digital-entertainment/armada-1500/
>>> + Product Brief:
>>> http://www.marvell.com/digital-entertainment/armada-1500/assets/Marvell-ARMADA-1500-Product-Brief.pdf
>>> + 88DE????
>>> + Design name: BG3
>>> + Core: ARM Cortex-A15, CA15 integrated L2CC
>>
>> Jisheng,
>>
>> can you comment on the above and fill in the missing pieces?
>>
>> Especially, if we want to base device tree compatibles later, we should
>> make it right in the first place.
>>
>
> Sorry, I can't leak some information now. So could we remove the BG3 and 88DE3010 sections?
> I promise I will update those information when I submit BG3 enable patches in near future.

Ok, but I leave the place-holders above for you to remember ;)

One last question: Can you at least tell what pl310 revision (e.g. r0p0
or r2p0) Tauros3's aux_ctrl is compatible with?

Sebastian

2013-10-17 06:37:53

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH v2 1/8] irqchip: add DesignWare APB ICTL interrupt controller

This adds an irqchip driver and corresponding devicetree binding for the
secondary interrupt controllers based on Synopsys DesignWare IP dw_apb_ictl.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Reviewed-by: Mark Rutland <[email protected]>
Reviewed-by: Jisheng Zhang <[email protected]>
---
Changelog:
v1->v2:
- reword binding docu for reg property and add FIQ decoding note
(Suggested by Mark Rutland)
- add cleanup on error path (Reported by Jisheng Zhang)
RFCv1->RFCv2:
- added copyright reference

Cc: Jason Cooper <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Jisheng Zhang <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
.../interrupt-controller/snps,dw-apb-ictl.txt | 32 +++++
drivers/irqchip/Kconfig | 4 +
drivers/irqchip/Makefile | 1 +
drivers/irqchip/irq-dw-apb-ictl.c | 150 ++++++++++++++++++++
4 files changed, 187 insertions(+)
create mode 100644 Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
create mode 100644 drivers/irqchip/irq-dw-apb-ictl.c

diff --git a/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt b/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
new file mode 100644
index 0000000..4929117
--- /dev/null
+++ b/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
@@ -0,0 +1,32 @@
+Synopsys DesignWare APB interrupt controller (dw_apb_ictl)
+
+Synopsys DesignWare provides interrupt controller IP for APB known as
+dw_apb_ictl. The IP is used as secondary interrupt controller in some SoCs with
+APB bus, e.g. Marvell Armada 1500.
+
+Required properties:
+- compatible: shall be "snps,dw-apb-ictl"
+- reg: physical base address of the controller and length of memory mapped
+ region starting with ENABLE_LOW register
+- interrupt-controller: identifies the node as an interrupt controller
+- #interrupt-cells: number of cells to encode an interrupt-specifier, shall be 1
+- interrupts: interrupt reference to primary interrupt controller
+- interrupt-parent: (optional) reference specific primary interrupt controller
+
+The interrupt sources map to the corresponding bits in the interrupt
+registers, i.e.
+- 0 maps to bit 0 of low interrupts,
+- 1 maps to bit 1 of low interrupts,
+- 32 maps to bit 0 of high interrupts,
+- 33 maps to bit 1 of high interrupts,
+- (optional) fast interrupts start at 64.
+
+Example:
+ aic: interrupt-controller@3000 {
+ compatible = "snps,dw-apb-ictl";
+ reg = <0x3000 0xc00>;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ interrupt-parent = <&gic>;
+ interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
+ };
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 3792a1a..940638d 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -30,6 +30,10 @@ config ARM_VIC_NR
The maximum number of VICs available in the system, for
power management.

+config DW_APB_ICTL
+ bool
+ select IRQ_DOMAIN
+
config IMGPDC_IRQ
bool
select GENERIC_IRQ_CHIP
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index c60b901..6427323 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_ARCH_MMP) += irq-mmp.o
obj-$(CONFIG_ARCH_MVEBU) += irq-armada-370-xp.o
obj-$(CONFIG_ARCH_MXS) += irq-mxs.o
obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o
+obj-$(CONFIG_DW_APB_ICTL) += irq-dw-apb-ictl.o
obj-$(CONFIG_METAG) += irq-metag-ext.o
obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o
obj-$(CONFIG_ARCH_MOXART) += irq-moxart.o
diff --git a/drivers/irqchip/irq-dw-apb-ictl.c b/drivers/irqchip/irq-dw-apb-ictl.c
new file mode 100644
index 0000000..31e231e
--- /dev/null
+++ b/drivers/irqchip/irq-dw-apb-ictl.c
@@ -0,0 +1,150 @@
+/*
+ * Synopsys DW APB ICTL irqchip driver.
+ *
+ * Sebastian Hesselbarth <[email protected]>
+ *
+ * based on GPL'ed 2.6 kernel sources
+ * (c) Marvell International Ltd.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+
+#include "irqchip.h"
+
+#define APB_INT_ENABLE_L 0x00
+#define APB_INT_ENABLE_H 0x04
+#define APB_INT_MASK_L 0x08
+#define APB_INT_MASK_H 0x0c
+#define APB_INT_FINALSTATUS_L 0x30
+#define APB_INT_FINALSTATUS_H 0x34
+
+static void dw_apb_ictl_handler(unsigned int irq, struct irq_desc *desc)
+{
+ struct irq_chip *chip = irq_get_chip(irq);
+ struct irq_chip_generic *gc = irq_get_handler_data(irq);
+ struct irq_domain *d = gc->private;
+ u32 stat;
+ int n;
+
+ chained_irq_enter(chip, desc);
+
+ for (n = 0; n < gc->num_ct; n++) {
+ stat = readl_relaxed(gc->reg_base +
+ APB_INT_FINALSTATUS_L + 4 * n);
+ while (stat) {
+ u32 hwirq = ffs(stat) - 1;
+ generic_handle_irq(irq_find_mapping(d,
+ gc->irq_base + hwirq + 32 * n));
+ stat &= ~(1 << hwirq);
+ }
+ }
+
+ chained_irq_exit(chip, desc);
+}
+
+static int __init dw_apb_ictl_init(struct device_node *np,
+ struct device_node *parent)
+{
+ unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
+ struct resource r;
+ struct irq_domain *domain;
+ struct irq_chip_generic *gc;
+ void __iomem *iobase;
+ int ret, nrirqs, irq;
+ u32 reg;
+
+ /* Map the parent interrupt for the chained handler */
+ irq = irq_of_parse_and_map(np, 0);
+ if (irq <= 0) {
+ pr_err("%s: unable to parse irq\n", np->full_name);
+ return -EINVAL;
+ }
+
+ ret = of_address_to_resource(np, 0, &r);
+ if (ret) {
+ pr_err("%s: unable to get resource\n", np->full_name);
+ return ret;
+ }
+
+ if (!request_mem_region(r.start, resource_size(&r), np->full_name)) {
+ pr_err("%s: unable to request mem region\n", np->full_name);
+ return -ENOMEM;
+ }
+
+ iobase = ioremap(r.start, resource_size(&r));
+ if (!iobase) {
+ pr_err("%s: unable to map resource\n", np->full_name);
+ ret = -ENOMEM;
+ goto err_release;
+ }
+
+ /*
+ * DW IP can be configured to allow 2-64 irqs. We can determine
+ * the number of irqs supported by writing into enable register
+ * and look for bits not set, as corresponding flip-flops will
+ * have been removed by sythesis tool.
+ */
+
+ /* mask and enable all interrupts */
+ writel(~0, iobase + APB_INT_MASK_L);
+ writel(~0, iobase + APB_INT_MASK_H);
+ writel(~0, iobase + APB_INT_ENABLE_L);
+ writel(~0, iobase + APB_INT_ENABLE_H);
+
+ reg = readl(iobase + APB_INT_ENABLE_H);
+ if (reg)
+ nrirqs = 32 + fls(reg);
+ else
+ nrirqs = fls(readl(iobase + APB_INT_ENABLE_L));
+
+ domain = irq_domain_add_linear(np, nrirqs,
+ &irq_generic_chip_ops, NULL);
+ if (!domain) {
+ pr_err("%s: unable to add irq domain\n", np->full_name);
+ ret = -ENOMEM;
+ goto err_unmap;
+ }
+
+ ret = irq_alloc_domain_generic_chips(domain, 32, (nrirqs > 32) ? 2 : 1,
+ np->name, handle_level_irq, clr, 0,
+ IRQ_GC_INIT_MASK_CACHE);
+ if (ret) {
+ pr_err("%s: unable to alloc irq domain gc\n", np->full_name);
+ goto err_unmap;
+ }
+
+ gc = irq_get_domain_generic_chip(domain, 0);
+ gc->private = domain;
+ gc->reg_base = iobase;
+
+ gc->chip_types[0].regs.mask = APB_INT_MASK_L;
+ gc->chip_types[0].chip.irq_mask = irq_gc_mask_set_bit;
+ gc->chip_types[0].chip.irq_unmask = irq_gc_mask_clr_bit;
+
+ if (nrirqs > 32) {
+ gc->chip_types[1].regs.mask = APB_INT_MASK_H;
+ gc->chip_types[1].chip.irq_mask = irq_gc_mask_set_bit;
+ gc->chip_types[1].chip.irq_unmask = irq_gc_mask_clr_bit;
+ }
+
+ irq_set_handler_data(irq, gc);
+ irq_set_chained_handler(irq, dw_apb_ictl_handler);
+
+ return 0;
+
+err_unmap:
+ iounmap(iobase);
+err_release:
+ release_mem_region(r.start, resource_size(&r));
+ return ret;
+}
+IRQCHIP_DECLARE(dw_apb_ictl,
+ "snps,dw-apb-ictl", dw_apb_ictl_init);
--
1.7.10.4

2013-10-17 06:38:03

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH v2 3/8] ARM: l2x0: add Marvell Tauros3 support

This adds support for the Marvell Tauros3 cache controller which
is compatible with pl310 cache controller but broadcasts L1 cache
operations to L2 cache. While updating the binding documentation,
clean up the list of possible compatibles. Also reorder driver
compatibles to allow non-ARM derivated to be compatible to ARM
cache controller compatibles.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Reviewed-by: Mark Rutland <[email protected]>
---
Changelog:
v1->v2:
- add tauros3 data without outer cache ops (Suggested by Jisheng Zhang)
- reorder compatibles to allow derivates to be compatible with ARM
controllers (Suggested by Mark Rutland)

Cc: Jason Cooper <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Jisheng Zhang <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
Documentation/devicetree/bindings/arm/l2cc.txt | 23 +++++------
arch/arm/include/asm/hardware/cache-l2x0.h | 1 +
arch/arm/mm/cache-l2x0.c | 49 ++++++++++++++++++++----
arch/arm/mm/cache-tauros3.h | 41 ++++++++++++++++++++
4 files changed, 95 insertions(+), 19 deletions(-)
create mode 100644 arch/arm/mm/cache-tauros3.h

diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2cc.txt
index c0c7626..b513cb8 100644
--- a/Documentation/devicetree/bindings/arm/l2cc.txt
+++ b/Documentation/devicetree/bindings/arm/l2cc.txt
@@ -7,20 +7,21 @@ The ARM L2 cache representation in the device tree should be done as follows:
Required properties:

- compatible : should be one of:
- "arm,pl310-cache"
- "arm,l220-cache"
- "arm,l210-cache"
- "marvell,aurora-system-cache": Marvell Controller designed to be
+ "arm,pl310-cache"
+ "arm,l220-cache"
+ "arm,l210-cache"
+ "bcm,bcm11351-a2-pl310-cache": DEPRECATED by "brcm,bcm11351-a2-pl310-cache"
+ "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
+ offset needs to be added to the address before passing down to the L2
+ cache controller
+ "marvell,aurora-system-cache": Marvell Controller designed to be
compatible with the ARM one, with system cache mode (meaning
maintenance operations on L1 are broadcasted to the L2 and L2
performs the same operation).
- "marvell,"aurora-outer-cache: Marvell Controller designed to be
- compatible with the ARM one with outer cache mode.
- "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
- offset needs to be added to the address before passing down to the L2
- cache controller
- "bcm,bcm11351-a2-pl310-cache": DEPRECATED by
- "brcm,bcm11351-a2-pl310-cache"
+ "marvell,aurora-outer-cache": Marvell Controller designed to be
+ compatible with the ARM one with outer cache mode.
+ "marvell,tauros3-cache": Marvell Tauros3 cache controller, compatible
+ with arm,pl310-cache controller.
- cache-unified : Specifies the cache is a unified cache.
- cache-level : Should be set to 2 for a level 2 cache.
- reg : Physical base address and size of cache controller's memory mapped
diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h
index 3b2c40b..6795ff7 100644
--- a/arch/arm/include/asm/hardware/cache-l2x0.h
+++ b/arch/arm/include/asm/hardware/cache-l2x0.h
@@ -131,6 +131,7 @@ struct l2x0_regs {
unsigned long prefetch_ctrl;
unsigned long pwr_ctrl;
unsigned long ctrl;
+ unsigned long aux2_ctrl;
};

extern struct l2x0_regs l2x0_saved_regs;
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 447da6f..a70a4f5 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -25,6 +25,7 @@

#include <asm/cacheflush.h>
#include <asm/hardware/cache-l2x0.h>
+#include "cache-tauros3.h"
#include "cache-aurora-l2.h"

#define CACHE_LINE_SIZE 32
@@ -767,6 +768,14 @@ static void aurora_save(void)
l2x0_saved_regs.aux_ctrl = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
}

+static void __init tauros3_save(void)
+{
+ l2x0_saved_regs.aux2_ctrl =
+ readl_relaxed(l2x0_base + TAUROS3_AUX2_CTRL);
+ l2x0_saved_regs.prefetch_ctrl =
+ readl_relaxed(l2x0_base + L2X0_PREFETCH_CTRL);
+}
+
static void l2x0_resume(void)
{
if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
@@ -821,6 +830,18 @@ static void aurora_resume(void)
}
}

+static void tauros3_resume(void)
+{
+ if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
+ writel_relaxed(l2x0_saved_regs.aux2_ctrl,
+ l2x0_base + TAUROS3_AUX2_CTRL);
+ writel_relaxed(l2x0_saved_regs.prefetch_ctrl,
+ l2x0_base + L2X0_PREFETCH_CTRL);
+ }
+
+ l2x0_resume();
+}
+
static void __init aurora_broadcast_l2_commands(void)
{
__u32 u;
@@ -906,6 +927,15 @@ static const struct l2x0_of_data aurora_no_outer_data = {
},
};

+static const struct l2x0_of_data tauros3_data = {
+ .setup = NULL,
+ .save = tauros3_save,
+ /* Tauros3 broadcasts L1 cache operations to L2 */
+ .outer_cache = {
+ .resume = tauros3_resume,
+ },
+};
+
static const struct l2x0_of_data bcm_l2x0_data = {
.setup = pl310_of_setup,
.save = pl310_save,
@@ -922,17 +952,20 @@ static const struct l2x0_of_data bcm_l2x0_data = {
};

static const struct of_device_id l2x0_ids[] __initconst = {
+ { .compatible = "bcm,bcm11351-a2-pl310-cache", /* deprecated name */
+ .data = (void *)&bcm_l2x0_data},
+ { .compatible = "brcm,bcm11351-a2-pl310-cache",
+ .data = (void *)&bcm_l2x0_data},
+ { .compatible = "marvell,aurora-outer-cache",
+ .data = (void *)&aurora_with_outer_data},
+ { .compatible = "marvell,aurora-system-cache",
+ .data = (void *)&aurora_no_outer_data},
+ { .compatible = "marvell,tauros3-cache",
+ .data = (void *)&tauros3_data },
+ /* keep ARM compatibles below non-ARM derivates */
{ .compatible = "arm,pl310-cache", .data = (void *)&pl310_data },
{ .compatible = "arm,l220-cache", .data = (void *)&l2x0_data },
{ .compatible = "arm,l210-cache", .data = (void *)&l2x0_data },
- { .compatible = "marvell,aurora-system-cache",
- .data = (void *)&aurora_no_outer_data},
- { .compatible = "marvell,aurora-outer-cache",
- .data = (void *)&aurora_with_outer_data},
- { .compatible = "brcm,bcm11351-a2-pl310-cache",
- .data = (void *)&bcm_l2x0_data},
- { .compatible = "bcm,bcm11351-a2-pl310-cache", /* deprecated name */
- .data = (void *)&bcm_l2x0_data},
{}
};

diff --git a/arch/arm/mm/cache-tauros3.h b/arch/arm/mm/cache-tauros3.h
new file mode 100644
index 0000000..02c0a97
--- /dev/null
+++ b/arch/arm/mm/cache-tauros3.h
@@ -0,0 +1,41 @@
+/*
+ * Marvell Tauros3 cache controller includes
+ *
+ * Sebastian Hesselbarth <[email protected]>
+ *
+ * based on GPL'ed 2.6 kernel sources
+ * (c) Marvell International Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __ASM_ARM_HARDWARE_TAUROS3_H
+#define __ASM_ARM_HARDWARE_TAUROS3_H
+
+/*
+ * Marvell Tauros3 L2CC is compatible with PL310 r0p0
+ * but with PREFETCH_CTRL (r2p0) and an additional event counter.
+ * Also, there is AUX2_CTRL for some Marvell specific control.
+ */
+
+#define TAUROS3_EVENT_CNT2_CFG 0x224
+#define TAUROS3_EVENT_CNT2_VAL 0x228
+#define TAUROS3_INV_ALL 0x780
+#define TAUROS3_CLEAN_ALL 0x784
+#define TAUROS3_AUX2_CTRL 0x820
+
+/* Registers shifts and masks */
+#define TAUROS3_AUX2_CTRL_LINEFILL_BURST8_EN (1 << 2)
+
+#endif
--
1.7.10.4

2013-10-17 06:38:10

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH v2 7/8] ARM: add Armada 1500 and Sony NSZ-GS7 device tree files

This adds very basic device tree files for the Marvell Armada 1500 SoC
(Berlin BG2) and the Sony NSZ-GS7 GoogleTV board. Currently, SoC only has
nodes for cpus, some clocks, l2 cache controller, local timer, apb timers,
uart, and interrupt controllers. The Sony NSZ-GS7 is a GoogleTV consumer
device comprising the Armada 1500 SoC above.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Reviewed-by: Jason Cooper <[email protected]>
Reviewed-by: Thomas Petazzoni <[email protected]>
Reviewed-by: Arnd Bergmann <[email protected]>
Reviewed-by: Jisheng Zhang <[email protected]>
---
Changelog:
v1->v2:
- add "arm,pl310-cache" compatible to l2cc (Suggested by Mark Rutland)
- replace 88DE3xxx numbering with SoC variant name
(Requested by Jisheng Zhang)
RCFv2->v1:
- switch to (soon to be) correct "marvell,pj4b" cpu compatible
- reference fixed-clock for uarts instead of hard-coded clock-frequency
- disable timers except two for clksrc and clkevt
RFCv1->RFCv2:
- add binding documentation (Reported by Jason Cooper)
- change l2cc from aurora to tauros3 (Reported by Thomas Petazzoni)
- add copyright reference
- adapt compatibles to mach-berlin instead of mach-mvebu

Cc: Jason Cooper <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Jisheng Zhang <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
.../devicetree/bindings/arm/marvell,berlin.txt | 24 +++
arch/arm/boot/dts/Makefile | 2 +
arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts | 29 +++
arch/arm/boot/dts/berlin2.dtsi | 227 ++++++++++++++++++++
4 files changed, 282 insertions(+)
create mode 100644 Documentation/devicetree/bindings/arm/marvell,berlin.txt
create mode 100644 arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts
create mode 100644 arch/arm/boot/dts/berlin2.dtsi

diff --git a/Documentation/devicetree/bindings/arm/marvell,berlin.txt b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
new file mode 100644
index 0000000..737afa5
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/marvell,berlin.txt
@@ -0,0 +1,24 @@
+Marvell Berlin SoC Family Device Tree Bindings
+---------------------------------------------------------------
+
+Boards with a SoC of the Marvell Berlin family, e.g. Armada 1500
+shall have the following properties:
+
+* Required root node properties:
+compatible: must contain "marvell,berlin"
+
+In addition, the above compatible shall be extended with the specific
+SoC and board used. Currently known SoC compatibles are:
+ "marvell,berlin2" for Marvell Armada 1500 (BG2, 88DE3100),
+ "marvell,berlin2cd" for Marvell Armada 1500-mini (BG2CD, 88DE3005)
+ "marvell,berlin2ct" for Marvell Armada ? (BG2CT, 88DE????)
+ "marvell,berlin3" for Marvell Armada ? (BG3, 88DE????)
+
+* Example:
+
+/ {
+ model = "Sony NSZ-GS7";
+ compatible = "sony,nsz-gs7", "marvell,berlin2", "marvell,berlin";
+
+ ...
+}
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 802720e..c9c1a6c 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -46,6 +46,8 @@ dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb
dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
dtb-$(CONFIG_ARCH_BCM) += bcm11351-brt.dtb \
bcm28155-ap.dtb
+dtb-$(CONFIG_ARCH_BERLIN) += \
+ berlin2-sony-nsz-gs7.dtb
dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \
da850-evm.dtb
dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \
diff --git a/arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts b/arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts
new file mode 100644
index 0000000..c72bfd4
--- /dev/null
+++ b/arch/arm/boot/dts/berlin2-sony-nsz-gs7.dts
@@ -0,0 +1,29 @@
+/*
+ * Device Tree file for Sony NSZ-GS7
+ *
+ * Sebastian Hesselbarth <[email protected]>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+/dts-v1/;
+
+#include "berlin2.dtsi"
+
+/ {
+ model = "Sony NSZ-GS7";
+ compatible = "sony,nsz-gs7", "marvell,berlin2", "marvell,berlin";
+
+ chosen {
+ bootargs = "console=ttyS0,115200 earlyprintk";
+ };
+
+ memory {
+ device_type = "memory";
+ reg = <0x00000000 0x40000000>; /* 1 GB */
+ };
+};
+
+&uart0 { status = "okay"; };
diff --git a/arch/arm/boot/dts/berlin2.dtsi b/arch/arm/boot/dts/berlin2.dtsi
new file mode 100644
index 0000000..56a1af2
--- /dev/null
+++ b/arch/arm/boot/dts/berlin2.dtsi
@@ -0,0 +1,227 @@
+/*
+ * Device Tree Include file for Marvell Armada 1500 (Berlin BG2) SoC
+ *
+ * Sebastian Hesselbarth <[email protected]>
+ *
+ * based on GPL'ed 2.6 kernel sources
+ * (c) Marvell International Ltd.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include "skeleton.dtsi"
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+ model = "Marvell Armada 1500 (BG2) SoC";
+ compatible = "marvell,berlin2", "marvell,berlin";
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ cpu@0 {
+ compatible = "marvell,pj4b";
+ device_type = "cpu";
+ next-level-cache = <&l2>;
+ reg = <0>;
+ };
+
+ cpu@1 {
+ compatible = "marvell,pj4b";
+ device_type = "cpu";
+ next-level-cache = <&l2>;
+ reg = <1>;
+ };
+ };
+
+ clocks {
+ smclk: sysmgr-clock {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <25000000>;
+ };
+
+ cfgclk: cfg-clock {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <100000000>;
+ };
+
+ sysclk: system-clock {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <400000000>;
+ };
+ };
+
+ soc {
+ compatible = "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ interrupt-parent = <&gic>;
+
+ ranges = <0 0xf7000000 0x1000000>;
+
+ l2: l2-cache-controller@ac0000 {
+ compatible = "marvell,tauros3-cache", "arm,pl310-cache";
+ reg = <0xac0000 0x1000>;
+ cache-unified;
+ cache-level = <2>;
+ };
+
+ gic: interrupt-controller@ad1000 {
+ compatible = "arm,cortex-a9-gic";
+ reg = <0xad1000 0x1000>, <0xad0100 0x0100>;
+ interrupt-controller;
+ #interrupt-cells = <3>;
+ };
+
+ local-timer@ad0600 {
+ compatible = "arm,cortex-a9-twd-timer";
+ reg = <0xad0600 0x20>;
+ interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&sysclk>;
+ };
+
+ apb@e80000 {
+ compatible = "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ ranges = <0 0xe80000 0x10000>;
+ interrupt-parent = <&aic>;
+
+ timer0: timer@2c00 {
+ compatible = "snps,dw-apb-timer";
+ reg = <0x2c00 0x14>;
+ interrupts = <8>;
+ clocks = <&cfgclk>;
+ clock-names = "timer";
+ status = "okay";
+ };
+
+ timer1: timer@2c14 {
+ compatible = "snps,dw-apb-timer";
+ reg = <0x2c14 0x14>;
+ interrupts = <9>;
+ clocks = <&cfgclk>;
+ clock-names = "timer";
+ status = "okay";
+ };
+
+ timer2: timer@2c28 {
+ compatible = "snps,dw-apb-timer";
+ reg = <0x2c28 0x14>;
+ interrupts = <10>;
+ clocks = <&cfgclk>;
+ clock-names = "timer";
+ status = "disabled";
+ };
+
+ timer3: timer@2c3c {
+ compatible = "snps,dw-apb-timer";
+ reg = <0x2c3c 0x14>;
+ interrupts = <11>;
+ clocks = <&cfgclk>;
+ clock-names = "timer";
+ status = "disabled";
+ };
+
+ timer4: timer@2c50 {
+ compatible = "snps,dw-apb-timer";
+ reg = <0x2c50 0x14>;
+ interrupts = <12>;
+ clocks = <&cfgclk>;
+ clock-names = "timer";
+ status = "disabled";
+ };
+
+ timer5: timer@2c64 {
+ compatible = "snps,dw-apb-timer";
+ reg = <0x2c64 0x14>;
+ interrupts = <13>;
+ clocks = <&cfgclk>;
+ clock-names = "timer";
+ status = "disabled";
+ };
+
+ timer6: timer@2c78 {
+ compatible = "snps,dw-apb-timer";
+ reg = <0x2c78 0x14>;
+ interrupts = <14>;
+ clocks = <&cfgclk>;
+ clock-names = "timer";
+ status = "disabled";
+ };
+
+ timer7: timer@2c8c {
+ compatible = "snps,dw-apb-timer";
+ reg = <0x2c8c 0x14>;
+ interrupts = <15>;
+ clocks = <&cfgclk>;
+ clock-names = "timer";
+ status = "disabled";
+ };
+
+ aic: interrupt-controller@3000 {
+ compatible = "snps,dw-apb-ictl";
+ reg = <0x3000 0xc00>;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ interrupt-parent = <&gic>;
+ interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
+ };
+ };
+
+ apb@fc0000 {
+ compatible = "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ ranges = <0 0xfc0000 0x10000>;
+ interrupt-parent = <&sic>;
+
+ uart0: serial@9000 {
+ compatible = "snps,dw-apb-uart";
+ reg = <0x9000 0x100>;
+ reg-shift = <2>;
+ reg-io-width = <1>;
+ interrupts = <8>;
+ clocks = <&smclk>;
+ status = "disabled";
+ };
+
+ uart1: serial@a000 {
+ compatible = "snps,dw-apb-uart";
+ reg = <0xa000 0x100>;
+ reg-shift = <2>;
+ reg-io-width = <1>;
+ interrupts = <9>;
+ clocks = <&smclk>;
+ status = "disabled";
+ };
+
+ uart2: serial@b000 {
+ compatible = "snps,dw-apb-uart";
+ reg = <0xb000 0x100>;
+ reg-shift = <2>;
+ reg-io-width = <1>;
+ interrupts = <10>;
+ clocks = <&smclk>;
+ status = "disabled";
+ };
+
+ sic: interrupt-controller@e000 {
+ compatible = "snps,dw-apb-ictl";
+ reg = <0xe000 0x400>;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ interrupt-parent = <&gic>;
+ interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
+ };
+ };
+ };
+};
--
1.7.10.4

2013-10-17 06:38:12

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH v2 8/8] ARM: add initial support for Marvell Berlin SoCs

This adds initial support for the Marvell Berlin (88DE3xxx) SoC family
and basic machine setup for Armada 1500 (88DE3100) SoCs.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
Reviewed-by: Jason Cooper <[email protected]>
Reviewed-by: Thomas Petazzoni <[email protected]>
Reviewed-by: Arnd Bergmann <[email protected]>
---
Changelog:
v1->v2:
- replace 88DE3xxx numbering with SoC variant name
(Requested by Jisheng Zhang)
- remove LOCAL_TIMERS dependency (Suggested by Dinh Nguyen)
RFCv2->v1:
- remove custom .init_time, adds dependency for arch-wide of_clk_init call
RFCv1->RFCv2:
- nuke .map_io (Reported by Arnd Bergmann)
- add copyright reference
- switch to mach-berlin instead of mach-mvebu

Cc: Jason Cooper <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Russell King <[email protected]>
Cc: Jisheng Zhang <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/Kconfig | 2 ++
arch/arm/Makefile | 1 +
arch/arm/mach-berlin/Kconfig | 23 +++++++++++++++++++++++
arch/arm/mach-berlin/Makefile | 1 +
arch/arm/mach-berlin/berlin.c | 39 +++++++++++++++++++++++++++++++++++++++
5 files changed, 66 insertions(+)
create mode 100644 arch/arm/mach-berlin/Kconfig
create mode 100644 arch/arm/mach-berlin/Makefile
create mode 100644 arch/arm/mach-berlin/berlin.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1ad6fb6..5692426 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -932,6 +932,8 @@ source "arch/arm/mach-bcm/Kconfig"

source "arch/arm/mach-bcm2835/Kconfig"

+source "arch/arm/mach-berlin/Kconfig"
+
source "arch/arm/mach-clps711x/Kconfig"

source "arch/arm/mach-cns3xxx/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index a37a50f..3ba332b 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -147,6 +147,7 @@ textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
machine-$(CONFIG_ARCH_AT91) += at91
machine-$(CONFIG_ARCH_BCM) += bcm
machine-$(CONFIG_ARCH_BCM2835) += bcm2835
+machine-$(CONFIG_ARCH_BERLIN) += berlin
machine-$(CONFIG_ARCH_CLPS711X) += clps711x
machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx
machine-$(CONFIG_ARCH_DAVINCI) += davinci
diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig
new file mode 100644
index 0000000..bdd5383
--- /dev/null
+++ b/arch/arm/mach-berlin/Kconfig
@@ -0,0 +1,23 @@
+config ARCH_BERLIN
+ bool "Marvell Berlin SoCs" if ARCH_MULTI_V7
+ select GENERIC_CLOCKEVENTS
+ select GENERIC_IRQ_CHIP
+ select COMMON_CLK
+ select DW_APB_ICTL
+ select DW_APB_TIMER_OF
+
+if ARCH_BERLIN
+
+menu "Marvell Berlin SoC variants"
+
+config MACH_BERLIN_BG2
+ bool "Marvell Armada 1500 (BG2)"
+ select ARM_GIC
+ select CACHE_L2X0
+ select CPU_PJ4B
+ select HAVE_ARM_TWD if SMP
+ select HAVE_SMP
+
+endmenu
+
+endif
diff --git a/arch/arm/mach-berlin/Makefile b/arch/arm/mach-berlin/Makefile
new file mode 100644
index 0000000..ab69fe9
--- /dev/null
+++ b/arch/arm/mach-berlin/Makefile
@@ -0,0 +1 @@
+obj-y += berlin.o
diff --git a/arch/arm/mach-berlin/berlin.c b/arch/arm/mach-berlin/berlin.c
new file mode 100644
index 0000000..16c2942
--- /dev/null
+++ b/arch/arm/mach-berlin/berlin.c
@@ -0,0 +1,39 @@
+/*
+ * Device Tree support for Marvell Berlin SoCs.
+ *
+ * Sebastian Hesselbarth <[email protected]>
+ *
+ * based on GPL'ed 2.6 kernel sources
+ * (c) Marvell International Ltd.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/of_platform.h>
+#include <asm/hardware/cache-l2x0.h>
+#include <asm/mach/arch.h>
+
+static void __init berlin_init_machine(void)
+{
+ /*
+ * with DT probing for L2CCs, berlin_init_machine can be removed.
+ * Note: 88DE3005 (Armada 1500-mini) uses pl310 l2cc
+ */
+ l2x0_of_init(0x70c00000, 0xfeffffff);
+ of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char * const berlin_dt_compat[] = {
+ "marvell,berlin",
+ NULL,
+};
+
+DT_MACHINE_START(BERLIN_DT, "Marvell Berlin")
+ .dt_compat = berlin_dt_compat,
+ .init_machine = berlin_init_machine,
+MACHINE_END
--
1.7.10.4

2013-10-25 21:31:06

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH v2 1/8] irqchip: add DesignWare APB ICTL interrupt controller

On 10/17/2013 07:37 AM, Sebastian Hesselbarth wrote:
> This adds an irqchip driver and corresponding devicetree binding for the
> secondary interrupt controllers based on Synopsys DesignWare IP dw_apb_ictl.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> Reviewed-by: Mark Rutland <[email protected]>
> Reviewed-by: Jisheng Zhang <[email protected]>

Thomas (tglx),

can you please look at this and review it? IIRC, Olof already closed
the arm-soc merge window for v3.13, so there is plenty of time to get
this straight. Nevertheless, it would be great to have it in early in
v3.13.

Also, I prefer to have Mark look at the bindings again and maybe
update his remarks with the latest conclusions of KS.

Regards,
Sebastian

> ---
> Changelog:
> v1->v2:
> - reword binding docu for reg property and add FIQ decoding note
> (Suggested by Mark Rutland)
> - add cleanup on error path (Reported by Jisheng Zhang)
> RFCv1->RFCv2:
> - added copyright reference
>
> Cc: Jason Cooper <[email protected]>
> Cc: Thomas Petazzoni <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Thomas Gleixner <[email protected]>
> Cc: Mark Rutland <[email protected]>
> Cc: Jisheng Zhang <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> ---
> .../interrupt-controller/snps,dw-apb-ictl.txt | 32 +++++
> drivers/irqchip/Kconfig | 4 +
> drivers/irqchip/Makefile | 1 +
> drivers/irqchip/irq-dw-apb-ictl.c | 150 ++++++++++++++++++++
> 4 files changed, 187 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
> create mode 100644 drivers/irqchip/irq-dw-apb-ictl.c
>
> diff --git a/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt b/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
> new file mode 100644
> index 0000000..4929117
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
> @@ -0,0 +1,32 @@
> +Synopsys DesignWare APB interrupt controller (dw_apb_ictl)
> +
> +Synopsys DesignWare provides interrupt controller IP for APB known as
> +dw_apb_ictl. The IP is used as secondary interrupt controller in some SoCs with
> +APB bus, e.g. Marvell Armada 1500.
> +
> +Required properties:
> +- compatible: shall be "snps,dw-apb-ictl"
> +- reg: physical base address of the controller and length of memory mapped
> + region starting with ENABLE_LOW register
> +- interrupt-controller: identifies the node as an interrupt controller
> +- #interrupt-cells: number of cells to encode an interrupt-specifier, shall be 1
> +- interrupts: interrupt reference to primary interrupt controller
> +- interrupt-parent: (optional) reference specific primary interrupt controller
> +
> +The interrupt sources map to the corresponding bits in the interrupt
> +registers, i.e.
> +- 0 maps to bit 0 of low interrupts,
> +- 1 maps to bit 1 of low interrupts,
> +- 32 maps to bit 0 of high interrupts,
> +- 33 maps to bit 1 of high interrupts,
> +- (optional) fast interrupts start at 64.
> +
> +Example:
> + aic: interrupt-controller@3000 {
> + compatible = "snps,dw-apb-ictl";
> + reg = <0x3000 0xc00>;
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + interrupt-parent = <&gic>;
> + interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
> + };
> diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
> index 3792a1a..940638d 100644
> --- a/drivers/irqchip/Kconfig
> +++ b/drivers/irqchip/Kconfig
> @@ -30,6 +30,10 @@ config ARM_VIC_NR
> The maximum number of VICs available in the system, for
> power management.
>
> +config DW_APB_ICTL
> + bool
> + select IRQ_DOMAIN
> +
> config IMGPDC_IRQ
> bool
> select GENERIC_IRQ_CHIP
> diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
> index c60b901..6427323 100644
> --- a/drivers/irqchip/Makefile
> +++ b/drivers/irqchip/Makefile
> @@ -6,6 +6,7 @@ obj-$(CONFIG_ARCH_MMP) += irq-mmp.o
> obj-$(CONFIG_ARCH_MVEBU) += irq-armada-370-xp.o
> obj-$(CONFIG_ARCH_MXS) += irq-mxs.o
> obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o
> +obj-$(CONFIG_DW_APB_ICTL) += irq-dw-apb-ictl.o
> obj-$(CONFIG_METAG) += irq-metag-ext.o
> obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o
> obj-$(CONFIG_ARCH_MOXART) += irq-moxart.o
> diff --git a/drivers/irqchip/irq-dw-apb-ictl.c b/drivers/irqchip/irq-dw-apb-ictl.c
> new file mode 100644
> index 0000000..31e231e
> --- /dev/null
> +++ b/drivers/irqchip/irq-dw-apb-ictl.c
> @@ -0,0 +1,150 @@
> +/*
> + * Synopsys DW APB ICTL irqchip driver.
> + *
> + * Sebastian Hesselbarth <[email protected]>
> + *
> + * based on GPL'ed 2.6 kernel sources
> + * (c) Marvell International Ltd.
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2. This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +#include <linux/io.h>
> +#include <linux/irq.h>
> +#include <linux/irqchip/chained_irq.h>
> +#include <linux/of_address.h>
> +#include <linux/of_irq.h>
> +
> +#include "irqchip.h"
> +
> +#define APB_INT_ENABLE_L 0x00
> +#define APB_INT_ENABLE_H 0x04
> +#define APB_INT_MASK_L 0x08
> +#define APB_INT_MASK_H 0x0c
> +#define APB_INT_FINALSTATUS_L 0x30
> +#define APB_INT_FINALSTATUS_H 0x34
> +
> +static void dw_apb_ictl_handler(unsigned int irq, struct irq_desc *desc)
> +{
> + struct irq_chip *chip = irq_get_chip(irq);
> + struct irq_chip_generic *gc = irq_get_handler_data(irq);
> + struct irq_domain *d = gc->private;
> + u32 stat;
> + int n;
> +
> + chained_irq_enter(chip, desc);
> +
> + for (n = 0; n < gc->num_ct; n++) {
> + stat = readl_relaxed(gc->reg_base +
> + APB_INT_FINALSTATUS_L + 4 * n);
> + while (stat) {
> + u32 hwirq = ffs(stat) - 1;
> + generic_handle_irq(irq_find_mapping(d,
> + gc->irq_base + hwirq + 32 * n));
> + stat &= ~(1 << hwirq);
> + }
> + }
> +
> + chained_irq_exit(chip, desc);
> +}
> +
> +static int __init dw_apb_ictl_init(struct device_node *np,
> + struct device_node *parent)
> +{
> + unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
> + struct resource r;
> + struct irq_domain *domain;
> + struct irq_chip_generic *gc;
> + void __iomem *iobase;
> + int ret, nrirqs, irq;
> + u32 reg;
> +
> + /* Map the parent interrupt for the chained handler */
> + irq = irq_of_parse_and_map(np, 0);
> + if (irq <= 0) {
> + pr_err("%s: unable to parse irq\n", np->full_name);
> + return -EINVAL;
> + }
> +
> + ret = of_address_to_resource(np, 0, &r);
> + if (ret) {
> + pr_err("%s: unable to get resource\n", np->full_name);
> + return ret;
> + }
> +
> + if (!request_mem_region(r.start, resource_size(&r), np->full_name)) {
> + pr_err("%s: unable to request mem region\n", np->full_name);
> + return -ENOMEM;
> + }
> +
> + iobase = ioremap(r.start, resource_size(&r));
> + if (!iobase) {
> + pr_err("%s: unable to map resource\n", np->full_name);
> + ret = -ENOMEM;
> + goto err_release;
> + }
> +
> + /*
> + * DW IP can be configured to allow 2-64 irqs. We can determine
> + * the number of irqs supported by writing into enable register
> + * and look for bits not set, as corresponding flip-flops will
> + * have been removed by sythesis tool.
> + */
> +
> + /* mask and enable all interrupts */
> + writel(~0, iobase + APB_INT_MASK_L);
> + writel(~0, iobase + APB_INT_MASK_H);
> + writel(~0, iobase + APB_INT_ENABLE_L);
> + writel(~0, iobase + APB_INT_ENABLE_H);
> +
> + reg = readl(iobase + APB_INT_ENABLE_H);
> + if (reg)
> + nrirqs = 32 + fls(reg);
> + else
> + nrirqs = fls(readl(iobase + APB_INT_ENABLE_L));
> +
> + domain = irq_domain_add_linear(np, nrirqs,
> + &irq_generic_chip_ops, NULL);
> + if (!domain) {
> + pr_err("%s: unable to add irq domain\n", np->full_name);
> + ret = -ENOMEM;
> + goto err_unmap;
> + }
> +
> + ret = irq_alloc_domain_generic_chips(domain, 32, (nrirqs > 32) ? 2 : 1,
> + np->name, handle_level_irq, clr, 0,
> + IRQ_GC_INIT_MASK_CACHE);
> + if (ret) {
> + pr_err("%s: unable to alloc irq domain gc\n", np->full_name);
> + goto err_unmap;
> + }
> +
> + gc = irq_get_domain_generic_chip(domain, 0);
> + gc->private = domain;
> + gc->reg_base = iobase;
> +
> + gc->chip_types[0].regs.mask = APB_INT_MASK_L;
> + gc->chip_types[0].chip.irq_mask = irq_gc_mask_set_bit;
> + gc->chip_types[0].chip.irq_unmask = irq_gc_mask_clr_bit;
> +
> + if (nrirqs > 32) {
> + gc->chip_types[1].regs.mask = APB_INT_MASK_H;
> + gc->chip_types[1].chip.irq_mask = irq_gc_mask_set_bit;
> + gc->chip_types[1].chip.irq_unmask = irq_gc_mask_clr_bit;
> + }
> +
> + irq_set_handler_data(irq, gc);
> + irq_set_chained_handler(irq, dw_apb_ictl_handler);
> +
> + return 0;
> +
> +err_unmap:
> + iounmap(iobase);
> +err_release:
> + release_mem_region(r.start, resource_size(&r));
> + return ret;
> +}
> +IRQCHIP_DECLARE(dw_apb_ictl,
> + "snps,dw-apb-ictl", dw_apb_ictl_init);
>