Broadcom STB S2/S3/S5 support for ARM and MIPS
Subsystems (4)
v3 cover Broadcom STB S2/S3/S5 support for ARM and MIPS
Hi,
This patch series adds support for S2/S3/S5 suspend/resume states on ARM and MIPS based Broadcom STB SoCs.
This was submitted a long time ago by Brian, and I am now picking this up and trying to get this included with support for our latest chips.
Provided that I can collect the necessary Acks from Rob (DT) and other people (Rafael?) I would probably take this via the Broadcom ARM SoC pull requests.
Thank you!
Changes in v3:
- make SRAM mapping uncached
- make SWAP_STACK + brcmstb_pm_s3_finish a single asm volatile statement
- added Rob's Acked-by to first patch
Changes in v2:
- clarify the first patch's subject (Rob)
- removed patch #2 which was creating a bisectability problem (kbuild)
- added proper AFLAGS to get s2-arm.S to build properly (kbuild)
- improved MIPS power management binding document (Rob)
Brian Norris (1):
soc: bcm: brcmstb: Add support for S2/S3/S5 suspend states (ARM)
Florian Fainelli (2):
dt-bindings: ARM: brcmstb: Update Broadcom STB Power Management
binding
dt-bindings: Document MIPS Broadcom STB power management nodes
Justin Chen (1):
soc bcm: brcmstb: Add support for S2/S3/S5 suspend states (MIPS)
.../devicetree/bindings/arm/bcm/brcm,brcmstb.txt | 6 +- .../devicetree/bindings/mips/brcm/soc.txt | 153 ++++ drivers/soc/bcm/Kconfig | 2 + drivers/soc/bcm/brcmstb/Kconfig | 9 + drivers/soc/bcm/brcmstb/Makefile | 1 + drivers/soc/bcm/brcmstb/pm/Makefile | 3 + drivers/soc/bcm/brcmstb/pm/aon_defs.h | 113 +++ drivers/soc/bcm/brcmstb/pm/pm-arm.c | 836 +++++++++++++++++++++ drivers/soc/bcm/brcmstb/pm/pm-mips.c | 461 ++++++++++++ drivers/soc/bcm/brcmstb/pm/pm.h | 89 +++ drivers/soc/bcm/brcmstb/pm/s2-arm.S | 76 ++ drivers/soc/bcm/brcmstb/pm/s2-mips.S | 200 +++++ drivers/soc/bcm/brcmstb/pm/s3-mips.S | 146 ++++ 13 files changed, 2094 insertions(+), 1 deletion(-) create mode 100644 drivers/soc/bcm/brcmstb/Kconfig create mode 100644 drivers/soc/bcm/brcmstb/pm/Makefile create mode 100644 drivers/soc/bcm/brcmstb/pm/aon_defs.h create mode 100644 drivers/soc/bcm/brcmstb/pm/pm-arm.c create mode 100644 drivers/soc/bcm/brcmstb/pm/pm-mips.c create mode 100644 drivers/soc/bcm/brcmstb/pm/pm.h create mode 100644 drivers/soc/bcm/brcmstb/pm/s2-arm.S create mode 100644 drivers/soc/bcm/brcmstb/pm/s2-mips.S create mode 100644 drivers/soc/bcm/brcmstb/pm/s3-mips.S
Signature · 1 line
2.9.3
PATCH v3 1/4 dt-bindings: ARM: brcmstb: Update Broadcom STB Power Management binding
Update the Broadcom STB Power Management binding document with new compatible strings for the DDR PHY and memory controller found on newer chips.
--- Documentation/devicetree/bindings/arm/bcm/brcm,brcmstb.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/arm/bcm/brcm,brcmstb.txt +5 -1
@@ -164,6 +164,8 @@ Control registers for this memory controller's DDR PHY. Required properties: - compatible : should contain one of these + "brcm,brcmstb-ddr-phy-v71.1" + "brcm,brcmstb-ddr-phy-v72.0" "brcm,brcmstb-ddr-phy-v225.1" "brcm,brcmstb-ddr-phy-v240.1" "brcm,brcmstb-ddr-phy-v240.2"
@@ -184,7 +186,9 @@ Sequencer DRAM parameters and control registers. Used for Self-Refresh Power-Down (SRPD), among other things. Required properties: -- compatible : should contain "brcm,brcmstb-memc-ddr" +- compatible : should contain one of these + "brcm,brcmstb-memc-ddr-rev-b.2.2" + "brcm,brcmstb-memc-ddr" - reg : the MEMC DDR register range Example:
Signature · 1 line
2.9.3
PATCH v3 2/4 soc: bcm: brcmstb: Add support for S2/S3/S5 suspend states (ARM)
In reply to Florian FainelliFrom: Brian Norris <[email protected]>
This commit adds support for the Broadcom STB S2/S3/S5 suspend states on ARM based SoCs.
This requires quite a lot of code in order to deal with the different HW blocks that need to be quiesced during suspend:
- DDR PHY SHIM
- DDR memory controller and sequencer
- control processor
The final steps of the suspend execute in an on-chip SRAM and there is a little bit of assembly code in order to shut down the DDR PHY PLL and then go into a wfi loop until a wake-up even occurs. Conversely the resume part involves waiting for the DDR PHY PLL to come back up and resume executions where we left.
For S3, because of our memory hashing (actual hashing code not included for simplicity, and is bypassed) we need to relocate the writable variables (stack) into SRAM shortly before suspending in order to leave the DRAM untouched and create a reliable hash of its contents.
This code has been contributed by Brian Norris initially and has been incrementally fixed and updated to support new chips by a lot of people.
--- drivers/soc/bcm/Kconfig | 2 + drivers/soc/bcm/brcmstb/Kconfig | 9 + drivers/soc/bcm/brcmstb/Makefile | 1 + drivers/soc/bcm/brcmstb/pm/Makefile | 2 + drivers/soc/bcm/brcmstb/pm/aon_defs.h | 113 +++++ drivers/soc/bcm/brcmstb/pm/pm-arm.c | 822 ++++++++++++++++++++++++++++++++++ drivers/soc/bcm/brcmstb/pm/pm.h | 78 ++++ drivers/soc/bcm/brcmstb/pm/s2-arm.S | 76 ++++ 8 files changed, 1103 insertions(+) create mode 100644 drivers/soc/bcm/brcmstb/Kconfig create mode 100644 drivers/soc/bcm/brcmstb/pm/Makefile create mode 100644 drivers/soc/bcm/brcmstb/pm/aon_defs.h create mode 100644 drivers/soc/bcm/brcmstb/pm/pm-arm.c create mode 100644 drivers/soc/bcm/brcmstb/pm/pm.h create mode 100644 drivers/soc/bcm/brcmstb/pm/s2-arm.S
drivers/soc/bcm/Kconfig +2 -0
@@ -20,4 +20,6 @@ config SOC_BRCMSTB If unsure, say N. +source "drivers/soc/bcm/brcmstb/Kconfig" + endmenu
drivers/soc/bcm/brcmstb/Kconfig new file +9 -0
@@ -0,0 +1,9 @@ +if SOC_BRCMSTB + +config BRCMSTB_PM + bool "Support suspend/resume for STB platforms" + default y + depends on PM + depends on ARM + +endif # SOC_BRCMSTB
drivers/soc/bcm/brcmstb/Makefile +1 -0
@@ -1 +1,2 @@ obj-y += common.o biuctrl.o +obj-y += pm/
drivers/soc/bcm/brcmstb/pm/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +obj-$(CONFIG_ARM) += s2-arm.o pm-arm.o +AFLAGS_s2-arm.o := -march=armv7-a
drivers/soc/bcm/brcmstb/pm/aon_defs.h new file +113 -0
113 lines not on this page · raw message
drivers/soc/bcm/brcmstb/pm/pm-arm.c new file +822 -0
822 lines not on this page · raw message
drivers/soc/bcm/brcmstb/pm/pm.h new file +78 -0
78 lines not on this page · raw message
drivers/soc/bcm/brcmstb/pm/s2-arm.S new file +76 -0
76 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v3 3/4 dt-bindings: Document MIPS Broadcom STB power management nodes
In reply to Florian FainelliDocument the different nodes required for supporting S2/S3/S5 suspend states on MIPS-based Broadcom STB SoCs.
--- .../devicetree/bindings/mips/brcm/soc.txt | 153 +++++++++++++++++++++ 1 file changed, 153 insertions(+)
Documentation/devicetree/bindings/mips/brcm/soc.txt +153 -0
@@ -11,3 +11,156 @@ Required properties: The experimental -viper variants are for running Linux on the 3384's BMIPS4355 cable modem CPU instead of the BMIPS5000 application processor. + +Power management +---------------- + +For power management (particularly, S2/S3/S5 system suspend), the following SoC +components are needed: + += Always-On control block (AON CTRL) + +This hardware provides control registers for the "always-on" (even in low-power +modes) hardware, such as the Power Management State Machine (PMSM). + +Required properties: +- compatible : should be one of + "brcm,bcm7425-aon-ctrl" + "brcm,bcm7429-aon-ctrl" + "brcm,bcm7435-aon-ctrl" and + "brcm,brcmstb-aon-ctrl" +- reg : the register start and length for the AON CTRL block + +Example: + +syscon at 410000 { + compatible = "brcm,bcm7425-aon-ctrl", "brcm,brcmstb-aon-ctrl"; + reg = <0x410000 0x400>; +}; + += Memory controllers + +A Broadcom STB SoC typically has a number of independent memory controllers, +each of which may have several associated hardware blocks, which are versioned +independently (control registers, DDR PHYs, etc.). One might consider +describing these controllers as a parent "memory controllers" block, which +contains N sub-nodes (one for each controller in the system), each of which is +associated with a number of hardware register resources (e.g., its PHY. + +== MEMC (MEMory Controller) + +Represents a single memory controller instance. + +Required properties: +- compatible : should contain "brcm,brcmstb-memc" and "simple-bus" +- ranges : should contain the child address in the parent address + space, must be 0 here, and the register start and length of + the entire memory controller (including all sub nodes: DDR PHY, + arbiter, etc.) +- #address-cells : must be 1 +- #size-cells : must be 1 + +Example: + + memory-controller: memc at 0 { + compatible = "brcm,brcmstb-memc", "simple-bus"; + ranges = <0x0 0x0 0xa000>; + #address-cells = <1>; + #size-cells = <1>; + + memc-arb at 1000 { + ... + }; + + memc-ddr at 2000 { + ... + }; + + ddr-phy at 6000 { + ... + }; + }; + +Should contain subnodes for any of the following relevant hardware resources: + +== DDR PHY control + +Control registers for this memory controller's DDR PHY. + +Required properties: +- compatible : should contain one of these + "brcm,brcmstb-ddr-phy-v64.5" + "brcm,brcmstb-ddr-phy" + +- reg : the DDR PHY register range and length + +Example: + + ddr-phy at 6000 { + compatible = "brcm,brcmstb-ddr-phy-v64.5"; + reg = <0x6000 0xc8>; + }; + +== DDR memory controller sequencer + +Control registers for this memory controller's DDR memory sequencer + +Required properties: +- compatible : should contain one of these + "brcm,bcm7425-memc-ddr" + "brcm,bcm7429-memc-ddr" + "brcm,bcm7435-memc-ddr" and + "brcm,brcmstb-memc-ddr" + +- reg : the DDR sequencer register range and length + +Example: + + memc-ddr at 2000 { + compatible = "brcm,bcm7425-memc-ddr", "brcm,brcmstb-memc-ddr"; + reg = <0x2000 0x300>; + }; + +== MEMC Arbiter + +The memory controller arbiter is responsible for memory clients allocation +(bandwidth, priorities etc.) and needs to have its contents restored during +deep sleep states (S3). + +Required properties: + +- compatible : should contain one of these + "brcm,brcmstb-memc-arb-v10.0.0.0" + "brcm,brcmstb-memc-arb" + +- reg : the DDR Arbiter register range and length + +Example: + + memc-arb at 1000 { + compatible = "brcm,brcmstb-memc-arb-v10.0.0.0"; + reg = <0x1000 0x248>; + }; + +== Timers + +The Broadcom STB chips contain a timer block with several general purpose +timers that can be used. + +Required properties: + +- compatible : should contain one of: + "brcm,bcm7425-timers" + "brcm,bcm7429-timers" + "brcm,bcm7435-timers and + "brcm,brcmstb-timers" +- reg : the timers register range +- interrupts : the interrupt line for this timer block + +Example: + + timers: timers at 4067c0 { + compatible = "brcm,bcm7425-timers", "brcm,brcmstb-timers"; + reg = <0x4067c0 0x40>; + interrupts = <&periph_intc 19>; + };
Signature · 1 line
2.9.3
Re: [PATCH v3 3/4] dt-bindings: Document MIPS Broadcom STB power management nodes
Quoted 7 lines · Florian Fainelli
Document the different nodes required for supporting S2/S3/S5 suspend states on MIPS-based Broadcom STB SoCs.
Signed-off-by Florian Fainelli <[email protected]>--- .../devicetree/bindings/mips/brcm/soc.txt | 153 +++++++++++++++++++++ 1 file changed, 153 insertions(+)
A couple of nits on the node names, otherwise:
Documentation/devicetree/bindings/mips/brcm/soc.txt Required properties: · line 65
Quoted 3 lines
Documentation/devicetree/bindings/mips/brcm/soc.txt +3
-0+Example: + + memory-controller: memc at 0 {
memory-controller at 0
Quoted 12 lines
Documentation/devicetree/bindings/mips/brcm/soc.txt +12
-0+ compatible = "brcm,brcmstb-memc", "simple-bus"; + ranges = <0x0 0x0 0xa000>; + #address-cells = <1>; + #size-cells = <1>; + + memc-arb at 1000 { + ... + }; + + memc-ddr at 2000 { + ... + };
Documentation/devicetree/bindings/mips/brcm/soc.txt Required properties: · line 162
Quoted 10 lines
Documentation/devicetree/bindings/mips/brcm/soc.txt +8
-0+ + ddr-phy at 6000 { + ... + }; + }; +Example: + + timers: timers at 4067c0 {
timer at ...
Quoted 7 lines
Documentation/devicetree/bindings/mips/brcm/soc.txt +4
-0+ compatible = "brcm,bcm7425-timers", "brcm,brcmstb-timers"; + reg = <0x4067c0 0x40>; + interrupts = <&periph_intc 19>; + };Signature · 1 line
2.9.3
PATCH v3 4/4 soc bcm: brcmstb: Add support for S2/S3/S5 suspend states (MIPS)
In reply to Florian FainelliFrom: Justin Chen <[email protected]>
This commit adds support for the Broadcom STB S2/S3/S5 suspend states on MIPS based SoCs.
This requires quite a lot of code in order to deal with the different HW blocks that need to be quiesced during suspend:
- DDR PHY
- DDR memory controller and arbiter
- control processor
The final steps of the suspend execute in cache and there is is a little bit of assembly code in order to shut down the DDR PHY PLL and then go into a wait loop until a wake-up even occurs. Conversely the resume part involves waiting for the DDR PHY PLL to come back up and resume executions where we left.
--- drivers/soc/bcm/brcmstb/Kconfig | 2 +- drivers/soc/bcm/brcmstb/pm/Makefile | 1 + drivers/soc/bcm/brcmstb/pm/pm-mips.c | 461 +++++++++++++++++++++++++++++++++++ drivers/soc/bcm/brcmstb/pm/pm.h | 13 +- drivers/soc/bcm/brcmstb/pm/s2-mips.S | 200 +++++++++++++++ drivers/soc/bcm/brcmstb/pm/s3-mips.S | 146 +++++++++++ 6 files changed, 821 insertions(+), 2 deletions(-) create mode 100644 drivers/soc/bcm/brcmstb/pm/pm-mips.c create mode 100644 drivers/soc/bcm/brcmstb/pm/s2-mips.S create mode 100644 drivers/soc/bcm/brcmstb/pm/s3-mips.S
drivers/soc/bcm/brcmstb/Kconfig +1 -1
@@ -4,6 +4,6 @@ config BRCMSTB_PM bool "Support suspend/resume for STB platforms" default y depends on PM - depends on ARM + depends on ARM || BMIPS_GENERIC endif # SOC_BRCMSTB
drivers/soc/bcm/brcmstb/pm/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-$(CONFIG_ARM) += s2-arm.o pm-arm.o AFLAGS_s2-arm.o := -march=armv7-a +obj-$(CONFIG_BMIPS_GENERIC) += s2-mips.o s3-mips.o pm-mips.o
drivers/soc/bcm/brcmstb/pm/pm-mips.c new file +461 -0
461 lines not on this page · raw message
drivers/soc/bcm/brcmstb/pm/pm.h +12 -1
@@ -70,9 +70,20 @@#ifndef __ASSEMBLY__ +#ifndef CONFIG_MIPS extern const unsigned long brcmstb_pm_do_s2_sz; extern asmlinkage int brcmstb_pm_do_s2(void __iomem *aon_ctrl_base,void __iomem *ddr_phy_pll_status); -#endif +#else +/* s2 asm */ +extern asmlinkage int brcm_pm_do_s2(u32 *s2_params); + +/* s3 asm */ +extern asmlinkage int brcm_pm_do_s3(void __iomem *aon_ctrl_base, +int dcache_linesz); +extern int s3_reentry; +#endif /* CONFIG_MIPS */ + +#endif #endif /* __BRCMSTB_PM_H__ */
drivers/soc/bcm/brcmstb/pm/s2-mips.S new file +200 -0
200 lines not on this page · raw message
drivers/soc/bcm/brcmstb/pm/s3-mips.S new file +146 -0
146 lines not on this page · raw message
Signature · 1 line
2.9.3
Florian Fainelli
maintainerQuoted 11 lines · Florian Fainelli
Hi,
This patch series adds support for S2/S3/S5 suspend/resume states on ARM and MIPS based Broadcom STB SoCs.
This was submitted a long time ago by Brian, and I am now picking this up and trying to get this included with support for our latest chips.
Provided that I can collect the necessary Acks from Rob (DT) and other people (Rafael?) I would probably take this via the Broadcom ARM SoC pull requests.
Rafael, any feedback on this?
Quoted 51 lines
Thank you!
Changes in v3:
- make SRAM mapping uncached
- makeSWAP_STACK+brcmstb_pm_s3_finisha single asm volatile statement
- added Rob's Acked-by to first patchChanges in v2:
- clarify the first patch's subject (Rob)
- removed patch #2 which was creating a bisectability problem (kbuild)
- added proper AFLAGS to gets2-arm.Sto build properly (kbuild)
- improved MIPS power management binding document (Rob)Brian Norris (1):
soc: bcm: brcmstb: Add support for S2/S3/S5 suspend states (ARM)Florian Fainelli (2):
dt-bindings: ARM: brcmstb: Update Broadcom STB Power Management
binding
dt-bindings: Document MIPS Broadcom STB power management nodesJustin Chen (1):
soc bcm: brcmstb: Add support for S2/S3/S5 suspend states (MIPS).../devicetree/bindings/arm/bcm/brcm,brcmstb.txt | 6 +- .../devicetree/bindings/mips/brcm/soc.txt | 153 ++++ drivers/soc/bcm/Kconfig | 2 + drivers/soc/bcm/brcmstb/Kconfig | 9 + drivers/soc/bcm/brcmstb/Makefile | 1 + drivers/soc/bcm/brcmstb/pm/Makefile | 3 + drivers/soc/bcm/brcmstb/pm/aon_defs.h | 113 +++ drivers/soc/bcm/brcmstb/pm/pm-arm.c | 836 +++++++++++++++++++++ drivers/soc/bcm/brcmstb/pm/pm-mips.c | 461 ++++++++++++ drivers/soc/bcm/brcmstb/pm/pm.h | 89 +++ drivers/soc/bcm/brcmstb/pm/s2-arm.S | 76 ++ drivers/soc/bcm/brcmstb/pm/s2-mips.S | 200 +++++ drivers/soc/bcm/brcmstb/pm/s3-mips.S | 146 ++++ 13 files changed, 2094 insertions(+), 1 deletion(-) create mode 100644 drivers/soc/bcm/brcmstb/Kconfig create mode 100644 drivers/soc/bcm/brcmstb/pm/Makefile create mode 100644 drivers/soc/bcm/brcmstb/pm/aon_defs.h create mode 100644 drivers/soc/bcm/brcmstb/pm/pm-arm.c create mode 100644 drivers/soc/bcm/brcmstb/pm/pm-mips.c create mode 100644 drivers/soc/bcm/brcmstb/pm/pm.h create mode 100644 drivers/soc/bcm/brcmstb/pm/s2-arm.S create mode 100644 drivers/soc/bcm/brcmstb/pm/s2-mips.S create mode 100644 drivers/soc/bcm/brcmstb/pm/s3-mips.S
Signature · 1 line
Florian
Florian Fainelli
AppliedQuoted 6 lines · Florian Fainelli
Quoted 5 lines · Florian Fainelli
Hi,
This patch series adds support for S2/S3/S5 suspend/resume states on ARM and MIPS based Broadcom STB SoCs.
Quoted 8 lines
Quoted 6 lines
This was submitted a long time ago by Brian, and I am now picking this up and trying to get this included with support for our latest chips.
Provided that I can collect the necessary Acks from Rob (DT) and other people (Rafael?) I would probably take this via the Broadcom ARM SoC pull requests.
Rafael, any feedback on this?
Applied these 4 patches to drivers/next now.
Signature · 1 line
Florian