Skip to contentSkip to conversation

Adding the Sparx5 Serdes driver

PATCH Superseded Steen Hegelund 4 participants 14 messages Dec 3, 2020 – Dec 7, 2020

Subsystems (6)

v8 of 15 Superseded Latest is v15 →

lore
Share & tools
lore

Steen Hegelund

author maintainer
#0 lore raw

v8 cover Adding the Sparx5 Serdes driver

Adding the Sparx5 Serdes driver

This series of patches provides the serdes driver for the Microchip Sparx5 ethernet switch.

The serdes driver supports the 10G and 25G serdes instances available in the Sparx5.

The Sparx5 serdes support several interface modes with several speeds and also allows the client to change the mode and the speed according to changing in the environment such as changing cables from DAC to fiber.

The serdes driver is to be used by the Sparx5 switchdev driver that will follow in subsequent series.

History:
--------
v7 -> v8:
Provide the IO targets as offsets from the start of the IO range Initialise resource index

v6 -> v7:
This series changes the way the IO targets are provided to the driver. Now only one IO range is available in the DT, and the driver has a table to map its targets (as their order is still not sequential), thus reducing the DT needed information and binding requirements.
The register access macros have been converted to functions.

- Bindings:
- reg prop: minItems set to 1
- reg-names prop: removed
- Driver
- Use one IO range and map targets via this.
- Change register access macros to use functions.
- Provided a new header files with reg access functions.
- Device tree
- Provide only one IO range

v5 -> v6:
Series error: This had the same content as v5

v4 -> v5:
- Bindings:
- Removed .yaml from compatible string
- reg prop: removed description and added minItems
- reg-names prop: removed description and added const name list and minItems
- #phy-cells prop: removed description and added maxItems
- Configuration interface
- Removed include of linux/phy.h
- Added include of linux/types.h
- Driver
- Added include of linux/phy.h

v3 -> v4:
- Add a reg-names item to the binding description
- Add a clocks item to the binding description
- Removed the clock parameter from the configuration interface
- Use the clock dt node to get the coreclock, and using that when doing the actual serdes configuration
- Added a clocks entry with a system clock reference to the serdes node in the device tree

v2 -> v3:
- Sorted the Kconfig sourced folders
- Sorted the Makefile included folders
- Changed the configuration interface documentation to use kernel style

v1 -> v2: Fixed kernel test robot warnings
- Made these structures static:
- media_presets_25g
- mode_presets_25g
- media_presets_10g
- mode_presets_10g
- Removed these duplicate initializations:
- sparx5_sd25g28_params.cfg_rx_reserve_15_8
- sparx5_sd25g28_params.cfg_pi_en
- sparx5_sd25g28_params.cfg_cdrck_en
- sparx5_sd10g28_params.cfg_cdrck_en

Lars Povlsen (2):
dt-bindings: phy: Add sparx5-serdes bindings
arm64: dts: sparx5: Add Sparx5 serdes driver node

Steen Hegelund (2):
phy: Add ethernet serdes configuration option
phy: Add Sparx5 ethernet serdes PHY driver

 .../bindings/phy/microchip,sparx5-serdes.yaml |  100 +
 arch/arm64/boot/dts/microchip/sparx5.dtsi     |    8 +
 drivers/phy/Kconfig                           |    3 +-
 drivers/phy/Makefile                          |    1 +
 drivers/phy/microchip/Kconfig                 |   12 +
 drivers/phy/microchip/Makefile                |    6 +
 drivers/phy/microchip/sparx5_serdes.c         | 2434 +++++++++++++++
 drivers/phy/microchip/sparx5_serdes.h         |  129 +
 drivers/phy/microchip/sparx5_serdes_regs.h    | 2695 +++++++++++++++++
 include/linux/phy/phy-ethernet-serdes.h       |   30 +
 include/linux/phy/phy.h                       |    4 +
 11 files changed, 5421 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/phy/microchip,sparx5-serdes.yaml
 create mode 100644 drivers/phy/microchip/Kconfig
 create mode 100644 drivers/phy/microchip/Makefile
 create mode 100644 drivers/phy/microchip/sparx5_serdes.c
 create mode 100644 drivers/phy/microchip/sparx5_serdes.h
 create mode 100644 drivers/phy/microchip/sparx5_serdes_regs.h
 create mode 100644 include/linux/phy/phy-ethernet-serdes.h
Signature · 1 line
2.29.2
author maintainer
#1 lore raw

PATCH v8 1/4 dt-bindings: phy: Add sparx5-serdes bindings

Document the Sparx5 ethernet serdes phy driver bindings.

---
 .../bindings/phy/microchip,sparx5-serdes.yaml | 100 ++++++++++++++++++
 1 file changed, 100 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/microchip,sparx5-serdes.yaml
Documentation/devicetree/bindings/phy/microchip,sparx5-serdes.yaml new file +100 -0
new file mode 100644
index 000000000000..bdbdb3bbddbe
@@ -0,0 +1,100 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/microchip,sparx5-serdes.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip Sparx5 Serdes controller
+
+maintainers:
+  - Steen Hegelund <[email protected]>
+
+description: |
+  The Sparx5 SERDES interfaces share the same basic functionality, but
+  support different operating modes and line rates.
+
+  The following list lists the SERDES features:
+
+  * RX Adaptive Decision Feedback Equalizer (DFE)
+  * Programmable continuous time linear equalizer (CTLE)
+  * Rx variable gain control
+  * Rx built-in fault detector (loss-of-lock/loss-of-signal)
+  * Adjustable tx de-emphasis (FFE)
+  * Tx output amplitude control
+  * Supports rx eye monitor
+  * Multiple loopback modes
+  * Prbs generator and checker
+  * Polarity inversion control
+
+  SERDES6G:
+
+  The SERDES6G is a high-speed SERDES interface, which can operate at
+  the following data rates:
+
+  * 100 Mbps (100BASE-FX)
+  * 1.25 Gbps (SGMII/1000BASE-X/1000BASE-KX)
+  * 3.125 Gbps (2.5GBASE-X/2.5GBASE-KX)
+  * 5.15625 Gbps (5GBASE-KR/5G-USXGMII)
+
+  SERDES10G
+
+  The SERDES10G is a high-speed SERDES interface, which can operate at
+  the following data rates:
+
+  * 100 Mbps (100BASE-FX)
+  * 1.25 Gbps (SGMII/1000BASE-X/1000BASE-KX)
+  * 3.125 Gbps (2.5GBASE-X/2.5GBASE-KX)
+  * 5 Gbps (QSGMII/USGMII)
+  * 5.15625 Gbps (5GBASE-KR/5G-USXGMII)
+  * 10 Gbps (10G-USGMII)
+  * 10.3125 Gbps (10GBASE-R/10GBASE-KR/USXGMII)
+
+  SERDES25G
+
+  The SERDES25G is a high-speed SERDES interface, which can operate at
+  the following data rates:
+
+  * 1.25 Gbps (SGMII/1000BASE-X/1000BASE-KX)
+  * 3.125 Gbps (2.5GBASE-X/2.5GBASE-KX)
+  * 5 Gbps (QSGMII/USGMII)
+  * 5.15625 Gbps (5GBASE-KR/5G-USXGMII)
+  * 10 Gbps (10G-USGMII)
+  * 10.3125 Gbps (10GBASE-R/10GBASE-KR/USXGMII)
+  * 25.78125 Gbps (25GBASE-KR/25GBASE-CR/25GBASE-SR/25GBASE-LR/25GBASE-ER)
+
+properties:
+  $nodename:
+    pattern: "^serdes@[0-9a-f]+$"
+
+  compatible:
+    const: microchip,sparx5-serdes
+
+  reg:
+    minItems: 1
+
+  '#phy-cells':
+    const: 1
+    description: |
+      - The main serdes input port
+
+  clocks:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - '#phy-cells'
+  - clocks
+
+additionalProperties: false
+
+examples:
+  - |
+    serdes: serdes@10808000 {
+      compatible = "microchip,sparx5-serdes";
+      #phy-cells = <1>;
+      clocks = <&sys_clk>;
+      reg = <0x10808000 0x5d0000>;
+    };
+
+...
Signature · 1 line
2.29.2
author maintainer
#2 lore raw

PATCH v8 2/4 phy: Add ethernet serdes configuration option

In reply to Steen Hegelund

Provide a new ethernet phy configuration structure, that allow PHYs used for ethernet to be configured with speed, media type and clock information.

---
 include/linux/phy/phy-ethernet-serdes.h | 30 +++++++++++++++++++++++++
 include/linux/phy/phy.h                 |  4 ++++
 2 files changed, 34 insertions(+)
 create mode 100644 include/linux/phy/phy-ethernet-serdes.h
include/linux/phy/phy-ethernet-serdes.h new file +30 -0
new file mode 100644
index 000000000000..d2462fadf179
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
+/*
+ * Microchip Sparx5 Ethernet SerDes driver
+ *
+ * Copyright (c) 2020 Microschip Inc
+ */
+#ifndef __PHY_ETHERNET_SERDES_H_
+#define __PHY_ETHERNET_SERDES_H_
+
+#include <linux/types.h>
+
+enum ethernet_media_type {
+	ETH_MEDIA_DEFAULT,
+	ETH_MEDIA_SR,
+	ETH_MEDIA_DAC,
+};
+
+/**
+ * struct phy_configure_opts_eth_serdes - Ethernet SerDes This structure is used
+ * to represent the configuration state of a Ethernet Serdes PHY.
+ * @speed: Speed of the serdes interface in Mbps
+ * @media_type: Specifies which media the serdes will be using
+ */
+struct phy_configure_opts_eth_serdes {
+	u32                        speed;
+	enum ethernet_media_type   media_type;
+};
+
+#endif
+
include/linux/phy/phy.h +4 -0
index e435bdb0bab3..78ecb375cede 100644
@@ -18,6 +18,7 @@
 
 #include <linux/phy/phy-dp.h>
 #include <linux/phy/phy-mipi-dphy.h>
+#include <linux/phy/phy-ethernet-serdes.h>
 
 struct phy;
 
@@ -49,11 +50,14 @@ enum phy_mode {
  *
  * @mipi_dphy:	Configuration set applicable for phys supporting
  *		the MIPI_DPHY phy mode.
+ * @eth_serdes: Configuration set applicable for phys supporting
+ *		the ethernet serdes.
  * @dp:		Configuration set applicable for phys supporting
  *		the DisplayPort protocol.
  */
 union phy_configure_opts {
 	struct phy_configure_opts_mipi_dphy	mipi_dphy;
+	struct phy_configure_opts_eth_serdes	eth_serdes;
 	struct phy_configure_opts_dp		dp;
 };
 
Signature · 1 line
2.29.2
author maintainer
#3 lore raw

PATCH v8 3/4 phy: Add Sparx5 ethernet serdes PHY driver

In reply to Steen Hegelund

Add the Microchip Sparx5 ethernet serdes PHY driver for the 6G, 10G and 25G interfaces available in the Sparx5 SoC.

---
 drivers/phy/Kconfig                        |    3 +-
 drivers/phy/Makefile                       |    1 +
 drivers/phy/microchip/Kconfig              |   12 +
 drivers/phy/microchip/Makefile             |    6 +
 drivers/phy/microchip/sparx5_serdes.c      | 2434 ++++++++++++++++++
 drivers/phy/microchip/sparx5_serdes.h      |  129 +
 drivers/phy/microchip/sparx5_serdes_regs.h | 2695 ++++++++++++++++++++
 7 files changed, 5279 insertions(+), 1 deletion(-)
 create mode 100644 drivers/phy/microchip/Kconfig
 create mode 100644 drivers/phy/microchip/Makefile
 create mode 100644 drivers/phy/microchip/sparx5_serdes.c
 create mode 100644 drivers/phy/microchip/sparx5_serdes.h
 create mode 100644 drivers/phy/microchip/sparx5_serdes_regs.h
drivers/phy/Kconfig +2 -1
index 01b53f86004c..f6a094c81e86 100644
@@ -66,9 +66,11 @@ source "drivers/phy/broadcom/Kconfig"
 source "drivers/phy/cadence/Kconfig"
 source "drivers/phy/freescale/Kconfig"
 source "drivers/phy/hisilicon/Kconfig"
+source "drivers/phy/intel/Kconfig"
 source "drivers/phy/lantiq/Kconfig"
 source "drivers/phy/marvell/Kconfig"
 source "drivers/phy/mediatek/Kconfig"
+source "drivers/phy/microchip/Kconfig"
 source "drivers/phy/motorola/Kconfig"
 source "drivers/phy/mscc/Kconfig"
 source "drivers/phy/qualcomm/Kconfig"
@@ -80,7 +82,6 @@ source "drivers/phy/socionext/Kconfig"
 source "drivers/phy/st/Kconfig"
 source "drivers/phy/tegra/Kconfig"
 source "drivers/phy/ti/Kconfig"
-source "drivers/phy/intel/Kconfig"
 source "drivers/phy/xilinx/Kconfig"
 
 endmenu
drivers/phy/Makefile +1 -0
index 6eb2916773c5..7d39a11d0f75 100644
@@ -19,6 +19,7 @@ obj-y					+= allwinner/	\
 					   lantiq/	\
 					   marvell/	\
 					   mediatek/	\
+					   microchip/	\
 					   motorola/	\
 					   mscc/	\
 					   qualcomm/	\
drivers/phy/microchip/Kconfig new file +12 -0
new file mode 100644
index 000000000000..0b1a818e01b8
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Phy drivers for Microchip devices
+#
+
+config PHY_SPARX5_SERDES
+	tristate "Microchip Sparx5 SerDes PHY driver"
+	select GENERIC_PHY
+	depends on OF
+	depends on HAS_IOMEM
+	help
+	  Enable this for support of the 10G/25G SerDes on Microchip Sparx5.
drivers/phy/microchip/Makefile new file +6 -0
new file mode 100644
index 000000000000..7b98345712aa
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Makefile for the Microchip phy drivers.
+#
+
+obj-$(CONFIG_PHY_SPARX5_SERDES) := sparx5_serdes.o
drivers/phy/microchip/sparx5_serdes.c new file +2434 -0

2,434 lines not on this page · raw message

drivers/phy/microchip/sparx5_serdes.h new file +129 -0

129 lines not on this page · raw message

drivers/phy/microchip/sparx5_serdes_regs.h new file +2695 -0

394 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.29.2

Part of the diff is not shown here. View the raw message.

#4 lore raw

Re: [PATCH v8 3/4] phy: Add Sparx5 ethernet serdes PHY driver

drivers/phy/microchip/sparx5_serdes.c line 620

Quoted 12 lines
drivers/phy/microchip/sparx5_serdes.c new file +12 -0
+/* map from SD25G28 interface width to configuration value */
+static u8 sd25g28_get_iw_setting(const u8 interface_width)
+{
+	switch (interface_width) {
+	case 10: return 0;
+	case 16: return 1;
+	case 32: return 3;
+	case 40: return 4;
+	case 64: return 5;
+	default:
+		pr_err("%s: Illegal value %d for interface width\n",
+		       __func__, interface_width);

Please make use of dev_err(phy->dev, so we know which PHY has configuration problems.

Quoted 23 lines
drivers/phy/microchip/sparx5_serdes.c new file +23 -0
+static int sparx5_serdes_validate(struct phy *phy, enum phy_mode mode,
+					int submode,
+					union phy_configure_opts *opts)
+{
+	struct sparx5_serdes_macro *macro = phy_get_drvdata(phy);
+	struct sparx5_serdes_private *priv = macro->priv;
+	u32 value, analog_sd;
+
+	if (mode != PHY_MODE_ETHERNET)
+		return -EINVAL;
+
+	switch (submode) {
+	case PHY_INTERFACE_MODE_1000BASEX:
+	case PHY_INTERFACE_MODE_SGMII:
+	case PHY_INTERFACE_MODE_QSGMII:
+	case PHY_INTERFACE_MODE_10GBASER:
+		break;
+	default:
+		return -EINVAL;
+	}
+	if (macro->serdestype == SPX5_SDT_6G) {
+		value = sdx5_rd(priv, SD6G_LANE_LANE_DF(macro->stpidx));
+		analog_sd = SD6G_LANE_LANE_DF_PMA2PCS_RXEI_FILTERED_GET(value);

drivers/phy/microchip/sparx5_serdes.c line 2191

Quoted 10 lines
drivers/phy/microchip/sparx5_serdes.c new file +10 -0
+	} else if (macro->serdestype == SPX5_SDT_10G) {
+		value = sdx5_rd(priv, SD10G_LANE_LANE_DF(macro->stpidx));
+		analog_sd = SD10G_LANE_LANE_DF_PMA2PCS_RXEI_FILTERED_GET(value);
+	} else {
+		value = sdx5_rd(priv, SD25G_LANE_LANE_DE(macro->stpidx));
+		analog_sd = SD25G_LANE_LANE_DE_LN_PMA_RXEI_GET(value);
+	}
+	/* Link up is when analog_sd == 0 */
+	return analog_sd;
+}

What i have not yet seen is how this code plugs together with phylink_pcs_ops?

Can this hardware also be used for SATA, USB? As far as i understand, the Marvell Comphy is multi-purpose, it is used for networking, USB, and SATA, etc. Making it a generic PHY then makes sense, because different subsystems need to use it.

But it looks like this is for networking only? So i'm wondering if it belongs in driver/net/pcs and it should be accessed using phylink_pcs_ops?

Andrew

#5 lore raw

Re: [PATCH v8 3/4] phy: Add Sparx5 ethernet serdes PHY driver

Quoted 41 lines · Andrew Lunn

drivers/phy/microchip/sparx5_serdes.c line 620

Quoted 12 lines
drivers/phy/microchip/sparx5_serdes.c new file +12 -0
+/* map from SD25G28 interface width to configuration value */
+static u8 sd25g28_get_iw_setting(const u8 interface_width)
+{
+	switch (interface_width) {
+	case 10: return 0;
+	case 16: return 1;
+	case 32: return 3;
+	case 40: return 4;
+	case 64: return 5;
+	default:
+		pr_err("%s: Illegal value %d for interface width\n",
+		       __func__, interface_width);

Please make use of dev_err(phy->dev, so we know which PHY has configuration problems.

Quoted 25 lines
drivers/phy/microchip/sparx5_serdes.c new file +25 -0
+static int sparx5_serdes_validate(struct phy *phy, enum phy_mode mode,
+					int submode,
+					union phy_configure_opts *opts)
+{
+	struct sparx5_serdes_macro *macro = phy_get_drvdata(phy);
+	struct sparx5_serdes_private *priv = macro->priv;
+	u32 value, analog_sd;
+
+	if (mode != PHY_MODE_ETHERNET)
+		return -EINVAL;
+
+	switch (submode) {
+	case PHY_INTERFACE_MODE_1000BASEX:
+	case PHY_INTERFACE_MODE_SGMII:
+	case PHY_INTERFACE_MODE_QSGMII:
+	case PHY_INTERFACE_MODE_10GBASER:
+		break;
+	default:
+		return -EINVAL;
+	}
+	if (macro->serdestype == SPX5_SDT_6G) {
+		value = sdx5_rd(priv, SD6G_LANE_LANE_DF(macro->stpidx));
+		analog_sd = SD6G_LANE_LANE_DF_PMA2PCS_RXEI_FILTERED_GET(value);
+	} else if (macro->serdestype == SPX5_SDT_10G) {
+		value = sdx5_rd(priv, SD10G_LANE_LANE_DF(macro->stpidx));
Quoted 8 lines

drivers/phy/microchip/sparx5_serdes.c line 2191

Quoted 8 lines
drivers/phy/microchip/sparx5_serdes.c new file +8 -0
+		analog_sd = SD10G_LANE_LANE_DF_PMA2PCS_RXEI_FILTERED_GET(value);
+	} else {
+		value = sdx5_rd(priv, SD25G_LANE_LANE_DE(macro->stpidx));
+		analog_sd = SD25G_LANE_LANE_DE_LN_PMA_RXEI_GET(value);
+	}
+	/* Link up is when analog_sd == 0 */
+	return analog_sd;
+}

You still have not Cc'd me on your patches. Please can you either:

1) use get_maintainer.pl to find out whom you should be sending your patches to
or
2) include me in your cc for this patch set as phylink maintainer in your patch set so I can review your use of phylink.

Consider your patches NAK'd until you send them to me so that I can review them.

Thanks.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
#6 lore raw

Re: [PATCH v8 3/4] phy: Add Sparx5 ethernet serdes PHY driver

Hi Russell,

Quoted 8 lines · Russell King - ARM Linux admin

You still have not Cc'd me on your patches. Please can you either:

1) use get_maintainer.pl to find out whom you should be sending your patches to
or
2) include me in your cc for this patch set as phylink maintainer in your patch set so I can review your use of phylink.

Note that this series is different from the network (switchdev) driver series and doesn't make use of phylink.

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#7 lore raw

Re: [PATCH v8 3/4] phy: Add Sparx5 ethernet serdes PHY driver

Quoted 12 lines · Alexandre Belloni

Hi Russell,

Quoted 8 lines · Russell King - ARM Linux admin

You still have not Cc'd me on your patches. Please can you either:

1) use get_maintainer.pl to find out whom you should be sending your patches to
or
2) include me in your cc for this patch set as phylink maintainer in your patch set so I can review your use of phylink.

Quoted 2 lines

Note that this series is different from the network (switchdev) driver series and doesn't make use of phylink.

Oh, didn't realise that; it's difficult to tell when you don't get the original messages, and only end up being Cc'd on a very trimmed down reply.

Email is a broken form of communication...

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
author maintainer
#8 lore raw

Re: [PATCH v8 3/4] phy: Add Sparx5 ethernet serdes PHY driver

In reply to Russell King - ARM Linux admin
Quoted 61 lines · Russell King - ARM Linux admin

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 41 lines · Andrew Lunn

drivers/phy/microchip/sparx5_serdes.c line 620

Quoted 12 lines
drivers/phy/microchip/sparx5_serdes.c new file +12 -0
+/* map from SD25G28 interface width to configuration value */
+static u8 sd25g28_get_iw_setting(const u8 interface_width)
+{
+   switch (interface_width) {
+   case 10: return 0;
+   case 16: return 1;
+   case 32: return 3;
+   case 40: return 4;
+   case 64: return 5;
+   default:
+           pr_err("%s: Illegal value %d for interface width\n",
+                  __func__, interface_width);

Please make use of dev_err(phy->dev, so we know which PHY has configuration problems.

Quoted 25 lines
drivers/phy/microchip/sparx5_serdes.c new file +25 -0
+static int sparx5_serdes_validate(struct phy *phy, enum phy_mode mode,
+                                   int submode,
+                                   union phy_configure_opts *opts)
+{
+   struct sparx5_serdes_macro *macro = phy_get_drvdata(phy);
+   struct sparx5_serdes_private *priv = macro->priv;
+   u32 value, analog_sd;
+
+   if (mode != PHY_MODE_ETHERNET)
+           return -EINVAL;
+
+   switch (submode) {
+   case PHY_INTERFACE_MODE_1000BASEX:
+   case PHY_INTERFACE_MODE_SGMII:
+   case PHY_INTERFACE_MODE_QSGMII:
+   case PHY_INTERFACE_MODE_10GBASER:
+           break;
+   default:
+           return -EINVAL;
+   }
+   if (macro->serdestype == SPX5_SDT_6G) {
+           value = sdx5_rd(priv, SD6G_LANE_LANE_DF(macro->stpidx));
+           analog_sd = SD6G_LANE_LANE_DF_PMA2PCS_RXEI_FILTERED_GET(value);
+   } else if (macro->serdestype == SPX5_SDT_10G) {
+           value = sdx5_rd(priv, SD10G_LANE_LANE_DF(macro->stpidx));
Quoted 8 lines

drivers/phy/microchip/sparx5_serdes.c line 2191

Quoted 8 lines
drivers/phy/microchip/sparx5_serdes.c new file +8 -0
+           analog_sd = SD10G_LANE_LANE_DF_PMA2PCS_RXEI_FILTERED_GET(value);
+   } else {
+           value = sdx5_rd(priv, SD25G_LANE_LANE_DE(macro->stpidx));
+           analog_sd = SD25G_LANE_LANE_DE_LN_PMA_RXEI_GET(value);
+   }
+   /* Link up is when analog_sd == 0 */
+   return analog_sd;
+}

You still have not Cc'd me on your patches. Please can you either:

1) use get_maintainer.pl to find out whom you should be sending your patches to
or
2) include me in your cc for this patch set as phylink maintainer in your patch set so I can review your use of phylink.

Quoted 4 lines

Consider your patches NAK'd until you send them to me so that I can review them.

Thanks.

Hi Russell,

I will CC you on the next version of this series. In reality I was just asked by Vladimir Oltean to crosspost to netdev. This is a series for the Generic PHY subsystem.
Sorry about the confusion.

Quoted 4 lines

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

BR
Steen

---------------------------------------
Steen Hegelund
[email protected]

author maintainer
#9 lore raw

Re: [PATCH v8 3/4] phy: Add Sparx5 ethernet serdes PHY driver

In reply to Andrew Lunn
Quoted 17 lines · Andrew Lunn

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

drivers/phy/microchip/sparx5_serdes.c line 620

Quoted 12 lines
drivers/phy/microchip/sparx5_serdes.c new file +12 -0
+/* map from SD25G28 interface width to configuration value */
+static u8 sd25g28_get_iw_setting(const u8 interface_width)
+{
+     switch (interface_width) {
+     case 10: return 0;
+     case 16: return 1;
+     case 32: return 3;
+     case 40: return 4;
+     case 64: return 5;
+     default:
+             pr_err("%s: Illegal value %d for interface width\n",
+                    __func__, interface_width);

Please make use of dev_err(phy->dev, so we know which PHY has configuration problems.

I will update that.

Quoted 43 lines
Quoted 24 lines
drivers/phy/microchip/sparx5_serdes.c new file +23 -0
+static int sparx5_serdes_validate(struct phy *phy, enum phy_mode mode,
+                                     int submode,
+                                     union phy_configure_opts *opts)
+{
+     struct sparx5_serdes_macro *macro = phy_get_drvdata(phy);
+     struct sparx5_serdes_private *priv = macro->priv;
+     u32 value, analog_sd;
+
+     if (mode != PHY_MODE_ETHERNET)
+             return -EINVAL;
+
+     switch (submode) {
+     case PHY_INTERFACE_MODE_1000BASEX:
+     case PHY_INTERFACE_MODE_SGMII:
+     case PHY_INTERFACE_MODE_QSGMII:
+     case PHY_INTERFACE_MODE_10GBASER:
+             break;
+     default:
+             return -EINVAL;
+     }
+     if (macro->serdestype == SPX5_SDT_6G) {
+             value = sdx5_rd(priv, SD6G_LANE_LANE_DF(macro->stpidx));
+             analog_sd = SD6G_LANE_LANE_DF_PMA2PCS_RXEI_FILTERED_GET(value);

drivers/phy/microchip/sparx5_serdes.c line 2191

Quoted 10 lines
drivers/phy/microchip/sparx5_serdes.c new file +10 -0
+     } else if (macro->serdestype == SPX5_SDT_10G) {
+             value = sdx5_rd(priv, SD10G_LANE_LANE_DF(macro->stpidx));
+             analog_sd = SD10G_LANE_LANE_DF_PMA2PCS_RXEI_FILTERED_GET(value);
+     } else {
+             value = sdx5_rd(priv, SD25G_LANE_LANE_DE(macro->stpidx));
+             analog_sd = SD25G_LANE_LANE_DE_LN_PMA_RXEI_GET(value);
+     }
+     /* Link up is when analog_sd == 0 */
+     return analog_sd;
+}

What i have not yet seen is how this code plugs together with phylink_pcs_ops?

Can this hardware also be used for SATA, USB? As far as i understand, the Marvell Comphy is multi-purpose, it is used for networking, USB, and SATA, etc. Making it a generic PHY then makes sense, because different subsystems need to use it.

Quoted 5 lines

But it looks like this is for networking only? So i'm wondering if it belongs in driver/net/pcs and it should be accessed using phylink_pcs_ops?

Andrew

This is a PHY that communicates on a SerDes link to an ethernet PHY or a SFP. So I took the lead from earlier work: the Microsemi Ocelot SerDes driver, and added the Sparx5 SerDes PHY driver here since it is very similar in intent. It is not an ethernet PHY as such.

BR
Steen

---------------------------------------
Steen Hegelund
[email protected]

#10 lore raw

Re: [PATCH v8 3/4] phy: Add Sparx5 ethernet serdes PHY driver

Quoted 13 lines · Steen Hegelund
Quoted 12 lines · Andrew Lunn

What i have not yet seen is how this code plugs together with phylink_pcs_ops?

Can this hardware also be used for SATA, USB? As far as i understand, the Marvell Comphy is multi-purpose, it is used for networking, USB, and SATA, etc. Making it a generic PHY then makes sense, because different subsystems need to use it.

But it looks like this is for networking only? So i'm wondering if it belongs in driver/net/pcs and it should be accessed using phylink_pcs_ops?

Quoted 6 lines
Quoted 1 line

Andrew

This is a PHY that communicates on a SerDes link to an ethernet PHY or a SFP. So I took the lead from earlier work: the Microsemi Ocelot SerDes driver, and added the Sparx5 SerDes PHY driver here since it is very similar in intent. It is not an ethernet PHY as such.

Okay, that is the normal situation in real hardware:

MAC <---> PCS PHY <---> SerDes PHY <---> SerDes lanes

where the PCS PHY handles the protocol level, and the SerDes PHY handles the clocking and electrical characteristics of the SerDes lanes.

Maybe we should ask for a diagram of the setups when new support is submitted to make the process of understanding the hardware easier?

Signature · 7 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#11 lore raw

Re: [PATCH v8 3/4] phy: Add Sparx5 ethernet serdes PHY driver

In reply to Andrew Lunn
Quoted 17 lines · Andrew Lunn

drivers/phy/microchip/sparx5_serdes.c line 2191

Quoted 13 lines
drivers/phy/microchip/sparx5_serdes.c new file +13 -0
+	if (macro->serdestype == SPX5_SDT_6G) {
+		value = sdx5_rd(priv, SD6G_LANE_LANE_DF(macro->stpidx));
+		analog_sd = SD6G_LANE_LANE_DF_PMA2PCS_RXEI_FILTERED_GET(value);
+	} else if (macro->serdestype == SPX5_SDT_10G) {
+		value = sdx5_rd(priv, SD10G_LANE_LANE_DF(macro->stpidx));
+		analog_sd = SD10G_LANE_LANE_DF_PMA2PCS_RXEI_FILTERED_GET(value);
+	} else {
+		value = sdx5_rd(priv, SD25G_LANE_LANE_DE(macro->stpidx));
+		analog_sd = SD25G_LANE_LANE_DE_LN_PMA_RXEI_GET(value);
+	}
+	/* Link up is when analog_sd == 0 */
+	return analog_sd;
+}

What i have not yet seen is how this code plugs together with phylink_pcs_ops?

Quoted 9 lines

Can this hardware also be used for SATA, USB? As far as i understand, the Marvell Comphy is multi-purpose, it is used for networking, USB, and SATA, etc. Making it a generic PHY then makes sense, because different subsystems need to use it.

But it looks like this is for networking only? So i'm wondering if it belongs in driver/net/pcs and it should be accessed using phylink_pcs_ops?

Ocelot had PCie on the phys, doesn't Sparx5 have it?

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author maintainer
#12 lore raw

Re: [PATCH v8 3/4] phy: Add Sparx5 ethernet serdes PHY driver

Quoted 25 lines · Alexandre Belloni

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 22 lines · Andrew Lunn

drivers/phy/microchip/sparx5_serdes.c line 2191

Quoted 13 lines
drivers/phy/microchip/sparx5_serdes.c new file +13 -0
+   if (macro->serdestype == SPX5_SDT_6G) {
+           value = sdx5_rd(priv, SD6G_LANE_LANE_DF(macro->stpidx));
+           analog_sd = SD6G_LANE_LANE_DF_PMA2PCS_RXEI_FILTERED_GET(value);
+   } else if (macro->serdestype == SPX5_SDT_10G) {
+           value = sdx5_rd(priv, SD10G_LANE_LANE_DF(macro->stpidx));
+           analog_sd = SD10G_LANE_LANE_DF_PMA2PCS_RXEI_FILTERED_GET(value);
+   } else {
+           value = sdx5_rd(priv, SD25G_LANE_LANE_DE(macro->stpidx));
+           analog_sd = SD25G_LANE_LANE_DE_LN_PMA_RXEI_GET(value);
+   }
+   /* Link up is when analog_sd == 0 */
+   return analog_sd;
+}

What i have not yet seen is how this code plugs together with phylink_pcs_ops?

Can this hardware also be used for SATA, USB? As far as i understand, the Marvell Comphy is multi-purpose, it is used for networking, USB, and SATA, etc. Making it a generic PHY then makes sense, because different subsystems need to use it.

Quoted 6 lines
Quoted 4 lines

But it looks like this is for networking only? So i'm wondering if it belongs in driver/net/pcs and it should be accessed using phylink_pcs_ops?

Ocelot had PCie on the phys, doesn't Sparx5 have it?

Yes Ocelot has that, but on Sparx5 the PCIe is separate...

Quoted 5 lines

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

BR
Steen

---------------------------------------
Steen Hegelund
[email protected]

author maintainer
#13 lore raw

PATCH v8 4/4 arm64: dts: sparx5: Add Sparx5 serdes driver node

In reply to Steen Hegelund

Add Sparx5 serdes driver node, and enable it generally for all reference boards.

---
 arch/arm64/boot/dts/microchip/sparx5.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/microchip/sparx5.dtsi +8 -0
index 8e7724d413fb..797601a9d542 100644
@@ -287,5 +287,13 @@ tmon0: tmon@610508110 {
 			#thermal-sensor-cells = <0>;
 			clocks = <&ahb_clk>;
 		};
+
+		serdes: serdes@10808000 {
+			compatible = "microchip,sparx5-serdes";
+			#phy-cells = <1>;
+			clocks = <&sys_clk>;
+			reg = <0x6 0x10808000 0x5d0000>;
+		};
+
 	};
 };
Signature · 1 line
2.29.2