1. 06 Feb, 2024 18 commits
    • Paolo Abeni's avatar
      Merge branch 'net-ravb-prepare-for-suspend-to-ram-and-runtime-pm-support-part-1' · ead21932
      Paolo Abeni authored
      Claudiu Beznea says:
      
      ====================
      net: ravb: Prepare for suspend to RAM and runtime PM support (part 1)
      
      This series prepares ravb driver for runtime PM support and adjust the
      already existing suspend to RAM code to work for RZ/G3S (R9A08G045) SoC.
      
      As there are IP versions that switch to module standby when disabling
      the clocks, and because of module standby IP switches to reset and
      the register content is lost, to be able to have runtime PM supported
      for all IP variants, the configuration operations were moved all to
      ravb_open()/ravb_close() letting the ravb_probe() and ravb_remove()
      to deal with resource parsing and allocation/free.
      
      The ethtool and IOCTL APIs that could have been run asyncronously
      were adapted to return if the interface is down. As explained in
      each individual commits description, this should be harmless.
      
      Along with it, the series contains preparatory cleanups.
      
      The series has been tested on the boards with the following device trees:
      - r8a7742-iwg21d-q7.dts
      - r8a774a1-hihope-rzg2m-ex.dts
      - r9a07g043u11-smarc-rzg2ul.dts
      - r9a07g054l2-smarc-rzv2l.dts
      - r9a07g044l2-smarc-rzg2l.dts
      
      Changes in v6:
      - fixed typo in patch 08/15
      - re-arranged the tags as my b4 am/shazam placed the Rb tags
        before author's Sob tag
      
      Changes in v5:
      - collected tags
      - fixed typos in patches description
      - improved description for patch 07/15
      - collected tags
      
      Changes in v4:
      - changed cover letter title and keep on 15 patches in series to cope
        with requirement at [1]
      - add dependency on RESET_CONTROLLER in patch "net: ravb: Make reset
        controller support mandatory"
      - use pm_runtime_active() in patch "net: ravb: Move the IRQs get and
        request in the probe function"
      - set config more before reading the mac address in patch "net: ravb: Set
        config mode in ndo_open and reset mode in ndo_close"
      - collected tags
      
      [1] https://www.kernel.org/doc/html/v6.6/process/maintainer-netdev.html#tl-dr
      
      Changes in v3:
      - collected tags
      - addressed review comments
      - squashed patch 17/21 ("net: ravb: Keep clock request operations grouped
        together") from v2 in patch 07/19 ("net: ravb: Move reference clock
        enable/disable on runtime PM APIs") from v3
      - check for ndev->flags & IFF_UP in patch 17/19 and 18/19 instead of
        checking netif_running()
      - dropped patch 19/21 ("net: ravb: Do not set promiscuous mode if the
        interface is down") as the changes there are not necessary as
        ndev->flags & IFF_UP is already checked at the beginning of
        __dev_set_rx_mode()
      - remove code from ravb_open() introduced by patch 20/21
        ("net: ravb: Do not apply RX CSUM settings to hardware if the interface
        is down") from v2 as this is not necessary; driver already takes
        care of this in ravb_emac_init_rcar()
      
      Changes in v2:
      - rework the driver (mainly, ravb_open() contains now only resource
        allocation and parsing leaving the settings to ravb_open(); ravb_remove()
        has been adapted accordingly) to be able to use runtime PM for all
        IP variants; due to this number of patches increased
      - adjust previous series to review comments
      - collected tags
      - populated driver's own runtime PM ops with enable/disable of reference
        clock
      ====================
      
      Link: https://lore.kernel.org/r/20240202084136.3426492-1-claudiu.beznea.uj@bp.renesas.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      ead21932
    • Claudiu Beznea's avatar
      net: ravb: Simplify ravb_resume() · e95273fe
      Claudiu Beznea authored
      Remove explicit calls to functions that are called by ravb_open(). There is
      no need to have them doubled now that the ravb_open() already contains
      what is needed for the interface configuration. Along with it,
      configurations needed by PTP were moved to ravb_wol_restore(). With this,
      code in ravb_resume() becomes simpler.
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      e95273fe
    • Claudiu Beznea's avatar
      net: ravb: Simplify ravb_suspend() · b07bc55c
      Claudiu Beznea authored
      As ravb_close() contains now the call to ravb_ptp_stop() for both ccc_gac
      and gPTP aware platforms, there is no need to keep the separate call in
      ravb_suspend(). Instead, move it to ravb_wol_setup(). In this way the
      resulting code is cleaner.
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      b07bc55c
    • Claudiu Beznea's avatar
      net: ravb: Set config mode in ndo_open and reset mode in ndo_close · 76fd52c1
      Claudiu Beznea authored
      As some IP variants switch to reset mode (and thus the register contents is
      lost) when setting clocks (due to module standby functionality) to be able
      to implement runtime PM and save more power, set the IP's operating mode to
      reset at the end of the probe. Along with it, in the ndo_open API the IP
      will be switched to configuration, then operation mode. In the ndo_close
      API, the IP will be switched back to reset mode. This allows implementing
      runtime PM and, along with it, save more power when the IP is not used.
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      76fd52c1
    • Claudiu Beznea's avatar
      net: ravb: Move PTP initialization in the driver's ndo_open API for ccc_gac platorms · a6a85ba3
      Claudiu Beznea authored
      The initialization sequence for PTP is the same for platforms with ccc_gac
      and gptp (according to "Figure 50.71 Flow of gPTP Initialization (Normal,
      Common to All Modes)" of the R-Car Series, 3rd generation hardware
      manual and "Figure 37A.53 Flow of gPTP Initialization (Normal, Common to
      All Modes)" of the RZ/G Series hardware manual).
      
      As some IP variants switch to reset mode (and thus the registers content is
      lost) when setting clocks (due to module standby functionality) to be able
      to implement runtime PM, move the PTP initialization to the driver's
      ndo_open API.
      
      This commit prepares the code for the addition of runtime PM.
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      a6a85ba3
    • Claudiu Beznea's avatar
      net: ravb: Move DBAT configuration to the driver's ndo_open API · cd1fb46e
      Claudiu Beznea authored
      DBAT setup was done in the driver's probe API. As some IP variants switch
      to reset mode (and thus registers content is lost) when setting clocks
      (due to module standby functionality) to be able to implement runtime PM
      move the DBAT configuration in the driver's ndo_open API.
      
      This commit prepares the code for the addition of runtime PM.
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      cd1fb46e
    • Claudiu Beznea's avatar
      net: ravb: Move delay mode set in the driver's ndo_open API · 23698a9a
      Claudiu Beznea authored
      Delay parsing and setting were done in the driver's probe API. As some IP
      variants switch to reset mode (and thus the register contents is lost) when
      setting clocks (due to module standby functionality) to be able to
      implement runtime PM keep the delay parsing in the driver's probe function
      and move the delay applying function to the driver's ndo_open API.
      
      Along with it, ravb_parse_delay_mode() function was moved close to
      ravb_set_delay_mode() function to have the delay specific code in the
      same place.
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      23698a9a
    • Claudiu Beznea's avatar
      net: ravb: Split GTI computation and set operations · f384ab48
      Claudiu Beznea authored
      ravb_set_gti() was computing the value of GTI based on the reference clock
      rate and then applied it to register. This was done on the driver's probe
      function. In order to implement runtime PM for all IP variants (as some IP
      variants switches to reset mode (and thus the registers content is lost)
      when module standby is configured through clock APIs) the GTI setup was
      split in 2 parts: one computing the value of the GTI register (done in the
      driver's probe function) and one applying the computed value to register
      (done in the driver's ndo_open API).
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      f384ab48
    • Claudiu Beznea's avatar
      net: ravb: Move getting/requesting IRQs in the probe() method · 32f012b8
      Claudiu Beznea authored
      The runtime PM implementation will disable clocks at the end of
      ravb_probe(). As some IP variants switch to reset mode as a result of
      setting module standby through clock disable APIs, to implement runtime PM
      the resource parsing and requesting are moved in the probe function and IP
      settings are moved in the open function. This is done because at the end of
      the probe some IP variants will switch anyway to reset mode and the
      registers content is lost. Also keeping only register settings operations
      in the ravb_open()/ravb_close() functions will make them faster.
      
      Commit moves IRQ requests to ravb_probe() to have all the IRQs ready when
      the interface is open. As now getting/requesting IRQs is done in a single
      place there is no need to keep intermediary data (like ravb_rx_irqs[] and
      ravb_tx_irqs[] arrays or IRQs in struct ravb_private).
      
      In order to avoid accessing the IP registers while the IP is runtime
      suspended (e.g. in the timeframe b/w the probe requests shared IRQs and
      IP clocks are enabled) in the interrupt handlers were introduced
      pm_runtime_active() checks. The device runtime PM usage counter has been
      incremented to avoid disabling the device's clocks while the check is in
      progress (if any).
      
      This is a preparatory change to add runtime PM support for all IP variants.
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      32f012b8
    • Claudiu Beznea's avatar
      net: ravb: Move reference clock enable/disable on runtime PM APIs · a654f6e8
      Claudiu Beznea authored
      Reference clock could be or not be part of the power domain. If it is part
      of the power domain, the power domain takes care of properly setting it. In
      case it is not part of the power domain and full runtime PM support is
      available in driver the clock will not be propertly disabled/enabled at
      runtime. For this, keep the prepare/unprepare operations in the driver's
      probe()/remove() functions and move the enable/disable in runtime PM
      functions.
      
      By doing this, the previous ravb_runtime_nop() function was renamed
      ravb_runtime_suspend() and the comment was removed. A proper runtime PM
      resume function was added (ravb_runtime_resume()). The current driver
      still don't need to make any register settings on runtime suspend/resume
      (as expressed in the removed comment) because, currently,
      pm_runtime_put_sync() is called on the driver remove function. This will be
      changed in the next commits (that extends the runtime PM support) such
      that proper register settings (along with runtime resume/suspend) will be
      done on ravb_open()/ravb_close().
      
      Along with it, the other clock request operations were moved close to
      reference clock request and prepare to have all the clock requests
      specific code grouped together.
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      a654f6e8
    • Claudiu Beznea's avatar
      net: ravb: Assert/de-assert reset on suspend/resume · c5c0714e
      Claudiu Beznea authored
      RZ/G3S can go to deep sleep states where power to most of the SoC parts is
      off. When resuming from such a state, the Ethernet controller needs to be
      reinitialized. De-asserting the reset signal for it should also be done.
      Thus, add reset assert/de-assert on suspend/resume functions.
      
      On the resume function, the de-assert was not reverted in case of failures
      to give the user a chance to restore the interface (e.g., bringing down/up
      the interface) in case suspend/resume failed.
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      c5c0714e
    • Claudiu Beznea's avatar
      net: ravb: Use tabs instead of spaces · 7493bb4c
      Claudiu Beznea authored
      Use tabs instead of spaces in the ravb_set_rate_gbeth() function.
      This aligns with the coding style requirements.
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      7493bb4c
    • Claudiu Beznea's avatar
      net: ravb: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr() · 6ccc22a5
      Claudiu Beznea authored
      SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() are deprecated now
      and require __maybe_unused protection against unused function warnings.
      The usage of pm_ptr() and SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() allows
      the compiler to see the functions, thus suppressing the warning. Thus
      drop the __maybe_unused markings.
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      6ccc22a5
    • Claudiu Beznea's avatar
      net: ravb: Make reset controller support mandatory · b1768e3d
      Claudiu Beznea authored
      On the RZ/G3S SoC the reset controller is mandatory for the IP to work.
      The device tree binding documentation for the ravb driver specifies that
      the resets are mandatory. Based on this, make the resets mandatory also in
      driver for all ravb devices.
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      b1768e3d
    • Claudiu Beznea's avatar
      net: ravb: Rely on PM domain to enable gptp_clk · e1da043f
      Claudiu Beznea authored
      ravb_rzv2m_hw_info::gptp_ref_clk is enabled only for RZ/V2M. RZ/V2M
      is an ARM64-based device which selects power domains by default and
      CONFIG_PM. The RZ/V2M Ethernet DT node has proper power-domain binding
      available in device tree from the commit that added the Ethernet node.
      (4872ca1f ("arm64: dts: renesas: r9a09g011: Add ethernet nodes")).
      
      Power domain support was available in the rzg2l-cpg.c driver when the
      Ethernet DT node has been enabled in RZ/V2M device tree.
      (ef3c613c ("clk: renesas: Add CPG core wrapper for RZ/G2L SoC")).
      
      Thus, remove the explicit clock enable for gptp_clk (and treat it as the
      other clocks are treated) as it is not needed and removing it doesn't
      break the ABI according to the above explanations.
      
      By removing the enable/disable operation from the driver we can add
      runtime PM support (which operates on clocks) w/o the need to handle
      the gptp_clk in the Ethernet driver functions like ravb_runtime_nop().
      PM domain does all that is needed.
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      e1da043f
    • Claudiu Beznea's avatar
      net: ravb: Let IP-specific receive function to interrogate descriptors · 2b993bfd
      Claudiu Beznea authored
      ravb_poll() initial code used to interrogate the first descriptor of the
      RX queue in case gPTP is false to determine if ravb_rx() should be called.
      This is done for non-gPTP IPs. For gPTP IPs the driver PTP-specific
      information was used to determine if receive function should be called. As
      every IP has its own receive function that interrogates the RX descriptors
      list in the same way the ravb_poll() was doing there is no need to double
      check this in ravb_poll(). Removing the code from ravb_poll() leads to a
      cleaner code.
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      2b993bfd
    • Bo Liu's avatar
      net: encx24j600: convert to use maple tree register cache · 3c974cdc
      Bo Liu authored
      The maple tree register cache is based on a much more modern data structure
      than the rbtree cache and makes optimisation choices which are probably
      more appropriate for modern systems than those made by the rbtree cache.
      Signed-off-by: default avatarBo Liu <liubo03@inspur.com>
      Link: https://lore.kernel.org/r/20240202064336.39138-1-liubo03@inspur.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      3c974cdc
    • Willem de Bruijn's avatar
      selftests/net: ignore timing errors in so_txtime if KSFT_MACHINE_SLOW · c41dfb0d
      Willem de Bruijn authored
      This test is time sensitive. It may fail on virtual machines and for
      debug builds.
      
      Continue to run in these environments to get code coverage. But
      optionally suppress failure for timing errors (only). This is
      controlled with environment variable KSFT_MACHINE_SLOW.
      
      The test continues to return 0 (KSFT_PASS), rather than KSFT_XFAIL
      as previously discussed. Because making so_txtime.c return that and
      then making so_txtime.sh capture runs that pass that vs KSFT_FAIL
      and pass it on added a bunch of (fragile bash) boilerplate, while the
      result is interpreted the same as KSFT_PASS anyway.
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Link: https://lore.kernel.org/r/20240201162130.2278240-1-willemdebruijn.kernel@gmail.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      c41dfb0d
  2. 05 Feb, 2024 15 commits
  3. 04 Feb, 2024 6 commits
  4. 03 Feb, 2024 1 commit
    • David S. Miller's avatar
      Merge branch 'qca-phy-led-fixes' · d6aa8e0a
      David S. Miller authored
      Christian Marangi says:
      
      ====================
      net: phy: qcom: qca808x: fixup qca808x LED
      
      This is a bit embarassing and totally my fault so sorry for that!
      
      While reworking the patch to phy_modify API, it was done a logic
      error and made the brightness_set function broken. It wasn't
      notice in last revisions test as the testing method was to verify
      if hw control was correctly working.
      
      Noticing this problem also made me notice an additional problem
      with the polarity.
      
      The introduced patch made the polarity configurable but I forgot
      to add the required code to enable Active High by default.
      (the PHY sets active low by default)
      
      This wasn't notice with hw control testing as the LED blink on
      traffic and polarity problem are not notice.
      
      It might be worth discussing if needed a change in implementation
      where the polarity function is always called but I think it's
      better this way where specific PHY apply fixup with the help
      of priv struct and on the config_init phase.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d6aa8e0a