Skip to contentSkip to conversation

lib: make strmhz available in SPL

RFC PATCH Superseded Chris Packham 4 participants 5 messages May 25, 2016 – Jun 6, 2016 Library code

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 lib: make strmhz available in SPL

From: Chris Packham <[email protected]>

When setting up a DDR controller it is useful to be able to display frequencies in a readable form. Make the strmhz() function available in SPL builds provided there is full vsprintf available.

---

 lib/Makefile | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
lib/Makefile +2 -3
index 02dfa29..f77befe 100644
@@ -42,7 +42,6 @@ obj-y += rc4.o
 obj-$(CONFIG_SHA1) += sha1.o
 obj-$(CONFIG_SUPPORT_EMMC_RPMB) += sha256.o
 obj-$(CONFIG_SHA256) += sha256.o
-obj-y	+= strmhz.o
 obj-$(CONFIG_TPM) += tpm.o
 obj-$(CONFIG_RBTREE)	+= rbtree.o
 obj-$(CONFIG_BITREVERSE) += bitrev.o
@@ -85,11 +84,11 @@ ifdef CONFIG_SPL_BUILD
 ifdef CONFIG_USE_TINY_PRINTF
 obj-$(CONFIG_SPL_SERIAL_SUPPORT) += tiny-printf.o panic.o strto.o
 else
-obj-$(CONFIG_SPL_SERIAL_SUPPORT) += vsprintf.o panic.o strto.o
+obj-$(CONFIG_SPL_SERIAL_SUPPORT) += vsprintf.o panic.o strto.o strmhz.o
 endif
 else
 # Main U-Boot always uses the full printf support
-obj-y += vsprintf.o panic.o strto.o
+obj-y += vsprintf.o panic.o strto.o strmhz.o
 endif
 
 subdir-ccflags-$(CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED) += -O2
Signature · 1 line
2.8.2
#1 lore raw

RFC PATCH 1/1 lib: make strmhz available in SPL

Hi Chris,

Quoted 6 lines · Chris Packham

From: Chris Packham <[email protected]>

When setting up a DDR controller it is useful to be able to display frequencies in a readable form. Make the strmhz() function available in SPL builds provided there is full vsprintf available.

Quoted 6 lines

---

 lib/Makefile | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

I notice there is print_freq(). Should these be rationalised?

Regards,
Simon

#2 lore raw

RFC PATCH 1/1 lib: make strmhz available in SPL

Quoted 13 lines · Simon Glass

Hi Chris,

Quoted 10 lines · Chris Packham

From: Chris Packham <[email protected]>

When setting up a DDR controller it is useful to be able to display frequencies in a readable form. Make the strmhz() function available in SPL builds provided there is full vsprintf available.

---

Quoted 6 lines
Quoted 2 lines
  lib/Makefile | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

I notice there is print_freq(). Should these be rationalised?

They appear to do different things. strmhz() populates a string with a value in MHz rounded to 3 places (i.e. the nearest KHz). print_freq() can handle Hz, KHz, MHz and GHz it also prints the output directly rather than to a user supplied buffer.

strmhz() is much more widely used but both strmhz() and print_freq() are used in command output ("bdinfo" and "cpu detail" respectively) so I don't think it would be a simple case of swapping one for the other.

#3 lore raw

PATCH v2 1/1 lib: make strmhz available in SPL

In reply to Simon Glass

From: Chris Packham <[email protected]>

When setting up a DDR controller it is useful to be able to display frequencies in a readable form. Make the strmhz() function available in SPL builds provided there is full vsprintf available.

---
Changes in v2:
- Collect review from Simon
- Drop RFC

 lib/Makefile | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
lib/Makefile +2 -3
index 02dfa29..f77befe 100644
@@ -42,7 +42,6 @@ obj-y += rc4.o
 obj-$(CONFIG_SHA1) += sha1.o
 obj-$(CONFIG_SUPPORT_EMMC_RPMB) += sha256.o
 obj-$(CONFIG_SHA256) += sha256.o
-obj-y	+= strmhz.o
 obj-$(CONFIG_TPM) += tpm.o
 obj-$(CONFIG_RBTREE)	+= rbtree.o
 obj-$(CONFIG_BITREVERSE) += bitrev.o
@@ -85,11 +84,11 @@ ifdef CONFIG_SPL_BUILD
 ifdef CONFIG_USE_TINY_PRINTF
 obj-$(CONFIG_SPL_SERIAL_SUPPORT) += tiny-printf.o panic.o strto.o
 else
-obj-$(CONFIG_SPL_SERIAL_SUPPORT) += vsprintf.o panic.o strto.o
+obj-$(CONFIG_SPL_SERIAL_SUPPORT) += vsprintf.o panic.o strto.o strmhz.o
 endif
 else
 # Main U-Boot always uses the full printf support
-obj-y += vsprintf.o panic.o strto.o
+obj-y += vsprintf.o panic.o strto.o strmhz.o
 endif
 
 subdir-ccflags-$(CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED) += -O2
Signature · 1 line
2.8.2
#4 lore raw

PATCH v2 1/1 lib: make strmhz available in SPL

Quoted 9 lines · Chris Packham

From: Chris Packham <[email protected]>

When setting up a DDR controller it is useful to be able to display frequencies in a readable form. Make the strmhz() function available in SPL builds provided there is full vsprintf available.

Applied to u-boot/master, 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/20160606/74723103/attachment.sig>