* [PATCH 1/7] Documentation: dt: brcmstb: add system PM bindings
2015-06-19 0:11 [PATCH 0/7] soc: brcmstb: add system suspend support for STB SoCs Brian Norris
@ 2015-06-19 0:11 ` Brian Norris
[not found] ` <1434672696-13632-2-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-19 0:11 ` [PATCH 2/7] Documentation: dt: brcmstb: add waketimer documentation Brian Norris
` (7 subsequent siblings)
8 siblings, 1 reply; 27+ messages in thread
From: Brian Norris @ 2015-06-19 0:11 UTC (permalink / raw)
To: Brian Norris, Gregory Fong, Florian Fainelli
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
linux-kernel, devicetree, linux-arm-kernel,
bcm-kernel-feedback-list
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
.../devicetree/bindings/arm/bcm/brcm,brcmstb.txt | 142 ++++++++++++++++++++-
1 file changed, 140 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/arm/bcm/brcm,brcmstb.txt b/Documentation/devicetree/bindings/arm/bcm/brcm,brcmstb.txt
index 430608ec09f0..94429649687e 100644
--- a/Documentation/devicetree/bindings/arm/bcm/brcm,brcmstb.txt
+++ b/Documentation/devicetree/bindings/arm/bcm/brcm,brcmstb.txt
@@ -43,8 +43,7 @@ example:
};
};
-Lastly, nodes that allow for support of SMP initialization and reboot are
-required:
+Nodes that allow for support of SMP initialization and reboot are required:
smpboot
-------
@@ -95,3 +94,142 @@ example:
compatible = "brcm,brcmstb-reboot";
syscon = <&sun_top_ctrl 0x304 0x308>;
};
+
+
+
+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 contain "brcm,brcmstb-aon-ctrl"
+- reg : the register start and length for the AON CTRL block
+
+Example:
+
+aon-ctrl@410000 {
+ compatible = "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). See
+the example device tree snippet below.
+
+== MEMC (MEMory Controller)
+
+Represents a single memory controller instance.
+
+Required properties:
+- compatible : should contain "brcm,brcmstb-memc" and "simple-bus"
+
+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-v225.1"
+ "brcm,brcmstb-ddr-phy-v240.1"
+ "brcm,brcmstb-ddr-phy-v240.2"
+
+- reg : the DDR PHY register range
+
+== DDR SHIMPHY
+
+Control registers for this memory controller's DDR SHIMPHY.
+
+Required properties:
+- compatible : should contain "brcm,brcmstb-ddr-shimphy-v1.0"
+- reg : the DDR SHIMPHY register range
+
+== MEMC DDR control
+
+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"
+- reg : the MEMC DDR register range
+
+Example:
+
+memory_controllers {
+ ranges;
+ compatible = "simple-bus";
+
+ memc@0 {
+ compatible = "brcm,brcmstb-memc", "simple-bus";
+ ranges;
+
+ ddr-phy@f1106000 {
+ compatible = "brcm,brcmstb-ddr-phy-v240.1";
+ reg = <0xf1106000 0x21c>;
+ };
+
+ shimphy@f1108000 {
+ compatible = "brcm,brcmstb-ddr-shimphy-v1.0";
+ reg = <0xf1108000 0xe4>;
+ };
+
+ memc-ddr@f1102000 {
+ reg = <0xf1102000 0x800>;
+ compatible = "brcm,brcmstb-memc-ddr";
+ };
+ };
+
+ memc@1 {
+ compatible = "brcm,brcmstb-memc", "simple-bus";
+ ranges;
+
+ ddr-phy@f1186000 {
+ compatible = "brcm,brcmstb-ddr-phy-v240.1";
+ reg = <0xf1186000 0x21c>;
+ };
+
+ shimphy@f1188000 {
+ compatible = "brcm,brcmstb-ddr-shimphy-v1.0";
+ reg = <0xf1188000 0xe4>;
+ };
+
+ memc-ddr@f1182000 {
+ reg = <0xf1182000 0x800>;
+ compatible = "brcm,brcmstb-memc-ddr";
+ };
+ };
+
+ memc@2 {
+ compatible = "brcm,brcmstb-memc", "simple-bus";
+ ranges;
+
+ ddr-phy@f1206000 {
+ compatible = "brcm,brcmstb-ddr-phy-v240.1";
+ reg = <0xf1206000 0x21c>;
+ };
+
+ shimphy@f1208000 {
+ compatible = "brcm,brcmstb-ddr-shimphy-v1.0";
+ reg = <0xf1208000 0xe4>;
+ };
+
+ memc-ddr@f1202000 {
+ reg = <0xf1202000 0x800>;
+ compatible = "brcm,brcmstb-memc-ddr";
+ };
+ };
+};
--
1.9.1
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 2/7] Documentation: dt: brcmstb: add waketimer documentation
2015-06-19 0:11 [PATCH 0/7] soc: brcmstb: add system suspend support for STB SoCs Brian Norris
2015-06-19 0:11 ` [PATCH 1/7] Documentation: dt: brcmstb: add system PM bindings Brian Norris
@ 2015-06-19 0:11 ` Brian Norris
[not found] ` <1434672696-13632-3-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-09-12 19:58 ` Florian Fainelli
2015-06-19 0:11 ` [PATCH 3/7] soc: add stubs for brcmstb SoC's Brian Norris
` (6 subsequent siblings)
8 siblings, 2 replies; 27+ messages in thread
From: Brian Norris @ 2015-06-19 0:11 UTC (permalink / raw)
To: Brian Norris, Gregory Fong, Florian Fainelli
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
linux-kernel, devicetree, linux-arm-kernel,
bcm-kernel-feedback-list
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
.../bindings/soc/brcmstb/brcm,brcmstb-waketimer.txt | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 Documentation/devicetree/bindings/soc/brcmstb/brcm,brcmstb-waketimer.txt
diff --git a/Documentation/devicetree/bindings/soc/brcmstb/brcm,brcmstb-waketimer.txt b/Documentation/devicetree/bindings/soc/brcmstb/brcm,brcmstb-waketimer.txt
new file mode 100644
index 000000000000..68c4329b6af0
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/brcmstb/brcm,brcmstb-waketimer.txt
@@ -0,0 +1,20 @@
+* Broadcom STB Wake-up Timer
+
+The Broadcom STB wake-up timer provides a high-resolution timer, with the
+ability to wake up the system from low-power suspend/standby modes.
+
+Required properties:
+- compatible : should contain "brcm,brcmstb-waketimer"
+- reg : the register start and length for the WKTMR block
+- interrupts : The TIMER interrupt
+- interrupt-parent: The phandle to the Always-On (AON) Power Management (PM) L2
+ interrupt controller node
+
+Example:
+
+waketimer@f0411580 {
+ compatible = "brcm,brcmstb-waketimer";
+ reg = <0xf0411580 0x14>;
+ interrupts = <0x3>;
+ interrupt-parent = <&aon_pm_l2_intc>;
+};
--
1.9.1
^ permalink raw reply related [flat|nested] 27+ messages in thread
[parent not found: <1434672696-13632-3-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 2/7] Documentation: dt: brcmstb: add waketimer documentation
[not found] ` <1434672696-13632-3-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-06-19 2:09 ` Gregory Fong
0 siblings, 0 replies; 27+ messages in thread
From: Gregory Fong @ 2015-06-19 2:09 UTC (permalink / raw)
To: Brian Norris
Cc: Florian Fainelli, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
bcm-kernel-feedback-list
On Thu, Jun 18, 2015 at 5:11 PM, Brian Norris
<computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Signed-off-by: Brian Norris <computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Acked-by: Gregory Fong <gregory.0xf0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 2/7] Documentation: dt: brcmstb: add waketimer documentation
2015-06-19 0:11 ` [PATCH 2/7] Documentation: dt: brcmstb: add waketimer documentation Brian Norris
[not found] ` <1434672696-13632-3-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-09-12 19:58 ` Florian Fainelli
1 sibling, 0 replies; 27+ messages in thread
From: Florian Fainelli @ 2015-09-12 19:58 UTC (permalink / raw)
To: Brian Norris, Gregory Fong
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
linux-kernel, devicetree, linux-arm-kernel,
bcm-kernel-feedback-list
Le 06/18/15 17:11, Brian Norris a écrit :
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Although the binding looks good to me, I am not applying this one just
yet since we would want to merge the wake-timer driver and its binding
at the same time, thanks!
> ---
> .../bindings/soc/brcmstb/brcm,brcmstb-waketimer.txt | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/soc/brcmstb/brcm,brcmstb-waketimer.txt
>
> diff --git a/Documentation/devicetree/bindings/soc/brcmstb/brcm,brcmstb-waketimer.txt b/Documentation/devicetree/bindings/soc/brcmstb/brcm,brcmstb-waketimer.txt
> new file mode 100644
> index 000000000000..68c4329b6af0
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/brcmstb/brcm,brcmstb-waketimer.txt
> @@ -0,0 +1,20 @@
> +* Broadcom STB Wake-up Timer
> +
> +The Broadcom STB wake-up timer provides a high-resolution timer, with the
> +ability to wake up the system from low-power suspend/standby modes.
> +
> +Required properties:
> +- compatible : should contain "brcm,brcmstb-waketimer"
> +- reg : the register start and length for the WKTMR block
> +- interrupts : The TIMER interrupt
> +- interrupt-parent: The phandle to the Always-On (AON) Power Management (PM) L2
> + interrupt controller node
> +
> +Example:
> +
> +waketimer@f0411580 {
> + compatible = "brcm,brcmstb-waketimer";
> + reg = <0xf0411580 0x14>;
> + interrupts = <0x3>;
> + interrupt-parent = <&aon_pm_l2_intc>;
> +};
>
--
Florian
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 3/7] soc: add stubs for brcmstb SoC's
2015-06-19 0:11 [PATCH 0/7] soc: brcmstb: add system suspend support for STB SoCs Brian Norris
2015-06-19 0:11 ` [PATCH 1/7] Documentation: dt: brcmstb: add system PM bindings Brian Norris
2015-06-19 0:11 ` [PATCH 2/7] Documentation: dt: brcmstb: add waketimer documentation Brian Norris
@ 2015-06-19 0:11 ` Brian Norris
[not found] ` <1434672696-13632-4-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-19 0:11 ` [PATCH 4/7] soc: brcmstb: add PM suspend/resume support (S2/S3/S5) Brian Norris
` (5 subsequent siblings)
8 siblings, 1 reply; 27+ messages in thread
From: Brian Norris @ 2015-06-19 0:11 UTC (permalink / raw)
To: Brian Norris, Gregory Fong, Florian Fainelli
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
linux-kernel, devicetree, linux-arm-kernel,
bcm-kernel-feedback-list
Used on BCM7xxx Set-Top Box chips (e.g., BCM7445).
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
arch/arm/mach-bcm/Kconfig | 1 +
drivers/soc/Kconfig | 1 +
drivers/soc/Makefile | 1 +
drivers/soc/brcmstb/Kconfig | 9 +++++++++
drivers/soc/brcmstb/Makefile | 1 +
drivers/soc/brcmstb/common.c | 33 +++++++++++++++++++++++++++++++++
include/soc/brcmstb/common.h | 15 +++++++++++++++
7 files changed, 61 insertions(+)
create mode 100644 drivers/soc/brcmstb/Kconfig
create mode 100644 drivers/soc/brcmstb/Makefile
create mode 100644 drivers/soc/brcmstb/common.c
create mode 100644 include/soc/brcmstb/common.h
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index e9184feffc4e..11cf1c97093f 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -146,6 +146,7 @@ config ARCH_BRCMSTB
select BRCMSTB_L2_IRQ
select BCM7120_L2_IRQ
select ARCH_WANT_OPTIONAL_GPIOLIB
+ select SOC_BRCMSTB
help
Say Y if you intend to run the kernel on a Broadcom ARM-based STB
chipset.
diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
index 96ddecb92254..c9c0fcce98a7 100644
--- a/drivers/soc/Kconfig
+++ b/drivers/soc/Kconfig
@@ -1,5 +1,6 @@
menu "SOC (System On Chip) specific Drivers"
+source "drivers/soc/brcmstb/Kconfig"
source "drivers/soc/mediatek/Kconfig"
source "drivers/soc/qcom/Kconfig"
source "drivers/soc/sunxi/Kconfig"
diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
index 7dc7c0d8a2c1..2706b1159e32 100644
--- a/drivers/soc/Makefile
+++ b/drivers/soc/Makefile
@@ -2,6 +2,7 @@
# Makefile for the Linux Kernel SOC specific device drivers.
#
+obj-$(CONFIG_SOC_BRCMSTB) += brcmstb/
obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/
obj-$(CONFIG_ARCH_QCOM) += qcom/
obj-$(CONFIG_ARCH_SUNXI) += sunxi/
diff --git a/drivers/soc/brcmstb/Kconfig b/drivers/soc/brcmstb/Kconfig
new file mode 100644
index 000000000000..39cab3bd544d
--- /dev/null
+++ b/drivers/soc/brcmstb/Kconfig
@@ -0,0 +1,9 @@
+menuconfig SOC_BRCMSTB
+ bool "Broadcom STB SoC drivers"
+ depends on ARM
+ help
+ Enables drivers for the Broadcom Set-Top Box (STB) series of chips.
+ This option alone enables only some support code, while the drivers
+ can be enabled individually within this menu.
+
+ If unsure, say N.
diff --git a/drivers/soc/brcmstb/Makefile b/drivers/soc/brcmstb/Makefile
new file mode 100644
index 000000000000..183280e39f80
--- /dev/null
+++ b/drivers/soc/brcmstb/Makefile
@@ -0,0 +1 @@
+obj-y += common.o
diff --git a/drivers/soc/brcmstb/common.c b/drivers/soc/brcmstb/common.c
new file mode 100644
index 000000000000..c262c029b1b8
--- /dev/null
+++ b/drivers/soc/brcmstb/common.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright © 2014 NVIDIA Corporation
+ * Copyright © 2015 Broadcom Corporation
+ *
+ * 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.
+ */
+
+#include <linux/of.h>
+
+#include <soc/brcmstb/common.h>
+
+static const struct of_device_id brcmstb_machine_match[] = {
+ { .compatible = "brcm,brcmstb", },
+ { }
+};
+
+bool soc_is_brcmstb(void)
+{
+ struct device_node *root;
+
+ root = of_find_node_by_path("/");
+ if (!root)
+ return false;
+
+ return of_match_node(brcmstb_machine_match, root) != NULL;
+}
diff --git a/include/soc/brcmstb/common.h b/include/soc/brcmstb/common.h
new file mode 100644
index 000000000000..cfb5335f2a15
--- /dev/null
+++ b/include/soc/brcmstb/common.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright © 2014 NVIDIA Corporation
+ * Copyright © 2015 Broadcom Corporation
+ *
+ * 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.
+ */
+
+#ifndef __SOC_BRCMSTB_COMMON_H__
+#define __SOC_BRCMSTB_COMMON_H__
+
+bool soc_is_brcmstb(void);
+
+#endif /* __SOC_BRCMSTB_COMMON_H__ */
--
1.9.1
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 4/7] soc: brcmstb: add PM suspend/resume support (S2/S3/S5)
2015-06-19 0:11 [PATCH 0/7] soc: brcmstb: add system suspend support for STB SoCs Brian Norris
` (2 preceding siblings ...)
2015-06-19 0:11 ` [PATCH 3/7] soc: add stubs for brcmstb SoC's Brian Norris
@ 2015-06-19 0:11 ` Brian Norris
[not found] ` <1434672696-13632-5-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-19 0:11 ` [PATCH 5/7] soc: brcmstb: add wake-timer driver Brian Norris
` (4 subsequent siblings)
8 siblings, 1 reply; 27+ messages in thread
From: Brian Norris @ 2015-06-19 0:11 UTC (permalink / raw)
To: Brian Norris, Gregory Fong, Florian Fainelli
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
linux-kernel, devicetree, linux-arm-kernel,
bcm-kernel-feedback-list
Support S2, S3, and S5 through /sys/power/state ("standby" and "mem")
and the poweroff code paths. See comments in pm.c for a few more details
about these system suspend modes.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/soc/brcmstb/Kconfig | 10 +
drivers/soc/brcmstb/Makefile | 2 +
drivers/soc/brcmstb/pm/Makefile | 1 +
drivers/soc/brcmstb/pm/aon_defs.h | 85 +++++++
drivers/soc/brcmstb/pm/pm.c | 512 ++++++++++++++++++++++++++++++++++++++
drivers/soc/brcmstb/pm/pm.h | 40 +++
drivers/soc/brcmstb/pm/s2.S | 73 ++++++
7 files changed, 723 insertions(+)
create mode 100644 drivers/soc/brcmstb/pm/Makefile
create mode 100644 drivers/soc/brcmstb/pm/aon_defs.h
create mode 100644 drivers/soc/brcmstb/pm/pm.c
create mode 100644 drivers/soc/brcmstb/pm/pm.h
create mode 100644 drivers/soc/brcmstb/pm/s2.S
diff --git a/drivers/soc/brcmstb/Kconfig b/drivers/soc/brcmstb/Kconfig
index 39cab3bd544d..5025dacce6f0 100644
--- a/drivers/soc/brcmstb/Kconfig
+++ b/drivers/soc/brcmstb/Kconfig
@@ -7,3 +7,13 @@ menuconfig SOC_BRCMSTB
can be enabled individually within this menu.
If unsure, say N.
+
+if SOC_BRCMSTB
+
+config BRCMSTB_PM
+ bool "Support suspend/resume for STB platforms"
+ default y
+ depends on PM
+ depends on ARM && ARCH_BRCMSTB
+
+endif # SOC_BRCMSTB
diff --git a/drivers/soc/brcmstb/Makefile b/drivers/soc/brcmstb/Makefile
index 183280e39f80..677e3fa0d042 100644
--- a/drivers/soc/brcmstb/Makefile
+++ b/drivers/soc/brcmstb/Makefile
@@ -1 +1,3 @@
+obj-$(CONFIG_BRCMSTB_PM) += pm/
+
obj-y += common.o
diff --git a/drivers/soc/brcmstb/pm/Makefile b/drivers/soc/brcmstb/pm/Makefile
new file mode 100644
index 000000000000..71a1ff4c368b
--- /dev/null
+++ b/drivers/soc/brcmstb/pm/Makefile
@@ -0,0 +1 @@
+obj-y += pm.o s2.o
diff --git a/drivers/soc/brcmstb/pm/aon_defs.h b/drivers/soc/brcmstb/pm/aon_defs.h
new file mode 100644
index 000000000000..2b660fa788e4
--- /dev/null
+++ b/drivers/soc/brcmstb/pm/aon_defs.h
@@ -0,0 +1,85 @@
+/*
+ * Always ON (AON) register interface between bootloader and Linux
+ *
+ * Copyright © 2014-2015 Broadcom Corporation
+ *
+ * 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.
+ */
+
+#ifndef __BRCMSTB_AON_DEFS_H__
+#define __BRCMSTB_AON_DEFS_H__
+
+#include <linux/compiler.h>
+
+/* Magic number in upper 16-bits */
+#define BRCMSTB_S3_MAGIC_MASK 0xffff0000
+#define BRCMSTB_S3_MAGIC_SHORT 0x5AFE0000
+
+enum {
+ /* Restore random key for AES memory verification (off = fixed key) */
+ S3_FLAG_LOAD_RANDKEY = (1 << 0),
+
+ /* Scratch buffer page table is present */
+ S3_FLAG_SCRATCH_BUFFER_TABLE = (1 << 1),
+
+ /* Skip all memory verification */
+ S3_FLAG_NO_MEM_VERIFY = (1 << 2),
+};
+
+#define BRCMSTB_HASH_LEN (128 / 8) /* 128-bit hash */
+
+#define AON_REG_MAGIC_FLAGS 0x00
+#define AON_REG_CONTROL_LOW 0x04
+#define AON_REG_CONTROL_HIGH 0x08
+#define AON_REG_S3_HASH 0x0c /* hash of S3 params */
+#define AON_REG_CONTROL_HASH_LEN 0x1c
+
+#define BRCMSTB_S3_MAGIC 0x5AFEB007
+#define BOOTLOADER_SCRATCH_SIZE 64
+#define IMAGE_DESCRIPTORS_BUFSIZE (2 * 1024)
+
+/*
+ * Bootloader utilizes a custom parameter block left in DRAM for handling S3
+ * warm resume
+ */
+struct brcmstb_s3_params {
+ /* scratch memory for bootloader */
+ uint8_t scratch[BOOTLOADER_SCRATCH_SIZE];
+
+ uint32_t magic; /* BRCMSTB_S3_MAGIC */
+ uint64_t reentry; /* PA */
+
+ /* descriptors */
+ uint32_t hash[BRCMSTB_HASH_LEN / 4];
+
+ /*
+ * If 0, then ignore this parameter (there is only one set of
+ * descriptors)
+ *
+ * If non-0, then a second set of descriptors is stored at:
+ *
+ * descriptors + desc_offset_2
+ *
+ * The MAC result of both descriptors is XOR'd and stored in @hash
+ */
+ uint32_t desc_offset_2;
+
+ /*
+ * (Physical) address of a brcmstb_bootloader_scratch_table, for
+ * providing a large DRAM buffer to the bootloader
+ */
+ uint64_t buffer_table;
+
+ uint32_t spare[70];
+
+ uint8_t descriptors[IMAGE_DESCRIPTORS_BUFSIZE];
+} __packed;
+
+#endif /* __BRCMSTB_AON_DEFS_H__ */
diff --git a/drivers/soc/brcmstb/pm/pm.c b/drivers/soc/brcmstb/pm/pm.c
new file mode 100644
index 000000000000..04f0528d5322
--- /dev/null
+++ b/drivers/soc/brcmstb/pm/pm.c
@@ -0,0 +1,512 @@
+/*
+ * ARM-specific support for Broadcom STB S2/S3/S5 power management
+ *
+ * S2: clock gate CPUs and as many peripherals as possible
+ * S3: power off all of the chip except the Always ON (AON) island; keep DDR is
+ * self-refresh
+ * S5: (a.k.a. S3 cold boot) much like S3, except DDR is powered down, so we
+ * treat this mode like a soft power-off, with wakeup allowed from AON
+ *
+ * Copyright © 2014-2015 Broadcom Corporation
+ *
+ * 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.
+ */
+
+#define pr_fmt(fmt) "brcmstb-pm: " fmt
+
+#include <linux/kernel.h>
+#include <linux/printk.h>
+#include <linux/io.h>
+#include <linux/ioport.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/suspend.h>
+#include <linux/err.h>
+#include <linux/delay.h>
+#include <linux/compiler.h>
+#include <linux/pm.h>
+#include <linux/bitops.h>
+#include <linux/dma-mapping.h>
+#include <linux/sizes.h>
+#include <linux/slab.h>
+#include <linux/kconfig.h>
+#include <asm/fncpy.h>
+#include <asm/suspend.h>
+#include <asm/setup.h>
+
+#include <soc/brcmstb/common.h>
+
+#include "pm.h"
+#include "aon_defs.h"
+
+#define BRCMSTB_DDR_PHY_PLL_STATUS 0x04
+
+#define SHIMPHY_DDR_PAD_CNTRL 0x8c
+#define SHIMPHY_PAD_PLL_SEQUENCE BIT(8)
+#define SHIMPHY_PAD_GATE_PLL_S3 BIT(9)
+
+#define MAX_NUM_MEMC 3
+
+/* Capped for performance reasons */
+#define MAX_HASH_SIZE SZ_256M
+/* Max per bank, to keep some fairness */
+#define MAX_HASH_SIZE_BANK SZ_64M
+
+struct brcmstb_memc {
+ void __iomem *ddr_phy_base;
+ void __iomem *ddr_shimphy_base;
+};
+
+struct brcmstb_pm_control {
+ void __iomem *aon_ctrl_base;
+ void __iomem *aon_sram;
+ struct brcmstb_memc memcs[MAX_NUM_MEMC];
+
+ void __iomem *boot_sram;
+ size_t boot_sram_len;
+
+ bool support_warm_boot;
+ int num_memc;
+
+ struct brcmstb_s3_params *s3_params;
+ dma_addr_t s3_params_pa;
+};
+
+enum bsp_initiate_command {
+ BSP_CLOCK_STOP = 0x00,
+ BSP_GEN_RANDOM_KEY = 0x4A,
+ BSP_RESTORE_RANDOM_KEY = 0x55,
+ BSP_GEN_FIXED_KEY = 0x63,
+};
+
+#define PM_INITIATE 0x01
+#define PM_INITIATE_SUCCESS 0x00
+#define PM_INITIATE_FAIL 0xfe
+
+static struct brcmstb_pm_control ctrl;
+
+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);
+
+static int (*brcmstb_pm_do_s2_sram)(void __iomem *aon_ctrl_base,
+ void __iomem *ddr_phy_pll_status);
+
+static int brcmstb_init_sram(struct device_node *dn)
+{
+ void __iomem *sram;
+ struct resource res;
+ int ret;
+
+ ret = of_address_to_resource(dn, 0, &res);
+ if (ret)
+ return ret;
+
+ /* Cached, executable remapping of SRAM */
+ sram = __arm_ioremap_exec(res.start, resource_size(&res), true);
+ if (!sram)
+ return -ENOMEM;
+
+ ctrl.boot_sram = sram;
+ ctrl.boot_sram_len = resource_size(&res);
+
+ return 0;
+}
+
+/*
+ * Latch into the BRCM SRAM compatible property here to be more specific than
+ * the standard "mmio-sram". Could be supported with genalloc too, but that
+ * would be overkill for its current single use-case.
+ */
+static const struct of_device_id sram_dt_ids[] = {
+ { .compatible = "brcm,boot-sram" },
+ {}
+};
+
+static int do_bsp_initiate_command(enum bsp_initiate_command cmd)
+{
+ void __iomem *base = ctrl.aon_ctrl_base;
+ int ret;
+ int timeo = 1000 * 1000; /* 1 second */
+
+ __raw_writel(0, base + AON_CTRL_PM_INITIATE);
+ (void)__raw_readl(base + AON_CTRL_PM_INITIATE);
+
+ /* Go! */
+ __raw_writel((cmd << 1) | PM_INITIATE, base + AON_CTRL_PM_INITIATE);
+
+ for (;;) {
+ ret = __raw_readl(base + AON_CTRL_PM_INITIATE);
+ if (!(ret & PM_INITIATE))
+ break;
+ if (timeo <= 0) {
+ pr_err("error: timeout waiting for BSP (%x)\n", ret);
+ break;
+ }
+ timeo -= 50;
+ udelay(50);
+ }
+
+ return (ret & 0xff) != PM_INITIATE_SUCCESS;
+}
+
+static int brcmstb_pm_handshake(void)
+{
+ void __iomem *base = ctrl.aon_ctrl_base;
+ u32 tmp;
+ int ret;
+
+ /* BSP power handshake, v1 */
+ tmp = __raw_readl(base + AON_CTRL_HOST_MISC_CMDS);
+ tmp &= ~1UL;
+ __raw_writel(tmp, base + AON_CTRL_HOST_MISC_CMDS);
+ (void)__raw_readl(base + AON_CTRL_HOST_MISC_CMDS);
+
+ ret = do_bsp_initiate_command(BSP_CLOCK_STOP);
+ if (ret)
+ pr_err("BSP handshake failed\n");
+
+ /*
+ * HACK: BSP may have internal race on the CLOCK_STOP command.
+ * Avoid touching the BSP for a few milliseconds.
+ */
+ mdelay(3);
+
+ return ret;
+}
+
+/*
+ * Run a Power Management State Machine (PMSM) shutdown command and put the CPU
+ * into a low-power mode
+ */
+static void brcmstb_do_pmsm_power_down(unsigned long base_cmd)
+{
+ void __iomem *base = ctrl.aon_ctrl_base;
+
+ /* pm_start_pwrdn transition 0->1 */
+ __raw_writel(base_cmd, base + AON_CTRL_PM_CTRL);
+ (void)__raw_readl(base + AON_CTRL_PM_CTRL);
+
+ __raw_writel(base_cmd | PM_PWR_DOWN, base + AON_CTRL_PM_CTRL);
+ (void)__raw_readl(base + AON_CTRL_PM_CTRL);
+
+ wfi();
+}
+
+/* Support S5 cold boot out of "poweroff" */
+static void brcmstb_pm_poweroff(void)
+{
+ brcmstb_pm_handshake();
+
+ /* Clear magic S3 warm-boot value */
+ __raw_writel(0, ctrl.aon_sram + AON_REG_MAGIC_FLAGS);
+ (void)__raw_readl(ctrl.aon_sram + AON_REG_MAGIC_FLAGS);
+
+ /* Skip wait-for-interrupt signal; just use a countdown */
+ __raw_writel(0x10, ctrl.aon_ctrl_base + AON_CTRL_PM_CPU_WAIT_COUNT);
+ (void)__raw_readl(ctrl.aon_ctrl_base + AON_CTRL_PM_CPU_WAIT_COUNT);
+
+ brcmstb_do_pmsm_power_down(PM_COLD_CONFIG);
+}
+
+static void *brcmstb_pm_copy_to_sram(void *fn, size_t len)
+{
+ unsigned int size = ALIGN(len, FNCPY_ALIGN);
+
+ if (ctrl.boot_sram_len < size) {
+ pr_err("standby code will not fit in SRAM\n");
+ return NULL;
+ }
+
+ return fncpy(ctrl.boot_sram, fn, size);
+}
+
+/*
+ * S2 suspend/resume picks up where we left off, so we must execute carefully
+ * from SRAM, in order to allow DDR to come back up safely before we continue.
+ */
+static int brcmstb_pm_s2(void)
+{
+ brcmstb_pm_do_s2_sram = brcmstb_pm_copy_to_sram(&brcmstb_pm_do_s2,
+ brcmstb_pm_do_s2_sz);
+ if (!brcmstb_pm_do_s2_sram)
+ return -EINVAL;
+
+ return brcmstb_pm_do_s2_sram(ctrl.aon_ctrl_base,
+ ctrl.memcs[0].ddr_phy_base +
+ BRCMSTB_DDR_PHY_PLL_STATUS);
+}
+
+static int brcmstb_pm_s3_finish(void)
+{
+ struct brcmstb_s3_params *params = ctrl.s3_params;
+ phys_addr_t params_pa = ctrl.s3_params_pa;
+ phys_addr_t reentry = virt_to_phys(&cpu_resume);
+ u32 flags = S3_FLAG_NO_MEM_VERIFY;
+ int i;
+
+ /* Clear parameter structure */
+ memset(params, 0, sizeof(*params));
+
+ params->magic = BRCMSTB_S3_MAGIC;
+ params->reentry = reentry;
+
+ flush_cache_all();
+
+ flags |= BRCMSTB_S3_MAGIC_SHORT;
+
+ __raw_writel(flags, ctrl.aon_sram + AON_REG_MAGIC_FLAGS);
+ __raw_writel(lower_32_bits(params_pa),
+ ctrl.aon_sram + AON_REG_CONTROL_LOW);
+ __raw_writel(upper_32_bits(params_pa),
+ ctrl.aon_sram + AON_REG_CONTROL_HIGH);
+
+ /* gate PLL | S3 */
+ for (i = 0; i < ctrl.num_memc; i++) {
+ u32 tmp;
+ tmp = __raw_readl(ctrl.memcs[i].ddr_shimphy_base +
+ SHIMPHY_DDR_PAD_CNTRL);
+ tmp |= SHIMPHY_PAD_GATE_PLL_S3 | SHIMPHY_PAD_PLL_SEQUENCE;
+ __raw_writel(tmp, ctrl.memcs[i].ddr_shimphy_base +
+ SHIMPHY_DDR_PAD_CNTRL);
+ }
+
+ brcmstb_do_pmsm_power_down(PM_WARM_CONFIG);
+
+ /* Must have been interrupted from wfi()? */
+ return -EINTR;
+}
+
+/*
+ * S3 mode resume to the bootloader before jumping back to Linux, so we can be
+ * a little less careful about running from DRAM.
+ */
+static int brcmstb_pm_do_s3(unsigned long sp)
+{
+ int ret;
+
+ /* should not return */
+ ret = brcmstb_pm_s3_finish();
+
+ pr_err("Could not enter S3\n");
+
+ return ret;
+}
+
+static int brcmstb_pm_s3(void)
+{
+ void __iomem *sp = ctrl.boot_sram + ctrl.boot_sram_len - 8;
+
+ return cpu_suspend((unsigned long)sp, brcmstb_pm_do_s3);
+}
+
+static int brcmstb_pm_standby(bool deep_standby)
+{
+ int ret;
+
+ if (brcmstb_pm_handshake())
+ return -EIO;
+
+ if (deep_standby)
+ ret = brcmstb_pm_s3();
+ else
+ ret = brcmstb_pm_s2();
+ if (ret)
+ pr_err("%s: standby failed\n", __func__);
+
+ return ret;
+}
+
+static int brcmstb_pm_enter(suspend_state_t state)
+{
+ int ret = -EINVAL;
+
+ switch (state) {
+ case PM_SUSPEND_STANDBY:
+ ret = brcmstb_pm_standby(false);
+ break;
+ case PM_SUSPEND_MEM:
+ ret = brcmstb_pm_standby(true);
+ break;
+ }
+
+ return ret;
+}
+
+static int brcmstb_pm_valid(suspend_state_t state)
+{
+ switch (state) {
+ case PM_SUSPEND_STANDBY:
+ return true;
+ case PM_SUSPEND_MEM:
+ return ctrl.support_warm_boot;
+ default:
+ return false;
+ }
+}
+
+static const struct platform_suspend_ops brcmstb_pm_ops = {
+ .enter = brcmstb_pm_enter,
+ .valid = brcmstb_pm_valid,
+};
+
+static const struct of_device_id aon_ctrl_dt_ids[] = {
+ { .compatible = "brcm,brcmstb-aon-ctrl" },
+ {}
+};
+
+struct ddr_phy_ofdata {
+ bool supports_warm_boot;
+};
+
+static struct ddr_phy_ofdata ddr_phy_225_1 = { .supports_warm_boot = false, };
+static struct ddr_phy_ofdata ddr_phy_240_1 = { .supports_warm_boot = true, };
+
+static const struct of_device_id ddr_phy_dt_ids[] = {
+ {
+ .compatible = "brcm,brcmstb-ddr-phy-v225.1",
+ .data = &ddr_phy_225_1,
+ },
+ {
+ .compatible = "brcm,brcmstb-ddr-phy-v240.1",
+ .data = &ddr_phy_240_1,
+ },
+ {
+ /* Same as v240.1, for the registers we care about */
+ .compatible = "brcm,brcmstb-ddr-phy-v240.2",
+ .data = &ddr_phy_240_1,
+ },
+ {}
+};
+
+static const struct of_device_id ddr_shimphy_dt_ids[] = {
+ { .compatible = "brcm,brcmstb-ddr-shimphy-v1.0" },
+ {}
+};
+
+static inline void __iomem *brcmstb_ioremap_node(struct device_node *dn,
+ int index)
+{
+ return of_io_request_and_map(dn, index, dn->full_name);
+}
+
+static void __iomem *brcmstb_ioremap_match(const struct of_device_id *matches,
+ int index, const void **ofdata)
+{
+ struct device_node *dn;
+ const struct of_device_id *match;
+
+ dn = of_find_matching_node_and_match(NULL, matches, &match);
+ if (!dn)
+ return ERR_PTR(-EINVAL);
+
+ if (ofdata)
+ *ofdata = match->data;
+
+ return brcmstb_ioremap_node(dn, index);
+}
+
+static int brcmstb_pm_init(void)
+{
+ struct device_node *dn;
+ void __iomem *base;
+ int ret, i;
+ const struct ddr_phy_ofdata *ddr_phy_data;
+
+ if (!soc_is_brcmstb())
+ return 0;
+
+ /* AON ctrl registers */
+ base = brcmstb_ioremap_match(aon_ctrl_dt_ids, 0, NULL);
+ if (IS_ERR(base)) {
+ pr_err("error mapping AON_CTRL\n");
+ return PTR_ERR(base);
+ }
+ ctrl.aon_ctrl_base = base;
+
+ /* AON SRAM registers */
+ base = brcmstb_ioremap_match(aon_ctrl_dt_ids, 1, NULL);
+ if (IS_ERR(base)) {
+ /* Assume standard offset */
+ ctrl.aon_sram = ctrl.aon_ctrl_base +
+ AON_CTRL_SYSTEM_DATA_RAM_OFS;
+ } else {
+ ctrl.aon_sram = base;
+ }
+
+ /* DDR PHY registers */
+ base = brcmstb_ioremap_match(ddr_phy_dt_ids, 0,
+ (const void **)&ddr_phy_data);
+ if (IS_ERR(base)) {
+ pr_err("error mapping DDR PHY\n");
+ return PTR_ERR(base);
+ }
+ ctrl.support_warm_boot = ddr_phy_data->supports_warm_boot;
+ /* Only need DDR PHY 0 for now? */
+ ctrl.memcs[0].ddr_phy_base = base;
+
+ /* DDR SHIM-PHY registers */
+ for_each_matching_node(dn, ddr_shimphy_dt_ids) {
+ i = ctrl.num_memc;
+ if (i >= MAX_NUM_MEMC) {
+ pr_warn("too many MEMCs (max %d)\n", MAX_NUM_MEMC);
+ break;
+ }
+ base = brcmstb_ioremap_node(dn, 0);
+ if (IS_ERR(base)) {
+ if (!ctrl.support_warm_boot)
+ break;
+
+ pr_err("error mapping DDR SHIMPHY %d\n", i);
+ return PTR_ERR(base);
+ }
+ ctrl.memcs[i].ddr_shimphy_base = base;
+ ctrl.num_memc++;
+ }
+
+ dn = of_find_matching_node(NULL, sram_dt_ids);
+ if (!dn) {
+ pr_err("SRAM not found\n");
+ return -EINVAL;
+ }
+
+ ret = brcmstb_init_sram(dn);
+ if (ret) {
+ pr_err("error setting up SRAM for PM\n");
+ return ret;
+ }
+
+ ctrl.s3_params = kmalloc(sizeof(*ctrl.s3_params), GFP_KERNEL);
+ if (!ctrl.s3_params)
+ return -ENOMEM;
+ ctrl.s3_params_pa = dma_map_single(NULL, ctrl.s3_params,
+ sizeof(*ctrl.s3_params),
+ DMA_TO_DEVICE);
+ if (dma_mapping_error(NULL, ctrl.s3_params_pa)) {
+ pr_err("error mapping DMA memory\n");
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ pm_power_off = brcmstb_pm_poweroff;
+ suspend_set_ops(&brcmstb_pm_ops);
+ return 0;
+
+out:
+ kfree(ctrl.s3_params);
+
+ pr_warn("PM: initialization failed with code %d\n", ret);
+
+ return ret;
+}
+
+arch_initcall(brcmstb_pm_init);
diff --git a/drivers/soc/brcmstb/pm/pm.h b/drivers/soc/brcmstb/pm/pm.h
new file mode 100644
index 000000000000..fadab6dc424a
--- /dev/null
+++ b/drivers/soc/brcmstb/pm/pm.h
@@ -0,0 +1,40 @@
+/*
+ * Definitions for Broadcom STB power management / Always ON (AON) block
+ *
+ * Copyright © 2014 Broadcom Corporation
+ *
+ * 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.
+ */
+
+#ifndef __BRCMSTB_PM_H__
+#define __BRCMSTB_PM_H__
+
+#define AON_CTRL_RESET_CTRL 0x00
+#define AON_CTRL_PM_CTRL 0x04
+#define AON_CTRL_PM_STATUS 0x08
+#define AON_CTRL_PM_CPU_WAIT_COUNT 0x10
+#define AON_CTRL_PM_INITIATE 0x88
+#define AON_CTRL_HOST_MISC_CMDS 0x8c
+#define AON_CTRL_SYSTEM_DATA_RAM_OFS 0x200
+
+/* PM_CTRL bitfield */
+#define PM_FAST_PWRDOWN (1 << 6)
+#define PM_WARM_BOOT (1 << 5)
+#define PM_DEEP_STANDBY (1 << 4)
+#define PM_CPU_PWR (1 << 3)
+#define PM_USE_CPU_RDY (1 << 2)
+#define PM_PLL_PWRDOWN (1 << 1)
+#define PM_PWR_DOWN (1 << 0)
+
+#define PM_S2_COMMAND (PM_PLL_PWRDOWN | PM_USE_CPU_RDY | PM_PWR_DOWN)
+#define PM_COLD_CONFIG (PM_PLL_PWRDOWN | PM_DEEP_STANDBY)
+#define PM_WARM_CONFIG (PM_COLD_CONFIG | PM_USE_CPU_RDY | PM_WARM_BOOT)
+
+#endif /* __BRCMSTB_PM_H__ */
diff --git a/drivers/soc/brcmstb/pm/s2.S b/drivers/soc/brcmstb/pm/s2.S
new file mode 100644
index 000000000000..704c4ecb6f6f
--- /dev/null
+++ b/drivers/soc/brcmstb/pm/s2.S
@@ -0,0 +1,73 @@
+/*
+ * Copyright © 2014 Broadcom Corporation
+ *
+ * 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.
+ */
+
+#include <linux/linkage.h>
+#include <asm/assembler.h>
+
+#include "pm.h"
+
+ .text
+ .align 3
+
+#define AON_CTRL_REG r10
+#define DDR_PHY_STATUS_REG r11
+
+/*
+ * r0: AON_CTRL base address
+ * r1: DDRY PHY PLL status register address
+ */
+ENTRY(brcmstb_pm_do_s2)
+ stmfd sp!, {r4-r11, lr}
+ mov AON_CTRL_REG, r0
+ mov DDR_PHY_STATUS_REG, r1
+
+ /* Flush memory transactions */
+ dsb
+
+ /* power down request */
+ ldr r0, =PM_S2_COMMAND
+ ldr r1, =0
+ str r1, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
+ ldr r1, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
+ str r0, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
+ ldr r0, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
+
+ /* Wait for interrupt */
+ wfi
+ nop
+
+ /* Bring MEMC back up */
+1: ldr r0, [DDR_PHY_STATUS_REG]
+ ands r0, #1
+ beq 1b
+
+ /* Power-up handshake */
+ ldr r0, =1
+ str r0, [AON_CTRL_REG, #AON_CTRL_HOST_MISC_CMDS]
+ ldr r0, [AON_CTRL_REG, #AON_CTRL_HOST_MISC_CMDS]
+
+ ldr r0, =0
+ str r0, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
+ ldr r0, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
+
+ /* Return to caller */
+ ldr r0, =0
+ ldmfd sp!, {r4-r11, pc}
+
+ ENDPROC(brcmstb_pm_do_s2)
+
+ /* Place literal pool here */
+ .ltorg
+
+ENTRY(brcmstb_pm_do_s2_sz)
+ .word . - brcmstb_pm_do_s2
--
1.9.1
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 5/7] soc: brcmstb: add wake-timer driver
2015-06-19 0:11 [PATCH 0/7] soc: brcmstb: add system suspend support for STB SoCs Brian Norris
` (3 preceding siblings ...)
2015-06-19 0:11 ` [PATCH 4/7] soc: brcmstb: add PM suspend/resume support (S2/S3/S5) Brian Norris
@ 2015-06-19 0:11 ` Brian Norris
[not found] ` <1434672696-13632-6-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-19 0:11 ` [PATCH 6/7] ARM: brcmstb: mask GIC IRQs on suspend Brian Norris
` (3 subsequent siblings)
8 siblings, 1 reply; 27+ messages in thread
From: Brian Norris @ 2015-06-19 0:11 UTC (permalink / raw)
To: Brian Norris, Gregory Fong, Florian Fainelli
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
linux-kernel, devicetree, linux-arm-kernel,
bcm-kernel-feedback-list
Useful for waking the system from suspend after a specified period of
time.
This IP could potentially be supported as an RTC driver (for use with
the 'rtcwake' utility), but it is not battery backed, so that's not a
great fit. Implement a custom sysfs interface instead.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
.../ABI/testing/sysfs-driver-wktmr-brcmstb | 12 +
drivers/soc/brcmstb/Kconfig | 3 +
drivers/soc/brcmstb/Makefile | 1 +
drivers/soc/brcmstb/wktmr.c | 242 +++++++++++++++++++++
4 files changed, 258 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-driver-wktmr-brcmstb
create mode 100644 drivers/soc/brcmstb/wktmr.c
diff --git a/Documentation/ABI/testing/sysfs-driver-wktmr-brcmstb b/Documentation/ABI/testing/sysfs-driver-wktmr-brcmstb
new file mode 100644
index 000000000000..e563f8b8d969
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-driver-wktmr-brcmstb
@@ -0,0 +1,12 @@
+What: /sys/bus/platform/drivers/brcm-waketimer/<MMIO-address>.waketimer/timeout
+Date: November 21, 2014
+KernelVersion: 3.14
+Contact: Brian Norris <norris@broadcom.com>
+Description: The control file for the wakeup timer. This integer value
+ represents the number of seconds between a suspend operation
+ (e.g., S3 suspend-to-RAM) and the time at which the wakeup
+ timer should fire.
+
+ Values are -1 (default) or any non-negative integer. Units are
+ in seconds. The special value of -1 means the timer should not
+ wake up the system.
diff --git a/drivers/soc/brcmstb/Kconfig b/drivers/soc/brcmstb/Kconfig
index 5025dacce6f0..e818eca7e847 100644
--- a/drivers/soc/brcmstb/Kconfig
+++ b/drivers/soc/brcmstb/Kconfig
@@ -16,4 +16,7 @@ config BRCMSTB_PM
depends on PM
depends on ARM && ARCH_BRCMSTB
+config BRCMSTB_WKTMR
+ tristate "Support wake-up timer"
+
endif # SOC_BRCMSTB
diff --git a/drivers/soc/brcmstb/Makefile b/drivers/soc/brcmstb/Makefile
index 677e3fa0d042..6ecba0644229 100644
--- a/drivers/soc/brcmstb/Makefile
+++ b/drivers/soc/brcmstb/Makefile
@@ -1,3 +1,4 @@
obj-$(CONFIG_BRCMSTB_PM) += pm/
obj-y += common.o
+obj-$(CONFIG_BRCMSTB_WKTMR) += wktmr.o
diff --git a/drivers/soc/brcmstb/wktmr.c b/drivers/soc/brcmstb/wktmr.c
new file mode 100644
index 000000000000..89f989724d3c
--- /dev/null
+++ b/drivers/soc/brcmstb/wktmr.c
@@ -0,0 +1,242 @@
+/*
+ * Copyright © 2014-2015 Broadcom Corporation
+ *
+ * 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.
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/stat.h>
+#include <linux/device.h>
+#include <linux/platform_device.h>
+#include <linux/suspend.h>
+#include <linux/err.h>
+#include <linux/of.h>
+#include <linux/pm.h>
+#include <linux/io.h>
+#include <linux/interrupt.h>
+#include <linux/irqreturn.h>
+#include <linux/pm_wakeup.h>
+#include <linux/reboot.h>
+
+#define DRV_NAME "brcm-waketimer"
+
+struct brcmstb_waketmr {
+ struct device *dev;
+ void __iomem *base;
+ unsigned int irq;
+
+ int wake_timeout;
+ struct notifier_block reboot_notifier;
+};
+
+/* No timeout */
+#define BRCMSTB_WKTMR_DEFAULT_TIMEOUT (-1)
+
+#define BRCMSTB_WKTMR_EVENT 0x00
+#define BRCMSTB_WKTMR_COUNTER 0x04
+#define BRCMSTB_WKTMR_ALARM 0x08
+#define BRCMSTB_WKTMR_PRESCALER 0x0C
+#define BRCMSTB_WKTMR_PRESACALER_VAL 0x10
+
+static inline void brcmstb_waketmr_clear_alarm(struct brcmstb_waketmr *timer)
+{
+ writel_relaxed(1, timer->base + BRCMSTB_WKTMR_EVENT);
+ (void)readl_relaxed(timer->base + BRCMSTB_WKTMR_EVENT);
+}
+
+static void brcmstb_waketmr_set_alarm(struct brcmstb_waketmr *timer,
+ unsigned int secs)
+{
+ unsigned int t;
+
+ brcmstb_waketmr_clear_alarm(timer);
+
+ t = readl_relaxed(timer->base + BRCMSTB_WKTMR_COUNTER);
+ writel_relaxed(t + secs + 1, timer->base + BRCMSTB_WKTMR_ALARM);
+}
+
+static irqreturn_t brcmstb_waketmr_irq(int irq, void *data)
+{
+ struct brcmstb_waketmr *timer = data;
+ pm_wakeup_event(timer->dev, 0);
+ return IRQ_HANDLED;
+}
+
+static ssize_t brcmstb_waketmr_timeout_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct brcmstb_waketmr *timer = dev_get_drvdata(dev);
+
+ return snprintf(buf, PAGE_SIZE, "%d\n", timer->wake_timeout);
+}
+
+static ssize_t brcmstb_waketmr_timeout_store(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct brcmstb_waketmr *timer = dev_get_drvdata(dev);
+ int timeout;
+ int ret;
+
+ ret = kstrtoint(buf, 0, &timeout);
+ if (ret < 0)
+ return ret;
+
+ /* Allow -1 as "no timeout" */
+ if (timeout < -1)
+ return -EINVAL;
+
+ timer->wake_timeout = timeout;
+
+ return count;
+}
+
+static const DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR,
+ brcmstb_waketmr_timeout_show,
+ brcmstb_waketmr_timeout_store);
+
+static int brcmstb_waketmr_prepare_suspend(struct brcmstb_waketmr *timer)
+{
+ struct device *dev = timer->dev;
+ int ret;
+
+ if (device_may_wakeup(dev) && timer->wake_timeout >= 0) {
+ ret = enable_irq_wake(timer->irq);
+ if (ret) {
+ dev_err(dev, "failed to enable wake-up interrupt\n");
+ return ret;
+ }
+
+ brcmstb_waketmr_set_alarm(timer, timer->wake_timeout);
+ }
+ return 0;
+}
+
+/* If enabled as a wakeup-source, arm the timer when powering off */
+static int brcmstb_waketmr_reboot(struct notifier_block *nb,
+ unsigned long action, void *data)
+{
+ struct brcmstb_waketmr *timer;
+ timer = container_of(nb, struct brcmstb_waketmr, reboot_notifier);
+
+ /* Set timer for cold boot */
+ if (action == SYS_POWER_OFF)
+ brcmstb_waketmr_prepare_suspend(timer);
+
+ return NOTIFY_DONE;
+}
+
+static int brcmstb_waketmr_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct brcmstb_waketmr *timer;
+ struct resource *res;
+ int ret;
+
+ timer = devm_kzalloc(dev, sizeof(*timer), GFP_KERNEL);
+ if (!timer)
+ return -ENOMEM;
+ platform_set_drvdata(pdev, timer);
+
+ timer->dev = dev;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ timer->base = devm_ioremap_resource(dev, res);
+ if (IS_ERR(timer->base))
+ return PTR_ERR(timer->base);
+
+ /*
+ * Set wakeup capability before requesting wakeup interrupt, so we can
+ * process boot-time "wakeups" (e.g., from S5 soft-off)
+ */
+ device_set_wakeup_capable(dev, true);
+ device_wakeup_enable(dev);
+
+ timer->irq = platform_get_irq(pdev, 0);
+ if ((int)timer->irq < 0)
+ return -ENODEV;
+
+ ret = devm_request_irq(dev, timer->irq, brcmstb_waketmr_irq, 0,
+ DRV_NAME, timer);
+ if (ret < 0)
+ return ret;
+
+ timer->reboot_notifier.notifier_call = brcmstb_waketmr_reboot;
+ register_reboot_notifier(&timer->reboot_notifier);
+
+ timer->wake_timeout = BRCMSTB_WKTMR_DEFAULT_TIMEOUT;
+
+ ret = device_create_file(dev, &dev_attr_timeout);
+ if (ret)
+ unregister_reboot_notifier(&timer->reboot_notifier);
+ else
+ dev_info(dev, "registered, with irq %d\n", timer->irq);
+ return ret;
+}
+
+static int brcmstb_waketmr_remove(struct platform_device *pdev)
+{
+ struct brcmstb_waketmr *timer = dev_get_drvdata(&pdev->dev);
+
+ device_remove_file(&pdev->dev, &dev_attr_timeout);
+ unregister_reboot_notifier(&timer->reboot_notifier);
+
+ return 0;
+}
+
+#ifdef CONFIG_PM_SLEEP
+static int brcmstb_waketmr_suspend(struct device *dev)
+{
+ struct brcmstb_waketmr *timer = dev_get_drvdata(dev);
+
+ return brcmstb_waketmr_prepare_suspend(timer);
+}
+
+static int brcmstb_waketmr_resume(struct device *dev)
+{
+ struct brcmstb_waketmr *timer = dev_get_drvdata(dev);
+ int ret;
+
+ if (!device_may_wakeup(dev) || timer->wake_timeout < 0)
+ return 0;
+
+ ret = disable_irq_wake(timer->irq);
+
+ brcmstb_waketmr_clear_alarm(timer);
+
+ return ret;
+}
+#endif /* CONFIG_PM_SLEEP */
+
+static SIMPLE_DEV_PM_OPS(brcmstb_waketmr_pm_ops, brcmstb_waketmr_suspend,
+ brcmstb_waketmr_resume);
+
+static const struct of_device_id brcmstb_waketmr_of_match[] = {
+ { .compatible = "brcm,brcmstb-waketimer" },
+ {},
+};
+
+static struct platform_driver brcmstb_waketmr_driver = {
+ .probe = brcmstb_waketmr_probe,
+ .remove = brcmstb_waketmr_remove,
+ .driver = {
+ .name = DRV_NAME,
+ .pm = &brcmstb_waketmr_pm_ops,
+ .of_match_table = of_match_ptr(brcmstb_waketmr_of_match),
+ }
+};
+module_platform_driver(brcmstb_waketmr_driver);
+
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Brian Norris");
+MODULE_DESCRIPTION("Wake-up timer driver for STB chips");
--
1.9.1
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 6/7] ARM: brcmstb: mask GIC IRQs on suspend
2015-06-19 0:11 [PATCH 0/7] soc: brcmstb: add system suspend support for STB SoCs Brian Norris
` (4 preceding siblings ...)
2015-06-19 0:11 ` [PATCH 5/7] soc: brcmstb: add wake-timer driver Brian Norris
@ 2015-06-19 0:11 ` Brian Norris
2015-06-19 1:48 ` Gregory Fong
[not found] ` <1434672696-13632-7-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-19 0:11 ` [PATCH 7/7] ARM: dts: brcmstb: add BCM7445 system PM DT nodes Brian Norris
` (2 subsequent siblings)
8 siblings, 2 replies; 27+ messages in thread
From: Brian Norris @ 2015-06-19 0:11 UTC (permalink / raw)
To: Brian Norris, Gregory Fong, Florian Fainelli
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
linux-kernel, devicetree, linux-arm-kernel,
bcm-kernel-feedback-list
Lazily-masked IRQs can cause system suspend problems (e.g., spurious
wakeups from WFI), so we need to be sure non-wakeup GIC interrupts get
masked, not just disabled, during system suspend.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
arch/arm/mach-bcm/brcmstb.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm/mach-bcm/brcmstb.c b/arch/arm/mach-bcm/brcmstb.c
index 3a60f7ee3f0c..8d9ec9d01306 100644
--- a/arch/arm/mach-bcm/brcmstb.c
+++ b/arch/arm/mach-bcm/brcmstb.c
@@ -12,11 +12,20 @@
*/
#include <linux/init.h>
+#include <linux/irq.h>
+#include <linux/irqchip.h>
+#include <linux/irqchip/arm-gic.h>
#include <linux/of_platform.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
+static void __init brcmstb_init_irq(void)
+{
+ gic_set_irqchip_flags(IRQCHIP_MASK_ON_SUSPEND);
+ irqchip_init();
+}
+
static const char *const brcmstb_match[] __initconst = {
"brcm,bcm7445",
"brcm,brcmstb",
@@ -25,4 +34,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
--
1.9.1
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH 6/7] ARM: brcmstb: mask GIC IRQs on suspend
2015-06-19 0:11 ` [PATCH 6/7] ARM: brcmstb: mask GIC IRQs on suspend Brian Norris
@ 2015-06-19 1:48 ` Gregory Fong
[not found] ` <1434672696-13632-7-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
1 sibling, 0 replies; 27+ messages in thread
From: Gregory Fong @ 2015-06-19 1:48 UTC (permalink / raw)
To: Brian Norris
Cc: Florian Fainelli, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
bcm-kernel-feedback-list
On Thu, Jun 18, 2015 at 5:11 PM, Brian Norris
<computersforpeace@gmail.com> wrote:
> Lazily-masked IRQs can cause system suspend problems (e.g., spurious
> wakeups from WFI), so we need to be sure non-wakeup GIC interrupts get
> masked, not just disabled, during system suspend.
>
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Gregory Fong <gregory.0xf0@gmail.com>
^ permalink raw reply [flat|nested] 27+ messages in thread
[parent not found: <1434672696-13632-7-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 6/7] ARM: brcmstb: mask GIC IRQs on suspend
[not found] ` <1434672696-13632-7-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-09-12 19:53 ` Florian Fainelli
[not found] ` <55F482BC.4050202-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 27+ messages in thread
From: Florian Fainelli @ 2015-09-12 19:53 UTC (permalink / raw)
To: Brian Norris, Gregory Fong
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w
Le 06/18/15 17:11, Brian Norris a écrit :
> Lazily-masked IRQs can cause system suspend problems (e.g., spurious
> wakeups from WFI), so we need to be sure non-wakeup GIC interrupts get
> masked, not just disabled, during system suspend.
>
> Signed-off-by: Brian Norris <computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Dropped this patch, no longer needed as of 4.3-rc0 with
aec89ef72ba6c94420f599dcb684ed66937cdacf ("irqchip/gic: Enable
SKIP_SET_WAKE and MASK_ON_SUSPEND")
--
Florian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 7/7] ARM: dts: brcmstb: add BCM7445 system PM DT nodes
2015-06-19 0:11 [PATCH 0/7] soc: brcmstb: add system suspend support for STB SoCs Brian Norris
` (5 preceding siblings ...)
2015-06-19 0:11 ` [PATCH 6/7] ARM: brcmstb: mask GIC IRQs on suspend Brian Norris
@ 2015-06-19 0:11 ` Brian Norris
[not found] ` <1434672696-13632-8-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
[not found] ` <1434672696-13632-1-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-22 19:47 ` Brian Norris
8 siblings, 1 reply; 27+ messages in thread
From: Brian Norris @ 2015-06-19 0:11 UTC (permalink / raw)
To: Brian Norris, Gregory Fong, Florian Fainelli
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
linux-kernel, devicetree, linux-arm-kernel,
bcm-kernel-feedback-list
Need the aon_pm_l2_intc, aon-ctrl, waketimer, boot SRAM, and
memory_controller descriptions.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
arch/arm/boot/dts/bcm7445.dtsi | 102 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 102 insertions(+)
diff --git a/arch/arm/boot/dts/bcm7445.dtsi b/arch/arm/boot/dts/bcm7445.dtsi
index 58dcd666257c..5b1aeaf5ac40 100644
--- a/arch/arm/boot/dts/bcm7445.dtsi
+++ b/arch/arm/boot/dts/bcm7445.dtsi
@@ -119,6 +119,30 @@
interrupt-names = "hif";
};
+ aon_pm_l2_intc: interrupt-controller@410640 {
+ compatible = "brcm,l2-intc";
+ reg = <0x410640 0x30>;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ interrupts = <GIC_SPI 0x40 0x0>;
+ interrupt-parent = <&gic>;
+ brcm,irq-can-wake;
+ };
+
+ aon-ctrl@410000 {
+ compatible = "brcm,brcmstb-aon-ctrl";
+ reg = <0x410000 0x200>, <0x410200 0x400>;
+ reg-names = "aon-ctrl", "aon-sram";
+ };
+
+ waketimer@f0417580 {
+ compatible = "brcm,brcmstb-waketimer";
+ reg = <0x417580 0x14>;
+ interrupt-parent = <&aon_pm_l2_intc>;
+ interrupts = <3>;
+ interrupt-names = "timer";
+ };
+
nand: nand@3e2800 {
status = "disabled";
#address-cells = <1>;
@@ -169,6 +193,84 @@
};
};
+ memory_controllers {
+ compatible = "simple-bus";
+ ranges = <0x0 0x0 0xf1100000 0x200000>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ memc@0 {
+ compatible = "brcm,brcmstb-memc", "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges = <0x0 0x0 0x80000>;
+
+ memc-ddr@2000 {
+ compatible = "brcm,brcmstb-memc-ddr";
+ reg = <0x2000 0x800>;
+ };
+
+ ddr-phy@6000 {
+ compatible = "brcm,brcmstb-ddr-phy-v240.1";
+ reg = <0x6000 0x21c>;
+ };
+
+ shimphy@8000 {
+ compatible = "brcm,brcmstb-ddr-shimphy-v1.0";
+ reg = <0x8000 0xe4>;
+ };
+ };
+
+ memc@1 {
+ compatible = "brcm,brcmstb-memc", "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges = <0x0 0x80000 0x80000>;
+
+ memc-ddr@2000 {
+ compatible = "brcm,brcmstb-memc-ddr";
+ reg = <0x2000 0x800>;
+ };
+
+ ddr-phy@6000 {
+ compatible = "brcm,brcmstb-ddr-phy-v240.1";
+ reg = <0x6000 0x21c>;
+ };
+
+ shimphy@8000 {
+ compatible = "brcm,brcmstb-ddr-shimphy-v1.0";
+ reg = <0x8000 0xe4>;
+ };
+ };
+
+ memc@2 {
+ compatible = "brcm,brcmstb-memc", "simple-bus";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges = <0x0 0x100000 0x80000>;
+
+ memc-ddr@2000 {
+ compatible = "brcm,brcmstb-memc-ddr";
+ reg = <0x2000 0x800>;
+ };
+
+ ddr-phy@6000 {
+ compatible = "brcm,brcmstb-ddr-phy-v240.1";
+ reg = <0x6000 0x21c>;
+ };
+
+ shimphy@8000 {
+ compatible = "brcm,brcmstb-ddr-shimphy-v1.0";
+ reg = <0x8000 0xe4>;
+ };
+ };
+ };
+
+ sram@ffe00000 {
+ compatible = "brcm,boot-sram", "mmio-sram";
+ reg = <0x0 0xffe00000 0x0 0x10000>;
+ };
+
smpboot {
compatible = "brcm,brcmstb-smpboot";
syscon-cpu = <&hif_cpubiuctrl 0x88 0x178>;
--
1.9.1
^ permalink raw reply related [flat|nested] 27+ messages in thread
[parent not found: <1434672696-13632-1-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 0/7] soc: brcmstb: add system suspend support for STB SoCs
[not found] ` <1434672696-13632-1-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-06-19 3:20 ` Gregory Fong
[not found] ` <CADtm3G7GQNuaZDoNe84YAh7pRV9s_2VhUuW8YpaCoNuozoyVZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 27+ messages in thread
From: Gregory Fong @ 2015-06-19 3:20 UTC (permalink / raw)
To: Brian Norris
Cc: Florian Fainelli, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
bcm-kernel-feedback-list
On Thu, Jun 18, 2015 at 5:11 PM, Brian Norris
<computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi,
>
> This patch set introduces system suspend/resume support for Broadcom STB SoCs.
> There are two suspend modes (S2 and S3) as well as a related low-power shutdown
> mode (S5).
>
> Along with the core PM support, include a driver for the wakeup-timer, which
> allows for simple testing of suspend/resume wakeup cycles.
>
> Brian
>
> Brian Norris (7):
> Documentation: dt: brcmstb: add system PM bindings
> Documentation: dt: brcmstb: add waketimer documentation
> soc: add stubs for brcmstb SoC's
> soc: brcmstb: add PM suspend/resume support (S2/S3/S5)
> soc: brcmstb: add wake-timer driver
> ARM: brcmstb: mask GIC IRQs on suspend
> ARM: dts: brcmstb: add BCM7445 system PM DT nodes
>
I tested this series two ways: with the device tree built into the
bootloader (BOLT) on BCM7445 and by using
arch/arm/boot/dts/bcm7445-bcm97445svmb.dtb
With the device tree from BOLT, everything works fine. Tested the
waketimer for S2, S3, and S5.
With the device tree in arch/arm/boot/dts/bcm7445-bcm97445svmb.dts, S2
works, but S3 and S5 do not. It comes back up but doesn't reach the
prompt:
[ 6.050808] PM: suspend of devices complete after 1.425 msecs
[ 6.051760] PM: late suspend of devices complete after 0.947 msecs
[ 6.052535] PM: noirq suspend of devices complete after 0.770 msecs
[ 6.052537] Disabling non-boot CPUs ...
[ 6.053005] CPU1: shutdown
[ 6.065914] CPU2: shutdown
[ 6.080756] CPU3: shutdown
[ 6.095214] Enabling non-boot CPUs ...
[ 6.111496] CPU1 is up
[ 6.126934] CPU2 is up
[ 6.142511] CPU3 is up
[ 6.145308] PM: noirq resume of devices complete after 2.772 msecs
[ 6.148022] PM: early resume of devices complete after 2.626 msecs
[ 6.151017] PM: resume of devices complete after 2.976 msecs
[ 6.212771] Restarting tasks ... done.
[[[ output stops here ]]]
I suspect there might be an issue somewhere in
[PATCH 7/7] ARM: dts: brcmstb: add BCM7445 system PM DT nodes.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 0/7] soc: brcmstb: add system suspend support for STB SoCs
2015-06-19 0:11 [PATCH 0/7] soc: brcmstb: add system suspend support for STB SoCs Brian Norris
` (7 preceding siblings ...)
[not found] ` <1434672696-13632-1-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-06-22 19:47 ` Brian Norris
2015-06-24 4:47 ` Florian Fainelli
8 siblings, 1 reply; 27+ messages in thread
From: Brian Norris @ 2015-06-22 19:47 UTC (permalink / raw)
To: Gregory Fong, Florian Fainelli
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
linux-kernel, devicetree, linux-arm-kernel,
bcm-kernel-feedback-list, linux-pm, Rafael J. Wysocki, Len Brown,
Pavel Machek
+ others
On Thu, Jun 18, 2015 at 05:11:29PM -0700, Brian Norris wrote:
> Hi,
>
> This patch set introduces system suspend/resume support for Broadcom STB SoCs.
> There are two suspend modes (S2 and S3) as well as a related low-power shutdown
> mode (S5).
>
> Along with the core PM support, include a driver for the wakeup-timer, which
> allows for simple testing of suspend/resume wakeup cycles.
>
> Brian
Somehow I completely missed out on sending this to a few of the right
places, like linux-pm and the PM maintainers. I guess I just trusted
get_maintainer.pl (which doesn't know what to do with drivers/soc/) too
much, and forgot to turn my brain on...
Anyway, if y'all can track down the patches via archives, feel free. Or
I will resend this shortly as a v2, with a few suggested fixes and with
a more complete CC list.
Regards,
Brian
> Brian Norris (7):
> Documentation: dt: brcmstb: add system PM bindings
> Documentation: dt: brcmstb: add waketimer documentation
> soc: add stubs for brcmstb SoC's
> soc: brcmstb: add PM suspend/resume support (S2/S3/S5)
> soc: brcmstb: add wake-timer driver
> ARM: brcmstb: mask GIC IRQs on suspend
> ARM: dts: brcmstb: add BCM7445 system PM DT nodes
>
> .../ABI/testing/sysfs-driver-wktmr-brcmstb | 12 +
> .../devicetree/bindings/arm/bcm/brcm,brcmstb.txt | 142 +++++-
> .../soc/brcmstb/brcm,brcmstb-waketimer.txt | 20 +
> arch/arm/boot/dts/bcm7445.dtsi | 102 ++++
> arch/arm/mach-bcm/Kconfig | 1 +
> arch/arm/mach-bcm/brcmstb.c | 10 +
> drivers/soc/Kconfig | 1 +
> drivers/soc/Makefile | 1 +
> drivers/soc/brcmstb/Kconfig | 22 +
> drivers/soc/brcmstb/Makefile | 4 +
> drivers/soc/brcmstb/common.c | 33 ++
> drivers/soc/brcmstb/pm/Makefile | 1 +
> drivers/soc/brcmstb/pm/aon_defs.h | 85 ++++
> drivers/soc/brcmstb/pm/pm.c | 512 +++++++++++++++++++++
> drivers/soc/brcmstb/pm/pm.h | 40 ++
> drivers/soc/brcmstb/pm/s2.S | 73 +++
> drivers/soc/brcmstb/wktmr.c | 242 ++++++++++
> include/soc/brcmstb/common.h | 15 +
> 18 files changed, 1314 insertions(+), 2 deletions(-)
> create mode 100644 Documentation/ABI/testing/sysfs-driver-wktmr-brcmstb
> create mode 100644 Documentation/devicetree/bindings/soc/brcmstb/brcm,brcmstb-waketimer.txt
> create mode 100644 drivers/soc/brcmstb/Kconfig
> create mode 100644 drivers/soc/brcmstb/Makefile
> create mode 100644 drivers/soc/brcmstb/common.c
> create mode 100644 drivers/soc/brcmstb/pm/Makefile
> create mode 100644 drivers/soc/brcmstb/pm/aon_defs.h
> create mode 100644 drivers/soc/brcmstb/pm/pm.c
> create mode 100644 drivers/soc/brcmstb/pm/pm.h
> create mode 100644 drivers/soc/brcmstb/pm/s2.S
> create mode 100644 drivers/soc/brcmstb/wktmr.c
> create mode 100644 include/soc/brcmstb/common.h
>
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 0/7] soc: brcmstb: add system suspend support for STB SoCs
2015-06-22 19:47 ` Brian Norris
@ 2015-06-24 4:47 ` Florian Fainelli
0 siblings, 0 replies; 27+ messages in thread
From: Florian Fainelli @ 2015-06-24 4:47 UTC (permalink / raw)
To: Brian Norris, Gregory Fong
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
linux-kernel, devicetree, linux-arm-kernel,
bcm-kernel-feedback-list, linux-pm, Rafael J. Wysocki, Len Brown,
Pavel Machek
Le 06/22/15 12:47, Brian Norris a écrit :
> + others
>
> On Thu, Jun 18, 2015 at 05:11:29PM -0700, Brian Norris wrote:
>> Hi,
>>
>> This patch set introduces system suspend/resume support for Broadcom STB SoCs.
>> There are two suspend modes (S2 and S3) as well as a related low-power shutdown
>> mode (S5).
>>
>> Along with the core PM support, include a driver for the wakeup-timer, which
>> allows for simple testing of suspend/resume wakeup cycles.
>>
>> Brian
>
> Somehow I completely missed out on sending this to a few of the right
> places, like linux-pm and the PM maintainers. I guess I just trusted
> get_maintainer.pl (which doesn't know what to do with drivers/soc/) too
> much, and forgot to turn my brain on...
>
> Anyway, if y'all can track down the patches via archives, feel free. Or
> I will resend this shortly as a v2, with a few suggested fixes and with
> a more complete CC list.
Works for me, thanks for getting this out:
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
I would like some comments on the Device Tree binding portion so I can
take these patches and submit them for our next Broadcom arm-soc pull
requests, thanks!
>
> Regards,
> Brian
>
>> Brian Norris (7):
>> Documentation: dt: brcmstb: add system PM bindings
>> Documentation: dt: brcmstb: add waketimer documentation
>> soc: add stubs for brcmstb SoC's
>> soc: brcmstb: add PM suspend/resume support (S2/S3/S5)
>> soc: brcmstb: add wake-timer driver
>> ARM: brcmstb: mask GIC IRQs on suspend
>> ARM: dts: brcmstb: add BCM7445 system PM DT nodes
>>
>> .../ABI/testing/sysfs-driver-wktmr-brcmstb | 12 +
>> .../devicetree/bindings/arm/bcm/brcm,brcmstb.txt | 142 +++++-
>> .../soc/brcmstb/brcm,brcmstb-waketimer.txt | 20 +
>> arch/arm/boot/dts/bcm7445.dtsi | 102 ++++
>> arch/arm/mach-bcm/Kconfig | 1 +
>> arch/arm/mach-bcm/brcmstb.c | 10 +
>> drivers/soc/Kconfig | 1 +
>> drivers/soc/Makefile | 1 +
>> drivers/soc/brcmstb/Kconfig | 22 +
>> drivers/soc/brcmstb/Makefile | 4 +
>> drivers/soc/brcmstb/common.c | 33 ++
>> drivers/soc/brcmstb/pm/Makefile | 1 +
>> drivers/soc/brcmstb/pm/aon_defs.h | 85 ++++
>> drivers/soc/brcmstb/pm/pm.c | 512 +++++++++++++++++++++
>> drivers/soc/brcmstb/pm/pm.h | 40 ++
>> drivers/soc/brcmstb/pm/s2.S | 73 +++
>> drivers/soc/brcmstb/wktmr.c | 242 ++++++++++
>> include/soc/brcmstb/common.h | 15 +
>> 18 files changed, 1314 insertions(+), 2 deletions(-)
>> create mode 100644 Documentation/ABI/testing/sysfs-driver-wktmr-brcmstb
>> create mode 100644 Documentation/devicetree/bindings/soc/brcmstb/brcm,brcmstb-waketimer.txt
>> create mode 100644 drivers/soc/brcmstb/Kconfig
>> create mode 100644 drivers/soc/brcmstb/Makefile
>> create mode 100644 drivers/soc/brcmstb/common.c
>> create mode 100644 drivers/soc/brcmstb/pm/Makefile
>> create mode 100644 drivers/soc/brcmstb/pm/aon_defs.h
>> create mode 100644 drivers/soc/brcmstb/pm/pm.c
>> create mode 100644 drivers/soc/brcmstb/pm/pm.h
>> create mode 100644 drivers/soc/brcmstb/pm/s2.S
>> create mode 100644 drivers/soc/brcmstb/wktmr.c
>> create mode 100644 include/soc/brcmstb/common.h
>>
>> --
>> 1.9.1
>>
--
Florian
^ permalink raw reply [flat|nested] 27+ messages in thread