aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/ti113x.h
diff options
context:
space:
mode:
authorDaniel Ritz <daniel.ritz@gmx.ch>2005-08-22 01:29:26 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2005-09-26 07:09:20 -0400
commit8c3520d4eb3b1bbf2e45fbae8dcfb8db06d5e775 (patch)
treedf9b4f49e8f9ffa34657776be458fbd124b2e87b /drivers/pcmcia/ti113x.h
parent8ddec7460d2f5db3ac35812c03676b1473d1d668 (diff)
[PATCH] yenta: auto-tune EnE bridges for CardBus cards
Echo Audio cardbus products are known to be incompatible with EnE bridges. in order to maybe solve the problem a EnE specific test bit has to be set, another cleared...but other setups have a good chance to break when just forcing the bits. so do the whole thingy automatically. The patch adds a hook in cb_alloc() that allows special tuning for the different chipsets. for ene just match the Echo products and set/clear the test bits, defaults to do the same thing as w/o the patch to not break working setups. Signed-off-by: Daniel Ritz <daniel.ritz@gmx.ch> Cc: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/ti113x.h')
-rw-r--r--drivers/pcmcia/ti113x.h86
1 files changed, 76 insertions, 10 deletions
diff --git a/drivers/pcmcia/ti113x.h b/drivers/pcmcia/ti113x.h
index fbe233e19ceb..d319f2e7d053 100644
--- a/drivers/pcmcia/ti113x.h
+++ b/drivers/pcmcia/ti113x.h
@@ -153,6 +153,12 @@
153/* EnE test register */ 153/* EnE test register */
154#define ENE_TEST_C9 0xc9 /* 8bit */ 154#define ENE_TEST_C9 0xc9 /* 8bit */
155#define ENE_TEST_C9_TLTENABLE 0x02 155#define ENE_TEST_C9_TLTENABLE 0x02
156#define ENE_TEST_C9_PFENABLE_F0 0x04
157#define ENE_TEST_C9_PFENABLE_F1 0x08
158#define ENE_TEST_C9_PFENABLE (ENE_TEST_C9_PFENABLE_F0 | ENE_TEST_C9_PFENABLE_F0)
159#define ENE_TEST_C9_WPDISALBLE_F0 0x40
160#define ENE_TEST_C9_WPDISALBLE_F1 0x80
161#define ENE_TEST_C9_WPDISALBLE (ENE_TEST_C9_WPDISALBLE_F0 | ENE_TEST_C9_WPDISALBLE_F1)
156 162
157/* 163/*
158 * Texas Instruments CardBus controller overrides. 164 * Texas Instruments CardBus controller overrides.
@@ -791,16 +797,6 @@ static int ti12xx_override(struct yenta_socket *socket)
791 config_writel(socket, TI113X_SYSTEM_CONTROL, val); 797 config_writel(socket, TI113X_SYSTEM_CONTROL, val);
792 798
793 /* 799 /*
794 * for EnE bridges only: clear testbit TLTEnable. this makes the
795 * RME Hammerfall DSP sound card working.
796 */
797 if (socket->dev->vendor == PCI_VENDOR_ID_ENE) {
798 u8 test_c9 = config_readb(socket, ENE_TEST_C9);
799 test_c9 &= ~ENE_TEST_C9_TLTENABLE;
800 config_writeb(socket, ENE_TEST_C9, test_c9);
801 }
802
803 /*
804 * Yenta expects controllers to use CSCINT to route 800 * Yenta expects controllers to use CSCINT to route
805 * CSC interrupts to PCI rather than INTVAL. 801 * CSC interrupts to PCI rather than INTVAL.
806 */ 802 */
@@ -841,5 +837,75 @@ static int ti1250_override(struct yenta_socket *socket)
841 return ti12xx_override(socket); 837 return ti12xx_override(socket);
842} 838}
843 839
840
841/**
842 * EnE specific part. EnE bridges are register compatible with TI bridges but
843 * have their own test registers and more important their own little problems.
844 * Some fixup code to make everybody happy (TM).
845 */
846
847/**
848 * set/clear various test bits:
849 * Defaults to clear the bit.
850 * - mask (u8) defines what bits to change
851 * - bits (u8) is the values to change them to
852 * -> it's
853 * current = (current & ~mask) | bits
854 */
855/* pci ids of devices that wants to have the bit set */
856#define DEVID(_vend,_dev,_subvend,_subdev,mask,bits) { \
857 .vendor = _vend, \
858 .device = _dev, \
859 .subvendor = _subvend, \
860 .subdevice = _subdev, \
861 .driver_data = ((mask) << 8 | (bits)), \
862 }
863static struct pci_device_id ene_tune_tbl[] = {
864 /* Echo Audio products based on motorola DSP56301 and DSP56361 */
865 DEVID(PCI_VENDOR_ID_MOTOROLA, 0x1801, 0xECC0, PCI_ANY_ID,
866 ENE_TEST_C9_TLTENABLE | ENE_TEST_C9_PFENABLE, ENE_TEST_C9_TLTENABLE),
867 DEVID(PCI_VENDOR_ID_MOTOROLA, 0x3410, 0xECC0, PCI_ANY_ID,
868 ENE_TEST_C9_TLTENABLE | ENE_TEST_C9_PFENABLE, ENE_TEST_C9_TLTENABLE),
869
870 {}
871};
872
873static void ene_tune_bridge(struct pcmcia_socket *sock, struct pci_bus *bus)
874{
875 struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
876 struct pci_dev *dev;
877 struct pci_device_id *id = NULL;
878 u8 test_c9, old_c9, mask, bits;
879
880 list_for_each_entry(dev, &bus->devices, bus_list) {
881 id = (struct pci_device_id *) pci_match_id(ene_tune_tbl, dev);
882 if (id)
883 break;
884 }
885
886 test_c9 = old_c9 = config_readb(socket, ENE_TEST_C9);
887 if (id) {
888 mask = (id->driver_data >> 8) & 0xFF;
889 bits = id->driver_data & 0xFF;
890
891 test_c9 = (test_c9 & ~mask) | bits;
892 }
893 else
894 /* default to clear TLTEnable bit, old behaviour */
895 test_c9 &= ~ENE_TEST_C9_TLTENABLE;
896
897 printk(KERN_INFO "yenta EnE: chaning testregister 0xC9, %02x -> %02x\n", old_c9, test_c9);
898 config_writeb(socket, ENE_TEST_C9, test_c9);
899}
900
901
902static int ene_override(struct yenta_socket *socket)
903{
904 /* install tune_bridge() function */
905 socket->socket.tune_bridge = ene_tune_bridge;
906
907 return ti1250_override(socket);
908}
909
844#endif /* _LINUX_TI113X_H */ 910#endif /* _LINUX_TI113X_H */
845 911