Lines 582-587
Link Here
|
582 |
return 0; |
582 |
return 0; |
583 |
} |
583 |
} |
584 |
|
584 |
|
|
|
585 |
static void radeon_detect_bios_type(struct radeonfb_info *rinfo) |
586 |
{ |
587 |
#ifndef CONFIG_PPC_OF |
588 |
int offset = rinfo->fp_bios_start + 4; |
589 |
unsigned char sign[4]; |
590 |
|
591 |
sign[0] = BIOS_IN8(offset); |
592 |
sign[1] = BIOS_IN8(offset + 1); |
593 |
sign[2] = BIOS_IN8(offset + 2); |
594 |
sign[3] = BIOS_IN8(offset + 3); |
595 |
|
596 |
if (!memcmp(sign, "ATOM", 4) || !memcmp(sign, "MOTA", 4)) { |
597 |
rinfo->is_atom_bios = 1; |
598 |
rinfo->atom_data_start = BIOS_IN16(rinfo->fp_bios_start + 32); |
599 |
|
600 |
printk(KERN_INFO "radeonfb: ATOM BIOS signature found\n"); |
601 |
|
602 |
return; |
603 |
} |
604 |
#endif /* NOT CONFIG_PPC_OF */ |
605 |
|
606 |
rinfo->is_atom_bios = 0; |
607 |
|
608 |
return; |
609 |
} |
610 |
|
585 |
/* |
611 |
/* |
586 |
* Retrieve PLL infos by different means (BIOS, Open Firmware, register probing...) |
612 |
* Retrieve PLL infos by different means (BIOS, Open Firmware, register probing...) |
587 |
*/ |
613 |
*/ |
Lines 658-677
Link Here
|
658 |
#endif /* CONFIG_PPC_OF || CONFIG_SPARC */ |
684 |
#endif /* CONFIG_PPC_OF || CONFIG_SPARC */ |
659 |
|
685 |
|
660 |
/* |
686 |
/* |
661 |
* Check out if we have an X86 which gave us some PLL informations |
687 |
* Check out if we have an ATOM BIOS which gave us some PLL informations |
662 |
* and if yes, retrieve them |
688 |
* and if yes, retrieve them |
663 |
*/ |
689 |
*/ |
|
|
690 |
|
664 |
if (!force_measure_pll && rinfo->bios_seg) { |
691 |
if (!force_measure_pll && rinfo->bios_seg) { |
665 |
u16 pll_info_block = BIOS_IN16(rinfo->fp_bios_start + 0x30); |
692 |
u16 pll_info_block; |
666 |
|
693 |
|
667 |
rinfo->pll.sclk = BIOS_IN16(pll_info_block + 0x08); |
694 |
if(rinfo->is_atom_bios) { |
668 |
rinfo->pll.mclk = BIOS_IN16(pll_info_block + 0x0a); |
695 |
pll_info_block = BIOS_IN16(rinfo->atom_data_start + 12); |
669 |
rinfo->pll.ref_clk = BIOS_IN16(pll_info_block + 0x0e); |
|
|
670 |
rinfo->pll.ref_div = BIOS_IN16(pll_info_block + 0x10); |
671 |
rinfo->pll.ppll_min = BIOS_IN32(pll_info_block + 0x12); |
672 |
rinfo->pll.ppll_max = BIOS_IN32(pll_info_block + 0x16); |
673 |
|
696 |
|
|
|
697 |
rinfo->pll.sclk = BIOS_IN32(pll_info_block + 8); |
698 |
rinfo->pll.mclk = BIOS_IN32(pll_info_block + 12); |
699 |
rinfo->pll.ref_clk = BIOS_IN16(pll_info_block + 82); |
700 |
rinfo->pll.ref_div = 0; /* Have to get it elsewhere */ |
701 |
rinfo->pll.ppll_min = BIOS_IN16(pll_info_block + 78); |
702 |
rinfo->pll.ppll_max = BIOS_IN32(pll_info_block + 32); |
703 |
} else { |
704 |
/* |
705 |
* Check out if we have an X86 which gave us some PLL informations |
706 |
* and if yes, retrieve them |
707 |
*/ |
708 |
pll_info_block = BIOS_IN16(rinfo->fp_bios_start + 0x30); |
709 |
|
710 |
rinfo->pll.sclk = BIOS_IN16(pll_info_block + 0x08); |
711 |
rinfo->pll.mclk = BIOS_IN16(pll_info_block + 0x0a); |
712 |
rinfo->pll.ref_clk = BIOS_IN16(pll_info_block + 0x0e); |
713 |
rinfo->pll.ref_div = BIOS_IN16(pll_info_block + 0x10); |
714 |
rinfo->pll.ppll_min = BIOS_IN32(pll_info_block + 0x12); |
715 |
rinfo->pll.ppll_max = BIOS_IN32(pll_info_block + 0x16); |
716 |
} |
674 |
printk(KERN_INFO "radeonfb: Retrieved PLL infos from BIOS\n"); |
717 |
printk(KERN_INFO "radeonfb: Retrieved PLL infos from BIOS\n"); |
|
|
718 |
|
675 |
goto found; |
719 |
goto found; |
676 |
} |
720 |
} |
677 |
|
721 |
|
Lines 687-704
Link Here
|
687 |
/* |
731 |
/* |
688 |
* Fall back to already-set defaults... |
732 |
* Fall back to already-set defaults... |
689 |
*/ |
733 |
*/ |
690 |
printk(KERN_INFO "radeonfb: Used default PLL infos\n"); |
734 |
printk(KERN_INFO "radeonfb: Fall back to default PLL infos\n"); |
691 |
|
735 |
|
692 |
found: |
736 |
found: |
|
|
737 |
/* Check and fix-up the PLL divisor if necessary */ |
738 |
if (rinfo->pll.ref_div < 2) { |
739 |
int tmp = INPLL(PPLL_REF_DIV); |
740 |
if (rinfo->family == CHIP_FAMILY_RS300) { |
741 |
rinfo->pll.ref_div = (tmp & R300_PPLL_REF_DIV_ACC_MASK) >> R300_PPLL_REF_DIV_ACC_SHIFT; |
742 |
} else { |
743 |
rinfo->pll.ref_div = tmp & PPLL_REF_DIV_MASK; |
744 |
} |
745 |
|
746 |
/* Sane default */ |
747 |
if (rinfo->pll.ref_div < 2) { |
748 |
printk(KERN_INFO "radeonfb: Set a sane default PLL divisor\n"); |
749 |
rinfo->pll.ref_div = 12; |
750 |
} |
751 |
} |
752 |
|
693 |
/* |
753 |
/* |
694 |
* Some methods fail to retrieve SCLK and MCLK values, we apply default |
754 |
* Some methods fail to retrieve SCLK and MCLK values, we apply default |
695 |
* settings in this case (200Mhz). If that really happne often, we could |
755 |
* settings in this case (200Mhz). If that really happen often, we could |
696 |
* fetch from registers instead... |
756 |
* fetch from registers instead... |
697 |
*/ |
757 |
*/ |
698 |
if (rinfo->pll.mclk == 0) |
758 |
if (rinfo->pll.mclk == 0) { |
|
|
759 |
printk(KERN_INFO "radeonfb: Set a sane default MCLK value\n"); |
699 |
rinfo->pll.mclk = 20000; |
760 |
rinfo->pll.mclk = 20000; |
700 |
if (rinfo->pll.sclk == 0) |
761 |
} |
|
|
762 |
if (rinfo->pll.mclk == 0) { |
763 |
printk(KERN_INFO "radeonfb: Set a sane default SCLK value\n"); |
701 |
rinfo->pll.sclk = 20000; |
764 |
rinfo->pll.sclk = 20000; |
|
|
765 |
} |
702 |
|
766 |
|
703 |
printk("radeonfb: Reference=%d.%02d MHz (RefDiv=%d) Memory=%d.%02d Mhz, System=%d.%02d MHz\n", |
767 |
printk("radeonfb: Reference=%d.%02d MHz (RefDiv=%d) Memory=%d.%02d Mhz, System=%d.%02d MHz\n", |
704 |
rinfo->pll.ref_clk / 100, rinfo->pll.ref_clk % 100, |
768 |
rinfo->pll.ref_clk / 100, rinfo->pll.ref_clk % 100, |
Lines 2302-2307
Link Here
|
2302 |
if (rinfo->bios_seg == NULL && rinfo->is_mobility) |
2366 |
if (rinfo->bios_seg == NULL && rinfo->is_mobility) |
2303 |
radeon_map_ROM(rinfo, pdev); |
2367 |
radeon_map_ROM(rinfo, pdev); |
2304 |
|
2368 |
|
|
|
2369 |
/* Check BIOS Type */ |
2370 |
radeon_detect_bios_type(rinfo); |
2371 |
|
2305 |
/* Get informations about the board's PLL */ |
2372 |
/* Get informations about the board's PLL */ |
2306 |
radeon_get_pllinfo(rinfo); |
2373 |
radeon_get_pllinfo(rinfo); |
2307 |
|
2374 |
|
Lines 2429-2434
Link Here
|
2429 |
|
2496 |
|
2430 |
radeonfb_bl_exit(rinfo); |
2497 |
radeonfb_bl_exit(rinfo); |
2431 |
|
2498 |
|
|
|
2499 |
radeonfb_bl_exit(rinfo); |
2500 |
|
2432 |
iounmap(rinfo->mmio_base); |
2501 |
iounmap(rinfo->mmio_base); |
2433 |
iounmap(rinfo->fb_base); |
2502 |
iounmap(rinfo->fb_base); |
2434 |
|
2503 |
|