Skip to content

RFC CPUFreq: create platform-dev for DT based cpufreq drivers

Viresh Kumar linux-arm-kernel linux-devicetree linux-pm 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest8 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8cpufreq: Reuse "compatible" binding to probe cpufreq driversDocumentation/devicetree/bindings/cpufreq/drivers.txt+46 -00 replies
2/8cpufreq: Create cpufreq platform-device based on "compatible" from DTdrivers/cpufreq/Makefile drivers/cpufreq/dt_device.c+53 -10 replies
3/8cpufreq: imx: reuse dt_device.c to create cpufreq platform devicearch/arm/mach-imx/imx27-dt.c arch/arm/mach-imx/mach-imx51.c drivers/cpufreq/dt_device.c+2 -70 replies
4/8cpufreq: mvebu: reuse dt_device.c to create cpufreq platform devicearch/arm/mach-mvebu/pmsu.c drivers/cpufreq/dt_device.c+2 -10 replies
5/8cpufreq: shmobile: reuse dt_device.c to create cpufreq platform devicearch/arm/mach-shmobile/Makefile arch/arm/mach-shmobile/common.h arch/arm/mach-shmobile/cpufreq.c +1 more+3 -250 replies
6/8cpufreq: zynq: reuse dt_device.c to create cpufreq platform devicearch/arm/mach-zynq/common.c drivers/cpufreq/dt_device.c+2 -20 replies
7/8cpufreq: calxeda: reuse dt_device.c to create cpufreq platform devicedrivers/cpufreq/dt_device.c drivers/cpufreq/highbank-cpufreq.c+3 -50 replies
8/8cpufreq: exynos: reuse dt_device.c to create cpufreq platform devicearch/arm/mach-exynos/exynos.c drivers/cpufreq/dt_device.c+13 -200 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC V1 0/8] CPUFreq: create platform-dev for DT based cpufreq drivers

Hi Guys,

DT based cpufreq drivers doesn't require much support from platform code now a days as most of the stuff is moved behind generic APIs. Like clk APIs for changing clock rates, regulator APIs for changing voltages, etc.

One of the bottleneck still left was how to select which cpufreq driver to probe for a given platform as there might be multiple drivers available.

Traditionally, we used to create platform devices from machine specific code which binds with a cpufreq driver. And while we moved towards DT based device creation, these devices stayed as is.

The problem is getting worse now as we have architectures now with Zero platform specific code. Forcefully these platforms have to create a new file in drivers/cpufreq/ to just add these platform devices in order to use the generic drivers like cpufreq-dt.c.

This has been discussed again and again, but with no solution yet. Last it was discussed here:

http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/256154.html

This patch is an attempt towards getting the bindings.

We only need to have cpufreq drivers name string present in "compatible" property for the root node.. If a cpufreq driver with DT support exists with that name, then cpufreq core will create a platform device for that.

The first patch presents the new binding, second one creates another file responsible for creating platform devices for all DT based cpufreq drivers.

And later patches update platforms to migrate to it one by one.

A BLACKLIST of platforms already supported by these drivers is also created for backward compatibility of newer kernels with older DTs. And so for such platforms DT files aren't updated.

An initial RFC that presented the idea was discussed here:
https://www.mail-archive.com/devicetree at vger.kernel.org/msg52509.html

Tested-ON: Exynos5250. (The last patch for exynos depends on some commits to be upstreamed in 3.19, presented here just for testing).

Viresh Kumar (8):
cpufreq: Reuse "compatible" binding to probe cpufreq drivers
cpufreq: Create cpufreq platform-device based on "compatible" from DT
cpufreq: imx: reuse dt_device.c to create cpufreq platform device
cpufreq: mvebu: reuse dt_device.c to create cpufreq platform device
cpufreq: shmobile: reuse dt_device.c to create cpufreq platform device
cpufreq: zynq: reuse dt_device.c to create cpufreq platform device
cpufreq: calxeda: reuse dt_device.c to create cpufreq platform device
cpufreq: exynos: reuse dt_device.c to create cpufreq platform device

 .../devicetree/bindings/cpufreq/drivers.txt        | 46 +++++++++++++++
 arch/arm/mach-exynos/exynos.c                      | 27 +++------
 arch/arm/mach-imx/imx27-dt.c                       |  4 --
 arch/arm/mach-imx/mach-imx51.c                     |  3 -
 arch/arm/mach-mvebu/pmsu.c                         |  1 -
 arch/arm/mach-shmobile/Makefile                    |  1 -
 arch/arm/mach-shmobile/common.h                    |  7 ---
 arch/arm/mach-shmobile/cpufreq.c                   | 17 ------
 arch/arm/mach-zynq/common.c                        |  2 -
 drivers/cpufreq/Makefile                           |  2 +-
 drivers/cpufreq/dt_device.c                        | 68 ++++++++++++++++++++++
 drivers/cpufreq/highbank-cpufreq.c                 |  5 --
 12 files changed, 123 insertions(+), 60 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/cpufreq/drivers.txt
 delete mode 100644 arch/arm/mach-shmobile/cpufreq.c
 create mode 100644 drivers/cpufreq/dt_device.c
Signature · 1 line
2.0.3.693.g996b0fd