3 * ATI Mach64 GX Support
6 #include <linux/delay.h>
8 #include <linux/sched.h>
12 #include <video/mach64.h>
15 /* Definitions for the ICS 2595 == ATI 18818_1 Clockchip */
17 #define REF_FREQ_2595 1432 /* 14.33 MHz (exact 14.31818) */
18 #define REF_DIV_2595 46 /* really 43 on ICS 2595 !!! */
20 #define MAX_FREQ_2595 15938 /* 159.38 MHz (really 170.486) */
21 #define MIN_FREQ_2595 8000 /* 80.00 MHz ( 85.565) */
22 /* mit Prescaler 2, 4, 8 */
23 #define ABS_MIN_FREQ_2595 1000 /* 10.00 MHz (really 10.697) */
24 #define N_ADJ_2595 257
26 #define STOP_BITS_2595 0x1800
43 static void aty_dac_waste4(const struct atyfb_par
*par
)
45 (void) aty_ld_8(DAC_REGS
, par
);
47 (void) aty_ld_8(DAC_REGS
+ 2, par
);
48 (void) aty_ld_8(DAC_REGS
+ 2, par
);
49 (void) aty_ld_8(DAC_REGS
+ 2, par
);
50 (void) aty_ld_8(DAC_REGS
+ 2, par
);
53 static void aty_StrobeClock(const struct atyfb_par
*par
)
59 tmp
= aty_ld_8(CLOCK_CNTL
, par
);
60 aty_st_8(CLOCK_CNTL
+ par
->clk_wr_offset
, tmp
| CLOCK_STROBE
, par
);
66 * IBM RGB514 DAC and Clock Chip
69 static void aty_st_514(int offset
, u8 val
, const struct atyfb_par
*par
)
71 aty_st_8(DAC_CNTL
, 1, par
);
73 aty_st_8(DAC_W_INDEX
, offset
& 0xff, par
);
75 aty_st_8(DAC_DATA
, (offset
>> 8) & 0xff, par
);
76 aty_st_8(DAC_MASK
, val
, par
);
77 aty_st_8(DAC_CNTL
, 0, par
);
80 static int aty_set_dac_514(const struct fb_info
*info
,
81 const union aty_pll
*pll
, u32 bpp
, u32 accel
)
83 struct atyfb_par
*par
= (struct atyfb_par
*) info
->par
;
92 0, 0x41, 0x03, 0x71, 0x45}, /* 8 bpp */
94 0, 0x45, 0x04, 0x0c, 0x01}, /* 555 */
96 0, 0x45, 0x06, 0x0e, 0x00}, /* XRGB */
112 aty_st_514(0x90, 0x00, par
); /* VRAM Mask Low */
113 aty_st_514(0x04, tab
[i
].pixel_dly
, par
); /* Horizontal Sync Control */
114 aty_st_514(0x05, 0x00, par
); /* Power Management */
115 aty_st_514(0x02, 0x01, par
); /* Misc Clock Control */
116 aty_st_514(0x71, tab
[i
].misc2_cntl
, par
); /* Misc Control 2 */
117 aty_st_514(0x0a, tab
[i
].pixel_rep
, par
); /* Pixel Format */
118 aty_st_514(tab
[i
].pixel_cntl_index
, tab
[i
].pixel_cntl_v1
, par
);
119 /* Misc Control 2 / 16 BPP Control / 32 BPP Control */
123 static int aty_var_to_pll_514(const struct fb_info
*info
, u32 vclk_per
,
124 u32 bpp
, union aty_pll
*pll
)
127 * FIXME: use real calculations instead of using fixed values from the old
131 u32 limit
; /* pixlock rounding limit (arbitrary) */
132 u8 m
; /* (df<<6) | vco_div_count */
133 u8 n
; /* ref_div_count */
134 } RGB514_clocks
[7] = {
136 8000, (3 << 6) | 20, 9}, /* 7395 ps / 135.2273 MHz */
138 10000, (1 << 6) | 19, 3}, /* 9977 ps / 100.2273 MHz */
140 13000, (1 << 6) | 2, 3}, /* 12509 ps / 79.9432 MHz */
142 14000, (2 << 6) | 8, 7}, /* 13394 ps / 74.6591 MHz */
144 16000, (1 << 6) | 44, 6}, /* 15378 ps / 65.0284 MHz */
146 25000, (1 << 6) | 15, 5}, /* 17460 ps / 57.2727 MHz */
148 50000, (0 << 6) | 53, 7}, /* 33145 ps / 30.1705 MHz */
152 for (i
= 0; i
< sizeof(RGB514_clocks
) / sizeof(*RGB514_clocks
);
154 if (vclk_per
<= RGB514_clocks
[i
].limit
) {
155 pll
->ibm514
.m
= RGB514_clocks
[i
].m
;
156 pll
->ibm514
.n
= RGB514_clocks
[i
].n
;
162 static u32
aty_pll_514_to_var(const struct fb_info
*info
,
163 const union aty_pll
*pll
)
165 struct atyfb_par
*par
= (struct atyfb_par
*) info
->par
;
166 u8 df
, vco_div_count
, ref_div_count
;
168 df
= pll
->ibm514
.m
>> 6;
169 vco_div_count
= pll
->ibm514
.m
& 0x3f;
170 ref_div_count
= pll
->ibm514
.n
;
172 return ((par
->ref_clk_per
* ref_div_count
) << (3 - df
))/
173 (vco_div_count
+ 65);
176 static void aty_set_pll_514(const struct fb_info
*info
,
177 const union aty_pll
*pll
)
179 struct atyfb_par
*par
= (struct atyfb_par
*) info
->par
;
181 aty_st_514(0x06, 0x02, par
); /* DAC Operation */
182 aty_st_514(0x10, 0x01, par
); /* PLL Control 1 */
183 aty_st_514(0x70, 0x01, par
); /* Misc Control 1 */
184 aty_st_514(0x8f, 0x1f, par
); /* PLL Ref. Divider Input */
185 aty_st_514(0x03, 0x00, par
); /* Sync Control */
186 aty_st_514(0x05, 0x00, par
); /* Power Management */
187 aty_st_514(0x20, pll
->ibm514
.m
, par
); /* F0 / M0 */
188 aty_st_514(0x21, pll
->ibm514
.n
, par
); /* F1 / N0 */
191 const struct aty_dac_ops aty_dac_ibm514
= {
192 .set_dac
= aty_set_dac_514
,
195 const struct aty_pll_ops aty_pll_ibm514
= {
196 .var_to_pll
= aty_var_to_pll_514
,
197 .pll_to_var
= aty_pll_514_to_var
,
198 .set_pll
= aty_set_pll_514
,
206 static int aty_set_dac_ATI68860_B(const struct fb_info
*info
,
207 const union aty_pll
*pll
, u32 bpp
,
210 struct atyfb_par
*par
= (struct atyfb_par
*) info
->par
;
211 u32 gModeReg
, devSetupRegA
, temp
, mask
;
220 0x60 | 0x00 /*(info->mach64DAC8Bit ? 0x00 : 0x01) */ ;
245 temp
= aty_ld_8(DAC_CNTL
, par
);
246 aty_st_8(DAC_CNTL
, (temp
& ~DAC_EXT_SEL_RS2
) | DAC_EXT_SEL_RS3
,
249 aty_st_8(DAC_REGS
+ 2, 0x1D, par
);
250 aty_st_8(DAC_REGS
+ 3, gModeReg
, par
);
251 aty_st_8(DAC_REGS
, 0x02, par
);
253 temp
= aty_ld_8(DAC_CNTL
, par
);
254 aty_st_8(DAC_CNTL
, temp
| DAC_EXT_SEL_RS2
| DAC_EXT_SEL_RS3
, par
);
256 if (info
->fix
.smem_len
< ONE_MB
)
258 else if (info
->fix
.smem_len
== ONE_MB
)
263 /* The following assumes that the BIOS has correctly set R7 of the
264 * Device Setup Register A at boot time.
266 #define A860_DELAY_L 0x80
268 temp
= aty_ld_8(DAC_REGS
, par
);
269 aty_st_8(DAC_REGS
, (devSetupRegA
| mask
) | (temp
& A860_DELAY_L
),
271 temp
= aty_ld_8(DAC_CNTL
, par
);
272 aty_st_8(DAC_CNTL
, (temp
& ~(DAC_EXT_SEL_RS2
| DAC_EXT_SEL_RS3
)),
275 aty_st_le32(BUS_CNTL
, 0x890e20f1, par
);
276 aty_st_le32(DAC_CNTL
, 0x47052100, par
);
280 const struct aty_dac_ops aty_dac_ati68860b
= {
281 .set_dac
= aty_set_dac_ATI68860_B
,
289 static int aty_set_dac_ATT21C498(const struct fb_info
*info
,
290 const union aty_pll
*pll
, u32 bpp
,
293 struct atyfb_par
*par
= (struct atyfb_par
*) info
->par
;
298 dotClock
= 100000000 / pll
->ics2595
.period_in_ps
;
302 if (dotClock
> 8000) {
322 if (1 /* info->mach64DAC8Bit */ )
326 aty_st_8(DAC_REGS
+ 2, DACMask
, par
);
328 aty_st_le32(BUS_CNTL
, 0x890e20f1, par
);
329 aty_st_le32(DAC_CNTL
, 0x00072000, par
);
333 const struct aty_dac_ops aty_dac_att21c498
= {
334 .set_dac
= aty_set_dac_ATT21C498
,
339 * ATI 18818 / ICS 2595 Clock Chip
342 static int aty_var_to_pll_18818(const struct fb_info
*info
, u32 vclk_per
,
343 u32 bpp
, union aty_pll
*pll
)
345 u32 MHz100
; /* in 0.01 MHz */
349 /* Calculate the programming word */
350 MHz100
= 100000000 / vclk_per
;
355 if (MHz100
> MAX_FREQ_2595
) {
356 MHz100
= MAX_FREQ_2595
;
358 } else if (MHz100
< ABS_MIN_FREQ_2595
) {
359 program_bits
= 0; /* MHz100 = 257 */
362 while (MHz100
< MIN_FREQ_2595
) {
368 MHz100
= (REF_DIV_2595
* MHz100
) / REF_FREQ_2595
;
370 MHz100
+= 500; /* + 0.5 round */
373 if (program_bits
== -1) {
374 program_bits
= MHz100
- N_ADJ_2595
;
375 switch (post_divider
) {
377 program_bits
|= 0x0600;
380 program_bits
|= 0x0400;
383 program_bits
|= 0x0200;
391 program_bits
|= STOP_BITS_2595
;
393 pll
->ics2595
.program_bits
= program_bits
;
394 pll
->ics2595
.locationAddr
= 0;
395 pll
->ics2595
.post_divider
= post_divider
;
396 pll
->ics2595
.period_in_ps
= vclk_per
;
401 static u32
aty_pll_18818_to_var(const struct fb_info
*info
,
402 const union aty_pll
*pll
)
404 return (pll
->ics2595
.period_in_ps
); /* default for now */
407 static void aty_ICS2595_put1bit(u8 data
, const struct atyfb_par
*par
)
412 tmp
= aty_ld_8(CLOCK_CNTL
, par
);
413 aty_st_8(CLOCK_CNTL
+ par
->clk_wr_offset
,
414 (tmp
& ~0x04) | (data
<< 2), par
);
416 tmp
= aty_ld_8(CLOCK_CNTL
, par
);
417 aty_st_8(CLOCK_CNTL
+ par
->clk_wr_offset
, (tmp
& ~0x08) | (0 << 3),
420 aty_StrobeClock(par
);
422 tmp
= aty_ld_8(CLOCK_CNTL
, par
);
423 aty_st_8(CLOCK_CNTL
+ par
->clk_wr_offset
, (tmp
& ~0x08) | (1 << 3),
426 aty_StrobeClock(par
);
430 static void aty_set_pll18818(const struct fb_info
*info
,
431 const union aty_pll
*pll
)
433 struct atyfb_par
*par
= (struct atyfb_par
*) info
->par
;
440 u8 old_crtc_ext_disp
;
442 old_clock_cntl
= aty_ld_8(CLOCK_CNTL
, par
);
443 aty_st_8(CLOCK_CNTL
+ par
->clk_wr_offset
, 0, par
);
445 old_crtc_ext_disp
= aty_ld_8(CRTC_GEN_CNTL
+ 3, par
);
446 aty_st_8(CRTC_GEN_CNTL
+ 3,
447 old_crtc_ext_disp
| (CRTC_EXT_DISP_EN
>> 24), par
);
449 mdelay(15); /* delay for 50 (15) ms */
451 program_bits
= pll
->ics2595
.program_bits
;
452 locationAddr
= pll
->ics2595
.locationAddr
;
454 /* Program the clock chip */
455 aty_st_8(CLOCK_CNTL
+ par
->clk_wr_offset
, 0, par
); /* Strobe = 0 */
456 aty_StrobeClock(par
);
457 aty_st_8(CLOCK_CNTL
+ par
->clk_wr_offset
, 1, par
); /* Strobe = 0 */
458 aty_StrobeClock(par
);
460 aty_ICS2595_put1bit(1, par
); /* Send start bits */
461 aty_ICS2595_put1bit(0, par
); /* Start bit */
462 aty_ICS2595_put1bit(0, par
); /* Read / ~Write */
464 for (i
= 0; i
< 5; i
++) { /* Location 0..4 */
465 aty_ICS2595_put1bit(locationAddr
& 1, par
);
469 for (i
= 0; i
< 8 + 1 + 2 + 2; i
++) {
470 aty_ICS2595_put1bit(program_bits
& 1, par
);
474 mdelay(1); /* delay for 1 ms */
476 (void) aty_ld_8(DAC_REGS
, par
); /* Clear DAC Counter */
477 aty_st_8(CRTC_GEN_CNTL
+ 3, old_crtc_ext_disp
, par
);
478 aty_st_8(CLOCK_CNTL
+ par
->clk_wr_offset
,
479 old_clock_cntl
| CLOCK_STROBE
, par
);
481 mdelay(50); /* delay for 50 (15) ms */
482 aty_st_8(CLOCK_CNTL
+ par
->clk_wr_offset
,
483 ((pll
->ics2595
.locationAddr
& 0x0F) | CLOCK_STROBE
), par
);
487 const struct aty_pll_ops aty_pll_ati18818_1
= {
488 .var_to_pll
= aty_var_to_pll_18818
,
489 .pll_to_var
= aty_pll_18818_to_var
,
490 .set_pll
= aty_set_pll18818
,
495 * STG 1703 Clock Chip
498 static int aty_var_to_pll_1703(const struct fb_info
*info
, u32 vclk_per
,
499 u32 bpp
, union aty_pll
*pll
)
501 u32 mhz100
; /* in 0.01 MHz */
503 /* u32 post_divider; */
504 u32 mach64MinFreq
, mach64MaxFreq
, mach64RefFreq
;
506 u16 remainder
, preRemainder
;
507 short divider
= 0, tempA
;
509 /* Calculate the programming word */
510 mhz100
= 100000000 / vclk_per
;
511 mach64MinFreq
= MIN_FREQ_2595
;
512 mach64MaxFreq
= MAX_FREQ_2595
;
513 mach64RefFreq
= REF_FREQ_2595
; /* 14.32 MHz */
515 /* Calculate program word */
519 if (mhz100
< mach64MinFreq
)
520 mhz100
= mach64MinFreq
;
521 if (mhz100
> mach64MaxFreq
)
522 mhz100
= mach64MaxFreq
;
525 while (mhz100
< (mach64MinFreq
<< 3)) {
530 temp
= (unsigned int) (mhz100
);
531 temp
= (unsigned int) (temp
* (MIN_N_1703
+ 2));
532 temp
-= (short) (mach64RefFreq
<< 1);
535 preRemainder
= 0xffff;
539 remainder
= tempB
% mach64RefFreq
;
540 tempB
= tempB
/ mach64RefFreq
;
542 if ((tempB
& 0xffff) <= 127
543 && (remainder
<= preRemainder
)) {
544 preRemainder
= remainder
;
549 ((tempB
& 0xff) << 8);
554 } while (tempA
<= (MIN_N_1703
<< 1));
556 program_bits
= divider
;
559 pll
->ics2595
.program_bits
= program_bits
;
560 pll
->ics2595
.locationAddr
= 0;
561 pll
->ics2595
.post_divider
= divider
; /* fuer nix */
562 pll
->ics2595
.period_in_ps
= vclk_per
;
567 static u32
aty_pll_1703_to_var(const struct fb_info
*info
,
568 const union aty_pll
*pll
)
570 return (pll
->ics2595
.period_in_ps
); /* default for now */
573 static void aty_set_pll_1703(const struct fb_info
*info
,
574 const union aty_pll
*pll
)
576 struct atyfb_par
*par
= (struct atyfb_par
*) info
->par
;
580 char old_crtc_ext_disp
;
582 old_crtc_ext_disp
= aty_ld_8(CRTC_GEN_CNTL
+ 3, par
);
583 aty_st_8(CRTC_GEN_CNTL
+ 3,
584 old_crtc_ext_disp
| (CRTC_EXT_DISP_EN
>> 24), par
);
586 program_bits
= pll
->ics2595
.program_bits
;
587 locationAddr
= pll
->ics2595
.locationAddr
;
592 (void) aty_ld_8(DAC_REGS
+ 2, par
);
593 aty_st_8(DAC_REGS
+ 2, (locationAddr
<< 1) + 0x20, par
);
594 aty_st_8(DAC_REGS
+ 2, 0, par
);
595 aty_st_8(DAC_REGS
+ 2, (program_bits
& 0xFF00) >> 8, par
);
596 aty_st_8(DAC_REGS
+ 2, (program_bits
& 0xFF), par
);
598 (void) aty_ld_8(DAC_REGS
, par
); /* Clear DAC Counter */
599 aty_st_8(CRTC_GEN_CNTL
+ 3, old_crtc_ext_disp
, par
);
603 const struct aty_pll_ops aty_pll_stg1703
= {
604 .var_to_pll
= aty_var_to_pll_1703
,
605 .pll_to_var
= aty_pll_1703_to_var
,
606 .set_pll
= aty_set_pll_1703
,
611 * Chrontel 8398 Clock Chip
614 static int aty_var_to_pll_8398(const struct fb_info
*info
, u32 vclk_per
,
615 u32 bpp
, union aty_pll
*pll
)
617 u32 tempA
, tempB
, fOut
, longMHz100
, diff
, preDiff
;
619 u32 mhz100
; /* in 0.01 MHz */
621 /* u32 post_divider; */
622 u32 mach64MinFreq
, mach64MaxFreq
, mach64RefFreq
;
623 u16 m
, n
, k
= 0, save_m
, save_n
, twoToKth
;
625 /* Calculate the programming word */
626 mhz100
= 100000000 / vclk_per
;
627 mach64MinFreq
= MIN_FREQ_2595
;
628 mach64MaxFreq
= MAX_FREQ_2595
;
629 mach64RefFreq
= REF_FREQ_2595
; /* 14.32 MHz */
634 /* Calculate program word */
638 if (mhz100
< mach64MinFreq
)
639 mhz100
= mach64MinFreq
;
640 if (mhz100
> mach64MaxFreq
)
641 mhz100
= mach64MaxFreq
;
643 longMHz100
= mhz100
* 256 / 100; /* 8 bit scale this */
645 while (mhz100
< (mach64MinFreq
<< 3)) {
652 preDiff
= 0xFFFFFFFF;
654 for (m
= MIN_M
; m
<= MAX_M
; m
++) {
655 for (n
= MIN_N
; n
<= MAX_N
; n
++) {
656 tempA
= 938356; /* 14.31818 * 65536 */
657 tempA
*= (n
+ 8); /* 43..256 */
658 tempB
= twoToKth
* 256;
659 tempB
*= (m
+ 2); /* 4..32 */
660 fOut
= tempA
/ tempB
; /* 8 bit scale */
662 if (longMHz100
> fOut
)
663 diff
= longMHz100
- fOut
;
665 diff
= fOut
- longMHz100
;
667 if (diff
< preDiff
) {
675 program_bits
= (k
<< 6) + (save_m
) + (save_n
<< 8);
678 pll
->ics2595
.program_bits
= program_bits
;
679 pll
->ics2595
.locationAddr
= 0;
680 pll
->ics2595
.post_divider
= 0;
681 pll
->ics2595
.period_in_ps
= vclk_per
;
686 static u32
aty_pll_8398_to_var(const struct fb_info
*info
,
687 const union aty_pll
*pll
)
689 return (pll
->ics2595
.period_in_ps
); /* default for now */
692 static void aty_set_pll_8398(const struct fb_info
*info
,
693 const union aty_pll
*pll
)
695 struct atyfb_par
*par
= (struct atyfb_par
*) info
->par
;
699 char old_crtc_ext_disp
;
702 old_crtc_ext_disp
= aty_ld_8(CRTC_GEN_CNTL
+ 3, par
);
703 aty_st_8(CRTC_GEN_CNTL
+ 3,
704 old_crtc_ext_disp
| (CRTC_EXT_DISP_EN
>> 24), par
);
706 program_bits
= pll
->ics2595
.program_bits
;
707 locationAddr
= pll
->ics2595
.locationAddr
;
710 tmp
= aty_ld_8(DAC_CNTL
, par
);
711 aty_st_8(DAC_CNTL
, tmp
| DAC_EXT_SEL_RS2
| DAC_EXT_SEL_RS3
, par
);
713 aty_st_8(DAC_REGS
, locationAddr
, par
);
714 aty_st_8(DAC_REGS
+ 1, (program_bits
& 0xff00) >> 8, par
);
715 aty_st_8(DAC_REGS
+ 1, (program_bits
& 0xff), par
);
717 tmp
= aty_ld_8(DAC_CNTL
, par
);
718 aty_st_8(DAC_CNTL
, (tmp
& ~DAC_EXT_SEL_RS2
) | DAC_EXT_SEL_RS3
,
721 (void) aty_ld_8(DAC_REGS
, par
); /* Clear DAC Counter */
722 aty_st_8(CRTC_GEN_CNTL
+ 3, old_crtc_ext_disp
, par
);
727 const struct aty_pll_ops aty_pll_ch8398
= {
728 .var_to_pll
= aty_var_to_pll_8398
,
729 .pll_to_var
= aty_pll_8398_to_var
,
730 .set_pll
= aty_set_pll_8398
,
735 * AT&T 20C408 Clock Chip
738 static int aty_var_to_pll_408(const struct fb_info
*info
, u32 vclk_per
,
739 u32 bpp
, union aty_pll
*pll
)
741 u32 mhz100
; /* in 0.01 MHz */
743 /* u32 post_divider; */
744 u32 mach64MinFreq
, mach64MaxFreq
, mach64RefFreq
;
746 u16 remainder
, preRemainder
;
747 short divider
= 0, tempA
;
749 /* Calculate the programming word */
750 mhz100
= 100000000 / vclk_per
;
751 mach64MinFreq
= MIN_FREQ_2595
;
752 mach64MaxFreq
= MAX_FREQ_2595
;
753 mach64RefFreq
= REF_FREQ_2595
; /* 14.32 MHz */
755 /* Calculate program word */
759 if (mhz100
< mach64MinFreq
)
760 mhz100
= mach64MinFreq
;
761 if (mhz100
> mach64MaxFreq
)
762 mhz100
= mach64MaxFreq
;
764 while (mhz100
< (mach64MinFreq
<< 3)) {
769 temp
= (unsigned int) mhz100
;
770 temp
= (unsigned int) (temp
* (MIN_N_408
+ 2));
771 temp
-= ((short) (mach64RefFreq
<< 1));
774 preRemainder
= 0xFFFF;
778 remainder
= tempB
% mach64RefFreq
;
779 tempB
= tempB
/ mach64RefFreq
;
780 if (((tempB
& 0xFFFF) <= 255)
781 && (remainder
<= preRemainder
)) {
782 preRemainder
= remainder
;
787 ((tempB
& 0xFF) << 8);
791 } while (tempA
<= 32);
793 program_bits
= divider
;
796 pll
->ics2595
.program_bits
= program_bits
;
797 pll
->ics2595
.locationAddr
= 0;
798 pll
->ics2595
.post_divider
= divider
; /* fuer nix */
799 pll
->ics2595
.period_in_ps
= vclk_per
;
804 static u32
aty_pll_408_to_var(const struct fb_info
*info
,
805 const union aty_pll
*pll
)
807 return (pll
->ics2595
.period_in_ps
); /* default for now */
810 static void aty_set_pll_408(const struct fb_info
*info
,
811 const union aty_pll
*pll
)
813 struct atyfb_par
*par
= (struct atyfb_par
*) info
->par
;
818 char old_crtc_ext_disp
;
820 old_crtc_ext_disp
= aty_ld_8(CRTC_GEN_CNTL
+ 3, par
);
821 aty_st_8(CRTC_GEN_CNTL
+ 3,
822 old_crtc_ext_disp
| (CRTC_EXT_DISP_EN
>> 24), par
);
824 program_bits
= pll
->ics2595
.program_bits
;
825 locationAddr
= pll
->ics2595
.locationAddr
;
829 tmpB
= aty_ld_8(DAC_REGS
+ 2, par
) | 1;
831 aty_st_8(DAC_REGS
+ 2, tmpB
, par
);
838 aty_st_8(DAC_REGS
, tmpB
, par
);
839 aty_st_8(DAC_REGS
+ 2, tmpA
, par
);
841 udelay(400); /* delay for 400 us */
843 locationAddr
= (locationAddr
<< 2) + 0x40;
845 tmpA
= program_bits
>> 8;
847 aty_st_8(DAC_REGS
, tmpB
, par
);
848 aty_st_8(DAC_REGS
+ 2, tmpA
, par
);
850 tmpB
= locationAddr
+ 1;
851 tmpA
= (u8
) program_bits
;
853 aty_st_8(DAC_REGS
, tmpB
, par
);
854 aty_st_8(DAC_REGS
+ 2, tmpA
, par
);
856 tmpB
= locationAddr
+ 2;
859 aty_st_8(DAC_REGS
, tmpB
, par
);
860 aty_st_8(DAC_REGS
+ 2, tmpA
, par
);
862 udelay(400); /* delay for 400 us */
863 tmpA
= tmpC
& (~(1 | 8));
866 aty_st_8(DAC_REGS
, tmpB
, par
);
867 aty_st_8(DAC_REGS
+ 2, tmpA
, par
);
869 (void) aty_ld_8(DAC_REGS
, par
); /* Clear DAC Counter */
870 aty_st_8(CRTC_GEN_CNTL
+ 3, old_crtc_ext_disp
, par
);
874 const struct aty_pll_ops aty_pll_att20c408
= {
875 .var_to_pll
= aty_var_to_pll_408
,
876 .pll_to_var
= aty_pll_408_to_var
,
877 .set_pll
= aty_set_pll_408
,
882 * Unsupported DAC and Clock Chip
885 static int aty_set_dac_unsupported(const struct fb_info
*info
,
886 const union aty_pll
*pll
, u32 bpp
,
889 struct atyfb_par
*par
= (struct atyfb_par
*) info
->par
;
891 aty_st_le32(BUS_CNTL
, 0x890e20f1, par
);
892 aty_st_le32(DAC_CNTL
, 0x47052100, par
);
893 /* new in 2.2.3p1 from Geert. ???????? */
894 aty_st_le32(BUS_CNTL
, 0x590e10ff, par
);
895 aty_st_le32(DAC_CNTL
, 0x47012100, par
);
899 static int dummy(void)
904 const struct aty_dac_ops aty_dac_unsupported
= {
905 .set_dac
= aty_set_dac_unsupported
,
908 const struct aty_pll_ops aty_pll_unsupported
= {
909 .var_to_pll
= (void *) dummy
,
910 .pll_to_var
= (void *) dummy
,
911 .set_pll
= (void *) dummy
,