2022-10-17 20:30:55

by Sean Anderson

[permalink] [raw]
Subject: [PATCH net-next v7 00/10] net: dpaa: Convert to phylink

This series converts the DPAA driver to phylink.

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 2 for details.

All mac drivers have now been converted. I would greatly appreciate if
anyone has T-series or P-series boards they can test/debug this series
on. I only have an LS1046ARDB. Everything but QSGMII should work without
breakage; QSGMII needs patches 7 and 8. For this reason, the last 4
patches in this series should be applied together (and should not go
through separate trees).

Changes in v7:
- provide phylink_validate_mask_caps() helper
- Fix oops if memac_pcs_create returned -EPROBE_DEFER
- Fix using pcs-names instead of pcs-handle-names
- Fix not checking for -ENODATA when looking for sgmii pcs
- Fix 81-character line
- Simplify memac_validate with phylink_validate_mask_caps

Changes in v6:
- Remove unnecessary $ref from renesas,rzn1-a5psw
- Remove unnecessary type from pcs-handle-names
- Add maxItems to pcs-handle
- Fix 81-character line
- Fix uninitialized variable in dtsec_mac_config

Changes in v5:
- Add Lynx PCS binding

Changes in v4:
- Use pcs-handle-names instead of pcs-names, as discussed
- Don't fail if phy support was not compiled in
- Split off rate adaptation series
- Split off DPAA "preparation" series
- Split off Lynx 10G support
- t208x: Mark MAC1 and MAC2 as 10G
- Add XFI PCS for t208x MAC1/MAC2

Changes in v3:
- Expand pcs-handle to an array
- 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
- 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

Changes in v2:
- Better document how we select which PCS to use in the default case
- 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

Russell King (Oracle) (1):
net: phylink: provide phylink_validate_mask_caps() helper

Sean Anderson (9):
dt-bindings: net: Expand pcs-handle to an array
dt-bindings: net: Add Lynx PCS binding
dt-bindings: net: fman: Add additional interface properties
net: fman: memac: Add serdes support
net: fman: memac: Use lynx pcs driver
net: dpaa: Convert to phylink
powerpc: dts: t208x: Mark MAC1 and MAC2 as 10G
powerpc: dts: qoriq: Add nodes for QSGMII PCSs
arm64: dts: layerscape: Add nodes for QSGMII PCSs

.../bindings/net/dsa/renesas,rzn1-a5psw.yaml | 2 +-
.../bindings/net/ethernet-controller.yaml | 11 +-
.../bindings/net/fsl,fman-dtsec.yaml | 53 +-
.../bindings/net/fsl,qoriq-mc-dpmac.yaml | 2 +-
.../devicetree/bindings/net/fsl-fman.txt | 5 +-
.../bindings/net/pcs/fsl,lynx-pcs.yaml | 40 +
.../boot/dts/freescale/fsl-ls1043-post.dtsi | 24 +
.../boot/dts/freescale/fsl-ls1046-post.dtsi | 25 +
.../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-10g-2.dtsi | 45 ++
.../boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi | 45 ++
.../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 +-
arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 4 +-
drivers/net/ethernet/freescale/dpaa/Kconfig | 4 +-
.../net/ethernet/freescale/dpaa/dpaa_eth.c | 89 +--
.../ethernet/freescale/dpaa/dpaa_ethtool.c | 90 +--
drivers/net/ethernet/freescale/fman/Kconfig | 4 +-
.../net/ethernet/freescale/fman/fman_dtsec.c | 460 +++++------
.../net/ethernet/freescale/fman/fman_mac.h | 10 -
.../net/ethernet/freescale/fman/fman_memac.c | 744 +++++++++---------
.../net/ethernet/freescale/fman/fman_tgec.c | 131 ++-
drivers/net/ethernet/freescale/fman/mac.c | 168 +---
drivers/net/ethernet/freescale/fman/mac.h | 23 +-
drivers/net/phy/phylink.c | 43 +-
include/linux/phylink.h | 3 +
41 files changed, 1106 insertions(+), 1064 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/pcs/fsl,lynx-pcs.yaml
create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi

--
2.35.1.1320.gc452695387.dirty


2022-10-17 20:30:55

by Sean Anderson

[permalink] [raw]
Subject: [PATCH net-next v7 01/10] dt-bindings: net: Expand pcs-handle to an array

This allows multiple phandles to be specified for pcs-handle, such as
when multiple PCSs are present for a single MAC. To differentiate
between them, also add a pcs-handle-names property.

Signed-off-by: Sean Anderson <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
---
This was previously submitted as [1]. I expect to update this series
more, so I have moved it here. Changes from that version include:
- Add maxItems to existing bindings
- Add a dependency from pcs-names to pcs-handle.

[1] https://lore.kernel.org/netdev/[email protected]/

(no changes since v6)

Changes in v6:
- Remove unnecessary $ref from renesas,rzn1-a5psw
- Remove unnecessary type from pcs-handle-names
- Add maxItems to pcs-handle

Changes in v4:
- Use pcs-handle-names instead of pcs-names, as discussed

Changes in v3:
- New

.../bindings/net/dsa/renesas,rzn1-a5psw.yaml | 2 +-
.../devicetree/bindings/net/ethernet-controller.yaml | 11 ++++++++++-
.../devicetree/bindings/net/fsl,qoriq-mc-dpmac.yaml | 2 +-
3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
index 7ca9c19a157c..0a0d62b6c00e 100644
--- a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
@@ -74,10 +74,10 @@ properties:

properties:
pcs-handle:
+ maxItems: 1
description:
phandle pointing to a PCS sub-node compatible with
renesas,rzn1-miic.yaml#
- $ref: /schemas/types.yaml#/definitions/phandle

unevaluatedProperties: false

diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
index 4b3c590fcebf..3aef506fa158 100644
--- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml
+++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
@@ -108,11 +108,17 @@ properties:
$ref: "#/properties/phy-connection-type"

pcs-handle:
- $ref: /schemas/types.yaml#/definitions/phandle
+ $ref: /schemas/types.yaml#/definitions/phandle-array
+ items:
+ maxItems: 1
description:
Specifies a reference to a node representing a PCS PHY device on a MDIO
bus to link with an external PHY (phy-handle) if exists.

+ pcs-handle-names:
+ description:
+ The name of each PCS in pcs-handle.
+
phy-handle:
$ref: /schemas/types.yaml#/definitions/phandle
description:
@@ -216,6 +222,9 @@ properties:
required:
- speed

+dependencies:
+ pcs-handle-names: [pcs-handle]
+
allOf:
- if:
properties:
diff --git a/Documentation/devicetree/bindings/net/fsl,qoriq-mc-dpmac.yaml b/Documentation/devicetree/bindings/net/fsl,qoriq-mc-dpmac.yaml
index 7f620a71a972..600240281e8c 100644
--- a/Documentation/devicetree/bindings/net/fsl,qoriq-mc-dpmac.yaml
+++ b/Documentation/devicetree/bindings/net/fsl,qoriq-mc-dpmac.yaml
@@ -31,7 +31,7 @@ properties:
phy-mode: true

pcs-handle:
- $ref: /schemas/types.yaml#/definitions/phandle
+ maxItems: 1
description:
A reference to a node representing a PCS PHY device found on
the internal MDIO bus.
--
2.35.1.1320.gc452695387.dirty

2022-10-17 20:50:15

by Sean Anderson

[permalink] [raw]
Subject: [PATCH net-next v7 10/10] arm64: dts: layerscape: Add nodes for QSGMII PCSs

Now that we actually read registers from QSGMII PCSs, it's important
that we have the correct address (instead of hoping that we're the MAC
with all the QSGMII PCSs on its bus). This adds nodes for the QSGMII
PCSs. The exact mapping of QSGMII to MACs depends on the SoC.

Since the first QSGMII PCSs share an address with the SGMII and XFI
PCSs, we only add new nodes for PCSs 2-4. This avoids address conflicts
on the bus.

Signed-off-by: Sean Anderson <[email protected]>
---

(no changes since v3)

Changes in v3:
- Split this patch off from the previous one

Changes in v2:
- New

.../boot/dts/freescale/fsl-ls1043-post.dtsi | 24 ++++++++++++++++++
.../boot/dts/freescale/fsl-ls1046-post.dtsi | 25 +++++++++++++++++++
2 files changed, 49 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi
index d237162a8744..5c4d7eef8b61 100644
--- a/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi
+++ b/arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi
@@ -24,9 +24,12 @@ &fman0 {

/* these aliases provide the FMan ports mapping */
enet0: ethernet@e0000 {
+ pcs-handle-names = "qsgmii";
};

enet1: ethernet@e2000 {
+ pcsphy-handle = <&pcsphy1>, <&qsgmiib_pcs1>;
+ pcs-handle-names = "sgmii", "qsgmii";
};

enet2: ethernet@e4000 {
@@ -36,11 +39,32 @@ enet3: ethernet@e6000 {
};

enet4: ethernet@e8000 {
+ pcsphy-handle = <&pcsphy4>, <&qsgmiib_pcs2>;
+ pcs-handle-names = "sgmii", "qsgmii";
};

enet5: ethernet@ea000 {
+ pcsphy-handle = <&pcsphy5>, <&qsgmiib_pcs3>;
+ pcs-handle-names = "sgmii", "qsgmii";
};

enet6: ethernet@f0000 {
};
+
+ mdio@e1000 {
+ qsgmiib_pcs1: ethernet-pcs@1 {
+ compatible = "fsl,lynx-pcs";
+ reg = <0x1>;
+ };
+
+ qsgmiib_pcs2: ethernet-pcs@2 {
+ compatible = "fsl,lynx-pcs";
+ reg = <0x2>;
+ };
+
+ qsgmiib_pcs3: ethernet-pcs@3 {
+ compatible = "fsl,lynx-pcs";
+ reg = <0x3>;
+ };
+ };
};
diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi
index d6caaea57d90..4e3345093943 100644
--- a/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi
+++ b/arch/arm64/boot/dts/freescale/fsl-ls1046-post.dtsi
@@ -23,6 +23,8 @@ &soc {
&fman0 {
/* these aliases provide the FMan ports mapping */
enet0: ethernet@e0000 {
+ pcsphy-handle = <&qsgmiib_pcs3>;
+ pcs-handle-names = "qsgmii";
};

enet1: ethernet@e2000 {
@@ -35,14 +37,37 @@ enet3: ethernet@e6000 {
};

enet4: ethernet@e8000 {
+ pcsphy-handle = <&pcsphy4>, <&qsgmiib_pcs1>;
+ pcs-handle-names = "sgmii", "qsgmii";
};

enet5: ethernet@ea000 {
+ pcsphy-handle = <&pcsphy5>, <&pcsphy5>;
+ pcs-handle-names = "sgmii", "qsgmii";
};

enet6: ethernet@f0000 {
};

enet7: ethernet@f2000 {
+ pcsphy-handle = <&pcsphy7>, <&qsgmiib_pcs2>, <&pcsphy7>;
+ pcs-handle-names = "sgmii", "qsgmii", "xfi";
+ };
+
+ mdio@eb000 {
+ qsgmiib_pcs1: ethernet-pcs@1 {
+ compatible = "fsl,lynx-pcs";
+ reg = <0x1>;
+ };
+
+ qsgmiib_pcs2: ethernet-pcs@2 {
+ compatible = "fsl,lynx-pcs";
+ reg = <0x2>;
+ };
+
+ qsgmiib_pcs3: ethernet-pcs@3 {
+ compatible = "fsl,lynx-pcs";
+ reg = <0x3>;
+ };
};
};
--
2.35.1.1320.gc452695387.dirty

2022-10-17 20:56:02

by Sean Anderson

[permalink] [raw]
Subject: [PATCH net-next v7 06/10] net: fman: memac: Use lynx pcs driver

Although not stated in the datasheet, as far as I can tell PCS for mEMACs
is a "Lynx." By reusing the existing driver, we can remove the PCS
management code from the memac driver. This requires calling some PCS
functions manually which phylink would usually do for us, but we will let
it do that soon.

One problem is that we don't actually have a PCS for QSGMII. We pretend
that each mEMAC's MDIO bus has four QSGMII PCSs, but this is not the case.
Only the "base" mEMAC's MDIO bus has the four QSGMII PCSs. This is not an
issue yet, because we never get the PCS state. However, it will be once the
conversion to phylink is complete, since the links will appear to never
come up. To get around this, we allow specifying multiple PCSs in pcsphy.
This breaks backwards compatibility with old device trees, but only for
QSGMII. IMO this is the only reasonable way to figure out what the actual
QSGMII PCS is.

Additionally, we now also support a separate XFI PCS. This can allow the
SerDes driver to set different addresses for the SGMII and XFI PCSs so they
can be accessed at the same time.

Signed-off-by: Sean Anderson <[email protected]>
---

Changes in v7:
- Fix oops if memac_pcs_create returned -EPROBE_DEFER
- Fix using pcs-names instead of pcs-handle-names
- Fix not checking for -ENODATA when looking for sgmii pcs

Changes in v6:
- Fix 81-character line

Changes in v3:
- Put the PCS mdiodev only after we are done with it (since the PCS
does not perform a get itself).

Changes in v2:
- Move PCS_LYNX dependency to fman Kconfig

drivers/net/ethernet/freescale/fman/Kconfig | 3 +
.../net/ethernet/freescale/fman/fman_memac.c | 258 +++++++-----------
2 files changed, 105 insertions(+), 156 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig
index 48bf8088795d..8f5637db41dd 100644
--- a/drivers/net/ethernet/freescale/fman/Kconfig
+++ b/drivers/net/ethernet/freescale/fman/Kconfig
@@ -4,6 +4,9 @@ config FSL_FMAN
depends on FSL_SOC || ARCH_LAYERSCAPE || COMPILE_TEST
select GENERIC_ALLOCATOR
select PHYLIB
+ select PHYLINK
+ select PCS
+ select PCS_LYNX
select CRC32
default n
help
diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c
index 56a29f505590..43584946cae2 100644
--- a/drivers/net/ethernet/freescale/fman/fman_memac.c
+++ b/drivers/net/ethernet/freescale/fman/fman_memac.c
@@ -11,43 +11,12 @@

#include <linux/slab.h>
#include <linux/io.h>
+#include <linux/pcs-lynx.h>
#include <linux/phy.h>
#include <linux/phy_fixed.h>
#include <linux/phy/phy.h>
#include <linux/of_mdio.h>

-/* PCS registers */
-#define MDIO_SGMII_CR 0x00
-#define MDIO_SGMII_DEV_ABIL_SGMII 0x04
-#define MDIO_SGMII_LINK_TMR_L 0x12
-#define MDIO_SGMII_LINK_TMR_H 0x13
-#define MDIO_SGMII_IF_MODE 0x14
-
-/* SGMII Control defines */
-#define SGMII_CR_AN_EN 0x1000
-#define SGMII_CR_RESTART_AN 0x0200
-#define SGMII_CR_FD 0x0100
-#define SGMII_CR_SPEED_SEL1_1G 0x0040
-#define SGMII_CR_DEF_VAL (SGMII_CR_AN_EN | SGMII_CR_FD | \
- SGMII_CR_SPEED_SEL1_1G)
-
-/* SGMII Device Ability for SGMII defines */
-#define MDIO_SGMII_DEV_ABIL_SGMII_MODE 0x4001
-#define MDIO_SGMII_DEV_ABIL_BASEX_MODE 0x01A0
-
-/* Link timer define */
-#define LINK_TMR_L 0xa120
-#define LINK_TMR_H 0x0007
-#define LINK_TMR_L_BASEX 0xaf08
-#define LINK_TMR_H_BASEX 0x002f
-
-/* SGMII IF Mode defines */
-#define IF_MODE_USE_SGMII_AN 0x0002
-#define IF_MODE_SGMII_EN 0x0001
-#define IF_MODE_SGMII_SPEED_100M 0x0004
-#define IF_MODE_SGMII_SPEED_1G 0x0008
-#define IF_MODE_SGMII_DUPLEX_HALF 0x0010
-
/* Num of additional exact match MAC adr regs */
#define MEMAC_NUM_OF_PADDRS 7

@@ -326,7 +295,9 @@ struct fman_mac {
struct fman_rev_info fm_rev_info;
bool basex_if;
struct phy *serdes;
- struct phy_device *pcsphy;
+ struct phylink_pcs *sgmii_pcs;
+ struct phylink_pcs *qsgmii_pcs;
+ struct phylink_pcs *xfi_pcs;
bool allmulti_enabled;
};

@@ -487,91 +458,22 @@ static u32 get_mac_addr_hash_code(u64 eth_addr)
return xor_val;
}

-static void setup_sgmii_internal_phy(struct fman_mac *memac,
- struct fixed_phy_status *fixed_link)
+static void setup_sgmii_internal(struct fman_mac *memac,
+ struct phylink_pcs *pcs,
+ struct fixed_phy_status *fixed_link)
{
- u16 tmp_reg16;
-
- if (WARN_ON(!memac->pcsphy))
- return;
-
- /* SGMII mode */
- tmp_reg16 = IF_MODE_SGMII_EN;
- if (!fixed_link)
- /* AN enable */
- tmp_reg16 |= IF_MODE_USE_SGMII_AN;
- else {
- switch (fixed_link->speed) {
- case 10:
- /* For 10M: IF_MODE[SPEED_10M] = 0 */
- break;
- case 100:
- tmp_reg16 |= IF_MODE_SGMII_SPEED_100M;
- break;
- case 1000:
- default:
- tmp_reg16 |= IF_MODE_SGMII_SPEED_1G;
- break;
- }
- if (!fixed_link->duplex)
- tmp_reg16 |= IF_MODE_SGMII_DUPLEX_HALF;
- }
- phy_write(memac->pcsphy, MDIO_SGMII_IF_MODE, tmp_reg16);
-
- /* Device ability according to SGMII specification */
- tmp_reg16 = MDIO_SGMII_DEV_ABIL_SGMII_MODE;
- phy_write(memac->pcsphy, MDIO_SGMII_DEV_ABIL_SGMII, tmp_reg16);
-
- /* Adjust link timer for SGMII -
- * According to Cisco SGMII specification the timer should be 1.6 ms.
- * The link_timer register is configured in units of the clock.
- * - When running as 1G SGMII, Serdes clock is 125 MHz, so
- * unit = 1 / (125*10^6 Hz) = 8 ns.
- * 1.6 ms in units of 8 ns = 1.6ms / 8ns = 2*10^5 = 0x30d40
- * - When running as 2.5G SGMII, Serdes clock is 312.5 MHz, so
- * unit = 1 / (312.5*10^6 Hz) = 3.2 ns.
- * 1.6 ms in units of 3.2 ns = 1.6ms / 3.2ns = 5*10^5 = 0x7a120.
- * Since link_timer value of 1G SGMII will be too short for 2.5 SGMII,
- * we always set up here a value of 2.5 SGMII.
- */
- phy_write(memac->pcsphy, MDIO_SGMII_LINK_TMR_H, LINK_TMR_H);
- phy_write(memac->pcsphy, MDIO_SGMII_LINK_TMR_L, LINK_TMR_L);
-
- if (!fixed_link)
- /* Restart AN */
- tmp_reg16 = SGMII_CR_DEF_VAL | SGMII_CR_RESTART_AN;
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
+ phy_interface_t iface = memac->basex_if ? PHY_INTERFACE_MODE_1000BASEX :
+ PHY_INTERFACE_MODE_SGMII;
+ unsigned int mode = fixed_link ? MLO_AN_FIXED : MLO_AN_INBAND;
+
+ linkmode_set_pause(advertising, true, true);
+ pcs->ops->pcs_config(pcs, mode, iface, advertising, true);
+ if (fixed_link)
+ pcs->ops->pcs_link_up(pcs, mode, iface, fixed_link->speed,
+ fixed_link->duplex);
else
- /* AN disabled */
- tmp_reg16 = SGMII_CR_DEF_VAL & ~SGMII_CR_AN_EN;
- phy_write(memac->pcsphy, 0x0, tmp_reg16);
-}
-
-static void setup_sgmii_internal_phy_base_x(struct fman_mac *memac)
-{
- u16 tmp_reg16;
-
- /* AN Device capability */
- tmp_reg16 = MDIO_SGMII_DEV_ABIL_BASEX_MODE;
- phy_write(memac->pcsphy, MDIO_SGMII_DEV_ABIL_SGMII, tmp_reg16);
-
- /* Adjust link timer for SGMII -
- * For Serdes 1000BaseX auto-negotiation the timer should be 10 ms.
- * The link_timer register is configured in units of the clock.
- * - When running as 1G SGMII, Serdes clock is 125 MHz, so
- * unit = 1 / (125*10^6 Hz) = 8 ns.
- * 10 ms in units of 8 ns = 10ms / 8ns = 1250000 = 0x1312d0
- * - When running as 2.5G SGMII, Serdes clock is 312.5 MHz, so
- * unit = 1 / (312.5*10^6 Hz) = 3.2 ns.
- * 10 ms in units of 3.2 ns = 10ms / 3.2ns = 3125000 = 0x2faf08.
- * Since link_timer value of 1G SGMII will be too short for 2.5 SGMII,
- * we always set up here a value of 2.5 SGMII.
- */
- phy_write(memac->pcsphy, MDIO_SGMII_LINK_TMR_H, LINK_TMR_H_BASEX);
- phy_write(memac->pcsphy, MDIO_SGMII_LINK_TMR_L, LINK_TMR_L_BASEX);
-
- /* Restart AN */
- tmp_reg16 = SGMII_CR_DEF_VAL | SGMII_CR_RESTART_AN;
- phy_write(memac->pcsphy, 0x0, tmp_reg16);
+ pcs->ops->pcs_an_restart(pcs);
}

static int check_init_parameters(struct fman_mac *memac)
@@ -983,7 +885,6 @@ static int memac_set_exception(struct fman_mac *memac,
static int memac_init(struct fman_mac *memac)
{
struct memac_cfg *memac_drv_param;
- u8 i;
enet_addr_t eth_addr;
bool slow_10g_if = false;
struct fixed_phy_status *fixed_link = NULL;
@@ -1036,32 +937,10 @@ static int memac_init(struct fman_mac *memac)
iowrite32be(reg32, &memac->regs->command_config);
}

- if (memac->phy_if == PHY_INTERFACE_MODE_SGMII) {
- /* Configure internal SGMII PHY */
- if (memac->basex_if)
- setup_sgmii_internal_phy_base_x(memac);
- else
- setup_sgmii_internal_phy(memac, fixed_link);
- } else if (memac->phy_if == PHY_INTERFACE_MODE_QSGMII) {
- /* Configure 4 internal SGMII PHYs */
- for (i = 0; i < 4; i++) {
- u8 qsmgii_phy_addr, phy_addr;
- /* QSGMII PHY address occupies 3 upper bits of 5-bit
- * phy_address; the lower 2 bits are used to extend
- * register address space and access each one of 4
- * ports inside QSGMII.
- */
- phy_addr = memac->pcsphy->mdio.addr;
- qsmgii_phy_addr = (u8)((phy_addr << 2) | i);
- memac->pcsphy->mdio.addr = qsmgii_phy_addr;
- if (memac->basex_if)
- setup_sgmii_internal_phy_base_x(memac);
- else
- setup_sgmii_internal_phy(memac, fixed_link);
-
- memac->pcsphy->mdio.addr = phy_addr;
- }
- }
+ if (memac->phy_if == PHY_INTERFACE_MODE_SGMII)
+ setup_sgmii_internal(memac, memac->sgmii_pcs, fixed_link);
+ else if (memac->phy_if == PHY_INTERFACE_MODE_QSGMII)
+ setup_sgmii_internal(memac, memac->qsgmii_pcs, fixed_link);

/* Max Frame Length */
err = fman_set_mac_max_frame(memac->fm, memac->mac_id,
@@ -1097,12 +976,25 @@ static int memac_init(struct fman_mac *memac)
return 0;
}

+static void pcs_put(struct phylink_pcs *pcs)
+{
+ struct mdio_device *mdiodev;
+
+ if (IS_ERR_OR_NULL(pcs))
+ return;
+
+ mdiodev = lynx_get_mdio_device(pcs);
+ lynx_pcs_destroy(pcs);
+ mdio_device_free(mdiodev);
+}
+
static int memac_free(struct fman_mac *memac)
{
free_init_resources(memac);

- if (memac->pcsphy)
- put_device(&memac->pcsphy->mdio.dev);
+ pcs_put(memac->sgmii_pcs);
+ pcs_put(memac->qsgmii_pcs);
+ pcs_put(memac->xfi_pcs);

kfree(memac->memac_drv_param);
kfree(memac);
@@ -1153,12 +1045,31 @@ static struct fman_mac *memac_config(struct mac_device *mac_dev,
return memac;
}

+static struct phylink_pcs *memac_pcs_create(struct device_node *mac_node,
+ int index)
+{
+ struct device_node *node;
+ struct mdio_device *mdiodev = NULL;
+ struct phylink_pcs *pcs;
+
+ node = of_parse_phandle(mac_node, "pcsphy-handle", index);
+ if (node && of_device_is_available(node))
+ mdiodev = of_mdio_find_device(node);
+ of_node_put(node);
+
+ if (!mdiodev)
+ return ERR_PTR(-EPROBE_DEFER);
+
+ pcs = lynx_pcs_create(mdiodev);
+ return pcs;
+}
+
int memac_initialization(struct mac_device *mac_dev,
struct device_node *mac_node,
struct fman_mac_params *params)
{
int err;
- struct device_node *phy_node;
+ struct phylink_pcs *pcs;
struct fixed_phy_status *fixed_link;
struct fman_mac *memac;

@@ -1188,23 +1099,58 @@ int memac_initialization(struct mac_device *mac_dev,
memac = mac_dev->fman_mac;
memac->memac_drv_param->max_frame_length = fman_get_max_frm();
memac->memac_drv_param->reset_on_init = true;
- if (memac->phy_if == PHY_INTERFACE_MODE_SGMII ||
- memac->phy_if == PHY_INTERFACE_MODE_QSGMII) {
- phy_node = of_parse_phandle(mac_node, "pcsphy-handle", 0);
- if (!phy_node) {
- pr_err("PCS PHY node is not available\n");
- err = -EINVAL;
+
+ err = of_property_match_string(mac_node, "pcs-handle-names", "xfi");
+ if (err >= 0) {
+ memac->xfi_pcs = memac_pcs_create(mac_node, err);
+ if (IS_ERR(memac->xfi_pcs)) {
+ err = PTR_ERR(memac->xfi_pcs);
+ dev_err_probe(mac_dev->dev, err, "missing xfi pcs\n");
goto _return_fm_mac_free;
}
+ } else if (err != -EINVAL && err != -ENODATA) {
+ goto _return_fm_mac_free;
+ }

- memac->pcsphy = of_phy_find_device(phy_node);
- if (!memac->pcsphy) {
- pr_err("of_phy_find_device (PCS PHY) failed\n");
- err = -EINVAL;
+ err = of_property_match_string(mac_node, "pcs-handle-names", "qsgmii");
+ if (err >= 0) {
+ memac->qsgmii_pcs = memac_pcs_create(mac_node, err);
+ if (IS_ERR(memac->qsgmii_pcs)) {
+ err = PTR_ERR(memac->qsgmii_pcs);
+ dev_err_probe(mac_dev->dev, err,
+ "missing qsgmii pcs\n");
goto _return_fm_mac_free;
}
+ } else if (err != -EINVAL && err != -ENODATA) {
+ goto _return_fm_mac_free;
+ }
+
+ /* For compatibility, if pcs-handle-names is missing, we assume this
+ * phy is the first one in pcsphy-handle
+ */
+ err = of_property_match_string(mac_node, "pcs-handle-names", "sgmii");
+ if (err == -EINVAL || err == -ENODATA)
+ pcs = memac_pcs_create(mac_node, 0);
+ else if (err < 0)
+ goto _return_fm_mac_free;
+ else
+ pcs = memac_pcs_create(mac_node, err);
+
+ if (!pcs) {
+ dev_err(mac_dev->dev, "missing pcs\n");
+ err = -ENOENT;
+ goto _return_fm_mac_free;
}

+ /* If err is set here, it means that pcs-handle-names was missing above
+ * (and therefore that xfi_pcs cannot be set). If we are defaulting to
+ * XGMII, assume this is for XFI. Otherwise, assume it is for SGMII.
+ */
+ if (err && mac_dev->phy_if == PHY_INTERFACE_MODE_XGMII)
+ memac->xfi_pcs = pcs;
+ else
+ memac->sgmii_pcs = pcs;
+
memac->serdes = devm_of_phy_get(mac_dev->dev, mac_node, "serdes");
err = PTR_ERR(memac->serdes);
if (err == -ENODEV || err == -ENOSYS) {
--
2.35.1.1320.gc452695387.dirty

2022-10-17 20:56:34

by Sean Anderson

[permalink] [raw]
Subject: [PATCH net-next v7 02/10] dt-bindings: net: Add Lynx PCS binding

This binding is fairly bare-bones for now, since the Lynx driver doesn't
parse any properties (or match based on the compatible). We just need it
in order to prevent the PCS nodes from having phy devices attached to
them. This is not really a problem, but it is a bit inefficient.

This binding is really for three separate PCSs (SGMII, QSGMII, and XFI).
However, the driver treats all of them the same. This works because the
SGMII and XFI devices typically use the same address, and the SerDes
driver (or RCW) muxes between them. The QSGMII PCSs have the same
register layout as the SGMII PCSs. To do things properly, we'd probably
do something like

ethernet-pcs@0 {
#pcs-cells = <1>;
compatible = "fsl,lynx-pcs";
reg = <0>, <1>, <2>, <3>;
};

but that would add complexity, and we can describe the hardware just
fine using separate PCSs for now.

Signed-off-by: Sean Anderson <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
---

(no changes since v5)

Changes in v5:
- New

.../bindings/net/pcs/fsl,lynx-pcs.yaml | 40 +++++++++++++++++++
1 file changed, 40 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/pcs/fsl,lynx-pcs.yaml

diff --git a/Documentation/devicetree/bindings/net/pcs/fsl,lynx-pcs.yaml b/Documentation/devicetree/bindings/net/pcs/fsl,lynx-pcs.yaml
new file mode 100644
index 000000000000..fbedf696c555
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/pcs/fsl,lynx-pcs.yaml
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/pcs/fsl,lynx-pcs.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP Lynx PCS
+
+maintainers:
+ - Ioana Ciornei <[email protected]>
+
+description: |
+ NXP Lynx 10G and 28G SerDes have Ethernet PCS devices which can be used as
+ protocol controllers. They are accessible over the Ethernet interface's MDIO
+ bus.
+
+properties:
+ compatible:
+ const: fsl,lynx-pcs
+
+ reg:
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+
+additionalProperties: false
+
+examples:
+ - |
+ mdio-bus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ qsgmii_pcs1: ethernet-pcs@1 {
+ compatible = "fsl,lynx-pcs";
+ reg = <1>;
+ };
+ };
--
2.35.1.1320.gc452695387.dirty

2022-10-17 21:04:30

by Sean Anderson

[permalink] [raw]
Subject: [PATCH net-next v7 09/10] powerpc: dts: qoriq: Add nodes for QSGMII PCSs

Now that we actually read registers from QSGMII PCSs, it's important
that we have the correct address (instead of hoping that we're the MAC
with all the QSGMII PCSs on its bus). This adds nodes for the QSGMII
PCSs. They have the same addresses on all SoCs (e.g. if QSGMIIA is
present it's used for MACs 1 through 4).

Since the first QSGMII PCSs share an address with the SGMII and XFI
PCSs, we only add new nodes for PCSs 2-4. This avoids address conflicts
on the bus.

Signed-off-by: Sean Anderson <[email protected]>
---

(no changes since v4)

Changes in v4:
- Add XFI PCS for t208x MAC1/MAC2

Changes in v3:
- Add compatibles for QSGMII PCSs
- Split arm and powerpcs dts updates

Changes in v2:
- New

.../boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi | 3 ++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi | 10 +++++++++-
.../boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi | 10 +++++++++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi | 10 +++++++++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi | 3 ++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi | 3 ++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi | 3 ++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi | 10 +++++++++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi | 10 +++++++++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi | 10 +++++++++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi | 3 ++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi | 10 +++++++++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi | 10 +++++++++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi | 10 +++++++++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi | 3 ++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi | 10 +++++++++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi | 10 +++++++++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi | 10 +++++++++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi | 3 ++-
arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi | 10 +++++++++-
20 files changed, 131 insertions(+), 20 deletions(-)

diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi
index baa0c503e741..7e70977f282a 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi
@@ -55,7 +55,8 @@ ethernet@e0000 {
reg = <0xe0000 0x1000>;
fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>;
ptp-timer = <&ptp_timer0>;
- pcsphy-handle = <&pcsphy0>;
+ pcsphy-handle = <&pcsphy0>, <&pcsphy0>;
+ pcs-handle-names = "sgmii", "qsgmii";
};

mdio@e1000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi
index 93095600e808..5f89f7c1761f 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi
@@ -52,7 +52,15 @@ ethernet@f0000 {
compatible = "fsl,fman-memac";
reg = <0xf0000 0x1000>;
fsl,fman-ports = <&fman0_rx_0x10 &fman0_tx_0x30>;
- pcsphy-handle = <&pcsphy6>;
+ pcsphy-handle = <&pcsphy6>, <&qsgmiib_pcs2>, <&pcsphy6>;
+ pcs-handle-names = "sgmii", "qsgmii", "xfi";
+ };
+
+ mdio@e9000 {
+ qsgmiib_pcs2: ethernet-pcs@2 {
+ compatible = "fsl,lynx-pcs";
+ reg = <2>;
+ };
};

mdio@f1000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi
index ff4bd38f0645..71eb75e82c2e 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi
@@ -55,7 +55,15 @@ ethernet@e2000 {
reg = <0xe2000 0x1000>;
fsl,fman-ports = <&fman0_rx_0x09 &fman0_tx_0x29>;
ptp-timer = <&ptp_timer0>;
- pcsphy-handle = <&pcsphy1>;
+ pcsphy-handle = <&pcsphy1>, <&qsgmiia_pcs1>;
+ pcs-handle-names = "sgmii", "qsgmii";
+ };
+
+ mdio@e1000 {
+ qsgmiia_pcs1: ethernet-pcs@1 {
+ compatible = "fsl,lynx-pcs";
+ reg = <1>;
+ };
};

mdio@e3000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi
index 1fa38ed6f59e..fb7032ddb7fc 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi
@@ -52,7 +52,15 @@ ethernet@f2000 {
compatible = "fsl,fman-memac";
reg = <0xf2000 0x1000>;
fsl,fman-ports = <&fman0_rx_0x11 &fman0_tx_0x31>;
- pcsphy-handle = <&pcsphy7>;
+ pcsphy-handle = <&pcsphy7>, <&qsgmiib_pcs3>, <&pcsphy7>;
+ pcs-handle-names = "sgmii", "qsgmii", "xfi";
+ };
+
+ mdio@e9000 {
+ qsgmiib_pcs3: ethernet-pcs@3 {
+ compatible = "fsl,lynx-pcs";
+ reg = <3>;
+ };
};

mdio@f3000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
index 437dab3fc017..6b3609574b0f 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
@@ -27,7 +27,8 @@ ethernet@e0000 {
reg = <0xe0000 0x1000>;
fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>;
ptp-timer = <&ptp_timer0>;
- pcsphy-handle = <&pcsphy0>;
+ pcsphy-handle = <&pcsphy0>, <&pcsphy0>;
+ pcs-handle-names = "sgmii", "xfi";
};

mdio@e1000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
index ad116b17850a..28ed1a85a436 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
@@ -27,7 +27,8 @@ ethernet@e2000 {
reg = <0xe2000 0x1000>;
fsl,fman-ports = <&fman0_rx_0x09 &fman0_tx_0x29>;
ptp-timer = <&ptp_timer0>;
- pcsphy-handle = <&pcsphy1>;
+ pcsphy-handle = <&pcsphy1>, <&pcsphy1>;
+ pcs-handle-names = "sgmii", "xfi";
};

mdio@e3000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi
index a8cc9780c0c4..1089d6861bfb 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi
@@ -51,7 +51,8 @@ ethernet@e0000 {
reg = <0xe0000 0x1000>;
fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>;
ptp-timer = <&ptp_timer0>;
- pcsphy-handle = <&pcsphy0>;
+ pcsphy-handle = <&pcsphy0>, <&pcsphy0>;
+ pcs-handle-names = "sgmii", "qsgmii";
};

mdio@e1000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi
index 8b8bd70c9382..a95bbb4fc827 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi
@@ -51,7 +51,15 @@ ethernet@e2000 {
reg = <0xe2000 0x1000>;
fsl,fman-ports = <&fman0_rx_0x09 &fman0_tx_0x29>;
ptp-timer = <&ptp_timer0>;
- pcsphy-handle = <&pcsphy1>;
+ pcsphy-handle = <&pcsphy1>, <&qsgmiia_pcs1>;
+ pcs-handle-names = "sgmii", "qsgmii";
+ };
+
+ mdio@e1000 {
+ qsgmiia_pcs1: ethernet-pcs@1 {
+ compatible = "fsl,lynx-pcs";
+ reg = <1>;
+ };
};

mdio@e3000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi
index 619c880b54d8..7d5af0147a25 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi
@@ -51,7 +51,15 @@ ethernet@e4000 {
reg = <0xe4000 0x1000>;
fsl,fman-ports = <&fman0_rx_0x0a &fman0_tx_0x2a>;
ptp-timer = <&ptp_timer0>;
- pcsphy-handle = <&pcsphy2>;
+ pcsphy-handle = <&pcsphy2>, <&qsgmiia_pcs2>;
+ pcs-handle-names = "sgmii", "qsgmii";
+ };
+
+ mdio@e1000 {
+ qsgmiia_pcs2: ethernet-pcs@2 {
+ compatible = "fsl,lynx-pcs";
+ reg = <2>;
+ };
};

mdio@e5000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi
index d7ebb73a400d..61e5466ec854 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi
@@ -51,7 +51,15 @@ ethernet@e6000 {
reg = <0xe6000 0x1000>;
fsl,fman-ports = <&fman0_rx_0x0b &fman0_tx_0x2b>;
ptp-timer = <&ptp_timer0>;
- pcsphy-handle = <&pcsphy3>;
+ pcsphy-handle = <&pcsphy3>, <&qsgmiia_pcs3>;
+ pcs-handle-names = "sgmii", "qsgmii";
+ };
+
+ mdio@e1000 {
+ qsgmiia_pcs3: ethernet-pcs@3 {
+ compatible = "fsl,lynx-pcs";
+ reg = <3>;
+ };
};

mdio@e7000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi
index b151d696a069..3ba0cdafc069 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi
@@ -51,7 +51,8 @@ ethernet@e8000 {
reg = <0xe8000 0x1000>;
fsl,fman-ports = <&fman0_rx_0x0c &fman0_tx_0x2c>;
ptp-timer = <&ptp_timer0>;
- pcsphy-handle = <&pcsphy4>;
+ pcsphy-handle = <&pcsphy4>, <&pcsphy4>;
+ pcs-handle-names = "sgmii", "qsgmii";
};

mdio@e9000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi
index adc0ae0013a3..51748de0a289 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi
@@ -51,7 +51,15 @@ ethernet@ea000 {
reg = <0xea000 0x1000>;
fsl,fman-ports = <&fman0_rx_0x0d &fman0_tx_0x2d>;
ptp-timer = <&ptp_timer0>;
- pcsphy-handle = <&pcsphy5>;
+ pcsphy-handle = <&pcsphy5>, <&qsgmiib_pcs1>;
+ pcs-handle-names = "sgmii", "qsgmii";
+ };
+
+ mdio@e9000 {
+ qsgmiib_pcs1: ethernet-pcs@1 {
+ compatible = "fsl,lynx-pcs";
+ reg = <1>;
+ };
};

mdio@eb000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi
index 435047e0e250..ee4f5170f632 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi
@@ -52,7 +52,15 @@ ethernet@f0000 {
compatible = "fsl,fman-memac";
reg = <0xf0000 0x1000>;
fsl,fman-ports = <&fman1_rx_0x10 &fman1_tx_0x30>;
- pcsphy-handle = <&pcsphy14>;
+ pcsphy-handle = <&pcsphy14>, <&qsgmiid_pcs2>, <&pcsphy14>;
+ pcs-handle-names = "sgmii", "qsgmii", "xfi";
+ };
+
+ mdio@e9000 {
+ qsgmiid_pcs2: ethernet-pcs@2 {
+ compatible = "fsl,lynx-pcs";
+ reg = <2>;
+ };
};

mdio@f1000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi
index c098657cca0a..83d2e0ce8f7b 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi
@@ -52,7 +52,15 @@ ethernet@f2000 {
compatible = "fsl,fman-memac";
reg = <0xf2000 0x1000>;
fsl,fman-ports = <&fman1_rx_0x11 &fman1_tx_0x31>;
- pcsphy-handle = <&pcsphy15>;
+ pcsphy-handle = <&pcsphy15>, <&qsgmiid_pcs3>, <&pcsphy15>;
+ pcs-handle-names = "sgmii", "qsgmii", "xfi";
+ };
+
+ mdio@e9000 {
+ qsgmiid_pcs3: ethernet-pcs@3 {
+ compatible = "fsl,lynx-pcs";
+ reg = <3>;
+ };
};

mdio@f3000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi
index 9d06824815f3..3132fc73f133 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi
@@ -51,7 +51,8 @@ ethernet@e0000 {
reg = <0xe0000 0x1000>;
fsl,fman-ports = <&fman1_rx_0x08 &fman1_tx_0x28>;
ptp-timer = <&ptp_timer1>;
- pcsphy-handle = <&pcsphy8>;
+ pcsphy-handle = <&pcsphy8>, <&pcsphy8>;
+ pcs-handle-names = "sgmii", "qsgmii";
};

mdio@e1000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi
index 70e947730c4b..75e904d96602 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi
@@ -51,7 +51,15 @@ ethernet@e2000 {
reg = <0xe2000 0x1000>;
fsl,fman-ports = <&fman1_rx_0x09 &fman1_tx_0x29>;
ptp-timer = <&ptp_timer1>;
- pcsphy-handle = <&pcsphy9>;
+ pcsphy-handle = <&pcsphy9>, <&qsgmiic_pcs1>;
+ pcs-handle-names = "sgmii", "qsgmii";
+ };
+
+ mdio@e1000 {
+ qsgmiic_pcs1: ethernet-pcs@1 {
+ compatible = "fsl,lynx-pcs";
+ reg = <1>;
+ };
};

mdio@e3000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi
index ad96e6529595..69f2cc7b8f19 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi
@@ -51,7 +51,15 @@ ethernet@e4000 {
reg = <0xe4000 0x1000>;
fsl,fman-ports = <&fman1_rx_0x0a &fman1_tx_0x2a>;
ptp-timer = <&ptp_timer1>;
- pcsphy-handle = <&pcsphy10>;
+ pcsphy-handle = <&pcsphy10>, <&qsgmiic_pcs2>;
+ pcs-handle-names = "sgmii", "qsgmii";
+ };
+
+ mdio@e1000 {
+ qsgmiic_pcs2: ethernet-pcs@2 {
+ compatible = "fsl,lynx-pcs";
+ reg = <2>;
+ };
};

mdio@e5000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi
index 034bc4b71f7a..b3aaf01d7da0 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi
@@ -51,7 +51,15 @@ ethernet@e6000 {
reg = <0xe6000 0x1000>;
fsl,fman-ports = <&fman1_rx_0x0b &fman1_tx_0x2b>;
ptp-timer = <&ptp_timer1>;
- pcsphy-handle = <&pcsphy11>;
+ pcsphy-handle = <&pcsphy11>, <&qsgmiic_pcs3>;
+ pcs-handle-names = "sgmii", "qsgmii";
+ };
+
+ mdio@e1000 {
+ qsgmiic_pcs3: ethernet-pcs@3 {
+ compatible = "fsl,lynx-pcs";
+ reg = <3>;
+ };
};

mdio@e7000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi
index 93ca23d82b39..18e020432807 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi
@@ -51,7 +51,8 @@ ethernet@e8000 {
reg = <0xe8000 0x1000>;
fsl,fman-ports = <&fman1_rx_0x0c &fman1_tx_0x2c>;
ptp-timer = <&ptp_timer1>;
- pcsphy-handle = <&pcsphy12>;
+ pcsphy-handle = <&pcsphy12>, <&pcsphy12>;
+ pcs-handle-names = "sgmii", "qsgmii";
};

mdio@e9000 {
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi
index 23b3117a2fd2..55f329d13f19 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi
@@ -51,7 +51,15 @@ ethernet@ea000 {
reg = <0xea000 0x1000>;
fsl,fman-ports = <&fman1_rx_0x0d &fman1_tx_0x2d>;
ptp-timer = <&ptp_timer1>;
- pcsphy-handle = <&pcsphy13>;
+ pcsphy-handle = <&pcsphy13>, <&qsgmiid_pcs1>;
+ pcs-handle-names = "sgmii", "qsgmii";
+ };
+
+ mdio@e9000 {
+ qsgmiid_pcs1: ethernet-pcs@1 {
+ compatible = "fsl,lynx-pcs";
+ reg = <1>;
+ };
};

mdio@eb000 {
--
2.35.1.1320.gc452695387.dirty

2022-10-17 21:08:08

by Sean Anderson

[permalink] [raw]
Subject: [PATCH net-next v7 08/10] powerpc: dts: t208x: Mark MAC1 and MAC2 as 10G

On the T208X SoCs, MAC1 and MAC2 support XGMII. Add some new MAC dtsi
fragments, and mark the QMAN ports as 10G.

Fixes: da414bb923d9 ("powerpc/mpc85xx: Add FSL QorIQ DPAA FMan support to the SoC device tree(s)")
Signed-off-by: Sean Anderson <[email protected]>
---

(no changes since v4)

Changes in v4:
- New

.../boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi | 44 +++++++++++++++++++
.../boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi | 44 +++++++++++++++++++
arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 4 +-
3 files changed, 90 insertions(+), 2 deletions(-)
create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi

diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
new file mode 100644
index 000000000000..437dab3fc017
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
+/*
+ * QorIQ FMan v3 10g port #2 device tree stub [ controller @ offset 0x400000 ]
+ *
+ * Copyright 2022 Sean Anderson <[email protected]>
+ * Copyright 2012 - 2015 Freescale Semiconductor Inc.
+ */
+
+fman@400000 {
+ fman0_rx_0x08: port@88000 {
+ cell-index = <0x8>;
+ compatible = "fsl,fman-v3-port-rx";
+ reg = <0x88000 0x1000>;
+ fsl,fman-10g-port;
+ };
+
+ fman0_tx_0x28: port@a8000 {
+ cell-index = <0x28>;
+ compatible = "fsl,fman-v3-port-tx";
+ reg = <0xa8000 0x1000>;
+ fsl,fman-10g-port;
+ };
+
+ ethernet@e0000 {
+ cell-index = <0>;
+ compatible = "fsl,fman-memac";
+ reg = <0xe0000 0x1000>;
+ fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>;
+ ptp-timer = <&ptp_timer0>;
+ pcsphy-handle = <&pcsphy0>;
+ };
+
+ mdio@e1000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
+ reg = <0xe1000 0x1000>;
+ fsl,erratum-a011043; /* must ignore read errors */
+
+ pcsphy0: ethernet-phy@0 {
+ reg = <0x0>;
+ };
+ };
+};
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
new file mode 100644
index 000000000000..ad116b17850a
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
+/*
+ * QorIQ FMan v3 10g port #3 device tree stub [ controller @ offset 0x400000 ]
+ *
+ * Copyright 2022 Sean Anderson <[email protected]>
+ * Copyright 2012 - 2015 Freescale Semiconductor Inc.
+ */
+
+fman@400000 {
+ fman0_rx_0x09: port@89000 {
+ cell-index = <0x9>;
+ compatible = "fsl,fman-v3-port-rx";
+ reg = <0x89000 0x1000>;
+ fsl,fman-10g-port;
+ };
+
+ fman0_tx_0x29: port@a9000 {
+ cell-index = <0x29>;
+ compatible = "fsl,fman-v3-port-tx";
+ reg = <0xa9000 0x1000>;
+ fsl,fman-10g-port;
+ };
+
+ ethernet@e2000 {
+ cell-index = <1>;
+ compatible = "fsl,fman-memac";
+ reg = <0xe2000 0x1000>;
+ fsl,fman-ports = <&fman0_rx_0x09 &fman0_tx_0x29>;
+ ptp-timer = <&ptp_timer0>;
+ pcsphy-handle = <&pcsphy1>;
+ };
+
+ mdio@e3000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
+ reg = <0xe3000 0x1000>;
+ fsl,erratum-a011043; /* must ignore read errors */
+
+ pcsphy1: ethernet-phy@0 {
+ reg = <0x0>;
+ };
+ };
+};
diff --git a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
index ecbb447920bc..74e17e134387 100644
--- a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
@@ -609,8 +609,8 @@ usb1: usb@211000 {
/include/ "qoriq-bman1.dtsi"

/include/ "qoriq-fman3-0.dtsi"
-/include/ "qoriq-fman3-0-1g-0.dtsi"
-/include/ "qoriq-fman3-0-1g-1.dtsi"
+/include/ "qoriq-fman3-0-10g-2.dtsi"
+/include/ "qoriq-fman3-0-10g-3.dtsi"
/include/ "qoriq-fman3-0-1g-2.dtsi"
/include/ "qoriq-fman3-0-1g-3.dtsi"
/include/ "qoriq-fman3-0-1g-4.dtsi"
--
2.35.1.1320.gc452695387.dirty

2022-10-19 14:40:47

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net-next v7 00/10] net: dpaa: Convert to phylink

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <[email protected]>:

On Mon, 17 Oct 2022 16:22:31 -0400 you wrote:
> This series converts the DPAA driver to phylink.
>
> 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 2 for details.
>
> All mac drivers have now been converted. I would greatly appreciate if
> anyone has T-series or P-series boards they can test/debug this series
> on. I only have an LS1046ARDB. Everything but QSGMII should work without
> breakage; QSGMII needs patches 7 and 8. For this reason, the last 4
> patches in this series should be applied together (and should not go
> through separate trees).
>
> [...]

Here is the summary with links:
- [net-next,v7,01/10] dt-bindings: net: Expand pcs-handle to an array
https://git.kernel.org/netdev/net-next/c/76025ee53b7d
- [net-next,v7,02/10] dt-bindings: net: Add Lynx PCS binding
https://git.kernel.org/netdev/net-next/c/00af103d06b3
- [net-next,v7,03/10] dt-bindings: net: fman: Add additional interface properties
https://git.kernel.org/netdev/net-next/c/045d05018a2d
- [net-next,v7,04/10] net: phylink: provide phylink_validate_mask_caps() helper
(no matching commit)
- [net-next,v7,05/10] net: fman: memac: Add serdes support
https://git.kernel.org/netdev/net-next/c/0fc83bd79589
- [net-next,v7,06/10] net: fman: memac: Use lynx pcs driver
https://git.kernel.org/netdev/net-next/c/a7c2a32e7f22
- [net-next,v7,07/10] net: dpaa: Convert to phylink
(no matching commit)
- [net-next,v7,08/10] powerpc: dts: t208x: Mark MAC1 and MAC2 as 10G
https://git.kernel.org/netdev/net-next/c/36926a7d70c2
- [net-next,v7,09/10] powerpc: dts: qoriq: Add nodes for QSGMII PCSs
https://git.kernel.org/netdev/net-next/c/4e31b808fad1
- [net-next,v7,10/10] arm64: dts: layerscape: Add nodes for QSGMII PCSs
https://git.kernel.org/netdev/net-next/c/4e748b1bd7c0

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html


2022-10-28 16:45:27

by Camelia Alexandra Groza

[permalink] [raw]
Subject: RE: [PATCH net-next v7 08/10] powerpc: dts: t208x: Mark MAC1 and MAC2 as 10G

> -----Original Message-----
> From: Sean Anderson <[email protected]>
> Sent: Monday, October 17, 2022 23:23
> To: David S . Miller <[email protected]>; Jakub Kicinski
> <[email protected]>; Madalin Bucur <[email protected]>; Camelia
> Alexandra Groza <[email protected]>; [email protected]
> Cc: Eric Dumazet <[email protected]>; linuxppc-dev @ lists . ozlabs .
> org <[email protected]>; [email protected];
> [email protected]; Russell King <[email protected]>; Paolo
> Abeni <[email protected]>; Sean Anderson <[email protected]>;
> Benjamin Herrenschmidt <[email protected]>; Krzysztof Kozlowski
> <[email protected]>; Leo Li <[email protected]>; Michael
> Ellerman <[email protected]>; Paul Mackerras <[email protected]>; Rob
> Herring <[email protected]>; [email protected]
> Subject: [PATCH net-next v7 08/10] powerpc: dts: t208x: Mark MAC1 and
> MAC2 as 10G
>
> On the T208X SoCs, MAC1 and MAC2 support XGMII. Add some new MAC
> dtsi
> fragments, and mark the QMAN ports as 10G.
>
> Fixes: da414bb923d9 ("powerpc/mpc85xx: Add FSL QorIQ DPAA FMan
> support to the SoC device tree(s)")
> Signed-off-by: Sean Anderson <[email protected]>
> ---
>
> (no changes since v4)
>
> Changes in v4:
> - New

Hi Sean,

These changes prevent MAC2 from probing on T2080RDB due to insufficient FMan hardware resources.

fsl-fman ffe400000.fman: set_num_of_tasks: Requested num_of_tasks and extra tasks pool for fm0 exceed total num_of_tasks.
fsl_dpa: dpaa_eth_init_tx_port: fm_port_init failed
fsl_dpa: probe of dpaa-ethernet.5 failed with error -11

The distribution of resources depends on the port type, and different FMan hardware revisions have different amounts of resources.

The current distribution of resources can be reconsidered, but this change should be reverted for now.

Regards,
Camelia


> .../boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi | 44 +++++++++++++++++++
> .../boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi | 44 +++++++++++++++++++
> arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 4 +-
> 3 files changed, 90 insertions(+), 2 deletions(-)
> create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
> create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
>
> diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
> b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
> new file mode 100644
> index 000000000000..437dab3fc017
> --- /dev/null
> +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
> @@ -0,0 +1,44 @@
> +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
> +/*
> + * QorIQ FMan v3 10g port #2 device tree stub [ controller @ offset
> 0x400000 ]
> + *
> + * Copyright 2022 Sean Anderson <[email protected]>
> + * Copyright 2012 - 2015 Freescale Semiconductor Inc.
> + */
> +
> +fman@400000 {
> + fman0_rx_0x08: port@88000 {
> + cell-index = <0x8>;
> + compatible = "fsl,fman-v3-port-rx";
> + reg = <0x88000 0x1000>;
> + fsl,fman-10g-port;
> + };
> +
> + fman0_tx_0x28: port@a8000 {
> + cell-index = <0x28>;
> + compatible = "fsl,fman-v3-port-tx";
> + reg = <0xa8000 0x1000>;
> + fsl,fman-10g-port;
> + };
> +
> + ethernet@e0000 {
> + cell-index = <0>;
> + compatible = "fsl,fman-memac";
> + reg = <0xe0000 0x1000>;
> + fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>;
> + ptp-timer = <&ptp_timer0>;
> + pcsphy-handle = <&pcsphy0>;
> + };
> +
> + mdio@e1000 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
> + reg = <0xe1000 0x1000>;
> + fsl,erratum-a011043; /* must ignore read errors */
> +
> + pcsphy0: ethernet-phy@0 {
> + reg = <0x0>;
> + };
> + };
> +};
> diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
> b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
> new file mode 100644
> index 000000000000..ad116b17850a
> --- /dev/null
> +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
> @@ -0,0 +1,44 @@
> +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
> +/*
> + * QorIQ FMan v3 10g port #3 device tree stub [ controller @ offset
> 0x400000 ]
> + *
> + * Copyright 2022 Sean Anderson <[email protected]>
> + * Copyright 2012 - 2015 Freescale Semiconductor Inc.
> + */
> +
> +fman@400000 {
> + fman0_rx_0x09: port@89000 {
> + cell-index = <0x9>;
> + compatible = "fsl,fman-v3-port-rx";
> + reg = <0x89000 0x1000>;
> + fsl,fman-10g-port;
> + };
> +
> + fman0_tx_0x29: port@a9000 {
> + cell-index = <0x29>;
> + compatible = "fsl,fman-v3-port-tx";
> + reg = <0xa9000 0x1000>;
> + fsl,fman-10g-port;
> + };
> +
> + ethernet@e2000 {
> + cell-index = <1>;
> + compatible = "fsl,fman-memac";
> + reg = <0xe2000 0x1000>;
> + fsl,fman-ports = <&fman0_rx_0x09 &fman0_tx_0x29>;
> + ptp-timer = <&ptp_timer0>;
> + pcsphy-handle = <&pcsphy1>;
> + };
> +
> + mdio@e3000 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
> + reg = <0xe3000 0x1000>;
> + fsl,erratum-a011043; /* must ignore read errors */
> +
> + pcsphy1: ethernet-phy@0 {
> + reg = <0x0>;
> + };
> + };
> +};
> diff --git a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
> b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
> index ecbb447920bc..74e17e134387 100644
> --- a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
> +++ b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
> @@ -609,8 +609,8 @@ usb1: usb@211000 {
> /include/ "qoriq-bman1.dtsi"
>
> /include/ "qoriq-fman3-0.dtsi"
> -/include/ "qoriq-fman3-0-1g-0.dtsi"
> -/include/ "qoriq-fman3-0-1g-1.dtsi"
> +/include/ "qoriq-fman3-0-10g-2.dtsi"
> +/include/ "qoriq-fman3-0-10g-3.dtsi"
> /include/ "qoriq-fman3-0-1g-2.dtsi"
> /include/ "qoriq-fman3-0-1g-3.dtsi"
> /include/ "qoriq-fman3-0-1g-4.dtsi"
> --
> 2.35.1.1320.gc452695387.dirty


2022-10-28 17:47:47

by Sean Anderson

[permalink] [raw]
Subject: Re: [PATCH net-next v7 08/10] powerpc: dts: t208x: Mark MAC1 and MAC2 as 10G

On 10/28/22 12:30, Camelia Alexandra Groza wrote:
>> -----Original Message-----
>> From: Sean Anderson <[email protected]>
>> Sent: Monday, October 17, 2022 23:23
>> To: David S . Miller <[email protected]>; Jakub Kicinski
>> <[email protected]>; Madalin Bucur <[email protected]>; Camelia
>> Alexandra Groza <[email protected]>; [email protected]
>> Cc: Eric Dumazet <[email protected]>; linuxppc-dev @ lists . ozlabs .
>> org <[email protected]>; [email protected];
>> [email protected]; Russell King <[email protected]>; Paolo
>> Abeni <[email protected]>; Sean Anderson <[email protected]>;
>> Benjamin Herrenschmidt <[email protected]>; Krzysztof Kozlowski
>> <[email protected]>; Leo Li <[email protected]>; Michael
>> Ellerman <[email protected]>; Paul Mackerras <[email protected]>; Rob
>> Herring <[email protected]>; [email protected]
>> Subject: [PATCH net-next v7 08/10] powerpc: dts: t208x: Mark MAC1 and
>> MAC2 as 10G
>>
>> On the T208X SoCs, MAC1 and MAC2 support XGMII. Add some new MAC
>> dtsi
>> fragments, and mark the QMAN ports as 10G.
>>
>> Fixes: da414bb923d9 ("powerpc/mpc85xx: Add FSL QorIQ DPAA FMan
>> support to the SoC device tree(s)")
>> Signed-off-by: Sean Anderson <[email protected]>
>> ---
>>
>> (no changes since v4)
>>
>> Changes in v4:
>> - New
>
> Hi Sean,
>
> These changes prevent MAC2 from probing on T2080RDB due to insufficient FMan hardware resources.
>
> fsl-fman ffe400000.fman: set_num_of_tasks: Requested num_of_tasks and extra tasks pool for fm0 exceed total num_of_tasks.
> fsl_dpa: dpaa_eth_init_tx_port: fm_port_init failed
> fsl_dpa: probe of dpaa-ethernet.5 failed with error -11
>
> The distribution of resources depends on the port type, and different FMan hardware revisions have different amounts of resources.
>
> The current distribution of resources can be reconsidered, but this change should be reverted for now.

OK, so this patch does two things:

@@ -37,12 +11,14 @@
cell-index = <0x8>;
compatible = "fsl,fman-v3-port-rx";
reg = <0x88000 0x1000>;
+ fsl,fman-10g-port;
};

fman0_tx_0x28: port@a8000 {
cell-index = <0x28>;
compatible = "fsl,fman-v3-port-tx";
reg = <0xa8000 0x1000>;
+ fsl,fman-10g-port;
};

ethernet@e0000 {
@@ -52,7 +28,7 @@
fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>;
ptp-timer = <&ptp_timer0>;
pcsphy-handle = <&pcsphy0>, <&pcsphy0>;
- pcs-handle-names = "sgmii", "qsgmii";
+ pcs-handle-names = "sgmii", "xfi";
};

mdio@e1000 {

First, it marks the ports as 10g. I believe this is what's causing the
resource problems above. Second, it removes support for QSGMII and adds
support for XFI. This is a matter of correctness; these MACs really
don't support QSGMII, and do support XFI. As I understand it, you can
run a 10g port at 1g speeds, it just won't perform as well. So I think a
more minimal revert would be to delete the fsl,fman-10g-port properties
in t2081si-post.dtsi.

That said, is 10g even being used on these ports? I included this patch
in order to avoid breaking any existing users.

--Sean

> Regards,
> Camelia
>
>
>> .../boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi | 44 +++++++++++++++++++
>> .../boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi | 44 +++++++++++++++++++
>> arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 4 +-
>> 3 files changed, 90 insertions(+), 2 deletions(-)
>> create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
>> create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
>>
>> diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
>> b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
>> new file mode 100644
>> index 000000000000..437dab3fc017
>> --- /dev/null
>> +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
>> @@ -0,0 +1,44 @@
>> +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
>> +/*
>> + * QorIQ FMan v3 10g port #2 device tree stub [ controller @ offset
>> 0x400000 ]
>> + *
>> + * Copyright 2022 Sean Anderson <[email protected]>
>> + * Copyright 2012 - 2015 Freescale Semiconductor Inc.
>> + */
>> +
>> +fman@400000 {
>> + fman0_rx_0x08: port@88000 {
>> + cell-index = <0x8>;
>> + compatible = "fsl,fman-v3-port-rx";
>> + reg = <0x88000 0x1000>;
>> + fsl,fman-10g-port;
>> + };
>> +
>> + fman0_tx_0x28: port@a8000 {
>> + cell-index = <0x28>;
>> + compatible = "fsl,fman-v3-port-tx";
>> + reg = <0xa8000 0x1000>;
>> + fsl,fman-10g-port;
>> + };
>> +
>> + ethernet@e0000 {
>> + cell-index = <0>;
>> + compatible = "fsl,fman-memac";
>> + reg = <0xe0000 0x1000>;
>> + fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>;
>> + ptp-timer = <&ptp_timer0>;
>> + pcsphy-handle = <&pcsphy0>;
>> + };
>> +
>> + mdio@e1000 {
>> + #address-cells = <1>;
>> + #size-cells = <0>;
>> + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
>> + reg = <0xe1000 0x1000>;
>> + fsl,erratum-a011043; /* must ignore read errors */
>> +
>> + pcsphy0: ethernet-phy@0 {
>> + reg = <0x0>;
>> + };
>> + };
>> +};
>> diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
>> b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
>> new file mode 100644
>> index 000000000000..ad116b17850a
>> --- /dev/null
>> +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
>> @@ -0,0 +1,44 @@
>> +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
>> +/*
>> + * QorIQ FMan v3 10g port #3 device tree stub [ controller @ offset
>> 0x400000 ]
>> + *
>> + * Copyright 2022 Sean Anderson <[email protected]>
>> + * Copyright 2012 - 2015 Freescale Semiconductor Inc.
>> + */
>> +
>> +fman@400000 {
>> + fman0_rx_0x09: port@89000 {
>> + cell-index = <0x9>;
>> + compatible = "fsl,fman-v3-port-rx";
>> + reg = <0x89000 0x1000>;
>> + fsl,fman-10g-port;
>> + };
>> +
>> + fman0_tx_0x29: port@a9000 {
>> + cell-index = <0x29>;
>> + compatible = "fsl,fman-v3-port-tx";
>> + reg = <0xa9000 0x1000>;
>> + fsl,fman-10g-port;
>> + };
>> +
>> + ethernet@e2000 {
>> + cell-index = <1>;
>> + compatible = "fsl,fman-memac";
>> + reg = <0xe2000 0x1000>;
>> + fsl,fman-ports = <&fman0_rx_0x09 &fman0_tx_0x29>;
>> + ptp-timer = <&ptp_timer0>;
>> + pcsphy-handle = <&pcsphy1>;
>> + };
>> +
>> + mdio@e3000 {
>> + #address-cells = <1>;
>> + #size-cells = <0>;
>> + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
>> + reg = <0xe3000 0x1000>;
>> + fsl,erratum-a011043; /* must ignore read errors */
>> +
>> + pcsphy1: ethernet-phy@0 {
>> + reg = <0x0>;
>> + };
>> + };
>> +};
>> diff --git a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
>> b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
>> index ecbb447920bc..74e17e134387 100644
>> --- a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
>> +++ b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
>> @@ -609,8 +609,8 @@ usb1: usb@211000 {
>> /include/ "qoriq-bman1.dtsi"
>>
>> /include/ "qoriq-fman3-0.dtsi"
>> -/include/ "qoriq-fman3-0-1g-0.dtsi"
>> -/include/ "qoriq-fman3-0-1g-1.dtsi"
>> +/include/ "qoriq-fman3-0-10g-2.dtsi"
>> +/include/ "qoriq-fman3-0-10g-3.dtsi"
>> /include/ "qoriq-fman3-0-1g-2.dtsi"
>> /include/ "qoriq-fman3-0-1g-3.dtsi"
>> /include/ "qoriq-fman3-0-1g-4.dtsi"
>> --
>> 2.35.1.1320.gc452695387.dirty
>


2022-10-31 14:48:57

by Camelia Alexandra Groza

[permalink] [raw]
Subject: RE: [PATCH net-next v7 08/10] powerpc: dts: t208x: Mark MAC1 and MAC2 as 10G

> -----Original Message-----
> From: Sean Anderson <[email protected]>
> Sent: Friday, October 28, 2022 19:55
> To: Camelia Alexandra Groza <[email protected]>; Sean Anderson
> <[email protected]>; David S . Miller <[email protected]>;
> Jakub Kicinski <[email protected]>; Madalin Bucur
> <[email protected]>; [email protected]
> Cc: Eric Dumazet <[email protected]>; linuxppc-dev @ lists . ozlabs .
> org <[email protected]>; [email protected];
> [email protected]; Russell King <[email protected]>; Paolo
> Abeni <[email protected]>; Benjamin Herrenschmidt
> <[email protected]>; Krzysztof Kozlowski
> <[email protected]>; Leo Li <[email protected]>; Michael
> Ellerman <[email protected]>; Paul Mackerras <[email protected]>; Rob
> Herring <[email protected]>; [email protected]
> Subject: Re: [PATCH net-next v7 08/10] powerpc: dts: t208x: Mark MAC1 and
> MAC2 as 10G
>
> On 10/28/22 12:30, Camelia Alexandra Groza wrote:
> >> -----Original Message-----
> >> From: Sean Anderson <[email protected]>
> >> Sent: Monday, October 17, 2022 23:23
> >> To: David S . Miller <[email protected]>; Jakub Kicinski
> >> <[email protected]>; Madalin Bucur <[email protected]>; Camelia
> >> Alexandra Groza <[email protected]>; [email protected]
> >> Cc: Eric Dumazet <[email protected]>; linuxppc-dev @ lists . ozlabs .
> >> org <[email protected]>; linux-arm-
> [email protected];
> >> [email protected]; Russell King <[email protected]>;
> Paolo
> >> Abeni <[email protected]>; Sean Anderson
> <[email protected]>;
> >> Benjamin Herrenschmidt <[email protected]>; Krzysztof
> Kozlowski
> >> <[email protected]>; Leo Li <[email protected]>;
> Michael
> >> Ellerman <[email protected]>; Paul Mackerras <[email protected]>;
> Rob
> >> Herring <[email protected]>; [email protected]
> >> Subject: [PATCH net-next v7 08/10] powerpc: dts: t208x: Mark MAC1 and
> >> MAC2 as 10G
> >>
> >> On the T208X SoCs, MAC1 and MAC2 support XGMII. Add some new MAC
> >> dtsi
> >> fragments, and mark the QMAN ports as 10G.
> >>
> >> Fixes: da414bb923d9 ("powerpc/mpc85xx: Add FSL QorIQ DPAA FMan
> >> support to the SoC device tree(s)")
> >> Signed-off-by: Sean Anderson <[email protected]>
> >> ---
> >>
> >> (no changes since v4)
> >>
> >> Changes in v4:
> >> - New
> >
> > Hi Sean,
> >
> > These changes prevent MAC2 from probing on T2080RDB due to
> insufficient FMan hardware resources.
> >
> > fsl-fman ffe400000.fman: set_num_of_tasks: Requested num_of_tasks
> and extra tasks pool for fm0 exceed total num_of_tasks.
> > fsl_dpa: dpaa_eth_init_tx_port: fm_port_init failed
> > fsl_dpa: probe of dpaa-ethernet.5 failed with error -11
> >
> > The distribution of resources depends on the port type, and different
> FMan hardware revisions have different amounts of resources.
> >
> > The current distribution of resources can be reconsidered, but this change
> should be reverted for now.
>
> OK, so this patch does two things:
>
> @@ -37,12 +11,14 @@
> cell-index = <0x8>;
> compatible = "fsl,fman-v3-port-rx";
> reg = <0x88000 0x1000>;
> + fsl,fman-10g-port;
> };
>
> fman0_tx_0x28: port@a8000 {
> cell-index = <0x28>;
> compatible = "fsl,fman-v3-port-tx";
> reg = <0xa8000 0x1000>;
> + fsl,fman-10g-port;
> };
>
> ethernet@e0000 {
> @@ -52,7 +28,7 @@
> fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>;
> ptp-timer = <&ptp_timer0>;
> pcsphy-handle = <&pcsphy0>, <&pcsphy0>;
> - pcs-handle-names = "sgmii", "qsgmii";
> + pcs-handle-names = "sgmii", "xfi";
> };
>
> mdio@e1000 {
>
> First, it marks the ports as 10g. I believe this is what's causing the
> resource problems above.

That's right.

> Second, it removes support for QSGMII and adds
> support for XFI. This is a matter of correctness; these MACs really
> don't support QSGMII, and do support XFI.

Correct, these MACs don't support QSGMII on this SoC.

> As I understand it, you can
> run a 10g port at 1g speeds, it just won't perform as well. So I think a
> more minimal revert would be to delete the fsl,fman-10g-port properties
> in t2081si-post.dtsi.

Since these two new dtsi files are included by only one SoC, I don't see an
advantage in adding these properties and then deleting them. No other
users benefit from adding them in the first place.

> That said, is 10g even being used on these ports? I included this patch
> in order to avoid breaking any existing users.

It is used, though less efficiently, with fewer FMan hardware resources.

Camelia

> --Sean
>
> > Regards,
> > Camelia
> >
> >
> >> .../boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi | 44 +++++++++++++++++++
> >> .../boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi | 44 +++++++++++++++++++
> >> arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 4 +-
> >> 3 files changed, 90 insertions(+), 2 deletions(-)
> >> create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-
> 2.dtsi
> >> create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-
> 3.dtsi
> >>
> >> diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
> >> b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
> >> new file mode 100644
> >> index 000000000000..437dab3fc017
> >> --- /dev/null
> >> +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
> >> @@ -0,0 +1,44 @@
> >> +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
> >> +/*
> >> + * QorIQ FMan v3 10g port #2 device tree stub [ controller @ offset
> >> 0x400000 ]
> >> + *
> >> + * Copyright 2022 Sean Anderson <[email protected]>
> >> + * Copyright 2012 - 2015 Freescale Semiconductor Inc.
> >> + */
> >> +
> >> +fman@400000 {
> >> + fman0_rx_0x08: port@88000 {
> >> + cell-index = <0x8>;
> >> + compatible = "fsl,fman-v3-port-rx";
> >> + reg = <0x88000 0x1000>;
> >> + fsl,fman-10g-port;
> >> + };
> >> +
> >> + fman0_tx_0x28: port@a8000 {
> >> + cell-index = <0x28>;
> >> + compatible = "fsl,fman-v3-port-tx";
> >> + reg = <0xa8000 0x1000>;
> >> + fsl,fman-10g-port;
> >> + };
> >> +
> >> + ethernet@e0000 {
> >> + cell-index = <0>;
> >> + compatible = "fsl,fman-memac";
> >> + reg = <0xe0000 0x1000>;
> >> + fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>;
> >> + ptp-timer = <&ptp_timer0>;
> >> + pcsphy-handle = <&pcsphy0>;
> >> + };
> >> +
> >> + mdio@e1000 {
> >> + #address-cells = <1>;
> >> + #size-cells = <0>;
> >> + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
> >> + reg = <0xe1000 0x1000>;
> >> + fsl,erratum-a011043; /* must ignore read errors */
> >> +
> >> + pcsphy0: ethernet-phy@0 {
> >> + reg = <0x0>;
> >> + };
> >> + };
> >> +};
> >> diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
> >> b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
> >> new file mode 100644
> >> index 000000000000..ad116b17850a
> >> --- /dev/null
> >> +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
> >> @@ -0,0 +1,44 @@
> >> +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
> >> +/*
> >> + * QorIQ FMan v3 10g port #3 device tree stub [ controller @ offset
> >> 0x400000 ]
> >> + *
> >> + * Copyright 2022 Sean Anderson <[email protected]>
> >> + * Copyright 2012 - 2015 Freescale Semiconductor Inc.
> >> + */
> >> +
> >> +fman@400000 {
> >> + fman0_rx_0x09: port@89000 {
> >> + cell-index = <0x9>;
> >> + compatible = "fsl,fman-v3-port-rx";
> >> + reg = <0x89000 0x1000>;
> >> + fsl,fman-10g-port;
> >> + };
> >> +
> >> + fman0_tx_0x29: port@a9000 {
> >> + cell-index = <0x29>;
> >> + compatible = "fsl,fman-v3-port-tx";
> >> + reg = <0xa9000 0x1000>;
> >> + fsl,fman-10g-port;
> >> + };
> >> +
> >> + ethernet@e2000 {
> >> + cell-index = <1>;
> >> + compatible = "fsl,fman-memac";
> >> + reg = <0xe2000 0x1000>;
> >> + fsl,fman-ports = <&fman0_rx_0x09 &fman0_tx_0x29>;
> >> + ptp-timer = <&ptp_timer0>;
> >> + pcsphy-handle = <&pcsphy1>;
> >> + };
> >> +
> >> + mdio@e3000 {
> >> + #address-cells = <1>;
> >> + #size-cells = <0>;
> >> + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
> >> + reg = <0xe3000 0x1000>;
> >> + fsl,erratum-a011043; /* must ignore read errors */
> >> +
> >> + pcsphy1: ethernet-phy@0 {
> >> + reg = <0x0>;
> >> + };
> >> + };
> >> +};
> >> diff --git a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
> >> b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
> >> index ecbb447920bc..74e17e134387 100644
> >> --- a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
> >> +++ b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
> >> @@ -609,8 +609,8 @@ usb1: usb@211000 {
> >> /include/ "qoriq-bman1.dtsi"
> >>
> >> /include/ "qoriq-fman3-0.dtsi"
> >> -/include/ "qoriq-fman3-0-1g-0.dtsi"
> >> -/include/ "qoriq-fman3-0-1g-1.dtsi"
> >> +/include/ "qoriq-fman3-0-10g-2.dtsi"
> >> +/include/ "qoriq-fman3-0-10g-3.dtsi"
> >> /include/ "qoriq-fman3-0-1g-2.dtsi"
> >> /include/ "qoriq-fman3-0-1g-3.dtsi"
> >> /include/ "qoriq-fman3-0-1g-4.dtsi"
> >> --
> >> 2.35.1.1320.gc452695387.dirty
> >

2022-10-31 22:53:00

by Sean Anderson

[permalink] [raw]
Subject: Re: [PATCH net-next v7 08/10] powerpc: dts: t208x: Mark MAC1 and MAC2 as 10G

On 10/31/22 10:12, Camelia Alexandra Groza wrote:
>> -----Original Message-----
>> From: Sean Anderson <[email protected]>
>> Sent: Friday, October 28, 2022 19:55
>> To: Camelia Alexandra Groza <[email protected]>; Sean Anderson
>> <[email protected]>; David S . Miller <[email protected]>;
>> Jakub Kicinski <[email protected]>; Madalin Bucur
>> <[email protected]>; [email protected]
>> Cc: Eric Dumazet <[email protected]>; linuxppc-dev @ lists . ozlabs .
>> org <[email protected]>; [email protected];
>> [email protected]; Russell King <[email protected]>; Paolo
>> Abeni <[email protected]>; Benjamin Herrenschmidt
>> <[email protected]>; Krzysztof Kozlowski
>> <[email protected]>; Leo Li <[email protected]>; Michael
>> Ellerman <[email protected]>; Paul Mackerras <[email protected]>; Rob
>> Herring <[email protected]>; [email protected]
>> Subject: Re: [PATCH net-next v7 08/10] powerpc: dts: t208x: Mark MAC1 and
>> MAC2 as 10G
>>
>> On 10/28/22 12:30, Camelia Alexandra Groza wrote:
>> >> -----Original Message-----
>> >> From: Sean Anderson <[email protected]>
>> >> Sent: Monday, October 17, 2022 23:23
>> >> To: David S . Miller <[email protected]>; Jakub Kicinski
>> >> <[email protected]>; Madalin Bucur <[email protected]>; Camelia
>> >> Alexandra Groza <[email protected]>; [email protected]
>> >> Cc: Eric Dumazet <[email protected]>; linuxppc-dev @ lists . ozlabs .
>> >> org <[email protected]>; linux-arm-
>> [email protected];
>> >> [email protected]; Russell King <[email protected]>;
>> Paolo
>> >> Abeni <[email protected]>; Sean Anderson
>> <[email protected]>;
>> >> Benjamin Herrenschmidt <[email protected]>; Krzysztof
>> Kozlowski
>> >> <[email protected]>; Leo Li <[email protected]>;
>> Michael
>> >> Ellerman <[email protected]>; Paul Mackerras <[email protected]>;
>> Rob
>> >> Herring <[email protected]>; [email protected]
>> >> Subject: [PATCH net-next v7 08/10] powerpc: dts: t208x: Mark MAC1 and
>> >> MAC2 as 10G
>> >>
>> >> On the T208X SoCs, MAC1 and MAC2 support XGMII. Add some new MAC
>> >> dtsi
>> >> fragments, and mark the QMAN ports as 10G.
>> >>
>> >> Fixes: da414bb923d9 ("powerpc/mpc85xx: Add FSL QorIQ DPAA FMan
>> >> support to the SoC device tree(s)")
>> >> Signed-off-by: Sean Anderson <[email protected]>
>> >> ---
>> >>
>> >> (no changes since v4)
>> >>
>> >> Changes in v4:
>> >> - New
>> >
>> > Hi Sean,
>> >
>> > These changes prevent MAC2 from probing on T2080RDB due to
>> insufficient FMan hardware resources.
>> >
>> > fsl-fman ffe400000.fman: set_num_of_tasks: Requested num_of_tasks
>> and extra tasks pool for fm0 exceed total num_of_tasks.
>> > fsl_dpa: dpaa_eth_init_tx_port: fm_port_init failed
>> > fsl_dpa: probe of dpaa-ethernet.5 failed with error -11
>> >
>> > The distribution of resources depends on the port type, and different
>> FMan hardware revisions have different amounts of resources.
>> >
>> > The current distribution of resources can be reconsidered, but this change
>> should be reverted for now.
>>
>> OK, so this patch does two things:
>>
>> @@ -37,12 +11,14 @@
>> cell-index = <0x8>;
>> compatible = "fsl,fman-v3-port-rx";
>> reg = <0x88000 0x1000>;
>> + fsl,fman-10g-port;
>> };
>>
>> fman0_tx_0x28: port@a8000 {
>> cell-index = <0x28>;
>> compatible = "fsl,fman-v3-port-tx";
>> reg = <0xa8000 0x1000>;
>> + fsl,fman-10g-port;
>> };
>>
>> ethernet@e0000 {
>> @@ -52,7 +28,7 @@
>> fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>;
>> ptp-timer = <&ptp_timer0>;
>> pcsphy-handle = <&pcsphy0>, <&pcsphy0>;
>> - pcs-handle-names = "sgmii", "qsgmii";
>> + pcs-handle-names = "sgmii", "xfi";
>> };
>>
>> mdio@e1000 {
>>
>> First, it marks the ports as 10g. I believe this is what's causing the
>> resource problems above.
>
> That's right.
>
>> Second, it removes support for QSGMII and adds
>> support for XFI. This is a matter of correctness; these MACs really
>> don't support QSGMII, and do support XFI.
>
> Correct, these MACs don't support QSGMII on this SoC.
>
>> As I understand it, you can
>> run a 10g port at 1g speeds, it just won't perform as well. So I think a
>> more minimal revert would be to delete the fsl,fman-10g-port properties
>> in t2081si-post.dtsi.
>
> Since these two new dtsi files are included by only one SoC, I don't see an
> advantage in adding these properties and then deleting them. No other
> users benefit from adding them in the first place.

OK, so would you prefer just overriding pcs-handle-names in the SoC dtsi?

--Sean

>> That said, is 10g even being used on these ports? I included this patch
>> in order to avoid breaking any existing users.
>
> It is used, though less efficiently, with fewer FMan hardware resources.
>
> Camelia
>
>> --Sean
>>
>> > Regards,
>> > Camelia
>> >
>> >
>> >> .../boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi | 44 +++++++++++++++++++
>> >> .../boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi | 44 +++++++++++++++++++
>> >> arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 4 +-
>> >> 3 files changed, 90 insertions(+), 2 deletions(-)
>> >> create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-
>> 2.dtsi
>> >> create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-
>> 3.dtsi
>> >>
>> >> diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
>> >> b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
>> >> new file mode 100644
>> >> index 000000000000..437dab3fc017
>> >> --- /dev/null
>> >> +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi
>> >> @@ -0,0 +1,44 @@
>> >> +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
>> >> +/*
>> >> + * QorIQ FMan v3 10g port #2 device tree stub [ controller @ offset
>> >> 0x400000 ]
>> >> + *
>> >> + * Copyright 2022 Sean Anderson <[email protected]>
>> >> + * Copyright 2012 - 2015 Freescale Semiconductor Inc.
>> >> + */
>> >> +
>> >> +fman@400000 {
>> >> + fman0_rx_0x08: port@88000 {
>> >> + cell-index = <0x8>;
>> >> + compatible = "fsl,fman-v3-port-rx";
>> >> + reg = <0x88000 0x1000>;
>> >> + fsl,fman-10g-port;
>> >> + };
>> >> +
>> >> + fman0_tx_0x28: port@a8000 {
>> >> + cell-index = <0x28>;
>> >> + compatible = "fsl,fman-v3-port-tx";
>> >> + reg = <0xa8000 0x1000>;
>> >> + fsl,fman-10g-port;
>> >> + };
>> >> +
>> >> + ethernet@e0000 {
>> >> + cell-index = <0>;
>> >> + compatible = "fsl,fman-memac";
>> >> + reg = <0xe0000 0x1000>;
>> >> + fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>;
>> >> + ptp-timer = <&ptp_timer0>;
>> >> + pcsphy-handle = <&pcsphy0>;
>> >> + };
>> >> +
>> >> + mdio@e1000 {
>> >> + #address-cells = <1>;
>> >> + #size-cells = <0>;
>> >> + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
>> >> + reg = <0xe1000 0x1000>;
>> >> + fsl,erratum-a011043; /* must ignore read errors */
>> >> +
>> >> + pcsphy0: ethernet-phy@0 {
>> >> + reg = <0x0>;
>> >> + };
>> >> + };
>> >> +};
>> >> diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
>> >> b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
>> >> new file mode 100644
>> >> index 000000000000..ad116b17850a
>> >> --- /dev/null
>> >> +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
>> >> @@ -0,0 +1,44 @@
>> >> +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
>> >> +/*
>> >> + * QorIQ FMan v3 10g port #3 device tree stub [ controller @ offset
>> >> 0x400000 ]
>> >> + *
>> >> + * Copyright 2022 Sean Anderson <[email protected]>
>> >> + * Copyright 2012 - 2015 Freescale Semiconductor Inc.
>> >> + */
>> >> +
>> >> +fman@400000 {
>> >> + fman0_rx_0x09: port@89000 {
>> >> + cell-index = <0x9>;
>> >> + compatible = "fsl,fman-v3-port-rx";
>> >> + reg = <0x89000 0x1000>;
>> >> + fsl,fman-10g-port;
>> >> + };
>> >> +
>> >> + fman0_tx_0x29: port@a9000 {
>> >> + cell-index = <0x29>;
>> >> + compatible = "fsl,fman-v3-port-tx";
>> >> + reg = <0xa9000 0x1000>;
>> >> + fsl,fman-10g-port;
>> >> + };
>> >> +
>> >> + ethernet@e2000 {
>> >> + cell-index = <1>;
>> >> + compatible = "fsl,fman-memac";
>> >> + reg = <0xe2000 0x1000>;
>> >> + fsl,fman-ports = <&fman0_rx_0x09 &fman0_tx_0x29>;
>> >> + ptp-timer = <&ptp_timer0>;
>> >> + pcsphy-handle = <&pcsphy1>;
>> >> + };
>> >> +
>> >> + mdio@e3000 {
>> >> + #address-cells = <1>;
>> >> + #size-cells = <0>;
>> >> + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
>> >> + reg = <0xe3000 0x1000>;
>> >> + fsl,erratum-a011043; /* must ignore read errors */
>> >> +
>> >> + pcsphy1: ethernet-phy@0 {
>> >> + reg = <0x0>;
>> >> + };
>> >> + };
>> >> +};
>> >> diff --git a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
>> >> b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
>> >> index ecbb447920bc..74e17e134387 100644
>> >> --- a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
>> >> +++ b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi
>> >> @@ -609,8 +609,8 @@ usb1: usb@211000 {
>> >> /include/ "qoriq-bman1.dtsi"
>> >>
>> >> /include/ "qoriq-fman3-0.dtsi"
>> >> -/include/ "qoriq-fman3-0-1g-0.dtsi"
>> >> -/include/ "qoriq-fman3-0-1g-1.dtsi"
>> >> +/include/ "qoriq-fman3-0-10g-2.dtsi"
>> >> +/include/ "qoriq-fman3-0-10g-3.dtsi"
>> >> /include/ "qoriq-fman3-0-1g-2.dtsi"
>> >> /include/ "qoriq-fman3-0-1g-3.dtsi"
>> >> /include/ "qoriq-fman3-0-1g-4.dtsi"
>> >> --
>> >> 2.35.1.1320.gc452695387.dirty
>> >
>