1. 25 3月, 2023 4 次提交
  2. 17 3月, 2023 1 次提交
    • M
      net: dsa: microchip: fix RGMII delay configuration on KSZ8765/KSZ8794/KSZ8795 · 5ae06327
      Marek Vasut 提交于
      The blamed commit has replaced a ksz_write8() call to address
      REG_PORT_5_CTRL_6 (0x56) with a ksz_set_xmii() -> ksz_pwrite8() call to
      regs[P_XMII_CTRL_1], which is also defined as 0x56 for ksz8795_regs[].
      
      The trouble is that, when compared to ksz_write8(), ksz_pwrite8() also
      adjusts the register offset with the port base address. So in reality,
      ksz_pwrite8(offset=0x56) accesses register 0x56 + 0x50 = 0xa6, which in
      this switch appears to be unmapped, and the RGMII delay configuration on
      the CPU port does nothing.
      
      So if the switch wasn't fine with the RGMII delay configuration done
      through pin strapping and relied on Linux to apply a different one in
      order to pass traffic, this is now broken.
      
      Using the offset translation logic imposed by ksz_pwrite8(), the correct
      value for regs[P_XMII_CTRL_1] should have been 0x6 on ksz8795_regs[], in
      order to really end up accessing register 0x56.
      
      Static code analysis shows that, despite there being multiple other
      accesses to regs[P_XMII_CTRL_1] in this driver, the only code path that
      is applicable to ksz8795_regs[] and ksz8_dev_ops is ksz_set_xmii().
      Therefore, the problem is isolated to RGMII delays.
      
      In its current form, ksz8795_regs[] contains the same value for
      P_XMII_CTRL_0 and for P_XMII_CTRL_1, and this raises valid suspicions
      that writes made by the driver to regs[P_XMII_CTRL_0] might overwrite
      writes made to regs[P_XMII_CTRL_1] or vice versa.
      
      Again, static analysis shows that the only accesses to P_XMII_CTRL_0
      from the driver are made from code paths which are not reachable with
      ksz8_dev_ops. So the accesses made by ksz_set_xmii() are safe for this
      switch family.
      
      [ vladimiroltean: rewrote commit message ]
      
      Fixes: c476bede ("net: dsa: microchip: ksz8795: use common xmii function")
      Signed-off-by: NMarek Vasut <marex@denx.de>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Acked-by: NArun Ramadoss <arun.ramadoss@microchip.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20230315231916.2998480-1-vladimir.oltean@nxp.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      5ae06327
  3. 13 2月, 2023 1 次提交
  4. 24 1月, 2023 2 次提交
    • A
      net: dsa: microchip: add support for credit based shaper · 71d7920f
      Arun Ramadoss 提交于
      KSZ9477, KSZ9567, KSZ9563, KSZ8563 and LAN937x supports Credit based
      shaper. To differentiate the chip supporting cbs, tc_cbs_supported
      flag is introduced in ksz_chip_data.
      And KSZ series has 16bit Credit increment registers whereas LAN937x has
      24bit register. The value to be programmed in the credit increment is
      determined using the successive multiplication method to convert decimal
      fraction to hexadecimal fraction.
      For example: if idleslope is 10000 and sendslope is -90000, then
      bandwidth is 10000 - (-90000) = 100000.
      The 10% bandwidth of 100Mbps means 10/100 = 0.1(decimal). This value has
      to be converted to hexa.
      1) 0.1 * 16 = 1.6  --> fraction 0.6 Carry = 1 (MSB)
      2) 0.6 * 16 = 9.6  --> fraction 0.6 Carry = 9
      3) 0.6 * 16 = 9.6  --> fraction 0.6 Carry = 9
      4) 0.6 * 16 = 9.6  --> fraction 0.6 Carry = 9
      5) 0.6 * 16 = 9.6  --> fraction 0.6 Carry = 9
      6) 0.6 * 16 = 9.6  --> fraction 0.6 Carry = 9 (LSB)
      Now 0.1(decimal) becomes 0.199999(Hex).
      If it is LAN937x, 24 bit value will be programmed to Credit Inc
      register, 0x199999. For others 16 bit value will be prgrammed, 0x1999.
      Signed-off-by: NArun Ramadoss <arun.ramadoss@microchip.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      71d7920f
    • A
      net: dsa: microchip: enable port queues for tc mqprio · e30f33a5
      Arun Ramadoss 提交于
      LAN937x family of switches has 8 queues per port where the KSZ switches
      has 4 queues per port. By default, only one queue per port is enabled.
      The queues are configurable in 2, 4 or 8. This patch add 8 number of
      queues for LAN937x and 4 for other switches.
      In the tag_ksz.c file, prioirty of the packet is queried using the skb
      buffer and the corresponding value is updated in the tag.
      Signed-off-by: NArun Ramadoss <arun.ramadoss@microchip.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      e30f33a5
  5. 21 1月, 2023 1 次提交
  6. 13 1月, 2023 5 次提交
  7. 20 12月, 2022 1 次提交
  8. 09 12月, 2022 1 次提交
  9. 07 12月, 2022 2 次提交
  10. 09 11月, 2022 2 次提交
  11. 27 9月, 2022 3 次提交
  12. 17 9月, 2022 1 次提交
  13. 07 9月, 2022 3 次提交
  14. 05 9月, 2022 2 次提交
  15. 03 9月, 2022 1 次提交
  16. 31 8月, 2022 6 次提交
  17. 24 8月, 2022 1 次提交
  18. 23 8月, 2022 1 次提交
    • V
      net: dsa: microchip: keep compatibility with device tree blobs with no phy-mode · 5fbb08eb
      Vladimir Oltean 提交于
      DSA has multiple ways of specifying a MAC connection to an internal PHY.
      One requires a DT description like this:
      
      	port@0 {
      		reg = <0>;
      		phy-handle = <&internal_phy>;
      		phy-mode = "internal";
      	};
      
      (which is IMO the recommended approach, as it is the clearest
      description)
      
      but it is also possible to leave the specification as just:
      
      	port@0 {
      		reg = <0>;
      	}
      
      and if the driver implements ds->ops->phy_read and ds->ops->phy_write,
      the DSA framework "knows" it should create a ds->slave_mii_bus, and it
      should connect to a non-OF-based internal PHY on this MDIO bus, at an
      MDIO address equal to the port address.
      
      There is also an intermediary way of describing things:
      
      	port@0 {
      		reg = <0>;
      		phy-handle = <&internal_phy>;
      	};
      
      In case 2, DSA calls phylink_connect_phy() and in case 3, it calls
      phylink_of_phy_connect(). In both cases, phylink_create() has been
      called with a phy_interface_t of PHY_INTERFACE_MODE_NA, and in both
      cases, PHY_INTERFACE_MODE_NA is translated into phy->interface.
      
      It is important to note that phy_device_create() initializes
      dev->interface = PHY_INTERFACE_MODE_GMII, and so, when we use
      phylink_create(PHY_INTERFACE_MODE_NA), no one will override this, and we
      will end up with a PHY_INTERFACE_MODE_GMII interface inherited from the
      PHY.
      
      All this means that in order to maintain compatibility with device tree
      blobs where the phy-mode property is missing, we need to allow the
      "gmii" phy-mode and treat it as "internal".
      
      Fixes: 2c709e0b ("net: dsa: microchip: ksz8795: add phylink support")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=216320Reported-by: NCraig McQueen <craig@mcqueen.id.au>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NAlvin Šipraga <alsi@bang-olufsen.dk>
      Tested-by: NRasmus Villemoes <rasmus.villemoes@prevas.dk>
      Link: https://lore.kernel.org/r/20220818143250.2797111-1-vladimir.oltean@nxp.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      5fbb08eb
  19. 27 7月, 2022 2 次提交