--- hostap_plx.c.orig Thu Jul 25 14:10:58 2002 +++ hostap_plx.c Thu Jul 25 14:49:39 2002 @@ -238,54 +238,74 @@ if (pci_enable_device(pdev)) return -EIO; - plx_ioaddr = pci_resource_start(pdev, 1); - pccard_ioaddr = pci_resource_start(pdev, 3); - - pccard_attr_mem = pci_resource_start(pdev, 2); - pccard_attr_len = pci_resource_len(pdev, 2); - if (pccard_attr_len < PLX_MIN_ATTR_LEN) - goto fail; - - attr_mem = (unsigned long) ioremap(pccard_attr_mem, pccard_attr_len); - if (!attr_mem) { - printk(KERN_ERR "%s: cannot remap attr_mem\n", dev_info); - goto fail; - } - - printk(KERN_INFO "PLX9052 PCI/PCMCIA adapter: " - "mem=0x%lx, plx_io=0x%x, irq=%d, pccard_io=0x%x\n", - pccard_attr_mem, plx_ioaddr, pdev->irq, pccard_ioaddr); - - if (prism2_plx_check_cis(attr_mem, pccard_attr_len, &cor_offset, - &cor_index)) { - printk(KERN_INFO "Unknown PC Card CIS - not a Prism2/2.5 " - "card?\n"); - goto fail; + if ((pdev->vendor != 0x15e8) && (pdev->device != 0x0131)) { + plx_ioaddr = pci_resource_start(pdev, 1); + pccard_ioaddr = pci_resource_start(pdev, 3); + + pccard_attr_mem = pci_resource_start(pdev, 2); + pccard_attr_len = pci_resource_len(pdev, 2); + if (pccard_attr_len < PLX_MIN_ATTR_LEN) + goto fail; + + attr_mem = (unsigned long) ioremap(pccard_attr_mem, pccard_attr_len); + if (!attr_mem) { + printk(KERN_ERR "%s: cannot remap attr_mem\n", dev_info); + goto fail; + } + + printk(KERN_INFO "PLX9052 PCI/PCMCIA adapter: " + "mem=0x%lx, plx_io=0x%x, irq=%d, pccard_io=0x%x\n", + pccard_attr_mem, plx_ioaddr, pdev->irq, pccard_ioaddr); + + if (prism2_plx_check_cis(attr_mem, pccard_attr_len, &cor_offset, + &cor_index)) { + printk(KERN_INFO "Unknown PC Card CIS - not a Prism2/2.5 " + "card?\n"); + goto fail; + } + + printk(KERN_DEBUG "Prism2/2.5 PC Card detected in PLX adapter\n"); + + /* Write COR to enable PC Card */ + writeb(cor_index | COR_LEVLREQ | COR_ENABLE_FUNC, + attr_mem + cor_offset); + + /* Enable PCI interrupts if they are not already enabled */ + reg = inl(plx_ioaddr + PLX_INTCSR); + printk(KERN_DEBUG "PLX_INTCSR=0x%x\n", reg); + if (!(reg & PLX_INTCSR_PCI_INTEN)) { + outl(reg | PLX_INTCSR_PCI_INTEN, plx_ioaddr + PLX_INTCSR); + if (!(inl(plx_ioaddr + PLX_INTCSR) & PLX_INTCSR_PCI_INTEN)) { + printk(KERN_WARNING "%s: Could not enable Local " + "Interrupts\n", dev_info); + goto fail; + } + } + + reg = inl(plx_ioaddr + PLX_CNTRL); + printk(KERN_DEBUG "PLX_CNTRL=0x%x (Serial EEPROM present=%d)\n", + reg, (reg & PLX_CNTRL_SERIAL_EEPROM_PRESENT) != 0); + /* should set PLX_PCIIPR to 0x01 (INTA#) if Serial EEPROM is not + * present; but are there really such cards in use(?) */ + } else { + /* This is for pheecom card with TMD7160 chip + also referred to as ASIC version */ + printk(KERN_DEBUG "TMD setup\n"); + pccard_ioaddr = pci_resource_start(pdev, 2); + plx_ioaddr = pci_resource_start(pdev, 1); + pccard_attr_mem = 0; + printk(KERN_INFO "TMD adapter at 0x%x, pccard at 0x%x\n", plx_ioaddr, pccard_ioaddr); + outb(0x45, plx_ioaddr); + mdelay(1000); + reg = inb(plx_ioaddr); + if (reg != 0x45) { + printk(KERN_ERR "%s: Error setting TMD corr values %x\n", dev_info, reg); + goto fail; + } + /* FIXME */ + cor_offset = 0; /* no idea what they mean */ + cor_index = 0; /* no idea what they mean */ } - - printk(KERN_DEBUG "Prism2/2.5 PC Card detected in PLX adapter\n"); - - /* Write COR to enable PC Card */ - writeb(cor_index | COR_LEVLREQ | COR_ENABLE_FUNC, - attr_mem + cor_offset); - - /* Enable PCI interrupts if they are not already enabled */ - reg = inl(plx_ioaddr + PLX_INTCSR); - printk(KERN_DEBUG "PLX_INTCSR=0x%x\n", reg); - if (!(reg & PLX_INTCSR_PCI_INTEN)) { - outl(reg | PLX_INTCSR_PCI_INTEN, plx_ioaddr + PLX_INTCSR); - if (!(inl(plx_ioaddr + PLX_INTCSR) & PLX_INTCSR_PCI_INTEN)) { - printk(KERN_WARNING "%s: Could not enable Local " - "Interrupts\n", dev_info); - goto fail; - } - } - - reg = inl(plx_ioaddr + PLX_CNTRL); - printk(KERN_DEBUG "PLX_CNTRL=0x%x (Serial EEPROM present=%d)\n", - reg, (reg & PLX_CNTRL_SERIAL_EEPROM_PRESENT) != 0); - /* should set PLX_PCIIPR to 0x01 (INTA#) if Serial EEPROM is not - * present; but are there really such cards in use(?) */ local = prism2_init_local_data(&prism2_plx_funcs, cards_found); if (local == NULL)