1. 06 Nov, 2020 18 commits
    • Ioana Ciornei's avatar
      net: phy: realtek: implement generic .handle_interrupt() callback · 03829163
      Ioana Ciornei authored
      In an attempt to actually support shared IRQs in phylib, we now move the
      responsibility of triggering the phylib state machine or just returning
      IRQ_NONE, based on the IRQ status register, to the PHY driver. Having
      3 different IRQ handling callbacks (.handle_interrupt(),
      .did_interrupt() and .ack_interrupt() ) is confusing so let the PHY
      driver implement directly an IRQ handler like any other device driver.
      Make this driver follow the new convention.
      
      Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
      Cc: Willy Liu <willy.liu@realtek.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      03829163
    • Ioana Ciornei's avatar
      net: phy: add genphy_handle_interrupt_no_ack() · 87de1f05
      Ioana Ciornei authored
      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: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      87de1f05
    • Ioana Ciornei's avatar
      net: phy: davicom: remove the use of .ack_interrupt() · 0d65cc18
      Ioana Ciornei authored
      In preparation of removing the .ack_interrupt() callback, we must replace
      its occurrences (aka phy_clear_interrupt), from the 2 places where it is
      called from (phy_enable_interrupts and phy_disable_interrupts), with
      equivalent functionality.
      
      This means that clearing interrupts now becomes something that the PHY
      driver is responsible of doing, before enabling interrupts and after
      clearing them. Make this driver follow the new contract.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0d65cc18
    • Ioana Ciornei's avatar
      net: phy: davicom: implement generic .handle_interrupt() calback · e954631c
      Ioana Ciornei authored
      In an attempt to actually support shared IRQs in phylib, we now move the
      responsibility of triggering the phylib state machine or just returning
      IRQ_NONE, based on the IRQ status register, to the PHY driver. Having
      3 different IRQ handling callbacks (.handle_interrupt(),
      .did_interrupt() and .ack_interrupt() ) is confusing so let the PHY
      driver implement directly an IRQ handler like any other device driver.
      Make this driver follow the new convention.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e954631c
    • Ioana Ciornei's avatar
      net: phy: cicada: remove the use of .ack_interrupt() · a758087f
      Ioana Ciornei authored
      In preparation of removing the .ack_interrupt() callback, we must replace
      its occurrences (aka phy_clear_interrupt), from the 2 places where it is
      called from (phy_enable_interrupts and phy_disable_interrupts), with
      equivalent functionality.
      
      This means that clearing interrupts now becomes something that the PHY
      driver is responsible of doing, before enabling interrupts and after
      clearing them. Make this driver follow the new contract.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a758087f
    • Ioana Ciornei's avatar
      net: phy: cicada: implement the generic .handle_interrupt() callback · e5d2b0b6
      Ioana Ciornei authored
      In an attempt to actually support shared IRQs in phylib, we now move the
      responsibility of triggering the phylib state machine or just returning
      IRQ_NONE, based on the IRQ status register, to the PHY driver. Having
      3 different IRQ handling callbacks (.handle_interrupt(),
      .did_interrupt() and .ack_interrupt() ) is confusing so let the PHY
      driver implement directly an IRQ handler like any other device driver.
      Make this driver follow the new convention.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e5d2b0b6
    • Ioana Ciornei's avatar
      net: phy: broadcom: remove use of ack_interrupt() · 15772e4d
      Ioana Ciornei authored
      In preparation of removing the .ack_interrupt() callback, we must replace
      its occurrences (aka phy_clear_interrupt), from the 2 places where it is
      called from (phy_enable_interrupts and phy_disable_interrupts), with
      equivalent functionality.
      
      This means that clearing interrupts now becomes something that the PHY
      driver is responsible of doing, before enabling interrupts and after
      clearing them. Make this driver follow the new contract.
      
      Cc: Michael Walle <michael@walle.cc>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      15772e4d
    • Ioana Ciornei's avatar
      net: phy: broadcom: implement generic .handle_interrupt() callback · 4567d5c3
      Ioana Ciornei authored
      In an attempt to actually support shared IRQs in phylib, we now move the
      responsibility of triggering the phylib state machine or just returning
      IRQ_NONE, based on the IRQ status register, to the PHY driver. Having
      3 different IRQ handling callbacks (.handle_interrupt(),
      .did_interrupt() and .ack_interrupt() ) is confusing so let the PHY
      driver implement directly an IRQ handler like any other device driver.
      Make this driver follow the new convention.
      
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Tested-by: default avatarMichael Walle <michael@walle.cc>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      4567d5c3
    • Ioana Ciornei's avatar
      net: phy: aquantia: remove the use of .ack_interrupt() · e11ef96d
      Ioana Ciornei authored
      In preparation of removing the .ack_interrupt() callback, we must replace
      its occurrences (aka phy_clear_interrupt), from the 2 places where it is
      called from (phy_enable_interrupts and phy_disable_interrupts), with
      equivalent functionality.
      
      This means that clearing interrupts now becomes something that the PHY
      driver is responsible of doing, before enabling interrupts and after
      clearing them. Make this driver follow the new contract.
      
      Cc: Heiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e11ef96d
    • Ioana Ciornei's avatar
      net: phy: aquantia: implement generic .handle_interrupt() callback · 6ab930df
      Ioana Ciornei authored
      In an attempt to actually support shared IRQs in phylib, we now move the
      responsibility of triggering the phylib state machine or just returning
      IRQ_NONE, based on the IRQ status register, to the PHY driver. Having
      3 different IRQ handling callbacks (.handle_interrupt(),
      .did_interrupt() and .ack_interrupt() ) is confusing so let the PHY
      driver implement directly an IRQ handler like any other device driver.
      Make this driver follow the new convention.
      
      Cc: Heiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      6ab930df
    • Ioana Ciornei's avatar
      net: phy: mscc: remove the use of .ack_interrupt() · 30446ae4
      Ioana Ciornei authored
      In preparation of removing the .ack_interrupt() callback, we must replace
      its occurrences (aka phy_clear_interrupt), from the 2 places where it is
      called from (phy_enable_interrupts and phy_disable_interrupts), with
      equivalent functionality.
      
      This means that clearing interrupts now becomes something that the PHY
      driver is responsible of doing, before enabling interrupts and after
      clearing them. Make this driver follow the new contract.
      
      Cc: Antoine Tenart <atenart@kernel.org>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Tested-by: Vladimir Oltean <olteanv@gmail.com> # VSC8514
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      30446ae4
    • Ioana Ciornei's avatar
      net: phy: mscc: implement generic .handle_interrupt() callback · 4008f373
      Ioana Ciornei authored
      In an attempt to actually support shared IRQs in phylib, we now move the
      responsibility of triggering the phylib state machine or just returning
      IRQ_NONE, based on the IRQ status register, to the PHY driver. Having
      3 different IRQ handling callbacks (.handle_interrupt(),
      .did_interrupt() and .ack_interrupt() ) is confusing so let the PHY
      driver implement directly an IRQ handler like any other device driver.
      Make this driver follow the new convention.
      
      Also, remove the .did_interrupt() callback since it's not anymore used.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Tested-by: Vladimir Oltean <olteanv@gmail.com> # VSC8514
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      4008f373
    • Ioana Ciornei's avatar
      net: phy: mscc: use phy_trigger_machine() to notify link change · f2e90604
      Ioana Ciornei authored
      According to the comment describing the phy_mac_interrupt() function, it
      it intended to be used by MAC drivers which have noticed a link change
      thus its use in the mscc PHY driver is improper and, most probably, was
      added just because phy_trigger_machine() was not exported.
      Now that we have acces to trigger the link state machine, use directly
      the phy_trigger_machine() function to notify a link change detected by
      the PHY driver.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Tested-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f2e90604
    • Ioana Ciornei's avatar
      net: phy: at803x: remove the use of .ack_interrupt() · a3417885
      Ioana Ciornei authored
      In preparation of removing the .ack_interrupt() callback, we must replace
      its occurrences (aka phy_clear_interrupt), from the 2 places where it is
      called from (phy_enable_interrupts and phy_disable_interrupts), with
      equivalent functionality.
      
      This means that clearing interrupts now becomes something that the PHY
      driver is responsible of doing, before enabling interrupts and after
      clearing them. Make this driver follow the new contract.
      
      Cc: Oleksij Rempel <o.rempel@pengutronix.de>
      Cc: Michael Walle <michael@walle.cc>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Tested-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a3417885
    • Ioana Ciornei's avatar
      net: phy: at803x: implement generic .handle_interrupt() callback · 29773097
      Ioana Ciornei authored
      In an attempt to actually support shared IRQs in phylib, we now move the
      responsibility of triggering the phylib state machine or just returning
      IRQ_NONE, based on the IRQ status register, to the PHY driver. Having
      3 different IRQ handling callbacks (.handle_interrupt(),
      .did_interrupt() and .ack_interrupt() ) is confusing so let the PHY
      driver implement directly an IRQ handler like any other device driver.
      Make this driver follow the new convention.
      
      Cc: Oleksij Rempel <o.rempel@pengutronix.de>
      Cc: Michael Walle <michael@walle.cc>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Tested-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      29773097
    • Ioana Ciornei's avatar
      net: phy: make .ack_interrupt() optional · 7b2d5908
      Ioana Ciornei authored
      As a first step into making phylib and all PHY drivers to actually
      have support for shared IRQs, make the .ack_interrupt() callback
      optional.
      
      After all drivers have been moved to implement the generic
      interrupt handle, the phy_drv_supports_irq() check will be
      changed again to only require the .handle_interrupts() callback.
      
      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: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7b2d5908
    • Ioana Ciornei's avatar
      net: phy: add a shutdown procedure · e2f016cf
      Ioana Ciornei authored
      In case of a board which uses a shared IRQ we can easily end up with an
      IRQ storm after a forced reboot.
      
      For example, a 'reboot -f' will trigger a call to the .shutdown()
      callbacks of all devices. Because phylib does not implement that hook,
      the PHY is not quiesced, thus it can very well leave its IRQ enabled.
      
      At the next boot, if that IRQ line is found asserted by the first PHY
      driver that uses it, but _before_ the driver that is _actually_ keeping
      the shared IRQ asserted is probed, the IRQ is not going to be
      acknowledged, thus it will keep being fired preventing the boot process
      of the kernel to continue. This is even worse when the second PHY driver
      is a module.
      
      To fix this, implement the .shutdown() callback and disable the
      interrupts if these are used.
      
      Note that we are still susceptible to IRQ storms if the previous kernel
      exited with a panic or if the bootloader left the shared IRQ active, but
      there is absolutely nothing we can do about these cases.
      
      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: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e2f016cf
    • Ioana Ciornei's avatar
      net: phy: export phy_error and phy_trigger_machine · 293e9a3d
      Ioana Ciornei authored
      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: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      293e9a3d
  2. 05 Nov, 2020 22 commits