aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via/via_clock.c
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-03-25 22:29:18 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-03-25 22:53:21 -0400
commitbea02e45874a5d18127b0779740c4fd5b3e7e44a (patch)
tree745687a257530605a9bfef107b37f8dfa8e7ca96 /drivers/video/via/via_clock.c
parentb692a63af8b63a7a7e84702a713d0072e336b326 (diff)
viafb: add engine clock support
This patch adds support for enabling and configuring the engine on VIAs IGPs. This is the main clock used for everything but pixel output. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/via/via_clock.c')
-rw-r--r--drivers/video/via/via_clock.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/drivers/video/via/via_clock.c b/drivers/video/via/via_clock.c
index a829a246881c..af8f26b643c1 100644
--- a/drivers/video/via/via_clock.c
+++ b/drivers/video/via/via_clock.c
@@ -87,6 +87,15 @@ static inline void k800_set_secondary_pll_encoded(u32 data)
87 via_write_reg_mask(VIASR, 0x40, 0x00, 0x04); /* disable reset */ 87 via_write_reg_mask(VIASR, 0x40, 0x00, 0x04); /* disable reset */
88} 88}
89 89
90static inline void set_engine_pll_encoded(u32 data)
91{
92 via_write_reg_mask(VIASR, 0x40, 0x01, 0x01); /* enable reset */
93 via_write_reg(VIASR, 0x47, data & 0xFF);
94 via_write_reg(VIASR, 0x48, (data >> 8) & 0xFF);
95 via_write_reg(VIASR, 0x49, (data >> 16) & 0xFF);
96 via_write_reg_mask(VIASR, 0x40, 0x00, 0x01); /* disable reset */
97}
98
90static void cle266_set_primary_pll(struct via_pll_config config) 99static void cle266_set_primary_pll(struct via_pll_config config)
91{ 100{
92 cle266_set_primary_pll_encoded(cle266_encode_pll(config)); 101 cle266_set_primary_pll_encoded(cle266_encode_pll(config));
@@ -117,6 +126,16 @@ static void vx855_set_secondary_pll(struct via_pll_config config)
117 k800_set_secondary_pll_encoded(vx855_encode_pll(config)); 126 k800_set_secondary_pll_encoded(vx855_encode_pll(config));
118} 127}
119 128
129static void k800_set_engine_pll(struct via_pll_config config)
130{
131 set_engine_pll_encoded(k800_encode_pll(config));
132}
133
134static void vx855_set_engine_pll(struct via_pll_config config)
135{
136 set_engine_pll_encoded(vx855_encode_pll(config));
137}
138
120static void set_primary_pll_state(u8 state) 139static void set_primary_pll_state(u8 state)
121{ 140{
122 u8 value; 141 u8 value;
@@ -153,6 +172,24 @@ static void set_secondary_pll_state(u8 state)
153 via_write_reg_mask(VIASR, 0x2D, value, 0x0C); 172 via_write_reg_mask(VIASR, 0x2D, value, 0x0C);
154} 173}
155 174
175static void set_engine_pll_state(u8 state)
176{
177 u8 value;
178
179 switch (state) {
180 case VIA_STATE_ON:
181 value = 0x02;
182 break;
183 case VIA_STATE_OFF:
184 value = 0x00;
185 break;
186 default:
187 return;
188 }
189
190 via_write_reg_mask(VIASR, 0x2D, value, 0x03);
191}
192
156static void set_primary_clock_state(u8 state) 193static void set_primary_clock_state(u8 state)
157{ 194{
158 u8 value; 195 u8 value;
@@ -247,6 +284,11 @@ static void dummy_set_pll_state(u8 state)
247 printk(KERN_INFO "Using undocumented set PLL state.\n%s", via_slap); 284 printk(KERN_INFO "Using undocumented set PLL state.\n%s", via_slap);
248} 285}
249 286
287static void dummy_set_pll(struct via_pll_config config)
288{
289 printk(KERN_INFO "Using undocumented set PLL.\n%s", via_slap);
290}
291
250void via_clock_init(struct via_clock *clock, int gfx_chip) 292void via_clock_init(struct via_clock *clock, int gfx_chip)
251{ 293{
252 switch (gfx_chip) { 294 switch (gfx_chip) {
@@ -261,6 +303,9 @@ void via_clock_init(struct via_clock *clock, int gfx_chip)
261 clock->set_secondary_clock_source = dummy_set_clock_source; 303 clock->set_secondary_clock_source = dummy_set_clock_source;
262 clock->set_secondary_pll_state = dummy_set_pll_state; 304 clock->set_secondary_pll_state = dummy_set_pll_state;
263 clock->set_secondary_pll = cle266_set_secondary_pll; 305 clock->set_secondary_pll = cle266_set_secondary_pll;
306
307 clock->set_engine_pll_state = dummy_set_pll_state;
308 clock->set_engine_pll = dummy_set_pll;
264 break; 309 break;
265 case UNICHROME_K800: 310 case UNICHROME_K800:
266 case UNICHROME_PM800: 311 case UNICHROME_PM800:
@@ -280,6 +325,9 @@ void via_clock_init(struct via_clock *clock, int gfx_chip)
280 clock->set_secondary_clock_source = set_secondary_clock_source; 325 clock->set_secondary_clock_source = set_secondary_clock_source;
281 clock->set_secondary_pll_state = set_secondary_pll_state; 326 clock->set_secondary_pll_state = set_secondary_pll_state;
282 clock->set_secondary_pll = k800_set_secondary_pll; 327 clock->set_secondary_pll = k800_set_secondary_pll;
328
329 clock->set_engine_pll_state = set_engine_pll_state;
330 clock->set_engine_pll = k800_set_engine_pll;
283 break; 331 break;
284 case UNICHROME_VX855: 332 case UNICHROME_VX855:
285 case UNICHROME_VX900: 333 case UNICHROME_VX900:
@@ -292,6 +340,9 @@ void via_clock_init(struct via_clock *clock, int gfx_chip)
292 clock->set_secondary_clock_source = set_secondary_clock_source; 340 clock->set_secondary_clock_source = set_secondary_clock_source;
293 clock->set_secondary_pll_state = set_secondary_pll_state; 341 clock->set_secondary_pll_state = set_secondary_pll_state;
294 clock->set_secondary_pll = vx855_set_secondary_pll; 342 clock->set_secondary_pll = vx855_set_secondary_pll;
343
344 clock->set_engine_pll_state = set_engine_pll_state;
345 clock->set_engine_pll = vx855_set_engine_pll;
295 break; 346 break;
296 347
297 } 348 }