1. 14 1月, 2014 3 次提交
  2. 05 1月, 2014 6 次提交
  3. 18 12月, 2013 3 次提交
  4. 10 12月, 2013 2 次提交
  5. 21 11月, 2013 1 次提交
  6. 28 5月, 2013 1 次提交
  7. 21 5月, 2013 2 次提交
    • F
      phy: add phy_mac_interrupt() to use with PHY_IGNORE_INTERRUPT · 5ea94e76
      Florian Fainelli 提交于
      There is currently no way for an Ethernet MAC driver servicing PHY link
      interrupts to notify this to the PHY state machine without defining its
      own state machine. Since most drivers are not so special, introduce a
      helper: phy_mac_interrupt() which can be called from a link up/down
      interrupt routine to update the PHY state machine. To avoid code
      duplication some refactoring has been done to expose the workqueue and
      its corresponding callback internally.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5ea94e76
    • F
      phy: fix the use of PHY_IGNORE_INTERRUPT · 2c7b4921
      Florian Fainelli 提交于
      When a PHY device is registered with the special IRQ value
      PHY_IGNORE_INTERRUPT (-2) it will not properly be handled by the PHY
      library:
      
      - it continues to poll its register, while we do not want this
        because such PHY link events or register changes are serviced by an
        Ethernet MAC
      - it will still try to configure PHY interrupts at the PHY level, such
        interrupts do not exist at the PHY but at the MAC level
      - the state machine only handles PHY_POLL, but should also handle
        PHY_IGNORE_INTERRUPT similarly
      
      This patch updates the PHY state machine and initialization paths to
      account for the specific PHY_IGNORE_INTERRUPT. Based on an earlier patch
      by Thomas Petazzoni, and reworked to add the missing bits. Add a helper
      phy_interrupt_is_valid() which specifically tests for a PHY interrupt
      not to be PHY_POLL or PHY_IGNORE_INTERRUPT and use it throughout the
      code.
      Signed-off-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2c7b4921
  8. 01 3月, 2013 1 次提交
    • P
      phy: Fix phy_device_free memory leak · b2a43191
      Petr Malat 提交于
      Fix memory leak in phy_device_free() for the case when phy_device*
      returned by phy_device_create() is not registered in the system.
      
      Bug description:
      phy_device_create() sets name of kobject using dev_set_name(), which
      allocates memory using kvasprintf(), but this memory isn't freed if
      the underlying device isn't registered properly, because kobject_cleanup()
      is not called in that case. This can happen (and actually is happening on
      our machines) if phy_device_register(), called by mdiobus_scan(), fails.
      
      Patch description:
      Embedded struct device is initialized in phy_device_create() and it
      counterpart phy_device_free() just drops one reference to the device,
      which leads to proper deinitialization including releasing the kobject
      name memory.
      Signed-off-by: NPetr Malat <oss@malat.biz>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b2a43191
  9. 15 1月, 2013 1 次提交
  10. 09 7月, 2012 1 次提交
  11. 28 6月, 2012 2 次提交
    • D
      phy: Fix warning in get_phy_device(). · 160c85f0
      David S. Miller 提交于
      drivers/net/phy/phy_device.c: In function ‘get_phy_device’:
      drivers/net/phy/phy_device.c:340:14: warning: ‘phy_id’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      
      GCC can't see that when we return zero we always initialize
      phy_id and that's the only path where we use it.
      
      Initialize phy_id to zero to shut it up.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      160c85f0
    • D
      netdev/phy: Handle IEEE802.3 clause 45 Ethernet PHYs · ac28b9f8
      David Daney 提交于
      The IEEE802.3 clause 45 MDIO bus protocol allows for directly
      addressing PHY registers using a 21 bit address, and is used by many
      10G Ethernet PHYS.  Already existing is the ability of MDIO bus
      drivers to use clause 45, with the MII_ADDR_C45 flag.  Here we add
      struct phy_c45_device_ids to hold the device identifier registers
      present in clause 45. struct phy_device gets a couple of new fields:
      c45_ids to hold the identifiers and is_c45 to signal that it is clause
      45.
      
      get_phy_device() gets a new parameter is_c45 to indicate that the PHY
      device should use the clause 45 protocol, and its callers are adjusted
      to pass false.  The follow-on patch to of_mdio.c will pass true where
      appropriate.
      
      EXPORT phy_device_create() so that the follow-on patch to of_mdio.c
      can use it to create phy devices for PHYs, that have non-standard
      device identifier registers, based on the device tree bindings.
      Signed-off-by: NDavid Daney <david.daney@cavium.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ac28b9f8
  12. 12 6月, 2012 1 次提交
  13. 16 5月, 2012 1 次提交
  14. 25 1月, 2012 1 次提交
    • A
      Remove useless get_driver()/put_driver() calls · f3ff9247
      Alan Stern 提交于
      As part of the removal of get_driver()/put_driver(), this patch
      (as1512) gets rid of various useless and unnecessary calls in several
      drivers.  In some cases it may be desirable to pin the driver by
      calling try_module_get(), but that can be done later.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      CC: Michael Buesch <m@bues.ch>
      CC: Joerg Roedel <joerg.roedel@amd.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f3ff9247
  15. 22 11月, 2011 1 次提交
  16. 17 11月, 2011 1 次提交
  17. 01 10月, 2011 1 次提交
  18. 31 3月, 2011 1 次提交
  19. 30 3月, 2011 1 次提交
    • M
      phylib: phy_attach_direct: phy_init_hw can fail, add cleanup · d005a09e
      Marc Kleine-Budde 提交于
      The function phy_attach_direct attaches the phy and calls phy_init_hw.
      phy_init_hw can fail, but the phy is still marked as attached. Successive
      calls to phy_attach_direct will fail because the phy is busy.
      
      [    1.020000] eth0: Freescale FEC PHY driver [Generic PHY] (mii_bus:phy_addr=1:00, irq=-1)
      [    1.030000] eth1: Freescale FEC PHY driver [Generic PHY] (mii_bus:phy_addr=1:01, irq=-1)
      [    2.050000] Sending DHCP requests .
      [    3.020000] PHY: 1:00 - Link is Up - 100/Full
      [    5.110000] ..... timed out!
      [   87.660000] IP-Config: Reopening network devices...
      [   88.190000] FEC: MDIO read timeout
      [   88.190000] eth0: could not attach to PHY
      [   88.190000] IP-Config: Failed to open eth0
      [   88.210000] FEC: MDIO read timeout
      [   88.210000] eth1: could not attach to PHY
      [   88.210000] IP-Config: Failed to open eth1
      [   88.220000] IP-Config: No network devices available.
      [   88.220000] Freeing init memory: 6968K
      
      [...]
      
      starting network interfaces...
      ip: RTNETLINK answers: File exists
      [   94.000000] net eth0: PHY already attached
      [   94.010000] eth0: could not attach to PHY
      ip: SIOCSIFFLAGS: Device or resource busy
      
      This patch adds phy_detach to clean up if phy_init_hw fails.
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d005a09e
  20. 25 10月, 2010 1 次提交
  21. 25 8月, 2010 1 次提交
    • A
      phylib: Fix race between returning phydev and calling adjust_link · ef24b16b
      Anton Vorontsov 提交于
      It is possible that phylib will call adjust_link before returning
      from {,of_}phy_connect(), which may cause the following [very rare,
      though] oops upon reopening the device:
      
        Unable to handle kernel paging request for data at address 0x0000024c
        Oops: Kernel access of bad area, sig: 11 [#1]
        PREEMPT SMP NR_CPUS=2 LTT NESTING LEVEL : 0
        P1021 RDB
        Modules linked in:
        NIP: c0345dac LR: c0345dac CTR: c0345d84
        TASK = dffab6b0[30] 'events/0' THREAD: c0d24000 CPU: 0
        [...]
        NIP [c0345dac] adjust_link+0x28/0x19c
        LR [c0345dac] adjust_link+0x28/0x19c
        Call Trace:
        [c0d25f00] [000045e1] 0x45e1 (unreliable)
        [c0d25f30] [c036c158] phy_state_machine+0x3ac/0x554
        [...]
      
      Here is why. Drivers store phydev in their private structures, e.g.
      gianfar driver:
      
      static int init_phy(struct net_device *dev)
      {
      	...
      	priv->phydev = of_phy_connect(...);
      	...
      }
      
      So that adjust_link could retrieve it back:
      
      static void adjust_link(struct net_device *dev)
      {
      	...
      	struct phy_device *phydev = priv->phydev;
      	...
      }
      
      If the device has been opened before, then phydev->state is set to
      PHY_HALTED (or undefined if the driver didn't call phy_stop()).
      
      Now, phy_connect starts the PHY state machine before returning phydev to
      the driver:
      
      	phy_start_machine(phydev, NULL);
      
      	if (phydev->irq > 0)
      		phy_start_interrupts(phydev);
      
      	return phydev;
      
      The time between 'phy_start_machine()' and 'return phydev' is undefined.
      The start machine routine delays execution for 1 second, which is enough
      for most cases. But under heavy load, or if you're unlucky, it is quite
      possible that PHY state machine will execute before phy_connect()
      returns, and so adjust_link callback will try to dereference phydev,
      which is not yet ready.
      
      To fix the issue, simply initialize the PHY's state to PHY_READY during
      phy_attach(). This will ensure that phylib won't call adjust_link before
      phy_start().
      Signed-off-by: NAnton Vorontsov <avorontsov@mvista.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ef24b16b
  22. 19 7月, 2010 1 次提交
    • R
      net: support time stamping in phy devices. · c1f19b51
      Richard Cochran 提交于
      This patch adds a new networking option to allow hardware time stamps
      from PHY devices. When enabled, likely candidates among incoming and
      outgoing network packets are offered to the PHY driver for possible
      time stamping. When accepted by the PHY driver, incoming packets are
      deferred for later delivery by the driver.
      
      The patch also adds phylib driver methods for the SIOCSHWTSTAMP ioctl
      and callbacks for transmit and receive time stamping. Drivers may
      optionally implement these functions.
      Signed-off-by: NRichard Cochran <richard.cochran@omicron.at>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c1f19b51
  23. 03 4月, 2010 1 次提交
  24. 05 2月, 2010 1 次提交
  25. 19 1月, 2010 1 次提交
    • A
      phylib: Move workqueue initialization to a proper place · 4f9c85a1
      Anton Vorontsov 提交于
      commit 541cd3ee ("phylib: Fix deadlock
      on resume") caused TI DaVinci EMAC ethernet driver to oops upon resume:
      
       PM: resume of devices complete after 237.098 msecs
       Restarting tasks ... done.
       kernel BUG at kernel/workqueue.c:354!
       Unable to handle kernel NULL pointer dereference at virtual address 00000000
       [...]
       Backtrace:
       [<c002c598>] (__bug+0x0/0x2c) from [<c0052a54>] (queue_delayed_work_on+0x74/0xf8)
       [<c00529e0>] (queue_delayed_work_on+0x0/0xf8) from [<c0052b30>] (queue_delayed_work+0x2c/0x30)
      
      The oops pops up because TI DaVinci EMAC driver detaches PHY on
      suspend and attaches it back on resume. Attaching makes phylib call
      phy_start_machine() that initializes a workqueue. On the other hand,
      PHY's resume routine will call phy_start_machine() again, and that
      will cause the oops since we just destroyed the already scheduled
      workqueue.
      
      This patch fixes the issue by moving workqueue initialization to
      phy_device_create().
      
      p.s. We don't see this oops with ucc_geth and gianfar drivers because
      they perform a fine-grained suspend, i.e. they just stop the PHYs
      without detaching.
      Reported-by: NSekhar Nori <nsekhar@ti.com>
      Signed-off-by: NAnton Vorontsov <avorontsov@ru.mvista.com>
      Tested-by: NSekhar Nori <nsekhar@ti.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4f9c85a1
  26. 31 12月, 2009 1 次提交
  27. 15 7月, 2009 1 次提交
  28. 17 6月, 2009 1 次提交