1. 12 Feb, 2024 15 commits
  2. 10 Feb, 2024 11 commits
    • David S. Miller's avatar
      Merge branch 'phy-package' · 970cb1ce
      David S. Miller authored
      Christian Marangi says:
      
      ====================
      net: phy: Introduce PHY Package concept
      
      Idea of this big series is to introduce the concept of PHY package in DT
      and give PHY drivers a way to derive the base address from DT.
      
      The concept of PHY package is nothing new and is already a thing in the
      kernel with the API phy_package_join/leave/read/write.
      
      What is currently lacking is describing this in DT and better reference
      a base address to calculate offset from.
      
      In the scenario of a PHY package where multiple address are used and
      there isn't a way to get the base address of the PHY package from some
      regs, getting the information from DT is the only way.
      
      A possible example to this problem is this:
      
              ethernet-phy-package@0 {
                  compatible = "qcom,qca8075-package";
                  #address-cells = <1>;
                  #size-cells = <0>;
      
                  reg = <0>;
                  qcom,package-mode = "qsgmii";
      
                  ethernet-phy@1 {
                    reg = <1>;
                  };
      
                  phy4: ethernet-phy@4 {
                    reg = <4>;
                  };
              };
      
      The mdio parse functions are changed to address for this additional
      special node, the function is changed to simply detect this node and
      search also in this. (we match the node name to be "ethernet-phy-package")
      
      PHY driver can then use introduced helper of_phy_package_join to join the
      PHY to the PHY package and derive the base address from DT.
      
      Changes v7:
      - Rebase on top of net-next
      - Add Reviewed-by tag for DT patch
      - Change tx-driver-strength to tx-drive-strength
      - Drop driver reference in DT
      Changes v6:
      - Back to absolute PHY implementation
      - Correctly drop refcount for node on error condition and on PHY leave
      - Drop DT include patch in favor for 3 boolean vendor property
      - Fix Documentation problem for compatible and missing type and
        description
      - Drop redundand gpio-controller dependency and description
      - Skip scanphy with invalid PHY Package node and make reg mandatory
      - Rework fiber read status to use more generic function
      - Split qca808x LED generalization patch to permit easier review
      - Correctly return -EINVAL with wrong data passed to vendor property
      - Drop removing LED ops for qca807x PHY driver with gpio-controller
      Changes v5:
      - Rebase on top of net-next
      - Change implementation to base addr + offset in subnode
      - Adapt to all the changes and cleanup done to at803x
      Changes v4:
      - Rework DT implementation
      - Drop of autojoin support and rework to simple helper
      - Rework PHY driver to the new implementation
      - Add compatible for qca807x package
      - Further cleanup patches
      Changes v3:
      - Add back compatible implementation
      - Detach patch that can be handled separately (phy_package_mmd,
        phy_package extended)
      - Rework code to new simplified implementation with base addr + offset
      - Improve documentation with additional info and description
      Changes v2:
      - Drop compatible "ethernet-phy-package", use node name prefix matching
        instead
      - Improve DT example
      - Add reg for ethernet-phy-package
      - Drop phy-mode for ethernet-phy-package
      - Drop patch for generalization of phy-mode
      - Drop global-phy property (handle internally to the PHY driver)
      - Rework OF phy package code and PHY driver to handle base address
      - Fix missing of_node_put
      - Add some missing docs for added variables in struct
      - Move some define from dt-bindings include to PHY driver
      - Handle qsgmii validation in PHY driver
      - Fix wrong include for gpiolib
      - Drop reduntant version.h include
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      970cb1ce
    • Christian Marangi's avatar
      net: phy: qca807x: add support for configurable LED · f508a226
      Christian Marangi authored
      QCA8072/5 have up to 2 LEDs attached for PHY.
      
      LEDs can be configured to be ON/hw blink or be set to HW control.
      
      Hw blink mode is set to blink at 4Hz or 250ms.
      
      PHY can support both copper (TP) or fiber (FIBRE) kind and supports
      different HW control modes based on the port type.
      
      HW control modes supported for netdev trigger for copper ports are:
      - LINK_10
      - LINK_100
      - LINK_1000
      - TX
      - RX
      - FULL_DUPLEX
      - HALF_DUPLEX
      
      HW control modes supported for netdev trigger for fiber ports are:
      - LINK_100
      - LINK_1000
      - TX
      - RX
      - FULL_DUPLEX
      - HALF_DUPLEX
      
      LED support conflicts with GPIO controller feature and must be disabled
      if gpio-controller is used for the PHY.
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f508a226
    • Christian Marangi's avatar
      net: phy: qcom: generalize some qca808x LED functions · 47b930d0
      Christian Marangi authored
      Generalize some qca808x LED functions in preparation for qca807x LED
      support.
      
      The LED implementation of qca808x and qca807x is the same but qca807x
      supports also Fiber port and have different hw control bits for Fiber
      port. To limit code duplication introduce micro functions that takes reg
      instead of LED index to tweak all the supported LED modes.
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      47b930d0
    • Christian Marangi's avatar
      net: phy: qcom: move common qca808x LED define to shared header · ee9d9807
      Christian Marangi authored
      The LED implementation of qca808x and qca807x is the same but qca807x
      supports also Fiber port and have different hw control bits for Fiber
      port.
      
      In preparation for qca807x introduction, move all the common define to
      shared header.
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ee9d9807
    • Robert Marko's avatar
      net: phy: qcom: add support for QCA807x PHY Family · d1cb613e
      Robert Marko authored
      This adds driver for the Qualcomm QCA8072 and QCA8075 PHY-s.
      
      They are 2 or 5 port IEEE 802.3 clause 22 compliant 10BASE-Te,
      100BASE-TX and 1000BASE-T PHY-s.
      
      They feature 2 SerDes, one for PSGMII or QSGMII connection with
      MAC, while second one is SGMII for connection to MAC or fiber.
      
      Both models have a combo port that supports 1000BASE-X and
      100BASE-FX fiber.
      
      PHY package can be configured in 3 mode following this table:
      
                    First Serdes mode       Second Serdes mode
      Option 1      PSGMII for copper       Disabled
                    ports 0-4
      Option 2      PSGMII for copper       1000BASE-X / 100BASE-FX
                    ports 0-4
      Option 3      QSGMII for copper       SGMII for
                    ports 0-3               copper port 4
      
      Each PHY inside of QCA807x series has 4 digitally controlled
      output only pins that natively drive LED-s.
      But some vendors used these to driver generic LED-s controlled
      by userspace, so lets enable registering each PHY as GPIO
      controller and add driver for it.
      
      These are commonly used in Qualcomm IPQ40xx, IPQ60xx and IPQ807x
      boards.
      Co-developed-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Signed-off-by: default avatarRobert Marko <robert.marko@sartura.hr>
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d1cb613e
    • Christian Marangi's avatar
      net: phy: provide whether link has changed in c37_read_status · 9b1d5e05
      Christian Marangi authored
      Some PHY driver might require additional regs call after
      genphy_c37_read_status() is called.
      
      Expand genphy_c37_read_status to provide a bool wheather the link has
      changed or not to permit PHY driver to skip additional regs call if
      nothing has changed.
      
      Every user of genphy_c37_read_status() is updated with the new
      additional bool.
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9b1d5e05
    • Christian Marangi's avatar
      dt-bindings: net: Document Qcom QCA807x PHY package · dd87eaa1
      Christian Marangi authored
      Document Qcom QCA807x PHY package.
      
      Qualcomm QCA807X Ethernet PHY is PHY package of 2 or 5
      IEEE 802.3 clause 22 compliant 10BASE-Te, 100BASE-TX and
      1000BASE-T PHY-s.
      
      Document the required property to make the PHY package correctly
      configure and work.
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Reviewed-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dd87eaa1
    • Christian Marangi's avatar
      net: phy: qcom: move more function to shared library · 737eb75a
      Christian Marangi authored
      Move more function to shared library in preparation for introduction of
      new PHY Family qca807x that will make use of both functions from at803x
      and qca808x as it's a transition PHY with some implementation of at803x
      and some from the new qca808x.
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      737eb75a
    • Christian Marangi's avatar
      net: phy: add devm/of_phy_package_join helper · 471e8fd3
      Christian Marangi authored
      Add devm/of_phy_package_join helper to join PHYs in a PHY package. These
      are variant of the manual phy_package_join with the difference that
      these will use DT nodes to derive the base_addr instead of manually
      passing an hardcoded value.
      
      An additional value is added in phy_package_shared, "np" to reference
      the PHY package node pointer in specific PHY driver probe_once and
      config_init_once functions to make use of additional specific properties
      defined in the PHY package node in DT.
      
      The np value is filled only with of_phy_package_join if a valid PHY
      package node is found. A valid PHY package node must have the node name
      set to "ethernet-phy-package".
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      471e8fd3
    • Christian Marangi's avatar
      net: phy: add support for scanning PHY in PHY packages nodes · 385ef48f
      Christian Marangi authored
      Add support for scanning PHY in PHY package nodes. PHY packages nodes
      are just container for actual PHY on the MDIO bus.
      
      Their PHY address defined in the PHY package node are absolute and
      reflect the address on the MDIO bus.
      
      mdio_bus.c and of_mdio.c is updated to now support and parse also
      PHY package subnode by checking if the node name match
      "ethernet-phy-package".
      
      As PHY package reg is mandatory and each PHY in the PHY package must
      have a reg, every invalid PHY Package node is ignored and will be
      skipped by the autoscan fallback.
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      385ef48f
    • Christian Marangi's avatar
      dt-bindings: net: document ethernet PHY package nodes · 8453c88c
      Christian Marangi authored
      Document ethernet PHY package nodes used to describe PHY shipped in
      bundle of 2-5 PHY. The special node describe a container of PHY that
      share common properties. This is a generic schema and PHY package
      should create specialized version with the required additional shared
      properties.
      
      Example are PHY packages that have some regs only in one PHY of the
      package and will affect every other PHY in the package, for example
      related to PHY interface mode calibration or global PHY mode selection.
      
      The PHY package node MUST declare the base address used by the PHY driver
      for global configuration by calculating the offsets of the global PHY
      based on the base address of the PHY package.
      
      Each reg of the PHYs defined in the PHY package node is absolute and
      describe the real address of the Ethernet PHY on the bus.
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8453c88c
  3. 09 Feb, 2024 14 commits