aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/fddi
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2014-11-21 09:09:57 -0500
committerDavid S. Miller <davem@davemloft.net>2014-11-21 16:37:13 -0500
commitfef85fc466ec1f4400a902049a519948f6b40979 (patch)
treed8131b7c12ad58befd1004d1cfaba4a40d43e277 /drivers/net/fddi
parenta65da0c3dac6e2d4f8ecf0aee8b0abe10001f2d9 (diff)
defxx: Correct DEFEA's ESIC MMIO decoding
Use ESIC's memory area 1 (MEMCS1) and its Memory Address High Compare and Memory Address Low Compare registers to set up the MMIO range for decoding accesses to PDQ ASIC registers. Previously the PDQ ASIC was thought to be addressable with the memory area 0 (MEMCS0) and its Memory Address Compare and Memory Address Mask registers. The MMIO range allocated for the option card is preset via ECU (EISA Configuration Utility) and can be disabled, so handle such a case gracefully too. Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/fddi')
-rw-r--r--drivers/net/fddi/defxx.c61
-rw-r--r--drivers/net/fddi/defxx.h2
2 files changed, 39 insertions, 24 deletions
diff --git a/drivers/net/fddi/defxx.c b/drivers/net/fddi/defxx.c
index d8d4f3d3ca32..75d54ea72c56 100644
--- a/drivers/net/fddi/defxx.c
+++ b/drivers/net/fddi/defxx.c
@@ -447,23 +447,24 @@ static void dfx_get_bars(struct device *bdev,
447 } 447 }
448 if (dfx_bus_eisa) { 448 if (dfx_bus_eisa) {
449 unsigned long base_addr = to_eisa_device(bdev)->base_addr; 449 unsigned long base_addr = to_eisa_device(bdev)->base_addr;
450 resource_size_t bar; 450 resource_size_t bar_lo;
451 resource_size_t bar_hi;
451 452
452 if (dfx_use_mmio) { 453 if (dfx_use_mmio) {
453 bar = inb(base_addr + PI_ESIC_K_MEM_ADD_CMP_2); 454 bar_lo = inb(base_addr + PI_ESIC_K_MEM_ADD_LO_CMP_2);
454 bar <<= 8; 455 bar_lo <<= 8;
455 bar |= inb(base_addr + PI_ESIC_K_MEM_ADD_CMP_1); 456 bar_lo |= inb(base_addr + PI_ESIC_K_MEM_ADD_LO_CMP_1);
456 bar <<= 8; 457 bar_lo <<= 8;
457 bar |= inb(base_addr + PI_ESIC_K_MEM_ADD_CMP_0); 458 bar_lo |= inb(base_addr + PI_ESIC_K_MEM_ADD_LO_CMP_0);
458 bar <<= 16; 459 bar_lo <<= 8;
459 *bar_start = bar; 460 *bar_start = bar_lo;
460 bar = inb(base_addr + PI_ESIC_K_MEM_ADD_MASK_2); 461 bar_hi = inb(base_addr + PI_ESIC_K_MEM_ADD_HI_CMP_2);
461 bar <<= 8; 462 bar_hi <<= 8;
462 bar |= inb(base_addr + PI_ESIC_K_MEM_ADD_MASK_1); 463 bar_hi |= inb(base_addr + PI_ESIC_K_MEM_ADD_HI_CMP_1);
463 bar <<= 8; 464 bar_hi <<= 8;
464 bar |= inb(base_addr + PI_ESIC_K_MEM_ADD_MASK_0); 465 bar_hi |= inb(base_addr + PI_ESIC_K_MEM_ADD_HI_CMP_0);
465 bar <<= 16; 466 bar_hi <<= 8;
466 *bar_len = (bar | PI_MEM_ADD_MASK_M) + 1; 467 *bar_len = ((bar_hi - bar_lo) | PI_MEM_ADD_MASK_M) + 1;
467 } else { 468 } else {
468 *bar_start = base_addr; 469 *bar_start = base_addr;
469 *bar_len = PI_ESIC_K_CSR_IO_LEN + 470 *bar_len = PI_ESIC_K_CSR_IO_LEN +
@@ -518,6 +519,7 @@ static int dfx_register(struct device *bdev)
518{ 519{
519 static int version_disp; 520 static int version_disp;
520 int dfx_bus_pci = dev_is_pci(bdev); 521 int dfx_bus_pci = dev_is_pci(bdev);
522 int dfx_bus_eisa = DFX_BUS_EISA(bdev);
521 int dfx_bus_tc = DFX_BUS_TC(bdev); 523 int dfx_bus_tc = DFX_BUS_TC(bdev);
522 int dfx_use_mmio = DFX_MMIO || dfx_bus_tc; 524 int dfx_use_mmio = DFX_MMIO || dfx_bus_tc;
523 const char *print_name = dev_name(bdev); 525 const char *print_name = dev_name(bdev);
@@ -558,6 +560,16 @@ static int dfx_register(struct device *bdev)
558 dev_set_drvdata(bdev, dev); 560 dev_set_drvdata(bdev, dev);
559 561
560 dfx_get_bars(bdev, &bar_start, &bar_len); 562 dfx_get_bars(bdev, &bar_start, &bar_len);
563 if (dfx_bus_eisa && dfx_use_mmio && bar_start == 0) {
564 pr_err("%s: Cannot use MMIO, no address set, aborting\n",
565 print_name);
566 pr_err("%s: Run ECU and set adapter's MMIO location\n",
567 print_name);
568 pr_err("%s: Or recompile driver with \"CONFIG_DEFXX_MMIO=n\""
569 "\n", print_name);
570 err = -ENXIO;
571 goto err_out;
572 }
561 573
562 if (dfx_use_mmio) 574 if (dfx_use_mmio)
563 region = request_mem_region(bar_start, bar_len, print_name); 575 region = request_mem_region(bar_start, bar_len, print_name);
@@ -714,13 +726,14 @@ static void dfx_bus_init(struct net_device *dev)
714 } 726 }
715 727
716 /* 728 /*
717 * Enable memory decoding (MEMCS0) and/or port decoding 729 * Enable memory decoding (MEMCS1) and/or port decoding
718 * (IOCS1/IOCS0) as appropriate in Function Control 730 * (IOCS1/IOCS0) as appropriate in Function Control
719 * Register. IOCS0 is used for PDQ registers, taking 16 731 * Register. MEMCS1 or IOCS0 is used for PDQ registers,
720 * 32-bit words, while IOCS1 is used for the Burst Holdoff 732 * taking 16 32-bit words, while IOCS1 is used for the
721 * register, taking a single 32-bit word only. We use the 733 * Burst Holdoff register, taking a single 32-bit word
722 * slot-specific I/O range as per the ESIC spec, that is 734 * only. We use the slot-specific I/O range as per the
723 * set bits 15:12 in the mask registers to mask them out. 735 * ESIC spec, that is set bits 15:12 in the mask registers
736 * to mask them out.
724 */ 737 */
725 738
726 /* Set the decode range of the board. */ 739 /* Set the decode range of the board. */
@@ -745,9 +758,11 @@ static void dfx_bus_init(struct net_device *dev)
745 outb(val, base_addr + PI_ESIC_K_IO_ADD_MASK_1_0); 758 outb(val, base_addr + PI_ESIC_K_IO_ADD_MASK_1_0);
746 759
747 /* Enable the decoders. */ 760 /* Enable the decoders. */
748 val = PI_FUNCTION_CNTRL_M_IOCS1 | PI_FUNCTION_CNTRL_M_IOCS0; 761 val = PI_FUNCTION_CNTRL_M_IOCS1;
749 if (dfx_use_mmio) 762 if (dfx_use_mmio)
750 val |= PI_FUNCTION_CNTRL_M_MEMCS0; 763 val |= PI_FUNCTION_CNTRL_M_MEMCS1;
764 else
765 val |= PI_FUNCTION_CNTRL_M_IOCS0;
751 outb(val, base_addr + PI_ESIC_K_FUNCTION_CNTRL); 766 outb(val, base_addr + PI_ESIC_K_FUNCTION_CNTRL);
752 767
753 /* 768 /*
diff --git a/drivers/net/fddi/defxx.h b/drivers/net/fddi/defxx.h
index 9527f0182fd4..16fe8049b238 100644
--- a/drivers/net/fddi/defxx.h
+++ b/drivers/net/fddi/defxx.h
@@ -1556,7 +1556,7 @@ typedef union
1556#define PI_BURST_HOLDOFF_V_RESERVED 1 1556#define PI_BURST_HOLDOFF_V_RESERVED 1
1557#define PI_BURST_HOLDOFF_V_MEM_MAP 0 1557#define PI_BURST_HOLDOFF_V_MEM_MAP 0
1558 1558
1559/* Define the implicit mask of the Memory Address Mask Register. */ 1559/* Define the implicit mask of the Memory Address Compare registers. */
1560 1560
1561#define PI_MEM_ADD_MASK_M 0x3ff 1561#define PI_MEM_ADD_MASK_M 0x3ff
1562 1562