]> Pileus Git - ~andy/linux/blobdiff - drivers/serial/serial_cs.c
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[~andy/linux] / drivers / serial / serial_cs.c
index ac60cd288418cf6a0ca68a1f74fe7652bb2398ee..79c9c5f5cdbae6995774d88b22fa61b370bc4eb3 100644 (file)
@@ -431,18 +431,20 @@ first_tuple(struct pcmcia_device *handle, tuple_t * tuple, cisparse_t * parse)
 {
        int i;
        i = pcmcia_get_first_tuple(handle, tuple);
-       if (i != CS_SUCCESS)
-               return CS_NO_MORE_ITEMS;
+       if (i != 0)
+               return i;
        i = pcmcia_get_tuple_data(handle, tuple);
-       if (i != CS_SUCCESS)
+       if (i != 0)
                return i;
-       return pcmcia_parse_tuple(handle, tuple, parse);
+       return pcmcia_parse_tuple(tuple, parse);
 }
 
 /*====================================================================*/
 
 static int simple_config_check(struct pcmcia_device *p_dev,
                               cistpl_cftable_entry_t *cf,
+                              cistpl_cftable_entry_t *dflt,
+                              unsigned int vcc,
                               void *priv_data)
 {
        static const int size_table[2] = { 8, 16 };
@@ -454,7 +456,6 @@ static int simple_config_check(struct pcmcia_device *p_dev,
 
        if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[(*try >> 1)])
            && (cf->io.win[0].base != 0)) {
-               p_dev->conf.ConfigIndex = cf->index;
                p_dev->io.BasePort1 = cf->io.win[0].base;
                p_dev->io.IOAddrLines = ((*try & 0x1) == 0) ?
                        16 : cf->io.flags & CISTPL_IO_LINES_MASK;
@@ -466,13 +467,14 @@ static int simple_config_check(struct pcmcia_device *p_dev,
 
 static int simple_config_check_notpicky(struct pcmcia_device *p_dev,
                                        cistpl_cftable_entry_t *cf,
+                                       cistpl_cftable_entry_t *dflt,
+                                       unsigned int vcc,
                                        void *priv_data)
 {
        static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
        int j;
 
        if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
-               p_dev->conf.ConfigIndex = cf->index;
                for (j = 0; j < 5; j++) {
                        p_dev->io.BasePort1 = base[j];
                        p_dev->io.IOAddrLines = base[j] ? 16 : 3;
@@ -486,23 +488,23 @@ static int simple_config_check_notpicky(struct pcmcia_device *p_dev,
 static int simple_config(struct pcmcia_device *link)
 {
        struct serial_info *info = link->priv;
-       config_info_t config;
-       int i, try;
+       int i = -ENODEV, try;
 
        /* If the card is already configured, look up the port and irq */
-       i = pcmcia_get_configuration_info(link, &config);
-       if ((i == CS_SUCCESS) && (config.Attributes & CONF_VALID_CLIENT)) {
+       if (link->function_config) {
                unsigned int port = 0;
-               if ((config.BasePort2 != 0) && (config.NumPorts2 == 8)) {
-                       port = config.BasePort2;
+               if ((link->io.BasePort2 != 0) &&
+                   (link->io.NumPorts2 == 8)) {
+                       port = link->io.BasePort2;
                        info->slave = 1;
                } else if ((info->manfid == MANFID_OSITECH) &&
-                          (config.NumPorts1 == 0x40)) {
-                       port = config.BasePort1 + 0x28;
+                          (link->io.NumPorts1 == 0x40)) {
+                       port = link->io.BasePort1 + 0x28;
                        info->slave = 1;
                }
                if (info->slave) {
-                       return setup_serial(link, info, port, config.AssignedIRQ);
+                       return setup_serial(link, info, port,
+                                           link->irq.AssignedIRQ);
                }
        }
 
@@ -525,7 +527,7 @@ static int simple_config(struct pcmcia_device *link)
 
 found_port:
        i = pcmcia_request_irq(link, &link->irq);
-       if (i != CS_SUCCESS) {
+       if (i != 0) {
                cs_error(link, RequestIRQ, i);
                link->irq.AssignedIRQ = 0;
        }
@@ -539,7 +541,7 @@ found_port:
                info->quirk->config(link);
 
        i = pcmcia_request_configuration(link, &link->conf);
-       if (i != CS_SUCCESS) {
+       if (i != 0) {
                cs_error(link, RequestConfiguration, i);
                return -1;
        }
@@ -548,6 +550,8 @@ found_port:
 
 static int multi_config_check(struct pcmcia_device *p_dev,
                              cistpl_cftable_entry_t *cf,
+                             cistpl_cftable_entry_t *dflt,
+                             unsigned int vcc,
                              void *priv_data)
 {
        int *base2 = priv_data;
@@ -555,7 +559,6 @@ static int multi_config_check(struct pcmcia_device *p_dev,
        /* The quad port cards have bad CIS's, so just look for a
           window larger than 8 ports and assume it will be right */
        if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) {
-               p_dev->conf.ConfigIndex = cf->index;
                p_dev->io.BasePort1 = cf->io.win[0].base;
                p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
                if (!pcmcia_request_io(p_dev, &p_dev->io)) {
@@ -568,12 +571,13 @@ static int multi_config_check(struct pcmcia_device *p_dev,
 
 static int multi_config_check_notpicky(struct pcmcia_device *p_dev,
                                       cistpl_cftable_entry_t *cf,
+                                      cistpl_cftable_entry_t *dflt,
+                                      unsigned int vcc,
                                       void *priv_data)
 {
        int *base2 = priv_data;
 
        if (cf->io.nwin == 2) {
-               p_dev->conf.ConfigIndex = cf->index;
                p_dev->io.BasePort1 = cf->io.win[0].base;
                p_dev->io.BasePort2 = cf->io.win[1].base;
                p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
@@ -605,7 +609,7 @@ static int multi_config(struct pcmcia_device *link)
        }
 
        i = pcmcia_request_irq(link, &link->irq);
-       if (i != CS_SUCCESS) {
+       if (i != 0) {
                /* FIXME: comment does not fit, error handling does not fit */
                printk(KERN_NOTICE
                       "serial_cs: no usable port range found, giving up\n");
@@ -620,7 +624,7 @@ static int multi_config(struct pcmcia_device *link)
                info->quirk->config(link);
 
        i = pcmcia_request_configuration(link, &link->conf);
-       if (i != CS_SUCCESS) {
+       if (i != 0) {
                cs_error(link, RequestConfiguration, i);
                return -ENODEV;
        }
@@ -677,7 +681,7 @@ static int serial_config(struct pcmcia_device * link)
        u_char *buf;
        cisparse_t *parse;
        cistpl_cftable_entry_t *cf;
-       int i;
+       int i, last_ret, last_fn;
 
        DEBUG(0, "serial_config(0x%p)\n", link);
 
@@ -695,10 +699,20 @@ static int serial_config(struct pcmcia_device * link)
        tuple->TupleDataMax = 255;
        tuple->Attributes = 0;
 
+       /* Get configuration register information */
+       tuple->DesiredTuple = CISTPL_CONFIG;
+       last_ret = first_tuple(link, tuple, parse);
+       if (last_ret != 0) {
+               last_fn = ParseTuple;
+               goto cs_failed;
+       }
+       link->conf.ConfigBase = parse->config.base;
+       link->conf.Present = parse->config.rmask[0];
+
        /* Is this a compliant multifunction card? */
        tuple->DesiredTuple = CISTPL_LONGLINK_MFC;
        tuple->Attributes = TUPLE_RETURN_COMMON | TUPLE_RETURN_LINK;
-       info->multi = (first_tuple(link, tuple, parse) == CS_SUCCESS);
+       info->multi = (first_tuple(link, tuple, parse) == 0);
 
        /* Is this a multiport card? */
        tuple->DesiredTuple = CISTPL_MANFID;
@@ -722,7 +736,7 @@ static int serial_config(struct pcmcia_device * link)
            ((link->func_id == CISTPL_FUNCID_MULTI) ||
             (link->func_id == CISTPL_FUNCID_SERIAL))) {
                tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY;
-               if (first_tuple(link, tuple, parse) == CS_SUCCESS) {
+               if (first_tuple(link, tuple, parse) == 0) {
                        if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0))
                                info->multi = cf->io.win[0].len >> 3;
                        if ((cf->io.nwin == 2) && (cf->io.win[0].len == 8) &&
@@ -757,7 +771,9 @@ static int serial_config(struct pcmcia_device * link)
        kfree(cfg_mem);
        return 0;
 
- failed:
+cs_failed:
+       cs_error(link, last_fn, last_ret);
+failed:
        serial_remove(link);
        kfree(cfg_mem);
        return -ENODEV;
@@ -859,10 +875,10 @@ static struct pcmcia_device_id serial_ids[] = {
        PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "LINKSYS", "PCMLM28", 0xf7cb0b07, 0x66881874, "PCMLM28.cis"),
        PCMCIA_MFC_DEVICE_CIS_PROD_ID12(1, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "DP83903.cis"),
        PCMCIA_MFC_DEVICE_CIS_PROD_ID4(1, "NSC MF LAN/Modem", 0x58fc6056, "DP83903.cis"),
-       PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0556, "3CCFEM556.cis"),
+       PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0556, "cis/3CCFEM556.cis"),
        PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0175, 0x0000, "DP83903.cis"),
-       PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0035, "3CXEM556.cis"),
-       PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x003d, "3CXEM556.cis"),
+       PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0035, "cis/3CXEM556.cis"),
+       PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x003d, "cis/3CXEM556.cis"),
        PCMCIA_DEVICE_CIS_PROD_ID12("Sierra Wireless", "AC850", 0xd85f6206, 0x42a2c018, "SW_8xx_SER.cis"),  /* Sierra Wireless AC850 3G Network Adapter R1 */
        PCMCIA_DEVICE_CIS_MANF_CARD(0x0192, 0x0710, "SW_7xx_SER.cis"),  /* Sierra Wireless AC710/AC750 GPRS Network Adapter R1 */
        PCMCIA_DEVICE_CIS_MANF_CARD(0x0192, 0xa555, "SW_555_SER.cis"),  /* Sierra Aircard 555 CDMA 1xrtt Modem -- pre update */