1. 26 8月, 2015 1 次提交
    • R
      net: fec: use reinit_completion() in mdio accessor functions · aac27c7a
      Russell King 提交于
      Rather than re-initialising the entire completion on every mdio access,
      use reinit_completion() which only resets the completion count.  This
      avoids possible reinitialisation of the contained spinlock and waitqueue
      while they may be in use (eg, mid-completion.)
      
      Such an event could occur if there's a long delay in interrupt handling
      causing the mdio accessor to time out, then a second access comes in
      while the interrupt handler on a different CPU has called complete().
      Another scenario where this has been observed is while locking has
      been missing at the phy layer, allowing concurrent attempts to access
      the MDIO bus.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aac27c7a
  2. 13 8月, 2015 1 次提交
  3. 11 8月, 2015 1 次提交
    • K
      net: fec: fix the race between xmit and bdp reclaiming path · c4bc44c6
      Kevin Hao 提交于
      When we transmit a fragmented skb, we may run into a race like the
      following scenario (assume txq->cur_tx is next to txq->dirty_tx):
                 cpu 0                                          cpu 1
        fec_enet_txq_submit_skb
          reserve a bdp for the first fragment
          fec_enet_txq_submit_frag_skb
             update the bdp for the other fragment
             update txq->cur_tx
                                                         fec_enet_tx_queue
                                                           bdp = fec_enet_get_nextdesc(txq->dirty_tx, fep, queue_id);
                                                           This bdp is the bdp reserved for the first segment. Given
                                                           that this bdp BD_ENET_TX_READY bit is not set and txq->cur_tx
                                                           is already pointed to a bdp beyond this one. We think this is a
                                                           completed bdp and try to reclaim it.
          update the bdp for the first segment
          update txq->cur_tx
      
      So we shouldn't update the txq->cur_tx until all the update to the
      bdps used for fragments are performed. Also add the corresponding
      memory barrier to guarantee that the update to the bdps, dirty_tx and
      cur_tx performed in the proper order.
      Signed-off-by: NKevin Hao <haokexin@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c4bc44c6
  4. 07 8月, 2015 1 次提交
  5. 27 7月, 2015 3 次提交
  6. 16 7月, 2015 1 次提交
  7. 09 7月, 2015 1 次提交
    • A
      net: fec: Ensure clocks are enabled while using mdio bus · 6c3e921b
      Andrew Lunn 提交于
      When a switch is attached to the mdio bus, the mdio bus can be used
      while the interface is not open. If the IPG clock is not enabled, MDIO
      reads/writes will simply time out.
      
      Add support for runtime PM to control this clock. Enable/disable this
      clock using runtime PM, with open()/close() and mdio read()/write()
      function triggering runtime PM operations. Since PM is optional, the
      IPG clock is enabled at probe and is no longer modified by
      fec_enet_clk_enable(), thus if PM is not enabled in the kernel, it is
      guaranteed the clock is running when MDIO operations are performed.
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Acked-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6c3e921b
  8. 29 6月, 2015 1 次提交
    • G
      net: fec: don't access RACC register when not available · 18803495
      Greg Ungerer 提交于
      Not all silicon implementations of the Freescale FEC hardware module
      have the RACC (Receive Accelerator Function) register, so we should not
      be trying to access it on those that don't. Currently none of the ColdFire
      based parts with a FEC have it.
      
      Support for RACC was introduced by commit 4c09eed9 ("net: fec: Enable imx6
      enet checksum acceleration"). A fix was introduced in commit d1391930
      ("net: fec: Fix build for MCF5272") that disables its use on the ColdFire
      M5272 part, but it doesn't fix the general case of other ColdFire parts.
      
      To fix we create a quirk flag, FEC_QUIRK_HAS_RACC, and check it before
      working with the RACC register.
      Signed-off-by: NGreg Ungerer <gerg@uclinux.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      18803495
  9. 23 6月, 2015 1 次提交
    • N
      net: fec: init MAC prior to mii bus probe · 55dd2753
      Nimrod Andy 提交于
      Below case causes mii bus probe failed:
      ifconfig eth0 down -> suspend/resume with Mega/fax mix off -> ifconfig eth0 up
      
      In i.MX6SX/i.MX7D chip, Mega/fast mix off feature is supported that means most of
      SOC power will be off including ENET MAC for power saving. Once ENET MAC power
      off, all initialized MAC registers reset to default, so in the case, it must
      init MAC prior to mii bus probe.
      Signed-off-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      55dd2753
  10. 12 5月, 2015 1 次提交
  11. 01 5月, 2015 1 次提交
  12. 30 3月, 2015 1 次提交
  13. 14 3月, 2015 1 次提交
  14. 11 3月, 2015 1 次提交
  15. 06 3月, 2015 1 次提交
  16. 05 3月, 2015 1 次提交
    • F
      net: fec: fix rcv is not last issue when do suspend/resume test · 61615cd2
      Fugang 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.
      
      [Peter]
      It has fixed kernel panic after long time suspend/resume test
      with nfs rootfs.
      
      [ 8864.429458] fec 2188000.ethernet eth0: rcv is not +last
      [ 8864.434799] fec 2188000.ethernet eth0: rcv is not +last
      [ 8864.440088] fec 2188000.ethernet eth0: rcv is not +last
      [ 8864.445424] fec 2188000.ethernet eth0: rcv is not +last
      [ 8864.450782] fec 2188000.ethernet eth0: rcv is not +last
      [ 8864.456111] Unable to handle kernel NULL pointer dereference at virtual address 00000000
      [ 8864.464225] pgd = 80004000
      [ 8864.466997] [00000000] *pgd=00000000
      [ 8864.470627] Internal error: Oops: 17 [#1] SMP ARM
      [ 8864.475353] Modules linked in: evbug
      [ 8864.479006] CPU: 0 PID: 3 Comm: ksoftirqd/0 Not tainted 4.0.0-rc1-00044-g7a2a1d2 #234
      [ 8864.486854] Hardware name: Freescale i.MX6 SoloX (Device Tree)
      [ 8864.492709] task: be069380 ti: be07a000 task.ti: be07a000
      [ 8864.498137] PC is at memcpy+0x80/0x330
      [ 8864.501919] LR is at gro_pull_from_frag0+0x34/0xa8
      [ 8864.506735] pc : [<802bb080>]    lr : [<8057c204>]    psr: 00000113
      [ 8864.506735] sp : be07bbd4  ip : 00000010  fp : be07bc0c
      [ 8864.518235] r10: 0000000e  r9 : 00000000  r8 : 809c7754
      [ 8864.523479] r7 : 809c7754  r6 : bb43c040  r5 : bd280cc0  r4 : 00000012
      [ 8864.530025] r3 : 00000804  r2 : fffffff2  r1 : 00000000  r0 : bb43b83c
      [ 8864.536575] Flags: nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
      [ 8864.543904] Control: 10c5387d  Table: bd14c04a  DAC: 00000015
      [ 8864.549669] Process ksoftirqd/0 (pid: 3, stack limit = 0xbe07a210)
      [ 8864.555869] Stack: (0xbe07bbd4 to 0xbe07c000)
      [ 8864.560250] bbc0:                                              bd280cc0 bb43c040 809c7754
      [ 8864.568455] bbe0: 809c7754 bb43b83c 00000012 8057c204 00000000 bd280cc0 bd8a0718 00000003
      [ 8864.576658] bc00: be07bc5c be07bc10 8057ebf0 8057c1dc 00000000 00000000 8057ecc4 bef59760
      [ 8864.584863] bc20: 00000002 bd8a0000 be07bc64 809c7754 00000000 bd8a0718 bd280cc0 bd8a0000
      [ 8864.593066] bc40: 00000000 0000001c 00000000 bd8a0000 be07bc74 be07bc60 8057f148 8057eb90
      [ 8864.601268] bc60: bf0810a0 00000000 be07bcf4 be07bc78 8044e7b4 8057f12c 00000000 8007df6c
      [ 8864.609470] bc80: bd8a0718 00000040 00000000 bd280a80 00000002 00000019 bd8a0600 bd8a1214
      [ 8864.617672] bca0: bd8a0690 bf0810a0 00000000 00000000 bd8a1000 00000000 00000027 bd280cc0
      [ 8864.625874] bcc0: 80062708 800625cc 000943db bd8a0718 00000001 000d1166 00000040 be7c1ec0
      [ 8864.634077] bce0: 0000012c be07bd00 be07bd3c be07bcf8 8057fc98 8044e3ac 809c2ec0 3ddff000
      [ 8864.642280] bd00: be07bd00 be07bd00 be07bd08 be07bd08 00000000 00000020 809c608c 00000003
      [ 8864.650481] bd20: 809c6080 40000001 809c6088 00200100 be07bd84 be07bd40 8002e690 8057fac8
      [ 8864.658684] bd40: be07bd64 be07bd50 00000001 04208040 000d1165 0000000a be07bd84 809c0d7c
      [ 8864.666885] bd60: 00000000 809c6af8 00000000 00000001 be008000 00000000 be07bd9c be07bd88
      [ 8864.675087] bd80: 8002eb64 8002e564 00000125 809c0d7c be07bdc4 be07bda0 8006f100 8002eaac
      [ 8864.683291] bda0: c080e10c be07bde8 809c6c6c c080e100 00000002 00000000 be07bde4 be07bdc8
      [ 8864.691492] bdc0: 800087a0 8006f098 806f2934 20000013 ffffffff be07be1c be07be44 be07bde8
      [ 8864.699695] bde0: 800133a4 80008784 00000001 00000001 00000000 00000000 be7c1680 00000000
      [ 8864.707896] be00: be0cfe00 bd93eb40 00000002 00000000 00000000 be07be44 be07be00 be07be30
      [ 8864.716098] be20: 8006278c 806f2934 20000013 ffffffff be069380 be7c1680 be07be7c be07be48
      [ 8864.724300] be40: 80049cfc 806f2910 00000001 00000000 80049cb4 00000000 be07be7c be7c1680
      [ 8864.732502] be60: be3289c0 be069380 bd23b600 be0cfe00 be07bebc be07be80 806ed614 80049c68
      [ 8864.740706] be80: be07a000 0000020a 809c608c 00000003 00000001 8002e858 be07a000 be035740
      [ 8864.748907] bea0: 00000000 00000001 809d4598 00000000 be07bed4 be07bec0 806edd0c 806ed440
      [ 8864.757110] bec0: be07a000 be07a000 be07bee4 be07bed8 806edd68 806edcf0 be07bef4 be07bee8
      [ 8864.765311] bee0: 8002e860 806edd34 be07bf24 be07bef8 800494b0 8002e828 be069380 00000000
      [ 8864.773512] bf00: be035780 be035740 8004938c 00000000 00000000 00000000 be07bfac be07bf28
      [ 8864.781715] bf20: 80045928 80049398 be07bf44 00000001 00000000 be035740 00000000 00030003
      [ 8864.789917] bf40: dead4ead ffffffff ffffffff 80a2716c 80b59b00 00000000 8088c954 be07bf5c
      [ 8864.798120] bf60: be07bf5c 00000000 00000000 dead4ead ffffffff ffffffff 80a2716c 00000000
      [ 8864.806320] bf80: 00000000 8088c954 be07bf88 be07bf88 be035780 8004584c 00000000 00000000
      [ 8864.814523] bfa0: 00000000 be07bfb0 8000ed10 80045858 00000000 00000000 00000000 00000000
      [ 8864.822723] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      [ 8864.830925] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 5ffbb5f7 f9fcf5e7
      [ 8864.839115] Backtrace:
      [ 8864.841631] [<8057c1d0>] (gro_pull_from_frag0) from [<8057ebf0>] (dev_gro_receive+0x6c/0x3f8)
      [ 8864.850173]  r6:00000003 r5:bd8a0718 r4:bd280cc0 r3:00000000
      [ 8864.855958] [<8057eb84>] (dev_gro_receive) from [<8057f148>] (napi_gro_receive+0x28/0xac)
      [ 8864.864152]  r10:bd8a0000 r9:00000000 r8:0000001c r7:00000000 r6:bd8a0000 r5:bd280cc0
      [ 8864.872115]  r4:bd8a0718
      [ 8864.874713] [<8057f120>] (napi_gro_receive) from [<8044e7b4>] (fec_enet_rx_napi+0x414/0xc74)
      [ 8864.883167]  r5:00000000 r4:bf0810a0
      [ 8864.886823] [<8044e3a0>] (fec_enet_rx_napi) from [<8057fc98>] (net_rx_action+0x1dc/0x2ec)
      [ 8864.895016]  r10:be07bd00 r9:0000012c r8:be7c1ec0 r7:00000040 r6:000d1166 r5:00000001
      [ 8864.902982]  r4:bd8a0718
      [ 8864.905570] [<8057fabc>] (net_rx_action) from [<8002e690>] (__do_softirq+0x138/0x2c4)
      [ 8864.913417]  r10:00200100 r9:809c6088 r8:40000001 r7:809c6080 r6:00000003 r5:809c608c
      [ 8864.921382]  r4:00000020
      [ 8864.923966] [<8002e558>] (__do_softirq) from [<8002eb64>] (irq_exit+0xc4/0x138)
      [ 8864.931289]  r10:00000000 r9:be008000 r8:00000001 r7:00000000 r6:809c6af8 r5:00000000
      [ 8864.939252]  r4:809c0d7c
      [ 8864.941841] [<8002eaa0>] (irq_exit) from [<8006f100>] (__handle_domain_irq+0x74/0xe8)
      [ 8864.949688]  r4:809c0d7c r3:00000125
      [ 8864.953342] [<8006f08c>] (__handle_domain_irq) from [<800087a0>] (gic_handle_irq+0x28/0x68)
      [ 8864.961707]  r9:00000000 r8:00000002 r7:c080e100 r6:809c6c6c r5:be07bde8 r4:c080e10c
      [ 8864.969597] [<80008778>] (gic_handle_irq) from [<800133a4>] (__irq_svc+0x44/0x5c)
      [ 8864.977097] Exception stack(0xbe07bde8 to 0xbe07be30)
      [ 8864.982173] bde0:                   00000001 00000001 00000000 00000000 be7c1680 00000000
      [ 8864.990377] be00: be0cfe00 bd93eb40 00000002 00000000 00000000 be07be44 be07be00 be07be30
      [ 8864.998573] be20: 8006278c 806f2934 20000013 ffffffff
      [ 8865.003638]  r7:be07be1c r6:ffffffff r5:20000013 r4:806f2934
      [ 8865.009447] [<806f2904>] (_raw_spin_unlock_irq) from [<80049cfc>] (finish_task_switch+0xa0/0x160)
      [ 8865.018334]  r4:be7c1680 r3:be069380
      [ 8865.021993] [<80049c5c>] (finish_task_switch) from [<806ed614>] (__schedule+0x1e0/0x5dc)
      [ 8865.030098]  r8:be0cfe00 r7:bd23b600 r6:be069380 r5:be3289c0 r4:be7c1680
      [ 8865.036942] [<806ed434>] (__schedule) from [<806edd0c>] (preempt_schedule_common+0x28/0x44)
      [ 8865.045307]  r9:00000000 r8:809d4598 r7:00000001 r6:00000000 r5:be035740 r4:be07a000
      [ 8865.053197] [<806edce4>] (preempt_schedule_common) from [<806edd68>] (_cond_resched+0x40/0x48)
      [ 8865.061822]  r4:be07a000 r3:be07a000
      [ 8865.065472] [<806edd28>] (_cond_resched) from [<8002e860>] (run_ksoftirqd+0x44/0x64)
      [ 8865.073252] [<8002e81c>] (run_ksoftirqd) from [<800494b0>] (smpboot_thread_fn+0x124/0x190)
      [ 8865.081550] [<8004938c>] (smpboot_thread_fn) from [<80045928>] (kthread+0xdc/0xf8)
      [ 8865.089133]  r10:00000000 r9:00000000 r8:00000000 r7:8004938c r6:be035740 r5:be035780
      [ 8865.097097]  r4:00000000 r3:be069380
      [ 8865.100752] [<8004584c>] (kthread) from [<8000ed10>] (ret_from_fork+0x14/0x24)
      [ 8865.107990]  r7:00000000 r6:00000000 r5:8004584c r4:be035780
      [ 8865.113767] Code: e320f000 e4913004 e4914004 e4915004 (e4916004)
      [ 8865.120006] ---[ end trace b0a4c6bd499288ca ]---
      [ 8865.124697] Kernel panic - not syncing: Fatal exception in interrupt
      [ 8865.131084] ---[ end Kernel panic - not syncing: Fatal exception in interrupt
      
      Cc: [v3.19+] stable@vger.kernel.org
      Tested-by: NPeter Chen <peter.chen@freescale.com>
      Signed-off-by: NPeter Chen <peter.chen@freescale.com>
      Signed-off-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      61615cd2
  17. 05 2月, 2015 1 次提交
  18. 25 1月, 2015 1 次提交
    • N
      net: fec: fix the warning found by dma debug · 2b995f63
      Nimrod 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-g88340160-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: NAnand Moon <moon.linux@yahoo.com>
      Reported-by: NChristian Gmeiner <christian.gmeiner@gmail.com>
      Signed-off-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2b995f63
  19. 14 1月, 2015 1 次提交
    • S
      net: fec: fix MDIO bus assignement for dual fec SoC's · 3d125f9c
      Stefan Agner 提交于
      On i.MX28, the MDIO bus is shared between the two FEC instances.
      The driver makes sure that the second FEC uses the MDIO bus of the
      first FEC. This is done conditionally if FEC_QUIRK_ENET_MAC is set.
      However, in newer designs, such as Vybrid or i.MX6SX, each FEC MAC
      has its own MDIO bus. Simply removing the quirk FEC_QUIRK_ENET_MAC
      is not an option since other logic, triggered by this quirk, is
      still needed.
      
      Furthermore, there are board designs which use the same MDIO bus
      for both PHY's even though the second bus would be available on the
      SoC side. Such layout are popular since it saves pins on SoC side.
      Due to the above quirk, those boards currently do work fine. The
      boards in the mainline tree with such a layout are:
      - Freescale Vybrid Tower with TWR-SER2 (vf610-twr.dts)
      - Freescale i.MX6 SoloX SDB Board (imx6sx-sdb.dts)
      
      This patch adds a new quirk FEC_QUIRK_SINGLE_MDIO for i.MX28, which
      makes sure that the MDIO bus of the first FEC is used in any case.
      
      However, the boards above do have a SoC with a MDIO bus for each FEC
      instance. But the PHY's are not connected in a 1:1 configuration. A
      proper device tree description is needed to allow the driver to
      figure out where to find its PHY. This patch fixes that shortcoming
      by adding a MDIO bus child node to the first FEC instance, along
      with the two PHY's on that bus, and making use of the phy-handle
      property to add a reference to the PHY's.
      Acked-by: NSascha Hauer <s.hauer@pengutronix.de>
      Signed-off-by: NStefan Agner <stefan@agner.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3d125f9c
  20. 09 1月, 2015 1 次提交
  21. 01 1月, 2015 1 次提交
    • N
      net: fec: add Wake-on-LAN support · de40ed31
      Nimrod Andy 提交于
      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: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      de40ed31
  22. 17 12月, 2014 1 次提交
    • N
      net: fec: Fix NAPI race · 94191fd6
      Nimrod Andy 提交于
      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: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      94191fd6
  23. 11 12月, 2014 3 次提交
  24. 10 12月, 2014 1 次提交
    • N
      net: fec: avoid kernal crash by NULL pointer when no phy connection · 213a9922
      Nimrod 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: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      213a9922
  25. 25 11月, 2014 1 次提交
  26. 19 11月, 2014 5 次提交
  27. 08 11月, 2014 1 次提交
  28. 04 11月, 2014 1 次提交
    • N
      net: fec: fix suspend broken on multiple MACs sillicons · f4c4a4e0
      Nimrod Andy 提交于
      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: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f4c4a4e0
  29. 23 10月, 2014 1 次提交
  30. 20 10月, 2014 1 次提交
  31. 16 10月, 2014 1 次提交
    • N
      net: fec: ptp: fix convergence issue to support LinuxPTP stack · 28b5f058
      Nimrod Andy 提交于
      iMX6SX IEEE 1588 module has one hw issue in capturing the ATVR register.
      The current SW flow is:
      		ENET0->ATCR |= ENET_ATCR_CAPTURE_MASK;
      		ts_counter_ns = ENET0->ATVR;
      The ATVR value is not expected value that cause LinuxPTP stack cannot be convergent.
      
      ENET Block Guide/ Chapter for the iMX6SX (PELE) address the issue:
      After set ENET_ATCR[Capture], there need some time cycles before the counter
      value is capture in the register clock domain. The wait-time-cycles is at least
      6 clock cycles of the slower clock between the register clock and the 1588 clock.
      So need something like:
      		ENET0->ATCR |= ENET_ATCR_CAPTURE_MASK;
      		wait();
      		ts_counter_ns = ENET0->ATVR;
      
      For iMX6SX, the 1588 ts_clk is fixed to 25Mhz, register clock is 66Mhz, so the
      wait-time-cycles must be greater than 240ns (40ns * 6). The patch add 1us delay
      before cpu read ATVR register.
      
      Changes V2:
      Modify the commit/comments log to describe the issue clearly.
      Signed-off-by: NFugang Duan <B38611@freescale.com>
      Acked-by: NRichard Cochran <richardcochran@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      28b5f058
  32. 15 10月, 2014 1 次提交
    • L
      net: fec: ptp: Enable PPS output based on ptp clock · 278d2404
      Luwei 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: NLuwei Zhou <b45643@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      278d2404