Skip to contentSkip to conversation

hpt366: HPT372N rev 2 controller fix

PATCH In review Albert Lee 2 participants 2 messages Apr 21, 2005

lore
Share & tools
lore

Albert Lee

author
#0 lore raw

PATCH 1/1 hpt366: HPT372N rev 2 controller fix

A particular revision of the HPT372N oopses hpt366 consistently. It's a regression caused by Alan's changes in 2.6.9 to support the HPT372N using only PLL timings. The driver works correctly in prior versions, where the the PCI clock is used instead. This patch restores that behaviour for this particular revision.

More info:
http://www.ussg.iu.edu/hypermail/linux/kernel/0410.0/0958.html
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=135515

Please CC replies to me.

-Albert

Signature · 2 lines
Prediction is very difficult, especially of the future.
                -- Niels Bohr
hpt366.c renamed from hpt366.c.orig +22 -1
@@ -802,6 +802,9 @@
 	
 		if((did == 4 && rid == 6) || (did == 5 && rid > 1))
 			is_372n = 1;
+		/* Check for a HPT372 rev 2, which is a special 372N */
+		if(did == 5 && rid == 2)
+			is_372n = 2;
 	}
 
 	/*
@@ -845,7 +848,25 @@
 			
 		printk(KERN_INFO "FREQ: %d PLL: %d\n", freq, pll);
 			
-		/* We always use the pll not the PCI clock on 372N */
+		/* We always use the pll not the PCI clock on 372N,
+		 * except for the 372 rev 2, which works fine with 372A
+		 * timings, and needs pci_set_drvdata().
+		 */
+		if(is_372n == 2)
+		{
+			if (pll == F_LOW_PCI_33) {
+				pci_set_drvdata(dev, (void *) thirty_three_base_hpt372);
+				printk("HPT37X: HPT372 rev 2 detected, using 33MHz PCI clock\n");
+			} else if (pll == F_LOW_PCI_40) {
+				/* Unsupported */
+			} else if (pll == F_LOW_PCI_50) {
+				pci_set_drvdata(dev, (void *) fifty_base_hpt372);
+				printk("HPT37X: HPT372 rev 2 detected, using 50MHz PCI clock\n");
+			} else {
+				pci_set_drvdata(dev, (void *) sixty_six_base_hpt372);
+				printk("HPT37X: HPT372 rev 2 detected, using 66MHz PCI clock\n");
+			}
+		}
 	}
 	else
 	{
#1 lore raw
Quoted 5 lines · Albert Lee

A particular revision of the HPT372N oopses hpt366 consistently. It's a regression caused by Alan's changes in 2.6.9 to support the HPT372N using only PLL timings. The driver works correctly in prior versions, where the the PCI clock is used instead. This patch restores that behaviour for this particular revision.

For some drives, if you are lucky. The problem is that the PLL code in the hpt366 driver is simply wrong. The -ac tree has some cleanup work in this area but hasn't fixed the PLL code yet. The vendor driver does handle this chip correctly.

Linus please avoid this patch - better an oops than disk corruption.

Alan