aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/sis
diff options
context:
space:
mode:
authorAaro Koskinen <aaro.koskinen@iki.fi>2011-02-13 17:11:23 -0500
committerPaul Mundt <lethal@linux-sh.org>2011-03-22 02:20:05 -0400
commit83ea0f164c35fb847afd9309be9ba40431fc501d (patch)
tree209fd310e1a3039a9faa55b12541c494e6ffddfc /drivers/video/sis
parent1721af4d8581587409d66d4fe0be6bc455611e5b (diff)
sisfb: POST should fail if R/W test fails
Currently there is no indication if R/W test fails during POST. This can happen e.g. when user plugs in a card with unsupported type of memory. Since the driver will be unusable, it's better to fail the whole POST if the memory cannot be configured properly. 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/video/sis')
-rw-r--r--drivers/video/sis/sis_main.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
index 2fb8c5a660fb..2c5de66dacf8 100644
--- a/drivers/video/sis/sis_main.c
+++ b/drivers/video/sis/sis_main.c
@@ -4627,11 +4627,11 @@ sisfb_post_xgi_rwtest(struct sis_video_info *ivideo, int starta,
4627 return 1; 4627 return 1;
4628} 4628}
4629 4629
4630static void __devinit 4630static int __devinit
4631sisfb_post_xgi_ramsize(struct sis_video_info *ivideo) 4631sisfb_post_xgi_ramsize(struct sis_video_info *ivideo)
4632{ 4632{
4633 unsigned int buswidth, ranksize, channelab, mapsize; 4633 unsigned int buswidth, ranksize, channelab, mapsize;
4634 int i, j, k, l; 4634 int i, j, k, l, status;
4635 u8 reg, sr14; 4635 u8 reg, sr14;
4636 static const u8 dramsr13[12 * 5] = { 4636 static const u8 dramsr13[12 * 5] = {
4637 0x02, 0x0e, 0x0b, 0x80, 0x5d, 4637 0x02, 0x0e, 0x0b, 0x80, 0x5d,
@@ -4673,7 +4673,7 @@ sisfb_post_xgi_ramsize(struct sis_video_info *ivideo)
4673 SiS_SetReg(SISSR, 0x13, 0x35); 4673 SiS_SetReg(SISSR, 0x13, 0x35);
4674 SiS_SetReg(SISSR, 0x14, 0x41); 4674 SiS_SetReg(SISSR, 0x14, 0x41);
4675 /* TODO */ 4675 /* TODO */
4676 return; 4676 return -ENOMEM;
4677 } 4677 }
4678 4678
4679 /* Non-interleaving */ 4679 /* Non-interleaving */
@@ -4835,6 +4835,7 @@ bail_out:
4835 4835
4836 j = (ivideo->chip == XGI_20) ? 5 : 9; 4836 j = (ivideo->chip == XGI_20) ? 5 : 9;
4837 k = (ivideo->chip == XGI_20) ? 12 : 4; 4837 k = (ivideo->chip == XGI_20) ? 12 : 4;
4838 status = -EIO;
4838 4839
4839 for(i = 0; i < k; i++) { 4840 for(i = 0; i < k; i++) {
4840 4841
@@ -4868,11 +4869,15 @@ bail_out:
4868 SiS_SetRegANDOR(SISSR, 0x14, 0x0f, (reg & 0xf0)); 4869 SiS_SetRegANDOR(SISSR, 0x14, 0x0f, (reg & 0xf0));
4869 sisfb_post_xgi_delay(ivideo, 1); 4870 sisfb_post_xgi_delay(ivideo, 1);
4870 4871
4871 if(sisfb_post_xgi_rwtest(ivideo, j, ((reg >> 4) + channelab - 2 + 20), mapsize)) 4872 if (sisfb_post_xgi_rwtest(ivideo, j, ((reg >> 4) + channelab - 2 + 20), mapsize)) {
4873 status = 0;
4872 break; 4874 break;
4875 }
4873 } 4876 }
4874 4877
4875 iounmap(ivideo->video_vbase); 4878 iounmap(ivideo->video_vbase);
4879
4880 return status;
4876} 4881}
4877 4882
4878static void __devinit 4883static void __devinit
@@ -5648,6 +5653,7 @@ sisfb_post_xgi(struct pci_dev *pdev)
5648 SiS_SetReg(SISSR, 0x14, bios[regb + 0xe0 + 8]); 5653 SiS_SetReg(SISSR, 0x14, bios[regb + 0xe0 + 8]);
5649 5654
5650 } else { 5655 } else {
5656 int err;
5651 5657
5652 /* Set default mode, don't clear screen */ 5658 /* Set default mode, don't clear screen */
5653 ivideo->SiS_Pr.SiS_UseOEM = false; 5659 ivideo->SiS_Pr.SiS_UseOEM = false;
@@ -5661,10 +5667,16 @@ sisfb_post_xgi(struct pci_dev *pdev)
5661 5667
5662 /* Disable read-cache */ 5668 /* Disable read-cache */
5663 SiS_SetRegAND(SISSR, 0x21, 0xdf); 5669 SiS_SetRegAND(SISSR, 0x21, 0xdf);
5664 sisfb_post_xgi_ramsize(ivideo); 5670 err = sisfb_post_xgi_ramsize(ivideo);
5665 /* Enable read-cache */ 5671 /* Enable read-cache */
5666 SiS_SetRegOR(SISSR, 0x21, 0x20); 5672 SiS_SetRegOR(SISSR, 0x21, 0x20);
5667 5673
5674 if (err) {
5675 dev_err(&pdev->dev,
5676 "%s: RAM size detection failed: %d\n",
5677 __func__, err);
5678 return 0;
5679 }
5668 } 5680 }
5669 5681
5670#if 0 5682#if 0