diff options
author | Alan Cox <alan@linux.intel.com> | 2009-08-27 06:00:24 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-15 15:02:27 -0400 |
commit | 8c5f20f36a1550d7bda22216202372a31d92825c (patch) | |
tree | bfa2d1d79605e9a278942f44f1cbbaad6d0078b5 | |
parent | 8d0e4fd405cc796a14f317257f11e3d12cbece2d (diff) |
Staging: et131x: fold the diet config into the other code
No point having a file just for that
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/et131x/Makefile | 1 | ||||
-rw-r--r-- | drivers/staging/et131x/et131x_config.c | 183 | ||||
-rw-r--r-- | drivers/staging/et131x/et131x_initpci.c | 86 |
3 files changed, 86 insertions, 184 deletions
diff --git a/drivers/staging/et131x/Makefile b/drivers/staging/et131x/Makefile index 3ad571d8a684..3ddbc64aa5f3 100644 --- a/drivers/staging/et131x/Makefile +++ b/drivers/staging/et131x/Makefile | |||
@@ -11,7 +11,6 @@ et131x-objs := et1310_eeprom.o \ | |||
11 | et1310_pm.o \ | 11 | et1310_pm.o \ |
12 | et1310_rx.o \ | 12 | et1310_rx.o \ |
13 | et1310_tx.o \ | 13 | et1310_tx.o \ |
14 | et131x_config.o \ | ||
15 | et131x_debug.o \ | 14 | et131x_debug.o \ |
16 | et131x_initpci.o \ | 15 | et131x_initpci.o \ |
17 | et131x_isr.o \ | 16 | et131x_isr.o \ |
diff --git a/drivers/staging/et131x/et131x_config.c b/drivers/staging/et131x/et131x_config.c deleted file mode 100644 index cde727d31801..000000000000 --- a/drivers/staging/et131x/et131x_config.c +++ /dev/null | |||
@@ -1,183 +0,0 @@ | |||
1 | /* | ||
2 | * Agere Systems Inc. | ||
3 | * 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs | ||
4 | * | ||
5 | * Copyright © 2005 Agere Systems Inc. | ||
6 | * All rights reserved. | ||
7 | * http://www.agere.com | ||
8 | * | ||
9 | *------------------------------------------------------------------------------ | ||
10 | * | ||
11 | * et131x_config.c - Handles parsing of configuration data during | ||
12 | * initialization. | ||
13 | * | ||
14 | *------------------------------------------------------------------------------ | ||
15 | * | ||
16 | * SOFTWARE LICENSE | ||
17 | * | ||
18 | * This software is provided subject to the following terms and conditions, | ||
19 | * which you should read carefully before using the software. Using this | ||
20 | * software indicates your acceptance of these terms and conditions. If you do | ||
21 | * not agree with these terms and conditions, do not use the software. | ||
22 | * | ||
23 | * Copyright © 2005 Agere Systems Inc. | ||
24 | * All rights reserved. | ||
25 | * | ||
26 | * Redistribution and use in source or binary forms, with or without | ||
27 | * modifications, are permitted provided that the following conditions are met: | ||
28 | * | ||
29 | * . Redistributions of source code must retain the above copyright notice, this | ||
30 | * list of conditions and the following Disclaimer as comments in the code as | ||
31 | * well as in the documentation and/or other materials provided with the | ||
32 | * distribution. | ||
33 | * | ||
34 | * . Redistributions in binary form must reproduce the above copyright notice, | ||
35 | * this list of conditions and the following Disclaimer in the documentation | ||
36 | * and/or other materials provided with the distribution. | ||
37 | * | ||
38 | * . Neither the name of Agere Systems Inc. nor the names of the contributors | ||
39 | * may be used to endorse or promote products derived from this software | ||
40 | * without specific prior written permission. | ||
41 | * | ||
42 | * Disclaimer | ||
43 | * | ||
44 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
45 | * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF | ||
46 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY | ||
47 | * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN | ||
48 | * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY | ||
49 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
50 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
51 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
52 | * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT | ||
53 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | ||
54 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
55 | * DAMAGE. | ||
56 | * | ||
57 | */ | ||
58 | |||
59 | #include "et131x_version.h" | ||
60 | #include "et131x_debug.h" | ||
61 | #include "et131x_defs.h" | ||
62 | |||
63 | #include <linux/init.h> | ||
64 | #include <linux/module.h> | ||
65 | #include <linux/types.h> | ||
66 | #include <linux/kernel.h> | ||
67 | |||
68 | #include <linux/sched.h> | ||
69 | #include <linux/ptrace.h> | ||
70 | #include <linux/slab.h> | ||
71 | #include <linux/ctype.h> | ||
72 | #include <linux/string.h> | ||
73 | #include <linux/timer.h> | ||
74 | #include <linux/interrupt.h> | ||
75 | #include <linux/in.h> | ||
76 | #include <linux/delay.h> | ||
77 | #include <linux/io.h> | ||
78 | #include <linux/bitops.h> | ||
79 | #include <linux/pci.h> | ||
80 | #include <asm/system.h> | ||
81 | |||
82 | #include <linux/netdevice.h> | ||
83 | #include <linux/etherdevice.h> | ||
84 | #include <linux/skbuff.h> | ||
85 | #include <linux/if_arp.h> | ||
86 | #include <linux/ioport.h> | ||
87 | |||
88 | #include "et1310_phy.h" | ||
89 | #include "et1310_pm.h" | ||
90 | #include "et1310_jagcore.h" | ||
91 | |||
92 | #include "et131x_adapter.h" | ||
93 | #include "et131x_initpci.h" | ||
94 | #include "et131x_config.h" | ||
95 | |||
96 | #include "et1310_tx.h" | ||
97 | |||
98 | /* Data for debugging facilities */ | ||
99 | #ifdef CONFIG_ET131X_DEBUG | ||
100 | extern dbg_info_t *et131x_dbginfo; | ||
101 | #endif /* CONFIG_ET131X_DEBUG */ | ||
102 | |||
103 | /* Defines for Parameter Default/Min/Max vaules */ | ||
104 | #define PARM_SPEED_DUPLEX_MIN 0 | ||
105 | #define PARM_SPEED_DUPLEX_MAX 5 | ||
106 | |||
107 | /* Module parameter for disabling NMI | ||
108 | * et131x_nmi_disable : | ||
109 | * Disable NMI (0-2) [0] | ||
110 | * 0 : | ||
111 | * 1 : | ||
112 | * 2 : | ||
113 | */ | ||
114 | static u32 et131x_nmi_disable; /* 0-2 */ | ||
115 | module_param(et131x_nmi_disable, uint, 0); | ||
116 | MODULE_PARM_DESC(et131x_nmi_disable, "Disable NMI (0-2) [0]"); | ||
117 | |||
118 | /* Module parameter for manual speed setting | ||
119 | * Set Link speed and dublex manually (0-5) [0] | ||
120 | * 1 : 10Mb Half-Duplex | ||
121 | * 2 : 10Mb Full-Duplex | ||
122 | * 3 : 100Mb Half-Duplex | ||
123 | * 4 : 100Mb Full-Duplex | ||
124 | * 5 : 1000Mb Full-Duplex | ||
125 | * 0 : Auto Speed Auto Duplex // default | ||
126 | */ | ||
127 | static u32 et131x_speed_set; | ||
128 | module_param(et131x_speed_set, uint, 0); | ||
129 | MODULE_PARM_DESC(et131x_speed_set, | ||
130 | "Set Link speed and dublex manually (0-5) [0] \n 1 : 10Mb Half-Duplex \n 2 : 10Mb Full-Duplex \n 3 : 100Mb Half-Duplex \n 4 : 100Mb Full-Duplex \n 5 : 1000Mb Full-Duplex \n 0 : Auto Speed Auto Dublex"); | ||
131 | |||
132 | /** | ||
133 | * et131x_config_parse | ||
134 | * @etdev: pointer to the private adapter struct | ||
135 | * | ||
136 | * Parses a configuration from some location (module parameters, for example) | ||
137 | * into the private adapter struct. This really has no sensible analogy in | ||
138 | * Linux as sysfs parameters are dynamic. Several things that were hee could | ||
139 | * go into sysfs, but other stuff like speed handling is part of the mii | ||
140 | * interfaces/ethtool. | ||
141 | */ | ||
142 | void et131x_config_parse(struct et131x_adapter *etdev) | ||
143 | { | ||
144 | static const u8 default_mac[] = { 0x00, 0x05, 0x3d, 0x00, 0x02, 0x00 }; | ||
145 | static const u8 duplex[] = { 0, 1, 2, 1, 2, 2 }; | ||
146 | static const u16 speed[] = { 0, 10, 10, 100, 100, 1000 }; | ||
147 | |||
148 | DBG_ENTER(et131x_dbginfo); | ||
149 | |||
150 | if (et131x_speed_set < PARM_SPEED_DUPLEX_MIN || | ||
151 | et131x_speed_set > PARM_SPEED_DUPLEX_MAX) { | ||
152 | dev_warn(&etdev->pdev->dev, "invalid speed setting ignored.\n"); | ||
153 | et131x_speed_set = 0; | ||
154 | } | ||
155 | else if (et131x_speed_set) | ||
156 | DBG_VERBOSE(et131x_dbginfo, "Speed set manually to : %d \n", | ||
157 | et131x_speed_set); | ||
158 | |||
159 | etdev->SpeedDuplex = et131x_speed_set; | ||
160 | etdev->RegistryJumboPacket = 1514; /* 1514-9216 */ | ||
161 | |||
162 | etdev->RegistryNMIDisable = et131x_nmi_disable; | ||
163 | |||
164 | /* Set the MAC address to a default */ | ||
165 | memcpy(etdev->CurrentAddress, default_mac, ETH_ALEN); | ||
166 | |||
167 | /* Decode SpeedDuplex | ||
168 | * | ||
169 | * Set up as if we are auto negotiating always and then change if we | ||
170 | * go into force mode | ||
171 | * | ||
172 | * If we are the 10/100 device, and gigabit is somehow requested then | ||
173 | * knock it down to 100 full. | ||
174 | */ | ||
175 | if (etdev->pdev->device == ET131X_PCI_DEVICE_ID_FAST && | ||
176 | etdev->SpeedDuplex == 5) | ||
177 | etdev->SpeedDuplex = 4; | ||
178 | |||
179 | etdev->AiForceSpeed = speed[etdev->SpeedDuplex]; | ||
180 | etdev->AiForceDpx = duplex[etdev->SpeedDuplex]; /* Auto FDX */ | ||
181 | |||
182 | DBG_LEAVE(et131x_dbginfo); | ||
183 | } | ||
diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c index c489090178be..34737d163808 100644 --- a/drivers/staging/et131x/et131x_initpci.c +++ b/drivers/staging/et131x/et131x_initpci.c | |||
@@ -140,6 +140,37 @@ static dbg_info_t et131x_info = { DRIVER_NAME_EXT, 0, 0 }; | |||
140 | dbg_info_t *et131x_dbginfo = &et131x_info; | 140 | dbg_info_t *et131x_dbginfo = &et131x_info; |
141 | #endif /* CONFIG_ET131X_DEBUG */ | 141 | #endif /* CONFIG_ET131X_DEBUG */ |
142 | 142 | ||
143 | /* Defines for Parameter Default/Min/Max vaules */ | ||
144 | #define PARM_SPEED_DUPLEX_MIN 0 | ||
145 | #define PARM_SPEED_DUPLEX_MAX 5 | ||
146 | |||
147 | /* Module parameter for disabling NMI | ||
148 | * et131x_nmi_disable : | ||
149 | * Disable NMI (0-2) [0] | ||
150 | * 0 : | ||
151 | * 1 : | ||
152 | * 2 : | ||
153 | */ | ||
154 | static u32 et131x_nmi_disable; /* 0-2 */ | ||
155 | module_param(et131x_nmi_disable, uint, 0); | ||
156 | MODULE_PARM_DESC(et131x_nmi_disable, "Disable NMI (0-2) [0]"); | ||
157 | |||
158 | /* Module parameter for manual speed setting | ||
159 | * Set Link speed and dublex manually (0-5) [0] | ||
160 | * 1 : 10Mb Half-Duplex | ||
161 | * 2 : 10Mb Full-Duplex | ||
162 | * 3 : 100Mb Half-Duplex | ||
163 | * 4 : 100Mb Full-Duplex | ||
164 | * 5 : 1000Mb Full-Duplex | ||
165 | * 0 : Auto Speed Auto Duplex // default | ||
166 | */ | ||
167 | static u32 et131x_speed_set; | ||
168 | module_param(et131x_speed_set, uint, 0); | ||
169 | MODULE_PARM_DESC(et131x_speed_set, | ||
170 | "Set Link speed and dublex manually (0-5) [0] \n 1 : 10Mb Half-Duplex \n 2 : 10Mb Full-Duplex \n 3 : 100Mb Half-Duplex \n 4 : 100Mb Full-Duplex \n 5 : 1000Mb Full-Duplex \n 0 : Auto Speed Auto Dublex"); | ||
171 | |||
172 | |||
173 | |||
143 | static struct pci_device_id et131x_pci_table[] __devinitdata = { | 174 | static struct pci_device_id et131x_pci_table[] __devinitdata = { |
144 | {ET131X_PCI_VENDOR_ID, ET131X_PCI_DEVICE_ID_GIG, PCI_ANY_ID, | 175 | {ET131X_PCI_VENDOR_ID, ET131X_PCI_DEVICE_ID_GIG, PCI_ANY_ID, |
145 | PCI_ANY_ID, 0, 0, 0UL}, | 176 | PCI_ANY_ID, 0, 0, 0UL}, |
@@ -202,6 +233,12 @@ int et131x_init_module(void) | |||
202 | DBG_ENTER(et131x_dbginfo); | 233 | DBG_ENTER(et131x_dbginfo); |
203 | DBG_PRINT("%s\n", DRIVER_INFO); | 234 | DBG_PRINT("%s\n", DRIVER_INFO); |
204 | 235 | ||
236 | if (et131x_speed_set < PARM_SPEED_DUPLEX_MIN || | ||
237 | et131x_speed_set > PARM_SPEED_DUPLEX_MAX) { | ||
238 | printk(KERN_WARNING "et131x: invalid speed setting ignored.\n"); | ||
239 | et131x_speed_set = 0; | ||
240 | } | ||
241 | |||
205 | result = pci_register_driver(&et131x_driver); | 242 | result = pci_register_driver(&et131x_driver); |
206 | 243 | ||
207 | DBG_LEAVE(et131x_dbginfo); | 244 | DBG_LEAVE(et131x_dbginfo); |
@@ -750,6 +787,55 @@ void __devexit et131x_pci_remove(struct pci_dev *pdev) | |||
750 | } | 787 | } |
751 | 788 | ||
752 | /** | 789 | /** |
790 | * et131x_config_parse | ||
791 | * @etdev: pointer to the private adapter struct | ||
792 | * | ||
793 | * Parses a configuration from some location (module parameters, for example) | ||
794 | * into the private adapter struct. This really has no sensible analogy in | ||
795 | * Linux as sysfs parameters are dynamic. Several things that were hee could | ||
796 | * go into sysfs, but other stuff like speed handling is part of the mii | ||
797 | * interfaces/ethtool. | ||
798 | */ | ||
799 | void et131x_config_parse(struct et131x_adapter *etdev) | ||
800 | { | ||
801 | static const u8 default_mac[] = { 0x00, 0x05, 0x3d, 0x00, 0x02, 0x00 }; | ||
802 | static const u8 duplex[] = { 0, 1, 2, 1, 2, 2 }; | ||
803 | static const u16 speed[] = { 0, 10, 10, 100, 100, 1000 }; | ||
804 | |||
805 | DBG_ENTER(et131x_dbginfo); | ||
806 | |||
807 | if (et131x_speed_set) | ||
808 | DBG_VERBOSE(et131x_dbginfo, "Speed set manually to : %d \n", | ||
809 | et131x_speed_set); | ||
810 | |||
811 | etdev->SpeedDuplex = et131x_speed_set; | ||
812 | etdev->RegistryJumboPacket = 1514; /* 1514-9216 */ | ||
813 | |||
814 | etdev->RegistryNMIDisable = et131x_nmi_disable; | ||
815 | |||
816 | /* Set the MAC address to a default */ | ||
817 | memcpy(etdev->CurrentAddress, default_mac, ETH_ALEN); | ||
818 | |||
819 | /* Decode SpeedDuplex | ||
820 | * | ||
821 | * Set up as if we are auto negotiating always and then change if we | ||
822 | * go into force mode | ||
823 | * | ||
824 | * If we are the 10/100 device, and gigabit is somehow requested then | ||
825 | * knock it down to 100 full. | ||
826 | */ | ||
827 | if (etdev->pdev->device == ET131X_PCI_DEVICE_ID_FAST && | ||
828 | etdev->SpeedDuplex == 5) | ||
829 | etdev->SpeedDuplex = 4; | ||
830 | |||
831 | etdev->AiForceSpeed = speed[etdev->SpeedDuplex]; | ||
832 | etdev->AiForceDpx = duplex[etdev->SpeedDuplex]; /* Auto FDX */ | ||
833 | |||
834 | DBG_LEAVE(et131x_dbginfo); | ||
835 | } | ||
836 | |||
837 | |||
838 | /** | ||
753 | * et131x_pci_setup - Perform device initialization | 839 | * et131x_pci_setup - Perform device initialization |
754 | * @pdev: a pointer to the device's pci_dev structure | 840 | * @pdev: a pointer to the device's pci_dev structure |
755 | * @ent: this device's entry in the pci_device_id table | 841 | * @ent: this device's entry in the pci_device_id table |