aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAaro Koskinen <aaro.koskinen@iki.fi>2011-02-13 17:11:24 -0500
committerPaul Mundt <lethal@linux-sh.org>2011-03-22 02:20:19 -0400
commit74de5f4e52bf6e2ee1fe559d53c5dbf0d9d6e4cd (patch)
tree6037e0807a6d50276d125b4b3cc4253008495a18 /drivers
parent83ea0f164c35fb847afd9309be9ba40431fc501d (diff)
sisfb: move XGI POST RAM type detection into a subroutine
Move XGI POST RAM type detection into a separate subroutine to make further code changes easier. No changes in functionality Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Cc: Thomas Winischhofer <thomas@winischhofer.net> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/sis/sis_main.c57
1 files changed, 35 insertions, 22 deletions
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
index 2c5de66dacf8..364559b12fc5 100644
--- a/drivers/video/sis/sis_main.c
+++ b/drivers/video/sis/sis_main.c
@@ -4936,6 +4936,40 @@ sisfb_post_xgi_setclocks(struct sis_video_info *ivideo, u8 regb)
4936 sisfb_post_xgi_delay(ivideo, 0x43); 4936 sisfb_post_xgi_delay(ivideo, 0x43);
4937} 4937}
4938 4938
4939static u8 __devinit
4940sisfb_post_xgi_ramtype(struct sis_video_info *ivideo)
4941{
4942 unsigned char *bios = ivideo->bios_abase;
4943 u8 ramtype;
4944 u8 reg;
4945 u8 v1;
4946
4947 ramtype = 0x00; v1 = 0x10;
4948 if (ivideo->haveXGIROM) {
4949 ramtype = bios[0x62];
4950 v1 = bios[0x1d2];
4951 }
4952 if (!(ramtype & 0x80)) {
4953 if (ivideo->chip == XGI_20) {
4954 SiS_SetReg(SISCR, 0x97, v1);
4955 reg = SiS_GetReg(SISCR, 0x97);
4956 if (reg & 0x10) {
4957 ramtype = (reg & 0x01) << 1;
4958 }
4959 } else {
4960 reg = SiS_GetReg(SISSR, 0x39);
4961 ramtype = reg & 0x02;
4962 if (!(ramtype)) {
4963 reg = SiS_GetReg(SISSR, 0x3a);
4964 ramtype = (reg >> 1) & 0x01;
4965 }
4966 }
4967 }
4968 ramtype &= 0x07;
4969
4970 return ramtype;
4971}
4972
4939static int __devinit 4973static int __devinit
4940sisfb_post_xgi(struct pci_dev *pdev) 4974sisfb_post_xgi(struct pci_dev *pdev)
4941{ 4975{
@@ -5380,28 +5414,7 @@ sisfb_post_xgi(struct pci_dev *pdev)
5380 SiS_SetReg(SISSR, 0x1c, 0x00); 5414 SiS_SetReg(SISSR, 0x1c, 0x00);
5381 } 5415 }
5382 5416
5383 ramtype = 0x00; v1 = 0x10; 5417 ramtype = sisfb_post_xgi_ramtype(ivideo);
5384 if(ivideo->haveXGIROM) {
5385 ramtype = bios[0x62];
5386 v1 = bios[0x1d2];
5387 }
5388 if(!(ramtype & 0x80)) {
5389 if(ivideo->chip == XGI_20) {
5390 SiS_SetReg(SISCR, 0x97, v1);
5391 reg = SiS_GetReg(SISCR, 0x97);
5392 if(reg & 0x10) {
5393 ramtype = (reg & 0x01) << 1;
5394 }
5395 } else {
5396 reg = SiS_GetReg(SISSR, 0x39);
5397 ramtype = reg & 0x02;
5398 if(!(ramtype)) {
5399 reg = SiS_GetReg(SISSR, 0x3a);
5400 ramtype = (reg >> 1) & 0x01;
5401 }
5402 }
5403 }
5404 ramtype &= 0x07;
5405 5418
5406 regb = 0; /* ! */ 5419 regb = 0; /* ! */
5407 5420