aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaro Koskinen <aaro.koskinen@iki.fi>2011-02-13 17:11:28 -0500
committerPaul Mundt <lethal@linux-sh.org>2011-03-22 02:21:01 -0400
commit42dea903bf56414aa1eb299412a744b0fd269931 (patch)
tree26f924001e7d6056c33d0fa588b0b3217aae23f8
parentc9982d59c5c877a65fbdef3c875e82eaa95c2505 (diff)
sisfb: add support for XGI Z9 DDR2 POST
Add support for ZGI Z9 DDR2 POST. The init sequence is from XGI's xgifb driver. Tested with ARM board using a PCI card with XGI Z9s and 32 MB DDR2 memory. After a cold reset the POST succeeds. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Cc: Thomas Winischhofer <thomas@winischhofer.net> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--drivers/video/sis/sis_main.c77
1 files changed, 68 insertions, 9 deletions
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
index 9c52d7bbef70..75259845933d 100644
--- a/drivers/video/sis/sis_main.c
+++ b/drivers/video/sis/sis_main.c
@@ -4983,6 +4983,48 @@ sisfb_post_xgi_ddr2_mrs_default(struct sis_video_info *ivideo, u8 regb)
4983} 4983}
4984 4984
4985static void __devinit 4985static void __devinit
4986sisfb_post_xgi_ddr2_mrs_xg21(struct sis_video_info *ivideo)
4987{
4988 sisfb_post_xgi_setclocks(ivideo, 1);
4989
4990 SiS_SetReg(SISCR, 0x97, 0x11);
4991 sisfb_post_xgi_delay(ivideo, 0x46);
4992
4993 SiS_SetReg(SISSR, 0x18, 0x00); /* EMRS2 */
4994 SiS_SetReg(SISSR, 0x19, 0x80);
4995 SiS_SetReg(SISSR, 0x16, 0x05);
4996 SiS_SetReg(SISSR, 0x16, 0x85);
4997
4998 SiS_SetReg(SISSR, 0x18, 0x00); /* EMRS3 */
4999 SiS_SetReg(SISSR, 0x19, 0xc0);
5000 SiS_SetReg(SISSR, 0x16, 0x05);
5001 SiS_SetReg(SISSR, 0x16, 0x85);
5002
5003 SiS_SetReg(SISSR, 0x18, 0x00); /* EMRS1 */
5004 SiS_SetReg(SISSR, 0x19, 0x40);
5005 SiS_SetReg(SISSR, 0x16, 0x05);
5006 SiS_SetReg(SISSR, 0x16, 0x85);
5007
5008 SiS_SetReg(SISSR, 0x18, 0x42); /* MRS1 */
5009 SiS_SetReg(SISSR, 0x19, 0x02);
5010 SiS_SetReg(SISSR, 0x16, 0x05);
5011 SiS_SetReg(SISSR, 0x16, 0x85);
5012 sisfb_post_xgi_delay(ivideo, 1);
5013
5014 SiS_SetReg(SISSR, 0x1b, 0x04);
5015 sisfb_post_xgi_delay(ivideo, 1);
5016
5017 SiS_SetReg(SISSR, 0x1b, 0x00);
5018 sisfb_post_xgi_delay(ivideo, 1);
5019
5020 SiS_SetReg(SISSR, 0x18, 0x42); /* MRS1 */
5021 SiS_SetReg(SISSR, 0x19, 0x00);
5022 SiS_SetReg(SISSR, 0x16, 0x05);
5023 SiS_SetReg(SISSR, 0x16, 0x85);
5024 sisfb_post_xgi_delay(ivideo, 1);
5025}
5026
5027static void __devinit
4986sisfb_post_xgi_ddr2(struct sis_video_info *ivideo, u8 regb) 5028sisfb_post_xgi_ddr2(struct sis_video_info *ivideo, u8 regb)
4987{ 5029{
4988 unsigned char *bios = ivideo->bios_abase; 5030 unsigned char *bios = ivideo->bios_abase;
@@ -5000,6 +5042,7 @@ sisfb_post_xgi_ddr2(struct sis_video_info *ivideo, u8 regb)
5000 u8 v2; 5042 u8 v2;
5001 u8 v3; 5043 u8 v3;
5002 5044
5045 SiS_SetReg(SISCR, 0xb0, 0x80); /* DDR2 dual frequency mode */
5003 SiS_SetReg(SISCR, 0x82, 0x77); 5046 SiS_SetReg(SISCR, 0x82, 0x77);
5004 SiS_SetReg(SISCR, 0x86, 0x00); 5047 SiS_SetReg(SISCR, 0x86, 0x00);
5005 reg = SiS_GetReg(SISCR, 0x86); 5048 reg = SiS_GetReg(SISCR, 0x86);
@@ -5021,7 +5064,10 @@ sisfb_post_xgi_ddr2(struct sis_video_info *ivideo, u8 regb)
5021 SiS_SetReg(SISCR, 0x82, v3); 5064 SiS_SetReg(SISCR, 0x82, v3);
5022 SiS_SetReg(SISCR, 0x98, 0x01); 5065 SiS_SetReg(SISCR, 0x98, 0x01);
5023 SiS_SetReg(SISCR, 0x9a, 0x02); 5066 SiS_SetReg(SISCR, 0x9a, 0x02);
5024 sisfb_post_xgi_ddr2_default(ivideo, regb); 5067 if (sisfb_xgi_is21(ivideo))
5068 sisfb_post_xgi_ddr2_mrs_xg21(ivideo);
5069 else
5070 sisfb_post_xgi_ddr2_mrs_default(ivideo, regb);
5025} 5071}
5026 5072
5027static u8 __devinit 5073static u8 __devinit
@@ -5346,9 +5392,23 @@ sisfb_post_xgi(struct pci_dev *pdev)
5346 SiS_SetReg(SISCR, 0x77, v1); 5392 SiS_SetReg(SISCR, 0x77, v1);
5347 } 5393 }
5348 5394
5349 /* RAM type */ 5395 /* RAM type:
5350 5396 *
5351 regb = 0; /* ! */ 5397 * 0 == DDR1, 1 == DDR2, 2..7 == reserved?
5398 *
5399 * The code seems to written so that regb should equal ramtype,
5400 * however, so far it has been hardcoded to 0. Enable other values only
5401 * on XGI Z9, as it passes the POST, and add a warning for others.
5402 */
5403 ramtype = sisfb_post_xgi_ramtype(ivideo);
5404 if (!sisfb_xgi_is21(ivideo) && ramtype) {
5405 dev_warn(&pdev->dev,
5406 "RAM type something else than expected: %d\n",
5407 ramtype);
5408 regb = 0;
5409 } else {
5410 regb = ramtype;
5411 }
5352 5412
5353 v1 = 0xff; 5413 v1 = 0xff;
5354 if(ivideo->haveXGIROM) { 5414 if(ivideo->haveXGIROM) {
@@ -5500,7 +5560,10 @@ sisfb_post_xgi(struct pci_dev *pdev)
5500 } 5560 }
5501 } 5561 }
5502 5562
5503 SiS_SetReg(SISSR, 0x17, 0x00); 5563 if (regb == 1)
5564 SiS_SetReg(SISSR, 0x17, 0x80); /* DDR2 */
5565 else
5566 SiS_SetReg(SISSR, 0x17, 0x00); /* DDR1 */
5504 SiS_SetReg(SISSR, 0x1a, 0x87); 5567 SiS_SetReg(SISSR, 0x1a, 0x87);
5505 5568
5506 if(ivideo->chip == XGI_20) { 5569 if(ivideo->chip == XGI_20) {
@@ -5508,10 +5571,6 @@ sisfb_post_xgi(struct pci_dev *pdev)
5508 SiS_SetReg(SISSR, 0x1c, 0x00); 5571 SiS_SetReg(SISSR, 0x1c, 0x00);
5509 } 5572 }
5510 5573
5511 ramtype = sisfb_post_xgi_ramtype(ivideo);
5512
5513 regb = 0; /* ! */
5514
5515 switch(ramtype) { 5574 switch(ramtype) {
5516 case 0: 5575 case 0:
5517 sisfb_post_xgi_setclocks(ivideo, regb); 5576 sisfb_post_xgi_setclocks(ivideo, regb);