1. 15 1月, 2013 1 次提交
  2. 09 7月, 2012 1 次提交
  3. 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
  4. 12 6月, 2012 1 次提交
  5. 16 5月, 2012 1 次提交
  6. 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
  7. 22 11月, 2011 1 次提交
  8. 17 11月, 2011 1 次提交
  9. 01 10月, 2011 1 次提交
  10. 31 3月, 2011 1 次提交
  11. 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
  12. 25 10月, 2010 1 次提交
  13. 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
  14. 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
  15. 03 4月, 2010 1 次提交
  16. 05 2月, 2010 1 次提交
  17. 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
  18. 31 12月, 2009 1 次提交
  19. 15 7月, 2009 1 次提交
  20. 17 6月, 2009 1 次提交
  21. 27 4月, 2009 2 次提交
  22. 15 1月, 2009 1 次提交
    • A
      phylib: Fix Freescale TBI PHY detection · f0d44ae3
      Anton Vorontsov 提交于
      Freescale on-chip TBI PHYs reports PHY ID as 0x0, but as of
      
      commit 3ee82383
      Author: Giulio Benetti <giulio.benetti@micronovasrl.com>
      Date:   Thu Nov 13 21:53:13 2008 +0000
      
          phy: fix phy address bug
      
          PHYID returns 0xffff and not 0xffffffff when not found and in some
          case(at91sam9263) 0x0. Maybe this patch could be useful.
      
      phy_device.c treats PHY ID == 0x0 as bogus IDs, and that results in
      gianfar driver failure to see the TBI PHYs. This code snippet triggers:
      
      	if (!priv->tbiphy) {
      		printk(KERN_WARNING "SGMII mode requires that the device "
      				"tree specify a tbi-handle\n");
      		return;
      	}
      
      Although tbi-handle is specified in the device tree.
      
      Btw, technically PHY ID == 0x0 is a valid ID (if we ever see a PHY
      manufactured by Xerox :-).
      Signed-off-by: NAnton Vorontsov <avorontsov@ru.mvista.com>
      Acked-by: NAndy Fleming <afleming@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f0d44ae3
  23. 26 12月, 2008 1 次提交
  24. 17 12月, 2008 1 次提交
  25. 29 11月, 2008 1 次提交
    • G
      phy: power management support · 0f0ca340
      Giuseppe Cavallaro 提交于
      This patch adds the power management support into the physical
      abstraction layer.
      
      Suspend and resume functions respectively turns on/off the bit 11
      into the PHY Basic mode control register.
      Generic PHY device starts supporting PM.
      
      In order to support the wake-on LAN and avoid to put in power down
      the PHY device, the MDIO is aware of what the Ethernet device wants to do.
      
      Voluntary, no CONFIG_PM defines were added into the sources.
      Also generic suspend/resume functions are exported to allow
      other drivers use them (such as genphy_config_aneg etc.).
      
      Within the phy_driver_register function, we need to remove the
      memset. It overrides the device driver owner and it is not good.
      Signed-off-by: NGiuseppe Cavallaro <peppe.cavallaro@st.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0f0ca340
  26. 21 11月, 2008 1 次提交
  27. 20 11月, 2008 1 次提交
    • T
      phylib: Fix auto-negotiation restart avoidance · de339c2a
      Trent Piepho 提交于
      A previous patch, 51e2a384, made
      genphy_config_aneg() not restart aneg by calling genphy_restart_aneg() if
      the advertisement hadn't changed.
      
      But, genphy_restart_aneg() doesn't just restart aneg, it may also *enable*
      aneg or un-isolate the PHY from the MII (those functions are controlled by
      the same register).  The code to avoid calling genphy_restart_aneg() didn't
      consider this.
      
      So, modify genphy_config_aneg() to also check if the PHY needs to have aneg
      enabled or be un-isolated before deciding not to restart aneg.
      
      This caused a problem with certain Davicom PHYs, as that driver isolates
      the PHY (why?) before calling genphy_config_aneg() and expects the PHY to
      be un-isolated by that function.
      Signed-off-by: NTrent Piepho <tpiepho@freescale.com>
      Reported-by: NScott Wood <scottwood@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      de339c2a
  28. 16 11月, 2008 1 次提交
  29. 11 11月, 2008 1 次提交
  30. 17 10月, 2008 1 次提交
  31. 14 10月, 2008 1 次提交
  32. 09 10月, 2008 1 次提交
    • T
      PHY: Avoid unnecessary aneg restarts · 51e2a384
      Trent Piepho 提交于
      The PHY's aneg is configured and restarted whenever the link is brought up,
      e.g. when DHCP is started after the kernel has booted.  This can take the
      link down for several seconds while auto-negotiation is redone.
      
      If the advertised features haven't changed, then it shouldn't be necessary
      to bring down the link and start auto-negotiation over again.
      
      genphy_config_advert() is enhanced to return 0 when the advertised features
      haven't been changed and >0 when they have been.
      
      genphy_config_aneg() then uses this information to not call
      genphy_restart_aneg() if there has been no change.
      Signed-off-by: NTrent Piepho <tpiepho@freescale.com>
      Acked-by: NAndy Fleming <afleming@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      51e2a384
  33. 23 5月, 2008 1 次提交
  34. 29 4月, 2008 1 次提交
  35. 25 4月, 2008 1 次提交
  36. 18 4月, 2008 1 次提交
  37. 03 2月, 2008 1 次提交
  38. 05 12月, 2007 1 次提交
    • A
      PHY: Add the phy_device_release device method. · 6f4a7f41
      Anton Vorontsov 提交于
      Lately I've got this nice badness on mdio bus removal:
      
      Device 'e0103120:06' does not have a release() function, it is broken and must be fixed.
      ------------[ cut here ]------------
      Badness at drivers/base/core.c:107
      NIP: c015c1a8 LR: c015c1a8 CTR: c0157488
      REGS: c34bdcf0 TRAP: 0700   Not tainted  (2.6.23-rc5-g9ebadfbb-dirty)
      MSR: 00029032 <EE,ME,IR,DR>  CR: 24088422  XER: 00000000
      ...
      [c34bdda0] [c015c1a8] device_release+0x78/0x80 (unreliable)
      [c34bddb0] [c01354cc] kobject_cleanup+0x80/0xbc
      [c34bddd0] [c01365f0] kref_put+0x54/0x6c
      [c34bdde0] [c013543c] kobject_put+0x24/0x34
      [c34bddf0] [c015c384] put_device+0x1c/0x2c
      [c34bde00] [c0180e84] mdiobus_unregister+0x2c/0x58
      ...
      
      Though actually there is nothing broken, it just device
      subsystem core expects another "pattern" of resource managment.
      
      This patch implement phy device's release function, thus
      we're getting rid of this badness.
      
      Also small hidden bug fixed, hope none other introduced. ;-)
      Signed-off-by: NAnton Vorontsov <avorontsov@ru.mvista.com>
      Acked-by: NAndy Fleming <afleming@freescale.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      6f4a7f41