An error occurred fetching the project authors.
  1. 18 Nov, 2023 3 commits
    • Kory Maincent's avatar
      net: Change the API of PHY default timestamp to MAC · 0f7f463d
      Kory Maincent authored
      Change the API to select MAC default time stamping instead of the PHY.
      Indeed the PHY is closer to the wire therefore theoretically it has less
      delay than the MAC timestamping but the reality is different. Due to lower
      time stamping clock frequency, latency in the MDIO bus and no PHC hardware
      synchronization between different PHY, the PHY PTP is often less precise
      than the MAC. The exception is for PHY designed specially for PTP case but
      these devices are not very widespread. For not breaking the compatibility I
      introduce a default_timestamp flag in phy_device that is set by the phy
      driver to know we are using the old API behavior.
      
      The phy_set_timestamp function is called at each call of phy_attach_direct.
      In case of MAC driver using phylink this function is called when the
      interface is turned up. Then if the interface goes down and up again the
      last choice of timestamp will be overwritten by the default choice.
      A solution could be to cache the timestamp status but it can bring other
      issues. In case of SFP, if we change the module, it doesn't make sense to
      blindly re-set the timestamp back to PHY, if the new module has a PHY with
      mediocre timestamping capabilities.
      Signed-off-by: default avatarKory Maincent <kory.maincent@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0f7f463d
    • Kory Maincent's avatar
      net: phy: micrel: fix ts_info value in case of no phc · 915d25a9
      Kory Maincent authored
      In case of no phc we should not return SOFTWARE TIMESTAMPING flags as we do
      not know whether the netdev supports of timestamping.
      Remove it from the lan8841_ts_info and simply return 0.
      Signed-off-by: default avatarKory Maincent <kory.maincent@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      915d25a9
    • Kory Maincent's avatar
      net: Convert PHYs hwtstamp callback to use kernel_hwtstamp_config · 446e2305
      Kory Maincent authored
      The PHYs hwtstamp callback are still getting the timestamp config from
      ifreq and using copy_from/to_user.
      Get rid of these functions by using timestamp configuration in parameter.
      This also allow to move on to kernel_hwtstamp_config and be similar to
      net devices using the new ndo_hwstamp_get/set.
      
      This adds the possibility to manipulate the timestamp configuration
      from the kernel which was not possible with the copy_from/to_user.
      Signed-off-by: default avatarKory Maincent <kory.maincent@bootlin.com>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      446e2305
  2. 20 Oct, 2023 1 commit
    • Oleksij Rempel's avatar
      net: phy: micrel: Fix forced link mode for KSZ886X switches · 510f02fe
      Oleksij Rempel authored
      Address a link speed detection issue in KSZ886X PHY driver when in
      forced link mode. Previously, link partners like "ASIX AX88772B"
      with KSZ8873 could fall back to 10Mbit instead of configured 100Mbit.
      
      The issue arises as KSZ886X PHY continues sending Fast Link Pulses (FLPs)
      even with autonegotiation off, misleading link partners in autoneg mode,
      leading to incorrect link speed detection.
      
      Now, when autonegotiation is disabled, the driver sets the link state
      forcefully using KSZ886X_CTRL_FORCE_LINK bit. This action, beyond just
      disabling autonegotiation, makes the PHY state more reliably detected by
      link partners using parallel detection, thus fixing the link speed
      misconfiguration.
      
      With autonegotiation enabled, link state is not forced, allowing proper
      autonegotiation process participation.
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarDivya Koppera <divya.koppera@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      510f02fe
  3. 07 Sep, 2023 1 commit
  4. 21 Jun, 2023 1 commit
    • Horatiu Vultur's avatar
      net: micrel: Change to receive timestamp in the frame for lan8841 · cc755495
      Horatiu Vultur authored
      Currently for each timestamp frame, the SW needs to go and read the
      received timestamp over the MDIO bus. But the HW has the capability
      to store the received nanoseconds part and the least significant two
      bits of the seconds in the reserved field of the PTP header. In this
      way we could save few MDIO transactions (actually a little more
      transactions because the access to the PTP registers are indirect)
      for each received frame.
      
      Instead of reading the rest of seconds part of the timestamp of the
      frame using MDIO transactions schedule PTP worker thread to read the
      seconds part every 500ms and then for each of the received frames use
      this information. Because if for example running with 512 frames per
      second, there is no point to read 512 times the second part.
      
      Doing all these changes will give a great CPU usage performance.
      Running ptp4l with logSyncInterval of -9 will give a ~60% CPU
      improvement.
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cc755495
  5. 07 Jun, 2023 1 commit
    • Robert Hancock's avatar
      net: phy: micrel: Move KSZ9477 errata fixes to PHY driver · 26dd2974
      Robert Hancock authored
      The ksz9477 DSA switch driver is currently updating some MMD registers
      on the internal port PHYs to address some chip errata. However, these
      errata are really a property of the PHY itself, not the switch they are
      part of, so this is kind of a layering violation. It makes more sense for
      these writes to be done inside the driver which binds to the PHY and not
      the driver for the containing device.
      
      This also addresses some issues where the ordering of when these writes
      are done may have been incorrect, causing the link to erratically fail to
      come up at the proper speed or at all. Doing this in the PHY driver
      during config_init ensures that they happen before anything else tries to
      change the state of the PHY on the port.
      
      The new code also ensures that autonegotiation is disabled during the
      register writes and re-enabled afterwards, as indicated by the latest
      version of the errata documentation from Microchip.
      Signed-off-by: default avatarRobert Hancock <robert.hancock@calian.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      26dd2974
  6. 22 May, 2023 1 commit
  7. 20 Apr, 2023 1 commit
  8. 17 Apr, 2023 1 commit
    • Horatiu Vultur's avatar
      net: phy: micrel: Fix PTP_PF_PEROUT for lan8841 · c6d6ef3e
      Horatiu Vultur authored
      If the 1PPS output was enabled and then lan8841 was configured to be a
      follower, then target clock which is used to generate the 1PPS was not
      configure correctly. The problem was that for each adjustments of the
      time, also the nanosecond part of the target clock was changed.
      Therefore the initial nanosecond part of the target clock was changed.
      The issue can be observed if both the leader and the follower are
      generating 1PPS and see that their PPS are not aligned even if the time
      is allined.
      The fix consists of not modifying the nanosecond part of the target
      clock when adjusting the time. In this way the 1PPS get also aligned.
      
      Fixes: e4ed8ba0 ("net: phy: micrel: Add support for PTP_PF_PEROUT for lan8841")
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c6d6ef3e
  9. 27 Mar, 2023 1 commit
    • Oleksij Rempel's avatar
      net: phy: micrel: correct KSZ9131RNX EEE capabilities and advertisement · f2e9d083
      Oleksij Rempel authored
      The KSZ9131RNX incorrectly shows EEE capabilities in its registers.
      Although the "EEE control and capability 1" (Register 3.20) is set to 0,
      indicating no EEE support, the "EEE advertisement 1" (Register 7.60) is
      set to 0x6, advertising EEE support for 1000BaseT/Full and
      100BaseT/Full.
      This inconsistency causes PHYlib to assume there is no EEE support,
      preventing control over EEE advertisement, which is enabled by default.
      
      This patch resolves the issue by utilizing the ksz9477_get_features()
      function to correctly set the EEE capabilities for the KSZ9131RNX. This
      adjustment allows proper control over EEE advertisement and ensures
      accurate representation of the device's capabilities.
      
      Fixes: 8b68710a ("net: phy: start using genphy_c45_ethtool_get/set_eee()")
      Reported-by: default avatarMarek Vasut <marex@denx.de>
      Tested-by: default avatarMarek Vasut <marex@denx.de>
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f2e9d083
  10. 24 Mar, 2023 1 commit
  11. 16 Mar, 2023 2 commits
  12. 13 Mar, 2023 1 commit
    • Horatiu Vultur's avatar
      net: phy: micrel: Add support for PTP_PF_PEROUT for lan8841 · e4ed8ba0
      Horatiu Vultur authored
      Lan8841 has 10 GPIOs and it has 2 events(EVENT_A and EVENT_B). It is
      possible to assigned the 2 events to any of the GPIOs, but a GPIO can
      have only 1 event at a time.
      These events are used to generate periodic signals. It is possible to
      configure the length, the start time and the period of the signal by
      configuring the event.
      Currently the SW uses only EVENT_A to generate the perout.
      
      These events are generated by comparing the target time with the PHC
      time. In case the PHC time is changed to a value bigger than the target
      time + reload time, then it would generate only 1 event and then it
      would stop because target time + reload time is small than PHC time.
      Therefore it is required to change also the target time every time when
      the PHC is changed. The same will apply also when the PHC time is
      changed to a smaller value.
      
      This was tested using:
      testptp -L 6,2
      testptp -p 1000000000 -w 200000000
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Link: https://lore.kernel.org/r/20230307214402.793057-1-horatiu.vultur@microchip.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e4ed8ba0
  13. 13 Feb, 2023 2 commits
  14. 10 Feb, 2023 1 commit
  15. 08 Feb, 2023 1 commit
  16. 09 Jan, 2023 2 commits
  17. 07 Jan, 2023 1 commit
    • Horatiu Vultur's avatar
      net: phy: micrel: Change handler interrupt for lan8814 · 7abd92a5
      Horatiu Vultur authored
      The lan8814 represents a package of 4 PHYs. All of them are sharing the
      same interrupt line. So when a link was going down/up or a frame was
      timestamped, then the interrupt handler of all the PHYs was called.
      Which is all fine and expected but the problem is the way the handler
      interrupt works.
      Basically if one of the PHYs timestamp a frame, then all the other 3
      PHYs were polling the status of the interrupt until that PHY actually
      cleared the interrupt by reading the timestamp.
      The reason of polling was in case another PHY was also timestamping a
      frame at the same time, it could miss this interrupt. But this is not
      the right approach, because it is the interrupt controller who needs to
      call the interrupt handlers again if the interrupt line is still
      active.
      Therefore change this such when the interrupt handler is called check
      only if the interrupt is for itself, otherwise just exit. In this way
      save CPU usage.
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Link: https://lore.kernel.org/r/20230104194218.3785229-1-horatiu.vultur@microchip.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7abd92a5
  18. 25 Oct, 2022 1 commit
  19. 13 Oct, 2022 1 commit
  20. 26 Sep, 2022 1 commit
  21. 22 Sep, 2022 2 commits
  22. 20 Sep, 2022 2 commits
  23. 31 Aug, 2022 2 commits
  24. 02 Jul, 2022 1 commit
  25. 16 May, 2022 2 commits
  26. 10 May, 2022 1 commit
  27. 06 May, 2022 2 commits
  28. 29 Apr, 2022 2 commits
  29. 08 Apr, 2022 1 commit
    • Marek Vasut's avatar
      net: phy: micrel: ksz9031/ksz9131: add cabletest support · 58389c00
      Marek Vasut authored
      Add cable test support for Micrel KSZ9x31 PHYs.
      
      Tested on i.MX8M Mini with KSZ9131RNX in 100/Full mode with pairs shuffled
      before magnetics:
      (note: Cable test started/completed messages are omitted)
      
        mx8mm-ksz9131-a-d-connected$ ethtool --cable-test eth0
        Pair A code OK
        Pair B code Short within Pair
        Pair B, fault length: 0.80m
        Pair C code Short within Pair
        Pair C, fault length: 0.80m
        Pair D code OK
      
        mx8mm-ksz9131-a-b-connected$ ethtool --cable-test eth0
        Pair A code OK
        Pair B code OK
        Pair C code Short within Pair
        Pair C, fault length: 0.00m
        Pair D code Short within Pair
        Pair D, fault length: 0.00m
      
      Tested on R8A77951 Salvator-XS with KSZ9031RNX and all four pairs connected:
      (note: Cable test started/completed messages are omitted)
      
        r8a7795-ksz9031-all-connected$ ethtool --cable-test eth0
        Pair A code OK
        Pair B code OK
        Pair C code OK
        Pair D code OK
      
      The CTRL1000 CTL1000_ENABLE_MASTER and CTL1000_AS_MASTER bits are not
      restored by calling phy_init_hw(), they must be manually cached in
      ksz9x31_cable_test_start() and restored at the end of
      ksz9x31_cable_test_get_status().
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Cc: Heiner Kallweit <hkallweit1@gmail.com>
      Cc: Oleksij Rempel <linux@rempel-privat.de>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Tested-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
      Link: https://lore.kernel.org/r/20220407105534.85833-1-marex@denx.deSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      58389c00