diff options
Diffstat (limited to 'recipes-bsp/imx-test/imx-test/clocks.sh')
-rwxr-xr-x | recipes-bsp/imx-test/imx-test/clocks.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/recipes-bsp/imx-test/imx-test/clocks.sh b/recipes-bsp/imx-test/imx-test/clocks.sh new file mode 100755 index 0000000..2121bef --- /dev/null +++ b/recipes-bsp/imx-test/imx-test/clocks.sh | |||
@@ -0,0 +1,29 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # This script is taken directly from the section 5.10 of the Freescale Application Note | ||
4 | # AN4509 and it simple prints the CPU clocks in a nice format | ||
5 | |||
6 | saved_path=$PWD | ||
7 | if ! mount|grep -sq '/sys/kernel/debug'; then | ||
8 | mount -t debugfs none /sys/kernel/debug | ||
9 | fi | ||
10 | |||
11 | printf "%-24s %-20s %3s %9s\n" "clock" "parent" "use" "flags" "rate" | ||
12 | |||
13 | for foo in $(find /sys/kernel/debug/clock -type d); do | ||
14 | if [ "$foo" = '/sys/kernel/debug/clock' ]; then | ||
15 | continue | ||
16 | fi | ||
17 | cd $foo | ||
18 | ec="$(cat usecount)" | ||
19 | rate="$(cat rate)" | ||
20 | flag="$(cat flags)" | ||
21 | clk="$(basename $foo)" | ||
22 | cd .. | ||
23 | parent="$(basename $PWD)" | ||
24 | if [ "$parent" = 'clock' ]; then | ||
25 | parent=" ---" | ||
26 | fi | ||
27 | printf "%-24s %-24s %2d %2d %10d\n" "$clk" "$parent" "$ec" "$flag" "$rate" | ||
28 | cd $saved_path | ||
29 | done | ||