cpufreq: Introduce TI CPUFreq/OPP Driver
Subsystems (2)
v2 cover cpufreq: Introduce TI CPUFreq/OPP Driver
Hi,
This series is v2 of the series to introduce the ti-cpufreq driver which parses SoC data and provides opp-supported-hw data to the OPP core in order to enable the proper OPPs for the silicon in use. v1 of this series can be found here [1].
Mostly minor fixes to the driver with the largest being converting to the driver to a module_platform_driver. In addition to this, the binding was updated to add TI specific compatible strings for the SoCs supported by the driver that it matches now. More specific driver changes can be found in the patches.
This patch depends on [2], which actually has already been merged even though the binding was not finalized yet, so another series here [3] was sent to update the already merged dt nodes.
Regards,
Dave
[1] https://lkml.org/lkml/2016/5/18/653
[2] http://lists.infradead.org/pipermail/linux-arm-kernel/2016-May/430205.html
[3] http://lists.infradead.org/pipermail/linux-arm-kernel/2016-August/452981.html
Dave Gerlach (2):
Documentation: dt: add bindings for ti-cpufreq
cpufreq: ti: Add cpufreq driver to determine available OPPs at runtime
.../devicetree/bindings/cpufreq/ti-cpufreq.txt | 130 +++++++++ drivers/cpufreq/Kconfig.arm | 11 + drivers/cpufreq/Makefile | 1 + drivers/cpufreq/ti-cpufreq.c | 308 +++++++++++++++++++++ 4 files changed, 450 insertions(+) create mode 100644 Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt create mode 100644 drivers/cpufreq/ti-cpufreq.c
Signature · 1 line
2.9.0
PATCH v2 1/2 Documentation: dt: add bindings for ti-cpufreq
Add the device tree bindings document for the TI CPUFreq/OPP driver on AM33xx, AM43xx, DRA7, and AM57 SoCs. The operating-points-v2 binding allows us to provide an opp-supported-hw property for each OPP to define when it is available. This driver is responsible for reading and parsing registers to determine which OPPs can be selectively enabled based on the specific SoC in use by matching against the opp-supported-hw data.
---v1->v2:
- Dropped all driver/linux specific documentation
- Fixed some typos
- Add new compatibles for each SoC family to match against
- Switched to use am335x example to better demonstrate field one of opp-supported-hw.
.../devicetree/bindings/cpufreq/ti-cpufreq.txt | 130 +++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt new file +130 -0
@@ -0,0 +1,130 @@ +TI CPUFreq and OPP bindings +================================ + +Certain TI SoCs, like those in the am335x, am437x, am57xx, and dra7xx +families support different OPPs depending on the silicon variant in use. +The ti_cpufreq driver can use revision and an efuse value from the SoC to +provide the OPP framework with supported hardware information. This is +used to determine which OPPs from the operating-points-v2 table get enabled +when it is parsed by the OPP framework. + +Required properties: +-------------------- +In 'cpus' nodes: +- operating-points-v2: Phandle to the operating-points-v2 table to use. +- ti,syscon-efuse: Syscon phandle, offset to efuse register, efuse register + mask, and efuse register shift to get the relevant bits + that describe OPP availability. +- ti,syscon-rev: Syscon and offset used to look up revision value on SoC. + +In 'operating-points-v2' table: +- compatible: Should be + - 'operating-points-v2-ti-am3352-cpu' for am335x SoCs + - 'operating-points-v2-ti-am4372-cpu' for am43xx SoCs + - 'operating-points-v2-ti-dra7-cpu' for dra7xx/am57xx SoCs + +- opp-supported-hw: Two bitfields indicating: + 1. Which revision of the SoC the OPP is supported by + 2. Which eFuse bits indicate this OPP is available + + A bitwise AND is performed against these values and if any bit + matches, the OPP gets enabled. + +Example: +-------- + +/* From arch/arm/boot/dts/am33xx.dtsi */ +cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu at 0 { + compatible = "arm,cortex-a8"; + device_type = "cpu"; + reg = <0>; + + operating-points-v2 = <&cpu0_opp_table>; + ti,syscon-efuse = <&scm_conf 0x7fc 0x1fff 0>; + ti,syscon-rev = <&scm_conf 0x600>; + + clocks = <&dpll_mpu_ck>; + clock-names = "cpu"; + + clock-latency = <300000>; /* From omap-cpufreq driver */ + }; +}; + +/* + * cpu0 has different OPPs depending on SoC revision and some on revisions + * 0x2 and 0x4 have eFuse bits that indicate if they are available or not + */ +cpu0_opp_table: opp_table0 { + compatible = "operating-points-v2-ti-am3352-cpu"; + + /* + * The three following nodes are marked with opp-suspend + * because they can not be enabled simultaneously on a + * single SoC. + */ + opp50 at 300000000 { + opp-hz = /bits/ 64 <300000000>; + opp-microvolt = <950000 931000 969000>; + opp-supported-hw = <0x06 0x0010>; + opp-suspend; + }; + + opp100 at 275000000 { + opp-hz = /bits/ 64 <275000000>; + opp-microvolt = <1100000 1078000 1122000>; + opp-supported-hw = <0x01 0x00FF>; + opp-suspend; + }; + + opp100 at 300000000 { + opp-hz = /bits/ 64 <300000000>; + opp-microvolt = <1100000 1078000 1122000>; + opp-supported-hw = <0x06 0x0020>; + opp-suspend; + }; + + opp100 at 500000000 { + opp-hz = /bits/ 64 <500000000>; + opp-microvolt = <1100000 1078000 1122000>; + opp-supported-hw = <0x01 0xFFFF>; + }; + + opp100 at 600000000 { + opp-hz = /bits/ 64 <600000000>; + opp-microvolt = <1100000 1078000 1122000>; + opp-supported-hw = <0x06 0x0040>; + }; + + opp120 at 600000000 { + opp-hz = /bits/ 64 <600000000>; + opp-microvolt = <1200000 1176000 1224000>; + opp-supported-hw = <0x01 0xFFFF>; + }; + + opp120 at 720000000 { + opp-hz = /bits/ 64 <720000000>; + opp-microvolt = <1200000 1176000 1224000>; + opp-supported-hw = <0x06 0x0080>; + }; + + oppturbo at 720000000 { + opp-hz = /bits/ 64 <720000000>; + opp-microvolt = <1260000 1234800 1285200>; + opp-supported-hw = <0x01 0xFFFF>; + }; + + oppturbo at 800000000 { + opp-hz = /bits/ 64 <800000000>; + opp-microvolt = <1260000 1234800 1285200>; + opp-supported-hw = <0x06 0x0100>; + }; + + oppnitro at 1000000000 { + opp-hz = /bits/ 64 <1000000000>; + opp-microvolt = <1325000 1298500 1351500>; + opp-supported-hw = <0x04 0x0200>; + }; +};
Signature · 1 line
2.9.0
Viresh Kumar
maintainerPATCH v2 1/2 Documentation: dt: add bindings for ti-cpufreq
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt line 24
Quoted 5 lines · Dave Gerlach
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt new file +5
-0+In 'operating-points-v2' table: +- compatible: Should be + - 'operating-points-v2-ti-am3352-cpu' for am335x SoCs + - 'operating-points-v2-ti-am4372-cpu' for am43xx SoCs + - 'operating-points-v2-ti-dra7-cpu' for dra7xx/am57xx SoCs
Why do you need SoC specific compatible here? Are you defining new fields in OPP tables for your SoC ? How are the tables for your case going to differ from the ones using "operating-points-v2" compatible string?
Signature · 1 line
viresh
PATCH v2 1/2 Documentation: dt: add bindings for ti-cpufreq
Quoted 12 lines · Viresh Kumar
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt line 24
Quoted 5 lines · Dave Gerlach
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt new file +5
-0+In 'operating-points-v2' table: +- compatible: Should be + - 'operating-points-v2-ti-am3352-cpu' for am335x SoCs + - 'operating-points-v2-ti-am4372-cpu' for am43xx SoCs + - 'operating-points-v2-ti-dra7-cpu' for dra7xx/am57xx SoCsWhy do you need SoC specific compatible here? Are you defining new fields in OPP tables for your SoC ? How are the tables for your case going to differ from the ones using "operating-points-v2" compatible string?
I thought you had suggested that I do this in your comments from v1, but I guess that was dependent on whether or not I put the properties I have inserted into the cpu node into the operating-points table instead. I still have gotten no comments from any DT maintainers so I left it as is. I am still not sure if that is acceptable.
Regards,
Dave
Viresh Kumar
maintainerPATCH v2 1/2 Documentation: dt: add bindings for ti-cpufreq
Quoted 14 lines · Dave Gerlach
Quoted 12 lines · Viresh Kumar
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt line 24
Quoted 5 lines · Dave Gerlach
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt new file +5
-0+In 'operating-points-v2' table: +- compatible: Should be + - 'operating-points-v2-ti-am3352-cpu' for am335x SoCs + - 'operating-points-v2-ti-am4372-cpu' for am43xx SoCs + - 'operating-points-v2-ti-dra7-cpu' for dra7xx/am57xx SoCsWhy do you need SoC specific compatible here? Are you defining new fields in OPP tables for your SoC ? How are the tables for your case going to differ from the ones using "operating-points-v2" compatible string?
Quoted 3 lines
I thought you had suggested that I do this in your comments from v1, but I guess that was dependent on whether or not I put the properties I have inserted into the cpu node into the operating-points table instead.
Yes.
Quoted 3 lines
I still
have gotten no comments from any DT maintainers so I left it as is. I am still not sure if that is acceptable.
@Rob: Can you please share your views on the new properties being added to the CPU node ?
Signature · 1 line
viresh
PATCH v2 1/2 Documentation: dt: add bindings for ti-cpufreq
Rob,
Quoted 19 lines · Viresh Kumar
Quoted 14 lines · Dave Gerlach
Quoted 12 lines · Viresh Kumar
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt line 24
Quoted 5 lines · Dave Gerlach
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt new file +5
-0+In 'operating-points-v2' table: +- compatible: Should be + - 'operating-points-v2-ti-am3352-cpu' for am335x SoCs + - 'operating-points-v2-ti-am4372-cpu' for am43xx SoCs + - 'operating-points-v2-ti-dra7-cpu' for dra7xx/am57xx SoCsWhy do you need SoC specific compatible here? Are you defining new fields in OPP tables for your SoC ? How are the tables for your case going to differ from the ones using "operating-points-v2" compatible string?
Quoted 3 lines
I thought you had suggested that I do this in your comments from v1, but I guess that was dependent on whether or not I put the properties I have inserted into the cpu node into the operating-points table instead.
Quoted 9 lines
Yes.
Quoted 3 lines
I still
have gotten no comments from any DT maintainers so I left it as is. I am still not sure if that is acceptable.@Rob: Can you please share your views on the new properties being added to the CPU node ?
I am fine moving the properties in the operating-points-v2 node or leaving it as is, whichever is preferred.
Viresh, thanks for your comments.
Regards,
Dave
Rob Herring
maintainerPATCH v2 1/2 Documentation: dt: add bindings for ti-cpufreq
In reply to Dave GerlachQuoted 7 lines · Dave Gerlach
Add the device tree bindings document for the TI CPUFreq/OPP driver on AM33xx, AM43xx, DRA7, and AM57 SoCs. The operating-points-v2 binding allows us to provide an opp-supported-hw property for each OPP to define when it is available. This driver is responsible for reading and parsing registers to determine which OPPs can be selectively enabled based on the specific SoC in use by matching against the opp-supported-hw data.
Sorry, for the delay. Missed this somehow.
Quoted 28 lines
Signed-off-by Dave Gerlach <[email protected]>---
v1->v2:
- Dropped all driver/linux specific documentation
- Fixed some typos
- Add new compatibles for each SoC family to match against
- Switched to use am335x example to better demonstrate field one of opp-supported-hw..../devicetree/bindings/cpufreq/ti-cpufreq.txt | 130 +++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txtDocumentation/devicetree/bindings/cpufreq/ti-cpufreq.txt new file +8
-0@@ -0,0 +1,130 @@ +TI CPUFreq and OPP bindings +================================ + +Certain TI SoCs, like those in the am335x, am437x, am57xx, and dra7xx +families support different OPPs depending on the silicon variant in use. +The ti_cpufreq driver can use revision and an efuse value from the SoC to +provide the OPP framework with supported hardware information. This is +used to determine which OPPs from the operating-points-v2 table get enabled
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt line 18
Quoted 10 lines
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt new file +10
-0+when it is parsed by the OPP framework. + +Required properties: +-------------------- +In 'cpus' nodes: +- operating-points-v2: Phandle to the operating-points-v2 table to use. +- ti,syscon-efuse: Syscon phandle, offset to efuse register, efuse register + mask, and efuse register shift to get the relevant bits + that describe OPP availability. +- ti,syscon-rev: Syscon and offset used to look up revision value on SoC.
These have nothing to do with a cpu, so they don't belong here. Maybe the first is a property of an OPP table, but the second certainly is not.
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt line 28
Quoted 10 lines
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt new file +10
-0+ +In 'operating-points-v2' table: +- compatible: Should be + - 'operating-points-v2-ti-am3352-cpu' for am335x SoCs + - 'operating-points-v2-ti-am4372-cpu' for am43xx SoCs + - 'operating-points-v2-ti-dra7-cpu' for dra7xx/am57xx SoCs + +- opp-supported-hw: Two bitfields indicating: + 1. Which revision of the SoC the OPP is supported by + 2. Which eFuse bits indicate this OPP is available
I tend to think you should handle this with kernel code (bootloader really) fixing up the OPP table as necessary rather than putting in DT.
Rob
PATCH v2 1/2 Documentation: dt: add bindings for ti-cpufreq
Rob,
Quoted 45 lines · Rob Herring
Quoted 7 lines · Dave Gerlach
Add the device tree bindings document for the TI CPUFreq/OPP driver on AM33xx, AM43xx, DRA7, and AM57 SoCs. The operating-points-v2 binding allows us to provide an opp-supported-hw property for each OPP to define when it is available. This driver is responsible for reading and parsing registers to determine which OPPs can be selectively enabled based on the specific SoC in use by matching against the opp-supported-hw data.
Sorry, for the delay. Missed this somehow.
Quoted 34 lines
Signed-off-by Dave Gerlach <[email protected]>---
v1->v2:
- Dropped all driver/linux specific documentation
- Fixed some typos
- Add new compatibles for each SoC family to match against
- Switched to use am335x example to better demonstrate field one of opp-supported-hw..../devicetree/bindings/cpufreq/ti-cpufreq.txt | 130 +++++++++++++++++++++ 1 file changed, 130 insertions(+)create mode 100644
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txtDocumentation/devicetree/bindings/cpufreq/ti-cpufreq.txt new file +14
-0@@ -0,0 +1,130 @@ +TI CPUFreq and OPP bindings +================================ + +Certain TI SoCs, like those in the am335x, am437x, am57xx, and dra7xx +families support different OPPs depending on the silicon variant in use. +The ti_cpufreq driver can use revision and an efuse value from the SoC to +provide the OPP framework with supported hardware information. This is +used to determine which OPPs from the operating-points-v2 table get enabled +when it is parsed by the OPP framework. + +Required properties: +-------------------- +In 'cpus' nodes: +- operating-points-v2: Phandle to the operating-points-v2 table to use.
Quoted 8 lines
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt line 18
Quoted 4 lines
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt new file +4
-0+- ti,syscon-efuse: Syscon phandle, offset to efuse register, efuse register + mask, and efuse register shift to get the relevant bits + that describe OPP availability. +- ti,syscon-rev: Syscon and offset used to look up revision value on SoC.These have nothing to do with a cpu, so they don't belong here. Maybe the first is a property of an OPP table, but the second certainly is not.
Yes, I have no issue with this and will move the ti properties into the operating points table for v3 of the series.
Quoted 15 lines
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt line 28
Quoted 11 lines
Documentation/devicetree/bindings/cpufreq/ti-cpufreq.txt new file +10
-0+ +In 'operating-points-v2' table: +- compatible: Should be + - 'operating-points-v2-ti-am3352-cpu' for am335x SoCs + - 'operating-points-v2-ti-am4372-cpu' for am43xx SoCs + - 'operating-points-v2-ti-dra7-cpu' for dra7xx/am57xx SoCs + +- opp-supported-hw: Two bitfields indicating: + 1. Which revision of the SoC the OPP is supported by + 2. Which eFuse bits indicate this OPP is availableI tend to think you should handle this with kernel code (bootloader really) fixing up the OPP table as necessary rather than putting in DT.
The operating-points-v2 binding here [1] was designed with doing this in mind, and others are using it and the corresponding functionality offered by the OPP core to selectively enable OPPs. Why hide this in u-boot when we already have kernel framework support to do it?
Thanks for your comments, will send v3 moving the appropriate properties into the OPP table.
Regards,
Dave
[1] Documentation/devicetree/bindings/opp/opp.txt
Quoted 2 lines
Rob
PATCH v2 2/2 cpufreq: ti: Add cpufreq driver to determine available OPPs at runtime
In reply to Dave GerlachSome TI SoCs, like those in the AM335x, AM437x, DRA7x, and AM57x families, have different OPPs available for the MPU depending on which specific variant of the SoC is in use. This can be determined through use of the revision and an eFuse register present in the silicon. Introduce a ti-cpufreq driver that can read the aformentioned values and provide them as version matching data to the opp framework. Through this the opp-supported-hw dt binding that is part of the operating-points-v2 table can be used to indicate availability of OPPs for each device.
This driver also creates the "cpufreq-dt" platform_device after passing the version matching data to the OPP framework so that the cpufreq-dt handles the actual cpufreq implementation. Even without the necessary data to pass the version matching data the driver will still create this device to maintain backwards compatibility with operating-points v1 tables.
---v1->v2:
- Convert to module_platform_driver to match against new compatibles in patch 1
- Cleaned up some bit shifts
- of_property_read_u32_array used rather than reading values individually
drivers/cpufreq/Kconfig.arm | 11 ++ drivers/cpufreq/Makefile | 1 + drivers/cpufreq/ti-cpufreq.c | 308 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 320 insertions(+) create mode 100644 drivers/cpufreq/ti-cpufreq.c
drivers/cpufreq/Kconfig.arm +11 -0
@@ -234,6 +234,17 @@ config ARM_TEGRA124_CPUFREQ help This adds the CPUFreq driver support for Tegra124 SOCs. +config ARM_TI_CPUFREQ + tristate "Texas Instruments CPUFreq support" + depends on ARCH_OMAP2PLUS + help + This driver enables valid OPPs on the running platform based on + values contained within the SoC in use. Enable this in order to + use the cpufreq-dt driver on all Texas Instruments platforms that + provide dt based operating-points-v2 tables with opp-supported-hw + data provided. Required for cpufreq support on AM335x, AM437x, + DRA7x, and AM57x platforms. + config ARM_PXA2xx_CPUFREQ tristate "Intel PXA2xx CPUfreq driver" depends on PXA27x || PXA25x
drivers/cpufreq/Makefile +1 -0
@@ -77,6 +77,7 @@ obj-$(CONFIG_ARM_SPEAR_CPUFREQ) += spear-cpufreq.o obj-$(CONFIG_ARM_STI_CPUFREQ) += sti-cpufreq.o obj-$(CONFIG_ARM_TEGRA20_CPUFREQ) += tegra20-cpufreq.o obj-$(CONFIG_ARM_TEGRA124_CPUFREQ) += tegra124-cpufreq.o +obj-$(CONFIG_ARM_TI_CPUFREQ) += ti-cpufreq.o obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.o obj-$(CONFIG_ACPI_CPPC_CPUFREQ) += cppc_cpufreq.o obj-$(CONFIG_MACH_MVEBU_V7) += mvebu-cpufreq.o
drivers/cpufreq/ti-cpufreq.c new file +308 -0
308 lines not on this page · raw message
Signature · 1 line
2.9.0
Viresh Kumar
maintainerPATCH v2 2/2 cpufreq: ti: Add cpufreq driver to determine available OPPs at runtime
Quoted 24 lines · Dave Gerlach
Some TI SoCs, like those in the AM335x, AM437x, DRA7x, and AM57x families, have different OPPs available for the MPU depending on which specific variant of the SoC is in use. This can be determined through use of the revision and an eFuse register present in the silicon. Introduce a ti-cpufreq driver that can read the aformentioned values and provide them as version matching data to the opp framework. Through this the opp-supported-hw dt binding that is part of the operating-points-v2 table can be used to indicate availability of OPPs for each device.
This driver also creates the "cpufreq-dt"
platform_deviceafter passing the version matching data to the OPP framework so that the cpufreq-dt handles the actual cpufreq implementation. Even without the necessary data to pass the version matching data the driver will still create this device to maintain backwards compatibility with operating-points v1 tables.Signed-off-by Dave Gerlach <[email protected]>---
v1->v2:
- Convert tomodule_platform_driverto match against new compatibles in patch 1
- Cleaned up some bit shifts
-of_property_read_u32_arrayused rather than reading values individually
Quoted 5 lines
drivers/cpufreq/Kconfig.arm | 11 ++ drivers/cpufreq/Makefile | 1 + drivers/cpufreq/ti-cpufreq.c | 308 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 320 insertions(+) create mode 100644 drivers/cpufreq/ti-cpufreq.c
I am wondering if we should start writing OPP drivers instead. As this patch doesn't have anything to do with cpufreq really :)
But its fine for now..
drivers/cpufreq/ti-cpufreq.c line 212
Quoted 7 lines
drivers/cpufreq/ti-cpufreq.c new file +7
-0+static const struct of_device_id ti_cpufreq_of_match[] = { + { .compatible ="operating-points-v2-ti-am3352-cpu" , + .data = &am3x_soc_data, }, + { .compatible ="operating-points-v2-ti-am4372-cpu" , + .data = &am4x_soc_data, }, + { .compatible ="operating-points-v2-ti-dra7-cpu" , + .data = &dra7_soc_data },
You should be using your SoC compatible strings here. OPP compatible property isn't supposed to be (mis)used for this purpose.
Signature · 1 line
viresh
PATCH v2 2/2 cpufreq: ti: Add cpufreq driver to determine available OPPs at runtime
Quoted 36 lines · Viresh Kumar
Quoted 24 lines · Dave Gerlach
Some TI SoCs, like those in the AM335x, AM437x, DRA7x, and AM57x families, have different OPPs available for the MPU depending on which specific variant of the SoC is in use. This can be determined through use of the revision and an eFuse register present in the silicon. Introduce a ti-cpufreq driver that can read the aformentioned values and provide them as version matching data to the opp framework. Through this the opp-supported-hw dt binding that is part of the operating-points-v2 table can be used to indicate availability of OPPs for each device.
This driver also creates the "cpufreq-dt"
platform_deviceafter passing the version matching data to the OPP framework so that the cpufreq-dt handles the actual cpufreq implementation. Even without the necessary data to pass the version matching data the driver will still create this device to maintain backwards compatibility with operating-points v1 tables.Signed-off-by Dave Gerlach <[email protected]>---
v1->v2:
- Convert tomodule_platform_driverto match against new compatibles in patch 1
- Cleaned up some bit shifts
-of_property_read_u32_arrayused rather than reading values individuallyQuoted 5 lines
drivers/cpufreq/Kconfig.arm | 11 ++ drivers/cpufreq/Makefile | 1 + drivers/cpufreq/ti-cpufreq.c | 308 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 320 insertions(+)create mode 100644
drivers/cpufreq/ti-cpufreq.cI am wondering if we should start writing OPP drivers instead. As this patch doesn't have anything to do with cpufreq really :)
But its fine for now..
Quoted 11 lines
drivers/cpufreq/ti-cpufreq.c line 212
Quoted 7 lines
drivers/cpufreq/ti-cpufreq.c new file +7
-0+static const struct of_device_id ti_cpufreq_of_match[] = { + { .compatible ="operating-points-v2-ti-am3352-cpu" , + .data = &am3x_soc_data, }, + { .compatible ="operating-points-v2-ti-am4372-cpu" , + .data = &am4x_soc_data, }, + { .compatible ="operating-points-v2-ti-dra7-cpu" , + .data = &dra7_soc_data },You should be using your SoC compatible strings here. OPP compatible property isn't supposed to be (mis)used for this purpose.
Referring to my comments in patch 1, what if we end up changing the bindings based on DT maintainer comments? We will have these compatible strings, and at that point is it acceptable to match against them? Or is it still better to match to SoC compatibles? I think it makes sense to just probe against these.
Regards,
Dave
Viresh Kumar
maintainerPATCH v2 2/2 cpufreq: ti: Add cpufreq driver to determine available OPPs at runtime
Quoted 12 lines · Dave Gerlach
Quoted 11 lines
drivers/cpufreq/ti-cpufreq.c line 212
Quoted 7 lines
drivers/cpufreq/ti-cpufreq.c new file +7
-0+static const struct of_device_id ti_cpufreq_of_match[] = { + { .compatible ="operating-points-v2-ti-am3352-cpu" , + .data = &am3x_soc_data, }, + { .compatible ="operating-points-v2-ti-am4372-cpu" , + .data = &am4x_soc_data, }, + { .compatible ="operating-points-v2-ti-dra7-cpu" , + .data = &dra7_soc_data },You should be using your SoC compatible strings here. OPP compatible property isn't supposed to be (mis)used for this purpose.
Quoted 5 lines
Referring to my comments in patch 1, what if we end up changing the bindings based on DT maintainer comments? We will have these compatible strings, and at that point is it acceptable to match against them? Or is it still better to match to SoC compatibles? I think it makes sense to just probe against these.
But even then I think these are not correct. You should have added a single compatible string: operating-points-v2-ti-cpu.
As the properties will stay the same across machines. And then you need to use SoC strings here.
Signature · 1 line
viresh
PATCH v2 2/2 cpufreq: ti: Add cpufreq driver to determine available OPPs at runtime
Viresh,
Quoted 19 lines · Viresh Kumar
Quoted 12 lines · Dave Gerlach
Quoted 11 lines
drivers/cpufreq/ti-cpufreq.c line 212
Quoted 7 lines
drivers/cpufreq/ti-cpufreq.c new file +7
-0+static const struct of_device_id ti_cpufreq_of_match[] = { + { .compatible ="operating-points-v2-ti-am3352-cpu" , + .data = &am3x_soc_data, }, + { .compatible ="operating-points-v2-ti-am4372-cpu" , + .data = &am4x_soc_data, }, + { .compatible ="operating-points-v2-ti-dra7-cpu" , + .data = &dra7_soc_data },You should be using your SoC compatible strings here. OPP compatible property isn't supposed to be (mis)used for this purpose.
Quoted 5 lines
Referring to my comments in patch 1, what if we end up changing the bindings based on DT maintainer comments? We will have these compatible strings, and at that point is it acceptable to match against them? Or is it still better to match to SoC compatibles? I think it makes sense to just probe against these.
Quoted 6 lines
But even then I think these are not correct. You should have added a single compatible string: operating-points-v2-ti-cpu.
As the properties will stay the same across machines. And then you need to use SoC strings here.
Are you opposed to moving _of_get_opp_desc_node from drivers/base/power/opp/opp.h to include/linux/pm_opp.h and renaming it appropriately?
If I move the ti properties out of the cpu node, as discussed in patch 1 of this series, and into the operating-points-v2 table, I need a way to get the operating-points-v2 device node and I think it makes sense to reuse this as it is what the opp framework uses internally to parse the phandle to the opp table.
Regards,
Dave
Viresh Kumar
maintainerPATCH v2 2/2 cpufreq: ti: Add cpufreq driver to determine available OPPs at runtime
Quoted 24 lines · Dave Gerlach
Viresh,
Quoted 22 lines · Viresh Kumar
Quoted 12 lines · Dave Gerlach
Quoted 11 lines
drivers/cpufreq/ti-cpufreq.c line 212
Quoted 7 lines
drivers/cpufreq/ti-cpufreq.c new file +7
-0+static const struct of_device_id ti_cpufreq_of_match[] = { + { .compatible ="operating-points-v2-ti-am3352-cpu" , + .data = &am3x_soc_data, }, + { .compatible ="operating-points-v2-ti-am4372-cpu" , + .data = &am4x_soc_data, }, + { .compatible ="operating-points-v2-ti-dra7-cpu" , + .data = &dra7_soc_data },You should be using your SoC compatible strings here. OPP compatible property isn't supposed to be (mis)used for this purpose.
Quoted 5 lines
Referring to my comments in patch 1, what if we end up changing the bindings based on DT maintainer comments? We will have these compatible strings, and at that point is it acceptable to match against them? Or is it still better to match to SoC compatibles? I think it makes sense to just probe against these.
But even then I think these are not correct. You should have added a single compatible string: operating-points-v2-ti-cpu.
Quoted 7 lines
Quoted 3 lines
As the properties will stay the same across machines. And then you need to use SoC strings here.
Are you opposed to moving
_of_get_opp_desc_nodefromdrivers/base/power/opp/opp.htoinclude/linux/pm_opp.hand renaming it appropriately?
I am not opposed to that, but ...
Quoted 5 lines
If I move the ti properties out of the cpu node, as discussed in patch 1 of this series, and into the operating-points-v2 table, I need a way to get the operating-points-v2 device node and I think it makes sense to reuse this as it is what the opp framework uses internally to parse the phandle to the opp table.
I am not sure if those registers belong to the OPP bindings. What are those registers really? What all can be read from them? Why shouldn't they be present as a separate node in DT on the respective bus? Look at how it is done for sti-cpufreq driver.
Signature · 1 line
viresh
PATCH v2 2/2 cpufreq: ti: Add cpufreq driver to determine available OPPs at runtime
Quoted 41 lines · Viresh Kumar
Quoted 24 lines · Dave Gerlach
Viresh,
Quoted 22 lines · Viresh Kumar
Quoted 12 lines · Dave Gerlach
Quoted 11 lines
drivers/cpufreq/ti-cpufreq.c line 212
Quoted 7 lines
drivers/cpufreq/ti-cpufreq.c new file +7
-0+static const struct of_device_id ti_cpufreq_of_match[] = { + { .compatible ="operating-points-v2-ti-am3352-cpu" , + .data = &am3x_soc_data, }, + { .compatible ="operating-points-v2-ti-am4372-cpu" , + .data = &am4x_soc_data, }, + { .compatible ="operating-points-v2-ti-dra7-cpu" , + .data = &dra7_soc_data },You should be using your SoC compatible strings here. OPP compatible property isn't supposed to be (mis)used for this purpose.
Quoted 5 lines
Referring to my comments in patch 1, what if we end up changing the bindings based on DT maintainer comments? We will have these compatible strings, and at that point is it acceptable to match against them? Or is it still better to match to SoC compatibles? I think it makes sense to just probe against these.
But even then I think these are not correct. You should have added a single compatible string: operating-points-v2-ti-cpu.
Quoted 7 lines
Quoted 3 lines
As the properties will stay the same across machines. And then you need to use SoC strings here.
Are you opposed to moving
_of_get_opp_desc_nodefromdrivers/base/power/opp/opp.htoinclude/linux/pm_opp.hand renaming it appropriately?I am not opposed to that, but ...
Quoted 5 lines
If I move the ti properties out of the cpu node, as discussed in patch 1 of this series, and into the operating-points-v2 table, I need a way to get the operating-points-v2 device node and I think it makes sense to reuse this as it is what the opp framework uses internally to parse the phandle to the opp table.
Quoted 5 lines
I am not sure if those registers belong to the OPP bindings. What are those registers really? What all can be read from them? Why shouldn't they be present as a separate node in DT on the respective bus? Look at how it is done for sti-cpufreq driver.
The sti-cpufreq driver in v4.8-rc7 appears to do what I am already doing in this revision of the patch, reading from a syscon phandle that is part of the cpu node in the DT which is what I was told not to do.
The register I am referencing in the syscon is a bit-field describing which OPPs are valid for the system, so it is very relevant to the OPP binding. They really are already present in a separate node, I'm just indexing into a syscon, same as the sti-cpufreq driver appears to be doing.
Regards,
Dave
Viresh Kumar
maintainerPATCH v2 2/2 cpufreq: ti: Add cpufreq driver to determine available OPPs at runtime
Quoted 48 lines · Dave Gerlach
Quoted 41 lines · Viresh Kumar
Quoted 24 lines · Dave Gerlach
Viresh,
Quoted 22 lines · Viresh Kumar
Quoted 12 lines · Dave Gerlach
Quoted 11 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+static const struct of_device_id ti_cpufreq_of_match[] = { + { .compatible = "operating-points-v2-ti-am3352-cpu", + .data = &am3x_soc_data, }, + { .compatible = "operating-points-v2-ti-am4372-cpu", + .data = &am4x_soc_data, }, + { .compatible = "operating-points-v2-ti-dra7-cpu", + .data = &dra7_soc_data },You should be using your SoC compatible strings here. OPP compatible property isn't supposed to be (mis)used for this purpose.
Quoted 5 lines
Referring to my comments in patch 1, what if we end up changing the bindings based on DT maintainer comments? We will have these compatible strings, and at that point is it acceptable to match against them? Or is it still better to match to SoC compatibles? I think it makes sense to just probe against these.
But even then I think these are not correct. You should have added a single compatible string: operating-points-v2-ti-cpu.
Quoted 7 lines
Quoted 3 lines
As the properties will stay the same across machines. And then you need to use SoC strings here.
Are you opposed to moving
_of_get_opp_desc_nodefromdrivers/base/power/opp/opp.htoinclude/linux/pm_opp.hand renaming it appropriately?I am not opposed to that, but ...
Quoted 5 lines
If I move the ti properties out of the cpu node, as discussed in patch 1 of this series, and into the operating-points-v2 table, I need a way to get the operating-points-v2 device node and I think it makes sense to reuse this as it is what the opp framework uses internally to parse the phandle to the opp table.
Quoted 5 lines
I am not sure if those registers belong to the OPP bindings. What are those registers really? What all can be read from them? Why shouldn't they be present as a separate node in DT on the respective bus? Look at how it is done for sti-cpufreq driver.
Quoted 8 lines
The sti-cpufreq driver in v4.8-rc7 appears to do what I am already doing in this revision of the patch, reading from a syscon phandle that is part of the cpu node in the DT which is what I was told not to do.
The register I am referencing in the syscon is a bit-field describing which OPPs are valid for the system, so it is very relevant to the OPP binding. They really are already present in a separate node, I'm just indexing into a syscon, same as the sti-cpufreq driver appears to be doing.
Okay, you can move that function out.
Signature · 1 line
viresh