summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils/regtools/desc/regs-jz4760b.xml10
-rw-r--r--utils/regtools/qeditor/std_analysers.cpp82
-rw-r--r--utils/regtools/qeditor/std_analysers.h1
3 files changed, 87 insertions, 6 deletions
diff --git a/utils/regtools/desc/regs-jz4760b.xml b/utils/regtools/desc/regs-jz4760b.xml
index 1d0df1bdd8..01e9d3febb 100644
--- a/utils/regtools/desc/regs-jz4760b.xml
+++ b/utils/regtools/desc/regs-jz4760b.xml
@@ -1017,14 +1017,14 @@
1017 </instance> 1017 </instance>
1018 <register> 1018 <register>
1019 <field> 1019 <field>
1020 <name>SRC_SEL</name> 1020 <name>OUT_SEL</name>
1021 <position>30</position> 1021 <position>30</position>
1022 <enum> 1022 <enum>
1023 <name>EXCLK</name> 1023 <name>LCD_PANEL</name>
1024 <value>0x0</value> 1024 <value>0x0</value>
1025 </enum> 1025 </enum>
1026 <enum> 1026 <enum>
1027 <name>PLL</name> 1027 <name>TV_ENC</name>
1028 <value>0x1</value> 1028 <value>0x1</value>
1029 </enum> 1029 </enum>
1030 </field> 1030 </field>
@@ -1427,7 +1427,7 @@
1427 <node> 1427 <node>
1428 <name>COUNTH_BUF</name> 1428 <name>COUNTH_BUF</name>
1429 <instance> 1429 <instance>
1430 <name>OSTCNTH_BUF</name> 1430 <name>COUNTH_BUF</name>
1431 <address>0xfc</address> 1431 <address>0xfc</address>
1432 </instance> 1432 </instance>
1433 <register/> 1433 <register/>
@@ -2222,7 +2222,7 @@
2222 <name>TRIGGER</name> 2222 <name>TRIGGER</name>
2223 <title>Trigger</title> 2223 <title>Trigger</title>
2224 <instance> 2224 <instance>
2225 <name>TRG</name> 2225 <name>TRIGGER</name>
2226 <range> 2226 <range>
2227 <first>0</first> 2227 <first>0</first>
2228 <count>6</count> 2228 <count>6</count>
diff --git a/utils/regtools/qeditor/std_analysers.cpp b/utils/regtools/qeditor/std_analysers.cpp
index 05a90f9d5b..bc64c518c8 100644
--- a/utils/regtools/qeditor/std_analysers.cpp
+++ b/utils/regtools/qeditor/std_analysers.cpp
@@ -84,7 +84,10 @@ QWidget *ClockAnalyser::GetWidget()
84 84
85bool ClockAnalyser::SupportSoc(const QString& soc_name) 85bool ClockAnalyser::SupportSoc(const QString& soc_name)
86{ 86{
87 return (soc_name == "imx233" || soc_name == "rk27xx" || soc_name == "atj213x"); 87 return soc_name == "imx233"
88 || soc_name == "rk27xx"
89 || soc_name == "atj213x"
90 || soc_name == "jz4760b";
88} 91}
89 92
90QString ClockAnalyser::GetFreq(unsigned freq) 93QString ClockAnalyser::GetFreq(unsigned freq)
@@ -137,10 +140,87 @@ void ClockAnalyser::FillTree()
137 if(m_soc.get()->name == "imx233") FillTreeIMX233(); 140 if(m_soc.get()->name == "imx233") FillTreeIMX233();
138 else if(m_soc.get()->name == "rk27xx") FillTreeRK27XX(); 141 else if(m_soc.get()->name == "rk27xx") FillTreeRK27XX();
139 else if(m_soc.get()->name == "atj213x") FillTreeATJ213X(); 142 else if(m_soc.get()->name == "atj213x") FillTreeATJ213X();
143 else if(m_soc.get()->name == "jz4760b") FillTreeJZ4760B();
140 m_tree_widget->expandAll(); 144 m_tree_widget->expandAll();
141 m_tree_widget->resizeColumnToContents(0); 145 m_tree_widget->resizeColumnToContents(0);
142} 146}
143 147
148void ClockAnalyser::FillTreeJZ4760B()
149{
150 AddClock(0, "RTCLK", 32768);
151 // assume EXCLK is 12MHz, we have no way to knowing for sure but this is the
152 // recommended value anyway
153 QTreeWidgetItem *exclk = AddClock(0, "EXCLK", 12000000);
154 // PLL0
155 soc_word_t pllm, plln, pllod, pllbypass;
156 QTreeWidgetItem *pll0 = 0;
157 if(ReadFieldOld("CPM", "PLLCTRL0", "FEED_DIV", pllm) &&
158 ReadFieldOld("CPM", "PLLCTRL0", "IN_DIV", plln) &&
159 ReadFieldOld("CPM", "PLLCTRL0", "OUT_DIV", pllod) &&
160 ReadFieldOld("CPM", "PLLCTRL0", "BYPASS", pllbypass))
161 {
162 pll0 = AddClock(exclk, "PLL0", FROM_PARENT, pllbypass ? 1 : 2 * pllm,
163 pllbypass ? 1 : plln * (1 << pllod));
164 }
165 else
166 pll0 = AddClock(exclk, "PLL0", INVALID);
167 // PLL1
168 soc_word_t plldiv, src_sel;
169 QTreeWidgetItem *pll1 = 0;
170 if(ReadFieldOld("CPM", "PLLCTRL1", "FEED_DIV", pllm) &&
171 ReadFieldOld("CPM", "PLLCTRL1", "IN_DIV", plln) &&
172 ReadFieldOld("CPM", "PLLCTRL1", "OUT_DIV", pllod) &&
173 ReadFieldOld("CPM", "PLLCTRL1", "SRC_SEL", src_sel) &&
174 ReadFieldOld("CPM", "PLLCTRL1", "PLL0_DIV", plldiv))
175 {
176 pll1 = AddClock(src_sel ? pll0 : exclk, "PLL1", FROM_PARENT, 2 * pllm,
177 plln * (1 << pllod) * (src_sel ? plldiv : 1));
178 }
179 else
180 pll1 = AddClock(exclk, "PLL1", INVALID);
181 // system clocks
182 const int NR_SYSCLK = 6;
183 const char *sysclk[NR_SYSCLK] = { "CCLK", "SCLK", "PCLK", "HCLK", "H2CLK", "MCLK"};
184 for(int i = 0; i < NR_SYSCLK; i++)
185 {
186 soc_word_t div = 0;
187 std::string field = std::string(sysclk[i]) + "_DIV";
188 if(ReadFieldOld("CPM", "SYSCLK", field.c_str(), div))
189 {
190 switch(div)
191 {
192 case 0: div = 1; break;
193 case 1: div = 2; break;
194 case 2: div = 3; break;
195 case 3: div = 4; break;
196 case 4: div = 6; break;
197 case 5: div = 8; break;
198 default: div = 0; break;
199 }
200 }
201 if(div != 0)
202 AddClock(pll0, sysclk[i], FROM_PARENT, 1, div);
203 else
204 AddClock(pll0, sysclk[i], INVALID);
205 }
206 // common to msc, i2s, lcd, uhc, otg, ssi, pcm, gpu, gps
207 soc_word_t pll_div;
208 if(ReadFieldOld("CPM", "SYSCLK", "PLL_DIV", pll_div))
209 pll_div = pll_div ? 1 : 2;
210 else
211 pll_div = 1; // error
212 // lcd
213 soc_word_t pll_sel, div;
214 if(ReadFieldOld("CPM", "LCDCLK", "DIV", div) &&
215 ReadFieldOld("CPM", "LCDCLK", "PLL_SEL", pll_sel))
216 {
217 AddClock(pll_sel ? pll1 : pll0, "LCDCLK",
218 FROM_PARENT, 1, pll_div * (div + 1));
219 }
220 else
221 AddClock(exclk, "LCDCLK", INVALID);
222}
223
144void ClockAnalyser::FillTreeATJ213X() 224void ClockAnalyser::FillTreeATJ213X()
145{ 225{
146 soc_word_t pllbypass, pllclk, en, coreclks, tmp0, tmp1, tmp2, tmp3; 226 soc_word_t pllbypass, pllclk, en, coreclks, tmp0, tmp1, tmp2, tmp3;
diff --git a/utils/regtools/qeditor/std_analysers.h b/utils/regtools/qeditor/std_analysers.h
index 030e010f58..3ab4735e0a 100644
--- a/utils/regtools/qeditor/std_analysers.h
+++ b/utils/regtools/qeditor/std_analysers.h
@@ -77,6 +77,7 @@ private:
77 void FillTreeIMX233(); 77 void FillTreeIMX233();
78 void FillTreeRK27XX(); 78 void FillTreeRK27XX();
79 void FillTreeATJ213X(); 79 void FillTreeATJ213X();
80 void FillTreeJZ4760B();
80 81
81private: 82private:
82 QGroupBox *m_group; 83 QGroupBox *m_group;