PCMCIA: sa11x0: cerf: convert to use new irq/gpio management
[linux-2.6.git] / drivers / pcmcia / o2micro.h
index a234ce1..5096e92 100644 (file)
 #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 */
@@ -135,12 +116,12 @@ static int o2micro_override(struct yenta_socket *socket)
         * from Eric Still, 02Micro.
         */
        u8 a, b;
+       bool use_speedup;
 
        if (PCI_FUNC(socket->dev->devfn) == 0) {
                a = config_readb(socket, O2_RESERVED1);
                b = config_readb(socket, O2_RESERVED2);
-
-               printk(KERN_INFO "Yenta O2: res at 0x94/0xD4: %02x/%02x\n", a, b);
+               dev_dbg(&socket->dev->dev, "O2: 0x94/0xD4: %02x/%02x\n", a, b);
 
                switch (socket->dev->device) {
                /*
@@ -153,19 +134,37 @@ static int o2micro_override(struct yenta_socket *socket)
                case PCI_DEVICE_ID_O2_6812:
                case PCI_DEVICE_ID_O2_6832:
                case PCI_DEVICE_ID_O2_6836:
-                       printk(KERN_INFO "Yenta O2: old bridge, disabling read prefetch/write burst\n");
-                       config_writeb(socket, O2_RESERVED1,
-                                     a & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST));
-                       config_writeb(socket, O2_RESERVED2,
-                                     b & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST));
+               case PCI_DEVICE_ID_O2_6933:
+                       use_speedup = false;
                        break;
-
                default:
-                       printk(KERN_INFO "Yenta O2: enabling read prefetch/write burst\n");
+                       use_speedup = true;
+                       break;
+               }
+
+               /* the user may override our decision */
+               if (strcasecmp(o2_speedup, "on") == 0)
+                       use_speedup = true;
+               else if (strcasecmp(o2_speedup, "off") == 0)
+                       use_speedup = false;
+               else if (strcasecmp(o2_speedup, "default") != 0)
+                       dev_warn(&socket->dev->dev,
+                               "O2: Unknown parameter, using 'default'");
+
+               if (use_speedup) {
+                       dev_info(&socket->dev->dev,
+                               "O2: enabling read prefetch/write burst. If you experience problems or performance issues, use the yenta_socket parameter 'o2_speedup=off'\n");
+                       config_writeb(socket, O2_RESERVED1,
+                                     a | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST);
+                       config_writeb(socket, O2_RESERVED2,
+                                     b | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST);
+               } else {
+                       dev_info(&socket->dev->dev,
+                               "O2: disabling read prefetch/write burst. If you experience problems or performance issues, use the yenta_socket parameter 'o2_speedup=on'\n");
                        config_writeb(socket, O2_RESERVED1,
-                                     a | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST);
+                                     a & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST));
                        config_writeb(socket, O2_RESERVED2,
-                                     b | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST);
+                                     b & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST));
                }
        }