1. 01 6月, 2013 1 次提交
  2. 28 5月, 2013 1 次提交
  3. 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
  4. 12 3月, 2013 1 次提交
  5. 15 1月, 2013 1 次提交
  6. 09 7月, 2012 1 次提交
  7. 01 7月, 2012 1 次提交
    • G
      phy: add the EEE support and the way to access to the MMD registers. · a59a4d19
      Giuseppe CAVALLARO 提交于
      This patch adds the support for the Energy-Efficient Ethernet (EEE)
      to the Physical Abstraction Layer.
      To support the EEE we have to access to the MMD registers 3.20 and
      7.60/61. So two new functions have been added to read/write the MMD
      registers (clause 45).
      
      An Ethernet driver (I tested the stmmac) can invoke the phy_init_eee to properly
      check if the EEE is supported by the PHYs and it can also set the clock
      stop enable bit in the 3.0 register.
      The phy_get_eee_err can be used for reporting the number of time where
      the PHY failed to complete its normal wake sequence.
      
      In the end, this patch also adds the EEE ethtool support implementing:
       o phy_ethtool_set_eee
       o phy_ethtool_get_eee
      
      v1: initial patch
      v2: fixed some errors especially on naming convention
      v3: renamed again the mmd read/write functions thank to Ben's feedback
      v4: moved file to phy.c and added the ethtool support.
      v5: fixed phy_adv_to_eee, phy_eee_to_supported, phy_eee_to_adv return
          values according to ethtool API (thanks to Ben's feedback).
          Renamed some macros to avoid too long names.
      v6: fixed kernel-doc comments to be properly parsed.
          Fixed the phy_init_eee function: we need to check which link mode
          was autonegotiated and then the corresponding bits in 7.60 and 7.61
          registers.
      v7: reviewed the way to get the negotiated settings.
      v8: fixed a problem in the phy_init_eee return value erroneously added
          when included the phy_read_status call.
      v9: do not remove the MDIO_AN_EEE_ADV_100TX and MDIO_AN_EEE_ADV_1000T
          and fixed the eee_{cap,lp,adv} declaration as "int" instead of u16.
      Signed-off-by: NGiuseppe Cavallaro <peppe.cavallaro@st.com>
      Reviewed-by: NBen Hutchings <bhutchings@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a59a4d19
  8. 28 6月, 2012 2 次提交
    • D
      netdev/phy/of: Add more methods for binding PHY devices to drivers. · a30e2c18
      David Daney 提交于
      Allow PHY drivers to supply their own device matching function
      (match_phy_device()), or to be matched OF compatible properties.
      
      PHYs following IEEE802.3 clause 45 have more than one device
      identifier constants, which breaks the default device matching code.
      Other 10G PHYs don't follow the standard manufacturer/device
      identifier register layout standards, but they do use the standard
      MDIO bus protocols for register access.  Both of these require
      adjustments to the PHY driver to device matching code.
      
      If the there is an of_node associated with such a PHY, we can match it
      to its driver using the "compatible" properties, just as we do with
      certain platform devices.  If the "compatible" property match fails,
      first check if there is a driver supplied matching function, and if
      not fall back to the existing identifier matching rules.
      Signed-off-by: NDavid Daney <david.daney@cavium.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a30e2c18
    • 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
  9. 16 5月, 2012 1 次提交
  10. 04 4月, 2012 1 次提交
  11. 16 3月, 2012 1 次提交
    • P
      device.h: audit and cleanup users in main include dir · 313162d0
      Paul Gortmaker 提交于
      The <linux/device.h> header includes a lot of stuff, and
      it in turn gets a lot of use just for the basic "struct device"
      which appears so often.
      
      Clean up the users as follows:
      
      1) For those headers only needing "struct device" as a pointer
      in fcn args, replace the include with exactly that.
      
      2) For headers not really using anything from device.h, simply
      delete the include altogether.
      
      3) For headers relying on getting device.h implicitly before
      being included themselves, now explicitly include device.h
      
      4) For files in which doing #1 or #2 uncovers an implicit
      dependency on some other header, fix by explicitly adding
      the required header(s).
      
      Any C files that were implicitly relying on device.h to be
      present have already been dealt with in advance.
      
      Total removals from #1 and #2: 51.  Total additions coming
      from #3: 9.  Total other implicit dependencies from #4: 7.
      
      As of 3.3-rc1, there were 110, so a net removal of 42 gives
      about a 38% reduction in device.h presence in include/*
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      313162d0
  12. 13 1月, 2012 1 次提交
  13. 24 10月, 2011 1 次提交
    • R
      net: hold sock reference while processing tx timestamps · da92b194
      Richard Cochran 提交于
      The pair of functions,
      
       * skb_clone_tx_timestamp()
       * skb_complete_tx_timestamp()
      
      were designed to allow timestamping in PHY devices. The first
      function, called during the MAC driver's hard_xmit method, identifies
      PTP protocol packets, clones them, and gives them to the PHY device
      driver. The PHY driver may hold onto the packet and deliver it at a
      later time using the second function, which adds the packet to the
      socket's error queue.
      
      As pointed out by Johannes, nothing prevents the socket from
      disappearing while the cloned packet is sitting in the PHY driver
      awaiting a timestamp. This patch fixes the issue by taking a reference
      on the socket for each such packet. In addition, the comments
      regarding the usage of these function are expanded to highlight the
      rule that PHY drivers must use skb_complete_tx_timestamp() to release
      the packet, in order to release the socket reference, too.
      
      These functions first appeared in v2.6.36.
      Reported-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NRichard Cochran <richard.cochran@omicron.at>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Reviewed-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      da92b194
  14. 27 7月, 2011 2 次提交
  15. 25 10月, 2010 1 次提交
  16. 03 9月, 2010 1 次提交
  17. 19 7月, 2010 2 次提交
  18. 03 4月, 2010 1 次提交
  19. 17 3月, 2010 1 次提交
    • J
      NET: Support clause 45 MDIO commands at the MDIO bus level · abf35df2
      Jason Gunthorpe 提交于
      IEEE 802.3ae clause 45 specifies a somewhat modified MDIO protocol
      for use by 10GIGE phys. The main change is a 21 bit address split into
      a 5 bit device ID and a 16 bit register offset. The definition is designed
      so that normal and extended devices can run on the same MDIO bus.
      
      Extend mdio-bitbang to do the new protocol. At the MDIO bus level the
      protocol is requested by or'ing MII_ADDR_C45 into the register offset.
      
      Make phy_read/phy_write/etc pass a full 32 bit register offset.
      
      This does not attempt to make the phy layer support C45 style PHYs, just
      to provide the MDIO bus support.
      
      Tested against a Broadcom 10GE phy with ID 0x206034, and several
      Broadcom 10/100/1000 Phys in normal mode.
      Signed-off-by: NJason Gunthorpe <jgunthorpe@obsidianresearch.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      abf35df2
  20. 05 2月, 2010 1 次提交
  21. 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
  22. 31 12月, 2009 1 次提交
  23. 27 5月, 2009 1 次提交
  24. 27 4月, 2009 2 次提交
  25. 14 4月, 2009 1 次提交
    • A
      phylib: Allow early-out in phy_change · a8729eb3
      Anatolij Gustschin 提交于
      Marvell 88E1121R Dual PHY device can be hardware-configured
      to use shared interrupt pin for both PHY ports. For such
      PHY configurations using shared PHY interrupt phy_interrupt()
      handler will also schedule a work for PHY port which didn't
      cause an interrupt.
      
      This patch adds a possibility for PHY drivers to provide
      did_interrupt() function which reports if the PHY (or a PHY
      port in a multi-PHY device) generated an interrupt. This
      function is called in phy_change() as phy_change() shouldn't
      proceed if it is invoked for a PHY which didn't cause an
      interrupt. So check for interrupt originator in phy_change()
      to allow early-out.
      Signed-off-by: NAnatolij Gustschin <agust@denx.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a8729eb3
  26. 14 3月, 2009 1 次提交
  27. 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
  28. 09 10月, 2008 4 次提交
  29. 19 9月, 2008 1 次提交
  30. 07 5月, 2008 1 次提交
  31. 25 4月, 2008 1 次提交
  32. 18 4月, 2008 1 次提交