1. 25 Nov, 2020 19 commits
    • Christian Eggers's avatar
      net: phy: dp83640: use new PTP_MSGTYPE_SYNC define · 651c814f
      Christian Eggers authored
      Replace use of magic number with recently introduced define.
      Signed-off-by: default avatarChristian Eggers <ceggers@arri.de>
      Reviewed-by: Kurt Kanzenbach's avatarKurt Kanzenbach <kurt@linutronix.de>
      Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      651c814f
    • Jakub Kicinski's avatar
      Merge branch 'net-phy-add-support-for-shared-interrupts-part-3' · 06254738
      Jakub Kicinski authored
      Ioana Ciornei says:
      
      ====================
      net: phy: add support for shared interrupts (part 3)
      
      This patch set aims to actually add support for shared interrupts in
      phylib and not only for multi-PHY devices. While we are at it,
      streamline the interrupt handling in phylib.
      
      For a bit of context, at the moment, there are multiple phy_driver ops
      that deal with this subject:
      
      - .config_intr() - Enable/disable the interrupt line.
      
      - .ack_interrupt() - Should quiesce any interrupts that may have been
        fired.  It's also used by phylib in conjunction with .config_intr() to
        clear any pending interrupts after the line was disabled, and before
        it is going to be enabled.
      
      - .did_interrupt() - Intended for multi-PHY devices with a shared IRQ
        line and used by phylib to discern which PHY from the package was the
        one that actually fired the interrupt.
      
      - .handle_interrupt() - Completely overrides the default interrupt
        handling logic from phylib. The PHY driver is responsible for checking
        if any interrupt was fired by the respective PHY and choose
        accordingly if it's the one that should trigger the link state machine.
      
      From my point of view, the interrupt handling in phylib has become
      somewhat confusing with all these callbacks that actually read the same
      PHY register - the interrupt status.  A more streamlined approach would
      be to just move the responsibility to write an interrupt handler to the
      driver (as any other device driver does) and make .handle_interrupt()
      the only way to deal with interrupts.
      
      Another advantage with this approach would be that phylib would gain
      support for shared IRQs between different PHY (not just multi-PHY
      devices), something which at the moment would require extending every
      PHY driver anyway in order to implement their .did_interrupt() callback
      and duplicate the same logic as in .ack_interrupt(). The disadvantage
      of making .did_interrupt() mandatory would be that we are slightly
      changing the semantics of the phylib API and that would increase
      confusion instead of reducing it.
      
      What I am proposing is the following:
      
      - As a first step, make the .ack_interrupt() callback optional so that
        we do not break any PHY driver amid the transition.
      
      - Every PHY driver gains a .handle_interrupt() implementation that, for
        the most part, would look like below:
      
      	irq_status = phy_read(phydev, INTR_STATUS);
      	if (irq_status < 0) {
      		phy_error(phydev);
      		return IRQ_NONE;
      	}
      
      	if (!(irq_status & irq_mask))
      		return IRQ_NONE;
      
      	phy_trigger_machine(phydev);
      
      	return IRQ_HANDLED;
      
      - Remove each PHY driver's implementation of the .ack_interrupt() by
        actually taking care of quiescing any pending interrupts before
        enabling/after disabling the interrupt line.
      
      - Finally, after all drivers have been ported, remove the
        .ack_interrupt() and .did_interrupt() callbacks from phy_driver.
      
      This patch set is part 3 (and final) of the entire change set and it
      addresses the remaining PHY drivers that have not been migrated
      previosly. Also, it finally removed the .did_interrupt() and
      .ack_interrupt() callbacks since they are of no use anymore.
      
      I do not have access to most of these PHY's, therefore I Cc-ed the
      latest contributors to the individual PHY drivers in order to have
      access, hopefully, to more regression testing.
      ====================
      
      Link: https://lore.kernel.org/r/20201123153817.1616814-1-ciorneiioana@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      06254738
    • Ioana Ciornei's avatar
      net: phy: remove the .did_interrupt() and .ack_interrupt() callback · 6527b938
      Ioana Ciornei authored
      Now that all the PHY drivers have been migrated to directly implement
      the generic .handle_interrupt() callback for a seamless support of
      shared IRQs and all the .config_inter() implementations clear any
      pending interrupts, we can safely remove the two callbacks.
      
      With this patch, phylib has a proper support for shared IRQs (and not
      just for multi-PHY devices. A PHY driver must implement both the
      .handle_interrupt() and .config_intr() callbacks for the IRQs to be
      actually used.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      6527b938
    • Ioana Ciornei's avatar
      net: phy: qsemi: remove the use of .ack_interrupt() · a1a44174
      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.
      
      Also, add a comment describing the multiple step interrupt
      acknoledgement process.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a1a44174
    • Ioana Ciornei's avatar
      net: phy: qsemi: implement generic .handle_interrupt() callback · efc3d9de
      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>
      efc3d9de
    • Ioana Ciornei's avatar
      net: phy: ti: remove the use of .ack_interrupt() · aa2d603a
      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: Dan Murphy <dmurphy@ti.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      aa2d603a
    • Ioana Ciornei's avatar
      net: phy: ti: implement generic .handle_interrupt() callback · 1d1ae3c6
      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: Dan Murphy <dmurphy@ti.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1d1ae3c6
    • Ioana Ciornei's avatar
      net: phy: national: remove the use of the .ack_interrupt() · a4d77421
      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>
      a4d77421
    • Ioana Ciornei's avatar
      net: phy: national: implement generic .handle_interrupt() callback · 6571b455
      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>
      6571b455
    • Ioana Ciornei's avatar
      net: phy: micrel: remove the use of .ack_interrupt() · c0c99d0c
      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: Divya Koppera <Divya.Koppera@microchip.com>
      Cc: Oleksij Rempel <o.rempel@pengutronix.de>
      Cc: Philippe Schenker <philippe.schenker@toradex.com>
      Cc: Marek Vasut <marex@denx.de>
      Cc: Antoine Tenart <atenart@kernel.org>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c0c99d0c
    • Ioana Ciornei's avatar
      net: phy: micrel: implement generic .handle_interrupt() callback · 59ca4e58
      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: Divya Koppera <Divya.Koppera@microchip.com>
      Cc: Oleksij Rempel <o.rempel@pengutronix.de>
      Cc: Philippe Schenker <philippe.schenker@toradex.com>
      Cc: Marek Vasut <marex@denx.de>
      Cc: Antoine Tenart <atenart@kernel.org>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      59ca4e58
    • Ioana Ciornei's avatar
      net: phy: meson-gxl: remove the use of .ack_callback() · 84c8f773
      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: Jerome Brunet <jbrunet@baylibre.com>
      Cc: Neil Armstrong <narmstrong@baylibre.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      84c8f773
    • Ioana Ciornei's avatar
      net: phy: meson-gxl: implement generic .handle_interrupt() callback · 6719e2be
      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: Jerome Brunet <jbrunet@baylibre.com>
      Cc: Neil Armstrong <narmstrong@baylibre.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      6719e2be
    • Ioana Ciornei's avatar
      net: phy: icplus: remove the use .ack_interrupt() · 12ae7ba3
      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: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      12ae7ba3
    • Ioana Ciornei's avatar
      net: phy: icplus: implement generic .handle_interrupt() callback · 25497b7f
      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>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      25497b7f
    • Ioana Ciornei's avatar
      net: phy: intel-xway: remove the use of .ack_interrupt() · 16c9709a
      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: Mathias Kresin <dev@kresin.me>
      Cc: Hauke Mehrtens <hauke@hauke-m.de>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      16c9709a
    • Ioana Ciornei's avatar
      net: phy: intel-xway: implement generic .handle_interrupt() callback · 1566db04
      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: Mathias Kresin <dev@kresin.me>
      Cc: Hauke Mehrtens <hauke@hauke-m.de>
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1566db04
    • Sven Van Asbroeck's avatar
      lan743x: replace polling loop by wait_event_timeout() · 470dfd80
      Sven Van Asbroeck authored
      The driver's ISR sends a 'software interrupt' event to the probe()
      thread using the following method:
      - probe(): write 0 to flag, enable s/w interrupt
      - probe(): poll on flag, relax using usleep_range()
      - ISR    : write 1 to flag
      
      Replace with wake_up() / wait_event_timeout(). Besides being easier
      to get right, this abstraction has better timing and memory
      consistency properties.
      
      Tested-by: Sven Van Asbroeck <thesven73@gmail.com> # lan7430
      Signed-off-by: default avatarSven Van Asbroeck <thesven73@gmail.com>
      Link: https://lore.kernel.org/r/20201123191529.14908-2-TheSven73@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      470dfd80
    • Sven Van Asbroeck's avatar
      lan743x: clean up software_isr function · c31799ba
      Sven Van Asbroeck authored
      For no apparent reason, this function reads the INT_STS register, and
      checks if the software interrupt bit is set. These things have already
      been carried out by this function's only caller.
      
      Clean up by removing the redundant code.
      
      Tested-by: Sven Van Asbroeck <thesven73@gmail.com> # lan7430
      Signed-off-by: default avatarSven Van Asbroeck <thesven73@gmail.com>
      Link: https://lore.kernel.org/r/20201123191529.14908-1-TheSven73@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c31799ba
  2. 24 Nov, 2020 21 commits