dump additional dss registers
[glsdk/util-scripts.git] / debug / dss_regdumps.sh
1 #!/bin/bash
2 # Author:- Venkateswara Rao Mandela
4 # Dump DSS dispc registers on DRA7xx
5 #For any queries, contact http://e2e.ti.com/support/omap/f/885
7 # Modify this string to --force <platname> if platform detection fails
8 FORCE_PLAT=""
10 # Set this variable to 1 when running against an Android Build
11 # The android shell has limited functionality. So this script runs
12 # omapconf via adb and parses the output on the host.
13 USE_ADB=0
15 # Define a function that wraps omapconf calls and removes the usual warning
16 # messages
17 oc_func() {
19     if [ "$USE_ADB" -eq 1 ]; then
20         OMAPCONF1="adb shell omapconf $FORCE_PLAT"
21     else
22         OMAPCONF1="omapconf $FORCE_PLAT"
23     fi
24     out_str=$($OMAPCONF1 "$@" 2>&1 | sed -e '/powerdm_deinit/d' -e '/clockdm_deinit/d' -e 's/[[:space:]]*$//')
25     echo "$out_str"
26 }
27 OMAPCONF=oc_func
29 read_reg() {
30     var=$($OMAPCONF read "$1")
31     echo "| $1    | 0x$var |"
32 }
34 get_field() {
35 start=$1
36 offset=$2
37 shift=$3
38 mask=$4
39         addr=`printf "0x%08x" $(( $start + $offset ))`
40         val=0x$($OMAPCONF read "$addr")
41         fld=`printf "0x%08x" $(( $val >> $shift ))`
42         fld=`printf "%d" $(( $fld & $mask ))`
43         echo $fld
44 }
46 echo "|----------------------------|
47 | Address (hex) | Data (hex) |
48 |----------------------------|"
50 # DSS Register Mapping Summary. Table 11-17
51 read_reg 0x58000000
52 read_reg 0x58000010
53 read_reg 0x58000014
54 read_reg 0x58000040
55 read_reg 0x5800005C
57 # OCP2SCP2 Register Mapping Summary. Table 11-26
58 read_reg 0x4A0A0000
59 read_reg 0x4A0A0010
60 read_reg 0x4A0A0014
61 read_reg 0x4A0A0018
63 # Table 11-79, 11-80 DSI registers
64 read_reg 0x58004054
65 read_reg 0x58005054
67 echo "|----------------------------|"
70 # Video 1 PLL registers
71 base=0x58004300
72 end=0x58004320
73 $OMAPCONF dump $base $end
75 # HDMI PLL registers
76 base=0x58040200
77 end=0x58040220
78 $OMAPCONF dump $base $end
80 dss_pll=0x4a002538
81 status=$(get_field $dss_pll 0x0  1 0x1)
82 if [ "$status" = "0" ]; then
83     # Video 2 PLL registers
84     base=0x58009300
85     end=0x58009320
86     $OMAPCONF dump $base $end
87 fi
89 # HDMI WP registers
90 base=0x58040000
91 end=0x58040094
92 $OMAPCONF dump $base $end
94 base=0x58001000
95 end=0x58001700
96 $OMAPCONF dump $base $end
98 base=0x58001700
99 end=0x58001800
100 $OMAPCONF dump $base $end
102 base=0x58001800
103 end=0x58001870
104 $OMAPCONF dump $base $end