Broadcom STB AVS CPUfreq driver
Subsystems (4)
Markus Mayer
maintainerv3 cover Broadcom STB AVS CPUfreq driver
This series contains the CPUfreq driver for Broadcom SoCs that use "AVS Firmware" for voltage and frequency scaling. All voltage and frequency transitions are performed by the firmware and are therefore hidden from Linux.
The driver provides a standard CPUfreq interface to other kernel components and to userland on the one hand and communicates with the AVS co-processor on the other.
Communication between the two processors is via shared mailbox registers and interrupts (ARM -> AVS to tell the firmware that there is a command to process and AVS -> ARM to tell the driver that a command finished executing).
Changes from v2:
- removed file Documentation/cpu-freq/brcmstb-avs-cpufreq.txt, instead adding the text as comment in the driver itself
- wildcard match in MAINTAINERS file (drivers/cpufreq/brcmstb*)
- drivers/cpufreq/Kconfig.arm: have ARM_BRCMSTB_AVS_CPUFREQ default y for ARCH_BRCMSTB
- fixed naming and Kconfig entry for CONFIG_ARM_BRCMSTB_AVS_CPUFREQ_DEBUG
- reordered and fixed include files
- made sure driver name doesn't exceed size of cpufreq_driver.name
- got rid of device_node pointers in struct private_data; there's no need for them, as we can call of_node_put() in __map_region()
- don't set driver_data for CPUFREQ_TABLE_END
- have brcm_avs_cpufreq_get() read from the firmware rather than return policy->cur
- don't update policy->cur in brcm_avs_target_index()
- created new function brcm_avs_prepare_init() to handle compatibility checks during initialization and moved corresponding code from brcm_avs_cpufreq_init() to the new function
- brcm_avs_prepare_init() is called from brcm_avs_cpufreq_probe() and therefore will only be called once, even in the case of an error, whereas brcm_avs_cpufreq_init() is called for every core if there is an error
- renamed brcm_avs_cpu_(init|exit) to brcm_avs_cpufreq_(init|exit)
- added platform_set_drvdata(pdev, NULL) upon deregistration
- fixed various style complaints by checkpatch.pl --strict
- fixed other style issues
- updated and improved some comments
- added Viresh's Acks to patches 1/3 and 3/3
Changes from v1:
- renamed binding document
- rewrote the introduction of the binding document
- created a new driver documentation file that contains Linux specific information that was previously part of the binding document
- renamed the driver (and related config options) to include a reference to "STB", since this implementation is primarily intended for use on set-top boxes
- improved comments
- updated function __map_region()
- updated struct private_data
- added code to unmap memory regions in the error and exit paths
- added new sysfs property to report frequency directly from the co-processor register
Markus Mayer (3):
dt: cpufreq: brcm: New binding document for brcmstb-avs-cpufreq
cpufreq: brcmstb-avs-cpufreq: AVS CPUfreq driver for Broadcom STB SoCs
cpufreq: brcmstb-avs-cpufreq: add debugfs support
.../bindings/cpufreq/brcm,stb-avs-cpu-freq.txt | 76 ++ MAINTAINERS | 8 + drivers/cpufreq/Kconfig.arm | 21 + drivers/cpufreq/Makefile | 1 + drivers/cpufreq/brcmstb-avs-cpufreq.c | 1057 ++++++++++++++++++++ 5 files changed, 1163 insertions(+) create mode 100644 Documentation/devicetree/bindings/cpufreq/brcm,stb-avs-cpu-freq.txt create mode 100644 drivers/cpufreq/brcmstb-avs-cpufreq.c
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Markus Mayer
maintainerPATCH v3 1/3 dt: cpufreq: brcm: New binding document for brcmstb-avs-cpufreq
Add the binding document for the new brcmstb-avs-cpufreq driver.
--- .../bindings/cpufreq/brcm,stb-avs-cpu-freq.txt | 76 ++++++++++++++++++++++ MAINTAINERS | 7 ++ 2 files changed, 83 insertions(+) create mode 100644 Documentation/devicetree/bindings/cpufreq/brcm,stb-avs-cpu-freq.txt
Documentation/devicetree/bindings/cpufreq/brcm,stb-avs-cpu-freq.txt new file +76 -0
@@ -0,0 +1,76 @@ +Broadcom STB AVS CPUfreq driver bindings +======================================== + +A total of three DT nodes are required. One node (brcm,avs-cpu-data-mem) +references the mailbox register used to communicate with the AVS CPU[1]. The +second node (brcm,avs-cpu-l2-intr) is required to trigger an interrupt on +the AVS CPU. The interrupt tells the AVS CPU that it needs to process a +command sent to it by a driver. Interrupting the AVS CPU is mandatory for +commands to be processed. + +The interface also requires a reference to the AVS host interrupt controller, +so a driver can react to interrupts generated by the AVS CPU whenever a command +has been processed. See [2] for more information on the brcm,l2-intc node. + +[1] The AVS CPU is an independent co-processor that runs proprietary +firmware. On some SoCs, this firmware supports DFS and DVFS in addition to +Adaptive Voltage Scaling. + +[2] Documentation/devicetree/bindings/interrupt-controller/brcm,l2-intc.txt + + +Node brcm,avs-cpu-data-mem +-------------------------- + +Required properties: +- compatible: Sould be one of: brcm,avs-cpu-data-mem, + brcm,bcm7271-avs-cpu-data-mem or brcm,bcm7268-avs-cpu-data-mem +- reg: Specifies base physical address and size of the registers. +- interrupts: The interrupt that the AVS CPU will use to interrupt the host + when a command completed. +- interrupt-parent: The interrupt controller the above interrupt is routed + through. +- interrupt-names: The name of the interrupt used to interrupt the host. + +Optional properties: +- None + +Node brcm,avs-cpu-l2-intr +------------------------- + +Required properties: +- compatible: Sould be one of: brcm,avs-cpu-l2-intr, + brcm,bcm7271-avs-cpu-l2-intr or brcm,bcm7268-avs-cpu-l2-intr +- reg: Specifies base physical address and size of the registers. + +Optional properties: +- None + + +Example +======= + + avs_host_l2_intc: interrupt-controller@f04d1200 { + #interrupt-cells = <1>; + compatible = "brcm,l2-intc"; + interrupt-parent = <&intc>; + reg = <0xf04d1200 0x48>; + interrupt-controller; + interrupts = <0x0 0x19 0x0>; + interrupt-names = "avs"; + }; + + avs-cpu-data-mem@f04c4000 { + compatible = "brcm,bcm7271-avs-cpu-data-mem", + "brcm,avs-cpu-data-mem"; + reg = <0xf04c4000 0x60>; + interrupts = <0x1a>; + interrupt-parent = <&avs_host_l2_intc>; + interrupt-names = "sw_intr"; + }; + + avs-cpu-l2-intr@f04d1100 { + compatible = "brcm,bcm7271-avs-cpu-l2-intr", + "brcm,avs-cpu-l2-intr"; + reg = <0xf04d1100 0x10>; + };
MAINTAINERS +7 -0
@@ -2701,6 +2701,13 @@ L: bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/[email protected] S: Maintained F: drivers/mtd/nand/brcmnand/ +BROADCOM STB AVS CPUFREQ DRIVER +M: Markus Mayer <mmayer-dY08KVG/lbpWk0Htik3J/[email protected]> +M: bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/[email protected] +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/cpufreq/brcm,stb-avs-cpu-freq.txt + BROADCOM SPECIFIC AMBA DRIVER (BCMA) M: Rafał Miłecki <[email protected]> L: [email protected]
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Markus Mayer
maintainerPATCH v3 2/3 cpufreq: brcmstb-avs-cpufreq: AVS CPUfreq driver for Broadcom STB SoCs
In reply to Markus MayerThis driver supports voltage and frequency scaling on Broadcom STB SoCs using AVS firmware with DFS and DVFS support.
Actual frequency or voltage scaling is done exclusively by the AVS firmware. The driver merely provides a standard CPUfreq interface to other kernel components and userland, and instructs the AVS firmware to perform frequency or voltage changes on its behalf.
--- MAINTAINERS | 1 + drivers/cpufreq/Kconfig.arm | 11 + drivers/cpufreq/Makefile | 1 + drivers/cpufreq/brcmstb-avs-cpufreq.c | 737 ++++++++++++++++++++++++++++++++++ 4 files changed, 750 insertions(+) create mode 100644 drivers/cpufreq/brcmstb-avs-cpufreq.c
MAINTAINERS +1 -0
@@ -2707,6 +2707,7 @@ M: bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/[email protected] L: [email protected] S: Maintained F: Documentation/devicetree/bindings/cpufreq/brcm,stb-avs-cpu-freq.txt +F: drivers/cpufreq/brcmstb* BROADCOM SPECIFIC AMBA DRIVER (BCMA) M: Rafał Miłecki <[email protected]>
drivers/cpufreq/Kconfig.arm +11 -0
@@ -12,6 +12,17 @@ config ARM_BIG_LITTLE_CPUFREQ help This enables the Generic CPUfreq driver for ARM big.LITTLE platforms. +config ARM_BRCMSTB_AVS_CPUFREQ + tristate "Broadcom STB AVS CPUfreq driver" + depends on ARCH_BRCMSTB || COMPILE_TEST + default y + help + Some Broadcom STB SoCs use a co-processor running proprietary firmware + ("AVS") to handle voltage and frequency scaling. This driver provides + a standard CPUfreq interface to to the firmware. + + Say Y, if you have a Broadcom SoC with AVS support for DFS or DVFS. + config ARM_DT_BL_CPUFREQ tristate "Generic probing via DT for ARM big LITTLE CPUfreq driver" depends on ARM_BIG_LITTLE_CPUFREQ && OF
drivers/cpufreq/Makefile +1 -0
@@ -51,6 +51,7 @@ obj-$(CONFIG_ARM_BIG_LITTLE_CPUFREQ) += arm_big_little.o # LITTLE drivers, so that it is probed last. obj-$(CONFIG_ARM_DT_BL_CPUFREQ) += arm_big_little_dt.o +obj-$(CONFIG_ARM_BRCMSTB_AVS_CPUFREQ) += brcmstb-avs-cpufreq.o obj-$(CONFIG_ARCH_DAVINCI) += davinci-cpufreq.o obj-$(CONFIG_UX500_SOC_DB8500) += dbx500-cpufreq.o obj-$(CONFIG_ARM_EXYNOS5440_CPUFREQ) += exynos5440-cpufreq.o
drivers/cpufreq/brcmstb-avs-cpufreq.c new file +737 -0
737 lines not on this page · raw message
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Markus Mayer
maintainerPATCH v3 3/3 cpufreq: brcmstb-avs-cpufreq: add debugfs support
In reply to Markus MayerIn order to aid debugging, we add a debugfs interface to the driver that allows direct interaction with the AVS co-processor.
The debugfs interface provides a means for reading all and writing some of the mailbox registers directly from the shell prompt and enables a user to execute the communications protocol between ARM CPU and AVS CPU step-by-step.
This interface should be used for debugging purposes only.
--- drivers/cpufreq/Kconfig.arm | 10 ++ drivers/cpufreq/brcmstb-avs-cpufreq.c | 322 +++++++++++++++++++++++++++++++++- 2 files changed, 331 insertions(+), 1 deletion(-)
drivers/cpufreq/Kconfig.arm +10 -0
@@ -23,6 +23,16 @@ config ARM_BRCMSTB_AVS_CPUFREQ Say Y, if you have a Broadcom SoC with AVS support for DFS or DVFS. +config ARM_BRCMSTB_AVS_CPUFREQ_DEBUG + bool "Broadcom STB AVS CPUfreq driver sysfs debug capability" + depends on ARM_BRCMSTB_AVS_CPUFREQ + help + Enabling this option turns on debug support via sysfs under + /sys/kernel/debug/brcmstb-avs-cpufreq. It is possible to read all and + write some AVS mailbox registers through sysfs entries. + + If in doubt, say N. + config ARM_DT_BL_CPUFREQ tristate "Generic probing via DT for ARM big LITTLE CPUfreq driver" depends on ARM_BIG_LITTLE_CPUFREQ && OF
drivers/cpufreq/brcmstb-avs-cpufreq.c +321 -1
356 lines not on this page · raw message
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Viresh Kumar
maintainerRe: [PATCH v3 2/3] cpufreq: brcmstb-avs-cpufreq: AVS CPUfreq driver for Broadcom STB SoCs
In reply to Markus Mayerdrivers/cpufreq/brcmstb-avs-cpufreq.c line 613
Quoted 9 lines · Markus Mayer
drivers/cpufreq/brcmstb-avs-cpufreq.c new file +9
-0+static int brcm_avs_cpufreq_exit (struct cpufreq_policy *policy) +{ +struct private_data *priv = policy->driver_data; + +iounmap (priv->base); +iounmap (priv->avs_intr_base); + +return 0 ; +}
Shouldn't the above be done in the below routine instead ?
Quoted 6 lines
drivers/cpufreq/brcmstb-avs-cpufreq.c new file +6
-0+static int brcm_avs_cpufreq_remove (struct platform_device *pdev) +{ +platform_set_drvdata (pdev,NULL ); + +return cpufreq_unregister_driver (&brcm_avs_driver); +}
Signature · 5 lines
viresh -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 2/3] cpufreq: brcmstb-avs-cpufreq: AVS CPUfreq driver for Broadcom STB SoCs
Quoted 12 lines · Viresh Kumar
drivers/cpufreq/brcmstb-avs-cpufreq.c line 613
Quoted 9 lines · Markus Mayer
drivers/cpufreq/brcmstb-avs-cpufreq.c new file +9
-0+static int brcm_avs_cpufreq_exit (struct cpufreq_policy *policy) +{ +struct private_data *priv = policy->driver_data; + +iounmap (priv->base); +iounmap (priv->avs_intr_base); + +return 0 ; +}Shouldn't the above be done in the below routine instead ?
Good point. I'll move it.
Quoted 9 lines
drivers/cpufreq/brcmstb-avs-cpufreq.c line 717
Quoted 6 lines
drivers/cpufreq/brcmstb-avs-cpufreq.c new file +6
-0+static int brcm_avs_cpufreq_remove (struct platform_device *pdev) +{ +platform_set_drvdata (pdev,NULL ); + +return cpufreq_unregister_driver (&brcm_avs_driver); +}--
viresh