Add Broadcom STB memory controller driver
v2 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 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 | 53 +++ drivers/memory/Kconfig | 9 + drivers/memory/Makefile | 1 + drivers/memory/brcmstb_memc.c | 302 ++++++++++++++++++ 6 files changed, 382 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
PATCH v2 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 | 53 +++++++++++++++++++ 2 files changed, 55 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
@@ -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 +53 -0
53 lines not on this page · raw message
Signature · 1 line
2.25.1
Rob Herring
maintainerRe: [PATCH v2 1/3] dt-bindings: memory-controller: Document Broadcom STB MEMC
Quoted 7 lines · Florian Fainelli
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.txtis removed and this binding is referenced instead.
Quoted 7 lines
Signed-off-by Florian Fainelli <[email protected]>--- .../bindings/arm/bcm/brcm,brcmstb.txt | 11 +--- .../brcm,brcmstb-memc-ddr.yaml | 53 +++++++++++++++++++ 2 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 Documentation/devicetree/bindings/memory-controllers/brcm,brcmstb-memc-ddr.yaml
Running 'make dtbs_check' with the schema in this patch gives the following warnings. Consider if they are expected or the schema is incorrect. These may not be new warnings.
Note that it is not yet a requirement to have 0 warnings for dtbs_check. This will change in the future.
Full log is available here: https://patchwork.ozlabs.org/patch/
memc-ddr@2000: 'clock-frequency' is a required property
arch/arm/boot/dts/bcm7445-bcm97445svmb.dtb arch/arm/boot/dts/bcm7445-bcm97445svmb.dtb arch/arm/boot/dts/bcm7445-bcm97445svmb.dtb
memc-ddr@2000: compatible:0: 'brcm,brcmstb-memc-ddr' is not one of ['brcm,brcmstb-memc-ddr-rev-b.1.x', 'brcm,brcmstb-memc-ddr-rev-b.2.0', '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.2.5', 'brcm,brcmstb-memc-ddr-rev-b.2.6', 'brcm,brcmstb-memc-ddr-rev-b.2.7', 'brcm,brcmstb-memc-ddr-rev-b.2.8', 'brcm,brcmstb-memc-ddr-rev-b.3.0', 'brcm,brcmstb-memc-ddr-rev-b.3.1', 'brcm,brcmstb-memc-ddr-rev-c.1.0', 'brcm,brcmstb-memc-ddr-rev-c.1.1', 'brcm,brcmstb-memc-ddr-rev-c.1.2', 'brcm,brcmstb-memc-ddr-rev-c.1.3', 'brcm,brcmstb-memc-ddr-rev-c.1.4']
arch/arm/boot/dts/bcm7445-bcm97445svmb.dtb arch/arm/boot/dts/bcm7445-bcm97445svmb.dtb arch/arm/boot/dts/bcm7445-bcm97445svmb.dtb
memc-ddr@2000: compatible: ['brcm,brcmstb-memc-ddr'] is too short
arch/arm/boot/dts/bcm7445-bcm97445svmb.dtb arch/arm/boot/dts/bcm7445-bcm97445svmb.dtb arch/arm/boot/dts/bcm7445-bcm97445svmb.dtb
Re: [PATCH v2 1/3] dt-bindings: memory-controller: Document Broadcom STB MEMC
In reply to Florian FainelliQuoted 7 lines · Florian Fainelli
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.txtis removed and this binding is referenced instead.
Quoted 7 lines
Signed-off-by Florian Fainelli <[email protected]>--- .../bindings/arm/bcm/brcm,brcmstb.txt | 11 +--- .../brcm,brcmstb-memc-ddr.yaml | 53 +++++++++++++++++++ 2 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 Documentation/devicetree/bindings/memory-controllers/brcm,brcmstb-memc-ddr.yaml
PATCH v2 2/3 Documentation: sysfs: Document Broadcom STB memc sysfs knobs
In reply to Florian FainelliDocument 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
@@ -0,0 +1,15 @@ +What: /sys/devices/platform/*/*/*/*/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/devices/platform/*/*/*/*/frequency +Date: July 2022 +KernelVersion: 5.21 +Contact: Florian Fainelli <[email protected]> +Description: + DDR PHY frequency in Hz.
Signature · 1 line
2.25.1
Re: [PATCH v2 2/3] Documentation: sysfs: Document Broadcom STB memc sysfs knobs
Quoted 15 lines · Florian Fainelli
Document the "srpd" and "frequency" sysfs attributes exposed by the
brcmstb_memcdriver.Signed-off-by Florian Fainelli <[email protected]>--- .../ABI/testing/sysfs-platform-brcmstb-memc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-platform-brcmstb-memcDocumentation/ABI/testing/sysfs-platform-brcmstb-memc new file +0
-0
Documentation/ABI/testing/sysfs-platform-brcmstb-memc line 1
Quoted 1 line
Documentation/ABI/testing/sysfs-platform-brcmstb-memc new file +1
-0@@ -0,0 +1,15 @@ +What: /sys/devices/platform/*/*/*/*/srpd
That's a lot of */. Are you sure it is correct path? Didn't you include here some driver-related path components? Can you paste in email full path as an example?
Documentation/ABI/testing/sysfs-platform-brcmstb-memc line 8
Quoted 7 lines
Documentation/ABI/testing/sysfs-platform-brcmstb-memc new file +7
-0+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).
Using hex suggests one should write there hex? If so, skip decimal... You describe the user interface, not hardware registers.
Documentation/ABI/testing/sysfs-platform-brcmstb-memc line 15
Quoted 7 lines
Documentation/ABI/testing/sysfs-platform-brcmstb-memc new file +7
-0+ +What: /sys/devices/platform/*/*/*/*/frequency +Date: July 2022 +KernelVersion: 5.21 +Contact: Florian Fainelli <[email protected]> +Description: + DDR PHY frequency in Hz.
Best regards,
Krzysztof
Re: [PATCH v2 2/3] Documentation: sysfs: Document Broadcom STB memc sysfs knobs
Quoted 10 lines · Krzysztof Kozlowski
Quoted 9 lines · Florian Fainelli
Document the "srpd" and "frequency" sysfs attributes exposed by the
brcmstb_memcdriver.Signed-off-by Florian Fainelli <[email protected]>--- .../ABI/testing/sysfs-platform-brcmstb-memc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-platform-brcmstb-memc
Quoted 11 lines
Documentation/ABI/testing/sysfs-platform-brcmstb-memc line 1
Quoted 7 lines
Documentation/ABI/testing/sysfs-platform-brcmstb-memc new file +1
-0@@ -0,0 +1,15 @@ +What: /sys/devices/platform/*/*/*/*/srpdThat's a lot of */. Are you sure it is correct path? Didn't you include here some driver-related path components? Can you paste in email full path as an example?
Yes this is the correct path:
/sys/devices/platform/rdb/rdb:memory_controllers/rdb:memory_controllers:memc@0/9902000.memc-ddr/
the 'rdb' node is our top level bus node, the 'rdb:memory_controllers' is an encapsulating node that groups all of the possible memory controllers in a system (there can be between 1 and 3), the rdb:memory_controllers@0 is the first of those memory controller and finally the 9902000.memc-ddr is the sub-node that contains the register controls of interest, since the memory controller aggregates different functions (arbitration, configuration, statistics, DDR PHY SHIM layer, etc.). Maybe I should provide a more complete binding while I am it.
Quoted 11 lines
Documentation/ABI/testing/sysfs-platform-brcmstb-memc line 8
Quoted 8 lines
Documentation/ABI/testing/sysfs-platform-brcmstb-memc new file +7
-0+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).Using hex suggests one should write there hex? If so, skip decimal... You describe the user interface, not hardware registers.
Fair enough.
Signature · 1 line
Florian
Re: [PATCH v2 2/3] Documentation: sysfs: Document Broadcom STB memc sysfs knobs
Quoted 23 lines · Florian Fainelli
Quoted 10 lines · Krzysztof Kozlowski
Quoted 9 lines · Florian Fainelli
Document the "srpd" and "frequency" sysfs attributes exposed by the
brcmstb_memcdriver.Signed-off-by Florian Fainelli <[email protected]>--- .../ABI/testing/sysfs-platform-brcmstb-memc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-platform-brcmstb-memcQuoted 11 lines
Documentation/ABI/testing/sysfs-platform-brcmstb-memc line 1
Quoted 7 lines
Documentation/ABI/testing/sysfs-platform-brcmstb-memc new file +1
-0@@ -0,0 +1,15 @@ +What: /sys/devices/platform/*/*/*/*/srpdThat's a lot of */. Are you sure it is correct path? Didn't you include here some driver-related path components? Can you paste in email full path as an example?
Quoted 5 lines
Yes this is the correct path:
/sys/devices/platform/rdb/rdb:memory_controllers/rdb:memory_controllers:memc@0/9902000.memc-ddr/
the 'rdb' node is our top level bus node, the 'rdb:memory_controllers' is an encapsulating node that groups all of the possible memory controllers in a system (there can be between 1 and 3), the rdb:memory_controllers@0 is the first of those memory controller and finally the 9902000.memc-ddr is the sub-node that contains the register controls of interest, since the memory controller aggregates different functions (arbitration, configuration, statistics, DDR PHY SHIM layer, etc.). Maybe I should provide a more complete binding while I am it.
The path should be much more specific so include at least:
rdb/rdb:memory_controllers/rdb:memory_controllers:memc@*/ (or some variations of it if pieces of name change)
However looking at the driver, this is regular platform driver, thus it will appear as:/sys/bus/platform/9902000.memc-ddr
Best regards,
Krzysztof
Florian Fainelli
maintainerRe: [PATCH v2 2/3] Documentation: sysfs: Document Broadcom STB memc sysfs knobs
Quoted 30 lines · Krzysztof Kozlowski
Quoted 23 lines · Florian Fainelli
Quoted 10 lines · Krzysztof Kozlowski
Quoted 9 lines · Florian Fainelli
Document the "srpd" and "frequency" sysfs attributes exposed by the
brcmstb_memcdriver.Signed-off-by Florian Fainelli <[email protected]>--- .../ABI/testing/sysfs-platform-brcmstb-memc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-platform-brcmstb-memcQuoted 11 lines
Documentation/ABI/testing/sysfs-platform-brcmstb-memc line 1
Quoted 7 lines
Documentation/ABI/testing/sysfs-platform-brcmstb-memc new file +1
-0@@ -0,0 +1,15 @@ +What: /sys/devices/platform/*/*/*/*/srpdThat's a lot of */. Are you sure it is correct path? Didn't you include here some driver-related path components? Can you paste in email full path as an example?
Quoted 5 lines
Yes this is the correct path:
/sys/devices/platform/rdb/rdb:memory_controllers/rdb:memory_controllers:memc@0/9902000.memc-ddr/
the 'rdb' node is our top level bus node, the 'rdb:memory_controllers' is an encapsulating node that groups all of the possible memory controllers in a system (there can be between 1 and 3), the rdb:memory_controllers@0 is the first of those memory controller and finally the 9902000.memc-ddr is the sub-node that contains the register controls of interest, since the memory controller aggregates different functions (arbitration, configuration, statistics, DDR PHY SHIM layer, etc.). Maybe I should provide a more complete binding while I am it.
Quoted 7 lines
The path should be much more specific so include at least:
rdb/rdb:memory_controllers/rdb:memory_controllers:memc@*/ (or some variations of it if pieces of name change)However looking at the driver, this is regular platform driver, thus it will appear as:
/sys/bus/platform/9902000.memc-ddr
There is a missing /devices in the path, but yet that will work too:
/sys/bus/platform/devices/9902000.memc-ddr
Thanks!
Signature · 1 line
Florian
PATCH v2 3/3 memory: Add Broadcom STB memory controller driver
In reply to Florian FainelliAdd 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 | 302 ++++++++++++++++++++++++++++++++++ 3 files changed, 312 insertions(+) create mode 100644 drivers/memory/brcmstb_memc.c
drivers/memory/Kconfig +9 -0
@@ -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
@@ -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 +302 -0
302 lines not on this page · raw message
Signature · 1 line
2.25.1