Skip to contentSkip to conversation

ARM: brcmstb: Add Broadcom STB SoC support

PATCH Superseded Marc Carino 4 participants 17 messages Nov 27, 2013 – Dec 13, 2013

Subsystems (5)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v2 cover ARM: brcmstb: Add Broadcom STB SoC support

This patchset contains the board support package for the Broadcom BCM7445 ARM-based SoC [1]. These changes contain a minimal set of code needed for a BCM7445-based board to boot the Linux kernel.

These changes heavily leverage the OF/devicetree framework.

v2:
- rebased to v3.13-rc1
- moved implementation to 'mach-bcm' folder
- added CPU init for B15

v1:
- initial submission

[1] http://www.broadcom.com/products/Cable/Cable-Set-Top-Box-Solutions/BCM7445

Marc Carino (6):
ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs
ARM: do CPU-specific init for Broadcom Brahma15 cores
ARM: brcmstb: add CPU binding for Broadcom Brahma15
ARM: brcmstb: add misc. DT bindings for brcm,brcmstb
ARM: brcmstb: gic: add compatible string for Broadcom Brahma15
ARM: brcmstb: dts: add a reference DTS for Broadcom 7445

 .../devicetree/bindings/arm/brcm-brcmstb.txt       |   72 +++++++
 Documentation/devicetree/bindings/arm/cpus.txt     |    1 +
 Documentation/devicetree/bindings/arm/gic.txt      |    1 +
 arch/arm/Kconfig.debug                             |   16 ++-
 arch/arm/boot/dts/brcmstb-7445.dts                 |  115 +++++++++++
 arch/arm/configs/brcmstb_defconfig                 |  127 ++++++++++++
 arch/arm/mach-bcm/Kconfig                          |   18 ++
 arch/arm/mach-bcm/Makefile                         |    2 +
 arch/arm/mach-bcm/brcmstb.c                        |  205 ++++++++++++++++++++
 arch/arm/mach-bcm/brcmstb.h                        |   70 +++++++
 arch/arm/mach-bcm/headsmp-brcmstb.S                |   29 +++
 arch/arm/mach-bcm/hotplug-brcmstb.c                |  203 +++++++++++++++++++
 arch/arm/mm/proc-v7.S                              |   11 +
 13 files changed, 869 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/brcm-brcmstb.txt
 create mode 100644 arch/arm/boot/dts/brcmstb-7445.dts
 create mode 100644 arch/arm/configs/brcmstb_defconfig
 create mode 100644 arch/arm/mach-bcm/brcmstb.c
 create mode 100644 arch/arm/mach-bcm/brcmstb.h
 create mode 100644 arch/arm/mach-bcm/headsmp-brcmstb.S
 create mode 100644 arch/arm/mach-bcm/hotplug-brcmstb.c
#1 lore raw

PATCH v2 1/6 ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs

The BCM7xxx series of Broadcom SoCs are used primarily in set-top boxes.

This patch adds machine support for the ARM-based Broadcom SoCs.

---
 arch/arm/Kconfig.debug              |   16 +++-
 arch/arm/configs/brcmstb_defconfig  |  127 ++++++++++++++++++++++
 arch/arm/mach-bcm/Kconfig           |   18 +++
 arch/arm/mach-bcm/Makefile          |    2 +
 arch/arm/mach-bcm/brcmstb.c         |  205 +++++++++++++++++++++++++++++++++++
 arch/arm/mach-bcm/brcmstb.h         |   70 ++++++++++++
 arch/arm/mach-bcm/headsmp-brcmstb.S |   29 +++++
 arch/arm/mach-bcm/hotplug-brcmstb.c |  203 ++++++++++++++++++++++++++++++++++
 8 files changed, 669 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/configs/brcmstb_defconfig
 create mode 100644 arch/arm/mach-bcm/brcmstb.c
 create mode 100644 arch/arm/mach-bcm/brcmstb.h
 create mode 100644 arch/arm/mach-bcm/headsmp-brcmstb.S
 create mode 100644 arch/arm/mach-bcm/hotplug-brcmstb.c
arch/arm/Kconfig.debug +15 -1
index 5765abf..266c699 100644
@@ -94,6 +94,17 @@ choice
 		depends on ARCH_BCM2835
 		select DEBUG_UART_PL01X
 
+	config DEBUG_BRCMSTB_UART
+		bool "Use BRCMSTB UART for low-level debug"
+		depends on ARCH_BRCMSTB
+		select DEBUG_UART_8250
+		help
+		  Say Y here if you want the debug print routines to direct
+		  their output to the first serial port on these devices.
+
+		  If you have a Broadcom STB chip and would like early print
+		  messages to appear over the UART, select this option.
+
 	config DEBUG_CLPS711X_UART1
 		bool "Kernel low-level debugging messages via UART1"
 		depends on ARCH_CLPS711X
@@ -988,6 +999,7 @@ config DEBUG_UART_PHYS
 	default 0x20064000 if DEBUG_RK29_UART1 || DEBUG_RK3X_UART2
 	default 0x20068000 if DEBUG_RK29_UART2 || DEBUG_RK3X_UART3
 	default 0x20201000 if DEBUG_BCM2835
+	default 0xf0406b00 if DEBUG_BRCMSTB_UART
 	default 0x4000e400 if DEBUG_LL_UART_EFM32
 	default 0x40090000 if ARCH_LPC32XX
 	default 0x40100000 if DEBUG_PXA_UART1
@@ -1029,6 +1041,7 @@ config DEBUG_UART_VIRT
 	default 0xf0009000 if DEBUG_CNS3XXX
 	default 0xf01fb000 if DEBUG_NOMADIK_UART
 	default 0xf0201000 if DEBUG_BCM2835
+	default 0xfc406b00 if DEBUG_BRCMSTB_UART
 	default 0xf11f1000 if ARCH_VERSATILE
 	default 0xf1600000 if ARCH_INTEGRATOR
 	default 0xf1c28000 if DEBUG_SUNXI_UART0
@@ -1091,7 +1104,8 @@ config DEBUG_UART_8250_WORD
 	default y if DEBUG_PICOXCELL_UART || DEBUG_SOCFPGA_UART || \
 		ARCH_KEYSTONE || \
 		DEBUG_DAVINCI_DMx_UART0 || DEBUG_DAVINCI_DA8XX_UART1 || \
-		DEBUG_DAVINCI_DA8XX_UART2 || DEBUG_DAVINCI_TNETV107X_UART1
+		DEBUG_DAVINCI_DA8XX_UART2 || DEBUG_DAVINCI_TNETV107X_UART1 || \
+		DEBUG_BRCMSTB_UART
 
 config DEBUG_UART_8250_FLOW_CONTROL
 	bool "Enable flow control for 8250 UART"
arch/arm/configs/brcmstb_defconfig new file +127 -0

127 lines not on this page · raw message

arch/arm/mach-bcm/Kconfig +18 -0
index 9fe6d88..9179259 100644
@@ -31,6 +31,24 @@ config ARCH_BCM_MOBILE
 	  BCM11130, BCM11140, BCM11351, BCM28145 and
 	  BCM28155 variants.
 
+config ARCH_BRCMSTB
+	bool "Broadcom BCM7XXX based boards" if ARCH_MULTI_V7
+	depends on MMU
+	select ARM_ARCH_TIMER
+	select ARM_GIC
+	select BRCMSTB
+	select MIGHT_HAVE_PCI
+	select HAVE_SMP
+	select USE_OF
+	select CPU_V7
+	select GENERIC_CLOCKEVENTS
+	help
+	  Say Y if you intend to run the kernel on a Broadcom ARM-based STB
+	  chipset.
+
+	  This enables support for Broadcom ARM-based set-top box chipsets,
+	  including the 7445 family of chips.
+
 endmenu
 
 endif
arch/arm/mach-bcm/Makefile +2 -0
index c2ccd5a..1e9060e 100644
@@ -13,3 +13,5 @@
 obj-$(CONFIG_ARCH_BCM_MOBILE)	:= board_bcm281xx.o bcm_kona_smc.o bcm_kona_smc_asm.o kona.o
 plus_sec := $(call as-instr,.arch_extension sec,+sec)
 AFLAGS_bcm_kona_smc_asm.o	:=-Wa,-march=armv7-a$(plus_sec)
+
+obj-$(CONFIG_ARCH_BRCMSTB) := brcmstb.o headsmp-brcmstb.o hotplug-brcmstb.o
arch/arm/mach-bcm/brcmstb.c new file +205 -0

205 lines not on this page · raw message

arch/arm/mach-bcm/brcmstb.h new file +70 -0

70 lines not on this page · raw message

arch/arm/mach-bcm/headsmp-brcmstb.S new file +29 -0
new file mode 100644
index 0000000..cb86e4b
@@ -0,0 +1,29 @@
+/*
+ * SMP boot code for secondary CPUs
+ * Based on arch/arm/mach-tegra/headsmp.S
+ *
+ * Copyright (C) 2010 NVIDIA, Inc.
+ * Copyright (C) 2013 Broadcom Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/linkage.h>
+#include <linux/init.h>
+
+        .section ".text.head", "ax"
+	__CPUINIT
+
+ENTRY(brcmstb_secondary_startup)
+        mov     r0, #0xd3
+        msr     cpsr_fsxc, r0
+        bl      v7_invalidate_l1
+        b       secondary_startup
+ENDPROC(brcmstb_secondary_startup)
arch/arm/mach-bcm/hotplug-brcmstb.c new file +203 -0

203 lines not on this page · raw message

Signature · 1 line
1.7.1
#10 lore raw

PATCH v2 2/6 ARM: do CPU-specific init for Broadcom Brahma15 cores

In reply to Marc Carino

Perform any CPU-specific initialization required on the Broadcom Brahma-15 core.

---
 arch/arm/mm/proc-v7.S |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
arch/arm/mm/proc-v7.S +11 -0
index bd17819..98ea423 100644
@@ -193,6 +193,7 @@ __v7_cr7mp_setup:
 	b	1f
 __v7_ca7mp_setup:
 __v7_ca15mp_setup:
+__v7_b15mp_setup:
 	mov	r10, #0
 1:
 #ifdef CONFIG_SMP
@@ -494,6 +495,16 @@ __v7_ca15mp_proc_info:
 	.size	__v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info
 
 	/*
+	 * Broadcom Corporation Brahma-B15 processor.
+	 */
+	.type	__v7_b15mp_proc_info, #object
+__v7_b15mp_proc_info:
+	.long	0x420f00f0
+	.long	0xff0ffff0
+	__v7_proc __v7_b15mp_setup, hwcaps = HWCAP_IDIV
+	.size	__v7_b15mp_proc_info, . - __v7_b15mp_proc_info
+
+	/*
 	 * Qualcomm Inc. Krait processors.
 	 */
 	.type	__krait_proc_info, #object
Signature · 1 line
1.7.1
#11 lore raw

PATCH v2 3/6 ARM: brcmstb: add CPU binding for Broadcom Brahma15

In reply to Marc Carino

Add the Broadcom Brahma B15 CPU to the DT CPU binding list.

---
 Documentation/devicetree/bindings/arm/cpus.txt |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/arm/cpus.txt +1 -0
index 9130435..423b879 100644
@@ -163,6 +163,7 @@ nodes to be present and contain the properties described below.
 			    "arm,cortex-r4"
 			    "arm,cortex-r5"
 			    "arm,cortex-r7"
+			    "brcm,brahma15"
 			    "faraday,fa526"
 			    "intel,sa110"
 			    "intel,sa1100"
Signature · 1 line
1.7.1
#12 lore raw

PATCH v2 4/6 ARM: brcmstb: add misc. DT bindings for brcm,brcmstb

In reply to Marc Carino

Document the bindings that the Broadcom STB platform needs for proper bootup.

---
 .../devicetree/bindings/arm/brcm-brcmstb.txt       |   72 ++++++++++++++++++++
 1 files changed, 72 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/brcm-brcmstb.txt
Documentation/devicetree/bindings/arm/brcm-brcmstb.txt new file +72 -0
new file mode 100644
index 0000000..2f3cd50
@@ -0,0 +1,72 @@
+Broadcom STB platforms Device Tree Bindings
+-------------------------------------------
+Boards with Broadcom Brahma15-based BCM7xxx SOC shall have the following
+properties.
+
+Required root node properties:
+    - compatible = "brcm,brcmstb";
+
+Further, the following platform nodes shall be defined:
+
+    - sun-top-ctrl
+    - cpu-biu-ctrl
+    - hif-continuation
+
+sun-top-ctrl
+------------
+This node describes the register block which is used for generic reset control.
+
+    - compatible: "brcm,brcmstb-sun-top-ctrl"
+    - properties:
+        o reg = <base_of_sun_top_ctrl_regs length>;
+        o reset-source-enable-reg = <offset_from_base>;
+        o sw-master-reset-reg = <offset_from_base>;
+
+cpu-biu-ctrl
+------------
+This node describes the register block used for configuring the CPU complex.
+
+    - compatible: "brcm,brcmstb-cpu-biu-ctrl"
+    - properties:
+        o reg = <base_of_cpu_biu_ctrl_regs length>;
+        o cpu-reset-config-reg = <offset_from_base>;
+        o cpu0-pwr-zone-ctrl-reg = <offset_from_base>;
+
+hif-continuation
+----------------
+This node describes the registers for setting the starting PC for each CPU core.
+
+    - compatible: "brcm,brcmstb-hif-continuation"
+    - properties:
+        o reg = <base_of_hif_continuation_regs length>;
+        o stb-boot-hi-addr0-reg = <offset_from_base>;
+
+example:
+
+/ {
+	model = "Broadcom STB";
+	compatible =  "brcm,brcmstb";
+
+	/* snip */
+
+	sun-top-ctrl at f0404000 {
+		compatible = "brcm,brcmstb-sun-top-ctrl";
+		reg = <0xf0404000 0x51c>;
+		reset-source-enable-reg = <0x304>;
+		sw-master-reset-reg = <0x308>;
+	};
+
+	cpu-biu-ctrl at f0442400 {
+		compatible = "brcm,brcmstb-cpu-biu-ctrl";
+		reg = <0xf0442400 0x5b4>;
+		cpu-reset-config-reg = <0x178>;
+		cpu0-pwr-zone-ctrl-reg = <0x88>;
+	};
+
+	hif-continuation at f0452000 {
+		compatible = "brcm,brcmstb-hif-continuation";
+		reg = <0xf0452000 0x100>;
+	};
+
+	/* snip */
+};
Signature · 1 line
1.7.1
#14 lore raw

PATCH v2 5/6 ARM: brcmstb: gic: add compatible string for Broadcom Brahma15

In reply to Marc Carino

Document the Broadcom Brahma B15 GIC implementation as compatible with the ARM GIC standard.

---
 Documentation/devicetree/bindings/arm/gic.txt |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/arm/gic.txt +1 -0
index 3dfb0c0..b7d7970 100644
@@ -15,6 +15,7 @@ Main node required properties:
 	"arm,cortex-a9-gic"
 	"arm,cortex-a7-gic"
 	"arm,arm11mp-gic"
+	"brcm,brahma15-gic"
 - interrupt-controller : Identifies the node as an interrupt controller
 - #interrupt-cells : Specifies the number of cells needed to encode an
   interrupt source.  The type shall be a <u32> and the value shall be 3.
Signature · 1 line
1.7.1
#15 lore raw

PATCH v2 6/6 ARM: brcmstb: dts: add a reference DTS for Broadcom 7445

In reply to Marc Carino

Add a sample DTS which will allow bootup of a board populated with the BCM7445 chip.

---
 arch/arm/boot/dts/brcmstb-7445.dts |  115 ++++++++++++++++++++++++++++++++++++
 1 files changed, 115 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/brcmstb-7445.dts
arch/arm/boot/dts/brcmstb-7445.dts new file +115 -0
new file mode 100644
index 0000000..a8b74c5
@@ -0,0 +1,115 @@
+/dts-v1/;
+/include/ "skeleton.dtsi"
+
+/ {
+	#address-cells = <0x1>;
+	#size-cells = <0x1>;
+	model = "Broadcom STB (7445)";
+	compatible = "brcm,brcmstb";
+	interrupt-parent = <&gic>;
+
+	chosen {
+		bootargs = "earlyprintk console=ttyS0,115200";
+	};
+
+	memory {
+		#address-cells = <0x1>;
+		#size-cells = <0x1>;
+		device_type = "memory";
+		reg = <0x0 0x40000000 0x40000000 0x40000000 0x80000000 0x40000000>;
+	};
+
+	cpupll: cpupll at 0 {
+		compatible = "fixed-clock";
+		#clock-cells = <0x0>;
+		clock-frequency = <1500000000>;
+	};
+
+	cpuclk: cpu-clk-div at 0 {
+		compatible = "brcm,brcmstb-cpu-clk-div";
+		reg = <0xf03e257c 0x4>;
+		#clock-cells = <0x0>;
+		clocks = <&cpupll>;
+		div-table = <0x0 0x1 0x11 0x2 0x12 0x4 0x13 0x8 0x14 0x10>;
+	};
+
+	cpus {
+		#address-cells = <0x1>;
+		#size-cells = <0x0>;
+
+		cpu at 0 {
+			operating-points = <0x16e360 0x0
+								0xb71b0 0x0
+								0x5b8d8 0x0
+								0x2dc6c 0x0
+								0x16e36 0x0>;
+			clocks = <&cpuclk>;
+			device_type = "cpu";
+			compatible = "brcm,brahma15";
+			reg = <0x0>;
+			clock-frequency = <1500000000>;
+		};
+
+		cpu at 1 {
+			device_type = "cpu";
+			compatible = "brcm,brahma15";
+			reg = <0x1>;
+			clock-frequency = <1500000000>;
+		};
+
+		cpu at 2 {
+			device_type = "cpu";
+			compatible = "brcm,brahma15";
+			reg = <0x2>;
+			clock-frequency = <1500000000>;
+		};
+
+		cpu at 3 {
+			device_type = "cpu";
+			compatible = "brcm,brahma15";
+			reg = <0x3>;
+			clock-frequency = <1500000000>;
+		};
+	};
+
+	gic: interrupt-controller at ffd00000 {
+		compatible = "brcm,brahma15-gic", "arm,cortex-a15-gic";
+		interrupt-controller;
+		#interrupt-cells = <0x3>;
+		reg = <0xffd01000 0x1000 0xffd02000 0x2000>;
+	};
+
+	timer {
+		compatible = "arm,armv7-timer";
+		interrupts = <0x1 0xd 0xf08 0x1 0xe 0xf08 0x1 0xb 0xf08 0x1 0xa 0xf08>;
+	};
+
+	serial at f0406b00 {
+		compatible = "ns16550a";
+		reg = <0xf0406b00 0x20>;
+		reg-shift = <0x2>;
+		reg-io-width = <0x4>;
+		interrupts = <0x0 0x4b 0x4>;
+		clock-frequency = <0x4d3f640>;
+	};
+
+	sun-top-ctrl at f0404000 {
+		compatible = "brcm,brcmstb-sun-top-ctrl";
+		reg = <0xf0404000 0x51c>;
+		reset-source-enable-reg = <0x304>;
+		sw-master-reset-reg = <0x308>;
+	};
+
+	cpu-biu-ctrl at f03e2400 {
+		compatible = "brcm,brcmstb-cpu-biu-ctrl";
+		reg = <0xf03e2400 0x5b4>;
+		cpu-reset-config-reg = <0x178>;
+		cpu0-pwr-zone-ctrl-reg = <0x88>;
+	};
+
+	hif-continuation at f0452000 {
+		compatible = "brcm,brcmstb-hif-continuation";
+		reg = <0xf0452000 0x100>;
+		stb-boot-hi-addr0-reg = <0x0>;
+	};
+};
Signature · 1 line
1.7.1
#2 lore raw

Re: [PATCH v2 1/6] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs

In reply to Marc Carino
Quoted 12 lines · Marc Carino
arch/arm/Kconfig.debug +4 -0
index 5765abf..266c699 100644
@@ -94,6 +94,17 @@ choice
 		depends on ARCH_BCM2835
 		select DEBUG_UART_PL01X
 
+	config DEBUG_BRCMSTB_UART
+		bool "Use BRCMSTB UART for low-level debug"
+		depends on ARCH_BRCMSTB
+		select DEBUG_UART_8250

arch/arm/Kconfig.debug choice · line 110

Quoted 10 lines
arch/arm/Kconfig.debug +7 -0
+		help
+		  Say Y here if you want the debug print routines to direct
+		  their output to the first serial port on these devices.
+
+		  If you have a Broadcom STB chip and would like early print
+		  messages to appear over the UART, select this option.
+
 	config DEBUG_CLPS711X_UART1
 		bool "Kernel low-level debugging messages via UART1"
 		depends on ARCH_CLPS711X

Can you split out the debug UART changes into a separate patch?

Quoted 6 lines
arch/arm/configs/brcmstb_defconfig new file +0 -0
new file mode 100644
index 0000000..1741d92

arch/arm/configs/brcmstb_defconfig line 8

Quoted 8 lines
arch/arm/configs/brcmstb_defconfig new file +8 -0
@@ -0,0 +1,127 @@
+CONFIG_CROSS_COMPILE="arm-linux-"
+CONFIG_KERNEL_LZO=y
+CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_SYSFS_DEPRECATED=y
+CONFIG_RELAY=y
+CONFIG_BLK_DEV_INITRD=y

Do you have a strong reason to have your own defconfig file? We currently try to consolidate as much as possible into multi_v7_defconfig, so please see if you can extend that instead to do what you need.

Quoted 9 lines
arch/arm/mach-bcm/Kconfig +1 -0
index 9fe6d88..9179259 100644
@@ -31,6 +31,24 @@ config ARCH_BCM_MOBILE
 	  BCM11130, BCM11140, BCM11351, BCM28145 and
 	  BCM28155 variants.
 
+config ARCH_BRCMSTB

arch/arm/mach-bcm/Kconfig config ARCH_BCM_MOBILE · line 44

Quoted 10 lines
arch/arm/mach-bcm/Kconfig +10 -0
+	bool "Broadcom BCM7XXX based boards" if ARCH_MULTI_V7
+	depends on MMU
+	select ARM_ARCH_TIMER
+	select ARM_GIC
+	select BRCMSTB
+	select MIGHT_HAVE_PCI
+	select HAVE_SMP
+	select USE_OF
+	select CPU_V7
+	select GENERIC_CLOCKEVENTS

Some of these are already implied by ARCH_MULTI_V7 and can be dropped from this list.

Quoted 4 lines
arch/arm/mach-bcm/Kconfig +4 -0
+struct platform_regs brcm_plat_regs;
+
+/***********************************************************************
+ * STB CPU (main application processor)

arch/arm/mach-bcm/Kconfig config ARCH_BCM_MOBILE

Quoted 10 lines
arch/arm/mach-bcm/Kconfig +10 -0
+ ***********************************************************************/
+
+static struct map_desc brcmstb_io_map[] __initdata = {
+	{
+	.virtual = (unsigned long)BRCMSTB_PERIPH_VIRT,
+	.pfn     = __phys_to_pfn(BRCMSTB_PERIPH_PHYS),
+	.length  = BRCMSTB_PERIPH_LENGTH,
+	.type    = MT_DEVICE,
+	},
+};

Why do you need a static I/O mapping? You should not rely on hardcoded virtual or physical addresses in general.

Quoted 13 lines
arch/arm/mach-bcm/Kconfig +13 -0
+static struct node_reg sun_top_ctrl_regs[] __initdata = {
+	{"reset-source-enable-reg", &brcm_plat_regs.reset_source_enable_reg},
+	{"sw-master-reset-reg", &brcm_plat_regs.sw_master_reset_reg},
+	{NULL, NULL}
+};
+
+static struct node_reg cpu_biu_ctrl_regs[] __initdata = {
+	{"cpu-reset-config-reg", &brcm_plat_regs.cpu_reset_config_reg},
+	{"cpu0-pwr-zone-ctrl-reg", &brcm_plat_regs.cpu0_pwr_zone_ctrl_reg},
+	{NULL, NULL}
+};
+
+static struct node_reg hif_continuation_regs[] __initdata = {

arch/arm/mach-bcm/Kconfig

Quoted 10 lines
arch/arm/mach-bcm/Kconfig +10 -0
+	{"stb-boot-hi-addr0-reg", &brcm_plat_regs.hif_continuation_regs_base},
+	{NULL, NULL}
+};
+
+static struct node_reg_block top_reg_blocks[] __initdata = {
+	{"brcm,brcmstb-sun-top-ctrl", sun_top_ctrl_regs},
+	{"brcm,brcmstb-cpu-biu-ctrl", cpu_biu_ctrl_regs},
+	{"brcm,brcmstb-hif-continuation", hif_continuation_regs},
+	{NULL, NULL}
+};

This seems like stuff that should go into the device drivers for the respective hardware blocks, not into platform code.

arch/arm/mach-bcm/Kconfig

Quoted 5 lines
arch/arm/mach-bcm/Kconfig +5 -0
+	addr = ioremap(BPHYSADDR(BCHP_IRQ0_IRQEN), sizeof(u32));
+	writel_relaxed(BCHP_IRQ0_IRQEN_uarta_irqen_MASK
+		| BCHP_IRQ0_IRQEN_uartb_irqen_MASK
+		| BCHP_IRQ0_IRQEN_uartc_irqen_MASK, addr);
+	iounmap(addr);

What does this part do? Isn't that something that should have been set up by the boot loader?

Quoted 22 lines
arch/arm/mach-bcm/Kconfig +22 -0
+	block = top_reg_blocks;
+	while (block->compatible) {
+		struct device_node *np;
+		struct node_reg *reg;
+
+		np = of_find_compatible_node(NULL, NULL, block->compatible);
+		if (!np)
+			panic("brcmstb: DT missing \"%s\" node\n",
+				block->compatible);
+
+		addr = of_iomap(np, 0);
+		if (!addr)
+			panic("brcmstb: iomap failure\n");
+
+		reg = block->regs;
+		while (reg->prop) {
+			u32 val;
+
+			if (!of_property_read_u32(np, reg->prop, &val))
+				*(reg->addr) = addr + val;
+			else
+				panic("brcmstb: node \"%s\" missing prop \"%s\"\n",

arch/arm/mach-bcm/Kconfig

Quoted 10 lines
arch/arm/mach-bcm/Kconfig +10 -0
+					block->compatible, reg->prop);
+
+			reg++;
+		}
+
+		of_node_put(np);
+
+		block++;
+	}
+}

We try hard to avoid having register available this early and outside of device drivers. Can you try to make at least some (if not all) of these more regular, and provide specific comments in the code why this is not possible for the others?

arch/arm/mach-bcm/Kconfig

Quoted 4 lines
arch/arm/mach-bcm/Kconfig +4 -0
+static void __init brcmstb_init(void)
+{
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}

This is the default function an can be omitted.

arch/arm/mach-bcm/Kconfig

Quoted 13 lines
arch/arm/mach-bcm/Kconfig +13 -0
+#define BRCMSTB_PERIPH_VIRT				0xfc000000
+#define BRCMSTB_PERIPH_PHYS				0xf0000000
+#define BRCMSTB_PERIPH_LENGTH				0x02000000
+
+#define BVIRTADDR(x)	(BRCMSTB_PERIPH_VIRT + ((x) & 0x0fffffff))
+#define BPHYSADDR(x)	((x) + BRCMSTB_PERIPH_PHYS)
+
+#define BCHP_UARTA_REG_START				0x00406b00
+
+#define BCHP_IRQ0_IRQEN					0x00406780
+#define BCHP_IRQ0_IRQEN_uarta_irqen_MASK		0x00010000
+#define BCHP_IRQ0_IRQEN_uartb_irqen_MASK		0x00020000
+#define BCHP_IRQ0_IRQEN_uartc_irqen_MASK		0x00040000

These should probably all be private to the files that use them

arch/arm/mach-bcm/Kconfig

Quoted 4 lines
arch/arm/mach-bcm/Kconfig +4 -0
+
+ENTRY(brcmstb_secondary_startup)
+        mov     r0, #0xd3
+        msr     cpsr_fsxc, r0

You should have comments here about why this is necessary.

arch/arm/mach-bcm/Kconfig

Quoted 13 lines
arch/arm/mach-bcm/Kconfig +13 -0
+#define ZONE_PWR_DN_REQ_MASK		0x00000200
+#define ZONE_PWR_UP_REQ_MASK		0x00000400
+#define ZONE_BLK_RST_ASSERT_MASK	0x00001000
+#define ZONE_PWR_OFF_STATE_MASK		0x02000000
+#define ZONE_PWR_ON_STATE_MASK		0x04000000
+#define ZONE_RESET_STATE_MASK		0x80000000
+
+static void __iomem *pwr_zone_ctrl_get_base(unsigned int cpu)
+{
+	void __iomem *base = brcm_plat_regs.cpu0_pwr_zone_ctrl_reg;
+	base += (cpu * 4);
+	return base;
+}

It looks like you are accessing a register area that is providing power domains for not just the CPUs but other parts of the system as well, which should be a proper device driver, e.g. pm_domain or regulator depending on what the hardware actually does, and then you plug the SMP code into that. Do you think that would work here?

In the long run, I would like to see the platform SMP code get merged with the cpuidle device drivers and moved to drivers/cpuidle, but we're not quite at the point where this can be done.

arch/arm/mach-bcm/Kconfig

Quoted 2 lines
arch/arm/mach-bcm/Kconfig +2 -0
+	/* Magic delay from misc_bpcm_arm.c */
+	busy_wait(10000);

I think you should use udelay() here rather than creating your own, but I may be missing the specific requirements. Of course it would be better not to need it at all.

Arnd

#3 lore raw

Re: [PATCH v2 1/6] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs

Hi Arnd,

2013/12/3 Arnd Bergmann <[email protected]>:

Quoted 9 lines

arch/arm/mach-bcm/brcmstb.c line 110

Quoted 6 lines
arch/arm/mach-bcm/brcmstb.c new file +5 -0
+     addr = ioremap(BPHYSADDR(BCHP_IRQ0_IRQEN), sizeof(u32));
+     writel_relaxed(BCHP_IRQ0_IRQEN_uarta_irqen_MASK
+             | BCHP_IRQ0_IRQEN_uartb_irqen_MASK
+             | BCHP_IRQ0_IRQEN_uartc_irqen_MASK, addr);
+     iounmap(addr);

What does this part do? Isn't that something that should have been set up by the boot loader?

The bootloader will typically use the UART in busy-looping mode and not rely on interrupts, also the bootloader currently does not know much about how many UARTs there are in the system and how they are going to be used.

One possible way to solve this would be to write a very small irqchip driver which only implements the "irq_enable" method to allow these interrupts to be forwarded to the GIC. Somewhere in the Device Tree we would have an interrupt-map property which describes the mapping between the bits in BCHP_IRQ0_IRQEN and their corresponding peripherals (UARTA, B, C).

Would that work?

Signature · 1 line
Florian
#4 lore raw

Re: [PATCH v2 1/6] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs

Quoted 8 lines · Florian Fainelli

2013/12/3 Arnd Bergmann <[email protected]>:

Quoted 7 lines
Quoted 6 lines
arch/arm/mach-bcm/brcmstb.c new file +5 -0
+     addr = ioremap(BPHYSADDR(BCHP_IRQ0_IRQEN), sizeof(u32));
+     writel_relaxed(BCHP_IRQ0_IRQEN_uarta_irqen_MASK
+             | BCHP_IRQ0_IRQEN_uartb_irqen_MASK
+             | BCHP_IRQ0_IRQEN_uartc_irqen_MASK, addr);
+     iounmap(addr);
Quoted 7 lines
Quoted 2 lines

What does this part do? Isn't that something that should have been set up by the boot loader?

The bootloader will typically use the UART in busy-looping mode and not rely on interrupts, also the bootloader currently does not know much about how many UARTs there are in the system and how they are going to be used.

Well, it should at least know how many ports are wire up and be able to set them up to a working state.

Quoted 8 lines

One possible way to solve this would be to write a very small irqchip driver which only implements the "irq_enable" method to allow these interrupts to be forwarded to the GIC. Somewhere in the Device Tree we would have an interrupt-map property which describes the mapping between the bits in BCHP_IRQ0_IRQEN and their corresponding peripherals (UARTA, B, C).

Would that work?

I think that would work, but it's getting into the overdesign territory. Can you clarify why this register exists in the first place and what makes it necessary to set it up? Are there similar registers for all other IRQs?

Arnd

author
#7 lore raw

Re: [PATCH v2 1/6] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs

In reply to Arnd Bergmann

Hello Arnd,

Quoted 4 lines

Do you have a strong reason to have your own defconfig file? We currently try to consolidate as much as possible into multi_v7_defconfig, so please see if you can extend that instead to do what you need.

There's no reason why we can't use the multi-platform defconfig. I'll make sure our platform uses it in the next revision.

Quoted 2 lines

This seems like stuff that should go into the device drivers for the respective hardware blocks, not into platform code.

Understood. I'm not sure if you recall this [1] conversation, but short of having a big array of registers offsets per chip ID (which will probably grow to 10 or more), leveraging the DT to let the bootloader tell the kernel these randomly-located registers are proved to be very lightweight.

Seems like there's one thing I could possibly factor out into a separate driver... the registers that assert a chip reset (sw-master-reset-reg). Maybe I could register a reset-controller driver specifically for this purpose?

Quoted 4 lines

We try hard to avoid having register available this early and outside of device drivers. Can you try to make at least some (if not all) of these more regular, and provide specific comments in the code why this is not possible for the others?

Just to be sure, you're asking to reduce our dependence on touching these machine-specific registers?

I will incorporate all of your suggestions into the next revision of the patch set. Thank you for the review!

Regards,
Marc

[1] http://www.spinics.net/lists/arm-kernel/msg288567.html

Quoted 223 lines · Arnd Bergmann
Quoted 12 lines · Marc Carino
arch/arm/Kconfig.debug +4 -0
index 5765abf..266c699 100644
@@ -94,6 +94,17 @@ choice
 		depends on ARCH_BCM2835
 		select DEBUG_UART_PL01X
 
+	config DEBUG_BRCMSTB_UART
+		bool "Use BRCMSTB UART for low-level debug"
+		depends on ARCH_BRCMSTB
+		select DEBUG_UART_8250

arch/arm/Kconfig.debug choice · line 110

Quoted 10 lines
arch/arm/Kconfig.debug +7 -0
+		help
+		  Say Y here if you want the debug print routines to direct
+		  their output to the first serial port on these devices.
+
+		  If you have a Broadcom STB chip and would like early print
+		  messages to appear over the UART, select this option.
+
 	config DEBUG_CLPS711X_UART1
 		bool "Kernel low-level debugging messages via UART1"
 		depends on ARCH_CLPS711X

Can you split out the debug UART changes into a separate patch?

Quoted 6 lines
arch/arm/configs/brcmstb_defconfig new file +0 -0
new file mode 100644
index 0000000..1741d92

arch/arm/configs/brcmstb_defconfig line 8

Quoted 8 lines
arch/arm/configs/brcmstb_defconfig new file +8 -0
@@ -0,0 +1,127 @@
+CONFIG_CROSS_COMPILE="arm-linux-"
+CONFIG_KERNEL_LZO=y
+CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_SYSFS_DEPRECATED=y
+CONFIG_RELAY=y
+CONFIG_BLK_DEV_INITRD=y

Do you have a strong reason to have your own defconfig file? We currently try to consolidate as much as possible into multi_v7_defconfig, so please see if you can extend that instead to do what you need.

Quoted 9 lines
arch/arm/mach-bcm/Kconfig +1 -0
index 9fe6d88..9179259 100644
@@ -31,6 +31,24 @@ config ARCH_BCM_MOBILE
 	  BCM11130, BCM11140, BCM11351, BCM28145 and
 	  BCM28155 variants.
 
+config ARCH_BRCMSTB

arch/arm/mach-bcm/Kconfig config ARCH_BCM_MOBILE · line 44

Quoted 10 lines
arch/arm/mach-bcm/Kconfig +10 -0
+	bool "Broadcom BCM7XXX based boards" if ARCH_MULTI_V7
+	depends on MMU
+	select ARM_ARCH_TIMER
+	select ARM_GIC
+	select BRCMSTB
+	select MIGHT_HAVE_PCI
+	select HAVE_SMP
+	select USE_OF
+	select CPU_V7
+	select GENERIC_CLOCKEVENTS

Some of these are already implied by ARCH_MULTI_V7 and can be dropped from this list.

Quoted 4 lines
arch/arm/mach-bcm/Kconfig +4 -0
+struct platform_regs brcm_plat_regs;
+
+/***********************************************************************
+ * STB CPU (main application processor)

arch/arm/mach-bcm/Kconfig config ARCH_BCM_MOBILE

Quoted 10 lines
arch/arm/mach-bcm/Kconfig +10 -0
+ ***********************************************************************/
+
+static struct map_desc brcmstb_io_map[] __initdata = {
+	{
+	.virtual = (unsigned long)BRCMSTB_PERIPH_VIRT,
+	.pfn     = __phys_to_pfn(BRCMSTB_PERIPH_PHYS),
+	.length  = BRCMSTB_PERIPH_LENGTH,
+	.type    = MT_DEVICE,
+	},
+};

Why do you need a static I/O mapping? You should not rely on hardcoded virtual or physical addresses in general.

Quoted 13 lines
arch/arm/mach-bcm/Kconfig +13 -0
+static struct node_reg sun_top_ctrl_regs[] __initdata = {
+	{"reset-source-enable-reg", &brcm_plat_regs.reset_source_enable_reg},
+	{"sw-master-reset-reg", &brcm_plat_regs.sw_master_reset_reg},
+	{NULL, NULL}
+};
+
+static struct node_reg cpu_biu_ctrl_regs[] __initdata = {
+	{"cpu-reset-config-reg", &brcm_plat_regs.cpu_reset_config_reg},
+	{"cpu0-pwr-zone-ctrl-reg", &brcm_plat_regs.cpu0_pwr_zone_ctrl_reg},
+	{NULL, NULL}
+};
+
+static struct node_reg hif_continuation_regs[] __initdata = {

arch/arm/mach-bcm/Kconfig

Quoted 10 lines
arch/arm/mach-bcm/Kconfig +10 -0
+	{"stb-boot-hi-addr0-reg", &brcm_plat_regs.hif_continuation_regs_base},
+	{NULL, NULL}
+};
+
+static struct node_reg_block top_reg_blocks[] __initdata = {
+	{"brcm,brcmstb-sun-top-ctrl", sun_top_ctrl_regs},
+	{"brcm,brcmstb-cpu-biu-ctrl", cpu_biu_ctrl_regs},
+	{"brcm,brcmstb-hif-continuation", hif_continuation_regs},
+	{NULL, NULL}
+};

This seems like stuff that should go into the device drivers for the respective hardware blocks, not into platform code.

arch/arm/mach-bcm/Kconfig

Quoted 5 lines
arch/arm/mach-bcm/Kconfig +5 -0
+	addr = ioremap(BPHYSADDR(BCHP_IRQ0_IRQEN), sizeof(u32));
+	writel_relaxed(BCHP_IRQ0_IRQEN_uarta_irqen_MASK
+		| BCHP_IRQ0_IRQEN_uartb_irqen_MASK
+		| BCHP_IRQ0_IRQEN_uartc_irqen_MASK, addr);
+	iounmap(addr);

What does this part do? Isn't that something that should have been set up by the boot loader?

Quoted 22 lines
arch/arm/mach-bcm/Kconfig +22 -0
+	block = top_reg_blocks;
+	while (block->compatible) {
+		struct device_node *np;
+		struct node_reg *reg;
+
+		np = of_find_compatible_node(NULL, NULL, block->compatible);
+		if (!np)
+			panic("brcmstb: DT missing \"%s\" node\n",
+				block->compatible);
+
+		addr = of_iomap(np, 0);
+		if (!addr)
+			panic("brcmstb: iomap failure\n");
+
+		reg = block->regs;
+		while (reg->prop) {
+			u32 val;
+
+			if (!of_property_read_u32(np, reg->prop, &val))
+				*(reg->addr) = addr + val;
+			else
+				panic("brcmstb: node \"%s\" missing prop \"%s\"\n",

arch/arm/mach-bcm/Kconfig

Quoted 10 lines
arch/arm/mach-bcm/Kconfig +10 -0
+					block->compatible, reg->prop);
+
+			reg++;
+		}
+
+		of_node_put(np);
+
+		block++;
+	}
+}

We try hard to avoid having register available this early and outside of device drivers. Can you try to make at least some (if not all) of these more regular, and provide specific comments in the code why this is not possible for the others?

arch/arm/mach-bcm/Kconfig

Quoted 4 lines
arch/arm/mach-bcm/Kconfig +4 -0
+static void __init brcmstb_init(void)
+{
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}

This is the default function an can be omitted.

arch/arm/mach-bcm/Kconfig

Quoted 13 lines
arch/arm/mach-bcm/Kconfig +13 -0
+#define BRCMSTB_PERIPH_VIRT				0xfc000000
+#define BRCMSTB_PERIPH_PHYS				0xf0000000
+#define BRCMSTB_PERIPH_LENGTH				0x02000000
+
+#define BVIRTADDR(x)	(BRCMSTB_PERIPH_VIRT + ((x) & 0x0fffffff))
+#define BPHYSADDR(x)	((x) + BRCMSTB_PERIPH_PHYS)
+
+#define BCHP_UARTA_REG_START				0x00406b00
+
+#define BCHP_IRQ0_IRQEN					0x00406780
+#define BCHP_IRQ0_IRQEN_uarta_irqen_MASK		0x00010000
+#define BCHP_IRQ0_IRQEN_uartb_irqen_MASK		0x00020000
+#define BCHP_IRQ0_IRQEN_uartc_irqen_MASK		0x00040000

These should probably all be private to the files that use them

arch/arm/mach-bcm/Kconfig

Quoted 4 lines
arch/arm/mach-bcm/Kconfig +4 -0
+
+ENTRY(brcmstb_secondary_startup)
+        mov     r0, #0xd3
+        msr     cpsr_fsxc, r0

You should have comments here about why this is necessary.

arch/arm/mach-bcm/Kconfig

Quoted 13 lines
arch/arm/mach-bcm/Kconfig +13 -0
+#define ZONE_PWR_DN_REQ_MASK		0x00000200
+#define ZONE_PWR_UP_REQ_MASK		0x00000400
+#define ZONE_BLK_RST_ASSERT_MASK	0x00001000
+#define ZONE_PWR_OFF_STATE_MASK		0x02000000
+#define ZONE_PWR_ON_STATE_MASK		0x04000000
+#define ZONE_RESET_STATE_MASK		0x80000000
+
+static void __iomem *pwr_zone_ctrl_get_base(unsigned int cpu)
+{
+	void __iomem *base = brcm_plat_regs.cpu0_pwr_zone_ctrl_reg;
+	base += (cpu * 4);
+	return base;
+}

It looks like you are accessing a register area that is providing power domains for not just the CPUs but other parts of the system as well, which should be a proper device driver, e.g. pm_domain or regulator depending on what the hardware actually does, and then you plug the SMP code into that. Do you think that would work here?

In the long run, I would like to see the platform SMP code get merged with the cpuidle device drivers and moved to drivers/cpuidle, but we're not quite at the point where this can be done.

arch/arm/mach-bcm/Kconfig

Quoted 2 lines
arch/arm/mach-bcm/Kconfig +2 -0
+	/* Magic delay from misc_bpcm_arm.c */
+	busy_wait(10000);

I think you should use udelay() here rather than creating your own, but I may be missing the specific requirements. Of course it would be better not to need it at all.

Arnd

#8 lore raw

Re: [PATCH v2 1/6] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs

Quoted 8 lines · Marc C
Quoted 2 lines

This seems like stuff that should go into the device drivers for the respective hardware blocks, not into platform code.

Understood. I'm not sure if you recall this [1] conversation, but short of having a big array of registers offsets per chip ID (which will probably grow to 10 or more), leveraging the DT to let the bootloader tell the kernel these randomly-located registers are proved to be very lightweight.

Right, but I didn't expect the code to look at these registers to be outside of a device-driver context.

Quoted 4 lines

Seems like there's one thing I could possibly factor out into a separate driver... the registers that assert a chip reset (sw-master-reset-reg). Maybe I could register a reset-controller driver specifically for this purpose?

I have not followed the latest developments regarding system-reset and where that is supposed to be handled, but I'm sure it's in some driver, probably drivers/power or drivers/reset.

Quoted 7 lines
Quoted 4 lines

We try hard to avoid having register available this early and outside of device drivers. Can you try to make at least some (if not all) of these more regular, and provide specific comments in the code why this is not possible for the others?

Just to be sure, you're asking to reduce our dependence on touching these machine-specific registers?

Not touching them at all would be preferred (e.g. if the boot loader could set them up to the correct per-board setting), but of course that doesn't work for run-time settings or system-reset.

The most important part of my comment above is to have as little as possible done "early", i.e. before init_machine(). Beyond that, the preferred way to do any kind of register access from a device driver with an abstract platform-independent interface. We have added a number of new subsystems in the past few years (clk, irqchip, pinctrl, reset, clocksource, regmap, syscon, ...) along these lines, to the extent where most new platforms can now have an empty machine descriptor (if they can use the standard psci_smp_ops, I mentioned already that we need some more work to get non-standard smp_ops merged with cpuidle).

Chances are that a lot of the registers you are trying to map here already have a subsystem that they can fit in as a device driver, or that they do something generic enough that we should add another subsystem to abstract them. If you need help figuring out which subsystem they should use, we should take a closer look at the actual register descriptions together. Is there a manual that is publically available?

Arnd

#5 lore raw

Re: [PATCH v2 1/6] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs

In reply to Arnd Bergmann

2013/12/5 Arnd Bergmann <[email protected]>:

Quoted 27 lines · Florian Fainelli
Quoted 8 lines

2013/12/3 Arnd Bergmann <[email protected]>:

Quoted 7 lines
Quoted 6 lines
arch/arm/mach-bcm/brcmstb.c new file +5 -0
+     addr = ioremap(BPHYSADDR(BCHP_IRQ0_IRQEN), sizeof(u32));
+     writel_relaxed(BCHP_IRQ0_IRQEN_uarta_irqen_MASK
+             | BCHP_IRQ0_IRQEN_uartb_irqen_MASK
+             | BCHP_IRQ0_IRQEN_uartc_irqen_MASK, addr);
+     iounmap(addr);
Quoted 7 lines
Quoted 2 lines

What does this part do? Isn't that something that should have been set up by the boot loader?

The bootloader will typically use the UART in busy-looping mode and not rely on interrupts, also the bootloader currently does not know much about how many UARTs there are in the system and how they are going to be used.

Well, it should at least know how many ports are wire up and be able to set them up to a working state.

Quoted 7 lines

One possible way to solve this would be to write a very small irqchip driver which only implements the "irq_enable" method to allow these interrupts to be forwarded to the GIC. Somewhere in the Device Tree we would have an interrupt-map property which describes the mapping between the bits in BCHP_IRQ0_IRQEN and their corresponding peripherals (UARTA, B, C).

Quoted 6 lines
Quoted 1 line

Would that work?

I think that would work, but it's getting into the overdesign territory. Can you clarify why this register exists in the first place and what makes it necessary to set it up? Are there similar registers for all other IRQs?

This BCHP_IRQ0 register is kind of special and only acts as an interrupt forwarder. Not enabling the IRQEN bit will prevent the UART interrupts to be raised at the GIC level. Now that I think about this some more, we might just go with some sort of special node which contains a mask of the interrupts and apply this mask to the corresponding hardware register? There is no need for this to be modelled as an interrupt controller because this really is not a real one.

Signature · 1 line
Florian
#6 lore raw

Re: [PATCH v2 1/6] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs

Quoted 8 lines · Florian Fainelli

This BCHP_IRQ0 register is kind of special and only acts as an interrupt forwarder. Not enabling the IRQEN bit will prevent the UART interrupts to be raised at the GIC level. Now that I think about this some more, we might just go with some sort of special node which contains a mask of the interrupts and apply this mask to the corresponding hardware register? There is no need for this to be modelled as an interrupt controller because this really is not a real one.

Right, that would work. Unfortunately we need it rather early (before the console code starts), so I'm not sure where to best put the code for it. Any suggestions?

What else is in the same 4K register region?

Arnd

#9 lore raw

Re: [PATCH v2 1/6] ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs

In reply to Marc Carino
Quoted 6 lines · Marc Carino

The BCM7xxx series of Broadcom SoCs are used primarily in set-top boxes.

This patch adds machine support for the ARM-based Broadcom SoCs.

<snip>

Quoted 29 lines
arch/arm/mach-bcm/brcmstb.h new file +23 -0
new file mode 100644
index 0000000..d08dffc
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2013 Broadcom Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __BRCMSTB_H__
+#define __BRCMSTB_H__
+
+#if !defined(__ASSEMBLY__)
+#include <linux/smp.h>
+#endif
+
+#define BRCMSTB_PERIPH_VIRT				0xfc000000
+#define BRCMSTB_PERIPH_PHYS				0xf0000000
+#define BRCMSTB_PERIPH_LENGTH				0x02000000

arch/arm/mach-bcm/brcmstb.h line 33

Quoted 10 lines
arch/arm/mach-bcm/brcmstb.h new file +10 -0
+
+#define BVIRTADDR(x)	(BRCMSTB_PERIPH_VIRT + ((x) & 0x0fffffff))
+#define BPHYSADDR(x)	((x) + BRCMSTB_PERIPH_PHYS)
+
+#define BCHP_UARTA_REG_START				0x00406b00
+
+#define BCHP_IRQ0_IRQEN					0x00406780
+#define BCHP_IRQ0_IRQEN_uarta_irqen_MASK		0x00010000
+#define BCHP_IRQ0_IRQEN_uartb_irqen_MASK		0x00020000
+#define BCHP_IRQ0_IRQEN_uartc_irqen_MASK		0x00040000

These need to be all uppercase. Using bitops might be nice too.

-Matt

#13 lore raw

Re: [PATCH v2 4/6] ARM: brcmstb: add misc. DT bindings for brcm,brcmstb

In reply to Marc Carino
Quoted 16 lines · Marc Carino

Document the bindings that the Broadcom STB platform needs for proper bootup.

---
 .../devicetree/bindings/arm/brcm-brcmstb.txt       |   72 ++++++++++++++++++++
 1 files changed, 72 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/brcm-brcmstb.txt
Documentation/devicetree/bindings/arm/brcm-brcmstb.txt new file +0 -0
new file mode 100644
index 0000000..2f3cd50

Documentation/devicetree/bindings/arm/brcm-brcmstb.txt line 4

Quoted 4 lines
Documentation/devicetree/bindings/arm/brcm-brcmstb.txt new file +4 -0
@@ -0,0 +1,72 @@
+Broadcom STB platforms Device Tree Bindings
+-------------------------------------------
+Boards with Broadcom Brahma15-based BCM7xxx SOC shall have the following
+properties.

Does Brahma15 identify the ARM-based members of the BCM7xxx family? I ask since it's a little confusing knowing that there's some MIPs-based BCM7xxx SoCs and this binding is specific to the ARM versions. Could the ARM-based members be enumerated explicitly by part number? e.g. BCM7445, etc.

Documentation/devicetree/bindings/arm/brcm-brcmstb.txt line 7

Quoted 3 lines
Documentation/devicetree/bindings/arm/brcm-brcmstb.txt new file +3 -0
+
+Required root node properties:
+    - compatible = "brcm,brcmstb";

Along the same lines...Isn't this a little too generic for a compatible string? If BCM7445 were the first in this family wouldn't brcm,bcm7445 be more appropriate given the compatible string naming guidelines?

-Matt

#16 lore raw

Re: [PATCH v2 6/6] ARM: brcmstb: dts: add a reference DTS for Broadcom 7445

In reply to Marc Carino
Quoted 40 lines · Marc Carino

Add a sample DTS which will allow bootup of a board populated with the BCM7445 chip.

---
 arch/arm/boot/dts/brcmstb-7445.dts |  115 ++++++++++++++++++++++++++++++++++++
 1 files changed, 115 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/brcmstb-7445.dts
arch/arm/boot/dts/brcmstb-7445.dts new file +24 -0
new file mode 100644
index 0000000..a8b74c5
@@ -0,0 +1,115 @@
+/dts-v1/;
+/include/ "skeleton.dtsi"
+
+/ {
+	#address-cells = <0x1>;
+	#size-cells = <0x1>;
+	model = "Broadcom STB (7445)";
+	compatible = "brcm,brcmstb";
+	interrupt-parent = <&gic>;
+
+	chosen {
+		bootargs = "earlyprintk console=ttyS0,115200";
+	};
+
+	memory {
+		#address-cells = <0x1>;
+		#size-cells = <0x1>;
+		device_type = "memory";
+		reg = <0x0 0x40000000 0x40000000 0x40000000 0x80000000 0x40000000>;
+	};
+
+	cpupll: cpupll at 0 {
+		compatible = "fixed-clock";
+		#clock-cells = <0x0>;

arch/arm/boot/dts/brcmstb-7445.dts line 34

Quoted 10 lines
arch/arm/boot/dts/brcmstb-7445.dts new file +10 -0
+		clock-frequency = <1500000000>;
+	};
+
+	cpuclk: cpu-clk-div at 0 {
+		compatible = "brcm,brcmstb-cpu-clk-div";
+		reg = <0xf03e257c 0x4>;
+		#clock-cells = <0x0>;
+		clocks = <&cpupll>;
+		div-table = <0x0 0x1 0x11 0x2 0x12 0x4 0x13 0x8 0x14 0x10>;
+	};

There's no clk driver code to use this that I can find and no binding to describe the use of this compatible string. This node should be removed and submitted along with the clk binding and driver series.

-Matt