[PATCH] pcmcia: match for fake CIS
authorDominik Brodowski <linux@dominikbrodowski.net>
Mon, 27 Jun 2005 23:28:07 +0000 (16:28 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 28 Jun 2005 01:03:06 +0000 (18:03 -0700)
Add another match flag for devices needing a CIS override.  The driver will
only probe/attach if the CIS has been replaced before.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/pcmcia/ds.c
include/linux/mod_devicetable.h
include/pcmcia/device_id.h

index 3ac7a443f6680b174460a2d8bcb0707c3b295033..c0611d56eab22961e58ad6a6fbc001dd1776edd2 100644 (file)
@@ -733,6 +733,14 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
                        return 0;
        }
 
+       if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) {
+               if (!dev->socket->fake_cis) {
+                       /* FIXME: evaluate using firmware helpers to
+                        * automagically load it from userspace */
+                       return 0;
+               }
+       }
+
        dev->dev.driver_data = (void *) did;
 
        return 1;
index e9651cd8310c7b7cb41a45ab6ec1d28222bb8ab3..c0106d68bb6d6771b0ee4ea5d45136fb295cd292 100644 (file)
@@ -196,6 +196,7 @@ struct pcmcia_device_id {
 
        /* not matched against */
        kernel_ulong_t  driver_info;
+       char *          cisfile;
 };
 
 #define PCMCIA_DEV_ID_MATCH_MANF_ID    0x0001
@@ -207,5 +208,6 @@ struct pcmcia_device_id {
 #define PCMCIA_DEV_ID_MATCH_PROD_ID3   0x0040
 #define PCMCIA_DEV_ID_MATCH_PROD_ID4   0x0080
 #define PCMCIA_DEV_ID_MATCH_DEVICE_NO  0x0100
+#define PCMCIA_DEV_ID_MATCH_FAKE_CIS   0x0200
 
 #endif /* LINUX_MOD_DEVICETABLE_H */
index acf68656de3c864ccb32ee054d2142a4b75c205b..346d81ece2873ec9aeeafd8e9b5bd3a92b34ee4d 100644 (file)
        .prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \
        .device_no = (mfc), }
 
+/* cards needing a CIS override */
+
+#define PCMCIA_DEVICE_CIS_MANF_CARD(manf, card, _cisfile) { \
+       .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
+                       PCMCIA_DEV_ID_MATCH_MANF_ID| \
+                       PCMCIA_DEV_ID_MATCH_CARD_ID, \
+       .manf_id = (manf), \
+       .card_id = (card), \
+       .cisfile = (_cisfile)}
+
+#define PCMCIA_DEVICE_CIS_PROD_ID12(v1, v2, vh1, vh2, _cisfile) { \
+       .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
+                       PCMCIA_DEV_ID_MATCH_PROD_ID1| \
+                       PCMCIA_DEV_ID_MATCH_PROD_ID2, \
+       .prod_id = { (v1), (v2), NULL, NULL }, \
+       .prod_id_hash = { (vh1), (vh2), 0, 0 }, \
+       .cisfile = (_cisfile)}
+
+#define PCMCIA_DEVICE_CIS_PROD_ID123(v1, v2, v3, vh1, vh2, vh3, _cisfile) { \
+       .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
+                       PCMCIA_DEV_ID_MATCH_PROD_ID1| \
+                       PCMCIA_DEV_ID_MATCH_PROD_ID2| \
+                       PCMCIA_DEV_ID_MATCH_PROD_ID3, \
+       .prod_id = { (v1), (v2), (v3), NULL },\
+       .prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \
+       .cisfile = (_cisfile)}
+
+
+#define PCMCIA_DEVICE_CIS_PROD_ID2(v2, vh2, _cisfile) { \
+       .match_flags =  PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
+                       PCMCIA_DEV_ID_MATCH_PROD_ID2, \
+       .prod_id = { NULL, (v2), NULL, NULL },  \
+       .prod_id_hash = { 0, (vh2), 0, 0 }, \
+       .cisfile = (_cisfile)}
+
+#define PCMCIA_PFC_DEVICE_CIS_PROD_ID12(mfc, v1, v2, vh1, vh2, _cisfile) { \
+       .match_flags =  PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
+                       PCMCIA_DEV_ID_MATCH_PROD_ID1| \
+                       PCMCIA_DEV_ID_MATCH_PROD_ID2| \
+                       PCMCIA_DEV_ID_MATCH_DEVICE_NO, \
+       .prod_id = { (v1), (v2), NULL, NULL }, \
+       .prod_id_hash = { (vh1), (vh2), 0, 0 },\
+       .device_no = (mfc), \
+       .cisfile = (_cisfile)}
+
+#define PCMCIA_MFC_DEVICE_CIS_MANF_CARD(mfc, manf, card, _cisfile) { \
+       .match_flags =  PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
+                       PCMCIA_DEV_ID_MATCH_MANF_ID| \
+                       PCMCIA_DEV_ID_MATCH_CARD_ID| \
+                       PCMCIA_DEV_ID_MATCH_FUNCTION, \
+       .manf_id = (manf), \
+       .card_id = (card), \
+       .function = (mfc), \
+       .cisfile = (_cisfile)}
+
+#define PCMCIA_MFC_DEVICE_CIS_PROD_ID12(mfc, v1, v2, vh1, vh2, _cisfile) { \
+       .match_flags =  PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
+                       PCMCIA_DEV_ID_MATCH_PROD_ID1| \
+                       PCMCIA_DEV_ID_MATCH_PROD_ID2| \
+                       PCMCIA_DEV_ID_MATCH_FUNCTION, \
+       .prod_id = { (v1), (v2), NULL, NULL }, \
+       .prod_id_hash = { (vh1), (vh2), 0, 0 }, \
+       .function = (mfc), \
+       .cisfile = (_cisfile)}
+
+#define PCMCIA_MFC_DEVICE_CIS_PROD_ID4(mfc, v4, vh4, _cisfile) { \
+       .match_flags =  PCMCIA_DEV_ID_MATCH_FAKE_CIS | \
+                       PCMCIA_DEV_ID_MATCH_PROD_ID4| \
+                       PCMCIA_DEV_ID_MATCH_FUNCTION, \
+       .prod_id = { NULL, NULL, NULL, (v4) }, \
+       .prod_id_hash = { 0, 0, 0, (vh4) }, \
+       .function = (mfc), \
+       .cisfile = (_cisfile)}
+
 
 #define PCMCIA_DEVICE_NULL { .match_flags = 0, }