1. 04 1月, 2018 1 次提交
  2. 14 12月, 2017 1 次提交
  3. 06 12月, 2017 1 次提交
    • S
      phylib: Add device reset GPIO support · bafbdd52
      Sergei Shtylyov 提交于
      The PHY devices sometimes do have their reset signal (maybe even power
      supply?) tied to some GPIO and sometimes it also does happen that a boot
      loader does not leave it deasserted. So far this issue has been attacked
      from (as I believe) a wrong angle: by teaching the MAC driver to manipulate
      the GPIO in question; that solution, when applied to the device trees, led
      to adding the PHY reset GPIO properties to the MAC device node, with one
      exception: Cadence MACB driver which could handle the "reset-gpios" prop
      in a PHY device subnode. I believe that the correct approach is to teach
      the 'phylib' to get the MDIO device reset GPIO from the device tree node
      corresponding to this device -- which this patch is doing...
      
      Note that I had to modify the AT803x PHY driver as it would stop working
      otherwise -- it made use of the reset GPIO for its own purposes...
      Signed-off-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Acked-by: NRob Herring <robh@kernel.org>
      [geert: Propagate actual errors from fwnode_get_named_gpiod()]
      [geert: Avoid destroying initial setup]
      [geert: Consolidate GPIO descriptor acquiring code]
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Tested-by: NRichard Leitner <richard.leitner@skidata.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bafbdd52
  4. 09 9月, 2017 1 次提交
  5. 18 7月, 2017 1 次提交
  6. 14 6月, 2017 2 次提交
  7. 03 6月, 2017 1 次提交
  8. 01 6月, 2017 1 次提交
    • R
      net: fix auto-loading of Marvell DSA driver · 1b8f8694
      Russell King 提交于
      Auto-loading of the Marvell DSA driver has stopped working with recent
      kernels.  This seems to be due to the change of binding for DSA devices,
      moving them from the platform bus to the MDIO bus.
      
      In order for module auto-loading to work, we need to provide a MODALIAS
      string in the uevent file for the device.  However, the device core does
      not automatically provide this, and needs each bus_type to implement a
      uevent method to generate these strings.  The MDIO bus does not provide
      such a method, so no MODALIAS string is provided:
      
      .# cat /sys/bus/mdio_bus/devices/f1072004.mdio-mii\:04/uevent
      DRIVER=mv88e6085
      OF_NAME=switch
      OF_FULLNAME=/soc/internal-regs/mdio@72004/switch@4
      OF_COMPATIBLE_0=marvell,mv88e6085
      OF_COMPATIBLE_N=1
      
      In the case of OF-based devices, the solution is easy -
      of_device_uevent_modalias() does the work for us.  After this is done,
      the uevent file looks like this:
      
      .# cat /sys/bus/mdio_bus/devices/f1072004.mdio-mii\:04/uevent
      DRIVER=mv88e6085
      OF_NAME=switch
      OF_FULLNAME=/soc/internal-regs/mdio@72004/switch@4
      OF_COMPATIBLE_0=marvell,mv88e6085
      OF_COMPATIBLE_N=1
      MODALIAS=of:NswitchT<NULL>Cmarvell,mv88e6085
      
      which results in auto-loading of the Marvell DSA driver on Clearfog
      platforms.
      
      Fixes: c0405563 ("ARM: dts: armada-388-clearfog: Utilize new DSA binding")
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1b8f8694
  9. 12 5月, 2017 1 次提交
  10. 25 4月, 2017 1 次提交
    • R
      mdio_bus: Issue GPIO RESET to PHYs. · 69226896
      Roger Quadros 提交于
      Some boards [1] leave the PHYs at an invalid state
      during system power-up or reset thus causing unreliability
      issues with the PHY which manifests as PHY not being detected
      or link not functional. To fix this, these PHYs need to be RESET
      via a GPIO connected to the PHY's RESET pin.
      
      Some boards have a single GPIO controlling the PHY RESET pin of all
      PHYs on the bus whereas some others have separate GPIOs controlling
      individual PHY RESETs.
      
      In both cases, the RESET de-assertion cannot be done in the PHY driver
      as the PHY will not probe till its reset is de-asserted.
      So do the RESET de-assertion in the MDIO bus driver.
      
      [1] - am572x-idk, am571x-idk, a437x-idk
      Signed-off-by: NRoger Quadros <rogerq@ti.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      69226896
  11. 30 3月, 2017 1 次提交
    • F
      net: phy: Allow building mdio-boardinfo into the kernel · d0281a56
      Florian Fainelli 提交于
      mdio-boardinfo contains code that is helpful for platforms to register
      specific MDIO bus devices independent of how CONFIG_MDIO_DEVICE or
      CONFIG_PHYLIB will be selected (modular or built-in). In order to make
      that possible, let's do the following:
      
      - descend into drivers/net/phy/ unconditionally
      
      - make mdiobus_setup_mdiodev_from_board_info() take a callback argument
        which allows us not to expose the internal MDIO board info list and
        mutex, yet maintain the logic within the same file
      
      - relocate the code that creates a MDIO device into
        drivers/net/phy/mdio_bus.c
      
      - build mdio-boardinfo.o into the kernel as soon as MDIO_DEVICE is
        defined (y or m)
      
      Fixes: 90eff909 ("net: phy: Allow splitting MDIO bus/device support from PHYs")
      Fixes: 648ea013 ("net: phy: Allow pre-declaration of MDIO devices")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Tested-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d0281a56
  12. 25 3月, 2017 1 次提交
    • F
      net: phy: Allow splitting MDIO bus/device support from PHYs · 90eff909
      Florian Fainelli 提交于
      Introduce a new configuration symbol: MDIO_DEVICE which allows building
      the MDIO devices and bus code, without pulling in the entire Ethernet
      PHY library and devices code.
      
      PHYLIB nows select MDIO_DEVICE and the relevant Makefile files are
      updated to reflect that.
      
      When MDIO_DEVICE (MDIO bus/device only) is selected, but not PHYLIB, we
      have mdio-bus.ko as a loadable module, and it does not have a
      module_exit() function because the safety of removing a bus class is
      unclear.
      
      When both MDIO_DEVICE and PHYLIB are enabled, we need to assemble
      everything into a common loadable module: libphy.ko because of nasty
      circular dependencies between phy.c, phy_device.c and mdio_bus.c which
      are really tough to untangle.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      90eff909
  13. 07 2月, 2017 1 次提交
  14. 25 11月, 2016 1 次提交
  15. 05 5月, 2016 1 次提交
  16. 02 5月, 2016 1 次提交
    • M
      mdio_bus: Fix MDIO bus scanning in __mdiobus_register() · 70e927b9
      Marek Vasut 提交于
      Since commit b74766a0 ("phylib: don't return NULL
      from get_phy_device()") in linux-next, phy_get_device() will return
      ERR_PTR(-ENODEV) instead of NULL if the PHY device ID is all ones.
      
      This causes problem with stmmac driver and likely some other drivers
      which call mdiobus_register(). I triggered this bug on SoCFPGA MCVEVK
      board with linux-next 20160427 and 20160428. In case of the stmmac, if
      there is no PHY node specified in the DT for the stmmac block, the stmmac
      driver ( drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c function
      stmmac_mdio_register() ) will call mdiobus_register() , which will
      register the MDIO bus and probe for the PHY.
      
      The mdiobus_register() resp. __mdiobus_register() iterates over all of
      the addresses on the MDIO bus and calls mdiobus_scan() for each of them,
      which invokes get_phy_device(). Before the aforementioned patch, the
      mdiobus_scan() would return NULL if no PHY was found on a given address
      and mdiobus_register() would continue and try the next PHY address. Now,
      mdiobus_scan() returns ERR_PTR(-ENODEV), which is caught by the
      'if (IS_ERR(phydev))' condition and the loop exits immediately if the
      PHY address does not contain PHY.
      
      Repair this by explicitly checking for the ERR_PTR(-ENODEV) and if this
      error comes around, continue with the next PHY address.
      Signed-off-by: NMarek Vasut <marex@denx.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      70e927b9
  17. 27 4月, 2016 1 次提交
  18. 12 4月, 2016 1 次提交
  19. 13 1月, 2016 1 次提交
  20. 08 1月, 2016 10 次提交
  21. 23 10月, 2015 1 次提交
  22. 26 9月, 2015 1 次提交
  23. 25 9月, 2015 3 次提交
    • R
      phy: add phy_device_remove() · 38737e49
      Russell King 提交于
      Add a phy_device_remove() function to complement phy_device_register(),
      which undoes the effects of phy_device_register() by removing the phy
      device from visibility, but not freeing it.
      
      This allows these details to be moved out of the mdio bus code into
      the phy code where this action belongs.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      38737e49
    • R
      phy: fix mdiobus module safety · 3e3aaf64
      Russell King 提交于
      Re-implement the mdiobus module refcounting to ensure that we actually
      ensure that the mdiobus module code does not go away while we might call
      into it.
      
      The old scheme using bus->dev.driver was buggy, because bus->dev is a
      class device which never has a struct device_driver associated with it,
      and hence the associated code trying to obtain a refcount did nothing
      useful.
      
      Instead, take the approach that other subsystems do: pass the module
      when calling mdiobus_register(), and record that in the mii_bus struct.
      When we need to increment the module use count in the phy code, use
      this stored pointer.  When the phy is deteched, drop the module
      refcount, remembering that the phy device might go away at that point.
      
      This doesn't stop the mii_bus going away while there are in-use phys -
      it merely stops the underlying code vanishing.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3e3aaf64
    • R
      phy: fix of_mdio_find_bus() device refcount leak · a1364421
      Russell King 提交于
      of_mdio_find_bus() leaks a struct device refcount, caused by using
      class_find_device() and not realising that the device reference has
      its refcount incremented:
      
       * Note, you will need to drop the reference with put_device() after use.
      ...
              while ((dev = class_dev_iter_next(&iter))) {
                      if (match(dev, data)) {
                              get_device(dev);
                              break;
                      }
      
      Update the comment, and arrange for the phy code to drop this refcount
      when disposing of a reference to it.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a1364421
  24. 02 9月, 2015 1 次提交
    • M
      phylib: fix device deletion order in mdiobus_unregister() · b6c6aedc
      Mark Salter 提交于
      commit 8b63ec18 ("phylib: Make PHYs children of their MDIO bus, not
      the bus' parent.") uncovered a problem in mdiobus_unregister() which
      leads to this warning when I reboot an APM Mustang (arm64) platform:
      
        WARNING: CPU: 7 PID: 4239 at fs/sysfs/group.c:224 sysfs_remove_group+0xa0/0xa4()
        sysfs group fffffe0000e07a10 not found for kobject 'xgene-mii-eth0:03'
        ...
        CPU: 7 PID: 4239 Comm: reboot Tainted: G            E   4.2.0-0.18.el7.test15.aarch64 #1
        Hardware name: AppliedMicro Mustang/Mustang, BIOS 1.1.0 Aug 26 2015
        Call Trace:
        [<fffffe000009739c>] dump_backtrace+0x0/0x170
        [<fffffe000009752c>] show_stack+0x20/0x2c
        [<fffffe00007436f0>] dump_stack+0x78/0x9c
        [<fffffe00000c2cb4>] warn_slowpath_common+0xa0/0xd8
        [<fffffe00000c2d60>] warn_slowpath_fmt+0x74/0x88
        [<fffffe0000293d3c>] sysfs_remove_group+0x9c/0xa4
        [<fffffe00004a8bac>] dpm_sysfs_remove+0x5c/0x70
        [<fffffe000049b388>] device_del+0x44/0x208
        [<fffffe000049b578>] device_unregister+0x2c/0x7c
        [<fffffe000050dc68>] mdiobus_unregister+0x48/0x94
        [<fffffe000052afd0>] xgene_enet_mdio_remove+0x28/0x44
        [<fffffe000052d3f0>] xgene_enet_remove+0xd0/0xd8
        [<fffffe000052d424>] xgene_enet_shutdown+0x2c/0x3c
        [<fffffe00004a204c>] platform_drv_shutdown+0x24/0x40
        [<fffffe000049d4f4>] device_shutdown+0xf0/0x1b4
        [<fffffe00000e31ec>] kernel_restart_prepare+0x40/0x4c
        [<fffffe00000e32f8>] kernel_restart+0x1c/0x80
        [<fffffe00000e3670>] SyS_reboot+0x17c/0x250
      
      The problem is that mdiobus_unregister() deletes the bus device before
      unregistering the phy devices on the bus. This wasn't a problem before
      because the phys were not children of the bus:
      
        /sys/devices/platform/APMC0D05:00/net/eth0/xgene-mii-eth0:03
        /sys/devices/platform/APMC0D05:00/net/eth0/xgene-mii-eth0
      
      But now that they are:
      
        /sys/devices/platform/APMC0D05:00/net/eth0/xgene-mii-eth0/xgene-mii-eth0:03
      
      when mdiobus_unregister deletes the bus device, the phy subdirs are
      removed from sysfs also. So when the phys are unregistered afterward,
      we get the warning. This patch changes the order so that phys are
      unregistered before the bus device is deleted.
      
      Fixes: 8b63ec18 ("phylib: Make PHYs children of their MDIO bus, not the bus' parent.")
      Signed-off-by: NMark Salter <msalter@redhat.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Tested-by: NMark Langsdorf <mlangsdo@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b6c6aedc
  25. 21 7月, 2015 1 次提交
  26. 27 1月, 2015 2 次提交
  27. 30 8月, 2014 1 次提交