* [PATCH v2 0/6] arm64: dts: freescale: imx8mp-skov: switch to nominal drive mode
@ 2025-01-06 14:21 Ahmad Fatoum
2025-01-06 14:21 ` [PATCH v2 1/6] dt-bindings: clock: imx8m: document nominal/overdrive properties Ahmad Fatoum
` (5 more replies)
0 siblings, 6 replies; 16+ messages in thread
From: Ahmad Fatoum @ 2025-01-06 14:21 UTC (permalink / raw)
To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Abel Vesa, Marek Vasut
Cc: linux-clk, imx, devicetree, linux-arm-kernel, linux-kernel,
Conor Dooley, Ahmad Fatoum
Unlike the i.MX8MM and i.MX8MN SoCs added earlier, the imx8mp.dtsi
configures some clocks at frequencies that are only validated for
overdrive mode, i.e., when VDD_SOC is 950 mV.
For the Skov i.MX8MP board, we want to run the SoC at the lower voltage of
850 mV though to reduce heat generation and power usage. For this to work,
clock rates need to adhere to the limits of the nominal drive mode.
This is done by this series: A new imx8mp-nominal.dtsi reconfigures
the imx8mp.dtsi clock tree to be compatible with nominal mode, an adaptation
to the Linux clock driver makes it sanity check the actual clock rates against
the SoC operating mode's constraints and finally the Skov DT makes use
of it.
Actual configuration of the VDD_SOC rail continues to happen prior to Linux
as well as PLL configuration that needs to happen earlier than the kernel
running. See the corresponding barebox patch series[1] for details.
Note that the barebox series didn't yet include VDD_SOC reconfiguration
to 850mV, that would follow once the kernel changes have been merged.
[1]: https://lore.kernel.org/barebox/20240503103717.1370636-1-a.fatoum@pengutronix.de/
---
Changes in v2:
- Explain in Patch 1/6 why two properties are added instead of one
(Conor)
- Collect Conor's Acked-by
- Collect Peng's Reviewed-by
- Link to v1: https://lore.kernel.org/r/20241219-imx8m-clk-v1-0-cfaffa087da6@pengutronix.de
---
Ahmad Fatoum (6):
dt-bindings: clock: imx8m: document nominal/overdrive properties
arm64: dts: imx8mp: Add optional nominal drive mode DTSI
arm64: dts: imx8mp: add fsl,nominal-mode property into nominal.dtsi
arm64: dts: freescale: imx8mp-skov: fix LDB clock rate configuration
arm64: dts: freescale: imx8mp-skov: operate SoC in nominal mode
clk: imx8mp: inform CCF of maximum frequency of clocks
.../devicetree/bindings/clock/imx8m-clock.yaml | 14 ++
arch/arm64/boot/dts/freescale/imx8mp-nominal.dtsi | 64 +++++++++
.../arm64/boot/dts/freescale/imx8mp-skov-reva.dtsi | 5 +-
.../freescale/imx8mp-skov-revb-mi1010ait-1cp1.dts | 19 +--
drivers/clk/imx/clk-imx8mp.c | 147 +++++++++++++++++++++
5 files changed, 233 insertions(+), 16 deletions(-)
---
base-commit: 78d4f34e2115b517bcbfe7ec0d018bbbb6f9b0b8
change-id: 20241217-imx8m-clk-9467763dfcd8
Best regards,
--
Ahmad Fatoum <a.fatoum@pengutronix.de>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 1/6] dt-bindings: clock: imx8m: document nominal/overdrive properties
2025-01-06 14:21 [PATCH v2 0/6] arm64: dts: freescale: imx8mp-skov: switch to nominal drive mode Ahmad Fatoum
@ 2025-01-06 14:21 ` Ahmad Fatoum
2025-01-06 16:41 ` Frank Li
2025-01-06 14:21 ` [PATCH v2 2/6] arm64: dts: imx8mp: Add optional nominal drive mode DTSI Ahmad Fatoum
` (4 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: Ahmad Fatoum @ 2025-01-06 14:21 UTC (permalink / raw)
To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Abel Vesa, Marek Vasut
Cc: linux-clk, imx, devicetree, linux-arm-kernel, linux-kernel,
Conor Dooley, Ahmad Fatoum
The imx8m-clock.yaml binding covers the clock controller inside all
of the i.MX8M Q/M/N/P SoCs. All of them have in common that they
support two operating modes: nominal and overdrive mode.
While the overdrive mode allows for higher frequencies for many IPs,
the nominal mode needs a lower SoC voltage, thereby reducing
heat generation and power usage.
As increasing clock rates beyond the maximum permitted by the supplied
SoC voltage can lead to difficult to debug issues, device tree consumers
would benefit from knowing what mode is active to enforce the clock rate
limits that come with it.
To facilitate this, extend the clock controller bindings with two mutually
exclusive optional properties. Allowing for absence of both properties is
needed, because there is no default suitable for all boards:
For i.MX8M Mini and Nano, the kernel SoC DTSIs has assigned-clock-rates
that are all achievable in nominal mode. For i.MX8MP, there are some
rates only validated for overdrive mode.
But even for the i.MX8M Mini/Nano boards, we don't know what rates they
may configure at runtime, so it has not been possible so far to infer from
just the device tree what the mode is.
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Documentation/devicetree/bindings/clock/imx8m-clock.yaml | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/Documentation/devicetree/bindings/clock/imx8m-clock.yaml b/Documentation/devicetree/bindings/clock/imx8m-clock.yaml
index c643d4a814786a1fc7e559140fe58911990f71bb..a6ae5257ef531f3fa8506d515d202f5b7842c4fa 100644
--- a/Documentation/devicetree/bindings/clock/imx8m-clock.yaml
+++ b/Documentation/devicetree/bindings/clock/imx8m-clock.yaml
@@ -43,6 +43,14 @@ properties:
ID in its "clocks" phandle cell. See include/dt-bindings/clock/imx8m-clock.h
for the full list of i.MX8M clock IDs.
+ fsl,nominal-mode:
+ description: Set if SoC is operated in nominal mode
+ $ref: /schemas/types.yaml#/definitions/flag
+
+ fsl,overdrive-mode:
+ description: Set if SoC is operated in overdrive mode
+ $ref: /schemas/types.yaml#/definitions/flag
+
required:
- compatible
- reg
@@ -95,6 +103,12 @@ allOf:
- const: clk_ext2
- const: clk_ext3
- const: clk_ext4
+ - if:
+ required:
+ - fsl,overdrive-mode
+ then:
+ properties:
+ fsl,nominal-mode: false
additionalProperties: false
--
2.39.5
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 2/6] arm64: dts: imx8mp: Add optional nominal drive mode DTSI
2025-01-06 14:21 [PATCH v2 0/6] arm64: dts: freescale: imx8mp-skov: switch to nominal drive mode Ahmad Fatoum
2025-01-06 14:21 ` [PATCH v2 1/6] dt-bindings: clock: imx8m: document nominal/overdrive properties Ahmad Fatoum
@ 2025-01-06 14:21 ` Ahmad Fatoum
2025-01-06 14:21 ` [PATCH v2 3/6] arm64: dts: imx8mp: add fsl,nominal-mode property into nominal.dtsi Ahmad Fatoum
` (3 subsequent siblings)
5 siblings, 0 replies; 16+ messages in thread
From: Ahmad Fatoum @ 2025-01-06 14:21 UTC (permalink / raw)
To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Abel Vesa, Marek Vasut
Cc: linux-clk, imx, devicetree, linux-arm-kernel, linux-kernel,
Ahmad Fatoum
Unlike the i.MX8MM and i.MX8MN SoCs added earlier, the device tree for
the i.MX8MP configures some clocks at frequencies that are only validated
for overdrive mode, i.e. when VDD_SOC is 950 mV.
Boards may want to run their SoC at the lower voltage of 850 mV though
to reduce heat generation and power usage. For this to work, clock rates
need to adhere to the limits of the nominal drive mode.
Add an optional DTSI file which can be included by various boards to run
in this mode.
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm64/boot/dts/freescale/imx8mp-nominal.dtsi | 63 +++++++++++++++++++++++
1 file changed, 63 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/imx8mp-nominal.dtsi b/arch/arm64/boot/dts/freescale/imx8mp-nominal.dtsi
new file mode 100644
index 0000000000000000000000000000000000000000..f9a82a663033a1dfb72163eebb62e4aee66cee2f
--- /dev/null
+++ b/arch/arm64/boot/dts/freescale/imx8mp-nominal.dtsi
@@ -0,0 +1,63 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (C) 2024 Pengutronix, Ahmad Fatoum <kernel@pengutronix.de>
+ */
+
+&clk {
+ assigned-clocks = <&clk IMX8MP_CLK_A53_SRC>,
+ <&clk IMX8MP_CLK_A53_CORE>,
+ <&clk IMX8MP_SYS_PLL3>,
+ <&clk IMX8MP_CLK_NOC>,
+ <&clk IMX8MP_CLK_NOC_IO>,
+ <&clk IMX8MP_CLK_GIC>;
+ assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>,
+ <&clk IMX8MP_ARM_PLL_OUT>,
+ <0>,
+ <&clk IMX8MP_SYS_PLL1_800M>,
+ <&clk IMX8MP_SYS_PLL3_OUT>,
+ <&clk IMX8MP_SYS_PLL1_800M>;
+ assigned-clock-rates = <0>, <0>,
+ <600000000>,
+ <800000000>,
+ <600000000>,
+ <400000000>;
+};
+
+&pgc_hdmimix {
+ assigned-clocks = <&clk IMX8MP_CLK_HDMI_AXI>,
+ <&clk IMX8MP_CLK_HDMI_APB>;
+ assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>,
+ <&clk IMX8MP_SYS_PLL1_133M>;
+ assigned-clock-rates = <400000000>, <133000000>;
+};
+
+&pgc_hsiomix {
+ assigned-clocks = <&clk IMX8MP_CLK_HSIO_AXI>;
+ assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>;
+ assigned-clock-rates = <400000000>;
+};
+
+&pgc_gpumix {
+ assigned-clocks = <&clk IMX8MP_CLK_GPU_AXI>,
+ <&clk IMX8MP_CLK_GPU_AHB>;
+ assigned-clock-parents = <&clk IMX8MP_SYS_PLL3_OUT>,
+ <&clk IMX8MP_SYS_PLL3_OUT>;
+ assigned-clock-rates = <600000000>, <300000000>;
+};
+
+&media_blk_ctrl {
+ assigned-clocks = <&clk IMX8MP_CLK_MEDIA_AXI>,
+ <&clk IMX8MP_CLK_MEDIA_APB>,
+ <&clk IMX8MP_CLK_MEDIA_DISP1_PIX>,
+ <&clk IMX8MP_CLK_MEDIA_DISP2_PIX>,
+ <&clk IMX8MP_CLK_MEDIA_ISP>,
+ <&clk IMX8MP_VIDEO_PLL1>;
+ assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>,
+ <&clk IMX8MP_SYS_PLL1_800M>,
+ <&clk IMX8MP_VIDEO_PLL1_OUT>,
+ <&clk IMX8MP_VIDEO_PLL1_OUT>,
+ <&clk IMX8MP_SYS_PLL1_800M>;
+ assigned-clock-rates = <400000000>, <200000000>,
+ <0>, <0>, <400000000>,
+ <1039500000>;
+};
--
2.39.5
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 3/6] arm64: dts: imx8mp: add fsl,nominal-mode property into nominal.dtsi
2025-01-06 14:21 [PATCH v2 0/6] arm64: dts: freescale: imx8mp-skov: switch to nominal drive mode Ahmad Fatoum
2025-01-06 14:21 ` [PATCH v2 1/6] dt-bindings: clock: imx8m: document nominal/overdrive properties Ahmad Fatoum
2025-01-06 14:21 ` [PATCH v2 2/6] arm64: dts: imx8mp: Add optional nominal drive mode DTSI Ahmad Fatoum
@ 2025-01-06 14:21 ` Ahmad Fatoum
2025-01-06 14:21 ` [PATCH v2 4/6] arm64: dts: freescale: imx8mp-skov: fix LDB clock rate configuration Ahmad Fatoum
` (2 subsequent siblings)
5 siblings, 0 replies; 16+ messages in thread
From: Ahmad Fatoum @ 2025-01-06 14:21 UTC (permalink / raw)
To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Abel Vesa, Marek Vasut
Cc: linux-clk, imx, devicetree, linux-arm-kernel, linux-kernel,
Ahmad Fatoum
The imx8mp-nominal.dtsi is meant to be included into boards that want to
override the default overdrive clock settings with settings suitable for
running in nominal drive mode at its lower required voltage.
Specifying fsl,nominal-mode informs drivers of this fact, so they can
sanity check runtime clock reconfiguration to observe the limits imposed
by nominal mode.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm64/boot/dts/freescale/imx8mp-nominal.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/boot/dts/freescale/imx8mp-nominal.dtsi b/arch/arm64/boot/dts/freescale/imx8mp-nominal.dtsi
index f9a82a663033a1dfb72163eebb62e4aee66cee2f..532eb049c7e87b562e91c70722434166a21f19dc 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp-nominal.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mp-nominal.dtsi
@@ -21,6 +21,7 @@ &clk {
<800000000>,
<600000000>,
<400000000>;
+ fsl,nominal-mode;
};
&pgc_hdmimix {
--
2.39.5
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 4/6] arm64: dts: freescale: imx8mp-skov: fix LDB clock rate configuration
2025-01-06 14:21 [PATCH v2 0/6] arm64: dts: freescale: imx8mp-skov: switch to nominal drive mode Ahmad Fatoum
` (2 preceding siblings ...)
2025-01-06 14:21 ` [PATCH v2 3/6] arm64: dts: imx8mp: add fsl,nominal-mode property into nominal.dtsi Ahmad Fatoum
@ 2025-01-06 14:21 ` Ahmad Fatoum
2025-01-06 14:21 ` [PATCH v2 5/6] arm64: dts: freescale: imx8mp-skov: operate SoC in nominal mode Ahmad Fatoum
2025-01-06 14:21 ` [PATCH v2 6/6] clk: imx8mp: inform CCF of maximum frequency of clocks Ahmad Fatoum
5 siblings, 0 replies; 16+ messages in thread
From: Ahmad Fatoum @ 2025-01-06 14:21 UTC (permalink / raw)
To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Abel Vesa, Marek Vasut
Cc: linux-clk, imx, devicetree, linux-arm-kernel, linux-kernel,
Ahmad Fatoum
When the imx8mp-skov-revb-mi1010ait-1cp1 device tree was first added, it
configured the minimum clock rate supported by the panel instead of
the typical clock rate:
fsl-ldb 32ec0000.blk-ctrl:bridge@5c: Configured LDB clock
(482300000 Hz) does not match requested LVDS clock: 490000000 Hz
Besides the warning, the display functioned normally though
This broke with commit ff06ea04e4cf ("clk: imx: clk-imx8mp: Allow
media_disp pixel clock reconfigure parent rate") as the reconfiguration
of the parent clocks removed setting the IMX8MP_VIDEO_PLL1 to 7 times
the display clock rate:
fsl-ldb 32ec0000.blk-ctrl:bridge@5c: Configured LDB clock
(70000000 Hz) does not match requested LVDS clock: 490000000 Hz
Fix this by configuring the typical rate instead and benefit from
the new commit by dropping the now unneeded assigned-clock-rates
in &media_blk_ctrl.
Fixes: ff06ea04e4cf ("clk: imx: clk-imx8mp: Allow media_disp pixel clock reconfigure parent rate")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
.../dts/freescale/imx8mp-skov-revb-mi1010ait-1cp1.dts | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/arch/arm64/boot/dts/freescale/imx8mp-skov-revb-mi1010ait-1cp1.dts b/arch/arm64/boot/dts/freescale/imx8mp-skov-revb-mi1010ait-1cp1.dts
index 30962922b361c9d05887722769c7585eb85b44a0..a13f6d76a495936575ead53e4ea69ed39f80d61c 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp-skov-revb-mi1010ait-1cp1.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mp-skov-revb-mi1010ait-1cp1.dts
@@ -51,8 +51,11 @@ &lcdif2 {
};
&lvds_bridge {
- /* IMX8MP_CLK_MEDIA_LDB = IMX8MP_CLK_MEDIA_DISP2_PIX * 7 */
- assigned-clock-rates = <482300000>;
+ assigned-clocks = <&clk IMX8MP_CLK_MEDIA_LDB>,
+ <&clk IMX8MP_VIDEO_PLL1>;
+ assigned-clock-parents = <&clk IMX8MP_VIDEO_PLL1_OUT>;
+ /* IMX8MP_VIDEO_PLL1 = IMX8MP_CLK_MEDIA_DISP2_PIX * 2 * 7 */
+ assigned-clock-rates = <0>, <980000000>;
status = "okay";
ports {
@@ -64,18 +67,6 @@ ldb_lvds_ch0: endpoint {
};
};
-&media_blk_ctrl {
- /* currently it is not possible to let display clocks confugure
- * automatically, so we need to set them manually
- */
- assigned-clock-rates = <500000000>, <200000000>, <0>,
- /* IMX8MP_CLK_MEDIA_DISP2_PIX = pixelclk of lvds panel */
- <68900000>,
- <500000000>,
- /* IMX8MP_VIDEO_PLL1 = IMX8MP_CLK_MEDIA_LDB * 2 */
- <964600000>;
-};
-
&pwm4 {
status = "okay";
};
--
2.39.5
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 5/6] arm64: dts: freescale: imx8mp-skov: operate SoC in nominal mode
2025-01-06 14:21 [PATCH v2 0/6] arm64: dts: freescale: imx8mp-skov: switch to nominal drive mode Ahmad Fatoum
` (3 preceding siblings ...)
2025-01-06 14:21 ` [PATCH v2 4/6] arm64: dts: freescale: imx8mp-skov: fix LDB clock rate configuration Ahmad Fatoum
@ 2025-01-06 14:21 ` Ahmad Fatoum
2025-01-06 14:21 ` [PATCH v2 6/6] clk: imx8mp: inform CCF of maximum frequency of clocks Ahmad Fatoum
5 siblings, 0 replies; 16+ messages in thread
From: Ahmad Fatoum @ 2025-01-06 14:21 UTC (permalink / raw)
To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Abel Vesa, Marek Vasut
Cc: linux-clk, imx, devicetree, linux-arm-kernel, linux-kernel,
Ahmad Fatoum
To reduce heat generation, the Skov i.MX8MP boards should run in nominal
drive mode with a VDD_SOC voltage of 850 mV.
At this operating point, not all frequencies that are achievable with
overdrive mode are possible, so import imx8mp-nominal.dtsi to clock down
the clocks.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm64/boot/dts/freescale/imx8mp-skov-reva.dtsi | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/freescale/imx8mp-skov-reva.dtsi b/arch/arm64/boot/dts/freescale/imx8mp-skov-reva.dtsi
index 59813ef8e2bb3a3d5672ba1c5776cf0e45fb6862..9dc36517e90c16dd10d14f55d8d5582e845b0f60 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp-skov-reva.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mp-skov-reva.dtsi
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
#include "imx8mp.dtsi"
+#include "imx8mp-nominal.dtsi"
#include <dt-bindings/leds/common.h>
@@ -237,8 +238,8 @@ pmic@25 {
regulators {
reg_vdd_soc: BUCK1 {
regulator-name = "VDD_SOC";
- regulator-min-microvolt = <600000>;
- regulator-max-microvolt = <2187500>;
+ regulator-min-microvolt = <850000>;
+ regulator-max-microvolt = <850000>;
vin-supply = <®_5v_p>;
regulator-boot-on;
regulator-always-on;
--
2.39.5
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 6/6] clk: imx8mp: inform CCF of maximum frequency of clocks
2025-01-06 14:21 [PATCH v2 0/6] arm64: dts: freescale: imx8mp-skov: switch to nominal drive mode Ahmad Fatoum
` (4 preceding siblings ...)
2025-01-06 14:21 ` [PATCH v2 5/6] arm64: dts: freescale: imx8mp-skov: operate SoC in nominal mode Ahmad Fatoum
@ 2025-01-06 14:21 ` Ahmad Fatoum
2025-01-06 23:42 ` Stephen Boyd
5 siblings, 1 reply; 16+ messages in thread
From: Ahmad Fatoum @ 2025-01-06 14:21 UTC (permalink / raw)
To: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Abel Vesa, Marek Vasut
Cc: linux-clk, imx, devicetree, linux-arm-kernel, linux-kernel,
Ahmad Fatoum
The IMX8MPCEC datasheet lists maximum frequencies allowed for different
modules. Some of these limits are universal, but some depend on
whether the SoC is operating in nominal or in overdrive mode.
The imx8mp.dtsi currently assumes overdrive mode and configures some
clocks in accordance with this. Boards wishing to make use of nominal
mode will need to override some of the clock rates manually.
As operating the clocks outside of their allowed range can lead to
difficult to debug issues, it makes sense to register the maximum rates
allowed in the driver, so the CCF can take them into account.
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/clk/imx/clk-imx8mp.c | 147 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 147 insertions(+)
diff --git a/drivers/clk/imx/clk-imx8mp.c b/drivers/clk/imx/clk-imx8mp.c
index 516dbd170c8a356f293621b371b9ef9b9bec90a4..3b06990b73adcb2e4807f91a8983ad35068572a7 100644
--- a/drivers/clk/imx/clk-imx8mp.c
+++ b/drivers/clk/imx/clk-imx8mp.c
@@ -8,6 +8,7 @@
#include <linux/err.h>
#include <linux/io.h>
#include <linux/module.h>
+#include <linux/units.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
@@ -405,6 +406,145 @@ static const char * const imx8mp_clkout_sels[] = {"audio_pll1_out", "audio_pll2_
static struct clk_hw **hws;
static struct clk_hw_onecell_data *clk_hw_data;
+struct imx8mp_clock_constraints {
+ int clkid;
+ u32 maxrate;
+};
+
+/*
+ * Below tables are taken from IMX8MPCEC Rev. 2.1, 07/2023
+ * Table 13. Maximum frequency of modules.
+ * Probable typos fixed are marked with a comment.
+ */
+static const struct imx8mp_clock_constraints imx8mp_clock_common_constraints[] = {
+ { IMX8MP_CLK_A53_DIV, 1000 * HZ_PER_MHZ },
+ { IMX8MP_CLK_ENET_AXI, 266666667 }, /* Datasheet claims 266MHz */
+ { IMX8MP_CLK_NAND_USDHC_BUS, 266666667 }, /* Datasheet claims 266MHz */
+ { IMX8MP_CLK_MEDIA_APB, 200 * HZ_PER_MHZ },
+ { IMX8MP_CLK_HDMI_APB, 133333333 }, /* Datasheet claims 133MHz */
+ { IMX8MP_CLK_ML_AXI, 800 * HZ_PER_MHZ },
+ { IMX8MP_CLK_AHB, 133333333 },
+ { IMX8MP_CLK_IPG_ROOT, 66666667 },
+ { IMX8MP_CLK_AUDIO_AHB, 400 * HZ_PER_MHZ },
+ { IMX8MP_CLK_MEDIA_DISP2_PIX, 170 * HZ_PER_MHZ },
+ { IMX8MP_CLK_DRAM_ALT, 666666667 },
+ { IMX8MP_CLK_DRAM_APB, 200 * HZ_PER_MHZ },
+ { IMX8MP_CLK_CAN1, 80 * HZ_PER_MHZ },
+ { IMX8MP_CLK_CAN2, 80 * HZ_PER_MHZ },
+ { IMX8MP_CLK_PCIE_AUX, 10 * HZ_PER_MHZ },
+ { IMX8MP_CLK_I2C5, 66666667 }, /* Datasheet claims 66MHz */
+ { IMX8MP_CLK_I2C6, 66666667 }, /* Datasheet claims 66MHz */
+ { IMX8MP_CLK_SAI1, 66666667 }, /* Datasheet claims 66MHz */
+ { IMX8MP_CLK_SAI2, 66666667 }, /* Datasheet claims 66MHz */
+ { IMX8MP_CLK_SAI3, 66666667 }, /* Datasheet claims 66MHz */
+ { IMX8MP_CLK_SAI5, 66666667 }, /* Datasheet claims 66MHz */
+ { IMX8MP_CLK_SAI6, 66666667 }, /* Datasheet claims 66MHz */
+ { IMX8MP_CLK_ENET_QOS, 125 * HZ_PER_MHZ },
+ { IMX8MP_CLK_ENET_QOS_TIMER, 200 * HZ_PER_MHZ },
+ { IMX8MP_CLK_ENET_REF, 125 * HZ_PER_MHZ },
+ { IMX8MP_CLK_ENET_TIMER, 125 * HZ_PER_MHZ },
+ { IMX8MP_CLK_ENET_PHY_REF, 125 * HZ_PER_MHZ },
+ { IMX8MP_CLK_NAND, 500 * HZ_PER_MHZ },
+ { IMX8MP_CLK_QSPI, 400 * HZ_PER_MHZ },
+ { IMX8MP_CLK_USDHC1, 400 * HZ_PER_MHZ },
+ { IMX8MP_CLK_USDHC2, 400 * HZ_PER_MHZ },
+ { IMX8MP_CLK_I2C1, 66666667 }, /* Datasheet claims 66MHz */
+ { IMX8MP_CLK_I2C2, 66666667 }, /* Datasheet claims 66MHz */
+ { IMX8MP_CLK_I2C3, 66666667 }, /* Datasheet claims 66MHz */
+ { IMX8MP_CLK_I2C4, 66666667 }, /* Datasheet claims 66MHz */
+ { IMX8MP_CLK_UART1, 80 * HZ_PER_MHZ },
+ { IMX8MP_CLK_UART2, 80 * HZ_PER_MHZ },
+ { IMX8MP_CLK_UART3, 80 * HZ_PER_MHZ },
+ { IMX8MP_CLK_UART4, 80 * HZ_PER_MHZ },
+ { IMX8MP_CLK_ECSPI1, 80 * HZ_PER_MHZ },
+ { IMX8MP_CLK_ECSPI2, 80 * HZ_PER_MHZ },
+ { IMX8MP_CLK_PWM1, 66666667 }, /* Datasheet claims 66MHz */
+ { IMX8MP_CLK_PWM2, 66666667 }, /* Datasheet claims 66MHz */
+ { IMX8MP_CLK_PWM3, 66666667 }, /* Datasheet claims 66MHz */
+ { IMX8MP_CLK_PWM4, 66666667 }, /* Datasheet claims 66MHz */
+ { IMX8MP_CLK_GPT1, 100 * HZ_PER_MHZ },
+ { IMX8MP_CLK_GPT2, 100 * HZ_PER_MHZ },
+ { IMX8MP_CLK_GPT3, 100 * HZ_PER_MHZ },
+ { IMX8MP_CLK_GPT4, 100 * HZ_PER_MHZ },
+ { IMX8MP_CLK_GPT5, 100 * HZ_PER_MHZ },
+ { IMX8MP_CLK_GPT6, 100 * HZ_PER_MHZ },
+ { IMX8MP_CLK_WDOG, 66666667 }, /* Datasheet claims 66MHz */
+ { IMX8MP_CLK_IPP_DO_CLKO1, 200 * HZ_PER_MHZ },
+ { IMX8MP_CLK_IPP_DO_CLKO2, 200 * HZ_PER_MHZ },
+ { IMX8MP_CLK_HDMI_REF_266M, 266 * HZ_PER_MHZ },
+ { IMX8MP_CLK_USDHC3, 400 * HZ_PER_MHZ },
+ { IMX8MP_CLK_MEDIA_MIPI_PHY1_REF, 300 * HZ_PER_MHZ },
+ { IMX8MP_CLK_MEDIA_DISP1_PIX, 250 * HZ_PER_MHZ },
+ { IMX8MP_CLK_MEDIA_CAM2_PIX, 277 * HZ_PER_MHZ },
+ { IMX8MP_CLK_MEDIA_LDB, 595 * HZ_PER_MHZ },
+ { IMX8MP_CLK_MEDIA_MIPI_TEST_BYTE, 200 * HZ_PER_MHZ },
+ { IMX8MP_CLK_ECSPI3, 80 * HZ_PER_MHZ },
+ { IMX8MP_CLK_PDM, 200 * HZ_PER_MHZ },
+ { IMX8MP_CLK_SAI7, 66666667 }, /* Datasheet claims 66MHz */
+ { IMX8MP_CLK_MAIN_AXI, 400 * HZ_PER_MHZ },
+ { /* sentinel */ },
+};
+
+static const struct imx8mp_clock_constraints imx8mp_clock_nominal_constraints[] = {
+ { IMX8MP_CLK_M7_CORE, 600 * HZ_PER_MHZ },
+ { IMX8MP_CLK_ML_CORE, 800 * HZ_PER_MHZ },
+ { IMX8MP_CLK_GPU3D_CORE, 800 * HZ_PER_MHZ },
+ { IMX8MP_CLK_GPU3D_SHADER_CORE, 800 * HZ_PER_MHZ },
+ { IMX8MP_CLK_GPU2D_CORE, 800 * HZ_PER_MHZ },
+ { IMX8MP_CLK_AUDIO_AXI_SRC, 600 * HZ_PER_MHZ },
+ { IMX8MP_CLK_HSIO_AXI, 400 * HZ_PER_MHZ },
+ { IMX8MP_CLK_MEDIA_ISP, 400 * HZ_PER_MHZ },
+ { IMX8MP_CLK_VPU_BUS, 600 * HZ_PER_MHZ },
+ { IMX8MP_CLK_MEDIA_AXI, 400 * HZ_PER_MHZ },
+ { IMX8MP_CLK_HDMI_AXI, 400 * HZ_PER_MHZ },
+ { IMX8MP_CLK_GPU_AXI, 600 * HZ_PER_MHZ },
+ { IMX8MP_CLK_GPU_AHB, 300 * HZ_PER_MHZ },
+ { IMX8MP_CLK_NOC, 800 * HZ_PER_MHZ },
+ { IMX8MP_CLK_NOC_IO, 600 * HZ_PER_MHZ },
+ { IMX8MP_CLK_ML_AHB, 300 * HZ_PER_MHZ },
+ { IMX8MP_CLK_VPU_G1, 600 * HZ_PER_MHZ },
+ { IMX8MP_CLK_VPU_G2, 500 * HZ_PER_MHZ },
+ { IMX8MP_CLK_MEDIA_CAM1_PIX, 400 * HZ_PER_MHZ },
+ { IMX8MP_CLK_VPU_VC8000E, 400 * HZ_PER_MHZ }, /* Datasheet claims 500MHz */
+ { IMX8MP_CLK_DRAM_CORE, 800 * HZ_PER_MHZ },
+ { IMX8MP_CLK_GIC, 400 * HZ_PER_MHZ },
+ { /* sentinel */ },
+};
+
+static const struct imx8mp_clock_constraints imx8mp_clock_overdrive_constraints[] = {
+ { IMX8MP_CLK_M7_CORE, 800 * HZ_PER_MHZ},
+ { IMX8MP_CLK_ML_CORE, 1000 * HZ_PER_MHZ },
+ { IMX8MP_CLK_GPU3D_CORE, 1000 * HZ_PER_MHZ },
+ { IMX8MP_CLK_GPU3D_SHADER_CORE, 1000 * HZ_PER_MHZ },
+ { IMX8MP_CLK_GPU2D_CORE, 1000 * HZ_PER_MHZ },
+ { IMX8MP_CLK_AUDIO_AXI_SRC, 800 * HZ_PER_MHZ },
+ { IMX8MP_CLK_HSIO_AXI, 500 * HZ_PER_MHZ },
+ { IMX8MP_CLK_MEDIA_ISP, 500 * HZ_PER_MHZ },
+ { IMX8MP_CLK_VPU_BUS, 800 * HZ_PER_MHZ },
+ { IMX8MP_CLK_MEDIA_AXI, 500 * HZ_PER_MHZ },
+ { IMX8MP_CLK_HDMI_AXI, 500 * HZ_PER_MHZ },
+ { IMX8MP_CLK_GPU_AXI, 800 * HZ_PER_MHZ },
+ { IMX8MP_CLK_GPU_AHB, 400 * HZ_PER_MHZ },
+ { IMX8MP_CLK_NOC, 1000 * HZ_PER_MHZ },
+ { IMX8MP_CLK_NOC_IO, 800 * HZ_PER_MHZ },
+ { IMX8MP_CLK_ML_AHB, 400 * HZ_PER_MHZ },
+ { IMX8MP_CLK_VPU_G1, 800 * HZ_PER_MHZ },
+ { IMX8MP_CLK_VPU_G2, 700 * HZ_PER_MHZ },
+ { IMX8MP_CLK_MEDIA_CAM1_PIX, 500 * HZ_PER_MHZ },
+ { IMX8MP_CLK_VPU_VC8000E, 500 * HZ_PER_MHZ }, /* Datasheet claims 400MHz */
+ { IMX8MP_CLK_DRAM_CORE, 1000 * HZ_PER_MHZ },
+ { IMX8MP_CLK_GIC, 500 * HZ_PER_MHZ },
+ { /* sentinel */ },
+};
+
+static void imx8mp_clocks_apply_constraints(const struct imx8mp_clock_constraints constraints[])
+{
+ const struct imx8mp_clock_constraints *constr;
+
+ for (constr = constraints; constr->clkid; constr++)
+ clk_hw_set_rate_range(hws[constr->clkid], 0, constr->maxrate);
+}
+
static int imx8mp_clocks_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -714,6 +854,13 @@ static int imx8mp_clocks_probe(struct platform_device *pdev)
imx_check_clk_hws(hws, IMX8MP_CLK_END);
+ imx8mp_clocks_apply_constraints(imx8mp_clock_common_constraints);
+
+ if (of_property_read_bool(np, "fsl,nominal-mode"))
+ imx8mp_clocks_apply_constraints(imx8mp_clock_nominal_constraints);
+ else if (of_property_read_bool(np, "fsl,overdrive-mode"))
+ imx8mp_clocks_apply_constraints(imx8mp_clock_overdrive_constraints);
+
err = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
if (err < 0) {
dev_err(dev, "failed to register hws for i.MX8MP\n");
--
2.39.5
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/6] dt-bindings: clock: imx8m: document nominal/overdrive properties
2025-01-06 14:21 ` [PATCH v2 1/6] dt-bindings: clock: imx8m: document nominal/overdrive properties Ahmad Fatoum
@ 2025-01-06 16:41 ` Frank Li
2025-01-06 19:25 ` Ahmad Fatoum
0 siblings, 1 reply; 16+ messages in thread
From: Frank Li @ 2025-01-06 16:41 UTC (permalink / raw)
To: Ahmad Fatoum
Cc: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Abel Vesa, Marek Vasut,
linux-clk, imx, devicetree, linux-arm-kernel, linux-kernel,
Conor Dooley
On Mon, Jan 06, 2025 at 03:21:42PM +0100, Ahmad Fatoum wrote:
> The imx8m-clock.yaml binding covers the clock controller inside all
> of the i.MX8M Q/M/N/P SoCs. All of them have in common that they
> support two operating modes: nominal and overdrive mode.
>
> While the overdrive mode allows for higher frequencies for many IPs,
> the nominal mode needs a lower SoC voltage, thereby reducing
> heat generation and power usage.
>
> As increasing clock rates beyond the maximum permitted by the supplied
> SoC voltage can lead to difficult to debug issues, device tree consumers
> would benefit from knowing what mode is active to enforce the clock rate
> limits that come with it.
>
> To facilitate this, extend the clock controller bindings with two mutually
> exclusive optional properties. Allowing for absence of both properties is
> needed, because there is no default suitable for all boards:
>
> For i.MX8M Mini and Nano, the kernel SoC DTSIs has assigned-clock-rates
> that are all achievable in nominal mode. For i.MX8MP, there are some
> rates only validated for overdrive mode.
>
> But even for the i.MX8M Mini/Nano boards, we don't know what rates they
> may configure at runtime, so it has not been possible so far to infer from
> just the device tree what the mode is.
>
> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> Documentation/devicetree/bindings/clock/imx8m-clock.yaml | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/clock/imx8m-clock.yaml b/Documentation/devicetree/bindings/clock/imx8m-clock.yaml
> index c643d4a814786a1fc7e559140fe58911990f71bb..a6ae5257ef531f3fa8506d515d202f5b7842c4fa 100644
> --- a/Documentation/devicetree/bindings/clock/imx8m-clock.yaml
> +++ b/Documentation/devicetree/bindings/clock/imx8m-clock.yaml
> @@ -43,6 +43,14 @@ properties:
> ID in its "clocks" phandle cell. See include/dt-bindings/clock/imx8m-clock.h
> for the full list of i.MX8M clock IDs.
>
> + fsl,nominal-mode:
> + description: Set if SoC is operated in nominal mode
> + $ref: /schemas/types.yaml#/definitions/flag
> +
> + fsl,overdrive-mode:
> + description: Set if SoC is operated in overdrive mode
> + $ref: /schemas/types.yaml#/definitions/flag
> +
why need two flags? suppose "not set fsl,overdrive-mode" is equal to
fsl,nominal-mode
Frank
> required:
> - compatible
> - reg
> @@ -95,6 +103,12 @@ allOf:
> - const: clk_ext2
> - const: clk_ext3
> - const: clk_ext4
> + - if:
> + required:
> + - fsl,overdrive-mode
> + then:
> + properties:
> + fsl,nominal-mode: false
>
> additionalProperties: false
>
>
> --
> 2.39.5
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/6] dt-bindings: clock: imx8m: document nominal/overdrive properties
2025-01-06 16:41 ` Frank Li
@ 2025-01-06 19:25 ` Ahmad Fatoum
2025-01-06 19:42 ` Frank Li
0 siblings, 1 reply; 16+ messages in thread
From: Ahmad Fatoum @ 2025-01-06 19:25 UTC (permalink / raw)
To: Frank Li
Cc: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Abel Vesa, Marek Vasut,
linux-clk, imx, devicetree, linux-arm-kernel, linux-kernel,
Conor Dooley
Hello Frank,
On 06.01.25 17:41, Frank Li wrote:
> On Mon, Jan 06, 2025 at 03:21:42PM +0100, Ahmad Fatoum wrote:
[snip]
>> Allowing for absence of both properties is
>> needed, because there is no default suitable for all boards:
>>
>> For i.MX8M Mini and Nano, the kernel SoC DTSIs has assigned-clock-rates
>> that are all achievable in nominal mode. For i.MX8MP, there are some
>> rates only validated for overdrive mode.
>>
>> But even for the i.MX8M Mini/Nano boards, we don't know what rates they
>> may configure at runtime, so it has not been possible so far to infer from
>> just the device tree what the mode is.
[snip]
>> + fsl,nominal-mode:
>> + description: Set if SoC is operated in nominal mode
>> + $ref: /schemas/types.yaml#/definitions/flag
>> +
>> + fsl,overdrive-mode:
>> + description: Set if SoC is operated in overdrive mode
>> + $ref: /schemas/types.yaml#/definitions/flag
>> +
>
> why need two flags? suppose "not set fsl,overdrive-mode" is equal to
> fsl,nominal-mode
Conor had the same question on v1[1] and I have addressed this in the commit
message of v2, see above.
In short, there is unfortunately no universally applicable default.
[1]: https://lore.kernel.org/all/4e2250b3-5170-4e88-aa0a-dd796b81e78b@pengutronix.de/
Thanks,
Ahmad
>
> Frank
>
>> required:
>> - compatible
>> - reg
>> @@ -95,6 +103,12 @@ allOf:
>> - const: clk_ext2
>> - const: clk_ext3
>> - const: clk_ext4
>> + - if:
>> + required:
>> + - fsl,overdrive-mode
>> + then:
>> + properties:
>> + fsl,nominal-mode: false
>>
>> additionalProperties: false
>>
>>
>> --
>> 2.39.5
>>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/6] dt-bindings: clock: imx8m: document nominal/overdrive properties
2025-01-06 19:25 ` Ahmad Fatoum
@ 2025-01-06 19:42 ` Frank Li
2025-01-06 19:55 ` Ahmad Fatoum
2025-01-13 13:52 ` Ahmad Fatoum
0 siblings, 2 replies; 16+ messages in thread
From: Frank Li @ 2025-01-06 19:42 UTC (permalink / raw)
To: Ahmad Fatoum
Cc: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Abel Vesa, Marek Vasut,
linux-clk, imx, devicetree, linux-arm-kernel, linux-kernel,
Conor Dooley
On Mon, Jan 06, 2025 at 08:25:38PM +0100, Ahmad Fatoum wrote:
> Hello Frank,
>
> On 06.01.25 17:41, Frank Li wrote:
> > On Mon, Jan 06, 2025 at 03:21:42PM +0100, Ahmad Fatoum wrote:
>
> [snip]
>
> >> Allowing for absence of both properties is
> >> needed, because there is no default suitable for all boards:
> >>
> >> For i.MX8M Mini and Nano, the kernel SoC DTSIs has assigned-clock-rates
> >> that are all achievable in nominal mode. For i.MX8MP, there are some
> >> rates only validated for overdrive mode.
> >>
> >> But even for the i.MX8M Mini/Nano boards, we don't know what rates they
> >> may configure at runtime, so it has not been possible so far to infer from
> >> just the device tree what the mode is.
>
> [snip]
>
> >> + fsl,nominal-mode:
> >> + description: Set if SoC is operated in nominal mode
> >> + $ref: /schemas/types.yaml#/definitions/flag
> >> +
> >> + fsl,overdrive-mode:
> >> + description: Set if SoC is operated in overdrive mode
> >> + $ref: /schemas/types.yaml#/definitions/flag
> >> +
> >
> > why need two flags? suppose "not set fsl,overdrive-mode" is equal to
> > fsl,nominal-mode
>
> Conor had the same question on v1[1] and I have addressed this in the commit
> message of v2, see above.
>
> In short, there is unfortunately no universally applicable default.
>
> [1]: https://lore.kernel.org/all/4e2250b3-5170-4e88-aa0a-dd796b81e78b@pengutronix.de/
>
But there are problem if use dts overlay because dts overlay can't support
delete property.
If one dts file use "fsl,overdrive-mode", dts overlay file can't delete
this property. "mutually exclusive optional properties" was not preferred.
mode = ["normal" | "overdrive"]
Frank
> Thanks,
> Ahmad
>
>
> >
> > Frank
> >
> >> required:
> >> - compatible
> >> - reg
> >> @@ -95,6 +103,12 @@ allOf:
> >> - const: clk_ext2
> >> - const: clk_ext3
> >> - const: clk_ext4
> >> + - if:
> >> + required:
> >> + - fsl,overdrive-mode
> >> + then:
> >> + properties:
> >> + fsl,nominal-mode: false
> >>
> >> additionalProperties: false
> >>
> >>
> >> --
> >> 2.39.5
> >>
> >
>
>
> --
> Pengutronix e.K. | |
> Steuerwalder Str. 21 | http://www.pengutronix.de/ |
> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/6] dt-bindings: clock: imx8m: document nominal/overdrive properties
2025-01-06 19:42 ` Frank Li
@ 2025-01-06 19:55 ` Ahmad Fatoum
2025-01-07 6:52 ` Krzysztof Kozlowski
2025-01-13 13:52 ` Ahmad Fatoum
1 sibling, 1 reply; 16+ messages in thread
From: Ahmad Fatoum @ 2025-01-06 19:55 UTC (permalink / raw)
To: Frank Li, Conor Dooley
Cc: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Abel Vesa, Marek Vasut,
linux-clk, imx, devicetree, linux-arm-kernel, linux-kernel,
Conor Dooley
Hello Frank,
On 06.01.25 20:42, Frank Li wrote:
> On Mon, Jan 06, 2025 at 08:25:38PM +0100, Ahmad Fatoum wrote:
>> On 06.01.25 17:41, Frank Li wrote:
>>> On Mon, Jan 06, 2025 at 03:21:42PM +0100, Ahmad Fatoum wrote:
>>>> Allowing for absence of both properties is
>>>> needed, because there is no default suitable for all boards:
>>>>
>>>> For i.MX8M Mini and Nano, the kernel SoC DTSIs has assigned-clock-rates
>>>> that are all achievable in nominal mode. For i.MX8MP, there are some
>>>> rates only validated for overdrive mode.
>>>>
>>>> But even for the i.MX8M Mini/Nano boards, we don't know what rates they
>>>> may configure at runtime, so it has not been possible so far to infer from
>>>> just the device tree what the mode is.
>>
>> [snip]
>>
>>>> + fsl,nominal-mode:
>>>> + description: Set if SoC is operated in nominal mode
>>>> + $ref: /schemas/types.yaml#/definitions/flag
>>>> +
>>>> + fsl,overdrive-mode:
>>>> + description: Set if SoC is operated in overdrive mode
>>>> + $ref: /schemas/types.yaml#/definitions/flag
>>>> +
>>>
>>> why need two flags? suppose "not set fsl,overdrive-mode" is equal to
>>> fsl,nominal-mode
>>
>> Conor had the same question on v1[1] and I have addressed this in the commit
>> message of v2, see above.
>>
>> In short, there is unfortunately no universally applicable default.
>>
>> [1]: https://lore.kernel.org/all/4e2250b3-5170-4e88-aa0a-dd796b81e78b@pengutronix.de/
>>
>
> But there are problem if use dts overlay because dts overlay can't support
> delete property.
>
> If one dts file use "fsl,overdrive-mode", dts overlay file can't delete
> this property. "mutually exclusive optional properties" was not preferred.
>
> mode = ["normal" | "overdrive"]
I don't see myself setting this via overlay, but if you say it's useful, we can
adjust the binding.
I am not sure what's the preference is though, should we have
fsl,operating-mode = "normal" / "overdrive"
or
fsl,operating-mode = <IMX_OPMODE_NORMAL> / <IMX_OPMODE_OVERDRIVE>
Any idea? Conor?
Cheers,
Ahmad
>
> Frank
>
>> Thanks,
>> Ahmad
>>
>>
>>>
>>> Frank
>>>
>>>> required:
>>>> - compatible
>>>> - reg
>>>> @@ -95,6 +103,12 @@ allOf:
>>>> - const: clk_ext2
>>>> - const: clk_ext3
>>>> - const: clk_ext4
>>>> + - if:
>>>> + required:
>>>> + - fsl,overdrive-mode
>>>> + then:
>>>> + properties:
>>>> + fsl,nominal-mode: false
>>>>
>>>> additionalProperties: false
>>>>
>>>>
>>>> --
>>>> 2.39.5
>>>>
>>>
>>
>>
>> --
>> Pengutronix e.K. | |
>> Steuerwalder Str. 21 | http://www.pengutronix.de/ |
>> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
>> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 6/6] clk: imx8mp: inform CCF of maximum frequency of clocks
2025-01-06 14:21 ` [PATCH v2 6/6] clk: imx8mp: inform CCF of maximum frequency of clocks Ahmad Fatoum
@ 2025-01-06 23:42 ` Stephen Boyd
2025-01-13 13:48 ` Ahmad Fatoum
0 siblings, 1 reply; 16+ messages in thread
From: Stephen Boyd @ 2025-01-06 23:42 UTC (permalink / raw)
To: Abel Vesa, Abel Vesa, Ahmad Fatoum, Conor Dooley, Fabio Estevam,
Krzysztof Kozlowski, Marek Vasut, Michael Turquette, Peng Fan,
Pengutronix Kernel Team, Rob Herring, Sascha Hauer, Shawn Guo
Cc: linux-clk, imx, devicetree, linux-arm-kernel, linux-kernel,
Ahmad Fatoum
Quoting Ahmad Fatoum (2025-01-06 06:21:47)
> diff --git a/drivers/clk/imx/clk-imx8mp.c b/drivers/clk/imx/clk-imx8mp.c
> index 516dbd170c8a356f293621b371b9ef9b9bec90a4..3b06990b73adcb2e4807f91a8983ad35068572a7 100644
> --- a/drivers/clk/imx/clk-imx8mp.c
> +++ b/drivers/clk/imx/clk-imx8mp.c
> @@ -405,6 +406,145 @@ static const char * const imx8mp_clkout_sels[] = {"audio_pll1_out", "audio_pll2_
> static struct clk_hw **hws;
> static struct clk_hw_onecell_data *clk_hw_data;
>
> +struct imx8mp_clock_constraints {
> + int clkid;
Is it signed instead of unsigned because the terminal element of the
array has -1 as a clkid? And because clkid 0 is a valid one?
> + u32 maxrate;
> +};
> +
> +/*
> + * Below tables are taken from IMX8MPCEC Rev. 2.1, 07/2023
> + * Table 13. Maximum frequency of modules.
> + * Probable typos fixed are marked with a comment.
> + */
> +static const struct imx8mp_clock_constraints imx8mp_clock_common_constraints[] = {
[...]
> + { IMX8MP_CLK_MEDIA_LDB, 595 * HZ_PER_MHZ },
> + { IMX8MP_CLK_MEDIA_MIPI_TEST_BYTE, 200 * HZ_PER_MHZ },
> + { IMX8MP_CLK_ECSPI3, 80 * HZ_PER_MHZ },
> + { IMX8MP_CLK_PDM, 200 * HZ_PER_MHZ },
> + { IMX8MP_CLK_SAI7, 66666667 }, /* Datasheet claims 66MHz */
> + { IMX8MP_CLK_MAIN_AXI, 400 * HZ_PER_MHZ },
> + { /* sentinel */ },
See nitpick below.
> +};
> +
> +static const struct imx8mp_clock_constraints imx8mp_clock_nominal_constraints[] = {
[...]
> + { IMX8MP_CLK_MEDIA_CAM1_PIX, 400 * HZ_PER_MHZ },
> + { IMX8MP_CLK_VPU_VC8000E, 400 * HZ_PER_MHZ }, /* Datasheet claims 500MHz */
> + { IMX8MP_CLK_DRAM_CORE, 800 * HZ_PER_MHZ },
> + { IMX8MP_CLK_GIC, 400 * HZ_PER_MHZ },
> + { /* sentinel */ },
See nitpick below.
> +};
> +
> +static const struct imx8mp_clock_constraints imx8mp_clock_overdrive_constraints[] = {
[...]
> + { IMX8MP_CLK_VPU_VC8000E, 500 * HZ_PER_MHZ }, /* Datasheet claims 400MHz */
> + { IMX8MP_CLK_DRAM_CORE, 1000 * HZ_PER_MHZ },
> + { IMX8MP_CLK_GIC, 500 * HZ_PER_MHZ },
> + { /* sentinel */ },
Please remove the comma because nothing can come after this and if
someone were to add something after they would get a compilation error.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/6] dt-bindings: clock: imx8m: document nominal/overdrive properties
2025-01-06 19:55 ` Ahmad Fatoum
@ 2025-01-07 6:52 ` Krzysztof Kozlowski
2025-01-13 13:51 ` Ahmad Fatoum
0 siblings, 1 reply; 16+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-07 6:52 UTC (permalink / raw)
To: Ahmad Fatoum
Cc: Frank Li, Conor Dooley, Abel Vesa, Peng Fan, Michael Turquette,
Stephen Boyd, Rob Herring, Krzysztof Kozlowski, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Abel Vesa,
Marek Vasut, linux-clk, imx, devicetree, linux-arm-kernel,
linux-kernel, Conor Dooley
On Mon, Jan 06, 2025 at 08:55:08PM +0100, Ahmad Fatoum wrote:
> >>> why need two flags? suppose "not set fsl,overdrive-mode" is equal to
> >>> fsl,nominal-mode
> >>
> >> Conor had the same question on v1[1] and I have addressed this in the commit
> >> message of v2, see above.
> >>
> >> In short, there is unfortunately no universally applicable default.
> >>
> >> [1]: https://lore.kernel.org/all/4e2250b3-5170-4e88-aa0a-dd796b81e78b@pengutronix.de/
> >>
> >
> > But there are problem if use dts overlay because dts overlay can't support
> > delete property.
> >
> > If one dts file use "fsl,overdrive-mode", dts overlay file can't delete
> > this property. "mutually exclusive optional properties" was not preferred.
> >
> > mode = ["normal" | "overdrive"]
>
> I don't see myself setting this via overlay, but if you say it's useful, we can
> adjust the binding.
>
> I am not sure what's the preference is though, should we have
>
> fsl,operating-mode = "normal" / "overdrive"
>
> or
>
> fsl,operating-mode = <IMX_OPMODE_NORMAL> / <IMX_OPMODE_OVERDRIVE>
>
>
> Any idea? Conor?
If these are two exclusive modes (plus default), then as Frank
suggested: use enum of strings. Imagine encoding enum of 10 values with
bools as you did: that would be enourmous oneOf condition or if:then:.
Preferred is strings, but numerical values are also accepted.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 6/6] clk: imx8mp: inform CCF of maximum frequency of clocks
2025-01-06 23:42 ` Stephen Boyd
@ 2025-01-13 13:48 ` Ahmad Fatoum
0 siblings, 0 replies; 16+ messages in thread
From: Ahmad Fatoum @ 2025-01-13 13:48 UTC (permalink / raw)
To: Stephen Boyd, Abel Vesa, Abel Vesa, Conor Dooley, Fabio Estevam,
Krzysztof Kozlowski, Marek Vasut, Michael Turquette, Peng Fan,
Pengutronix Kernel Team, Rob Herring, Sascha Hauer, Shawn Guo
Cc: linux-clk, imx, devicetree, linux-arm-kernel, linux-kernel
Hello Stephen,
On 07.01.25 00:42, Stephen Boyd wrote:
> Quoting Ahmad Fatoum (2025-01-06 06:21:47)
>> diff --git a/drivers/clk/imx/clk-imx8mp.c b/drivers/clk/imx/clk-imx8mp.c
>> index 516dbd170c8a356f293621b371b9ef9b9bec90a4..3b06990b73adcb2e4807f91a8983ad35068572a7 100644
>> --- a/drivers/clk/imx/clk-imx8mp.c
>> +++ b/drivers/clk/imx/clk-imx8mp.c
>> @@ -405,6 +406,145 @@ static const char * const imx8mp_clkout_sels[] = {"audio_pll1_out", "audio_pll2_
>> static struct clk_hw **hws;
>> static struct clk_hw_onecell_data *clk_hw_data;
>>
>> +struct imx8mp_clock_constraints {
>> + int clkid;
>
> Is it signed instead of unsigned because the terminal element of the
> array has -1 as a clkid? And because clkid 0 is a valid one?
I did use -1 originally, but then switched to zero as applying
constraints on IMX8MP_CLK_DUMMY doesn't make sense anyway.
> Please remove the comma because nothing can come after this and if
> someone were to add something after they would get a compilation error.
Commas removed and clkid made unsigned in v3.
Thanks,
Ahmad
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/6] dt-bindings: clock: imx8m: document nominal/overdrive properties
2025-01-07 6:52 ` Krzysztof Kozlowski
@ 2025-01-13 13:51 ` Ahmad Fatoum
0 siblings, 0 replies; 16+ messages in thread
From: Ahmad Fatoum @ 2025-01-13 13:51 UTC (permalink / raw)
To: Krzysztof Kozlowski, Conor Dooley
Cc: Frank Li, Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd,
Rob Herring, Krzysztof Kozlowski, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Abel Vesa, Marek Vasut,
linux-clk, imx, devicetree, linux-arm-kernel, linux-kernel,
Conor Dooley
Hi Krzysztof,
Hi Conor,
On 07.01.25 07:52, Krzysztof Kozlowski wrote:
> On Mon, Jan 06, 2025 at 08:55:08PM +0100, Ahmad Fatoum wrote:
>> I am not sure what's the preference is though, should we have>>
>> fsl,operating-mode = "normal" / "overdrive"
>>
>> or
>>
>> fsl,operating-mode = <IMX_OPMODE_NORMAL> / <IMX_OPMODE_OVERDRIVE>
>>
>>
>> Any idea? Conor?
>
> If these are two exclusive modes (plus default), then as Frank
> suggested: use enum of strings. Imagine encoding enum of 10 values with
> bools as you did: that would be enourmous oneOf condition or if:then:.
>
> Preferred is strings, but numerical values are also accepted.
Ok, I went with strings for v3. Thanks
@Conor, as the binding changed I've dropped your Ack from v3.
Thanks,
Ahmad
>
> Best regards,
> Krzysztof
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/6] dt-bindings: clock: imx8m: document nominal/overdrive properties
2025-01-06 19:42 ` Frank Li
2025-01-06 19:55 ` Ahmad Fatoum
@ 2025-01-13 13:52 ` Ahmad Fatoum
1 sibling, 0 replies; 16+ messages in thread
From: Ahmad Fatoum @ 2025-01-13 13:52 UTC (permalink / raw)
To: Frank Li
Cc: Abel Vesa, Peng Fan, Michael Turquette, Stephen Boyd, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Abel Vesa, Marek Vasut,
linux-clk, imx, devicetree, linux-arm-kernel, linux-kernel,
Conor Dooley
Hi Frank,
On 06.01.25 20:42, Frank Li wrote:
> On Mon, Jan 06, 2025 at 08:25:38PM +0100, Ahmad Fatoum wrote:
>> [1]: https://lore.kernel.org/all/4e2250b3-5170-4e88-aa0a-dd796b81e78b@pengutronix.de/
>>
>
> But there are problem if use dts overlay because dts overlay can't support
> delete property.
>
> If one dts file use "fsl,overdrive-mode", dts overlay file can't delete
> this property. "mutually exclusive optional properties" was not preferred.
>
> mode = ["normal" | "overdrive"]
I just sent out v3[1] with your suggestion incorporated, but missed adding
you to Cc.
[1]: https://lore.kernel.org/all/20250113-imx8m-clk-v3-0-0d6e9bdeaa4e@pengutronix.de/
Thanks,
Ahmad
>
> Frank
>
>> Thanks,
>> Ahmad
>>
>>
>>>
>>> Frank
>>>
>>>> required:
>>>> - compatible
>>>> - reg
>>>> @@ -95,6 +103,12 @@ allOf:
>>>> - const: clk_ext2
>>>> - const: clk_ext3
>>>> - const: clk_ext4
>>>> + - if:
>>>> + required:
>>>> + - fsl,overdrive-mode
>>>> + then:
>>>> + properties:
>>>> + fsl,nominal-mode: false
>>>>
>>>> additionalProperties: false
>>>>
>>>>
>>>> --
>>>> 2.39.5
>>>>
>>>
>>
>>
>> --
>> Pengutronix e.K. | |
>> Steuerwalder Str. 21 | http://www.pengutronix.de/ |
>> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
>> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2025-01-13 13:59 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-06 14:21 [PATCH v2 0/6] arm64: dts: freescale: imx8mp-skov: switch to nominal drive mode Ahmad Fatoum
2025-01-06 14:21 ` [PATCH v2 1/6] dt-bindings: clock: imx8m: document nominal/overdrive properties Ahmad Fatoum
2025-01-06 16:41 ` Frank Li
2025-01-06 19:25 ` Ahmad Fatoum
2025-01-06 19:42 ` Frank Li
2025-01-06 19:55 ` Ahmad Fatoum
2025-01-07 6:52 ` Krzysztof Kozlowski
2025-01-13 13:51 ` Ahmad Fatoum
2025-01-13 13:52 ` Ahmad Fatoum
2025-01-06 14:21 ` [PATCH v2 2/6] arm64: dts: imx8mp: Add optional nominal drive mode DTSI Ahmad Fatoum
2025-01-06 14:21 ` [PATCH v2 3/6] arm64: dts: imx8mp: add fsl,nominal-mode property into nominal.dtsi Ahmad Fatoum
2025-01-06 14:21 ` [PATCH v2 4/6] arm64: dts: freescale: imx8mp-skov: fix LDB clock rate configuration Ahmad Fatoum
2025-01-06 14:21 ` [PATCH v2 5/6] arm64: dts: freescale: imx8mp-skov: operate SoC in nominal mode Ahmad Fatoum
2025-01-06 14:21 ` [PATCH v2 6/6] clk: imx8mp: inform CCF of maximum frequency of clocks Ahmad Fatoum
2025-01-06 23:42 ` Stephen Boyd
2025-01-13 13:48 ` Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).