Skip to contentSkip to conversation

Add Broadcom STB memory controller driver

PATCH Applied Florian Fainelli 2 participants 5 messages Aug 12, 2022 – Aug 17, 2022

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

v5 cover Add Broadcom STB memory controller driver

Hi Krzysztof,

This small patch series adds basic support for controlling self-refresh power down on Broadcom STB memory controllers. We might be able to contribute more features to the memory controller driver in the future like accurate reporting of the memory type, timings, and possibly some performance counters.

Changes in v5:

- use DEFINE_SIMPLE_PM_OPS() to avoid keeping the __maybe_unused

Changes in v4:

- drop unnecessary owner assignment for the platform_driver
- use pm_ptr() as directed

Changes in v3:

- made 'frequency' property optional to avoid introducing warnings for existing BMIPS and BCM7445 DTS files
- updated sysfs document to use a shorter and universal path

Changes in v2:

- merged the v1 first two patches
- added a sysfs document describing attributes exposed
- addressed feedback from Krzysztof regarding style and API usage

Florian Fainelli (3):
dt-bindings: memory-controller: Document Broadcom STB MEMC
Documentation: sysfs: Document Broadcom STB memc sysfs knobs
memory: Add Broadcom STB memory controller driver

 .../ABI/testing/sysfs-platform-brcmstb-memc   |  15 +
 .../bindings/arm/bcm/brcm,brcmstb.txt         |  11 +-
 .../brcm,brcmstb-memc-ddr.yaml                |  52 +++
 drivers/memory/Kconfig                        |   9 +
 drivers/memory/Makefile                       |   1 +
 drivers/memory/brcmstb_memc.c                 | 301 ++++++++++++++++++
 6 files changed, 380 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-platform-brcmstb-memc
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/brcm,brcmstb-memc-ddr.yaml
 create mode 100644 drivers/memory/brcmstb_memc.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH v5 1/3 dt-bindings: memory-controller: Document Broadcom STB MEMC

Document the Broadcom STB memory controller which is a trivial binding for now with a set of compatible strings and single register.

Since we introduce this binding, the section in Documentation/devicetree/bindings/arm/bcm/brcm,brcmstb.txt is removed and this binding is referenced instead.

---
 .../bindings/arm/bcm/brcm,brcmstb.txt         | 11 +---
 .../brcm,brcmstb-memc-ddr.yaml                | 52 +++++++++++++++++++
 2 files changed, 54 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/brcm,brcmstb-memc-ddr.yaml
Documentation/devicetree/bindings/arm/bcm/brcm,brcmstb.txt +2 -9
index 104cc9b41df4..e797d2f69f3b 100644
@@ -187,15 +187,8 @@ Required properties:
 Sequencer DRAM parameters and control registers. Used for Self-Refresh
 Power-Down (SRPD), among other things.
 
-Required properties:
-- compatible     : should contain one of these
-	"brcm,brcmstb-memc-ddr-rev-b.2.1"
-	"brcm,brcmstb-memc-ddr-rev-b.2.2"
-	"brcm,brcmstb-memc-ddr-rev-b.2.3"
-	"brcm,brcmstb-memc-ddr-rev-b.3.0"
-	"brcm,brcmstb-memc-ddr-rev-b.3.1"
-	"brcm,brcmstb-memc-ddr"
-- reg            : the MEMC DDR register range
+See Documentation/devicetree/bindings/memory-controllers/brcm,memc.yaml for a
+full list of supported compatible strings and properties.
 
 Example:
 
Documentation/devicetree/bindings/memory-controllers/brcm,brcmstb-memc-ddr.yaml new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

PATCH v5 2/3 Documentation: sysfs: Document Broadcom STB memc sysfs knobs

In reply to Florian Fainelli

Document the "srpd" and "frequency" sysfs attributes exposed by the brcmstb_memc driver.

---
 .../ABI/testing/sysfs-platform-brcmstb-memc       | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-platform-brcmstb-memc
Documentation/ABI/testing/sysfs-platform-brcmstb-memc new file +15 -0
new file mode 100644
index 000000000000..2f2b750ac2fd
@@ -0,0 +1,15 @@
+What:		/sys/bus/platform/devices/*/srpd
+Date:		July 2022
+KernelVersion:	5.21
+Contact:	Florian Fainelli <[email protected]>
+Description:
+		Self Refresh Power Down (SRPD) inactivity timeout counted in
+		internal DDR controller clock cycles. Possible values range
+		from 0 (disable inactivity timeout) to 65535 (0xffff).
+
+What:		/sys/bus/platform/devices/*/frequency
+Date:		July 2022
+KernelVersion:	5.21
+Contact:	Florian Fainelli <[email protected]>
+Description:
+		DDR PHY frequency in Hz.
Signature · 1 line
2.25.1
#3 lore raw

PATCH v5 3/3 memory: Add Broadcom STB memory controller driver

In reply to Florian Fainelli

Add support for configuring the Self Refresh Power Down (SRPD) inactivity timeout on Broadcom STB chips. This is used to conserve power when the DRAM activity is reduced.

---
 drivers/memory/Kconfig        |   9 +
 drivers/memory/Makefile       |   1 +
 drivers/memory/brcmstb_memc.c | 301 ++++++++++++++++++++++++++++++++++
 3 files changed, 311 insertions(+)
 create mode 100644 drivers/memory/brcmstb_memc.c
drivers/memory/Kconfig +9 -0
index ac1a411648d8..fac290e48e0b 100644
@@ -66,6 +66,15 @@ config BRCMSTB_DPFE
 	  for the DRAM's temperature. Slower refresh rate means cooler RAM,
 	  higher refresh rate means hotter RAM.
 
+config BRCMSTB_MEMC
+	tristate "Broadcom STB MEMC driver"
+	default ARCH_BRCMSTB
+	depends on ARCH_BRCMSTB || COMPILE_TEST
+	help
+	  This driver provides a way to configure the Broadcom STB memory
+	  controller and specifically control the Self Refresh Power Down
+	  (SRPD) inactivity timeout.
+
 config BT1_L2_CTL
 	bool "Baikal-T1 CM2 L2-RAM Cache Control Block"
 	depends on MIPS_BAIKAL_T1 || COMPILE_TEST
drivers/memory/Makefile +1 -0
index bc7663ed1c25..e148f636c082 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_ARM_PL172_MPMC)	+= pl172.o
 obj-$(CONFIG_ATMEL_SDRAMC)	+= atmel-sdramc.o
 obj-$(CONFIG_ATMEL_EBI)		+= atmel-ebi.o
 obj-$(CONFIG_BRCMSTB_DPFE)	+= brcmstb_dpfe.o
+obj-$(CONFIG_BRCMSTB_MEMC)	+= brcmstb_memc.o
 obj-$(CONFIG_BT1_L2_CTL)	+= bt1-l2-ctl.o
 obj-$(CONFIG_TI_AEMIF)		+= ti-aemif.o
 obj-$(CONFIG_TI_EMIF)		+= emif.o
drivers/memory/brcmstb_memc.c new file +301 -0

301 lines not on this page · raw message

Signature · 1 line
2.25.1
#4 lore raw
In reply to Florian Fainelli
Quoted 9 lines · Florian Fainelli

This small patch series adds basic support for controlling self-refresh power down on Broadcom STB memory controllers. We might be able to contribute more features to the memory controller driver in the future like accurate reporting of the memory type, timings, and possibly some performance counters.

Changes in v5:

[...]

Applied, thanks!

[1/3] dt-bindings: memory-controller: Document Broadcom STB MEMC

      https://git.kernel.org/krzk/linux-mem-ctrl/c/0da0b6bf854dcfb047fec70bbbadabb7ff0fcb3e
[2/3] Documentation: sysfs: Document Broadcom STB memc sysfs knobs
      https://git.kernel.org/krzk/linux-mem-ctrl/c/df0269bb936430c2e5c45b158fbbe5a13728d53f
[3/3] memory: Add Broadcom STB memory controller driver
      https://git.kernel.org/krzk/linux-mem-ctrl/c/65991a63d02decf269e7d5334620df0dd5919762

Best regards,

Signature · 1 line
Krzysztof Kozlowski <[email protected]>