summaryrefslogtreecommitdiff
path: root/drivers/net
AgeCommit message (Collapse)Author
2015-05-08net: fec: setup right value for mdio hold timeUwe Kleine-König
The FEC modules used on i.MX28 and newer have a register to tune the MDIO output hold time that should be at least 10 ns. Up to now this value was not explicitly set and so resulted in less hold time if the fec clock was faster than 100 MHz. This was noticed on an i.MX28 machine that uses an input clock of ~150 Mhz which resulted in unreliable communication with a Marvell switch. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-05-08net: fec: fix unbalanced clk disable on driver unbindStefan Agner
When the driver is removed (e.g. using unbind through sysfs), the clocks get disabled twice, once on fec_enet_close and once on fec_drv_remove. Since the clocks are enabled only once, this leads to a warning: WARNING: CPU: 0 PID: 402 at drivers/clk/clk.c:992 clk_core_disable+0x64/0x68() Remove the call to fec_enet_clk_enable in fec_drv_remove to balance the clock enable/disable calls again. This has been introduce by e8fcfcd5684a ("net: fec: optimize the clock management to save power"). Signed-off-by: Stefan Agner <stefan@agner.ch> Acked-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-05-08net: fec: fix NULL pointer dereference in fec_enet_timeout_workHubert Feurstein
This patch initialises the fep->netdev pointer. This pointer was not initialised at all, but is used in fec_enet_timeout_work and in some error paths. Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-05-08MLK-10474 net: fec: remove frag number checkFugang Duan
Since TSO has no frag list, the frag number is zero. Remove the frag number check to fix kernel dump issue when SW TSO feature enable. Signed-off-by: Fugang Duan <B38611@freescale.com>
2015-05-08MLK-10410 net: fec: fix enet warning issue by suspend/resumeFugang Duan
When down eth0 on i.MX6SX platform and then do suspend/resume operation, there have one kernel dump. The patch fix the warning issue. After eth interface down, it is not necessary to init phydev to NULL since it do this in driver remove and eth open fucntion. Signed-off-by: Fugang Duan <B38611@freescale.com>
2015-05-08net: fec: fix receive VLAN CTAG HW acceleration issueFugang Duan
The current driver support receive VLAN CTAG HW acceleration feature (NETIF_F_HW_VLAN_CTAG_RX) through software simulation. There calls the api .skb_copy_to_linear_data_offset() to skip the VLAN tag, but there have overlap between the two memory data point range. The patch just fix the issue. V2: Michael Grzeschik suggest to use memmove() instead of skb_copy_to_linear_data_offset(). Reported-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-05-08MLK-10392-2 flexcan: inactive all message buffer before enable can deviceDong Aisheng
There may be possible valid and active messages in message buffer caused by the random data in memory. It will cause the CAN sends out the random message once it's up. So we have to initialize the MB memory and inactive all message buffers before enable the CAN device to avoid the accidently tranfser. Signed-off-by: Dong Aisheng <b29396@freescale.com>
2015-04-14MLK-10210 WIFI: ath6kl: Fixed the issue that warning messages were printed ↵Shenwei Wang
when uninstalling ath6kl_sdio after iperf test. When handing the command "ifconfig wlan0 down", the driver handler did not notify the disconnected event to the upper layer stack cfg80211, which would cause the relating resources unable to be released. A notification of disconnet event to cfg80211 was added when the driver was changed to the disconnect state. Signed-off-by: Shenwei Wang <shenwei.wang@freescale.com>
2015-04-14MLK-10211 can: flexcan: fix resume failed issueDong Aisheng
We can observe the following error during system resume. dpm_run_callback(): platform_pm_resume+0x0/0x4c returns -110 PM: Device 2090000.can failed to resume: error -110 It is caused by the flexcan is in disable state and the clock is disabled by default while the CAN is not up. During resume, the calling of flexcan_chip_enable will obviously fail due to no clock. The issue only happened when CAN device is not up. If CAN is up, clock is there and no issue will happen. Because the CAN is always in disabled state by default if it's not up. We don't have to disable it again during suspend and enable it after resume. This patch simply the suspend/resume to only enter/exit disabled mode if CAN is up. Signed-off-by: Dong Aisheng <b29396@freescale.com>
2015-04-14net: fec: fix the warning found by dma debugNimrod Andy
Enable kernel config "CONFIG_HAVE_DMA_API_DEBUG", FEC have kernel warning: [ 6.650444] fec 2188000.ethernet: DMA-API: device driver tries to free DMA memory it has not allocated [ 6.664289] Modules linked in: [ 6.667378] CPU: 0 PID: 3 Comm: ksoftirqd/0 Not tainted 3.19.0-rc4-00688-g8834016-dirty #150 [ 6.675841] Hardware name: Freescale i.MX6 SoloX (Device Tree) [ 6.681698] Backtrace: [ 6.684189] [<80011e3c>] (dump_backtrace) from [<80011fdc>] (show_stack+0x18/0x1c) [ 6.691789] r6:80890154 r5:00000000 r4:00000000 r3:00000000 [ 6.697533] [<80011fc4>] (show_stack) from [<806d2d88>] (dump_stack+0x80/0x9c) [ 6.704799] [<806d2d08>] (dump_stack) from [<8002a4e4>] (warn_slowpath_common+0x7c/0xb4) [ 6.712917] r5:00000445 r4:00000000 [ 6.716544] [<8002a468>] (warn_slowpath_common) from [<8002a5c0>] (warn_slowpath_fmt+0x38/0x40) [ 6.725265] r8:809a2ee8 r7:00000000 r6:00000000 r5:00000000 r4:00000042 [ 6.732087] [<8002a58c>] (warn_slowpath_fmt) from [<802d6268>] (check_unmap+0x86c/0x98c) [ 6.740202] r3:808c79bc r2:8089060c [ 6.743826] [<802d59fc>] (check_unmap) from [<802d65e4>] (debug_dma_unmap_page+0x80/0x88) [ 6.752029] r10:00000000 r9:00000000 r8:00000000 r7:00000001 r6:be12a410 r5:00000000 [ 6.759967] r4:00000042 [ 6.762538] [<802d6564>] (debug_dma_unmap_page) from [<80440248>] (fec_enet_rx_napi+0x7ec/0xb9c) [ 6.771345] r7:00000400 r6:be3e4000 r5:bf08fa20 r4:be036000 [ 6.777094] [<8043fa5c>] (fec_enet_rx_napi) from [<8056ae24>] (net_rx_action+0x134/0x324) [ 6.785297] r10:be089e60 r9:80998180 r8:ffff8d68 r7:0000012c r6:00000040 r5:00000001 [ 6.793239] r4:be036718 [ 6.795801] [<8056acf0>] (net_rx_action) from [<8002db24>] (__do_softirq+0x138/0x2d0) [ 6.803655] r10:00000003 r9:00000003 r8:80996378 r7:8099c080 r6:00000100 r5:8099c08c [ 6.811593] r4:00000000 [ 6.814157] [<8002d9ec>] (__do_softirq) from [<8002dd00>] (run_ksoftirqd+0x44/0x5c) [ 6.821836] r10:00000000 r9:00000000 r8:809b133c r7:00000000 r6:00000001 r5:00000000 [ 6.829775] r4:be027e80 [ 6.832346] [<8002dcbc>] (run_ksoftirqd) from [<80048290>] (smpboot_thread_fn+0x154/0x1c4) [ 6.840649] [<8004813c>] (smpboot_thread_fn) from [<80044780>] (kthread+0xdc/0xf8) [ 6.848224] r10:00000000 r8:00000000 r7:8004813c r6:be027e80 r5:be027ec0 r4:00000000 [ 6.856179] [<800446a4>] (kthread) from [<8000ebc8>] (ret_from_fork+0x14/0x2c) [ 6.863425] r7:00000000 r6:00000000 r5:800446a4 r4:be027ec0 [ 6.869156] ---[ end trace 861cf914d2461a8b ]--- There have one bug in .fec_enet_tx_queue() function to unmap the DMA memory: For SG or TSO, get one buffer descriptor and then unmap the related DMA memory, and then get the next buffer descriptor, loop to while() to check "TX_READY". If "TX_READY" bit still __IS__ existed in the BD (The next fraglist or next TSO packet is not transmited complitely), exit the current clean work. When the next work is triggered, it still repeat above step with the same BD. The potential issue is that unmap the same DMA memory for multiple times. The patch fix the clean work for SG and TSO packet. Reported-by: Anand Moon <moon.linux@yahoo.com> Reported-by: Christian Gmeiner <christian.gmeiner@gmail.com> Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14MLK-10131 flexcan: fix wakeup unwork issueDong Aisheng
Original code will always disable flexcan during suspend no matter whether wakeup feature is enabled. It's caused by merge issue when doing kernel upgrade. Fix it by removing that disable code. Signed-off-by: Dong Aisheng <b29396@freescale.com>
2015-04-14ENGR00320136 net: fec: fix rcv is not last issue when do suspend/resume testFugang Duan
When do suspend/resume stress test, some log shows "rcv is not +last". The issue is that enet suspend will disable phy clock, phy link down, after resume back, enet MAC redo initial and ready to tx/rx packet, but phy still is not ready which is doing auto-negotiation. When phy link is not up, don't schdule napi soft irq. (cherry-picked from commit 61b16b307663ac972bc6c80cc5b308c546396027) Signed-off-by: Fugang Duan <B38611@freescale.com>
2015-04-14net: fec: add Wake-on-LAN supportFugang Duan
Support for Wake-on-LAN using Magic Packet. ENET IP supports sleep mode in low power status, when system enter suspend status, Magic packet can wake up system even if all SOC clocks are gate. The patch doing below things: - flagging the device as a wakeup source for the system, as well as its Wake-on-LAN interrupt - prepare the hardware for entering WoL mode - add standard ethtool WOL interface - enable the ENET interrupt to wake us Tested on i.MX6q/dl sabresd, sabreauto boards, i.MX6SX arm2 boards. Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: Fix NAPI raceFugang Duan
Do camera capture test on i.MX6q sabresd board, and save the capture data to nfs rootfs. The command is: gst-launch-1.0 -e imxv4l2src device=/dev/video1 num-buffers=2592000 ! tee name=t ! queue ! imxv4l2sink sync=false t. ! queue ! vpuenc ! queue ! mux. pulsesrc num-buffers=3720937 blocksize=4096 ! 'audio/x-raw, rate=44100, channels=2' ! queue ! imxmp3enc ! mpegaudioparse ! queue ! mux. qtmux name=mux ! filesink location=video_recording_long.mov After about 10 hours running, there have net watchdog timeout kernel dump: ... WARNING: CPU: 0 PID: 0 at net/sched/sch_generic.c:264 dev_watchdog+0x2b4/0x2d8() NETDEV WATCHDOG: eth0 (fec): transmit queue 0 timed out CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.24-01051-gdb840b7 #440 [<80014e6c>] (unwind_backtrace) from [<800118ac>] (show_stack+0x10/0x14) [<800118ac>] (show_stack) from [<806ae3f0>] (dump_stack+0x78/0xc0) [<806ae3f0>] (dump_stack) from [<8002b504>] (warn_slowpath_common+0x68/0x8c) [<8002b504>] (warn_slowpath_common) from [<8002b558>] (warn_slowpath_fmt+0x30/0x40) [<8002b558>] (warn_slowpath_fmt) from [<8055e0d4>] (dev_watchdog+0x2b4/0x2d8) [<8055e0d4>] (dev_watchdog) from [<800352d8>] (call_timer_fn.isra.33+0x24/0x8c) [<800352d8>] (call_timer_fn.isra.33) from [<800354c4>] (run_timer_softirq+0x184/0x220) [<800354c4>] (run_timer_softirq) from [<8002f420>] (__do_softirq+0xc0/0x22c) [<8002f420>] (__do_softirq) from [<8002f804>] (irq_exit+0xa8/0xf4) [<8002f804>] (irq_exit) from [<8000ee5c>] (handle_IRQ+0x54/0xb4) [<8000ee5c>] (handle_IRQ) from [<80008598>] (gic_handle_irq+0x28/0x5c) [<80008598>] (gic_handle_irq) from [<800123c0>] (__irq_svc+0x40/0x74) Exception stack(0x80d27f18 to 0x80d27f60) 7f00: 80d27f60 0000014c 7f20: 8858c60e 0000004d 884e4540 0000004d ab7250d0 80d34348 00000000 00000000 7f40: 00000001 00000000 00000017 80d27f60 800702a4 80476e6c 600f0013 ffffffff [<800123c0>] (__irq_svc) from [<80476e6c>] (cpuidle_enter_state+0x50/0xe0) [<80476e6c>] (cpuidle_enter_state) from [<80476fa8>] (cpuidle_idle_call+0xac/0x154) [<80476fa8>] (cpuidle_idle_call) from [<8000f174>] (arch_cpu_idle+0x8/0x44) [<8000f174>] (arch_cpu_idle) from [<80064c54>] (cpu_startup_entry+0x100/0x158) [<80064c54>] (cpu_startup_entry) from [<80cd8a9c>] (start_kernel+0x304/0x368) ---[ end trace 09ebd32fb032f86d ]--- ... There might have a race in napi_schedule(), leaving interrupts disabled forever. After these patch, the case still work more than 40 hours running. Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: only enable mdio interrupt before phy device link upNimrod Andy
Before phy device link up, we only enable FEC mdio interrupt, which is more reasonable. Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: clear all interrupt events to support i.MX6SXNimrod Andy
For i.MX6SX FEC controller, there have interrupt mask and event field extension. To support all SOCs FEC, we clear all interrupt events during MAVC initial process. Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: reset fep link status in suspend functionNimrod Andy
On some i.MX6 serial boards, phy power and refrence clock are supplied or controlled by SOC. When do suspend/resume test, the power and clock are disabled, so phy device link down. For current driver, fep->link is still up status, which cause extra operation like below code. To avoid the dumy operation, we set fep->link to down when phy device is real down. ... if (fep->link) { napi_disable(&fep->napi); netif_tx_lock_bh(ndev); fec_stop(ndev); netif_tx_unlock_bh(ndev); napi_enable(&fep->napi); fep->link = phy_dev->link; status_change = 1; } ... Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14MLK-9919 net: fec: reinit MAC0 MII bus for MAC1 use after resume backFugang Duan
i.MX6SX-AI board has two enet MACs (MAC0 and MAC1), they share MAC0 MII bus. When PHY0 don't connect to enet MAC0, MAC0 mii bus probe phy0 failed, and the net interface is set to unattach mode. During suspend resume test, driver don't reinit MAC0 after resume back, so MII bus don't work that causes MAC1 also cannot access PHY1. The patch just is workaround that reinit MAC0 MII bus for MAC1 using. Signed-off-by: Fugang Duan <B38611@freescale.com>
2015-04-14net: fec: avoid kernal crash by NULL pointer when no phy connectionNimrod Andy
On i.MX6SX sabreauto board, when there have no phy daughter board connection, there have kernel crash by NULL pointer: fec 2188000.ethernet eth0: could not attach to PHY Unable to handle kernel NULL pointer dereference at virtual address 00000220 pgd = 80004000 [00000220] *pgd=00000000 Internal error: Oops: 5 [#1] PREEMPT SMP ARM Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.24-01042-g27eaeea-dirty #405 task: d8078000 ti: d8076000 task.ti: d8076000 PC is at mutex_lock+0x10/0x54 LR is at phy_start+0x14/0x68 pc : [<806ad4e4>] lr : [<803b0f90>] psr: 60000113 sp : d8077d80 ip : 00000000 fp : d83cc000 r10: 0000100c r9 : d83cc800 r8 : 00000000 r7 : d83bcd0c r6 : 00000200 r5 : 00000220 r4 : 00000220 r3 : 00000000 r2 : 00000000 r1 : d83bcd90 r0 : 00000220 Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 10c5387d Table: 8000404a DAC: 00000015 Process swapper/0 (pid: 1, stack limit = 0xd8076240) Stack: (0xd8077d80 to 0xd8078000) 7d80: 00000000 803b0f90 00000001 00000000 d83bc800 803be034 00000007 805c3fb4 7da0: 00000003 80d4e0bc 805efcb8 fffffff1 fffffff0 00000000 00000000 d8077dfc 7dc0: 0000000d 80d6ce80 80d126b0 800499c8 d83bc800 d83bc800 806f0f40 d83bc82c 7de0: 00000000 00000000 80d6ce80 80d126b0 0000016b 80540250 d8076008 d83bc800 7e00: 0000016b d83bc800 00001003 00000001 00001002 805404d4 d83bc800 00000120 7e20: 00001002 00001002 00000000 805405d4 d83bc800 00000001 80d126c0 00001002 7e40: 80dbc5dc 80d02024 00000000 806ae360 00000002 d6128420 d6127198 12400000 7e60: 00000000 00000000 00000002 d61271e8 00000000 12400000 d801674c 800e49f0 7e80: d6127198 d6124e58 00000000 80238848 d61271c4 00000000 00000001 d8016700 7ea0: 80dd2e00 80d752c0 80d752c0 80cfdaec 0000010c 80239430 806c2e90 d800f080 7ec0: d800f380 804e46b4 ffffffbc 80d15cb0 00000007 80d752c0 80d752c0 80d01e94 7ee0: 0000010c d8076030 00000000 800088cc 80dbaba4 80bd411c d80a6f00 806b1e04 7f00: 00000000 00000000 00000000 80125b84 00000000 80d2c56c 60000113 00000001 7f20: ef7ff9df 806c80cc 0000010c 80043f5c 80c95eb8 00000007 ef7ffa1d 00000007 7f40: 80d2c55c 80d15cb0 00000007 80d752c0 80d752c0 80ccc50c 0000010c 80d0a114 7f60: 80d0a10c 80cccc04 00000007 00000007 80ccc50c 806ae410 00000000 8004cb84 7f80: 80d17bc0 00000000 806a4bd4 00000000 00000000 00000000 00000000 00000000 7fa0: 00000000 806a4bdc 00000000 8000e5f8 00000000 00000000 00000000 00000000 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 1e79a7bb e5337f77 [<806ad4e4>] (mutex_lock) from [<803b0f90>] (phy_start+0x14/0x68) [<803b0f90>] (phy_start) from [<803be034>] (fec_enet_open+0x448/0x5dc) [<803be034>] (fec_enet_open) from [<80540250>] (__dev_open+0xa8/0x110) [<80540250>] (__dev_open) from [<805404d4>] (__dev_change_flags+0x88/0x170) [<805404d4>] (__dev_change_flags) from [<805405d4>] (dev_change_flags+0x18/0x48) [<805405d4>] (dev_change_flags) from [<80d02024>] (ip_auto_config+0x190/0xf94) [<80d02024>] (ip_auto_config) from [<800088cc>] (do_one_initcall+0xe8/0x144) [<800088cc>] (do_one_initcall) from [<80cccc04>] (kernel_init_freeable+0x104/0x1c8) [<80cccc04>] (kernel_init_freeable) from [<806a4bdc>] (kernel_init+0x8/0xec) [<806a4bdc>] (kernel_init) from [<8000e5f8>] (ret_from_fork+0x14/0x3c) Code: e92d4010 e3a03000 e1a04000 ee073fba (e1903f9f) Add phydev check to fix the issue. Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: init maximum receive buffer size for ring1 and ring2Fugang Duan
i.MX6SX fec support three rx ring1, the current driver lost to init ring1 and ring2 maximum receive buffer size, that cause receving frame date length error. The driver reports "rcv is not +last" error log in user case. Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: remove unused return value from swap_buffer()Lothar Waßmann
The return value of swap_buffer() is not used by any caller, thus remove it. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: simplify loop counter handling in swap_buffer()Lothar Waßmann
Eliminate the DIV_ROUND_UP() and change the loop counter increment to 4 instead. This results in saving 6 instructions in the functions assembly code. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: use swab32s() instead of cpu_to_be32()Lothar Waßmann
when swap_buffer() is being called, we know for sure, that we need to byte swap the data. Furthermore, this function is called for swapping data in both directions. Thus cpu_to_be32() is semantically not correct for all use cases. Use swab32s() to reflect this. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: improve access to quirk flags by copying them into ↵Lothar Waßmann
fec_enet_private struct Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: change type of 'bufdesc_ex' to boolFugang Duan
fep->bufdesc_ex is treated as a boolean value, thus declare it as such. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: fix regression on i.MX28 introduced by rx_copybreak supportLothar Waßmann
commit 1b7bde6d659d ("net: fec: implement rx_copybreak to improve rx performance") introduced a regression for i.MX28. The swap_buffer() function doing the endian conversion of the received data on i.MX28 may access memory beyond the actual packet size in the DMA buffer. fec_enet_copybreak() does not copy those bytes, so that the last bytes of a packet may be filled with invalid data after swapping. This will likely lead to checksum errors on received packets. E.g. when trying to mount an NFS rootfs: UDP: bad checksum. From 192.168.1.225:111 to 192.168.100.73:44662 ulen 36 Do the byte swapping and copying to the new skb in one go if necessary. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Tested-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14MLK-9786 net: fec: Add busfreq support to the driverFugang Duan
Add request_bus_freq() and release_bus_freq() calls to the various drivers to ensure that the DDR and AHB are the requested frequency before the driver starts its task. Signed-off-by: Fugang Duan <B38611@freescale.com>
2015-04-14net: fec: fix suspend broken on multiple MACs silliconsFugang Duan
On i.MX6SX sdb platform, there has two same enet MACs, after system up, just eth0 is up, and then do suspend/resume test: [ 50.437967] PM: Syncing filesystems ... done. [ 50.476924] Freezing user space processes ... (elapsed 0.005 seconds) done. [ 50.490093] Freezing remaining freezable tasks ... (elapsed 0.004 seconds) done. [ 50.559771] ------------[ cut here ]------------ [ 50.564453] WARNING: CPU: 0 PID: 575 at drivers/clk/clk.c:851 __clk_disable+0x60/0x6c() [ 50.572475] Modules linked in: [ 50.575578] CPU: 0 PID: 575 Comm: sh Not tainted 3.18.0-rc2-next-20141031-00007-gf61135b #21 [ 50.584031] Backtrace: [ 50.586550] [<80011ecc>] (dump_backtrace) from [<8001206c>] (show_stack+0x18/0x1c) [ 50.594136] r6:808a7a54 r5:00000000 r4:00000000 r3:00000000 [ 50.599920] [<80012054>] (show_stack) from [<806ab3c0>] (dump_stack+0x80/0x9c) [ 50.607187] [<806ab340>] (dump_stack) from [<8002a3e8>] (warn_slowpath_common+0x6c/0x8c) [ 50.615294] r5:00000353 r4:00000000 [ 50.618940] [<8002a37c>] (warn_slowpath_common) from [<8002a42c>] (warn_slowpath_null+0x24/0x2c) [ 50.627738] r8:00000000 r7:be144c44 r6:be015600 r5:80070013 r4:be015600 [ 50.634573] [<8002a408>] (warn_slowpath_null) from [<804f8d4c>] (__clk_disable+0x60/0x6c) [ 50.642777] [<804f8cec>] (__clk_disable) from [<804f8e5c>] (clk_disable+0x2c/0x38) [ 50.650359] r4:be015600 r3:00000000 [ 50.654006] [<804f8e30>] (clk_disable) from [<80420ab4>] (fec_enet_clk_enable+0xc4/0x258) [ 50.662196] r5:be3cb620 r4:be3cb000 [ 50.665838] [<804209f0>] (fec_enet_clk_enable) from [<80421178>] (fec_suspend+0x30/0x180) [ 50.674026] r7:be144c44 r6:be144c10 r5:8037f5a4 r4:be3cb000 [ 50.679802] [<80421148>] (fec_suspend) from [<8037f5d8>] (platform_pm_suspend+0x34/0x64) [ 50.687906] r10:00000000 r9:00000000 r8:00000000 r7:be144c44 r6:be144c10 r5:8037f5a4 [ 50.695852] r4:be144c10 r3:80421148 [ 50.699511] [<8037f5a4>] (platform_pm_suspend) from [<8038784c>] (dpm_run_callback.isra.14+0x34/0x6c) [ 50.708764] [<80387818>] (dpm_run_callback.isra.14) from [<80387f00>] (__device_suspend+0x12c/0x2a4) [ 50.717909] r9:8098ec8c r8:80973bec r6:00000002 r5:811c7038 r4:be144c10 [ 50.724746] [<80387dd4>] (__device_suspend) from [<803894fc>] (dpm_suspend+0x64/0x224) [ 50.732675] r8:80973bec r7:be144c10 r6:8098ec24 r5:811c7038 r4:be144cc4 [ 50.739509] [<80389498>] (dpm_suspend) from [<8038999c>] (dpm_suspend_start+0x60/0x68) [ 50.747438] r10:8082fa24 r9:00000000 r8:00000004 r7:00000003 r6:00000000 r5:8116ec80 [ 50.755386] r4:00000002 [ 50.757969] [<8038993c>] (dpm_suspend_start) from [<800679d8>] (suspend_devices_and_enter+0x90/0x3ec) [ 50.767202] r4:00000003 r3:8116eca0 [ 50.770843] [<80067948>] (suspend_devices_and_enter) from [<80067f40>] (pm_suspend+0x20c/0x2a4) [ 50.779553] r8:00000004 r7:00000003 r6:00000000 r5:8116ec8c r4:00000003 [ 50.786394] [<80067d34>] (pm_suspend) from [<80066858>] (state_store+0x70/0xc0) [ 50.793718] r6:8116ec90 r5:00000003 r4:bd88a800 r3:0000006d [ 50.799496] [<800667e8>] (state_store) from [<802b0384>] (kobj_attr_store+0x1c/0x28) [ 50.807251] r10:bd399f78 r8:00000000 r7:bd88a800 r6:bd88a800 r5:00000004 r4:bd085680 [ 50.815219] [<802b0368>] (kobj_attr_store) from [<80153090>] (sysfs_kf_write+0x54/0x58) [ 50.823252] [<8015303c>] (sysfs_kf_write) from [<80151fd8>] (kernfs_fop_write+0xd0/0x194) [ 50.831441] r6:00000004 r5:bd08568c r4:bd085680 r3:8015303c [ 50.837220] [<80151f08>] (kernfs_fop_write) from [<800eddb4>] (vfs_write+0xb8/0x1a8) [ 50.844975] r10:00000000 r9:00000000 r8:00000000 r7:bd399f78 r6:01336408 r5:00000004 [ 50.852924] r4:bc584dc0 [ 50.855505] [<800edcfc>] (vfs_write) from [<800ee0b8>] (SyS_write+0x48/0x88) [ 50.862567] r10:00000000 r8:00000000 r7:01336408 r6:00000004 r5:bc584dc0 r4:bc584dc0 [ 50.870537] [<800ee070>] (SyS_write) from [<8000eb00>] (ret_fast_syscall+0x0/0x48) [ 50.878120] r9:bd398000 r8:8000ecc4 r7:00000004 r6:76f42b48 r5:01336408 r4:00000004 [ 50.885983] ---[ end trace 7545115d752a316a ]--- [ 50.890765] ------------[ cut here ]------------ The root cause is that eth1 is not opened and clock is not enabled, and .suspend() still call .fec_enet_clk_enable() to disable clock. To avoid the broken, let it check network device up status by calling .netif_running() before disable/enable clocks. Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14MLK-9716 net: fec: Fix the kernel panic issue on i.MX6SL-EVK board.Luwei Zhou
The i.MX6SL-EVK FEC IP doesn't support PTP feature. After adding PPS support, irq handler will invoke fec_check_pps_status function. We need to add a condition judge. Unable to handle kernel NULL pointer dereference at virtual address 000000a8 pgd = 80004000 [000000a8] *pgd=00000000 Internal error: Oops: 17 [#1] PREEMPT SMP ARM Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.17-00946-g1c543fd #7 task: 80cc8028 ti: 80cbc000 task.ti: 80cbc000 PC is at ptp_clock_event+0x144/0x190 LR is at __getnstimeofday+0x3c/0x140 pc : [<8044f4f8>] lr : [<8006e148>] psr: 60000193 sp : 80cbde30 ip : 5447606f fp : 00000001 r10: 80cbde58 r9 : 80d152c5 r8 : 00000000 r7 : 088000f7 r6 : 00000000 r5 : 00000608 r4 : ab1cf4c0 r3 : 00000002 r2 : 3b9ac9ff r1 : 80cbde30 r0 : 00000000 Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 10c5387d Table: a8d8804a DAC: 00000015 Process swapper/0 (pid: 0, stack limit = 0x80cbc240) Stack: (0x80cbde30 to 0x80cbe000) de20: 5447606f 0b0b3ebd 00000001 ab1cf4c0 de40: 00000608 00000000 088000f7 80cc48c0 ab00df00 803b0744 00000002 60000193 de60: 80cc48c0 8002e708 ab1cf000 02000000 00000001 ab1cf4c0 00000092 803abbc0 de80: 803abaac ab2d0f80 ab00df5c 00000000 00000000 80063808 00000002 e6484c37 dea0: e6484c37 ab00df00 ab00df5c ab2d0f80 00000092 00000000 80d152c3 ab7400d4 dec0: 00000000 8006398c ab00df00 ab00df5c 00000064 80066840 00000092 80cb8e54 dee0: 80cbc000 800631ec 80cc4c34 8000eed4 c080210c 80cc4da0 80cbdf20 c0802100 df00: 80ccaa1c 80008574 8006e830 80460f9c 60000113 ffffffff 80cbdf54 80012300 df20: 80cbdf68 3b9aca00 e6483614 00000002 e6429e70 00000002 ab7400d0 00000001 df40: 80ccaa1c 80d152c3 ab7400d4 00000000 0000001a 80cbdf68 8006e830 80460f9c df60: 60000113 ffffffff e6483614 00000002 80cbc000 80d6ede4 00000001 ab7400d0 df80: 80cbc000 80d6ede4 00000001 80461124 00000000 80cbc000 00000000 80cc49a4 dfa0: 8065b50c 80d152c3 00000001 8000f1e4 00000000 80062f18 80cab938 80c6eaa0 dfc0: ffffffff ffffffff 80c6e57c 00000000 00000000 80cab938 00000000 10c5387d dfe0: 80cc4928 80cab934 80cc90b0 8000406a 00000000 80008074 00000000 00000000 [<8044f4f8>] (ptp_clock_event) from [<803b0744>] (fec_ptp_check_pps_event+0xd4/0xe4) [<803b0744>] (fec_ptp_check_pps_event) from [<803abbc0>] (fec_enet_interrupt+0x114/0x16c) [<803abbc0>] (fec_enet_interrupt) from [<80063808>] (handle_irq_event_percpu+0x50/0x198) [<80063808>] (handle_irq_event_percpu) from [<8006398c>] (handle_irq_event+0x3c/0x5c) [<8006398c>] (handle_irq_event) from [<80066840>] (handle_fasteoi_irq+0x98/0x158) [<80066840>] (handle_fasteoi_irq) from [<800631ec>] (generic_handle_irq+0x20/0x30) [<800631ec>] (generic_handle_irq) from [<8000eed4>] (handle_IRQ+0x4c/0xb0) [<8000eed4>] (handle_IRQ) from [<80008574>] (gic_handle_irq+0x28/0x5c) [<80008574>] (gic_handle_irq) from [<80012300>] (__irq_svc+0x40/0x74) Exception stack(0x80cbdf20 to 0x80cbdf68) df20: 80cbdf68 3b9aca00 e6483614 00000002 e6429e70 00000002 ab7400d0 00000001 df40: 80ccaa1c 80d152c3 ab7400d4 00000000 0000001a 80cbdf68 8006e830 80460f9c df60: 60000113 ffffffff [<80012300>] (__irq_svc) from [<80460f9c>] (cpuidle_enter_state+0x50/0xe8) [<80460f9c>] (cpuidle_enter_state) from [<80461124>] (cpuidle_idle_call+0xf0/0x160) [<80461124>] (cpuidle_idle_call) from [<8000f1e4>] (arch_cpu_idle+0x8/0x44) [<8000f1e4>] (arch_cpu_idle) from [<80062f18>] (cpu_startup_entry+0x60/0x150) [<80062f18>] (cpu_startup_entry) from [<80c6eaa0>] (start_kernel+0x300/0x364) Code: eaffffbc e1a0000d ebf07d11 e1a0100d (e59800a8) ---[ end trace 085ff044896a7d08 ]--- Kernel panic - not syncing: Fatal exception in interrupt Tested-by: Bai Ping <b51503@freescale.com> Signed-off-by: Luwei Zhou <b45643@freescale.com>
2015-04-14net: fec: ptp: Enable PPS output based on ptp clockLuwei Zhou
FEC ptp timer has 4 channel compare/trigger function. It can be used to enable pps output. The pulse would be ouput high exactly on N second. The pulse ouput high on compare event mode is used to produce pulse per second. The pulse width would be one cycle based on ptp timer clock source.Since 31-bit ptp hardware timer is used, the timer will wrap more than 2 seconds. We need to reload the compare compare event about every 1 second. Signed-off-by: Luwei Zhou <b45643@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14ptp: drivers: set the number of programmable pins.Richard Cochran
This patch updates the many PTP Hardware Clock drivers with the newly introduced field that advertises the number of programmable pins. Some of these devices do have programmable pins, but the implementation will have to wait for follow on patches. Signed-off-by: Richard Cochran <richardcochran@gmail.com> Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: ptp: Use hardware algorithm to adjust PTP counter.Luwei Zhou
The FEC IP supports hardware adjustment for ptp timer. Refer to the description of ENET_ATCOR and ENET_ATINC registers in the spec about the hardware adjustment. This patch uses hardware support to adjust the ptp offset and frequency on the slave side. Signed-off-by: Luwei Zhou <b45643@freescale.com> Signed-off-by: Frank Li <Frank.Li@freescale.com> Signed-off-by: Fugang Duan <b38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: ptp: Use the 31-bit ptp timer.Luwei Zhou
When ptp switches from software adjustment to hardware ajustment, linux ptp can't converge. It is caused by the IP limit. Hardware adjustment logcial have issue when ptp counter runs over 0x80000000(31 bit counter). The internal IP reference manual already remove 32bit free-running count support. This patch replace the 32-bit PTP timer with 31-bit. Signed-off-by: Luwei Zhou <b45643@freescale.com> Signed-off-by: Frank Li <Frank.Li@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: Fix sparse warnings with different lock contexts for basic blockNimrod Andy
reproduce: make ARCH=arm C=1 2>fec.txt drivers/net/ethernet/freescale/fec_main.o cat fec.txt sparse warnings: drivers/net/ethernet/freescale/fec_main.c:2916:12: warning: context imbalance in 'fec_set_features' - different lock contexts for basic block Christopher Li suggest to change as below: if (need_lock) { lock(); do_something_real(); unlock(); } else { do_something_real(); } Reported-by: Fabio Estevam <festevam@gmail.com> Suggested-by: Christopher Li <sparse@chrisli.org> Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14MLK-9691 net: fec: call .pm_qos_remove_request() in .ndo_stop() callbackFugang Duan
Call .pm_qos_remove_request() in .ndo_stop() callback to avoid kernel warning during enet open/close test. Signed-off-by: Fugang Duan <B38611@freescale.com>
2015-04-14ENGR00301115 net: fec_ptp: fix convergence issue to support IXXAT and ↵Fugang Duan
LinuxPTP stack IEEE 1588 module has one hw issue in capturing the ATVR register. According to the user manual it is: ENET0->ATCR |= ENET_ATCR_CAPTURE_MASK; while(ENET0->ATCR & ENET_ATCR_CAPTURE_MASK); ts_counter_ns = ENET0->ATVR; Incorrect behavior for ENET_ATCR[Capture and Restart Bits]. These bits will always read a value zero. According to SPEC, when these bits are set to 1'b1, these should hold value 1'b1 until the counter value is capture in the register clock domain. Unfortunately there is a bug with the way the bit "ENET_ATCR_CAPTURE" clears. So need something like: ENET0->ATCR |= ENET_ATCR_CAPTURE_MASK; wait(); ts_counter_ns = ENET0->ATVR; The wait-time to be at least 6 clock cycle of the slower clock between the register clock and the 1588 clock. The 1588 ts_clk is 25Mhz, register clock is 66Mhz, so the wait-time must be greater than 240ns (40ns * 6). The workaround is that adding 1us delay before read ATVR. Signed-off-by: Fugang Duan <B38611@freescale.com> (cherry picked from commit d4601299b22de03b6dd28baea4643e04f6a41942)
2015-04-14ENGR00299323-10 net:fec: add enet AVB Ubuntu Gstreamer demo supportFugang Duan
Support Gstreamer AVB demo support. ring1 -> ClassA, ring2 -> ClassB, ring0 -> Best Effort For QoS: ring1 > ring2 > ring0 For bandwidth reverse: 50% bandwidth -> ClassA 33% bandwidth -> ClassB 17% bandwidth -> Best effort queue In general, ClassA run audio, ClassB run video. Since AVB demo use big bandwidth streaming, video cost more than 33Mbps bandwidth, and with Qos limitation: ClassA >= ClassB > Best effort, so we have to change ring2 bandwidth equal to ring1 bandwidth (50%). After validate on FPGA, AVB demo can work fine for audio and video. Signed-off-by: Fugang Duan <B38611@freescale.com> (cherry picked from commit 93d6579a7b3d2dafa721c835df5d5f7d30ed386e)
2015-04-14fec: Fix fec_enet_alloc_buffers() error pathFabio Estevam
When fec_enet_alloc_buffers() fails we should better undo the previous actions, which consists of: disabling the FEC clocks and putting the FEC pins into inactive state. The error path for fec_enet_mii_probe() is kept unchanged. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: fix build error at m68k platformFrank Li
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 1b7bde6d659d30f171259cc2dfba8e5dab34e735 make.cross ARCH=m68k m5275evb_defconfig make.cross ARCH=m68k All error/warnings: drivers/net/ethernet/freescale/fec_main.c: In function 'fec_enet_rx_queue': >> drivers/net/ethernet/freescale/fec_main.c:1470:3: error: implicit declaration of function 'prefetch' [-Werror=implicit-function-declaration] prefetch(skb->data - NET_IP_ALIGN); ^ cc1: some warnings being treated as errors missed included prefetch.h Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Frank Li <Frank.Li@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: implement rx_copybreak to improve rx performanceNimrod Andy
- Copy short frames and keep the buffers mapped, re-allocate skb instead of memory copy for long frames. - Add support for setting/getting rx_copybreak using generic ethtool tunable Changes V3: * As Eric Dumazet's suggestion that removing the copybreak module parameter and only keep the ethtool API support for rx_copybreak. Changes V2: * Implements rx_copybreak * Rx_copybreak provides module parameter to change this value * Add tunable_ops support for rx_copybreak Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: Frank Li <Frank.Li@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: free resource after phy probe failedNimrod Andy
Free memory and disable all related clocks when there has no phy connection or phy probe failed. Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: align rx data buffer size for dma map/unmapNimrod Andy
Align allocated rx data buffer size for dma map/unmap, otherwise kernel print warning when enable DMA_API_DEBUG. Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: remove the ERR006358 workaround for imx6sx enetNimrod Andy
Remove the ERR006358 workaround for imx6sx enet since the hw issue was fixed on the SOC. Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: Add Ftype to BD to distiguish three tx queues for AVBNimrod Andy
The current driver loss Ftype field init for BD, which cause tx queue #1 and #2 cannot work well. Add Ftype field to BD to distiguish three queues for AVB: 0 -> Best Effort 1 -> ClassA 2 -> ClassB Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: fix build error at m68k platformFrank Li
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 4d494cdc92b3b9a0f5fb9e1560810fa27d5a0489 make.cross ARCH=m68k m5272c3_defconfig make.cross ARCH=m68k drivers/net/ethernet/freescale/fec.h:262:0: warning: "FEC_R_DES_START" redefined #define FEC_R_DES_START(X) ((X == 1) ? FEC_R_DES_START_1 : \ ^ drivers/net/ethernet/freescale/fec.h:158:0: note: this is the location of the previous definition #define FEC_R_DES_START 0x3d0 /* Receive descriptor ring */ ^ drivers/net/ethernet/freescale/fec.h:265:0: warning: "FEC_X_DES_START" redefined #define FEC_X_DES_START(X) ((X == 1) ? FEC_X_DES_START_1 : \ ... Signed-off-by: Frank Li <Frank.Li@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: ethernet: freescale: fec_main.c: Cleaning up missing null-terminate in ↵Rickard Strandqvist
conjunction with strncpy Replacing strncpy with strlcpy to avoid strings that lacks null terminate. Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: use container_of to resolve bufdesc_ex from bufdescFabian Frederick
Use container_of instead of casting first structure member. ARM cross-compiled but untested. Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14fec: Remove fec_enet_select_queue()Fabio Estevam
Sparse complains about fec_enet_select_queue() not being static. Feedback from David Miller [1] was to remove this function instead of making it static: "Please just delete this function. It's overriding code which does exactly the same thing. Actually, more precisely, this code is duplicating code in a way that bypasses many core facilitites of the networking. For example, this override means that socket based flow steering, XPS, etc. are all not happening on these devices. Without ->ndo_select_queue(), the flow dissector does __netdev_pick_tx which is exactly what you want to happen." [1] http://www.spinics.net/lists/netdev/msg297653.html Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: fix code identationNimrod Andy
There have extra identation before .skb_copy_to_linear_data_offset(), this patch just remove the identation. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-04-14net: fec: Workaround for imx6sx enet tx hang when enable three queuesFugang Duan
When enable three queues on imx6sx enet, and then do tx performance test with iperf tool, after some time running, tx hang. Found that: If uDMA is running, software set TDAR may cause tx hang. If uDMA is in idle, software set TDAR don't cause tx hang. There is a TDAR race condition for mutliQ when the software sets TDAR and the UDMA clears TDAR simultaneously or in a small window (2-4 cycles). This will cause the udma_tx and udma_tx_arbiter state machines to hang. The issue exist at i.MX6SX enet IP. So, the Workaround is checking TDAR status four time, if TDAR cleared by hardware and then write TDAR, otherwise don't set TDAR. The patch is only one Workaround for the issue ERR007885. Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: Frank Li <Frank.Li@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>