Skip to contentSkip to conversation

ARM: brcmstb: Bus Interface Unit support

PATCH New Florian Fainelli 3 participants 12 messages Sep 15, 2015 – Sep 18, 2015

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v2 cover ARM: brcmstb: Bus Interface Unit support

Hi all,

This patch series adds support for early boot time Bus Interface Unit control register setup which is required to occur before SMP is brought-up, but needs to remap registers, so init_irq() is chosen for that.

This builds on top of the 'soc/next' branch at github.com/Broadcom/stblinux

Major changes in v2:

- updated Device Tree documentation based on Rob's feedback
- added a better pr_fmt format for pr_* calls in biuctrl.c

Florian Fainelli (3):
Documentation: bindings: brcmstb: Document write-pairing
soc: brcmstb: Add Bus Interface Unit control setup
ARM: brcmstb: Setup BIU control registers during boot

 .../devicetree/bindings/arm/bcm/brcm,brcmstb.txt   |  20 ++++
 arch/arm/mach-bcm/brcmstb.c                        |   9 ++
 drivers/soc/brcmstb/Makefile                       |   2 +-
 drivers/soc/brcmstb/biuctrl.c                      | 119 +++++++++++++++++++++
 include/linux/soc/brcmstb/brcmstb.h                |  10 ++
 5 files changed, 159 insertions(+), 1 deletion(-)
 create mode 100644 drivers/soc/brcmstb/biuctrl.c
 create mode 100644 include/linux/soc/brcmstb/brcmstb.h
Signature · 1 line
2.1.0
#1 lore raw

PATCH v2 1/3 Documentation: bindings: brcmstb: Document write-pairing

Document the hif-cpubiuctrl node a bit more, and add a documentation entry for the optional "brcm,write-pairing" property.

---
Changes in v2:

- added a description of what the BIU stands for and what write pairing is
- fixed the compatible string description

 .../devicetree/bindings/arm/bcm/brcm,brcmstb.txt     | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
Documentation/devicetree/bindings/arm/bcm/brcm,brcmstb.txt +20 -0
index 430608ec09f0..8ac28eb4a5a1 100644
@@ -20,6 +20,25 @@ system control is required:
     - compatible: "brcm,bcm<chip_id>-hif-cpubiuctrl", "syscon"
     - compatible: "brcm,bcm<chip_id>-hif-continuation", "syscon"
 
+hif-cpubiuctrl node
+-------------------
+SoCs with Broadcom Brahma15 ARM-based CPUs have a specific Bus Interface Unit
+(BIU) block which controls and interfaces the CPU complex to the different
+Memory Controller Ports (MCP), one per memory controller (MEMC). This BIU block
+offers a feature called Write Pairing which consists in collapsing two adjacent
+cache lines into a single (bursted) write transaction towards the memory
+controller (MEMC) to maximize write bandwidth.
+
+Required properties:
+
+    - compatible: must be "brcm,bcm7445-hif-cpubiuctrl", "syscon"
+
+Optional properties:
+
+    - brcm,write-pairing:
+	Boolean property, which when present indicates that the chip
+	supports write-pairing.
+
 example:
     rdb {
         #address-cells = <1>;
@@ -35,6 +54,7 @@ example:
         hif_cpubiuctrl: syscon at 3e2400 {
             compatible = "brcm,bcm7445-hif-cpubiuctrl", "syscon";
             reg = <0x3e2400 0x5b4>;
+            brcm,write-pairing;
         };
 
         hif_continuation: syscon at 452000 {
Signature · 1 line
2.1.0
#4 lore raw

PATCH v2 2/3 soc: brcmstb: Add Bus Interface Unit control setup

In reply to Florian Fainelli

Broadcom STB SoCs (brcmstb) require an early setup of their Bus Interface Unit control register, this needs to happen before SMP is brought up because it affects how the CPU complex will be interfaced to the memory controller.

Add support code which properly initializes the BIU registers based on whether "brcm,write-pairing" is present in Device Tree, and take care of saving and restoring credit register settings during system-wide suspend/resume operations.

---
Changes in v2:

- add a pr_fmt prefix which is more descriptive

 drivers/soc/brcmstb/Makefile        |   2 +-
 drivers/soc/brcmstb/biuctrl.c       | 119 ++++++++++++++++++++++++++++++++++++
 include/linux/soc/brcmstb/brcmstb.h |  10 +++
 3 files changed, 130 insertions(+), 1 deletion(-)
 create mode 100644 drivers/soc/brcmstb/biuctrl.c
 create mode 100644 include/linux/soc/brcmstb/brcmstb.h
drivers/soc/brcmstb/Makefile +1 -1
index 677e3fa0d042..75df0e0c091d 100644
@@ -1,3 +1,3 @@
 obj-$(CONFIG_BRCMSTB_PM)	+= pm/
 
-obj-y				+= common.o
+obj-y				+= common.o biuctrl.o
drivers/soc/brcmstb/biuctrl.c new file +119 -0

119 lines not on this page · raw message

include/linux/soc/brcmstb/brcmstb.h new file +10 -0
new file mode 100644
index 000000000000..7009f61ea24c
@@ -0,0 +1,10 @@
+#ifndef __BRCMSTB_SOC_H
+#define __BRCMSTB_SOC_H
+
+/*
+ * Bus Interface Unit control register setup, must happen early during boot,
+ * before SMP is brought up, called by machine entry point.
+ */
+int brcmstb_biuctrl_init(void);
+
+#endif /* __BRCMSTB_SOC_H */
Signature · 1 line
2.1.0
#5 lore raw

PATCH v2 2/3 soc: brcmstb: Add Bus Interface Unit control setup

Quoted 33 lines · Florian Fainelli

Broadcom STB SoCs (brcmstb) require an early setup of their Bus Interface Unit control register, this needs to happen before SMP is brought up because it affects how the CPU complex will be interfaced to the memory controller.

Add support code which properly initializes the BIU registers based on whether "brcm,write-pairing" is present in Device Tree, and take care of saving and restoring credit register settings during system-wide suspend/resume operations.

---
Changes in v2:

- add a pr_fmt prefix which is more descriptive

 drivers/soc/brcmstb/Makefile        |   2 +-
 drivers/soc/brcmstb/biuctrl.c       | 119 ++++++++++++++++++++++++++++++++++++
 include/linux/soc/brcmstb/brcmstb.h |  10 +++
 3 files changed, 130 insertions(+), 1 deletion(-)
 create mode 100644 drivers/soc/brcmstb/biuctrl.c
 create mode 100644 include/linux/soc/brcmstb/brcmstb.h

[...]

drivers/soc/brcmstb/biuctrl.c new file +2 -0
new file mode 100644
index 000000000000..1d4deada1c4d
@@ -0,0 +1,119 @@
[...]
+int __init brcmstb_biuctrl_init(void)
+{

drivers/soc/brcmstb/biuctrl.c line 112

Quoted 10 lines
drivers/soc/brcmstb/biuctrl.c new file +10 -0
+       int ret = 0;
+
+       ret = setup_hifcpubiuctrl_regs();
+       if (ret)
+               return ret;
+
+       ret = mcp_write_pairing_set();
+       if (ret) {
+               pr_err("MCP: Unable to disable write pairing!\n");
+               return ret;

The return value isn't used in patch 3. Is there a point to returning an error from this function in either of the above two locations, considering that?

Looks good otherwise.

#6 lore raw

PATCH v2 2/3 soc: brcmstb: Add Bus Interface Unit control setup

Quoted 25 lines · Gregory Fong
Quoted 10 lines

[...]

drivers/soc/brcmstb/biuctrl.c new file +2 -0
new file mode 100644
index 000000000000..1d4deada1c4d
@@ -0,0 +1,119 @@
[...]
+int __init brcmstb_biuctrl_init(void)
+{

drivers/soc/brcmstb/biuctrl.c line 112

Quoted 10 lines
drivers/soc/brcmstb/biuctrl.c new file +10 -0
+       int ret = 0;
+
+       ret = setup_hifcpubiuctrl_regs();
+       if (ret)
+               return ret;
+
+       ret = mcp_write_pairing_set();
+       if (ret) {
+               pr_err("MCP: Unable to disable write pairing!\n");
+               return ret;

The return value isn't used in patch 3. Is there a point to returning an error from this function in either of the above two locations, considering that?

Quoted 3 lines

Looks good otherwise.

Not really, how about this:

void __init brcmstb_biuctrl_init(void)

{
        int ret;

        setup_hifcpubiuctrl_regs();

        ret = mcp_write_pairing_set();
        if (ret) {
                pr_err("MCP: Unable to disable write pairing!\n");
                return;
        }
#ifdef CONFIG_PM_SLEEP
        register_syscore_ops(&brcmstb_cpu_credit_syscore_ops);

#endif
}

and updating the function prototype accordingly in the header file?

Signature · 1 line
Florian
#7 lore raw

PATCH v2 2/3 soc: brcmstb: Add Bus Interface Unit control setup

Quoted 44 lines · Florian Fainelli
Quoted 25 lines · Gregory Fong
Quoted 10 lines

[...]

drivers/soc/brcmstb/biuctrl.c new file +2 -0
new file mode 100644
index 000000000000..1d4deada1c4d
@@ -0,0 +1,119 @@
[...]
+int __init brcmstb_biuctrl_init(void)
+{

drivers/soc/brcmstb/biuctrl.c line 112

Quoted 10 lines
drivers/soc/brcmstb/biuctrl.c new file +10 -0
+       int ret = 0;
+
+       ret = setup_hifcpubiuctrl_regs();
+       if (ret)
+               return ret;
+
+       ret = mcp_write_pairing_set();
+       if (ret) {
+               pr_err("MCP: Unable to disable write pairing!\n");
+               return ret;

The return value isn't used in patch 3. Is there a point to returning an error from this function in either of the above two locations, considering that?

Quoted 3 lines

Looks good otherwise.

Not really, how about this:

void __init brcmstb_biuctrl_init(void)

{
        int ret;

        setup_hifcpubiuctrl_regs();

        ret = mcp_write_pairing_set();
        if (ret) {
                pr_err("MCP: Unable to disable write pairing!\n");
                return;
        }
Quoted 6 lines
#ifdef CONFIG_PM_SLEEP
        register_syscore_ops(&brcmstb_cpu_credit_syscore_ops);

#endif
}

and updating the function prototype accordingly in the header file?

Sure, that works.

Thanks,
Gregory

author Applied
#8 lore raw

PATCH v2 2/3 soc: brcmstb: Add Bus Interface Unit control setup

In reply to Florian Fainelli
Quoted 11 lines · Florian Fainelli

Broadcom STB SoCs (brcmstb) require an early setup of their Bus Interface Unit control register, this needs to happen before SMP is brought up because it affects how the CPU complex will be interfaced to the memory controller.

Add support code which properly initializes the BIU registers based on whether "brcm,write-pairing" is present in Device Tree, and take care of saving and restoring credit register settings during system-wide suspend/resume operations.

Applied to soc/next with Gregory's tag and the revised function prototype returning void.

Signature · 1 line
Florian
#9 lore raw

PATCH v2 3/3 ARM: brcmstb: Setup BIU control registers during boot

In reply to Florian Fainelli

Call brcmstb_biuctrl_init() in brcmstb's init_irq machine descriptor callback since we need to setup the Bus Interface Unit before SMP in particular, but we also need to be able to remap registers.

---
 arch/arm/mach-bcm/brcmstb.c | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm/mach-bcm/brcmstb.c +9 -0
index 3a60f7ee3f0c..99a67cfb7c0d 100644
@@ -12,11 +12,19 @@
  */
 
 #include <linux/init.h>
+#include <linux/irqchip.h>
 #include <linux/of_platform.h>
+#include <linux/soc/brcmstb/brcmstb.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
+static void __init brcmstb_init_irq(void)
+{
+	irqchip_init();
+	brcmstb_biuctrl_init();
+}
+
 static const char *const brcmstb_match[] __initconst = {
 	"brcm,bcm7445",
 	"brcm,brcmstb",
@@ -25,4 +33,5 @@ static const char *const brcmstb_match[] __initconst = {
 
 DT_MACHINE_START(BRCMSTB, "Broadcom STB (Flattened Device Tree)")
 	.dt_compat	= brcmstb_match,
+	.init_irq	= brcmstb_init_irq,
 MACHINE_END
Signature · 1 line
2.1.0
author Applied
#11 lore raw

PATCH v2 3/3 ARM: brcmstb: Setup BIU control registers during boot

In reply to Florian Fainelli
Quoted 5 lines · Florian Fainelli

Call brcmstb_biuctrl_init() in brcmstb's init_irq machine descriptor callback since we need to setup the Bus Interface Unit before SMP in particular, but we also need to be able to remap registers.

Applied to soc/next.

Signature · 1 line
Florian