diff options
348 files changed, 18206 insertions, 3489 deletions
diff --git a/Documentation/fb/imacfb.txt b/Documentation/fb/imacfb.txt new file mode 100644 index 000000000000..759028545a7e --- /dev/null +++ b/Documentation/fb/imacfb.txt | |||
@@ -0,0 +1,31 @@ | |||
1 | |||
2 | What is imacfb? | ||
3 | =============== | ||
4 | |||
5 | This is a generic EFI platform driver for Intel based Apple computers. | ||
6 | Imacfb is only for EFI booted Intel Macs. | ||
7 | |||
8 | Supported Hardware | ||
9 | ================== | ||
10 | |||
11 | iMac 17"/20" | ||
12 | Macbook | ||
13 | Macbook Pro 15"/17" | ||
14 | MacMini | ||
15 | |||
16 | How to use it? | ||
17 | ============== | ||
18 | |||
19 | Imacfb does not have any kind of autodetection of your machine. | ||
20 | You have to add the fillowing kernel parameters in your elilo.conf: | ||
21 | Macbook : | ||
22 | video=imacfb:macbook | ||
23 | MacMini : | ||
24 | video=imacfb:mini | ||
25 | Macbook Pro 15", iMac 17" : | ||
26 | video=imacfb:i17 | ||
27 | Macbook Pro 17", iMac 20" : | ||
28 | video=imacfb:i20 | ||
29 | |||
30 | -- | ||
31 | Edgar Hucek <gimli@dark-green.com> | ||
diff --git a/Documentation/kobject.txt b/Documentation/kobject.txt index 8d9bffbd192c..949f7b5a2053 100644 --- a/Documentation/kobject.txt +++ b/Documentation/kobject.txt | |||
@@ -247,7 +247,7 @@ the object-specific fields, which include: | |||
247 | - default_attrs: Default attributes to be exported via sysfs when the | 247 | - default_attrs: Default attributes to be exported via sysfs when the |
248 | object is registered.Note that the last attribute has to be | 248 | object is registered.Note that the last attribute has to be |
249 | initialized to NULL ! You can find a complete implementation | 249 | initialized to NULL ! You can find a complete implementation |
250 | in drivers/block/genhd.c | 250 | in block/genhd.c |
251 | 251 | ||
252 | 252 | ||
253 | Instances of struct kobj_type are not registered; only referenced by | 253 | Instances of struct kobj_type are not registered; only referenced by |
diff --git a/Documentation/networking/LICENSE.qla3xxx b/Documentation/networking/LICENSE.qla3xxx new file mode 100644 index 000000000000..2f2077e34d81 --- /dev/null +++ b/Documentation/networking/LICENSE.qla3xxx | |||
@@ -0,0 +1,46 @@ | |||
1 | Copyright (c) 2003-2006 QLogic Corporation | ||
2 | QLogic Linux Networking HBA Driver | ||
3 | |||
4 | This program includes a device driver for Linux 2.6 that may be | ||
5 | distributed with QLogic hardware specific firmware binary file. | ||
6 | You may modify and redistribute the device driver code under the | ||
7 | GNU General Public License as published by the Free Software | ||
8 | Foundation (version 2 or a later version). | ||
9 | |||
10 | You may redistribute the hardware specific firmware binary file | ||
11 | under the following terms: | ||
12 | |||
13 | 1. Redistribution of source code (only if applicable), | ||
14 | must retain the above copyright notice, this list of | ||
15 | conditions and the following disclaimer. | ||
16 | |||
17 | 2. Redistribution in binary form must reproduce the above | ||
18 | copyright notice, this list of conditions and the | ||
19 | following disclaimer in the documentation and/or other | ||
20 | materials provided with the distribution. | ||
21 | |||
22 | 3. The name of QLogic Corporation may not be used to | ||
23 | endorse or promote products derived from this software | ||
24 | without specific prior written permission | ||
25 | |||
26 | REGARDLESS OF WHAT LICENSING MECHANISM IS USED OR APPLICABLE, | ||
27 | THIS PROGRAM IS PROVIDED BY QLOGIC CORPORATION "AS IS'' AND ANY | ||
28 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
29 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
30 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR | ||
31 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
32 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | ||
33 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
34 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
35 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
36 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
37 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
38 | POSSIBILITY OF SUCH DAMAGE. | ||
39 | |||
40 | USER ACKNOWLEDGES AND AGREES THAT USE OF THIS PROGRAM WILL NOT | ||
41 | CREATE OR GIVE GROUNDS FOR A LICENSE BY IMPLICATION, ESTOPPEL, OR | ||
42 | OTHERWISE IN ANY INTELLECTUAL PROPERTY RIGHTS (PATENT, COPYRIGHT, | ||
43 | TRADE SECRET, MASK WORK, OR OTHER PROPRIETARY RIGHT) EMBODIED IN | ||
44 | ANY OTHER QLOGIC HARDWARE OR SOFTWARE EITHER SOLELY OR IN | ||
45 | COMBINATION WITH THIS PROGRAM. | ||
46 | |||
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index d46338af6002..3e0c017e7877 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt | |||
@@ -294,15 +294,15 @@ tcp_rmem - vector of 3 INTEGERs: min, default, max | |||
294 | Default: 87380*2 bytes. | 294 | Default: 87380*2 bytes. |
295 | 295 | ||
296 | tcp_mem - vector of 3 INTEGERs: min, pressure, max | 296 | tcp_mem - vector of 3 INTEGERs: min, pressure, max |
297 | low: below this number of pages TCP is not bothered about its | 297 | min: below this number of pages TCP is not bothered about its |
298 | memory appetite. | 298 | memory appetite. |
299 | 299 | ||
300 | pressure: when amount of memory allocated by TCP exceeds this number | 300 | pressure: when amount of memory allocated by TCP exceeds this number |
301 | of pages, TCP moderates its memory consumption and enters memory | 301 | of pages, TCP moderates its memory consumption and enters memory |
302 | pressure mode, which is exited when memory consumption falls | 302 | pressure mode, which is exited when memory consumption falls |
303 | under "low". | 303 | under "min". |
304 | 304 | ||
305 | high: number of pages allowed for queueing by all TCP sockets. | 305 | max: number of pages allowed for queueing by all TCP sockets. |
306 | 306 | ||
307 | Defaults are calculated at boot time from amount of available | 307 | Defaults are calculated at boot time from amount of available |
308 | memory. | 308 | memory. |
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt index 3c62e66e1fcc..8c48b8a27b9c 100644 --- a/Documentation/powerpc/booting-without-of.txt +++ b/Documentation/powerpc/booting-without-of.txt | |||
@@ -1196,7 +1196,7 @@ platforms are moved over to use the flattened-device-tree model. | |||
1196 | - model : Model of the device. Can be "TSEC", "eTSEC", or "FEC" | 1196 | - model : Model of the device. Can be "TSEC", "eTSEC", or "FEC" |
1197 | - compatible : Should be "gianfar" | 1197 | - compatible : Should be "gianfar" |
1198 | - reg : Offset and length of the register set for the device | 1198 | - reg : Offset and length of the register set for the device |
1199 | - address : List of bytes representing the ethernet address of | 1199 | - mac-address : List of bytes representing the ethernet address of |
1200 | this controller | 1200 | this controller |
1201 | - interrupts : <a b> where a is the interrupt number and b is a | 1201 | - interrupts : <a b> where a is the interrupt number and b is a |
1202 | field that represents an encoding of the sense and level | 1202 | field that represents an encoding of the sense and level |
@@ -1216,7 +1216,7 @@ platforms are moved over to use the flattened-device-tree model. | |||
1216 | model = "TSEC"; | 1216 | model = "TSEC"; |
1217 | compatible = "gianfar"; | 1217 | compatible = "gianfar"; |
1218 | reg = <24000 1000>; | 1218 | reg = <24000 1000>; |
1219 | address = [ 00 E0 0C 00 73 00 ]; | 1219 | mac-address = [ 00 E0 0C 00 73 00 ]; |
1220 | interrupts = <d 3 e 3 12 3>; | 1220 | interrupts = <d 3 e 3 12 3>; |
1221 | interrupt-parent = <40000>; | 1221 | interrupt-parent = <40000>; |
1222 | phy-handle = <2452000> | 1222 | phy-handle = <2452000> |
@@ -1498,7 +1498,7 @@ not necessary as they are usually the same as the root node. | |||
1498 | model = "TSEC"; | 1498 | model = "TSEC"; |
1499 | compatible = "gianfar"; | 1499 | compatible = "gianfar"; |
1500 | reg = <24000 1000>; | 1500 | reg = <24000 1000>; |
1501 | address = [ 00 E0 0C 00 73 00 ]; | 1501 | mac-address = [ 00 E0 0C 00 73 00 ]; |
1502 | interrupts = <d 3 e 3 12 3>; | 1502 | interrupts = <d 3 e 3 12 3>; |
1503 | interrupt-parent = <40000>; | 1503 | interrupt-parent = <40000>; |
1504 | phy-handle = <2452000>; | 1504 | phy-handle = <2452000>; |
@@ -1511,7 +1511,7 @@ not necessary as they are usually the same as the root node. | |||
1511 | model = "TSEC"; | 1511 | model = "TSEC"; |
1512 | compatible = "gianfar"; | 1512 | compatible = "gianfar"; |
1513 | reg = <25000 1000>; | 1513 | reg = <25000 1000>; |
1514 | address = [ 00 E0 0C 00 73 01 ]; | 1514 | mac-address = [ 00 E0 0C 00 73 01 ]; |
1515 | interrupts = <13 3 14 3 18 3>; | 1515 | interrupts = <13 3 14 3 18 3>; |
1516 | interrupt-parent = <40000>; | 1516 | interrupt-parent = <40000>; |
1517 | phy-handle = <2452001>; | 1517 | phy-handle = <2452001>; |
@@ -1524,7 +1524,7 @@ not necessary as they are usually the same as the root node. | |||
1524 | model = "FEC"; | 1524 | model = "FEC"; |
1525 | compatible = "gianfar"; | 1525 | compatible = "gianfar"; |
1526 | reg = <26000 1000>; | 1526 | reg = <26000 1000>; |
1527 | address = [ 00 E0 0C 00 73 02 ]; | 1527 | mac-address = [ 00 E0 0C 00 73 02 ]; |
1528 | interrupts = <19 3>; | 1528 | interrupts = <19 3>; |
1529 | interrupt-parent = <40000>; | 1529 | interrupt-parent = <40000>; |
1530 | phy-handle = <2452002>; | 1530 | phy-handle = <2452002>; |
diff --git a/MAINTAINERS b/MAINTAINERS index e3e1515ba5a9..d3315a552be1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2360,6 +2360,12 @@ M: linux-driver@qlogic.com | |||
2360 | L: linux-scsi@vger.kernel.org | 2360 | L: linux-scsi@vger.kernel.org |
2361 | S: Supported | 2361 | S: Supported |
2362 | 2362 | ||
2363 | QLOGIC QLA3XXX NETWORK DRIVER | ||
2364 | P: Ron Mercer | ||
2365 | M: linux-driver@qlogic.com | ||
2366 | L: netdev@vger.kernel.org | ||
2367 | S: Supported | ||
2368 | |||
2363 | QNX4 FILESYSTEM | 2369 | QNX4 FILESYSTEM |
2364 | P: Anders Larsen | 2370 | P: Anders Larsen |
2365 | M: al@alarsen.net | 2371 | M: al@alarsen.net |
@@ -2610,6 +2616,18 @@ P: Nicolas Pitre | |||
2610 | M: nico@cam.org | 2616 | M: nico@cam.org |
2611 | S: Maintained | 2617 | S: Maintained |
2612 | 2618 | ||
2619 | SOFTMAC LAYER (IEEE 802.11) | ||
2620 | P: Johannes Berg | ||
2621 | M: johannes@sipsolutions.net | ||
2622 | P: Joe Jezak | ||
2623 | M: josejx@gentoo.org | ||
2624 | P: Daniel Drake | ||
2625 | M: dsd@gentoo.org | ||
2626 | W: http://softmac.sipsolutions.net/ | ||
2627 | L: softmac-dev@sipsolutions.net | ||
2628 | L: netdev@vger.kernel.org | ||
2629 | S: Maintained | ||
2630 | |||
2613 | SOFTWARE RAID (Multiple Disks) SUPPORT | 2631 | SOFTWARE RAID (Multiple Disks) SUPPORT |
2614 | P: Ingo Molnar | 2632 | P: Ingo Molnar |
2615 | M: mingo@redhat.com | 2633 | M: mingo@redhat.com |
@@ -2656,6 +2674,14 @@ M: chrisw@sous-sol.org | |||
2656 | L: stable@kernel.org | 2674 | L: stable@kernel.org |
2657 | S: Maintained | 2675 | S: Maintained |
2658 | 2676 | ||
2677 | STABLE BRANCH: | ||
2678 | P: Greg Kroah-Hartman | ||
2679 | M: greg@kroah.com | ||
2680 | P: Chris Wright | ||
2681 | M: chrisw@sous-sol.org | ||
2682 | L: stable@kernel.org | ||
2683 | S: Maintained | ||
2684 | |||
2659 | TPM DEVICE DRIVER | 2685 | TPM DEVICE DRIVER |
2660 | P: Kylene Hall | 2686 | P: Kylene Hall |
2661 | M: kjhall@us.ibm.com | 2687 | M: kjhall@us.ibm.com |
@@ -3326,6 +3352,15 @@ W: http://www.qsl.net/dl1bke/ | |||
3326 | L: linux-hams@vger.kernel.org | 3352 | L: linux-hams@vger.kernel.org |
3327 | S: Maintained | 3353 | S: Maintained |
3328 | 3354 | ||
3355 | ZD1211RW WIRELESS DRIVER | ||
3356 | P: Daniel Drake | ||
3357 | M: dsd@gentoo.org | ||
3358 | P: Ulrich Kunitz | ||
3359 | M: kune@deine-taler.de | ||
3360 | W: http://zd1211.ath.cx/wiki/DriverRewrite | ||
3361 | L: zd1211-devs@lists.sourceforge.net (subscribers-only) | ||
3362 | S: Maintained | ||
3363 | |||
3329 | ZF MACHZ WATCHDOG | 3364 | ZF MACHZ WATCHDOG |
3330 | P: Fernando Fuganti | 3365 | P: Fernando Fuganti |
3331 | M: fuganti@netbank.com.br | 3366 | M: fuganti@netbank.com.br |
@@ -309,9 +309,6 @@ CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) | |||
309 | 309 | ||
310 | CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ | 310 | CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ |
311 | -fno-strict-aliasing -fno-common | 311 | -fno-strict-aliasing -fno-common |
312 | # Force gcc to behave correct even for buggy distributions | ||
313 | CFLAGS += $(call cc-option, -fno-stack-protector) | ||
314 | |||
315 | AFLAGS := -D__ASSEMBLY__ | 312 | AFLAGS := -D__ASSEMBLY__ |
316 | 313 | ||
317 | # Read KERNELRELEASE from include/config/kernel.release (if it exists) | 314 | # Read KERNELRELEASE from include/config/kernel.release (if it exists) |
@@ -436,12 +433,13 @@ core-y := usr/ | |||
436 | endif # KBUILD_EXTMOD | 433 | endif # KBUILD_EXTMOD |
437 | 434 | ||
438 | ifeq ($(dot-config),1) | 435 | ifeq ($(dot-config),1) |
439 | # In this section, we need .config | 436 | # Read in config |
437 | -include include/config/auto.conf | ||
440 | 438 | ||
439 | ifeq ($(KBUILD_EXTMOD),) | ||
441 | # Read in dependencies to all Kconfig* files, make sure to run | 440 | # Read in dependencies to all Kconfig* files, make sure to run |
442 | # oldconfig if changes are detected. | 441 | # oldconfig if changes are detected. |
443 | -include include/config/auto.conf.cmd | 442 | -include include/config/auto.conf.cmd |
444 | -include include/config/auto.conf | ||
445 | 443 | ||
446 | # To avoid any implicit rule to kick in, define an empty command | 444 | # To avoid any implicit rule to kick in, define an empty command |
447 | $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; | 445 | $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; |
@@ -451,16 +449,27 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; | |||
451 | # if auto.conf.cmd is missing then we are probably in a cleaned tree so | 449 | # if auto.conf.cmd is missing then we are probably in a cleaned tree so |
452 | # we execute the config step to be sure to catch updated Kconfig files | 450 | # we execute the config step to be sure to catch updated Kconfig files |
453 | include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd | 451 | include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd |
454 | ifeq ($(KBUILD_EXTMOD),) | ||
455 | $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig | 452 | $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig |
456 | else | 453 | else |
457 | $(error kernel configuration not valid - run 'make prepare' in $(srctree) to update it) | 454 | # external modules needs include/linux/autoconf.h and include/config/auto.conf |
458 | endif | 455 | # but do not care if they are up-to-date. Use auto.conf to trigger the test |
456 | PHONY += include/config/auto.conf | ||
457 | |||
458 | include/config/auto.conf: | ||
459 | $(Q)test -e include/linux/autoconf.h -a -e $@ || ( \ | ||
460 | echo; \ | ||
461 | echo " ERROR: Kernel configuration is invalid."; \ | ||
462 | echo " include/linux/autoconf.h or $@ are missing."; \ | ||
463 | echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ | ||
464 | echo; \ | ||
465 | /bin/false) | ||
466 | |||
467 | endif # KBUILD_EXTMOD | ||
459 | 468 | ||
460 | else | 469 | else |
461 | # Dummy target needed, because used as prerequisite | 470 | # Dummy target needed, because used as prerequisite |
462 | include/config/auto.conf: ; | 471 | include/config/auto.conf: ; |
463 | endif | 472 | endif # $(dot-config) |
464 | 473 | ||
465 | # The all: target is the default when no target is given on the | 474 | # The all: target is the default when no target is given on the |
466 | # command line. | 475 | # command line. |
@@ -474,6 +483,8 @@ else | |||
474 | CFLAGS += -O2 | 483 | CFLAGS += -O2 |
475 | endif | 484 | endif |
476 | 485 | ||
486 | include $(srctree)/arch/$(ARCH)/Makefile | ||
487 | |||
477 | ifdef CONFIG_FRAME_POINTER | 488 | ifdef CONFIG_FRAME_POINTER |
478 | CFLAGS += -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,) | 489 | CFLAGS += -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,) |
479 | else | 490 | else |
@@ -488,7 +499,8 @@ ifdef CONFIG_DEBUG_INFO | |||
488 | CFLAGS += -g | 499 | CFLAGS += -g |
489 | endif | 500 | endif |
490 | 501 | ||
491 | include $(srctree)/arch/$(ARCH)/Makefile | 502 | # Force gcc to behave correct even for buggy distributions |
503 | CFLAGS += $(call cc-option, -fno-stack-protector) | ||
492 | 504 | ||
493 | # arch Makefile may override CC so keep this after arch Makefile is included | 505 | # arch Makefile may override CC so keep this after arch Makefile is included |
494 | NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) | 506 | NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) |
diff --git a/arch/arm/common/rtctime.c b/arch/arm/common/rtctime.c index 35c9a64ac14c..4e5445cfb0ea 100644 --- a/arch/arm/common/rtctime.c +++ b/arch/arm/common/rtctime.c | |||
@@ -68,6 +68,7 @@ void rtc_next_alarm_time(struct rtc_time *next, struct rtc_time *now, struct rtc | |||
68 | rtc_time_to_tm(next_time, next); | 68 | rtc_time_to_tm(next_time, next); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | EXPORT_SYMBOL(rtc_next_alarm_time); | ||
71 | 72 | ||
72 | static inline int rtc_arm_read_time(struct rtc_ops *ops, struct rtc_time *tm) | 73 | static inline int rtc_arm_read_time(struct rtc_ops *ops, struct rtc_time *tm) |
73 | { | 74 | { |
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 4e29dd03e582..aeeed806f991 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c | |||
@@ -233,7 +233,7 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err) | |||
233 | spin_unlock_irq(&die_lock); | 233 | spin_unlock_irq(&die_lock); |
234 | 234 | ||
235 | if (panic_on_oops) | 235 | if (panic_on_oops) |
236 | panic("Fatal exception: panic_on_oops"); | 236 | panic("Fatal exception"); |
237 | 237 | ||
238 | do_exit(SIGSEGV); | 238 | do_exit(SIGSEGV); |
239 | } | 239 | } |
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c index 2d40fe1145f0..9562177b5fe1 100644 --- a/arch/arm/mach-ixp4xx/common-pci.c +++ b/arch/arm/mach-ixp4xx/common-pci.c | |||
@@ -532,8 +532,6 @@ pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) | |||
532 | return -EIO; | 532 | return -EIO; |
533 | } | 533 | } |
534 | 534 | ||
535 | EXPORT_SYMBOL(pci_set_dma_mask); | ||
536 | EXPORT_SYMBOL(pci_set_consistent_dma_mask); | ||
537 | EXPORT_SYMBOL(ixp4xx_pci_read); | 535 | EXPORT_SYMBOL(ixp4xx_pci_read); |
538 | EXPORT_SYMBOL(ixp4xx_pci_write); | 536 | EXPORT_SYMBOL(ixp4xx_pci_write); |
539 | 537 | ||
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-setup.c b/arch/arm/mach-ixp4xx/gtwx5715-setup.c index 654e2eed81fb..30f1300e0e21 100644 --- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c +++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c | |||
@@ -107,9 +107,9 @@ static struct flash_platform_data gtwx5715_flash_data = { | |||
107 | .width = 2, | 107 | .width = 2, |
108 | }; | 108 | }; |
109 | 109 | ||
110 | static struct gtw5715_flash_resource = { | 110 | static struct resource gtwx5715_flash_resource = { |
111 | .flags = IORESOURCE_MEM, | 111 | .flags = IORESOURCE_MEM, |
112 | } | 112 | }; |
113 | 113 | ||
114 | static struct platform_device gtwx5715_flash = { | 114 | static struct platform_device gtwx5715_flash = { |
115 | .name = "IXP4XX-Flash", | 115 | .name = "IXP4XX-Flash", |
@@ -130,9 +130,6 @@ static void __init gtwx5715_init(void) | |||
130 | { | 130 | { |
131 | ixp4xx_sys_init(); | 131 | ixp4xx_sys_init(); |
132 | 132 | ||
133 | if (!flash_resource) | ||
134 | printk(KERN_ERR "Could not allocate flash resource\n"); | ||
135 | |||
136 | gtwx5715_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); | 133 | gtwx5715_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); |
137 | gtwx5715_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_8M - 1; | 134 | gtwx5715_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_8M - 1; |
138 | 135 | ||
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index 0d4005dc06c5..82e0fd02af1c 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c | |||
@@ -454,7 +454,7 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
454 | panic("Fatal exception in interrupt"); | 454 | panic("Fatal exception in interrupt"); |
455 | 455 | ||
456 | if (panic_on_oops) | 456 | if (panic_on_oops) |
457 | panic("Fatal exception: panic_on_oops"); | 457 | panic("Fatal exception"); |
458 | 458 | ||
459 | oops_exit(); | 459 | oops_exit(); |
460 | do_exit(SIGSEGV); | 460 | do_exit(SIGSEGV); |
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c index 5a0420464c6c..fffa9e0826bc 100644 --- a/arch/ia64/kernel/traps.c +++ b/arch/ia64/kernel/traps.c | |||
@@ -118,7 +118,7 @@ die (const char *str, struct pt_regs *regs, long err) | |||
118 | spin_unlock_irq(&die.lock); | 118 | spin_unlock_irq(&die.lock); |
119 | 119 | ||
120 | if (panic_on_oops) | 120 | if (panic_on_oops) |
121 | panic("Fatal exception: panic_on_oops"); | 121 | panic("Fatal exception"); |
122 | 122 | ||
123 | do_exit(SIGSEGV); | 123 | do_exit(SIGSEGV); |
124 | } | 124 | } |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 13e583f16ede..abb325eb8f75 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -836,9 +836,10 @@ config MCA | |||
836 | bool | 836 | bool |
837 | 837 | ||
838 | config PCI | 838 | config PCI |
839 | bool "PCI support" if 40x || CPM2 || PPC_83xx || PPC_85xx || PPC_MPC52xx || (EMBEDDED && PPC_ISERIES) \ | 839 | bool "PCI support" if 40x || CPM2 || PPC_83xx || PPC_85xx || PPC_86xx \ |
840 | || MPC7448HPC2 | 840 | || PPC_MPC52xx || (EMBEDDED && PPC_ISERIES) || MPC7448HPC2 |
841 | default y if !40x && !CPM2 && !8xx && !APUS && !PPC_83xx && !PPC_85xx && !PPC_86xx | 841 | default y if !40x && !CPM2 && !8xx && !APUS && !PPC_83xx \ |
842 | && !PPC_85xx && !PPC_86xx | ||
842 | default PCI_PERMEDIA if !4xx && !CPM2 && !8xx && APUS | 843 | default PCI_PERMEDIA if !4xx && !CPM2 && !8xx && APUS |
843 | default PCI_QSPAN if !4xx && !CPM2 && 8xx | 844 | default PCI_QSPAN if !4xx && !CPM2 && 8xx |
844 | help | 845 | help |
diff --git a/arch/powerpc/boot/dts/mpc8641_hpcn.dts b/arch/powerpc/boot/dts/mpc8641_hpcn.dts new file mode 100644 index 000000000000..f0c7731743ea --- /dev/null +++ b/arch/powerpc/boot/dts/mpc8641_hpcn.dts | |||
@@ -0,0 +1,339 @@ | |||
1 | /* | ||
2 | * MPC8641 HPCN Device Tree Source | ||
3 | * | ||
4 | * Copyright 2006 Freescale Semiconductor Inc. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | */ | ||
11 | |||
12 | |||
13 | / { | ||
14 | model = "MPC8641HPCN"; | ||
15 | compatible = "mpc86xx"; | ||
16 | #address-cells = <1>; | ||
17 | #size-cells = <1>; | ||
18 | |||
19 | cpus { | ||
20 | #cpus = <2>; | ||
21 | #address-cells = <1>; | ||
22 | #size-cells = <0>; | ||
23 | |||
24 | PowerPC,8641@0 { | ||
25 | device_type = "cpu"; | ||
26 | reg = <0>; | ||
27 | d-cache-line-size = <20>; // 32 bytes | ||
28 | i-cache-line-size = <20>; // 32 bytes | ||
29 | d-cache-size = <8000>; // L1, 32K | ||
30 | i-cache-size = <8000>; // L1, 32K | ||
31 | timebase-frequency = <0>; // 33 MHz, from uboot | ||
32 | bus-frequency = <0>; // From uboot | ||
33 | clock-frequency = <0>; // From uboot | ||
34 | 32-bit; | ||
35 | linux,boot-cpu; | ||
36 | }; | ||
37 | PowerPC,8641@1 { | ||
38 | device_type = "cpu"; | ||
39 | reg = <1>; | ||
40 | d-cache-line-size = <20>; // 32 bytes | ||
41 | i-cache-line-size = <20>; // 32 bytes | ||
42 | d-cache-size = <8000>; // L1, 32K | ||
43 | i-cache-size = <8000>; // L1, 32K | ||
44 | timebase-frequency = <0>; // 33 MHz, from uboot | ||
45 | bus-frequency = <0>; // From uboot | ||
46 | clock-frequency = <0>; // From uboot | ||
47 | 32-bit; | ||
48 | }; | ||
49 | }; | ||
50 | |||
51 | memory { | ||
52 | device_type = "memory"; | ||
53 | reg = <00000000 40000000>; // 1G at 0x0 | ||
54 | }; | ||
55 | |||
56 | soc8641@f8000000 { | ||
57 | #address-cells = <1>; | ||
58 | #size-cells = <1>; | ||
59 | #interrupt-cells = <2>; | ||
60 | device_type = "soc"; | ||
61 | ranges = <0 f8000000 00100000>; | ||
62 | reg = <f8000000 00100000>; // CCSRBAR 1M | ||
63 | bus-frequency = <0>; | ||
64 | |||
65 | i2c@3000 { | ||
66 | device_type = "i2c"; | ||
67 | compatible = "fsl-i2c"; | ||
68 | reg = <3000 100>; | ||
69 | interrupts = <2b 2>; | ||
70 | interrupt-parent = <40000>; | ||
71 | dfsrr; | ||
72 | }; | ||
73 | |||
74 | i2c@3100 { | ||
75 | device_type = "i2c"; | ||
76 | compatible = "fsl-i2c"; | ||
77 | reg = <3100 100>; | ||
78 | interrupts = <2b 2>; | ||
79 | interrupt-parent = <40000>; | ||
80 | dfsrr; | ||
81 | }; | ||
82 | |||
83 | mdio@24520 { | ||
84 | #address-cells = <1>; | ||
85 | #size-cells = <0>; | ||
86 | device_type = "mdio"; | ||
87 | compatible = "gianfar"; | ||
88 | reg = <24520 20>; | ||
89 | linux,phandle = <24520>; | ||
90 | ethernet-phy@0 { | ||
91 | linux,phandle = <2452000>; | ||
92 | interrupt-parent = <40000>; | ||
93 | interrupts = <4a 1>; | ||
94 | reg = <0>; | ||
95 | device_type = "ethernet-phy"; | ||
96 | }; | ||
97 | ethernet-phy@1 { | ||
98 | linux,phandle = <2452001>; | ||
99 | interrupt-parent = <40000>; | ||
100 | interrupts = <4a 1>; | ||
101 | reg = <1>; | ||
102 | device_type = "ethernet-phy"; | ||
103 | }; | ||
104 | ethernet-phy@2 { | ||
105 | linux,phandle = <2452002>; | ||
106 | interrupt-parent = <40000>; | ||
107 | interrupts = <4a 1>; | ||
108 | reg = <2>; | ||
109 | device_type = "ethernet-phy"; | ||
110 | }; | ||
111 | ethernet-phy@3 { | ||
112 | linux,phandle = <2452003>; | ||
113 | interrupt-parent = <40000>; | ||
114 | interrupts = <4a 1>; | ||
115 | reg = <3>; | ||
116 | device_type = "ethernet-phy"; | ||
117 | }; | ||
118 | }; | ||
119 | |||
120 | ethernet@24000 { | ||
121 | #address-cells = <1>; | ||
122 | #size-cells = <0>; | ||
123 | device_type = "network"; | ||
124 | model = "TSEC"; | ||
125 | compatible = "gianfar"; | ||
126 | reg = <24000 1000>; | ||
127 | mac-address = [ 00 E0 0C 00 73 00 ]; | ||
128 | interrupts = <1d 2 1e 2 22 2>; | ||
129 | interrupt-parent = <40000>; | ||
130 | phy-handle = <2452000>; | ||
131 | }; | ||
132 | |||
133 | ethernet@25000 { | ||
134 | #address-cells = <1>; | ||
135 | #size-cells = <0>; | ||
136 | device_type = "network"; | ||
137 | model = "TSEC"; | ||
138 | compatible = "gianfar"; | ||
139 | reg = <25000 1000>; | ||
140 | mac-address = [ 00 E0 0C 00 73 01 ]; | ||
141 | interrupts = <23 2 24 2 28 2>; | ||
142 | interrupt-parent = <40000>; | ||
143 | phy-handle = <2452001>; | ||
144 | }; | ||
145 | |||
146 | ethernet@26000 { | ||
147 | #address-cells = <1>; | ||
148 | #size-cells = <0>; | ||
149 | device_type = "network"; | ||
150 | model = "TSEC"; | ||
151 | compatible = "gianfar"; | ||
152 | reg = <26000 1000>; | ||
153 | mac-address = [ 00 E0 0C 00 02 FD ]; | ||
154 | interrupts = <1F 2 20 2 21 2>; | ||
155 | interrupt-parent = <40000>; | ||
156 | phy-handle = <2452002>; | ||
157 | }; | ||
158 | |||
159 | ethernet@27000 { | ||
160 | #address-cells = <1>; | ||
161 | #size-cells = <0>; | ||
162 | device_type = "network"; | ||
163 | model = "TSEC"; | ||
164 | compatible = "gianfar"; | ||
165 | reg = <27000 1000>; | ||
166 | mac-address = [ 00 E0 0C 00 03 FD ]; | ||
167 | interrupts = <25 2 26 2 27 2>; | ||
168 | interrupt-parent = <40000>; | ||
169 | phy-handle = <2452003>; | ||
170 | }; | ||
171 | serial@4500 { | ||
172 | device_type = "serial"; | ||
173 | compatible = "ns16550"; | ||
174 | reg = <4500 100>; | ||
175 | clock-frequency = <0>; | ||
176 | interrupts = <2a 2>; | ||
177 | interrupt-parent = <40000>; | ||
178 | }; | ||
179 | |||
180 | serial@4600 { | ||
181 | device_type = "serial"; | ||
182 | compatible = "ns16550"; | ||
183 | reg = <4600 100>; | ||
184 | clock-frequency = <0>; | ||
185 | interrupts = <1c 2>; | ||
186 | interrupt-parent = <40000>; | ||
187 | }; | ||
188 | |||
189 | pci@8000 { | ||
190 | compatible = "86xx"; | ||
191 | device_type = "pci"; | ||
192 | #interrupt-cells = <1>; | ||
193 | #size-cells = <2>; | ||
194 | #address-cells = <3>; | ||
195 | reg = <8000 1000>; | ||
196 | bus-range = <0 fe>; | ||
197 | ranges = <02000000 0 80000000 80000000 0 20000000 | ||
198 | 01000000 0 00000000 e2000000 0 00100000>; | ||
199 | clock-frequency = <1fca055>; | ||
200 | interrupt-parent = <40000>; | ||
201 | interrupts = <18 2>; | ||
202 | interrupt-map-mask = <f800 0 0 7>; | ||
203 | interrupt-map = < | ||
204 | /* IDSEL 0x11 */ | ||
205 | 8800 0 0 1 4d0 3 2 | ||
206 | 8800 0 0 2 4d0 4 2 | ||
207 | 8800 0 0 3 4d0 5 2 | ||
208 | 8800 0 0 4 4d0 6 2 | ||
209 | |||
210 | /* IDSEL 0x12 */ | ||
211 | 9000 0 0 1 4d0 4 2 | ||
212 | 9000 0 0 2 4d0 5 2 | ||
213 | 9000 0 0 3 4d0 6 2 | ||
214 | 9000 0 0 4 4d0 3 2 | ||
215 | |||
216 | /* IDSEL 0x13 */ | ||
217 | 9800 0 0 1 4d0 0 0 | ||
218 | 9800 0 0 2 4d0 0 0 | ||
219 | 9800 0 0 3 4d0 0 0 | ||
220 | 9800 0 0 4 4d0 0 0 | ||
221 | |||
222 | /* IDSEL 0x14 */ | ||
223 | a000 0 0 1 4d0 0 0 | ||
224 | a000 0 0 2 4d0 0 0 | ||
225 | a000 0 0 3 4d0 0 0 | ||
226 | a000 0 0 4 4d0 0 0 | ||
227 | |||
228 | /* IDSEL 0x15 */ | ||
229 | a800 0 0 1 4d0 0 0 | ||
230 | a800 0 0 2 4d0 0 0 | ||
231 | a800 0 0 3 4d0 0 0 | ||
232 | a800 0 0 4 4d0 0 0 | ||
233 | |||
234 | /* IDSEL 0x16 */ | ||
235 | b000 0 0 1 4d0 0 0 | ||
236 | b000 0 0 2 4d0 0 0 | ||
237 | b000 0 0 3 4d0 0 0 | ||
238 | b000 0 0 4 4d0 0 0 | ||
239 | |||
240 | /* IDSEL 0x17 */ | ||
241 | b800 0 0 1 4d0 0 0 | ||
242 | b800 0 0 2 4d0 0 0 | ||
243 | b800 0 0 3 4d0 0 0 | ||
244 | b800 0 0 4 4d0 0 0 | ||
245 | |||
246 | /* IDSEL 0x18 */ | ||
247 | c000 0 0 1 4d0 0 0 | ||
248 | c000 0 0 2 4d0 0 0 | ||
249 | c000 0 0 3 4d0 0 0 | ||
250 | c000 0 0 4 4d0 0 0 | ||
251 | |||
252 | /* IDSEL 0x19 */ | ||
253 | c800 0 0 1 4d0 0 0 | ||
254 | c800 0 0 2 4d0 0 0 | ||
255 | c800 0 0 3 4d0 0 0 | ||
256 | c800 0 0 4 4d0 0 0 | ||
257 | |||
258 | /* IDSEL 0x1a */ | ||
259 | d000 0 0 1 4d0 6 2 | ||
260 | d000 0 0 2 4d0 3 2 | ||
261 | d000 0 0 3 4d0 4 2 | ||
262 | d000 0 0 4 4d0 5 2 | ||
263 | |||
264 | |||
265 | /* IDSEL 0x1b */ | ||
266 | d800 0 0 1 4d0 5 2 | ||
267 | d800 0 0 2 4d0 0 0 | ||
268 | d800 0 0 3 4d0 0 0 | ||
269 | d800 0 0 4 4d0 0 0 | ||
270 | |||
271 | /* IDSEL 0x1c */ | ||
272 | e000 0 0 1 4d0 9 2 | ||
273 | e000 0 0 2 4d0 a 2 | ||
274 | e000 0 0 3 4d0 c 2 | ||
275 | e000 0 0 4 4d0 7 2 | ||
276 | |||
277 | /* IDSEL 0x1d */ | ||
278 | e800 0 0 1 4d0 9 2 | ||
279 | e800 0 0 2 4d0 a 2 | ||
280 | e800 0 0 3 4d0 b 2 | ||
281 | e800 0 0 4 4d0 0 0 | ||
282 | |||
283 | /* IDSEL 0x1e */ | ||
284 | f000 0 0 1 4d0 c 2 | ||
285 | f000 0 0 2 4d0 0 0 | ||
286 | f000 0 0 3 4d0 0 0 | ||
287 | f000 0 0 4 4d0 0 0 | ||
288 | |||
289 | /* IDSEL 0x1f */ | ||
290 | f800 0 0 1 4d0 6 2 | ||
291 | f800 0 0 2 4d0 0 0 | ||
292 | f800 0 0 3 4d0 0 0 | ||
293 | f800 0 0 4 4d0 0 0 | ||
294 | >; | ||
295 | i8259@4d0 { | ||
296 | linux,phandle = <4d0>; | ||
297 | clock-frequency = <0>; | ||
298 | interrupt-controller; | ||
299 | device_type = "interrupt-controller"; | ||
300 | #address-cells = <0>; | ||
301 | #interrupt-cells = <2>; | ||
302 | built-in; | ||
303 | compatible = "chrp,iic"; | ||
304 | big-endian; | ||
305 | interrupts = <49 2>; | ||
306 | interrupt-parent = <40000>; | ||
307 | }; | ||
308 | |||
309 | }; | ||
310 | pic@40000 { | ||
311 | linux,phandle = <40000>; | ||
312 | clock-frequency = <0>; | ||
313 | interrupt-controller; | ||
314 | #address-cells = <0>; | ||
315 | #interrupt-cells = <2>; | ||
316 | reg = <40000 40000>; | ||
317 | built-in; | ||
318 | compatible = "chrp,open-pic"; | ||
319 | device_type = "open-pic"; | ||
320 | big-endian; | ||
321 | interrupts = < | ||
322 | 10 2 11 2 12 2 13 2 | ||
323 | 14 2 15 2 16 2 17 2 | ||
324 | 18 2 19 2 1a 2 1b 2 | ||
325 | 1c 2 1d 2 1e 2 1f 2 | ||
326 | 20 2 21 2 22 2 23 2 | ||
327 | 24 2 25 2 26 2 27 2 | ||
328 | 28 2 29 2 2a 2 2b 2 | ||
329 | 2c 2 2d 2 2e 2 2f 2 | ||
330 | 30 2 31 2 32 2 33 2 | ||
331 | 34 2 35 2 36 2 37 2 | ||
332 | 38 2 39 2 2a 2 3b 2 | ||
333 | 3c 2 3d 2 3e 2 3f 2 | ||
334 | 48 1 49 2 4a 1 | ||
335 | >; | ||
336 | interrupt-parent = <40000>; | ||
337 | }; | ||
338 | }; | ||
339 | }; | ||
diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig index a45627547d03..8c6bd17c6929 100644 --- a/arch/powerpc/configs/g5_defconfig +++ b/arch/powerpc/configs/g5_defconfig | |||
@@ -1,16 +1,18 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.17-rc1 | 3 | # Linux kernel version: 2.6.18-rc3 |
4 | # Wed Apr 19 13:24:37 2006 | 4 | # Tue Aug 8 09:12:29 2006 |
5 | # | 5 | # |
6 | CONFIG_PPC64=y | 6 | CONFIG_PPC64=y |
7 | CONFIG_64BIT=y | 7 | CONFIG_64BIT=y |
8 | CONFIG_PPC_MERGE=y | 8 | CONFIG_PPC_MERGE=y |
9 | CONFIG_MMU=y | 9 | CONFIG_MMU=y |
10 | CONFIG_GENERIC_HARDIRQS=y | 10 | CONFIG_GENERIC_HARDIRQS=y |
11 | CONFIG_IRQ_PER_CPU=y | ||
11 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y | 12 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y |
12 | CONFIG_GENERIC_HWEIGHT=y | 13 | CONFIG_GENERIC_HWEIGHT=y |
13 | CONFIG_GENERIC_CALIBRATE_DELAY=y | 14 | CONFIG_GENERIC_CALIBRATE_DELAY=y |
15 | CONFIG_GENERIC_FIND_NEXT_BIT=y | ||
14 | CONFIG_PPC=y | 16 | CONFIG_PPC=y |
15 | CONFIG_EARLY_PRINTK=y | 17 | CONFIG_EARLY_PRINTK=y |
16 | CONFIG_COMPAT=y | 18 | CONFIG_COMPAT=y |
@@ -33,6 +35,7 @@ CONFIG_PPC_STD_MMU=y | |||
33 | CONFIG_VIRT_CPU_ACCOUNTING=y | 35 | CONFIG_VIRT_CPU_ACCOUNTING=y |
34 | CONFIG_SMP=y | 36 | CONFIG_SMP=y |
35 | CONFIG_NR_CPUS=4 | 37 | CONFIG_NR_CPUS=4 |
38 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | ||
36 | 39 | ||
37 | # | 40 | # |
38 | # Code maturity level options | 41 | # Code maturity level options |
@@ -50,6 +53,7 @@ CONFIG_SWAP=y | |||
50 | CONFIG_SYSVIPC=y | 53 | CONFIG_SYSVIPC=y |
51 | CONFIG_POSIX_MQUEUE=y | 54 | CONFIG_POSIX_MQUEUE=y |
52 | # CONFIG_BSD_PROCESS_ACCT is not set | 55 | # CONFIG_BSD_PROCESS_ACCT is not set |
56 | # CONFIG_TASKSTATS is not set | ||
53 | CONFIG_SYSCTL=y | 57 | CONFIG_SYSCTL=y |
54 | # CONFIG_AUDIT is not set | 58 | # CONFIG_AUDIT is not set |
55 | CONFIG_IKCONFIG=y | 59 | CONFIG_IKCONFIG=y |
@@ -67,10 +71,12 @@ CONFIG_PRINTK=y | |||
67 | CONFIG_BUG=y | 71 | CONFIG_BUG=y |
68 | CONFIG_ELF_CORE=y | 72 | CONFIG_ELF_CORE=y |
69 | CONFIG_BASE_FULL=y | 73 | CONFIG_BASE_FULL=y |
74 | CONFIG_RT_MUTEXES=y | ||
70 | CONFIG_FUTEX=y | 75 | CONFIG_FUTEX=y |
71 | CONFIG_EPOLL=y | 76 | CONFIG_EPOLL=y |
72 | CONFIG_SHMEM=y | 77 | CONFIG_SHMEM=y |
73 | CONFIG_SLAB=y | 78 | CONFIG_SLAB=y |
79 | CONFIG_VM_EVENT_COUNTERS=y | ||
74 | # CONFIG_TINY_SHMEM is not set | 80 | # CONFIG_TINY_SHMEM is not set |
75 | CONFIG_BASE_SMALL=0 | 81 | CONFIG_BASE_SMALL=0 |
76 | # CONFIG_SLOB is not set | 82 | # CONFIG_SLOB is not set |
@@ -116,12 +122,16 @@ CONFIG_PPC_PMAC=y | |||
116 | CONFIG_PPC_PMAC64=y | 122 | CONFIG_PPC_PMAC64=y |
117 | # CONFIG_PPC_MAPLE is not set | 123 | # CONFIG_PPC_MAPLE is not set |
118 | # CONFIG_PPC_CELL is not set | 124 | # CONFIG_PPC_CELL is not set |
125 | # CONFIG_PPC_CELL_NATIVE is not set | ||
126 | # CONFIG_PPC_IBM_CELL_BLADE is not set | ||
127 | # CONFIG_UDBG_RTAS_CONSOLE is not set | ||
119 | CONFIG_U3_DART=y | 128 | CONFIG_U3_DART=y |
120 | CONFIG_MPIC=y | 129 | CONFIG_MPIC=y |
121 | # CONFIG_PPC_RTAS is not set | 130 | # CONFIG_PPC_RTAS is not set |
122 | # CONFIG_MMIO_NVRAM is not set | 131 | # CONFIG_MMIO_NVRAM is not set |
123 | CONFIG_MPIC_BROKEN_U3=y | 132 | CONFIG_MPIC_BROKEN_U3=y |
124 | # CONFIG_PPC_MPC106 is not set | 133 | # CONFIG_PPC_MPC106 is not set |
134 | CONFIG_PPC_970_NAP=y | ||
125 | CONFIG_CPU_FREQ=y | 135 | CONFIG_CPU_FREQ=y |
126 | CONFIG_CPU_FREQ_TABLE=y | 136 | CONFIG_CPU_FREQ_TABLE=y |
127 | # CONFIG_CPU_FREQ_DEBUG is not set | 137 | # CONFIG_CPU_FREQ_DEBUG is not set |
@@ -153,6 +163,7 @@ CONFIG_BINFMT_ELF=y | |||
153 | CONFIG_FORCE_MAX_ZONEORDER=13 | 163 | CONFIG_FORCE_MAX_ZONEORDER=13 |
154 | CONFIG_IOMMU_VMERGE=y | 164 | CONFIG_IOMMU_VMERGE=y |
155 | # CONFIG_HOTPLUG_CPU is not set | 165 | # CONFIG_HOTPLUG_CPU is not set |
166 | CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y | ||
156 | CONFIG_KEXEC=y | 167 | CONFIG_KEXEC=y |
157 | # CONFIG_CRASH_DUMP is not set | 168 | # CONFIG_CRASH_DUMP is not set |
158 | CONFIG_IRQ_ALL_CPUS=y | 169 | CONFIG_IRQ_ALL_CPUS=y |
@@ -168,6 +179,7 @@ CONFIG_FLATMEM=y | |||
168 | CONFIG_FLAT_NODE_MEM_MAP=y | 179 | CONFIG_FLAT_NODE_MEM_MAP=y |
169 | # CONFIG_SPARSEMEM_STATIC is not set | 180 | # CONFIG_SPARSEMEM_STATIC is not set |
170 | CONFIG_SPLIT_PTLOCK_CPUS=4 | 181 | CONFIG_SPLIT_PTLOCK_CPUS=4 |
182 | CONFIG_RESOURCES_64BIT=y | ||
171 | # CONFIG_PPC_64K_PAGES is not set | 183 | # CONFIG_PPC_64K_PAGES is not set |
172 | # CONFIG_SCHED_SMT is not set | 184 | # CONFIG_SCHED_SMT is not set |
173 | CONFIG_PROC_DEVICETREE=y | 185 | CONFIG_PROC_DEVICETREE=y |
@@ -184,6 +196,7 @@ CONFIG_GENERIC_ISA_DMA=y | |||
184 | # CONFIG_PPC_INDIRECT_PCI is not set | 196 | # CONFIG_PPC_INDIRECT_PCI is not set |
185 | CONFIG_PCI=y | 197 | CONFIG_PCI=y |
186 | CONFIG_PCI_DOMAINS=y | 198 | CONFIG_PCI_DOMAINS=y |
199 | # CONFIG_PCIEPORTBUS is not set | ||
187 | # CONFIG_PCI_DEBUG is not set | 200 | # CONFIG_PCI_DEBUG is not set |
188 | 201 | ||
189 | # | 202 | # |
@@ -227,6 +240,8 @@ CONFIG_INET_ESP=m | |||
227 | CONFIG_INET_IPCOMP=m | 240 | CONFIG_INET_IPCOMP=m |
228 | CONFIG_INET_XFRM_TUNNEL=m | 241 | CONFIG_INET_XFRM_TUNNEL=m |
229 | CONFIG_INET_TUNNEL=y | 242 | CONFIG_INET_TUNNEL=y |
243 | CONFIG_INET_XFRM_MODE_TRANSPORT=y | ||
244 | CONFIG_INET_XFRM_MODE_TUNNEL=y | ||
230 | CONFIG_INET_DIAG=y | 245 | CONFIG_INET_DIAG=y |
231 | CONFIG_INET_TCP_DIAG=y | 246 | CONFIG_INET_TCP_DIAG=y |
232 | # CONFIG_TCP_CONG_ADVANCED is not set | 247 | # CONFIG_TCP_CONG_ADVANCED is not set |
@@ -239,6 +254,7 @@ CONFIG_TCP_CONG_BIC=y | |||
239 | # CONFIG_IPV6 is not set | 254 | # CONFIG_IPV6 is not set |
240 | # CONFIG_INET6_XFRM_TUNNEL is not set | 255 | # CONFIG_INET6_XFRM_TUNNEL is not set |
241 | # CONFIG_INET6_TUNNEL is not set | 256 | # CONFIG_INET6_TUNNEL is not set |
257 | # CONFIG_NETWORK_SECMARK is not set | ||
242 | CONFIG_NETFILTER=y | 258 | CONFIG_NETFILTER=y |
243 | # CONFIG_NETFILTER_DEBUG is not set | 259 | # CONFIG_NETFILTER_DEBUG is not set |
244 | 260 | ||
@@ -263,6 +279,7 @@ CONFIG_IP_NF_TFTP=m | |||
263 | CONFIG_IP_NF_AMANDA=m | 279 | CONFIG_IP_NF_AMANDA=m |
264 | # CONFIG_IP_NF_PPTP is not set | 280 | # CONFIG_IP_NF_PPTP is not set |
265 | # CONFIG_IP_NF_H323 is not set | 281 | # CONFIG_IP_NF_H323 is not set |
282 | # CONFIG_IP_NF_SIP is not set | ||
266 | CONFIG_IP_NF_QUEUE=m | 283 | CONFIG_IP_NF_QUEUE=m |
267 | 284 | ||
268 | # | 285 | # |
@@ -318,6 +335,7 @@ CONFIG_STANDALONE=y | |||
318 | CONFIG_PREVENT_FIRMWARE_BUILD=y | 335 | CONFIG_PREVENT_FIRMWARE_BUILD=y |
319 | CONFIG_FW_LOADER=y | 336 | CONFIG_FW_LOADER=y |
320 | # CONFIG_DEBUG_DRIVER is not set | 337 | # CONFIG_DEBUG_DRIVER is not set |
338 | # CONFIG_SYS_HYPERVISOR is not set | ||
321 | 339 | ||
322 | # | 340 | # |
323 | # Connector - unified userspace <-> kernelspace linker | 341 | # Connector - unified userspace <-> kernelspace linker |
@@ -355,6 +373,7 @@ CONFIG_BLK_DEV_NBD=m | |||
355 | CONFIG_BLK_DEV_RAM=y | 373 | CONFIG_BLK_DEV_RAM=y |
356 | CONFIG_BLK_DEV_RAM_COUNT=16 | 374 | CONFIG_BLK_DEV_RAM_COUNT=16 |
357 | CONFIG_BLK_DEV_RAM_SIZE=65536 | 375 | CONFIG_BLK_DEV_RAM_SIZE=65536 |
376 | CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 | ||
358 | CONFIG_BLK_DEV_INITRD=y | 377 | CONFIG_BLK_DEV_INITRD=y |
359 | CONFIG_CDROM_PKTCDVD=m | 378 | CONFIG_CDROM_PKTCDVD=m |
360 | CONFIG_CDROM_PKTCDVD_BUFFERS=8 | 379 | CONFIG_CDROM_PKTCDVD_BUFFERS=8 |
@@ -417,7 +436,6 @@ CONFIG_IDEDMA_PCI_AUTO=y | |||
417 | CONFIG_BLK_DEV_IDE_PMAC=y | 436 | CONFIG_BLK_DEV_IDE_PMAC=y |
418 | CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y | 437 | CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y |
419 | CONFIG_BLK_DEV_IDEDMA_PMAC=y | 438 | CONFIG_BLK_DEV_IDEDMA_PMAC=y |
420 | # CONFIG_BLK_DEV_IDE_PMAC_BLINK is not set | ||
421 | # CONFIG_IDE_ARM is not set | 439 | # CONFIG_IDE_ARM is not set |
422 | CONFIG_BLK_DEV_IDEDMA=y | 440 | CONFIG_BLK_DEV_IDEDMA=y |
423 | # CONFIG_IDEDMA_IVB is not set | 441 | # CONFIG_IDEDMA_IVB is not set |
@@ -478,6 +496,7 @@ CONFIG_SCSI_SATA_SVW=y | |||
478 | # CONFIG_SCSI_SATA_MV is not set | 496 | # CONFIG_SCSI_SATA_MV is not set |
479 | # CONFIG_SCSI_SATA_NV is not set | 497 | # CONFIG_SCSI_SATA_NV is not set |
480 | # CONFIG_SCSI_PDC_ADMA is not set | 498 | # CONFIG_SCSI_PDC_ADMA is not set |
499 | # CONFIG_SCSI_HPTIOP is not set | ||
481 | # CONFIG_SCSI_SATA_QSTOR is not set | 500 | # CONFIG_SCSI_SATA_QSTOR is not set |
482 | # CONFIG_SCSI_SATA_PROMISE is not set | 501 | # CONFIG_SCSI_SATA_PROMISE is not set |
483 | # CONFIG_SCSI_SATA_SX4 is not set | 502 | # CONFIG_SCSI_SATA_SX4 is not set |
@@ -497,7 +516,6 @@ CONFIG_SCSI_SATA_SVW=y | |||
497 | # CONFIG_SCSI_INIA100 is not set | 516 | # CONFIG_SCSI_INIA100 is not set |
498 | # CONFIG_SCSI_SYM53C8XX_2 is not set | 517 | # CONFIG_SCSI_SYM53C8XX_2 is not set |
499 | # CONFIG_SCSI_IPR is not set | 518 | # CONFIG_SCSI_IPR is not set |
500 | # CONFIG_SCSI_QLOGIC_FC is not set | ||
501 | # CONFIG_SCSI_QLOGIC_1280 is not set | 519 | # CONFIG_SCSI_QLOGIC_1280 is not set |
502 | # CONFIG_SCSI_QLA_FC is not set | 520 | # CONFIG_SCSI_QLA_FC is not set |
503 | # CONFIG_SCSI_LPFC is not set | 521 | # CONFIG_SCSI_LPFC is not set |
@@ -514,9 +532,7 @@ CONFIG_MD_LINEAR=y | |||
514 | CONFIG_MD_RAID0=y | 532 | CONFIG_MD_RAID0=y |
515 | CONFIG_MD_RAID1=y | 533 | CONFIG_MD_RAID1=y |
516 | CONFIG_MD_RAID10=m | 534 | CONFIG_MD_RAID10=m |
517 | CONFIG_MD_RAID5=y | 535 | # CONFIG_MD_RAID456 is not set |
518 | # CONFIG_MD_RAID5_RESHAPE is not set | ||
519 | CONFIG_MD_RAID6=m | ||
520 | CONFIG_MD_MULTIPATH=m | 536 | CONFIG_MD_MULTIPATH=m |
521 | CONFIG_MD_FAULTY=m | 537 | CONFIG_MD_FAULTY=m |
522 | CONFIG_BLK_DEV_DM=y | 538 | CONFIG_BLK_DEV_DM=y |
@@ -559,7 +575,6 @@ CONFIG_IEEE1394_OHCI1394=y | |||
559 | # | 575 | # |
560 | CONFIG_IEEE1394_VIDEO1394=m | 576 | CONFIG_IEEE1394_VIDEO1394=m |
561 | CONFIG_IEEE1394_SBP2=m | 577 | CONFIG_IEEE1394_SBP2=m |
562 | # CONFIG_IEEE1394_SBP2_PHYS_DMA is not set | ||
563 | CONFIG_IEEE1394_ETH1394=m | 578 | CONFIG_IEEE1394_ETH1394=m |
564 | CONFIG_IEEE1394_DV1394=m | 579 | CONFIG_IEEE1394_DV1394=m |
565 | CONFIG_IEEE1394_RAWIO=y | 580 | CONFIG_IEEE1394_RAWIO=y |
@@ -573,6 +588,7 @@ CONFIG_IEEE1394_RAWIO=y | |||
573 | # Macintosh device drivers | 588 | # Macintosh device drivers |
574 | # | 589 | # |
575 | CONFIG_ADB_PMU=y | 590 | CONFIG_ADB_PMU=y |
591 | # CONFIG_ADB_PMU_LED is not set | ||
576 | CONFIG_PMAC_SMU=y | 592 | CONFIG_PMAC_SMU=y |
577 | CONFIG_THERM_PM72=y | 593 | CONFIG_THERM_PM72=y |
578 | CONFIG_WINDFARM=y | 594 | CONFIG_WINDFARM=y |
@@ -643,6 +659,7 @@ CONFIG_TIGON3=y | |||
643 | # CONFIG_CHELSIO_T1 is not set | 659 | # CONFIG_CHELSIO_T1 is not set |
644 | # CONFIG_IXGB is not set | 660 | # CONFIG_IXGB is not set |
645 | # CONFIG_S2IO is not set | 661 | # CONFIG_S2IO is not set |
662 | # CONFIG_MYRI10GE is not set | ||
646 | 663 | ||
647 | # | 664 | # |
648 | # Token Ring devices | 665 | # Token Ring devices |
@@ -739,6 +756,7 @@ CONFIG_SERIO=y | |||
739 | CONFIG_VT=y | 756 | CONFIG_VT=y |
740 | CONFIG_VT_CONSOLE=y | 757 | CONFIG_VT_CONSOLE=y |
741 | CONFIG_HW_CONSOLE=y | 758 | CONFIG_HW_CONSOLE=y |
759 | # CONFIG_VT_HW_CONSOLE_BINDING is not set | ||
742 | # CONFIG_SERIAL_NONSTANDARD is not set | 760 | # CONFIG_SERIAL_NONSTANDARD is not set |
743 | 761 | ||
744 | # | 762 | # |
@@ -754,6 +772,7 @@ CONFIG_HW_CONSOLE=y | |||
754 | CONFIG_UNIX98_PTYS=y | 772 | CONFIG_UNIX98_PTYS=y |
755 | CONFIG_LEGACY_PTYS=y | 773 | CONFIG_LEGACY_PTYS=y |
756 | CONFIG_LEGACY_PTY_COUNT=256 | 774 | CONFIG_LEGACY_PTY_COUNT=256 |
775 | # CONFIG_BRIQ_PANEL is not set | ||
757 | 776 | ||
758 | # | 777 | # |
759 | # IPMI | 778 | # IPMI |
@@ -764,6 +783,7 @@ CONFIG_LEGACY_PTY_COUNT=256 | |||
764 | # Watchdog Cards | 783 | # Watchdog Cards |
765 | # | 784 | # |
766 | # CONFIG_WATCHDOG is not set | 785 | # CONFIG_WATCHDOG is not set |
786 | # CONFIG_HW_RANDOM is not set | ||
767 | CONFIG_GEN_RTC=y | 787 | CONFIG_GEN_RTC=y |
768 | # CONFIG_GEN_RTC_X is not set | 788 | # CONFIG_GEN_RTC_X is not set |
769 | # CONFIG_DTLK is not set | 789 | # CONFIG_DTLK is not set |
@@ -774,6 +794,7 @@ CONFIG_GEN_RTC=y | |||
774 | # Ftape, the floppy tape device driver | 794 | # Ftape, the floppy tape device driver |
775 | # | 795 | # |
776 | CONFIG_AGP=m | 796 | CONFIG_AGP=m |
797 | # CONFIG_AGP_SIS is not set | ||
777 | # CONFIG_AGP_VIA is not set | 798 | # CONFIG_AGP_VIA is not set |
778 | CONFIG_AGP_UNINORTH=m | 799 | CONFIG_AGP_UNINORTH=m |
779 | # CONFIG_DRM is not set | 800 | # CONFIG_DRM is not set |
@@ -813,6 +834,7 @@ CONFIG_I2C_ALGOBIT=y | |||
813 | # CONFIG_I2C_PIIX4 is not set | 834 | # CONFIG_I2C_PIIX4 is not set |
814 | CONFIG_I2C_POWERMAC=y | 835 | CONFIG_I2C_POWERMAC=y |
815 | # CONFIG_I2C_NFORCE2 is not set | 836 | # CONFIG_I2C_NFORCE2 is not set |
837 | # CONFIG_I2C_OCORES is not set | ||
816 | # CONFIG_I2C_PARPORT_LIGHT is not set | 838 | # CONFIG_I2C_PARPORT_LIGHT is not set |
817 | # CONFIG_I2C_PROSAVAGE is not set | 839 | # CONFIG_I2C_PROSAVAGE is not set |
818 | # CONFIG_I2C_SAVAGE4 is not set | 840 | # CONFIG_I2C_SAVAGE4 is not set |
@@ -849,7 +871,6 @@ CONFIG_I2C_POWERMAC=y | |||
849 | # | 871 | # |
850 | # Dallas's 1-wire bus | 872 | # Dallas's 1-wire bus |
851 | # | 873 | # |
852 | # CONFIG_W1 is not set | ||
853 | 874 | ||
854 | # | 875 | # |
855 | # Hardware Monitoring support | 876 | # Hardware Monitoring support |
@@ -865,6 +886,7 @@ CONFIG_I2C_POWERMAC=y | |||
865 | # Multimedia devices | 886 | # Multimedia devices |
866 | # | 887 | # |
867 | # CONFIG_VIDEO_DEV is not set | 888 | # CONFIG_VIDEO_DEV is not set |
889 | CONFIG_VIDEO_V4L2=y | ||
868 | 890 | ||
869 | # | 891 | # |
870 | # Digital Video Broadcasting Devices | 892 | # Digital Video Broadcasting Devices |
@@ -875,22 +897,19 @@ CONFIG_I2C_POWERMAC=y | |||
875 | # | 897 | # |
876 | # Graphics support | 898 | # Graphics support |
877 | # | 899 | # |
900 | CONFIG_FIRMWARE_EDID=y | ||
878 | CONFIG_FB=y | 901 | CONFIG_FB=y |
879 | CONFIG_FB_CFB_FILLRECT=y | 902 | CONFIG_FB_CFB_FILLRECT=y |
880 | CONFIG_FB_CFB_COPYAREA=y | 903 | CONFIG_FB_CFB_COPYAREA=y |
881 | CONFIG_FB_CFB_IMAGEBLIT=y | 904 | CONFIG_FB_CFB_IMAGEBLIT=y |
882 | CONFIG_FB_MACMODES=y | 905 | CONFIG_FB_MACMODES=y |
883 | CONFIG_FB_FIRMWARE_EDID=y | 906 | # CONFIG_FB_BACKLIGHT is not set |
884 | CONFIG_FB_MODE_HELPERS=y | 907 | CONFIG_FB_MODE_HELPERS=y |
885 | CONFIG_FB_TILEBLITTING=y | 908 | CONFIG_FB_TILEBLITTING=y |
886 | # CONFIG_FB_CIRRUS is not set | 909 | # CONFIG_FB_CIRRUS is not set |
887 | # CONFIG_FB_PM2 is not set | 910 | # CONFIG_FB_PM2 is not set |
888 | # CONFIG_FB_CYBER2000 is not set | 911 | # CONFIG_FB_CYBER2000 is not set |
889 | CONFIG_FB_OF=y | 912 | CONFIG_FB_OF=y |
890 | # CONFIG_FB_CONTROL is not set | ||
891 | # CONFIG_FB_PLATINUM is not set | ||
892 | # CONFIG_FB_VALKYRIE is not set | ||
893 | # CONFIG_FB_CT65550 is not set | ||
894 | # CONFIG_FB_ASILIANT is not set | 913 | # CONFIG_FB_ASILIANT is not set |
895 | # CONFIG_FB_IMSTT is not set | 914 | # CONFIG_FB_IMSTT is not set |
896 | # CONFIG_FB_VGA16 is not set | 915 | # CONFIG_FB_VGA16 is not set |
@@ -990,6 +1009,18 @@ CONFIG_SND_VERBOSE_PROCFS=y | |||
990 | # CONFIG_SND_CMIPCI is not set | 1009 | # CONFIG_SND_CMIPCI is not set |
991 | # CONFIG_SND_CS4281 is not set | 1010 | # CONFIG_SND_CS4281 is not set |
992 | # CONFIG_SND_CS46XX is not set | 1011 | # CONFIG_SND_CS46XX is not set |
1012 | # CONFIG_SND_DARLA20 is not set | ||
1013 | # CONFIG_SND_GINA20 is not set | ||
1014 | # CONFIG_SND_LAYLA20 is not set | ||
1015 | # CONFIG_SND_DARLA24 is not set | ||
1016 | # CONFIG_SND_GINA24 is not set | ||
1017 | # CONFIG_SND_LAYLA24 is not set | ||
1018 | # CONFIG_SND_MONA is not set | ||
1019 | # CONFIG_SND_MIA is not set | ||
1020 | # CONFIG_SND_ECHO3G is not set | ||
1021 | # CONFIG_SND_INDIGO is not set | ||
1022 | # CONFIG_SND_INDIGOIO is not set | ||
1023 | # CONFIG_SND_INDIGODJ is not set | ||
993 | # CONFIG_SND_EMU10K1 is not set | 1024 | # CONFIG_SND_EMU10K1 is not set |
994 | # CONFIG_SND_EMU10K1X is not set | 1025 | # CONFIG_SND_EMU10K1X is not set |
995 | # CONFIG_SND_ENS1370 is not set | 1026 | # CONFIG_SND_ENS1370 is not set |
@@ -1027,6 +1058,17 @@ CONFIG_SND_POWERMAC=m | |||
1027 | CONFIG_SND_POWERMAC_AUTO_DRC=y | 1058 | CONFIG_SND_POWERMAC_AUTO_DRC=y |
1028 | 1059 | ||
1029 | # | 1060 | # |
1061 | # Apple Onboard Audio driver | ||
1062 | # | ||
1063 | CONFIG_SND_AOA=m | ||
1064 | CONFIG_SND_AOA_FABRIC_LAYOUT=m | ||
1065 | CONFIG_SND_AOA_ONYX=m | ||
1066 | CONFIG_SND_AOA_TAS=m | ||
1067 | CONFIG_SND_AOA_TOONIE=m | ||
1068 | CONFIG_SND_AOA_SOUNDBUS=m | ||
1069 | CONFIG_SND_AOA_SOUNDBUS_I2S=m | ||
1070 | |||
1071 | # | ||
1030 | # USB devices | 1072 | # USB devices |
1031 | # | 1073 | # |
1032 | CONFIG_SND_USB_AUDIO=m | 1074 | CONFIG_SND_USB_AUDIO=m |
@@ -1060,6 +1102,7 @@ CONFIG_USB_DEVICEFS=y | |||
1060 | CONFIG_USB_EHCI_HCD=y | 1102 | CONFIG_USB_EHCI_HCD=y |
1061 | # CONFIG_USB_EHCI_SPLIT_ISO is not set | 1103 | # CONFIG_USB_EHCI_SPLIT_ISO is not set |
1062 | # CONFIG_USB_EHCI_ROOT_HUB_TT is not set | 1104 | # CONFIG_USB_EHCI_ROOT_HUB_TT is not set |
1105 | # CONFIG_USB_EHCI_TT_NEWSCHED is not set | ||
1063 | # CONFIG_USB_ISP116X_HCD is not set | 1106 | # CONFIG_USB_ISP116X_HCD is not set |
1064 | CONFIG_USB_OHCI_HCD=y | 1107 | CONFIG_USB_OHCI_HCD=y |
1065 | # CONFIG_USB_OHCI_BIG_ENDIAN is not set | 1108 | # CONFIG_USB_OHCI_BIG_ENDIAN is not set |
@@ -1110,9 +1153,7 @@ CONFIG_USB_HIDDEV=y | |||
1110 | # CONFIG_USB_ACECAD is not set | 1153 | # CONFIG_USB_ACECAD is not set |
1111 | # CONFIG_USB_KBTAB is not set | 1154 | # CONFIG_USB_KBTAB is not set |
1112 | # CONFIG_USB_POWERMATE is not set | 1155 | # CONFIG_USB_POWERMATE is not set |
1113 | # CONFIG_USB_MTOUCH is not set | 1156 | # CONFIG_USB_TOUCHSCREEN is not set |
1114 | # CONFIG_USB_ITMTOUCH is not set | ||
1115 | # CONFIG_USB_EGALAX is not set | ||
1116 | # CONFIG_USB_YEALINK is not set | 1157 | # CONFIG_USB_YEALINK is not set |
1117 | # CONFIG_USB_XPAD is not set | 1158 | # CONFIG_USB_XPAD is not set |
1118 | # CONFIG_USB_ATI_REMOTE is not set | 1159 | # CONFIG_USB_ATI_REMOTE is not set |
@@ -1155,6 +1196,7 @@ CONFIG_USB_SERIAL=m | |||
1155 | CONFIG_USB_SERIAL_GENERIC=y | 1196 | CONFIG_USB_SERIAL_GENERIC=y |
1156 | # CONFIG_USB_SERIAL_AIRPRIME is not set | 1197 | # CONFIG_USB_SERIAL_AIRPRIME is not set |
1157 | # CONFIG_USB_SERIAL_ANYDATA is not set | 1198 | # CONFIG_USB_SERIAL_ANYDATA is not set |
1199 | # CONFIG_USB_SERIAL_ARK3116 is not set | ||
1158 | CONFIG_USB_SERIAL_BELKIN=m | 1200 | CONFIG_USB_SERIAL_BELKIN=m |
1159 | # CONFIG_USB_SERIAL_WHITEHEAT is not set | 1201 | # CONFIG_USB_SERIAL_WHITEHEAT is not set |
1160 | CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m | 1202 | CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m |
@@ -1162,6 +1204,7 @@ CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m | |||
1162 | CONFIG_USB_SERIAL_CYPRESS_M8=m | 1204 | CONFIG_USB_SERIAL_CYPRESS_M8=m |
1163 | CONFIG_USB_SERIAL_EMPEG=m | 1205 | CONFIG_USB_SERIAL_EMPEG=m |
1164 | CONFIG_USB_SERIAL_FTDI_SIO=m | 1206 | CONFIG_USB_SERIAL_FTDI_SIO=m |
1207 | # CONFIG_USB_SERIAL_FUNSOFT is not set | ||
1165 | CONFIG_USB_SERIAL_VISOR=m | 1208 | CONFIG_USB_SERIAL_VISOR=m |
1166 | CONFIG_USB_SERIAL_IPAQ=m | 1209 | CONFIG_USB_SERIAL_IPAQ=m |
1167 | CONFIG_USB_SERIAL_IR=m | 1210 | CONFIG_USB_SERIAL_IR=m |
@@ -1191,9 +1234,11 @@ CONFIG_USB_SERIAL_PL2303=m | |||
1191 | # CONFIG_USB_SERIAL_HP4X is not set | 1234 | # CONFIG_USB_SERIAL_HP4X is not set |
1192 | CONFIG_USB_SERIAL_SAFE=m | 1235 | CONFIG_USB_SERIAL_SAFE=m |
1193 | CONFIG_USB_SERIAL_SAFE_PADDED=y | 1236 | CONFIG_USB_SERIAL_SAFE_PADDED=y |
1237 | # CONFIG_USB_SERIAL_SIERRAWIRELESS is not set | ||
1194 | CONFIG_USB_SERIAL_TI=m | 1238 | CONFIG_USB_SERIAL_TI=m |
1195 | CONFIG_USB_SERIAL_CYBERJACK=m | 1239 | CONFIG_USB_SERIAL_CYBERJACK=m |
1196 | CONFIG_USB_SERIAL_XIRCOM=m | 1240 | CONFIG_USB_SERIAL_XIRCOM=m |
1241 | # CONFIG_USB_SERIAL_OPTION is not set | ||
1197 | CONFIG_USB_SERIAL_OMNINET=m | 1242 | CONFIG_USB_SERIAL_OMNINET=m |
1198 | CONFIG_USB_EZUSB=y | 1243 | CONFIG_USB_EZUSB=y |
1199 | 1244 | ||
@@ -1207,10 +1252,12 @@ CONFIG_USB_EZUSB=y | |||
1207 | # CONFIG_USB_LEGOTOWER is not set | 1252 | # CONFIG_USB_LEGOTOWER is not set |
1208 | # CONFIG_USB_LCD is not set | 1253 | # CONFIG_USB_LCD is not set |
1209 | # CONFIG_USB_LED is not set | 1254 | # CONFIG_USB_LED is not set |
1255 | # CONFIG_USB_CYPRESS_CY7C63 is not set | ||
1210 | # CONFIG_USB_CYTHERM is not set | 1256 | # CONFIG_USB_CYTHERM is not set |
1211 | # CONFIG_USB_PHIDGETKIT is not set | 1257 | # CONFIG_USB_PHIDGETKIT is not set |
1212 | # CONFIG_USB_PHIDGETSERVO is not set | 1258 | # CONFIG_USB_PHIDGETSERVO is not set |
1213 | # CONFIG_USB_IDMOUSE is not set | 1259 | # CONFIG_USB_IDMOUSE is not set |
1260 | CONFIG_USB_APPLEDISPLAY=m | ||
1214 | # CONFIG_USB_SISUSBVGA is not set | 1261 | # CONFIG_USB_SISUSBVGA is not set |
1215 | # CONFIG_USB_LD is not set | 1262 | # CONFIG_USB_LD is not set |
1216 | # CONFIG_USB_TEST is not set | 1263 | # CONFIG_USB_TEST is not set |
@@ -1235,6 +1282,14 @@ CONFIG_USB_EZUSB=y | |||
1235 | # CONFIG_NEW_LEDS is not set | 1282 | # CONFIG_NEW_LEDS is not set |
1236 | 1283 | ||
1237 | # | 1284 | # |
1285 | # LED drivers | ||
1286 | # | ||
1287 | |||
1288 | # | ||
1289 | # LED Triggers | ||
1290 | # | ||
1291 | |||
1292 | # | ||
1238 | # InfiniBand support | 1293 | # InfiniBand support |
1239 | # | 1294 | # |
1240 | # CONFIG_INFINIBAND is not set | 1295 | # CONFIG_INFINIBAND is not set |
@@ -1249,6 +1304,19 @@ CONFIG_USB_EZUSB=y | |||
1249 | # CONFIG_RTC_CLASS is not set | 1304 | # CONFIG_RTC_CLASS is not set |
1250 | 1305 | ||
1251 | # | 1306 | # |
1307 | # DMA Engine support | ||
1308 | # | ||
1309 | # CONFIG_DMA_ENGINE is not set | ||
1310 | |||
1311 | # | ||
1312 | # DMA Clients | ||
1313 | # | ||
1314 | |||
1315 | # | ||
1316 | # DMA Devices | ||
1317 | # | ||
1318 | |||
1319 | # | ||
1252 | # File systems | 1320 | # File systems |
1253 | # | 1321 | # |
1254 | CONFIG_EXT2_FS=y | 1322 | CONFIG_EXT2_FS=y |
@@ -1273,7 +1341,6 @@ CONFIG_REISERFS_FS_SECURITY=y | |||
1273 | # CONFIG_JFS_FS is not set | 1341 | # CONFIG_JFS_FS is not set |
1274 | CONFIG_FS_POSIX_ACL=y | 1342 | CONFIG_FS_POSIX_ACL=y |
1275 | CONFIG_XFS_FS=m | 1343 | CONFIG_XFS_FS=m |
1276 | CONFIG_XFS_EXPORT=y | ||
1277 | # CONFIG_XFS_QUOTA is not set | 1344 | # CONFIG_XFS_QUOTA is not set |
1278 | CONFIG_XFS_SECURITY=y | 1345 | CONFIG_XFS_SECURITY=y |
1279 | CONFIG_XFS_POSIX_ACL=y | 1346 | CONFIG_XFS_POSIX_ACL=y |
@@ -1282,6 +1349,7 @@ CONFIG_XFS_POSIX_ACL=y | |||
1282 | # CONFIG_MINIX_FS is not set | 1349 | # CONFIG_MINIX_FS is not set |
1283 | # CONFIG_ROMFS_FS is not set | 1350 | # CONFIG_ROMFS_FS is not set |
1284 | CONFIG_INOTIFY=y | 1351 | CONFIG_INOTIFY=y |
1352 | CONFIG_INOTIFY_USER=y | ||
1285 | # CONFIG_QUOTA is not set | 1353 | # CONFIG_QUOTA is not set |
1286 | CONFIG_DNOTIFY=y | 1354 | CONFIG_DNOTIFY=y |
1287 | CONFIG_AUTOFS_FS=m | 1355 | CONFIG_AUTOFS_FS=m |
@@ -1363,7 +1431,9 @@ CONFIG_RPCSEC_GSS_KRB5=y | |||
1363 | # CONFIG_SMB_FS is not set | 1431 | # CONFIG_SMB_FS is not set |
1364 | CONFIG_CIFS=m | 1432 | CONFIG_CIFS=m |
1365 | # CONFIG_CIFS_STATS is not set | 1433 | # CONFIG_CIFS_STATS is not set |
1434 | # CONFIG_CIFS_WEAK_PW_HASH is not set | ||
1366 | # CONFIG_CIFS_XATTR is not set | 1435 | # CONFIG_CIFS_XATTR is not set |
1436 | # CONFIG_CIFS_DEBUG2 is not set | ||
1367 | # CONFIG_CIFS_EXPERIMENTAL is not set | 1437 | # CONFIG_CIFS_EXPERIMENTAL is not set |
1368 | # CONFIG_NCP_FS is not set | 1438 | # CONFIG_NCP_FS is not set |
1369 | # CONFIG_CODA_FS is not set | 1439 | # CONFIG_CODA_FS is not set |
@@ -1444,6 +1514,9 @@ CONFIG_CRC32=y | |||
1444 | CONFIG_LIBCRC32C=m | 1514 | CONFIG_LIBCRC32C=m |
1445 | CONFIG_ZLIB_INFLATE=y | 1515 | CONFIG_ZLIB_INFLATE=y |
1446 | CONFIG_ZLIB_DEFLATE=m | 1516 | CONFIG_ZLIB_DEFLATE=m |
1517 | CONFIG_TEXTSEARCH=y | ||
1518 | CONFIG_TEXTSEARCH_KMP=m | ||
1519 | CONFIG_PLIST=y | ||
1447 | 1520 | ||
1448 | # | 1521 | # |
1449 | # Instrumentation Support | 1522 | # Instrumentation Support |
@@ -1457,14 +1530,19 @@ CONFIG_OPROFILE=y | |||
1457 | # | 1530 | # |
1458 | # CONFIG_PRINTK_TIME is not set | 1531 | # CONFIG_PRINTK_TIME is not set |
1459 | CONFIG_MAGIC_SYSRQ=y | 1532 | CONFIG_MAGIC_SYSRQ=y |
1533 | # CONFIG_UNUSED_SYMBOLS is not set | ||
1460 | CONFIG_DEBUG_KERNEL=y | 1534 | CONFIG_DEBUG_KERNEL=y |
1461 | CONFIG_LOG_BUF_SHIFT=17 | 1535 | CONFIG_LOG_BUF_SHIFT=17 |
1462 | CONFIG_DETECT_SOFTLOCKUP=y | 1536 | CONFIG_DETECT_SOFTLOCKUP=y |
1463 | # CONFIG_SCHEDSTATS is not set | 1537 | # CONFIG_SCHEDSTATS is not set |
1464 | # CONFIG_DEBUG_SLAB is not set | 1538 | # CONFIG_DEBUG_SLAB is not set |
1465 | CONFIG_DEBUG_MUTEXES=y | 1539 | # CONFIG_DEBUG_RT_MUTEXES is not set |
1540 | # CONFIG_RT_MUTEX_TESTER is not set | ||
1466 | # CONFIG_DEBUG_SPINLOCK is not set | 1541 | # CONFIG_DEBUG_SPINLOCK is not set |
1542 | CONFIG_DEBUG_MUTEXES=y | ||
1543 | # CONFIG_DEBUG_RWSEMS is not set | ||
1467 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | 1544 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set |
1545 | # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set | ||
1468 | # CONFIG_DEBUG_KOBJECT is not set | 1546 | # CONFIG_DEBUG_KOBJECT is not set |
1469 | # CONFIG_DEBUG_INFO is not set | 1547 | # CONFIG_DEBUG_INFO is not set |
1470 | CONFIG_DEBUG_FS=y | 1548 | CONFIG_DEBUG_FS=y |
@@ -1476,11 +1554,7 @@ CONFIG_FORCED_INLINING=y | |||
1476 | # CONFIG_DEBUGGER is not set | 1554 | # CONFIG_DEBUGGER is not set |
1477 | CONFIG_IRQSTACKS=y | 1555 | CONFIG_IRQSTACKS=y |
1478 | CONFIG_BOOTX_TEXT=y | 1556 | CONFIG_BOOTX_TEXT=y |
1479 | # CONFIG_PPC_EARLY_DEBUG_LPAR is not set | 1557 | # CONFIG_PPC_EARLY_DEBUG is not set |
1480 | # CONFIG_PPC_EARLY_DEBUG_G5 is not set | ||
1481 | # CONFIG_PPC_EARLY_DEBUG_RTAS is not set | ||
1482 | # CONFIG_PPC_EARLY_DEBUG_MAPLE is not set | ||
1483 | # CONFIG_PPC_EARLY_DEBUG_ISERIES is not set | ||
1484 | 1558 | ||
1485 | # | 1559 | # |
1486 | # Security options | 1560 | # Security options |
diff --git a/arch/powerpc/configs/iseries_defconfig b/arch/powerpc/configs/iseries_defconfig index a95e455a1944..72ed95b3ead6 100644 --- a/arch/powerpc/configs/iseries_defconfig +++ b/arch/powerpc/configs/iseries_defconfig | |||
@@ -1,16 +1,18 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.17-rc1 | 3 | # Linux kernel version: 2.6.18-rc3 |
4 | # Wed Apr 19 11:46:44 2006 | 4 | # Tue Aug 8 09:15:46 2006 |
5 | # | 5 | # |
6 | CONFIG_PPC64=y | 6 | CONFIG_PPC64=y |
7 | CONFIG_64BIT=y | 7 | CONFIG_64BIT=y |
8 | CONFIG_PPC_MERGE=y | 8 | CONFIG_PPC_MERGE=y |
9 | CONFIG_MMU=y | 9 | CONFIG_MMU=y |
10 | CONFIG_GENERIC_HARDIRQS=y | 10 | CONFIG_GENERIC_HARDIRQS=y |
11 | CONFIG_IRQ_PER_CPU=y | ||
11 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y | 12 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y |
12 | CONFIG_GENERIC_HWEIGHT=y | 13 | CONFIG_GENERIC_HWEIGHT=y |
13 | CONFIG_GENERIC_CALIBRATE_DELAY=y | 14 | CONFIG_GENERIC_CALIBRATE_DELAY=y |
15 | CONFIG_GENERIC_FIND_NEXT_BIT=y | ||
14 | CONFIG_PPC=y | 16 | CONFIG_PPC=y |
15 | CONFIG_EARLY_PRINTK=y | 17 | CONFIG_EARLY_PRINTK=y |
16 | CONFIG_COMPAT=y | 18 | CONFIG_COMPAT=y |
@@ -34,6 +36,7 @@ CONFIG_PPC_STD_MMU=y | |||
34 | CONFIG_VIRT_CPU_ACCOUNTING=y | 36 | CONFIG_VIRT_CPU_ACCOUNTING=y |
35 | CONFIG_SMP=y | 37 | CONFIG_SMP=y |
36 | CONFIG_NR_CPUS=32 | 38 | CONFIG_NR_CPUS=32 |
39 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | ||
37 | 40 | ||
38 | # | 41 | # |
39 | # Code maturity level options | 42 | # Code maturity level options |
@@ -51,6 +54,7 @@ CONFIG_SWAP=y | |||
51 | CONFIG_SYSVIPC=y | 54 | CONFIG_SYSVIPC=y |
52 | CONFIG_POSIX_MQUEUE=y | 55 | CONFIG_POSIX_MQUEUE=y |
53 | # CONFIG_BSD_PROCESS_ACCT is not set | 56 | # CONFIG_BSD_PROCESS_ACCT is not set |
57 | # CONFIG_TASKSTATS is not set | ||
54 | CONFIG_SYSCTL=y | 58 | CONFIG_SYSCTL=y |
55 | CONFIG_AUDIT=y | 59 | CONFIG_AUDIT=y |
56 | CONFIG_AUDITSYSCALL=y | 60 | CONFIG_AUDITSYSCALL=y |
@@ -69,10 +73,12 @@ CONFIG_PRINTK=y | |||
69 | CONFIG_BUG=y | 73 | CONFIG_BUG=y |
70 | CONFIG_ELF_CORE=y | 74 | CONFIG_ELF_CORE=y |
71 | CONFIG_BASE_FULL=y | 75 | CONFIG_BASE_FULL=y |
76 | CONFIG_RT_MUTEXES=y | ||
72 | CONFIG_FUTEX=y | 77 | CONFIG_FUTEX=y |
73 | CONFIG_EPOLL=y | 78 | CONFIG_EPOLL=y |
74 | CONFIG_SHMEM=y | 79 | CONFIG_SHMEM=y |
75 | CONFIG_SLAB=y | 80 | CONFIG_SLAB=y |
81 | CONFIG_VM_EVENT_COUNTERS=y | ||
76 | # CONFIG_TINY_SHMEM is not set | 82 | # CONFIG_TINY_SHMEM is not set |
77 | CONFIG_BASE_SMALL=0 | 83 | CONFIG_BASE_SMALL=0 |
78 | # CONFIG_SLOB is not set | 84 | # CONFIG_SLOB is not set |
@@ -113,10 +119,14 @@ CONFIG_DEFAULT_IOSCHED="anticipatory" | |||
113 | CONFIG_PPC_ISERIES=y | 119 | CONFIG_PPC_ISERIES=y |
114 | # CONFIG_EMBEDDED6xx is not set | 120 | # CONFIG_EMBEDDED6xx is not set |
115 | # CONFIG_APUS is not set | 121 | # CONFIG_APUS is not set |
122 | # CONFIG_PPC_CELL is not set | ||
123 | # CONFIG_PPC_CELL_NATIVE is not set | ||
124 | # CONFIG_UDBG_RTAS_CONSOLE is not set | ||
116 | # CONFIG_PPC_RTAS is not set | 125 | # CONFIG_PPC_RTAS is not set |
117 | # CONFIG_MMIO_NVRAM is not set | 126 | # CONFIG_MMIO_NVRAM is not set |
118 | CONFIG_IBMVIO=y | 127 | CONFIG_IBMVIO=y |
119 | # CONFIG_PPC_MPC106 is not set | 128 | # CONFIG_PPC_MPC106 is not set |
129 | # CONFIG_PPC_970_NAP is not set | ||
120 | # CONFIG_CPU_FREQ is not set | 130 | # CONFIG_CPU_FREQ is not set |
121 | # CONFIG_WANT_EARLY_SERIAL is not set | 131 | # CONFIG_WANT_EARLY_SERIAL is not set |
122 | 132 | ||
@@ -135,6 +145,7 @@ CONFIG_BINFMT_ELF=y | |||
135 | # CONFIG_BINFMT_MISC is not set | 145 | # CONFIG_BINFMT_MISC is not set |
136 | CONFIG_FORCE_MAX_ZONEORDER=13 | 146 | CONFIG_FORCE_MAX_ZONEORDER=13 |
137 | CONFIG_IOMMU_VMERGE=y | 147 | CONFIG_IOMMU_VMERGE=y |
148 | CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y | ||
138 | CONFIG_IRQ_ALL_CPUS=y | 149 | CONFIG_IRQ_ALL_CPUS=y |
139 | CONFIG_LPARCFG=y | 150 | CONFIG_LPARCFG=y |
140 | # CONFIG_NUMA is not set | 151 | # CONFIG_NUMA is not set |
@@ -149,6 +160,7 @@ CONFIG_FLATMEM=y | |||
149 | CONFIG_FLAT_NODE_MEM_MAP=y | 160 | CONFIG_FLAT_NODE_MEM_MAP=y |
150 | # CONFIG_SPARSEMEM_STATIC is not set | 161 | # CONFIG_SPARSEMEM_STATIC is not set |
151 | CONFIG_SPLIT_PTLOCK_CPUS=4 | 162 | CONFIG_SPLIT_PTLOCK_CPUS=4 |
163 | CONFIG_RESOURCES_64BIT=y | ||
152 | # CONFIG_PPC_64K_PAGES is not set | 164 | # CONFIG_PPC_64K_PAGES is not set |
153 | # CONFIG_SCHED_SMT is not set | 165 | # CONFIG_SCHED_SMT is not set |
154 | CONFIG_PROC_DEVICETREE=y | 166 | CONFIG_PROC_DEVICETREE=y |
@@ -164,6 +176,7 @@ CONFIG_GENERIC_ISA_DMA=y | |||
164 | # CONFIG_PPC_INDIRECT_PCI is not set | 176 | # CONFIG_PPC_INDIRECT_PCI is not set |
165 | CONFIG_PCI=y | 177 | CONFIG_PCI=y |
166 | CONFIG_PCI_DOMAINS=y | 178 | CONFIG_PCI_DOMAINS=y |
179 | # CONFIG_PCIEPORTBUS is not set | ||
167 | # CONFIG_PCI_DEBUG is not set | 180 | # CONFIG_PCI_DEBUG is not set |
168 | 181 | ||
169 | # | 182 | # |
@@ -207,6 +220,8 @@ CONFIG_INET_ESP=m | |||
207 | CONFIG_INET_IPCOMP=m | 220 | CONFIG_INET_IPCOMP=m |
208 | CONFIG_INET_XFRM_TUNNEL=m | 221 | CONFIG_INET_XFRM_TUNNEL=m |
209 | CONFIG_INET_TUNNEL=y | 222 | CONFIG_INET_TUNNEL=y |
223 | CONFIG_INET_XFRM_MODE_TRANSPORT=y | ||
224 | CONFIG_INET_XFRM_MODE_TUNNEL=y | ||
210 | CONFIG_INET_DIAG=y | 225 | CONFIG_INET_DIAG=y |
211 | CONFIG_INET_TCP_DIAG=y | 226 | CONFIG_INET_TCP_DIAG=y |
212 | # CONFIG_TCP_CONG_ADVANCED is not set | 227 | # CONFIG_TCP_CONG_ADVANCED is not set |
@@ -219,6 +234,7 @@ CONFIG_TCP_CONG_BIC=y | |||
219 | # CONFIG_IPV6 is not set | 234 | # CONFIG_IPV6 is not set |
220 | # CONFIG_INET6_XFRM_TUNNEL is not set | 235 | # CONFIG_INET6_XFRM_TUNNEL is not set |
221 | # CONFIG_INET6_TUNNEL is not set | 236 | # CONFIG_INET6_TUNNEL is not set |
237 | # CONFIG_NETWORK_SECMARK is not set | ||
222 | CONFIG_NETFILTER=y | 238 | CONFIG_NETFILTER=y |
223 | # CONFIG_NETFILTER_DEBUG is not set | 239 | # CONFIG_NETFILTER_DEBUG is not set |
224 | 240 | ||
@@ -246,9 +262,11 @@ CONFIG_NETFILTER_XT_MATCH_MARK=m | |||
246 | # CONFIG_NETFILTER_XT_MATCH_POLICY is not set | 262 | # CONFIG_NETFILTER_XT_MATCH_POLICY is not set |
247 | # CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set | 263 | # CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set |
248 | CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m | 264 | CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m |
265 | # CONFIG_NETFILTER_XT_MATCH_QUOTA is not set | ||
249 | CONFIG_NETFILTER_XT_MATCH_REALM=m | 266 | CONFIG_NETFILTER_XT_MATCH_REALM=m |
250 | CONFIG_NETFILTER_XT_MATCH_SCTP=m | 267 | CONFIG_NETFILTER_XT_MATCH_SCTP=m |
251 | CONFIG_NETFILTER_XT_MATCH_STATE=m | 268 | CONFIG_NETFILTER_XT_MATCH_STATE=m |
269 | # CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set | ||
252 | CONFIG_NETFILTER_XT_MATCH_STRING=m | 270 | CONFIG_NETFILTER_XT_MATCH_STRING=m |
253 | CONFIG_NETFILTER_XT_MATCH_TCPMSS=m | 271 | CONFIG_NETFILTER_XT_MATCH_TCPMSS=m |
254 | 272 | ||
@@ -267,6 +285,7 @@ CONFIG_IP_NF_TFTP=m | |||
267 | CONFIG_IP_NF_AMANDA=m | 285 | CONFIG_IP_NF_AMANDA=m |
268 | # CONFIG_IP_NF_PPTP is not set | 286 | # CONFIG_IP_NF_PPTP is not set |
269 | # CONFIG_IP_NF_H323 is not set | 287 | # CONFIG_IP_NF_H323 is not set |
288 | # CONFIG_IP_NF_SIP is not set | ||
270 | CONFIG_IP_NF_QUEUE=m | 289 | CONFIG_IP_NF_QUEUE=m |
271 | CONFIG_IP_NF_IPTABLES=m | 290 | CONFIG_IP_NF_IPTABLES=m |
272 | CONFIG_IP_NF_MATCH_IPRANGE=m | 291 | CONFIG_IP_NF_MATCH_IPRANGE=m |
@@ -360,6 +379,7 @@ CONFIG_STANDALONE=y | |||
360 | CONFIG_PREVENT_FIRMWARE_BUILD=y | 379 | CONFIG_PREVENT_FIRMWARE_BUILD=y |
361 | CONFIG_FW_LOADER=m | 380 | CONFIG_FW_LOADER=m |
362 | # CONFIG_DEBUG_DRIVER is not set | 381 | # CONFIG_DEBUG_DRIVER is not set |
382 | # CONFIG_SYS_HYPERVISOR is not set | ||
363 | 383 | ||
364 | # | 384 | # |
365 | # Connector - unified userspace <-> kernelspace linker | 385 | # Connector - unified userspace <-> kernelspace linker |
@@ -396,6 +416,7 @@ CONFIG_BLK_DEV_NBD=m | |||
396 | CONFIG_BLK_DEV_RAM=y | 416 | CONFIG_BLK_DEV_RAM=y |
397 | CONFIG_BLK_DEV_RAM_COUNT=16 | 417 | CONFIG_BLK_DEV_RAM_COUNT=16 |
398 | CONFIG_BLK_DEV_RAM_SIZE=65536 | 418 | CONFIG_BLK_DEV_RAM_SIZE=65536 |
419 | CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 | ||
399 | CONFIG_BLK_DEV_INITRD=y | 420 | CONFIG_BLK_DEV_INITRD=y |
400 | # CONFIG_CDROM_PKTCDVD is not set | 421 | # CONFIG_CDROM_PKTCDVD is not set |
401 | # CONFIG_ATA_OVER_ETH is not set | 422 | # CONFIG_ATA_OVER_ETH is not set |
@@ -453,6 +474,7 @@ CONFIG_SCSI_FC_ATTRS=y | |||
453 | # CONFIG_MEGARAID_LEGACY is not set | 474 | # CONFIG_MEGARAID_LEGACY is not set |
454 | # CONFIG_MEGARAID_SAS is not set | 475 | # CONFIG_MEGARAID_SAS is not set |
455 | # CONFIG_SCSI_SATA is not set | 476 | # CONFIG_SCSI_SATA is not set |
477 | # CONFIG_SCSI_HPTIOP is not set | ||
456 | # CONFIG_SCSI_BUSLOGIC is not set | 478 | # CONFIG_SCSI_BUSLOGIC is not set |
457 | # CONFIG_SCSI_DMX3191D is not set | 479 | # CONFIG_SCSI_DMX3191D is not set |
458 | # CONFIG_SCSI_EATA is not set | 480 | # CONFIG_SCSI_EATA is not set |
@@ -464,7 +486,6 @@ CONFIG_SCSI_IBMVSCSI=m | |||
464 | # CONFIG_SCSI_INIA100 is not set | 486 | # CONFIG_SCSI_INIA100 is not set |
465 | # CONFIG_SCSI_SYM53C8XX_2 is not set | 487 | # CONFIG_SCSI_SYM53C8XX_2 is not set |
466 | # CONFIG_SCSI_IPR is not set | 488 | # CONFIG_SCSI_IPR is not set |
467 | # CONFIG_SCSI_QLOGIC_FC is not set | ||
468 | # CONFIG_SCSI_QLOGIC_1280 is not set | 489 | # CONFIG_SCSI_QLOGIC_1280 is not set |
469 | # CONFIG_SCSI_QLA_FC is not set | 490 | # CONFIG_SCSI_QLA_FC is not set |
470 | # CONFIG_SCSI_LPFC is not set | 491 | # CONFIG_SCSI_LPFC is not set |
@@ -481,9 +502,7 @@ CONFIG_MD_LINEAR=y | |||
481 | CONFIG_MD_RAID0=y | 502 | CONFIG_MD_RAID0=y |
482 | CONFIG_MD_RAID1=y | 503 | CONFIG_MD_RAID1=y |
483 | CONFIG_MD_RAID10=m | 504 | CONFIG_MD_RAID10=m |
484 | CONFIG_MD_RAID5=y | 505 | # CONFIG_MD_RAID456 is not set |
485 | # CONFIG_MD_RAID5_RESHAPE is not set | ||
486 | CONFIG_MD_RAID6=m | ||
487 | CONFIG_MD_MULTIPATH=m | 506 | CONFIG_MD_MULTIPATH=m |
488 | CONFIG_MD_FAULTY=m | 507 | CONFIG_MD_FAULTY=m |
489 | CONFIG_BLK_DEV_DM=y | 508 | CONFIG_BLK_DEV_DM=y |
@@ -596,6 +615,7 @@ CONFIG_E1000=m | |||
596 | # CONFIG_CHELSIO_T1 is not set | 615 | # CONFIG_CHELSIO_T1 is not set |
597 | # CONFIG_IXGB is not set | 616 | # CONFIG_IXGB is not set |
598 | # CONFIG_S2IO is not set | 617 | # CONFIG_S2IO is not set |
618 | # CONFIG_MYRI10GE is not set | ||
599 | 619 | ||
600 | # | 620 | # |
601 | # Token Ring devices | 621 | # Token Ring devices |
@@ -696,6 +716,7 @@ CONFIG_SERIAL_ICOM=m | |||
696 | CONFIG_UNIX98_PTYS=y | 716 | CONFIG_UNIX98_PTYS=y |
697 | CONFIG_LEGACY_PTYS=y | 717 | CONFIG_LEGACY_PTYS=y |
698 | CONFIG_LEGACY_PTY_COUNT=256 | 718 | CONFIG_LEGACY_PTY_COUNT=256 |
719 | # CONFIG_BRIQ_PANEL is not set | ||
699 | 720 | ||
700 | # | 721 | # |
701 | # IPMI | 722 | # IPMI |
@@ -706,6 +727,7 @@ CONFIG_LEGACY_PTY_COUNT=256 | |||
706 | # Watchdog Cards | 727 | # Watchdog Cards |
707 | # | 728 | # |
708 | # CONFIG_WATCHDOG is not set | 729 | # CONFIG_WATCHDOG is not set |
730 | # CONFIG_HW_RANDOM is not set | ||
709 | CONFIG_GEN_RTC=y | 731 | CONFIG_GEN_RTC=y |
710 | # CONFIG_GEN_RTC_X is not set | 732 | # CONFIG_GEN_RTC_X is not set |
711 | # CONFIG_DTLK is not set | 733 | # CONFIG_DTLK is not set |
@@ -741,7 +763,6 @@ CONFIG_MAX_RAW_DEVS=256 | |||
741 | # | 763 | # |
742 | # Dallas's 1-wire bus | 764 | # Dallas's 1-wire bus |
743 | # | 765 | # |
744 | # CONFIG_W1 is not set | ||
745 | 766 | ||
746 | # | 767 | # |
747 | # Hardware Monitoring support | 768 | # Hardware Monitoring support |
@@ -757,6 +778,7 @@ CONFIG_MAX_RAW_DEVS=256 | |||
757 | # Multimedia devices | 778 | # Multimedia devices |
758 | # | 779 | # |
759 | # CONFIG_VIDEO_DEV is not set | 780 | # CONFIG_VIDEO_DEV is not set |
781 | CONFIG_VIDEO_V4L2=y | ||
760 | 782 | ||
761 | # | 783 | # |
762 | # Digital Video Broadcasting Devices | 784 | # Digital Video Broadcasting Devices |
@@ -766,7 +788,9 @@ CONFIG_MAX_RAW_DEVS=256 | |||
766 | # | 788 | # |
767 | # Graphics support | 789 | # Graphics support |
768 | # | 790 | # |
791 | CONFIG_FIRMWARE_EDID=y | ||
769 | # CONFIG_FB is not set | 792 | # CONFIG_FB is not set |
793 | # CONFIG_BACKLIGHT_LCD_SUPPORT is not set | ||
770 | 794 | ||
771 | # | 795 | # |
772 | # Sound | 796 | # Sound |
@@ -801,6 +825,14 @@ CONFIG_USB_ARCH_HAS_EHCI=y | |||
801 | # CONFIG_NEW_LEDS is not set | 825 | # CONFIG_NEW_LEDS is not set |
802 | 826 | ||
803 | # | 827 | # |
828 | # LED drivers | ||
829 | # | ||
830 | |||
831 | # | ||
832 | # LED Triggers | ||
833 | # | ||
834 | |||
835 | # | ||
804 | # InfiniBand support | 836 | # InfiniBand support |
805 | # | 837 | # |
806 | # CONFIG_INFINIBAND is not set | 838 | # CONFIG_INFINIBAND is not set |
@@ -815,6 +847,19 @@ CONFIG_USB_ARCH_HAS_EHCI=y | |||
815 | # CONFIG_RTC_CLASS is not set | 847 | # CONFIG_RTC_CLASS is not set |
816 | 848 | ||
817 | # | 849 | # |
850 | # DMA Engine support | ||
851 | # | ||
852 | # CONFIG_DMA_ENGINE is not set | ||
853 | |||
854 | # | ||
855 | # DMA Clients | ||
856 | # | ||
857 | |||
858 | # | ||
859 | # DMA Devices | ||
860 | # | ||
861 | |||
862 | # | ||
818 | # File systems | 863 | # File systems |
819 | # | 864 | # |
820 | CONFIG_EXT2_FS=y | 865 | CONFIG_EXT2_FS=y |
@@ -843,7 +888,6 @@ CONFIG_JFS_SECURITY=y | |||
843 | # CONFIG_JFS_STATISTICS is not set | 888 | # CONFIG_JFS_STATISTICS is not set |
844 | CONFIG_FS_POSIX_ACL=y | 889 | CONFIG_FS_POSIX_ACL=y |
845 | CONFIG_XFS_FS=m | 890 | CONFIG_XFS_FS=m |
846 | CONFIG_XFS_EXPORT=y | ||
847 | # CONFIG_XFS_QUOTA is not set | 891 | # CONFIG_XFS_QUOTA is not set |
848 | CONFIG_XFS_SECURITY=y | 892 | CONFIG_XFS_SECURITY=y |
849 | CONFIG_XFS_POSIX_ACL=y | 893 | CONFIG_XFS_POSIX_ACL=y |
@@ -852,6 +896,7 @@ CONFIG_XFS_POSIX_ACL=y | |||
852 | # CONFIG_MINIX_FS is not set | 896 | # CONFIG_MINIX_FS is not set |
853 | # CONFIG_ROMFS_FS is not set | 897 | # CONFIG_ROMFS_FS is not set |
854 | CONFIG_INOTIFY=y | 898 | CONFIG_INOTIFY=y |
899 | CONFIG_INOTIFY_USER=y | ||
855 | # CONFIG_QUOTA is not set | 900 | # CONFIG_QUOTA is not set |
856 | CONFIG_DNOTIFY=y | 901 | CONFIG_DNOTIFY=y |
857 | CONFIG_AUTOFS_FS=m | 902 | CONFIG_AUTOFS_FS=m |
@@ -933,8 +978,10 @@ CONFIG_RPCSEC_GSS_SPKM3=m | |||
933 | # CONFIG_SMB_FS is not set | 978 | # CONFIG_SMB_FS is not set |
934 | CONFIG_CIFS=m | 979 | CONFIG_CIFS=m |
935 | # CONFIG_CIFS_STATS is not set | 980 | # CONFIG_CIFS_STATS is not set |
981 | # CONFIG_CIFS_WEAK_PW_HASH is not set | ||
936 | CONFIG_CIFS_XATTR=y | 982 | CONFIG_CIFS_XATTR=y |
937 | CONFIG_CIFS_POSIX=y | 983 | CONFIG_CIFS_POSIX=y |
984 | # CONFIG_CIFS_DEBUG2 is not set | ||
938 | # CONFIG_CIFS_EXPERIMENTAL is not set | 985 | # CONFIG_CIFS_EXPERIMENTAL is not set |
939 | # CONFIG_NCP_FS is not set | 986 | # CONFIG_NCP_FS is not set |
940 | # CONFIG_CODA_FS is not set | 987 | # CONFIG_CODA_FS is not set |
@@ -1013,10 +1060,12 @@ CONFIG_TEXTSEARCH=y | |||
1013 | CONFIG_TEXTSEARCH_KMP=m | 1060 | CONFIG_TEXTSEARCH_KMP=m |
1014 | CONFIG_TEXTSEARCH_BM=m | 1061 | CONFIG_TEXTSEARCH_BM=m |
1015 | CONFIG_TEXTSEARCH_FSM=m | 1062 | CONFIG_TEXTSEARCH_FSM=m |
1063 | CONFIG_PLIST=y | ||
1016 | 1064 | ||
1017 | # | 1065 | # |
1018 | # Instrumentation Support | 1066 | # Instrumentation Support |
1019 | # | 1067 | # |
1068 | # CONFIG_PROFILING is not set | ||
1020 | # CONFIG_KPROBES is not set | 1069 | # CONFIG_KPROBES is not set |
1021 | 1070 | ||
1022 | # | 1071 | # |
@@ -1024,14 +1073,19 @@ CONFIG_TEXTSEARCH_FSM=m | |||
1024 | # | 1073 | # |
1025 | # CONFIG_PRINTK_TIME is not set | 1074 | # CONFIG_PRINTK_TIME is not set |
1026 | CONFIG_MAGIC_SYSRQ=y | 1075 | CONFIG_MAGIC_SYSRQ=y |
1076 | # CONFIG_UNUSED_SYMBOLS is not set | ||
1027 | CONFIG_DEBUG_KERNEL=y | 1077 | CONFIG_DEBUG_KERNEL=y |
1028 | CONFIG_LOG_BUF_SHIFT=17 | 1078 | CONFIG_LOG_BUF_SHIFT=17 |
1029 | CONFIG_DETECT_SOFTLOCKUP=y | 1079 | CONFIG_DETECT_SOFTLOCKUP=y |
1030 | # CONFIG_SCHEDSTATS is not set | 1080 | # CONFIG_SCHEDSTATS is not set |
1031 | # CONFIG_DEBUG_SLAB is not set | 1081 | # CONFIG_DEBUG_SLAB is not set |
1032 | # CONFIG_DEBUG_MUTEXES is not set | 1082 | # CONFIG_DEBUG_RT_MUTEXES is not set |
1083 | # CONFIG_RT_MUTEX_TESTER is not set | ||
1033 | # CONFIG_DEBUG_SPINLOCK is not set | 1084 | # CONFIG_DEBUG_SPINLOCK is not set |
1085 | # CONFIG_DEBUG_MUTEXES is not set | ||
1086 | # CONFIG_DEBUG_RWSEMS is not set | ||
1034 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | 1087 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set |
1088 | # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set | ||
1035 | # CONFIG_DEBUG_KOBJECT is not set | 1089 | # CONFIG_DEBUG_KOBJECT is not set |
1036 | # CONFIG_DEBUG_INFO is not set | 1090 | # CONFIG_DEBUG_INFO is not set |
1037 | CONFIG_DEBUG_FS=y | 1091 | CONFIG_DEBUG_FS=y |
@@ -1042,11 +1096,7 @@ CONFIG_DEBUG_STACKOVERFLOW=y | |||
1042 | CONFIG_DEBUG_STACK_USAGE=y | 1096 | CONFIG_DEBUG_STACK_USAGE=y |
1043 | # CONFIG_DEBUGGER is not set | 1097 | # CONFIG_DEBUGGER is not set |
1044 | CONFIG_IRQSTACKS=y | 1098 | CONFIG_IRQSTACKS=y |
1045 | # CONFIG_PPC_EARLY_DEBUG_LPAR is not set | 1099 | # CONFIG_PPC_EARLY_DEBUG is not set |
1046 | # CONFIG_PPC_EARLY_DEBUG_G5 is not set | ||
1047 | # CONFIG_PPC_EARLY_DEBUG_RTAS is not set | ||
1048 | # CONFIG_PPC_EARLY_DEBUG_MAPLE is not set | ||
1049 | # CONFIG_PPC_EARLY_DEBUG_ISERIES is not set | ||
1050 | 1100 | ||
1051 | # | 1101 | # |
1052 | # Security options | 1102 | # Security options |
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig index 31708ad4574e..c18e8600d78f 100644 --- a/arch/powerpc/configs/pseries_defconfig +++ b/arch/powerpc/configs/pseries_defconfig | |||
@@ -1,13 +1,14 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.17-rc4 | 3 | # Linux kernel version: 2.6.18-rc3 |
4 | # Sun May 28 07:26:56 2006 | 4 | # Tue Aug 8 09:14:48 2006 |
5 | # | 5 | # |
6 | CONFIG_PPC64=y | 6 | CONFIG_PPC64=y |
7 | CONFIG_64BIT=y | 7 | CONFIG_64BIT=y |
8 | CONFIG_PPC_MERGE=y | 8 | CONFIG_PPC_MERGE=y |
9 | CONFIG_MMU=y | 9 | CONFIG_MMU=y |
10 | CONFIG_GENERIC_HARDIRQS=y | 10 | CONFIG_GENERIC_HARDIRQS=y |
11 | CONFIG_IRQ_PER_CPU=y | ||
11 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y | 12 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y |
12 | CONFIG_GENERIC_HWEIGHT=y | 13 | CONFIG_GENERIC_HWEIGHT=y |
13 | CONFIG_GENERIC_CALIBRATE_DELAY=y | 14 | CONFIG_GENERIC_CALIBRATE_DELAY=y |
@@ -35,6 +36,7 @@ CONFIG_PPC_STD_MMU=y | |||
35 | CONFIG_VIRT_CPU_ACCOUNTING=y | 36 | CONFIG_VIRT_CPU_ACCOUNTING=y |
36 | CONFIG_SMP=y | 37 | CONFIG_SMP=y |
37 | CONFIG_NR_CPUS=128 | 38 | CONFIG_NR_CPUS=128 |
39 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | ||
38 | 40 | ||
39 | # | 41 | # |
40 | # Code maturity level options | 42 | # Code maturity level options |
@@ -52,6 +54,7 @@ CONFIG_SWAP=y | |||
52 | CONFIG_SYSVIPC=y | 54 | CONFIG_SYSVIPC=y |
53 | CONFIG_POSIX_MQUEUE=y | 55 | CONFIG_POSIX_MQUEUE=y |
54 | # CONFIG_BSD_PROCESS_ACCT is not set | 56 | # CONFIG_BSD_PROCESS_ACCT is not set |
57 | # CONFIG_TASKSTATS is not set | ||
55 | CONFIG_SYSCTL=y | 58 | CONFIG_SYSCTL=y |
56 | CONFIG_AUDIT=y | 59 | CONFIG_AUDIT=y |
57 | CONFIG_AUDITSYSCALL=y | 60 | CONFIG_AUDITSYSCALL=y |
@@ -70,10 +73,12 @@ CONFIG_PRINTK=y | |||
70 | CONFIG_BUG=y | 73 | CONFIG_BUG=y |
71 | CONFIG_ELF_CORE=y | 74 | CONFIG_ELF_CORE=y |
72 | CONFIG_BASE_FULL=y | 75 | CONFIG_BASE_FULL=y |
76 | CONFIG_RT_MUTEXES=y | ||
73 | CONFIG_FUTEX=y | 77 | CONFIG_FUTEX=y |
74 | CONFIG_EPOLL=y | 78 | CONFIG_EPOLL=y |
75 | CONFIG_SHMEM=y | 79 | CONFIG_SHMEM=y |
76 | CONFIG_SLAB=y | 80 | CONFIG_SLAB=y |
81 | CONFIG_VM_EVENT_COUNTERS=y | ||
77 | # CONFIG_TINY_SHMEM is not set | 82 | # CONFIG_TINY_SHMEM is not set |
78 | CONFIG_BASE_SMALL=0 | 83 | CONFIG_BASE_SMALL=0 |
79 | # CONFIG_SLOB is not set | 84 | # CONFIG_SLOB is not set |
@@ -118,6 +123,9 @@ CONFIG_PPC_PSERIES=y | |||
118 | # CONFIG_PPC_PMAC is not set | 123 | # CONFIG_PPC_PMAC is not set |
119 | # CONFIG_PPC_MAPLE is not set | 124 | # CONFIG_PPC_MAPLE is not set |
120 | # CONFIG_PPC_CELL is not set | 125 | # CONFIG_PPC_CELL is not set |
126 | # CONFIG_PPC_CELL_NATIVE is not set | ||
127 | # CONFIG_PPC_IBM_CELL_BLADE is not set | ||
128 | # CONFIG_UDBG_RTAS_CONSOLE is not set | ||
121 | CONFIG_XICS=y | 129 | CONFIG_XICS=y |
122 | # CONFIG_U3_DART is not set | 130 | # CONFIG_U3_DART is not set |
123 | CONFIG_MPIC=y | 131 | CONFIG_MPIC=y |
@@ -149,6 +157,7 @@ CONFIG_BINFMT_MISC=m | |||
149 | CONFIG_FORCE_MAX_ZONEORDER=13 | 157 | CONFIG_FORCE_MAX_ZONEORDER=13 |
150 | CONFIG_IOMMU_VMERGE=y | 158 | CONFIG_IOMMU_VMERGE=y |
151 | CONFIG_HOTPLUG_CPU=y | 159 | CONFIG_HOTPLUG_CPU=y |
160 | CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y | ||
152 | CONFIG_KEXEC=y | 161 | CONFIG_KEXEC=y |
153 | # CONFIG_CRASH_DUMP is not set | 162 | # CONFIG_CRASH_DUMP is not set |
154 | CONFIG_IRQ_ALL_CPUS=y | 163 | CONFIG_IRQ_ALL_CPUS=y |
@@ -173,6 +182,7 @@ CONFIG_SPARSEMEM_EXTREME=y | |||
173 | # CONFIG_MEMORY_HOTPLUG is not set | 182 | # CONFIG_MEMORY_HOTPLUG is not set |
174 | CONFIG_SPLIT_PTLOCK_CPUS=4 | 183 | CONFIG_SPLIT_PTLOCK_CPUS=4 |
175 | CONFIG_MIGRATION=y | 184 | CONFIG_MIGRATION=y |
185 | CONFIG_RESOURCES_64BIT=y | ||
176 | CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y | 186 | CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y |
177 | # CONFIG_PPC_64K_PAGES is not set | 187 | # CONFIG_PPC_64K_PAGES is not set |
178 | CONFIG_SCHED_SMT=y | 188 | CONFIG_SCHED_SMT=y |
@@ -190,6 +200,7 @@ CONFIG_PPC_I8259=y | |||
190 | # CONFIG_PPC_INDIRECT_PCI is not set | 200 | # CONFIG_PPC_INDIRECT_PCI is not set |
191 | CONFIG_PCI=y | 201 | CONFIG_PCI=y |
192 | CONFIG_PCI_DOMAINS=y | 202 | CONFIG_PCI_DOMAINS=y |
203 | # CONFIG_PCIEPORTBUS is not set | ||
193 | # CONFIG_PCI_DEBUG is not set | 204 | # CONFIG_PCI_DEBUG is not set |
194 | 205 | ||
195 | # | 206 | # |
@@ -238,6 +249,8 @@ CONFIG_INET_ESP=m | |||
238 | CONFIG_INET_IPCOMP=m | 249 | CONFIG_INET_IPCOMP=m |
239 | CONFIG_INET_XFRM_TUNNEL=m | 250 | CONFIG_INET_XFRM_TUNNEL=m |
240 | CONFIG_INET_TUNNEL=y | 251 | CONFIG_INET_TUNNEL=y |
252 | CONFIG_INET_XFRM_MODE_TRANSPORT=y | ||
253 | CONFIG_INET_XFRM_MODE_TUNNEL=y | ||
241 | CONFIG_INET_DIAG=y | 254 | CONFIG_INET_DIAG=y |
242 | CONFIG_INET_TCP_DIAG=y | 255 | CONFIG_INET_TCP_DIAG=y |
243 | # CONFIG_TCP_CONG_ADVANCED is not set | 256 | # CONFIG_TCP_CONG_ADVANCED is not set |
@@ -250,6 +263,7 @@ CONFIG_TCP_CONG_BIC=y | |||
250 | # CONFIG_IPV6 is not set | 263 | # CONFIG_IPV6 is not set |
251 | # CONFIG_INET6_XFRM_TUNNEL is not set | 264 | # CONFIG_INET6_XFRM_TUNNEL is not set |
252 | # CONFIG_INET6_TUNNEL is not set | 265 | # CONFIG_INET6_TUNNEL is not set |
266 | # CONFIG_NETWORK_SECMARK is not set | ||
253 | CONFIG_NETFILTER=y | 267 | CONFIG_NETFILTER=y |
254 | # CONFIG_NETFILTER_DEBUG is not set | 268 | # CONFIG_NETFILTER_DEBUG is not set |
255 | 269 | ||
@@ -277,6 +291,7 @@ CONFIG_IP_NF_TFTP=m | |||
277 | CONFIG_IP_NF_AMANDA=m | 291 | CONFIG_IP_NF_AMANDA=m |
278 | # CONFIG_IP_NF_PPTP is not set | 292 | # CONFIG_IP_NF_PPTP is not set |
279 | # CONFIG_IP_NF_H323 is not set | 293 | # CONFIG_IP_NF_H323 is not set |
294 | # CONFIG_IP_NF_SIP is not set | ||
280 | CONFIG_IP_NF_QUEUE=m | 295 | CONFIG_IP_NF_QUEUE=m |
281 | 296 | ||
282 | # | 297 | # |
@@ -316,6 +331,7 @@ CONFIG_LLC=y | |||
316 | # Network testing | 331 | # Network testing |
317 | # | 332 | # |
318 | # CONFIG_NET_PKTGEN is not set | 333 | # CONFIG_NET_PKTGEN is not set |
334 | # CONFIG_NET_TCPPROBE is not set | ||
319 | # CONFIG_HAMRADIO is not set | 335 | # CONFIG_HAMRADIO is not set |
320 | # CONFIG_IRDA is not set | 336 | # CONFIG_IRDA is not set |
321 | # CONFIG_BT is not set | 337 | # CONFIG_BT is not set |
@@ -332,6 +348,7 @@ CONFIG_STANDALONE=y | |||
332 | CONFIG_PREVENT_FIRMWARE_BUILD=y | 348 | CONFIG_PREVENT_FIRMWARE_BUILD=y |
333 | CONFIG_FW_LOADER=y | 349 | CONFIG_FW_LOADER=y |
334 | # CONFIG_DEBUG_DRIVER is not set | 350 | # CONFIG_DEBUG_DRIVER is not set |
351 | # CONFIG_SYS_HYPERVISOR is not set | ||
335 | 352 | ||
336 | # | 353 | # |
337 | # Connector - unified userspace <-> kernelspace linker | 354 | # Connector - unified userspace <-> kernelspace linker |
@@ -352,6 +369,7 @@ CONFIG_PARPORT_PC=m | |||
352 | # CONFIG_PARPORT_PC_FIFO is not set | 369 | # CONFIG_PARPORT_PC_FIFO is not set |
353 | # CONFIG_PARPORT_PC_SUPERIO is not set | 370 | # CONFIG_PARPORT_PC_SUPERIO is not set |
354 | # CONFIG_PARPORT_GSC is not set | 371 | # CONFIG_PARPORT_GSC is not set |
372 | # CONFIG_PARPORT_AX88796 is not set | ||
355 | # CONFIG_PARPORT_1284 is not set | 373 | # CONFIG_PARPORT_1284 is not set |
356 | 374 | ||
357 | # | 375 | # |
@@ -376,6 +394,7 @@ CONFIG_BLK_DEV_NBD=m | |||
376 | CONFIG_BLK_DEV_RAM=y | 394 | CONFIG_BLK_DEV_RAM=y |
377 | CONFIG_BLK_DEV_RAM_COUNT=16 | 395 | CONFIG_BLK_DEV_RAM_COUNT=16 |
378 | CONFIG_BLK_DEV_RAM_SIZE=65536 | 396 | CONFIG_BLK_DEV_RAM_SIZE=65536 |
397 | CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 | ||
379 | CONFIG_BLK_DEV_INITRD=y | 398 | CONFIG_BLK_DEV_INITRD=y |
380 | # CONFIG_CDROM_PKTCDVD is not set | 399 | # CONFIG_CDROM_PKTCDVD is not set |
381 | # CONFIG_ATA_OVER_ETH is not set | 400 | # CONFIG_ATA_OVER_ETH is not set |
@@ -487,6 +506,7 @@ CONFIG_SCSI_SAS_ATTRS=m | |||
487 | # CONFIG_MEGARAID_LEGACY is not set | 506 | # CONFIG_MEGARAID_LEGACY is not set |
488 | # CONFIG_MEGARAID_SAS is not set | 507 | # CONFIG_MEGARAID_SAS is not set |
489 | # CONFIG_SCSI_SATA is not set | 508 | # CONFIG_SCSI_SATA is not set |
509 | # CONFIG_SCSI_HPTIOP is not set | ||
490 | # CONFIG_SCSI_BUSLOGIC is not set | 510 | # CONFIG_SCSI_BUSLOGIC is not set |
491 | # CONFIG_SCSI_DMX3191D is not set | 511 | # CONFIG_SCSI_DMX3191D is not set |
492 | # CONFIG_SCSI_EATA is not set | 512 | # CONFIG_SCSI_EATA is not set |
@@ -508,12 +528,6 @@ CONFIG_SCSI_IPR_TRACE=y | |||
508 | CONFIG_SCSI_IPR_DUMP=y | 528 | CONFIG_SCSI_IPR_DUMP=y |
509 | # CONFIG_SCSI_QLOGIC_1280 is not set | 529 | # CONFIG_SCSI_QLOGIC_1280 is not set |
510 | CONFIG_SCSI_QLA_FC=m | 530 | CONFIG_SCSI_QLA_FC=m |
511 | CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE=y | ||
512 | CONFIG_SCSI_QLA21XX=m | ||
513 | CONFIG_SCSI_QLA22XX=m | ||
514 | CONFIG_SCSI_QLA2300=m | ||
515 | CONFIG_SCSI_QLA2322=m | ||
516 | CONFIG_SCSI_QLA24XX=m | ||
517 | CONFIG_SCSI_LPFC=m | 531 | CONFIG_SCSI_LPFC=m |
518 | # CONFIG_SCSI_DC395x is not set | 532 | # CONFIG_SCSI_DC395x is not set |
519 | # CONFIG_SCSI_DC390T is not set | 533 | # CONFIG_SCSI_DC390T is not set |
@@ -528,9 +542,7 @@ CONFIG_MD_LINEAR=y | |||
528 | CONFIG_MD_RAID0=y | 542 | CONFIG_MD_RAID0=y |
529 | CONFIG_MD_RAID1=y | 543 | CONFIG_MD_RAID1=y |
530 | CONFIG_MD_RAID10=m | 544 | CONFIG_MD_RAID10=m |
531 | CONFIG_MD_RAID5=y | 545 | # CONFIG_MD_RAID456 is not set |
532 | CONFIG_MD_RAID5_RESHAPE=y | ||
533 | CONFIG_MD_RAID6=m | ||
534 | CONFIG_MD_MULTIPATH=m | 546 | CONFIG_MD_MULTIPATH=m |
535 | CONFIG_MD_FAULTY=m | 547 | CONFIG_MD_FAULTY=m |
536 | CONFIG_BLK_DEV_DM=y | 548 | CONFIG_BLK_DEV_DM=y |
@@ -651,6 +663,7 @@ CONFIG_IXGB=m | |||
651 | # CONFIG_IXGB_NAPI is not set | 663 | # CONFIG_IXGB_NAPI is not set |
652 | CONFIG_S2IO=m | 664 | CONFIG_S2IO=m |
653 | # CONFIG_S2IO_NAPI is not set | 665 | # CONFIG_S2IO_NAPI is not set |
666 | # CONFIG_MYRI10GE is not set | ||
654 | 667 | ||
655 | # | 668 | # |
656 | # Token Ring devices | 669 | # Token Ring devices |
@@ -754,6 +767,7 @@ CONFIG_SERIO_LIBPS2=y | |||
754 | CONFIG_VT=y | 767 | CONFIG_VT=y |
755 | CONFIG_VT_CONSOLE=y | 768 | CONFIG_VT_CONSOLE=y |
756 | CONFIG_HW_CONSOLE=y | 769 | CONFIG_HW_CONSOLE=y |
770 | # CONFIG_VT_HW_CONSOLE_BINDING is not set | ||
757 | # CONFIG_SERIAL_NONSTANDARD is not set | 771 | # CONFIG_SERIAL_NONSTANDARD is not set |
758 | 772 | ||
759 | # | 773 | # |
@@ -776,6 +790,7 @@ CONFIG_SERIAL_JSM=m | |||
776 | CONFIG_UNIX98_PTYS=y | 790 | CONFIG_UNIX98_PTYS=y |
777 | CONFIG_LEGACY_PTYS=y | 791 | CONFIG_LEGACY_PTYS=y |
778 | CONFIG_LEGACY_PTY_COUNT=256 | 792 | CONFIG_LEGACY_PTY_COUNT=256 |
793 | # CONFIG_BRIQ_PANEL is not set | ||
779 | # CONFIG_PRINTER is not set | 794 | # CONFIG_PRINTER is not set |
780 | # CONFIG_PPDEV is not set | 795 | # CONFIG_PPDEV is not set |
781 | # CONFIG_TIPAR is not set | 796 | # CONFIG_TIPAR is not set |
@@ -793,6 +808,7 @@ CONFIG_HVCS=m | |||
793 | # Watchdog Cards | 808 | # Watchdog Cards |
794 | # | 809 | # |
795 | # CONFIG_WATCHDOG is not set | 810 | # CONFIG_WATCHDOG is not set |
811 | # CONFIG_HW_RANDOM is not set | ||
796 | CONFIG_GEN_RTC=y | 812 | CONFIG_GEN_RTC=y |
797 | # CONFIG_GEN_RTC_X is not set | 813 | # CONFIG_GEN_RTC_X is not set |
798 | # CONFIG_DTLK is not set | 814 | # CONFIG_DTLK is not set |
@@ -839,6 +855,7 @@ CONFIG_I2C_ALGOBIT=y | |||
839 | # CONFIG_I2C_I810 is not set | 855 | # CONFIG_I2C_I810 is not set |
840 | # CONFIG_I2C_PIIX4 is not set | 856 | # CONFIG_I2C_PIIX4 is not set |
841 | # CONFIG_I2C_NFORCE2 is not set | 857 | # CONFIG_I2C_NFORCE2 is not set |
858 | # CONFIG_I2C_OCORES is not set | ||
842 | # CONFIG_I2C_PARPORT is not set | 859 | # CONFIG_I2C_PARPORT is not set |
843 | # CONFIG_I2C_PARPORT_LIGHT is not set | 860 | # CONFIG_I2C_PARPORT_LIGHT is not set |
844 | # CONFIG_I2C_PROSAVAGE is not set | 861 | # CONFIG_I2C_PROSAVAGE is not set |
@@ -876,7 +893,6 @@ CONFIG_I2C_ALGOBIT=y | |||
876 | # | 893 | # |
877 | # Dallas's 1-wire bus | 894 | # Dallas's 1-wire bus |
878 | # | 895 | # |
879 | # CONFIG_W1 is not set | ||
880 | 896 | ||
881 | # | 897 | # |
882 | # Hardware Monitoring support | 898 | # Hardware Monitoring support |
@@ -892,6 +908,7 @@ CONFIG_I2C_ALGOBIT=y | |||
892 | # Multimedia devices | 908 | # Multimedia devices |
893 | # | 909 | # |
894 | # CONFIG_VIDEO_DEV is not set | 910 | # CONFIG_VIDEO_DEV is not set |
911 | CONFIG_VIDEO_V4L2=y | ||
895 | 912 | ||
896 | # | 913 | # |
897 | # Digital Video Broadcasting Devices | 914 | # Digital Video Broadcasting Devices |
@@ -902,19 +919,19 @@ CONFIG_I2C_ALGOBIT=y | |||
902 | # | 919 | # |
903 | # Graphics support | 920 | # Graphics support |
904 | # | 921 | # |
922 | CONFIG_FIRMWARE_EDID=y | ||
905 | CONFIG_FB=y | 923 | CONFIG_FB=y |
906 | CONFIG_FB_CFB_FILLRECT=y | 924 | CONFIG_FB_CFB_FILLRECT=y |
907 | CONFIG_FB_CFB_COPYAREA=y | 925 | CONFIG_FB_CFB_COPYAREA=y |
908 | CONFIG_FB_CFB_IMAGEBLIT=y | 926 | CONFIG_FB_CFB_IMAGEBLIT=y |
909 | CONFIG_FB_MACMODES=y | 927 | CONFIG_FB_MACMODES=y |
910 | CONFIG_FB_FIRMWARE_EDID=y | 928 | # CONFIG_FB_BACKLIGHT is not set |
911 | CONFIG_FB_MODE_HELPERS=y | 929 | CONFIG_FB_MODE_HELPERS=y |
912 | CONFIG_FB_TILEBLITTING=y | 930 | CONFIG_FB_TILEBLITTING=y |
913 | # CONFIG_FB_CIRRUS is not set | 931 | # CONFIG_FB_CIRRUS is not set |
914 | # CONFIG_FB_PM2 is not set | 932 | # CONFIG_FB_PM2 is not set |
915 | # CONFIG_FB_CYBER2000 is not set | 933 | # CONFIG_FB_CYBER2000 is not set |
916 | CONFIG_FB_OF=y | 934 | CONFIG_FB_OF=y |
917 | # CONFIG_FB_CT65550 is not set | ||
918 | # CONFIG_FB_ASILIANT is not set | 935 | # CONFIG_FB_ASILIANT is not set |
919 | # CONFIG_FB_IMSTT is not set | 936 | # CONFIG_FB_IMSTT is not set |
920 | # CONFIG_FB_VGA16 is not set | 937 | # CONFIG_FB_VGA16 is not set |
@@ -993,6 +1010,7 @@ CONFIG_USB_DEVICEFS=y | |||
993 | CONFIG_USB_EHCI_HCD=y | 1010 | CONFIG_USB_EHCI_HCD=y |
994 | # CONFIG_USB_EHCI_SPLIT_ISO is not set | 1011 | # CONFIG_USB_EHCI_SPLIT_ISO is not set |
995 | # CONFIG_USB_EHCI_ROOT_HUB_TT is not set | 1012 | # CONFIG_USB_EHCI_ROOT_HUB_TT is not set |
1013 | # CONFIG_USB_EHCI_TT_NEWSCHED is not set | ||
996 | # CONFIG_USB_ISP116X_HCD is not set | 1014 | # CONFIG_USB_ISP116X_HCD is not set |
997 | CONFIG_USB_OHCI_HCD=y | 1015 | CONFIG_USB_OHCI_HCD=y |
998 | # CONFIG_USB_OHCI_BIG_ENDIAN is not set | 1016 | # CONFIG_USB_OHCI_BIG_ENDIAN is not set |
@@ -1083,10 +1101,12 @@ CONFIG_USB_MON=y | |||
1083 | # CONFIG_USB_LEGOTOWER is not set | 1101 | # CONFIG_USB_LEGOTOWER is not set |
1084 | # CONFIG_USB_LCD is not set | 1102 | # CONFIG_USB_LCD is not set |
1085 | # CONFIG_USB_LED is not set | 1103 | # CONFIG_USB_LED is not set |
1104 | # CONFIG_USB_CYPRESS_CY7C63 is not set | ||
1086 | # CONFIG_USB_CYTHERM is not set | 1105 | # CONFIG_USB_CYTHERM is not set |
1087 | # CONFIG_USB_PHIDGETKIT is not set | 1106 | # CONFIG_USB_PHIDGETKIT is not set |
1088 | # CONFIG_USB_PHIDGETSERVO is not set | 1107 | # CONFIG_USB_PHIDGETSERVO is not set |
1089 | # CONFIG_USB_IDMOUSE is not set | 1108 | # CONFIG_USB_IDMOUSE is not set |
1109 | # CONFIG_USB_APPLEDISPLAY is not set | ||
1090 | # CONFIG_USB_SISUSBVGA is not set | 1110 | # CONFIG_USB_SISUSBVGA is not set |
1091 | # CONFIG_USB_LD is not set | 1111 | # CONFIG_USB_LD is not set |
1092 | # CONFIG_USB_TEST is not set | 1112 | # CONFIG_USB_TEST is not set |
@@ -1124,12 +1144,14 @@ CONFIG_USB_MON=y | |||
1124 | CONFIG_INFINIBAND=m | 1144 | CONFIG_INFINIBAND=m |
1125 | CONFIG_INFINIBAND_USER_MAD=m | 1145 | CONFIG_INFINIBAND_USER_MAD=m |
1126 | CONFIG_INFINIBAND_USER_ACCESS=m | 1146 | CONFIG_INFINIBAND_USER_ACCESS=m |
1147 | CONFIG_INFINIBAND_ADDR_TRANS=y | ||
1127 | CONFIG_INFINIBAND_MTHCA=m | 1148 | CONFIG_INFINIBAND_MTHCA=m |
1128 | CONFIG_INFINIBAND_MTHCA_DEBUG=y | 1149 | CONFIG_INFINIBAND_MTHCA_DEBUG=y |
1129 | CONFIG_INFINIBAND_IPOIB=m | 1150 | CONFIG_INFINIBAND_IPOIB=m |
1130 | CONFIG_INFINIBAND_IPOIB_DEBUG=y | 1151 | CONFIG_INFINIBAND_IPOIB_DEBUG=y |
1131 | # CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set | 1152 | # CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set |
1132 | CONFIG_INFINIBAND_SRP=m | 1153 | CONFIG_INFINIBAND_SRP=m |
1154 | # CONFIG_INFINIBAND_ISER is not set | ||
1133 | 1155 | ||
1134 | # | 1156 | # |
1135 | # EDAC - error detection and reporting (RAS) (EXPERIMENTAL) | 1157 | # EDAC - error detection and reporting (RAS) (EXPERIMENTAL) |
@@ -1141,6 +1163,19 @@ CONFIG_INFINIBAND_SRP=m | |||
1141 | # CONFIG_RTC_CLASS is not set | 1163 | # CONFIG_RTC_CLASS is not set |
1142 | 1164 | ||
1143 | # | 1165 | # |
1166 | # DMA Engine support | ||
1167 | # | ||
1168 | # CONFIG_DMA_ENGINE is not set | ||
1169 | |||
1170 | # | ||
1171 | # DMA Clients | ||
1172 | # | ||
1173 | |||
1174 | # | ||
1175 | # DMA Devices | ||
1176 | # | ||
1177 | |||
1178 | # | ||
1144 | # File systems | 1179 | # File systems |
1145 | # | 1180 | # |
1146 | CONFIG_EXT2_FS=y | 1181 | CONFIG_EXT2_FS=y |
@@ -1169,15 +1204,16 @@ CONFIG_JFS_SECURITY=y | |||
1169 | # CONFIG_JFS_STATISTICS is not set | 1204 | # CONFIG_JFS_STATISTICS is not set |
1170 | CONFIG_FS_POSIX_ACL=y | 1205 | CONFIG_FS_POSIX_ACL=y |
1171 | CONFIG_XFS_FS=m | 1206 | CONFIG_XFS_FS=m |
1172 | CONFIG_XFS_EXPORT=y | ||
1173 | # CONFIG_XFS_QUOTA is not set | 1207 | # CONFIG_XFS_QUOTA is not set |
1174 | CONFIG_XFS_SECURITY=y | 1208 | CONFIG_XFS_SECURITY=y |
1175 | CONFIG_XFS_POSIX_ACL=y | 1209 | CONFIG_XFS_POSIX_ACL=y |
1176 | # CONFIG_XFS_RT is not set | 1210 | # CONFIG_XFS_RT is not set |
1177 | CONFIG_OCFS2_FS=m | 1211 | CONFIG_OCFS2_FS=m |
1212 | CONFIG_OCFS2_DEBUG_MASKLOG=y | ||
1178 | # CONFIG_MINIX_FS is not set | 1213 | # CONFIG_MINIX_FS is not set |
1179 | # CONFIG_ROMFS_FS is not set | 1214 | # CONFIG_ROMFS_FS is not set |
1180 | CONFIG_INOTIFY=y | 1215 | CONFIG_INOTIFY=y |
1216 | CONFIG_INOTIFY_USER=y | ||
1181 | # CONFIG_QUOTA is not set | 1217 | # CONFIG_QUOTA is not set |
1182 | CONFIG_DNOTIFY=y | 1218 | CONFIG_DNOTIFY=y |
1183 | # CONFIG_AUTOFS_FS is not set | 1219 | # CONFIG_AUTOFS_FS is not set |
@@ -1259,8 +1295,10 @@ CONFIG_RPCSEC_GSS_SPKM3=m | |||
1259 | # CONFIG_SMB_FS is not set | 1295 | # CONFIG_SMB_FS is not set |
1260 | CONFIG_CIFS=m | 1296 | CONFIG_CIFS=m |
1261 | # CONFIG_CIFS_STATS is not set | 1297 | # CONFIG_CIFS_STATS is not set |
1298 | # CONFIG_CIFS_WEAK_PW_HASH is not set | ||
1262 | CONFIG_CIFS_XATTR=y | 1299 | CONFIG_CIFS_XATTR=y |
1263 | CONFIG_CIFS_POSIX=y | 1300 | CONFIG_CIFS_POSIX=y |
1301 | # CONFIG_CIFS_DEBUG2 is not set | ||
1264 | # CONFIG_CIFS_EXPERIMENTAL is not set | 1302 | # CONFIG_CIFS_EXPERIMENTAL is not set |
1265 | # CONFIG_NCP_FS is not set | 1303 | # CONFIG_NCP_FS is not set |
1266 | # CONFIG_CODA_FS is not set | 1304 | # CONFIG_CODA_FS is not set |
@@ -1326,6 +1364,9 @@ CONFIG_CRC32=y | |||
1326 | CONFIG_LIBCRC32C=m | 1364 | CONFIG_LIBCRC32C=m |
1327 | CONFIG_ZLIB_INFLATE=y | 1365 | CONFIG_ZLIB_INFLATE=y |
1328 | CONFIG_ZLIB_DEFLATE=m | 1366 | CONFIG_ZLIB_DEFLATE=m |
1367 | CONFIG_TEXTSEARCH=y | ||
1368 | CONFIG_TEXTSEARCH_KMP=m | ||
1369 | CONFIG_PLIST=y | ||
1329 | 1370 | ||
1330 | # | 1371 | # |
1331 | # Instrumentation Support | 1372 | # Instrumentation Support |
@@ -1339,14 +1380,19 @@ CONFIG_KPROBES=y | |||
1339 | # | 1380 | # |
1340 | # CONFIG_PRINTK_TIME is not set | 1381 | # CONFIG_PRINTK_TIME is not set |
1341 | CONFIG_MAGIC_SYSRQ=y | 1382 | CONFIG_MAGIC_SYSRQ=y |
1383 | # CONFIG_UNUSED_SYMBOLS is not set | ||
1342 | CONFIG_DEBUG_KERNEL=y | 1384 | CONFIG_DEBUG_KERNEL=y |
1343 | CONFIG_LOG_BUF_SHIFT=17 | 1385 | CONFIG_LOG_BUF_SHIFT=17 |
1344 | CONFIG_DETECT_SOFTLOCKUP=y | 1386 | CONFIG_DETECT_SOFTLOCKUP=y |
1345 | # CONFIG_SCHEDSTATS is not set | 1387 | # CONFIG_SCHEDSTATS is not set |
1346 | # CONFIG_DEBUG_SLAB is not set | 1388 | # CONFIG_DEBUG_SLAB is not set |
1347 | # CONFIG_DEBUG_MUTEXES is not set | 1389 | # CONFIG_DEBUG_RT_MUTEXES is not set |
1390 | # CONFIG_RT_MUTEX_TESTER is not set | ||
1348 | # CONFIG_DEBUG_SPINLOCK is not set | 1391 | # CONFIG_DEBUG_SPINLOCK is not set |
1392 | # CONFIG_DEBUG_MUTEXES is not set | ||
1393 | # CONFIG_DEBUG_RWSEMS is not set | ||
1349 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | 1394 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set |
1395 | # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set | ||
1350 | # CONFIG_DEBUG_KOBJECT is not set | 1396 | # CONFIG_DEBUG_KOBJECT is not set |
1351 | # CONFIG_DEBUG_INFO is not set | 1397 | # CONFIG_DEBUG_INFO is not set |
1352 | CONFIG_DEBUG_FS=y | 1398 | CONFIG_DEBUG_FS=y |
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 814f242aeb8c..956c2e5564b7 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -67,9 +67,9 @@ pci64-$(CONFIG_PPC64) += pci_64.o pci_dn.o pci_iommu.o \ | |||
67 | pci_direct_iommu.o iomap.o | 67 | pci_direct_iommu.o iomap.o |
68 | pci32-$(CONFIG_PPC32) := pci_32.o | 68 | pci32-$(CONFIG_PPC32) := pci_32.o |
69 | obj-$(CONFIG_PCI) += $(pci64-y) $(pci32-y) | 69 | obj-$(CONFIG_PCI) += $(pci64-y) $(pci32-y) |
70 | kexec-$(CONFIG_PPC64) := machine_kexec_64.o crash.o | 70 | kexec-$(CONFIG_PPC64) := machine_kexec_64.o |
71 | kexec-$(CONFIG_PPC32) := machine_kexec_32.o | 71 | kexec-$(CONFIG_PPC32) := machine_kexec_32.o |
72 | obj-$(CONFIG_KEXEC) += machine_kexec.o $(kexec-y) | 72 | obj-$(CONFIG_KEXEC) += machine_kexec.o crash.o $(kexec-y) |
73 | 73 | ||
74 | ifeq ($(CONFIG_PPC_ISERIES),y) | 74 | ifeq ($(CONFIG_PPC_ISERIES),y) |
75 | $(obj)/head_64.o: $(obj)/lparmap.s | 75 | $(obj)/head_64.o: $(obj)/lparmap.s |
diff --git a/arch/powerpc/kernel/cpu_setup_power4.S b/arch/powerpc/kernel/cpu_setup_power4.S index f69af2c5d7b3..76e97aa71c45 100644 --- a/arch/powerpc/kernel/cpu_setup_power4.S +++ b/arch/powerpc/kernel/cpu_setup_power4.S | |||
@@ -76,6 +76,8 @@ _GLOBAL(__setup_cpu_ppc970) | |||
76 | mfspr r0,SPRN_HID0 | 76 | mfspr r0,SPRN_HID0 |
77 | li r11,5 /* clear DOZE and SLEEP */ | 77 | li r11,5 /* clear DOZE and SLEEP */ |
78 | rldimi r0,r11,52,8 /* set NAP and DPM */ | 78 | rldimi r0,r11,52,8 /* set NAP and DPM */ |
79 | li r11,0 | ||
80 | rldimi r0,r11,32,31 /* clear EN_ATTN */ | ||
79 | mtspr SPRN_HID0,r0 | 81 | mtspr SPRN_HID0,r0 |
80 | mfspr r0,SPRN_HID0 | 82 | mfspr r0,SPRN_HID0 |
81 | mfspr r0,SPRN_HID0 | 83 | mfspr r0,SPRN_HID0 |
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c index 358cecdc6aef..f04c18e08b8b 100644 --- a/arch/powerpc/kernel/crash.c +++ b/arch/powerpc/kernel/crash.c | |||
@@ -44,6 +44,7 @@ | |||
44 | /* This keeps a track of which one is crashing cpu. */ | 44 | /* This keeps a track of which one is crashing cpu. */ |
45 | int crashing_cpu = -1; | 45 | int crashing_cpu = -1; |
46 | static cpumask_t cpus_in_crash = CPU_MASK_NONE; | 46 | static cpumask_t cpus_in_crash = CPU_MASK_NONE; |
47 | cpumask_t cpus_in_sr = CPU_MASK_NONE; | ||
47 | 48 | ||
48 | static u32 *append_elf_note(u32 *buf, char *name, unsigned type, void *data, | 49 | static u32 *append_elf_note(u32 *buf, char *name, unsigned type, void *data, |
49 | size_t data_len) | 50 | size_t data_len) |
@@ -139,7 +140,13 @@ void crash_ipi_callback(struct pt_regs *regs) | |||
139 | 140 | ||
140 | if (ppc_md.kexec_cpu_down) | 141 | if (ppc_md.kexec_cpu_down) |
141 | ppc_md.kexec_cpu_down(1, 1); | 142 | ppc_md.kexec_cpu_down(1, 1); |
143 | |||
144 | #ifdef CONFIG_PPC64 | ||
142 | kexec_smp_wait(); | 145 | kexec_smp_wait(); |
146 | #else | ||
147 | for (;;); /* FIXME */ | ||
148 | #endif | ||
149 | |||
143 | /* NOTREACHED */ | 150 | /* NOTREACHED */ |
144 | } | 151 | } |
145 | 152 | ||
@@ -255,7 +262,11 @@ static void crash_kexec_prepare_cpus(int cpu) | |||
255 | * | 262 | * |
256 | * do this if kexec in setup.c ? | 263 | * do this if kexec in setup.c ? |
257 | */ | 264 | */ |
265 | #ifdef CONFIG_PPC64 | ||
258 | smp_release_cpus(); | 266 | smp_release_cpus(); |
267 | #else | ||
268 | /* FIXME */ | ||
269 | #endif | ||
259 | } | 270 | } |
260 | 271 | ||
261 | void crash_kexec_secondary(struct pt_regs *regs) | 272 | void crash_kexec_secondary(struct pt_regs *regs) |
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 01bdae35cb55..7ee685433319 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -693,7 +693,7 @@ unsigned int irq_radix_revmap(struct irq_host *host, | |||
693 | /* If not there, try to insert it */ | 693 | /* If not there, try to insert it */ |
694 | virq = irq_find_mapping(host, hwirq); | 694 | virq = irq_find_mapping(host, hwirq); |
695 | if (virq != NO_IRQ) | 695 | if (virq != NO_IRQ) |
696 | radix_tree_insert(tree, virq, &irq_map[virq]); | 696 | radix_tree_insert(tree, hwirq, &irq_map[virq]); |
697 | bail: | 697 | bail: |
698 | spin_unlock_irqrestore(&irq_big_lock, flags); | 698 | spin_unlock_irqrestore(&irq_big_lock, flags); |
699 | return virq; | 699 | return virq; |
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 9f0898c89759..cd65c367b8b6 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c | |||
@@ -61,6 +61,8 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) | |||
61 | if (!ret) { | 61 | if (!ret) { |
62 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); | 62 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); |
63 | p->opcode = *p->addr; | 63 | p->opcode = *p->addr; |
64 | flush_icache_range((unsigned long)p->ainsn.insn, | ||
65 | (unsigned long)p->ainsn.insn + sizeof(kprobe_opcode_t)); | ||
64 | } | 66 | } |
65 | 67 | ||
66 | return ret; | 68 | return ret; |
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c index a81ca1b841ec..e60a0c544d63 100644 --- a/arch/powerpc/kernel/machine_kexec.c +++ b/arch/powerpc/kernel/machine_kexec.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/reboot.h> | 13 | #include <linux/reboot.h> |
14 | #include <linux/threads.h> | 14 | #include <linux/threads.h> |
15 | #include <asm/machdep.h> | 15 | #include <asm/machdep.h> |
16 | #include <asm/lmb.h> | ||
16 | 17 | ||
17 | void machine_crash_shutdown(struct pt_regs *regs) | 18 | void machine_crash_shutdown(struct pt_regs *regs) |
18 | { | 19 | { |
@@ -59,3 +60,58 @@ NORET_TYPE void machine_kexec(struct kimage *image) | |||
59 | } | 60 | } |
60 | for(;;); | 61 | for(;;); |
61 | } | 62 | } |
63 | |||
64 | static int __init early_parse_crashk(char *p) | ||
65 | { | ||
66 | unsigned long size; | ||
67 | |||
68 | if (!p) | ||
69 | return 1; | ||
70 | |||
71 | size = memparse(p, &p); | ||
72 | |||
73 | if (*p == '@') | ||
74 | crashk_res.start = memparse(p + 1, &p); | ||
75 | else | ||
76 | crashk_res.start = KDUMP_KERNELBASE; | ||
77 | |||
78 | crashk_res.end = crashk_res.start + size - 1; | ||
79 | |||
80 | return 0; | ||
81 | } | ||
82 | early_param("crashkernel", early_parse_crashk); | ||
83 | |||
84 | void __init reserve_crashkernel(void) | ||
85 | { | ||
86 | unsigned long size; | ||
87 | |||
88 | if (crashk_res.start == 0) | ||
89 | return; | ||
90 | |||
91 | /* We might have got these values via the command line or the | ||
92 | * device tree, either way sanitise them now. */ | ||
93 | |||
94 | size = crashk_res.end - crashk_res.start + 1; | ||
95 | |||
96 | if (crashk_res.start != KDUMP_KERNELBASE) | ||
97 | printk("Crash kernel location must be 0x%x\n", | ||
98 | KDUMP_KERNELBASE); | ||
99 | |||
100 | crashk_res.start = KDUMP_KERNELBASE; | ||
101 | size = PAGE_ALIGN(size); | ||
102 | crashk_res.end = crashk_res.start + size - 1; | ||
103 | |||
104 | /* Crash kernel trumps memory limit */ | ||
105 | if (memory_limit && memory_limit <= crashk_res.end) { | ||
106 | memory_limit = crashk_res.end + 1; | ||
107 | printk("Adjusted memory limit for crashkernel, now 0x%lx\n", | ||
108 | memory_limit); | ||
109 | } | ||
110 | |||
111 | lmb_reserve(crashk_res.start, size); | ||
112 | } | ||
113 | |||
114 | int overlaps_crashkernel(unsigned long start, unsigned long size) | ||
115 | { | ||
116 | return (start + size) > crashk_res.start && start <= crashk_res.end; | ||
117 | } | ||
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c index b438d45a068c..be58985c7681 100644 --- a/arch/powerpc/kernel/machine_kexec_64.c +++ b/arch/powerpc/kernel/machine_kexec_64.c | |||
@@ -10,7 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | 12 | ||
13 | #include <linux/cpumask.h> | ||
14 | #include <linux/kexec.h> | 13 | #include <linux/kexec.h> |
15 | #include <linux/smp.h> | 14 | #include <linux/smp.h> |
16 | #include <linux/thread_info.h> | 15 | #include <linux/thread_info.h> |
@@ -21,7 +20,6 @@ | |||
21 | #include <asm/machdep.h> | 20 | #include <asm/machdep.h> |
22 | #include <asm/cacheflush.h> | 21 | #include <asm/cacheflush.h> |
23 | #include <asm/paca.h> | 22 | #include <asm/paca.h> |
24 | #include <asm/lmb.h> | ||
25 | #include <asm/mmu.h> | 23 | #include <asm/mmu.h> |
26 | #include <asm/sections.h> /* _end */ | 24 | #include <asm/sections.h> /* _end */ |
27 | #include <asm/prom.h> | 25 | #include <asm/prom.h> |
@@ -385,58 +383,3 @@ static int __init kexec_setup(void) | |||
385 | return 0; | 383 | return 0; |
386 | } | 384 | } |
387 | __initcall(kexec_setup); | 385 | __initcall(kexec_setup); |
388 | |||
389 | static int __init early_parse_crashk(char *p) | ||
390 | { | ||
391 | unsigned long size; | ||
392 | |||
393 | if (!p) | ||
394 | return 1; | ||
395 | |||
396 | size = memparse(p, &p); | ||
397 | |||
398 | if (*p == '@') | ||
399 | crashk_res.start = memparse(p + 1, &p); | ||
400 | else | ||
401 | crashk_res.start = KDUMP_KERNELBASE; | ||
402 | |||
403 | crashk_res.end = crashk_res.start + size - 1; | ||
404 | |||
405 | return 0; | ||
406 | } | ||
407 | early_param("crashkernel", early_parse_crashk); | ||
408 | |||
409 | void __init reserve_crashkernel(void) | ||
410 | { | ||
411 | unsigned long size; | ||
412 | |||
413 | if (crashk_res.start == 0) | ||
414 | return; | ||
415 | |||
416 | /* We might have got these values via the command line or the | ||
417 | * device tree, either way sanitise them now. */ | ||
418 | |||
419 | size = crashk_res.end - crashk_res.start + 1; | ||
420 | |||
421 | if (crashk_res.start != KDUMP_KERNELBASE) | ||
422 | printk("Crash kernel location must be 0x%x\n", | ||
423 | KDUMP_KERNELBASE); | ||
424 | |||
425 | crashk_res.start = KDUMP_KERNELBASE; | ||
426 | size = PAGE_ALIGN(size); | ||
427 | crashk_res.end = crashk_res.start + size - 1; | ||
428 | |||
429 | /* Crash kernel trumps memory limit */ | ||
430 | if (memory_limit && memory_limit <= crashk_res.end) { | ||
431 | memory_limit = crashk_res.end + 1; | ||
432 | printk("Adjusted memory limit for crashkernel, now 0x%lx\n", | ||
433 | memory_limit); | ||
434 | } | ||
435 | |||
436 | lmb_reserve(crashk_res.start, size); | ||
437 | } | ||
438 | |||
439 | int overlaps_crashkernel(unsigned long start, unsigned long size) | ||
440 | { | ||
441 | return (start + size) > crashk_res.start && start <= crashk_res.end; | ||
442 | } | ||
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index 4a4cb5598402..77f1e06d208d 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c | |||
@@ -569,6 +569,27 @@ int rtas_set_indicator(int indicator, int index, int new_value) | |||
569 | } | 569 | } |
570 | EXPORT_SYMBOL(rtas_set_indicator); | 570 | EXPORT_SYMBOL(rtas_set_indicator); |
571 | 571 | ||
572 | /* | ||
573 | * Ignoring RTAS extended delay | ||
574 | */ | ||
575 | int rtas_set_indicator_fast(int indicator, int index, int new_value) | ||
576 | { | ||
577 | int rc; | ||
578 | int token = rtas_token("set-indicator"); | ||
579 | |||
580 | if (token == RTAS_UNKNOWN_SERVICE) | ||
581 | return -ENOENT; | ||
582 | |||
583 | rc = rtas_call(token, 3, 1, NULL, indicator, index, new_value); | ||
584 | |||
585 | WARN_ON(rc == -2 || (rc >= 9900 && rc <= 9905)); | ||
586 | |||
587 | if (rc < 0) | ||
588 | return rtas_error_rc(rc); | ||
589 | |||
590 | return rc; | ||
591 | } | ||
592 | |||
572 | void rtas_restart(char *cmd) | 593 | void rtas_restart(char *cmd) |
573 | { | 594 | { |
574 | if (rtas_flash_term_hook) | 595 | if (rtas_flash_term_hook) |
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index 2105767fcc57..e4d1713e8aea 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c | |||
@@ -55,9 +55,6 @@ | |||
55 | 55 | ||
56 | #ifdef CONFIG_PPC64 /* XXX */ | 56 | #ifdef CONFIG_PPC64 /* XXX */ |
57 | #define _IO_BASE pci_io_base | 57 | #define _IO_BASE pci_io_base |
58 | #ifdef CONFIG_KEXEC | ||
59 | cpumask_t cpus_in_sr = CPU_MASK_NONE; | ||
60 | #endif | ||
61 | #endif | 58 | #endif |
62 | 59 | ||
63 | #ifdef CONFIG_DEBUGGER | 60 | #ifdef CONFIG_DEBUGGER |
@@ -151,7 +148,7 @@ int die(const char *str, struct pt_regs *regs, long err) | |||
151 | panic("Fatal exception in interrupt"); | 148 | panic("Fatal exception in interrupt"); |
152 | 149 | ||
153 | if (panic_on_oops) | 150 | if (panic_on_oops) |
154 | panic("Fatal exception: panic_on_oops"); | 151 | panic("Fatal exception"); |
155 | 152 | ||
156 | do_exit(err); | 153 | do_exit(err); |
157 | 154 | ||
@@ -211,6 +208,19 @@ void system_reset_exception(struct pt_regs *regs) | |||
211 | 208 | ||
212 | die("System Reset", regs, SIGABRT); | 209 | die("System Reset", regs, SIGABRT); |
213 | 210 | ||
211 | /* | ||
212 | * Some CPUs when released from the debugger will execute this path. | ||
213 | * These CPUs entered the debugger via a soft-reset. If the CPU was | ||
214 | * hung before entering the debugger it will return to the hung | ||
215 | * state when exiting this function. This causes a problem in | ||
216 | * kdump since the hung CPU(s) will not respond to the IPI sent | ||
217 | * from kdump. To prevent the problem we call crash_kexec_secondary() | ||
218 | * here. If a kdump had not been initiated or we exit the debugger | ||
219 | * with the "exit and recover" command (x) crash_kexec_secondary() | ||
220 | * will return after 5ms and the CPU returns to its previous state. | ||
221 | */ | ||
222 | crash_kexec_secondary(regs); | ||
223 | |||
214 | /* Must die if the interrupt is not recoverable */ | 224 | /* Must die if the interrupt is not recoverable */ |
215 | if (!(regs->msr & MSR_RI)) | 225 | if (!(regs->msr & MSR_RI)) |
216 | panic("Unrecoverable System Reset"); | 226 | panic("Unrecoverable System Reset"); |
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 71c634e0b87c..31867a701fcb 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -213,8 +213,6 @@ static void pseries_lpar_enable_pmcs(void) | |||
213 | { | 213 | { |
214 | unsigned long set, reset; | 214 | unsigned long set, reset; |
215 | 215 | ||
216 | power4_enable_pmcs(); | ||
217 | |||
218 | set = 1UL << 63; | 216 | set = 1UL << 63; |
219 | reset = 0; | 217 | reset = 0; |
220 | plpar_hcall_norets(H_PERFMON, set, reset); | 218 | plpar_hcall_norets(H_PERFMON, set, reset); |
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c index 2d0da6f9e244..e98863025721 100644 --- a/arch/powerpc/platforms/pseries/xics.c +++ b/arch/powerpc/platforms/pseries/xics.c | |||
@@ -467,7 +467,7 @@ void xics_setup_cpu(void) | |||
467 | * | 467 | * |
468 | * XXX: undo of teardown on kexec needs this too, as may hotplug | 468 | * XXX: undo of teardown on kexec needs this too, as may hotplug |
469 | */ | 469 | */ |
470 | rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE, | 470 | rtas_set_indicator_fast(GLOBAL_INTERRUPT_QUEUE, |
471 | (1UL << interrupt_server_size) - 1 - default_distrib_server, 1); | 471 | (1UL << interrupt_server_size) - 1 - default_distrib_server, 1); |
472 | } | 472 | } |
473 | 473 | ||
@@ -796,7 +796,7 @@ void xics_teardown_cpu(int secondary) | |||
796 | * so leave the master cpu in the group. | 796 | * so leave the master cpu in the group. |
797 | */ | 797 | */ |
798 | if (secondary) | 798 | if (secondary) |
799 | rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE, | 799 | rtas_set_indicator_fast(GLOBAL_INTERRUPT_QUEUE, |
800 | (1UL << interrupt_server_size) - 1 - | 800 | (1UL << interrupt_server_size) - 1 - |
801 | default_distrib_server, 0); | 801 | default_distrib_server, 0); |
802 | } | 802 | } |
@@ -813,7 +813,7 @@ void xics_migrate_irqs_away(void) | |||
813 | xics_set_cpu_priority(cpu, 0); | 813 | xics_set_cpu_priority(cpu, 0); |
814 | 814 | ||
815 | /* remove ourselves from the global interrupt queue */ | 815 | /* remove ourselves from the global interrupt queue */ |
816 | status = rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE, | 816 | status = rtas_set_indicator_fast(GLOBAL_INTERRUPT_QUEUE, |
817 | (1UL << interrupt_server_size) - 1 - default_distrib_server, 0); | 817 | (1UL << interrupt_server_size) - 1 - default_distrib_server, 0); |
818 | WARN_ON(status < 0); | 818 | WARN_ON(status < 0); |
819 | 819 | ||
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index e983972132d8..12b65609c072 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c | |||
@@ -169,8 +169,16 @@ static int __init gfar_of_init(void) | |||
169 | goto err; | 169 | goto err; |
170 | } | 170 | } |
171 | 171 | ||
172 | mac_addr = get_property(np, "address", NULL); | 172 | mac_addr = get_property(np, "local-mac-address", NULL); |
173 | memcpy(gfar_data.mac_addr, mac_addr, 6); | 173 | if (mac_addr == NULL) |
174 | mac_addr = get_property(np, "mac-address", NULL); | ||
175 | if (mac_addr == NULL) { | ||
176 | /* Obsolete */ | ||
177 | mac_addr = get_property(np, "address", NULL); | ||
178 | } | ||
179 | |||
180 | if (mac_addr) | ||
181 | memcpy(gfar_data.mac_addr, mac_addr, 6); | ||
174 | 182 | ||
175 | if (model && !strcasecmp(model, "TSEC")) | 183 | if (model && !strcasecmp(model, "TSEC")) |
176 | gfar_data.device_flags = | 184 | gfar_data.device_flags = |
diff --git a/arch/ppc/platforms/85xx/mpc8560_ads.c b/arch/ppc/platforms/85xx/mpc8560_ads.c index d90cd24d018e..94badafe4ef1 100644 --- a/arch/ppc/platforms/85xx/mpc8560_ads.c +++ b/arch/ppc/platforms/85xx/mpc8560_ads.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/initrd.h> | 29 | #include <linux/initrd.h> |
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/fsl_devices.h> | 31 | #include <linux/fsl_devices.h> |
32 | #include <linux/fs_enet_pd.h> | ||
32 | 33 | ||
33 | #include <asm/system.h> | 34 | #include <asm/system.h> |
34 | #include <asm/pgtable.h> | 35 | #include <asm/pgtable.h> |
@@ -58,6 +59,71 @@ | |||
58 | * Setup the architecture | 59 | * Setup the architecture |
59 | * | 60 | * |
60 | */ | 61 | */ |
62 | static void init_fcc_ioports(void) | ||
63 | { | ||
64 | struct immap *immap; | ||
65 | struct io_port *io; | ||
66 | u32 tempval; | ||
67 | |||
68 | immap = cpm2_immr; | ||
69 | |||
70 | io = &immap->im_ioport; | ||
71 | /* FCC2/3 are on the ports B/C. */ | ||
72 | tempval = in_be32(&io->iop_pdirb); | ||
73 | tempval &= ~PB2_DIRB0; | ||
74 | tempval |= PB2_DIRB1; | ||
75 | out_be32(&io->iop_pdirb, tempval); | ||
76 | |||
77 | tempval = in_be32(&io->iop_psorb); | ||
78 | tempval &= ~PB2_PSORB0; | ||
79 | tempval |= PB2_PSORB1; | ||
80 | out_be32(&io->iop_psorb, tempval); | ||
81 | |||
82 | tempval = in_be32(&io->iop_pparb); | ||
83 | tempval |= (PB2_DIRB0 | PB2_DIRB1); | ||
84 | out_be32(&io->iop_pparb, tempval); | ||
85 | |||
86 | tempval = in_be32(&io->iop_pdirb); | ||
87 | tempval &= ~PB3_DIRB0; | ||
88 | tempval |= PB3_DIRB1; | ||
89 | out_be32(&io->iop_pdirb, tempval); | ||
90 | |||
91 | tempval = in_be32(&io->iop_psorb); | ||
92 | tempval &= ~PB3_PSORB0; | ||
93 | tempval |= PB3_PSORB1; | ||
94 | out_be32(&io->iop_psorb, tempval); | ||
95 | |||
96 | tempval = in_be32(&io->iop_pparb); | ||
97 | tempval |= (PB3_DIRB0 | PB3_DIRB1); | ||
98 | out_be32(&io->iop_pparb, tempval); | ||
99 | |||
100 | tempval = in_be32(&io->iop_pdirc); | ||
101 | tempval |= PC3_DIRC1; | ||
102 | out_be32(&io->iop_pdirc, tempval); | ||
103 | |||
104 | tempval = in_be32(&io->iop_pparc); | ||
105 | tempval |= PC3_DIRC1; | ||
106 | out_be32(&io->iop_pparc, tempval); | ||
107 | |||
108 | /* Port C has clocks...... */ | ||
109 | tempval = in_be32(&io->iop_psorc); | ||
110 | tempval &= ~(CLK_TRX); | ||
111 | out_be32(&io->iop_psorc, tempval); | ||
112 | |||
113 | tempval = in_be32(&io->iop_pdirc); | ||
114 | tempval &= ~(CLK_TRX); | ||
115 | out_be32(&io->iop_pdirc, tempval); | ||
116 | tempval = in_be32(&io->iop_pparc); | ||
117 | tempval |= (CLK_TRX); | ||
118 | out_be32(&io->iop_pparc, tempval); | ||
119 | |||
120 | /* Configure Serial Interface clock routing. | ||
121 | * First, clear all FCC bits to zero, | ||
122 | * then set the ones we want. | ||
123 | */ | ||
124 | immap->im_cpmux.cmx_fcr &= ~(CPMUX_CLK_MASK); | ||
125 | immap->im_cpmux.cmx_fcr |= CPMUX_CLK_ROUTE; | ||
126 | } | ||
61 | 127 | ||
62 | static void __init | 128 | static void __init |
63 | mpc8560ads_setup_arch(void) | 129 | mpc8560ads_setup_arch(void) |
@@ -66,6 +132,7 @@ mpc8560ads_setup_arch(void) | |||
66 | unsigned int freq; | 132 | unsigned int freq; |
67 | struct gianfar_platform_data *pdata; | 133 | struct gianfar_platform_data *pdata; |
68 | struct gianfar_mdio_data *mdata; | 134 | struct gianfar_mdio_data *mdata; |
135 | struct fs_platform_info *fpi; | ||
69 | 136 | ||
70 | cpm2_reset(); | 137 | cpm2_reset(); |
71 | 138 | ||
@@ -110,6 +177,28 @@ mpc8560ads_setup_arch(void) | |||
110 | memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); | 177 | memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); |
111 | } | 178 | } |
112 | 179 | ||
180 | init_fcc_ioports(); | ||
181 | ppc_sys_device_remove(MPC85xx_CPM_FCC1); | ||
182 | |||
183 | fpi = (struct fs_platform_info *) ppc_sys_get_pdata(MPC85xx_CPM_FCC2); | ||
184 | if (fpi) { | ||
185 | memcpy(fpi->macaddr, binfo->bi_enet2addr, 6); | ||
186 | fpi->bus_id = "0:02"; | ||
187 | fpi->phy_addr = 2; | ||
188 | fpi->dpram_offset = (u32)cpm2_immr->im_dprambase; | ||
189 | fpi->fcc_regs_c = (u32)&cpm2_immr->im_fcc_c[1]; | ||
190 | } | ||
191 | |||
192 | fpi = (struct fs_platform_info *) ppc_sys_get_pdata(MPC85xx_CPM_FCC3); | ||
193 | if (fpi) { | ||
194 | memcpy(fpi->macaddr, binfo->bi_enet2addr, 6); | ||
195 | fpi->macaddr[5] += 1; | ||
196 | fpi->bus_id = "0:03"; | ||
197 | fpi->phy_addr = 3; | ||
198 | fpi->dpram_offset = (u32)cpm2_immr->im_dprambase; | ||
199 | fpi->fcc_regs_c = (u32)&cpm2_immr->im_fcc_c[2]; | ||
200 | } | ||
201 | |||
113 | #ifdef CONFIG_BLK_DEV_INITRD | 202 | #ifdef CONFIG_BLK_DEV_INITRD |
114 | if (initrd_start) | 203 | if (initrd_start) |
115 | ROOT_DEV = Root_RAM0; | 204 | ROOT_DEV = Root_RAM0; |
diff --git a/arch/ppc/platforms/85xx/mpc85xx_ads_common.h b/arch/ppc/platforms/85xx/mpc85xx_ads_common.h index abf32281655d..c8c322fe3680 100644 --- a/arch/ppc/platforms/85xx/mpc85xx_ads_common.h +++ b/arch/ppc/platforms/85xx/mpc85xx_ads_common.h | |||
@@ -45,4 +45,23 @@ extern void mpc85xx_ads_map_io(void) __init; | |||
45 | 45 | ||
46 | #define MPC85XX_PCI1_IO_SIZE 0x01000000 | 46 | #define MPC85XX_PCI1_IO_SIZE 0x01000000 |
47 | 47 | ||
48 | /* FCC1 Clock Source Configuration. These can be | ||
49 | * redefined in the board specific file. | ||
50 | * Can only choose from CLK9-12 */ | ||
51 | #define F1_RXCLK 12 | ||
52 | #define F1_TXCLK 11 | ||
53 | |||
54 | /* FCC2 Clock Source Configuration. These can be | ||
55 | * redefined in the board specific file. | ||
56 | * Can only choose from CLK13-16 */ | ||
57 | #define F2_RXCLK 13 | ||
58 | #define F2_TXCLK 14 | ||
59 | |||
60 | /* FCC3 Clock Source Configuration. These can be | ||
61 | * redefined in the board specific file. | ||
62 | * Can only choose from CLK13-16 */ | ||
63 | #define F3_RXCLK 15 | ||
64 | #define F3_TXCLK 16 | ||
65 | |||
66 | |||
48 | #endif /* __MACH_MPC85XX_ADS_H__ */ | 67 | #endif /* __MACH_MPC85XX_ADS_H__ */ |
diff --git a/arch/ppc/platforms/mpc8272ads_setup.c b/arch/ppc/platforms/mpc8272ads_setup.c index abb7154de2c7..2a35fe2b9b96 100644 --- a/arch/ppc/platforms/mpc8272ads_setup.c +++ b/arch/ppc/platforms/mpc8272ads_setup.c | |||
@@ -56,64 +56,51 @@ static struct fs_uart_platform_info mpc8272_uart_pdata[] = { | |||
56 | }, | 56 | }, |
57 | }; | 57 | }; |
58 | 58 | ||
59 | static struct fs_mii_bus_info mii_bus_info = { | 59 | static struct fs_mii_bb_platform_info m82xx_mii_bb_pdata = { |
60 | .method = fsmii_bitbang, | 60 | .mdio_dat.bit = 18, |
61 | .id = 0, | 61 | .mdio_dir.bit = 18, |
62 | .i.bitbang = { | 62 | .mdc_dat.bit = 19, |
63 | .mdio_port = fsiop_portc, | 63 | .delay = 1, |
64 | .mdio_bit = 18, | ||
65 | .mdc_port = fsiop_portc, | ||
66 | .mdc_bit = 19, | ||
67 | .delay = 1, | ||
68 | }, | ||
69 | }; | ||
70 | |||
71 | static struct fs_platform_info mpc82xx_fcc1_pdata = { | ||
72 | .fs_no = fsid_fcc1, | ||
73 | .cp_page = CPM_CR_FCC1_PAGE, | ||
74 | .cp_block = CPM_CR_FCC1_SBLOCK, | ||
75 | .clk_trx = (PC_F1RXCLK | PC_F1TXCLK), | ||
76 | .clk_route = CMX1_CLK_ROUTE, | ||
77 | .clk_mask = CMX1_CLK_MASK, | ||
78 | .init_ioports = init_fcc1_ioports, | ||
79 | |||
80 | .phy_addr = 0, | ||
81 | #ifdef PHY_INTERRUPT | ||
82 | .phy_irq = PHY_INTERRUPT, | ||
83 | #else | ||
84 | .phy_irq = -1; | ||
85 | #endif | ||
86 | .mem_offset = FCC1_MEM_OFFSET, | ||
87 | .bus_info = &mii_bus_info, | ||
88 | .rx_ring = 32, | ||
89 | .tx_ring = 32, | ||
90 | .rx_copybreak = 240, | ||
91 | .use_napi = 0, | ||
92 | .napi_weight = 17, | ||
93 | }; | 64 | }; |
94 | 65 | ||
95 | static struct fs_platform_info mpc82xx_fcc2_pdata = { | 66 | static struct fs_platform_info mpc82xx_enet_pdata[] = { |
96 | .fs_no = fsid_fcc2, | 67 | [fsid_fcc1] = { |
97 | .cp_page = CPM_CR_FCC2_PAGE, | 68 | .fs_no = fsid_fcc1, |
98 | .cp_block = CPM_CR_FCC2_SBLOCK, | 69 | .cp_page = CPM_CR_FCC1_PAGE, |
99 | .clk_trx = (PC_F2RXCLK | PC_F2TXCLK), | 70 | .cp_block = CPM_CR_FCC1_SBLOCK, |
100 | .clk_route = CMX2_CLK_ROUTE, | 71 | |
101 | .clk_mask = CMX2_CLK_MASK, | 72 | .clk_trx = (PC_F1RXCLK | PC_F1TXCLK), |
102 | .init_ioports = init_fcc2_ioports, | 73 | .clk_route = CMX1_CLK_ROUTE, |
103 | 74 | .clk_mask = CMX1_CLK_MASK, | |
104 | .phy_addr = 3, | 75 | .init_ioports = init_fcc1_ioports, |
105 | #ifdef PHY_INTERRUPT | 76 | |
106 | .phy_irq = PHY_INTERRUPT, | 77 | .mem_offset = FCC1_MEM_OFFSET, |
107 | #else | 78 | |
108 | .phy_irq = -1; | 79 | .rx_ring = 32, |
109 | #endif | 80 | .tx_ring = 32, |
110 | .mem_offset = FCC2_MEM_OFFSET, | 81 | .rx_copybreak = 240, |
111 | .bus_info = &mii_bus_info, | 82 | .use_napi = 0, |
112 | .rx_ring = 32, | 83 | .napi_weight = 17, |
113 | .tx_ring = 32, | 84 | .bus_id = "0:00", |
114 | .rx_copybreak = 240, | 85 | }, |
115 | .use_napi = 0, | 86 | [fsid_fcc2] = { |
116 | .napi_weight = 17, | 87 | .fs_no = fsid_fcc2, |
88 | .cp_page = CPM_CR_FCC2_PAGE, | ||
89 | .cp_block = CPM_CR_FCC2_SBLOCK, | ||
90 | .clk_trx = (PC_F2RXCLK | PC_F2TXCLK), | ||
91 | .clk_route = CMX2_CLK_ROUTE, | ||
92 | .clk_mask = CMX2_CLK_MASK, | ||
93 | .init_ioports = init_fcc2_ioports, | ||
94 | |||
95 | .mem_offset = FCC2_MEM_OFFSET, | ||
96 | |||
97 | .rx_ring = 32, | ||
98 | .tx_ring = 32, | ||
99 | .rx_copybreak = 240, | ||
100 | .use_napi = 0, | ||
101 | .napi_weight = 17, | ||
102 | .bus_id = "0:03", | ||
103 | }, | ||
117 | }; | 104 | }; |
118 | 105 | ||
119 | static void init_fcc1_ioports(void) | 106 | static void init_fcc1_ioports(void) |
@@ -209,20 +196,21 @@ static void __init mpc8272ads_fixup_enet_pdata(struct platform_device *pdev, | |||
209 | bd_t* bi = (void*)__res; | 196 | bd_t* bi = (void*)__res; |
210 | int fs_no = fsid_fcc1+pdev->id-1; | 197 | int fs_no = fsid_fcc1+pdev->id-1; |
211 | 198 | ||
212 | mpc82xx_fcc1_pdata.dpram_offset = mpc82xx_fcc2_pdata.dpram_offset = (u32)cpm2_immr->im_dprambase; | 199 | if(fs_no > ARRAY_SIZE(mpc82xx_enet_pdata)) { |
213 | mpc82xx_fcc1_pdata.fcc_regs_c = mpc82xx_fcc2_pdata.fcc_regs_c = (u32)cpm2_immr->im_fcc_c; | 200 | return; |
214 | |||
215 | switch(fs_no) { | ||
216 | case fsid_fcc1: | ||
217 | memcpy(&mpc82xx_fcc1_pdata.macaddr,bi->bi_enetaddr,6); | ||
218 | pdev->dev.platform_data = &mpc82xx_fcc1_pdata; | ||
219 | break; | ||
220 | case fsid_fcc2: | ||
221 | memcpy(&mpc82xx_fcc2_pdata.macaddr,bi->bi_enetaddr,6); | ||
222 | mpc82xx_fcc2_pdata.macaddr[5] ^= 1; | ||
223 | pdev->dev.platform_data = &mpc82xx_fcc2_pdata; | ||
224 | break; | ||
225 | } | 201 | } |
202 | |||
203 | mpc82xx_enet_pdata[fs_no].dpram_offset= | ||
204 | (u32)cpm2_immr->im_dprambase; | ||
205 | mpc82xx_enet_pdata[fs_no].fcc_regs_c = | ||
206 | (u32)cpm2_immr->im_fcc_c; | ||
207 | memcpy(&mpc82xx_enet_pdata[fs_no].macaddr,bi->bi_enetaddr,6); | ||
208 | |||
209 | /* prevent dup mac */ | ||
210 | if(fs_no == fsid_fcc2) | ||
211 | mpc82xx_enet_pdata[fs_no].macaddr[5] ^= 1; | ||
212 | |||
213 | pdev->dev.platform_data = &mpc82xx_enet_pdata[fs_no]; | ||
226 | } | 214 | } |
227 | 215 | ||
228 | static void mpc8272ads_fixup_uart_pdata(struct platform_device *pdev, | 216 | static void mpc8272ads_fixup_uart_pdata(struct platform_device *pdev, |
@@ -274,6 +262,29 @@ static void init_scc4_uart_ioports(void) | |||
274 | iounmap(immap); | 262 | iounmap(immap); |
275 | } | 263 | } |
276 | 264 | ||
265 | static void __init mpc8272ads_fixup_mdio_pdata(struct platform_device *pdev, | ||
266 | int idx) | ||
267 | { | ||
268 | m82xx_mii_bb_pdata.irq[0] = PHY_INTERRUPT; | ||
269 | m82xx_mii_bb_pdata.irq[1] = -1; | ||
270 | m82xx_mii_bb_pdata.irq[2] = -1; | ||
271 | m82xx_mii_bb_pdata.irq[3] = PHY_INTERRUPT; | ||
272 | m82xx_mii_bb_pdata.irq[31] = -1; | ||
273 | |||
274 | |||
275 | m82xx_mii_bb_pdata.mdio_dat.offset = | ||
276 | (u32)&cpm2_immr->im_ioport.iop_pdatc; | ||
277 | |||
278 | m82xx_mii_bb_pdata.mdio_dir.offset = | ||
279 | (u32)&cpm2_immr->im_ioport.iop_pdirc; | ||
280 | |||
281 | m82xx_mii_bb_pdata.mdc_dat.offset = | ||
282 | (u32)&cpm2_immr->im_ioport.iop_pdatc; | ||
283 | |||
284 | |||
285 | pdev->dev.platform_data = &m82xx_mii_bb_pdata; | ||
286 | } | ||
287 | |||
277 | static int mpc8272ads_platform_notify(struct device *dev) | 288 | static int mpc8272ads_platform_notify(struct device *dev) |
278 | { | 289 | { |
279 | static const struct platform_notify_dev_map dev_map[] = { | 290 | static const struct platform_notify_dev_map dev_map[] = { |
@@ -286,6 +297,10 @@ static int mpc8272ads_platform_notify(struct device *dev) | |||
286 | .rtn = mpc8272ads_fixup_uart_pdata, | 297 | .rtn = mpc8272ads_fixup_uart_pdata, |
287 | }, | 298 | }, |
288 | { | 299 | { |
300 | .bus_id = "fsl-bb-mdio", | ||
301 | .rtn = mpc8272ads_fixup_mdio_pdata, | ||
302 | }, | ||
303 | { | ||
289 | .bus_id = NULL | 304 | .bus_id = NULL |
290 | } | 305 | } |
291 | }; | 306 | }; |
@@ -319,6 +334,7 @@ int __init mpc8272ads_init(void) | |||
319 | ppc_sys_device_enable(MPC82xx_CPM_SCC4); | 334 | ppc_sys_device_enable(MPC82xx_CPM_SCC4); |
320 | #endif | 335 | #endif |
321 | 336 | ||
337 | ppc_sys_device_enable(MPC82xx_MDIO_BB); | ||
322 | 338 | ||
323 | return 0; | 339 | return 0; |
324 | } | 340 | } |
diff --git a/arch/ppc/platforms/mpc866ads_setup.c b/arch/ppc/platforms/mpc866ads_setup.c index f19b6167c770..e12cece4c9fd 100644 --- a/arch/ppc/platforms/mpc866ads_setup.c +++ b/arch/ppc/platforms/mpc866ads_setup.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /*arch/ppc/platforms/mpc885ads-setup.c | 1 | /*arch/ppc/platforms/mpc866ads-setup.c |
2 | * | 2 | * |
3 | * Platform setup for the Freescale mpc885ads board | 3 | * Platform setup for the Freescale mpc866ads board |
4 | * | 4 | * |
5 | * Vitaly Bordug <vbordug@ru.mvista.com> | 5 | * Vitaly Bordug <vbordug@ru.mvista.com> |
6 | * | 6 | * |
7 | * Copyright 2005 MontaVista Software Inc. | 7 | * Copyright 2005-2006 MontaVista Software Inc. |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public License | 9 | * This file is licensed under the terms of the GNU General Public License |
10 | * version 2. This program is licensed "as is" without any warranty of any | 10 | * version 2. This program is licensed "as is" without any warranty of any |
@@ -42,49 +42,36 @@ static void setup_scc1_ioports(void); | |||
42 | static void setup_smc1_ioports(void); | 42 | static void setup_smc1_ioports(void); |
43 | static void setup_smc2_ioports(void); | 43 | static void setup_smc2_ioports(void); |
44 | 44 | ||
45 | static struct fs_mii_bus_info fec_mii_bus_info = { | 45 | static struct fs_mii_fec_platform_info mpc8xx_mdio_fec_pdata; |
46 | .method = fsmii_fec, | ||
47 | .id = 0, | ||
48 | }; | ||
49 | |||
50 | static struct fs_mii_bus_info scc_mii_bus_info = { | ||
51 | .method = fsmii_fixed, | ||
52 | .id = 0, | ||
53 | .i.fixed.speed = 10, | ||
54 | .i.fixed.duplex = 0, | ||
55 | }; | ||
56 | 46 | ||
57 | static struct fs_platform_info mpc8xx_fec_pdata[] = { | 47 | static struct fs_mii_fec_platform_info mpc8xx_mdio_fec_pdata; |
58 | { | ||
59 | .rx_ring = 128, | ||
60 | .tx_ring = 16, | ||
61 | .rx_copybreak = 240, | ||
62 | 48 | ||
63 | .use_napi = 1, | 49 | static struct fs_platform_info mpc8xx_enet_pdata[] = { |
64 | .napi_weight = 17, | 50 | [fsid_fec1] = { |
51 | .rx_ring = 128, | ||
52 | .tx_ring = 16, | ||
53 | .rx_copybreak = 240, | ||
65 | 54 | ||
66 | .phy_addr = 15, | 55 | .use_napi = 1, |
67 | .phy_irq = -1, | 56 | .napi_weight = 17, |
68 | 57 | ||
69 | .use_rmii = 0, | 58 | .init_ioports = setup_fec1_ioports, |
70 | 59 | ||
71 | .bus_info = &fec_mii_bus_info, | 60 | .bus_id = "0:0f", |
72 | } | 61 | .has_phy = 1, |
73 | }; | 62 | }, |
63 | [fsid_scc1] = { | ||
64 | .rx_ring = 64, | ||
65 | .tx_ring = 8, | ||
66 | .rx_copybreak = 240, | ||
67 | .use_napi = 1, | ||
68 | .napi_weight = 17, | ||
74 | 69 | ||
75 | static struct fs_platform_info mpc8xx_scc_pdata = { | ||
76 | .rx_ring = 64, | ||
77 | .tx_ring = 8, | ||
78 | .rx_copybreak = 240, | ||
79 | 70 | ||
80 | .use_napi = 1, | 71 | .init_ioports = setup_scc1_ioports, |
81 | .napi_weight = 17, | ||
82 | |||
83 | .phy_addr = -1, | ||
84 | .phy_irq = -1, | ||
85 | |||
86 | .bus_info = &scc_mii_bus_info, | ||
87 | 72 | ||
73 | .bus_id = "fixed@100:1", | ||
74 | }, | ||
88 | }; | 75 | }; |
89 | 76 | ||
90 | static struct fs_uart_platform_info mpc866_uart_pdata[] = { | 77 | static struct fs_uart_platform_info mpc866_uart_pdata[] = { |
@@ -207,63 +194,6 @@ static void setup_scc1_ioports(void) | |||
207 | 194 | ||
208 | } | 195 | } |
209 | 196 | ||
210 | static void mpc866ads_fixup_enet_pdata(struct platform_device *pdev, int fs_no) | ||
211 | { | ||
212 | struct fs_platform_info *fpi = pdev->dev.platform_data; | ||
213 | |||
214 | volatile cpm8xx_t *cp; | ||
215 | bd_t *bd = (bd_t *) __res; | ||
216 | char *e; | ||
217 | int i; | ||
218 | |||
219 | /* Get pointer to Communication Processor */ | ||
220 | cp = cpmp; | ||
221 | switch (fs_no) { | ||
222 | case fsid_fec1: | ||
223 | fpi = &mpc8xx_fec_pdata[0]; | ||
224 | fpi->init_ioports = &setup_fec1_ioports; | ||
225 | |||
226 | break; | ||
227 | case fsid_scc1: | ||
228 | fpi = &mpc8xx_scc_pdata; | ||
229 | fpi->init_ioports = &setup_scc1_ioports; | ||
230 | |||
231 | break; | ||
232 | default: | ||
233 | printk(KERN_WARNING"Device %s is not supported!\n", pdev->name); | ||
234 | return; | ||
235 | } | ||
236 | |||
237 | pdev->dev.platform_data = fpi; | ||
238 | fpi->fs_no = fs_no; | ||
239 | |||
240 | e = (unsigned char *)&bd->bi_enetaddr; | ||
241 | for (i = 0; i < 6; i++) | ||
242 | fpi->macaddr[i] = *e++; | ||
243 | |||
244 | fpi->macaddr[5 - pdev->id]++; | ||
245 | |||
246 | } | ||
247 | |||
248 | static void mpc866ads_fixup_fec_enet_pdata(struct platform_device *pdev, | ||
249 | int idx) | ||
250 | { | ||
251 | /* This is for FEC devices only */ | ||
252 | if (!pdev || !pdev->name || (!strstr(pdev->name, "fsl-cpm-fec"))) | ||
253 | return; | ||
254 | mpc866ads_fixup_enet_pdata(pdev, fsid_fec1 + pdev->id - 1); | ||
255 | } | ||
256 | |||
257 | static void mpc866ads_fixup_scc_enet_pdata(struct platform_device *pdev, | ||
258 | int idx) | ||
259 | { | ||
260 | /* This is for SCC devices only */ | ||
261 | if (!pdev || !pdev->name || (!strstr(pdev->name, "fsl-cpm-scc"))) | ||
262 | return; | ||
263 | |||
264 | mpc866ads_fixup_enet_pdata(pdev, fsid_scc1 + pdev->id - 1); | ||
265 | } | ||
266 | |||
267 | static void setup_smc1_ioports(void) | 197 | static void setup_smc1_ioports(void) |
268 | { | 198 | { |
269 | immap_t *immap = (immap_t *) IMAP_ADDR; | 199 | immap_t *immap = (immap_t *) IMAP_ADDR; |
@@ -315,6 +245,56 @@ static void setup_smc2_ioports(void) | |||
315 | 245 | ||
316 | } | 246 | } |
317 | 247 | ||
248 | static int ma_count = 0; | ||
249 | |||
250 | static void mpc866ads_fixup_enet_pdata(struct platform_device *pdev, int fs_no) | ||
251 | { | ||
252 | struct fs_platform_info *fpi; | ||
253 | |||
254 | volatile cpm8xx_t *cp; | ||
255 | bd_t *bd = (bd_t *) __res; | ||
256 | char *e; | ||
257 | int i; | ||
258 | |||
259 | /* Get pointer to Communication Processor */ | ||
260 | cp = cpmp; | ||
261 | |||
262 | if(fs_no > ARRAY_SIZE(mpc8xx_enet_pdata)) { | ||
263 | printk(KERN_ERR"No network-suitable #%d device on bus", fs_no); | ||
264 | return; | ||
265 | } | ||
266 | |||
267 | |||
268 | fpi = &mpc8xx_enet_pdata[fs_no]; | ||
269 | fpi->fs_no = fs_no; | ||
270 | pdev->dev.platform_data = fpi; | ||
271 | |||
272 | e = (unsigned char *)&bd->bi_enetaddr; | ||
273 | for (i = 0; i < 6; i++) | ||
274 | fpi->macaddr[i] = *e++; | ||
275 | |||
276 | fpi->macaddr[5] += ma_count++; | ||
277 | } | ||
278 | |||
279 | static void mpc866ads_fixup_fec_enet_pdata(struct platform_device *pdev, | ||
280 | int idx) | ||
281 | { | ||
282 | /* This is for FEC devices only */ | ||
283 | if (!pdev || !pdev->name || (!strstr(pdev->name, "fsl-cpm-fec"))) | ||
284 | return; | ||
285 | mpc866ads_fixup_enet_pdata(pdev, fsid_fec1 + pdev->id - 1); | ||
286 | } | ||
287 | |||
288 | static void mpc866ads_fixup_scc_enet_pdata(struct platform_device *pdev, | ||
289 | int idx) | ||
290 | { | ||
291 | /* This is for SCC devices only */ | ||
292 | if (!pdev || !pdev->name || (!strstr(pdev->name, "fsl-cpm-scc"))) | ||
293 | return; | ||
294 | |||
295 | mpc866ads_fixup_enet_pdata(pdev, fsid_scc1 + pdev->id - 1); | ||
296 | } | ||
297 | |||
318 | static void __init mpc866ads_fixup_uart_pdata(struct platform_device *pdev, | 298 | static void __init mpc866ads_fixup_uart_pdata(struct platform_device *pdev, |
319 | int idx) | 299 | int idx) |
320 | { | 300 | { |
@@ -359,6 +339,9 @@ static int mpc866ads_platform_notify(struct device *dev) | |||
359 | 339 | ||
360 | int __init mpc866ads_init(void) | 340 | int __init mpc866ads_init(void) |
361 | { | 341 | { |
342 | bd_t *bd = (bd_t *) __res; | ||
343 | struct fs_mii_fec_platform_info* fmpi; | ||
344 | |||
362 | printk(KERN_NOTICE "mpc866ads: Init\n"); | 345 | printk(KERN_NOTICE "mpc866ads: Init\n"); |
363 | 346 | ||
364 | platform_notify = mpc866ads_platform_notify; | 347 | platform_notify = mpc866ads_platform_notify; |
@@ -366,11 +349,20 @@ int __init mpc866ads_init(void) | |||
366 | ppc_sys_device_initfunc(); | 349 | ppc_sys_device_initfunc(); |
367 | ppc_sys_device_disable_all(); | 350 | ppc_sys_device_disable_all(); |
368 | 351 | ||
369 | #ifdef MPC8xx_SECOND_ETH_SCC1 | 352 | #ifdef CONFIG_MPC8xx_SECOND_ETH_SCC1 |
370 | ppc_sys_device_enable(MPC8xx_CPM_SCC1); | 353 | ppc_sys_device_enable(MPC8xx_CPM_SCC1); |
371 | #endif | 354 | #endif |
372 | ppc_sys_device_enable(MPC8xx_CPM_FEC1); | 355 | ppc_sys_device_enable(MPC8xx_CPM_FEC1); |
373 | 356 | ||
357 | ppc_sys_device_enable(MPC8xx_MDIO_FEC); | ||
358 | |||
359 | fmpi = ppc_sys_platform_devices[MPC8xx_MDIO_FEC].dev.platform_data = | ||
360 | &mpc8xx_mdio_fec_pdata; | ||
361 | |||
362 | fmpi->mii_speed = ((((bd->bi_intfreq + 4999999) / 2500000) / 2) & 0x3F) << 1; | ||
363 | /* No PHY interrupt line here */ | ||
364 | fmpi->irq[0xf] = -1; | ||
365 | |||
374 | /* Since either of the uarts could be used as console, they need to ready */ | 366 | /* Since either of the uarts could be used as console, they need to ready */ |
375 | #ifdef CONFIG_SERIAL_CPM_SMC1 | 367 | #ifdef CONFIG_SERIAL_CPM_SMC1 |
376 | ppc_sys_device_enable(MPC8xx_CPM_SMC1); | 368 | ppc_sys_device_enable(MPC8xx_CPM_SMC1); |
@@ -381,6 +373,14 @@ int __init mpc866ads_init(void) | |||
381 | ppc_sys_device_enable(MPC8xx_CPM_SMC2); | 373 | ppc_sys_device_enable(MPC8xx_CPM_SMC2); |
382 | ppc_sys_device_setfunc(MPC8xx_CPM_SMC2, PPC_SYS_FUNC_UART); | 374 | ppc_sys_device_setfunc(MPC8xx_CPM_SMC2, PPC_SYS_FUNC_UART); |
383 | #endif | 375 | #endif |
376 | ppc_sys_device_enable(MPC8xx_MDIO_FEC); | ||
377 | |||
378 | fmpi = ppc_sys_platform_devices[MPC8xx_MDIO_FEC].dev.platform_data = | ||
379 | &mpc8xx_mdio_fec_pdata; | ||
380 | |||
381 | fmpi->mii_speed = ((((bd->bi_intfreq + 4999999) / 2500000) / 2) & 0x3F) << 1; | ||
382 | /* No PHY interrupt line here */ | ||
383 | fmpi->irq[0xf] = -1; | ||
384 | 384 | ||
385 | return 0; | 385 | return 0; |
386 | } | 386 | } |
diff --git a/arch/ppc/platforms/mpc885ads_setup.c b/arch/ppc/platforms/mpc885ads_setup.c index c1fc4a16fea9..5dfa4e6c2af0 100644 --- a/arch/ppc/platforms/mpc885ads_setup.c +++ b/arch/ppc/platforms/mpc885ads_setup.c | |||
@@ -38,7 +38,10 @@ extern unsigned char __res[]; | |||
38 | static void setup_smc1_ioports(void); | 38 | static void setup_smc1_ioports(void); |
39 | static void setup_smc2_ioports(void); | 39 | static void setup_smc2_ioports(void); |
40 | 40 | ||
41 | static void __init mpc885ads_scc_phy_init(char); | 41 | static struct fs_mii_fec_platform_info mpc8xx_mdio_fec_pdata; |
42 | static void setup_fec1_ioports(void); | ||
43 | static void setup_fec2_ioports(void); | ||
44 | static void setup_scc3_ioports(void); | ||
42 | 45 | ||
43 | static struct fs_uart_platform_info mpc885_uart_pdata[] = { | 46 | static struct fs_uart_platform_info mpc885_uart_pdata[] = { |
44 | [fsid_smc1_uart] = { | 47 | [fsid_smc1_uart] = { |
@@ -61,23 +64,8 @@ static struct fs_uart_platform_info mpc885_uart_pdata[] = { | |||
61 | }, | 64 | }, |
62 | }; | 65 | }; |
63 | 66 | ||
64 | static struct fs_mii_bus_info fec_mii_bus_info = { | 67 | static struct fs_platform_info mpc8xx_enet_pdata[] = { |
65 | .method = fsmii_fec, | 68 | [fsid_fec1] = { |
66 | .id = 0, | ||
67 | }; | ||
68 | |||
69 | static struct fs_mii_bus_info scc_mii_bus_info = { | ||
70 | #ifdef CONFIG_SCC_ENET_8xx_FIXED | ||
71 | .method = fsmii_fixed, | ||
72 | #else | ||
73 | .method = fsmii_fec, | ||
74 | #endif | ||
75 | |||
76 | .id = 0, | ||
77 | }; | ||
78 | |||
79 | static struct fs_platform_info mpc8xx_fec_pdata[] = { | ||
80 | { | ||
81 | .rx_ring = 128, | 69 | .rx_ring = 128, |
82 | .tx_ring = 16, | 70 | .tx_ring = 16, |
83 | .rx_copybreak = 240, | 71 | .rx_copybreak = 240, |
@@ -85,11 +73,12 @@ static struct fs_platform_info mpc8xx_fec_pdata[] = { | |||
85 | .use_napi = 1, | 73 | .use_napi = 1, |
86 | .napi_weight = 17, | 74 | .napi_weight = 17, |
87 | 75 | ||
88 | .phy_addr = 0, | 76 | .init_ioports = setup_fec1_ioports, |
89 | .phy_irq = SIU_IRQ7, | ||
90 | 77 | ||
91 | .bus_info = &fec_mii_bus_info, | 78 | .bus_id = "0:00", |
92 | }, { | 79 | .has_phy = 1, |
80 | }, | ||
81 | [fsid_fec2] = { | ||
93 | .rx_ring = 128, | 82 | .rx_ring = 128, |
94 | .tx_ring = 16, | 83 | .tx_ring = 16, |
95 | .rx_copybreak = 240, | 84 | .rx_copybreak = 240, |
@@ -97,35 +86,32 @@ static struct fs_platform_info mpc8xx_fec_pdata[] = { | |||
97 | .use_napi = 1, | 86 | .use_napi = 1, |
98 | .napi_weight = 17, | 87 | .napi_weight = 17, |
99 | 88 | ||
100 | .phy_addr = 1, | 89 | .init_ioports = setup_fec2_ioports, |
101 | .phy_irq = SIU_IRQ7, | ||
102 | |||
103 | .bus_info = &fec_mii_bus_info, | ||
104 | } | ||
105 | }; | ||
106 | 90 | ||
107 | static struct fs_platform_info mpc8xx_scc_pdata = { | 91 | .bus_id = "0:01", |
108 | .rx_ring = 64, | 92 | .has_phy = 1, |
109 | .tx_ring = 8, | 93 | }, |
110 | .rx_copybreak = 240, | 94 | [fsid_scc3] = { |
95 | .rx_ring = 64, | ||
96 | .tx_ring = 8, | ||
97 | .rx_copybreak = 240, | ||
111 | 98 | ||
112 | .use_napi = 1, | 99 | .use_napi = 1, |
113 | .napi_weight = 17, | 100 | .napi_weight = 17, |
114 | 101 | ||
115 | .phy_addr = 2, | 102 | .init_ioports = setup_scc3_ioports, |
116 | #ifdef CONFIG_MPC8xx_SCC_ENET_FIXED | 103 | #ifdef CONFIG_FIXED_MII_10_FDX |
117 | .phy_irq = -1, | 104 | .bus_id = "fixed@100:1", |
118 | #else | 105 | #else |
119 | .phy_irq = SIU_IRQ7, | 106 | .bus_id = "0:02", |
120 | #endif | 107 | #endif |
121 | 108 | }, | |
122 | .bus_info = &scc_mii_bus_info, | ||
123 | }; | 109 | }; |
124 | 110 | ||
125 | void __init board_init(void) | 111 | void __init board_init(void) |
126 | { | 112 | { |
127 | volatile cpm8xx_t *cp = cpmp; | 113 | cpm8xx_t *cp = cpmp; |
128 | unsigned int *bcsr_io; | 114 | unsigned int *bcsr_io; |
129 | 115 | ||
130 | #ifdef CONFIG_FS_ENET | 116 | #ifdef CONFIG_FS_ENET |
131 | immap_t *immap = (immap_t *) IMAP_ADDR; | 117 | immap_t *immap = (immap_t *) IMAP_ADDR; |
@@ -164,6 +150,14 @@ void __init board_init(void) | |||
164 | /* use MDC for MII (common) */ | 150 | /* use MDC for MII (common) */ |
165 | setbits16(&immap->im_ioport.iop_pdpar, 0x0080); | 151 | setbits16(&immap->im_ioport.iop_pdpar, 0x0080); |
166 | clrbits16(&immap->im_ioport.iop_pddir, 0x0080); | 152 | clrbits16(&immap->im_ioport.iop_pddir, 0x0080); |
153 | bcsr_io = ioremap(BCSR5, sizeof(unsigned long)); | ||
154 | clrbits32(bcsr_io,BCSR5_MII1_EN); | ||
155 | clrbits32(bcsr_io,BCSR5_MII1_RST); | ||
156 | #ifdef CONFIG_MPC8xx_SECOND_ETH_FEC2 | ||
157 | clrbits32(bcsr_io,BCSR5_MII2_EN); | ||
158 | clrbits32(bcsr_io,BCSR5_MII2_RST); | ||
159 | #endif | ||
160 | iounmap(bcsr_io); | ||
167 | #endif | 161 | #endif |
168 | } | 162 | } |
169 | 163 | ||
@@ -194,8 +188,8 @@ static void setup_fec2_ioports(void) | |||
194 | /* configure FEC2 pins */ | 188 | /* configure FEC2 pins */ |
195 | setbits32(&immap->im_cpm.cp_pepar, 0x0003fffc); | 189 | setbits32(&immap->im_cpm.cp_pepar, 0x0003fffc); |
196 | setbits32(&immap->im_cpm.cp_pedir, 0x0003fffc); | 190 | setbits32(&immap->im_cpm.cp_pedir, 0x0003fffc); |
197 | setbits32(&immap->im_cpm.cp_peso, 0x00037800); | ||
198 | clrbits32(&immap->im_cpm.cp_peso, 0x000087fc); | 191 | clrbits32(&immap->im_cpm.cp_peso, 0x000087fc); |
192 | setbits32(&immap->im_cpm.cp_peso, 0x00037800); | ||
199 | clrbits32(&immap->im_cpm.cp_cptr, 0x00000080); | 193 | clrbits32(&immap->im_cpm.cp_cptr, 0x00000080); |
200 | } | 194 | } |
201 | 195 | ||
@@ -213,6 +207,8 @@ static void setup_scc3_ioports(void) | |||
213 | 207 | ||
214 | /* Enable the PHY. | 208 | /* Enable the PHY. |
215 | */ | 209 | */ |
210 | clrbits32(bcsr_io+4, BCSR4_ETH10_RST); | ||
211 | udelay(1000); | ||
216 | setbits32(bcsr_io+4, BCSR4_ETH10_RST); | 212 | setbits32(bcsr_io+4, BCSR4_ETH10_RST); |
217 | /* Configure port A pins for Txd and Rxd. | 213 | /* Configure port A pins for Txd and Rxd. |
218 | */ | 214 | */ |
@@ -254,37 +250,38 @@ static void setup_scc3_ioports(void) | |||
254 | clrbits32(&immap->im_cpm.cp_pedir, PE_ENET_TENA); | 250 | clrbits32(&immap->im_cpm.cp_pedir, PE_ENET_TENA); |
255 | setbits32(&immap->im_cpm.cp_peso, PE_ENET_TENA); | 251 | setbits32(&immap->im_cpm.cp_peso, PE_ENET_TENA); |
256 | 252 | ||
257 | setbits32(bcsr_io+1, BCSR1_ETHEN); | 253 | setbits32(bcsr_io+4, BCSR1_ETHEN); |
258 | iounmap(bcsr_io); | 254 | iounmap(bcsr_io); |
259 | } | 255 | } |
260 | 256 | ||
257 | static int mac_count = 0; | ||
258 | |||
261 | static void mpc885ads_fixup_enet_pdata(struct platform_device *pdev, int fs_no) | 259 | static void mpc885ads_fixup_enet_pdata(struct platform_device *pdev, int fs_no) |
262 | { | 260 | { |
263 | struct fs_platform_info *fpi = pdev->dev.platform_data; | 261 | struct fs_platform_info *fpi; |
264 | |||
265 | volatile cpm8xx_t *cp; | ||
266 | bd_t *bd = (bd_t *) __res; | 262 | bd_t *bd = (bd_t *) __res; |
267 | char *e; | 263 | char *e; |
268 | int i; | 264 | int i; |
269 | 265 | ||
270 | /* Get pointer to Communication Processor */ | 266 | if(fs_no > ARRAY_SIZE(mpc8xx_enet_pdata)) { |
271 | cp = cpmp; | 267 | printk(KERN_ERR"No network-suitable #%d device on bus", fs_no); |
268 | return; | ||
269 | } | ||
270 | |||
271 | fpi = &mpc8xx_enet_pdata[fs_no]; | ||
272 | |||
272 | switch (fs_no) { | 273 | switch (fs_no) { |
273 | case fsid_fec1: | 274 | case fsid_fec1: |
274 | fpi = &mpc8xx_fec_pdata[0]; | ||
275 | fpi->init_ioports = &setup_fec1_ioports; | 275 | fpi->init_ioports = &setup_fec1_ioports; |
276 | break; | 276 | break; |
277 | case fsid_fec2: | 277 | case fsid_fec2: |
278 | fpi = &mpc8xx_fec_pdata[1]; | ||
279 | fpi->init_ioports = &setup_fec2_ioports; | 278 | fpi->init_ioports = &setup_fec2_ioports; |
280 | break; | 279 | break; |
281 | case fsid_scc3: | 280 | case fsid_scc3: |
282 | fpi = &mpc8xx_scc_pdata; | ||
283 | fpi->init_ioports = &setup_scc3_ioports; | 281 | fpi->init_ioports = &setup_scc3_ioports; |
284 | mpc885ads_scc_phy_init(fpi->phy_addr); | ||
285 | break; | 282 | break; |
286 | default: | 283 | default: |
287 | printk(KERN_WARNING"Device %s is not supported!\n", pdev->name); | 284 | printk(KERN_WARNING "Device %s is not supported!\n", pdev->name); |
288 | return; | 285 | return; |
289 | } | 286 | } |
290 | 287 | ||
@@ -295,7 +292,7 @@ static void mpc885ads_fixup_enet_pdata(struct platform_device *pdev, int fs_no) | |||
295 | for (i = 0; i < 6; i++) | 292 | for (i = 0; i < 6; i++) |
296 | fpi->macaddr[i] = *e++; | 293 | fpi->macaddr[i] = *e++; |
297 | 294 | ||
298 | fpi->macaddr[5 - pdev->id]++; | 295 | fpi->macaddr[5] += mac_count++; |
299 | 296 | ||
300 | } | 297 | } |
301 | 298 | ||
@@ -318,58 +315,6 @@ static void __init mpc885ads_fixup_scc_enet_pdata(struct platform_device *pdev, | |||
318 | mpc885ads_fixup_enet_pdata(pdev, fsid_scc1 + pdev->id - 1); | 315 | mpc885ads_fixup_enet_pdata(pdev, fsid_scc1 + pdev->id - 1); |
319 | } | 316 | } |
320 | 317 | ||
321 | /* SCC ethernet controller does not have MII management channel. FEC1 MII | ||
322 | * channel is used to communicate with the 10Mbit PHY. | ||
323 | */ | ||
324 | |||
325 | #define MII_ECNTRL_PINMUX 0x4 | ||
326 | #define FEC_ECNTRL_PINMUX 0x00000004 | ||
327 | #define FEC_RCNTRL_MII_MODE 0x00000004 | ||
328 | |||
329 | /* Make MII read/write commands. | ||
330 | */ | ||
331 | #define mk_mii_write(REG, VAL, PHY_ADDR) (0x50020000 | (((REG) & 0x1f) << 18) | \ | ||
332 | ((VAL) & 0xffff) | ((PHY_ADDR) << 23)) | ||
333 | |||
334 | static void mpc885ads_scc_phy_init(char phy_addr) | ||
335 | { | ||
336 | volatile immap_t *immap; | ||
337 | volatile fec_t *fecp; | ||
338 | bd_t *bd; | ||
339 | |||
340 | bd = (bd_t *) __res; | ||
341 | immap = (immap_t *) IMAP_ADDR; /* pointer to internal registers */ | ||
342 | fecp = &(immap->im_cpm.cp_fec); | ||
343 | |||
344 | /* Enable MII pins of the FEC1 | ||
345 | */ | ||
346 | setbits16(&immap->im_ioport.iop_pdpar, 0x0080); | ||
347 | clrbits16(&immap->im_ioport.iop_pddir, 0x0080); | ||
348 | /* Set MII speed to 2.5 MHz | ||
349 | */ | ||
350 | out_be32(&fecp->fec_mii_speed, | ||
351 | ((((bd->bi_intfreq + 4999999) / 2500000) / 2) & 0x3F) << 1); | ||
352 | |||
353 | /* Enable FEC pin MUX | ||
354 | */ | ||
355 | setbits32(&fecp->fec_ecntrl, MII_ECNTRL_PINMUX); | ||
356 | setbits32(&fecp->fec_r_cntrl, FEC_RCNTRL_MII_MODE); | ||
357 | |||
358 | out_be32(&fecp->fec_mii_data, | ||
359 | mk_mii_write(MII_BMCR, BMCR_ISOLATE, phy_addr)); | ||
360 | udelay(100); | ||
361 | out_be32(&fecp->fec_mii_data, | ||
362 | mk_mii_write(MII_ADVERTISE, | ||
363 | ADVERTISE_10HALF | ADVERTISE_CSMA, phy_addr)); | ||
364 | udelay(100); | ||
365 | |||
366 | /* Disable FEC MII settings | ||
367 | */ | ||
368 | clrbits32(&fecp->fec_ecntrl, MII_ECNTRL_PINMUX); | ||
369 | clrbits32(&fecp->fec_r_cntrl, FEC_RCNTRL_MII_MODE); | ||
370 | out_be32(&fecp->fec_mii_speed, 0); | ||
371 | } | ||
372 | |||
373 | static void setup_smc1_ioports(void) | 318 | static void setup_smc1_ioports(void) |
374 | { | 319 | { |
375 | immap_t *immap = (immap_t *) IMAP_ADDR; | 320 | immap_t *immap = (immap_t *) IMAP_ADDR; |
@@ -462,6 +407,9 @@ static int mpc885ads_platform_notify(struct device *dev) | |||
462 | 407 | ||
463 | int __init mpc885ads_init(void) | 408 | int __init mpc885ads_init(void) |
464 | { | 409 | { |
410 | struct fs_mii_fec_platform_info* fmpi; | ||
411 | bd_t *bd = (bd_t *) __res; | ||
412 | |||
465 | printk(KERN_NOTICE "mpc885ads: Init\n"); | 413 | printk(KERN_NOTICE "mpc885ads: Init\n"); |
466 | 414 | ||
467 | platform_notify = mpc885ads_platform_notify; | 415 | platform_notify = mpc885ads_platform_notify; |
@@ -471,8 +419,17 @@ int __init mpc885ads_init(void) | |||
471 | 419 | ||
472 | ppc_sys_device_enable(MPC8xx_CPM_FEC1); | 420 | ppc_sys_device_enable(MPC8xx_CPM_FEC1); |
473 | 421 | ||
422 | ppc_sys_device_enable(MPC8xx_MDIO_FEC); | ||
423 | fmpi = ppc_sys_platform_devices[MPC8xx_MDIO_FEC].dev.platform_data = | ||
424 | &mpc8xx_mdio_fec_pdata; | ||
425 | |||
426 | fmpi->mii_speed = ((((bd->bi_intfreq + 4999999) / 2500000) / 2) & 0x3F) << 1; | ||
427 | |||
428 | /* No PHY interrupt line here */ | ||
429 | fmpi->irq[0xf] = SIU_IRQ7; | ||
430 | |||
474 | #ifdef CONFIG_MPC8xx_SECOND_ETH_SCC3 | 431 | #ifdef CONFIG_MPC8xx_SECOND_ETH_SCC3 |
475 | ppc_sys_device_enable(MPC8xx_CPM_SCC1); | 432 | ppc_sys_device_enable(MPC8xx_CPM_SCC3); |
476 | 433 | ||
477 | #endif | 434 | #endif |
478 | #ifdef CONFIG_MPC8xx_SECOND_ETH_FEC2 | 435 | #ifdef CONFIG_MPC8xx_SECOND_ETH_FEC2 |
diff --git a/arch/ppc/platforms/pq2ads_pd.h b/arch/ppc/platforms/pq2ads_pd.h index 8f14a43eafec..672483df8079 100644 --- a/arch/ppc/platforms/pq2ads_pd.h +++ b/arch/ppc/platforms/pq2ads_pd.h | |||
@@ -29,86 +29,4 @@ | |||
29 | #define F3_RXCLK 13 | 29 | #define F3_RXCLK 13 |
30 | #define F3_TXCLK 14 | 30 | #define F3_TXCLK 14 |
31 | 31 | ||
32 | /* Automatically generates register configurations */ | ||
33 | #define PC_CLK(x) ((uint)(1<<(x-1))) /* FCC CLK I/O ports */ | ||
34 | |||
35 | #define CMXFCR_RF1CS(x) ((uint)((x-5)<<27)) /* FCC1 Receive Clock Source */ | ||
36 | #define CMXFCR_TF1CS(x) ((uint)((x-5)<<24)) /* FCC1 Transmit Clock Source */ | ||
37 | #define CMXFCR_RF2CS(x) ((uint)((x-9)<<19)) /* FCC2 Receive Clock Source */ | ||
38 | #define CMXFCR_TF2CS(x) ((uint)((x-9)<<16)) /* FCC2 Transmit Clock Source */ | ||
39 | #define CMXFCR_RF3CS(x) ((uint)((x-9)<<11)) /* FCC3 Receive Clock Source */ | ||
40 | #define CMXFCR_TF3CS(x) ((uint)((x-9)<<8)) /* FCC3 Transmit Clock Source */ | ||
41 | |||
42 | #define PC_F1RXCLK PC_CLK(F1_RXCLK) | ||
43 | #define PC_F1TXCLK PC_CLK(F1_TXCLK) | ||
44 | #define CMX1_CLK_ROUTE (CMXFCR_RF1CS(F1_RXCLK) | CMXFCR_TF1CS(F1_TXCLK)) | ||
45 | #define CMX1_CLK_MASK ((uint)0xff000000) | ||
46 | |||
47 | #define PC_F2RXCLK PC_CLK(F2_RXCLK) | ||
48 | #define PC_F2TXCLK PC_CLK(F2_TXCLK) | ||
49 | #define CMX2_CLK_ROUTE (CMXFCR_RF2CS(F2_RXCLK) | CMXFCR_TF2CS(F2_TXCLK)) | ||
50 | #define CMX2_CLK_MASK ((uint)0x00ff0000) | ||
51 | |||
52 | #define PC_F3RXCLK PC_CLK(F3_RXCLK) | ||
53 | #define PC_F3TXCLK PC_CLK(F3_TXCLK) | ||
54 | #define CMX3_CLK_ROUTE (CMXFCR_RF3CS(F3_RXCLK) | CMXFCR_TF3CS(F3_TXCLK)) | ||
55 | #define CMX3_CLK_MASK ((uint)0x0000ff00) | ||
56 | |||
57 | /* I/O Pin assignment for FCC1. I don't yet know the best way to do this, | ||
58 | * but there is little variation among the choices. | ||
59 | */ | ||
60 | #define PA1_COL 0x00000001U | ||
61 | #define PA1_CRS 0x00000002U | ||
62 | #define PA1_TXER 0x00000004U | ||
63 | #define PA1_TXEN 0x00000008U | ||
64 | #define PA1_RXDV 0x00000010U | ||
65 | #define PA1_RXER 0x00000020U | ||
66 | #define PA1_TXDAT 0x00003c00U | ||
67 | #define PA1_RXDAT 0x0003c000U | ||
68 | #define PA1_PSORA0 (PA1_RXDAT | PA1_TXDAT) | ||
69 | #define PA1_PSORA1 (PA1_COL | PA1_CRS | PA1_TXER | PA1_TXEN | \ | ||
70 | PA1_RXDV | PA1_RXER) | ||
71 | #define PA1_DIRA0 (PA1_RXDAT | PA1_CRS | PA1_COL | PA1_RXER | PA1_RXDV) | ||
72 | #define PA1_DIRA1 (PA1_TXDAT | PA1_TXEN | PA1_TXER) | ||
73 | |||
74 | |||
75 | /* I/O Pin assignment for FCC2. I don't yet know the best way to do this, | ||
76 | * but there is little variation among the choices. | ||
77 | */ | ||
78 | #define PB2_TXER 0x00000001U | ||
79 | #define PB2_RXDV 0x00000002U | ||
80 | #define PB2_TXEN 0x00000004U | ||
81 | #define PB2_RXER 0x00000008U | ||
82 | #define PB2_COL 0x00000010U | ||
83 | #define PB2_CRS 0x00000020U | ||
84 | #define PB2_TXDAT 0x000003c0U | ||
85 | #define PB2_RXDAT 0x00003c00U | ||
86 | #define PB2_PSORB0 (PB2_RXDAT | PB2_TXDAT | PB2_CRS | PB2_COL | \ | ||
87 | PB2_RXER | PB2_RXDV | PB2_TXER) | ||
88 | #define PB2_PSORB1 (PB2_TXEN) | ||
89 | #define PB2_DIRB0 (PB2_RXDAT | PB2_CRS | PB2_COL | PB2_RXER | PB2_RXDV) | ||
90 | #define PB2_DIRB1 (PB2_TXDAT | PB2_TXEN | PB2_TXER) | ||
91 | |||
92 | |||
93 | /* I/O Pin assignment for FCC3. I don't yet know the best way to do this, | ||
94 | * but there is little variation among the choices. | ||
95 | */ | ||
96 | #define PB3_RXDV 0x00004000U | ||
97 | #define PB3_RXER 0x00008000U | ||
98 | #define PB3_TXER 0x00010000U | ||
99 | #define PB3_TXEN 0x00020000U | ||
100 | #define PB3_COL 0x00040000U | ||
101 | #define PB3_CRS 0x00080000U | ||
102 | #define PB3_TXDAT 0x0f000000U | ||
103 | #define PB3_RXDAT 0x00f00000U | ||
104 | #define PB3_PSORB0 (PB3_RXDAT | PB3_TXDAT | PB3_CRS | PB3_COL | \ | ||
105 | PB3_RXER | PB3_RXDV | PB3_TXER | PB3_TXEN) | ||
106 | #define PB3_PSORB1 0 | ||
107 | #define PB3_DIRB0 (PB3_RXDAT | PB3_CRS | PB3_COL | PB3_RXER | PB3_RXDV) | ||
108 | #define PB3_DIRB1 (PB3_TXDAT | PB3_TXEN | PB3_TXER) | ||
109 | |||
110 | #define FCC_MEM_OFFSET(x) (CPM_FCC_SPECIAL_BASE + (x*128)) | ||
111 | #define FCC1_MEM_OFFSET FCC_MEM_OFFSET(0) | ||
112 | #define FCC2_MEM_OFFSET FCC_MEM_OFFSET(1) | ||
113 | |||
114 | #endif | 32 | #endif |
diff --git a/arch/ppc/syslib/mpc85xx_devices.c b/arch/ppc/syslib/mpc85xx_devices.c index 7735336f5b8f..325136e5aee0 100644 --- a/arch/ppc/syslib/mpc85xx_devices.c +++ b/arch/ppc/syslib/mpc85xx_devices.c | |||
@@ -16,9 +16,11 @@ | |||
16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
17 | #include <linux/serial_8250.h> | 17 | #include <linux/serial_8250.h> |
18 | #include <linux/fsl_devices.h> | 18 | #include <linux/fsl_devices.h> |
19 | #include <linux/fs_enet_pd.h> | ||
19 | #include <asm/mpc85xx.h> | 20 | #include <asm/mpc85xx.h> |
20 | #include <asm/irq.h> | 21 | #include <asm/irq.h> |
21 | #include <asm/ppc_sys.h> | 22 | #include <asm/ppc_sys.h> |
23 | #include <asm/cpm2.h> | ||
22 | 24 | ||
23 | /* We use offsets for IORESOURCE_MEM since we do not know at compile time | 25 | /* We use offsets for IORESOURCE_MEM since we do not know at compile time |
24 | * what CCSRBAR is, will get fixed up by mach_mpc85xx_fixup | 26 | * what CCSRBAR is, will get fixed up by mach_mpc85xx_fixup |
@@ -82,6 +84,60 @@ static struct fsl_i2c_platform_data mpc85xx_fsl_i2c2_pdata = { | |||
82 | .device_flags = FSL_I2C_DEV_SEPARATE_DFSRR, | 84 | .device_flags = FSL_I2C_DEV_SEPARATE_DFSRR, |
83 | }; | 85 | }; |
84 | 86 | ||
87 | static struct fs_platform_info mpc85xx_fcc1_pdata = { | ||
88 | .fs_no = fsid_fcc1, | ||
89 | .cp_page = CPM_CR_FCC1_PAGE, | ||
90 | .cp_block = CPM_CR_FCC1_SBLOCK, | ||
91 | |||
92 | .rx_ring = 32, | ||
93 | .tx_ring = 32, | ||
94 | .rx_copybreak = 240, | ||
95 | .use_napi = 0, | ||
96 | .napi_weight = 17, | ||
97 | |||
98 | .clk_mask = CMX1_CLK_MASK, | ||
99 | .clk_route = CMX1_CLK_ROUTE, | ||
100 | .clk_trx = (PC_F1RXCLK | PC_F1TXCLK), | ||
101 | |||
102 | .mem_offset = FCC1_MEM_OFFSET, | ||
103 | }; | ||
104 | |||
105 | static struct fs_platform_info mpc85xx_fcc2_pdata = { | ||
106 | .fs_no = fsid_fcc2, | ||
107 | .cp_page = CPM_CR_FCC2_PAGE, | ||
108 | .cp_block = CPM_CR_FCC2_SBLOCK, | ||
109 | |||
110 | .rx_ring = 32, | ||
111 | .tx_ring = 32, | ||
112 | .rx_copybreak = 240, | ||
113 | .use_napi = 0, | ||
114 | .napi_weight = 17, | ||
115 | |||
116 | .clk_mask = CMX2_CLK_MASK, | ||
117 | .clk_route = CMX2_CLK_ROUTE, | ||
118 | .clk_trx = (PC_F2RXCLK | PC_F2TXCLK), | ||
119 | |||
120 | .mem_offset = FCC2_MEM_OFFSET, | ||
121 | }; | ||
122 | |||
123 | static struct fs_platform_info mpc85xx_fcc3_pdata = { | ||
124 | .fs_no = fsid_fcc3, | ||
125 | .cp_page = CPM_CR_FCC3_PAGE, | ||
126 | .cp_block = CPM_CR_FCC3_SBLOCK, | ||
127 | |||
128 | .rx_ring = 32, | ||
129 | .tx_ring = 32, | ||
130 | .rx_copybreak = 240, | ||
131 | .use_napi = 0, | ||
132 | .napi_weight = 17, | ||
133 | |||
134 | .clk_mask = CMX3_CLK_MASK, | ||
135 | .clk_route = CMX3_CLK_ROUTE, | ||
136 | .clk_trx = (PC_F3RXCLK | PC_F3TXCLK), | ||
137 | |||
138 | .mem_offset = FCC3_MEM_OFFSET, | ||
139 | }; | ||
140 | |||
85 | static struct plat_serial8250_port serial_platform_data[] = { | 141 | static struct plat_serial8250_port serial_platform_data[] = { |
86 | [0] = { | 142 | [0] = { |
87 | .mapbase = 0x4500, | 143 | .mapbase = 0x4500, |
@@ -318,19 +374,28 @@ struct platform_device ppc_sys_platform_devices[] = { | |||
318 | [MPC85xx_CPM_FCC1] = { | 374 | [MPC85xx_CPM_FCC1] = { |
319 | .name = "fsl-cpm-fcc", | 375 | .name = "fsl-cpm-fcc", |
320 | .id = 1, | 376 | .id = 1, |
321 | .num_resources = 3, | 377 | .num_resources = 4, |
378 | .dev.platform_data = &mpc85xx_fcc1_pdata, | ||
322 | .resource = (struct resource[]) { | 379 | .resource = (struct resource[]) { |
323 | { | 380 | { |
381 | .name = "fcc_regs", | ||
324 | .start = 0x91300, | 382 | .start = 0x91300, |
325 | .end = 0x9131F, | 383 | .end = 0x9131F, |
326 | .flags = IORESOURCE_MEM, | 384 | .flags = IORESOURCE_MEM, |
327 | }, | 385 | }, |
328 | { | 386 | { |
387 | .name = "fcc_regs_c", | ||
329 | .start = 0x91380, | 388 | .start = 0x91380, |
330 | .end = 0x9139F, | 389 | .end = 0x9139F, |
331 | .flags = IORESOURCE_MEM, | 390 | .flags = IORESOURCE_MEM, |
332 | }, | 391 | }, |
333 | { | 392 | { |
393 | .name = "fcc_pram", | ||
394 | .start = 0x88400, | ||
395 | .end = 0x884ff, | ||
396 | .flags = IORESOURCE_MEM, | ||
397 | }, | ||
398 | { | ||
334 | .start = SIU_INT_FCC1, | 399 | .start = SIU_INT_FCC1, |
335 | .end = SIU_INT_FCC1, | 400 | .end = SIU_INT_FCC1, |
336 | .flags = IORESOURCE_IRQ, | 401 | .flags = IORESOURCE_IRQ, |
@@ -340,19 +405,28 @@ struct platform_device ppc_sys_platform_devices[] = { | |||
340 | [MPC85xx_CPM_FCC2] = { | 405 | [MPC85xx_CPM_FCC2] = { |
341 | .name = "fsl-cpm-fcc", | 406 | .name = "fsl-cpm-fcc", |
342 | .id = 2, | 407 | .id = 2, |
343 | .num_resources = 3, | 408 | .num_resources = 4, |
409 | .dev.platform_data = &mpc85xx_fcc2_pdata, | ||
344 | .resource = (struct resource[]) { | 410 | .resource = (struct resource[]) { |
345 | { | 411 | { |
412 | .name = "fcc_regs", | ||
346 | .start = 0x91320, | 413 | .start = 0x91320, |
347 | .end = 0x9133F, | 414 | .end = 0x9133F, |
348 | .flags = IORESOURCE_MEM, | 415 | .flags = IORESOURCE_MEM, |
349 | }, | 416 | }, |
350 | { | 417 | { |
418 | .name = "fcc_regs_c", | ||
351 | .start = 0x913A0, | 419 | .start = 0x913A0, |
352 | .end = 0x913CF, | 420 | .end = 0x913CF, |
353 | .flags = IORESOURCE_MEM, | 421 | .flags = IORESOURCE_MEM, |
354 | }, | 422 | }, |
355 | { | 423 | { |
424 | .name = "fcc_pram", | ||
425 | .start = 0x88500, | ||
426 | .end = 0x885ff, | ||
427 | .flags = IORESOURCE_MEM, | ||
428 | }, | ||
429 | { | ||
356 | .start = SIU_INT_FCC2, | 430 | .start = SIU_INT_FCC2, |
357 | .end = SIU_INT_FCC2, | 431 | .end = SIU_INT_FCC2, |
358 | .flags = IORESOURCE_IRQ, | 432 | .flags = IORESOURCE_IRQ, |
@@ -362,19 +436,28 @@ struct platform_device ppc_sys_platform_devices[] = { | |||
362 | [MPC85xx_CPM_FCC3] = { | 436 | [MPC85xx_CPM_FCC3] = { |
363 | .name = "fsl-cpm-fcc", | 437 | .name = "fsl-cpm-fcc", |
364 | .id = 3, | 438 | .id = 3, |
365 | .num_resources = 3, | 439 | .num_resources = 4, |
440 | .dev.platform_data = &mpc85xx_fcc3_pdata, | ||
366 | .resource = (struct resource[]) { | 441 | .resource = (struct resource[]) { |
367 | { | 442 | { |
443 | .name = "fcc_regs", | ||
368 | .start = 0x91340, | 444 | .start = 0x91340, |
369 | .end = 0x9135F, | 445 | .end = 0x9135F, |
370 | .flags = IORESOURCE_MEM, | 446 | .flags = IORESOURCE_MEM, |
371 | }, | 447 | }, |
372 | { | 448 | { |
449 | .name = "fcc_regs_c", | ||
373 | .start = 0x913D0, | 450 | .start = 0x913D0, |
374 | .end = 0x913FF, | 451 | .end = 0x913FF, |
375 | .flags = IORESOURCE_MEM, | 452 | .flags = IORESOURCE_MEM, |
376 | }, | 453 | }, |
377 | { | 454 | { |
455 | .name = "fcc_pram", | ||
456 | .start = 0x88600, | ||
457 | .end = 0x886ff, | ||
458 | .flags = IORESOURCE_MEM, | ||
459 | }, | ||
460 | { | ||
378 | .start = SIU_INT_FCC3, | 461 | .start = SIU_INT_FCC3, |
379 | .end = SIU_INT_FCC3, | 462 | .end = SIU_INT_FCC3, |
380 | .flags = IORESOURCE_IRQ, | 463 | .flags = IORESOURCE_IRQ, |
diff --git a/arch/ppc/syslib/mpc8xx_devices.c b/arch/ppc/syslib/mpc8xx_devices.c index 6f536383866e..cf5ab47487a7 100644 --- a/arch/ppc/syslib/mpc8xx_devices.c +++ b/arch/ppc/syslib/mpc8xx_devices.c | |||
@@ -218,6 +218,14 @@ struct platform_device ppc_sys_platform_devices[] = { | |||
218 | }, | 218 | }, |
219 | }, | 219 | }, |
220 | }, | 220 | }, |
221 | |||
222 | [MPC8xx_MDIO_FEC] = { | ||
223 | .name = "fsl-cpm-fec-mdio", | ||
224 | .id = 0, | ||
225 | .num_resources = 0, | ||
226 | |||
227 | }, | ||
228 | |||
221 | }; | 229 | }; |
222 | 230 | ||
223 | static int __init mach_mpc8xx_fixup(struct platform_device *pdev) | 231 | static int __init mach_mpc8xx_fixup(struct platform_device *pdev) |
diff --git a/arch/ppc/syslib/mpc8xx_sys.c b/arch/ppc/syslib/mpc8xx_sys.c index eee213284855..18ba1d7ff9f1 100644 --- a/arch/ppc/syslib/mpc8xx_sys.c +++ b/arch/ppc/syslib/mpc8xx_sys.c | |||
@@ -22,7 +22,7 @@ struct ppc_sys_spec ppc_sys_specs[] = { | |||
22 | .ppc_sys_name = "MPC86X", | 22 | .ppc_sys_name = "MPC86X", |
23 | .mask = 0xFFFFFFFF, | 23 | .mask = 0xFFFFFFFF, |
24 | .value = 0x00000000, | 24 | .value = 0x00000000, |
25 | .num_devices = 7, | 25 | .num_devices = 8, |
26 | .device_list = (enum ppc_sys_devices[]) | 26 | .device_list = (enum ppc_sys_devices[]) |
27 | { | 27 | { |
28 | MPC8xx_CPM_FEC1, | 28 | MPC8xx_CPM_FEC1, |
@@ -32,13 +32,14 @@ struct ppc_sys_spec ppc_sys_specs[] = { | |||
32 | MPC8xx_CPM_SCC4, | 32 | MPC8xx_CPM_SCC4, |
33 | MPC8xx_CPM_SMC1, | 33 | MPC8xx_CPM_SMC1, |
34 | MPC8xx_CPM_SMC2, | 34 | MPC8xx_CPM_SMC2, |
35 | MPC8xx_MDIO_FEC, | ||
35 | }, | 36 | }, |
36 | }, | 37 | }, |
37 | { | 38 | { |
38 | .ppc_sys_name = "MPC885", | 39 | .ppc_sys_name = "MPC885", |
39 | .mask = 0xFFFFFFFF, | 40 | .mask = 0xFFFFFFFF, |
40 | .value = 0x00000000, | 41 | .value = 0x00000000, |
41 | .num_devices = 8, | 42 | .num_devices = 9, |
42 | .device_list = (enum ppc_sys_devices[]) | 43 | .device_list = (enum ppc_sys_devices[]) |
43 | { | 44 | { |
44 | MPC8xx_CPM_FEC1, | 45 | MPC8xx_CPM_FEC1, |
@@ -49,6 +50,7 @@ struct ppc_sys_spec ppc_sys_specs[] = { | |||
49 | MPC8xx_CPM_SCC4, | 50 | MPC8xx_CPM_SCC4, |
50 | MPC8xx_CPM_SMC1, | 51 | MPC8xx_CPM_SMC1, |
51 | MPC8xx_CPM_SMC2, | 52 | MPC8xx_CPM_SMC2, |
53 | MPC8xx_MDIO_FEC, | ||
52 | }, | 54 | }, |
53 | }, | 55 | }, |
54 | { /* default match */ | 56 | { /* default match */ |
diff --git a/arch/ppc/syslib/pq2_devices.c b/arch/ppc/syslib/pq2_devices.c index 8692d00c08c4..fefbc217a56d 100644 --- a/arch/ppc/syslib/pq2_devices.c +++ b/arch/ppc/syslib/pq2_devices.c | |||
@@ -369,6 +369,11 @@ struct platform_device ppc_sys_platform_devices[] = { | |||
369 | }, | 369 | }, |
370 | }, | 370 | }, |
371 | }, | 371 | }, |
372 | [MPC82xx_MDIO_BB] = { | ||
373 | .name = "fsl-bb-mdio", | ||
374 | .id = 0, | ||
375 | .num_resources = 0, | ||
376 | }, | ||
372 | }; | 377 | }; |
373 | 378 | ||
374 | static int __init mach_mpc82xx_fixup(struct platform_device *pdev) | 379 | static int __init mach_mpc82xx_fixup(struct platform_device *pdev) |
diff --git a/arch/ppc/syslib/pq2_sys.c b/arch/ppc/syslib/pq2_sys.c index fee8948162b9..f52600c0db20 100644 --- a/arch/ppc/syslib/pq2_sys.c +++ b/arch/ppc/syslib/pq2_sys.c | |||
@@ -139,13 +139,14 @@ struct ppc_sys_spec ppc_sys_specs[] = { | |||
139 | .ppc_sys_name = "8272", | 139 | .ppc_sys_name = "8272", |
140 | .mask = 0x0000ff00, | 140 | .mask = 0x0000ff00, |
141 | .value = 0x00000c00, | 141 | .value = 0x00000c00, |
142 | .num_devices = 12, | 142 | .num_devices = 13, |
143 | .device_list = (enum ppc_sys_devices[]) | 143 | .device_list = (enum ppc_sys_devices[]) |
144 | { | 144 | { |
145 | MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_SCC1, | 145 | MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_SCC1, |
146 | MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, MPC82xx_CPM_SCC4, | 146 | MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, MPC82xx_CPM_SCC4, |
147 | MPC82xx_CPM_SMC1, MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, | 147 | MPC82xx_CPM_SMC1, MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, |
148 | MPC82xx_CPM_I2C, MPC82xx_CPM_USB, MPC82xx_SEC1, | 148 | MPC82xx_CPM_I2C, MPC82xx_CPM_USB, MPC82xx_SEC1, |
149 | MPC82xx_MDIO_BB, | ||
149 | }, | 150 | }, |
150 | }, | 151 | }, |
151 | /* below is a list of the 8280 family of processors */ | 152 | /* below is a list of the 8280 family of processors */ |
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c index 6a4b5f9715c9..a0a94e0ef8d1 100644 --- a/arch/s390/appldata/appldata_base.c +++ b/arch/s390/appldata/appldata_base.c | |||
@@ -618,7 +618,7 @@ appldata_offline_cpu(int cpu) | |||
618 | } | 618 | } |
619 | 619 | ||
620 | #ifdef CONFIG_HOTPLUG_CPU | 620 | #ifdef CONFIG_HOTPLUG_CPU |
621 | static int | 621 | static int __cpuinit |
622 | appldata_cpu_notify(struct notifier_block *self, | 622 | appldata_cpu_notify(struct notifier_block *self, |
623 | unsigned long action, void *hcpu) | 623 | unsigned long action, void *hcpu) |
624 | { | 624 | { |
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index eb6ebfef134a..6e6b6de77770 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c | |||
@@ -129,7 +129,7 @@ void __init paging_init(void) | |||
129 | /* | 129 | /* |
130 | * pg_table is physical at this point | 130 | * pg_table is physical at this point |
131 | */ | 131 | */ |
132 | pg_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); | 132 | pg_table = (pte_t *) alloc_bootmem_pages(PAGE_SIZE); |
133 | 133 | ||
134 | pg_dir->pgd0 = (_PAGE_TABLE | __pa(pg_table)); | 134 | pg_dir->pgd0 = (_PAGE_TABLE | __pa(pg_table)); |
135 | pg_dir->pgd1 = (_PAGE_TABLE | (__pa(pg_table)+1024)); | 135 | pg_dir->pgd1 = (_PAGE_TABLE | (__pa(pg_table)+1024)); |
@@ -219,7 +219,7 @@ void __init paging_init(void) | |||
219 | continue; | 219 | continue; |
220 | } | 220 | } |
221 | 221 | ||
222 | pm_dir = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE*4); | 222 | pm_dir = (pmd_t *) alloc_bootmem_pages(PAGE_SIZE * 4); |
223 | pgd_populate(&init_mm, pg_dir, pm_dir); | 223 | pgd_populate(&init_mm, pg_dir, pm_dir); |
224 | 224 | ||
225 | for (j = 0 ; j < PTRS_PER_PMD ; j++,pm_dir++) { | 225 | for (j = 0 ; j < PTRS_PER_PMD ; j++,pm_dir++) { |
@@ -228,7 +228,7 @@ void __init paging_init(void) | |||
228 | continue; | 228 | continue; |
229 | } | 229 | } |
230 | 230 | ||
231 | pt_dir = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); | 231 | pt_dir = (pte_t *) alloc_bootmem_pages(PAGE_SIZE); |
232 | pmd_populate_kernel(&init_mm, pm_dir, pt_dir); | 232 | pmd_populate_kernel(&init_mm, pm_dir, pt_dir); |
233 | 233 | ||
234 | for (k = 0 ; k < PTRS_PER_PTE ; k++,pt_dir++) { | 234 | for (k = 0 ; k < PTRS_PER_PTE ; k++,pt_dir++) { |
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c index 4e9938dee060..14052f089814 100644 --- a/arch/x86_64/kernel/traps.c +++ b/arch/x86_64/kernel/traps.c | |||
@@ -529,7 +529,7 @@ void __kprobes oops_end(unsigned long flags) | |||
529 | /* Nest count reaches zero, release the lock. */ | 529 | /* Nest count reaches zero, release the lock. */ |
530 | spin_unlock_irqrestore(&die_lock, flags); | 530 | spin_unlock_irqrestore(&die_lock, flags); |
531 | if (panic_on_oops) | 531 | if (panic_on_oops) |
532 | panic("Fatal exception: panic_on_oops"); | 532 | panic("Fatal exception"); |
533 | } | 533 | } |
534 | 534 | ||
535 | void __kprobes __die(const char * str, struct pt_regs * regs, long err) | 535 | void __kprobes __die(const char * str, struct pt_regs * regs, long err) |
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c index 9734960a2451..ce077d6bf3a0 100644 --- a/arch/xtensa/kernel/traps.c +++ b/arch/xtensa/kernel/traps.c | |||
@@ -488,7 +488,7 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
488 | panic("Fatal exception in interrupt"); | 488 | panic("Fatal exception in interrupt"); |
489 | 489 | ||
490 | if (panic_on_oops) | 490 | if (panic_on_oops) |
491 | panic("Fatal exception: panic_on_oops"); | 491 | panic("Fatal exception"); |
492 | 492 | ||
493 | do_exit(err); | 493 | do_exit(err); |
494 | } | 494 | } |
diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig index d53f664a4dd8..fff89c2d88fd 100644 --- a/drivers/char/watchdog/Kconfig +++ b/drivers/char/watchdog/Kconfig | |||
@@ -45,7 +45,7 @@ config WATCHDOG_NOWAYOUT | |||
45 | comment "Watchdog Device Drivers" | 45 | comment "Watchdog Device Drivers" |
46 | depends on WATCHDOG | 46 | depends on WATCHDOG |
47 | 47 | ||
48 | # Architecture Independant | 48 | # Architecture Independent |
49 | 49 | ||
50 | config SOFT_WATCHDOG | 50 | config SOFT_WATCHDOG |
51 | tristate "Software watchdog" | 51 | tristate "Software watchdog" |
@@ -127,7 +127,7 @@ config S3C2410_WATCHDOG | |||
127 | enabled. | 127 | enabled. |
128 | 128 | ||
129 | The driver is limited by the speed of the system's PCLK | 129 | The driver is limited by the speed of the system's PCLK |
130 | signal, so with reasonbaly fast systems (PCLK around 50-66MHz) | 130 | signal, so with reasonably fast systems (PCLK around 50-66MHz) |
131 | then watchdog intervals of over approximately 20seconds are | 131 | then watchdog intervals of over approximately 20seconds are |
132 | unavailable. | 132 | unavailable. |
133 | 133 | ||
@@ -423,7 +423,7 @@ config SBC_EPX_C3_WATCHDOG | |||
423 | is no way to know if writing to its IO address will corrupt | 423 | is no way to know if writing to its IO address will corrupt |
424 | your system or have any real effect. The only way to be sure | 424 | your system or have any real effect. The only way to be sure |
425 | that this driver does what you want is to make sure you | 425 | that this driver does what you want is to make sure you |
426 | are runnning it on an EPX-C3 from Winsystems with the watchdog | 426 | are running it on an EPX-C3 from Winsystems with the watchdog |
427 | timer at IO address 0x1ee and 0x1ef. It will write to both those | 427 | timer at IO address 0x1ee and 0x1ef. It will write to both those |
428 | IO ports. Basically, the assumption is made that if you compile | 428 | IO ports. Basically, the assumption is made that if you compile |
429 | this driver into your kernel and/or load it as a module, that you | 429 | this driver into your kernel and/or load it as a module, that you |
@@ -472,7 +472,7 @@ config INDYDOG | |||
472 | tristate "Indy/I2 Hardware Watchdog" | 472 | tristate "Indy/I2 Hardware Watchdog" |
473 | depends on WATCHDOG && SGI_IP22 | 473 | depends on WATCHDOG && SGI_IP22 |
474 | help | 474 | help |
475 | Hardwaredriver for the Indy's/I2's watchdog. This is a | 475 | Hardware driver for the Indy's/I2's watchdog. This is a |
476 | watchdog timer that will reboot the machine after a 60 second | 476 | watchdog timer that will reboot the machine after a 60 second |
477 | timer expired and no process has written to /dev/watchdog during | 477 | timer expired and no process has written to /dev/watchdog during |
478 | that time. | 478 | that time. |
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c index 2f962cfa3f7f..78810ba982e9 100644 --- a/drivers/ide/pci/generic.c +++ b/drivers/ide/pci/generic.c | |||
@@ -180,6 +180,36 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = { | |||
180 | .channels = 2, | 180 | .channels = 2, |
181 | .autodma = AUTODMA, | 181 | .autodma = AUTODMA, |
182 | .bootable = OFF_BOARD, | 182 | .bootable = OFF_BOARD, |
183 | },{ /* 15 */ | ||
184 | .name = "JMB361", | ||
185 | .init_hwif = init_hwif_generic, | ||
186 | .channels = 2, | ||
187 | .autodma = AUTODMA, | ||
188 | .bootable = OFF_BOARD, | ||
189 | },{ /* 16 */ | ||
190 | .name = "JMB363", | ||
191 | .init_hwif = init_hwif_generic, | ||
192 | .channels = 2, | ||
193 | .autodma = AUTODMA, | ||
194 | .bootable = OFF_BOARD, | ||
195 | },{ /* 17 */ | ||
196 | .name = "JMB365", | ||
197 | .init_hwif = init_hwif_generic, | ||
198 | .channels = 2, | ||
199 | .autodma = AUTODMA, | ||
200 | .bootable = OFF_BOARD, | ||
201 | },{ /* 18 */ | ||
202 | .name = "JMB366", | ||
203 | .init_hwif = init_hwif_generic, | ||
204 | .channels = 2, | ||
205 | .autodma = AUTODMA, | ||
206 | .bootable = OFF_BOARD, | ||
207 | },{ /* 19 */ | ||
208 | .name = "JMB368", | ||
209 | .init_hwif = init_hwif_generic, | ||
210 | .channels = 2, | ||
211 | .autodma = AUTODMA, | ||
212 | .bootable = OFF_BOARD, | ||
183 | } | 213 | } |
184 | }; | 214 | }; |
185 | 215 | ||
diff --git a/drivers/isdn/i4l/Kconfig b/drivers/isdn/i4l/Kconfig index a4f7288a1fc8..3ef567b99c74 100644 --- a/drivers/isdn/i4l/Kconfig +++ b/drivers/isdn/i4l/Kconfig | |||
@@ -5,6 +5,7 @@ | |||
5 | config ISDN_PPP | 5 | config ISDN_PPP |
6 | bool "Support synchronous PPP" | 6 | bool "Support synchronous PPP" |
7 | depends on INET | 7 | depends on INET |
8 | select SLHC | ||
8 | help | 9 | help |
9 | Over digital connections such as ISDN, there is no need to | 10 | Over digital connections such as ISDN, there is no need to |
10 | synchronize sender and recipient's clocks with start and stop bits | 11 | synchronize sender and recipient's clocks with start and stop bits |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 217615b33223..93f701ea87bc 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -710,6 +710,8 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc, | |||
710 | return -EINVAL; | 710 | return -EINVAL; |
711 | } | 711 | } |
712 | 712 | ||
713 | m->ti = ti; | ||
714 | |||
713 | r = parse_features(&as, m, ti); | 715 | r = parse_features(&as, m, ti); |
714 | if (r) | 716 | if (r) |
715 | goto bad; | 717 | goto bad; |
@@ -751,7 +753,6 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc, | |||
751 | } | 753 | } |
752 | 754 | ||
753 | ti->private = m; | 755 | ti->private = m; |
754 | m->ti = ti; | ||
755 | 756 | ||
756 | return 0; | 757 | return 0; |
757 | 758 | ||
diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c index d687a14ec0a7..06ac899a9a26 100644 --- a/drivers/media/dvb/bt8xx/dst.c +++ b/drivers/media/dvb/bt8xx/dst.c | |||
@@ -393,7 +393,7 @@ static int dst_set_bandwidth(struct dst_state *state, fe_bandwidth_t bandwidth) | |||
393 | state->bandwidth = bandwidth; | 393 | state->bandwidth = bandwidth; |
394 | 394 | ||
395 | if (state->dst_type != DST_TYPE_IS_TERR) | 395 | if (state->dst_type != DST_TYPE_IS_TERR) |
396 | return 0; | 396 | return -EOPNOTSUPP; |
397 | 397 | ||
398 | switch (bandwidth) { | 398 | switch (bandwidth) { |
399 | case BANDWIDTH_6_MHZ: | 399 | case BANDWIDTH_6_MHZ: |
@@ -462,7 +462,7 @@ static int dst_set_symbolrate(struct dst_state *state, u32 srate) | |||
462 | 462 | ||
463 | state->symbol_rate = srate; | 463 | state->symbol_rate = srate; |
464 | if (state->dst_type == DST_TYPE_IS_TERR) { | 464 | if (state->dst_type == DST_TYPE_IS_TERR) { |
465 | return 0; | 465 | return -EOPNOTSUPP; |
466 | } | 466 | } |
467 | dprintk(verbose, DST_INFO, 1, "set symrate %u", srate); | 467 | dprintk(verbose, DST_INFO, 1, "set symrate %u", srate); |
468 | srate /= 1000; | 468 | srate /= 1000; |
@@ -504,7 +504,7 @@ static int dst_set_symbolrate(struct dst_state *state, u32 srate) | |||
504 | static int dst_set_modulation(struct dst_state *state, fe_modulation_t modulation) | 504 | static int dst_set_modulation(struct dst_state *state, fe_modulation_t modulation) |
505 | { | 505 | { |
506 | if (state->dst_type != DST_TYPE_IS_CABLE) | 506 | if (state->dst_type != DST_TYPE_IS_CABLE) |
507 | return 0; | 507 | return -EOPNOTSUPP; |
508 | 508 | ||
509 | state->modulation = modulation; | 509 | state->modulation = modulation; |
510 | switch (modulation) { | 510 | switch (modulation) { |
@@ -1234,7 +1234,7 @@ int dst_command(struct dst_state *state, u8 *data, u8 len) | |||
1234 | goto error; | 1234 | goto error; |
1235 | } | 1235 | } |
1236 | if (write_dst(state, data, len)) { | 1236 | if (write_dst(state, data, len)) { |
1237 | dprintk(verbose, DST_INFO, 1, "Tring to recover.. "); | 1237 | dprintk(verbose, DST_INFO, 1, "Trying to recover.. "); |
1238 | if ((dst_error_recovery(state)) < 0) { | 1238 | if ((dst_error_recovery(state)) < 0) { |
1239 | dprintk(verbose, DST_ERROR, 1, "Recovery Failed."); | 1239 | dprintk(verbose, DST_ERROR, 1, "Recovery Failed."); |
1240 | goto error; | 1240 | goto error; |
@@ -1328,15 +1328,13 @@ static int dst_tone_power_cmd(struct dst_state *state) | |||
1328 | { | 1328 | { |
1329 | u8 paket[8] = { 0x00, 0x09, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00 }; | 1329 | u8 paket[8] = { 0x00, 0x09, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00 }; |
1330 | 1330 | ||
1331 | if (state->dst_type == DST_TYPE_IS_TERR) | 1331 | if (state->dst_type != DST_TYPE_IS_SAT) |
1332 | return 0; | 1332 | return -EOPNOTSUPP; |
1333 | paket[4] = state->tx_tuna[4]; | 1333 | paket[4] = state->tx_tuna[4]; |
1334 | paket[2] = state->tx_tuna[2]; | 1334 | paket[2] = state->tx_tuna[2]; |
1335 | paket[3] = state->tx_tuna[3]; | 1335 | paket[3] = state->tx_tuna[3]; |
1336 | paket[7] = dst_check_sum (paket, 7); | 1336 | paket[7] = dst_check_sum (paket, 7); |
1337 | dst_command(state, paket, 8); | 1337 | return dst_command(state, paket, 8); |
1338 | |||
1339 | return 0; | ||
1340 | } | 1338 | } |
1341 | 1339 | ||
1342 | static int dst_get_tuna(struct dst_state *state) | 1340 | static int dst_get_tuna(struct dst_state *state) |
@@ -1465,7 +1463,7 @@ static int dst_set_diseqc(struct dvb_frontend *fe, struct dvb_diseqc_master_cmd | |||
1465 | u8 paket[8] = { 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xf0, 0xec }; | 1463 | u8 paket[8] = { 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xf0, 0xec }; |
1466 | 1464 | ||
1467 | if (state->dst_type != DST_TYPE_IS_SAT) | 1465 | if (state->dst_type != DST_TYPE_IS_SAT) |
1468 | return 0; | 1466 | return -EOPNOTSUPP; |
1469 | if (cmd->msg_len > 0 && cmd->msg_len < 5) | 1467 | if (cmd->msg_len > 0 && cmd->msg_len < 5) |
1470 | memcpy(&paket[3], cmd->msg, cmd->msg_len); | 1468 | memcpy(&paket[3], cmd->msg, cmd->msg_len); |
1471 | else if (cmd->msg_len == 5 && state->dst_hw_cap & DST_TYPE_HAS_DISEQC5) | 1469 | else if (cmd->msg_len == 5 && state->dst_hw_cap & DST_TYPE_HAS_DISEQC5) |
@@ -1473,18 +1471,17 @@ static int dst_set_diseqc(struct dvb_frontend *fe, struct dvb_diseqc_master_cmd | |||
1473 | else | 1471 | else |
1474 | return -EINVAL; | 1472 | return -EINVAL; |
1475 | paket[7] = dst_check_sum(&paket[0], 7); | 1473 | paket[7] = dst_check_sum(&paket[0], 7); |
1476 | dst_command(state, paket, 8); | 1474 | return dst_command(state, paket, 8); |
1477 | return 0; | ||
1478 | } | 1475 | } |
1479 | 1476 | ||
1480 | static int dst_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) | 1477 | static int dst_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) |
1481 | { | 1478 | { |
1482 | int need_cmd; | 1479 | int need_cmd, retval = 0; |
1483 | struct dst_state *state = fe->demodulator_priv; | 1480 | struct dst_state *state = fe->demodulator_priv; |
1484 | 1481 | ||
1485 | state->voltage = voltage; | 1482 | state->voltage = voltage; |
1486 | if (state->dst_type != DST_TYPE_IS_SAT) | 1483 | if (state->dst_type != DST_TYPE_IS_SAT) |
1487 | return 0; | 1484 | return -EOPNOTSUPP; |
1488 | 1485 | ||
1489 | need_cmd = 0; | 1486 | need_cmd = 0; |
1490 | 1487 | ||
@@ -1506,9 +1503,9 @@ static int dst_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) | |||
1506 | } | 1503 | } |
1507 | 1504 | ||
1508 | if (need_cmd) | 1505 | if (need_cmd) |
1509 | dst_tone_power_cmd(state); | 1506 | retval = dst_tone_power_cmd(state); |
1510 | 1507 | ||
1511 | return 0; | 1508 | return retval; |
1512 | } | 1509 | } |
1513 | 1510 | ||
1514 | static int dst_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone) | 1511 | static int dst_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone) |
@@ -1517,7 +1514,7 @@ static int dst_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone) | |||
1517 | 1514 | ||
1518 | state->tone = tone; | 1515 | state->tone = tone; |
1519 | if (state->dst_type != DST_TYPE_IS_SAT) | 1516 | if (state->dst_type != DST_TYPE_IS_SAT) |
1520 | return 0; | 1517 | return -EOPNOTSUPP; |
1521 | 1518 | ||
1522 | switch (tone) { | 1519 | switch (tone) { |
1523 | case SEC_TONE_OFF: | 1520 | case SEC_TONE_OFF: |
@@ -1533,9 +1530,7 @@ static int dst_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone) | |||
1533 | default: | 1530 | default: |
1534 | return -EINVAL; | 1531 | return -EINVAL; |
1535 | } | 1532 | } |
1536 | dst_tone_power_cmd(state); | 1533 | return dst_tone_power_cmd(state); |
1537 | |||
1538 | return 0; | ||
1539 | } | 1534 | } |
1540 | 1535 | ||
1541 | static int dst_send_burst(struct dvb_frontend *fe, fe_sec_mini_cmd_t minicmd) | 1536 | static int dst_send_burst(struct dvb_frontend *fe, fe_sec_mini_cmd_t minicmd) |
@@ -1543,7 +1538,7 @@ static int dst_send_burst(struct dvb_frontend *fe, fe_sec_mini_cmd_t minicmd) | |||
1543 | struct dst_state *state = fe->demodulator_priv; | 1538 | struct dst_state *state = fe->demodulator_priv; |
1544 | 1539 | ||
1545 | if (state->dst_type != DST_TYPE_IS_SAT) | 1540 | if (state->dst_type != DST_TYPE_IS_SAT) |
1546 | return 0; | 1541 | return -EOPNOTSUPP; |
1547 | state->minicmd = minicmd; | 1542 | state->minicmd = minicmd; |
1548 | switch (minicmd) { | 1543 | switch (minicmd) { |
1549 | case SEC_MINI_A: | 1544 | case SEC_MINI_A: |
@@ -1553,9 +1548,7 @@ static int dst_send_burst(struct dvb_frontend *fe, fe_sec_mini_cmd_t minicmd) | |||
1553 | state->tx_tuna[3] = 0xff; | 1548 | state->tx_tuna[3] = 0xff; |
1554 | break; | 1549 | break; |
1555 | } | 1550 | } |
1556 | dst_tone_power_cmd(state); | 1551 | return dst_tone_power_cmd(state); |
1557 | |||
1558 | return 0; | ||
1559 | } | 1552 | } |
1560 | 1553 | ||
1561 | 1554 | ||
@@ -1608,28 +1601,31 @@ static int dst_read_signal_strength(struct dvb_frontend *fe, u16 *strength) | |||
1608 | { | 1601 | { |
1609 | struct dst_state *state = fe->demodulator_priv; | 1602 | struct dst_state *state = fe->demodulator_priv; |
1610 | 1603 | ||
1611 | dst_get_signal(state); | 1604 | int retval = dst_get_signal(state); |
1612 | *strength = state->decode_strength; | 1605 | *strength = state->decode_strength; |
1613 | 1606 | ||
1614 | return 0; | 1607 | return retval; |
1615 | } | 1608 | } |
1616 | 1609 | ||
1617 | static int dst_read_snr(struct dvb_frontend *fe, u16 *snr) | 1610 | static int dst_read_snr(struct dvb_frontend *fe, u16 *snr) |
1618 | { | 1611 | { |
1619 | struct dst_state *state = fe->demodulator_priv; | 1612 | struct dst_state *state = fe->demodulator_priv; |
1620 | 1613 | ||
1621 | dst_get_signal(state); | 1614 | int retval = dst_get_signal(state); |
1622 | *snr = state->decode_snr; | 1615 | *snr = state->decode_snr; |
1623 | 1616 | ||
1624 | return 0; | 1617 | return retval; |
1625 | } | 1618 | } |
1626 | 1619 | ||
1627 | static int dst_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) | 1620 | static int dst_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) |
1628 | { | 1621 | { |
1622 | int retval = -EINVAL; | ||
1629 | struct dst_state *state = fe->demodulator_priv; | 1623 | struct dst_state *state = fe->demodulator_priv; |
1630 | 1624 | ||
1631 | if (p != NULL) { | 1625 | if (p != NULL) { |
1632 | dst_set_freq(state, p->frequency); | 1626 | retval = dst_set_freq(state, p->frequency); |
1627 | if(retval != 0) | ||
1628 | return retval; | ||
1633 | dprintk(verbose, DST_DEBUG, 1, "Set Frequency=[%d]", p->frequency); | 1629 | dprintk(verbose, DST_DEBUG, 1, "Set Frequency=[%d]", p->frequency); |
1634 | 1630 | ||
1635 | if (state->dst_type == DST_TYPE_IS_SAT) { | 1631 | if (state->dst_type == DST_TYPE_IS_SAT) { |
@@ -1647,10 +1643,10 @@ static int dst_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_paramet | |||
1647 | dst_set_symbolrate(state, p->u.qam.symbol_rate); | 1643 | dst_set_symbolrate(state, p->u.qam.symbol_rate); |
1648 | dst_set_modulation(state, p->u.qam.modulation); | 1644 | dst_set_modulation(state, p->u.qam.modulation); |
1649 | } | 1645 | } |
1650 | dst_write_tuna(fe); | 1646 | retval = dst_write_tuna(fe); |
1651 | } | 1647 | } |
1652 | 1648 | ||
1653 | return 0; | 1649 | return retval; |
1654 | } | 1650 | } |
1655 | 1651 | ||
1656 | static int dst_tune_frontend(struct dvb_frontend* fe, | 1652 | static int dst_tune_frontend(struct dvb_frontend* fe, |
diff --git a/drivers/media/dvb/dvb-core/Makefile b/drivers/media/dvb/dvb-core/Makefile index 11054657fdb5..0b5182835cc8 100644 --- a/drivers/media/dvb/dvb-core/Makefile +++ b/drivers/media/dvb/dvb-core/Makefile | |||
@@ -2,8 +2,8 @@ | |||
2 | # Makefile for the kernel DVB device drivers. | 2 | # Makefile for the kernel DVB device drivers. |
3 | # | 3 | # |
4 | 4 | ||
5 | dvb-core-objs = dvbdev.o dmxdev.o dvb_demux.o dvb_filter.o \ | 5 | dvb-core-objs := dvbdev.o dmxdev.o dvb_demux.o dvb_filter.o \ |
6 | dvb_ca_en50221.o dvb_frontend.o \ | 6 | dvb_ca_en50221.o dvb_frontend.o \ |
7 | dvb_net.o dvb_ringbuffer.o dvb_math.o | 7 | dvb_net.o dvb_ringbuffer.o dvb_math.o |
8 | 8 | ||
9 | obj-$(CONFIG_DVB_CORE) += dvb-core.o | 9 | obj-$(CONFIG_DVB_CORE) += dvb-core.o |
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig index de3128a31de8..220076b1b956 100644 --- a/drivers/media/radio/Kconfig +++ b/drivers/media/radio/Kconfig | |||
@@ -350,5 +350,15 @@ config RADIO_ZOLTRIX_PORT | |||
350 | help | 350 | help |
351 | Enter the I/O port of your Zoltrix radio card. | 351 | Enter the I/O port of your Zoltrix radio card. |
352 | 352 | ||
353 | endmenu | 353 | config USB_DSBR |
354 | tristate "D-Link USB FM radio support (EXPERIMENTAL)" | ||
355 | depends on USB && VIDEO_V4L1 && EXPERIMENTAL | ||
356 | ---help--- | ||
357 | Say Y here if you want to connect this type of radio to your | ||
358 | computer's USB port. Note that the audio is not digital, and | ||
359 | you must connect the line out connector to a sound card or a | ||
360 | set of speakers. | ||
354 | 361 | ||
362 | To compile this driver as a module, choose M here: the | ||
363 | module will be called dsbr100. | ||
364 | endmenu | ||
diff --git a/drivers/media/radio/Makefile b/drivers/media/radio/Makefile index e95b6805e002..cf55a18e3ddf 100644 --- a/drivers/media/radio/Makefile +++ b/drivers/media/radio/Makefile | |||
@@ -20,5 +20,6 @@ obj-$(CONFIG_RADIO_GEMTEK) += radio-gemtek.o | |||
20 | obj-$(CONFIG_RADIO_GEMTEK_PCI) += radio-gemtek-pci.o | 20 | obj-$(CONFIG_RADIO_GEMTEK_PCI) += radio-gemtek-pci.o |
21 | obj-$(CONFIG_RADIO_TRUST) += radio-trust.o | 21 | obj-$(CONFIG_RADIO_TRUST) += radio-trust.o |
22 | obj-$(CONFIG_RADIO_MAESTRO) += radio-maestro.o | 22 | obj-$(CONFIG_RADIO_MAESTRO) += radio-maestro.o |
23 | obj-$(CONFIG_USB_DSBR) += dsbr100.o | ||
23 | 24 | ||
24 | EXTRA_CFLAGS += -Isound | 25 | EXTRA_CFLAGS += -Isound |
diff --git a/drivers/media/video/dsbr100.c b/drivers/media/radio/dsbr100.c index f7e33f9ee8e9..f7e33f9ee8e9 100644 --- a/drivers/media/video/dsbr100.c +++ b/drivers/media/radio/dsbr100.c | |||
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index fe56862d51e4..732bf1e7c326 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -449,18 +449,6 @@ source "drivers/media/video/pvrusb2/Kconfig" | |||
449 | 449 | ||
450 | source "drivers/media/video/em28xx/Kconfig" | 450 | source "drivers/media/video/em28xx/Kconfig" |
451 | 451 | ||
452 | config USB_DSBR | ||
453 | tristate "D-Link USB FM radio support (EXPERIMENTAL)" | ||
454 | depends on USB && VIDEO_V4L1 && EXPERIMENTAL | ||
455 | ---help--- | ||
456 | Say Y here if you want to connect this type of radio to your | ||
457 | computer's USB port. Note that the audio is not digital, and | ||
458 | you must connect the line out connector to a sound card or a | ||
459 | set of speakers. | ||
460 | |||
461 | To compile this driver as a module, choose M here: the | ||
462 | module will be called dsbr100. | ||
463 | |||
464 | source "drivers/media/video/usbvideo/Kconfig" | 452 | source "drivers/media/video/usbvideo/Kconfig" |
465 | 453 | ||
466 | source "drivers/media/video/et61x251/Kconfig" | 454 | source "drivers/media/video/et61x251/Kconfig" |
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 353d61cfac1b..e82e511f2a72 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile | |||
@@ -77,7 +77,6 @@ obj-$(CONFIG_VIDEO_UPD64083) += upd64083.o | |||
77 | obj-$(CONFIG_VIDEO_CX2341X) += cx2341x.o | 77 | obj-$(CONFIG_VIDEO_CX2341X) += cx2341x.o |
78 | 78 | ||
79 | obj-$(CONFIG_USB_DABUSB) += dabusb.o | 79 | obj-$(CONFIG_USB_DABUSB) += dabusb.o |
80 | obj-$(CONFIG_USB_DSBR) += dsbr100.o | ||
81 | obj-$(CONFIG_USB_OV511) += ov511.o | 80 | obj-$(CONFIG_USB_OV511) += ov511.o |
82 | obj-$(CONFIG_USB_SE401) += se401.o | 81 | obj-$(CONFIG_USB_SE401) += se401.o |
83 | obj-$(CONFIG_USB_STV680) += stv680.o | 82 | obj-$(CONFIG_USB_STV680) += stv680.o |
@@ -91,6 +90,7 @@ obj-$(CONFIG_USB_ZC0301) += zc0301/ | |||
91 | obj-$(CONFIG_USB_IBMCAM) += usbvideo/ | 90 | obj-$(CONFIG_USB_IBMCAM) += usbvideo/ |
92 | obj-$(CONFIG_USB_KONICAWC) += usbvideo/ | 91 | obj-$(CONFIG_USB_KONICAWC) += usbvideo/ |
93 | obj-$(CONFIG_USB_VICAM) += usbvideo/ | 92 | obj-$(CONFIG_USB_VICAM) += usbvideo/ |
93 | obj-$(CONFIG_USB_QUICKCAM_MESSENGER) += usbvideo/ | ||
94 | 94 | ||
95 | obj-$(CONFIG_VIDEO_VIVI) += vivi.o | 95 | obj-$(CONFIG_VIDEO_VIVI) += vivi.o |
96 | 96 | ||
diff --git a/drivers/media/video/compat_ioctl32.c b/drivers/media/video/compat_ioctl32.c index 9dddff42ec13..b69ee1194815 100644 --- a/drivers/media/video/compat_ioctl32.c +++ b/drivers/media/video/compat_ioctl32.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #ifdef CONFIG_COMPAT | 22 | #ifdef CONFIG_COMPAT |
23 | 23 | ||
24 | 24 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | |
25 | struct video_tuner32 { | 25 | struct video_tuner32 { |
26 | compat_int_t tuner; | 26 | compat_int_t tuner; |
27 | char name[32]; | 27 | char name[32]; |
@@ -107,6 +107,7 @@ struct video_window32 { | |||
107 | compat_caddr_t clips; | 107 | compat_caddr_t clips; |
108 | compat_int_t clipcount; | 108 | compat_int_t clipcount; |
109 | }; | 109 | }; |
110 | #endif | ||
110 | 111 | ||
111 | static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 112 | static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
112 | { | 113 | { |
@@ -124,6 +125,7 @@ static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
124 | } | 125 | } |
125 | 126 | ||
126 | 127 | ||
128 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
127 | /* You get back everything except the clips... */ | 129 | /* You get back everything except the clips... */ |
128 | static int put_video_window32(struct video_window *kp, struct video_window32 __user *up) | 130 | static int put_video_window32(struct video_window *kp, struct video_window32 __user *up) |
129 | { | 131 | { |
@@ -138,6 +140,7 @@ static int put_video_window32(struct video_window *kp, struct video_window32 __u | |||
138 | return -EFAULT; | 140 | return -EFAULT; |
139 | return 0; | 141 | return 0; |
140 | } | 142 | } |
143 | #endif | ||
141 | 144 | ||
142 | struct v4l2_clip32 | 145 | struct v4l2_clip32 |
143 | { | 146 | { |
@@ -490,6 +493,7 @@ static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user | |||
490 | return 0; | 493 | return 0; |
491 | } | 494 | } |
492 | 495 | ||
496 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
493 | struct video_code32 | 497 | struct video_code32 |
494 | { | 498 | { |
495 | char loadwhat[16]; /* name or tag of file being passed */ | 499 | char loadwhat[16]; /* name or tag of file being passed */ |
@@ -517,6 +521,8 @@ static inline int microcode32(struct video_code *kp, struct video_code32 __user | |||
517 | #define VIDIOCSFREQ32 _IOW('v',15, u32) | 521 | #define VIDIOCSFREQ32 _IOW('v',15, u32) |
518 | #define VIDIOCSMICROCODE32 _IOW('v',27, struct video_code32) | 522 | #define VIDIOCSMICROCODE32 _IOW('v',27, struct video_code32) |
519 | 523 | ||
524 | #endif | ||
525 | |||
520 | /* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */ | 526 | /* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */ |
521 | #define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4) | 527 | #define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4) |
522 | #define VIDIOC_G_FMT32 _IOWR ('V', 4, struct v4l2_format32) | 528 | #define VIDIOC_G_FMT32 _IOWR ('V', 4, struct v4l2_format32) |
@@ -537,6 +543,7 @@ static inline int microcode32(struct video_code *kp, struct video_code32 __user | |||
537 | #define VIDIOC_S_INPUT32 _IOWR ('V', 39, compat_int_t) | 543 | #define VIDIOC_S_INPUT32 _IOWR ('V', 39, compat_int_t) |
538 | #define VIDIOC_TRY_FMT32 _IOWR ('V', 64, struct v4l2_format32) | 544 | #define VIDIOC_TRY_FMT32 _IOWR ('V', 64, struct v4l2_format32) |
539 | 545 | ||
546 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
540 | enum { | 547 | enum { |
541 | MaxClips = (~0U-sizeof(struct video_window))/sizeof(struct video_clip) | 548 | MaxClips = (~0U-sizeof(struct video_window))/sizeof(struct video_clip) |
542 | }; | 549 | }; |
@@ -601,14 +608,17 @@ static int do_set_window(struct file *file, unsigned int cmd, unsigned long arg) | |||
601 | 608 | ||
602 | return native_ioctl(file, VIDIOCSWIN, (unsigned long)vw); | 609 | return native_ioctl(file, VIDIOCSWIN, (unsigned long)vw); |
603 | } | 610 | } |
611 | #endif | ||
604 | 612 | ||
605 | static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 613 | static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
606 | { | 614 | { |
607 | union { | 615 | union { |
616 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
608 | struct video_tuner vt; | 617 | struct video_tuner vt; |
609 | struct video_buffer vb; | 618 | struct video_buffer vb; |
610 | struct video_window vw; | 619 | struct video_window vw; |
611 | struct video_code vc; | 620 | struct video_code vc; |
621 | #endif | ||
612 | struct v4l2_format v2f; | 622 | struct v4l2_format v2f; |
613 | struct v4l2_buffer v2b; | 623 | struct v4l2_buffer v2b; |
614 | struct v4l2_framebuffer v2fb; | 624 | struct v4l2_framebuffer v2fb; |
@@ -624,6 +634,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
624 | 634 | ||
625 | /* First, convert the command. */ | 635 | /* First, convert the command. */ |
626 | switch(cmd) { | 636 | switch(cmd) { |
637 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
627 | case VIDIOCGTUNER32: cmd = VIDIOCGTUNER; break; | 638 | case VIDIOCGTUNER32: cmd = VIDIOCGTUNER; break; |
628 | case VIDIOCSTUNER32: cmd = VIDIOCSTUNER; break; | 639 | case VIDIOCSTUNER32: cmd = VIDIOCSTUNER; break; |
629 | case VIDIOCGWIN32: cmd = VIDIOCGWIN; break; | 640 | case VIDIOCGWIN32: cmd = VIDIOCGWIN; break; |
@@ -631,6 +642,8 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
631 | case VIDIOCSFBUF32: cmd = VIDIOCSFBUF; break; | 642 | case VIDIOCSFBUF32: cmd = VIDIOCSFBUF; break; |
632 | case VIDIOCGFREQ32: cmd = VIDIOCGFREQ; break; | 643 | case VIDIOCGFREQ32: cmd = VIDIOCGFREQ; break; |
633 | case VIDIOCSFREQ32: cmd = VIDIOCSFREQ; break; | 644 | case VIDIOCSFREQ32: cmd = VIDIOCSFREQ; break; |
645 | case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break; | ||
646 | #endif | ||
634 | case VIDIOC_G_FMT32: cmd = VIDIOC_G_FMT; break; | 647 | case VIDIOC_G_FMT32: cmd = VIDIOC_G_FMT; break; |
635 | case VIDIOC_S_FMT32: cmd = VIDIOC_S_FMT; break; | 648 | case VIDIOC_S_FMT32: cmd = VIDIOC_S_FMT; break; |
636 | case VIDIOC_QUERYBUF32: cmd = VIDIOC_QUERYBUF; break; | 649 | case VIDIOC_QUERYBUF32: cmd = VIDIOC_QUERYBUF; break; |
@@ -647,10 +660,10 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
647 | case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break; | 660 | case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break; |
648 | case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break; | 661 | case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break; |
649 | case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break; | 662 | case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break; |
650 | case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break; | ||
651 | }; | 663 | }; |
652 | 664 | ||
653 | switch(cmd) { | 665 | switch(cmd) { |
666 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
654 | case VIDIOCSTUNER: | 667 | case VIDIOCSTUNER: |
655 | case VIDIOCGTUNER: | 668 | case VIDIOCGTUNER: |
656 | err = get_video_tuner32(&karg.vt, up); | 669 | err = get_video_tuner32(&karg.vt, up); |
@@ -664,6 +677,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
664 | break; | 677 | break; |
665 | 678 | ||
666 | case VIDIOCSFREQ: | 679 | case VIDIOCSFREQ: |
680 | #endif | ||
667 | case VIDIOC_S_INPUT: | 681 | case VIDIOC_S_INPUT: |
668 | case VIDIOC_OVERLAY: | 682 | case VIDIOC_OVERLAY: |
669 | case VIDIOC_STREAMON: | 683 | case VIDIOC_STREAMON: |
@@ -717,18 +731,21 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
717 | compatible_arg = 0; | 731 | compatible_arg = 0; |
718 | break; | 732 | break; |
719 | 733 | ||
734 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
720 | case VIDIOCGWIN: | 735 | case VIDIOCGWIN: |
721 | case VIDIOCGFBUF: | 736 | case VIDIOCGFBUF: |
722 | case VIDIOCGFREQ: | 737 | case VIDIOCGFREQ: |
738 | #endif | ||
723 | case VIDIOC_G_FBUF: | 739 | case VIDIOC_G_FBUF: |
724 | case VIDIOC_G_INPUT: | 740 | case VIDIOC_G_INPUT: |
725 | compatible_arg = 0; | 741 | compatible_arg = 0; |
742 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
726 | case VIDIOCSMICROCODE: | 743 | case VIDIOCSMICROCODE: |
727 | err = microcode32(&karg.vc, up); | 744 | err = microcode32(&karg.vc, up); |
728 | compatible_arg = 0; | 745 | compatible_arg = 0; |
729 | break; | 746 | break; |
747 | #endif | ||
730 | }; | 748 | }; |
731 | |||
732 | if(err) | 749 | if(err) |
733 | goto out; | 750 | goto out; |
734 | 751 | ||
@@ -743,6 +760,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
743 | } | 760 | } |
744 | if(err == 0) { | 761 | if(err == 0) { |
745 | switch(cmd) { | 762 | switch(cmd) { |
763 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
746 | case VIDIOCGTUNER: | 764 | case VIDIOCGTUNER: |
747 | err = put_video_tuner32(&karg.vt, up); | 765 | err = put_video_tuner32(&karg.vt, up); |
748 | break; | 766 | break; |
@@ -754,7 +772,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
754 | case VIDIOCGFBUF: | 772 | case VIDIOCGFBUF: |
755 | err = put_video_buffer32(&karg.vb, up); | 773 | err = put_video_buffer32(&karg.vb, up); |
756 | break; | 774 | break; |
757 | 775 | #endif | |
758 | case VIDIOC_G_FBUF: | 776 | case VIDIOC_G_FBUF: |
759 | err = put_v4l2_framebuffer32(&karg.v2fb, up); | 777 | err = put_v4l2_framebuffer32(&karg.v2fb, up); |
760 | break; | 778 | break; |
@@ -792,7 +810,9 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
792 | err = put_v4l2_input32(&karg.v2i, up); | 810 | err = put_v4l2_input32(&karg.v2i, up); |
793 | break; | 811 | break; |
794 | 812 | ||
813 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
795 | case VIDIOCGFREQ: | 814 | case VIDIOCGFREQ: |
815 | #endif | ||
796 | case VIDIOC_G_INPUT: | 816 | case VIDIOC_G_INPUT: |
797 | err = put_user(((u32)karg.vx), (u32 __user *)up); | 817 | err = put_user(((u32)karg.vx), (u32 __user *)up); |
798 | break; | 818 | break; |
@@ -810,6 +830,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) | |||
810 | return ret; | 830 | return ret; |
811 | 831 | ||
812 | switch (cmd) { | 832 | switch (cmd) { |
833 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
813 | case VIDIOCSWIN32: | 834 | case VIDIOCSWIN32: |
814 | ret = do_set_window(file, cmd, arg); | 835 | ret = do_set_window(file, cmd, arg); |
815 | break; | 836 | break; |
@@ -820,6 +841,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) | |||
820 | case VIDIOCSFBUF32: | 841 | case VIDIOCSFBUF32: |
821 | case VIDIOCGFREQ32: | 842 | case VIDIOCGFREQ32: |
822 | case VIDIOCSFREQ32: | 843 | case VIDIOCSFREQ32: |
844 | #endif | ||
823 | case VIDIOC_QUERYCAP: | 845 | case VIDIOC_QUERYCAP: |
824 | case VIDIOC_ENUM_FMT: | 846 | case VIDIOC_ENUM_FMT: |
825 | case VIDIOC_G_FMT32: | 847 | case VIDIOC_G_FMT32: |
@@ -851,6 +873,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) | |||
851 | ret = do_video_ioctl(file, cmd, arg); | 873 | ret = do_video_ioctl(file, cmd, arg); |
852 | break; | 874 | break; |
853 | 875 | ||
876 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
854 | /* Little v, the video4linux ioctls (conflict?) */ | 877 | /* Little v, the video4linux ioctls (conflict?) */ |
855 | case VIDIOCGCAP: | 878 | case VIDIOCGCAP: |
856 | case VIDIOCGCHAN: | 879 | case VIDIOCGCHAN: |
@@ -879,6 +902,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) | |||
879 | case _IOR('v' , BASE_VIDIOCPRIVATE+7, int): | 902 | case _IOR('v' , BASE_VIDIOCPRIVATE+7, int): |
880 | ret = native_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); | 903 | ret = native_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); |
881 | break; | 904 | break; |
905 | #endif | ||
882 | default: | 906 | default: |
883 | v4l_print_ioctl("compat_ioctl32", cmd); | 907 | v4l_print_ioctl("compat_ioctl32", cmd); |
884 | } | 908 | } |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 5c2036b40ea1..7bb7589a07c3 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -104,8 +104,8 @@ u32 cx25840_read4(struct i2c_client * client, u16 addr) | |||
104 | if (i2c_master_recv(client, buffer, 4) < 4) | 104 | if (i2c_master_recv(client, buffer, 4) < 4) |
105 | return 0; | 105 | return 0; |
106 | 106 | ||
107 | return (buffer[0] << 24) | (buffer[1] << 16) | | 107 | return (buffer[3] << 24) | (buffer[2] << 16) | |
108 | (buffer[2] << 8) | buffer[3]; | 108 | (buffer[1] << 8) | buffer[0]; |
109 | } | 109 | } |
110 | 110 | ||
111 | int cx25840_and_or(struct i2c_client *client, u16 addr, unsigned and_mask, | 111 | int cx25840_and_or(struct i2c_client *client, u16 addr, unsigned and_mask, |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 547cdbdb644d..94c92bacc342 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -1225,7 +1225,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1225 | struct v4l2_format *f = arg; | 1225 | struct v4l2_format *f = arg; |
1226 | return cx8800_try_fmt(dev,fh,f); | 1226 | return cx8800_try_fmt(dev,fh,f); |
1227 | } | 1227 | } |
1228 | #ifdef CONFIG_V4L1_COMPAT | 1228 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
1229 | /* --- streaming capture ------------------------------------- */ | 1229 | /* --- streaming capture ------------------------------------- */ |
1230 | case VIDIOCGMBUF: | 1230 | case VIDIOCGMBUF: |
1231 | { | 1231 | { |
@@ -1584,7 +1584,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
1584 | *id = 0; | 1584 | *id = 0; |
1585 | return 0; | 1585 | return 0; |
1586 | } | 1586 | } |
1587 | #ifdef CONFIG_V4L1_COMPAT | 1587 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
1588 | case VIDIOCSTUNER: | 1588 | case VIDIOCSTUNER: |
1589 | { | 1589 | { |
1590 | struct video_tuner *v = arg; | 1590 | struct video_tuner *v = arg; |
diff --git a/drivers/media/video/msp3400-kthreads.c b/drivers/media/video/msp3400-kthreads.c index f2fd9195b3ac..ed02ff811388 100644 --- a/drivers/media/video/msp3400-kthreads.c +++ b/drivers/media/video/msp3400-kthreads.c | |||
@@ -961,10 +961,10 @@ int msp34xxg_thread(void *data) | |||
961 | /* setup the chip*/ | 961 | /* setup the chip*/ |
962 | msp34xxg_reset(client); | 962 | msp34xxg_reset(client); |
963 | state->std = state->radio ? 0x40 : msp_standard; | 963 | state->std = state->radio ? 0x40 : msp_standard; |
964 | if (state->std != 1) | ||
965 | goto unmute; | ||
966 | /* start autodetect */ | 964 | /* start autodetect */ |
967 | msp_write_dem(client, 0x20, state->std); | 965 | msp_write_dem(client, 0x20, state->std); |
966 | if (state->std != 1) | ||
967 | goto unmute; | ||
968 | 968 | ||
969 | /* watch autodetect */ | 969 | /* watch autodetect */ |
970 | v4l_dbg(1, msp_debug, client, "started autodetect, waiting for result\n"); | 970 | v4l_dbg(1, msp_debug, client, "started autodetect, waiting for result\n"); |
diff --git a/drivers/media/video/pwc/Kconfig b/drivers/media/video/pwc/Kconfig index 697145e0bf15..8fdf7101d3bf 100644 --- a/drivers/media/video/pwc/Kconfig +++ b/drivers/media/video/pwc/Kconfig | |||
@@ -30,7 +30,7 @@ config USB_PWC | |||
30 | 30 | ||
31 | config USB_PWC_DEBUG | 31 | config USB_PWC_DEBUG |
32 | bool "USB Philips Cameras verbose debug" | 32 | bool "USB Philips Cameras verbose debug" |
33 | depends USB_PWC | 33 | depends on USB_PWC |
34 | help | 34 | help |
35 | Say Y here in order to have the pwc driver generate verbose debugging | 35 | Say Y here in order to have the pwc driver generate verbose debugging |
36 | messages. | 36 | messages. |
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index 47d0d83a0264..d4703944df9c 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c | |||
@@ -160,6 +160,7 @@ static struct file_operations pwc_fops = { | |||
160 | .poll = pwc_video_poll, | 160 | .poll = pwc_video_poll, |
161 | .mmap = pwc_video_mmap, | 161 | .mmap = pwc_video_mmap, |
162 | .ioctl = pwc_video_ioctl, | 162 | .ioctl = pwc_video_ioctl, |
163 | .compat_ioctl = v4l_compat_ioctl32, | ||
163 | .llseek = no_llseek, | 164 | .llseek = no_llseek, |
164 | }; | 165 | }; |
165 | static struct video_device pwc_template = { | 166 | static struct video_device pwc_template = { |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 8656f2400e18..2c171af9a9f2 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -2087,7 +2087,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
2087 | struct v4l2_format *f = arg; | 2087 | struct v4l2_format *f = arg; |
2088 | return saa7134_try_fmt(dev,fh,f); | 2088 | return saa7134_try_fmt(dev,fh,f); |
2089 | } | 2089 | } |
2090 | #ifdef CONFIG_V4L1_COMPAT | 2090 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
2091 | case VIDIOCGMBUF: | 2091 | case VIDIOCGMBUF: |
2092 | { | 2092 | { |
2093 | struct video_mbuf *mbuf = arg; | 2093 | struct video_mbuf *mbuf = arg; |
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c index a167e17c6dcd..d7eadc2c298d 100644 --- a/drivers/media/video/tuner-types.c +++ b/drivers/media/video/tuner-types.c | |||
@@ -1027,10 +1027,11 @@ static struct tuner_params tuner_tnf_5335mf_params[] = { | |||
1027 | /* 70-79 */ | 1027 | /* 70-79 */ |
1028 | /* ------------ TUNER_SAMSUNG_TCPN_2121P30A - Samsung NTSC ------------ */ | 1028 | /* ------------ TUNER_SAMSUNG_TCPN_2121P30A - Samsung NTSC ------------ */ |
1029 | 1029 | ||
1030 | /* '+ 4' turns on the Low Noise Amplifier */ | ||
1030 | static struct tuner_range tuner_samsung_tcpn_2121p30a_ntsc_ranges[] = { | 1031 | static struct tuner_range tuner_samsung_tcpn_2121p30a_ntsc_ranges[] = { |
1031 | { 16 * 130.00 /*MHz*/, 0xce, 0x01, }, | 1032 | { 16 * 130.00 /*MHz*/, 0xce, 0x01 + 4, }, |
1032 | { 16 * 364.50 /*MHz*/, 0xce, 0x02, }, | 1033 | { 16 * 364.50 /*MHz*/, 0xce, 0x02 + 4, }, |
1033 | { 16 * 999.99 , 0xce, 0x08, }, | 1034 | { 16 * 999.99 , 0xce, 0x08 + 4, }, |
1034 | }; | 1035 | }; |
1035 | 1036 | ||
1036 | static struct tuner_params tuner_samsung_tcpn_2121p30a_params[] = { | 1037 | static struct tuner_params tuner_samsung_tcpn_2121p30a_params[] = { |
@@ -1060,10 +1061,11 @@ static struct tuner_params tuner_thomson_fe6600_params[] = { | |||
1060 | 1061 | ||
1061 | /* ------------ TUNER_SAMSUNG_TCPG_6121P30A - Samsung PAL ------------ */ | 1062 | /* ------------ TUNER_SAMSUNG_TCPG_6121P30A - Samsung PAL ------------ */ |
1062 | 1063 | ||
1064 | /* '+ 4' turns on the Low Noise Amplifier */ | ||
1063 | static struct tuner_range tuner_samsung_tcpg_6121p30a_pal_ranges[] = { | 1065 | static struct tuner_range tuner_samsung_tcpg_6121p30a_pal_ranges[] = { |
1064 | { 16 * 146.25 /*MHz*/, 0xce, 0x01, }, | 1066 | { 16 * 146.25 /*MHz*/, 0xce, 0x01 + 4, }, |
1065 | { 16 * 428.50 /*MHz*/, 0xce, 0x02, }, | 1067 | { 16 * 428.50 /*MHz*/, 0xce, 0x02 + 4, }, |
1066 | { 16 * 999.99 , 0xce, 0x08, }, | 1068 | { 16 * 999.99 , 0xce, 0x08 + 4, }, |
1067 | }; | 1069 | }; |
1068 | 1070 | ||
1069 | static struct tuner_params tuner_samsung_tcpg_6121p30a_params[] = { | 1071 | static struct tuner_params tuner_samsung_tcpg_6121p30a_params[] = { |
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c index d83a2c84d233..d7c3fcbc80f7 100644 --- a/drivers/media/video/v4l1-compat.c +++ b/drivers/media/video/v4l1-compat.c | |||
@@ -599,6 +599,10 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
599 | dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %d\n",err); | 599 | dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %d\n",err); |
600 | break; | 600 | break; |
601 | } | 601 | } |
602 | |||
603 | pict->depth = ((fmt2->fmt.pix.bytesperline<<3) | ||
604 | + (fmt2->fmt.pix.width-1) ) | ||
605 | /fmt2->fmt.pix.width; | ||
602 | pict->palette = pixelformat_to_palette( | 606 | pict->palette = pixelformat_to_palette( |
603 | fmt2->fmt.pix.pixelformat); | 607 | fmt2->fmt.pix.pixelformat); |
604 | break; | 608 | break; |
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 2ecbeffb559e..8d972ffdaf98 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -202,7 +202,7 @@ static char *v4l2_memory_names[] = { | |||
202 | /* ------------------------------------------------------------------ */ | 202 | /* ------------------------------------------------------------------ */ |
203 | /* debug help functions */ | 203 | /* debug help functions */ |
204 | 204 | ||
205 | #ifdef CONFIG_V4L1_COMPAT | 205 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
206 | static const char *v4l1_ioctls[] = { | 206 | static const char *v4l1_ioctls[] = { |
207 | [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP", | 207 | [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP", |
208 | [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN", | 208 | [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN", |
@@ -301,7 +301,7 @@ static const char *v4l2_ioctls[] = { | |||
301 | #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) | 301 | #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) |
302 | 302 | ||
303 | static const char *v4l2_int_ioctls[] = { | 303 | static const char *v4l2_int_ioctls[] = { |
304 | #ifdef CONFIG_V4L1_COMPAT | 304 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
305 | [_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES", | 305 | [_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES", |
306 | [_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS", | 306 | [_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS", |
307 | [_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM", | 307 | [_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM", |
@@ -367,7 +367,7 @@ void v4l_printk_ioctl(unsigned int cmd) | |||
367 | (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ? | 367 | (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ? |
368 | v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); | 368 | v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); |
369 | break; | 369 | break; |
370 | #ifdef CONFIG_V4L1_COMPAT | 370 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
371 | case 'v': | 371 | case 'v': |
372 | printk("v4l1 ioctl %s, dir=%s (0x%08x)\n", | 372 | printk("v4l1 ioctl %s, dir=%s (0x%08x)\n", |
373 | (_IOC_NR(cmd) < V4L1_IOCTLS) ? | 373 | (_IOC_NR(cmd) < V4L1_IOCTLS) ? |
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index 0fc90cd393f6..88bf2af2a0e7 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c | |||
@@ -760,7 +760,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
760 | ret=vfd->vidioc_overlay(file, fh, *i); | 760 | ret=vfd->vidioc_overlay(file, fh, *i); |
761 | break; | 761 | break; |
762 | } | 762 | } |
763 | #ifdef CONFIG_V4L1_COMPAT | 763 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
764 | /* --- streaming capture ------------------------------------- */ | 764 | /* --- streaming capture ------------------------------------- */ |
765 | case VIDIOCGMBUF: | 765 | case VIDIOCGMBUF: |
766 | { | 766 | { |
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 38bd0c1018c2..841884af0cc0 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c | |||
@@ -986,7 +986,7 @@ static int vidioc_dqbuf (struct file *file, void *priv, struct v4l2_buffer *p) | |||
986 | file->f_flags & O_NONBLOCK)); | 986 | file->f_flags & O_NONBLOCK)); |
987 | } | 987 | } |
988 | 988 | ||
989 | #ifdef CONFIG_V4L1_COMPAT | 989 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
990 | static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf) | 990 | static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf) |
991 | { | 991 | { |
992 | struct vivi_fh *fh=priv; | 992 | struct vivi_fh *fh=priv; |
@@ -1328,7 +1328,7 @@ static struct video_device vivi = { | |||
1328 | .vidioc_s_ctrl = vidioc_s_ctrl, | 1328 | .vidioc_s_ctrl = vidioc_s_ctrl, |
1329 | .vidioc_streamon = vidioc_streamon, | 1329 | .vidioc_streamon = vidioc_streamon, |
1330 | .vidioc_streamoff = vidioc_streamoff, | 1330 | .vidioc_streamoff = vidioc_streamoff, |
1331 | #ifdef CONFIG_V4L1_COMPAT | 1331 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
1332 | .vidiocgmbuf = vidiocgmbuf, | 1332 | .vidiocgmbuf = vidiocgmbuf, |
1333 | #endif | 1333 | #endif |
1334 | .tvnorms = tvnorms, | 1334 | .tvnorms = tvnorms, |
diff --git a/drivers/mmc/mmc_queue.c b/drivers/mmc/mmc_queue.c index 0b9682e9a357..74f8cdeeff0f 100644 --- a/drivers/mmc/mmc_queue.c +++ b/drivers/mmc/mmc_queue.c | |||
@@ -79,7 +79,8 @@ static int mmc_queue_thread(void *d) | |||
79 | spin_lock_irq(q->queue_lock); | 79 | spin_lock_irq(q->queue_lock); |
80 | set_current_state(TASK_INTERRUPTIBLE); | 80 | set_current_state(TASK_INTERRUPTIBLE); |
81 | if (!blk_queue_plugged(q)) | 81 | if (!blk_queue_plugged(q)) |
82 | mq->req = req = elv_next_request(q); | 82 | req = elv_next_request(q); |
83 | mq->req = req; | ||
83 | spin_unlock_irq(q->queue_lock); | 84 | spin_unlock_irq(q->queue_lock); |
84 | 85 | ||
85 | if (!req) { | 86 | if (!req) { |
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c index 8a30ef3ae419..c351c6d1a18a 100644 --- a/drivers/mmc/wbsd.c +++ b/drivers/mmc/wbsd.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include "wbsd.h" | 41 | #include "wbsd.h" |
42 | 42 | ||
43 | #define DRIVER_NAME "wbsd" | 43 | #define DRIVER_NAME "wbsd" |
44 | #define DRIVER_VERSION "1.5" | 44 | #define DRIVER_VERSION "1.6" |
45 | 45 | ||
46 | #define DBG(x...) \ | 46 | #define DBG(x...) \ |
47 | pr_debug(DRIVER_NAME ": " x) | 47 | pr_debug(DRIVER_NAME ": " x) |
@@ -1439,13 +1439,13 @@ static int __devinit wbsd_scan(struct wbsd_host *host) | |||
1439 | 1439 | ||
1440 | static int __devinit wbsd_request_region(struct wbsd_host *host, int base) | 1440 | static int __devinit wbsd_request_region(struct wbsd_host *host, int base) |
1441 | { | 1441 | { |
1442 | if (io & 0x7) | 1442 | if (base & 0x7) |
1443 | return -EINVAL; | 1443 | return -EINVAL; |
1444 | 1444 | ||
1445 | if (!request_region(base, 8, DRIVER_NAME)) | 1445 | if (!request_region(base, 8, DRIVER_NAME)) |
1446 | return -EIO; | 1446 | return -EIO; |
1447 | 1447 | ||
1448 | host->base = io; | 1448 | host->base = base; |
1449 | 1449 | ||
1450 | return 0; | 1450 | return 0; |
1451 | } | 1451 | } |
@@ -1773,7 +1773,7 @@ static int __devinit wbsd_init(struct device *dev, int base, int irq, int dma, | |||
1773 | /* | 1773 | /* |
1774 | * Request resources. | 1774 | * Request resources. |
1775 | */ | 1775 | */ |
1776 | ret = wbsd_request_resources(host, io, irq, dma); | 1776 | ret = wbsd_request_resources(host, base, irq, dma); |
1777 | if (ret) { | 1777 | if (ret) { |
1778 | wbsd_release_resources(host); | 1778 | wbsd_release_resources(host); |
1779 | wbsd_free_mmc(dev); | 1779 | wbsd_free_mmc(dev); |
@@ -1861,6 +1861,7 @@ static void __devexit wbsd_shutdown(struct device *dev, int pnp) | |||
1861 | 1861 | ||
1862 | static int __devinit wbsd_probe(struct platform_device *dev) | 1862 | static int __devinit wbsd_probe(struct platform_device *dev) |
1863 | { | 1863 | { |
1864 | /* Use the module parameters for resources */ | ||
1864 | return wbsd_init(&dev->dev, io, irq, dma, 0); | 1865 | return wbsd_init(&dev->dev, io, irq, dma, 0); |
1865 | } | 1866 | } |
1866 | 1867 | ||
diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c index 07136ec423bd..d7b115a35962 100644 --- a/drivers/net/3c501.c +++ b/drivers/net/3c501.c | |||
@@ -120,7 +120,6 @@ static const char version[] = | |||
120 | #include <linux/slab.h> | 120 | #include <linux/slab.h> |
121 | #include <linux/string.h> | 121 | #include <linux/string.h> |
122 | #include <linux/errno.h> | 122 | #include <linux/errno.h> |
123 | #include <linux/config.h> /* for CONFIG_IP_MULTICAST */ | ||
124 | #include <linux/spinlock.h> | 123 | #include <linux/spinlock.h> |
125 | #include <linux/ethtool.h> | 124 | #include <linux/ethtool.h> |
126 | #include <linux/delay.h> | 125 | #include <linux/delay.h> |
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c index 4532b17e40ea..aedfddf20cb3 100644 --- a/drivers/net/3c515.c +++ b/drivers/net/3c515.c | |||
@@ -1003,7 +1003,8 @@ static int corkscrew_start_xmit(struct sk_buff *skb, | |||
1003 | /* Calculate the next Tx descriptor entry. */ | 1003 | /* Calculate the next Tx descriptor entry. */ |
1004 | int entry = vp->cur_tx % TX_RING_SIZE; | 1004 | int entry = vp->cur_tx % TX_RING_SIZE; |
1005 | struct boom_tx_desc *prev_entry; | 1005 | struct boom_tx_desc *prev_entry; |
1006 | unsigned long flags, i; | 1006 | unsigned long flags; |
1007 | int i; | ||
1007 | 1008 | ||
1008 | if (vp->tx_full) /* No room to transmit with */ | 1009 | if (vp->tx_full) /* No room to transmit with */ |
1009 | return 1; | 1010 | return 1; |
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 80e8ca013e44..7c23813bb097 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -3169,7 +3169,7 @@ static int __init vortex_init(void) | |||
3169 | { | 3169 | { |
3170 | int pci_rc, eisa_rc; | 3170 | int pci_rc, eisa_rc; |
3171 | 3171 | ||
3172 | pci_rc = pci_module_init(&vortex_driver); | 3172 | pci_rc = pci_register_driver(&vortex_driver); |
3173 | eisa_rc = vortex_eisa_init(); | 3173 | eisa_rc = vortex_eisa_init(); |
3174 | 3174 | ||
3175 | if (pci_rc == 0) | 3175 | if (pci_rc == 0) |
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index 1428bb7715af..4c2e76326c4a 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c | |||
@@ -2098,7 +2098,7 @@ static int __init cp_init (void) | |||
2098 | #ifdef MODULE | 2098 | #ifdef MODULE |
2099 | printk("%s", version); | 2099 | printk("%s", version); |
2100 | #endif | 2100 | #endif |
2101 | return pci_module_init (&cp_driver); | 2101 | return pci_register_driver(&cp_driver); |
2102 | } | 2102 | } |
2103 | 2103 | ||
2104 | static void __exit cp_exit (void) | 2104 | static void __exit cp_exit (void) |
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index e4f4eaff7679..2a707747ed8e 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c | |||
@@ -2629,7 +2629,7 @@ static int __init rtl8139_init_module (void) | |||
2629 | printk (KERN_INFO RTL8139_DRIVER_NAME "\n"); | 2629 | printk (KERN_INFO RTL8139_DRIVER_NAME "\n"); |
2630 | #endif | 2630 | #endif |
2631 | 2631 | ||
2632 | return pci_module_init (&rtl8139_pci_driver); | 2632 | return pci_register_driver(&rtl8139_pci_driver); |
2633 | } | 2633 | } |
2634 | 2634 | ||
2635 | 2635 | ||
diff --git a/drivers/net/82596.c b/drivers/net/82596.c index 7e2ca9571467..257d3bce3993 100644 --- a/drivers/net/82596.c +++ b/drivers/net/82596.c | |||
@@ -899,7 +899,7 @@ memory_squeeze: | |||
899 | } | 899 | } |
900 | 900 | ||
901 | 901 | ||
902 | static inline void i596_cleanup_cmd(struct net_device *dev, struct i596_private *lp) | 902 | static void i596_cleanup_cmd(struct net_device *dev, struct i596_private *lp) |
903 | { | 903 | { |
904 | struct i596_cmd *ptr; | 904 | struct i596_cmd *ptr; |
905 | 905 | ||
@@ -932,7 +932,8 @@ static inline void i596_cleanup_cmd(struct net_device *dev, struct i596_private | |||
932 | lp->scb.cmd = I596_NULL; | 932 | lp->scb.cmd = I596_NULL; |
933 | } | 933 | } |
934 | 934 | ||
935 | static inline void i596_reset(struct net_device *dev, struct i596_private *lp, int ioaddr) | 935 | static void i596_reset(struct net_device *dev, struct i596_private *lp, |
936 | int ioaddr) | ||
936 | { | 937 | { |
937 | unsigned long flags; | 938 | unsigned long flags; |
938 | 939 | ||
@@ -1578,7 +1579,7 @@ static int debug = -1; | |||
1578 | module_param(debug, int, 0); | 1579 | module_param(debug, int, 0); |
1579 | MODULE_PARM_DESC(debug, "i82596 debug mask"); | 1580 | MODULE_PARM_DESC(debug, "i82596 debug mask"); |
1580 | 1581 | ||
1581 | int init_module(void) | 1582 | int __init init_module(void) |
1582 | { | 1583 | { |
1583 | if (debug >= 0) | 1584 | if (debug >= 0) |
1584 | i596_debug = debug; | 1585 | i596_debug = debug; |
@@ -1588,7 +1589,7 @@ int init_module(void) | |||
1588 | return 0; | 1589 | return 0; |
1589 | } | 1590 | } |
1590 | 1591 | ||
1591 | void cleanup_module(void) | 1592 | void __exit cleanup_module(void) |
1592 | { | 1593 | { |
1593 | unregister_netdev(dev_82596); | 1594 | unregister_netdev(dev_82596); |
1594 | #ifdef __mc68000__ | 1595 | #ifdef __mc68000__ |
diff --git a/drivers/net/8390.c b/drivers/net/8390.c index d2935ae39814..3eb7048684a6 100644 --- a/drivers/net/8390.c +++ b/drivers/net/8390.c | |||
@@ -299,7 +299,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
299 | * Slow phase with lock held. | 299 | * Slow phase with lock held. |
300 | */ | 300 | */ |
301 | 301 | ||
302 | disable_irq_nosync(dev->irq); | 302 | disable_irq_nosync_lockdep(dev->irq); |
303 | 303 | ||
304 | spin_lock(&ei_local->page_lock); | 304 | spin_lock(&ei_local->page_lock); |
305 | 305 | ||
@@ -338,7 +338,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
338 | netif_stop_queue(dev); | 338 | netif_stop_queue(dev); |
339 | outb_p(ENISR_ALL, e8390_base + EN0_IMR); | 339 | outb_p(ENISR_ALL, e8390_base + EN0_IMR); |
340 | spin_unlock(&ei_local->page_lock); | 340 | spin_unlock(&ei_local->page_lock); |
341 | enable_irq(dev->irq); | 341 | enable_irq_lockdep(dev->irq); |
342 | ei_local->stat.tx_errors++; | 342 | ei_local->stat.tx_errors++; |
343 | return 1; | 343 | return 1; |
344 | } | 344 | } |
@@ -379,7 +379,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
379 | outb_p(ENISR_ALL, e8390_base + EN0_IMR); | 379 | outb_p(ENISR_ALL, e8390_base + EN0_IMR); |
380 | 380 | ||
381 | spin_unlock(&ei_local->page_lock); | 381 | spin_unlock(&ei_local->page_lock); |
382 | enable_irq(dev->irq); | 382 | enable_irq_lockdep(dev->irq); |
383 | 383 | ||
384 | dev_kfree_skb (skb); | 384 | dev_kfree_skb (skb); |
385 | ei_local->stat.tx_bytes += send_length; | 385 | ei_local->stat.tx_bytes += send_length; |
@@ -505,9 +505,9 @@ irqreturn_t ei_interrupt(int irq, void *dev_id, struct pt_regs * regs) | |||
505 | #ifdef CONFIG_NET_POLL_CONTROLLER | 505 | #ifdef CONFIG_NET_POLL_CONTROLLER |
506 | void ei_poll(struct net_device *dev) | 506 | void ei_poll(struct net_device *dev) |
507 | { | 507 | { |
508 | disable_irq(dev->irq); | 508 | disable_irq_lockdep(dev->irq); |
509 | ei_interrupt(dev->irq, dev, NULL); | 509 | ei_interrupt(dev->irq, dev, NULL); |
510 | enable_irq(dev->irq); | 510 | enable_irq_lockdep(dev->irq); |
511 | } | 511 | } |
512 | #endif | 512 | #endif |
513 | 513 | ||
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 39189903e355..6f388d9e9bea 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1411,6 +1411,22 @@ config FORCEDETH | |||
1411 | <file:Documentation/networking/net-modules.txt>. The module will be | 1411 | <file:Documentation/networking/net-modules.txt>. The module will be |
1412 | called forcedeth. | 1412 | called forcedeth. |
1413 | 1413 | ||
1414 | config FORCEDETH_NAPI | ||
1415 | bool "Use Rx and Tx Polling (NAPI) (EXPERIMENTAL)" | ||
1416 | depends on FORCEDETH && EXPERIMENTAL | ||
1417 | help | ||
1418 | NAPI is a new driver API designed to reduce CPU and interrupt load | ||
1419 | when the driver is receiving lots of packets from the card. It is | ||
1420 | still somewhat experimental and thus not yet enabled by default. | ||
1421 | |||
1422 | If your estimated Rx load is 10kpps or more, or if the card will be | ||
1423 | deployed on potentially unfriendly networks (e.g. in a firewall), | ||
1424 | then say Y here. | ||
1425 | |||
1426 | See <file:Documentation/networking/NAPI_HOWTO.txt> for more | ||
1427 | information. | ||
1428 | |||
1429 | If in doubt, say N. | ||
1414 | 1430 | ||
1415 | config CS89x0 | 1431 | config CS89x0 |
1416 | tristate "CS89x0 support" | 1432 | tristate "CS89x0 support" |
@@ -1724,6 +1740,20 @@ config VIA_RHINE_MMIO | |||
1724 | 1740 | ||
1725 | If unsure, say Y. | 1741 | If unsure, say Y. |
1726 | 1742 | ||
1743 | config VIA_RHINE_NAPI | ||
1744 | bool "Use Rx Polling (NAPI)" | ||
1745 | depends on VIA_RHINE | ||
1746 | help | ||
1747 | NAPI is a new driver API designed to reduce CPU and interrupt load | ||
1748 | when the driver is receiving lots of packets from the card. | ||
1749 | |||
1750 | If your estimated Rx load is 10kpps or more, or if the card will be | ||
1751 | deployed on potentially unfriendly networks (e.g. in a firewall), | ||
1752 | then say Y here. | ||
1753 | |||
1754 | See <file:Documentation/networking/NAPI_HOWTO.txt> for more | ||
1755 | information. | ||
1756 | |||
1727 | config LAN_SAA9730 | 1757 | config LAN_SAA9730 |
1728 | bool "Philips SAA9730 Ethernet support (EXPERIMENTAL)" | 1758 | bool "Philips SAA9730 Ethernet support (EXPERIMENTAL)" |
1729 | depends on NET_PCI && EXPERIMENTAL && MIPS | 1759 | depends on NET_PCI && EXPERIMENTAL && MIPS |
@@ -2219,6 +2249,33 @@ config GFAR_NAPI | |||
2219 | bool "NAPI Support" | 2249 | bool "NAPI Support" |
2220 | depends on GIANFAR | 2250 | depends on GIANFAR |
2221 | 2251 | ||
2252 | config UCC_GETH | ||
2253 | tristate "Freescale QE UCC GETH" | ||
2254 | depends on QUICC_ENGINE && UCC_FAST | ||
2255 | help | ||
2256 | This driver supports the Gigabit Ethernet mode of QE UCC. | ||
2257 | QE can be found on MPC836x CPUs. | ||
2258 | |||
2259 | config UGETH_NAPI | ||
2260 | bool "NAPI Support" | ||
2261 | depends on UCC_GETH | ||
2262 | |||
2263 | config UGETH_MAGIC_PACKET | ||
2264 | bool "Magic Packet detection support" | ||
2265 | depends on UCC_GETH | ||
2266 | |||
2267 | config UGETH_FILTERING | ||
2268 | bool "Mac address filtering support" | ||
2269 | depends on UCC_GETH | ||
2270 | |||
2271 | config UGETH_TX_ON_DEMOND | ||
2272 | bool "Transmit on Demond support" | ||
2273 | depends on UCC_GETH | ||
2274 | |||
2275 | config UGETH_HAS_GIGA | ||
2276 | bool | ||
2277 | depends on UCC_GETH && MPC836x | ||
2278 | |||
2222 | config MV643XX_ETH | 2279 | config MV643XX_ETH |
2223 | tristate "MV-643XX Ethernet support" | 2280 | tristate "MV-643XX Ethernet support" |
2224 | depends on MOMENCO_OCELOT_C || MOMENCO_JAGUAR_ATX || MV64360 || MOMENCO_OCELOT_3 || PPC_MULTIPLATFORM | 2281 | depends on MOMENCO_OCELOT_C || MOMENCO_JAGUAR_ATX || MV64360 || MOMENCO_OCELOT_3 || PPC_MULTIPLATFORM |
@@ -2249,6 +2306,15 @@ config MV643XX_ETH_2 | |||
2249 | This enables support for Port 2 of the Marvell MV643XX Gigabit | 2306 | This enables support for Port 2 of the Marvell MV643XX Gigabit |
2250 | Ethernet. | 2307 | Ethernet. |
2251 | 2308 | ||
2309 | config QLA3XXX | ||
2310 | tristate "QLogic QLA3XXX Network Driver Support" | ||
2311 | depends on PCI | ||
2312 | help | ||
2313 | This driver supports QLogic ISP3XXX gigabit Ethernet cards. | ||
2314 | |||
2315 | To compile this driver as a module, choose M here: the module | ||
2316 | will be called qla3xxx. | ||
2317 | |||
2252 | endmenu | 2318 | endmenu |
2253 | 2319 | ||
2254 | # | 2320 | # |
@@ -2509,6 +2575,7 @@ config PLIP | |||
2509 | 2575 | ||
2510 | config PPP | 2576 | config PPP |
2511 | tristate "PPP (point-to-point protocol) support" | 2577 | tristate "PPP (point-to-point protocol) support" |
2578 | select SLHC | ||
2512 | ---help--- | 2579 | ---help--- |
2513 | PPP (Point to Point Protocol) is a newer and better SLIP. It serves | 2580 | PPP (Point to Point Protocol) is a newer and better SLIP. It serves |
2514 | the same purpose: sending Internet traffic over telephone (and other | 2581 | the same purpose: sending Internet traffic over telephone (and other |
@@ -2689,6 +2756,7 @@ config SLIP | |||
2689 | config SLIP_COMPRESSED | 2756 | config SLIP_COMPRESSED |
2690 | bool "CSLIP compressed headers" | 2757 | bool "CSLIP compressed headers" |
2691 | depends on SLIP | 2758 | depends on SLIP |
2759 | select SLHC | ||
2692 | ---help--- | 2760 | ---help--- |
2693 | This protocol is faster than SLIP because it uses compression on the | 2761 | This protocol is faster than SLIP because it uses compression on the |
2694 | TCP/IP headers (not on the data itself), but it has to be supported | 2762 | TCP/IP headers (not on the data itself), but it has to be supported |
@@ -2701,6 +2769,12 @@ config SLIP_COMPRESSED | |||
2701 | <http://www.tldp.org/docs.html#howto>, explains how to configure | 2769 | <http://www.tldp.org/docs.html#howto>, explains how to configure |
2702 | CSLIP. This won't enlarge your kernel. | 2770 | CSLIP. This won't enlarge your kernel. |
2703 | 2771 | ||
2772 | config SLHC | ||
2773 | tristate | ||
2774 | help | ||
2775 | This option enables Van Jacobsen serial line header compression | ||
2776 | routines. | ||
2777 | |||
2704 | config SLIP_SMART | 2778 | config SLIP_SMART |
2705 | bool "Keepalive and linefill" | 2779 | bool "Keepalive and linefill" |
2706 | depends on SLIP | 2780 | depends on SLIP |
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index c91e95126f78..6ff17649c0fc 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
@@ -2,10 +2,6 @@ | |||
2 | # Makefile for the Linux network (ethercard) device drivers. | 2 | # Makefile for the Linux network (ethercard) device drivers. |
3 | # | 3 | # |
4 | 4 | ||
5 | ifeq ($(CONFIG_ISDN_PPP),y) | ||
6 | obj-$(CONFIG_ISDN) += slhc.o | ||
7 | endif | ||
8 | |||
9 | obj-$(CONFIG_E1000) += e1000/ | 5 | obj-$(CONFIG_E1000) += e1000/ |
10 | obj-$(CONFIG_IBM_EMAC) += ibm_emac/ | 6 | obj-$(CONFIG_IBM_EMAC) += ibm_emac/ |
11 | obj-$(CONFIG_IXGB) += ixgb/ | 7 | obj-$(CONFIG_IXGB) += ixgb/ |
@@ -18,6 +14,9 @@ gianfar_driver-objs := gianfar.o \ | |||
18 | gianfar_mii.o \ | 14 | gianfar_mii.o \ |
19 | gianfar_sysfs.o | 15 | gianfar_sysfs.o |
20 | 16 | ||
17 | obj-$(CONFIG_UCC_GETH) += ucc_geth_driver.o | ||
18 | ucc_geth_driver-objs := ucc_geth.o ucc_geth_phy.o | ||
19 | |||
21 | # | 20 | # |
22 | # link order important here | 21 | # link order important here |
23 | # | 22 | # |
@@ -110,8 +109,9 @@ obj-$(CONFIG_FORCEDETH) += forcedeth.o | |||
110 | obj-$(CONFIG_NE_H8300) += ne-h8300.o 8390.o | 109 | obj-$(CONFIG_NE_H8300) += ne-h8300.o 8390.o |
111 | 110 | ||
112 | obj-$(CONFIG_MV643XX_ETH) += mv643xx_eth.o | 111 | obj-$(CONFIG_MV643XX_ETH) += mv643xx_eth.o |
112 | obj-$(CONFIG_QLA3XXX) += qla3xxx.o | ||
113 | 113 | ||
114 | obj-$(CONFIG_PPP) += ppp_generic.o slhc.o | 114 | obj-$(CONFIG_PPP) += ppp_generic.o |
115 | obj-$(CONFIG_PPP_ASYNC) += ppp_async.o | 115 | obj-$(CONFIG_PPP_ASYNC) += ppp_async.o |
116 | obj-$(CONFIG_PPP_SYNC_TTY) += ppp_synctty.o | 116 | obj-$(CONFIG_PPP_SYNC_TTY) += ppp_synctty.o |
117 | obj-$(CONFIG_PPP_DEFLATE) += ppp_deflate.o | 117 | obj-$(CONFIG_PPP_DEFLATE) += ppp_deflate.o |
@@ -120,9 +120,7 @@ obj-$(CONFIG_PPP_MPPE) += ppp_mppe.o | |||
120 | obj-$(CONFIG_PPPOE) += pppox.o pppoe.o | 120 | obj-$(CONFIG_PPPOE) += pppox.o pppoe.o |
121 | 121 | ||
122 | obj-$(CONFIG_SLIP) += slip.o | 122 | obj-$(CONFIG_SLIP) += slip.o |
123 | ifeq ($(CONFIG_SLIP_COMPRESSED),y) | 123 | obj-$(CONFIG_SLHC) += slhc.o |
124 | obj-$(CONFIG_SLIP) += slhc.o | ||
125 | endif | ||
126 | 124 | ||
127 | obj-$(CONFIG_DUMMY) += dummy.o | 125 | obj-$(CONFIG_DUMMY) += dummy.o |
128 | obj-$(CONFIG_IFB) += ifb.o | 126 | obj-$(CONFIG_IFB) += ifb.o |
diff --git a/drivers/net/ac3200.c b/drivers/net/ac3200.c index 7952dc6d77e3..0fbbcb75af69 100644 --- a/drivers/net/ac3200.c +++ b/drivers/net/ac3200.c | |||
@@ -370,8 +370,7 @@ MODULE_PARM_DESC(mem, "Memory base address(es)"); | |||
370 | MODULE_DESCRIPTION("Ansel AC3200 EISA ethernet driver"); | 370 | MODULE_DESCRIPTION("Ansel AC3200 EISA ethernet driver"); |
371 | MODULE_LICENSE("GPL"); | 371 | MODULE_LICENSE("GPL"); |
372 | 372 | ||
373 | int | 373 | int __init init_module(void) |
374 | init_module(void) | ||
375 | { | 374 | { |
376 | struct net_device *dev; | 375 | struct net_device *dev; |
377 | int this_dev, found = 0; | 376 | int this_dev, found = 0; |
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c index 1c01e9b3d07c..c0f3574b470b 100644 --- a/drivers/net/acenic.c +++ b/drivers/net/acenic.c | |||
@@ -725,7 +725,7 @@ static struct pci_driver acenic_pci_driver = { | |||
725 | 725 | ||
726 | static int __init acenic_init(void) | 726 | static int __init acenic_init(void) |
727 | { | 727 | { |
728 | return pci_module_init(&acenic_pci_driver); | 728 | return pci_register_driver(&acenic_pci_driver); |
729 | } | 729 | } |
730 | 730 | ||
731 | static void __exit acenic_exit(void) | 731 | static void __exit acenic_exit(void) |
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c index ed322a76980d..2ef8e554263b 100644 --- a/drivers/net/amd8111e.c +++ b/drivers/net/amd8111e.c | |||
@@ -2158,7 +2158,7 @@ static struct pci_driver amd8111e_driver = { | |||
2158 | 2158 | ||
2159 | static int __init amd8111e_init(void) | 2159 | static int __init amd8111e_init(void) |
2160 | { | 2160 | { |
2161 | return pci_module_init(&amd8111e_driver); | 2161 | return pci_register_driver(&amd8111e_driver); |
2162 | } | 2162 | } |
2163 | 2163 | ||
2164 | static void __exit amd8111e_cleanup(void) | 2164 | static void __exit amd8111e_cleanup(void) |
diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c index 1d01ac0000e4..ae7f828344d9 100644 --- a/drivers/net/appletalk/cops.c +++ b/drivers/net/appletalk/cops.c | |||
@@ -1030,7 +1030,7 @@ module_param(io, int, 0); | |||
1030 | module_param(irq, int, 0); | 1030 | module_param(irq, int, 0); |
1031 | module_param(board_type, int, 0); | 1031 | module_param(board_type, int, 0); |
1032 | 1032 | ||
1033 | int init_module(void) | 1033 | int __init init_module(void) |
1034 | { | 1034 | { |
1035 | if (io == 0) | 1035 | if (io == 0) |
1036 | printk(KERN_WARNING "%s: You shouldn't autoprobe with insmod\n", | 1036 | printk(KERN_WARNING "%s: You shouldn't autoprobe with insmod\n", |
diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index 979a33df0a8c..fc256c197cd6 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c | |||
@@ -177,7 +177,7 @@ static struct pci_driver com20020pci_driver = { | |||
177 | static int __init com20020pci_init(void) | 177 | static int __init com20020pci_init(void) |
178 | { | 178 | { |
179 | BUGLVL(D_NORMAL) printk(VERSION); | 179 | BUGLVL(D_NORMAL) printk(VERSION); |
180 | return pci_module_init(&com20020pci_driver); | 180 | return pci_register_driver(&com20020pci_driver); |
181 | } | 181 | } |
182 | 182 | ||
183 | static void __exit com20020pci_cleanup(void) | 183 | static void __exit com20020pci_cleanup(void) |
diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c index 5d7929c79bce..4ca061c2d5b2 100644 --- a/drivers/net/at1700.c +++ b/drivers/net/at1700.c | |||
@@ -901,7 +901,7 @@ MODULE_PARM_DESC(io, "AT1700/FMV18X I/O base address"); | |||
901 | MODULE_PARM_DESC(irq, "AT1700/FMV18X IRQ number"); | 901 | MODULE_PARM_DESC(irq, "AT1700/FMV18X IRQ number"); |
902 | MODULE_PARM_DESC(net_debug, "AT1700/FMV18X debug level (0-6)"); | 902 | MODULE_PARM_DESC(net_debug, "AT1700/FMV18X debug level (0-6)"); |
903 | 903 | ||
904 | int init_module(void) | 904 | int __init init_module(void) |
905 | { | 905 | { |
906 | if (io == 0) | 906 | if (io == 0) |
907 | printk("at1700: You should not use auto-probing with insmod!\n"); | 907 | printk("at1700: You should not use auto-probing with insmod!\n"); |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index bea0fc0ede2f..17eb2912971d 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -2354,7 +2354,7 @@ static int __init b44_init(void) | |||
2354 | dma_desc_align_mask = ~(dma_desc_align_size - 1); | 2354 | dma_desc_align_mask = ~(dma_desc_align_size - 1); |
2355 | dma_desc_sync_size = max_t(unsigned int, dma_desc_align_size, sizeof(struct dma_desc)); | 2355 | dma_desc_sync_size = max_t(unsigned int, dma_desc_align_size, sizeof(struct dma_desc)); |
2356 | 2356 | ||
2357 | return pci_module_init(&b44_driver); | 2357 | return pci_register_driver(&b44_driver); |
2358 | } | 2358 | } |
2359 | 2359 | ||
2360 | static void __exit b44_cleanup(void) | 2360 | static void __exit b44_cleanup(void) |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index db73de0d2511..654b903985cd 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -56,8 +56,8 @@ | |||
56 | 56 | ||
57 | #define DRV_MODULE_NAME "bnx2" | 57 | #define DRV_MODULE_NAME "bnx2" |
58 | #define PFX DRV_MODULE_NAME ": " | 58 | #define PFX DRV_MODULE_NAME ": " |
59 | #define DRV_MODULE_VERSION "1.4.43" | 59 | #define DRV_MODULE_VERSION "1.4.44" |
60 | #define DRV_MODULE_RELDATE "June 28, 2006" | 60 | #define DRV_MODULE_RELDATE "August 10, 2006" |
61 | 61 | ||
62 | #define RUN_AT(x) (jiffies + (x)) | 62 | #define RUN_AT(x) (jiffies + (x)) |
63 | 63 | ||
@@ -209,8 +209,10 @@ MODULE_DEVICE_TABLE(pci, bnx2_pci_tbl); | |||
209 | 209 | ||
210 | static inline u32 bnx2_tx_avail(struct bnx2 *bp) | 210 | static inline u32 bnx2_tx_avail(struct bnx2 *bp) |
211 | { | 211 | { |
212 | u32 diff = TX_RING_IDX(bp->tx_prod) - TX_RING_IDX(bp->tx_cons); | 212 | u32 diff; |
213 | 213 | ||
214 | smp_mb(); | ||
215 | diff = TX_RING_IDX(bp->tx_prod) - TX_RING_IDX(bp->tx_cons); | ||
214 | if (diff > MAX_TX_DESC_CNT) | 216 | if (diff > MAX_TX_DESC_CNT) |
215 | diff = (diff & MAX_TX_DESC_CNT) - 1; | 217 | diff = (diff & MAX_TX_DESC_CNT) - 1; |
216 | return (bp->tx_ring_size - diff); | 218 | return (bp->tx_ring_size - diff); |
@@ -1569,7 +1571,7 @@ bnx2_alloc_rx_skb(struct bnx2 *bp, u16 index) | |||
1569 | struct rx_bd *rxbd = &bp->rx_desc_ring[RX_RING(index)][RX_IDX(index)]; | 1571 | struct rx_bd *rxbd = &bp->rx_desc_ring[RX_RING(index)][RX_IDX(index)]; |
1570 | unsigned long align; | 1572 | unsigned long align; |
1571 | 1573 | ||
1572 | skb = dev_alloc_skb(bp->rx_buf_size); | 1574 | skb = netdev_alloc_skb(bp->dev, bp->rx_buf_size); |
1573 | if (skb == NULL) { | 1575 | if (skb == NULL) { |
1574 | return -ENOMEM; | 1576 | return -ENOMEM; |
1575 | } | 1577 | } |
@@ -1578,7 +1580,6 @@ bnx2_alloc_rx_skb(struct bnx2 *bp, u16 index) | |||
1578 | skb_reserve(skb, 8 - align); | 1580 | skb_reserve(skb, 8 - align); |
1579 | } | 1581 | } |
1580 | 1582 | ||
1581 | skb->dev = bp->dev; | ||
1582 | mapping = pci_map_single(bp->pdev, skb->data, bp->rx_buf_use_size, | 1583 | mapping = pci_map_single(bp->pdev, skb->data, bp->rx_buf_use_size, |
1583 | PCI_DMA_FROMDEVICE); | 1584 | PCI_DMA_FROMDEVICE); |
1584 | 1585 | ||
@@ -1686,15 +1687,20 @@ bnx2_tx_int(struct bnx2 *bp) | |||
1686 | } | 1687 | } |
1687 | 1688 | ||
1688 | bp->tx_cons = sw_cons; | 1689 | bp->tx_cons = sw_cons; |
1690 | /* Need to make the tx_cons update visible to bnx2_start_xmit() | ||
1691 | * before checking for netif_queue_stopped(). Without the | ||
1692 | * memory barrier, there is a small possibility that bnx2_start_xmit() | ||
1693 | * will miss it and cause the queue to be stopped forever. | ||
1694 | */ | ||
1695 | smp_mb(); | ||
1689 | 1696 | ||
1690 | if (unlikely(netif_queue_stopped(bp->dev))) { | 1697 | if (unlikely(netif_queue_stopped(bp->dev)) && |
1691 | spin_lock(&bp->tx_lock); | 1698 | (bnx2_tx_avail(bp) > bp->tx_wake_thresh)) { |
1699 | netif_tx_lock(bp->dev); | ||
1692 | if ((netif_queue_stopped(bp->dev)) && | 1700 | if ((netif_queue_stopped(bp->dev)) && |
1693 | (bnx2_tx_avail(bp) > MAX_SKB_FRAGS)) { | 1701 | (bnx2_tx_avail(bp) > bp->tx_wake_thresh)) |
1694 | |||
1695 | netif_wake_queue(bp->dev); | 1702 | netif_wake_queue(bp->dev); |
1696 | } | 1703 | netif_tx_unlock(bp->dev); |
1697 | spin_unlock(&bp->tx_lock); | ||
1698 | } | 1704 | } |
1699 | } | 1705 | } |
1700 | 1706 | ||
@@ -1786,7 +1792,7 @@ bnx2_rx_int(struct bnx2 *bp, int budget) | |||
1786 | if ((bp->dev->mtu > 1500) && (len <= RX_COPY_THRESH)) { | 1792 | if ((bp->dev->mtu > 1500) && (len <= RX_COPY_THRESH)) { |
1787 | struct sk_buff *new_skb; | 1793 | struct sk_buff *new_skb; |
1788 | 1794 | ||
1789 | new_skb = dev_alloc_skb(len + 2); | 1795 | new_skb = netdev_alloc_skb(bp->dev, len + 2); |
1790 | if (new_skb == NULL) | 1796 | if (new_skb == NULL) |
1791 | goto reuse_rx; | 1797 | goto reuse_rx; |
1792 | 1798 | ||
@@ -1797,7 +1803,6 @@ bnx2_rx_int(struct bnx2 *bp, int budget) | |||
1797 | 1803 | ||
1798 | skb_reserve(new_skb, 2); | 1804 | skb_reserve(new_skb, 2); |
1799 | skb_put(new_skb, len); | 1805 | skb_put(new_skb, len); |
1800 | new_skb->dev = bp->dev; | ||
1801 | 1806 | ||
1802 | bnx2_reuse_rx_skb(bp, skb, | 1807 | bnx2_reuse_rx_skb(bp, skb, |
1803 | sw_ring_cons, sw_ring_prod); | 1808 | sw_ring_cons, sw_ring_prod); |
@@ -3503,6 +3508,8 @@ bnx2_init_tx_ring(struct bnx2 *bp) | |||
3503 | struct tx_bd *txbd; | 3508 | struct tx_bd *txbd; |
3504 | u32 val; | 3509 | u32 val; |
3505 | 3510 | ||
3511 | bp->tx_wake_thresh = bp->tx_ring_size / 2; | ||
3512 | |||
3506 | txbd = &bp->tx_desc_ring[MAX_TX_DESC_CNT]; | 3513 | txbd = &bp->tx_desc_ring[MAX_TX_DESC_CNT]; |
3507 | 3514 | ||
3508 | txbd->tx_bd_haddr_hi = (u64) bp->tx_desc_mapping >> 32; | 3515 | txbd->tx_bd_haddr_hi = (u64) bp->tx_desc_mapping >> 32; |
@@ -3952,7 +3959,7 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode) | |||
3952 | return -EINVAL; | 3959 | return -EINVAL; |
3953 | 3960 | ||
3954 | pkt_size = 1514; | 3961 | pkt_size = 1514; |
3955 | skb = dev_alloc_skb(pkt_size); | 3962 | skb = netdev_alloc_skb(bp->dev, pkt_size); |
3956 | if (!skb) | 3963 | if (!skb) |
3957 | return -ENOMEM; | 3964 | return -ENOMEM; |
3958 | packet = skb_put(skb, pkt_size); | 3965 | packet = skb_put(skb, pkt_size); |
@@ -4390,10 +4397,8 @@ bnx2_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid) | |||
4390 | #endif | 4397 | #endif |
4391 | 4398 | ||
4392 | /* Called with netif_tx_lock. | 4399 | /* Called with netif_tx_lock. |
4393 | * hard_start_xmit is pseudo-lockless - a lock is only required when | 4400 | * bnx2_tx_int() runs without netif_tx_lock unless it needs to call |
4394 | * the tx queue is full. This way, we get the benefit of lockless | 4401 | * netif_wake_queue(). |
4395 | * operations most of the time without the complexities to handle | ||
4396 | * netif_stop_queue/wake_queue race conditions. | ||
4397 | */ | 4402 | */ |
4398 | static int | 4403 | static int |
4399 | bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) | 4404 | bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) |
@@ -4512,12 +4517,9 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4512 | dev->trans_start = jiffies; | 4517 | dev->trans_start = jiffies; |
4513 | 4518 | ||
4514 | if (unlikely(bnx2_tx_avail(bp) <= MAX_SKB_FRAGS)) { | 4519 | if (unlikely(bnx2_tx_avail(bp) <= MAX_SKB_FRAGS)) { |
4515 | spin_lock(&bp->tx_lock); | ||
4516 | netif_stop_queue(dev); | 4520 | netif_stop_queue(dev); |
4517 | 4521 | if (bnx2_tx_avail(bp) > bp->tx_wake_thresh) | |
4518 | if (bnx2_tx_avail(bp) > MAX_SKB_FRAGS) | ||
4519 | netif_wake_queue(dev); | 4522 | netif_wake_queue(dev); |
4520 | spin_unlock(&bp->tx_lock); | ||
4521 | } | 4523 | } |
4522 | 4524 | ||
4523 | return NETDEV_TX_OK; | 4525 | return NETDEV_TX_OK; |
@@ -5628,7 +5630,6 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
5628 | bp->pdev = pdev; | 5630 | bp->pdev = pdev; |
5629 | 5631 | ||
5630 | spin_lock_init(&bp->phy_lock); | 5632 | spin_lock_init(&bp->phy_lock); |
5631 | spin_lock_init(&bp->tx_lock); | ||
5632 | INIT_WORK(&bp->reset_task, bnx2_reset_task, bp); | 5633 | INIT_WORK(&bp->reset_task, bnx2_reset_task, bp); |
5633 | 5634 | ||
5634 | dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0); | 5635 | dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0); |
@@ -5751,7 +5752,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
5751 | bp->mac_addr[5] = (u8) reg; | 5752 | bp->mac_addr[5] = (u8) reg; |
5752 | 5753 | ||
5753 | bp->tx_ring_size = MAX_TX_DESC_CNT; | 5754 | bp->tx_ring_size = MAX_TX_DESC_CNT; |
5754 | bnx2_set_rx_ring_size(bp, 100); | 5755 | bnx2_set_rx_ring_size(bp, 255); |
5755 | 5756 | ||
5756 | bp->rx_csum = 1; | 5757 | bp->rx_csum = 1; |
5757 | 5758 | ||
@@ -6015,7 +6016,7 @@ static struct pci_driver bnx2_pci_driver = { | |||
6015 | 6016 | ||
6016 | static int __init bnx2_init(void) | 6017 | static int __init bnx2_init(void) |
6017 | { | 6018 | { |
6018 | return pci_module_init(&bnx2_pci_driver); | 6019 | return pci_register_driver(&bnx2_pci_driver); |
6019 | } | 6020 | } |
6020 | 6021 | ||
6021 | static void __exit bnx2_cleanup(void) | 6022 | static void __exit bnx2_cleanup(void) |
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index 658c5ee95c73..fe804763c607 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h | |||
@@ -3890,10 +3890,6 @@ struct bnx2 { | |||
3890 | u32 tx_prod_bseq __attribute__((aligned(L1_CACHE_BYTES))); | 3890 | u32 tx_prod_bseq __attribute__((aligned(L1_CACHE_BYTES))); |
3891 | u16 tx_prod; | 3891 | u16 tx_prod; |
3892 | 3892 | ||
3893 | struct tx_bd *tx_desc_ring; | ||
3894 | struct sw_bd *tx_buf_ring; | ||
3895 | int tx_ring_size; | ||
3896 | |||
3897 | u16 tx_cons __attribute__((aligned(L1_CACHE_BYTES))); | 3893 | u16 tx_cons __attribute__((aligned(L1_CACHE_BYTES))); |
3898 | u16 hw_tx_cons; | 3894 | u16 hw_tx_cons; |
3899 | 3895 | ||
@@ -3916,9 +3912,11 @@ struct bnx2 { | |||
3916 | struct sw_bd *rx_buf_ring; | 3912 | struct sw_bd *rx_buf_ring; |
3917 | struct rx_bd *rx_desc_ring[MAX_RX_RINGS]; | 3913 | struct rx_bd *rx_desc_ring[MAX_RX_RINGS]; |
3918 | 3914 | ||
3919 | /* Only used to synchronize netif_stop_queue/wake_queue when tx */ | 3915 | /* TX constants */ |
3920 | /* ring is full */ | 3916 | struct tx_bd *tx_desc_ring; |
3921 | spinlock_t tx_lock; | 3917 | struct sw_bd *tx_buf_ring; |
3918 | int tx_ring_size; | ||
3919 | u32 tx_wake_thresh; | ||
3922 | 3920 | ||
3923 | /* End of fields used in the performance code paths. */ | 3921 | /* End of fields used in the performance code paths. */ |
3924 | 3922 | ||
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index a31544ccb3c4..26040abfef62 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
@@ -5245,7 +5245,7 @@ static int __init cas_init(void) | |||
5245 | else | 5245 | else |
5246 | link_transition_timeout = 0; | 5246 | link_transition_timeout = 0; |
5247 | 5247 | ||
5248 | return pci_module_init(&cas_driver); | 5248 | return pci_register_driver(&cas_driver); |
5249 | } | 5249 | } |
5250 | 5250 | ||
5251 | static void __exit cas_cleanup(void) | 5251 | static void __exit cas_cleanup(void) |
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c index e67872433e92..b6de184e4699 100644 --- a/drivers/net/chelsio/cxgb2.c +++ b/drivers/net/chelsio/cxgb2.c | |||
@@ -1243,7 +1243,7 @@ static struct pci_driver driver = { | |||
1243 | 1243 | ||
1244 | static int __init t1_init_module(void) | 1244 | static int __init t1_init_module(void) |
1245 | { | 1245 | { |
1246 | return pci_module_init(&driver); | 1246 | return pci_register_driver(&driver); |
1247 | } | 1247 | } |
1248 | 1248 | ||
1249 | static void __exit t1_cleanup_module(void) | 1249 | static void __exit t1_cleanup_module(void) |
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 47eecce35fa4..2dcca79b1f6a 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c | |||
@@ -1905,8 +1905,7 @@ MODULE_LICENSE("GPL"); | |||
1905 | 1905 | ||
1906 | */ | 1906 | */ |
1907 | 1907 | ||
1908 | int | 1908 | int __init init_module(void) |
1909 | init_module(void) | ||
1910 | { | 1909 | { |
1911 | struct net_device *dev = alloc_etherdev(sizeof(struct net_local)); | 1910 | struct net_device *dev = alloc_etherdev(sizeof(struct net_local)); |
1912 | struct net_local *lp; | 1911 | struct net_local *lp; |
diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c index 91cc8cbdd440..7d06dedbfb26 100644 --- a/drivers/net/defxx.c +++ b/drivers/net/defxx.c | |||
@@ -3444,7 +3444,7 @@ static int __init dfx_init(void) | |||
3444 | { | 3444 | { |
3445 | int rc_pci, rc_eisa; | 3445 | int rc_pci, rc_eisa; |
3446 | 3446 | ||
3447 | rc_pci = pci_module_init(&dfx_driver); | 3447 | rc_pci = pci_register_driver(&dfx_driver); |
3448 | if (rc_pci >= 0) dfx_have_pci = 1; | 3448 | if (rc_pci >= 0) dfx_have_pci = 1; |
3449 | 3449 | ||
3450 | rc_eisa = dfx_eisa_init(); | 3450 | rc_eisa = dfx_eisa_init(); |
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c index 402961e68c89..a572c2970564 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c | |||
@@ -1815,7 +1815,7 @@ static struct pci_driver rio_driver = { | |||
1815 | static int __init | 1815 | static int __init |
1816 | rio_init (void) | 1816 | rio_init (void) |
1817 | { | 1817 | { |
1818 | return pci_module_init (&rio_driver); | 1818 | return pci_register_driver(&rio_driver); |
1819 | } | 1819 | } |
1820 | 1820 | ||
1821 | static void __exit | 1821 | static void __exit |
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index 1b758b707134..3d76fa144c4f 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -339,6 +339,17 @@ static void dm9000_timeout(struct net_device *dev) | |||
339 | spin_unlock_irqrestore(&db->lock,flags); | 339 | spin_unlock_irqrestore(&db->lock,flags); |
340 | } | 340 | } |
341 | 341 | ||
342 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
343 | /* | ||
344 | *Used by netconsole | ||
345 | */ | ||
346 | static void dm9000_poll_controller(struct net_device *dev) | ||
347 | { | ||
348 | disable_irq(dev->irq); | ||
349 | dm9000_interrupt(dev->irq,dev,NULL); | ||
350 | enable_irq(dev->irq); | ||
351 | } | ||
352 | #endif | ||
342 | 353 | ||
343 | /* dm9000_release_board | 354 | /* dm9000_release_board |
344 | * | 355 | * |
@@ -538,6 +549,9 @@ dm9000_probe(struct platform_device *pdev) | |||
538 | ndev->stop = &dm9000_stop; | 549 | ndev->stop = &dm9000_stop; |
539 | ndev->get_stats = &dm9000_get_stats; | 550 | ndev->get_stats = &dm9000_get_stats; |
540 | ndev->set_multicast_list = &dm9000_hash_table; | 551 | ndev->set_multicast_list = &dm9000_hash_table; |
552 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
553 | ndev->poll_controller = &dm9000_poll_controller; | ||
554 | #endif | ||
541 | 555 | ||
542 | #ifdef DM9000_PROGRAM_EEPROM | 556 | #ifdef DM9000_PROGRAM_EEPROM |
543 | program_eeprom(db); | 557 | program_eeprom(db); |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index e208c0905e61..b42ad76b1116 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -2869,7 +2869,7 @@ static int __init e100_init_module(void) | |||
2869 | printk(KERN_INFO PFX "%s, %s\n", DRV_DESCRIPTION, DRV_VERSION); | 2869 | printk(KERN_INFO PFX "%s, %s\n", DRV_DESCRIPTION, DRV_VERSION); |
2870 | printk(KERN_INFO PFX "%s\n", DRV_COPYRIGHT); | 2870 | printk(KERN_INFO PFX "%s\n", DRV_COPYRIGHT); |
2871 | } | 2871 | } |
2872 | return pci_module_init(&e100_driver); | 2872 | return pci_register_driver(&e100_driver); |
2873 | } | 2873 | } |
2874 | 2874 | ||
2875 | static void __exit e100_cleanup_module(void) | 2875 | static void __exit e100_cleanup_module(void) |
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index 8eddfdf62f55..f62d17848332 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c | |||
@@ -105,6 +105,33 @@ static int32_t e1000_configure_kmrn_for_10_100(struct e1000_hw *hw, | |||
105 | uint16_t duplex); | 105 | uint16_t duplex); |
106 | static int32_t e1000_configure_kmrn_for_1000(struct e1000_hw *hw); | 106 | static int32_t e1000_configure_kmrn_for_1000(struct e1000_hw *hw); |
107 | 107 | ||
108 | static int32_t e1000_erase_ich8_4k_segment(struct e1000_hw *hw, | ||
109 | uint32_t segment); | ||
110 | static int32_t e1000_get_software_flag(struct e1000_hw *hw); | ||
111 | static int32_t e1000_get_software_semaphore(struct e1000_hw *hw); | ||
112 | static int32_t e1000_init_lcd_from_nvm(struct e1000_hw *hw); | ||
113 | static int32_t e1000_kumeran_lock_loss_workaround(struct e1000_hw *hw); | ||
114 | static int32_t e1000_read_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, | ||
115 | uint16_t words, uint16_t *data); | ||
116 | static int32_t e1000_read_ich8_byte(struct e1000_hw *hw, uint32_t index, | ||
117 | uint8_t* data); | ||
118 | static int32_t e1000_read_ich8_word(struct e1000_hw *hw, uint32_t index, | ||
119 | uint16_t *data); | ||
120 | static int32_t e1000_read_kmrn_reg(struct e1000_hw *hw, uint32_t reg_addr, | ||
121 | uint16_t *data); | ||
122 | static void e1000_release_software_flag(struct e1000_hw *hw); | ||
123 | static void e1000_release_software_semaphore(struct e1000_hw *hw); | ||
124 | static int32_t e1000_set_pci_ex_no_snoop(struct e1000_hw *hw, | ||
125 | uint32_t no_snoop); | ||
126 | static int32_t e1000_verify_write_ich8_byte(struct e1000_hw *hw, | ||
127 | uint32_t index, uint8_t byte); | ||
128 | static int32_t e1000_write_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, | ||
129 | uint16_t words, uint16_t *data); | ||
130 | static int32_t e1000_write_ich8_byte(struct e1000_hw *hw, uint32_t index, | ||
131 | uint8_t data); | ||
132 | static int32_t e1000_write_kmrn_reg(struct e1000_hw *hw, uint32_t reg_addr, | ||
133 | uint16_t data); | ||
134 | |||
108 | /* IGP cable length table */ | 135 | /* IGP cable length table */ |
109 | static const | 136 | static const |
110 | uint16_t e1000_igp_cable_length_table[IGP01E1000_AGC_LENGTH_TABLE_SIZE] = | 137 | uint16_t e1000_igp_cable_length_table[IGP01E1000_AGC_LENGTH_TABLE_SIZE] = |
@@ -3247,7 +3274,7 @@ e1000_shift_in_mdi_bits(struct e1000_hw *hw) | |||
3247 | return data; | 3274 | return data; |
3248 | } | 3275 | } |
3249 | 3276 | ||
3250 | int32_t | 3277 | static int32_t |
3251 | e1000_swfw_sync_acquire(struct e1000_hw *hw, uint16_t mask) | 3278 | e1000_swfw_sync_acquire(struct e1000_hw *hw, uint16_t mask) |
3252 | { | 3279 | { |
3253 | uint32_t swfw_sync = 0; | 3280 | uint32_t swfw_sync = 0; |
@@ -3291,7 +3318,7 @@ e1000_swfw_sync_acquire(struct e1000_hw *hw, uint16_t mask) | |||
3291 | return E1000_SUCCESS; | 3318 | return E1000_SUCCESS; |
3292 | } | 3319 | } |
3293 | 3320 | ||
3294 | void | 3321 | static void |
3295 | e1000_swfw_sync_release(struct e1000_hw *hw, uint16_t mask) | 3322 | e1000_swfw_sync_release(struct e1000_hw *hw, uint16_t mask) |
3296 | { | 3323 | { |
3297 | uint32_t swfw_sync; | 3324 | uint32_t swfw_sync; |
@@ -3589,7 +3616,7 @@ e1000_write_phy_reg_ex(struct e1000_hw *hw, | |||
3589 | return E1000_SUCCESS; | 3616 | return E1000_SUCCESS; |
3590 | } | 3617 | } |
3591 | 3618 | ||
3592 | int32_t | 3619 | static int32_t |
3593 | e1000_read_kmrn_reg(struct e1000_hw *hw, | 3620 | e1000_read_kmrn_reg(struct e1000_hw *hw, |
3594 | uint32_t reg_addr, | 3621 | uint32_t reg_addr, |
3595 | uint16_t *data) | 3622 | uint16_t *data) |
@@ -3622,7 +3649,7 @@ e1000_read_kmrn_reg(struct e1000_hw *hw, | |||
3622 | return E1000_SUCCESS; | 3649 | return E1000_SUCCESS; |
3623 | } | 3650 | } |
3624 | 3651 | ||
3625 | int32_t | 3652 | static int32_t |
3626 | e1000_write_kmrn_reg(struct e1000_hw *hw, | 3653 | e1000_write_kmrn_reg(struct e1000_hw *hw, |
3627 | uint32_t reg_addr, | 3654 | uint32_t reg_addr, |
3628 | uint16_t data) | 3655 | uint16_t data) |
@@ -3853,7 +3880,7 @@ e1000_phy_powerdown_workaround(struct e1000_hw *hw) | |||
3853 | * | 3880 | * |
3854 | * hw - struct containing variables accessed by shared code | 3881 | * hw - struct containing variables accessed by shared code |
3855 | ******************************************************************************/ | 3882 | ******************************************************************************/ |
3856 | int32_t | 3883 | static int32_t |
3857 | e1000_kumeran_lock_loss_workaround(struct e1000_hw *hw) | 3884 | e1000_kumeran_lock_loss_workaround(struct e1000_hw *hw) |
3858 | { | 3885 | { |
3859 | int32_t ret_val; | 3886 | int32_t ret_val; |
@@ -4100,7 +4127,7 @@ e1000_phy_igp_get_info(struct e1000_hw *hw, | |||
4100 | * hw - Struct containing variables accessed by shared code | 4127 | * hw - Struct containing variables accessed by shared code |
4101 | * phy_info - PHY information structure | 4128 | * phy_info - PHY information structure |
4102 | ******************************************************************************/ | 4129 | ******************************************************************************/ |
4103 | int32_t | 4130 | static int32_t |
4104 | e1000_phy_ife_get_info(struct e1000_hw *hw, | 4131 | e1000_phy_ife_get_info(struct e1000_hw *hw, |
4105 | struct e1000_phy_info *phy_info) | 4132 | struct e1000_phy_info *phy_info) |
4106 | { | 4133 | { |
@@ -5657,6 +5684,7 @@ e1000_init_rx_addrs(struct e1000_hw *hw) | |||
5657 | * for the first 15 multicast addresses, and hashes the rest into the | 5684 | * for the first 15 multicast addresses, and hashes the rest into the |
5658 | * multicast table. | 5685 | * multicast table. |
5659 | *****************************************************************************/ | 5686 | *****************************************************************************/ |
5687 | #if 0 | ||
5660 | void | 5688 | void |
5661 | e1000_mc_addr_list_update(struct e1000_hw *hw, | 5689 | e1000_mc_addr_list_update(struct e1000_hw *hw, |
5662 | uint8_t *mc_addr_list, | 5690 | uint8_t *mc_addr_list, |
@@ -5733,6 +5761,7 @@ e1000_mc_addr_list_update(struct e1000_hw *hw, | |||
5733 | } | 5761 | } |
5734 | DEBUGOUT("MC Update Complete\n"); | 5762 | DEBUGOUT("MC Update Complete\n"); |
5735 | } | 5763 | } |
5764 | #endif /* 0 */ | ||
5736 | 5765 | ||
5737 | /****************************************************************************** | 5766 | /****************************************************************************** |
5738 | * Hashes an address to determine its location in the multicast table | 5767 | * Hashes an address to determine its location in the multicast table |
@@ -6601,6 +6630,7 @@ e1000_get_bus_info(struct e1000_hw *hw) | |||
6601 | * hw - Struct containing variables accessed by shared code | 6630 | * hw - Struct containing variables accessed by shared code |
6602 | * offset - offset to read from | 6631 | * offset - offset to read from |
6603 | *****************************************************************************/ | 6632 | *****************************************************************************/ |
6633 | #if 0 | ||
6604 | uint32_t | 6634 | uint32_t |
6605 | e1000_read_reg_io(struct e1000_hw *hw, | 6635 | e1000_read_reg_io(struct e1000_hw *hw, |
6606 | uint32_t offset) | 6636 | uint32_t offset) |
@@ -6611,6 +6641,7 @@ e1000_read_reg_io(struct e1000_hw *hw, | |||
6611 | e1000_io_write(hw, io_addr, offset); | 6641 | e1000_io_write(hw, io_addr, offset); |
6612 | return e1000_io_read(hw, io_data); | 6642 | return e1000_io_read(hw, io_data); |
6613 | } | 6643 | } |
6644 | #endif /* 0 */ | ||
6614 | 6645 | ||
6615 | /****************************************************************************** | 6646 | /****************************************************************************** |
6616 | * Writes a value to one of the devices registers using port I/O (as opposed to | 6647 | * Writes a value to one of the devices registers using port I/O (as opposed to |
@@ -7923,6 +7954,7 @@ e1000_set_pci_express_master_disable(struct e1000_hw *hw) | |||
7923 | * returns: - none. | 7954 | * returns: - none. |
7924 | * | 7955 | * |
7925 | ***************************************************************************/ | 7956 | ***************************************************************************/ |
7957 | #if 0 | ||
7926 | void | 7958 | void |
7927 | e1000_enable_pciex_master(struct e1000_hw *hw) | 7959 | e1000_enable_pciex_master(struct e1000_hw *hw) |
7928 | { | 7960 | { |
@@ -7937,6 +7969,7 @@ e1000_enable_pciex_master(struct e1000_hw *hw) | |||
7937 | ctrl &= ~E1000_CTRL_GIO_MASTER_DISABLE; | 7969 | ctrl &= ~E1000_CTRL_GIO_MASTER_DISABLE; |
7938 | E1000_WRITE_REG(hw, CTRL, ctrl); | 7970 | E1000_WRITE_REG(hw, CTRL, ctrl); |
7939 | } | 7971 | } |
7972 | #endif /* 0 */ | ||
7940 | 7973 | ||
7941 | /******************************************************************************* | 7974 | /******************************************************************************* |
7942 | * | 7975 | * |
@@ -8162,7 +8195,7 @@ e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw) | |||
8162 | * E1000_SUCCESS at any other case. | 8195 | * E1000_SUCCESS at any other case. |
8163 | * | 8196 | * |
8164 | ***************************************************************************/ | 8197 | ***************************************************************************/ |
8165 | int32_t | 8198 | static int32_t |
8166 | e1000_get_software_semaphore(struct e1000_hw *hw) | 8199 | e1000_get_software_semaphore(struct e1000_hw *hw) |
8167 | { | 8200 | { |
8168 | int32_t timeout = hw->eeprom.word_size + 1; | 8201 | int32_t timeout = hw->eeprom.word_size + 1; |
@@ -8197,7 +8230,7 @@ e1000_get_software_semaphore(struct e1000_hw *hw) | |||
8197 | * hw: Struct containing variables accessed by shared code | 8230 | * hw: Struct containing variables accessed by shared code |
8198 | * | 8231 | * |
8199 | ***************************************************************************/ | 8232 | ***************************************************************************/ |
8200 | void | 8233 | static void |
8201 | e1000_release_software_semaphore(struct e1000_hw *hw) | 8234 | e1000_release_software_semaphore(struct e1000_hw *hw) |
8202 | { | 8235 | { |
8203 | uint32_t swsm; | 8236 | uint32_t swsm; |
@@ -8279,7 +8312,7 @@ e1000_arc_subsystem_valid(struct e1000_hw *hw) | |||
8279 | * returns: E1000_SUCCESS | 8312 | * returns: E1000_SUCCESS |
8280 | * | 8313 | * |
8281 | *****************************************************************************/ | 8314 | *****************************************************************************/ |
8282 | int32_t | 8315 | static int32_t |
8283 | e1000_set_pci_ex_no_snoop(struct e1000_hw *hw, uint32_t no_snoop) | 8316 | e1000_set_pci_ex_no_snoop(struct e1000_hw *hw, uint32_t no_snoop) |
8284 | { | 8317 | { |
8285 | uint32_t gcr_reg = 0; | 8318 | uint32_t gcr_reg = 0; |
@@ -8320,7 +8353,7 @@ e1000_set_pci_ex_no_snoop(struct e1000_hw *hw, uint32_t no_snoop) | |||
8320 | * hw: Struct containing variables accessed by shared code | 8353 | * hw: Struct containing variables accessed by shared code |
8321 | * | 8354 | * |
8322 | ***************************************************************************/ | 8355 | ***************************************************************************/ |
8323 | int32_t | 8356 | static int32_t |
8324 | e1000_get_software_flag(struct e1000_hw *hw) | 8357 | e1000_get_software_flag(struct e1000_hw *hw) |
8325 | { | 8358 | { |
8326 | int32_t timeout = PHY_CFG_TIMEOUT; | 8359 | int32_t timeout = PHY_CFG_TIMEOUT; |
@@ -8359,7 +8392,7 @@ e1000_get_software_flag(struct e1000_hw *hw) | |||
8359 | * hw: Struct containing variables accessed by shared code | 8392 | * hw: Struct containing variables accessed by shared code |
8360 | * | 8393 | * |
8361 | ***************************************************************************/ | 8394 | ***************************************************************************/ |
8362 | void | 8395 | static void |
8363 | e1000_release_software_flag(struct e1000_hw *hw) | 8396 | e1000_release_software_flag(struct e1000_hw *hw) |
8364 | { | 8397 | { |
8365 | uint32_t extcnf_ctrl; | 8398 | uint32_t extcnf_ctrl; |
@@ -8383,6 +8416,7 @@ e1000_release_software_flag(struct e1000_hw *hw) | |||
8383 | * hw: Struct containing variables accessed by shared code | 8416 | * hw: Struct containing variables accessed by shared code |
8384 | * | 8417 | * |
8385 | ***************************************************************************/ | 8418 | ***************************************************************************/ |
8419 | #if 0 | ||
8386 | int32_t | 8420 | int32_t |
8387 | e1000_ife_disable_dynamic_power_down(struct e1000_hw *hw) | 8421 | e1000_ife_disable_dynamic_power_down(struct e1000_hw *hw) |
8388 | { | 8422 | { |
@@ -8402,6 +8436,7 @@ e1000_ife_disable_dynamic_power_down(struct e1000_hw *hw) | |||
8402 | 8436 | ||
8403 | return ret_val; | 8437 | return ret_val; |
8404 | } | 8438 | } |
8439 | #endif /* 0 */ | ||
8405 | 8440 | ||
8406 | /*************************************************************************** | 8441 | /*************************************************************************** |
8407 | * | 8442 | * |
@@ -8411,6 +8446,7 @@ e1000_ife_disable_dynamic_power_down(struct e1000_hw *hw) | |||
8411 | * hw: Struct containing variables accessed by shared code | 8446 | * hw: Struct containing variables accessed by shared code |
8412 | * | 8447 | * |
8413 | ***************************************************************************/ | 8448 | ***************************************************************************/ |
8449 | #if 0 | ||
8414 | int32_t | 8450 | int32_t |
8415 | e1000_ife_enable_dynamic_power_down(struct e1000_hw *hw) | 8451 | e1000_ife_enable_dynamic_power_down(struct e1000_hw *hw) |
8416 | { | 8452 | { |
@@ -8430,6 +8466,7 @@ e1000_ife_enable_dynamic_power_down(struct e1000_hw *hw) | |||
8430 | 8466 | ||
8431 | return ret_val; | 8467 | return ret_val; |
8432 | } | 8468 | } |
8469 | #endif /* 0 */ | ||
8433 | 8470 | ||
8434 | /****************************************************************************** | 8471 | /****************************************************************************** |
8435 | * Reads a 16 bit word or words from the EEPROM using the ICH8's flash access | 8472 | * Reads a 16 bit word or words from the EEPROM using the ICH8's flash access |
@@ -8440,7 +8477,7 @@ e1000_ife_enable_dynamic_power_down(struct e1000_hw *hw) | |||
8440 | * data - word read from the EEPROM | 8477 | * data - word read from the EEPROM |
8441 | * words - number of words to read | 8478 | * words - number of words to read |
8442 | *****************************************************************************/ | 8479 | *****************************************************************************/ |
8443 | int32_t | 8480 | static int32_t |
8444 | e1000_read_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, uint16_t words, | 8481 | e1000_read_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, uint16_t words, |
8445 | uint16_t *data) | 8482 | uint16_t *data) |
8446 | { | 8483 | { |
@@ -8496,7 +8533,7 @@ e1000_read_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, uint16_t words, | |||
8496 | * words - number of words to write | 8533 | * words - number of words to write |
8497 | * data - words to write to the EEPROM | 8534 | * data - words to write to the EEPROM |
8498 | *****************************************************************************/ | 8535 | *****************************************************************************/ |
8499 | int32_t | 8536 | static int32_t |
8500 | e1000_write_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, uint16_t words, | 8537 | e1000_write_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, uint16_t words, |
8501 | uint16_t *data) | 8538 | uint16_t *data) |
8502 | { | 8539 | { |
@@ -8543,7 +8580,7 @@ e1000_write_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, uint16_t words, | |||
8543 | * | 8580 | * |
8544 | * hw - The pointer to the hw structure | 8581 | * hw - The pointer to the hw structure |
8545 | ****************************************************************************/ | 8582 | ****************************************************************************/ |
8546 | int32_t | 8583 | static int32_t |
8547 | e1000_ich8_cycle_init(struct e1000_hw *hw) | 8584 | e1000_ich8_cycle_init(struct e1000_hw *hw) |
8548 | { | 8585 | { |
8549 | union ich8_hws_flash_status hsfsts; | 8586 | union ich8_hws_flash_status hsfsts; |
@@ -8610,7 +8647,7 @@ e1000_ich8_cycle_init(struct e1000_hw *hw) | |||
8610 | * | 8647 | * |
8611 | * hw - The pointer to the hw structure | 8648 | * hw - The pointer to the hw structure |
8612 | ****************************************************************************/ | 8649 | ****************************************************************************/ |
8613 | int32_t | 8650 | static int32_t |
8614 | e1000_ich8_flash_cycle(struct e1000_hw *hw, uint32_t timeout) | 8651 | e1000_ich8_flash_cycle(struct e1000_hw *hw, uint32_t timeout) |
8615 | { | 8652 | { |
8616 | union ich8_hws_flash_ctrl hsflctl; | 8653 | union ich8_hws_flash_ctrl hsflctl; |
@@ -8645,7 +8682,7 @@ e1000_ich8_flash_cycle(struct e1000_hw *hw, uint32_t timeout) | |||
8645 | * size - Size of data to read, 1=byte 2=word | 8682 | * size - Size of data to read, 1=byte 2=word |
8646 | * data - Pointer to the word to store the value read. | 8683 | * data - Pointer to the word to store the value read. |
8647 | *****************************************************************************/ | 8684 | *****************************************************************************/ |
8648 | int32_t | 8685 | static int32_t |
8649 | e1000_read_ich8_data(struct e1000_hw *hw, uint32_t index, | 8686 | e1000_read_ich8_data(struct e1000_hw *hw, uint32_t index, |
8650 | uint32_t size, uint16_t* data) | 8687 | uint32_t size, uint16_t* data) |
8651 | { | 8688 | { |
@@ -8724,7 +8761,7 @@ e1000_read_ich8_data(struct e1000_hw *hw, uint32_t index, | |||
8724 | * size - Size of data to read, 1=byte 2=word | 8761 | * size - Size of data to read, 1=byte 2=word |
8725 | * data - The byte(s) to write to the NVM. | 8762 | * data - The byte(s) to write to the NVM. |
8726 | *****************************************************************************/ | 8763 | *****************************************************************************/ |
8727 | int32_t | 8764 | static int32_t |
8728 | e1000_write_ich8_data(struct e1000_hw *hw, uint32_t index, uint32_t size, | 8765 | e1000_write_ich8_data(struct e1000_hw *hw, uint32_t index, uint32_t size, |
8729 | uint16_t data) | 8766 | uint16_t data) |
8730 | { | 8767 | { |
@@ -8799,7 +8836,7 @@ e1000_write_ich8_data(struct e1000_hw *hw, uint32_t index, uint32_t size, | |||
8799 | * index - The index of the byte to read. | 8836 | * index - The index of the byte to read. |
8800 | * data - Pointer to a byte to store the value read. | 8837 | * data - Pointer to a byte to store the value read. |
8801 | *****************************************************************************/ | 8838 | *****************************************************************************/ |
8802 | int32_t | 8839 | static int32_t |
8803 | e1000_read_ich8_byte(struct e1000_hw *hw, uint32_t index, uint8_t* data) | 8840 | e1000_read_ich8_byte(struct e1000_hw *hw, uint32_t index, uint8_t* data) |
8804 | { | 8841 | { |
8805 | int32_t status = E1000_SUCCESS; | 8842 | int32_t status = E1000_SUCCESS; |
@@ -8822,7 +8859,7 @@ e1000_read_ich8_byte(struct e1000_hw *hw, uint32_t index, uint8_t* data) | |||
8822 | * index - The index of the byte to write. | 8859 | * index - The index of the byte to write. |
8823 | * byte - The byte to write to the NVM. | 8860 | * byte - The byte to write to the NVM. |
8824 | *****************************************************************************/ | 8861 | *****************************************************************************/ |
8825 | int32_t | 8862 | static int32_t |
8826 | e1000_verify_write_ich8_byte(struct e1000_hw *hw, uint32_t index, uint8_t byte) | 8863 | e1000_verify_write_ich8_byte(struct e1000_hw *hw, uint32_t index, uint8_t byte) |
8827 | { | 8864 | { |
8828 | int32_t error = E1000_SUCCESS; | 8865 | int32_t error = E1000_SUCCESS; |
@@ -8853,7 +8890,7 @@ e1000_verify_write_ich8_byte(struct e1000_hw *hw, uint32_t index, uint8_t byte) | |||
8853 | * index - The index of the byte to read. | 8890 | * index - The index of the byte to read. |
8854 | * data - The byte to write to the NVM. | 8891 | * data - The byte to write to the NVM. |
8855 | *****************************************************************************/ | 8892 | *****************************************************************************/ |
8856 | int32_t | 8893 | static int32_t |
8857 | e1000_write_ich8_byte(struct e1000_hw *hw, uint32_t index, uint8_t data) | 8894 | e1000_write_ich8_byte(struct e1000_hw *hw, uint32_t index, uint8_t data) |
8858 | { | 8895 | { |
8859 | int32_t status = E1000_SUCCESS; | 8896 | int32_t status = E1000_SUCCESS; |
@@ -8871,7 +8908,7 @@ e1000_write_ich8_byte(struct e1000_hw *hw, uint32_t index, uint8_t data) | |||
8871 | * index - The starting byte index of the word to read. | 8908 | * index - The starting byte index of the word to read. |
8872 | * data - Pointer to a word to store the value read. | 8909 | * data - Pointer to a word to store the value read. |
8873 | *****************************************************************************/ | 8910 | *****************************************************************************/ |
8874 | int32_t | 8911 | static int32_t |
8875 | e1000_read_ich8_word(struct e1000_hw *hw, uint32_t index, uint16_t *data) | 8912 | e1000_read_ich8_word(struct e1000_hw *hw, uint32_t index, uint16_t *data) |
8876 | { | 8913 | { |
8877 | int32_t status = E1000_SUCCESS; | 8914 | int32_t status = E1000_SUCCESS; |
@@ -8886,6 +8923,7 @@ e1000_read_ich8_word(struct e1000_hw *hw, uint32_t index, uint16_t *data) | |||
8886 | * index - The starting byte index of the word to read. | 8923 | * index - The starting byte index of the word to read. |
8887 | * data - The word to write to the NVM. | 8924 | * data - The word to write to the NVM. |
8888 | *****************************************************************************/ | 8925 | *****************************************************************************/ |
8926 | #if 0 | ||
8889 | int32_t | 8927 | int32_t |
8890 | e1000_write_ich8_word(struct e1000_hw *hw, uint32_t index, uint16_t data) | 8928 | e1000_write_ich8_word(struct e1000_hw *hw, uint32_t index, uint16_t data) |
8891 | { | 8929 | { |
@@ -8893,6 +8931,7 @@ e1000_write_ich8_word(struct e1000_hw *hw, uint32_t index, uint16_t data) | |||
8893 | status = e1000_write_ich8_data(hw, index, 2, data); | 8931 | status = e1000_write_ich8_data(hw, index, 2, data); |
8894 | return status; | 8932 | return status; |
8895 | } | 8933 | } |
8934 | #endif /* 0 */ | ||
8896 | 8935 | ||
8897 | /****************************************************************************** | 8936 | /****************************************************************************** |
8898 | * Erases the bank specified. Each bank is a 4k block. Segments are 0 based. | 8937 | * Erases the bank specified. Each bank is a 4k block. Segments are 0 based. |
@@ -8901,7 +8940,7 @@ e1000_write_ich8_word(struct e1000_hw *hw, uint32_t index, uint16_t data) | |||
8901 | * hw - pointer to e1000_hw structure | 8940 | * hw - pointer to e1000_hw structure |
8902 | * segment - 0 for first segment, 1 for second segment, etc. | 8941 | * segment - 0 for first segment, 1 for second segment, etc. |
8903 | *****************************************************************************/ | 8942 | *****************************************************************************/ |
8904 | int32_t | 8943 | static int32_t |
8905 | e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t segment) | 8944 | e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t segment) |
8906 | { | 8945 | { |
8907 | union ich8_hws_flash_status hsfsts; | 8946 | union ich8_hws_flash_status hsfsts; |
@@ -8998,6 +9037,7 @@ e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t segment) | |||
8998 | * hw: Struct containing variables accessed by shared code | 9037 | * hw: Struct containing variables accessed by shared code |
8999 | * | 9038 | * |
9000 | *****************************************************************************/ | 9039 | *****************************************************************************/ |
9040 | #if 0 | ||
9001 | int32_t | 9041 | int32_t |
9002 | e1000_duplex_reversal(struct e1000_hw *hw) | 9042 | e1000_duplex_reversal(struct e1000_hw *hw) |
9003 | { | 9043 | { |
@@ -9026,8 +9066,9 @@ e1000_duplex_reversal(struct e1000_hw *hw) | |||
9026 | 9066 | ||
9027 | return ret_val; | 9067 | return ret_val; |
9028 | } | 9068 | } |
9069 | #endif /* 0 */ | ||
9029 | 9070 | ||
9030 | int32_t | 9071 | static int32_t |
9031 | e1000_init_lcd_from_nvm_config_region(struct e1000_hw *hw, | 9072 | e1000_init_lcd_from_nvm_config_region(struct e1000_hw *hw, |
9032 | uint32_t cnf_base_addr, uint32_t cnf_size) | 9073 | uint32_t cnf_base_addr, uint32_t cnf_size) |
9033 | { | 9074 | { |
@@ -9061,7 +9102,7 @@ e1000_init_lcd_from_nvm_config_region(struct e1000_hw *hw, | |||
9061 | } | 9102 | } |
9062 | 9103 | ||
9063 | 9104 | ||
9064 | int32_t | 9105 | static int32_t |
9065 | e1000_init_lcd_from_nvm(struct e1000_hw *hw) | 9106 | e1000_init_lcd_from_nvm(struct e1000_hw *hw) |
9066 | { | 9107 | { |
9067 | uint32_t reg_data, cnf_base_addr, cnf_size, ret_val, loop; | 9108 | uint32_t reg_data, cnf_base_addr, cnf_size, ret_val, loop; |
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h index f9341e3276b3..375b95518c31 100644 --- a/drivers/net/e1000/e1000_hw.h +++ b/drivers/net/e1000/e1000_hw.h | |||
@@ -323,13 +323,8 @@ int32_t e1000_write_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t dat | |||
323 | int32_t e1000_phy_hw_reset(struct e1000_hw *hw); | 323 | int32_t e1000_phy_hw_reset(struct e1000_hw *hw); |
324 | int32_t e1000_phy_reset(struct e1000_hw *hw); | 324 | int32_t e1000_phy_reset(struct e1000_hw *hw); |
325 | void e1000_phy_powerdown_workaround(struct e1000_hw *hw); | 325 | void e1000_phy_powerdown_workaround(struct e1000_hw *hw); |
326 | int32_t e1000_kumeran_lock_loss_workaround(struct e1000_hw *hw); | ||
327 | int32_t e1000_init_lcd_from_nvm_config_region(struct e1000_hw *hw, uint32_t cnf_base_addr, uint32_t cnf_size); | ||
328 | int32_t e1000_init_lcd_from_nvm(struct e1000_hw *hw); | ||
329 | int32_t e1000_phy_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info); | 326 | int32_t e1000_phy_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info); |
330 | int32_t e1000_validate_mdi_setting(struct e1000_hw *hw); | 327 | int32_t e1000_validate_mdi_setting(struct e1000_hw *hw); |
331 | int32_t e1000_read_kmrn_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t *data); | ||
332 | int32_t e1000_write_kmrn_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t data); | ||
333 | 328 | ||
334 | /* EEPROM Functions */ | 329 | /* EEPROM Functions */ |
335 | int32_t e1000_init_eeprom_params(struct e1000_hw *hw); | 330 | int32_t e1000_init_eeprom_params(struct e1000_hw *hw); |
@@ -400,13 +395,8 @@ int32_t e1000_update_eeprom_checksum(struct e1000_hw *hw); | |||
400 | int32_t e1000_write_eeprom(struct e1000_hw *hw, uint16_t reg, uint16_t words, uint16_t *data); | 395 | int32_t e1000_write_eeprom(struct e1000_hw *hw, uint16_t reg, uint16_t words, uint16_t *data); |
401 | int32_t e1000_read_part_num(struct e1000_hw *hw, uint32_t * part_num); | 396 | int32_t e1000_read_part_num(struct e1000_hw *hw, uint32_t * part_num); |
402 | int32_t e1000_read_mac_addr(struct e1000_hw * hw); | 397 | int32_t e1000_read_mac_addr(struct e1000_hw * hw); |
403 | int32_t e1000_swfw_sync_acquire(struct e1000_hw *hw, uint16_t mask); | ||
404 | void e1000_swfw_sync_release(struct e1000_hw *hw, uint16_t mask); | ||
405 | void e1000_release_software_flag(struct e1000_hw *hw); | ||
406 | int32_t e1000_get_software_flag(struct e1000_hw *hw); | ||
407 | 398 | ||
408 | /* Filters (multicast, vlan, receive) */ | 399 | /* Filters (multicast, vlan, receive) */ |
409 | void e1000_mc_addr_list_update(struct e1000_hw *hw, uint8_t * mc_addr_list, uint32_t mc_addr_count, uint32_t pad, uint32_t rar_used_count); | ||
410 | uint32_t e1000_hash_mc_addr(struct e1000_hw *hw, uint8_t * mc_addr); | 400 | uint32_t e1000_hash_mc_addr(struct e1000_hw *hw, uint8_t * mc_addr); |
411 | void e1000_mta_set(struct e1000_hw *hw, uint32_t hash_value); | 401 | void e1000_mta_set(struct e1000_hw *hw, uint32_t hash_value); |
412 | void e1000_rar_set(struct e1000_hw *hw, uint8_t * mc_addr, uint32_t rar_index); | 402 | void e1000_rar_set(struct e1000_hw *hw, uint8_t * mc_addr, uint32_t rar_index); |
@@ -431,31 +421,9 @@ void e1000_pci_clear_mwi(struct e1000_hw *hw); | |||
431 | void e1000_read_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value); | 421 | void e1000_read_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value); |
432 | void e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value); | 422 | void e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value); |
433 | /* Port I/O is only supported on 82544 and newer */ | 423 | /* Port I/O is only supported on 82544 and newer */ |
434 | uint32_t e1000_io_read(struct e1000_hw *hw, unsigned long port); | ||
435 | uint32_t e1000_read_reg_io(struct e1000_hw *hw, uint32_t offset); | ||
436 | void e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value); | 424 | void e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value); |
437 | void e1000_enable_pciex_master(struct e1000_hw *hw); | ||
438 | int32_t e1000_disable_pciex_master(struct e1000_hw *hw); | 425 | int32_t e1000_disable_pciex_master(struct e1000_hw *hw); |
439 | int32_t e1000_get_software_semaphore(struct e1000_hw *hw); | ||
440 | void e1000_release_software_semaphore(struct e1000_hw *hw); | ||
441 | int32_t e1000_check_phy_reset_block(struct e1000_hw *hw); | 426 | int32_t e1000_check_phy_reset_block(struct e1000_hw *hw); |
442 | int32_t e1000_set_pci_ex_no_snoop(struct e1000_hw *hw, uint32_t no_snoop); | ||
443 | |||
444 | int32_t e1000_read_ich8_byte(struct e1000_hw *hw, uint32_t index, | ||
445 | uint8_t *data); | ||
446 | int32_t e1000_verify_write_ich8_byte(struct e1000_hw *hw, uint32_t index, | ||
447 | uint8_t byte); | ||
448 | int32_t e1000_write_ich8_byte(struct e1000_hw *hw, uint32_t index, | ||
449 | uint8_t byte); | ||
450 | int32_t e1000_read_ich8_word(struct e1000_hw *hw, uint32_t index, | ||
451 | uint16_t *data); | ||
452 | int32_t e1000_read_ich8_data(struct e1000_hw *hw, uint32_t index, | ||
453 | uint32_t size, uint16_t *data); | ||
454 | int32_t e1000_read_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, | ||
455 | uint16_t words, uint16_t *data); | ||
456 | int32_t e1000_write_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, | ||
457 | uint16_t words, uint16_t *data); | ||
458 | int32_t e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t segment); | ||
459 | 427 | ||
460 | 428 | ||
461 | #define E1000_READ_REG_IO(a, reg) \ | 429 | #define E1000_READ_REG_IO(a, reg) \ |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 815abe559d99..0cf9ff2462ba 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -244,7 +244,7 @@ e1000_init_module(void) | |||
244 | 244 | ||
245 | printk(KERN_INFO "%s\n", e1000_copyright); | 245 | printk(KERN_INFO "%s\n", e1000_copyright); |
246 | 246 | ||
247 | ret = pci_module_init(&e1000_driver); | 247 | ret = pci_register_driver(&e1000_driver); |
248 | 248 | ||
249 | return ret; | 249 | return ret; |
250 | } | 250 | } |
@@ -4383,11 +4383,13 @@ e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t *value) | |||
4383 | pci_write_config_word(adapter->pdev, reg, *value); | 4383 | pci_write_config_word(adapter->pdev, reg, *value); |
4384 | } | 4384 | } |
4385 | 4385 | ||
4386 | #if 0 | ||
4386 | uint32_t | 4387 | uint32_t |
4387 | e1000_io_read(struct e1000_hw *hw, unsigned long port) | 4388 | e1000_io_read(struct e1000_hw *hw, unsigned long port) |
4388 | { | 4389 | { |
4389 | return inl(port); | 4390 | return inl(port); |
4390 | } | 4391 | } |
4392 | #endif /* 0 */ | ||
4391 | 4393 | ||
4392 | void | 4394 | void |
4393 | e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value) | 4395 | e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value) |
diff --git a/drivers/net/e2100.c b/drivers/net/e2100.c index e5c5cd2a2712..e4e733a380e3 100644 --- a/drivers/net/e2100.c +++ b/drivers/net/e2100.c | |||
@@ -425,8 +425,8 @@ MODULE_LICENSE("GPL"); | |||
425 | 425 | ||
426 | /* This is set up so that only a single autoprobe takes place per call. | 426 | /* This is set up so that only a single autoprobe takes place per call. |
427 | ISA device autoprobes on a running machine are not recommended. */ | 427 | ISA device autoprobes on a running machine are not recommended. */ |
428 | int | 428 | |
429 | init_module(void) | 429 | int __init init_module(void) |
430 | { | 430 | { |
431 | struct net_device *dev; | 431 | struct net_device *dev; |
432 | int this_dev, found = 0; | 432 | int this_dev, found = 0; |
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c index 20d31430c74f..8dc61d65dd23 100644 --- a/drivers/net/eepro.c +++ b/drivers/net/eepro.c | |||
@@ -1807,8 +1807,7 @@ MODULE_PARM_DESC(irq, "EtherExpress Pro/10 IRQ number(s)"); | |||
1807 | MODULE_PARM_DESC(mem, "EtherExpress Pro/10 Rx buffer size(es) in kB (3-29)"); | 1807 | MODULE_PARM_DESC(mem, "EtherExpress Pro/10 Rx buffer size(es) in kB (3-29)"); |
1808 | MODULE_PARM_DESC(autodetect, "EtherExpress Pro/10 force board(s) detection (0-1)"); | 1808 | MODULE_PARM_DESC(autodetect, "EtherExpress Pro/10 force board(s) detection (0-1)"); |
1809 | 1809 | ||
1810 | int | 1810 | int __init init_module(void) |
1811 | init_module(void) | ||
1812 | { | 1811 | { |
1813 | struct net_device *dev; | 1812 | struct net_device *dev; |
1814 | int i; | 1813 | int i; |
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index e445988c92ee..a3d515def109 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c | |||
@@ -2385,7 +2385,7 @@ static int __init eepro100_init_module(void) | |||
2385 | #ifdef MODULE | 2385 | #ifdef MODULE |
2386 | printk(version); | 2386 | printk(version); |
2387 | #endif | 2387 | #endif |
2388 | return pci_module_init(&eepro100_driver); | 2388 | return pci_register_driver(&eepro100_driver); |
2389 | } | 2389 | } |
2390 | 2390 | ||
2391 | static void __exit eepro100_cleanup_module(void) | 2391 | static void __exit eepro100_cleanup_module(void) |
diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c index 33291bcf6d4c..0701c1d810ca 100644 --- a/drivers/net/eexpress.c +++ b/drivers/net/eexpress.c | |||
@@ -1698,7 +1698,7 @@ MODULE_LICENSE("GPL"); | |||
1698 | * are specified, we verify and then use them. If no parameters are given, we | 1698 | * are specified, we verify and then use them. If no parameters are given, we |
1699 | * autoprobe for one card only. | 1699 | * autoprobe for one card only. |
1700 | */ | 1700 | */ |
1701 | int init_module(void) | 1701 | int __init init_module(void) |
1702 | { | 1702 | { |
1703 | struct net_device *dev; | 1703 | struct net_device *dev; |
1704 | int this_dev, found = 0; | 1704 | int this_dev, found = 0; |
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index a67650ccf084..25c4619d842e 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c | |||
@@ -1604,7 +1604,7 @@ static int __init epic_init (void) | |||
1604 | version, version2, version3); | 1604 | version, version2, version3); |
1605 | #endif | 1605 | #endif |
1606 | 1606 | ||
1607 | return pci_module_init (&epic_driver); | 1607 | return pci_register_driver(&epic_driver); |
1608 | } | 1608 | } |
1609 | 1609 | ||
1610 | 1610 | ||
diff --git a/drivers/net/es3210.c b/drivers/net/es3210.c index 6b0ab1eac3fb..fd7b32a24ea4 100644 --- a/drivers/net/es3210.c +++ b/drivers/net/es3210.c | |||
@@ -421,8 +421,7 @@ MODULE_PARM_DESC(mem, "memory base address(es)"); | |||
421 | MODULE_DESCRIPTION("Racal-Interlan ES3210 EISA ethernet driver"); | 421 | MODULE_DESCRIPTION("Racal-Interlan ES3210 EISA ethernet driver"); |
422 | MODULE_LICENSE("GPL"); | 422 | MODULE_LICENSE("GPL"); |
423 | 423 | ||
424 | int | 424 | int __init init_module(void) |
425 | init_module(void) | ||
426 | { | 425 | { |
427 | struct net_device *dev; | 426 | struct net_device *dev; |
428 | int this_dev, found = 0; | 427 | int this_dev, found = 0; |
diff --git a/drivers/net/eth16i.c b/drivers/net/eth16i.c index 4bf76f86d8e9..ca42efa9143c 100644 --- a/drivers/net/eth16i.c +++ b/drivers/net/eth16i.c | |||
@@ -1434,7 +1434,7 @@ MODULE_PARM_DESC(mediatype, "eth16i media type of interface(s) (bnc,tp,dix,auto, | |||
1434 | module_param(debug, int, 0); | 1434 | module_param(debug, int, 0); |
1435 | MODULE_PARM_DESC(debug, "eth16i debug level (0-6)"); | 1435 | MODULE_PARM_DESC(debug, "eth16i debug level (0-6)"); |
1436 | 1436 | ||
1437 | int init_module(void) | 1437 | int __init init_module(void) |
1438 | { | 1438 | { |
1439 | int this_dev, found = 0; | 1439 | int this_dev, found = 0; |
1440 | struct net_device *dev; | 1440 | struct net_device *dev; |
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c index 97d34fee8c1f..a2121faa610f 100644 --- a/drivers/net/fealnx.c +++ b/drivers/net/fealnx.c | |||
@@ -92,7 +92,7 @@ static int full_duplex[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1 }; | |||
92 | #include <asm/uaccess.h> | 92 | #include <asm/uaccess.h> |
93 | 93 | ||
94 | /* These identify the driver base version and may not be removed. */ | 94 | /* These identify the driver base version and may not be removed. */ |
95 | static char version[] __devinitdata = | 95 | static char version[] = |
96 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE "\n"; | 96 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE "\n"; |
97 | 97 | ||
98 | 98 | ||
@@ -1984,7 +1984,7 @@ static int __init fealnx_init(void) | |||
1984 | printk(version); | 1984 | printk(version); |
1985 | #endif | 1985 | #endif |
1986 | 1986 | ||
1987 | return pci_module_init(&fealnx_driver); | 1987 | return pci_register_driver(&fealnx_driver); |
1988 | } | 1988 | } |
1989 | 1989 | ||
1990 | static void __exit fealnx_exit(void) | 1990 | static void __exit fealnx_exit(void) |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 11b8f1b43dd5..8c8f7cf0e952 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -109,6 +109,7 @@ | |||
109 | * 0.54: 21 Mar 2006: Fix spin locks for multi irqs and cleanup. | 109 | * 0.54: 21 Mar 2006: Fix spin locks for multi irqs and cleanup. |
110 | * 0.55: 22 Mar 2006: Add flow control (pause frame). | 110 | * 0.55: 22 Mar 2006: Add flow control (pause frame). |
111 | * 0.56: 22 Mar 2006: Additional ethtool config and moduleparam support. | 111 | * 0.56: 22 Mar 2006: Additional ethtool config and moduleparam support. |
112 | * 0.57: 14 May 2006: Mac address set in probe/remove and order corrections. | ||
112 | * | 113 | * |
113 | * Known bugs: | 114 | * Known bugs: |
114 | * We suspect that on some hardware no TX done interrupts are generated. | 115 | * We suspect that on some hardware no TX done interrupts are generated. |
@@ -120,7 +121,12 @@ | |||
120 | * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few | 121 | * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few |
121 | * superfluous timer interrupts from the nic. | 122 | * superfluous timer interrupts from the nic. |
122 | */ | 123 | */ |
123 | #define FORCEDETH_VERSION "0.56" | 124 | #ifdef CONFIG_FORCEDETH_NAPI |
125 | #define DRIVERNAPI "-NAPI" | ||
126 | #else | ||
127 | #define DRIVERNAPI | ||
128 | #endif | ||
129 | #define FORCEDETH_VERSION "0.57" | ||
124 | #define DRV_NAME "forcedeth" | 130 | #define DRV_NAME "forcedeth" |
125 | 131 | ||
126 | #include <linux/module.h> | 132 | #include <linux/module.h> |
@@ -262,7 +268,8 @@ enum { | |||
262 | NvRegRingSizes = 0x108, | 268 | NvRegRingSizes = 0x108, |
263 | #define NVREG_RINGSZ_TXSHIFT 0 | 269 | #define NVREG_RINGSZ_TXSHIFT 0 |
264 | #define NVREG_RINGSZ_RXSHIFT 16 | 270 | #define NVREG_RINGSZ_RXSHIFT 16 |
265 | NvRegUnknownTransmitterReg = 0x10c, | 271 | NvRegTransmitPoll = 0x10c, |
272 | #define NVREG_TRANSMITPOLL_MAC_ADDR_REV 0x00008000 | ||
266 | NvRegLinkSpeed = 0x110, | 273 | NvRegLinkSpeed = 0x110, |
267 | #define NVREG_LINKSPEED_FORCE 0x10000 | 274 | #define NVREG_LINKSPEED_FORCE 0x10000 |
268 | #define NVREG_LINKSPEED_10 1000 | 275 | #define NVREG_LINKSPEED_10 1000 |
@@ -381,21 +388,21 @@ enum { | |||
381 | 388 | ||
382 | /* Big endian: should work, but is untested */ | 389 | /* Big endian: should work, but is untested */ |
383 | struct ring_desc { | 390 | struct ring_desc { |
384 | u32 PacketBuffer; | 391 | __le32 buf; |
385 | u32 FlagLen; | 392 | __le32 flaglen; |
386 | }; | 393 | }; |
387 | 394 | ||
388 | struct ring_desc_ex { | 395 | struct ring_desc_ex { |
389 | u32 PacketBufferHigh; | 396 | __le32 bufhigh; |
390 | u32 PacketBufferLow; | 397 | __le32 buflow; |
391 | u32 TxVlan; | 398 | __le32 txvlan; |
392 | u32 FlagLen; | 399 | __le32 flaglen; |
393 | }; | 400 | }; |
394 | 401 | ||
395 | typedef union _ring_type { | 402 | union ring_type { |
396 | struct ring_desc* orig; | 403 | struct ring_desc* orig; |
397 | struct ring_desc_ex* ex; | 404 | struct ring_desc_ex* ex; |
398 | } ring_type; | 405 | }; |
399 | 406 | ||
400 | #define FLAG_MASK_V1 0xffff0000 | 407 | #define FLAG_MASK_V1 0xffff0000 |
401 | #define FLAG_MASK_V2 0xffffc000 | 408 | #define FLAG_MASK_V2 0xffffc000 |
@@ -653,8 +660,8 @@ static const struct nv_ethtool_str nv_etests_str[] = { | |||
653 | }; | 660 | }; |
654 | 661 | ||
655 | struct register_test { | 662 | struct register_test { |
656 | u32 reg; | 663 | __le32 reg; |
657 | u32 mask; | 664 | __le32 mask; |
658 | }; | 665 | }; |
659 | 666 | ||
660 | static const struct register_test nv_registers_test[] = { | 667 | static const struct register_test nv_registers_test[] = { |
@@ -713,7 +720,7 @@ struct fe_priv { | |||
713 | /* rx specific fields. | 720 | /* rx specific fields. |
714 | * Locking: Within irq hander or disable_irq+spin_lock(&np->lock); | 721 | * Locking: Within irq hander or disable_irq+spin_lock(&np->lock); |
715 | */ | 722 | */ |
716 | ring_type rx_ring; | 723 | union ring_type rx_ring; |
717 | unsigned int cur_rx, refill_rx; | 724 | unsigned int cur_rx, refill_rx; |
718 | struct sk_buff **rx_skbuff; | 725 | struct sk_buff **rx_skbuff; |
719 | dma_addr_t *rx_dma; | 726 | dma_addr_t *rx_dma; |
@@ -733,7 +740,7 @@ struct fe_priv { | |||
733 | /* | 740 | /* |
734 | * tx specific fields. | 741 | * tx specific fields. |
735 | */ | 742 | */ |
736 | ring_type tx_ring; | 743 | union ring_type tx_ring; |
737 | unsigned int next_tx, nic_tx; | 744 | unsigned int next_tx, nic_tx; |
738 | struct sk_buff **tx_skbuff; | 745 | struct sk_buff **tx_skbuff; |
739 | dma_addr_t *tx_dma; | 746 | dma_addr_t *tx_dma; |
@@ -826,13 +833,13 @@ static inline void pci_push(u8 __iomem *base) | |||
826 | 833 | ||
827 | static inline u32 nv_descr_getlength(struct ring_desc *prd, u32 v) | 834 | static inline u32 nv_descr_getlength(struct ring_desc *prd, u32 v) |
828 | { | 835 | { |
829 | return le32_to_cpu(prd->FlagLen) | 836 | return le32_to_cpu(prd->flaglen) |
830 | & ((v == DESC_VER_1) ? LEN_MASK_V1 : LEN_MASK_V2); | 837 | & ((v == DESC_VER_1) ? LEN_MASK_V1 : LEN_MASK_V2); |
831 | } | 838 | } |
832 | 839 | ||
833 | static inline u32 nv_descr_getlength_ex(struct ring_desc_ex *prd, u32 v) | 840 | static inline u32 nv_descr_getlength_ex(struct ring_desc_ex *prd, u32 v) |
834 | { | 841 | { |
835 | return le32_to_cpu(prd->FlagLen) & LEN_MASK_V2; | 842 | return le32_to_cpu(prd->flaglen) & LEN_MASK_V2; |
836 | } | 843 | } |
837 | 844 | ||
838 | static int reg_delay(struct net_device *dev, int offset, u32 mask, u32 target, | 845 | static int reg_delay(struct net_device *dev, int offset, u32 mask, u32 target, |
@@ -885,7 +892,7 @@ static void free_rings(struct net_device *dev) | |||
885 | struct fe_priv *np = get_nvpriv(dev); | 892 | struct fe_priv *np = get_nvpriv(dev); |
886 | 893 | ||
887 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 894 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
888 | if(np->rx_ring.orig) | 895 | if (np->rx_ring.orig) |
889 | pci_free_consistent(np->pci_dev, sizeof(struct ring_desc) * (np->rx_ring_size + np->tx_ring_size), | 896 | pci_free_consistent(np->pci_dev, sizeof(struct ring_desc) * (np->rx_ring_size + np->tx_ring_size), |
890 | np->rx_ring.orig, np->ring_addr); | 897 | np->rx_ring.orig, np->ring_addr); |
891 | } else { | 898 | } else { |
@@ -1178,7 +1185,7 @@ static void nv_stop_tx(struct net_device *dev) | |||
1178 | KERN_INFO "nv_stop_tx: TransmitterStatus remained busy"); | 1185 | KERN_INFO "nv_stop_tx: TransmitterStatus remained busy"); |
1179 | 1186 | ||
1180 | udelay(NV_TXSTOP_DELAY2); | 1187 | udelay(NV_TXSTOP_DELAY2); |
1181 | writel(0, base + NvRegUnknownTransmitterReg); | 1188 | writel(readl(base + NvRegTransmitPoll) & NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll); |
1182 | } | 1189 | } |
1183 | 1190 | ||
1184 | static void nv_txrx_reset(struct net_device *dev) | 1191 | static void nv_txrx_reset(struct net_device *dev) |
@@ -1258,14 +1265,14 @@ static int nv_alloc_rx(struct net_device *dev) | |||
1258 | np->rx_dma[nr] = pci_map_single(np->pci_dev, skb->data, | 1265 | np->rx_dma[nr] = pci_map_single(np->pci_dev, skb->data, |
1259 | skb->end-skb->data, PCI_DMA_FROMDEVICE); | 1266 | skb->end-skb->data, PCI_DMA_FROMDEVICE); |
1260 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 1267 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
1261 | np->rx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->rx_dma[nr]); | 1268 | np->rx_ring.orig[nr].buf = cpu_to_le32(np->rx_dma[nr]); |
1262 | wmb(); | 1269 | wmb(); |
1263 | np->rx_ring.orig[nr].FlagLen = cpu_to_le32(np->rx_buf_sz | NV_RX_AVAIL); | 1270 | np->rx_ring.orig[nr].flaglen = cpu_to_le32(np->rx_buf_sz | NV_RX_AVAIL); |
1264 | } else { | 1271 | } else { |
1265 | np->rx_ring.ex[nr].PacketBufferHigh = cpu_to_le64(np->rx_dma[nr]) >> 32; | 1272 | np->rx_ring.ex[nr].bufhigh = cpu_to_le64(np->rx_dma[nr]) >> 32; |
1266 | np->rx_ring.ex[nr].PacketBufferLow = cpu_to_le64(np->rx_dma[nr]) & 0x0FFFFFFFF; | 1273 | np->rx_ring.ex[nr].buflow = cpu_to_le64(np->rx_dma[nr]) & 0x0FFFFFFFF; |
1267 | wmb(); | 1274 | wmb(); |
1268 | np->rx_ring.ex[nr].FlagLen = cpu_to_le32(np->rx_buf_sz | NV_RX2_AVAIL); | 1275 | np->rx_ring.ex[nr].flaglen = cpu_to_le32(np->rx_buf_sz | NV_RX2_AVAIL); |
1269 | } | 1276 | } |
1270 | dprintk(KERN_DEBUG "%s: nv_alloc_rx: Packet %d marked as Available\n", | 1277 | dprintk(KERN_DEBUG "%s: nv_alloc_rx: Packet %d marked as Available\n", |
1271 | dev->name, refill_rx); | 1278 | dev->name, refill_rx); |
@@ -1277,6 +1284,16 @@ static int nv_alloc_rx(struct net_device *dev) | |||
1277 | return 0; | 1284 | return 0; |
1278 | } | 1285 | } |
1279 | 1286 | ||
1287 | /* If rx bufs are exhausted called after 50ms to attempt to refresh */ | ||
1288 | #ifdef CONFIG_FORCEDETH_NAPI | ||
1289 | static void nv_do_rx_refill(unsigned long data) | ||
1290 | { | ||
1291 | struct net_device *dev = (struct net_device *) data; | ||
1292 | |||
1293 | /* Just reschedule NAPI rx processing */ | ||
1294 | netif_rx_schedule(dev); | ||
1295 | } | ||
1296 | #else | ||
1280 | static void nv_do_rx_refill(unsigned long data) | 1297 | static void nv_do_rx_refill(unsigned long data) |
1281 | { | 1298 | { |
1282 | struct net_device *dev = (struct net_device *) data; | 1299 | struct net_device *dev = (struct net_device *) data; |
@@ -1305,6 +1322,7 @@ static void nv_do_rx_refill(unsigned long data) | |||
1305 | enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); | 1322 | enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); |
1306 | } | 1323 | } |
1307 | } | 1324 | } |
1325 | #endif | ||
1308 | 1326 | ||
1309 | static void nv_init_rx(struct net_device *dev) | 1327 | static void nv_init_rx(struct net_device *dev) |
1310 | { | 1328 | { |
@@ -1315,9 +1333,9 @@ static void nv_init_rx(struct net_device *dev) | |||
1315 | np->refill_rx = 0; | 1333 | np->refill_rx = 0; |
1316 | for (i = 0; i < np->rx_ring_size; i++) | 1334 | for (i = 0; i < np->rx_ring_size; i++) |
1317 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) | 1335 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
1318 | np->rx_ring.orig[i].FlagLen = 0; | 1336 | np->rx_ring.orig[i].flaglen = 0; |
1319 | else | 1337 | else |
1320 | np->rx_ring.ex[i].FlagLen = 0; | 1338 | np->rx_ring.ex[i].flaglen = 0; |
1321 | } | 1339 | } |
1322 | 1340 | ||
1323 | static void nv_init_tx(struct net_device *dev) | 1341 | static void nv_init_tx(struct net_device *dev) |
@@ -1328,9 +1346,9 @@ static void nv_init_tx(struct net_device *dev) | |||
1328 | np->next_tx = np->nic_tx = 0; | 1346 | np->next_tx = np->nic_tx = 0; |
1329 | for (i = 0; i < np->tx_ring_size; i++) { | 1347 | for (i = 0; i < np->tx_ring_size; i++) { |
1330 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) | 1348 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
1331 | np->tx_ring.orig[i].FlagLen = 0; | 1349 | np->tx_ring.orig[i].flaglen = 0; |
1332 | else | 1350 | else |
1333 | np->tx_ring.ex[i].FlagLen = 0; | 1351 | np->tx_ring.ex[i].flaglen = 0; |
1334 | np->tx_skbuff[i] = NULL; | 1352 | np->tx_skbuff[i] = NULL; |
1335 | np->tx_dma[i] = 0; | 1353 | np->tx_dma[i] = 0; |
1336 | } | 1354 | } |
@@ -1373,9 +1391,9 @@ static void nv_drain_tx(struct net_device *dev) | |||
1373 | 1391 | ||
1374 | for (i = 0; i < np->tx_ring_size; i++) { | 1392 | for (i = 0; i < np->tx_ring_size; i++) { |
1375 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) | 1393 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
1376 | np->tx_ring.orig[i].FlagLen = 0; | 1394 | np->tx_ring.orig[i].flaglen = 0; |
1377 | else | 1395 | else |
1378 | np->tx_ring.ex[i].FlagLen = 0; | 1396 | np->tx_ring.ex[i].flaglen = 0; |
1379 | if (nv_release_txskb(dev, i)) | 1397 | if (nv_release_txskb(dev, i)) |
1380 | np->stats.tx_dropped++; | 1398 | np->stats.tx_dropped++; |
1381 | } | 1399 | } |
@@ -1387,9 +1405,9 @@ static void nv_drain_rx(struct net_device *dev) | |||
1387 | int i; | 1405 | int i; |
1388 | for (i = 0; i < np->rx_ring_size; i++) { | 1406 | for (i = 0; i < np->rx_ring_size; i++) { |
1389 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) | 1407 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
1390 | np->rx_ring.orig[i].FlagLen = 0; | 1408 | np->rx_ring.orig[i].flaglen = 0; |
1391 | else | 1409 | else |
1392 | np->rx_ring.ex[i].FlagLen = 0; | 1410 | np->rx_ring.ex[i].flaglen = 0; |
1393 | wmb(); | 1411 | wmb(); |
1394 | if (np->rx_skbuff[i]) { | 1412 | if (np->rx_skbuff[i]) { |
1395 | pci_unmap_single(np->pci_dev, np->rx_dma[i], | 1413 | pci_unmap_single(np->pci_dev, np->rx_dma[i], |
@@ -1450,17 +1468,17 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1450 | np->tx_dma_len[nr] = bcnt; | 1468 | np->tx_dma_len[nr] = bcnt; |
1451 | 1469 | ||
1452 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 1470 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
1453 | np->tx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->tx_dma[nr]); | 1471 | np->tx_ring.orig[nr].buf = cpu_to_le32(np->tx_dma[nr]); |
1454 | np->tx_ring.orig[nr].FlagLen = cpu_to_le32((bcnt-1) | tx_flags); | 1472 | np->tx_ring.orig[nr].flaglen = cpu_to_le32((bcnt-1) | tx_flags); |
1455 | } else { | 1473 | } else { |
1456 | np->tx_ring.ex[nr].PacketBufferHigh = cpu_to_le64(np->tx_dma[nr]) >> 32; | 1474 | np->tx_ring.ex[nr].bufhigh = cpu_to_le64(np->tx_dma[nr]) >> 32; |
1457 | np->tx_ring.ex[nr].PacketBufferLow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; | 1475 | np->tx_ring.ex[nr].buflow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; |
1458 | np->tx_ring.ex[nr].FlagLen = cpu_to_le32((bcnt-1) | tx_flags); | 1476 | np->tx_ring.ex[nr].flaglen = cpu_to_le32((bcnt-1) | tx_flags); |
1459 | } | 1477 | } |
1460 | tx_flags = np->tx_flags; | 1478 | tx_flags = np->tx_flags; |
1461 | offset += bcnt; | 1479 | offset += bcnt; |
1462 | size -= bcnt; | 1480 | size -= bcnt; |
1463 | } while(size); | 1481 | } while (size); |
1464 | 1482 | ||
1465 | /* setup the fragments */ | 1483 | /* setup the fragments */ |
1466 | for (i = 0; i < fragments; i++) { | 1484 | for (i = 0; i < fragments; i++) { |
@@ -1477,12 +1495,12 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1477 | np->tx_dma_len[nr] = bcnt; | 1495 | np->tx_dma_len[nr] = bcnt; |
1478 | 1496 | ||
1479 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 1497 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
1480 | np->tx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->tx_dma[nr]); | 1498 | np->tx_ring.orig[nr].buf = cpu_to_le32(np->tx_dma[nr]); |
1481 | np->tx_ring.orig[nr].FlagLen = cpu_to_le32((bcnt-1) | tx_flags); | 1499 | np->tx_ring.orig[nr].flaglen = cpu_to_le32((bcnt-1) | tx_flags); |
1482 | } else { | 1500 | } else { |
1483 | np->tx_ring.ex[nr].PacketBufferHigh = cpu_to_le64(np->tx_dma[nr]) >> 32; | 1501 | np->tx_ring.ex[nr].bufhigh = cpu_to_le64(np->tx_dma[nr]) >> 32; |
1484 | np->tx_ring.ex[nr].PacketBufferLow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; | 1502 | np->tx_ring.ex[nr].buflow = cpu_to_le64(np->tx_dma[nr]) & 0x0FFFFFFFF; |
1485 | np->tx_ring.ex[nr].FlagLen = cpu_to_le32((bcnt-1) | tx_flags); | 1503 | np->tx_ring.ex[nr].flaglen = cpu_to_le32((bcnt-1) | tx_flags); |
1486 | } | 1504 | } |
1487 | offset += bcnt; | 1505 | offset += bcnt; |
1488 | size -= bcnt; | 1506 | size -= bcnt; |
@@ -1491,9 +1509,9 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1491 | 1509 | ||
1492 | /* set last fragment flag */ | 1510 | /* set last fragment flag */ |
1493 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 1511 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
1494 | np->tx_ring.orig[nr].FlagLen |= cpu_to_le32(tx_flags_extra); | 1512 | np->tx_ring.orig[nr].flaglen |= cpu_to_le32(tx_flags_extra); |
1495 | } else { | 1513 | } else { |
1496 | np->tx_ring.ex[nr].FlagLen |= cpu_to_le32(tx_flags_extra); | 1514 | np->tx_ring.ex[nr].flaglen |= cpu_to_le32(tx_flags_extra); |
1497 | } | 1515 | } |
1498 | 1516 | ||
1499 | np->tx_skbuff[nr] = skb; | 1517 | np->tx_skbuff[nr] = skb; |
@@ -1512,10 +1530,10 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1512 | 1530 | ||
1513 | /* set tx flags */ | 1531 | /* set tx flags */ |
1514 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 1532 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
1515 | np->tx_ring.orig[start_nr].FlagLen |= cpu_to_le32(tx_flags | tx_flags_extra); | 1533 | np->tx_ring.orig[start_nr].flaglen |= cpu_to_le32(tx_flags | tx_flags_extra); |
1516 | } else { | 1534 | } else { |
1517 | np->tx_ring.ex[start_nr].TxVlan = cpu_to_le32(tx_flags_vlan); | 1535 | np->tx_ring.ex[start_nr].txvlan = cpu_to_le32(tx_flags_vlan); |
1518 | np->tx_ring.ex[start_nr].FlagLen |= cpu_to_le32(tx_flags | tx_flags_extra); | 1536 | np->tx_ring.ex[start_nr].flaglen |= cpu_to_le32(tx_flags | tx_flags_extra); |
1519 | } | 1537 | } |
1520 | 1538 | ||
1521 | dprintk(KERN_DEBUG "%s: nv_start_xmit: packet %d (entries %d) queued for transmission. tx_flags_extra: %x\n", | 1539 | dprintk(KERN_DEBUG "%s: nv_start_xmit: packet %d (entries %d) queued for transmission. tx_flags_extra: %x\n", |
@@ -1547,7 +1565,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1547 | static void nv_tx_done(struct net_device *dev) | 1565 | static void nv_tx_done(struct net_device *dev) |
1548 | { | 1566 | { |
1549 | struct fe_priv *np = netdev_priv(dev); | 1567 | struct fe_priv *np = netdev_priv(dev); |
1550 | u32 Flags; | 1568 | u32 flags; |
1551 | unsigned int i; | 1569 | unsigned int i; |
1552 | struct sk_buff *skb; | 1570 | struct sk_buff *skb; |
1553 | 1571 | ||
@@ -1555,22 +1573,22 @@ static void nv_tx_done(struct net_device *dev) | |||
1555 | i = np->nic_tx % np->tx_ring_size; | 1573 | i = np->nic_tx % np->tx_ring_size; |
1556 | 1574 | ||
1557 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) | 1575 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) |
1558 | Flags = le32_to_cpu(np->tx_ring.orig[i].FlagLen); | 1576 | flags = le32_to_cpu(np->tx_ring.orig[i].flaglen); |
1559 | else | 1577 | else |
1560 | Flags = le32_to_cpu(np->tx_ring.ex[i].FlagLen); | 1578 | flags = le32_to_cpu(np->tx_ring.ex[i].flaglen); |
1561 | 1579 | ||
1562 | dprintk(KERN_DEBUG "%s: nv_tx_done: looking at packet %d, Flags 0x%x.\n", | 1580 | dprintk(KERN_DEBUG "%s: nv_tx_done: looking at packet %d, flags 0x%x.\n", |
1563 | dev->name, np->nic_tx, Flags); | 1581 | dev->name, np->nic_tx, flags); |
1564 | if (Flags & NV_TX_VALID) | 1582 | if (flags & NV_TX_VALID) |
1565 | break; | 1583 | break; |
1566 | if (np->desc_ver == DESC_VER_1) { | 1584 | if (np->desc_ver == DESC_VER_1) { |
1567 | if (Flags & NV_TX_LASTPACKET) { | 1585 | if (flags & NV_TX_LASTPACKET) { |
1568 | skb = np->tx_skbuff[i]; | 1586 | skb = np->tx_skbuff[i]; |
1569 | if (Flags & (NV_TX_RETRYERROR|NV_TX_CARRIERLOST|NV_TX_LATECOLLISION| | 1587 | if (flags & (NV_TX_RETRYERROR|NV_TX_CARRIERLOST|NV_TX_LATECOLLISION| |
1570 | NV_TX_UNDERFLOW|NV_TX_ERROR)) { | 1588 | NV_TX_UNDERFLOW|NV_TX_ERROR)) { |
1571 | if (Flags & NV_TX_UNDERFLOW) | 1589 | if (flags & NV_TX_UNDERFLOW) |
1572 | np->stats.tx_fifo_errors++; | 1590 | np->stats.tx_fifo_errors++; |
1573 | if (Flags & NV_TX_CARRIERLOST) | 1591 | if (flags & NV_TX_CARRIERLOST) |
1574 | np->stats.tx_carrier_errors++; | 1592 | np->stats.tx_carrier_errors++; |
1575 | np->stats.tx_errors++; | 1593 | np->stats.tx_errors++; |
1576 | } else { | 1594 | } else { |
@@ -1579,13 +1597,13 @@ static void nv_tx_done(struct net_device *dev) | |||
1579 | } | 1597 | } |
1580 | } | 1598 | } |
1581 | } else { | 1599 | } else { |
1582 | if (Flags & NV_TX2_LASTPACKET) { | 1600 | if (flags & NV_TX2_LASTPACKET) { |
1583 | skb = np->tx_skbuff[i]; | 1601 | skb = np->tx_skbuff[i]; |
1584 | if (Flags & (NV_TX2_RETRYERROR|NV_TX2_CARRIERLOST|NV_TX2_LATECOLLISION| | 1602 | if (flags & (NV_TX2_RETRYERROR|NV_TX2_CARRIERLOST|NV_TX2_LATECOLLISION| |
1585 | NV_TX2_UNDERFLOW|NV_TX2_ERROR)) { | 1603 | NV_TX2_UNDERFLOW|NV_TX2_ERROR)) { |
1586 | if (Flags & NV_TX2_UNDERFLOW) | 1604 | if (flags & NV_TX2_UNDERFLOW) |
1587 | np->stats.tx_fifo_errors++; | 1605 | np->stats.tx_fifo_errors++; |
1588 | if (Flags & NV_TX2_CARRIERLOST) | 1606 | if (flags & NV_TX2_CARRIERLOST) |
1589 | np->stats.tx_carrier_errors++; | 1607 | np->stats.tx_carrier_errors++; |
1590 | np->stats.tx_errors++; | 1608 | np->stats.tx_errors++; |
1591 | } else { | 1609 | } else { |
@@ -1638,29 +1656,29 @@ static void nv_tx_timeout(struct net_device *dev) | |||
1638 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 1656 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
1639 | printk(KERN_INFO "%03x: %08x %08x // %08x %08x // %08x %08x // %08x %08x\n", | 1657 | printk(KERN_INFO "%03x: %08x %08x // %08x %08x // %08x %08x // %08x %08x\n", |
1640 | i, | 1658 | i, |
1641 | le32_to_cpu(np->tx_ring.orig[i].PacketBuffer), | 1659 | le32_to_cpu(np->tx_ring.orig[i].buf), |
1642 | le32_to_cpu(np->tx_ring.orig[i].FlagLen), | 1660 | le32_to_cpu(np->tx_ring.orig[i].flaglen), |
1643 | le32_to_cpu(np->tx_ring.orig[i+1].PacketBuffer), | 1661 | le32_to_cpu(np->tx_ring.orig[i+1].buf), |
1644 | le32_to_cpu(np->tx_ring.orig[i+1].FlagLen), | 1662 | le32_to_cpu(np->tx_ring.orig[i+1].flaglen), |
1645 | le32_to_cpu(np->tx_ring.orig[i+2].PacketBuffer), | 1663 | le32_to_cpu(np->tx_ring.orig[i+2].buf), |
1646 | le32_to_cpu(np->tx_ring.orig[i+2].FlagLen), | 1664 | le32_to_cpu(np->tx_ring.orig[i+2].flaglen), |
1647 | le32_to_cpu(np->tx_ring.orig[i+3].PacketBuffer), | 1665 | le32_to_cpu(np->tx_ring.orig[i+3].buf), |
1648 | le32_to_cpu(np->tx_ring.orig[i+3].FlagLen)); | 1666 | le32_to_cpu(np->tx_ring.orig[i+3].flaglen)); |
1649 | } else { | 1667 | } else { |
1650 | printk(KERN_INFO "%03x: %08x %08x %08x // %08x %08x %08x // %08x %08x %08x // %08x %08x %08x\n", | 1668 | printk(KERN_INFO "%03x: %08x %08x %08x // %08x %08x %08x // %08x %08x %08x // %08x %08x %08x\n", |
1651 | i, | 1669 | i, |
1652 | le32_to_cpu(np->tx_ring.ex[i].PacketBufferHigh), | 1670 | le32_to_cpu(np->tx_ring.ex[i].bufhigh), |
1653 | le32_to_cpu(np->tx_ring.ex[i].PacketBufferLow), | 1671 | le32_to_cpu(np->tx_ring.ex[i].buflow), |
1654 | le32_to_cpu(np->tx_ring.ex[i].FlagLen), | 1672 | le32_to_cpu(np->tx_ring.ex[i].flaglen), |
1655 | le32_to_cpu(np->tx_ring.ex[i+1].PacketBufferHigh), | 1673 | le32_to_cpu(np->tx_ring.ex[i+1].bufhigh), |
1656 | le32_to_cpu(np->tx_ring.ex[i+1].PacketBufferLow), | 1674 | le32_to_cpu(np->tx_ring.ex[i+1].buflow), |
1657 | le32_to_cpu(np->tx_ring.ex[i+1].FlagLen), | 1675 | le32_to_cpu(np->tx_ring.ex[i+1].flaglen), |
1658 | le32_to_cpu(np->tx_ring.ex[i+2].PacketBufferHigh), | 1676 | le32_to_cpu(np->tx_ring.ex[i+2].bufhigh), |
1659 | le32_to_cpu(np->tx_ring.ex[i+2].PacketBufferLow), | 1677 | le32_to_cpu(np->tx_ring.ex[i+2].buflow), |
1660 | le32_to_cpu(np->tx_ring.ex[i+2].FlagLen), | 1678 | le32_to_cpu(np->tx_ring.ex[i+2].flaglen), |
1661 | le32_to_cpu(np->tx_ring.ex[i+3].PacketBufferHigh), | 1679 | le32_to_cpu(np->tx_ring.ex[i+3].bufhigh), |
1662 | le32_to_cpu(np->tx_ring.ex[i+3].PacketBufferLow), | 1680 | le32_to_cpu(np->tx_ring.ex[i+3].buflow), |
1663 | le32_to_cpu(np->tx_ring.ex[i+3].FlagLen)); | 1681 | le32_to_cpu(np->tx_ring.ex[i+3].flaglen)); |
1664 | } | 1682 | } |
1665 | } | 1683 | } |
1666 | } | 1684 | } |
@@ -1697,7 +1715,7 @@ static int nv_getlen(struct net_device *dev, void *packet, int datalen) | |||
1697 | int protolen; /* length as stored in the proto field */ | 1715 | int protolen; /* length as stored in the proto field */ |
1698 | 1716 | ||
1699 | /* 1) calculate len according to header */ | 1717 | /* 1) calculate len according to header */ |
1700 | if ( ((struct vlan_ethhdr *)packet)->h_vlan_proto == __constant_htons(ETH_P_8021Q)) { | 1718 | if ( ((struct vlan_ethhdr *)packet)->h_vlan_proto == htons(ETH_P_8021Q)) { |
1701 | protolen = ntohs( ((struct vlan_ethhdr *)packet)->h_vlan_encapsulated_proto ); | 1719 | protolen = ntohs( ((struct vlan_ethhdr *)packet)->h_vlan_encapsulated_proto ); |
1702 | hdrlen = VLAN_HLEN; | 1720 | hdrlen = VLAN_HLEN; |
1703 | } else { | 1721 | } else { |
@@ -1740,13 +1758,14 @@ static int nv_getlen(struct net_device *dev, void *packet, int datalen) | |||
1740 | } | 1758 | } |
1741 | } | 1759 | } |
1742 | 1760 | ||
1743 | static void nv_rx_process(struct net_device *dev) | 1761 | static int nv_rx_process(struct net_device *dev, int limit) |
1744 | { | 1762 | { |
1745 | struct fe_priv *np = netdev_priv(dev); | 1763 | struct fe_priv *np = netdev_priv(dev); |
1746 | u32 Flags; | 1764 | u32 flags; |
1747 | u32 vlanflags = 0; | 1765 | u32 vlanflags = 0; |
1766 | int count; | ||
1748 | 1767 | ||
1749 | for (;;) { | 1768 | for (count = 0; count < limit; ++count) { |
1750 | struct sk_buff *skb; | 1769 | struct sk_buff *skb; |
1751 | int len; | 1770 | int len; |
1752 | int i; | 1771 | int i; |
@@ -1755,18 +1774,18 @@ static void nv_rx_process(struct net_device *dev) | |||
1755 | 1774 | ||
1756 | i = np->cur_rx % np->rx_ring_size; | 1775 | i = np->cur_rx % np->rx_ring_size; |
1757 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 1776 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
1758 | Flags = le32_to_cpu(np->rx_ring.orig[i].FlagLen); | 1777 | flags = le32_to_cpu(np->rx_ring.orig[i].flaglen); |
1759 | len = nv_descr_getlength(&np->rx_ring.orig[i], np->desc_ver); | 1778 | len = nv_descr_getlength(&np->rx_ring.orig[i], np->desc_ver); |
1760 | } else { | 1779 | } else { |
1761 | Flags = le32_to_cpu(np->rx_ring.ex[i].FlagLen); | 1780 | flags = le32_to_cpu(np->rx_ring.ex[i].flaglen); |
1762 | len = nv_descr_getlength_ex(&np->rx_ring.ex[i], np->desc_ver); | 1781 | len = nv_descr_getlength_ex(&np->rx_ring.ex[i], np->desc_ver); |
1763 | vlanflags = le32_to_cpu(np->rx_ring.ex[i].PacketBufferLow); | 1782 | vlanflags = le32_to_cpu(np->rx_ring.ex[i].buflow); |
1764 | } | 1783 | } |
1765 | 1784 | ||
1766 | dprintk(KERN_DEBUG "%s: nv_rx_process: looking at packet %d, Flags 0x%x.\n", | 1785 | dprintk(KERN_DEBUG "%s: nv_rx_process: looking at packet %d, flags 0x%x.\n", |
1767 | dev->name, np->cur_rx, Flags); | 1786 | dev->name, np->cur_rx, flags); |
1768 | 1787 | ||
1769 | if (Flags & NV_RX_AVAIL) | 1788 | if (flags & NV_RX_AVAIL) |
1770 | break; /* still owned by hardware, */ | 1789 | break; /* still owned by hardware, */ |
1771 | 1790 | ||
1772 | /* | 1791 | /* |
@@ -1780,7 +1799,7 @@ static void nv_rx_process(struct net_device *dev) | |||
1780 | 1799 | ||
1781 | { | 1800 | { |
1782 | int j; | 1801 | int j; |
1783 | dprintk(KERN_DEBUG "Dumping packet (flags 0x%x).",Flags); | 1802 | dprintk(KERN_DEBUG "Dumping packet (flags 0x%x).",flags); |
1784 | for (j=0; j<64; j++) { | 1803 | for (j=0; j<64; j++) { |
1785 | if ((j%16) == 0) | 1804 | if ((j%16) == 0) |
1786 | dprintk("\n%03x:", j); | 1805 | dprintk("\n%03x:", j); |
@@ -1790,30 +1809,30 @@ static void nv_rx_process(struct net_device *dev) | |||
1790 | } | 1809 | } |
1791 | /* look at what we actually got: */ | 1810 | /* look at what we actually got: */ |
1792 | if (np->desc_ver == DESC_VER_1) { | 1811 | if (np->desc_ver == DESC_VER_1) { |
1793 | if (!(Flags & NV_RX_DESCRIPTORVALID)) | 1812 | if (!(flags & NV_RX_DESCRIPTORVALID)) |
1794 | goto next_pkt; | 1813 | goto next_pkt; |
1795 | 1814 | ||
1796 | if (Flags & NV_RX_ERROR) { | 1815 | if (flags & NV_RX_ERROR) { |
1797 | if (Flags & NV_RX_MISSEDFRAME) { | 1816 | if (flags & NV_RX_MISSEDFRAME) { |
1798 | np->stats.rx_missed_errors++; | 1817 | np->stats.rx_missed_errors++; |
1799 | np->stats.rx_errors++; | 1818 | np->stats.rx_errors++; |
1800 | goto next_pkt; | 1819 | goto next_pkt; |
1801 | } | 1820 | } |
1802 | if (Flags & (NV_RX_ERROR1|NV_RX_ERROR2|NV_RX_ERROR3)) { | 1821 | if (flags & (NV_RX_ERROR1|NV_RX_ERROR2|NV_RX_ERROR3)) { |
1803 | np->stats.rx_errors++; | 1822 | np->stats.rx_errors++; |
1804 | goto next_pkt; | 1823 | goto next_pkt; |
1805 | } | 1824 | } |
1806 | if (Flags & NV_RX_CRCERR) { | 1825 | if (flags & NV_RX_CRCERR) { |
1807 | np->stats.rx_crc_errors++; | 1826 | np->stats.rx_crc_errors++; |
1808 | np->stats.rx_errors++; | 1827 | np->stats.rx_errors++; |
1809 | goto next_pkt; | 1828 | goto next_pkt; |
1810 | } | 1829 | } |
1811 | if (Flags & NV_RX_OVERFLOW) { | 1830 | if (flags & NV_RX_OVERFLOW) { |
1812 | np->stats.rx_over_errors++; | 1831 | np->stats.rx_over_errors++; |
1813 | np->stats.rx_errors++; | 1832 | np->stats.rx_errors++; |
1814 | goto next_pkt; | 1833 | goto next_pkt; |
1815 | } | 1834 | } |
1816 | if (Flags & NV_RX_ERROR4) { | 1835 | if (flags & NV_RX_ERROR4) { |
1817 | len = nv_getlen(dev, np->rx_skbuff[i]->data, len); | 1836 | len = nv_getlen(dev, np->rx_skbuff[i]->data, len); |
1818 | if (len < 0) { | 1837 | if (len < 0) { |
1819 | np->stats.rx_errors++; | 1838 | np->stats.rx_errors++; |
@@ -1821,32 +1840,32 @@ static void nv_rx_process(struct net_device *dev) | |||
1821 | } | 1840 | } |
1822 | } | 1841 | } |
1823 | /* framing errors are soft errors. */ | 1842 | /* framing errors are soft errors. */ |
1824 | if (Flags & NV_RX_FRAMINGERR) { | 1843 | if (flags & NV_RX_FRAMINGERR) { |
1825 | if (Flags & NV_RX_SUBSTRACT1) { | 1844 | if (flags & NV_RX_SUBSTRACT1) { |
1826 | len--; | 1845 | len--; |
1827 | } | 1846 | } |
1828 | } | 1847 | } |
1829 | } | 1848 | } |
1830 | } else { | 1849 | } else { |
1831 | if (!(Flags & NV_RX2_DESCRIPTORVALID)) | 1850 | if (!(flags & NV_RX2_DESCRIPTORVALID)) |
1832 | goto next_pkt; | 1851 | goto next_pkt; |
1833 | 1852 | ||
1834 | if (Flags & NV_RX2_ERROR) { | 1853 | if (flags & NV_RX2_ERROR) { |
1835 | if (Flags & (NV_RX2_ERROR1|NV_RX2_ERROR2|NV_RX2_ERROR3)) { | 1854 | if (flags & (NV_RX2_ERROR1|NV_RX2_ERROR2|NV_RX2_ERROR3)) { |
1836 | np->stats.rx_errors++; | 1855 | np->stats.rx_errors++; |
1837 | goto next_pkt; | 1856 | goto next_pkt; |
1838 | } | 1857 | } |
1839 | if (Flags & NV_RX2_CRCERR) { | 1858 | if (flags & NV_RX2_CRCERR) { |
1840 | np->stats.rx_crc_errors++; | 1859 | np->stats.rx_crc_errors++; |
1841 | np->stats.rx_errors++; | 1860 | np->stats.rx_errors++; |
1842 | goto next_pkt; | 1861 | goto next_pkt; |
1843 | } | 1862 | } |
1844 | if (Flags & NV_RX2_OVERFLOW) { | 1863 | if (flags & NV_RX2_OVERFLOW) { |
1845 | np->stats.rx_over_errors++; | 1864 | np->stats.rx_over_errors++; |
1846 | np->stats.rx_errors++; | 1865 | np->stats.rx_errors++; |
1847 | goto next_pkt; | 1866 | goto next_pkt; |
1848 | } | 1867 | } |
1849 | if (Flags & NV_RX2_ERROR4) { | 1868 | if (flags & NV_RX2_ERROR4) { |
1850 | len = nv_getlen(dev, np->rx_skbuff[i]->data, len); | 1869 | len = nv_getlen(dev, np->rx_skbuff[i]->data, len); |
1851 | if (len < 0) { | 1870 | if (len < 0) { |
1852 | np->stats.rx_errors++; | 1871 | np->stats.rx_errors++; |
@@ -1854,17 +1873,17 @@ static void nv_rx_process(struct net_device *dev) | |||
1854 | } | 1873 | } |
1855 | } | 1874 | } |
1856 | /* framing errors are soft errors */ | 1875 | /* framing errors are soft errors */ |
1857 | if (Flags & NV_RX2_FRAMINGERR) { | 1876 | if (flags & NV_RX2_FRAMINGERR) { |
1858 | if (Flags & NV_RX2_SUBSTRACT1) { | 1877 | if (flags & NV_RX2_SUBSTRACT1) { |
1859 | len--; | 1878 | len--; |
1860 | } | 1879 | } |
1861 | } | 1880 | } |
1862 | } | 1881 | } |
1863 | if (np->txrxctl_bits & NVREG_TXRXCTL_RXCHECK) { | 1882 | if (np->txrxctl_bits & NVREG_TXRXCTL_RXCHECK) { |
1864 | Flags &= NV_RX2_CHECKSUMMASK; | 1883 | flags &= NV_RX2_CHECKSUMMASK; |
1865 | if (Flags == NV_RX2_CHECKSUMOK1 || | 1884 | if (flags == NV_RX2_CHECKSUMOK1 || |
1866 | Flags == NV_RX2_CHECKSUMOK2 || | 1885 | flags == NV_RX2_CHECKSUMOK2 || |
1867 | Flags == NV_RX2_CHECKSUMOK3) { | 1886 | flags == NV_RX2_CHECKSUMOK3) { |
1868 | dprintk(KERN_DEBUG "%s: hw checksum hit!.\n", dev->name); | 1887 | dprintk(KERN_DEBUG "%s: hw checksum hit!.\n", dev->name); |
1869 | np->rx_skbuff[i]->ip_summed = CHECKSUM_UNNECESSARY; | 1888 | np->rx_skbuff[i]->ip_summed = CHECKSUM_UNNECESSARY; |
1870 | } else { | 1889 | } else { |
@@ -1880,17 +1899,27 @@ static void nv_rx_process(struct net_device *dev) | |||
1880 | skb->protocol = eth_type_trans(skb, dev); | 1899 | skb->protocol = eth_type_trans(skb, dev); |
1881 | dprintk(KERN_DEBUG "%s: nv_rx_process: packet %d with %d bytes, proto %d accepted.\n", | 1900 | dprintk(KERN_DEBUG "%s: nv_rx_process: packet %d with %d bytes, proto %d accepted.\n", |
1882 | dev->name, np->cur_rx, len, skb->protocol); | 1901 | dev->name, np->cur_rx, len, skb->protocol); |
1883 | if (np->vlangrp && (vlanflags & NV_RX3_VLAN_TAG_PRESENT)) { | 1902 | #ifdef CONFIG_FORCEDETH_NAPI |
1884 | vlan_hwaccel_rx(skb, np->vlangrp, vlanflags & NV_RX3_VLAN_TAG_MASK); | 1903 | if (np->vlangrp && (vlanflags & NV_RX3_VLAN_TAG_PRESENT)) |
1885 | } else { | 1904 | vlan_hwaccel_receive_skb(skb, np->vlangrp, |
1905 | vlanflags & NV_RX3_VLAN_TAG_MASK); | ||
1906 | else | ||
1907 | netif_receive_skb(skb); | ||
1908 | #else | ||
1909 | if (np->vlangrp && (vlanflags & NV_RX3_VLAN_TAG_PRESENT)) | ||
1910 | vlan_hwaccel_rx(skb, np->vlangrp, | ||
1911 | vlanflags & NV_RX3_VLAN_TAG_MASK); | ||
1912 | else | ||
1886 | netif_rx(skb); | 1913 | netif_rx(skb); |
1887 | } | 1914 | #endif |
1888 | dev->last_rx = jiffies; | 1915 | dev->last_rx = jiffies; |
1889 | np->stats.rx_packets++; | 1916 | np->stats.rx_packets++; |
1890 | np->stats.rx_bytes += len; | 1917 | np->stats.rx_bytes += len; |
1891 | next_pkt: | 1918 | next_pkt: |
1892 | np->cur_rx++; | 1919 | np->cur_rx++; |
1893 | } | 1920 | } |
1921 | |||
1922 | return count; | ||
1894 | } | 1923 | } |
1895 | 1924 | ||
1896 | static void set_bufsize(struct net_device *dev) | 1925 | static void set_bufsize(struct net_device *dev) |
@@ -1990,7 +2019,7 @@ static int nv_set_mac_address(struct net_device *dev, void *addr) | |||
1990 | struct fe_priv *np = netdev_priv(dev); | 2019 | struct fe_priv *np = netdev_priv(dev); |
1991 | struct sockaddr *macaddr = (struct sockaddr*)addr; | 2020 | struct sockaddr *macaddr = (struct sockaddr*)addr; |
1992 | 2021 | ||
1993 | if(!is_valid_ether_addr(macaddr->sa_data)) | 2022 | if (!is_valid_ether_addr(macaddr->sa_data)) |
1994 | return -EADDRNOTAVAIL; | 2023 | return -EADDRNOTAVAIL; |
1995 | 2024 | ||
1996 | /* synchronized against open : rtnl_lock() held by caller */ | 2025 | /* synchronized against open : rtnl_lock() held by caller */ |
@@ -2283,20 +2312,20 @@ set_speed: | |||
2283 | lpa_pause = lpa & (LPA_PAUSE_CAP| LPA_PAUSE_ASYM); | 2312 | lpa_pause = lpa & (LPA_PAUSE_CAP| LPA_PAUSE_ASYM); |
2284 | 2313 | ||
2285 | switch (adv_pause) { | 2314 | switch (adv_pause) { |
2286 | case (ADVERTISE_PAUSE_CAP): | 2315 | case ADVERTISE_PAUSE_CAP: |
2287 | if (lpa_pause & LPA_PAUSE_CAP) { | 2316 | if (lpa_pause & LPA_PAUSE_CAP) { |
2288 | pause_flags |= NV_PAUSEFRAME_RX_ENABLE; | 2317 | pause_flags |= NV_PAUSEFRAME_RX_ENABLE; |
2289 | if (np->pause_flags & NV_PAUSEFRAME_TX_REQ) | 2318 | if (np->pause_flags & NV_PAUSEFRAME_TX_REQ) |
2290 | pause_flags |= NV_PAUSEFRAME_TX_ENABLE; | 2319 | pause_flags |= NV_PAUSEFRAME_TX_ENABLE; |
2291 | } | 2320 | } |
2292 | break; | 2321 | break; |
2293 | case (ADVERTISE_PAUSE_ASYM): | 2322 | case ADVERTISE_PAUSE_ASYM: |
2294 | if (lpa_pause == (LPA_PAUSE_CAP| LPA_PAUSE_ASYM)) | 2323 | if (lpa_pause == (LPA_PAUSE_CAP| LPA_PAUSE_ASYM)) |
2295 | { | 2324 | { |
2296 | pause_flags |= NV_PAUSEFRAME_TX_ENABLE; | 2325 | pause_flags |= NV_PAUSEFRAME_TX_ENABLE; |
2297 | } | 2326 | } |
2298 | break; | 2327 | break; |
2299 | case (ADVERTISE_PAUSE_CAP| ADVERTISE_PAUSE_ASYM): | 2328 | case ADVERTISE_PAUSE_CAP| ADVERTISE_PAUSE_ASYM: |
2300 | if (lpa_pause & LPA_PAUSE_CAP) | 2329 | if (lpa_pause & LPA_PAUSE_CAP) |
2301 | { | 2330 | { |
2302 | pause_flags |= NV_PAUSEFRAME_RX_ENABLE; | 2331 | pause_flags |= NV_PAUSEFRAME_RX_ENABLE; |
@@ -2376,14 +2405,6 @@ static irqreturn_t nv_nic_irq(int foo, void *data, struct pt_regs *regs) | |||
2376 | nv_tx_done(dev); | 2405 | nv_tx_done(dev); |
2377 | spin_unlock(&np->lock); | 2406 | spin_unlock(&np->lock); |
2378 | 2407 | ||
2379 | nv_rx_process(dev); | ||
2380 | if (nv_alloc_rx(dev)) { | ||
2381 | spin_lock(&np->lock); | ||
2382 | if (!np->in_shutdown) | ||
2383 | mod_timer(&np->oom_kick, jiffies + OOM_REFILL); | ||
2384 | spin_unlock(&np->lock); | ||
2385 | } | ||
2386 | |||
2387 | if (events & NVREG_IRQ_LINK) { | 2408 | if (events & NVREG_IRQ_LINK) { |
2388 | spin_lock(&np->lock); | 2409 | spin_lock(&np->lock); |
2389 | nv_link_irq(dev); | 2410 | nv_link_irq(dev); |
@@ -2403,6 +2424,29 @@ static irqreturn_t nv_nic_irq(int foo, void *data, struct pt_regs *regs) | |||
2403 | printk(KERN_DEBUG "%s: received irq with unknown events 0x%x. Please report\n", | 2424 | printk(KERN_DEBUG "%s: received irq with unknown events 0x%x. Please report\n", |
2404 | dev->name, events); | 2425 | dev->name, events); |
2405 | } | 2426 | } |
2427 | #ifdef CONFIG_FORCEDETH_NAPI | ||
2428 | if (events & NVREG_IRQ_RX_ALL) { | ||
2429 | netif_rx_schedule(dev); | ||
2430 | |||
2431 | /* Disable furthur receive irq's */ | ||
2432 | spin_lock(&np->lock); | ||
2433 | np->irqmask &= ~NVREG_IRQ_RX_ALL; | ||
2434 | |||
2435 | if (np->msi_flags & NV_MSI_X_ENABLED) | ||
2436 | writel(NVREG_IRQ_RX_ALL, base + NvRegIrqMask); | ||
2437 | else | ||
2438 | writel(np->irqmask, base + NvRegIrqMask); | ||
2439 | spin_unlock(&np->lock); | ||
2440 | } | ||
2441 | #else | ||
2442 | nv_rx_process(dev, dev->weight); | ||
2443 | if (nv_alloc_rx(dev)) { | ||
2444 | spin_lock(&np->lock); | ||
2445 | if (!np->in_shutdown) | ||
2446 | mod_timer(&np->oom_kick, jiffies + OOM_REFILL); | ||
2447 | spin_unlock(&np->lock); | ||
2448 | } | ||
2449 | #endif | ||
2406 | if (i > max_interrupt_work) { | 2450 | if (i > max_interrupt_work) { |
2407 | spin_lock(&np->lock); | 2451 | spin_lock(&np->lock); |
2408 | /* disable interrupts on the nic */ | 2452 | /* disable interrupts on the nic */ |
@@ -2474,6 +2518,63 @@ static irqreturn_t nv_nic_irq_tx(int foo, void *data, struct pt_regs *regs) | |||
2474 | return IRQ_RETVAL(i); | 2518 | return IRQ_RETVAL(i); |
2475 | } | 2519 | } |
2476 | 2520 | ||
2521 | #ifdef CONFIG_FORCEDETH_NAPI | ||
2522 | static int nv_napi_poll(struct net_device *dev, int *budget) | ||
2523 | { | ||
2524 | int pkts, limit = min(*budget, dev->quota); | ||
2525 | struct fe_priv *np = netdev_priv(dev); | ||
2526 | u8 __iomem *base = get_hwbase(dev); | ||
2527 | |||
2528 | pkts = nv_rx_process(dev, limit); | ||
2529 | |||
2530 | if (nv_alloc_rx(dev)) { | ||
2531 | spin_lock_irq(&np->lock); | ||
2532 | if (!np->in_shutdown) | ||
2533 | mod_timer(&np->oom_kick, jiffies + OOM_REFILL); | ||
2534 | spin_unlock_irq(&np->lock); | ||
2535 | } | ||
2536 | |||
2537 | if (pkts < limit) { | ||
2538 | /* all done, no more packets present */ | ||
2539 | netif_rx_complete(dev); | ||
2540 | |||
2541 | /* re-enable receive interrupts */ | ||
2542 | spin_lock_irq(&np->lock); | ||
2543 | np->irqmask |= NVREG_IRQ_RX_ALL; | ||
2544 | if (np->msi_flags & NV_MSI_X_ENABLED) | ||
2545 | writel(NVREG_IRQ_RX_ALL, base + NvRegIrqMask); | ||
2546 | else | ||
2547 | writel(np->irqmask, base + NvRegIrqMask); | ||
2548 | spin_unlock_irq(&np->lock); | ||
2549 | return 0; | ||
2550 | } else { | ||
2551 | /* used up our quantum, so reschedule */ | ||
2552 | dev->quota -= pkts; | ||
2553 | *budget -= pkts; | ||
2554 | return 1; | ||
2555 | } | ||
2556 | } | ||
2557 | #endif | ||
2558 | |||
2559 | #ifdef CONFIG_FORCEDETH_NAPI | ||
2560 | static irqreturn_t nv_nic_irq_rx(int foo, void *data, struct pt_regs *regs) | ||
2561 | { | ||
2562 | struct net_device *dev = (struct net_device *) data; | ||
2563 | u8 __iomem *base = get_hwbase(dev); | ||
2564 | u32 events; | ||
2565 | |||
2566 | events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_RX_ALL; | ||
2567 | writel(NVREG_IRQ_RX_ALL, base + NvRegMSIXIrqStatus); | ||
2568 | |||
2569 | if (events) { | ||
2570 | netif_rx_schedule(dev); | ||
2571 | /* disable receive interrupts on the nic */ | ||
2572 | writel(NVREG_IRQ_RX_ALL, base + NvRegIrqMask); | ||
2573 | pci_push(base); | ||
2574 | } | ||
2575 | return IRQ_HANDLED; | ||
2576 | } | ||
2577 | #else | ||
2477 | static irqreturn_t nv_nic_irq_rx(int foo, void *data, struct pt_regs *regs) | 2578 | static irqreturn_t nv_nic_irq_rx(int foo, void *data, struct pt_regs *regs) |
2478 | { | 2579 | { |
2479 | struct net_device *dev = (struct net_device *) data; | 2580 | struct net_device *dev = (struct net_device *) data; |
@@ -2492,7 +2593,7 @@ static irqreturn_t nv_nic_irq_rx(int foo, void *data, struct pt_regs *regs) | |||
2492 | if (!(events & np->irqmask)) | 2593 | if (!(events & np->irqmask)) |
2493 | break; | 2594 | break; |
2494 | 2595 | ||
2495 | nv_rx_process(dev); | 2596 | nv_rx_process(dev, dev->weight); |
2496 | if (nv_alloc_rx(dev)) { | 2597 | if (nv_alloc_rx(dev)) { |
2497 | spin_lock_irq(&np->lock); | 2598 | spin_lock_irq(&np->lock); |
2498 | if (!np->in_shutdown) | 2599 | if (!np->in_shutdown) |
@@ -2514,12 +2615,12 @@ static irqreturn_t nv_nic_irq_rx(int foo, void *data, struct pt_regs *regs) | |||
2514 | spin_unlock_irq(&np->lock); | 2615 | spin_unlock_irq(&np->lock); |
2515 | break; | 2616 | break; |
2516 | } | 2617 | } |
2517 | |||
2518 | } | 2618 | } |
2519 | dprintk(KERN_DEBUG "%s: nv_nic_irq_rx completed\n", dev->name); | 2619 | dprintk(KERN_DEBUG "%s: nv_nic_irq_rx completed\n", dev->name); |
2520 | 2620 | ||
2521 | return IRQ_RETVAL(i); | 2621 | return IRQ_RETVAL(i); |
2522 | } | 2622 | } |
2623 | #endif | ||
2523 | 2624 | ||
2524 | static irqreturn_t nv_nic_irq_other(int foo, void *data, struct pt_regs *regs) | 2625 | static irqreturn_t nv_nic_irq_other(int foo, void *data, struct pt_regs *regs) |
2525 | { | 2626 | { |
@@ -3245,7 +3346,7 @@ static int nv_set_ringparam(struct net_device *dev, struct ethtool_ringparam* ri | |||
3245 | if (!rxtx_ring || !rx_skbuff || !rx_dma || !tx_skbuff || !tx_dma || !tx_dma_len) { | 3346 | if (!rxtx_ring || !rx_skbuff || !rx_dma || !tx_skbuff || !tx_dma || !tx_dma_len) { |
3246 | /* fall back to old rings */ | 3347 | /* fall back to old rings */ |
3247 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 3348 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
3248 | if(rxtx_ring) | 3349 | if (rxtx_ring) |
3249 | pci_free_consistent(np->pci_dev, sizeof(struct ring_desc) * (ring->rx_pending + ring->tx_pending), | 3350 | pci_free_consistent(np->pci_dev, sizeof(struct ring_desc) * (ring->rx_pending + ring->tx_pending), |
3250 | rxtx_ring, ring_addr); | 3351 | rxtx_ring, ring_addr); |
3251 | } else { | 3352 | } else { |
@@ -3481,7 +3582,7 @@ static int nv_get_stats_count(struct net_device *dev) | |||
3481 | struct fe_priv *np = netdev_priv(dev); | 3582 | struct fe_priv *np = netdev_priv(dev); |
3482 | 3583 | ||
3483 | if (np->driver_data & DEV_HAS_STATISTICS) | 3584 | if (np->driver_data & DEV_HAS_STATISTICS) |
3484 | return (sizeof(struct nv_ethtool_stats)/sizeof(u64)); | 3585 | return sizeof(struct nv_ethtool_stats)/sizeof(u64); |
3485 | else | 3586 | else |
3486 | return 0; | 3587 | return 0; |
3487 | } | 3588 | } |
@@ -3619,7 +3720,7 @@ static int nv_loopback_test(struct net_device *dev) | |||
3619 | struct sk_buff *tx_skb, *rx_skb; | 3720 | struct sk_buff *tx_skb, *rx_skb; |
3620 | dma_addr_t test_dma_addr; | 3721 | dma_addr_t test_dma_addr; |
3621 | u32 tx_flags_extra = (np->desc_ver == DESC_VER_1 ? NV_TX_LASTPACKET : NV_TX2_LASTPACKET); | 3722 | u32 tx_flags_extra = (np->desc_ver == DESC_VER_1 ? NV_TX_LASTPACKET : NV_TX2_LASTPACKET); |
3622 | u32 Flags; | 3723 | u32 flags; |
3623 | int len, i, pkt_len; | 3724 | int len, i, pkt_len; |
3624 | u8 *pkt_data; | 3725 | u8 *pkt_data; |
3625 | u32 filter_flags = 0; | 3726 | u32 filter_flags = 0; |
@@ -3663,12 +3764,12 @@ static int nv_loopback_test(struct net_device *dev) | |||
3663 | tx_skb->end-tx_skb->data, PCI_DMA_FROMDEVICE); | 3764 | tx_skb->end-tx_skb->data, PCI_DMA_FROMDEVICE); |
3664 | 3765 | ||
3665 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 3766 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
3666 | np->tx_ring.orig[0].PacketBuffer = cpu_to_le32(test_dma_addr); | 3767 | np->tx_ring.orig[0].buf = cpu_to_le32(test_dma_addr); |
3667 | np->tx_ring.orig[0].FlagLen = cpu_to_le32((pkt_len-1) | np->tx_flags | tx_flags_extra); | 3768 | np->tx_ring.orig[0].flaglen = cpu_to_le32((pkt_len-1) | np->tx_flags | tx_flags_extra); |
3668 | } else { | 3769 | } else { |
3669 | np->tx_ring.ex[0].PacketBufferHigh = cpu_to_le64(test_dma_addr) >> 32; | 3770 | np->tx_ring.ex[0].bufhigh = cpu_to_le64(test_dma_addr) >> 32; |
3670 | np->tx_ring.ex[0].PacketBufferLow = cpu_to_le64(test_dma_addr) & 0x0FFFFFFFF; | 3771 | np->tx_ring.ex[0].buflow = cpu_to_le64(test_dma_addr) & 0x0FFFFFFFF; |
3671 | np->tx_ring.ex[0].FlagLen = cpu_to_le32((pkt_len-1) | np->tx_flags | tx_flags_extra); | 3772 | np->tx_ring.ex[0].flaglen = cpu_to_le32((pkt_len-1) | np->tx_flags | tx_flags_extra); |
3672 | } | 3773 | } |
3673 | writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); | 3774 | writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); |
3674 | pci_push(get_hwbase(dev)); | 3775 | pci_push(get_hwbase(dev)); |
@@ -3677,21 +3778,21 @@ static int nv_loopback_test(struct net_device *dev) | |||
3677 | 3778 | ||
3678 | /* check for rx of the packet */ | 3779 | /* check for rx of the packet */ |
3679 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 3780 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
3680 | Flags = le32_to_cpu(np->rx_ring.orig[0].FlagLen); | 3781 | flags = le32_to_cpu(np->rx_ring.orig[0].flaglen); |
3681 | len = nv_descr_getlength(&np->rx_ring.orig[0], np->desc_ver); | 3782 | len = nv_descr_getlength(&np->rx_ring.orig[0], np->desc_ver); |
3682 | 3783 | ||
3683 | } else { | 3784 | } else { |
3684 | Flags = le32_to_cpu(np->rx_ring.ex[0].FlagLen); | 3785 | flags = le32_to_cpu(np->rx_ring.ex[0].flaglen); |
3685 | len = nv_descr_getlength_ex(&np->rx_ring.ex[0], np->desc_ver); | 3786 | len = nv_descr_getlength_ex(&np->rx_ring.ex[0], np->desc_ver); |
3686 | } | 3787 | } |
3687 | 3788 | ||
3688 | if (Flags & NV_RX_AVAIL) { | 3789 | if (flags & NV_RX_AVAIL) { |
3689 | ret = 0; | 3790 | ret = 0; |
3690 | } else if (np->desc_ver == DESC_VER_1) { | 3791 | } else if (np->desc_ver == DESC_VER_1) { |
3691 | if (Flags & NV_RX_ERROR) | 3792 | if (flags & NV_RX_ERROR) |
3692 | ret = 0; | 3793 | ret = 0; |
3693 | } else { | 3794 | } else { |
3694 | if (Flags & NV_RX2_ERROR) { | 3795 | if (flags & NV_RX2_ERROR) { |
3695 | ret = 0; | 3796 | ret = 0; |
3696 | } | 3797 | } |
3697 | } | 3798 | } |
@@ -3753,6 +3854,7 @@ static void nv_self_test(struct net_device *dev, struct ethtool_test *test, u64 | |||
3753 | if (test->flags & ETH_TEST_FL_OFFLINE) { | 3854 | if (test->flags & ETH_TEST_FL_OFFLINE) { |
3754 | if (netif_running(dev)) { | 3855 | if (netif_running(dev)) { |
3755 | netif_stop_queue(dev); | 3856 | netif_stop_queue(dev); |
3857 | netif_poll_disable(dev); | ||
3756 | netif_tx_lock_bh(dev); | 3858 | netif_tx_lock_bh(dev); |
3757 | spin_lock_irq(&np->lock); | 3859 | spin_lock_irq(&np->lock); |
3758 | nv_disable_hw_interrupts(dev, np->irqmask); | 3860 | nv_disable_hw_interrupts(dev, np->irqmask); |
@@ -3811,6 +3913,7 @@ static void nv_self_test(struct net_device *dev, struct ethtool_test *test, u64 | |||
3811 | nv_start_rx(dev); | 3913 | nv_start_rx(dev); |
3812 | nv_start_tx(dev); | 3914 | nv_start_tx(dev); |
3813 | netif_start_queue(dev); | 3915 | netif_start_queue(dev); |
3916 | netif_poll_enable(dev); | ||
3814 | nv_enable_hw_interrupts(dev, np->irqmask); | 3917 | nv_enable_hw_interrupts(dev, np->irqmask); |
3815 | } | 3918 | } |
3816 | } | 3919 | } |
@@ -3895,10 +3998,9 @@ static int nv_open(struct net_device *dev) | |||
3895 | 3998 | ||
3896 | dprintk(KERN_DEBUG "nv_open: begin\n"); | 3999 | dprintk(KERN_DEBUG "nv_open: begin\n"); |
3897 | 4000 | ||
3898 | /* 1) erase previous misconfiguration */ | 4001 | /* erase previous misconfiguration */ |
3899 | if (np->driver_data & DEV_HAS_POWER_CNTRL) | 4002 | if (np->driver_data & DEV_HAS_POWER_CNTRL) |
3900 | nv_mac_reset(dev); | 4003 | nv_mac_reset(dev); |
3901 | /* 4.1-1: stop adapter: ignored, 4.3 seems to be overkill */ | ||
3902 | writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); | 4004 | writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); |
3903 | writel(0, base + NvRegMulticastAddrB); | 4005 | writel(0, base + NvRegMulticastAddrB); |
3904 | writel(0, base + NvRegMulticastMaskA); | 4006 | writel(0, base + NvRegMulticastMaskA); |
@@ -3913,26 +4015,22 @@ static int nv_open(struct net_device *dev) | |||
3913 | if (np->pause_flags & NV_PAUSEFRAME_TX_CAPABLE) | 4015 | if (np->pause_flags & NV_PAUSEFRAME_TX_CAPABLE) |
3914 | writel(NVREG_TX_PAUSEFRAME_DISABLE, base + NvRegTxPauseFrame); | 4016 | writel(NVREG_TX_PAUSEFRAME_DISABLE, base + NvRegTxPauseFrame); |
3915 | 4017 | ||
3916 | /* 2) initialize descriptor rings */ | 4018 | /* initialize descriptor rings */ |
3917 | set_bufsize(dev); | 4019 | set_bufsize(dev); |
3918 | oom = nv_init_ring(dev); | 4020 | oom = nv_init_ring(dev); |
3919 | 4021 | ||
3920 | writel(0, base + NvRegLinkSpeed); | 4022 | writel(0, base + NvRegLinkSpeed); |
3921 | writel(0, base + NvRegUnknownTransmitterReg); | 4023 | writel(readl(base + NvRegTransmitPoll) & NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll); |
3922 | nv_txrx_reset(dev); | 4024 | nv_txrx_reset(dev); |
3923 | writel(0, base + NvRegUnknownSetupReg6); | 4025 | writel(0, base + NvRegUnknownSetupReg6); |
3924 | 4026 | ||
3925 | np->in_shutdown = 0; | 4027 | np->in_shutdown = 0; |
3926 | 4028 | ||
3927 | /* 3) set mac address */ | 4029 | /* give hw rings */ |
3928 | nv_copy_mac_to_hw(dev); | ||
3929 | |||
3930 | /* 4) give hw rings */ | ||
3931 | setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING); | 4030 | setup_hw_rings(dev, NV_SETUP_RX_RING | NV_SETUP_TX_RING); |
3932 | writel( ((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT), | 4031 | writel( ((np->rx_ring_size-1) << NVREG_RINGSZ_RXSHIFT) + ((np->tx_ring_size-1) << NVREG_RINGSZ_TXSHIFT), |
3933 | base + NvRegRingSizes); | 4032 | base + NvRegRingSizes); |
3934 | 4033 | ||
3935 | /* 5) continue setup */ | ||
3936 | writel(np->linkspeed, base + NvRegLinkSpeed); | 4034 | writel(np->linkspeed, base + NvRegLinkSpeed); |
3937 | if (np->desc_ver == DESC_VER_1) | 4035 | if (np->desc_ver == DESC_VER_1) |
3938 | writel(NVREG_TX_WM_DESC1_DEFAULT, base + NvRegTxWatermark); | 4036 | writel(NVREG_TX_WM_DESC1_DEFAULT, base + NvRegTxWatermark); |
@@ -3950,7 +4048,6 @@ static int nv_open(struct net_device *dev) | |||
3950 | writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); | 4048 | writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); |
3951 | writel(NVREG_MIISTAT_MASK2, base + NvRegMIIStatus); | 4049 | writel(NVREG_MIISTAT_MASK2, base + NvRegMIIStatus); |
3952 | 4050 | ||
3953 | /* 6) continue setup */ | ||
3954 | writel(NVREG_MISC1_FORCE | NVREG_MISC1_HD, base + NvRegMisc1); | 4051 | writel(NVREG_MISC1_FORCE | NVREG_MISC1_HD, base + NvRegMisc1); |
3955 | writel(readl(base + NvRegTransmitterStatus), base + NvRegTransmitterStatus); | 4052 | writel(readl(base + NvRegTransmitterStatus), base + NvRegTransmitterStatus); |
3956 | writel(NVREG_PFF_ALWAYS, base + NvRegPacketFilterFlags); | 4053 | writel(NVREG_PFF_ALWAYS, base + NvRegPacketFilterFlags); |
@@ -4020,6 +4117,8 @@ static int nv_open(struct net_device *dev) | |||
4020 | nv_start_rx(dev); | 4117 | nv_start_rx(dev); |
4021 | nv_start_tx(dev); | 4118 | nv_start_tx(dev); |
4022 | netif_start_queue(dev); | 4119 | netif_start_queue(dev); |
4120 | netif_poll_enable(dev); | ||
4121 | |||
4023 | if (ret) { | 4122 | if (ret) { |
4024 | netif_carrier_on(dev); | 4123 | netif_carrier_on(dev); |
4025 | } else { | 4124 | } else { |
@@ -4049,6 +4148,7 @@ static int nv_close(struct net_device *dev) | |||
4049 | spin_lock_irq(&np->lock); | 4148 | spin_lock_irq(&np->lock); |
4050 | np->in_shutdown = 1; | 4149 | np->in_shutdown = 1; |
4051 | spin_unlock_irq(&np->lock); | 4150 | spin_unlock_irq(&np->lock); |
4151 | netif_poll_disable(dev); | ||
4052 | synchronize_irq(dev->irq); | 4152 | synchronize_irq(dev->irq); |
4053 | 4153 | ||
4054 | del_timer_sync(&np->oom_kick); | 4154 | del_timer_sync(&np->oom_kick); |
@@ -4076,12 +4176,6 @@ static int nv_close(struct net_device *dev) | |||
4076 | if (np->wolenabled) | 4176 | if (np->wolenabled) |
4077 | nv_start_rx(dev); | 4177 | nv_start_rx(dev); |
4078 | 4178 | ||
4079 | /* special op: write back the misordered MAC address - otherwise | ||
4080 | * the next nv_probe would see a wrong address. | ||
4081 | */ | ||
4082 | writel(np->orig_mac[0], base + NvRegMacAddrA); | ||
4083 | writel(np->orig_mac[1], base + NvRegMacAddrB); | ||
4084 | |||
4085 | /* FIXME: power down nic */ | 4179 | /* FIXME: power down nic */ |
4086 | 4180 | ||
4087 | return 0; | 4181 | return 0; |
@@ -4094,7 +4188,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
4094 | unsigned long addr; | 4188 | unsigned long addr; |
4095 | u8 __iomem *base; | 4189 | u8 __iomem *base; |
4096 | int err, i; | 4190 | int err, i; |
4097 | u32 powerstate; | 4191 | u32 powerstate, txreg; |
4098 | 4192 | ||
4099 | dev = alloc_etherdev(sizeof(struct fe_priv)); | 4193 | dev = alloc_etherdev(sizeof(struct fe_priv)); |
4100 | err = -ENOMEM; | 4194 | err = -ENOMEM; |
@@ -4270,6 +4364,10 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
4270 | #ifdef CONFIG_NET_POLL_CONTROLLER | 4364 | #ifdef CONFIG_NET_POLL_CONTROLLER |
4271 | dev->poll_controller = nv_poll_controller; | 4365 | dev->poll_controller = nv_poll_controller; |
4272 | #endif | 4366 | #endif |
4367 | dev->weight = 64; | ||
4368 | #ifdef CONFIG_FORCEDETH_NAPI | ||
4369 | dev->poll = nv_napi_poll; | ||
4370 | #endif | ||
4273 | SET_ETHTOOL_OPS(dev, &ops); | 4371 | SET_ETHTOOL_OPS(dev, &ops); |
4274 | dev->tx_timeout = nv_tx_timeout; | 4372 | dev->tx_timeout = nv_tx_timeout; |
4275 | dev->watchdog_timeo = NV_WATCHDOG_TIMEO; | 4373 | dev->watchdog_timeo = NV_WATCHDOG_TIMEO; |
@@ -4281,12 +4379,30 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
4281 | np->orig_mac[0] = readl(base + NvRegMacAddrA); | 4379 | np->orig_mac[0] = readl(base + NvRegMacAddrA); |
4282 | np->orig_mac[1] = readl(base + NvRegMacAddrB); | 4380 | np->orig_mac[1] = readl(base + NvRegMacAddrB); |
4283 | 4381 | ||
4284 | dev->dev_addr[0] = (np->orig_mac[1] >> 8) & 0xff; | 4382 | /* check the workaround bit for correct mac address order */ |
4285 | dev->dev_addr[1] = (np->orig_mac[1] >> 0) & 0xff; | 4383 | txreg = readl(base + NvRegTransmitPoll); |
4286 | dev->dev_addr[2] = (np->orig_mac[0] >> 24) & 0xff; | 4384 | if (txreg & NVREG_TRANSMITPOLL_MAC_ADDR_REV) { |
4287 | dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff; | 4385 | /* mac address is already in correct order */ |
4288 | dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff; | 4386 | dev->dev_addr[0] = (np->orig_mac[0] >> 0) & 0xff; |
4289 | dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff; | 4387 | dev->dev_addr[1] = (np->orig_mac[0] >> 8) & 0xff; |
4388 | dev->dev_addr[2] = (np->orig_mac[0] >> 16) & 0xff; | ||
4389 | dev->dev_addr[3] = (np->orig_mac[0] >> 24) & 0xff; | ||
4390 | dev->dev_addr[4] = (np->orig_mac[1] >> 0) & 0xff; | ||
4391 | dev->dev_addr[5] = (np->orig_mac[1] >> 8) & 0xff; | ||
4392 | } else { | ||
4393 | /* need to reverse mac address to correct order */ | ||
4394 | dev->dev_addr[0] = (np->orig_mac[1] >> 8) & 0xff; | ||
4395 | dev->dev_addr[1] = (np->orig_mac[1] >> 0) & 0xff; | ||
4396 | dev->dev_addr[2] = (np->orig_mac[0] >> 24) & 0xff; | ||
4397 | dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff; | ||
4398 | dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff; | ||
4399 | dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff; | ||
4400 | /* set permanent address to be correct aswell */ | ||
4401 | np->orig_mac[0] = (dev->dev_addr[0] << 0) + (dev->dev_addr[1] << 8) + | ||
4402 | (dev->dev_addr[2] << 16) + (dev->dev_addr[3] << 24); | ||
4403 | np->orig_mac[1] = (dev->dev_addr[4] << 0) + (dev->dev_addr[5] << 8); | ||
4404 | writel(txreg|NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll); | ||
4405 | } | ||
4290 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | 4406 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); |
4291 | 4407 | ||
4292 | if (!is_valid_ether_addr(dev->perm_addr)) { | 4408 | if (!is_valid_ether_addr(dev->perm_addr)) { |
@@ -4309,6 +4425,9 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
4309 | dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], | 4425 | dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], |
4310 | dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); | 4426 | dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); |
4311 | 4427 | ||
4428 | /* set mac address */ | ||
4429 | nv_copy_mac_to_hw(dev); | ||
4430 | |||
4312 | /* disable WOL */ | 4431 | /* disable WOL */ |
4313 | writel(0, base + NvRegWakeUpFlags); | 4432 | writel(0, base + NvRegWakeUpFlags); |
4314 | np->wolenabled = 0; | 4433 | np->wolenabled = 0; |
@@ -4421,9 +4540,17 @@ out: | |||
4421 | static void __devexit nv_remove(struct pci_dev *pci_dev) | 4540 | static void __devexit nv_remove(struct pci_dev *pci_dev) |
4422 | { | 4541 | { |
4423 | struct net_device *dev = pci_get_drvdata(pci_dev); | 4542 | struct net_device *dev = pci_get_drvdata(pci_dev); |
4543 | struct fe_priv *np = netdev_priv(dev); | ||
4544 | u8 __iomem *base = get_hwbase(dev); | ||
4424 | 4545 | ||
4425 | unregister_netdev(dev); | 4546 | unregister_netdev(dev); |
4426 | 4547 | ||
4548 | /* special op: write back the misordered MAC address - otherwise | ||
4549 | * the next nv_probe would see a wrong address. | ||
4550 | */ | ||
4551 | writel(np->orig_mac[0], base + NvRegMacAddrA); | ||
4552 | writel(np->orig_mac[1], base + NvRegMacAddrB); | ||
4553 | |||
4427 | /* free all structures */ | 4554 | /* free all structures */ |
4428 | free_rings(dev); | 4555 | free_rings(dev); |
4429 | iounmap(get_hwbase(dev)); | 4556 | iounmap(get_hwbase(dev)); |
@@ -4540,7 +4667,7 @@ static struct pci_driver driver = { | |||
4540 | static int __init init_nic(void) | 4667 | static int __init init_nic(void) |
4541 | { | 4668 | { |
4542 | printk(KERN_INFO "forcedeth.c: Reverse Engineered nForce ethernet driver. Version %s.\n", FORCEDETH_VERSION); | 4669 | printk(KERN_INFO "forcedeth.c: Reverse Engineered nForce ethernet driver. Version %s.\n", FORCEDETH_VERSION); |
4543 | return pci_module_init(&driver); | 4670 | return pci_register_driver(&driver); |
4544 | } | 4671 | } |
4545 | 4672 | ||
4546 | static void __exit exit_nic(void) | 4673 | static void __exit exit_nic(void) |
diff --git a/drivers/net/fs_enet/Makefile b/drivers/net/fs_enet/Makefile index d6dd3f2fb43e..02d4dc18ba69 100644 --- a/drivers/net/fs_enet/Makefile +++ b/drivers/net/fs_enet/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | obj-$(CONFIG_FS_ENET) += fs_enet.o | 5 | obj-$(CONFIG_FS_ENET) += fs_enet.o |
6 | 6 | ||
7 | obj-$(CONFIG_8xx) += mac-fec.o mac-scc.o | 7 | obj-$(CONFIG_8xx) += mac-fec.o mac-scc.o mii-fec.o |
8 | obj-$(CONFIG_8260) += mac-fcc.o | 8 | obj-$(CONFIG_CPM2) += mac-fcc.o mii-bitbang.o |
9 | 9 | ||
10 | fs_enet-objs := fs_enet-main.o fs_enet-mii.o mii-bitbang.o mii-fixed.o | 10 | fs_enet-objs := fs_enet-main.o |
diff --git a/drivers/net/fs_enet/fec.h b/drivers/net/fs_enet/fec.h new file mode 100644 index 000000000000..e980527e2b99 --- /dev/null +++ b/drivers/net/fs_enet/fec.h | |||
@@ -0,0 +1,42 @@ | |||
1 | #ifndef FS_ENET_FEC_H | ||
2 | #define FS_ENET_FEC_H | ||
3 | |||
4 | /* CRC polynomium used by the FEC for the multicast group filtering */ | ||
5 | #define FEC_CRC_POLY 0x04C11DB7 | ||
6 | |||
7 | #define FEC_MAX_MULTICAST_ADDRS 64 | ||
8 | |||
9 | /* Interrupt events/masks. | ||
10 | */ | ||
11 | #define FEC_ENET_HBERR 0x80000000U /* Heartbeat error */ | ||
12 | #define FEC_ENET_BABR 0x40000000U /* Babbling receiver */ | ||
13 | #define FEC_ENET_BABT 0x20000000U /* Babbling transmitter */ | ||
14 | #define FEC_ENET_GRA 0x10000000U /* Graceful stop complete */ | ||
15 | #define FEC_ENET_TXF 0x08000000U /* Full frame transmitted */ | ||
16 | #define FEC_ENET_TXB 0x04000000U /* A buffer was transmitted */ | ||
17 | #define FEC_ENET_RXF 0x02000000U /* Full frame received */ | ||
18 | #define FEC_ENET_RXB 0x01000000U /* A buffer was received */ | ||
19 | #define FEC_ENET_MII 0x00800000U /* MII interrupt */ | ||
20 | #define FEC_ENET_EBERR 0x00400000U /* SDMA bus error */ | ||
21 | |||
22 | #define FEC_ECNTRL_PINMUX 0x00000004 | ||
23 | #define FEC_ECNTRL_ETHER_EN 0x00000002 | ||
24 | #define FEC_ECNTRL_RESET 0x00000001 | ||
25 | |||
26 | #define FEC_RCNTRL_BC_REJ 0x00000010 | ||
27 | #define FEC_RCNTRL_PROM 0x00000008 | ||
28 | #define FEC_RCNTRL_MII_MODE 0x00000004 | ||
29 | #define FEC_RCNTRL_DRT 0x00000002 | ||
30 | #define FEC_RCNTRL_LOOP 0x00000001 | ||
31 | |||
32 | #define FEC_TCNTRL_FDEN 0x00000004 | ||
33 | #define FEC_TCNTRL_HBC 0x00000002 | ||
34 | #define FEC_TCNTRL_GTS 0x00000001 | ||
35 | |||
36 | |||
37 | |||
38 | /* | ||
39 | * Delay to wait for FEC reset command to complete (in us) | ||
40 | */ | ||
41 | #define FEC_RESET_DELAY 50 | ||
42 | #endif | ||
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index f6abff5846b3..df62506a1787 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/bitops.h> | 37 | #include <linux/bitops.h> |
38 | #include <linux/fs.h> | 38 | #include <linux/fs.h> |
39 | #include <linux/platform_device.h> | 39 | #include <linux/platform_device.h> |
40 | #include <linux/phy.h> | ||
40 | 41 | ||
41 | #include <linux/vmalloc.h> | 42 | #include <linux/vmalloc.h> |
42 | #include <asm/pgtable.h> | 43 | #include <asm/pgtable.h> |
@@ -682,35 +683,6 @@ static void fs_free_irq(struct net_device *dev, int irq) | |||
682 | (*fep->ops->post_free_irq)(dev, irq); | 683 | (*fep->ops->post_free_irq)(dev, irq); |
683 | } | 684 | } |
684 | 685 | ||
685 | /**********************************************************************************/ | ||
686 | |||
687 | /* This interrupt occurs when the PHY detects a link change. */ | ||
688 | static irqreturn_t | ||
689 | fs_mii_link_interrupt(int irq, void *dev_id, struct pt_regs *regs) | ||
690 | { | ||
691 | struct net_device *dev = dev_id; | ||
692 | struct fs_enet_private *fep; | ||
693 | const struct fs_platform_info *fpi; | ||
694 | |||
695 | fep = netdev_priv(dev); | ||
696 | fpi = fep->fpi; | ||
697 | |||
698 | /* | ||
699 | * Acknowledge the interrupt if possible. If we have not | ||
700 | * found the PHY yet we can't process or acknowledge the | ||
701 | * interrupt now. Instead we ignore this interrupt for now, | ||
702 | * which we can do since it is edge triggered. It will be | ||
703 | * acknowledged later by fs_enet_open(). | ||
704 | */ | ||
705 | if (!fep->phy) | ||
706 | return IRQ_NONE; | ||
707 | |||
708 | fs_mii_ack_int(dev); | ||
709 | fs_mii_link_status_change_check(dev, 0); | ||
710 | |||
711 | return IRQ_HANDLED; | ||
712 | } | ||
713 | |||
714 | static void fs_timeout(struct net_device *dev) | 686 | static void fs_timeout(struct net_device *dev) |
715 | { | 687 | { |
716 | struct fs_enet_private *fep = netdev_priv(dev); | 688 | struct fs_enet_private *fep = netdev_priv(dev); |
@@ -722,10 +694,13 @@ static void fs_timeout(struct net_device *dev) | |||
722 | spin_lock_irqsave(&fep->lock, flags); | 694 | spin_lock_irqsave(&fep->lock, flags); |
723 | 695 | ||
724 | if (dev->flags & IFF_UP) { | 696 | if (dev->flags & IFF_UP) { |
697 | phy_stop(fep->phydev); | ||
725 | (*fep->ops->stop)(dev); | 698 | (*fep->ops->stop)(dev); |
726 | (*fep->ops->restart)(dev); | 699 | (*fep->ops->restart)(dev); |
700 | phy_start(fep->phydev); | ||
727 | } | 701 | } |
728 | 702 | ||
703 | phy_start(fep->phydev); | ||
729 | wake = fep->tx_free && !(CBDR_SC(fep->cur_tx) & BD_ENET_TX_READY); | 704 | wake = fep->tx_free && !(CBDR_SC(fep->cur_tx) & BD_ENET_TX_READY); |
730 | spin_unlock_irqrestore(&fep->lock, flags); | 705 | spin_unlock_irqrestore(&fep->lock, flags); |
731 | 706 | ||
@@ -733,35 +708,112 @@ static void fs_timeout(struct net_device *dev) | |||
733 | netif_wake_queue(dev); | 708 | netif_wake_queue(dev); |
734 | } | 709 | } |
735 | 710 | ||
711 | /*----------------------------------------------------------------------------- | ||
712 | * generic link-change handler - should be sufficient for most cases | ||
713 | *-----------------------------------------------------------------------------*/ | ||
714 | static void generic_adjust_link(struct net_device *dev) | ||
715 | { | ||
716 | struct fs_enet_private *fep = netdev_priv(dev); | ||
717 | struct phy_device *phydev = fep->phydev; | ||
718 | int new_state = 0; | ||
719 | |||
720 | if (phydev->link) { | ||
721 | |||
722 | /* adjust to duplex mode */ | ||
723 | if (phydev->duplex != fep->oldduplex){ | ||
724 | new_state = 1; | ||
725 | fep->oldduplex = phydev->duplex; | ||
726 | } | ||
727 | |||
728 | if (phydev->speed != fep->oldspeed) { | ||
729 | new_state = 1; | ||
730 | fep->oldspeed = phydev->speed; | ||
731 | } | ||
732 | |||
733 | if (!fep->oldlink) { | ||
734 | new_state = 1; | ||
735 | fep->oldlink = 1; | ||
736 | netif_schedule(dev); | ||
737 | netif_carrier_on(dev); | ||
738 | netif_start_queue(dev); | ||
739 | } | ||
740 | |||
741 | if (new_state) | ||
742 | fep->ops->restart(dev); | ||
743 | |||
744 | } else if (fep->oldlink) { | ||
745 | new_state = 1; | ||
746 | fep->oldlink = 0; | ||
747 | fep->oldspeed = 0; | ||
748 | fep->oldduplex = -1; | ||
749 | netif_carrier_off(dev); | ||
750 | netif_stop_queue(dev); | ||
751 | } | ||
752 | |||
753 | if (new_state && netif_msg_link(fep)) | ||
754 | phy_print_status(phydev); | ||
755 | } | ||
756 | |||
757 | |||
758 | static void fs_adjust_link(struct net_device *dev) | ||
759 | { | ||
760 | struct fs_enet_private *fep = netdev_priv(dev); | ||
761 | unsigned long flags; | ||
762 | |||
763 | spin_lock_irqsave(&fep->lock, flags); | ||
764 | |||
765 | if(fep->ops->adjust_link) | ||
766 | fep->ops->adjust_link(dev); | ||
767 | else | ||
768 | generic_adjust_link(dev); | ||
769 | |||
770 | spin_unlock_irqrestore(&fep->lock, flags); | ||
771 | } | ||
772 | |||
773 | static int fs_init_phy(struct net_device *dev) | ||
774 | { | ||
775 | struct fs_enet_private *fep = netdev_priv(dev); | ||
776 | struct phy_device *phydev; | ||
777 | |||
778 | fep->oldlink = 0; | ||
779 | fep->oldspeed = 0; | ||
780 | fep->oldduplex = -1; | ||
781 | if(fep->fpi->bus_id) | ||
782 | phydev = phy_connect(dev, fep->fpi->bus_id, &fs_adjust_link, 0); | ||
783 | else { | ||
784 | printk("No phy bus ID specified in BSP code\n"); | ||
785 | return -EINVAL; | ||
786 | } | ||
787 | if (IS_ERR(phydev)) { | ||
788 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); | ||
789 | return PTR_ERR(phydev); | ||
790 | } | ||
791 | |||
792 | fep->phydev = phydev; | ||
793 | |||
794 | return 0; | ||
795 | } | ||
796 | |||
797 | |||
736 | static int fs_enet_open(struct net_device *dev) | 798 | static int fs_enet_open(struct net_device *dev) |
737 | { | 799 | { |
738 | struct fs_enet_private *fep = netdev_priv(dev); | 800 | struct fs_enet_private *fep = netdev_priv(dev); |
739 | const struct fs_platform_info *fpi = fep->fpi; | ||
740 | int r; | 801 | int r; |
802 | int err; | ||
741 | 803 | ||
742 | /* Install our interrupt handler. */ | 804 | /* Install our interrupt handler. */ |
743 | r = fs_request_irq(dev, fep->interrupt, "fs_enet-mac", fs_enet_interrupt); | 805 | r = fs_request_irq(dev, fep->interrupt, "fs_enet-mac", fs_enet_interrupt); |
744 | if (r != 0) { | 806 | if (r != 0) { |
745 | printk(KERN_ERR DRV_MODULE_NAME | 807 | printk(KERN_ERR DRV_MODULE_NAME |
746 | ": %s Could not allocate FEC IRQ!", dev->name); | 808 | ": %s Could not allocate FS_ENET IRQ!", dev->name); |
747 | return -EINVAL; | 809 | return -EINVAL; |
748 | } | 810 | } |
749 | 811 | ||
750 | /* Install our phy interrupt handler */ | 812 | err = fs_init_phy(dev); |
751 | if (fpi->phy_irq != -1) { | 813 | if(err) |
752 | 814 | return err; | |
753 | r = fs_request_irq(dev, fpi->phy_irq, "fs_enet-phy", fs_mii_link_interrupt); | ||
754 | if (r != 0) { | ||
755 | printk(KERN_ERR DRV_MODULE_NAME | ||
756 | ": %s Could not allocate PHY IRQ!", dev->name); | ||
757 | fs_free_irq(dev, fep->interrupt); | ||
758 | return -EINVAL; | ||
759 | } | ||
760 | } | ||
761 | 815 | ||
762 | fs_mii_startup(dev); | 816 | phy_start(fep->phydev); |
763 | netif_carrier_off(dev); | ||
764 | fs_mii_link_status_change_check(dev, 1); | ||
765 | 817 | ||
766 | return 0; | 818 | return 0; |
767 | } | 819 | } |
@@ -769,20 +821,19 @@ static int fs_enet_open(struct net_device *dev) | |||
769 | static int fs_enet_close(struct net_device *dev) | 821 | static int fs_enet_close(struct net_device *dev) |
770 | { | 822 | { |
771 | struct fs_enet_private *fep = netdev_priv(dev); | 823 | struct fs_enet_private *fep = netdev_priv(dev); |
772 | const struct fs_platform_info *fpi = fep->fpi; | ||
773 | unsigned long flags; | 824 | unsigned long flags; |
774 | 825 | ||
775 | netif_stop_queue(dev); | 826 | netif_stop_queue(dev); |
776 | netif_carrier_off(dev); | 827 | netif_carrier_off(dev); |
777 | fs_mii_shutdown(dev); | 828 | phy_stop(fep->phydev); |
778 | 829 | ||
779 | spin_lock_irqsave(&fep->lock, flags); | 830 | spin_lock_irqsave(&fep->lock, flags); |
780 | (*fep->ops->stop)(dev); | 831 | (*fep->ops->stop)(dev); |
781 | spin_unlock_irqrestore(&fep->lock, flags); | 832 | spin_unlock_irqrestore(&fep->lock, flags); |
782 | 833 | ||
783 | /* release any irqs */ | 834 | /* release any irqs */ |
784 | if (fpi->phy_irq != -1) | 835 | phy_disconnect(fep->phydev); |
785 | fs_free_irq(dev, fpi->phy_irq); | 836 | fep->phydev = NULL; |
786 | fs_free_irq(dev, fep->interrupt); | 837 | fs_free_irq(dev, fep->interrupt); |
787 | 838 | ||
788 | return 0; | 839 | return 0; |
@@ -830,33 +881,19 @@ static void fs_get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
830 | static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 881 | static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
831 | { | 882 | { |
832 | struct fs_enet_private *fep = netdev_priv(dev); | 883 | struct fs_enet_private *fep = netdev_priv(dev); |
833 | unsigned long flags; | 884 | return phy_ethtool_gset(fep->phydev, cmd); |
834 | int rc; | ||
835 | |||
836 | spin_lock_irqsave(&fep->lock, flags); | ||
837 | rc = mii_ethtool_gset(&fep->mii_if, cmd); | ||
838 | spin_unlock_irqrestore(&fep->lock, flags); | ||
839 | |||
840 | return rc; | ||
841 | } | 885 | } |
842 | 886 | ||
843 | static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 887 | static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
844 | { | 888 | { |
845 | struct fs_enet_private *fep = netdev_priv(dev); | 889 | struct fs_enet_private *fep = netdev_priv(dev); |
846 | unsigned long flags; | 890 | phy_ethtool_sset(fep->phydev, cmd); |
847 | int rc; | 891 | return 0; |
848 | |||
849 | spin_lock_irqsave(&fep->lock, flags); | ||
850 | rc = mii_ethtool_sset(&fep->mii_if, cmd); | ||
851 | spin_unlock_irqrestore(&fep->lock, flags); | ||
852 | |||
853 | return rc; | ||
854 | } | 892 | } |
855 | 893 | ||
856 | static int fs_nway_reset(struct net_device *dev) | 894 | static int fs_nway_reset(struct net_device *dev) |
857 | { | 895 | { |
858 | struct fs_enet_private *fep = netdev_priv(dev); | 896 | return 0; |
859 | return mii_nway_restart(&fep->mii_if); | ||
860 | } | 897 | } |
861 | 898 | ||
862 | static u32 fs_get_msglevel(struct net_device *dev) | 899 | static u32 fs_get_msglevel(struct net_device *dev) |
@@ -898,7 +935,7 @@ static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
898 | return -EINVAL; | 935 | return -EINVAL; |
899 | 936 | ||
900 | spin_lock_irqsave(&fep->lock, flags); | 937 | spin_lock_irqsave(&fep->lock, flags); |
901 | rc = generic_mii_ioctl(&fep->mii_if, mii, cmd, NULL); | 938 | rc = phy_mii_ioctl(fep->phydev, mii, cmd); |
902 | spin_unlock_irqrestore(&fep->lock, flags); | 939 | spin_unlock_irqrestore(&fep->lock, flags); |
903 | return rc; | 940 | return rc; |
904 | } | 941 | } |
@@ -1030,12 +1067,6 @@ static struct net_device *fs_init_instance(struct device *dev, | |||
1030 | } | 1067 | } |
1031 | registered = 1; | 1068 | registered = 1; |
1032 | 1069 | ||
1033 | err = fs_mii_connect(ndev); | ||
1034 | if (err != 0) { | ||
1035 | printk(KERN_ERR DRV_MODULE_NAME | ||
1036 | ": %s fs_mii_connect failed.\n", ndev->name); | ||
1037 | goto err; | ||
1038 | } | ||
1039 | 1070 | ||
1040 | return ndev; | 1071 | return ndev; |
1041 | 1072 | ||
@@ -1073,8 +1104,6 @@ static int fs_cleanup_instance(struct net_device *ndev) | |||
1073 | 1104 | ||
1074 | fpi = fep->fpi; | 1105 | fpi = fep->fpi; |
1075 | 1106 | ||
1076 | fs_mii_disconnect(ndev); | ||
1077 | |||
1078 | unregister_netdev(ndev); | 1107 | unregister_netdev(ndev); |
1079 | 1108 | ||
1080 | dma_free_coherent(fep->dev, (fpi->tx_ring + fpi->rx_ring) * sizeof(cbd_t), | 1109 | dma_free_coherent(fep->dev, (fpi->tx_ring + fpi->rx_ring) * sizeof(cbd_t), |
@@ -1196,17 +1225,39 @@ static int __init fs_init(void) | |||
1196 | r = setup_immap(); | 1225 | r = setup_immap(); |
1197 | if (r != 0) | 1226 | if (r != 0) |
1198 | return r; | 1227 | return r; |
1199 | r = driver_register(&fs_enet_fec_driver); | 1228 | |
1229 | #ifdef CONFIG_FS_ENET_HAS_FCC | ||
1230 | /* let's insert mii stuff */ | ||
1231 | r = fs_enet_mdio_bb_init(); | ||
1232 | |||
1233 | if (r != 0) { | ||
1234 | printk(KERN_ERR DRV_MODULE_NAME | ||
1235 | "BB PHY init failed.\n"); | ||
1236 | return r; | ||
1237 | } | ||
1238 | r = driver_register(&fs_enet_fcc_driver); | ||
1200 | if (r != 0) | 1239 | if (r != 0) |
1201 | goto err; | 1240 | goto err; |
1241 | #endif | ||
1202 | 1242 | ||
1203 | r = driver_register(&fs_enet_fcc_driver); | 1243 | #ifdef CONFIG_FS_ENET_HAS_FEC |
1244 | r = fs_enet_mdio_fec_init(); | ||
1245 | if (r != 0) { | ||
1246 | printk(KERN_ERR DRV_MODULE_NAME | ||
1247 | "FEC PHY init failed.\n"); | ||
1248 | return r; | ||
1249 | } | ||
1250 | |||
1251 | r = driver_register(&fs_enet_fec_driver); | ||
1204 | if (r != 0) | 1252 | if (r != 0) |
1205 | goto err; | 1253 | goto err; |
1254 | #endif | ||
1206 | 1255 | ||
1256 | #ifdef CONFIG_FS_ENET_HAS_SCC | ||
1207 | r = driver_register(&fs_enet_scc_driver); | 1257 | r = driver_register(&fs_enet_scc_driver); |
1208 | if (r != 0) | 1258 | if (r != 0) |
1209 | goto err; | 1259 | goto err; |
1260 | #endif | ||
1210 | 1261 | ||
1211 | return 0; | 1262 | return 0; |
1212 | err: | 1263 | err: |
diff --git a/drivers/net/fs_enet/fs_enet-mii.c b/drivers/net/fs_enet/fs_enet-mii.c deleted file mode 100644 index b7e6e21725cb..000000000000 --- a/drivers/net/fs_enet/fs_enet-mii.c +++ /dev/null | |||
@@ -1,505 +0,0 @@ | |||
1 | /* | ||
2 | * Combined Ethernet driver for Motorola MPC8xx and MPC82xx. | ||
3 | * | ||
4 | * Copyright (c) 2003 Intracom S.A. | ||
5 | * by Pantelis Antoniou <panto@intracom.gr> | ||
6 | * | ||
7 | * 2005 (c) MontaVista Software, Inc. | ||
8 | * Vitaly Bordug <vbordug@ru.mvista.com> | ||
9 | * | ||
10 | * Heavily based on original FEC driver by Dan Malek <dan@embeddededge.com> | ||
11 | * and modifications by Joakim Tjernlund <joakim.tjernlund@lumentis.se> | ||
12 | * | ||
13 | * This file is licensed under the terms of the GNU General Public License | ||
14 | * version 2. This program is licensed "as is" without any warranty of any | ||
15 | * kind, whether express or implied. | ||
16 | */ | ||
17 | |||
18 | |||
19 | #include <linux/module.h> | ||
20 | #include <linux/types.h> | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/sched.h> | ||
23 | #include <linux/string.h> | ||
24 | #include <linux/ptrace.h> | ||
25 | #include <linux/errno.h> | ||
26 | #include <linux/ioport.h> | ||
27 | #include <linux/slab.h> | ||
28 | #include <linux/interrupt.h> | ||
29 | #include <linux/pci.h> | ||
30 | #include <linux/init.h> | ||
31 | #include <linux/delay.h> | ||
32 | #include <linux/netdevice.h> | ||
33 | #include <linux/etherdevice.h> | ||
34 | #include <linux/skbuff.h> | ||
35 | #include <linux/spinlock.h> | ||
36 | #include <linux/mii.h> | ||
37 | #include <linux/ethtool.h> | ||
38 | #include <linux/bitops.h> | ||
39 | |||
40 | #include <asm/pgtable.h> | ||
41 | #include <asm/irq.h> | ||
42 | #include <asm/uaccess.h> | ||
43 | |||
44 | #include "fs_enet.h" | ||
45 | |||
46 | /*************************************************/ | ||
47 | |||
48 | /* | ||
49 | * Generic PHY support. | ||
50 | * Should work for all PHYs, but link change is detected by polling | ||
51 | */ | ||
52 | |||
53 | static void generic_timer_callback(unsigned long data) | ||
54 | { | ||
55 | struct net_device *dev = (struct net_device *)data; | ||
56 | struct fs_enet_private *fep = netdev_priv(dev); | ||
57 | |||
58 | fep->phy_timer_list.expires = jiffies + HZ / 2; | ||
59 | |||
60 | add_timer(&fep->phy_timer_list); | ||
61 | |||
62 | fs_mii_link_status_change_check(dev, 0); | ||
63 | } | ||
64 | |||
65 | static void generic_startup(struct net_device *dev) | ||
66 | { | ||
67 | struct fs_enet_private *fep = netdev_priv(dev); | ||
68 | |||
69 | fep->phy_timer_list.expires = jiffies + HZ / 2; /* every 500ms */ | ||
70 | fep->phy_timer_list.data = (unsigned long)dev; | ||
71 | fep->phy_timer_list.function = generic_timer_callback; | ||
72 | add_timer(&fep->phy_timer_list); | ||
73 | } | ||
74 | |||
75 | static void generic_shutdown(struct net_device *dev) | ||
76 | { | ||
77 | struct fs_enet_private *fep = netdev_priv(dev); | ||
78 | |||
79 | del_timer_sync(&fep->phy_timer_list); | ||
80 | } | ||
81 | |||
82 | /* ------------------------------------------------------------------------- */ | ||
83 | /* The Davicom DM9161 is used on the NETTA board */ | ||
84 | |||
85 | /* register definitions */ | ||
86 | |||
87 | #define MII_DM9161_ANAR 4 /* Aux. Config Register */ | ||
88 | #define MII_DM9161_ACR 16 /* Aux. Config Register */ | ||
89 | #define MII_DM9161_ACSR 17 /* Aux. Config/Status Register */ | ||
90 | #define MII_DM9161_10TCSR 18 /* 10BaseT Config/Status Reg. */ | ||
91 | #define MII_DM9161_INTR 21 /* Interrupt Register */ | ||
92 | #define MII_DM9161_RECR 22 /* Receive Error Counter Reg. */ | ||
93 | #define MII_DM9161_DISCR 23 /* Disconnect Counter Register */ | ||
94 | |||
95 | static void dm9161_startup(struct net_device *dev) | ||
96 | { | ||
97 | struct fs_enet_private *fep = netdev_priv(dev); | ||
98 | |||
99 | fs_mii_write(dev, fep->mii_if.phy_id, MII_DM9161_INTR, 0x0000); | ||
100 | /* Start autonegotiation */ | ||
101 | fs_mii_write(dev, fep->mii_if.phy_id, MII_BMCR, 0x1200); | ||
102 | |||
103 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
104 | schedule_timeout(HZ*8); | ||
105 | } | ||
106 | |||
107 | static void dm9161_ack_int(struct net_device *dev) | ||
108 | { | ||
109 | struct fs_enet_private *fep = netdev_priv(dev); | ||
110 | |||
111 | fs_mii_read(dev, fep->mii_if.phy_id, MII_DM9161_INTR); | ||
112 | } | ||
113 | |||
114 | static void dm9161_shutdown(struct net_device *dev) | ||
115 | { | ||
116 | struct fs_enet_private *fep = netdev_priv(dev); | ||
117 | |||
118 | fs_mii_write(dev, fep->mii_if.phy_id, MII_DM9161_INTR, 0x0f00); | ||
119 | } | ||
120 | |||
121 | /**********************************************************************************/ | ||
122 | |||
123 | static const struct phy_info phy_info[] = { | ||
124 | { | ||
125 | .id = 0x00181b88, | ||
126 | .name = "DM9161", | ||
127 | .startup = dm9161_startup, | ||
128 | .ack_int = dm9161_ack_int, | ||
129 | .shutdown = dm9161_shutdown, | ||
130 | }, { | ||
131 | .id = 0, | ||
132 | .name = "GENERIC", | ||
133 | .startup = generic_startup, | ||
134 | .shutdown = generic_shutdown, | ||
135 | }, | ||
136 | }; | ||
137 | |||
138 | /**********************************************************************************/ | ||
139 | |||
140 | static int phy_id_detect(struct net_device *dev) | ||
141 | { | ||
142 | struct fs_enet_private *fep = netdev_priv(dev); | ||
143 | const struct fs_platform_info *fpi = fep->fpi; | ||
144 | struct fs_enet_mii_bus *bus = fep->mii_bus; | ||
145 | int i, r, start, end, phytype, physubtype; | ||
146 | const struct phy_info *phy; | ||
147 | int phy_hwid, phy_id; | ||
148 | |||
149 | phy_hwid = -1; | ||
150 | fep->phy = NULL; | ||
151 | |||
152 | /* auto-detect? */ | ||
153 | if (fpi->phy_addr == -1) { | ||
154 | start = 1; | ||
155 | end = 32; | ||
156 | } else { /* direct */ | ||
157 | start = fpi->phy_addr; | ||
158 | end = start + 1; | ||
159 | } | ||
160 | |||
161 | for (phy_id = start; phy_id < end; phy_id++) { | ||
162 | /* skip already used phy addresses on this bus */ | ||
163 | if (bus->usage_map & (1 << phy_id)) | ||
164 | continue; | ||
165 | r = fs_mii_read(dev, phy_id, MII_PHYSID1); | ||
166 | if (r == -1 || (phytype = (r & 0xffff)) == 0xffff) | ||
167 | continue; | ||
168 | r = fs_mii_read(dev, phy_id, MII_PHYSID2); | ||
169 | if (r == -1 || (physubtype = (r & 0xffff)) == 0xffff) | ||
170 | continue; | ||
171 | phy_hwid = (phytype << 16) | physubtype; | ||
172 | if (phy_hwid != -1) | ||
173 | break; | ||
174 | } | ||
175 | |||
176 | if (phy_hwid == -1) { | ||
177 | printk(KERN_ERR DRV_MODULE_NAME | ||
178 | ": %s No PHY detected! range=0x%02x-0x%02x\n", | ||
179 | dev->name, start, end); | ||
180 | return -1; | ||
181 | } | ||
182 | |||
183 | for (i = 0, phy = phy_info; i < ARRAY_SIZE(phy_info); i++, phy++) | ||
184 | if (phy->id == (phy_hwid >> 4) || phy->id == 0) | ||
185 | break; | ||
186 | |||
187 | if (i >= ARRAY_SIZE(phy_info)) { | ||
188 | printk(KERN_ERR DRV_MODULE_NAME | ||
189 | ": %s PHY id 0x%08x is not supported!\n", | ||
190 | dev->name, phy_hwid); | ||
191 | return -1; | ||
192 | } | ||
193 | |||
194 | fep->phy = phy; | ||
195 | |||
196 | /* mark this address as used */ | ||
197 | bus->usage_map |= (1 << phy_id); | ||
198 | |||
199 | printk(KERN_INFO DRV_MODULE_NAME | ||
200 | ": %s Phy @ 0x%x, type %s (0x%08x)%s\n", | ||
201 | dev->name, phy_id, fep->phy->name, phy_hwid, | ||
202 | fpi->phy_addr == -1 ? " (auto-detected)" : ""); | ||
203 | |||
204 | return phy_id; | ||
205 | } | ||
206 | |||
207 | void fs_mii_startup(struct net_device *dev) | ||
208 | { | ||
209 | struct fs_enet_private *fep = netdev_priv(dev); | ||
210 | |||
211 | if (fep->phy->startup) | ||
212 | (*fep->phy->startup) (dev); | ||
213 | } | ||
214 | |||
215 | void fs_mii_shutdown(struct net_device *dev) | ||
216 | { | ||
217 | struct fs_enet_private *fep = netdev_priv(dev); | ||
218 | |||
219 | if (fep->phy->shutdown) | ||
220 | (*fep->phy->shutdown) (dev); | ||
221 | } | ||
222 | |||
223 | void fs_mii_ack_int(struct net_device *dev) | ||
224 | { | ||
225 | struct fs_enet_private *fep = netdev_priv(dev); | ||
226 | |||
227 | if (fep->phy->ack_int) | ||
228 | (*fep->phy->ack_int) (dev); | ||
229 | } | ||
230 | |||
231 | #define MII_LINK 0x0001 | ||
232 | #define MII_HALF 0x0002 | ||
233 | #define MII_FULL 0x0004 | ||
234 | #define MII_BASE4 0x0008 | ||
235 | #define MII_10M 0x0010 | ||
236 | #define MII_100M 0x0020 | ||
237 | #define MII_1G 0x0040 | ||
238 | #define MII_10G 0x0080 | ||
239 | |||
240 | /* return full mii info at one gulp, with a usable form */ | ||
241 | static unsigned int mii_full_status(struct mii_if_info *mii) | ||
242 | { | ||
243 | unsigned int status; | ||
244 | int bmsr, adv, lpa, neg; | ||
245 | struct fs_enet_private* fep = netdev_priv(mii->dev); | ||
246 | |||
247 | /* first, a dummy read, needed to latch some MII phys */ | ||
248 | (void)mii->mdio_read(mii->dev, mii->phy_id, MII_BMSR); | ||
249 | bmsr = mii->mdio_read(mii->dev, mii->phy_id, MII_BMSR); | ||
250 | |||
251 | /* no link */ | ||
252 | if ((bmsr & BMSR_LSTATUS) == 0) | ||
253 | return 0; | ||
254 | |||
255 | status = MII_LINK; | ||
256 | |||
257 | /* Lets look what ANEG says if it's supported - otherwize we shall | ||
258 | take the right values from the platform info*/ | ||
259 | if(!mii->force_media) { | ||
260 | /* autoneg not completed; don't bother */ | ||
261 | if ((bmsr & BMSR_ANEGCOMPLETE) == 0) | ||
262 | return 0; | ||
263 | |||
264 | adv = (*mii->mdio_read)(mii->dev, mii->phy_id, MII_ADVERTISE); | ||
265 | lpa = (*mii->mdio_read)(mii->dev, mii->phy_id, MII_LPA); | ||
266 | |||
267 | neg = lpa & adv; | ||
268 | } else { | ||
269 | neg = fep->fpi->bus_info->lpa; | ||
270 | } | ||
271 | |||
272 | if (neg & LPA_100FULL) | ||
273 | status |= MII_FULL | MII_100M; | ||
274 | else if (neg & LPA_100BASE4) | ||
275 | status |= MII_FULL | MII_BASE4 | MII_100M; | ||
276 | else if (neg & LPA_100HALF) | ||
277 | status |= MII_HALF | MII_100M; | ||
278 | else if (neg & LPA_10FULL) | ||
279 | status |= MII_FULL | MII_10M; | ||
280 | else | ||
281 | status |= MII_HALF | MII_10M; | ||
282 | |||
283 | return status; | ||
284 | } | ||
285 | |||
286 | void fs_mii_link_status_change_check(struct net_device *dev, int init_media) | ||
287 | { | ||
288 | struct fs_enet_private *fep = netdev_priv(dev); | ||
289 | struct mii_if_info *mii = &fep->mii_if; | ||
290 | unsigned int mii_status; | ||
291 | int ok_to_print, link, duplex, speed; | ||
292 | unsigned long flags; | ||
293 | |||
294 | ok_to_print = netif_msg_link(fep); | ||
295 | |||
296 | mii_status = mii_full_status(mii); | ||
297 | |||
298 | if (!init_media && mii_status == fep->last_mii_status) | ||
299 | return; | ||
300 | |||
301 | fep->last_mii_status = mii_status; | ||
302 | |||
303 | link = !!(mii_status & MII_LINK); | ||
304 | duplex = !!(mii_status & MII_FULL); | ||
305 | speed = (mii_status & MII_100M) ? 100 : 10; | ||
306 | |||
307 | if (link == 0) { | ||
308 | netif_carrier_off(mii->dev); | ||
309 | netif_stop_queue(dev); | ||
310 | if (!init_media) { | ||
311 | spin_lock_irqsave(&fep->lock, flags); | ||
312 | (*fep->ops->stop)(dev); | ||
313 | spin_unlock_irqrestore(&fep->lock, flags); | ||
314 | } | ||
315 | |||
316 | if (ok_to_print) | ||
317 | printk(KERN_INFO "%s: link down\n", mii->dev->name); | ||
318 | |||
319 | } else { | ||
320 | |||
321 | mii->full_duplex = duplex; | ||
322 | |||
323 | netif_carrier_on(mii->dev); | ||
324 | |||
325 | spin_lock_irqsave(&fep->lock, flags); | ||
326 | fep->duplex = duplex; | ||
327 | fep->speed = speed; | ||
328 | (*fep->ops->restart)(dev); | ||
329 | spin_unlock_irqrestore(&fep->lock, flags); | ||
330 | |||
331 | netif_start_queue(dev); | ||
332 | |||
333 | if (ok_to_print) | ||
334 | printk(KERN_INFO "%s: link up, %dMbps, %s-duplex\n", | ||
335 | dev->name, speed, duplex ? "full" : "half"); | ||
336 | } | ||
337 | } | ||
338 | |||
339 | /**********************************************************************************/ | ||
340 | |||
341 | int fs_mii_read(struct net_device *dev, int phy_id, int location) | ||
342 | { | ||
343 | struct fs_enet_private *fep = netdev_priv(dev); | ||
344 | struct fs_enet_mii_bus *bus = fep->mii_bus; | ||
345 | |||
346 | unsigned long flags; | ||
347 | int ret; | ||
348 | |||
349 | spin_lock_irqsave(&bus->mii_lock, flags); | ||
350 | ret = (*bus->mii_read)(bus, phy_id, location); | ||
351 | spin_unlock_irqrestore(&bus->mii_lock, flags); | ||
352 | |||
353 | return ret; | ||
354 | } | ||
355 | |||
356 | void fs_mii_write(struct net_device *dev, int phy_id, int location, int value) | ||
357 | { | ||
358 | struct fs_enet_private *fep = netdev_priv(dev); | ||
359 | struct fs_enet_mii_bus *bus = fep->mii_bus; | ||
360 | unsigned long flags; | ||
361 | |||
362 | spin_lock_irqsave(&bus->mii_lock, flags); | ||
363 | (*bus->mii_write)(bus, phy_id, location, value); | ||
364 | spin_unlock_irqrestore(&bus->mii_lock, flags); | ||
365 | } | ||
366 | |||
367 | /*****************************************************************************/ | ||
368 | |||
369 | /* list of all registered mii buses */ | ||
370 | static LIST_HEAD(fs_mii_bus_list); | ||
371 | |||
372 | static struct fs_enet_mii_bus *lookup_bus(int method, int id) | ||
373 | { | ||
374 | struct list_head *ptr; | ||
375 | struct fs_enet_mii_bus *bus; | ||
376 | |||
377 | list_for_each(ptr, &fs_mii_bus_list) { | ||
378 | bus = list_entry(ptr, struct fs_enet_mii_bus, list); | ||
379 | if (bus->bus_info->method == method && | ||
380 | bus->bus_info->id == id) | ||
381 | return bus; | ||
382 | } | ||
383 | return NULL; | ||
384 | } | ||
385 | |||
386 | static struct fs_enet_mii_bus *create_bus(const struct fs_mii_bus_info *bi) | ||
387 | { | ||
388 | struct fs_enet_mii_bus *bus; | ||
389 | int ret = 0; | ||
390 | |||
391 | bus = kmalloc(sizeof(*bus), GFP_KERNEL); | ||
392 | if (bus == NULL) { | ||
393 | ret = -ENOMEM; | ||
394 | goto err; | ||
395 | } | ||
396 | memset(bus, 0, sizeof(*bus)); | ||
397 | spin_lock_init(&bus->mii_lock); | ||
398 | bus->bus_info = bi; | ||
399 | bus->refs = 0; | ||
400 | bus->usage_map = 0; | ||
401 | |||
402 | /* perform initialization */ | ||
403 | switch (bi->method) { | ||
404 | |||
405 | case fsmii_fixed: | ||
406 | ret = fs_mii_fixed_init(bus); | ||
407 | if (ret != 0) | ||
408 | goto err; | ||
409 | break; | ||
410 | |||
411 | case fsmii_bitbang: | ||
412 | ret = fs_mii_bitbang_init(bus); | ||
413 | if (ret != 0) | ||
414 | goto err; | ||
415 | break; | ||
416 | #ifdef CONFIG_FS_ENET_HAS_FEC | ||
417 | case fsmii_fec: | ||
418 | ret = fs_mii_fec_init(bus); | ||
419 | if (ret != 0) | ||
420 | goto err; | ||
421 | break; | ||
422 | #endif | ||
423 | default: | ||
424 | ret = -EINVAL; | ||
425 | goto err; | ||
426 | } | ||
427 | |||
428 | list_add(&bus->list, &fs_mii_bus_list); | ||
429 | |||
430 | return bus; | ||
431 | |||
432 | err: | ||
433 | kfree(bus); | ||
434 | return ERR_PTR(ret); | ||
435 | } | ||
436 | |||
437 | static void destroy_bus(struct fs_enet_mii_bus *bus) | ||
438 | { | ||
439 | /* remove from bus list */ | ||
440 | list_del(&bus->list); | ||
441 | |||
442 | /* nothing more needed */ | ||
443 | kfree(bus); | ||
444 | } | ||
445 | |||
446 | int fs_mii_connect(struct net_device *dev) | ||
447 | { | ||
448 | struct fs_enet_private *fep = netdev_priv(dev); | ||
449 | const struct fs_platform_info *fpi = fep->fpi; | ||
450 | struct fs_enet_mii_bus *bus = NULL; | ||
451 | |||
452 | /* check method validity */ | ||
453 | switch (fpi->bus_info->method) { | ||
454 | case fsmii_fixed: | ||
455 | case fsmii_bitbang: | ||
456 | break; | ||
457 | #ifdef CONFIG_FS_ENET_HAS_FEC | ||
458 | case fsmii_fec: | ||
459 | break; | ||
460 | #endif | ||
461 | default: | ||
462 | printk(KERN_ERR DRV_MODULE_NAME | ||
463 | ": %s Unknown MII bus method (%d)!\n", | ||
464 | dev->name, fpi->bus_info->method); | ||
465 | return -EINVAL; | ||
466 | } | ||
467 | |||
468 | bus = lookup_bus(fpi->bus_info->method, fpi->bus_info->id); | ||
469 | |||
470 | /* if not found create new bus */ | ||
471 | if (bus == NULL) { | ||
472 | bus = create_bus(fpi->bus_info); | ||
473 | if (IS_ERR(bus)) { | ||
474 | printk(KERN_ERR DRV_MODULE_NAME | ||
475 | ": %s MII bus creation failure!\n", dev->name); | ||
476 | return PTR_ERR(bus); | ||
477 | } | ||
478 | } | ||
479 | |||
480 | bus->refs++; | ||
481 | |||
482 | fep->mii_bus = bus; | ||
483 | |||
484 | fep->mii_if.dev = dev; | ||
485 | fep->mii_if.phy_id_mask = 0x1f; | ||
486 | fep->mii_if.reg_num_mask = 0x1f; | ||
487 | fep->mii_if.mdio_read = fs_mii_read; | ||
488 | fep->mii_if.mdio_write = fs_mii_write; | ||
489 | fep->mii_if.force_media = fpi->bus_info->disable_aneg; | ||
490 | fep->mii_if.phy_id = phy_id_detect(dev); | ||
491 | |||
492 | return 0; | ||
493 | } | ||
494 | |||
495 | void fs_mii_disconnect(struct net_device *dev) | ||
496 | { | ||
497 | struct fs_enet_private *fep = netdev_priv(dev); | ||
498 | struct fs_enet_mii_bus *bus = NULL; | ||
499 | |||
500 | bus = fep->mii_bus; | ||
501 | fep->mii_bus = NULL; | ||
502 | |||
503 | if (--bus->refs <= 0) | ||
504 | destroy_bus(bus); | ||
505 | } | ||
diff --git a/drivers/net/fs_enet/fs_enet.h b/drivers/net/fs_enet/fs_enet.h index e7ec96c964a9..95022c005f75 100644 --- a/drivers/net/fs_enet/fs_enet.h +++ b/drivers/net/fs_enet/fs_enet.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/netdevice.h> | 5 | #include <linux/netdevice.h> |
6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
7 | #include <linux/list.h> | 7 | #include <linux/list.h> |
8 | #include <linux/phy.h> | ||
8 | 9 | ||
9 | #include <linux/fs_enet_pd.h> | 10 | #include <linux/fs_enet_pd.h> |
10 | 11 | ||
@@ -12,12 +13,30 @@ | |||
12 | 13 | ||
13 | #ifdef CONFIG_CPM1 | 14 | #ifdef CONFIG_CPM1 |
14 | #include <asm/commproc.h> | 15 | #include <asm/commproc.h> |
16 | |||
17 | struct fec_info { | ||
18 | fec_t* fecp; | ||
19 | u32 mii_speed; | ||
20 | }; | ||
15 | #endif | 21 | #endif |
16 | 22 | ||
17 | #ifdef CONFIG_CPM2 | 23 | #ifdef CONFIG_CPM2 |
18 | #include <asm/cpm2.h> | 24 | #include <asm/cpm2.h> |
19 | #endif | 25 | #endif |
20 | 26 | ||
27 | /* This is used to operate with pins. | ||
28 | Note that the actual port size may | ||
29 | be different; cpm(s) handle it OK */ | ||
30 | struct bb_info { | ||
31 | u8 mdio_dat_msk; | ||
32 | u8 mdio_dir_msk; | ||
33 | u8 *mdio_dir; | ||
34 | u8 *mdio_dat; | ||
35 | u8 mdc_msk; | ||
36 | u8 *mdc_dat; | ||
37 | int delay; | ||
38 | }; | ||
39 | |||
21 | /* hw driver ops */ | 40 | /* hw driver ops */ |
22 | struct fs_ops { | 41 | struct fs_ops { |
23 | int (*setup_data)(struct net_device *dev); | 42 | int (*setup_data)(struct net_device *dev); |
@@ -25,6 +44,7 @@ struct fs_ops { | |||
25 | void (*free_bd)(struct net_device *dev); | 44 | void (*free_bd)(struct net_device *dev); |
26 | void (*cleanup_data)(struct net_device *dev); | 45 | void (*cleanup_data)(struct net_device *dev); |
27 | void (*set_multicast_list)(struct net_device *dev); | 46 | void (*set_multicast_list)(struct net_device *dev); |
47 | void (*adjust_link)(struct net_device *dev); | ||
28 | void (*restart)(struct net_device *dev); | 48 | void (*restart)(struct net_device *dev); |
29 | void (*stop)(struct net_device *dev); | 49 | void (*stop)(struct net_device *dev); |
30 | void (*pre_request_irq)(struct net_device *dev, int irq); | 50 | void (*pre_request_irq)(struct net_device *dev, int irq); |
@@ -100,10 +120,6 @@ struct fs_enet_mii_bus { | |||
100 | }; | 120 | }; |
101 | }; | 121 | }; |
102 | 122 | ||
103 | int fs_mii_bitbang_init(struct fs_enet_mii_bus *bus); | ||
104 | int fs_mii_fixed_init(struct fs_enet_mii_bus *bus); | ||
105 | int fs_mii_fec_init(struct fs_enet_mii_bus *bus); | ||
106 | |||
107 | struct fs_enet_private { | 123 | struct fs_enet_private { |
108 | struct device *dev; /* pointer back to the device (must be initialized first) */ | 124 | struct device *dev; /* pointer back to the device (must be initialized first) */ |
109 | spinlock_t lock; /* during all ops except TX pckt processing */ | 125 | spinlock_t lock; /* during all ops except TX pckt processing */ |
@@ -130,7 +146,8 @@ struct fs_enet_private { | |||
130 | struct fs_enet_mii_bus *mii_bus; | 146 | struct fs_enet_mii_bus *mii_bus; |
131 | int interrupt; | 147 | int interrupt; |
132 | 148 | ||
133 | int duplex, speed; /* current settings */ | 149 | struct phy_device *phydev; |
150 | int oldduplex, oldspeed, oldlink; /* current settings */ | ||
134 | 151 | ||
135 | /* event masks */ | 152 | /* event masks */ |
136 | u32 ev_napi_rx; /* mask of NAPI rx events */ | 153 | u32 ev_napi_rx; /* mask of NAPI rx events */ |
@@ -168,15 +185,9 @@ struct fs_enet_private { | |||
168 | }; | 185 | }; |
169 | 186 | ||
170 | /***************************************************************************/ | 187 | /***************************************************************************/ |
171 | 188 | int fs_enet_mdio_bb_init(void); | |
172 | int fs_mii_read(struct net_device *dev, int phy_id, int location); | 189 | int fs_mii_fixed_init(struct fs_enet_mii_bus *bus); |
173 | void fs_mii_write(struct net_device *dev, int phy_id, int location, int value); | 190 | int fs_enet_mdio_fec_init(void); |
174 | |||
175 | void fs_mii_startup(struct net_device *dev); | ||
176 | void fs_mii_shutdown(struct net_device *dev); | ||
177 | void fs_mii_ack_int(struct net_device *dev); | ||
178 | |||
179 | void fs_mii_link_status_change_check(struct net_device *dev, int init_media); | ||
180 | 191 | ||
181 | void fs_init_bds(struct net_device *dev); | 192 | void fs_init_bds(struct net_device *dev); |
182 | void fs_cleanup_bds(struct net_device *dev); | 193 | void fs_cleanup_bds(struct net_device *dev); |
@@ -194,7 +205,6 @@ int fs_enet_platform_init(void); | |||
194 | void fs_enet_platform_cleanup(void); | 205 | void fs_enet_platform_cleanup(void); |
195 | 206 | ||
196 | /***************************************************************************/ | 207 | /***************************************************************************/ |
197 | |||
198 | /* buffer descriptor access macros */ | 208 | /* buffer descriptor access macros */ |
199 | 209 | ||
200 | /* access macros */ | 210 | /* access macros */ |
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c index 64e20982c1fe..1ff2597b8495 100644 --- a/drivers/net/fs_enet/mac-fcc.c +++ b/drivers/net/fs_enet/mac-fcc.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/bitops.h> | 34 | #include <linux/bitops.h> |
35 | #include <linux/fs.h> | 35 | #include <linux/fs.h> |
36 | #include <linux/platform_device.h> | 36 | #include <linux/platform_device.h> |
37 | #include <linux/phy.h> | ||
37 | 38 | ||
38 | #include <asm/immap_cpm2.h> | 39 | #include <asm/immap_cpm2.h> |
39 | #include <asm/mpc8260.h> | 40 | #include <asm/mpc8260.h> |
@@ -122,22 +123,32 @@ static int do_pd_setup(struct fs_enet_private *fep) | |||
122 | 123 | ||
123 | /* Attach the memory for the FCC Parameter RAM */ | 124 | /* Attach the memory for the FCC Parameter RAM */ |
124 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_pram"); | 125 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_pram"); |
125 | fep->fcc.ep = (void *)r->start; | 126 | fep->fcc.ep = (void *)ioremap(r->start, r->end - r->start + 1); |
126 | |||
127 | if (fep->fcc.ep == NULL) | 127 | if (fep->fcc.ep == NULL) |
128 | return -EINVAL; | 128 | return -EINVAL; |
129 | 129 | ||
130 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_regs"); | 130 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_regs"); |
131 | fep->fcc.fccp = (void *)r->start; | 131 | fep->fcc.fccp = (void *)ioremap(r->start, r->end - r->start + 1); |
132 | |||
133 | if (fep->fcc.fccp == NULL) | 132 | if (fep->fcc.fccp == NULL) |
134 | return -EINVAL; | 133 | return -EINVAL; |
135 | 134 | ||
136 | fep->fcc.fcccp = (void *)fep->fpi->fcc_regs_c; | 135 | if (fep->fpi->fcc_regs_c) { |
136 | |||
137 | fep->fcc.fcccp = (void *)fep->fpi->fcc_regs_c; | ||
138 | } else { | ||
139 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, | ||
140 | "fcc_regs_c"); | ||
141 | fep->fcc.fcccp = (void *)ioremap(r->start, | ||
142 | r->end - r->start + 1); | ||
143 | } | ||
137 | 144 | ||
138 | if (fep->fcc.fcccp == NULL) | 145 | if (fep->fcc.fcccp == NULL) |
139 | return -EINVAL; | 146 | return -EINVAL; |
140 | 147 | ||
148 | fep->fcc.mem = (void *)fep->fpi->mem_offset; | ||
149 | if (fep->fcc.mem == NULL) | ||
150 | return -EINVAL; | ||
151 | |||
141 | return 0; | 152 | return 0; |
142 | } | 153 | } |
143 | 154 | ||
@@ -155,8 +166,6 @@ static int setup_data(struct net_device *dev) | |||
155 | if ((unsigned int)fep->fcc.idx >= 3) /* max 3 FCCs */ | 166 | if ((unsigned int)fep->fcc.idx >= 3) /* max 3 FCCs */ |
156 | return -EINVAL; | 167 | return -EINVAL; |
157 | 168 | ||
158 | fep->fcc.mem = (void *)fpi->mem_offset; | ||
159 | |||
160 | if (do_pd_setup(fep) != 0) | 169 | if (do_pd_setup(fep) != 0) |
161 | return -EINVAL; | 170 | return -EINVAL; |
162 | 171 | ||
@@ -394,7 +403,7 @@ static void restart(struct net_device *dev) | |||
394 | 403 | ||
395 | /* adjust to speed (for RMII mode) */ | 404 | /* adjust to speed (for RMII mode) */ |
396 | if (fpi->use_rmii) { | 405 | if (fpi->use_rmii) { |
397 | if (fep->speed == 100) | 406 | if (fep->phydev->speed == 100) |
398 | C8(fcccp, fcc_gfemr, 0x20); | 407 | C8(fcccp, fcc_gfemr, 0x20); |
399 | else | 408 | else |
400 | S8(fcccp, fcc_gfemr, 0x20); | 409 | S8(fcccp, fcc_gfemr, 0x20); |
@@ -420,7 +429,7 @@ static void restart(struct net_device *dev) | |||
420 | S32(fccp, fcc_fpsmr, FCC_PSMR_RMII); | 429 | S32(fccp, fcc_fpsmr, FCC_PSMR_RMII); |
421 | 430 | ||
422 | /* adjust to duplex mode */ | 431 | /* adjust to duplex mode */ |
423 | if (fep->duplex) | 432 | if (fep->phydev->duplex) |
424 | S32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB); | 433 | S32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB); |
425 | else | 434 | else |
426 | C32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB); | 435 | C32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB); |
@@ -486,7 +495,10 @@ static void rx_bd_done(struct net_device *dev) | |||
486 | 495 | ||
487 | static void tx_kickstart(struct net_device *dev) | 496 | static void tx_kickstart(struct net_device *dev) |
488 | { | 497 | { |
489 | /* nothing */ | 498 | struct fs_enet_private *fep = netdev_priv(dev); |
499 | fcc_t *fccp = fep->fcc.fccp; | ||
500 | |||
501 | S32(fccp, fcc_ftodr, 0x80); | ||
490 | } | 502 | } |
491 | 503 | ||
492 | static u32 get_int_events(struct net_device *dev) | 504 | static u32 get_int_events(struct net_device *dev) |
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c index e09547077529..c2c5fd419bd0 100644 --- a/drivers/net/fs_enet/mac-fec.c +++ b/drivers/net/fs_enet/mac-fec.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | #include "fs_enet.h" | 48 | #include "fs_enet.h" |
49 | #include "fec.h" | ||
49 | 50 | ||
50 | /*************************************************/ | 51 | /*************************************************/ |
51 | 52 | ||
@@ -75,50 +76,8 @@ | |||
75 | /* clear bits */ | 76 | /* clear bits */ |
76 | #define FC(_fecp, _reg, _v) FW(_fecp, _reg, FR(_fecp, _reg) & ~(_v)) | 77 | #define FC(_fecp, _reg, _v) FW(_fecp, _reg, FR(_fecp, _reg) & ~(_v)) |
77 | 78 | ||
78 | |||
79 | /* CRC polynomium used by the FEC for the multicast group filtering */ | ||
80 | #define FEC_CRC_POLY 0x04C11DB7 | ||
81 | |||
82 | #define FEC_MAX_MULTICAST_ADDRS 64 | ||
83 | |||
84 | /* Interrupt events/masks. | ||
85 | */ | ||
86 | #define FEC_ENET_HBERR 0x80000000U /* Heartbeat error */ | ||
87 | #define FEC_ENET_BABR 0x40000000U /* Babbling receiver */ | ||
88 | #define FEC_ENET_BABT 0x20000000U /* Babbling transmitter */ | ||
89 | #define FEC_ENET_GRA 0x10000000U /* Graceful stop complete */ | ||
90 | #define FEC_ENET_TXF 0x08000000U /* Full frame transmitted */ | ||
91 | #define FEC_ENET_TXB 0x04000000U /* A buffer was transmitted */ | ||
92 | #define FEC_ENET_RXF 0x02000000U /* Full frame received */ | ||
93 | #define FEC_ENET_RXB 0x01000000U /* A buffer was received */ | ||
94 | #define FEC_ENET_MII 0x00800000U /* MII interrupt */ | ||
95 | #define FEC_ENET_EBERR 0x00400000U /* SDMA bus error */ | ||
96 | |||
97 | #define FEC_ECNTRL_PINMUX 0x00000004 | ||
98 | #define FEC_ECNTRL_ETHER_EN 0x00000002 | ||
99 | #define FEC_ECNTRL_RESET 0x00000001 | ||
100 | |||
101 | #define FEC_RCNTRL_BC_REJ 0x00000010 | ||
102 | #define FEC_RCNTRL_PROM 0x00000008 | ||
103 | #define FEC_RCNTRL_MII_MODE 0x00000004 | ||
104 | #define FEC_RCNTRL_DRT 0x00000002 | ||
105 | #define FEC_RCNTRL_LOOP 0x00000001 | ||
106 | |||
107 | #define FEC_TCNTRL_FDEN 0x00000004 | ||
108 | #define FEC_TCNTRL_HBC 0x00000002 | ||
109 | #define FEC_TCNTRL_GTS 0x00000001 | ||
110 | |||
111 | |||
112 | /* Make MII read/write commands for the FEC. | ||
113 | */ | ||
114 | #define mk_mii_read(REG) (0x60020000 | ((REG & 0x1f) << 18)) | ||
115 | #define mk_mii_write(REG, VAL) (0x50020000 | ((REG & 0x1f) << 18) | (VAL & 0xffff)) | ||
116 | #define mk_mii_end 0 | ||
117 | |||
118 | #define FEC_MII_LOOPS 10000 | ||
119 | |||
120 | /* | 79 | /* |
121 | * Delay to wait for FEC reset command to complete (in us) | 80 | * Delay to wait for FEC reset command to complete (in us) |
122 | */ | 81 | */ |
123 | #define FEC_RESET_DELAY 50 | 82 | #define FEC_RESET_DELAY 50 |
124 | 83 | ||
@@ -303,13 +262,15 @@ static void restart(struct net_device *dev) | |||
303 | int r; | 262 | int r; |
304 | u32 addrhi, addrlo; | 263 | u32 addrhi, addrlo; |
305 | 264 | ||
265 | struct mii_bus* mii = fep->phydev->bus; | ||
266 | struct fec_info* fec_inf = mii->priv; | ||
267 | |||
306 | r = whack_reset(fep->fec.fecp); | 268 | r = whack_reset(fep->fec.fecp); |
307 | if (r != 0) | 269 | if (r != 0) |
308 | printk(KERN_ERR DRV_MODULE_NAME | 270 | printk(KERN_ERR DRV_MODULE_NAME |
309 | ": %s FEC Reset FAILED!\n", dev->name); | 271 | ": %s FEC Reset FAILED!\n", dev->name); |
310 | |||
311 | /* | 272 | /* |
312 | * Set station address. | 273 | * Set station address. |
313 | */ | 274 | */ |
314 | addrhi = ((u32) dev->dev_addr[0] << 24) | | 275 | addrhi = ((u32) dev->dev_addr[0] << 24) | |
315 | ((u32) dev->dev_addr[1] << 16) | | 276 | ((u32) dev->dev_addr[1] << 16) | |
@@ -350,12 +311,12 @@ static void restart(struct net_device *dev) | |||
350 | FW(fecp, fun_code, 0x78000000); | 311 | FW(fecp, fun_code, 0x78000000); |
351 | 312 | ||
352 | /* | 313 | /* |
353 | * Set MII speed. | 314 | * Set MII speed. |
354 | */ | 315 | */ |
355 | FW(fecp, mii_speed, fep->mii_bus->fec.mii_speed); | 316 | FW(fecp, mii_speed, fec_inf->mii_speed); |
356 | 317 | ||
357 | /* | 318 | /* |
358 | * Clear any outstanding interrupt. | 319 | * Clear any outstanding interrupt. |
359 | */ | 320 | */ |
360 | FW(fecp, ievent, 0xffc0); | 321 | FW(fecp, ievent, 0xffc0); |
361 | FW(fecp, ivec, (fep->interrupt / 2) << 29); | 322 | FW(fecp, ivec, (fep->interrupt / 2) << 29); |
@@ -390,11 +351,12 @@ static void restart(struct net_device *dev) | |||
390 | } | 351 | } |
391 | #endif | 352 | #endif |
392 | 353 | ||
354 | |||
393 | FW(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */ | 355 | FW(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */ |
394 | /* | 356 | /* |
395 | * adjust to duplex mode | 357 | * adjust to duplex mode |
396 | */ | 358 | */ |
397 | if (fep->duplex) { | 359 | if (fep->phydev->duplex) { |
398 | FC(fecp, r_cntrl, FEC_RCNTRL_DRT); | 360 | FC(fecp, r_cntrl, FEC_RCNTRL_DRT); |
399 | FS(fecp, x_cntrl, FEC_TCNTRL_FDEN); /* FD enable */ | 361 | FS(fecp, x_cntrl, FEC_TCNTRL_FDEN); /* FD enable */ |
400 | } else { | 362 | } else { |
@@ -418,9 +380,11 @@ static void restart(struct net_device *dev) | |||
418 | static void stop(struct net_device *dev) | 380 | static void stop(struct net_device *dev) |
419 | { | 381 | { |
420 | struct fs_enet_private *fep = netdev_priv(dev); | 382 | struct fs_enet_private *fep = netdev_priv(dev); |
383 | const struct fs_platform_info *fpi = fep->fpi; | ||
421 | fec_t *fecp = fep->fec.fecp; | 384 | fec_t *fecp = fep->fec.fecp; |
422 | struct fs_enet_mii_bus *bus = fep->mii_bus; | 385 | |
423 | const struct fs_mii_bus_info *bi = bus->bus_info; | 386 | struct fec_info* feci= fep->phydev->bus->priv; |
387 | |||
424 | int i; | 388 | int i; |
425 | 389 | ||
426 | if ((FR(fecp, ecntrl) & FEC_ECNTRL_ETHER_EN) == 0) | 390 | if ((FR(fecp, ecntrl) & FEC_ECNTRL_ETHER_EN) == 0) |
@@ -444,11 +408,11 @@ static void stop(struct net_device *dev) | |||
444 | fs_cleanup_bds(dev); | 408 | fs_cleanup_bds(dev); |
445 | 409 | ||
446 | /* shut down FEC1? that's where the mii bus is */ | 410 | /* shut down FEC1? that's where the mii bus is */ |
447 | if (fep->fec.idx == 0 && bus->refs > 1 && bi->method == fsmii_fec) { | 411 | if (fpi->has_phy) { |
448 | FS(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */ | 412 | FS(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */ |
449 | FS(fecp, ecntrl, FEC_ECNTRL_PINMUX | FEC_ECNTRL_ETHER_EN); | 413 | FS(fecp, ecntrl, FEC_ECNTRL_PINMUX | FEC_ECNTRL_ETHER_EN); |
450 | FW(fecp, ievent, FEC_ENET_MII); | 414 | FW(fecp, ievent, FEC_ENET_MII); |
451 | FW(fecp, mii_speed, bus->fec.mii_speed); | 415 | FW(fecp, mii_speed, feci->mii_speed); |
452 | } | 416 | } |
453 | } | 417 | } |
454 | 418 | ||
@@ -583,73 +547,3 @@ const struct fs_ops fs_fec_ops = { | |||
583 | .free_bd = free_bd, | 547 | .free_bd = free_bd, |
584 | }; | 548 | }; |
585 | 549 | ||
586 | /***********************************************************************/ | ||
587 | |||
588 | static int mii_read(struct fs_enet_mii_bus *bus, int phy_id, int location) | ||
589 | { | ||
590 | fec_t *fecp = bus->fec.fecp; | ||
591 | int i, ret = -1; | ||
592 | |||
593 | if ((FR(fecp, r_cntrl) & FEC_RCNTRL_MII_MODE) == 0) | ||
594 | BUG(); | ||
595 | |||
596 | /* Add PHY address to register command. */ | ||
597 | FW(fecp, mii_data, (phy_id << 23) | mk_mii_read(location)); | ||
598 | |||
599 | for (i = 0; i < FEC_MII_LOOPS; i++) | ||
600 | if ((FR(fecp, ievent) & FEC_ENET_MII) != 0) | ||
601 | break; | ||
602 | |||
603 | if (i < FEC_MII_LOOPS) { | ||
604 | FW(fecp, ievent, FEC_ENET_MII); | ||
605 | ret = FR(fecp, mii_data) & 0xffff; | ||
606 | } | ||
607 | |||
608 | return ret; | ||
609 | } | ||
610 | |||
611 | static void mii_write(struct fs_enet_mii_bus *bus, int phy_id, int location, int value) | ||
612 | { | ||
613 | fec_t *fecp = bus->fec.fecp; | ||
614 | int i; | ||
615 | |||
616 | /* this must never happen */ | ||
617 | if ((FR(fecp, r_cntrl) & FEC_RCNTRL_MII_MODE) == 0) | ||
618 | BUG(); | ||
619 | |||
620 | /* Add PHY address to register command. */ | ||
621 | FW(fecp, mii_data, (phy_id << 23) | mk_mii_write(location, value)); | ||
622 | |||
623 | for (i = 0; i < FEC_MII_LOOPS; i++) | ||
624 | if ((FR(fecp, ievent) & FEC_ENET_MII) != 0) | ||
625 | break; | ||
626 | |||
627 | if (i < FEC_MII_LOOPS) | ||
628 | FW(fecp, ievent, FEC_ENET_MII); | ||
629 | } | ||
630 | |||
631 | int fs_mii_fec_init(struct fs_enet_mii_bus *bus) | ||
632 | { | ||
633 | bd_t *bd = (bd_t *)__res; | ||
634 | const struct fs_mii_bus_info *bi = bus->bus_info; | ||
635 | fec_t *fecp; | ||
636 | |||
637 | if (bi->id != 0) | ||
638 | return -1; | ||
639 | |||
640 | bus->fec.fecp = &((immap_t *)fs_enet_immap)->im_cpm.cp_fec; | ||
641 | bus->fec.mii_speed = ((((bd->bi_intfreq + 4999999) / 2500000) / 2) | ||
642 | & 0x3F) << 1; | ||
643 | |||
644 | fecp = bus->fec.fecp; | ||
645 | |||
646 | FS(fecp, r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */ | ||
647 | FS(fecp, ecntrl, FEC_ECNTRL_PINMUX | FEC_ECNTRL_ETHER_EN); | ||
648 | FW(fecp, ievent, FEC_ENET_MII); | ||
649 | FW(fecp, mii_speed, bus->fec.mii_speed); | ||
650 | |||
651 | bus->mii_read = mii_read; | ||
652 | bus->mii_write = mii_write; | ||
653 | |||
654 | return 0; | ||
655 | } | ||
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c index eaa24fab645f..95ec5872c507 100644 --- a/drivers/net/fs_enet/mac-scc.c +++ b/drivers/net/fs_enet/mac-scc.c | |||
@@ -369,7 +369,7 @@ static void restart(struct net_device *dev) | |||
369 | W16(sccp, scc_psmr, SCC_PSMR_ENCRC | SCC_PSMR_NIB22); | 369 | W16(sccp, scc_psmr, SCC_PSMR_ENCRC | SCC_PSMR_NIB22); |
370 | 370 | ||
371 | /* Set full duplex mode if needed */ | 371 | /* Set full duplex mode if needed */ |
372 | if (fep->duplex) | 372 | if (fep->phydev->duplex) |
373 | S16(sccp, scc_psmr, SCC_PSMR_LPB | SCC_PSMR_FDE); | 373 | S16(sccp, scc_psmr, SCC_PSMR_LPB | SCC_PSMR_FDE); |
374 | 374 | ||
375 | S32(sccp, scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT); | 375 | S32(sccp, scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT); |
@@ -500,6 +500,8 @@ static void tx_restart(struct net_device *dev) | |||
500 | scc_cr_cmd(fep, CPM_CR_RESTART_TX); | 500 | scc_cr_cmd(fep, CPM_CR_RESTART_TX); |
501 | } | 501 | } |
502 | 502 | ||
503 | |||
504 | |||
503 | /*************************************************************************/ | 505 | /*************************************************************************/ |
504 | 506 | ||
505 | const struct fs_ops fs_scc_ops = { | 507 | const struct fs_ops fs_scc_ops = { |
diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c index 48f9cf83ab6f..0b9b8b5c847c 100644 --- a/drivers/net/fs_enet/mii-bitbang.c +++ b/drivers/net/fs_enet/mii-bitbang.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/mii.h> | 33 | #include <linux/mii.h> |
34 | #include <linux/ethtool.h> | 34 | #include <linux/ethtool.h> |
35 | #include <linux/bitops.h> | 35 | #include <linux/bitops.h> |
36 | #include <linux/platform_device.h> | ||
36 | 37 | ||
37 | #include <asm/pgtable.h> | 38 | #include <asm/pgtable.h> |
38 | #include <asm/irq.h> | 39 | #include <asm/irq.h> |
@@ -40,129 +41,25 @@ | |||
40 | 41 | ||
41 | #include "fs_enet.h" | 42 | #include "fs_enet.h" |
42 | 43 | ||
43 | #ifdef CONFIG_8xx | 44 | static int bitbang_prep_bit(u8 **datp, u8 *mskp, |
44 | static int bitbang_prep_bit(u8 **dirp, u8 **datp, u8 *mskp, int port, int bit) | 45 | struct fs_mii_bit *mii_bit) |
45 | { | 46 | { |
46 | immap_t *im = (immap_t *)fs_enet_immap; | 47 | void *dat; |
47 | void *dir, *dat, *ppar; | ||
48 | int adv; | 48 | int adv; |
49 | u8 msk; | 49 | u8 msk; |
50 | 50 | ||
51 | switch (port) { | 51 | dat = (void*) mii_bit->offset; |
52 | case fsiop_porta: | ||
53 | dir = &im->im_ioport.iop_padir; | ||
54 | dat = &im->im_ioport.iop_padat; | ||
55 | ppar = &im->im_ioport.iop_papar; | ||
56 | break; | ||
57 | |||
58 | case fsiop_portb: | ||
59 | dir = &im->im_cpm.cp_pbdir; | ||
60 | dat = &im->im_cpm.cp_pbdat; | ||
61 | ppar = &im->im_cpm.cp_pbpar; | ||
62 | break; | ||
63 | |||
64 | case fsiop_portc: | ||
65 | dir = &im->im_ioport.iop_pcdir; | ||
66 | dat = &im->im_ioport.iop_pcdat; | ||
67 | ppar = &im->im_ioport.iop_pcpar; | ||
68 | break; | ||
69 | |||
70 | case fsiop_portd: | ||
71 | dir = &im->im_ioport.iop_pddir; | ||
72 | dat = &im->im_ioport.iop_pddat; | ||
73 | ppar = &im->im_ioport.iop_pdpar; | ||
74 | break; | ||
75 | |||
76 | case fsiop_porte: | ||
77 | dir = &im->im_cpm.cp_pedir; | ||
78 | dat = &im->im_cpm.cp_pedat; | ||
79 | ppar = &im->im_cpm.cp_pepar; | ||
80 | break; | ||
81 | |||
82 | default: | ||
83 | printk(KERN_ERR DRV_MODULE_NAME | ||
84 | "Illegal port value %d!\n", port); | ||
85 | return -EINVAL; | ||
86 | } | ||
87 | |||
88 | adv = bit >> 3; | ||
89 | dir = (char *)dir + adv; | ||
90 | dat = (char *)dat + adv; | ||
91 | ppar = (char *)ppar + adv; | ||
92 | |||
93 | msk = 1 << (7 - (bit & 7)); | ||
94 | if ((in_8(ppar) & msk) != 0) { | ||
95 | printk(KERN_ERR DRV_MODULE_NAME | ||
96 | "pin %d on port %d is not general purpose!\n", bit, port); | ||
97 | return -EINVAL; | ||
98 | } | ||
99 | |||
100 | *dirp = dir; | ||
101 | *datp = dat; | ||
102 | *mskp = msk; | ||
103 | |||
104 | return 0; | ||
105 | } | ||
106 | #endif | ||
107 | |||
108 | #ifdef CONFIG_8260 | ||
109 | static int bitbang_prep_bit(u8 **dirp, u8 **datp, u8 *mskp, int port, int bit) | ||
110 | { | ||
111 | iop_cpm2_t *io = &((cpm2_map_t *)fs_enet_immap)->im_ioport; | ||
112 | void *dir, *dat, *ppar; | ||
113 | int adv; | ||
114 | u8 msk; | ||
115 | |||
116 | switch (port) { | ||
117 | case fsiop_porta: | ||
118 | dir = &io->iop_pdira; | ||
119 | dat = &io->iop_pdata; | ||
120 | ppar = &io->iop_ppara; | ||
121 | break; | ||
122 | |||
123 | case fsiop_portb: | ||
124 | dir = &io->iop_pdirb; | ||
125 | dat = &io->iop_pdatb; | ||
126 | ppar = &io->iop_pparb; | ||
127 | break; | ||
128 | |||
129 | case fsiop_portc: | ||
130 | dir = &io->iop_pdirc; | ||
131 | dat = &io->iop_pdatc; | ||
132 | ppar = &io->iop_pparc; | ||
133 | break; | ||
134 | |||
135 | case fsiop_portd: | ||
136 | dir = &io->iop_pdird; | ||
137 | dat = &io->iop_pdatd; | ||
138 | ppar = &io->iop_ppard; | ||
139 | break; | ||
140 | |||
141 | default: | ||
142 | printk(KERN_ERR DRV_MODULE_NAME | ||
143 | "Illegal port value %d!\n", port); | ||
144 | return -EINVAL; | ||
145 | } | ||
146 | 52 | ||
147 | adv = bit >> 3; | 53 | adv = mii_bit->bit >> 3; |
148 | dir = (char *)dir + adv; | ||
149 | dat = (char *)dat + adv; | 54 | dat = (char *)dat + adv; |
150 | ppar = (char *)ppar + adv; | ||
151 | 55 | ||
152 | msk = 1 << (7 - (bit & 7)); | 56 | msk = 1 << (7 - (mii_bit->bit & 7)); |
153 | if ((in_8(ppar) & msk) != 0) { | ||
154 | printk(KERN_ERR DRV_MODULE_NAME | ||
155 | "pin %d on port %d is not general purpose!\n", bit, port); | ||
156 | return -EINVAL; | ||
157 | } | ||
158 | 57 | ||
159 | *dirp = dir; | ||
160 | *datp = dat; | 58 | *datp = dat; |
161 | *mskp = msk; | 59 | *mskp = msk; |
162 | 60 | ||
163 | return 0; | 61 | return 0; |
164 | } | 62 | } |
165 | #endif | ||
166 | 63 | ||
167 | static inline void bb_set(u8 *p, u8 m) | 64 | static inline void bb_set(u8 *p, u8 m) |
168 | { | 65 | { |
@@ -179,44 +76,44 @@ static inline int bb_read(u8 *p, u8 m) | |||
179 | return (in_8(p) & m) != 0; | 76 | return (in_8(p) & m) != 0; |
180 | } | 77 | } |
181 | 78 | ||
182 | static inline void mdio_active(struct fs_enet_mii_bus *bus) | 79 | static inline void mdio_active(struct bb_info *bitbang) |
183 | { | 80 | { |
184 | bb_set(bus->bitbang.mdio_dir, bus->bitbang.mdio_msk); | 81 | bb_set(bitbang->mdio_dir, bitbang->mdio_dir_msk); |
185 | } | 82 | } |
186 | 83 | ||
187 | static inline void mdio_tristate(struct fs_enet_mii_bus *bus) | 84 | static inline void mdio_tristate(struct bb_info *bitbang ) |
188 | { | 85 | { |
189 | bb_clr(bus->bitbang.mdio_dir, bus->bitbang.mdio_msk); | 86 | bb_clr(bitbang->mdio_dir, bitbang->mdio_dir_msk); |
190 | } | 87 | } |
191 | 88 | ||
192 | static inline int mdio_read(struct fs_enet_mii_bus *bus) | 89 | static inline int mdio_read(struct bb_info *bitbang ) |
193 | { | 90 | { |
194 | return bb_read(bus->bitbang.mdio_dat, bus->bitbang.mdio_msk); | 91 | return bb_read(bitbang->mdio_dat, bitbang->mdio_dat_msk); |
195 | } | 92 | } |
196 | 93 | ||
197 | static inline void mdio(struct fs_enet_mii_bus *bus, int what) | 94 | static inline void mdio(struct bb_info *bitbang , int what) |
198 | { | 95 | { |
199 | if (what) | 96 | if (what) |
200 | bb_set(bus->bitbang.mdio_dat, bus->bitbang.mdio_msk); | 97 | bb_set(bitbang->mdio_dat, bitbang->mdio_dat_msk); |
201 | else | 98 | else |
202 | bb_clr(bus->bitbang.mdio_dat, bus->bitbang.mdio_msk); | 99 | bb_clr(bitbang->mdio_dat, bitbang->mdio_dat_msk); |
203 | } | 100 | } |
204 | 101 | ||
205 | static inline void mdc(struct fs_enet_mii_bus *bus, int what) | 102 | static inline void mdc(struct bb_info *bitbang , int what) |
206 | { | 103 | { |
207 | if (what) | 104 | if (what) |
208 | bb_set(bus->bitbang.mdc_dat, bus->bitbang.mdc_msk); | 105 | bb_set(bitbang->mdc_dat, bitbang->mdc_msk); |
209 | else | 106 | else |
210 | bb_clr(bus->bitbang.mdc_dat, bus->bitbang.mdc_msk); | 107 | bb_clr(bitbang->mdc_dat, bitbang->mdc_msk); |
211 | } | 108 | } |
212 | 109 | ||
213 | static inline void mii_delay(struct fs_enet_mii_bus *bus) | 110 | static inline void mii_delay(struct bb_info *bitbang ) |
214 | { | 111 | { |
215 | udelay(bus->bus_info->i.bitbang.delay); | 112 | udelay(bitbang->delay); |
216 | } | 113 | } |
217 | 114 | ||
218 | /* Utility to send the preamble, address, and register (common to read and write). */ | 115 | /* Utility to send the preamble, address, and register (common to read and write). */ |
219 | static void bitbang_pre(struct fs_enet_mii_bus *bus, int read, u8 addr, u8 reg) | 116 | static void bitbang_pre(struct bb_info *bitbang , int read, u8 addr, u8 reg) |
220 | { | 117 | { |
221 | int j; | 118 | int j; |
222 | 119 | ||
@@ -228,177 +125,284 @@ static void bitbang_pre(struct fs_enet_mii_bus *bus, int read, u8 addr, u8 reg) | |||
228 | * but it is safer and will be much more robust. | 125 | * but it is safer and will be much more robust. |
229 | */ | 126 | */ |
230 | 127 | ||
231 | mdio_active(bus); | 128 | mdio_active(bitbang); |
232 | mdio(bus, 1); | 129 | mdio(bitbang, 1); |
233 | for (j = 0; j < 32; j++) { | 130 | for (j = 0; j < 32; j++) { |
234 | mdc(bus, 0); | 131 | mdc(bitbang, 0); |
235 | mii_delay(bus); | 132 | mii_delay(bitbang); |
236 | mdc(bus, 1); | 133 | mdc(bitbang, 1); |
237 | mii_delay(bus); | 134 | mii_delay(bitbang); |
238 | } | 135 | } |
239 | 136 | ||
240 | /* send the start bit (01) and the read opcode (10) or write (10) */ | 137 | /* send the start bit (01) and the read opcode (10) or write (10) */ |
241 | mdc(bus, 0); | 138 | mdc(bitbang, 0); |
242 | mdio(bus, 0); | 139 | mdio(bitbang, 0); |
243 | mii_delay(bus); | 140 | mii_delay(bitbang); |
244 | mdc(bus, 1); | 141 | mdc(bitbang, 1); |
245 | mii_delay(bus); | 142 | mii_delay(bitbang); |
246 | mdc(bus, 0); | 143 | mdc(bitbang, 0); |
247 | mdio(bus, 1); | 144 | mdio(bitbang, 1); |
248 | mii_delay(bus); | 145 | mii_delay(bitbang); |
249 | mdc(bus, 1); | 146 | mdc(bitbang, 1); |
250 | mii_delay(bus); | 147 | mii_delay(bitbang); |
251 | mdc(bus, 0); | 148 | mdc(bitbang, 0); |
252 | mdio(bus, read); | 149 | mdio(bitbang, read); |
253 | mii_delay(bus); | 150 | mii_delay(bitbang); |
254 | mdc(bus, 1); | 151 | mdc(bitbang, 1); |
255 | mii_delay(bus); | 152 | mii_delay(bitbang); |
256 | mdc(bus, 0); | 153 | mdc(bitbang, 0); |
257 | mdio(bus, !read); | 154 | mdio(bitbang, !read); |
258 | mii_delay(bus); | 155 | mii_delay(bitbang); |
259 | mdc(bus, 1); | 156 | mdc(bitbang, 1); |
260 | mii_delay(bus); | 157 | mii_delay(bitbang); |
261 | 158 | ||
262 | /* send the PHY address */ | 159 | /* send the PHY address */ |
263 | for (j = 0; j < 5; j++) { | 160 | for (j = 0; j < 5; j++) { |
264 | mdc(bus, 0); | 161 | mdc(bitbang, 0); |
265 | mdio(bus, (addr & 0x10) != 0); | 162 | mdio(bitbang, (addr & 0x10) != 0); |
266 | mii_delay(bus); | 163 | mii_delay(bitbang); |
267 | mdc(bus, 1); | 164 | mdc(bitbang, 1); |
268 | mii_delay(bus); | 165 | mii_delay(bitbang); |
269 | addr <<= 1; | 166 | addr <<= 1; |
270 | } | 167 | } |
271 | 168 | ||
272 | /* send the register address */ | 169 | /* send the register address */ |
273 | for (j = 0; j < 5; j++) { | 170 | for (j = 0; j < 5; j++) { |
274 | mdc(bus, 0); | 171 | mdc(bitbang, 0); |
275 | mdio(bus, (reg & 0x10) != 0); | 172 | mdio(bitbang, (reg & 0x10) != 0); |
276 | mii_delay(bus); | 173 | mii_delay(bitbang); |
277 | mdc(bus, 1); | 174 | mdc(bitbang, 1); |
278 | mii_delay(bus); | 175 | mii_delay(bitbang); |
279 | reg <<= 1; | 176 | reg <<= 1; |
280 | } | 177 | } |
281 | } | 178 | } |
282 | 179 | ||
283 | static int mii_read(struct fs_enet_mii_bus *bus, int phy_id, int location) | 180 | static int fs_enet_mii_bb_read(struct mii_bus *bus , int phy_id, int location) |
284 | { | 181 | { |
285 | u16 rdreg; | 182 | u16 rdreg; |
286 | int ret, j; | 183 | int ret, j; |
287 | u8 addr = phy_id & 0xff; | 184 | u8 addr = phy_id & 0xff; |
288 | u8 reg = location & 0xff; | 185 | u8 reg = location & 0xff; |
186 | struct bb_info* bitbang = bus->priv; | ||
289 | 187 | ||
290 | bitbang_pre(bus, 1, addr, reg); | 188 | bitbang_pre(bitbang, 1, addr, reg); |
291 | 189 | ||
292 | /* tri-state our MDIO I/O pin so we can read */ | 190 | /* tri-state our MDIO I/O pin so we can read */ |
293 | mdc(bus, 0); | 191 | mdc(bitbang, 0); |
294 | mdio_tristate(bus); | 192 | mdio_tristate(bitbang); |
295 | mii_delay(bus); | 193 | mii_delay(bitbang); |
296 | mdc(bus, 1); | 194 | mdc(bitbang, 1); |
297 | mii_delay(bus); | 195 | mii_delay(bitbang); |
298 | 196 | ||
299 | /* check the turnaround bit: the PHY should be driving it to zero */ | 197 | /* check the turnaround bit: the PHY should be driving it to zero */ |
300 | if (mdio_read(bus) != 0) { | 198 | if (mdio_read(bitbang) != 0) { |
301 | /* PHY didn't drive TA low */ | 199 | /* PHY didn't drive TA low */ |
302 | for (j = 0; j < 32; j++) { | 200 | for (j = 0; j < 32; j++) { |
303 | mdc(bus, 0); | 201 | mdc(bitbang, 0); |
304 | mii_delay(bus); | 202 | mii_delay(bitbang); |
305 | mdc(bus, 1); | 203 | mdc(bitbang, 1); |
306 | mii_delay(bus); | 204 | mii_delay(bitbang); |
307 | } | 205 | } |
308 | ret = -1; | 206 | ret = -1; |
309 | goto out; | 207 | goto out; |
310 | } | 208 | } |
311 | 209 | ||
312 | mdc(bus, 0); | 210 | mdc(bitbang, 0); |
313 | mii_delay(bus); | 211 | mii_delay(bitbang); |
314 | 212 | ||
315 | /* read 16 bits of register data, MSB first */ | 213 | /* read 16 bits of register data, MSB first */ |
316 | rdreg = 0; | 214 | rdreg = 0; |
317 | for (j = 0; j < 16; j++) { | 215 | for (j = 0; j < 16; j++) { |
318 | mdc(bus, 1); | 216 | mdc(bitbang, 1); |
319 | mii_delay(bus); | 217 | mii_delay(bitbang); |
320 | rdreg <<= 1; | 218 | rdreg <<= 1; |
321 | rdreg |= mdio_read(bus); | 219 | rdreg |= mdio_read(bitbang); |
322 | mdc(bus, 0); | 220 | mdc(bitbang, 0); |
323 | mii_delay(bus); | 221 | mii_delay(bitbang); |
324 | } | 222 | } |
325 | 223 | ||
326 | mdc(bus, 1); | 224 | mdc(bitbang, 1); |
327 | mii_delay(bus); | 225 | mii_delay(bitbang); |
328 | mdc(bus, 0); | 226 | mdc(bitbang, 0); |
329 | mii_delay(bus); | 227 | mii_delay(bitbang); |
330 | mdc(bus, 1); | 228 | mdc(bitbang, 1); |
331 | mii_delay(bus); | 229 | mii_delay(bitbang); |
332 | 230 | ||
333 | ret = rdreg; | 231 | ret = rdreg; |
334 | out: | 232 | out: |
335 | return ret; | 233 | return ret; |
336 | } | 234 | } |
337 | 235 | ||
338 | static void mii_write(struct fs_enet_mii_bus *bus, int phy_id, int location, int val) | 236 | static int fs_enet_mii_bb_write(struct mii_bus *bus, int phy_id, int location, u16 val) |
339 | { | 237 | { |
340 | int j; | 238 | int j; |
239 | struct bb_info* bitbang = bus->priv; | ||
240 | |||
341 | u8 addr = phy_id & 0xff; | 241 | u8 addr = phy_id & 0xff; |
342 | u8 reg = location & 0xff; | 242 | u8 reg = location & 0xff; |
343 | u16 value = val & 0xffff; | 243 | u16 value = val & 0xffff; |
344 | 244 | ||
345 | bitbang_pre(bus, 0, addr, reg); | 245 | bitbang_pre(bitbang, 0, addr, reg); |
346 | 246 | ||
347 | /* send the turnaround (10) */ | 247 | /* send the turnaround (10) */ |
348 | mdc(bus, 0); | 248 | mdc(bitbang, 0); |
349 | mdio(bus, 1); | 249 | mdio(bitbang, 1); |
350 | mii_delay(bus); | 250 | mii_delay(bitbang); |
351 | mdc(bus, 1); | 251 | mdc(bitbang, 1); |
352 | mii_delay(bus); | 252 | mii_delay(bitbang); |
353 | mdc(bus, 0); | 253 | mdc(bitbang, 0); |
354 | mdio(bus, 0); | 254 | mdio(bitbang, 0); |
355 | mii_delay(bus); | 255 | mii_delay(bitbang); |
356 | mdc(bus, 1); | 256 | mdc(bitbang, 1); |
357 | mii_delay(bus); | 257 | mii_delay(bitbang); |
358 | 258 | ||
359 | /* write 16 bits of register data, MSB first */ | 259 | /* write 16 bits of register data, MSB first */ |
360 | for (j = 0; j < 16; j++) { | 260 | for (j = 0; j < 16; j++) { |
361 | mdc(bus, 0); | 261 | mdc(bitbang, 0); |
362 | mdio(bus, (value & 0x8000) != 0); | 262 | mdio(bitbang, (value & 0x8000) != 0); |
363 | mii_delay(bus); | 263 | mii_delay(bitbang); |
364 | mdc(bus, 1); | 264 | mdc(bitbang, 1); |
365 | mii_delay(bus); | 265 | mii_delay(bitbang); |
366 | value <<= 1; | 266 | value <<= 1; |
367 | } | 267 | } |
368 | 268 | ||
369 | /* | 269 | /* |
370 | * Tri-state the MDIO line. | 270 | * Tri-state the MDIO line. |
371 | */ | 271 | */ |
372 | mdio_tristate(bus); | 272 | mdio_tristate(bitbang); |
373 | mdc(bus, 0); | 273 | mdc(bitbang, 0); |
374 | mii_delay(bus); | 274 | mii_delay(bitbang); |
375 | mdc(bus, 1); | 275 | mdc(bitbang, 1); |
376 | mii_delay(bus); | 276 | mii_delay(bitbang); |
277 | return 0; | ||
377 | } | 278 | } |
378 | 279 | ||
379 | int fs_mii_bitbang_init(struct fs_enet_mii_bus *bus) | 280 | static int fs_enet_mii_bb_reset(struct mii_bus *bus) |
281 | { | ||
282 | /*nothing here - dunno how to reset it*/ | ||
283 | return 0; | ||
284 | } | ||
285 | |||
286 | static int fs_mii_bitbang_init(struct bb_info *bitbang, struct fs_mii_bb_platform_info* fmpi) | ||
380 | { | 287 | { |
381 | const struct fs_mii_bus_info *bi = bus->bus_info; | ||
382 | int r; | 288 | int r; |
383 | 289 | ||
384 | r = bitbang_prep_bit(&bus->bitbang.mdio_dir, | 290 | bitbang->delay = fmpi->delay; |
385 | &bus->bitbang.mdio_dat, | 291 | |
386 | &bus->bitbang.mdio_msk, | 292 | r = bitbang_prep_bit(&bitbang->mdio_dir, |
387 | bi->i.bitbang.mdio_port, | 293 | &bitbang->mdio_dir_msk, |
388 | bi->i.bitbang.mdio_bit); | 294 | &fmpi->mdio_dir); |
389 | if (r != 0) | 295 | if (r != 0) |
390 | return r; | 296 | return r; |
391 | 297 | ||
392 | r = bitbang_prep_bit(&bus->bitbang.mdc_dir, | 298 | r = bitbang_prep_bit(&bitbang->mdio_dat, |
393 | &bus->bitbang.mdc_dat, | 299 | &bitbang->mdio_dat_msk, |
394 | &bus->bitbang.mdc_msk, | 300 | &fmpi->mdio_dat); |
395 | bi->i.bitbang.mdc_port, | ||
396 | bi->i.bitbang.mdc_bit); | ||
397 | if (r != 0) | 301 | if (r != 0) |
398 | return r; | 302 | return r; |
399 | 303 | ||
400 | bus->mii_read = mii_read; | 304 | r = bitbang_prep_bit(&bitbang->mdc_dat, |
401 | bus->mii_write = mii_write; | 305 | &bitbang->mdc_msk, |
306 | &fmpi->mdc_dat); | ||
307 | if (r != 0) | ||
308 | return r; | ||
402 | 309 | ||
403 | return 0; | 310 | return 0; |
404 | } | 311 | } |
312 | |||
313 | |||
314 | static int __devinit fs_enet_mdio_probe(struct device *dev) | ||
315 | { | ||
316 | struct platform_device *pdev = to_platform_device(dev); | ||
317 | struct fs_mii_bb_platform_info *pdata; | ||
318 | struct mii_bus *new_bus; | ||
319 | struct bb_info *bitbang; | ||
320 | int err = 0; | ||
321 | |||
322 | if (NULL == dev) | ||
323 | return -EINVAL; | ||
324 | |||
325 | new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL); | ||
326 | |||
327 | if (NULL == new_bus) | ||
328 | return -ENOMEM; | ||
329 | |||
330 | bitbang = kzalloc(sizeof(struct bb_info), GFP_KERNEL); | ||
331 | |||
332 | if (NULL == bitbang) | ||
333 | return -ENOMEM; | ||
334 | |||
335 | new_bus->name = "BB MII Bus", | ||
336 | new_bus->read = &fs_enet_mii_bb_read, | ||
337 | new_bus->write = &fs_enet_mii_bb_write, | ||
338 | new_bus->reset = &fs_enet_mii_bb_reset, | ||
339 | new_bus->id = pdev->id; | ||
340 | |||
341 | new_bus->phy_mask = ~0x9; | ||
342 | pdata = (struct fs_mii_bb_platform_info *)pdev->dev.platform_data; | ||
343 | |||
344 | if (NULL == pdata) { | ||
345 | printk(KERN_ERR "gfar mdio %d: Missing platform data!\n", pdev->id); | ||
346 | return -ENODEV; | ||
347 | } | ||
348 | |||
349 | /*set up workspace*/ | ||
350 | fs_mii_bitbang_init(bitbang, pdata); | ||
351 | |||
352 | new_bus->priv = bitbang; | ||
353 | |||
354 | new_bus->irq = pdata->irq; | ||
355 | |||
356 | new_bus->dev = dev; | ||
357 | dev_set_drvdata(dev, new_bus); | ||
358 | |||
359 | err = mdiobus_register(new_bus); | ||
360 | |||
361 | if (0 != err) { | ||
362 | printk (KERN_ERR "%s: Cannot register as MDIO bus\n", | ||
363 | new_bus->name); | ||
364 | goto bus_register_fail; | ||
365 | } | ||
366 | |||
367 | return 0; | ||
368 | |||
369 | bus_register_fail: | ||
370 | kfree(bitbang); | ||
371 | kfree(new_bus); | ||
372 | |||
373 | return err; | ||
374 | } | ||
375 | |||
376 | |||
377 | static int fs_enet_mdio_remove(struct device *dev) | ||
378 | { | ||
379 | struct mii_bus *bus = dev_get_drvdata(dev); | ||
380 | |||
381 | mdiobus_unregister(bus); | ||
382 | |||
383 | dev_set_drvdata(dev, NULL); | ||
384 | |||
385 | iounmap((void *) (&bus->priv)); | ||
386 | bus->priv = NULL; | ||
387 | kfree(bus); | ||
388 | |||
389 | return 0; | ||
390 | } | ||
391 | |||
392 | static struct device_driver fs_enet_bb_mdio_driver = { | ||
393 | .name = "fsl-bb-mdio", | ||
394 | .bus = &platform_bus_type, | ||
395 | .probe = fs_enet_mdio_probe, | ||
396 | .remove = fs_enet_mdio_remove, | ||
397 | }; | ||
398 | |||
399 | int fs_enet_mdio_bb_init(void) | ||
400 | { | ||
401 | return driver_register(&fs_enet_bb_mdio_driver); | ||
402 | } | ||
403 | |||
404 | void fs_enet_mdio_bb_exit(void) | ||
405 | { | ||
406 | driver_unregister(&fs_enet_bb_mdio_driver); | ||
407 | } | ||
408 | |||
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c new file mode 100644 index 000000000000..1328e10caa35 --- /dev/null +++ b/drivers/net/fs_enet/mii-fec.c | |||
@@ -0,0 +1,243 @@ | |||
1 | /* | ||
2 | * Combined Ethernet driver for Motorola MPC8xx and MPC82xx. | ||
3 | * | ||
4 | * Copyright (c) 2003 Intracom S.A. | ||
5 | * by Pantelis Antoniou <panto@intracom.gr> | ||
6 | * | ||
7 | * 2005 (c) MontaVista Software, Inc. | ||
8 | * Vitaly Bordug <vbordug@ru.mvista.com> | ||
9 | * | ||
10 | * This file is licensed under the terms of the GNU General Public License | ||
11 | * version 2. This program is licensed "as is" without any warranty of any | ||
12 | * kind, whether express or implied. | ||
13 | */ | ||
14 | |||
15 | |||
16 | #include <linux/config.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/types.h> | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/sched.h> | ||
21 | #include <linux/string.h> | ||
22 | #include <linux/ptrace.h> | ||
23 | #include <linux/errno.h> | ||
24 | #include <linux/ioport.h> | ||
25 | #include <linux/slab.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/pci.h> | ||
28 | #include <linux/init.h> | ||
29 | #include <linux/delay.h> | ||
30 | #include <linux/netdevice.h> | ||
31 | #include <linux/etherdevice.h> | ||
32 | #include <linux/skbuff.h> | ||
33 | #include <linux/spinlock.h> | ||
34 | #include <linux/mii.h> | ||
35 | #include <linux/ethtool.h> | ||
36 | #include <linux/bitops.h> | ||
37 | #include <linux/platform_device.h> | ||
38 | |||
39 | #include <asm/pgtable.h> | ||
40 | #include <asm/irq.h> | ||
41 | #include <asm/uaccess.h> | ||
42 | |||
43 | #include "fs_enet.h" | ||
44 | #include "fec.h" | ||
45 | |||
46 | /* Make MII read/write commands for the FEC. | ||
47 | */ | ||
48 | #define mk_mii_read(REG) (0x60020000 | ((REG & 0x1f) << 18)) | ||
49 | #define mk_mii_write(REG, VAL) (0x50020000 | ((REG & 0x1f) << 18) | (VAL & 0xffff)) | ||
50 | #define mk_mii_end 0 | ||
51 | |||
52 | #define FEC_MII_LOOPS 10000 | ||
53 | |||
54 | static int match_has_phy (struct device *dev, void* data) | ||
55 | { | ||
56 | struct platform_device* pdev = container_of(dev, struct platform_device, dev); | ||
57 | struct fs_platform_info* fpi; | ||
58 | if(strcmp(pdev->name, (char*)data)) | ||
59 | { | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | fpi = pdev->dev.platform_data; | ||
64 | if((fpi)&&(fpi->has_phy)) | ||
65 | return 1; | ||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static int fs_mii_fec_init(struct fec_info* fec, struct fs_mii_fec_platform_info *fmpi) | ||
70 | { | ||
71 | struct resource *r; | ||
72 | fec_t *fecp; | ||
73 | char* name = "fsl-cpm-fec"; | ||
74 | |||
75 | /* we need fec in order to be useful */ | ||
76 | struct platform_device *fec_pdev = | ||
77 | container_of(bus_find_device(&platform_bus_type, NULL, name, match_has_phy), | ||
78 | struct platform_device, dev); | ||
79 | |||
80 | if(fec_pdev == NULL) { | ||
81 | printk(KERN_ERR"Unable to find PHY for %s", name); | ||
82 | return -ENODEV; | ||
83 | } | ||
84 | |||
85 | r = platform_get_resource_byname(fec_pdev, IORESOURCE_MEM, "regs"); | ||
86 | |||
87 | fec->fecp = fecp = (fec_t*)ioremap(r->start,sizeof(fec_t)); | ||
88 | fec->mii_speed = fmpi->mii_speed; | ||
89 | |||
90 | setbits32(&fecp->fec_r_cntrl, FEC_RCNTRL_MII_MODE); /* MII enable */ | ||
91 | setbits32(&fecp->fec_ecntrl, FEC_ECNTRL_PINMUX | FEC_ECNTRL_ETHER_EN); | ||
92 | out_be32(&fecp->fec_ievent, FEC_ENET_MII); | ||
93 | out_be32(&fecp->fec_mii_speed, fec->mii_speed); | ||
94 | |||
95 | return 0; | ||
96 | } | ||
97 | |||
98 | static int fs_enet_fec_mii_read(struct mii_bus *bus , int phy_id, int location) | ||
99 | { | ||
100 | struct fec_info* fec = bus->priv; | ||
101 | fec_t *fecp = fec->fecp; | ||
102 | int i, ret = -1; | ||
103 | |||
104 | if ((in_be32(&fecp->fec_r_cntrl) & FEC_RCNTRL_MII_MODE) == 0) | ||
105 | BUG(); | ||
106 | |||
107 | /* Add PHY address to register command. */ | ||
108 | out_be32(&fecp->fec_mii_data, (phy_id << 23) | mk_mii_read(location)); | ||
109 | |||
110 | for (i = 0; i < FEC_MII_LOOPS; i++) | ||
111 | if ((in_be32(&fecp->fec_ievent) & FEC_ENET_MII) != 0) | ||
112 | break; | ||
113 | |||
114 | if (i < FEC_MII_LOOPS) { | ||
115 | out_be32(&fecp->fec_ievent, FEC_ENET_MII); | ||
116 | ret = in_be32(&fecp->fec_mii_data) & 0xffff; | ||
117 | } | ||
118 | |||
119 | return ret; | ||
120 | |||
121 | } | ||
122 | |||
123 | static int fs_enet_fec_mii_write(struct mii_bus *bus, int phy_id, int location, u16 val) | ||
124 | { | ||
125 | struct fec_info* fec = bus->priv; | ||
126 | fec_t *fecp = fec->fecp; | ||
127 | int i; | ||
128 | |||
129 | /* this must never happen */ | ||
130 | if ((in_be32(&fecp->fec_r_cntrl) & FEC_RCNTRL_MII_MODE) == 0) | ||
131 | BUG(); | ||
132 | |||
133 | /* Add PHY address to register command. */ | ||
134 | out_be32(&fecp->fec_mii_data, (phy_id << 23) | mk_mii_write(location, val)); | ||
135 | |||
136 | for (i = 0; i < FEC_MII_LOOPS; i++) | ||
137 | if ((in_be32(&fecp->fec_ievent) & FEC_ENET_MII) != 0) | ||
138 | break; | ||
139 | |||
140 | if (i < FEC_MII_LOOPS) | ||
141 | out_be32(&fecp->fec_ievent, FEC_ENET_MII); | ||
142 | |||
143 | return 0; | ||
144 | |||
145 | } | ||
146 | |||
147 | static int fs_enet_fec_mii_reset(struct mii_bus *bus) | ||
148 | { | ||
149 | /* nothing here - for now */ | ||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | static int __devinit fs_enet_fec_mdio_probe(struct device *dev) | ||
154 | { | ||
155 | struct platform_device *pdev = to_platform_device(dev); | ||
156 | struct fs_mii_fec_platform_info *pdata; | ||
157 | struct mii_bus *new_bus; | ||
158 | struct fec_info *fec; | ||
159 | int err = 0; | ||
160 | if (NULL == dev) | ||
161 | return -EINVAL; | ||
162 | new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL); | ||
163 | |||
164 | if (NULL == new_bus) | ||
165 | return -ENOMEM; | ||
166 | |||
167 | fec = kzalloc(sizeof(struct fec_info), GFP_KERNEL); | ||
168 | |||
169 | if (NULL == fec) | ||
170 | return -ENOMEM; | ||
171 | |||
172 | new_bus->name = "FEC MII Bus", | ||
173 | new_bus->read = &fs_enet_fec_mii_read, | ||
174 | new_bus->write = &fs_enet_fec_mii_write, | ||
175 | new_bus->reset = &fs_enet_fec_mii_reset, | ||
176 | new_bus->id = pdev->id; | ||
177 | |||
178 | pdata = (struct fs_mii_fec_platform_info *)pdev->dev.platform_data; | ||
179 | |||
180 | if (NULL == pdata) { | ||
181 | printk(KERN_ERR "fs_enet FEC mdio %d: Missing platform data!\n", pdev->id); | ||
182 | return -ENODEV; | ||
183 | } | ||
184 | |||
185 | /*set up workspace*/ | ||
186 | |||
187 | fs_mii_fec_init(fec, pdata); | ||
188 | new_bus->priv = fec; | ||
189 | |||
190 | new_bus->irq = pdata->irq; | ||
191 | |||
192 | new_bus->dev = dev; | ||
193 | dev_set_drvdata(dev, new_bus); | ||
194 | |||
195 | err = mdiobus_register(new_bus); | ||
196 | |||
197 | if (0 != err) { | ||
198 | printk (KERN_ERR "%s: Cannot register as MDIO bus\n", | ||
199 | new_bus->name); | ||
200 | goto bus_register_fail; | ||
201 | } | ||
202 | |||
203 | return 0; | ||
204 | |||
205 | bus_register_fail: | ||
206 | kfree(new_bus); | ||
207 | |||
208 | return err; | ||
209 | } | ||
210 | |||
211 | |||
212 | static int fs_enet_fec_mdio_remove(struct device *dev) | ||
213 | { | ||
214 | struct mii_bus *bus = dev_get_drvdata(dev); | ||
215 | |||
216 | mdiobus_unregister(bus); | ||
217 | |||
218 | dev_set_drvdata(dev, NULL); | ||
219 | kfree(bus->priv); | ||
220 | |||
221 | bus->priv = NULL; | ||
222 | kfree(bus); | ||
223 | |||
224 | return 0; | ||
225 | } | ||
226 | |||
227 | static struct device_driver fs_enet_fec_mdio_driver = { | ||
228 | .name = "fsl-cpm-fec-mdio", | ||
229 | .bus = &platform_bus_type, | ||
230 | .probe = fs_enet_fec_mdio_probe, | ||
231 | .remove = fs_enet_fec_mdio_remove, | ||
232 | }; | ||
233 | |||
234 | int fs_enet_mdio_fec_init(void) | ||
235 | { | ||
236 | return driver_register(&fs_enet_fec_mdio_driver); | ||
237 | } | ||
238 | |||
239 | void fs_enet_mdio_fec_exit(void) | ||
240 | { | ||
241 | driver_unregister(&fs_enet_fec_mdio_driver); | ||
242 | } | ||
243 | |||
diff --git a/drivers/net/fs_enet/mii-fixed.c b/drivers/net/fs_enet/mii-fixed.c deleted file mode 100644 index ae4a9c3bb393..000000000000 --- a/drivers/net/fs_enet/mii-fixed.c +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | /* | ||
2 | * Combined Ethernet driver for Motorola MPC8xx and MPC82xx. | ||
3 | * | ||
4 | * Copyright (c) 2003 Intracom S.A. | ||
5 | * by Pantelis Antoniou <panto@intracom.gr> | ||
6 | * | ||
7 | * 2005 (c) MontaVista Software, Inc. | ||
8 | * Vitaly Bordug <vbordug@ru.mvista.com> | ||
9 | * | ||
10 | * This file is licensed under the terms of the GNU General Public License | ||
11 | * version 2. This program is licensed "as is" without any warranty of any | ||
12 | * kind, whether express or implied. | ||
13 | */ | ||
14 | |||
15 | |||
16 | #include <linux/module.h> | ||
17 | #include <linux/types.h> | ||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/sched.h> | ||
20 | #include <linux/string.h> | ||
21 | #include <linux/ptrace.h> | ||
22 | #include <linux/errno.h> | ||
23 | #include <linux/ioport.h> | ||
24 | #include <linux/slab.h> | ||
25 | #include <linux/interrupt.h> | ||
26 | #include <linux/pci.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/delay.h> | ||
29 | #include <linux/netdevice.h> | ||
30 | #include <linux/etherdevice.h> | ||
31 | #include <linux/skbuff.h> | ||
32 | #include <linux/spinlock.h> | ||
33 | #include <linux/mii.h> | ||
34 | #include <linux/ethtool.h> | ||
35 | #include <linux/bitops.h> | ||
36 | |||
37 | #include <asm/pgtable.h> | ||
38 | #include <asm/irq.h> | ||
39 | #include <asm/uaccess.h> | ||
40 | |||
41 | #include "fs_enet.h" | ||
42 | |||
43 | static const u16 mii_regs[7] = { | ||
44 | 0x3100, | ||
45 | 0x786d, | ||
46 | 0x0fff, | ||
47 | 0x0fff, | ||
48 | 0x01e1, | ||
49 | 0x45e1, | ||
50 | 0x0003, | ||
51 | }; | ||
52 | |||
53 | static int mii_read(struct fs_enet_mii_bus *bus, int phy_id, int location) | ||
54 | { | ||
55 | int ret = 0; | ||
56 | |||
57 | if ((unsigned int)location >= ARRAY_SIZE(mii_regs)) | ||
58 | return -1; | ||
59 | |||
60 | if (location != 5) | ||
61 | ret = mii_regs[location]; | ||
62 | else | ||
63 | ret = bus->fixed.lpa; | ||
64 | |||
65 | return ret; | ||
66 | } | ||
67 | |||
68 | static void mii_write(struct fs_enet_mii_bus *bus, int phy_id, int location, int val) | ||
69 | { | ||
70 | /* do nothing */ | ||
71 | } | ||
72 | |||
73 | int fs_mii_fixed_init(struct fs_enet_mii_bus *bus) | ||
74 | { | ||
75 | const struct fs_mii_bus_info *bi = bus->bus_info; | ||
76 | |||
77 | bus->fixed.lpa = 0x45e1; /* default 100Mb, full duplex */ | ||
78 | |||
79 | /* if speed is fixed at 10Mb, remove 100Mb modes */ | ||
80 | if (bi->i.fixed.speed == 10) | ||
81 | bus->fixed.lpa &= ~LPA_100; | ||
82 | |||
83 | /* if duplex is half, remove full duplex modes */ | ||
84 | if (bi->i.fixed.duplex == 0) | ||
85 | bus->fixed.lpa &= ~LPA_DUPLEX; | ||
86 | |||
87 | bus->mii_read = mii_read; | ||
88 | bus->mii_write = mii_write; | ||
89 | |||
90 | return 0; | ||
91 | } | ||
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index e7d9bf330287..ff5a67d619bb 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c | |||
@@ -111,7 +111,6 @@ | |||
111 | #include <linux/etherdevice.h> | 111 | #include <linux/etherdevice.h> |
112 | #include <linux/skbuff.h> | 112 | #include <linux/skbuff.h> |
113 | #include <linux/types.h> | 113 | #include <linux/types.h> |
114 | #include <linux/config.h> /* for CONFIG_PCI */ | ||
115 | #include <linux/delay.h> | 114 | #include <linux/delay.h> |
116 | #include <linux/init.h> | 115 | #include <linux/init.h> |
117 | #include <linux/bitops.h> | 116 | #include <linux/bitops.h> |
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c index 47f6f64d604c..415ba8dc94ce 100644 --- a/drivers/net/irda/mcs7780.c +++ b/drivers/net/irda/mcs7780.c | |||
@@ -45,7 +45,6 @@ | |||
45 | 45 | ||
46 | #include <linux/module.h> | 46 | #include <linux/module.h> |
47 | #include <linux/moduleparam.h> | 47 | #include <linux/moduleparam.h> |
48 | #include <linux/config.h> | ||
49 | #include <linux/kernel.h> | 48 | #include <linux/kernel.h> |
50 | #include <linux/types.h> | 49 | #include <linux/types.h> |
51 | #include <linux/errno.h> | 50 | #include <linux/errno.h> |
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c index 0ea65c4c6f85..b69776e00951 100644 --- a/drivers/net/irda/w83977af_ir.c +++ b/drivers/net/irda/w83977af_ir.c | |||
@@ -40,7 +40,6 @@ | |||
40 | ********************************************************************/ | 40 | ********************************************************************/ |
41 | 41 | ||
42 | #include <linux/module.h> | 42 | #include <linux/module.h> |
43 | #include <linux/config.h> | ||
44 | #include <linux/kernel.h> | 43 | #include <linux/kernel.h> |
45 | #include <linux/types.h> | 44 | #include <linux/types.h> |
46 | #include <linux/skbuff.h> | 45 | #include <linux/skbuff.h> |
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index b1cf8522d8fc..346273d42f97 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -162,7 +162,7 @@ ixgb_init_module(void) | |||
162 | 162 | ||
163 | printk(KERN_INFO "%s\n", ixgb_copyright); | 163 | printk(KERN_INFO "%s\n", ixgb_copyright); |
164 | 164 | ||
165 | return pci_module_init(&ixgb_driver); | 165 | return pci_register_driver(&ixgb_driver); |
166 | } | 166 | } |
167 | 167 | ||
168 | module_init(ixgb_init_module); | 168 | module_init(ixgb_init_module); |
diff --git a/drivers/net/lance.c b/drivers/net/lance.c index c1c3452c90ca..5b4dbfe5fb77 100644 --- a/drivers/net/lance.c +++ b/drivers/net/lance.c | |||
@@ -326,7 +326,7 @@ MODULE_PARM_DESC(dma, "LANCE/PCnet ISA DMA channel (ignored for some devices)"); | |||
326 | MODULE_PARM_DESC(irq, "LANCE/PCnet IRQ number (ignored for some devices)"); | 326 | MODULE_PARM_DESC(irq, "LANCE/PCnet IRQ number (ignored for some devices)"); |
327 | MODULE_PARM_DESC(lance_debug, "LANCE/PCnet debug level (0-7)"); | 327 | MODULE_PARM_DESC(lance_debug, "LANCE/PCnet debug level (0-7)"); |
328 | 328 | ||
329 | int init_module(void) | 329 | int __init init_module(void) |
330 | { | 330 | { |
331 | struct net_device *dev; | 331 | struct net_device *dev; |
332 | int this_dev, found = 0; | 332 | int this_dev, found = 0; |
diff --git a/drivers/net/lne390.c b/drivers/net/lne390.c index 646e89fc3562..c0ec7f6abcb2 100644 --- a/drivers/net/lne390.c +++ b/drivers/net/lne390.c | |||
@@ -406,7 +406,7 @@ MODULE_PARM_DESC(mem, "memory base address(es)"); | |||
406 | MODULE_DESCRIPTION("Mylex LNE390A/B EISA Ethernet driver"); | 406 | MODULE_DESCRIPTION("Mylex LNE390A/B EISA Ethernet driver"); |
407 | MODULE_LICENSE("GPL"); | 407 | MODULE_LICENSE("GPL"); |
408 | 408 | ||
409 | int init_module(void) | 409 | int __init init_module(void) |
410 | { | 410 | { |
411 | struct net_device *dev; | 411 | struct net_device *dev; |
412 | int this_dev, found = 0; | 412 | int this_dev, found = 0; |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index 9bdd43ab3573..e2346e8a4d52 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -187,11 +187,14 @@ struct myri10ge_priv { | |||
187 | u8 mac_addr[6]; /* eeprom mac address */ | 187 | u8 mac_addr[6]; /* eeprom mac address */ |
188 | unsigned long serial_number; | 188 | unsigned long serial_number; |
189 | int vendor_specific_offset; | 189 | int vendor_specific_offset; |
190 | int fw_multicast_support; | ||
190 | u32 devctl; | 191 | u32 devctl; |
191 | u16 msi_flags; | 192 | u16 msi_flags; |
192 | u32 read_dma; | 193 | u32 read_dma; |
193 | u32 write_dma; | 194 | u32 write_dma; |
194 | u32 read_write_dma; | 195 | u32 read_write_dma; |
196 | u32 link_changes; | ||
197 | u32 msg_enable; | ||
195 | }; | 198 | }; |
196 | 199 | ||
197 | static char *myri10ge_fw_unaligned = "myri10ge_ethp_z8e.dat"; | 200 | static char *myri10ge_fw_unaligned = "myri10ge_ethp_z8e.dat"; |
@@ -257,6 +260,12 @@ module_param(myri10ge_max_irq_loops, int, S_IRUGO); | |||
257 | MODULE_PARM_DESC(myri10ge_max_irq_loops, | 260 | MODULE_PARM_DESC(myri10ge_max_irq_loops, |
258 | "Set stuck legacy IRQ detection threshold\n"); | 261 | "Set stuck legacy IRQ detection threshold\n"); |
259 | 262 | ||
263 | #define MYRI10GE_MSG_DEFAULT NETIF_MSG_LINK | ||
264 | |||
265 | static int myri10ge_debug = -1; /* defaults above */ | ||
266 | module_param(myri10ge_debug, int, 0); | ||
267 | MODULE_PARM_DESC(myri10ge_debug, "Debug level (0=none,...,16=all)"); | ||
268 | |||
260 | #define MYRI10GE_FW_OFFSET 1024*1024 | 269 | #define MYRI10GE_FW_OFFSET 1024*1024 |
261 | #define MYRI10GE_HIGHPART_TO_U32(X) \ | 270 | #define MYRI10GE_HIGHPART_TO_U32(X) \ |
262 | (sizeof (X) == 8) ? ((u32)((u64)(X) >> 32)) : (0) | 271 | (sizeof (X) == 8) ? ((u32)((u64)(X) >> 32)) : (0) |
@@ -271,7 +280,7 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd, | |||
271 | struct mcp_cmd *buf; | 280 | struct mcp_cmd *buf; |
272 | char buf_bytes[sizeof(*buf) + 8]; | 281 | char buf_bytes[sizeof(*buf) + 8]; |
273 | struct mcp_cmd_response *response = mgp->cmd; | 282 | struct mcp_cmd_response *response = mgp->cmd; |
274 | char __iomem *cmd_addr = mgp->sram + MXGEFW_CMD_OFFSET; | 283 | char __iomem *cmd_addr = mgp->sram + MXGEFW_ETH_CMD; |
275 | u32 dma_low, dma_high, result, value; | 284 | u32 dma_low, dma_high, result, value; |
276 | int sleep_total = 0; | 285 | int sleep_total = 0; |
277 | 286 | ||
@@ -320,6 +329,8 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd, | |||
320 | if (result == 0) { | 329 | if (result == 0) { |
321 | data->data0 = value; | 330 | data->data0 = value; |
322 | return 0; | 331 | return 0; |
332 | } else if (result == MXGEFW_CMD_UNKNOWN) { | ||
333 | return -ENOSYS; | ||
323 | } else { | 334 | } else { |
324 | dev_err(&mgp->pdev->dev, | 335 | dev_err(&mgp->pdev->dev, |
325 | "command %d failed, result = %d\n", | 336 | "command %d failed, result = %d\n", |
@@ -404,7 +415,7 @@ static void myri10ge_dummy_rdma(struct myri10ge_priv *mgp, int enable) | |||
404 | buf[4] = htonl(dma_low); /* dummy addr LSW */ | 415 | buf[4] = htonl(dma_low); /* dummy addr LSW */ |
405 | buf[5] = htonl(enable); /* enable? */ | 416 | buf[5] = htonl(enable); /* enable? */ |
406 | 417 | ||
407 | submit = mgp->sram + 0xfc01c0; | 418 | submit = mgp->sram + MXGEFW_BOOT_DUMMY_RDMA; |
408 | 419 | ||
409 | myri10ge_pio_copy(submit, &buf, sizeof(buf)); | 420 | myri10ge_pio_copy(submit, &buf, sizeof(buf)); |
410 | for (i = 0; mgp->cmd->data != MYRI10GE_NO_CONFIRM_DATA && i < 20; i++) | 421 | for (i = 0; mgp->cmd->data != MYRI10GE_NO_CONFIRM_DATA && i < 20; i++) |
@@ -600,7 +611,7 @@ static int myri10ge_load_firmware(struct myri10ge_priv *mgp) | |||
600 | buf[5] = htonl(8); /* where to copy to */ | 611 | buf[5] = htonl(8); /* where to copy to */ |
601 | buf[6] = htonl(0); /* where to jump to */ | 612 | buf[6] = htonl(0); /* where to jump to */ |
602 | 613 | ||
603 | submit = mgp->sram + 0xfc0000; | 614 | submit = mgp->sram + MXGEFW_BOOT_HANDOFF; |
604 | 615 | ||
605 | myri10ge_pio_copy(submit, &buf, sizeof(buf)); | 616 | myri10ge_pio_copy(submit, &buf, sizeof(buf)); |
606 | mb(); | 617 | mb(); |
@@ -764,6 +775,7 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
764 | mgp->rx_small.cnt = 0; | 775 | mgp->rx_small.cnt = 0; |
765 | mgp->rx_done.idx = 0; | 776 | mgp->rx_done.idx = 0; |
766 | mgp->rx_done.cnt = 0; | 777 | mgp->rx_done.cnt = 0; |
778 | mgp->link_changes = 0; | ||
767 | status = myri10ge_update_mac_address(mgp, mgp->dev->dev_addr); | 779 | status = myri10ge_update_mac_address(mgp, mgp->dev->dev_addr); |
768 | myri10ge_change_promisc(mgp, 0, 0); | 780 | myri10ge_change_promisc(mgp, 0, 0); |
769 | myri10ge_change_pause(mgp, mgp->pause); | 781 | myri10ge_change_pause(mgp, mgp->pause); |
@@ -798,12 +810,13 @@ myri10ge_submit_8rx(struct mcp_kreq_ether_recv __iomem * dst, | |||
798 | * pages directly and building a fraglist in the near future. | 810 | * pages directly and building a fraglist in the near future. |
799 | */ | 811 | */ |
800 | 812 | ||
801 | static inline struct sk_buff *myri10ge_alloc_big(int bytes) | 813 | static inline struct sk_buff *myri10ge_alloc_big(struct net_device *dev, |
814 | int bytes) | ||
802 | { | 815 | { |
803 | struct sk_buff *skb; | 816 | struct sk_buff *skb; |
804 | unsigned long data, roundup; | 817 | unsigned long data, roundup; |
805 | 818 | ||
806 | skb = dev_alloc_skb(bytes + 4096 + MXGEFW_PAD); | 819 | skb = netdev_alloc_skb(dev, bytes + 4096 + MXGEFW_PAD); |
807 | if (skb == NULL) | 820 | if (skb == NULL) |
808 | return NULL; | 821 | return NULL; |
809 | 822 | ||
@@ -821,12 +834,13 @@ static inline struct sk_buff *myri10ge_alloc_big(int bytes) | |||
821 | 834 | ||
822 | /* Allocate 2x as much space as required and use whichever portion | 835 | /* Allocate 2x as much space as required and use whichever portion |
823 | * does not cross a 4KB boundary */ | 836 | * does not cross a 4KB boundary */ |
824 | static inline struct sk_buff *myri10ge_alloc_small_safe(unsigned int bytes) | 837 | static inline struct sk_buff *myri10ge_alloc_small_safe(struct net_device *dev, |
838 | unsigned int bytes) | ||
825 | { | 839 | { |
826 | struct sk_buff *skb; | 840 | struct sk_buff *skb; |
827 | unsigned long data, boundary; | 841 | unsigned long data, boundary; |
828 | 842 | ||
829 | skb = dev_alloc_skb(2 * (bytes + MXGEFW_PAD) - 1); | 843 | skb = netdev_alloc_skb(dev, 2 * (bytes + MXGEFW_PAD) - 1); |
830 | if (unlikely(skb == NULL)) | 844 | if (unlikely(skb == NULL)) |
831 | return NULL; | 845 | return NULL; |
832 | 846 | ||
@@ -847,12 +861,13 @@ static inline struct sk_buff *myri10ge_alloc_small_safe(unsigned int bytes) | |||
847 | 861 | ||
848 | /* Allocate just enough space, and verify that the allocated | 862 | /* Allocate just enough space, and verify that the allocated |
849 | * space does not cross a 4KB boundary */ | 863 | * space does not cross a 4KB boundary */ |
850 | static inline struct sk_buff *myri10ge_alloc_small(int bytes) | 864 | static inline struct sk_buff *myri10ge_alloc_small(struct net_device *dev, |
865 | int bytes) | ||
851 | { | 866 | { |
852 | struct sk_buff *skb; | 867 | struct sk_buff *skb; |
853 | unsigned long roundup, data, end; | 868 | unsigned long roundup, data, end; |
854 | 869 | ||
855 | skb = dev_alloc_skb(bytes + 16 + MXGEFW_PAD); | 870 | skb = netdev_alloc_skb(dev, bytes + 16 + MXGEFW_PAD); |
856 | if (unlikely(skb == NULL)) | 871 | if (unlikely(skb == NULL)) |
857 | return NULL; | 872 | return NULL; |
858 | 873 | ||
@@ -868,15 +883,17 @@ static inline struct sk_buff *myri10ge_alloc_small(int bytes) | |||
868 | "myri10ge_alloc_small: small skb crossed 4KB boundary\n"); | 883 | "myri10ge_alloc_small: small skb crossed 4KB boundary\n"); |
869 | myri10ge_skb_cross_4k = 1; | 884 | myri10ge_skb_cross_4k = 1; |
870 | dev_kfree_skb_any(skb); | 885 | dev_kfree_skb_any(skb); |
871 | skb = myri10ge_alloc_small_safe(bytes); | 886 | skb = myri10ge_alloc_small_safe(dev, bytes); |
872 | } | 887 | } |
873 | return skb; | 888 | return skb; |
874 | } | 889 | } |
875 | 890 | ||
876 | static inline int | 891 | static inline int |
877 | myri10ge_getbuf(struct myri10ge_rx_buf *rx, struct pci_dev *pdev, int bytes, | 892 | myri10ge_getbuf(struct myri10ge_rx_buf *rx, struct myri10ge_priv *mgp, |
878 | int idx) | 893 | int bytes, int idx) |
879 | { | 894 | { |
895 | struct net_device *dev = mgp->dev; | ||
896 | struct pci_dev *pdev = mgp->pdev; | ||
880 | struct sk_buff *skb; | 897 | struct sk_buff *skb; |
881 | dma_addr_t bus; | 898 | dma_addr_t bus; |
882 | int len, retval = 0; | 899 | int len, retval = 0; |
@@ -884,11 +901,11 @@ myri10ge_getbuf(struct myri10ge_rx_buf *rx, struct pci_dev *pdev, int bytes, | |||
884 | bytes += VLAN_HLEN; /* account for 802.1q vlan tag */ | 901 | bytes += VLAN_HLEN; /* account for 802.1q vlan tag */ |
885 | 902 | ||
886 | if ((bytes + MXGEFW_PAD) > (4096 - 16) /* linux overhead */ ) | 903 | if ((bytes + MXGEFW_PAD) > (4096 - 16) /* linux overhead */ ) |
887 | skb = myri10ge_alloc_big(bytes); | 904 | skb = myri10ge_alloc_big(dev, bytes); |
888 | else if (myri10ge_skb_cross_4k) | 905 | else if (myri10ge_skb_cross_4k) |
889 | skb = myri10ge_alloc_small_safe(bytes); | 906 | skb = myri10ge_alloc_small_safe(dev, bytes); |
890 | else | 907 | else |
891 | skb = myri10ge_alloc_small(bytes); | 908 | skb = myri10ge_alloc_small(dev, bytes); |
892 | 909 | ||
893 | if (unlikely(skb == NULL)) { | 910 | if (unlikely(skb == NULL)) { |
894 | rx->alloc_fail++; | 911 | rx->alloc_fail++; |
@@ -951,7 +968,7 @@ myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx, | |||
951 | unmap_len = pci_unmap_len(&rx->info[idx], len); | 968 | unmap_len = pci_unmap_len(&rx->info[idx], len); |
952 | 969 | ||
953 | /* try to replace the received skb */ | 970 | /* try to replace the received skb */ |
954 | if (myri10ge_getbuf(rx, mgp->pdev, bytes, idx)) { | 971 | if (myri10ge_getbuf(rx, mgp, bytes, idx)) { |
955 | /* drop the frame -- the old skbuf is re-cycled */ | 972 | /* drop the frame -- the old skbuf is re-cycled */ |
956 | mgp->stats.rx_dropped += 1; | 973 | mgp->stats.rx_dropped += 1; |
957 | return 0; | 974 | return 0; |
@@ -968,7 +985,6 @@ myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx, | |||
968 | skb_put(skb, len); | 985 | skb_put(skb, len); |
969 | 986 | ||
970 | skb->protocol = eth_type_trans(skb, mgp->dev); | 987 | skb->protocol = eth_type_trans(skb, mgp->dev); |
971 | skb->dev = mgp->dev; | ||
972 | if (mgp->csum_flag) { | 988 | if (mgp->csum_flag) { |
973 | if ((skb->protocol == ntohs(ETH_P_IP)) || | 989 | if ((skb->protocol == ntohs(ETH_P_IP)) || |
974 | (skb->protocol == ntohs(ETH_P_IPV6))) { | 990 | (skb->protocol == ntohs(ETH_P_IPV6))) { |
@@ -1081,13 +1097,19 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp) | |||
1081 | if (mgp->link_state != stats->link_up) { | 1097 | if (mgp->link_state != stats->link_up) { |
1082 | mgp->link_state = stats->link_up; | 1098 | mgp->link_state = stats->link_up; |
1083 | if (mgp->link_state) { | 1099 | if (mgp->link_state) { |
1084 | printk(KERN_INFO "myri10ge: %s: link up\n", | 1100 | if (netif_msg_link(mgp)) |
1085 | mgp->dev->name); | 1101 | printk(KERN_INFO |
1102 | "myri10ge: %s: link up\n", | ||
1103 | mgp->dev->name); | ||
1086 | netif_carrier_on(mgp->dev); | 1104 | netif_carrier_on(mgp->dev); |
1105 | mgp->link_changes++; | ||
1087 | } else { | 1106 | } else { |
1088 | printk(KERN_INFO "myri10ge: %s: link down\n", | 1107 | if (netif_msg_link(mgp)) |
1089 | mgp->dev->name); | 1108 | printk(KERN_INFO |
1109 | "myri10ge: %s: link down\n", | ||
1110 | mgp->dev->name); | ||
1090 | netif_carrier_off(mgp->dev); | 1111 | netif_carrier_off(mgp->dev); |
1112 | mgp->link_changes++; | ||
1091 | } | 1113 | } |
1092 | } | 1114 | } |
1093 | if (mgp->rdma_tags_available != | 1115 | if (mgp->rdma_tags_available != |
@@ -1289,7 +1311,8 @@ static const char myri10ge_gstrings_stats[][ETH_GSTRING_LEN] = { | |||
1289 | "serial_number", "tx_pkt_start", "tx_pkt_done", | 1311 | "serial_number", "tx_pkt_start", "tx_pkt_done", |
1290 | "tx_req", "tx_done", "rx_small_cnt", "rx_big_cnt", | 1312 | "tx_req", "tx_done", "rx_small_cnt", "rx_big_cnt", |
1291 | "wake_queue", "stop_queue", "watchdog_resets", "tx_linearized", | 1313 | "wake_queue", "stop_queue", "watchdog_resets", "tx_linearized", |
1292 | "link_up", "dropped_link_overflow", "dropped_link_error_or_filtered", | 1314 | "link_changes", "link_up", "dropped_link_overflow", |
1315 | "dropped_link_error_or_filtered", "dropped_multicast_filtered", | ||
1293 | "dropped_runt", "dropped_overrun", "dropped_no_small_buffer", | 1316 | "dropped_runt", "dropped_overrun", "dropped_no_small_buffer", |
1294 | "dropped_no_big_buffer" | 1317 | "dropped_no_big_buffer" |
1295 | }; | 1318 | }; |
@@ -1341,16 +1364,31 @@ myri10ge_get_ethtool_stats(struct net_device *netdev, | |||
1341 | data[i++] = (unsigned int)mgp->stop_queue; | 1364 | data[i++] = (unsigned int)mgp->stop_queue; |
1342 | data[i++] = (unsigned int)mgp->watchdog_resets; | 1365 | data[i++] = (unsigned int)mgp->watchdog_resets; |
1343 | data[i++] = (unsigned int)mgp->tx_linearized; | 1366 | data[i++] = (unsigned int)mgp->tx_linearized; |
1367 | data[i++] = (unsigned int)mgp->link_changes; | ||
1344 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->link_up); | 1368 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->link_up); |
1345 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_link_overflow); | 1369 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_link_overflow); |
1346 | data[i++] = | 1370 | data[i++] = |
1347 | (unsigned int)ntohl(mgp->fw_stats->dropped_link_error_or_filtered); | 1371 | (unsigned int)ntohl(mgp->fw_stats->dropped_link_error_or_filtered); |
1372 | data[i++] = | ||
1373 | (unsigned int)ntohl(mgp->fw_stats->dropped_multicast_filtered); | ||
1348 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_runt); | 1374 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_runt); |
1349 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_overrun); | 1375 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_overrun); |
1350 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_no_small_buffer); | 1376 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_no_small_buffer); |
1351 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_no_big_buffer); | 1377 | data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_no_big_buffer); |
1352 | } | 1378 | } |
1353 | 1379 | ||
1380 | static void myri10ge_set_msglevel(struct net_device *netdev, u32 value) | ||
1381 | { | ||
1382 | struct myri10ge_priv *mgp = netdev_priv(netdev); | ||
1383 | mgp->msg_enable = value; | ||
1384 | } | ||
1385 | |||
1386 | static u32 myri10ge_get_msglevel(struct net_device *netdev) | ||
1387 | { | ||
1388 | struct myri10ge_priv *mgp = netdev_priv(netdev); | ||
1389 | return mgp->msg_enable; | ||
1390 | } | ||
1391 | |||
1354 | static struct ethtool_ops myri10ge_ethtool_ops = { | 1392 | static struct ethtool_ops myri10ge_ethtool_ops = { |
1355 | .get_settings = myri10ge_get_settings, | 1393 | .get_settings = myri10ge_get_settings, |
1356 | .get_drvinfo = myri10ge_get_drvinfo, | 1394 | .get_drvinfo = myri10ge_get_drvinfo, |
@@ -1371,7 +1409,9 @@ static struct ethtool_ops myri10ge_ethtool_ops = { | |||
1371 | #endif | 1409 | #endif |
1372 | .get_strings = myri10ge_get_strings, | 1410 | .get_strings = myri10ge_get_strings, |
1373 | .get_stats_count = myri10ge_get_stats_count, | 1411 | .get_stats_count = myri10ge_get_stats_count, |
1374 | .get_ethtool_stats = myri10ge_get_ethtool_stats | 1412 | .get_ethtool_stats = myri10ge_get_ethtool_stats, |
1413 | .set_msglevel = myri10ge_set_msglevel, | ||
1414 | .get_msglevel = myri10ge_get_msglevel | ||
1375 | }; | 1415 | }; |
1376 | 1416 | ||
1377 | static int myri10ge_allocate_rings(struct net_device *dev) | 1417 | static int myri10ge_allocate_rings(struct net_device *dev) |
@@ -1439,7 +1479,7 @@ static int myri10ge_allocate_rings(struct net_device *dev) | |||
1439 | /* Fill the receive rings */ | 1479 | /* Fill the receive rings */ |
1440 | 1480 | ||
1441 | for (i = 0; i <= mgp->rx_small.mask; i++) { | 1481 | for (i = 0; i <= mgp->rx_small.mask; i++) { |
1442 | status = myri10ge_getbuf(&mgp->rx_small, mgp->pdev, | 1482 | status = myri10ge_getbuf(&mgp->rx_small, mgp, |
1443 | mgp->small_bytes, i); | 1483 | mgp->small_bytes, i); |
1444 | if (status) { | 1484 | if (status) { |
1445 | printk(KERN_ERR | 1485 | printk(KERN_ERR |
@@ -1451,8 +1491,7 @@ static int myri10ge_allocate_rings(struct net_device *dev) | |||
1451 | 1491 | ||
1452 | for (i = 0; i <= mgp->rx_big.mask; i++) { | 1492 | for (i = 0; i <= mgp->rx_big.mask; i++) { |
1453 | status = | 1493 | status = |
1454 | myri10ge_getbuf(&mgp->rx_big, mgp->pdev, | 1494 | myri10ge_getbuf(&mgp->rx_big, mgp, dev->mtu + ETH_HLEN, i); |
1455 | dev->mtu + ETH_HLEN, i); | ||
1456 | if (status) { | 1495 | if (status) { |
1457 | printk(KERN_ERR | 1496 | printk(KERN_ERR |
1458 | "myri10ge: %s: alloced only %d big bufs\n", | 1497 | "myri10ge: %s: alloced only %d big bufs\n", |
@@ -1648,9 +1687,11 @@ static int myri10ge_open(struct net_device *dev) | |||
1648 | } | 1687 | } |
1649 | 1688 | ||
1650 | if (mgp->mtrr >= 0) { | 1689 | if (mgp->mtrr >= 0) { |
1651 | mgp->tx.wc_fifo = (u8 __iomem *) mgp->sram + 0x200000; | 1690 | mgp->tx.wc_fifo = (u8 __iomem *) mgp->sram + MXGEFW_ETH_SEND_4; |
1652 | mgp->rx_small.wc_fifo = (u8 __iomem *) mgp->sram + 0x300000; | 1691 | mgp->rx_small.wc_fifo = |
1653 | mgp->rx_big.wc_fifo = (u8 __iomem *) mgp->sram + 0x340000; | 1692 | (u8 __iomem *) mgp->sram + MXGEFW_ETH_RECV_SMALL; |
1693 | mgp->rx_big.wc_fifo = | ||
1694 | (u8 __iomem *) mgp->sram + MXGEFW_ETH_RECV_BIG; | ||
1654 | } else { | 1695 | } else { |
1655 | mgp->tx.wc_fifo = NULL; | 1696 | mgp->tx.wc_fifo = NULL; |
1656 | mgp->rx_small.wc_fifo = NULL; | 1697 | mgp->rx_small.wc_fifo = NULL; |
@@ -1686,7 +1727,21 @@ static int myri10ge_open(struct net_device *dev) | |||
1686 | 1727 | ||
1687 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->fw_stats_bus); | 1728 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->fw_stats_bus); |
1688 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->fw_stats_bus); | 1729 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->fw_stats_bus); |
1689 | status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_STATS_DMA, &cmd, 0); | 1730 | cmd.data2 = sizeof(struct mcp_irq_data); |
1731 | status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_STATS_DMA_V2, &cmd, 0); | ||
1732 | if (status == -ENOSYS) { | ||
1733 | dma_addr_t bus = mgp->fw_stats_bus; | ||
1734 | bus += offsetof(struct mcp_irq_data, send_done_count); | ||
1735 | cmd.data0 = MYRI10GE_LOWPART_TO_U32(bus); | ||
1736 | cmd.data1 = MYRI10GE_HIGHPART_TO_U32(bus); | ||
1737 | status = myri10ge_send_cmd(mgp, | ||
1738 | MXGEFW_CMD_SET_STATS_DMA_OBSOLETE, | ||
1739 | &cmd, 0); | ||
1740 | /* Firmware cannot support multicast without STATS_DMA_V2 */ | ||
1741 | mgp->fw_multicast_support = 0; | ||
1742 | } else { | ||
1743 | mgp->fw_multicast_support = 1; | ||
1744 | } | ||
1690 | if (status) { | 1745 | if (status) { |
1691 | printk(KERN_ERR "myri10ge: %s: Couldn't set stats DMA\n", | 1746 | printk(KERN_ERR "myri10ge: %s: Couldn't set stats DMA\n", |
1692 | dev->name); | 1747 | dev->name); |
@@ -1841,7 +1896,8 @@ myri10ge_submit_req_wc(struct myri10ge_tx_buf *tx, | |||
1841 | if (cnt > 0) { | 1896 | if (cnt > 0) { |
1842 | /* pad it to 64 bytes. The src is 64 bytes bigger than it | 1897 | /* pad it to 64 bytes. The src is 64 bytes bigger than it |
1843 | * needs to be so that we don't overrun it */ | 1898 | * needs to be so that we don't overrun it */ |
1844 | myri10ge_pio_copy(tx->wc_fifo + (cnt << 18), src, 64); | 1899 | myri10ge_pio_copy(tx->wc_fifo + MXGEFW_ETH_SEND_OFFSET(cnt), |
1900 | src, 64); | ||
1845 | mb(); | 1901 | mb(); |
1846 | } | 1902 | } |
1847 | } | 1903 | } |
@@ -2140,9 +2196,81 @@ static struct net_device_stats *myri10ge_get_stats(struct net_device *dev) | |||
2140 | 2196 | ||
2141 | static void myri10ge_set_multicast_list(struct net_device *dev) | 2197 | static void myri10ge_set_multicast_list(struct net_device *dev) |
2142 | { | 2198 | { |
2199 | struct myri10ge_cmd cmd; | ||
2200 | struct myri10ge_priv *mgp; | ||
2201 | struct dev_mc_list *mc_list; | ||
2202 | int err; | ||
2203 | |||
2204 | mgp = netdev_priv(dev); | ||
2143 | /* can be called from atomic contexts, | 2205 | /* can be called from atomic contexts, |
2144 | * pass 1 to force atomicity in myri10ge_send_cmd() */ | 2206 | * pass 1 to force atomicity in myri10ge_send_cmd() */ |
2145 | myri10ge_change_promisc(netdev_priv(dev), dev->flags & IFF_PROMISC, 1); | 2207 | myri10ge_change_promisc(mgp, dev->flags & IFF_PROMISC, 1); |
2208 | |||
2209 | /* This firmware is known to not support multicast */ | ||
2210 | if (!mgp->fw_multicast_support) | ||
2211 | return; | ||
2212 | |||
2213 | /* Disable multicast filtering */ | ||
2214 | |||
2215 | err = myri10ge_send_cmd(mgp, MXGEFW_ENABLE_ALLMULTI, &cmd, 1); | ||
2216 | if (err != 0) { | ||
2217 | printk(KERN_ERR "myri10ge: %s: Failed MXGEFW_ENABLE_ALLMULTI," | ||
2218 | " error status: %d\n", dev->name, err); | ||
2219 | goto abort; | ||
2220 | } | ||
2221 | |||
2222 | if (dev->flags & IFF_ALLMULTI) { | ||
2223 | /* request to disable multicast filtering, so quit here */ | ||
2224 | return; | ||
2225 | } | ||
2226 | |||
2227 | /* Flush the filters */ | ||
2228 | |||
2229 | err = myri10ge_send_cmd(mgp, MXGEFW_LEAVE_ALL_MULTICAST_GROUPS, | ||
2230 | &cmd, 1); | ||
2231 | if (err != 0) { | ||
2232 | printk(KERN_ERR | ||
2233 | "myri10ge: %s: Failed MXGEFW_LEAVE_ALL_MULTICAST_GROUPS" | ||
2234 | ", error status: %d\n", dev->name, err); | ||
2235 | goto abort; | ||
2236 | } | ||
2237 | |||
2238 | /* Walk the multicast list, and add each address */ | ||
2239 | for (mc_list = dev->mc_list; mc_list != NULL; mc_list = mc_list->next) { | ||
2240 | memcpy(&cmd.data0, &mc_list->dmi_addr, 4); | ||
2241 | memcpy(&cmd.data1, ((char *)&mc_list->dmi_addr) + 4, 2); | ||
2242 | cmd.data0 = htonl(cmd.data0); | ||
2243 | cmd.data1 = htonl(cmd.data1); | ||
2244 | err = myri10ge_send_cmd(mgp, MXGEFW_JOIN_MULTICAST_GROUP, | ||
2245 | &cmd, 1); | ||
2246 | |||
2247 | if (err != 0) { | ||
2248 | printk(KERN_ERR "myri10ge: %s: Failed " | ||
2249 | "MXGEFW_JOIN_MULTICAST_GROUP, error status:" | ||
2250 | "%d\t", dev->name, err); | ||
2251 | printk(KERN_ERR "MAC %02x:%02x:%02x:%02x:%02x:%02x\n", | ||
2252 | ((unsigned char *)&mc_list->dmi_addr)[0], | ||
2253 | ((unsigned char *)&mc_list->dmi_addr)[1], | ||
2254 | ((unsigned char *)&mc_list->dmi_addr)[2], | ||
2255 | ((unsigned char *)&mc_list->dmi_addr)[3], | ||
2256 | ((unsigned char *)&mc_list->dmi_addr)[4], | ||
2257 | ((unsigned char *)&mc_list->dmi_addr)[5] | ||
2258 | ); | ||
2259 | goto abort; | ||
2260 | } | ||
2261 | } | ||
2262 | /* Enable multicast filtering */ | ||
2263 | err = myri10ge_send_cmd(mgp, MXGEFW_DISABLE_ALLMULTI, &cmd, 1); | ||
2264 | if (err != 0) { | ||
2265 | printk(KERN_ERR "myri10ge: %s: Failed MXGEFW_DISABLE_ALLMULTI," | ||
2266 | "error status: %d\n", dev->name, err); | ||
2267 | goto abort; | ||
2268 | } | ||
2269 | |||
2270 | return; | ||
2271 | |||
2272 | abort: | ||
2273 | return; | ||
2146 | } | 2274 | } |
2147 | 2275 | ||
2148 | static int myri10ge_set_mac_address(struct net_device *dev, void *addr) | 2276 | static int myri10ge_set_mac_address(struct net_device *dev, void *addr) |
@@ -2581,6 +2709,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2581 | mgp->csum_flag = MXGEFW_FLAGS_CKSUM; | 2709 | mgp->csum_flag = MXGEFW_FLAGS_CKSUM; |
2582 | mgp->pause = myri10ge_flow_control; | 2710 | mgp->pause = myri10ge_flow_control; |
2583 | mgp->intr_coal_delay = myri10ge_intr_coal_delay; | 2711 | mgp->intr_coal_delay = myri10ge_intr_coal_delay; |
2712 | mgp->msg_enable = netif_msg_init(myri10ge_debug, MYRI10GE_MSG_DEFAULT); | ||
2584 | init_waitqueue_head(&mgp->down_wq); | 2713 | init_waitqueue_head(&mgp->down_wq); |
2585 | 2714 | ||
2586 | if (pci_enable_device(pdev)) { | 2715 | if (pci_enable_device(pdev)) { |
diff --git a/drivers/net/myri10ge/myri10ge_mcp.h b/drivers/net/myri10ge/myri10ge_mcp.h index 0a6cae6cb186..9519ae7cd5ec 100644 --- a/drivers/net/myri10ge/myri10ge_mcp.h +++ b/drivers/net/myri10ge/myri10ge_mcp.h | |||
@@ -91,7 +91,19 @@ struct mcp_kreq_ether_recv { | |||
91 | 91 | ||
92 | /* Commands */ | 92 | /* Commands */ |
93 | 93 | ||
94 | #define MXGEFW_CMD_OFFSET 0xf80000 | 94 | #define MXGEFW_BOOT_HANDOFF 0xfc0000 |
95 | #define MXGEFW_BOOT_DUMMY_RDMA 0xfc01c0 | ||
96 | |||
97 | #define MXGEFW_ETH_CMD 0xf80000 | ||
98 | #define MXGEFW_ETH_SEND_4 0x200000 | ||
99 | #define MXGEFW_ETH_SEND_1 0x240000 | ||
100 | #define MXGEFW_ETH_SEND_2 0x280000 | ||
101 | #define MXGEFW_ETH_SEND_3 0x2c0000 | ||
102 | #define MXGEFW_ETH_RECV_SMALL 0x300000 | ||
103 | #define MXGEFW_ETH_RECV_BIG 0x340000 | ||
104 | |||
105 | #define MXGEFW_ETH_SEND(n) (0x200000 + (((n) & 0x03) * 0x40000)) | ||
106 | #define MXGEFW_ETH_SEND_OFFSET(n) (MXGEFW_ETH_SEND(n) - MXGEFW_ETH_SEND_4) | ||
95 | 107 | ||
96 | enum myri10ge_mcp_cmd_type { | 108 | enum myri10ge_mcp_cmd_type { |
97 | MXGEFW_CMD_NONE = 0, | 109 | MXGEFW_CMD_NONE = 0, |
@@ -154,7 +166,7 @@ enum myri10ge_mcp_cmd_type { | |||
154 | MXGEFW_CMD_SET_MTU, | 166 | MXGEFW_CMD_SET_MTU, |
155 | MXGEFW_CMD_GET_INTR_COAL_DELAY_OFFSET, /* in microseconds */ | 167 | MXGEFW_CMD_GET_INTR_COAL_DELAY_OFFSET, /* in microseconds */ |
156 | MXGEFW_CMD_SET_STATS_INTERVAL, /* in microseconds */ | 168 | MXGEFW_CMD_SET_STATS_INTERVAL, /* in microseconds */ |
157 | MXGEFW_CMD_SET_STATS_DMA, | 169 | MXGEFW_CMD_SET_STATS_DMA_OBSOLETE, /* replaced by SET_STATS_DMA_V2 */ |
158 | 170 | ||
159 | MXGEFW_ENABLE_PROMISC, | 171 | MXGEFW_ENABLE_PROMISC, |
160 | MXGEFW_DISABLE_PROMISC, | 172 | MXGEFW_DISABLE_PROMISC, |
@@ -168,7 +180,26 @@ enum myri10ge_mcp_cmd_type { | |||
168 | * data2 = RDMA length (MSH), WDMA length (LSH) | 180 | * data2 = RDMA length (MSH), WDMA length (LSH) |
169 | * command return data = repetitions (MSH), 0.5-ms ticks (LSH) | 181 | * command return data = repetitions (MSH), 0.5-ms ticks (LSH) |
170 | */ | 182 | */ |
171 | MXGEFW_DMA_TEST | 183 | MXGEFW_DMA_TEST, |
184 | |||
185 | MXGEFW_ENABLE_ALLMULTI, | ||
186 | MXGEFW_DISABLE_ALLMULTI, | ||
187 | |||
188 | /* returns MXGEFW_CMD_ERROR_MULTICAST | ||
189 | * if there is no room in the cache | ||
190 | * data0,MSH(data1) = multicast group address */ | ||
191 | MXGEFW_JOIN_MULTICAST_GROUP, | ||
192 | /* returns MXGEFW_CMD_ERROR_MULTICAST | ||
193 | * if the address is not in the cache, | ||
194 | * or is equal to FF-FF-FF-FF-FF-FF | ||
195 | * data0,MSH(data1) = multicast group address */ | ||
196 | MXGEFW_LEAVE_MULTICAST_GROUP, | ||
197 | MXGEFW_LEAVE_ALL_MULTICAST_GROUPS, | ||
198 | |||
199 | MXGEFW_CMD_SET_STATS_DMA_V2, | ||
200 | /* data0, data1 = bus addr, | ||
201 | * data2 = sizeof(struct mcp_irq_data) from driver point of view, allows | ||
202 | * adding new stuff to mcp_irq_data without changing the ABI */ | ||
172 | }; | 203 | }; |
173 | 204 | ||
174 | enum myri10ge_mcp_cmd_status { | 205 | enum myri10ge_mcp_cmd_status { |
@@ -180,11 +211,17 @@ enum myri10ge_mcp_cmd_status { | |||
180 | MXGEFW_CMD_ERROR_CLOSED, | 211 | MXGEFW_CMD_ERROR_CLOSED, |
181 | MXGEFW_CMD_ERROR_HASH_ERROR, | 212 | MXGEFW_CMD_ERROR_HASH_ERROR, |
182 | MXGEFW_CMD_ERROR_BAD_PORT, | 213 | MXGEFW_CMD_ERROR_BAD_PORT, |
183 | MXGEFW_CMD_ERROR_RESOURCES | 214 | MXGEFW_CMD_ERROR_RESOURCES, |
215 | MXGEFW_CMD_ERROR_MULTICAST | ||
184 | }; | 216 | }; |
185 | 217 | ||
186 | /* 40 Bytes */ | 218 | #define MXGEFW_OLD_IRQ_DATA_LEN 40 |
219 | |||
187 | struct mcp_irq_data { | 220 | struct mcp_irq_data { |
221 | /* add new counters at the beginning */ | ||
222 | u32 future_use[5]; | ||
223 | u32 dropped_multicast_filtered; | ||
224 | /* 40 Bytes */ | ||
188 | u32 send_done_count; | 225 | u32 send_done_count; |
189 | 226 | ||
190 | u32 link_up; | 227 | u32 link_up; |
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index db0475a1102f..9510030feeb4 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
@@ -3246,7 +3246,7 @@ static int __init natsemi_init_mod (void) | |||
3246 | printk(version); | 3246 | printk(version); |
3247 | #endif | 3247 | #endif |
3248 | 3248 | ||
3249 | return pci_module_init (&natsemi_driver); | 3249 | return pci_register_driver(&natsemi_driver); |
3250 | } | 3250 | } |
3251 | 3251 | ||
3252 | static void __exit natsemi_exit_mod (void) | 3252 | static void __exit natsemi_exit_mod (void) |
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c index 34bdba9eec79..654b477b570a 100644 --- a/drivers/net/ne2k-pci.c +++ b/drivers/net/ne2k-pci.c | |||
@@ -702,7 +702,7 @@ static int __init ne2k_pci_init(void) | |||
702 | #ifdef MODULE | 702 | #ifdef MODULE |
703 | printk(version); | 703 | printk(version); |
704 | #endif | 704 | #endif |
705 | return pci_module_init (&ne2k_driver); | 705 | return pci_register_driver(&ne2k_driver); |
706 | } | 706 | } |
707 | 707 | ||
708 | 708 | ||
diff --git a/drivers/net/netx-eth.c b/drivers/net/netx-eth.c index b1311ae82675..30ed9a5a40e0 100644 --- a/drivers/net/netx-eth.c +++ b/drivers/net/netx-eth.c | |||
@@ -17,7 +17,6 @@ | |||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/config.h> | ||
21 | #include <linux/init.h> | 20 | #include <linux/init.h> |
22 | #include <linux/module.h> | 21 | #include <linux/module.h> |
23 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
diff --git a/drivers/net/ni52.c b/drivers/net/ni52.c index fa854c8fde75..4d52ecf8af56 100644 --- a/drivers/net/ni52.c +++ b/drivers/net/ni52.c | |||
@@ -1323,7 +1323,7 @@ MODULE_PARM_DESC(irq, "NI5210 IRQ number,required"); | |||
1323 | MODULE_PARM_DESC(memstart, "NI5210 memory base address,required"); | 1323 | MODULE_PARM_DESC(memstart, "NI5210 memory base address,required"); |
1324 | MODULE_PARM_DESC(memend, "NI5210 memory end address,required"); | 1324 | MODULE_PARM_DESC(memend, "NI5210 memory end address,required"); |
1325 | 1325 | ||
1326 | int init_module(void) | 1326 | int __init init_module(void) |
1327 | { | 1327 | { |
1328 | if(io <= 0x0 || !memend || !memstart || irq < 2) { | 1328 | if(io <= 0x0 || !memend || !memstart || irq < 2) { |
1329 | printk("ni52: Autoprobing not allowed for modules.\nni52: Set symbols 'io' 'irq' 'memstart' and 'memend'\n"); | 1329 | printk("ni52: Autoprobing not allowed for modules.\nni52: Set symbols 'io' 'irq' 'memstart' and 'memend'\n"); |
diff --git a/drivers/net/ni65.c b/drivers/net/ni65.c index bb42ff218484..810cc572f5f7 100644 --- a/drivers/net/ni65.c +++ b/drivers/net/ni65.c | |||
@@ -1253,7 +1253,7 @@ MODULE_PARM_DESC(irq, "ni6510 IRQ number (ignored for some cards)"); | |||
1253 | MODULE_PARM_DESC(io, "ni6510 I/O base address"); | 1253 | MODULE_PARM_DESC(io, "ni6510 I/O base address"); |
1254 | MODULE_PARM_DESC(dma, "ni6510 ISA DMA channel (ignored for some cards)"); | 1254 | MODULE_PARM_DESC(dma, "ni6510 ISA DMA channel (ignored for some cards)"); |
1255 | 1255 | ||
1256 | int init_module(void) | 1256 | int __init init_module(void) |
1257 | { | 1257 | { |
1258 | dev_ni65 = ni65_probe(-1); | 1258 | dev_ni65 = ni65_probe(-1); |
1259 | return IS_ERR(dev_ni65) ? PTR_ERR(dev_ni65) : 0; | 1259 | return IS_ERR(dev_ni65) ? PTR_ERR(dev_ni65) : 0; |
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index 0e76859c90a2..0dedd34804c3 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c | |||
@@ -2178,7 +2178,7 @@ static struct pci_driver driver = { | |||
2178 | static int __init ns83820_init(void) | 2178 | static int __init ns83820_init(void) |
2179 | { | 2179 | { |
2180 | printk(KERN_INFO "ns83820.c: National Semiconductor DP83820 10/100/1000 driver.\n"); | 2180 | printk(KERN_INFO "ns83820.c: National Semiconductor DP83820 10/100/1000 driver.\n"); |
2181 | return pci_module_init(&driver); | 2181 | return pci_register_driver(&driver); |
2182 | } | 2182 | } |
2183 | 2183 | ||
2184 | static void __exit ns83820_exit(void) | 2184 | static void __exit ns83820_exit(void) |
diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c index e0e293964042..e6347620529e 100644 --- a/drivers/net/pci-skeleton.c +++ b/drivers/net/pci-skeleton.c | |||
@@ -1963,7 +1963,7 @@ static int __init netdrv_init_module (void) | |||
1963 | #ifdef MODULE | 1963 | #ifdef MODULE |
1964 | printk(version); | 1964 | printk(version); |
1965 | #endif | 1965 | #endif |
1966 | return pci_module_init (&netdrv_pci_driver); | 1966 | return pci_register_driver(&netdrv_pci_driver); |
1967 | } | 1967 | } |
1968 | 1968 | ||
1969 | 1969 | ||
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 297e9f805366..c54f6a7ebf31 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -771,6 +771,7 @@ static struct pcmcia_device_id axnet_ids[] = { | |||
771 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0309), | 771 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0309), |
772 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1106), | 772 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1106), |
773 | PCMCIA_DEVICE_MANF_CARD(0x8a01, 0xc1ab), | 773 | PCMCIA_DEVICE_MANF_CARD(0x8a01, 0xc1ab), |
774 | PCMCIA_DEVICE_MANF_CARD(0x021b, 0x0202), | ||
774 | PCMCIA_DEVICE_PROD_ID12("AmbiCom,Inc.", "Fast Ethernet PC Card(AMB8110)", 0x49b020a7, 0x119cc9fc), | 775 | PCMCIA_DEVICE_PROD_ID12("AmbiCom,Inc.", "Fast Ethernet PC Card(AMB8110)", 0x49b020a7, 0x119cc9fc), |
775 | PCMCIA_DEVICE_PROD_ID124("Fast Ethernet", "16-bit PC Card", "AX88190", 0xb4be14e3, 0x9a12eb6a, 0xab9be5ef), | 776 | PCMCIA_DEVICE_PROD_ID124("Fast Ethernet", "16-bit PC Card", "AX88190", 0xb4be14e3, 0x9a12eb6a, 0xab9be5ef), |
776 | PCMCIA_DEVICE_PROD_ID12("ASIX", "AX88190", 0x0959823b, 0xab9be5ef), | 777 | PCMCIA_DEVICE_PROD_ID12("ASIX", "AX88190", 0x0959823b, 0xab9be5ef), |
@@ -786,8 +787,6 @@ static struct pcmcia_device_id axnet_ids[] = { | |||
786 | PCMCIA_DEVICE_PROD_ID12("PCMCIA", "FastEtherCard", 0x281f1c5d, 0x7ef26116), | 787 | PCMCIA_DEVICE_PROD_ID12("PCMCIA", "FastEtherCard", 0x281f1c5d, 0x7ef26116), |
787 | PCMCIA_DEVICE_PROD_ID12("PCMCIA", "FEP501", 0x281f1c5d, 0x2e272058), | 788 | PCMCIA_DEVICE_PROD_ID12("PCMCIA", "FEP501", 0x281f1c5d, 0x2e272058), |
788 | PCMCIA_DEVICE_PROD_ID14("Network Everywhere", "AX88190", 0x820a67b6, 0xab9be5ef), | 789 | PCMCIA_DEVICE_PROD_ID14("Network Everywhere", "AX88190", 0x820a67b6, 0xab9be5ef), |
789 | /* this is not specific enough */ | ||
790 | /* PCMCIA_DEVICE_MANF_CARD(0x021b, 0x0202), */ | ||
791 | PCMCIA_DEVICE_NULL, | 790 | PCMCIA_DEVICE_NULL, |
792 | }; | 791 | }; |
793 | MODULE_DEVICE_TABLE(pcmcia, axnet_ids); | 792 | MODULE_DEVICE_TABLE(pcmcia, axnet_ids); |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 0ecebfc31f07..cc0dcc9bf636 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -654,11 +654,8 @@ static int pcnet_config(struct pcmcia_device *link) | |||
654 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 654 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
655 | 655 | ||
656 | if (info->flags & (IS_DL10019|IS_DL10022)) { | 656 | if (info->flags & (IS_DL10019|IS_DL10022)) { |
657 | u_char id = inb(dev->base_addr + 0x1a); | ||
658 | dev->do_ioctl = &ei_ioctl; | 657 | dev->do_ioctl = &ei_ioctl; |
659 | mii_phy_probe(dev); | 658 | mii_phy_probe(dev); |
660 | if ((id == 0x30) && !info->pna_phy && (info->eth_phy == 4)) | ||
661 | info->eth_phy = 0; | ||
662 | } | 659 | } |
663 | 660 | ||
664 | link->dev_node = &info->node; | 661 | link->dev_node = &info->node; |
@@ -821,15 +818,6 @@ static void mdio_write(kio_addr_t addr, int phy_id, int loc, int value) | |||
821 | } | 818 | } |
822 | } | 819 | } |
823 | 820 | ||
824 | static void mdio_reset(kio_addr_t addr, int phy_id) | ||
825 | { | ||
826 | outb_p(0x08, addr); | ||
827 | outb_p(0x0c, addr); | ||
828 | outb_p(0x08, addr); | ||
829 | outb_p(0x0c, addr); | ||
830 | outb_p(0x00, addr); | ||
831 | } | ||
832 | |||
833 | /*====================================================================== | 821 | /*====================================================================== |
834 | 822 | ||
835 | EEPROM access routines for DL10019 and DL10022 based cards | 823 | EEPROM access routines for DL10019 and DL10022 based cards |
@@ -942,7 +930,8 @@ static void set_misc_reg(struct net_device *dev) | |||
942 | } | 930 | } |
943 | if (info->flags & IS_DL10022) { | 931 | if (info->flags & IS_DL10022) { |
944 | if (info->flags & HAS_MII) { | 932 | if (info->flags & HAS_MII) { |
945 | mdio_reset(nic_base + DLINK_GPIO, info->eth_phy); | 933 | /* Advertise 100F, 100H, 10F, 10H */ |
934 | mdio_write(nic_base + DLINK_GPIO, info->eth_phy, 4, 0x01e1); | ||
946 | /* Restart MII autonegotiation */ | 935 | /* Restart MII autonegotiation */ |
947 | mdio_write(nic_base + DLINK_GPIO, info->eth_phy, 0, 0x0000); | 936 | mdio_write(nic_base + DLINK_GPIO, info->eth_phy, 0, 0x0000); |
948 | mdio_write(nic_base + DLINK_GPIO, info->eth_phy, 0, 0x1200); | 937 | mdio_write(nic_base + DLINK_GPIO, info->eth_phy, 0, 0x1200); |
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 9bae77ce1314..4122bb46f5ff 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -345,6 +345,7 @@ typedef struct local_info_t { | |||
345 | void __iomem *dingo_ccr; /* only used for CEM56 cards */ | 345 | void __iomem *dingo_ccr; /* only used for CEM56 cards */ |
346 | unsigned last_ptr_value; /* last packets transmitted value */ | 346 | unsigned last_ptr_value; /* last packets transmitted value */ |
347 | const char *manf_str; | 347 | const char *manf_str; |
348 | struct work_struct tx_timeout_task; | ||
348 | } local_info_t; | 349 | } local_info_t; |
349 | 350 | ||
350 | /**************** | 351 | /**************** |
@@ -352,6 +353,7 @@ typedef struct local_info_t { | |||
352 | */ | 353 | */ |
353 | static int do_start_xmit(struct sk_buff *skb, struct net_device *dev); | 354 | static int do_start_xmit(struct sk_buff *skb, struct net_device *dev); |
354 | static void do_tx_timeout(struct net_device *dev); | 355 | static void do_tx_timeout(struct net_device *dev); |
356 | static void xirc2ps_tx_timeout_task(void *data); | ||
355 | static struct net_device_stats *do_get_stats(struct net_device *dev); | 357 | static struct net_device_stats *do_get_stats(struct net_device *dev); |
356 | static void set_addresses(struct net_device *dev); | 358 | static void set_addresses(struct net_device *dev); |
357 | static void set_multicast_list(struct net_device *dev); | 359 | static void set_multicast_list(struct net_device *dev); |
@@ -589,6 +591,7 @@ xirc2ps_probe(struct pcmcia_device *link) | |||
589 | #ifdef HAVE_TX_TIMEOUT | 591 | #ifdef HAVE_TX_TIMEOUT |
590 | dev->tx_timeout = do_tx_timeout; | 592 | dev->tx_timeout = do_tx_timeout; |
591 | dev->watchdog_timeo = TX_TIMEOUT; | 593 | dev->watchdog_timeo = TX_TIMEOUT; |
594 | INIT_WORK(&local->tx_timeout_task, xirc2ps_tx_timeout_task, dev); | ||
592 | #endif | 595 | #endif |
593 | 596 | ||
594 | return xirc2ps_config(link); | 597 | return xirc2ps_config(link); |
@@ -1341,17 +1344,24 @@ xirc2ps_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1341 | /*====================================================================*/ | 1344 | /*====================================================================*/ |
1342 | 1345 | ||
1343 | static void | 1346 | static void |
1344 | do_tx_timeout(struct net_device *dev) | 1347 | xirc2ps_tx_timeout_task(void *data) |
1345 | { | 1348 | { |
1346 | local_info_t *lp = netdev_priv(dev); | 1349 | struct net_device *dev = data; |
1347 | printk(KERN_NOTICE "%s: transmit timed out\n", dev->name); | ||
1348 | lp->stats.tx_errors++; | ||
1349 | /* reset the card */ | 1350 | /* reset the card */ |
1350 | do_reset(dev,1); | 1351 | do_reset(dev,1); |
1351 | dev->trans_start = jiffies; | 1352 | dev->trans_start = jiffies; |
1352 | netif_wake_queue(dev); | 1353 | netif_wake_queue(dev); |
1353 | } | 1354 | } |
1354 | 1355 | ||
1356 | static void | ||
1357 | do_tx_timeout(struct net_device *dev) | ||
1358 | { | ||
1359 | local_info_t *lp = netdev_priv(dev); | ||
1360 | lp->stats.tx_errors++; | ||
1361 | printk(KERN_NOTICE "%s: transmit timed out\n", dev->name); | ||
1362 | schedule_work(&lp->tx_timeout_task); | ||
1363 | } | ||
1364 | |||
1355 | static int | 1365 | static int |
1356 | do_start_xmit(struct sk_buff *skb, struct net_device *dev) | 1366 | do_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1357 | { | 1367 | { |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 4daafe303358..5e26fe806e21 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -202,6 +202,8 @@ static int homepna[MAX_UNITS]; | |||
202 | #define CSR15 15 | 202 | #define CSR15 15 |
203 | #define PCNET32_MC_FILTER 8 | 203 | #define PCNET32_MC_FILTER 8 |
204 | 204 | ||
205 | #define PCNET32_79C970A 0x2621 | ||
206 | |||
205 | /* The PCNET32 Rx and Tx ring descriptors. */ | 207 | /* The PCNET32 Rx and Tx ring descriptors. */ |
206 | struct pcnet32_rx_head { | 208 | struct pcnet32_rx_head { |
207 | u32 base; | 209 | u32 base; |
@@ -289,6 +291,7 @@ struct pcnet32_private { | |||
289 | 291 | ||
290 | /* each bit indicates an available PHY */ | 292 | /* each bit indicates an available PHY */ |
291 | u32 phymask; | 293 | u32 phymask; |
294 | unsigned short chip_version; /* which variant this is */ | ||
292 | }; | 295 | }; |
293 | 296 | ||
294 | static int pcnet32_probe_pci(struct pci_dev *, const struct pci_device_id *); | 297 | static int pcnet32_probe_pci(struct pci_dev *, const struct pci_device_id *); |
@@ -724,9 +727,11 @@ static u32 pcnet32_get_link(struct net_device *dev) | |||
724 | spin_lock_irqsave(&lp->lock, flags); | 727 | spin_lock_irqsave(&lp->lock, flags); |
725 | if (lp->mii) { | 728 | if (lp->mii) { |
726 | r = mii_link_ok(&lp->mii_if); | 729 | r = mii_link_ok(&lp->mii_if); |
727 | } else { | 730 | } else if (lp->chip_version >= PCNET32_79C970A) { |
728 | ulong ioaddr = dev->base_addr; /* card base I/O address */ | 731 | ulong ioaddr = dev->base_addr; /* card base I/O address */ |
729 | r = (lp->a.read_bcr(ioaddr, 4) != 0xc0); | 732 | r = (lp->a.read_bcr(ioaddr, 4) != 0xc0); |
733 | } else { /* can not detect link on really old chips */ | ||
734 | r = 1; | ||
730 | } | 735 | } |
731 | spin_unlock_irqrestore(&lp->lock, flags); | 736 | spin_unlock_irqrestore(&lp->lock, flags); |
732 | 737 | ||
@@ -1091,6 +1096,10 @@ static int pcnet32_suspend(struct net_device *dev, unsigned long *flags, | |||
1091 | ulong ioaddr = dev->base_addr; | 1096 | ulong ioaddr = dev->base_addr; |
1092 | int ticks; | 1097 | int ticks; |
1093 | 1098 | ||
1099 | /* really old chips have to be stopped. */ | ||
1100 | if (lp->chip_version < PCNET32_79C970A) | ||
1101 | return 0; | ||
1102 | |||
1094 | /* set SUSPEND (SPND) - CSR5 bit 0 */ | 1103 | /* set SUSPEND (SPND) - CSR5 bit 0 */ |
1095 | csr5 = a->read_csr(ioaddr, CSR5); | 1104 | csr5 = a->read_csr(ioaddr, CSR5); |
1096 | a->write_csr(ioaddr, CSR5, csr5 | CSR5_SUSPEND); | 1105 | a->write_csr(ioaddr, CSR5, csr5 | CSR5_SUSPEND); |
@@ -1529,6 +1538,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1529 | lp->mii_if.reg_num_mask = 0x1f; | 1538 | lp->mii_if.reg_num_mask = 0x1f; |
1530 | lp->dxsuflo = dxsuflo; | 1539 | lp->dxsuflo = dxsuflo; |
1531 | lp->mii = mii; | 1540 | lp->mii = mii; |
1541 | lp->chip_version = chip_version; | ||
1532 | lp->msg_enable = pcnet32_debug; | 1542 | lp->msg_enable = pcnet32_debug; |
1533 | if ((cards_found >= MAX_UNITS) | 1543 | if ((cards_found >= MAX_UNITS) |
1534 | || (options[cards_found] > sizeof(options_mapping))) | 1544 | || (options[cards_found] > sizeof(options_mapping))) |
@@ -1839,10 +1849,7 @@ static int pcnet32_open(struct net_device *dev) | |||
1839 | val |= 2; | 1849 | val |= 2; |
1840 | } else if (lp->options & PCNET32_PORT_ASEL) { | 1850 | } else if (lp->options & PCNET32_PORT_ASEL) { |
1841 | /* workaround of xSeries250, turn on for 79C975 only */ | 1851 | /* workaround of xSeries250, turn on for 79C975 only */ |
1842 | i = ((lp->a.read_csr(ioaddr, 88) | | 1852 | if (lp->chip_version == 0x2627) |
1843 | (lp->a. | ||
1844 | read_csr(ioaddr, 89) << 16)) >> 12) & 0xffff; | ||
1845 | if (i == 0x2627) | ||
1846 | val |= 3; | 1853 | val |= 3; |
1847 | } | 1854 | } |
1848 | lp->a.write_bcr(ioaddr, 9, val); | 1855 | lp->a.write_bcr(ioaddr, 9, val); |
@@ -1986,9 +1993,11 @@ static int pcnet32_open(struct net_device *dev) | |||
1986 | 1993 | ||
1987 | netif_start_queue(dev); | 1994 | netif_start_queue(dev); |
1988 | 1995 | ||
1989 | /* Print the link status and start the watchdog */ | 1996 | if (lp->chip_version >= PCNET32_79C970A) { |
1990 | pcnet32_check_media(dev, 1); | 1997 | /* Print the link status and start the watchdog */ |
1991 | mod_timer(&(lp->watchdog_timer), PCNET32_WATCHDOG_TIMEOUT); | 1998 | pcnet32_check_media(dev, 1); |
1999 | mod_timer(&(lp->watchdog_timer), PCNET32_WATCHDOG_TIMEOUT); | ||
2000 | } | ||
1992 | 2001 | ||
1993 | i = 0; | 2002 | i = 0; |
1994 | while (i++ < 100) | 2003 | while (i++ < 100) |
@@ -2969,7 +2978,7 @@ static int __init pcnet32_init_module(void) | |||
2969 | tx_start = tx_start_pt; | 2978 | tx_start = tx_start_pt; |
2970 | 2979 | ||
2971 | /* find the PCI devices */ | 2980 | /* find the PCI devices */ |
2972 | if (!pci_module_init(&pcnet32_driver)) | 2981 | if (!pci_register_driver(&pcnet32_driver)) |
2973 | pcnet32_have_pci = 1; | 2982 | pcnet32_have_pci = 1; |
2974 | 2983 | ||
2975 | /* should we find any remaining VLbus devices ? */ | 2984 | /* should we find any remaining VLbus devices ? */ |
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 2ba6d3a40e2e..b79ec0d7480f 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -56,5 +56,22 @@ config SMSC_PHY | |||
56 | ---help--- | 56 | ---help--- |
57 | Currently supports the LAN83C185 PHY | 57 | Currently supports the LAN83C185 PHY |
58 | 58 | ||
59 | config FIXED_PHY | ||
60 | tristate "Drivers for PHY emulation on fixed speed/link" | ||
61 | depends on PHYLIB | ||
62 | ---help--- | ||
63 | Adds the driver to PHY layer to cover the boards that do not have any PHY bound, | ||
64 | but with the ability to manipulate with speed/link in software. The relavant MII | ||
65 | speed/duplex parameters could be effectively handled in user-specified fuction. | ||
66 | Currently tested with mpc866ads. | ||
67 | |||
68 | config FIXED_MII_10_FDX | ||
69 | bool "Emulation for 10M Fdx fixed PHY behavior" | ||
70 | depends on FIXED_PHY | ||
71 | |||
72 | config FIXED_MII_100_FDX | ||
73 | bool "Emulation for 100M Fdx fixed PHY behavior" | ||
74 | depends on FIXED_PHY | ||
75 | |||
59 | endmenu | 76 | endmenu |
60 | 77 | ||
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index a00e61942525..320f8323123f 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile | |||
@@ -10,3 +10,4 @@ obj-$(CONFIG_LXT_PHY) += lxt.o | |||
10 | obj-$(CONFIG_QSEMI_PHY) += qsemi.o | 10 | obj-$(CONFIG_QSEMI_PHY) += qsemi.o |
11 | obj-$(CONFIG_SMSC_PHY) += smsc.o | 11 | obj-$(CONFIG_SMSC_PHY) += smsc.o |
12 | obj-$(CONFIG_VITESSE_PHY) += vitesse.o | 12 | obj-$(CONFIG_VITESSE_PHY) += vitesse.o |
13 | obj-$(CONFIG_FIXED_PHY) += fixed.o | ||
diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c new file mode 100644 index 000000000000..341036df4710 --- /dev/null +++ b/drivers/net/phy/fixed.c | |||
@@ -0,0 +1,358 @@ | |||
1 | /* | ||
2 | * drivers/net/phy/fixed.c | ||
3 | * | ||
4 | * Driver for fixed PHYs, when transceiver is able to operate in one fixed mode. | ||
5 | * | ||
6 | * Author: Vitaly Bordug | ||
7 | * | ||
8 | * Copyright (c) 2006 MontaVista Software, Inc. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the | ||
12 | * Free Software Foundation; either version 2 of the License, or (at your | ||
13 | * option) any later version. | ||
14 | * | ||
15 | */ | ||
16 | #include <linux/config.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/sched.h> | ||
19 | #include <linux/string.h> | ||
20 | #include <linux/errno.h> | ||
21 | #include <linux/unistd.h> | ||
22 | #include <linux/slab.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/delay.h> | ||
26 | #include <linux/netdevice.h> | ||
27 | #include <linux/etherdevice.h> | ||
28 | #include <linux/skbuff.h> | ||
29 | #include <linux/spinlock.h> | ||
30 | #include <linux/mm.h> | ||
31 | #include <linux/module.h> | ||
32 | #include <linux/mii.h> | ||
33 | #include <linux/ethtool.h> | ||
34 | #include <linux/phy.h> | ||
35 | |||
36 | #include <asm/io.h> | ||
37 | #include <asm/irq.h> | ||
38 | #include <asm/uaccess.h> | ||
39 | |||
40 | #define MII_REGS_NUM 7 | ||
41 | |||
42 | /* | ||
43 | The idea is to emulate normal phy behavior by responding with | ||
44 | pre-defined values to mii BMCR read, so that read_status hook could | ||
45 | take all the needed info. | ||
46 | */ | ||
47 | |||
48 | struct fixed_phy_status { | ||
49 | u8 link; | ||
50 | u16 speed; | ||
51 | u8 duplex; | ||
52 | }; | ||
53 | |||
54 | /*----------------------------------------------------------------------------- | ||
55 | * Private information hoder for mii_bus | ||
56 | *-----------------------------------------------------------------------------*/ | ||
57 | struct fixed_info { | ||
58 | u16 *regs; | ||
59 | u8 regs_num; | ||
60 | struct fixed_phy_status phy_status; | ||
61 | struct phy_device *phydev; /* pointer to the container */ | ||
62 | /* link & speed cb */ | ||
63 | int(*link_update)(struct net_device*, struct fixed_phy_status*); | ||
64 | |||
65 | }; | ||
66 | |||
67 | /*----------------------------------------------------------------------------- | ||
68 | * If something weird is required to be done with link/speed, | ||
69 | * network driver is able to assign a function to implement this. | ||
70 | * May be useful for PHY's that need to be software-driven. | ||
71 | *-----------------------------------------------------------------------------*/ | ||
72 | int fixed_mdio_set_link_update(struct phy_device* phydev, | ||
73 | int(*link_update)(struct net_device*, struct fixed_phy_status*)) | ||
74 | { | ||
75 | struct fixed_info *fixed; | ||
76 | |||
77 | if(link_update == NULL) | ||
78 | return -EINVAL; | ||
79 | |||
80 | if(phydev) { | ||
81 | if(phydev->bus) { | ||
82 | fixed = phydev->bus->priv; | ||
83 | fixed->link_update = link_update; | ||
84 | return 0; | ||
85 | } | ||
86 | } | ||
87 | return -EINVAL; | ||
88 | } | ||
89 | EXPORT_SYMBOL(fixed_mdio_set_link_update); | ||
90 | |||
91 | /*----------------------------------------------------------------------------- | ||
92 | * This is used for updating internal mii regs from the status | ||
93 | *-----------------------------------------------------------------------------*/ | ||
94 | static int fixed_mdio_update_regs(struct fixed_info *fixed) | ||
95 | { | ||
96 | u16 *regs = fixed->regs; | ||
97 | u16 bmsr = 0; | ||
98 | u16 bmcr = 0; | ||
99 | |||
100 | if(!regs) { | ||
101 | printk(KERN_ERR "%s: regs not set up", __FUNCTION__); | ||
102 | return -EINVAL; | ||
103 | } | ||
104 | |||
105 | if(fixed->phy_status.link) | ||
106 | bmsr |= BMSR_LSTATUS; | ||
107 | |||
108 | if(fixed->phy_status.duplex) { | ||
109 | bmcr |= BMCR_FULLDPLX; | ||
110 | |||
111 | switch ( fixed->phy_status.speed ) { | ||
112 | case 100: | ||
113 | bmsr |= BMSR_100FULL; | ||
114 | bmcr |= BMCR_SPEED100; | ||
115 | break; | ||
116 | |||
117 | case 10: | ||
118 | bmsr |= BMSR_10FULL; | ||
119 | break; | ||
120 | } | ||
121 | } else { | ||
122 | switch ( fixed->phy_status.speed ) { | ||
123 | case 100: | ||
124 | bmsr |= BMSR_100HALF; | ||
125 | bmcr |= BMCR_SPEED100; | ||
126 | break; | ||
127 | |||
128 | case 10: | ||
129 | bmsr |= BMSR_100HALF; | ||
130 | break; | ||
131 | } | ||
132 | } | ||
133 | |||
134 | regs[MII_BMCR] = bmcr; | ||
135 | regs[MII_BMSR] = bmsr | 0x800; /*we are always capable of 10 hdx*/ | ||
136 | |||
137 | return 0; | ||
138 | } | ||
139 | |||
140 | static int fixed_mii_read(struct mii_bus *bus, int phy_id, int location) | ||
141 | { | ||
142 | struct fixed_info *fixed = bus->priv; | ||
143 | |||
144 | /* if user has registered link update callback, use it */ | ||
145 | if(fixed->phydev) | ||
146 | if(fixed->phydev->attached_dev) { | ||
147 | if(fixed->link_update) { | ||
148 | fixed->link_update(fixed->phydev->attached_dev, | ||
149 | &fixed->phy_status); | ||
150 | fixed_mdio_update_regs(fixed); | ||
151 | } | ||
152 | } | ||
153 | |||
154 | if ((unsigned int)location >= fixed->regs_num) | ||
155 | return -1; | ||
156 | return fixed->regs[location]; | ||
157 | } | ||
158 | |||
159 | static int fixed_mii_write(struct mii_bus *bus, int phy_id, int location, u16 val) | ||
160 | { | ||
161 | /* do nothing for now*/ | ||
162 | return 0; | ||
163 | } | ||
164 | |||
165 | static int fixed_mii_reset(struct mii_bus *bus) | ||
166 | { | ||
167 | /*nothing here - no way/need to reset it*/ | ||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | static int fixed_config_aneg(struct phy_device *phydev) | ||
172 | { | ||
173 | /* :TODO:03/13/2006 09:45:37 PM:: | ||
174 | The full autoneg funcionality can be emulated, | ||
175 | but no need to have anything here for now | ||
176 | */ | ||
177 | return 0; | ||
178 | } | ||
179 | |||
180 | /*----------------------------------------------------------------------------- | ||
181 | * the manual bind will do the magic - with phy_id_mask == 0 | ||
182 | * match will never return true... | ||
183 | *-----------------------------------------------------------------------------*/ | ||
184 | static struct phy_driver fixed_mdio_driver = { | ||
185 | .name = "Fixed PHY", | ||
186 | .features = PHY_BASIC_FEATURES, | ||
187 | .config_aneg = fixed_config_aneg, | ||
188 | .read_status = genphy_read_status, | ||
189 | .driver = { .owner = THIS_MODULE,}, | ||
190 | }; | ||
191 | |||
192 | /*----------------------------------------------------------------------------- | ||
193 | * This func is used to create all the necessary stuff, bind | ||
194 | * the fixed phy driver and register all it on the mdio_bus_type. | ||
195 | * speed is either 10 or 100, duplex is boolean. | ||
196 | * number is used to create multiple fixed PHYs, so that several devices can | ||
197 | * utilize them simultaneously. | ||
198 | *-----------------------------------------------------------------------------*/ | ||
199 | static int fixed_mdio_register_device(int number, int speed, int duplex) | ||
200 | { | ||
201 | struct mii_bus *new_bus; | ||
202 | struct fixed_info *fixed; | ||
203 | struct phy_device *phydev; | ||
204 | int err = 0; | ||
205 | |||
206 | struct device* dev = kzalloc(sizeof(struct device), GFP_KERNEL); | ||
207 | |||
208 | if (NULL == dev) | ||
209 | return -ENOMEM; | ||
210 | |||
211 | new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL); | ||
212 | |||
213 | if (NULL == new_bus) { | ||
214 | kfree(dev); | ||
215 | return -ENOMEM; | ||
216 | } | ||
217 | fixed = kzalloc(sizeof(struct fixed_info), GFP_KERNEL); | ||
218 | |||
219 | if (NULL == fixed) { | ||
220 | kfree(dev); | ||
221 | kfree(new_bus); | ||
222 | return -ENOMEM; | ||
223 | } | ||
224 | |||
225 | fixed->regs = kzalloc(MII_REGS_NUM*sizeof(int), GFP_KERNEL); | ||
226 | fixed->regs_num = MII_REGS_NUM; | ||
227 | fixed->phy_status.speed = speed; | ||
228 | fixed->phy_status.duplex = duplex; | ||
229 | fixed->phy_status.link = 1; | ||
230 | |||
231 | new_bus->name = "Fixed MII Bus", | ||
232 | new_bus->read = &fixed_mii_read, | ||
233 | new_bus->write = &fixed_mii_write, | ||
234 | new_bus->reset = &fixed_mii_reset, | ||
235 | |||
236 | /*set up workspace*/ | ||
237 | fixed_mdio_update_regs(fixed); | ||
238 | new_bus->priv = fixed; | ||
239 | |||
240 | new_bus->dev = dev; | ||
241 | dev_set_drvdata(dev, new_bus); | ||
242 | |||
243 | /* create phy_device and register it on the mdio bus */ | ||
244 | phydev = phy_device_create(new_bus, 0, 0); | ||
245 | |||
246 | /* | ||
247 | Put the phydev pointer into the fixed pack so that bus read/write code could | ||
248 | be able to access for instance attached netdev. Well it doesn't have to do | ||
249 | so, only in case of utilizing user-specified link-update... | ||
250 | */ | ||
251 | fixed->phydev = phydev; | ||
252 | |||
253 | if(NULL == phydev) { | ||
254 | err = -ENOMEM; | ||
255 | goto device_create_fail; | ||
256 | } | ||
257 | |||
258 | phydev->irq = -1; | ||
259 | phydev->dev.bus = &mdio_bus_type; | ||
260 | |||
261 | if(number) | ||
262 | snprintf(phydev->dev.bus_id, BUS_ID_SIZE, | ||
263 | "fixed_%d@%d:%d", number, speed, duplex); | ||
264 | else | ||
265 | snprintf(phydev->dev.bus_id, BUS_ID_SIZE, | ||
266 | "fixed@%d:%d", speed, duplex); | ||
267 | phydev->bus = new_bus; | ||
268 | |||
269 | err = device_register(&phydev->dev); | ||
270 | if(err) { | ||
271 | printk(KERN_ERR "Phy %s failed to register\n", | ||
272 | phydev->dev.bus_id); | ||
273 | goto bus_register_fail; | ||
274 | } | ||
275 | |||
276 | /* | ||
277 | the mdio bus has phy_id match... In order not to do it | ||
278 | artificially, we are binding the driver here by hand; | ||
279 | it will be the same for all the fixed phys anyway. | ||
280 | */ | ||
281 | down_write(&phydev->dev.bus->subsys.rwsem); | ||
282 | |||
283 | phydev->dev.driver = &fixed_mdio_driver.driver; | ||
284 | |||
285 | err = phydev->dev.driver->probe(&phydev->dev); | ||
286 | if(err < 0) { | ||
287 | printk(KERN_ERR "Phy %s: problems with fixed driver\n",phydev->dev.bus_id); | ||
288 | up_write(&phydev->dev.bus->subsys.rwsem); | ||
289 | goto probe_fail; | ||
290 | } | ||
291 | |||
292 | device_bind_driver(&phydev->dev); | ||
293 | up_write(&phydev->dev.bus->subsys.rwsem); | ||
294 | |||
295 | return 0; | ||
296 | |||
297 | probe_fail: | ||
298 | device_unregister(&phydev->dev); | ||
299 | bus_register_fail: | ||
300 | kfree(phydev); | ||
301 | device_create_fail: | ||
302 | kfree(dev); | ||
303 | kfree(new_bus); | ||
304 | kfree(fixed); | ||
305 | |||
306 | return err; | ||
307 | } | ||
308 | |||
309 | |||
310 | MODULE_DESCRIPTION("Fixed PHY device & driver for PAL"); | ||
311 | MODULE_AUTHOR("Vitaly Bordug"); | ||
312 | MODULE_LICENSE("GPL"); | ||
313 | |||
314 | static int __init fixed_init(void) | ||
315 | { | ||
316 | int ret; | ||
317 | int duplex = 0; | ||
318 | |||
319 | /* register on the bus... Not expected to be matched with anything there... */ | ||
320 | phy_driver_register(&fixed_mdio_driver); | ||
321 | |||
322 | /* So let the fun begin... | ||
323 | We will create several mdio devices here, and will bound the upper | ||
324 | driver to them. | ||
325 | |||
326 | Then the external software can lookup the phy bus by searching | ||
327 | fixed@speed:duplex, e.g. fixed@100:1, to be connected to the | ||
328 | virtual 100M Fdx phy. | ||
329 | |||
330 | In case several virtual PHYs required, the bus_id will be in form | ||
331 | fixed_<num>@<speed>:<duplex>, which make it able even to define | ||
332 | driver-specific link control callback, if for instance PHY is completely | ||
333 | SW-driven. | ||
334 | |||
335 | */ | ||
336 | |||
337 | #ifdef CONFIG_FIXED_MII_DUPLEX | ||
338 | duplex = 1; | ||
339 | #endif | ||
340 | |||
341 | #ifdef CONFIG_FIXED_MII_100_FDX | ||
342 | fixed_mdio_register_device(0, 100, 1); | ||
343 | #endif | ||
344 | |||
345 | #ifdef CONFIX_FIXED_MII_10_FDX | ||
346 | fixed_mdio_register_device(0, 10, 1); | ||
347 | #endif | ||
348 | return 0; | ||
349 | } | ||
350 | |||
351 | static void __exit fixed_exit(void) | ||
352 | { | ||
353 | phy_driver_unregister(&fixed_mdio_driver); | ||
354 | /* :WARNING:02/18/2006 04:32:40 AM:: Cleanup all the created stuff */ | ||
355 | } | ||
356 | |||
357 | module_init(fixed_init); | ||
358 | module_exit(fixed_exit); | ||
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 1dde390c164d..cf6660c93ffa 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -159,6 +159,7 @@ struct bus_type mdio_bus_type = { | |||
159 | .suspend = mdio_bus_suspend, | 159 | .suspend = mdio_bus_suspend, |
160 | .resume = mdio_bus_resume, | 160 | .resume = mdio_bus_resume, |
161 | }; | 161 | }; |
162 | EXPORT_SYMBOL(mdio_bus_type); | ||
162 | 163 | ||
163 | int __init mdio_bus_init(void) | 164 | int __init mdio_bus_init(void) |
164 | { | 165 | { |
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 1bc1e032c5d6..2d1ecfdc80db 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -45,6 +45,35 @@ static struct phy_driver genphy_driver; | |||
45 | extern int mdio_bus_init(void); | 45 | extern int mdio_bus_init(void); |
46 | extern void mdio_bus_exit(void); | 46 | extern void mdio_bus_exit(void); |
47 | 47 | ||
48 | struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) | ||
49 | { | ||
50 | struct phy_device *dev; | ||
51 | /* We allocate the device, and initialize the | ||
52 | * default values */ | ||
53 | dev = kcalloc(1, sizeof(*dev), GFP_KERNEL); | ||
54 | |||
55 | if (NULL == dev) | ||
56 | return (struct phy_device*) PTR_ERR((void*)-ENOMEM); | ||
57 | |||
58 | dev->speed = 0; | ||
59 | dev->duplex = -1; | ||
60 | dev->pause = dev->asym_pause = 0; | ||
61 | dev->link = 1; | ||
62 | |||
63 | dev->autoneg = AUTONEG_ENABLE; | ||
64 | |||
65 | dev->addr = addr; | ||
66 | dev->phy_id = phy_id; | ||
67 | dev->bus = bus; | ||
68 | |||
69 | dev->state = PHY_DOWN; | ||
70 | |||
71 | spin_lock_init(&dev->lock); | ||
72 | |||
73 | return dev; | ||
74 | } | ||
75 | EXPORT_SYMBOL(phy_device_create); | ||
76 | |||
48 | /* get_phy_device | 77 | /* get_phy_device |
49 | * | 78 | * |
50 | * description: Reads the ID registers of the PHY at addr on the | 79 | * description: Reads the ID registers of the PHY at addr on the |
@@ -78,27 +107,7 @@ struct phy_device * get_phy_device(struct mii_bus *bus, int addr) | |||
78 | if (0xffffffff == phy_id) | 107 | if (0xffffffff == phy_id) |
79 | return NULL; | 108 | return NULL; |
80 | 109 | ||
81 | /* Otherwise, we allocate the device, and initialize the | 110 | dev = phy_device_create(bus, addr, phy_id); |
82 | * default values */ | ||
83 | dev = kcalloc(1, sizeof(*dev), GFP_KERNEL); | ||
84 | |||
85 | if (NULL == dev) | ||
86 | return ERR_PTR(-ENOMEM); | ||
87 | |||
88 | dev->speed = 0; | ||
89 | dev->duplex = -1; | ||
90 | dev->pause = dev->asym_pause = 0; | ||
91 | dev->link = 1; | ||
92 | |||
93 | dev->autoneg = AUTONEG_ENABLE; | ||
94 | |||
95 | dev->addr = addr; | ||
96 | dev->phy_id = phy_id; | ||
97 | dev->bus = bus; | ||
98 | |||
99 | dev->state = PHY_DOWN; | ||
100 | |||
101 | spin_lock_init(&dev->lock); | ||
102 | 111 | ||
103 | return dev; | 112 | return dev; |
104 | } | 113 | } |
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 25e31fb5cb31..b1d8ed40ad98 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c | |||
@@ -14,7 +14,6 @@ | |||
14 | * | 14 | * |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/config.h> | ||
18 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
19 | #include <linux/module.h> | 18 | #include <linux/module.h> |
20 | #include <linux/mii.h> | 19 | #include <linux/mii.h> |
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c index ffd215d9a9be..792716beb052 100644 --- a/drivers/net/phy/vitesse.c +++ b/drivers/net/phy/vitesse.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/config.h> | ||
16 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
17 | #include <linux/module.h> | 16 | #include <linux/module.h> |
18 | #include <linux/mii.h> | 17 | #include <linux/mii.h> |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 0ec6e9d57b94..c872f7c6cce3 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -192,7 +192,7 @@ struct cardmap { | |||
192 | void *ptr[CARDMAP_WIDTH]; | 192 | void *ptr[CARDMAP_WIDTH]; |
193 | }; | 193 | }; |
194 | static void *cardmap_get(struct cardmap *map, unsigned int nr); | 194 | static void *cardmap_get(struct cardmap *map, unsigned int nr); |
195 | static void cardmap_set(struct cardmap **map, unsigned int nr, void *ptr); | 195 | static int cardmap_set(struct cardmap **map, unsigned int nr, void *ptr); |
196 | static unsigned int cardmap_find_first_free(struct cardmap *map); | 196 | static unsigned int cardmap_find_first_free(struct cardmap *map); |
197 | static void cardmap_destroy(struct cardmap **map); | 197 | static void cardmap_destroy(struct cardmap **map); |
198 | 198 | ||
@@ -1995,10 +1995,9 @@ ppp_register_channel(struct ppp_channel *chan) | |||
1995 | { | 1995 | { |
1996 | struct channel *pch; | 1996 | struct channel *pch; |
1997 | 1997 | ||
1998 | pch = kmalloc(sizeof(struct channel), GFP_KERNEL); | 1998 | pch = kzalloc(sizeof(struct channel), GFP_KERNEL); |
1999 | if (pch == 0) | 1999 | if (pch == 0) |
2000 | return -ENOMEM; | 2000 | return -ENOMEM; |
2001 | memset(pch, 0, sizeof(struct channel)); | ||
2002 | pch->ppp = NULL; | 2001 | pch->ppp = NULL; |
2003 | pch->chan = chan; | 2002 | pch->chan = chan; |
2004 | chan->ppp = pch; | 2003 | chan->ppp = pch; |
@@ -2408,13 +2407,12 @@ ppp_create_interface(int unit, int *retp) | |||
2408 | int ret = -ENOMEM; | 2407 | int ret = -ENOMEM; |
2409 | int i; | 2408 | int i; |
2410 | 2409 | ||
2411 | ppp = kmalloc(sizeof(struct ppp), GFP_KERNEL); | 2410 | ppp = kzalloc(sizeof(struct ppp), GFP_KERNEL); |
2412 | if (!ppp) | 2411 | if (!ppp) |
2413 | goto out; | 2412 | goto out; |
2414 | dev = alloc_netdev(0, "", ppp_setup); | 2413 | dev = alloc_netdev(0, "", ppp_setup); |
2415 | if (!dev) | 2414 | if (!dev) |
2416 | goto out1; | 2415 | goto out1; |
2417 | memset(ppp, 0, sizeof(struct ppp)); | ||
2418 | 2416 | ||
2419 | ppp->mru = PPP_MRU; | 2417 | ppp->mru = PPP_MRU; |
2420 | init_ppp_file(&ppp->file, INTERFACE); | 2418 | init_ppp_file(&ppp->file, INTERFACE); |
@@ -2454,11 +2452,16 @@ ppp_create_interface(int unit, int *retp) | |||
2454 | } | 2452 | } |
2455 | 2453 | ||
2456 | atomic_inc(&ppp_unit_count); | 2454 | atomic_inc(&ppp_unit_count); |
2457 | cardmap_set(&all_ppp_units, unit, ppp); | 2455 | ret = cardmap_set(&all_ppp_units, unit, ppp); |
2456 | if (ret != 0) | ||
2457 | goto out3; | ||
2458 | |||
2458 | mutex_unlock(&all_ppp_mutex); | 2459 | mutex_unlock(&all_ppp_mutex); |
2459 | *retp = 0; | 2460 | *retp = 0; |
2460 | return ppp; | 2461 | return ppp; |
2461 | 2462 | ||
2463 | out3: | ||
2464 | atomic_dec(&ppp_unit_count); | ||
2462 | out2: | 2465 | out2: |
2463 | mutex_unlock(&all_ppp_mutex); | 2466 | mutex_unlock(&all_ppp_mutex); |
2464 | free_netdev(dev); | 2467 | free_netdev(dev); |
@@ -2695,7 +2698,7 @@ static void *cardmap_get(struct cardmap *map, unsigned int nr) | |||
2695 | return NULL; | 2698 | return NULL; |
2696 | } | 2699 | } |
2697 | 2700 | ||
2698 | static void cardmap_set(struct cardmap **pmap, unsigned int nr, void *ptr) | 2701 | static int cardmap_set(struct cardmap **pmap, unsigned int nr, void *ptr) |
2699 | { | 2702 | { |
2700 | struct cardmap *p; | 2703 | struct cardmap *p; |
2701 | int i; | 2704 | int i; |
@@ -2704,8 +2707,9 @@ static void cardmap_set(struct cardmap **pmap, unsigned int nr, void *ptr) | |||
2704 | if (p == NULL || (nr >> p->shift) >= CARDMAP_WIDTH) { | 2707 | if (p == NULL || (nr >> p->shift) >= CARDMAP_WIDTH) { |
2705 | do { | 2708 | do { |
2706 | /* need a new top level */ | 2709 | /* need a new top level */ |
2707 | struct cardmap *np = kmalloc(sizeof(*np), GFP_KERNEL); | 2710 | struct cardmap *np = kzalloc(sizeof(*np), GFP_KERNEL); |
2708 | memset(np, 0, sizeof(*np)); | 2711 | if (!np) |
2712 | goto enomem; | ||
2709 | np->ptr[0] = p; | 2713 | np->ptr[0] = p; |
2710 | if (p != NULL) { | 2714 | if (p != NULL) { |
2711 | np->shift = p->shift + CARDMAP_ORDER; | 2715 | np->shift = p->shift + CARDMAP_ORDER; |
@@ -2719,8 +2723,9 @@ static void cardmap_set(struct cardmap **pmap, unsigned int nr, void *ptr) | |||
2719 | while (p->shift > 0) { | 2723 | while (p->shift > 0) { |
2720 | i = (nr >> p->shift) & CARDMAP_MASK; | 2724 | i = (nr >> p->shift) & CARDMAP_MASK; |
2721 | if (p->ptr[i] == NULL) { | 2725 | if (p->ptr[i] == NULL) { |
2722 | struct cardmap *np = kmalloc(sizeof(*np), GFP_KERNEL); | 2726 | struct cardmap *np = kzalloc(sizeof(*np), GFP_KERNEL); |
2723 | memset(np, 0, sizeof(*np)); | 2727 | if (!np) |
2728 | goto enomem; | ||
2724 | np->shift = p->shift - CARDMAP_ORDER; | 2729 | np->shift = p->shift - CARDMAP_ORDER; |
2725 | np->parent = p; | 2730 | np->parent = p; |
2726 | p->ptr[i] = np; | 2731 | p->ptr[i] = np; |
@@ -2735,6 +2740,9 @@ static void cardmap_set(struct cardmap **pmap, unsigned int nr, void *ptr) | |||
2735 | set_bit(i, &p->inuse); | 2740 | set_bit(i, &p->inuse); |
2736 | else | 2741 | else |
2737 | clear_bit(i, &p->inuse); | 2742 | clear_bit(i, &p->inuse); |
2743 | return 0; | ||
2744 | enomem: | ||
2745 | return -ENOMEM; | ||
2738 | } | 2746 | } |
2739 | 2747 | ||
2740 | static unsigned int cardmap_find_first_free(struct cardmap *map) | 2748 | static unsigned int cardmap_find_first_free(struct cardmap *map) |
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c new file mode 100644 index 000000000000..c729aeeb4696 --- /dev/null +++ b/drivers/net/qla3xxx.c | |||
@@ -0,0 +1,3537 @@ | |||
1 | /* | ||
2 | * QLogic QLA3xxx NIC HBA Driver | ||
3 | * Copyright (c) 2003-2006 QLogic Corporation | ||
4 | * | ||
5 | * See LICENSE.qla3xxx for copyright and licensing details. | ||
6 | */ | ||
7 | |||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/init.h> | ||
10 | #include <linux/types.h> | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/list.h> | ||
13 | #include <linux/pci.h> | ||
14 | #include <linux/dma-mapping.h> | ||
15 | #include <linux/sched.h> | ||
16 | #include <linux/slab.h> | ||
17 | #include <linux/dmapool.h> | ||
18 | #include <linux/mempool.h> | ||
19 | #include <linux/spinlock.h> | ||
20 | #include <linux/kthread.h> | ||
21 | #include <linux/interrupt.h> | ||
22 | #include <linux/errno.h> | ||
23 | #include <linux/ioport.h> | ||
24 | #include <linux/ip.h> | ||
25 | #include <linux/if_arp.h> | ||
26 | #include <linux/if_ether.h> | ||
27 | #include <linux/netdevice.h> | ||
28 | #include <linux/etherdevice.h> | ||
29 | #include <linux/ethtool.h> | ||
30 | #include <linux/skbuff.h> | ||
31 | #include <linux/rtnetlink.h> | ||
32 | #include <linux/if_vlan.h> | ||
33 | #include <linux/init.h> | ||
34 | #include <linux/delay.h> | ||
35 | #include <linux/mm.h> | ||
36 | |||
37 | #include "qla3xxx.h" | ||
38 | |||
39 | #define DRV_NAME "qla3xxx" | ||
40 | #define DRV_STRING "QLogic ISP3XXX Network Driver" | ||
41 | #define DRV_VERSION "v2.02.00-k36" | ||
42 | #define PFX DRV_NAME " " | ||
43 | |||
44 | static const char ql3xxx_driver_name[] = DRV_NAME; | ||
45 | static const char ql3xxx_driver_version[] = DRV_VERSION; | ||
46 | |||
47 | MODULE_AUTHOR("QLogic Corporation"); | ||
48 | MODULE_DESCRIPTION("QLogic ISP3XXX Network Driver " DRV_VERSION " "); | ||
49 | MODULE_LICENSE("GPL"); | ||
50 | MODULE_VERSION(DRV_VERSION); | ||
51 | |||
52 | static const u32 default_msg | ||
53 | = NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK | ||
54 | | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN; | ||
55 | |||
56 | static int debug = -1; /* defaults above */ | ||
57 | module_param(debug, int, 0); | ||
58 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | ||
59 | |||
60 | static int msi; | ||
61 | module_param(msi, int, 0); | ||
62 | MODULE_PARM_DESC(msi, "Turn on Message Signaled Interrupts."); | ||
63 | |||
64 | static struct pci_device_id ql3xxx_pci_tbl[] __devinitdata = { | ||
65 | {PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, QL3022_DEVICE_ID)}, | ||
66 | /* required last entry */ | ||
67 | {0,} | ||
68 | }; | ||
69 | |||
70 | MODULE_DEVICE_TABLE(pci, ql3xxx_pci_tbl); | ||
71 | |||
72 | /* | ||
73 | * Caller must take hw_lock. | ||
74 | */ | ||
75 | static int ql_sem_spinlock(struct ql3_adapter *qdev, | ||
76 | u32 sem_mask, u32 sem_bits) | ||
77 | { | ||
78 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | ||
79 | u32 value; | ||
80 | unsigned int seconds = 3; | ||
81 | |||
82 | do { | ||
83 | writel((sem_mask | sem_bits), | ||
84 | &port_regs->CommonRegs.semaphoreReg); | ||
85 | value = readl(&port_regs->CommonRegs.semaphoreReg); | ||
86 | if ((value & (sem_mask >> 16)) == sem_bits) | ||
87 | return 0; | ||
88 | ssleep(1); | ||
89 | } while(--seconds); | ||
90 | return -1; | ||
91 | } | ||
92 | |||
93 | static void ql_sem_unlock(struct ql3_adapter *qdev, u32 sem_mask) | ||
94 | { | ||
95 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | ||
96 | writel(sem_mask, &port_regs->CommonRegs.semaphoreReg); | ||
97 | readl(&port_regs->CommonRegs.semaphoreReg); | ||
98 | } | ||
99 | |||
100 | static int ql_sem_lock(struct ql3_adapter *qdev, u32 sem_mask, u32 sem_bits) | ||
101 | { | ||
102 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | ||
103 | u32 value; | ||
104 | |||
105 | writel((sem_mask | sem_bits), &port_regs->CommonRegs.semaphoreReg); | ||
106 | value = readl(&port_regs->CommonRegs.semaphoreReg); | ||
107 | return ((value & (sem_mask >> 16)) == sem_bits); | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | * Caller holds hw_lock. | ||
112 | */ | ||
113 | static int ql_wait_for_drvr_lock(struct ql3_adapter *qdev) | ||
114 | { | ||
115 | int i = 0; | ||
116 | |||
117 | while (1) { | ||
118 | if (!ql_sem_lock(qdev, | ||
119 | QL_DRVR_SEM_MASK, | ||
120 | (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) | ||
121 | * 2) << 1)) { | ||
122 | if (i < 10) { | ||
123 | ssleep(1); | ||
124 | i++; | ||
125 | } else { | ||
126 | printk(KERN_ERR PFX "%s: Timed out waiting for " | ||
127 | "driver lock...\n", | ||
128 | qdev->ndev->name); | ||
129 | return 0; | ||
130 | } | ||
131 | } else { | ||
132 | printk(KERN_DEBUG PFX | ||
133 | "%s: driver lock acquired.\n", | ||
134 | qdev->ndev->name); | ||
135 | return 1; | ||
136 | } | ||
137 | } | ||
138 | } | ||
139 | |||
140 | static void ql_set_register_page(struct ql3_adapter *qdev, u32 page) | ||
141 | { | ||
142 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | ||
143 | |||
144 | writel(((ISP_CONTROL_NP_MASK << 16) | page), | ||
145 | &port_regs->CommonRegs.ispControlStatus); | ||
146 | readl(&port_regs->CommonRegs.ispControlStatus); | ||
147 | qdev->current_page = page; | ||
148 | } | ||
149 | |||
150 | static u32 ql_read_common_reg_l(struct ql3_adapter *qdev, | ||
151 | u32 __iomem * reg) | ||
152 | { | ||
153 | u32 value; | ||
154 | unsigned long hw_flags; | ||
155 | |||
156 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); | ||
157 | value = readl(reg); | ||
158 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | ||
159 | |||
160 | return value; | ||
161 | } | ||
162 | |||
163 | static u32 ql_read_common_reg(struct ql3_adapter *qdev, | ||
164 | u32 __iomem * reg) | ||
165 | { | ||
166 | return readl(reg); | ||
167 | } | ||
168 | |||
169 | static u32 ql_read_page0_reg_l(struct ql3_adapter *qdev, u32 __iomem *reg) | ||
170 | { | ||
171 | u32 value; | ||
172 | unsigned long hw_flags; | ||
173 | |||
174 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); | ||
175 | |||
176 | if (qdev->current_page != 0) | ||
177 | ql_set_register_page(qdev,0); | ||
178 | value = readl(reg); | ||
179 | |||
180 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | ||
181 | return value; | ||
182 | } | ||
183 | |||
184 | static u32 ql_read_page0_reg(struct ql3_adapter *qdev, u32 __iomem *reg) | ||
185 | { | ||
186 | if (qdev->current_page != 0) | ||
187 | ql_set_register_page(qdev,0); | ||
188 | return readl(reg); | ||
189 | } | ||
190 | |||
191 | static void ql_write_common_reg_l(struct ql3_adapter *qdev, | ||
192 | u32 * reg, u32 value) | ||
193 | { | ||
194 | unsigned long hw_flags; | ||
195 | |||
196 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); | ||
197 | writel(value, (u32 *) reg); | ||
198 | readl(reg); | ||
199 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | ||
200 | return; | ||
201 | } | ||
202 | |||
203 | static void ql_write_common_reg(struct ql3_adapter *qdev, | ||
204 | u32 * reg, u32 value) | ||
205 | { | ||
206 | writel(value, (u32 *) reg); | ||
207 | readl(reg); | ||
208 | return; | ||
209 | } | ||
210 | |||
211 | static void ql_write_page0_reg(struct ql3_adapter *qdev, | ||
212 | u32 * reg, u32 value) | ||
213 | { | ||
214 | if (qdev->current_page != 0) | ||
215 | ql_set_register_page(qdev,0); | ||
216 | writel(value, (u32 *) reg); | ||
217 | readl(reg); | ||
218 | return; | ||
219 | } | ||
220 | |||
221 | /* | ||
222 | * Caller holds hw_lock. Only called during init. | ||
223 | */ | ||
224 | static void ql_write_page1_reg(struct ql3_adapter *qdev, | ||
225 | u32 * reg, u32 value) | ||
226 | { | ||
227 | if (qdev->current_page != 1) | ||
228 | ql_set_register_page(qdev,1); | ||
229 | writel(value, (u32 *) reg); | ||
230 | readl(reg); | ||
231 | return; | ||
232 | } | ||
233 | |||
234 | /* | ||
235 | * Caller holds hw_lock. Only called during init. | ||
236 | */ | ||
237 | static void ql_write_page2_reg(struct ql3_adapter *qdev, | ||
238 | u32 * reg, u32 value) | ||
239 | { | ||
240 | if (qdev->current_page != 2) | ||
241 | ql_set_register_page(qdev,2); | ||
242 | writel(value, (u32 *) reg); | ||
243 | readl(reg); | ||
244 | return; | ||
245 | } | ||
246 | |||
247 | static void ql_disable_interrupts(struct ql3_adapter *qdev) | ||
248 | { | ||
249 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | ||
250 | |||
251 | ql_write_common_reg_l(qdev, &port_regs->CommonRegs.ispInterruptMaskReg, | ||
252 | (ISP_IMR_ENABLE_INT << 16)); | ||
253 | |||
254 | } | ||
255 | |||
256 | static void ql_enable_interrupts(struct ql3_adapter *qdev) | ||
257 | { | ||
258 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | ||
259 | |||
260 | ql_write_common_reg_l(qdev, &port_regs->CommonRegs.ispInterruptMaskReg, | ||
261 | ((0xff << 16) | ISP_IMR_ENABLE_INT)); | ||
262 | |||
263 | } | ||
264 | |||
265 | static void ql_release_to_lrg_buf_free_list(struct ql3_adapter *qdev, | ||
266 | struct ql_rcv_buf_cb *lrg_buf_cb) | ||
267 | { | ||
268 | u64 map; | ||
269 | lrg_buf_cb->next = NULL; | ||
270 | |||
271 | if (qdev->lrg_buf_free_tail == NULL) { /* The list is empty */ | ||
272 | qdev->lrg_buf_free_head = qdev->lrg_buf_free_tail = lrg_buf_cb; | ||
273 | } else { | ||
274 | qdev->lrg_buf_free_tail->next = lrg_buf_cb; | ||
275 | qdev->lrg_buf_free_tail = lrg_buf_cb; | ||
276 | } | ||
277 | |||
278 | if (!lrg_buf_cb->skb) { | ||
279 | lrg_buf_cb->skb = dev_alloc_skb(qdev->lrg_buffer_len); | ||
280 | if (unlikely(!lrg_buf_cb->skb)) { | ||
281 | printk(KERN_ERR PFX "%s: failed dev_alloc_skb().\n", | ||
282 | qdev->ndev->name); | ||
283 | qdev->lrg_buf_skb_check++; | ||
284 | } else { | ||
285 | /* | ||
286 | * We save some space to copy the ethhdr from first | ||
287 | * buffer | ||
288 | */ | ||
289 | skb_reserve(lrg_buf_cb->skb, QL_HEADER_SPACE); | ||
290 | map = pci_map_single(qdev->pdev, | ||
291 | lrg_buf_cb->skb->data, | ||
292 | qdev->lrg_buffer_len - | ||
293 | QL_HEADER_SPACE, | ||
294 | PCI_DMA_FROMDEVICE); | ||
295 | lrg_buf_cb->buf_phy_addr_low = | ||
296 | cpu_to_le32(LS_64BITS(map)); | ||
297 | lrg_buf_cb->buf_phy_addr_high = | ||
298 | cpu_to_le32(MS_64BITS(map)); | ||
299 | pci_unmap_addr_set(lrg_buf_cb, mapaddr, map); | ||
300 | pci_unmap_len_set(lrg_buf_cb, maplen, | ||
301 | qdev->lrg_buffer_len - | ||
302 | QL_HEADER_SPACE); | ||
303 | } | ||
304 | } | ||
305 | |||
306 | qdev->lrg_buf_free_count++; | ||
307 | } | ||
308 | |||
309 | static struct ql_rcv_buf_cb *ql_get_from_lrg_buf_free_list(struct ql3_adapter | ||
310 | *qdev) | ||
311 | { | ||
312 | struct ql_rcv_buf_cb *lrg_buf_cb; | ||
313 | |||
314 | if ((lrg_buf_cb = qdev->lrg_buf_free_head) != NULL) { | ||
315 | if ((qdev->lrg_buf_free_head = lrg_buf_cb->next) == NULL) | ||
316 | qdev->lrg_buf_free_tail = NULL; | ||
317 | qdev->lrg_buf_free_count--; | ||
318 | } | ||
319 | |||
320 | return lrg_buf_cb; | ||
321 | } | ||
322 | |||
323 | static u32 addrBits = EEPROM_NO_ADDR_BITS; | ||
324 | static u32 dataBits = EEPROM_NO_DATA_BITS; | ||
325 | |||
326 | static void fm93c56a_deselect(struct ql3_adapter *qdev); | ||
327 | static void eeprom_readword(struct ql3_adapter *qdev, u32 eepromAddr, | ||
328 | unsigned short *value); | ||
329 | |||
330 | /* | ||
331 | * Caller holds hw_lock. | ||
332 | */ | ||
333 | static void fm93c56a_select(struct ql3_adapter *qdev) | ||
334 | { | ||
335 | struct ql3xxx_port_registers __iomem *port_regs = | ||
336 | qdev->mem_map_registers; | ||
337 | |||
338 | qdev->eeprom_cmd_data = AUBURN_EEPROM_CS_1; | ||
339 | ql_write_common_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg, | ||
340 | ISP_NVRAM_MASK | qdev->eeprom_cmd_data); | ||
341 | ql_write_common_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg, | ||
342 | ((ISP_NVRAM_MASK << 16) | qdev->eeprom_cmd_data)); | ||
343 | } | ||
344 | |||
345 | /* | ||
346 | * Caller holds hw_lock. | ||
347 | */ | ||
348 | static void fm93c56a_cmd(struct ql3_adapter *qdev, u32 cmd, u32 eepromAddr) | ||
349 | { | ||
350 | int i; | ||
351 | u32 mask; | ||
352 | u32 dataBit; | ||
353 | u32 previousBit; | ||
354 | struct ql3xxx_port_registers __iomem *port_regs = | ||
355 | qdev->mem_map_registers; | ||
356 | |||
357 | /* Clock in a zero, then do the start bit */ | ||
358 | ql_write_common_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg, | ||
359 | ISP_NVRAM_MASK | qdev->eeprom_cmd_data | | ||
360 | AUBURN_EEPROM_DO_1); | ||
361 | ql_write_common_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg, | ||
362 | ISP_NVRAM_MASK | qdev-> | ||
363 | eeprom_cmd_data | AUBURN_EEPROM_DO_1 | | ||
364 | AUBURN_EEPROM_CLK_RISE); | ||
365 | ql_write_common_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg, | ||
366 | ISP_NVRAM_MASK | qdev-> | ||
367 | eeprom_cmd_data | AUBURN_EEPROM_DO_1 | | ||
368 | AUBURN_EEPROM_CLK_FALL); | ||
369 | |||
370 | mask = 1 << (FM93C56A_CMD_BITS - 1); | ||
371 | /* Force the previous data bit to be different */ | ||
372 | previousBit = 0xffff; | ||
373 | for (i = 0; i < FM93C56A_CMD_BITS; i++) { | ||
374 | dataBit = | ||
375 | (cmd & mask) ? AUBURN_EEPROM_DO_1 : AUBURN_EEPROM_DO_0; | ||
376 | if (previousBit != dataBit) { | ||
377 | /* | ||
378 | * If the bit changed, then change the DO state to | ||
379 | * match | ||
380 | */ | ||
381 | ql_write_common_reg(qdev, | ||
382 | &port_regs->CommonRegs. | ||
383 | serialPortInterfaceReg, | ||
384 | ISP_NVRAM_MASK | qdev-> | ||
385 | eeprom_cmd_data | dataBit); | ||
386 | previousBit = dataBit; | ||
387 | } | ||
388 | ql_write_common_reg(qdev, | ||
389 | &port_regs->CommonRegs. | ||
390 | serialPortInterfaceReg, | ||
391 | ISP_NVRAM_MASK | qdev-> | ||
392 | eeprom_cmd_data | dataBit | | ||
393 | AUBURN_EEPROM_CLK_RISE); | ||
394 | ql_write_common_reg(qdev, | ||
395 | &port_regs->CommonRegs. | ||
396 | serialPortInterfaceReg, | ||
397 | ISP_NVRAM_MASK | qdev-> | ||
398 | eeprom_cmd_data | dataBit | | ||
399 | AUBURN_EEPROM_CLK_FALL); | ||
400 | cmd = cmd << 1; | ||
401 | } | ||
402 | |||
403 | mask = 1 << (addrBits - 1); | ||
404 | /* Force the previous data bit to be different */ | ||
405 | previousBit = 0xffff; | ||
406 | for (i = 0; i < addrBits; i++) { | ||
407 | dataBit = | ||
408 | (eepromAddr & mask) ? AUBURN_EEPROM_DO_1 : | ||
409 | AUBURN_EEPROM_DO_0; | ||
410 | if (previousBit != dataBit) { | ||
411 | /* | ||
412 | * If the bit changed, then change the DO state to | ||
413 | * match | ||
414 | */ | ||
415 | ql_write_common_reg(qdev, | ||
416 | &port_regs->CommonRegs. | ||
417 | serialPortInterfaceReg, | ||
418 | ISP_NVRAM_MASK | qdev-> | ||
419 | eeprom_cmd_data | dataBit); | ||
420 | previousBit = dataBit; | ||
421 | } | ||
422 | ql_write_common_reg(qdev, | ||
423 | &port_regs->CommonRegs. | ||
424 | serialPortInterfaceReg, | ||
425 | ISP_NVRAM_MASK | qdev-> | ||
426 | eeprom_cmd_data | dataBit | | ||
427 | AUBURN_EEPROM_CLK_RISE); | ||
428 | ql_write_common_reg(qdev, | ||
429 | &port_regs->CommonRegs. | ||
430 | serialPortInterfaceReg, | ||
431 | ISP_NVRAM_MASK | qdev-> | ||
432 | eeprom_cmd_data | dataBit | | ||
433 | AUBURN_EEPROM_CLK_FALL); | ||
434 | eepromAddr = eepromAddr << 1; | ||
435 | } | ||
436 | } | ||
437 | |||
438 | /* | ||
439 | * Caller holds hw_lock. | ||
440 | */ | ||
441 | static void fm93c56a_deselect(struct ql3_adapter *qdev) | ||
442 | { | ||
443 | struct ql3xxx_port_registers __iomem *port_regs = | ||
444 | qdev->mem_map_registers; | ||
445 | qdev->eeprom_cmd_data = AUBURN_EEPROM_CS_0; | ||
446 | ql_write_common_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg, | ||
447 | ISP_NVRAM_MASK | qdev->eeprom_cmd_data); | ||
448 | } | ||
449 | |||
450 | /* | ||
451 | * Caller holds hw_lock. | ||
452 | */ | ||
453 | static void fm93c56a_datain(struct ql3_adapter *qdev, unsigned short *value) | ||
454 | { | ||
455 | int i; | ||
456 | u32 data = 0; | ||
457 | u32 dataBit; | ||
458 | struct ql3xxx_port_registers __iomem *port_regs = | ||
459 | qdev->mem_map_registers; | ||
460 | |||
461 | /* Read the data bits */ | ||
462 | /* The first bit is a dummy. Clock right over it. */ | ||
463 | for (i = 0; i < dataBits; i++) { | ||
464 | ql_write_common_reg(qdev, | ||
465 | &port_regs->CommonRegs. | ||
466 | serialPortInterfaceReg, | ||
467 | ISP_NVRAM_MASK | qdev->eeprom_cmd_data | | ||
468 | AUBURN_EEPROM_CLK_RISE); | ||
469 | ql_write_common_reg(qdev, | ||
470 | &port_regs->CommonRegs. | ||
471 | serialPortInterfaceReg, | ||
472 | ISP_NVRAM_MASK | qdev->eeprom_cmd_data | | ||
473 | AUBURN_EEPROM_CLK_FALL); | ||
474 | dataBit = | ||
475 | (ql_read_common_reg | ||
476 | (qdev, | ||
477 | &port_regs->CommonRegs. | ||
478 | serialPortInterfaceReg) & AUBURN_EEPROM_DI_1) ? 1 : 0; | ||
479 | data = (data << 1) | dataBit; | ||
480 | } | ||
481 | *value = (u16) data; | ||
482 | } | ||
483 | |||
484 | /* | ||
485 | * Caller holds hw_lock. | ||
486 | */ | ||
487 | static void eeprom_readword(struct ql3_adapter *qdev, | ||
488 | u32 eepromAddr, unsigned short *value) | ||
489 | { | ||
490 | fm93c56a_select(qdev); | ||
491 | fm93c56a_cmd(qdev, (int)FM93C56A_READ, eepromAddr); | ||
492 | fm93c56a_datain(qdev, value); | ||
493 | fm93c56a_deselect(qdev); | ||
494 | } | ||
495 | |||
496 | static void ql_swap_mac_addr(u8 * macAddress) | ||
497 | { | ||
498 | #ifdef __BIG_ENDIAN | ||
499 | u8 temp; | ||
500 | temp = macAddress[0]; | ||
501 | macAddress[0] = macAddress[1]; | ||
502 | macAddress[1] = temp; | ||
503 | temp = macAddress[2]; | ||
504 | macAddress[2] = macAddress[3]; | ||
505 | macAddress[3] = temp; | ||
506 | temp = macAddress[4]; | ||
507 | macAddress[4] = macAddress[5]; | ||
508 | macAddress[5] = temp; | ||
509 | #endif | ||
510 | } | ||
511 | |||
512 | static int ql_get_nvram_params(struct ql3_adapter *qdev) | ||
513 | { | ||
514 | u16 *pEEPROMData; | ||
515 | u16 checksum = 0; | ||
516 | u32 index; | ||
517 | unsigned long hw_flags; | ||
518 | |||
519 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); | ||
520 | |||
521 | pEEPROMData = (u16 *) & qdev->nvram_data; | ||
522 | qdev->eeprom_cmd_data = 0; | ||
523 | if(ql_sem_spinlock(qdev, QL_NVRAM_SEM_MASK, | ||
524 | (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) * | ||
525 | 2) << 10)) { | ||
526 | printk(KERN_ERR PFX"%s: Failed ql_sem_spinlock().\n", | ||
527 | __func__); | ||
528 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | ||
529 | return -1; | ||
530 | } | ||
531 | |||
532 | for (index = 0; index < EEPROM_SIZE; index++) { | ||
533 | eeprom_readword(qdev, index, pEEPROMData); | ||
534 | checksum += *pEEPROMData; | ||
535 | pEEPROMData++; | ||
536 | } | ||
537 | ql_sem_unlock(qdev, QL_NVRAM_SEM_MASK); | ||
538 | |||
539 | if (checksum != 0) { | ||
540 | printk(KERN_ERR PFX "%s: checksum should be zero, is %x!!\n", | ||
541 | qdev->ndev->name, checksum); | ||
542 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | ||
543 | return -1; | ||
544 | } | ||
545 | |||
546 | /* | ||
547 | * We have a problem with endianness for the MAC addresses | ||
548 | * and the two 8-bit values version, and numPorts. We | ||
549 | * have to swap them on big endian systems. | ||
550 | */ | ||
551 | ql_swap_mac_addr(qdev->nvram_data.funcCfg_fn0.macAddress); | ||
552 | ql_swap_mac_addr(qdev->nvram_data.funcCfg_fn1.macAddress); | ||
553 | ql_swap_mac_addr(qdev->nvram_data.funcCfg_fn2.macAddress); | ||
554 | ql_swap_mac_addr(qdev->nvram_data.funcCfg_fn3.macAddress); | ||
555 | pEEPROMData = (u16 *) & qdev->nvram_data.version; | ||
556 | *pEEPROMData = le16_to_cpu(*pEEPROMData); | ||
557 | |||
558 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | ||
559 | return checksum; | ||
560 | } | ||
561 | |||
562 | static const u32 PHYAddr[2] = { | ||
563 | PORT0_PHY_ADDRESS, PORT1_PHY_ADDRESS | ||
564 | }; | ||
565 | |||
566 | static int ql_wait_for_mii_ready(struct ql3_adapter *qdev) | ||
567 | { | ||
568 | struct ql3xxx_port_registers __iomem *port_regs = | ||
569 | qdev->mem_map_registers; | ||
570 | u32 temp; | ||
571 | int count = 1000; | ||
572 | |||
573 | while (count) { | ||
574 | temp = ql_read_page0_reg(qdev, &port_regs->macMIIStatusReg); | ||
575 | if (!(temp & MAC_MII_STATUS_BSY)) | ||
576 | return 0; | ||
577 | udelay(10); | ||
578 | count--; | ||
579 | } | ||
580 | return -1; | ||
581 | } | ||
582 | |||
583 | static void ql_mii_enable_scan_mode(struct ql3_adapter *qdev) | ||
584 | { | ||
585 | struct ql3xxx_port_registers __iomem *port_regs = | ||
586 | qdev->mem_map_registers; | ||
587 | u32 scanControl; | ||
588 | |||
589 | if (qdev->numPorts > 1) { | ||
590 | /* Auto scan will cycle through multiple ports */ | ||
591 | scanControl = MAC_MII_CONTROL_AS | MAC_MII_CONTROL_SC; | ||
592 | } else { | ||
593 | scanControl = MAC_MII_CONTROL_SC; | ||
594 | } | ||
595 | |||
596 | /* | ||
597 | * Scan register 1 of PHY/PETBI, | ||
598 | * Set up to scan both devices | ||
599 | * The autoscan starts from the first register, completes | ||
600 | * the last one before rolling over to the first | ||
601 | */ | ||
602 | ql_write_page0_reg(qdev, &port_regs->macMIIMgmtAddrReg, | ||
603 | PHYAddr[0] | MII_SCAN_REGISTER); | ||
604 | |||
605 | ql_write_page0_reg(qdev, &port_regs->macMIIMgmtControlReg, | ||
606 | (scanControl) | | ||
607 | ((MAC_MII_CONTROL_SC | MAC_MII_CONTROL_AS) << 16)); | ||
608 | } | ||
609 | |||
610 | static u8 ql_mii_disable_scan_mode(struct ql3_adapter *qdev) | ||
611 | { | ||
612 | u8 ret; | ||
613 | struct ql3xxx_port_registers __iomem *port_regs = | ||
614 | qdev->mem_map_registers; | ||
615 | |||
616 | /* See if scan mode is enabled before we turn it off */ | ||
617 | if (ql_read_page0_reg(qdev, &port_regs->macMIIMgmtControlReg) & | ||
618 | (MAC_MII_CONTROL_AS | MAC_MII_CONTROL_SC)) { | ||
619 | /* Scan is enabled */ | ||
620 | ret = 1; | ||
621 | } else { | ||
622 | /* Scan is disabled */ | ||
623 | ret = 0; | ||
624 | } | ||
625 | |||
626 | /* | ||
627 | * When disabling scan mode you must first change the MII register | ||
628 | * address | ||
629 | */ | ||
630 | ql_write_page0_reg(qdev, &port_regs->macMIIMgmtAddrReg, | ||
631 | PHYAddr[0] | MII_SCAN_REGISTER); | ||
632 | |||
633 | ql_write_page0_reg(qdev, &port_regs->macMIIMgmtControlReg, | ||
634 | ((MAC_MII_CONTROL_SC | MAC_MII_CONTROL_AS | | ||
635 | MAC_MII_CONTROL_RC) << 16)); | ||
636 | |||
637 | return ret; | ||
638 | } | ||
639 | |||
640 | static int ql_mii_write_reg_ex(struct ql3_adapter *qdev, | ||
641 | u16 regAddr, u16 value, u32 mac_index) | ||
642 | { | ||
643 | struct ql3xxx_port_registers __iomem *port_regs = | ||
644 | qdev->mem_map_registers; | ||
645 | u8 scanWasEnabled; | ||
646 | |||
647 | scanWasEnabled = ql_mii_disable_scan_mode(qdev); | ||
648 | |||
649 | if (ql_wait_for_mii_ready(qdev)) { | ||
650 | if (netif_msg_link(qdev)) | ||
651 | printk(KERN_WARNING PFX | ||
652 | "%s Timed out waiting for management port to " | ||
653 | "get free before issuing command.\n", | ||
654 | qdev->ndev->name); | ||
655 | return -1; | ||
656 | } | ||
657 | |||
658 | ql_write_page0_reg(qdev, &port_regs->macMIIMgmtAddrReg, | ||
659 | PHYAddr[mac_index] | regAddr); | ||
660 | |||
661 | ql_write_page0_reg(qdev, &port_regs->macMIIMgmtDataReg, value); | ||
662 | |||
663 | /* Wait for write to complete 9/10/04 SJP */ | ||
664 | if (ql_wait_for_mii_ready(qdev)) { | ||
665 | if (netif_msg_link(qdev)) | ||
666 | printk(KERN_WARNING PFX | ||
667 | "%s: Timed out waiting for management port to" | ||
668 | "get free before issuing command.\n", | ||
669 | qdev->ndev->name); | ||
670 | return -1; | ||
671 | } | ||
672 | |||
673 | if (scanWasEnabled) | ||
674 | ql_mii_enable_scan_mode(qdev); | ||
675 | |||
676 | return 0; | ||
677 | } | ||
678 | |||
679 | static int ql_mii_read_reg_ex(struct ql3_adapter *qdev, u16 regAddr, | ||
680 | u16 * value, u32 mac_index) | ||
681 | { | ||
682 | struct ql3xxx_port_registers __iomem *port_regs = | ||
683 | qdev->mem_map_registers; | ||
684 | u8 scanWasEnabled; | ||
685 | u32 temp; | ||
686 | |||
687 | scanWasEnabled = ql_mii_disable_scan_mode(qdev); | ||
688 | |||
689 | if (ql_wait_for_mii_ready(qdev)) { | ||
690 | if (netif_msg_link(qdev)) | ||
691 | printk(KERN_WARNING PFX | ||
692 | "%s: Timed out waiting for management port to " | ||
693 | "get free before issuing command.\n", | ||
694 | qdev->ndev->name); | ||
695 | return -1; | ||
696 | } | ||
697 | |||
698 | ql_write_page0_reg(qdev, &port_regs->macMIIMgmtAddrReg, | ||
699 | PHYAddr[mac_index] | regAddr); | ||
700 | |||
701 | ql_write_page0_reg(qdev, &port_regs->macMIIMgmtControlReg, | ||
702 | (MAC_MII_CONTROL_RC << 16)); | ||
703 | |||
704 | ql_write_page0_reg(qdev, &port_regs->macMIIMgmtControlReg, | ||
705 | (MAC_MII_CONTROL_RC << 16) | MAC_MII_CONTROL_RC); | ||
706 | |||
707 | /* Wait for the read to complete */ | ||
708 | if (ql_wait_for_mii_ready(qdev)) { | ||
709 | if (netif_msg_link(qdev)) | ||
710 | printk(KERN_WARNING PFX | ||
711 | "%s: Timed out waiting for management port to " | ||
712 | "get free after issuing command.\n", | ||
713 | qdev->ndev->name); | ||
714 | return -1; | ||
715 | } | ||
716 | |||
717 | temp = ql_read_page0_reg(qdev, &port_regs->macMIIMgmtDataReg); | ||
718 | *value = (u16) temp; | ||
719 | |||
720 | if (scanWasEnabled) | ||
721 | ql_mii_enable_scan_mode(qdev); | ||
722 | |||
723 | return 0; | ||
724 | } | ||
725 | |||
726 | static int ql_mii_write_reg(struct ql3_adapter *qdev, u16 regAddr, u16 value) | ||
727 | { | ||
728 | struct ql3xxx_port_registers __iomem *port_regs = | ||
729 | qdev->mem_map_registers; | ||
730 | |||
731 | ql_mii_disable_scan_mode(qdev); | ||
732 | |||
733 | if (ql_wait_for_mii_ready(qdev)) { | ||
734 | if (netif_msg_link(qdev)) | ||
735 | printk(KERN_WARNING PFX | ||
736 | "%s: Timed out waiting for management port to " | ||
737 | "get free before issuing command.\n", | ||
738 | qdev->ndev->name); | ||
739 | return -1; | ||
740 | } | ||
741 | |||
742 | ql_write_page0_reg(qdev, &port_regs->macMIIMgmtAddrReg, | ||
743 | qdev->PHYAddr | regAddr); | ||
744 | |||
745 | ql_write_page0_reg(qdev, &port_regs->macMIIMgmtDataReg, value); | ||
746 | |||
747 | /* Wait for write to complete. */ | ||
748 | if (ql_wait_for_mii_ready(qdev)) { | ||
749 | if (netif_msg_link(qdev)) | ||
750 | printk(KERN_WARNING PFX | ||
751 | "%s: Timed out waiting for management port to " | ||
752 | "get free before issuing command.\n", | ||
753 | qdev->ndev->name); | ||
754 | return -1; | ||
755 | } | ||
756 | |||
757 | ql_mii_enable_scan_mode(qdev); | ||
758 | |||
759 | return 0; | ||
760 | } | ||
761 | |||
762 | static int ql_mii_read_reg(struct ql3_adapter *qdev, u16 regAddr, u16 *value) | ||
763 | { | ||
764 | u32 temp; | ||
765 | struct ql3xxx_port_registers __iomem *port_regs = | ||
766 | qdev->mem_map_registers; | ||
767 | |||
768 | ql_mii_disable_scan_mode(qdev); | ||
769 | |||
770 | if (ql_wait_for_mii_ready(qdev)) { | ||
771 | if (netif_msg_link(qdev)) | ||
772 | printk(KERN_WARNING PFX | ||
773 | "%s: Timed out waiting for management port to " | ||
774 | "get free before issuing command.\n", | ||
775 | qdev->ndev->name); | ||
776 | return -1; | ||
777 | } | ||
778 | |||
779 | ql_write_page0_reg(qdev, &port_regs->macMIIMgmtAddrReg, | ||
780 | qdev->PHYAddr | regAddr); | ||
781 | |||
782 | ql_write_page0_reg(qdev, &port_regs->macMIIMgmtControlReg, | ||
783 | (MAC_MII_CONTROL_RC << 16)); | ||
784 | |||
785 | ql_write_page0_reg(qdev, &port_regs->macMIIMgmtControlReg, | ||
786 | (MAC_MII_CONTROL_RC << 16) | MAC_MII_CONTROL_RC); | ||
787 | |||
788 | /* Wait for the read to complete */ | ||
789 | if (ql_wait_for_mii_ready(qdev)) { | ||
790 | if (netif_msg_link(qdev)) | ||
791 | printk(KERN_WARNING PFX | ||
792 | "%s: Timed out waiting for management port to " | ||
793 | "get free before issuing command.\n", | ||
794 | qdev->ndev->name); | ||
795 | return -1; | ||
796 | } | ||
797 | |||
798 | temp = ql_read_page0_reg(qdev, &port_regs->macMIIMgmtDataReg); | ||
799 | *value = (u16) temp; | ||
800 | |||
801 | ql_mii_enable_scan_mode(qdev); | ||
802 | |||
803 | return 0; | ||
804 | } | ||
805 | |||
806 | static void ql_petbi_reset(struct ql3_adapter *qdev) | ||
807 | { | ||
808 | ql_mii_write_reg(qdev, PETBI_CONTROL_REG, PETBI_CTRL_SOFT_RESET); | ||
809 | } | ||
810 | |||
811 | static void ql_petbi_start_neg(struct ql3_adapter *qdev) | ||
812 | { | ||
813 | u16 reg; | ||
814 | |||
815 | /* Enable Auto-negotiation sense */ | ||
816 | ql_mii_read_reg(qdev, PETBI_TBI_CTRL, ®); | ||
817 | reg |= PETBI_TBI_AUTO_SENSE; | ||
818 | ql_mii_write_reg(qdev, PETBI_TBI_CTRL, reg); | ||
819 | |||
820 | ql_mii_write_reg(qdev, PETBI_NEG_ADVER, | ||
821 | PETBI_NEG_PAUSE | PETBI_NEG_DUPLEX); | ||
822 | |||
823 | ql_mii_write_reg(qdev, PETBI_CONTROL_REG, | ||
824 | PETBI_CTRL_AUTO_NEG | PETBI_CTRL_RESTART_NEG | | ||
825 | PETBI_CTRL_FULL_DUPLEX | PETBI_CTRL_SPEED_1000); | ||
826 | |||
827 | } | ||
828 | |||
829 | static void ql_petbi_reset_ex(struct ql3_adapter *qdev, u32 mac_index) | ||
830 | { | ||
831 | ql_mii_write_reg_ex(qdev, PETBI_CONTROL_REG, PETBI_CTRL_SOFT_RESET, | ||
832 | mac_index); | ||
833 | } | ||
834 | |||
835 | static void ql_petbi_start_neg_ex(struct ql3_adapter *qdev, u32 mac_index) | ||
836 | { | ||
837 | u16 reg; | ||
838 | |||
839 | /* Enable Auto-negotiation sense */ | ||
840 | ql_mii_read_reg_ex(qdev, PETBI_TBI_CTRL, ®, mac_index); | ||
841 | reg |= PETBI_TBI_AUTO_SENSE; | ||
842 | ql_mii_write_reg_ex(qdev, PETBI_TBI_CTRL, reg, mac_index); | ||
843 | |||
844 | ql_mii_write_reg_ex(qdev, PETBI_NEG_ADVER, | ||
845 | PETBI_NEG_PAUSE | PETBI_NEG_DUPLEX, mac_index); | ||
846 | |||
847 | ql_mii_write_reg_ex(qdev, PETBI_CONTROL_REG, | ||
848 | PETBI_CTRL_AUTO_NEG | PETBI_CTRL_RESTART_NEG | | ||
849 | PETBI_CTRL_FULL_DUPLEX | PETBI_CTRL_SPEED_1000, | ||
850 | mac_index); | ||
851 | } | ||
852 | |||
853 | static void ql_petbi_init(struct ql3_adapter *qdev) | ||
854 | { | ||
855 | ql_petbi_reset(qdev); | ||
856 | ql_petbi_start_neg(qdev); | ||
857 | } | ||
858 | |||
859 | static void ql_petbi_init_ex(struct ql3_adapter *qdev, u32 mac_index) | ||
860 | { | ||
861 | ql_petbi_reset_ex(qdev, mac_index); | ||
862 | ql_petbi_start_neg_ex(qdev, mac_index); | ||
863 | } | ||
864 | |||
865 | static int ql_is_petbi_neg_pause(struct ql3_adapter *qdev) | ||
866 | { | ||
867 | u16 reg; | ||
868 | |||
869 | if (ql_mii_read_reg(qdev, PETBI_NEG_PARTNER, ®) < 0) | ||
870 | return 0; | ||
871 | |||
872 | return (reg & PETBI_NEG_PAUSE_MASK) == PETBI_NEG_PAUSE; | ||
873 | } | ||
874 | |||
875 | static int ql_phy_get_speed(struct ql3_adapter *qdev) | ||
876 | { | ||
877 | u16 reg; | ||
878 | |||
879 | if (ql_mii_read_reg(qdev, AUX_CONTROL_STATUS, ®) < 0) | ||
880 | return 0; | ||
881 | |||
882 | reg = (((reg & 0x18) >> 3) & 3); | ||
883 | |||
884 | if (reg == 2) | ||
885 | return SPEED_1000; | ||
886 | else if (reg == 1) | ||
887 | return SPEED_100; | ||
888 | else if (reg == 0) | ||
889 | return SPEED_10; | ||
890 | else | ||
891 | return -1; | ||
892 | } | ||
893 | |||
894 | static int ql_is_full_dup(struct ql3_adapter *qdev) | ||
895 | { | ||
896 | u16 reg; | ||
897 | |||
898 | if (ql_mii_read_reg(qdev, AUX_CONTROL_STATUS, ®) < 0) | ||
899 | return 0; | ||
900 | |||
901 | return (reg & PHY_AUX_DUPLEX_STAT) != 0; | ||
902 | } | ||
903 | |||
904 | static int ql_is_phy_neg_pause(struct ql3_adapter *qdev) | ||
905 | { | ||
906 | u16 reg; | ||
907 | |||
908 | if (ql_mii_read_reg(qdev, PHY_NEG_PARTNER, ®) < 0) | ||
909 | return 0; | ||
910 | |||
911 | return (reg & PHY_NEG_PAUSE) != 0; | ||
912 | } | ||
913 | |||
914 | /* | ||
915 | * Caller holds hw_lock. | ||
916 | */ | ||
917 | static void ql_mac_enable(struct ql3_adapter *qdev, u32 enable) | ||
918 | { | ||
919 | struct ql3xxx_port_registers __iomem *port_regs = | ||
920 | qdev->mem_map_registers; | ||
921 | u32 value; | ||
922 | |||
923 | if (enable) | ||
924 | value = (MAC_CONFIG_REG_PE | (MAC_CONFIG_REG_PE << 16)); | ||
925 | else | ||
926 | value = (MAC_CONFIG_REG_PE << 16); | ||
927 | |||
928 | if (qdev->mac_index) | ||
929 | ql_write_page0_reg(qdev, &port_regs->mac1ConfigReg, value); | ||
930 | else | ||
931 | ql_write_page0_reg(qdev, &port_regs->mac0ConfigReg, value); | ||
932 | } | ||
933 | |||
934 | /* | ||
935 | * Caller holds hw_lock. | ||
936 | */ | ||
937 | static void ql_mac_cfg_soft_reset(struct ql3_adapter *qdev, u32 enable) | ||
938 | { | ||
939 | struct ql3xxx_port_registers __iomem *port_regs = | ||
940 | qdev->mem_map_registers; | ||
941 | u32 value; | ||
942 | |||
943 | if (enable) | ||
944 | value = (MAC_CONFIG_REG_SR | (MAC_CONFIG_REG_SR << 16)); | ||
945 | else | ||
946 | value = (MAC_CONFIG_REG_SR << 16); | ||
947 | |||
948 | if (qdev->mac_index) | ||
949 | ql_write_page0_reg(qdev, &port_regs->mac1ConfigReg, value); | ||
950 | else | ||
951 | ql_write_page0_reg(qdev, &port_regs->mac0ConfigReg, value); | ||
952 | } | ||
953 | |||
954 | /* | ||
955 | * Caller holds hw_lock. | ||
956 | */ | ||
957 | static void ql_mac_cfg_gig(struct ql3_adapter *qdev, u32 enable) | ||
958 | { | ||
959 | struct ql3xxx_port_registers __iomem *port_regs = | ||
960 | qdev->mem_map_registers; | ||
961 | u32 value; | ||
962 | |||
963 | if (enable) | ||
964 | value = (MAC_CONFIG_REG_GM | (MAC_CONFIG_REG_GM << 16)); | ||
965 | else | ||
966 | value = (MAC_CONFIG_REG_GM << 16); | ||
967 | |||
968 | if (qdev->mac_index) | ||
969 | ql_write_page0_reg(qdev, &port_regs->mac1ConfigReg, value); | ||
970 | else | ||
971 | ql_write_page0_reg(qdev, &port_regs->mac0ConfigReg, value); | ||
972 | } | ||
973 | |||
974 | /* | ||
975 | * Caller holds hw_lock. | ||
976 | */ | ||
977 | static void ql_mac_cfg_full_dup(struct ql3_adapter *qdev, u32 enable) | ||
978 | { | ||
979 | struct ql3xxx_port_registers __iomem *port_regs = | ||
980 | qdev->mem_map_registers; | ||
981 | u32 value; | ||
982 | |||
983 | if (enable) | ||
984 | value = (MAC_CONFIG_REG_FD | (MAC_CONFIG_REG_FD << 16)); | ||
985 | else | ||
986 | value = (MAC_CONFIG_REG_FD << 16); | ||
987 | |||
988 | if (qdev->mac_index) | ||
989 | ql_write_page0_reg(qdev, &port_regs->mac1ConfigReg, value); | ||
990 | else | ||
991 | ql_write_page0_reg(qdev, &port_regs->mac0ConfigReg, value); | ||
992 | } | ||
993 | |||
994 | /* | ||
995 | * Caller holds hw_lock. | ||
996 | */ | ||
997 | static void ql_mac_cfg_pause(struct ql3_adapter *qdev, u32 enable) | ||
998 | { | ||
999 | struct ql3xxx_port_registers __iomem *port_regs = | ||
1000 | qdev->mem_map_registers; | ||
1001 | u32 value; | ||
1002 | |||
1003 | if (enable) | ||
1004 | value = | ||
1005 | ((MAC_CONFIG_REG_TF | MAC_CONFIG_REG_RF) | | ||
1006 | ((MAC_CONFIG_REG_TF | MAC_CONFIG_REG_RF) << 16)); | ||
1007 | else | ||
1008 | value = ((MAC_CONFIG_REG_TF | MAC_CONFIG_REG_RF) << 16); | ||
1009 | |||
1010 | if (qdev->mac_index) | ||
1011 | ql_write_page0_reg(qdev, &port_regs->mac1ConfigReg, value); | ||
1012 | else | ||
1013 | ql_write_page0_reg(qdev, &port_regs->mac0ConfigReg, value); | ||
1014 | } | ||
1015 | |||
1016 | /* | ||
1017 | * Caller holds hw_lock. | ||
1018 | */ | ||
1019 | static int ql_is_fiber(struct ql3_adapter *qdev) | ||
1020 | { | ||
1021 | struct ql3xxx_port_registers __iomem *port_regs = | ||
1022 | qdev->mem_map_registers; | ||
1023 | u32 bitToCheck = 0; | ||
1024 | u32 temp; | ||
1025 | |||
1026 | switch (qdev->mac_index) { | ||
1027 | case 0: | ||
1028 | bitToCheck = PORT_STATUS_SM0; | ||
1029 | break; | ||
1030 | case 1: | ||
1031 | bitToCheck = PORT_STATUS_SM1; | ||
1032 | break; | ||
1033 | } | ||
1034 | |||
1035 | temp = ql_read_page0_reg(qdev, &port_regs->portStatus); | ||
1036 | return (temp & bitToCheck) != 0; | ||
1037 | } | ||
1038 | |||
1039 | static int ql_is_auto_cfg(struct ql3_adapter *qdev) | ||
1040 | { | ||
1041 | u16 reg; | ||
1042 | ql_mii_read_reg(qdev, 0x00, ®); | ||
1043 | return (reg & 0x1000) != 0; | ||
1044 | } | ||
1045 | |||
1046 | /* | ||
1047 | * Caller holds hw_lock. | ||
1048 | */ | ||
1049 | static int ql_is_auto_neg_complete(struct ql3_adapter *qdev) | ||
1050 | { | ||
1051 | struct ql3xxx_port_registers __iomem *port_regs = | ||
1052 | qdev->mem_map_registers; | ||
1053 | u32 bitToCheck = 0; | ||
1054 | u32 temp; | ||
1055 | |||
1056 | switch (qdev->mac_index) { | ||
1057 | case 0: | ||
1058 | bitToCheck = PORT_STATUS_AC0; | ||
1059 | break; | ||
1060 | case 1: | ||
1061 | bitToCheck = PORT_STATUS_AC1; | ||
1062 | break; | ||
1063 | } | ||
1064 | |||
1065 | temp = ql_read_page0_reg(qdev, &port_regs->portStatus); | ||
1066 | if (temp & bitToCheck) { | ||
1067 | if (netif_msg_link(qdev)) | ||
1068 | printk(KERN_INFO PFX | ||
1069 | "%s: Auto-Negotiate complete.\n", | ||
1070 | qdev->ndev->name); | ||
1071 | return 1; | ||
1072 | } else { | ||
1073 | if (netif_msg_link(qdev)) | ||
1074 | printk(KERN_WARNING PFX | ||
1075 | "%s: Auto-Negotiate incomplete.\n", | ||
1076 | qdev->ndev->name); | ||
1077 | return 0; | ||
1078 | } | ||
1079 | } | ||
1080 | |||
1081 | /* | ||
1082 | * ql_is_neg_pause() returns 1 if pause was negotiated to be on | ||
1083 | */ | ||
1084 | static int ql_is_neg_pause(struct ql3_adapter *qdev) | ||
1085 | { | ||
1086 | if (ql_is_fiber(qdev)) | ||
1087 | return ql_is_petbi_neg_pause(qdev); | ||
1088 | else | ||
1089 | return ql_is_phy_neg_pause(qdev); | ||
1090 | } | ||
1091 | |||
1092 | static int ql_auto_neg_error(struct ql3_adapter *qdev) | ||
1093 | { | ||
1094 | struct ql3xxx_port_registers __iomem *port_regs = | ||
1095 | qdev->mem_map_registers; | ||
1096 | u32 bitToCheck = 0; | ||
1097 | u32 temp; | ||
1098 | |||
1099 | switch (qdev->mac_index) { | ||
1100 | case 0: | ||
1101 | bitToCheck = PORT_STATUS_AE0; | ||
1102 | break; | ||
1103 | case 1: | ||
1104 | bitToCheck = PORT_STATUS_AE1; | ||
1105 | break; | ||
1106 | } | ||
1107 | temp = ql_read_page0_reg(qdev, &port_regs->portStatus); | ||
1108 | return (temp & bitToCheck) != 0; | ||
1109 | } | ||
1110 | |||
1111 | static u32 ql_get_link_speed(struct ql3_adapter *qdev) | ||
1112 | { | ||
1113 | if (ql_is_fiber(qdev)) | ||
1114 | return SPEED_1000; | ||
1115 | else | ||
1116 | return ql_phy_get_speed(qdev); | ||
1117 | } | ||
1118 | |||
1119 | static int ql_is_link_full_dup(struct ql3_adapter *qdev) | ||
1120 | { | ||
1121 | if (ql_is_fiber(qdev)) | ||
1122 | return 1; | ||
1123 | else | ||
1124 | return ql_is_full_dup(qdev); | ||
1125 | } | ||
1126 | |||
1127 | /* | ||
1128 | * Caller holds hw_lock. | ||
1129 | */ | ||
1130 | static int ql_link_down_detect(struct ql3_adapter *qdev) | ||
1131 | { | ||
1132 | struct ql3xxx_port_registers __iomem *port_regs = | ||
1133 | qdev->mem_map_registers; | ||
1134 | u32 bitToCheck = 0; | ||
1135 | u32 temp; | ||
1136 | |||
1137 | switch (qdev->mac_index) { | ||
1138 | case 0: | ||
1139 | bitToCheck = ISP_CONTROL_LINK_DN_0; | ||
1140 | break; | ||
1141 | case 1: | ||
1142 | bitToCheck = ISP_CONTROL_LINK_DN_1; | ||
1143 | break; | ||
1144 | } | ||
1145 | |||
1146 | temp = | ||
1147 | ql_read_common_reg(qdev, &port_regs->CommonRegs.ispControlStatus); | ||
1148 | return (temp & bitToCheck) != 0; | ||
1149 | } | ||
1150 | |||
1151 | /* | ||
1152 | * Caller holds hw_lock. | ||
1153 | */ | ||
1154 | static int ql_link_down_detect_clear(struct ql3_adapter *qdev) | ||
1155 | { | ||
1156 | struct ql3xxx_port_registers __iomem *port_regs = | ||
1157 | qdev->mem_map_registers; | ||
1158 | |||
1159 | switch (qdev->mac_index) { | ||
1160 | case 0: | ||
1161 | ql_write_common_reg(qdev, | ||
1162 | &port_regs->CommonRegs.ispControlStatus, | ||
1163 | (ISP_CONTROL_LINK_DN_0) | | ||
1164 | (ISP_CONTROL_LINK_DN_0 << 16)); | ||
1165 | break; | ||
1166 | |||
1167 | case 1: | ||
1168 | ql_write_common_reg(qdev, | ||
1169 | &port_regs->CommonRegs.ispControlStatus, | ||
1170 | (ISP_CONTROL_LINK_DN_1) | | ||
1171 | (ISP_CONTROL_LINK_DN_1 << 16)); | ||
1172 | break; | ||
1173 | |||
1174 | default: | ||
1175 | return 1; | ||
1176 | } | ||
1177 | |||
1178 | return 0; | ||
1179 | } | ||
1180 | |||
1181 | /* | ||
1182 | * Caller holds hw_lock. | ||
1183 | */ | ||
1184 | static int ql_this_adapter_controls_port(struct ql3_adapter *qdev, | ||
1185 | u32 mac_index) | ||
1186 | { | ||
1187 | struct ql3xxx_port_registers __iomem *port_regs = | ||
1188 | qdev->mem_map_registers; | ||
1189 | u32 bitToCheck = 0; | ||
1190 | u32 temp; | ||
1191 | |||
1192 | switch (mac_index) { | ||
1193 | case 0: | ||
1194 | bitToCheck = PORT_STATUS_F1_ENABLED; | ||
1195 | break; | ||
1196 | case 1: | ||
1197 | bitToCheck = PORT_STATUS_F3_ENABLED; | ||
1198 | break; | ||
1199 | default: | ||
1200 | break; | ||
1201 | } | ||
1202 | |||
1203 | temp = ql_read_page0_reg(qdev, &port_regs->portStatus); | ||
1204 | if (temp & bitToCheck) { | ||
1205 | if (netif_msg_link(qdev)) | ||
1206 | printk(KERN_DEBUG PFX | ||
1207 | "%s: is not link master.\n", qdev->ndev->name); | ||
1208 | return 0; | ||
1209 | } else { | ||
1210 | if (netif_msg_link(qdev)) | ||
1211 | printk(KERN_DEBUG PFX | ||
1212 | "%s: is link master.\n", qdev->ndev->name); | ||
1213 | return 1; | ||
1214 | } | ||
1215 | } | ||
1216 | |||
1217 | static void ql_phy_reset_ex(struct ql3_adapter *qdev, u32 mac_index) | ||
1218 | { | ||
1219 | ql_mii_write_reg_ex(qdev, CONTROL_REG, PHY_CTRL_SOFT_RESET, mac_index); | ||
1220 | } | ||
1221 | |||
1222 | static void ql_phy_start_neg_ex(struct ql3_adapter *qdev, u32 mac_index) | ||
1223 | { | ||
1224 | u16 reg; | ||
1225 | |||
1226 | ql_mii_write_reg_ex(qdev, PHY_NEG_ADVER, | ||
1227 | PHY_NEG_PAUSE | PHY_NEG_ADV_SPEED | 1, mac_index); | ||
1228 | |||
1229 | ql_mii_read_reg_ex(qdev, CONTROL_REG, ®, mac_index); | ||
1230 | ql_mii_write_reg_ex(qdev, CONTROL_REG, reg | PHY_CTRL_RESTART_NEG, | ||
1231 | mac_index); | ||
1232 | } | ||
1233 | |||
1234 | static void ql_phy_init_ex(struct ql3_adapter *qdev, u32 mac_index) | ||
1235 | { | ||
1236 | ql_phy_reset_ex(qdev, mac_index); | ||
1237 | ql_phy_start_neg_ex(qdev, mac_index); | ||
1238 | } | ||
1239 | |||
1240 | /* | ||
1241 | * Caller holds hw_lock. | ||
1242 | */ | ||
1243 | static u32 ql_get_link_state(struct ql3_adapter *qdev) | ||
1244 | { | ||
1245 | struct ql3xxx_port_registers __iomem *port_regs = | ||
1246 | qdev->mem_map_registers; | ||
1247 | u32 bitToCheck = 0; | ||
1248 | u32 temp, linkState; | ||
1249 | |||
1250 | switch (qdev->mac_index) { | ||
1251 | case 0: | ||
1252 | bitToCheck = PORT_STATUS_UP0; | ||
1253 | break; | ||
1254 | case 1: | ||
1255 | bitToCheck = PORT_STATUS_UP1; | ||
1256 | break; | ||
1257 | } | ||
1258 | temp = ql_read_page0_reg(qdev, &port_regs->portStatus); | ||
1259 | if (temp & bitToCheck) { | ||
1260 | linkState = LS_UP; | ||
1261 | } else { | ||
1262 | linkState = LS_DOWN; | ||
1263 | if (netif_msg_link(qdev)) | ||
1264 | printk(KERN_WARNING PFX | ||
1265 | "%s: Link is down.\n", qdev->ndev->name); | ||
1266 | } | ||
1267 | return linkState; | ||
1268 | } | ||
1269 | |||
1270 | static int ql_port_start(struct ql3_adapter *qdev) | ||
1271 | { | ||
1272 | if(ql_sem_spinlock(qdev, QL_PHY_GIO_SEM_MASK, | ||
1273 | (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) * | ||
1274 | 2) << 7)) | ||
1275 | return -1; | ||
1276 | |||
1277 | if (ql_is_fiber(qdev)) { | ||
1278 | ql_petbi_init(qdev); | ||
1279 | } else { | ||
1280 | /* Copper port */ | ||
1281 | ql_phy_init_ex(qdev, qdev->mac_index); | ||
1282 | } | ||
1283 | |||
1284 | ql_sem_unlock(qdev, QL_PHY_GIO_SEM_MASK); | ||
1285 | return 0; | ||
1286 | } | ||
1287 | |||
1288 | static int ql_finish_auto_neg(struct ql3_adapter *qdev) | ||
1289 | { | ||
1290 | |||
1291 | if(ql_sem_spinlock(qdev, QL_PHY_GIO_SEM_MASK, | ||
1292 | (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) * | ||
1293 | 2) << 7)) | ||
1294 | return -1; | ||
1295 | |||
1296 | if (!ql_auto_neg_error(qdev)) { | ||
1297 | if (test_bit(QL_LINK_MASTER,&qdev->flags)) { | ||
1298 | /* configure the MAC */ | ||
1299 | if (netif_msg_link(qdev)) | ||
1300 | printk(KERN_DEBUG PFX | ||
1301 | "%s: Configuring link.\n", | ||
1302 | qdev->ndev-> | ||
1303 | name); | ||
1304 | ql_mac_cfg_soft_reset(qdev, 1); | ||
1305 | ql_mac_cfg_gig(qdev, | ||
1306 | (ql_get_link_speed | ||
1307 | (qdev) == | ||
1308 | SPEED_1000)); | ||
1309 | ql_mac_cfg_full_dup(qdev, | ||
1310 | ql_is_link_full_dup | ||
1311 | (qdev)); | ||
1312 | ql_mac_cfg_pause(qdev, | ||
1313 | ql_is_neg_pause | ||
1314 | (qdev)); | ||
1315 | ql_mac_cfg_soft_reset(qdev, 0); | ||
1316 | |||
1317 | /* enable the MAC */ | ||
1318 | if (netif_msg_link(qdev)) | ||
1319 | printk(KERN_DEBUG PFX | ||
1320 | "%s: Enabling mac.\n", | ||
1321 | qdev->ndev-> | ||
1322 | name); | ||
1323 | ql_mac_enable(qdev, 1); | ||
1324 | } | ||
1325 | |||
1326 | if (netif_msg_link(qdev)) | ||
1327 | printk(KERN_DEBUG PFX | ||
1328 | "%s: Change port_link_state LS_DOWN to LS_UP.\n", | ||
1329 | qdev->ndev->name); | ||
1330 | qdev->port_link_state = LS_UP; | ||
1331 | netif_start_queue(qdev->ndev); | ||
1332 | netif_carrier_on(qdev->ndev); | ||
1333 | if (netif_msg_link(qdev)) | ||
1334 | printk(KERN_INFO PFX | ||
1335 | "%s: Link is up at %d Mbps, %s duplex.\n", | ||
1336 | qdev->ndev->name, | ||
1337 | ql_get_link_speed(qdev), | ||
1338 | ql_is_link_full_dup(qdev) | ||
1339 | ? "full" : "half"); | ||
1340 | |||
1341 | } else { /* Remote error detected */ | ||
1342 | |||
1343 | if (test_bit(QL_LINK_MASTER,&qdev->flags)) { | ||
1344 | if (netif_msg_link(qdev)) | ||
1345 | printk(KERN_DEBUG PFX | ||
1346 | "%s: Remote error detected. " | ||
1347 | "Calling ql_port_start().\n", | ||
1348 | qdev->ndev-> | ||
1349 | name); | ||
1350 | /* | ||
1351 | * ql_port_start() is shared code and needs | ||
1352 | * to lock the PHY on it's own. | ||
1353 | */ | ||
1354 | ql_sem_unlock(qdev, QL_PHY_GIO_SEM_MASK); | ||
1355 | if(ql_port_start(qdev)) {/* Restart port */ | ||
1356 | return -1; | ||
1357 | } else | ||
1358 | return 0; | ||
1359 | } | ||
1360 | } | ||
1361 | ql_sem_unlock(qdev, QL_PHY_GIO_SEM_MASK); | ||
1362 | return 0; | ||
1363 | } | ||
1364 | |||
1365 | static void ql_link_state_machine(struct ql3_adapter *qdev) | ||
1366 | { | ||
1367 | u32 curr_link_state; | ||
1368 | unsigned long hw_flags; | ||
1369 | |||
1370 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); | ||
1371 | |||
1372 | curr_link_state = ql_get_link_state(qdev); | ||
1373 | |||
1374 | if (test_bit(QL_RESET_ACTIVE,&qdev->flags)) { | ||
1375 | if (netif_msg_link(qdev)) | ||
1376 | printk(KERN_INFO PFX | ||
1377 | "%s: Reset in progress, skip processing link " | ||
1378 | "state.\n", qdev->ndev->name); | ||
1379 | return; | ||
1380 | } | ||
1381 | |||
1382 | switch (qdev->port_link_state) { | ||
1383 | default: | ||
1384 | if (test_bit(QL_LINK_MASTER,&qdev->flags)) { | ||
1385 | ql_port_start(qdev); | ||
1386 | } | ||
1387 | qdev->port_link_state = LS_DOWN; | ||
1388 | /* Fall Through */ | ||
1389 | |||
1390 | case LS_DOWN: | ||
1391 | if (netif_msg_link(qdev)) | ||
1392 | printk(KERN_DEBUG PFX | ||
1393 | "%s: port_link_state = LS_DOWN.\n", | ||
1394 | qdev->ndev->name); | ||
1395 | if (curr_link_state == LS_UP) { | ||
1396 | if (netif_msg_link(qdev)) | ||
1397 | printk(KERN_DEBUG PFX | ||
1398 | "%s: curr_link_state = LS_UP.\n", | ||
1399 | qdev->ndev->name); | ||
1400 | if (ql_is_auto_neg_complete(qdev)) | ||
1401 | ql_finish_auto_neg(qdev); | ||
1402 | |||
1403 | if (qdev->port_link_state == LS_UP) | ||
1404 | ql_link_down_detect_clear(qdev); | ||
1405 | |||
1406 | } | ||
1407 | break; | ||
1408 | |||
1409 | case LS_UP: | ||
1410 | /* | ||
1411 | * See if the link is currently down or went down and came | ||
1412 | * back up | ||
1413 | */ | ||
1414 | if ((curr_link_state == LS_DOWN) || ql_link_down_detect(qdev)) { | ||
1415 | if (netif_msg_link(qdev)) | ||
1416 | printk(KERN_INFO PFX "%s: Link is down.\n", | ||
1417 | qdev->ndev->name); | ||
1418 | qdev->port_link_state = LS_DOWN; | ||
1419 | } | ||
1420 | break; | ||
1421 | } | ||
1422 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | ||
1423 | } | ||
1424 | |||
1425 | /* | ||
1426 | * Caller must take hw_lock and QL_PHY_GIO_SEM. | ||
1427 | */ | ||
1428 | static void ql_get_phy_owner(struct ql3_adapter *qdev) | ||
1429 | { | ||
1430 | if (ql_this_adapter_controls_port(qdev, qdev->mac_index)) | ||
1431 | set_bit(QL_LINK_MASTER,&qdev->flags); | ||
1432 | else | ||
1433 | clear_bit(QL_LINK_MASTER,&qdev->flags); | ||
1434 | } | ||
1435 | |||
1436 | /* | ||
1437 | * Caller must take hw_lock and QL_PHY_GIO_SEM. | ||
1438 | */ | ||
1439 | static void ql_init_scan_mode(struct ql3_adapter *qdev) | ||
1440 | { | ||
1441 | ql_mii_enable_scan_mode(qdev); | ||
1442 | |||
1443 | if (test_bit(QL_LINK_OPTICAL,&qdev->flags)) { | ||
1444 | if (ql_this_adapter_controls_port(qdev, qdev->mac_index)) | ||
1445 | ql_petbi_init_ex(qdev, qdev->mac_index); | ||
1446 | } else { | ||
1447 | if (ql_this_adapter_controls_port(qdev, qdev->mac_index)) | ||
1448 | ql_phy_init_ex(qdev, qdev->mac_index); | ||
1449 | } | ||
1450 | } | ||
1451 | |||
1452 | /* | ||
1453 | * MII_Setup needs to be called before taking the PHY out of reset so that the | ||
1454 | * management interface clock speed can be set properly. It would be better if | ||
1455 | * we had a way to disable MDC until after the PHY is out of reset, but we | ||
1456 | * don't have that capability. | ||
1457 | */ | ||
1458 | static int ql_mii_setup(struct ql3_adapter *qdev) | ||
1459 | { | ||
1460 | u32 reg; | ||
1461 | struct ql3xxx_port_registers __iomem *port_regs = | ||
1462 | qdev->mem_map_registers; | ||
1463 | |||
1464 | if(ql_sem_spinlock(qdev, QL_PHY_GIO_SEM_MASK, | ||
1465 | (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) * | ||
1466 | 2) << 7)) | ||
1467 | return -1; | ||
1468 | |||
1469 | /* Divide 125MHz clock by 28 to meet PHY timing requirements */ | ||
1470 | reg = MAC_MII_CONTROL_CLK_SEL_DIV28; | ||
1471 | |||
1472 | ql_write_page0_reg(qdev, &port_regs->macMIIMgmtControlReg, | ||
1473 | reg | ((MAC_MII_CONTROL_CLK_SEL_MASK) << 16)); | ||
1474 | |||
1475 | ql_sem_unlock(qdev, QL_PHY_GIO_SEM_MASK); | ||
1476 | return 0; | ||
1477 | } | ||
1478 | |||
1479 | static u32 ql_supported_modes(struct ql3_adapter *qdev) | ||
1480 | { | ||
1481 | u32 supported; | ||
1482 | |||
1483 | if (test_bit(QL_LINK_OPTICAL,&qdev->flags)) { | ||
1484 | supported = SUPPORTED_1000baseT_Full | SUPPORTED_FIBRE | ||
1485 | | SUPPORTED_Autoneg; | ||
1486 | } else { | ||
1487 | supported = SUPPORTED_10baseT_Half | ||
1488 | | SUPPORTED_10baseT_Full | ||
1489 | | SUPPORTED_100baseT_Half | ||
1490 | | SUPPORTED_100baseT_Full | ||
1491 | | SUPPORTED_1000baseT_Half | ||
1492 | | SUPPORTED_1000baseT_Full | ||
1493 | | SUPPORTED_Autoneg | SUPPORTED_TP; | ||
1494 | } | ||
1495 | |||
1496 | return supported; | ||
1497 | } | ||
1498 | |||
1499 | static int ql_get_auto_cfg_status(struct ql3_adapter *qdev) | ||
1500 | { | ||
1501 | int status; | ||
1502 | unsigned long hw_flags; | ||
1503 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); | ||
1504 | if(ql_sem_spinlock(qdev, QL_PHY_GIO_SEM_MASK, | ||
1505 | (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) * | ||
1506 | 2) << 7)) | ||
1507 | return 0; | ||
1508 | status = ql_is_auto_cfg(qdev); | ||
1509 | ql_sem_unlock(qdev, QL_PHY_GIO_SEM_MASK); | ||
1510 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | ||
1511 | return status; | ||
1512 | } | ||
1513 | |||
1514 | static u32 ql_get_speed(struct ql3_adapter *qdev) | ||
1515 | { | ||
1516 | u32 status; | ||
1517 | unsigned long hw_flags; | ||
1518 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); | ||
1519 | if(ql_sem_spinlock(qdev, QL_PHY_GIO_SEM_MASK, | ||
1520 | (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) * | ||
1521 | 2) << 7)) | ||
1522 | return 0; | ||
1523 | status = ql_get_link_speed(qdev); | ||
1524 | ql_sem_unlock(qdev, QL_PHY_GIO_SEM_MASK); | ||
1525 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | ||
1526 | return status; | ||
1527 | } | ||
1528 | |||
1529 | static int ql_get_full_dup(struct ql3_adapter *qdev) | ||
1530 | { | ||
1531 | int status; | ||
1532 | unsigned long hw_flags; | ||
1533 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); | ||
1534 | if(ql_sem_spinlock(qdev, QL_PHY_GIO_SEM_MASK, | ||
1535 | (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) * | ||
1536 | 2) << 7)) | ||
1537 | return 0; | ||
1538 | status = ql_is_link_full_dup(qdev); | ||
1539 | ql_sem_unlock(qdev, QL_PHY_GIO_SEM_MASK); | ||
1540 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | ||
1541 | return status; | ||
1542 | } | ||
1543 | |||
1544 | |||
1545 | static int ql_get_settings(struct net_device *ndev, struct ethtool_cmd *ecmd) | ||
1546 | { | ||
1547 | struct ql3_adapter *qdev = netdev_priv(ndev); | ||
1548 | |||
1549 | ecmd->transceiver = XCVR_INTERNAL; | ||
1550 | ecmd->supported = ql_supported_modes(qdev); | ||
1551 | |||
1552 | if (test_bit(QL_LINK_OPTICAL,&qdev->flags)) { | ||
1553 | ecmd->port = PORT_FIBRE; | ||
1554 | } else { | ||
1555 | ecmd->port = PORT_TP; | ||
1556 | ecmd->phy_address = qdev->PHYAddr; | ||
1557 | } | ||
1558 | ecmd->advertising = ql_supported_modes(qdev); | ||
1559 | ecmd->autoneg = ql_get_auto_cfg_status(qdev); | ||
1560 | ecmd->speed = ql_get_speed(qdev); | ||
1561 | ecmd->duplex = ql_get_full_dup(qdev); | ||
1562 | return 0; | ||
1563 | } | ||
1564 | |||
1565 | static void ql_get_drvinfo(struct net_device *ndev, | ||
1566 | struct ethtool_drvinfo *drvinfo) | ||
1567 | { | ||
1568 | struct ql3_adapter *qdev = netdev_priv(ndev); | ||
1569 | strncpy(drvinfo->driver, ql3xxx_driver_name, 32); | ||
1570 | strncpy(drvinfo->version, ql3xxx_driver_version, 32); | ||
1571 | strncpy(drvinfo->fw_version, "N/A", 32); | ||
1572 | strncpy(drvinfo->bus_info, pci_name(qdev->pdev), 32); | ||
1573 | drvinfo->n_stats = 0; | ||
1574 | drvinfo->testinfo_len = 0; | ||
1575 | drvinfo->regdump_len = 0; | ||
1576 | drvinfo->eedump_len = 0; | ||
1577 | } | ||
1578 | |||
1579 | static u32 ql_get_msglevel(struct net_device *ndev) | ||
1580 | { | ||
1581 | struct ql3_adapter *qdev = netdev_priv(ndev); | ||
1582 | return qdev->msg_enable; | ||
1583 | } | ||
1584 | |||
1585 | static void ql_set_msglevel(struct net_device *ndev, u32 value) | ||
1586 | { | ||
1587 | struct ql3_adapter *qdev = netdev_priv(ndev); | ||
1588 | qdev->msg_enable = value; | ||
1589 | } | ||
1590 | |||
1591 | static struct ethtool_ops ql3xxx_ethtool_ops = { | ||
1592 | .get_settings = ql_get_settings, | ||
1593 | .get_drvinfo = ql_get_drvinfo, | ||
1594 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
1595 | .get_link = ethtool_op_get_link, | ||
1596 | .get_msglevel = ql_get_msglevel, | ||
1597 | .set_msglevel = ql_set_msglevel, | ||
1598 | }; | ||
1599 | |||
1600 | static int ql_populate_free_queue(struct ql3_adapter *qdev) | ||
1601 | { | ||
1602 | struct ql_rcv_buf_cb *lrg_buf_cb = qdev->lrg_buf_free_head; | ||
1603 | u64 map; | ||
1604 | |||
1605 | while (lrg_buf_cb) { | ||
1606 | if (!lrg_buf_cb->skb) { | ||
1607 | lrg_buf_cb->skb = dev_alloc_skb(qdev->lrg_buffer_len); | ||
1608 | if (unlikely(!lrg_buf_cb->skb)) { | ||
1609 | printk(KERN_DEBUG PFX | ||
1610 | "%s: Failed dev_alloc_skb().\n", | ||
1611 | qdev->ndev->name); | ||
1612 | break; | ||
1613 | } else { | ||
1614 | /* | ||
1615 | * We save some space to copy the ethhdr from | ||
1616 | * first buffer | ||
1617 | */ | ||
1618 | skb_reserve(lrg_buf_cb->skb, QL_HEADER_SPACE); | ||
1619 | map = pci_map_single(qdev->pdev, | ||
1620 | lrg_buf_cb->skb->data, | ||
1621 | qdev->lrg_buffer_len - | ||
1622 | QL_HEADER_SPACE, | ||
1623 | PCI_DMA_FROMDEVICE); | ||
1624 | lrg_buf_cb->buf_phy_addr_low = | ||
1625 | cpu_to_le32(LS_64BITS(map)); | ||
1626 | lrg_buf_cb->buf_phy_addr_high = | ||
1627 | cpu_to_le32(MS_64BITS(map)); | ||
1628 | pci_unmap_addr_set(lrg_buf_cb, mapaddr, map); | ||
1629 | pci_unmap_len_set(lrg_buf_cb, maplen, | ||
1630 | qdev->lrg_buffer_len - | ||
1631 | QL_HEADER_SPACE); | ||
1632 | --qdev->lrg_buf_skb_check; | ||
1633 | if (!qdev->lrg_buf_skb_check) | ||
1634 | return 1; | ||
1635 | } | ||
1636 | } | ||
1637 | lrg_buf_cb = lrg_buf_cb->next; | ||
1638 | } | ||
1639 | return 0; | ||
1640 | } | ||
1641 | |||
1642 | /* | ||
1643 | * Caller holds hw_lock. | ||
1644 | */ | ||
1645 | static void ql_update_lrg_bufq_prod_index(struct ql3_adapter *qdev) | ||
1646 | { | ||
1647 | struct bufq_addr_element *lrg_buf_q_ele; | ||
1648 | int i; | ||
1649 | struct ql_rcv_buf_cb *lrg_buf_cb; | ||
1650 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | ||
1651 | |||
1652 | if ((qdev->lrg_buf_free_count >= 8) | ||
1653 | && (qdev->lrg_buf_release_cnt >= 16)) { | ||
1654 | |||
1655 | if (qdev->lrg_buf_skb_check) | ||
1656 | if (!ql_populate_free_queue(qdev)) | ||
1657 | return; | ||
1658 | |||
1659 | lrg_buf_q_ele = qdev->lrg_buf_next_free; | ||
1660 | |||
1661 | while ((qdev->lrg_buf_release_cnt >= 16) | ||
1662 | && (qdev->lrg_buf_free_count >= 8)) { | ||
1663 | |||
1664 | for (i = 0; i < 8; i++) { | ||
1665 | lrg_buf_cb = | ||
1666 | ql_get_from_lrg_buf_free_list(qdev); | ||
1667 | lrg_buf_q_ele->addr_high = | ||
1668 | lrg_buf_cb->buf_phy_addr_high; | ||
1669 | lrg_buf_q_ele->addr_low = | ||
1670 | lrg_buf_cb->buf_phy_addr_low; | ||
1671 | lrg_buf_q_ele++; | ||
1672 | |||
1673 | qdev->lrg_buf_release_cnt--; | ||
1674 | } | ||
1675 | |||
1676 | qdev->lrg_buf_q_producer_index++; | ||
1677 | |||
1678 | if (qdev->lrg_buf_q_producer_index == NUM_LBUFQ_ENTRIES) | ||
1679 | qdev->lrg_buf_q_producer_index = 0; | ||
1680 | |||
1681 | if (qdev->lrg_buf_q_producer_index == | ||
1682 | (NUM_LBUFQ_ENTRIES - 1)) { | ||
1683 | lrg_buf_q_ele = qdev->lrg_buf_q_virt_addr; | ||
1684 | } | ||
1685 | } | ||
1686 | |||
1687 | qdev->lrg_buf_next_free = lrg_buf_q_ele; | ||
1688 | |||
1689 | ql_write_common_reg(qdev, | ||
1690 | (u32 *) & port_regs->CommonRegs. | ||
1691 | rxLargeQProducerIndex, | ||
1692 | qdev->lrg_buf_q_producer_index); | ||
1693 | } | ||
1694 | } | ||
1695 | |||
1696 | static void ql_process_mac_tx_intr(struct ql3_adapter *qdev, | ||
1697 | struct ob_mac_iocb_rsp *mac_rsp) | ||
1698 | { | ||
1699 | struct ql_tx_buf_cb *tx_cb; | ||
1700 | |||
1701 | tx_cb = &qdev->tx_buf[mac_rsp->transaction_id]; | ||
1702 | pci_unmap_single(qdev->pdev, | ||
1703 | pci_unmap_addr(tx_cb, mapaddr), | ||
1704 | pci_unmap_len(tx_cb, maplen), PCI_DMA_TODEVICE); | ||
1705 | dev_kfree_skb_irq(tx_cb->skb); | ||
1706 | qdev->stats.tx_packets++; | ||
1707 | qdev->stats.tx_bytes += tx_cb->skb->len; | ||
1708 | tx_cb->skb = NULL; | ||
1709 | atomic_inc(&qdev->tx_count); | ||
1710 | } | ||
1711 | |||
1712 | static void ql_process_mac_rx_intr(struct ql3_adapter *qdev, | ||
1713 | struct ib_mac_iocb_rsp *ib_mac_rsp_ptr) | ||
1714 | { | ||
1715 | long int offset; | ||
1716 | u32 lrg_buf_phy_addr_low = 0; | ||
1717 | struct ql_rcv_buf_cb *lrg_buf_cb1 = NULL; | ||
1718 | struct ql_rcv_buf_cb *lrg_buf_cb2 = NULL; | ||
1719 | u32 *curr_ial_ptr; | ||
1720 | struct sk_buff *skb; | ||
1721 | u16 length = le16_to_cpu(ib_mac_rsp_ptr->length); | ||
1722 | |||
1723 | /* | ||
1724 | * Get the inbound address list (small buffer). | ||
1725 | */ | ||
1726 | offset = qdev->small_buf_index * QL_SMALL_BUFFER_SIZE; | ||
1727 | if (++qdev->small_buf_index == NUM_SMALL_BUFFERS) | ||
1728 | qdev->small_buf_index = 0; | ||
1729 | |||
1730 | curr_ial_ptr = (u32 *) (qdev->small_buf_virt_addr + offset); | ||
1731 | qdev->last_rsp_offset = qdev->small_buf_phy_addr_low + offset; | ||
1732 | qdev->small_buf_release_cnt++; | ||
1733 | |||
1734 | /* start of first buffer */ | ||
1735 | lrg_buf_phy_addr_low = le32_to_cpu(*curr_ial_ptr); | ||
1736 | lrg_buf_cb1 = &qdev->lrg_buf[qdev->lrg_buf_index]; | ||
1737 | qdev->lrg_buf_release_cnt++; | ||
1738 | if (++qdev->lrg_buf_index == NUM_LARGE_BUFFERS) | ||
1739 | qdev->lrg_buf_index = 0; | ||
1740 | curr_ial_ptr++; /* 64-bit pointers require two incs. */ | ||
1741 | curr_ial_ptr++; | ||
1742 | |||
1743 | /* start of second buffer */ | ||
1744 | lrg_buf_phy_addr_low = le32_to_cpu(*curr_ial_ptr); | ||
1745 | lrg_buf_cb2 = &qdev->lrg_buf[qdev->lrg_buf_index]; | ||
1746 | |||
1747 | /* | ||
1748 | * Second buffer gets sent up the stack. | ||
1749 | */ | ||
1750 | qdev->lrg_buf_release_cnt++; | ||
1751 | if (++qdev->lrg_buf_index == NUM_LARGE_BUFFERS) | ||
1752 | qdev->lrg_buf_index = 0; | ||
1753 | skb = lrg_buf_cb2->skb; | ||
1754 | |||
1755 | qdev->stats.rx_packets++; | ||
1756 | qdev->stats.rx_bytes += length; | ||
1757 | |||
1758 | skb_put(skb, length); | ||
1759 | pci_unmap_single(qdev->pdev, | ||
1760 | pci_unmap_addr(lrg_buf_cb2, mapaddr), | ||
1761 | pci_unmap_len(lrg_buf_cb2, maplen), | ||
1762 | PCI_DMA_FROMDEVICE); | ||
1763 | prefetch(skb->data); | ||
1764 | skb->dev = qdev->ndev; | ||
1765 | skb->ip_summed = CHECKSUM_NONE; | ||
1766 | skb->protocol = eth_type_trans(skb, qdev->ndev); | ||
1767 | |||
1768 | netif_receive_skb(skb); | ||
1769 | qdev->ndev->last_rx = jiffies; | ||
1770 | lrg_buf_cb2->skb = NULL; | ||
1771 | |||
1772 | ql_release_to_lrg_buf_free_list(qdev, lrg_buf_cb1); | ||
1773 | ql_release_to_lrg_buf_free_list(qdev, lrg_buf_cb2); | ||
1774 | } | ||
1775 | |||
1776 | static void ql_process_macip_rx_intr(struct ql3_adapter *qdev, | ||
1777 | struct ib_ip_iocb_rsp *ib_ip_rsp_ptr) | ||
1778 | { | ||
1779 | long int offset; | ||
1780 | u32 lrg_buf_phy_addr_low = 0; | ||
1781 | struct ql_rcv_buf_cb *lrg_buf_cb1 = NULL; | ||
1782 | struct ql_rcv_buf_cb *lrg_buf_cb2 = NULL; | ||
1783 | u32 *curr_ial_ptr; | ||
1784 | struct sk_buff *skb1, *skb2; | ||
1785 | struct net_device *ndev = qdev->ndev; | ||
1786 | u16 length = le16_to_cpu(ib_ip_rsp_ptr->length); | ||
1787 | u16 size = 0; | ||
1788 | |||
1789 | /* | ||
1790 | * Get the inbound address list (small buffer). | ||
1791 | */ | ||
1792 | |||
1793 | offset = qdev->small_buf_index * QL_SMALL_BUFFER_SIZE; | ||
1794 | if (++qdev->small_buf_index == NUM_SMALL_BUFFERS) | ||
1795 | qdev->small_buf_index = 0; | ||
1796 | curr_ial_ptr = (u32 *) (qdev->small_buf_virt_addr + offset); | ||
1797 | qdev->last_rsp_offset = qdev->small_buf_phy_addr_low + offset; | ||
1798 | qdev->small_buf_release_cnt++; | ||
1799 | |||
1800 | /* start of first buffer */ | ||
1801 | lrg_buf_phy_addr_low = le32_to_cpu(*curr_ial_ptr); | ||
1802 | lrg_buf_cb1 = &qdev->lrg_buf[qdev->lrg_buf_index]; | ||
1803 | |||
1804 | qdev->lrg_buf_release_cnt++; | ||
1805 | if (++qdev->lrg_buf_index == NUM_LARGE_BUFFERS) | ||
1806 | qdev->lrg_buf_index = 0; | ||
1807 | skb1 = lrg_buf_cb1->skb; | ||
1808 | curr_ial_ptr++; /* 64-bit pointers require two incs. */ | ||
1809 | curr_ial_ptr++; | ||
1810 | |||
1811 | /* start of second buffer */ | ||
1812 | lrg_buf_phy_addr_low = le32_to_cpu(*curr_ial_ptr); | ||
1813 | lrg_buf_cb2 = &qdev->lrg_buf[qdev->lrg_buf_index]; | ||
1814 | skb2 = lrg_buf_cb2->skb; | ||
1815 | qdev->lrg_buf_release_cnt++; | ||
1816 | if (++qdev->lrg_buf_index == NUM_LARGE_BUFFERS) | ||
1817 | qdev->lrg_buf_index = 0; | ||
1818 | |||
1819 | qdev->stats.rx_packets++; | ||
1820 | qdev->stats.rx_bytes += length; | ||
1821 | |||
1822 | /* | ||
1823 | * Copy the ethhdr from first buffer to second. This | ||
1824 | * is necessary for IP completions. | ||
1825 | */ | ||
1826 | if (*((u16 *) skb1->data) != 0xFFFF) | ||
1827 | size = VLAN_ETH_HLEN; | ||
1828 | else | ||
1829 | size = ETH_HLEN; | ||
1830 | |||
1831 | skb_put(skb2, length); /* Just the second buffer length here. */ | ||
1832 | pci_unmap_single(qdev->pdev, | ||
1833 | pci_unmap_addr(lrg_buf_cb2, mapaddr), | ||
1834 | pci_unmap_len(lrg_buf_cb2, maplen), | ||
1835 | PCI_DMA_FROMDEVICE); | ||
1836 | prefetch(skb2->data); | ||
1837 | |||
1838 | memcpy(skb_push(skb2, size), skb1->data + VLAN_ID_LEN, size); | ||
1839 | skb2->dev = qdev->ndev; | ||
1840 | skb2->ip_summed = CHECKSUM_NONE; | ||
1841 | skb2->protocol = eth_type_trans(skb2, qdev->ndev); | ||
1842 | |||
1843 | netif_receive_skb(skb2); | ||
1844 | ndev->last_rx = jiffies; | ||
1845 | lrg_buf_cb2->skb = NULL; | ||
1846 | |||
1847 | ql_release_to_lrg_buf_free_list(qdev, lrg_buf_cb1); | ||
1848 | ql_release_to_lrg_buf_free_list(qdev, lrg_buf_cb2); | ||
1849 | } | ||
1850 | |||
1851 | static int ql_tx_rx_clean(struct ql3_adapter *qdev, | ||
1852 | int *tx_cleaned, int *rx_cleaned, int work_to_do) | ||
1853 | { | ||
1854 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | ||
1855 | struct net_rsp_iocb *net_rsp; | ||
1856 | struct net_device *ndev = qdev->ndev; | ||
1857 | unsigned long hw_flags; | ||
1858 | |||
1859 | /* While there are entries in the completion queue. */ | ||
1860 | while ((cpu_to_le32(*(qdev->prsp_producer_index)) != | ||
1861 | qdev->rsp_consumer_index) && (*rx_cleaned < work_to_do)) { | ||
1862 | |||
1863 | net_rsp = qdev->rsp_current; | ||
1864 | switch (net_rsp->opcode) { | ||
1865 | |||
1866 | case OPCODE_OB_MAC_IOCB_FN0: | ||
1867 | case OPCODE_OB_MAC_IOCB_FN2: | ||
1868 | ql_process_mac_tx_intr(qdev, (struct ob_mac_iocb_rsp *) | ||
1869 | net_rsp); | ||
1870 | (*tx_cleaned)++; | ||
1871 | break; | ||
1872 | |||
1873 | case OPCODE_IB_MAC_IOCB: | ||
1874 | ql_process_mac_rx_intr(qdev, (struct ib_mac_iocb_rsp *) | ||
1875 | net_rsp); | ||
1876 | (*rx_cleaned)++; | ||
1877 | break; | ||
1878 | |||
1879 | case OPCODE_IB_IP_IOCB: | ||
1880 | ql_process_macip_rx_intr(qdev, (struct ib_ip_iocb_rsp *) | ||
1881 | net_rsp); | ||
1882 | (*rx_cleaned)++; | ||
1883 | break; | ||
1884 | default: | ||
1885 | { | ||
1886 | u32 *tmp = (u32 *) net_rsp; | ||
1887 | printk(KERN_ERR PFX | ||
1888 | "%s: Hit default case, not " | ||
1889 | "handled!\n" | ||
1890 | " dropping the packet, opcode = " | ||
1891 | "%x.\n", | ||
1892 | ndev->name, net_rsp->opcode); | ||
1893 | printk(KERN_ERR PFX | ||
1894 | "0x%08lx 0x%08lx 0x%08lx 0x%08lx \n", | ||
1895 | (unsigned long int)tmp[0], | ||
1896 | (unsigned long int)tmp[1], | ||
1897 | (unsigned long int)tmp[2], | ||
1898 | (unsigned long int)tmp[3]); | ||
1899 | } | ||
1900 | } | ||
1901 | |||
1902 | qdev->rsp_consumer_index++; | ||
1903 | |||
1904 | if (qdev->rsp_consumer_index == NUM_RSP_Q_ENTRIES) { | ||
1905 | qdev->rsp_consumer_index = 0; | ||
1906 | qdev->rsp_current = qdev->rsp_q_virt_addr; | ||
1907 | } else { | ||
1908 | qdev->rsp_current++; | ||
1909 | } | ||
1910 | } | ||
1911 | |||
1912 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); | ||
1913 | |||
1914 | ql_update_lrg_bufq_prod_index(qdev); | ||
1915 | |||
1916 | if (qdev->small_buf_release_cnt >= 16) { | ||
1917 | while (qdev->small_buf_release_cnt >= 16) { | ||
1918 | qdev->small_buf_q_producer_index++; | ||
1919 | |||
1920 | if (qdev->small_buf_q_producer_index == | ||
1921 | NUM_SBUFQ_ENTRIES) | ||
1922 | qdev->small_buf_q_producer_index = 0; | ||
1923 | qdev->small_buf_release_cnt -= 8; | ||
1924 | } | ||
1925 | |||
1926 | ql_write_common_reg(qdev, | ||
1927 | (u32 *) & port_regs->CommonRegs. | ||
1928 | rxSmallQProducerIndex, | ||
1929 | qdev->small_buf_q_producer_index); | ||
1930 | } | ||
1931 | |||
1932 | ql_write_common_reg(qdev, | ||
1933 | (u32 *) & port_regs->CommonRegs.rspQConsumerIndex, | ||
1934 | qdev->rsp_consumer_index); | ||
1935 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | ||
1936 | |||
1937 | if (unlikely(netif_queue_stopped(qdev->ndev))) { | ||
1938 | if (netif_queue_stopped(qdev->ndev) && | ||
1939 | (atomic_read(&qdev->tx_count) > (NUM_REQ_Q_ENTRIES / 4))) | ||
1940 | netif_wake_queue(qdev->ndev); | ||
1941 | } | ||
1942 | |||
1943 | return *tx_cleaned + *rx_cleaned; | ||
1944 | } | ||
1945 | |||
1946 | static int ql_poll(struct net_device *ndev, int *budget) | ||
1947 | { | ||
1948 | struct ql3_adapter *qdev = netdev_priv(ndev); | ||
1949 | int work_to_do = min(*budget, ndev->quota); | ||
1950 | int rx_cleaned = 0, tx_cleaned = 0; | ||
1951 | |||
1952 | if (!netif_carrier_ok(ndev)) | ||
1953 | goto quit_polling; | ||
1954 | |||
1955 | ql_tx_rx_clean(qdev, &tx_cleaned, &rx_cleaned, work_to_do); | ||
1956 | *budget -= rx_cleaned; | ||
1957 | ndev->quota -= rx_cleaned; | ||
1958 | |||
1959 | if ((!tx_cleaned && !rx_cleaned) || !netif_running(ndev)) { | ||
1960 | quit_polling: | ||
1961 | netif_rx_complete(ndev); | ||
1962 | ql_enable_interrupts(qdev); | ||
1963 | return 0; | ||
1964 | } | ||
1965 | return 1; | ||
1966 | } | ||
1967 | |||
1968 | static irqreturn_t ql3xxx_isr(int irq, void *dev_id, struct pt_regs *regs) | ||
1969 | { | ||
1970 | |||
1971 | struct net_device *ndev = dev_id; | ||
1972 | struct ql3_adapter *qdev = netdev_priv(ndev); | ||
1973 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | ||
1974 | u32 value; | ||
1975 | int handled = 1; | ||
1976 | u32 var; | ||
1977 | |||
1978 | port_regs = qdev->mem_map_registers; | ||
1979 | |||
1980 | value = | ||
1981 | ql_read_common_reg_l(qdev, &port_regs->CommonRegs.ispControlStatus); | ||
1982 | |||
1983 | if (value & (ISP_CONTROL_FE | ISP_CONTROL_RI)) { | ||
1984 | spin_lock(&qdev->adapter_lock); | ||
1985 | netif_stop_queue(qdev->ndev); | ||
1986 | netif_carrier_off(qdev->ndev); | ||
1987 | ql_disable_interrupts(qdev); | ||
1988 | qdev->port_link_state = LS_DOWN; | ||
1989 | set_bit(QL_RESET_ACTIVE,&qdev->flags) ; | ||
1990 | |||
1991 | if (value & ISP_CONTROL_FE) { | ||
1992 | /* | ||
1993 | * Chip Fatal Error. | ||
1994 | */ | ||
1995 | var = | ||
1996 | ql_read_page0_reg_l(qdev, | ||
1997 | &port_regs->PortFatalErrStatus); | ||
1998 | printk(KERN_WARNING PFX | ||
1999 | "%s: Resetting chip. PortFatalErrStatus " | ||
2000 | "register = 0x%x\n", ndev->name, var); | ||
2001 | set_bit(QL_RESET_START,&qdev->flags) ; | ||
2002 | } else { | ||
2003 | /* | ||
2004 | * Soft Reset Requested. | ||
2005 | */ | ||
2006 | set_bit(QL_RESET_PER_SCSI,&qdev->flags) ; | ||
2007 | printk(KERN_ERR PFX | ||
2008 | "%s: Another function issued a reset to the " | ||
2009 | "chip. ISR value = %x.\n", ndev->name, value); | ||
2010 | } | ||
2011 | queue_work(qdev->workqueue, &qdev->reset_work); | ||
2012 | spin_unlock(&qdev->adapter_lock); | ||
2013 | } else if (value & ISP_IMR_DISABLE_CMPL_INT) { | ||
2014 | ql_disable_interrupts(qdev); | ||
2015 | if (likely(netif_rx_schedule_prep(ndev))) | ||
2016 | __netif_rx_schedule(ndev); | ||
2017 | else | ||
2018 | ql_enable_interrupts(qdev); | ||
2019 | } else { | ||
2020 | return IRQ_NONE; | ||
2021 | } | ||
2022 | |||
2023 | return IRQ_RETVAL(handled); | ||
2024 | } | ||
2025 | |||
2026 | static int ql3xxx_send(struct sk_buff *skb, struct net_device *ndev) | ||
2027 | { | ||
2028 | struct ql3_adapter *qdev = (struct ql3_adapter *)netdev_priv(ndev); | ||
2029 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | ||
2030 | struct ql_tx_buf_cb *tx_cb; | ||
2031 | struct ob_mac_iocb_req *mac_iocb_ptr; | ||
2032 | u64 map; | ||
2033 | |||
2034 | if (unlikely(atomic_read(&qdev->tx_count) < 2)) { | ||
2035 | if (!netif_queue_stopped(ndev)) | ||
2036 | netif_stop_queue(ndev); | ||
2037 | return NETDEV_TX_BUSY; | ||
2038 | } | ||
2039 | tx_cb = &qdev->tx_buf[qdev->req_producer_index] ; | ||
2040 | mac_iocb_ptr = tx_cb->queue_entry; | ||
2041 | memset((void *)mac_iocb_ptr, 0, sizeof(struct ob_mac_iocb_req)); | ||
2042 | mac_iocb_ptr->opcode = qdev->mac_ob_opcode; | ||
2043 | mac_iocb_ptr->flags |= qdev->mb_bit_mask; | ||
2044 | mac_iocb_ptr->transaction_id = qdev->req_producer_index; | ||
2045 | mac_iocb_ptr->data_len = cpu_to_le16((u16) skb->len); | ||
2046 | tx_cb->skb = skb; | ||
2047 | map = pci_map_single(qdev->pdev, skb->data, skb->len, PCI_DMA_TODEVICE); | ||
2048 | mac_iocb_ptr->buf_addr0_low = cpu_to_le32(LS_64BITS(map)); | ||
2049 | mac_iocb_ptr->buf_addr0_high = cpu_to_le32(MS_64BITS(map)); | ||
2050 | mac_iocb_ptr->buf_0_len = cpu_to_le32(skb->len | OB_MAC_IOCB_REQ_E); | ||
2051 | pci_unmap_addr_set(tx_cb, mapaddr, map); | ||
2052 | pci_unmap_len_set(tx_cb, maplen, skb->len); | ||
2053 | atomic_dec(&qdev->tx_count); | ||
2054 | |||
2055 | qdev->req_producer_index++; | ||
2056 | if (qdev->req_producer_index == NUM_REQ_Q_ENTRIES) | ||
2057 | qdev->req_producer_index = 0; | ||
2058 | wmb(); | ||
2059 | ql_write_common_reg_l(qdev, | ||
2060 | (u32 *) & port_regs->CommonRegs.reqQProducerIndex, | ||
2061 | qdev->req_producer_index); | ||
2062 | |||
2063 | ndev->trans_start = jiffies; | ||
2064 | if (netif_msg_tx_queued(qdev)) | ||
2065 | printk(KERN_DEBUG PFX "%s: tx queued, slot %d, len %d\n", | ||
2066 | ndev->name, qdev->req_producer_index, skb->len); | ||
2067 | |||
2068 | return NETDEV_TX_OK; | ||
2069 | } | ||
2070 | static int ql_alloc_net_req_rsp_queues(struct ql3_adapter *qdev) | ||
2071 | { | ||
2072 | qdev->req_q_size = | ||
2073 | (u32) (NUM_REQ_Q_ENTRIES * sizeof(struct ob_mac_iocb_req)); | ||
2074 | |||
2075 | qdev->req_q_virt_addr = | ||
2076 | pci_alloc_consistent(qdev->pdev, | ||
2077 | (size_t) qdev->req_q_size, | ||
2078 | &qdev->req_q_phy_addr); | ||
2079 | |||
2080 | if ((qdev->req_q_virt_addr == NULL) || | ||
2081 | LS_64BITS(qdev->req_q_phy_addr) & (qdev->req_q_size - 1)) { | ||
2082 | printk(KERN_ERR PFX "%s: reqQ failed.\n", | ||
2083 | qdev->ndev->name); | ||
2084 | return -ENOMEM; | ||
2085 | } | ||
2086 | |||
2087 | qdev->rsp_q_size = NUM_RSP_Q_ENTRIES * sizeof(struct net_rsp_iocb); | ||
2088 | |||
2089 | qdev->rsp_q_virt_addr = | ||
2090 | pci_alloc_consistent(qdev->pdev, | ||
2091 | (size_t) qdev->rsp_q_size, | ||
2092 | &qdev->rsp_q_phy_addr); | ||
2093 | |||
2094 | if ((qdev->rsp_q_virt_addr == NULL) || | ||
2095 | LS_64BITS(qdev->rsp_q_phy_addr) & (qdev->rsp_q_size - 1)) { | ||
2096 | printk(KERN_ERR PFX | ||
2097 | "%s: rspQ allocation failed\n", | ||
2098 | qdev->ndev->name); | ||
2099 | pci_free_consistent(qdev->pdev, (size_t) qdev->req_q_size, | ||
2100 | qdev->req_q_virt_addr, | ||
2101 | qdev->req_q_phy_addr); | ||
2102 | return -ENOMEM; | ||
2103 | } | ||
2104 | |||
2105 | set_bit(QL_ALLOC_REQ_RSP_Q_DONE,&qdev->flags); | ||
2106 | |||
2107 | return 0; | ||
2108 | } | ||
2109 | |||
2110 | static void ql_free_net_req_rsp_queues(struct ql3_adapter *qdev) | ||
2111 | { | ||
2112 | if (!test_bit(QL_ALLOC_REQ_RSP_Q_DONE,&qdev->flags)) { | ||
2113 | printk(KERN_INFO PFX | ||
2114 | "%s: Already done.\n", qdev->ndev->name); | ||
2115 | return; | ||
2116 | } | ||
2117 | |||
2118 | pci_free_consistent(qdev->pdev, | ||
2119 | qdev->req_q_size, | ||
2120 | qdev->req_q_virt_addr, qdev->req_q_phy_addr); | ||
2121 | |||
2122 | qdev->req_q_virt_addr = NULL; | ||
2123 | |||
2124 | pci_free_consistent(qdev->pdev, | ||
2125 | qdev->rsp_q_size, | ||
2126 | qdev->rsp_q_virt_addr, qdev->rsp_q_phy_addr); | ||
2127 | |||
2128 | qdev->rsp_q_virt_addr = NULL; | ||
2129 | |||
2130 | clear_bit(QL_ALLOC_REQ_RSP_Q_DONE,&qdev->flags); | ||
2131 | } | ||
2132 | |||
2133 | static int ql_alloc_buffer_queues(struct ql3_adapter *qdev) | ||
2134 | { | ||
2135 | /* Create Large Buffer Queue */ | ||
2136 | qdev->lrg_buf_q_size = | ||
2137 | NUM_LBUFQ_ENTRIES * sizeof(struct lrg_buf_q_entry); | ||
2138 | if (qdev->lrg_buf_q_size < PAGE_SIZE) | ||
2139 | qdev->lrg_buf_q_alloc_size = PAGE_SIZE; | ||
2140 | else | ||
2141 | qdev->lrg_buf_q_alloc_size = qdev->lrg_buf_q_size * 2; | ||
2142 | |||
2143 | qdev->lrg_buf_q_alloc_virt_addr = | ||
2144 | pci_alloc_consistent(qdev->pdev, | ||
2145 | qdev->lrg_buf_q_alloc_size, | ||
2146 | &qdev->lrg_buf_q_alloc_phy_addr); | ||
2147 | |||
2148 | if (qdev->lrg_buf_q_alloc_virt_addr == NULL) { | ||
2149 | printk(KERN_ERR PFX | ||
2150 | "%s: lBufQ failed\n", qdev->ndev->name); | ||
2151 | return -ENOMEM; | ||
2152 | } | ||
2153 | qdev->lrg_buf_q_virt_addr = qdev->lrg_buf_q_alloc_virt_addr; | ||
2154 | qdev->lrg_buf_q_phy_addr = qdev->lrg_buf_q_alloc_phy_addr; | ||
2155 | |||
2156 | /* Create Small Buffer Queue */ | ||
2157 | qdev->small_buf_q_size = | ||
2158 | NUM_SBUFQ_ENTRIES * sizeof(struct lrg_buf_q_entry); | ||
2159 | if (qdev->small_buf_q_size < PAGE_SIZE) | ||
2160 | qdev->small_buf_q_alloc_size = PAGE_SIZE; | ||
2161 | else | ||
2162 | qdev->small_buf_q_alloc_size = qdev->small_buf_q_size * 2; | ||
2163 | |||
2164 | qdev->small_buf_q_alloc_virt_addr = | ||
2165 | pci_alloc_consistent(qdev->pdev, | ||
2166 | qdev->small_buf_q_alloc_size, | ||
2167 | &qdev->small_buf_q_alloc_phy_addr); | ||
2168 | |||
2169 | if (qdev->small_buf_q_alloc_virt_addr == NULL) { | ||
2170 | printk(KERN_ERR PFX | ||
2171 | "%s: Small Buffer Queue allocation failed.\n", | ||
2172 | qdev->ndev->name); | ||
2173 | pci_free_consistent(qdev->pdev, qdev->lrg_buf_q_alloc_size, | ||
2174 | qdev->lrg_buf_q_alloc_virt_addr, | ||
2175 | qdev->lrg_buf_q_alloc_phy_addr); | ||
2176 | return -ENOMEM; | ||
2177 | } | ||
2178 | |||
2179 | qdev->small_buf_q_virt_addr = qdev->small_buf_q_alloc_virt_addr; | ||
2180 | qdev->small_buf_q_phy_addr = qdev->small_buf_q_alloc_phy_addr; | ||
2181 | set_bit(QL_ALLOC_BUFQS_DONE,&qdev->flags); | ||
2182 | return 0; | ||
2183 | } | ||
2184 | |||
2185 | static void ql_free_buffer_queues(struct ql3_adapter *qdev) | ||
2186 | { | ||
2187 | if (!test_bit(QL_ALLOC_BUFQS_DONE,&qdev->flags)) { | ||
2188 | printk(KERN_INFO PFX | ||
2189 | "%s: Already done.\n", qdev->ndev->name); | ||
2190 | return; | ||
2191 | } | ||
2192 | |||
2193 | pci_free_consistent(qdev->pdev, | ||
2194 | qdev->lrg_buf_q_alloc_size, | ||
2195 | qdev->lrg_buf_q_alloc_virt_addr, | ||
2196 | qdev->lrg_buf_q_alloc_phy_addr); | ||
2197 | |||
2198 | qdev->lrg_buf_q_virt_addr = NULL; | ||
2199 | |||
2200 | pci_free_consistent(qdev->pdev, | ||
2201 | qdev->small_buf_q_alloc_size, | ||
2202 | qdev->small_buf_q_alloc_virt_addr, | ||
2203 | qdev->small_buf_q_alloc_phy_addr); | ||
2204 | |||
2205 | qdev->small_buf_q_virt_addr = NULL; | ||
2206 | |||
2207 | clear_bit(QL_ALLOC_BUFQS_DONE,&qdev->flags); | ||
2208 | } | ||
2209 | |||
2210 | static int ql_alloc_small_buffers(struct ql3_adapter *qdev) | ||
2211 | { | ||
2212 | int i; | ||
2213 | struct bufq_addr_element *small_buf_q_entry; | ||
2214 | |||
2215 | /* Currently we allocate on one of memory and use it for smallbuffers */ | ||
2216 | qdev->small_buf_total_size = | ||
2217 | (QL_ADDR_ELE_PER_BUFQ_ENTRY * NUM_SBUFQ_ENTRIES * | ||
2218 | QL_SMALL_BUFFER_SIZE); | ||
2219 | |||
2220 | qdev->small_buf_virt_addr = | ||
2221 | pci_alloc_consistent(qdev->pdev, | ||
2222 | qdev->small_buf_total_size, | ||
2223 | &qdev->small_buf_phy_addr); | ||
2224 | |||
2225 | if (qdev->small_buf_virt_addr == NULL) { | ||
2226 | printk(KERN_ERR PFX | ||
2227 | "%s: Failed to get small buffer memory.\n", | ||
2228 | qdev->ndev->name); | ||
2229 | return -ENOMEM; | ||
2230 | } | ||
2231 | |||
2232 | qdev->small_buf_phy_addr_low = LS_64BITS(qdev->small_buf_phy_addr); | ||
2233 | qdev->small_buf_phy_addr_high = MS_64BITS(qdev->small_buf_phy_addr); | ||
2234 | |||
2235 | small_buf_q_entry = qdev->small_buf_q_virt_addr; | ||
2236 | |||
2237 | qdev->last_rsp_offset = qdev->small_buf_phy_addr_low; | ||
2238 | |||
2239 | /* Initialize the small buffer queue. */ | ||
2240 | for (i = 0; i < (QL_ADDR_ELE_PER_BUFQ_ENTRY * NUM_SBUFQ_ENTRIES); i++) { | ||
2241 | small_buf_q_entry->addr_high = | ||
2242 | cpu_to_le32(qdev->small_buf_phy_addr_high); | ||
2243 | small_buf_q_entry->addr_low = | ||
2244 | cpu_to_le32(qdev->small_buf_phy_addr_low + | ||
2245 | (i * QL_SMALL_BUFFER_SIZE)); | ||
2246 | small_buf_q_entry++; | ||
2247 | } | ||
2248 | qdev->small_buf_index = 0; | ||
2249 | set_bit(QL_ALLOC_SMALL_BUF_DONE,&qdev->flags); | ||
2250 | return 0; | ||
2251 | } | ||
2252 | |||
2253 | static void ql_free_small_buffers(struct ql3_adapter *qdev) | ||
2254 | { | ||
2255 | if (!test_bit(QL_ALLOC_SMALL_BUF_DONE,&qdev->flags)) { | ||
2256 | printk(KERN_INFO PFX | ||
2257 | "%s: Already done.\n", qdev->ndev->name); | ||
2258 | return; | ||
2259 | } | ||
2260 | if (qdev->small_buf_virt_addr != NULL) { | ||
2261 | pci_free_consistent(qdev->pdev, | ||
2262 | qdev->small_buf_total_size, | ||
2263 | qdev->small_buf_virt_addr, | ||
2264 | qdev->small_buf_phy_addr); | ||
2265 | |||
2266 | qdev->small_buf_virt_addr = NULL; | ||
2267 | } | ||
2268 | } | ||
2269 | |||
2270 | static void ql_free_large_buffers(struct ql3_adapter *qdev) | ||
2271 | { | ||
2272 | int i = 0; | ||
2273 | struct ql_rcv_buf_cb *lrg_buf_cb; | ||
2274 | |||
2275 | for (i = 0; i < NUM_LARGE_BUFFERS; i++) { | ||
2276 | lrg_buf_cb = &qdev->lrg_buf[i]; | ||
2277 | if (lrg_buf_cb->skb) { | ||
2278 | dev_kfree_skb(lrg_buf_cb->skb); | ||
2279 | pci_unmap_single(qdev->pdev, | ||
2280 | pci_unmap_addr(lrg_buf_cb, mapaddr), | ||
2281 | pci_unmap_len(lrg_buf_cb, maplen), | ||
2282 | PCI_DMA_FROMDEVICE); | ||
2283 | memset(lrg_buf_cb, 0, sizeof(struct ql_rcv_buf_cb)); | ||
2284 | } else { | ||
2285 | break; | ||
2286 | } | ||
2287 | } | ||
2288 | } | ||
2289 | |||
2290 | static void ql_init_large_buffers(struct ql3_adapter *qdev) | ||
2291 | { | ||
2292 | int i; | ||
2293 | struct ql_rcv_buf_cb *lrg_buf_cb; | ||
2294 | struct bufq_addr_element *buf_addr_ele = qdev->lrg_buf_q_virt_addr; | ||
2295 | |||
2296 | for (i = 0; i < NUM_LARGE_BUFFERS; i++) { | ||
2297 | lrg_buf_cb = &qdev->lrg_buf[i]; | ||
2298 | buf_addr_ele->addr_high = lrg_buf_cb->buf_phy_addr_high; | ||
2299 | buf_addr_ele->addr_low = lrg_buf_cb->buf_phy_addr_low; | ||
2300 | buf_addr_ele++; | ||
2301 | } | ||
2302 | qdev->lrg_buf_index = 0; | ||
2303 | qdev->lrg_buf_skb_check = 0; | ||
2304 | } | ||
2305 | |||
2306 | static int ql_alloc_large_buffers(struct ql3_adapter *qdev) | ||
2307 | { | ||
2308 | int i; | ||
2309 | struct ql_rcv_buf_cb *lrg_buf_cb; | ||
2310 | struct sk_buff *skb; | ||
2311 | u64 map; | ||
2312 | |||
2313 | for (i = 0; i < NUM_LARGE_BUFFERS; i++) { | ||
2314 | skb = dev_alloc_skb(qdev->lrg_buffer_len); | ||
2315 | if (unlikely(!skb)) { | ||
2316 | /* Better luck next round */ | ||
2317 | printk(KERN_ERR PFX | ||
2318 | "%s: large buff alloc failed, " | ||
2319 | "for %d bytes at index %d.\n", | ||
2320 | qdev->ndev->name, | ||
2321 | qdev->lrg_buffer_len * 2, i); | ||
2322 | ql_free_large_buffers(qdev); | ||
2323 | return -ENOMEM; | ||
2324 | } else { | ||
2325 | |||
2326 | lrg_buf_cb = &qdev->lrg_buf[i]; | ||
2327 | memset(lrg_buf_cb, 0, sizeof(struct ql_rcv_buf_cb)); | ||
2328 | lrg_buf_cb->index = i; | ||
2329 | lrg_buf_cb->skb = skb; | ||
2330 | /* | ||
2331 | * We save some space to copy the ethhdr from first | ||
2332 | * buffer | ||
2333 | */ | ||
2334 | skb_reserve(skb, QL_HEADER_SPACE); | ||
2335 | map = pci_map_single(qdev->pdev, | ||
2336 | skb->data, | ||
2337 | qdev->lrg_buffer_len - | ||
2338 | QL_HEADER_SPACE, | ||
2339 | PCI_DMA_FROMDEVICE); | ||
2340 | pci_unmap_addr_set(lrg_buf_cb, mapaddr, map); | ||
2341 | pci_unmap_len_set(lrg_buf_cb, maplen, | ||
2342 | qdev->lrg_buffer_len - | ||
2343 | QL_HEADER_SPACE); | ||
2344 | lrg_buf_cb->buf_phy_addr_low = | ||
2345 | cpu_to_le32(LS_64BITS(map)); | ||
2346 | lrg_buf_cb->buf_phy_addr_high = | ||
2347 | cpu_to_le32(MS_64BITS(map)); | ||
2348 | } | ||
2349 | } | ||
2350 | return 0; | ||
2351 | } | ||
2352 | |||
2353 | static void ql_create_send_free_list(struct ql3_adapter *qdev) | ||
2354 | { | ||
2355 | struct ql_tx_buf_cb *tx_cb; | ||
2356 | int i; | ||
2357 | struct ob_mac_iocb_req *req_q_curr = | ||
2358 | qdev->req_q_virt_addr; | ||
2359 | |||
2360 | /* Create free list of transmit buffers */ | ||
2361 | for (i = 0; i < NUM_REQ_Q_ENTRIES; i++) { | ||
2362 | tx_cb = &qdev->tx_buf[i]; | ||
2363 | tx_cb->skb = NULL; | ||
2364 | tx_cb->queue_entry = req_q_curr; | ||
2365 | req_q_curr++; | ||
2366 | } | ||
2367 | } | ||
2368 | |||
2369 | static int ql_alloc_mem_resources(struct ql3_adapter *qdev) | ||
2370 | { | ||
2371 | if (qdev->ndev->mtu == NORMAL_MTU_SIZE) | ||
2372 | qdev->lrg_buffer_len = NORMAL_MTU_SIZE; | ||
2373 | else if (qdev->ndev->mtu == JUMBO_MTU_SIZE) { | ||
2374 | qdev->lrg_buffer_len = JUMBO_MTU_SIZE; | ||
2375 | } else { | ||
2376 | printk(KERN_ERR PFX | ||
2377 | "%s: Invalid mtu size. Only 1500 and 9000 are accepted.\n", | ||
2378 | qdev->ndev->name); | ||
2379 | return -ENOMEM; | ||
2380 | } | ||
2381 | qdev->lrg_buffer_len += VLAN_ETH_HLEN + VLAN_ID_LEN + QL_HEADER_SPACE; | ||
2382 | qdev->max_frame_size = | ||
2383 | (qdev->lrg_buffer_len - QL_HEADER_SPACE) + ETHERNET_CRC_SIZE; | ||
2384 | |||
2385 | /* | ||
2386 | * First allocate a page of shared memory and use it for shadow | ||
2387 | * locations of Network Request Queue Consumer Address Register and | ||
2388 | * Network Completion Queue Producer Index Register | ||
2389 | */ | ||
2390 | qdev->shadow_reg_virt_addr = | ||
2391 | pci_alloc_consistent(qdev->pdev, | ||
2392 | PAGE_SIZE, &qdev->shadow_reg_phy_addr); | ||
2393 | |||
2394 | if (qdev->shadow_reg_virt_addr != NULL) { | ||
2395 | qdev->preq_consumer_index = (u16 *) qdev->shadow_reg_virt_addr; | ||
2396 | qdev->req_consumer_index_phy_addr_high = | ||
2397 | MS_64BITS(qdev->shadow_reg_phy_addr); | ||
2398 | qdev->req_consumer_index_phy_addr_low = | ||
2399 | LS_64BITS(qdev->shadow_reg_phy_addr); | ||
2400 | |||
2401 | qdev->prsp_producer_index = | ||
2402 | (u32 *) (((u8 *) qdev->preq_consumer_index) + 8); | ||
2403 | qdev->rsp_producer_index_phy_addr_high = | ||
2404 | qdev->req_consumer_index_phy_addr_high; | ||
2405 | qdev->rsp_producer_index_phy_addr_low = | ||
2406 | qdev->req_consumer_index_phy_addr_low + 8; | ||
2407 | } else { | ||
2408 | printk(KERN_ERR PFX | ||
2409 | "%s: shadowReg Alloc failed.\n", qdev->ndev->name); | ||
2410 | return -ENOMEM; | ||
2411 | } | ||
2412 | |||
2413 | if (ql_alloc_net_req_rsp_queues(qdev) != 0) { | ||
2414 | printk(KERN_ERR PFX | ||
2415 | "%s: ql_alloc_net_req_rsp_queues failed.\n", | ||
2416 | qdev->ndev->name); | ||
2417 | goto err_req_rsp; | ||
2418 | } | ||
2419 | |||
2420 | if (ql_alloc_buffer_queues(qdev) != 0) { | ||
2421 | printk(KERN_ERR PFX | ||
2422 | "%s: ql_alloc_buffer_queues failed.\n", | ||
2423 | qdev->ndev->name); | ||
2424 | goto err_buffer_queues; | ||
2425 | } | ||
2426 | |||
2427 | if (ql_alloc_small_buffers(qdev) != 0) { | ||
2428 | printk(KERN_ERR PFX | ||
2429 | "%s: ql_alloc_small_buffers failed\n", qdev->ndev->name); | ||
2430 | goto err_small_buffers; | ||
2431 | } | ||
2432 | |||
2433 | if (ql_alloc_large_buffers(qdev) != 0) { | ||
2434 | printk(KERN_ERR PFX | ||
2435 | "%s: ql_alloc_large_buffers failed\n", qdev->ndev->name); | ||
2436 | goto err_small_buffers; | ||
2437 | } | ||
2438 | |||
2439 | /* Initialize the large buffer queue. */ | ||
2440 | ql_init_large_buffers(qdev); | ||
2441 | ql_create_send_free_list(qdev); | ||
2442 | |||
2443 | qdev->rsp_current = qdev->rsp_q_virt_addr; | ||
2444 | |||
2445 | return 0; | ||
2446 | |||
2447 | err_small_buffers: | ||
2448 | ql_free_buffer_queues(qdev); | ||
2449 | err_buffer_queues: | ||
2450 | ql_free_net_req_rsp_queues(qdev); | ||
2451 | err_req_rsp: | ||
2452 | pci_free_consistent(qdev->pdev, | ||
2453 | PAGE_SIZE, | ||
2454 | qdev->shadow_reg_virt_addr, | ||
2455 | qdev->shadow_reg_phy_addr); | ||
2456 | |||
2457 | return -ENOMEM; | ||
2458 | } | ||
2459 | |||
2460 | static void ql_free_mem_resources(struct ql3_adapter *qdev) | ||
2461 | { | ||
2462 | ql_free_large_buffers(qdev); | ||
2463 | ql_free_small_buffers(qdev); | ||
2464 | ql_free_buffer_queues(qdev); | ||
2465 | ql_free_net_req_rsp_queues(qdev); | ||
2466 | if (qdev->shadow_reg_virt_addr != NULL) { | ||
2467 | pci_free_consistent(qdev->pdev, | ||
2468 | PAGE_SIZE, | ||
2469 | qdev->shadow_reg_virt_addr, | ||
2470 | qdev->shadow_reg_phy_addr); | ||
2471 | qdev->shadow_reg_virt_addr = NULL; | ||
2472 | } | ||
2473 | } | ||
2474 | |||
2475 | static int ql_init_misc_registers(struct ql3_adapter *qdev) | ||
2476 | { | ||
2477 | struct ql3xxx_local_ram_registers *local_ram = | ||
2478 | (struct ql3xxx_local_ram_registers *)qdev->mem_map_registers; | ||
2479 | |||
2480 | if(ql_sem_spinlock(qdev, QL_DDR_RAM_SEM_MASK, | ||
2481 | (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) * | ||
2482 | 2) << 4)) | ||
2483 | return -1; | ||
2484 | |||
2485 | ql_write_page2_reg(qdev, | ||
2486 | &local_ram->bufletSize, qdev->nvram_data.bufletSize); | ||
2487 | |||
2488 | ql_write_page2_reg(qdev, | ||
2489 | &local_ram->maxBufletCount, | ||
2490 | qdev->nvram_data.bufletCount); | ||
2491 | |||
2492 | ql_write_page2_reg(qdev, | ||
2493 | &local_ram->freeBufletThresholdLow, | ||
2494 | (qdev->nvram_data.tcpWindowThreshold25 << 16) | | ||
2495 | (qdev->nvram_data.tcpWindowThreshold0)); | ||
2496 | |||
2497 | ql_write_page2_reg(qdev, | ||
2498 | &local_ram->freeBufletThresholdHigh, | ||
2499 | qdev->nvram_data.tcpWindowThreshold50); | ||
2500 | |||
2501 | ql_write_page2_reg(qdev, | ||
2502 | &local_ram->ipHashTableBase, | ||
2503 | (qdev->nvram_data.ipHashTableBaseHi << 16) | | ||
2504 | qdev->nvram_data.ipHashTableBaseLo); | ||
2505 | ql_write_page2_reg(qdev, | ||
2506 | &local_ram->ipHashTableCount, | ||
2507 | qdev->nvram_data.ipHashTableSize); | ||
2508 | ql_write_page2_reg(qdev, | ||
2509 | &local_ram->tcpHashTableBase, | ||
2510 | (qdev->nvram_data.tcpHashTableBaseHi << 16) | | ||
2511 | qdev->nvram_data.tcpHashTableBaseLo); | ||
2512 | ql_write_page2_reg(qdev, | ||
2513 | &local_ram->tcpHashTableCount, | ||
2514 | qdev->nvram_data.tcpHashTableSize); | ||
2515 | ql_write_page2_reg(qdev, | ||
2516 | &local_ram->ncbBase, | ||
2517 | (qdev->nvram_data.ncbTableBaseHi << 16) | | ||
2518 | qdev->nvram_data.ncbTableBaseLo); | ||
2519 | ql_write_page2_reg(qdev, | ||
2520 | &local_ram->maxNcbCount, | ||
2521 | qdev->nvram_data.ncbTableSize); | ||
2522 | ql_write_page2_reg(qdev, | ||
2523 | &local_ram->drbBase, | ||
2524 | (qdev->nvram_data.drbTableBaseHi << 16) | | ||
2525 | qdev->nvram_data.drbTableBaseLo); | ||
2526 | ql_write_page2_reg(qdev, | ||
2527 | &local_ram->maxDrbCount, | ||
2528 | qdev->nvram_data.drbTableSize); | ||
2529 | ql_sem_unlock(qdev, QL_DDR_RAM_SEM_MASK); | ||
2530 | return 0; | ||
2531 | } | ||
2532 | |||
2533 | static int ql_adapter_initialize(struct ql3_adapter *qdev) | ||
2534 | { | ||
2535 | u32 value; | ||
2536 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | ||
2537 | struct ql3xxx_host_memory_registers __iomem *hmem_regs = | ||
2538 | (struct ql3xxx_host_memory_registers *)port_regs; | ||
2539 | u32 delay = 10; | ||
2540 | int status = 0; | ||
2541 | |||
2542 | if(ql_mii_setup(qdev)) | ||
2543 | return -1; | ||
2544 | |||
2545 | /* Bring out PHY out of reset */ | ||
2546 | ql_write_common_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg, | ||
2547 | (ISP_SERIAL_PORT_IF_WE | | ||
2548 | (ISP_SERIAL_PORT_IF_WE << 16))); | ||
2549 | |||
2550 | qdev->port_link_state = LS_DOWN; | ||
2551 | netif_carrier_off(qdev->ndev); | ||
2552 | |||
2553 | /* V2 chip fix for ARS-39168. */ | ||
2554 | ql_write_common_reg(qdev, &port_regs->CommonRegs.serialPortInterfaceReg, | ||
2555 | (ISP_SERIAL_PORT_IF_SDE | | ||
2556 | (ISP_SERIAL_PORT_IF_SDE << 16))); | ||
2557 | |||
2558 | /* Request Queue Registers */ | ||
2559 | *((u32 *) (qdev->preq_consumer_index)) = 0; | ||
2560 | atomic_set(&qdev->tx_count,NUM_REQ_Q_ENTRIES); | ||
2561 | qdev->req_producer_index = 0; | ||
2562 | |||
2563 | ql_write_page1_reg(qdev, | ||
2564 | &hmem_regs->reqConsumerIndexAddrHigh, | ||
2565 | qdev->req_consumer_index_phy_addr_high); | ||
2566 | ql_write_page1_reg(qdev, | ||
2567 | &hmem_regs->reqConsumerIndexAddrLow, | ||
2568 | qdev->req_consumer_index_phy_addr_low); | ||
2569 | |||
2570 | ql_write_page1_reg(qdev, | ||
2571 | &hmem_regs->reqBaseAddrHigh, | ||
2572 | MS_64BITS(qdev->req_q_phy_addr)); | ||
2573 | ql_write_page1_reg(qdev, | ||
2574 | &hmem_regs->reqBaseAddrLow, | ||
2575 | LS_64BITS(qdev->req_q_phy_addr)); | ||
2576 | ql_write_page1_reg(qdev, &hmem_regs->reqLength, NUM_REQ_Q_ENTRIES); | ||
2577 | |||
2578 | /* Response Queue Registers */ | ||
2579 | *((u16 *) (qdev->prsp_producer_index)) = 0; | ||
2580 | qdev->rsp_consumer_index = 0; | ||
2581 | qdev->rsp_current = qdev->rsp_q_virt_addr; | ||
2582 | |||
2583 | ql_write_page1_reg(qdev, | ||
2584 | &hmem_regs->rspProducerIndexAddrHigh, | ||
2585 | qdev->rsp_producer_index_phy_addr_high); | ||
2586 | |||
2587 | ql_write_page1_reg(qdev, | ||
2588 | &hmem_regs->rspProducerIndexAddrLow, | ||
2589 | qdev->rsp_producer_index_phy_addr_low); | ||
2590 | |||
2591 | ql_write_page1_reg(qdev, | ||
2592 | &hmem_regs->rspBaseAddrHigh, | ||
2593 | MS_64BITS(qdev->rsp_q_phy_addr)); | ||
2594 | |||
2595 | ql_write_page1_reg(qdev, | ||
2596 | &hmem_regs->rspBaseAddrLow, | ||
2597 | LS_64BITS(qdev->rsp_q_phy_addr)); | ||
2598 | |||
2599 | ql_write_page1_reg(qdev, &hmem_regs->rspLength, NUM_RSP_Q_ENTRIES); | ||
2600 | |||
2601 | /* Large Buffer Queue */ | ||
2602 | ql_write_page1_reg(qdev, | ||
2603 | &hmem_regs->rxLargeQBaseAddrHigh, | ||
2604 | MS_64BITS(qdev->lrg_buf_q_phy_addr)); | ||
2605 | |||
2606 | ql_write_page1_reg(qdev, | ||
2607 | &hmem_regs->rxLargeQBaseAddrLow, | ||
2608 | LS_64BITS(qdev->lrg_buf_q_phy_addr)); | ||
2609 | |||
2610 | ql_write_page1_reg(qdev, &hmem_regs->rxLargeQLength, NUM_LBUFQ_ENTRIES); | ||
2611 | |||
2612 | ql_write_page1_reg(qdev, | ||
2613 | &hmem_regs->rxLargeBufferLength, | ||
2614 | qdev->lrg_buffer_len); | ||
2615 | |||
2616 | /* Small Buffer Queue */ | ||
2617 | ql_write_page1_reg(qdev, | ||
2618 | &hmem_regs->rxSmallQBaseAddrHigh, | ||
2619 | MS_64BITS(qdev->small_buf_q_phy_addr)); | ||
2620 | |||
2621 | ql_write_page1_reg(qdev, | ||
2622 | &hmem_regs->rxSmallQBaseAddrLow, | ||
2623 | LS_64BITS(qdev->small_buf_q_phy_addr)); | ||
2624 | |||
2625 | ql_write_page1_reg(qdev, &hmem_regs->rxSmallQLength, NUM_SBUFQ_ENTRIES); | ||
2626 | ql_write_page1_reg(qdev, | ||
2627 | &hmem_regs->rxSmallBufferLength, | ||
2628 | QL_SMALL_BUFFER_SIZE); | ||
2629 | |||
2630 | qdev->small_buf_q_producer_index = NUM_SBUFQ_ENTRIES - 1; | ||
2631 | qdev->small_buf_release_cnt = 8; | ||
2632 | qdev->lrg_buf_q_producer_index = NUM_LBUFQ_ENTRIES - 1; | ||
2633 | qdev->lrg_buf_release_cnt = 8; | ||
2634 | qdev->lrg_buf_next_free = | ||
2635 | (struct bufq_addr_element *)qdev->lrg_buf_q_virt_addr; | ||
2636 | qdev->small_buf_index = 0; | ||
2637 | qdev->lrg_buf_index = 0; | ||
2638 | qdev->lrg_buf_free_count = 0; | ||
2639 | qdev->lrg_buf_free_head = NULL; | ||
2640 | qdev->lrg_buf_free_tail = NULL; | ||
2641 | |||
2642 | ql_write_common_reg(qdev, | ||
2643 | (u32 *) & port_regs->CommonRegs. | ||
2644 | rxSmallQProducerIndex, | ||
2645 | qdev->small_buf_q_producer_index); | ||
2646 | ql_write_common_reg(qdev, | ||
2647 | (u32 *) & port_regs->CommonRegs. | ||
2648 | rxLargeQProducerIndex, | ||
2649 | qdev->lrg_buf_q_producer_index); | ||
2650 | |||
2651 | /* | ||
2652 | * Find out if the chip has already been initialized. If it has, then | ||
2653 | * we skip some of the initialization. | ||
2654 | */ | ||
2655 | clear_bit(QL_LINK_MASTER, &qdev->flags); | ||
2656 | value = ql_read_page0_reg(qdev, &port_regs->portStatus); | ||
2657 | if ((value & PORT_STATUS_IC) == 0) { | ||
2658 | |||
2659 | /* Chip has not been configured yet, so let it rip. */ | ||
2660 | if(ql_init_misc_registers(qdev)) { | ||
2661 | status = -1; | ||
2662 | goto out; | ||
2663 | } | ||
2664 | |||
2665 | if (qdev->mac_index) | ||
2666 | ql_write_page0_reg(qdev, | ||
2667 | &port_regs->mac1MaxFrameLengthReg, | ||
2668 | qdev->max_frame_size); | ||
2669 | else | ||
2670 | ql_write_page0_reg(qdev, | ||
2671 | &port_regs->mac0MaxFrameLengthReg, | ||
2672 | qdev->max_frame_size); | ||
2673 | |||
2674 | value = qdev->nvram_data.tcpMaxWindowSize; | ||
2675 | ql_write_page0_reg(qdev, &port_regs->tcpMaxWindow, value); | ||
2676 | |||
2677 | value = (0xFFFF << 16) | qdev->nvram_data.extHwConfig; | ||
2678 | |||
2679 | if(ql_sem_spinlock(qdev, QL_FLASH_SEM_MASK, | ||
2680 | (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) | ||
2681 | * 2) << 13)) { | ||
2682 | status = -1; | ||
2683 | goto out; | ||
2684 | } | ||
2685 | ql_write_page0_reg(qdev, &port_regs->ExternalHWConfig, value); | ||
2686 | ql_write_page0_reg(qdev, &port_regs->InternalChipConfig, | ||
2687 | (((INTERNAL_CHIP_SD | INTERNAL_CHIP_WE) << | ||
2688 | 16) | (INTERNAL_CHIP_SD | | ||
2689 | INTERNAL_CHIP_WE))); | ||
2690 | ql_sem_unlock(qdev, QL_FLASH_SEM_MASK); | ||
2691 | } | ||
2692 | |||
2693 | |||
2694 | if(ql_sem_spinlock(qdev, QL_PHY_GIO_SEM_MASK, | ||
2695 | (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) * | ||
2696 | 2) << 7)) { | ||
2697 | status = -1; | ||
2698 | goto out; | ||
2699 | } | ||
2700 | |||
2701 | ql_init_scan_mode(qdev); | ||
2702 | ql_get_phy_owner(qdev); | ||
2703 | |||
2704 | /* Load the MAC Configuration */ | ||
2705 | |||
2706 | /* Program lower 32 bits of the MAC address */ | ||
2707 | ql_write_page0_reg(qdev, &port_regs->macAddrIndirectPtrReg, | ||
2708 | (MAC_ADDR_INDIRECT_PTR_REG_RP_MASK << 16)); | ||
2709 | ql_write_page0_reg(qdev, &port_regs->macAddrDataReg, | ||
2710 | ((qdev->ndev->dev_addr[2] << 24) | ||
2711 | | (qdev->ndev->dev_addr[3] << 16) | ||
2712 | | (qdev->ndev->dev_addr[4] << 8) | ||
2713 | | qdev->ndev->dev_addr[5])); | ||
2714 | |||
2715 | /* Program top 16 bits of the MAC address */ | ||
2716 | ql_write_page0_reg(qdev, &port_regs->macAddrIndirectPtrReg, | ||
2717 | ((MAC_ADDR_INDIRECT_PTR_REG_RP_MASK << 16) | 1)); | ||
2718 | ql_write_page0_reg(qdev, &port_regs->macAddrDataReg, | ||
2719 | ((qdev->ndev->dev_addr[0] << 8) | ||
2720 | | qdev->ndev->dev_addr[1])); | ||
2721 | |||
2722 | /* Enable Primary MAC */ | ||
2723 | ql_write_page0_reg(qdev, &port_regs->macAddrIndirectPtrReg, | ||
2724 | ((MAC_ADDR_INDIRECT_PTR_REG_PE << 16) | | ||
2725 | MAC_ADDR_INDIRECT_PTR_REG_PE)); | ||
2726 | |||
2727 | /* Clear Primary and Secondary IP addresses */ | ||
2728 | ql_write_page0_reg(qdev, &port_regs->ipAddrIndexReg, | ||
2729 | ((IP_ADDR_INDEX_REG_MASK << 16) | | ||
2730 | (qdev->mac_index << 2))); | ||
2731 | ql_write_page0_reg(qdev, &port_regs->ipAddrDataReg, 0); | ||
2732 | |||
2733 | ql_write_page0_reg(qdev, &port_regs->ipAddrIndexReg, | ||
2734 | ((IP_ADDR_INDEX_REG_MASK << 16) | | ||
2735 | ((qdev->mac_index << 2) + 1))); | ||
2736 | ql_write_page0_reg(qdev, &port_regs->ipAddrDataReg, 0); | ||
2737 | |||
2738 | ql_sem_unlock(qdev, QL_PHY_GIO_SEM_MASK); | ||
2739 | |||
2740 | /* Indicate Configuration Complete */ | ||
2741 | ql_write_page0_reg(qdev, | ||
2742 | &port_regs->portControl, | ||
2743 | ((PORT_CONTROL_CC << 16) | PORT_CONTROL_CC)); | ||
2744 | |||
2745 | do { | ||
2746 | value = ql_read_page0_reg(qdev, &port_regs->portStatus); | ||
2747 | if (value & PORT_STATUS_IC) | ||
2748 | break; | ||
2749 | msleep(500); | ||
2750 | } while (--delay); | ||
2751 | |||
2752 | if (delay == 0) { | ||
2753 | printk(KERN_ERR PFX | ||
2754 | "%s: Hw Initialization timeout.\n", qdev->ndev->name); | ||
2755 | status = -1; | ||
2756 | goto out; | ||
2757 | } | ||
2758 | |||
2759 | /* Enable Ethernet Function */ | ||
2760 | value = | ||
2761 | (PORT_CONTROL_EF | PORT_CONTROL_ET | PORT_CONTROL_EI | | ||
2762 | PORT_CONTROL_HH); | ||
2763 | ql_write_page0_reg(qdev, &port_regs->portControl, | ||
2764 | ((value << 16) | value)); | ||
2765 | |||
2766 | out: | ||
2767 | return status; | ||
2768 | } | ||
2769 | |||
2770 | /* | ||
2771 | * Caller holds hw_lock. | ||
2772 | */ | ||
2773 | static int ql_adapter_reset(struct ql3_adapter *qdev) | ||
2774 | { | ||
2775 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | ||
2776 | int status = 0; | ||
2777 | u16 value; | ||
2778 | int max_wait_time; | ||
2779 | |||
2780 | set_bit(QL_RESET_ACTIVE, &qdev->flags); | ||
2781 | clear_bit(QL_RESET_DONE, &qdev->flags); | ||
2782 | |||
2783 | /* | ||
2784 | * Issue soft reset to chip. | ||
2785 | */ | ||
2786 | printk(KERN_DEBUG PFX | ||
2787 | "%s: Issue soft reset to chip.\n", | ||
2788 | qdev->ndev->name); | ||
2789 | ql_write_common_reg(qdev, | ||
2790 | (u32 *) & port_regs->CommonRegs.ispControlStatus, | ||
2791 | ((ISP_CONTROL_SR << 16) | ISP_CONTROL_SR)); | ||
2792 | |||
2793 | /* Wait 3 seconds for reset to complete. */ | ||
2794 | printk(KERN_DEBUG PFX | ||
2795 | "%s: Wait 10 milliseconds for reset to complete.\n", | ||
2796 | qdev->ndev->name); | ||
2797 | |||
2798 | /* Wait until the firmware tells us the Soft Reset is done */ | ||
2799 | max_wait_time = 5; | ||
2800 | do { | ||
2801 | value = | ||
2802 | ql_read_common_reg(qdev, | ||
2803 | &port_regs->CommonRegs.ispControlStatus); | ||
2804 | if ((value & ISP_CONTROL_SR) == 0) | ||
2805 | break; | ||
2806 | |||
2807 | ssleep(1); | ||
2808 | } while ((--max_wait_time)); | ||
2809 | |||
2810 | /* | ||
2811 | * Also, make sure that the Network Reset Interrupt bit has been | ||
2812 | * cleared after the soft reset has taken place. | ||
2813 | */ | ||
2814 | value = | ||
2815 | ql_read_common_reg(qdev, &port_regs->CommonRegs.ispControlStatus); | ||
2816 | if (value & ISP_CONTROL_RI) { | ||
2817 | printk(KERN_DEBUG PFX | ||
2818 | "ql_adapter_reset: clearing RI after reset.\n"); | ||
2819 | ql_write_common_reg(qdev, | ||
2820 | (u32 *) & port_regs->CommonRegs. | ||
2821 | ispControlStatus, | ||
2822 | ((ISP_CONTROL_RI << 16) | ISP_CONTROL_RI)); | ||
2823 | } | ||
2824 | |||
2825 | if (max_wait_time == 0) { | ||
2826 | /* Issue Force Soft Reset */ | ||
2827 | ql_write_common_reg(qdev, | ||
2828 | (u32 *) & port_regs->CommonRegs. | ||
2829 | ispControlStatus, | ||
2830 | ((ISP_CONTROL_FSR << 16) | | ||
2831 | ISP_CONTROL_FSR)); | ||
2832 | /* | ||
2833 | * Wait until the firmware tells us the Force Soft Reset is | ||
2834 | * done | ||
2835 | */ | ||
2836 | max_wait_time = 5; | ||
2837 | do { | ||
2838 | value = | ||
2839 | ql_read_common_reg(qdev, | ||
2840 | &port_regs->CommonRegs. | ||
2841 | ispControlStatus); | ||
2842 | if ((value & ISP_CONTROL_FSR) == 0) { | ||
2843 | break; | ||
2844 | } | ||
2845 | ssleep(1); | ||
2846 | } while ((--max_wait_time)); | ||
2847 | } | ||
2848 | if (max_wait_time == 0) | ||
2849 | status = 1; | ||
2850 | |||
2851 | clear_bit(QL_RESET_ACTIVE, &qdev->flags); | ||
2852 | set_bit(QL_RESET_DONE, &qdev->flags); | ||
2853 | return status; | ||
2854 | } | ||
2855 | |||
2856 | static void ql_set_mac_info(struct ql3_adapter *qdev) | ||
2857 | { | ||
2858 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | ||
2859 | u32 value, port_status; | ||
2860 | u8 func_number; | ||
2861 | |||
2862 | /* Get the function number */ | ||
2863 | value = | ||
2864 | ql_read_common_reg_l(qdev, &port_regs->CommonRegs.ispControlStatus); | ||
2865 | func_number = (u8) ((value >> 4) & OPCODE_FUNC_ID_MASK); | ||
2866 | port_status = ql_read_page0_reg(qdev, &port_regs->portStatus); | ||
2867 | switch (value & ISP_CONTROL_FN_MASK) { | ||
2868 | case ISP_CONTROL_FN0_NET: | ||
2869 | qdev->mac_index = 0; | ||
2870 | qdev->mac_ob_opcode = OUTBOUND_MAC_IOCB | func_number; | ||
2871 | qdev->tcp_ob_opcode = OUTBOUND_TCP_IOCB | func_number; | ||
2872 | qdev->update_ob_opcode = UPDATE_NCB_IOCB | func_number; | ||
2873 | qdev->mb_bit_mask = FN0_MA_BITS_MASK; | ||
2874 | qdev->PHYAddr = PORT0_PHY_ADDRESS; | ||
2875 | if (port_status & PORT_STATUS_SM0) | ||
2876 | set_bit(QL_LINK_OPTICAL,&qdev->flags); | ||
2877 | else | ||
2878 | clear_bit(QL_LINK_OPTICAL,&qdev->flags); | ||
2879 | break; | ||
2880 | |||
2881 | case ISP_CONTROL_FN1_NET: | ||
2882 | qdev->mac_index = 1; | ||
2883 | qdev->mac_ob_opcode = OUTBOUND_MAC_IOCB | func_number; | ||
2884 | qdev->tcp_ob_opcode = OUTBOUND_TCP_IOCB | func_number; | ||
2885 | qdev->update_ob_opcode = UPDATE_NCB_IOCB | func_number; | ||
2886 | qdev->mb_bit_mask = FN1_MA_BITS_MASK; | ||
2887 | qdev->PHYAddr = PORT1_PHY_ADDRESS; | ||
2888 | if (port_status & PORT_STATUS_SM1) | ||
2889 | set_bit(QL_LINK_OPTICAL,&qdev->flags); | ||
2890 | else | ||
2891 | clear_bit(QL_LINK_OPTICAL,&qdev->flags); | ||
2892 | break; | ||
2893 | |||
2894 | case ISP_CONTROL_FN0_SCSI: | ||
2895 | case ISP_CONTROL_FN1_SCSI: | ||
2896 | default: | ||
2897 | printk(KERN_DEBUG PFX | ||
2898 | "%s: Invalid function number, ispControlStatus = 0x%x\n", | ||
2899 | qdev->ndev->name,value); | ||
2900 | break; | ||
2901 | } | ||
2902 | qdev->numPorts = qdev->nvram_data.numPorts; | ||
2903 | } | ||
2904 | |||
2905 | static void ql_display_dev_info(struct net_device *ndev) | ||
2906 | { | ||
2907 | struct ql3_adapter *qdev = (struct ql3_adapter *)netdev_priv(ndev); | ||
2908 | struct pci_dev *pdev = qdev->pdev; | ||
2909 | |||
2910 | printk(KERN_INFO PFX | ||
2911 | "\n%s Adapter %d RevisionID %d found on PCI slot %d.\n", | ||
2912 | DRV_NAME, qdev->index, qdev->chip_rev_id, qdev->pci_slot); | ||
2913 | printk(KERN_INFO PFX | ||
2914 | "%s Interface.\n", | ||
2915 | test_bit(QL_LINK_OPTICAL,&qdev->flags) ? "OPTICAL" : "COPPER"); | ||
2916 | |||
2917 | /* | ||
2918 | * Print PCI bus width/type. | ||
2919 | */ | ||
2920 | printk(KERN_INFO PFX | ||
2921 | "Bus interface is %s %s.\n", | ||
2922 | ((qdev->pci_width == 64) ? "64-bit" : "32-bit"), | ||
2923 | ((qdev->pci_x) ? "PCI-X" : "PCI")); | ||
2924 | |||
2925 | printk(KERN_INFO PFX | ||
2926 | "mem IO base address adjusted = 0x%p\n", | ||
2927 | qdev->mem_map_registers); | ||
2928 | printk(KERN_INFO PFX "Interrupt number = %d\n", pdev->irq); | ||
2929 | |||
2930 | if (netif_msg_probe(qdev)) | ||
2931 | printk(KERN_INFO PFX | ||
2932 | "%s: MAC address %02x:%02x:%02x:%02x:%02x:%02x\n", | ||
2933 | ndev->name, ndev->dev_addr[0], ndev->dev_addr[1], | ||
2934 | ndev->dev_addr[2], ndev->dev_addr[3], ndev->dev_addr[4], | ||
2935 | ndev->dev_addr[5]); | ||
2936 | } | ||
2937 | |||
2938 | static int ql_adapter_down(struct ql3_adapter *qdev, int do_reset) | ||
2939 | { | ||
2940 | struct net_device *ndev = qdev->ndev; | ||
2941 | int retval = 0; | ||
2942 | |||
2943 | netif_stop_queue(ndev); | ||
2944 | netif_carrier_off(ndev); | ||
2945 | |||
2946 | clear_bit(QL_ADAPTER_UP,&qdev->flags); | ||
2947 | clear_bit(QL_LINK_MASTER,&qdev->flags); | ||
2948 | |||
2949 | ql_disable_interrupts(qdev); | ||
2950 | |||
2951 | free_irq(qdev->pdev->irq, ndev); | ||
2952 | |||
2953 | if (qdev->msi && test_bit(QL_MSI_ENABLED,&qdev->flags)) { | ||
2954 | printk(KERN_INFO PFX | ||
2955 | "%s: calling pci_disable_msi().\n", qdev->ndev->name); | ||
2956 | clear_bit(QL_MSI_ENABLED,&qdev->flags); | ||
2957 | pci_disable_msi(qdev->pdev); | ||
2958 | } | ||
2959 | |||
2960 | del_timer_sync(&qdev->adapter_timer); | ||
2961 | |||
2962 | netif_poll_disable(ndev); | ||
2963 | |||
2964 | if (do_reset) { | ||
2965 | int soft_reset; | ||
2966 | unsigned long hw_flags; | ||
2967 | |||
2968 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); | ||
2969 | if (ql_wait_for_drvr_lock(qdev)) { | ||
2970 | if ((soft_reset = ql_adapter_reset(qdev))) { | ||
2971 | printk(KERN_ERR PFX | ||
2972 | "%s: ql_adapter_reset(%d) FAILED!\n", | ||
2973 | ndev->name, qdev->index); | ||
2974 | } | ||
2975 | printk(KERN_ERR PFX | ||
2976 | "%s: Releaseing driver lock via chip reset.\n",ndev->name); | ||
2977 | } else { | ||
2978 | printk(KERN_ERR PFX | ||
2979 | "%s: Could not acquire driver lock to do " | ||
2980 | "reset!\n", ndev->name); | ||
2981 | retval = -1; | ||
2982 | } | ||
2983 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | ||
2984 | } | ||
2985 | ql_free_mem_resources(qdev); | ||
2986 | return retval; | ||
2987 | } | ||
2988 | |||
2989 | static int ql_adapter_up(struct ql3_adapter *qdev) | ||
2990 | { | ||
2991 | struct net_device *ndev = qdev->ndev; | ||
2992 | int err; | ||
2993 | unsigned long irq_flags = SA_SAMPLE_RANDOM | SA_SHIRQ; | ||
2994 | unsigned long hw_flags; | ||
2995 | |||
2996 | if (ql_alloc_mem_resources(qdev)) { | ||
2997 | printk(KERN_ERR PFX | ||
2998 | "%s Unable to allocate buffers.\n", ndev->name); | ||
2999 | return -ENOMEM; | ||
3000 | } | ||
3001 | |||
3002 | if (qdev->msi) { | ||
3003 | if (pci_enable_msi(qdev->pdev)) { | ||
3004 | printk(KERN_ERR PFX | ||
3005 | "%s: User requested MSI, but MSI failed to " | ||
3006 | "initialize. Continuing without MSI.\n", | ||
3007 | qdev->ndev->name); | ||
3008 | qdev->msi = 0; | ||
3009 | } else { | ||
3010 | printk(KERN_INFO PFX "%s: MSI Enabled...\n", qdev->ndev->name); | ||
3011 | set_bit(QL_MSI_ENABLED,&qdev->flags); | ||
3012 | irq_flags &= ~SA_SHIRQ; | ||
3013 | } | ||
3014 | } | ||
3015 | |||
3016 | if ((err = request_irq(qdev->pdev->irq, | ||
3017 | ql3xxx_isr, | ||
3018 | irq_flags, ndev->name, ndev))) { | ||
3019 | printk(KERN_ERR PFX | ||
3020 | "%s: Failed to reserve interrupt %d already in use.\n", | ||
3021 | ndev->name, qdev->pdev->irq); | ||
3022 | goto err_irq; | ||
3023 | } | ||
3024 | |||
3025 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); | ||
3026 | |||
3027 | if ((err = ql_wait_for_drvr_lock(qdev))) { | ||
3028 | if ((err = ql_adapter_initialize(qdev))) { | ||
3029 | printk(KERN_ERR PFX | ||
3030 | "%s: Unable to initialize adapter.\n", | ||
3031 | ndev->name); | ||
3032 | goto err_init; | ||
3033 | } | ||
3034 | printk(KERN_ERR PFX | ||
3035 | "%s: Releaseing driver lock.\n",ndev->name); | ||
3036 | ql_sem_unlock(qdev, QL_DRVR_SEM_MASK); | ||
3037 | } else { | ||
3038 | printk(KERN_ERR PFX | ||
3039 | "%s: Could not aquire driver lock.\n", | ||
3040 | ndev->name); | ||
3041 | goto err_lock; | ||
3042 | } | ||
3043 | |||
3044 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | ||
3045 | |||
3046 | set_bit(QL_ADAPTER_UP,&qdev->flags); | ||
3047 | |||
3048 | mod_timer(&qdev->adapter_timer, jiffies + HZ * 1); | ||
3049 | |||
3050 | netif_poll_enable(ndev); | ||
3051 | ql_enable_interrupts(qdev); | ||
3052 | return 0; | ||
3053 | |||
3054 | err_init: | ||
3055 | ql_sem_unlock(qdev, QL_DRVR_SEM_MASK); | ||
3056 | err_lock: | ||
3057 | free_irq(qdev->pdev->irq, ndev); | ||
3058 | err_irq: | ||
3059 | if (qdev->msi && test_bit(QL_MSI_ENABLED,&qdev->flags)) { | ||
3060 | printk(KERN_INFO PFX | ||
3061 | "%s: calling pci_disable_msi().\n", | ||
3062 | qdev->ndev->name); | ||
3063 | clear_bit(QL_MSI_ENABLED,&qdev->flags); | ||
3064 | pci_disable_msi(qdev->pdev); | ||
3065 | } | ||
3066 | return err; | ||
3067 | } | ||
3068 | |||
3069 | static int ql_cycle_adapter(struct ql3_adapter *qdev, int reset) | ||
3070 | { | ||
3071 | if( ql_adapter_down(qdev,reset) || ql_adapter_up(qdev)) { | ||
3072 | printk(KERN_ERR PFX | ||
3073 | "%s: Driver up/down cycle failed, " | ||
3074 | "closing device\n",qdev->ndev->name); | ||
3075 | dev_close(qdev->ndev); | ||
3076 | return -1; | ||
3077 | } | ||
3078 | return 0; | ||
3079 | } | ||
3080 | |||
3081 | static int ql3xxx_close(struct net_device *ndev) | ||
3082 | { | ||
3083 | struct ql3_adapter *qdev = netdev_priv(ndev); | ||
3084 | |||
3085 | /* | ||
3086 | * Wait for device to recover from a reset. | ||
3087 | * (Rarely happens, but possible.) | ||
3088 | */ | ||
3089 | while (!test_bit(QL_ADAPTER_UP,&qdev->flags)) | ||
3090 | msleep(50); | ||
3091 | |||
3092 | ql_adapter_down(qdev,QL_DO_RESET); | ||
3093 | return 0; | ||
3094 | } | ||
3095 | |||
3096 | static int ql3xxx_open(struct net_device *ndev) | ||
3097 | { | ||
3098 | struct ql3_adapter *qdev = netdev_priv(ndev); | ||
3099 | return (ql_adapter_up(qdev)); | ||
3100 | } | ||
3101 | |||
3102 | static struct net_device_stats *ql3xxx_get_stats(struct net_device *dev) | ||
3103 | { | ||
3104 | struct ql3_adapter *qdev = (struct ql3_adapter *)dev->priv; | ||
3105 | return &qdev->stats; | ||
3106 | } | ||
3107 | |||
3108 | static int ql3xxx_change_mtu(struct net_device *ndev, int new_mtu) | ||
3109 | { | ||
3110 | struct ql3_adapter *qdev = netdev_priv(ndev); | ||
3111 | printk(KERN_ERR PFX "%s: new mtu size = %d.\n", ndev->name, new_mtu); | ||
3112 | if (new_mtu != NORMAL_MTU_SIZE && new_mtu != JUMBO_MTU_SIZE) { | ||
3113 | printk(KERN_ERR PFX | ||
3114 | "%s: mtu size of %d is not valid. Use exactly %d or " | ||
3115 | "%d.\n", ndev->name, new_mtu, NORMAL_MTU_SIZE, | ||
3116 | JUMBO_MTU_SIZE); | ||
3117 | return -EINVAL; | ||
3118 | } | ||
3119 | |||
3120 | if (!netif_running(ndev)) { | ||
3121 | ndev->mtu = new_mtu; | ||
3122 | return 0; | ||
3123 | } | ||
3124 | |||
3125 | ndev->mtu = new_mtu; | ||
3126 | return ql_cycle_adapter(qdev,QL_DO_RESET); | ||
3127 | } | ||
3128 | |||
3129 | static void ql3xxx_set_multicast_list(struct net_device *ndev) | ||
3130 | { | ||
3131 | /* | ||
3132 | * We are manually parsing the list in the net_device structure. | ||
3133 | */ | ||
3134 | return; | ||
3135 | } | ||
3136 | |||
3137 | static int ql3xxx_set_mac_address(struct net_device *ndev, void *p) | ||
3138 | { | ||
3139 | struct ql3_adapter *qdev = (struct ql3_adapter *)netdev_priv(ndev); | ||
3140 | struct ql3xxx_port_registers __iomem *port_regs = | ||
3141 | qdev->mem_map_registers; | ||
3142 | struct sockaddr *addr = p; | ||
3143 | unsigned long hw_flags; | ||
3144 | |||
3145 | if (netif_running(ndev)) | ||
3146 | return -EBUSY; | ||
3147 | |||
3148 | if (!is_valid_ether_addr(addr->sa_data)) | ||
3149 | return -EADDRNOTAVAIL; | ||
3150 | |||
3151 | memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len); | ||
3152 | |||
3153 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); | ||
3154 | /* Program lower 32 bits of the MAC address */ | ||
3155 | ql_write_page0_reg(qdev, &port_regs->macAddrIndirectPtrReg, | ||
3156 | (MAC_ADDR_INDIRECT_PTR_REG_RP_MASK << 16)); | ||
3157 | ql_write_page0_reg(qdev, &port_regs->macAddrDataReg, | ||
3158 | ((ndev->dev_addr[2] << 24) | (ndev-> | ||
3159 | dev_addr[3] << 16) | | ||
3160 | (ndev->dev_addr[4] << 8) | ndev->dev_addr[5])); | ||
3161 | |||
3162 | /* Program top 16 bits of the MAC address */ | ||
3163 | ql_write_page0_reg(qdev, &port_regs->macAddrIndirectPtrReg, | ||
3164 | ((MAC_ADDR_INDIRECT_PTR_REG_RP_MASK << 16) | 1)); | ||
3165 | ql_write_page0_reg(qdev, &port_regs->macAddrDataReg, | ||
3166 | ((ndev->dev_addr[0] << 8) | ndev->dev_addr[1])); | ||
3167 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | ||
3168 | |||
3169 | return 0; | ||
3170 | } | ||
3171 | |||
3172 | static void ql3xxx_tx_timeout(struct net_device *ndev) | ||
3173 | { | ||
3174 | struct ql3_adapter *qdev = (struct ql3_adapter *)netdev_priv(ndev); | ||
3175 | |||
3176 | printk(KERN_ERR PFX "%s: Resetting...\n", ndev->name); | ||
3177 | /* | ||
3178 | * Stop the queues, we've got a problem. | ||
3179 | */ | ||
3180 | netif_stop_queue(ndev); | ||
3181 | |||
3182 | /* | ||
3183 | * Wake up the worker to process this event. | ||
3184 | */ | ||
3185 | queue_work(qdev->workqueue, &qdev->tx_timeout_work); | ||
3186 | } | ||
3187 | |||
3188 | static void ql_reset_work(struct ql3_adapter *qdev) | ||
3189 | { | ||
3190 | struct net_device *ndev = qdev->ndev; | ||
3191 | u32 value; | ||
3192 | struct ql_tx_buf_cb *tx_cb; | ||
3193 | int max_wait_time, i; | ||
3194 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | ||
3195 | unsigned long hw_flags; | ||
3196 | |||
3197 | if (test_bit((QL_RESET_PER_SCSI | QL_RESET_START),&qdev->flags)) { | ||
3198 | clear_bit(QL_LINK_MASTER,&qdev->flags); | ||
3199 | |||
3200 | /* | ||
3201 | * Loop through the active list and return the skb. | ||
3202 | */ | ||
3203 | for (i = 0; i < NUM_REQ_Q_ENTRIES; i++) { | ||
3204 | tx_cb = &qdev->tx_buf[i]; | ||
3205 | if (tx_cb->skb) { | ||
3206 | |||
3207 | printk(KERN_DEBUG PFX | ||
3208 | "%s: Freeing lost SKB.\n", | ||
3209 | qdev->ndev->name); | ||
3210 | pci_unmap_single(qdev->pdev, | ||
3211 | pci_unmap_addr(tx_cb, mapaddr), | ||
3212 | pci_unmap_len(tx_cb, maplen), PCI_DMA_TODEVICE); | ||
3213 | dev_kfree_skb(tx_cb->skb); | ||
3214 | tx_cb->skb = NULL; | ||
3215 | } | ||
3216 | } | ||
3217 | |||
3218 | printk(KERN_ERR PFX | ||
3219 | "%s: Clearing NRI after reset.\n", qdev->ndev->name); | ||
3220 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); | ||
3221 | ql_write_common_reg(qdev, | ||
3222 | &port_regs->CommonRegs. | ||
3223 | ispControlStatus, | ||
3224 | ((ISP_CONTROL_RI << 16) | ISP_CONTROL_RI)); | ||
3225 | /* | ||
3226 | * Wait the for Soft Reset to Complete. | ||
3227 | */ | ||
3228 | max_wait_time = 10; | ||
3229 | do { | ||
3230 | value = ql_read_common_reg(qdev, | ||
3231 | &port_regs->CommonRegs. | ||
3232 | |||
3233 | ispControlStatus); | ||
3234 | if ((value & ISP_CONTROL_SR) == 0) { | ||
3235 | printk(KERN_DEBUG PFX | ||
3236 | "%s: reset completed.\n", | ||
3237 | qdev->ndev->name); | ||
3238 | break; | ||
3239 | } | ||
3240 | |||
3241 | if (value & ISP_CONTROL_RI) { | ||
3242 | printk(KERN_DEBUG PFX | ||
3243 | "%s: clearing NRI after reset.\n", | ||
3244 | qdev->ndev->name); | ||
3245 | ql_write_common_reg(qdev, | ||
3246 | (u32 *) & | ||
3247 | port_regs-> | ||
3248 | CommonRegs. | ||
3249 | ispControlStatus, | ||
3250 | ((ISP_CONTROL_RI << | ||
3251 | 16) | ISP_CONTROL_RI)); | ||
3252 | } | ||
3253 | |||
3254 | ssleep(1); | ||
3255 | } while (--max_wait_time); | ||
3256 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | ||
3257 | |||
3258 | if (value & ISP_CONTROL_SR) { | ||
3259 | |||
3260 | /* | ||
3261 | * Set the reset flags and clear the board again. | ||
3262 | * Nothing else to do... | ||
3263 | */ | ||
3264 | printk(KERN_ERR PFX | ||
3265 | "%s: Timed out waiting for reset to " | ||
3266 | "complete.\n", ndev->name); | ||
3267 | printk(KERN_ERR PFX | ||
3268 | "%s: Do a reset.\n", ndev->name); | ||
3269 | clear_bit(QL_RESET_PER_SCSI,&qdev->flags); | ||
3270 | clear_bit(QL_RESET_START,&qdev->flags); | ||
3271 | ql_cycle_adapter(qdev,QL_DO_RESET); | ||
3272 | return; | ||
3273 | } | ||
3274 | |||
3275 | clear_bit(QL_RESET_ACTIVE,&qdev->flags); | ||
3276 | clear_bit(QL_RESET_PER_SCSI,&qdev->flags); | ||
3277 | clear_bit(QL_RESET_START,&qdev->flags); | ||
3278 | ql_cycle_adapter(qdev,QL_NO_RESET); | ||
3279 | } | ||
3280 | } | ||
3281 | |||
3282 | static void ql_tx_timeout_work(struct ql3_adapter *qdev) | ||
3283 | { | ||
3284 | ql_cycle_adapter(qdev,QL_DO_RESET); | ||
3285 | } | ||
3286 | |||
3287 | static void ql_get_board_info(struct ql3_adapter *qdev) | ||
3288 | { | ||
3289 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | ||
3290 | u32 value; | ||
3291 | |||
3292 | value = ql_read_page0_reg_l(qdev, &port_regs->portStatus); | ||
3293 | |||
3294 | qdev->chip_rev_id = ((value & PORT_STATUS_REV_ID_MASK) >> 12); | ||
3295 | if (value & PORT_STATUS_64) | ||
3296 | qdev->pci_width = 64; | ||
3297 | else | ||
3298 | qdev->pci_width = 32; | ||
3299 | if (value & PORT_STATUS_X) | ||
3300 | qdev->pci_x = 1; | ||
3301 | else | ||
3302 | qdev->pci_x = 0; | ||
3303 | qdev->pci_slot = (u8) PCI_SLOT(qdev->pdev->devfn); | ||
3304 | } | ||
3305 | |||
3306 | static void ql3xxx_timer(unsigned long ptr) | ||
3307 | { | ||
3308 | struct ql3_adapter *qdev = (struct ql3_adapter *)ptr; | ||
3309 | |||
3310 | if (test_bit(QL_RESET_ACTIVE,&qdev->flags)) { | ||
3311 | printk(KERN_DEBUG PFX | ||
3312 | "%s: Reset in progress.\n", | ||
3313 | qdev->ndev->name); | ||
3314 | goto end; | ||
3315 | } | ||
3316 | |||
3317 | ql_link_state_machine(qdev); | ||
3318 | |||
3319 | /* Restart timer on 2 second interval. */ | ||
3320 | end: | ||
3321 | mod_timer(&qdev->adapter_timer, jiffies + HZ * 1); | ||
3322 | } | ||
3323 | |||
3324 | static int __devinit ql3xxx_probe(struct pci_dev *pdev, | ||
3325 | const struct pci_device_id *pci_entry) | ||
3326 | { | ||
3327 | struct net_device *ndev = NULL; | ||
3328 | struct ql3_adapter *qdev = NULL; | ||
3329 | static int cards_found = 0; | ||
3330 | int pci_using_dac, err; | ||
3331 | |||
3332 | err = pci_enable_device(pdev); | ||
3333 | if (err) { | ||
3334 | printk(KERN_ERR PFX "%s cannot enable PCI device\n", | ||
3335 | pci_name(pdev)); | ||
3336 | goto err_out; | ||
3337 | } | ||
3338 | |||
3339 | err = pci_request_regions(pdev, DRV_NAME); | ||
3340 | if (err) { | ||
3341 | printk(KERN_ERR PFX "%s cannot obtain PCI resources\n", | ||
3342 | pci_name(pdev)); | ||
3343 | goto err_out_disable_pdev; | ||
3344 | } | ||
3345 | |||
3346 | pci_set_master(pdev); | ||
3347 | |||
3348 | if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) { | ||
3349 | pci_using_dac = 1; | ||
3350 | err = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK); | ||
3351 | } else if (!(err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) { | ||
3352 | pci_using_dac = 0; | ||
3353 | err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); | ||
3354 | } | ||
3355 | |||
3356 | if (err) { | ||
3357 | printk(KERN_ERR PFX "%s no usable DMA configuration\n", | ||
3358 | pci_name(pdev)); | ||
3359 | goto err_out_free_regions; | ||
3360 | } | ||
3361 | |||
3362 | ndev = alloc_etherdev(sizeof(struct ql3_adapter)); | ||
3363 | if (!ndev) | ||
3364 | goto err_out_free_regions; | ||
3365 | |||
3366 | SET_MODULE_OWNER(ndev); | ||
3367 | SET_NETDEV_DEV(ndev, &pdev->dev); | ||
3368 | |||
3369 | ndev->features = NETIF_F_LLTX; | ||
3370 | if (pci_using_dac) | ||
3371 | ndev->features |= NETIF_F_HIGHDMA; | ||
3372 | |||
3373 | pci_set_drvdata(pdev, ndev); | ||
3374 | |||
3375 | qdev = netdev_priv(ndev); | ||
3376 | qdev->index = cards_found; | ||
3377 | qdev->ndev = ndev; | ||
3378 | qdev->pdev = pdev; | ||
3379 | qdev->port_link_state = LS_DOWN; | ||
3380 | if (msi) | ||
3381 | qdev->msi = 1; | ||
3382 | |||
3383 | qdev->msg_enable = netif_msg_init(debug, default_msg); | ||
3384 | |||
3385 | qdev->mem_map_registers = | ||
3386 | ioremap_nocache(pci_resource_start(pdev, 1), | ||
3387 | pci_resource_len(qdev->pdev, 1)); | ||
3388 | if (!qdev->mem_map_registers) { | ||
3389 | printk(KERN_ERR PFX "%s: cannot map device registers\n", | ||
3390 | pci_name(pdev)); | ||
3391 | goto err_out_free_ndev; | ||
3392 | } | ||
3393 | |||
3394 | spin_lock_init(&qdev->adapter_lock); | ||
3395 | spin_lock_init(&qdev->hw_lock); | ||
3396 | |||
3397 | /* Set driver entry points */ | ||
3398 | ndev->open = ql3xxx_open; | ||
3399 | ndev->hard_start_xmit = ql3xxx_send; | ||
3400 | ndev->stop = ql3xxx_close; | ||
3401 | ndev->get_stats = ql3xxx_get_stats; | ||
3402 | ndev->change_mtu = ql3xxx_change_mtu; | ||
3403 | ndev->set_multicast_list = ql3xxx_set_multicast_list; | ||
3404 | SET_ETHTOOL_OPS(ndev, &ql3xxx_ethtool_ops); | ||
3405 | ndev->set_mac_address = ql3xxx_set_mac_address; | ||
3406 | ndev->tx_timeout = ql3xxx_tx_timeout; | ||
3407 | ndev->watchdog_timeo = 5 * HZ; | ||
3408 | |||
3409 | ndev->poll = &ql_poll; | ||
3410 | ndev->weight = 64; | ||
3411 | |||
3412 | ndev->irq = pdev->irq; | ||
3413 | |||
3414 | /* make sure the EEPROM is good */ | ||
3415 | if (ql_get_nvram_params(qdev)) { | ||
3416 | printk(KERN_ALERT PFX | ||
3417 | "ql3xxx_probe: Adapter #%d, Invalid NVRAM parameters.\n", | ||
3418 | qdev->index); | ||
3419 | goto err_out_iounmap; | ||
3420 | } | ||
3421 | |||
3422 | ql_set_mac_info(qdev); | ||
3423 | |||
3424 | /* Validate and set parameters */ | ||
3425 | if (qdev->mac_index) { | ||
3426 | memcpy(ndev->dev_addr, &qdev->nvram_data.funcCfg_fn2.macAddress, | ||
3427 | ETH_ALEN); | ||
3428 | } else { | ||
3429 | memcpy(ndev->dev_addr, &qdev->nvram_data.funcCfg_fn0.macAddress, | ||
3430 | ETH_ALEN); | ||
3431 | } | ||
3432 | memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len); | ||
3433 | |||
3434 | ndev->tx_queue_len = NUM_REQ_Q_ENTRIES; | ||
3435 | |||
3436 | /* Turn off support for multicasting */ | ||
3437 | ndev->flags &= ~IFF_MULTICAST; | ||
3438 | |||
3439 | /* Record PCI bus information. */ | ||
3440 | ql_get_board_info(qdev); | ||
3441 | |||
3442 | /* | ||
3443 | * Set the Maximum Memory Read Byte Count value. We do this to handle | ||
3444 | * jumbo frames. | ||
3445 | */ | ||
3446 | if (qdev->pci_x) { | ||
3447 | pci_write_config_word(pdev, (int)0x4e, (u16) 0x0036); | ||
3448 | } | ||
3449 | |||
3450 | err = register_netdev(ndev); | ||
3451 | if (err) { | ||
3452 | printk(KERN_ERR PFX "%s: cannot register net device\n", | ||
3453 | pci_name(pdev)); | ||
3454 | goto err_out_iounmap; | ||
3455 | } | ||
3456 | |||
3457 | /* we're going to reset, so assume we have no link for now */ | ||
3458 | |||
3459 | netif_carrier_off(ndev); | ||
3460 | netif_stop_queue(ndev); | ||
3461 | |||
3462 | qdev->workqueue = create_singlethread_workqueue(ndev->name); | ||
3463 | INIT_WORK(&qdev->reset_work, (void (*)(void *))ql_reset_work, qdev); | ||
3464 | INIT_WORK(&qdev->tx_timeout_work, | ||
3465 | (void (*)(void *))ql_tx_timeout_work, qdev); | ||
3466 | |||
3467 | init_timer(&qdev->adapter_timer); | ||
3468 | qdev->adapter_timer.function = ql3xxx_timer; | ||
3469 | qdev->adapter_timer.expires = jiffies + HZ * 2; /* two second delay */ | ||
3470 | qdev->adapter_timer.data = (unsigned long)qdev; | ||
3471 | |||
3472 | if(!cards_found) { | ||
3473 | printk(KERN_ALERT PFX "%s\n", DRV_STRING); | ||
3474 | printk(KERN_ALERT PFX "Driver name: %s, Version: %s.\n", | ||
3475 | DRV_NAME, DRV_VERSION); | ||
3476 | } | ||
3477 | ql_display_dev_info(ndev); | ||
3478 | |||
3479 | cards_found++; | ||
3480 | return 0; | ||
3481 | |||
3482 | err_out_iounmap: | ||
3483 | iounmap(qdev->mem_map_registers); | ||
3484 | err_out_free_ndev: | ||
3485 | free_netdev(ndev); | ||
3486 | err_out_free_regions: | ||
3487 | pci_release_regions(pdev); | ||
3488 | err_out_disable_pdev: | ||
3489 | pci_disable_device(pdev); | ||
3490 | pci_set_drvdata(pdev, NULL); | ||
3491 | err_out: | ||
3492 | return err; | ||
3493 | } | ||
3494 | |||
3495 | static void __devexit ql3xxx_remove(struct pci_dev *pdev) | ||
3496 | { | ||
3497 | struct net_device *ndev = pci_get_drvdata(pdev); | ||
3498 | struct ql3_adapter *qdev = netdev_priv(ndev); | ||
3499 | |||
3500 | unregister_netdev(ndev); | ||
3501 | qdev = netdev_priv(ndev); | ||
3502 | |||
3503 | ql_disable_interrupts(qdev); | ||
3504 | |||
3505 | if (qdev->workqueue) { | ||
3506 | cancel_delayed_work(&qdev->reset_work); | ||
3507 | cancel_delayed_work(&qdev->tx_timeout_work); | ||
3508 | destroy_workqueue(qdev->workqueue); | ||
3509 | qdev->workqueue = NULL; | ||
3510 | } | ||
3511 | |||
3512 | iounmap((void *)qdev->mmap_virt_base); | ||
3513 | pci_release_regions(pdev); | ||
3514 | pci_set_drvdata(pdev, NULL); | ||
3515 | free_netdev(ndev); | ||
3516 | } | ||
3517 | |||
3518 | static struct pci_driver ql3xxx_driver = { | ||
3519 | |||
3520 | .name = DRV_NAME, | ||
3521 | .id_table = ql3xxx_pci_tbl, | ||
3522 | .probe = ql3xxx_probe, | ||
3523 | .remove = __devexit_p(ql3xxx_remove), | ||
3524 | }; | ||
3525 | |||
3526 | static int __init ql3xxx_init_module(void) | ||
3527 | { | ||
3528 | return pci_register_driver(&ql3xxx_driver); | ||
3529 | } | ||
3530 | |||
3531 | static void __exit ql3xxx_exit(void) | ||
3532 | { | ||
3533 | pci_unregister_driver(&ql3xxx_driver); | ||
3534 | } | ||
3535 | |||
3536 | module_init(ql3xxx_init_module); | ||
3537 | module_exit(ql3xxx_exit); | ||
diff --git a/drivers/net/qla3xxx.h b/drivers/net/qla3xxx.h new file mode 100644 index 000000000000..9492cee6b083 --- /dev/null +++ b/drivers/net/qla3xxx.h | |||
@@ -0,0 +1,1194 @@ | |||
1 | /* | ||
2 | * QLogic QLA3xxx NIC HBA Driver | ||
3 | * Copyright (c) 2003-2006 QLogic Corporation | ||
4 | * | ||
5 | * See LICENSE.qla3xxx for copyright and licensing details. | ||
6 | */ | ||
7 | #ifndef _QLA3XXX_H_ | ||
8 | #define _QLA3XXX_H_ | ||
9 | |||
10 | /* | ||
11 | * IOCB Definitions... | ||
12 | */ | ||
13 | #pragma pack(1) | ||
14 | |||
15 | #define OPCODE_OB_MAC_IOCB_FN0 0x01 | ||
16 | #define OPCODE_OB_MAC_IOCB_FN2 0x21 | ||
17 | #define OPCODE_OB_TCP_IOCB_FN0 0x03 | ||
18 | #define OPCODE_OB_TCP_IOCB_FN2 0x23 | ||
19 | #define OPCODE_UPDATE_NCB_IOCB_FN0 0x00 | ||
20 | #define OPCODE_UPDATE_NCB_IOCB_FN2 0x20 | ||
21 | |||
22 | #define OPCODE_UPDATE_NCB_IOCB 0xF0 | ||
23 | #define OPCODE_IB_MAC_IOCB 0xF9 | ||
24 | #define OPCODE_IB_IP_IOCB 0xFA | ||
25 | #define OPCODE_IB_TCP_IOCB 0xFB | ||
26 | #define OPCODE_DUMP_PROTO_IOCB 0xFE | ||
27 | #define OPCODE_BUFFER_ALERT_IOCB 0xFB | ||
28 | |||
29 | #define OPCODE_FUNC_ID_MASK 0x30 | ||
30 | #define OUTBOUND_MAC_IOCB 0x01 /* plus function bits */ | ||
31 | #define OUTBOUND_TCP_IOCB 0x03 /* plus function bits */ | ||
32 | #define UPDATE_NCB_IOCB 0x00 /* plus function bits */ | ||
33 | |||
34 | #define FN0_MA_BITS_MASK 0x00 | ||
35 | #define FN1_MA_BITS_MASK 0x80 | ||
36 | |||
37 | struct ob_mac_iocb_req { | ||
38 | u8 opcode; | ||
39 | u8 flags; | ||
40 | #define OB_MAC_IOCB_REQ_MA 0xC0 | ||
41 | #define OB_MAC_IOCB_REQ_F 0x20 | ||
42 | #define OB_MAC_IOCB_REQ_X 0x10 | ||
43 | #define OB_MAC_IOCB_REQ_D 0x02 | ||
44 | #define OB_MAC_IOCB_REQ_I 0x01 | ||
45 | __le16 reserved0; | ||
46 | |||
47 | __le32 transaction_id; | ||
48 | __le16 data_len; | ||
49 | __le16 reserved1; | ||
50 | __le32 reserved2; | ||
51 | __le32 reserved3; | ||
52 | __le32 buf_addr0_low; | ||
53 | __le32 buf_addr0_high; | ||
54 | __le32 buf_0_len; | ||
55 | __le32 buf_addr1_low; | ||
56 | __le32 buf_addr1_high; | ||
57 | __le32 buf_1_len; | ||
58 | __le32 buf_addr2_low; | ||
59 | __le32 buf_addr2_high; | ||
60 | __le32 buf_2_len; | ||
61 | __le32 reserved4; | ||
62 | __le32 reserved5; | ||
63 | }; | ||
64 | /* | ||
65 | * The following constants define control bits for buffer | ||
66 | * length fields for all IOCB's. | ||
67 | */ | ||
68 | #define OB_MAC_IOCB_REQ_E 0x80000000 /* Last valid buffer in list. */ | ||
69 | #define OB_MAC_IOCB_REQ_C 0x40000000 /* points to an OAL. (continuation) */ | ||
70 | #define OB_MAC_IOCB_REQ_L 0x20000000 /* Auburn local address pointer. */ | ||
71 | #define OB_MAC_IOCB_REQ_R 0x10000000 /* 32-bit address pointer. */ | ||
72 | |||
73 | struct ob_mac_iocb_rsp { | ||
74 | u8 opcode; | ||
75 | u8 flags; | ||
76 | #define OB_MAC_IOCB_RSP_P 0x08 | ||
77 | #define OB_MAC_IOCB_RSP_S 0x02 | ||
78 | #define OB_MAC_IOCB_RSP_I 0x01 | ||
79 | |||
80 | __le16 reserved0; | ||
81 | __le32 transaction_id; | ||
82 | __le32 reserved1; | ||
83 | __le32 reserved2; | ||
84 | }; | ||
85 | |||
86 | struct ib_mac_iocb_rsp { | ||
87 | u8 opcode; | ||
88 | u8 flags; | ||
89 | #define IB_MAC_IOCB_RSP_S 0x80 | ||
90 | #define IB_MAC_IOCB_RSP_H1 0x40 | ||
91 | #define IB_MAC_IOCB_RSP_H0 0x20 | ||
92 | #define IB_MAC_IOCB_RSP_B 0x10 | ||
93 | #define IB_MAC_IOCB_RSP_M 0x08 | ||
94 | #define IB_MAC_IOCB_RSP_MA 0x07 | ||
95 | |||
96 | __le16 length; | ||
97 | __le32 reserved; | ||
98 | __le32 ial_low; | ||
99 | __le32 ial_high; | ||
100 | |||
101 | }; | ||
102 | |||
103 | struct ob_ip_iocb_req { | ||
104 | u8 opcode; | ||
105 | __le16 flags; | ||
106 | #define OB_IP_IOCB_REQ_O 0x100 | ||
107 | #define OB_IP_IOCB_REQ_H 0x008 | ||
108 | #define OB_IP_IOCB_REQ_U 0x004 | ||
109 | #define OB_IP_IOCB_REQ_D 0x002 | ||
110 | #define OB_IP_IOCB_REQ_I 0x001 | ||
111 | |||
112 | u8 reserved0; | ||
113 | |||
114 | __le32 transaction_id; | ||
115 | __le16 data_len; | ||
116 | __le16 reserved1; | ||
117 | __le32 hncb_ptr_low; | ||
118 | __le32 hncb_ptr_high; | ||
119 | __le32 buf_addr0_low; | ||
120 | __le32 buf_addr0_high; | ||
121 | __le32 buf_0_len; | ||
122 | __le32 buf_addr1_low; | ||
123 | __le32 buf_addr1_high; | ||
124 | __le32 buf_1_len; | ||
125 | __le32 buf_addr2_low; | ||
126 | __le32 buf_addr2_high; | ||
127 | __le32 buf_2_len; | ||
128 | __le32 reserved2; | ||
129 | __le32 reserved3; | ||
130 | }; | ||
131 | |||
132 | /* defines for BufferLength fields above */ | ||
133 | #define OB_IP_IOCB_REQ_E 0x80000000 | ||
134 | #define OB_IP_IOCB_REQ_C 0x40000000 | ||
135 | #define OB_IP_IOCB_REQ_L 0x20000000 | ||
136 | #define OB_IP_IOCB_REQ_R 0x10000000 | ||
137 | |||
138 | struct ob_ip_iocb_rsp { | ||
139 | u8 opcode; | ||
140 | u8 flags; | ||
141 | #define OB_MAC_IOCB_RSP_E 0x08 | ||
142 | #define OB_MAC_IOCB_RSP_L 0x04 | ||
143 | #define OB_MAC_IOCB_RSP_S 0x02 | ||
144 | #define OB_MAC_IOCB_RSP_I 0x01 | ||
145 | |||
146 | __le16 reserved0; | ||
147 | __le32 transaction_id; | ||
148 | __le32 reserved1; | ||
149 | __le32 reserved2; | ||
150 | }; | ||
151 | |||
152 | struct ob_tcp_iocb_req { | ||
153 | u8 opcode; | ||
154 | |||
155 | u8 flags0; | ||
156 | #define OB_TCP_IOCB_REQ_P 0x80 | ||
157 | #define OB_TCP_IOCB_REQ_CI 0x20 | ||
158 | #define OB_TCP_IOCB_REQ_H 0x10 | ||
159 | #define OB_TCP_IOCB_REQ_LN 0x08 | ||
160 | #define OB_TCP_IOCB_REQ_K 0x04 | ||
161 | #define OB_TCP_IOCB_REQ_D 0x02 | ||
162 | #define OB_TCP_IOCB_REQ_I 0x01 | ||
163 | |||
164 | u8 flags1; | ||
165 | #define OB_TCP_IOCB_REQ_OSM 0x40 | ||
166 | #define OB_TCP_IOCB_REQ_URG 0x20 | ||
167 | #define OB_TCP_IOCB_REQ_ACK 0x10 | ||
168 | #define OB_TCP_IOCB_REQ_PSH 0x08 | ||
169 | #define OB_TCP_IOCB_REQ_RST 0x04 | ||
170 | #define OB_TCP_IOCB_REQ_SYN 0x02 | ||
171 | #define OB_TCP_IOCB_REQ_FIN 0x01 | ||
172 | |||
173 | u8 options_len; | ||
174 | #define OB_TCP_IOCB_REQ_OMASK 0xF0 | ||
175 | #define OB_TCP_IOCB_REQ_SHIFT 4 | ||
176 | |||
177 | __le32 transaction_id; | ||
178 | __le32 data_len; | ||
179 | __le32 hncb_ptr_low; | ||
180 | __le32 hncb_ptr_high; | ||
181 | __le32 buf_addr0_low; | ||
182 | __le32 buf_addr0_high; | ||
183 | __le32 buf_0_len; | ||
184 | __le32 buf_addr1_low; | ||
185 | __le32 buf_addr1_high; | ||
186 | __le32 buf_1_len; | ||
187 | __le32 buf_addr2_low; | ||
188 | __le32 buf_addr2_high; | ||
189 | __le32 buf_2_len; | ||
190 | __le32 time_stamp; | ||
191 | __le32 reserved1; | ||
192 | }; | ||
193 | |||
194 | struct ob_tcp_iocb_rsp { | ||
195 | u8 opcode; | ||
196 | |||
197 | u8 flags0; | ||
198 | #define OB_TCP_IOCB_RSP_C 0x20 | ||
199 | #define OB_TCP_IOCB_RSP_H 0x10 | ||
200 | #define OB_TCP_IOCB_RSP_LN 0x08 | ||
201 | #define OB_TCP_IOCB_RSP_K 0x04 | ||
202 | #define OB_TCP_IOCB_RSP_D 0x02 | ||
203 | #define OB_TCP_IOCB_RSP_I 0x01 | ||
204 | |||
205 | u8 flags1; | ||
206 | #define OB_TCP_IOCB_RSP_E 0x10 | ||
207 | #define OB_TCP_IOCB_RSP_W 0x08 | ||
208 | #define OB_TCP_IOCB_RSP_P 0x04 | ||
209 | #define OB_TCP_IOCB_RSP_T 0x02 | ||
210 | #define OB_TCP_IOCB_RSP_F 0x01 | ||
211 | |||
212 | u8 state; | ||
213 | #define OB_TCP_IOCB_RSP_SMASK 0xF0 | ||
214 | #define OB_TCP_IOCB_RSP_SHIFT 4 | ||
215 | |||
216 | __le32 transaction_id; | ||
217 | __le32 local_ncb_ptr; | ||
218 | __le32 reserved0; | ||
219 | }; | ||
220 | |||
221 | struct ib_ip_iocb_rsp { | ||
222 | u8 opcode; | ||
223 | u8 flags; | ||
224 | #define IB_IP_IOCB_RSP_S 0x80 | ||
225 | #define IB_IP_IOCB_RSP_H1 0x40 | ||
226 | #define IB_IP_IOCB_RSP_H0 0x20 | ||
227 | #define IB_IP_IOCB_RSP_B 0x10 | ||
228 | #define IB_IP_IOCB_RSP_M 0x08 | ||
229 | #define IB_IP_IOCB_RSP_MA 0x07 | ||
230 | |||
231 | __le16 length; | ||
232 | __le16 checksum; | ||
233 | __le16 reserved; | ||
234 | #define IB_IP_IOCB_RSP_R 0x01 | ||
235 | __le32 ial_low; | ||
236 | __le32 ial_high; | ||
237 | }; | ||
238 | |||
239 | struct ib_tcp_iocb_rsp { | ||
240 | u8 opcode; | ||
241 | u8 flags; | ||
242 | #define IB_TCP_IOCB_RSP_P 0x80 | ||
243 | #define IB_TCP_IOCB_RSP_T 0x40 | ||
244 | #define IB_TCP_IOCB_RSP_D 0x20 | ||
245 | #define IB_TCP_IOCB_RSP_N 0x10 | ||
246 | #define IB_TCP_IOCB_RSP_IP 0x03 | ||
247 | #define IB_TCP_FLAG_MASK 0xf0 | ||
248 | #define IB_TCP_FLAG_IOCB_SYN 0x00 | ||
249 | |||
250 | #define TCP_IB_RSP_FLAGS(x) (x->flags & ~IB_TCP_FLAG_MASK) | ||
251 | |||
252 | __le16 length; | ||
253 | __le32 hncb_ref_num; | ||
254 | __le32 ial_low; | ||
255 | __le32 ial_high; | ||
256 | }; | ||
257 | |||
258 | struct net_rsp_iocb { | ||
259 | u8 opcode; | ||
260 | u8 flags; | ||
261 | __le16 reserved0; | ||
262 | __le32 reserved[3]; | ||
263 | }; | ||
264 | #pragma pack() | ||
265 | |||
266 | /* | ||
267 | * Register Definitions... | ||
268 | */ | ||
269 | #define PORT0_PHY_ADDRESS 0x1e00 | ||
270 | #define PORT1_PHY_ADDRESS 0x1f00 | ||
271 | |||
272 | #define ETHERNET_CRC_SIZE 4 | ||
273 | |||
274 | #define MII_SCAN_REGISTER 0x00000001 | ||
275 | |||
276 | /* 32-bit ispControlStatus */ | ||
277 | enum { | ||
278 | ISP_CONTROL_NP_MASK = 0x0003, | ||
279 | ISP_CONTROL_NP_PCSR = 0x0000, | ||
280 | ISP_CONTROL_NP_HMCR = 0x0001, | ||
281 | ISP_CONTROL_NP_LRAMCR = 0x0002, | ||
282 | ISP_CONTROL_NP_PSR = 0x0003, | ||
283 | ISP_CONTROL_RI = 0x0008, | ||
284 | ISP_CONTROL_CI = 0x0010, | ||
285 | ISP_CONTROL_PI = 0x0020, | ||
286 | ISP_CONTROL_IN = 0x0040, | ||
287 | ISP_CONTROL_BE = 0x0080, | ||
288 | ISP_CONTROL_FN_MASK = 0x0700, | ||
289 | ISP_CONTROL_FN0_NET = 0x0400, | ||
290 | ISP_CONTROL_FN0_SCSI = 0x0500, | ||
291 | ISP_CONTROL_FN1_NET = 0x0600, | ||
292 | ISP_CONTROL_FN1_SCSI = 0x0700, | ||
293 | ISP_CONTROL_LINK_DN_0 = 0x0800, | ||
294 | ISP_CONTROL_LINK_DN_1 = 0x1000, | ||
295 | ISP_CONTROL_FSR = 0x2000, | ||
296 | ISP_CONTROL_FE = 0x4000, | ||
297 | ISP_CONTROL_SR = 0x8000, | ||
298 | }; | ||
299 | |||
300 | /* 32-bit ispInterruptMaskReg */ | ||
301 | enum { | ||
302 | ISP_IMR_ENABLE_INT = 0x0004, | ||
303 | ISP_IMR_DISABLE_RESET_INT = 0x0008, | ||
304 | ISP_IMR_DISABLE_CMPL_INT = 0x0010, | ||
305 | ISP_IMR_DISABLE_PROC_INT = 0x0020, | ||
306 | }; | ||
307 | |||
308 | /* 32-bit serialPortInterfaceReg */ | ||
309 | enum { | ||
310 | ISP_SERIAL_PORT_IF_CLK = 0x0001, | ||
311 | ISP_SERIAL_PORT_IF_CS = 0x0002, | ||
312 | ISP_SERIAL_PORT_IF_D0 = 0x0004, | ||
313 | ISP_SERIAL_PORT_IF_DI = 0x0008, | ||
314 | ISP_NVRAM_MASK = (0x000F << 16), | ||
315 | ISP_SERIAL_PORT_IF_WE = 0x0010, | ||
316 | ISP_SERIAL_PORT_IF_NVR_MASK = 0x001F, | ||
317 | ISP_SERIAL_PORT_IF_SCI = 0x0400, | ||
318 | ISP_SERIAL_PORT_IF_SC0 = 0x0800, | ||
319 | ISP_SERIAL_PORT_IF_SCE = 0x1000, | ||
320 | ISP_SERIAL_PORT_IF_SDI = 0x2000, | ||
321 | ISP_SERIAL_PORT_IF_SDO = 0x4000, | ||
322 | ISP_SERIAL_PORT_IF_SDE = 0x8000, | ||
323 | ISP_SERIAL_PORT_IF_I2C_MASK = 0xFC00, | ||
324 | }; | ||
325 | |||
326 | /* semaphoreReg */ | ||
327 | enum { | ||
328 | QL_RESOURCE_MASK_BASE_CODE = 0x7, | ||
329 | QL_RESOURCE_BITS_BASE_CODE = 0x4, | ||
330 | QL_DRVR_SEM_BITS = (QL_RESOURCE_BITS_BASE_CODE << 1), | ||
331 | QL_DDR_RAM_SEM_BITS = (QL_RESOURCE_BITS_BASE_CODE << 4), | ||
332 | QL_PHY_GIO_SEM_BITS = (QL_RESOURCE_BITS_BASE_CODE << 7), | ||
333 | QL_NVRAM_SEM_BITS = (QL_RESOURCE_BITS_BASE_CODE << 10), | ||
334 | QL_FLASH_SEM_BITS = (QL_RESOURCE_BITS_BASE_CODE << 13), | ||
335 | QL_DRVR_SEM_MASK = (QL_RESOURCE_MASK_BASE_CODE << (1 + 16)), | ||
336 | QL_DDR_RAM_SEM_MASK = (QL_RESOURCE_MASK_BASE_CODE << (4 + 16)), | ||
337 | QL_PHY_GIO_SEM_MASK = (QL_RESOURCE_MASK_BASE_CODE << (7 + 16)), | ||
338 | QL_NVRAM_SEM_MASK = (QL_RESOURCE_MASK_BASE_CODE << (10 + 16)), | ||
339 | QL_FLASH_SEM_MASK = (QL_RESOURCE_MASK_BASE_CODE << (13 + 16)), | ||
340 | }; | ||
341 | |||
342 | /* | ||
343 | * QL3XXX memory-mapped registers | ||
344 | * QL3XXX has 4 "pages" of registers, each page occupying | ||
345 | * 256 bytes. Each page has a "common" area at the start and then | ||
346 | * page-specific registers after that. | ||
347 | */ | ||
348 | struct ql3xxx_common_registers { | ||
349 | u32 MB0; /* Offset 0x00 */ | ||
350 | u32 MB1; /* Offset 0x04 */ | ||
351 | u32 MB2; /* Offset 0x08 */ | ||
352 | u32 MB3; /* Offset 0x0c */ | ||
353 | u32 MB4; /* Offset 0x10 */ | ||
354 | u32 MB5; /* Offset 0x14 */ | ||
355 | u32 MB6; /* Offset 0x18 */ | ||
356 | u32 MB7; /* Offset 0x1c */ | ||
357 | u32 flashBiosAddr; | ||
358 | u32 flashBiosData; | ||
359 | u32 ispControlStatus; | ||
360 | u32 ispInterruptMaskReg; | ||
361 | u32 serialPortInterfaceReg; | ||
362 | u32 semaphoreReg; | ||
363 | u32 reqQProducerIndex; | ||
364 | u32 rspQConsumerIndex; | ||
365 | |||
366 | u32 rxLargeQProducerIndex; | ||
367 | u32 rxSmallQProducerIndex; | ||
368 | u32 arcMadiCommand; | ||
369 | u32 arcMadiData; | ||
370 | }; | ||
371 | |||
372 | enum { | ||
373 | EXT_HW_CONFIG_SP_MASK = 0x0006, | ||
374 | EXT_HW_CONFIG_SP_NONE = 0x0000, | ||
375 | EXT_HW_CONFIG_SP_BYTE_PARITY = 0x0002, | ||
376 | EXT_HW_CONFIG_SP_ECC = 0x0004, | ||
377 | EXT_HW_CONFIG_SP_ECCx = 0x0006, | ||
378 | EXT_HW_CONFIG_SIZE_MASK = 0x0060, | ||
379 | EXT_HW_CONFIG_SIZE_128M = 0x0000, | ||
380 | EXT_HW_CONFIG_SIZE_256M = 0x0020, | ||
381 | EXT_HW_CONFIG_SIZE_512M = 0x0040, | ||
382 | EXT_HW_CONFIG_SIZE_INVALID = 0x0060, | ||
383 | EXT_HW_CONFIG_PD = 0x0080, | ||
384 | EXT_HW_CONFIG_FW = 0x0200, | ||
385 | EXT_HW_CONFIG_US = 0x0400, | ||
386 | EXT_HW_CONFIG_DCS_MASK = 0x1800, | ||
387 | EXT_HW_CONFIG_DCS_9MA = 0x0000, | ||
388 | EXT_HW_CONFIG_DCS_15MA = 0x0800, | ||
389 | EXT_HW_CONFIG_DCS_18MA = 0x1000, | ||
390 | EXT_HW_CONFIG_DCS_24MA = 0x1800, | ||
391 | EXT_HW_CONFIG_DDS_MASK = 0x6000, | ||
392 | EXT_HW_CONFIG_DDS_9MA = 0x0000, | ||
393 | EXT_HW_CONFIG_DDS_15MA = 0x2000, | ||
394 | EXT_HW_CONFIG_DDS_18MA = 0x4000, | ||
395 | EXT_HW_CONFIG_DDS_24MA = 0x6000, | ||
396 | }; | ||
397 | |||
398 | /* InternalChipConfig */ | ||
399 | enum { | ||
400 | INTERNAL_CHIP_DM = 0x0001, | ||
401 | INTERNAL_CHIP_SD = 0x0002, | ||
402 | INTERNAL_CHIP_RAP_MASK = 0x000C, | ||
403 | INTERNAL_CHIP_RAP_RR = 0x0000, | ||
404 | INTERNAL_CHIP_RAP_NRM = 0x0004, | ||
405 | INTERNAL_CHIP_RAP_ERM = 0x0008, | ||
406 | INTERNAL_CHIP_RAP_ERMx = 0x000C, | ||
407 | INTERNAL_CHIP_WE = 0x0010, | ||
408 | INTERNAL_CHIP_EF = 0x0020, | ||
409 | INTERNAL_CHIP_FR = 0x0040, | ||
410 | INTERNAL_CHIP_FW = 0x0080, | ||
411 | INTERNAL_CHIP_FI = 0x0100, | ||
412 | INTERNAL_CHIP_FT = 0x0200, | ||
413 | }; | ||
414 | |||
415 | /* portControl */ | ||
416 | enum { | ||
417 | PORT_CONTROL_DS = 0x0001, | ||
418 | PORT_CONTROL_HH = 0x0002, | ||
419 | PORT_CONTROL_EI = 0x0004, | ||
420 | PORT_CONTROL_ET = 0x0008, | ||
421 | PORT_CONTROL_EF = 0x0010, | ||
422 | PORT_CONTROL_DRM = 0x0020, | ||
423 | PORT_CONTROL_RLB = 0x0040, | ||
424 | PORT_CONTROL_RCB = 0x0080, | ||
425 | PORT_CONTROL_MAC = 0x0100, | ||
426 | PORT_CONTROL_IPV = 0x0200, | ||
427 | PORT_CONTROL_IFP = 0x0400, | ||
428 | PORT_CONTROL_ITP = 0x0800, | ||
429 | PORT_CONTROL_FI = 0x1000, | ||
430 | PORT_CONTROL_DFP = 0x2000, | ||
431 | PORT_CONTROL_OI = 0x4000, | ||
432 | PORT_CONTROL_CC = 0x8000, | ||
433 | }; | ||
434 | |||
435 | /* portStatus */ | ||
436 | enum { | ||
437 | PORT_STATUS_SM0 = 0x0001, | ||
438 | PORT_STATUS_SM1 = 0x0002, | ||
439 | PORT_STATUS_X = 0x0008, | ||
440 | PORT_STATUS_DL = 0x0080, | ||
441 | PORT_STATUS_IC = 0x0200, | ||
442 | PORT_STATUS_MRC = 0x0400, | ||
443 | PORT_STATUS_NL = 0x0800, | ||
444 | PORT_STATUS_REV_ID_MASK = 0x7000, | ||
445 | PORT_STATUS_REV_ID_1 = 0x1000, | ||
446 | PORT_STATUS_REV_ID_2 = 0x2000, | ||
447 | PORT_STATUS_REV_ID_3 = 0x3000, | ||
448 | PORT_STATUS_64 = 0x8000, | ||
449 | PORT_STATUS_UP0 = 0x10000, | ||
450 | PORT_STATUS_AC0 = 0x20000, | ||
451 | PORT_STATUS_AE0 = 0x40000, | ||
452 | PORT_STATUS_UP1 = 0x100000, | ||
453 | PORT_STATUS_AC1 = 0x200000, | ||
454 | PORT_STATUS_AE1 = 0x400000, | ||
455 | PORT_STATUS_F0_ENABLED = 0x1000000, | ||
456 | PORT_STATUS_F1_ENABLED = 0x2000000, | ||
457 | PORT_STATUS_F2_ENABLED = 0x4000000, | ||
458 | PORT_STATUS_F3_ENABLED = 0x8000000, | ||
459 | }; | ||
460 | |||
461 | /* macMIIMgmtControlReg */ | ||
462 | enum { | ||
463 | MAC_ADDR_INDIRECT_PTR_REG_RP_MASK = 0x0003, | ||
464 | MAC_ADDR_INDIRECT_PTR_REG_RP_PRI_LWR = 0x0000, | ||
465 | MAC_ADDR_INDIRECT_PTR_REG_RP_PRI_UPR = 0x0001, | ||
466 | MAC_ADDR_INDIRECT_PTR_REG_RP_SEC_LWR = 0x0002, | ||
467 | MAC_ADDR_INDIRECT_PTR_REG_RP_SEC_UPR = 0x0003, | ||
468 | MAC_ADDR_INDIRECT_PTR_REG_PR = 0x0008, | ||
469 | MAC_ADDR_INDIRECT_PTR_REG_SS = 0x0010, | ||
470 | MAC_ADDR_INDIRECT_PTR_REG_SE = 0x0020, | ||
471 | MAC_ADDR_INDIRECT_PTR_REG_SP = 0x0040, | ||
472 | MAC_ADDR_INDIRECT_PTR_REG_PE = 0x0080, | ||
473 | }; | ||
474 | |||
475 | /* macMIIMgmtControlReg */ | ||
476 | enum { | ||
477 | MAC_MII_CONTROL_RC = 0x0001, | ||
478 | MAC_MII_CONTROL_SC = 0x0002, | ||
479 | MAC_MII_CONTROL_AS = 0x0004, | ||
480 | MAC_MII_CONTROL_NP = 0x0008, | ||
481 | MAC_MII_CONTROL_CLK_SEL_MASK = 0x0070, | ||
482 | MAC_MII_CONTROL_CLK_SEL_DIV2 = 0x0000, | ||
483 | MAC_MII_CONTROL_CLK_SEL_DIV4 = 0x0010, | ||
484 | MAC_MII_CONTROL_CLK_SEL_DIV6 = 0x0020, | ||
485 | MAC_MII_CONTROL_CLK_SEL_DIV8 = 0x0030, | ||
486 | MAC_MII_CONTROL_CLK_SEL_DIV10 = 0x0040, | ||
487 | MAC_MII_CONTROL_CLK_SEL_DIV14 = 0x0050, | ||
488 | MAC_MII_CONTROL_CLK_SEL_DIV20 = 0x0060, | ||
489 | MAC_MII_CONTROL_CLK_SEL_DIV28 = 0x0070, | ||
490 | MAC_MII_CONTROL_RM = 0x8000, | ||
491 | }; | ||
492 | |||
493 | /* macMIIStatusReg */ | ||
494 | enum { | ||
495 | MAC_MII_STATUS_BSY = 0x0001, | ||
496 | MAC_MII_STATUS_SC = 0x0002, | ||
497 | MAC_MII_STATUS_NV = 0x0004, | ||
498 | }; | ||
499 | |||
500 | enum { | ||
501 | MAC_CONFIG_REG_PE = 0x0001, | ||
502 | MAC_CONFIG_REG_TF = 0x0002, | ||
503 | MAC_CONFIG_REG_RF = 0x0004, | ||
504 | MAC_CONFIG_REG_FD = 0x0008, | ||
505 | MAC_CONFIG_REG_GM = 0x0010, | ||
506 | MAC_CONFIG_REG_LB = 0x0020, | ||
507 | MAC_CONFIG_REG_SR = 0x8000, | ||
508 | }; | ||
509 | |||
510 | enum { | ||
511 | MAC_HALF_DUPLEX_REG_ED = 0x10000, | ||
512 | MAC_HALF_DUPLEX_REG_NB = 0x20000, | ||
513 | MAC_HALF_DUPLEX_REG_BNB = 0x40000, | ||
514 | MAC_HALF_DUPLEX_REG_ALT = 0x80000, | ||
515 | }; | ||
516 | |||
517 | enum { | ||
518 | IP_ADDR_INDEX_REG_MASK = 0x000f, | ||
519 | IP_ADDR_INDEX_REG_FUNC_0_PRI = 0x0000, | ||
520 | IP_ADDR_INDEX_REG_FUNC_0_SEC = 0x0001, | ||
521 | IP_ADDR_INDEX_REG_FUNC_1_PRI = 0x0002, | ||
522 | IP_ADDR_INDEX_REG_FUNC_1_SEC = 0x0003, | ||
523 | IP_ADDR_INDEX_REG_FUNC_2_PRI = 0x0004, | ||
524 | IP_ADDR_INDEX_REG_FUNC_2_SEC = 0x0005, | ||
525 | IP_ADDR_INDEX_REG_FUNC_3_PRI = 0x0006, | ||
526 | IP_ADDR_INDEX_REG_FUNC_3_SEC = 0x0007, | ||
527 | }; | ||
528 | |||
529 | enum { | ||
530 | PROBE_MUX_ADDR_REG_MUX_SEL_MASK = 0x003f, | ||
531 | PROBE_MUX_ADDR_REG_SYSCLK = 0x0000, | ||
532 | PROBE_MUX_ADDR_REG_PCICLK = 0x0040, | ||
533 | PROBE_MUX_ADDR_REG_NRXCLK = 0x0080, | ||
534 | PROBE_MUX_ADDR_REG_CPUCLK = 0x00C0, | ||
535 | PROBE_MUX_ADDR_REG_MODULE_SEL_MASK = 0x3f00, | ||
536 | PROBE_MUX_ADDR_REG_UP = 0x4000, | ||
537 | PROBE_MUX_ADDR_REG_RE = 0x8000, | ||
538 | }; | ||
539 | |||
540 | enum { | ||
541 | STATISTICS_INDEX_REG_MASK = 0x01ff, | ||
542 | STATISTICS_INDEX_REG_MAC0_TX_FRAME = 0x0000, | ||
543 | STATISTICS_INDEX_REG_MAC0_TX_BYTES = 0x0001, | ||
544 | STATISTICS_INDEX_REG_MAC0_TX_STAT1 = 0x0002, | ||
545 | STATISTICS_INDEX_REG_MAC0_TX_STAT2 = 0x0003, | ||
546 | STATISTICS_INDEX_REG_MAC0_TX_STAT3 = 0x0004, | ||
547 | STATISTICS_INDEX_REG_MAC0_TX_STAT4 = 0x0005, | ||
548 | STATISTICS_INDEX_REG_MAC0_TX_STAT5 = 0x0006, | ||
549 | STATISTICS_INDEX_REG_MAC0_RX_FRAME = 0x0007, | ||
550 | STATISTICS_INDEX_REG_MAC0_RX_BYTES = 0x0008, | ||
551 | STATISTICS_INDEX_REG_MAC0_RX_STAT1 = 0x0009, | ||
552 | STATISTICS_INDEX_REG_MAC0_RX_STAT2 = 0x000a, | ||
553 | STATISTICS_INDEX_REG_MAC0_RX_STAT3 = 0x000b, | ||
554 | STATISTICS_INDEX_REG_MAC0_RX_ERR_CRC = 0x000c, | ||
555 | STATISTICS_INDEX_REG_MAC0_RX_ERR_ENC = 0x000d, | ||
556 | STATISTICS_INDEX_REG_MAC0_RX_ERR_LEN = 0x000e, | ||
557 | STATISTICS_INDEX_REG_MAC0_RX_STAT4 = 0x000f, | ||
558 | STATISTICS_INDEX_REG_MAC1_TX_FRAME = 0x0010, | ||
559 | STATISTICS_INDEX_REG_MAC1_TX_BYTES = 0x0011, | ||
560 | STATISTICS_INDEX_REG_MAC1_TX_STAT1 = 0x0012, | ||
561 | STATISTICS_INDEX_REG_MAC1_TX_STAT2 = 0x0013, | ||
562 | STATISTICS_INDEX_REG_MAC1_TX_STAT3 = 0x0014, | ||
563 | STATISTICS_INDEX_REG_MAC1_TX_STAT4 = 0x0015, | ||
564 | STATISTICS_INDEX_REG_MAC1_TX_STAT5 = 0x0016, | ||
565 | STATISTICS_INDEX_REG_MAC1_RX_FRAME = 0x0017, | ||
566 | STATISTICS_INDEX_REG_MAC1_RX_BYTES = 0x0018, | ||
567 | STATISTICS_INDEX_REG_MAC1_RX_STAT1 = 0x0019, | ||
568 | STATISTICS_INDEX_REG_MAC1_RX_STAT2 = 0x001a, | ||
569 | STATISTICS_INDEX_REG_MAC1_RX_STAT3 = 0x001b, | ||
570 | STATISTICS_INDEX_REG_MAC1_RX_ERR_CRC = 0x001c, | ||
571 | STATISTICS_INDEX_REG_MAC1_RX_ERR_ENC = 0x001d, | ||
572 | STATISTICS_INDEX_REG_MAC1_RX_ERR_LEN = 0x001e, | ||
573 | STATISTICS_INDEX_REG_MAC1_RX_STAT4 = 0x001f, | ||
574 | STATISTICS_INDEX_REG_IP_TX_PKTS = 0x0020, | ||
575 | STATISTICS_INDEX_REG_IP_TX_BYTES = 0x0021, | ||
576 | STATISTICS_INDEX_REG_IP_TX_FRAG = 0x0022, | ||
577 | STATISTICS_INDEX_REG_IP_RX_PKTS = 0x0023, | ||
578 | STATISTICS_INDEX_REG_IP_RX_BYTES = 0x0024, | ||
579 | STATISTICS_INDEX_REG_IP_RX_FRAG = 0x0025, | ||
580 | STATISTICS_INDEX_REG_IP_DGRM_REASSEMBLY = 0x0026, | ||
581 | STATISTICS_INDEX_REG_IP_V6_RX_PKTS = 0x0027, | ||
582 | STATISTICS_INDEX_REG_IP_RX_PKTERR = 0x0028, | ||
583 | STATISTICS_INDEX_REG_IP_REASSEMBLY_ERR = 0x0029, | ||
584 | STATISTICS_INDEX_REG_TCP_TX_SEG = 0x0030, | ||
585 | STATISTICS_INDEX_REG_TCP_TX_BYTES = 0x0031, | ||
586 | STATISTICS_INDEX_REG_TCP_RX_SEG = 0x0032, | ||
587 | STATISTICS_INDEX_REG_TCP_RX_BYTES = 0x0033, | ||
588 | STATISTICS_INDEX_REG_TCP_TIMER_EXP = 0x0034, | ||
589 | STATISTICS_INDEX_REG_TCP_RX_ACK = 0x0035, | ||
590 | STATISTICS_INDEX_REG_TCP_TX_ACK = 0x0036, | ||
591 | STATISTICS_INDEX_REG_TCP_RX_ERR = 0x0037, | ||
592 | STATISTICS_INDEX_REG_TCP_RX_WIN_PROBE = 0x0038, | ||
593 | STATISTICS_INDEX_REG_TCP_ECC_ERR_CORR = 0x003f, | ||
594 | }; | ||
595 | |||
596 | enum { | ||
597 | PORT_FATAL_ERROR_STATUS_OFB_RE_MAC0 = 0x00000001, | ||
598 | PORT_FATAL_ERROR_STATUS_OFB_RE_MAC1 = 0x00000002, | ||
599 | PORT_FATAL_ERROR_STATUS_OFB_WE = 0x00000004, | ||
600 | PORT_FATAL_ERROR_STATUS_IFB_RE = 0x00000008, | ||
601 | PORT_FATAL_ERROR_STATUS_IFB_WE_MAC0 = 0x00000010, | ||
602 | PORT_FATAL_ERROR_STATUS_IFB_WE_MAC1 = 0x00000020, | ||
603 | PORT_FATAL_ERROR_STATUS_ODE_RE = 0x00000040, | ||
604 | PORT_FATAL_ERROR_STATUS_ODE_WE = 0x00000080, | ||
605 | PORT_FATAL_ERROR_STATUS_IDE_RE = 0x00000100, | ||
606 | PORT_FATAL_ERROR_STATUS_IDE_WE = 0x00000200, | ||
607 | PORT_FATAL_ERROR_STATUS_SDE_RE = 0x00000400, | ||
608 | PORT_FATAL_ERROR_STATUS_SDE_WE = 0x00000800, | ||
609 | PORT_FATAL_ERROR_STATUS_BLE = 0x00001000, | ||
610 | PORT_FATAL_ERROR_STATUS_SPE = 0x00002000, | ||
611 | PORT_FATAL_ERROR_STATUS_EP0 = 0x00004000, | ||
612 | PORT_FATAL_ERROR_STATUS_EP1 = 0x00008000, | ||
613 | PORT_FATAL_ERROR_STATUS_ICE = 0x00010000, | ||
614 | PORT_FATAL_ERROR_STATUS_ILE = 0x00020000, | ||
615 | PORT_FATAL_ERROR_STATUS_OPE = 0x00040000, | ||
616 | PORT_FATAL_ERROR_STATUS_TA = 0x00080000, | ||
617 | PORT_FATAL_ERROR_STATUS_MA = 0x00100000, | ||
618 | PORT_FATAL_ERROR_STATUS_SCE = 0x00200000, | ||
619 | PORT_FATAL_ERROR_STATUS_RPE = 0x00400000, | ||
620 | PORT_FATAL_ERROR_STATUS_MPE = 0x00800000, | ||
621 | PORT_FATAL_ERROR_STATUS_OCE = 0x01000000, | ||
622 | }; | ||
623 | |||
624 | /* | ||
625 | * port control and status page - page 0 | ||
626 | */ | ||
627 | |||
628 | struct ql3xxx_port_registers { | ||
629 | struct ql3xxx_common_registers CommonRegs; | ||
630 | |||
631 | u32 ExternalHWConfig; | ||
632 | u32 InternalChipConfig; | ||
633 | u32 portControl; | ||
634 | u32 portStatus; | ||
635 | u32 macAddrIndirectPtrReg; | ||
636 | u32 macAddrDataReg; | ||
637 | u32 macMIIMgmtControlReg; | ||
638 | u32 macMIIMgmtAddrReg; | ||
639 | u32 macMIIMgmtDataReg; | ||
640 | u32 macMIIStatusReg; | ||
641 | u32 mac0ConfigReg; | ||
642 | u32 mac0IpgIfgReg; | ||
643 | u32 mac0HalfDuplexReg; | ||
644 | u32 mac0MaxFrameLengthReg; | ||
645 | u32 mac0PauseThresholdReg; | ||
646 | u32 mac1ConfigReg; | ||
647 | u32 mac1IpgIfgReg; | ||
648 | u32 mac1HalfDuplexReg; | ||
649 | u32 mac1MaxFrameLengthReg; | ||
650 | u32 mac1PauseThresholdReg; | ||
651 | u32 ipAddrIndexReg; | ||
652 | u32 ipAddrDataReg; | ||
653 | u32 ipReassemblyTimeout; | ||
654 | u32 tcpMaxWindow; | ||
655 | u32 currentTcpTimestamp[2]; | ||
656 | u32 internalRamRWAddrReg; | ||
657 | u32 internalRamWDataReg; | ||
658 | u32 reclaimedBufferAddrRegLow; | ||
659 | u32 reclaimedBufferAddrRegHigh; | ||
660 | u32 reserved[2]; | ||
661 | u32 fpgaRevID; | ||
662 | u32 localRamAddr; | ||
663 | u32 localRamDataAutoIncr; | ||
664 | u32 localRamDataNonIncr; | ||
665 | u32 gpOutput; | ||
666 | u32 gpInput; | ||
667 | u32 probeMuxAddr; | ||
668 | u32 probeMuxData; | ||
669 | u32 statisticsIndexReg; | ||
670 | u32 statisticsReadDataRegAutoIncr; | ||
671 | u32 statisticsReadDataRegNoIncr; | ||
672 | u32 PortFatalErrStatus; | ||
673 | }; | ||
674 | |||
675 | /* | ||
676 | * port host memory config page - page 1 | ||
677 | */ | ||
678 | struct ql3xxx_host_memory_registers { | ||
679 | struct ql3xxx_common_registers CommonRegs; | ||
680 | |||
681 | u32 reserved[12]; | ||
682 | |||
683 | /* Network Request Queue */ | ||
684 | u32 reqConsumerIndex; | ||
685 | u32 reqConsumerIndexAddrLow; | ||
686 | u32 reqConsumerIndexAddrHigh; | ||
687 | u32 reqBaseAddrLow; | ||
688 | u32 reqBaseAddrHigh; | ||
689 | u32 reqLength; | ||
690 | |||
691 | /* Network Completion Queue */ | ||
692 | u32 rspProducerIndex; | ||
693 | u32 rspProducerIndexAddrLow; | ||
694 | u32 rspProducerIndexAddrHigh; | ||
695 | u32 rspBaseAddrLow; | ||
696 | u32 rspBaseAddrHigh; | ||
697 | u32 rspLength; | ||
698 | |||
699 | /* RX Large Buffer Queue */ | ||
700 | u32 rxLargeQConsumerIndex; | ||
701 | u32 rxLargeQBaseAddrLow; | ||
702 | u32 rxLargeQBaseAddrHigh; | ||
703 | u32 rxLargeQLength; | ||
704 | u32 rxLargeBufferLength; | ||
705 | |||
706 | /* RX Small Buffer Queue */ | ||
707 | u32 rxSmallQConsumerIndex; | ||
708 | u32 rxSmallQBaseAddrLow; | ||
709 | u32 rxSmallQBaseAddrHigh; | ||
710 | u32 rxSmallQLength; | ||
711 | u32 rxSmallBufferLength; | ||
712 | |||
713 | }; | ||
714 | |||
715 | /* | ||
716 | * port local RAM page - page 2 | ||
717 | */ | ||
718 | struct ql3xxx_local_ram_registers { | ||
719 | struct ql3xxx_common_registers CommonRegs; | ||
720 | u32 bufletSize; | ||
721 | u32 maxBufletCount; | ||
722 | u32 currentBufletCount; | ||
723 | u32 reserved; | ||
724 | u32 freeBufletThresholdLow; | ||
725 | u32 freeBufletThresholdHigh; | ||
726 | u32 ipHashTableBase; | ||
727 | u32 ipHashTableCount; | ||
728 | u32 tcpHashTableBase; | ||
729 | u32 tcpHashTableCount; | ||
730 | u32 ncbBase; | ||
731 | u32 maxNcbCount; | ||
732 | u32 currentNcbCount; | ||
733 | u32 drbBase; | ||
734 | u32 maxDrbCount; | ||
735 | u32 currentDrbCount; | ||
736 | }; | ||
737 | |||
738 | /* | ||
739 | * definitions for Semaphore bits in Semaphore/Serial NVRAM interface register | ||
740 | */ | ||
741 | |||
742 | #define LS_64BITS(x) (u32)(0xffffffff & ((u64)x)) | ||
743 | #define MS_64BITS(x) (u32)(0xffffffff & (((u64)x)>>16>>16) ) | ||
744 | |||
745 | /* | ||
746 | * I/O register | ||
747 | */ | ||
748 | |||
749 | enum { | ||
750 | CONTROL_REG = 0, | ||
751 | STATUS_REG = 1, | ||
752 | PHY_STAT_LINK_UP = 0x0004, | ||
753 | PHY_CTRL_LOOPBACK = 0x4000, | ||
754 | |||
755 | PETBI_CONTROL_REG = 0x00, | ||
756 | PETBI_CTRL_SOFT_RESET = 0x8000, | ||
757 | PETBI_CTRL_AUTO_NEG = 0x1000, | ||
758 | PETBI_CTRL_RESTART_NEG = 0x0200, | ||
759 | PETBI_CTRL_FULL_DUPLEX = 0x0100, | ||
760 | PETBI_CTRL_SPEED_1000 = 0x0040, | ||
761 | |||
762 | PETBI_STATUS_REG = 0x01, | ||
763 | PETBI_STAT_NEG_DONE = 0x0020, | ||
764 | PETBI_STAT_LINK_UP = 0x0004, | ||
765 | |||
766 | PETBI_NEG_ADVER = 0x04, | ||
767 | PETBI_NEG_PAUSE = 0x0080, | ||
768 | PETBI_NEG_PAUSE_MASK = 0x0180, | ||
769 | PETBI_NEG_DUPLEX = 0x0020, | ||
770 | PETBI_NEG_DUPLEX_MASK = 0x0060, | ||
771 | |||
772 | PETBI_NEG_PARTNER = 0x05, | ||
773 | PETBI_NEG_ERROR_MASK = 0x3000, | ||
774 | |||
775 | PETBI_EXPANSION_REG = 0x06, | ||
776 | PETBI_EXP_PAGE_RX = 0x0002, | ||
777 | |||
778 | PETBI_TBI_CTRL = 0x11, | ||
779 | PETBI_TBI_RESET = 0x8000, | ||
780 | PETBI_TBI_AUTO_SENSE = 0x0100, | ||
781 | PETBI_TBI_SERDES_MODE = 0x0010, | ||
782 | PETBI_TBI_SERDES_WRAP = 0x0002, | ||
783 | |||
784 | AUX_CONTROL_STATUS = 0x1c, | ||
785 | PHY_AUX_NEG_DONE = 0x8000, | ||
786 | PHY_NEG_PARTNER = 5, | ||
787 | PHY_AUX_DUPLEX_STAT = 0x0020, | ||
788 | PHY_AUX_SPEED_STAT = 0x0018, | ||
789 | PHY_AUX_NO_HW_STRAP = 0x0004, | ||
790 | PHY_AUX_RESET_STICK = 0x0002, | ||
791 | PHY_NEG_PAUSE = 0x0400, | ||
792 | PHY_CTRL_SOFT_RESET = 0x8000, | ||
793 | PHY_NEG_ADVER = 4, | ||
794 | PHY_NEG_ADV_SPEED = 0x01e0, | ||
795 | PHY_CTRL_RESTART_NEG = 0x0200, | ||
796 | }; | ||
797 | enum { | ||
798 | /* AM29LV Flash definitions */ | ||
799 | FM93C56A_START = 0x1, | ||
800 | /* Commands */ | ||
801 | FM93C56A_READ = 0x2, | ||
802 | FM93C56A_WEN = 0x0, | ||
803 | FM93C56A_WRITE = 0x1, | ||
804 | FM93C56A_WRITE_ALL = 0x0, | ||
805 | FM93C56A_WDS = 0x0, | ||
806 | FM93C56A_ERASE = 0x3, | ||
807 | FM93C56A_ERASE_ALL = 0x0, | ||
808 | /* Command Extentions */ | ||
809 | FM93C56A_WEN_EXT = 0x3, | ||
810 | FM93C56A_WRITE_ALL_EXT = 0x1, | ||
811 | FM93C56A_WDS_EXT = 0x0, | ||
812 | FM93C56A_ERASE_ALL_EXT = 0x2, | ||
813 | /* Special Bits */ | ||
814 | FM93C56A_READ_DUMMY_BITS = 1, | ||
815 | FM93C56A_READY = 0, | ||
816 | FM93C56A_BUSY = 1, | ||
817 | FM93C56A_CMD_BITS = 2, | ||
818 | /* AM29LV Flash definitions */ | ||
819 | FM93C56A_SIZE_8 = 0x100, | ||
820 | FM93C56A_SIZE_16 = 0x80, | ||
821 | FM93C66A_SIZE_8 = 0x200, | ||
822 | FM93C66A_SIZE_16 = 0x100, | ||
823 | FM93C86A_SIZE_16 = 0x400, | ||
824 | /* Address Bits */ | ||
825 | FM93C56A_NO_ADDR_BITS_16 = 8, | ||
826 | FM93C56A_NO_ADDR_BITS_8 = 9, | ||
827 | FM93C86A_NO_ADDR_BITS_16 = 10, | ||
828 | /* Data Bits */ | ||
829 | FM93C56A_DATA_BITS_16 = 16, | ||
830 | FM93C56A_DATA_BITS_8 = 8, | ||
831 | }; | ||
832 | enum { | ||
833 | /* Auburn Bits */ | ||
834 | AUBURN_EEPROM_DI = 0x8, | ||
835 | AUBURN_EEPROM_DI_0 = 0x0, | ||
836 | AUBURN_EEPROM_DI_1 = 0x8, | ||
837 | AUBURN_EEPROM_DO = 0x4, | ||
838 | AUBURN_EEPROM_DO_0 = 0x0, | ||
839 | AUBURN_EEPROM_DO_1 = 0x4, | ||
840 | AUBURN_EEPROM_CS = 0x2, | ||
841 | AUBURN_EEPROM_CS_0 = 0x0, | ||
842 | AUBURN_EEPROM_CS_1 = 0x2, | ||
843 | AUBURN_EEPROM_CLK_RISE = 0x1, | ||
844 | AUBURN_EEPROM_CLK_FALL = 0x0, | ||
845 | }; | ||
846 | enum {EEPROM_SIZE = FM93C86A_SIZE_16, | ||
847 | EEPROM_NO_ADDR_BITS = FM93C86A_NO_ADDR_BITS_16, | ||
848 | EEPROM_NO_DATA_BITS = FM93C56A_DATA_BITS_16, | ||
849 | }; | ||
850 | |||
851 | /* | ||
852 | * MAC Config data structure | ||
853 | */ | ||
854 | struct eeprom_port_cfg { | ||
855 | u16 etherMtu_mac; | ||
856 | u16 pauseThreshold_mac; | ||
857 | u16 resumeThreshold_mac; | ||
858 | u16 portConfiguration; | ||
859 | #define PORT_CONFIG_AUTO_NEG_ENABLED 0x8000 | ||
860 | #define PORT_CONFIG_SYM_PAUSE_ENABLED 0x4000 | ||
861 | #define PORT_CONFIG_FULL_DUPLEX_ENABLED 0x2000 | ||
862 | #define PORT_CONFIG_HALF_DUPLEX_ENABLED 0x1000 | ||
863 | #define PORT_CONFIG_1000MB_SPEED 0x0400 | ||
864 | #define PORT_CONFIG_100MB_SPEED 0x0200 | ||
865 | #define PORT_CONFIG_10MB_SPEED 0x0100 | ||
866 | #define PORT_CONFIG_LINK_SPEED_MASK 0x0F00 | ||
867 | u16 reserved[12]; | ||
868 | |||
869 | }; | ||
870 | |||
871 | /* | ||
872 | * BIOS data structure | ||
873 | */ | ||
874 | struct eeprom_bios_cfg { | ||
875 | u16 SpinDlyEn:1, disBios:1, EnMemMap:1, EnSelectBoot:1, Reserved:12; | ||
876 | |||
877 | u8 bootID0:7, boodID0Valid:1; | ||
878 | u8 bootLun0[8]; | ||
879 | |||
880 | u8 bootID1:7, boodID1Valid:1; | ||
881 | u8 bootLun1[8]; | ||
882 | |||
883 | u16 MaxLunsTrgt; | ||
884 | u8 reserved[10]; | ||
885 | }; | ||
886 | |||
887 | /* | ||
888 | * Function Specific Data structure | ||
889 | */ | ||
890 | struct eeprom_function_cfg { | ||
891 | u8 reserved[30]; | ||
892 | u8 macAddress[6]; | ||
893 | u8 macAddressSecondary[6]; | ||
894 | |||
895 | u16 subsysVendorId; | ||
896 | u16 subsysDeviceId; | ||
897 | }; | ||
898 | |||
899 | /* | ||
900 | * EEPROM format | ||
901 | */ | ||
902 | struct eeprom_data { | ||
903 | u8 asicId[4]; | ||
904 | u8 version; | ||
905 | u8 numPorts; | ||
906 | u16 boardId; | ||
907 | |||
908 | #define EEPROM_BOARDID_STR_SIZE 16 | ||
909 | #define EEPROM_SERIAL_NUM_SIZE 16 | ||
910 | |||
911 | u8 boardIdStr[16]; | ||
912 | u8 serialNumber[16]; | ||
913 | u16 extHwConfig; | ||
914 | struct eeprom_port_cfg macCfg_port0; | ||
915 | struct eeprom_port_cfg macCfg_port1; | ||
916 | u16 bufletSize; | ||
917 | u16 bufletCount; | ||
918 | u16 tcpWindowThreshold50; | ||
919 | u16 tcpWindowThreshold25; | ||
920 | u16 tcpWindowThreshold0; | ||
921 | u16 ipHashTableBaseHi; | ||
922 | u16 ipHashTableBaseLo; | ||
923 | u16 ipHashTableSize; | ||
924 | u16 tcpHashTableBaseHi; | ||
925 | u16 tcpHashTableBaseLo; | ||
926 | u16 tcpHashTableSize; | ||
927 | u16 ncbTableBaseHi; | ||
928 | u16 ncbTableBaseLo; | ||
929 | u16 ncbTableSize; | ||
930 | u16 drbTableBaseHi; | ||
931 | u16 drbTableBaseLo; | ||
932 | u16 drbTableSize; | ||
933 | u16 reserved_142[4]; | ||
934 | u16 ipReassemblyTimeout; | ||
935 | u16 tcpMaxWindowSize; | ||
936 | u16 ipSecurity; | ||
937 | #define IPSEC_CONFIG_PRESENT 0x0001 | ||
938 | u8 reserved_156[294]; | ||
939 | u16 qDebug[8]; | ||
940 | struct eeprom_function_cfg funcCfg_fn0; | ||
941 | u16 reserved_510; | ||
942 | u8 oemSpace[432]; | ||
943 | struct eeprom_bios_cfg biosCfg_fn1; | ||
944 | struct eeprom_function_cfg funcCfg_fn1; | ||
945 | u16 reserved_1022; | ||
946 | u8 reserved_1024[464]; | ||
947 | struct eeprom_function_cfg funcCfg_fn2; | ||
948 | u16 reserved_1534; | ||
949 | u8 reserved_1536[432]; | ||
950 | struct eeprom_bios_cfg biosCfg_fn3; | ||
951 | struct eeprom_function_cfg funcCfg_fn3; | ||
952 | u16 checksum; | ||
953 | }; | ||
954 | |||
955 | /* | ||
956 | * General definitions... | ||
957 | */ | ||
958 | |||
959 | /* | ||
960 | * Below are a number compiler switches for controlling driver behavior. | ||
961 | * Some are not supported under certain conditions and are notated as such. | ||
962 | */ | ||
963 | |||
964 | #define QL3XXX_VENDOR_ID 0x1077 | ||
965 | #define QL3022_DEVICE_ID 0x3022 | ||
966 | |||
967 | /* MTU & Frame Size stuff */ | ||
968 | #define NORMAL_MTU_SIZE ETH_DATA_LEN | ||
969 | #define JUMBO_MTU_SIZE 9000 | ||
970 | #define VLAN_ID_LEN 2 | ||
971 | |||
972 | /* Request Queue Related Definitions */ | ||
973 | #define NUM_REQ_Q_ENTRIES 256 /* so that 64 * 64 = 4096 (1 page) */ | ||
974 | |||
975 | /* Response Queue Related Definitions */ | ||
976 | #define NUM_RSP_Q_ENTRIES 256 /* so that 256 * 16 = 4096 (1 page) */ | ||
977 | |||
978 | /* Transmit and Receive Buffers */ | ||
979 | #define NUM_LBUFQ_ENTRIES 128 | ||
980 | #define NUM_SBUFQ_ENTRIES 64 | ||
981 | #define QL_SMALL_BUFFER_SIZE 32 | ||
982 | #define QL_ADDR_ELE_PER_BUFQ_ENTRY \ | ||
983 | (sizeof(struct lrg_buf_q_entry) / sizeof(struct bufq_addr_element)) | ||
984 | /* Each send has at least control block. This is how many we keep. */ | ||
985 | #define NUM_SMALL_BUFFERS NUM_SBUFQ_ENTRIES * QL_ADDR_ELE_PER_BUFQ_ENTRY | ||
986 | #define NUM_LARGE_BUFFERS NUM_LBUFQ_ENTRIES * QL_ADDR_ELE_PER_BUFQ_ENTRY | ||
987 | #define QL_HEADER_SPACE 32 /* make header space at top of skb. */ | ||
988 | /* | ||
989 | * Large & Small Buffers for Receives | ||
990 | */ | ||
991 | struct lrg_buf_q_entry { | ||
992 | |||
993 | u32 addr0_lower; | ||
994 | #define IAL_LAST_ENTRY 0x00000001 | ||
995 | #define IAL_CONT_ENTRY 0x00000002 | ||
996 | #define IAL_FLAG_MASK 0x00000003 | ||
997 | u32 addr0_upper; | ||
998 | u32 addr1_lower; | ||
999 | u32 addr1_upper; | ||
1000 | u32 addr2_lower; | ||
1001 | u32 addr2_upper; | ||
1002 | u32 addr3_lower; | ||
1003 | u32 addr3_upper; | ||
1004 | u32 addr4_lower; | ||
1005 | u32 addr4_upper; | ||
1006 | u32 addr5_lower; | ||
1007 | u32 addr5_upper; | ||
1008 | u32 addr6_lower; | ||
1009 | u32 addr6_upper; | ||
1010 | u32 addr7_lower; | ||
1011 | u32 addr7_upper; | ||
1012 | |||
1013 | }; | ||
1014 | |||
1015 | struct bufq_addr_element { | ||
1016 | u32 addr_low; | ||
1017 | u32 addr_high; | ||
1018 | }; | ||
1019 | |||
1020 | #define QL_NO_RESET 0 | ||
1021 | #define QL_DO_RESET 1 | ||
1022 | |||
1023 | enum link_state_t { | ||
1024 | LS_UNKNOWN = 0, | ||
1025 | LS_DOWN, | ||
1026 | LS_DEGRADE, | ||
1027 | LS_RECOVER, | ||
1028 | LS_UP, | ||
1029 | }; | ||
1030 | |||
1031 | struct ql_rcv_buf_cb { | ||
1032 | struct ql_rcv_buf_cb *next; | ||
1033 | struct sk_buff *skb; | ||
1034 | DECLARE_PCI_UNMAP_ADDR(mapaddr); | ||
1035 | DECLARE_PCI_UNMAP_LEN(maplen); | ||
1036 | __le32 buf_phy_addr_low; | ||
1037 | __le32 buf_phy_addr_high; | ||
1038 | int index; | ||
1039 | }; | ||
1040 | |||
1041 | struct ql_tx_buf_cb { | ||
1042 | struct sk_buff *skb; | ||
1043 | struct ob_mac_iocb_req *queue_entry ; | ||
1044 | DECLARE_PCI_UNMAP_ADDR(mapaddr); | ||
1045 | DECLARE_PCI_UNMAP_LEN(maplen); | ||
1046 | }; | ||
1047 | |||
1048 | /* definitions for type field */ | ||
1049 | #define QL_BUF_TYPE_MACIOCB 0x01 | ||
1050 | #define QL_BUF_TYPE_IPIOCB 0x02 | ||
1051 | #define QL_BUF_TYPE_TCPIOCB 0x03 | ||
1052 | |||
1053 | /* qdev->flags definitions. */ | ||
1054 | enum { QL_RESET_DONE = 1, /* Reset finished. */ | ||
1055 | QL_RESET_ACTIVE = 2, /* Waiting for reset to finish. */ | ||
1056 | QL_RESET_START = 3, /* Please reset the chip. */ | ||
1057 | QL_RESET_PER_SCSI = 4, /* SCSI driver requests reset. */ | ||
1058 | QL_TX_TIMEOUT = 5, /* Timeout in progress. */ | ||
1059 | QL_LINK_MASTER = 6, /* This driver controls the link. */ | ||
1060 | QL_ADAPTER_UP = 7, /* Adapter has been brought up. */ | ||
1061 | QL_THREAD_UP = 8, /* This flag is available. */ | ||
1062 | QL_LINK_UP = 9, /* Link Status. */ | ||
1063 | QL_ALLOC_REQ_RSP_Q_DONE = 10, | ||
1064 | QL_ALLOC_BUFQS_DONE = 11, | ||
1065 | QL_ALLOC_SMALL_BUF_DONE = 12, | ||
1066 | QL_LINK_OPTICAL = 13, | ||
1067 | QL_MSI_ENABLED = 14, | ||
1068 | }; | ||
1069 | |||
1070 | /* | ||
1071 | * ql3_adapter - The main Adapter structure definition. | ||
1072 | * This structure has all fields relevant to the hardware. | ||
1073 | */ | ||
1074 | |||
1075 | struct ql3_adapter { | ||
1076 | u32 reserved_00; | ||
1077 | unsigned long flags; | ||
1078 | |||
1079 | /* PCI Configuration information for this device */ | ||
1080 | struct pci_dev *pdev; | ||
1081 | struct net_device *ndev; /* Parent NET device */ | ||
1082 | |||
1083 | /* Hardware information */ | ||
1084 | u8 chip_rev_id; | ||
1085 | u8 pci_slot; | ||
1086 | u8 pci_width; | ||
1087 | u8 pci_x; | ||
1088 | u32 msi; | ||
1089 | int index; | ||
1090 | struct timer_list adapter_timer; /* timer used for various functions */ | ||
1091 | |||
1092 | spinlock_t adapter_lock; | ||
1093 | spinlock_t hw_lock; | ||
1094 | |||
1095 | /* PCI Bus Relative Register Addresses */ | ||
1096 | u8 *mmap_virt_base; /* stores return value from ioremap() */ | ||
1097 | struct ql3xxx_port_registers __iomem *mem_map_registers; | ||
1098 | u32 current_page; /* tracks current register page */ | ||
1099 | |||
1100 | u32 msg_enable; | ||
1101 | u8 reserved_01[2]; | ||
1102 | u8 reserved_02[2]; | ||
1103 | |||
1104 | /* Page for Shadow Registers */ | ||
1105 | void *shadow_reg_virt_addr; | ||
1106 | dma_addr_t shadow_reg_phy_addr; | ||
1107 | |||
1108 | /* Net Request Queue */ | ||
1109 | u32 req_q_size; | ||
1110 | u32 reserved_03; | ||
1111 | struct ob_mac_iocb_req *req_q_virt_addr; | ||
1112 | dma_addr_t req_q_phy_addr; | ||
1113 | u16 req_producer_index; | ||
1114 | u16 reserved_04; | ||
1115 | u16 *preq_consumer_index; | ||
1116 | u32 req_consumer_index_phy_addr_high; | ||
1117 | u32 req_consumer_index_phy_addr_low; | ||
1118 | atomic_t tx_count; | ||
1119 | struct ql_tx_buf_cb tx_buf[NUM_REQ_Q_ENTRIES]; | ||
1120 | |||
1121 | /* Net Response Queue */ | ||
1122 | u32 rsp_q_size; | ||
1123 | u32 eeprom_cmd_data; | ||
1124 | struct net_rsp_iocb *rsp_q_virt_addr; | ||
1125 | dma_addr_t rsp_q_phy_addr; | ||
1126 | struct net_rsp_iocb *rsp_current; | ||
1127 | u16 rsp_consumer_index; | ||
1128 | u16 reserved_06; | ||
1129 | u32 *prsp_producer_index; | ||
1130 | u32 rsp_producer_index_phy_addr_high; | ||
1131 | u32 rsp_producer_index_phy_addr_low; | ||
1132 | |||
1133 | /* Large Buffer Queue */ | ||
1134 | u32 lrg_buf_q_alloc_size; | ||
1135 | u32 lrg_buf_q_size; | ||
1136 | void *lrg_buf_q_alloc_virt_addr; | ||
1137 | void *lrg_buf_q_virt_addr; | ||
1138 | dma_addr_t lrg_buf_q_alloc_phy_addr; | ||
1139 | dma_addr_t lrg_buf_q_phy_addr; | ||
1140 | u32 lrg_buf_q_producer_index; | ||
1141 | u32 lrg_buf_release_cnt; | ||
1142 | struct bufq_addr_element *lrg_buf_next_free; | ||
1143 | |||
1144 | /* Large (Receive) Buffers */ | ||
1145 | struct ql_rcv_buf_cb lrg_buf[NUM_LARGE_BUFFERS]; | ||
1146 | struct ql_rcv_buf_cb *lrg_buf_free_head; | ||
1147 | struct ql_rcv_buf_cb *lrg_buf_free_tail; | ||
1148 | u32 lrg_buf_free_count; | ||
1149 | u32 lrg_buffer_len; | ||
1150 | u32 lrg_buf_index; | ||
1151 | u32 lrg_buf_skb_check; | ||
1152 | |||
1153 | /* Small Buffer Queue */ | ||
1154 | u32 small_buf_q_alloc_size; | ||
1155 | u32 small_buf_q_size; | ||
1156 | u32 small_buf_q_producer_index; | ||
1157 | void *small_buf_q_alloc_virt_addr; | ||
1158 | void *small_buf_q_virt_addr; | ||
1159 | dma_addr_t small_buf_q_alloc_phy_addr; | ||
1160 | dma_addr_t small_buf_q_phy_addr; | ||
1161 | u32 small_buf_index; | ||
1162 | |||
1163 | /* Small (Receive) Buffers */ | ||
1164 | void *small_buf_virt_addr; | ||
1165 | dma_addr_t small_buf_phy_addr; | ||
1166 | u32 small_buf_phy_addr_low; | ||
1167 | u32 small_buf_phy_addr_high; | ||
1168 | u32 small_buf_release_cnt; | ||
1169 | u32 small_buf_total_size; | ||
1170 | |||
1171 | /* ISR related, saves status for DPC. */ | ||
1172 | u32 control_status; | ||
1173 | |||
1174 | struct eeprom_data nvram_data; | ||
1175 | struct timer_list ioctl_timer; | ||
1176 | u32 port_link_state; | ||
1177 | u32 last_rsp_offset; | ||
1178 | |||
1179 | /* 4022 specific */ | ||
1180 | u32 mac_index; /* Driver's MAC number can be 0 or 1 for first and second networking functions respectively */ | ||
1181 | u32 PHYAddr; /* Address of PHY 0x1e00 Port 0 and 0x1f00 Port 1 */ | ||
1182 | u32 mac_ob_opcode; /* Opcode to use on mac transmission */ | ||
1183 | u32 tcp_ob_opcode; /* Opcode to use on tcp transmission */ | ||
1184 | u32 update_ob_opcode; /* Opcode to use for updating NCB */ | ||
1185 | u32 mb_bit_mask; /* MA Bits mask to use on transmission */ | ||
1186 | u32 numPorts; | ||
1187 | struct net_device_stats stats; | ||
1188 | struct workqueue_struct *workqueue; | ||
1189 | struct work_struct reset_work; | ||
1190 | struct work_struct tx_timeout_work; | ||
1191 | u32 max_frame_size; | ||
1192 | }; | ||
1193 | |||
1194 | #endif /* _QLA3XXX_H_ */ | ||
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 4c2f575faad7..5722a5638ffc 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -2809,7 +2809,7 @@ static struct pci_driver rtl8169_pci_driver = { | |||
2809 | static int __init | 2809 | static int __init |
2810 | rtl8169_init_module(void) | 2810 | rtl8169_init_module(void) |
2811 | { | 2811 | { |
2812 | return pci_module_init(&rtl8169_pci_driver); | 2812 | return pci_register_driver(&rtl8169_pci_driver); |
2813 | } | 2813 | } |
2814 | 2814 | ||
2815 | static void __exit | 2815 | static void __exit |
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c index c3ed734cbe39..31bcdad54716 100644 --- a/drivers/net/rrunner.c +++ b/drivers/net/rrunner.c | |||
@@ -1736,7 +1736,7 @@ static struct pci_driver rr_driver = { | |||
1736 | 1736 | ||
1737 | static int __init rr_init_module(void) | 1737 | static int __init rr_init_module(void) |
1738 | { | 1738 | { |
1739 | return pci_module_init(&rr_driver); | 1739 | return pci_register_driver(&rr_driver); |
1740 | } | 1740 | } |
1741 | 1741 | ||
1742 | static void __exit rr_cleanup_module(void) | 1742 | static void __exit rr_cleanup_module(void) |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 132ed32bce1a..c16f9156c98a 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -71,6 +71,7 @@ | |||
71 | #include <asm/uaccess.h> | 71 | #include <asm/uaccess.h> |
72 | #include <asm/io.h> | 72 | #include <asm/io.h> |
73 | #include <asm/div64.h> | 73 | #include <asm/div64.h> |
74 | #include <asm/irq.h> | ||
74 | 75 | ||
75 | /* local include */ | 76 | /* local include */ |
76 | #include "s2io.h" | 77 | #include "s2io.h" |
@@ -7232,7 +7233,7 @@ static void __devexit s2io_rem_nic(struct pci_dev *pdev) | |||
7232 | 7233 | ||
7233 | int __init s2io_starter(void) | 7234 | int __init s2io_starter(void) |
7234 | { | 7235 | { |
7235 | return pci_module_init(&s2io_driver); | 7236 | return pci_register_driver(&s2io_driver); |
7236 | } | 7237 | } |
7237 | 7238 | ||
7238 | /** | 7239 | /** |
diff --git a/drivers/net/saa9730.c b/drivers/net/saa9730.c index b2acedbefa8f..c479b07be788 100644 --- a/drivers/net/saa9730.c +++ b/drivers/net/saa9730.c | |||
@@ -1131,7 +1131,7 @@ static struct pci_driver saa9730_driver = { | |||
1131 | 1131 | ||
1132 | static int __init saa9730_init(void) | 1132 | static int __init saa9730_init(void) |
1133 | { | 1133 | { |
1134 | return pci_module_init(&saa9730_driver); | 1134 | return pci_register_driver(&saa9730_driver); |
1135 | } | 1135 | } |
1136 | 1136 | ||
1137 | static void __exit saa9730_cleanup(void) | 1137 | static void __exit saa9730_cleanup(void) |
diff --git a/drivers/net/seeq8005.c b/drivers/net/seeq8005.c index efd0f235020f..01392bca0223 100644 --- a/drivers/net/seeq8005.c +++ b/drivers/net/seeq8005.c | |||
@@ -742,7 +742,7 @@ module_param(irq, int, 0); | |||
742 | MODULE_PARM_DESC(io, "SEEQ 8005 I/O base address"); | 742 | MODULE_PARM_DESC(io, "SEEQ 8005 I/O base address"); |
743 | MODULE_PARM_DESC(irq, "SEEQ 8005 IRQ number"); | 743 | MODULE_PARM_DESC(irq, "SEEQ 8005 IRQ number"); |
744 | 744 | ||
745 | int init_module(void) | 745 | int __init init_module(void) |
746 | { | 746 | { |
747 | dev_seeq = seeq8005_probe(-1); | 747 | dev_seeq = seeq8005_probe(-1); |
748 | if (IS_ERR(dev_seeq)) | 748 | if (IS_ERR(dev_seeq)) |
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index df0cbebb3277..16e30d523fc5 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c | |||
@@ -1871,7 +1871,7 @@ static struct pci_driver sis190_pci_driver = { | |||
1871 | 1871 | ||
1872 | static int __init sis190_init_module(void) | 1872 | static int __init sis190_init_module(void) |
1873 | { | 1873 | { |
1874 | return pci_module_init(&sis190_pci_driver); | 1874 | return pci_register_driver(&sis190_pci_driver); |
1875 | } | 1875 | } |
1876 | 1876 | ||
1877 | static void __exit sis190_cleanup_module(void) | 1877 | static void __exit sis190_cleanup_module(void) |
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c index 29ee7ffedfff..6af50286349d 100644 --- a/drivers/net/sis900.c +++ b/drivers/net/sis900.c | |||
@@ -134,6 +134,7 @@ static const struct mii_chip_info { | |||
134 | { "AMD 79C901 10BASE-T PHY", 0x0000, 0x6B70, LAN }, | 134 | { "AMD 79C901 10BASE-T PHY", 0x0000, 0x6B70, LAN }, |
135 | { "AMD 79C901 HomePNA PHY", 0x0000, 0x6B90, HOME}, | 135 | { "AMD 79C901 HomePNA PHY", 0x0000, 0x6B90, HOME}, |
136 | { "ICS LAN PHY", 0x0015, 0xF440, LAN }, | 136 | { "ICS LAN PHY", 0x0015, 0xF440, LAN }, |
137 | { "ICS LAN PHY", 0x0143, 0xBC70, LAN }, | ||
137 | { "NS 83851 PHY", 0x2000, 0x5C20, MIX }, | 138 | { "NS 83851 PHY", 0x2000, 0x5C20, MIX }, |
138 | { "NS 83847 PHY", 0x2000, 0x5C30, MIX }, | 139 | { "NS 83847 PHY", 0x2000, 0x5C30, MIX }, |
139 | { "Realtek RTL8201 PHY", 0x0000, 0x8200, LAN }, | 140 | { "Realtek RTL8201 PHY", 0x0000, 0x8200, LAN }, |
@@ -2495,7 +2496,7 @@ static int __init sis900_init_module(void) | |||
2495 | printk(version); | 2496 | printk(version); |
2496 | #endif | 2497 | #endif |
2497 | 2498 | ||
2498 | return pci_module_init(&sis900_pci_driver); | 2499 | return pci_register_driver(&sis900_pci_driver); |
2499 | } | 2500 | } |
2500 | 2501 | ||
2501 | static void __exit sis900_cleanup_module(void) | 2502 | static void __exit sis900_cleanup_module(void) |
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index ee62845d3ac9..49e76c7f10da 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c | |||
@@ -5133,7 +5133,7 @@ static struct pci_driver skge_driver = { | |||
5133 | 5133 | ||
5134 | static int __init skge_init(void) | 5134 | static int __init skge_init(void) |
5135 | { | 5135 | { |
5136 | return pci_module_init(&skge_driver); | 5136 | return pci_register_driver(&skge_driver); |
5137 | } | 5137 | } |
5138 | 5138 | ||
5139 | static void __exit skge_exit(void) | 5139 | static void __exit skge_exit(void) |
diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c index b5714a60237d..8e4d18440a56 100644 --- a/drivers/net/skfp/skfddi.c +++ b/drivers/net/skfp/skfddi.c | |||
@@ -2280,7 +2280,7 @@ static struct pci_driver skfddi_pci_driver = { | |||
2280 | 2280 | ||
2281 | static int __init skfd_init(void) | 2281 | static int __init skfd_init(void) |
2282 | { | 2282 | { |
2283 | return pci_module_init(&skfddi_pci_driver); | 2283 | return pci_register_driver(&skfddi_pci_driver); |
2284 | } | 2284 | } |
2285 | 2285 | ||
2286 | static void __exit skfd_exit(void) | 2286 | static void __exit skfd_exit(void) |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 7de9a07b2ac2..1b752141a4f3 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -2211,6 +2211,7 @@ static int skge_up(struct net_device *dev) | |||
2211 | skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F); | 2211 | skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F); |
2212 | skge_led(skge, LED_MODE_ON); | 2212 | skge_led(skge, LED_MODE_ON); |
2213 | 2213 | ||
2214 | netif_poll_enable(dev); | ||
2214 | return 0; | 2215 | return 0; |
2215 | 2216 | ||
2216 | free_rx_ring: | 2217 | free_rx_ring: |
@@ -2279,6 +2280,7 @@ static int skge_down(struct net_device *dev) | |||
2279 | 2280 | ||
2280 | skge_led(skge, LED_MODE_OFF); | 2281 | skge_led(skge, LED_MODE_OFF); |
2281 | 2282 | ||
2283 | netif_poll_disable(dev); | ||
2282 | skge_tx_clean(skge); | 2284 | skge_tx_clean(skge); |
2283 | skge_rx_clean(skge); | 2285 | skge_rx_clean(skge); |
2284 | 2286 | ||
@@ -3508,7 +3510,7 @@ static struct pci_driver skge_driver = { | |||
3508 | 3510 | ||
3509 | static int __init skge_init_module(void) | 3511 | static int __init skge_init_module(void) |
3510 | { | 3512 | { |
3511 | return pci_module_init(&skge_driver); | 3513 | return pci_register_driver(&skge_driver); |
3512 | } | 3514 | } |
3513 | 3515 | ||
3514 | static void __exit skge_cleanup_module(void) | 3516 | static void __exit skge_cleanup_module(void) |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 933e87f1cc68..805a7dcf5508 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -50,7 +50,7 @@ | |||
50 | #include "sky2.h" | 50 | #include "sky2.h" |
51 | 51 | ||
52 | #define DRV_NAME "sky2" | 52 | #define DRV_NAME "sky2" |
53 | #define DRV_VERSION "1.5" | 53 | #define DRV_VERSION "1.6" |
54 | #define PFX DRV_NAME " " | 54 | #define PFX DRV_NAME " " |
55 | 55 | ||
56 | /* | 56 | /* |
@@ -121,6 +121,11 @@ static const struct pci_device_id sky2_id_table[] = { | |||
121 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, | 121 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, |
122 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4362) }, | 122 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4362) }, |
123 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4363) }, | 123 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4363) }, |
124 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4364) }, | ||
125 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4365) }, | ||
126 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4366) }, | ||
127 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4367) }, | ||
128 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) }, | ||
124 | { 0 } | 129 | { 0 } |
125 | }; | 130 | }; |
126 | 131 | ||
@@ -1926,12 +1931,6 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last) | |||
1926 | } | 1931 | } |
1927 | } | 1932 | } |
1928 | 1933 | ||
1929 | /* Is status ring empty or is there more to do? */ | ||
1930 | static inline int sky2_more_work(const struct sky2_hw *hw) | ||
1931 | { | ||
1932 | return (hw->st_idx != sky2_read16(hw, STAT_PUT_IDX)); | ||
1933 | } | ||
1934 | |||
1935 | /* Process status response ring */ | 1934 | /* Process status response ring */ |
1936 | static int sky2_status_intr(struct sky2_hw *hw, int to_do) | 1935 | static int sky2_status_intr(struct sky2_hw *hw, int to_do) |
1937 | { | 1936 | { |
@@ -2022,6 +2021,9 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do) | |||
2022 | } | 2021 | } |
2023 | } | 2022 | } |
2024 | 2023 | ||
2024 | /* Fully processed status ring so clear irq */ | ||
2025 | sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ); | ||
2026 | |||
2025 | exit_loop: | 2027 | exit_loop: |
2026 | if (buf_write[0]) { | 2028 | if (buf_write[0]) { |
2027 | sky2 = netdev_priv(hw->dev[0]); | 2029 | sky2 = netdev_priv(hw->dev[0]); |
@@ -2231,19 +2233,16 @@ static int sky2_poll(struct net_device *dev0, int *budget) | |||
2231 | sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2); | 2233 | sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2); |
2232 | 2234 | ||
2233 | work_done = sky2_status_intr(hw, work_limit); | 2235 | work_done = sky2_status_intr(hw, work_limit); |
2234 | *budget -= work_done; | 2236 | if (work_done < work_limit) { |
2235 | dev0->quota -= work_done; | 2237 | netif_rx_complete(dev0); |
2236 | |||
2237 | if (status & Y2_IS_STAT_BMU) | ||
2238 | sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ); | ||
2239 | 2238 | ||
2240 | if (sky2_more_work(hw)) | 2239 | sky2_read32(hw, B0_Y2_SP_LISR); |
2240 | return 0; | ||
2241 | } else { | ||
2242 | *budget -= work_done; | ||
2243 | dev0->quota -= work_done; | ||
2241 | return 1; | 2244 | return 1; |
2242 | 2245 | } | |
2243 | netif_rx_complete(dev0); | ||
2244 | |||
2245 | sky2_read32(hw, B0_Y2_SP_LISR); | ||
2246 | return 0; | ||
2247 | } | 2246 | } |
2248 | 2247 | ||
2249 | static irqreturn_t sky2_intr(int irq, void *dev_id, struct pt_regs *regs) | 2248 | static irqreturn_t sky2_intr(int irq, void *dev_id, struct pt_regs *regs) |
diff --git a/drivers/net/slhc.c b/drivers/net/slhc.c index 3a1b7131681c..9a540e2092b9 100644 --- a/drivers/net/slhc.c +++ b/drivers/net/slhc.c | |||
@@ -94,27 +94,23 @@ slhc_init(int rslots, int tslots) | |||
94 | register struct cstate *ts; | 94 | register struct cstate *ts; |
95 | struct slcompress *comp; | 95 | struct slcompress *comp; |
96 | 96 | ||
97 | comp = (struct slcompress *)kmalloc(sizeof(struct slcompress), | 97 | comp = kzalloc(sizeof(struct slcompress), GFP_KERNEL); |
98 | GFP_KERNEL); | ||
99 | if (! comp) | 98 | if (! comp) |
100 | goto out_fail; | 99 | goto out_fail; |
101 | memset(comp, 0, sizeof(struct slcompress)); | ||
102 | 100 | ||
103 | if ( rslots > 0 && rslots < 256 ) { | 101 | if ( rslots > 0 && rslots < 256 ) { |
104 | size_t rsize = rslots * sizeof(struct cstate); | 102 | size_t rsize = rslots * sizeof(struct cstate); |
105 | comp->rstate = (struct cstate *) kmalloc(rsize, GFP_KERNEL); | 103 | comp->rstate = kzalloc(rsize, GFP_KERNEL); |
106 | if (! comp->rstate) | 104 | if (! comp->rstate) |
107 | goto out_free; | 105 | goto out_free; |
108 | memset(comp->rstate, 0, rsize); | ||
109 | comp->rslot_limit = rslots - 1; | 106 | comp->rslot_limit = rslots - 1; |
110 | } | 107 | } |
111 | 108 | ||
112 | if ( tslots > 0 && tslots < 256 ) { | 109 | if ( tslots > 0 && tslots < 256 ) { |
113 | size_t tsize = tslots * sizeof(struct cstate); | 110 | size_t tsize = tslots * sizeof(struct cstate); |
114 | comp->tstate = (struct cstate *) kmalloc(tsize, GFP_KERNEL); | 111 | comp->tstate = kzalloc(tsize, GFP_KERNEL); |
115 | if (! comp->tstate) | 112 | if (! comp->tstate) |
116 | goto out_free2; | 113 | goto out_free2; |
117 | memset(comp->tstate, 0, tsize); | ||
118 | comp->tslot_limit = tslots - 1; | 114 | comp->tslot_limit = tslots - 1; |
119 | } | 115 | } |
120 | 116 | ||
@@ -141,9 +137,9 @@ slhc_init(int rslots, int tslots) | |||
141 | return comp; | 137 | return comp; |
142 | 138 | ||
143 | out_free2: | 139 | out_free2: |
144 | kfree((unsigned char *)comp->rstate); | 140 | kfree(comp->rstate); |
145 | out_free: | 141 | out_free: |
146 | kfree((unsigned char *)comp); | 142 | kfree(comp); |
147 | out_fail: | 143 | out_fail: |
148 | return NULL; | 144 | return NULL; |
149 | } | 145 | } |
@@ -700,20 +696,6 @@ EXPORT_SYMBOL(slhc_compress); | |||
700 | EXPORT_SYMBOL(slhc_uncompress); | 696 | EXPORT_SYMBOL(slhc_uncompress); |
701 | EXPORT_SYMBOL(slhc_toss); | 697 | EXPORT_SYMBOL(slhc_toss); |
702 | 698 | ||
703 | #ifdef MODULE | ||
704 | |||
705 | int init_module(void) | ||
706 | { | ||
707 | printk(KERN_INFO "CSLIP: code copyright 1989 Regents of the University of California\n"); | ||
708 | return 0; | ||
709 | } | ||
710 | |||
711 | void cleanup_module(void) | ||
712 | { | ||
713 | return; | ||
714 | } | ||
715 | |||
716 | #endif /* MODULE */ | ||
717 | #else /* CONFIG_INET */ | 699 | #else /* CONFIG_INET */ |
718 | 700 | ||
719 | 701 | ||
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index d37bd860b336..4438fe8c9499 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c | |||
@@ -55,8 +55,6 @@ static const char version[] = | |||
55 | ) | 55 | ) |
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | |||
59 | #include <linux/config.h> | ||
60 | #include <linux/init.h> | 58 | #include <linux/init.h> |
61 | #include <linux/module.h> | 59 | #include <linux/module.h> |
62 | #include <linux/kernel.h> | 60 | #include <linux/kernel.h> |
@@ -1092,6 +1090,7 @@ static irqreturn_t smc911x_interrupt(int irq, void *dev_id, struct pt_regs *regs | |||
1092 | /* Spurious interrupt check */ | 1090 | /* Spurious interrupt check */ |
1093 | if ((SMC_GET_IRQ_CFG() & (INT_CFG_IRQ_INT_ | INT_CFG_IRQ_EN_)) != | 1091 | if ((SMC_GET_IRQ_CFG() & (INT_CFG_IRQ_INT_ | INT_CFG_IRQ_EN_)) != |
1094 | (INT_CFG_IRQ_INT_ | INT_CFG_IRQ_EN_)) { | 1092 | (INT_CFG_IRQ_INT_ | INT_CFG_IRQ_EN_)) { |
1093 | spin_unlock_irqrestore(&lp->lock, flags); | ||
1095 | return IRQ_NONE; | 1094 | return IRQ_NONE; |
1096 | } | 1095 | } |
1097 | 1096 | ||
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 3d8dcb6c8758..cf62373b808b 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -321,12 +321,12 @@ static void smc_reset(struct net_device *dev) | |||
321 | DBG(2, "%s: %s\n", dev->name, __FUNCTION__); | 321 | DBG(2, "%s: %s\n", dev->name, __FUNCTION__); |
322 | 322 | ||
323 | /* Disable all interrupts, block TX tasklet */ | 323 | /* Disable all interrupts, block TX tasklet */ |
324 | spin_lock(&lp->lock); | 324 | spin_lock_irq(&lp->lock); |
325 | SMC_SELECT_BANK(2); | 325 | SMC_SELECT_BANK(2); |
326 | SMC_SET_INT_MASK(0); | 326 | SMC_SET_INT_MASK(0); |
327 | pending_skb = lp->pending_tx_skb; | 327 | pending_skb = lp->pending_tx_skb; |
328 | lp->pending_tx_skb = NULL; | 328 | lp->pending_tx_skb = NULL; |
329 | spin_unlock(&lp->lock); | 329 | spin_unlock_irq(&lp->lock); |
330 | 330 | ||
331 | /* free any pending tx skb */ | 331 | /* free any pending tx skb */ |
332 | if (pending_skb) { | 332 | if (pending_skb) { |
@@ -448,12 +448,12 @@ static void smc_shutdown(struct net_device *dev) | |||
448 | DBG(2, "%s: %s\n", CARDNAME, __FUNCTION__); | 448 | DBG(2, "%s: %s\n", CARDNAME, __FUNCTION__); |
449 | 449 | ||
450 | /* no more interrupts for me */ | 450 | /* no more interrupts for me */ |
451 | spin_lock(&lp->lock); | 451 | spin_lock_irq(&lp->lock); |
452 | SMC_SELECT_BANK(2); | 452 | SMC_SELECT_BANK(2); |
453 | SMC_SET_INT_MASK(0); | 453 | SMC_SET_INT_MASK(0); |
454 | pending_skb = lp->pending_tx_skb; | 454 | pending_skb = lp->pending_tx_skb; |
455 | lp->pending_tx_skb = NULL; | 455 | lp->pending_tx_skb = NULL; |
456 | spin_unlock(&lp->lock); | 456 | spin_unlock_irq(&lp->lock); |
457 | if (pending_skb) | 457 | if (pending_skb) |
458 | dev_kfree_skb(pending_skb); | 458 | dev_kfree_skb(pending_skb); |
459 | 459 | ||
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index 9f9f8f2d5338..7aa7fbac8224 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -184,16 +184,10 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
184 | #define SMC_IO_SHIFT 0 | 184 | #define SMC_IO_SHIFT 0 |
185 | #define SMC_NOWAIT 1 | 185 | #define SMC_NOWAIT 1 |
186 | 186 | ||
187 | #define SMC_inb(a, r) readb((a) + (r)) | ||
188 | #define SMC_outb(v, a, r) writeb(v, (a) + (r)) | ||
189 | #define SMC_inw(a, r) readw((a) + (r)) | 187 | #define SMC_inw(a, r) readw((a) + (r)) |
190 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | 188 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) |
191 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) | 189 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) |
192 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | 190 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) |
193 | #define SMC_inl(a, r) readl((a) + (r)) | ||
194 | #define SMC_outl(v, a, r) writel(v, (a) + (r)) | ||
195 | #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) | ||
196 | #define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) | ||
197 | 191 | ||
198 | #include <asm/mach-types.h> | 192 | #include <asm/mach-types.h> |
199 | #include <asm/arch/cpu.h> | 193 | #include <asm/arch/cpu.h> |
@@ -367,6 +361,24 @@ static inline void LPD7_SMC_outsw (unsigned char* a, int r, | |||
367 | 361 | ||
368 | #define SMC_IRQ_FLAGS (0) | 362 | #define SMC_IRQ_FLAGS (0) |
369 | 363 | ||
364 | #elif defined(CONFIG_ARCH_VERSATILE) | ||
365 | |||
366 | #define SMC_CAN_USE_8BIT 1 | ||
367 | #define SMC_CAN_USE_16BIT 1 | ||
368 | #define SMC_CAN_USE_32BIT 1 | ||
369 | #define SMC_NOWAIT 1 | ||
370 | |||
371 | #define SMC_inb(a, r) readb((a) + (r)) | ||
372 | #define SMC_inw(a, r) readw((a) + (r)) | ||
373 | #define SMC_inl(a, r) readl((a) + (r)) | ||
374 | #define SMC_outb(v, a, r) writeb(v, (a) + (r)) | ||
375 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | ||
376 | #define SMC_outl(v, a, r) writel(v, (a) + (r)) | ||
377 | #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) | ||
378 | #define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) | ||
379 | |||
380 | #define SMC_IRQ_FLAGS (0) | ||
381 | |||
370 | #else | 382 | #else |
371 | 383 | ||
372 | #define SMC_CAN_USE_8BIT 1 | 384 | #define SMC_CAN_USE_8BIT 1 |
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index 647f62e9707d..88907218457a 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c | |||
@@ -1611,13 +1611,12 @@ spider_net_open(struct net_device *netdev) | |||
1611 | int result; | 1611 | int result; |
1612 | 1612 | ||
1613 | result = -ENOMEM; | 1613 | result = -ENOMEM; |
1614 | if (spider_net_init_chain(card, &card->tx_chain, | 1614 | if (spider_net_init_chain(card, &card->tx_chain, card->descr, |
1615 | card->descr, | 1615 | PCI_DMA_TODEVICE, card->tx_desc)) |
1616 | PCI_DMA_TODEVICE, tx_descriptors)) | ||
1617 | goto alloc_tx_failed; | 1616 | goto alloc_tx_failed; |
1618 | if (spider_net_init_chain(card, &card->rx_chain, | 1617 | if (spider_net_init_chain(card, &card->rx_chain, |
1619 | card->descr + tx_descriptors, | 1618 | card->descr + card->rx_desc, |
1620 | PCI_DMA_FROMDEVICE, rx_descriptors)) | 1619 | PCI_DMA_FROMDEVICE, card->rx_desc)) |
1621 | goto alloc_rx_failed; | 1620 | goto alloc_rx_failed; |
1622 | 1621 | ||
1623 | /* allocate rx skbs */ | 1622 | /* allocate rx skbs */ |
@@ -2005,6 +2004,9 @@ spider_net_setup_netdev(struct spider_net_card *card) | |||
2005 | 2004 | ||
2006 | card->options.rx_csum = SPIDER_NET_RX_CSUM_DEFAULT; | 2005 | card->options.rx_csum = SPIDER_NET_RX_CSUM_DEFAULT; |
2007 | 2006 | ||
2007 | card->tx_desc = tx_descriptors; | ||
2008 | card->rx_desc = rx_descriptors; | ||
2009 | |||
2008 | spider_net_setup_netdev_ops(netdev); | 2010 | spider_net_setup_netdev_ops(netdev); |
2009 | 2011 | ||
2010 | netdev->features = NETIF_F_HW_CSUM | NETIF_F_LLTX; | 2012 | netdev->features = NETIF_F_HW_CSUM | NETIF_F_LLTX; |
diff --git a/drivers/net/spider_net.h b/drivers/net/spider_net.h index f6dcf180ae3d..30407cdf0892 100644 --- a/drivers/net/spider_net.h +++ b/drivers/net/spider_net.h | |||
@@ -440,6 +440,9 @@ struct spider_net_card { | |||
440 | /* for ethtool */ | 440 | /* for ethtool */ |
441 | int msg_enable; | 441 | int msg_enable; |
442 | 442 | ||
443 | int rx_desc; | ||
444 | int tx_desc; | ||
445 | |||
443 | struct spider_net_descr descr[0]; | 446 | struct spider_net_descr descr[0]; |
444 | }; | 447 | }; |
445 | 448 | ||
diff --git a/drivers/net/spider_net_ethtool.c b/drivers/net/spider_net_ethtool.c index a5bb0b7633af..02209222b8c9 100644 --- a/drivers/net/spider_net_ethtool.c +++ b/drivers/net/spider_net_ethtool.c | |||
@@ -130,6 +130,18 @@ spider_net_ethtool_set_tx_csum(struct net_device *netdev, uint32_t data) | |||
130 | return 0; | 130 | return 0; |
131 | } | 131 | } |
132 | 132 | ||
133 | static void | ||
134 | spider_net_ethtool_get_ringparam(struct net_device *netdev, | ||
135 | struct ethtool_ringparam *ering) | ||
136 | { | ||
137 | struct spider_net_card *card = netdev->priv; | ||
138 | |||
139 | ering->tx_max_pending = SPIDER_NET_TX_DESCRIPTORS_MAX; | ||
140 | ering->tx_pending = card->tx_desc; | ||
141 | ering->rx_max_pending = SPIDER_NET_RX_DESCRIPTORS_MAX; | ||
142 | ering->rx_pending = card->rx_desc; | ||
143 | } | ||
144 | |||
133 | struct ethtool_ops spider_net_ethtool_ops = { | 145 | struct ethtool_ops spider_net_ethtool_ops = { |
134 | .get_settings = spider_net_ethtool_get_settings, | 146 | .get_settings = spider_net_ethtool_get_settings, |
135 | .get_drvinfo = spider_net_ethtool_get_drvinfo, | 147 | .get_drvinfo = spider_net_ethtool_get_drvinfo, |
@@ -141,5 +153,6 @@ struct ethtool_ops spider_net_ethtool_ops = { | |||
141 | .set_rx_csum = spider_net_ethtool_set_rx_csum, | 153 | .set_rx_csum = spider_net_ethtool_set_rx_csum, |
142 | .get_tx_csum = spider_net_ethtool_get_tx_csum, | 154 | .get_tx_csum = spider_net_ethtool_get_tx_csum, |
143 | .set_tx_csum = spider_net_ethtool_set_tx_csum, | 155 | .set_tx_csum = spider_net_ethtool_set_tx_csum, |
156 | .get_ringparam = spider_net_ethtool_get_ringparam, | ||
144 | }; | 157 | }; |
145 | 158 | ||
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index c0a62b00ffc8..8e1f6206b7d0 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c | |||
@@ -2053,7 +2053,7 @@ static int __init starfire_init (void) | |||
2053 | return -ENODEV; | 2053 | return -ENODEV; |
2054 | } | 2054 | } |
2055 | 2055 | ||
2056 | return pci_module_init (&starfire_driver); | 2056 | return pci_register_driver(&starfire_driver); |
2057 | } | 2057 | } |
2058 | 2058 | ||
2059 | 2059 | ||
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index ac17377b3e9f..c243a80f4006 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c | |||
@@ -17,6 +17,8 @@ | |||
17 | Support and updates available at | 17 | Support and updates available at |
18 | http://www.scyld.com/network/sundance.html | 18 | http://www.scyld.com/network/sundance.html |
19 | [link no longer provides useful info -jgarzik] | 19 | [link no longer provides useful info -jgarzik] |
20 | Archives of the mailing list are still available at | ||
21 | http://www.beowulf.org/pipermail/netdrivers/ | ||
20 | 22 | ||
21 | */ | 23 | */ |
22 | 24 | ||
@@ -107,7 +109,7 @@ static char *media[MAX_UNITS]; | |||
107 | #endif | 109 | #endif |
108 | 110 | ||
109 | /* These identify the driver base version and may not be removed. */ | 111 | /* These identify the driver base version and may not be removed. */ |
110 | static char version[] __devinitdata = | 112 | static char version[] = |
111 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " Written by Donald Becker\n" | 113 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " Written by Donald Becker\n" |
112 | KERN_INFO " http://www.scyld.com/network/sundance.html\n"; | 114 | KERN_INFO " http://www.scyld.com/network/sundance.html\n"; |
113 | 115 | ||
@@ -646,7 +648,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev, | |||
646 | /* Reset the chip to erase previous misconfiguration. */ | 648 | /* Reset the chip to erase previous misconfiguration. */ |
647 | if (netif_msg_hw(np)) | 649 | if (netif_msg_hw(np)) |
648 | printk("ASIC Control is %x.\n", ioread32(ioaddr + ASICCtrl)); | 650 | printk("ASIC Control is %x.\n", ioread32(ioaddr + ASICCtrl)); |
649 | iowrite16(0x00ff, ioaddr + ASICCtrl + 2); | 651 | sundance_reset(dev, 0x00ff << 16); |
650 | if (netif_msg_hw(np)) | 652 | if (netif_msg_hw(np)) |
651 | printk("ASIC Control is now %x.\n", ioread32(ioaddr + ASICCtrl)); | 653 | printk("ASIC Control is now %x.\n", ioread32(ioaddr + ASICCtrl)); |
652 | 654 | ||
@@ -1075,13 +1077,8 @@ reset_tx (struct net_device *dev) | |||
1075 | 1077 | ||
1076 | /* Reset tx logic, TxListPtr will be cleaned */ | 1078 | /* Reset tx logic, TxListPtr will be cleaned */ |
1077 | iowrite16 (TxDisable, ioaddr + MACCtrl1); | 1079 | iowrite16 (TxDisable, ioaddr + MACCtrl1); |
1078 | iowrite16 (TxReset | DMAReset | FIFOReset | NetworkReset, | 1080 | sundance_reset(dev, (NetworkReset|FIFOReset|DMAReset|TxReset) << 16); |
1079 | ioaddr + ASICCtrl + 2); | 1081 | |
1080 | for (i=50; i > 0; i--) { | ||
1081 | if ((ioread16(ioaddr + ASICCtrl + 2) & ResetBusy) == 0) | ||
1082 | break; | ||
1083 | mdelay(1); | ||
1084 | } | ||
1085 | /* free all tx skbuff */ | 1082 | /* free all tx skbuff */ |
1086 | for (i = 0; i < TX_RING_SIZE; i++) { | 1083 | for (i = 0; i < TX_RING_SIZE; i++) { |
1087 | skb = np->tx_skbuff[i]; | 1084 | skb = np->tx_skbuff[i]; |
@@ -1736,7 +1733,7 @@ static int __init sundance_init(void) | |||
1736 | #ifdef MODULE | 1733 | #ifdef MODULE |
1737 | printk(version); | 1734 | printk(version); |
1738 | #endif | 1735 | #endif |
1739 | return pci_module_init(&sundance_driver); | 1736 | return pci_register_driver(&sundance_driver); |
1740 | } | 1737 | } |
1741 | 1738 | ||
1742 | static void __exit sundance_exit(void) | 1739 | static void __exit sundance_exit(void) |
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index b70bbd748978..1a441a8a2add 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
@@ -3194,7 +3194,7 @@ static struct pci_driver gem_driver = { | |||
3194 | 3194 | ||
3195 | static int __init gem_init(void) | 3195 | static int __init gem_init(void) |
3196 | { | 3196 | { |
3197 | return pci_module_init(&gem_driver); | 3197 | return pci_register_driver(&gem_driver); |
3198 | } | 3198 | } |
3199 | 3199 | ||
3200 | static void __exit gem_cleanup(void) | 3200 | static void __exit gem_cleanup(void) |
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c index 8b53ded66d37..39460fa916fe 100644 --- a/drivers/net/tc35815.c +++ b/drivers/net/tc35815.c | |||
@@ -1725,7 +1725,7 @@ static struct pci_driver tc35815_driver = { | |||
1725 | 1725 | ||
1726 | static int __init tc35815_init_module(void) | 1726 | static int __init tc35815_init_module(void) |
1727 | { | 1727 | { |
1728 | return pci_module_init(&tc35815_driver); | 1728 | return pci_register_driver(&tc35815_driver); |
1729 | } | 1729 | } |
1730 | 1730 | ||
1731 | static void __exit tc35815_cleanup_module(void) | 1731 | static void __exit tc35815_cleanup_module(void) |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 6f97962dd06b..d6e2a6869f28 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -68,8 +68,8 @@ | |||
68 | 68 | ||
69 | #define DRV_MODULE_NAME "tg3" | 69 | #define DRV_MODULE_NAME "tg3" |
70 | #define PFX DRV_MODULE_NAME ": " | 70 | #define PFX DRV_MODULE_NAME ": " |
71 | #define DRV_MODULE_VERSION "3.64" | 71 | #define DRV_MODULE_VERSION "3.65" |
72 | #define DRV_MODULE_RELDATE "July 31, 2006" | 72 | #define DRV_MODULE_RELDATE "August 07, 2006" |
73 | 73 | ||
74 | #define TG3_DEF_MAC_MODE 0 | 74 | #define TG3_DEF_MAC_MODE 0 |
75 | #define TG3_DEF_RX_MODE 0 | 75 | #define TG3_DEF_RX_MODE 0 |
@@ -123,9 +123,6 @@ | |||
123 | TG3_RX_RCB_RING_SIZE(tp)) | 123 | TG3_RX_RCB_RING_SIZE(tp)) |
124 | #define TG3_TX_RING_BYTES (sizeof(struct tg3_tx_buffer_desc) * \ | 124 | #define TG3_TX_RING_BYTES (sizeof(struct tg3_tx_buffer_desc) * \ |
125 | TG3_TX_RING_SIZE) | 125 | TG3_TX_RING_SIZE) |
126 | #define TX_BUFFS_AVAIL(TP) \ | ||
127 | ((TP)->tx_pending - \ | ||
128 | (((TP)->tx_prod - (TP)->tx_cons) & (TG3_TX_RING_SIZE - 1))) | ||
129 | #define NEXT_TX(N) (((N) + 1) & (TG3_TX_RING_SIZE - 1)) | 126 | #define NEXT_TX(N) (((N) + 1) & (TG3_TX_RING_SIZE - 1)) |
130 | 127 | ||
131 | #define RX_PKT_BUF_SZ (1536 + tp->rx_offset + 64) | 128 | #define RX_PKT_BUF_SZ (1536 + tp->rx_offset + 64) |
@@ -2987,6 +2984,13 @@ static void tg3_tx_recover(struct tg3 *tp) | |||
2987 | spin_unlock(&tp->lock); | 2984 | spin_unlock(&tp->lock); |
2988 | } | 2985 | } |
2989 | 2986 | ||
2987 | static inline u32 tg3_tx_avail(struct tg3 *tp) | ||
2988 | { | ||
2989 | smp_mb(); | ||
2990 | return (tp->tx_pending - | ||
2991 | ((tp->tx_prod - tp->tx_cons) & (TG3_TX_RING_SIZE - 1))); | ||
2992 | } | ||
2993 | |||
2990 | /* Tigon3 never reports partial packet sends. So we do not | 2994 | /* Tigon3 never reports partial packet sends. So we do not |
2991 | * need special logic to handle SKBs that have not had all | 2995 | * need special logic to handle SKBs that have not had all |
2992 | * of their frags sent yet, like SunGEM does. | 2996 | * of their frags sent yet, like SunGEM does. |
@@ -3038,12 +3042,20 @@ static void tg3_tx(struct tg3 *tp) | |||
3038 | 3042 | ||
3039 | tp->tx_cons = sw_idx; | 3043 | tp->tx_cons = sw_idx; |
3040 | 3044 | ||
3041 | if (unlikely(netif_queue_stopped(tp->dev))) { | 3045 | /* Need to make the tx_cons update visible to tg3_start_xmit() |
3042 | spin_lock(&tp->tx_lock); | 3046 | * before checking for netif_queue_stopped(). Without the |
3047 | * memory barrier, there is a small possibility that tg3_start_xmit() | ||
3048 | * will miss it and cause the queue to be stopped forever. | ||
3049 | */ | ||
3050 | smp_mb(); | ||
3051 | |||
3052 | if (unlikely(netif_queue_stopped(tp->dev) && | ||
3053 | (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH))) { | ||
3054 | netif_tx_lock(tp->dev); | ||
3043 | if (netif_queue_stopped(tp->dev) && | 3055 | if (netif_queue_stopped(tp->dev) && |
3044 | (TX_BUFFS_AVAIL(tp) > TG3_TX_WAKEUP_THRESH)) | 3056 | (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH)) |
3045 | netif_wake_queue(tp->dev); | 3057 | netif_wake_queue(tp->dev); |
3046 | spin_unlock(&tp->tx_lock); | 3058 | netif_tx_unlock(tp->dev); |
3047 | } | 3059 | } |
3048 | } | 3060 | } |
3049 | 3061 | ||
@@ -3101,7 +3113,6 @@ static int tg3_alloc_rx_skb(struct tg3 *tp, u32 opaque_key, | |||
3101 | if (skb == NULL) | 3113 | if (skb == NULL) |
3102 | return -ENOMEM; | 3114 | return -ENOMEM; |
3103 | 3115 | ||
3104 | skb->dev = tp->dev; | ||
3105 | skb_reserve(skb, tp->rx_offset); | 3116 | skb_reserve(skb, tp->rx_offset); |
3106 | 3117 | ||
3107 | mapping = pci_map_single(tp->pdev, skb->data, | 3118 | mapping = pci_map_single(tp->pdev, skb->data, |
@@ -3274,7 +3285,6 @@ static int tg3_rx(struct tg3 *tp, int budget) | |||
3274 | if (copy_skb == NULL) | 3285 | if (copy_skb == NULL) |
3275 | goto drop_it_no_recycle; | 3286 | goto drop_it_no_recycle; |
3276 | 3287 | ||
3277 | copy_skb->dev = tp->dev; | ||
3278 | skb_reserve(copy_skb, 2); | 3288 | skb_reserve(copy_skb, 2); |
3279 | skb_put(copy_skb, len); | 3289 | skb_put(copy_skb, len); |
3280 | pci_dma_sync_single_for_cpu(tp->pdev, dma_addr, len, PCI_DMA_FROMDEVICE); | 3290 | pci_dma_sync_single_for_cpu(tp->pdev, dma_addr, len, PCI_DMA_FROMDEVICE); |
@@ -3797,7 +3807,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3797 | * interrupt. Furthermore, IRQ processing runs lockless so we have | 3807 | * interrupt. Furthermore, IRQ processing runs lockless so we have |
3798 | * no IRQ context deadlocks to worry about either. Rejoice! | 3808 | * no IRQ context deadlocks to worry about either. Rejoice! |
3799 | */ | 3809 | */ |
3800 | if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) { | 3810 | if (unlikely(tg3_tx_avail(tp) <= (skb_shinfo(skb)->nr_frags + 1))) { |
3801 | if (!netif_queue_stopped(dev)) { | 3811 | if (!netif_queue_stopped(dev)) { |
3802 | netif_stop_queue(dev); | 3812 | netif_stop_queue(dev); |
3803 | 3813 | ||
@@ -3893,12 +3903,10 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3893 | tw32_tx_mbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry); | 3903 | tw32_tx_mbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry); |
3894 | 3904 | ||
3895 | tp->tx_prod = entry; | 3905 | tp->tx_prod = entry; |
3896 | if (unlikely(TX_BUFFS_AVAIL(tp) <= (MAX_SKB_FRAGS + 1))) { | 3906 | if (unlikely(tg3_tx_avail(tp) <= (MAX_SKB_FRAGS + 1))) { |
3897 | spin_lock(&tp->tx_lock); | ||
3898 | netif_stop_queue(dev); | 3907 | netif_stop_queue(dev); |
3899 | if (TX_BUFFS_AVAIL(tp) > TG3_TX_WAKEUP_THRESH) | 3908 | if (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH) |
3900 | netif_wake_queue(tp->dev); | 3909 | netif_wake_queue(tp->dev); |
3901 | spin_unlock(&tp->tx_lock); | ||
3902 | } | 3910 | } |
3903 | 3911 | ||
3904 | out_unlock: | 3912 | out_unlock: |
@@ -3920,7 +3928,7 @@ static int tg3_tso_bug(struct tg3 *tp, struct sk_buff *skb) | |||
3920 | struct sk_buff *segs, *nskb; | 3928 | struct sk_buff *segs, *nskb; |
3921 | 3929 | ||
3922 | /* Estimate the number of fragments in the worst case */ | 3930 | /* Estimate the number of fragments in the worst case */ |
3923 | if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->gso_segs * 3))) { | 3931 | if (unlikely(tg3_tx_avail(tp) <= (skb_shinfo(skb)->gso_segs * 3))) { |
3924 | netif_stop_queue(tp->dev); | 3932 | netif_stop_queue(tp->dev); |
3925 | return NETDEV_TX_BUSY; | 3933 | return NETDEV_TX_BUSY; |
3926 | } | 3934 | } |
@@ -3960,7 +3968,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev) | |||
3960 | * interrupt. Furthermore, IRQ processing runs lockless so we have | 3968 | * interrupt. Furthermore, IRQ processing runs lockless so we have |
3961 | * no IRQ context deadlocks to worry about either. Rejoice! | 3969 | * no IRQ context deadlocks to worry about either. Rejoice! |
3962 | */ | 3970 | */ |
3963 | if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) { | 3971 | if (unlikely(tg3_tx_avail(tp) <= (skb_shinfo(skb)->nr_frags + 1))) { |
3964 | if (!netif_queue_stopped(dev)) { | 3972 | if (!netif_queue_stopped(dev)) { |
3965 | netif_stop_queue(dev); | 3973 | netif_stop_queue(dev); |
3966 | 3974 | ||
@@ -4110,12 +4118,10 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev) | |||
4110 | tw32_tx_mbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry); | 4118 | tw32_tx_mbox((MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW), entry); |
4111 | 4119 | ||
4112 | tp->tx_prod = entry; | 4120 | tp->tx_prod = entry; |
4113 | if (unlikely(TX_BUFFS_AVAIL(tp) <= (MAX_SKB_FRAGS + 1))) { | 4121 | if (unlikely(tg3_tx_avail(tp) <= (MAX_SKB_FRAGS + 1))) { |
4114 | spin_lock(&tp->tx_lock); | ||
4115 | netif_stop_queue(dev); | 4122 | netif_stop_queue(dev); |
4116 | if (TX_BUFFS_AVAIL(tp) > TG3_TX_WAKEUP_THRESH) | 4123 | if (tg3_tx_avail(tp) > TG3_TX_WAKEUP_THRESH) |
4117 | netif_wake_queue(tp->dev); | 4124 | netif_wake_queue(tp->dev); |
4118 | spin_unlock(&tp->tx_lock); | ||
4119 | } | 4125 | } |
4120 | 4126 | ||
4121 | out_unlock: | 4127 | out_unlock: |
@@ -11474,7 +11480,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
11474 | tp->grc_mode |= GRC_MODE_BSWAP_NONFRM_DATA; | 11480 | tp->grc_mode |= GRC_MODE_BSWAP_NONFRM_DATA; |
11475 | #endif | 11481 | #endif |
11476 | spin_lock_init(&tp->lock); | 11482 | spin_lock_init(&tp->lock); |
11477 | spin_lock_init(&tp->tx_lock); | ||
11478 | spin_lock_init(&tp->indirect_lock); | 11483 | spin_lock_init(&tp->indirect_lock); |
11479 | INIT_WORK(&tp->reset_task, tg3_reset_task, tp); | 11484 | INIT_WORK(&tp->reset_task, tg3_reset_task, tp); |
11480 | 11485 | ||
@@ -11814,7 +11819,7 @@ static struct pci_driver tg3_driver = { | |||
11814 | 11819 | ||
11815 | static int __init tg3_init(void) | 11820 | static int __init tg3_init(void) |
11816 | { | 11821 | { |
11817 | return pci_module_init(&tg3_driver); | 11822 | return pci_register_driver(&tg3_driver); |
11818 | } | 11823 | } |
11819 | 11824 | ||
11820 | static void __exit tg3_cleanup(void) | 11825 | static void __exit tg3_cleanup(void) |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index ba2c98711c88..3ecf356cfb08 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -2079,9 +2079,9 @@ struct tg3 { | |||
2079 | * lock: Held during reset, PHY access, timer, and when | 2079 | * lock: Held during reset, PHY access, timer, and when |
2080 | * updating tg3_flags and tg3_flags2. | 2080 | * updating tg3_flags and tg3_flags2. |
2081 | * | 2081 | * |
2082 | * tx_lock: Held during tg3_start_xmit and tg3_tx only | 2082 | * netif_tx_lock: Held during tg3_start_xmit. tg3_tx holds |
2083 | * when calling netif_[start|stop]_queue. | 2083 | * netif_tx_lock when it needs to call |
2084 | * tg3_start_xmit is protected by netif_tx_lock. | 2084 | * netif_wake_queue. |
2085 | * | 2085 | * |
2086 | * Both of these locks are to be held with BH safety. | 2086 | * Both of these locks are to be held with BH safety. |
2087 | * | 2087 | * |
@@ -2118,8 +2118,6 @@ struct tg3 { | |||
2118 | u32 tx_cons; | 2118 | u32 tx_cons; |
2119 | u32 tx_pending; | 2119 | u32 tx_pending; |
2120 | 2120 | ||
2121 | spinlock_t tx_lock; | ||
2122 | |||
2123 | struct tg3_tx_buffer_desc *tx_ring; | 2121 | struct tg3_tx_buffer_desc *tx_ring; |
2124 | struct tx_ring_info *tx_buffers; | 2122 | struct tx_ring_info *tx_buffers; |
2125 | dma_addr_t tx_desc_mapping; | 2123 | dma_addr_t tx_desc_mapping; |
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c index 465921e3874c..412390ba142e 100644 --- a/drivers/net/tokenring/3c359.c +++ b/drivers/net/tokenring/3c359.c | |||
@@ -1815,7 +1815,7 @@ static struct pci_driver xl_3c359_driver = { | |||
1815 | 1815 | ||
1816 | static int __init xl_pci_init (void) | 1816 | static int __init xl_pci_init (void) |
1817 | { | 1817 | { |
1818 | return pci_module_init (&xl_3c359_driver); | 1818 | return pci_register_driver(&xl_3c359_driver); |
1819 | } | 1819 | } |
1820 | 1820 | ||
1821 | 1821 | ||
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c index 9f491563944e..4470025ff7f8 100644 --- a/drivers/net/tokenring/ibmtr.c +++ b/drivers/net/tokenring/ibmtr.c | |||
@@ -140,7 +140,7 @@ in the event that chatty debug messages are desired - jjs 12/30/98 */ | |||
140 | 140 | ||
141 | /* version and credits */ | 141 | /* version and credits */ |
142 | #ifndef PCMCIA | 142 | #ifndef PCMCIA |
143 | static char version[] __initdata = | 143 | static char version[] __devinitdata = |
144 | "\nibmtr.c: v1.3.57 8/ 7/94 Peter De Schrijver and Mark Swanson\n" | 144 | "\nibmtr.c: v1.3.57 8/ 7/94 Peter De Schrijver and Mark Swanson\n" |
145 | " v2.1.125 10/20/98 Paul Norton <pnorton@ieee.org>\n" | 145 | " v2.1.125 10/20/98 Paul Norton <pnorton@ieee.org>\n" |
146 | " v2.2.0 12/30/98 Joel Sloan <jjs@c-me.com>\n" | 146 | " v2.2.0 12/30/98 Joel Sloan <jjs@c-me.com>\n" |
@@ -216,7 +216,7 @@ static int __devinitdata turbo_irq[IBMTR_MAX_ADAPTERS] = {0}; | |||
216 | static int __devinitdata turbo_searched = 0; | 216 | static int __devinitdata turbo_searched = 0; |
217 | 217 | ||
218 | #ifndef PCMCIA | 218 | #ifndef PCMCIA |
219 | static __u32 ibmtr_mem_base __initdata = 0xd0000; | 219 | static __u32 ibmtr_mem_base __devinitdata = 0xd0000; |
220 | #endif | 220 | #endif |
221 | 221 | ||
222 | static void __devinit PrtChanID(char *pcid, short stride) | 222 | static void __devinit PrtChanID(char *pcid, short stride) |
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c index 28d968ffd5d0..0d66700c6ced 100644 --- a/drivers/net/tokenring/lanstreamer.c +++ b/drivers/net/tokenring/lanstreamer.c | |||
@@ -1998,7 +1998,7 @@ static struct pci_driver streamer_pci_driver = { | |||
1998 | }; | 1998 | }; |
1999 | 1999 | ||
2000 | static int __init streamer_init_module(void) { | 2000 | static int __init streamer_init_module(void) { |
2001 | return pci_module_init(&streamer_pci_driver); | 2001 | return pci_register_driver(&streamer_pci_driver); |
2002 | } | 2002 | } |
2003 | 2003 | ||
2004 | static void __exit streamer_cleanup_module(void) { | 2004 | static void __exit streamer_cleanup_module(void) { |
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c index cd2e0251e2bc..85a7f797d343 100644 --- a/drivers/net/tokenring/smctr.c +++ b/drivers/net/tokenring/smctr.c | |||
@@ -5666,7 +5666,7 @@ module_param_array(io, int, NULL, 0); | |||
5666 | module_param_array(irq, int, NULL, 0); | 5666 | module_param_array(irq, int, NULL, 0); |
5667 | module_param(ringspeed, int, 0); | 5667 | module_param(ringspeed, int, 0); |
5668 | 5668 | ||
5669 | static struct net_device *setup_card(int n) | 5669 | static struct net_device * __init setup_card(int n) |
5670 | { | 5670 | { |
5671 | struct net_device *dev = alloc_trdev(sizeof(struct net_local)); | 5671 | struct net_device *dev = alloc_trdev(sizeof(struct net_local)); |
5672 | int err; | 5672 | int err; |
@@ -5696,9 +5696,8 @@ out: | |||
5696 | free_netdev(dev); | 5696 | free_netdev(dev); |
5697 | return ERR_PTR(err); | 5697 | return ERR_PTR(err); |
5698 | } | 5698 | } |
5699 | |||
5700 | 5699 | ||
5701 | int init_module(void) | 5700 | int __init init_module(void) |
5702 | { | 5701 | { |
5703 | int i, found = 0; | 5702 | int i, found = 0; |
5704 | struct net_device *dev; | 5703 | struct net_device *dev; |
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index d05c5aa254ee..350a73e99a85 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -2172,7 +2172,7 @@ static int __init de_init (void) | |||
2172 | #ifdef MODULE | 2172 | #ifdef MODULE |
2173 | printk("%s", version); | 2173 | printk("%s", version); |
2174 | #endif | 2174 | #endif |
2175 | return pci_module_init (&de_driver); | 2175 | return pci_register_driver(&de_driver); |
2176 | } | 2176 | } |
2177 | 2177 | ||
2178 | static void __exit de_exit (void) | 2178 | static void __exit de_exit (void) |
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c index 75ff14a55239..e661d0a9cc64 100644 --- a/drivers/net/tulip/de4x5.c +++ b/drivers/net/tulip/de4x5.c | |||
@@ -5754,7 +5754,7 @@ static int __init de4x5_module_init (void) | |||
5754 | int err = 0; | 5754 | int err = 0; |
5755 | 5755 | ||
5756 | #ifdef CONFIG_PCI | 5756 | #ifdef CONFIG_PCI |
5757 | err = pci_module_init (&de4x5_pci_driver); | 5757 | err = pci_register_driver(&de4x5_pci_driver); |
5758 | #endif | 5758 | #endif |
5759 | #ifdef CONFIG_EISA | 5759 | #ifdef CONFIG_EISA |
5760 | err |= eisa_driver_register (&de4x5_eisa_driver); | 5760 | err |= eisa_driver_register (&de4x5_eisa_driver); |
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index 4e5b0f2acc39..66dade556821 100644 --- a/drivers/net/tulip/dmfe.c +++ b/drivers/net/tulip/dmfe.c | |||
@@ -2039,7 +2039,7 @@ static int __init dmfe_init_module(void) | |||
2039 | if (HPNA_NoiseFloor > 15) | 2039 | if (HPNA_NoiseFloor > 15) |
2040 | HPNA_NoiseFloor = 0; | 2040 | HPNA_NoiseFloor = 0; |
2041 | 2041 | ||
2042 | rc = pci_module_init(&dmfe_driver); | 2042 | rc = pci_register_driver(&dmfe_driver); |
2043 | if (rc < 0) | 2043 | if (rc < 0) |
2044 | return rc; | 2044 | return rc; |
2045 | 2045 | ||
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 7351831f57ce..e1987ec493c2 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -1849,7 +1849,7 @@ static int __init tulip_init (void) | |||
1849 | tulip_max_interrupt_work = max_interrupt_work; | 1849 | tulip_max_interrupt_work = max_interrupt_work; |
1850 | 1850 | ||
1851 | /* probe for and init boards */ | 1851 | /* probe for and init boards */ |
1852 | return pci_module_init (&tulip_driver); | 1852 | return pci_register_driver(&tulip_driver); |
1853 | } | 1853 | } |
1854 | 1854 | ||
1855 | 1855 | ||
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index fd64b2b3e99c..c4c720e2d4c3 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c | |||
@@ -1702,7 +1702,6 @@ MODULE_PARM_DESC(mode, "ULi M5261/M5263: Bit 0: 10/100Mbps, bit 2: duplex, bit 8 | |||
1702 | 1702 | ||
1703 | static int __init uli526x_init_module(void) | 1703 | static int __init uli526x_init_module(void) |
1704 | { | 1704 | { |
1705 | int rc; | ||
1706 | 1705 | ||
1707 | printk(version); | 1706 | printk(version); |
1708 | printed_version = 1; | 1707 | printed_version = 1; |
@@ -1714,22 +1713,19 @@ static int __init uli526x_init_module(void) | |||
1714 | if (cr6set) | 1713 | if (cr6set) |
1715 | uli526x_cr6_user_set = cr6set; | 1714 | uli526x_cr6_user_set = cr6set; |
1716 | 1715 | ||
1717 | switch(mode) { | 1716 | switch (mode) { |
1718 | case ULI526X_10MHF: | 1717 | case ULI526X_10MHF: |
1719 | case ULI526X_100MHF: | 1718 | case ULI526X_100MHF: |
1720 | case ULI526X_10MFD: | 1719 | case ULI526X_10MFD: |
1721 | case ULI526X_100MFD: | 1720 | case ULI526X_100MFD: |
1722 | uli526x_media_mode = mode; | 1721 | uli526x_media_mode = mode; |
1723 | break; | 1722 | break; |
1724 | default:uli526x_media_mode = ULI526X_AUTO; | 1723 | default: |
1724 | uli526x_media_mode = ULI526X_AUTO; | ||
1725 | break; | 1725 | break; |
1726 | } | 1726 | } |
1727 | 1727 | ||
1728 | rc = pci_module_init(&uli526x_driver); | 1728 | return pci_register_driver(&uli526x_driver); |
1729 | if (rc < 0) | ||
1730 | return rc; | ||
1731 | |||
1732 | return 0; | ||
1733 | } | 1729 | } |
1734 | 1730 | ||
1735 | 1731 | ||
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index 7f414815cc62..6b82d1498223 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c | |||
@@ -138,7 +138,7 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; | |||
138 | #include <asm/irq.h> | 138 | #include <asm/irq.h> |
139 | 139 | ||
140 | /* These identify the driver base version and may not be removed. */ | 140 | /* These identify the driver base version and may not be removed. */ |
141 | static char version[] __devinitdata = | 141 | static char version[] = |
142 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " (2.4 port) " DRV_RELDATE " Donald Becker <becker@scyld.com>\n" | 142 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " (2.4 port) " DRV_RELDATE " Donald Becker <becker@scyld.com>\n" |
143 | KERN_INFO " http://www.scyld.com/network/drivers.html\n"; | 143 | KERN_INFO " http://www.scyld.com/network/drivers.html\n"; |
144 | 144 | ||
@@ -1689,7 +1689,7 @@ static struct pci_driver w840_driver = { | |||
1689 | static int __init w840_init(void) | 1689 | static int __init w840_init(void) |
1690 | { | 1690 | { |
1691 | printk(version); | 1691 | printk(version); |
1692 | return pci_module_init(&w840_driver); | 1692 | return pci_register_driver(&w840_driver); |
1693 | } | 1693 | } |
1694 | 1694 | ||
1695 | static void __exit w840_exit(void) | 1695 | static void __exit w840_exit(void) |
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c index f874e4f6ccf6..cf43390d2c80 100644 --- a/drivers/net/tulip/xircom_cb.c +++ b/drivers/net/tulip/xircom_cb.c | |||
@@ -1264,8 +1264,7 @@ static void investigate_write_descriptor(struct net_device *dev, struct xircom_p | |||
1264 | 1264 | ||
1265 | static int __init xircom_init(void) | 1265 | static int __init xircom_init(void) |
1266 | { | 1266 | { |
1267 | pci_register_driver(&xircom_ops); | 1267 | return pci_register_driver(&xircom_ops); |
1268 | return 0; | ||
1269 | } | 1268 | } |
1270 | 1269 | ||
1271 | static void __exit xircom_exit(void) | 1270 | static void __exit xircom_exit(void) |
diff --git a/drivers/net/tulip/xircom_tulip_cb.c b/drivers/net/tulip/xircom_tulip_cb.c index 17ca7dc42e6f..d797b7b2e35f 100644 --- a/drivers/net/tulip/xircom_tulip_cb.c +++ b/drivers/net/tulip/xircom_tulip_cb.c | |||
@@ -1707,7 +1707,7 @@ static int __init xircom_init(void) | |||
1707 | #ifdef MODULE | 1707 | #ifdef MODULE |
1708 | printk(version); | 1708 | printk(version); |
1709 | #endif | 1709 | #endif |
1710 | return pci_module_init(&xircom_driver); | 1710 | return pci_register_driver(&xircom_driver); |
1711 | } | 1711 | } |
1712 | 1712 | ||
1713 | 1713 | ||
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index 4103c37172f9..1014461178cc 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c | |||
@@ -2660,7 +2660,7 @@ static struct pci_driver typhoon_driver = { | |||
2660 | static int __init | 2660 | static int __init |
2661 | typhoon_init(void) | 2661 | typhoon_init(void) |
2662 | { | 2662 | { |
2663 | return pci_module_init(&typhoon_driver); | 2663 | return pci_register_driver(&typhoon_driver); |
2664 | } | 2664 | } |
2665 | 2665 | ||
2666 | static void __exit | 2666 | static void __exit |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c new file mode 100644 index 000000000000..47f49ef72bdc --- /dev/null +++ b/drivers/net/ucc_geth.c | |||
@@ -0,0 +1,4278 @@ | |||
1 | /* | ||
2 | * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved. | ||
3 | * | ||
4 | * Author: Shlomi Gridish <gridish@freescale.com> | ||
5 | * | ||
6 | * Description: | ||
7 | * QE UCC Gigabit Ethernet Driver | ||
8 | * | ||
9 | * Changelog: | ||
10 | * Jul 6, 2006 Li Yang <LeoLi@freescale.com> | ||
11 | * - Rearrange code and style fixes | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License as published by the | ||
15 | * Free Software Foundation; either version 2 of the License, or (at your | ||
16 | * option) any later version. | ||
17 | */ | ||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/errno.h> | ||
21 | #include <linux/slab.h> | ||
22 | #include <linux/stddef.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/netdevice.h> | ||
25 | #include <linux/etherdevice.h> | ||
26 | #include <linux/skbuff.h> | ||
27 | #include <linux/spinlock.h> | ||
28 | #include <linux/mm.h> | ||
29 | #include <linux/ethtool.h> | ||
30 | #include <linux/delay.h> | ||
31 | #include <linux/dma-mapping.h> | ||
32 | #include <linux/fsl_devices.h> | ||
33 | #include <linux/ethtool.h> | ||
34 | #include <linux/platform_device.h> | ||
35 | #include <linux/mii.h> | ||
36 | |||
37 | #include <asm/uaccess.h> | ||
38 | #include <asm/irq.h> | ||
39 | #include <asm/io.h> | ||
40 | #include <asm/immap_qe.h> | ||
41 | #include <asm/qe.h> | ||
42 | #include <asm/ucc.h> | ||
43 | #include <asm/ucc_fast.h> | ||
44 | |||
45 | #include "ucc_geth.h" | ||
46 | #include "ucc_geth_phy.h" | ||
47 | |||
48 | #undef DEBUG | ||
49 | |||
50 | #define DRV_DESC "QE UCC Gigabit Ethernet Controller version:June 20, 2006" | ||
51 | #define DRV_NAME "ucc_geth" | ||
52 | |||
53 | #define ugeth_printk(level, format, arg...) \ | ||
54 | printk(level format "\n", ## arg) | ||
55 | |||
56 | #define ugeth_dbg(format, arg...) \ | ||
57 | ugeth_printk(KERN_DEBUG , format , ## arg) | ||
58 | #define ugeth_err(format, arg...) \ | ||
59 | ugeth_printk(KERN_ERR , format , ## arg) | ||
60 | #define ugeth_info(format, arg...) \ | ||
61 | ugeth_printk(KERN_INFO , format , ## arg) | ||
62 | #define ugeth_warn(format, arg...) \ | ||
63 | ugeth_printk(KERN_WARNING , format , ## arg) | ||
64 | |||
65 | #ifdef UGETH_VERBOSE_DEBUG | ||
66 | #define ugeth_vdbg ugeth_dbg | ||
67 | #else | ||
68 | #define ugeth_vdbg(fmt, args...) do { } while (0) | ||
69 | #endif /* UGETH_VERBOSE_DEBUG */ | ||
70 | |||
71 | static DEFINE_SPINLOCK(ugeth_lock); | ||
72 | |||
73 | static ucc_geth_info_t ugeth_primary_info = { | ||
74 | .uf_info = { | ||
75 | .bd_mem_part = MEM_PART_SYSTEM, | ||
76 | .rtsm = UCC_FAST_SEND_IDLES_BETWEEN_FRAMES, | ||
77 | .max_rx_buf_length = 1536, | ||
78 | /* FIXME: should be changed in run time for 1G and 100M */ | ||
79 | #ifdef CONFIG_UGETH_HAS_GIGA | ||
80 | .urfs = UCC_GETH_URFS_GIGA_INIT, | ||
81 | .urfet = UCC_GETH_URFET_GIGA_INIT, | ||
82 | .urfset = UCC_GETH_URFSET_GIGA_INIT, | ||
83 | .utfs = UCC_GETH_UTFS_GIGA_INIT, | ||
84 | .utfet = UCC_GETH_UTFET_GIGA_INIT, | ||
85 | .utftt = UCC_GETH_UTFTT_GIGA_INIT, | ||
86 | #else | ||
87 | .urfs = UCC_GETH_URFS_INIT, | ||
88 | .urfet = UCC_GETH_URFET_INIT, | ||
89 | .urfset = UCC_GETH_URFSET_INIT, | ||
90 | .utfs = UCC_GETH_UTFS_INIT, | ||
91 | .utfet = UCC_GETH_UTFET_INIT, | ||
92 | .utftt = UCC_GETH_UTFTT_INIT, | ||
93 | #endif | ||
94 | .ufpt = 256, | ||
95 | .mode = UCC_FAST_PROTOCOL_MODE_ETHERNET, | ||
96 | .ttx_trx = UCC_FAST_GUMR_TRANSPARENT_TTX_TRX_NORMAL, | ||
97 | .tenc = UCC_FAST_TX_ENCODING_NRZ, | ||
98 | .renc = UCC_FAST_RX_ENCODING_NRZ, | ||
99 | .tcrc = UCC_FAST_16_BIT_CRC, | ||
100 | .synl = UCC_FAST_SYNC_LEN_NOT_USED, | ||
101 | }, | ||
102 | .numQueuesTx = 1, | ||
103 | .numQueuesRx = 1, | ||
104 | .extendedFilteringChainPointer = ((uint32_t) NULL), | ||
105 | .typeorlen = 3072 /*1536 */ , | ||
106 | .nonBackToBackIfgPart1 = 0x40, | ||
107 | .nonBackToBackIfgPart2 = 0x60, | ||
108 | .miminumInterFrameGapEnforcement = 0x50, | ||
109 | .backToBackInterFrameGap = 0x60, | ||
110 | .mblinterval = 128, | ||
111 | .nortsrbytetime = 5, | ||
112 | .fracsiz = 1, | ||
113 | .strictpriorityq = 0xff, | ||
114 | .altBebTruncation = 0xa, | ||
115 | .excessDefer = 1, | ||
116 | .maxRetransmission = 0xf, | ||
117 | .collisionWindow = 0x37, | ||
118 | .receiveFlowControl = 1, | ||
119 | .maxGroupAddrInHash = 4, | ||
120 | .maxIndAddrInHash = 4, | ||
121 | .prel = 7, | ||
122 | .maxFrameLength = 1518, | ||
123 | .minFrameLength = 64, | ||
124 | .maxD1Length = 1520, | ||
125 | .maxD2Length = 1520, | ||
126 | .vlantype = 0x8100, | ||
127 | .ecamptr = ((uint32_t) NULL), | ||
128 | .eventRegMask = UCCE_OTHER, | ||
129 | .pausePeriod = 0xf000, | ||
130 | .interruptcoalescingmaxvalue = {1, 1, 1, 1, 1, 1, 1, 1}, | ||
131 | .bdRingLenTx = { | ||
132 | TX_BD_RING_LEN, | ||
133 | TX_BD_RING_LEN, | ||
134 | TX_BD_RING_LEN, | ||
135 | TX_BD_RING_LEN, | ||
136 | TX_BD_RING_LEN, | ||
137 | TX_BD_RING_LEN, | ||
138 | TX_BD_RING_LEN, | ||
139 | TX_BD_RING_LEN}, | ||
140 | |||
141 | .bdRingLenRx = { | ||
142 | RX_BD_RING_LEN, | ||
143 | RX_BD_RING_LEN, | ||
144 | RX_BD_RING_LEN, | ||
145 | RX_BD_RING_LEN, | ||
146 | RX_BD_RING_LEN, | ||
147 | RX_BD_RING_LEN, | ||
148 | RX_BD_RING_LEN, | ||
149 | RX_BD_RING_LEN}, | ||
150 | |||
151 | .numStationAddresses = UCC_GETH_NUM_OF_STATION_ADDRESSES_1, | ||
152 | .largestexternallookupkeysize = | ||
153 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE, | ||
154 | .statisticsMode = UCC_GETH_STATISTICS_GATHERING_MODE_NONE, | ||
155 | .vlanOperationTagged = UCC_GETH_VLAN_OPERATION_TAGGED_NOP, | ||
156 | .vlanOperationNonTagged = UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP, | ||
157 | .rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT, | ||
158 | .aufc = UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_NONE, | ||
159 | .padAndCrc = MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC, | ||
160 | .numThreadsTx = UCC_GETH_NUM_OF_THREADS_4, | ||
161 | .numThreadsRx = UCC_GETH_NUM_OF_THREADS_4, | ||
162 | .riscTx = QE_RISC_ALLOCATION_RISC1_AND_RISC2, | ||
163 | .riscRx = QE_RISC_ALLOCATION_RISC1_AND_RISC2, | ||
164 | }; | ||
165 | |||
166 | static ucc_geth_info_t ugeth_info[8]; | ||
167 | |||
168 | #ifdef DEBUG | ||
169 | static void mem_disp(u8 *addr, int size) | ||
170 | { | ||
171 | u8 *i; | ||
172 | int size16Aling = (size >> 4) << 4; | ||
173 | int size4Aling = (size >> 2) << 2; | ||
174 | int notAlign = 0; | ||
175 | if (size % 16) | ||
176 | notAlign = 1; | ||
177 | |||
178 | for (i = addr; (u32) i < (u32) addr + size16Aling; i += 16) | ||
179 | printk("0x%08x: %08x %08x %08x %08x\r\n", | ||
180 | (u32) i, | ||
181 | *((u32 *) (i)), | ||
182 | *((u32 *) (i + 4)), | ||
183 | *((u32 *) (i + 8)), *((u32 *) (i + 12))); | ||
184 | if (notAlign == 1) | ||
185 | printk("0x%08x: ", (u32) i); | ||
186 | for (; (u32) i < (u32) addr + size4Aling; i += 4) | ||
187 | printk("%08x ", *((u32 *) (i))); | ||
188 | for (; (u32) i < (u32) addr + size; i++) | ||
189 | printk("%02x", *((u8 *) (i))); | ||
190 | if (notAlign == 1) | ||
191 | printk("\r\n"); | ||
192 | } | ||
193 | #endif /* DEBUG */ | ||
194 | |||
195 | #ifdef CONFIG_UGETH_FILTERING | ||
196 | static void enqueue(struct list_head *node, struct list_head *lh) | ||
197 | { | ||
198 | unsigned long flags; | ||
199 | |||
200 | spin_lock_irqsave(ugeth_lock, flags); | ||
201 | list_add_tail(node, lh); | ||
202 | spin_unlock_irqrestore(ugeth_lock, flags); | ||
203 | } | ||
204 | #endif /* CONFIG_UGETH_FILTERING */ | ||
205 | |||
206 | static struct list_head *dequeue(struct list_head *lh) | ||
207 | { | ||
208 | unsigned long flags; | ||
209 | |||
210 | spin_lock_irqsave(ugeth_lock, flags); | ||
211 | if (!list_empty(lh)) { | ||
212 | struct list_head *node = lh->next; | ||
213 | list_del(node); | ||
214 | spin_unlock_irqrestore(ugeth_lock, flags); | ||
215 | return node; | ||
216 | } else { | ||
217 | spin_unlock_irqrestore(ugeth_lock, flags); | ||
218 | return NULL; | ||
219 | } | ||
220 | } | ||
221 | |||
222 | static int get_interface_details(enet_interface_e enet_interface, | ||
223 | enet_speed_e *speed, | ||
224 | int *r10m, | ||
225 | int *rmm, | ||
226 | int *rpm, | ||
227 | int *tbi, int *limited_to_full_duplex) | ||
228 | { | ||
229 | /* Analyze enet_interface according to Interface Mode | ||
230 | Configuration table */ | ||
231 | switch (enet_interface) { | ||
232 | case ENET_10_MII: | ||
233 | *speed = ENET_SPEED_10BT; | ||
234 | break; | ||
235 | case ENET_10_RMII: | ||
236 | *speed = ENET_SPEED_10BT; | ||
237 | *r10m = 1; | ||
238 | *rmm = 1; | ||
239 | break; | ||
240 | case ENET_10_RGMII: | ||
241 | *speed = ENET_SPEED_10BT; | ||
242 | *rpm = 1; | ||
243 | *r10m = 1; | ||
244 | *limited_to_full_duplex = 1; | ||
245 | break; | ||
246 | case ENET_100_MII: | ||
247 | *speed = ENET_SPEED_100BT; | ||
248 | break; | ||
249 | case ENET_100_RMII: | ||
250 | *speed = ENET_SPEED_100BT; | ||
251 | *rmm = 1; | ||
252 | break; | ||
253 | case ENET_100_RGMII: | ||
254 | *speed = ENET_SPEED_100BT; | ||
255 | *rpm = 1; | ||
256 | *limited_to_full_duplex = 1; | ||
257 | break; | ||
258 | case ENET_1000_GMII: | ||
259 | *speed = ENET_SPEED_1000BT; | ||
260 | *limited_to_full_duplex = 1; | ||
261 | break; | ||
262 | case ENET_1000_RGMII: | ||
263 | *speed = ENET_SPEED_1000BT; | ||
264 | *rpm = 1; | ||
265 | *limited_to_full_duplex = 1; | ||
266 | break; | ||
267 | case ENET_1000_TBI: | ||
268 | *speed = ENET_SPEED_1000BT; | ||
269 | *tbi = 1; | ||
270 | *limited_to_full_duplex = 1; | ||
271 | break; | ||
272 | case ENET_1000_RTBI: | ||
273 | *speed = ENET_SPEED_1000BT; | ||
274 | *rpm = 1; | ||
275 | *tbi = 1; | ||
276 | *limited_to_full_duplex = 1; | ||
277 | break; | ||
278 | default: | ||
279 | return -EINVAL; | ||
280 | break; | ||
281 | } | ||
282 | |||
283 | return 0; | ||
284 | } | ||
285 | |||
286 | static struct sk_buff *get_new_skb(ucc_geth_private_t *ugeth, u8 *bd) | ||
287 | { | ||
288 | struct sk_buff *skb = NULL; | ||
289 | |||
290 | skb = dev_alloc_skb(ugeth->ug_info->uf_info.max_rx_buf_length + | ||
291 | UCC_GETH_RX_DATA_BUF_ALIGNMENT); | ||
292 | |||
293 | if (skb == NULL) | ||
294 | return NULL; | ||
295 | |||
296 | /* We need the data buffer to be aligned properly. We will reserve | ||
297 | * as many bytes as needed to align the data properly | ||
298 | */ | ||
299 | skb_reserve(skb, | ||
300 | UCC_GETH_RX_DATA_BUF_ALIGNMENT - | ||
301 | (((unsigned)skb->data) & (UCC_GETH_RX_DATA_BUF_ALIGNMENT - | ||
302 | 1))); | ||
303 | |||
304 | skb->dev = ugeth->dev; | ||
305 | |||
306 | BD_BUFFER_SET(bd, | ||
307 | dma_map_single(NULL, | ||
308 | skb->data, | ||
309 | ugeth->ug_info->uf_info.max_rx_buf_length + | ||
310 | UCC_GETH_RX_DATA_BUF_ALIGNMENT, | ||
311 | DMA_FROM_DEVICE)); | ||
312 | |||
313 | BD_STATUS_AND_LENGTH_SET(bd, | ||
314 | (R_E | R_I | | ||
315 | (BD_STATUS_AND_LENGTH(bd) & R_W))); | ||
316 | |||
317 | return skb; | ||
318 | } | ||
319 | |||
320 | static int rx_bd_buffer_set(ucc_geth_private_t *ugeth, u8 rxQ) | ||
321 | { | ||
322 | u8 *bd; | ||
323 | u32 bd_status; | ||
324 | struct sk_buff *skb; | ||
325 | int i; | ||
326 | |||
327 | bd = ugeth->p_rx_bd_ring[rxQ]; | ||
328 | i = 0; | ||
329 | |||
330 | do { | ||
331 | bd_status = BD_STATUS_AND_LENGTH(bd); | ||
332 | skb = get_new_skb(ugeth, bd); | ||
333 | |||
334 | if (!skb) /* If can not allocate data buffer, | ||
335 | abort. Cleanup will be elsewhere */ | ||
336 | return -ENOMEM; | ||
337 | |||
338 | ugeth->rx_skbuff[rxQ][i] = skb; | ||
339 | |||
340 | /* advance the BD pointer */ | ||
341 | bd += UCC_GETH_SIZE_OF_BD; | ||
342 | i++; | ||
343 | } while (!(bd_status & R_W)); | ||
344 | |||
345 | return 0; | ||
346 | } | ||
347 | |||
348 | static int fill_init_enet_entries(ucc_geth_private_t *ugeth, | ||
349 | volatile u32 *p_start, | ||
350 | u8 num_entries, | ||
351 | u32 thread_size, | ||
352 | u32 thread_alignment, | ||
353 | qe_risc_allocation_e risc, | ||
354 | int skip_page_for_first_entry) | ||
355 | { | ||
356 | u32 init_enet_offset; | ||
357 | u8 i; | ||
358 | int snum; | ||
359 | |||
360 | for (i = 0; i < num_entries; i++) { | ||
361 | if ((snum = qe_get_snum()) < 0) { | ||
362 | ugeth_err("fill_init_enet_entries: Can not get SNUM."); | ||
363 | return snum; | ||
364 | } | ||
365 | if ((i == 0) && skip_page_for_first_entry) | ||
366 | /* First entry of Rx does not have page */ | ||
367 | init_enet_offset = 0; | ||
368 | else { | ||
369 | init_enet_offset = | ||
370 | qe_muram_alloc(thread_size, thread_alignment); | ||
371 | if (IS_MURAM_ERR(init_enet_offset)) { | ||
372 | ugeth_err | ||
373 | ("fill_init_enet_entries: Can not allocate DPRAM memory."); | ||
374 | qe_put_snum((u8) snum); | ||
375 | return -ENOMEM; | ||
376 | } | ||
377 | } | ||
378 | *(p_start++) = | ||
379 | ((u8) snum << ENET_INIT_PARAM_SNUM_SHIFT) | init_enet_offset | ||
380 | | risc; | ||
381 | } | ||
382 | |||
383 | return 0; | ||
384 | } | ||
385 | |||
386 | static int return_init_enet_entries(ucc_geth_private_t *ugeth, | ||
387 | volatile u32 *p_start, | ||
388 | u8 num_entries, | ||
389 | qe_risc_allocation_e risc, | ||
390 | int skip_page_for_first_entry) | ||
391 | { | ||
392 | u32 init_enet_offset; | ||
393 | u8 i; | ||
394 | int snum; | ||
395 | |||
396 | for (i = 0; i < num_entries; i++) { | ||
397 | /* Check that this entry was actually valid -- | ||
398 | needed in case failed in allocations */ | ||
399 | if ((*p_start & ENET_INIT_PARAM_RISC_MASK) == risc) { | ||
400 | snum = | ||
401 | (u32) (*p_start & ENET_INIT_PARAM_SNUM_MASK) >> | ||
402 | ENET_INIT_PARAM_SNUM_SHIFT; | ||
403 | qe_put_snum((u8) snum); | ||
404 | if (!((i == 0) && skip_page_for_first_entry)) { | ||
405 | /* First entry of Rx does not have page */ | ||
406 | init_enet_offset = | ||
407 | (in_be32(p_start) & | ||
408 | ENET_INIT_PARAM_PTR_MASK); | ||
409 | qe_muram_free(init_enet_offset); | ||
410 | } | ||
411 | *(p_start++) = 0; /* Just for cosmetics */ | ||
412 | } | ||
413 | } | ||
414 | |||
415 | return 0; | ||
416 | } | ||
417 | |||
418 | #ifdef DEBUG | ||
419 | static int dump_init_enet_entries(ucc_geth_private_t *ugeth, | ||
420 | volatile u32 *p_start, | ||
421 | u8 num_entries, | ||
422 | u32 thread_size, | ||
423 | qe_risc_allocation_e risc, | ||
424 | int skip_page_for_first_entry) | ||
425 | { | ||
426 | u32 init_enet_offset; | ||
427 | u8 i; | ||
428 | int snum; | ||
429 | |||
430 | for (i = 0; i < num_entries; i++) { | ||
431 | /* Check that this entry was actually valid -- | ||
432 | needed in case failed in allocations */ | ||
433 | if ((*p_start & ENET_INIT_PARAM_RISC_MASK) == risc) { | ||
434 | snum = | ||
435 | (u32) (*p_start & ENET_INIT_PARAM_SNUM_MASK) >> | ||
436 | ENET_INIT_PARAM_SNUM_SHIFT; | ||
437 | qe_put_snum((u8) snum); | ||
438 | if (!((i == 0) && skip_page_for_first_entry)) { | ||
439 | /* First entry of Rx does not have page */ | ||
440 | init_enet_offset = | ||
441 | (in_be32(p_start) & | ||
442 | ENET_INIT_PARAM_PTR_MASK); | ||
443 | ugeth_info("Init enet entry %d:", i); | ||
444 | ugeth_info("Base address: 0x%08x", | ||
445 | (u32) | ||
446 | qe_muram_addr(init_enet_offset)); | ||
447 | mem_disp(qe_muram_addr(init_enet_offset), | ||
448 | thread_size); | ||
449 | } | ||
450 | p_start++; | ||
451 | } | ||
452 | } | ||
453 | |||
454 | return 0; | ||
455 | } | ||
456 | #endif | ||
457 | |||
458 | #ifdef CONFIG_UGETH_FILTERING | ||
459 | static enet_addr_container_t *get_enet_addr_container(void) | ||
460 | { | ||
461 | enet_addr_container_t *enet_addr_cont; | ||
462 | |||
463 | /* allocate memory */ | ||
464 | enet_addr_cont = kmalloc(sizeof(enet_addr_container_t), GFP_KERNEL); | ||
465 | if (!enet_addr_cont) { | ||
466 | ugeth_err("%s: No memory for enet_addr_container_t object.", | ||
467 | __FUNCTION__); | ||
468 | return NULL; | ||
469 | } | ||
470 | |||
471 | return enet_addr_cont; | ||
472 | } | ||
473 | #endif /* CONFIG_UGETH_FILTERING */ | ||
474 | |||
475 | static void put_enet_addr_container(enet_addr_container_t *enet_addr_cont) | ||
476 | { | ||
477 | kfree(enet_addr_cont); | ||
478 | } | ||
479 | |||
480 | #ifdef CONFIG_UGETH_FILTERING | ||
481 | static int hw_add_addr_in_paddr(ucc_geth_private_t *ugeth, | ||
482 | enet_addr_t *p_enet_addr, u8 paddr_num) | ||
483 | { | ||
484 | ucc_geth_82xx_address_filtering_pram_t *p_82xx_addr_filt; | ||
485 | |||
486 | if (!(paddr_num < NUM_OF_PADDRS)) { | ||
487 | ugeth_warn("%s: Illagel paddr_num.", __FUNCTION__); | ||
488 | return -EINVAL; | ||
489 | } | ||
490 | |||
491 | p_82xx_addr_filt = | ||
492 | (ucc_geth_82xx_address_filtering_pram_t *) ugeth->p_rx_glbl_pram-> | ||
493 | addressfiltering; | ||
494 | |||
495 | /* Ethernet frames are defined in Little Endian mode, */ | ||
496 | /* therefore to insert the address we reverse the bytes. */ | ||
497 | out_be16(&p_82xx_addr_filt->paddr[paddr_num].h, | ||
498 | (u16) (((u16) (((u16) ((*p_enet_addr)[5])) << 8)) | | ||
499 | (u16) (*p_enet_addr)[4])); | ||
500 | out_be16(&p_82xx_addr_filt->paddr[paddr_num].m, | ||
501 | (u16) (((u16) (((u16) ((*p_enet_addr)[3])) << 8)) | | ||
502 | (u16) (*p_enet_addr)[2])); | ||
503 | out_be16(&p_82xx_addr_filt->paddr[paddr_num].l, | ||
504 | (u16) (((u16) (((u16) ((*p_enet_addr)[1])) << 8)) | | ||
505 | (u16) (*p_enet_addr)[0])); | ||
506 | |||
507 | return 0; | ||
508 | } | ||
509 | #endif /* CONFIG_UGETH_FILTERING */ | ||
510 | |||
511 | static int hw_clear_addr_in_paddr(ucc_geth_private_t *ugeth, u8 paddr_num) | ||
512 | { | ||
513 | ucc_geth_82xx_address_filtering_pram_t *p_82xx_addr_filt; | ||
514 | |||
515 | if (!(paddr_num < NUM_OF_PADDRS)) { | ||
516 | ugeth_warn("%s: Illagel paddr_num.", __FUNCTION__); | ||
517 | return -EINVAL; | ||
518 | } | ||
519 | |||
520 | p_82xx_addr_filt = | ||
521 | (ucc_geth_82xx_address_filtering_pram_t *) ugeth->p_rx_glbl_pram-> | ||
522 | addressfiltering; | ||
523 | |||
524 | /* Writing address ff.ff.ff.ff.ff.ff disables address | ||
525 | recognition for this register */ | ||
526 | out_be16(&p_82xx_addr_filt->paddr[paddr_num].h, 0xffff); | ||
527 | out_be16(&p_82xx_addr_filt->paddr[paddr_num].m, 0xffff); | ||
528 | out_be16(&p_82xx_addr_filt->paddr[paddr_num].l, 0xffff); | ||
529 | |||
530 | return 0; | ||
531 | } | ||
532 | |||
533 | static void hw_add_addr_in_hash(ucc_geth_private_t *ugeth, | ||
534 | enet_addr_t *p_enet_addr) | ||
535 | { | ||
536 | ucc_geth_82xx_address_filtering_pram_t *p_82xx_addr_filt; | ||
537 | u32 cecr_subblock; | ||
538 | |||
539 | p_82xx_addr_filt = | ||
540 | (ucc_geth_82xx_address_filtering_pram_t *) ugeth->p_rx_glbl_pram-> | ||
541 | addressfiltering; | ||
542 | |||
543 | cecr_subblock = | ||
544 | ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num); | ||
545 | |||
546 | /* Ethernet frames are defined in Little Endian mode, | ||
547 | therefor to insert */ | ||
548 | /* the address to the hash (Big Endian mode), we reverse the bytes.*/ | ||
549 | out_be16(&p_82xx_addr_filt->taddr.h, | ||
550 | (u16) (((u16) (((u16) ((*p_enet_addr)[5])) << 8)) | | ||
551 | (u16) (*p_enet_addr)[4])); | ||
552 | out_be16(&p_82xx_addr_filt->taddr.m, | ||
553 | (u16) (((u16) (((u16) ((*p_enet_addr)[3])) << 8)) | | ||
554 | (u16) (*p_enet_addr)[2])); | ||
555 | out_be16(&p_82xx_addr_filt->taddr.l, | ||
556 | (u16) (((u16) (((u16) ((*p_enet_addr)[1])) << 8)) | | ||
557 | (u16) (*p_enet_addr)[0])); | ||
558 | |||
559 | qe_issue_cmd(QE_SET_GROUP_ADDRESS, cecr_subblock, | ||
560 | (u8) QE_CR_PROTOCOL_ETHERNET, 0); | ||
561 | } | ||
562 | |||
563 | #ifdef CONFIG_UGETH_MAGIC_PACKET | ||
564 | static void magic_packet_detection_enable(ucc_geth_private_t *ugeth) | ||
565 | { | ||
566 | ucc_fast_private_t *uccf; | ||
567 | ucc_geth_t *ug_regs; | ||
568 | u32 maccfg2, uccm; | ||
569 | |||
570 | uccf = ugeth->uccf; | ||
571 | ug_regs = ugeth->ug_regs; | ||
572 | |||
573 | /* Enable interrupts for magic packet detection */ | ||
574 | uccm = in_be32(uccf->p_uccm); | ||
575 | uccm |= UCCE_MPD; | ||
576 | out_be32(uccf->p_uccm, uccm); | ||
577 | |||
578 | /* Enable magic packet detection */ | ||
579 | maccfg2 = in_be32(&ug_regs->maccfg2); | ||
580 | maccfg2 |= MACCFG2_MPE; | ||
581 | out_be32(&ug_regs->maccfg2, maccfg2); | ||
582 | } | ||
583 | |||
584 | static void magic_packet_detection_disable(ucc_geth_private_t *ugeth) | ||
585 | { | ||
586 | ucc_fast_private_t *uccf; | ||
587 | ucc_geth_t *ug_regs; | ||
588 | u32 maccfg2, uccm; | ||
589 | |||
590 | uccf = ugeth->uccf; | ||
591 | ug_regs = ugeth->ug_regs; | ||
592 | |||
593 | /* Disable interrupts for magic packet detection */ | ||
594 | uccm = in_be32(uccf->p_uccm); | ||
595 | uccm &= ~UCCE_MPD; | ||
596 | out_be32(uccf->p_uccm, uccm); | ||
597 | |||
598 | /* Disable magic packet detection */ | ||
599 | maccfg2 = in_be32(&ug_regs->maccfg2); | ||
600 | maccfg2 &= ~MACCFG2_MPE; | ||
601 | out_be32(&ug_regs->maccfg2, maccfg2); | ||
602 | } | ||
603 | #endif /* MAGIC_PACKET */ | ||
604 | |||
605 | static inline int compare_addr(enet_addr_t *addr1, enet_addr_t *addr2) | ||
606 | { | ||
607 | return memcmp(addr1, addr2, ENET_NUM_OCTETS_PER_ADDRESS); | ||
608 | } | ||
609 | |||
610 | #ifdef DEBUG | ||
611 | static void get_statistics(ucc_geth_private_t *ugeth, | ||
612 | ucc_geth_tx_firmware_statistics_t * | ||
613 | tx_firmware_statistics, | ||
614 | ucc_geth_rx_firmware_statistics_t * | ||
615 | rx_firmware_statistics, | ||
616 | ucc_geth_hardware_statistics_t *hardware_statistics) | ||
617 | { | ||
618 | ucc_fast_t *uf_regs; | ||
619 | ucc_geth_t *ug_regs; | ||
620 | ucc_geth_tx_firmware_statistics_pram_t *p_tx_fw_statistics_pram; | ||
621 | ucc_geth_rx_firmware_statistics_pram_t *p_rx_fw_statistics_pram; | ||
622 | |||
623 | ug_regs = ugeth->ug_regs; | ||
624 | uf_regs = (ucc_fast_t *) ug_regs; | ||
625 | p_tx_fw_statistics_pram = ugeth->p_tx_fw_statistics_pram; | ||
626 | p_rx_fw_statistics_pram = ugeth->p_rx_fw_statistics_pram; | ||
627 | |||
628 | /* Tx firmware only if user handed pointer and driver actually | ||
629 | gathers Tx firmware statistics */ | ||
630 | if (tx_firmware_statistics && p_tx_fw_statistics_pram) { | ||
631 | tx_firmware_statistics->sicoltx = | ||
632 | in_be32(&p_tx_fw_statistics_pram->sicoltx); | ||
633 | tx_firmware_statistics->mulcoltx = | ||
634 | in_be32(&p_tx_fw_statistics_pram->mulcoltx); | ||
635 | tx_firmware_statistics->latecoltxfr = | ||
636 | in_be32(&p_tx_fw_statistics_pram->latecoltxfr); | ||
637 | tx_firmware_statistics->frabortduecol = | ||
638 | in_be32(&p_tx_fw_statistics_pram->frabortduecol); | ||
639 | tx_firmware_statistics->frlostinmactxer = | ||
640 | in_be32(&p_tx_fw_statistics_pram->frlostinmactxer); | ||
641 | tx_firmware_statistics->carriersenseertx = | ||
642 | in_be32(&p_tx_fw_statistics_pram->carriersenseertx); | ||
643 | tx_firmware_statistics->frtxok = | ||
644 | in_be32(&p_tx_fw_statistics_pram->frtxok); | ||
645 | tx_firmware_statistics->txfrexcessivedefer = | ||
646 | in_be32(&p_tx_fw_statistics_pram->txfrexcessivedefer); | ||
647 | tx_firmware_statistics->txpkts256 = | ||
648 | in_be32(&p_tx_fw_statistics_pram->txpkts256); | ||
649 | tx_firmware_statistics->txpkts512 = | ||
650 | in_be32(&p_tx_fw_statistics_pram->txpkts512); | ||
651 | tx_firmware_statistics->txpkts1024 = | ||
652 | in_be32(&p_tx_fw_statistics_pram->txpkts1024); | ||
653 | tx_firmware_statistics->txpktsjumbo = | ||
654 | in_be32(&p_tx_fw_statistics_pram->txpktsjumbo); | ||
655 | } | ||
656 | |||
657 | /* Rx firmware only if user handed pointer and driver actually | ||
658 | * gathers Rx firmware statistics */ | ||
659 | if (rx_firmware_statistics && p_rx_fw_statistics_pram) { | ||
660 | int i; | ||
661 | rx_firmware_statistics->frrxfcser = | ||
662 | in_be32(&p_rx_fw_statistics_pram->frrxfcser); | ||
663 | rx_firmware_statistics->fraligner = | ||
664 | in_be32(&p_rx_fw_statistics_pram->fraligner); | ||
665 | rx_firmware_statistics->inrangelenrxer = | ||
666 | in_be32(&p_rx_fw_statistics_pram->inrangelenrxer); | ||
667 | rx_firmware_statistics->outrangelenrxer = | ||
668 | in_be32(&p_rx_fw_statistics_pram->outrangelenrxer); | ||
669 | rx_firmware_statistics->frtoolong = | ||
670 | in_be32(&p_rx_fw_statistics_pram->frtoolong); | ||
671 | rx_firmware_statistics->runt = | ||
672 | in_be32(&p_rx_fw_statistics_pram->runt); | ||
673 | rx_firmware_statistics->verylongevent = | ||
674 | in_be32(&p_rx_fw_statistics_pram->verylongevent); | ||
675 | rx_firmware_statistics->symbolerror = | ||
676 | in_be32(&p_rx_fw_statistics_pram->symbolerror); | ||
677 | rx_firmware_statistics->dropbsy = | ||
678 | in_be32(&p_rx_fw_statistics_pram->dropbsy); | ||
679 | for (i = 0; i < 0x8; i++) | ||
680 | rx_firmware_statistics->res0[i] = | ||
681 | p_rx_fw_statistics_pram->res0[i]; | ||
682 | rx_firmware_statistics->mismatchdrop = | ||
683 | in_be32(&p_rx_fw_statistics_pram->mismatchdrop); | ||
684 | rx_firmware_statistics->underpkts = | ||
685 | in_be32(&p_rx_fw_statistics_pram->underpkts); | ||
686 | rx_firmware_statistics->pkts256 = | ||
687 | in_be32(&p_rx_fw_statistics_pram->pkts256); | ||
688 | rx_firmware_statistics->pkts512 = | ||
689 | in_be32(&p_rx_fw_statistics_pram->pkts512); | ||
690 | rx_firmware_statistics->pkts1024 = | ||
691 | in_be32(&p_rx_fw_statistics_pram->pkts1024); | ||
692 | rx_firmware_statistics->pktsjumbo = | ||
693 | in_be32(&p_rx_fw_statistics_pram->pktsjumbo); | ||
694 | rx_firmware_statistics->frlossinmacer = | ||
695 | in_be32(&p_rx_fw_statistics_pram->frlossinmacer); | ||
696 | rx_firmware_statistics->pausefr = | ||
697 | in_be32(&p_rx_fw_statistics_pram->pausefr); | ||
698 | for (i = 0; i < 0x4; i++) | ||
699 | rx_firmware_statistics->res1[i] = | ||
700 | p_rx_fw_statistics_pram->res1[i]; | ||
701 | rx_firmware_statistics->removevlan = | ||
702 | in_be32(&p_rx_fw_statistics_pram->removevlan); | ||
703 | rx_firmware_statistics->replacevlan = | ||
704 | in_be32(&p_rx_fw_statistics_pram->replacevlan); | ||
705 | rx_firmware_statistics->insertvlan = | ||
706 | in_be32(&p_rx_fw_statistics_pram->insertvlan); | ||
707 | } | ||
708 | |||
709 | /* Hardware only if user handed pointer and driver actually | ||
710 | gathers hardware statistics */ | ||
711 | if (hardware_statistics && (in_be32(&uf_regs->upsmr) & UPSMR_HSE)) { | ||
712 | hardware_statistics->tx64 = in_be32(&ug_regs->tx64); | ||
713 | hardware_statistics->tx127 = in_be32(&ug_regs->tx127); | ||
714 | hardware_statistics->tx255 = in_be32(&ug_regs->tx255); | ||
715 | hardware_statistics->rx64 = in_be32(&ug_regs->rx64); | ||
716 | hardware_statistics->rx127 = in_be32(&ug_regs->rx127); | ||
717 | hardware_statistics->rx255 = in_be32(&ug_regs->rx255); | ||
718 | hardware_statistics->txok = in_be32(&ug_regs->txok); | ||
719 | hardware_statistics->txcf = in_be16(&ug_regs->txcf); | ||
720 | hardware_statistics->tmca = in_be32(&ug_regs->tmca); | ||
721 | hardware_statistics->tbca = in_be32(&ug_regs->tbca); | ||
722 | hardware_statistics->rxfok = in_be32(&ug_regs->rxfok); | ||
723 | hardware_statistics->rxbok = in_be32(&ug_regs->rxbok); | ||
724 | hardware_statistics->rbyt = in_be32(&ug_regs->rbyt); | ||
725 | hardware_statistics->rmca = in_be32(&ug_regs->rmca); | ||
726 | hardware_statistics->rbca = in_be32(&ug_regs->rbca); | ||
727 | } | ||
728 | } | ||
729 | |||
730 | static void dump_bds(ucc_geth_private_t *ugeth) | ||
731 | { | ||
732 | int i; | ||
733 | int length; | ||
734 | |||
735 | for (i = 0; i < ugeth->ug_info->numQueuesTx; i++) { | ||
736 | if (ugeth->p_tx_bd_ring[i]) { | ||
737 | length = | ||
738 | (ugeth->ug_info->bdRingLenTx[i] * | ||
739 | UCC_GETH_SIZE_OF_BD); | ||
740 | ugeth_info("TX BDs[%d]", i); | ||
741 | mem_disp(ugeth->p_tx_bd_ring[i], length); | ||
742 | } | ||
743 | } | ||
744 | for (i = 0; i < ugeth->ug_info->numQueuesRx; i++) { | ||
745 | if (ugeth->p_rx_bd_ring[i]) { | ||
746 | length = | ||
747 | (ugeth->ug_info->bdRingLenRx[i] * | ||
748 | UCC_GETH_SIZE_OF_BD); | ||
749 | ugeth_info("RX BDs[%d]", i); | ||
750 | mem_disp(ugeth->p_rx_bd_ring[i], length); | ||
751 | } | ||
752 | } | ||
753 | } | ||
754 | |||
755 | static void dump_regs(ucc_geth_private_t *ugeth) | ||
756 | { | ||
757 | int i; | ||
758 | |||
759 | ugeth_info("UCC%d Geth registers:", ugeth->ug_info->uf_info.ucc_num); | ||
760 | ugeth_info("Base address: 0x%08x", (u32) ugeth->ug_regs); | ||
761 | |||
762 | ugeth_info("maccfg1 : addr - 0x%08x, val - 0x%08x", | ||
763 | (u32) & ugeth->ug_regs->maccfg1, | ||
764 | in_be32(&ugeth->ug_regs->maccfg1)); | ||
765 | ugeth_info("maccfg2 : addr - 0x%08x, val - 0x%08x", | ||
766 | (u32) & ugeth->ug_regs->maccfg2, | ||
767 | in_be32(&ugeth->ug_regs->maccfg2)); | ||
768 | ugeth_info("ipgifg : addr - 0x%08x, val - 0x%08x", | ||
769 | (u32) & ugeth->ug_regs->ipgifg, | ||
770 | in_be32(&ugeth->ug_regs->ipgifg)); | ||
771 | ugeth_info("hafdup : addr - 0x%08x, val - 0x%08x", | ||
772 | (u32) & ugeth->ug_regs->hafdup, | ||
773 | in_be32(&ugeth->ug_regs->hafdup)); | ||
774 | ugeth_info("miimcfg : addr - 0x%08x, val - 0x%08x", | ||
775 | (u32) & ugeth->ug_regs->miimng.miimcfg, | ||
776 | in_be32(&ugeth->ug_regs->miimng.miimcfg)); | ||
777 | ugeth_info("miimcom : addr - 0x%08x, val - 0x%08x", | ||
778 | (u32) & ugeth->ug_regs->miimng.miimcom, | ||
779 | in_be32(&ugeth->ug_regs->miimng.miimcom)); | ||
780 | ugeth_info("miimadd : addr - 0x%08x, val - 0x%08x", | ||
781 | (u32) & ugeth->ug_regs->miimng.miimadd, | ||
782 | in_be32(&ugeth->ug_regs->miimng.miimadd)); | ||
783 | ugeth_info("miimcon : addr - 0x%08x, val - 0x%08x", | ||
784 | (u32) & ugeth->ug_regs->miimng.miimcon, | ||
785 | in_be32(&ugeth->ug_regs->miimng.miimcon)); | ||
786 | ugeth_info("miimstat : addr - 0x%08x, val - 0x%08x", | ||
787 | (u32) & ugeth->ug_regs->miimng.miimstat, | ||
788 | in_be32(&ugeth->ug_regs->miimng.miimstat)); | ||
789 | ugeth_info("miimmind : addr - 0x%08x, val - 0x%08x", | ||
790 | (u32) & ugeth->ug_regs->miimng.miimind, | ||
791 | in_be32(&ugeth->ug_regs->miimng.miimind)); | ||
792 | ugeth_info("ifctl : addr - 0x%08x, val - 0x%08x", | ||
793 | (u32) & ugeth->ug_regs->ifctl, | ||
794 | in_be32(&ugeth->ug_regs->ifctl)); | ||
795 | ugeth_info("ifstat : addr - 0x%08x, val - 0x%08x", | ||
796 | (u32) & ugeth->ug_regs->ifstat, | ||
797 | in_be32(&ugeth->ug_regs->ifstat)); | ||
798 | ugeth_info("macstnaddr1: addr - 0x%08x, val - 0x%08x", | ||
799 | (u32) & ugeth->ug_regs->macstnaddr1, | ||
800 | in_be32(&ugeth->ug_regs->macstnaddr1)); | ||
801 | ugeth_info("macstnaddr2: addr - 0x%08x, val - 0x%08x", | ||
802 | (u32) & ugeth->ug_regs->macstnaddr2, | ||
803 | in_be32(&ugeth->ug_regs->macstnaddr2)); | ||
804 | ugeth_info("uempr : addr - 0x%08x, val - 0x%08x", | ||
805 | (u32) & ugeth->ug_regs->uempr, | ||
806 | in_be32(&ugeth->ug_regs->uempr)); | ||
807 | ugeth_info("utbipar : addr - 0x%08x, val - 0x%08x", | ||
808 | (u32) & ugeth->ug_regs->utbipar, | ||
809 | in_be32(&ugeth->ug_regs->utbipar)); | ||
810 | ugeth_info("uescr : addr - 0x%08x, val - 0x%04x", | ||
811 | (u32) & ugeth->ug_regs->uescr, | ||
812 | in_be16(&ugeth->ug_regs->uescr)); | ||
813 | ugeth_info("tx64 : addr - 0x%08x, val - 0x%08x", | ||
814 | (u32) & ugeth->ug_regs->tx64, | ||
815 | in_be32(&ugeth->ug_regs->tx64)); | ||
816 | ugeth_info("tx127 : addr - 0x%08x, val - 0x%08x", | ||
817 | (u32) & ugeth->ug_regs->tx127, | ||
818 | in_be32(&ugeth->ug_regs->tx127)); | ||
819 | ugeth_info("tx255 : addr - 0x%08x, val - 0x%08x", | ||
820 | (u32) & ugeth->ug_regs->tx255, | ||
821 | in_be32(&ugeth->ug_regs->tx255)); | ||
822 | ugeth_info("rx64 : addr - 0x%08x, val - 0x%08x", | ||
823 | (u32) & ugeth->ug_regs->rx64, | ||
824 | in_be32(&ugeth->ug_regs->rx64)); | ||
825 | ugeth_info("rx127 : addr - 0x%08x, val - 0x%08x", | ||
826 | (u32) & ugeth->ug_regs->rx127, | ||
827 | in_be32(&ugeth->ug_regs->rx127)); | ||
828 | ugeth_info("rx255 : addr - 0x%08x, val - 0x%08x", | ||
829 | (u32) & ugeth->ug_regs->rx255, | ||
830 | in_be32(&ugeth->ug_regs->rx255)); | ||
831 | ugeth_info("txok : addr - 0x%08x, val - 0x%08x", | ||
832 | (u32) & ugeth->ug_regs->txok, | ||
833 | in_be32(&ugeth->ug_regs->txok)); | ||
834 | ugeth_info("txcf : addr - 0x%08x, val - 0x%04x", | ||
835 | (u32) & ugeth->ug_regs->txcf, | ||
836 | in_be16(&ugeth->ug_regs->txcf)); | ||
837 | ugeth_info("tmca : addr - 0x%08x, val - 0x%08x", | ||
838 | (u32) & ugeth->ug_regs->tmca, | ||
839 | in_be32(&ugeth->ug_regs->tmca)); | ||
840 | ugeth_info("tbca : addr - 0x%08x, val - 0x%08x", | ||
841 | (u32) & ugeth->ug_regs->tbca, | ||
842 | in_be32(&ugeth->ug_regs->tbca)); | ||
843 | ugeth_info("rxfok : addr - 0x%08x, val - 0x%08x", | ||
844 | (u32) & ugeth->ug_regs->rxfok, | ||
845 | in_be32(&ugeth->ug_regs->rxfok)); | ||
846 | ugeth_info("rxbok : addr - 0x%08x, val - 0x%08x", | ||
847 | (u32) & ugeth->ug_regs->rxbok, | ||
848 | in_be32(&ugeth->ug_regs->rxbok)); | ||
849 | ugeth_info("rbyt : addr - 0x%08x, val - 0x%08x", | ||
850 | (u32) & ugeth->ug_regs->rbyt, | ||
851 | in_be32(&ugeth->ug_regs->rbyt)); | ||
852 | ugeth_info("rmca : addr - 0x%08x, val - 0x%08x", | ||
853 | (u32) & ugeth->ug_regs->rmca, | ||
854 | in_be32(&ugeth->ug_regs->rmca)); | ||
855 | ugeth_info("rbca : addr - 0x%08x, val - 0x%08x", | ||
856 | (u32) & ugeth->ug_regs->rbca, | ||
857 | in_be32(&ugeth->ug_regs->rbca)); | ||
858 | ugeth_info("scar : addr - 0x%08x, val - 0x%08x", | ||
859 | (u32) & ugeth->ug_regs->scar, | ||
860 | in_be32(&ugeth->ug_regs->scar)); | ||
861 | ugeth_info("scam : addr - 0x%08x, val - 0x%08x", | ||
862 | (u32) & ugeth->ug_regs->scam, | ||
863 | in_be32(&ugeth->ug_regs->scam)); | ||
864 | |||
865 | if (ugeth->p_thread_data_tx) { | ||
866 | int numThreadsTxNumerical; | ||
867 | switch (ugeth->ug_info->numThreadsTx) { | ||
868 | case UCC_GETH_NUM_OF_THREADS_1: | ||
869 | numThreadsTxNumerical = 1; | ||
870 | break; | ||
871 | case UCC_GETH_NUM_OF_THREADS_2: | ||
872 | numThreadsTxNumerical = 2; | ||
873 | break; | ||
874 | case UCC_GETH_NUM_OF_THREADS_4: | ||
875 | numThreadsTxNumerical = 4; | ||
876 | break; | ||
877 | case UCC_GETH_NUM_OF_THREADS_6: | ||
878 | numThreadsTxNumerical = 6; | ||
879 | break; | ||
880 | case UCC_GETH_NUM_OF_THREADS_8: | ||
881 | numThreadsTxNumerical = 8; | ||
882 | break; | ||
883 | default: | ||
884 | numThreadsTxNumerical = 0; | ||
885 | break; | ||
886 | } | ||
887 | |||
888 | ugeth_info("Thread data TXs:"); | ||
889 | ugeth_info("Base address: 0x%08x", | ||
890 | (u32) ugeth->p_thread_data_tx); | ||
891 | for (i = 0; i < numThreadsTxNumerical; i++) { | ||
892 | ugeth_info("Thread data TX[%d]:", i); | ||
893 | ugeth_info("Base address: 0x%08x", | ||
894 | (u32) & ugeth->p_thread_data_tx[i]); | ||
895 | mem_disp((u8 *) & ugeth->p_thread_data_tx[i], | ||
896 | sizeof(ucc_geth_thread_data_tx_t)); | ||
897 | } | ||
898 | } | ||
899 | if (ugeth->p_thread_data_rx) { | ||
900 | int numThreadsRxNumerical; | ||
901 | switch (ugeth->ug_info->numThreadsRx) { | ||
902 | case UCC_GETH_NUM_OF_THREADS_1: | ||
903 | numThreadsRxNumerical = 1; | ||
904 | break; | ||
905 | case UCC_GETH_NUM_OF_THREADS_2: | ||
906 | numThreadsRxNumerical = 2; | ||
907 | break; | ||
908 | case UCC_GETH_NUM_OF_THREADS_4: | ||
909 | numThreadsRxNumerical = 4; | ||
910 | break; | ||
911 | case UCC_GETH_NUM_OF_THREADS_6: | ||
912 | numThreadsRxNumerical = 6; | ||
913 | break; | ||
914 | case UCC_GETH_NUM_OF_THREADS_8: | ||
915 | numThreadsRxNumerical = 8; | ||
916 | break; | ||
917 | default: | ||
918 | numThreadsRxNumerical = 0; | ||
919 | break; | ||
920 | } | ||
921 | |||
922 | ugeth_info("Thread data RX:"); | ||
923 | ugeth_info("Base address: 0x%08x", | ||
924 | (u32) ugeth->p_thread_data_rx); | ||
925 | for (i = 0; i < numThreadsRxNumerical; i++) { | ||
926 | ugeth_info("Thread data RX[%d]:", i); | ||
927 | ugeth_info("Base address: 0x%08x", | ||
928 | (u32) & ugeth->p_thread_data_rx[i]); | ||
929 | mem_disp((u8 *) & ugeth->p_thread_data_rx[i], | ||
930 | sizeof(ucc_geth_thread_data_rx_t)); | ||
931 | } | ||
932 | } | ||
933 | if (ugeth->p_exf_glbl_param) { | ||
934 | ugeth_info("EXF global param:"); | ||
935 | ugeth_info("Base address: 0x%08x", | ||
936 | (u32) ugeth->p_exf_glbl_param); | ||
937 | mem_disp((u8 *) ugeth->p_exf_glbl_param, | ||
938 | sizeof(*ugeth->p_exf_glbl_param)); | ||
939 | } | ||
940 | if (ugeth->p_tx_glbl_pram) { | ||
941 | ugeth_info("TX global param:"); | ||
942 | ugeth_info("Base address: 0x%08x", (u32) ugeth->p_tx_glbl_pram); | ||
943 | ugeth_info("temoder : addr - 0x%08x, val - 0x%04x", | ||
944 | (u32) & ugeth->p_tx_glbl_pram->temoder, | ||
945 | in_be16(&ugeth->p_tx_glbl_pram->temoder)); | ||
946 | ugeth_info("sqptr : addr - 0x%08x, val - 0x%08x", | ||
947 | (u32) & ugeth->p_tx_glbl_pram->sqptr, | ||
948 | in_be32(&ugeth->p_tx_glbl_pram->sqptr)); | ||
949 | ugeth_info("schedulerbasepointer: addr - 0x%08x, val - 0x%08x", | ||
950 | (u32) & ugeth->p_tx_glbl_pram->schedulerbasepointer, | ||
951 | in_be32(&ugeth->p_tx_glbl_pram-> | ||
952 | schedulerbasepointer)); | ||
953 | ugeth_info("txrmonbaseptr: addr - 0x%08x, val - 0x%08x", | ||
954 | (u32) & ugeth->p_tx_glbl_pram->txrmonbaseptr, | ||
955 | in_be32(&ugeth->p_tx_glbl_pram->txrmonbaseptr)); | ||
956 | ugeth_info("tstate : addr - 0x%08x, val - 0x%08x", | ||
957 | (u32) & ugeth->p_tx_glbl_pram->tstate, | ||
958 | in_be32(&ugeth->p_tx_glbl_pram->tstate)); | ||
959 | ugeth_info("iphoffset[0] : addr - 0x%08x, val - 0x%02x", | ||
960 | (u32) & ugeth->p_tx_glbl_pram->iphoffset[0], | ||
961 | ugeth->p_tx_glbl_pram->iphoffset[0]); | ||
962 | ugeth_info("iphoffset[1] : addr - 0x%08x, val - 0x%02x", | ||
963 | (u32) & ugeth->p_tx_glbl_pram->iphoffset[1], | ||
964 | ugeth->p_tx_glbl_pram->iphoffset[1]); | ||
965 | ugeth_info("iphoffset[2] : addr - 0x%08x, val - 0x%02x", | ||
966 | (u32) & ugeth->p_tx_glbl_pram->iphoffset[2], | ||
967 | ugeth->p_tx_glbl_pram->iphoffset[2]); | ||
968 | ugeth_info("iphoffset[3] : addr - 0x%08x, val - 0x%02x", | ||
969 | (u32) & ugeth->p_tx_glbl_pram->iphoffset[3], | ||
970 | ugeth->p_tx_glbl_pram->iphoffset[3]); | ||
971 | ugeth_info("iphoffset[4] : addr - 0x%08x, val - 0x%02x", | ||
972 | (u32) & ugeth->p_tx_glbl_pram->iphoffset[4], | ||
973 | ugeth->p_tx_glbl_pram->iphoffset[4]); | ||
974 | ugeth_info("iphoffset[5] : addr - 0x%08x, val - 0x%02x", | ||
975 | (u32) & ugeth->p_tx_glbl_pram->iphoffset[5], | ||
976 | ugeth->p_tx_glbl_pram->iphoffset[5]); | ||
977 | ugeth_info("iphoffset[6] : addr - 0x%08x, val - 0x%02x", | ||
978 | (u32) & ugeth->p_tx_glbl_pram->iphoffset[6], | ||
979 | ugeth->p_tx_glbl_pram->iphoffset[6]); | ||
980 | ugeth_info("iphoffset[7] : addr - 0x%08x, val - 0x%02x", | ||
981 | (u32) & ugeth->p_tx_glbl_pram->iphoffset[7], | ||
982 | ugeth->p_tx_glbl_pram->iphoffset[7]); | ||
983 | ugeth_info("vtagtable[0] : addr - 0x%08x, val - 0x%08x", | ||
984 | (u32) & ugeth->p_tx_glbl_pram->vtagtable[0], | ||
985 | in_be32(&ugeth->p_tx_glbl_pram->vtagtable[0])); | ||
986 | ugeth_info("vtagtable[1] : addr - 0x%08x, val - 0x%08x", | ||
987 | (u32) & ugeth->p_tx_glbl_pram->vtagtable[1], | ||
988 | in_be32(&ugeth->p_tx_glbl_pram->vtagtable[1])); | ||
989 | ugeth_info("vtagtable[2] : addr - 0x%08x, val - 0x%08x", | ||
990 | (u32) & ugeth->p_tx_glbl_pram->vtagtable[2], | ||
991 | in_be32(&ugeth->p_tx_glbl_pram->vtagtable[2])); | ||
992 | ugeth_info("vtagtable[3] : addr - 0x%08x, val - 0x%08x", | ||
993 | (u32) & ugeth->p_tx_glbl_pram->vtagtable[3], | ||
994 | in_be32(&ugeth->p_tx_glbl_pram->vtagtable[3])); | ||
995 | ugeth_info("vtagtable[4] : addr - 0x%08x, val - 0x%08x", | ||
996 | (u32) & ugeth->p_tx_glbl_pram->vtagtable[4], | ||
997 | in_be32(&ugeth->p_tx_glbl_pram->vtagtable[4])); | ||
998 | ugeth_info("vtagtable[5] : addr - 0x%08x, val - 0x%08x", | ||
999 | (u32) & ugeth->p_tx_glbl_pram->vtagtable[5], | ||
1000 | in_be32(&ugeth->p_tx_glbl_pram->vtagtable[5])); | ||
1001 | ugeth_info("vtagtable[6] : addr - 0x%08x, val - 0x%08x", | ||
1002 | (u32) & ugeth->p_tx_glbl_pram->vtagtable[6], | ||
1003 | in_be32(&ugeth->p_tx_glbl_pram->vtagtable[6])); | ||
1004 | ugeth_info("vtagtable[7] : addr - 0x%08x, val - 0x%08x", | ||
1005 | (u32) & ugeth->p_tx_glbl_pram->vtagtable[7], | ||
1006 | in_be32(&ugeth->p_tx_glbl_pram->vtagtable[7])); | ||
1007 | ugeth_info("tqptr : addr - 0x%08x, val - 0x%08x", | ||
1008 | (u32) & ugeth->p_tx_glbl_pram->tqptr, | ||
1009 | in_be32(&ugeth->p_tx_glbl_pram->tqptr)); | ||
1010 | } | ||
1011 | if (ugeth->p_rx_glbl_pram) { | ||
1012 | ugeth_info("RX global param:"); | ||
1013 | ugeth_info("Base address: 0x%08x", (u32) ugeth->p_rx_glbl_pram); | ||
1014 | ugeth_info("remoder : addr - 0x%08x, val - 0x%08x", | ||
1015 | (u32) & ugeth->p_rx_glbl_pram->remoder, | ||
1016 | in_be32(&ugeth->p_rx_glbl_pram->remoder)); | ||
1017 | ugeth_info("rqptr : addr - 0x%08x, val - 0x%08x", | ||
1018 | (u32) & ugeth->p_rx_glbl_pram->rqptr, | ||
1019 | in_be32(&ugeth->p_rx_glbl_pram->rqptr)); | ||
1020 | ugeth_info("typeorlen : addr - 0x%08x, val - 0x%04x", | ||
1021 | (u32) & ugeth->p_rx_glbl_pram->typeorlen, | ||
1022 | in_be16(&ugeth->p_rx_glbl_pram->typeorlen)); | ||
1023 | ugeth_info("rxgstpack : addr - 0x%08x, val - 0x%02x", | ||
1024 | (u32) & ugeth->p_rx_glbl_pram->rxgstpack, | ||
1025 | ugeth->p_rx_glbl_pram->rxgstpack); | ||
1026 | ugeth_info("rxrmonbaseptr : addr - 0x%08x, val - 0x%08x", | ||
1027 | (u32) & ugeth->p_rx_glbl_pram->rxrmonbaseptr, | ||
1028 | in_be32(&ugeth->p_rx_glbl_pram->rxrmonbaseptr)); | ||
1029 | ugeth_info("intcoalescingptr: addr - 0x%08x, val - 0x%08x", | ||
1030 | (u32) & ugeth->p_rx_glbl_pram->intcoalescingptr, | ||
1031 | in_be32(&ugeth->p_rx_glbl_pram->intcoalescingptr)); | ||
1032 | ugeth_info("rstate : addr - 0x%08x, val - 0x%02x", | ||
1033 | (u32) & ugeth->p_rx_glbl_pram->rstate, | ||
1034 | ugeth->p_rx_glbl_pram->rstate); | ||
1035 | ugeth_info("mrblr : addr - 0x%08x, val - 0x%04x", | ||
1036 | (u32) & ugeth->p_rx_glbl_pram->mrblr, | ||
1037 | in_be16(&ugeth->p_rx_glbl_pram->mrblr)); | ||
1038 | ugeth_info("rbdqptr : addr - 0x%08x, val - 0x%08x", | ||
1039 | (u32) & ugeth->p_rx_glbl_pram->rbdqptr, | ||
1040 | in_be32(&ugeth->p_rx_glbl_pram->rbdqptr)); | ||
1041 | ugeth_info("mflr : addr - 0x%08x, val - 0x%04x", | ||
1042 | (u32) & ugeth->p_rx_glbl_pram->mflr, | ||
1043 | in_be16(&ugeth->p_rx_glbl_pram->mflr)); | ||
1044 | ugeth_info("minflr : addr - 0x%08x, val - 0x%04x", | ||
1045 | (u32) & ugeth->p_rx_glbl_pram->minflr, | ||
1046 | in_be16(&ugeth->p_rx_glbl_pram->minflr)); | ||
1047 | ugeth_info("maxd1 : addr - 0x%08x, val - 0x%04x", | ||
1048 | (u32) & ugeth->p_rx_glbl_pram->maxd1, | ||
1049 | in_be16(&ugeth->p_rx_glbl_pram->maxd1)); | ||
1050 | ugeth_info("maxd2 : addr - 0x%08x, val - 0x%04x", | ||
1051 | (u32) & ugeth->p_rx_glbl_pram->maxd2, | ||
1052 | in_be16(&ugeth->p_rx_glbl_pram->maxd2)); | ||
1053 | ugeth_info("ecamptr : addr - 0x%08x, val - 0x%08x", | ||
1054 | (u32) & ugeth->p_rx_glbl_pram->ecamptr, | ||
1055 | in_be32(&ugeth->p_rx_glbl_pram->ecamptr)); | ||
1056 | ugeth_info("l2qt : addr - 0x%08x, val - 0x%08x", | ||
1057 | (u32) & ugeth->p_rx_glbl_pram->l2qt, | ||
1058 | in_be32(&ugeth->p_rx_glbl_pram->l2qt)); | ||
1059 | ugeth_info("l3qt[0] : addr - 0x%08x, val - 0x%08x", | ||
1060 | (u32) & ugeth->p_rx_glbl_pram->l3qt[0], | ||
1061 | in_be32(&ugeth->p_rx_glbl_pram->l3qt[0])); | ||
1062 | ugeth_info("l3qt[1] : addr - 0x%08x, val - 0x%08x", | ||
1063 | (u32) & ugeth->p_rx_glbl_pram->l3qt[1], | ||
1064 | in_be32(&ugeth->p_rx_glbl_pram->l3qt[1])); | ||
1065 | ugeth_info("l3qt[2] : addr - 0x%08x, val - 0x%08x", | ||
1066 | (u32) & ugeth->p_rx_glbl_pram->l3qt[2], | ||
1067 | in_be32(&ugeth->p_rx_glbl_pram->l3qt[2])); | ||
1068 | ugeth_info("l3qt[3] : addr - 0x%08x, val - 0x%08x", | ||
1069 | (u32) & ugeth->p_rx_glbl_pram->l3qt[3], | ||
1070 | in_be32(&ugeth->p_rx_glbl_pram->l3qt[3])); | ||
1071 | ugeth_info("l3qt[4] : addr - 0x%08x, val - 0x%08x", | ||
1072 | (u32) & ugeth->p_rx_glbl_pram->l3qt[4], | ||
1073 | in_be32(&ugeth->p_rx_glbl_pram->l3qt[4])); | ||
1074 | ugeth_info("l3qt[5] : addr - 0x%08x, val - 0x%08x", | ||
1075 | (u32) & ugeth->p_rx_glbl_pram->l3qt[5], | ||
1076 | in_be32(&ugeth->p_rx_glbl_pram->l3qt[5])); | ||
1077 | ugeth_info("l3qt[6] : addr - 0x%08x, val - 0x%08x", | ||
1078 | (u32) & ugeth->p_rx_glbl_pram->l3qt[6], | ||
1079 | in_be32(&ugeth->p_rx_glbl_pram->l3qt[6])); | ||
1080 | ugeth_info("l3qt[7] : addr - 0x%08x, val - 0x%08x", | ||
1081 | (u32) & ugeth->p_rx_glbl_pram->l3qt[7], | ||
1082 | in_be32(&ugeth->p_rx_glbl_pram->l3qt[7])); | ||
1083 | ugeth_info("vlantype : addr - 0x%08x, val - 0x%04x", | ||
1084 | (u32) & ugeth->p_rx_glbl_pram->vlantype, | ||
1085 | in_be16(&ugeth->p_rx_glbl_pram->vlantype)); | ||
1086 | ugeth_info("vlantci : addr - 0x%08x, val - 0x%04x", | ||
1087 | (u32) & ugeth->p_rx_glbl_pram->vlantci, | ||
1088 | in_be16(&ugeth->p_rx_glbl_pram->vlantci)); | ||
1089 | for (i = 0; i < 64; i++) | ||
1090 | ugeth_info | ||
1091 | ("addressfiltering[%d]: addr - 0x%08x, val - 0x%02x", | ||
1092 | i, | ||
1093 | (u32) & ugeth->p_rx_glbl_pram->addressfiltering[i], | ||
1094 | ugeth->p_rx_glbl_pram->addressfiltering[i]); | ||
1095 | ugeth_info("exfGlobalParam : addr - 0x%08x, val - 0x%08x", | ||
1096 | (u32) & ugeth->p_rx_glbl_pram->exfGlobalParam, | ||
1097 | in_be32(&ugeth->p_rx_glbl_pram->exfGlobalParam)); | ||
1098 | } | ||
1099 | if (ugeth->p_send_q_mem_reg) { | ||
1100 | ugeth_info("Send Q memory registers:"); | ||
1101 | ugeth_info("Base address: 0x%08x", | ||
1102 | (u32) ugeth->p_send_q_mem_reg); | ||
1103 | for (i = 0; i < ugeth->ug_info->numQueuesTx; i++) { | ||
1104 | ugeth_info("SQQD[%d]:", i); | ||
1105 | ugeth_info("Base address: 0x%08x", | ||
1106 | (u32) & ugeth->p_send_q_mem_reg->sqqd[i]); | ||
1107 | mem_disp((u8 *) & ugeth->p_send_q_mem_reg->sqqd[i], | ||
1108 | sizeof(ucc_geth_send_queue_qd_t)); | ||
1109 | } | ||
1110 | } | ||
1111 | if (ugeth->p_scheduler) { | ||
1112 | ugeth_info("Scheduler:"); | ||
1113 | ugeth_info("Base address: 0x%08x", (u32) ugeth->p_scheduler); | ||
1114 | mem_disp((u8 *) ugeth->p_scheduler, | ||
1115 | sizeof(*ugeth->p_scheduler)); | ||
1116 | } | ||
1117 | if (ugeth->p_tx_fw_statistics_pram) { | ||
1118 | ugeth_info("TX FW statistics pram:"); | ||
1119 | ugeth_info("Base address: 0x%08x", | ||
1120 | (u32) ugeth->p_tx_fw_statistics_pram); | ||
1121 | mem_disp((u8 *) ugeth->p_tx_fw_statistics_pram, | ||
1122 | sizeof(*ugeth->p_tx_fw_statistics_pram)); | ||
1123 | } | ||
1124 | if (ugeth->p_rx_fw_statistics_pram) { | ||
1125 | ugeth_info("RX FW statistics pram:"); | ||
1126 | ugeth_info("Base address: 0x%08x", | ||
1127 | (u32) ugeth->p_rx_fw_statistics_pram); | ||
1128 | mem_disp((u8 *) ugeth->p_rx_fw_statistics_pram, | ||
1129 | sizeof(*ugeth->p_rx_fw_statistics_pram)); | ||
1130 | } | ||
1131 | if (ugeth->p_rx_irq_coalescing_tbl) { | ||
1132 | ugeth_info("RX IRQ coalescing tables:"); | ||
1133 | ugeth_info("Base address: 0x%08x", | ||
1134 | (u32) ugeth->p_rx_irq_coalescing_tbl); | ||
1135 | for (i = 0; i < ugeth->ug_info->numQueuesRx; i++) { | ||
1136 | ugeth_info("RX IRQ coalescing table entry[%d]:", i); | ||
1137 | ugeth_info("Base address: 0x%08x", | ||
1138 | (u32) & ugeth->p_rx_irq_coalescing_tbl-> | ||
1139 | coalescingentry[i]); | ||
1140 | ugeth_info | ||
1141 | ("interruptcoalescingmaxvalue: addr - 0x%08x, val - 0x%08x", | ||
1142 | (u32) & ugeth->p_rx_irq_coalescing_tbl-> | ||
1143 | coalescingentry[i].interruptcoalescingmaxvalue, | ||
1144 | in_be32(&ugeth->p_rx_irq_coalescing_tbl-> | ||
1145 | coalescingentry[i]. | ||
1146 | interruptcoalescingmaxvalue)); | ||
1147 | ugeth_info | ||
1148 | ("interruptcoalescingcounter : addr - 0x%08x, val - 0x%08x", | ||
1149 | (u32) & ugeth->p_rx_irq_coalescing_tbl-> | ||
1150 | coalescingentry[i].interruptcoalescingcounter, | ||
1151 | in_be32(&ugeth->p_rx_irq_coalescing_tbl-> | ||
1152 | coalescingentry[i]. | ||
1153 | interruptcoalescingcounter)); | ||
1154 | } | ||
1155 | } | ||
1156 | if (ugeth->p_rx_bd_qs_tbl) { | ||
1157 | ugeth_info("RX BD QS tables:"); | ||
1158 | ugeth_info("Base address: 0x%08x", (u32) ugeth->p_rx_bd_qs_tbl); | ||
1159 | for (i = 0; i < ugeth->ug_info->numQueuesRx; i++) { | ||
1160 | ugeth_info("RX BD QS table[%d]:", i); | ||
1161 | ugeth_info("Base address: 0x%08x", | ||
1162 | (u32) & ugeth->p_rx_bd_qs_tbl[i]); | ||
1163 | ugeth_info | ||
1164 | ("bdbaseptr : addr - 0x%08x, val - 0x%08x", | ||
1165 | (u32) & ugeth->p_rx_bd_qs_tbl[i].bdbaseptr, | ||
1166 | in_be32(&ugeth->p_rx_bd_qs_tbl[i].bdbaseptr)); | ||
1167 | ugeth_info | ||
1168 | ("bdptr : addr - 0x%08x, val - 0x%08x", | ||
1169 | (u32) & ugeth->p_rx_bd_qs_tbl[i].bdptr, | ||
1170 | in_be32(&ugeth->p_rx_bd_qs_tbl[i].bdptr)); | ||
1171 | ugeth_info | ||
1172 | ("externalbdbaseptr: addr - 0x%08x, val - 0x%08x", | ||
1173 | (u32) & ugeth->p_rx_bd_qs_tbl[i].externalbdbaseptr, | ||
1174 | in_be32(&ugeth->p_rx_bd_qs_tbl[i]. | ||
1175 | externalbdbaseptr)); | ||
1176 | ugeth_info | ||
1177 | ("externalbdptr : addr - 0x%08x, val - 0x%08x", | ||
1178 | (u32) & ugeth->p_rx_bd_qs_tbl[i].externalbdptr, | ||
1179 | in_be32(&ugeth->p_rx_bd_qs_tbl[i].externalbdptr)); | ||
1180 | ugeth_info("ucode RX Prefetched BDs:"); | ||
1181 | ugeth_info("Base address: 0x%08x", | ||
1182 | (u32) | ||
1183 | qe_muram_addr(in_be32 | ||
1184 | (&ugeth->p_rx_bd_qs_tbl[i]. | ||
1185 | bdbaseptr))); | ||
1186 | mem_disp((u8 *) | ||
1187 | qe_muram_addr(in_be32 | ||
1188 | (&ugeth->p_rx_bd_qs_tbl[i]. | ||
1189 | bdbaseptr)), | ||
1190 | sizeof(ucc_geth_rx_prefetched_bds_t)); | ||
1191 | } | ||
1192 | } | ||
1193 | if (ugeth->p_init_enet_param_shadow) { | ||
1194 | int size; | ||
1195 | ugeth_info("Init enet param shadow:"); | ||
1196 | ugeth_info("Base address: 0x%08x", | ||
1197 | (u32) ugeth->p_init_enet_param_shadow); | ||
1198 | mem_disp((u8 *) ugeth->p_init_enet_param_shadow, | ||
1199 | sizeof(*ugeth->p_init_enet_param_shadow)); | ||
1200 | |||
1201 | size = sizeof(ucc_geth_thread_rx_pram_t); | ||
1202 | if (ugeth->ug_info->rxExtendedFiltering) { | ||
1203 | size += | ||
1204 | THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING; | ||
1205 | if (ugeth->ug_info->largestexternallookupkeysize == | ||
1206 | QE_FLTR_TABLE_LOOKUP_KEY_SIZE_8_BYTES) | ||
1207 | size += | ||
1208 | THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_8; | ||
1209 | if (ugeth->ug_info->largestexternallookupkeysize == | ||
1210 | QE_FLTR_TABLE_LOOKUP_KEY_SIZE_16_BYTES) | ||
1211 | size += | ||
1212 | THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_16; | ||
1213 | } | ||
1214 | |||
1215 | dump_init_enet_entries(ugeth, | ||
1216 | &(ugeth->p_init_enet_param_shadow-> | ||
1217 | txthread[0]), | ||
1218 | ENET_INIT_PARAM_MAX_ENTRIES_TX, | ||
1219 | sizeof(ucc_geth_thread_tx_pram_t), | ||
1220 | ugeth->ug_info->riscTx, 0); | ||
1221 | dump_init_enet_entries(ugeth, | ||
1222 | &(ugeth->p_init_enet_param_shadow-> | ||
1223 | rxthread[0]), | ||
1224 | ENET_INIT_PARAM_MAX_ENTRIES_RX, size, | ||
1225 | ugeth->ug_info->riscRx, 1); | ||
1226 | } | ||
1227 | } | ||
1228 | #endif /* DEBUG */ | ||
1229 | |||
1230 | static void init_default_reg_vals(volatile u32 *upsmr_register, | ||
1231 | volatile u32 *maccfg1_register, | ||
1232 | volatile u32 *maccfg2_register) | ||
1233 | { | ||
1234 | out_be32(upsmr_register, UCC_GETH_UPSMR_INIT); | ||
1235 | out_be32(maccfg1_register, UCC_GETH_MACCFG1_INIT); | ||
1236 | out_be32(maccfg2_register, UCC_GETH_MACCFG2_INIT); | ||
1237 | } | ||
1238 | |||
1239 | static int init_half_duplex_params(int alt_beb, | ||
1240 | int back_pressure_no_backoff, | ||
1241 | int no_backoff, | ||
1242 | int excess_defer, | ||
1243 | u8 alt_beb_truncation, | ||
1244 | u8 max_retransmissions, | ||
1245 | u8 collision_window, | ||
1246 | volatile u32 *hafdup_register) | ||
1247 | { | ||
1248 | u32 value = 0; | ||
1249 | |||
1250 | if ((alt_beb_truncation > HALFDUP_ALT_BEB_TRUNCATION_MAX) || | ||
1251 | (max_retransmissions > HALFDUP_MAX_RETRANSMISSION_MAX) || | ||
1252 | (collision_window > HALFDUP_COLLISION_WINDOW_MAX)) | ||
1253 | return -EINVAL; | ||
1254 | |||
1255 | value = (u32) (alt_beb_truncation << HALFDUP_ALT_BEB_TRUNCATION_SHIFT); | ||
1256 | |||
1257 | if (alt_beb) | ||
1258 | value |= HALFDUP_ALT_BEB; | ||
1259 | if (back_pressure_no_backoff) | ||
1260 | value |= HALFDUP_BACK_PRESSURE_NO_BACKOFF; | ||
1261 | if (no_backoff) | ||
1262 | value |= HALFDUP_NO_BACKOFF; | ||
1263 | if (excess_defer) | ||
1264 | value |= HALFDUP_EXCESSIVE_DEFER; | ||
1265 | |||
1266 | value |= (max_retransmissions << HALFDUP_MAX_RETRANSMISSION_SHIFT); | ||
1267 | |||
1268 | value |= collision_window; | ||
1269 | |||
1270 | out_be32(hafdup_register, value); | ||
1271 | return 0; | ||
1272 | } | ||
1273 | |||
1274 | static int init_inter_frame_gap_params(u8 non_btb_cs_ipg, | ||
1275 | u8 non_btb_ipg, | ||
1276 | u8 min_ifg, | ||
1277 | u8 btb_ipg, | ||
1278 | volatile u32 *ipgifg_register) | ||
1279 | { | ||
1280 | u32 value = 0; | ||
1281 | |||
1282 | /* Non-Back-to-back IPG part 1 should be <= Non-Back-to-back | ||
1283 | IPG part 2 */ | ||
1284 | if (non_btb_cs_ipg > non_btb_ipg) | ||
1285 | return -EINVAL; | ||
1286 | |||
1287 | if ((non_btb_cs_ipg > IPGIFG_NON_BACK_TO_BACK_IFG_PART1_MAX) || | ||
1288 | (non_btb_ipg > IPGIFG_NON_BACK_TO_BACK_IFG_PART2_MAX) || | ||
1289 | /*(min_ifg > IPGIFG_MINIMUM_IFG_ENFORCEMENT_MAX) || */ | ||
1290 | (btb_ipg > IPGIFG_BACK_TO_BACK_IFG_MAX)) | ||
1291 | return -EINVAL; | ||
1292 | |||
1293 | value |= | ||
1294 | ((non_btb_cs_ipg << IPGIFG_NON_BACK_TO_BACK_IFG_PART1_SHIFT) & | ||
1295 | IPGIFG_NBTB_CS_IPG_MASK); | ||
1296 | value |= | ||
1297 | ((non_btb_ipg << IPGIFG_NON_BACK_TO_BACK_IFG_PART2_SHIFT) & | ||
1298 | IPGIFG_NBTB_IPG_MASK); | ||
1299 | value |= | ||
1300 | ((min_ifg << IPGIFG_MINIMUM_IFG_ENFORCEMENT_SHIFT) & | ||
1301 | IPGIFG_MIN_IFG_MASK); | ||
1302 | value |= (btb_ipg & IPGIFG_BTB_IPG_MASK); | ||
1303 | |||
1304 | out_be32(ipgifg_register, value); | ||
1305 | return 0; | ||
1306 | } | ||
1307 | |||
1308 | static int init_flow_control_params(u32 automatic_flow_control_mode, | ||
1309 | int rx_flow_control_enable, | ||
1310 | int tx_flow_control_enable, | ||
1311 | u16 pause_period, | ||
1312 | u16 extension_field, | ||
1313 | volatile u32 *upsmr_register, | ||
1314 | volatile u32 *uempr_register, | ||
1315 | volatile u32 *maccfg1_register) | ||
1316 | { | ||
1317 | u32 value = 0; | ||
1318 | |||
1319 | /* Set UEMPR register */ | ||
1320 | value = (u32) pause_period << UEMPR_PAUSE_TIME_VALUE_SHIFT; | ||
1321 | value |= (u32) extension_field << UEMPR_EXTENDED_PAUSE_TIME_VALUE_SHIFT; | ||
1322 | out_be32(uempr_register, value); | ||
1323 | |||
1324 | /* Set UPSMR register */ | ||
1325 | value = in_be32(upsmr_register); | ||
1326 | value |= automatic_flow_control_mode; | ||
1327 | out_be32(upsmr_register, value); | ||
1328 | |||
1329 | value = in_be32(maccfg1_register); | ||
1330 | if (rx_flow_control_enable) | ||
1331 | value |= MACCFG1_FLOW_RX; | ||
1332 | if (tx_flow_control_enable) | ||
1333 | value |= MACCFG1_FLOW_TX; | ||
1334 | out_be32(maccfg1_register, value); | ||
1335 | |||
1336 | return 0; | ||
1337 | } | ||
1338 | |||
1339 | static int init_hw_statistics_gathering_mode(int enable_hardware_statistics, | ||
1340 | int auto_zero_hardware_statistics, | ||
1341 | volatile u32 *upsmr_register, | ||
1342 | volatile u16 *uescr_register) | ||
1343 | { | ||
1344 | u32 upsmr_value = 0; | ||
1345 | u16 uescr_value = 0; | ||
1346 | /* Enable hardware statistics gathering if requested */ | ||
1347 | if (enable_hardware_statistics) { | ||
1348 | upsmr_value = in_be32(upsmr_register); | ||
1349 | upsmr_value |= UPSMR_HSE; | ||
1350 | out_be32(upsmr_register, upsmr_value); | ||
1351 | } | ||
1352 | |||
1353 | /* Clear hardware statistics counters */ | ||
1354 | uescr_value = in_be16(uescr_register); | ||
1355 | uescr_value |= UESCR_CLRCNT; | ||
1356 | /* Automatically zero hardware statistics counters on read, | ||
1357 | if requested */ | ||
1358 | if (auto_zero_hardware_statistics) | ||
1359 | uescr_value |= UESCR_AUTOZ; | ||
1360 | out_be16(uescr_register, uescr_value); | ||
1361 | |||
1362 | return 0; | ||
1363 | } | ||
1364 | |||
1365 | static int init_firmware_statistics_gathering_mode(int | ||
1366 | enable_tx_firmware_statistics, | ||
1367 | int enable_rx_firmware_statistics, | ||
1368 | volatile u32 *tx_rmon_base_ptr, | ||
1369 | u32 tx_firmware_statistics_structure_address, | ||
1370 | volatile u32 *rx_rmon_base_ptr, | ||
1371 | u32 rx_firmware_statistics_structure_address, | ||
1372 | volatile u16 *temoder_register, | ||
1373 | volatile u32 *remoder_register) | ||
1374 | { | ||
1375 | /* Note: this function does not check if */ | ||
1376 | /* the parameters it receives are NULL */ | ||
1377 | u16 temoder_value; | ||
1378 | u32 remoder_value; | ||
1379 | |||
1380 | if (enable_tx_firmware_statistics) { | ||
1381 | out_be32(tx_rmon_base_ptr, | ||
1382 | tx_firmware_statistics_structure_address); | ||
1383 | temoder_value = in_be16(temoder_register); | ||
1384 | temoder_value |= TEMODER_TX_RMON_STATISTICS_ENABLE; | ||
1385 | out_be16(temoder_register, temoder_value); | ||
1386 | } | ||
1387 | |||
1388 | if (enable_rx_firmware_statistics) { | ||
1389 | out_be32(rx_rmon_base_ptr, | ||
1390 | rx_firmware_statistics_structure_address); | ||
1391 | remoder_value = in_be32(remoder_register); | ||
1392 | remoder_value |= REMODER_RX_RMON_STATISTICS_ENABLE; | ||
1393 | out_be32(remoder_register, remoder_value); | ||
1394 | } | ||
1395 | |||
1396 | return 0; | ||
1397 | } | ||
1398 | |||
1399 | static int init_mac_station_addr_regs(u8 address_byte_0, | ||
1400 | u8 address_byte_1, | ||
1401 | u8 address_byte_2, | ||
1402 | u8 address_byte_3, | ||
1403 | u8 address_byte_4, | ||
1404 | u8 address_byte_5, | ||
1405 | volatile u32 *macstnaddr1_register, | ||
1406 | volatile u32 *macstnaddr2_register) | ||
1407 | { | ||
1408 | u32 value = 0; | ||
1409 | |||
1410 | /* Example: for a station address of 0x12345678ABCD, */ | ||
1411 | /* 0x12 is byte 0, 0x34 is byte 1 and so on and 0xCD is byte 5 */ | ||
1412 | |||
1413 | /* MACSTNADDR1 Register: */ | ||
1414 | |||
1415 | /* 0 7 8 15 */ | ||
1416 | /* station address byte 5 station address byte 4 */ | ||
1417 | /* 16 23 24 31 */ | ||
1418 | /* station address byte 3 station address byte 2 */ | ||
1419 | value |= (u32) ((address_byte_2 << 0) & 0x000000FF); | ||
1420 | value |= (u32) ((address_byte_3 << 8) & 0x0000FF00); | ||
1421 | value |= (u32) ((address_byte_4 << 16) & 0x00FF0000); | ||
1422 | value |= (u32) ((address_byte_5 << 24) & 0xFF000000); | ||
1423 | |||
1424 | out_be32(macstnaddr1_register, value); | ||
1425 | |||
1426 | /* MACSTNADDR2 Register: */ | ||
1427 | |||
1428 | /* 0 7 8 15 */ | ||
1429 | /* station address byte 1 station address byte 0 */ | ||
1430 | /* 16 23 24 31 */ | ||
1431 | /* reserved reserved */ | ||
1432 | value = 0; | ||
1433 | value |= (u32) ((address_byte_0 << 16) & 0x00FF0000); | ||
1434 | value |= (u32) ((address_byte_1 << 24) & 0xFF000000); | ||
1435 | |||
1436 | out_be32(macstnaddr2_register, value); | ||
1437 | |||
1438 | return 0; | ||
1439 | } | ||
1440 | |||
1441 | static int init_mac_duplex_mode(int full_duplex, | ||
1442 | int limited_to_full_duplex, | ||
1443 | volatile u32 *maccfg2_register) | ||
1444 | { | ||
1445 | u32 value = 0; | ||
1446 | |||
1447 | /* some interfaces must work in full duplex mode */ | ||
1448 | if ((full_duplex == 0) && (limited_to_full_duplex == 1)) | ||
1449 | return -EINVAL; | ||
1450 | |||
1451 | value = in_be32(maccfg2_register); | ||
1452 | |||
1453 | if (full_duplex) | ||
1454 | value |= MACCFG2_FDX; | ||
1455 | else | ||
1456 | value &= ~MACCFG2_FDX; | ||
1457 | |||
1458 | out_be32(maccfg2_register, value); | ||
1459 | return 0; | ||
1460 | } | ||
1461 | |||
1462 | static int init_check_frame_length_mode(int length_check, | ||
1463 | volatile u32 *maccfg2_register) | ||
1464 | { | ||
1465 | u32 value = 0; | ||
1466 | |||
1467 | value = in_be32(maccfg2_register); | ||
1468 | |||
1469 | if (length_check) | ||
1470 | value |= MACCFG2_LC; | ||
1471 | else | ||
1472 | value &= ~MACCFG2_LC; | ||
1473 | |||
1474 | out_be32(maccfg2_register, value); | ||
1475 | return 0; | ||
1476 | } | ||
1477 | |||
1478 | static int init_preamble_length(u8 preamble_length, | ||
1479 | volatile u32 *maccfg2_register) | ||
1480 | { | ||
1481 | u32 value = 0; | ||
1482 | |||
1483 | if ((preamble_length < 3) || (preamble_length > 7)) | ||
1484 | return -EINVAL; | ||
1485 | |||
1486 | value = in_be32(maccfg2_register); | ||
1487 | value &= ~MACCFG2_PREL_MASK; | ||
1488 | value |= (preamble_length << MACCFG2_PREL_SHIFT); | ||
1489 | out_be32(maccfg2_register, value); | ||
1490 | return 0; | ||
1491 | } | ||
1492 | |||
1493 | static int init_mii_management_configuration(int reset_mgmt, | ||
1494 | int preamble_supress, | ||
1495 | volatile u32 *miimcfg_register, | ||
1496 | volatile u32 *miimind_register) | ||
1497 | { | ||
1498 | unsigned int timeout = PHY_INIT_TIMEOUT; | ||
1499 | u32 value = 0; | ||
1500 | |||
1501 | value = in_be32(miimcfg_register); | ||
1502 | if (reset_mgmt) { | ||
1503 | value |= MIIMCFG_RESET_MANAGEMENT; | ||
1504 | out_be32(miimcfg_register, value); | ||
1505 | } | ||
1506 | |||
1507 | value = 0; | ||
1508 | |||
1509 | if (preamble_supress) | ||
1510 | value |= MIIMCFG_NO_PREAMBLE; | ||
1511 | |||
1512 | value |= UCC_GETH_MIIMCFG_MNGMNT_CLC_DIV_INIT; | ||
1513 | out_be32(miimcfg_register, value); | ||
1514 | |||
1515 | /* Wait until the bus is free */ | ||
1516 | while ((in_be32(miimind_register) & MIIMIND_BUSY) && timeout--) | ||
1517 | cpu_relax(); | ||
1518 | |||
1519 | if (timeout <= 0) { | ||
1520 | ugeth_err("%s: The MII Bus is stuck!", __FUNCTION__); | ||
1521 | return -ETIMEDOUT; | ||
1522 | } | ||
1523 | |||
1524 | return 0; | ||
1525 | } | ||
1526 | |||
1527 | static int init_rx_parameters(int reject_broadcast, | ||
1528 | int receive_short_frames, | ||
1529 | int promiscuous, volatile u32 *upsmr_register) | ||
1530 | { | ||
1531 | u32 value = 0; | ||
1532 | |||
1533 | value = in_be32(upsmr_register); | ||
1534 | |||
1535 | if (reject_broadcast) | ||
1536 | value |= UPSMR_BRO; | ||
1537 | else | ||
1538 | value &= ~UPSMR_BRO; | ||
1539 | |||
1540 | if (receive_short_frames) | ||
1541 | value |= UPSMR_RSH; | ||
1542 | else | ||
1543 | value &= ~UPSMR_RSH; | ||
1544 | |||
1545 | if (promiscuous) | ||
1546 | value |= UPSMR_PRO; | ||
1547 | else | ||
1548 | value &= ~UPSMR_PRO; | ||
1549 | |||
1550 | out_be32(upsmr_register, value); | ||
1551 | |||
1552 | return 0; | ||
1553 | } | ||
1554 | |||
1555 | static int init_max_rx_buff_len(u16 max_rx_buf_len, | ||
1556 | volatile u16 *mrblr_register) | ||
1557 | { | ||
1558 | /* max_rx_buf_len value must be a multiple of 128 */ | ||
1559 | if ((max_rx_buf_len == 0) | ||
1560 | || (max_rx_buf_len % UCC_GETH_MRBLR_ALIGNMENT)) | ||
1561 | return -EINVAL; | ||
1562 | |||
1563 | out_be16(mrblr_register, max_rx_buf_len); | ||
1564 | return 0; | ||
1565 | } | ||
1566 | |||
1567 | static int init_min_frame_len(u16 min_frame_length, | ||
1568 | volatile u16 *minflr_register, | ||
1569 | volatile u16 *mrblr_register) | ||
1570 | { | ||
1571 | u16 mrblr_value = 0; | ||
1572 | |||
1573 | mrblr_value = in_be16(mrblr_register); | ||
1574 | if (min_frame_length >= (mrblr_value - 4)) | ||
1575 | return -EINVAL; | ||
1576 | |||
1577 | out_be16(minflr_register, min_frame_length); | ||
1578 | return 0; | ||
1579 | } | ||
1580 | |||
1581 | static int adjust_enet_interface(ucc_geth_private_t *ugeth) | ||
1582 | { | ||
1583 | ucc_geth_info_t *ug_info; | ||
1584 | ucc_geth_t *ug_regs; | ||
1585 | ucc_fast_t *uf_regs; | ||
1586 | enet_speed_e speed; | ||
1587 | int ret_val, rpm = 0, tbi = 0, r10m = 0, rmm = | ||
1588 | 0, limited_to_full_duplex = 0; | ||
1589 | u32 upsmr, maccfg2, utbipar, tbiBaseAddress; | ||
1590 | u16 value; | ||
1591 | |||
1592 | ugeth_vdbg("%s: IN", __FUNCTION__); | ||
1593 | |||
1594 | ug_info = ugeth->ug_info; | ||
1595 | ug_regs = ugeth->ug_regs; | ||
1596 | uf_regs = ugeth->uccf->uf_regs; | ||
1597 | |||
1598 | /* Analyze enet_interface according to Interface Mode Configuration | ||
1599 | table */ | ||
1600 | ret_val = | ||
1601 | get_interface_details(ug_info->enet_interface, &speed, &r10m, &rmm, | ||
1602 | &rpm, &tbi, &limited_to_full_duplex); | ||
1603 | if (ret_val != 0) { | ||
1604 | ugeth_err | ||
1605 | ("%s: half duplex not supported in requested configuration.", | ||
1606 | __FUNCTION__); | ||
1607 | return ret_val; | ||
1608 | } | ||
1609 | |||
1610 | /* Set MACCFG2 */ | ||
1611 | maccfg2 = in_be32(&ug_regs->maccfg2); | ||
1612 | maccfg2 &= ~MACCFG2_INTERFACE_MODE_MASK; | ||
1613 | if ((speed == ENET_SPEED_10BT) || (speed == ENET_SPEED_100BT)) | ||
1614 | maccfg2 |= MACCFG2_INTERFACE_MODE_NIBBLE; | ||
1615 | else if (speed == ENET_SPEED_1000BT) | ||
1616 | maccfg2 |= MACCFG2_INTERFACE_MODE_BYTE; | ||
1617 | maccfg2 |= ug_info->padAndCrc; | ||
1618 | out_be32(&ug_regs->maccfg2, maccfg2); | ||
1619 | |||
1620 | /* Set UPSMR */ | ||
1621 | upsmr = in_be32(&uf_regs->upsmr); | ||
1622 | upsmr &= ~(UPSMR_RPM | UPSMR_R10M | UPSMR_TBIM | UPSMR_RMM); | ||
1623 | if (rpm) | ||
1624 | upsmr |= UPSMR_RPM; | ||
1625 | if (r10m) | ||
1626 | upsmr |= UPSMR_R10M; | ||
1627 | if (tbi) | ||
1628 | upsmr |= UPSMR_TBIM; | ||
1629 | if (rmm) | ||
1630 | upsmr |= UPSMR_RMM; | ||
1631 | out_be32(&uf_regs->upsmr, upsmr); | ||
1632 | |||
1633 | /* Set UTBIPAR */ | ||
1634 | utbipar = in_be32(&ug_regs->utbipar); | ||
1635 | utbipar &= ~UTBIPAR_PHY_ADDRESS_MASK; | ||
1636 | if (tbi) | ||
1637 | utbipar |= | ||
1638 | (ug_info->phy_address + | ||
1639 | ugeth->ug_info->uf_info. | ||
1640 | ucc_num) << UTBIPAR_PHY_ADDRESS_SHIFT; | ||
1641 | else | ||
1642 | utbipar |= | ||
1643 | (0x10 + | ||
1644 | ugeth->ug_info->uf_info. | ||
1645 | ucc_num) << UTBIPAR_PHY_ADDRESS_SHIFT; | ||
1646 | out_be32(&ug_regs->utbipar, utbipar); | ||
1647 | |||
1648 | /* Disable autonegotiation in tbi mode, because by default it | ||
1649 | comes up in autonegotiation mode. */ | ||
1650 | /* Note that this depends on proper setting in utbipar register. */ | ||
1651 | if (tbi) { | ||
1652 | tbiBaseAddress = in_be32(&ug_regs->utbipar); | ||
1653 | tbiBaseAddress &= UTBIPAR_PHY_ADDRESS_MASK; | ||
1654 | tbiBaseAddress >>= UTBIPAR_PHY_ADDRESS_SHIFT; | ||
1655 | value = | ||
1656 | ugeth->mii_info->mdio_read(ugeth->dev, (u8) tbiBaseAddress, | ||
1657 | ENET_TBI_MII_CR); | ||
1658 | value &= ~0x1000; /* Turn off autonegotiation */ | ||
1659 | ugeth->mii_info->mdio_write(ugeth->dev, (u8) tbiBaseAddress, | ||
1660 | ENET_TBI_MII_CR, value); | ||
1661 | } | ||
1662 | |||
1663 | ret_val = init_mac_duplex_mode(1, | ||
1664 | limited_to_full_duplex, | ||
1665 | &ug_regs->maccfg2); | ||
1666 | if (ret_val != 0) { | ||
1667 | ugeth_err | ||
1668 | ("%s: half duplex not supported in requested configuration.", | ||
1669 | __FUNCTION__); | ||
1670 | return ret_val; | ||
1671 | } | ||
1672 | |||
1673 | init_check_frame_length_mode(ug_info->lengthCheckRx, &ug_regs->maccfg2); | ||
1674 | |||
1675 | ret_val = init_preamble_length(ug_info->prel, &ug_regs->maccfg2); | ||
1676 | if (ret_val != 0) { | ||
1677 | ugeth_err | ||
1678 | ("%s: Preamble length must be between 3 and 7 inclusive.", | ||
1679 | __FUNCTION__); | ||
1680 | return ret_val; | ||
1681 | } | ||
1682 | |||
1683 | return 0; | ||
1684 | } | ||
1685 | |||
1686 | /* Called every time the controller might need to be made | ||
1687 | * aware of new link state. The PHY code conveys this | ||
1688 | * information through variables in the ugeth structure, and this | ||
1689 | * function converts those variables into the appropriate | ||
1690 | * register values, and can bring down the device if needed. | ||
1691 | */ | ||
1692 | static void adjust_link(struct net_device *dev) | ||
1693 | { | ||
1694 | ucc_geth_private_t *ugeth = netdev_priv(dev); | ||
1695 | ucc_geth_t *ug_regs; | ||
1696 | u32 tempval; | ||
1697 | struct ugeth_mii_info *mii_info = ugeth->mii_info; | ||
1698 | |||
1699 | ug_regs = ugeth->ug_regs; | ||
1700 | |||
1701 | if (mii_info->link) { | ||
1702 | /* Now we make sure that we can be in full duplex mode. | ||
1703 | * If not, we operate in half-duplex mode. */ | ||
1704 | if (mii_info->duplex != ugeth->oldduplex) { | ||
1705 | if (!(mii_info->duplex)) { | ||
1706 | tempval = in_be32(&ug_regs->maccfg2); | ||
1707 | tempval &= ~(MACCFG2_FDX); | ||
1708 | out_be32(&ug_regs->maccfg2, tempval); | ||
1709 | |||
1710 | ugeth_info("%s: Half Duplex", dev->name); | ||
1711 | } else { | ||
1712 | tempval = in_be32(&ug_regs->maccfg2); | ||
1713 | tempval |= MACCFG2_FDX; | ||
1714 | out_be32(&ug_regs->maccfg2, tempval); | ||
1715 | |||
1716 | ugeth_info("%s: Full Duplex", dev->name); | ||
1717 | } | ||
1718 | |||
1719 | ugeth->oldduplex = mii_info->duplex; | ||
1720 | } | ||
1721 | |||
1722 | if (mii_info->speed != ugeth->oldspeed) { | ||
1723 | switch (mii_info->speed) { | ||
1724 | case 1000: | ||
1725 | #ifdef CONFIG_MPC836x | ||
1726 | /* FIXME: This code is for 100Mbs BUG fixing, | ||
1727 | remove this when it is fixed!!! */ | ||
1728 | if (ugeth->ug_info->enet_interface == | ||
1729 | ENET_1000_GMII) | ||
1730 | /* Run the commands which initialize the PHY */ | ||
1731 | { | ||
1732 | tempval = | ||
1733 | (u32) mii_info->mdio_read(ugeth-> | ||
1734 | dev, mii_info->mii_id, 0x1b); | ||
1735 | tempval |= 0x000f; | ||
1736 | mii_info->mdio_write(ugeth->dev, | ||
1737 | mii_info->mii_id, 0x1b, | ||
1738 | (u16) tempval); | ||
1739 | tempval = | ||
1740 | (u32) mii_info->mdio_read(ugeth-> | ||
1741 | dev, mii_info->mii_id, | ||
1742 | MII_BMCR); | ||
1743 | mii_info->mdio_write(ugeth->dev, | ||
1744 | mii_info->mii_id, MII_BMCR, | ||
1745 | (u16) (tempval | BMCR_RESET)); | ||
1746 | } else if (ugeth->ug_info->enet_interface == | ||
1747 | ENET_1000_RGMII) | ||
1748 | /* Run the commands which initialize the PHY */ | ||
1749 | { | ||
1750 | tempval = | ||
1751 | (u32) mii_info->mdio_read(ugeth-> | ||
1752 | dev, mii_info->mii_id, 0x1b); | ||
1753 | tempval = (tempval & ~0x000f) | 0x000b; | ||
1754 | mii_info->mdio_write(ugeth->dev, | ||
1755 | mii_info->mii_id, 0x1b, | ||
1756 | (u16) tempval); | ||
1757 | tempval = | ||
1758 | (u32) mii_info->mdio_read(ugeth-> | ||
1759 | dev, mii_info->mii_id, | ||
1760 | MII_BMCR); | ||
1761 | mii_info->mdio_write(ugeth->dev, | ||
1762 | mii_info->mii_id, MII_BMCR, | ||
1763 | (u16) (tempval | BMCR_RESET)); | ||
1764 | } | ||
1765 | msleep(4000); | ||
1766 | #endif /* CONFIG_MPC8360 */ | ||
1767 | adjust_enet_interface(ugeth); | ||
1768 | break; | ||
1769 | case 100: | ||
1770 | case 10: | ||
1771 | #ifdef CONFIG_MPC836x | ||
1772 | /* FIXME: This code is for 100Mbs BUG fixing, | ||
1773 | remove this lines when it will be fixed!!! */ | ||
1774 | ugeth->ug_info->enet_interface = ENET_100_RGMII; | ||
1775 | tempval = | ||
1776 | (u32) mii_info->mdio_read(ugeth->dev, | ||
1777 | mii_info->mii_id, | ||
1778 | 0x1b); | ||
1779 | tempval = (tempval & ~0x000f) | 0x000b; | ||
1780 | mii_info->mdio_write(ugeth->dev, | ||
1781 | mii_info->mii_id, 0x1b, | ||
1782 | (u16) tempval); | ||
1783 | tempval = | ||
1784 | (u32) mii_info->mdio_read(ugeth->dev, | ||
1785 | mii_info->mii_id, | ||
1786 | MII_BMCR); | ||
1787 | mii_info->mdio_write(ugeth->dev, | ||
1788 | mii_info->mii_id, MII_BMCR, | ||
1789 | (u16) (tempval | | ||
1790 | BMCR_RESET)); | ||
1791 | msleep(4000); | ||
1792 | #endif /* CONFIG_MPC8360 */ | ||
1793 | adjust_enet_interface(ugeth); | ||
1794 | break; | ||
1795 | default: | ||
1796 | ugeth_warn | ||
1797 | ("%s: Ack! Speed (%d) is not 10/100/1000!", | ||
1798 | dev->name, mii_info->speed); | ||
1799 | break; | ||
1800 | } | ||
1801 | |||
1802 | ugeth_info("%s: Speed %dBT", dev->name, | ||
1803 | mii_info->speed); | ||
1804 | |||
1805 | ugeth->oldspeed = mii_info->speed; | ||
1806 | } | ||
1807 | |||
1808 | if (!ugeth->oldlink) { | ||
1809 | ugeth_info("%s: Link is up", dev->name); | ||
1810 | ugeth->oldlink = 1; | ||
1811 | netif_carrier_on(dev); | ||
1812 | netif_schedule(dev); | ||
1813 | } | ||
1814 | } else { | ||
1815 | if (ugeth->oldlink) { | ||
1816 | ugeth_info("%s: Link is down", dev->name); | ||
1817 | ugeth->oldlink = 0; | ||
1818 | ugeth->oldspeed = 0; | ||
1819 | ugeth->oldduplex = -1; | ||
1820 | netif_carrier_off(dev); | ||
1821 | } | ||
1822 | } | ||
1823 | } | ||
1824 | |||
1825 | /* Configure the PHY for dev. | ||
1826 | * returns 0 if success. -1 if failure | ||
1827 | */ | ||
1828 | static int init_phy(struct net_device *dev) | ||
1829 | { | ||
1830 | ucc_geth_private_t *ugeth = netdev_priv(dev); | ||
1831 | struct phy_info *curphy; | ||
1832 | ucc_mii_mng_t *mii_regs; | ||
1833 | struct ugeth_mii_info *mii_info; | ||
1834 | int err; | ||
1835 | |||
1836 | mii_regs = &ugeth->ug_regs->miimng; | ||
1837 | |||
1838 | ugeth->oldlink = 0; | ||
1839 | ugeth->oldspeed = 0; | ||
1840 | ugeth->oldduplex = -1; | ||
1841 | |||
1842 | mii_info = kmalloc(sizeof(struct ugeth_mii_info), GFP_KERNEL); | ||
1843 | |||
1844 | if (NULL == mii_info) { | ||
1845 | ugeth_err("%s: Could not allocate mii_info", dev->name); | ||
1846 | return -ENOMEM; | ||
1847 | } | ||
1848 | |||
1849 | mii_info->mii_regs = mii_regs; | ||
1850 | mii_info->speed = SPEED_1000; | ||
1851 | mii_info->duplex = DUPLEX_FULL; | ||
1852 | mii_info->pause = 0; | ||
1853 | mii_info->link = 0; | ||
1854 | |||
1855 | mii_info->advertising = (ADVERTISED_10baseT_Half | | ||
1856 | ADVERTISED_10baseT_Full | | ||
1857 | ADVERTISED_100baseT_Half | | ||
1858 | ADVERTISED_100baseT_Full | | ||
1859 | ADVERTISED_1000baseT_Full); | ||
1860 | mii_info->autoneg = 1; | ||
1861 | |||
1862 | mii_info->mii_id = ugeth->ug_info->phy_address; | ||
1863 | |||
1864 | mii_info->dev = dev; | ||
1865 | |||
1866 | mii_info->mdio_read = &read_phy_reg; | ||
1867 | mii_info->mdio_write = &write_phy_reg; | ||
1868 | |||
1869 | ugeth->mii_info = mii_info; | ||
1870 | |||
1871 | spin_lock_irq(&ugeth->lock); | ||
1872 | |||
1873 | /* Set this UCC to be the master of the MII managment */ | ||
1874 | ucc_set_qe_mux_mii_mng(ugeth->ug_info->uf_info.ucc_num); | ||
1875 | |||
1876 | if (init_mii_management_configuration(1, | ||
1877 | ugeth->ug_info-> | ||
1878 | miiPreambleSupress, | ||
1879 | &mii_regs->miimcfg, | ||
1880 | &mii_regs->miimind)) { | ||
1881 | ugeth_err("%s: The MII Bus is stuck!", dev->name); | ||
1882 | err = -1; | ||
1883 | goto bus_fail; | ||
1884 | } | ||
1885 | |||
1886 | spin_unlock_irq(&ugeth->lock); | ||
1887 | |||
1888 | /* get info for this PHY */ | ||
1889 | curphy = get_phy_info(ugeth->mii_info); | ||
1890 | |||
1891 | if (curphy == NULL) { | ||
1892 | ugeth_err("%s: No PHY found", dev->name); | ||
1893 | err = -1; | ||
1894 | goto no_phy; | ||
1895 | } | ||
1896 | |||
1897 | mii_info->phyinfo = curphy; | ||
1898 | |||
1899 | /* Run the commands which initialize the PHY */ | ||
1900 | if (curphy->init) { | ||
1901 | err = curphy->init(ugeth->mii_info); | ||
1902 | if (err) | ||
1903 | goto phy_init_fail; | ||
1904 | } | ||
1905 | |||
1906 | return 0; | ||
1907 | |||
1908 | phy_init_fail: | ||
1909 | no_phy: | ||
1910 | bus_fail: | ||
1911 | kfree(mii_info); | ||
1912 | |||
1913 | return err; | ||
1914 | } | ||
1915 | |||
1916 | #ifdef CONFIG_UGETH_TX_ON_DEMOND | ||
1917 | static int ugeth_transmit_on_demand(ucc_geth_private_t *ugeth) | ||
1918 | { | ||
1919 | ucc_fast_transmit_on_demand(ugeth->uccf); | ||
1920 | |||
1921 | return 0; | ||
1922 | } | ||
1923 | #endif | ||
1924 | |||
1925 | static int ugeth_graceful_stop_tx(ucc_geth_private_t *ugeth) | ||
1926 | { | ||
1927 | ucc_fast_private_t *uccf; | ||
1928 | u32 cecr_subblock; | ||
1929 | u32 temp; | ||
1930 | |||
1931 | uccf = ugeth->uccf; | ||
1932 | |||
1933 | /* Mask GRACEFUL STOP TX interrupt bit and clear it */ | ||
1934 | temp = in_be32(uccf->p_uccm); | ||
1935 | temp &= ~UCCE_GRA; | ||
1936 | out_be32(uccf->p_uccm, temp); | ||
1937 | out_be32(uccf->p_ucce, UCCE_GRA); /* clear by writing 1 */ | ||
1938 | |||
1939 | /* Issue host command */ | ||
1940 | cecr_subblock = | ||
1941 | ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num); | ||
1942 | qe_issue_cmd(QE_GRACEFUL_STOP_TX, cecr_subblock, | ||
1943 | (u8) QE_CR_PROTOCOL_ETHERNET, 0); | ||
1944 | |||
1945 | /* Wait for command to complete */ | ||
1946 | do { | ||
1947 | temp = in_be32(uccf->p_ucce); | ||
1948 | } while (!(temp & UCCE_GRA)); | ||
1949 | |||
1950 | uccf->stopped_tx = 1; | ||
1951 | |||
1952 | return 0; | ||
1953 | } | ||
1954 | |||
1955 | static int ugeth_graceful_stop_rx(ucc_geth_private_t * ugeth) | ||
1956 | { | ||
1957 | ucc_fast_private_t *uccf; | ||
1958 | u32 cecr_subblock; | ||
1959 | u8 temp; | ||
1960 | |||
1961 | uccf = ugeth->uccf; | ||
1962 | |||
1963 | /* Clear acknowledge bit */ | ||
1964 | temp = ugeth->p_rx_glbl_pram->rxgstpack; | ||
1965 | temp &= ~GRACEFUL_STOP_ACKNOWLEDGE_RX; | ||
1966 | ugeth->p_rx_glbl_pram->rxgstpack = temp; | ||
1967 | |||
1968 | /* Keep issuing command and checking acknowledge bit until | ||
1969 | it is asserted, according to spec */ | ||
1970 | do { | ||
1971 | /* Issue host command */ | ||
1972 | cecr_subblock = | ||
1973 | ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info. | ||
1974 | ucc_num); | ||
1975 | qe_issue_cmd(QE_GRACEFUL_STOP_RX, cecr_subblock, | ||
1976 | (u8) QE_CR_PROTOCOL_ETHERNET, 0); | ||
1977 | |||
1978 | temp = ugeth->p_rx_glbl_pram->rxgstpack; | ||
1979 | } while (!(temp & GRACEFUL_STOP_ACKNOWLEDGE_RX)); | ||
1980 | |||
1981 | uccf->stopped_rx = 1; | ||
1982 | |||
1983 | return 0; | ||
1984 | } | ||
1985 | |||
1986 | static int ugeth_restart_tx(ucc_geth_private_t *ugeth) | ||
1987 | { | ||
1988 | ucc_fast_private_t *uccf; | ||
1989 | u32 cecr_subblock; | ||
1990 | |||
1991 | uccf = ugeth->uccf; | ||
1992 | |||
1993 | cecr_subblock = | ||
1994 | ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num); | ||
1995 | qe_issue_cmd(QE_RESTART_TX, cecr_subblock, (u8) QE_CR_PROTOCOL_ETHERNET, | ||
1996 | 0); | ||
1997 | uccf->stopped_tx = 0; | ||
1998 | |||
1999 | return 0; | ||
2000 | } | ||
2001 | |||
2002 | static int ugeth_restart_rx(ucc_geth_private_t *ugeth) | ||
2003 | { | ||
2004 | ucc_fast_private_t *uccf; | ||
2005 | u32 cecr_subblock; | ||
2006 | |||
2007 | uccf = ugeth->uccf; | ||
2008 | |||
2009 | cecr_subblock = | ||
2010 | ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num); | ||
2011 | qe_issue_cmd(QE_RESTART_RX, cecr_subblock, (u8) QE_CR_PROTOCOL_ETHERNET, | ||
2012 | 0); | ||
2013 | uccf->stopped_rx = 0; | ||
2014 | |||
2015 | return 0; | ||
2016 | } | ||
2017 | |||
2018 | static int ugeth_enable(ucc_geth_private_t *ugeth, comm_dir_e mode) | ||
2019 | { | ||
2020 | ucc_fast_private_t *uccf; | ||
2021 | int enabled_tx, enabled_rx; | ||
2022 | |||
2023 | uccf = ugeth->uccf; | ||
2024 | |||
2025 | /* check if the UCC number is in range. */ | ||
2026 | if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) { | ||
2027 | ugeth_err("%s: ucc_num out of range.", __FUNCTION__); | ||
2028 | return -EINVAL; | ||
2029 | } | ||
2030 | |||
2031 | enabled_tx = uccf->enabled_tx; | ||
2032 | enabled_rx = uccf->enabled_rx; | ||
2033 | |||
2034 | /* Get Tx and Rx going again, in case this channel was actively | ||
2035 | disabled. */ | ||
2036 | if ((mode & COMM_DIR_TX) && (!enabled_tx) && uccf->stopped_tx) | ||
2037 | ugeth_restart_tx(ugeth); | ||
2038 | if ((mode & COMM_DIR_RX) && (!enabled_rx) && uccf->stopped_rx) | ||
2039 | ugeth_restart_rx(ugeth); | ||
2040 | |||
2041 | ucc_fast_enable(uccf, mode); /* OK to do even if not disabled */ | ||
2042 | |||
2043 | return 0; | ||
2044 | |||
2045 | } | ||
2046 | |||
2047 | static int ugeth_disable(ucc_geth_private_t * ugeth, comm_dir_e mode) | ||
2048 | { | ||
2049 | ucc_fast_private_t *uccf; | ||
2050 | |||
2051 | uccf = ugeth->uccf; | ||
2052 | |||
2053 | /* check if the UCC number is in range. */ | ||
2054 | if (ugeth->ug_info->uf_info.ucc_num >= UCC_MAX_NUM) { | ||
2055 | ugeth_err("%s: ucc_num out of range.", __FUNCTION__); | ||
2056 | return -EINVAL; | ||
2057 | } | ||
2058 | |||
2059 | /* Stop any transmissions */ | ||
2060 | if ((mode & COMM_DIR_TX) && uccf->enabled_tx && !uccf->stopped_tx) | ||
2061 | ugeth_graceful_stop_tx(ugeth); | ||
2062 | |||
2063 | /* Stop any receptions */ | ||
2064 | if ((mode & COMM_DIR_RX) && uccf->enabled_rx && !uccf->stopped_rx) | ||
2065 | ugeth_graceful_stop_rx(ugeth); | ||
2066 | |||
2067 | ucc_fast_disable(ugeth->uccf, mode); /* OK to do even if not enabled */ | ||
2068 | |||
2069 | return 0; | ||
2070 | } | ||
2071 | |||
2072 | static void ugeth_dump_regs(ucc_geth_private_t *ugeth) | ||
2073 | { | ||
2074 | #ifdef DEBUG | ||
2075 | ucc_fast_dump_regs(ugeth->uccf); | ||
2076 | dump_regs(ugeth); | ||
2077 | dump_bds(ugeth); | ||
2078 | #endif | ||
2079 | } | ||
2080 | |||
2081 | #ifdef CONFIG_UGETH_FILTERING | ||
2082 | static int ugeth_ext_filtering_serialize_tad(ucc_geth_tad_params_t * | ||
2083 | p_UccGethTadParams, | ||
2084 | qe_fltr_tad_t *qe_fltr_tad) | ||
2085 | { | ||
2086 | u16 temp; | ||
2087 | |||
2088 | /* Zero serialized TAD */ | ||
2089 | memset(qe_fltr_tad, 0, QE_FLTR_TAD_SIZE); | ||
2090 | |||
2091 | qe_fltr_tad->serialized[0] |= UCC_GETH_TAD_V; /* Must have this */ | ||
2092 | if (p_UccGethTadParams->rx_non_dynamic_extended_features_mode || | ||
2093 | (p_UccGethTadParams->vtag_op != UCC_GETH_VLAN_OPERATION_TAGGED_NOP) | ||
2094 | || (p_UccGethTadParams->vnontag_op != | ||
2095 | UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP) | ||
2096 | ) | ||
2097 | qe_fltr_tad->serialized[0] |= UCC_GETH_TAD_EF; | ||
2098 | if (p_UccGethTadParams->reject_frame) | ||
2099 | qe_fltr_tad->serialized[0] |= UCC_GETH_TAD_REJ; | ||
2100 | temp = | ||
2101 | (u16) (((u16) p_UccGethTadParams-> | ||
2102 | vtag_op) << UCC_GETH_TAD_VTAG_OP_SHIFT); | ||
2103 | qe_fltr_tad->serialized[0] |= (u8) (temp >> 8); /* upper bits */ | ||
2104 | |||
2105 | qe_fltr_tad->serialized[1] |= (u8) (temp & 0x00ff); /* lower bits */ | ||
2106 | if (p_UccGethTadParams->vnontag_op == | ||
2107 | UCC_GETH_VLAN_OPERATION_NON_TAGGED_Q_TAG_INSERT) | ||
2108 | qe_fltr_tad->serialized[1] |= UCC_GETH_TAD_V_NON_VTAG_OP; | ||
2109 | qe_fltr_tad->serialized[1] |= | ||
2110 | p_UccGethTadParams->rqos << UCC_GETH_TAD_RQOS_SHIFT; | ||
2111 | |||
2112 | qe_fltr_tad->serialized[2] |= | ||
2113 | p_UccGethTadParams->vpri << UCC_GETH_TAD_V_PRIORITY_SHIFT; | ||
2114 | /* upper bits */ | ||
2115 | qe_fltr_tad->serialized[2] |= (u8) (p_UccGethTadParams->vid >> 8); | ||
2116 | /* lower bits */ | ||
2117 | qe_fltr_tad->serialized[3] |= (u8) (p_UccGethTadParams->vid & 0x00ff); | ||
2118 | |||
2119 | return 0; | ||
2120 | } | ||
2121 | |||
2122 | static enet_addr_container_t | ||
2123 | *ugeth_82xx_filtering_get_match_addr_in_hash(ucc_geth_private_t *ugeth, | ||
2124 | enet_addr_t *p_enet_addr) | ||
2125 | { | ||
2126 | enet_addr_container_t *enet_addr_cont; | ||
2127 | struct list_head *p_lh; | ||
2128 | u16 i, num; | ||
2129 | int32_t j; | ||
2130 | u8 *p_counter; | ||
2131 | |||
2132 | if ((*p_enet_addr)[0] & ENET_GROUP_ADDR) { | ||
2133 | p_lh = &ugeth->group_hash_q; | ||
2134 | p_counter = &(ugeth->numGroupAddrInHash); | ||
2135 | } else { | ||
2136 | p_lh = &ugeth->ind_hash_q; | ||
2137 | p_counter = &(ugeth->numIndAddrInHash); | ||
2138 | } | ||
2139 | |||
2140 | if (!p_lh) | ||
2141 | return NULL; | ||
2142 | |||
2143 | num = *p_counter; | ||
2144 | |||
2145 | for (i = 0; i < num; i++) { | ||
2146 | enet_addr_cont = | ||
2147 | (enet_addr_container_t *) | ||
2148 | ENET_ADDR_CONT_ENTRY(dequeue(p_lh)); | ||
2149 | for (j = ENET_NUM_OCTETS_PER_ADDRESS - 1; j >= 0; j--) { | ||
2150 | if ((*p_enet_addr)[j] != (enet_addr_cont->address)[j]) | ||
2151 | break; | ||
2152 | if (j == 0) | ||
2153 | return enet_addr_cont; /* Found */ | ||
2154 | } | ||
2155 | enqueue(p_lh, &enet_addr_cont->node); /* Put it back */ | ||
2156 | } | ||
2157 | return NULL; | ||
2158 | } | ||
2159 | |||
2160 | static int ugeth_82xx_filtering_add_addr_in_hash(ucc_geth_private_t *ugeth, | ||
2161 | enet_addr_t *p_enet_addr) | ||
2162 | { | ||
2163 | ucc_geth_enet_address_recognition_location_e location; | ||
2164 | enet_addr_container_t *enet_addr_cont; | ||
2165 | struct list_head *p_lh; | ||
2166 | u8 i; | ||
2167 | u32 limit; | ||
2168 | u8 *p_counter; | ||
2169 | |||
2170 | if ((*p_enet_addr)[0] & ENET_GROUP_ADDR) { | ||
2171 | p_lh = &ugeth->group_hash_q; | ||
2172 | limit = ugeth->ug_info->maxGroupAddrInHash; | ||
2173 | location = | ||
2174 | UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_GROUP_HASH; | ||
2175 | p_counter = &(ugeth->numGroupAddrInHash); | ||
2176 | } else { | ||
2177 | p_lh = &ugeth->ind_hash_q; | ||
2178 | limit = ugeth->ug_info->maxIndAddrInHash; | ||
2179 | location = | ||
2180 | UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_INDIVIDUAL_HASH; | ||
2181 | p_counter = &(ugeth->numIndAddrInHash); | ||
2182 | } | ||
2183 | |||
2184 | if ((enet_addr_cont = | ||
2185 | ugeth_82xx_filtering_get_match_addr_in_hash(ugeth, p_enet_addr))) { | ||
2186 | list_add(p_lh, &enet_addr_cont->node); /* Put it back */ | ||
2187 | return 0; | ||
2188 | } | ||
2189 | if ((!p_lh) || (!(*p_counter < limit))) | ||
2190 | return -EBUSY; | ||
2191 | if (!(enet_addr_cont = get_enet_addr_container())) | ||
2192 | return -ENOMEM; | ||
2193 | for (i = 0; i < ENET_NUM_OCTETS_PER_ADDRESS; i++) | ||
2194 | (enet_addr_cont->address)[i] = (*p_enet_addr)[i]; | ||
2195 | enet_addr_cont->location = location; | ||
2196 | enqueue(p_lh, &enet_addr_cont->node); /* Put it back */ | ||
2197 | ++(*p_counter); | ||
2198 | |||
2199 | hw_add_addr_in_hash(ugeth, &(enet_addr_cont->address)); | ||
2200 | |||
2201 | return 0; | ||
2202 | } | ||
2203 | |||
2204 | static int ugeth_82xx_filtering_clear_addr_in_hash(ucc_geth_private_t *ugeth, | ||
2205 | enet_addr_t *p_enet_addr) | ||
2206 | { | ||
2207 | ucc_geth_82xx_address_filtering_pram_t *p_82xx_addr_filt; | ||
2208 | enet_addr_container_t *enet_addr_cont; | ||
2209 | ucc_fast_private_t *uccf; | ||
2210 | comm_dir_e comm_dir; | ||
2211 | u16 i, num; | ||
2212 | struct list_head *p_lh; | ||
2213 | u32 *addr_h, *addr_l; | ||
2214 | u8 *p_counter; | ||
2215 | |||
2216 | uccf = ugeth->uccf; | ||
2217 | |||
2218 | p_82xx_addr_filt = | ||
2219 | (ucc_geth_82xx_address_filtering_pram_t *) ugeth->p_rx_glbl_pram-> | ||
2220 | addressfiltering; | ||
2221 | |||
2222 | if (! | ||
2223 | (enet_addr_cont = | ||
2224 | ugeth_82xx_filtering_get_match_addr_in_hash(ugeth, p_enet_addr))) | ||
2225 | return -ENOENT; | ||
2226 | |||
2227 | /* It's been found and removed from the CQ. */ | ||
2228 | /* Now destroy its container */ | ||
2229 | put_enet_addr_container(enet_addr_cont); | ||
2230 | |||
2231 | if ((*p_enet_addr)[0] & ENET_GROUP_ADDR) { | ||
2232 | addr_h = &(p_82xx_addr_filt->gaddr_h); | ||
2233 | addr_l = &(p_82xx_addr_filt->gaddr_l); | ||
2234 | p_lh = &ugeth->group_hash_q; | ||
2235 | p_counter = &(ugeth->numGroupAddrInHash); | ||
2236 | } else { | ||
2237 | addr_h = &(p_82xx_addr_filt->iaddr_h); | ||
2238 | addr_l = &(p_82xx_addr_filt->iaddr_l); | ||
2239 | p_lh = &ugeth->ind_hash_q; | ||
2240 | p_counter = &(ugeth->numIndAddrInHash); | ||
2241 | } | ||
2242 | |||
2243 | comm_dir = 0; | ||
2244 | if (uccf->enabled_tx) | ||
2245 | comm_dir |= COMM_DIR_TX; | ||
2246 | if (uccf->enabled_rx) | ||
2247 | comm_dir |= COMM_DIR_RX; | ||
2248 | if (comm_dir) | ||
2249 | ugeth_disable(ugeth, comm_dir); | ||
2250 | |||
2251 | /* Clear the hash table. */ | ||
2252 | out_be32(addr_h, 0x00000000); | ||
2253 | out_be32(addr_l, 0x00000000); | ||
2254 | |||
2255 | /* Add all remaining CQ elements back into hash */ | ||
2256 | num = --(*p_counter); | ||
2257 | for (i = 0; i < num; i++) { | ||
2258 | enet_addr_cont = | ||
2259 | (enet_addr_container_t *) | ||
2260 | ENET_ADDR_CONT_ENTRY(dequeue(p_lh)); | ||
2261 | hw_add_addr_in_hash(ugeth, &(enet_addr_cont->address)); | ||
2262 | enqueue(p_lh, &enet_addr_cont->node); /* Put it back */ | ||
2263 | } | ||
2264 | |||
2265 | if (comm_dir) | ||
2266 | ugeth_enable(ugeth, comm_dir); | ||
2267 | |||
2268 | return 0; | ||
2269 | } | ||
2270 | #endif /* CONFIG_UGETH_FILTERING */ | ||
2271 | |||
2272 | static int ugeth_82xx_filtering_clear_all_addr_in_hash(ucc_geth_private_t * | ||
2273 | ugeth, | ||
2274 | enet_addr_type_e | ||
2275 | enet_addr_type) | ||
2276 | { | ||
2277 | ucc_geth_82xx_address_filtering_pram_t *p_82xx_addr_filt; | ||
2278 | ucc_fast_private_t *uccf; | ||
2279 | comm_dir_e comm_dir; | ||
2280 | struct list_head *p_lh; | ||
2281 | u16 i, num; | ||
2282 | u32 *addr_h, *addr_l; | ||
2283 | u8 *p_counter; | ||
2284 | |||
2285 | uccf = ugeth->uccf; | ||
2286 | |||
2287 | p_82xx_addr_filt = | ||
2288 | (ucc_geth_82xx_address_filtering_pram_t *) ugeth->p_rx_glbl_pram-> | ||
2289 | addressfiltering; | ||
2290 | |||
2291 | if (enet_addr_type == ENET_ADDR_TYPE_GROUP) { | ||
2292 | addr_h = &(p_82xx_addr_filt->gaddr_h); | ||
2293 | addr_l = &(p_82xx_addr_filt->gaddr_l); | ||
2294 | p_lh = &ugeth->group_hash_q; | ||
2295 | p_counter = &(ugeth->numGroupAddrInHash); | ||
2296 | } else if (enet_addr_type == ENET_ADDR_TYPE_INDIVIDUAL) { | ||
2297 | addr_h = &(p_82xx_addr_filt->iaddr_h); | ||
2298 | addr_l = &(p_82xx_addr_filt->iaddr_l); | ||
2299 | p_lh = &ugeth->ind_hash_q; | ||
2300 | p_counter = &(ugeth->numIndAddrInHash); | ||
2301 | } else | ||
2302 | return -EINVAL; | ||
2303 | |||
2304 | comm_dir = 0; | ||
2305 | if (uccf->enabled_tx) | ||
2306 | comm_dir |= COMM_DIR_TX; | ||
2307 | if (uccf->enabled_rx) | ||
2308 | comm_dir |= COMM_DIR_RX; | ||
2309 | if (comm_dir) | ||
2310 | ugeth_disable(ugeth, comm_dir); | ||
2311 | |||
2312 | /* Clear the hash table. */ | ||
2313 | out_be32(addr_h, 0x00000000); | ||
2314 | out_be32(addr_l, 0x00000000); | ||
2315 | |||
2316 | if (!p_lh) | ||
2317 | return 0; | ||
2318 | |||
2319 | num = *p_counter; | ||
2320 | |||
2321 | /* Delete all remaining CQ elements */ | ||
2322 | for (i = 0; i < num; i++) | ||
2323 | put_enet_addr_container(ENET_ADDR_CONT_ENTRY(dequeue(p_lh))); | ||
2324 | |||
2325 | *p_counter = 0; | ||
2326 | |||
2327 | if (comm_dir) | ||
2328 | ugeth_enable(ugeth, comm_dir); | ||
2329 | |||
2330 | return 0; | ||
2331 | } | ||
2332 | |||
2333 | #ifdef CONFIG_UGETH_FILTERING | ||
2334 | static int ugeth_82xx_filtering_add_addr_in_paddr(ucc_geth_private_t *ugeth, | ||
2335 | enet_addr_t *p_enet_addr, | ||
2336 | u8 paddr_num) | ||
2337 | { | ||
2338 | int i; | ||
2339 | |||
2340 | if ((*p_enet_addr)[0] & ENET_GROUP_ADDR) | ||
2341 | ugeth_warn | ||
2342 | ("%s: multicast address added to paddr will have no " | ||
2343 | "effect - is this what you wanted?", | ||
2344 | __FUNCTION__); | ||
2345 | |||
2346 | ugeth->indAddrRegUsed[paddr_num] = 1; /* mark this paddr as used */ | ||
2347 | /* store address in our database */ | ||
2348 | for (i = 0; i < ENET_NUM_OCTETS_PER_ADDRESS; i++) | ||
2349 | ugeth->paddr[paddr_num][i] = (*p_enet_addr)[i]; | ||
2350 | /* put in hardware */ | ||
2351 | return hw_add_addr_in_paddr(ugeth, p_enet_addr, paddr_num); | ||
2352 | } | ||
2353 | #endif /* CONFIG_UGETH_FILTERING */ | ||
2354 | |||
2355 | static int ugeth_82xx_filtering_clear_addr_in_paddr(ucc_geth_private_t *ugeth, | ||
2356 | u8 paddr_num) | ||
2357 | { | ||
2358 | ugeth->indAddrRegUsed[paddr_num] = 0; /* mark this paddr as not used */ | ||
2359 | return hw_clear_addr_in_paddr(ugeth, paddr_num);/* clear in hardware */ | ||
2360 | } | ||
2361 | |||
2362 | static void ucc_geth_memclean(ucc_geth_private_t *ugeth) | ||
2363 | { | ||
2364 | u16 i, j; | ||
2365 | u8 *bd; | ||
2366 | |||
2367 | if (!ugeth) | ||
2368 | return; | ||
2369 | |||
2370 | if (ugeth->uccf) | ||
2371 | ucc_fast_free(ugeth->uccf); | ||
2372 | |||
2373 | if (ugeth->p_thread_data_tx) { | ||
2374 | qe_muram_free(ugeth->thread_dat_tx_offset); | ||
2375 | ugeth->p_thread_data_tx = NULL; | ||
2376 | } | ||
2377 | if (ugeth->p_thread_data_rx) { | ||
2378 | qe_muram_free(ugeth->thread_dat_rx_offset); | ||
2379 | ugeth->p_thread_data_rx = NULL; | ||
2380 | } | ||
2381 | if (ugeth->p_exf_glbl_param) { | ||
2382 | qe_muram_free(ugeth->exf_glbl_param_offset); | ||
2383 | ugeth->p_exf_glbl_param = NULL; | ||
2384 | } | ||
2385 | if (ugeth->p_rx_glbl_pram) { | ||
2386 | qe_muram_free(ugeth->rx_glbl_pram_offset); | ||
2387 | ugeth->p_rx_glbl_pram = NULL; | ||
2388 | } | ||
2389 | if (ugeth->p_tx_glbl_pram) { | ||
2390 | qe_muram_free(ugeth->tx_glbl_pram_offset); | ||
2391 | ugeth->p_tx_glbl_pram = NULL; | ||
2392 | } | ||
2393 | if (ugeth->p_send_q_mem_reg) { | ||
2394 | qe_muram_free(ugeth->send_q_mem_reg_offset); | ||
2395 | ugeth->p_send_q_mem_reg = NULL; | ||
2396 | } | ||
2397 | if (ugeth->p_scheduler) { | ||
2398 | qe_muram_free(ugeth->scheduler_offset); | ||
2399 | ugeth->p_scheduler = NULL; | ||
2400 | } | ||
2401 | if (ugeth->p_tx_fw_statistics_pram) { | ||
2402 | qe_muram_free(ugeth->tx_fw_statistics_pram_offset); | ||
2403 | ugeth->p_tx_fw_statistics_pram = NULL; | ||
2404 | } | ||
2405 | if (ugeth->p_rx_fw_statistics_pram) { | ||
2406 | qe_muram_free(ugeth->rx_fw_statistics_pram_offset); | ||
2407 | ugeth->p_rx_fw_statistics_pram = NULL; | ||
2408 | } | ||
2409 | if (ugeth->p_rx_irq_coalescing_tbl) { | ||
2410 | qe_muram_free(ugeth->rx_irq_coalescing_tbl_offset); | ||
2411 | ugeth->p_rx_irq_coalescing_tbl = NULL; | ||
2412 | } | ||
2413 | if (ugeth->p_rx_bd_qs_tbl) { | ||
2414 | qe_muram_free(ugeth->rx_bd_qs_tbl_offset); | ||
2415 | ugeth->p_rx_bd_qs_tbl = NULL; | ||
2416 | } | ||
2417 | if (ugeth->p_init_enet_param_shadow) { | ||
2418 | return_init_enet_entries(ugeth, | ||
2419 | &(ugeth->p_init_enet_param_shadow-> | ||
2420 | rxthread[0]), | ||
2421 | ENET_INIT_PARAM_MAX_ENTRIES_RX, | ||
2422 | ugeth->ug_info->riscRx, 1); | ||
2423 | return_init_enet_entries(ugeth, | ||
2424 | &(ugeth->p_init_enet_param_shadow-> | ||
2425 | txthread[0]), | ||
2426 | ENET_INIT_PARAM_MAX_ENTRIES_TX, | ||
2427 | ugeth->ug_info->riscTx, 0); | ||
2428 | kfree(ugeth->p_init_enet_param_shadow); | ||
2429 | ugeth->p_init_enet_param_shadow = NULL; | ||
2430 | } | ||
2431 | for (i = 0; i < ugeth->ug_info->numQueuesTx; i++) { | ||
2432 | bd = ugeth->p_tx_bd_ring[i]; | ||
2433 | for (j = 0; j < ugeth->ug_info->bdRingLenTx[i]; j++) { | ||
2434 | if (ugeth->tx_skbuff[i][j]) { | ||
2435 | dma_unmap_single(NULL, | ||
2436 | BD_BUFFER_ARG(bd), | ||
2437 | (BD_STATUS_AND_LENGTH(bd) & | ||
2438 | BD_LENGTH_MASK), | ||
2439 | DMA_TO_DEVICE); | ||
2440 | dev_kfree_skb_any(ugeth->tx_skbuff[i][j]); | ||
2441 | ugeth->tx_skbuff[i][j] = NULL; | ||
2442 | } | ||
2443 | } | ||
2444 | |||
2445 | kfree(ugeth->tx_skbuff[i]); | ||
2446 | |||
2447 | if (ugeth->p_tx_bd_ring[i]) { | ||
2448 | if (ugeth->ug_info->uf_info.bd_mem_part == | ||
2449 | MEM_PART_SYSTEM) | ||
2450 | kfree((void *)ugeth->tx_bd_ring_offset[i]); | ||
2451 | else if (ugeth->ug_info->uf_info.bd_mem_part == | ||
2452 | MEM_PART_MURAM) | ||
2453 | qe_muram_free(ugeth->tx_bd_ring_offset[i]); | ||
2454 | ugeth->p_tx_bd_ring[i] = NULL; | ||
2455 | } | ||
2456 | } | ||
2457 | for (i = 0; i < ugeth->ug_info->numQueuesRx; i++) { | ||
2458 | if (ugeth->p_rx_bd_ring[i]) { | ||
2459 | /* Return existing data buffers in ring */ | ||
2460 | bd = ugeth->p_rx_bd_ring[i]; | ||
2461 | for (j = 0; j < ugeth->ug_info->bdRingLenRx[i]; j++) { | ||
2462 | if (ugeth->rx_skbuff[i][j]) { | ||
2463 | dma_unmap_single(NULL, BD_BUFFER(bd), | ||
2464 | ugeth->ug_info-> | ||
2465 | uf_info. | ||
2466 | max_rx_buf_length + | ||
2467 | UCC_GETH_RX_DATA_BUF_ALIGNMENT, | ||
2468 | DMA_FROM_DEVICE); | ||
2469 | |||
2470 | dev_kfree_skb_any(ugeth-> | ||
2471 | rx_skbuff[i][j]); | ||
2472 | ugeth->rx_skbuff[i][j] = NULL; | ||
2473 | } | ||
2474 | bd += UCC_GETH_SIZE_OF_BD; | ||
2475 | } | ||
2476 | |||
2477 | kfree(ugeth->rx_skbuff[i]); | ||
2478 | |||
2479 | if (ugeth->ug_info->uf_info.bd_mem_part == | ||
2480 | MEM_PART_SYSTEM) | ||
2481 | kfree((void *)ugeth->rx_bd_ring_offset[i]); | ||
2482 | else if (ugeth->ug_info->uf_info.bd_mem_part == | ||
2483 | MEM_PART_MURAM) | ||
2484 | qe_muram_free(ugeth->rx_bd_ring_offset[i]); | ||
2485 | ugeth->p_rx_bd_ring[i] = NULL; | ||
2486 | } | ||
2487 | } | ||
2488 | while (!list_empty(&ugeth->group_hash_q)) | ||
2489 | put_enet_addr_container(ENET_ADDR_CONT_ENTRY | ||
2490 | (dequeue(&ugeth->group_hash_q))); | ||
2491 | while (!list_empty(&ugeth->ind_hash_q)) | ||
2492 | put_enet_addr_container(ENET_ADDR_CONT_ENTRY | ||
2493 | (dequeue(&ugeth->ind_hash_q))); | ||
2494 | |||
2495 | } | ||
2496 | |||
2497 | static void ucc_geth_set_multi(struct net_device *dev) | ||
2498 | { | ||
2499 | ucc_geth_private_t *ugeth; | ||
2500 | struct dev_mc_list *dmi; | ||
2501 | ucc_fast_t *uf_regs; | ||
2502 | ucc_geth_82xx_address_filtering_pram_t *p_82xx_addr_filt; | ||
2503 | enet_addr_t tempaddr; | ||
2504 | u8 *mcptr, *tdptr; | ||
2505 | int i, j; | ||
2506 | |||
2507 | ugeth = netdev_priv(dev); | ||
2508 | |||
2509 | uf_regs = ugeth->uccf->uf_regs; | ||
2510 | |||
2511 | if (dev->flags & IFF_PROMISC) { | ||
2512 | |||
2513 | /* Log any net taps. */ | ||
2514 | printk("%s: Promiscuous mode enabled.\n", dev->name); | ||
2515 | uf_regs->upsmr |= UPSMR_PRO; | ||
2516 | |||
2517 | } else { | ||
2518 | |||
2519 | uf_regs->upsmr &= ~UPSMR_PRO; | ||
2520 | |||
2521 | p_82xx_addr_filt = | ||
2522 | (ucc_geth_82xx_address_filtering_pram_t *) ugeth-> | ||
2523 | p_rx_glbl_pram->addressfiltering; | ||
2524 | |||
2525 | if (dev->flags & IFF_ALLMULTI) { | ||
2526 | /* Catch all multicast addresses, so set the | ||
2527 | * filter to all 1's. | ||
2528 | */ | ||
2529 | out_be32(&p_82xx_addr_filt->gaddr_h, 0xffffffff); | ||
2530 | out_be32(&p_82xx_addr_filt->gaddr_l, 0xffffffff); | ||
2531 | } else { | ||
2532 | /* Clear filter and add the addresses in the list. | ||
2533 | */ | ||
2534 | out_be32(&p_82xx_addr_filt->gaddr_h, 0x0); | ||
2535 | out_be32(&p_82xx_addr_filt->gaddr_l, 0x0); | ||
2536 | |||
2537 | dmi = dev->mc_list; | ||
2538 | |||
2539 | for (i = 0; i < dev->mc_count; i++, dmi = dmi->next) { | ||
2540 | |||
2541 | /* Only support group multicast for now. | ||
2542 | */ | ||
2543 | if (!(dmi->dmi_addr[0] & 1)) | ||
2544 | continue; | ||
2545 | |||
2546 | /* The address in dmi_addr is LSB first, | ||
2547 | * and taddr is MSB first. We have to | ||
2548 | * copy bytes MSB first from dmi_addr. | ||
2549 | */ | ||
2550 | mcptr = (u8 *) dmi->dmi_addr + 5; | ||
2551 | tdptr = (u8 *) & tempaddr; | ||
2552 | for (j = 0; j < 6; j++) | ||
2553 | *tdptr++ = *mcptr--; | ||
2554 | |||
2555 | /* Ask CPM to run CRC and set bit in | ||
2556 | * filter mask. | ||
2557 | */ | ||
2558 | hw_add_addr_in_hash(ugeth, &tempaddr); | ||
2559 | |||
2560 | } | ||
2561 | } | ||
2562 | } | ||
2563 | } | ||
2564 | |||
2565 | static void ucc_geth_stop(ucc_geth_private_t *ugeth) | ||
2566 | { | ||
2567 | ucc_geth_t *ug_regs = ugeth->ug_regs; | ||
2568 | u32 tempval; | ||
2569 | |||
2570 | ugeth_vdbg("%s: IN", __FUNCTION__); | ||
2571 | |||
2572 | /* Disable the controller */ | ||
2573 | ugeth_disable(ugeth, COMM_DIR_RX_AND_TX); | ||
2574 | |||
2575 | /* Tell the kernel the link is down */ | ||
2576 | ugeth->mii_info->link = 0; | ||
2577 | adjust_link(ugeth->dev); | ||
2578 | |||
2579 | /* Mask all interrupts */ | ||
2580 | out_be32(ugeth->uccf->p_ucce, 0x00000000); | ||
2581 | |||
2582 | /* Clear all interrupts */ | ||
2583 | out_be32(ugeth->uccf->p_ucce, 0xffffffff); | ||
2584 | |||
2585 | /* Disable Rx and Tx */ | ||
2586 | tempval = in_be32(&ug_regs->maccfg1); | ||
2587 | tempval &= ~(MACCFG1_ENABLE_RX | MACCFG1_ENABLE_TX); | ||
2588 | out_be32(&ug_regs->maccfg1, tempval); | ||
2589 | |||
2590 | if (ugeth->ug_info->board_flags & FSL_UGETH_BRD_HAS_PHY_INTR) { | ||
2591 | /* Clear any pending interrupts */ | ||
2592 | mii_clear_phy_interrupt(ugeth->mii_info); | ||
2593 | |||
2594 | /* Disable PHY Interrupts */ | ||
2595 | mii_configure_phy_interrupt(ugeth->mii_info, | ||
2596 | MII_INTERRUPT_DISABLED); | ||
2597 | } | ||
2598 | |||
2599 | free_irq(ugeth->ug_info->uf_info.irq, ugeth->dev); | ||
2600 | |||
2601 | if (ugeth->ug_info->board_flags & FSL_UGETH_BRD_HAS_PHY_INTR) { | ||
2602 | free_irq(ugeth->ug_info->phy_interrupt, ugeth->dev); | ||
2603 | } else { | ||
2604 | del_timer_sync(&ugeth->phy_info_timer); | ||
2605 | } | ||
2606 | |||
2607 | ucc_geth_memclean(ugeth); | ||
2608 | } | ||
2609 | |||
2610 | static int ucc_geth_startup(ucc_geth_private_t *ugeth) | ||
2611 | { | ||
2612 | ucc_geth_82xx_address_filtering_pram_t *p_82xx_addr_filt; | ||
2613 | ucc_geth_init_pram_t *p_init_enet_pram; | ||
2614 | ucc_fast_private_t *uccf; | ||
2615 | ucc_geth_info_t *ug_info; | ||
2616 | ucc_fast_info_t *uf_info; | ||
2617 | ucc_fast_t *uf_regs; | ||
2618 | ucc_geth_t *ug_regs; | ||
2619 | int ret_val = -EINVAL; | ||
2620 | u32 remoder = UCC_GETH_REMODER_INIT; | ||
2621 | u32 init_enet_pram_offset, cecr_subblock, command, maccfg1; | ||
2622 | u32 ifstat, i, j, size, l2qt, l3qt, length; | ||
2623 | u16 temoder = UCC_GETH_TEMODER_INIT; | ||
2624 | u16 test; | ||
2625 | u8 function_code = 0; | ||
2626 | u8 *bd, *endOfRing; | ||
2627 | u8 numThreadsRxNumerical, numThreadsTxNumerical; | ||
2628 | |||
2629 | ugeth_vdbg("%s: IN", __FUNCTION__); | ||
2630 | |||
2631 | ug_info = ugeth->ug_info; | ||
2632 | uf_info = &ug_info->uf_info; | ||
2633 | |||
2634 | if (!((uf_info->bd_mem_part == MEM_PART_SYSTEM) || | ||
2635 | (uf_info->bd_mem_part == MEM_PART_MURAM))) { | ||
2636 | ugeth_err("%s: Bad memory partition value.", __FUNCTION__); | ||
2637 | return -EINVAL; | ||
2638 | } | ||
2639 | |||
2640 | /* Rx BD lengths */ | ||
2641 | for (i = 0; i < ug_info->numQueuesRx; i++) { | ||
2642 | if ((ug_info->bdRingLenRx[i] < UCC_GETH_RX_BD_RING_SIZE_MIN) || | ||
2643 | (ug_info->bdRingLenRx[i] % | ||
2644 | UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT)) { | ||
2645 | ugeth_err | ||
2646 | ("%s: Rx BD ring length must be multiple of 4," | ||
2647 | " no smaller than 8.", __FUNCTION__); | ||
2648 | return -EINVAL; | ||
2649 | } | ||
2650 | } | ||
2651 | |||
2652 | /* Tx BD lengths */ | ||
2653 | for (i = 0; i < ug_info->numQueuesTx; i++) { | ||
2654 | if (ug_info->bdRingLenTx[i] < UCC_GETH_TX_BD_RING_SIZE_MIN) { | ||
2655 | ugeth_err | ||
2656 | ("%s: Tx BD ring length must be no smaller than 2.", | ||
2657 | __FUNCTION__); | ||
2658 | return -EINVAL; | ||
2659 | } | ||
2660 | } | ||
2661 | |||
2662 | /* mrblr */ | ||
2663 | if ((uf_info->max_rx_buf_length == 0) || | ||
2664 | (uf_info->max_rx_buf_length % UCC_GETH_MRBLR_ALIGNMENT)) { | ||
2665 | ugeth_err | ||
2666 | ("%s: max_rx_buf_length must be non-zero multiple of 128.", | ||
2667 | __FUNCTION__); | ||
2668 | return -EINVAL; | ||
2669 | } | ||
2670 | |||
2671 | /* num Tx queues */ | ||
2672 | if (ug_info->numQueuesTx > NUM_TX_QUEUES) { | ||
2673 | ugeth_err("%s: number of tx queues too large.", __FUNCTION__); | ||
2674 | return -EINVAL; | ||
2675 | } | ||
2676 | |||
2677 | /* num Rx queues */ | ||
2678 | if (ug_info->numQueuesRx > NUM_RX_QUEUES) { | ||
2679 | ugeth_err("%s: number of rx queues too large.", __FUNCTION__); | ||
2680 | return -EINVAL; | ||
2681 | } | ||
2682 | |||
2683 | /* l2qt */ | ||
2684 | for (i = 0; i < UCC_GETH_VLAN_PRIORITY_MAX; i++) { | ||
2685 | if (ug_info->l2qt[i] >= ug_info->numQueuesRx) { | ||
2686 | ugeth_err | ||
2687 | ("%s: VLAN priority table entry must not be" | ||
2688 | " larger than number of Rx queues.", | ||
2689 | __FUNCTION__); | ||
2690 | return -EINVAL; | ||
2691 | } | ||
2692 | } | ||
2693 | |||
2694 | /* l3qt */ | ||
2695 | for (i = 0; i < UCC_GETH_IP_PRIORITY_MAX; i++) { | ||
2696 | if (ug_info->l3qt[i] >= ug_info->numQueuesRx) { | ||
2697 | ugeth_err | ||
2698 | ("%s: IP priority table entry must not be" | ||
2699 | " larger than number of Rx queues.", | ||
2700 | __FUNCTION__); | ||
2701 | return -EINVAL; | ||
2702 | } | ||
2703 | } | ||
2704 | |||
2705 | if (ug_info->cam && !ug_info->ecamptr) { | ||
2706 | ugeth_err("%s: If cam mode is chosen, must supply cam ptr.", | ||
2707 | __FUNCTION__); | ||
2708 | return -EINVAL; | ||
2709 | } | ||
2710 | |||
2711 | if ((ug_info->numStationAddresses != | ||
2712 | UCC_GETH_NUM_OF_STATION_ADDRESSES_1) | ||
2713 | && ug_info->rxExtendedFiltering) { | ||
2714 | ugeth_err("%s: Number of station addresses greater than 1 " | ||
2715 | "not allowed in extended parsing mode.", | ||
2716 | __FUNCTION__); | ||
2717 | return -EINVAL; | ||
2718 | } | ||
2719 | |||
2720 | /* Generate uccm_mask for receive */ | ||
2721 | uf_info->uccm_mask = ug_info->eventRegMask & UCCE_OTHER;/* Errors */ | ||
2722 | for (i = 0; i < ug_info->numQueuesRx; i++) | ||
2723 | uf_info->uccm_mask |= (UCCE_RXBF_SINGLE_MASK << i); | ||
2724 | |||
2725 | for (i = 0; i < ug_info->numQueuesTx; i++) | ||
2726 | uf_info->uccm_mask |= (UCCE_TXBF_SINGLE_MASK << i); | ||
2727 | /* Initialize the general fast UCC block. */ | ||
2728 | if (ucc_fast_init(uf_info, &uccf)) { | ||
2729 | ugeth_err("%s: Failed to init uccf.", __FUNCTION__); | ||
2730 | ucc_geth_memclean(ugeth); | ||
2731 | return -ENOMEM; | ||
2732 | } | ||
2733 | ugeth->uccf = uccf; | ||
2734 | |||
2735 | switch (ug_info->numThreadsRx) { | ||
2736 | case UCC_GETH_NUM_OF_THREADS_1: | ||
2737 | numThreadsRxNumerical = 1; | ||
2738 | break; | ||
2739 | case UCC_GETH_NUM_OF_THREADS_2: | ||
2740 | numThreadsRxNumerical = 2; | ||
2741 | break; | ||
2742 | case UCC_GETH_NUM_OF_THREADS_4: | ||
2743 | numThreadsRxNumerical = 4; | ||
2744 | break; | ||
2745 | case UCC_GETH_NUM_OF_THREADS_6: | ||
2746 | numThreadsRxNumerical = 6; | ||
2747 | break; | ||
2748 | case UCC_GETH_NUM_OF_THREADS_8: | ||
2749 | numThreadsRxNumerical = 8; | ||
2750 | break; | ||
2751 | default: | ||
2752 | ugeth_err("%s: Bad number of Rx threads value.", __FUNCTION__); | ||
2753 | ucc_geth_memclean(ugeth); | ||
2754 | return -EINVAL; | ||
2755 | break; | ||
2756 | } | ||
2757 | |||
2758 | switch (ug_info->numThreadsTx) { | ||
2759 | case UCC_GETH_NUM_OF_THREADS_1: | ||
2760 | numThreadsTxNumerical = 1; | ||
2761 | break; | ||
2762 | case UCC_GETH_NUM_OF_THREADS_2: | ||
2763 | numThreadsTxNumerical = 2; | ||
2764 | break; | ||
2765 | case UCC_GETH_NUM_OF_THREADS_4: | ||
2766 | numThreadsTxNumerical = 4; | ||
2767 | break; | ||
2768 | case UCC_GETH_NUM_OF_THREADS_6: | ||
2769 | numThreadsTxNumerical = 6; | ||
2770 | break; | ||
2771 | case UCC_GETH_NUM_OF_THREADS_8: | ||
2772 | numThreadsTxNumerical = 8; | ||
2773 | break; | ||
2774 | default: | ||
2775 | ugeth_err("%s: Bad number of Tx threads value.", __FUNCTION__); | ||
2776 | ucc_geth_memclean(ugeth); | ||
2777 | return -EINVAL; | ||
2778 | break; | ||
2779 | } | ||
2780 | |||
2781 | /* Calculate rx_extended_features */ | ||
2782 | ugeth->rx_non_dynamic_extended_features = ug_info->ipCheckSumCheck || | ||
2783 | ug_info->ipAddressAlignment || | ||
2784 | (ug_info->numStationAddresses != | ||
2785 | UCC_GETH_NUM_OF_STATION_ADDRESSES_1); | ||
2786 | |||
2787 | ugeth->rx_extended_features = ugeth->rx_non_dynamic_extended_features || | ||
2788 | (ug_info->vlanOperationTagged != UCC_GETH_VLAN_OPERATION_TAGGED_NOP) | ||
2789 | || (ug_info->vlanOperationNonTagged != | ||
2790 | UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP); | ||
2791 | |||
2792 | uf_regs = uccf->uf_regs; | ||
2793 | ug_regs = (ucc_geth_t *) (uccf->uf_regs); | ||
2794 | ugeth->ug_regs = ug_regs; | ||
2795 | |||
2796 | init_default_reg_vals(&uf_regs->upsmr, | ||
2797 | &ug_regs->maccfg1, &ug_regs->maccfg2); | ||
2798 | |||
2799 | /* Set UPSMR */ | ||
2800 | /* For more details see the hardware spec. */ | ||
2801 | init_rx_parameters(ug_info->bro, | ||
2802 | ug_info->rsh, ug_info->pro, &uf_regs->upsmr); | ||
2803 | |||
2804 | /* We're going to ignore other registers for now, */ | ||
2805 | /* except as needed to get up and running */ | ||
2806 | |||
2807 | /* Set MACCFG1 */ | ||
2808 | /* For more details see the hardware spec. */ | ||
2809 | init_flow_control_params(ug_info->aufc, | ||
2810 | ug_info->receiveFlowControl, | ||
2811 | 1, | ||
2812 | ug_info->pausePeriod, | ||
2813 | ug_info->extensionField, | ||
2814 | &uf_regs->upsmr, | ||
2815 | &ug_regs->uempr, &ug_regs->maccfg1); | ||
2816 | |||
2817 | maccfg1 = in_be32(&ug_regs->maccfg1); | ||
2818 | maccfg1 |= MACCFG1_ENABLE_RX; | ||
2819 | maccfg1 |= MACCFG1_ENABLE_TX; | ||
2820 | out_be32(&ug_regs->maccfg1, maccfg1); | ||
2821 | |||
2822 | /* Set IPGIFG */ | ||
2823 | /* For more details see the hardware spec. */ | ||
2824 | ret_val = init_inter_frame_gap_params(ug_info->nonBackToBackIfgPart1, | ||
2825 | ug_info->nonBackToBackIfgPart2, | ||
2826 | ug_info-> | ||
2827 | miminumInterFrameGapEnforcement, | ||
2828 | ug_info->backToBackInterFrameGap, | ||
2829 | &ug_regs->ipgifg); | ||
2830 | if (ret_val != 0) { | ||
2831 | ugeth_err("%s: IPGIFG initialization parameter too large.", | ||
2832 | __FUNCTION__); | ||
2833 | ucc_geth_memclean(ugeth); | ||
2834 | return ret_val; | ||
2835 | } | ||
2836 | |||
2837 | /* Set HAFDUP */ | ||
2838 | /* For more details see the hardware spec. */ | ||
2839 | ret_val = init_half_duplex_params(ug_info->altBeb, | ||
2840 | ug_info->backPressureNoBackoff, | ||
2841 | ug_info->noBackoff, | ||
2842 | ug_info->excessDefer, | ||
2843 | ug_info->altBebTruncation, | ||
2844 | ug_info->maxRetransmission, | ||
2845 | ug_info->collisionWindow, | ||
2846 | &ug_regs->hafdup); | ||
2847 | if (ret_val != 0) { | ||
2848 | ugeth_err("%s: Half Duplex initialization parameter too large.", | ||
2849 | __FUNCTION__); | ||
2850 | ucc_geth_memclean(ugeth); | ||
2851 | return ret_val; | ||
2852 | } | ||
2853 | |||
2854 | /* Set IFSTAT */ | ||
2855 | /* For more details see the hardware spec. */ | ||
2856 | /* Read only - resets upon read */ | ||
2857 | ifstat = in_be32(&ug_regs->ifstat); | ||
2858 | |||
2859 | /* Clear UEMPR */ | ||
2860 | /* For more details see the hardware spec. */ | ||
2861 | out_be32(&ug_regs->uempr, 0); | ||
2862 | |||
2863 | /* Set UESCR */ | ||
2864 | /* For more details see the hardware spec. */ | ||
2865 | init_hw_statistics_gathering_mode((ug_info->statisticsMode & | ||
2866 | UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE), | ||
2867 | 0, &uf_regs->upsmr, &ug_regs->uescr); | ||
2868 | |||
2869 | /* Allocate Tx bds */ | ||
2870 | for (j = 0; j < ug_info->numQueuesTx; j++) { | ||
2871 | /* Allocate in multiple of | ||
2872 | UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT, | ||
2873 | according to spec */ | ||
2874 | length = ((ug_info->bdRingLenTx[j] * UCC_GETH_SIZE_OF_BD) | ||
2875 | / UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT) | ||
2876 | * UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT; | ||
2877 | if ((ug_info->bdRingLenTx[j] * UCC_GETH_SIZE_OF_BD) % | ||
2878 | UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT) | ||
2879 | length += UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT; | ||
2880 | if (uf_info->bd_mem_part == MEM_PART_SYSTEM) { | ||
2881 | u32 align = 4; | ||
2882 | if (UCC_GETH_TX_BD_RING_ALIGNMENT > 4) | ||
2883 | align = UCC_GETH_TX_BD_RING_ALIGNMENT; | ||
2884 | ugeth->tx_bd_ring_offset[j] = | ||
2885 | (u32) (kmalloc((u32) (length + align), | ||
2886 | GFP_KERNEL)); | ||
2887 | if (ugeth->tx_bd_ring_offset[j] != 0) | ||
2888 | ugeth->p_tx_bd_ring[j] = | ||
2889 | (void*)((ugeth->tx_bd_ring_offset[j] + | ||
2890 | align) & ~(align - 1)); | ||
2891 | } else if (uf_info->bd_mem_part == MEM_PART_MURAM) { | ||
2892 | ugeth->tx_bd_ring_offset[j] = | ||
2893 | qe_muram_alloc(length, | ||
2894 | UCC_GETH_TX_BD_RING_ALIGNMENT); | ||
2895 | if (!IS_MURAM_ERR(ugeth->tx_bd_ring_offset[j])) | ||
2896 | ugeth->p_tx_bd_ring[j] = | ||
2897 | (u8 *) qe_muram_addr(ugeth-> | ||
2898 | tx_bd_ring_offset[j]); | ||
2899 | } | ||
2900 | if (!ugeth->p_tx_bd_ring[j]) { | ||
2901 | ugeth_err | ||
2902 | ("%s: Can not allocate memory for Tx bd rings.", | ||
2903 | __FUNCTION__); | ||
2904 | ucc_geth_memclean(ugeth); | ||
2905 | return -ENOMEM; | ||
2906 | } | ||
2907 | /* Zero unused end of bd ring, according to spec */ | ||
2908 | memset(ugeth->p_tx_bd_ring[j] + | ||
2909 | ug_info->bdRingLenTx[j] * UCC_GETH_SIZE_OF_BD, 0, | ||
2910 | length - ug_info->bdRingLenTx[j] * UCC_GETH_SIZE_OF_BD); | ||
2911 | } | ||
2912 | |||
2913 | /* Allocate Rx bds */ | ||
2914 | for (j = 0; j < ug_info->numQueuesRx; j++) { | ||
2915 | length = ug_info->bdRingLenRx[j] * UCC_GETH_SIZE_OF_BD; | ||
2916 | if (uf_info->bd_mem_part == MEM_PART_SYSTEM) { | ||
2917 | u32 align = 4; | ||
2918 | if (UCC_GETH_RX_BD_RING_ALIGNMENT > 4) | ||
2919 | align = UCC_GETH_RX_BD_RING_ALIGNMENT; | ||
2920 | ugeth->rx_bd_ring_offset[j] = | ||
2921 | (u32) (kmalloc((u32) (length + align), GFP_KERNEL)); | ||
2922 | if (ugeth->rx_bd_ring_offset[j] != 0) | ||
2923 | ugeth->p_rx_bd_ring[j] = | ||
2924 | (void*)((ugeth->rx_bd_ring_offset[j] + | ||
2925 | align) & ~(align - 1)); | ||
2926 | } else if (uf_info->bd_mem_part == MEM_PART_MURAM) { | ||
2927 | ugeth->rx_bd_ring_offset[j] = | ||
2928 | qe_muram_alloc(length, | ||
2929 | UCC_GETH_RX_BD_RING_ALIGNMENT); | ||
2930 | if (!IS_MURAM_ERR(ugeth->rx_bd_ring_offset[j])) | ||
2931 | ugeth->p_rx_bd_ring[j] = | ||
2932 | (u8 *) qe_muram_addr(ugeth-> | ||
2933 | rx_bd_ring_offset[j]); | ||
2934 | } | ||
2935 | if (!ugeth->p_rx_bd_ring[j]) { | ||
2936 | ugeth_err | ||
2937 | ("%s: Can not allocate memory for Rx bd rings.", | ||
2938 | __FUNCTION__); | ||
2939 | ucc_geth_memclean(ugeth); | ||
2940 | return -ENOMEM; | ||
2941 | } | ||
2942 | } | ||
2943 | |||
2944 | /* Init Tx bds */ | ||
2945 | for (j = 0; j < ug_info->numQueuesTx; j++) { | ||
2946 | /* Setup the skbuff rings */ | ||
2947 | ugeth->tx_skbuff[j] = | ||
2948 | (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) * | ||
2949 | ugeth->ug_info->bdRingLenTx[j], | ||
2950 | GFP_KERNEL); | ||
2951 | |||
2952 | if (ugeth->tx_skbuff[j] == NULL) { | ||
2953 | ugeth_err("%s: Could not allocate tx_skbuff", | ||
2954 | __FUNCTION__); | ||
2955 | ucc_geth_memclean(ugeth); | ||
2956 | return -ENOMEM; | ||
2957 | } | ||
2958 | |||
2959 | for (i = 0; i < ugeth->ug_info->bdRingLenTx[j]; i++) | ||
2960 | ugeth->tx_skbuff[j][i] = NULL; | ||
2961 | |||
2962 | ugeth->skb_curtx[j] = ugeth->skb_dirtytx[j] = 0; | ||
2963 | bd = ugeth->confBd[j] = ugeth->txBd[j] = ugeth->p_tx_bd_ring[j]; | ||
2964 | for (i = 0; i < ug_info->bdRingLenTx[j]; i++) { | ||
2965 | BD_BUFFER_CLEAR(bd); | ||
2966 | BD_STATUS_AND_LENGTH_SET(bd, 0); | ||
2967 | bd += UCC_GETH_SIZE_OF_BD; | ||
2968 | } | ||
2969 | bd -= UCC_GETH_SIZE_OF_BD; | ||
2970 | BD_STATUS_AND_LENGTH_SET(bd, T_W);/* for last BD set Wrap bit */ | ||
2971 | } | ||
2972 | |||
2973 | /* Init Rx bds */ | ||
2974 | for (j = 0; j < ug_info->numQueuesRx; j++) { | ||
2975 | /* Setup the skbuff rings */ | ||
2976 | ugeth->rx_skbuff[j] = | ||
2977 | (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) * | ||
2978 | ugeth->ug_info->bdRingLenRx[j], | ||
2979 | GFP_KERNEL); | ||
2980 | |||
2981 | if (ugeth->rx_skbuff[j] == NULL) { | ||
2982 | ugeth_err("%s: Could not allocate rx_skbuff", | ||
2983 | __FUNCTION__); | ||
2984 | ucc_geth_memclean(ugeth); | ||
2985 | return -ENOMEM; | ||
2986 | } | ||
2987 | |||
2988 | for (i = 0; i < ugeth->ug_info->bdRingLenRx[j]; i++) | ||
2989 | ugeth->rx_skbuff[j][i] = NULL; | ||
2990 | |||
2991 | ugeth->skb_currx[j] = 0; | ||
2992 | bd = ugeth->rxBd[j] = ugeth->p_rx_bd_ring[j]; | ||
2993 | for (i = 0; i < ug_info->bdRingLenRx[j]; i++) { | ||
2994 | BD_STATUS_AND_LENGTH_SET(bd, R_I); | ||
2995 | BD_BUFFER_CLEAR(bd); | ||
2996 | bd += UCC_GETH_SIZE_OF_BD; | ||
2997 | } | ||
2998 | bd -= UCC_GETH_SIZE_OF_BD; | ||
2999 | BD_STATUS_AND_LENGTH_SET(bd, R_W);/* for last BD set Wrap bit */ | ||
3000 | } | ||
3001 | |||
3002 | /* | ||
3003 | * Global PRAM | ||
3004 | */ | ||
3005 | /* Tx global PRAM */ | ||
3006 | /* Allocate global tx parameter RAM page */ | ||
3007 | ugeth->tx_glbl_pram_offset = | ||
3008 | qe_muram_alloc(sizeof(ucc_geth_tx_global_pram_t), | ||
3009 | UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT); | ||
3010 | if (IS_MURAM_ERR(ugeth->tx_glbl_pram_offset)) { | ||
3011 | ugeth_err | ||
3012 | ("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.", | ||
3013 | __FUNCTION__); | ||
3014 | ucc_geth_memclean(ugeth); | ||
3015 | return -ENOMEM; | ||
3016 | } | ||
3017 | ugeth->p_tx_glbl_pram = | ||
3018 | (ucc_geth_tx_global_pram_t *) qe_muram_addr(ugeth-> | ||
3019 | tx_glbl_pram_offset); | ||
3020 | /* Zero out p_tx_glbl_pram */ | ||
3021 | memset(ugeth->p_tx_glbl_pram, 0, sizeof(ucc_geth_tx_global_pram_t)); | ||
3022 | |||
3023 | /* Fill global PRAM */ | ||
3024 | |||
3025 | /* TQPTR */ | ||
3026 | /* Size varies with number of Tx threads */ | ||
3027 | ugeth->thread_dat_tx_offset = | ||
3028 | qe_muram_alloc(numThreadsTxNumerical * | ||
3029 | sizeof(ucc_geth_thread_data_tx_t) + | ||
3030 | 32 * (numThreadsTxNumerical == 1), | ||
3031 | UCC_GETH_THREAD_DATA_ALIGNMENT); | ||
3032 | if (IS_MURAM_ERR(ugeth->thread_dat_tx_offset)) { | ||
3033 | ugeth_err | ||
3034 | ("%s: Can not allocate DPRAM memory for p_thread_data_tx.", | ||
3035 | __FUNCTION__); | ||
3036 | ucc_geth_memclean(ugeth); | ||
3037 | return -ENOMEM; | ||
3038 | } | ||
3039 | |||
3040 | ugeth->p_thread_data_tx = | ||
3041 | (ucc_geth_thread_data_tx_t *) qe_muram_addr(ugeth-> | ||
3042 | thread_dat_tx_offset); | ||
3043 | out_be32(&ugeth->p_tx_glbl_pram->tqptr, ugeth->thread_dat_tx_offset); | ||
3044 | |||
3045 | /* vtagtable */ | ||
3046 | for (i = 0; i < UCC_GETH_TX_VTAG_TABLE_ENTRY_MAX; i++) | ||
3047 | out_be32(&ugeth->p_tx_glbl_pram->vtagtable[i], | ||
3048 | ug_info->vtagtable[i]); | ||
3049 | |||
3050 | /* iphoffset */ | ||
3051 | for (i = 0; i < TX_IP_OFFSET_ENTRY_MAX; i++) | ||
3052 | ugeth->p_tx_glbl_pram->iphoffset[i] = ug_info->iphoffset[i]; | ||
3053 | |||
3054 | /* SQPTR */ | ||
3055 | /* Size varies with number of Tx queues */ | ||
3056 | ugeth->send_q_mem_reg_offset = | ||
3057 | qe_muram_alloc(ug_info->numQueuesTx * | ||
3058 | sizeof(ucc_geth_send_queue_qd_t), | ||
3059 | UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT); | ||
3060 | if (IS_MURAM_ERR(ugeth->send_q_mem_reg_offset)) { | ||
3061 | ugeth_err | ||
3062 | ("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.", | ||
3063 | __FUNCTION__); | ||
3064 | ucc_geth_memclean(ugeth); | ||
3065 | return -ENOMEM; | ||
3066 | } | ||
3067 | |||
3068 | ugeth->p_send_q_mem_reg = | ||
3069 | (ucc_geth_send_queue_mem_region_t *) qe_muram_addr(ugeth-> | ||
3070 | send_q_mem_reg_offset); | ||
3071 | out_be32(&ugeth->p_tx_glbl_pram->sqptr, ugeth->send_q_mem_reg_offset); | ||
3072 | |||
3073 | /* Setup the table */ | ||
3074 | /* Assume BD rings are already established */ | ||
3075 | for (i = 0; i < ug_info->numQueuesTx; i++) { | ||
3076 | endOfRing = | ||
3077 | ugeth->p_tx_bd_ring[i] + (ug_info->bdRingLenTx[i] - | ||
3078 | 1) * UCC_GETH_SIZE_OF_BD; | ||
3079 | if (ugeth->ug_info->uf_info.bd_mem_part == MEM_PART_SYSTEM) { | ||
3080 | out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].bd_ring_base, | ||
3081 | (u32) virt_to_phys(ugeth->p_tx_bd_ring[i])); | ||
3082 | out_be32(&ugeth->p_send_q_mem_reg->sqqd[i]. | ||
3083 | last_bd_completed_address, | ||
3084 | (u32) virt_to_phys(endOfRing)); | ||
3085 | } else if (ugeth->ug_info->uf_info.bd_mem_part == | ||
3086 | MEM_PART_MURAM) { | ||
3087 | out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].bd_ring_base, | ||
3088 | (u32) immrbar_virt_to_phys(ugeth-> | ||
3089 | p_tx_bd_ring[i])); | ||
3090 | out_be32(&ugeth->p_send_q_mem_reg->sqqd[i]. | ||
3091 | last_bd_completed_address, | ||
3092 | (u32) immrbar_virt_to_phys(endOfRing)); | ||
3093 | } | ||
3094 | } | ||
3095 | |||
3096 | /* schedulerbasepointer */ | ||
3097 | |||
3098 | if (ug_info->numQueuesTx > 1) { | ||
3099 | /* scheduler exists only if more than 1 tx queue */ | ||
3100 | ugeth->scheduler_offset = | ||
3101 | qe_muram_alloc(sizeof(ucc_geth_scheduler_t), | ||
3102 | UCC_GETH_SCHEDULER_ALIGNMENT); | ||
3103 | if (IS_MURAM_ERR(ugeth->scheduler_offset)) { | ||
3104 | ugeth_err | ||
3105 | ("%s: Can not allocate DPRAM memory for p_scheduler.", | ||
3106 | __FUNCTION__); | ||
3107 | ucc_geth_memclean(ugeth); | ||
3108 | return -ENOMEM; | ||
3109 | } | ||
3110 | |||
3111 | ugeth->p_scheduler = | ||
3112 | (ucc_geth_scheduler_t *) qe_muram_addr(ugeth-> | ||
3113 | scheduler_offset); | ||
3114 | out_be32(&ugeth->p_tx_glbl_pram->schedulerbasepointer, | ||
3115 | ugeth->scheduler_offset); | ||
3116 | /* Zero out p_scheduler */ | ||
3117 | memset(ugeth->p_scheduler, 0, sizeof(ucc_geth_scheduler_t)); | ||
3118 | |||
3119 | /* Set values in scheduler */ | ||
3120 | out_be32(&ugeth->p_scheduler->mblinterval, | ||
3121 | ug_info->mblinterval); | ||
3122 | out_be16(&ugeth->p_scheduler->nortsrbytetime, | ||
3123 | ug_info->nortsrbytetime); | ||
3124 | ugeth->p_scheduler->fracsiz = ug_info->fracsiz; | ||
3125 | ugeth->p_scheduler->strictpriorityq = ug_info->strictpriorityq; | ||
3126 | ugeth->p_scheduler->txasap = ug_info->txasap; | ||
3127 | ugeth->p_scheduler->extrabw = ug_info->extrabw; | ||
3128 | for (i = 0; i < NUM_TX_QUEUES; i++) | ||
3129 | ugeth->p_scheduler->weightfactor[i] = | ||
3130 | ug_info->weightfactor[i]; | ||
3131 | |||
3132 | /* Set pointers to cpucount registers in scheduler */ | ||
3133 | ugeth->p_cpucount[0] = &(ugeth->p_scheduler->cpucount0); | ||
3134 | ugeth->p_cpucount[1] = &(ugeth->p_scheduler->cpucount1); | ||
3135 | ugeth->p_cpucount[2] = &(ugeth->p_scheduler->cpucount2); | ||
3136 | ugeth->p_cpucount[3] = &(ugeth->p_scheduler->cpucount3); | ||
3137 | ugeth->p_cpucount[4] = &(ugeth->p_scheduler->cpucount4); | ||
3138 | ugeth->p_cpucount[5] = &(ugeth->p_scheduler->cpucount5); | ||
3139 | ugeth->p_cpucount[6] = &(ugeth->p_scheduler->cpucount6); | ||
3140 | ugeth->p_cpucount[7] = &(ugeth->p_scheduler->cpucount7); | ||
3141 | } | ||
3142 | |||
3143 | /* schedulerbasepointer */ | ||
3144 | /* TxRMON_PTR (statistics) */ | ||
3145 | if (ug_info-> | ||
3146 | statisticsMode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX) { | ||
3147 | ugeth->tx_fw_statistics_pram_offset = | ||
3148 | qe_muram_alloc(sizeof | ||
3149 | (ucc_geth_tx_firmware_statistics_pram_t), | ||
3150 | UCC_GETH_TX_STATISTICS_ALIGNMENT); | ||
3151 | if (IS_MURAM_ERR(ugeth->tx_fw_statistics_pram_offset)) { | ||
3152 | ugeth_err | ||
3153 | ("%s: Can not allocate DPRAM memory for" | ||
3154 | " p_tx_fw_statistics_pram.", __FUNCTION__); | ||
3155 | ucc_geth_memclean(ugeth); | ||
3156 | return -ENOMEM; | ||
3157 | } | ||
3158 | ugeth->p_tx_fw_statistics_pram = | ||
3159 | (ucc_geth_tx_firmware_statistics_pram_t *) | ||
3160 | qe_muram_addr(ugeth->tx_fw_statistics_pram_offset); | ||
3161 | /* Zero out p_tx_fw_statistics_pram */ | ||
3162 | memset(ugeth->p_tx_fw_statistics_pram, | ||
3163 | 0, sizeof(ucc_geth_tx_firmware_statistics_pram_t)); | ||
3164 | } | ||
3165 | |||
3166 | /* temoder */ | ||
3167 | /* Already has speed set */ | ||
3168 | |||
3169 | if (ug_info->numQueuesTx > 1) | ||
3170 | temoder |= TEMODER_SCHEDULER_ENABLE; | ||
3171 | if (ug_info->ipCheckSumGenerate) | ||
3172 | temoder |= TEMODER_IP_CHECKSUM_GENERATE; | ||
3173 | temoder |= ((ug_info->numQueuesTx - 1) << TEMODER_NUM_OF_QUEUES_SHIFT); | ||
3174 | out_be16(&ugeth->p_tx_glbl_pram->temoder, temoder); | ||
3175 | |||
3176 | test = in_be16(&ugeth->p_tx_glbl_pram->temoder); | ||
3177 | |||
3178 | /* Function code register value to be used later */ | ||
3179 | function_code = QE_BMR_BYTE_ORDER_BO_MOT | UCC_FAST_FUNCTION_CODE_GBL; | ||
3180 | /* Required for QE */ | ||
3181 | |||
3182 | /* function code register */ | ||
3183 | out_be32(&ugeth->p_tx_glbl_pram->tstate, ((u32) function_code) << 24); | ||
3184 | |||
3185 | /* Rx global PRAM */ | ||
3186 | /* Allocate global rx parameter RAM page */ | ||
3187 | ugeth->rx_glbl_pram_offset = | ||
3188 | qe_muram_alloc(sizeof(ucc_geth_rx_global_pram_t), | ||
3189 | UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT); | ||
3190 | if (IS_MURAM_ERR(ugeth->rx_glbl_pram_offset)) { | ||
3191 | ugeth_err | ||
3192 | ("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.", | ||
3193 | __FUNCTION__); | ||
3194 | ucc_geth_memclean(ugeth); | ||
3195 | return -ENOMEM; | ||
3196 | } | ||
3197 | ugeth->p_rx_glbl_pram = | ||
3198 | (ucc_geth_rx_global_pram_t *) qe_muram_addr(ugeth-> | ||
3199 | rx_glbl_pram_offset); | ||
3200 | /* Zero out p_rx_glbl_pram */ | ||
3201 | memset(ugeth->p_rx_glbl_pram, 0, sizeof(ucc_geth_rx_global_pram_t)); | ||
3202 | |||
3203 | /* Fill global PRAM */ | ||
3204 | |||
3205 | /* RQPTR */ | ||
3206 | /* Size varies with number of Rx threads */ | ||
3207 | ugeth->thread_dat_rx_offset = | ||
3208 | qe_muram_alloc(numThreadsRxNumerical * | ||
3209 | sizeof(ucc_geth_thread_data_rx_t), | ||
3210 | UCC_GETH_THREAD_DATA_ALIGNMENT); | ||
3211 | if (IS_MURAM_ERR(ugeth->thread_dat_rx_offset)) { | ||
3212 | ugeth_err | ||
3213 | ("%s: Can not allocate DPRAM memory for p_thread_data_rx.", | ||
3214 | __FUNCTION__); | ||
3215 | ucc_geth_memclean(ugeth); | ||
3216 | return -ENOMEM; | ||
3217 | } | ||
3218 | |||
3219 | ugeth->p_thread_data_rx = | ||
3220 | (ucc_geth_thread_data_rx_t *) qe_muram_addr(ugeth-> | ||
3221 | thread_dat_rx_offset); | ||
3222 | out_be32(&ugeth->p_rx_glbl_pram->rqptr, ugeth->thread_dat_rx_offset); | ||
3223 | |||
3224 | /* typeorlen */ | ||
3225 | out_be16(&ugeth->p_rx_glbl_pram->typeorlen, ug_info->typeorlen); | ||
3226 | |||
3227 | /* rxrmonbaseptr (statistics) */ | ||
3228 | if (ug_info-> | ||
3229 | statisticsMode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX) { | ||
3230 | ugeth->rx_fw_statistics_pram_offset = | ||
3231 | qe_muram_alloc(sizeof | ||
3232 | (ucc_geth_rx_firmware_statistics_pram_t), | ||
3233 | UCC_GETH_RX_STATISTICS_ALIGNMENT); | ||
3234 | if (IS_MURAM_ERR(ugeth->rx_fw_statistics_pram_offset)) { | ||
3235 | ugeth_err | ||
3236 | ("%s: Can not allocate DPRAM memory for" | ||
3237 | " p_rx_fw_statistics_pram.", __FUNCTION__); | ||
3238 | ucc_geth_memclean(ugeth); | ||
3239 | return -ENOMEM; | ||
3240 | } | ||
3241 | ugeth->p_rx_fw_statistics_pram = | ||
3242 | (ucc_geth_rx_firmware_statistics_pram_t *) | ||
3243 | qe_muram_addr(ugeth->rx_fw_statistics_pram_offset); | ||
3244 | /* Zero out p_rx_fw_statistics_pram */ | ||
3245 | memset(ugeth->p_rx_fw_statistics_pram, 0, | ||
3246 | sizeof(ucc_geth_rx_firmware_statistics_pram_t)); | ||
3247 | } | ||
3248 | |||
3249 | /* intCoalescingPtr */ | ||
3250 | |||
3251 | /* Size varies with number of Rx queues */ | ||
3252 | ugeth->rx_irq_coalescing_tbl_offset = | ||
3253 | qe_muram_alloc(ug_info->numQueuesRx * | ||
3254 | sizeof(ucc_geth_rx_interrupt_coalescing_entry_t), | ||
3255 | UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT); | ||
3256 | if (IS_MURAM_ERR(ugeth->rx_irq_coalescing_tbl_offset)) { | ||
3257 | ugeth_err | ||
3258 | ("%s: Can not allocate DPRAM memory for" | ||
3259 | " p_rx_irq_coalescing_tbl.", __FUNCTION__); | ||
3260 | ucc_geth_memclean(ugeth); | ||
3261 | return -ENOMEM; | ||
3262 | } | ||
3263 | |||
3264 | ugeth->p_rx_irq_coalescing_tbl = | ||
3265 | (ucc_geth_rx_interrupt_coalescing_table_t *) | ||
3266 | qe_muram_addr(ugeth->rx_irq_coalescing_tbl_offset); | ||
3267 | out_be32(&ugeth->p_rx_glbl_pram->intcoalescingptr, | ||
3268 | ugeth->rx_irq_coalescing_tbl_offset); | ||
3269 | |||
3270 | /* Fill interrupt coalescing table */ | ||
3271 | for (i = 0; i < ug_info->numQueuesRx; i++) { | ||
3272 | out_be32(&ugeth->p_rx_irq_coalescing_tbl->coalescingentry[i]. | ||
3273 | interruptcoalescingmaxvalue, | ||
3274 | ug_info->interruptcoalescingmaxvalue[i]); | ||
3275 | out_be32(&ugeth->p_rx_irq_coalescing_tbl->coalescingentry[i]. | ||
3276 | interruptcoalescingcounter, | ||
3277 | ug_info->interruptcoalescingmaxvalue[i]); | ||
3278 | } | ||
3279 | |||
3280 | /* MRBLR */ | ||
3281 | init_max_rx_buff_len(uf_info->max_rx_buf_length, | ||
3282 | &ugeth->p_rx_glbl_pram->mrblr); | ||
3283 | /* MFLR */ | ||
3284 | out_be16(&ugeth->p_rx_glbl_pram->mflr, ug_info->maxFrameLength); | ||
3285 | /* MINFLR */ | ||
3286 | init_min_frame_len(ug_info->minFrameLength, | ||
3287 | &ugeth->p_rx_glbl_pram->minflr, | ||
3288 | &ugeth->p_rx_glbl_pram->mrblr); | ||
3289 | /* MAXD1 */ | ||
3290 | out_be16(&ugeth->p_rx_glbl_pram->maxd1, ug_info->maxD1Length); | ||
3291 | /* MAXD2 */ | ||
3292 | out_be16(&ugeth->p_rx_glbl_pram->maxd2, ug_info->maxD2Length); | ||
3293 | |||
3294 | /* l2qt */ | ||
3295 | l2qt = 0; | ||
3296 | for (i = 0; i < UCC_GETH_VLAN_PRIORITY_MAX; i++) | ||
3297 | l2qt |= (ug_info->l2qt[i] << (28 - 4 * i)); | ||
3298 | out_be32(&ugeth->p_rx_glbl_pram->l2qt, l2qt); | ||
3299 | |||
3300 | /* l3qt */ | ||
3301 | for (j = 0; j < UCC_GETH_IP_PRIORITY_MAX; j += 8) { | ||
3302 | l3qt = 0; | ||
3303 | for (i = 0; i < 8; i++) | ||
3304 | l3qt |= (ug_info->l3qt[j + i] << (28 - 4 * i)); | ||
3305 | out_be32(&ugeth->p_rx_glbl_pram->l3qt[j], l3qt); | ||
3306 | } | ||
3307 | |||
3308 | /* vlantype */ | ||
3309 | out_be16(&ugeth->p_rx_glbl_pram->vlantype, ug_info->vlantype); | ||
3310 | |||
3311 | /* vlantci */ | ||
3312 | out_be16(&ugeth->p_rx_glbl_pram->vlantci, ug_info->vlantci); | ||
3313 | |||
3314 | /* ecamptr */ | ||
3315 | out_be32(&ugeth->p_rx_glbl_pram->ecamptr, ug_info->ecamptr); | ||
3316 | |||
3317 | /* RBDQPTR */ | ||
3318 | /* Size varies with number of Rx queues */ | ||
3319 | ugeth->rx_bd_qs_tbl_offset = | ||
3320 | qe_muram_alloc(ug_info->numQueuesRx * | ||
3321 | (sizeof(ucc_geth_rx_bd_queues_entry_t) + | ||
3322 | sizeof(ucc_geth_rx_prefetched_bds_t)), | ||
3323 | UCC_GETH_RX_BD_QUEUES_ALIGNMENT); | ||
3324 | if (IS_MURAM_ERR(ugeth->rx_bd_qs_tbl_offset)) { | ||
3325 | ugeth_err | ||
3326 | ("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.", | ||
3327 | __FUNCTION__); | ||
3328 | ucc_geth_memclean(ugeth); | ||
3329 | return -ENOMEM; | ||
3330 | } | ||
3331 | |||
3332 | ugeth->p_rx_bd_qs_tbl = | ||
3333 | (ucc_geth_rx_bd_queues_entry_t *) qe_muram_addr(ugeth-> | ||
3334 | rx_bd_qs_tbl_offset); | ||
3335 | out_be32(&ugeth->p_rx_glbl_pram->rbdqptr, ugeth->rx_bd_qs_tbl_offset); | ||
3336 | /* Zero out p_rx_bd_qs_tbl */ | ||
3337 | memset(ugeth->p_rx_bd_qs_tbl, | ||
3338 | 0, | ||
3339 | ug_info->numQueuesRx * (sizeof(ucc_geth_rx_bd_queues_entry_t) + | ||
3340 | sizeof(ucc_geth_rx_prefetched_bds_t))); | ||
3341 | |||
3342 | /* Setup the table */ | ||
3343 | /* Assume BD rings are already established */ | ||
3344 | for (i = 0; i < ug_info->numQueuesRx; i++) { | ||
3345 | if (ugeth->ug_info->uf_info.bd_mem_part == MEM_PART_SYSTEM) { | ||
3346 | out_be32(&ugeth->p_rx_bd_qs_tbl[i].externalbdbaseptr, | ||
3347 | (u32) virt_to_phys(ugeth->p_rx_bd_ring[i])); | ||
3348 | } else if (ugeth->ug_info->uf_info.bd_mem_part == | ||
3349 | MEM_PART_MURAM) { | ||
3350 | out_be32(&ugeth->p_rx_bd_qs_tbl[i].externalbdbaseptr, | ||
3351 | (u32) immrbar_virt_to_phys(ugeth-> | ||
3352 | p_rx_bd_ring[i])); | ||
3353 | } | ||
3354 | /* rest of fields handled by QE */ | ||
3355 | } | ||
3356 | |||
3357 | /* remoder */ | ||
3358 | /* Already has speed set */ | ||
3359 | |||
3360 | if (ugeth->rx_extended_features) | ||
3361 | remoder |= REMODER_RX_EXTENDED_FEATURES; | ||
3362 | if (ug_info->rxExtendedFiltering) | ||
3363 | remoder |= REMODER_RX_EXTENDED_FILTERING; | ||
3364 | if (ug_info->dynamicMaxFrameLength) | ||
3365 | remoder |= REMODER_DYNAMIC_MAX_FRAME_LENGTH; | ||
3366 | if (ug_info->dynamicMinFrameLength) | ||
3367 | remoder |= REMODER_DYNAMIC_MIN_FRAME_LENGTH; | ||
3368 | remoder |= | ||
3369 | ug_info->vlanOperationTagged << REMODER_VLAN_OPERATION_TAGGED_SHIFT; | ||
3370 | remoder |= | ||
3371 | ug_info-> | ||
3372 | vlanOperationNonTagged << REMODER_VLAN_OPERATION_NON_TAGGED_SHIFT; | ||
3373 | remoder |= ug_info->rxQoSMode << REMODER_RX_QOS_MODE_SHIFT; | ||
3374 | remoder |= ((ug_info->numQueuesRx - 1) << REMODER_NUM_OF_QUEUES_SHIFT); | ||
3375 | if (ug_info->ipCheckSumCheck) | ||
3376 | remoder |= REMODER_IP_CHECKSUM_CHECK; | ||
3377 | if (ug_info->ipAddressAlignment) | ||
3378 | remoder |= REMODER_IP_ADDRESS_ALIGNMENT; | ||
3379 | out_be32(&ugeth->p_rx_glbl_pram->remoder, remoder); | ||
3380 | |||
3381 | /* Note that this function must be called */ | ||
3382 | /* ONLY AFTER p_tx_fw_statistics_pram */ | ||
3383 | /* andp_UccGethRxFirmwareStatisticsPram are allocated ! */ | ||
3384 | init_firmware_statistics_gathering_mode((ug_info-> | ||
3385 | statisticsMode & | ||
3386 | UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX), | ||
3387 | (ug_info->statisticsMode & | ||
3388 | UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX), | ||
3389 | &ugeth->p_tx_glbl_pram->txrmonbaseptr, | ||
3390 | ugeth->tx_fw_statistics_pram_offset, | ||
3391 | &ugeth->p_rx_glbl_pram->rxrmonbaseptr, | ||
3392 | ugeth->rx_fw_statistics_pram_offset, | ||
3393 | &ugeth->p_tx_glbl_pram->temoder, | ||
3394 | &ugeth->p_rx_glbl_pram->remoder); | ||
3395 | |||
3396 | /* function code register */ | ||
3397 | ugeth->p_rx_glbl_pram->rstate = function_code; | ||
3398 | |||
3399 | /* initialize extended filtering */ | ||
3400 | if (ug_info->rxExtendedFiltering) { | ||
3401 | if (!ug_info->extendedFilteringChainPointer) { | ||
3402 | ugeth_err("%s: Null Extended Filtering Chain Pointer.", | ||
3403 | __FUNCTION__); | ||
3404 | ucc_geth_memclean(ugeth); | ||
3405 | return -EINVAL; | ||
3406 | } | ||
3407 | |||
3408 | /* Allocate memory for extended filtering Mode Global | ||
3409 | Parameters */ | ||
3410 | ugeth->exf_glbl_param_offset = | ||
3411 | qe_muram_alloc(sizeof(ucc_geth_exf_global_pram_t), | ||
3412 | UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT); | ||
3413 | if (IS_MURAM_ERR(ugeth->exf_glbl_param_offset)) { | ||
3414 | ugeth_err | ||
3415 | ("%s: Can not allocate DPRAM memory for" | ||
3416 | " p_exf_glbl_param.", __FUNCTION__); | ||
3417 | ucc_geth_memclean(ugeth); | ||
3418 | return -ENOMEM; | ||
3419 | } | ||
3420 | |||
3421 | ugeth->p_exf_glbl_param = | ||
3422 | (ucc_geth_exf_global_pram_t *) qe_muram_addr(ugeth-> | ||
3423 | exf_glbl_param_offset); | ||
3424 | out_be32(&ugeth->p_rx_glbl_pram->exfGlobalParam, | ||
3425 | ugeth->exf_glbl_param_offset); | ||
3426 | out_be32(&ugeth->p_exf_glbl_param->l2pcdptr, | ||
3427 | (u32) ug_info->extendedFilteringChainPointer); | ||
3428 | |||
3429 | } else { /* initialize 82xx style address filtering */ | ||
3430 | |||
3431 | /* Init individual address recognition registers to disabled */ | ||
3432 | |||
3433 | for (j = 0; j < NUM_OF_PADDRS; j++) | ||
3434 | ugeth_82xx_filtering_clear_addr_in_paddr(ugeth, (u8) j); | ||
3435 | |||
3436 | /* Create CQs for hash tables */ | ||
3437 | if (ug_info->maxGroupAddrInHash > 0) { | ||
3438 | INIT_LIST_HEAD(&ugeth->group_hash_q); | ||
3439 | } | ||
3440 | if (ug_info->maxIndAddrInHash > 0) { | ||
3441 | INIT_LIST_HEAD(&ugeth->ind_hash_q); | ||
3442 | } | ||
3443 | p_82xx_addr_filt = | ||
3444 | (ucc_geth_82xx_address_filtering_pram_t *) ugeth-> | ||
3445 | p_rx_glbl_pram->addressfiltering; | ||
3446 | |||
3447 | ugeth_82xx_filtering_clear_all_addr_in_hash(ugeth, | ||
3448 | ENET_ADDR_TYPE_GROUP); | ||
3449 | ugeth_82xx_filtering_clear_all_addr_in_hash(ugeth, | ||
3450 | ENET_ADDR_TYPE_INDIVIDUAL); | ||
3451 | } | ||
3452 | |||
3453 | /* | ||
3454 | * Initialize UCC at QE level | ||
3455 | */ | ||
3456 | |||
3457 | command = QE_INIT_TX_RX; | ||
3458 | |||
3459 | /* Allocate shadow InitEnet command parameter structure. | ||
3460 | * This is needed because after the InitEnet command is executed, | ||
3461 | * the structure in DPRAM is released, because DPRAM is a premium | ||
3462 | * resource. | ||
3463 | * This shadow structure keeps a copy of what was done so that the | ||
3464 | * allocated resources can be released when the channel is freed. | ||
3465 | */ | ||
3466 | if (!(ugeth->p_init_enet_param_shadow = | ||
3467 | (ucc_geth_init_pram_t *) kmalloc(sizeof(ucc_geth_init_pram_t), | ||
3468 | GFP_KERNEL))) { | ||
3469 | ugeth_err | ||
3470 | ("%s: Can not allocate memory for" | ||
3471 | " p_UccInitEnetParamShadows.", __FUNCTION__); | ||
3472 | ucc_geth_memclean(ugeth); | ||
3473 | return -ENOMEM; | ||
3474 | } | ||
3475 | /* Zero out *p_init_enet_param_shadow */ | ||
3476 | memset((char *)ugeth->p_init_enet_param_shadow, | ||
3477 | 0, sizeof(ucc_geth_init_pram_t)); | ||
3478 | |||
3479 | /* Fill shadow InitEnet command parameter structure */ | ||
3480 | |||
3481 | ugeth->p_init_enet_param_shadow->resinit1 = | ||
3482 | ENET_INIT_PARAM_MAGIC_RES_INIT1; | ||
3483 | ugeth->p_init_enet_param_shadow->resinit2 = | ||
3484 | ENET_INIT_PARAM_MAGIC_RES_INIT2; | ||
3485 | ugeth->p_init_enet_param_shadow->resinit3 = | ||
3486 | ENET_INIT_PARAM_MAGIC_RES_INIT3; | ||
3487 | ugeth->p_init_enet_param_shadow->resinit4 = | ||
3488 | ENET_INIT_PARAM_MAGIC_RES_INIT4; | ||
3489 | ugeth->p_init_enet_param_shadow->resinit5 = | ||
3490 | ENET_INIT_PARAM_MAGIC_RES_INIT5; | ||
3491 | ugeth->p_init_enet_param_shadow->rgftgfrxglobal |= | ||
3492 | ((u32) ug_info->numThreadsRx) << ENET_INIT_PARAM_RGF_SHIFT; | ||
3493 | ugeth->p_init_enet_param_shadow->rgftgfrxglobal |= | ||
3494 | ((u32) ug_info->numThreadsTx) << ENET_INIT_PARAM_TGF_SHIFT; | ||
3495 | |||
3496 | ugeth->p_init_enet_param_shadow->rgftgfrxglobal |= | ||
3497 | ugeth->rx_glbl_pram_offset | ug_info->riscRx; | ||
3498 | if ((ug_info->largestexternallookupkeysize != | ||
3499 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE) | ||
3500 | && (ug_info->largestexternallookupkeysize != | ||
3501 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES) | ||
3502 | && (ug_info->largestexternallookupkeysize != | ||
3503 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES)) { | ||
3504 | ugeth_err("%s: Invalid largest External Lookup Key Size.", | ||
3505 | __FUNCTION__); | ||
3506 | ucc_geth_memclean(ugeth); | ||
3507 | return -EINVAL; | ||
3508 | } | ||
3509 | ugeth->p_init_enet_param_shadow->largestexternallookupkeysize = | ||
3510 | ug_info->largestexternallookupkeysize; | ||
3511 | size = sizeof(ucc_geth_thread_rx_pram_t); | ||
3512 | if (ug_info->rxExtendedFiltering) { | ||
3513 | size += THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING; | ||
3514 | if (ug_info->largestexternallookupkeysize == | ||
3515 | QE_FLTR_TABLE_LOOKUP_KEY_SIZE_8_BYTES) | ||
3516 | size += | ||
3517 | THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_8; | ||
3518 | if (ug_info->largestexternallookupkeysize == | ||
3519 | QE_FLTR_TABLE_LOOKUP_KEY_SIZE_16_BYTES) | ||
3520 | size += | ||
3521 | THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_16; | ||
3522 | } | ||
3523 | |||
3524 | if ((ret_val = fill_init_enet_entries(ugeth, &(ugeth-> | ||
3525 | p_init_enet_param_shadow->rxthread[0]), | ||
3526 | (u8) (numThreadsRxNumerical + 1) | ||
3527 | /* Rx needs one extra for terminator */ | ||
3528 | , size, UCC_GETH_THREAD_RX_PRAM_ALIGNMENT, | ||
3529 | ug_info->riscRx, 1)) != 0) { | ||
3530 | ugeth_err("%s: Can not fill p_init_enet_param_shadow.", | ||
3531 | __FUNCTION__); | ||
3532 | ucc_geth_memclean(ugeth); | ||
3533 | return ret_val; | ||
3534 | } | ||
3535 | |||
3536 | ugeth->p_init_enet_param_shadow->txglobal = | ||
3537 | ugeth->tx_glbl_pram_offset | ug_info->riscTx; | ||
3538 | if ((ret_val = | ||
3539 | fill_init_enet_entries(ugeth, | ||
3540 | &(ugeth->p_init_enet_param_shadow-> | ||
3541 | txthread[0]), numThreadsTxNumerical, | ||
3542 | sizeof(ucc_geth_thread_tx_pram_t), | ||
3543 | UCC_GETH_THREAD_TX_PRAM_ALIGNMENT, | ||
3544 | ug_info->riscTx, 0)) != 0) { | ||
3545 | ugeth_err("%s: Can not fill p_init_enet_param_shadow.", | ||
3546 | __FUNCTION__); | ||
3547 | ucc_geth_memclean(ugeth); | ||
3548 | return ret_val; | ||
3549 | } | ||
3550 | |||
3551 | /* Load Rx bds with buffers */ | ||
3552 | for (i = 0; i < ug_info->numQueuesRx; i++) { | ||
3553 | if ((ret_val = rx_bd_buffer_set(ugeth, (u8) i)) != 0) { | ||
3554 | ugeth_err("%s: Can not fill Rx bds with buffers.", | ||
3555 | __FUNCTION__); | ||
3556 | ucc_geth_memclean(ugeth); | ||
3557 | return ret_val; | ||
3558 | } | ||
3559 | } | ||
3560 | |||
3561 | /* Allocate InitEnet command parameter structure */ | ||
3562 | init_enet_pram_offset = qe_muram_alloc(sizeof(ucc_geth_init_pram_t), 4); | ||
3563 | if (IS_MURAM_ERR(init_enet_pram_offset)) { | ||
3564 | ugeth_err | ||
3565 | ("%s: Can not allocate DPRAM memory for p_init_enet_pram.", | ||
3566 | __FUNCTION__); | ||
3567 | ucc_geth_memclean(ugeth); | ||
3568 | return -ENOMEM; | ||
3569 | } | ||
3570 | p_init_enet_pram = | ||
3571 | (ucc_geth_init_pram_t *) qe_muram_addr(init_enet_pram_offset); | ||
3572 | |||
3573 | /* Copy shadow InitEnet command parameter structure into PRAM */ | ||
3574 | p_init_enet_pram->resinit1 = ugeth->p_init_enet_param_shadow->resinit1; | ||
3575 | p_init_enet_pram->resinit2 = ugeth->p_init_enet_param_shadow->resinit2; | ||
3576 | p_init_enet_pram->resinit3 = ugeth->p_init_enet_param_shadow->resinit3; | ||
3577 | p_init_enet_pram->resinit4 = ugeth->p_init_enet_param_shadow->resinit4; | ||
3578 | out_be16(&p_init_enet_pram->resinit5, | ||
3579 | ugeth->p_init_enet_param_shadow->resinit5); | ||
3580 | p_init_enet_pram->largestexternallookupkeysize = | ||
3581 | ugeth->p_init_enet_param_shadow->largestexternallookupkeysize; | ||
3582 | out_be32(&p_init_enet_pram->rgftgfrxglobal, | ||
3583 | ugeth->p_init_enet_param_shadow->rgftgfrxglobal); | ||
3584 | for (i = 0; i < ENET_INIT_PARAM_MAX_ENTRIES_RX; i++) | ||
3585 | out_be32(&p_init_enet_pram->rxthread[i], | ||
3586 | ugeth->p_init_enet_param_shadow->rxthread[i]); | ||
3587 | out_be32(&p_init_enet_pram->txglobal, | ||
3588 | ugeth->p_init_enet_param_shadow->txglobal); | ||
3589 | for (i = 0; i < ENET_INIT_PARAM_MAX_ENTRIES_TX; i++) | ||
3590 | out_be32(&p_init_enet_pram->txthread[i], | ||
3591 | ugeth->p_init_enet_param_shadow->txthread[i]); | ||
3592 | |||
3593 | /* Issue QE command */ | ||
3594 | cecr_subblock = | ||
3595 | ucc_fast_get_qe_cr_subblock(ugeth->ug_info->uf_info.ucc_num); | ||
3596 | qe_issue_cmd(command, cecr_subblock, (u8) QE_CR_PROTOCOL_ETHERNET, | ||
3597 | init_enet_pram_offset); | ||
3598 | |||
3599 | /* Free InitEnet command parameter */ | ||
3600 | qe_muram_free(init_enet_pram_offset); | ||
3601 | |||
3602 | return 0; | ||
3603 | } | ||
3604 | |||
3605 | /* returns a net_device_stats structure pointer */ | ||
3606 | static struct net_device_stats *ucc_geth_get_stats(struct net_device *dev) | ||
3607 | { | ||
3608 | ucc_geth_private_t *ugeth = netdev_priv(dev); | ||
3609 | |||
3610 | return &(ugeth->stats); | ||
3611 | } | ||
3612 | |||
3613 | /* ucc_geth_timeout gets called when a packet has not been | ||
3614 | * transmitted after a set amount of time. | ||
3615 | * For now, assume that clearing out all the structures, and | ||
3616 | * starting over will fix the problem. */ | ||
3617 | static void ucc_geth_timeout(struct net_device *dev) | ||
3618 | { | ||
3619 | ucc_geth_private_t *ugeth = netdev_priv(dev); | ||
3620 | |||
3621 | ugeth_vdbg("%s: IN", __FUNCTION__); | ||
3622 | |||
3623 | ugeth->stats.tx_errors++; | ||
3624 | |||
3625 | ugeth_dump_regs(ugeth); | ||
3626 | |||
3627 | if (dev->flags & IFF_UP) { | ||
3628 | ucc_geth_stop(ugeth); | ||
3629 | ucc_geth_startup(ugeth); | ||
3630 | } | ||
3631 | |||
3632 | netif_schedule(dev); | ||
3633 | } | ||
3634 | |||
3635 | /* This is called by the kernel when a frame is ready for transmission. */ | ||
3636 | /* It is pointed to by the dev->hard_start_xmit function pointer */ | ||
3637 | static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
3638 | { | ||
3639 | ucc_geth_private_t *ugeth = netdev_priv(dev); | ||
3640 | u8 *bd; /* BD pointer */ | ||
3641 | u32 bd_status; | ||
3642 | u8 txQ = 0; | ||
3643 | |||
3644 | ugeth_vdbg("%s: IN", __FUNCTION__); | ||
3645 | |||
3646 | spin_lock_irq(&ugeth->lock); | ||
3647 | |||
3648 | ugeth->stats.tx_bytes += skb->len; | ||
3649 | |||
3650 | /* Start from the next BD that should be filled */ | ||
3651 | bd = ugeth->txBd[txQ]; | ||
3652 | bd_status = BD_STATUS_AND_LENGTH(bd); | ||
3653 | /* Save the skb pointer so we can free it later */ | ||
3654 | ugeth->tx_skbuff[txQ][ugeth->skb_curtx[txQ]] = skb; | ||
3655 | |||
3656 | /* Update the current skb pointer (wrapping if this was the last) */ | ||
3657 | ugeth->skb_curtx[txQ] = | ||
3658 | (ugeth->skb_curtx[txQ] + | ||
3659 | 1) & TX_RING_MOD_MASK(ugeth->ug_info->bdRingLenTx[txQ]); | ||
3660 | |||
3661 | /* set up the buffer descriptor */ | ||
3662 | BD_BUFFER_SET(bd, | ||
3663 | dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE)); | ||
3664 | |||
3665 | //printk(KERN_DEBUG"skb->data is 0x%x\n",skb->data); | ||
3666 | |||
3667 | bd_status = (bd_status & T_W) | T_R | T_I | T_L | skb->len; | ||
3668 | |||
3669 | BD_STATUS_AND_LENGTH_SET(bd, bd_status); | ||
3670 | |||
3671 | dev->trans_start = jiffies; | ||
3672 | |||
3673 | /* Move to next BD in the ring */ | ||
3674 | if (!(bd_status & T_W)) | ||
3675 | ugeth->txBd[txQ] = bd + UCC_GETH_SIZE_OF_BD; | ||
3676 | else | ||
3677 | ugeth->txBd[txQ] = ugeth->p_tx_bd_ring[txQ]; | ||
3678 | |||
3679 | /* If the next BD still needs to be cleaned up, then the bds | ||
3680 | are full. We need to tell the kernel to stop sending us stuff. */ | ||
3681 | if (bd == ugeth->confBd[txQ]) { | ||
3682 | if (!netif_queue_stopped(dev)) | ||
3683 | netif_stop_queue(dev); | ||
3684 | } | ||
3685 | |||
3686 | if (ugeth->p_scheduler) { | ||
3687 | ugeth->cpucount[txQ]++; | ||
3688 | /* Indicate to QE that there are more Tx bds ready for | ||
3689 | transmission */ | ||
3690 | /* This is done by writing a running counter of the bd | ||
3691 | count to the scheduler PRAM. */ | ||
3692 | out_be16(ugeth->p_cpucount[txQ], ugeth->cpucount[txQ]); | ||
3693 | } | ||
3694 | |||
3695 | spin_unlock_irq(&ugeth->lock); | ||
3696 | |||
3697 | return 0; | ||
3698 | } | ||
3699 | |||
3700 | static int ucc_geth_rx(ucc_geth_private_t *ugeth, u8 rxQ, int rx_work_limit) | ||
3701 | { | ||
3702 | struct sk_buff *skb; | ||
3703 | u8 *bd; | ||
3704 | u16 length, howmany = 0; | ||
3705 | u32 bd_status; | ||
3706 | u8 *bdBuffer; | ||
3707 | |||
3708 | ugeth_vdbg("%s: IN", __FUNCTION__); | ||
3709 | |||
3710 | spin_lock(&ugeth->lock); | ||
3711 | /* collect received buffers */ | ||
3712 | bd = ugeth->rxBd[rxQ]; | ||
3713 | |||
3714 | bd_status = BD_STATUS_AND_LENGTH(bd); | ||
3715 | |||
3716 | /* while there are received buffers and BD is full (~R_E) */ | ||
3717 | while (!((bd_status & (R_E)) || (--rx_work_limit < 0))) { | ||
3718 | bdBuffer = (u8 *) BD_BUFFER(bd); | ||
3719 | length = (u16) ((bd_status & BD_LENGTH_MASK) - 4); | ||
3720 | skb = ugeth->rx_skbuff[rxQ][ugeth->skb_currx[rxQ]]; | ||
3721 | |||
3722 | /* determine whether buffer is first, last, first and last | ||
3723 | (single buffer frame) or middle (not first and not last) */ | ||
3724 | if (!skb || | ||
3725 | (!(bd_status & (R_F | R_L))) || | ||
3726 | (bd_status & R_ERRORS_FATAL)) { | ||
3727 | ugeth_vdbg("%s, %d: ERROR!!! skb - 0x%08x", | ||
3728 | __FUNCTION__, __LINE__, (u32) skb); | ||
3729 | if (skb) | ||
3730 | dev_kfree_skb_any(skb); | ||
3731 | |||
3732 | ugeth->rx_skbuff[rxQ][ugeth->skb_currx[rxQ]] = NULL; | ||
3733 | ugeth->stats.rx_dropped++; | ||
3734 | } else { | ||
3735 | ugeth->stats.rx_packets++; | ||
3736 | howmany++; | ||
3737 | |||
3738 | /* Prep the skb for the packet */ | ||
3739 | skb_put(skb, length); | ||
3740 | |||
3741 | /* Tell the skb what kind of packet this is */ | ||
3742 | skb->protocol = eth_type_trans(skb, ugeth->dev); | ||
3743 | |||
3744 | ugeth->stats.rx_bytes += length; | ||
3745 | /* Send the packet up the stack */ | ||
3746 | #ifdef CONFIG_UGETH_NAPI | ||
3747 | netif_receive_skb(skb); | ||
3748 | #else | ||
3749 | netif_rx(skb); | ||
3750 | #endif /* CONFIG_UGETH_NAPI */ | ||
3751 | } | ||
3752 | |||
3753 | ugeth->dev->last_rx = jiffies; | ||
3754 | |||
3755 | skb = get_new_skb(ugeth, bd); | ||
3756 | if (!skb) { | ||
3757 | ugeth_warn("%s: No Rx Data Buffer", __FUNCTION__); | ||
3758 | spin_unlock(&ugeth->lock); | ||
3759 | ugeth->stats.rx_dropped++; | ||
3760 | break; | ||
3761 | } | ||
3762 | |||
3763 | ugeth->rx_skbuff[rxQ][ugeth->skb_currx[rxQ]] = skb; | ||
3764 | |||
3765 | /* update to point at the next skb */ | ||
3766 | ugeth->skb_currx[rxQ] = | ||
3767 | (ugeth->skb_currx[rxQ] + | ||
3768 | 1) & RX_RING_MOD_MASK(ugeth->ug_info->bdRingLenRx[rxQ]); | ||
3769 | |||
3770 | if (bd_status & R_W) | ||
3771 | bd = ugeth->p_rx_bd_ring[rxQ]; | ||
3772 | else | ||
3773 | bd += UCC_GETH_SIZE_OF_BD; | ||
3774 | |||
3775 | bd_status = BD_STATUS_AND_LENGTH(bd); | ||
3776 | } | ||
3777 | |||
3778 | ugeth->rxBd[rxQ] = bd; | ||
3779 | spin_unlock(&ugeth->lock); | ||
3780 | return howmany; | ||
3781 | } | ||
3782 | |||
3783 | static int ucc_geth_tx(struct net_device *dev, u8 txQ) | ||
3784 | { | ||
3785 | /* Start from the next BD that should be filled */ | ||
3786 | ucc_geth_private_t *ugeth = netdev_priv(dev); | ||
3787 | u8 *bd; /* BD pointer */ | ||
3788 | u32 bd_status; | ||
3789 | |||
3790 | bd = ugeth->confBd[txQ]; | ||
3791 | bd_status = BD_STATUS_AND_LENGTH(bd); | ||
3792 | |||
3793 | /* Normal processing. */ | ||
3794 | while ((bd_status & T_R) == 0) { | ||
3795 | /* BD contains already transmitted buffer. */ | ||
3796 | /* Handle the transmitted buffer and release */ | ||
3797 | /* the BD to be used with the current frame */ | ||
3798 | |||
3799 | if ((bd = ugeth->txBd[txQ]) && (netif_queue_stopped(dev) == 0)) | ||
3800 | break; | ||
3801 | |||
3802 | ugeth->stats.tx_packets++; | ||
3803 | |||
3804 | /* Free the sk buffer associated with this TxBD */ | ||
3805 | dev_kfree_skb_irq(ugeth-> | ||
3806 | tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]]); | ||
3807 | ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]] = NULL; | ||
3808 | ugeth->skb_dirtytx[txQ] = | ||
3809 | (ugeth->skb_dirtytx[txQ] + | ||
3810 | 1) & TX_RING_MOD_MASK(ugeth->ug_info->bdRingLenTx[txQ]); | ||
3811 | |||
3812 | /* We freed a buffer, so now we can restart transmission */ | ||
3813 | if (netif_queue_stopped(dev)) | ||
3814 | netif_wake_queue(dev); | ||
3815 | |||
3816 | /* Advance the confirmation BD pointer */ | ||
3817 | if (!(bd_status & T_W)) | ||
3818 | ugeth->confBd[txQ] += UCC_GETH_SIZE_OF_BD; | ||
3819 | else | ||
3820 | ugeth->confBd[txQ] = ugeth->p_tx_bd_ring[txQ]; | ||
3821 | } | ||
3822 | return 0; | ||
3823 | } | ||
3824 | |||
3825 | #ifdef CONFIG_UGETH_NAPI | ||
3826 | static int ucc_geth_poll(struct net_device *dev, int *budget) | ||
3827 | { | ||
3828 | ucc_geth_private_t *ugeth = netdev_priv(dev); | ||
3829 | int howmany; | ||
3830 | int rx_work_limit = *budget; | ||
3831 | u8 rxQ = 0; | ||
3832 | |||
3833 | if (rx_work_limit > dev->quota) | ||
3834 | rx_work_limit = dev->quota; | ||
3835 | |||
3836 | howmany = ucc_geth_rx(ugeth, rxQ, rx_work_limit); | ||
3837 | |||
3838 | dev->quota -= howmany; | ||
3839 | rx_work_limit -= howmany; | ||
3840 | *budget -= howmany; | ||
3841 | |||
3842 | if (rx_work_limit >= 0) | ||
3843 | netif_rx_complete(dev); | ||
3844 | |||
3845 | return (rx_work_limit < 0) ? 1 : 0; | ||
3846 | } | ||
3847 | #endif /* CONFIG_UGETH_NAPI */ | ||
3848 | |||
3849 | static irqreturn_t ucc_geth_irq_handler(int irq, void *info, | ||
3850 | struct pt_regs *regs) | ||
3851 | { | ||
3852 | struct net_device *dev = (struct net_device *)info; | ||
3853 | ucc_geth_private_t *ugeth = netdev_priv(dev); | ||
3854 | ucc_fast_private_t *uccf; | ||
3855 | ucc_geth_info_t *ug_info; | ||
3856 | register u32 ucce = 0; | ||
3857 | register u32 bit_mask = UCCE_RXBF_SINGLE_MASK; | ||
3858 | register u32 tx_mask = UCCE_TXBF_SINGLE_MASK; | ||
3859 | register u8 i; | ||
3860 | |||
3861 | ugeth_vdbg("%s: IN", __FUNCTION__); | ||
3862 | |||
3863 | if (!ugeth) | ||
3864 | return IRQ_NONE; | ||
3865 | |||
3866 | uccf = ugeth->uccf; | ||
3867 | ug_info = ugeth->ug_info; | ||
3868 | |||
3869 | do { | ||
3870 | ucce |= (u32) (in_be32(uccf->p_ucce) & in_be32(uccf->p_uccm)); | ||
3871 | |||
3872 | /* clear event bits for next time */ | ||
3873 | /* Side effect here is to mask ucce variable | ||
3874 | for future processing below. */ | ||
3875 | out_be32(uccf->p_ucce, ucce); /* Clear with ones, | ||
3876 | but only bits in UCCM */ | ||
3877 | |||
3878 | /* We ignore Tx interrupts because Tx confirmation is | ||
3879 | done inside Tx routine */ | ||
3880 | |||
3881 | for (i = 0; i < ug_info->numQueuesRx; i++) { | ||
3882 | if (ucce & bit_mask) | ||
3883 | ucc_geth_rx(ugeth, i, | ||
3884 | (int)ugeth->ug_info-> | ||
3885 | bdRingLenRx[i]); | ||
3886 | ucce &= ~bit_mask; | ||
3887 | bit_mask <<= 1; | ||
3888 | } | ||
3889 | |||
3890 | for (i = 0; i < ug_info->numQueuesTx; i++) { | ||
3891 | if (ucce & tx_mask) | ||
3892 | ucc_geth_tx(dev, i); | ||
3893 | ucce &= ~tx_mask; | ||
3894 | tx_mask <<= 1; | ||
3895 | } | ||
3896 | |||
3897 | /* Exceptions */ | ||
3898 | if (ucce & UCCE_BSY) { | ||
3899 | ugeth_vdbg("Got BUSY irq!!!!"); | ||
3900 | ugeth->stats.rx_errors++; | ||
3901 | ucce &= ~UCCE_BSY; | ||
3902 | } | ||
3903 | if (ucce & UCCE_OTHER) { | ||
3904 | ugeth_vdbg("Got frame with error (ucce - 0x%08x)!!!!", | ||
3905 | ucce); | ||
3906 | ugeth->stats.rx_errors++; | ||
3907 | ucce &= ~ucce; | ||
3908 | } | ||
3909 | } | ||
3910 | while (ucce); | ||
3911 | |||
3912 | return IRQ_HANDLED; | ||
3913 | } | ||
3914 | |||
3915 | static irqreturn_t phy_interrupt(int irq, void *dev_id, struct pt_regs *regs) | ||
3916 | { | ||
3917 | struct net_device *dev = (struct net_device *)dev_id; | ||
3918 | ucc_geth_private_t *ugeth = netdev_priv(dev); | ||
3919 | |||
3920 | ugeth_vdbg("%s: IN", __FUNCTION__); | ||
3921 | |||
3922 | /* Clear the interrupt */ | ||
3923 | mii_clear_phy_interrupt(ugeth->mii_info); | ||
3924 | |||
3925 | /* Disable PHY interrupts */ | ||
3926 | mii_configure_phy_interrupt(ugeth->mii_info, MII_INTERRUPT_DISABLED); | ||
3927 | |||
3928 | /* Schedule the phy change */ | ||
3929 | schedule_work(&ugeth->tq); | ||
3930 | |||
3931 | return IRQ_HANDLED; | ||
3932 | } | ||
3933 | |||
3934 | /* Scheduled by the phy_interrupt/timer to handle PHY changes */ | ||
3935 | static void ugeth_phy_change(void *data) | ||
3936 | { | ||
3937 | struct net_device *dev = (struct net_device *)data; | ||
3938 | ucc_geth_private_t *ugeth = netdev_priv(dev); | ||
3939 | ucc_geth_t *ug_regs; | ||
3940 | int result = 0; | ||
3941 | |||
3942 | ugeth_vdbg("%s: IN", __FUNCTION__); | ||
3943 | |||
3944 | ug_regs = ugeth->ug_regs; | ||
3945 | |||
3946 | /* Delay to give the PHY a chance to change the | ||
3947 | * register state */ | ||
3948 | msleep(1); | ||
3949 | |||
3950 | /* Update the link, speed, duplex */ | ||
3951 | result = ugeth->mii_info->phyinfo->read_status(ugeth->mii_info); | ||
3952 | |||
3953 | /* Adjust the known status as long as the link | ||
3954 | * isn't still coming up */ | ||
3955 | if ((0 == result) || (ugeth->mii_info->link == 0)) | ||
3956 | adjust_link(dev); | ||
3957 | |||
3958 | /* Reenable interrupts, if needed */ | ||
3959 | if (ugeth->ug_info->board_flags & FSL_UGETH_BRD_HAS_PHY_INTR) | ||
3960 | mii_configure_phy_interrupt(ugeth->mii_info, | ||
3961 | MII_INTERRUPT_ENABLED); | ||
3962 | } | ||
3963 | |||
3964 | /* Called every so often on systems that don't interrupt | ||
3965 | * the core for PHY changes */ | ||
3966 | static void ugeth_phy_timer(unsigned long data) | ||
3967 | { | ||
3968 | struct net_device *dev = (struct net_device *)data; | ||
3969 | ucc_geth_private_t *ugeth = netdev_priv(dev); | ||
3970 | |||
3971 | schedule_work(&ugeth->tq); | ||
3972 | |||
3973 | mod_timer(&ugeth->phy_info_timer, jiffies + PHY_CHANGE_TIME * HZ); | ||
3974 | } | ||
3975 | |||
3976 | /* Keep trying aneg for some time | ||
3977 | * If, after GFAR_AN_TIMEOUT seconds, it has not | ||
3978 | * finished, we switch to forced. | ||
3979 | * Either way, once the process has completed, we either | ||
3980 | * request the interrupt, or switch the timer over to | ||
3981 | * using ugeth_phy_timer to check status */ | ||
3982 | static void ugeth_phy_startup_timer(unsigned long data) | ||
3983 | { | ||
3984 | struct ugeth_mii_info *mii_info = (struct ugeth_mii_info *)data; | ||
3985 | ucc_geth_private_t *ugeth = netdev_priv(mii_info->dev); | ||
3986 | static int secondary = UGETH_AN_TIMEOUT; | ||
3987 | int result; | ||
3988 | |||
3989 | /* Configure the Auto-negotiation */ | ||
3990 | result = mii_info->phyinfo->config_aneg(mii_info); | ||
3991 | |||
3992 | /* If autonegotiation failed to start, and | ||
3993 | * we haven't timed out, reset the timer, and return */ | ||
3994 | if (result && secondary--) { | ||
3995 | mod_timer(&ugeth->phy_info_timer, jiffies + HZ); | ||
3996 | return; | ||
3997 | } else if (result) { | ||
3998 | /* Couldn't start autonegotiation. | ||
3999 | * Try switching to forced */ | ||
4000 | mii_info->autoneg = 0; | ||
4001 | result = mii_info->phyinfo->config_aneg(mii_info); | ||
4002 | |||
4003 | /* Forcing failed! Give up */ | ||
4004 | if (result) { | ||
4005 | ugeth_err("%s: Forcing failed!", mii_info->dev->name); | ||
4006 | return; | ||
4007 | } | ||
4008 | } | ||
4009 | |||
4010 | /* Kill the timer so it can be restarted */ | ||
4011 | del_timer_sync(&ugeth->phy_info_timer); | ||
4012 | |||
4013 | /* Grab the PHY interrupt, if necessary/possible */ | ||
4014 | if (ugeth->ug_info->board_flags & FSL_UGETH_BRD_HAS_PHY_INTR) { | ||
4015 | if (request_irq(ugeth->ug_info->phy_interrupt, | ||
4016 | phy_interrupt, | ||
4017 | SA_SHIRQ, "phy_interrupt", mii_info->dev) < 0) { | ||
4018 | ugeth_err("%s: Can't get IRQ %d (PHY)", | ||
4019 | mii_info->dev->name, | ||
4020 | ugeth->ug_info->phy_interrupt); | ||
4021 | } else { | ||
4022 | mii_configure_phy_interrupt(ugeth->mii_info, | ||
4023 | MII_INTERRUPT_ENABLED); | ||
4024 | return; | ||
4025 | } | ||
4026 | } | ||
4027 | |||
4028 | /* Start the timer again, this time in order to | ||
4029 | * handle a change in status */ | ||
4030 | init_timer(&ugeth->phy_info_timer); | ||
4031 | ugeth->phy_info_timer.function = &ugeth_phy_timer; | ||
4032 | ugeth->phy_info_timer.data = (unsigned long)mii_info->dev; | ||
4033 | mod_timer(&ugeth->phy_info_timer, jiffies + PHY_CHANGE_TIME * HZ); | ||
4034 | } | ||
4035 | |||
4036 | /* Called when something needs to use the ethernet device */ | ||
4037 | /* Returns 0 for success. */ | ||
4038 | static int ucc_geth_open(struct net_device *dev) | ||
4039 | { | ||
4040 | ucc_geth_private_t *ugeth = netdev_priv(dev); | ||
4041 | int err; | ||
4042 | |||
4043 | ugeth_vdbg("%s: IN", __FUNCTION__); | ||
4044 | |||
4045 | /* Test station address */ | ||
4046 | if (dev->dev_addr[0] & ENET_GROUP_ADDR) { | ||
4047 | ugeth_err("%s: Multicast address used for station address" | ||
4048 | " - is this what you wanted?", __FUNCTION__); | ||
4049 | return -EINVAL; | ||
4050 | } | ||
4051 | |||
4052 | err = ucc_geth_startup(ugeth); | ||
4053 | if (err) { | ||
4054 | ugeth_err("%s: Cannot configure net device, aborting.", | ||
4055 | dev->name); | ||
4056 | return err; | ||
4057 | } | ||
4058 | |||
4059 | err = adjust_enet_interface(ugeth); | ||
4060 | if (err) { | ||
4061 | ugeth_err("%s: Cannot configure net device, aborting.", | ||
4062 | dev->name); | ||
4063 | return err; | ||
4064 | } | ||
4065 | |||
4066 | /* Set MACSTNADDR1, MACSTNADDR2 */ | ||
4067 | /* For more details see the hardware spec. */ | ||
4068 | init_mac_station_addr_regs(dev->dev_addr[0], | ||
4069 | dev->dev_addr[1], | ||
4070 | dev->dev_addr[2], | ||
4071 | dev->dev_addr[3], | ||
4072 | dev->dev_addr[4], | ||
4073 | dev->dev_addr[5], | ||
4074 | &ugeth->ug_regs->macstnaddr1, | ||
4075 | &ugeth->ug_regs->macstnaddr2); | ||
4076 | |||
4077 | err = init_phy(dev); | ||
4078 | if (err) { | ||
4079 | ugeth_err("%s: Cannot initialzie PHY, aborting.", dev->name); | ||
4080 | return err; | ||
4081 | } | ||
4082 | #ifndef CONFIG_UGETH_NAPI | ||
4083 | err = | ||
4084 | request_irq(ugeth->ug_info->uf_info.irq, ucc_geth_irq_handler, 0, | ||
4085 | "UCC Geth", dev); | ||
4086 | if (err) { | ||
4087 | ugeth_err("%s: Cannot get IRQ for net device, aborting.", | ||
4088 | dev->name); | ||
4089 | ucc_geth_stop(ugeth); | ||
4090 | return err; | ||
4091 | } | ||
4092 | #endif /* CONFIG_UGETH_NAPI */ | ||
4093 | |||
4094 | /* Set up the PHY change work queue */ | ||
4095 | INIT_WORK(&ugeth->tq, ugeth_phy_change, dev); | ||
4096 | |||
4097 | init_timer(&ugeth->phy_info_timer); | ||
4098 | ugeth->phy_info_timer.function = &ugeth_phy_startup_timer; | ||
4099 | ugeth->phy_info_timer.data = (unsigned long)ugeth->mii_info; | ||
4100 | mod_timer(&ugeth->phy_info_timer, jiffies + HZ); | ||
4101 | |||
4102 | err = ugeth_enable(ugeth, COMM_DIR_RX_AND_TX); | ||
4103 | if (err) { | ||
4104 | ugeth_err("%s: Cannot enable net device, aborting.", dev->name); | ||
4105 | ucc_geth_stop(ugeth); | ||
4106 | return err; | ||
4107 | } | ||
4108 | |||
4109 | netif_start_queue(dev); | ||
4110 | |||
4111 | return err; | ||
4112 | } | ||
4113 | |||
4114 | /* Stops the kernel queue, and halts the controller */ | ||
4115 | static int ucc_geth_close(struct net_device *dev) | ||
4116 | { | ||
4117 | ucc_geth_private_t *ugeth = netdev_priv(dev); | ||
4118 | |||
4119 | ugeth_vdbg("%s: IN", __FUNCTION__); | ||
4120 | |||
4121 | ucc_geth_stop(ugeth); | ||
4122 | |||
4123 | /* Shutdown the PHY */ | ||
4124 | if (ugeth->mii_info->phyinfo->close) | ||
4125 | ugeth->mii_info->phyinfo->close(ugeth->mii_info); | ||
4126 | |||
4127 | kfree(ugeth->mii_info); | ||
4128 | |||
4129 | netif_stop_queue(dev); | ||
4130 | |||
4131 | return 0; | ||
4132 | } | ||
4133 | |||
4134 | struct ethtool_ops ucc_geth_ethtool_ops = { | ||
4135 | .get_settings = NULL, | ||
4136 | .get_drvinfo = NULL, | ||
4137 | .get_regs_len = NULL, | ||
4138 | .get_regs = NULL, | ||
4139 | .get_link = NULL, | ||
4140 | .get_coalesce = NULL, | ||
4141 | .set_coalesce = NULL, | ||
4142 | .get_ringparam = NULL, | ||
4143 | .set_ringparam = NULL, | ||
4144 | .get_strings = NULL, | ||
4145 | .get_stats_count = NULL, | ||
4146 | .get_ethtool_stats = NULL, | ||
4147 | }; | ||
4148 | |||
4149 | static int ucc_geth_probe(struct device *device) | ||
4150 | { | ||
4151 | struct platform_device *pdev = to_platform_device(device); | ||
4152 | struct ucc_geth_platform_data *ugeth_pdata; | ||
4153 | struct net_device *dev = NULL; | ||
4154 | struct ucc_geth_private *ugeth = NULL; | ||
4155 | struct ucc_geth_info *ug_info; | ||
4156 | int err; | ||
4157 | static int mii_mng_configured = 0; | ||
4158 | |||
4159 | ugeth_vdbg("%s: IN", __FUNCTION__); | ||
4160 | |||
4161 | ugeth_pdata = (struct ucc_geth_platform_data *)pdev->dev.platform_data; | ||
4162 | |||
4163 | ug_info = &ugeth_info[pdev->id]; | ||
4164 | ug_info->uf_info.ucc_num = pdev->id; | ||
4165 | ug_info->uf_info.rx_clock = ugeth_pdata->rx_clock; | ||
4166 | ug_info->uf_info.tx_clock = ugeth_pdata->tx_clock; | ||
4167 | ug_info->uf_info.regs = ugeth_pdata->phy_reg_addr; | ||
4168 | ug_info->uf_info.irq = platform_get_irq(pdev, 0); | ||
4169 | ug_info->phy_address = ugeth_pdata->phy_id; | ||
4170 | ug_info->enet_interface = ugeth_pdata->phy_interface; | ||
4171 | ug_info->board_flags = ugeth_pdata->board_flags; | ||
4172 | ug_info->phy_interrupt = ugeth_pdata->phy_interrupt; | ||
4173 | |||
4174 | printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n", | ||
4175 | ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs, | ||
4176 | ug_info->uf_info.irq); | ||
4177 | |||
4178 | if (ug_info == NULL) { | ||
4179 | ugeth_err("%s: [%d] Missing additional data!", __FUNCTION__, | ||
4180 | pdev->id); | ||
4181 | return -ENODEV; | ||
4182 | } | ||
4183 | |||
4184 | if (!mii_mng_configured) { | ||
4185 | ucc_set_qe_mux_mii_mng(ug_info->uf_info.ucc_num); | ||
4186 | mii_mng_configured = 1; | ||
4187 | } | ||
4188 | |||
4189 | /* Create an ethernet device instance */ | ||
4190 | dev = alloc_etherdev(sizeof(*ugeth)); | ||
4191 | |||
4192 | if (dev == NULL) | ||
4193 | return -ENOMEM; | ||
4194 | |||
4195 | ugeth = netdev_priv(dev); | ||
4196 | spin_lock_init(&ugeth->lock); | ||
4197 | |||
4198 | dev_set_drvdata(device, dev); | ||
4199 | |||
4200 | /* Set the dev->base_addr to the gfar reg region */ | ||
4201 | dev->base_addr = (unsigned long)(ug_info->uf_info.regs); | ||
4202 | |||
4203 | SET_MODULE_OWNER(dev); | ||
4204 | SET_NETDEV_DEV(dev, device); | ||
4205 | |||
4206 | /* Fill in the dev structure */ | ||
4207 | dev->open = ucc_geth_open; | ||
4208 | dev->hard_start_xmit = ucc_geth_start_xmit; | ||
4209 | dev->tx_timeout = ucc_geth_timeout; | ||
4210 | dev->watchdog_timeo = TX_TIMEOUT; | ||
4211 | #ifdef CONFIG_UGETH_NAPI | ||
4212 | dev->poll = ucc_geth_poll; | ||
4213 | dev->weight = UCC_GETH_DEV_WEIGHT; | ||
4214 | #endif /* CONFIG_UGETH_NAPI */ | ||
4215 | dev->stop = ucc_geth_close; | ||
4216 | dev->get_stats = ucc_geth_get_stats; | ||
4217 | // dev->change_mtu = ucc_geth_change_mtu; | ||
4218 | dev->mtu = 1500; | ||
4219 | dev->set_multicast_list = ucc_geth_set_multi; | ||
4220 | dev->ethtool_ops = &ucc_geth_ethtool_ops; | ||
4221 | |||
4222 | err = register_netdev(dev); | ||
4223 | if (err) { | ||
4224 | ugeth_err("%s: Cannot register net device, aborting.", | ||
4225 | dev->name); | ||
4226 | free_netdev(dev); | ||
4227 | return err; | ||
4228 | } | ||
4229 | |||
4230 | ugeth->ug_info = ug_info; | ||
4231 | ugeth->dev = dev; | ||
4232 | memcpy(dev->dev_addr, ugeth_pdata->mac_addr, 6); | ||
4233 | |||
4234 | return 0; | ||
4235 | } | ||
4236 | |||
4237 | static int ucc_geth_remove(struct device *device) | ||
4238 | { | ||
4239 | struct net_device *dev = dev_get_drvdata(device); | ||
4240 | struct ucc_geth_private *ugeth = netdev_priv(dev); | ||
4241 | |||
4242 | dev_set_drvdata(device, NULL); | ||
4243 | ucc_geth_memclean(ugeth); | ||
4244 | free_netdev(dev); | ||
4245 | |||
4246 | return 0; | ||
4247 | } | ||
4248 | |||
4249 | /* Structure for a device driver */ | ||
4250 | static struct device_driver ucc_geth_driver = { | ||
4251 | .name = DRV_NAME, | ||
4252 | .bus = &platform_bus_type, | ||
4253 | .probe = ucc_geth_probe, | ||
4254 | .remove = ucc_geth_remove, | ||
4255 | }; | ||
4256 | |||
4257 | static int __init ucc_geth_init(void) | ||
4258 | { | ||
4259 | int i; | ||
4260 | printk(KERN_INFO "ucc_geth: " DRV_DESC "\n"); | ||
4261 | for (i = 0; i < 8; i++) | ||
4262 | memcpy(&(ugeth_info[i]), &ugeth_primary_info, | ||
4263 | sizeof(ugeth_primary_info)); | ||
4264 | |||
4265 | return driver_register(&ucc_geth_driver); | ||
4266 | } | ||
4267 | |||
4268 | static void __exit ucc_geth_exit(void) | ||
4269 | { | ||
4270 | driver_unregister(&ucc_geth_driver); | ||
4271 | } | ||
4272 | |||
4273 | module_init(ucc_geth_init); | ||
4274 | module_exit(ucc_geth_exit); | ||
4275 | |||
4276 | MODULE_AUTHOR("Freescale Semiconductor, Inc"); | ||
4277 | MODULE_DESCRIPTION(DRV_DESC); | ||
4278 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h new file mode 100644 index 000000000000..005965f5dd9b --- /dev/null +++ b/drivers/net/ucc_geth.h | |||
@@ -0,0 +1,1339 @@ | |||
1 | /* | ||
2 | * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved. | ||
3 | * | ||
4 | * Author: Shlomi Gridish <gridish@freescale.com> | ||
5 | * | ||
6 | * Description: | ||
7 | * Internal header file for UCC Gigabit Ethernet unit routines. | ||
8 | * | ||
9 | * Changelog: | ||
10 | * Jun 28, 2006 Li Yang <LeoLi@freescale.com> | ||
11 | * - Rearrange code and style fixes | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License as published by the | ||
15 | * Free Software Foundation; either version 2 of the License, or (at your | ||
16 | * option) any later version. | ||
17 | */ | ||
18 | #ifndef __UCC_GETH_H__ | ||
19 | #define __UCC_GETH_H__ | ||
20 | |||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/list.h> | ||
23 | #include <linux/fsl_devices.h> | ||
24 | |||
25 | #include <asm/immap_qe.h> | ||
26 | #include <asm/qe.h> | ||
27 | |||
28 | #include <asm/ucc.h> | ||
29 | #include <asm/ucc_fast.h> | ||
30 | |||
31 | #define NUM_TX_QUEUES 8 | ||
32 | #define NUM_RX_QUEUES 8 | ||
33 | #define NUM_BDS_IN_PREFETCHED_BDS 4 | ||
34 | #define TX_IP_OFFSET_ENTRY_MAX 8 | ||
35 | #define NUM_OF_PADDRS 4 | ||
36 | #define ENET_INIT_PARAM_MAX_ENTRIES_RX 9 | ||
37 | #define ENET_INIT_PARAM_MAX_ENTRIES_TX 8 | ||
38 | |||
39 | typedef struct ucc_mii_mng { | ||
40 | u32 miimcfg; /* MII management configuration reg */ | ||
41 | u32 miimcom; /* MII management command reg */ | ||
42 | u32 miimadd; /* MII management address reg */ | ||
43 | u32 miimcon; /* MII management control reg */ | ||
44 | u32 miimstat; /* MII management status reg */ | ||
45 | u32 miimind; /* MII management indication reg */ | ||
46 | } __attribute__ ((packed)) ucc_mii_mng_t; | ||
47 | |||
48 | typedef struct ucc_geth { | ||
49 | ucc_fast_t uccf; | ||
50 | |||
51 | u32 maccfg1; /* mac configuration reg. 1 */ | ||
52 | u32 maccfg2; /* mac configuration reg. 2 */ | ||
53 | u32 ipgifg; /* interframe gap reg. */ | ||
54 | u32 hafdup; /* half-duplex reg. */ | ||
55 | u8 res1[0x10]; | ||
56 | ucc_mii_mng_t miimng; /* MII management structure */ | ||
57 | u32 ifctl; /* interface control reg */ | ||
58 | u32 ifstat; /* interface statux reg */ | ||
59 | u32 macstnaddr1; /* mac station address part 1 reg */ | ||
60 | u32 macstnaddr2; /* mac station address part 2 reg */ | ||
61 | u8 res2[0x8]; | ||
62 | u32 uempr; /* UCC Ethernet Mac parameter reg */ | ||
63 | u32 utbipar; /* UCC tbi address reg */ | ||
64 | u16 uescr; /* UCC Ethernet statistics control reg */ | ||
65 | u8 res3[0x180 - 0x15A]; | ||
66 | u32 tx64; /* Total number of frames (including bad | ||
67 | frames) transmitted that were exactly of the | ||
68 | minimal length (64 for un tagged, 68 for | ||
69 | tagged, or with length exactly equal to the | ||
70 | parameter MINLength */ | ||
71 | u32 tx127; /* Total number of frames (including bad | ||
72 | frames) transmitted that were between | ||
73 | MINLength (Including FCS length==4) and 127 | ||
74 | octets */ | ||
75 | u32 tx255; /* Total number of frames (including bad | ||
76 | frames) transmitted that were between 128 | ||
77 | (Including FCS length==4) and 255 octets */ | ||
78 | u32 rx64; /* Total number of frames received including | ||
79 | bad frames that were exactly of the mninimal | ||
80 | length (64 bytes) */ | ||
81 | u32 rx127; /* Total number of frames (including bad | ||
82 | frames) received that were between MINLength | ||
83 | (Including FCS length==4) and 127 octets */ | ||
84 | u32 rx255; /* Total number of frames (including bad | ||
85 | frames) received that were between 128 | ||
86 | (Including FCS length==4) and 255 octets */ | ||
87 | u32 txok; /* Total number of octets residing in frames | ||
88 | that where involved in succesfull | ||
89 | transmission */ | ||
90 | u16 txcf; /* Total number of PAUSE control frames | ||
91 | transmitted by this MAC */ | ||
92 | u8 res4[0x2]; | ||
93 | u32 tmca; /* Total number of frames that were transmitted | ||
94 | succesfully with the group address bit set | ||
95 | that are not broadcast frames */ | ||
96 | u32 tbca; /* Total number of frames transmitted | ||
97 | succesfully that had destination address | ||
98 | field equal to the broadcast address */ | ||
99 | u32 rxfok; /* Total number of frames received OK */ | ||
100 | u32 rxbok; /* Total number of octets received OK */ | ||
101 | u32 rbyt; /* Total number of octets received including | ||
102 | octets in bad frames. Must be implemented in | ||
103 | HW because it includes octets in frames that | ||
104 | never even reach the UCC */ | ||
105 | u32 rmca; /* Total number of frames that were received | ||
106 | succesfully with the group address bit set | ||
107 | that are not broadcast frames */ | ||
108 | u32 rbca; /* Total number of frames received succesfully | ||
109 | that had destination address equal to the | ||
110 | broadcast address */ | ||
111 | u32 scar; /* Statistics carry register */ | ||
112 | u32 scam; /* Statistics caryy mask register */ | ||
113 | u8 res5[0x200 - 0x1c4]; | ||
114 | } __attribute__ ((packed)) ucc_geth_t; | ||
115 | |||
116 | /* UCC GETH TEMODR Register */ | ||
117 | #define TEMODER_TX_RMON_STATISTICS_ENABLE 0x0100 /* enable Tx statistics | ||
118 | */ | ||
119 | #define TEMODER_SCHEDULER_ENABLE 0x2000 /* enable scheduler */ | ||
120 | #define TEMODER_IP_CHECKSUM_GENERATE 0x0400 /* generate IPv4 | ||
121 | checksums */ | ||
122 | #define TEMODER_PERFORMANCE_OPTIMIZATION_MODE1 0x0200 /* enable performance | ||
123 | optimization | ||
124 | enhancement (mode1) */ | ||
125 | #define TEMODER_RMON_STATISTICS 0x0100 /* enable tx statistics | ||
126 | */ | ||
127 | #define TEMODER_NUM_OF_QUEUES_SHIFT (15-15) /* Number of queues << | ||
128 | shift */ | ||
129 | |||
130 | /* UCC GETH TEMODR Register */ | ||
131 | #define REMODER_RX_RMON_STATISTICS_ENABLE 0x00001000 /* enable Rx | ||
132 | statistics */ | ||
133 | #define REMODER_RX_EXTENDED_FEATURES 0x80000000 /* enable | ||
134 | extended | ||
135 | features */ | ||
136 | #define REMODER_VLAN_OPERATION_TAGGED_SHIFT (31-9 ) /* vlan operation | ||
137 | tagged << shift */ | ||
138 | #define REMODER_VLAN_OPERATION_NON_TAGGED_SHIFT (31-10) /* vlan operation non | ||
139 | tagged << shift */ | ||
140 | #define REMODER_RX_QOS_MODE_SHIFT (31-15) /* rx QoS mode << shift | ||
141 | */ | ||
142 | #define REMODER_RMON_STATISTICS 0x00001000 /* enable rx | ||
143 | statistics */ | ||
144 | #define REMODER_RX_EXTENDED_FILTERING 0x00000800 /* extended | ||
145 | filtering | ||
146 | vs. | ||
147 | mpc82xx-like | ||
148 | filtering */ | ||
149 | #define REMODER_NUM_OF_QUEUES_SHIFT (31-23) /* Number of queues << | ||
150 | shift */ | ||
151 | #define REMODER_DYNAMIC_MAX_FRAME_LENGTH 0x00000008 /* enable | ||
152 | dynamic max | ||
153 | frame length | ||
154 | */ | ||
155 | #define REMODER_DYNAMIC_MIN_FRAME_LENGTH 0x00000004 /* enable | ||
156 | dynamic min | ||
157 | frame length | ||
158 | */ | ||
159 | #define REMODER_IP_CHECKSUM_CHECK 0x00000002 /* check IPv4 | ||
160 | checksums */ | ||
161 | #define REMODER_IP_ADDRESS_ALIGNMENT 0x00000001 /* align ip | ||
162 | address to | ||
163 | 4-byte | ||
164 | boundary */ | ||
165 | |||
166 | /* UCC GETH Event Register */ | ||
167 | #define UCCE_MPD 0x80000000 /* Magic packet | ||
168 | detection */ | ||
169 | #define UCCE_SCAR 0x40000000 | ||
170 | #define UCCE_GRA 0x20000000 /* Tx graceful | ||
171 | stop | ||
172 | complete */ | ||
173 | #define UCCE_CBPR 0x10000000 | ||
174 | #define UCCE_BSY 0x08000000 | ||
175 | #define UCCE_RXC 0x04000000 | ||
176 | #define UCCE_TXC 0x02000000 | ||
177 | #define UCCE_TXE 0x01000000 | ||
178 | #define UCCE_TXB7 0x00800000 | ||
179 | #define UCCE_TXB6 0x00400000 | ||
180 | #define UCCE_TXB5 0x00200000 | ||
181 | #define UCCE_TXB4 0x00100000 | ||
182 | #define UCCE_TXB3 0x00080000 | ||
183 | #define UCCE_TXB2 0x00040000 | ||
184 | #define UCCE_TXB1 0x00020000 | ||
185 | #define UCCE_TXB0 0x00010000 | ||
186 | #define UCCE_RXB7 0x00008000 | ||
187 | #define UCCE_RXB6 0x00004000 | ||
188 | #define UCCE_RXB5 0x00002000 | ||
189 | #define UCCE_RXB4 0x00001000 | ||
190 | #define UCCE_RXB3 0x00000800 | ||
191 | #define UCCE_RXB2 0x00000400 | ||
192 | #define UCCE_RXB1 0x00000200 | ||
193 | #define UCCE_RXB0 0x00000100 | ||
194 | #define UCCE_RXF7 0x00000080 | ||
195 | #define UCCE_RXF6 0x00000040 | ||
196 | #define UCCE_RXF5 0x00000020 | ||
197 | #define UCCE_RXF4 0x00000010 | ||
198 | #define UCCE_RXF3 0x00000008 | ||
199 | #define UCCE_RXF2 0x00000004 | ||
200 | #define UCCE_RXF1 0x00000002 | ||
201 | #define UCCE_RXF0 0x00000001 | ||
202 | |||
203 | #define UCCE_RXBF_SINGLE_MASK (UCCE_RXF0) | ||
204 | #define UCCE_TXBF_SINGLE_MASK (UCCE_TXB0) | ||
205 | |||
206 | #define UCCE_TXB (UCCE_TXB7 | UCCE_TXB6 | UCCE_TXB5 | UCCE_TXB4 |\ | ||
207 | UCCE_TXB3 | UCCE_TXB2 | UCCE_TXB1 | UCCE_TXB0) | ||
208 | #define UCCE_RXB (UCCE_RXB7 | UCCE_RXB6 | UCCE_RXB5 | UCCE_RXB4 |\ | ||
209 | UCCE_RXB3 | UCCE_RXB2 | UCCE_RXB1 | UCCE_RXB0) | ||
210 | #define UCCE_RXF (UCCE_RXF7 | UCCE_RXF6 | UCCE_RXF5 | UCCE_RXF4 |\ | ||
211 | UCCE_RXF3 | UCCE_RXF2 | UCCE_RXF1 | UCCE_RXF0) | ||
212 | #define UCCE_OTHER (UCCE_SCAR | UCCE_GRA | UCCE_CBPR | UCCE_BSY |\ | ||
213 | UCCE_RXC | UCCE_TXC | UCCE_TXE) | ||
214 | |||
215 | /* UCC GETH UPSMR (Protocol Specific Mode Register) */ | ||
216 | #define UPSMR_ECM 0x04000000 /* Enable CAM | ||
217 | Miss or | ||
218 | Enable | ||
219 | Filtering | ||
220 | Miss */ | ||
221 | #define UPSMR_HSE 0x02000000 /* Hardware | ||
222 | Statistics | ||
223 | Enable */ | ||
224 | #define UPSMR_PRO 0x00400000 /* Promiscuous*/ | ||
225 | #define UPSMR_CAP 0x00200000 /* CAM polarity | ||
226 | */ | ||
227 | #define UPSMR_RSH 0x00100000 /* Receive | ||
228 | Short Frames | ||
229 | */ | ||
230 | #define UPSMR_RPM 0x00080000 /* Reduced Pin | ||
231 | Mode | ||
232 | interfaces */ | ||
233 | #define UPSMR_R10M 0x00040000 /* RGMII/RMII | ||
234 | 10 Mode */ | ||
235 | #define UPSMR_RLPB 0x00020000 /* RMII | ||
236 | Loopback | ||
237 | Mode */ | ||
238 | #define UPSMR_TBIM 0x00010000 /* Ten-bit | ||
239 | Interface | ||
240 | Mode */ | ||
241 | #define UPSMR_RMM 0x00001000 /* RMII/RGMII | ||
242 | Mode */ | ||
243 | #define UPSMR_CAM 0x00000400 /* CAM Address | ||
244 | Matching */ | ||
245 | #define UPSMR_BRO 0x00000200 /* Broadcast | ||
246 | Address */ | ||
247 | #define UPSMR_RES1 0x00002000 /* Reserved | ||
248 | feild - must | ||
249 | be 1 */ | ||
250 | |||
251 | /* UCC GETH MACCFG1 (MAC Configuration 1 Register) */ | ||
252 | #define MACCFG1_FLOW_RX 0x00000020 /* Flow Control | ||
253 | Rx */ | ||
254 | #define MACCFG1_FLOW_TX 0x00000010 /* Flow Control | ||
255 | Tx */ | ||
256 | #define MACCFG1_ENABLE_SYNCHED_RX 0x00000008 /* Rx Enable | ||
257 | synchronized | ||
258 | to Rx stream | ||
259 | */ | ||
260 | #define MACCFG1_ENABLE_RX 0x00000004 /* Enable Rx */ | ||
261 | #define MACCFG1_ENABLE_SYNCHED_TX 0x00000002 /* Tx Enable | ||
262 | synchronized | ||
263 | to Tx stream | ||
264 | */ | ||
265 | #define MACCFG1_ENABLE_TX 0x00000001 /* Enable Tx */ | ||
266 | |||
267 | /* UCC GETH MACCFG2 (MAC Configuration 2 Register) */ | ||
268 | #define MACCFG2_PREL_SHIFT (31 - 19) /* Preamble | ||
269 | Length << | ||
270 | shift */ | ||
271 | #define MACCFG2_PREL_MASK 0x0000f000 /* Preamble | ||
272 | Length mask */ | ||
273 | #define MACCFG2_SRP 0x00000080 /* Soft Receive | ||
274 | Preamble */ | ||
275 | #define MACCFG2_STP 0x00000040 /* Soft | ||
276 | Transmit | ||
277 | Preamble */ | ||
278 | #define MACCFG2_RESERVED_1 0x00000020 /* Reserved - | ||
279 | must be set | ||
280 | to 1 */ | ||
281 | #define MACCFG2_LC 0x00000010 /* Length Check | ||
282 | */ | ||
283 | #define MACCFG2_MPE 0x00000008 /* Magic packet | ||
284 | detect */ | ||
285 | #define MACCFG2_FDX 0x00000001 /* Full Duplex */ | ||
286 | #define MACCFG2_FDX_MASK 0x00000001 /* Full Duplex | ||
287 | mask */ | ||
288 | #define MACCFG2_PAD_CRC 0x00000004 | ||
289 | #define MACCFG2_CRC_EN 0x00000002 | ||
290 | #define MACCFG2_PAD_AND_CRC_MODE_NONE 0x00000000 /* Neither | ||
291 | Padding | ||
292 | short frames | ||
293 | nor CRC */ | ||
294 | #define MACCFG2_PAD_AND_CRC_MODE_CRC_ONLY 0x00000002 /* Append CRC | ||
295 | only */ | ||
296 | #define MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC 0x00000004 | ||
297 | #define MACCFG2_INTERFACE_MODE_NIBBLE 0x00000100 /* nibble mode | ||
298 | (MII/RMII/RGMII | ||
299 | 10/100bps) */ | ||
300 | #define MACCFG2_INTERFACE_MODE_BYTE 0x00000200 /* byte mode | ||
301 | (GMII/TBI/RTB/RGMII | ||
302 | 1000bps ) */ | ||
303 | #define MACCFG2_INTERFACE_MODE_MASK 0x00000300 /* mask | ||
304 | covering all | ||
305 | relevant | ||
306 | bits */ | ||
307 | |||
308 | /* UCC GETH IPGIFG (Inter-frame Gap / Inter-Frame Gap Register) */ | ||
309 | #define IPGIFG_NON_BACK_TO_BACK_IFG_PART1_SHIFT (31 - 7) /* Non | ||
310 | back-to-back | ||
311 | inter frame | ||
312 | gap part 1. | ||
313 | << shift */ | ||
314 | #define IPGIFG_NON_BACK_TO_BACK_IFG_PART2_SHIFT (31 - 15) /* Non | ||
315 | back-to-back | ||
316 | inter frame | ||
317 | gap part 2. | ||
318 | << shift */ | ||
319 | #define IPGIFG_MINIMUM_IFG_ENFORCEMENT_SHIFT (31 - 23) /* Mimimum IFG | ||
320 | Enforcement | ||
321 | << shift */ | ||
322 | #define IPGIFG_BACK_TO_BACK_IFG_SHIFT (31 - 31) /* back-to-back | ||
323 | inter frame | ||
324 | gap << shift | ||
325 | */ | ||
326 | #define IPGIFG_NON_BACK_TO_BACK_IFG_PART1_MAX 127 /* Non back-to-back | ||
327 | inter frame gap part | ||
328 | 1. max val */ | ||
329 | #define IPGIFG_NON_BACK_TO_BACK_IFG_PART2_MAX 127 /* Non back-to-back | ||
330 | inter frame gap part | ||
331 | 2. max val */ | ||
332 | #define IPGIFG_MINIMUM_IFG_ENFORCEMENT_MAX 255 /* Mimimum IFG | ||
333 | Enforcement max val */ | ||
334 | #define IPGIFG_BACK_TO_BACK_IFG_MAX 127 /* back-to-back inter | ||
335 | frame gap max val */ | ||
336 | #define IPGIFG_NBTB_CS_IPG_MASK 0x7F000000 | ||
337 | #define IPGIFG_NBTB_IPG_MASK 0x007F0000 | ||
338 | #define IPGIFG_MIN_IFG_MASK 0x0000FF00 | ||
339 | #define IPGIFG_BTB_IPG_MASK 0x0000007F | ||
340 | |||
341 | /* UCC GETH HAFDUP (Half Duplex Register) */ | ||
342 | #define HALFDUP_ALT_BEB_TRUNCATION_SHIFT (31 - 11) /* Alternate | ||
343 | Binary | ||
344 | Exponential | ||
345 | Backoff | ||
346 | Truncation | ||
347 | << shift */ | ||
348 | #define HALFDUP_ALT_BEB_TRUNCATION_MAX 0xf /* Alternate Binary | ||
349 | Exponential Backoff | ||
350 | Truncation max val */ | ||
351 | #define HALFDUP_ALT_BEB 0x00080000 /* Alternate | ||
352 | Binary | ||
353 | Exponential | ||
354 | Backoff */ | ||
355 | #define HALFDUP_BACK_PRESSURE_NO_BACKOFF 0x00040000 /* Back | ||
356 | pressure no | ||
357 | backoff */ | ||
358 | #define HALFDUP_NO_BACKOFF 0x00020000 /* No Backoff */ | ||
359 | #define HALFDUP_EXCESSIVE_DEFER 0x00010000 /* Excessive | ||
360 | Defer */ | ||
361 | #define HALFDUP_MAX_RETRANSMISSION_SHIFT (31 - 19) /* Maximum | ||
362 | Retransmission | ||
363 | << shift */ | ||
364 | #define HALFDUP_MAX_RETRANSMISSION_MAX 0xf /* Maximum | ||
365 | Retransmission max | ||
366 | val */ | ||
367 | #define HALFDUP_COLLISION_WINDOW_SHIFT (31 - 31) /* Collision | ||
368 | Window << | ||
369 | shift */ | ||
370 | #define HALFDUP_COLLISION_WINDOW_MAX 0x3f /* Collision Window max | ||
371 | val */ | ||
372 | #define HALFDUP_ALT_BEB_TR_MASK 0x00F00000 | ||
373 | #define HALFDUP_RETRANS_MASK 0x0000F000 | ||
374 | #define HALFDUP_COL_WINDOW_MASK 0x0000003F | ||
375 | |||
376 | /* UCC GETH UCCS (Ethernet Status Register) */ | ||
377 | #define UCCS_BPR 0x02 /* Back pressure (in | ||
378 | half duplex mode) */ | ||
379 | #define UCCS_PAU 0x02 /* Pause state (in full | ||
380 | duplex mode) */ | ||
381 | #define UCCS_MPD 0x01 /* Magic Packet | ||
382 | Detected */ | ||
383 | |||
384 | /* UCC GETH MIIMCFG (MII Management Configuration Register) */ | ||
385 | #define MIIMCFG_RESET_MANAGEMENT 0x80000000 /* Reset | ||
386 | management */ | ||
387 | #define MIIMCFG_NO_PREAMBLE 0x00000010 /* Preamble | ||
388 | suppress */ | ||
389 | #define MIIMCFG_CLOCK_DIVIDE_SHIFT (31 - 31) /* clock divide | ||
390 | << shift */ | ||
391 | #define MIIMCFG_CLOCK_DIVIDE_MAX 0xf /* clock divide max val | ||
392 | */ | ||
393 | #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_2 0x00000000 /* divide by 2 */ | ||
394 | #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_4 0x00000001 /* divide by 4 */ | ||
395 | #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_6 0x00000002 /* divide by 6 */ | ||
396 | #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_8 0x00000003 /* divide by 8 */ | ||
397 | #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_10 0x00000004 /* divide by 10 | ||
398 | */ | ||
399 | #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_14 0x00000005 /* divide by 14 | ||
400 | */ | ||
401 | #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_16 0x00000008 /* divide by 16 | ||
402 | */ | ||
403 | #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_20 0x00000006 /* divide by 20 | ||
404 | */ | ||
405 | #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_28 0x00000007 /* divide by 28 | ||
406 | */ | ||
407 | #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_32 0x00000009 /* divide by 32 | ||
408 | */ | ||
409 | #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_48 0x0000000a /* divide by 48 | ||
410 | */ | ||
411 | #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_64 0x0000000b /* divide by 64 | ||
412 | */ | ||
413 | #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_80 0x0000000c /* divide by 80 | ||
414 | */ | ||
415 | #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_112 0x0000000d /* divide by | ||
416 | 112 */ | ||
417 | #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_160 0x0000000e /* divide by | ||
418 | 160 */ | ||
419 | #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_224 0x0000000f /* divide by | ||
420 | 224 */ | ||
421 | |||
422 | /* UCC GETH MIIMCOM (MII Management Command Register) */ | ||
423 | #define MIIMCOM_SCAN_CYCLE 0x00000002 /* Scan cycle */ | ||
424 | #define MIIMCOM_READ_CYCLE 0x00000001 /* Read cycle */ | ||
425 | |||
426 | /* UCC GETH MIIMADD (MII Management Address Register) */ | ||
427 | #define MIIMADD_PHY_ADDRESS_SHIFT (31 - 23) /* PHY Address | ||
428 | << shift */ | ||
429 | #define MIIMADD_PHY_REGISTER_SHIFT (31 - 31) /* PHY Register | ||
430 | << shift */ | ||
431 | |||
432 | /* UCC GETH MIIMCON (MII Management Control Register) */ | ||
433 | #define MIIMCON_PHY_CONTROL_SHIFT (31 - 31) /* PHY Control | ||
434 | << shift */ | ||
435 | #define MIIMCON_PHY_STATUS_SHIFT (31 - 31) /* PHY Status | ||
436 | << shift */ | ||
437 | |||
438 | /* UCC GETH MIIMIND (MII Management Indicator Register) */ | ||
439 | #define MIIMIND_NOT_VALID 0x00000004 /* Not valid */ | ||
440 | #define MIIMIND_SCAN 0x00000002 /* Scan in | ||
441 | progress */ | ||
442 | #define MIIMIND_BUSY 0x00000001 | ||
443 | |||
444 | /* UCC GETH IFSTAT (Interface Status Register) */ | ||
445 | #define IFSTAT_EXCESS_DEFER 0x00000200 /* Excessive | ||
446 | transmission | ||
447 | defer */ | ||
448 | |||
449 | /* UCC GETH MACSTNADDR1 (Station Address Part 1 Register) */ | ||
450 | #define MACSTNADDR1_OCTET_6_SHIFT (31 - 7) /* Station | ||
451 | address 6th | ||
452 | octet << | ||
453 | shift */ | ||
454 | #define MACSTNADDR1_OCTET_5_SHIFT (31 - 15) /* Station | ||
455 | address 5th | ||
456 | octet << | ||
457 | shift */ | ||
458 | #define MACSTNADDR1_OCTET_4_SHIFT (31 - 23) /* Station | ||
459 | address 4th | ||
460 | octet << | ||
461 | shift */ | ||
462 | #define MACSTNADDR1_OCTET_3_SHIFT (31 - 31) /* Station | ||
463 | address 3rd | ||
464 | octet << | ||
465 | shift */ | ||
466 | |||
467 | /* UCC GETH MACSTNADDR2 (Station Address Part 2 Register) */ | ||
468 | #define MACSTNADDR2_OCTET_2_SHIFT (31 - 7) /* Station | ||
469 | address 2nd | ||
470 | octet << | ||
471 | shift */ | ||
472 | #define MACSTNADDR2_OCTET_1_SHIFT (31 - 15) /* Station | ||
473 | address 1st | ||
474 | octet << | ||
475 | shift */ | ||
476 | |||
477 | /* UCC GETH UEMPR (Ethernet Mac Parameter Register) */ | ||
478 | #define UEMPR_PAUSE_TIME_VALUE_SHIFT (31 - 15) /* Pause time | ||
479 | value << | ||
480 | shift */ | ||
481 | #define UEMPR_EXTENDED_PAUSE_TIME_VALUE_SHIFT (31 - 31) /* Extended | ||
482 | pause time | ||
483 | value << | ||
484 | shift */ | ||
485 | |||
486 | /* UCC GETH UTBIPAR (Ten Bit Interface Physical Address Register) */ | ||
487 | #define UTBIPAR_PHY_ADDRESS_SHIFT (31 - 31) /* Phy address | ||
488 | << shift */ | ||
489 | #define UTBIPAR_PHY_ADDRESS_MASK 0x0000001f /* Phy address | ||
490 | mask */ | ||
491 | |||
492 | /* UCC GETH UESCR (Ethernet Statistics Control Register) */ | ||
493 | #define UESCR_AUTOZ 0x8000 /* Automatically zero | ||
494 | addressed | ||
495 | statistical counter | ||
496 | values */ | ||
497 | #define UESCR_CLRCNT 0x4000 /* Clear all statistics | ||
498 | counters */ | ||
499 | #define UESCR_MAXCOV_SHIFT (15 - 7) /* Max | ||
500 | Coalescing | ||
501 | Value << | ||
502 | shift */ | ||
503 | #define UESCR_SCOV_SHIFT (15 - 15) /* Status | ||
504 | Coalescing | ||
505 | Value << | ||
506 | shift */ | ||
507 | |||
508 | /* UCC GETH UDSR (Data Synchronization Register) */ | ||
509 | #define UDSR_MAGIC 0x067E | ||
510 | |||
511 | typedef struct ucc_geth_thread_data_tx { | ||
512 | u8 res0[104]; | ||
513 | } __attribute__ ((packed)) ucc_geth_thread_data_tx_t; | ||
514 | |||
515 | typedef struct ucc_geth_thread_data_rx { | ||
516 | u8 res0[40]; | ||
517 | } __attribute__ ((packed)) ucc_geth_thread_data_rx_t; | ||
518 | |||
519 | /* Send Queue Queue-Descriptor */ | ||
520 | typedef struct ucc_geth_send_queue_qd { | ||
521 | u32 bd_ring_base; /* pointer to BD ring base address */ | ||
522 | u8 res0[0x8]; | ||
523 | u32 last_bd_completed_address;/* initialize to last entry in BD ring */ | ||
524 | u8 res1[0x30]; | ||
525 | } __attribute__ ((packed)) ucc_geth_send_queue_qd_t; | ||
526 | |||
527 | typedef struct ucc_geth_send_queue_mem_region { | ||
528 | ucc_geth_send_queue_qd_t sqqd[NUM_TX_QUEUES]; | ||
529 | } __attribute__ ((packed)) ucc_geth_send_queue_mem_region_t; | ||
530 | |||
531 | typedef struct ucc_geth_thread_tx_pram { | ||
532 | u8 res0[64]; | ||
533 | } __attribute__ ((packed)) ucc_geth_thread_tx_pram_t; | ||
534 | |||
535 | typedef struct ucc_geth_thread_rx_pram { | ||
536 | u8 res0[128]; | ||
537 | } __attribute__ ((packed)) ucc_geth_thread_rx_pram_t; | ||
538 | |||
539 | #define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING 64 | ||
540 | #define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_8 64 | ||
541 | #define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_16 96 | ||
542 | |||
543 | typedef struct ucc_geth_scheduler { | ||
544 | u16 cpucount0; /* CPU packet counter */ | ||
545 | u16 cpucount1; /* CPU packet counter */ | ||
546 | u16 cecount0; /* QE packet counter */ | ||
547 | u16 cecount1; /* QE packet counter */ | ||
548 | u16 cpucount2; /* CPU packet counter */ | ||
549 | u16 cpucount3; /* CPU packet counter */ | ||
550 | u16 cecount2; /* QE packet counter */ | ||
551 | u16 cecount3; /* QE packet counter */ | ||
552 | u16 cpucount4; /* CPU packet counter */ | ||
553 | u16 cpucount5; /* CPU packet counter */ | ||
554 | u16 cecount4; /* QE packet counter */ | ||
555 | u16 cecount5; /* QE packet counter */ | ||
556 | u16 cpucount6; /* CPU packet counter */ | ||
557 | u16 cpucount7; /* CPU packet counter */ | ||
558 | u16 cecount6; /* QE packet counter */ | ||
559 | u16 cecount7; /* QE packet counter */ | ||
560 | u32 weightstatus[NUM_TX_QUEUES]; /* accumulated weight factor */ | ||
561 | u32 rtsrshadow; /* temporary variable handled by QE */ | ||
562 | u32 time; /* temporary variable handled by QE */ | ||
563 | u32 ttl; /* temporary variable handled by QE */ | ||
564 | u32 mblinterval; /* max burst length interval */ | ||
565 | u16 nortsrbytetime; /* normalized value of byte time in tsr units */ | ||
566 | u8 fracsiz; /* radix 2 log value of denom. of | ||
567 | NorTSRByteTime */ | ||
568 | u8 res0[1]; | ||
569 | u8 strictpriorityq; /* Strict Priority Mask register */ | ||
570 | u8 txasap; /* Transmit ASAP register */ | ||
571 | u8 extrabw; /* Extra BandWidth register */ | ||
572 | u8 oldwfqmask; /* temporary variable handled by QE */ | ||
573 | u8 weightfactor[NUM_TX_QUEUES]; | ||
574 | /**< weight factor for queues */ | ||
575 | u32 minw; /* temporary variable handled by QE */ | ||
576 | u8 res1[0x70 - 0x64]; | ||
577 | } __attribute__ ((packed)) ucc_geth_scheduler_t; | ||
578 | |||
579 | typedef struct ucc_geth_tx_firmware_statistics_pram { | ||
580 | u32 sicoltx; /* single collision */ | ||
581 | u32 mulcoltx; /* multiple collision */ | ||
582 | u32 latecoltxfr; /* late collision */ | ||
583 | u32 frabortduecol; /* frames aborted due to transmit collision */ | ||
584 | u32 frlostinmactxer; /* frames lost due to internal MAC error | ||
585 | transmission that are not counted on any | ||
586 | other counter */ | ||
587 | u32 carriersenseertx; /* carrier sense error */ | ||
588 | u32 frtxok; /* frames transmitted OK */ | ||
589 | u32 txfrexcessivedefer; /* frames with defferal time greater than | ||
590 | specified threshold */ | ||
591 | u32 txpkts256; /* total packets (including bad) between 256 | ||
592 | and 511 octets */ | ||
593 | u32 txpkts512; /* total packets (including bad) between 512 | ||
594 | and 1023 octets */ | ||
595 | u32 txpkts1024; /* total packets (including bad) between 1024 | ||
596 | and 1518 octets */ | ||
597 | u32 txpktsjumbo; /* total packets (including bad) between 1024 | ||
598 | and MAXLength octets */ | ||
599 | } __attribute__ ((packed)) ucc_geth_tx_firmware_statistics_pram_t; | ||
600 | |||
601 | typedef struct ucc_geth_rx_firmware_statistics_pram { | ||
602 | u32 frrxfcser; /* frames with crc error */ | ||
603 | u32 fraligner; /* frames with alignment error */ | ||
604 | u32 inrangelenrxer; /* in range length error */ | ||
605 | u32 outrangelenrxer; /* out of range length error */ | ||
606 | u32 frtoolong; /* frame too long */ | ||
607 | u32 runt; /* runt */ | ||
608 | u32 verylongevent; /* very long event */ | ||
609 | u32 symbolerror; /* symbol error */ | ||
610 | u32 dropbsy; /* drop because of BD not ready */ | ||
611 | u8 res0[0x8]; | ||
612 | u32 mismatchdrop; /* drop because of MAC filtering (e.g. address | ||
613 | or type mismatch) */ | ||
614 | u32 underpkts; /* total frames less than 64 octets */ | ||
615 | u32 pkts256; /* total frames (including bad) between 256 and | ||
616 | 511 octets */ | ||
617 | u32 pkts512; /* total frames (including bad) between 512 and | ||
618 | 1023 octets */ | ||
619 | u32 pkts1024; /* total frames (including bad) between 1024 | ||
620 | and 1518 octets */ | ||
621 | u32 pktsjumbo; /* total frames (including bad) between 1024 | ||
622 | and MAXLength octets */ | ||
623 | u32 frlossinmacer; /* frames lost because of internal MAC error | ||
624 | that is not counted in any other counter */ | ||
625 | u32 pausefr; /* pause frames */ | ||
626 | u8 res1[0x4]; | ||
627 | u32 removevlan; /* total frames that had their VLAN tag removed | ||
628 | */ | ||
629 | u32 replacevlan; /* total frames that had their VLAN tag | ||
630 | replaced */ | ||
631 | u32 insertvlan; /* total frames that had their VLAN tag | ||
632 | inserted */ | ||
633 | } __attribute__ ((packed)) ucc_geth_rx_firmware_statistics_pram_t; | ||
634 | |||
635 | typedef struct ucc_geth_rx_interrupt_coalescing_entry { | ||
636 | u32 interruptcoalescingmaxvalue; /* interrupt coalescing max | ||
637 | value */ | ||
638 | u32 interruptcoalescingcounter; /* interrupt coalescing counter, | ||
639 | initialize to | ||
640 | interruptcoalescingmaxvalue */ | ||
641 | } __attribute__ ((packed)) ucc_geth_rx_interrupt_coalescing_entry_t; | ||
642 | |||
643 | typedef struct ucc_geth_rx_interrupt_coalescing_table { | ||
644 | ucc_geth_rx_interrupt_coalescing_entry_t coalescingentry[NUM_RX_QUEUES]; | ||
645 | /**< interrupt coalescing entry */ | ||
646 | } __attribute__ ((packed)) ucc_geth_rx_interrupt_coalescing_table_t; | ||
647 | |||
648 | typedef struct ucc_geth_rx_prefetched_bds { | ||
649 | qe_bd_t bd[NUM_BDS_IN_PREFETCHED_BDS]; /* prefetched bd */ | ||
650 | } __attribute__ ((packed)) ucc_geth_rx_prefetched_bds_t; | ||
651 | |||
652 | typedef struct ucc_geth_rx_bd_queues_entry { | ||
653 | u32 bdbaseptr; /* BD base pointer */ | ||
654 | u32 bdptr; /* BD pointer */ | ||
655 | u32 externalbdbaseptr; /* external BD base pointer */ | ||
656 | u32 externalbdptr; /* external BD pointer */ | ||
657 | } __attribute__ ((packed)) ucc_geth_rx_bd_queues_entry_t; | ||
658 | |||
659 | typedef struct ucc_geth_tx_global_pram { | ||
660 | u16 temoder; | ||
661 | u8 res0[0x38 - 0x02]; | ||
662 | u32 sqptr; /* a base pointer to send queue memory region */ | ||
663 | u32 schedulerbasepointer; /* a base pointer to scheduler memory | ||
664 | region */ | ||
665 | u32 txrmonbaseptr; /* base pointer to Tx RMON statistics counter */ | ||
666 | u32 tstate; /* tx internal state. High byte contains | ||
667 | function code */ | ||
668 | u8 iphoffset[TX_IP_OFFSET_ENTRY_MAX]; | ||
669 | u32 vtagtable[0x8]; /* 8 4-byte VLAN tags */ | ||
670 | u32 tqptr; /* a base pointer to the Tx Queues Memory | ||
671 | Region */ | ||
672 | u8 res2[0x80 - 0x74]; | ||
673 | } __attribute__ ((packed)) ucc_geth_tx_global_pram_t; | ||
674 | |||
675 | /* structure representing Extended Filtering Global Parameters in PRAM */ | ||
676 | typedef struct ucc_geth_exf_global_pram { | ||
677 | u32 l2pcdptr; /* individual address filter, high */ | ||
678 | u8 res0[0x10 - 0x04]; | ||
679 | } __attribute__ ((packed)) ucc_geth_exf_global_pram_t; | ||
680 | |||
681 | typedef struct ucc_geth_rx_global_pram { | ||
682 | u32 remoder; /* ethernet mode reg. */ | ||
683 | u32 rqptr; /* base pointer to the Rx Queues Memory Region*/ | ||
684 | u32 res0[0x1]; | ||
685 | u8 res1[0x20 - 0xC]; | ||
686 | u16 typeorlen; /* cutoff point less than which, type/len field | ||
687 | is considered length */ | ||
688 | u8 res2[0x1]; | ||
689 | u8 rxgstpack; /* acknowledgement on GRACEFUL STOP RX command*/ | ||
690 | u32 rxrmonbaseptr; /* base pointer to Rx RMON statistics counter */ | ||
691 | u8 res3[0x30 - 0x28]; | ||
692 | u32 intcoalescingptr; /* Interrupt coalescing table pointer */ | ||
693 | u8 res4[0x36 - 0x34]; | ||
694 | u8 rstate; /* rx internal state. High byte contains | ||
695 | function code */ | ||
696 | u8 res5[0x46 - 0x37]; | ||
697 | u16 mrblr; /* max receive buffer length reg. */ | ||
698 | u32 rbdqptr; /* base pointer to RxBD parameter table | ||
699 | description */ | ||
700 | u16 mflr; /* max frame length reg. */ | ||
701 | u16 minflr; /* min frame length reg. */ | ||
702 | u16 maxd1; /* max dma1 length reg. */ | ||
703 | u16 maxd2; /* max dma2 length reg. */ | ||
704 | u32 ecamptr; /* external CAM address */ | ||
705 | u32 l2qt; /* VLAN priority mapping table. */ | ||
706 | u32 l3qt[0x8]; /* IP priority mapping table. */ | ||
707 | u16 vlantype; /* vlan type */ | ||
708 | u16 vlantci; /* default vlan tci */ | ||
709 | u8 addressfiltering[64]; /* address filtering data structure */ | ||
710 | u32 exfGlobalParam; /* base address for extended filtering global | ||
711 | parameters */ | ||
712 | u8 res6[0x100 - 0xC4]; /* Initialize to zero */ | ||
713 | } __attribute__ ((packed)) ucc_geth_rx_global_pram_t; | ||
714 | |||
715 | #define GRACEFUL_STOP_ACKNOWLEDGE_RX 0x01 | ||
716 | |||
717 | /* structure representing InitEnet command */ | ||
718 | typedef struct ucc_geth_init_pram { | ||
719 | u8 resinit1; | ||
720 | u8 resinit2; | ||
721 | u8 resinit3; | ||
722 | u8 resinit4; | ||
723 | u16 resinit5; | ||
724 | u8 res1[0x1]; | ||
725 | u8 largestexternallookupkeysize; | ||
726 | u32 rgftgfrxglobal; | ||
727 | u32 rxthread[ENET_INIT_PARAM_MAX_ENTRIES_RX]; /* rx threads */ | ||
728 | u8 res2[0x38 - 0x30]; | ||
729 | u32 txglobal; /* tx global */ | ||
730 | u32 txthread[ENET_INIT_PARAM_MAX_ENTRIES_TX]; /* tx threads */ | ||
731 | u8 res3[0x1]; | ||
732 | } __attribute__ ((packed)) ucc_geth_init_pram_t; | ||
733 | |||
734 | #define ENET_INIT_PARAM_RGF_SHIFT (32 - 4) | ||
735 | #define ENET_INIT_PARAM_TGF_SHIFT (32 - 8) | ||
736 | |||
737 | #define ENET_INIT_PARAM_RISC_MASK 0x0000003f | ||
738 | #define ENET_INIT_PARAM_PTR_MASK 0x00ffffc0 | ||
739 | #define ENET_INIT_PARAM_SNUM_MASK 0xff000000 | ||
740 | #define ENET_INIT_PARAM_SNUM_SHIFT 24 | ||
741 | |||
742 | #define ENET_INIT_PARAM_MAGIC_RES_INIT1 0x06 | ||
743 | #define ENET_INIT_PARAM_MAGIC_RES_INIT2 0x30 | ||
744 | #define ENET_INIT_PARAM_MAGIC_RES_INIT3 0xff | ||
745 | #define ENET_INIT_PARAM_MAGIC_RES_INIT4 0x00 | ||
746 | #define ENET_INIT_PARAM_MAGIC_RES_INIT5 0x0400 | ||
747 | |||
748 | /* structure representing 82xx Address Filtering Enet Address in PRAM */ | ||
749 | typedef struct ucc_geth_82xx_enet_address { | ||
750 | u8 res1[0x2]; | ||
751 | u16 h; /* address (MSB) */ | ||
752 | u16 m; /* address */ | ||
753 | u16 l; /* address (LSB) */ | ||
754 | } __attribute__ ((packed)) ucc_geth_82xx_enet_address_t; | ||
755 | |||
756 | /* structure representing 82xx Address Filtering PRAM */ | ||
757 | typedef struct ucc_geth_82xx_address_filtering_pram { | ||
758 | u32 iaddr_h; /* individual address filter, high */ | ||
759 | u32 iaddr_l; /* individual address filter, low */ | ||
760 | u32 gaddr_h; /* group address filter, high */ | ||
761 | u32 gaddr_l; /* group address filter, low */ | ||
762 | ucc_geth_82xx_enet_address_t taddr; | ||
763 | ucc_geth_82xx_enet_address_t paddr[NUM_OF_PADDRS]; | ||
764 | u8 res0[0x40 - 0x38]; | ||
765 | } __attribute__ ((packed)) ucc_geth_82xx_address_filtering_pram_t; | ||
766 | |||
767 | /* GETH Tx firmware statistics structure, used when calling | ||
768 | UCC_GETH_GetStatistics. */ | ||
769 | typedef struct ucc_geth_tx_firmware_statistics { | ||
770 | u32 sicoltx; /* single collision */ | ||
771 | u32 mulcoltx; /* multiple collision */ | ||
772 | u32 latecoltxfr; /* late collision */ | ||
773 | u32 frabortduecol; /* frames aborted due to transmit collision */ | ||
774 | u32 frlostinmactxer; /* frames lost due to internal MAC error | ||
775 | transmission that are not counted on any | ||
776 | other counter */ | ||
777 | u32 carriersenseertx; /* carrier sense error */ | ||
778 | u32 frtxok; /* frames transmitted OK */ | ||
779 | u32 txfrexcessivedefer; /* frames with defferal time greater than | ||
780 | specified threshold */ | ||
781 | u32 txpkts256; /* total packets (including bad) between 256 | ||
782 | and 511 octets */ | ||
783 | u32 txpkts512; /* total packets (including bad) between 512 | ||
784 | and 1023 octets */ | ||
785 | u32 txpkts1024; /* total packets (including bad) between 1024 | ||
786 | and 1518 octets */ | ||
787 | u32 txpktsjumbo; /* total packets (including bad) between 1024 | ||
788 | and MAXLength octets */ | ||
789 | } __attribute__ ((packed)) ucc_geth_tx_firmware_statistics_t; | ||
790 | |||
791 | /* GETH Rx firmware statistics structure, used when calling | ||
792 | UCC_GETH_GetStatistics. */ | ||
793 | typedef struct ucc_geth_rx_firmware_statistics { | ||
794 | u32 frrxfcser; /* frames with crc error */ | ||
795 | u32 fraligner; /* frames with alignment error */ | ||
796 | u32 inrangelenrxer; /* in range length error */ | ||
797 | u32 outrangelenrxer; /* out of range length error */ | ||
798 | u32 frtoolong; /* frame too long */ | ||
799 | u32 runt; /* runt */ | ||
800 | u32 verylongevent; /* very long event */ | ||
801 | u32 symbolerror; /* symbol error */ | ||
802 | u32 dropbsy; /* drop because of BD not ready */ | ||
803 | u8 res0[0x8]; | ||
804 | u32 mismatchdrop; /* drop because of MAC filtering (e.g. address | ||
805 | or type mismatch) */ | ||
806 | u32 underpkts; /* total frames less than 64 octets */ | ||
807 | u32 pkts256; /* total frames (including bad) between 256 and | ||
808 | 511 octets */ | ||
809 | u32 pkts512; /* total frames (including bad) between 512 and | ||
810 | 1023 octets */ | ||
811 | u32 pkts1024; /* total frames (including bad) between 1024 | ||
812 | and 1518 octets */ | ||
813 | u32 pktsjumbo; /* total frames (including bad) between 1024 | ||
814 | and MAXLength octets */ | ||
815 | u32 frlossinmacer; /* frames lost because of internal MAC error | ||
816 | that is not counted in any other counter */ | ||
817 | u32 pausefr; /* pause frames */ | ||
818 | u8 res1[0x4]; | ||
819 | u32 removevlan; /* total frames that had their VLAN tag removed | ||
820 | */ | ||
821 | u32 replacevlan; /* total frames that had their VLAN tag | ||
822 | replaced */ | ||
823 | u32 insertvlan; /* total frames that had their VLAN tag | ||
824 | inserted */ | ||
825 | } __attribute__ ((packed)) ucc_geth_rx_firmware_statistics_t; | ||
826 | |||
827 | /* GETH hardware statistics structure, used when calling | ||
828 | UCC_GETH_GetStatistics. */ | ||
829 | typedef struct ucc_geth_hardware_statistics { | ||
830 | u32 tx64; /* Total number of frames (including bad | ||
831 | frames) transmitted that were exactly of the | ||
832 | minimal length (64 for un tagged, 68 for | ||
833 | tagged, or with length exactly equal to the | ||
834 | parameter MINLength */ | ||
835 | u32 tx127; /* Total number of frames (including bad | ||
836 | frames) transmitted that were between | ||
837 | MINLength (Including FCS length==4) and 127 | ||
838 | octets */ | ||
839 | u32 tx255; /* Total number of frames (including bad | ||
840 | frames) transmitted that were between 128 | ||
841 | (Including FCS length==4) and 255 octets */ | ||
842 | u32 rx64; /* Total number of frames received including | ||
843 | bad frames that were exactly of the mninimal | ||
844 | length (64 bytes) */ | ||
845 | u32 rx127; /* Total number of frames (including bad | ||
846 | frames) received that were between MINLength | ||
847 | (Including FCS length==4) and 127 octets */ | ||
848 | u32 rx255; /* Total number of frames (including bad | ||
849 | frames) received that were between 128 | ||
850 | (Including FCS length==4) and 255 octets */ | ||
851 | u32 txok; /* Total number of octets residing in frames | ||
852 | that where involved in succesfull | ||
853 | transmission */ | ||
854 | u16 txcf; /* Total number of PAUSE control frames | ||
855 | transmitted by this MAC */ | ||
856 | u32 tmca; /* Total number of frames that were transmitted | ||
857 | succesfully with the group address bit set | ||
858 | that are not broadcast frames */ | ||
859 | u32 tbca; /* Total number of frames transmitted | ||
860 | succesfully that had destination address | ||
861 | field equal to the broadcast address */ | ||
862 | u32 rxfok; /* Total number of frames received OK */ | ||
863 | u32 rxbok; /* Total number of octets received OK */ | ||
864 | u32 rbyt; /* Total number of octets received including | ||
865 | octets in bad frames. Must be implemented in | ||
866 | HW because it includes octets in frames that | ||
867 | never even reach the UCC */ | ||
868 | u32 rmca; /* Total number of frames that were received | ||
869 | succesfully with the group address bit set | ||
870 | that are not broadcast frames */ | ||
871 | u32 rbca; /* Total number of frames received succesfully | ||
872 | that had destination address equal to the | ||
873 | broadcast address */ | ||
874 | } __attribute__ ((packed)) ucc_geth_hardware_statistics_t; | ||
875 | |||
876 | /* UCC GETH Tx errors returned via TxConf callback */ | ||
877 | #define TX_ERRORS_DEF 0x0200 | ||
878 | #define TX_ERRORS_EXDEF 0x0100 | ||
879 | #define TX_ERRORS_LC 0x0080 | ||
880 | #define TX_ERRORS_RL 0x0040 | ||
881 | #define TX_ERRORS_RC_MASK 0x003C | ||
882 | #define TX_ERRORS_RC_SHIFT 2 | ||
883 | #define TX_ERRORS_UN 0x0002 | ||
884 | #define TX_ERRORS_CSL 0x0001 | ||
885 | |||
886 | /* UCC GETH Rx errors returned via RxStore callback */ | ||
887 | #define RX_ERRORS_CMR 0x0200 | ||
888 | #define RX_ERRORS_M 0x0100 | ||
889 | #define RX_ERRORS_BC 0x0080 | ||
890 | #define RX_ERRORS_MC 0x0040 | ||
891 | |||
892 | /* Transmit BD. These are in addition to values defined in uccf. */ | ||
893 | #define T_VID 0x003c0000 /* insert VLAN id index mask. */ | ||
894 | #define T_DEF (((u32) TX_ERRORS_DEF ) << 16) | ||
895 | #define T_EXDEF (((u32) TX_ERRORS_EXDEF ) << 16) | ||
896 | #define T_LC (((u32) TX_ERRORS_LC ) << 16) | ||
897 | #define T_RL (((u32) TX_ERRORS_RL ) << 16) | ||
898 | #define T_RC_MASK (((u32) TX_ERRORS_RC_MASK ) << 16) | ||
899 | #define T_UN (((u32) TX_ERRORS_UN ) << 16) | ||
900 | #define T_CSL (((u32) TX_ERRORS_CSL ) << 16) | ||
901 | #define T_ERRORS_REPORT (T_DEF | T_EXDEF | T_LC | T_RL | T_RC_MASK \ | ||
902 | | T_UN | T_CSL) /* transmit errors to report */ | ||
903 | |||
904 | /* Receive BD. These are in addition to values defined in uccf. */ | ||
905 | #define R_LG 0x00200000 /* Frame length violation. */ | ||
906 | #define R_NO 0x00100000 /* Non-octet aligned frame. */ | ||
907 | #define R_SH 0x00080000 /* Short frame. */ | ||
908 | #define R_CR 0x00040000 /* CRC error. */ | ||
909 | #define R_OV 0x00020000 /* Overrun. */ | ||
910 | #define R_IPCH 0x00010000 /* IP checksum check failed. */ | ||
911 | #define R_CMR (((u32) RX_ERRORS_CMR ) << 16) | ||
912 | #define R_M (((u32) RX_ERRORS_M ) << 16) | ||
913 | #define R_BC (((u32) RX_ERRORS_BC ) << 16) | ||
914 | #define R_MC (((u32) RX_ERRORS_MC ) << 16) | ||
915 | #define R_ERRORS_REPORT (R_CMR | R_M | R_BC | R_MC) /* receive errors to | ||
916 | report */ | ||
917 | #define R_ERRORS_FATAL (R_LG | R_NO | R_SH | R_CR | \ | ||
918 | R_OV | R_IPCH) /* receive errors to discard */ | ||
919 | |||
920 | /* Alignments */ | ||
921 | #define UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT 256 | ||
922 | #define UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT 128 | ||
923 | #define UCC_GETH_THREAD_RX_PRAM_ALIGNMENT 128 | ||
924 | #define UCC_GETH_THREAD_TX_PRAM_ALIGNMENT 64 | ||
925 | #define UCC_GETH_THREAD_DATA_ALIGNMENT 256 /* spec gives values | ||
926 | based on num of | ||
927 | threads, but always | ||
928 | using the maximum is | ||
929 | easier */ | ||
930 | #define UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT 32 | ||
931 | #define UCC_GETH_SCHEDULER_ALIGNMENT 4 /* This is a guess */ | ||
932 | #define UCC_GETH_TX_STATISTICS_ALIGNMENT 4 /* This is a guess */ | ||
933 | #define UCC_GETH_RX_STATISTICS_ALIGNMENT 4 /* This is a guess */ | ||
934 | #define UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT 4 /* This is a | ||
935 | guess */ | ||
936 | #define UCC_GETH_RX_BD_QUEUES_ALIGNMENT 8 /* This is a guess */ | ||
937 | #define UCC_GETH_RX_PREFETCHED_BDS_ALIGNMENT 128 /* This is a guess */ | ||
938 | #define UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT 4 /* This | ||
939 | is a | ||
940 | guess | ||
941 | */ | ||
942 | #define UCC_GETH_RX_BD_RING_ALIGNMENT 32 | ||
943 | #define UCC_GETH_TX_BD_RING_ALIGNMENT 32 | ||
944 | #define UCC_GETH_MRBLR_ALIGNMENT 128 | ||
945 | #define UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT 4 | ||
946 | #define UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT 32 | ||
947 | #define UCC_GETH_RX_DATA_BUF_ALIGNMENT 64 | ||
948 | |||
949 | #define UCC_GETH_TAD_EF 0x80 | ||
950 | #define UCC_GETH_TAD_V 0x40 | ||
951 | #define UCC_GETH_TAD_REJ 0x20 | ||
952 | #define UCC_GETH_TAD_VTAG_OP_RIGHT_SHIFT 2 | ||
953 | #define UCC_GETH_TAD_VTAG_OP_SHIFT 6 | ||
954 | #define UCC_GETH_TAD_V_NON_VTAG_OP 0x20 | ||
955 | #define UCC_GETH_TAD_RQOS_SHIFT 0 | ||
956 | #define UCC_GETH_TAD_V_PRIORITY_SHIFT 5 | ||
957 | #define UCC_GETH_TAD_CFI 0x10 | ||
958 | |||
959 | #define UCC_GETH_VLAN_PRIORITY_MAX 8 | ||
960 | #define UCC_GETH_IP_PRIORITY_MAX 64 | ||
961 | #define UCC_GETH_TX_VTAG_TABLE_ENTRY_MAX 8 | ||
962 | #define UCC_GETH_RX_BD_RING_SIZE_MIN 8 | ||
963 | #define UCC_GETH_TX_BD_RING_SIZE_MIN 2 | ||
964 | |||
965 | #define UCC_GETH_SIZE_OF_BD QE_SIZEOF_BD | ||
966 | |||
967 | /* Driver definitions */ | ||
968 | #define TX_BD_RING_LEN 0x10 | ||
969 | #define RX_BD_RING_LEN 0x10 | ||
970 | #define UCC_GETH_DEV_WEIGHT TX_BD_RING_LEN | ||
971 | |||
972 | #define TX_RING_MOD_MASK(size) (size-1) | ||
973 | #define RX_RING_MOD_MASK(size) (size-1) | ||
974 | |||
975 | #define ENET_NUM_OCTETS_PER_ADDRESS 6 | ||
976 | #define ENET_GROUP_ADDR 0x01 /* Group address mask | ||
977 | for ethernet | ||
978 | addresses */ | ||
979 | |||
980 | #define TX_TIMEOUT (1*HZ) | ||
981 | #define SKB_ALLOC_TIMEOUT 100000 | ||
982 | #define PHY_INIT_TIMEOUT 100000 | ||
983 | #define PHY_CHANGE_TIME 2 | ||
984 | |||
985 | /* Fast Ethernet (10/100 Mbps) */ | ||
986 | #define UCC_GETH_URFS_INIT 512 /* Rx virtual FIFO size | ||
987 | */ | ||
988 | #define UCC_GETH_URFET_INIT 256 /* 1/2 urfs */ | ||
989 | #define UCC_GETH_URFSET_INIT 384 /* 3/4 urfs */ | ||
990 | #define UCC_GETH_UTFS_INIT 512 /* Tx virtual FIFO size | ||
991 | */ | ||
992 | #define UCC_GETH_UTFET_INIT 256 /* 1/2 utfs */ | ||
993 | #define UCC_GETH_UTFTT_INIT 128 | ||
994 | /* Gigabit Ethernet (1000 Mbps) */ | ||
995 | #define UCC_GETH_URFS_GIGA_INIT 4096/*2048*/ /* Rx virtual | ||
996 | FIFO size */ | ||
997 | #define UCC_GETH_URFET_GIGA_INIT 2048/*1024*/ /* 1/2 urfs */ | ||
998 | #define UCC_GETH_URFSET_GIGA_INIT 3072/*1536*/ /* 3/4 urfs */ | ||
999 | #define UCC_GETH_UTFS_GIGA_INIT 8192/*2048*/ /* Tx virtual | ||
1000 | FIFO size */ | ||
1001 | #define UCC_GETH_UTFET_GIGA_INIT 4096/*1024*/ /* 1/2 utfs */ | ||
1002 | #define UCC_GETH_UTFTT_GIGA_INIT 0x400/*0x40*/ /* */ | ||
1003 | |||
1004 | #define UCC_GETH_REMODER_INIT 0 /* bits that must be | ||
1005 | set */ | ||
1006 | #define UCC_GETH_TEMODER_INIT 0xC000 /* bits that must */ | ||
1007 | #define UCC_GETH_UPSMR_INIT (UPSMR_RES1) /* Start value | ||
1008 | for this | ||
1009 | register */ | ||
1010 | #define UCC_GETH_MACCFG1_INIT 0 | ||
1011 | #define UCC_GETH_MACCFG2_INIT (MACCFG2_RESERVED_1) | ||
1012 | #define UCC_GETH_MIIMCFG_MNGMNT_CLC_DIV_INIT \ | ||
1013 | (MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_112) | ||
1014 | |||
1015 | /* Ethernet speed */ | ||
1016 | typedef enum enet_speed { | ||
1017 | ENET_SPEED_10BT, /* 10 Base T */ | ||
1018 | ENET_SPEED_100BT, /* 100 Base T */ | ||
1019 | ENET_SPEED_1000BT /* 1000 Base T */ | ||
1020 | } enet_speed_e; | ||
1021 | |||
1022 | /* Ethernet Address Type. */ | ||
1023 | typedef enum enet_addr_type { | ||
1024 | ENET_ADDR_TYPE_INDIVIDUAL, | ||
1025 | ENET_ADDR_TYPE_GROUP, | ||
1026 | ENET_ADDR_TYPE_BROADCAST | ||
1027 | } enet_addr_type_e; | ||
1028 | |||
1029 | /* TBI / MII Set Register */ | ||
1030 | typedef enum enet_tbi_mii_reg { | ||
1031 | ENET_TBI_MII_CR = 0x00, /* Control (CR ) */ | ||
1032 | ENET_TBI_MII_SR = 0x01, /* Status (SR ) */ | ||
1033 | ENET_TBI_MII_ANA = 0x04, /* AN advertisement (ANA ) */ | ||
1034 | ENET_TBI_MII_ANLPBPA = 0x05, /* AN link partner base page ability | ||
1035 | (ANLPBPA) */ | ||
1036 | ENET_TBI_MII_ANEX = 0x06, /* AN expansion (ANEX ) */ | ||
1037 | ENET_TBI_MII_ANNPT = 0x07, /* AN next page transmit (ANNPT ) */ | ||
1038 | ENET_TBI_MII_ANLPANP = 0x08, /* AN link partner ability next page | ||
1039 | (ANLPANP) */ | ||
1040 | ENET_TBI_MII_EXST = 0x0F, /* Extended status (EXST ) */ | ||
1041 | ENET_TBI_MII_JD = 0x10, /* Jitter diagnostics (JD ) */ | ||
1042 | ENET_TBI_MII_TBICON = 0x11 /* TBI control (TBICON ) */ | ||
1043 | } enet_tbi_mii_reg_e; | ||
1044 | |||
1045 | /* UCC GETH 82xx Ethernet Address Recognition Location */ | ||
1046 | typedef enum ucc_geth_enet_address_recognition_location { | ||
1047 | UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_STATION_ADDRESS,/* station | ||
1048 | address */ | ||
1049 | UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_PADDR_FIRST, /* additional | ||
1050 | station | ||
1051 | address | ||
1052 | paddr1 */ | ||
1053 | UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_PADDR2, /* additional | ||
1054 | station | ||
1055 | address | ||
1056 | paddr2 */ | ||
1057 | UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_PADDR3, /* additional | ||
1058 | station | ||
1059 | address | ||
1060 | paddr3 */ | ||
1061 | UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_PADDR_LAST, /* additional | ||
1062 | station | ||
1063 | address | ||
1064 | paddr4 */ | ||
1065 | UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_GROUP_HASH, /* group hash */ | ||
1066 | UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_INDIVIDUAL_HASH /* individual | ||
1067 | hash */ | ||
1068 | } ucc_geth_enet_address_recognition_location_e; | ||
1069 | |||
1070 | /* UCC GETH vlan operation tagged */ | ||
1071 | typedef enum ucc_geth_vlan_operation_tagged { | ||
1072 | UCC_GETH_VLAN_OPERATION_TAGGED_NOP = 0x0, /* Tagged - nop */ | ||
1073 | UCC_GETH_VLAN_OPERATION_TAGGED_REPLACE_VID_PORTION_OF_Q_TAG | ||
1074 | = 0x1, /* Tagged - replace vid portion of q tag */ | ||
1075 | UCC_GETH_VLAN_OPERATION_TAGGED_IF_VID0_REPLACE_VID_WITH_DEFAULT_VALUE | ||
1076 | = 0x2, /* Tagged - if vid0 replace vid with default value */ | ||
1077 | UCC_GETH_VLAN_OPERATION_TAGGED_EXTRACT_Q_TAG_FROM_FRAME | ||
1078 | = 0x3 /* Tagged - extract q tag from frame */ | ||
1079 | } ucc_geth_vlan_operation_tagged_e; | ||
1080 | |||
1081 | /* UCC GETH vlan operation non-tagged */ | ||
1082 | typedef enum ucc_geth_vlan_operation_non_tagged { | ||
1083 | UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP = 0x0, /* Non tagged - nop */ | ||
1084 | UCC_GETH_VLAN_OPERATION_NON_TAGGED_Q_TAG_INSERT = 0x1 /* Non tagged - | ||
1085 | q tag insert | ||
1086 | */ | ||
1087 | } ucc_geth_vlan_operation_non_tagged_e; | ||
1088 | |||
1089 | /* UCC GETH Rx Quality of Service Mode */ | ||
1090 | typedef enum ucc_geth_qos_mode { | ||
1091 | UCC_GETH_QOS_MODE_DEFAULT = 0x0, /* default queue */ | ||
1092 | UCC_GETH_QOS_MODE_QUEUE_NUM_FROM_L2_CRITERIA = 0x1, /* queue | ||
1093 | determined | ||
1094 | by L2 | ||
1095 | criteria */ | ||
1096 | UCC_GETH_QOS_MODE_QUEUE_NUM_FROM_L3_CRITERIA = 0x2 /* queue | ||
1097 | determined | ||
1098 | by L3 | ||
1099 | criteria */ | ||
1100 | } ucc_geth_qos_mode_e; | ||
1101 | |||
1102 | /* UCC GETH Statistics Gathering Mode - These are bit flags, 'or' them together | ||
1103 | for combined functionality */ | ||
1104 | typedef enum ucc_geth_statistics_gathering_mode { | ||
1105 | UCC_GETH_STATISTICS_GATHERING_MODE_NONE = 0x00000000, /* No | ||
1106 | statistics | ||
1107 | gathering */ | ||
1108 | UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE = 0x00000001,/* Enable | ||
1109 | hardware | ||
1110 | statistics | ||
1111 | gathering | ||
1112 | */ | ||
1113 | UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX = 0x00000004,/*Enable | ||
1114 | firmware | ||
1115 | tx | ||
1116 | statistics | ||
1117 | gathering | ||
1118 | */ | ||
1119 | UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX = 0x00000008/* Enable | ||
1120 | firmware | ||
1121 | rx | ||
1122 | statistics | ||
1123 | gathering | ||
1124 | */ | ||
1125 | } ucc_geth_statistics_gathering_mode_e; | ||
1126 | |||
1127 | /* UCC GETH Pad and CRC Mode - Note, Padding without CRC is not possible */ | ||
1128 | typedef enum ucc_geth_maccfg2_pad_and_crc_mode { | ||
1129 | UCC_GETH_PAD_AND_CRC_MODE_NONE | ||
1130 | = MACCFG2_PAD_AND_CRC_MODE_NONE, /* Neither Padding | ||
1131 | short frames | ||
1132 | nor CRC */ | ||
1133 | UCC_GETH_PAD_AND_CRC_MODE_CRC_ONLY | ||
1134 | = MACCFG2_PAD_AND_CRC_MODE_CRC_ONLY, /* Append | ||
1135 | CRC only */ | ||
1136 | UCC_GETH_PAD_AND_CRC_MODE_PAD_AND_CRC = | ||
1137 | MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC | ||
1138 | } ucc_geth_maccfg2_pad_and_crc_mode_e; | ||
1139 | |||
1140 | /* UCC GETH upsmr Flow Control Mode */ | ||
1141 | typedef enum ucc_geth_flow_control_mode { | ||
1142 | UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_NONE = 0x00000000, /* No automatic | ||
1143 | flow control | ||
1144 | */ | ||
1145 | UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_PAUSE_WHEN_EMERGENCY | ||
1146 | = 0x00004000 /* Send pause frame when RxFIFO reaches its | ||
1147 | emergency threshold */ | ||
1148 | } ucc_geth_flow_control_mode_e; | ||
1149 | |||
1150 | /* UCC GETH number of threads */ | ||
1151 | typedef enum ucc_geth_num_of_threads { | ||
1152 | UCC_GETH_NUM_OF_THREADS_1 = 0x1, /* 1 */ | ||
1153 | UCC_GETH_NUM_OF_THREADS_2 = 0x2, /* 2 */ | ||
1154 | UCC_GETH_NUM_OF_THREADS_4 = 0x0, /* 4 */ | ||
1155 | UCC_GETH_NUM_OF_THREADS_6 = 0x3, /* 6 */ | ||
1156 | UCC_GETH_NUM_OF_THREADS_8 = 0x4 /* 8 */ | ||
1157 | } ucc_geth_num_of_threads_e; | ||
1158 | |||
1159 | /* UCC GETH number of station addresses */ | ||
1160 | typedef enum ucc_geth_num_of_station_addresses { | ||
1161 | UCC_GETH_NUM_OF_STATION_ADDRESSES_1, /* 1 */ | ||
1162 | UCC_GETH_NUM_OF_STATION_ADDRESSES_5 /* 5 */ | ||
1163 | } ucc_geth_num_of_station_addresses_e; | ||
1164 | |||
1165 | typedef u8 enet_addr_t[ENET_NUM_OCTETS_PER_ADDRESS]; | ||
1166 | |||
1167 | /* UCC GETH 82xx Ethernet Address Container */ | ||
1168 | typedef struct enet_addr_container { | ||
1169 | enet_addr_t address; /* ethernet address */ | ||
1170 | ucc_geth_enet_address_recognition_location_e location; /* location in | ||
1171 | 82xx address | ||
1172 | recognition | ||
1173 | hardware */ | ||
1174 | struct list_head node; | ||
1175 | } enet_addr_container_t; | ||
1176 | |||
1177 | #define ENET_ADDR_CONT_ENTRY(ptr) list_entry(ptr, enet_addr_container_t, node) | ||
1178 | |||
1179 | /* UCC GETH Termination Action Descriptor (TAD) structure. */ | ||
1180 | typedef struct ucc_geth_tad_params { | ||
1181 | int rx_non_dynamic_extended_features_mode; | ||
1182 | int reject_frame; | ||
1183 | ucc_geth_vlan_operation_tagged_e vtag_op; | ||
1184 | ucc_geth_vlan_operation_non_tagged_e vnontag_op; | ||
1185 | ucc_geth_qos_mode_e rqos; | ||
1186 | u8 vpri; | ||
1187 | u16 vid; | ||
1188 | } ucc_geth_tad_params_t; | ||
1189 | |||
1190 | /* GETH protocol initialization structure */ | ||
1191 | typedef struct ucc_geth_info { | ||
1192 | ucc_fast_info_t uf_info; | ||
1193 | u8 numQueuesTx; | ||
1194 | u8 numQueuesRx; | ||
1195 | int ipCheckSumCheck; | ||
1196 | int ipCheckSumGenerate; | ||
1197 | int rxExtendedFiltering; | ||
1198 | u32 extendedFilteringChainPointer; | ||
1199 | u16 typeorlen; | ||
1200 | int dynamicMaxFrameLength; | ||
1201 | int dynamicMinFrameLength; | ||
1202 | u8 nonBackToBackIfgPart1; | ||
1203 | u8 nonBackToBackIfgPart2; | ||
1204 | u8 miminumInterFrameGapEnforcement; | ||
1205 | u8 backToBackInterFrameGap; | ||
1206 | int ipAddressAlignment; | ||
1207 | int lengthCheckRx; | ||
1208 | u32 mblinterval; | ||
1209 | u16 nortsrbytetime; | ||
1210 | u8 fracsiz; | ||
1211 | u8 strictpriorityq; | ||
1212 | u8 txasap; | ||
1213 | u8 extrabw; | ||
1214 | int miiPreambleSupress; | ||
1215 | u8 altBebTruncation; | ||
1216 | int altBeb; | ||
1217 | int backPressureNoBackoff; | ||
1218 | int noBackoff; | ||
1219 | int excessDefer; | ||
1220 | u8 maxRetransmission; | ||
1221 | u8 collisionWindow; | ||
1222 | int pro; | ||
1223 | int cap; | ||
1224 | int rsh; | ||
1225 | int rlpb; | ||
1226 | int cam; | ||
1227 | int bro; | ||
1228 | int ecm; | ||
1229 | int receiveFlowControl; | ||
1230 | u8 maxGroupAddrInHash; | ||
1231 | u8 maxIndAddrInHash; | ||
1232 | u8 prel; | ||
1233 | u16 maxFrameLength; | ||
1234 | u16 minFrameLength; | ||
1235 | u16 maxD1Length; | ||
1236 | u16 maxD2Length; | ||
1237 | u16 vlantype; | ||
1238 | u16 vlantci; | ||
1239 | u32 ecamptr; | ||
1240 | u32 eventRegMask; | ||
1241 | u16 pausePeriod; | ||
1242 | u16 extensionField; | ||
1243 | u8 phy_address; | ||
1244 | u32 board_flags; | ||
1245 | u32 phy_interrupt; | ||
1246 | u8 weightfactor[NUM_TX_QUEUES]; | ||
1247 | u8 interruptcoalescingmaxvalue[NUM_RX_QUEUES]; | ||
1248 | u8 l2qt[UCC_GETH_VLAN_PRIORITY_MAX]; | ||
1249 | u8 l3qt[UCC_GETH_IP_PRIORITY_MAX]; | ||
1250 | u32 vtagtable[UCC_GETH_TX_VTAG_TABLE_ENTRY_MAX]; | ||
1251 | u8 iphoffset[TX_IP_OFFSET_ENTRY_MAX]; | ||
1252 | u16 bdRingLenTx[NUM_TX_QUEUES]; | ||
1253 | u16 bdRingLenRx[NUM_RX_QUEUES]; | ||
1254 | enet_interface_e enet_interface; | ||
1255 | ucc_geth_num_of_station_addresses_e numStationAddresses; | ||
1256 | qe_fltr_largest_external_tbl_lookup_key_size_e | ||
1257 | largestexternallookupkeysize; | ||
1258 | ucc_geth_statistics_gathering_mode_e statisticsMode; | ||
1259 | ucc_geth_vlan_operation_tagged_e vlanOperationTagged; | ||
1260 | ucc_geth_vlan_operation_non_tagged_e vlanOperationNonTagged; | ||
1261 | ucc_geth_qos_mode_e rxQoSMode; | ||
1262 | ucc_geth_flow_control_mode_e aufc; | ||
1263 | ucc_geth_maccfg2_pad_and_crc_mode_e padAndCrc; | ||
1264 | ucc_geth_num_of_threads_e numThreadsTx; | ||
1265 | ucc_geth_num_of_threads_e numThreadsRx; | ||
1266 | qe_risc_allocation_e riscTx; | ||
1267 | qe_risc_allocation_e riscRx; | ||
1268 | } ucc_geth_info_t; | ||
1269 | |||
1270 | /* structure representing UCC GETH */ | ||
1271 | typedef struct ucc_geth_private { | ||
1272 | ucc_geth_info_t *ug_info; | ||
1273 | ucc_fast_private_t *uccf; | ||
1274 | struct net_device *dev; | ||
1275 | struct net_device_stats stats; /* linux network statistics */ | ||
1276 | ucc_geth_t *ug_regs; | ||
1277 | ucc_geth_init_pram_t *p_init_enet_param_shadow; | ||
1278 | ucc_geth_exf_global_pram_t *p_exf_glbl_param; | ||
1279 | u32 exf_glbl_param_offset; | ||
1280 | ucc_geth_rx_global_pram_t *p_rx_glbl_pram; | ||
1281 | u32 rx_glbl_pram_offset; | ||
1282 | ucc_geth_tx_global_pram_t *p_tx_glbl_pram; | ||
1283 | u32 tx_glbl_pram_offset; | ||
1284 | ucc_geth_send_queue_mem_region_t *p_send_q_mem_reg; | ||
1285 | u32 send_q_mem_reg_offset; | ||
1286 | ucc_geth_thread_data_tx_t *p_thread_data_tx; | ||
1287 | u32 thread_dat_tx_offset; | ||
1288 | ucc_geth_thread_data_rx_t *p_thread_data_rx; | ||
1289 | u32 thread_dat_rx_offset; | ||
1290 | ucc_geth_scheduler_t *p_scheduler; | ||
1291 | u32 scheduler_offset; | ||
1292 | ucc_geth_tx_firmware_statistics_pram_t *p_tx_fw_statistics_pram; | ||
1293 | u32 tx_fw_statistics_pram_offset; | ||
1294 | ucc_geth_rx_firmware_statistics_pram_t *p_rx_fw_statistics_pram; | ||
1295 | u32 rx_fw_statistics_pram_offset; | ||
1296 | ucc_geth_rx_interrupt_coalescing_table_t *p_rx_irq_coalescing_tbl; | ||
1297 | u32 rx_irq_coalescing_tbl_offset; | ||
1298 | ucc_geth_rx_bd_queues_entry_t *p_rx_bd_qs_tbl; | ||
1299 | u32 rx_bd_qs_tbl_offset; | ||
1300 | u8 *p_tx_bd_ring[NUM_TX_QUEUES]; | ||
1301 | u32 tx_bd_ring_offset[NUM_TX_QUEUES]; | ||
1302 | u8 *p_rx_bd_ring[NUM_RX_QUEUES]; | ||
1303 | u32 rx_bd_ring_offset[NUM_RX_QUEUES]; | ||
1304 | u8 *confBd[NUM_TX_QUEUES]; | ||
1305 | u8 *txBd[NUM_TX_QUEUES]; | ||
1306 | u8 *rxBd[NUM_RX_QUEUES]; | ||
1307 | int badFrame[NUM_RX_QUEUES]; | ||
1308 | u16 cpucount[NUM_TX_QUEUES]; | ||
1309 | volatile u16 *p_cpucount[NUM_TX_QUEUES]; | ||
1310 | int indAddrRegUsed[NUM_OF_PADDRS]; | ||
1311 | enet_addr_t paddr[NUM_OF_PADDRS]; | ||
1312 | u8 numGroupAddrInHash; | ||
1313 | u8 numIndAddrInHash; | ||
1314 | u8 numIndAddrInReg; | ||
1315 | int rx_extended_features; | ||
1316 | int rx_non_dynamic_extended_features; | ||
1317 | struct list_head conf_skbs; | ||
1318 | struct list_head group_hash_q; | ||
1319 | struct list_head ind_hash_q; | ||
1320 | u32 saved_uccm; | ||
1321 | spinlock_t lock; | ||
1322 | /* pointers to arrays of skbuffs for tx and rx */ | ||
1323 | struct sk_buff **tx_skbuff[NUM_TX_QUEUES]; | ||
1324 | struct sk_buff **rx_skbuff[NUM_RX_QUEUES]; | ||
1325 | /* indices pointing to the next free sbk in skb arrays */ | ||
1326 | u16 skb_curtx[NUM_TX_QUEUES]; | ||
1327 | u16 skb_currx[NUM_RX_QUEUES]; | ||
1328 | /* index of the first skb which hasn't been transmitted yet. */ | ||
1329 | u16 skb_dirtytx[NUM_TX_QUEUES]; | ||
1330 | |||
1331 | struct work_struct tq; | ||
1332 | struct timer_list phy_info_timer; | ||
1333 | struct ugeth_mii_info *mii_info; | ||
1334 | int oldspeed; | ||
1335 | int oldduplex; | ||
1336 | int oldlink; | ||
1337 | } ucc_geth_private_t; | ||
1338 | |||
1339 | #endif /* __UCC_GETH_H__ */ | ||
diff --git a/drivers/net/ucc_geth_phy.c b/drivers/net/ucc_geth_phy.c new file mode 100644 index 000000000000..f91028c5386d --- /dev/null +++ b/drivers/net/ucc_geth_phy.c | |||
@@ -0,0 +1,801 @@ | |||
1 | /* | ||
2 | * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved. | ||
3 | * | ||
4 | * Author: Shlomi Gridish <gridish@freescale.com> | ||
5 | * | ||
6 | * Description: | ||
7 | * UCC GETH Driver -- PHY handling | ||
8 | * | ||
9 | * Changelog: | ||
10 | * Jun 28, 2006 Li Yang <LeoLi@freescale.com> | ||
11 | * - Rearrange code and style fixes | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License as published by the | ||
15 | * Free Software Foundation; either version 2 of the License, or (at your | ||
16 | * option) any later version. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #include <linux/config.h> | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/sched.h> | ||
23 | #include <linux/string.h> | ||
24 | #include <linux/errno.h> | ||
25 | #include <linux/slab.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/delay.h> | ||
29 | #include <linux/netdevice.h> | ||
30 | #include <linux/etherdevice.h> | ||
31 | #include <linux/skbuff.h> | ||
32 | #include <linux/spinlock.h> | ||
33 | #include <linux/mm.h> | ||
34 | #include <linux/module.h> | ||
35 | #include <linux/version.h> | ||
36 | #include <linux/crc32.h> | ||
37 | #include <linux/mii.h> | ||
38 | #include <linux/ethtool.h> | ||
39 | |||
40 | #include <asm/io.h> | ||
41 | #include <asm/irq.h> | ||
42 | #include <asm/uaccess.h> | ||
43 | |||
44 | #include "ucc_geth.h" | ||
45 | #include "ucc_geth_phy.h" | ||
46 | #include <platforms/83xx/mpc8360e_pb.h> | ||
47 | |||
48 | #define ugphy_printk(level, format, arg...) \ | ||
49 | printk(level format "\n", ## arg) | ||
50 | |||
51 | #define ugphy_dbg(format, arg...) \ | ||
52 | ugphy_printk(KERN_DEBUG, format , ## arg) | ||
53 | #define ugphy_err(format, arg...) \ | ||
54 | ugphy_printk(KERN_ERR, format , ## arg) | ||
55 | #define ugphy_info(format, arg...) \ | ||
56 | ugphy_printk(KERN_INFO, format , ## arg) | ||
57 | #define ugphy_warn(format, arg...) \ | ||
58 | ugphy_printk(KERN_WARNING, format , ## arg) | ||
59 | |||
60 | #ifdef UGETH_VERBOSE_DEBUG | ||
61 | #define ugphy_vdbg ugphy_dbg | ||
62 | #else | ||
63 | #define ugphy_vdbg(fmt, args...) do { } while (0) | ||
64 | #endif /* UGETH_VERBOSE_DEBUG */ | ||
65 | |||
66 | static void config_genmii_advert(struct ugeth_mii_info *mii_info); | ||
67 | static void genmii_setup_forced(struct ugeth_mii_info *mii_info); | ||
68 | static void genmii_restart_aneg(struct ugeth_mii_info *mii_info); | ||
69 | static int gbit_config_aneg(struct ugeth_mii_info *mii_info); | ||
70 | static int genmii_config_aneg(struct ugeth_mii_info *mii_info); | ||
71 | static int genmii_update_link(struct ugeth_mii_info *mii_info); | ||
72 | static int genmii_read_status(struct ugeth_mii_info *mii_info); | ||
73 | u16 phy_read(struct ugeth_mii_info *mii_info, u16 regnum); | ||
74 | void phy_write(struct ugeth_mii_info *mii_info, u16 regnum, u16 val); | ||
75 | |||
76 | static u8 *bcsr_regs = NULL; | ||
77 | |||
78 | /* Write value to the PHY for this device to the register at regnum, */ | ||
79 | /* waiting until the write is done before it returns. All PHY */ | ||
80 | /* configuration has to be done through the TSEC1 MIIM regs */ | ||
81 | void write_phy_reg(struct net_device *dev, int mii_id, int regnum, int value) | ||
82 | { | ||
83 | ucc_geth_private_t *ugeth = netdev_priv(dev); | ||
84 | ucc_mii_mng_t *mii_regs; | ||
85 | enet_tbi_mii_reg_e mii_reg = (enet_tbi_mii_reg_e) regnum; | ||
86 | u32 tmp_reg; | ||
87 | |||
88 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
89 | |||
90 | spin_lock_irq(&ugeth->lock); | ||
91 | |||
92 | mii_regs = ugeth->mii_info->mii_regs; | ||
93 | |||
94 | /* Set this UCC to be the master of the MII managment */ | ||
95 | ucc_set_qe_mux_mii_mng(ugeth->ug_info->uf_info.ucc_num); | ||
96 | |||
97 | /* Stop the MII management read cycle */ | ||
98 | out_be32(&mii_regs->miimcom, 0); | ||
99 | /* Setting up the MII Mangement Address Register */ | ||
100 | tmp_reg = ((u32) mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | mii_reg; | ||
101 | out_be32(&mii_regs->miimadd, tmp_reg); | ||
102 | |||
103 | /* Setting up the MII Mangement Control Register with the value */ | ||
104 | out_be32(&mii_regs->miimcon, (u32) value); | ||
105 | |||
106 | /* Wait till MII management write is complete */ | ||
107 | while ((in_be32(&mii_regs->miimind)) & MIIMIND_BUSY) | ||
108 | cpu_relax(); | ||
109 | |||
110 | spin_unlock_irq(&ugeth->lock); | ||
111 | |||
112 | udelay(10000); | ||
113 | } | ||
114 | |||
115 | /* Reads from register regnum in the PHY for device dev, */ | ||
116 | /* returning the value. Clears miimcom first. All PHY */ | ||
117 | /* configuration has to be done through the TSEC1 MIIM regs */ | ||
118 | int read_phy_reg(struct net_device *dev, int mii_id, int regnum) | ||
119 | { | ||
120 | ucc_geth_private_t *ugeth = netdev_priv(dev); | ||
121 | ucc_mii_mng_t *mii_regs; | ||
122 | enet_tbi_mii_reg_e mii_reg = (enet_tbi_mii_reg_e) regnum; | ||
123 | u32 tmp_reg; | ||
124 | u16 value; | ||
125 | |||
126 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
127 | |||
128 | spin_lock_irq(&ugeth->lock); | ||
129 | |||
130 | mii_regs = ugeth->mii_info->mii_regs; | ||
131 | |||
132 | /* Setting up the MII Mangement Address Register */ | ||
133 | tmp_reg = ((u32) mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | mii_reg; | ||
134 | out_be32(&mii_regs->miimadd, tmp_reg); | ||
135 | |||
136 | /* Perform an MII management read cycle */ | ||
137 | out_be32(&mii_regs->miimcom, MIIMCOM_READ_CYCLE); | ||
138 | |||
139 | /* Wait till MII management write is complete */ | ||
140 | while ((in_be32(&mii_regs->miimind)) & MIIMIND_BUSY) | ||
141 | cpu_relax(); | ||
142 | |||
143 | udelay(10000); | ||
144 | |||
145 | /* Read MII management status */ | ||
146 | value = (u16) in_be32(&mii_regs->miimstat); | ||
147 | out_be32(&mii_regs->miimcom, 0); | ||
148 | if (value == 0xffff) | ||
149 | ugphy_warn("read wrong value : mii_id %d,mii_reg %d, base %08x", | ||
150 | mii_id, mii_reg, (u32) & (mii_regs->miimcfg)); | ||
151 | |||
152 | spin_unlock_irq(&ugeth->lock); | ||
153 | |||
154 | return (value); | ||
155 | } | ||
156 | |||
157 | void mii_clear_phy_interrupt(struct ugeth_mii_info *mii_info) | ||
158 | { | ||
159 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
160 | |||
161 | if (mii_info->phyinfo->ack_interrupt) | ||
162 | mii_info->phyinfo->ack_interrupt(mii_info); | ||
163 | } | ||
164 | |||
165 | void mii_configure_phy_interrupt(struct ugeth_mii_info *mii_info, | ||
166 | u32 interrupts) | ||
167 | { | ||
168 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
169 | |||
170 | mii_info->interrupts = interrupts; | ||
171 | if (mii_info->phyinfo->config_intr) | ||
172 | mii_info->phyinfo->config_intr(mii_info); | ||
173 | } | ||
174 | |||
175 | /* Writes MII_ADVERTISE with the appropriate values, after | ||
176 | * sanitizing advertise to make sure only supported features | ||
177 | * are advertised | ||
178 | */ | ||
179 | static void config_genmii_advert(struct ugeth_mii_info *mii_info) | ||
180 | { | ||
181 | u32 advertise; | ||
182 | u16 adv; | ||
183 | |||
184 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
185 | |||
186 | /* Only allow advertising what this PHY supports */ | ||
187 | mii_info->advertising &= mii_info->phyinfo->features; | ||
188 | advertise = mii_info->advertising; | ||
189 | |||
190 | /* Setup standard advertisement */ | ||
191 | adv = phy_read(mii_info, MII_ADVERTISE); | ||
192 | adv &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4); | ||
193 | if (advertise & ADVERTISED_10baseT_Half) | ||
194 | adv |= ADVERTISE_10HALF; | ||
195 | if (advertise & ADVERTISED_10baseT_Full) | ||
196 | adv |= ADVERTISE_10FULL; | ||
197 | if (advertise & ADVERTISED_100baseT_Half) | ||
198 | adv |= ADVERTISE_100HALF; | ||
199 | if (advertise & ADVERTISED_100baseT_Full) | ||
200 | adv |= ADVERTISE_100FULL; | ||
201 | phy_write(mii_info, MII_ADVERTISE, adv); | ||
202 | } | ||
203 | |||
204 | static void genmii_setup_forced(struct ugeth_mii_info *mii_info) | ||
205 | { | ||
206 | u16 ctrl; | ||
207 | u32 features = mii_info->phyinfo->features; | ||
208 | |||
209 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
210 | |||
211 | ctrl = phy_read(mii_info, MII_BMCR); | ||
212 | |||
213 | ctrl &= | ||
214 | ~(BMCR_FULLDPLX | BMCR_SPEED100 | BMCR_SPEED1000 | BMCR_ANENABLE); | ||
215 | ctrl |= BMCR_RESET; | ||
216 | |||
217 | switch (mii_info->speed) { | ||
218 | case SPEED_1000: | ||
219 | if (features & (SUPPORTED_1000baseT_Half | ||
220 | | SUPPORTED_1000baseT_Full)) { | ||
221 | ctrl |= BMCR_SPEED1000; | ||
222 | break; | ||
223 | } | ||
224 | mii_info->speed = SPEED_100; | ||
225 | case SPEED_100: | ||
226 | if (features & (SUPPORTED_100baseT_Half | ||
227 | | SUPPORTED_100baseT_Full)) { | ||
228 | ctrl |= BMCR_SPEED100; | ||
229 | break; | ||
230 | } | ||
231 | mii_info->speed = SPEED_10; | ||
232 | case SPEED_10: | ||
233 | if (features & (SUPPORTED_10baseT_Half | ||
234 | | SUPPORTED_10baseT_Full)) | ||
235 | break; | ||
236 | default: /* Unsupported speed! */ | ||
237 | ugphy_err("%s: Bad speed!", mii_info->dev->name); | ||
238 | break; | ||
239 | } | ||
240 | |||
241 | phy_write(mii_info, MII_BMCR, ctrl); | ||
242 | } | ||
243 | |||
244 | /* Enable and Restart Autonegotiation */ | ||
245 | static void genmii_restart_aneg(struct ugeth_mii_info *mii_info) | ||
246 | { | ||
247 | u16 ctl; | ||
248 | |||
249 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
250 | |||
251 | ctl = phy_read(mii_info, MII_BMCR); | ||
252 | ctl |= (BMCR_ANENABLE | BMCR_ANRESTART); | ||
253 | phy_write(mii_info, MII_BMCR, ctl); | ||
254 | } | ||
255 | |||
256 | static int gbit_config_aneg(struct ugeth_mii_info *mii_info) | ||
257 | { | ||
258 | u16 adv; | ||
259 | u32 advertise; | ||
260 | |||
261 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
262 | |||
263 | if (mii_info->autoneg) { | ||
264 | /* Configure the ADVERTISE register */ | ||
265 | config_genmii_advert(mii_info); | ||
266 | advertise = mii_info->advertising; | ||
267 | |||
268 | adv = phy_read(mii_info, MII_1000BASETCONTROL); | ||
269 | adv &= ~(MII_1000BASETCONTROL_FULLDUPLEXCAP | | ||
270 | MII_1000BASETCONTROL_HALFDUPLEXCAP); | ||
271 | if (advertise & SUPPORTED_1000baseT_Half) | ||
272 | adv |= MII_1000BASETCONTROL_HALFDUPLEXCAP; | ||
273 | if (advertise & SUPPORTED_1000baseT_Full) | ||
274 | adv |= MII_1000BASETCONTROL_FULLDUPLEXCAP; | ||
275 | phy_write(mii_info, MII_1000BASETCONTROL, adv); | ||
276 | |||
277 | /* Start/Restart aneg */ | ||
278 | genmii_restart_aneg(mii_info); | ||
279 | } else | ||
280 | genmii_setup_forced(mii_info); | ||
281 | |||
282 | return 0; | ||
283 | } | ||
284 | |||
285 | static int genmii_config_aneg(struct ugeth_mii_info *mii_info) | ||
286 | { | ||
287 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
288 | |||
289 | if (mii_info->autoneg) { | ||
290 | config_genmii_advert(mii_info); | ||
291 | genmii_restart_aneg(mii_info); | ||
292 | } else | ||
293 | genmii_setup_forced(mii_info); | ||
294 | |||
295 | return 0; | ||
296 | } | ||
297 | |||
298 | static int genmii_update_link(struct ugeth_mii_info *mii_info) | ||
299 | { | ||
300 | u16 status; | ||
301 | |||
302 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
303 | |||
304 | /* Do a fake read */ | ||
305 | phy_read(mii_info, MII_BMSR); | ||
306 | |||
307 | /* Read link and autonegotiation status */ | ||
308 | status = phy_read(mii_info, MII_BMSR); | ||
309 | if ((status & BMSR_LSTATUS) == 0) | ||
310 | mii_info->link = 0; | ||
311 | else | ||
312 | mii_info->link = 1; | ||
313 | |||
314 | /* If we are autonegotiating, and not done, | ||
315 | * return an error */ | ||
316 | if (mii_info->autoneg && !(status & BMSR_ANEGCOMPLETE)) | ||
317 | return -EAGAIN; | ||
318 | |||
319 | return 0; | ||
320 | } | ||
321 | |||
322 | static int genmii_read_status(struct ugeth_mii_info *mii_info) | ||
323 | { | ||
324 | u16 status; | ||
325 | int err; | ||
326 | |||
327 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
328 | |||
329 | /* Update the link, but return if there | ||
330 | * was an error */ | ||
331 | err = genmii_update_link(mii_info); | ||
332 | if (err) | ||
333 | return err; | ||
334 | |||
335 | if (mii_info->autoneg) { | ||
336 | status = phy_read(mii_info, MII_LPA); | ||
337 | |||
338 | if (status & (LPA_10FULL | LPA_100FULL)) | ||
339 | mii_info->duplex = DUPLEX_FULL; | ||
340 | else | ||
341 | mii_info->duplex = DUPLEX_HALF; | ||
342 | if (status & (LPA_100FULL | LPA_100HALF)) | ||
343 | mii_info->speed = SPEED_100; | ||
344 | else | ||
345 | mii_info->speed = SPEED_10; | ||
346 | mii_info->pause = 0; | ||
347 | } | ||
348 | /* On non-aneg, we assume what we put in BMCR is the speed, | ||
349 | * though magic-aneg shouldn't prevent this case from occurring | ||
350 | */ | ||
351 | |||
352 | return 0; | ||
353 | } | ||
354 | |||
355 | static int marvell_init(struct ugeth_mii_info *mii_info) | ||
356 | { | ||
357 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
358 | |||
359 | phy_write(mii_info, 0x14, 0x0cd2); | ||
360 | phy_write(mii_info, MII_BMCR, | ||
361 | phy_read(mii_info, MII_BMCR) | BMCR_RESET); | ||
362 | msleep(4000); | ||
363 | |||
364 | return 0; | ||
365 | } | ||
366 | |||
367 | static int marvell_config_aneg(struct ugeth_mii_info *mii_info) | ||
368 | { | ||
369 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
370 | |||
371 | /* The Marvell PHY has an errata which requires | ||
372 | * that certain registers get written in order | ||
373 | * to restart autonegotiation */ | ||
374 | phy_write(mii_info, MII_BMCR, BMCR_RESET); | ||
375 | |||
376 | phy_write(mii_info, 0x1d, 0x1f); | ||
377 | phy_write(mii_info, 0x1e, 0x200c); | ||
378 | phy_write(mii_info, 0x1d, 0x5); | ||
379 | phy_write(mii_info, 0x1e, 0); | ||
380 | phy_write(mii_info, 0x1e, 0x100); | ||
381 | |||
382 | gbit_config_aneg(mii_info); | ||
383 | |||
384 | return 0; | ||
385 | } | ||
386 | |||
387 | static int marvell_read_status(struct ugeth_mii_info *mii_info) | ||
388 | { | ||
389 | u16 status; | ||
390 | int err; | ||
391 | |||
392 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
393 | |||
394 | /* Update the link, but return if there | ||
395 | * was an error */ | ||
396 | err = genmii_update_link(mii_info); | ||
397 | if (err) | ||
398 | return err; | ||
399 | |||
400 | /* If the link is up, read the speed and duplex */ | ||
401 | /* If we aren't autonegotiating, assume speeds | ||
402 | * are as set */ | ||
403 | if (mii_info->autoneg && mii_info->link) { | ||
404 | int speed; | ||
405 | status = phy_read(mii_info, MII_M1011_PHY_SPEC_STATUS); | ||
406 | |||
407 | /* Get the duplexity */ | ||
408 | if (status & MII_M1011_PHY_SPEC_STATUS_FULLDUPLEX) | ||
409 | mii_info->duplex = DUPLEX_FULL; | ||
410 | else | ||
411 | mii_info->duplex = DUPLEX_HALF; | ||
412 | |||
413 | /* Get the speed */ | ||
414 | speed = status & MII_M1011_PHY_SPEC_STATUS_SPD_MASK; | ||
415 | switch (speed) { | ||
416 | case MII_M1011_PHY_SPEC_STATUS_1000: | ||
417 | mii_info->speed = SPEED_1000; | ||
418 | break; | ||
419 | case MII_M1011_PHY_SPEC_STATUS_100: | ||
420 | mii_info->speed = SPEED_100; | ||
421 | break; | ||
422 | default: | ||
423 | mii_info->speed = SPEED_10; | ||
424 | break; | ||
425 | } | ||
426 | mii_info->pause = 0; | ||
427 | } | ||
428 | |||
429 | return 0; | ||
430 | } | ||
431 | |||
432 | static int marvell_ack_interrupt(struct ugeth_mii_info *mii_info) | ||
433 | { | ||
434 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
435 | |||
436 | /* Clear the interrupts by reading the reg */ | ||
437 | phy_read(mii_info, MII_M1011_IEVENT); | ||
438 | |||
439 | return 0; | ||
440 | } | ||
441 | |||
442 | static int marvell_config_intr(struct ugeth_mii_info *mii_info) | ||
443 | { | ||
444 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
445 | |||
446 | if (mii_info->interrupts == MII_INTERRUPT_ENABLED) | ||
447 | phy_write(mii_info, MII_M1011_IMASK, MII_M1011_IMASK_INIT); | ||
448 | else | ||
449 | phy_write(mii_info, MII_M1011_IMASK, MII_M1011_IMASK_CLEAR); | ||
450 | |||
451 | return 0; | ||
452 | } | ||
453 | |||
454 | static int cis820x_init(struct ugeth_mii_info *mii_info) | ||
455 | { | ||
456 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
457 | |||
458 | phy_write(mii_info, MII_CIS8201_AUX_CONSTAT, | ||
459 | MII_CIS8201_AUXCONSTAT_INIT); | ||
460 | phy_write(mii_info, MII_CIS8201_EXT_CON1, MII_CIS8201_EXTCON1_INIT); | ||
461 | |||
462 | return 0; | ||
463 | } | ||
464 | |||
465 | static int cis820x_read_status(struct ugeth_mii_info *mii_info) | ||
466 | { | ||
467 | u16 status; | ||
468 | int err; | ||
469 | |||
470 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
471 | |||
472 | /* Update the link, but return if there | ||
473 | * was an error */ | ||
474 | err = genmii_update_link(mii_info); | ||
475 | if (err) | ||
476 | return err; | ||
477 | |||
478 | /* If the link is up, read the speed and duplex */ | ||
479 | /* If we aren't autonegotiating, assume speeds | ||
480 | * are as set */ | ||
481 | if (mii_info->autoneg && mii_info->link) { | ||
482 | int speed; | ||
483 | |||
484 | status = phy_read(mii_info, MII_CIS8201_AUX_CONSTAT); | ||
485 | if (status & MII_CIS8201_AUXCONSTAT_DUPLEX) | ||
486 | mii_info->duplex = DUPLEX_FULL; | ||
487 | else | ||
488 | mii_info->duplex = DUPLEX_HALF; | ||
489 | |||
490 | speed = status & MII_CIS8201_AUXCONSTAT_SPEED; | ||
491 | |||
492 | switch (speed) { | ||
493 | case MII_CIS8201_AUXCONSTAT_GBIT: | ||
494 | mii_info->speed = SPEED_1000; | ||
495 | break; | ||
496 | case MII_CIS8201_AUXCONSTAT_100: | ||
497 | mii_info->speed = SPEED_100; | ||
498 | break; | ||
499 | default: | ||
500 | mii_info->speed = SPEED_10; | ||
501 | break; | ||
502 | } | ||
503 | } | ||
504 | |||
505 | return 0; | ||
506 | } | ||
507 | |||
508 | static int cis820x_ack_interrupt(struct ugeth_mii_info *mii_info) | ||
509 | { | ||
510 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
511 | |||
512 | phy_read(mii_info, MII_CIS8201_ISTAT); | ||
513 | |||
514 | return 0; | ||
515 | } | ||
516 | |||
517 | static int cis820x_config_intr(struct ugeth_mii_info *mii_info) | ||
518 | { | ||
519 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
520 | |||
521 | if (mii_info->interrupts == MII_INTERRUPT_ENABLED) | ||
522 | phy_write(mii_info, MII_CIS8201_IMASK, MII_CIS8201_IMASK_MASK); | ||
523 | else | ||
524 | phy_write(mii_info, MII_CIS8201_IMASK, 0); | ||
525 | |||
526 | return 0; | ||
527 | } | ||
528 | |||
529 | #define DM9161_DELAY 10 | ||
530 | |||
531 | static int dm9161_read_status(struct ugeth_mii_info *mii_info) | ||
532 | { | ||
533 | u16 status; | ||
534 | int err; | ||
535 | |||
536 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
537 | |||
538 | /* Update the link, but return if there | ||
539 | * was an error */ | ||
540 | err = genmii_update_link(mii_info); | ||
541 | if (err) | ||
542 | return err; | ||
543 | |||
544 | /* If the link is up, read the speed and duplex */ | ||
545 | /* If we aren't autonegotiating, assume speeds | ||
546 | * are as set */ | ||
547 | if (mii_info->autoneg && mii_info->link) { | ||
548 | status = phy_read(mii_info, MII_DM9161_SCSR); | ||
549 | if (status & (MII_DM9161_SCSR_100F | MII_DM9161_SCSR_100H)) | ||
550 | mii_info->speed = SPEED_100; | ||
551 | else | ||
552 | mii_info->speed = SPEED_10; | ||
553 | |||
554 | if (status & (MII_DM9161_SCSR_100F | MII_DM9161_SCSR_10F)) | ||
555 | mii_info->duplex = DUPLEX_FULL; | ||
556 | else | ||
557 | mii_info->duplex = DUPLEX_HALF; | ||
558 | } | ||
559 | |||
560 | return 0; | ||
561 | } | ||
562 | |||
563 | static int dm9161_config_aneg(struct ugeth_mii_info *mii_info) | ||
564 | { | ||
565 | struct dm9161_private *priv = mii_info->priv; | ||
566 | |||
567 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
568 | |||
569 | if (0 == priv->resetdone) | ||
570 | return -EAGAIN; | ||
571 | |||
572 | return 0; | ||
573 | } | ||
574 | |||
575 | static void dm9161_timer(unsigned long data) | ||
576 | { | ||
577 | struct ugeth_mii_info *mii_info = (struct ugeth_mii_info *)data; | ||
578 | struct dm9161_private *priv = mii_info->priv; | ||
579 | u16 status = phy_read(mii_info, MII_BMSR); | ||
580 | |||
581 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
582 | |||
583 | if (status & BMSR_ANEGCOMPLETE) { | ||
584 | priv->resetdone = 1; | ||
585 | } else | ||
586 | mod_timer(&priv->timer, jiffies + DM9161_DELAY * HZ); | ||
587 | } | ||
588 | |||
589 | static int dm9161_init(struct ugeth_mii_info *mii_info) | ||
590 | { | ||
591 | struct dm9161_private *priv; | ||
592 | |||
593 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
594 | |||
595 | /* Allocate the private data structure */ | ||
596 | priv = kmalloc(sizeof(struct dm9161_private), GFP_KERNEL); | ||
597 | |||
598 | if (NULL == priv) | ||
599 | return -ENOMEM; | ||
600 | |||
601 | mii_info->priv = priv; | ||
602 | |||
603 | /* Reset is not done yet */ | ||
604 | priv->resetdone = 0; | ||
605 | |||
606 | phy_write(mii_info, MII_BMCR, | ||
607 | phy_read(mii_info, MII_BMCR) | BMCR_RESET); | ||
608 | |||
609 | phy_write(mii_info, MII_BMCR, | ||
610 | phy_read(mii_info, MII_BMCR) & ~BMCR_ISOLATE); | ||
611 | |||
612 | config_genmii_advert(mii_info); | ||
613 | /* Start/Restart aneg */ | ||
614 | genmii_config_aneg(mii_info); | ||
615 | |||
616 | /* Start a timer for DM9161_DELAY seconds to wait | ||
617 | * for the PHY to be ready */ | ||
618 | init_timer(&priv->timer); | ||
619 | priv->timer.function = &dm9161_timer; | ||
620 | priv->timer.data = (unsigned long)mii_info; | ||
621 | mod_timer(&priv->timer, jiffies + DM9161_DELAY * HZ); | ||
622 | |||
623 | return 0; | ||
624 | } | ||
625 | |||
626 | static void dm9161_close(struct ugeth_mii_info *mii_info) | ||
627 | { | ||
628 | struct dm9161_private *priv = mii_info->priv; | ||
629 | |||
630 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
631 | |||
632 | del_timer_sync(&priv->timer); | ||
633 | kfree(priv); | ||
634 | } | ||
635 | |||
636 | static int dm9161_ack_interrupt(struct ugeth_mii_info *mii_info) | ||
637 | { | ||
638 | /* FIXME: This lines are for BUG fixing in the mpc8325. | ||
639 | Remove this from here when it's fixed */ | ||
640 | if (bcsr_regs == NULL) | ||
641 | bcsr_regs = (u8 *) ioremap(BCSR_PHYS_ADDR, BCSR_SIZE); | ||
642 | bcsr_regs[14] |= 0x40; | ||
643 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
644 | |||
645 | /* Clear the interrupts by reading the reg */ | ||
646 | phy_read(mii_info, MII_DM9161_INTR); | ||
647 | |||
648 | |||
649 | return 0; | ||
650 | } | ||
651 | |||
652 | static int dm9161_config_intr(struct ugeth_mii_info *mii_info) | ||
653 | { | ||
654 | /* FIXME: This lines are for BUG fixing in the mpc8325. | ||
655 | Remove this from here when it's fixed */ | ||
656 | if (bcsr_regs == NULL) { | ||
657 | bcsr_regs = (u8 *) ioremap(BCSR_PHYS_ADDR, BCSR_SIZE); | ||
658 | bcsr_regs[14] &= ~0x40; | ||
659 | } | ||
660 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
661 | |||
662 | if (mii_info->interrupts == MII_INTERRUPT_ENABLED) | ||
663 | phy_write(mii_info, MII_DM9161_INTR, MII_DM9161_INTR_INIT); | ||
664 | else | ||
665 | phy_write(mii_info, MII_DM9161_INTR, MII_DM9161_INTR_STOP); | ||
666 | |||
667 | return 0; | ||
668 | } | ||
669 | |||
670 | /* Cicada 820x */ | ||
671 | static struct phy_info phy_info_cis820x = { | ||
672 | .phy_id = 0x000fc440, | ||
673 | .name = "Cicada Cis8204", | ||
674 | .phy_id_mask = 0x000fffc0, | ||
675 | .features = MII_GBIT_FEATURES, | ||
676 | .init = &cis820x_init, | ||
677 | .config_aneg = &gbit_config_aneg, | ||
678 | .read_status = &cis820x_read_status, | ||
679 | .ack_interrupt = &cis820x_ack_interrupt, | ||
680 | .config_intr = &cis820x_config_intr, | ||
681 | }; | ||
682 | |||
683 | static struct phy_info phy_info_dm9161 = { | ||
684 | .phy_id = 0x0181b880, | ||
685 | .phy_id_mask = 0x0ffffff0, | ||
686 | .name = "Davicom DM9161E", | ||
687 | .init = dm9161_init, | ||
688 | .config_aneg = dm9161_config_aneg, | ||
689 | .read_status = dm9161_read_status, | ||
690 | .close = dm9161_close, | ||
691 | }; | ||
692 | |||
693 | static struct phy_info phy_info_dm9161a = { | ||
694 | .phy_id = 0x0181b8a0, | ||
695 | .phy_id_mask = 0x0ffffff0, | ||
696 | .name = "Davicom DM9161A", | ||
697 | .features = MII_BASIC_FEATURES, | ||
698 | .init = dm9161_init, | ||
699 | .config_aneg = dm9161_config_aneg, | ||
700 | .read_status = dm9161_read_status, | ||
701 | .ack_interrupt = dm9161_ack_interrupt, | ||
702 | .config_intr = dm9161_config_intr, | ||
703 | .close = dm9161_close, | ||
704 | }; | ||
705 | |||
706 | static struct phy_info phy_info_marvell = { | ||
707 | .phy_id = 0x01410c00, | ||
708 | .phy_id_mask = 0xffffff00, | ||
709 | .name = "Marvell 88E11x1", | ||
710 | .features = MII_GBIT_FEATURES, | ||
711 | .init = &marvell_init, | ||
712 | .config_aneg = &marvell_config_aneg, | ||
713 | .read_status = &marvell_read_status, | ||
714 | .ack_interrupt = &marvell_ack_interrupt, | ||
715 | .config_intr = &marvell_config_intr, | ||
716 | }; | ||
717 | |||
718 | static struct phy_info phy_info_genmii = { | ||
719 | .phy_id = 0x00000000, | ||
720 | .phy_id_mask = 0x00000000, | ||
721 | .name = "Generic MII", | ||
722 | .features = MII_BASIC_FEATURES, | ||
723 | .config_aneg = genmii_config_aneg, | ||
724 | .read_status = genmii_read_status, | ||
725 | }; | ||
726 | |||
727 | static struct phy_info *phy_info[] = { | ||
728 | &phy_info_cis820x, | ||
729 | &phy_info_marvell, | ||
730 | &phy_info_dm9161, | ||
731 | &phy_info_dm9161a, | ||
732 | &phy_info_genmii, | ||
733 | NULL | ||
734 | }; | ||
735 | |||
736 | u16 phy_read(struct ugeth_mii_info *mii_info, u16 regnum) | ||
737 | { | ||
738 | u16 retval; | ||
739 | unsigned long flags; | ||
740 | |||
741 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
742 | |||
743 | spin_lock_irqsave(&mii_info->mdio_lock, flags); | ||
744 | retval = mii_info->mdio_read(mii_info->dev, mii_info->mii_id, regnum); | ||
745 | spin_unlock_irqrestore(&mii_info->mdio_lock, flags); | ||
746 | |||
747 | return retval; | ||
748 | } | ||
749 | |||
750 | void phy_write(struct ugeth_mii_info *mii_info, u16 regnum, u16 val) | ||
751 | { | ||
752 | unsigned long flags; | ||
753 | |||
754 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
755 | |||
756 | spin_lock_irqsave(&mii_info->mdio_lock, flags); | ||
757 | mii_info->mdio_write(mii_info->dev, mii_info->mii_id, regnum, val); | ||
758 | spin_unlock_irqrestore(&mii_info->mdio_lock, flags); | ||
759 | } | ||
760 | |||
761 | /* Use the PHY ID registers to determine what type of PHY is attached | ||
762 | * to device dev. return a struct phy_info structure describing that PHY | ||
763 | */ | ||
764 | struct phy_info *get_phy_info(struct ugeth_mii_info *mii_info) | ||
765 | { | ||
766 | u16 phy_reg; | ||
767 | u32 phy_ID; | ||
768 | int i; | ||
769 | struct phy_info *theInfo = NULL; | ||
770 | struct net_device *dev = mii_info->dev; | ||
771 | |||
772 | ugphy_vdbg("%s: IN", __FUNCTION__); | ||
773 | |||
774 | /* Grab the bits from PHYIR1, and put them in the upper half */ | ||
775 | phy_reg = phy_read(mii_info, MII_PHYSID1); | ||
776 | phy_ID = (phy_reg & 0xffff) << 16; | ||
777 | |||
778 | /* Grab the bits from PHYIR2, and put them in the lower half */ | ||
779 | phy_reg = phy_read(mii_info, MII_PHYSID2); | ||
780 | phy_ID |= (phy_reg & 0xffff); | ||
781 | |||
782 | /* loop through all the known PHY types, and find one that */ | ||
783 | /* matches the ID we read from the PHY. */ | ||
784 | for (i = 0; phy_info[i]; i++) | ||
785 | if (phy_info[i]->phy_id == (phy_ID & phy_info[i]->phy_id_mask)){ | ||
786 | theInfo = phy_info[i]; | ||
787 | break; | ||
788 | } | ||
789 | |||
790 | /* This shouldn't happen, as we have generic PHY support */ | ||
791 | if (theInfo == NULL) { | ||
792 | ugphy_info("%s: PHY id %x is not supported!", dev->name, | ||
793 | phy_ID); | ||
794 | return NULL; | ||
795 | } else { | ||
796 | ugphy_info("%s: PHY is %s (%x)", dev->name, theInfo->name, | ||
797 | phy_ID); | ||
798 | } | ||
799 | |||
800 | return theInfo; | ||
801 | } | ||
diff --git a/drivers/net/ucc_geth_phy.h b/drivers/net/ucc_geth_phy.h new file mode 100644 index 000000000000..2f98b8f1bb0a --- /dev/null +++ b/drivers/net/ucc_geth_phy.h | |||
@@ -0,0 +1,217 @@ | |||
1 | /* | ||
2 | * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved. | ||
3 | * | ||
4 | * Author: Shlomi Gridish <gridish@freescale.com> | ||
5 | * | ||
6 | * Description: | ||
7 | * UCC GETH Driver -- PHY handling | ||
8 | * | ||
9 | * Changelog: | ||
10 | * Jun 28, 2006 Li Yang <LeoLi@freescale.com> | ||
11 | * - Rearrange code and style fixes | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License as published by the | ||
15 | * Free Software Foundation; either version 2 of the License, or (at your | ||
16 | * option) any later version. | ||
17 | * | ||
18 | */ | ||
19 | #ifndef __UCC_GETH_PHY_H__ | ||
20 | #define __UCC_GETH_PHY_H__ | ||
21 | |||
22 | #define MII_end ((u32)-2) | ||
23 | #define MII_read ((u32)-1) | ||
24 | |||
25 | #define MIIMIND_BUSY 0x00000001 | ||
26 | #define MIIMIND_NOTVALID 0x00000004 | ||
27 | |||
28 | #define UGETH_AN_TIMEOUT 2000 | ||
29 | |||
30 | /* 1000BT control (Marvell & BCM54xx at least) */ | ||
31 | #define MII_1000BASETCONTROL 0x09 | ||
32 | #define MII_1000BASETCONTROL_FULLDUPLEXCAP 0x0200 | ||
33 | #define MII_1000BASETCONTROL_HALFDUPLEXCAP 0x0100 | ||
34 | |||
35 | /* Cicada Extended Control Register 1 */ | ||
36 | #define MII_CIS8201_EXT_CON1 0x17 | ||
37 | #define MII_CIS8201_EXTCON1_INIT 0x0000 | ||
38 | |||
39 | /* Cicada Interrupt Mask Register */ | ||
40 | #define MII_CIS8201_IMASK 0x19 | ||
41 | #define MII_CIS8201_IMASK_IEN 0x8000 | ||
42 | #define MII_CIS8201_IMASK_SPEED 0x4000 | ||
43 | #define MII_CIS8201_IMASK_LINK 0x2000 | ||
44 | #define MII_CIS8201_IMASK_DUPLEX 0x1000 | ||
45 | #define MII_CIS8201_IMASK_MASK 0xf000 | ||
46 | |||
47 | /* Cicada Interrupt Status Register */ | ||
48 | #define MII_CIS8201_ISTAT 0x1a | ||
49 | #define MII_CIS8201_ISTAT_STATUS 0x8000 | ||
50 | #define MII_CIS8201_ISTAT_SPEED 0x4000 | ||
51 | #define MII_CIS8201_ISTAT_LINK 0x2000 | ||
52 | #define MII_CIS8201_ISTAT_DUPLEX 0x1000 | ||
53 | |||
54 | /* Cicada Auxiliary Control/Status Register */ | ||
55 | #define MII_CIS8201_AUX_CONSTAT 0x1c | ||
56 | #define MII_CIS8201_AUXCONSTAT_INIT 0x0004 | ||
57 | #define MII_CIS8201_AUXCONSTAT_DUPLEX 0x0020 | ||
58 | #define MII_CIS8201_AUXCONSTAT_SPEED 0x0018 | ||
59 | #define MII_CIS8201_AUXCONSTAT_GBIT 0x0010 | ||
60 | #define MII_CIS8201_AUXCONSTAT_100 0x0008 | ||
61 | |||
62 | /* 88E1011 PHY Status Register */ | ||
63 | #define MII_M1011_PHY_SPEC_STATUS 0x11 | ||
64 | #define MII_M1011_PHY_SPEC_STATUS_1000 0x8000 | ||
65 | #define MII_M1011_PHY_SPEC_STATUS_100 0x4000 | ||
66 | #define MII_M1011_PHY_SPEC_STATUS_SPD_MASK 0xc000 | ||
67 | #define MII_M1011_PHY_SPEC_STATUS_FULLDUPLEX 0x2000 | ||
68 | #define MII_M1011_PHY_SPEC_STATUS_RESOLVED 0x0800 | ||
69 | #define MII_M1011_PHY_SPEC_STATUS_LINK 0x0400 | ||
70 | |||
71 | #define MII_M1011_IEVENT 0x13 | ||
72 | #define MII_M1011_IEVENT_CLEAR 0x0000 | ||
73 | |||
74 | #define MII_M1011_IMASK 0x12 | ||
75 | #define MII_M1011_IMASK_INIT 0x6400 | ||
76 | #define MII_M1011_IMASK_CLEAR 0x0000 | ||
77 | |||
78 | #define MII_DM9161_SCR 0x10 | ||
79 | #define MII_DM9161_SCR_INIT 0x0610 | ||
80 | |||
81 | /* DM9161 Specified Configuration and Status Register */ | ||
82 | #define MII_DM9161_SCSR 0x11 | ||
83 | #define MII_DM9161_SCSR_100F 0x8000 | ||
84 | #define MII_DM9161_SCSR_100H 0x4000 | ||
85 | #define MII_DM9161_SCSR_10F 0x2000 | ||
86 | #define MII_DM9161_SCSR_10H 0x1000 | ||
87 | |||
88 | /* DM9161 Interrupt Register */ | ||
89 | #define MII_DM9161_INTR 0x15 | ||
90 | #define MII_DM9161_INTR_PEND 0x8000 | ||
91 | #define MII_DM9161_INTR_DPLX_MASK 0x0800 | ||
92 | #define MII_DM9161_INTR_SPD_MASK 0x0400 | ||
93 | #define MII_DM9161_INTR_LINK_MASK 0x0200 | ||
94 | #define MII_DM9161_INTR_MASK 0x0100 | ||
95 | #define MII_DM9161_INTR_DPLX_CHANGE 0x0010 | ||
96 | #define MII_DM9161_INTR_SPD_CHANGE 0x0008 | ||
97 | #define MII_DM9161_INTR_LINK_CHANGE 0x0004 | ||
98 | #define MII_DM9161_INTR_INIT 0x0000 | ||
99 | #define MII_DM9161_INTR_STOP \ | ||
100 | (MII_DM9161_INTR_DPLX_MASK | MII_DM9161_INTR_SPD_MASK \ | ||
101 | | MII_DM9161_INTR_LINK_MASK | MII_DM9161_INTR_MASK) | ||
102 | |||
103 | /* DM9161 10BT Configuration/Status */ | ||
104 | #define MII_DM9161_10BTCSR 0x12 | ||
105 | #define MII_DM9161_10BTCSR_INIT 0x7800 | ||
106 | |||
107 | #define MII_BASIC_FEATURES (SUPPORTED_10baseT_Half | \ | ||
108 | SUPPORTED_10baseT_Full | \ | ||
109 | SUPPORTED_100baseT_Half | \ | ||
110 | SUPPORTED_100baseT_Full | \ | ||
111 | SUPPORTED_Autoneg | \ | ||
112 | SUPPORTED_TP | \ | ||
113 | SUPPORTED_MII) | ||
114 | |||
115 | #define MII_GBIT_FEATURES (MII_BASIC_FEATURES | \ | ||
116 | SUPPORTED_1000baseT_Half | \ | ||
117 | SUPPORTED_1000baseT_Full) | ||
118 | |||
119 | #define MII_READ_COMMAND 0x00000001 | ||
120 | |||
121 | #define MII_INTERRUPT_DISABLED 0x0 | ||
122 | #define MII_INTERRUPT_ENABLED 0x1 | ||
123 | /* Taken from mii_if_info and sungem_phy.h */ | ||
124 | struct ugeth_mii_info { | ||
125 | /* Information about the PHY type */ | ||
126 | /* And management functions */ | ||
127 | struct phy_info *phyinfo; | ||
128 | |||
129 | ucc_mii_mng_t *mii_regs; | ||
130 | |||
131 | /* forced speed & duplex (no autoneg) | ||
132 | * partner speed & duplex & pause (autoneg) | ||
133 | */ | ||
134 | int speed; | ||
135 | int duplex; | ||
136 | int pause; | ||
137 | |||
138 | /* The most recently read link state */ | ||
139 | int link; | ||
140 | |||
141 | /* Enabled Interrupts */ | ||
142 | u32 interrupts; | ||
143 | |||
144 | u32 advertising; | ||
145 | int autoneg; | ||
146 | int mii_id; | ||
147 | |||
148 | /* private data pointer */ | ||
149 | /* For use by PHYs to maintain extra state */ | ||
150 | void *priv; | ||
151 | |||
152 | /* Provided by host chip */ | ||
153 | struct net_device *dev; | ||
154 | |||
155 | /* A lock to ensure that only one thing can read/write | ||
156 | * the MDIO bus at a time */ | ||
157 | spinlock_t mdio_lock; | ||
158 | |||
159 | /* Provided by ethernet driver */ | ||
160 | int (*mdio_read) (struct net_device * dev, int mii_id, int reg); | ||
161 | void (*mdio_write) (struct net_device * dev, int mii_id, int reg, | ||
162 | int val); | ||
163 | }; | ||
164 | |||
165 | /* struct phy_info: a structure which defines attributes for a PHY | ||
166 | * | ||
167 | * id will contain a number which represents the PHY. During | ||
168 | * startup, the driver will poll the PHY to find out what its | ||
169 | * UID--as defined by registers 2 and 3--is. The 32-bit result | ||
170 | * gotten from the PHY will be ANDed with phy_id_mask to | ||
171 | * discard any bits which may change based on revision numbers | ||
172 | * unimportant to functionality | ||
173 | * | ||
174 | * There are 6 commands which take a ugeth_mii_info structure. | ||
175 | * Each PHY must declare config_aneg, and read_status. | ||
176 | */ | ||
177 | struct phy_info { | ||
178 | u32 phy_id; | ||
179 | char *name; | ||
180 | unsigned int phy_id_mask; | ||
181 | u32 features; | ||
182 | |||
183 | /* Called to initialize the PHY */ | ||
184 | int (*init) (struct ugeth_mii_info * mii_info); | ||
185 | |||
186 | /* Called to suspend the PHY for power */ | ||
187 | int (*suspend) (struct ugeth_mii_info * mii_info); | ||
188 | |||
189 | /* Reconfigures autonegotiation (or disables it) */ | ||
190 | int (*config_aneg) (struct ugeth_mii_info * mii_info); | ||
191 | |||
192 | /* Determines the negotiated speed and duplex */ | ||
193 | int (*read_status) (struct ugeth_mii_info * mii_info); | ||
194 | |||
195 | /* Clears any pending interrupts */ | ||
196 | int (*ack_interrupt) (struct ugeth_mii_info * mii_info); | ||
197 | |||
198 | /* Enables or disables interrupts */ | ||
199 | int (*config_intr) (struct ugeth_mii_info * mii_info); | ||
200 | |||
201 | /* Clears up any memory if needed */ | ||
202 | void (*close) (struct ugeth_mii_info * mii_info); | ||
203 | }; | ||
204 | |||
205 | struct phy_info *get_phy_info(struct ugeth_mii_info *mii_info); | ||
206 | void write_phy_reg(struct net_device *dev, int mii_id, int regnum, int value); | ||
207 | int read_phy_reg(struct net_device *dev, int mii_id, int regnum); | ||
208 | void mii_clear_phy_interrupt(struct ugeth_mii_info *mii_info); | ||
209 | void mii_configure_phy_interrupt(struct ugeth_mii_info *mii_info, | ||
210 | u32 interrupts); | ||
211 | |||
212 | struct dm9161_private { | ||
213 | struct timer_list timer; | ||
214 | int resetdone; | ||
215 | }; | ||
216 | |||
217 | #endif /* __UCC_GETH_PHY_H__ */ | ||
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index d3d0ec970318..efeb10b9c61b 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -30,8 +30,8 @@ | |||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #define DRV_NAME "via-rhine" | 32 | #define DRV_NAME "via-rhine" |
33 | #define DRV_VERSION "1.4.0" | 33 | #define DRV_VERSION "1.4.1" |
34 | #define DRV_RELDATE "June-27-2006" | 34 | #define DRV_RELDATE "July-24-2006" |
35 | 35 | ||
36 | 36 | ||
37 | /* A few user-configurable values. | 37 | /* A few user-configurable values. |
@@ -44,6 +44,10 @@ static int max_interrupt_work = 20; | |||
44 | Setting to > 1518 effectively disables this feature. */ | 44 | Setting to > 1518 effectively disables this feature. */ |
45 | static int rx_copybreak; | 45 | static int rx_copybreak; |
46 | 46 | ||
47 | /* Work-around for broken BIOSes: they are unable to get the chip back out of | ||
48 | power state D3 so PXE booting fails. bootparam(7): via-rhine.avoid_D3=1 */ | ||
49 | static int avoid_D3; | ||
50 | |||
47 | /* | 51 | /* |
48 | * In case you are looking for 'options[]' or 'full_duplex[]', they | 52 | * In case you are looking for 'options[]' or 'full_duplex[]', they |
49 | * are gone. Use ethtool(8) instead. | 53 | * are gone. Use ethtool(8) instead. |
@@ -63,7 +67,11 @@ static const int multicast_filter_limit = 32; | |||
63 | There are no ill effects from too-large receive rings. */ | 67 | There are no ill effects from too-large receive rings. */ |
64 | #define TX_RING_SIZE 16 | 68 | #define TX_RING_SIZE 16 |
65 | #define TX_QUEUE_LEN 10 /* Limit ring entries actually used. */ | 69 | #define TX_QUEUE_LEN 10 /* Limit ring entries actually used. */ |
70 | #ifdef CONFIG_VIA_RHINE_NAPI | ||
71 | #define RX_RING_SIZE 64 | ||
72 | #else | ||
66 | #define RX_RING_SIZE 16 | 73 | #define RX_RING_SIZE 16 |
74 | #endif | ||
67 | 75 | ||
68 | 76 | ||
69 | /* Operational parameters that usually are not changed. */ | 77 | /* Operational parameters that usually are not changed. */ |
@@ -116,9 +124,11 @@ MODULE_LICENSE("GPL"); | |||
116 | module_param(max_interrupt_work, int, 0); | 124 | module_param(max_interrupt_work, int, 0); |
117 | module_param(debug, int, 0); | 125 | module_param(debug, int, 0); |
118 | module_param(rx_copybreak, int, 0); | 126 | module_param(rx_copybreak, int, 0); |
127 | module_param(avoid_D3, bool, 0); | ||
119 | MODULE_PARM_DESC(max_interrupt_work, "VIA Rhine maximum events handled per interrupt"); | 128 | MODULE_PARM_DESC(max_interrupt_work, "VIA Rhine maximum events handled per interrupt"); |
120 | MODULE_PARM_DESC(debug, "VIA Rhine debug level (0-7)"); | 129 | MODULE_PARM_DESC(debug, "VIA Rhine debug level (0-7)"); |
121 | MODULE_PARM_DESC(rx_copybreak, "VIA Rhine copy breakpoint for copy-only-tiny-frames"); | 130 | MODULE_PARM_DESC(rx_copybreak, "VIA Rhine copy breakpoint for copy-only-tiny-frames"); |
131 | MODULE_PARM_DESC(avoid_D3, "Avoid power state D3 (work-around for broken BIOSes)"); | ||
122 | 132 | ||
123 | /* | 133 | /* |
124 | Theory of Operation | 134 | Theory of Operation |
@@ -396,7 +406,7 @@ static void rhine_tx_timeout(struct net_device *dev); | |||
396 | static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev); | 406 | static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev); |
397 | static irqreturn_t rhine_interrupt(int irq, void *dev_instance, struct pt_regs *regs); | 407 | static irqreturn_t rhine_interrupt(int irq, void *dev_instance, struct pt_regs *regs); |
398 | static void rhine_tx(struct net_device *dev); | 408 | static void rhine_tx(struct net_device *dev); |
399 | static void rhine_rx(struct net_device *dev); | 409 | static int rhine_rx(struct net_device *dev, int limit); |
400 | static void rhine_error(struct net_device *dev, int intr_status); | 410 | static void rhine_error(struct net_device *dev, int intr_status); |
401 | static void rhine_set_rx_mode(struct net_device *dev); | 411 | static void rhine_set_rx_mode(struct net_device *dev); |
402 | static struct net_device_stats *rhine_get_stats(struct net_device *dev); | 412 | static struct net_device_stats *rhine_get_stats(struct net_device *dev); |
@@ -564,6 +574,32 @@ static void rhine_poll(struct net_device *dev) | |||
564 | } | 574 | } |
565 | #endif | 575 | #endif |
566 | 576 | ||
577 | #ifdef CONFIG_VIA_RHINE_NAPI | ||
578 | static int rhine_napipoll(struct net_device *dev, int *budget) | ||
579 | { | ||
580 | struct rhine_private *rp = netdev_priv(dev); | ||
581 | void __iomem *ioaddr = rp->base; | ||
582 | int done, limit = min(dev->quota, *budget); | ||
583 | |||
584 | done = rhine_rx(dev, limit); | ||
585 | *budget -= done; | ||
586 | dev->quota -= done; | ||
587 | |||
588 | if (done < limit) { | ||
589 | netif_rx_complete(dev); | ||
590 | |||
591 | iowrite16(IntrRxDone | IntrRxErr | IntrRxEmpty| IntrRxOverflow | | ||
592 | IntrRxDropped | IntrRxNoBuf | IntrTxAborted | | ||
593 | IntrTxDone | IntrTxError | IntrTxUnderrun | | ||
594 | IntrPCIErr | IntrStatsMax | IntrLinkChange, | ||
595 | ioaddr + IntrEnable); | ||
596 | return 0; | ||
597 | } | ||
598 | else | ||
599 | return 1; | ||
600 | } | ||
601 | #endif | ||
602 | |||
567 | static void rhine_hw_init(struct net_device *dev, long pioaddr) | 603 | static void rhine_hw_init(struct net_device *dev, long pioaddr) |
568 | { | 604 | { |
569 | struct rhine_private *rp = netdev_priv(dev); | 605 | struct rhine_private *rp = netdev_priv(dev); |
@@ -744,6 +780,10 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
744 | #ifdef CONFIG_NET_POLL_CONTROLLER | 780 | #ifdef CONFIG_NET_POLL_CONTROLLER |
745 | dev->poll_controller = rhine_poll; | 781 | dev->poll_controller = rhine_poll; |
746 | #endif | 782 | #endif |
783 | #ifdef CONFIG_VIA_RHINE_NAPI | ||
784 | dev->poll = rhine_napipoll; | ||
785 | dev->weight = 64; | ||
786 | #endif | ||
747 | if (rp->quirks & rqRhineI) | 787 | if (rp->quirks & rqRhineI) |
748 | dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM; | 788 | dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM; |
749 | 789 | ||
@@ -789,6 +829,9 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
789 | } | 829 | } |
790 | } | 830 | } |
791 | rp->mii_if.phy_id = phy_id; | 831 | rp->mii_if.phy_id = phy_id; |
832 | if (debug > 1 && avoid_D3) | ||
833 | printk(KERN_INFO "%s: No D3 power state at shutdown.\n", | ||
834 | dev->name); | ||
792 | 835 | ||
793 | return 0; | 836 | return 0; |
794 | 837 | ||
@@ -1014,6 +1057,8 @@ static void init_registers(struct net_device *dev) | |||
1014 | 1057 | ||
1015 | rhine_set_rx_mode(dev); | 1058 | rhine_set_rx_mode(dev); |
1016 | 1059 | ||
1060 | netif_poll_enable(dev); | ||
1061 | |||
1017 | /* Enable interrupts by setting the interrupt mask. */ | 1062 | /* Enable interrupts by setting the interrupt mask. */ |
1018 | iowrite16(IntrRxDone | IntrRxErr | IntrRxEmpty| IntrRxOverflow | | 1063 | iowrite16(IntrRxDone | IntrRxErr | IntrRxEmpty| IntrRxOverflow | |
1019 | IntrRxDropped | IntrRxNoBuf | IntrTxAborted | | 1064 | IntrRxDropped | IntrRxNoBuf | IntrTxAborted | |
@@ -1268,8 +1313,18 @@ static irqreturn_t rhine_interrupt(int irq, void *dev_instance, struct pt_regs * | |||
1268 | dev->name, intr_status); | 1313 | dev->name, intr_status); |
1269 | 1314 | ||
1270 | if (intr_status & (IntrRxDone | IntrRxErr | IntrRxDropped | | 1315 | if (intr_status & (IntrRxDone | IntrRxErr | IntrRxDropped | |
1271 | IntrRxWakeUp | IntrRxEmpty | IntrRxNoBuf)) | 1316 | IntrRxWakeUp | IntrRxEmpty | IntrRxNoBuf)) { |
1272 | rhine_rx(dev); | 1317 | #ifdef CONFIG_VIA_RHINE_NAPI |
1318 | iowrite16(IntrTxAborted | | ||
1319 | IntrTxDone | IntrTxError | IntrTxUnderrun | | ||
1320 | IntrPCIErr | IntrStatsMax | IntrLinkChange, | ||
1321 | ioaddr + IntrEnable); | ||
1322 | |||
1323 | netif_rx_schedule(dev); | ||
1324 | #else | ||
1325 | rhine_rx(dev, RX_RING_SIZE); | ||
1326 | #endif | ||
1327 | } | ||
1273 | 1328 | ||
1274 | if (intr_status & (IntrTxErrSummary | IntrTxDone)) { | 1329 | if (intr_status & (IntrTxErrSummary | IntrTxDone)) { |
1275 | if (intr_status & IntrTxErrSummary) { | 1330 | if (intr_status & IntrTxErrSummary) { |
@@ -1367,13 +1422,12 @@ static void rhine_tx(struct net_device *dev) | |||
1367 | spin_unlock(&rp->lock); | 1422 | spin_unlock(&rp->lock); |
1368 | } | 1423 | } |
1369 | 1424 | ||
1370 | /* This routine is logically part of the interrupt handler, but isolated | 1425 | /* Process up to limit frames from receive ring */ |
1371 | for clarity and better register allocation. */ | 1426 | static int rhine_rx(struct net_device *dev, int limit) |
1372 | static void rhine_rx(struct net_device *dev) | ||
1373 | { | 1427 | { |
1374 | struct rhine_private *rp = netdev_priv(dev); | 1428 | struct rhine_private *rp = netdev_priv(dev); |
1429 | int count; | ||
1375 | int entry = rp->cur_rx % RX_RING_SIZE; | 1430 | int entry = rp->cur_rx % RX_RING_SIZE; |
1376 | int boguscnt = rp->dirty_rx + RX_RING_SIZE - rp->cur_rx; | ||
1377 | 1431 | ||
1378 | if (debug > 4) { | 1432 | if (debug > 4) { |
1379 | printk(KERN_DEBUG "%s: rhine_rx(), entry %d status %8.8x.\n", | 1433 | printk(KERN_DEBUG "%s: rhine_rx(), entry %d status %8.8x.\n", |
@@ -1382,16 +1436,18 @@ static void rhine_rx(struct net_device *dev) | |||
1382 | } | 1436 | } |
1383 | 1437 | ||
1384 | /* If EOP is set on the next entry, it's a new packet. Send it up. */ | 1438 | /* If EOP is set on the next entry, it's a new packet. Send it up. */ |
1385 | while (!(rp->rx_head_desc->rx_status & cpu_to_le32(DescOwn))) { | 1439 | for (count = 0; count < limit; ++count) { |
1386 | struct rx_desc *desc = rp->rx_head_desc; | 1440 | struct rx_desc *desc = rp->rx_head_desc; |
1387 | u32 desc_status = le32_to_cpu(desc->rx_status); | 1441 | u32 desc_status = le32_to_cpu(desc->rx_status); |
1388 | int data_size = desc_status >> 16; | 1442 | int data_size = desc_status >> 16; |
1389 | 1443 | ||
1444 | if (desc_status & DescOwn) | ||
1445 | break; | ||
1446 | |||
1390 | if (debug > 4) | 1447 | if (debug > 4) |
1391 | printk(KERN_DEBUG "rhine_rx() status is %8.8x.\n", | 1448 | printk(KERN_DEBUG "rhine_rx() status is %8.8x.\n", |
1392 | desc_status); | 1449 | desc_status); |
1393 | if (--boguscnt < 0) | 1450 | |
1394 | break; | ||
1395 | if ((desc_status & (RxWholePkt | RxErr)) != RxWholePkt) { | 1451 | if ((desc_status & (RxWholePkt | RxErr)) != RxWholePkt) { |
1396 | if ((desc_status & RxWholePkt) != RxWholePkt) { | 1452 | if ((desc_status & RxWholePkt) != RxWholePkt) { |
1397 | printk(KERN_WARNING "%s: Oversized Ethernet " | 1453 | printk(KERN_WARNING "%s: Oversized Ethernet " |
@@ -1460,7 +1516,11 @@ static void rhine_rx(struct net_device *dev) | |||
1460 | PCI_DMA_FROMDEVICE); | 1516 | PCI_DMA_FROMDEVICE); |
1461 | } | 1517 | } |
1462 | skb->protocol = eth_type_trans(skb, dev); | 1518 | skb->protocol = eth_type_trans(skb, dev); |
1519 | #ifdef CONFIG_VIA_RHINE_NAPI | ||
1520 | netif_receive_skb(skb); | ||
1521 | #else | ||
1463 | netif_rx(skb); | 1522 | netif_rx(skb); |
1523 | #endif | ||
1464 | dev->last_rx = jiffies; | 1524 | dev->last_rx = jiffies; |
1465 | rp->stats.rx_bytes += pkt_len; | 1525 | rp->stats.rx_bytes += pkt_len; |
1466 | rp->stats.rx_packets++; | 1526 | rp->stats.rx_packets++; |
@@ -1487,6 +1547,8 @@ static void rhine_rx(struct net_device *dev) | |||
1487 | } | 1547 | } |
1488 | rp->rx_ring[entry].rx_status = cpu_to_le32(DescOwn); | 1548 | rp->rx_ring[entry].rx_status = cpu_to_le32(DescOwn); |
1489 | } | 1549 | } |
1550 | |||
1551 | return count; | ||
1490 | } | 1552 | } |
1491 | 1553 | ||
1492 | /* | 1554 | /* |
@@ -1776,6 +1838,7 @@ static int rhine_close(struct net_device *dev) | |||
1776 | spin_lock_irq(&rp->lock); | 1838 | spin_lock_irq(&rp->lock); |
1777 | 1839 | ||
1778 | netif_stop_queue(dev); | 1840 | netif_stop_queue(dev); |
1841 | netif_poll_disable(dev); | ||
1779 | 1842 | ||
1780 | if (debug > 1) | 1843 | if (debug > 1) |
1781 | printk(KERN_DEBUG "%s: Shutting down ethercard, " | 1844 | printk(KERN_DEBUG "%s: Shutting down ethercard, " |
@@ -1857,7 +1920,8 @@ static void rhine_shutdown (struct pci_dev *pdev) | |||
1857 | } | 1920 | } |
1858 | 1921 | ||
1859 | /* Hit power state D3 (sleep) */ | 1922 | /* Hit power state D3 (sleep) */ |
1860 | iowrite8(ioread8(ioaddr + StickyHW) | 0x03, ioaddr + StickyHW); | 1923 | if (!avoid_D3) |
1924 | iowrite8(ioread8(ioaddr + StickyHW) | 0x03, ioaddr + StickyHW); | ||
1861 | 1925 | ||
1862 | /* TODO: Check use of pci_enable_wake() */ | 1926 | /* TODO: Check use of pci_enable_wake() */ |
1863 | 1927 | ||
@@ -1941,7 +2005,7 @@ static int __init rhine_init(void) | |||
1941 | #ifdef MODULE | 2005 | #ifdef MODULE |
1942 | printk(version); | 2006 | printk(version); |
1943 | #endif | 2007 | #endif |
1944 | return pci_module_init(&rhine_driver); | 2008 | return pci_register_driver(&rhine_driver); |
1945 | } | 2009 | } |
1946 | 2010 | ||
1947 | 2011 | ||
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index aa9cd92f46b2..e266db1518e7 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -2250,7 +2250,7 @@ static int __init velocity_init_module(void) | |||
2250 | int ret; | 2250 | int ret; |
2251 | 2251 | ||
2252 | velocity_register_notifier(); | 2252 | velocity_register_notifier(); |
2253 | ret = pci_module_init(&velocity_driver); | 2253 | ret = pci_register_driver(&velocity_driver); |
2254 | if (ret < 0) | 2254 | if (ret < 0) |
2255 | velocity_unregister_notifier(); | 2255 | velocity_unregister_notifier(); |
2256 | return ret; | 2256 | return ret; |
diff --git a/drivers/net/via-velocity.h b/drivers/net/via-velocity.h index 496c3d597444..4665ef2c63df 100644 --- a/drivers/net/via-velocity.h +++ b/drivers/net/via-velocity.h | |||
@@ -262,25 +262,6 @@ struct velocity_rd_info { | |||
262 | dma_addr_t skb_dma; | 262 | dma_addr_t skb_dma; |
263 | }; | 263 | }; |
264 | 264 | ||
265 | /** | ||
266 | * alloc_rd_info - allocate an rd info block | ||
267 | * | ||
268 | * Alocate and initialize a receive info structure used for keeping | ||
269 | * track of kernel side information related to each receive | ||
270 | * descriptor we are using | ||
271 | */ | ||
272 | |||
273 | static inline struct velocity_rd_info *alloc_rd_info(void) | ||
274 | { | ||
275 | struct velocity_rd_info *ptr; | ||
276 | if ((ptr = kmalloc(sizeof(struct velocity_rd_info), GFP_ATOMIC)) == NULL) | ||
277 | return NULL; | ||
278 | else { | ||
279 | memset(ptr, 0, sizeof(struct velocity_rd_info)); | ||
280 | return ptr; | ||
281 | } | ||
282 | } | ||
283 | |||
284 | /* | 265 | /* |
285 | * Used to track transmit side buffers. | 266 | * Used to track transmit side buffers. |
286 | */ | 267 | */ |
diff --git a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c index 435e91ec4620..6b63b350cd52 100644 --- a/drivers/net/wan/c101.c +++ b/drivers/net/wan/c101.c | |||
@@ -118,7 +118,7 @@ static inline void openwin(card_t *card, u8 page) | |||
118 | 118 | ||
119 | static inline void set_carrier(port_t *port) | 119 | static inline void set_carrier(port_t *port) |
120 | { | 120 | { |
121 | if (!sca_in(MSCI1_OFFSET + ST3, port) & ST3_DCD) | 121 | if (!(sca_in(MSCI1_OFFSET + ST3, port) & ST3_DCD)) |
122 | netif_carrier_on(port_to_dev(port)); | 122 | netif_carrier_on(port_to_dev(port)); |
123 | else | 123 | else |
124 | netif_carrier_off(port_to_dev(port)); | 124 | netif_carrier_off(port_to_dev(port)); |
@@ -127,10 +127,10 @@ static inline void set_carrier(port_t *port) | |||
127 | 127 | ||
128 | static void sca_msci_intr(port_t *port) | 128 | static void sca_msci_intr(port_t *port) |
129 | { | 129 | { |
130 | u8 stat = sca_in(MSCI1_OFFSET + ST1, port); /* read MSCI ST1 status */ | 130 | u8 stat = sca_in(MSCI0_OFFSET + ST1, port); /* read MSCI ST1 status */ |
131 | 131 | ||
132 | /* Reset MSCI TX underrun status bit */ | 132 | /* Reset MSCI TX underrun and CDCD (ignored) status bit */ |
133 | sca_out(stat & ST1_UDRN, MSCI0_OFFSET + ST1, port); | 133 | sca_out(stat & (ST1_UDRN | ST1_CDCD), MSCI0_OFFSET + ST1, port); |
134 | 134 | ||
135 | if (stat & ST1_UDRN) { | 135 | if (stat & ST1_UDRN) { |
136 | struct net_device_stats *stats = hdlc_stats(port_to_dev(port)); | 136 | struct net_device_stats *stats = hdlc_stats(port_to_dev(port)); |
@@ -138,6 +138,7 @@ static void sca_msci_intr(port_t *port) | |||
138 | stats->tx_fifo_errors++; | 138 | stats->tx_fifo_errors++; |
139 | } | 139 | } |
140 | 140 | ||
141 | stat = sca_in(MSCI1_OFFSET + ST1, port); /* read MSCI1 ST1 status */ | ||
141 | /* Reset MSCI CDCD status bit - uses ch#2 DCD input */ | 142 | /* Reset MSCI CDCD status bit - uses ch#2 DCD input */ |
142 | sca_out(stat & ST1_CDCD, MSCI1_OFFSET + ST1, port); | 143 | sca_out(stat & ST1_CDCD, MSCI1_OFFSET + ST1, port); |
143 | 144 | ||
diff --git a/drivers/net/wan/cycx_main.c b/drivers/net/wan/cycx_main.c index 430b1f630fb4..a5e7ce1bd16a 100644 --- a/drivers/net/wan/cycx_main.c +++ b/drivers/net/wan/cycx_main.c | |||
@@ -40,7 +40,6 @@ | |||
40 | * 1998/08/08 acme Initial version. | 40 | * 1998/08/08 acme Initial version. |
41 | */ | 41 | */ |
42 | 42 | ||
43 | #include <linux/config.h> /* OS configuration options */ | ||
44 | #include <linux/stddef.h> /* offsetof(), etc. */ | 43 | #include <linux/stddef.h> /* offsetof(), etc. */ |
45 | #include <linux/errno.h> /* return codes */ | 44 | #include <linux/errno.h> /* return codes */ |
46 | #include <linux/string.h> /* inline memset(), etc. */ | 45 | #include <linux/string.h> /* inline memset(), etc. */ |
diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c index 6e1ec5bf22fc..736987559432 100644 --- a/drivers/net/wan/dlci.c +++ b/drivers/net/wan/dlci.c | |||
@@ -28,7 +28,6 @@ | |||
28 | * 2 of the License, or (at your option) any later version. | 28 | * 2 of the License, or (at your option) any later version. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <linux/config.h> /* for CONFIG_DLCI_COUNT */ | ||
32 | #include <linux/module.h> | 31 | #include <linux/module.h> |
33 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
34 | #include <linux/types.h> | 33 | #include <linux/types.h> |
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c index 684af4316ffd..af4d4155905b 100644 --- a/drivers/net/wan/dscc4.c +++ b/drivers/net/wan/dscc4.c | |||
@@ -2062,7 +2062,7 @@ static struct pci_driver dscc4_driver = { | |||
2062 | 2062 | ||
2063 | static int __init dscc4_init_module(void) | 2063 | static int __init dscc4_init_module(void) |
2064 | { | 2064 | { |
2065 | return pci_module_init(&dscc4_driver); | 2065 | return pci_register_driver(&dscc4_driver); |
2066 | } | 2066 | } |
2067 | 2067 | ||
2068 | static void __exit dscc4_cleanup_module(void) | 2068 | static void __exit dscc4_cleanup_module(void) |
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index 3705db04a343..564351aafa41 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
@@ -2697,7 +2697,7 @@ fst_init(void) | |||
2697 | for (i = 0; i < FST_MAX_CARDS; i++) | 2697 | for (i = 0; i < FST_MAX_CARDS; i++) |
2698 | fst_card_array[i] = NULL; | 2698 | fst_card_array[i] = NULL; |
2699 | spin_lock_init(&fst_work_q_lock); | 2699 | spin_lock_init(&fst_work_q_lock); |
2700 | return pci_module_init(&fst_driver); | 2700 | return pci_register_driver(&fst_driver); |
2701 | } | 2701 | } |
2702 | 2702 | ||
2703 | static void __exit | 2703 | static void __exit |
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c index 39f44241a728..7b5d81deb028 100644 --- a/drivers/net/wan/lmc/lmc_main.c +++ b/drivers/net/wan/lmc/lmc_main.c | |||
@@ -1790,7 +1790,7 @@ static struct pci_driver lmc_driver = { | |||
1790 | 1790 | ||
1791 | static int __init init_lmc(void) | 1791 | static int __init init_lmc(void) |
1792 | { | 1792 | { |
1793 | return pci_module_init(&lmc_driver); | 1793 | return pci_register_driver(&lmc_driver); |
1794 | } | 1794 | } |
1795 | 1795 | ||
1796 | static void __exit exit_lmc(void) | 1796 | static void __exit exit_lmc(void) |
diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c index 567effff4a3e..56e69403d178 100644 --- a/drivers/net/wan/pc300_drv.c +++ b/drivers/net/wan/pc300_drv.c | |||
@@ -3677,7 +3677,7 @@ static struct pci_driver cpc_driver = { | |||
3677 | 3677 | ||
3678 | static int __init cpc_init(void) | 3678 | static int __init cpc_init(void) |
3679 | { | 3679 | { |
3680 | return pci_module_init(&cpc_driver); | 3680 | return pci_register_driver(&cpc_driver); |
3681 | } | 3681 | } |
3682 | 3682 | ||
3683 | static void __exit cpc_cleanup_module(void) | 3683 | static void __exit cpc_cleanup_module(void) |
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c index 4df61fa3214b..a6b9c33b68e4 100644 --- a/drivers/net/wan/pci200syn.c +++ b/drivers/net/wan/pci200syn.c | |||
@@ -476,7 +476,7 @@ static int __init pci200_init_module(void) | |||
476 | printk(KERN_ERR "pci200syn: Invalid PCI clock frequency\n"); | 476 | printk(KERN_ERR "pci200syn: Invalid PCI clock frequency\n"); |
477 | return -EINVAL; | 477 | return -EINVAL; |
478 | } | 478 | } |
479 | return pci_module_init(&pci200_pci_driver); | 479 | return pci_register_driver(&pci200_pci_driver); |
480 | } | 480 | } |
481 | 481 | ||
482 | 482 | ||
diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c index 7628c2d81f45..0ba018f8382b 100644 --- a/drivers/net/wan/sdla.c +++ b/drivers/net/wan/sdla.c | |||
@@ -32,7 +32,6 @@ | |||
32 | * 2 of the License, or (at your option) any later version. | 32 | * 2 of the License, or (at your option) any later version. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include <linux/config.h> /* for CONFIG_DLCI_MAX */ | ||
36 | #include <linux/module.h> | 35 | #include <linux/module.h> |
37 | #include <linux/kernel.h> | 36 | #include <linux/kernel.h> |
38 | #include <linux/types.h> | 37 | #include <linux/types.h> |
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c index b2031dfc4bb1..ec68f7dfd93f 100644 --- a/drivers/net/wan/wanxl.c +++ b/drivers/net/wan/wanxl.c | |||
@@ -837,7 +837,7 @@ static int __init wanxl_init_module(void) | |||
837 | #ifdef MODULE | 837 | #ifdef MODULE |
838 | printk(KERN_INFO "%s\n", version); | 838 | printk(KERN_INFO "%s\n", version); |
839 | #endif | 839 | #endif |
840 | return pci_module_init(&wanxl_pci_driver); | 840 | return pci_register_driver(&wanxl_pci_driver); |
841 | } | 841 | } |
842 | 842 | ||
843 | static void __exit wanxl_cleanup_module(void) | 843 | static void __exit wanxl_cleanup_module(void) |
diff --git a/drivers/net/wd.c b/drivers/net/wd.c index 7caa8dc88a58..b1ba1872f315 100644 --- a/drivers/net/wd.c +++ b/drivers/net/wd.c | |||
@@ -500,8 +500,8 @@ MODULE_LICENSE("GPL"); | |||
500 | 500 | ||
501 | /* This is set up so that only a single autoprobe takes place per call. | 501 | /* This is set up so that only a single autoprobe takes place per call. |
502 | ISA device autoprobes on a running machine are not recommended. */ | 502 | ISA device autoprobes on a running machine are not recommended. */ |
503 | int | 503 | |
504 | init_module(void) | 504 | int __init init_module(void) |
505 | { | 505 | { |
506 | struct net_device *dev; | 506 | struct net_device *dev; |
507 | int this_dev, found = 0; | 507 | int this_dev, found = 0; |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index a4dd13942714..16befbcea58c 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -3950,13 +3950,11 @@ static u16 issuecommand(struct airo_info *ai, Cmd *pCmd, Resp *pRsp) { | |||
3950 | pRsp->rsp0 = IN4500(ai, RESP0); | 3950 | pRsp->rsp0 = IN4500(ai, RESP0); |
3951 | pRsp->rsp1 = IN4500(ai, RESP1); | 3951 | pRsp->rsp1 = IN4500(ai, RESP1); |
3952 | pRsp->rsp2 = IN4500(ai, RESP2); | 3952 | pRsp->rsp2 = IN4500(ai, RESP2); |
3953 | if ((pRsp->status & 0xff00)!=0 && pCmd->cmd != CMD_SOFTRESET) { | 3953 | if ((pRsp->status & 0xff00)!=0 && pCmd->cmd != CMD_SOFTRESET) |
3954 | airo_print_err(ai->dev->name, "cmd= %x\n", pCmd->cmd); | 3954 | airo_print_err(ai->dev->name, |
3955 | airo_print_err(ai->dev->name, "status= %x\n", pRsp->status); | 3955 | "cmd:%x status:%x rsp0:%x rsp1:%x rsp2:%x", |
3956 | airo_print_err(ai->dev->name, "Rsp0= %x\n", pRsp->rsp0); | 3956 | pCmd->cmd, pRsp->status, pRsp->rsp0, pRsp->rsp1, |
3957 | airo_print_err(ai->dev->name, "Rsp1= %x\n", pRsp->rsp1); | 3957 | pRsp->rsp2); |
3958 | airo_print_err(ai->dev->name, "Rsp2= %x\n", pRsp->rsp2); | ||
3959 | } | ||
3960 | 3958 | ||
3961 | // clear stuck command busy if necessary | 3959 | // clear stuck command busy if necessary |
3962 | if (IN4500(ai, COMMAND) & COMMAND_BUSY) { | 3960 | if (IN4500(ai, COMMAND) & COMMAND_BUSY) { |
diff --git a/drivers/net/wireless/atmel_pci.c b/drivers/net/wireless/atmel_pci.c index d425c3cefded..3bfa791c323d 100644 --- a/drivers/net/wireless/atmel_pci.c +++ b/drivers/net/wireless/atmel_pci.c | |||
@@ -76,7 +76,7 @@ static void __devexit atmel_pci_remove(struct pci_dev *pdev) | |||
76 | 76 | ||
77 | static int __init atmel_init_module(void) | 77 | static int __init atmel_init_module(void) |
78 | { | 78 | { |
79 | return pci_module_init(&atmel_driver); | 79 | return pci_register_driver(&atmel_driver); |
80 | } | 80 | } |
81 | 81 | ||
82 | static void __exit atmel_cleanup_module(void) | 82 | static void __exit atmel_cleanup_module(void) |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx.h b/drivers/net/wireless/bcm43xx/bcm43xx.h index 17a56828e232..c6ee1e974c84 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx.h +++ b/drivers/net/wireless/bcm43xx/bcm43xx.h | |||
@@ -504,6 +504,12 @@ struct bcm43xx_phyinfo { | |||
504 | * This lock is only used by bcm43xx_phy_{un}lock() | 504 | * This lock is only used by bcm43xx_phy_{un}lock() |
505 | */ | 505 | */ |
506 | spinlock_t lock; | 506 | spinlock_t lock; |
507 | |||
508 | /* Firmware. */ | ||
509 | const struct firmware *ucode; | ||
510 | const struct firmware *pcm; | ||
511 | const struct firmware *initvals0; | ||
512 | const struct firmware *initvals1; | ||
507 | }; | 513 | }; |
508 | 514 | ||
509 | 515 | ||
@@ -593,12 +599,14 @@ struct bcm43xx_coreinfo { | |||
593 | u8 available:1, | 599 | u8 available:1, |
594 | enabled:1, | 600 | enabled:1, |
595 | initialized:1; | 601 | initialized:1; |
596 | /** core_id ID number */ | ||
597 | u16 id; | ||
598 | /** core_rev revision number */ | 602 | /** core_rev revision number */ |
599 | u8 rev; | 603 | u8 rev; |
600 | /** Index number for _switch_core() */ | 604 | /** Index number for _switch_core() */ |
601 | u8 index; | 605 | u8 index; |
606 | /** core_id ID number */ | ||
607 | u16 id; | ||
608 | /** Core-specific data. */ | ||
609 | void *priv; | ||
602 | }; | 610 | }; |
603 | 611 | ||
604 | /* Additional information for each 80211 core. */ | 612 | /* Additional information for each 80211 core. */ |
@@ -647,7 +655,23 @@ enum { | |||
647 | BCM43xx_STAT_RESTARTING, /* controller_restart() called. */ | 655 | BCM43xx_STAT_RESTARTING, /* controller_restart() called. */ |
648 | }; | 656 | }; |
649 | #define bcm43xx_status(bcm) atomic_read(&(bcm)->init_status) | 657 | #define bcm43xx_status(bcm) atomic_read(&(bcm)->init_status) |
650 | #define bcm43xx_set_status(bcm, stat) atomic_set(&(bcm)->init_status, (stat)) | 658 | #define bcm43xx_set_status(bcm, stat) do { \ |
659 | atomic_set(&(bcm)->init_status, (stat)); \ | ||
660 | smp_wmb(); \ | ||
661 | } while (0) | ||
662 | |||
663 | /* *** THEORY OF LOCKING *** | ||
664 | * | ||
665 | * We have two different locks in the bcm43xx driver. | ||
666 | * => bcm->mutex: General sleeping mutex. Protects struct bcm43xx_private | ||
667 | * and the device registers. This mutex does _not_ protect | ||
668 | * against concurrency from the IRQ handler. | ||
669 | * => bcm->irq_lock: IRQ spinlock. Protects against IRQ handler concurrency. | ||
670 | * | ||
671 | * Please note that, if you only take the irq_lock, you are not protected | ||
672 | * against concurrency from the periodic work handlers. | ||
673 | * Most times you want to take _both_ locks. | ||
674 | */ | ||
651 | 675 | ||
652 | struct bcm43xx_private { | 676 | struct bcm43xx_private { |
653 | struct ieee80211_device *ieee; | 677 | struct ieee80211_device *ieee; |
@@ -659,7 +683,6 @@ struct bcm43xx_private { | |||
659 | 683 | ||
660 | void __iomem *mmio_addr; | 684 | void __iomem *mmio_addr; |
661 | 685 | ||
662 | /* Locking, see "theory of locking" text below. */ | ||
663 | spinlock_t irq_lock; | 686 | spinlock_t irq_lock; |
664 | struct mutex mutex; | 687 | struct mutex mutex; |
665 | 688 | ||
@@ -691,6 +714,7 @@ struct bcm43xx_private { | |||
691 | struct bcm43xx_sprominfo sprom; | 714 | struct bcm43xx_sprominfo sprom; |
692 | #define BCM43xx_NR_LEDS 4 | 715 | #define BCM43xx_NR_LEDS 4 |
693 | struct bcm43xx_led leds[BCM43xx_NR_LEDS]; | 716 | struct bcm43xx_led leds[BCM43xx_NR_LEDS]; |
717 | spinlock_t leds_lock; | ||
694 | 718 | ||
695 | /* The currently active core. */ | 719 | /* The currently active core. */ |
696 | struct bcm43xx_coreinfo *current_core; | 720 | struct bcm43xx_coreinfo *current_core; |
@@ -708,10 +732,6 @@ struct bcm43xx_private { | |||
708 | struct bcm43xx_coreinfo core_80211[ BCM43xx_MAX_80211_CORES ]; | 732 | struct bcm43xx_coreinfo core_80211[ BCM43xx_MAX_80211_CORES ]; |
709 | /* Additional information, specific to the 80211 cores. */ | 733 | /* Additional information, specific to the 80211 cores. */ |
710 | struct bcm43xx_coreinfo_80211 core_80211_ext[ BCM43xx_MAX_80211_CORES ]; | 734 | struct bcm43xx_coreinfo_80211 core_80211_ext[ BCM43xx_MAX_80211_CORES ]; |
711 | /* Index of the current 80211 core. If current_core is not | ||
712 | * an 80211 core, this is -1. | ||
713 | */ | ||
714 | int current_80211_core_idx; | ||
715 | /* Number of available 80211 cores. */ | 735 | /* Number of available 80211 cores. */ |
716 | int nr_80211_available; | 736 | int nr_80211_available; |
717 | 737 | ||
@@ -724,6 +744,8 @@ struct bcm43xx_private { | |||
724 | u32 irq_savedstate; | 744 | u32 irq_savedstate; |
725 | /* Link Quality calculation context. */ | 745 | /* Link Quality calculation context. */ |
726 | struct bcm43xx_noise_calculation noisecalc; | 746 | struct bcm43xx_noise_calculation noisecalc; |
747 | /* if > 0 MAC is suspended. if == 0 MAC is enabled. */ | ||
748 | int mac_suspended; | ||
727 | 749 | ||
728 | /* Threshold values. */ | 750 | /* Threshold values. */ |
729 | //TODO: The RTS thr has to be _used_. Currently, it is only set via WX. | 751 | //TODO: The RTS thr has to be _used_. Currently, it is only set via WX. |
@@ -746,12 +768,6 @@ struct bcm43xx_private { | |||
746 | struct bcm43xx_key key[54]; | 768 | struct bcm43xx_key key[54]; |
747 | u8 default_key_idx; | 769 | u8 default_key_idx; |
748 | 770 | ||
749 | /* Firmware. */ | ||
750 | const struct firmware *ucode; | ||
751 | const struct firmware *pcm; | ||
752 | const struct firmware *initvals0; | ||
753 | const struct firmware *initvals1; | ||
754 | |||
755 | /* Random Number Generator. */ | 771 | /* Random Number Generator. */ |
756 | struct hwrng rng; | 772 | struct hwrng rng; |
757 | char rng_name[20 + 1]; | 773 | char rng_name[20 + 1]; |
@@ -763,55 +779,6 @@ struct bcm43xx_private { | |||
763 | }; | 779 | }; |
764 | 780 | ||
765 | 781 | ||
766 | /* *** THEORY OF LOCKING *** | ||
767 | * | ||
768 | * We have two different locks in the bcm43xx driver. | ||
769 | * => bcm->mutex: General sleeping mutex. Protects struct bcm43xx_private | ||
770 | * and the device registers. | ||
771 | * => bcm->irq_lock: IRQ spinlock. Protects against IRQ handler concurrency. | ||
772 | * | ||
773 | * We have three types of helper function pairs to utilize these locks. | ||
774 | * (Always use the helper functions.) | ||
775 | * 1) bcm43xx_{un}lock_noirq(): | ||
776 | * Takes bcm->mutex. Does _not_ protect against IRQ concurrency, | ||
777 | * so it is almost always unsafe, if device IRQs are enabled. | ||
778 | * So only use this, if device IRQs are masked. | ||
779 | * Locking may sleep. | ||
780 | * You can sleep within the critical section. | ||
781 | * 2) bcm43xx_{un}lock_irqonly(): | ||
782 | * Takes bcm->irq_lock. Does _not_ protect against | ||
783 | * bcm43xx_lock_noirq() critical sections. | ||
784 | * Does only protect against the IRQ handler path and other | ||
785 | * irqonly() critical sections. | ||
786 | * Locking does not sleep. | ||
787 | * You must not sleep within the critical section. | ||
788 | * 3) bcm43xx_{un}lock_irqsafe(): | ||
789 | * This is the cummulative lock and takes both, mutex and irq_lock. | ||
790 | * Protects against noirq() and irqonly() critical sections (and | ||
791 | * the IRQ handler path). | ||
792 | * Locking may sleep. | ||
793 | * You must not sleep within the critical section. | ||
794 | */ | ||
795 | |||
796 | /* Lock type 1 */ | ||
797 | #define bcm43xx_lock_noirq(bcm) mutex_lock(&(bcm)->mutex) | ||
798 | #define bcm43xx_unlock_noirq(bcm) mutex_unlock(&(bcm)->mutex) | ||
799 | /* Lock type 2 */ | ||
800 | #define bcm43xx_lock_irqonly(bcm, flags) \ | ||
801 | spin_lock_irqsave(&(bcm)->irq_lock, flags) | ||
802 | #define bcm43xx_unlock_irqonly(bcm, flags) \ | ||
803 | spin_unlock_irqrestore(&(bcm)->irq_lock, flags) | ||
804 | /* Lock type 3 */ | ||
805 | #define bcm43xx_lock_irqsafe(bcm, flags) do { \ | ||
806 | bcm43xx_lock_noirq(bcm); \ | ||
807 | bcm43xx_lock_irqonly(bcm, flags); \ | ||
808 | } while (0) | ||
809 | #define bcm43xx_unlock_irqsafe(bcm, flags) do { \ | ||
810 | bcm43xx_unlock_irqonly(bcm, flags); \ | ||
811 | bcm43xx_unlock_noirq(bcm); \ | ||
812 | } while (0) | ||
813 | |||
814 | |||
815 | static inline | 782 | static inline |
816 | struct bcm43xx_private * bcm43xx_priv(struct net_device *dev) | 783 | struct bcm43xx_private * bcm43xx_priv(struct net_device *dev) |
817 | { | 784 | { |
@@ -863,34 +830,33 @@ int bcm43xx_using_pio(struct bcm43xx_private *bcm) | |||
863 | * any of these functions. | 830 | * any of these functions. |
864 | */ | 831 | */ |
865 | static inline | 832 | static inline |
833 | struct bcm43xx_coreinfo_80211 * | ||
834 | bcm43xx_current_80211_priv(struct bcm43xx_private *bcm) | ||
835 | { | ||
836 | assert(bcm->current_core->id == BCM43xx_COREID_80211); | ||
837 | return bcm->current_core->priv; | ||
838 | } | ||
839 | static inline | ||
866 | struct bcm43xx_pio * bcm43xx_current_pio(struct bcm43xx_private *bcm) | 840 | struct bcm43xx_pio * bcm43xx_current_pio(struct bcm43xx_private *bcm) |
867 | { | 841 | { |
868 | assert(bcm43xx_using_pio(bcm)); | 842 | assert(bcm43xx_using_pio(bcm)); |
869 | assert(bcm->current_80211_core_idx >= 0); | 843 | return &(bcm43xx_current_80211_priv(bcm)->pio); |
870 | assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES); | ||
871 | return &(bcm->core_80211_ext[bcm->current_80211_core_idx].pio); | ||
872 | } | 844 | } |
873 | static inline | 845 | static inline |
874 | struct bcm43xx_dma * bcm43xx_current_dma(struct bcm43xx_private *bcm) | 846 | struct bcm43xx_dma * bcm43xx_current_dma(struct bcm43xx_private *bcm) |
875 | { | 847 | { |
876 | assert(!bcm43xx_using_pio(bcm)); | 848 | assert(!bcm43xx_using_pio(bcm)); |
877 | assert(bcm->current_80211_core_idx >= 0); | 849 | return &(bcm43xx_current_80211_priv(bcm)->dma); |
878 | assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES); | ||
879 | return &(bcm->core_80211_ext[bcm->current_80211_core_idx].dma); | ||
880 | } | 850 | } |
881 | static inline | 851 | static inline |
882 | struct bcm43xx_phyinfo * bcm43xx_current_phy(struct bcm43xx_private *bcm) | 852 | struct bcm43xx_phyinfo * bcm43xx_current_phy(struct bcm43xx_private *bcm) |
883 | { | 853 | { |
884 | assert(bcm->current_80211_core_idx >= 0); | 854 | return &(bcm43xx_current_80211_priv(bcm)->phy); |
885 | assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES); | ||
886 | return &(bcm->core_80211_ext[bcm->current_80211_core_idx].phy); | ||
887 | } | 855 | } |
888 | static inline | 856 | static inline |
889 | struct bcm43xx_radioinfo * bcm43xx_current_radio(struct bcm43xx_private *bcm) | 857 | struct bcm43xx_radioinfo * bcm43xx_current_radio(struct bcm43xx_private *bcm) |
890 | { | 858 | { |
891 | assert(bcm->current_80211_core_idx >= 0); | 859 | return &(bcm43xx_current_80211_priv(bcm)->radio); |
892 | assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES); | ||
893 | return &(bcm->core_80211_ext[bcm->current_80211_core_idx].radio); | ||
894 | } | 860 | } |
895 | 861 | ||
896 | 862 | ||
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c index ce2e40b29b4f..923275ea0789 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c | |||
@@ -77,7 +77,8 @@ static ssize_t devinfo_read_file(struct file *file, char __user *userbuf, | |||
77 | 77 | ||
78 | down(&big_buffer_sem); | 78 | down(&big_buffer_sem); |
79 | 79 | ||
80 | bcm43xx_lock_irqsafe(bcm, flags); | 80 | mutex_lock(&bcm->mutex); |
81 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
81 | if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) { | 82 | if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) { |
82 | fappend("Board not initialized.\n"); | 83 | fappend("Board not initialized.\n"); |
83 | goto out; | 84 | goto out; |
@@ -121,7 +122,8 @@ static ssize_t devinfo_read_file(struct file *file, char __user *userbuf, | |||
121 | fappend("\n"); | 122 | fappend("\n"); |
122 | 123 | ||
123 | out: | 124 | out: |
124 | bcm43xx_unlock_irqsafe(bcm, flags); | 125 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
126 | mutex_unlock(&bcm->mutex); | ||
125 | res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); | 127 | res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); |
126 | up(&big_buffer_sem); | 128 | up(&big_buffer_sem); |
127 | return res; | 129 | return res; |
@@ -159,7 +161,8 @@ static ssize_t spromdump_read_file(struct file *file, char __user *userbuf, | |||
159 | unsigned long flags; | 161 | unsigned long flags; |
160 | 162 | ||
161 | down(&big_buffer_sem); | 163 | down(&big_buffer_sem); |
162 | bcm43xx_lock_irqsafe(bcm, flags); | 164 | mutex_lock(&bcm->mutex); |
165 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
163 | if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) { | 166 | if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) { |
164 | fappend("Board not initialized.\n"); | 167 | fappend("Board not initialized.\n"); |
165 | goto out; | 168 | goto out; |
@@ -169,7 +172,8 @@ static ssize_t spromdump_read_file(struct file *file, char __user *userbuf, | |||
169 | fappend("boardflags: 0x%04x\n", bcm->sprom.boardflags); | 172 | fappend("boardflags: 0x%04x\n", bcm->sprom.boardflags); |
170 | 173 | ||
171 | out: | 174 | out: |
172 | bcm43xx_unlock_irqsafe(bcm, flags); | 175 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
176 | mutex_unlock(&bcm->mutex); | ||
173 | res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); | 177 | res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); |
174 | up(&big_buffer_sem); | 178 | up(&big_buffer_sem); |
175 | return res; | 179 | return res; |
@@ -188,7 +192,8 @@ static ssize_t tsf_read_file(struct file *file, char __user *userbuf, | |||
188 | u64 tsf; | 192 | u64 tsf; |
189 | 193 | ||
190 | down(&big_buffer_sem); | 194 | down(&big_buffer_sem); |
191 | bcm43xx_lock_irqsafe(bcm, flags); | 195 | mutex_lock(&bcm->mutex); |
196 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
192 | if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) { | 197 | if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) { |
193 | fappend("Board not initialized.\n"); | 198 | fappend("Board not initialized.\n"); |
194 | goto out; | 199 | goto out; |
@@ -199,7 +204,8 @@ static ssize_t tsf_read_file(struct file *file, char __user *userbuf, | |||
199 | (unsigned int)(tsf & 0xFFFFFFFFULL)); | 204 | (unsigned int)(tsf & 0xFFFFFFFFULL)); |
200 | 205 | ||
201 | out: | 206 | out: |
202 | bcm43xx_unlock_irqsafe(bcm, flags); | 207 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
208 | mutex_unlock(&bcm->mutex); | ||
203 | res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); | 209 | res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); |
204 | up(&big_buffer_sem); | 210 | up(&big_buffer_sem); |
205 | return res; | 211 | return res; |
@@ -221,7 +227,8 @@ static ssize_t tsf_write_file(struct file *file, const char __user *user_buf, | |||
221 | res = -EFAULT; | 227 | res = -EFAULT; |
222 | goto out_up; | 228 | goto out_up; |
223 | } | 229 | } |
224 | bcm43xx_lock_irqsafe(bcm, flags); | 230 | mutex_lock(&bcm->mutex); |
231 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
225 | if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) { | 232 | if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) { |
226 | printk(KERN_INFO PFX "debugfs: Board not initialized.\n"); | 233 | printk(KERN_INFO PFX "debugfs: Board not initialized.\n"); |
227 | res = -EFAULT; | 234 | res = -EFAULT; |
@@ -237,7 +244,8 @@ static ssize_t tsf_write_file(struct file *file, const char __user *user_buf, | |||
237 | res = buf_size; | 244 | res = buf_size; |
238 | 245 | ||
239 | out_unlock: | 246 | out_unlock: |
240 | bcm43xx_unlock_irqsafe(bcm, flags); | 247 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
248 | mutex_unlock(&bcm->mutex); | ||
241 | out_up: | 249 | out_up: |
242 | up(&big_buffer_sem); | 250 | up(&big_buffer_sem); |
243 | return res; | 251 | return res; |
@@ -258,7 +266,8 @@ static ssize_t txstat_read_file(struct file *file, char __user *userbuf, | |||
258 | int i, cnt, j = 0; | 266 | int i, cnt, j = 0; |
259 | 267 | ||
260 | down(&big_buffer_sem); | 268 | down(&big_buffer_sem); |
261 | bcm43xx_lock_irqsafe(bcm, flags); | 269 | mutex_lock(&bcm->mutex); |
270 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
262 | 271 | ||
263 | fappend("Last %d logged xmitstatus blobs (Latest first):\n\n", | 272 | fappend("Last %d logged xmitstatus blobs (Latest first):\n\n", |
264 | BCM43xx_NR_LOGGED_XMITSTATUS); | 273 | BCM43xx_NR_LOGGED_XMITSTATUS); |
@@ -294,14 +303,51 @@ static ssize_t txstat_read_file(struct file *file, char __user *userbuf, | |||
294 | i = BCM43xx_NR_LOGGED_XMITSTATUS - 1; | 303 | i = BCM43xx_NR_LOGGED_XMITSTATUS - 1; |
295 | } | 304 | } |
296 | 305 | ||
297 | bcm43xx_unlock_irqsafe(bcm, flags); | 306 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
298 | res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); | 307 | res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); |
299 | bcm43xx_lock_irqsafe(bcm, flags); | 308 | spin_lock_irqsave(&bcm->irq_lock, flags); |
300 | if (*ppos == pos) { | 309 | if (*ppos == pos) { |
301 | /* Done. Drop the copied data. */ | 310 | /* Done. Drop the copied data. */ |
302 | e->xmitstatus_printing = 0; | 311 | e->xmitstatus_printing = 0; |
303 | } | 312 | } |
304 | bcm43xx_unlock_irqsafe(bcm, flags); | 313 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
314 | mutex_unlock(&bcm->mutex); | ||
315 | up(&big_buffer_sem); | ||
316 | return res; | ||
317 | } | ||
318 | |||
319 | static ssize_t restart_write_file(struct file *file, const char __user *user_buf, | ||
320 | size_t count, loff_t *ppos) | ||
321 | { | ||
322 | struct bcm43xx_private *bcm = file->private_data; | ||
323 | char *buf = really_big_buffer; | ||
324 | ssize_t buf_size; | ||
325 | ssize_t res; | ||
326 | unsigned long flags; | ||
327 | |||
328 | buf_size = min(count, sizeof (really_big_buffer) - 1); | ||
329 | down(&big_buffer_sem); | ||
330 | if (copy_from_user(buf, user_buf, buf_size)) { | ||
331 | res = -EFAULT; | ||
332 | goto out_up; | ||
333 | } | ||
334 | mutex_lock(&(bcm)->mutex); | ||
335 | spin_lock_irqsave(&(bcm)->irq_lock, flags); | ||
336 | if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) { | ||
337 | printk(KERN_INFO PFX "debugfs: Board not initialized.\n"); | ||
338 | res = -EFAULT; | ||
339 | goto out_unlock; | ||
340 | } | ||
341 | if (count > 0 && buf[0] == '1') { | ||
342 | bcm43xx_controller_restart(bcm, "manually restarted"); | ||
343 | res = count; | ||
344 | } else | ||
345 | res = -EINVAL; | ||
346 | |||
347 | out_unlock: | ||
348 | spin_unlock_irqrestore(&(bcm)->irq_lock, flags); | ||
349 | mutex_unlock(&(bcm)->mutex); | ||
350 | out_up: | ||
305 | up(&big_buffer_sem); | 351 | up(&big_buffer_sem); |
306 | return res; | 352 | return res; |
307 | } | 353 | } |
@@ -339,6 +385,11 @@ static struct file_operations txstat_fops = { | |||
339 | .open = open_file_generic, | 385 | .open = open_file_generic, |
340 | }; | 386 | }; |
341 | 387 | ||
388 | static struct file_operations restart_fops = { | ||
389 | .write = restart_write_file, | ||
390 | .open = open_file_generic, | ||
391 | }; | ||
392 | |||
342 | 393 | ||
343 | void bcm43xx_debugfs_add_device(struct bcm43xx_private *bcm) | 394 | void bcm43xx_debugfs_add_device(struct bcm43xx_private *bcm) |
344 | { | 395 | { |
@@ -390,6 +441,10 @@ void bcm43xx_debugfs_add_device(struct bcm43xx_private *bcm) | |||
390 | bcm, &txstat_fops); | 441 | bcm, &txstat_fops); |
391 | if (!e->dentry_txstat) | 442 | if (!e->dentry_txstat) |
392 | printk(KERN_ERR PFX "debugfs: creating \"tx_status\" for \"%s\" failed!\n", devdir); | 443 | printk(KERN_ERR PFX "debugfs: creating \"tx_status\" for \"%s\" failed!\n", devdir); |
444 | e->dentry_restart = debugfs_create_file("restart", 0222, e->subdir, | ||
445 | bcm, &restart_fops); | ||
446 | if (!e->dentry_restart) | ||
447 | printk(KERN_ERR PFX "debugfs: creating \"restart\" for \"%s\" failed!\n", devdir); | ||
393 | } | 448 | } |
394 | 449 | ||
395 | void bcm43xx_debugfs_remove_device(struct bcm43xx_private *bcm) | 450 | void bcm43xx_debugfs_remove_device(struct bcm43xx_private *bcm) |
@@ -405,6 +460,7 @@ void bcm43xx_debugfs_remove_device(struct bcm43xx_private *bcm) | |||
405 | debugfs_remove(e->dentry_devinfo); | 460 | debugfs_remove(e->dentry_devinfo); |
406 | debugfs_remove(e->dentry_tsf); | 461 | debugfs_remove(e->dentry_tsf); |
407 | debugfs_remove(e->dentry_txstat); | 462 | debugfs_remove(e->dentry_txstat); |
463 | debugfs_remove(e->dentry_restart); | ||
408 | debugfs_remove(e->subdir); | 464 | debugfs_remove(e->subdir); |
409 | kfree(e->xmitstatus_buffer); | 465 | kfree(e->xmitstatus_buffer); |
410 | kfree(e->xmitstatus_print_buffer); | 466 | kfree(e->xmitstatus_print_buffer); |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h index 50ce267f794d..a40d1af35545 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h +++ b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.h | |||
@@ -20,6 +20,7 @@ struct bcm43xx_dfsentry { | |||
20 | struct dentry *dentry_spromdump; | 20 | struct dentry *dentry_spromdump; |
21 | struct dentry *dentry_tsf; | 21 | struct dentry *dentry_tsf; |
22 | struct dentry *dentry_txstat; | 22 | struct dentry *dentry_txstat; |
23 | struct dentry *dentry_restart; | ||
23 | 24 | ||
24 | struct bcm43xx_private *bcm; | 25 | struct bcm43xx_private *bcm; |
25 | 26 | ||
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_leds.c b/drivers/net/wireless/bcm43xx/bcm43xx_leds.c index ec80692d638a..c3f90c8563d9 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_leds.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_leds.c | |||
@@ -51,12 +51,12 @@ static void bcm43xx_led_blink(unsigned long d) | |||
51 | struct bcm43xx_private *bcm = led->bcm; | 51 | struct bcm43xx_private *bcm = led->bcm; |
52 | unsigned long flags; | 52 | unsigned long flags; |
53 | 53 | ||
54 | bcm43xx_lock_irqonly(bcm, flags); | 54 | spin_lock_irqsave(&bcm->leds_lock, flags); |
55 | if (led->blink_interval) { | 55 | if (led->blink_interval) { |
56 | bcm43xx_led_changestate(led); | 56 | bcm43xx_led_changestate(led); |
57 | mod_timer(&led->blink_timer, jiffies + led->blink_interval); | 57 | mod_timer(&led->blink_timer, jiffies + led->blink_interval); |
58 | } | 58 | } |
59 | bcm43xx_unlock_irqonly(bcm, flags); | 59 | spin_unlock_irqrestore(&bcm->leds_lock, flags); |
60 | } | 60 | } |
61 | 61 | ||
62 | static void bcm43xx_led_blink_start(struct bcm43xx_led *led, | 62 | static void bcm43xx_led_blink_start(struct bcm43xx_led *led, |
@@ -177,7 +177,9 @@ void bcm43xx_leds_update(struct bcm43xx_private *bcm, int activity) | |||
177 | int i, turn_on; | 177 | int i, turn_on; |
178 | unsigned long interval = 0; | 178 | unsigned long interval = 0; |
179 | u16 ledctl; | 179 | u16 ledctl; |
180 | unsigned long flags; | ||
180 | 181 | ||
182 | spin_lock_irqsave(&bcm->leds_lock, flags); | ||
181 | ledctl = bcm43xx_read16(bcm, BCM43xx_MMIO_GPIO_CONTROL); | 183 | ledctl = bcm43xx_read16(bcm, BCM43xx_MMIO_GPIO_CONTROL); |
182 | for (i = 0; i < BCM43xx_NR_LEDS; i++) { | 184 | for (i = 0; i < BCM43xx_NR_LEDS; i++) { |
183 | led = &(bcm->leds[i]); | 185 | led = &(bcm->leds[i]); |
@@ -266,6 +268,7 @@ void bcm43xx_leds_update(struct bcm43xx_private *bcm, int activity) | |||
266 | ledctl &= ~(1 << i); | 268 | ledctl &= ~(1 << i); |
267 | } | 269 | } |
268 | bcm43xx_write16(bcm, BCM43xx_MMIO_GPIO_CONTROL, ledctl); | 270 | bcm43xx_write16(bcm, BCM43xx_MMIO_GPIO_CONTROL, ledctl); |
271 | spin_unlock_irqrestore(&bcm->leds_lock, flags); | ||
269 | } | 272 | } |
270 | 273 | ||
271 | void bcm43xx_leds_switch_all(struct bcm43xx_private *bcm, int on) | 274 | void bcm43xx_leds_switch_all(struct bcm43xx_private *bcm, int on) |
@@ -274,7 +277,9 @@ void bcm43xx_leds_switch_all(struct bcm43xx_private *bcm, int on) | |||
274 | u16 ledctl; | 277 | u16 ledctl; |
275 | int i; | 278 | int i; |
276 | int bit_on; | 279 | int bit_on; |
280 | unsigned long flags; | ||
277 | 281 | ||
282 | spin_lock_irqsave(&bcm->leds_lock, flags); | ||
278 | ledctl = bcm43xx_read16(bcm, BCM43xx_MMIO_GPIO_CONTROL); | 283 | ledctl = bcm43xx_read16(bcm, BCM43xx_MMIO_GPIO_CONTROL); |
279 | for (i = 0; i < BCM43xx_NR_LEDS; i++) { | 284 | for (i = 0; i < BCM43xx_NR_LEDS; i++) { |
280 | led = &(bcm->leds[i]); | 285 | led = &(bcm->leds[i]); |
@@ -290,4 +295,5 @@ void bcm43xx_leds_switch_all(struct bcm43xx_private *bcm, int on) | |||
290 | ledctl &= ~(1 << i); | 295 | ledctl &= ~(1 << i); |
291 | } | 296 | } |
292 | bcm43xx_write16(bcm, BCM43xx_MMIO_GPIO_CONTROL, ledctl); | 297 | bcm43xx_write16(bcm, BCM43xx_MMIO_GPIO_CONTROL, ledctl); |
298 | spin_unlock_irqrestore(&bcm->leds_lock, flags); | ||
293 | } | 299 | } |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index df317c1e12a8..b095f3cc6730 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c | |||
@@ -509,23 +509,19 @@ static void bcm43xx_synchronize_irq(struct bcm43xx_private *bcm) | |||
509 | } | 509 | } |
510 | 510 | ||
511 | /* Make sure we don't receive more data from the device. */ | 511 | /* Make sure we don't receive more data from the device. */ |
512 | static int bcm43xx_disable_interrupts_sync(struct bcm43xx_private *bcm, u32 *oldstate) | 512 | static int bcm43xx_disable_interrupts_sync(struct bcm43xx_private *bcm) |
513 | { | 513 | { |
514 | unsigned long flags; | 514 | unsigned long flags; |
515 | u32 old; | ||
516 | 515 | ||
517 | bcm43xx_lock_irqonly(bcm, flags); | 516 | spin_lock_irqsave(&bcm->irq_lock, flags); |
518 | if (unlikely(bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED)) { | 517 | if (unlikely(bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED)) { |
519 | bcm43xx_unlock_irqonly(bcm, flags); | 518 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
520 | return -EBUSY; | 519 | return -EBUSY; |
521 | } | 520 | } |
522 | old = bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL); | 521 | bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL); |
523 | bcm43xx_unlock_irqonly(bcm, flags); | 522 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
524 | bcm43xx_synchronize_irq(bcm); | 523 | bcm43xx_synchronize_irq(bcm); |
525 | 524 | ||
526 | if (oldstate) | ||
527 | *oldstate = old; | ||
528 | |||
529 | return 0; | 525 | return 0; |
530 | } | 526 | } |
531 | 527 | ||
@@ -537,7 +533,6 @@ static int bcm43xx_read_radioinfo(struct bcm43xx_private *bcm) | |||
537 | u16 manufact; | 533 | u16 manufact; |
538 | u16 version; | 534 | u16 version; |
539 | u8 revision; | 535 | u8 revision; |
540 | s8 i; | ||
541 | 536 | ||
542 | if (bcm->chip_id == 0x4317) { | 537 | if (bcm->chip_id == 0x4317) { |
543 | if (bcm->chip_rev == 0x00) | 538 | if (bcm->chip_rev == 0x00) |
@@ -580,20 +575,11 @@ static int bcm43xx_read_radioinfo(struct bcm43xx_private *bcm) | |||
580 | radio->version = version; | 575 | radio->version = version; |
581 | radio->revision = revision; | 576 | radio->revision = revision; |
582 | 577 | ||
583 | /* Set default attenuation values. */ | ||
584 | radio->baseband_atten = bcm43xx_default_baseband_attenuation(bcm); | ||
585 | radio->radio_atten = bcm43xx_default_radio_attenuation(bcm); | ||
586 | radio->txctl1 = bcm43xx_default_txctl1(bcm); | ||
587 | radio->txctl2 = 0xFFFF; | ||
588 | if (phy->type == BCM43xx_PHYTYPE_A) | 578 | if (phy->type == BCM43xx_PHYTYPE_A) |
589 | radio->txpower_desired = bcm->sprom.maxpower_aphy; | 579 | radio->txpower_desired = bcm->sprom.maxpower_aphy; |
590 | else | 580 | else |
591 | radio->txpower_desired = bcm->sprom.maxpower_bgphy; | 581 | radio->txpower_desired = bcm->sprom.maxpower_bgphy; |
592 | 582 | ||
593 | /* Initialize the in-memory nrssi Lookup Table. */ | ||
594 | for (i = 0; i < 64; i++) | ||
595 | radio->nrssi_lt[i] = i; | ||
596 | |||
597 | return 0; | 583 | return 0; |
598 | 584 | ||
599 | err_unsupported_radio: | 585 | err_unsupported_radio: |
@@ -1250,10 +1236,6 @@ int bcm43xx_switch_core(struct bcm43xx_private *bcm, struct bcm43xx_coreinfo *ne | |||
1250 | goto out; | 1236 | goto out; |
1251 | 1237 | ||
1252 | bcm->current_core = new_core; | 1238 | bcm->current_core = new_core; |
1253 | bcm->current_80211_core_idx = -1; | ||
1254 | if (new_core->id == BCM43xx_COREID_80211) | ||
1255 | bcm->current_80211_core_idx = (int)(new_core - &(bcm->core_80211[0])); | ||
1256 | |||
1257 | out: | 1239 | out: |
1258 | return err; | 1240 | return err; |
1259 | } | 1241 | } |
@@ -1423,43 +1405,23 @@ static void bcm43xx_wireless_core_disable(struct bcm43xx_private *bcm) | |||
1423 | bcm43xx_core_disable(bcm, 0); | 1405 | bcm43xx_core_disable(bcm, 0); |
1424 | } | 1406 | } |
1425 | 1407 | ||
1426 | /* Mark the current 80211 core inactive. | 1408 | /* Mark the current 80211 core inactive. */ |
1427 | * "active_80211_core" is the other 80211 core, which is used. | 1409 | static void bcm43xx_wireless_core_mark_inactive(struct bcm43xx_private *bcm) |
1428 | */ | ||
1429 | static int bcm43xx_wireless_core_mark_inactive(struct bcm43xx_private *bcm, | ||
1430 | struct bcm43xx_coreinfo *active_80211_core) | ||
1431 | { | 1410 | { |
1432 | u32 sbtmstatelow; | 1411 | u32 sbtmstatelow; |
1433 | struct bcm43xx_coreinfo *old_core; | ||
1434 | int err = 0; | ||
1435 | 1412 | ||
1436 | bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL); | 1413 | bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL); |
1437 | bcm43xx_radio_turn_off(bcm); | 1414 | bcm43xx_radio_turn_off(bcm); |
1438 | sbtmstatelow = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATELOW); | 1415 | sbtmstatelow = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATELOW); |
1439 | sbtmstatelow &= ~0x200a0000; | 1416 | sbtmstatelow &= 0xDFF5FFFF; |
1440 | sbtmstatelow |= 0xa0000; | 1417 | sbtmstatelow |= 0x000A0000; |
1441 | bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, sbtmstatelow); | 1418 | bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, sbtmstatelow); |
1442 | udelay(1); | 1419 | udelay(1); |
1443 | sbtmstatelow = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATELOW); | 1420 | sbtmstatelow = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATELOW); |
1444 | sbtmstatelow &= ~0xa0000; | 1421 | sbtmstatelow &= 0xFFF5FFFF; |
1445 | sbtmstatelow |= 0x80000; | 1422 | sbtmstatelow |= 0x00080000; |
1446 | bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, sbtmstatelow); | 1423 | bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, sbtmstatelow); |
1447 | udelay(1); | 1424 | udelay(1); |
1448 | |||
1449 | if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_G) { | ||
1450 | old_core = bcm->current_core; | ||
1451 | err = bcm43xx_switch_core(bcm, active_80211_core); | ||
1452 | if (err) | ||
1453 | goto out; | ||
1454 | sbtmstatelow = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATELOW); | ||
1455 | sbtmstatelow &= ~0x20000000; | ||
1456 | sbtmstatelow |= 0x20000000; | ||
1457 | bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, sbtmstatelow); | ||
1458 | err = bcm43xx_switch_core(bcm, old_core); | ||
1459 | } | ||
1460 | |||
1461 | out: | ||
1462 | return err; | ||
1463 | } | 1425 | } |
1464 | 1426 | ||
1465 | static void handle_irq_transmit_status(struct bcm43xx_private *bcm) | 1427 | static void handle_irq_transmit_status(struct bcm43xx_private *bcm) |
@@ -1720,7 +1682,7 @@ static void bcm43xx_interrupt_tasklet(struct bcm43xx_private *bcm) | |||
1720 | # define bcmirq_handled(irq) do { /* nothing */ } while (0) | 1682 | # define bcmirq_handled(irq) do { /* nothing */ } while (0) |
1721 | #endif /* CONFIG_BCM43XX_DEBUG*/ | 1683 | #endif /* CONFIG_BCM43XX_DEBUG*/ |
1722 | 1684 | ||
1723 | bcm43xx_lock_irqonly(bcm, flags); | 1685 | spin_lock_irqsave(&bcm->irq_lock, flags); |
1724 | reason = bcm->irq_reason; | 1686 | reason = bcm->irq_reason; |
1725 | dma_reason[0] = bcm->dma_reason[0]; | 1687 | dma_reason[0] = bcm->dma_reason[0]; |
1726 | dma_reason[1] = bcm->dma_reason[1]; | 1688 | dma_reason[1] = bcm->dma_reason[1]; |
@@ -1746,7 +1708,7 @@ static void bcm43xx_interrupt_tasklet(struct bcm43xx_private *bcm) | |||
1746 | dma_reason[2], dma_reason[3]); | 1708 | dma_reason[2], dma_reason[3]); |
1747 | bcm43xx_controller_restart(bcm, "DMA error"); | 1709 | bcm43xx_controller_restart(bcm, "DMA error"); |
1748 | mmiowb(); | 1710 | mmiowb(); |
1749 | bcm43xx_unlock_irqonly(bcm, flags); | 1711 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
1750 | return; | 1712 | return; |
1751 | } | 1713 | } |
1752 | if (unlikely((dma_reason[0] & BCM43xx_DMAIRQ_NONFATALMASK) | | 1714 | if (unlikely((dma_reason[0] & BCM43xx_DMAIRQ_NONFATALMASK) | |
@@ -1834,7 +1796,7 @@ static void bcm43xx_interrupt_tasklet(struct bcm43xx_private *bcm) | |||
1834 | bcm43xx_leds_update(bcm, activity); | 1796 | bcm43xx_leds_update(bcm, activity); |
1835 | bcm43xx_interrupt_enable(bcm, bcm->irq_savedstate); | 1797 | bcm43xx_interrupt_enable(bcm, bcm->irq_savedstate); |
1836 | mmiowb(); | 1798 | mmiowb(); |
1837 | bcm43xx_unlock_irqonly(bcm, flags); | 1799 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
1838 | } | 1800 | } |
1839 | 1801 | ||
1840 | static void pio_irq_workaround(struct bcm43xx_private *bcm, | 1802 | static void pio_irq_workaround(struct bcm43xx_private *bcm, |
@@ -1885,14 +1847,8 @@ static irqreturn_t bcm43xx_interrupt_handler(int irq, void *dev_id, struct pt_re | |||
1885 | 1847 | ||
1886 | spin_lock(&bcm->irq_lock); | 1848 | spin_lock(&bcm->irq_lock); |
1887 | 1849 | ||
1888 | /* Only accept IRQs, if we are initialized properly. | 1850 | assert(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED); |
1889 | * This avoids an RX race while initializing. | 1851 | assert(bcm->current_core->id == BCM43xx_COREID_80211); |
1890 | * We should probably not enable IRQs before we are initialized | ||
1891 | * completely, but some careful work is needed to fix this. I think it | ||
1892 | * is best to stay with this cheap workaround for now... . | ||
1893 | */ | ||
1894 | if (unlikely(bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED)) | ||
1895 | goto out; | ||
1896 | 1852 | ||
1897 | reason = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); | 1853 | reason = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); |
1898 | if (reason == 0xffffffff) { | 1854 | if (reason == 0xffffffff) { |
@@ -1930,16 +1886,18 @@ out: | |||
1930 | 1886 | ||
1931 | static void bcm43xx_release_firmware(struct bcm43xx_private *bcm, int force) | 1887 | static void bcm43xx_release_firmware(struct bcm43xx_private *bcm, int force) |
1932 | { | 1888 | { |
1889 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | ||
1890 | |||
1933 | if (bcm->firmware_norelease && !force) | 1891 | if (bcm->firmware_norelease && !force) |
1934 | return; /* Suspending or controller reset. */ | 1892 | return; /* Suspending or controller reset. */ |
1935 | release_firmware(bcm->ucode); | 1893 | release_firmware(phy->ucode); |
1936 | bcm->ucode = NULL; | 1894 | phy->ucode = NULL; |
1937 | release_firmware(bcm->pcm); | 1895 | release_firmware(phy->pcm); |
1938 | bcm->pcm = NULL; | 1896 | phy->pcm = NULL; |
1939 | release_firmware(bcm->initvals0); | 1897 | release_firmware(phy->initvals0); |
1940 | bcm->initvals0 = NULL; | 1898 | phy->initvals0 = NULL; |
1941 | release_firmware(bcm->initvals1); | 1899 | release_firmware(phy->initvals1); |
1942 | bcm->initvals1 = NULL; | 1900 | phy->initvals1 = NULL; |
1943 | } | 1901 | } |
1944 | 1902 | ||
1945 | static int bcm43xx_request_firmware(struct bcm43xx_private *bcm) | 1903 | static int bcm43xx_request_firmware(struct bcm43xx_private *bcm) |
@@ -1950,11 +1908,11 @@ static int bcm43xx_request_firmware(struct bcm43xx_private *bcm) | |||
1950 | int nr; | 1908 | int nr; |
1951 | char buf[22 + sizeof(modparam_fwpostfix) - 1] = { 0 }; | 1909 | char buf[22 + sizeof(modparam_fwpostfix) - 1] = { 0 }; |
1952 | 1910 | ||
1953 | if (!bcm->ucode) { | 1911 | if (!phy->ucode) { |
1954 | snprintf(buf, ARRAY_SIZE(buf), "bcm43xx_microcode%d%s.fw", | 1912 | snprintf(buf, ARRAY_SIZE(buf), "bcm43xx_microcode%d%s.fw", |
1955 | (rev >= 5 ? 5 : rev), | 1913 | (rev >= 5 ? 5 : rev), |
1956 | modparam_fwpostfix); | 1914 | modparam_fwpostfix); |
1957 | err = request_firmware(&bcm->ucode, buf, &bcm->pci_dev->dev); | 1915 | err = request_firmware(&phy->ucode, buf, &bcm->pci_dev->dev); |
1958 | if (err) { | 1916 | if (err) { |
1959 | printk(KERN_ERR PFX | 1917 | printk(KERN_ERR PFX |
1960 | "Error: Microcode \"%s\" not available or load failed.\n", | 1918 | "Error: Microcode \"%s\" not available or load failed.\n", |
@@ -1963,12 +1921,12 @@ static int bcm43xx_request_firmware(struct bcm43xx_private *bcm) | |||
1963 | } | 1921 | } |
1964 | } | 1922 | } |
1965 | 1923 | ||
1966 | if (!bcm->pcm) { | 1924 | if (!phy->pcm) { |
1967 | snprintf(buf, ARRAY_SIZE(buf), | 1925 | snprintf(buf, ARRAY_SIZE(buf), |
1968 | "bcm43xx_pcm%d%s.fw", | 1926 | "bcm43xx_pcm%d%s.fw", |
1969 | (rev < 5 ? 4 : 5), | 1927 | (rev < 5 ? 4 : 5), |
1970 | modparam_fwpostfix); | 1928 | modparam_fwpostfix); |
1971 | err = request_firmware(&bcm->pcm, buf, &bcm->pci_dev->dev); | 1929 | err = request_firmware(&phy->pcm, buf, &bcm->pci_dev->dev); |
1972 | if (err) { | 1930 | if (err) { |
1973 | printk(KERN_ERR PFX | 1931 | printk(KERN_ERR PFX |
1974 | "Error: PCM \"%s\" not available or load failed.\n", | 1932 | "Error: PCM \"%s\" not available or load failed.\n", |
@@ -1977,7 +1935,7 @@ static int bcm43xx_request_firmware(struct bcm43xx_private *bcm) | |||
1977 | } | 1935 | } |
1978 | } | 1936 | } |
1979 | 1937 | ||
1980 | if (!bcm->initvals0) { | 1938 | if (!phy->initvals0) { |
1981 | if (rev == 2 || rev == 4) { | 1939 | if (rev == 2 || rev == 4) { |
1982 | switch (phy->type) { | 1940 | switch (phy->type) { |
1983 | case BCM43xx_PHYTYPE_A: | 1941 | case BCM43xx_PHYTYPE_A: |
@@ -2008,20 +1966,20 @@ static int bcm43xx_request_firmware(struct bcm43xx_private *bcm) | |||
2008 | snprintf(buf, ARRAY_SIZE(buf), "bcm43xx_initval%02d%s.fw", | 1966 | snprintf(buf, ARRAY_SIZE(buf), "bcm43xx_initval%02d%s.fw", |
2009 | nr, modparam_fwpostfix); | 1967 | nr, modparam_fwpostfix); |
2010 | 1968 | ||
2011 | err = request_firmware(&bcm->initvals0, buf, &bcm->pci_dev->dev); | 1969 | err = request_firmware(&phy->initvals0, buf, &bcm->pci_dev->dev); |
2012 | if (err) { | 1970 | if (err) { |
2013 | printk(KERN_ERR PFX | 1971 | printk(KERN_ERR PFX |
2014 | "Error: InitVals \"%s\" not available or load failed.\n", | 1972 | "Error: InitVals \"%s\" not available or load failed.\n", |
2015 | buf); | 1973 | buf); |
2016 | goto error; | 1974 | goto error; |
2017 | } | 1975 | } |
2018 | if (bcm->initvals0->size % sizeof(struct bcm43xx_initval)) { | 1976 | if (phy->initvals0->size % sizeof(struct bcm43xx_initval)) { |
2019 | printk(KERN_ERR PFX "InitVals fileformat error.\n"); | 1977 | printk(KERN_ERR PFX "InitVals fileformat error.\n"); |
2020 | goto error; | 1978 | goto error; |
2021 | } | 1979 | } |
2022 | } | 1980 | } |
2023 | 1981 | ||
2024 | if (!bcm->initvals1) { | 1982 | if (!phy->initvals1) { |
2025 | if (rev >= 5) { | 1983 | if (rev >= 5) { |
2026 | u32 sbtmstatehigh; | 1984 | u32 sbtmstatehigh; |
2027 | 1985 | ||
@@ -2043,14 +2001,14 @@ static int bcm43xx_request_firmware(struct bcm43xx_private *bcm) | |||
2043 | snprintf(buf, ARRAY_SIZE(buf), "bcm43xx_initval%02d%s.fw", | 2001 | snprintf(buf, ARRAY_SIZE(buf), "bcm43xx_initval%02d%s.fw", |
2044 | nr, modparam_fwpostfix); | 2002 | nr, modparam_fwpostfix); |
2045 | 2003 | ||
2046 | err = request_firmware(&bcm->initvals1, buf, &bcm->pci_dev->dev); | 2004 | err = request_firmware(&phy->initvals1, buf, &bcm->pci_dev->dev); |
2047 | if (err) { | 2005 | if (err) { |
2048 | printk(KERN_ERR PFX | 2006 | printk(KERN_ERR PFX |
2049 | "Error: InitVals \"%s\" not available or load failed.\n", | 2007 | "Error: InitVals \"%s\" not available or load failed.\n", |
2050 | buf); | 2008 | buf); |
2051 | goto error; | 2009 | goto error; |
2052 | } | 2010 | } |
2053 | if (bcm->initvals1->size % sizeof(struct bcm43xx_initval)) { | 2011 | if (phy->initvals1->size % sizeof(struct bcm43xx_initval)) { |
2054 | printk(KERN_ERR PFX "InitVals fileformat error.\n"); | 2012 | printk(KERN_ERR PFX "InitVals fileformat error.\n"); |
2055 | goto error; | 2013 | goto error; |
2056 | } | 2014 | } |
@@ -2070,12 +2028,13 @@ err_noinitval: | |||
2070 | 2028 | ||
2071 | static void bcm43xx_upload_microcode(struct bcm43xx_private *bcm) | 2029 | static void bcm43xx_upload_microcode(struct bcm43xx_private *bcm) |
2072 | { | 2030 | { |
2031 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | ||
2073 | const u32 *data; | 2032 | const u32 *data; |
2074 | unsigned int i, len; | 2033 | unsigned int i, len; |
2075 | 2034 | ||
2076 | /* Upload Microcode. */ | 2035 | /* Upload Microcode. */ |
2077 | data = (u32 *)(bcm->ucode->data); | 2036 | data = (u32 *)(phy->ucode->data); |
2078 | len = bcm->ucode->size / sizeof(u32); | 2037 | len = phy->ucode->size / sizeof(u32); |
2079 | bcm43xx_shm_control_word(bcm, BCM43xx_SHM_UCODE, 0x0000); | 2038 | bcm43xx_shm_control_word(bcm, BCM43xx_SHM_UCODE, 0x0000); |
2080 | for (i = 0; i < len; i++) { | 2039 | for (i = 0; i < len; i++) { |
2081 | bcm43xx_write32(bcm, BCM43xx_MMIO_SHM_DATA, | 2040 | bcm43xx_write32(bcm, BCM43xx_MMIO_SHM_DATA, |
@@ -2084,8 +2043,8 @@ static void bcm43xx_upload_microcode(struct bcm43xx_private *bcm) | |||
2084 | } | 2043 | } |
2085 | 2044 | ||
2086 | /* Upload PCM data. */ | 2045 | /* Upload PCM data. */ |
2087 | data = (u32 *)(bcm->pcm->data); | 2046 | data = (u32 *)(phy->pcm->data); |
2088 | len = bcm->pcm->size / sizeof(u32); | 2047 | len = phy->pcm->size / sizeof(u32); |
2089 | bcm43xx_shm_control_word(bcm, BCM43xx_SHM_PCM, 0x01ea); | 2048 | bcm43xx_shm_control_word(bcm, BCM43xx_SHM_PCM, 0x01ea); |
2090 | bcm43xx_write32(bcm, BCM43xx_MMIO_SHM_DATA, 0x00004000); | 2049 | bcm43xx_write32(bcm, BCM43xx_MMIO_SHM_DATA, 0x00004000); |
2091 | bcm43xx_shm_control_word(bcm, BCM43xx_SHM_PCM, 0x01eb); | 2050 | bcm43xx_shm_control_word(bcm, BCM43xx_SHM_PCM, 0x01eb); |
@@ -2131,15 +2090,16 @@ err_format: | |||
2131 | 2090 | ||
2132 | static int bcm43xx_upload_initvals(struct bcm43xx_private *bcm) | 2091 | static int bcm43xx_upload_initvals(struct bcm43xx_private *bcm) |
2133 | { | 2092 | { |
2093 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | ||
2134 | int err; | 2094 | int err; |
2135 | 2095 | ||
2136 | err = bcm43xx_write_initvals(bcm, (struct bcm43xx_initval *)bcm->initvals0->data, | 2096 | err = bcm43xx_write_initvals(bcm, (struct bcm43xx_initval *)phy->initvals0->data, |
2137 | bcm->initvals0->size / sizeof(struct bcm43xx_initval)); | 2097 | phy->initvals0->size / sizeof(struct bcm43xx_initval)); |
2138 | if (err) | 2098 | if (err) |
2139 | goto out; | 2099 | goto out; |
2140 | if (bcm->initvals1) { | 2100 | if (phy->initvals1) { |
2141 | err = bcm43xx_write_initvals(bcm, (struct bcm43xx_initval *)bcm->initvals1->data, | 2101 | err = bcm43xx_write_initvals(bcm, (struct bcm43xx_initval *)phy->initvals1->data, |
2142 | bcm->initvals1->size / sizeof(struct bcm43xx_initval)); | 2102 | phy->initvals1->size / sizeof(struct bcm43xx_initval)); |
2143 | if (err) | 2103 | if (err) |
2144 | goto out; | 2104 | goto out; |
2145 | } | 2105 | } |
@@ -2156,9 +2116,7 @@ static struct pci_device_id bcm43xx_47xx_ids[] = { | |||
2156 | 2116 | ||
2157 | static int bcm43xx_initialize_irq(struct bcm43xx_private *bcm) | 2117 | static int bcm43xx_initialize_irq(struct bcm43xx_private *bcm) |
2158 | { | 2118 | { |
2159 | int res; | 2119 | int err; |
2160 | unsigned int i; | ||
2161 | u32 data; | ||
2162 | 2120 | ||
2163 | bcm->irq = bcm->pci_dev->irq; | 2121 | bcm->irq = bcm->pci_dev->irq; |
2164 | #ifdef CONFIG_BCM947XX | 2122 | #ifdef CONFIG_BCM947XX |
@@ -2175,32 +2133,12 @@ static int bcm43xx_initialize_irq(struct bcm43xx_private *bcm) | |||
2175 | } | 2133 | } |
2176 | } | 2134 | } |
2177 | #endif | 2135 | #endif |
2178 | res = request_irq(bcm->irq, bcm43xx_interrupt_handler, | 2136 | err = request_irq(bcm->irq, bcm43xx_interrupt_handler, |
2179 | IRQF_SHARED, KBUILD_MODNAME, bcm); | 2137 | IRQF_SHARED, KBUILD_MODNAME, bcm); |
2180 | if (res) { | 2138 | if (err) |
2181 | printk(KERN_ERR PFX "Cannot register IRQ%d\n", bcm->irq); | 2139 | printk(KERN_ERR PFX "Cannot register IRQ%d\n", bcm->irq); |
2182 | return -ENODEV; | ||
2183 | } | ||
2184 | bcm43xx_write32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON, 0xffffffff); | ||
2185 | bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, 0x00020402); | ||
2186 | i = 0; | ||
2187 | while (1) { | ||
2188 | data = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); | ||
2189 | if (data == BCM43xx_IRQ_READY) | ||
2190 | break; | ||
2191 | i++; | ||
2192 | if (i >= BCM43xx_IRQWAIT_MAX_RETRIES) { | ||
2193 | printk(KERN_ERR PFX "Card IRQ register not responding. " | ||
2194 | "Giving up.\n"); | ||
2195 | free_irq(bcm->irq, bcm); | ||
2196 | return -ENODEV; | ||
2197 | } | ||
2198 | udelay(10); | ||
2199 | } | ||
2200 | // dummy read | ||
2201 | bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); | ||
2202 | 2140 | ||
2203 | return 0; | 2141 | return err; |
2204 | } | 2142 | } |
2205 | 2143 | ||
2206 | /* Switch to the core used to write the GPIO register. | 2144 | /* Switch to the core used to write the GPIO register. |
@@ -2298,13 +2236,17 @@ static int bcm43xx_gpio_cleanup(struct bcm43xx_private *bcm) | |||
2298 | /* http://bcm-specs.sipsolutions.net/EnableMac */ | 2236 | /* http://bcm-specs.sipsolutions.net/EnableMac */ |
2299 | void bcm43xx_mac_enable(struct bcm43xx_private *bcm) | 2237 | void bcm43xx_mac_enable(struct bcm43xx_private *bcm) |
2300 | { | 2238 | { |
2301 | bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, | 2239 | bcm->mac_suspended--; |
2302 | bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD) | 2240 | assert(bcm->mac_suspended >= 0); |
2303 | | BCM43xx_SBF_MAC_ENABLED); | 2241 | if (bcm->mac_suspended == 0) { |
2304 | bcm43xx_write32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON, BCM43xx_IRQ_READY); | 2242 | bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, |
2305 | bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD); /* dummy read */ | 2243 | bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD) |
2306 | bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); /* dummy read */ | 2244 | | BCM43xx_SBF_MAC_ENABLED); |
2307 | bcm43xx_power_saving_ctl_bits(bcm, -1, -1); | 2245 | bcm43xx_write32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON, BCM43xx_IRQ_READY); |
2246 | bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD); /* dummy read */ | ||
2247 | bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); /* dummy read */ | ||
2248 | bcm43xx_power_saving_ctl_bits(bcm, -1, -1); | ||
2249 | } | ||
2308 | } | 2250 | } |
2309 | 2251 | ||
2310 | /* http://bcm-specs.sipsolutions.net/SuspendMAC */ | 2252 | /* http://bcm-specs.sipsolutions.net/SuspendMAC */ |
@@ -2313,18 +2255,23 @@ void bcm43xx_mac_suspend(struct bcm43xx_private *bcm) | |||
2313 | int i; | 2255 | int i; |
2314 | u32 tmp; | 2256 | u32 tmp; |
2315 | 2257 | ||
2316 | bcm43xx_power_saving_ctl_bits(bcm, -1, 1); | 2258 | assert(bcm->mac_suspended >= 0); |
2317 | bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, | 2259 | if (bcm->mac_suspended == 0) { |
2318 | bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD) | 2260 | bcm43xx_power_saving_ctl_bits(bcm, -1, 1); |
2319 | & ~BCM43xx_SBF_MAC_ENABLED); | 2261 | bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, |
2320 | bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); /* dummy read */ | 2262 | bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD) |
2321 | for (i = 100000; i; i--) { | 2263 | & ~BCM43xx_SBF_MAC_ENABLED); |
2322 | tmp = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); | 2264 | bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); /* dummy read */ |
2323 | if (tmp & BCM43xx_IRQ_READY) | 2265 | for (i = 10000; i; i--) { |
2324 | return; | 2266 | tmp = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); |
2325 | udelay(10); | 2267 | if (tmp & BCM43xx_IRQ_READY) |
2268 | goto out; | ||
2269 | udelay(1); | ||
2270 | } | ||
2271 | printkl(KERN_ERR PFX "MAC suspend failed\n"); | ||
2326 | } | 2272 | } |
2327 | printkl(KERN_ERR PFX "MAC suspend failed\n"); | 2273 | out: |
2274 | bcm->mac_suspended++; | ||
2328 | } | 2275 | } |
2329 | 2276 | ||
2330 | void bcm43xx_set_iwmode(struct bcm43xx_private *bcm, | 2277 | void bcm43xx_set_iwmode(struct bcm43xx_private *bcm, |
@@ -2394,7 +2341,6 @@ static void bcm43xx_chip_cleanup(struct bcm43xx_private *bcm) | |||
2394 | if (!modparam_noleds) | 2341 | if (!modparam_noleds) |
2395 | bcm43xx_leds_exit(bcm); | 2342 | bcm43xx_leds_exit(bcm); |
2396 | bcm43xx_gpio_cleanup(bcm); | 2343 | bcm43xx_gpio_cleanup(bcm); |
2397 | free_irq(bcm->irq, bcm); | ||
2398 | bcm43xx_release_firmware(bcm, 0); | 2344 | bcm43xx_release_firmware(bcm, 0); |
2399 | } | 2345 | } |
2400 | 2346 | ||
@@ -2406,7 +2352,7 @@ static int bcm43xx_chip_init(struct bcm43xx_private *bcm) | |||
2406 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); | 2352 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
2407 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | 2353 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
2408 | int err; | 2354 | int err; |
2409 | int tmp; | 2355 | int i, tmp; |
2410 | u32 value32; | 2356 | u32 value32; |
2411 | u16 value16; | 2357 | u16 value16; |
2412 | 2358 | ||
@@ -2419,13 +2365,26 @@ static int bcm43xx_chip_init(struct bcm43xx_private *bcm) | |||
2419 | goto out; | 2365 | goto out; |
2420 | bcm43xx_upload_microcode(bcm); | 2366 | bcm43xx_upload_microcode(bcm); |
2421 | 2367 | ||
2422 | err = bcm43xx_initialize_irq(bcm); | 2368 | bcm43xx_write32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON, 0xFFFFFFFF); |
2423 | if (err) | 2369 | bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD, 0x00020402); |
2424 | goto err_release_fw; | 2370 | i = 0; |
2371 | while (1) { | ||
2372 | value32 = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); | ||
2373 | if (value32 == BCM43xx_IRQ_READY) | ||
2374 | break; | ||
2375 | i++; | ||
2376 | if (i >= BCM43xx_IRQWAIT_MAX_RETRIES) { | ||
2377 | printk(KERN_ERR PFX "IRQ_READY timeout\n"); | ||
2378 | err = -ENODEV; | ||
2379 | goto err_release_fw; | ||
2380 | } | ||
2381 | udelay(10); | ||
2382 | } | ||
2383 | bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); /* dummy read */ | ||
2425 | 2384 | ||
2426 | err = bcm43xx_gpio_init(bcm); | 2385 | err = bcm43xx_gpio_init(bcm); |
2427 | if (err) | 2386 | if (err) |
2428 | goto err_free_irq; | 2387 | goto err_release_fw; |
2429 | 2388 | ||
2430 | err = bcm43xx_upload_initvals(bcm); | 2389 | err = bcm43xx_upload_initvals(bcm); |
2431 | if (err) | 2390 | if (err) |
@@ -2509,8 +2468,6 @@ err_radio_off: | |||
2509 | bcm43xx_radio_turn_off(bcm); | 2468 | bcm43xx_radio_turn_off(bcm); |
2510 | err_gpio_cleanup: | 2469 | err_gpio_cleanup: |
2511 | bcm43xx_gpio_cleanup(bcm); | 2470 | bcm43xx_gpio_cleanup(bcm); |
2512 | err_free_irq: | ||
2513 | free_irq(bcm->irq, bcm); | ||
2514 | err_release_fw: | 2471 | err_release_fw: |
2515 | bcm43xx_release_firmware(bcm, 1); | 2472 | bcm43xx_release_firmware(bcm, 1); |
2516 | goto out; | 2473 | goto out; |
@@ -2550,11 +2507,9 @@ static void bcm43xx_init_struct_phyinfo(struct bcm43xx_phyinfo *phy) | |||
2550 | { | 2507 | { |
2551 | /* Initialize a "phyinfo" structure. The structure is already | 2508 | /* Initialize a "phyinfo" structure. The structure is already |
2552 | * zeroed out. | 2509 | * zeroed out. |
2510 | * This is called on insmod time to initialize members. | ||
2553 | */ | 2511 | */ |
2554 | phy->antenna_diversity = 0xFFFF; | ||
2555 | phy->savedpctlreg = 0xFFFF; | 2512 | phy->savedpctlreg = 0xFFFF; |
2556 | phy->minlowsig[0] = 0xFFFF; | ||
2557 | phy->minlowsig[1] = 0xFFFF; | ||
2558 | spin_lock_init(&phy->lock); | 2513 | spin_lock_init(&phy->lock); |
2559 | } | 2514 | } |
2560 | 2515 | ||
@@ -2562,14 +2517,11 @@ static void bcm43xx_init_struct_radioinfo(struct bcm43xx_radioinfo *radio) | |||
2562 | { | 2517 | { |
2563 | /* Initialize a "radioinfo" structure. The structure is already | 2518 | /* Initialize a "radioinfo" structure. The structure is already |
2564 | * zeroed out. | 2519 | * zeroed out. |
2520 | * This is called on insmod time to initialize members. | ||
2565 | */ | 2521 | */ |
2566 | radio->interfmode = BCM43xx_RADIO_INTERFMODE_NONE; | 2522 | radio->interfmode = BCM43xx_RADIO_INTERFMODE_NONE; |
2567 | radio->channel = 0xFF; | 2523 | radio->channel = 0xFF; |
2568 | radio->initial_channel = 0xFF; | 2524 | radio->initial_channel = 0xFF; |
2569 | radio->lofcal = 0xFFFF; | ||
2570 | radio->initval = 0xFFFF; | ||
2571 | radio->nrssi[0] = -1000; | ||
2572 | radio->nrssi[1] = -1000; | ||
2573 | } | 2525 | } |
2574 | 2526 | ||
2575 | static int bcm43xx_probe_cores(struct bcm43xx_private *bcm) | 2527 | static int bcm43xx_probe_cores(struct bcm43xx_private *bcm) |
@@ -2587,7 +2539,6 @@ static int bcm43xx_probe_cores(struct bcm43xx_private *bcm) | |||
2587 | * BCM43xx_MAX_80211_CORES); | 2539 | * BCM43xx_MAX_80211_CORES); |
2588 | memset(&bcm->core_80211_ext, 0, sizeof(struct bcm43xx_coreinfo_80211) | 2540 | memset(&bcm->core_80211_ext, 0, sizeof(struct bcm43xx_coreinfo_80211) |
2589 | * BCM43xx_MAX_80211_CORES); | 2541 | * BCM43xx_MAX_80211_CORES); |
2590 | bcm->current_80211_core_idx = -1; | ||
2591 | bcm->nr_80211_available = 0; | 2542 | bcm->nr_80211_available = 0; |
2592 | bcm->current_core = NULL; | 2543 | bcm->current_core = NULL; |
2593 | bcm->active_80211_core = NULL; | 2544 | bcm->active_80211_core = NULL; |
@@ -2757,6 +2708,7 @@ static int bcm43xx_probe_cores(struct bcm43xx_private *bcm) | |||
2757 | goto out; | 2708 | goto out; |
2758 | } | 2709 | } |
2759 | bcm->nr_80211_available++; | 2710 | bcm->nr_80211_available++; |
2711 | core->priv = ext_80211; | ||
2760 | bcm43xx_init_struct_phyinfo(&ext_80211->phy); | 2712 | bcm43xx_init_struct_phyinfo(&ext_80211->phy); |
2761 | bcm43xx_init_struct_radioinfo(&ext_80211->radio); | 2713 | bcm43xx_init_struct_radioinfo(&ext_80211->radio); |
2762 | break; | 2714 | break; |
@@ -2857,7 +2809,8 @@ static void bcm43xx_wireless_core_cleanup(struct bcm43xx_private *bcm) | |||
2857 | } | 2809 | } |
2858 | 2810 | ||
2859 | /* http://bcm-specs.sipsolutions.net/80211Init */ | 2811 | /* http://bcm-specs.sipsolutions.net/80211Init */ |
2860 | static int bcm43xx_wireless_core_init(struct bcm43xx_private *bcm) | 2812 | static int bcm43xx_wireless_core_init(struct bcm43xx_private *bcm, |
2813 | int active_wlcore) | ||
2861 | { | 2814 | { |
2862 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | 2815 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
2863 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); | 2816 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
@@ -2939,19 +2892,26 @@ static int bcm43xx_wireless_core_init(struct bcm43xx_private *bcm) | |||
2939 | if (bcm->current_core->rev >= 5) | 2892 | if (bcm->current_core->rev >= 5) |
2940 | bcm43xx_write16(bcm, 0x043C, 0x000C); | 2893 | bcm43xx_write16(bcm, 0x043C, 0x000C); |
2941 | 2894 | ||
2942 | if (bcm43xx_using_pio(bcm)) | 2895 | if (active_wlcore) { |
2943 | err = bcm43xx_pio_init(bcm); | 2896 | if (bcm43xx_using_pio(bcm)) |
2944 | else | 2897 | err = bcm43xx_pio_init(bcm); |
2945 | err = bcm43xx_dma_init(bcm); | 2898 | else |
2946 | if (err) | 2899 | err = bcm43xx_dma_init(bcm); |
2947 | goto err_chip_cleanup; | 2900 | if (err) |
2901 | goto err_chip_cleanup; | ||
2902 | } | ||
2948 | bcm43xx_write16(bcm, 0x0612, 0x0050); | 2903 | bcm43xx_write16(bcm, 0x0612, 0x0050); |
2949 | bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x0416, 0x0050); | 2904 | bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x0416, 0x0050); |
2950 | bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x0414, 0x01F4); | 2905 | bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x0414, 0x01F4); |
2951 | 2906 | ||
2952 | bcm43xx_mac_enable(bcm); | 2907 | if (active_wlcore) { |
2953 | bcm43xx_interrupt_enable(bcm, bcm->irq_savedstate); | 2908 | if (radio->initial_channel != 0xFF) |
2909 | bcm43xx_radio_selectchannel(bcm, radio->initial_channel, 0); | ||
2910 | } | ||
2954 | 2911 | ||
2912 | /* Don't enable MAC/IRQ here, as it will race with the IRQ handler. | ||
2913 | * We enable it later. | ||
2914 | */ | ||
2955 | bcm->current_core->initialized = 1; | 2915 | bcm->current_core->initialized = 1; |
2956 | out: | 2916 | out: |
2957 | return err; | 2917 | return err; |
@@ -3066,11 +3026,6 @@ out: | |||
3066 | return err; | 3026 | return err; |
3067 | } | 3027 | } |
3068 | 3028 | ||
3069 | static void bcm43xx_softmac_init(struct bcm43xx_private *bcm) | ||
3070 | { | ||
3071 | ieee80211softmac_start(bcm->net_dev); | ||
3072 | } | ||
3073 | |||
3074 | static void bcm43xx_periodic_every120sec(struct bcm43xx_private *bcm) | 3029 | static void bcm43xx_periodic_every120sec(struct bcm43xx_private *bcm) |
3075 | { | 3030 | { |
3076 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | 3031 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
@@ -3182,39 +3137,40 @@ static void bcm43xx_periodic_work_handler(void *d) | |||
3182 | /* Periodic work will take a long time, so we want it to | 3137 | /* Periodic work will take a long time, so we want it to |
3183 | * be preemtible. | 3138 | * be preemtible. |
3184 | */ | 3139 | */ |
3185 | bcm43xx_lock_irqonly(bcm, flags); | ||
3186 | netif_stop_queue(bcm->net_dev); | 3140 | netif_stop_queue(bcm->net_dev); |
3141 | synchronize_net(); | ||
3142 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
3143 | bcm43xx_mac_suspend(bcm); | ||
3187 | if (bcm43xx_using_pio(bcm)) | 3144 | if (bcm43xx_using_pio(bcm)) |
3188 | bcm43xx_pio_freeze_txqueues(bcm); | 3145 | bcm43xx_pio_freeze_txqueues(bcm); |
3189 | savedirqs = bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL); | 3146 | savedirqs = bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL); |
3190 | bcm43xx_unlock_irqonly(bcm, flags); | 3147 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
3191 | bcm43xx_lock_noirq(bcm); | 3148 | mutex_lock(&bcm->mutex); |
3192 | bcm43xx_synchronize_irq(bcm); | 3149 | bcm43xx_synchronize_irq(bcm); |
3193 | } else { | 3150 | } else { |
3194 | /* Periodic work should take short time, so we want low | 3151 | /* Periodic work should take short time, so we want low |
3195 | * locking overhead. | 3152 | * locking overhead. |
3196 | */ | 3153 | */ |
3197 | bcm43xx_lock_irqsafe(bcm, flags); | 3154 | mutex_lock(&bcm->mutex); |
3155 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
3198 | } | 3156 | } |
3199 | 3157 | ||
3200 | do_periodic_work(bcm); | 3158 | do_periodic_work(bcm); |
3201 | 3159 | ||
3202 | if (badness > BADNESS_LIMIT) { | 3160 | if (badness > BADNESS_LIMIT) { |
3203 | bcm43xx_lock_irqonly(bcm, flags); | 3161 | spin_lock_irqsave(&bcm->irq_lock, flags); |
3204 | if (likely(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED)) { | 3162 | if (likely(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED)) { |
3205 | tasklet_enable(&bcm->isr_tasklet); | 3163 | tasklet_enable(&bcm->isr_tasklet); |
3206 | bcm43xx_interrupt_enable(bcm, savedirqs); | 3164 | bcm43xx_interrupt_enable(bcm, savedirqs); |
3207 | if (bcm43xx_using_pio(bcm)) | 3165 | if (bcm43xx_using_pio(bcm)) |
3208 | bcm43xx_pio_thaw_txqueues(bcm); | 3166 | bcm43xx_pio_thaw_txqueues(bcm); |
3167 | bcm43xx_mac_enable(bcm); | ||
3209 | } | 3168 | } |
3210 | netif_wake_queue(bcm->net_dev); | 3169 | netif_wake_queue(bcm->net_dev); |
3211 | mmiowb(); | ||
3212 | bcm43xx_unlock_irqonly(bcm, flags); | ||
3213 | bcm43xx_unlock_noirq(bcm); | ||
3214 | } else { | ||
3215 | mmiowb(); | ||
3216 | bcm43xx_unlock_irqsafe(bcm, flags); | ||
3217 | } | 3170 | } |
3171 | mmiowb(); | ||
3172 | spin_unlock_irqrestore(&bcm->irq_lock, flags); | ||
3173 | mutex_unlock(&bcm->mutex); | ||
3218 | } | 3174 | } |
3219 | 3175 | ||
3220 | static void bcm43xx_periodic_tasks_delete(struct bcm43xx_private *bcm) | 3176 | static void bcm43xx_periodic_tasks_delete(struct bcm43xx_private *bcm) |
@@ -3243,9 +3199,9 @@ static int bcm43xx_rng_read(struct hwrng *rng, u32 *data) | |||
3243 | struct bcm43xx_private *bcm = (struct bcm43xx_private *)rng->priv; | 3199 | struct bcm43xx_private *bcm = (struct bcm43xx_private *)rng->priv; |
3244 | unsigned long flags; | 3200 | unsigned long flags; |
3245 | 3201 | ||
3246 | bcm43xx_lock_irqonly(bcm, flags); | 3202 | spin_lock_irqsave(&(bcm)->irq_lock, flags); |
3247 | *data = bcm43xx_read16(bcm, BCM43xx_MMIO_RNG); | 3203 | *data = bcm43xx_read16(bcm, BCM43xx_MMIO_RNG); |
3248 | bcm43xx_unlock_irqonly(bcm, flags); | 3204 | spin_unlock_irqrestore(&(bcm)->irq_lock, flags); |
3249 | 3205 | ||
3250 | return (sizeof(u16)); | 3206 | return (sizeof(u16)); |
3251 | } | 3207 | } |
@@ -3271,139 +3227,322 @@ static int bcm43xx_rng_init(struct bcm43xx_private *bcm) | |||
3271 | return err; | 3227 | return err; |
3272 | } | 3228 | } |
3273 | 3229 | ||
3274 | /* This is the opposite of bcm43xx_init_board() */ | 3230 | static int bcm43xx_shutdown_all_wireless_cores(struct bcm43xx_private *bcm) |
3275 | static void bcm43xx_free_board(struct bcm43xx_private *bcm) | ||
3276 | { | 3231 | { |
3232 | int ret = 0; | ||
3277 | int i, err; | 3233 | int i, err; |
3234 | struct bcm43xx_coreinfo *core; | ||
3278 | 3235 | ||
3279 | bcm43xx_lock_noirq(bcm); | 3236 | bcm43xx_set_status(bcm, BCM43xx_STAT_SHUTTINGDOWN); |
3237 | for (i = 0; i < bcm->nr_80211_available; i++) { | ||
3238 | core = &(bcm->core_80211[i]); | ||
3239 | assert(core->available); | ||
3240 | if (!core->initialized) | ||
3241 | continue; | ||
3242 | err = bcm43xx_switch_core(bcm, core); | ||
3243 | if (err) { | ||
3244 | dprintk(KERN_ERR PFX "shutdown_all_wireless_cores " | ||
3245 | "switch_core failed (%d)\n", err); | ||
3246 | ret = err; | ||
3247 | continue; | ||
3248 | } | ||
3249 | bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL); | ||
3250 | bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); /* dummy read */ | ||
3251 | bcm43xx_wireless_core_cleanup(bcm); | ||
3252 | if (core == bcm->active_80211_core) | ||
3253 | bcm->active_80211_core = NULL; | ||
3254 | } | ||
3255 | free_irq(bcm->irq, bcm); | ||
3256 | bcm43xx_set_status(bcm, BCM43xx_STAT_UNINIT); | ||
3257 | |||
3258 | return ret; | ||
3259 | } | ||
3260 | |||
3261 | /* This is the opposite of bcm43xx_init_board() */ | ||
3262 | static void bcm43xx_free_board(struct bcm43xx_private *bcm) | ||
3263 | { | ||
3280 | bcm43xx_sysfs_unregister(bcm); | 3264 | bcm43xx_sysfs_unregister(bcm); |
3281 | bcm43xx_periodic_tasks_delete(bcm); | 3265 | bcm43xx_periodic_tasks_delete(bcm); |
3282 | 3266 | ||
3283 | bcm43xx_set_status(bcm, BCM43xx_STAT_SHUTTINGDOWN); | 3267 | mutex_lock(&(bcm)->mutex); |
3268 | bcm43xx_shutdown_all_wireless_cores(bcm); | ||
3269 | bcm43xx_pctl_set_crystal(bcm, 0); | ||
3270 | mutex_unlock(&(bcm)->mutex); | ||
3271 | } | ||
3272 | |||
3273 | static void prepare_phydata_for_init(struct bcm43xx_phyinfo *phy) | ||
3274 | { | ||
3275 | phy->antenna_diversity = 0xFFFF; | ||
3276 | memset(phy->minlowsig, 0xFF, sizeof(phy->minlowsig)); | ||
3277 | memset(phy->minlowsigpos, 0, sizeof(phy->minlowsigpos)); | ||
3278 | |||
3279 | /* Flags */ | ||
3280 | phy->calibrated = 0; | ||
3281 | phy->is_locked = 0; | ||
3282 | |||
3283 | if (phy->_lo_pairs) { | ||
3284 | memset(phy->_lo_pairs, 0, | ||
3285 | sizeof(struct bcm43xx_lopair) * BCM43xx_LO_COUNT); | ||
3286 | } | ||
3287 | memset(phy->loopback_gain, 0, sizeof(phy->loopback_gain)); | ||
3288 | } | ||
3289 | |||
3290 | static void prepare_radiodata_for_init(struct bcm43xx_private *bcm, | ||
3291 | struct bcm43xx_radioinfo *radio) | ||
3292 | { | ||
3293 | int i; | ||
3294 | |||
3295 | /* Set default attenuation values. */ | ||
3296 | radio->baseband_atten = bcm43xx_default_baseband_attenuation(bcm); | ||
3297 | radio->radio_atten = bcm43xx_default_radio_attenuation(bcm); | ||
3298 | radio->txctl1 = bcm43xx_default_txctl1(bcm); | ||
3299 | radio->txctl2 = 0xFFFF; | ||
3300 | radio->txpwr_offset = 0; | ||
3301 | |||
3302 | /* NRSSI */ | ||
3303 | radio->nrssislope = 0; | ||
3304 | for (i = 0; i < ARRAY_SIZE(radio->nrssi); i++) | ||
3305 | radio->nrssi[i] = -1000; | ||
3306 | for (i = 0; i < ARRAY_SIZE(radio->nrssi_lt); i++) | ||
3307 | radio->nrssi_lt[i] = i; | ||
3308 | |||
3309 | radio->lofcal = 0xFFFF; | ||
3310 | radio->initval = 0xFFFF; | ||
3311 | |||
3312 | radio->aci_enable = 0; | ||
3313 | radio->aci_wlan_automatic = 0; | ||
3314 | radio->aci_hw_rssi = 0; | ||
3315 | } | ||
3316 | |||
3317 | static void prepare_priv_for_init(struct bcm43xx_private *bcm) | ||
3318 | { | ||
3319 | int i; | ||
3320 | struct bcm43xx_coreinfo *core; | ||
3321 | struct bcm43xx_coreinfo_80211 *wlext; | ||
3284 | 3322 | ||
3285 | bcm43xx_rng_exit(bcm); | 3323 | assert(!bcm->active_80211_core); |
3324 | |||
3325 | bcm43xx_set_status(bcm, BCM43xx_STAT_INITIALIZING); | ||
3326 | |||
3327 | /* Flags */ | ||
3328 | bcm->was_initialized = 0; | ||
3329 | bcm->reg124_set_0x4 = 0; | ||
3330 | |||
3331 | /* Stats */ | ||
3332 | memset(&bcm->stats, 0, sizeof(bcm->stats)); | ||
3333 | |||
3334 | /* Wireless core data */ | ||
3286 | for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) { | 3335 | for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) { |
3287 | if (!bcm->core_80211[i].available) | 3336 | core = &(bcm->core_80211[i]); |
3288 | continue; | 3337 | wlext = core->priv; |
3289 | if (!bcm->core_80211[i].initialized) | 3338 | |
3339 | if (!core->available) | ||
3290 | continue; | 3340 | continue; |
3341 | assert(wlext == &(bcm->core_80211_ext[i])); | ||
3291 | 3342 | ||
3292 | err = bcm43xx_switch_core(bcm, &bcm->core_80211[i]); | 3343 | prepare_phydata_for_init(&wlext->phy); |
3293 | assert(err == 0); | 3344 | prepare_radiodata_for_init(bcm, &wlext->radio); |
3294 | bcm43xx_wireless_core_cleanup(bcm); | ||
3295 | } | 3345 | } |
3296 | 3346 | ||
3297 | bcm43xx_pctl_set_crystal(bcm, 0); | 3347 | /* IRQ related flags */ |
3348 | bcm->irq_reason = 0; | ||
3349 | memset(bcm->dma_reason, 0, sizeof(bcm->dma_reason)); | ||
3350 | bcm->irq_savedstate = BCM43xx_IRQ_INITIAL; | ||
3298 | 3351 | ||
3299 | bcm43xx_set_status(bcm, BCM43xx_STAT_UNINIT); | 3352 | /* Noise calculation context */ |
3300 | bcm43xx_unlock_noirq(bcm); | 3353 | memset(&bcm->noisecalc, 0, sizeof(bcm->noisecalc)); |
3354 | |||
3355 | /* Periodic work context */ | ||
3356 | bcm->periodic_state = 0; | ||
3301 | } | 3357 | } |
3302 | 3358 | ||
3303 | static int bcm43xx_init_board(struct bcm43xx_private *bcm) | 3359 | static int wireless_core_up(struct bcm43xx_private *bcm, |
3360 | int active_wlcore) | ||
3361 | { | ||
3362 | int err; | ||
3363 | |||
3364 | if (!bcm43xx_core_enabled(bcm)) | ||
3365 | bcm43xx_wireless_core_reset(bcm, 1); | ||
3366 | if (!active_wlcore) | ||
3367 | bcm43xx_wireless_core_mark_inactive(bcm); | ||
3368 | err = bcm43xx_wireless_core_init(bcm, active_wlcore); | ||
3369 | if (err) | ||
3370 | goto out; | ||
3371 | if (!active_wlcore) | ||
3372 | bcm43xx_radio_turn_off(bcm); | ||
3373 | out: | ||
3374 | return err; | ||
3375 | } | ||
3376 | |||
3377 | /* Select and enable the "to be used" wireless core. | ||
3378 | * Locking: bcm->mutex must be aquired before calling this. | ||
3379 | * bcm->irq_lock must not be aquired. | ||
3380 | */ | ||
3381 | int bcm43xx_select_wireless_core(struct bcm43xx_private *bcm, | ||
3382 | int phytype) | ||
3304 | { | 3383 | { |
3305 | int i, err; | 3384 | int i, err; |
3306 | int connect_phy; | 3385 | struct bcm43xx_coreinfo *active_core = NULL; |
3386 | struct bcm43xx_coreinfo_80211 *active_wlext = NULL; | ||
3387 | struct bcm43xx_coreinfo *core; | ||
3388 | struct bcm43xx_coreinfo_80211 *wlext; | ||
3389 | int adjust_active_sbtmstatelow = 0; | ||
3307 | 3390 | ||
3308 | might_sleep(); | 3391 | might_sleep(); |
3309 | 3392 | ||
3310 | bcm43xx_lock_noirq(bcm); | 3393 | if (phytype < 0) { |
3311 | bcm43xx_set_status(bcm, BCM43xx_STAT_INITIALIZING); | 3394 | /* If no phytype is requested, select the first core. */ |
3395 | assert(bcm->core_80211[0].available); | ||
3396 | wlext = bcm->core_80211[0].priv; | ||
3397 | phytype = wlext->phy.type; | ||
3398 | } | ||
3399 | /* Find the requested core. */ | ||
3400 | for (i = 0; i < bcm->nr_80211_available; i++) { | ||
3401 | core = &(bcm->core_80211[i]); | ||
3402 | wlext = core->priv; | ||
3403 | if (wlext->phy.type == phytype) { | ||
3404 | active_core = core; | ||
3405 | active_wlext = wlext; | ||
3406 | break; | ||
3407 | } | ||
3408 | } | ||
3409 | if (!active_core) | ||
3410 | return -ESRCH; /* No such PHYTYPE on this board. */ | ||
3411 | |||
3412 | if (bcm->active_80211_core) { | ||
3413 | /* We already selected a wl core in the past. | ||
3414 | * So first clean up everything. | ||
3415 | */ | ||
3416 | dprintk(KERN_INFO PFX "select_wireless_core: cleanup\n"); | ||
3417 | ieee80211softmac_stop(bcm->net_dev); | ||
3418 | bcm43xx_set_status(bcm, BCM43xx_STAT_INITIALIZED); | ||
3419 | err = bcm43xx_disable_interrupts_sync(bcm); | ||
3420 | assert(!err); | ||
3421 | tasklet_enable(&bcm->isr_tasklet); | ||
3422 | err = bcm43xx_shutdown_all_wireless_cores(bcm); | ||
3423 | if (err) | ||
3424 | goto error; | ||
3425 | /* Ok, everything down, continue to re-initialize. */ | ||
3426 | bcm43xx_set_status(bcm, BCM43xx_STAT_INITIALIZING); | ||
3427 | } | ||
3428 | |||
3429 | /* Reset all data structures. */ | ||
3430 | prepare_priv_for_init(bcm); | ||
3312 | 3431 | ||
3313 | err = bcm43xx_pctl_set_crystal(bcm, 1); | ||
3314 | if (err) | ||
3315 | goto out; | ||
3316 | err = bcm43xx_pctl_init(bcm); | ||
3317 | if (err) | ||
3318 | goto err_crystal_off; | ||
3319 | err = bcm43xx_pctl_set_clock(bcm, BCM43xx_PCTL_CLK_FAST); | 3432 | err = bcm43xx_pctl_set_clock(bcm, BCM43xx_PCTL_CLK_FAST); |
3320 | if (err) | 3433 | if (err) |
3321 | goto err_crystal_off; | 3434 | goto error; |
3322 | 3435 | ||
3323 | tasklet_enable(&bcm->isr_tasklet); | 3436 | /* Mark all unused cores "inactive". */ |
3324 | for (i = 0; i < bcm->nr_80211_available; i++) { | 3437 | for (i = 0; i < bcm->nr_80211_available; i++) { |
3325 | err = bcm43xx_switch_core(bcm, &bcm->core_80211[i]); | 3438 | core = &(bcm->core_80211[i]); |
3326 | assert(err != -ENODEV); | 3439 | wlext = core->priv; |
3327 | if (err) | ||
3328 | goto err_80211_unwind; | ||
3329 | 3440 | ||
3330 | /* Enable the selected wireless core. | 3441 | if (core == active_core) |
3331 | * Connect PHY only on the first core. | 3442 | continue; |
3332 | */ | 3443 | err = bcm43xx_switch_core(bcm, core); |
3333 | if (!bcm43xx_core_enabled(bcm)) { | 3444 | if (err) { |
3334 | if (bcm->nr_80211_available == 1) { | 3445 | dprintk(KERN_ERR PFX "Could not switch to inactive " |
3335 | connect_phy = bcm43xx_current_phy(bcm)->connected; | 3446 | "802.11 core (%d)\n", err); |
3336 | } else { | 3447 | goto error; |
3337 | if (i == 0) | ||
3338 | connect_phy = 1; | ||
3339 | else | ||
3340 | connect_phy = 0; | ||
3341 | } | ||
3342 | bcm43xx_wireless_core_reset(bcm, connect_phy); | ||
3343 | } | 3448 | } |
3449 | err = wireless_core_up(bcm, 0); | ||
3450 | if (err) { | ||
3451 | dprintk(KERN_ERR PFX "core_up for inactive 802.11 core " | ||
3452 | "failed (%d)\n", err); | ||
3453 | goto error; | ||
3454 | } | ||
3455 | adjust_active_sbtmstatelow = 1; | ||
3456 | } | ||
3344 | 3457 | ||
3345 | if (i != 0) | 3458 | /* Now initialize the active 802.11 core. */ |
3346 | bcm43xx_wireless_core_mark_inactive(bcm, &bcm->core_80211[0]); | 3459 | err = bcm43xx_switch_core(bcm, active_core); |
3347 | 3460 | if (err) { | |
3348 | err = bcm43xx_wireless_core_init(bcm); | 3461 | dprintk(KERN_ERR PFX "Could not switch to active " |
3349 | if (err) | 3462 | "802.11 core (%d)\n", err); |
3350 | goto err_80211_unwind; | 3463 | goto error; |
3464 | } | ||
3465 | if (adjust_active_sbtmstatelow && | ||
3466 | active_wlext->phy.type == BCM43xx_PHYTYPE_G) { | ||
3467 | u32 sbtmstatelow; | ||
3351 | 3468 | ||
3352 | if (i != 0) { | 3469 | sbtmstatelow = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATELOW); |
3353 | bcm43xx_mac_suspend(bcm); | 3470 | sbtmstatelow |= 0x20000000; |
3354 | bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL); | 3471 | bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, sbtmstatelow); |
3355 | bcm43xx_radio_turn_off(bcm); | ||
3356 | } | ||
3357 | } | 3472 | } |
3358 | bcm->active_80211_core = &bcm->core_80211[0]; | 3473 | err = wireless_core_up(bcm, 1); |
3359 | if (bcm->nr_80211_available >= 2) { | 3474 | if (err) { |
3360 | bcm43xx_switch_core(bcm, &bcm->core_80211[0]); | 3475 | dprintk(KERN_ERR PFX "core_up for active 802.11 core " |
3361 | bcm43xx_mac_enable(bcm); | 3476 | "failed (%d)\n", err); |
3477 | goto error; | ||
3362 | } | 3478 | } |
3363 | err = bcm43xx_rng_init(bcm); | 3479 | err = bcm43xx_pctl_set_clock(bcm, BCM43xx_PCTL_CLK_DYNAMIC); |
3364 | if (err) | 3480 | if (err) |
3365 | goto err_80211_unwind; | 3481 | goto error; |
3482 | bcm->active_80211_core = active_core; | ||
3483 | |||
3366 | bcm43xx_macfilter_clear(bcm, BCM43xx_MACFILTER_ASSOC); | 3484 | bcm43xx_macfilter_clear(bcm, BCM43xx_MACFILTER_ASSOC); |
3367 | bcm43xx_macfilter_set(bcm, BCM43xx_MACFILTER_SELF, (u8 *)(bcm->net_dev->dev_addr)); | 3485 | bcm43xx_macfilter_set(bcm, BCM43xx_MACFILTER_SELF, (u8 *)(bcm->net_dev->dev_addr)); |
3368 | dprintk(KERN_INFO PFX "80211 cores initialized\n"); | ||
3369 | bcm43xx_security_init(bcm); | 3486 | bcm43xx_security_init(bcm); |
3370 | bcm43xx_softmac_init(bcm); | 3487 | ieee80211softmac_start(bcm->net_dev); |
3371 | 3488 | ||
3372 | bcm43xx_pctl_set_clock(bcm, BCM43xx_PCTL_CLK_DYNAMIC); | 3489 | /* Let's go! Be careful after enabling the IRQs. |
3490 | * Don't switch cores, for example. | ||
3491 | */ | ||
3492 | bcm43xx_mac_enable(bcm); | ||
3493 | bcm43xx_set_status(bcm, BCM43xx_STAT_INITIALIZED); | ||
3494 | err = bcm43xx_initialize_irq(bcm); | ||
3495 | if (err) | ||
3496 | goto error; | ||
3497 | bcm43xx_interrupt_enable(bcm, bcm->irq_savedstate); | ||
3373 | 3498 | ||
3374 | if (bcm43xx_current_radio(bcm)->initial_channel != 0xFF) { | 3499 | dprintk(KERN_INFO PFX "Selected 802.11 core (phytype %d)\n", |
3375 | bcm43xx_mac_suspend(bcm); | 3500 | active_wlext->phy.type); |
3376 | bcm43xx_radio_selectchannel(bcm, bcm43xx_current_radio(bcm)->initial_channel, 0); | ||
3377 | bcm43xx_mac_enable(bcm); | ||
3378 | } | ||
3379 | 3501 | ||
3380 | /* Initialization of the board is done. Flag it as such. */ | 3502 | return 0; |
3381 | bcm43xx_set_status(bcm, BCM43xx_STAT_INITIALIZED); | 3503 | |
3504 | error: | ||
3505 | bcm43xx_set_status(bcm, BCM43xx_STAT_UNINIT); | ||
3506 | bcm43xx_pctl_set_clock(bcm, BCM43xx_PCTL_CLK_SLOW); | ||
3507 | return err; | ||
3508 | } | ||
3509 | |||
3510 | static int bcm43xx_init_board(struct bcm43xx_private *bcm) | ||
3511 | { | ||
3512 | int err; | ||
3513 | |||
3514 | mutex_lock(&(bcm)->mutex); | ||
3515 | |||
3516 | tasklet_enable(&bcm->isr_tasklet); | ||
3517 | err = bcm43xx_pctl_set_crystal(bcm, 1); | ||
3518 | if (err) | ||
3519 | goto err_tasklet; | ||
3520 | err = bcm43xx_pctl_init(bcm); | ||
3521 | if (err) | ||
3522 | goto err_crystal_off; | ||
3523 | err = bcm43xx_select_wireless_core(bcm, -1); | ||
3524 | if (err) | ||
3525 | goto err_crystal_off; | ||
3382 | 3526 | ||
3383 | bcm43xx_periodic_tasks_setup(bcm); | 3527 | bcm43xx_periodic_tasks_setup(bcm); |
3384 | bcm43xx_sysfs_register(bcm); | 3528 | err = bcm43xx_sysfs_register(bcm); |
3385 | //FIXME: check for bcm43xx_sysfs_register failure. This function is a bit messy regarding unwinding, though... | 3529 | if (err) |
3530 | goto err_wlshutdown; | ||
3386 | 3531 | ||
3387 | /*FIXME: This should be handled by softmac instead. */ | 3532 | /*FIXME: This should be handled by softmac instead. */ |
3388 | schedule_work(&bcm->softmac->associnfo.work); | 3533 | schedule_work(&bcm->softmac->associnfo.work); |
3389 | 3534 | ||
3390 | assert(err == 0); | ||
3391 | out: | 3535 | out: |
3392 | bcm43xx_unlock_noirq(bcm); | 3536 | mutex_unlock(&(bcm)->mutex); |
3393 | 3537 | ||
3394 | return err; | 3538 | return err; |
3395 | 3539 | ||
3396 | err_80211_unwind: | 3540 | err_wlshutdown: |
3397 | tasklet_disable(&bcm->isr_tasklet); | 3541 | bcm43xx_shutdown_all_wireless_cores(bcm); |
3398 | /* unwind all 80211 initialization */ | ||
3399 | for (i = 0; i < bcm->nr_80211_available; i++) { | ||
3400 | if (!bcm->core_80211[i].initialized) | ||
3401 | continue; | ||
3402 | bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL); | ||
3403 | bcm43xx_wireless_core_cleanup(bcm); | ||
3404 | } | ||
3405 | err_crystal_off: | 3542 | err_crystal_off: |
3406 | bcm43xx_pctl_set_crystal(bcm, 0); | 3543 | bcm43xx_pctl_set_crystal(bcm, 0); |
3544 | err_tasklet: | ||
3545 | tasklet_disable(&bcm->isr_tasklet); | ||
3407 | goto out; | 3546 | goto out; |
3408 | } | 3547 | } |
3409 | 3548 | ||
@@ -3647,7 +3786,8 @@ static void bcm43xx_ieee80211_set_chan(struct net_device *net_dev, | |||
3647 | struct bcm43xx_radioinfo *radio; | 3786 | struct bcm43xx_radioinfo *radio; |
3648 | unsigned long flags; | 3787 | unsigned long flags; |
3649 | 3788 | ||
3650 | bcm43xx_lock_irqsafe(bcm, flags); | 3789 | mutex_lock(&bcm->mutex); |
3790 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
3651 | if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) { | 3791 | if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) { |
3652 | bcm43xx_mac_suspend(bcm); | 3792 | bcm43xx_mac_suspend(bcm); |
3653 | bcm43xx_radio_selectchannel(bcm, channel, 0); | 3793 | bcm43xx_radio_selectchannel(bcm, channel, 0); |
@@ -3656,7 +3796,8 @@ static void bcm43xx_ieee80211_set_chan(struct net_device *net_dev, | |||
3656 | radio = bcm43xx_current_radio(bcm); | 3796 | radio = bcm43xx_current_radio(bcm); |
3657 | radio->initial_channel = channel; | 3797 | radio->initial_channel = channel; |
3658 | } | 3798 | } |
3659 | bcm43xx_unlock_irqsafe(bcm, flags); | 3799 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
3800 | mutex_unlock(&bcm->mutex); | ||
3660 | } | 3801 | } |
3661 | 3802 | ||
3662 | /* set_security() callback in struct ieee80211_device */ | 3803 | /* set_security() callback in struct ieee80211_device */ |
@@ -3670,7 +3811,8 @@ static void bcm43xx_ieee80211_set_security(struct net_device *net_dev, | |||
3670 | 3811 | ||
3671 | dprintk(KERN_INFO PFX "set security called"); | 3812 | dprintk(KERN_INFO PFX "set security called"); |
3672 | 3813 | ||
3673 | bcm43xx_lock_irqsafe(bcm, flags); | 3814 | mutex_lock(&bcm->mutex); |
3815 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
3674 | 3816 | ||
3675 | for (keyidx = 0; keyidx<WEP_KEYS; keyidx++) | 3817 | for (keyidx = 0; keyidx<WEP_KEYS; keyidx++) |
3676 | if (sec->flags & (1<<keyidx)) { | 3818 | if (sec->flags & (1<<keyidx)) { |
@@ -3739,7 +3881,8 @@ static void bcm43xx_ieee80211_set_security(struct net_device *net_dev, | |||
3739 | } else | 3881 | } else |
3740 | bcm43xx_clear_keys(bcm); | 3882 | bcm43xx_clear_keys(bcm); |
3741 | } | 3883 | } |
3742 | bcm43xx_unlock_irqsafe(bcm, flags); | 3884 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
3885 | mutex_unlock(&bcm->mutex); | ||
3743 | } | 3886 | } |
3744 | 3887 | ||
3745 | /* hard_start_xmit() callback in struct ieee80211_device */ | 3888 | /* hard_start_xmit() callback in struct ieee80211_device */ |
@@ -3751,10 +3894,10 @@ static int bcm43xx_ieee80211_hard_start_xmit(struct ieee80211_txb *txb, | |||
3751 | int err = -ENODEV; | 3894 | int err = -ENODEV; |
3752 | unsigned long flags; | 3895 | unsigned long flags; |
3753 | 3896 | ||
3754 | bcm43xx_lock_irqonly(bcm, flags); | 3897 | spin_lock_irqsave(&bcm->irq_lock, flags); |
3755 | if (likely(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED)) | 3898 | if (likely(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED)) |
3756 | err = bcm43xx_tx(bcm, txb); | 3899 | err = bcm43xx_tx(bcm, txb); |
3757 | bcm43xx_unlock_irqonly(bcm, flags); | 3900 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
3758 | 3901 | ||
3759 | return err; | 3902 | return err; |
3760 | } | 3903 | } |
@@ -3769,9 +3912,9 @@ static void bcm43xx_net_tx_timeout(struct net_device *net_dev) | |||
3769 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 3912 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
3770 | unsigned long flags; | 3913 | unsigned long flags; |
3771 | 3914 | ||
3772 | bcm43xx_lock_irqonly(bcm, flags); | 3915 | spin_lock_irqsave(&bcm->irq_lock, flags); |
3773 | bcm43xx_controller_restart(bcm, "TX timeout"); | 3916 | bcm43xx_controller_restart(bcm, "TX timeout"); |
3774 | bcm43xx_unlock_irqonly(bcm, flags); | 3917 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
3775 | } | 3918 | } |
3776 | 3919 | ||
3777 | #ifdef CONFIG_NET_POLL_CONTROLLER | 3920 | #ifdef CONFIG_NET_POLL_CONTROLLER |
@@ -3781,7 +3924,8 @@ static void bcm43xx_net_poll_controller(struct net_device *net_dev) | |||
3781 | unsigned long flags; | 3924 | unsigned long flags; |
3782 | 3925 | ||
3783 | local_irq_save(flags); | 3926 | local_irq_save(flags); |
3784 | bcm43xx_interrupt_handler(bcm->irq, bcm, NULL); | 3927 | if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) |
3928 | bcm43xx_interrupt_handler(bcm->irq, bcm, NULL); | ||
3785 | local_irq_restore(flags); | 3929 | local_irq_restore(flags); |
3786 | } | 3930 | } |
3787 | #endif /* CONFIG_NET_POLL_CONTROLLER */ | 3931 | #endif /* CONFIG_NET_POLL_CONTROLLER */ |
@@ -3799,7 +3943,7 @@ static int bcm43xx_net_stop(struct net_device *net_dev) | |||
3799 | int err; | 3943 | int err; |
3800 | 3944 | ||
3801 | ieee80211softmac_stop(net_dev); | 3945 | ieee80211softmac_stop(net_dev); |
3802 | err = bcm43xx_disable_interrupts_sync(bcm, NULL); | 3946 | err = bcm43xx_disable_interrupts_sync(bcm); |
3803 | assert(!err); | 3947 | assert(!err); |
3804 | bcm43xx_free_board(bcm); | 3948 | bcm43xx_free_board(bcm); |
3805 | 3949 | ||
@@ -3818,10 +3962,12 @@ static int bcm43xx_init_private(struct bcm43xx_private *bcm, | |||
3818 | bcm->softmac->set_channel = bcm43xx_ieee80211_set_chan; | 3962 | bcm->softmac->set_channel = bcm43xx_ieee80211_set_chan; |
3819 | 3963 | ||
3820 | bcm->irq_savedstate = BCM43xx_IRQ_INITIAL; | 3964 | bcm->irq_savedstate = BCM43xx_IRQ_INITIAL; |
3965 | bcm->mac_suspended = 1; | ||
3821 | bcm->pci_dev = pci_dev; | 3966 | bcm->pci_dev = pci_dev; |
3822 | bcm->net_dev = net_dev; | 3967 | bcm->net_dev = net_dev; |
3823 | bcm->bad_frames_preempt = modparam_bad_frames_preempt; | 3968 | bcm->bad_frames_preempt = modparam_bad_frames_preempt; |
3824 | spin_lock_init(&bcm->irq_lock); | 3969 | spin_lock_init(&bcm->irq_lock); |
3970 | spin_lock_init(&bcm->leds_lock); | ||
3825 | mutex_init(&bcm->mutex); | 3971 | mutex_init(&bcm->mutex); |
3826 | tasklet_init(&bcm->isr_tasklet, | 3972 | tasklet_init(&bcm->isr_tasklet, |
3827 | (void (*)(unsigned long))bcm43xx_interrupt_tasklet, | 3973 | (void (*)(unsigned long))bcm43xx_interrupt_tasklet, |
@@ -3940,7 +4086,6 @@ static void __devexit bcm43xx_remove_one(struct pci_dev *pdev) | |||
3940 | bcm43xx_debugfs_remove_device(bcm); | 4086 | bcm43xx_debugfs_remove_device(bcm); |
3941 | unregister_netdev(net_dev); | 4087 | unregister_netdev(net_dev); |
3942 | bcm43xx_detach_board(bcm); | 4088 | bcm43xx_detach_board(bcm); |
3943 | assert(bcm->ucode == NULL); | ||
3944 | free_ieee80211softmac(net_dev); | 4089 | free_ieee80211softmac(net_dev); |
3945 | } | 4090 | } |
3946 | 4091 | ||
@@ -3950,47 +4095,25 @@ static void __devexit bcm43xx_remove_one(struct pci_dev *pdev) | |||
3950 | static void bcm43xx_chip_reset(void *_bcm) | 4095 | static void bcm43xx_chip_reset(void *_bcm) |
3951 | { | 4096 | { |
3952 | struct bcm43xx_private *bcm = _bcm; | 4097 | struct bcm43xx_private *bcm = _bcm; |
3953 | struct net_device *net_dev = bcm->net_dev; | 4098 | struct bcm43xx_phyinfo *phy; |
3954 | struct pci_dev *pci_dev = bcm->pci_dev; | ||
3955 | int err; | 4099 | int err; |
3956 | int was_initialized = (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED); | ||
3957 | 4100 | ||
3958 | netif_stop_queue(bcm->net_dev); | 4101 | mutex_lock(&(bcm)->mutex); |
3959 | tasklet_disable(&bcm->isr_tasklet); | 4102 | phy = bcm43xx_current_phy(bcm); |
4103 | err = bcm43xx_select_wireless_core(bcm, phy->type); | ||
4104 | mutex_unlock(&(bcm)->mutex); | ||
3960 | 4105 | ||
3961 | bcm->firmware_norelease = 1; | 4106 | printk(KERN_ERR PFX "Controller restart%s\n", |
3962 | if (was_initialized) | 4107 | (err == 0) ? "ed" : " failed"); |
3963 | bcm43xx_free_board(bcm); | ||
3964 | bcm->firmware_norelease = 0; | ||
3965 | bcm43xx_detach_board(bcm); | ||
3966 | err = bcm43xx_init_private(bcm, net_dev, pci_dev); | ||
3967 | if (err) | ||
3968 | goto failure; | ||
3969 | err = bcm43xx_attach_board(bcm); | ||
3970 | if (err) | ||
3971 | goto failure; | ||
3972 | if (was_initialized) { | ||
3973 | err = bcm43xx_init_board(bcm); | ||
3974 | if (err) | ||
3975 | goto failure; | ||
3976 | } | ||
3977 | netif_wake_queue(bcm->net_dev); | ||
3978 | printk(KERN_INFO PFX "Controller restarted\n"); | ||
3979 | |||
3980 | return; | ||
3981 | failure: | ||
3982 | printk(KERN_ERR PFX "Controller restart failed\n"); | ||
3983 | } | 4108 | } |
3984 | 4109 | ||
3985 | /* Hard-reset the chip. | 4110 | /* Hard-reset the chip. |
3986 | * This can be called from interrupt or process context. | 4111 | * This can be called from interrupt or process context. |
3987 | * Make sure to _not_ re-enable device interrupts after this has been called. | 4112 | */ |
3988 | */ | ||
3989 | void bcm43xx_controller_restart(struct bcm43xx_private *bcm, const char *reason) | 4113 | void bcm43xx_controller_restart(struct bcm43xx_private *bcm, const char *reason) |
3990 | { | 4114 | { |
4115 | assert(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED); | ||
3991 | bcm43xx_set_status(bcm, BCM43xx_STAT_RESTARTING); | 4116 | bcm43xx_set_status(bcm, BCM43xx_STAT_RESTARTING); |
3992 | bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL); | ||
3993 | bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD); /* dummy read */ | ||
3994 | printk(KERN_ERR PFX "Controller RESET (%s) ...\n", reason); | 4117 | printk(KERN_ERR PFX "Controller RESET (%s) ...\n", reason); |
3995 | INIT_WORK(&bcm->restart_work, bcm43xx_chip_reset, bcm); | 4118 | INIT_WORK(&bcm->restart_work, bcm43xx_chip_reset, bcm); |
3996 | schedule_work(&bcm->restart_work); | 4119 | schedule_work(&bcm->restart_work); |
@@ -4002,21 +4125,16 @@ static int bcm43xx_suspend(struct pci_dev *pdev, pm_message_t state) | |||
4002 | { | 4125 | { |
4003 | struct net_device *net_dev = pci_get_drvdata(pdev); | 4126 | struct net_device *net_dev = pci_get_drvdata(pdev); |
4004 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 4127 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
4005 | unsigned long flags; | 4128 | int err; |
4006 | int try_to_shutdown = 0, err; | ||
4007 | 4129 | ||
4008 | dprintk(KERN_INFO PFX "Suspending...\n"); | 4130 | dprintk(KERN_INFO PFX "Suspending...\n"); |
4009 | 4131 | ||
4010 | bcm43xx_lock_irqsafe(bcm, flags); | ||
4011 | bcm->was_initialized = (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED); | ||
4012 | if (bcm->was_initialized) | ||
4013 | try_to_shutdown = 1; | ||
4014 | bcm43xx_unlock_irqsafe(bcm, flags); | ||
4015 | |||
4016 | netif_device_detach(net_dev); | 4132 | netif_device_detach(net_dev); |
4017 | if (try_to_shutdown) { | 4133 | bcm->was_initialized = 0; |
4134 | if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) { | ||
4135 | bcm->was_initialized = 1; | ||
4018 | ieee80211softmac_stop(net_dev); | 4136 | ieee80211softmac_stop(net_dev); |
4019 | err = bcm43xx_disable_interrupts_sync(bcm, &bcm->irq_savedstate); | 4137 | err = bcm43xx_disable_interrupts_sync(bcm); |
4020 | if (unlikely(err)) { | 4138 | if (unlikely(err)) { |
4021 | dprintk(KERN_ERR PFX "Suspend failed.\n"); | 4139 | dprintk(KERN_ERR PFX "Suspend failed.\n"); |
4022 | return -EAGAIN; | 4140 | return -EAGAIN; |
@@ -4049,17 +4167,14 @@ static int bcm43xx_resume(struct pci_dev *pdev) | |||
4049 | pci_restore_state(pdev); | 4167 | pci_restore_state(pdev); |
4050 | 4168 | ||
4051 | bcm43xx_chipset_attach(bcm); | 4169 | bcm43xx_chipset_attach(bcm); |
4052 | if (bcm->was_initialized) { | 4170 | if (bcm->was_initialized) |
4053 | bcm->irq_savedstate = BCM43xx_IRQ_INITIAL; | ||
4054 | err = bcm43xx_init_board(bcm); | 4171 | err = bcm43xx_init_board(bcm); |
4055 | } | ||
4056 | if (err) { | 4172 | if (err) { |
4057 | printk(KERN_ERR PFX "Resume failed!\n"); | 4173 | printk(KERN_ERR PFX "Resume failed!\n"); |
4058 | return err; | 4174 | return err; |
4059 | } | 4175 | } |
4060 | |||
4061 | netif_device_attach(net_dev); | 4176 | netif_device_attach(net_dev); |
4062 | 4177 | ||
4063 | dprintk(KERN_INFO PFX "Device resumed.\n"); | 4178 | dprintk(KERN_INFO PFX "Device resumed.\n"); |
4064 | 4179 | ||
4065 | return 0; | 4180 | return 0; |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.h b/drivers/net/wireless/bcm43xx/bcm43xx_main.h index 116493671f88..505c86e2007a 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.h +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.h | |||
@@ -133,6 +133,9 @@ void bcm43xx_dummy_transmission(struct bcm43xx_private *bcm); | |||
133 | 133 | ||
134 | int bcm43xx_switch_core(struct bcm43xx_private *bcm, struct bcm43xx_coreinfo *new_core); | 134 | int bcm43xx_switch_core(struct bcm43xx_private *bcm, struct bcm43xx_coreinfo *new_core); |
135 | 135 | ||
136 | int bcm43xx_select_wireless_core(struct bcm43xx_private *bcm, | ||
137 | int phytype); | ||
138 | |||
136 | void bcm43xx_wireless_core_reset(struct bcm43xx_private *bcm, int connect_phy); | 139 | void bcm43xx_wireless_core_reset(struct bcm43xx_private *bcm, int connect_phy); |
137 | 140 | ||
138 | void bcm43xx_mac_suspend(struct bcm43xx_private *bcm); | 141 | void bcm43xx_mac_suspend(struct bcm43xx_private *bcm); |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c index f8200deecc8a..eafd0f662686 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c | |||
@@ -81,6 +81,16 @@ static const s8 bcm43xx_tssi2dbm_g_table[] = { | |||
81 | static void bcm43xx_phy_initg(struct bcm43xx_private *bcm); | 81 | static void bcm43xx_phy_initg(struct bcm43xx_private *bcm); |
82 | 82 | ||
83 | 83 | ||
84 | static inline | ||
85 | void bcm43xx_voluntary_preempt(void) | ||
86 | { | ||
87 | assert(!in_atomic() && !in_irq() && | ||
88 | !in_interrupt() && !irqs_disabled()); | ||
89 | #ifndef CONFIG_PREEMPT | ||
90 | cond_resched(); | ||
91 | #endif /* CONFIG_PREEMPT */ | ||
92 | } | ||
93 | |||
84 | void bcm43xx_raw_phy_lock(struct bcm43xx_private *bcm) | 94 | void bcm43xx_raw_phy_lock(struct bcm43xx_private *bcm) |
85 | { | 95 | { |
86 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | 96 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
@@ -133,22 +143,14 @@ void bcm43xx_phy_write(struct bcm43xx_private *bcm, u16 offset, u16 val) | |||
133 | void bcm43xx_phy_calibrate(struct bcm43xx_private *bcm) | 143 | void bcm43xx_phy_calibrate(struct bcm43xx_private *bcm) |
134 | { | 144 | { |
135 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | 145 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
136 | unsigned long flags; | ||
137 | 146 | ||
138 | bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD); /* Dummy read. */ | 147 | bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD); /* Dummy read. */ |
139 | if (phy->calibrated) | 148 | if (phy->calibrated) |
140 | return; | 149 | return; |
141 | if (phy->type == BCM43xx_PHYTYPE_G && phy->rev == 1) { | 150 | if (phy->type == BCM43xx_PHYTYPE_G && phy->rev == 1) { |
142 | /* We do not want to be preempted while calibrating | ||
143 | * the hardware. | ||
144 | */ | ||
145 | local_irq_save(flags); | ||
146 | |||
147 | bcm43xx_wireless_core_reset(bcm, 0); | 151 | bcm43xx_wireless_core_reset(bcm, 0); |
148 | bcm43xx_phy_initg(bcm); | 152 | bcm43xx_phy_initg(bcm); |
149 | bcm43xx_wireless_core_reset(bcm, 1); | 153 | bcm43xx_wireless_core_reset(bcm, 1); |
150 | |||
151 | local_irq_restore(flags); | ||
152 | } | 154 | } |
153 | phy->calibrated = 1; | 155 | phy->calibrated = 1; |
154 | } | 156 | } |
@@ -1299,7 +1301,9 @@ static u16 bcm43xx_phy_lo_b_r15_loop(struct bcm43xx_private *bcm) | |||
1299 | { | 1301 | { |
1300 | int i; | 1302 | int i; |
1301 | u16 ret = 0; | 1303 | u16 ret = 0; |
1304 | unsigned long flags; | ||
1302 | 1305 | ||
1306 | local_irq_save(flags); | ||
1303 | for (i = 0; i < 10; i++){ | 1307 | for (i = 0; i < 10; i++){ |
1304 | bcm43xx_phy_write(bcm, 0x0015, 0xAFA0); | 1308 | bcm43xx_phy_write(bcm, 0x0015, 0xAFA0); |
1305 | udelay(1); | 1309 | udelay(1); |
@@ -1309,6 +1313,8 @@ static u16 bcm43xx_phy_lo_b_r15_loop(struct bcm43xx_private *bcm) | |||
1309 | udelay(40); | 1313 | udelay(40); |
1310 | ret += bcm43xx_phy_read(bcm, 0x002C); | 1314 | ret += bcm43xx_phy_read(bcm, 0x002C); |
1311 | } | 1315 | } |
1316 | local_irq_restore(flags); | ||
1317 | bcm43xx_voluntary_preempt(); | ||
1312 | 1318 | ||
1313 | return ret; | 1319 | return ret; |
1314 | } | 1320 | } |
@@ -1435,6 +1441,7 @@ u16 bcm43xx_phy_lo_g_deviation_subval(struct bcm43xx_private *bcm, u16 control) | |||
1435 | } | 1441 | } |
1436 | ret = bcm43xx_phy_read(bcm, 0x002D); | 1442 | ret = bcm43xx_phy_read(bcm, 0x002D); |
1437 | local_irq_restore(flags); | 1443 | local_irq_restore(flags); |
1444 | bcm43xx_voluntary_preempt(); | ||
1438 | 1445 | ||
1439 | return ret; | 1446 | return ret; |
1440 | } | 1447 | } |
@@ -1760,6 +1767,7 @@ void bcm43xx_phy_lo_g_measure(struct bcm43xx_private *bcm) | |||
1760 | bcm43xx_radio_write16(bcm, 0x43, i); | 1767 | bcm43xx_radio_write16(bcm, 0x43, i); |
1761 | bcm43xx_radio_write16(bcm, 0x52, radio->txctl2); | 1768 | bcm43xx_radio_write16(bcm, 0x52, radio->txctl2); |
1762 | udelay(10); | 1769 | udelay(10); |
1770 | bcm43xx_voluntary_preempt(); | ||
1763 | 1771 | ||
1764 | bcm43xx_phy_set_baseband_attenuation(bcm, j * 2); | 1772 | bcm43xx_phy_set_baseband_attenuation(bcm, j * 2); |
1765 | 1773 | ||
@@ -1803,6 +1811,7 @@ void bcm43xx_phy_lo_g_measure(struct bcm43xx_private *bcm) | |||
1803 | radio->txctl2 | 1811 | radio->txctl2 |
1804 | | (3/*txctl1*/ << 4));//FIXME: shouldn't txctl1 be zero here and 3 in the loop above? | 1812 | | (3/*txctl1*/ << 4));//FIXME: shouldn't txctl1 be zero here and 3 in the loop above? |
1805 | udelay(10); | 1813 | udelay(10); |
1814 | bcm43xx_voluntary_preempt(); | ||
1806 | 1815 | ||
1807 | bcm43xx_phy_set_baseband_attenuation(bcm, j * 2); | 1816 | bcm43xx_phy_set_baseband_attenuation(bcm, j * 2); |
1808 | 1817 | ||
@@ -1824,6 +1833,7 @@ void bcm43xx_phy_lo_g_measure(struct bcm43xx_private *bcm) | |||
1824 | bcm43xx_phy_write(bcm, 0x0812, (r27 << 8) | 0xA2); | 1833 | bcm43xx_phy_write(bcm, 0x0812, (r27 << 8) | 0xA2); |
1825 | udelay(2); | 1834 | udelay(2); |
1826 | bcm43xx_phy_write(bcm, 0x0812, (r27 << 8) | 0xA3); | 1835 | bcm43xx_phy_write(bcm, 0x0812, (r27 << 8) | 0xA3); |
1836 | bcm43xx_voluntary_preempt(); | ||
1827 | } else | 1837 | } else |
1828 | bcm43xx_phy_write(bcm, 0x0015, r27 | 0xEFA0); | 1838 | bcm43xx_phy_write(bcm, 0x0015, r27 | 0xEFA0); |
1829 | bcm43xx_phy_lo_adjust(bcm, is_initializing); | 1839 | bcm43xx_phy_lo_adjust(bcm, is_initializing); |
@@ -2188,12 +2198,6 @@ int bcm43xx_phy_init(struct bcm43xx_private *bcm) | |||
2188 | { | 2198 | { |
2189 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | 2199 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
2190 | int err = -ENODEV; | 2200 | int err = -ENODEV; |
2191 | unsigned long flags; | ||
2192 | |||
2193 | /* We do not want to be preempted while calibrating | ||
2194 | * the hardware. | ||
2195 | */ | ||
2196 | local_irq_save(flags); | ||
2197 | 2201 | ||
2198 | switch (phy->type) { | 2202 | switch (phy->type) { |
2199 | case BCM43xx_PHYTYPE_A: | 2203 | case BCM43xx_PHYTYPE_A: |
@@ -2227,7 +2231,6 @@ int bcm43xx_phy_init(struct bcm43xx_private *bcm) | |||
2227 | err = 0; | 2231 | err = 0; |
2228 | break; | 2232 | break; |
2229 | } | 2233 | } |
2230 | local_irq_restore(flags); | ||
2231 | if (err) | 2234 | if (err) |
2232 | printk(KERN_WARNING PFX "Unknown PHYTYPE found!\n"); | 2235 | printk(KERN_WARNING PFX "Unknown PHYTYPE found!\n"); |
2233 | 2236 | ||
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_pio.c b/drivers/net/wireless/bcm43xx/bcm43xx_pio.c index 574085c46152..c60c1743ea06 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_pio.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_pio.c | |||
@@ -262,7 +262,7 @@ static void tx_tasklet(unsigned long d) | |||
262 | int err; | 262 | int err; |
263 | u16 txctl; | 263 | u16 txctl; |
264 | 264 | ||
265 | bcm43xx_lock_irqonly(bcm, flags); | 265 | spin_lock_irqsave(&bcm->irq_lock, flags); |
266 | 266 | ||
267 | if (queue->tx_frozen) | 267 | if (queue->tx_frozen) |
268 | goto out_unlock; | 268 | goto out_unlock; |
@@ -300,7 +300,7 @@ static void tx_tasklet(unsigned long d) | |||
300 | continue; | 300 | continue; |
301 | } | 301 | } |
302 | out_unlock: | 302 | out_unlock: |
303 | bcm43xx_unlock_irqonly(bcm, flags); | 303 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
304 | } | 304 | } |
305 | 305 | ||
306 | static void setup_txqueues(struct bcm43xx_pioqueue *queue) | 306 | static void setup_txqueues(struct bcm43xx_pioqueue *queue) |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c index 6a23bdc75412..ece335178f6a 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c | |||
@@ -120,12 +120,14 @@ static ssize_t bcm43xx_attr_sprom_show(struct device *dev, | |||
120 | GFP_KERNEL); | 120 | GFP_KERNEL); |
121 | if (!sprom) | 121 | if (!sprom) |
122 | return -ENOMEM; | 122 | return -ENOMEM; |
123 | bcm43xx_lock_irqsafe(bcm, flags); | 123 | mutex_lock(&bcm->mutex); |
124 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
124 | err = bcm43xx_sprom_read(bcm, sprom); | 125 | err = bcm43xx_sprom_read(bcm, sprom); |
125 | if (!err) | 126 | if (!err) |
126 | err = sprom2hex(sprom, buf, PAGE_SIZE); | 127 | err = sprom2hex(sprom, buf, PAGE_SIZE); |
127 | mmiowb(); | 128 | mmiowb(); |
128 | bcm43xx_unlock_irqsafe(bcm, flags); | 129 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
130 | mutex_unlock(&bcm->mutex); | ||
129 | kfree(sprom); | 131 | kfree(sprom); |
130 | 132 | ||
131 | return err; | 133 | return err; |
@@ -150,10 +152,14 @@ static ssize_t bcm43xx_attr_sprom_store(struct device *dev, | |||
150 | err = hex2sprom(sprom, buf, count); | 152 | err = hex2sprom(sprom, buf, count); |
151 | if (err) | 153 | if (err) |
152 | goto out_kfree; | 154 | goto out_kfree; |
153 | bcm43xx_lock_irqsafe(bcm, flags); | 155 | mutex_lock(&bcm->mutex); |
156 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
157 | spin_lock(&bcm->leds_lock); | ||
154 | err = bcm43xx_sprom_write(bcm, sprom); | 158 | err = bcm43xx_sprom_write(bcm, sprom); |
155 | mmiowb(); | 159 | mmiowb(); |
156 | bcm43xx_unlock_irqsafe(bcm, flags); | 160 | spin_unlock(&bcm->leds_lock); |
161 | spin_unlock_irqrestore(&bcm->irq_lock, flags); | ||
162 | mutex_unlock(&bcm->mutex); | ||
157 | out_kfree: | 163 | out_kfree: |
158 | kfree(sprom); | 164 | kfree(sprom); |
159 | 165 | ||
@@ -176,7 +182,7 @@ static ssize_t bcm43xx_attr_interfmode_show(struct device *dev, | |||
176 | if (!capable(CAP_NET_ADMIN)) | 182 | if (!capable(CAP_NET_ADMIN)) |
177 | return -EPERM; | 183 | return -EPERM; |
178 | 184 | ||
179 | bcm43xx_lock_noirq(bcm); | 185 | mutex_lock(&bcm->mutex); |
180 | 186 | ||
181 | switch (bcm43xx_current_radio(bcm)->interfmode) { | 187 | switch (bcm43xx_current_radio(bcm)->interfmode) { |
182 | case BCM43xx_RADIO_INTERFMODE_NONE: | 188 | case BCM43xx_RADIO_INTERFMODE_NONE: |
@@ -193,7 +199,7 @@ static ssize_t bcm43xx_attr_interfmode_show(struct device *dev, | |||
193 | } | 199 | } |
194 | err = 0; | 200 | err = 0; |
195 | 201 | ||
196 | bcm43xx_unlock_noirq(bcm); | 202 | mutex_unlock(&bcm->mutex); |
197 | 203 | ||
198 | return err ? err : count; | 204 | return err ? err : count; |
199 | 205 | ||
@@ -229,7 +235,8 @@ static ssize_t bcm43xx_attr_interfmode_store(struct device *dev, | |||
229 | return -EINVAL; | 235 | return -EINVAL; |
230 | } | 236 | } |
231 | 237 | ||
232 | bcm43xx_lock_irqsafe(bcm, flags); | 238 | mutex_lock(&bcm->mutex); |
239 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
233 | 240 | ||
234 | err = bcm43xx_radio_set_interference_mitigation(bcm, mode); | 241 | err = bcm43xx_radio_set_interference_mitigation(bcm, mode); |
235 | if (err) { | 242 | if (err) { |
@@ -237,7 +244,8 @@ static ssize_t bcm43xx_attr_interfmode_store(struct device *dev, | |||
237 | "supported by device\n"); | 244 | "supported by device\n"); |
238 | } | 245 | } |
239 | mmiowb(); | 246 | mmiowb(); |
240 | bcm43xx_unlock_irqsafe(bcm, flags); | 247 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
248 | mutex_unlock(&bcm->mutex); | ||
241 | 249 | ||
242 | return err ? err : count; | 250 | return err ? err : count; |
243 | } | 251 | } |
@@ -257,7 +265,7 @@ static ssize_t bcm43xx_attr_preamble_show(struct device *dev, | |||
257 | if (!capable(CAP_NET_ADMIN)) | 265 | if (!capable(CAP_NET_ADMIN)) |
258 | return -EPERM; | 266 | return -EPERM; |
259 | 267 | ||
260 | bcm43xx_lock_noirq(bcm); | 268 | mutex_lock(&bcm->mutex); |
261 | 269 | ||
262 | if (bcm->short_preamble) | 270 | if (bcm->short_preamble) |
263 | count = snprintf(buf, PAGE_SIZE, "1 (Short Preamble enabled)\n"); | 271 | count = snprintf(buf, PAGE_SIZE, "1 (Short Preamble enabled)\n"); |
@@ -265,7 +273,7 @@ static ssize_t bcm43xx_attr_preamble_show(struct device *dev, | |||
265 | count = snprintf(buf, PAGE_SIZE, "0 (Short Preamble disabled)\n"); | 273 | count = snprintf(buf, PAGE_SIZE, "0 (Short Preamble disabled)\n"); |
266 | 274 | ||
267 | err = 0; | 275 | err = 0; |
268 | bcm43xx_unlock_noirq(bcm); | 276 | mutex_unlock(&bcm->mutex); |
269 | 277 | ||
270 | return err ? err : count; | 278 | return err ? err : count; |
271 | } | 279 | } |
@@ -285,12 +293,14 @@ static ssize_t bcm43xx_attr_preamble_store(struct device *dev, | |||
285 | value = get_boolean(buf, count); | 293 | value = get_boolean(buf, count); |
286 | if (value < 0) | 294 | if (value < 0) |
287 | return value; | 295 | return value; |
288 | bcm43xx_lock_irqsafe(bcm, flags); | 296 | mutex_lock(&bcm->mutex); |
297 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
289 | 298 | ||
290 | bcm->short_preamble = !!value; | 299 | bcm->short_preamble = !!value; |
291 | 300 | ||
292 | err = 0; | 301 | err = 0; |
293 | bcm43xx_unlock_irqsafe(bcm, flags); | 302 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
303 | mutex_unlock(&bcm->mutex); | ||
294 | 304 | ||
295 | return err ? err : count; | 305 | return err ? err : count; |
296 | } | 306 | } |
@@ -299,6 +309,70 @@ static DEVICE_ATTR(shortpreamble, 0644, | |||
299 | bcm43xx_attr_preamble_show, | 309 | bcm43xx_attr_preamble_show, |
300 | bcm43xx_attr_preamble_store); | 310 | bcm43xx_attr_preamble_store); |
301 | 311 | ||
312 | static ssize_t bcm43xx_attr_phymode_store(struct device *dev, | ||
313 | struct device_attribute *attr, | ||
314 | const char *buf, size_t count) | ||
315 | { | ||
316 | struct bcm43xx_private *bcm = dev_to_bcm(dev); | ||
317 | int phytype; | ||
318 | int err = -EINVAL; | ||
319 | |||
320 | if (count < 1) | ||
321 | goto out; | ||
322 | switch (buf[0]) { | ||
323 | case 'a': case 'A': | ||
324 | phytype = BCM43xx_PHYTYPE_A; | ||
325 | break; | ||
326 | case 'b': case 'B': | ||
327 | phytype = BCM43xx_PHYTYPE_B; | ||
328 | break; | ||
329 | case 'g': case 'G': | ||
330 | phytype = BCM43xx_PHYTYPE_G; | ||
331 | break; | ||
332 | default: | ||
333 | goto out; | ||
334 | } | ||
335 | |||
336 | mutex_lock(&(bcm)->mutex); | ||
337 | err = bcm43xx_select_wireless_core(bcm, phytype); | ||
338 | mutex_unlock(&(bcm)->mutex); | ||
339 | if (err == -ESRCH) | ||
340 | err = -ENODEV; | ||
341 | |||
342 | out: | ||
343 | return err ? err : count; | ||
344 | } | ||
345 | |||
346 | static ssize_t bcm43xx_attr_phymode_show(struct device *dev, | ||
347 | struct device_attribute *attr, | ||
348 | char *buf) | ||
349 | { | ||
350 | struct bcm43xx_private *bcm = dev_to_bcm(dev); | ||
351 | ssize_t count = 0; | ||
352 | |||
353 | mutex_lock(&(bcm)->mutex); | ||
354 | switch (bcm43xx_current_phy(bcm)->type) { | ||
355 | case BCM43xx_PHYTYPE_A: | ||
356 | snprintf(buf, PAGE_SIZE, "A"); | ||
357 | break; | ||
358 | case BCM43xx_PHYTYPE_B: | ||
359 | snprintf(buf, PAGE_SIZE, "B"); | ||
360 | break; | ||
361 | case BCM43xx_PHYTYPE_G: | ||
362 | snprintf(buf, PAGE_SIZE, "G"); | ||
363 | break; | ||
364 | default: | ||
365 | assert(0); | ||
366 | } | ||
367 | mutex_unlock(&(bcm)->mutex); | ||
368 | |||
369 | return count; | ||
370 | } | ||
371 | |||
372 | static DEVICE_ATTR(phymode, 0644, | ||
373 | bcm43xx_attr_phymode_show, | ||
374 | bcm43xx_attr_phymode_store); | ||
375 | |||
302 | int bcm43xx_sysfs_register(struct bcm43xx_private *bcm) | 376 | int bcm43xx_sysfs_register(struct bcm43xx_private *bcm) |
303 | { | 377 | { |
304 | struct device *dev = &bcm->pci_dev->dev; | 378 | struct device *dev = &bcm->pci_dev->dev; |
@@ -315,9 +389,14 @@ int bcm43xx_sysfs_register(struct bcm43xx_private *bcm) | |||
315 | err = device_create_file(dev, &dev_attr_shortpreamble); | 389 | err = device_create_file(dev, &dev_attr_shortpreamble); |
316 | if (err) | 390 | if (err) |
317 | goto err_remove_interfmode; | 391 | goto err_remove_interfmode; |
392 | err = device_create_file(dev, &dev_attr_phymode); | ||
393 | if (err) | ||
394 | goto err_remove_shortpreamble; | ||
318 | 395 | ||
319 | out: | 396 | out: |
320 | return err; | 397 | return err; |
398 | err_remove_shortpreamble: | ||
399 | device_remove_file(dev, &dev_attr_shortpreamble); | ||
321 | err_remove_interfmode: | 400 | err_remove_interfmode: |
322 | device_remove_file(dev, &dev_attr_interference); | 401 | device_remove_file(dev, &dev_attr_interference); |
323 | err_remove_sprom: | 402 | err_remove_sprom: |
@@ -329,6 +408,7 @@ void bcm43xx_sysfs_unregister(struct bcm43xx_private *bcm) | |||
329 | { | 408 | { |
330 | struct device *dev = &bcm->pci_dev->dev; | 409 | struct device *dev = &bcm->pci_dev->dev; |
331 | 410 | ||
411 | device_remove_file(dev, &dev_attr_phymode); | ||
332 | device_remove_file(dev, &dev_attr_shortpreamble); | 412 | device_remove_file(dev, &dev_attr_shortpreamble); |
333 | device_remove_file(dev, &dev_attr_interference); | 413 | device_remove_file(dev, &dev_attr_interference); |
334 | device_remove_file(dev, &dev_attr_sprom); | 414 | device_remove_file(dev, &dev_attr_sprom); |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c index 5c36e29efff7..1d3a3aaf96ec 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c | |||
@@ -47,6 +47,8 @@ | |||
47 | #define BCM43xx_WX_VERSION 18 | 47 | #define BCM43xx_WX_VERSION 18 |
48 | 48 | ||
49 | #define MAX_WX_STRING 80 | 49 | #define MAX_WX_STRING 80 |
50 | /* FIXME: the next line is a guess as to what the maximum RSSI value might be */ | ||
51 | #define RX_RSSI_MAX 60 | ||
50 | 52 | ||
51 | 53 | ||
52 | static int bcm43xx_wx_get_name(struct net_device *net_dev, | 54 | static int bcm43xx_wx_get_name(struct net_device *net_dev, |
@@ -56,12 +58,11 @@ static int bcm43xx_wx_get_name(struct net_device *net_dev, | |||
56 | { | 58 | { |
57 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 59 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
58 | int i; | 60 | int i; |
59 | unsigned long flags; | ||
60 | struct bcm43xx_phyinfo *phy; | 61 | struct bcm43xx_phyinfo *phy; |
61 | char suffix[7] = { 0 }; | 62 | char suffix[7] = { 0 }; |
62 | int have_a = 0, have_b = 0, have_g = 0; | 63 | int have_a = 0, have_b = 0, have_g = 0; |
63 | 64 | ||
64 | bcm43xx_lock_irqsafe(bcm, flags); | 65 | mutex_lock(&bcm->mutex); |
65 | for (i = 0; i < bcm->nr_80211_available; i++) { | 66 | for (i = 0; i < bcm->nr_80211_available; i++) { |
66 | phy = &(bcm->core_80211_ext[i].phy); | 67 | phy = &(bcm->core_80211_ext[i].phy); |
67 | switch (phy->type) { | 68 | switch (phy->type) { |
@@ -77,7 +78,7 @@ static int bcm43xx_wx_get_name(struct net_device *net_dev, | |||
77 | assert(0); | 78 | assert(0); |
78 | } | 79 | } |
79 | } | 80 | } |
80 | bcm43xx_unlock_irqsafe(bcm, flags); | 81 | mutex_unlock(&bcm->mutex); |
81 | 82 | ||
82 | i = 0; | 83 | i = 0; |
83 | if (have_a) { | 84 | if (have_a) { |
@@ -111,7 +112,9 @@ static int bcm43xx_wx_set_channelfreq(struct net_device *net_dev, | |||
111 | int freq; | 112 | int freq; |
112 | int err = -EINVAL; | 113 | int err = -EINVAL; |
113 | 114 | ||
114 | bcm43xx_lock_irqsafe(bcm, flags); | 115 | mutex_lock(&bcm->mutex); |
116 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
117 | |||
115 | if ((data->freq.m >= 0) && (data->freq.m <= 1000)) { | 118 | if ((data->freq.m >= 0) && (data->freq.m <= 1000)) { |
116 | channel = data->freq.m; | 119 | channel = data->freq.m; |
117 | freq = bcm43xx_channel_to_freq(bcm, channel); | 120 | freq = bcm43xx_channel_to_freq(bcm, channel); |
@@ -131,7 +134,8 @@ static int bcm43xx_wx_set_channelfreq(struct net_device *net_dev, | |||
131 | err = 0; | 134 | err = 0; |
132 | } | 135 | } |
133 | out_unlock: | 136 | out_unlock: |
134 | bcm43xx_unlock_irqsafe(bcm, flags); | 137 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
138 | mutex_unlock(&bcm->mutex); | ||
135 | 139 | ||
136 | return err; | 140 | return err; |
137 | } | 141 | } |
@@ -143,11 +147,10 @@ static int bcm43xx_wx_get_channelfreq(struct net_device *net_dev, | |||
143 | { | 147 | { |
144 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 148 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
145 | struct bcm43xx_radioinfo *radio; | 149 | struct bcm43xx_radioinfo *radio; |
146 | unsigned long flags; | ||
147 | int err = -ENODEV; | 150 | int err = -ENODEV; |
148 | u16 channel; | 151 | u16 channel; |
149 | 152 | ||
150 | bcm43xx_lock_irqsafe(bcm, flags); | 153 | mutex_lock(&bcm->mutex); |
151 | radio = bcm43xx_current_radio(bcm); | 154 | radio = bcm43xx_current_radio(bcm); |
152 | channel = radio->channel; | 155 | channel = radio->channel; |
153 | if (channel == 0xFF) { | 156 | if (channel == 0xFF) { |
@@ -162,7 +165,7 @@ static int bcm43xx_wx_get_channelfreq(struct net_device *net_dev, | |||
162 | 165 | ||
163 | err = 0; | 166 | err = 0; |
164 | out_unlock: | 167 | out_unlock: |
165 | bcm43xx_unlock_irqsafe(bcm, flags); | 168 | mutex_unlock(&bcm->mutex); |
166 | 169 | ||
167 | return err; | 170 | return err; |
168 | } | 171 | } |
@@ -180,13 +183,15 @@ static int bcm43xx_wx_set_mode(struct net_device *net_dev, | |||
180 | if (mode == IW_MODE_AUTO) | 183 | if (mode == IW_MODE_AUTO) |
181 | mode = BCM43xx_INITIAL_IWMODE; | 184 | mode = BCM43xx_INITIAL_IWMODE; |
182 | 185 | ||
183 | bcm43xx_lock_irqsafe(bcm, flags); | 186 | mutex_lock(&bcm->mutex); |
187 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
184 | if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) { | 188 | if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) { |
185 | if (bcm->ieee->iw_mode != mode) | 189 | if (bcm->ieee->iw_mode != mode) |
186 | bcm43xx_set_iwmode(bcm, mode); | 190 | bcm43xx_set_iwmode(bcm, mode); |
187 | } else | 191 | } else |
188 | bcm->ieee->iw_mode = mode; | 192 | bcm->ieee->iw_mode = mode; |
189 | bcm43xx_unlock_irqsafe(bcm, flags); | 193 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
194 | mutex_unlock(&bcm->mutex); | ||
190 | 195 | ||
191 | return 0; | 196 | return 0; |
192 | } | 197 | } |
@@ -197,11 +202,10 @@ static int bcm43xx_wx_get_mode(struct net_device *net_dev, | |||
197 | char *extra) | 202 | char *extra) |
198 | { | 203 | { |
199 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 204 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
200 | unsigned long flags; | ||
201 | 205 | ||
202 | bcm43xx_lock_irqsafe(bcm, flags); | 206 | mutex_lock(&bcm->mutex); |
203 | data->mode = bcm->ieee->iw_mode; | 207 | data->mode = bcm->ieee->iw_mode; |
204 | bcm43xx_unlock_irqsafe(bcm, flags); | 208 | mutex_unlock(&bcm->mutex); |
205 | 209 | ||
206 | return 0; | 210 | return 0; |
207 | } | 211 | } |
@@ -214,7 +218,6 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev, | |||
214 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 218 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
215 | struct iw_range *range = (struct iw_range *)extra; | 219 | struct iw_range *range = (struct iw_range *)extra; |
216 | const struct ieee80211_geo *geo; | 220 | const struct ieee80211_geo *geo; |
217 | unsigned long flags; | ||
218 | int i, j; | 221 | int i, j; |
219 | struct bcm43xx_phyinfo *phy; | 222 | struct bcm43xx_phyinfo *phy; |
220 | 223 | ||
@@ -226,15 +229,14 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev, | |||
226 | range->throughput = 27 * 1000 * 1000; | 229 | range->throughput = 27 * 1000 * 1000; |
227 | 230 | ||
228 | range->max_qual.qual = 100; | 231 | range->max_qual.qual = 100; |
229 | /* TODO: Real max RSSI */ | 232 | range->max_qual.level = 152; /* set floor at -104 dBm (152 - 256) */ |
230 | range->max_qual.level = 3; | 233 | range->max_qual.noise = 152; |
231 | range->max_qual.noise = 100; | 234 | range->max_qual.updated = IW_QUAL_ALL_UPDATED; |
232 | range->max_qual.updated = 7; | ||
233 | 235 | ||
234 | range->avg_qual.qual = 70; | 236 | range->avg_qual.qual = 50; |
235 | range->avg_qual.level = 2; | 237 | range->avg_qual.level = 0; |
236 | range->avg_qual.noise = 40; | 238 | range->avg_qual.noise = 0; |
237 | range->avg_qual.updated = 7; | 239 | range->avg_qual.updated = IW_QUAL_ALL_UPDATED; |
238 | 240 | ||
239 | range->min_rts = BCM43xx_MIN_RTS_THRESHOLD; | 241 | range->min_rts = BCM43xx_MIN_RTS_THRESHOLD; |
240 | range->max_rts = BCM43xx_MAX_RTS_THRESHOLD; | 242 | range->max_rts = BCM43xx_MAX_RTS_THRESHOLD; |
@@ -254,7 +256,7 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev, | |||
254 | IW_ENC_CAPA_CIPHER_TKIP | | 256 | IW_ENC_CAPA_CIPHER_TKIP | |
255 | IW_ENC_CAPA_CIPHER_CCMP; | 257 | IW_ENC_CAPA_CIPHER_CCMP; |
256 | 258 | ||
257 | bcm43xx_lock_irqsafe(bcm, flags); | 259 | mutex_lock(&bcm->mutex); |
258 | phy = bcm43xx_current_phy(bcm); | 260 | phy = bcm43xx_current_phy(bcm); |
259 | 261 | ||
260 | range->num_bitrates = 0; | 262 | range->num_bitrates = 0; |
@@ -301,7 +303,7 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev, | |||
301 | } | 303 | } |
302 | range->num_frequency = j; | 304 | range->num_frequency = j; |
303 | 305 | ||
304 | bcm43xx_unlock_irqsafe(bcm, flags); | 306 | mutex_unlock(&bcm->mutex); |
305 | 307 | ||
306 | return 0; | 308 | return 0; |
307 | } | 309 | } |
@@ -314,11 +316,11 @@ static int bcm43xx_wx_set_nick(struct net_device *net_dev, | |||
314 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 316 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
315 | size_t len; | 317 | size_t len; |
316 | 318 | ||
317 | bcm43xx_lock_noirq(bcm); | 319 | mutex_lock(&bcm->mutex); |
318 | len = min((size_t)data->data.length, (size_t)IW_ESSID_MAX_SIZE); | 320 | len = min((size_t)data->data.length, (size_t)IW_ESSID_MAX_SIZE); |
319 | memcpy(bcm->nick, extra, len); | 321 | memcpy(bcm->nick, extra, len); |
320 | bcm->nick[len] = '\0'; | 322 | bcm->nick[len] = '\0'; |
321 | bcm43xx_unlock_noirq(bcm); | 323 | mutex_unlock(&bcm->mutex); |
322 | 324 | ||
323 | return 0; | 325 | return 0; |
324 | } | 326 | } |
@@ -331,12 +333,12 @@ static int bcm43xx_wx_get_nick(struct net_device *net_dev, | |||
331 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 333 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
332 | size_t len; | 334 | size_t len; |
333 | 335 | ||
334 | bcm43xx_lock_noirq(bcm); | 336 | mutex_lock(&bcm->mutex); |
335 | len = strlen(bcm->nick) + 1; | 337 | len = strlen(bcm->nick) + 1; |
336 | memcpy(extra, bcm->nick, len); | 338 | memcpy(extra, bcm->nick, len); |
337 | data->data.length = (__u16)len; | 339 | data->data.length = (__u16)len; |
338 | data->data.flags = 1; | 340 | data->data.flags = 1; |
339 | bcm43xx_unlock_noirq(bcm); | 341 | mutex_unlock(&bcm->mutex); |
340 | 342 | ||
341 | return 0; | 343 | return 0; |
342 | } | 344 | } |
@@ -350,7 +352,8 @@ static int bcm43xx_wx_set_rts(struct net_device *net_dev, | |||
350 | unsigned long flags; | 352 | unsigned long flags; |
351 | int err = -EINVAL; | 353 | int err = -EINVAL; |
352 | 354 | ||
353 | bcm43xx_lock_irqsafe(bcm, flags); | 355 | mutex_lock(&bcm->mutex); |
356 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
354 | if (data->rts.disabled) { | 357 | if (data->rts.disabled) { |
355 | bcm->rts_threshold = BCM43xx_MAX_RTS_THRESHOLD; | 358 | bcm->rts_threshold = BCM43xx_MAX_RTS_THRESHOLD; |
356 | err = 0; | 359 | err = 0; |
@@ -361,7 +364,8 @@ static int bcm43xx_wx_set_rts(struct net_device *net_dev, | |||
361 | err = 0; | 364 | err = 0; |
362 | } | 365 | } |
363 | } | 366 | } |
364 | bcm43xx_unlock_irqsafe(bcm, flags); | 367 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
368 | mutex_unlock(&bcm->mutex); | ||
365 | 369 | ||
366 | return err; | 370 | return err; |
367 | } | 371 | } |
@@ -372,13 +376,12 @@ static int bcm43xx_wx_get_rts(struct net_device *net_dev, | |||
372 | char *extra) | 376 | char *extra) |
373 | { | 377 | { |
374 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 378 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
375 | unsigned long flags; | ||
376 | 379 | ||
377 | bcm43xx_lock_irqsafe(bcm, flags); | 380 | mutex_lock(&bcm->mutex); |
378 | data->rts.value = bcm->rts_threshold; | 381 | data->rts.value = bcm->rts_threshold; |
379 | data->rts.fixed = 0; | 382 | data->rts.fixed = 0; |
380 | data->rts.disabled = (bcm->rts_threshold == BCM43xx_MAX_RTS_THRESHOLD); | 383 | data->rts.disabled = (bcm->rts_threshold == BCM43xx_MAX_RTS_THRESHOLD); |
381 | bcm43xx_unlock_irqsafe(bcm, flags); | 384 | mutex_unlock(&bcm->mutex); |
382 | 385 | ||
383 | return 0; | 386 | return 0; |
384 | } | 387 | } |
@@ -392,7 +395,8 @@ static int bcm43xx_wx_set_frag(struct net_device *net_dev, | |||
392 | unsigned long flags; | 395 | unsigned long flags; |
393 | int err = -EINVAL; | 396 | int err = -EINVAL; |
394 | 397 | ||
395 | bcm43xx_lock_irqsafe(bcm, flags); | 398 | mutex_lock(&bcm->mutex); |
399 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
396 | if (data->frag.disabled) { | 400 | if (data->frag.disabled) { |
397 | bcm->ieee->fts = MAX_FRAG_THRESHOLD; | 401 | bcm->ieee->fts = MAX_FRAG_THRESHOLD; |
398 | err = 0; | 402 | err = 0; |
@@ -403,7 +407,8 @@ static int bcm43xx_wx_set_frag(struct net_device *net_dev, | |||
403 | err = 0; | 407 | err = 0; |
404 | } | 408 | } |
405 | } | 409 | } |
406 | bcm43xx_unlock_irqsafe(bcm, flags); | 410 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
411 | mutex_unlock(&bcm->mutex); | ||
407 | 412 | ||
408 | return err; | 413 | return err; |
409 | } | 414 | } |
@@ -414,13 +419,12 @@ static int bcm43xx_wx_get_frag(struct net_device *net_dev, | |||
414 | char *extra) | 419 | char *extra) |
415 | { | 420 | { |
416 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 421 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
417 | unsigned long flags; | ||
418 | 422 | ||
419 | bcm43xx_lock_irqsafe(bcm, flags); | 423 | mutex_lock(&bcm->mutex); |
420 | data->frag.value = bcm->ieee->fts; | 424 | data->frag.value = bcm->ieee->fts; |
421 | data->frag.fixed = 0; | 425 | data->frag.fixed = 0; |
422 | data->frag.disabled = (bcm->ieee->fts == MAX_FRAG_THRESHOLD); | 426 | data->frag.disabled = (bcm->ieee->fts == MAX_FRAG_THRESHOLD); |
423 | bcm43xx_unlock_irqsafe(bcm, flags); | 427 | mutex_unlock(&bcm->mutex); |
424 | 428 | ||
425 | return 0; | 429 | return 0; |
426 | } | 430 | } |
@@ -442,7 +446,8 @@ static int bcm43xx_wx_set_xmitpower(struct net_device *net_dev, | |||
442 | return -EOPNOTSUPP; | 446 | return -EOPNOTSUPP; |
443 | } | 447 | } |
444 | 448 | ||
445 | bcm43xx_lock_irqsafe(bcm, flags); | 449 | mutex_lock(&bcm->mutex); |
450 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
446 | if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) | 451 | if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) |
447 | goto out_unlock; | 452 | goto out_unlock; |
448 | radio = bcm43xx_current_radio(bcm); | 453 | radio = bcm43xx_current_radio(bcm); |
@@ -466,7 +471,8 @@ static int bcm43xx_wx_set_xmitpower(struct net_device *net_dev, | |||
466 | err = 0; | 471 | err = 0; |
467 | 472 | ||
468 | out_unlock: | 473 | out_unlock: |
469 | bcm43xx_unlock_irqsafe(bcm, flags); | 474 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
475 | mutex_unlock(&bcm->mutex); | ||
470 | 476 | ||
471 | return err; | 477 | return err; |
472 | } | 478 | } |
@@ -478,10 +484,9 @@ static int bcm43xx_wx_get_xmitpower(struct net_device *net_dev, | |||
478 | { | 484 | { |
479 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 485 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
480 | struct bcm43xx_radioinfo *radio; | 486 | struct bcm43xx_radioinfo *radio; |
481 | unsigned long flags; | ||
482 | int err = -ENODEV; | 487 | int err = -ENODEV; |
483 | 488 | ||
484 | bcm43xx_lock_irqsafe(bcm, flags); | 489 | mutex_lock(&bcm->mutex); |
485 | if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) | 490 | if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) |
486 | goto out_unlock; | 491 | goto out_unlock; |
487 | radio = bcm43xx_current_radio(bcm); | 492 | radio = bcm43xx_current_radio(bcm); |
@@ -493,7 +498,7 @@ static int bcm43xx_wx_get_xmitpower(struct net_device *net_dev, | |||
493 | 498 | ||
494 | err = 0; | 499 | err = 0; |
495 | out_unlock: | 500 | out_unlock: |
496 | bcm43xx_unlock_irqsafe(bcm, flags); | 501 | mutex_unlock(&bcm->mutex); |
497 | 502 | ||
498 | return err; | 503 | return err; |
499 | } | 504 | } |
@@ -580,7 +585,8 @@ static int bcm43xx_wx_set_interfmode(struct net_device *net_dev, | |||
580 | return -EINVAL; | 585 | return -EINVAL; |
581 | } | 586 | } |
582 | 587 | ||
583 | bcm43xx_lock_irqsafe(bcm, flags); | 588 | mutex_lock(&bcm->mutex); |
589 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
584 | if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) { | 590 | if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) { |
585 | err = bcm43xx_radio_set_interference_mitigation(bcm, mode); | 591 | err = bcm43xx_radio_set_interference_mitigation(bcm, mode); |
586 | if (err) { | 592 | if (err) { |
@@ -595,7 +601,8 @@ static int bcm43xx_wx_set_interfmode(struct net_device *net_dev, | |||
595 | } else | 601 | } else |
596 | bcm43xx_current_radio(bcm)->interfmode = mode; | 602 | bcm43xx_current_radio(bcm)->interfmode = mode; |
597 | } | 603 | } |
598 | bcm43xx_unlock_irqsafe(bcm, flags); | 604 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
605 | mutex_unlock(&bcm->mutex); | ||
599 | 606 | ||
600 | return err; | 607 | return err; |
601 | } | 608 | } |
@@ -606,12 +613,11 @@ static int bcm43xx_wx_get_interfmode(struct net_device *net_dev, | |||
606 | char *extra) | 613 | char *extra) |
607 | { | 614 | { |
608 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 615 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
609 | unsigned long flags; | ||
610 | int mode; | 616 | int mode; |
611 | 617 | ||
612 | bcm43xx_lock_irqsafe(bcm, flags); | 618 | mutex_lock(&bcm->mutex); |
613 | mode = bcm43xx_current_radio(bcm)->interfmode; | 619 | mode = bcm43xx_current_radio(bcm)->interfmode; |
614 | bcm43xx_unlock_irqsafe(bcm, flags); | 620 | mutex_unlock(&bcm->mutex); |
615 | 621 | ||
616 | switch (mode) { | 622 | switch (mode) { |
617 | case BCM43xx_RADIO_INTERFMODE_NONE: | 623 | case BCM43xx_RADIO_INTERFMODE_NONE: |
@@ -641,9 +647,11 @@ static int bcm43xx_wx_set_shortpreamble(struct net_device *net_dev, | |||
641 | int on; | 647 | int on; |
642 | 648 | ||
643 | on = *((int *)extra); | 649 | on = *((int *)extra); |
644 | bcm43xx_lock_irqsafe(bcm, flags); | 650 | mutex_lock(&bcm->mutex); |
651 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
645 | bcm->short_preamble = !!on; | 652 | bcm->short_preamble = !!on; |
646 | bcm43xx_unlock_irqsafe(bcm, flags); | 653 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
654 | mutex_unlock(&bcm->mutex); | ||
647 | 655 | ||
648 | return 0; | 656 | return 0; |
649 | } | 657 | } |
@@ -654,12 +662,11 @@ static int bcm43xx_wx_get_shortpreamble(struct net_device *net_dev, | |||
654 | char *extra) | 662 | char *extra) |
655 | { | 663 | { |
656 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 664 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
657 | unsigned long flags; | ||
658 | int on; | 665 | int on; |
659 | 666 | ||
660 | bcm43xx_lock_irqsafe(bcm, flags); | 667 | mutex_lock(&bcm->mutex); |
661 | on = bcm->short_preamble; | 668 | on = bcm->short_preamble; |
662 | bcm43xx_unlock_irqsafe(bcm, flags); | 669 | mutex_unlock(&bcm->mutex); |
663 | 670 | ||
664 | if (on) | 671 | if (on) |
665 | strncpy(extra, "1 (Short Preamble enabled)", MAX_WX_STRING); | 672 | strncpy(extra, "1 (Short Preamble enabled)", MAX_WX_STRING); |
@@ -681,11 +688,13 @@ static int bcm43xx_wx_set_swencryption(struct net_device *net_dev, | |||
681 | 688 | ||
682 | on = *((int *)extra); | 689 | on = *((int *)extra); |
683 | 690 | ||
684 | bcm43xx_lock_irqsafe(bcm, flags); | 691 | mutex_lock(&bcm->mutex); |
692 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
685 | bcm->ieee->host_encrypt = !!on; | 693 | bcm->ieee->host_encrypt = !!on; |
686 | bcm->ieee->host_decrypt = !!on; | 694 | bcm->ieee->host_decrypt = !!on; |
687 | bcm->ieee->host_build_iv = !on; | 695 | bcm->ieee->host_build_iv = !on; |
688 | bcm43xx_unlock_irqsafe(bcm, flags); | 696 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
697 | mutex_unlock(&bcm->mutex); | ||
689 | 698 | ||
690 | return 0; | 699 | return 0; |
691 | } | 700 | } |
@@ -696,12 +705,11 @@ static int bcm43xx_wx_get_swencryption(struct net_device *net_dev, | |||
696 | char *extra) | 705 | char *extra) |
697 | { | 706 | { |
698 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 707 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
699 | unsigned long flags; | ||
700 | int on; | 708 | int on; |
701 | 709 | ||
702 | bcm43xx_lock_irqsafe(bcm, flags); | 710 | mutex_lock(&bcm->mutex); |
703 | on = bcm->ieee->host_encrypt; | 711 | on = bcm->ieee->host_encrypt; |
704 | bcm43xx_unlock_irqsafe(bcm, flags); | 712 | mutex_unlock(&bcm->mutex); |
705 | 713 | ||
706 | if (on) | 714 | if (on) |
707 | strncpy(extra, "1 (SW encryption enabled) ", MAX_WX_STRING); | 715 | strncpy(extra, "1 (SW encryption enabled) ", MAX_WX_STRING); |
@@ -764,11 +772,13 @@ static int bcm43xx_wx_sprom_read(struct net_device *net_dev, | |||
764 | if (!sprom) | 772 | if (!sprom) |
765 | goto out; | 773 | goto out; |
766 | 774 | ||
767 | bcm43xx_lock_irqsafe(bcm, flags); | 775 | mutex_lock(&bcm->mutex); |
776 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
768 | err = -ENODEV; | 777 | err = -ENODEV; |
769 | if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) | 778 | if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) |
770 | err = bcm43xx_sprom_read(bcm, sprom); | 779 | err = bcm43xx_sprom_read(bcm, sprom); |
771 | bcm43xx_unlock_irqsafe(bcm, flags); | 780 | spin_unlock_irqrestore(&bcm->irq_lock, flags); |
781 | mutex_unlock(&bcm->mutex); | ||
772 | if (!err) | 782 | if (!err) |
773 | data->data.length = sprom2hex(sprom, extra); | 783 | data->data.length = sprom2hex(sprom, extra); |
774 | kfree(sprom); | 784 | kfree(sprom); |
@@ -809,11 +819,15 @@ static int bcm43xx_wx_sprom_write(struct net_device *net_dev, | |||
809 | if (err) | 819 | if (err) |
810 | goto out_kfree; | 820 | goto out_kfree; |
811 | 821 | ||
812 | bcm43xx_lock_irqsafe(bcm, flags); | 822 | mutex_lock(&bcm->mutex); |
823 | spin_lock_irqsave(&bcm->irq_lock, flags); | ||
824 | spin_lock(&bcm->leds_lock); | ||
813 | err = -ENODEV; | 825 | err = -ENODEV; |
814 | if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) | 826 | if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) |
815 | err = bcm43xx_sprom_write(bcm, sprom); | 827 | err = bcm43xx_sprom_write(bcm, sprom); |
816 | bcm43xx_unlock_irqsafe(bcm, flags); | 828 | spin_unlock(&bcm->leds_lock); |
829 | spin_unlock_irqrestore(&bcm->irq_lock, flags); | ||
830 | mutex_unlock(&bcm->mutex); | ||
817 | out_kfree: | 831 | out_kfree: |
818 | kfree(sprom); | 832 | kfree(sprom); |
819 | out: | 833 | out: |
@@ -827,6 +841,10 @@ static struct iw_statistics *bcm43xx_get_wireless_stats(struct net_device *net_d | |||
827 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 841 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
828 | struct ieee80211softmac_device *mac = ieee80211_priv(net_dev); | 842 | struct ieee80211softmac_device *mac = ieee80211_priv(net_dev); |
829 | struct iw_statistics *wstats; | 843 | struct iw_statistics *wstats; |
844 | struct ieee80211_network *network = NULL; | ||
845 | static int tmp_level = 0; | ||
846 | static int tmp_qual = 0; | ||
847 | unsigned long flags; | ||
830 | 848 | ||
831 | wstats = &bcm->stats.wstats; | 849 | wstats = &bcm->stats.wstats; |
832 | if (!mac->associated) { | 850 | if (!mac->associated) { |
@@ -844,16 +862,28 @@ static struct iw_statistics *bcm43xx_get_wireless_stats(struct net_device *net_d | |||
844 | wstats->qual.level = 0; | 862 | wstats->qual.level = 0; |
845 | wstats->qual.noise = 0; | 863 | wstats->qual.noise = 0; |
846 | wstats->qual.updated = 7; | 864 | wstats->qual.updated = 7; |
847 | wstats->qual.updated |= IW_QUAL_NOISE_INVALID | | 865 | wstats->qual.updated |= IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; |
848 | IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; | ||
849 | return wstats; | 866 | return wstats; |
850 | } | 867 | } |
851 | /* fill in the real statistics when iface associated */ | 868 | /* fill in the real statistics when iface associated */ |
852 | wstats->qual.qual = 100; // TODO: get the real signal quality | 869 | spin_lock_irqsave(&mac->ieee->lock, flags); |
853 | wstats->qual.level = 3 - bcm->stats.link_quality; | 870 | list_for_each_entry(network, &mac->ieee->network_list, list) { |
871 | if (!memcmp(mac->associnfo.bssid, network->bssid, ETH_ALEN)) { | ||
872 | if (!tmp_level) { /* get initial values */ | ||
873 | tmp_level = network->stats.signal; | ||
874 | tmp_qual = network->stats.rssi; | ||
875 | } else { /* smooth results */ | ||
876 | tmp_level = (15 * tmp_level + network->stats.signal)/16; | ||
877 | tmp_qual = (15 * tmp_qual + network->stats.rssi)/16; | ||
878 | } | ||
879 | break; | ||
880 | } | ||
881 | } | ||
882 | spin_unlock_irqrestore(&mac->ieee->lock, flags); | ||
883 | wstats->qual.level = tmp_level; | ||
884 | wstats->qual.qual = 100 * tmp_qual / RX_RSSI_MAX; | ||
854 | wstats->qual.noise = bcm->stats.noise; | 885 | wstats->qual.noise = bcm->stats.noise; |
855 | wstats->qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | | 886 | wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; |
856 | IW_QUAL_NOISE_UPDATED; | ||
857 | wstats->discard.code = bcm->ieee->ieee_stats.rx_discards_undecryptable; | 887 | wstats->discard.code = bcm->ieee->ieee_stats.rx_discards_undecryptable; |
858 | wstats->discard.retries = bcm->ieee->ieee_stats.tx_retry_limit_exceeded; | 888 | wstats->discard.retries = bcm->ieee->ieee_stats.tx_retry_limit_exceeded; |
859 | wstats->discard.nwid = bcm->ieee->ieee_stats.tx_discards_wrong_sa; | 889 | wstats->discard.nwid = bcm->ieee->ieee_stats.tx_discards_wrong_sa; |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c b/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c index 6dbd855b3647..c0efbfe605a5 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c | |||
@@ -492,16 +492,15 @@ int bcm43xx_rx(struct bcm43xx_private *bcm, | |||
492 | 492 | ||
493 | memset(&stats, 0, sizeof(stats)); | 493 | memset(&stats, 0, sizeof(stats)); |
494 | stats.mac_time = le16_to_cpu(rxhdr->mactime); | 494 | stats.mac_time = le16_to_cpu(rxhdr->mactime); |
495 | stats.rssi = bcm43xx_rssi_postprocess(bcm, rxhdr->rssi, is_ofdm, | 495 | stats.rssi = rxhdr->rssi; |
496 | stats.signal = bcm43xx_rssi_postprocess(bcm, rxhdr->rssi, is_ofdm, | ||
496 | !!(rxflags1 & BCM43xx_RXHDR_FLAGS1_2053RSSIADJ), | 497 | !!(rxflags1 & BCM43xx_RXHDR_FLAGS1_2053RSSIADJ), |
497 | !!(rxflags3 & BCM43xx_RXHDR_FLAGS3_2050RSSIADJ)); | 498 | !!(rxflags3 & BCM43xx_RXHDR_FLAGS3_2050RSSIADJ)); |
498 | stats.signal = rxhdr->signal_quality; //FIXME | ||
499 | //TODO stats.noise = | 499 | //TODO stats.noise = |
500 | if (is_ofdm) | 500 | if (is_ofdm) |
501 | stats.rate = bcm43xx_plcp_get_bitrate_ofdm(plcp); | 501 | stats.rate = bcm43xx_plcp_get_bitrate_ofdm(plcp); |
502 | else | 502 | else |
503 | stats.rate = bcm43xx_plcp_get_bitrate_cck(plcp); | 503 | stats.rate = bcm43xx_plcp_get_bitrate_cck(plcp); |
504 | //printk("RX ofdm %d, rate == %u\n", is_ofdm, stats.rate); | ||
505 | stats.received_channel = radio->channel; | 504 | stats.received_channel = radio->channel; |
506 | //TODO stats.control = | 505 | //TODO stats.control = |
507 | stats.mask = IEEE80211_STATMASK_SIGNAL | | 506 | stats.mask = IEEE80211_STATMASK_SIGNAL | |
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index dafaa5ff5aa6..d500012fdc7a 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c | |||
@@ -1042,6 +1042,9 @@ static int prism2_reset_port(struct net_device *dev) | |||
1042 | dev->name, local->fragm_threshold); | 1042 | dev->name, local->fragm_threshold); |
1043 | } | 1043 | } |
1044 | 1044 | ||
1045 | /* Some firmwares lose antenna selection settings on reset */ | ||
1046 | (void) hostap_set_antsel(local); | ||
1047 | |||
1045 | return res; | 1048 | return res; |
1046 | } | 1049 | } |
1047 | 1050 | ||
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index e955db435b30..5f8ccf48061a 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
@@ -6531,7 +6531,7 @@ static int __init ipw2100_init(void) | |||
6531 | printk(KERN_INFO DRV_NAME ": %s, %s\n", DRV_DESCRIPTION, DRV_VERSION); | 6531 | printk(KERN_INFO DRV_NAME ": %s, %s\n", DRV_DESCRIPTION, DRV_VERSION); |
6532 | printk(KERN_INFO DRV_NAME ": %s\n", DRV_COPYRIGHT); | 6532 | printk(KERN_INFO DRV_NAME ": %s\n", DRV_COPYRIGHT); |
6533 | 6533 | ||
6534 | ret = pci_module_init(&ipw2100_pci_driver); | 6534 | ret = pci_register_driver(&ipw2100_pci_driver); |
6535 | 6535 | ||
6536 | #ifdef CONFIG_IPW2100_DEBUG | 6536 | #ifdef CONFIG_IPW2100_DEBUG |
6537 | ipw2100_debug_level = debug; | 6537 | ipw2100_debug_level = debug; |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index b3300ffe4eec..a72f3e1e991b 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -2667,7 +2667,7 @@ static void ipw_fw_dma_abort(struct ipw_priv *priv) | |||
2667 | 2667 | ||
2668 | IPW_DEBUG_FW(">> :\n"); | 2668 | IPW_DEBUG_FW(">> :\n"); |
2669 | 2669 | ||
2670 | //set the Stop and Abort bit | 2670 | /* set the Stop and Abort bit */ |
2671 | control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_STOP_AND_ABORT; | 2671 | control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_STOP_AND_ABORT; |
2672 | ipw_write_reg32(priv, IPW_DMA_I_DMA_CONTROL, control); | 2672 | ipw_write_reg32(priv, IPW_DMA_I_DMA_CONTROL, control); |
2673 | priv->sram_desc.last_cb_index = 0; | 2673 | priv->sram_desc.last_cb_index = 0; |
@@ -3002,8 +3002,6 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) | |||
3002 | if (rc < 0) | 3002 | if (rc < 0) |
3003 | return rc; | 3003 | return rc; |
3004 | 3004 | ||
3005 | // spin_lock_irqsave(&priv->lock, flags); | ||
3006 | |||
3007 | for (addr = IPW_SHARED_LOWER_BOUND; | 3005 | for (addr = IPW_SHARED_LOWER_BOUND; |
3008 | addr < IPW_REGISTER_DOMAIN1_END; addr += 4) { | 3006 | addr < IPW_REGISTER_DOMAIN1_END; addr += 4) { |
3009 | ipw_write32(priv, addr, 0); | 3007 | ipw_write32(priv, addr, 0); |
@@ -3097,8 +3095,6 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) | |||
3097 | firmware have problem getting alive resp. */ | 3095 | firmware have problem getting alive resp. */ |
3098 | ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, 0); | 3096 | ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, 0); |
3099 | 3097 | ||
3100 | // spin_unlock_irqrestore(&priv->lock, flags); | ||
3101 | |||
3102 | return rc; | 3098 | return rc; |
3103 | } | 3099 | } |
3104 | 3100 | ||
@@ -6387,13 +6383,6 @@ static int ipw_wx_set_genie(struct net_device *dev, | |||
6387 | (wrqu->data.length && extra == NULL)) | 6383 | (wrqu->data.length && extra == NULL)) |
6388 | return -EINVAL; | 6384 | return -EINVAL; |
6389 | 6385 | ||
6390 | //mutex_lock(&priv->mutex); | ||
6391 | |||
6392 | //if (!ieee->wpa_enabled) { | ||
6393 | // err = -EOPNOTSUPP; | ||
6394 | // goto out; | ||
6395 | //} | ||
6396 | |||
6397 | if (wrqu->data.length) { | 6386 | if (wrqu->data.length) { |
6398 | buf = kmalloc(wrqu->data.length, GFP_KERNEL); | 6387 | buf = kmalloc(wrqu->data.length, GFP_KERNEL); |
6399 | if (buf == NULL) { | 6388 | if (buf == NULL) { |
@@ -6413,7 +6402,6 @@ static int ipw_wx_set_genie(struct net_device *dev, | |||
6413 | 6402 | ||
6414 | ipw_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); | 6403 | ipw_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); |
6415 | out: | 6404 | out: |
6416 | //mutex_unlock(&priv->mutex); | ||
6417 | return err; | 6405 | return err; |
6418 | } | 6406 | } |
6419 | 6407 | ||
@@ -6426,13 +6414,6 @@ static int ipw_wx_get_genie(struct net_device *dev, | |||
6426 | struct ieee80211_device *ieee = priv->ieee; | 6414 | struct ieee80211_device *ieee = priv->ieee; |
6427 | int err = 0; | 6415 | int err = 0; |
6428 | 6416 | ||
6429 | //mutex_lock(&priv->mutex); | ||
6430 | |||
6431 | //if (!ieee->wpa_enabled) { | ||
6432 | // err = -EOPNOTSUPP; | ||
6433 | // goto out; | ||
6434 | //} | ||
6435 | |||
6436 | if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) { | 6417 | if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) { |
6437 | wrqu->data.length = 0; | 6418 | wrqu->data.length = 0; |
6438 | goto out; | 6419 | goto out; |
@@ -6447,7 +6428,6 @@ static int ipw_wx_get_genie(struct net_device *dev, | |||
6447 | memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); | 6428 | memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); |
6448 | 6429 | ||
6449 | out: | 6430 | out: |
6450 | //mutex_unlock(&priv->mutex); | ||
6451 | return err; | 6431 | return err; |
6452 | } | 6432 | } |
6453 | 6433 | ||
@@ -6558,7 +6538,6 @@ static int ipw_wx_set_auth(struct net_device *dev, | |||
6558 | ieee->ieee802_1x = param->value; | 6538 | ieee->ieee802_1x = param->value; |
6559 | break; | 6539 | break; |
6560 | 6540 | ||
6561 | //case IW_AUTH_ROAMING_CONTROL: | ||
6562 | case IW_AUTH_PRIVACY_INVOKED: | 6541 | case IW_AUTH_PRIVACY_INVOKED: |
6563 | ieee->privacy_invoked = param->value; | 6542 | ieee->privacy_invoked = param->value; |
6564 | break; | 6543 | break; |
@@ -6680,7 +6659,7 @@ static int ipw_wx_set_mlme(struct net_device *dev, | |||
6680 | 6659 | ||
6681 | switch (mlme->cmd) { | 6660 | switch (mlme->cmd) { |
6682 | case IW_MLME_DEAUTH: | 6661 | case IW_MLME_DEAUTH: |
6683 | // silently ignore | 6662 | /* silently ignore */ |
6684 | break; | 6663 | break; |
6685 | 6664 | ||
6686 | case IW_MLME_DISASSOC: | 6665 | case IW_MLME_DISASSOC: |
@@ -9766,7 +9745,7 @@ static int ipw_wx_set_monitor(struct net_device *dev, | |||
9766 | return 0; | 9745 | return 0; |
9767 | } | 9746 | } |
9768 | 9747 | ||
9769 | #endif // CONFIG_IPW2200_MONITOR | 9748 | #endif /* CONFIG_IPW2200_MONITOR */ |
9770 | 9749 | ||
9771 | static int ipw_wx_reset(struct net_device *dev, | 9750 | static int ipw_wx_reset(struct net_device *dev, |
9772 | struct iw_request_info *info, | 9751 | struct iw_request_info *info, |
@@ -10009,7 +9988,7 @@ static void init_sys_config(struct ipw_sys_config *sys_config) | |||
10009 | sys_config->dot11g_auto_detection = 0; | 9988 | sys_config->dot11g_auto_detection = 0; |
10010 | sys_config->enable_cts_to_self = 0; | 9989 | sys_config->enable_cts_to_self = 0; |
10011 | sys_config->bt_coexist_collision_thr = 0; | 9990 | sys_config->bt_coexist_collision_thr = 0; |
10012 | sys_config->pass_noise_stats_to_host = 1; //1 -- fix for 256 | 9991 | sys_config->pass_noise_stats_to_host = 1; /* 1 -- fix for 256 */ |
10013 | sys_config->silence_threshold = 0x1e; | 9992 | sys_config->silence_threshold = 0x1e; |
10014 | } | 9993 | } |
10015 | 9994 | ||
@@ -11774,7 +11753,7 @@ static int __init ipw_init(void) | |||
11774 | printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); | 11753 | printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); |
11775 | printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n"); | 11754 | printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n"); |
11776 | 11755 | ||
11777 | ret = pci_module_init(&ipw_driver); | 11756 | ret = pci_register_driver(&ipw_driver); |
11778 | if (ret) { | 11757 | if (ret) { |
11779 | IPW_ERROR("Unable to initialize PCI module\n"); | 11758 | IPW_ERROR("Unable to initialize PCI module\n"); |
11780 | return ret; | 11759 | return ret; |
diff --git a/drivers/net/wireless/orinoco_nortel.c b/drivers/net/wireless/orinoco_nortel.c index bf05b907747e..eaf3d13b851c 100644 --- a/drivers/net/wireless/orinoco_nortel.c +++ b/drivers/net/wireless/orinoco_nortel.c | |||
@@ -304,7 +304,7 @@ MODULE_LICENSE("Dual MPL/GPL"); | |||
304 | static int __init orinoco_nortel_init(void) | 304 | static int __init orinoco_nortel_init(void) |
305 | { | 305 | { |
306 | printk(KERN_DEBUG "%s\n", version); | 306 | printk(KERN_DEBUG "%s\n", version); |
307 | return pci_module_init(&orinoco_nortel_driver); | 307 | return pci_register_driver(&orinoco_nortel_driver); |
308 | } | 308 | } |
309 | 309 | ||
310 | static void __exit orinoco_nortel_exit(void) | 310 | static void __exit orinoco_nortel_exit(void) |
diff --git a/drivers/net/wireless/orinoco_pci.c b/drivers/net/wireless/orinoco_pci.c index 1759c543fbee..97a8b4ff32bd 100644 --- a/drivers/net/wireless/orinoco_pci.c +++ b/drivers/net/wireless/orinoco_pci.c | |||
@@ -244,7 +244,7 @@ MODULE_LICENSE("Dual MPL/GPL"); | |||
244 | static int __init orinoco_pci_init(void) | 244 | static int __init orinoco_pci_init(void) |
245 | { | 245 | { |
246 | printk(KERN_DEBUG "%s\n", version); | 246 | printk(KERN_DEBUG "%s\n", version); |
247 | return pci_module_init(&orinoco_pci_driver); | 247 | return pci_register_driver(&orinoco_pci_driver); |
248 | } | 248 | } |
249 | 249 | ||
250 | static void __exit orinoco_pci_exit(void) | 250 | static void __exit orinoco_pci_exit(void) |
diff --git a/drivers/net/wireless/orinoco_plx.c b/drivers/net/wireless/orinoco_plx.c index 7f006f624171..31162ac25a92 100644 --- a/drivers/net/wireless/orinoco_plx.c +++ b/drivers/net/wireless/orinoco_plx.c | |||
@@ -351,7 +351,7 @@ MODULE_LICENSE("Dual MPL/GPL"); | |||
351 | static int __init orinoco_plx_init(void) | 351 | static int __init orinoco_plx_init(void) |
352 | { | 352 | { |
353 | printk(KERN_DEBUG "%s\n", version); | 353 | printk(KERN_DEBUG "%s\n", version); |
354 | return pci_module_init(&orinoco_plx_driver); | 354 | return pci_register_driver(&orinoco_plx_driver); |
355 | } | 355 | } |
356 | 356 | ||
357 | static void __exit orinoco_plx_exit(void) | 357 | static void __exit orinoco_plx_exit(void) |
diff --git a/drivers/net/wireless/orinoco_tmd.c b/drivers/net/wireless/orinoco_tmd.c index 0831721e4d6c..7c7b960c91df 100644 --- a/drivers/net/wireless/orinoco_tmd.c +++ b/drivers/net/wireless/orinoco_tmd.c | |||
@@ -228,7 +228,7 @@ MODULE_LICENSE("Dual MPL/GPL"); | |||
228 | static int __init orinoco_tmd_init(void) | 228 | static int __init orinoco_tmd_init(void) |
229 | { | 229 | { |
230 | printk(KERN_DEBUG "%s\n", version); | 230 | printk(KERN_DEBUG "%s\n", version); |
231 | return pci_module_init(&orinoco_tmd_driver); | 231 | return pci_register_driver(&orinoco_tmd_driver); |
232 | } | 232 | } |
233 | 233 | ||
234 | static void __exit orinoco_tmd_exit(void) | 234 | static void __exit orinoco_tmd_exit(void) |
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c index 989599ad33ef..0c30fe7e8f7f 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.c +++ b/drivers/net/wireless/prism54/isl_ioctl.c | |||
@@ -35,10 +35,14 @@ | |||
35 | 35 | ||
36 | #include <net/iw_handler.h> /* New driver API */ | 36 | #include <net/iw_handler.h> /* New driver API */ |
37 | 37 | ||
38 | #define KEY_SIZE_WEP104 13 /* 104/128-bit WEP keys */ | ||
39 | #define KEY_SIZE_WEP40 5 /* 40/64-bit WEP keys */ | ||
40 | /* KEY_SIZE_TKIP should match isl_oid.h, struct obj_key.key[] size */ | ||
41 | #define KEY_SIZE_TKIP 32 /* TKIP keys */ | ||
38 | 42 | ||
39 | static void prism54_wpa_ie_add(islpci_private *priv, u8 *bssid, | 43 | static void prism54_wpa_bss_ie_add(islpci_private *priv, u8 *bssid, |
40 | u8 *wpa_ie, size_t wpa_ie_len); | 44 | u8 *wpa_ie, size_t wpa_ie_len); |
41 | static size_t prism54_wpa_ie_get(islpci_private *priv, u8 *bssid, u8 *wpa_ie); | 45 | static size_t prism54_wpa_bss_ie_get(islpci_private *priv, u8 *bssid, u8 *wpa_ie); |
42 | static int prism54_set_wpa(struct net_device *, struct iw_request_info *, | 46 | static int prism54_set_wpa(struct net_device *, struct iw_request_info *, |
43 | __u32 *, char *); | 47 | __u32 *, char *); |
44 | 48 | ||
@@ -468,6 +472,9 @@ prism54_get_range(struct net_device *ndev, struct iw_request_info *info, | |||
468 | range->event_capa[1] = IW_EVENT_CAPA_K_1; | 472 | range->event_capa[1] = IW_EVENT_CAPA_K_1; |
469 | range->event_capa[4] = IW_EVENT_CAPA_MASK(IWEVCUSTOM); | 473 | range->event_capa[4] = IW_EVENT_CAPA_MASK(IWEVCUSTOM); |
470 | 474 | ||
475 | range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | | ||
476 | IW_ENC_CAPA_CIPHER_TKIP; | ||
477 | |||
471 | if (islpci_get_state(priv) < PRV_STATE_INIT) | 478 | if (islpci_get_state(priv) < PRV_STATE_INIT) |
472 | return 0; | 479 | return 0; |
473 | 480 | ||
@@ -567,6 +574,8 @@ prism54_translate_bss(struct net_device *ndev, char *current_ev, | |||
567 | struct iw_event iwe; /* Temporary buffer */ | 574 | struct iw_event iwe; /* Temporary buffer */ |
568 | short cap; | 575 | short cap; |
569 | islpci_private *priv = netdev_priv(ndev); | 576 | islpci_private *priv = netdev_priv(ndev); |
577 | u8 wpa_ie[MAX_WPA_IE_LEN]; | ||
578 | size_t wpa_ie_len; | ||
570 | 579 | ||
571 | /* The first entry must be the MAC address */ | 580 | /* The first entry must be the MAC address */ |
572 | memcpy(iwe.u.ap_addr.sa_data, bss->address, 6); | 581 | memcpy(iwe.u.ap_addr.sa_data, bss->address, 6); |
@@ -627,27 +636,13 @@ prism54_translate_bss(struct net_device *ndev, char *current_ev, | |||
627 | current_ev = | 636 | current_ev = |
628 | iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); | 637 | iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); |
629 | 638 | ||
630 | if (priv->wpa) { | 639 | /* Add WPA/RSN Information Element, if any */ |
631 | u8 wpa_ie[MAX_WPA_IE_LEN]; | 640 | wpa_ie_len = prism54_wpa_bss_ie_get(priv, bss->address, wpa_ie); |
632 | char *buf, *p; | 641 | if (wpa_ie_len > 0) { |
633 | size_t wpa_ie_len; | 642 | iwe.cmd = IWEVGENIE; |
634 | int i; | 643 | iwe.u.data.length = min(wpa_ie_len, (size_t)MAX_WPA_IE_LEN); |
635 | 644 | current_ev = iwe_stream_add_point(current_ev, end_buf, | |
636 | wpa_ie_len = prism54_wpa_ie_get(priv, bss->address, wpa_ie); | 645 | &iwe, wpa_ie); |
637 | if (wpa_ie_len > 0 && | ||
638 | (buf = kmalloc(wpa_ie_len * 2 + 10, GFP_ATOMIC))) { | ||
639 | p = buf; | ||
640 | p += sprintf(p, "wpa_ie="); | ||
641 | for (i = 0; i < wpa_ie_len; i++) { | ||
642 | p += sprintf(p, "%02x", wpa_ie[i]); | ||
643 | } | ||
644 | memset(&iwe, 0, sizeof (iwe)); | ||
645 | iwe.cmd = IWEVCUSTOM; | ||
646 | iwe.u.data.length = strlen(buf); | ||
647 | current_ev = iwe_stream_add_point(current_ev, end_buf, | ||
648 | &iwe, buf); | ||
649 | kfree(buf); | ||
650 | } | ||
651 | } | 646 | } |
652 | return current_ev; | 647 | return current_ev; |
653 | } | 648 | } |
@@ -1051,12 +1046,24 @@ prism54_set_encode(struct net_device *ndev, struct iw_request_info *info, | |||
1051 | current_index = r.u; | 1046 | current_index = r.u; |
1052 | /* Verify that the key is not marked as invalid */ | 1047 | /* Verify that the key is not marked as invalid */ |
1053 | if (!(dwrq->flags & IW_ENCODE_NOKEY)) { | 1048 | if (!(dwrq->flags & IW_ENCODE_NOKEY)) { |
1054 | key.length = dwrq->length > sizeof (key.key) ? | 1049 | if (dwrq->length > KEY_SIZE_TKIP) { |
1055 | sizeof (key.key) : dwrq->length; | 1050 | /* User-provided key data too big */ |
1056 | memcpy(key.key, extra, key.length); | 1051 | return -EINVAL; |
1057 | if (key.length == 32) | 1052 | } |
1058 | /* we want WPA-PSK */ | 1053 | if (dwrq->length > KEY_SIZE_WEP104) { |
1054 | /* WPA-PSK TKIP */ | ||
1059 | key.type = DOT11_PRIV_TKIP; | 1055 | key.type = DOT11_PRIV_TKIP; |
1056 | key.length = KEY_SIZE_TKIP; | ||
1057 | } else if (dwrq->length > KEY_SIZE_WEP40) { | ||
1058 | /* WEP 104/128 */ | ||
1059 | key.length = KEY_SIZE_WEP104; | ||
1060 | } else { | ||
1061 | /* WEP 40/64 */ | ||
1062 | key.length = KEY_SIZE_WEP40; | ||
1063 | } | ||
1064 | memset(key.key, 0, sizeof (key.key)); | ||
1065 | memcpy(key.key, extra, dwrq->length); | ||
1066 | |||
1060 | if ((index < 0) || (index > 3)) | 1067 | if ((index < 0) || (index > 3)) |
1061 | /* no index provided use the current one */ | 1068 | /* no index provided use the current one */ |
1062 | index = current_index; | 1069 | index = current_index; |
@@ -1210,6 +1217,489 @@ prism54_set_txpower(struct net_device *ndev, struct iw_request_info *info, | |||
1210 | } | 1217 | } |
1211 | } | 1218 | } |
1212 | 1219 | ||
1220 | static int prism54_set_genie(struct net_device *ndev, | ||
1221 | struct iw_request_info *info, | ||
1222 | struct iw_point *data, char *extra) | ||
1223 | { | ||
1224 | islpci_private *priv = netdev_priv(ndev); | ||
1225 | int alen, ret = 0; | ||
1226 | struct obj_attachment *attach; | ||
1227 | |||
1228 | if (data->length > MAX_WPA_IE_LEN || | ||
1229 | (data->length && extra == NULL)) | ||
1230 | return -EINVAL; | ||
1231 | |||
1232 | memcpy(priv->wpa_ie, extra, data->length); | ||
1233 | priv->wpa_ie_len = data->length; | ||
1234 | |||
1235 | alen = sizeof(*attach) + priv->wpa_ie_len; | ||
1236 | attach = kzalloc(alen, GFP_KERNEL); | ||
1237 | if (attach == NULL) | ||
1238 | return -ENOMEM; | ||
1239 | |||
1240 | #define WLAN_FC_TYPE_MGMT 0 | ||
1241 | #define WLAN_FC_STYPE_ASSOC_REQ 0 | ||
1242 | #define WLAN_FC_STYPE_REASSOC_REQ 2 | ||
1243 | |||
1244 | /* Note: endianness is covered by mgt_set_varlen */ | ||
1245 | attach->type = (WLAN_FC_TYPE_MGMT << 2) | | ||
1246 | (WLAN_FC_STYPE_ASSOC_REQ << 4); | ||
1247 | attach->id = -1; | ||
1248 | attach->size = priv->wpa_ie_len; | ||
1249 | memcpy(attach->data, extra, priv->wpa_ie_len); | ||
1250 | |||
1251 | ret = mgt_set_varlen(priv, DOT11_OID_ATTACHMENT, attach, | ||
1252 | priv->wpa_ie_len); | ||
1253 | if (ret == 0) { | ||
1254 | attach->type = (WLAN_FC_TYPE_MGMT << 2) | | ||
1255 | (WLAN_FC_STYPE_REASSOC_REQ << 4); | ||
1256 | |||
1257 | ret = mgt_set_varlen(priv, DOT11_OID_ATTACHMENT, attach, | ||
1258 | priv->wpa_ie_len); | ||
1259 | if (ret == 0) | ||
1260 | printk(KERN_DEBUG "%s: WPA IE Attachment was set\n", | ||
1261 | ndev->name); | ||
1262 | } | ||
1263 | |||
1264 | kfree(attach); | ||
1265 | return ret; | ||
1266 | } | ||
1267 | |||
1268 | |||
1269 | static int prism54_get_genie(struct net_device *ndev, | ||
1270 | struct iw_request_info *info, | ||
1271 | struct iw_point *data, char *extra) | ||
1272 | { | ||
1273 | islpci_private *priv = netdev_priv(ndev); | ||
1274 | int len = priv->wpa_ie_len; | ||
1275 | |||
1276 | if (len <= 0) { | ||
1277 | data->length = 0; | ||
1278 | return 0; | ||
1279 | } | ||
1280 | |||
1281 | if (data->length < len) | ||
1282 | return -E2BIG; | ||
1283 | |||
1284 | data->length = len; | ||
1285 | memcpy(extra, priv->wpa_ie, len); | ||
1286 | |||
1287 | return 0; | ||
1288 | } | ||
1289 | |||
1290 | static int prism54_set_auth(struct net_device *ndev, | ||
1291 | struct iw_request_info *info, | ||
1292 | union iwreq_data *wrqu, char *extra) | ||
1293 | { | ||
1294 | islpci_private *priv = netdev_priv(ndev); | ||
1295 | struct iw_param *param = &wrqu->param; | ||
1296 | u32 mlmelevel = 0, authen = 0, dot1x = 0; | ||
1297 | u32 exunencrypt = 0, privinvoked = 0, wpa = 0; | ||
1298 | u32 old_wpa; | ||
1299 | int ret = 0; | ||
1300 | union oid_res_t r; | ||
1301 | |||
1302 | if (islpci_get_state(priv) < PRV_STATE_INIT) | ||
1303 | return 0; | ||
1304 | |||
1305 | /* first get the flags */ | ||
1306 | down_write(&priv->mib_sem); | ||
1307 | wpa = old_wpa = priv->wpa; | ||
1308 | up_write(&priv->mib_sem); | ||
1309 | ret = mgt_get_request(priv, DOT11_OID_AUTHENABLE, 0, NULL, &r); | ||
1310 | authen = r.u; | ||
1311 | ret = mgt_get_request(priv, DOT11_OID_PRIVACYINVOKED, 0, NULL, &r); | ||
1312 | privinvoked = r.u; | ||
1313 | ret = mgt_get_request(priv, DOT11_OID_EXUNENCRYPTED, 0, NULL, &r); | ||
1314 | exunencrypt = r.u; | ||
1315 | ret = mgt_get_request(priv, DOT11_OID_DOT1XENABLE, 0, NULL, &r); | ||
1316 | dot1x = r.u; | ||
1317 | ret = mgt_get_request(priv, DOT11_OID_MLMEAUTOLEVEL, 0, NULL, &r); | ||
1318 | mlmelevel = r.u; | ||
1319 | |||
1320 | if (ret < 0) | ||
1321 | goto out; | ||
1322 | |||
1323 | switch (param->flags & IW_AUTH_INDEX) { | ||
1324 | case IW_AUTH_CIPHER_PAIRWISE: | ||
1325 | case IW_AUTH_CIPHER_GROUP: | ||
1326 | case IW_AUTH_KEY_MGMT: | ||
1327 | break; | ||
1328 | |||
1329 | case IW_AUTH_WPA_ENABLED: | ||
1330 | /* Do the same thing as IW_AUTH_WPA_VERSION */ | ||
1331 | if (param->value) { | ||
1332 | wpa = 1; | ||
1333 | privinvoked = 1; /* For privacy invoked */ | ||
1334 | exunencrypt = 1; /* Filter out all unencrypted frames */ | ||
1335 | dot1x = 0x01; /* To enable eap filter */ | ||
1336 | mlmelevel = DOT11_MLME_EXTENDED; | ||
1337 | authen = DOT11_AUTH_OS; /* Only WEP uses _SK and _BOTH */ | ||
1338 | } else { | ||
1339 | wpa = 0; | ||
1340 | privinvoked = 0; | ||
1341 | exunencrypt = 0; /* Do not filter un-encrypted data */ | ||
1342 | dot1x = 0; | ||
1343 | mlmelevel = DOT11_MLME_AUTO; | ||
1344 | } | ||
1345 | break; | ||
1346 | |||
1347 | case IW_AUTH_WPA_VERSION: | ||
1348 | if (param->value & IW_AUTH_WPA_VERSION_DISABLED) { | ||
1349 | wpa = 0; | ||
1350 | privinvoked = 0; | ||
1351 | exunencrypt = 0; /* Do not filter un-encrypted data */ | ||
1352 | dot1x = 0; | ||
1353 | mlmelevel = DOT11_MLME_AUTO; | ||
1354 | } else { | ||
1355 | if (param->value & IW_AUTH_WPA_VERSION_WPA) | ||
1356 | wpa = 1; | ||
1357 | else if (param->value & IW_AUTH_WPA_VERSION_WPA2) | ||
1358 | wpa = 2; | ||
1359 | privinvoked = 1; /* For privacy invoked */ | ||
1360 | exunencrypt = 1; /* Filter out all unencrypted frames */ | ||
1361 | dot1x = 0x01; /* To enable eap filter */ | ||
1362 | mlmelevel = DOT11_MLME_EXTENDED; | ||
1363 | authen = DOT11_AUTH_OS; /* Only WEP uses _SK and _BOTH */ | ||
1364 | } | ||
1365 | break; | ||
1366 | |||
1367 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | ||
1368 | dot1x = param->value ? 1 : 0; | ||
1369 | break; | ||
1370 | |||
1371 | case IW_AUTH_PRIVACY_INVOKED: | ||
1372 | privinvoked = param->value ? 1 : 0; | ||
1373 | |||
1374 | case IW_AUTH_DROP_UNENCRYPTED: | ||
1375 | exunencrypt = param->value ? 1 : 0; | ||
1376 | break; | ||
1377 | |||
1378 | case IW_AUTH_80211_AUTH_ALG: | ||
1379 | if (param->value & IW_AUTH_ALG_SHARED_KEY) { | ||
1380 | /* Only WEP uses _SK and _BOTH */ | ||
1381 | if (wpa > 0) { | ||
1382 | ret = -EINVAL; | ||
1383 | goto out; | ||
1384 | } | ||
1385 | authen = DOT11_AUTH_SK; | ||
1386 | } else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM) { | ||
1387 | authen = DOT11_AUTH_OS; | ||
1388 | } else { | ||
1389 | ret = -EINVAL; | ||
1390 | goto out; | ||
1391 | } | ||
1392 | break; | ||
1393 | |||
1394 | default: | ||
1395 | return -EOPNOTSUPP; | ||
1396 | } | ||
1397 | |||
1398 | /* Set all the values */ | ||
1399 | down_write(&priv->mib_sem); | ||
1400 | priv->wpa = wpa; | ||
1401 | up_write(&priv->mib_sem); | ||
1402 | mgt_set_request(priv, DOT11_OID_AUTHENABLE, 0, &authen); | ||
1403 | mgt_set_request(priv, DOT11_OID_PRIVACYINVOKED, 0, &privinvoked); | ||
1404 | mgt_set_request(priv, DOT11_OID_EXUNENCRYPTED, 0, &exunencrypt); | ||
1405 | mgt_set_request(priv, DOT11_OID_DOT1XENABLE, 0, &dot1x); | ||
1406 | mgt_set_request(priv, DOT11_OID_MLMEAUTOLEVEL, 0, &mlmelevel); | ||
1407 | |||
1408 | out: | ||
1409 | return ret; | ||
1410 | } | ||
1411 | |||
1412 | static int prism54_get_auth(struct net_device *ndev, | ||
1413 | struct iw_request_info *info, | ||
1414 | union iwreq_data *wrqu, char *extra) | ||
1415 | { | ||
1416 | islpci_private *priv = netdev_priv(ndev); | ||
1417 | struct iw_param *param = &wrqu->param; | ||
1418 | u32 wpa = 0; | ||
1419 | int ret = 0; | ||
1420 | union oid_res_t r; | ||
1421 | |||
1422 | if (islpci_get_state(priv) < PRV_STATE_INIT) | ||
1423 | return 0; | ||
1424 | |||
1425 | /* first get the flags */ | ||
1426 | down_write(&priv->mib_sem); | ||
1427 | wpa = priv->wpa; | ||
1428 | up_write(&priv->mib_sem); | ||
1429 | |||
1430 | switch (param->flags & IW_AUTH_INDEX) { | ||
1431 | case IW_AUTH_CIPHER_PAIRWISE: | ||
1432 | case IW_AUTH_CIPHER_GROUP: | ||
1433 | case IW_AUTH_KEY_MGMT: | ||
1434 | /* | ||
1435 | * wpa_supplicant will control these internally | ||
1436 | */ | ||
1437 | ret = -EOPNOTSUPP; | ||
1438 | break; | ||
1439 | |||
1440 | case IW_AUTH_WPA_VERSION: | ||
1441 | switch (wpa) { | ||
1442 | case 1: | ||
1443 | param->value = IW_AUTH_WPA_VERSION_WPA; | ||
1444 | break; | ||
1445 | case 2: | ||
1446 | param->value = IW_AUTH_WPA_VERSION_WPA2; | ||
1447 | break; | ||
1448 | case 0: | ||
1449 | default: | ||
1450 | param->value = IW_AUTH_WPA_VERSION_DISABLED; | ||
1451 | break; | ||
1452 | } | ||
1453 | break; | ||
1454 | |||
1455 | case IW_AUTH_DROP_UNENCRYPTED: | ||
1456 | ret = mgt_get_request(priv, DOT11_OID_EXUNENCRYPTED, 0, NULL, &r); | ||
1457 | if (ret >= 0) | ||
1458 | param->value = r.u > 0 ? 1 : 0; | ||
1459 | break; | ||
1460 | |||
1461 | case IW_AUTH_80211_AUTH_ALG: | ||
1462 | ret = mgt_get_request(priv, DOT11_OID_AUTHENABLE, 0, NULL, &r); | ||
1463 | if (ret >= 0) { | ||
1464 | switch (r.u) { | ||
1465 | case DOT11_AUTH_OS: | ||
1466 | param->value = IW_AUTH_ALG_OPEN_SYSTEM; | ||
1467 | break; | ||
1468 | case DOT11_AUTH_BOTH: | ||
1469 | case DOT11_AUTH_SK: | ||
1470 | param->value = IW_AUTH_ALG_SHARED_KEY; | ||
1471 | case DOT11_AUTH_NONE: | ||
1472 | default: | ||
1473 | param->value = 0; | ||
1474 | break; | ||
1475 | } | ||
1476 | } | ||
1477 | break; | ||
1478 | |||
1479 | case IW_AUTH_WPA_ENABLED: | ||
1480 | param->value = wpa > 0 ? 1 : 0; | ||
1481 | break; | ||
1482 | |||
1483 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | ||
1484 | ret = mgt_get_request(priv, DOT11_OID_DOT1XENABLE, 0, NULL, &r); | ||
1485 | if (ret >= 0) | ||
1486 | param->value = r.u > 0 ? 1 : 0; | ||
1487 | break; | ||
1488 | |||
1489 | case IW_AUTH_PRIVACY_INVOKED: | ||
1490 | ret = mgt_get_request(priv, DOT11_OID_PRIVACYINVOKED, 0, NULL, &r); | ||
1491 | if (ret >= 0) | ||
1492 | param->value = r.u > 0 ? 1 : 0; | ||
1493 | break; | ||
1494 | |||
1495 | default: | ||
1496 | return -EOPNOTSUPP; | ||
1497 | } | ||
1498 | return ret; | ||
1499 | } | ||
1500 | |||
1501 | static int prism54_set_encodeext(struct net_device *ndev, | ||
1502 | struct iw_request_info *info, | ||
1503 | union iwreq_data *wrqu, | ||
1504 | char *extra) | ||
1505 | { | ||
1506 | islpci_private *priv = netdev_priv(ndev); | ||
1507 | struct iw_point *encoding = &wrqu->encoding; | ||
1508 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | ||
1509 | int idx, alg = ext->alg, set_key = 1; | ||
1510 | union oid_res_t r; | ||
1511 | int authen = DOT11_AUTH_OS, invoke = 0, exunencrypt = 0; | ||
1512 | int ret = 0; | ||
1513 | |||
1514 | if (islpci_get_state(priv) < PRV_STATE_INIT) | ||
1515 | return 0; | ||
1516 | |||
1517 | /* Determine and validate the key index */ | ||
1518 | idx = (encoding->flags & IW_ENCODE_INDEX) - 1; | ||
1519 | if (idx) { | ||
1520 | if (idx < 0 || idx > 3) | ||
1521 | return -EINVAL; | ||
1522 | } else { | ||
1523 | ret = mgt_get_request(priv, DOT11_OID_DEFKEYID, 0, NULL, &r); | ||
1524 | if (ret < 0) | ||
1525 | goto out; | ||
1526 | idx = r.u; | ||
1527 | } | ||
1528 | |||
1529 | if (encoding->flags & IW_ENCODE_DISABLED) | ||
1530 | alg = IW_ENCODE_ALG_NONE; | ||
1531 | |||
1532 | if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { | ||
1533 | /* Only set transmit key index here, actual | ||
1534 | * key is set below if needed. | ||
1535 | */ | ||
1536 | ret = mgt_set_request(priv, DOT11_OID_DEFKEYID, 0, &idx); | ||
1537 | set_key = ext->key_len > 0 ? 1 : 0; | ||
1538 | } | ||
1539 | |||
1540 | if (set_key) { | ||
1541 | struct obj_key key = { DOT11_PRIV_WEP, 0, "" }; | ||
1542 | switch (alg) { | ||
1543 | case IW_ENCODE_ALG_NONE: | ||
1544 | break; | ||
1545 | case IW_ENCODE_ALG_WEP: | ||
1546 | if (ext->key_len > KEY_SIZE_WEP104) { | ||
1547 | ret = -EINVAL; | ||
1548 | goto out; | ||
1549 | } | ||
1550 | if (ext->key_len > KEY_SIZE_WEP40) | ||
1551 | key.length = KEY_SIZE_WEP104; | ||
1552 | else | ||
1553 | key.length = KEY_SIZE_WEP40; | ||
1554 | break; | ||
1555 | case IW_ENCODE_ALG_TKIP: | ||
1556 | if (ext->key_len > KEY_SIZE_TKIP) { | ||
1557 | ret = -EINVAL; | ||
1558 | goto out; | ||
1559 | } | ||
1560 | key.type = DOT11_PRIV_TKIP; | ||
1561 | key.length = KEY_SIZE_TKIP; | ||
1562 | default: | ||
1563 | return -EINVAL; | ||
1564 | } | ||
1565 | |||
1566 | if (key.length) { | ||
1567 | memset(key.key, 0, sizeof(key.key)); | ||
1568 | memcpy(key.key, ext->key, ext->key_len); | ||
1569 | ret = mgt_set_request(priv, DOT11_OID_DEFKEYX, idx, | ||
1570 | &key); | ||
1571 | if (ret < 0) | ||
1572 | goto out; | ||
1573 | } | ||
1574 | } | ||
1575 | |||
1576 | /* Read the flags */ | ||
1577 | if (encoding->flags & IW_ENCODE_DISABLED) { | ||
1578 | /* Encoding disabled, | ||
1579 | * authen = DOT11_AUTH_OS; | ||
1580 | * invoke = 0; | ||
1581 | * exunencrypt = 0; */ | ||
1582 | } | ||
1583 | if (encoding->flags & IW_ENCODE_OPEN) { | ||
1584 | /* Encode but accept non-encoded packets. No auth */ | ||
1585 | invoke = 1; | ||
1586 | } | ||
1587 | if (encoding->flags & IW_ENCODE_RESTRICTED) { | ||
1588 | /* Refuse non-encoded packets. Auth */ | ||
1589 | authen = DOT11_AUTH_BOTH; | ||
1590 | invoke = 1; | ||
1591 | exunencrypt = 1; | ||
1592 | } | ||
1593 | |||
1594 | /* do the change if requested */ | ||
1595 | if (encoding->flags & IW_ENCODE_MODE) { | ||
1596 | ret = mgt_set_request(priv, DOT11_OID_AUTHENABLE, 0, | ||
1597 | &authen); | ||
1598 | ret = mgt_set_request(priv, DOT11_OID_PRIVACYINVOKED, 0, | ||
1599 | &invoke); | ||
1600 | ret = mgt_set_request(priv, DOT11_OID_EXUNENCRYPTED, 0, | ||
1601 | &exunencrypt); | ||
1602 | } | ||
1603 | |||
1604 | out: | ||
1605 | return ret; | ||
1606 | } | ||
1607 | |||
1608 | |||
1609 | static int prism54_get_encodeext(struct net_device *ndev, | ||
1610 | struct iw_request_info *info, | ||
1611 | union iwreq_data *wrqu, | ||
1612 | char *extra) | ||
1613 | { | ||
1614 | islpci_private *priv = netdev_priv(ndev); | ||
1615 | struct iw_point *encoding = &wrqu->encoding; | ||
1616 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | ||
1617 | int idx, max_key_len; | ||
1618 | union oid_res_t r; | ||
1619 | int authen = DOT11_AUTH_OS, invoke = 0, exunencrypt = 0, wpa = 0; | ||
1620 | int ret = 0; | ||
1621 | |||
1622 | if (islpci_get_state(priv) < PRV_STATE_INIT) | ||
1623 | return 0; | ||
1624 | |||
1625 | /* first get the flags */ | ||
1626 | ret = mgt_get_request(priv, DOT11_OID_AUTHENABLE, 0, NULL, &r); | ||
1627 | authen = r.u; | ||
1628 | ret = mgt_get_request(priv, DOT11_OID_PRIVACYINVOKED, 0, NULL, &r); | ||
1629 | invoke = r.u; | ||
1630 | ret = mgt_get_request(priv, DOT11_OID_EXUNENCRYPTED, 0, NULL, &r); | ||
1631 | exunencrypt = r.u; | ||
1632 | if (ret < 0) | ||
1633 | goto out; | ||
1634 | |||
1635 | max_key_len = encoding->length - sizeof(*ext); | ||
1636 | if (max_key_len < 0) | ||
1637 | return -EINVAL; | ||
1638 | |||
1639 | idx = (encoding->flags & IW_ENCODE_INDEX) - 1; | ||
1640 | if (idx) { | ||
1641 | if (idx < 0 || idx > 3) | ||
1642 | return -EINVAL; | ||
1643 | } else { | ||
1644 | ret = mgt_get_request(priv, DOT11_OID_DEFKEYID, 0, NULL, &r); | ||
1645 | if (ret < 0) | ||
1646 | goto out; | ||
1647 | idx = r.u; | ||
1648 | } | ||
1649 | |||
1650 | encoding->flags = idx + 1; | ||
1651 | memset(ext, 0, sizeof(*ext)); | ||
1652 | |||
1653 | switch (authen) { | ||
1654 | case DOT11_AUTH_BOTH: | ||
1655 | case DOT11_AUTH_SK: | ||
1656 | wrqu->encoding.flags |= IW_ENCODE_RESTRICTED; | ||
1657 | case DOT11_AUTH_OS: | ||
1658 | default: | ||
1659 | wrqu->encoding.flags |= IW_ENCODE_OPEN; | ||
1660 | break; | ||
1661 | } | ||
1662 | |||
1663 | down_write(&priv->mib_sem); | ||
1664 | wpa = priv->wpa; | ||
1665 | up_write(&priv->mib_sem); | ||
1666 | |||
1667 | if (authen == DOT11_AUTH_OS && !exunencrypt && !invoke && !wpa) { | ||
1668 | /* No encryption */ | ||
1669 | ext->alg = IW_ENCODE_ALG_NONE; | ||
1670 | ext->key_len = 0; | ||
1671 | wrqu->encoding.flags |= IW_ENCODE_DISABLED; | ||
1672 | } else { | ||
1673 | struct obj_key *key; | ||
1674 | |||
1675 | ret = mgt_get_request(priv, DOT11_OID_DEFKEYX, idx, NULL, &r); | ||
1676 | if (ret < 0) | ||
1677 | goto out; | ||
1678 | key = r.ptr; | ||
1679 | if (max_key_len < key->length) { | ||
1680 | ret = -E2BIG; | ||
1681 | goto out; | ||
1682 | } | ||
1683 | memcpy(ext->key, key->key, key->length); | ||
1684 | ext->key_len = key->length; | ||
1685 | |||
1686 | switch (key->type) { | ||
1687 | case DOT11_PRIV_TKIP: | ||
1688 | ext->alg = IW_ENCODE_ALG_TKIP; | ||
1689 | break; | ||
1690 | default: | ||
1691 | case DOT11_PRIV_WEP: | ||
1692 | ext->alg = IW_ENCODE_ALG_WEP; | ||
1693 | break; | ||
1694 | } | ||
1695 | wrqu->encoding.flags |= IW_ENCODE_ENABLED; | ||
1696 | } | ||
1697 | |||
1698 | out: | ||
1699 | return ret; | ||
1700 | } | ||
1701 | |||
1702 | |||
1213 | static int | 1703 | static int |
1214 | prism54_reset(struct net_device *ndev, struct iw_request_info *info, | 1704 | prism54_reset(struct net_device *ndev, struct iw_request_info *info, |
1215 | __u32 * uwrq, char *extra) | 1705 | __u32 * uwrq, char *extra) |
@@ -1591,8 +2081,8 @@ static u8 wpa_oid[4] = { 0x00, 0x50, 0xf2, 1 }; | |||
1591 | #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" | 2081 | #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" |
1592 | 2082 | ||
1593 | static void | 2083 | static void |
1594 | prism54_wpa_ie_add(islpci_private *priv, u8 *bssid, | 2084 | prism54_wpa_bss_ie_add(islpci_private *priv, u8 *bssid, |
1595 | u8 *wpa_ie, size_t wpa_ie_len) | 2085 | u8 *wpa_ie, size_t wpa_ie_len) |
1596 | { | 2086 | { |
1597 | struct list_head *ptr; | 2087 | struct list_head *ptr; |
1598 | struct islpci_bss_wpa_ie *bss = NULL; | 2088 | struct islpci_bss_wpa_ie *bss = NULL; |
@@ -1658,7 +2148,7 @@ prism54_wpa_ie_add(islpci_private *priv, u8 *bssid, | |||
1658 | } | 2148 | } |
1659 | 2149 | ||
1660 | static size_t | 2150 | static size_t |
1661 | prism54_wpa_ie_get(islpci_private *priv, u8 *bssid, u8 *wpa_ie) | 2151 | prism54_wpa_bss_ie_get(islpci_private *priv, u8 *bssid, u8 *wpa_ie) |
1662 | { | 2152 | { |
1663 | struct list_head *ptr; | 2153 | struct list_head *ptr; |
1664 | struct islpci_bss_wpa_ie *bss = NULL; | 2154 | struct islpci_bss_wpa_ie *bss = NULL; |
@@ -1683,14 +2173,14 @@ prism54_wpa_ie_get(islpci_private *priv, u8 *bssid, u8 *wpa_ie) | |||
1683 | } | 2173 | } |
1684 | 2174 | ||
1685 | void | 2175 | void |
1686 | prism54_wpa_ie_init(islpci_private *priv) | 2176 | prism54_wpa_bss_ie_init(islpci_private *priv) |
1687 | { | 2177 | { |
1688 | INIT_LIST_HEAD(&priv->bss_wpa_list); | 2178 | INIT_LIST_HEAD(&priv->bss_wpa_list); |
1689 | sema_init(&priv->wpa_sem, 1); | 2179 | sema_init(&priv->wpa_sem, 1); |
1690 | } | 2180 | } |
1691 | 2181 | ||
1692 | void | 2182 | void |
1693 | prism54_wpa_ie_clean(islpci_private *priv) | 2183 | prism54_wpa_bss_ie_clean(islpci_private *priv) |
1694 | { | 2184 | { |
1695 | struct list_head *ptr, *n; | 2185 | struct list_head *ptr, *n; |
1696 | 2186 | ||
@@ -1722,7 +2212,7 @@ prism54_process_bss_data(islpci_private *priv, u32 oid, u8 *addr, | |||
1722 | } | 2212 | } |
1723 | if (pos[0] == WLAN_EID_GENERIC && pos[1] >= 4 && | 2213 | if (pos[0] == WLAN_EID_GENERIC && pos[1] >= 4 && |
1724 | memcmp(pos + 2, wpa_oid, 4) == 0) { | 2214 | memcmp(pos + 2, wpa_oid, 4) == 0) { |
1725 | prism54_wpa_ie_add(priv, addr, pos, pos[1] + 2); | 2215 | prism54_wpa_bss_ie_add(priv, addr, pos, pos[1] + 2); |
1726 | return; | 2216 | return; |
1727 | } | 2217 | } |
1728 | pos += 2 + pos[1]; | 2218 | pos += 2 + pos[1]; |
@@ -1879,7 +2369,7 @@ prism54_process_trap_helper(islpci_private *priv, enum oid_num_t oid, | |||
1879 | send_formatted_event(priv, "Associate request (ex)", mlme, 1); | 2369 | send_formatted_event(priv, "Associate request (ex)", mlme, 1); |
1880 | 2370 | ||
1881 | if (priv->iw_mode != IW_MODE_MASTER | 2371 | if (priv->iw_mode != IW_MODE_MASTER |
1882 | && mlmeex->state != DOT11_STATE_AUTHING) | 2372 | && mlmeex->state != DOT11_STATE_ASSOCING) |
1883 | break; | 2373 | break; |
1884 | 2374 | ||
1885 | confirm = kmalloc(sizeof(struct obj_mlmeex), GFP_ATOMIC); | 2375 | confirm = kmalloc(sizeof(struct obj_mlmeex), GFP_ATOMIC); |
@@ -1893,7 +2383,7 @@ prism54_process_trap_helper(islpci_private *priv, enum oid_num_t oid, | |||
1893 | confirm->state = 0; /* not used */ | 2383 | confirm->state = 0; /* not used */ |
1894 | confirm->code = 0; | 2384 | confirm->code = 0; |
1895 | 2385 | ||
1896 | wpa_ie_len = prism54_wpa_ie_get(priv, mlmeex->address, wpa_ie); | 2386 | wpa_ie_len = prism54_wpa_bss_ie_get(priv, mlmeex->address, wpa_ie); |
1897 | 2387 | ||
1898 | if (!wpa_ie_len) { | 2388 | if (!wpa_ie_len) { |
1899 | printk(KERN_DEBUG "No WPA IE found from " | 2389 | printk(KERN_DEBUG "No WPA IE found from " |
@@ -1937,7 +2427,7 @@ prism54_process_trap_helper(islpci_private *priv, enum oid_num_t oid, | |||
1937 | confirm->state = 0; /* not used */ | 2427 | confirm->state = 0; /* not used */ |
1938 | confirm->code = 0; | 2428 | confirm->code = 0; |
1939 | 2429 | ||
1940 | wpa_ie_len = prism54_wpa_ie_get(priv, mlmeex->address, wpa_ie); | 2430 | wpa_ie_len = prism54_wpa_bss_ie_get(priv, mlmeex->address, wpa_ie); |
1941 | 2431 | ||
1942 | if (!wpa_ie_len) { | 2432 | if (!wpa_ie_len) { |
1943 | printk(KERN_DEBUG "No WPA IE found from " | 2433 | printk(KERN_DEBUG "No WPA IE found from " |
@@ -2553,6 +3043,15 @@ static const iw_handler prism54_handler[] = { | |||
2553 | (iw_handler) prism54_get_encode, /* SIOCGIWENCODE */ | 3043 | (iw_handler) prism54_get_encode, /* SIOCGIWENCODE */ |
2554 | (iw_handler) NULL, /* SIOCSIWPOWER */ | 3044 | (iw_handler) NULL, /* SIOCSIWPOWER */ |
2555 | (iw_handler) NULL, /* SIOCGIWPOWER */ | 3045 | (iw_handler) NULL, /* SIOCGIWPOWER */ |
3046 | NULL, /* -- hole -- */ | ||
3047 | NULL, /* -- hole -- */ | ||
3048 | (iw_handler) prism54_set_genie, /* SIOCSIWGENIE */ | ||
3049 | (iw_handler) prism54_get_genie, /* SIOCGIWGENIE */ | ||
3050 | (iw_handler) prism54_set_auth, /* SIOCSIWAUTH */ | ||
3051 | (iw_handler) prism54_get_auth, /* SIOCGIWAUTH */ | ||
3052 | (iw_handler) prism54_set_encodeext, /* SIOCSIWENCODEEXT */ | ||
3053 | (iw_handler) prism54_get_encodeext, /* SIOCGIWENCODEEXT */ | ||
3054 | NULL, /* SIOCSIWPMKSA */ | ||
2556 | }; | 3055 | }; |
2557 | 3056 | ||
2558 | /* The low order bit identify a SET (0) or a GET (1) ioctl. */ | 3057 | /* The low order bit identify a SET (0) or a GET (1) ioctl. */ |
diff --git a/drivers/net/wireless/prism54/isl_ioctl.h b/drivers/net/wireless/prism54/isl_ioctl.h index 46d5cde80c85..65f33acd0a42 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.h +++ b/drivers/net/wireless/prism54/isl_ioctl.h | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | #include <net/iw_handler.h> /* New driver API */ | 28 | #include <net/iw_handler.h> /* New driver API */ |
29 | 29 | ||
30 | #define SUPPORTED_WIRELESS_EXT 16 | 30 | #define SUPPORTED_WIRELESS_EXT 19 |
31 | 31 | ||
32 | void prism54_mib_init(islpci_private *); | 32 | void prism54_mib_init(islpci_private *); |
33 | 33 | ||
@@ -39,8 +39,8 @@ void prism54_acl_clean(struct islpci_acl *); | |||
39 | 39 | ||
40 | void prism54_process_trap(void *); | 40 | void prism54_process_trap(void *); |
41 | 41 | ||
42 | void prism54_wpa_ie_init(islpci_private *priv); | 42 | void prism54_wpa_bss_ie_init(islpci_private *priv); |
43 | void prism54_wpa_ie_clean(islpci_private *priv); | 43 | void prism54_wpa_bss_ie_clean(islpci_private *priv); |
44 | 44 | ||
45 | int prism54_set_mac_address(struct net_device *, void *); | 45 | int prism54_set_mac_address(struct net_device *, void *); |
46 | 46 | ||
diff --git a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c index 5ddf29599032..ab3c5a27efd9 100644 --- a/drivers/net/wireless/prism54/islpci_dev.c +++ b/drivers/net/wireless/prism54/islpci_dev.c | |||
@@ -715,7 +715,7 @@ islpci_alloc_memory(islpci_private *priv) | |||
715 | } | 715 | } |
716 | 716 | ||
717 | prism54_acl_init(&priv->acl); | 717 | prism54_acl_init(&priv->acl); |
718 | prism54_wpa_ie_init(priv); | 718 | prism54_wpa_bss_ie_init(priv); |
719 | if (mgt_init(priv)) | 719 | if (mgt_init(priv)) |
720 | goto out_free; | 720 | goto out_free; |
721 | 721 | ||
@@ -774,7 +774,7 @@ islpci_free_memory(islpci_private *priv) | |||
774 | 774 | ||
775 | /* Free the acces control list and the WPA list */ | 775 | /* Free the acces control list and the WPA list */ |
776 | prism54_acl_clean(&priv->acl); | 776 | prism54_acl_clean(&priv->acl); |
777 | prism54_wpa_ie_clean(priv); | 777 | prism54_wpa_bss_ie_clean(priv); |
778 | mgt_clean(priv); | 778 | mgt_clean(priv); |
779 | 779 | ||
780 | return 0; | 780 | return 0; |
diff --git a/drivers/net/wireless/prism54/islpci_dev.h b/drivers/net/wireless/prism54/islpci_dev.h index 07053165e4c5..5049f37455b1 100644 --- a/drivers/net/wireless/prism54/islpci_dev.h +++ b/drivers/net/wireless/prism54/islpci_dev.h | |||
@@ -179,6 +179,8 @@ typedef struct { | |||
179 | struct list_head bss_wpa_list; | 179 | struct list_head bss_wpa_list; |
180 | int num_bss_wpa; | 180 | int num_bss_wpa; |
181 | struct semaphore wpa_sem; | 181 | struct semaphore wpa_sem; |
182 | u8 wpa_ie[MAX_WPA_IE_LEN]; | ||
183 | size_t wpa_ie_len; | ||
182 | 184 | ||
183 | struct work_struct reset_task; | 185 | struct work_struct reset_task; |
184 | int reset_task_pending; | 186 | int reset_task_pending; |
diff --git a/drivers/net/wireless/prism54/islpci_hotplug.c b/drivers/net/wireless/prism54/islpci_hotplug.c index 09fc17a0f029..f692dccf0d07 100644 --- a/drivers/net/wireless/prism54/islpci_hotplug.c +++ b/drivers/net/wireless/prism54/islpci_hotplug.c | |||
@@ -313,7 +313,7 @@ prism54_module_init(void) | |||
313 | 313 | ||
314 | __bug_on_wrong_struct_sizes (); | 314 | __bug_on_wrong_struct_sizes (); |
315 | 315 | ||
316 | return pci_module_init(&prism54_driver); | 316 | return pci_register_driver(&prism54_driver); |
317 | } | 317 | } |
318 | 318 | ||
319 | /* by the time prism54_module_exit() terminates, as a postcondition | 319 | /* by the time prism54_module_exit() terminates, as a postcondition |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 61b83a5e737a..8e112d139e29 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -52,8 +52,8 @@ | |||
52 | #include <pcmcia/ds.h> | 52 | #include <pcmcia/ds.h> |
53 | #include <pcmcia/mem_op.h> | 53 | #include <pcmcia/mem_op.h> |
54 | 54 | ||
55 | #include <net/ieee80211.h> | ||
56 | #include <linux/wireless.h> | 55 | #include <linux/wireless.h> |
56 | #include <net/iw_handler.h> | ||
57 | 57 | ||
58 | #include <asm/io.h> | 58 | #include <asm/io.h> |
59 | #include <asm/system.h> | 59 | #include <asm/system.h> |
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index 7f78b7801fb3..bcc7038130f6 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c | |||
@@ -242,7 +242,7 @@ spectrum_reset(struct pcmcia_device *link, int idle) | |||
242 | u_int save_cor; | 242 | u_int save_cor; |
243 | 243 | ||
244 | /* Doing it if hardware is gone is guaranteed crash */ | 244 | /* Doing it if hardware is gone is guaranteed crash */ |
245 | if (pcmcia_dev_present(link)) | 245 | if (!pcmcia_dev_present(link)) |
246 | return -ENODEV; | 246 | return -ENODEV; |
247 | 247 | ||
248 | /* Save original COR value */ | 248 | /* Save original COR value */ |
diff --git a/drivers/net/wireless/zd1211rw/Makefile b/drivers/net/wireless/zd1211rw/Makefile index 500314fc74d2..6603ad5be63d 100644 --- a/drivers/net/wireless/zd1211rw/Makefile +++ b/drivers/net/wireless/zd1211rw/Makefile | |||
@@ -3,6 +3,7 @@ obj-$(CONFIG_ZD1211RW) += zd1211rw.o | |||
3 | zd1211rw-objs := zd_chip.o zd_ieee80211.o \ | 3 | zd1211rw-objs := zd_chip.o zd_ieee80211.o \ |
4 | zd_mac.o zd_netdev.o \ | 4 | zd_mac.o zd_netdev.o \ |
5 | zd_rf_al2230.o zd_rf_rf2959.o \ | 5 | zd_rf_al2230.o zd_rf_rf2959.o \ |
6 | zd_rf_al7230b.o \ | ||
6 | zd_rf.o zd_usb.o zd_util.o | 7 | zd_rf.o zd_usb.o zd_util.o |
7 | 8 | ||
8 | ifeq ($(CONFIG_ZD1211RW_DEBUG),y) | 9 | ifeq ($(CONFIG_ZD1211RW_DEBUG),y) |
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c index da9d06bdb818..58419985e00f 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.c +++ b/drivers/net/wireless/zd1211rw/zd_chip.c | |||
@@ -42,12 +42,11 @@ void zd_chip_init(struct zd_chip *chip, | |||
42 | 42 | ||
43 | void zd_chip_clear(struct zd_chip *chip) | 43 | void zd_chip_clear(struct zd_chip *chip) |
44 | { | 44 | { |
45 | mutex_lock(&chip->mutex); | 45 | ZD_ASSERT(!mutex_is_locked(&chip->mutex)); |
46 | zd_usb_clear(&chip->usb); | 46 | zd_usb_clear(&chip->usb); |
47 | zd_rf_clear(&chip->rf); | 47 | zd_rf_clear(&chip->rf); |
48 | mutex_unlock(&chip->mutex); | ||
49 | mutex_destroy(&chip->mutex); | 48 | mutex_destroy(&chip->mutex); |
50 | memset(chip, 0, sizeof(*chip)); | 49 | ZD_MEMCLEAR(chip, sizeof(*chip)); |
51 | } | 50 | } |
52 | 51 | ||
53 | static int scnprint_mac_oui(const u8 *addr, char *buffer, size_t size) | 52 | static int scnprint_mac_oui(const u8 *addr, char *buffer, size_t size) |
@@ -68,10 +67,11 @@ static int scnprint_id(struct zd_chip *chip, char *buffer, size_t size) | |||
68 | i += scnprint_mac_oui(chip->e2p_mac, buffer+i, size-i); | 67 | i += scnprint_mac_oui(chip->e2p_mac, buffer+i, size-i); |
69 | i += scnprintf(buffer+i, size-i, " "); | 68 | i += scnprintf(buffer+i, size-i, " "); |
70 | i += zd_rf_scnprint_id(&chip->rf, buffer+i, size-i); | 69 | i += zd_rf_scnprint_id(&chip->rf, buffer+i, size-i); |
71 | i += scnprintf(buffer+i, size-i, " pa%1x %c%c%c", chip->pa_type, | 70 | i += scnprintf(buffer+i, size-i, " pa%1x %c%c%c%c", chip->pa_type, |
72 | chip->patch_cck_gain ? 'g' : '-', | 71 | chip->patch_cck_gain ? 'g' : '-', |
73 | chip->patch_cr157 ? '7' : '-', | 72 | chip->patch_cr157 ? '7' : '-', |
74 | chip->patch_6m_band_edge ? '6' : '-'); | 73 | chip->patch_6m_band_edge ? '6' : '-', |
74 | chip->new_phy_layout ? 'N' : '-'); | ||
75 | return i; | 75 | return i; |
76 | } | 76 | } |
77 | 77 | ||
@@ -330,13 +330,14 @@ static int read_pod(struct zd_chip *chip, u8 *rf_type) | |||
330 | chip->patch_cck_gain = (value >> 8) & 0x1; | 330 | chip->patch_cck_gain = (value >> 8) & 0x1; |
331 | chip->patch_cr157 = (value >> 13) & 0x1; | 331 | chip->patch_cr157 = (value >> 13) & 0x1; |
332 | chip->patch_6m_band_edge = (value >> 21) & 0x1; | 332 | chip->patch_6m_band_edge = (value >> 21) & 0x1; |
333 | chip->new_phy_layout = (value >> 31) & 0x1; | ||
333 | 334 | ||
334 | dev_dbg_f(zd_chip_dev(chip), | 335 | dev_dbg_f(zd_chip_dev(chip), |
335 | "RF %s %#01x PA type %#01x patch CCK %d patch CR157 %d " | 336 | "RF %s %#01x PA type %#01x patch CCK %d patch CR157 %d " |
336 | "patch 6M %d\n", | 337 | "patch 6M %d new PHY %d\n", |
337 | zd_rf_name(*rf_type), *rf_type, | 338 | zd_rf_name(*rf_type), *rf_type, |
338 | chip->pa_type, chip->patch_cck_gain, | 339 | chip->pa_type, chip->patch_cck_gain, |
339 | chip->patch_cr157, chip->patch_6m_band_edge); | 340 | chip->patch_cr157, chip->patch_6m_band_edge, chip->new_phy_layout); |
340 | return 0; | 341 | return 0; |
341 | error: | 342 | error: |
342 | *rf_type = 0; | 343 | *rf_type = 0; |
@@ -344,6 +345,7 @@ error: | |||
344 | chip->patch_cck_gain = 0; | 345 | chip->patch_cck_gain = 0; |
345 | chip->patch_cr157 = 0; | 346 | chip->patch_cr157 = 0; |
346 | chip->patch_6m_band_edge = 0; | 347 | chip->patch_6m_band_edge = 0; |
348 | chip->new_phy_layout = 0; | ||
347 | return r; | 349 | return r; |
348 | } | 350 | } |
349 | 351 | ||
@@ -717,7 +719,7 @@ static int zd1211b_hw_reset_phy(struct zd_chip *chip) | |||
717 | { CR21, 0x0e }, { CR22, 0x23 }, { CR23, 0x90 }, | 719 | { CR21, 0x0e }, { CR22, 0x23 }, { CR23, 0x90 }, |
718 | { CR24, 0x14 }, { CR25, 0x40 }, { CR26, 0x10 }, | 720 | { CR24, 0x14 }, { CR25, 0x40 }, { CR26, 0x10 }, |
719 | { CR27, 0x10 }, { CR28, 0x7f }, { CR29, 0x80 }, | 721 | { CR27, 0x10 }, { CR28, 0x7f }, { CR29, 0x80 }, |
720 | { CR30, 0x49 }, /* jointly decoder, no ASIC */ | 722 | { CR30, 0x4b }, /* ASIC/FWT, no jointly decoder */ |
721 | { CR31, 0x60 }, { CR32, 0x43 }, { CR33, 0x08 }, | 723 | { CR31, 0x60 }, { CR32, 0x43 }, { CR33, 0x08 }, |
722 | { CR34, 0x06 }, { CR35, 0x0a }, { CR36, 0x00 }, | 724 | { CR34, 0x06 }, { CR35, 0x0a }, { CR36, 0x00 }, |
723 | { CR37, 0x00 }, { CR38, 0x38 }, { CR39, 0x0c }, | 725 | { CR37, 0x00 }, { CR38, 0x38 }, { CR39, 0x0c }, |
@@ -807,7 +809,6 @@ static int zd1211_hw_init_hmac(struct zd_chip *chip) | |||
807 | { CR_ACK_TIMEOUT_EXT, 0x80 }, | 809 | { CR_ACK_TIMEOUT_EXT, 0x80 }, |
808 | { CR_ADDA_PWR_DWN, 0x00 }, | 810 | { CR_ADDA_PWR_DWN, 0x00 }, |
809 | { CR_ACK_TIME_80211, 0x100 }, | 811 | { CR_ACK_TIME_80211, 0x100 }, |
810 | { CR_IFS_VALUE, 0x547c032 }, | ||
811 | { CR_RX_PE_DELAY, 0x70 }, | 812 | { CR_RX_PE_DELAY, 0x70 }, |
812 | { CR_PS_CTRL, 0x10000000 }, | 813 | { CR_PS_CTRL, 0x10000000 }, |
813 | { CR_RTS_CTS_RATE, 0x02030203 }, | 814 | { CR_RTS_CTS_RATE, 0x02030203 }, |
@@ -854,11 +855,10 @@ static int zd1211b_hw_init_hmac(struct zd_chip *chip) | |||
854 | { CR_ACK_TIMEOUT_EXT, 0x80 }, | 855 | { CR_ACK_TIMEOUT_EXT, 0x80 }, |
855 | { CR_ADDA_PWR_DWN, 0x00 }, | 856 | { CR_ADDA_PWR_DWN, 0x00 }, |
856 | { CR_ACK_TIME_80211, 0x100 }, | 857 | { CR_ACK_TIME_80211, 0x100 }, |
857 | { CR_IFS_VALUE, 0x547c032 }, | ||
858 | { CR_RX_PE_DELAY, 0x70 }, | 858 | { CR_RX_PE_DELAY, 0x70 }, |
859 | { CR_PS_CTRL, 0x10000000 }, | 859 | { CR_PS_CTRL, 0x10000000 }, |
860 | { CR_RTS_CTS_RATE, 0x02030203 }, | 860 | { CR_RTS_CTS_RATE, 0x02030203 }, |
861 | { CR_RX_THRESHOLD, 0x000c0640 }, | 861 | { CR_RX_THRESHOLD, 0x000c0eff, }, |
862 | { CR_AFTER_PNP, 0x1 }, | 862 | { CR_AFTER_PNP, 0x1 }, |
863 | { CR_WEP_PROTECT, 0x114 }, | 863 | { CR_WEP_PROTECT, 0x114 }, |
864 | }; | 864 | }; |
@@ -970,10 +970,15 @@ static int hw_init(struct zd_chip *chip) | |||
970 | r = hw_init_hmac(chip); | 970 | r = hw_init_hmac(chip); |
971 | if (r) | 971 | if (r) |
972 | return r; | 972 | return r; |
973 | r = set_beacon_interval(chip, 100); | 973 | |
974 | /* Although the vendor driver defaults to a different value during | ||
975 | * init, it overwrites the IFS value with the following every time | ||
976 | * the channel changes. We should aim to be more intelligent... */ | ||
977 | r = zd_iowrite32_locked(chip, IFS_VALUE_DEFAULT, CR_IFS_VALUE); | ||
974 | if (r) | 978 | if (r) |
975 | return r; | 979 | return r; |
976 | return 0; | 980 | |
981 | return set_beacon_interval(chip, 100); | ||
977 | } | 982 | } |
978 | 983 | ||
979 | #ifdef DEBUG | 984 | #ifdef DEBUG |
@@ -1613,3 +1618,34 @@ int zd_rfwritev_locked(struct zd_chip *chip, | |||
1613 | 1618 | ||
1614 | return 0; | 1619 | return 0; |
1615 | } | 1620 | } |
1621 | |||
1622 | /* | ||
1623 | * We can optionally program the RF directly through CR regs, if supported by | ||
1624 | * the hardware. This is much faster than the older method. | ||
1625 | */ | ||
1626 | int zd_rfwrite_cr_locked(struct zd_chip *chip, u32 value) | ||
1627 | { | ||
1628 | struct zd_ioreq16 ioreqs[] = { | ||
1629 | { CR244, (value >> 16) & 0xff }, | ||
1630 | { CR243, (value >> 8) & 0xff }, | ||
1631 | { CR242, value & 0xff }, | ||
1632 | }; | ||
1633 | ZD_ASSERT(mutex_is_locked(&chip->mutex)); | ||
1634 | return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); | ||
1635 | } | ||
1636 | |||
1637 | int zd_rfwritev_cr_locked(struct zd_chip *chip, | ||
1638 | const u32 *values, unsigned int count) | ||
1639 | { | ||
1640 | int r; | ||
1641 | unsigned int i; | ||
1642 | |||
1643 | for (i = 0; i < count; i++) { | ||
1644 | r = zd_rfwrite_cr_locked(chip, values[i]); | ||
1645 | if (r) | ||
1646 | return r; | ||
1647 | } | ||
1648 | |||
1649 | return 0; | ||
1650 | } | ||
1651 | |||
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h index 069d2b467339..4b1250859897 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.h +++ b/drivers/net/wireless/zd1211rw/zd_chip.h | |||
@@ -473,7 +473,15 @@ | |||
473 | 473 | ||
474 | #define CR_ACK_TIMEOUT_EXT CTL_REG(0x0690) | 474 | #define CR_ACK_TIMEOUT_EXT CTL_REG(0x0690) |
475 | #define CR_BCN_FIFO_SEMAPHORE CTL_REG(0x0694) | 475 | #define CR_BCN_FIFO_SEMAPHORE CTL_REG(0x0694) |
476 | |||
476 | #define CR_IFS_VALUE CTL_REG(0x0698) | 477 | #define CR_IFS_VALUE CTL_REG(0x0698) |
478 | #define IFS_VALUE_DIFS_SH 0 | ||
479 | #define IFS_VALUE_EIFS_SH 12 | ||
480 | #define IFS_VALUE_SIFS_SH 24 | ||
481 | #define IFS_VALUE_DEFAULT (( 50 << IFS_VALUE_DIFS_SH) | \ | ||
482 | (1148 << IFS_VALUE_EIFS_SH) | \ | ||
483 | ( 10 << IFS_VALUE_SIFS_SH)) | ||
484 | |||
477 | #define CR_RX_TIME_OUT CTL_REG(0x069C) | 485 | #define CR_RX_TIME_OUT CTL_REG(0x069C) |
478 | #define CR_TOTAL_RX_FRM CTL_REG(0x06A0) | 486 | #define CR_TOTAL_RX_FRM CTL_REG(0x06A0) |
479 | #define CR_CRC32_CNT CTL_REG(0x06A4) | 487 | #define CR_CRC32_CNT CTL_REG(0x06A4) |
@@ -630,6 +638,7 @@ enum { | |||
630 | LOAD_CODE_SIZE = 0xe, /* words */ | 638 | LOAD_CODE_SIZE = 0xe, /* words */ |
631 | LOAD_VECT_SIZE = 0x10000 - 0xfff7, /* words */ | 639 | LOAD_VECT_SIZE = 0x10000 - 0xfff7, /* words */ |
632 | EEPROM_REGS_OFFSET = LOAD_CODE_SIZE + LOAD_VECT_SIZE, | 640 | EEPROM_REGS_OFFSET = LOAD_CODE_SIZE + LOAD_VECT_SIZE, |
641 | EEPROM_REGS_SIZE = 0x7e, /* words */ | ||
633 | E2P_BASE_OFFSET = EEPROM_START_OFFSET + | 642 | E2P_BASE_OFFSET = EEPROM_START_OFFSET + |
634 | EEPROM_REGS_OFFSET, | 643 | EEPROM_REGS_OFFSET, |
635 | }; | 644 | }; |
@@ -655,7 +664,7 @@ struct zd_chip { | |||
655 | /* SetPointOFDM in the vendor driver */ | 664 | /* SetPointOFDM in the vendor driver */ |
656 | u8 ofdm_cal_values[3][E2P_CHANNEL_COUNT]; | 665 | u8 ofdm_cal_values[3][E2P_CHANNEL_COUNT]; |
657 | u8 pa_type:4, patch_cck_gain:1, patch_cr157:1, patch_6m_band_edge:1, | 666 | u8 pa_type:4, patch_cck_gain:1, patch_cr157:1, patch_6m_band_edge:1, |
658 | is_zd1211b:1; | 667 | new_phy_layout:1, is_zd1211b:1; |
659 | }; | 668 | }; |
660 | 669 | ||
661 | static inline struct zd_chip *zd_usb_to_chip(struct zd_usb *usb) | 670 | static inline struct zd_chip *zd_usb_to_chip(struct zd_usb *usb) |
@@ -739,8 +748,12 @@ static inline int zd_rfwrite_locked(struct zd_chip *chip, u32 value, u8 bits) | |||
739 | return zd_usb_rfwrite(&chip->usb, value, bits); | 748 | return zd_usb_rfwrite(&chip->usb, value, bits); |
740 | } | 749 | } |
741 | 750 | ||
751 | int zd_rfwrite_cr_locked(struct zd_chip *chip, u32 value); | ||
752 | |||
742 | int zd_rfwritev_locked(struct zd_chip *chip, | 753 | int zd_rfwritev_locked(struct zd_chip *chip, |
743 | const u32* values, unsigned int count, u8 bits); | 754 | const u32* values, unsigned int count, u8 bits); |
755 | int zd_rfwritev_cr_locked(struct zd_chip *chip, | ||
756 | const u32* values, unsigned int count); | ||
744 | 757 | ||
745 | /* Locking functions for reading and writing registers. | 758 | /* Locking functions for reading and writing registers. |
746 | * The different parameters are intentional. | 759 | * The different parameters are intentional. |
diff --git a/drivers/net/wireless/zd1211rw/zd_def.h b/drivers/net/wireless/zd1211rw/zd_def.h index 465906812fc4..a13ec72eb304 100644 --- a/drivers/net/wireless/zd1211rw/zd_def.h +++ b/drivers/net/wireless/zd1211rw/zd_def.h | |||
@@ -45,4 +45,10 @@ do { \ | |||
45 | # define ZD_ASSERT(x) do { } while (0) | 45 | # define ZD_ASSERT(x) do { } while (0) |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | #ifdef DEBUG | ||
49 | # define ZD_MEMCLEAR(pointer, size) memset((pointer), 0xff, (size)) | ||
50 | #else | ||
51 | # define ZD_MEMCLEAR(pointer, size) do { } while (0) | ||
52 | #endif | ||
53 | |||
48 | #endif /* _ZD_DEF_H */ | 54 | #endif /* _ZD_DEF_H */ |
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index d6f3e02a0b54..0eda534a648c 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -127,11 +127,9 @@ out: | |||
127 | 127 | ||
128 | void zd_mac_clear(struct zd_mac *mac) | 128 | void zd_mac_clear(struct zd_mac *mac) |
129 | { | 129 | { |
130 | /* Aquire the lock. */ | ||
131 | spin_lock(&mac->lock); | ||
132 | spin_unlock(&mac->lock); | ||
133 | zd_chip_clear(&mac->chip); | 130 | zd_chip_clear(&mac->chip); |
134 | memset(mac, 0, sizeof(*mac)); | 131 | ZD_ASSERT(!spin_is_locked(&mac->lock)); |
132 | ZD_MEMCLEAR(mac, sizeof(struct zd_mac)); | ||
135 | } | 133 | } |
136 | 134 | ||
137 | static int reset_mode(struct zd_mac *mac) | 135 | static int reset_mode(struct zd_mac *mac) |
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.h b/drivers/net/wireless/zd1211rw/zd_mac.h index 71e382c589ee..082bcf8ec8dc 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.h +++ b/drivers/net/wireless/zd1211rw/zd_mac.h | |||
@@ -121,9 +121,9 @@ enum mac_flags { | |||
121 | }; | 121 | }; |
122 | 122 | ||
123 | struct zd_mac { | 123 | struct zd_mac { |
124 | struct net_device *netdev; | ||
125 | struct zd_chip chip; | 124 | struct zd_chip chip; |
126 | spinlock_t lock; | 125 | spinlock_t lock; |
126 | struct net_device *netdev; | ||
127 | /* Unlocked reading possible */ | 127 | /* Unlocked reading possible */ |
128 | struct iw_statistics iw_stats; | 128 | struct iw_statistics iw_stats; |
129 | u8 qual_average; | 129 | u8 qual_average; |
diff --git a/drivers/net/wireless/zd1211rw/zd_netdev.c b/drivers/net/wireless/zd1211rw/zd_netdev.c index 9df232c2c863..440ef24b5fd1 100644 --- a/drivers/net/wireless/zd1211rw/zd_netdev.c +++ b/drivers/net/wireless/zd1211rw/zd_netdev.c | |||
@@ -72,10 +72,18 @@ static int iw_get_name(struct net_device *netdev, | |||
72 | struct iw_request_info *info, | 72 | struct iw_request_info *info, |
73 | union iwreq_data *req, char *extra) | 73 | union iwreq_data *req, char *extra) |
74 | { | 74 | { |
75 | /* FIXME: check whether 802.11a will also supported, add also | 75 | /* FIXME: check whether 802.11a will also supported */ |
76 | * zd1211B, if we support it. | 76 | strlcpy(req->name, "IEEE 802.11b/g", IFNAMSIZ); |
77 | */ | 77 | return 0; |
78 | strlcpy(req->name, "802.11g zd1211", IFNAMSIZ); | 78 | } |
79 | |||
80 | static int iw_get_nick(struct net_device *netdev, | ||
81 | struct iw_request_info *info, | ||
82 | union iwreq_data *req, char *extra) | ||
83 | { | ||
84 | strcpy(extra, "zd1211"); | ||
85 | req->data.length = strlen(extra) + 1; | ||
86 | req->data.flags = 1; | ||
79 | return 0; | 87 | return 0; |
80 | } | 88 | } |
81 | 89 | ||
@@ -181,6 +189,7 @@ static int iw_get_encodeext(struct net_device *netdev, | |||
181 | 189 | ||
182 | static const iw_handler zd_standard_iw_handlers[] = { | 190 | static const iw_handler zd_standard_iw_handlers[] = { |
183 | WX(SIOCGIWNAME) = iw_get_name, | 191 | WX(SIOCGIWNAME) = iw_get_name, |
192 | WX(SIOCGIWNICKN) = iw_get_nick, | ||
184 | WX(SIOCSIWFREQ) = iw_set_freq, | 193 | WX(SIOCSIWFREQ) = iw_set_freq, |
185 | WX(SIOCGIWFREQ) = iw_get_freq, | 194 | WX(SIOCGIWFREQ) = iw_get_freq, |
186 | WX(SIOCSIWMODE) = iw_set_mode, | 195 | WX(SIOCSIWMODE) = iw_set_mode, |
diff --git a/drivers/net/wireless/zd1211rw/zd_rf.c b/drivers/net/wireless/zd1211rw/zd_rf.c index d3770d2c61bc..f50cff3db916 100644 --- a/drivers/net/wireless/zd1211rw/zd_rf.c +++ b/drivers/net/wireless/zd1211rw/zd_rf.c | |||
@@ -56,7 +56,7 @@ void zd_rf_init(struct zd_rf *rf) | |||
56 | 56 | ||
57 | void zd_rf_clear(struct zd_rf *rf) | 57 | void zd_rf_clear(struct zd_rf *rf) |
58 | { | 58 | { |
59 | memset(rf, 0, sizeof(*rf)); | 59 | ZD_MEMCLEAR(rf, sizeof(*rf)); |
60 | } | 60 | } |
61 | 61 | ||
62 | int zd_rf_init_hw(struct zd_rf *rf, u8 type) | 62 | int zd_rf_init_hw(struct zd_rf *rf, u8 type) |
@@ -76,6 +76,11 @@ int zd_rf_init_hw(struct zd_rf *rf, u8 type) | |||
76 | if (r) | 76 | if (r) |
77 | return r; | 77 | return r; |
78 | break; | 78 | break; |
79 | case AL7230B_RF: | ||
80 | r = zd_rf_init_al7230b(rf); | ||
81 | if (r) | ||
82 | return r; | ||
83 | break; | ||
79 | default: | 84 | default: |
80 | dev_err(zd_chip_dev(chip), | 85 | dev_err(zd_chip_dev(chip), |
81 | "RF %s %#x is not supported\n", zd_rf_name(type), type); | 86 | "RF %s %#x is not supported\n", zd_rf_name(type), type); |
diff --git a/drivers/net/wireless/zd1211rw/zd_rf.h b/drivers/net/wireless/zd1211rw/zd_rf.h index ea30f693fcc8..676b3734f1ed 100644 --- a/drivers/net/wireless/zd1211rw/zd_rf.h +++ b/drivers/net/wireless/zd1211rw/zd_rf.h | |||
@@ -78,5 +78,6 @@ int zd_switch_radio_off(struct zd_rf *rf); | |||
78 | 78 | ||
79 | int zd_rf_init_rf2959(struct zd_rf *rf); | 79 | int zd_rf_init_rf2959(struct zd_rf *rf); |
80 | int zd_rf_init_al2230(struct zd_rf *rf); | 80 | int zd_rf_init_al2230(struct zd_rf *rf); |
81 | int zd_rf_init_al7230b(struct zd_rf *rf); | ||
81 | 82 | ||
82 | #endif /* _ZD_RF_H */ | 83 | #endif /* _ZD_RF_H */ |
diff --git a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c index 0948b25f660d..25323a13a3db 100644 --- a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c +++ b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "zd_usb.h" | 21 | #include "zd_usb.h" |
22 | #include "zd_chip.h" | 22 | #include "zd_chip.h" |
23 | 23 | ||
24 | static const u32 al2230_table[][3] = { | 24 | static const u32 zd1211_al2230_table[][3] = { |
25 | RF_CHANNEL( 1) = { 0x03f790, 0x033331, 0x00000d, }, | 25 | RF_CHANNEL( 1) = { 0x03f790, 0x033331, 0x00000d, }, |
26 | RF_CHANNEL( 2) = { 0x03f790, 0x0b3331, 0x00000d, }, | 26 | RF_CHANNEL( 2) = { 0x03f790, 0x0b3331, 0x00000d, }, |
27 | RF_CHANNEL( 3) = { 0x03e790, 0x033331, 0x00000d, }, | 27 | RF_CHANNEL( 3) = { 0x03e790, 0x033331, 0x00000d, }, |
@@ -38,6 +38,53 @@ static const u32 al2230_table[][3] = { | |||
38 | RF_CHANNEL(14) = { 0x03e7c0, 0x066661, 0x00000d, }, | 38 | RF_CHANNEL(14) = { 0x03e7c0, 0x066661, 0x00000d, }, |
39 | }; | 39 | }; |
40 | 40 | ||
41 | static const u32 zd1211b_al2230_table[][3] = { | ||
42 | RF_CHANNEL( 1) = { 0x09efc0, 0x8cccc0, 0xb00000, }, | ||
43 | RF_CHANNEL( 2) = { 0x09efc0, 0x8cccd0, 0xb00000, }, | ||
44 | RF_CHANNEL( 3) = { 0x09e7c0, 0x8cccc0, 0xb00000, }, | ||
45 | RF_CHANNEL( 4) = { 0x09e7c0, 0x8cccd0, 0xb00000, }, | ||
46 | RF_CHANNEL( 5) = { 0x05efc0, 0x8cccc0, 0xb00000, }, | ||
47 | RF_CHANNEL( 6) = { 0x05efc0, 0x8cccd0, 0xb00000, }, | ||
48 | RF_CHANNEL( 7) = { 0x05e7c0, 0x8cccc0, 0xb00000, }, | ||
49 | RF_CHANNEL( 8) = { 0x05e7c0, 0x8cccd0, 0xb00000, }, | ||
50 | RF_CHANNEL( 9) = { 0x0defc0, 0x8cccc0, 0xb00000, }, | ||
51 | RF_CHANNEL(10) = { 0x0defc0, 0x8cccd0, 0xb00000, }, | ||
52 | RF_CHANNEL(11) = { 0x0de7c0, 0x8cccc0, 0xb00000, }, | ||
53 | RF_CHANNEL(12) = { 0x0de7c0, 0x8cccd0, 0xb00000, }, | ||
54 | RF_CHANNEL(13) = { 0x03efc0, 0x8cccc0, 0xb00000, }, | ||
55 | RF_CHANNEL(14) = { 0x03e7c0, 0x866660, 0xb00000, }, | ||
56 | }; | ||
57 | |||
58 | static const struct zd_ioreq16 zd1211b_ioreqs_shared_1[] = { | ||
59 | { CR240, 0x57 }, { CR9, 0xe0 }, | ||
60 | }; | ||
61 | |||
62 | static int zd1211b_al2230_finalize_rf(struct zd_chip *chip) | ||
63 | { | ||
64 | int r; | ||
65 | static const struct zd_ioreq16 ioreqs[] = { | ||
66 | { CR80, 0x30 }, { CR81, 0x30 }, { CR79, 0x58 }, | ||
67 | { CR12, 0xf0 }, { CR77, 0x1b }, { CR78, 0x58 }, | ||
68 | { CR203, 0x06 }, | ||
69 | { }, | ||
70 | |||
71 | { CR240, 0x80 }, | ||
72 | }; | ||
73 | |||
74 | r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); | ||
75 | if (r) | ||
76 | return r; | ||
77 | |||
78 | /* related to antenna selection? */ | ||
79 | if (chip->new_phy_layout) { | ||
80 | r = zd_iowrite16_locked(chip, 0xe1, CR9); | ||
81 | if (r) | ||
82 | return r; | ||
83 | } | ||
84 | |||
85 | return zd_iowrite16_locked(chip, 0x06, CR203); | ||
86 | } | ||
87 | |||
41 | static int zd1211_al2230_init_hw(struct zd_rf *rf) | 88 | static int zd1211_al2230_init_hw(struct zd_rf *rf) |
42 | { | 89 | { |
43 | int r; | 90 | int r; |
@@ -139,7 +186,7 @@ static int zd1211b_al2230_init_hw(struct zd_rf *rf) | |||
139 | { CR47, 0x1e }, | 186 | { CR47, 0x1e }, |
140 | 187 | ||
141 | /* ZD1211B 05.06.10 */ | 188 | /* ZD1211B 05.06.10 */ |
142 | { CR48, 0x00 }, { CR49, 0x00 }, { CR51, 0x01 }, | 189 | { CR48, 0x06 }, { CR49, 0xf9 }, { CR51, 0x01 }, |
143 | { CR52, 0x80 }, { CR53, 0x7e }, { CR65, 0x00 }, | 190 | { CR52, 0x80 }, { CR53, 0x7e }, { CR65, 0x00 }, |
144 | { CR66, 0x00 }, { CR67, 0x00 }, { CR68, 0x00 }, | 191 | { CR66, 0x00 }, { CR67, 0x00 }, { CR68, 0x00 }, |
145 | { CR69, 0x28 }, | 192 | { CR69, 0x28 }, |
@@ -172,79 +219,78 @@ static int zd1211b_al2230_init_hw(struct zd_rf *rf) | |||
172 | { CR137, 0x50 }, /* 5614 */ | 219 | { CR137, 0x50 }, /* 5614 */ |
173 | { CR138, 0xa8 }, | 220 | { CR138, 0xa8 }, |
174 | { CR144, 0xac }, /* 5621 */ | 221 | { CR144, 0xac }, /* 5621 */ |
175 | { CR150, 0x0d }, { CR252, 0x00 }, { CR253, 0x00 }, | 222 | { CR150, 0x0d }, { CR252, 0x34 }, { CR253, 0x34 }, |
176 | }; | 223 | }; |
177 | 224 | ||
178 | static const u32 rv1[] = { | 225 | static const u32 rv1[] = { |
179 | /* channel 1 */ | 226 | 0x8cccd0, |
180 | 0x03f790, | 227 | 0x481dc0, |
181 | 0x033331, | 228 | 0xcfff00, |
182 | 0x00000d, | 229 | 0x25a000, |
183 | 230 | ||
184 | 0x0b3331, | 231 | /* To improve AL2230 yield, improve phase noise, 4713 */ |
185 | 0x03b812, | 232 | 0x25a000, |
186 | 0x00fff3, | 233 | 0xa3b2f0, |
187 | 0x0005a4, | 234 | |
188 | 0x0f4dc5, /* fix freq shift 0x044dc5 */ | 235 | 0x6da010, /* Reg6 update for MP versio */ |
189 | 0x0805b6, | 236 | 0xe36280, /* Modified by jxiao for Bor-Chin on 2004/08/02 */ |
190 | 0x0146c7, | 237 | 0x116000, |
191 | 0x000688, | 238 | 0x9dc020, /* External control TX power (CR31) */ |
192 | 0x0403b9, /* External control TX power (CR31) */ | 239 | 0x5ddb00, /* RegA update for MP version */ |
193 | 0x00dbba, | 240 | 0xd99000, /* RegB update for MP version */ |
194 | 0x00099b, | 241 | 0x3ffbd0, /* RegC update for MP version */ |
195 | 0x0bdffc, | 242 | 0xb00000, /* RegD update for MP version */ |
196 | 0x00000d, | 243 | |
197 | 0x00580f, | 244 | /* improve phase noise and remove phase calibration,4713 */ |
245 | 0xf01a00, | ||
198 | }; | 246 | }; |
199 | 247 | ||
200 | static const struct zd_ioreq16 ioreqs2[] = { | 248 | static const struct zd_ioreq16 ioreqs2[] = { |
201 | { CR47, 0x1e }, { CR_RFCFG, 0x03 }, | 249 | { CR251, 0x2f }, /* shdnb(PLL_ON)=0 */ |
250 | { CR251, 0x7f }, /* shdnb(PLL_ON)=1 */ | ||
202 | }; | 251 | }; |
203 | 252 | ||
204 | static const u32 rv2[] = { | 253 | static const u32 rv2[] = { |
205 | 0x00880f, | 254 | /* To improve AL2230 yield, 4713 */ |
206 | 0x00080f, | 255 | 0xf01b00, |
256 | 0xf01e00, | ||
257 | 0xf01a00, | ||
207 | }; | 258 | }; |
208 | 259 | ||
209 | static const struct zd_ioreq16 ioreqs3[] = { | 260 | static const struct zd_ioreq16 ioreqs3[] = { |
210 | { CR_RFCFG, 0x00 }, { CR47, 0x1e }, { CR251, 0x7f }, | 261 | /* related to 6M band edge patching, happens unconditionally */ |
211 | }; | 262 | { CR128, 0x14 }, { CR129, 0x12 }, { CR130, 0x10 }, |
212 | |||
213 | static const u32 rv3[] = { | ||
214 | 0x00d80f, | ||
215 | 0x00780f, | ||
216 | 0x00580f, | ||
217 | }; | ||
218 | |||
219 | static const struct zd_ioreq16 ioreqs4[] = { | ||
220 | { CR138, 0x28 }, { CR203, 0x06 }, | ||
221 | }; | 263 | }; |
222 | 264 | ||
265 | r = zd_iowrite16a_locked(chip, zd1211b_ioreqs_shared_1, | ||
266 | ARRAY_SIZE(zd1211b_ioreqs_shared_1)); | ||
267 | if (r) | ||
268 | return r; | ||
223 | r = zd_iowrite16a_locked(chip, ioreqs1, ARRAY_SIZE(ioreqs1)); | 269 | r = zd_iowrite16a_locked(chip, ioreqs1, ARRAY_SIZE(ioreqs1)); |
224 | if (r) | 270 | if (r) |
225 | return r; | 271 | return r; |
226 | r = zd_rfwritev_locked(chip, rv1, ARRAY_SIZE(rv1), RF_RV_BITS); | 272 | r = zd_rfwritev_cr_locked(chip, zd1211b_al2230_table[0], 3); |
227 | if (r) | 273 | if (r) |
228 | return r; | 274 | return r; |
229 | r = zd_iowrite16a_locked(chip, ioreqs2, ARRAY_SIZE(ioreqs2)); | 275 | r = zd_rfwritev_cr_locked(chip, rv1, ARRAY_SIZE(rv1)); |
230 | if (r) | 276 | if (r) |
231 | return r; | 277 | return r; |
232 | r = zd_rfwritev_locked(chip, rv2, ARRAY_SIZE(rv2), RF_RV_BITS); | 278 | r = zd_iowrite16a_locked(chip, ioreqs2, ARRAY_SIZE(ioreqs2)); |
233 | if (r) | 279 | if (r) |
234 | return r; | 280 | return r; |
235 | r = zd_iowrite16a_locked(chip, ioreqs3, ARRAY_SIZE(ioreqs3)); | 281 | r = zd_rfwritev_cr_locked(chip, rv2, ARRAY_SIZE(rv2)); |
236 | if (r) | 282 | if (r) |
237 | return r; | 283 | return r; |
238 | r = zd_rfwritev_locked(chip, rv3, ARRAY_SIZE(rv3), RF_RV_BITS); | 284 | r = zd_iowrite16a_locked(chip, ioreqs3, ARRAY_SIZE(ioreqs3)); |
239 | if (r) | 285 | if (r) |
240 | return r; | 286 | return r; |
241 | return zd_iowrite16a_locked(chip, ioreqs4, ARRAY_SIZE(ioreqs4)); | 287 | return zd1211b_al2230_finalize_rf(chip); |
242 | } | 288 | } |
243 | 289 | ||
244 | static int al2230_set_channel(struct zd_rf *rf, u8 channel) | 290 | static int zd1211_al2230_set_channel(struct zd_rf *rf, u8 channel) |
245 | { | 291 | { |
246 | int r; | 292 | int r; |
247 | const u32 *rv = al2230_table[channel-1]; | 293 | const u32 *rv = zd1211_al2230_table[channel-1]; |
248 | struct zd_chip *chip = zd_rf_to_chip(rf); | 294 | struct zd_chip *chip = zd_rf_to_chip(rf); |
249 | static const struct zd_ioreq16 ioreqs[] = { | 295 | static const struct zd_ioreq16 ioreqs[] = { |
250 | { CR138, 0x28 }, | 296 | { CR138, 0x28 }, |
@@ -257,6 +303,24 @@ static int al2230_set_channel(struct zd_rf *rf, u8 channel) | |||
257 | return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); | 303 | return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); |
258 | } | 304 | } |
259 | 305 | ||
306 | static int zd1211b_al2230_set_channel(struct zd_rf *rf, u8 channel) | ||
307 | { | ||
308 | int r; | ||
309 | const u32 *rv = zd1211b_al2230_table[channel-1]; | ||
310 | struct zd_chip *chip = zd_rf_to_chip(rf); | ||
311 | |||
312 | r = zd_iowrite16a_locked(chip, zd1211b_ioreqs_shared_1, | ||
313 | ARRAY_SIZE(zd1211b_ioreqs_shared_1)); | ||
314 | if (r) | ||
315 | return r; | ||
316 | |||
317 | r = zd_rfwritev_cr_locked(chip, rv, 3); | ||
318 | if (r) | ||
319 | return r; | ||
320 | |||
321 | return zd1211b_al2230_finalize_rf(chip); | ||
322 | } | ||
323 | |||
260 | static int zd1211_al2230_switch_radio_on(struct zd_rf *rf) | 324 | static int zd1211_al2230_switch_radio_on(struct zd_rf *rf) |
261 | { | 325 | { |
262 | struct zd_chip *chip = zd_rf_to_chip(rf); | 326 | struct zd_chip *chip = zd_rf_to_chip(rf); |
@@ -294,13 +358,14 @@ int zd_rf_init_al2230(struct zd_rf *rf) | |||
294 | { | 358 | { |
295 | struct zd_chip *chip = zd_rf_to_chip(rf); | 359 | struct zd_chip *chip = zd_rf_to_chip(rf); |
296 | 360 | ||
297 | rf->set_channel = al2230_set_channel; | ||
298 | rf->switch_radio_off = al2230_switch_radio_off; | 361 | rf->switch_radio_off = al2230_switch_radio_off; |
299 | if (chip->is_zd1211b) { | 362 | if (chip->is_zd1211b) { |
300 | rf->init_hw = zd1211b_al2230_init_hw; | 363 | rf->init_hw = zd1211b_al2230_init_hw; |
364 | rf->set_channel = zd1211b_al2230_set_channel; | ||
301 | rf->switch_radio_on = zd1211b_al2230_switch_radio_on; | 365 | rf->switch_radio_on = zd1211b_al2230_switch_radio_on; |
302 | } else { | 366 | } else { |
303 | rf->init_hw = zd1211_al2230_init_hw; | 367 | rf->init_hw = zd1211_al2230_init_hw; |
368 | rf->set_channel = zd1211_al2230_set_channel; | ||
304 | rf->switch_radio_on = zd1211_al2230_switch_radio_on; | 369 | rf->switch_radio_on = zd1211_al2230_switch_radio_on; |
305 | } | 370 | } |
306 | rf->patch_6m_band_edge = 1; | 371 | rf->patch_6m_band_edge = 1; |
diff --git a/drivers/net/wireless/zd1211rw/zd_rf_al7230b.c b/drivers/net/wireless/zd1211rw/zd_rf_al7230b.c new file mode 100644 index 000000000000..a289f95187ec --- /dev/null +++ b/drivers/net/wireless/zd1211rw/zd_rf_al7230b.c | |||
@@ -0,0 +1,274 @@ | |||
1 | /* zd_rf_al7230b.c: Functions for the AL7230B RF controller | ||
2 | * | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation; either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program; if not, write to the Free Software | ||
15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
16 | */ | ||
17 | |||
18 | #include <linux/kernel.h> | ||
19 | |||
20 | #include "zd_rf.h" | ||
21 | #include "zd_usb.h" | ||
22 | #include "zd_chip.h" | ||
23 | |||
24 | static const u32 chan_rv[][2] = { | ||
25 | RF_CHANNEL( 1) = { 0x09ec00, 0x8cccc8 }, | ||
26 | RF_CHANNEL( 2) = { 0x09ec00, 0x8cccd8 }, | ||
27 | RF_CHANNEL( 3) = { 0x09ec00, 0x8cccc0 }, | ||
28 | RF_CHANNEL( 4) = { 0x09ec00, 0x8cccd0 }, | ||
29 | RF_CHANNEL( 5) = { 0x05ec00, 0x8cccc8 }, | ||
30 | RF_CHANNEL( 6) = { 0x05ec00, 0x8cccd8 }, | ||
31 | RF_CHANNEL( 7) = { 0x05ec00, 0x8cccc0 }, | ||
32 | RF_CHANNEL( 8) = { 0x05ec00, 0x8cccd0 }, | ||
33 | RF_CHANNEL( 9) = { 0x0dec00, 0x8cccc8 }, | ||
34 | RF_CHANNEL(10) = { 0x0dec00, 0x8cccd8 }, | ||
35 | RF_CHANNEL(11) = { 0x0dec00, 0x8cccc0 }, | ||
36 | RF_CHANNEL(12) = { 0x0dec00, 0x8cccd0 }, | ||
37 | RF_CHANNEL(13) = { 0x03ec00, 0x8cccc8 }, | ||
38 | RF_CHANNEL(14) = { 0x03ec00, 0x866660 }, | ||
39 | }; | ||
40 | |||
41 | static const u32 std_rv[] = { | ||
42 | 0x4ff821, | ||
43 | 0xc5fbfc, | ||
44 | 0x21ebfe, | ||
45 | 0xafd401, /* freq shift 0xaad401 */ | ||
46 | 0x6cf56a, | ||
47 | 0xe04073, | ||
48 | 0x193d76, | ||
49 | 0x9dd844, | ||
50 | 0x500007, | ||
51 | 0xd8c010, | ||
52 | }; | ||
53 | |||
54 | static int al7230b_init_hw(struct zd_rf *rf) | ||
55 | { | ||
56 | int i, r; | ||
57 | struct zd_chip *chip = zd_rf_to_chip(rf); | ||
58 | |||
59 | /* All of these writes are identical to AL2230 unless otherwise | ||
60 | * specified */ | ||
61 | static const struct zd_ioreq16 ioreqs_1[] = { | ||
62 | /* This one is 7230-specific, and happens before the rest */ | ||
63 | { CR240, 0x57 }, | ||
64 | { }, | ||
65 | |||
66 | { CR15, 0x20 }, { CR23, 0x40 }, { CR24, 0x20 }, | ||
67 | { CR26, 0x11 }, { CR28, 0x3e }, { CR29, 0x00 }, | ||
68 | { CR44, 0x33 }, | ||
69 | /* This value is different for 7230 (was: 0x2a) */ | ||
70 | { CR106, 0x22 }, | ||
71 | { CR107, 0x1a }, { CR109, 0x09 }, { CR110, 0x27 }, | ||
72 | { CR111, 0x2b }, { CR112, 0x2b }, { CR119, 0x0a }, | ||
73 | /* This happened further down in AL2230, | ||
74 | * and the value changed (was: 0xe0) */ | ||
75 | { CR122, 0xfc }, | ||
76 | { CR10, 0x89 }, | ||
77 | /* for newest (3rd cut) AL2300 */ | ||
78 | { CR17, 0x28 }, | ||
79 | { CR26, 0x93 }, { CR34, 0x30 }, | ||
80 | /* for newest (3rd cut) AL2300 */ | ||
81 | { CR35, 0x3e }, | ||
82 | { CR41, 0x24 }, { CR44, 0x32 }, | ||
83 | /* for newest (3rd cut) AL2300 */ | ||
84 | { CR46, 0x96 }, | ||
85 | { CR47, 0x1e }, { CR79, 0x58 }, { CR80, 0x30 }, | ||
86 | { CR81, 0x30 }, { CR87, 0x0a }, { CR89, 0x04 }, | ||
87 | { CR92, 0x0a }, { CR99, 0x28 }, | ||
88 | /* This value is different for 7230 (was: 0x00) */ | ||
89 | { CR100, 0x02 }, | ||
90 | { CR101, 0x13 }, { CR102, 0x27 }, | ||
91 | /* This value is different for 7230 (was: 0x24) */ | ||
92 | { CR106, 0x22 }, | ||
93 | /* This value is different for 7230 (was: 0x2a) */ | ||
94 | { CR107, 0x3f }, | ||
95 | { CR109, 0x09 }, | ||
96 | /* This value is different for 7230 (was: 0x13) */ | ||
97 | { CR110, 0x1f }, | ||
98 | { CR111, 0x1f }, { CR112, 0x1f }, { CR113, 0x27 }, | ||
99 | { CR114, 0x27 }, | ||
100 | /* for newest (3rd cut) AL2300 */ | ||
101 | { CR115, 0x24 }, | ||
102 | /* This value is different for 7230 (was: 0x24) */ | ||
103 | { CR116, 0x3f }, | ||
104 | /* This value is different for 7230 (was: 0xf4) */ | ||
105 | { CR117, 0xfa }, | ||
106 | { CR118, 0xfc }, { CR119, 0x10 }, { CR120, 0x4f }, | ||
107 | { CR121, 0x77 }, { CR137, 0x88 }, | ||
108 | /* This one is 7230-specific */ | ||
109 | { CR138, 0xa8 }, | ||
110 | /* This value is different for 7230 (was: 0xff) */ | ||
111 | { CR252, 0x34 }, | ||
112 | /* This value is different for 7230 (was: 0xff) */ | ||
113 | { CR253, 0x34 }, | ||
114 | |||
115 | /* PLL_OFF */ | ||
116 | { CR251, 0x2f }, | ||
117 | }; | ||
118 | |||
119 | static const struct zd_ioreq16 ioreqs_2[] = { | ||
120 | /* PLL_ON */ | ||
121 | { CR251, 0x3f }, | ||
122 | { CR128, 0x14 }, { CR129, 0x12 }, { CR130, 0x10 }, | ||
123 | { CR38, 0x38 }, { CR136, 0xdf }, | ||
124 | }; | ||
125 | |||
126 | r = zd_iowrite16a_locked(chip, ioreqs_1, ARRAY_SIZE(ioreqs_1)); | ||
127 | if (r) | ||
128 | return r; | ||
129 | |||
130 | r = zd_rfwrite_cr_locked(chip, 0x09ec04); | ||
131 | if (r) | ||
132 | return r; | ||
133 | r = zd_rfwrite_cr_locked(chip, 0x8cccc8); | ||
134 | if (r) | ||
135 | return r; | ||
136 | |||
137 | for (i = 0; i < ARRAY_SIZE(std_rv); i++) { | ||
138 | r = zd_rfwrite_cr_locked(chip, std_rv[i]); | ||
139 | if (r) | ||
140 | return r; | ||
141 | } | ||
142 | |||
143 | r = zd_rfwrite_cr_locked(chip, 0x3c9000); | ||
144 | if (r) | ||
145 | return r; | ||
146 | r = zd_rfwrite_cr_locked(chip, 0xbfffff); | ||
147 | if (r) | ||
148 | return r; | ||
149 | r = zd_rfwrite_cr_locked(chip, 0x700000); | ||
150 | if (r) | ||
151 | return r; | ||
152 | r = zd_rfwrite_cr_locked(chip, 0xf15d58); | ||
153 | if (r) | ||
154 | return r; | ||
155 | |||
156 | r = zd_iowrite16a_locked(chip, ioreqs_2, ARRAY_SIZE(ioreqs_2)); | ||
157 | if (r) | ||
158 | return r; | ||
159 | |||
160 | r = zd_rfwrite_cr_locked(chip, 0xf15d59); | ||
161 | if (r) | ||
162 | return r; | ||
163 | r = zd_rfwrite_cr_locked(chip, 0xf15d5c); | ||
164 | if (r) | ||
165 | return r; | ||
166 | r = zd_rfwrite_cr_locked(chip, 0xf15d58); | ||
167 | if (r) | ||
168 | return r; | ||
169 | |||
170 | r = zd_iowrite16_locked(chip, 0x06, CR203); | ||
171 | if (r) | ||
172 | return r; | ||
173 | r = zd_iowrite16_locked(chip, 0x80, CR240); | ||
174 | if (r) | ||
175 | return r; | ||
176 | |||
177 | return 0; | ||
178 | } | ||
179 | |||
180 | static int al7230b_set_channel(struct zd_rf *rf, u8 channel) | ||
181 | { | ||
182 | int i, r; | ||
183 | const u32 *rv = chan_rv[channel-1]; | ||
184 | struct zd_chip *chip = zd_rf_to_chip(rf); | ||
185 | |||
186 | struct zd_ioreq16 ioreqs_1[] = { | ||
187 | { CR128, 0x14 }, { CR129, 0x12 }, { CR130, 0x10 }, | ||
188 | { CR38, 0x38 }, { CR136, 0xdf }, | ||
189 | }; | ||
190 | |||
191 | struct zd_ioreq16 ioreqs_2[] = { | ||
192 | /* PLL_ON */ | ||
193 | { CR251, 0x3f }, | ||
194 | { CR203, 0x06 }, { CR240, 0x08 }, | ||
195 | }; | ||
196 | |||
197 | r = zd_iowrite16_locked(chip, 0x57, CR240); | ||
198 | if (r) | ||
199 | return r; | ||
200 | |||
201 | /* PLL_OFF */ | ||
202 | r = zd_iowrite16_locked(chip, 0x2f, CR251); | ||
203 | if (r) | ||
204 | return r; | ||
205 | |||
206 | for (i = 0; i < ARRAY_SIZE(std_rv); i++) { | ||
207 | r = zd_rfwrite_cr_locked(chip, std_rv[i]); | ||
208 | if (r) | ||
209 | return r; | ||
210 | } | ||
211 | |||
212 | r = zd_rfwrite_cr_locked(chip, 0x3c9000); | ||
213 | if (r) | ||
214 | return r; | ||
215 | r = zd_rfwrite_cr_locked(chip, 0xf15d58); | ||
216 | if (r) | ||
217 | return r; | ||
218 | |||
219 | r = zd_iowrite16a_locked(chip, ioreqs_1, ARRAY_SIZE(ioreqs_1)); | ||
220 | if (r) | ||
221 | return r; | ||
222 | |||
223 | for (i = 0; i < 2; i++) { | ||
224 | r = zd_rfwrite_cr_locked(chip, rv[i]); | ||
225 | if (r) | ||
226 | return r; | ||
227 | } | ||
228 | |||
229 | r = zd_rfwrite_cr_locked(chip, 0x3c9000); | ||
230 | if (r) | ||
231 | return r; | ||
232 | |||
233 | return zd_iowrite16a_locked(chip, ioreqs_2, ARRAY_SIZE(ioreqs_2)); | ||
234 | } | ||
235 | |||
236 | static int al7230b_switch_radio_on(struct zd_rf *rf) | ||
237 | { | ||
238 | struct zd_chip *chip = zd_rf_to_chip(rf); | ||
239 | static const struct zd_ioreq16 ioreqs[] = { | ||
240 | { CR11, 0x00 }, | ||
241 | { CR251, 0x3f }, | ||
242 | }; | ||
243 | |||
244 | return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); | ||
245 | } | ||
246 | |||
247 | static int al7230b_switch_radio_off(struct zd_rf *rf) | ||
248 | { | ||
249 | struct zd_chip *chip = zd_rf_to_chip(rf); | ||
250 | static const struct zd_ioreq16 ioreqs[] = { | ||
251 | { CR11, 0x04 }, | ||
252 | { CR251, 0x2f }, | ||
253 | }; | ||
254 | |||
255 | return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); | ||
256 | } | ||
257 | |||
258 | int zd_rf_init_al7230b(struct zd_rf *rf) | ||
259 | { | ||
260 | struct zd_chip *chip = zd_rf_to_chip(rf); | ||
261 | |||
262 | if (chip->is_zd1211b) { | ||
263 | dev_err(zd_chip_dev(chip), "AL7230B is currently not " | ||
264 | "supported for ZD1211B devices\n"); | ||
265 | return -ENODEV; | ||
266 | } | ||
267 | |||
268 | rf->init_hw = al7230b_init_hw; | ||
269 | rf->set_channel = al7230b_set_channel; | ||
270 | rf->switch_radio_on = al7230b_switch_radio_on; | ||
271 | rf->switch_radio_off = al7230b_switch_radio_off; | ||
272 | rf->patch_6m_band_edge = 1; | ||
273 | return 0; | ||
274 | } | ||
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index 6320984126c7..47489fe8ab52 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
@@ -16,6 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <asm/unaligned.h> | 18 | #include <asm/unaligned.h> |
19 | #include <linux/kernel.h> | ||
19 | #include <linux/init.h> | 20 | #include <linux/init.h> |
20 | #include <linux/module.h> | 21 | #include <linux/module.h> |
21 | #include <linux/firmware.h> | 22 | #include <linux/firmware.h> |
@@ -39,9 +40,17 @@ static struct usb_device_id usb_ids[] = { | |||
39 | { USB_DEVICE(0x6891, 0xa727), .driver_info = DEVICE_ZD1211 }, | 40 | { USB_DEVICE(0x6891, 0xa727), .driver_info = DEVICE_ZD1211 }, |
40 | { USB_DEVICE(0x0df6, 0x9071), .driver_info = DEVICE_ZD1211 }, | 41 | { USB_DEVICE(0x0df6, 0x9071), .driver_info = DEVICE_ZD1211 }, |
41 | { USB_DEVICE(0x157e, 0x300b), .driver_info = DEVICE_ZD1211 }, | 42 | { USB_DEVICE(0x157e, 0x300b), .driver_info = DEVICE_ZD1211 }, |
43 | { USB_DEVICE(0x079b, 0x004a), .driver_info = DEVICE_ZD1211 }, | ||
44 | { USB_DEVICE(0x1740, 0x2000), .driver_info = DEVICE_ZD1211 }, | ||
45 | { USB_DEVICE(0x157e, 0x3204), .driver_info = DEVICE_ZD1211 }, | ||
46 | { USB_DEVICE(0x0586, 0x3402), .driver_info = DEVICE_ZD1211 }, | ||
42 | /* ZD1211B */ | 47 | /* ZD1211B */ |
43 | { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, | 48 | { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, |
44 | { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B }, | 49 | { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B }, |
50 | { USB_DEVICE(0x079b, 0x0062), .driver_info = DEVICE_ZD1211B }, | ||
51 | { USB_DEVICE(0x1582, 0x6003), .driver_info = DEVICE_ZD1211B }, | ||
52 | /* "Driverless" devices that need ejecting */ | ||
53 | { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, | ||
45 | {} | 54 | {} |
46 | }; | 55 | }; |
47 | 56 | ||
@@ -263,6 +272,39 @@ static char *get_fw_name(char *buffer, size_t size, u8 device_type, | |||
263 | return buffer; | 272 | return buffer; |
264 | } | 273 | } |
265 | 274 | ||
275 | static int handle_version_mismatch(struct usb_device *udev, u8 device_type, | ||
276 | const struct firmware *ub_fw) | ||
277 | { | ||
278 | const struct firmware *ur_fw = NULL; | ||
279 | int offset; | ||
280 | int r = 0; | ||
281 | char fw_name[128]; | ||
282 | |||
283 | r = request_fw_file(&ur_fw, | ||
284 | get_fw_name(fw_name, sizeof(fw_name), device_type, "ur"), | ||
285 | &udev->dev); | ||
286 | if (r) | ||
287 | goto error; | ||
288 | |||
289 | r = upload_code(udev, ur_fw->data, ur_fw->size, FW_START_OFFSET, | ||
290 | REBOOT); | ||
291 | if (r) | ||
292 | goto error; | ||
293 | |||
294 | offset = ((EEPROM_REGS_OFFSET + EEPROM_REGS_SIZE) * sizeof(u16)); | ||
295 | r = upload_code(udev, ub_fw->data + offset, ub_fw->size - offset, | ||
296 | E2P_BASE_OFFSET + EEPROM_REGS_SIZE, REBOOT); | ||
297 | |||
298 | /* At this point, the vendor driver downloads the whole firmware | ||
299 | * image, hacks around with version IDs, and uploads it again, | ||
300 | * completely overwriting the boot code. We do not do this here as | ||
301 | * it is not required on any tested devices, and it is suspected to | ||
302 | * cause problems. */ | ||
303 | error: | ||
304 | release_firmware(ur_fw); | ||
305 | return r; | ||
306 | } | ||
307 | |||
266 | static int upload_firmware(struct usb_device *udev, u8 device_type) | 308 | static int upload_firmware(struct usb_device *udev, u8 device_type) |
267 | { | 309 | { |
268 | int r; | 310 | int r; |
@@ -282,15 +324,17 @@ static int upload_firmware(struct usb_device *udev, u8 device_type) | |||
282 | 324 | ||
283 | fw_bcdDevice = get_word(ub_fw->data, EEPROM_REGS_OFFSET); | 325 | fw_bcdDevice = get_word(ub_fw->data, EEPROM_REGS_OFFSET); |
284 | 326 | ||
285 | /* FIXME: do we have any reason to perform the kludge that the vendor | ||
286 | * driver does when there is a version mismatch? (their driver uploads | ||
287 | * different firmwares and stuff) | ||
288 | */ | ||
289 | if (fw_bcdDevice != bcdDevice) { | 327 | if (fw_bcdDevice != bcdDevice) { |
290 | dev_info(&udev->dev, | 328 | dev_info(&udev->dev, |
291 | "firmware device id %#06x and actual device id " | 329 | "firmware version %#06x and device bootcode version " |
292 | "%#06x differ, continuing anyway\n", | 330 | "%#06x differ\n", fw_bcdDevice, bcdDevice); |
293 | fw_bcdDevice, bcdDevice); | 331 | if (bcdDevice <= 0x4313) |
332 | dev_warn(&udev->dev, "device has old bootcode, please " | ||
333 | "report success or failure\n"); | ||
334 | |||
335 | r = handle_version_mismatch(udev, device_type, ub_fw); | ||
336 | if (r) | ||
337 | goto error; | ||
294 | } else { | 338 | } else { |
295 | dev_dbg_f(&udev->dev, | 339 | dev_dbg_f(&udev->dev, |
296 | "firmware device id %#06x is equal to the " | 340 | "firmware device id %#06x is equal to the " |
@@ -620,7 +664,7 @@ resubmit: | |||
620 | usb_submit_urb(urb, GFP_ATOMIC); | 664 | usb_submit_urb(urb, GFP_ATOMIC); |
621 | } | 665 | } |
622 | 666 | ||
623 | struct urb *alloc_urb(struct zd_usb *usb) | 667 | static struct urb *alloc_urb(struct zd_usb *usb) |
624 | { | 668 | { |
625 | struct usb_device *udev = zd_usb_to_usbdev(usb); | 669 | struct usb_device *udev = zd_usb_to_usbdev(usb); |
626 | struct urb *urb; | 670 | struct urb *urb; |
@@ -644,7 +688,7 @@ struct urb *alloc_urb(struct zd_usb *usb) | |||
644 | return urb; | 688 | return urb; |
645 | } | 689 | } |
646 | 690 | ||
647 | void free_urb(struct urb *urb) | 691 | static void free_urb(struct urb *urb) |
648 | { | 692 | { |
649 | if (!urb) | 693 | if (!urb) |
650 | return; | 694 | return; |
@@ -864,7 +908,7 @@ void zd_usb_clear(struct zd_usb *usb) | |||
864 | { | 908 | { |
865 | usb_set_intfdata(usb->intf, NULL); | 909 | usb_set_intfdata(usb->intf, NULL); |
866 | usb_put_intf(usb->intf); | 910 | usb_put_intf(usb->intf); |
867 | memset(usb, 0, sizeof(*usb)); | 911 | ZD_MEMCLEAR(usb, sizeof(*usb)); |
868 | /* FIXME: usb_interrupt, usb_tx, usb_rx? */ | 912 | /* FIXME: usb_interrupt, usb_tx, usb_rx? */ |
869 | } | 913 | } |
870 | 914 | ||
@@ -910,6 +954,55 @@ static void print_id(struct usb_device *udev) | |||
910 | #define print_id(udev) do { } while (0) | 954 | #define print_id(udev) do { } while (0) |
911 | #endif | 955 | #endif |
912 | 956 | ||
957 | static int eject_installer(struct usb_interface *intf) | ||
958 | { | ||
959 | struct usb_device *udev = interface_to_usbdev(intf); | ||
960 | struct usb_host_interface *iface_desc = &intf->altsetting[0]; | ||
961 | struct usb_endpoint_descriptor *endpoint; | ||
962 | unsigned char *cmd; | ||
963 | u8 bulk_out_ep; | ||
964 | int r; | ||
965 | |||
966 | /* Find bulk out endpoint */ | ||
967 | endpoint = &iface_desc->endpoint[1].desc; | ||
968 | if ((endpoint->bEndpointAddress & USB_TYPE_MASK) == USB_DIR_OUT && | ||
969 | (endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | ||
970 | USB_ENDPOINT_XFER_BULK) { | ||
971 | bulk_out_ep = endpoint->bEndpointAddress; | ||
972 | } else { | ||
973 | dev_err(&udev->dev, | ||
974 | "zd1211rw: Could not find bulk out endpoint\n"); | ||
975 | return -ENODEV; | ||
976 | } | ||
977 | |||
978 | cmd = kzalloc(31, GFP_KERNEL); | ||
979 | if (cmd == NULL) | ||
980 | return -ENODEV; | ||
981 | |||
982 | /* USB bulk command block */ | ||
983 | cmd[0] = 0x55; /* bulk command signature */ | ||
984 | cmd[1] = 0x53; /* bulk command signature */ | ||
985 | cmd[2] = 0x42; /* bulk command signature */ | ||
986 | cmd[3] = 0x43; /* bulk command signature */ | ||
987 | cmd[14] = 6; /* command length */ | ||
988 | |||
989 | cmd[15] = 0x1b; /* SCSI command: START STOP UNIT */ | ||
990 | cmd[19] = 0x2; /* eject disc */ | ||
991 | |||
992 | dev_info(&udev->dev, "Ejecting virtual installer media...\n"); | ||
993 | r = usb_bulk_msg(udev, usb_sndbulkpipe(udev, bulk_out_ep), | ||
994 | cmd, 31, NULL, 2000); | ||
995 | kfree(cmd); | ||
996 | if (r) | ||
997 | return r; | ||
998 | |||
999 | /* At this point, the device disconnects and reconnects with the real | ||
1000 | * ID numbers. */ | ||
1001 | |||
1002 | usb_set_intfdata(intf, NULL); | ||
1003 | return 0; | ||
1004 | } | ||
1005 | |||
913 | static int probe(struct usb_interface *intf, const struct usb_device_id *id) | 1006 | static int probe(struct usb_interface *intf, const struct usb_device_id *id) |
914 | { | 1007 | { |
915 | int r; | 1008 | int r; |
@@ -918,6 +1011,9 @@ static int probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
918 | 1011 | ||
919 | print_id(udev); | 1012 | print_id(udev); |
920 | 1013 | ||
1014 | if (id->driver_info & DEVICE_INSTALLER) | ||
1015 | return eject_installer(intf); | ||
1016 | |||
921 | switch (udev->speed) { | 1017 | switch (udev->speed) { |
922 | case USB_SPEED_LOW: | 1018 | case USB_SPEED_LOW: |
923 | case USB_SPEED_FULL: | 1019 | case USB_SPEED_FULL: |
@@ -983,6 +1079,11 @@ static void disconnect(struct usb_interface *intf) | |||
983 | struct zd_mac *mac = zd_netdev_mac(netdev); | 1079 | struct zd_mac *mac = zd_netdev_mac(netdev); |
984 | struct zd_usb *usb = &mac->chip.usb; | 1080 | struct zd_usb *usb = &mac->chip.usb; |
985 | 1081 | ||
1082 | /* Either something really bad happened, or we're just dealing with | ||
1083 | * a DEVICE_INSTALLER. */ | ||
1084 | if (netdev == NULL) | ||
1085 | return; | ||
1086 | |||
986 | dev_dbg_f(zd_usb_dev(usb), "\n"); | 1087 | dev_dbg_f(zd_usb_dev(usb), "\n"); |
987 | 1088 | ||
988 | zd_netdev_disconnect(netdev); | 1089 | zd_netdev_disconnect(netdev); |
@@ -998,7 +1099,6 @@ static void disconnect(struct usb_interface *intf) | |||
998 | */ | 1099 | */ |
999 | usb_reset_device(interface_to_usbdev(intf)); | 1100 | usb_reset_device(interface_to_usbdev(intf)); |
1000 | 1101 | ||
1001 | /* If somebody still waits on this lock now, this is an error. */ | ||
1002 | zd_netdev_free(netdev); | 1102 | zd_netdev_free(netdev); |
1003 | dev_dbg(&intf->dev, "disconnected\n"); | 1103 | dev_dbg(&intf->dev, "disconnected\n"); |
1004 | } | 1104 | } |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.h b/drivers/net/wireless/zd1211rw/zd_usb.h index d6420283bd5a..92746f76239a 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.h +++ b/drivers/net/wireless/zd1211rw/zd_usb.h | |||
@@ -30,6 +30,7 @@ | |||
30 | enum devicetype { | 30 | enum devicetype { |
31 | DEVICE_ZD1211 = 0, | 31 | DEVICE_ZD1211 = 0, |
32 | DEVICE_ZD1211B = 1, | 32 | DEVICE_ZD1211B = 1, |
33 | DEVICE_INSTALLER = 2, | ||
33 | }; | 34 | }; |
34 | 35 | ||
35 | enum endpoints { | 36 | enum endpoints { |
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index 8459a18254a4..b6b247433709 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c | |||
@@ -1434,7 +1434,7 @@ static int __init yellowfin_init (void) | |||
1434 | #ifdef MODULE | 1434 | #ifdef MODULE |
1435 | printk(version); | 1435 | printk(version); |
1436 | #endif | 1436 | #endif |
1437 | return pci_module_init (&yellowfin_driver); | 1437 | return pci_register_driver(&yellowfin_driver); |
1438 | } | 1438 | } |
1439 | 1439 | ||
1440 | 1440 | ||
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig index 3fae77ffb2fa..3c148eaf2f4d 100644 --- a/drivers/pci/hotplug/Kconfig +++ b/drivers/pci/hotplug/Kconfig | |||
@@ -153,13 +153,6 @@ config HOTPLUG_PCI_SHPC_POLL_EVENT_MODE | |||
153 | 153 | ||
154 | When in doubt, say N. | 154 | When in doubt, say N. |
155 | 155 | ||
156 | config HOTPLUG_PCI_SHPC_PHPRM_LEGACY | ||
157 | bool "For AMD SHPC only: Use $HRT for resource/configuration" | ||
158 | depends on HOTPLUG_PCI_SHPC && !ACPI | ||
159 | help | ||
160 | Say Y here for AMD SHPC. You have to select this option if you are | ||
161 | using this driver on platform with AMD SHPC. | ||
162 | |||
163 | config HOTPLUG_PCI_RPA | 156 | config HOTPLUG_PCI_RPA |
164 | tristate "RPA PCI Hotplug driver" | 157 | tristate "RPA PCI Hotplug driver" |
165 | depends on HOTPLUG_PCI && PPC_PSERIES && PPC64 && !HOTPLUG_PCI_FAKE | 158 | depends on HOTPLUG_PCI && PPC_PSERIES && PPC64 && !HOTPLUG_PCI_FAKE |
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index ce89f5815861..eaea9d36a1bb 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
@@ -279,6 +279,11 @@ struct hpc_ops { | |||
279 | 279 | ||
280 | 280 | ||
281 | #ifdef CONFIG_ACPI | 281 | #ifdef CONFIG_ACPI |
282 | #include <acpi/acpi.h> | ||
283 | #include <acpi/acpi_bus.h> | ||
284 | #include <acpi/actypes.h> | ||
285 | #include <linux/pci-acpi.h> | ||
286 | |||
282 | #define pciehp_get_hp_hw_control_from_firmware(dev) \ | 287 | #define pciehp_get_hp_hw_control_from_firmware(dev) \ |
283 | pciehp_acpi_get_hp_hw_control_from_firmware(dev) | 288 | pciehp_acpi_get_hp_hw_control_from_firmware(dev) |
284 | static inline int pciehp_get_hp_params_from_firmware(struct pci_dev *dev, | 289 | static inline int pciehp_get_hp_params_from_firmware(struct pci_dev *dev, |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 0d8fb6e607a1..6ab3b6cd2b54 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -38,10 +38,6 @@ | |||
38 | 38 | ||
39 | #include "../pci.h" | 39 | #include "../pci.h" |
40 | #include "pciehp.h" | 40 | #include "pciehp.h" |
41 | #include <acpi/acpi.h> | ||
42 | #include <acpi/acpi_bus.h> | ||
43 | #include <acpi/actypes.h> | ||
44 | #include <linux/pci-acpi.h> | ||
45 | #ifdef DEBUG | 41 | #ifdef DEBUG |
46 | #define DBG_K_TRACE_ENTRY ((unsigned int)0x00000001) /* On function entry */ | 42 | #define DBG_K_TRACE_ENTRY ((unsigned int)0x00000001) /* On function entry */ |
47 | #define DBG_K_TRACE_EXIT ((unsigned int)0x00000002) /* On function exit */ | 43 | #define DBG_K_TRACE_EXIT ((unsigned int)0x00000002) /* On function exit */ |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 4bf03fb67f8d..d8e9b95f0a1a 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -1730,8 +1730,8 @@ dasd_flush_request_queue(struct dasd_device * device) | |||
1730 | req = elv_next_request(device->request_queue); | 1730 | req = elv_next_request(device->request_queue); |
1731 | if (req == NULL) | 1731 | if (req == NULL) |
1732 | break; | 1732 | break; |
1733 | dasd_end_request(req, 0); | ||
1734 | blkdev_dequeue_request(req); | 1733 | blkdev_dequeue_request(req); |
1734 | dasd_end_request(req, 0); | ||
1735 | } | 1735 | } |
1736 | spin_unlock_irq(&device->request_queue_lock); | 1736 | spin_unlock_irq(&device->request_queue_lock); |
1737 | } | 1737 | } |
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index 7f6fdac74706..9d0c6e1a0e66 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -48,18 +48,20 @@ struct dasd_devmap { | |||
48 | }; | 48 | }; |
49 | 49 | ||
50 | /* | 50 | /* |
51 | * dasd_servermap is used to store the server_id of all storage servers | 51 | * dasd_server_ssid_map contains a globally unique storage server subsystem ID. |
52 | * accessed by DASD device driver. | 52 | * dasd_server_ssid_list contains the list of all subsystem IDs accessed by |
53 | * the DASD device driver. | ||
53 | */ | 54 | */ |
54 | struct dasd_servermap { | 55 | struct dasd_server_ssid_map { |
55 | struct list_head list; | 56 | struct list_head list; |
56 | struct server_id { | 57 | struct server_id { |
57 | char vendor[4]; | 58 | char vendor[4]; |
58 | char serial[15]; | 59 | char serial[15]; |
59 | } sid; | 60 | } sid; |
61 | __u16 ssid; | ||
60 | }; | 62 | }; |
61 | 63 | ||
62 | static struct list_head dasd_serverlist; | 64 | static struct list_head dasd_server_ssid_list; |
63 | 65 | ||
64 | /* | 66 | /* |
65 | * Parameter parsing functions for dasd= parameter. The syntax is: | 67 | * Parameter parsing functions for dasd= parameter. The syntax is: |
@@ -89,7 +91,7 @@ static char *dasd[256]; | |||
89 | module_param_array(dasd, charp, NULL, 0); | 91 | module_param_array(dasd, charp, NULL, 0); |
90 | 92 | ||
91 | /* | 93 | /* |
92 | * Single spinlock to protect devmap structures and lists. | 94 | * Single spinlock to protect devmap and servermap structures and lists. |
93 | */ | 95 | */ |
94 | static DEFINE_SPINLOCK(dasd_devmap_lock); | 96 | static DEFINE_SPINLOCK(dasd_devmap_lock); |
95 | 97 | ||
@@ -264,8 +266,9 @@ dasd_parse_keyword( char *parsestring ) { | |||
264 | if (dasd_page_cache) | 266 | if (dasd_page_cache) |
265 | return residual_str; | 267 | return residual_str; |
266 | dasd_page_cache = | 268 | dasd_page_cache = |
267 | kmem_cache_create("dasd_page_cache", PAGE_SIZE, 0, | 269 | kmem_cache_create("dasd_page_cache", PAGE_SIZE, |
268 | SLAB_CACHE_DMA, NULL, NULL ); | 270 | PAGE_SIZE, SLAB_CACHE_DMA, |
271 | NULL, NULL ); | ||
269 | if (!dasd_page_cache) | 272 | if (!dasd_page_cache) |
270 | MESSAGE(KERN_WARNING, "%s", "Failed to create slab, " | 273 | MESSAGE(KERN_WARNING, "%s", "Failed to create slab, " |
271 | "fixed buffer mode disabled."); | 274 | "fixed buffer mode disabled."); |
@@ -859,39 +862,6 @@ static struct attribute_group dasd_attr_group = { | |||
859 | }; | 862 | }; |
860 | 863 | ||
861 | /* | 864 | /* |
862 | * Check if the related storage server is already contained in the | ||
863 | * dasd_serverlist. If server is not contained, create new entry. | ||
864 | * Return 0 if server was already in serverlist, | ||
865 | * 1 if the server was added successfully | ||
866 | * <0 in case of error. | ||
867 | */ | ||
868 | static int | ||
869 | dasd_add_server(struct dasd_uid *uid) | ||
870 | { | ||
871 | struct dasd_servermap *new, *tmp; | ||
872 | |||
873 | /* check if server is already contained */ | ||
874 | list_for_each_entry(tmp, &dasd_serverlist, list) | ||
875 | // normale cmp? | ||
876 | if (strncmp(tmp->sid.vendor, uid->vendor, | ||
877 | sizeof(tmp->sid.vendor)) == 0 | ||
878 | && strncmp(tmp->sid.serial, uid->serial, | ||
879 | sizeof(tmp->sid.serial)) == 0) | ||
880 | return 0; | ||
881 | |||
882 | new = (struct dasd_servermap *) | ||
883 | kzalloc(sizeof(struct dasd_servermap), GFP_KERNEL); | ||
884 | if (!new) | ||
885 | return -ENOMEM; | ||
886 | |||
887 | strncpy(new->sid.vendor, uid->vendor, sizeof(new->sid.vendor)); | ||
888 | strncpy(new->sid.serial, uid->serial, sizeof(new->sid.serial)); | ||
889 | list_add(&new->list, &dasd_serverlist); | ||
890 | return 1; | ||
891 | } | ||
892 | |||
893 | |||
894 | /* | ||
895 | * Return copy of the device unique identifier. | 865 | * Return copy of the device unique identifier. |
896 | */ | 866 | */ |
897 | int | 867 | int |
@@ -910,6 +880,9 @@ dasd_get_uid(struct ccw_device *cdev, struct dasd_uid *uid) | |||
910 | 880 | ||
911 | /* | 881 | /* |
912 | * Register the given device unique identifier into devmap struct. | 882 | * Register the given device unique identifier into devmap struct. |
883 | * In addition check if the related storage server subsystem ID is already | ||
884 | * contained in the dasd_server_ssid_list. If subsystem ID is not contained, | ||
885 | * create new entry. | ||
913 | * Return 0 if server was already in serverlist, | 886 | * Return 0 if server was already in serverlist, |
914 | * 1 if the server was added successful | 887 | * 1 if the server was added successful |
915 | * <0 in case of error. | 888 | * <0 in case of error. |
@@ -918,16 +891,39 @@ int | |||
918 | dasd_set_uid(struct ccw_device *cdev, struct dasd_uid *uid) | 891 | dasd_set_uid(struct ccw_device *cdev, struct dasd_uid *uid) |
919 | { | 892 | { |
920 | struct dasd_devmap *devmap; | 893 | struct dasd_devmap *devmap; |
921 | int rc; | 894 | struct dasd_server_ssid_map *srv, *tmp; |
922 | 895 | ||
923 | devmap = dasd_find_busid(cdev->dev.bus_id); | 896 | devmap = dasd_find_busid(cdev->dev.bus_id); |
924 | if (IS_ERR(devmap)) | 897 | if (IS_ERR(devmap)) |
925 | return PTR_ERR(devmap); | 898 | return PTR_ERR(devmap); |
899 | |||
900 | /* generate entry for server_ssid_map */ | ||
901 | srv = (struct dasd_server_ssid_map *) | ||
902 | kzalloc(sizeof(struct dasd_server_ssid_map), GFP_KERNEL); | ||
903 | if (!srv) | ||
904 | return -ENOMEM; | ||
905 | strncpy(srv->sid.vendor, uid->vendor, sizeof(srv->sid.vendor) - 1); | ||
906 | strncpy(srv->sid.serial, uid->serial, sizeof(srv->sid.serial) - 1); | ||
907 | srv->ssid = uid->ssid; | ||
908 | |||
909 | /* server is already contained ? */ | ||
926 | spin_lock(&dasd_devmap_lock); | 910 | spin_lock(&dasd_devmap_lock); |
927 | devmap->uid = *uid; | 911 | devmap->uid = *uid; |
928 | rc = dasd_add_server(uid); | 912 | list_for_each_entry(tmp, &dasd_server_ssid_list, list) { |
913 | if (!memcmp(&srv->sid, &tmp->sid, | ||
914 | sizeof(struct dasd_server_ssid_map))) { | ||
915 | kfree(srv); | ||
916 | srv = NULL; | ||
917 | break; | ||
918 | } | ||
919 | } | ||
920 | |||
921 | /* add servermap to serverlist */ | ||
922 | if (srv) | ||
923 | list_add(&srv->list, &dasd_server_ssid_list); | ||
929 | spin_unlock(&dasd_devmap_lock); | 924 | spin_unlock(&dasd_devmap_lock); |
930 | return rc; | 925 | |
926 | return (srv ? 1 : 0); | ||
931 | } | 927 | } |
932 | EXPORT_SYMBOL_GPL(dasd_set_uid); | 928 | EXPORT_SYMBOL_GPL(dasd_set_uid); |
933 | 929 | ||
@@ -995,7 +991,7 @@ dasd_devmap_init(void) | |||
995 | INIT_LIST_HEAD(&dasd_hashlists[i]); | 991 | INIT_LIST_HEAD(&dasd_hashlists[i]); |
996 | 992 | ||
997 | /* Initialize servermap structure. */ | 993 | /* Initialize servermap structure. */ |
998 | INIT_LIST_HEAD(&dasd_serverlist); | 994 | INIT_LIST_HEAD(&dasd_server_ssid_list); |
999 | return 0; | 995 | return 0; |
1000 | } | 996 | } |
1001 | 997 | ||
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 39c2281371b5..957ed5db98e4 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -468,11 +468,11 @@ dasd_eckd_generate_uid(struct dasd_device *device, struct dasd_uid *uid) | |||
468 | return -ENODEV; | 468 | return -ENODEV; |
469 | 469 | ||
470 | memset(uid, 0, sizeof(struct dasd_uid)); | 470 | memset(uid, 0, sizeof(struct dasd_uid)); |
471 | strncpy(uid->vendor, confdata->ned1.HDA_manufacturer, | 471 | memcpy(uid->vendor, confdata->ned1.HDA_manufacturer, |
472 | sizeof(uid->vendor) - 1); | 472 | sizeof(uid->vendor) - 1); |
473 | EBCASC(uid->vendor, sizeof(uid->vendor) - 1); | 473 | EBCASC(uid->vendor, sizeof(uid->vendor) - 1); |
474 | strncpy(uid->serial, confdata->ned1.HDA_location, | 474 | memcpy(uid->serial, confdata->ned1.HDA_location, |
475 | sizeof(uid->serial) - 1); | 475 | sizeof(uid->serial) - 1); |
476 | EBCASC(uid->serial, sizeof(uid->serial) - 1); | 476 | EBCASC(uid->serial, sizeof(uid->serial) - 1); |
477 | uid->ssid = confdata->neq.subsystemID; | 477 | uid->ssid = confdata->neq.subsystemID; |
478 | if (confdata->ned2.sneq.flags == 0x40) { | 478 | if (confdata->ned2.sneq.flags == 0x40) { |
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c index 1140302ff11d..ca7d51f7eccc 100644 --- a/drivers/s390/block/xpram.c +++ b/drivers/s390/block/xpram.c | |||
@@ -48,15 +48,6 @@ | |||
48 | #define PRINT_ERR(x...) printk(KERN_ERR XPRAM_NAME " error:" x) | 48 | #define PRINT_ERR(x...) printk(KERN_ERR XPRAM_NAME " error:" x) |
49 | 49 | ||
50 | 50 | ||
51 | static struct sysdev_class xpram_sysclass = { | ||
52 | set_kset_name("xpram"), | ||
53 | }; | ||
54 | |||
55 | static struct sys_device xpram_sys_device = { | ||
56 | .id = 0, | ||
57 | .cls = &xpram_sysclass, | ||
58 | }; | ||
59 | |||
60 | typedef struct { | 51 | typedef struct { |
61 | unsigned int size; /* size of xpram segment in pages */ | 52 | unsigned int size; /* size of xpram segment in pages */ |
62 | unsigned int offset; /* start page of xpram segment */ | 53 | unsigned int offset; /* start page of xpram segment */ |
@@ -451,8 +442,6 @@ static void __exit xpram_exit(void) | |||
451 | } | 442 | } |
452 | unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME); | 443 | unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME); |
453 | blk_cleanup_queue(xpram_queue); | 444 | blk_cleanup_queue(xpram_queue); |
454 | sysdev_unregister(&xpram_sys_device); | ||
455 | sysdev_class_unregister(&xpram_sysclass); | ||
456 | } | 445 | } |
457 | 446 | ||
458 | static int __init xpram_init(void) | 447 | static int __init xpram_init(void) |
@@ -470,19 +459,7 @@ static int __init xpram_init(void) | |||
470 | rc = xpram_setup_sizes(xpram_pages); | 459 | rc = xpram_setup_sizes(xpram_pages); |
471 | if (rc) | 460 | if (rc) |
472 | return rc; | 461 | return rc; |
473 | rc = sysdev_class_register(&xpram_sysclass); | 462 | return xpram_setup_blkdev(); |
474 | if (rc) | ||
475 | return rc; | ||
476 | |||
477 | rc = sysdev_register(&xpram_sys_device); | ||
478 | if (rc) { | ||
479 | sysdev_class_unregister(&xpram_sysclass); | ||
480 | return rc; | ||
481 | } | ||
482 | rc = xpram_setup_blkdev(); | ||
483 | if (rc) | ||
484 | sysdev_unregister(&xpram_sys_device); | ||
485 | return rc; | ||
486 | } | 463 | } |
487 | 464 | ||
488 | module_init(xpram_init); | 465 | module_init(xpram_init); |
diff --git a/drivers/s390/char/tape_class.c b/drivers/s390/char/tape_class.c index 643b6d078563..56b87618b100 100644 --- a/drivers/s390/char/tape_class.c +++ b/drivers/s390/char/tape_class.c | |||
@@ -76,7 +76,7 @@ struct tape_class_device *register_tape_dev( | |||
76 | device, | 76 | device, |
77 | "%s", tcd->device_name | 77 | "%s", tcd->device_name |
78 | ); | 78 | ); |
79 | rc = PTR_ERR(tcd->class_device); | 79 | rc = IS_ERR(tcd->class_device) ? PTR_ERR(tcd->class_device) : 0; |
80 | if (rc) | 80 | if (rc) |
81 | goto fail_with_cdev; | 81 | goto fail_with_cdev; |
82 | rc = sysfs_create_link( | 82 | rc = sysfs_create_link( |
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index 7a39e0b0386c..6d91c2eb205b 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
@@ -772,6 +772,7 @@ ccw_device_online_verify(struct ccw_device *cdev, enum dev_event dev_event) | |||
772 | stsch(sch->schid, &sch->schib); | 772 | stsch(sch->schid, &sch->schib); |
773 | 773 | ||
774 | if (sch->schib.scsw.actl != 0 || | 774 | if (sch->schib.scsw.actl != 0 || |
775 | (sch->schib.scsw.stctl & SCSW_STCTL_STATUS_PEND) || | ||
775 | (cdev->private->irb.scsw.stctl & SCSW_STCTL_STATUS_PEND)) { | 776 | (cdev->private->irb.scsw.stctl & SCSW_STCTL_STATUS_PEND)) { |
776 | /* | 777 | /* |
777 | * No final status yet or final status not yet delivered | 778 | * No final status yet or final status not yet delivered |
diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c index a60124264bee..9e3de0bd59b5 100644 --- a/drivers/s390/cio/device_ops.c +++ b/drivers/s390/cio/device_ops.c | |||
@@ -263,6 +263,9 @@ ccw_device_wake_up(struct ccw_device *cdev, unsigned long ip, struct irb *irb) | |||
263 | /* Abuse intparm for error reporting. */ | 263 | /* Abuse intparm for error reporting. */ |
264 | if (IS_ERR(irb)) | 264 | if (IS_ERR(irb)) |
265 | cdev->private->intparm = -EIO; | 265 | cdev->private->intparm = -EIO; |
266 | else if (irb->scsw.cc == 1) | ||
267 | /* Retry for deferred condition code. */ | ||
268 | cdev->private->intparm = -EAGAIN; | ||
266 | else if ((irb->scsw.dstat != | 269 | else if ((irb->scsw.dstat != |
267 | (DEV_STAT_CHN_END|DEV_STAT_DEV_END)) || | 270 | (DEV_STAT_CHN_END|DEV_STAT_DEV_END)) || |
268 | (irb->scsw.cstat != 0)) { | 271 | (irb->scsw.cstat != 0)) { |
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 5fff1f93973a..e1327b8fce00 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -8510,9 +8510,9 @@ static int | |||
8510 | qeth_ipv6_init(void) | 8510 | qeth_ipv6_init(void) |
8511 | { | 8511 | { |
8512 | qeth_old_arp_constructor = arp_tbl.constructor; | 8512 | qeth_old_arp_constructor = arp_tbl.constructor; |
8513 | write_lock(&arp_tbl.lock); | 8513 | write_lock_bh(&arp_tbl.lock); |
8514 | arp_tbl.constructor = qeth_arp_constructor; | 8514 | arp_tbl.constructor = qeth_arp_constructor; |
8515 | write_unlock(&arp_tbl.lock); | 8515 | write_unlock_bh(&arp_tbl.lock); |
8516 | 8516 | ||
8517 | arp_direct_ops = (struct neigh_ops*) | 8517 | arp_direct_ops = (struct neigh_ops*) |
8518 | kmalloc(sizeof(struct neigh_ops), GFP_KERNEL); | 8518 | kmalloc(sizeof(struct neigh_ops), GFP_KERNEL); |
@@ -8528,9 +8528,9 @@ qeth_ipv6_init(void) | |||
8528 | static void | 8528 | static void |
8529 | qeth_ipv6_uninit(void) | 8529 | qeth_ipv6_uninit(void) |
8530 | { | 8530 | { |
8531 | write_lock(&arp_tbl.lock); | 8531 | write_lock_bh(&arp_tbl.lock); |
8532 | arp_tbl.constructor = qeth_old_arp_constructor; | 8532 | arp_tbl.constructor = qeth_old_arp_constructor; |
8533 | write_unlock(&arp_tbl.lock); | 8533 | write_unlock_bh(&arp_tbl.lock); |
8534 | kfree(arp_direct_ops); | 8534 | kfree(arp_direct_ops); |
8535 | } | 8535 | } |
8536 | #endif /* CONFIG_QETH_IPV6 */ | 8536 | #endif /* CONFIG_QETH_IPV6 */ |
diff --git a/drivers/scsi/arm/Kconfig b/drivers/scsi/arm/Kconfig index 06d7601cdf56..d006a8cb4a74 100644 --- a/drivers/scsi/arm/Kconfig +++ b/drivers/scsi/arm/Kconfig | |||
@@ -69,6 +69,7 @@ comment "The following drivers are not fully supported" | |||
69 | config SCSI_CUMANA_1 | 69 | config SCSI_CUMANA_1 |
70 | tristate "CumanaSCSI I support (EXPERIMENTAL)" | 70 | tristate "CumanaSCSI I support (EXPERIMENTAL)" |
71 | depends on ARCH_ACORN && EXPERIMENTAL && SCSI | 71 | depends on ARCH_ACORN && EXPERIMENTAL && SCSI |
72 | select SCSI_SPI_ATTRS | ||
72 | help | 73 | help |
73 | This enables support for the Cumana SCSI I card. If you have an | 74 | This enables support for the Cumana SCSI I card. If you have an |
74 | Acorn system with one of these, say Y. If unsure, say N. | 75 | Acorn system with one of these, say Y. If unsure, say N. |
@@ -76,6 +77,7 @@ config SCSI_CUMANA_1 | |||
76 | config SCSI_ECOSCSI | 77 | config SCSI_ECOSCSI |
77 | tristate "EcoScsi support (EXPERIMENTAL)" | 78 | tristate "EcoScsi support (EXPERIMENTAL)" |
78 | depends on ARCH_ACORN && EXPERIMENTAL && (ARCH_ARC || ARCH_A5K) && SCSI | 79 | depends on ARCH_ACORN && EXPERIMENTAL && (ARCH_ARC || ARCH_A5K) && SCSI |
80 | select SCSI_SPI_ATTRS | ||
79 | help | 81 | help |
80 | This enables support for the EcoSCSI card -- a small card that sits | 82 | This enables support for the EcoSCSI card -- a small card that sits |
81 | in the Econet socket. If you have an Acorn system with one of these, | 83 | in the Econet socket. If you have an Acorn system with one of these, |
@@ -84,6 +86,7 @@ config SCSI_ECOSCSI | |||
84 | config SCSI_OAK1 | 86 | config SCSI_OAK1 |
85 | tristate "Oak SCSI support (EXPERIMENTAL)" | 87 | tristate "Oak SCSI support (EXPERIMENTAL)" |
86 | depends on ARCH_ACORN && EXPERIMENTAL && SCSI | 88 | depends on ARCH_ACORN && EXPERIMENTAL && SCSI |
89 | select SCSI_SPI_ATTRS | ||
87 | help | 90 | help |
88 | This enables support for the Oak SCSI card. If you have an Acorn | 91 | This enables support for the Oak SCSI card. If you have an Acorn |
89 | system with one of these, say Y. If unsure, say N. | 92 | system with one of these, say Y. If unsure, say N. |
diff --git a/drivers/scsi/arm/scsi.h b/drivers/scsi/arm/scsi.h index 6dd544a5eb56..8c2600ffc6af 100644 --- a/drivers/scsi/arm/scsi.h +++ b/drivers/scsi/arm/scsi.h | |||
@@ -74,7 +74,7 @@ static inline void init_SCp(Scsi_Cmnd *SCpnt) | |||
74 | unsigned long len = 0; | 74 | unsigned long len = 0; |
75 | int buf; | 75 | int buf; |
76 | 76 | ||
77 | SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->buffer; | 77 | SCpnt->SCp.buffer = (struct scatterlist *) SCpnt->request_buffer; |
78 | SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1; | 78 | SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1; |
79 | SCpnt->SCp.ptr = (char *) | 79 | SCpnt->SCp.ptr = (char *) |
80 | (page_address(SCpnt->SCp.buffer->page) + | 80 | (page_address(SCpnt->SCp.buffer->page) + |
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index 19745a31072b..5e8afc876980 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c | |||
@@ -567,8 +567,8 @@ static int piix_sata_prereset(struct ata_port *ap) | |||
567 | present = 1; | 567 | present = 1; |
568 | } | 568 | } |
569 | 569 | ||
570 | DPRINTK("ata%u: LEAVE, pcs=0x%x present_mask=0x%x\n", | 570 | DPRINTK("ata%u: LEAVE, pcs=0x%x present=0x%x\n", |
571 | ap->id, pcs, present_mask); | 571 | ap->id, pcs, present); |
572 | 572 | ||
573 | if (!present) { | 573 | if (!present) { |
574 | ata_port_printk(ap, KERN_INFO, "SATA port has no device.\n"); | 574 | ata_port_printk(ap, KERN_INFO, "SATA port has no device.\n"); |
@@ -828,6 +828,7 @@ static void __devinit piix_init_sata_map(struct pci_dev *pdev, | |||
828 | case IDE: | 828 | case IDE: |
829 | WARN_ON((i & 1) || map[i + 1] != IDE); | 829 | WARN_ON((i & 1) || map[i + 1] != IDE); |
830 | pinfo[i / 2] = piix_port_info[ich5_pata]; | 830 | pinfo[i / 2] = piix_port_info[ich5_pata]; |
831 | pinfo[i / 2].private_data = hpriv; | ||
831 | i++; | 832 | i++; |
832 | printk(" IDE IDE"); | 833 | printk(" IDE IDE"); |
833 | break; | 834 | break; |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 386e5f21e191..16fc2dd8f2f7 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -5185,28 +5185,6 @@ void ata_host_stop (struct ata_host_set *host_set) | |||
5185 | iounmap(host_set->mmio_base); | 5185 | iounmap(host_set->mmio_base); |
5186 | } | 5186 | } |
5187 | 5187 | ||
5188 | |||
5189 | /** | ||
5190 | * ata_host_remove - Unregister SCSI host structure with upper layers | ||
5191 | * @ap: Port to unregister | ||
5192 | * @do_unregister: 1 if we fully unregister, 0 to just stop the port | ||
5193 | * | ||
5194 | * LOCKING: | ||
5195 | * Inherited from caller. | ||
5196 | */ | ||
5197 | |||
5198 | static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister) | ||
5199 | { | ||
5200 | struct Scsi_Host *sh = ap->host; | ||
5201 | |||
5202 | DPRINTK("ENTER\n"); | ||
5203 | |||
5204 | if (do_unregister) | ||
5205 | scsi_remove_host(sh); | ||
5206 | |||
5207 | ap->ops->port_stop(ap); | ||
5208 | } | ||
5209 | |||
5210 | /** | 5188 | /** |
5211 | * ata_dev_init - Initialize an ata_device structure | 5189 | * ata_dev_init - Initialize an ata_device structure |
5212 | * @dev: Device structure to initialize | 5190 | * @dev: Device structure to initialize |
@@ -5532,8 +5510,11 @@ int ata_device_add(const struct ata_probe_ent *ent) | |||
5532 | 5510 | ||
5533 | err_out: | 5511 | err_out: |
5534 | for (i = 0; i < count; i++) { | 5512 | for (i = 0; i < count; i++) { |
5535 | ata_host_remove(host_set->ports[i], 1); | 5513 | struct ata_port *ap = host_set->ports[i]; |
5536 | scsi_host_put(host_set->ports[i]->host); | 5514 | if (ap) { |
5515 | ap->ops->port_stop(ap); | ||
5516 | scsi_host_put(ap->host); | ||
5517 | } | ||
5537 | } | 5518 | } |
5538 | err_free_ret: | 5519 | err_free_ret: |
5539 | kfree(host_set); | 5520 | kfree(host_set); |
@@ -5558,7 +5539,7 @@ void ata_port_detach(struct ata_port *ap) | |||
5558 | int i; | 5539 | int i; |
5559 | 5540 | ||
5560 | if (!ap->ops->error_handler) | 5541 | if (!ap->ops->error_handler) |
5561 | return; | 5542 | goto skip_eh; |
5562 | 5543 | ||
5563 | /* tell EH we're leaving & flush EH */ | 5544 | /* tell EH we're leaving & flush EH */ |
5564 | spin_lock_irqsave(ap->lock, flags); | 5545 | spin_lock_irqsave(ap->lock, flags); |
@@ -5594,6 +5575,7 @@ void ata_port_detach(struct ata_port *ap) | |||
5594 | cancel_delayed_work(&ap->hotplug_task); | 5575 | cancel_delayed_work(&ap->hotplug_task); |
5595 | flush_workqueue(ata_aux_wq); | 5576 | flush_workqueue(ata_aux_wq); |
5596 | 5577 | ||
5578 | skip_eh: | ||
5597 | /* remove the associated SCSI host */ | 5579 | /* remove the associated SCSI host */ |
5598 | scsi_remove_host(ap->host); | 5580 | scsi_remove_host(ap->host); |
5599 | } | 5581 | } |
@@ -5662,7 +5644,7 @@ int ata_scsi_release(struct Scsi_Host *host) | |||
5662 | DPRINTK("ENTER\n"); | 5644 | DPRINTK("ENTER\n"); |
5663 | 5645 | ||
5664 | ap->ops->port_disable(ap); | 5646 | ap->ops->port_disable(ap); |
5665 | ata_host_remove(ap, 0); | 5647 | ap->ops->port_stop(ap); |
5666 | 5648 | ||
5667 | DPRINTK("EXIT\n"); | 5649 | DPRINTK("EXIT\n"); |
5668 | return 1; | 5650 | return 1; |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 7ced41ecde86..e92c31d698ff 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -2353,6 +2353,19 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) | |||
2353 | ata_gen_ata_desc_sense(qc); | 2353 | ata_gen_ata_desc_sense(qc); |
2354 | } | 2354 | } |
2355 | 2355 | ||
2356 | /* SCSI EH automatically locks door if sdev->locked is | ||
2357 | * set. Sometimes door lock request continues to | ||
2358 | * fail, for example, when no media is present. This | ||
2359 | * creates a loop - SCSI EH issues door lock which | ||
2360 | * fails and gets invoked again to acquire sense data | ||
2361 | * for the failed command. | ||
2362 | * | ||
2363 | * If door lock fails, always clear sdev->locked to | ||
2364 | * avoid this infinite loop. | ||
2365 | */ | ||
2366 | if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL) | ||
2367 | qc->dev->sdev->locked = 0; | ||
2368 | |||
2356 | qc->scsicmd->result = SAM_STAT_CHECK_CONDITION; | 2369 | qc->scsicmd->result = SAM_STAT_CHECK_CONDITION; |
2357 | qc->scsidone(cmd); | 2370 | qc->scsidone(cmd); |
2358 | ata_qc_free(qc); | 2371 | ata_qc_free(qc); |
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index 2e0f4a4076af..3f368c7d3ef9 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c | |||
@@ -1106,7 +1106,6 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1106 | 1106 | ||
1107 | probe_ent->irq = pdev->irq; | 1107 | probe_ent->irq = pdev->irq; |
1108 | probe_ent->irq_flags = IRQF_SHARED; | 1108 | probe_ent->irq_flags = IRQF_SHARED; |
1109 | probe_ent->mmio_base = port_base; | ||
1110 | probe_ent->private_data = hpriv; | 1109 | probe_ent->private_data = hpriv; |
1111 | 1110 | ||
1112 | hpriv->host_base = host_base; | 1111 | hpriv->host_base = host_base; |
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index 822914e2f43b..f7a975d5db09 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c | |||
@@ -110,7 +110,6 @@ static void au1xxx_start_ohc(struct platform_device *dev) | |||
110 | 110 | ||
111 | printk(KERN_DEBUG __FILE__ | 111 | printk(KERN_DEBUG __FILE__ |
112 | ": Clock to USB host has been enabled \n"); | 112 | ": Clock to USB host has been enabled \n"); |
113 | #endif | ||
114 | } | 113 | } |
115 | 114 | ||
116 | static void au1xxx_stop_ohc(struct platform_device *dev) | 115 | static void au1xxx_stop_ohc(struct platform_device *dev) |
diff --git a/drivers/usb/input/appletouch.c b/drivers/usb/input/appletouch.c index 9e3f13903371..044faa07e297 100644 --- a/drivers/usb/input/appletouch.c +++ b/drivers/usb/input/appletouch.c | |||
@@ -597,9 +597,9 @@ static void atp_disconnect(struct usb_interface *iface) | |||
597 | if (dev) { | 597 | if (dev) { |
598 | usb_kill_urb(dev->urb); | 598 | usb_kill_urb(dev->urb); |
599 | input_unregister_device(dev->input); | 599 | input_unregister_device(dev->input); |
600 | usb_free_urb(dev->urb); | ||
601 | usb_buffer_free(dev->udev, dev->datalen, | 600 | usb_buffer_free(dev->udev, dev->datalen, |
602 | dev->data, dev->urb->transfer_dma); | 601 | dev->data, dev->urb->transfer_dma); |
602 | usb_free_urb(dev->urb); | ||
603 | kfree(dev); | 603 | kfree(dev); |
604 | } | 604 | } |
605 | printk(KERN_INFO "input: appletouch disconnected\n"); | 605 | printk(KERN_INFO "input: appletouch disconnected\n"); |
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 786e1dbe88ec..983e104dd452 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -1242,11 +1242,12 @@ done: | |||
1242 | static int ctrl_out (struct usbtest_dev *dev, | 1242 | static int ctrl_out (struct usbtest_dev *dev, |
1243 | unsigned count, unsigned length, unsigned vary) | 1243 | unsigned count, unsigned length, unsigned vary) |
1244 | { | 1244 | { |
1245 | unsigned i, j, len, retval; | 1245 | unsigned i, j, len; |
1246 | int retval; | ||
1246 | u8 *buf; | 1247 | u8 *buf; |
1247 | char *what = "?"; | 1248 | char *what = "?"; |
1248 | struct usb_device *udev; | 1249 | struct usb_device *udev; |
1249 | 1250 | ||
1250 | if (length < 1 || length > 0xffff || vary >= length) | 1251 | if (length < 1 || length > 0xffff || vary >= length) |
1251 | return -EINVAL; | 1252 | return -EINVAL; |
1252 | 1253 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index a20da8528a5f..15945e806f03 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -306,6 +306,8 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = { | |||
306 | 306 | ||
307 | 307 | ||
308 | static struct usb_device_id id_table_combined [] = { | 308 | static struct usb_device_id id_table_combined [] = { |
309 | { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, | ||
310 | { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, | ||
309 | { USB_DEVICE(FTDI_VID, FTDI_ACTZWAVE_PID) }, | 311 | { USB_DEVICE(FTDI_VID, FTDI_ACTZWAVE_PID) }, |
310 | { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) }, | 312 | { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) }, |
311 | { USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) }, | 313 | { USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 9f7343a45424..8888cd80a491 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -32,6 +32,12 @@ | |||
32 | #define FTDI_NF_RIC_PID 0x0001 /* Product Id */ | 32 | #define FTDI_NF_RIC_PID 0x0001 /* Product Id */ |
33 | 33 | ||
34 | 34 | ||
35 | /* www.canusb.com Lawicel CANUSB device */ | ||
36 | #define FTDI_CANUSB_PID 0xFFA8 /* Product Id */ | ||
37 | |||
38 | /* AlphaMicro Components AMC-232USB01 device */ | ||
39 | #define FTDI_AMC232_PID 0xFF00 /* Product Id */ | ||
40 | |||
35 | /* ACT Solutions HomePro ZWave interface (http://www.act-solutions.com/HomePro.htm) */ | 41 | /* ACT Solutions HomePro ZWave interface (http://www.act-solutions.com/HomePro.htm) */ |
36 | #define FTDI_ACTZWAVE_PID 0xF2D0 | 42 | #define FTDI_ACTZWAVE_PID 0xF2D0 |
37 | 43 | ||
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index 7e1bd5d6dfa0..9840bade79f9 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c | |||
@@ -251,6 +251,8 @@ static struct usb_device_id ipaq_id_table [] = { | |||
251 | { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ | 251 | { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ |
252 | { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */ | 252 | { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */ |
253 | { USB_DEVICE(0x04DD, 0x9102) }, /* SHARP WS003SH USB Modem */ | 253 | { USB_DEVICE(0x04DD, 0x9102) }, /* SHARP WS003SH USB Modem */ |
254 | { USB_DEVICE(0x04DD, 0x9121) }, /* SHARP WS004SH USB Modem */ | ||
255 | { USB_DEVICE(0x04DD, 0x9123) }, /* SHARP WS007SH USB Modem */ | ||
254 | { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */ | 256 | { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */ |
255 | { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */ | 257 | { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */ |
256 | { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */ | 258 | { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */ |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 2793f9a912b4..fd158e063c06 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -1240,6 +1240,16 @@ UNUSUAL_DEV( 0x0ed1, 0x7636, 0x0103, 0x0103, | |||
1240 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1240 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1241 | US_FL_IGNORE_RESIDUE | US_FL_GO_SLOW | US_FL_MAX_SECTORS_64), | 1241 | US_FL_IGNORE_RESIDUE | US_FL_GO_SLOW | US_FL_MAX_SECTORS_64), |
1242 | 1242 | ||
1243 | /* David Kuehling <dvdkhlng@gmx.de>: | ||
1244 | * for MP3-Player AVOX WSX-300ER (bought in Japan). Reports lots of SCSI | ||
1245 | * errors when trying to write. | ||
1246 | */ | ||
1247 | UNUSUAL_DEV( 0x0f19, 0x0105, 0x0100, 0x0100, | ||
1248 | "C-MEX", | ||
1249 | "A-VOX", | ||
1250 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1251 | US_FL_IGNORE_RESIDUE ), | ||
1252 | |||
1243 | /* Reported by Michael Stattmann <michael@stattmann.com> */ | 1253 | /* Reported by Michael Stattmann <michael@stattmann.com> */ |
1244 | UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, | 1254 | UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, |
1245 | "Sony Ericsson", | 1255 | "Sony Ericsson", |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index c40b9b8b1e7e..702eb933cf88 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -554,7 +554,7 @@ config FB_VESA | |||
554 | 554 | ||
555 | config FB_IMAC | 555 | config FB_IMAC |
556 | bool "Intel-based Macintosh Framebuffer Support" | 556 | bool "Intel-based Macintosh Framebuffer Support" |
557 | depends on (FB = y) && X86 | 557 | depends on (FB = y) && X86 && EFI |
558 | select FB_CFB_FILLRECT | 558 | select FB_CFB_FILLRECT |
559 | select FB_CFB_COPYAREA | 559 | select FB_CFB_COPYAREA |
560 | select FB_CFB_IMAGEBLIT | 560 | select FB_CFB_IMAGEBLIT |
diff --git a/drivers/video/imacfb.c b/drivers/video/imacfb.c index ff233b84dec4..b485bece5fc9 100644 --- a/drivers/video/imacfb.c +++ b/drivers/video/imacfb.c | |||
@@ -18,6 +18,8 @@ | |||
18 | #include <linux/screen_info.h> | 18 | #include <linux/screen_info.h> |
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/string.h> | 20 | #include <linux/string.h> |
21 | #include <linux/dmi.h> | ||
22 | #include <linux/efi.h> | ||
21 | 23 | ||
22 | #include <asm/io.h> | 24 | #include <asm/io.h> |
23 | 25 | ||
@@ -28,7 +30,7 @@ typedef enum _MAC_TYPE { | |||
28 | M_I20, | 30 | M_I20, |
29 | M_MINI, | 31 | M_MINI, |
30 | M_MACBOOK, | 32 | M_MACBOOK, |
31 | M_NEW | 33 | M_UNKNOWN |
32 | } MAC_TYPE; | 34 | } MAC_TYPE; |
33 | 35 | ||
34 | /* --------------------------------------------------------------------- */ | 36 | /* --------------------------------------------------------------------- */ |
@@ -52,10 +54,36 @@ static struct fb_fix_screeninfo imacfb_fix __initdata = { | |||
52 | }; | 54 | }; |
53 | 55 | ||
54 | static int inverse; | 56 | static int inverse; |
55 | static int model = M_NEW; | 57 | static int model = M_UNKNOWN; |
56 | static int manual_height; | 58 | static int manual_height; |
57 | static int manual_width; | 59 | static int manual_width; |
58 | 60 | ||
61 | static int set_system(struct dmi_system_id *id) | ||
62 | { | ||
63 | printk(KERN_INFO "imacfb: %s detected - set system to %ld\n", | ||
64 | id->ident, (long)id->driver_data); | ||
65 | |||
66 | model = (long)id->driver_data; | ||
67 | |||
68 | return 0; | ||
69 | } | ||
70 | |||
71 | static struct dmi_system_id __initdata dmi_system_table[] = { | ||
72 | { set_system, "iMac4,1", { | ||
73 | DMI_MATCH(DMI_BIOS_VENDOR,"Apple Computer, Inc."), | ||
74 | DMI_MATCH(DMI_BIOS_VERSION,"iMac4,1") }, (void*)M_I17}, | ||
75 | { set_system, "MacBookPro1,1", { | ||
76 | DMI_MATCH(DMI_BIOS_VENDOR,"Apple Computer, Inc."), | ||
77 | DMI_MATCH(DMI_BIOS_VERSION,"MacBookPro1,1") }, (void*)M_I17}, | ||
78 | { set_system, "MacBook1,1", { | ||
79 | DMI_MATCH(DMI_BIOS_VENDOR,"Apple Computer, Inc."), | ||
80 | DMI_MATCH(DMI_PRODUCT_NAME,"MacBook1,1")}, (void *)M_MACBOOK}, | ||
81 | { set_system, "Macmini1,1", { | ||
82 | DMI_MATCH(DMI_BIOS_VENDOR,"Apple Computer, Inc."), | ||
83 | DMI_MATCH(DMI_PRODUCT_NAME,"Macmini1,1")}, (void *)M_MINI}, | ||
84 | {}, | ||
85 | }; | ||
86 | |||
59 | #define DEFAULT_FB_MEM 1024*1024*16 | 87 | #define DEFAULT_FB_MEM 1024*1024*16 |
60 | 88 | ||
61 | /* --------------------------------------------------------------------- */ | 89 | /* --------------------------------------------------------------------- */ |
@@ -149,7 +177,6 @@ static int __init imacfb_probe(struct platform_device *dev) | |||
149 | screen_info.lfb_linelength = 1472 * 4; | 177 | screen_info.lfb_linelength = 1472 * 4; |
150 | screen_info.lfb_base = 0x80010000; | 178 | screen_info.lfb_base = 0x80010000; |
151 | break; | 179 | break; |
152 | case M_NEW: | ||
153 | case M_I20: | 180 | case M_I20: |
154 | screen_info.lfb_width = 1680; | 181 | screen_info.lfb_width = 1680; |
155 | screen_info.lfb_height = 1050; | 182 | screen_info.lfb_height = 1050; |
@@ -207,6 +234,10 @@ static int __init imacfb_probe(struct platform_device *dev) | |||
207 | size_remap = size_total; | 234 | size_remap = size_total; |
208 | imacfb_fix.smem_len = size_remap; | 235 | imacfb_fix.smem_len = size_remap; |
209 | 236 | ||
237 | #ifndef __i386__ | ||
238 | screen_info.imacpm_seg = 0; | ||
239 | #endif | ||
240 | |||
210 | if (!request_mem_region(imacfb_fix.smem_start, size_total, "imacfb")) { | 241 | if (!request_mem_region(imacfb_fix.smem_start, size_total, "imacfb")) { |
211 | printk(KERN_WARNING | 242 | printk(KERN_WARNING |
212 | "imacfb: cannot reserve video memory at 0x%lx\n", | 243 | "imacfb: cannot reserve video memory at 0x%lx\n", |
@@ -324,8 +355,16 @@ static int __init imacfb_init(void) | |||
324 | int ret; | 355 | int ret; |
325 | char *option = NULL; | 356 | char *option = NULL; |
326 | 357 | ||
327 | /* ignore error return of fb_get_options */ | 358 | if (!efi_enabled) |
328 | fb_get_options("imacfb", &option); | 359 | return -ENODEV; |
360 | if (!dmi_check_system(dmi_system_table)) | ||
361 | return -ENODEV; | ||
362 | if (model == M_UNKNOWN) | ||
363 | return -ENODEV; | ||
364 | |||
365 | if (fb_get_options("imacfb", &option)) | ||
366 | return -ENODEV; | ||
367 | |||
329 | imacfb_setup(option); | 368 | imacfb_setup(option); |
330 | ret = platform_driver_register(&imacfb_driver); | 369 | ret = platform_driver_register(&imacfb_driver); |
331 | 370 | ||
diff --git a/fs/adfs/super.c b/fs/adfs/super.c index ba1c88af49fe..82011019494c 100644 --- a/fs/adfs/super.c +++ b/fs/adfs/super.c | |||
@@ -308,7 +308,7 @@ static struct adfs_discmap *adfs_read_map(struct super_block *sb, struct adfs_di | |||
308 | if (adfs_checkmap(sb, dm)) | 308 | if (adfs_checkmap(sb, dm)) |
309 | return dm; | 309 | return dm; |
310 | 310 | ||
311 | adfs_error(sb, NULL, "map corrupted"); | 311 | adfs_error(sb, "map corrupted"); |
312 | 312 | ||
313 | error_free: | 313 | error_free: |
314 | while (--zone >= 0) | 314 | while (--zone >= 0) |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 63614ed16336..5c4fcd1dbf59 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -395,14 +395,16 @@ static int fuse_readpages(struct file *file, struct address_space *mapping, | |||
395 | struct fuse_readpages_data data; | 395 | struct fuse_readpages_data data; |
396 | int err; | 396 | int err; |
397 | 397 | ||
398 | err = -EIO; | ||
398 | if (is_bad_inode(inode)) | 399 | if (is_bad_inode(inode)) |
399 | return -EIO; | 400 | goto clean_pages_up; |
400 | 401 | ||
401 | data.file = file; | 402 | data.file = file; |
402 | data.inode = inode; | 403 | data.inode = inode; |
403 | data.req = fuse_get_req(fc); | 404 | data.req = fuse_get_req(fc); |
405 | err = PTR_ERR(data.req); | ||
404 | if (IS_ERR(data.req)) | 406 | if (IS_ERR(data.req)) |
405 | return PTR_ERR(data.req); | 407 | goto clean_pages_up; |
406 | 408 | ||
407 | err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data); | 409 | err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data); |
408 | if (!err) { | 410 | if (!err) { |
@@ -412,6 +414,10 @@ static int fuse_readpages(struct file *file, struct address_space *mapping, | |||
412 | fuse_put_request(fc, data.req); | 414 | fuse_put_request(fc, data.req); |
413 | } | 415 | } |
414 | return err; | 416 | return err; |
417 | |||
418 | clean_pages_up: | ||
419 | put_pages_list(pages); | ||
420 | return err; | ||
415 | } | 421 | } |
416 | 422 | ||
417 | static size_t fuse_send_write(struct fuse_req *req, struct file *file, | 423 | static size_t fuse_send_write(struct fuse_req *req, struct file *file, |
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index 43e3f566aad6..a223cf4faa9b 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c | |||
@@ -168,16 +168,15 @@ void jfs_dirty_inode(struct inode *inode) | |||
168 | set_cflag(COMMIT_Dirty, inode); | 168 | set_cflag(COMMIT_Dirty, inode); |
169 | } | 169 | } |
170 | 170 | ||
171 | static int | 171 | int jfs_get_block(struct inode *ip, sector_t lblock, |
172 | jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks, | 172 | struct buffer_head *bh_result, int create) |
173 | struct buffer_head *bh_result, int create) | ||
174 | { | 173 | { |
175 | s64 lblock64 = lblock; | 174 | s64 lblock64 = lblock; |
176 | int rc = 0; | 175 | int rc = 0; |
177 | xad_t xad; | 176 | xad_t xad; |
178 | s64 xaddr; | 177 | s64 xaddr; |
179 | int xflag; | 178 | int xflag; |
180 | s32 xlen = max_blocks; | 179 | s32 xlen = bh_result->b_size >> ip->i_blkbits; |
181 | 180 | ||
182 | /* | 181 | /* |
183 | * Take appropriate lock on inode | 182 | * Take appropriate lock on inode |
@@ -188,7 +187,7 @@ jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks, | |||
188 | IREAD_LOCK(ip); | 187 | IREAD_LOCK(ip); |
189 | 188 | ||
190 | if (((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size) && | 189 | if (((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size) && |
191 | (!xtLookup(ip, lblock64, max_blocks, &xflag, &xaddr, &xlen, 0)) && | 190 | (!xtLookup(ip, lblock64, xlen, &xflag, &xaddr, &xlen, 0)) && |
192 | xaddr) { | 191 | xaddr) { |
193 | if (xflag & XAD_NOTRECORDED) { | 192 | if (xflag & XAD_NOTRECORDED) { |
194 | if (!create) | 193 | if (!create) |
@@ -255,13 +254,6 @@ jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks, | |||
255 | return rc; | 254 | return rc; |
256 | } | 255 | } |
257 | 256 | ||
258 | static int jfs_get_block(struct inode *ip, sector_t lblock, | ||
259 | struct buffer_head *bh_result, int create) | ||
260 | { | ||
261 | return jfs_get_blocks(ip, lblock, bh_result->b_size >> ip->i_blkbits, | ||
262 | bh_result, create); | ||
263 | } | ||
264 | |||
265 | static int jfs_writepage(struct page *page, struct writeback_control *wbc) | 257 | static int jfs_writepage(struct page *page, struct writeback_control *wbc) |
266 | { | 258 | { |
267 | return nobh_writepage(page, jfs_get_block, wbc); | 259 | return nobh_writepage(page, jfs_get_block, wbc); |
diff --git a/fs/jfs/jfs_inode.h b/fs/jfs/jfs_inode.h index b5c7da6190dc..1fc48df670c8 100644 --- a/fs/jfs/jfs_inode.h +++ b/fs/jfs/jfs_inode.h | |||
@@ -32,6 +32,7 @@ extern void jfs_truncate_nolock(struct inode *, loff_t); | |||
32 | extern void jfs_free_zero_link(struct inode *); | 32 | extern void jfs_free_zero_link(struct inode *); |
33 | extern struct dentry *jfs_get_parent(struct dentry *dentry); | 33 | extern struct dentry *jfs_get_parent(struct dentry *dentry); |
34 | extern void jfs_set_inode_flags(struct inode *); | 34 | extern void jfs_set_inode_flags(struct inode *); |
35 | extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int); | ||
35 | 36 | ||
36 | extern const struct address_space_operations jfs_aops; | 37 | extern const struct address_space_operations jfs_aops; |
37 | extern struct inode_operations jfs_dir_inode_operations; | 38 | extern struct inode_operations jfs_dir_inode_operations; |
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 4f6cfebc82db..143bcd1d5eaa 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/moduleparam.h> | 26 | #include <linux/moduleparam.h> |
27 | #include <linux/kthread.h> | 27 | #include <linux/kthread.h> |
28 | #include <linux/posix_acl.h> | 28 | #include <linux/posix_acl.h> |
29 | #include <linux/buffer_head.h> | ||
29 | #include <asm/uaccess.h> | 30 | #include <asm/uaccess.h> |
30 | #include <linux/seq_file.h> | 31 | #include <linux/seq_file.h> |
31 | 32 | ||
@@ -298,7 +299,7 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
298 | break; | 299 | break; |
299 | } | 300 | } |
300 | 301 | ||
301 | #if defined(CONFIG_QUOTA) | 302 | #ifdef CONFIG_QUOTA |
302 | case Opt_quota: | 303 | case Opt_quota: |
303 | case Opt_usrquota: | 304 | case Opt_usrquota: |
304 | *flag |= JFS_USRQUOTA; | 305 | *flag |= JFS_USRQUOTA; |
@@ -597,7 +598,7 @@ static int jfs_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
597 | if (sbi->flag & JFS_NOINTEGRITY) | 598 | if (sbi->flag & JFS_NOINTEGRITY) |
598 | seq_puts(seq, ",nointegrity"); | 599 | seq_puts(seq, ",nointegrity"); |
599 | 600 | ||
600 | #if defined(CONFIG_QUOTA) | 601 | #ifdef CONFIG_QUOTA |
601 | if (sbi->flag & JFS_USRQUOTA) | 602 | if (sbi->flag & JFS_USRQUOTA) |
602 | seq_puts(seq, ",usrquota"); | 603 | seq_puts(seq, ",usrquota"); |
603 | 604 | ||
@@ -608,6 +609,113 @@ static int jfs_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
608 | return 0; | 609 | return 0; |
609 | } | 610 | } |
610 | 611 | ||
612 | #ifdef CONFIG_QUOTA | ||
613 | |||
614 | /* Read data from quotafile - avoid pagecache and such because we cannot afford | ||
615 | * acquiring the locks... As quota files are never truncated and quota code | ||
616 | * itself serializes the operations (and noone else should touch the files) | ||
617 | * we don't have to be afraid of races */ | ||
618 | static ssize_t jfs_quota_read(struct super_block *sb, int type, char *data, | ||
619 | size_t len, loff_t off) | ||
620 | { | ||
621 | struct inode *inode = sb_dqopt(sb)->files[type]; | ||
622 | sector_t blk = off >> sb->s_blocksize_bits; | ||
623 | int err = 0; | ||
624 | int offset = off & (sb->s_blocksize - 1); | ||
625 | int tocopy; | ||
626 | size_t toread; | ||
627 | struct buffer_head tmp_bh; | ||
628 | struct buffer_head *bh; | ||
629 | loff_t i_size = i_size_read(inode); | ||
630 | |||
631 | if (off > i_size) | ||
632 | return 0; | ||
633 | if (off+len > i_size) | ||
634 | len = i_size-off; | ||
635 | toread = len; | ||
636 | while (toread > 0) { | ||
637 | tocopy = sb->s_blocksize - offset < toread ? | ||
638 | sb->s_blocksize - offset : toread; | ||
639 | |||
640 | tmp_bh.b_state = 0; | ||
641 | tmp_bh.b_size = 1 << inode->i_blkbits; | ||
642 | err = jfs_get_block(inode, blk, &tmp_bh, 0); | ||
643 | if (err) | ||
644 | return err; | ||
645 | if (!buffer_mapped(&tmp_bh)) /* A hole? */ | ||
646 | memset(data, 0, tocopy); | ||
647 | else { | ||
648 | bh = sb_bread(sb, tmp_bh.b_blocknr); | ||
649 | if (!bh) | ||
650 | return -EIO; | ||
651 | memcpy(data, bh->b_data+offset, tocopy); | ||
652 | brelse(bh); | ||
653 | } | ||
654 | offset = 0; | ||
655 | toread -= tocopy; | ||
656 | data += tocopy; | ||
657 | blk++; | ||
658 | } | ||
659 | return len; | ||
660 | } | ||
661 | |||
662 | /* Write to quotafile */ | ||
663 | static ssize_t jfs_quota_write(struct super_block *sb, int type, | ||
664 | const char *data, size_t len, loff_t off) | ||
665 | { | ||
666 | struct inode *inode = sb_dqopt(sb)->files[type]; | ||
667 | sector_t blk = off >> sb->s_blocksize_bits; | ||
668 | int err = 0; | ||
669 | int offset = off & (sb->s_blocksize - 1); | ||
670 | int tocopy; | ||
671 | size_t towrite = len; | ||
672 | struct buffer_head tmp_bh; | ||
673 | struct buffer_head *bh; | ||
674 | |||
675 | mutex_lock(&inode->i_mutex); | ||
676 | while (towrite > 0) { | ||
677 | tocopy = sb->s_blocksize - offset < towrite ? | ||
678 | sb->s_blocksize - offset : towrite; | ||
679 | |||
680 | tmp_bh.b_state = 0; | ||
681 | tmp_bh.b_size = 1 << inode->i_blkbits; | ||
682 | err = jfs_get_block(inode, blk, &tmp_bh, 1); | ||
683 | if (err) | ||
684 | goto out; | ||
685 | if (offset || tocopy != sb->s_blocksize) | ||
686 | bh = sb_bread(sb, tmp_bh.b_blocknr); | ||
687 | else | ||
688 | bh = sb_getblk(sb, tmp_bh.b_blocknr); | ||
689 | if (!bh) { | ||
690 | err = -EIO; | ||
691 | goto out; | ||
692 | } | ||
693 | lock_buffer(bh); | ||
694 | memcpy(bh->b_data+offset, data, tocopy); | ||
695 | flush_dcache_page(bh->b_page); | ||
696 | set_buffer_uptodate(bh); | ||
697 | mark_buffer_dirty(bh); | ||
698 | unlock_buffer(bh); | ||
699 | brelse(bh); | ||
700 | offset = 0; | ||
701 | towrite -= tocopy; | ||
702 | data += tocopy; | ||
703 | blk++; | ||
704 | } | ||
705 | out: | ||
706 | if (len == towrite) | ||
707 | return err; | ||
708 | if (inode->i_size < off+len-towrite) | ||
709 | i_size_write(inode, off+len-towrite); | ||
710 | inode->i_version++; | ||
711 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; | ||
712 | mark_inode_dirty(inode); | ||
713 | mutex_unlock(&inode->i_mutex); | ||
714 | return len - towrite; | ||
715 | } | ||
716 | |||
717 | #endif | ||
718 | |||
611 | static struct super_operations jfs_super_operations = { | 719 | static struct super_operations jfs_super_operations = { |
612 | .alloc_inode = jfs_alloc_inode, | 720 | .alloc_inode = jfs_alloc_inode, |
613 | .destroy_inode = jfs_destroy_inode, | 721 | .destroy_inode = jfs_destroy_inode, |
@@ -621,7 +729,11 @@ static struct super_operations jfs_super_operations = { | |||
621 | .unlockfs = jfs_unlockfs, | 729 | .unlockfs = jfs_unlockfs, |
622 | .statfs = jfs_statfs, | 730 | .statfs = jfs_statfs, |
623 | .remount_fs = jfs_remount, | 731 | .remount_fs = jfs_remount, |
624 | .show_options = jfs_show_options | 732 | .show_options = jfs_show_options, |
733 | #ifdef CONFIG_QUOTA | ||
734 | .quota_read = jfs_quota_read, | ||
735 | .quota_write = jfs_quota_write, | ||
736 | #endif | ||
625 | }; | 737 | }; |
626 | 738 | ||
627 | static struct export_operations jfs_export_operations = { | 739 | static struct export_operations jfs_export_operations = { |
diff --git a/fs/locks.c b/fs/locks.c index b0b41a64e10b..d7c53392cac1 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -1421,8 +1421,9 @@ static int __setlease(struct file *filp, long arg, struct file_lock **flp) | |||
1421 | if (!leases_enable) | 1421 | if (!leases_enable) |
1422 | goto out; | 1422 | goto out; |
1423 | 1423 | ||
1424 | error = lease_alloc(filp, arg, &fl); | 1424 | error = -ENOMEM; |
1425 | if (error) | 1425 | fl = locks_alloc_lock(); |
1426 | if (fl == NULL) | ||
1426 | goto out; | 1427 | goto out; |
1427 | 1428 | ||
1428 | locks_copy_lock(fl, lease); | 1429 | locks_copy_lock(fl, lease); |
@@ -1430,6 +1431,7 @@ static int __setlease(struct file *filp, long arg, struct file_lock **flp) | |||
1430 | locks_insert_lock(before, fl); | 1431 | locks_insert_lock(before, fl); |
1431 | 1432 | ||
1432 | *flp = fl; | 1433 | *flp = fl; |
1434 | error = 0; | ||
1433 | out: | 1435 | out: |
1434 | return error; | 1436 | return error; |
1435 | } | 1437 | } |
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 1b8346dd0572..9503240ef0e5 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -2375,7 +2375,6 @@ leave: | |||
2375 | mlog(0, "returning %d\n", ret); | 2375 | mlog(0, "returning %d\n", ret); |
2376 | return ret; | 2376 | return ret; |
2377 | } | 2377 | } |
2378 | EXPORT_SYMBOL_GPL(dlm_migrate_lockres); | ||
2379 | 2378 | ||
2380 | int dlm_lock_basts_flushed(struct dlm_ctxt *dlm, struct dlm_lock *lock) | 2379 | int dlm_lock_basts_flushed(struct dlm_ctxt *dlm, struct dlm_lock *lock) |
2381 | { | 2380 | { |
diff --git a/fs/ocfs2/dlm/dlmunlock.c b/fs/ocfs2/dlm/dlmunlock.c index b0c3134f4f70..37be4b2e0d4a 100644 --- a/fs/ocfs2/dlm/dlmunlock.c +++ b/fs/ocfs2/dlm/dlmunlock.c | |||
@@ -155,7 +155,7 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm, | |||
155 | else | 155 | else |
156 | status = dlm_get_unlock_actions(dlm, res, lock, lksb, &actions); | 156 | status = dlm_get_unlock_actions(dlm, res, lock, lksb, &actions); |
157 | 157 | ||
158 | if (status != DLM_NORMAL) | 158 | if (status != DLM_NORMAL && (status != DLM_CANCELGRANT || !master_node)) |
159 | goto leave; | 159 | goto leave; |
160 | 160 | ||
161 | /* By now this has been masked out of cancel requests. */ | 161 | /* By now this has been masked out of cancel requests. */ |
@@ -183,8 +183,7 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm, | |||
183 | spin_lock(&lock->spinlock); | 183 | spin_lock(&lock->spinlock); |
184 | /* if the master told us the lock was already granted, | 184 | /* if the master told us the lock was already granted, |
185 | * let the ast handle all of these actions */ | 185 | * let the ast handle all of these actions */ |
186 | if (status == DLM_NORMAL && | 186 | if (status == DLM_CANCELGRANT) { |
187 | lksb->status == DLM_CANCELGRANT) { | ||
188 | actions &= ~(DLM_UNLOCK_REMOVE_LOCK| | 187 | actions &= ~(DLM_UNLOCK_REMOVE_LOCK| |
189 | DLM_UNLOCK_REGRANT_LOCK| | 188 | DLM_UNLOCK_REGRANT_LOCK| |
190 | DLM_UNLOCK_CLEAR_CONVERT_TYPE); | 189 | DLM_UNLOCK_CLEAR_CONVERT_TYPE); |
@@ -349,14 +348,9 @@ static enum dlm_status dlm_send_remote_unlock_request(struct dlm_ctxt *dlm, | |||
349 | vec, veclen, owner, &status); | 348 | vec, veclen, owner, &status); |
350 | if (tmpret >= 0) { | 349 | if (tmpret >= 0) { |
351 | // successfully sent and received | 350 | // successfully sent and received |
352 | if (status == DLM_CANCELGRANT) | 351 | if (status == DLM_FORWARD) |
353 | ret = DLM_NORMAL; | ||
354 | else if (status == DLM_FORWARD) { | ||
355 | mlog(0, "master was in-progress. retry\n"); | 352 | mlog(0, "master was in-progress. retry\n"); |
356 | ret = DLM_FORWARD; | 353 | ret = status; |
357 | } else | ||
358 | ret = status; | ||
359 | lksb->status = status; | ||
360 | } else { | 354 | } else { |
361 | mlog_errno(tmpret); | 355 | mlog_errno(tmpret); |
362 | if (dlm_is_host_down(tmpret)) { | 356 | if (dlm_is_host_down(tmpret)) { |
@@ -372,7 +366,6 @@ static enum dlm_status dlm_send_remote_unlock_request(struct dlm_ctxt *dlm, | |||
372 | /* something bad. this will BUG in ocfs2 */ | 366 | /* something bad. this will BUG in ocfs2 */ |
373 | ret = dlm_err_to_dlm_status(tmpret); | 367 | ret = dlm_err_to_dlm_status(tmpret); |
374 | } | 368 | } |
375 | lksb->status = ret; | ||
376 | } | 369 | } |
377 | 370 | ||
378 | return ret; | 371 | return ret; |
@@ -483,6 +476,10 @@ int dlm_unlock_lock_handler(struct o2net_msg *msg, u32 len, void *data) | |||
483 | 476 | ||
484 | /* lock was found on queue */ | 477 | /* lock was found on queue */ |
485 | lksb = lock->lksb; | 478 | lksb = lock->lksb; |
479 | if (flags & (LKM_VALBLK|LKM_PUT_LVB) && | ||
480 | lock->ml.type != LKM_EXMODE) | ||
481 | flags &= ~(LKM_VALBLK|LKM_PUT_LVB); | ||
482 | |||
486 | /* unlockast only called on originating node */ | 483 | /* unlockast only called on originating node */ |
487 | if (flags & LKM_PUT_LVB) { | 484 | if (flags & LKM_PUT_LVB) { |
488 | lksb->flags |= DLM_LKSB_PUT_LVB; | 485 | lksb->flags |= DLM_LKSB_PUT_LVB; |
@@ -507,11 +504,8 @@ not_found: | |||
507 | "cookie=%u:%llu\n", | 504 | "cookie=%u:%llu\n", |
508 | dlm_get_lock_cookie_node(unlock->cookie), | 505 | dlm_get_lock_cookie_node(unlock->cookie), |
509 | dlm_get_lock_cookie_seq(unlock->cookie)); | 506 | dlm_get_lock_cookie_seq(unlock->cookie)); |
510 | else { | 507 | else |
511 | /* send the lksb->status back to the other node */ | ||
512 | status = lksb->status; | ||
513 | dlm_lock_put(lock); | 508 | dlm_lock_put(lock); |
514 | } | ||
515 | 509 | ||
516 | leave: | 510 | leave: |
517 | if (res) | 511 | if (res) |
@@ -533,26 +527,22 @@ static enum dlm_status dlm_get_cancel_actions(struct dlm_ctxt *dlm, | |||
533 | 527 | ||
534 | if (dlm_lock_on_list(&res->blocked, lock)) { | 528 | if (dlm_lock_on_list(&res->blocked, lock)) { |
535 | /* cancel this outright */ | 529 | /* cancel this outright */ |
536 | lksb->status = DLM_NORMAL; | ||
537 | status = DLM_NORMAL; | 530 | status = DLM_NORMAL; |
538 | *actions = (DLM_UNLOCK_CALL_AST | | 531 | *actions = (DLM_UNLOCK_CALL_AST | |
539 | DLM_UNLOCK_REMOVE_LOCK); | 532 | DLM_UNLOCK_REMOVE_LOCK); |
540 | } else if (dlm_lock_on_list(&res->converting, lock)) { | 533 | } else if (dlm_lock_on_list(&res->converting, lock)) { |
541 | /* cancel the request, put back on granted */ | 534 | /* cancel the request, put back on granted */ |
542 | lksb->status = DLM_NORMAL; | ||
543 | status = DLM_NORMAL; | 535 | status = DLM_NORMAL; |
544 | *actions = (DLM_UNLOCK_CALL_AST | | 536 | *actions = (DLM_UNLOCK_CALL_AST | |
545 | DLM_UNLOCK_REMOVE_LOCK | | 537 | DLM_UNLOCK_REMOVE_LOCK | |
546 | DLM_UNLOCK_REGRANT_LOCK | | 538 | DLM_UNLOCK_REGRANT_LOCK | |
547 | DLM_UNLOCK_CLEAR_CONVERT_TYPE); | 539 | DLM_UNLOCK_CLEAR_CONVERT_TYPE); |
548 | } else if (dlm_lock_on_list(&res->granted, lock)) { | 540 | } else if (dlm_lock_on_list(&res->granted, lock)) { |
549 | /* too late, already granted. DLM_CANCELGRANT */ | 541 | /* too late, already granted. */ |
550 | lksb->status = DLM_CANCELGRANT; | 542 | status = DLM_CANCELGRANT; |
551 | status = DLM_NORMAL; | ||
552 | *actions = DLM_UNLOCK_CALL_AST; | 543 | *actions = DLM_UNLOCK_CALL_AST; |
553 | } else { | 544 | } else { |
554 | mlog(ML_ERROR, "lock to cancel is not on any list!\n"); | 545 | mlog(ML_ERROR, "lock to cancel is not on any list!\n"); |
555 | lksb->status = DLM_IVLOCKID; | ||
556 | status = DLM_IVLOCKID; | 546 | status = DLM_IVLOCKID; |
557 | *actions = 0; | 547 | *actions = 0; |
558 | } | 548 | } |
@@ -569,13 +559,11 @@ static enum dlm_status dlm_get_unlock_actions(struct dlm_ctxt *dlm, | |||
569 | 559 | ||
570 | /* unlock request */ | 560 | /* unlock request */ |
571 | if (!dlm_lock_on_list(&res->granted, lock)) { | 561 | if (!dlm_lock_on_list(&res->granted, lock)) { |
572 | lksb->status = DLM_DENIED; | ||
573 | status = DLM_DENIED; | 562 | status = DLM_DENIED; |
574 | dlm_error(status); | 563 | dlm_error(status); |
575 | *actions = 0; | 564 | *actions = 0; |
576 | } else { | 565 | } else { |
577 | /* unlock granted lock */ | 566 | /* unlock granted lock */ |
578 | lksb->status = DLM_NORMAL; | ||
579 | status = DLM_NORMAL; | 567 | status = DLM_NORMAL; |
580 | *actions = (DLM_UNLOCK_FREE_LOCK | | 568 | *actions = (DLM_UNLOCK_FREE_LOCK | |
581 | DLM_UNLOCK_CALL_AST | | 569 | DLM_UNLOCK_CALL_AST | |
@@ -632,6 +620,8 @@ retry: | |||
632 | 620 | ||
633 | spin_lock(&res->spinlock); | 621 | spin_lock(&res->spinlock); |
634 | is_master = (res->owner == dlm->node_num); | 622 | is_master = (res->owner == dlm->node_num); |
623 | if (flags & LKM_VALBLK && lock->ml.type != LKM_EXMODE) | ||
624 | flags &= ~LKM_VALBLK; | ||
635 | spin_unlock(&res->spinlock); | 625 | spin_unlock(&res->spinlock); |
636 | 626 | ||
637 | if (is_master) { | 627 | if (is_master) { |
@@ -665,7 +655,7 @@ retry: | |||
665 | } | 655 | } |
666 | 656 | ||
667 | if (call_ast) { | 657 | if (call_ast) { |
668 | mlog(0, "calling unlockast(%p, %d)\n", data, lksb->status); | 658 | mlog(0, "calling unlockast(%p, %d)\n", data, status); |
669 | if (is_master) { | 659 | if (is_master) { |
670 | /* it is possible that there is one last bast | 660 | /* it is possible that there is one last bast |
671 | * pending. make sure it is flushed, then | 661 | * pending. make sure it is flushed, then |
@@ -677,9 +667,12 @@ retry: | |||
677 | wait_event(dlm->ast_wq, | 667 | wait_event(dlm->ast_wq, |
678 | dlm_lock_basts_flushed(dlm, lock)); | 668 | dlm_lock_basts_flushed(dlm, lock)); |
679 | } | 669 | } |
680 | (*unlockast)(data, lksb->status); | 670 | (*unlockast)(data, status); |
681 | } | 671 | } |
682 | 672 | ||
673 | if (status == DLM_CANCELGRANT) | ||
674 | status = DLM_NORMAL; | ||
675 | |||
683 | if (status == DLM_NORMAL) { | 676 | if (status == DLM_NORMAL) { |
684 | mlog(0, "kicking the thread\n"); | 677 | mlog(0, "kicking the thread\n"); |
685 | dlm_kick_thread(dlm, res); | 678 | dlm_kick_thread(dlm, res); |
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index 0d1973ea32b0..1f17a4d08287 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c | |||
@@ -840,6 +840,12 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb, | |||
840 | 840 | ||
841 | mlog(0, "Allocating %u clusters for a new window.\n", | 841 | mlog(0, "Allocating %u clusters for a new window.\n", |
842 | ocfs2_local_alloc_window_bits(osb)); | 842 | ocfs2_local_alloc_window_bits(osb)); |
843 | |||
844 | /* Instruct the allocation code to try the most recently used | ||
845 | * cluster group. We'll re-record the group used this pass | ||
846 | * below. */ | ||
847 | ac->ac_last_group = osb->la_last_gd; | ||
848 | |||
843 | /* we used the generic suballoc reserve function, but we set | 849 | /* we used the generic suballoc reserve function, but we set |
844 | * everything up nicely, so there's no reason why we can't use | 850 | * everything up nicely, so there's no reason why we can't use |
845 | * the more specific cluster api to claim bits. */ | 851 | * the more specific cluster api to claim bits. */ |
@@ -852,6 +858,8 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb, | |||
852 | goto bail; | 858 | goto bail; |
853 | } | 859 | } |
854 | 860 | ||
861 | osb->la_last_gd = ac->ac_last_group; | ||
862 | |||
855 | la->la_bm_off = cpu_to_le32(cluster_off); | 863 | la->la_bm_off = cpu_to_le32(cluster_off); |
856 | alloc->id1.bitmap1.i_total = cpu_to_le32(cluster_count); | 864 | alloc->id1.bitmap1.i_total = cpu_to_le32(cluster_count); |
857 | /* just in case... In the future when we find space ourselves, | 865 | /* just in case... In the future when we find space ourselves, |
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index cd4a6f253d13..0462a7f4e21b 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
@@ -197,7 +197,6 @@ struct ocfs2_super | |||
197 | struct ocfs2_node_map recovery_map; | 197 | struct ocfs2_node_map recovery_map; |
198 | struct ocfs2_node_map umount_map; | 198 | struct ocfs2_node_map umount_map; |
199 | 199 | ||
200 | u32 num_clusters; | ||
201 | u64 root_blkno; | 200 | u64 root_blkno; |
202 | u64 system_dir_blkno; | 201 | u64 system_dir_blkno; |
203 | u64 bitmap_blkno; | 202 | u64 bitmap_blkno; |
@@ -237,6 +236,7 @@ struct ocfs2_super | |||
237 | 236 | ||
238 | enum ocfs2_local_alloc_state local_alloc_state; | 237 | enum ocfs2_local_alloc_state local_alloc_state; |
239 | struct buffer_head *local_alloc_bh; | 238 | struct buffer_head *local_alloc_bh; |
239 | u64 la_last_gd; | ||
240 | 240 | ||
241 | /* Next two fields are for local node slot recovery during | 241 | /* Next two fields are for local node slot recovery during |
242 | * mount. */ | 242 | * mount. */ |
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index 195523090c87..9d91e66f51a9 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -70,12 +70,6 @@ static int ocfs2_block_group_search(struct inode *inode, | |||
70 | struct buffer_head *group_bh, | 70 | struct buffer_head *group_bh, |
71 | u32 bits_wanted, u32 min_bits, | 71 | u32 bits_wanted, u32 min_bits, |
72 | u16 *bit_off, u16 *bits_found); | 72 | u16 *bit_off, u16 *bits_found); |
73 | static int ocfs2_search_chain(struct ocfs2_alloc_context *ac, | ||
74 | u32 bits_wanted, | ||
75 | u32 min_bits, | ||
76 | u16 *bit_off, | ||
77 | unsigned int *num_bits, | ||
78 | u64 *bg_blkno); | ||
79 | static int ocfs2_claim_suballoc_bits(struct ocfs2_super *osb, | 73 | static int ocfs2_claim_suballoc_bits(struct ocfs2_super *osb, |
80 | struct ocfs2_alloc_context *ac, | 74 | struct ocfs2_alloc_context *ac, |
81 | u32 bits_wanted, | 75 | u32 bits_wanted, |
@@ -85,11 +79,6 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_super *osb, | |||
85 | u64 *bg_blkno); | 79 | u64 *bg_blkno); |
86 | static int ocfs2_test_bg_bit_allocatable(struct buffer_head *bg_bh, | 80 | static int ocfs2_test_bg_bit_allocatable(struct buffer_head *bg_bh, |
87 | int nr); | 81 | int nr); |
88 | static int ocfs2_block_group_find_clear_bits(struct ocfs2_super *osb, | ||
89 | struct buffer_head *bg_bh, | ||
90 | unsigned int bits_wanted, | ||
91 | u16 *bit_off, | ||
92 | u16 *bits_found); | ||
93 | static inline int ocfs2_block_group_set_bits(struct ocfs2_journal_handle *handle, | 82 | static inline int ocfs2_block_group_set_bits(struct ocfs2_journal_handle *handle, |
94 | struct inode *alloc_inode, | 83 | struct inode *alloc_inode, |
95 | struct ocfs2_group_desc *bg, | 84 | struct ocfs2_group_desc *bg, |
@@ -143,6 +132,64 @@ static u32 ocfs2_bits_per_group(struct ocfs2_chain_list *cl) | |||
143 | return (u32)le16_to_cpu(cl->cl_cpg) * (u32)le16_to_cpu(cl->cl_bpc); | 132 | return (u32)le16_to_cpu(cl->cl_cpg) * (u32)le16_to_cpu(cl->cl_bpc); |
144 | } | 133 | } |
145 | 134 | ||
135 | /* somewhat more expensive than our other checks, so use sparingly. */ | ||
136 | static int ocfs2_check_group_descriptor(struct super_block *sb, | ||
137 | struct ocfs2_dinode *di, | ||
138 | struct ocfs2_group_desc *gd) | ||
139 | { | ||
140 | unsigned int max_bits; | ||
141 | |||
142 | if (!OCFS2_IS_VALID_GROUP_DESC(gd)) { | ||
143 | OCFS2_RO_ON_INVALID_GROUP_DESC(sb, gd); | ||
144 | return -EIO; | ||
145 | } | ||
146 | |||
147 | if (di->i_blkno != gd->bg_parent_dinode) { | ||
148 | ocfs2_error(sb, "Group descriptor # %llu has bad parent " | ||
149 | "pointer (%llu, expected %llu)", | ||
150 | (unsigned long long)le64_to_cpu(gd->bg_blkno), | ||
151 | (unsigned long long)le64_to_cpu(gd->bg_parent_dinode), | ||
152 | (unsigned long long)le64_to_cpu(di->i_blkno)); | ||
153 | return -EIO; | ||
154 | } | ||
155 | |||
156 | max_bits = le16_to_cpu(di->id2.i_chain.cl_cpg) * le16_to_cpu(di->id2.i_chain.cl_bpc); | ||
157 | if (le16_to_cpu(gd->bg_bits) > max_bits) { | ||
158 | ocfs2_error(sb, "Group descriptor # %llu has bit count of %u", | ||
159 | (unsigned long long)le64_to_cpu(gd->bg_blkno), | ||
160 | le16_to_cpu(gd->bg_bits)); | ||
161 | return -EIO; | ||
162 | } | ||
163 | |||
164 | if (le16_to_cpu(gd->bg_chain) >= | ||
165 | le16_to_cpu(di->id2.i_chain.cl_next_free_rec)) { | ||
166 | ocfs2_error(sb, "Group descriptor # %llu has bad chain %u", | ||
167 | (unsigned long long)le64_to_cpu(gd->bg_blkno), | ||
168 | le16_to_cpu(gd->bg_chain)); | ||
169 | return -EIO; | ||
170 | } | ||
171 | |||
172 | if (le16_to_cpu(gd->bg_free_bits_count) > le16_to_cpu(gd->bg_bits)) { | ||
173 | ocfs2_error(sb, "Group descriptor # %llu has bit count %u but " | ||
174 | "claims that %u are free", | ||
175 | (unsigned long long)le64_to_cpu(gd->bg_blkno), | ||
176 | le16_to_cpu(gd->bg_bits), | ||
177 | le16_to_cpu(gd->bg_free_bits_count)); | ||
178 | return -EIO; | ||
179 | } | ||
180 | |||
181 | if (le16_to_cpu(gd->bg_bits) > (8 * le16_to_cpu(gd->bg_size))) { | ||
182 | ocfs2_error(sb, "Group descriptor # %llu has bit count %u but " | ||
183 | "max bitmap bits of %u", | ||
184 | (unsigned long long)le64_to_cpu(gd->bg_blkno), | ||
185 | le16_to_cpu(gd->bg_bits), | ||
186 | 8 * le16_to_cpu(gd->bg_size)); | ||
187 | return -EIO; | ||
188 | } | ||
189 | |||
190 | return 0; | ||
191 | } | ||
192 | |||
146 | static int ocfs2_block_group_fill(struct ocfs2_journal_handle *handle, | 193 | static int ocfs2_block_group_fill(struct ocfs2_journal_handle *handle, |
147 | struct inode *alloc_inode, | 194 | struct inode *alloc_inode, |
148 | struct buffer_head *bg_bh, | 195 | struct buffer_head *bg_bh, |
@@ -663,6 +710,7 @@ static int ocfs2_test_bg_bit_allocatable(struct buffer_head *bg_bh, | |||
663 | static int ocfs2_block_group_find_clear_bits(struct ocfs2_super *osb, | 710 | static int ocfs2_block_group_find_clear_bits(struct ocfs2_super *osb, |
664 | struct buffer_head *bg_bh, | 711 | struct buffer_head *bg_bh, |
665 | unsigned int bits_wanted, | 712 | unsigned int bits_wanted, |
713 | unsigned int total_bits, | ||
666 | u16 *bit_off, | 714 | u16 *bit_off, |
667 | u16 *bits_found) | 715 | u16 *bits_found) |
668 | { | 716 | { |
@@ -679,10 +727,8 @@ static int ocfs2_block_group_find_clear_bits(struct ocfs2_super *osb, | |||
679 | found = start = best_offset = best_size = 0; | 727 | found = start = best_offset = best_size = 0; |
680 | bitmap = bg->bg_bitmap; | 728 | bitmap = bg->bg_bitmap; |
681 | 729 | ||
682 | while((offset = ocfs2_find_next_zero_bit(bitmap, | 730 | while((offset = ocfs2_find_next_zero_bit(bitmap, total_bits, start)) != -1) { |
683 | le16_to_cpu(bg->bg_bits), | 731 | if (offset == total_bits) |
684 | start)) != -1) { | ||
685 | if (offset == le16_to_cpu(bg->bg_bits)) | ||
686 | break; | 732 | break; |
687 | 733 | ||
688 | if (!ocfs2_test_bg_bit_allocatable(bg_bh, offset)) { | 734 | if (!ocfs2_test_bg_bit_allocatable(bg_bh, offset)) { |
@@ -911,14 +957,35 @@ static int ocfs2_cluster_group_search(struct inode *inode, | |||
911 | { | 957 | { |
912 | int search = -ENOSPC; | 958 | int search = -ENOSPC; |
913 | int ret; | 959 | int ret; |
914 | struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) group_bh->b_data; | 960 | struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *) group_bh->b_data; |
915 | u16 tmp_off, tmp_found; | 961 | u16 tmp_off, tmp_found; |
962 | unsigned int max_bits, gd_cluster_off; | ||
916 | 963 | ||
917 | BUG_ON(!ocfs2_is_cluster_bitmap(inode)); | 964 | BUG_ON(!ocfs2_is_cluster_bitmap(inode)); |
918 | 965 | ||
919 | if (bg->bg_free_bits_count) { | 966 | if (gd->bg_free_bits_count) { |
967 | max_bits = le16_to_cpu(gd->bg_bits); | ||
968 | |||
969 | /* Tail groups in cluster bitmaps which aren't cpg | ||
970 | * aligned are prone to partial extention by a failed | ||
971 | * fs resize. If the file system resize never got to | ||
972 | * update the dinode cluster count, then we don't want | ||
973 | * to trust any clusters past it, regardless of what | ||
974 | * the group descriptor says. */ | ||
975 | gd_cluster_off = ocfs2_blocks_to_clusters(inode->i_sb, | ||
976 | le64_to_cpu(gd->bg_blkno)); | ||
977 | if ((gd_cluster_off + max_bits) > | ||
978 | OCFS2_I(inode)->ip_clusters) { | ||
979 | max_bits = OCFS2_I(inode)->ip_clusters - gd_cluster_off; | ||
980 | mlog(0, "Desc %llu, bg_bits %u, clusters %u, use %u\n", | ||
981 | (unsigned long long)le64_to_cpu(gd->bg_blkno), | ||
982 | le16_to_cpu(gd->bg_bits), | ||
983 | OCFS2_I(inode)->ip_clusters, max_bits); | ||
984 | } | ||
985 | |||
920 | ret = ocfs2_block_group_find_clear_bits(OCFS2_SB(inode->i_sb), | 986 | ret = ocfs2_block_group_find_clear_bits(OCFS2_SB(inode->i_sb), |
921 | group_bh, bits_wanted, | 987 | group_bh, bits_wanted, |
988 | max_bits, | ||
922 | &tmp_off, &tmp_found); | 989 | &tmp_off, &tmp_found); |
923 | if (ret) | 990 | if (ret) |
924 | return ret; | 991 | return ret; |
@@ -951,17 +1018,109 @@ static int ocfs2_block_group_search(struct inode *inode, | |||
951 | if (bg->bg_free_bits_count) | 1018 | if (bg->bg_free_bits_count) |
952 | ret = ocfs2_block_group_find_clear_bits(OCFS2_SB(inode->i_sb), | 1019 | ret = ocfs2_block_group_find_clear_bits(OCFS2_SB(inode->i_sb), |
953 | group_bh, bits_wanted, | 1020 | group_bh, bits_wanted, |
1021 | le16_to_cpu(bg->bg_bits), | ||
954 | bit_off, bits_found); | 1022 | bit_off, bits_found); |
955 | 1023 | ||
956 | return ret; | 1024 | return ret; |
957 | } | 1025 | } |
958 | 1026 | ||
1027 | static int ocfs2_alloc_dinode_update_counts(struct inode *inode, | ||
1028 | struct ocfs2_journal_handle *handle, | ||
1029 | struct buffer_head *di_bh, | ||
1030 | u32 num_bits, | ||
1031 | u16 chain) | ||
1032 | { | ||
1033 | int ret; | ||
1034 | u32 tmp_used; | ||
1035 | struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data; | ||
1036 | struct ocfs2_chain_list *cl = (struct ocfs2_chain_list *) &di->id2.i_chain; | ||
1037 | |||
1038 | ret = ocfs2_journal_access(handle, inode, di_bh, | ||
1039 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
1040 | if (ret < 0) { | ||
1041 | mlog_errno(ret); | ||
1042 | goto out; | ||
1043 | } | ||
1044 | |||
1045 | tmp_used = le32_to_cpu(di->id1.bitmap1.i_used); | ||
1046 | di->id1.bitmap1.i_used = cpu_to_le32(num_bits + tmp_used); | ||
1047 | le32_add_cpu(&cl->cl_recs[chain].c_free, -num_bits); | ||
1048 | |||
1049 | ret = ocfs2_journal_dirty(handle, di_bh); | ||
1050 | if (ret < 0) | ||
1051 | mlog_errno(ret); | ||
1052 | |||
1053 | out: | ||
1054 | return ret; | ||
1055 | } | ||
1056 | |||
1057 | static int ocfs2_search_one_group(struct ocfs2_alloc_context *ac, | ||
1058 | u32 bits_wanted, | ||
1059 | u32 min_bits, | ||
1060 | u16 *bit_off, | ||
1061 | unsigned int *num_bits, | ||
1062 | u64 gd_blkno, | ||
1063 | u16 *bits_left) | ||
1064 | { | ||
1065 | int ret; | ||
1066 | u16 found; | ||
1067 | struct buffer_head *group_bh = NULL; | ||
1068 | struct ocfs2_group_desc *gd; | ||
1069 | struct inode *alloc_inode = ac->ac_inode; | ||
1070 | struct ocfs2_journal_handle *handle = ac->ac_handle; | ||
1071 | |||
1072 | ret = ocfs2_read_block(OCFS2_SB(alloc_inode->i_sb), gd_blkno, | ||
1073 | &group_bh, OCFS2_BH_CACHED, alloc_inode); | ||
1074 | if (ret < 0) { | ||
1075 | mlog_errno(ret); | ||
1076 | return ret; | ||
1077 | } | ||
1078 | |||
1079 | gd = (struct ocfs2_group_desc *) group_bh->b_data; | ||
1080 | if (!OCFS2_IS_VALID_GROUP_DESC(gd)) { | ||
1081 | OCFS2_RO_ON_INVALID_GROUP_DESC(alloc_inode->i_sb, gd); | ||
1082 | ret = -EIO; | ||
1083 | goto out; | ||
1084 | } | ||
1085 | |||
1086 | ret = ac->ac_group_search(alloc_inode, group_bh, bits_wanted, min_bits, | ||
1087 | bit_off, &found); | ||
1088 | if (ret < 0) { | ||
1089 | if (ret != -ENOSPC) | ||
1090 | mlog_errno(ret); | ||
1091 | goto out; | ||
1092 | } | ||
1093 | |||
1094 | *num_bits = found; | ||
1095 | |||
1096 | ret = ocfs2_alloc_dinode_update_counts(alloc_inode, handle, ac->ac_bh, | ||
1097 | *num_bits, | ||
1098 | le16_to_cpu(gd->bg_chain)); | ||
1099 | if (ret < 0) { | ||
1100 | mlog_errno(ret); | ||
1101 | goto out; | ||
1102 | } | ||
1103 | |||
1104 | ret = ocfs2_block_group_set_bits(handle, alloc_inode, gd, group_bh, | ||
1105 | *bit_off, *num_bits); | ||
1106 | if (ret < 0) | ||
1107 | mlog_errno(ret); | ||
1108 | |||
1109 | *bits_left = le16_to_cpu(gd->bg_free_bits_count); | ||
1110 | |||
1111 | out: | ||
1112 | brelse(group_bh); | ||
1113 | |||
1114 | return ret; | ||
1115 | } | ||
1116 | |||
959 | static int ocfs2_search_chain(struct ocfs2_alloc_context *ac, | 1117 | static int ocfs2_search_chain(struct ocfs2_alloc_context *ac, |
960 | u32 bits_wanted, | 1118 | u32 bits_wanted, |
961 | u32 min_bits, | 1119 | u32 min_bits, |
962 | u16 *bit_off, | 1120 | u16 *bit_off, |
963 | unsigned int *num_bits, | 1121 | unsigned int *num_bits, |
964 | u64 *bg_blkno) | 1122 | u64 *bg_blkno, |
1123 | u16 *bits_left) | ||
965 | { | 1124 | { |
966 | int status; | 1125 | int status; |
967 | u16 chain, tmp_bits; | 1126 | u16 chain, tmp_bits; |
@@ -988,9 +1147,9 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac, | |||
988 | goto bail; | 1147 | goto bail; |
989 | } | 1148 | } |
990 | bg = (struct ocfs2_group_desc *) group_bh->b_data; | 1149 | bg = (struct ocfs2_group_desc *) group_bh->b_data; |
991 | if (!OCFS2_IS_VALID_GROUP_DESC(bg)) { | 1150 | status = ocfs2_check_group_descriptor(alloc_inode->i_sb, fe, bg); |
992 | OCFS2_RO_ON_INVALID_GROUP_DESC(alloc_inode->i_sb, bg); | 1151 | if (status) { |
993 | status = -EIO; | 1152 | mlog_errno(status); |
994 | goto bail; | 1153 | goto bail; |
995 | } | 1154 | } |
996 | 1155 | ||
@@ -1018,9 +1177,9 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac, | |||
1018 | goto bail; | 1177 | goto bail; |
1019 | } | 1178 | } |
1020 | bg = (struct ocfs2_group_desc *) group_bh->b_data; | 1179 | bg = (struct ocfs2_group_desc *) group_bh->b_data; |
1021 | if (!OCFS2_IS_VALID_GROUP_DESC(bg)) { | 1180 | status = ocfs2_check_group_descriptor(alloc_inode->i_sb, fe, bg); |
1022 | OCFS2_RO_ON_INVALID_GROUP_DESC(alloc_inode->i_sb, bg); | 1181 | if (status) { |
1023 | status = -EIO; | 1182 | mlog_errno(status); |
1024 | goto bail; | 1183 | goto bail; |
1025 | } | 1184 | } |
1026 | } | 1185 | } |
@@ -1099,6 +1258,7 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac, | |||
1099 | (unsigned long long)fe->i_blkno); | 1258 | (unsigned long long)fe->i_blkno); |
1100 | 1259 | ||
1101 | *bg_blkno = le64_to_cpu(bg->bg_blkno); | 1260 | *bg_blkno = le64_to_cpu(bg->bg_blkno); |
1261 | *bits_left = le16_to_cpu(bg->bg_free_bits_count); | ||
1102 | bail: | 1262 | bail: |
1103 | if (group_bh) | 1263 | if (group_bh) |
1104 | brelse(group_bh); | 1264 | brelse(group_bh); |
@@ -1120,6 +1280,8 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_super *osb, | |||
1120 | { | 1280 | { |
1121 | int status; | 1281 | int status; |
1122 | u16 victim, i; | 1282 | u16 victim, i; |
1283 | u16 bits_left = 0; | ||
1284 | u64 hint_blkno = ac->ac_last_group; | ||
1123 | struct ocfs2_chain_list *cl; | 1285 | struct ocfs2_chain_list *cl; |
1124 | struct ocfs2_dinode *fe; | 1286 | struct ocfs2_dinode *fe; |
1125 | 1287 | ||
@@ -1146,6 +1308,28 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_super *osb, | |||
1146 | goto bail; | 1308 | goto bail; |
1147 | } | 1309 | } |
1148 | 1310 | ||
1311 | if (hint_blkno) { | ||
1312 | /* Attempt to short-circuit the usual search mechanism | ||
1313 | * by jumping straight to the most recently used | ||
1314 | * allocation group. This helps us mantain some | ||
1315 | * contiguousness across allocations. */ | ||
1316 | status = ocfs2_search_one_group(ac, bits_wanted, min_bits, | ||
1317 | bit_off, num_bits, | ||
1318 | hint_blkno, &bits_left); | ||
1319 | if (!status) { | ||
1320 | /* Be careful to update *bg_blkno here as the | ||
1321 | * caller is expecting it to be filled in, and | ||
1322 | * ocfs2_search_one_group() won't do that for | ||
1323 | * us. */ | ||
1324 | *bg_blkno = hint_blkno; | ||
1325 | goto set_hint; | ||
1326 | } | ||
1327 | if (status < 0 && status != -ENOSPC) { | ||
1328 | mlog_errno(status); | ||
1329 | goto bail; | ||
1330 | } | ||
1331 | } | ||
1332 | |||
1149 | cl = (struct ocfs2_chain_list *) &fe->id2.i_chain; | 1333 | cl = (struct ocfs2_chain_list *) &fe->id2.i_chain; |
1150 | 1334 | ||
1151 | victim = ocfs2_find_victim_chain(cl); | 1335 | victim = ocfs2_find_victim_chain(cl); |
@@ -1153,9 +1337,9 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_super *osb, | |||
1153 | ac->ac_allow_chain_relink = 1; | 1337 | ac->ac_allow_chain_relink = 1; |
1154 | 1338 | ||
1155 | status = ocfs2_search_chain(ac, bits_wanted, min_bits, bit_off, | 1339 | status = ocfs2_search_chain(ac, bits_wanted, min_bits, bit_off, |
1156 | num_bits, bg_blkno); | 1340 | num_bits, bg_blkno, &bits_left); |
1157 | if (!status) | 1341 | if (!status) |
1158 | goto bail; | 1342 | goto set_hint; |
1159 | if (status < 0 && status != -ENOSPC) { | 1343 | if (status < 0 && status != -ENOSPC) { |
1160 | mlog_errno(status); | 1344 | mlog_errno(status); |
1161 | goto bail; | 1345 | goto bail; |
@@ -1177,8 +1361,8 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_super *osb, | |||
1177 | 1361 | ||
1178 | ac->ac_chain = i; | 1362 | ac->ac_chain = i; |
1179 | status = ocfs2_search_chain(ac, bits_wanted, min_bits, | 1363 | status = ocfs2_search_chain(ac, bits_wanted, min_bits, |
1180 | bit_off, num_bits, | 1364 | bit_off, num_bits, bg_blkno, |
1181 | bg_blkno); | 1365 | &bits_left); |
1182 | if (!status) | 1366 | if (!status) |
1183 | break; | 1367 | break; |
1184 | if (status < 0 && status != -ENOSPC) { | 1368 | if (status < 0 && status != -ENOSPC) { |
@@ -1186,8 +1370,19 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_super *osb, | |||
1186 | goto bail; | 1370 | goto bail; |
1187 | } | 1371 | } |
1188 | } | 1372 | } |
1189 | bail: | ||
1190 | 1373 | ||
1374 | set_hint: | ||
1375 | if (status != -ENOSPC) { | ||
1376 | /* If the next search of this group is not likely to | ||
1377 | * yield a suitable extent, then we reset the last | ||
1378 | * group hint so as to not waste a disk read */ | ||
1379 | if (bits_left < min_bits) | ||
1380 | ac->ac_last_group = 0; | ||
1381 | else | ||
1382 | ac->ac_last_group = *bg_blkno; | ||
1383 | } | ||
1384 | |||
1385 | bail: | ||
1191 | mlog_exit(status); | 1386 | mlog_exit(status); |
1192 | return status; | 1387 | return status; |
1193 | } | 1388 | } |
@@ -1341,7 +1536,7 @@ int ocfs2_claim_clusters(struct ocfs2_super *osb, | |||
1341 | { | 1536 | { |
1342 | int status; | 1537 | int status; |
1343 | unsigned int bits_wanted = ac->ac_bits_wanted - ac->ac_bits_given; | 1538 | unsigned int bits_wanted = ac->ac_bits_wanted - ac->ac_bits_given; |
1344 | u64 bg_blkno; | 1539 | u64 bg_blkno = 0; |
1345 | u16 bg_bit_off; | 1540 | u16 bg_bit_off; |
1346 | 1541 | ||
1347 | mlog_entry_void(); | 1542 | mlog_entry_void(); |
@@ -1494,9 +1689,9 @@ static int ocfs2_free_suballoc_bits(struct ocfs2_journal_handle *handle, | |||
1494 | } | 1689 | } |
1495 | 1690 | ||
1496 | group = (struct ocfs2_group_desc *) group_bh->b_data; | 1691 | group = (struct ocfs2_group_desc *) group_bh->b_data; |
1497 | if (!OCFS2_IS_VALID_GROUP_DESC(group)) { | 1692 | status = ocfs2_check_group_descriptor(alloc_inode->i_sb, fe, group); |
1498 | OCFS2_RO_ON_INVALID_GROUP_DESC(alloc_inode->i_sb, group); | 1693 | if (status) { |
1499 | status = -EIO; | 1694 | mlog_errno(status); |
1500 | goto bail; | 1695 | goto bail; |
1501 | } | 1696 | } |
1502 | BUG_ON((count + start_bit) > le16_to_cpu(group->bg_bits)); | 1697 | BUG_ON((count + start_bit) > le16_to_cpu(group->bg_bits)); |
diff --git a/fs/ocfs2/suballoc.h b/fs/ocfs2/suballoc.h index a76c82a7ceac..c787838d1052 100644 --- a/fs/ocfs2/suballoc.h +++ b/fs/ocfs2/suballoc.h | |||
@@ -49,6 +49,8 @@ struct ocfs2_alloc_context { | |||
49 | u16 ac_chain; | 49 | u16 ac_chain; |
50 | int ac_allow_chain_relink; | 50 | int ac_allow_chain_relink; |
51 | group_search_t *ac_group_search; | 51 | group_search_t *ac_group_search; |
52 | |||
53 | u64 ac_last_group; | ||
52 | }; | 54 | }; |
53 | 55 | ||
54 | void ocfs2_free_alloc_context(struct ocfs2_alloc_context *ac); | 56 | void ocfs2_free_alloc_context(struct ocfs2_alloc_context *ac); |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 382706a67ffd..d17e33e66a1e 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -1442,8 +1442,13 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1442 | 1442 | ||
1443 | osb->bitmap_blkno = OCFS2_I(inode)->ip_blkno; | 1443 | osb->bitmap_blkno = OCFS2_I(inode)->ip_blkno; |
1444 | 1444 | ||
1445 | /* We don't have a cluster lock on the bitmap here because | ||
1446 | * we're only interested in static information and the extra | ||
1447 | * complexity at mount time isn't worht it. Don't pass the | ||
1448 | * inode in to the read function though as we don't want it to | ||
1449 | * be put in the cache. */ | ||
1445 | status = ocfs2_read_block(osb, osb->bitmap_blkno, &bitmap_bh, 0, | 1450 | status = ocfs2_read_block(osb, osb->bitmap_blkno, &bitmap_bh, 0, |
1446 | inode); | 1451 | NULL); |
1447 | iput(inode); | 1452 | iput(inode); |
1448 | if (status < 0) { | 1453 | if (status < 0) { |
1449 | mlog_errno(status); | 1454 | mlog_errno(status); |
@@ -1452,7 +1457,6 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1452 | 1457 | ||
1453 | di = (struct ocfs2_dinode *) bitmap_bh->b_data; | 1458 | di = (struct ocfs2_dinode *) bitmap_bh->b_data; |
1454 | osb->bitmap_cpg = le16_to_cpu(di->id2.i_chain.cl_cpg); | 1459 | osb->bitmap_cpg = le16_to_cpu(di->id2.i_chain.cl_cpg); |
1455 | osb->num_clusters = le32_to_cpu(di->id1.bitmap1.i_total); | ||
1456 | brelse(bitmap_bh); | 1460 | brelse(bitmap_bh); |
1457 | mlog(0, "cluster bitmap inode: %llu, clusters per group: %u\n", | 1461 | mlog(0, "cluster bitmap inode: %llu, clusters per group: %u\n", |
1458 | (unsigned long long)osb->bitmap_blkno, osb->bitmap_cpg); | 1462 | (unsigned long long)osb->bitmap_blkno, osb->bitmap_cpg); |
diff --git a/fs/udf/super.c b/fs/udf/super.c index 4df822c881b6..7de172efa084 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -115,6 +115,13 @@ static struct inode *udf_alloc_inode(struct super_block *sb) | |||
115 | ei = (struct udf_inode_info *)kmem_cache_alloc(udf_inode_cachep, SLAB_KERNEL); | 115 | ei = (struct udf_inode_info *)kmem_cache_alloc(udf_inode_cachep, SLAB_KERNEL); |
116 | if (!ei) | 116 | if (!ei) |
117 | return NULL; | 117 | return NULL; |
118 | |||
119 | ei->i_unique = 0; | ||
120 | ei->i_lenExtents = 0; | ||
121 | ei->i_next_alloc_block = 0; | ||
122 | ei->i_next_alloc_goal = 0; | ||
123 | ei->i_strat4096 = 0; | ||
124 | |||
118 | return &ei->vfs_inode; | 125 | return &ei->vfs_inode; |
119 | } | 126 | } |
120 | 127 | ||
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c index eef6763f3a67..d2bbcd882a69 100644 --- a/fs/xfs/xfs_alloc.c +++ b/fs/xfs/xfs_alloc.c | |||
@@ -1835,40 +1835,47 @@ xfs_alloc_fix_freelist( | |||
1835 | &agbp))) | 1835 | &agbp))) |
1836 | return error; | 1836 | return error; |
1837 | if (!pag->pagf_init) { | 1837 | if (!pag->pagf_init) { |
1838 | ASSERT(flags & XFS_ALLOC_FLAG_TRYLOCK); | ||
1839 | ASSERT(!(flags & XFS_ALLOC_FLAG_FREEING)); | ||
1838 | args->agbp = NULL; | 1840 | args->agbp = NULL; |
1839 | return 0; | 1841 | return 0; |
1840 | } | 1842 | } |
1841 | } else | 1843 | } else |
1842 | agbp = NULL; | 1844 | agbp = NULL; |
1843 | 1845 | ||
1844 | /* If this is a metadata preferred pag and we are user data | 1846 | /* |
1847 | * If this is a metadata preferred pag and we are user data | ||
1845 | * then try somewhere else if we are not being asked to | 1848 | * then try somewhere else if we are not being asked to |
1846 | * try harder at this point | 1849 | * try harder at this point |
1847 | */ | 1850 | */ |
1848 | if (pag->pagf_metadata && args->userdata && flags) { | 1851 | if (pag->pagf_metadata && args->userdata && |
1852 | (flags & XFS_ALLOC_FLAG_TRYLOCK)) { | ||
1853 | ASSERT(!(flags & XFS_ALLOC_FLAG_FREEING)); | ||
1849 | args->agbp = NULL; | 1854 | args->agbp = NULL; |
1850 | return 0; | 1855 | return 0; |
1851 | } | 1856 | } |
1852 | 1857 | ||
1853 | need = XFS_MIN_FREELIST_PAG(pag, mp); | 1858 | if (!(flags & XFS_ALLOC_FLAG_FREEING)) { |
1854 | delta = need > pag->pagf_flcount ? need - pag->pagf_flcount : 0; | 1859 | need = XFS_MIN_FREELIST_PAG(pag, mp); |
1855 | /* | 1860 | delta = need > pag->pagf_flcount ? need - pag->pagf_flcount : 0; |
1856 | * If it looks like there isn't a long enough extent, or enough | 1861 | /* |
1857 | * total blocks, reject it. | 1862 | * If it looks like there isn't a long enough extent, or enough |
1858 | */ | 1863 | * total blocks, reject it. |
1859 | longest = (pag->pagf_longest > delta) ? | 1864 | */ |
1860 | (pag->pagf_longest - delta) : | 1865 | longest = (pag->pagf_longest > delta) ? |
1861 | (pag->pagf_flcount > 0 || pag->pagf_longest > 0); | 1866 | (pag->pagf_longest - delta) : |
1862 | if (args->minlen + args->alignment + args->minalignslop - 1 > longest || | 1867 | (pag->pagf_flcount > 0 || pag->pagf_longest > 0); |
1863 | (!(flags & XFS_ALLOC_FLAG_FREEING) && | 1868 | if ((args->minlen + args->alignment + args->minalignslop - 1) > |
1864 | (int)(pag->pagf_freeblks + pag->pagf_flcount - | 1869 | longest || |
1865 | need - args->total) < | 1870 | ((int)(pag->pagf_freeblks + pag->pagf_flcount - |
1866 | (int)args->minleft)) { | 1871 | need - args->total) < (int)args->minleft)) { |
1867 | if (agbp) | 1872 | if (agbp) |
1868 | xfs_trans_brelse(tp, agbp); | 1873 | xfs_trans_brelse(tp, agbp); |
1869 | args->agbp = NULL; | 1874 | args->agbp = NULL; |
1870 | return 0; | 1875 | return 0; |
1876 | } | ||
1871 | } | 1877 | } |
1878 | |||
1872 | /* | 1879 | /* |
1873 | * Get the a.g. freespace buffer. | 1880 | * Get the a.g. freespace buffer. |
1874 | * Can fail if we're not blocking on locks, and it's held. | 1881 | * Can fail if we're not blocking on locks, and it's held. |
@@ -1878,6 +1885,8 @@ xfs_alloc_fix_freelist( | |||
1878 | &agbp))) | 1885 | &agbp))) |
1879 | return error; | 1886 | return error; |
1880 | if (agbp == NULL) { | 1887 | if (agbp == NULL) { |
1888 | ASSERT(flags & XFS_ALLOC_FLAG_TRYLOCK); | ||
1889 | ASSERT(!(flags & XFS_ALLOC_FLAG_FREEING)); | ||
1881 | args->agbp = NULL; | 1890 | args->agbp = NULL; |
1882 | return 0; | 1891 | return 0; |
1883 | } | 1892 | } |
@@ -1887,22 +1896,24 @@ xfs_alloc_fix_freelist( | |||
1887 | */ | 1896 | */ |
1888 | agf = XFS_BUF_TO_AGF(agbp); | 1897 | agf = XFS_BUF_TO_AGF(agbp); |
1889 | need = XFS_MIN_FREELIST(agf, mp); | 1898 | need = XFS_MIN_FREELIST(agf, mp); |
1890 | delta = need > be32_to_cpu(agf->agf_flcount) ? | ||
1891 | (need - be32_to_cpu(agf->agf_flcount)) : 0; | ||
1892 | /* | 1899 | /* |
1893 | * If there isn't enough total or single-extent, reject it. | 1900 | * If there isn't enough total or single-extent, reject it. |
1894 | */ | 1901 | */ |
1895 | longest = be32_to_cpu(agf->agf_longest); | 1902 | if (!(flags & XFS_ALLOC_FLAG_FREEING)) { |
1896 | longest = (longest > delta) ? (longest - delta) : | 1903 | delta = need > be32_to_cpu(agf->agf_flcount) ? |
1897 | (be32_to_cpu(agf->agf_flcount) > 0 || longest > 0); | 1904 | (need - be32_to_cpu(agf->agf_flcount)) : 0; |
1898 | if (args->minlen + args->alignment + args->minalignslop - 1 > longest || | 1905 | longest = be32_to_cpu(agf->agf_longest); |
1899 | (!(flags & XFS_ALLOC_FLAG_FREEING) && | 1906 | longest = (longest > delta) ? (longest - delta) : |
1900 | (int)(be32_to_cpu(agf->agf_freeblks) + | 1907 | (be32_to_cpu(agf->agf_flcount) > 0 || longest > 0); |
1901 | be32_to_cpu(agf->agf_flcount) - need - args->total) < | 1908 | if ((args->minlen + args->alignment + args->minalignslop - 1) > |
1902 | (int)args->minleft)) { | 1909 | longest || |
1903 | xfs_trans_brelse(tp, agbp); | 1910 | ((int)(be32_to_cpu(agf->agf_freeblks) + |
1904 | args->agbp = NULL; | 1911 | be32_to_cpu(agf->agf_flcount) - need - args->total) < |
1905 | return 0; | 1912 | (int)args->minleft)) { |
1913 | xfs_trans_brelse(tp, agbp); | ||
1914 | args->agbp = NULL; | ||
1915 | return 0; | ||
1916 | } | ||
1906 | } | 1917 | } |
1907 | /* | 1918 | /* |
1908 | * Make the freelist shorter if it's too long. | 1919 | * Make the freelist shorter if it's too long. |
@@ -1950,12 +1961,11 @@ xfs_alloc_fix_freelist( | |||
1950 | * on a completely full ag. | 1961 | * on a completely full ag. |
1951 | */ | 1962 | */ |
1952 | if (targs.agbno == NULLAGBLOCK) { | 1963 | if (targs.agbno == NULLAGBLOCK) { |
1953 | if (!(flags & XFS_ALLOC_FLAG_FREEING)) { | 1964 | if (flags & XFS_ALLOC_FLAG_FREEING) |
1954 | xfs_trans_brelse(tp, agflbp); | 1965 | break; |
1955 | args->agbp = NULL; | 1966 | xfs_trans_brelse(tp, agflbp); |
1956 | return 0; | 1967 | args->agbp = NULL; |
1957 | } | 1968 | return 0; |
1958 | break; | ||
1959 | } | 1969 | } |
1960 | /* | 1970 | /* |
1961 | * Put each allocated block on the list. | 1971 | * Put each allocated block on the list. |
@@ -2442,31 +2452,26 @@ xfs_free_extent( | |||
2442 | xfs_fsblock_t bno, /* starting block number of extent */ | 2452 | xfs_fsblock_t bno, /* starting block number of extent */ |
2443 | xfs_extlen_t len) /* length of extent */ | 2453 | xfs_extlen_t len) /* length of extent */ |
2444 | { | 2454 | { |
2445 | #ifdef DEBUG | 2455 | xfs_alloc_arg_t args; |
2446 | xfs_agf_t *agf; /* a.g. freespace header */ | ||
2447 | #endif | ||
2448 | xfs_alloc_arg_t args; /* allocation argument structure */ | ||
2449 | int error; | 2456 | int error; |
2450 | 2457 | ||
2451 | ASSERT(len != 0); | 2458 | ASSERT(len != 0); |
2459 | memset(&args, 0, sizeof(xfs_alloc_arg_t)); | ||
2452 | args.tp = tp; | 2460 | args.tp = tp; |
2453 | args.mp = tp->t_mountp; | 2461 | args.mp = tp->t_mountp; |
2454 | args.agno = XFS_FSB_TO_AGNO(args.mp, bno); | 2462 | args.agno = XFS_FSB_TO_AGNO(args.mp, bno); |
2455 | ASSERT(args.agno < args.mp->m_sb.sb_agcount); | 2463 | ASSERT(args.agno < args.mp->m_sb.sb_agcount); |
2456 | args.agbno = XFS_FSB_TO_AGBNO(args.mp, bno); | 2464 | args.agbno = XFS_FSB_TO_AGBNO(args.mp, bno); |
2457 | args.alignment = 1; | ||
2458 | args.minlen = args.minleft = args.minalignslop = 0; | ||
2459 | down_read(&args.mp->m_peraglock); | 2465 | down_read(&args.mp->m_peraglock); |
2460 | args.pag = &args.mp->m_perag[args.agno]; | 2466 | args.pag = &args.mp->m_perag[args.agno]; |
2461 | if ((error = xfs_alloc_fix_freelist(&args, XFS_ALLOC_FLAG_FREEING))) | 2467 | if ((error = xfs_alloc_fix_freelist(&args, XFS_ALLOC_FLAG_FREEING))) |
2462 | goto error0; | 2468 | goto error0; |
2463 | #ifdef DEBUG | 2469 | #ifdef DEBUG |
2464 | ASSERT(args.agbp != NULL); | 2470 | ASSERT(args.agbp != NULL); |
2465 | agf = XFS_BUF_TO_AGF(args.agbp); | 2471 | ASSERT((args.agbno + len) <= |
2466 | ASSERT(args.agbno + len <= be32_to_cpu(agf->agf_length)); | 2472 | be32_to_cpu(XFS_BUF_TO_AGF(args.agbp)->agf_length)); |
2467 | #endif | 2473 | #endif |
2468 | error = xfs_free_ag_extent(tp, args.agbp, args.agno, args.agbno, | 2474 | error = xfs_free_ag_extent(tp, args.agbp, args.agno, args.agbno, len, 0); |
2469 | len, 0); | ||
2470 | error0: | 2475 | error0: |
2471 | up_read(&args.mp->m_peraglock); | 2476 | up_read(&args.mp->m_peraglock); |
2472 | return error; | 2477 | return error; |
diff --git a/include/asm-powerpc/kexec.h b/include/asm-powerpc/kexec.h index 8f7fd5cfec34..11cbdf81fd2e 100644 --- a/include/asm-powerpc/kexec.h +++ b/include/asm-powerpc/kexec.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #ifndef __ASSEMBLY__ | 34 | #ifndef __ASSEMBLY__ |
35 | #include <linux/cpumask.h> | ||
35 | 36 | ||
36 | #ifdef CONFIG_KEXEC | 37 | #ifdef CONFIG_KEXEC |
37 | 38 | ||
@@ -109,7 +110,6 @@ static inline void crash_setup_regs(struct pt_regs *newregs, | |||
109 | 110 | ||
110 | #define MAX_NOTE_BYTES 1024 | 111 | #define MAX_NOTE_BYTES 1024 |
111 | 112 | ||
112 | #ifdef __powerpc64__ | ||
113 | extern void kexec_smp_wait(void); /* get and clear naca physid, wait for | 113 | extern void kexec_smp_wait(void); /* get and clear naca physid, wait for |
114 | master to copy new code to 0 */ | 114 | master to copy new code to 0 */ |
115 | extern int crashing_cpu; | 115 | extern int crashing_cpu; |
@@ -119,7 +119,6 @@ static inline int kexec_sr_activated(int cpu) | |||
119 | { | 119 | { |
120 | return cpu_isset(cpu,cpus_in_sr); | 120 | return cpu_isset(cpu,cpus_in_sr); |
121 | } | 121 | } |
122 | #endif /* __powerpc64 __ */ | ||
123 | 122 | ||
124 | struct kimage; | 123 | struct kimage; |
125 | struct pt_regs; | 124 | struct pt_regs; |
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h index a33c6acffa61..82a27e9a041f 100644 --- a/include/asm-powerpc/rtas.h +++ b/include/asm-powerpc/rtas.h | |||
@@ -170,6 +170,7 @@ extern int rtas_get_sensor(int sensor, int index, int *state); | |||
170 | extern int rtas_get_power_level(int powerdomain, int *level); | 170 | extern int rtas_get_power_level(int powerdomain, int *level); |
171 | extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); | 171 | extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); |
172 | extern int rtas_set_indicator(int indicator, int index, int new_value); | 172 | extern int rtas_set_indicator(int indicator, int index, int new_value); |
173 | extern int rtas_set_indicator_fast(int indicator, int index, int new_value); | ||
173 | extern void rtas_progress(char *s, unsigned short hex); | 174 | extern void rtas_progress(char *s, unsigned short hex); |
174 | extern void rtas_initialize(void); | 175 | extern void rtas_initialize(void); |
175 | 176 | ||
diff --git a/include/asm-ppc/cpm2.h b/include/asm-ppc/cpm2.h index c70344b91049..f6a7ff04ffe5 100644 --- a/include/asm-ppc/cpm2.h +++ b/include/asm-ppc/cpm2.h | |||
@@ -1093,5 +1093,100 @@ typedef struct im_idma { | |||
1093 | 1093 | ||
1094 | #define FCC_PSMR_RMII ((uint)0x00020000) /* Use RMII interface */ | 1094 | #define FCC_PSMR_RMII ((uint)0x00020000) /* Use RMII interface */ |
1095 | 1095 | ||
1096 | /* FCC iop & clock configuration. BSP code is responsible to define Fx_RXCLK & Fx_TXCLK | ||
1097 | * in order to use clock-computing stuff below for the FCC x | ||
1098 | */ | ||
1099 | |||
1100 | /* Automatically generates register configurations */ | ||
1101 | #define PC_CLK(x) ((uint)(1<<(x-1))) /* FCC CLK I/O ports */ | ||
1102 | |||
1103 | #define CMXFCR_RF1CS(x) ((uint)((x-5)<<27)) /* FCC1 Receive Clock Source */ | ||
1104 | #define CMXFCR_TF1CS(x) ((uint)((x-5)<<24)) /* FCC1 Transmit Clock Source */ | ||
1105 | #define CMXFCR_RF2CS(x) ((uint)((x-9)<<19)) /* FCC2 Receive Clock Source */ | ||
1106 | #define CMXFCR_TF2CS(x) ((uint)((x-9)<<16)) /* FCC2 Transmit Clock Source */ | ||
1107 | #define CMXFCR_RF3CS(x) ((uint)((x-9)<<11)) /* FCC3 Receive Clock Source */ | ||
1108 | #define CMXFCR_TF3CS(x) ((uint)((x-9)<<8)) /* FCC3 Transmit Clock Source */ | ||
1109 | |||
1110 | #define PC_F1RXCLK PC_CLK(F1_RXCLK) | ||
1111 | #define PC_F1TXCLK PC_CLK(F1_TXCLK) | ||
1112 | #define CMX1_CLK_ROUTE (CMXFCR_RF1CS(F1_RXCLK) | CMXFCR_TF1CS(F1_TXCLK)) | ||
1113 | #define CMX1_CLK_MASK ((uint)0xff000000) | ||
1114 | |||
1115 | #define PC_F2RXCLK PC_CLK(F2_RXCLK) | ||
1116 | #define PC_F2TXCLK PC_CLK(F2_TXCLK) | ||
1117 | #define CMX2_CLK_ROUTE (CMXFCR_RF2CS(F2_RXCLK) | CMXFCR_TF2CS(F2_TXCLK)) | ||
1118 | #define CMX2_CLK_MASK ((uint)0x00ff0000) | ||
1119 | |||
1120 | #define PC_F3RXCLK PC_CLK(F3_RXCLK) | ||
1121 | #define PC_F3TXCLK PC_CLK(F3_TXCLK) | ||
1122 | #define CMX3_CLK_ROUTE (CMXFCR_RF3CS(F3_RXCLK) | CMXFCR_TF3CS(F3_TXCLK)) | ||
1123 | #define CMX3_CLK_MASK ((uint)0x0000ff00) | ||
1124 | |||
1125 | #define CPMUX_CLK_MASK (CMX3_CLK_MASK | CMX2_CLK_MASK) | ||
1126 | #define CPMUX_CLK_ROUTE (CMX3_CLK_ROUTE | CMX2_CLK_ROUTE) | ||
1127 | |||
1128 | #define CLK_TRX (PC_F3TXCLK | PC_F3RXCLK | PC_F2TXCLK | PC_F2RXCLK) | ||
1129 | |||
1130 | /* I/O Pin assignment for FCC1. I don't yet know the best way to do this, | ||
1131 | * but there is little variation among the choices. | ||
1132 | */ | ||
1133 | #define PA1_COL 0x00000001U | ||
1134 | #define PA1_CRS 0x00000002U | ||
1135 | #define PA1_TXER 0x00000004U | ||
1136 | #define PA1_TXEN 0x00000008U | ||
1137 | #define PA1_RXDV 0x00000010U | ||
1138 | #define PA1_RXER 0x00000020U | ||
1139 | #define PA1_TXDAT 0x00003c00U | ||
1140 | #define PA1_RXDAT 0x0003c000U | ||
1141 | #define PA1_PSORA0 (PA1_RXDAT | PA1_TXDAT) | ||
1142 | #define PA1_PSORA1 (PA1_COL | PA1_CRS | PA1_TXER | PA1_TXEN | \ | ||
1143 | PA1_RXDV | PA1_RXER) | ||
1144 | #define PA1_DIRA0 (PA1_RXDAT | PA1_CRS | PA1_COL | PA1_RXER | PA1_RXDV) | ||
1145 | #define PA1_DIRA1 (PA1_TXDAT | PA1_TXEN | PA1_TXER) | ||
1146 | |||
1147 | |||
1148 | /* I/O Pin assignment for FCC2. I don't yet know the best way to do this, | ||
1149 | * but there is little variation among the choices. | ||
1150 | */ | ||
1151 | #define PB2_TXER 0x00000001U | ||
1152 | #define PB2_RXDV 0x00000002U | ||
1153 | #define PB2_TXEN 0x00000004U | ||
1154 | #define PB2_RXER 0x00000008U | ||
1155 | #define PB2_COL 0x00000010U | ||
1156 | #define PB2_CRS 0x00000020U | ||
1157 | #define PB2_TXDAT 0x000003c0U | ||
1158 | #define PB2_RXDAT 0x00003c00U | ||
1159 | #define PB2_PSORB0 (PB2_RXDAT | PB2_TXDAT | PB2_CRS | PB2_COL | \ | ||
1160 | PB2_RXER | PB2_RXDV | PB2_TXER) | ||
1161 | #define PB2_PSORB1 (PB2_TXEN) | ||
1162 | #define PB2_DIRB0 (PB2_RXDAT | PB2_CRS | PB2_COL | PB2_RXER | PB2_RXDV) | ||
1163 | #define PB2_DIRB1 (PB2_TXDAT | PB2_TXEN | PB2_TXER) | ||
1164 | |||
1165 | |||
1166 | /* I/O Pin assignment for FCC3. I don't yet know the best way to do this, | ||
1167 | * but there is little variation among the choices. | ||
1168 | */ | ||
1169 | #define PB3_RXDV 0x00004000U | ||
1170 | #define PB3_RXER 0x00008000U | ||
1171 | #define PB3_TXER 0x00010000U | ||
1172 | #define PB3_TXEN 0x00020000U | ||
1173 | #define PB3_COL 0x00040000U | ||
1174 | #define PB3_CRS 0x00080000U | ||
1175 | #define PB3_TXDAT 0x0f000000U | ||
1176 | #define PC3_TXDAT 0x00000010U | ||
1177 | #define PB3_RXDAT 0x00f00000U | ||
1178 | #define PB3_PSORB0 (PB3_RXDAT | PB3_TXDAT | PB3_CRS | PB3_COL | \ | ||
1179 | PB3_RXER | PB3_RXDV | PB3_TXER | PB3_TXEN) | ||
1180 | #define PB3_PSORB1 0 | ||
1181 | #define PB3_DIRB0 (PB3_RXDAT | PB3_CRS | PB3_COL | PB3_RXER | PB3_RXDV) | ||
1182 | #define PB3_DIRB1 (PB3_TXDAT | PB3_TXEN | PB3_TXER) | ||
1183 | #define PC3_DIRC1 (PC3_TXDAT) | ||
1184 | |||
1185 | /* Handy macro to specify mem for FCCs*/ | ||
1186 | #define FCC_MEM_OFFSET(x) (CPM_FCC_SPECIAL_BASE + (x*128)) | ||
1187 | #define FCC1_MEM_OFFSET FCC_MEM_OFFSET(0) | ||
1188 | #define FCC2_MEM_OFFSET FCC_MEM_OFFSET(1) | ||
1189 | #define FCC2_MEM_OFFSET FCC_MEM_OFFSET(2) | ||
1190 | |||
1096 | #endif /* __CPM2__ */ | 1191 | #endif /* __CPM2__ */ |
1097 | #endif /* __KERNEL__ */ | 1192 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-ppc/mpc8260.h b/include/asm-ppc/mpc8260.h index 4b93481e7679..23579d4afae7 100644 --- a/include/asm-ppc/mpc8260.h +++ b/include/asm-ppc/mpc8260.h | |||
@@ -82,6 +82,7 @@ enum ppc_sys_devices { | |||
82 | MPC82xx_CPM_SMC2, | 82 | MPC82xx_CPM_SMC2, |
83 | MPC82xx_CPM_USB, | 83 | MPC82xx_CPM_USB, |
84 | MPC82xx_SEC1, | 84 | MPC82xx_SEC1, |
85 | MPC82xx_MDIO_BB, | ||
85 | NUM_PPC_SYS_DEVS, | 86 | NUM_PPC_SYS_DEVS, |
86 | }; | 87 | }; |
87 | 88 | ||
diff --git a/include/asm-ppc/mpc8xx.h b/include/asm-ppc/mpc8xx.h index adcce33f20ae..d3a2f2fe230c 100644 --- a/include/asm-ppc/mpc8xx.h +++ b/include/asm-ppc/mpc8xx.h | |||
@@ -110,6 +110,7 @@ enum ppc_sys_devices { | |||
110 | MPC8xx_CPM_SMC1, | 110 | MPC8xx_CPM_SMC1, |
111 | MPC8xx_CPM_SMC2, | 111 | MPC8xx_CPM_SMC2, |
112 | MPC8xx_CPM_USB, | 112 | MPC8xx_CPM_USB, |
113 | MPC8xx_MDIO_FEC, | ||
113 | NUM_PPC_SYS_DEVS, | 114 | NUM_PPC_SYS_DEVS, |
114 | }; | 115 | }; |
115 | 116 | ||
diff --git a/include/linux/fb.h b/include/linux/fb.h index 4ad0673b1995..2f335e966011 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef _LINUX_FB_H | 1 | #ifndef _LINUX_FB_H |
2 | #define _LINUX_FB_H | 2 | #define _LINUX_FB_H |
3 | 3 | ||
4 | #include <linux/backlight.h> | ||
5 | #include <asm/types.h> | 4 | #include <asm/types.h> |
6 | 5 | ||
7 | /* Definitions of frame buffers */ | 6 | /* Definitions of frame buffers */ |
@@ -381,6 +380,7 @@ struct fb_cursor { | |||
381 | #include <linux/workqueue.h> | 380 | #include <linux/workqueue.h> |
382 | #include <linux/notifier.h> | 381 | #include <linux/notifier.h> |
383 | #include <linux/list.h> | 382 | #include <linux/list.h> |
383 | #include <linux/backlight.h> | ||
384 | #include <asm/io.h> | 384 | #include <asm/io.h> |
385 | 385 | ||
386 | struct vm_area_struct; | 386 | struct vm_area_struct; |
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h index 783c476b8674..74ed35a00a94 100644 --- a/include/linux/fs_enet_pd.h +++ b/include/linux/fs_enet_pd.h | |||
@@ -69,34 +69,21 @@ enum fs_ioport { | |||
69 | fsiop_porte, | 69 | fsiop_porte, |
70 | }; | 70 | }; |
71 | 71 | ||
72 | struct fs_mii_bus_info { | 72 | struct fs_mii_bit { |
73 | int method; /* mii method */ | 73 | u32 offset; |
74 | int id; /* the id of the mii_bus */ | 74 | u8 bit; |
75 | int disable_aneg; /* if the controller needs to negothiate speed & duplex */ | 75 | u8 polarity; |
76 | int lpa; /* the default board-specific vallues will be applied otherwise */ | 76 | }; |
77 | 77 | struct fs_mii_bb_platform_info { | |
78 | union { | 78 | struct fs_mii_bit mdio_dir; |
79 | struct { | 79 | struct fs_mii_bit mdio_dat; |
80 | int duplex; | 80 | struct fs_mii_bit mdc_dat; |
81 | int speed; | 81 | int mdio_port; /* port & bit for MDIO */ |
82 | } fixed; | 82 | int mdio_bit; |
83 | 83 | int mdc_port; /* port & bit for MDC */ | |
84 | struct { | 84 | int mdc_bit; |
85 | /* nothing */ | 85 | int delay; /* delay in us */ |
86 | } fec; | 86 | int irq[32]; /* irqs per phy's */ |
87 | |||
88 | struct { | ||
89 | /* nothing */ | ||
90 | } scc; | ||
91 | |||
92 | struct { | ||
93 | int mdio_port; /* port & bit for MDIO */ | ||
94 | int mdio_bit; | ||
95 | int mdc_port; /* port & bit for MDC */ | ||
96 | int mdc_bit; | ||
97 | int delay; /* delay in us */ | ||
98 | } bitbang; | ||
99 | } i; | ||
100 | }; | 87 | }; |
101 | 88 | ||
102 | struct fs_platform_info { | 89 | struct fs_platform_info { |
@@ -119,6 +106,7 @@ struct fs_platform_info { | |||
119 | u32 device_flags; | 106 | u32 device_flags; |
120 | 107 | ||
121 | int phy_addr; /* the phy address (-1 no phy) */ | 108 | int phy_addr; /* the phy address (-1 no phy) */ |
109 | const char* bus_id; | ||
122 | int phy_irq; /* the phy irq (if it exists) */ | 110 | int phy_irq; /* the phy irq (if it exists) */ |
123 | 111 | ||
124 | const struct fs_mii_bus_info *bus_info; | 112 | const struct fs_mii_bus_info *bus_info; |
@@ -130,6 +118,10 @@ struct fs_platform_info { | |||
130 | int napi_weight; /* NAPI weight */ | 118 | int napi_weight; /* NAPI weight */ |
131 | 119 | ||
132 | int use_rmii; /* use RMII mode */ | 120 | int use_rmii; /* use RMII mode */ |
121 | int has_phy; /* if the network is phy container as well...*/ | ||
122 | }; | ||
123 | struct fs_mii_fec_platform_info { | ||
124 | u32 irq[32]; | ||
125 | u32 mii_speed; | ||
133 | }; | 126 | }; |
134 | |||
135 | #endif | 127 | #endif |
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 383627ad328f..ab2740832742 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
@@ -155,6 +155,11 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb, | |||
155 | { | 155 | { |
156 | struct net_device_stats *stats; | 156 | struct net_device_stats *stats; |
157 | 157 | ||
158 | if (skb_bond_should_drop(skb)) { | ||
159 | dev_kfree_skb_any(skb); | ||
160 | return NET_RX_DROP; | ||
161 | } | ||
162 | |||
158 | skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK]; | 163 | skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK]; |
159 | if (skb->dev == NULL) { | 164 | if (skb->dev == NULL) { |
160 | dev_kfree_skb_any(skb); | 165 | dev_kfree_skb_any(skb); |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 181c69cad4e3..851aa1bcfc1a 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -210,6 +210,7 @@ extern enum system_states { | |||
210 | extern void dump_stack(void); | 210 | extern void dump_stack(void); |
211 | 211 | ||
212 | #ifdef DEBUG | 212 | #ifdef DEBUG |
213 | /* If you are writing a driver, please use dev_dbg instead */ | ||
213 | #define pr_debug(fmt,arg...) \ | 214 | #define pr_debug(fmt,arg...) \ |
214 | printk(KERN_DEBUG fmt,##arg) | 215 | printk(KERN_DEBUG fmt,##arg) |
215 | #else | 216 | #else |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 990957e0929f..f0b135cd86da 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -336,6 +336,7 @@ static inline void init_page_count(struct page *page) | |||
336 | } | 336 | } |
337 | 337 | ||
338 | void put_page(struct page *page); | 338 | void put_page(struct page *page); |
339 | void put_pages_list(struct list_head *pages); | ||
339 | 340 | ||
340 | void split_page(struct page *page, unsigned int order); | 341 | void split_page(struct page *page, unsigned int order); |
341 | 342 | ||
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 75f02d8c6ed3..50a4719512ed 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -320,6 +320,9 @@ struct net_device | |||
320 | #define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT) | 320 | #define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT) |
321 | #define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT) | 321 | #define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT) |
322 | 322 | ||
323 | /* List of features with software fallbacks. */ | ||
324 | #define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6) | ||
325 | |||
323 | #define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM) | 326 | #define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM) |
324 | #define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM) | 327 | #define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM) |
325 | 328 | ||
@@ -1012,6 +1015,30 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) | |||
1012 | unlikely(skb->ip_summed != CHECKSUM_HW)); | 1015 | unlikely(skb->ip_summed != CHECKSUM_HW)); |
1013 | } | 1016 | } |
1014 | 1017 | ||
1018 | /* On bonding slaves other than the currently active slave, suppress | ||
1019 | * duplicates except for 802.3ad ETH_P_SLOW and alb non-mcast/bcast. | ||
1020 | */ | ||
1021 | static inline int skb_bond_should_drop(struct sk_buff *skb) | ||
1022 | { | ||
1023 | struct net_device *dev = skb->dev; | ||
1024 | struct net_device *master = dev->master; | ||
1025 | |||
1026 | if (master && | ||
1027 | (dev->priv_flags & IFF_SLAVE_INACTIVE)) { | ||
1028 | if (master->priv_flags & IFF_MASTER_ALB) { | ||
1029 | if (skb->pkt_type != PACKET_BROADCAST && | ||
1030 | skb->pkt_type != PACKET_MULTICAST) | ||
1031 | return 0; | ||
1032 | } | ||
1033 | if (master->priv_flags & IFF_MASTER_8023AD && | ||
1034 | skb->protocol == __constant_htons(ETH_P_SLOW)) | ||
1035 | return 0; | ||
1036 | |||
1037 | return 1; | ||
1038 | } | ||
1039 | return 0; | ||
1040 | } | ||
1041 | |||
1015 | #endif /* __KERNEL__ */ | 1042 | #endif /* __KERNEL__ */ |
1016 | 1043 | ||
1017 | #endif /* _LINUX_DEV_H */ | 1044 | #endif /* _LINUX_DEV_H */ |
diff --git a/include/linux/phy.h b/include/linux/phy.h index 331521a10a2d..9447a57ee8a9 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -378,6 +378,7 @@ int phy_mii_ioctl(struct phy_device *phydev, | |||
378 | struct mii_ioctl_data *mii_data, int cmd); | 378 | struct mii_ioctl_data *mii_data, int cmd); |
379 | int phy_start_interrupts(struct phy_device *phydev); | 379 | int phy_start_interrupts(struct phy_device *phydev); |
380 | void phy_print_status(struct phy_device *phydev); | 380 | void phy_print_status(struct phy_device *phydev); |
381 | struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id); | ||
381 | 382 | ||
382 | extern struct bus_type mdio_bus_type; | 383 | extern struct bus_type mdio_bus_type; |
383 | #endif /* __PHY_H */ | 384 | #endif /* __PHY_H */ |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 19c96d498e20..755e9cddac47 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -1040,6 +1040,21 @@ static inline int pskb_trim(struct sk_buff *skb, unsigned int len) | |||
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | /** | 1042 | /** |
1043 | * pskb_trim_unique - remove end from a paged unique (not cloned) buffer | ||
1044 | * @skb: buffer to alter | ||
1045 | * @len: new length | ||
1046 | * | ||
1047 | * This is identical to pskb_trim except that the caller knows that | ||
1048 | * the skb is not cloned so we should never get an error due to out- | ||
1049 | * of-memory. | ||
1050 | */ | ||
1051 | static inline void pskb_trim_unique(struct sk_buff *skb, unsigned int len) | ||
1052 | { | ||
1053 | int err = pskb_trim(skb, len); | ||
1054 | BUG_ON(err); | ||
1055 | } | ||
1056 | |||
1057 | /** | ||
1043 | * skb_orphan - orphan a buffer | 1058 | * skb_orphan - orphan a buffer |
1044 | * @skb: buffer to orphan | 1059 | * @skb: buffer to orphan |
1045 | * | 1060 | * |
@@ -1081,7 +1096,7 @@ static inline void __skb_queue_purge(struct sk_buff_head *list) | |||
1081 | * the headroom they think they need without accounting for the | 1096 | * the headroom they think they need without accounting for the |
1082 | * built in space. The built in space is used for optimisations. | 1097 | * built in space. The built in space is used for optimisations. |
1083 | * | 1098 | * |
1084 | * %NULL is returned in there is no free memory. | 1099 | * %NULL is returned if there is no free memory. |
1085 | */ | 1100 | */ |
1086 | static inline struct sk_buff *__dev_alloc_skb(unsigned int length, | 1101 | static inline struct sk_buff *__dev_alloc_skb(unsigned int length, |
1087 | gfp_t gfp_mask) | 1102 | gfp_t gfp_mask) |
@@ -1101,7 +1116,7 @@ static inline struct sk_buff *__dev_alloc_skb(unsigned int length, | |||
1101 | * the headroom they think they need without accounting for the | 1116 | * the headroom they think they need without accounting for the |
1102 | * built in space. The built in space is used for optimisations. | 1117 | * built in space. The built in space is used for optimisations. |
1103 | * | 1118 | * |
1104 | * %NULL is returned in there is no free memory. Although this function | 1119 | * %NULL is returned if there is no free memory. Although this function |
1105 | * allocates memory it can be called from an interrupt. | 1120 | * allocates memory it can be called from an interrupt. |
1106 | */ | 1121 | */ |
1107 | static inline struct sk_buff *dev_alloc_skb(unsigned int length) | 1122 | static inline struct sk_buff *dev_alloc_skb(unsigned int length) |
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index f8665326ed9f..600d61d7d2ab 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
17 | #include <linux/mutex.h> | 17 | #include <linux/mutex.h> |
18 | #include <linux/compiler.h> /* need __user */ | 18 | #include <linux/compiler.h> /* need __user */ |
19 | #ifdef CONFIG_VIDEO_V4L1 | 19 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
20 | #include <linux/videodev.h> | 20 | #include <linux/videodev.h> |
21 | #else | 21 | #else |
22 | #include <linux/videodev2.h> | 22 | #include <linux/videodev2.h> |
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index ecc42864b001..b174ebb277a9 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -240,6 +240,11 @@ struct ieee80211_snap_hdr { | |||
240 | #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) | 240 | #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) |
241 | #define WLAN_CAPABILITY_DSSS_OFDM (1<<13) | 241 | #define WLAN_CAPABILITY_DSSS_OFDM (1<<13) |
242 | 242 | ||
243 | /* 802.11g ERP information element */ | ||
244 | #define WLAN_ERP_NON_ERP_PRESENT (1<<0) | ||
245 | #define WLAN_ERP_USE_PROTECTION (1<<1) | ||
246 | #define WLAN_ERP_BARKER_PREAMBLE (1<<2) | ||
247 | |||
243 | /* Status codes */ | 248 | /* Status codes */ |
244 | enum ieee80211_statuscode { | 249 | enum ieee80211_statuscode { |
245 | WLAN_STATUS_SUCCESS = 0, | 250 | WLAN_STATUS_SUCCESS = 0, |
@@ -747,6 +752,8 @@ struct ieee80211_txb { | |||
747 | #define NETWORK_HAS_IBSS_DFS (1<<8) | 752 | #define NETWORK_HAS_IBSS_DFS (1<<8) |
748 | #define NETWORK_HAS_TPC_REPORT (1<<9) | 753 | #define NETWORK_HAS_TPC_REPORT (1<<9) |
749 | 754 | ||
755 | #define NETWORK_HAS_ERP_VALUE (1<<10) | ||
756 | |||
750 | #define QOS_QUEUE_NUM 4 | 757 | #define QOS_QUEUE_NUM 4 |
751 | #define QOS_OUI_LEN 3 | 758 | #define QOS_OUI_LEN 3 |
752 | #define QOS_OUI_TYPE 2 | 759 | #define QOS_OUI_TYPE 2 |
@@ -1252,6 +1259,8 @@ extern int ieee80211_tx_frame(struct ieee80211_device *ieee, | |||
1252 | int total_len, int encrypt_mpdu); | 1259 | int total_len, int encrypt_mpdu); |
1253 | 1260 | ||
1254 | /* ieee80211_rx.c */ | 1261 | /* ieee80211_rx.c */ |
1262 | extern void ieee80211_rx_any(struct ieee80211_device *ieee, | ||
1263 | struct sk_buff *skb, struct ieee80211_rx_stats *stats); | ||
1255 | extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | 1264 | extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, |
1256 | struct ieee80211_rx_stats *rx_stats); | 1265 | struct ieee80211_rx_stats *rx_stats); |
1257 | /* make sure to set stats->len */ | 1266 | /* make sure to set stats->len */ |
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h index 00ad810eb883..425b3a57ac74 100644 --- a/include/net/ieee80211softmac.h +++ b/include/net/ieee80211softmac.h | |||
@@ -86,9 +86,6 @@ struct ieee80211softmac_assoc_info { | |||
86 | 86 | ||
87 | /* BSSID we're trying to associate to */ | 87 | /* BSSID we're trying to associate to */ |
88 | char bssid[ETH_ALEN]; | 88 | char bssid[ETH_ALEN]; |
89 | |||
90 | /* Rates supported by the network */ | ||
91 | struct ieee80211softmac_ratesinfo supported_rates; | ||
92 | 89 | ||
93 | /* some flags. | 90 | /* some flags. |
94 | * static_essid is valid if the essid is constant, | 91 | * static_essid is valid if the essid is constant, |
@@ -103,6 +100,7 @@ struct ieee80211softmac_assoc_info { | |||
103 | * bssfixed is used for SIOCSIWAP. | 100 | * bssfixed is used for SIOCSIWAP. |
104 | */ | 101 | */ |
105 | u8 static_essid:1, | 102 | u8 static_essid:1, |
103 | short_preamble_available:1, | ||
106 | associating:1, | 104 | associating:1, |
107 | assoc_wait:1, | 105 | assoc_wait:1, |
108 | bssvalid:1, | 106 | bssvalid:1, |
@@ -115,6 +113,19 @@ struct ieee80211softmac_assoc_info { | |||
115 | struct work_struct timeout; | 113 | struct work_struct timeout; |
116 | }; | 114 | }; |
117 | 115 | ||
116 | struct ieee80211softmac_bss_info { | ||
117 | /* Rates supported by the network */ | ||
118 | struct ieee80211softmac_ratesinfo supported_rates; | ||
119 | |||
120 | /* This indicates whether frames can currently be transmitted with | ||
121 | * short preamble (only use this variable during TX at CCK rates) */ | ||
122 | u8 short_preamble:1; | ||
123 | |||
124 | /* This indicates whether protection (e.g. self-CTS) should be used | ||
125 | * when transmitting with OFDM modulation */ | ||
126 | u8 use_protection:1; | ||
127 | }; | ||
128 | |||
118 | enum { | 129 | enum { |
119 | IEEE80211SOFTMAC_AUTH_OPEN_REQUEST = 1, | 130 | IEEE80211SOFTMAC_AUTH_OPEN_REQUEST = 1, |
120 | IEEE80211SOFTMAC_AUTH_OPEN_RESPONSE = 2, | 131 | IEEE80211SOFTMAC_AUTH_OPEN_RESPONSE = 2, |
@@ -157,6 +168,10 @@ struct ieee80211softmac_txrates { | |||
157 | #define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */ | 168 | #define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */ |
158 | #define IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST (1 << 3) /* mgt_mcast_rate */ | 169 | #define IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST (1 << 3) /* mgt_mcast_rate */ |
159 | 170 | ||
171 | #define IEEE80211SOFTMAC_BSSINFOCHG_RATES (1 << 0) /* supported_rates */ | ||
172 | #define IEEE80211SOFTMAC_BSSINFOCHG_SHORT_PREAMBLE (1 << 1) /* short_preamble */ | ||
173 | #define IEEE80211SOFTMAC_BSSINFOCHG_PROTECTION (1 << 2) /* use_protection */ | ||
174 | |||
160 | struct ieee80211softmac_device { | 175 | struct ieee80211softmac_device { |
161 | /* 802.11 structure for data stuff */ | 176 | /* 802.11 structure for data stuff */ |
162 | struct ieee80211_device *ieee; | 177 | struct ieee80211_device *ieee; |
@@ -200,10 +215,16 @@ struct ieee80211softmac_device { | |||
200 | * The driver just needs to read them. | 215 | * The driver just needs to read them. |
201 | */ | 216 | */ |
202 | struct ieee80211softmac_txrates txrates; | 217 | struct ieee80211softmac_txrates txrates; |
203 | /* If the driver needs to do stuff on TX rate changes, assign this callback. */ | 218 | |
219 | /* If the driver needs to do stuff on TX rate changes, assign this | ||
220 | * callback. See IEEE80211SOFTMAC_TXRATECHG for change flags. */ | ||
204 | void (*txrates_change)(struct net_device *dev, | 221 | void (*txrates_change)(struct net_device *dev, |
205 | u32 changes, /* see IEEE80211SOFTMAC_TXRATECHG flags */ | 222 | u32 changes); |
206 | const struct ieee80211softmac_txrates *rates_before_change); | 223 | |
224 | /* If the driver needs to do stuff when BSS properties change, assign | ||
225 | * this callback. see IEEE80211SOFTMAC_BSSINFOCHG for change flags. */ | ||
226 | void (*bssinfo_change)(struct net_device *dev, | ||
227 | u32 changes); | ||
207 | 228 | ||
208 | /* private stuff follows */ | 229 | /* private stuff follows */ |
209 | /* this lock protects this structure */ | 230 | /* this lock protects this structure */ |
@@ -216,6 +237,7 @@ struct ieee80211softmac_device { | |||
216 | 237 | ||
217 | struct ieee80211softmac_scaninfo *scaninfo; | 238 | struct ieee80211softmac_scaninfo *scaninfo; |
218 | struct ieee80211softmac_assoc_info associnfo; | 239 | struct ieee80211softmac_assoc_info associnfo; |
240 | struct ieee80211softmac_bss_info bssinfo; | ||
219 | 241 | ||
220 | struct list_head auth_queue; | 242 | struct list_head auth_queue; |
221 | struct list_head events; | 243 | struct list_head events; |
@@ -257,6 +279,14 @@ extern void ieee80211softmac_fragment_lost(struct net_device *dev, | |||
257 | * Note that the rates need to be sorted. */ | 279 | * Note that the rates need to be sorted. */ |
258 | extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates); | 280 | extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates); |
259 | 281 | ||
282 | /* Finds the highest rate which is: | ||
283 | * 1. Present in ri (optionally a basic rate) | ||
284 | * 2. Supported by the device | ||
285 | * 3. Less than or equal to the user-defined rate | ||
286 | */ | ||
287 | extern u8 ieee80211softmac_highest_supported_rate(struct ieee80211softmac_device *mac, | ||
288 | struct ieee80211softmac_ratesinfo *ri, int basic_only); | ||
289 | |||
260 | /* Helper function which advises you the rate at which a frame should be | 290 | /* Helper function which advises you the rate at which a frame should be |
261 | * transmitted at. */ | 291 | * transmitted at. */ |
262 | static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device *mac, | 292 | static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device *mac, |
@@ -279,6 +309,24 @@ static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device | |||
279 | return txrates->mcast_rate; | 309 | return txrates->mcast_rate; |
280 | } | 310 | } |
281 | 311 | ||
312 | /* Helper function which advises you when it is safe to transmit with short | ||
313 | * preamble. | ||
314 | * You should only call this function when transmitting at CCK rates. */ | ||
315 | static inline int ieee80211softmac_short_preamble_ok(struct ieee80211softmac_device *mac, | ||
316 | int is_multicast, | ||
317 | int is_mgt) | ||
318 | { | ||
319 | return (is_multicast && is_mgt) ? 0 : mac->bssinfo.short_preamble; | ||
320 | } | ||
321 | |||
322 | /* Helper function which advises you whether protection (e.g. self-CTS) is | ||
323 | * needed. 1 = protection needed, 0 = no protection needed | ||
324 | * Only use this function when transmitting with OFDM modulation. */ | ||
325 | static inline int ieee80211softmac_protection_needed(struct ieee80211softmac_device *mac) | ||
326 | { | ||
327 | return mac->bssinfo.use_protection; | ||
328 | } | ||
329 | |||
282 | /* Start the SoftMAC. Call this after you initialized the device | 330 | /* Start the SoftMAC. Call this after you initialized the device |
283 | * and it is ready to run. | 331 | * and it is ready to run. |
284 | */ | 332 | */ |
diff --git a/kernel/futex.c b/kernel/futex.c index c2b2e0b83abf..d4633c588f33 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -297,7 +297,7 @@ static int futex_handle_fault(unsigned long address, int attempt) | |||
297 | struct vm_area_struct * vma; | 297 | struct vm_area_struct * vma; |
298 | struct mm_struct *mm = current->mm; | 298 | struct mm_struct *mm = current->mm; |
299 | 299 | ||
300 | if (attempt >= 2 || !(vma = find_vma(mm, address)) || | 300 | if (attempt > 2 || !(vma = find_vma(mm, address)) || |
301 | vma->vm_start > address || !(vma->vm_flags & VM_WRITE)) | 301 | vma->vm_start > address || !(vma->vm_flags & VM_WRITE)) |
302 | return -EFAULT; | 302 | return -EFAULT; |
303 | 303 | ||
@@ -747,8 +747,10 @@ retry: | |||
747 | */ | 747 | */ |
748 | if (attempt++) { | 748 | if (attempt++) { |
749 | if (futex_handle_fault((unsigned long)uaddr2, | 749 | if (futex_handle_fault((unsigned long)uaddr2, |
750 | attempt)) | 750 | attempt)) { |
751 | ret = -EFAULT; | ||
751 | goto out; | 752 | goto out; |
753 | } | ||
752 | goto retry; | 754 | goto retry; |
753 | } | 755 | } |
754 | 756 | ||
@@ -1322,9 +1324,10 @@ static int do_futex_lock_pi(u32 __user *uaddr, int detect, int trylock, | |||
1322 | * still holding the mmap_sem. | 1324 | * still holding the mmap_sem. |
1323 | */ | 1325 | */ |
1324 | if (attempt++) { | 1326 | if (attempt++) { |
1325 | if (futex_handle_fault((unsigned long)uaddr, attempt)) | 1327 | if (futex_handle_fault((unsigned long)uaddr, attempt)) { |
1328 | ret = -EFAULT; | ||
1326 | goto out_unlock_release_sem; | 1329 | goto out_unlock_release_sem; |
1327 | 1330 | } | |
1328 | goto retry_locked; | 1331 | goto retry_locked; |
1329 | } | 1332 | } |
1330 | 1333 | ||
@@ -1506,9 +1509,10 @@ pi_faulted: | |||
1506 | * still holding the mmap_sem. | 1509 | * still holding the mmap_sem. |
1507 | */ | 1510 | */ |
1508 | if (attempt++) { | 1511 | if (attempt++) { |
1509 | if (futex_handle_fault((unsigned long)uaddr, attempt)) | 1512 | if (futex_handle_fault((unsigned long)uaddr, attempt)) { |
1513 | ret = -EFAULT; | ||
1510 | goto out_unlock; | 1514 | goto out_unlock; |
1511 | 1515 | } | |
1512 | goto retry_locked; | 1516 | goto retry_locked; |
1513 | } | 1517 | } |
1514 | 1518 | ||
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index be989efc7856..21c38a7e666b 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -187,7 +187,7 @@ switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_base *base) | |||
187 | { | 187 | { |
188 | struct hrtimer_base *new_base; | 188 | struct hrtimer_base *new_base; |
189 | 189 | ||
190 | new_base = &__get_cpu_var(hrtimer_bases[base->index]); | 190 | new_base = &__get_cpu_var(hrtimer_bases)[base->index]; |
191 | 191 | ||
192 | if (base != new_base) { | 192 | if (base != new_base) { |
193 | /* | 193 | /* |
diff --git a/kernel/panic.c b/kernel/panic.c index d8a0bca21233..9b8dcfd1ca93 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/nmi.h> | 19 | #include <linux/nmi.h> |
20 | #include <linux/kexec.h> | 20 | #include <linux/kexec.h> |
21 | #include <linux/debug_locks.h> | ||
21 | 22 | ||
22 | int panic_on_oops; | 23 | int panic_on_oops; |
23 | int tainted; | 24 | int tainted; |
diff --git a/kernel/timer.c b/kernel/timer.c index b650f04888ed..1d7dd6267c2d 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -1324,46 +1324,19 @@ asmlinkage long sys_getpid(void) | |||
1324 | } | 1324 | } |
1325 | 1325 | ||
1326 | /* | 1326 | /* |
1327 | * Accessing ->group_leader->real_parent is not SMP-safe, it could | 1327 | * Accessing ->real_parent is not SMP-safe, it could |
1328 | * change from under us. However, rather than getting any lock | 1328 | * change from under us. However, we can use a stale |
1329 | * we can use an optimistic algorithm: get the parent | 1329 | * value of ->real_parent under rcu_read_lock(), see |
1330 | * pid, and go back and check that the parent is still | 1330 | * release_task()->call_rcu(delayed_put_task_struct). |
1331 | * the same. If it has changed (which is extremely unlikely | ||
1332 | * indeed), we just try again.. | ||
1333 | * | ||
1334 | * NOTE! This depends on the fact that even if we _do_ | ||
1335 | * get an old value of "parent", we can happily dereference | ||
1336 | * the pointer (it was and remains a dereferencable kernel pointer | ||
1337 | * no matter what): we just can't necessarily trust the result | ||
1338 | * until we know that the parent pointer is valid. | ||
1339 | * | ||
1340 | * NOTE2: ->group_leader never changes from under us. | ||
1341 | */ | 1331 | */ |
1342 | asmlinkage long sys_getppid(void) | 1332 | asmlinkage long sys_getppid(void) |
1343 | { | 1333 | { |
1344 | int pid; | 1334 | int pid; |
1345 | struct task_struct *me = current; | ||
1346 | struct task_struct *parent; | ||
1347 | 1335 | ||
1348 | parent = me->group_leader->real_parent; | 1336 | rcu_read_lock(); |
1349 | for (;;) { | 1337 | pid = rcu_dereference(current->real_parent)->tgid; |
1350 | pid = parent->tgid; | 1338 | rcu_read_unlock(); |
1351 | #if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT) | ||
1352 | { | ||
1353 | struct task_struct *old = parent; | ||
1354 | 1339 | ||
1355 | /* | ||
1356 | * Make sure we read the pid before re-reading the | ||
1357 | * parent pointer: | ||
1358 | */ | ||
1359 | smp_rmb(); | ||
1360 | parent = me->group_leader->real_parent; | ||
1361 | if (old != parent) | ||
1362 | continue; | ||
1363 | } | ||
1364 | #endif | ||
1365 | break; | ||
1366 | } | ||
1367 | return pid; | 1340 | return pid; |
1368 | } | 1341 | } |
1369 | 1342 | ||
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 448e8f7b342d..835fe28b87a8 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -68,7 +68,7 @@ struct workqueue_struct { | |||
68 | 68 | ||
69 | /* All the per-cpu workqueues on the system, for hotplug cpu to add/remove | 69 | /* All the per-cpu workqueues on the system, for hotplug cpu to add/remove |
70 | threads to each one as cpus come/go. */ | 70 | threads to each one as cpus come/go. */ |
71 | static DEFINE_SPINLOCK(workqueue_lock); | 71 | static DEFINE_MUTEX(workqueue_mutex); |
72 | static LIST_HEAD(workqueues); | 72 | static LIST_HEAD(workqueues); |
73 | 73 | ||
74 | static int singlethread_cpu; | 74 | static int singlethread_cpu; |
@@ -320,10 +320,10 @@ void fastcall flush_workqueue(struct workqueue_struct *wq) | |||
320 | } else { | 320 | } else { |
321 | int cpu; | 321 | int cpu; |
322 | 322 | ||
323 | lock_cpu_hotplug(); | 323 | mutex_lock(&workqueue_mutex); |
324 | for_each_online_cpu(cpu) | 324 | for_each_online_cpu(cpu) |
325 | flush_cpu_workqueue(per_cpu_ptr(wq->cpu_wq, cpu)); | 325 | flush_cpu_workqueue(per_cpu_ptr(wq->cpu_wq, cpu)); |
326 | unlock_cpu_hotplug(); | 326 | mutex_unlock(&workqueue_mutex); |
327 | } | 327 | } |
328 | } | 328 | } |
329 | EXPORT_SYMBOL_GPL(flush_workqueue); | 329 | EXPORT_SYMBOL_GPL(flush_workqueue); |
@@ -371,8 +371,7 @@ struct workqueue_struct *__create_workqueue(const char *name, | |||
371 | } | 371 | } |
372 | 372 | ||
373 | wq->name = name; | 373 | wq->name = name; |
374 | /* We don't need the distraction of CPUs appearing and vanishing. */ | 374 | mutex_lock(&workqueue_mutex); |
375 | lock_cpu_hotplug(); | ||
376 | if (singlethread) { | 375 | if (singlethread) { |
377 | INIT_LIST_HEAD(&wq->list); | 376 | INIT_LIST_HEAD(&wq->list); |
378 | p = create_workqueue_thread(wq, singlethread_cpu); | 377 | p = create_workqueue_thread(wq, singlethread_cpu); |
@@ -381,9 +380,7 @@ struct workqueue_struct *__create_workqueue(const char *name, | |||
381 | else | 380 | else |
382 | wake_up_process(p); | 381 | wake_up_process(p); |
383 | } else { | 382 | } else { |
384 | spin_lock(&workqueue_lock); | ||
385 | list_add(&wq->list, &workqueues); | 383 | list_add(&wq->list, &workqueues); |
386 | spin_unlock(&workqueue_lock); | ||
387 | for_each_online_cpu(cpu) { | 384 | for_each_online_cpu(cpu) { |
388 | p = create_workqueue_thread(wq, cpu); | 385 | p = create_workqueue_thread(wq, cpu); |
389 | if (p) { | 386 | if (p) { |
@@ -393,7 +390,7 @@ struct workqueue_struct *__create_workqueue(const char *name, | |||
393 | destroy = 1; | 390 | destroy = 1; |
394 | } | 391 | } |
395 | } | 392 | } |
396 | unlock_cpu_hotplug(); | 393 | mutex_unlock(&workqueue_mutex); |
397 | 394 | ||
398 | /* | 395 | /* |
399 | * Was there any error during startup? If yes then clean up: | 396 | * Was there any error during startup? If yes then clean up: |
@@ -434,17 +431,15 @@ void destroy_workqueue(struct workqueue_struct *wq) | |||
434 | flush_workqueue(wq); | 431 | flush_workqueue(wq); |
435 | 432 | ||
436 | /* We don't need the distraction of CPUs appearing and vanishing. */ | 433 | /* We don't need the distraction of CPUs appearing and vanishing. */ |
437 | lock_cpu_hotplug(); | 434 | mutex_lock(&workqueue_mutex); |
438 | if (is_single_threaded(wq)) | 435 | if (is_single_threaded(wq)) |
439 | cleanup_workqueue_thread(wq, singlethread_cpu); | 436 | cleanup_workqueue_thread(wq, singlethread_cpu); |
440 | else { | 437 | else { |
441 | for_each_online_cpu(cpu) | 438 | for_each_online_cpu(cpu) |
442 | cleanup_workqueue_thread(wq, cpu); | 439 | cleanup_workqueue_thread(wq, cpu); |
443 | spin_lock(&workqueue_lock); | ||
444 | list_del(&wq->list); | 440 | list_del(&wq->list); |
445 | spin_unlock(&workqueue_lock); | ||
446 | } | 441 | } |
447 | unlock_cpu_hotplug(); | 442 | mutex_unlock(&workqueue_mutex); |
448 | free_percpu(wq->cpu_wq); | 443 | free_percpu(wq->cpu_wq); |
449 | kfree(wq); | 444 | kfree(wq); |
450 | } | 445 | } |
@@ -515,11 +510,13 @@ int schedule_on_each_cpu(void (*func)(void *info), void *info) | |||
515 | if (!works) | 510 | if (!works) |
516 | return -ENOMEM; | 511 | return -ENOMEM; |
517 | 512 | ||
513 | mutex_lock(&workqueue_mutex); | ||
518 | for_each_online_cpu(cpu) { | 514 | for_each_online_cpu(cpu) { |
519 | INIT_WORK(per_cpu_ptr(works, cpu), func, info); | 515 | INIT_WORK(per_cpu_ptr(works, cpu), func, info); |
520 | __queue_work(per_cpu_ptr(keventd_wq->cpu_wq, cpu), | 516 | __queue_work(per_cpu_ptr(keventd_wq->cpu_wq, cpu), |
521 | per_cpu_ptr(works, cpu)); | 517 | per_cpu_ptr(works, cpu)); |
522 | } | 518 | } |
519 | mutex_unlock(&workqueue_mutex); | ||
523 | flush_workqueue(keventd_wq); | 520 | flush_workqueue(keventd_wq); |
524 | free_percpu(works); | 521 | free_percpu(works); |
525 | return 0; | 522 | return 0; |
@@ -635,6 +632,7 @@ static int __devinit workqueue_cpu_callback(struct notifier_block *nfb, | |||
635 | 632 | ||
636 | switch (action) { | 633 | switch (action) { |
637 | case CPU_UP_PREPARE: | 634 | case CPU_UP_PREPARE: |
635 | mutex_lock(&workqueue_mutex); | ||
638 | /* Create a new workqueue thread for it. */ | 636 | /* Create a new workqueue thread for it. */ |
639 | list_for_each_entry(wq, &workqueues, list) { | 637 | list_for_each_entry(wq, &workqueues, list) { |
640 | if (!create_workqueue_thread(wq, hotcpu)) { | 638 | if (!create_workqueue_thread(wq, hotcpu)) { |
@@ -653,6 +651,7 @@ static int __devinit workqueue_cpu_callback(struct notifier_block *nfb, | |||
653 | kthread_bind(cwq->thread, hotcpu); | 651 | kthread_bind(cwq->thread, hotcpu); |
654 | wake_up_process(cwq->thread); | 652 | wake_up_process(cwq->thread); |
655 | } | 653 | } |
654 | mutex_unlock(&workqueue_mutex); | ||
656 | break; | 655 | break; |
657 | 656 | ||
658 | case CPU_UP_CANCELED: | 657 | case CPU_UP_CANCELED: |
@@ -664,6 +663,15 @@ static int __devinit workqueue_cpu_callback(struct notifier_block *nfb, | |||
664 | any_online_cpu(cpu_online_map)); | 663 | any_online_cpu(cpu_online_map)); |
665 | cleanup_workqueue_thread(wq, hotcpu); | 664 | cleanup_workqueue_thread(wq, hotcpu); |
666 | } | 665 | } |
666 | mutex_unlock(&workqueue_mutex); | ||
667 | break; | ||
668 | |||
669 | case CPU_DOWN_PREPARE: | ||
670 | mutex_lock(&workqueue_mutex); | ||
671 | break; | ||
672 | |||
673 | case CPU_DOWN_FAILED: | ||
674 | mutex_unlock(&workqueue_mutex); | ||
667 | break; | 675 | break; |
668 | 676 | ||
669 | case CPU_DEAD: | 677 | case CPU_DEAD: |
@@ -671,6 +679,7 @@ static int __devinit workqueue_cpu_callback(struct notifier_block *nfb, | |||
671 | cleanup_workqueue_thread(wq, hotcpu); | 679 | cleanup_workqueue_thread(wq, hotcpu); |
672 | list_for_each_entry(wq, &workqueues, list) | 680 | list_for_each_entry(wq, &workqueues, list) |
673 | take_over_work(wq, hotcpu); | 681 | take_over_work(wq, hotcpu); |
682 | mutex_unlock(&workqueue_mutex); | ||
674 | break; | 683 | break; |
675 | } | 684 | } |
676 | 685 | ||
@@ -54,6 +54,26 @@ void put_page(struct page *page) | |||
54 | } | 54 | } |
55 | EXPORT_SYMBOL(put_page); | 55 | EXPORT_SYMBOL(put_page); |
56 | 56 | ||
57 | /** | ||
58 | * put_pages_list(): release a list of pages | ||
59 | * | ||
60 | * Release a list of pages which are strung together on page.lru. Currently | ||
61 | * used by read_cache_pages() and related error recovery code. | ||
62 | * | ||
63 | * @pages: list of pages threaded on page->lru | ||
64 | */ | ||
65 | void put_pages_list(struct list_head *pages) | ||
66 | { | ||
67 | while (!list_empty(pages)) { | ||
68 | struct page *victim; | ||
69 | |||
70 | victim = list_entry(pages->prev, struct page, lru); | ||
71 | list_del(&victim->lru); | ||
72 | page_cache_release(victim); | ||
73 | } | ||
74 | } | ||
75 | EXPORT_SYMBOL(put_pages_list); | ||
76 | |||
57 | /* | 77 | /* |
58 | * Writeback is about to end against a page which has been marked for immediate | 78 | * Writeback is about to end against a page which has been marked for immediate |
59 | * reclaim. If it still appears to be reclaimable, move it to the tail of the | 79 | * reclaim. If it still appears to be reclaimable, move it to the tail of the |
diff --git a/net/atm/proc.c b/net/atm/proc.c index 3f95b0886a6a..91fe5f53ff11 100644 --- a/net/atm/proc.c +++ b/net/atm/proc.c | |||
@@ -507,7 +507,7 @@ err_out: | |||
507 | goto out; | 507 | goto out; |
508 | } | 508 | } |
509 | 509 | ||
510 | void __exit atm_proc_exit(void) | 510 | void atm_proc_exit(void) |
511 | { | 511 | { |
512 | atm_proc_dirs_remove(); | 512 | atm_proc_dirs_remove(); |
513 | } | 513 | } |
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index f55ef682ef84..b1211d5342f6 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -386,12 +386,17 @@ void br_features_recompute(struct net_bridge *br) | |||
386 | checksum = 0; | 386 | checksum = 0; |
387 | 387 | ||
388 | if (feature & NETIF_F_GSO) | 388 | if (feature & NETIF_F_GSO) |
389 | feature |= NETIF_F_TSO; | 389 | feature |= NETIF_F_GSO_SOFTWARE; |
390 | feature |= NETIF_F_GSO; | 390 | feature |= NETIF_F_GSO; |
391 | 391 | ||
392 | features &= feature; | 392 | features &= feature; |
393 | } | 393 | } |
394 | 394 | ||
395 | if (!(checksum & NETIF_F_ALL_CSUM)) | ||
396 | features &= ~NETIF_F_SG; | ||
397 | if (!(features & NETIF_F_SG)) | ||
398 | features &= ~NETIF_F_GSO_MASK; | ||
399 | |||
395 | br->dev->features = features | checksum | NETIF_F_LLTX | | 400 | br->dev->features = features | checksum | NETIF_F_LLTX | |
396 | NETIF_F_GSO_ROBUST; | 401 | NETIF_F_GSO_ROBUST; |
397 | } | 402 | } |
diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c index 02693a230dc1..9f950db3b76f 100644 --- a/net/bridge/netfilter/ebt_ulog.c +++ b/net/bridge/netfilter/ebt_ulog.c | |||
@@ -74,6 +74,9 @@ static void ulog_send(unsigned int nlgroup) | |||
74 | if (timer_pending(&ub->timer)) | 74 | if (timer_pending(&ub->timer)) |
75 | del_timer(&ub->timer); | 75 | del_timer(&ub->timer); |
76 | 76 | ||
77 | if (!ub->skb) | ||
78 | return; | ||
79 | |||
77 | /* last nlmsg needs NLMSG_DONE */ | 80 | /* last nlmsg needs NLMSG_DONE */ |
78 | if (ub->qlen > 1) | 81 | if (ub->qlen > 1) |
79 | ub->lastnlh->nlmsg_type = NLMSG_DONE; | 82 | ub->lastnlh->nlmsg_type = NLMSG_DONE; |
diff --git a/net/core/dev.c b/net/core/dev.c index d95e2626d944..d4a1ec3bded5 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -116,6 +116,7 @@ | |||
116 | #include <linux/audit.h> | 116 | #include <linux/audit.h> |
117 | #include <linux/dmaengine.h> | 117 | #include <linux/dmaengine.h> |
118 | #include <linux/err.h> | 118 | #include <linux/err.h> |
119 | #include <linux/ctype.h> | ||
119 | 120 | ||
120 | /* | 121 | /* |
121 | * The list of packet types we will receive (as opposed to discard) | 122 | * The list of packet types we will receive (as opposed to discard) |
@@ -632,14 +633,22 @@ struct net_device * dev_get_by_flags(unsigned short if_flags, unsigned short mas | |||
632 | * @name: name string | 633 | * @name: name string |
633 | * | 634 | * |
634 | * Network device names need to be valid file names to | 635 | * Network device names need to be valid file names to |
635 | * to allow sysfs to work | 636 | * to allow sysfs to work. We also disallow any kind of |
637 | * whitespace. | ||
636 | */ | 638 | */ |
637 | int dev_valid_name(const char *name) | 639 | int dev_valid_name(const char *name) |
638 | { | 640 | { |
639 | return !(*name == '\0' | 641 | if (*name == '\0') |
640 | || !strcmp(name, ".") | 642 | return 0; |
641 | || !strcmp(name, "..") | 643 | if (!strcmp(name, ".") || !strcmp(name, "..")) |
642 | || strchr(name, '/')); | 644 | return 0; |
645 | |||
646 | while (*name) { | ||
647 | if (*name == '/' || isspace(*name)) | ||
648 | return 0; | ||
649 | name++; | ||
650 | } | ||
651 | return 1; | ||
643 | } | 652 | } |
644 | 653 | ||
645 | /** | 654 | /** |
@@ -1619,26 +1628,10 @@ static inline struct net_device *skb_bond(struct sk_buff *skb) | |||
1619 | struct net_device *dev = skb->dev; | 1628 | struct net_device *dev = skb->dev; |
1620 | 1629 | ||
1621 | if (dev->master) { | 1630 | if (dev->master) { |
1622 | /* | 1631 | if (skb_bond_should_drop(skb)) { |
1623 | * On bonding slaves other than the currently active | ||
1624 | * slave, suppress duplicates except for 802.3ad | ||
1625 | * ETH_P_SLOW and alb non-mcast/bcast. | ||
1626 | */ | ||
1627 | if (dev->priv_flags & IFF_SLAVE_INACTIVE) { | ||
1628 | if (dev->master->priv_flags & IFF_MASTER_ALB) { | ||
1629 | if (skb->pkt_type != PACKET_BROADCAST && | ||
1630 | skb->pkt_type != PACKET_MULTICAST) | ||
1631 | goto keep; | ||
1632 | } | ||
1633 | |||
1634 | if (dev->master->priv_flags & IFF_MASTER_8023AD && | ||
1635 | skb->protocol == __constant_htons(ETH_P_SLOW)) | ||
1636 | goto keep; | ||
1637 | |||
1638 | kfree_skb(skb); | 1632 | kfree_skb(skb); |
1639 | return NULL; | 1633 | return NULL; |
1640 | } | 1634 | } |
1641 | keep: | ||
1642 | skb->dev = dev->master; | 1635 | skb->dev = dev->master; |
1643 | } | 1636 | } |
1644 | 1637 | ||
diff --git a/net/core/dst.c b/net/core/dst.c index 470c05bc4cb2..1a5e49da0e77 100644 --- a/net/core/dst.c +++ b/net/core/dst.c | |||
@@ -95,12 +95,11 @@ static void dst_run_gc(unsigned long dummy) | |||
95 | dst_gc_timer_inc = DST_GC_INC; | 95 | dst_gc_timer_inc = DST_GC_INC; |
96 | dst_gc_timer_expires = DST_GC_MIN; | 96 | dst_gc_timer_expires = DST_GC_MIN; |
97 | } | 97 | } |
98 | dst_gc_timer.expires = jiffies + dst_gc_timer_expires; | ||
99 | #if RT_CACHE_DEBUG >= 2 | 98 | #if RT_CACHE_DEBUG >= 2 |
100 | printk("dst_total: %d/%d %ld\n", | 99 | printk("dst_total: %d/%d %ld\n", |
101 | atomic_read(&dst_total), delayed, dst_gc_timer_expires); | 100 | atomic_read(&dst_total), delayed, dst_gc_timer_expires); |
102 | #endif | 101 | #endif |
103 | add_timer(&dst_gc_timer); | 102 | mod_timer(&dst_gc_timer, jiffies + dst_gc_timer_expires); |
104 | 103 | ||
105 | out: | 104 | out: |
106 | spin_unlock(&dst_lock); | 105 | spin_unlock(&dst_lock); |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 67ed14ddabd2..6a7320b39ed0 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -2149,6 +2149,8 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev, | |||
2149 | skb->mac.raw = ((u8 *) iph) - 14 - pkt_dev->nr_labels*sizeof(u32); | 2149 | skb->mac.raw = ((u8 *) iph) - 14 - pkt_dev->nr_labels*sizeof(u32); |
2150 | skb->dev = odev; | 2150 | skb->dev = odev; |
2151 | skb->pkt_type = PACKET_HOST; | 2151 | skb->pkt_type = PACKET_HOST; |
2152 | skb->nh.iph = iph; | ||
2153 | skb->h.uh = udph; | ||
2152 | 2154 | ||
2153 | if (pkt_dev->nfrags <= 0) | 2155 | if (pkt_dev->nfrags <= 0) |
2154 | pgh = (struct pktgen_hdr *)skb_put(skb, datalen); | 2156 | pgh = (struct pktgen_hdr *)skb_put(skb, datalen); |
@@ -2460,6 +2462,8 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, | |||
2460 | skb->protocol = protocol; | 2462 | skb->protocol = protocol; |
2461 | skb->dev = odev; | 2463 | skb->dev = odev; |
2462 | skb->pkt_type = PACKET_HOST; | 2464 | skb->pkt_type = PACKET_HOST; |
2465 | skb->nh.ipv6h = iph; | ||
2466 | skb->h.uh = udph; | ||
2463 | 2467 | ||
2464 | if (pkt_dev->nfrags <= 0) | 2468 | if (pkt_dev->nfrags <= 0) |
2465 | pgh = (struct pktgen_hdr *)skb_put(skb, datalen); | 2469 | pgh = (struct pktgen_hdr *)skb_put(skb, datalen); |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 20e5bb73f147..30cc1ba6ed5c 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -394,6 +394,9 @@ static int do_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | |||
394 | } | 394 | } |
395 | 395 | ||
396 | if (ida[IFLA_ADDRESS - 1]) { | 396 | if (ida[IFLA_ADDRESS - 1]) { |
397 | struct sockaddr *sa; | ||
398 | int len; | ||
399 | |||
397 | if (!dev->set_mac_address) { | 400 | if (!dev->set_mac_address) { |
398 | err = -EOPNOTSUPP; | 401 | err = -EOPNOTSUPP; |
399 | goto out; | 402 | goto out; |
@@ -405,7 +408,17 @@ static int do_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | |||
405 | if (ida[IFLA_ADDRESS - 1]->rta_len != RTA_LENGTH(dev->addr_len)) | 408 | if (ida[IFLA_ADDRESS - 1]->rta_len != RTA_LENGTH(dev->addr_len)) |
406 | goto out; | 409 | goto out; |
407 | 410 | ||
408 | err = dev->set_mac_address(dev, RTA_DATA(ida[IFLA_ADDRESS - 1])); | 411 | len = sizeof(sa_family_t) + dev->addr_len; |
412 | sa = kmalloc(len, GFP_KERNEL); | ||
413 | if (!sa) { | ||
414 | err = -ENOMEM; | ||
415 | goto out; | ||
416 | } | ||
417 | sa->sa_family = dev->type; | ||
418 | memcpy(sa->sa_data, RTA_DATA(ida[IFLA_ADDRESS - 1]), | ||
419 | dev->addr_len); | ||
420 | err = dev->set_mac_address(dev, sa); | ||
421 | kfree(sa); | ||
409 | if (err) | 422 | if (err) |
410 | goto out; | 423 | goto out; |
411 | send_addr_notify = 1; | 424 | send_addr_notify = 1; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 022d8894c11d..c54f3664bce5 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -268,8 +268,10 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, | |||
268 | struct sk_buff *skb; | 268 | struct sk_buff *skb; |
269 | 269 | ||
270 | skb = alloc_skb(length + NET_SKB_PAD, gfp_mask); | 270 | skb = alloc_skb(length + NET_SKB_PAD, gfp_mask); |
271 | if (likely(skb)) | 271 | if (likely(skb)) { |
272 | skb_reserve(skb, NET_SKB_PAD); | 272 | skb_reserve(skb, NET_SKB_PAD); |
273 | skb->dev = dev; | ||
274 | } | ||
273 | return skb; | 275 | return skb; |
274 | } | 276 | } |
275 | 277 | ||
diff --git a/net/core/utils.c b/net/core/utils.c index 4f96f389243d..e31c90e05594 100644 --- a/net/core/utils.c +++ b/net/core/utils.c | |||
@@ -130,12 +130,13 @@ void __init net_random_init(void) | |||
130 | static int net_random_reseed(void) | 130 | static int net_random_reseed(void) |
131 | { | 131 | { |
132 | int i; | 132 | int i; |
133 | unsigned long seed[NR_CPUS]; | 133 | unsigned long seed; |
134 | 134 | ||
135 | get_random_bytes(seed, sizeof(seed)); | ||
136 | for_each_possible_cpu(i) { | 135 | for_each_possible_cpu(i) { |
137 | struct nrnd_state *state = &per_cpu(net_rand_state,i); | 136 | struct nrnd_state *state = &per_cpu(net_rand_state,i); |
138 | __net_srandom(state, seed[i]); | 137 | |
138 | get_random_bytes(&seed, sizeof(seed)); | ||
139 | __net_srandom(state, seed); | ||
139 | } | 140 | } |
140 | return 0; | 141 | return 0; |
141 | } | 142 | } |
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index 72d4d4e04d42..d60358d702d7 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c | |||
@@ -779,33 +779,44 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
779 | return 0; | 779 | return 0; |
780 | } | 780 | } |
781 | 781 | ||
782 | /* Filter out unrelated packets, call ieee80211_rx[_mgt] */ | 782 | /* Filter out unrelated packets, call ieee80211_rx[_mgt] |
783 | int ieee80211_rx_any(struct ieee80211_device *ieee, | 783 | * This function takes over the skb, it should not be used again after calling |
784 | * this function. */ | ||
785 | void ieee80211_rx_any(struct ieee80211_device *ieee, | ||
784 | struct sk_buff *skb, struct ieee80211_rx_stats *stats) | 786 | struct sk_buff *skb, struct ieee80211_rx_stats *stats) |
785 | { | 787 | { |
786 | struct ieee80211_hdr_4addr *hdr; | 788 | struct ieee80211_hdr_4addr *hdr; |
787 | int is_packet_for_us; | 789 | int is_packet_for_us; |
788 | u16 fc; | 790 | u16 fc; |
789 | 791 | ||
790 | if (ieee->iw_mode == IW_MODE_MONITOR) | 792 | if (ieee->iw_mode == IW_MODE_MONITOR) { |
791 | return ieee80211_rx(ieee, skb, stats) ? 0 : -EINVAL; | 793 | if (!ieee80211_rx(ieee, skb, stats)) |
794 | dev_kfree_skb_irq(skb); | ||
795 | return; | ||
796 | } | ||
797 | |||
798 | if (skb->len < sizeof(struct ieee80211_hdr)) | ||
799 | goto drop_free; | ||
792 | 800 | ||
793 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | 801 | hdr = (struct ieee80211_hdr_4addr *)skb->data; |
794 | fc = le16_to_cpu(hdr->frame_ctl); | 802 | fc = le16_to_cpu(hdr->frame_ctl); |
795 | 803 | ||
796 | if ((fc & IEEE80211_FCTL_VERS) != 0) | 804 | if ((fc & IEEE80211_FCTL_VERS) != 0) |
797 | return -EINVAL; | 805 | goto drop_free; |
798 | 806 | ||
799 | switch (fc & IEEE80211_FCTL_FTYPE) { | 807 | switch (fc & IEEE80211_FCTL_FTYPE) { |
800 | case IEEE80211_FTYPE_MGMT: | 808 | case IEEE80211_FTYPE_MGMT: |
809 | if (skb->len < sizeof(struct ieee80211_hdr_3addr)) | ||
810 | goto drop_free; | ||
801 | ieee80211_rx_mgt(ieee, hdr, stats); | 811 | ieee80211_rx_mgt(ieee, hdr, stats); |
802 | return 0; | 812 | dev_kfree_skb_irq(skb); |
813 | return; | ||
803 | case IEEE80211_FTYPE_DATA: | 814 | case IEEE80211_FTYPE_DATA: |
804 | break; | 815 | break; |
805 | case IEEE80211_FTYPE_CTL: | 816 | case IEEE80211_FTYPE_CTL: |
806 | return 0; | 817 | return; |
807 | default: | 818 | default: |
808 | return -EINVAL; | 819 | return; |
809 | } | 820 | } |
810 | 821 | ||
811 | is_packet_for_us = 0; | 822 | is_packet_for_us = 0; |
@@ -849,8 +860,14 @@ int ieee80211_rx_any(struct ieee80211_device *ieee, | |||
849 | } | 860 | } |
850 | 861 | ||
851 | if (is_packet_for_us) | 862 | if (is_packet_for_us) |
852 | return (ieee80211_rx(ieee, skb, stats) ? 0 : -EINVAL); | 863 | if (!ieee80211_rx(ieee, skb, stats)) |
853 | return 0; | 864 | dev_kfree_skb_irq(skb); |
865 | return; | ||
866 | |||
867 | drop_free: | ||
868 | dev_kfree_skb_irq(skb); | ||
869 | ieee->stats.rx_dropped++; | ||
870 | return; | ||
854 | } | 871 | } |
855 | 872 | ||
856 | #define MGMT_FRAME_FIXED_PART_LENGTH 0x24 | 873 | #define MGMT_FRAME_FIXED_PART_LENGTH 0x24 |
@@ -1166,6 +1183,7 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element | |||
1166 | 1183 | ||
1167 | case MFIE_TYPE_ERP_INFO: | 1184 | case MFIE_TYPE_ERP_INFO: |
1168 | network->erp_value = info_element->data[0]; | 1185 | network->erp_value = info_element->data[0]; |
1186 | network->flags |= NETWORK_HAS_ERP_VALUE; | ||
1169 | IEEE80211_DEBUG_MGMT("MFIE_TYPE_ERP_SET: %d\n", | 1187 | IEEE80211_DEBUG_MGMT("MFIE_TYPE_ERP_SET: %d\n", |
1170 | network->erp_value); | 1188 | network->erp_value); |
1171 | break; | 1189 | break; |
@@ -1729,5 +1747,6 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee, | |||
1729 | } | 1747 | } |
1730 | } | 1748 | } |
1731 | 1749 | ||
1750 | EXPORT_SYMBOL_GPL(ieee80211_rx_any); | ||
1732 | EXPORT_SYMBOL(ieee80211_rx_mgt); | 1751 | EXPORT_SYMBOL(ieee80211_rx_mgt); |
1733 | EXPORT_SYMBOL(ieee80211_rx); | 1752 | EXPORT_SYMBOL(ieee80211_rx); |
diff --git a/net/ieee80211/softmac/ieee80211softmac_assoc.c b/net/ieee80211/softmac/ieee80211softmac_assoc.c index 44215ce64d4e..589f6d2c548a 100644 --- a/net/ieee80211/softmac/ieee80211softmac_assoc.c +++ b/net/ieee80211/softmac/ieee80211softmac_assoc.c | |||
@@ -96,7 +96,7 @@ ieee80211softmac_disassoc(struct ieee80211softmac_device *mac) | |||
96 | mac->associated = 0; | 96 | mac->associated = 0; |
97 | mac->associnfo.bssvalid = 0; | 97 | mac->associnfo.bssvalid = 0; |
98 | mac->associnfo.associating = 0; | 98 | mac->associnfo.associating = 0; |
99 | ieee80211softmac_init_txrates(mac); | 99 | ieee80211softmac_init_bss(mac); |
100 | ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL); | 100 | ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL); |
101 | spin_unlock_irqrestore(&mac->lock, flags); | 101 | spin_unlock_irqrestore(&mac->lock, flags); |
102 | } | 102 | } |
@@ -334,11 +334,19 @@ ieee80211softmac_associated(struct ieee80211softmac_device *mac, | |||
334 | struct ieee80211_assoc_response * resp, | 334 | struct ieee80211_assoc_response * resp, |
335 | struct ieee80211softmac_network *net) | 335 | struct ieee80211softmac_network *net) |
336 | { | 336 | { |
337 | u16 cap = le16_to_cpu(resp->capability); | ||
338 | u8 erp_value = net->erp_value; | ||
339 | |||
337 | mac->associnfo.associating = 0; | 340 | mac->associnfo.associating = 0; |
338 | mac->associnfo.supported_rates = net->supported_rates; | 341 | mac->bssinfo.supported_rates = net->supported_rates; |
339 | ieee80211softmac_recalc_txrates(mac); | 342 | ieee80211softmac_recalc_txrates(mac); |
340 | 343 | ||
341 | mac->associated = 1; | 344 | mac->associated = 1; |
345 | |||
346 | mac->associnfo.short_preamble_available = | ||
347 | (cap & WLAN_CAPABILITY_SHORT_PREAMBLE) != 0; | ||
348 | ieee80211softmac_process_erp(mac, erp_value); | ||
349 | |||
342 | if (mac->set_bssid_filter) | 350 | if (mac->set_bssid_filter) |
343 | mac->set_bssid_filter(mac->dev, net->bssid); | 351 | mac->set_bssid_filter(mac->dev, net->bssid); |
344 | memcpy(mac->ieee->bssid, net->bssid, ETH_ALEN); | 352 | memcpy(mac->ieee->bssid, net->bssid, ETH_ALEN); |
@@ -351,9 +359,9 @@ ieee80211softmac_associated(struct ieee80211softmac_device *mac, | |||
351 | int | 359 | int |
352 | ieee80211softmac_handle_assoc_response(struct net_device * dev, | 360 | ieee80211softmac_handle_assoc_response(struct net_device * dev, |
353 | struct ieee80211_assoc_response * resp, | 361 | struct ieee80211_assoc_response * resp, |
354 | struct ieee80211_network * _ieee80211_network_do_not_use) | 362 | struct ieee80211_network * _ieee80211_network) |
355 | { | 363 | { |
356 | /* NOTE: the network parameter has to be ignored by | 364 | /* NOTE: the network parameter has to be mostly ignored by |
357 | * this code because it is the ieee80211's pointer | 365 | * this code because it is the ieee80211's pointer |
358 | * to the struct, not ours (we made a copy) | 366 | * to the struct, not ours (we made a copy) |
359 | */ | 367 | */ |
@@ -385,6 +393,11 @@ ieee80211softmac_handle_assoc_response(struct net_device * dev, | |||
385 | /* now that we know it was for us, we can cancel the timeout */ | 393 | /* now that we know it was for us, we can cancel the timeout */ |
386 | cancel_delayed_work(&mac->associnfo.timeout); | 394 | cancel_delayed_work(&mac->associnfo.timeout); |
387 | 395 | ||
396 | /* if the association response included an ERP IE, update our saved | ||
397 | * copy */ | ||
398 | if (_ieee80211_network->flags & NETWORK_HAS_ERP_VALUE) | ||
399 | network->erp_value = _ieee80211_network->erp_value; | ||
400 | |||
388 | switch (status) { | 401 | switch (status) { |
389 | case 0: | 402 | case 0: |
390 | dprintk(KERN_INFO PFX "associated!\n"); | 403 | dprintk(KERN_INFO PFX "associated!\n"); |
diff --git a/net/ieee80211/softmac/ieee80211softmac_io.c b/net/ieee80211/softmac/ieee80211softmac_io.c index 6ae5a1dc7956..82bfddbf33a2 100644 --- a/net/ieee80211/softmac/ieee80211softmac_io.c +++ b/net/ieee80211/softmac/ieee80211softmac_io.c | |||
@@ -467,3 +467,17 @@ ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac, | |||
467 | kfree(pkt); | 467 | kfree(pkt); |
468 | return 0; | 468 | return 0; |
469 | } | 469 | } |
470 | |||
471 | /* Beacon handling */ | ||
472 | int ieee80211softmac_handle_beacon(struct net_device *dev, | ||
473 | struct ieee80211_beacon *beacon, | ||
474 | struct ieee80211_network *network) | ||
475 | { | ||
476 | struct ieee80211softmac_device *mac = ieee80211_priv(dev); | ||
477 | |||
478 | if (mac->associated && memcmp(network->bssid, mac->associnfo.bssid, ETH_ALEN) == 0) | ||
479 | ieee80211softmac_process_erp(mac, network->erp_value); | ||
480 | |||
481 | return 0; | ||
482 | } | ||
483 | |||
diff --git a/net/ieee80211/softmac/ieee80211softmac_module.c b/net/ieee80211/softmac/ieee80211softmac_module.c index 4b2e57d12418..addea1cf73ae 100644 --- a/net/ieee80211/softmac/ieee80211softmac_module.c +++ b/net/ieee80211/softmac/ieee80211softmac_module.c | |||
@@ -44,6 +44,7 @@ struct net_device *alloc_ieee80211softmac(int sizeof_priv) | |||
44 | softmac->ieee->handle_assoc_response = ieee80211softmac_handle_assoc_response; | 44 | softmac->ieee->handle_assoc_response = ieee80211softmac_handle_assoc_response; |
45 | softmac->ieee->handle_reassoc_request = ieee80211softmac_handle_reassoc_req; | 45 | softmac->ieee->handle_reassoc_request = ieee80211softmac_handle_reassoc_req; |
46 | softmac->ieee->handle_disassoc = ieee80211softmac_handle_disassoc; | 46 | softmac->ieee->handle_disassoc = ieee80211softmac_handle_disassoc; |
47 | softmac->ieee->handle_beacon = ieee80211softmac_handle_beacon; | ||
47 | softmac->scaninfo = NULL; | 48 | softmac->scaninfo = NULL; |
48 | 49 | ||
49 | softmac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT; | 50 | softmac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT; |
@@ -178,21 +179,14 @@ int ieee80211softmac_ratesinfo_rate_supported(struct ieee80211softmac_ratesinfo | |||
178 | return 0; | 179 | return 0; |
179 | } | 180 | } |
180 | 181 | ||
181 | /* Finds the highest rate which is: | 182 | u8 ieee80211softmac_highest_supported_rate(struct ieee80211softmac_device *mac, |
182 | * 1. Present in ri (optionally a basic rate) | ||
183 | * 2. Supported by the device | ||
184 | * 3. Less than or equal to the user-defined rate | ||
185 | */ | ||
186 | static u8 highest_supported_rate(struct ieee80211softmac_device *mac, | ||
187 | struct ieee80211softmac_ratesinfo *ri, int basic_only) | 183 | struct ieee80211softmac_ratesinfo *ri, int basic_only) |
188 | { | 184 | { |
189 | u8 user_rate = mac->txrates.user_rate; | 185 | u8 user_rate = mac->txrates.user_rate; |
190 | int i; | 186 | int i; |
191 | 187 | ||
192 | if (ri->count == 0) { | 188 | if (ri->count == 0) |
193 | dprintk(KERN_ERR PFX "empty ratesinfo?\n"); | ||
194 | return IEEE80211_CCK_RATE_1MB; | 189 | return IEEE80211_CCK_RATE_1MB; |
195 | } | ||
196 | 190 | ||
197 | for (i = ri->count - 1; i >= 0; i--) { | 191 | for (i = ri->count - 1; i >= 0; i--) { |
198 | u8 rate = ri->rates[i]; | 192 | u8 rate = ri->rates[i]; |
@@ -208,36 +202,61 @@ static u8 highest_supported_rate(struct ieee80211softmac_device *mac, | |||
208 | /* If we haven't found a suitable rate by now, just trust the user */ | 202 | /* If we haven't found a suitable rate by now, just trust the user */ |
209 | return user_rate; | 203 | return user_rate; |
210 | } | 204 | } |
205 | EXPORT_SYMBOL_GPL(ieee80211softmac_highest_supported_rate); | ||
206 | |||
207 | void ieee80211softmac_process_erp(struct ieee80211softmac_device *mac, | ||
208 | u8 erp_value) | ||
209 | { | ||
210 | int use_protection; | ||
211 | int short_preamble; | ||
212 | u32 changes = 0; | ||
213 | |||
214 | /* Barker preamble mode */ | ||
215 | short_preamble = ((erp_value & WLAN_ERP_BARKER_PREAMBLE) == 0 | ||
216 | && mac->associnfo.short_preamble_available) ? 1 : 0; | ||
217 | |||
218 | /* Protection needed? */ | ||
219 | use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0; | ||
220 | |||
221 | if (mac->bssinfo.short_preamble != short_preamble) { | ||
222 | changes |= IEEE80211SOFTMAC_BSSINFOCHG_SHORT_PREAMBLE; | ||
223 | mac->bssinfo.short_preamble = short_preamble; | ||
224 | } | ||
225 | |||
226 | if (mac->bssinfo.use_protection != use_protection) { | ||
227 | changes |= IEEE80211SOFTMAC_BSSINFOCHG_PROTECTION; | ||
228 | mac->bssinfo.use_protection = use_protection; | ||
229 | } | ||
230 | |||
231 | if (mac->bssinfo_change && changes) | ||
232 | mac->bssinfo_change(mac->dev, changes); | ||
233 | } | ||
211 | 234 | ||
212 | void ieee80211softmac_recalc_txrates(struct ieee80211softmac_device *mac) | 235 | void ieee80211softmac_recalc_txrates(struct ieee80211softmac_device *mac) |
213 | { | 236 | { |
214 | struct ieee80211softmac_txrates *txrates = &mac->txrates; | 237 | struct ieee80211softmac_txrates *txrates = &mac->txrates; |
215 | struct ieee80211softmac_txrates oldrates; | ||
216 | u32 change = 0; | 238 | u32 change = 0; |
217 | 239 | ||
218 | if (mac->txrates_change) | ||
219 | oldrates = mac->txrates; | ||
220 | |||
221 | change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT; | 240 | change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT; |
222 | txrates->default_rate = highest_supported_rate(mac, &mac->associnfo.supported_rates, 0); | 241 | txrates->default_rate = ieee80211softmac_highest_supported_rate(mac, &mac->bssinfo.supported_rates, 0); |
223 | 242 | ||
224 | change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK; | 243 | change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK; |
225 | txrates->default_fallback = lower_rate(mac, txrates->default_rate); | 244 | txrates->default_fallback = lower_rate(mac, txrates->default_rate); |
226 | 245 | ||
227 | change |= IEEE80211SOFTMAC_TXRATECHG_MCAST; | 246 | change |= IEEE80211SOFTMAC_TXRATECHG_MCAST; |
228 | txrates->mcast_rate = highest_supported_rate(mac, &mac->associnfo.supported_rates, 1); | 247 | txrates->mcast_rate = ieee80211softmac_highest_supported_rate(mac, &mac->bssinfo.supported_rates, 1); |
229 | 248 | ||
230 | if (mac->txrates_change) | 249 | if (mac->txrates_change) |
231 | mac->txrates_change(mac->dev, change, &oldrates); | 250 | mac->txrates_change(mac->dev, change); |
232 | 251 | ||
233 | } | 252 | } |
234 | 253 | ||
235 | void ieee80211softmac_init_txrates(struct ieee80211softmac_device *mac) | 254 | void ieee80211softmac_init_bss(struct ieee80211softmac_device *mac) |
236 | { | 255 | { |
237 | struct ieee80211_device *ieee = mac->ieee; | 256 | struct ieee80211_device *ieee = mac->ieee; |
238 | u32 change = 0; | 257 | u32 change = 0; |
239 | struct ieee80211softmac_txrates *txrates = &mac->txrates; | 258 | struct ieee80211softmac_txrates *txrates = &mac->txrates; |
240 | struct ieee80211softmac_txrates oldrates; | 259 | struct ieee80211softmac_bss_info *bssinfo = &mac->bssinfo; |
241 | 260 | ||
242 | /* TODO: We need some kind of state machine to lower the default rates | 261 | /* TODO: We need some kind of state machine to lower the default rates |
243 | * if we loose too many packets. | 262 | * if we loose too many packets. |
@@ -245,8 +264,6 @@ void ieee80211softmac_init_txrates(struct ieee80211softmac_device *mac) | |||
245 | /* Change the default txrate to the highest possible value. | 264 | /* Change the default txrate to the highest possible value. |
246 | * The txrate machine will lower it, if it is too high. | 265 | * The txrate machine will lower it, if it is too high. |
247 | */ | 266 | */ |
248 | if (mac->txrates_change) | ||
249 | oldrates = mac->txrates; | ||
250 | /* FIXME: We don't correctly handle backing down to lower | 267 | /* FIXME: We don't correctly handle backing down to lower |
251 | rates, so 801.11g devices start off at 11M for now. People | 268 | rates, so 801.11g devices start off at 11M for now. People |
252 | can manually change it if they really need to, but 11M is | 269 | can manually change it if they really need to, but 11M is |
@@ -272,7 +289,23 @@ void ieee80211softmac_init_txrates(struct ieee80211softmac_device *mac) | |||
272 | change |= IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST; | 289 | change |= IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST; |
273 | 290 | ||
274 | if (mac->txrates_change) | 291 | if (mac->txrates_change) |
275 | mac->txrates_change(mac->dev, change, &oldrates); | 292 | mac->txrates_change(mac->dev, change); |
293 | |||
294 | change = 0; | ||
295 | |||
296 | bssinfo->supported_rates.count = 0; | ||
297 | memset(bssinfo->supported_rates.rates, 0, | ||
298 | sizeof(bssinfo->supported_rates.rates)); | ||
299 | change |= IEEE80211SOFTMAC_BSSINFOCHG_RATES; | ||
300 | |||
301 | bssinfo->short_preamble = 0; | ||
302 | change |= IEEE80211SOFTMAC_BSSINFOCHG_SHORT_PREAMBLE; | ||
303 | |||
304 | bssinfo->use_protection = 0; | ||
305 | change |= IEEE80211SOFTMAC_BSSINFOCHG_PROTECTION; | ||
306 | |||
307 | if (mac->bssinfo_change) | ||
308 | mac->bssinfo_change(mac->dev, change); | ||
276 | 309 | ||
277 | mac->running = 1; | 310 | mac->running = 1; |
278 | } | 311 | } |
@@ -282,7 +315,7 @@ void ieee80211softmac_start(struct net_device *dev) | |||
282 | struct ieee80211softmac_device *mac = ieee80211_priv(dev); | 315 | struct ieee80211softmac_device *mac = ieee80211_priv(dev); |
283 | 316 | ||
284 | ieee80211softmac_start_check_rates(mac); | 317 | ieee80211softmac_start_check_rates(mac); |
285 | ieee80211softmac_init_txrates(mac); | 318 | ieee80211softmac_init_bss(mac); |
286 | } | 319 | } |
287 | EXPORT_SYMBOL_GPL(ieee80211softmac_start); | 320 | EXPORT_SYMBOL_GPL(ieee80211softmac_start); |
288 | 321 | ||
@@ -335,7 +368,6 @@ u8 ieee80211softmac_lower_rate_delta(struct ieee80211softmac_device *mac, u8 rat | |||
335 | static void ieee80211softmac_add_txrates_badness(struct ieee80211softmac_device *mac, | 368 | static void ieee80211softmac_add_txrates_badness(struct ieee80211softmac_device *mac, |
336 | int amount) | 369 | int amount) |
337 | { | 370 | { |
338 | struct ieee80211softmac_txrates oldrates; | ||
339 | u8 default_rate = mac->txrates.default_rate; | 371 | u8 default_rate = mac->txrates.default_rate; |
340 | u8 default_fallback = mac->txrates.default_fallback; | 372 | u8 default_fallback = mac->txrates.default_fallback; |
341 | u32 changes = 0; | 373 | u32 changes = 0; |
@@ -348,8 +380,6 @@ printk("badness %d\n", mac->txrate_badness); | |||
348 | mac->txrate_badness += amount; | 380 | mac->txrate_badness += amount; |
349 | if (mac->txrate_badness <= -1000) { | 381 | if (mac->txrate_badness <= -1000) { |
350 | /* Very small badness. Try a faster bitrate. */ | 382 | /* Very small badness. Try a faster bitrate. */ |
351 | if (mac->txrates_change) | ||
352 | memcpy(&oldrates, &mac->txrates, sizeof(oldrates)); | ||
353 | default_rate = raise_rate(mac, default_rate); | 383 | default_rate = raise_rate(mac, default_rate); |
354 | changes |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT; | 384 | changes |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT; |
355 | default_fallback = get_fallback_rate(mac, default_rate); | 385 | default_fallback = get_fallback_rate(mac, default_rate); |
@@ -358,8 +388,6 @@ printk("badness %d\n", mac->txrate_badness); | |||
358 | printk("Bitrate raised to %u\n", default_rate); | 388 | printk("Bitrate raised to %u\n", default_rate); |
359 | } else if (mac->txrate_badness >= 10000) { | 389 | } else if (mac->txrate_badness >= 10000) { |
360 | /* Very high badness. Try a slower bitrate. */ | 390 | /* Very high badness. Try a slower bitrate. */ |
361 | if (mac->txrates_change) | ||
362 | memcpy(&oldrates, &mac->txrates, sizeof(oldrates)); | ||
363 | default_rate = lower_rate(mac, default_rate); | 391 | default_rate = lower_rate(mac, default_rate); |
364 | changes |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT; | 392 | changes |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT; |
365 | default_fallback = get_fallback_rate(mac, default_rate); | 393 | default_fallback = get_fallback_rate(mac, default_rate); |
@@ -372,7 +400,7 @@ printk("Bitrate lowered to %u\n", default_rate); | |||
372 | mac->txrates.default_fallback = default_fallback; | 400 | mac->txrates.default_fallback = default_fallback; |
373 | 401 | ||
374 | if (changes && mac->txrates_change) | 402 | if (changes && mac->txrates_change) |
375 | mac->txrates_change(mac->dev, changes, &oldrates); | 403 | mac->txrates_change(mac->dev, changes); |
376 | } | 404 | } |
377 | 405 | ||
378 | void ieee80211softmac_fragment_lost(struct net_device *dev, | 406 | void ieee80211softmac_fragment_lost(struct net_device *dev, |
@@ -416,7 +444,11 @@ ieee80211softmac_create_network(struct ieee80211softmac_device *mac, | |||
416 | memcpy(&softnet->supported_rates.rates[softnet->supported_rates.count], net->rates_ex, net->rates_ex_len); | 444 | memcpy(&softnet->supported_rates.rates[softnet->supported_rates.count], net->rates_ex, net->rates_ex_len); |
417 | softnet->supported_rates.count += net->rates_ex_len; | 445 | softnet->supported_rates.count += net->rates_ex_len; |
418 | sort(softnet->supported_rates.rates, softnet->supported_rates.count, sizeof(softnet->supported_rates.rates[0]), rate_cmp, NULL); | 446 | sort(softnet->supported_rates.rates, softnet->supported_rates.count, sizeof(softnet->supported_rates.rates[0]), rate_cmp, NULL); |
419 | 447 | ||
448 | /* we save the ERP value because it is needed at association time, and | ||
449 | * many AP's do not include an ERP IE in the association response. */ | ||
450 | softnet->erp_value = net->erp_value; | ||
451 | |||
420 | softnet->capabilities = net->capability; | 452 | softnet->capabilities = net->capability; |
421 | return softnet; | 453 | return softnet; |
422 | } | 454 | } |
diff --git a/net/ieee80211/softmac/ieee80211softmac_priv.h b/net/ieee80211/softmac/ieee80211softmac_priv.h index fa1f8e3acfc0..0642e090b8a7 100644 --- a/net/ieee80211/softmac/ieee80211softmac_priv.h +++ b/net/ieee80211/softmac/ieee80211softmac_priv.h | |||
@@ -116,9 +116,11 @@ ieee80211softmac_get_network_by_essid(struct ieee80211softmac_device *mac, | |||
116 | struct ieee80211softmac_essid *essid); | 116 | struct ieee80211softmac_essid *essid); |
117 | 117 | ||
118 | /* Rates related */ | 118 | /* Rates related */ |
119 | void ieee80211softmac_process_erp(struct ieee80211softmac_device *mac, | ||
120 | u8 erp_value); | ||
119 | int ieee80211softmac_ratesinfo_rate_supported(struct ieee80211softmac_ratesinfo *ri, u8 rate); | 121 | int ieee80211softmac_ratesinfo_rate_supported(struct ieee80211softmac_ratesinfo *ri, u8 rate); |
120 | u8 ieee80211softmac_lower_rate_delta(struct ieee80211softmac_device *mac, u8 rate, int delta); | 122 | u8 ieee80211softmac_lower_rate_delta(struct ieee80211softmac_device *mac, u8 rate, int delta); |
121 | void ieee80211softmac_init_txrates(struct ieee80211softmac_device *mac); | 123 | void ieee80211softmac_init_bss(struct ieee80211softmac_device *mac); |
122 | void ieee80211softmac_recalc_txrates(struct ieee80211softmac_device *mac); | 124 | void ieee80211softmac_recalc_txrates(struct ieee80211softmac_device *mac); |
123 | static inline u8 lower_rate(struct ieee80211softmac_device *mac, u8 rate) { | 125 | static inline u8 lower_rate(struct ieee80211softmac_device *mac, u8 rate) { |
124 | return ieee80211softmac_lower_rate_delta(mac, rate, 1); | 126 | return ieee80211softmac_lower_rate_delta(mac, rate, 1); |
@@ -133,6 +135,9 @@ static inline u8 get_fallback_rate(struct ieee80211softmac_device *mac, u8 rate) | |||
133 | /*** prototypes from _io.c */ | 135 | /*** prototypes from _io.c */ |
134 | int ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac, | 136 | int ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac, |
135 | void* ptrarg, u32 type, u32 arg); | 137 | void* ptrarg, u32 type, u32 arg); |
138 | int ieee80211softmac_handle_beacon(struct net_device *dev, | ||
139 | struct ieee80211_beacon *beacon, | ||
140 | struct ieee80211_network *network); | ||
136 | 141 | ||
137 | /*** prototypes from _auth.c */ | 142 | /*** prototypes from _auth.c */ |
138 | /* do these have to go into the public header? */ | 143 | /* do these have to go into the public header? */ |
@@ -189,6 +194,7 @@ struct ieee80211softmac_network { | |||
189 | authenticated:1, | 194 | authenticated:1, |
190 | auth_desynced_once:1; | 195 | auth_desynced_once:1; |
191 | 196 | ||
197 | u8 erp_value; /* Saved ERP value */ | ||
192 | u16 capabilities; /* Capabilities bitfield */ | 198 | u16 capabilities; /* Capabilities bitfield */ |
193 | u8 challenge_len; /* Auth Challenge length */ | 199 | u8 challenge_len; /* Auth Challenge length */ |
194 | char *challenge; /* Challenge Text */ | 200 | char *challenge; /* Challenge Text */ |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 9be53a8e72c3..51738000f3dc 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -159,7 +159,7 @@ void free_fib_info(struct fib_info *fi) | |||
159 | 159 | ||
160 | void fib_release_info(struct fib_info *fi) | 160 | void fib_release_info(struct fib_info *fi) |
161 | { | 161 | { |
162 | write_lock(&fib_info_lock); | 162 | write_lock_bh(&fib_info_lock); |
163 | if (fi && --fi->fib_treeref == 0) { | 163 | if (fi && --fi->fib_treeref == 0) { |
164 | hlist_del(&fi->fib_hash); | 164 | hlist_del(&fi->fib_hash); |
165 | if (fi->fib_prefsrc) | 165 | if (fi->fib_prefsrc) |
@@ -172,7 +172,7 @@ void fib_release_info(struct fib_info *fi) | |||
172 | fi->fib_dead = 1; | 172 | fi->fib_dead = 1; |
173 | fib_info_put(fi); | 173 | fib_info_put(fi); |
174 | } | 174 | } |
175 | write_unlock(&fib_info_lock); | 175 | write_unlock_bh(&fib_info_lock); |
176 | } | 176 | } |
177 | 177 | ||
178 | static __inline__ int nh_comp(const struct fib_info *fi, const struct fib_info *ofi) | 178 | static __inline__ int nh_comp(const struct fib_info *fi, const struct fib_info *ofi) |
@@ -598,7 +598,7 @@ static void fib_hash_move(struct hlist_head *new_info_hash, | |||
598 | unsigned int old_size = fib_hash_size; | 598 | unsigned int old_size = fib_hash_size; |
599 | unsigned int i, bytes; | 599 | unsigned int i, bytes; |
600 | 600 | ||
601 | write_lock(&fib_info_lock); | 601 | write_lock_bh(&fib_info_lock); |
602 | old_info_hash = fib_info_hash; | 602 | old_info_hash = fib_info_hash; |
603 | old_laddrhash = fib_info_laddrhash; | 603 | old_laddrhash = fib_info_laddrhash; |
604 | fib_hash_size = new_size; | 604 | fib_hash_size = new_size; |
@@ -639,7 +639,7 @@ static void fib_hash_move(struct hlist_head *new_info_hash, | |||
639 | } | 639 | } |
640 | fib_info_laddrhash = new_laddrhash; | 640 | fib_info_laddrhash = new_laddrhash; |
641 | 641 | ||
642 | write_unlock(&fib_info_lock); | 642 | write_unlock_bh(&fib_info_lock); |
643 | 643 | ||
644 | bytes = old_size * sizeof(struct hlist_head *); | 644 | bytes = old_size * sizeof(struct hlist_head *); |
645 | fib_hash_free(old_info_hash, bytes); | 645 | fib_hash_free(old_info_hash, bytes); |
@@ -820,7 +820,7 @@ link_it: | |||
820 | 820 | ||
821 | fi->fib_treeref++; | 821 | fi->fib_treeref++; |
822 | atomic_inc(&fi->fib_clntref); | 822 | atomic_inc(&fi->fib_clntref); |
823 | write_lock(&fib_info_lock); | 823 | write_lock_bh(&fib_info_lock); |
824 | hlist_add_head(&fi->fib_hash, | 824 | hlist_add_head(&fi->fib_hash, |
825 | &fib_info_hash[fib_info_hashfn(fi)]); | 825 | &fib_info_hash[fib_info_hashfn(fi)]); |
826 | if (fi->fib_prefsrc) { | 826 | if (fi->fib_prefsrc) { |
@@ -839,7 +839,7 @@ link_it: | |||
839 | head = &fib_info_devhash[hash]; | 839 | head = &fib_info_devhash[hash]; |
840 | hlist_add_head(&nh->nh_hash, head); | 840 | hlist_add_head(&nh->nh_hash, head); |
841 | } endfor_nexthops(fi) | 841 | } endfor_nexthops(fi) |
842 | write_unlock(&fib_info_lock); | 842 | write_unlock_bh(&fib_info_lock); |
843 | return fi; | 843 | return fi; |
844 | 844 | ||
845 | err_inval: | 845 | err_inval: |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 9f4b752f5a33..8e8117c19e4d 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -1793,29 +1793,35 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr) | |||
1793 | struct in_device *in_dev; | 1793 | struct in_device *in_dev; |
1794 | u32 group = imr->imr_multiaddr.s_addr; | 1794 | u32 group = imr->imr_multiaddr.s_addr; |
1795 | u32 ifindex; | 1795 | u32 ifindex; |
1796 | int ret = -EADDRNOTAVAIL; | ||
1796 | 1797 | ||
1797 | rtnl_lock(); | 1798 | rtnl_lock(); |
1798 | in_dev = ip_mc_find_dev(imr); | 1799 | in_dev = ip_mc_find_dev(imr); |
1799 | if (!in_dev) { | ||
1800 | rtnl_unlock(); | ||
1801 | return -ENODEV; | ||
1802 | } | ||
1803 | ifindex = imr->imr_ifindex; | 1800 | ifindex = imr->imr_ifindex; |
1804 | for (imlp = &inet->mc_list; (iml = *imlp) != NULL; imlp = &iml->next) { | 1801 | for (imlp = &inet->mc_list; (iml = *imlp) != NULL; imlp = &iml->next) { |
1805 | if (iml->multi.imr_multiaddr.s_addr == group && | 1802 | if (iml->multi.imr_multiaddr.s_addr != group) |
1806 | iml->multi.imr_ifindex == ifindex) { | 1803 | continue; |
1807 | (void) ip_mc_leave_src(sk, iml, in_dev); | 1804 | if (ifindex) { |
1805 | if (iml->multi.imr_ifindex != ifindex) | ||
1806 | continue; | ||
1807 | } else if (imr->imr_address.s_addr && imr->imr_address.s_addr != | ||
1808 | iml->multi.imr_address.s_addr) | ||
1809 | continue; | ||
1810 | |||
1811 | (void) ip_mc_leave_src(sk, iml, in_dev); | ||
1808 | 1812 | ||
1809 | *imlp = iml->next; | 1813 | *imlp = iml->next; |
1810 | 1814 | ||
1815 | if (in_dev) | ||
1811 | ip_mc_dec_group(in_dev, group); | 1816 | ip_mc_dec_group(in_dev, group); |
1812 | rtnl_unlock(); | 1817 | rtnl_unlock(); |
1813 | sock_kfree_s(sk, iml, sizeof(*iml)); | 1818 | sock_kfree_s(sk, iml, sizeof(*iml)); |
1814 | return 0; | 1819 | return 0; |
1815 | } | ||
1816 | } | 1820 | } |
1821 | if (!in_dev) | ||
1822 | ret = -ENODEV; | ||
1817 | rtnl_unlock(); | 1823 | rtnl_unlock(); |
1818 | return -EADDRNOTAVAIL; | 1824 | return ret; |
1819 | } | 1825 | } |
1820 | 1826 | ||
1821 | int ip_mc_source(int add, int omode, struct sock *sk, struct | 1827 | int ip_mc_source(int add, int omode, struct sock *sk, struct |
@@ -2199,13 +2205,13 @@ void ip_mc_drop_socket(struct sock *sk) | |||
2199 | struct in_device *in_dev; | 2205 | struct in_device *in_dev; |
2200 | inet->mc_list = iml->next; | 2206 | inet->mc_list = iml->next; |
2201 | 2207 | ||
2202 | if ((in_dev = inetdev_by_index(iml->multi.imr_ifindex)) != NULL) { | 2208 | in_dev = inetdev_by_index(iml->multi.imr_ifindex); |
2203 | (void) ip_mc_leave_src(sk, iml, in_dev); | 2209 | (void) ip_mc_leave_src(sk, iml, in_dev); |
2210 | if (in_dev != NULL) { | ||
2204 | ip_mc_dec_group(in_dev, iml->multi.imr_multiaddr.s_addr); | 2211 | ip_mc_dec_group(in_dev, iml->multi.imr_multiaddr.s_addr); |
2205 | in_dev_put(in_dev); | 2212 | in_dev_put(in_dev); |
2206 | } | 2213 | } |
2207 | sock_kfree_s(sk, iml, sizeof(*iml)); | 2214 | sock_kfree_s(sk, iml, sizeof(*iml)); |
2208 | |||
2209 | } | 2215 | } |
2210 | rtnl_unlock(); | 2216 | rtnl_unlock(); |
2211 | } | 2217 | } |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 9bf307a29783..4c20f5546893 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -947,7 +947,7 @@ alloc_new_skb: | |||
947 | skb_prev->csum = csum_sub(skb_prev->csum, | 947 | skb_prev->csum = csum_sub(skb_prev->csum, |
948 | skb->csum); | 948 | skb->csum); |
949 | data += fraggap; | 949 | data += fraggap; |
950 | skb_trim(skb_prev, maxfraglen); | 950 | pskb_trim_unique(skb_prev, maxfraglen); |
951 | } | 951 | } |
952 | 952 | ||
953 | copy = datalen - transhdrlen - fraggap; | 953 | copy = datalen - transhdrlen - fraggap; |
@@ -1142,7 +1142,7 @@ ssize_t ip_append_page(struct sock *sk, struct page *page, | |||
1142 | data, fraggap, 0); | 1142 | data, fraggap, 0); |
1143 | skb_prev->csum = csum_sub(skb_prev->csum, | 1143 | skb_prev->csum = csum_sub(skb_prev->csum, |
1144 | skb->csum); | 1144 | skb->csum); |
1145 | skb_trim(skb_prev, maxfraglen); | 1145 | pskb_trim_unique(skb_prev, maxfraglen); |
1146 | } | 1146 | } |
1147 | 1147 | ||
1148 | /* | 1148 | /* |
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 80c73ca90116..df4854cf598b 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -1170,21 +1170,34 @@ static int __init arp_tables_init(void) | |||
1170 | { | 1170 | { |
1171 | int ret; | 1171 | int ret; |
1172 | 1172 | ||
1173 | xt_proto_init(NF_ARP); | 1173 | ret = xt_proto_init(NF_ARP); |
1174 | if (ret < 0) | ||
1175 | goto err1; | ||
1174 | 1176 | ||
1175 | /* Noone else will be downing sem now, so we won't sleep */ | 1177 | /* Noone else will be downing sem now, so we won't sleep */ |
1176 | xt_register_target(&arpt_standard_target); | 1178 | ret = xt_register_target(&arpt_standard_target); |
1177 | xt_register_target(&arpt_error_target); | 1179 | if (ret < 0) |
1180 | goto err2; | ||
1181 | ret = xt_register_target(&arpt_error_target); | ||
1182 | if (ret < 0) | ||
1183 | goto err3; | ||
1178 | 1184 | ||
1179 | /* Register setsockopt */ | 1185 | /* Register setsockopt */ |
1180 | ret = nf_register_sockopt(&arpt_sockopts); | 1186 | ret = nf_register_sockopt(&arpt_sockopts); |
1181 | if (ret < 0) { | 1187 | if (ret < 0) |
1182 | duprintf("Unable to register sockopts.\n"); | 1188 | goto err4; |
1183 | return ret; | ||
1184 | } | ||
1185 | 1189 | ||
1186 | printk("arp_tables: (C) 2002 David S. Miller\n"); | 1190 | printk("arp_tables: (C) 2002 David S. Miller\n"); |
1187 | return 0; | 1191 | return 0; |
1192 | |||
1193 | err4: | ||
1194 | xt_unregister_target(&arpt_error_target); | ||
1195 | err3: | ||
1196 | xt_unregister_target(&arpt_standard_target); | ||
1197 | err2: | ||
1198 | xt_proto_fini(NF_ARP); | ||
1199 | err1: | ||
1200 | return ret; | ||
1188 | } | 1201 | } |
1189 | 1202 | ||
1190 | static void __exit arp_tables_fini(void) | 1203 | static void __exit arp_tables_fini(void) |
diff --git a/net/ipv4/netfilter/ip_conntrack_netlink.c b/net/ipv4/netfilter/ip_conntrack_netlink.c index 33891bb1fde4..0d4cc92391fa 100644 --- a/net/ipv4/netfilter/ip_conntrack_netlink.c +++ b/net/ipv4/netfilter/ip_conntrack_netlink.c | |||
@@ -415,21 +415,18 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) | |||
415 | cb->args[0], *id); | 415 | cb->args[0], *id); |
416 | 416 | ||
417 | read_lock_bh(&ip_conntrack_lock); | 417 | read_lock_bh(&ip_conntrack_lock); |
418 | last = (struct ip_conntrack *)cb->args[1]; | ||
418 | for (; cb->args[0] < ip_conntrack_htable_size; cb->args[0]++) { | 419 | for (; cb->args[0] < ip_conntrack_htable_size; cb->args[0]++) { |
419 | restart: | 420 | restart: |
420 | last = (struct ip_conntrack *)cb->args[1]; | ||
421 | list_for_each_prev(i, &ip_conntrack_hash[cb->args[0]]) { | 421 | list_for_each_prev(i, &ip_conntrack_hash[cb->args[0]]) { |
422 | h = (struct ip_conntrack_tuple_hash *) i; | 422 | h = (struct ip_conntrack_tuple_hash *) i; |
423 | if (DIRECTION(h) != IP_CT_DIR_ORIGINAL) | 423 | if (DIRECTION(h) != IP_CT_DIR_ORIGINAL) |
424 | continue; | 424 | continue; |
425 | ct = tuplehash_to_ctrack(h); | 425 | ct = tuplehash_to_ctrack(h); |
426 | if (last != NULL) { | 426 | if (cb->args[1]) { |
427 | if (ct == last) { | 427 | if (ct != last) |
428 | ip_conntrack_put(last); | ||
429 | cb->args[1] = 0; | ||
430 | last = NULL; | ||
431 | } else | ||
432 | continue; | 428 | continue; |
429 | cb->args[1] = 0; | ||
433 | } | 430 | } |
434 | if (ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).pid, | 431 | if (ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).pid, |
435 | cb->nlh->nlmsg_seq, | 432 | cb->nlh->nlmsg_seq, |
@@ -440,17 +437,17 @@ restart: | |||
440 | goto out; | 437 | goto out; |
441 | } | 438 | } |
442 | } | 439 | } |
443 | if (last != NULL) { | 440 | if (cb->args[1]) { |
444 | ip_conntrack_put(last); | ||
445 | cb->args[1] = 0; | 441 | cb->args[1] = 0; |
446 | goto restart; | 442 | goto restart; |
447 | } | 443 | } |
448 | } | 444 | } |
449 | out: | 445 | out: |
450 | read_unlock_bh(&ip_conntrack_lock); | 446 | read_unlock_bh(&ip_conntrack_lock); |
447 | if (last) | ||
448 | ip_conntrack_put(last); | ||
451 | 449 | ||
452 | DEBUGP("leaving, last bucket=%lu id=%u\n", cb->args[0], *id); | 450 | DEBUGP("leaving, last bucket=%lu id=%u\n", cb->args[0], *id); |
453 | |||
454 | return skb->len; | 451 | return skb->len; |
455 | } | 452 | } |
456 | 453 | ||
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index fc5bdd5eb7d3..048514f15f2f 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -230,7 +230,7 @@ ipt_do_table(struct sk_buff **pskb, | |||
230 | const char *indev, *outdev; | 230 | const char *indev, *outdev; |
231 | void *table_base; | 231 | void *table_base; |
232 | struct ipt_entry *e, *back; | 232 | struct ipt_entry *e, *back; |
233 | struct xt_table_info *private = table->private; | 233 | struct xt_table_info *private; |
234 | 234 | ||
235 | /* Initialization */ | 235 | /* Initialization */ |
236 | ip = (*pskb)->nh.iph; | 236 | ip = (*pskb)->nh.iph; |
@@ -247,6 +247,7 @@ ipt_do_table(struct sk_buff **pskb, | |||
247 | 247 | ||
248 | read_lock_bh(&table->lock); | 248 | read_lock_bh(&table->lock); |
249 | IP_NF_ASSERT(table->valid_hooks & (1 << hook)); | 249 | IP_NF_ASSERT(table->valid_hooks & (1 << hook)); |
250 | private = table->private; | ||
250 | table_base = (void *)private->entries[smp_processor_id()]; | 251 | table_base = (void *)private->entries[smp_processor_id()]; |
251 | e = get_entry(table_base, private->hook_entry[hook]); | 252 | e = get_entry(table_base, private->hook_entry[hook]); |
252 | 253 | ||
@@ -2239,22 +2240,39 @@ static int __init ip_tables_init(void) | |||
2239 | { | 2240 | { |
2240 | int ret; | 2241 | int ret; |
2241 | 2242 | ||
2242 | xt_proto_init(AF_INET); | 2243 | ret = xt_proto_init(AF_INET); |
2244 | if (ret < 0) | ||
2245 | goto err1; | ||
2243 | 2246 | ||
2244 | /* Noone else will be downing sem now, so we won't sleep */ | 2247 | /* Noone else will be downing sem now, so we won't sleep */ |
2245 | xt_register_target(&ipt_standard_target); | 2248 | ret = xt_register_target(&ipt_standard_target); |
2246 | xt_register_target(&ipt_error_target); | 2249 | if (ret < 0) |
2247 | xt_register_match(&icmp_matchstruct); | 2250 | goto err2; |
2251 | ret = xt_register_target(&ipt_error_target); | ||
2252 | if (ret < 0) | ||
2253 | goto err3; | ||
2254 | ret = xt_register_match(&icmp_matchstruct); | ||
2255 | if (ret < 0) | ||
2256 | goto err4; | ||
2248 | 2257 | ||
2249 | /* Register setsockopt */ | 2258 | /* Register setsockopt */ |
2250 | ret = nf_register_sockopt(&ipt_sockopts); | 2259 | ret = nf_register_sockopt(&ipt_sockopts); |
2251 | if (ret < 0) { | 2260 | if (ret < 0) |
2252 | duprintf("Unable to register sockopts.\n"); | 2261 | goto err5; |
2253 | return ret; | ||
2254 | } | ||
2255 | 2262 | ||
2256 | printk("ip_tables: (C) 2000-2006 Netfilter Core Team\n"); | 2263 | printk("ip_tables: (C) 2000-2006 Netfilter Core Team\n"); |
2257 | return 0; | 2264 | return 0; |
2265 | |||
2266 | err5: | ||
2267 | xt_unregister_match(&icmp_matchstruct); | ||
2268 | err4: | ||
2269 | xt_unregister_target(&ipt_error_target); | ||
2270 | err3: | ||
2271 | xt_unregister_target(&ipt_standard_target); | ||
2272 | err2: | ||
2273 | xt_proto_fini(AF_INET); | ||
2274 | err1: | ||
2275 | return ret; | ||
2258 | } | 2276 | } |
2259 | 2277 | ||
2260 | static void __exit ip_tables_fini(void) | 2278 | static void __exit ip_tables_fini(void) |
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c index d7dd7fe7051c..d46fd677fa11 100644 --- a/net/ipv4/netfilter/ipt_ULOG.c +++ b/net/ipv4/netfilter/ipt_ULOG.c | |||
@@ -115,6 +115,11 @@ static void ulog_send(unsigned int nlgroupnum) | |||
115 | del_timer(&ub->timer); | 115 | del_timer(&ub->timer); |
116 | } | 116 | } |
117 | 117 | ||
118 | if (!ub->skb) { | ||
119 | DEBUGP("ipt_ULOG: ulog_send: nothing to send\n"); | ||
120 | return; | ||
121 | } | ||
122 | |||
118 | /* last nlmsg needs NLMSG_DONE */ | 123 | /* last nlmsg needs NLMSG_DONE */ |
119 | if (ub->qlen > 1) | 124 | if (ub->qlen > 1) |
120 | ub->lastnlh->nlmsg_type = NLMSG_DONE; | 125 | ub->lastnlh->nlmsg_type = NLMSG_DONE; |
diff --git a/net/ipv4/netfilter/ipt_hashlimit.c b/net/ipv4/netfilter/ipt_hashlimit.c index 6b662449e825..3bd2368e1fc9 100644 --- a/net/ipv4/netfilter/ipt_hashlimit.c +++ b/net/ipv4/netfilter/ipt_hashlimit.c | |||
@@ -454,15 +454,12 @@ hashlimit_match(const struct sk_buff *skb, | |||
454 | dh->rateinfo.credit_cap = user2credits(hinfo->cfg.avg * | 454 | dh->rateinfo.credit_cap = user2credits(hinfo->cfg.avg * |
455 | hinfo->cfg.burst); | 455 | hinfo->cfg.burst); |
456 | dh->rateinfo.cost = user2credits(hinfo->cfg.avg); | 456 | dh->rateinfo.cost = user2credits(hinfo->cfg.avg); |
457 | 457 | } else { | |
458 | spin_unlock_bh(&hinfo->lock); | 458 | /* update expiration timeout */ |
459 | return 1; | 459 | dh->expires = now + msecs_to_jiffies(hinfo->cfg.expire); |
460 | rateinfo_recalc(dh, now); | ||
460 | } | 461 | } |
461 | 462 | ||
462 | /* update expiration timeout */ | ||
463 | dh->expires = now + msecs_to_jiffies(hinfo->cfg.expire); | ||
464 | |||
465 | rateinfo_recalc(dh, now); | ||
466 | if (dh->rateinfo.credit >= dh->rateinfo.cost) { | 463 | if (dh->rateinfo.credit >= dh->rateinfo.cost) { |
467 | /* We're underlimit. */ | 464 | /* We're underlimit. */ |
468 | dh->rateinfo.credit -= dh->rateinfo.cost; | 465 | dh->rateinfo.credit -= dh->rateinfo.cost; |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 19bd49d69d9f..b873cbcdd0b8 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -3157,7 +3157,7 @@ int __init ip_rt_init(void) | |||
3157 | rhash_entries, | 3157 | rhash_entries, |
3158 | (num_physpages >= 128 * 1024) ? | 3158 | (num_physpages >= 128 * 1024) ? |
3159 | 15 : 17, | 3159 | 15 : 17, |
3160 | HASH_HIGHMEM, | 3160 | 0, |
3161 | &rt_hash_log, | 3161 | &rt_hash_log, |
3162 | &rt_hash_mask, | 3162 | &rt_hash_mask, |
3163 | 0); | 3163 | 0); |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 5c08ea20a18d..507adefbc17c 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -466,7 +466,8 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
466 | if (skb->len != tcp_header_size) | 466 | if (skb->len != tcp_header_size) |
467 | tcp_event_data_sent(tp, skb, sk); | 467 | tcp_event_data_sent(tp, skb, sk); |
468 | 468 | ||
469 | TCP_INC_STATS(TCP_MIB_OUTSEGS); | 469 | if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq) |
470 | TCP_INC_STATS(TCP_MIB_OUTSEGS); | ||
470 | 471 | ||
471 | err = icsk->icsk_af_ops->queue_xmit(skb, 0); | 472 | err = icsk->icsk_af_ops->queue_xmit(skb, 0); |
472 | if (likely(err <= 0)) | 473 | if (likely(err <= 0)) |
@@ -2157,10 +2158,9 @@ int tcp_connect(struct sock *sk) | |||
2157 | skb_shinfo(buff)->gso_size = 0; | 2158 | skb_shinfo(buff)->gso_size = 0; |
2158 | skb_shinfo(buff)->gso_type = 0; | 2159 | skb_shinfo(buff)->gso_type = 0; |
2159 | buff->csum = 0; | 2160 | buff->csum = 0; |
2161 | tp->snd_nxt = tp->write_seq; | ||
2160 | TCP_SKB_CB(buff)->seq = tp->write_seq++; | 2162 | TCP_SKB_CB(buff)->seq = tp->write_seq++; |
2161 | TCP_SKB_CB(buff)->end_seq = tp->write_seq; | 2163 | TCP_SKB_CB(buff)->end_seq = tp->write_seq; |
2162 | tp->snd_nxt = tp->write_seq; | ||
2163 | tp->pushed_seq = tp->write_seq; | ||
2164 | 2164 | ||
2165 | /* Send it off. */ | 2165 | /* Send it off. */ |
2166 | TCP_SKB_CB(buff)->when = tcp_time_stamp; | 2166 | TCP_SKB_CB(buff)->when = tcp_time_stamp; |
@@ -2170,6 +2170,12 @@ int tcp_connect(struct sock *sk) | |||
2170 | sk_charge_skb(sk, buff); | 2170 | sk_charge_skb(sk, buff); |
2171 | tp->packets_out += tcp_skb_pcount(buff); | 2171 | tp->packets_out += tcp_skb_pcount(buff); |
2172 | tcp_transmit_skb(sk, buff, 1, GFP_KERNEL); | 2172 | tcp_transmit_skb(sk, buff, 1, GFP_KERNEL); |
2173 | |||
2174 | /* We change tp->snd_nxt after the tcp_transmit_skb() call | ||
2175 | * in order to make this packet get counted in tcpOutSegs. | ||
2176 | */ | ||
2177 | tp->snd_nxt = tp->write_seq; | ||
2178 | tp->pushed_seq = tp->write_seq; | ||
2173 | TCP_INC_STATS(TCP_MIB_ACTIVEOPENS); | 2179 | TCP_INC_STATS(TCP_MIB_ACTIVEOPENS); |
2174 | 2180 | ||
2175 | /* Timer for repeating the SYN until an answer. */ | 2181 | /* Timer for repeating the SYN until an answer. */ |
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c index b3435324b573..dab37d2f65fc 100644 --- a/net/ipv4/tcp_probe.c +++ b/net/ipv4/tcp_probe.c | |||
@@ -130,11 +130,12 @@ static ssize_t tcpprobe_read(struct file *file, char __user *buf, | |||
130 | error = wait_event_interruptible(tcpw.wait, | 130 | error = wait_event_interruptible(tcpw.wait, |
131 | __kfifo_len(tcpw.fifo) != 0); | 131 | __kfifo_len(tcpw.fifo) != 0); |
132 | if (error) | 132 | if (error) |
133 | return error; | 133 | goto out_free; |
134 | 134 | ||
135 | cnt = kfifo_get(tcpw.fifo, tbuf, len); | 135 | cnt = kfifo_get(tcpw.fifo, tbuf, len); |
136 | error = copy_to_user(buf, tbuf, cnt); | 136 | error = copy_to_user(buf, tbuf, cnt); |
137 | 137 | ||
138 | out_free: | ||
138 | vfree(tbuf); | 139 | vfree(tbuf); |
139 | 140 | ||
140 | return error ? error : cnt; | 141 | return error ? error : cnt; |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 8ea1e36bf8eb..0c5042e7380d 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -1909,11 +1909,11 @@ static int inet6_addr_add(int ifindex, struct in6_addr *pfx, int plen, | |||
1909 | ifp = ipv6_add_addr(idev, pfx, plen, scope, ifa_flags); | 1909 | ifp = ipv6_add_addr(idev, pfx, plen, scope, ifa_flags); |
1910 | 1910 | ||
1911 | if (!IS_ERR(ifp)) { | 1911 | if (!IS_ERR(ifp)) { |
1912 | spin_lock(&ifp->lock); | 1912 | spin_lock_bh(&ifp->lock); |
1913 | ifp->valid_lft = valid_lft; | 1913 | ifp->valid_lft = valid_lft; |
1914 | ifp->prefered_lft = prefered_lft; | 1914 | ifp->prefered_lft = prefered_lft; |
1915 | ifp->tstamp = jiffies; | 1915 | ifp->tstamp = jiffies; |
1916 | spin_unlock(&ifp->lock); | 1916 | spin_unlock_bh(&ifp->lock); |
1917 | 1917 | ||
1918 | addrconf_dad_start(ifp, 0); | 1918 | addrconf_dad_start(ifp, 0); |
1919 | in6_ifa_put(ifp); | 1919 | in6_ifa_put(ifp); |
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 1044b6fce0d5..3d6e9a351150 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -712,6 +712,11 @@ discard_it: | |||
712 | return 0; | 712 | return 0; |
713 | } | 713 | } |
714 | 714 | ||
715 | /* | ||
716 | * Special lock-class for __icmpv6_socket: | ||
717 | */ | ||
718 | static struct lock_class_key icmpv6_socket_sk_dst_lock_key; | ||
719 | |||
715 | int __init icmpv6_init(struct net_proto_family *ops) | 720 | int __init icmpv6_init(struct net_proto_family *ops) |
716 | { | 721 | { |
717 | struct sock *sk; | 722 | struct sock *sk; |
@@ -730,6 +735,14 @@ int __init icmpv6_init(struct net_proto_family *ops) | |||
730 | 735 | ||
731 | sk = per_cpu(__icmpv6_socket, i)->sk; | 736 | sk = per_cpu(__icmpv6_socket, i)->sk; |
732 | sk->sk_allocation = GFP_ATOMIC; | 737 | sk->sk_allocation = GFP_ATOMIC; |
738 | /* | ||
739 | * Split off their lock-class, because sk->sk_dst_lock | ||
740 | * gets used from softirqs, which is safe for | ||
741 | * __icmpv6_socket (because those never get directly used | ||
742 | * via userspace syscalls), but unsafe for normal sockets. | ||
743 | */ | ||
744 | lockdep_set_class(&sk->sk_dst_lock, | ||
745 | &icmpv6_socket_sk_dst_lock_key); | ||
733 | 746 | ||
734 | /* Enough space for 2 64K ICMP packets, including | 747 | /* Enough space for 2 64K ICMP packets, including |
735 | * sk_buff struct overhead. | 748 | * sk_buff struct overhead. |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 69451af6abe7..4fb47a252913 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -1095,7 +1095,7 @@ alloc_new_skb: | |||
1095 | skb_prev->csum = csum_sub(skb_prev->csum, | 1095 | skb_prev->csum = csum_sub(skb_prev->csum, |
1096 | skb->csum); | 1096 | skb->csum); |
1097 | data += fraggap; | 1097 | data += fraggap; |
1098 | skb_trim(skb_prev, maxfraglen); | 1098 | pskb_trim_unique(skb_prev, maxfraglen); |
1099 | } | 1099 | } |
1100 | copy = datalen - transhdrlen - fraggap; | 1100 | copy = datalen - transhdrlen - fraggap; |
1101 | if (copy < 0) { | 1101 | if (copy < 0) { |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 9d697d4dcffc..639eb20c9f1f 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -268,13 +268,14 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, struct in6_addr *addr) | |||
268 | if ((dev = dev_get_by_index(mc_lst->ifindex)) != NULL) { | 268 | if ((dev = dev_get_by_index(mc_lst->ifindex)) != NULL) { |
269 | struct inet6_dev *idev = in6_dev_get(dev); | 269 | struct inet6_dev *idev = in6_dev_get(dev); |
270 | 270 | ||
271 | (void) ip6_mc_leave_src(sk, mc_lst, idev); | ||
271 | if (idev) { | 272 | if (idev) { |
272 | (void) ip6_mc_leave_src(sk,mc_lst,idev); | ||
273 | __ipv6_dev_mc_dec(idev, &mc_lst->addr); | 273 | __ipv6_dev_mc_dec(idev, &mc_lst->addr); |
274 | in6_dev_put(idev); | 274 | in6_dev_put(idev); |
275 | } | 275 | } |
276 | dev_put(dev); | 276 | dev_put(dev); |
277 | } | 277 | } else |
278 | (void) ip6_mc_leave_src(sk, mc_lst, NULL); | ||
278 | sock_kfree_s(sk, mc_lst, sizeof(*mc_lst)); | 279 | sock_kfree_s(sk, mc_lst, sizeof(*mc_lst)); |
279 | return 0; | 280 | return 0; |
280 | } | 281 | } |
@@ -334,13 +335,14 @@ void ipv6_sock_mc_close(struct sock *sk) | |||
334 | if (dev) { | 335 | if (dev) { |
335 | struct inet6_dev *idev = in6_dev_get(dev); | 336 | struct inet6_dev *idev = in6_dev_get(dev); |
336 | 337 | ||
338 | (void) ip6_mc_leave_src(sk, mc_lst, idev); | ||
337 | if (idev) { | 339 | if (idev) { |
338 | (void) ip6_mc_leave_src(sk, mc_lst, idev); | ||
339 | __ipv6_dev_mc_dec(idev, &mc_lst->addr); | 340 | __ipv6_dev_mc_dec(idev, &mc_lst->addr); |
340 | in6_dev_put(idev); | 341 | in6_dev_put(idev); |
341 | } | 342 | } |
342 | dev_put(dev); | 343 | dev_put(dev); |
343 | } | 344 | } else |
345 | (void) ip6_mc_leave_src(sk, mc_lst, NULL); | ||
344 | 346 | ||
345 | sock_kfree_s(sk, mc_lst, sizeof(*mc_lst)); | 347 | sock_kfree_s(sk, mc_lst, sizeof(*mc_lst)); |
346 | 348 | ||
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index f26898b00347..c9d6b23cd3f7 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -1398,23 +1398,39 @@ static int __init ip6_tables_init(void) | |||
1398 | { | 1398 | { |
1399 | int ret; | 1399 | int ret; |
1400 | 1400 | ||
1401 | xt_proto_init(AF_INET6); | 1401 | ret = xt_proto_init(AF_INET6); |
1402 | if (ret < 0) | ||
1403 | goto err1; | ||
1402 | 1404 | ||
1403 | /* Noone else will be downing sem now, so we won't sleep */ | 1405 | /* Noone else will be downing sem now, so we won't sleep */ |
1404 | xt_register_target(&ip6t_standard_target); | 1406 | ret = xt_register_target(&ip6t_standard_target); |
1405 | xt_register_target(&ip6t_error_target); | 1407 | if (ret < 0) |
1406 | xt_register_match(&icmp6_matchstruct); | 1408 | goto err2; |
1409 | ret = xt_register_target(&ip6t_error_target); | ||
1410 | if (ret < 0) | ||
1411 | goto err3; | ||
1412 | ret = xt_register_match(&icmp6_matchstruct); | ||
1413 | if (ret < 0) | ||
1414 | goto err4; | ||
1407 | 1415 | ||
1408 | /* Register setsockopt */ | 1416 | /* Register setsockopt */ |
1409 | ret = nf_register_sockopt(&ip6t_sockopts); | 1417 | ret = nf_register_sockopt(&ip6t_sockopts); |
1410 | if (ret < 0) { | 1418 | if (ret < 0) |
1411 | duprintf("Unable to register sockopts.\n"); | 1419 | goto err5; |
1412 | xt_proto_fini(AF_INET6); | ||
1413 | return ret; | ||
1414 | } | ||
1415 | 1420 | ||
1416 | printk("ip6_tables: (C) 2000-2006 Netfilter Core Team\n"); | 1421 | printk("ip6_tables: (C) 2000-2006 Netfilter Core Team\n"); |
1417 | return 0; | 1422 | return 0; |
1423 | |||
1424 | err5: | ||
1425 | xt_unregister_match(&icmp6_matchstruct); | ||
1426 | err4: | ||
1427 | xt_unregister_target(&ip6t_error_target); | ||
1428 | err3: | ||
1429 | xt_unregister_target(&ip6t_standard_target); | ||
1430 | err2: | ||
1431 | xt_proto_fini(AF_INET6); | ||
1432 | err1: | ||
1433 | return ret; | ||
1418 | } | 1434 | } |
1419 | 1435 | ||
1420 | static void __exit ip6_tables_fini(void) | 1436 | static void __exit ip6_tables_fini(void) |
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index aa34ff4b707c..bef3f61569f7 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -1642,13 +1642,17 @@ static int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty | |||
1642 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) | 1642 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) |
1643 | goto out; | 1643 | goto out; |
1644 | 1644 | ||
1645 | ipx = ipx_hdr(skb); | 1645 | if (!pskb_may_pull(skb, sizeof(struct ipxhdr))) |
1646 | ipx_pktsize = ntohs(ipx->ipx_pktsize); | 1646 | goto drop; |
1647 | |||
1648 | ipx_pktsize = ntohs(ipx_hdr(skb)->ipx_pktsize); | ||
1647 | 1649 | ||
1648 | /* Too small or invalid header? */ | 1650 | /* Too small or invalid header? */ |
1649 | if (ipx_pktsize < sizeof(struct ipxhdr) || ipx_pktsize > skb->len) | 1651 | if (ipx_pktsize < sizeof(struct ipxhdr) || |
1652 | !pskb_may_pull(skb, ipx_pktsize)) | ||
1650 | goto drop; | 1653 | goto drop; |
1651 | 1654 | ||
1655 | ipx = ipx_hdr(skb); | ||
1652 | if (ipx->ipx_checksum != IPX_NO_CHECKSUM && | 1656 | if (ipx->ipx_checksum != IPX_NO_CHECKSUM && |
1653 | ipx->ipx_checksum != ipx_cksum(ipx, ipx_pktsize)) | 1657 | ipx->ipx_checksum != ipx_cksum(ipx, ipx_pktsize)) |
1654 | goto drop; | 1658 | goto drop; |
diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c index 42eb0c3a9780..61cb8cf7d153 100644 --- a/net/llc/llc_sap.c +++ b/net/llc/llc_sap.c | |||
@@ -330,6 +330,9 @@ static void llc_sap_mcast(struct llc_sap *sap, | |||
330 | if (llc->laddr.lsap != laddr->lsap) | 330 | if (llc->laddr.lsap != laddr->lsap) |
331 | continue; | 331 | continue; |
332 | 332 | ||
333 | if (llc->dev != skb->dev) | ||
334 | continue; | ||
335 | |||
333 | skb1 = skb_clone(skb, GFP_ATOMIC); | 336 | skb1 = skb_clone(skb, GFP_ATOMIC); |
334 | if (!skb1) | 337 | if (!skb1) |
335 | break; | 338 | break; |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index af4845971f70..6527d4e048d8 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -429,9 +429,9 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) | |||
429 | cb->args[0], *id); | 429 | cb->args[0], *id); |
430 | 430 | ||
431 | read_lock_bh(&nf_conntrack_lock); | 431 | read_lock_bh(&nf_conntrack_lock); |
432 | last = (struct nf_conn *)cb->args[1]; | ||
432 | for (; cb->args[0] < nf_conntrack_htable_size; cb->args[0]++) { | 433 | for (; cb->args[0] < nf_conntrack_htable_size; cb->args[0]++) { |
433 | restart: | 434 | restart: |
434 | last = (struct nf_conn *)cb->args[1]; | ||
435 | list_for_each_prev(i, &nf_conntrack_hash[cb->args[0]]) { | 435 | list_for_each_prev(i, &nf_conntrack_hash[cb->args[0]]) { |
436 | h = (struct nf_conntrack_tuple_hash *) i; | 436 | h = (struct nf_conntrack_tuple_hash *) i; |
437 | if (DIRECTION(h) != IP_CT_DIR_ORIGINAL) | 437 | if (DIRECTION(h) != IP_CT_DIR_ORIGINAL) |
@@ -442,13 +442,10 @@ restart: | |||
442 | * then dump everything. */ | 442 | * then dump everything. */ |
443 | if (l3proto && L3PROTO(ct) != l3proto) | 443 | if (l3proto && L3PROTO(ct) != l3proto) |
444 | continue; | 444 | continue; |
445 | if (last != NULL) { | 445 | if (cb->args[1]) { |
446 | if (ct == last) { | 446 | if (ct != last) |
447 | nf_ct_put(last); | ||
448 | cb->args[1] = 0; | ||
449 | last = NULL; | ||
450 | } else | ||
451 | continue; | 447 | continue; |
448 | cb->args[1] = 0; | ||
452 | } | 449 | } |
453 | if (ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).pid, | 450 | if (ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).pid, |
454 | cb->nlh->nlmsg_seq, | 451 | cb->nlh->nlmsg_seq, |
@@ -459,17 +456,17 @@ restart: | |||
459 | goto out; | 456 | goto out; |
460 | } | 457 | } |
461 | } | 458 | } |
462 | if (last != NULL) { | 459 | if (cb->args[1]) { |
463 | nf_ct_put(last); | ||
464 | cb->args[1] = 0; | 460 | cb->args[1] = 0; |
465 | goto restart; | 461 | goto restart; |
466 | } | 462 | } |
467 | } | 463 | } |
468 | out: | 464 | out: |
469 | read_unlock_bh(&nf_conntrack_lock); | 465 | read_unlock_bh(&nf_conntrack_lock); |
466 | if (last) | ||
467 | nf_ct_put(last); | ||
470 | 468 | ||
471 | DEBUGP("leaving, last bucket=%lu id=%u\n", cb->args[0], *id); | 469 | DEBUGP("leaving, last bucket=%lu id=%u\n", cb->args[0], *id); |
472 | |||
473 | return skb->len; | 470 | return skb->len; |
474 | } | 471 | } |
475 | 472 | ||
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 61cdda4e5d3b..b59d3b2bde21 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -366,6 +366,9 @@ __nfulnl_send(struct nfulnl_instance *inst) | |||
366 | if (timer_pending(&inst->timer)) | 366 | if (timer_pending(&inst->timer)) |
367 | del_timer(&inst->timer); | 367 | del_timer(&inst->timer); |
368 | 368 | ||
369 | if (!inst->skb) | ||
370 | return 0; | ||
371 | |||
369 | if (inst->qlen > 1) | 372 | if (inst->qlen > 1) |
370 | inst->lastnlh->nlmsg_type = NLMSG_DONE; | 373 | inst->lastnlh->nlmsg_type = NLMSG_DONE; |
371 | 374 | ||
diff --git a/net/netfilter/xt_physdev.c b/net/netfilter/xt_physdev.c index a9f4f6f3c628..63a965467465 100644 --- a/net/netfilter/xt_physdev.c +++ b/net/netfilter/xt_physdev.c | |||
@@ -10,6 +10,7 @@ | |||
10 | 10 | ||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/skbuff.h> | 12 | #include <linux/skbuff.h> |
13 | #include <linux/netfilter_bridge.h> | ||
13 | #include <linux/netfilter/xt_physdev.h> | 14 | #include <linux/netfilter/xt_physdev.h> |
14 | #include <linux/netfilter/x_tables.h> | 15 | #include <linux/netfilter/x_tables.h> |
15 | #include <linux/netfilter_bridge.h> | 16 | #include <linux/netfilter_bridge.h> |
diff --git a/net/netfilter/xt_string.c b/net/netfilter/xt_string.c index d8e3891b5f8b..275330fcdaaa 100644 --- a/net/netfilter/xt_string.c +++ b/net/netfilter/xt_string.c | |||
@@ -37,7 +37,7 @@ static int match(const struct sk_buff *skb, | |||
37 | 37 | ||
38 | return (skb_find_text((struct sk_buff *)skb, conf->from_offset, | 38 | return (skb_find_text((struct sk_buff *)skb, conf->from_offset, |
39 | conf->to_offset, conf->config, &state) | 39 | conf->to_offset, conf->config, &state) |
40 | != UINT_MAX) && !conf->invert; | 40 | != UINT_MAX) ^ conf->invert; |
41 | } | 41 | } |
42 | 42 | ||
43 | #define STRING_TEXT_PRIV(m) ((struct xt_string_info *) m) | 43 | #define STRING_TEXT_PRIV(m) ((struct xt_string_info *) m) |
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index eea366966740..0a6cfa0005be 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -796,7 +796,7 @@ static int __init init_u32(void) | |||
796 | { | 796 | { |
797 | printk("u32 classifier\n"); | 797 | printk("u32 classifier\n"); |
798 | #ifdef CONFIG_CLS_U32_PERF | 798 | #ifdef CONFIG_CLS_U32_PERF |
799 | printk(" Perfomance counters on\n"); | 799 | printk(" Performance counters on\n"); |
800 | #endif | 800 | #endif |
801 | #ifdef CONFIG_NET_CLS_POLICE | 801 | #ifdef CONFIG_NET_CLS_POLICE |
802 | printk(" OLD policer on \n"); | 802 | printk(" OLD policer on \n"); |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index f35bc676128c..3da67ca2c3ce 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1134,12 +1134,33 @@ int __xfrm_route_forward(struct sk_buff *skb, unsigned short family) | |||
1134 | } | 1134 | } |
1135 | EXPORT_SYMBOL(__xfrm_route_forward); | 1135 | EXPORT_SYMBOL(__xfrm_route_forward); |
1136 | 1136 | ||
1137 | /* Optimize later using cookies and generation ids. */ | ||
1138 | |||
1137 | static struct dst_entry *xfrm_dst_check(struct dst_entry *dst, u32 cookie) | 1139 | static struct dst_entry *xfrm_dst_check(struct dst_entry *dst, u32 cookie) |
1138 | { | 1140 | { |
1139 | /* If it is marked obsolete, which is how we even get here, | 1141 | /* Code (such as __xfrm4_bundle_create()) sets dst->obsolete |
1140 | * then we have purged it from the policy bundle list and we | 1142 | * to "-1" to force all XFRM destinations to get validated by |
1141 | * did that for a good reason. | 1143 | * dst_ops->check on every use. We do this because when a |
1144 | * normal route referenced by an XFRM dst is obsoleted we do | ||
1145 | * not go looking around for all parent referencing XFRM dsts | ||
1146 | * so that we can invalidate them. It is just too much work. | ||
1147 | * Instead we make the checks here on every use. For example: | ||
1148 | * | ||
1149 | * XFRM dst A --> IPv4 dst X | ||
1150 | * | ||
1151 | * X is the "xdst->route" of A (X is also the "dst->path" of A | ||
1152 | * in this example). If X is marked obsolete, "A" will not | ||
1153 | * notice. That's what we are validating here via the | ||
1154 | * stale_bundle() check. | ||
1155 | * | ||
1156 | * When a policy's bundle is pruned, we dst_free() the XFRM | ||
1157 | * dst which causes it's ->obsolete field to be set to a | ||
1158 | * positive non-zero integer. If an XFRM dst has been pruned | ||
1159 | * like this, we want to force a new route lookup. | ||
1142 | */ | 1160 | */ |
1161 | if (dst->obsolete < 0 && !stale_bundle(dst)) | ||
1162 | return dst; | ||
1163 | |||
1143 | return NULL; | 1164 | return NULL; |
1144 | } | 1165 | } |
1145 | 1166 | ||
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 44312926b849..e2de650d3dbf 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -391,7 +391,7 @@ static void do_input(char *alias, | |||
391 | unsigned int i; | 391 | unsigned int i; |
392 | 392 | ||
393 | for (i = min; i < max; i++) | 393 | for (i = min; i < max; i++) |
394 | if (arr[i / BITS_PER_LONG] & (1 << (i%BITS_PER_LONG))) | 394 | if (arr[i / BITS_PER_LONG] & (1L << (i%BITS_PER_LONG))) |
395 | sprintf(alias + strlen(alias), "%X,*", i); | 395 | sprintf(alias + strlen(alias), "%X,*", i); |
396 | } | 396 | } |
397 | 397 | ||
diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig index f4980ca5c05c..1b7c3dfc2b41 100644 --- a/sound/oss/Kconfig +++ b/sound/oss/Kconfig | |||
@@ -31,7 +31,7 @@ config SOUND_EMU10K1 | |||
31 | For more information on this driver and the degree of support for | 31 | For more information on this driver and the degree of support for |
32 | the different card models please check: | 32 | the different card models please check: |
33 | 33 | ||
34 | <http://sourceforge.net/projects/emu10k1/> | 34 | <http://sourceforge.net/projects/emu10k1/> |
35 | 35 | ||
36 | It is now possible to load dsp microcode patches into the EMU10K1 | 36 | It is now possible to load dsp microcode patches into the EMU10K1 |
37 | chip. These patches are used to implement real time sound | 37 | chip. These patches are used to implement real time sound |
@@ -140,7 +140,7 @@ config SOUND_TRIDENT | |||
140 | system support" and "Sysctl support", and after the /proc file | 140 | system support" and "Sysctl support", and after the /proc file |
141 | system has been mounted, executing the command | 141 | system has been mounted, executing the command |
142 | 142 | ||
143 | command what is enabled | 143 | command what is enabled |
144 | 144 | ||
145 | echo 0>/proc/ALi5451 pcm out is also set to S/PDIF out. (Default). | 145 | echo 0>/proc/ALi5451 pcm out is also set to S/PDIF out. (Default). |
146 | 146 | ||
@@ -838,7 +838,7 @@ config SOUND_WAVEARTIST | |||
838 | 838 | ||
839 | config SOUND_TVMIXER | 839 | config SOUND_TVMIXER |
840 | tristate "TV card (bt848) mixer support" | 840 | tristate "TV card (bt848) mixer support" |
841 | depends on SOUND_PRIME && I2C | 841 | depends on SOUND_PRIME && I2C && VIDEO_V4L1 |
842 | help | 842 | help |
843 | Support for audio mixer facilities on the BT848 TV frame-grabber | 843 | Support for audio mixer facilities on the BT848 TV frame-grabber |
844 | card. | 844 | card. |
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index d7ad32f514da..e49c0fe21b0d 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig | |||
@@ -16,16 +16,16 @@ config SND_AD1889 | |||
16 | will be called snd-ad1889. | 16 | will be called snd-ad1889. |
17 | 17 | ||
18 | config SND_ALS300 | 18 | config SND_ALS300 |
19 | tristate "Avance Logic ALS300/ALS300+" | 19 | tristate "Avance Logic ALS300/ALS300+" |
20 | depends on SND | 20 | depends on SND |
21 | select SND_PCM | 21 | select SND_PCM |
22 | select SND_AC97_CODEC | 22 | select SND_AC97_CODEC |
23 | select SND_OPL3_LIB | 23 | select SND_OPL3_LIB |
24 | help | 24 | help |
25 | Say 'Y' or 'M' to include support for Avance Logic ALS300/ALS300+ | 25 | Say 'Y' or 'M' to include support for Avance Logic ALS300/ALS300+ |
26 | 26 | ||
27 | To compile this driver as a module, choose M here: the module | 27 | To compile this driver as a module, choose M here: the module |
28 | will be called snd-als300 | 28 | will be called snd-als300 |
29 | 29 | ||
30 | config SND_ALS4000 | 30 | config SND_ALS4000 |
31 | tristate "Avance Logic ALS4000" | 31 | tristate "Avance Logic ALS4000" |
@@ -78,49 +78,49 @@ config SND_ATIIXP_MODEM | |||
78 | will be called snd-atiixp-modem. | 78 | will be called snd-atiixp-modem. |
79 | 79 | ||
80 | config SND_AU8810 | 80 | config SND_AU8810 |
81 | tristate "Aureal Advantage" | 81 | tristate "Aureal Advantage" |
82 | depends on SND | 82 | depends on SND |
83 | select SND_MPU401_UART | 83 | select SND_MPU401_UART |
84 | select SND_AC97_CODEC | 84 | select SND_AC97_CODEC |
85 | help | 85 | help |
86 | Say Y here to include support for Aureal Advantage soundcards. | 86 | Say Y here to include support for Aureal Advantage soundcards. |
87 | 87 | ||
88 | Supported features: Hardware Mixer, SRC, EQ and SPDIF output. | 88 | Supported features: Hardware Mixer, SRC, EQ and SPDIF output. |
89 | 3D support code is in place, but not yet useable. For more info, | 89 | 3D support code is in place, but not yet useable. For more info, |
90 | email the ALSA developer list, or <mjander@users.sourceforge.net>. | 90 | email the ALSA developer list, or <mjander@users.sourceforge.net>. |
91 | 91 | ||
92 | To compile this driver as a module, choose M here: the module | 92 | To compile this driver as a module, choose M here: the module |
93 | will be called snd-au8810. | 93 | will be called snd-au8810. |
94 | 94 | ||
95 | config SND_AU8820 | 95 | config SND_AU8820 |
96 | tristate "Aureal Vortex" | 96 | tristate "Aureal Vortex" |
97 | depends on SND | 97 | depends on SND |
98 | select SND_MPU401_UART | 98 | select SND_MPU401_UART |
99 | select SND_AC97_CODEC | 99 | select SND_AC97_CODEC |
100 | help | 100 | help |
101 | Say Y here to include support for Aureal Vortex soundcards. | 101 | Say Y here to include support for Aureal Vortex soundcards. |
102 | 102 | ||
103 | Supported features: Hardware Mixer and SRC. For more info, email | 103 | Supported features: Hardware Mixer and SRC. For more info, email |
104 | the ALSA developer list, or <mjander@users.sourceforge.net>. | 104 | the ALSA developer list, or <mjander@users.sourceforge.net>. |
105 | 105 | ||
106 | To compile this driver as a module, choose M here: the module | 106 | To compile this driver as a module, choose M here: the module |
107 | will be called snd-au8820. | 107 | will be called snd-au8820. |
108 | 108 | ||
109 | config SND_AU8830 | 109 | config SND_AU8830 |
110 | tristate "Aureal Vortex 2" | 110 | tristate "Aureal Vortex 2" |
111 | depends on SND | 111 | depends on SND |
112 | select SND_MPU401_UART | 112 | select SND_MPU401_UART |
113 | select SND_AC97_CODEC | 113 | select SND_AC97_CODEC |
114 | help | 114 | help |
115 | Say Y here to include support for Aureal Vortex 2 soundcards. | 115 | Say Y here to include support for Aureal Vortex 2 soundcards. |
116 | 116 | ||
117 | Supported features: Hardware Mixer, SRC, EQ and SPDIF output. | 117 | Supported features: Hardware Mixer, SRC, EQ and SPDIF output. |
118 | 3D support code is in place, but not yet useable. For more info, | 118 | 3D support code is in place, but not yet useable. For more info, |
119 | email the ALSA developer list, or <mjander@users.sourceforge.net>. | 119 | email the ALSA developer list, or <mjander@users.sourceforge.net>. |
120 | 120 | ||
121 | To compile this driver as a module, choose M here: the module | 121 | To compile this driver as a module, choose M here: the module |
122 | will be called snd-au8830. | 122 | will be called snd-au8830. |
123 | 123 | ||
124 | config SND_AZT3328 | 124 | config SND_AZT3328 |
125 | tristate "Aztech AZF3328 / PCI168 (EXPERIMENTAL)" | 125 | tristate "Aztech AZF3328 / PCI168 (EXPERIMENTAL)" |
126 | depends on SND && EXPERIMENTAL | 126 | depends on SND && EXPERIMENTAL |
@@ -135,10 +135,10 @@ config SND_AZT3328 | |||
135 | will be called snd-azt3328. | 135 | will be called snd-azt3328. |
136 | 136 | ||
137 | config SND_BT87X | 137 | config SND_BT87X |
138 | tristate "Bt87x Audio Capture" | 138 | tristate "Bt87x Audio Capture" |
139 | depends on SND | 139 | depends on SND |
140 | select SND_PCM | 140 | select SND_PCM |
141 | help | 141 | help |
142 | If you want to record audio from TV cards based on | 142 | If you want to record audio from TV cards based on |
143 | Brooktree Bt878/Bt879 chips, say Y here and read | 143 | Brooktree Bt878/Bt879 chips, say Y here and read |
144 | <file:Documentation/sound/alsa/Bt87x.txt>. | 144 | <file:Documentation/sound/alsa/Bt87x.txt>. |
@@ -209,7 +209,7 @@ config SND_CS46XX | |||
209 | config SND_CS46XX_NEW_DSP | 209 | config SND_CS46XX_NEW_DSP |
210 | bool "Cirrus Logic (Sound Fusion) New DSP support" | 210 | bool "Cirrus Logic (Sound Fusion) New DSP support" |
211 | depends on SND_CS46XX | 211 | depends on SND_CS46XX |
212 | default y | 212 | default y |
213 | help | 213 | help |
214 | Say Y here to use a new DSP image for SPDIF and dual codecs. | 214 | Say Y here to use a new DSP image for SPDIF and dual codecs. |
215 | 215 | ||
@@ -225,7 +225,7 @@ config SND_CS5535AUDIO | |||
225 | referred to as NS CS5535 IO or AMD CS5535 IO companion in | 225 | referred to as NS CS5535 IO or AMD CS5535 IO companion in |
226 | various literature. This driver also supports the CS5536 audio | 226 | various literature. This driver also supports the CS5536 audio |
227 | device. However, for both chips, on certain boards, you may | 227 | device. However, for both chips, on certain boards, you may |
228 | need to use ac97_quirk=hp_only if your board has physically | 228 | need to use ac97_quirk=hp_only if your board has physically |
229 | mapped headphone out to master output. If that works for you, | 229 | mapped headphone out to master output. If that works for you, |
230 | send lspci -vvv output to the mailing list so that your board | 230 | send lspci -vvv output to the mailing list so that your board |
231 | can be identified in the quirks list. | 231 | can be identified in the quirks list. |
@@ -468,11 +468,13 @@ config SND_FM801_TEA575X_BOOL | |||
468 | FM801 chip with a TEA5757 tuner connected to GPIO1-3 pins (Media | 468 | FM801 chip with a TEA5757 tuner connected to GPIO1-3 pins (Media |
469 | Forte SF256-PCS-02) into the snd-fm801 driver. | 469 | Forte SF256-PCS-02) into the snd-fm801 driver. |
470 | 470 | ||
471 | This will enable support for the old V4L1 API. | ||
472 | |||
471 | config SND_FM801_TEA575X | 473 | config SND_FM801_TEA575X |
472 | tristate | 474 | tristate |
473 | depends on SND_FM801_TEA575X_BOOL | 475 | depends on SND_FM801_TEA575X_BOOL |
474 | default SND_FM801 | 476 | default SND_FM801 |
475 | select VIDEO_DEV | 477 | select VIDEO_V4L1 |
476 | 478 | ||
477 | config SND_HDA_INTEL | 479 | config SND_HDA_INTEL |
478 | tristate "Intel HD Audio" | 480 | tristate "Intel HD Audio" |
diff --git a/usr/Makefile b/usr/Makefile index e93824269da2..5b31c0b61c76 100644 --- a/usr/Makefile +++ b/usr/Makefile | |||
@@ -35,6 +35,9 @@ quiet_cmd_initfs = GEN $@ | |||
35 | cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input) | 35 | cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input) |
36 | 36 | ||
37 | targets := initramfs_data.cpio.gz | 37 | targets := initramfs_data.cpio.gz |
38 | # do not try to update files included in initramfs | ||
39 | $(deps_initramfs): ; | ||
40 | |||
38 | $(deps_initramfs): klibcdirs | 41 | $(deps_initramfs): klibcdirs |
39 | # We rebuild initramfs_data.cpio.gz if: | 42 | # We rebuild initramfs_data.cpio.gz if: |
40 | # 1) Any included file is newer then initramfs_data.cpio.gz | 43 | # 1) Any included file is newer then initramfs_data.cpio.gz |