]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
WAN pc300too.c: Fix PC300-X.21 detection
authorKrzysztof Hałasa <khc@pm.waw.pl>
Thu, 20 Nov 2008 14:51:05 +0000 (15:51 +0100)
committerKrzysztof Hałasa <khc@pm.waw.pl>
Sat, 22 Nov 2008 01:55:21 +0000 (02:55 +0100)
pc300too driver works around a bug in PCI9050 bridge.  Unfortunately
it was doing that too late.

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
drivers/net/wan/pc300too.c

index ac8b0a20a0d857a9fd9de1188c9b16a37cc72491..f247e5d9002a3b8837f64e390583c3efcb1470c5 100644 (file)
@@ -319,27 +319,6 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
        }
        pci_set_drvdata(pdev, card);
 
-       if (pdev->device == PCI_DEVICE_ID_PC300_TE_1 ||
-           pdev->device == PCI_DEVICE_ID_PC300_TE_2)
-               card->type = PC300_TE; /* not fully supported */
-       else if (card->init_ctrl_value & PC300_CTYPE_MASK)
-               card->type = PC300_X21;
-       else
-               card->type = PC300_RSV;
-
-       if (pdev->device == PCI_DEVICE_ID_PC300_RX_1 ||
-           pdev->device == PCI_DEVICE_ID_PC300_TE_1)
-               card->n_ports = 1;
-       else
-               card->n_ports = 2;
-
-       for (i = 0; i < card->n_ports; i++)
-               if (!(card->ports[i].netdev = alloc_hdlcdev(&card->ports[i]))) {
-                       printk(KERN_ERR "pc300: unable to allocate memory\n");
-                       pc300_pci_remove_one(pdev);
-                       return -ENOMEM;
-               }
-
        if (pci_resource_len(pdev, 0) != PC300_PLX_SIZE ||
            pci_resource_len(pdev, 2) != PC300_SCA_SIZE ||
            pci_resource_len(pdev, 3) < 16384) {
@@ -348,13 +327,13 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
                return -EFAULT;
        }
 
-       plxphys = pci_resource_start(pdev,0) & PCI_BASE_ADDRESS_MEM_MASK;
+       plxphys = pci_resource_start(pdev, 0) & PCI_BASE_ADDRESS_MEM_MASK;
        card->plxbase = ioremap(plxphys, PC300_PLX_SIZE);
 
-       scaphys = pci_resource_start(pdev,2) & PCI_BASE_ADDRESS_MEM_MASK;
+       scaphys = pci_resource_start(pdev, 2) & PCI_BASE_ADDRESS_MEM_MASK;
        card->scabase = ioremap(scaphys, PC300_SCA_SIZE);
 
-       ramphys = pci_resource_start(pdev,3) & PCI_BASE_ADDRESS_MEM_MASK;
+       ramphys = pci_resource_start(pdev, 3) & PCI_BASE_ADDRESS_MEM_MASK;
        card->rambase = pci_ioremap_bar(pdev, 3);
 
        if (card->plxbase == NULL ||
@@ -369,6 +348,27 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
        card->init_ctrl_value = readl(&((plx9050 __iomem *)card->scabase)->init_ctrl);
        pci_write_config_dword(pdev, PCI_BASE_ADDRESS_0, plxphys);
 
+       if (pdev->device == PCI_DEVICE_ID_PC300_TE_1 ||
+           pdev->device == PCI_DEVICE_ID_PC300_TE_2)
+               card->type = PC300_TE; /* not fully supported */
+       else if (card->init_ctrl_value & PC300_CTYPE_MASK)
+               card->type = PC300_X21;
+       else
+               card->type = PC300_RSV;
+
+       if (pdev->device == PCI_DEVICE_ID_PC300_RX_1 ||
+           pdev->device == PCI_DEVICE_ID_PC300_TE_1)
+               card->n_ports = 1;
+       else
+               card->n_ports = 2;
+
+       for (i = 0; i < card->n_ports; i++)
+               if (!(card->ports[i].netdev = alloc_hdlcdev(&card->ports[i]))) {
+                       printk(KERN_ERR "pc300: unable to allocate memory\n");
+                       pc300_pci_remove_one(pdev);
+                       return -ENOMEM;
+               }
+
        /* Reset PLX */
        p = &card->plxbase->init_ctrl;
        writel(card->init_ctrl_value | 0x40000000, p);