1. 12 Jun, 2021 27 commits
  2. 11 Jun, 2021 13 commits
    • David S. Miller's avatar
      Merge branch 'ipa-sysfs' · 1f1aa3fe
      David S. Miller authored
      Alex Elder says:
      
      ====================
      net: ipa: introduce ipa_syfs.c
      
      This series (its last patch, actually) creates a new source file,
      "ipa_syfs.c", to contain functions and data that expose to user
      space information known by the IPA driver via device attributes.
      
      The directory containing these files on supported systems is:
          /sys/devices/platform/soc@0/1e40000.ipa
      
      And within that direcftory, the following files and directories
      are added:
          .
          |-- feature
          |   |-- rx_offload          Type of checksum offload supported
          |   `-- tx_offload
          |   . . .
          |-- modem
          |   |-- rx_endpoint_id      IPA endpoint IDs for the embedded modem
          |   `-- tx_endpoint_id
          |   . . .
          |-- version                 IPA hardware version (informational)
              . . .
      
      The first patch just makes endpoint validation unconditional, as
      suggested by Leon Romanovsky.  The second just ensures the version
      defined in configuration data is valid, so the version attribute
      doesn't have to handle unrecognized version numbers.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1f1aa3fe
    • Alex Elder's avatar
      net: ipa: introduce sysfs code · 2e3cf97f
      Alex Elder authored
      Add IPA device attributes to expose information known by the IPA
      driver about the hardware and its configuration.
      
      All pointers used to display these attribute values (i.e., IPA
      pointer and endpoint pointers) will have been initialized by the
      time IPA probe has completed, so they may be safely dereferenced.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2e3cf97f
    • Alex Elder's avatar
      net: ipa: introduce ipa_version_valid() · e22e8e2f
      Alex Elder authored
      Define and use a new function that just validates the version
      defined in configuration data.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e22e8e2f
    • Alex Elder's avatar
      net: ipa: make endpoint data validation unconditional · 9e8fb7bf
      Alex Elder authored
      The cost of validating the endpoint configuration data is not all
      that high, so just do it unconditionally, rather than doing so only
      when IPA_VALIDATAION is defined.
      Suggested-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9e8fb7bf
    • Lijun Pan's avatar
      ibmvnic: fix kernel build warning in strncpy · 0b217d3d
      Lijun Pan authored
      drivers/net/ethernet/ibm/ibmvnic.c: In function ‘handle_vpd_rsp’:
      drivers/net/ethernet/ibm/ibmvnic.c:4393:3: warning: ‘strncpy’ output truncated before terminating nul copying 3 bytes from a string of the same length [-Wstringop-truncation]
       4393 |   strncpy((char *)adapter->fw_version, "N/A", 3 * sizeof(char));
            |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Signed-off-by: default avatarLijun Pan <lijunp213@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0b217d3d
    • David S. Miller's avatar
      Merge branch 'sja1105-xpcs' · 2227ec7b
      David S. Miller authored
      Vladimir Oltean says:
      
      ====================
      Port the SJA1105 DSA driver to XPCS
      
      As requested when adding support for the NXP SJA1110, the SJA1105 driver
      could make use of the common XPCS driver, to eliminate some hardware
      specific code duplication.
      
      This series modifies the XPCS driver so that it can accommodate the XPCS
      instantiation from NXP switches, and the SJA1105 driver so it can expose
      what the XPCS driver expects.
      
      Tested on NXP SJA1105S and SJA1110A.
      
      Changes in v3:
      None. This is a resend of v2 which had "changes requested" even though
      there was no direct feedback.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2227ec7b
    • Vladimir Oltean's avatar
      net: dsa: sja1105: plug in support for 2500base-x · 56b63466
      Vladimir Oltean authored
      The MAC treats 2500base-x same as SGMII (yay for that) except that it
      must be set to a different speed.
      
      Extend all places that check for SGMII to also check for 2500base-x.
      
      Also add the missing 2500base-x compatibility matrix entry for SJA1110D.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      56b63466
    • Vladimir Oltean's avatar
      net: dsa: sja1105: SGMII and 2500base-x on the SJA1110 are 'special' · ece578bc
      Vladimir Oltean authored
      For the xMII Mode Parameters Table to be properly configured for SGMII
      mode on SJA1110, we need to set the "special" bit, since SGMII is
      officially bitwise coded as 0b0011 in SJA1105 (decimal 3, equal to
      XMII_MODE_SGMII), and as 0b1011 in SJA1110 (decimal 11).
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ece578bc
    • Vladimir Oltean's avatar
      net: dsa: sja1105: register the PCS MDIO bus for SJA1110 · 27871359
      Vladimir Oltean authored
      On the SJA1110, the PCS of each SERDES-capable port is accessed through
      a different memory window which is 0x100 bytes in size, denoted by
      "pcs_base".
      
      In each PCS register access window, the XPCS MMDs are accessed in an
      indirect way: in pages/banks of up to 0x100 addresses each. Changing the
      page/bank is done by writing to a special register at the end of the
      access window.
      
      The MDIO register map accessed indirectly through the indirect banked
      method described above is similar to what SJA1105 has: upper 5 bits are
      the MMD, lower 16 bits are the MDIO address within that MMD.
      
      Since the PHY ID reported by the XPCS inside SJA1110 is also all zeroes
      (like SJA1105), we need to trap those reads and return a fake PHY ID so
      that the xpcs driver can apply some specific fixups for our integration.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      27871359
    • Vladimir Oltean's avatar
      net: dsa: sja1105: migrate to xpcs for SGMII · 3ad1d171
      Vladimir Oltean authored
      There is a desire to use the generic driver for the Synopsys XPCS
      located in drivers/net/pcs, and to achieve that, the sja1105 driver must
      expose an MDIO bus for the SGMII PCS, because the XPCS probes as an
      mdio_device.
      
      In preparation of the SJA1110 which in fact has a different access
      procedure for the SJA1105, we register this PCS MDIO bus once in the
      common code, but we implement function pointers for the read and write
      methods. In this patch there is a single implementation for them.
      
      There is exactly one MDIO bus for the PCS, this will contain all PCSes
      at MDIO addresses equal to the port number.
      
      We delete a bunch of hardware support code because the xpcs driver
      already does what we need.
      
      We need to hack up the MDIO reads for the PHY ID, since our XPCS
      instantiation returns zeroes and there are some specific fixups which
      need to be applied by the xpcs driver.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3ad1d171
    • Vladimir Oltean's avatar
      net: pcs: xpcs: export xpcs_do_config and xpcs_link_up · a853c68e
      Vladimir Oltean authored
      The sja1105 hardware has a quirk in that some changes require a switch
      reset, which loses all configuration. When the reset is initiated,
      everything needs to be reprogrammed, including the MACs and the PCS.
      This is currently done in sja1105_static_config_reload() - we manually
      call sja1105_adjust_port_config(), sja1105_sgmii_pcs_config() and
      sja1105_sgmii_pcs_force_speed() which are all internal functions.
      
      There is a desire for sja1105 to use the common xpcs driver, and that
      means that the equivalents of those functions, xpcs_do_config() and
      xpcs_link_up() respectively, will no longer be local functions.
      
      Forcing phylink to retrigger a resolve somehow, say by doing dev_close()
      followed by dev_open() is not really an option, because the CPU port
      might have a PCS as well, and there is no net device which we can close
      and reopen for that. Additionally, the dev_close/dev_open sequence might
      force a renegotiation of the copper-side link for SGMII ports connected
      to a PHY, and this is undesirable as well, because the switch reset is
      much quicker than a PHY autoneg, so we would have a lot more downtime.
      
      The only solution I see is for the sja1105 driver to keep doing what
      it's doing, and that means we need to export the equivalents from xpcs
      for sja1105_sgmii_pcs_config and sja1105_sgmii_pcs_force_speed, and call
      them directly in sja1105_static_config_reload(). This will be done
      during the conversion patch.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a853c68e
    • Vladimir Oltean's avatar
      net: pcs: xpcs: add support for NXP SJA1110 · f7380bba
      Vladimir Oltean authored
      The NXP SJA1110 switch integrates its own, non-Synopsys PMA, but it
      manages it through the register space of the XPCS itself, in a small
      register window inside MDIO_MMD_VEND2 from address 0x8030 to 0x806e.
      
      This coincides with where the registers for the default Synopsys PMA
      are, but the register definitions are of course not the same.
      
      This situation is an odd hardware quirk, but the simplest way to manage
      it is to drive the SJA1110's PMA from within the XPCS driver.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f7380bba
    • Vladimir Oltean's avatar
      net: pcs: xpcs: add support for NXP SJA1105 · dd0721ea
      Vladimir Oltean authored
      The NXP SJA1105 DSA switch integrates a Synopsys SGMII XPCS on port 4.
      The generic code works fine, except there is an integration issue which
      needs to be dealt with: in this switch, the XPCS is integrated with a
      PMA that has the TX lane polarity inverted by default (PLUS is MINUS,
      MINUS is PLUS).
      
      To obtain normal non-inverted behavior, the TX lane polarity must be
      inverted in the PCS, via the DIGITAL_CONTROL_2 register.
      
      We introduce a pma_config() method in xpcs_compat which is called by the
      phylink_pcs_config() implementation.
      
      Also, the NXP SJA1105 returns all zeroes in the PHY ID registers 2 and 3.
      We need to hack up an ad-hoc PHY ID (OUI is zero, device ID is 1) in
      order for the XPCS driver to recognize it. This PHY ID is added to the
      public include/linux/pcs/pcs-xpcs.h for that reason (for the sja1105
      driver to be able to use it in a later patch).
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dd0721ea