Skip to contentSkip to conversation

staging/xgifb: Remove unused values in XGI340_cr41 and XGI27_cr41

PATCH New Peter Huewe 1 participant 6 messages Feb 5, 2013 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 staging/xgifb: Remove unused values in XGI340_cr41 and XGI27_cr41

In the lookup tables XGI340_cr41 and XGI27_cr41 only the first three values are used of each 'line', thus the remaining fields can be removed.

Rationale:
- vb_init.c uses pVBInfo->ram_type for the 'column' index for pVBInfo->CR40.

- pVBInfo->ram_type is assigned the return value of XGINew_GetXG20DRAMType which can only be 0, 1 or 2

- pVBInfo->CR40 is assigned to either XGI340_cr41 or XGI27_cr41 in vb_setmode.c

-> only the first three values are used. This becomes also evident as values 3-7 are all 0.

---
 drivers/staging/xgifb/vb_struct.h |    2 +-
 drivers/staging/xgifb/vb_table.h  |  108 ++++++++++++++++++------------------
 2 files changed, 55 insertions(+), 55 deletions(-)
drivers/staging/xgifb/vb_struct.h +1 -1
index e570bae..02f3bb5 100644
@@ -158,7 +158,7 @@ struct vb_device_info {
 	void __iomem *FBAddr;
 
 	unsigned char const (*SR15)[8];
-	unsigned char const (*CR40)[8];
+	unsigned char const (*CR40)[3];
 
 	struct SiS_MCLKData const *MCLKData;
 
drivers/staging/xgifb/vb_table.h +54 -54

114 lines not on this page · raw message

Signature · 1 line
1.7.8.6
#1 lore raw

PATCH 2/6 staging/xgifb: Remove unused values in XG27_SR13 and XGI340_SR13

In the lookup tables XG27_SR13 and XGI340_SR13 only the first three values are used of each 'line', thus the remaining fields can be removed.

Rationale:
- vb_init.c uses pVBInfo->ram_type for the 'column' index for pVBInfo->SR15.

- pVBInfo->ram_type is assigned the return value of XGINew_GetXG20DRAMType which can only be 0, 1 or 2

- pVBInfo->SR15 is assigned to either XG27_SR13 or XGI340_SR13 in vb_setmode.c

-> only the first three values are used. This becomes also evident as values 3-7 are all 0.

---
 drivers/staging/xgifb/vb_struct.h |    2 +-
 drivers/staging/xgifb/vb_table.h  |   24 ++++++++++++------------
 2 files changed, 13 insertions(+), 13 deletions(-)
drivers/staging/xgifb/vb_struct.h +1 -1
index 02f3bb5..ae0c18b 100644
@@ -157,7 +157,7 @@ struct vb_device_info {
 
 	void __iomem *FBAddr;
 
-	unsigned char const (*SR15)[8];
+	unsigned char const (*SR15)[3];
 	unsigned char const (*CR40)[3];
 
 	struct SiS_MCLKData const *MCLKData;
drivers/staging/xgifb/vb_table.h +12 -12
index a1be751..b7abe25 100644
@@ -33,18 +33,18 @@ const struct XGI_ECLKDataStruct XGI340_ECLKData[] = {
 	{0x5c, 0x23, 0x01, 166}
 };
 
-static const unsigned char XG27_SR13[4][8] = {
-	{0x35, 0x45, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR13 */
-	{0x41, 0x51, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR14 */
-	{0x32, 0x32, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR18 */
-	{0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}  /* SR1B */
-};
-
-static const unsigned char XGI340_SR13[4][8] = {
-	{0x35, 0x45, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR13 */
-	{0x41, 0x51, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR14 */
-	{0x31, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR18 */
-	{0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}  /* SR1B */
+static const unsigned char XG27_SR13[4][3] = {
+	{0x35, 0x45, 0xb1}, /* SR13 */
+	{0x41, 0x51, 0x5c}, /* SR14 */
+	{0x32, 0x32, 0x42}, /* SR18 */
+	{0x03, 0x03, 0x03}  /* SR1B */
+};
+
+static const unsigned char XGI340_SR13[4][3] = {
+	{0x35, 0x45, 0xb1}, /* SR13 */
+	{0x41, 0x51, 0x5c}, /* SR14 */
+	{0x31, 0x42, 0x42}, /* SR18 */
+	{0x03, 0x03, 0x03}  /* SR1B */
 };
 
 static const unsigned char XGI340_cr41[24][3] = {
Signature · 1 line
1.7.8.6
#2 lore raw

PATCH 3/6 staging/xgifb: Remove unused entries in XGI340New_MCLKData and XGI27New_MCLKData

In reply to Peter Huewe

In the lookup tables XGI340New_MCLKData and XGI27New_MCLKData only the first three 'lines' are used, thus the remaining fields can be removed.

Rationale:
- vb_init.c uses pVBInfo->ram_type as the index for pVBInfo->MCLKData

- pVBInfo->ram_type is assigned the return value of XGINew_GetXG20DRAMType which can only be 0, 1 or 2

- pVBInfo->MCLKData is assigned to either XGI340New_MCLKData or XGI27New_MCLKData in vb_setmode.c

-> only the first three values are used, the rest can be removed.

---
 drivers/staging/xgifb/vb_table.h |   10 ----------
 1 files changed, 0 insertions(+), 10 deletions(-)
drivers/staging/xgifb/vb_table.h +0 -10
index b7abe25..04fd5cf 100644
@@ -4,22 +4,12 @@ static const struct SiS_MCLKData XGI340New_MCLKData[] = {
 	{0x16, 0x01, 0x01, 166},
 	{0x19, 0x02, 0x01, 124},
 	{0x7C, 0x08, 0x01, 200},
-	{0x79, 0x06, 0x01, 250},
-	{0x29, 0x01, 0x81, 301},
-	{0x5c, 0x23, 0x01, 166},
-	{0x5c, 0x23, 0x01, 166},
-	{0x5c, 0x23, 0x01, 166}
 };
 
 static const struct SiS_MCLKData XGI27New_MCLKData[] = {
 	{0x5c, 0x23, 0x01, 166},
 	{0x19, 0x02, 0x01, 124},
 	{0x7C, 0x08, 0x80, 200},
-	{0x79, 0x06, 0x80, 250},
-	{0x29, 0x01, 0x81, 300},
-	{0x5c, 0x23, 0x01, 166},
-	{0x5c, 0x23, 0x01, 166},
-	{0x5c, 0x23, 0x01, 166}
 };
 
 const struct XGI_ECLKDataStruct XGI340_ECLKData[] = {
Signature · 1 line
1.7.8.6
#3 lore raw

PATCH 4/6 staging/xgifb: Remove unused values in XGI340_ECLKData

In reply to Peter Huewe

In the lookup table XGI340_ECLKData only the first three 'lines' are used, thus the remaining entries can be removed.

Rationale:
- vb_init.c uses pVBInfo->ram_type as the index for XGI340_ECLKData.

- pVBInfo->ram_type is assigned the return value of XGINew_GetXG20DRAMType which can only be 0, 1 or 2

-> only the first three values are used.
-> remove the remeining entries.

---
 drivers/staging/xgifb/vb_table.h |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
drivers/staging/xgifb/vb_table.h +0 -5
index 04fd5cf..b4c05c8 100644
@@ -16,11 +16,6 @@ const struct XGI_ECLKDataStruct XGI340_ECLKData[] = {
 	{0x5c, 0x23, 0x01, 166},
 	{0x55, 0x84, 0x01, 123},
 	{0x7C, 0x08, 0x01, 200},
-	{0x79, 0x06, 0x01, 250},
-	{0x29, 0x01, 0x81, 301},
-	{0x5c, 0x23, 0x01, 166},
-	{0x5c, 0x23, 0x01, 166},
-	{0x5c, 0x23, 0x01, 166}
 };
 
 static const unsigned char XG27_SR13[4][3] = {
Signature · 1 line
1.7.8.6
#4 lore raw

PATCH 5/6 staging/xgifb: Remove unneeded conditional assignment

In reply to Peter Huewe

pVBInfo->ram_type is assigned the return value of XGINew_GetXG20DRAMType which can only be 0, 1 or 2

-> The conditional assignment is not needed here as it always evaluates to true.
-> remove

---
 drivers/staging/xgifb/vb_init.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/xgifb/vb_init.c +1 -1
index 7b8f41d..e19a714 100644
@@ -440,7 +440,7 @@ static void XGINew_SetDRAMDefaultRegister340(
 	xgifb_reg_set(P3d4, 0x6A, pVBInfo->CR40[7][pVBInfo->ram_type]);
 
 	/* CR6B DQS fine tune delay */
-	temp = (pVBInfo->ram_type <= 2) ? 0xaa : 0x00;
+	temp = 0xaa;
 	XGI_SetDRAM_Helper(P3d4, temp, 0, 0x6B, 2, 0xF0, 0x10);
 
 	/* CR6E DQM fine tune delay */
Signature · 1 line
1.7.8.6
#5 lore raw

PATCH 6/6 staging/xgifb: Remove always false if statement

In reply to Peter Huewe

MCLKData does not contain any 0x1C value for its field SR28 nor does XGI340_ECLKData contain any 0x1C or 0x22 value for its field SR2E.

-> the statement always evaluates to false.
-> remove

---
 drivers/staging/xgifb/vb_init.c |   16 ----------------
 1 files changed, 0 insertions(+), 16 deletions(-)
drivers/staging/xgifb/vb_init.c +0 -16
index e19a714..82170d4 100644
@@ -131,22 +131,6 @@ static void XGINew_SetMemoryClock(struct xgi_hw_device_info *HwDeviceExtension,
 	xgifb_reg_set(pVBInfo->P3c4,
 		      0x30,
 		      XGI340_ECLKData[pVBInfo->ram_type].SR30);
-
-	/* When XG42 ECLK = MCLK = 207MHz, Set SR32 D[1:0] = 10b */
-	/* Modify SR32 value, when MCLK=207MHZ, ELCK=250MHz,
-	 * Set SR32 D[1:0] = 10b */
-	if (HwDeviceExtension->jChipType == XG42) {
-		if ((pVBInfo->MCLKData[pVBInfo->ram_type].SR28 == 0x1C) &&
-		    (pVBInfo->MCLKData[pVBInfo->ram_type].SR29 == 0x01) &&
-		    (((XGI340_ECLKData[pVBInfo->ram_type].SR2E == 0x1C) &&
-		      (XGI340_ECLKData[pVBInfo->ram_type].SR2F == 0x01)) ||
-		     ((XGI340_ECLKData[pVBInfo->ram_type].SR2E == 0x22) &&
-		      (XGI340_ECLKData[pVBInfo->ram_type].SR2F == 0x01))))
-			xgifb_reg_set(pVBInfo->P3c4,
-				      0x32,
-				      ((unsigned char) xgifb_reg_get(
-					  pVBInfo->P3c4, 0x32) & 0xFC) | 0x02);
-	}
 }
 
 static void XGINew_DDRII_Bootup_XG27(
Signature · 1 line
1.7.8.6