diff options
author | Krzysztof Hałasa <khc@pm.waw.pl> | 2008-11-20 09:51:05 -0500 |
---|---|---|
committer | Krzysztof Hałasa <khc@pm.waw.pl> | 2008-11-21 20:55:21 -0500 |
commit | 6476a907b57d9229de7807aeea534ad45e19a4ce (patch) | |
tree | cd31ad13351efeeacee7e26579b54768c49ee313 | |
parent | 72364706c3b7c09a658e356218a918c5f92dcad0 (diff) |
WAN pc300too.c: Fix PC300-X.21 detection
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>
-rw-r--r-- | drivers/net/wan/pc300too.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c index ac8b0a20a0d8..f247e5d9002a 100644 --- a/drivers/net/wan/pc300too.c +++ b/drivers/net/wan/pc300too.c | |||
@@ -319,27 +319,6 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev, | |||
319 | } | 319 | } |
320 | pci_set_drvdata(pdev, card); | 320 | pci_set_drvdata(pdev, card); |
321 | 321 | ||
322 | if (pdev->device == PCI_DEVICE_ID_PC300_TE_1 || | ||
323 | pdev->device == PCI_DEVICE_ID_PC300_TE_2) | ||
324 | card->type = PC300_TE; /* not fully supported */ | ||
325 | else if (card->init_ctrl_value & PC300_CTYPE_MASK) | ||
326 | card->type = PC300_X21; | ||
327 | else | ||
328 | card->type = PC300_RSV; | ||
329 | |||
330 | if (pdev->device == PCI_DEVICE_ID_PC300_RX_1 || | ||
331 | pdev->device == PCI_DEVICE_ID_PC300_TE_1) | ||
332 | card->n_ports = 1; | ||
333 | else | ||
334 | card->n_ports = 2; | ||
335 | |||
336 | for (i = 0; i < card->n_ports; i++) | ||
337 | if (!(card->ports[i].netdev = alloc_hdlcdev(&card->ports[i]))) { | ||
338 | printk(KERN_ERR "pc300: unable to allocate memory\n"); | ||
339 | pc300_pci_remove_one(pdev); | ||
340 | return -ENOMEM; | ||
341 | } | ||
342 | |||
343 | if (pci_resource_len(pdev, 0) != PC300_PLX_SIZE || | 322 | if (pci_resource_len(pdev, 0) != PC300_PLX_SIZE || |
344 | pci_resource_len(pdev, 2) != PC300_SCA_SIZE || | 323 | pci_resource_len(pdev, 2) != PC300_SCA_SIZE || |
345 | pci_resource_len(pdev, 3) < 16384) { | 324 | pci_resource_len(pdev, 3) < 16384) { |
@@ -348,13 +327,13 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev, | |||
348 | return -EFAULT; | 327 | return -EFAULT; |
349 | } | 328 | } |
350 | 329 | ||
351 | plxphys = pci_resource_start(pdev,0) & PCI_BASE_ADDRESS_MEM_MASK; | 330 | plxphys = pci_resource_start(pdev, 0) & PCI_BASE_ADDRESS_MEM_MASK; |
352 | card->plxbase = ioremap(plxphys, PC300_PLX_SIZE); | 331 | card->plxbase = ioremap(plxphys, PC300_PLX_SIZE); |
353 | 332 | ||
354 | scaphys = pci_resource_start(pdev,2) & PCI_BASE_ADDRESS_MEM_MASK; | 333 | scaphys = pci_resource_start(pdev, 2) & PCI_BASE_ADDRESS_MEM_MASK; |
355 | card->scabase = ioremap(scaphys, PC300_SCA_SIZE); | 334 | card->scabase = ioremap(scaphys, PC300_SCA_SIZE); |
356 | 335 | ||
357 | ramphys = pci_resource_start(pdev,3) & PCI_BASE_ADDRESS_MEM_MASK; | 336 | ramphys = pci_resource_start(pdev, 3) & PCI_BASE_ADDRESS_MEM_MASK; |
358 | card->rambase = pci_ioremap_bar(pdev, 3); | 337 | card->rambase = pci_ioremap_bar(pdev, 3); |
359 | 338 | ||
360 | if (card->plxbase == NULL || | 339 | if (card->plxbase == NULL || |
@@ -369,6 +348,27 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev, | |||
369 | card->init_ctrl_value = readl(&((plx9050 __iomem *)card->scabase)->init_ctrl); | 348 | card->init_ctrl_value = readl(&((plx9050 __iomem *)card->scabase)->init_ctrl); |
370 | pci_write_config_dword(pdev, PCI_BASE_ADDRESS_0, plxphys); | 349 | pci_write_config_dword(pdev, PCI_BASE_ADDRESS_0, plxphys); |
371 | 350 | ||
351 | if (pdev->device == PCI_DEVICE_ID_PC300_TE_1 || | ||
352 | pdev->device == PCI_DEVICE_ID_PC300_TE_2) | ||
353 | card->type = PC300_TE; /* not fully supported */ | ||
354 | else if (card->init_ctrl_value & PC300_CTYPE_MASK) | ||
355 | card->type = PC300_X21; | ||
356 | else | ||
357 | card->type = PC300_RSV; | ||
358 | |||
359 | if (pdev->device == PCI_DEVICE_ID_PC300_RX_1 || | ||
360 | pdev->device == PCI_DEVICE_ID_PC300_TE_1) | ||
361 | card->n_ports = 1; | ||
362 | else | ||
363 | card->n_ports = 2; | ||
364 | |||
365 | for (i = 0; i < card->n_ports; i++) | ||
366 | if (!(card->ports[i].netdev = alloc_hdlcdev(&card->ports[i]))) { | ||
367 | printk(KERN_ERR "pc300: unable to allocate memory\n"); | ||
368 | pc300_pci_remove_one(pdev); | ||
369 | return -ENOMEM; | ||
370 | } | ||
371 | |||
372 | /* Reset PLX */ | 372 | /* Reset PLX */ |
373 | p = &card->plxbase->init_ctrl; | 373 | p = &card->plxbase->init_ctrl; |
374 | writel(card->init_ctrl_value | 0x40000000, p); | 374 | writel(card->init_ctrl_value | 0x40000000, p); |