]> code.ossystems Code Review - meta-freescale.git/commitdiff
imx-test: Add script to print system clocks
authorLeonardo Sandoval <leonardo.sandoval@freescale.com>
Thu, 10 Jan 2013 19:32:04 +0000 (13:32 -0600)
committerOtavio Salvador <otavio@ossystems.com.br>
Fri, 11 Jan 2013 12:43:28 +0000 (10:43 -0200)
This adds a 'clocks.sh' which can print the system clocks of the system.

[YOCTO #3586]

Signed-off-by: Leonardo Sandoval <leonardo.sandoval@freescale.com>
meta-fsl-arm/recipes-bsp/imx-test/imx-test.inc
meta-fsl-arm/recipes-bsp/imx-test/imx-test/clocks.sh [new file with mode: 0755]

index 52ead1c110448f08e71c5d2c6ecd32ae2a6d2864..b3b9a07c54a60dbbaa2b56856c4a6ea153e3e980 100644 (file)
@@ -11,7 +11,9 @@ PLATFORM_mx6 = "IMX6Q"
 PLATFORM_mx53 = "IMX53"
 PLATFORM_mx51 = "IMX51"
 
-SRC_URI = "${FSL_MIRROR}/imx-test-${PV}.tar.gz"
+SRC_URI = "${FSL_MIRROR}/imx-test-${PV}.tar.gz \
+           file://clocks.sh"
+
 
 do_compile() {
         LDFLAGS="" make PLATFORM=${PLATFORM} LINUXPATH=${STAGING_KERNEL_DIR} \
@@ -21,6 +23,7 @@ do_compile() {
 do_install() {
         install -d ${D}/unit_tests
         install -m 755 test-utils.sh ${D}/unit_tests/test-utils.sh
+        install -m 0755 ${WORKDIR}/clocks.sh ${D}/unit_tests/clocks.sh
         install -m 755 ${S}/platform/${PLATFORM}/* ${D}/unit_tests/
 }
 
diff --git a/meta-fsl-arm/recipes-bsp/imx-test/imx-test/clocks.sh b/meta-fsl-arm/recipes-bsp/imx-test/imx-test/clocks.sh
new file mode 100755 (executable)
index 0000000..2121bef
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+# This script is taken directly from the section 5.10 of the Freescale Application Note
+# AN4509 and it simple prints the CPU clocks in a nice format
+
+saved_path=$PWD
+if ! mount|grep -sq '/sys/kernel/debug'; then
+  mount -t debugfs none /sys/kernel/debug
+fi
+
+printf "%-24s %-20s %3s %9s\n" "clock" "parent" "use" "flags" "rate"
+
+for foo in $(find /sys/kernel/debug/clock -type d); do
+  if [ "$foo" = '/sys/kernel/debug/clock' ]; then
+    continue
+  fi
+  cd $foo
+  ec="$(cat usecount)"
+  rate="$(cat rate)"
+  flag="$(cat flags)"
+  clk="$(basename $foo)"
+  cd ..
+  parent="$(basename $PWD)"
+  if [ "$parent" = 'clock' ]; then
+    parent=" ---"
+  fi
+  printf "%-24s %-24s %2d %2d %10d\n" "$clk" "$parent" "$ec" "$flag" "$rate"
+  cd $saved_path
+done