1. 20 4月, 2021 1 次提交
  2. 10 4月, 2021 1 次提交
    • H
      net: phy: make PHY PM ops a no-op if MAC driver manages PHY PM · fba863b8
      Heiner Kallweit 提交于
      Resume callback of the PHY driver is called after the one for the MAC
      driver. The PHY driver resume callback calls phy_init_hw(), and this is
      potentially problematic if the MAC driver calls phy_start() in its resume
      callback. One issue was reported with the fec driver and a KSZ8081 PHY
      which seems to become unstable if a soft reset is triggered during aneg.
      
      The new flag allows MAC drivers to indicate that they take care of
      suspending/resuming the PHY. Then the MAC PM callbacks can handle
      any dependency between MAC and PHY PM.
      Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      fba863b8
  3. 25 3月, 2021 1 次提交
  4. 17 2月, 2021 2 次提交
  5. 16 2月, 2021 1 次提交
  6. 12 2月, 2021 1 次提交
  7. 20 1月, 2021 1 次提交
    • A
      mdio, phy: fix -Wshadow warnings triggered by nested container_of() · 7eab14de
      Alexander Lobakin 提交于
      container_of() macro hides a local variable '__mptr' inside. This
      becomes a problem when several container_of() are nested in each
      other within single line or plain macros.
      As C preprocessor doesn't support generating random variable names,
      the sole solution is to avoid defining macros that consist only of
      container_of() calls, or they will self-shadow '__mptr' each time:
      
      In file included from ./include/linux/bitmap.h:10,
                       from drivers/net/phy/phy_device.c:12:
      drivers/net/phy/phy_device.c: In function ‘phy_device_release’:
      ./include/linux/kernel.h:693:8: warning: declaration of ‘__mptr’ shadows a previous local [-Wshadow]
        693 |  void *__mptr = (void *)(ptr);     \
            |        ^~~~~~
      ./include/linux/phy.h:647:26: note: in expansion of macro ‘container_of’
        647 | #define to_phy_device(d) container_of(to_mdio_device(d), \
            |                          ^~~~~~~~~~~~
      ./include/linux/mdio.h:52:27: note: in expansion of macro ‘container_of’
         52 | #define to_mdio_device(d) container_of(d, struct mdio_device, dev)
            |                           ^~~~~~~~~~~~
      ./include/linux/phy.h:647:39: note: in expansion of macro ‘to_mdio_device’
        647 | #define to_phy_device(d) container_of(to_mdio_device(d), \
            |                                       ^~~~~~~~~~~~~~
      drivers/net/phy/phy_device.c:217:8: note: in expansion of macro ‘to_phy_device’
        217 |  kfree(to_phy_device(dev));
            |        ^~~~~~~~~~~~~
      ./include/linux/kernel.h:693:8: note: shadowed declaration is here
        693 |  void *__mptr = (void *)(ptr);     \
            |        ^~~~~~
      ./include/linux/phy.h:647:26: note: in expansion of macro ‘container_of’
        647 | #define to_phy_device(d) container_of(to_mdio_device(d), \
            |                          ^~~~~~~~~~~~
      drivers/net/phy/phy_device.c:217:8: note: in expansion of macro ‘to_phy_device’
        217 |  kfree(to_phy_device(dev));
            |        ^~~~~~~~~~~~~
      
      As they are declared in header files, these warnings are highly
      repetitive and very annoying (along with the one from linux/pci.h).
      
      Convert the related macros from linux/{mdio,phy}.h to static inlines
      to avoid self-shadowing and potentially improve bug-catching.
      No functional changes implied.
      Signed-off-by: NAlexander Lobakin <alobakin@pm.me>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20210116161246.67075-1-alobakin@pm.meSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      7eab14de
  8. 15 1月, 2021 1 次提交
  9. 17 12月, 2020 1 次提交
  10. 26 11月, 2020 1 次提交
  11. 06 11月, 2020 2 次提交
    • I
      net: phy: add genphy_handle_interrupt_no_ack() · 87de1f05
      Ioana Ciornei 提交于
      It seems there are cases where the interrupts are handled by another
      entity (ie an IRQ controller embedded inside the PHY) and do not need
      any other interraction from phylib. For this kind of PHYs, like the
      RTL8366RB, add the genphy_handle_interrupt_no_ack() function which just
      triggers the link state machine.
      Signed-off-by: NIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      87de1f05
    • I
      net: phy: export phy_error and phy_trigger_machine · 293e9a3d
      Ioana Ciornei 提交于
      These functions are currently used by phy_interrupt() to either signal
      an error condition or to trigger the link state machine. In an attempt
      to actually support shared PHY IRQs, export these two functions so that
      the actual PHY drivers can use them.
      
      Cc: Alexandru Ardelean <alexandru.ardelean@analog.com>
      Cc: Andre Edich <andre.edich@microchip.com>
      Cc: Antoine Tenart <atenart@kernel.org>
      Cc: Baruch Siach <baruch@tkos.co.il>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Dan Murphy <dmurphy@ti.com>
      Cc: Divya Koppera <Divya.Koppera@microchip.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Hauke Mehrtens <hauke@hauke-m.de>
      Cc: Heiner Kallweit <hkallweit1@gmail.com>
      Cc: Jerome Brunet <jbrunet@baylibre.com>
      Cc: Kavya Sree Kotagiri <kavyasree.kotagiri@microchip.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Marco Felsch <m.felsch@pengutronix.de>
      Cc: Marek Vasut <marex@denx.de>
      Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
      Cc: Mathias Kresin <dev@kresin.me>
      Cc: Maxim Kochetkov <fido_max@inbox.ru>
      Cc: Michael Walle <michael@walle.cc>
      Cc: Neil Armstrong <narmstrong@baylibre.com>
      Cc: Nisar Sayed <Nisar.Sayed@microchip.com>
      Cc: Oleksij Rempel <o.rempel@pengutronix.de>
      Cc: Philippe Schenker <philippe.schenker@toradex.com>
      Cc: Willy Liu <willy.liu@realtek.com>
      Cc: Yuiko Oshino <yuiko.oshino@microchip.com>
      Signed-off-by: NIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      293e9a3d
  12. 29 10月, 2020 1 次提交
    • M
      net: phy: remove kernel-doc duplication · e86c6569
      Mauro Carvalho Chehab 提交于
      Sphinx 3 now checks for duplicated function declarations:
      
      	.../Documentation/networking/kapi:143: ../include/linux/phy.h:163: WARNING: Duplicate C declaration, also defined in 'networking/kapi'.
      	Declaration is 'unsigned int phy_supported_speeds (struct phy_device *phy, unsigned int *speeds, unsigned int size)'.
      	.../Documentation/networking/kapi:143: ../include/linux/phy.h:1034: WARNING: Duplicate C declaration, also defined in 'networking/kapi'.
      	Declaration is 'int phy_read_mmd (struct phy_device *phydev, int devad, u32 regnum)'.
      	.../Documentation/networking/kapi:143: ../include/linux/phy.h:1076: WARNING: Duplicate C declaration, also defined in 'networking/kapi'.
      	Declaration is 'int __phy_read_mmd (struct phy_device *phydev, int devad, u32 regnum)'.
      	.../Documentation/networking/kapi:143: ../include/linux/phy.h:1088: WARNING: Duplicate C declaration, also defined in 'networking/kapi'.
      	Declaration is 'int phy_write_mmd (struct phy_device *phydev, int devad, u32 regnum, u16 val)'.
      	.../Documentation/networking/kapi:143: ../include/linux/phy.h:1100: WARNING: Duplicate C declaration, also defined in 'networking/kapi'.
      	Declaration is 'int __phy_write_mmd (struct phy_device *phydev, int devad, u32 regnum, u16 val)'.
      
      It turns that both the C and the H files have the same
      kernel-doc markup for the same functions. Let's drop the
      at the header file, keeping the one closer to the code.
      Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/75e9a357f9a716833d2094b04898754876365e68.1603791716.git.mchehab+huawei@kernel.orgSigned-off-by: NJonathan Corbet <corbet@lwn.net>
      e86c6569
  13. 24 9月, 2020 2 次提交
  14. 04 8月, 2020 1 次提交
  15. 09 7月, 2020 1 次提交
  16. 08 7月, 2020 1 次提交
  17. 01 7月, 2020 2 次提交
    • B
      net: phy: don't abuse devres in devm_mdiobus_register() · ac3a68d5
      Bartosz Golaszewski 提交于
      We currently have two managed helpers for mdiobus - devm_mdiobus_alloc()
      and devm_mdiobus_register(). The idea behind devres is that the release
      callback releases whatever resource the devm function allocates. In the
      mdiobus case however there's no devres associated with the device by
      devm_mdiobus_register(). Instead the release callback for
      devm_mdiobus_alloc(): _devm_mdiobus_free() unregisters the device if
      it is marked as managed.
      
      This all seems wrong. The managed structure shouldn't need to know or
      care about whether it's managed or not - and this is the case now for
      struct mii_bus. The devres wrapper should be opaque to the managed
      resource.
      
      This changeset makes devm_mdiobus_alloc() and devm_mdiobus_register()
      conform to common devres standards: devm_mdiobus_alloc() allocates a
      devres structure and registers a callback that will call mdiobus_free().
      __devm_mdiobus_register() allocated another devres and registers a
      callback that will unregister the bus.
      Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ac3a68d5
    • B
      phy: un-inline devm_mdiobus_register() · 8b11c20a
      Bartosz Golaszewski 提交于
      Functions should only be static inline if they're very short. This
      devres helper is already over 10 lines and it will grow soon as we'll
      be improving upon its approach. Pull it into mdio_devres.c.
      Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8b11c20a
  18. 26 6月, 2020 1 次提交
  19. 25 6月, 2020 2 次提交
  20. 24 6月, 2020 1 次提交
  21. 20 6月, 2020 3 次提交
  22. 27 5月, 2020 3 次提交
  23. 22 5月, 2020 1 次提交
  24. 19 5月, 2020 1 次提交
    • D
      net: phy: simplify phy_link_change arguments · a307593a
      Doug Berger 提交于
      This function was introduced to allow for different handling of
      link up and link down events particularly with regard to the
      netif_carrier. The third argument do_carrier allowed the flag to
      be left unchanged.
      
      Since then the phylink has introduced an implementation that
      completely ignores the third parameter since it never wants to
      change the flag and the phylib always sets the third parameter
      to true so the flag is always changed.
      
      Therefore the third argument (i.e. do_carrier) is no longer
      necessary and can be removed. This also means that the phylib
      phy_link_down() function no longer needs its second argument.
      Signed-off-by: NDoug Berger <opendmb@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a307593a
  25. 11 5月, 2020 4 次提交
  26. 07 5月, 2020 2 次提交
    • O
      ethtool: provide UAPI for PHY master/slave configuration. · bdbdac76
      Oleksij Rempel 提交于
      This UAPI is needed for BroadR-Reach 100BASE-T1 devices. Due to lack of
      auto-negotiation support, we needed to be able to configure the
      MASTER-SLAVE role of the port manually or from an application in user
      space.
      
      The same UAPI can be used for 1000BASE-T or MultiGBASE-T devices to
      force MASTER or SLAVE role. See IEEE 802.3-2018:
      22.2.4.3.7 MASTER-SLAVE control register (Register 9)
      22.2.4.3.8 MASTER-SLAVE status register (Register 10)
      40.5.2 MASTER-SLAVE configuration resolution
      45.2.1.185.1 MASTER-SLAVE config value (1.2100.14)
      45.2.7.10 MultiGBASE-T AN control 1 register (Register 7.32)
      
      The MASTER-SLAVE role affects the clock configuration:
      
      -------------------------------------------------------------------------------
      When the  PHY is configured as MASTER, the PMA Transmit function shall
      source TX_TCLK from a local clock source. When configured as SLAVE, the
      PMA Transmit function shall source TX_TCLK from the clock recovered from
      data stream provided by MASTER.
      
      iMX6Q                     KSZ9031                XXX
      ------\                /-----------\        /------------\
            |                |           |        |            |
       MAC  |<----RGMII----->| PHY Slave |<------>| PHY Master |
            |<--- 125 MHz ---+-<------/  |        | \          |
      ------/                \-----------/        \------------/
                                                     ^
                                                      \-TX_TCLK
      
      -------------------------------------------------------------------------------
      
      Since some clock or link related issues are only reproducible in a
      specific MASTER-SLAVE-role, MAC and PHY configuration, it is beneficial
      to provide generic (not 100BASE-T1 specific) interface to the user space
      for configuration flexibility and trouble shooting.
      Signed-off-by: NOleksij Rempel <o.rempel@pengutronix.de>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bdbdac76
    • M
      net: phy: add concept of shared storage for PHYs · 63490847
      Michael Walle 提交于
      There are packages which contain multiple PHY devices, eg. a quad PHY
      transceiver. Provide functions to allocate and free shared storage.
      
      Usually, a quad PHY contains global registers, which don't belong to any
      PHY. Provide convenience functions to access these registers.
      Signed-off-by: NMichael Walle <michael@walle.cc>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      63490847
  27. 25 4月, 2020 1 次提交