aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/3c59x.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2005-11-07 03:58:08 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:53:25 -0500
commit900fd17dd01d2c99dfd1ec0b53a860894a2673ee (patch)
treefcd447fc10d1a58c11854e29077417c329afebe7 /drivers/net/3c59x.c
parent35b306743d17cdd31357e5de9ce6c549e5d6756e (diff)
[PATCH] 3c59x: enable use of memory-mapped PCI I/O
Add capability for 3c59x driver to use memory-mapped PCI I/O resources. This may improve performance for those devices so equipped. This will be the default behaviour for IS_CYCLONE and IS_TORNADO devices. Additionally, it can be enabled/disabled individually for up to MAX_UNITS number of devices via the use_mmio module option or for all units via the global_use_mmio option. The use_mmio option overrides the global_use_mmio option for those devices specified. Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/net/3c59x.c')
-rw-r--r--drivers/net/3c59x.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 413b82c5994c..c1ee8efc9d56 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -908,9 +908,11 @@ static int full_duplex[MAX_UNITS] = {[0 ... MAX_UNITS-1] = -1 };
908static int hw_checksums[MAX_UNITS] = {[0 ... MAX_UNITS-1] = -1 }; 908static int hw_checksums[MAX_UNITS] = {[0 ... MAX_UNITS-1] = -1 };
909static int flow_ctrl[MAX_UNITS] = {[0 ... MAX_UNITS-1] = -1 }; 909static int flow_ctrl[MAX_UNITS] = {[0 ... MAX_UNITS-1] = -1 };
910static int enable_wol[MAX_UNITS] = {[0 ... MAX_UNITS-1] = -1 }; 910static int enable_wol[MAX_UNITS] = {[0 ... MAX_UNITS-1] = -1 };
911static int use_mmio[MAX_UNITS] = {[0 ... MAX_UNITS-1] = -1 };
911static int global_options = -1; 912static int global_options = -1;
912static int global_full_duplex = -1; 913static int global_full_duplex = -1;
913static int global_enable_wol = -1; 914static int global_enable_wol = -1;
915static int global_use_mmio = -1;
914 916
915/* #define dev_alloc_skb dev_alloc_skb_debug */ 917/* #define dev_alloc_skb dev_alloc_skb_debug */
916 918
@@ -935,6 +937,8 @@ module_param(compaq_ioaddr, int, 0);
935module_param(compaq_irq, int, 0); 937module_param(compaq_irq, int, 0);
936module_param(compaq_device_id, int, 0); 938module_param(compaq_device_id, int, 0);
937module_param(watchdog, int, 0); 939module_param(watchdog, int, 0);
940module_param(global_use_mmio, int, 0);
941module_param_array(use_mmio, int, NULL, 0);
938MODULE_PARM_DESC(debug, "3c59x debug level (0-6)"); 942MODULE_PARM_DESC(debug, "3c59x debug level (0-6)");
939MODULE_PARM_DESC(options, "3c59x: Bits 0-3: media type, bit 4: bus mastering, bit 9: full duplex"); 943MODULE_PARM_DESC(options, "3c59x: Bits 0-3: media type, bit 4: bus mastering, bit 9: full duplex");
940MODULE_PARM_DESC(global_options, "3c59x: same as options, but applies to all NICs if options is unset"); 944MODULE_PARM_DESC(global_options, "3c59x: same as options, but applies to all NICs if options is unset");
@@ -950,6 +954,8 @@ MODULE_PARM_DESC(compaq_ioaddr, "3c59x PCI I/O base address (Compaq BIOS problem
950MODULE_PARM_DESC(compaq_irq, "3c59x PCI IRQ number (Compaq BIOS problem workaround)"); 954MODULE_PARM_DESC(compaq_irq, "3c59x PCI IRQ number (Compaq BIOS problem workaround)");
951MODULE_PARM_DESC(compaq_device_id, "3c59x PCI device ID (Compaq BIOS problem workaround)"); 955MODULE_PARM_DESC(compaq_device_id, "3c59x PCI device ID (Compaq BIOS problem workaround)");
952MODULE_PARM_DESC(watchdog, "3c59x transmit timeout in milliseconds"); 956MODULE_PARM_DESC(watchdog, "3c59x transmit timeout in milliseconds");
957MODULE_PARM_DESC(global_use_mmio, "3c59x: same as use_mmio, but applies to all NICs if options is unset");
958MODULE_PARM_DESC(use_mmio, "3c59x: use memory-mapped PCI I/O resource (0-1)");
953 959
954#ifdef CONFIG_NET_POLL_CONTROLLER 960#ifdef CONFIG_NET_POLL_CONTROLLER
955static void poll_vortex(struct net_device *dev) 961static void poll_vortex(struct net_device *dev)
@@ -1109,15 +1115,32 @@ static int __init vortex_eisa_init (void)
1109static int __devinit vortex_init_one (struct pci_dev *pdev, 1115static int __devinit vortex_init_one (struct pci_dev *pdev,
1110 const struct pci_device_id *ent) 1116 const struct pci_device_id *ent)
1111{ 1117{
1112 int rc; 1118 int rc, unit, pci_bar;
1119 struct vortex_chip_info *vci;
1120 void __iomem *ioaddr;
1113 1121
1114 /* wake up and enable device */ 1122 /* wake up and enable device */
1115 rc = pci_enable_device (pdev); 1123 rc = pci_enable_device (pdev);
1116 if (rc < 0) 1124 if (rc < 0)
1117 goto out; 1125 goto out;
1118 1126
1119 rc = vortex_probe1 (&pdev->dev, pci_iomap(pdev, 0, 0), 1127 unit = vortex_cards_found;
1120 pdev->irq, ent->driver_data, vortex_cards_found); 1128
1129 if (global_use_mmio < 0 && (unit >= MAX_UNITS || use_mmio[unit] < 0)) {
1130 /* Determine the default if the user didn't override us */
1131 vci = &vortex_info_tbl[ent->driver_data];
1132 pci_bar = vci->drv_flags & (IS_CYCLONE | IS_TORNADO) ? 1 : 0;
1133 } else if (unit < MAX_UNITS && use_mmio[unit] >= 0)
1134 pci_bar = use_mmio[unit] ? 1 : 0;
1135 else
1136 pci_bar = global_use_mmio ? 1 : 0;
1137
1138 ioaddr = pci_iomap(pdev, pci_bar, 0);
1139 if (!ioaddr) /* If mapping fails, fall-back to BAR 0... */
1140 ioaddr = pci_iomap(pdev, 0, 0);
1141
1142 rc = vortex_probe1(&pdev->dev, ioaddr, pdev->irq,
1143 ent->driver_data, unit);
1121 if (rc < 0) { 1144 if (rc < 0) {
1122 pci_disable_device (pdev); 1145 pci_disable_device (pdev);
1123 goto out; 1146 goto out;