Skip to contentSkip to conversation

arm: imx-common: introduce back usec2ticks

PATCH New Peng Fan 3 participants 7 messages Apr 29, 2016 – May 10, 2016

Subsystems (2)
lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/1 arm: imx-common: introduce back usec2ticks

This commit "2bb014820c49a63902103bac710bc86b5772e843"
do some clean up to use the code in lib/time.c.
But usec2ticks is still being used by security related job ring code. Bring back the function to avoid build break.

Cc Stefano Babic <[email protected]>
---
 arch/arm/imx-common/timer.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
arch/arm/imx-common/timer.c +17 -0
index 92c7218..bde24af 100644
@@ -124,3 +124,20 @@ ulong get_tbclk(void)
 {
 	return gpt_get_clk();
 }
+
+/*
+ * This function is intended for SHORT delays only.
+ * It will overflow at around 10 seconds @ 400MHz,
+ * or 20 seconds @ 200MHz.
+ */
+unsigned long usec2ticks(unsigned long usec)
+{
+	ulong ticks;
+
+	if (usec < 1000)
+		ticks = ((usec * (get_tbclk()/1000)) + 500) / 1000;
+	else
+		ticks = ((usec / 10) * (get_tbclk() / 100000));
+
+	return ticks;
+}
Signature · 1 line
2.6.2
#1 lore raw

PATCH 1/1 arm: imx-common: introduce back usec2ticks

Quoted 7 lines · Peng Fan

This commit "2bb014820c49a63902103bac710bc86b5772e843"
do some clean up to use the code in lib/time.c.
But usec2ticks is still being used by security related job ring code. Bring back the function to avoid build break.

Cc Stefano Babic <[email protected]>

.... some option not enabled by default somewhere? I build test the world frequently..

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160502/9a339870/attachment.sig>
author
#2 lore raw

PATCH 1/1 arm: imx-common: introduce back usec2ticks

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 5 lines · Peng Fan

This commit "2bb014820c49a63902103bac710bc86b5772e843"
do some clean up to use the code in lib/time.c.
But usec2ticks is still being used by security related job ring code. Bring back the function to avoid build break.

Quoted 5 lines
Quoted 2 lines
Cc Stefano Babic <[email protected]>

.... some option not enabled by default somewhere? I build test the world frequently..

Yeah.

Security related options not enabled by default.

If enabled these for i.MX6,
#define CONFIG_SECURE_BOOT
#define CONFIG_SYS_FSL_SEC_COMPAT 4 /* HAB version */
#define CONFIG_FSL_CAAM
#define CONFIG_CMD_DEKBLOB
#define CONFIG_SYS_FSL_SEC_LE

Met the errors:

drivers/crypto/fsl/jr.c:333: undefined reference to `usec2ticks'

Regards,
Peng.

Quoted 3 lines
Signature · 2 lines
-- 
Tom
#3 lore raw

PATCH 1/1 arm: imx-common: introduce back usec2ticks

Quoted 28 lines · Peng Fan

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 5 lines · Peng Fan

This commit "2bb014820c49a63902103bac710bc86b5772e843"
do some clean up to use the code in lib/time.c.
But usec2ticks is still being used by security related job ring code. Bring back the function to avoid build break.

Quoted 5 lines
Quoted 2 lines
Cc Stefano Babic <[email protected]>

.... some option not enabled by default somewhere? I build test the world frequently..

Yeah.

Security related options not enabled by default.

If enabled these for i.MX6,
#define CONFIG_SECURE_BOOT
#define CONFIG_SYS_FSL_SEC_COMPAT 4 /* HAB version */
#define CONFIG_FSL_CAAM
#define CONFIG_CMD_DEKBLOB
#define CONFIG_SYS_FSL_SEC_LE

Quoted 3 lines

Met the errors:

drivers/crypto/fsl/jr.c:333: undefined reference to `usec2ticks'

I'd like to see this stuff moved over to Kconfig and a sample config enabled so things don't break in the future, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160502/2e041107/attachment.sig>
author
#4 lore raw

PATCH 1/1 arm: imx-common: introduce back usec2ticks

Hi Tom,

Quoted 29 lines · Tom Rini
Quoted 28 lines · Peng Fan

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 5 lines · Peng Fan

This commit "2bb014820c49a63902103bac710bc86b5772e843"
do some clean up to use the code in lib/time.c.
But usec2ticks is still being used by security related job ring code. Bring back the function to avoid build break.

Quoted 5 lines
Quoted 2 lines
Cc Stefano Babic <[email protected]>

.... some option not enabled by default somewhere? I build test the world frequently..

Yeah.

Security related options not enabled by default.

If enabled these for i.MX6,
#define CONFIG_SECURE_BOOT
#define CONFIG_SYS_FSL_SEC_COMPAT 4 /* HAB version */
#define CONFIG_FSL_CAAM
#define CONFIG_CMD_DEKBLOB
#define CONFIG_SYS_FSL_SEC_LE

Quoted 6 lines
Quoted 3 lines

Met the errors:

drivers/crypto/fsl/jr.c:333: undefined reference to `usec2ticks'

I'd like to see this stuff moved over to Kconfig and a sample config enabled so things don't break in the future, thanks!

Ok. Will add this support.

Will you directly pick up this patch or go through i.MX tree?

Thanks,
Peng.

Quoted 3 lines
Signature · 2 lines
-- 
Tom
author
#5 lore raw

PATCH 1/1 arm: imx-common: introduce back usec2ticks

In reply to Peng Fan

Hi Stefano,

Kindly ping..

Thanks,
Peng.

Quoted 39 lines · Peng Fan

This commit "2bb014820c49a63902103bac710bc86b5772e843"
do some clean up to use the code in lib/time.c.
But usec2ticks is still being used by security related job ring code. Bring back the function to avoid build break.

Cc Stefano Babic <[email protected]>

---
arch/arm/imx-common/timer.c | 17 +++++++++++++++++

1 file changed, 17 insertions(+)
arch/arm/imx-common/timer.c +17 -0
index 92c7218..bde24af 100644
@@ -124,3 +124,20 @@ ulong get_tbclk(void)
 {
 	return gpt_get_clk();
 }
+
+/*
+ * This function is intended for SHORT delays only.
+ * It will overflow at around 10 seconds @ 400MHz,
+ * or 20 seconds @ 200MHz.
+ */
+unsigned long usec2ticks(unsigned long usec)
+{
+	ulong ticks;
+
+	if (usec < 1000)
+		ticks = ((usec * (get_tbclk()/1000)) + 500) / 1000;
+	else
+		ticks = ((usec / 10) * (get_tbclk() / 100000));
+
+	return ticks;
+}
Signature · 1 line
2.6.2
#6 lore raw

PATCH 1/1 arm: imx-common: introduce back usec2ticks

Hi Peng,

Quoted 4 lines · Peng Fan

Hi Stefano,

Kindly ping..

I have maybe misunderstood the thread and I have supposed you want to send a V2 with the stuff related to secure moved to Kconfig, as requested by Tom. For that reason, you find your patch tagged with "Changes requested" in patchwork. Anyway, this can be done in a follow up patch.

I will completely agree if this is done separately.

Best regards,
Stefano

Quoted 42 lines

Thanks,
Peng.

Quoted 39 lines · Peng Fan

This commit "2bb014820c49a63902103bac710bc86b5772e843"
do some clean up to use the code in lib/time.c.
But usec2ticks is still being used by security related job ring code. Bring back the function to avoid build break.

Cc Stefano Babic <[email protected]>

---
arch/arm/imx-common/timer.c | 17 +++++++++++++++++

1 file changed, 17 insertions(+)
arch/arm/imx-common/timer.c +17 -0
index 92c7218..bde24af 100644
@@ -124,3 +124,20 @@ ulong get_tbclk(void)
 {
 	return gpt_get_clk();
 }
+
+/*
+ * This function is intended for SHORT delays only.
+ * It will overflow at around 10 seconds @ 400MHz,
+ * or 20 seconds @ 200MHz.
+ */
+unsigned long usec2ticks(unsigned long usec)
+{
+	ulong ticks;
+
+	if (usec < 1000)
+		ticks = ((usec * (get_tbclk()/1000)) + 500) / 1000;
+	else
+		ticks = ((usec / 10) * (get_tbclk() / 100000));
+
+	return ticks;
+}
Signature · 1 line
2.6.2
Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
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
=====================================================================