aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/ucc_geth.c
AgeCommit message (Collapse)Author
2009-09-11ucc_geth: Fix hangs after switching from full to half duplexAnton Vorontsov
MPC8360 QE UCC ethernet controllers hang when changing link duplex under a load (a bit of NFS activity is enough). PHY: mdio@e0102120:00 - Link is Up - 1000/Full sh-3.00# ethtool -s eth0 speed 100 duplex half autoneg off PHY: mdio@e0102120:00 - Link is Down PHY: mdio@e0102120:00 - Link is Up - 100/Half NETDEV WATCHDOG: eth0 (ucc_geth): transmit queue 0 timed out ------------[ cut here ]------------ Badness at c01fcbd0 [verbose debug info unavailable] NIP: c01fcbd0 LR: c01fcbd0 CTR: c0194e44 ... The cure is to disable the controller before changing speed/duplex and enable it afterwards. Though, disabling the controller might take quite a while, so we better not grab any spinlocks in adjust_link(). Instead, we quiesce the driver's activity, and only then disable the controller. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-09-11ucc_geth: Rearrange some code to avoid forward declarationsAnton Vorontsov
We'll need ugeth_disable() and ugeth_enable() calls earlier in the file, so rearrange some code to avoid forward declarations. The patch doesn't contain any functional changes. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Acked-by: Timur Tabi <timur@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-09-02Merge branch 'master' of ↵David S. Miller
master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 Conflicts: drivers/net/yellowfin.c
2009-08-30ucc_geth: Implement suspend/resume and Wake-On-LAN supportAnton Vorontsov
This patch implements suspend/resume and WOL support for UCC Ethernet driver. We support two wake up events: wake on PHY/link changes and wake on magic packet. In some CPUs (like MPC8569) QE shuts down during sleep, so magic packet detection is unusable, and also on resume we should fully reinitialize UCC structures. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-08-30ucc_geth: Remove UGETH_MAGIC_PACKET Kconfig symbol and codeAnton Vorontsov
This patch removes currently unused UGETH_MAGIC_PACKET Kconfig symbol and code, i.e. magic_packet_detection_{enable,disable} functions. The two functions each contain just two steps that we'll place into suspend/resume code path under CONFIG_PM. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-08-30ucc_geth: Factor out MAC initialization steps into a callAnton Vorontsov
This patch factors out MAC initialization into ucc_geth_init_mac() function that we'll use for suspend/resume. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-08-14drivers/net: fixed drivers that support netpoll use ndo_start_xmit()Dongdong Deng
The NETPOLL API requires that interrupts remain disabled in netpoll_send_skb(). The use of spin_lock_irq() and spin_unlock_irq() in the NETPOLL API callbacks causes the interrupts to get enabled and can lead to kernel instability. The solution is to use spin_lock_irqsave() and spin_unlock_restore() to prevent the irqs from getting enabled while in netpoll_send_skb(). Call trace: netpoll_send_skb() { -> local_irq_save(flags) ---> dev->ndo_start_xmit(skb, dev) ---> spin_lock_irq() ---> spin_unlock_irq() *******here would enable the interrupt. ... -> local_irq_restore(flags) } Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com> Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Acked-by: Bruce Ashfield <bruce.ashfield@windriver.com> Acked-by: Matt Mackall <mpm@selenic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-07-23Merge branch 'master' of ↵David S. Miller
master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 Conflicts: drivers/net/wireless/iwmc3200wifi/netdev.c net/wireless/scan.c
2009-07-22ucc_geth: Revive fixed link supportAnton Vorontsov
Since commit 0b9da337dca972e7a4144e298ec3adb8f244d4a4 ("Rework ucc_geth driver to use of_mdio infrastructure") the fixed-link support is broken. This patch fixes the support by removing !ug_info->phy_node check, and adds a call to of_phy_connect_fixed_link() if a phy is not attached to the MAC. Also, remove an old fixed-link code that we don't use any longer. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-07-07ucc_geth: Add support for skb recyclingAnton Vorontsov
We can reclaim transmitted skbs to use in the receive path, so-called skb recycling support. Also reorder ucc_geth_poll() steps, so that we'll clean tx ring firstly, thus maybe reclaim some skbs for rx. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-07-05net: use NETDEV_TX_OK instead of 0 in ndo_start_xmit() functionsPatrick McHardy
This patch is the result of an automatic spatch transformation to convert all ndo_start_xmit() return values of 0 to NETDEV_TX_OK. Some occurences are missed by the automatic conversion, those will be handled in a seperate patch. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-06-18Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6Linus Torvalds
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (55 commits) netxen: fix tx ring accounting netxen: fix detection of cut-thru firmware mode forcedeth: fix dma api mismatches atm: sk_wmem_alloc initial value is one net: correct off-by-one write allocations reports via-velocity : fix no link detection on boot Net / e100: Fix suspend of devices that cannot be power managed TI DaVinci EMAC : Fix rmmod error net: group address list and its count ipv4: Fix fib_trie rebalancing, part 2 pkt_sched: Update drops stats in act_police sky2: version 1.23 sky2: add GRO support sky2: skb recycling sky2: reduce default transmit ring sky2: receive counter update sky2: fix shutdown synchronization sky2: PCI irq issues sky2: more receive shutdown sky2: turn off pause during shutdown ... Manually fix trivial conflict in net/core/skbuff.c due to kmemcheck
2009-06-17net/ucc_geth: Add SGMII support for UCC GETH driverHaiying Wang
-- derived from reverted commit 047584ce94108012288554a5f84585d792cc7f8f -- reworked by Grant Likely to play nice with commit: "net: Rework ucc_geth driver to use of_mdio infrastructure" (0b9da337dca972e7a4144e298ec3adb8f244d4a4) Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-06-17Revert "net/ucc_geth: Add SGMII support for UEC GETH driver"Grant Likely
This reverts commit 047584ce94108012288554a5f84585d792cc7f8f. This patch meshes badly with "net: Rework ucc_geth driver to use of_mdio infrastructure" (0b9da337dca972e7a4144e298ec3adb8f244d4a4). Since most of the patch needs to be reworked, it is clearer to revert the patch and then apply the corrected version Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-06-15Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6Linus Torvalds
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1244 commits) pkt_sched: Rename PSCHED_US2NS and PSCHED_NS2US ipv4: Fix fib_trie rebalancing Bluetooth: Fix issue with uninitialized nsh.type in DTL-1 driver Bluetooth: Fix Kconfig issue with RFKILL integration PIM-SM: namespace changes ipv4: update ARPD help text net: use a deferred timer in rt_check_expire ieee802154: fix kconfig bool/tristate muckup bonding: initialization rework bonding: use is_zero_ether_addr bonding: network device names are case sensative bonding: elminate bad refcount code bonding: fix style issues bonding: fix destructor bonding: remove bonding read/write semaphore bonding: initialize before registration bonding: bond_create always called with default parameters x_tables: Convert printk to pr_err netfilter: conntrack: optional reliable conntrack event delivery list_nulls: add hlist_nulls_add_head and hlist_nulls_del ...
2009-06-03net/ucc_geth: Add SGMII support for UEC GETH driverHaiying Wang
Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-05-26net/ucc_geth: allow to set mac address on running deviceKevin Hao
Inspired by the patch for 8139too (bda6a15a). Currently we can't set mac address on a running ucc_geth device. But this is needed when you use this device as a bonding slave in bonding device in balance-alb mode. So add this feature for ucc_geth device. Signed-off-by: Kevin Hao <kexin.hao@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-05-19net/ucc_geth: Assign six threads to Rx for UECHaiying Wang
In the case the QE has 46 SNUMs for the threads to support four UCC Ethernet at 1000Base-T simultaneously. Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com> Acked-by: David S. Miller <davem@davemloft.net> Acked-by: Timur Tabi <timur@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2009-05-19net/ucc_geth: update riscTx and riscRx in ucc_gethHaiying Wang
Change the definition of riscTx and riscRx to unsigned integer instead of enum, and change their values to support 4 risc allocation if the qe has 4 RISC engines. Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2009-04-28net: Fix ucc_geth.c handling of fixed-link w/o phy-connection-type property.Grant Likely
Previous rework to ucc_geth.c to add of_mdio support (net: Rework ucc_geth driver to use of_mdio infrastructure) added a block of code which broke older openfirmware device trees which this case. This patch removes the offending blurb. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-04-27net: Rework ucc_geth driver to use of_mdio infrastructureGrant Likely
This patch simplifies the driver by making use of more common code. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Andy Fleming <afleming@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-04-23Merge branch 'master' of ↵David S. Miller
master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 Conflicts: net/iucv/af_iucv.c
2009-04-22ucc_geth.c: Fix upsmr setting in RMII modeHeiko Schocher
If using the UCC on a MPC8360 in RMII mode, don;t set UCC_GETH_UPSMR_RPM bit in the upsmr register. Signed-off-by: Heiko Schocher <hs@denx.de> Acked-by: Li Yang <leoli@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-04-21ucc_geth: Move freeing of TX packets to NAPI contextJoakim Tjernlund
This will make the system alot more responsive while ping flooding the ucc_geth ethernet interface. Also set NAPI weight to 64 as this is a common value. Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-04-02ucc_geth: Pass proper device to DMA routines, otherwise oops happensAnton Vorontsov
The driver should pass a device that actually specifies internal DMA ops, but currently it passes netdev's device, which is wrong and that causes following oops: Kernel BUG at c01c4df8 [verbose debug info unavailable] Oops: Exception in kernel mode, sig: 5 [#1] [...] NIP [c01c4df8] get_new_skb+0x7c/0xf8 LR [c01c4da4] get_new_skb+0x28/0xf8 Call Trace: [ef82be00] [c01c4da4] get_new_skb+0x28/0xf8 (unreliable) [ef82be20] [c01c4eb8] rx_bd_buffer_set+0x44/0x98 [ef82be40] [c01c62bc] ucc_geth_startup+0x11b0/0x147c [ef82be80] [c01c6674] ucc_geth_open+0xec/0x2a4 [ef82bea0] [c02288a4] dev_open+0xc0/0x11c [...] Fix this by passing of_device's device that specifies DMA ops in its archdata. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-04-02ucc_geth: Remove unused headerKumar Gala
Now that the driver is exclusively an of_platform driver we no longer use the structs and #defines in fsl_devices.h Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-03-29ucc_geth: Fix use-after-of_node_put() in ucc_geth_probe().David S. Miller
We can't put 'mdio' until after we've used it in the fsl_pq_mdio_bus_name() call. Also fix error return values. Signed-off-by: David S. Miller <davem@davemloft.net>
2009-03-27ucc_geth: Fix three oopses in PHY {de,}initialization codeAnton Vorontsov
When there are no free snums, UCC ethernet should gracefully fail, but currently it oopses this way: # ifconfig eth0 up fill_init_enet_entries: Can not get SNUM. ucc_geth_startup: Can not fill p_init_enet_param_shadow. eth0: Cannot configure net device, aborting. Unable to handle kernel paging request for data at address 0x00000190 Faulting instruction address: 0xc0294c88 Oops: Kernel access of bad area, sig: 11 [#1] [...] NIP [c0294c88] mutex_lock+0x0/0x1c LR [c01b6be8] phy_stop+0x20/0x70 Call Trace: [efb25da0] [efb2eb60] 0xefb2eb60 (unreliable) [efb25db0] [c01b2058] ucc_geth_stop+0x2c/0x8c [efb25dd0] [c01b4194] ucc_geth_open+0x48/0x27c [efb25df0] [c020eec0] dev_open+0xc0/0x118 [...] This is because the ucc_geth_stop() routine assumes that ugeth->phydev is always initialized by the ucc_geth_open(), while it is not in case of errors. If we add a check to the ucc_geth_stop(), then another oops pops up: Unable to handle kernel paging request for data at address 0x00000004 Faulting instruction address: 0xc01b46a4 Oops: Kernel access of bad area, sig: 11 [#1] [...] NIP [c01b46a4] adjust_link+0x20/0x1b4 LR [c01b770c] phy_state_machine+0xdc/0x44c Call Trace: [ef83bf10] [c021b388] linkwatch_schedule_work+0x74/0xf8 (unreliable) [ef83bf40] [c01b770c] phy_state_machine+0xdc/0x44c [ef83bf60] [c004c13c] run_workqueue+0xb8/0x148 [ef83bf90] [c004c870] worker_thread+0x70/0xd0 [ef83bfd0] [c00505fc] kthread+0x48/0x84 [ef83bff0] [c000f464] kernel_thread+0x4c/0x68 [...] That one happens because ucc_geth_stop() does not call phy_disconnect() and so phylib state machine is running without any idea that a MAC has just died. Also, when device tree specifies fixed-link, and CONFIG_FIXED_PHY is disabled, we'll get this oops: 0:01 not found eth2: Could not attach to PHY eth2: Cannot initialize PHY, aborting. Unable to handle kernel paging request for data at address 0x00000190 Faulting instruction address: 0xc02967d0 Oops: Kernel access of bad area, sig: 11 [#1] [...] NIP [c02967d0] mutex_lock+0x0/0x1c LR [c01b6bcc] phy_stop+0x20/0x70 Call Trace: [ef82be50] [efb6bb60] 0xefb6bb60 (unreliable) [ef82be60] [c01b2058] ucc_geth_stop+0x2c/0x8c [ef82be80] [c01b4194] ucc_geth_open+0x48/0x27c [ef82bea0] [c0210a04] dev_open+0xc0/0x118 [ef82bec0] [c020f85c] dev_change_flags+0x84/0x1ac [ef82bee0] [c037b768] ic_open_devs+0x168/0x2bc [ef82bf20] [c037ca98] ip_auto_config+0x90/0x28c [ef82bf60] [c0001b9c] do_one_initcall+0x34/0x1a0 [ef82bfd0] [c035e240] do_initcalls+0x38/0x58 [ef82bfe0] [c035e2c4] kernel_init+0x30/0x90 [ef82bff0] [c000f464] kernel_thread+0x4c/0x68 [...] And again, ucc_geth_stop() assumes that ugeth->phydev is there, while it isn't. This patch fixes all three oopses simply by rearranging some code: - In ucc_geth_open(): move init_phy() call to the beginning, so that we only call ucc_geth_stop() with a PHY attached; - Move phy_disconnect() call from ucc_geth_close() to ucc_geth_stop(), so that we'll always disconnect the PHY. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-03-24ucc_geth: Convert to net_device_opsJoakim Tjernlund
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-03-24ucc_geth: Fix build breakage caused by a mergeAnton Vorontsov
This patch fixes following build error: CC ucc_geth.o ucc_geth.c: In function 'ucc_geth_probe': ucc_geth.c:3644: error: implicit declaration of function 'uec_mdio_bus_name' make[2]: *** [ucc_geth.o] Error 1 Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-03-23ucc_geth: Fix merge error.David S. Miller
I left a merge failure unresolved, noticed by Stephen Rothwell. Signed-off-by: David S. Miller <davem@davemloft.net>
2009-03-23Merge branch 'master' of ↵David S. Miller
master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 Conflicts: drivers/net/ucc_geth.c
2009-03-22ucc_geth: Fix oops when using fixed-link supportAnton Vorontsov
commit b1c4a9dddf09fe99b8f88252718ac5b357363dc4 ("ucc_geth: Change uec phy id to the same format as gianfar's") introduced a regression in the ucc_geth driver that causes this oops when fixed-link is used: Unable to handle kernel paging request for data at address 0x00000000 Faulting instruction address: 0xc0151270 Oops: Kernel access of bad area, sig: 11 [#1] TMCUTU NIP: c0151270 LR: c0151270 CTR: c0017760 REGS: cf81fa60 TRAP: 0300 Not tainted (2.6.29-rc8) MSR: 00009032 <EE,ME,IR,DR> CR: 24024042 XER: 20000000 DAR: 00000000, DSISR: 20000000 TASK = cf81cba0[1] 'swapper' THREAD: cf81e000 GPR00: c0151270 cf81fb10 cf81cba0 00000000 c0272e20 c025f354 00001e80 cf86b08c GPR08: d1068200 cffffb74 06000000 d106c200 42024042 10085148 0fffd000 0ffc81a0 GPR16: 00000001 00000001 00000000 007ffeb0 00000000 0000c000 cf83f36c cf83f000 GPR24: 00000030 cf83f360 cf81fb20 00000000 d106c200 20000000 00001e80 cf83f360 NIP [c0151270] ucc_geth_open+0x330/0x1efc LR [c0151270] ucc_geth_open+0x330/0x1efc Call Trace: [cf81fb10] [c0151270] ucc_geth_open+0x330/0x1efc (unreliable) [cf81fba0] [c0187638] dev_open+0xbc/0x12c [cf81fbc0] [c0187e38] dev_change_flags+0x8c/0x1b0 This patch fixes the issue by removing offending (and somewhat duplicate) code from init_phy() routine, and changes _probe() function to use uec_mdio_bus_name(). Also, since we fully construct phy_bus_id in the _probe() routine, we no longer need ->phy_address and ->mdio_bus fields in ucc_geth_info structure. I wish the patch would be a bit shorter, but it seems like the only way to fix the issue in a sane way. Luckily, the patch has been tested with real PHYs and fixed-link, so no further regressions expected. Reported-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Tested-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-02-04netdev: Merge UCC and gianfar MDIO bus driversAndy Fleming
The MDIO bus drivers for the UCC and gianfar ethernet controllers are essentially the same. There's no reason to duplicate that much code. Signed-off-by: Andy Fleming <afleming@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-01-30Merge branch 'master' of ↵David S. Miller
master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 Conflicts: drivers/net/e1000/e1000_main.c
2009-01-29ucc_geth: Change uec phy id to the same format as gianfar'sHaiying Wang
The commit b31a1d8b41513b96e9c7ec2f68c5734cef0b26a4 ("gianfar: Convert gianfar to an of_platform_driver") changes the gianfar's phy id to the format like "mdio@xxxx:xx", but uec still uses the old format like "xxxxxxxx:xx". For the board whose UEC uses gianfar-mdio like MPC8568MDS, the phy can not be attached because of the incompatible phy id format. This patch changes uec's phy id to the same format as gianfar's. Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-01-21net: Remove redundant NAPI functionsBen Hutchings
Following the removal of the unused struct net_device * parameter from the NAPI functions named *netif_rx_* in commit 908a7a1, they are exactly equivalent to the corresponding *napi_* functions and are therefore redundant. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-01-11ucc_geth: use correct UCCE macrosTimur Tabi
The UCC Event Register (UCCE) already has unambigous macro definitions in qe.h, so we should not be defining our own in the UCC Ethernet driver. Removed unused local variable 'dev' from ucc_geth_poll(), which fixes a warning caused by commit 908a7a16b852ffd618a9127be8d62432182d81b4 ("net: Remove unused netdev arg from some NAPI interfaces."). Replaced in_be/out_be pairs with setbits32 or clrbits32, where applicable. Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-12-26ucc_geth: Eliminate the need for forward referencesAnton Vorontsov
This patch simply reorders some functions to eliminate the need for forward references. No other changes than that. Suggested-by: Timur Tabi <timur@freescale.com> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-12-22net: Remove unused netdev arg from some NAPI interfaces.Neil Horman
When the napi api was changed to separate its 1:1 binding to the net_device struct, the netif_rx_[prep|schedule|complete] api failed to remove the now vestigual net_device structure parameter. This patch cleans up that api by properly removing it.. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-12-18ucc_geth: Remove UGETH_FILTERING dead codeAnton Vorontsov
The code appears to be dead: nobody call these functions, plus build breaks when UGETH_FILTERING is enabled: ucc_geth.c:1848: warning: 'struct enet_addr' declared inside parameter list ucc_geth.c:1848: warning: its scope is only this definition or declaration, which is probably not what you want ucc_geth.c: In function 'ugeth_82xx_filtering_get_match_addr_in_hash': ucc_geth.c:1856: error: dereferencing pointer to incomplete type ucc_geth.c:1874: error: dereferencing pointer to incomplete type ucc_geth.c:1877: warning: return from incompatible pointer type ucc_geth.c: At top level: ucc_geth.c:1885: warning: 'struct enet_addr' declared inside parameter list ucc_geth.c: In function 'ugeth_82xx_filtering_add_addr_in_hash': ucc_geth.c:1894: error: dereferencing pointer to incomplete type ucc_geth.c:1909: warning: passing argument 2 of 'ugeth_82xx_filtering_get_match_addr_in_hash' from incompatible pointer type ucc_geth.c:1909: warning: assignment from incompatible pointer type ucc_geth.c:1918: error: dereferencing pointer to incomplete type ucc_geth.c: At top level: ucc_geth.c:1928: warning: 'struct enet_addr' declared inside parameter list ucc_geth.c: In function 'ugeth_82xx_filtering_clear_addr_in_hash': ucc_geth.c:1947: warning: passing argument 2 of 'ugeth_82xx_filtering_get_match_addr_in_hash' from incompatible pointer type ucc_geth.c:1947: warning: assignment from incompatible pointer type ucc_geth.c:1954: error: dereferencing pointer to incomplete type ucc_geth.c: At top level: ucc_geth.c:2060: warning: 'struct enet_addr' declared inside parameter list ucc_geth.c: In function 'ugeth_82xx_filtering_add_addr_in_paddr': ucc_geth.c:2064: error: dereferencing pointer to incomplete type ucc_geth.c:2073: error: dereferencing pointer to incomplete type ucc_geth.c:2075: warning: passing argument 2 of 'hw_add_addr_in_paddr' from incompatible pointer type make[2]: *** [ucc_geth.o] Error 1 The code is there since the driver was merged, and nobody seem to be interested in fixing or actually using it. If we ever want the filtering support, we can always revert the patch and fix it, but so far it just draws reader's attention. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-12-18ucc_geth: Fix IO memory (un)mapping codeAnton Vorontsov
The driver doesn't check ioremap() return value, and doesn't free the remapped memory. This patch fixes it. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-12-18ucc_geth: Cleanup repetitive ucc_geth_memclean() callsAnton Vorontsov
No need to call ucc_geth_memclean() so many times, just check for errors in ucc_geth_open(), and call ucc_geth_stop() in case of errors. The ucc_geth_stop() may be called anytime and will do the right thing. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-12-18ucc_geth: Fix IRQ freeing code in ucc_geth_open()Anton Vorontsov
open() routine calls stop() in case of errors, the function will try to free the requested IRQ. But we don't know if it was actually requested, so the code might issue bogus free_irq(0, dev) call. Fix this by rearranging the code so that now request_irq() is the last call in the open() routine, and move free_irq() into the close(). Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-12-18ucc_geth: Fix TX watchdog timeout handlingAnton Vorontsov
The timeout handling code is currently broken in several ways: - It calls stop() (which frees all the memory and IRQ), and then calls startup() (which won't re-request IRQ, neither it will re-init the Fast UCC structure). - It calls these routines from the softirq context, which is wrong, since stop() calls free_irq() (which might sleep) and startup() allocates things with GFP_KERNEL. - It won't soft-reset the PHY. We need the PHY reset for at least MPC8360E-MDS boards with Marvell 88E1111 PHY, the PHY won't recover from timeouts w/o the reset. So the patch fixes these problems by implementing the workqueue for the timeout handling, and there we fully re-open the device via close() and open() calls. The close/open paths do the right things, and I can see that the driver actually survive the timeouts. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-12-18ucc_geth: Fix endless loop in stop_{tx,rx} routinesAnton Vorontsov
Currently the routines wait for the various bits w/o an assumption that bits may never get set. When timeouts happen I see that these bits never get set and so the routines hang the kernel. With this patch we'll wait the graceful stop for 100 ms, and then will simply exit. There is nothing* we can do about that, but it's OK since we'll do full reset later. * Well, actually, there is also not-graceful variant for the TX stop, but specs says that we never should use it. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-11-10net: struct device - replace bus_id with dev_name(), dev_set_name()Kay Sievers
Acked-by: Marcel Holtmann <marcel@holtmann.org> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-11-03drivers/net: Kill now superfluous ->last_rx stores.David S. Miller
The generic packet receive code takes care of setting netdev->last_rx when necessary, for the sake of the bonding ARP monitor. Drivers need not do it any more. Some cases had to be skipped over because the drivers were making use of the ->last_rx value themselves. Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-24drivers/net: replace __FUNCTION__ with __func__Harvey Harrison
__FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-07-21ucc_geth: do not touch net queue in adjust_link phylib callbackAnton Vorontsov
If the net queue has not been started, we'll get this nice oops and non-working ethernet: ------------[ cut here ]------------ Kernel BUG at c01f4648 [verbose debug info unavailable] Oops: Exception in kernel mode, sig: 5 [#1] MPC836x RDK Modules linked in: NIP: c01f4648 LR: c01c0a10 CTR: c01c08e4 REGS: cf839e40 TRAP: 0700 Not tainted (2.6.26-05254-gc7b9969) MSR: 00021032 <ME,IR,DR> CR: 22042044 XER: 00000000 TASK = cf828c30[4] 'events/0' THREAD: cf838000 GPR00: c01c0a10 cf839ef0 cf828c30 c035ceb0 cf8469a0 00000064 00000000 00000000 GPR08: c035ceb0 00000001 00000001 cf99c280 22044044 7ca81020 0fffc000 00000000 GPR16: 0fff2544 0fff63c0 00000000 0fff78e0 0ffa5580 00000004 00000000 00000000 GPR24: 02082000 cf9d0000 d1068000 00009032 cf846800 cf846b80 00000001 00000014 NIP [c01f4648] __netif_schedule+0x28/0x8c LR [c01c0a10] adjust_link+0x12c/0x1e4 Call Trace: [cf839ef0] [c0380f50] 0xc0380f50 (unreliable) [cf839f10] [c01c0a10] adjust_link+0x12c/0x1e4 [cf839f40] [c01c2628] phy_state_machine+0x2e0/0x448 [cf839f60] [c00425e8] run_workqueue+0xc8/0x168 [cf839f90] [c0042c6c] worker_thread+0x70/0xd0 [cf839fd0] [c0046954] kthread+0x48/0x84 [cf839ff0] [c0012488] kernel_thread+0x44/0x60 Instruction dump: 7c0803a6 4e800020 3d20c036 9421ffe0 7c0802a6 7c681b78 3929ceb0 7c694a78 7d290034 90010024 bfa10014 5529d97e <0f090000> 39600002 38030024 7d200028 ---[ end trace a57d367843bd2904 ]--- Since the driver is using phylib (which is doing netif_carrier_on/off()), we should simply remove netif_tx_schedule_all() from adjust_link(). Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>