mbox series

[net-next,v3,00/47,RFT] net: dpaa: Convert to phylink

Message ID 20220715215954.1449214-1-sean.anderson@seco.com
Headers show
Series net: dpaa: Convert to phylink | expand

Message

Sean Anderson July 15, 2022, 9:59 p.m. UTC
This series converts the DPAA driver to phylink. Additionally,
it also adds a serdes driver to allow for dynamic reconfiguration
between 1g and 10g interfaces (such as in an SFP+ slot). These changes
are submitted together for this RFT, but they will eventually be
submitted separately to the appropriate subsystem maintainers.

I have tried to maintain backwards compatibility with existing device
trees whereever possible. However, one area where I was unable to
achieve this was with QSGMII. Please refer to patch 4 for details.

All mac drivers have now been converted. I would greatly appreciate if
anyone has QorIQ boards they can test/debug this series on. I only have an
LS1046ARDB. Everything but QSGMII should work without breakage; QSGMII
needs patches 42 and 43.

The serdes driver is mostly functional (except for XFI). This series
only adds support for the LS1046ARDB SerDes (and untested LS1088ARDB),
but it should be fairly straightforward to add support for other SoCs
and boards (see Documentation/driver-api/phy/qoriq.rst).

This is the last spin of this series with all patches included. After next
week (depending on feedback) I will resend the patches broken up as
follows:
- 5: 1000BASE-KX support
- 1, 6, 44, 45: Lynx 10G support
- 7-10, 12-14: Phy rate adaptation support
- 2-4, 15-43, 46, 47: DPAA phylink conversion

Patches 15-19 were first submitted as [1].

[1] https://lore.kernel.org/netdev/20220531195851.1592220-1-sean.anderson@seco.com/

Changes in v3:
- Manually expand yaml references
- Add mode configuration to device tree
- Expand pcs-handle to an array
- Incorperate some minor changes into the first FMan binding commit
- Add vendor prefix 'fsl,' to rgmii and mii properties.
- Set maxItems for pcs-names
- Remove phy-* properties from example because dt-schema complains and I
  can't be bothered to figure out how to make it work.
- Add pcs-handle as a preferred version of pcsphy-handle
- Deprecate pcsphy-handle
- Remove mii/rmii properties
- Add 1000BASE-KX interface mode
- Rename remaining references to QorIQ SerDes to Lynx 10G
- Fix PLL enable sequence by waiting for our reset request to be cleared
  before continuing. Do the same for the lock, even though it isn't as
  critical. Because we will delay for 1.5ms on average, use prepare
  instead of enable so we can sleep.
- Document the status of each protocol
- Fix offset of several bitfields in RECR0
- Take into account PLLRST_B, SDRST_B, and SDEN when considering whether
  a PLL is "enabled."
- Only power off unused lanes.
- Split mode lane mask into first/last lane (like group)
- Read modes from device tree
- Use caps to determine whether KX/KR are supported
- Move modes to lynx_priv
- Ensure that the protocol controller is not already in-use when we try
  to configure a new mode. This should only occur if the device tree is
  misconfigured (e.g. when QSGMII is selected on two lanes but there is
  only one QSGMII controller).
- Split PLL drivers off into their own file
- Add clock for "ext_dly" instead of writing the bit directly (and
  racing with any clock code).
- Use kasprintf instead of open-coding the snprintf dance
- Support 1000BASE-KX in lynx_lookup_proto. This still requires PCS
  support, so nothing is truly "enabled" yet.
- Add support for phy rate adaptation
- Support differing link speeds and interface speeds
- Adjust advertisement based on rate adaptation
- Adjust link settings based on rate adaptation
- Add support for CRS-based rate adaptation
- Add support for AQR115
- Add some additional phy interfaces
- Add support for aquantia rate adaptation
- Put the PCS mdiodev only after we are done with it (since the PCS
  does not perform a get itself).
- Remove _return label from memac_initialization in favor of returning
  directly
- Fix grabbing the default PCS not checking for -ENODATA from
  of_property_match_string
- Set DTSEC_ECNTRL_R100M in dtsec_link_up instead of dtsec_mac_config
- Remove rmii/mii properties
- Replace 1000Base... with 1000BASE... to match IEEE capitalization
- Add compatibles for QSGMII PCSs
- Split arm and powerpcs dts updates
- Describe modes in device tree
- ls1088a: Add serdes bindings

Changes in v2:
- Rename to fsl,lynx-10g.yaml
- Refer to the device in the documentation, rather than the binding
- Move compatible first
- Document phy cells in the description
- Allow a value of 1 for phy-cells. This allows for compatibility with
  the similar (but according to Ioana Ciornei different enough) lynx-28g
  binding.
- Remove minItems
- Use list for clock-names
- Fix example binding having too many cells in regs
- Add #clock-cells. This will allow using assigned-clocks* to configure
  the PLLs.
- Document the structure of the compatible strings
- Convert FMan MAC bindings to yaml
- Better document how we select which PCS to use in the default case
- Rename driver to Lynx 10G (etc.)
- Fix not clearing group->pll after disabling it
- Support 1 and 2 phy-cells
- Power off lanes during probe
- Clear SGMIIaCR1_PCS_EN during probe
- Rename LYNX_PROTO_UNKNOWN to LYNX_PROTO_NONE
- Handle 1000BASE-KX in lynx_proto_mode_prep
- Remove some unused variables
- Fix prototype for dtsec_initialization
- Fix warning if sizeof(void *) != sizeof(resource_size_t)
- Specify type of mac_dev for exception_cb
- Add helper for sanity checking cgr ops
- Add CGR update function
- Adjust queue depth on rate change
- Move PCS_LYNX dependency to fman Kconfig
- Remove unused variable slow_10g_if
- Restrict valid link modes based on the phy interface. This is easier
  to set up, and mostly captures what I intended to do the first time.
  We now have a custom validate which restricts half-duplex for some SoCs
  for RGMII, but generally just uses the default phylink validate.
- Configure the SerDes in enable/disable
- Properly implement all ethtool ops and ioctls. These were mostly
  stubbed out just enough to compile last time.
- Convert 10GEC and dTSEC as well
- Fix capitalization of mEMAC in commit messages
- Add nodes for QSGMII PCSs
- Add nodes for QSGMII PCSs
- Use one phy cell for SerDes1, since no lanes can be grouped
- Disable SerDes by default to prevent breaking boards inadvertently.

Sean Anderson (47):
  dt-bindings: phy: Add Lynx 10G phy binding
  dt-bindings: net: Expand pcs-handle to an array
  dt-bindings: net: Convert FMan MAC bindings to yaml
  dt-bindings: net: fman: Add additional interface properties
  net: phy: Add 1000BASE-KX interface mode
  [RFT] phy: fsl: Add Lynx 10G SerDes driver
  net: phy: Add support for rate adaptation
  net: phylink: Support differing link speeds and interface speeds
  net: phylink: Adjust advertisement based on rate adaptation
  net: phylink: Adjust link settings based on rate adaptation
  [RFC] net: phylink: Add support for CRS-based rate adaptation
  net: phy: aquantia: Add support for AQR115
  net: phy: aquantia: Add some additional phy interfaces
  net: phy: aquantia: Add support for rate adaptation
  net: fman: Convert to SPDX identifiers
  net: fman: Don't pass comm_mode to enable/disable
  net: fman: Store en/disable in mac_device instead of mac_priv_s
  net: fman: dtsec: Always gracefully stop/start
  net: fman: Get PCS node in per-mac init
  net: fman: Store initialization function in match data
  net: fman: Move struct dev to mac_device
  net: fman: Configure fixed link in memac_initialization
  net: fman: Export/rename some common functions
  net: fman: memac: Use params instead of priv for max_speed
  net: fman: Move initialization to mac-specific files
  net: fman: Mark mac methods static
  net: fman: Inline several functions into initialization
  net: fman: Remove internal_phy_node from params
  net: fman: Map the base address once
  net: fman: Pass params directly to mac init
  net: fman: Use mac_dev for some params
  net: fman: Specify type of mac_dev for exception_cb
  net: fman: Clean up error handling
  net: fman: Change return type of disable to void
  net: dpaa: Use mac_dev variable in dpaa_netdev_init
  soc: fsl: qbman: Add helper for sanity checking cgr ops
  soc: fsl: qbman: Add CGR update function
  net: dpaa: Adjust queue depth on rate change
  net: fman: memac: Add serdes support
  net: fman: memac: Use lynx pcs driver
  [RFT] net: dpaa: Convert to phylink
  powerpc: dts: qoriq: Add nodes for QSGMII PCSs
  arm64: dts: layerscape: Add nodes for QSGMII PCSs
  arm64: dts: ls1046a: Add serdes bindings
  arm64: dts: ls1088a: Add serdes bindings
  arm64: dts: ls1046ardb: Add serdes bindings
  [WIP] arm64: dts: ls1088ardb: Add serdes bindings

 .../bindings/net/dsa/renesas,rzn1-a5psw.yaml  |    1 +
 .../bindings/net/ethernet-controller.yaml     |   10 +-
 .../bindings/net/fsl,fman-dtsec.yaml          |  172 +++
 .../bindings/net/fsl,qoriq-mc-dpmac.yaml      |    2 +-
 .../devicetree/bindings/net/fsl-fman.txt      |  133 +-
 .../devicetree/bindings/phy/fsl,lynx-10g.yaml |  311 ++++
 Documentation/driver-api/phy/index.rst        |    1 +
 Documentation/driver-api/phy/lynx_10g.rst     |   73 +
 MAINTAINERS                                   |    6 +
 .../boot/dts/freescale/fsl-ls1043-post.dtsi   |   24 +
 .../boot/dts/freescale/fsl-ls1046-post.dtsi   |   25 +
 .../boot/dts/freescale/fsl-ls1046a-rdb.dts    |   34 +
 .../arm64/boot/dts/freescale/fsl-ls1046a.dtsi |  179 +++
 .../boot/dts/freescale/fsl-ls1088a-rdb.dts    |   87 ++
 .../arm64/boot/dts/freescale/fsl-ls1088a.dtsi |   96 ++
 .../fsl/qoriq-fman3-0-10g-0-best-effort.dtsi  |    3 +-
 .../boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi     |   10 +-
 .../fsl/qoriq-fman3-0-10g-1-best-effort.dtsi  |   10 +-
 .../boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi     |   10 +-
 .../boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi      |    3 +-
 .../boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi      |   10 +-
 .../boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi      |   10 +-
 .../boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi      |   10 +-
 .../boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi      |    3 +-
 .../boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi      |   10 +-
 .../boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi     |   10 +-
 .../boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi     |   10 +-
 .../boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi      |    3 +-
 .../boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi      |   10 +-
 .../boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi      |   10 +-
 .../boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi      |   10 +-
 .../boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi      |    3 +-
 .../boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi      |   10 +-
 drivers/net/ethernet/freescale/dpaa/Kconfig   |    4 +-
 .../net/ethernet/freescale/dpaa/dpaa_eth.c    |  132 +-
 .../ethernet/freescale/dpaa/dpaa_eth_sysfs.c  |    2 +-
 .../ethernet/freescale/dpaa/dpaa_ethtool.c    |   90 +-
 drivers/net/ethernet/freescale/fman/Kconfig   |    4 +-
 drivers/net/ethernet/freescale/fman/fman.c    |   31 +-
 drivers/net/ethernet/freescale/fman/fman.h    |   31 +-
 .../net/ethernet/freescale/fman/fman_dtsec.c  |  674 ++++-----
 .../net/ethernet/freescale/fman/fman_dtsec.h  |   58 +-
 .../net/ethernet/freescale/fman/fman_keygen.c |   29 +-
 .../net/ethernet/freescale/fman/fman_keygen.h |   29 +-
 .../net/ethernet/freescale/fman/fman_mac.h    |   34 +-
 .../net/ethernet/freescale/fman/fman_memac.c  |  864 +++++------
 .../net/ethernet/freescale/fman/fman_memac.h  |   57 +-
 .../net/ethernet/freescale/fman/fman_muram.c  |   31 +-
 .../net/ethernet/freescale/fman/fman_muram.h  |   32 +-
 .../net/ethernet/freescale/fman/fman_port.c   |   29 +-
 .../net/ethernet/freescale/fman/fman_port.h   |   29 +-
 drivers/net/ethernet/freescale/fman/fman_sp.c |   29 +-
 drivers/net/ethernet/freescale/fman/fman_sp.h |   28 +-
 .../net/ethernet/freescale/fman/fman_tgec.c   |  274 ++--
 .../net/ethernet/freescale/fman/fman_tgec.h   |   54 +-
 drivers/net/ethernet/freescale/fman/mac.c     |  653 +--------
 drivers/net/ethernet/freescale/fman/mac.h     |   66 +-
 drivers/net/phy/aquantia_main.c               |   86 +-
 drivers/net/phy/phy.c                         |   21 +
 drivers/net/phy/phylink.c                     |  161 +-
 drivers/phy/freescale/Kconfig                 |   20 +
 drivers/phy/freescale/Makefile                |    3 +
 drivers/phy/freescale/lynx-10g.h              |   36 +
 drivers/phy/freescale/phy-fsl-lynx-10g-clk.c  |  438 ++++++
 drivers/phy/freescale/phy-fsl-lynx-10g.c      | 1297 +++++++++++++++++
 drivers/soc/fsl/qbman/qman.c                  |   76 +-
 include/linux/phy.h                           |   42 +
 include/linux/phylink.h                       |   12 +-
 include/soc/fsl/qman.h                        |    9 +
 69 files changed, 4408 insertions(+), 2356 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/fsl,fman-dtsec.yaml
 create mode 100644 Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml
 create mode 100644 Documentation/driver-api/phy/lynx_10g.rst
 create mode 100644 drivers/phy/freescale/lynx-10g.h
 create mode 100644 drivers/phy/freescale/phy-fsl-lynx-10g-clk.c
 create mode 100644 drivers/phy/freescale/phy-fsl-lynx-10g.c

Comments

Sean Anderson July 21, 2022, 11:35 p.m. UTC | #1
On 7/21/22 2:29 PM, Rob Herring wrote:
> On Thu, Jul 21, 2022 at 10:06 AM Sean Anderson <sean.anderson@seco.com> wrote:
>>
>>
>>
>> On 7/20/22 6:17 PM, Rob Herring wrote:
>> > On Fri, Jul 15, 2022 at 05:59:08PM -0400, Sean Anderson wrote:
>> >> This adds a binding for the SerDes module found on QorIQ processors. The
>> >> phy reference has two cells, one for the first lane and one for the
>> >> last. This should allow for good support of multi-lane protocols when
>> >> (if) they are added. There is no protocol option, because the driver is
>> >> designed to be able to completely reconfigure lanes at runtime.
>> >> Generally, the phy consumer can select the appropriate protocol using
>> >> set_mode. For the most part there is only one protocol controller
>> >> (consumer) per lane/protocol combination. The exception to this is the
>> >> B4860 processor, which has some lanes which can be connected to
>> >> multiple MACs. For that processor, I anticipate the easiest way to
>> >> resolve this will be to add an additional cell with a "protocol
>> >> controller instance" property.
>> >>
>> >> Each serdes has a unique set of supported protocols (and lanes). The
>> >> support matrix is configured in the device tree. The format of each
>> >> PCCR (protocol configuration register) is modeled. Although the general
>> >> format is typically the same across different SoCs, the specific
>> >> supported protocols (and the values necessary to select them) are
>> >> particular to individual SerDes. A nested structure is used to reduce
>> >> duplication of data.
>> >>
>> >> There are two PLLs, each of which can be used as the master clock for
>> >> each lane. Each PLL has its own reference. For the moment they are
>> >> required, because it simplifies the driver implementation. Absent
>> >> reference clocks can be modeled by a fixed-clock with a rate of 0.
>> >>
>> >> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
>> >> ---
>> >>
>> >> Changes in v3:
>> >> - Manually expand yaml references
>> >> - Add mode configuration to device tree
>> >>
>> >> Changes in v2:
>> >> - Rename to fsl,lynx-10g.yaml
>> >> - Refer to the device in the documentation, rather than the binding
>> >> - Move compatible first
>> >> - Document phy cells in the description
>> >> - Allow a value of 1 for phy-cells. This allows for compatibility with
>> >>   the similar (but according to Ioana Ciornei different enough) lynx-28g
>> >>   binding.
>> >> - Remove minItems
>> >> - Use list for clock-names
>> >> - Fix example binding having too many cells in regs
>> >> - Add #clock-cells. This will allow using assigned-clocks* to configure
>> >>   the PLLs.
>> >> - Document the structure of the compatible strings
>> >>
>> >>  .../devicetree/bindings/phy/fsl,lynx-10g.yaml | 311 ++++++++++++++++++
>> >>  1 file changed, 311 insertions(+)
>> >>  create mode 100644 Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml
>> >>
>> >> diff --git a/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml b/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml
>> >> new file mode 100644
>> >> index 000000000000..a2c37225bb67
>> >> --- /dev/null
>> >> +++ b/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml
>> >> @@ -0,0 +1,311 @@
>> >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> >> +%YAML 1.2
>> >> +---
>> >> +$id: http://devicetree.org/schemas/phy/fsl,lynx-10g.yaml#
>> >> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> >> +
>> >> +title: NXP Lynx 10G SerDes
>> >> +
>> >> +maintainers:
>> >> +  - Sean Anderson <sean.anderson@seco.com>
>> >> +
>> >> +description: |
>> >> +  These Lynx "SerDes" devices are found in NXP's QorIQ line of processors. The
>> >> +  SerDes provides up to eight lanes. Each lane may be configured individually,
>> >> +  or may be combined with adjacent lanes for a multi-lane protocol. The SerDes
>> >> +  supports a variety of protocols, including up to 10G Ethernet, PCIe, SATA, and
>> >> +  others. The specific protocols supported for each lane depend on the
>> >> +  particular SoC.
>> >> +
>> >> +definitions:
>> >
>> > $defs:
>>
>> That didn't work until recently :)
>>
>> I will change this for next revision.
>>
>> >> +  fsl,cfg:
>> >> +    $ref: /schemas/types.yaml#/definitions/uint32
>> >> +    minimum: 1
>> >> +    description: |
>> >> +      The configuration value to program into the field.
>> >
>> > What field?
>>
>> Ah, looks like this lost some context when I moved it. I will expand on this.
>>
>> >> +
>> >> +  fsl,first-lane:
>> >> +    $ref: /schemas/types.yaml#/definitions/uint32
>> >> +    minimum: 0
>> >> +    maximum: 7
>> >> +    description: |
>> >> +      The first lane in the group configured by fsl,cfg. This lane will have
>> >> +      the FIRST_LANE bit set in GCR0. The reset direction will also be set
>> >> +      based on whether this property is less than or greater than
>> >> +      fsl,last-lane.
>> >> +
>> >> +  fsl,last-lane:
>> >> +    $ref: /schemas/types.yaml#/definitions/uint32
>> >> +    minimum: 0
>> >> +    maximum: 7
>> >> +    description: |
>> >> +      The last lane configured by fsl,cfg. If this property is absent,
>> >> +      then it will default to the value of fsl,first-lane.
>> >> +
>> >> +properties:
>> >> +  compatible:
>> >> +    items:
>> >> +      - enum:
>> >> +          - fsl,ls1046a-serdes
>> >> +          - fsl,ls1088a-serdes
>> >> +      - const: fsl,lynx-10g
>> >> +
>> >> +  "#clock-cells":
>> >> +    const: 1
>> >> +    description: |
>> >> +      The cell contains the index of the PLL, starting from 0. Note that when
>> >> +      assigning a rate to a PLL, the PLLs' rates are divided by 1000 to avoid
>> >> +      overflow. A rate of 5000000 corresponds to 5GHz.
>> >> +
>> >> +  "#phy-cells":
>> >> +    minimum: 1
>> >> +    maximum: 2
>> >> +    description: |
>> >> +      The cells contain the following arguments:
>> >> +      - The first lane in the group. Lanes are numbered based on the register
>> >> +        offsets, not the I/O ports. This corresponds to the letter-based ("Lane
>> >> +        A") naming scheme, and not the number-based ("Lane 0") naming scheme. On
>> >> +        most SoCs, "Lane A" is "Lane 0", but not always.
>> >> +      - Last lane. For single-lane protocols, this should be the same as the
>> >> +        first lane.
>> >
>> > Perhaps a single cell with a lane mask would be simpler.
>>
>> Yes.
>>
>> >> +      If no lanes in a SerDes can be grouped, then #phy-cells may be 1, and the
>> >> +      first cell will specify the only lane in the group.
>> >
>> > It is generally easier to have a fixed number of cells.
>>
>> This was remarked on last time. I allowed this for better compatibility with the lynx
>> 28g serdes binding. Is that reasonable? I agree it would simplify the driver to just
>> have one cell type.
>>
>> >> +
>> >> +  clocks:
>> >> +    maxItems: 2
>> >> +    description: |
>> >> +      Clock for each PLL reference clock input.
>> >> +
>> >> +  clock-names:
>> >> +    minItems: 2
>> >> +    maxItems: 2
>> >> +    items:
>> >> +      enum:
>> >> +        - ref0
>> >> +        - ref1
>> >> +
>> >> +  reg:
>> >> +    maxItems: 1
>> >> +
>> >> +patternProperties:
>> >> +  '^pccr-':
>> >> +    type: object
>> >> +
>> >> +    description: |
>> >> +      One of the protocol configuration registers (PCCRs). These contains
>> >> +      several fields, each of which mux a particular protocol onto a particular
>> >> +      lane.
>> >> +
>> >> +    properties:
>> >> +      fsl,pccr:
>> >> +        $ref: /schemas/types.yaml#/definitions/uint32
>> >> +        description: |
>> >> +          The index of the PCCR. This is the same as the register name suffix.
>> >> +          For example, a node for PCCRB would use a value of '0xb' for an
>> >> +          offset of 0x22C (0x200 + 4 * 0xb).
>> >> +
>> >> +    patternProperties:
>> >> +      '^(q?sgmii|xfi|pcie|sata)-':
>> >> +        type: object
>> >> +
>> >> +        description: |
>> >> +          A configuration field within a PCCR. Each field configures one
>> >> +          protocol controller. The value of the field determines the lanes the
>> >> +          controller is connected to, if any.
>> >> +
>> >> +        properties:
>> >> +          fsl,index:
>> >
>> > indexes are generally a red flag in binding. What is the index, how does
>> > it correspond to the h/w and why do you need it.
>>
>> As described in the description below, the "index" is the protocol controller suffix,
>> corresponding to a particular field (or set of fields) in the protocol configuration
>> registers.
>>
>> > If we do end up needing
>> > it, 'reg' is generally how we address some component.
>>
>> I originally used reg, but I got warnings about inheriting #size-cells and
>> #address-cells. These bindings are already quite verbose to write out (there
>> are around 10-20 configurations per SerDes to describe) and I would like to
>> minimize the amount of properties to what is necessary. Additionally, this
>> really describes a particular index of a field, and not a register (or an offset
>> within a register).
> 
> Are you trying to describe all possible configurations in DT? Don't.
> The DT should be the config for the specific board, not a menu of
> possible configurations.

Reasons 2 and 3 mentioned below.

>> >> +            $ref: /schemas/types.yaml#/definitions/uint32
>> >> +            description: |
>> >> +              The index of the field. This corresponds to the suffix in the
>> >
>> > What field?
>>
>> The one from the description above.
>>
>> >> +              documentation. For example, PEXa would be 0, PEXb 1, etc.
>> >> +              Generally, higher fields occupy lower bits.
>> >> +
>> >> +              If there are any subnodes present, they will be preferred over
>> >> +              fsl,cfg et. al.
>> >> +
>> >> +          fsl,cfg:
>> >> +            $ref: "#/definitions/fsl,cfg"
>> >> +
>> >> +          fsl,first-lane:
>> >> +            $ref: "#/definitions/fsl,first-lane"
>> >> +
>> >> +          fsl,last-lane:
>> >> +            $ref: "#/definitions/fsl,last-lane"
>> >
>> > Why do you have lane assignments here and in the phy cells?
>>
>> For three reasons. First, because we need to know what protocols are valid on what
>> lanes. The idea is to allow the MAC to configure the protocols at runtime. To do
>> this, someone has to figure out if the protocol is supported on that lane. The
>> best place to put this IMO is the serdes.
> 
> Within ethernet protocols, that makes sense.
> 
>> Second, some serdes have (mostly) unsupported protocols such as PCIe as well as
>> Ethernet protocols. To allow using Ethernet, we need to know which lanes are
>> configured (by the firmware/bootloader) for some other protocol. That way, we
>> can avoid touching them.
> 
> The ones needed for ethernet are the ones with a connection to the
> ethernet MACs with the 'phys' properties. Why don't you just ignore
> the !ethernet ones?

That's what I try to do. However, non-ethernet modes can use the same
lanes as ethernet modes. So we need to know how the protocol selection
registers are laid out, and what bits select which lanes. Although the
general layout is mostly the same [1], the mapping is specific to the
individual serdes on the individual SoC.

[1] Occasionally, the layout of registers changes between different SoC
    revisions. Usually this is because one of the registers ran out of
    bits.

>> Third, as part of the probe sequence, we need to ensure that no protocol controllers
>> are currently selected. Otherwise, we will get strange problems later when we try
>> to connect multiple protocol controllers to the same lane.
> 
> Sounds like a kernel problem...

Of course, but this stuff has to come from somewhere. Due to the second
reason above we can't just clear out all the PCCRs. We need to know
whether a lane is in use or not, 

>>
>> >> +
>> >> +          fsl,proto:
>> >> +            $ref: /schemas/types.yaml#/definitions/string
>> >> +            enum:
>> >> +              - sgmii
>> >> +              - sgmii25
>> >> +              - qsgmii
>> >> +              - xfi
>> >> +              - pcie
>> >> +              - sata
>> >
>> > We have standard phy modes already for at least most of these types.
>> > Generally the mode is set in the phy cells.
>>
>> Yes, but this is the "protocol" which may correspond to multiple phy modes.
>> For example, sgmii25 allows SGMII, 1000BASE-X, 1000BASE-KR, and 2500BASE-X
>> phy modes.
> 
> As phy mode is more specific than protocol (or mode implies protocol),
> why do we need protocol in DT?

The protocol (along with the PCCR and the protocol controller index) is
used to determine the bitmask for a particular selector. For example,
PCCR1 on the T1040 has the following layout:

Bits  Field name
===== ==========
 0- 1 SGMIIA_CFG
 2- 3 SGMIIB_CFG
 4- 5 SGMIIC_CFG
 6- 7 SGMIID_CFG
 8- 9 SGMIIE_CFG
10-11 SGMIIF_CFG
12-15 Reserved
   16 SGMIIA_KX
   17 SGMIIB_KX
   18 SGMIIC_KX
   19 SGMIID_KX
   20 SGMIIE_KX
   21 SGMIIF_KX
22-23 Reserved
24-25 QSGMA_CFG
26-27 Reserved
28-29 QSGMB_CFG
30-31 Reserved

Note that the KX bit (determining whether 1000BASE-X/SGMII or
1000BASE-KX is enabled) is not contiguous with the CFG field. Instead,
the "index" of the protocol controller is used to determine the correct
max to use for the CFG field as well as the KX bit. Also note that this
register is inhomogeneous. Just the "index" is not enough: we need to
know what the protocol is as well.

> [...]
> 
>> >> +        xfi-1 {
>> >> +          fsl,index = <1>;
>> >> +          fsl,cfg = <0x1>;
>> >> +          fsl,first-lane = <0>;
>> >> +          fsl,proto = "xfi";
>> >> +        };
>> >> +      };
>> >> +    };
>> >
>> > Other than lane assignments and modes, I don't really understand what
>> > you are trying to do.
>>
>> This is touched on a bit above, but the idea here is to allow for dynamic
>> reconfiguration of the serdes mode in order to support multiple ethernet
>> phy modes at runtime. To do this, we need to know about all the available
>> protocol controllers, and the lanes they support. In particular, the
>> available controllers and the lanes they map to (and the values to
>> program to select them) differ even between different serdes on the same
>> SoC.
>>
>> > It all looks too complex and I don't see any other
>> > phy bindings needing something this complex.
>>
>> This was explicitly asked for last time. I also would not like to do this,
>> but you and Krzysztof Kozlowski were very opposed to having per-device
>> compatible strings. If you have a suggestion for a different approach, I
>> am all ears. I find it very frustrating that the primary feedback I get from
>> the device tree folks is "you can't do this" without a corresponding "do it
>> this way."
> 
> How much time do you expect that we spend on your binding which is
> only 1 out of the 100-200 patches we get a week?

I appreciate the work you do on this. But every revision I make without
knowing whether I'm on the right track wastes both of our time. I have
to spend my time coming up with and implementing a new binding and you
have to spend time reviewing it. A nudge in the right direction can
easily save us both time.

> We're not experts in all kinds of h/w and the experts for specific h/w
> don't always care about DT bindings.

Vinod, this is why I (and presumably Rob) would appreciate your feedback.

> We often get presented with solutions without sufficient explanations
> of the problem. If I don't understand the problem, how can I propose a
> solution? We can only point out what doesn't fit within normal DT
> patterns. PHYs with multiple modes supported is not a unique problem,
> so why are existing ways to deal with that not sufficient and why do
> you need a *very* specific binding?

Well, take for example xlnx,zynqmp-psgtr. Although it is not obvious
from the binding, there are several things which simplify the driver.
First, all the modes are completely incompatible. Any consumer will not
need to switch modes at runtime. Second, there is only one GTR device
per SoC. That means that the compatible string which completely
determines the available modes. The mode/lane mapping can be stored in
the driver instead of in the device tree. Last, there is only one
variant of this device. There are no other SoCs with slightly different
register layout, mode support, or lanes.

To contrast with this device, there are several almost-compatible modes.
We cannot just set the mode at boot and be done with it (in fact this is
exactly what I am trying to change by adding a driver). Some modes are
so similar that they reuse protocol controllers, but they still need to
have different lane configuration. There are multiple different SerDes
devices on each SoC. While they have the same register layout, the
connected protocol controllers (and lane mapping) is different. There
are also different SoCs with (ever-so-slightly) different register
layouts, protocol controllers, and lane mappings.

All of this sort of information would normally just be stored in the
driver as a set of struct arrays. In fact, this is what I did the first
time!

> With the phy binding, you know what each lane is connected to. You can
> put whatever information you want in the phy cells to configure the
> phy for that client. The phy cells are defined by the provider and
> opaque to the consumer. Yes, we like to standardize cells when
> possible, but that's only a convenience. I'm not saying phy cells is
> the answer for everything and define 10 cells worth of data either.

Maybe it's better to do something like

	// first-lane last-lane protocol pccr idx val
	phys = <&serdes1 1 1 PHY_TYPE_SGMII 0x8 2 1>,
	       <&serdes1 1 1 PHY_TYPE_QSGMII 0x9 0 2>,
	       <&serdes1 1 1 PHY_TYPE_10GBASER 0xb 1 1>;
	phy-names = "sgmii", "qsgmii", "xfi";

(made up values)

But this doesn't play well with the existing idiom of being able to call
phy_set_mode(). Plus, existing drivers expect to have one (devicetree)
phy for one physical serdes.

What about

	phys = <&serdes1_lane1>;

and then under the serdes node do something like

	serdes1: phy@foo {
		...

		serdes1_lane1 {
			first-lane = <1>;

			sgmii {
				fsl,pccr = <0x8>;
				fsl,idx = <2>;
				fsl,cfg = <1>;
				fsl,proto = "sgmii";
				// or PHY_TYPE_SGMII
			};

			qsgmii {
				...
			};

			xfi {
				...
			};
		};
	};

and this way you could have something like a fsl,reserved property to
deal with not-yet-supported lanes. And this could be added piecemeal by
board configs.

--Sean
Camelia Alexandra Groza July 22, 2022, 12:41 p.m. UTC | #2
> -----Original Message-----
> From: Sean Anderson <sean.anderson@seco.com>
> Sent: Thursday, July 21, 2022 18:41
> To: Camelia Alexandra Groza <camelia.groza@nxp.com>; David S . Miller
> <davem@davemloft.net>; Jakub Kicinski <kuba@kernel.org>; Madalin Bucur
> <madalin.bucur@nxp.com>; netdev@vger.kernel.org
> Cc: Paolo Abeni <pabeni@redhat.com>; Eric Dumazet
> <edumazet@google.com>; linux-arm-kernel@lists.infradead.org; Russell
> King <linux@armlinux.org.uk>; linux-kernel@vger.kernel.org; Kishon Vijay
> Abraham I <kishon@ti.com>; Krzysztof Kozlowski
> <krzysztof.kozlowski+dt@linaro.org>; Leo Li <leoyang.li@nxp.com>; Rob
> Herring <robh+dt@kernel.org>; Shawn Guo <shawnguo@kernel.org>; Vinod
> Koul <vkoul@kernel.org>; devicetree@vger.kernel.org; linux-
> phy@lists.infradead.org
> Subject: Re: [PATCH net-next v3 46/47] arm64: dts: ls1046ardb: Add serdes
> bindings
> 
> 
> 
> On 7/21/22 10:20 AM, Camelia Alexandra Groza wrote:
> >> -----Original Message-----
> >> From: Sean Anderson <sean.anderson@seco.com>
> >> Sent: Saturday, July 16, 2022 1:00
> >> To: David S . Miller <davem@davemloft.net>; Jakub Kicinski
> >> <kuba@kernel.org>; Madalin Bucur <madalin.bucur@nxp.com>;
> >> netdev@vger.kernel.org
> >> Cc: Paolo Abeni <pabeni@redhat.com>; Eric Dumazet
> >> <edumazet@google.com>; linux-arm-kernel@lists.infradead.org; Russell
> >> King <linux@armlinux.org.uk>; linux-kernel@vger.kernel.org; Sean
> Anderson
> >> <sean.anderson@seco.com>; Kishon Vijay Abraham I <kishon@ti.com>;
> >> Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>; Leo Li
> >> <leoyang.li@nxp.com>; Rob Herring <robh+dt@kernel.org>; Shawn Guo
> >> <shawnguo@kernel.org>; Vinod Koul <vkoul@kernel.org>;
> >> devicetree@vger.kernel.org; linux-phy@lists.infradead.org
> >> Subject: [PATCH net-next v3 46/47] arm64: dts: ls1046ardb: Add serdes
> >> bindings
> >>
> >> This adds appropriate bindings for the macs which use the SerDes. The
> >> 156.25MHz fixed clock is a crystal. The 100MHz clocks (there are
> >> actually 3) come from a Renesas 6V49205B at address 69 on i2c0. There is
> >> no driver for this device (and as far as I know all you can do with the
> >> 100MHz clocks is gate them), so I have chosen to model it as a single
> >> fixed clock.
> >>
> >> Note: the SerDes1 lane numbering for the LS1046A is *reversed*.
> >> This means that Lane A (what the driver thinks is lane 0) uses pins
> >> SD1_TX3_P/N.
> >>
> >> Because this will break ethernet if the serdes is not enabled, enable
> >> the serdes driver by default on Layerscape.
> >>
> >> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> >> ---
> >> Please let me know if there is a better/more specific config I can use
> >> here.
> >>
> >> (no changes since v1)
> >
> > My LS1046ARDB hangs at boot with this patch right after the second SerDes
> is probed,
> > right before the point where the PCI host bridge is registered. I can get
> around this
> > either by disabling the second SerDes node from the device tree, or
> disabling
> > CONFIG_PCI_LAYERSCAPE at build.
> >
> > I haven't debugged it more but there seems to be an issue here.
> 
> Hm. Do you have anything plugged into the PCIe/SATA slots? I haven't been
> testing with
> anything there. For now, it may be better to just leave it disabled.
> 
> --Sean

Yes, I have an Intel e1000 card plugged in.

Camelia
Sean Anderson July 25, 2022, 8:02 p.m. UTC | #3
On 7/22/22 8:41 AM, Camelia Alexandra Groza wrote:
>> -----Original Message-----
>> From: Sean Anderson <sean.anderson@seco.com>
>> Sent: Thursday, July 21, 2022 18:41
>> To: Camelia Alexandra Groza <camelia.groza@nxp.com>; David S . Miller
>> <davem@davemloft.net>; Jakub Kicinski <kuba@kernel.org>; Madalin Bucur
>> <madalin.bucur@nxp.com>; netdev@vger.kernel.org
>> Cc: Paolo Abeni <pabeni@redhat.com>; Eric Dumazet
>> <edumazet@google.com>; linux-arm-kernel@lists.infradead.org; Russell
>> King <linux@armlinux.org.uk>; linux-kernel@vger.kernel.org; Kishon Vijay
>> Abraham I <kishon@ti.com>; Krzysztof Kozlowski
>> <krzysztof.kozlowski+dt@linaro.org>; Leo Li <leoyang.li@nxp.com>; Rob
>> Herring <robh+dt@kernel.org>; Shawn Guo <shawnguo@kernel.org>; Vinod
>> Koul <vkoul@kernel.org>; devicetree@vger.kernel.org; linux-
>> phy@lists.infradead.org
>> Subject: Re: [PATCH net-next v3 46/47] arm64: dts: ls1046ardb: Add serdes
>> bindings
>> 
>> 
>> 
>> On 7/21/22 10:20 AM, Camelia Alexandra Groza wrote:
>> >> -----Original Message-----
>> >> From: Sean Anderson <sean.anderson@seco.com>
>> >> Sent: Saturday, July 16, 2022 1:00
>> >> To: David S . Miller <davem@davemloft.net>; Jakub Kicinski
>> >> <kuba@kernel.org>; Madalin Bucur <madalin.bucur@nxp.com>;
>> >> netdev@vger.kernel.org
>> >> Cc: Paolo Abeni <pabeni@redhat.com>; Eric Dumazet
>> >> <edumazet@google.com>; linux-arm-kernel@lists.infradead.org; Russell
>> >> King <linux@armlinux.org.uk>; linux-kernel@vger.kernel.org; Sean
>> Anderson
>> >> <sean.anderson@seco.com>; Kishon Vijay Abraham I <kishon@ti.com>;
>> >> Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>; Leo Li
>> >> <leoyang.li@nxp.com>; Rob Herring <robh+dt@kernel.org>; Shawn Guo
>> >> <shawnguo@kernel.org>; Vinod Koul <vkoul@kernel.org>;
>> >> devicetree@vger.kernel.org; linux-phy@lists.infradead.org
>> >> Subject: [PATCH net-next v3 46/47] arm64: dts: ls1046ardb: Add serdes
>> >> bindings
>> >>
>> >> This adds appropriate bindings for the macs which use the SerDes. The
>> >> 156.25MHz fixed clock is a crystal. The 100MHz clocks (there are
>> >> actually 3) come from a Renesas 6V49205B at address 69 on i2c0. There is
>> >> no driver for this device (and as far as I know all you can do with the
>> >> 100MHz clocks is gate them), so I have chosen to model it as a single
>> >> fixed clock.
>> >>
>> >> Note: the SerDes1 lane numbering for the LS1046A is *reversed*.
>> >> This means that Lane A (what the driver thinks is lane 0) uses pins
>> >> SD1_TX3_P/N.
>> >>
>> >> Because this will break ethernet if the serdes is not enabled, enable
>> >> the serdes driver by default on Layerscape.
>> >>
>> >> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
>> >> ---
>> >> Please let me know if there is a better/more specific config I can use
>> >> here.
>> >>
>> >> (no changes since v1)
>> >
>> > My LS1046ARDB hangs at boot with this patch right after the second SerDes
>> is probed,
>> > right before the point where the PCI host bridge is registered. I can get
>> around this
>> > either by disabling the second SerDes node from the device tree, or
>> disabling
>> > CONFIG_PCI_LAYERSCAPE at build.
>> >
>> > I haven't debugged it more but there seems to be an issue here.
>> 
>> Hm. Do you have anything plugged into the PCIe/SATA slots? I haven't been
>> testing with
>> anything there. For now, it may be better to just leave it disabled.
>> 
>> --Sean
> 
> Yes, I have an Intel e1000 card plugged in.
> 
> Camelia
> 

Can you try the following patch? I was able to boot with PCI with it applied.
Camelia Alexandra Groza July 26, 2022, 11:35 a.m. UTC | #4
> -----Original Message-----
> From: Sean Anderson <sean.anderson@seco.com>
> Sent: Monday, July 25, 2022 23:02
> To: Camelia Alexandra Groza <camelia.groza@nxp.com>; David S . Miller
> <davem@davemloft.net>; Jakub Kicinski <kuba@kernel.org>; Madalin Bucur
> <madalin.bucur@nxp.com>; netdev@vger.kernel.org
> Cc: Paolo Abeni <pabeni@redhat.com>; Eric Dumazet
> <edumazet@google.com>; linux-arm-kernel@lists.infradead.org; Russell
> King <linux@armlinux.org.uk>; linux-kernel@vger.kernel.org; Kishon Vijay
> Abraham I <kishon@ti.com>; Krzysztof Kozlowski
> <krzysztof.kozlowski+dt@linaro.org>; Leo Li <leoyang.li@nxp.com>; Rob
> Herring <robh+dt@kernel.org>; Shawn Guo <shawnguo@kernel.org>; Vinod
> Koul <vkoul@kernel.org>; devicetree@vger.kernel.org; linux-
> phy@lists.infradead.org
> Subject: Re: [PATCH net-next v3 46/47] arm64: dts: ls1046ardb: Add serdes
> bindings
> 
> 
> 
> On 7/22/22 8:41 AM, Camelia Alexandra Groza wrote:
> >> -----Original Message-----
> >> From: Sean Anderson <sean.anderson@seco.com>
> >> Sent: Thursday, July 21, 2022 18:41
> >> To: Camelia Alexandra Groza <camelia.groza@nxp.com>; David S . Miller
> >> <davem@davemloft.net>; Jakub Kicinski <kuba@kernel.org>; Madalin
> Bucur
> >> <madalin.bucur@nxp.com>; netdev@vger.kernel.org
> >> Cc: Paolo Abeni <pabeni@redhat.com>; Eric Dumazet
> >> <edumazet@google.com>; linux-arm-kernel@lists.infradead.org; Russell
> >> King <linux@armlinux.org.uk>; linux-kernel@vger.kernel.org; Kishon Vijay
> >> Abraham I <kishon@ti.com>; Krzysztof Kozlowski
> >> <krzysztof.kozlowski+dt@linaro.org>; Leo Li <leoyang.li@nxp.com>; Rob
> >> Herring <robh+dt@kernel.org>; Shawn Guo <shawnguo@kernel.org>;
> Vinod
> >> Koul <vkoul@kernel.org>; devicetree@vger.kernel.org; linux-
> >> phy@lists.infradead.org
> >> Subject: Re: [PATCH net-next v3 46/47] arm64: dts: ls1046ardb: Add
> serdes
> >> bindings
> >>
> >>
> >>
> >> On 7/21/22 10:20 AM, Camelia Alexandra Groza wrote:
> >> >> -----Original Message-----
> >> >> From: Sean Anderson <sean.anderson@seco.com>
> >> >> Sent: Saturday, July 16, 2022 1:00
> >> >> To: David S . Miller <davem@davemloft.net>; Jakub Kicinski
> >> >> <kuba@kernel.org>; Madalin Bucur <madalin.bucur@nxp.com>;
> >> >> netdev@vger.kernel.org
> >> >> Cc: Paolo Abeni <pabeni@redhat.com>; Eric Dumazet
> >> >> <edumazet@google.com>; linux-arm-kernel@lists.infradead.org;
> Russell
> >> >> King <linux@armlinux.org.uk>; linux-kernel@vger.kernel.org; Sean
> >> Anderson
> >> >> <sean.anderson@seco.com>; Kishon Vijay Abraham I
> <kishon@ti.com>;
> >> >> Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>; Leo Li
> >> >> <leoyang.li@nxp.com>; Rob Herring <robh+dt@kernel.org>; Shawn
> Guo
> >> >> <shawnguo@kernel.org>; Vinod Koul <vkoul@kernel.org>;
> >> >> devicetree@vger.kernel.org; linux-phy@lists.infradead.org
> >> >> Subject: [PATCH net-next v3 46/47] arm64: dts: ls1046ardb: Add serdes
> >> >> bindings
> >> >>
> >> >> This adds appropriate bindings for the macs which use the SerDes. The
> >> >> 156.25MHz fixed clock is a crystal. The 100MHz clocks (there are
> >> >> actually 3) come from a Renesas 6V49205B at address 69 on i2c0. There
> is
> >> >> no driver for this device (and as far as I know all you can do with the
> >> >> 100MHz clocks is gate them), so I have chosen to model it as a single
> >> >> fixed clock.
> >> >>
> >> >> Note: the SerDes1 lane numbering for the LS1046A is *reversed*.
> >> >> This means that Lane A (what the driver thinks is lane 0) uses pins
> >> >> SD1_TX3_P/N.
> >> >>
> >> >> Because this will break ethernet if the serdes is not enabled, enable
> >> >> the serdes driver by default on Layerscape.
> >> >>
> >> >> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> >> >> ---
> >> >> Please let me know if there is a better/more specific config I can use
> >> >> here.
> >> >>
> >> >> (no changes since v1)
> >> >
> >> > My LS1046ARDB hangs at boot with this patch right after the second
> SerDes
> >> is probed,
> >> > right before the point where the PCI host bridge is registered. I can get
> >> around this
> >> > either by disabling the second SerDes node from the device tree, or
> >> disabling
> >> > CONFIG_PCI_LAYERSCAPE at build.
> >> >
> >> > I haven't debugged it more but there seems to be an issue here.
> >>
> >> Hm. Do you have anything plugged into the PCIe/SATA slots? I haven't
> been
> >> testing with
> >> anything there. For now, it may be better to just leave it disabled.
> >>
> >> --Sean
> >
> > Yes, I have an Intel e1000 card plugged in.
> >
> > Camelia
> >
> 
> Can you try the following patch? I was able to boot with PCI with it applied.

Works for me as well. The board boots fine and the PCI card is functional. Thanks. 

> From 71f4136f1bdda89009936a9c24561b60e0554859 Mon Sep 17 00:00:00
> 2001
> From: Sean Anderson <sean.anderson@seco.com>
> Date: Mon, 25 Jul 2022 16:01:16 -0400
> Subject: [PATCH] arm64: dts: ls1046a: Fix missing PCIe lane
> 
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> ---
>  arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi
> b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi
> index 0b3765cad383..3841ba274782 100644
> --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi
> +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi
> @@ -532,7 +532,7 @@ pcie-0 {
>  					/* PCIe.1 x1 */
>  					cfg-1 {
>  						fsl,cfg = <0x1>;
> -						fsl,first-lane = <1>;
> +						fsl,first-lane = <0>;
>  					};
> 
>  					/* PCIe.1 x4 */
> @@ -543,6 +543,14 @@ cfg-3 {
>  					};
>  				};
> 
> +				/* PCIe.2 x1 */
> +				pcie-1 {
> +					fsl,index = <1>;
> +					fsl,proto = "pcie";
> +					fsl,cfg = <0x1>;
> +					fsl,first-lane = <1>;
> +				};
> +
>  				pcie-2 {
>  					fsl,index = <2>;
>  					fsl,proto = "pcie";
> --
> 2.35.1.1320.gc452695387.dirty
Sean Anderson July 26, 2022, 3:44 p.m. UTC | #5
Hi Rob,

On 7/21/22 7:35 PM, Sean Anderson wrote:
> What about
> 
> 	phys = <&serdes1_lane1>;
> 
> and then under the serdes node do something like
> 
> 	serdes1: phy@foo {
> 		...
> 
> 		serdes1_lane1 {
> 			first-lane = <1>;
> 
> 			sgmii {
> 				fsl,pccr = <0x8>;
> 				fsl,idx = <2>;
> 				fsl,cfg = <1>;
> 				fsl,proto = "sgmii";
> 				// or PHY_TYPE_SGMII
> 			};
> 
> 			qsgmii {
> 				...
> 			};
> 
> 			xfi {
> 				...
> 			};
> 		};
> 	};
> 
> and this way you could have something like a fsl,reserved property to
> deal with not-yet-supported lanes. And this could be added piecemeal by
> board configs.

Does this sound good? I would like to start working on v4 of this series,
and reworking the binding will be a big part of that. Am I heading in the
right direction? This seems to be a more common approach (e.g. mediatek,tphy).

--Sean