* [U-Boot] [PATCH 2/2] mx6sxsabresd: Add thermal support
@ 2014-11-25 15:11 Fabio Estevam
2014-11-25 15:11 ` [U-Boot] [PATCH 1/2] mxc_ocotp: Do not disable the OCOTP clock after every access Fabio Estevam
2014-12-01 9:36 ` [U-Boot] [PATCH 2/2] mx6sxsabresd: Add thermal support Stefano Babic
0 siblings, 2 replies; 7+ messages in thread
From: Fabio Estevam @ 2014-11-25 15:11 UTC (permalink / raw)
To: u-boot
Add thermal support so that the temperature of the chip can be displayed on
boot:
U-Boot 2015.01-rc1-18268-g1366c05-dirty (Nov 25 2014 - 13:02:42)
CPU: Freescale i.MX6SX rev1.0 at 792 MHz
CPU: Temperature 50 C
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
include/configs/mx6sxsabresd.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/configs/mx6sxsabresd.h b/include/configs/mx6sxsabresd.h
index d8ab291..5e0edab 100644
--- a/include/configs/mx6sxsabresd.h
+++ b/include/configs/mx6sxsabresd.h
@@ -208,6 +208,16 @@
#define CONFIG_PCIE_IMX_POWER_GPIO IMX_GPIO_NR(2, 1)
#endif
+#define CONFIG_DM
+#define CONFIG_DM_THERMAL
+#define CONFIG_SYS_MALLOC_F_LEN (1 << 10)
+#define CONFIG_IMX6_THERMAL
+
+#define CONFIG_CMD_FUSE
+#if defined(CONFIG_CMD_FUSE) || defined(CONFIG_IMX6_THERMAL)
+#define CONFIG_MXC_OCOTP
+#endif
+
/* FLASH and environment organization */
#define CONFIG_SYS_NO_FLASH
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/2] mxc_ocotp: Do not disable the OCOTP clock after every access
2014-11-25 15:11 [U-Boot] [PATCH 2/2] mx6sxsabresd: Add thermal support Fabio Estevam
@ 2014-11-25 15:11 ` Fabio Estevam
2014-11-25 19:48 ` Benoît Thébaudeau
2014-12-01 9:36 ` Stefano Babic
2014-12-01 9:36 ` [U-Boot] [PATCH 2/2] mx6sxsabresd: Add thermal support Stefano Babic
1 sibling, 2 replies; 7+ messages in thread
From: Fabio Estevam @ 2014-11-25 15:11 UTC (permalink / raw)
To: u-boot
Leave the OCOTP turned on, so that we subsequent access do not fail.
After enabling the thermal driver on a mx6sxsabresd board:
U-Boot 2015.01-rc1-18267-g99d4189-dirty (Nov 24 2014 - 12:59:01)
CPU: Freescale i.MX6SX rev1.0 at 792 MHz
CPU: Temperature 48 C
Reset cause: POR
Board: MX6SX SABRE SDB
I2C: ready
DRAM: 1 GiB
PMIC: PFUZE100 ID=0x10
MMC: FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
00:01.0 - 16c3:abcd - Bridge device
01:00.0 - 8086:08b1 - Network controller
In: serial
Out: serial
Err: serial
Net:
(hang)
As the thermal driver accesses the ocotp registers, its clock will be disabled
afterwards.
Then when the MAC address is read (also from ocotp registers) it will cause a
hang.
Do not disable the ocotp clock to prevent this problem.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/misc/mxc_ocotp.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/misc/mxc_ocotp.c b/drivers/misc/mxc_ocotp.c
index 3de1245..67f9429 100644
--- a/drivers/misc/mxc_ocotp.c
+++ b/drivers/misc/mxc_ocotp.c
@@ -81,8 +81,6 @@ static int finish_access(struct ocotp_regs *regs, const char *caller)
err = !!(readl(®s->ctrl) & BM_CTRL_ERROR);
clear_error(regs);
- enable_ocotp_clk(0);
-
if (err) {
printf("mxc_ocotp %s(): Access protect error\n", caller);
return -EIO;
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/2] mxc_ocotp: Do not disable the OCOTP clock after every access
2014-11-25 15:11 ` [U-Boot] [PATCH 1/2] mxc_ocotp: Do not disable the OCOTP clock after every access Fabio Estevam
@ 2014-11-25 19:48 ` Benoît Thébaudeau
2014-11-25 19:56 ` Fabio Estevam
2014-12-01 9:36 ` Stefano Babic
1 sibling, 1 reply; 7+ messages in thread
From: Benoît Thébaudeau @ 2014-11-25 19:48 UTC (permalink / raw)
To: u-boot
Hi Fabio,
On Tue, Nov 25, 2014 at 4:11 PM, Fabio Estevam
<fabio.estevam@freescale.com> wrote:
> Leave the OCOTP turned on, so that we subsequent access do not fail.
>
> After enabling the thermal driver on a mx6sxsabresd board:
>
> U-Boot 2015.01-rc1-18267-g99d4189-dirty (Nov 24 2014 - 12:59:01)
>
> CPU: Freescale i.MX6SX rev1.0 at 792 MHz
> CPU: Temperature 48 C
> Reset cause: POR
> Board: MX6SX SABRE SDB
> I2C: ready
> DRAM: 1 GiB
> PMIC: PFUZE100 ID=0x10
> MMC: FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
> 00:01.0 - 16c3:abcd - Bridge device
> 01:00.0 - 8086:08b1 - Network controller
> In: serial
> Out: serial
> Err: serial
> Net:
> (hang)
>
> As the thermal driver accesses the ocotp registers, its clock will be disabled
> afterwards.
>
> Then when the MAC address is read (also from ocotp registers) it will cause a
> hang.
>
> Do not disable the ocotp clock to prevent this problem.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> drivers/misc/mxc_ocotp.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/misc/mxc_ocotp.c b/drivers/misc/mxc_ocotp.c
> index 3de1245..67f9429 100644
> --- a/drivers/misc/mxc_ocotp.c
> +++ b/drivers/misc/mxc_ocotp.c
> @@ -81,8 +81,6 @@ static int finish_access(struct ocotp_regs *regs, const char *caller)
> err = !!(readl(®s->ctrl) & BM_CTRL_ERROR);
> clear_error(regs);
>
> - enable_ocotp_clk(0);
> -
> if (err) {
> printf("mxc_ocotp %s(): Access protect error\n", caller);
> return -EIO;
That, or:
- Make imx_get_mac_from_fuse() call enable_ocotp_clk(1) before
reading the fuses, then call enable_ocotp_clk(0).
- Make enable_ocotp_clk() return the clock initial state and store it
in prepare_access(), then restore it in finish_access(). Same in
imx_get_mac_from_fuse().
Which of these 3 choices do you think would be the best?
Regards,
Beno?t
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/2] mxc_ocotp: Do not disable the OCOTP clock after every access
2014-11-25 19:48 ` Benoît Thébaudeau
@ 2014-11-25 19:56 ` Fabio Estevam
2014-11-25 20:13 ` Benoît Thébaudeau
0 siblings, 1 reply; 7+ messages in thread
From: Fabio Estevam @ 2014-11-25 19:56 UTC (permalink / raw)
To: u-boot
Hi Beno?t,
On Tue, Nov 25, 2014 at 5:48 PM, Beno?t Th?baudeau
<benoit.thebaudeau.dev@gmail.com> wrote:
> That, or:
> - Make imx_get_mac_from_fuse() call enable_ocotp_clk(1) before
> reading the fuses, then call enable_ocotp_clk(0).
Yes, I started with this exact same approach as well. It works, but
Nitin told me he also had similiar issues with hab.
Other issue I see with such approach is that if people would try to
read the ocotp registers manually in the U-boot prompt (via md.l
command), then they will also get a hang.
> - Make enable_ocotp_clk() return the clock initial state and store it
> in prepare_access(), then restore it in finish_access(). Same in
> imx_get_mac_from_fuse().
This would work as well, but with some more complexity. Still would
cause the hang via manual readings.
> Which of these 3 choices do you think would be the best?
I think the simplest one and the one that would be more general would
be the one proposed by this patch.
Regards,
Fabio Estevam
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/2] mxc_ocotp: Do not disable the OCOTP clock after every access
2014-11-25 19:56 ` Fabio Estevam
@ 2014-11-25 20:13 ` Benoît Thébaudeau
0 siblings, 0 replies; 7+ messages in thread
From: Benoît Thébaudeau @ 2014-11-25 20:13 UTC (permalink / raw)
To: u-boot
Hi Fabio,
On Tue, Nov 25, 2014 at 8:56 PM, Fabio Estevam <festevam@gmail.com> wrote:
> On Tue, Nov 25, 2014 at 5:48 PM, Beno?t Th?baudeau
> <benoit.thebaudeau.dev@gmail.com> wrote:
>
>> That, or:
>> - Make imx_get_mac_from_fuse() call enable_ocotp_clk(1) before
>> reading the fuses, then call enable_ocotp_clk(0).
>
> Yes, I started with this exact same approach as well. It works, but
> Nitin told me he also had similiar issues with hab.
>
> Other issue I see with such approach is that if people would try to
> read the ocotp registers manually in the U-boot prompt (via md.l
> command), then they will also get a hang.
If users access the OCOTP registers manually, they can also enable the
OCOTP clock in the corresponding register beforehand, even if this
complicates things.
>> - Make enable_ocotp_clk() return the clock initial state and store it
>> in prepare_access(), then restore it in finish_access(). Same in
>> imx_get_mac_from_fuse().
>
> This would work as well, but with some more complexity. Still would
> cause the hang via manual readings.
>
>> Which of these 3 choices do you think would be the best?
>
> I think the simplest one and the one that would be more general would
> be the one proposed by this patch.
The only possible issue that I see with leaving the OCOTP clock
enabled is the risk of inadvertently writing the fuses, either in
U-Boot or in the booted OS. That being said, Freescale advise against
leaving the fuses powered for production boards, in which cases there
is no such risk.
Reviewed-by: Beno?t Th?baudeau <benoit.thebaudeau.dev@gmail.com>
Regards,
Beno?t
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/2] mx6sxsabresd: Add thermal support
2014-11-25 15:11 [U-Boot] [PATCH 2/2] mx6sxsabresd: Add thermal support Fabio Estevam
2014-11-25 15:11 ` [U-Boot] [PATCH 1/2] mxc_ocotp: Do not disable the OCOTP clock after every access Fabio Estevam
@ 2014-12-01 9:36 ` Stefano Babic
1 sibling, 0 replies; 7+ messages in thread
From: Stefano Babic @ 2014-12-01 9:36 UTC (permalink / raw)
To: u-boot
On 25/11/2014 16:11, Fabio Estevam wrote:
> Add thermal support so that the temperature of the chip can be displayed on
> boot:
>
> U-Boot 2015.01-rc1-18268-g1366c05-dirty (Nov 25 2014 - 13:02:42)
>
> CPU: Freescale i.MX6SX rev1.0 at 792 MHz
> CPU: Temperature 50 C
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> include/configs/mx6sxsabresd.h | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/include/configs/mx6sxsabresd.h b/include/configs/mx6sxsabresd.h
> index d8ab291..5e0edab 100644
> --- a/include/configs/mx6sxsabresd.h
> +++ b/include/configs/mx6sxsabresd.h
> @@ -208,6 +208,16 @@
> #define CONFIG_PCIE_IMX_POWER_GPIO IMX_GPIO_NR(2, 1)
> #endif
>
> +#define CONFIG_DM
> +#define CONFIG_DM_THERMAL
> +#define CONFIG_SYS_MALLOC_F_LEN (1 << 10)
> +#define CONFIG_IMX6_THERMAL
> +
> +#define CONFIG_CMD_FUSE
> +#if defined(CONFIG_CMD_FUSE) || defined(CONFIG_IMX6_THERMAL)
> +#define CONFIG_MXC_OCOTP
> +#endif
> +
> /* FLASH and environment organization */
> #define CONFIG_SYS_NO_FLASH
>
>
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/2] mxc_ocotp: Do not disable the OCOTP clock after every access
2014-11-25 15:11 ` [U-Boot] [PATCH 1/2] mxc_ocotp: Do not disable the OCOTP clock after every access Fabio Estevam
2014-11-25 19:48 ` Benoît Thébaudeau
@ 2014-12-01 9:36 ` Stefano Babic
1 sibling, 0 replies; 7+ messages in thread
From: Stefano Babic @ 2014-12-01 9:36 UTC (permalink / raw)
To: u-boot
On 25/11/2014 16:11, Fabio Estevam wrote:
> Leave the OCOTP turned on, so that we subsequent access do not fail.
>
> After enabling the thermal driver on a mx6sxsabresd board:
>
> U-Boot 2015.01-rc1-18267-g99d4189-dirty (Nov 24 2014 - 12:59:01)
>
> CPU: Freescale i.MX6SX rev1.0 at 792 MHz
> CPU: Temperature 48 C
> Reset cause: POR
> Board: MX6SX SABRE SDB
> I2C: ready
> DRAM: 1 GiB
> PMIC: PFUZE100 ID=0x10
> MMC: FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
> 00:01.0 - 16c3:abcd - Bridge device
> 01:00.0 - 8086:08b1 - Network controller
> In: serial
> Out: serial
> Err: serial
> Net:
> (hang)
>
> As the thermal driver accesses the ocotp registers, its clock will be disabled
> afterwards.
>
> Then when the MAC address is read (also from ocotp registers) it will cause a
> hang.
>
> Do not disable the ocotp clock to prevent this problem.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> drivers/misc/mxc_ocotp.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/misc/mxc_ocotp.c b/drivers/misc/mxc_ocotp.c
> index 3de1245..67f9429 100644
> --- a/drivers/misc/mxc_ocotp.c
> +++ b/drivers/misc/mxc_ocotp.c
> @@ -81,8 +81,6 @@ static int finish_access(struct ocotp_regs *regs, const char *caller)
> err = !!(readl(®s->ctrl) & BM_CTRL_ERROR);
> clear_error(regs);
>
> - enable_ocotp_clk(0);
> -
> if (err) {
> printf("mxc_ocotp %s(): Access protect error\n", caller);
> return -EIO;
>
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-12-01 9:36 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-25 15:11 [U-Boot] [PATCH 2/2] mx6sxsabresd: Add thermal support Fabio Estevam
2014-11-25 15:11 ` [U-Boot] [PATCH 1/2] mxc_ocotp: Do not disable the OCOTP clock after every access Fabio Estevam
2014-11-25 19:48 ` Benoît Thébaudeau
2014-11-25 19:56 ` Fabio Estevam
2014-11-25 20:13 ` Benoît Thébaudeau
2014-12-01 9:36 ` Stefano Babic
2014-12-01 9:36 ` [U-Boot] [PATCH 2/2] mx6sxsabresd: Add thermal support Stefano Babic
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.