1. 30 7月, 2014 1 次提交
    • F
      net: phy: re-apply PHY fixups during phy_register_device · d92f5dec
      Florian Fainelli 提交于
      Commit 87aa9f9c ("net: phy: consolidate PHY reset in phy_init_hw()")
      moved the call to phy_scan_fixups() in phy_init_hw() after a software
      reset is performed.
      
      By the time phy_init_hw() is called in phy_device_register(), no driver
      has been bound to this PHY yet, so all the checks in phy_init_hw()
      against the PHY driver and the PHY driver's config_init function will
      return 0. We will therefore never call phy_scan_fixups() as we should.
      
      Fix this by calling phy_scan_fixups() and check for its return value to
      restore the intended functionality.
      
      This broke PHY drivers which do register an early PHY fixup callback to
      intercept the PHY probing and do things like changing the 32-bits unique
      PHY identifier when a pseudo-PHY address has been used, as well as
      board-specific PHY fixups that need to be applied during driver probe
      time.
      Reported-by: NHauke Merthens <hauke-m@hauke-m.de>
      Reported-by: NJonas Gorski <jogo@openwrt.org>
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d92f5dec
  2. 25 7月, 2014 1 次提交
  3. 09 7月, 2014 1 次提交
  4. 23 5月, 2014 2 次提交
    • S
      net: phy: make of_set_phy_supported work with genphy driver · de906af1
      Sascha Hauer 提交于
      of_set_phy_supported allows overwiting hardware capabilities of
      a phy with values from the devicetree. of_set_phy_supported is
      called right after phy_device_register in the assumption that
      phy_probe is called from phy_device_register and the features
      of the phy are already initialized. For the genphy driver this
      is not true, here phy_probe is called later during phy_connect
      time. phy_probe will then overwrite all settings done from
      of_set_phy_supported
      Fix this by moving of_set_phy_supported to the core phy code
      and calling it from phy_probe.
      Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      de906af1
    • S
      net: phy: genphy: Allow overwriting features · c242a472
      Sascha Hauer 提交于
      of_set_phy_supported allows overwiting hardware capabilities of
      a phy with values from the devicetree. This does not work with
      the genphy driver though because the genphys config_init function
      will overwrite all values adjusted by of_set_phy_supported. Fix
      this by initialising the genphy features in the phy_driver struct
      and in config_init just limit the features to the ones the hardware
      can actually support. The resulting features are a subset of the
      devicetree specified features and the hardware features.
      Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c242a472
  5. 16 5月, 2014 1 次提交
    • G
      net: phy: Don't call phy_resume if phy_init_hw failed · b394745d
      Guenter Roeck 提交于
      After the call to phy_init_hw failed in phy_attach_direct, phy_detach is called
      to detach the phy device from its network device. If the attached driver is a
      generic phy driver, this also detaches the driver. Subsequently phy_resume
      is called, which assumes without checking that a driver is attached to the
      device. This will result in a crash such as
      
      Unable to handle kernel paging request for data at address 0xffffffffffffff90
      Faulting instruction address: 0xc0000000003a0e18
      Oops: Kernel access of bad area, sig: 11 [#1]
      ...
      NIP [c0000000003a0e18] .phy_attach_direct+0x68/0x17c
      LR [c0000000003a0e6c] .phy_attach_direct+0xbc/0x17c
      Call Trace:
      [c0000003fc0475d0] [c0000000003a0e6c] .phy_attach_direct+0xbc/0x17c (unreliable)
      [c0000003fc047670] [c0000000003a0ff8] .phy_connect_direct+0x28/0x98
      [c0000003fc047700] [c0000000003f0074] .of_phy_connect+0x4c/0xa4
      
      Only call phy_resume if phy_init_hw was successful.
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b394745d
  6. 21 4月, 2014 1 次提交
  7. 15 3月, 2014 1 次提交
  8. 26 2月, 2014 1 次提交
  9. 18 2月, 2014 2 次提交
  10. 13 2月, 2014 3 次提交
  11. 05 2月, 2014 1 次提交
    • F
      net: phy: ensure Gigabit features are masked off if requested · 5273e3a5
      Florian Fainelli 提交于
      When a Gigabit PHY device is connected to a 10/100Mbits capable Ethernet
      MAC, the driver will restrict the phydev->supported modes to mask off
      Gigabit. If the Gigabit PHY comes out of reset with the Gigabit features
      set by default in MII_CTRL1000, it will keep advertising these feature,
      so by the time we call genphy_config_advert(), the condition on
      phydev->supported having the Gigabit features on is false, and we do not
      update MII_CTRL1000 with updated values, and we keep advertising Gigabit
      features, eventually configuring the PHY for Gigabit whilst the Ethernet
      MAC does not support that.
      
      This patches fixes the problem by ensuring that the Gigabit feature bits
      are always cleared in MII_CTRL1000, if the PHY happens to be a Gigabit
      PHY, and then, if Gigabit features are supported, setting those and
      updating MII_CTRL1000 accordingly.
      Reported-by: NMax Filippov <jcmvbkbc@gmail.com>
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Tested-by: NMax Filippov <jcmvbkbc@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5273e3a5
  12. 20 1月, 2014 1 次提交
  13. 14 1月, 2014 3 次提交
  14. 05 1月, 2014 6 次提交
  15. 18 12月, 2013 3 次提交
  16. 10 12月, 2013 2 次提交
  17. 21 11月, 2013 1 次提交
  18. 28 5月, 2013 1 次提交
  19. 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
  20. 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
  21. 15 1月, 2013 1 次提交
  22. 09 7月, 2012 1 次提交
  23. 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
  24. 12 6月, 2012 1 次提交