Setting trip points is supported by the imx thermal driver and it is
useful to be able to test this without adjusting config.
Signed-off-by: Leonard Crestez <[email protected]>
---
arch/arm/configs/imx_v6_v7_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index bb6fa56..f7984a6 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -204,6 +204,7 @@ CONFIG_POWER_SUPPLY=y
CONFIG_SENSORS_GPIO_FAN=y
CONFIG_SENSORS_IIO_HWMON=y
CONFIG_THERMAL=y
+CONFIG_THERMAL_WRITABLE_TRIPS=y
CONFIG_CPU_THERMAL=y
CONFIG_IMX_THERMAL=y
CONFIG_WATCHDOG=y
--
2.7.4
This seems to work fine with the existing imx thermal driver on both 6ul
and 6ull. It was just missing in dts.
Signed-off-by: Leonard Crestez <[email protected]>
---
arch/arm/boot/dts/imx6ul.dtsi | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi
index b9d7d2d..cda5e9e 100644
--- a/arch/arm/boot/dts/imx6ul.dtsi
+++ b/arch/arm/boot/dts/imx6ul.dtsi
@@ -597,6 +597,14 @@
fsl,anatop = <&anatop>;
};
+ tempmon: tempmon {
+ compatible = "fsl,imx6ul-tempmon", "fsl,imx6sx-tempmon";
+ interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
+ fsl,tempmon = <&anatop>;
+ fsl,tempmon-data = <&ocotp>;
+ clocks = <&clks IMX6UL_CLK_PLL3_USB_OTG>;
+ };
+
snvs: snvs@020cc000 {
compatible = "fsl,sec-v4.0-mon", "syscon", "simple-mfd";
reg = <0x020cc000 0x4000>;
--
2.7.4
On Thu, Jun 8, 2017 at 1:26 PM, Leonard Crestez <[email protected]> wrote:
> + tempmon: tempmon {
> + compatible = "fsl,imx6ul-tempmon", "fsl,imx6sx-tempmon";
> + interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
> + fsl,tempmon = <&anatop>;
> + fsl,tempmon-data = <&ocotp>;
> + clocks = <&clks IMX6UL_CLK_PLL3_USB_OTG>;
Does the IMX6UL_CLK_PLL3_USB_OTG clock really control tempmon? Please
double check.
On Thu, 2017-06-08 at 13:45 -0300, Fabio Estevam wrote:
> On Thu, Jun 8, 2017 at 1:26 PM, Leonard Crestez wrote:
>
> >
> > + tempmon: tempmon {
> > + compatible = "fsl,imx6ul-tempmon", "fsl,imx6sx-tempmon";
> > + interrupts = ;
> > + fsl,tempmon = <&anatop>;
> > + fsl,tempmon-data = <&ocotp>;
> > + clocks = <&clks IMX6UL_CLK_PLL3_USB_OTG>;
> Does the IMX6UL_CLK_PLL3_USB_OTG clock really control tempmon? Please
> double check.
Yes, as far as I can tell the tempmon block uses the 480 Mhz PLL3 clock
directly. This is similar to other imx6 SOCs. This PLL is used for
stuff like USB but not only that. My understanding is the _USB_OTG
suffix is descriptive, similar to PLL4_AUDIO and PLL6_ENET. Other non-
usb components use PLL3 (like UART) but through other gates/dividers.
Setting this to IMX6UL_CLK_DUMMY will cause temperature reads to fail.
Even if PLL3 usually ends up being constantly enabled because of uarts
this is not true at imx_thermal_probe time (or uarts can be disabled).
--
Regards,
Leonard
On Fri, Jun 9, 2017 at 7:58 AM, Leonard Crestez <[email protected]> wrote:
> Yes, as far as I can tell the tempmon block uses the 480 Mhz PLL3 clock
> directly. This is similar to other imx6 SOCs. This PLL is used for
> stuff like USB but not only that. My understanding is the _USB_OTG
> suffix is descriptive, similar to PLL4_AUDIO and PLL6_ENET. Other non-
> usb components use PLL3 (like UART) but through other gates/dividers.
Yes, PLL3 can be a parent for the UART clock, but UART has its own clock gate.
> Setting this to IMX6UL_CLK_DUMMY will cause temperature reads to fail.
> Even if PLL3 usually ends up being constantly enabled because of uarts
> this is not true at imx_thermal_probe time (or uarts can be disabled).
Ok, thanks for confirming. It was not obvious from reading the
reference manual that the PLL3 clock is the gate for tempmon.
Hi,
On Fri, 9 Jun 2017 13:58:15 +0300 Leonard Crestez wrote:
> On Thu, 2017-06-08 at 13:45 -0300, Fabio Estevam wrote:
> > On Thu, Jun 8, 2017 at 1:26 PM, Leonard Crestez wrote:
> >
> > >
> > > + tempmon: tempmon {
> > > + compatible = "fsl,imx6ul-tempmon", "fsl,imx6sx-tempmon";
> > > + interrupts = ;
> > > + fsl,tempmon = <&anatop>;
> > > + fsl,tempmon-data = <&ocotp>;
> > > + clocks = <&clks IMX6UL_CLK_PLL3_USB_OTG>;
> > Does the IMX6UL_CLK_PLL3_USB_OTG clock really control tempmon? Please
> > double check.
>
> Yes, as far as I can tell the tempmon block uses the 480 Mhz PLL3 clock
> directly. This is similar to other imx6 SOCs. This PLL is used for
> stuff like USB but not only that. My understanding is the _USB_OTG
> suffix is descriptive, similar to PLL4_AUDIO and PLL6_ENET. Other non-
> usb components use PLL3 (like UART) but through other gates/dividers.
>
> Setting this to IMX6UL_CLK_DUMMY will cause temperature reads to fail.
> Even if PLL3 usually ends up being constantly enabled because of uarts
> this is not true at imx_thermal_probe time (or uarts can be disabled).
>
Since the driver is accessing the OCOTP registers it definitely needs
the IMX6UL_CLK_OCOTP too!
Lothar Waßmann
On Fri, 2017-06-09 at 15:46 +0200, Lothar Waßmann wrote:
> On Fri, 9 Jun 2017 13:58:15 +0300 Leonard Crestez wrote:
> > On Thu, 2017-06-08 at 13:45 -0300, Fabio Estevam wrote:
> > > On Thu, Jun 8, 2017 at 1:26 PM, Leonard Crestez wrote:
> > > > + tempmon: tempmon {
> > > > + compatible = "fsl,imx6ul-tempmon", "fsl,imx6sx-tempmon";
> > > > + interrupts = ;
> > > > + fsl,tempmon = <&anatop>;
> > > > + fsl,tempmon-data = <&ocotp>;
> > > > + clocks = <&clks IMX6UL_CLK_PLL3_USB_OTG>;
> > > Does the IMX6UL_CLK_PLL3_USB_OTG clock really control tempmon? Please
> > > double check.
> > Yes, as far as I can tell the tempmon block uses the 480 Mhz PLL3 clock
> > directly. This is similar to other imx6 SOCs. This PLL is used for
> > stuff like USB but not only that. My understanding is the _USB_OTG
> > suffix is descriptive, similar to PLL4_AUDIO and PLL6_ENET. Other non-
> > usb components use PLL3 (like UART) but through other gates/dividers.
> >
> > Setting this to IMX6UL_CLK_DUMMY will cause temperature reads to fail.
> > Even if PLL3 usually ends up being constantly enabled because of uarts
> > this is not true at imx_thermal_probe time (or uarts can be disabled).
> >
> Since the driver is accessing the OCOTP registers it definitely needs
> the IMX6UL_CLK_OCOTP too!
>
I don't think so. OCOTP reads fuse values into shadows registers on
chip reset and values seem to be available even if it's specific OCOTP
clock is off. I think that clock is only required for writes or shadow
updates.
In theory perhaps tempmon could be made to read ocotp through the imx-
ocotp nvmem driver? It is not clear in what scenario this would
actually be required.
This discussion is not specific to 6ul/6ull. There are other reads from
ocotp which don't enable it's clock, for example
imx6q_opp_check_speed_grading.
--
Regards,
Leonard
Hi,
On Fri, 9 Jun 2017 18:34:44 +0300 Leonard Crestez wrote:
> On Fri, 2017-06-09 at 15:46 +0200, Lothar Waßmann wrote:
> > On Fri, 9 Jun 2017 13:58:15 +0300 Leonard Crestez wrote:
> > > On Thu, 2017-06-08 at 13:45 -0300, Fabio Estevam wrote:
> > > > On Thu, Jun 8, 2017 at 1:26 PM, Leonard Crestez wrote:
> > > > > + tempmon: tempmon {
> > > > > + compatible = "fsl,imx6ul-tempmon", "fsl,imx6sx-tempmon";
> > > > > + interrupts = ;
> > > > > + fsl,tempmon = <&anatop>;
> > > > > + fsl,tempmon-data = <&ocotp>;
> > > > > + clocks = <&clks IMX6UL_CLK_PLL3_USB_OTG>;
> > > > Does the IMX6UL_CLK_PLL3_USB_OTG clock really control tempmon? Please
> > > > double check.
> > > Yes, as far as I can tell the tempmon block uses the 480 Mhz PLL3 clock
> > > directly. This is similar to other imx6 SOCs. This PLL is used for
> > > stuff like USB but not only that. My understanding is the _USB_OTG
> > > suffix is descriptive, similar to PLL4_AUDIO and PLL6_ENET. Other non-
> > > usb components use PLL3 (like UART) but through other gates/dividers.
> > >
> > > Setting this to IMX6UL_CLK_DUMMY will cause temperature reads to fail.
> > > Even if PLL3 usually ends up being constantly enabled because of uarts
> > > this is not true at imx_thermal_probe time (or uarts can be disabled).
> > >
> > Since the driver is accessing the OCOTP registers it definitely needs
> > the IMX6UL_CLK_OCOTP too!
> >
> I don't think so. OCOTP reads fuse values into shadows registers on
> chip reset and values seem to be available even if it's specific OCOTP
>
Shadow registers are registers nonetheless which require a clock for
accessing them.
> clock is off. I think that clock is only required for writes or shadow
> updates.
>
Sometimes it helps to read the Reference Manual or take hardware and try
it out. The i.MX6(Q|UL) Reference Manual lists the required clocks as:
Table 35-1. OCOTP Clocks
Clock name Clock Root Description
ipg_clk ipg_clk_root Peripheral clock
ipg_clk_s ipg_clk_root Peripheral access clock
and Table 18-3. "System Clocks, Gating, and Override (continued)"
for i.MX6UL shows:
OCOTP IPG_CLK IPG_CLK_ROOT CCGR2[CG6] (IIM_CLK_ENABLE)
IPG_CLK_S IPG_CLK_ROOT CCGR2[CG6] (IIM_CLK_ENABLE)
while the same table for i.MX6Q shows:
OCOTP ipg_clk ipg_clk_root CCGR2[CG6] (iim_clk_enable)
ipg_clk_s ipg_clk_root
with a blank entry in the "Clock Gating" column for the access clock.
So, for i.MX6Q there is no clock enable necessary for the access clock,
but for i.MX6UL there is!
You can simply verify it by trying to read any of the fuse registers
with the OCOTP clock disabled (which immediately hangs the processor).
> In theory perhaps tempmon could be made to read ocotp through the imx-
> ocotp nvmem driver? It is not clear in what scenario this would
> actually be required.
>
> This discussion is not specific to 6ul/6ull. There are other reads from
> ocotp which don't enable it's clock, for example
> imx6q_opp_check_speed_grading.
>
Which works, because i.MX6Q doesn't require to enable the OCOTP access
clock.
Lothar Waßmann
On Mon, 2017-06-12 at 12:40 +0200, Lothar Waßmann wrote:
> On Fri, 9 Jun 2017 18:34:44 +0300 Leonard Crestez wrote:
> >
> > On Fri, 2017-06-09 at 15:46 +0200, Lothar Waßmann wrote:
> > >
> > > On Fri, 9 Jun 2017 13:58:15 +0300 Leonard Crestez wrote:
> > > >
> > > > On Thu, 2017-06-08 at 13:45 -0300, Fabio Estevam wrote:
> > > > >
> > > > > On Thu, Jun 8, 2017 at 1:26 PM, Leonard Crestez wrote:
> > > > > >
> > > > > > + tempmon: tempmon {
> > > > > > + compatible = "fsl,imx6ul-tempmon", "fsl,imx6sx-tempmon";
> > > > > > + interrupts = ;
> > > > > > + fsl,tempmon = <&anatop>;
> > > > > > + fsl,tempmon-data = <&ocotp>;
> > > > > > + clocks = <&clks IMX6UL_CLK_PLL3_USB_OTG>;
> > > > > Does the IMX6UL_CLK_PLL3_USB_OTG clock really control tempmon? Please
> > > > > double check.
> > > > Yes, as far as I can tell the tempmon block uses the 480 Mhz PLL3 clock
> > > > directly. This is similar to other imx6 SOCs. This PLL is used for
> > > > stuff like USB but not only that. My understanding is the _USB_OTG
> > > > suffix is descriptive, similar to PLL4_AUDIO and PLL6_ENET. Other non-
> > > > usb components use PLL3 (like UART) but through other gates/dividers.
> > > >
> > > > Setting this to IMX6UL_CLK_DUMMY will cause temperature reads to fail.
> > > > Even if PLL3 usually ends up being constantly enabled because of uarts
> > > > this is not true at imx_thermal_probe time (or uarts can be disabled).
> > > >
> > > Since the driver is accessing the OCOTP registers it definitely needs
> > > the IMX6UL_CLK_OCOTP too!
> > >
> > I don't think so. OCOTP reads fuse values into shadows registers on
> > chip reset and values seem to be available even if it's specific OCOTP
> >
> Shadow registers are registers nonetheless which require a clock for
> accessing them.
>
> >
> > clock is off. I think that clock is only required for writes or shadow
> > updates.
> >
> Sometimes it helps to read the Reference Manual or take hardware and try
> it out. The i.MX6(Q|UL) Reference Manual lists the required clocks as:
> Table 35-1. OCOTP Clocks
> Clock name Clock Root Description
> ipg_clk ipg_clk_root Peripheral clock
> ipg_clk_s ipg_clk_root Peripheral access clock
>
> and Table 18-3. "System Clocks, Gating, and Override (continued)"
> for i.MX6UL shows:
> OCOTP IPG_CLK IPG_CLK_ROOT CCGR2[CG6] (IIM_CLK_ENABLE)
> IPG_CLK_S IPG_CLK_ROOT CCGR2[CG6] (IIM_CLK_ENABLE)
>
> while the same table for i.MX6Q shows:
> OCOTP ipg_clk ipg_clk_root CCGR2[CG6] (iim_clk_enable)
> ipg_clk_s ipg_clk_root
>
> with a blank entry in the "Clock Gating" column for the access clock.
> So, for i.MX6Q there is no clock enable necessary for the access clock,
> but for i.MX6UL there is!
>
> You can simply verify it by trying to read any of the fuse registers
> with the OCOTP clock disabled (which immediately hangs the processor).
I did check this on real hardware and it seems to work. Printing the
values read from OCOTP inside imx_get_sensor_data displays what looks
like valid data.
However it seems that this might be accidental, it just happens that
the OCOTP clock starts as enabled and is only disabled later in the
boot from "clk_disable_unused". But in theory imx-tempmon can be built
as a module so this is a real bug. It currently seems to already affect
imx6sx.
--
Regards,
Leonard
On Mon, Jun 12, 2017 at 8:47 AM, Leonard Crestez
<[email protected]> wrote:
> However it seems that this might be accidental, it just happens that
> the OCOTP clock starts as enabled and is only disabled later in the
Most likely because U-Boot enabled the OCOTP clock as it reads the
speed grading fuse.
Hi,
On Mon, 12 Jun 2017 10:22:45 -0300 Fabio Estevam wrote:
> On Mon, Jun 12, 2017 at 8:47 AM, Leonard Crestez
> <[email protected]> wrote:
>
> > However it seems that this might be accidental, it just happens that
> > the OCOTP clock starts as enabled and is only disabled later in the
>
> Most likely because U-Boot enabled the OCOTP clock as it reads the
> speed grading fuse.
>
No, the imx6q_opp_check_speed_grading() runs on an i.MX6Q which, as
mentioned in my other mail <[email protected]>,
does not require any clock to be enabled for accessing the OCOTP regs.
Lothar Waßmann
On Mon, Jun 12, 2017 at 10:37 AM, Lothar Waßmann <[email protected]> wrote:
> Hi,
>
> On Mon, 12 Jun 2017 10:22:45 -0300 Fabio Estevam wrote:
>> On Mon, Jun 12, 2017 at 8:47 AM, Leonard Crestez
>> <[email protected]> wrote:
>>
>> > However it seems that this might be accidental, it just happens that
>> > the OCOTP clock starts as enabled and is only disabled later in the
>>
>> Most likely because U-Boot enabled the OCOTP clock as it reads the
>> speed grading fuse.
>>
> No, the imx6q_opp_check_speed_grading() runs on an i.MX6Q which, as
> mentioned in my other mail <[email protected]>,
> does not require any clock to be enabled for accessing the OCOTP regs.
[Sorry I removed the list in my previous response by mistake]
What I was trying to say is that the OCOTP clock is enabled by U-Boot
on mx6ul evk board.
Please check:
http://git.denx.de/?p=u-boot.git;a=blob;f=board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c;h=a5746fe08688d5752bf1d69cff465a355404d6da;hb=HEAD#l833
This would explain why Leonard did not see the kernel hang on his test.
So I agree with you that the thermal driver needs the IMX6UL_CLK_OCOTP too.
On Thu, Jun 08, 2017 at 07:26:57PM +0300, Leonard Crestez wrote:
> Setting trip points is supported by the imx thermal driver and it is
> useful to be able to test this without adjusting config.
>
> Signed-off-by: Leonard Crestez <[email protected]>
Applied, thanks.