mbox series

[v3,0/4] cpufreq: Add imx-cpufreq-dt driver

Message ID cover.1557236799.git.leonard.crestez@nxp.com
Headers show
Series cpufreq: Add imx-cpufreq-dt driver | expand

Message

Leonard Crestez May 7, 2019, 1:52 p.m. UTC
Right now in upstream imx8m cpufreq support just lists a common subset
of OPPs because the higher ones should only be attempted after checking
speed grading in fuses.

Driver reads from nvmem and calls dev_pm_opp_set_supported_hw before
registering cpufreq-dt.

Changes since v2:
 * Minor reformatting in Kconfig (Viresh)
 * Open-code imx_cpufreq_dt_match_node (Viresh)
 * Add mkt_segment bits to supported_hw and update .dtsi to match after
reviewing latest datasheets.
 * Add dt-bindings like other opp-supported-hw users
 * Add devicetree mailing list (keep forgetting dts needs to be reviewed)
Link to v2: https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=113163
Link to v1 (RFC): https://patchwork.kernel.org/patch/10916769/

I never noticed anything wrong with going above the fused speed grading
however it's technically unsafe so the cpufreq code changes should go in
before DT changes.

Driver is module by default. It depends on nvmem-imx which can also be a
module.

It's a platform device registered from soc-imx8 because couldn't find
any appropriate node for MODULE_DEVICE_TABLE(of).

Leonard Crestez (4):
  cpufreq: Add imx-cpufreq-dt driver
  dt-bindings: imx-cpufreq-dt: Document opp-supported-hw usage
  arm64: dts: imx8mm: Add cpu speed grading and all OPPs
  arm64: dts: imx8mq: Add cpu speed grading and all OPPs

 .../bindings/cpufreq/imx-cpufreq-dt.txt       | 37 +++++++
 arch/arm64/boot/dts/freescale/imx8mm.dtsi     | 17 +++-
 arch/arm64/boot/dts/freescale/imx8mq.dtsi     | 26 ++++-
 drivers/cpufreq/Kconfig.arm                   | 10 ++
 drivers/cpufreq/Makefile                      |  1 +
 drivers/cpufreq/cpufreq-dt-platdev.c          |  3 +
 drivers/cpufreq/imx-cpufreq-dt.c              | 96 +++++++++++++++++++
 drivers/soc/imx/soc-imx8.c                    |  3 +
 8 files changed, 191 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/cpufreq/imx-cpufreq-dt.txt
 create mode 100644 drivers/cpufreq/imx-cpufreq-dt.c

Comments

Viresh Kumar May 8, 2019, 3:54 a.m. UTC | #1
On 07-05-19, 13:52, Leonard Crestez wrote:
> Right now in upstream imx8m cpufreq support just lists a common subset
> of OPPs because the higher ones should only be attempted after checking
> speed grading in fuses.
> 
> Add a small driver which checks speed grading from nvmem cells before
> registering cpufreq-dt.
> 
> This driver allows unlocking all frequencies for imx8mm and imx8mq and
> could be applied to other chips like imx7d
> 
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> 
> ---
>  drivers/cpufreq/Kconfig.arm          | 10 +++
>  drivers/cpufreq/Makefile             |  1 +
>  drivers/cpufreq/cpufreq-dt-platdev.c |  3 +
>  drivers/cpufreq/imx-cpufreq-dt.c     | 96 ++++++++++++++++++++++++++++
>  drivers/soc/imx/soc-imx8.c           |  3 +
>  5 files changed, 113 insertions(+)
>  create mode 100644 drivers/cpufreq/imx-cpufreq-dt.c
> 
> diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
> index 179a1d302f48..78ed9ef49e68 100644
> --- a/drivers/cpufreq/Kconfig.arm
> +++ b/drivers/cpufreq/Kconfig.arm
> @@ -90,10 +90,20 @@ config ARM_IMX6Q_CPUFREQ
>  	help
>  	  This adds cpufreq driver support for Freescale i.MX6 series SoCs.
>  
>  	  If in doubt, say N.
>  
> +config ARM_IMX_CPUFREQ_DT
> +	tristate "Freescale i.MX8M cpufreq support"
> +	depends on ARCH_MXC && CPUFREQ_DT
> +	default m if ARCH_MXC && CPUFREQ_DT

As I said in the previous version, the if block above is redundant and
not required.

> +	help
> +	  This adds cpufreq driver support for Freescale i.MX8M series SoCs,
> +	  based on cpufreq-dt.
> +
> +	  If in doubt, say N.
Leonard Crestez May 9, 2019, 9:03 a.m. UTC | #2
On 5/8/2019 6:54 AM, Viresh Kumar wrote:
> On 07-05-19, 13:52, Leonard Crestez wrote:

>> +config ARM_IMX_CPUFREQ_DT
>> +	tristate "Freescale i.MX8M cpufreq support"
>> +	depends on ARCH_MXC && CPUFREQ_DT
>> +	default m if ARCH_MXC && CPUFREQ_DT
> 
> As I said in the previous version, the if block above is redundant and
> not required.

Sorry, I misread and thought you were referring to () rather than what's 
inside.

Is "default m" otherwise OK? It's a reasonable implication of ARCH_MXC

--
Regards,
Leonard
Viresh Kumar May 9, 2019, 9:23 a.m. UTC | #3
On 09-05-19, 09:03, Leonard Crestez wrote:
> On 5/8/2019 6:54 AM, Viresh Kumar wrote:
> > On 07-05-19, 13:52, Leonard Crestez wrote:
> 
> >> +config ARM_IMX_CPUFREQ_DT
> >> +	tristate "Freescale i.MX8M cpufreq support"
> >> +	depends on ARCH_MXC && CPUFREQ_DT
> >> +	default m if ARCH_MXC && CPUFREQ_DT
> > 
> > As I said in the previous version, the if block above is redundant and
> > not required.
> 
> Sorry, I misread and thought you were referring to () rather than what's 
> inside.
> 
> Is "default m" otherwise OK? It's a reasonable implication of ARCH_MXC

I think it would be better to keep it disabled by default and so
removing the line all together would be a good option.