[PATCH] enable read prefetching on O2Micro bridges

Daniel Ritz daniel.ritz at gmx.ch
Thu May 6 01:10:10 BST 2004


This one enables read prefetching on O2micro bridges. It fixes the problems
seen with the RME Hammerfall DSP.
Thanks to Eric Still from O2micro for the input.

against 2.6.6-rc3-bk

--- 1.153/include/linux/pci_ids.h	Thu Apr 29 11:41:09 2004
+++ edited/include/linux/pci_ids.h	Wed May  5 20:52:20 2004
@@ -1540,6 +1540,8 @@
 #define PCI_DEVICE_ID_O2_6730		0x673a
 #define PCI_DEVICE_ID_O2_6832		0x6832
 #define PCI_DEVICE_ID_O2_6836		0x6836
+#define PCI_DEVICE_ID_O2_6812		0x6872
+#define PCI_DEVICE_ID_O2_6933		0x6933
 
 #define PCI_VENDOR_ID_3DFX		0x121a
 #define PCI_DEVICE_ID_3DFX_VOODOO	0x0001
--- 1.54/drivers/pcmcia/yenta_socket.c	Wed Apr 14 23:06:58 2004
+++ edited/drivers/pcmcia/yenta_socket.c	Wed May  5 23:33:27 2004
@@ -668,6 +668,7 @@
 #include "ti113x.h"
 #include "ricoh.h"
 #include "topic.h"
+#include "o2micro.h"
 
 enum {
 	CARDBUS_TYPE_DEFAULT = -1,
@@ -676,7 +677,8 @@
 	CARDBUS_TYPE_TI12XX,
 	CARDBUS_TYPE_TI1250,
 	CARDBUS_TYPE_RICOH,
-	CARDBUS_TYPE_TOPIC97
+	CARDBUS_TYPE_TOPIC97,
+	CARDBUS_TYPE_O2MICRO,
 };
 
 /*
@@ -716,6 +718,10 @@
 	[CARDBUS_TYPE_TOPIC97]	= {
 		.override	= topic97_override,
 	},
+	[CARDBUS_TYPE_O2MICRO]	= {
+		.override	= o2micro_override,
+		.restore_state	= o2micro_restore_state,
+	},
 };
 
 
@@ -1098,6 +1104,13 @@
 
 	CB_ID(PCI_VENDOR_ID_TOSHIBA, PCI_DEVICE_ID_TOSHIBA_TOPIC97, TOPIC97),
 	CB_ID(PCI_VENDOR_ID_TOSHIBA, PCI_DEVICE_ID_TOSHIBA_TOPIC100, TOPIC97),
+
+	CB_ID(PCI_VENDOR_ID_O2, PCI_DEVICE_ID_O2_6729, O2MICRO),
+	CB_ID(PCI_VENDOR_ID_O2, PCI_DEVICE_ID_O2_6730, O2MICRO),
+	CB_ID(PCI_VENDOR_ID_O2, PCI_DEVICE_ID_O2_6812, O2MICRO),
+	CB_ID(PCI_VENDOR_ID_O2, PCI_DEVICE_ID_O2_6832, O2MICRO),
+	CB_ID(PCI_VENDOR_ID_O2, PCI_DEVICE_ID_O2_6836, O2MICRO),
+	CB_ID(PCI_VENDOR_ID_O2, PCI_DEVICE_ID_O2_6933, O2MICRO),
 
 	/* match any cardbus bridge */
 	CB_ID(PCI_ANY_ID, PCI_ANY_ID, DEFAULT),
--- 1.3/drivers/pcmcia/o2micro.h	Sat Oct 19 01:11:25 2002
+++ edited/drivers/pcmcia/o2micro.h	Wed May  5 23:32:39 2004
@@ -30,25 +30,6 @@
 #ifndef _LINUX_O2MICRO_H
 #define _LINUX_O2MICRO_H
 
-#ifndef PCI_VENDOR_ID_O2
-#define PCI_VENDOR_ID_O2		0x1217
-#endif
-#ifndef PCI_DEVICE_ID_O2_6729
-#define PCI_DEVICE_ID_O2_6729		0x6729
-#endif
-#ifndef PCI_DEVICE_ID_O2_6730
-#define PCI_DEVICE_ID_O2_6730		0x673a
-#endif
-#ifndef PCI_DEVICE_ID_O2_6832
-#define PCI_DEVICE_ID_O2_6832		0x6832
-#endif
-#ifndef PCI_DEVICE_ID_O2_6836
-#define PCI_DEVICE_ID_O2_6836		0x6836
-#endif
-#ifndef PCI_DEVICE_ID_O2_6812
-#define PCI_DEVICE_ID_O2_6812		0x6872
-#endif
-
 /* Additional PCI configuration registers */
 
 #define O2_MUX_CONTROL		0x90	/* 32 bit */
@@ -119,5 +100,31 @@
 #define  O2_MODE_E_SPKR_OUT	0x02
 #define  O2_MODE_E_LED_OUT	0x08
 #define  O2_MODE_E_SKTA_ACTV	0x10
+
+static int o2micro_override(struct yenta_socket *socket)
+{
+	/*
+	 * 'reserved' register at 0x94/D4. chaning it to 0xCA (8 bit) enables
+	 * read prefetching which for example makes the RME Hammerfall DSP
+	 * working. for some bridges it is at 0x94, for others at 0xD4. it's
+	 * ok to write to both registers on all O2 bridges.
+	 * from Eric Still, 02Micro.
+	 */
+	if (PCI_FUNC(socket->dev->devfn) == 0) {
+		config_writeb(socket, 0x94, 0xCA);
+		config_writeb(socket, 0xD4, 0xCA);
+	}
+
+	return 0;
+}
+
+static void o2micro_restore_state(struct yenta_socket *socket)
+{
+	/*
+	 * as long as read prefetch is the only thing in
+	 * o2micro_override, it's safe to call it from here
+	 */
+	o2micro_override(socket);
+}
 
 #endif /* _LINUX_O2MICRO_H */
--- 1.50/drivers/pcmcia/i82365.c	Sat Apr 17 10:36:21 2004
+++ edited/drivers/pcmcia/i82365.c	Tue Apr 20 21:44:05 2004
@@ -65,7 +65,6 @@
 #include "cirrus.h"
 #include "vg468.h"
 #include "ricoh.h"
-#include "o2micro.h"
 
 #ifdef DEBUG
 static const char *version =




More information about the linux-pcmcia mailing list