lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | ;create clocks area
|
| 2 | local &pll_reg
|
| 3 | local &foutvco
|
| 4 | local &fout2
|
| 5 | local &fout3
|
| 6 |
|
| 7 | area.create clocks 200 300
|
| 8 | area.clear clocks
|
| 9 |
|
| 10 | area.select clocks
|
| 11 | area.view clocks
|
| 12 |
|
| 13 | if state.run()
|
| 14 | (
|
| 15 | break
|
| 16 | )
|
| 17 |
|
| 18 | ;disable mmu
|
| 19 | &cr=data.long(c15:0x1)
|
| 20 | &tmp=&cr&(~0x1)
|
| 21 | per.s c15:0x1 %LONG &tmp
|
| 22 |
|
| 23 | print "*********************PLL********************************************"
|
| 24 | &pll_reg=0x0013b008
|
| 25 | &fref=26000000.
|
| 26 | print "check mpll..."
|
| 27 | Gosub calc_pll
|
| 28 |
|
| 29 | &pll_reg=0x0013b010
|
| 30 | &fref=26000000.
|
| 31 | print "check upll..."
|
| 32 | Gosub calc_pll
|
| 33 |
|
| 34 | &pll_reg=0x0013B018
|
| 35 | &tmp=data.long(D:0x0013B018)
|
| 36 | &tmp=(&tmp>>25)&0x3
|
| 37 | if (&tmp==1)
|
| 38 | (
|
| 39 | &fref=30720000.
|
| 40 | )
|
| 41 | else
|
| 42 | (
|
| 43 | &fref=26000000.
|
| 44 | )
|
| 45 | print "check dpll..."
|
| 46 | Gosub calc_pll
|
| 47 |
|
| 48 | &pll_reg=0x0013b110
|
| 49 | &fref=26000000.
|
| 50 | print "check gpll..."
|
| 51 | Gosub calc_pll
|
| 52 |
|
| 53 | print "*********************M0 CLK********************************************"
|
| 54 | &tmp=data.long(D:0x0013b038)
|
| 55 | &tmp=&tmp&0x3
|
| 56 | if (&tmp==0)
|
| 57 | (
|
| 58 | print "M0 clk sel main_clk"
|
| 59 | )
|
| 60 | if (&tmp==1)
|
| 61 | (
|
| 62 | print "M0 clk sel 104M"
|
| 63 | )
|
| 64 | if (&tmp==2)
|
| 65 | (
|
| 66 | print "M0 clk sel 78M"
|
| 67 | )
|
| 68 | if (&tmp==3)
|
| 69 | (
|
| 70 | print "M0 clk sel 32K"
|
| 71 | )
|
| 72 |
|
| 73 | print "*********************A53 CLK********************************************"
|
| 74 | &tmp=data.long(D:0x01306040)
|
| 75 | &tmp=&tmp&0x3
|
| 76 | if (&tmp==0)
|
| 77 | (
|
| 78 |
|
| 79 | print "ufi clk sel main_clk"
|
| 80 | )
|
| 81 | if (&tmp==1)
|
| 82 | (
|
| 83 | print "ufi clk sel 624M"
|
| 84 | )
|
| 85 | if (&tmp==2)
|
| 86 | (
|
| 87 | print "ufi clk sel 312M"
|
| 88 | )
|
| 89 | if (&tmp==3)
|
| 90 | (
|
| 91 | print "ufi clk sel 156M"
|
| 92 | )
|
| 93 |
|
| 94 | print "*********************PS CLK********************************************"
|
| 95 | &tmp=data.long(D:0x01306020)
|
| 96 | &tmp=&tmp&0x3
|
| 97 | if (&tmp==0)
|
| 98 | (
|
| 99 | print "pscpu clk sel main_clk"
|
| 100 | )
|
| 101 | if (&tmp==1)
|
| 102 | (
|
| 103 | print "pscpu clk sel 624M"
|
| 104 | )
|
| 105 | if (&tmp==2)
|
| 106 | (
|
| 107 | print "pscpu clk sel 312M"
|
| 108 | )
|
| 109 | if (&tmp==3)
|
| 110 | (
|
| 111 | print "pscpu clk sel 156M"
|
| 112 | )
|
| 113 |
|
| 114 | print "*********************PHY CLK********************************************"
|
| 115 | &tmp=data.long(D:0x01306030)
|
| 116 | &tmp=&tmp&0x3
|
| 117 | if (&tmp==0)
|
| 118 | (
|
| 119 | print "phycpu clk sel main_clk"
|
| 120 | )
|
| 121 | if (&tmp==1)
|
| 122 | (
|
| 123 | print "phycpu clk sel 491M"
|
| 124 | )
|
| 125 | if (&tmp==2)
|
| 126 | (
|
| 127 | print "phycpu clk sel 312M"
|
| 128 | )
|
| 129 | if (&tmp==3)
|
| 130 | (
|
| 131 | print "phycpu clk sel 156M"
|
| 132 | )
|
| 133 |
|
| 134 | print "*********************AXI CLK********************************************"
|
| 135 | &tmp=data.long(D:0x01306000)
|
| 136 | &tmp=&tmp&0x7
|
| 137 | if (&tmp==0)
|
| 138 | (
|
| 139 | print "axi clk sel main_clk"
|
| 140 | )
|
| 141 | if (&tmp==1)
|
| 142 | (
|
| 143 | print "axi clk sel 156M"
|
| 144 | )
|
| 145 | if (&tmp==2)
|
| 146 | (
|
| 147 | print "axi clk sel 124.8M"
|
| 148 | )
|
| 149 | if (&tmp==3)
|
| 150 | (
|
| 151 | print "axi clk sel 104M"
|
| 152 | )
|
| 153 | if (&tmp==4)
|
| 154 | (
|
| 155 | print "axi clk sel 78M"
|
| 156 | )
|
| 157 | if (&tmp==5)
|
| 158 | (
|
| 159 | print "axi clk sel 52M"
|
| 160 | )
|
| 161 | if (&tmp==6)
|
| 162 | (
|
| 163 | print "axi clk sel 39M"
|
| 164 | )
|
| 165 | if (&tmp==7)
|
| 166 | (
|
| 167 | print "axi clk sel 6.5M"
|
| 168 | )
|
| 169 |
|
| 170 | print "*********************DDR CLK********************************************"
|
| 171 | &tmp=data.long(D:0x01306050)
|
| 172 | &tmp=&tmp&0x3
|
| 173 | if (&tmp==0)
|
| 174 | (
|
| 175 | print "ddr io clk sel 312M"
|
| 176 | )
|
| 177 | if (&tmp==1)
|
| 178 | (
|
| 179 | print "ddr io clk sel 400M"
|
| 180 | )
|
| 181 | if (&tmp==2)
|
| 182 | (
|
| 183 | print "ddr io clk sel 208M"
|
| 184 | )
|
| 185 | if (&tmp==3)
|
| 186 | (
|
| 187 | print "ddr io clk sel 156M"
|
| 188 | )
|
| 189 | ;restore mmu config
|
| 190 | per.s c15:0x1 %LONG &cr
|
| 191 | ENDDO
|
| 192 |
|
| 193 |
|
| 194 | ;*****************************************************************
|
| 195 | calc_pll:
|
| 196 |
|
| 197 | local &tmp1
|
| 198 | local &tmp2
|
| 199 | &tmp1=data.long(D:&pll_reg)
|
| 200 | &tmp2=data.long(D:&pll_reg+0x4)
|
| 201 | &power=(&tmp1>>0x1f)&0x1
|
| 202 | if (&power==1)
|
| 203 | (
|
| 204 | print "pll is power down"
|
| 205 | )
|
| 206 | else
|
| 207 | (
|
| 208 | print "pll is power up"
|
| 209 | )
|
| 210 |
|
| 211 | &lock=(&tmp1>>0x1e)&0x1
|
| 212 | if (&lock==1)
|
| 213 | (
|
| 214 | print "pll is locked"
|
| 215 | )
|
| 216 | else
|
| 217 | (
|
| 218 | print "pll is unlocked"
|
| 219 | )
|
| 220 |
|
| 221 | &refdiv=(&tmp1>>0x12)&((0x1<<0x6)-1)
|
| 222 | &fbdiv=(&tmp1>>0x6)&((0x1<<0xc)-1)
|
| 223 | &frac=(&tmp2)&((0x1<<0x18)-1)
|
| 224 | &foutvco=(&fref/&refdiv)*(&fbdiv+&frac)
|
| 225 | print "pll foutvco="+"&foutvco"
|
| 226 |
|
| 227 | &postdiv1=(&tmp1>>0x3)&((0x1<<0x3)-0x1)
|
| 228 | &postdiv2=(&tmp1)&((0x1<<0x3)-0x1)
|
| 229 | &foutpostdiv=&foutvco/&postdiv1/&postdiv2
|
| 230 | &fout2=&foutpostdiv/0x2
|
| 231 | &fout3=&foutpostdiv/0x3
|
| 232 | &fout4=&foutpostdiv/0x4
|
| 233 | print "pll foutpostdiv="+"&foutpostdiv"
|
| 234 | print "pll fout2="+"&fout2"
|
| 235 | print "pll fout3="+"&fout3"
|
| 236 | print "pll fout4="+"&fout4"
|
| 237 |
|
| 238 | RETURN
|