1. 05 Jul, 2024 6 commits
    • Serge Semin's avatar
      net: pcs: xpcs: Introduce DW XPCS info structure · bcac735c
      Serge Semin authored
      The being introduced structure will preserve the PCS and PMA IDs retrieved
      from the respective DW XPCS MMDs or potentially pre-defined by the client
      drivers. (The later change will be introduced later in the framework of
      the commit adding the memory-mapped DW XPCS devices support.)
      
      The structure fields are filled in in the xpcs_get_id() function, which
      used to be responsible for the PCS Device ID getting only. Besides of the
      PCS ID the method now fetches the PMA/PMD IDs too from MMD 1, which used
      to be done in xpcs_dev_flag(). The retrieved PMA ID will be from now
      utilized for the PMA-specific tweaks like it was introduced for the
      Wangxun TxGBE PCS in the commit f629acc6 ("net: pcs: xpcs: support to
      switch mode for Wangxun NICs").
      
      Note 1. The xpcs_get_id() error-handling semantics has been changed. From
      now the error number will be returned from the function. There is no point
      in the next IOs or saving 0xffs and then looping over the actual device
      IDs if device couldn't be reached. -ENODEV will be returned if the very
      first IO operation failed thus indicating that no device could be found.
      
      Note 2. The PCS and PMA IDs macros have been converted to enum'es. The
      enum'es will be populated later in another commit with the virtual IDs
      identifying the DW XPCS devices which have some platform-specifics, but
      have been synthesized with the default PCS/PMA ID.
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bcac735c
    • Serge Semin's avatar
      net: pcs: xpcs: Convert xpcs_compat to dw_xpcs_compat · 410232ab
      Serge Semin authored
      The xpcs_compat structure has been left as the only dw-prefix-less
      structure since the previous commit. Let's unify at least the structures
      naming in the driver by adding the dw_-prefix to it.
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      410232ab
    • Serge Semin's avatar
      net: pcs: xpcs: Convert xpcs_id to dw_xpcs_desc · 71b200b3
      Serge Semin authored
      A structure with the PCS/PMA MMD IDs data is being introduced in one of
      the next commits. In order to prevent the names ambiguity let's convert
      the xpcs_id structure name to dw_xpcs_desc. The later version is more
      suitable since the structure content is indeed the device descriptor
      containing the data and callbacks required for the driver to correctly set
      the device up.
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      71b200b3
    • Serge Semin's avatar
      net: pcs: xpcs: Split up xpcs_create() body to sub-functions · 03b3be07
      Serge Semin authored
      As an initial preparation before adding the fwnode-based DW XPCS device
      support let's split the xpcs_create() function code up to a set of the
      small sub-functions. Thus the xpcs_create() implementation will get to
      look simpler and turn to be more coherent. Further updates will just touch
      the new sub-functions a bit: add platform-specific device info, add the
      reference clock getting and enabling.
      
      The xpcs_create() method will now contain the next static methods calls:
      
      xpcs_create_data() - create the DW XPCS device descriptor, pre-initialize
      it' fields and increase the mdio device refcount-er;
      
      xpcs_init_id() - find XPCS ID instance and save it in the device
      descriptor;
      
      xpcs_init_iface() - find MAC/PCS interface descriptor and perform
      basic initialization specific to it: soft-reset, disable polling.
      
      The update doesn't imply any semantic change but merely makes the code
      looking simpler and more ready for adding new features support.
      
      Note the xpcs_destroy() has been moved to being defined below the
      xpcs_create_mdiodev() function as the driver now implies having the
      protagonist-then-antagonist functions definition order.
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      03b3be07
    • Serge Semin's avatar
      net: pcs: xpcs: Move native device ID macro to linux/pcs/pcs-xpcs.h · f37bee95
      Serge Semin authored
      One of the next commits will alter the DW XPCS driver to support setting a
      custom device ID for the particular MDIO-device detected on the platform.
      The generic DW XPCS ID can be used as a custom ID as well in case if the
      DW XPCS-device was erroneously synthesized with no or some undefined ID.
      In addition to that having all supported DW XPCS device IDs defined in a
      single place will improve the code maintainability and readability.
      
      Note while at it rename the macros to being shorter and looking alike to
      the already defined NXP XPCS ID macro.
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f37bee95
    • Rob Herring (Arm)'s avatar
      dt-bindings: net: Define properties at top-level · 390b14b5
      Rob Herring (Arm) authored
      Convention is DT schemas should define all properties at the top-level
      and not inside of if/then schemas. That minimizes the if/then schemas
      and is more future proof.
      Signed-off-by: default avatarRob Herring (Arm) <robh@kernel.org>
      Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Reviewed-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Link: https://patch.msgid.link/20240703195827.1670594-2-robh@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      390b14b5
  2. 04 Jul, 2024 34 commits