From nobody Fri Dec 27 12:16:08 2024 Received: from pp2023.ppsmtp.net (pp2023.ppsmtp.net [132.145.231.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CAD515820C; Mon, 9 Dec 2024 18:22:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=132.145.231.115 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733768546; cv=none; b=lK72yQ17qQj2Cc1yOtJLxhru4rhltLeQtjTWopW3vmiicoZZbR1EVkJOt4ZsJDLOy2z4RAKFwn9Qve8Ib3sx4EHec8a/YaHbRa6UUsY9qjkcZDChC9RLlLNFXuIVPJTtTQSOkTf4MaZ/ddcfRT6bq9RO8/B3Ap/l6dfqc3TOyZU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733768546; c=relaxed/simple; bh=va6KQ6fg6+4pePZiXAcMh5tjrhXgNGFnKfVDcKnT7fM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=CEq2ZySBpAMbJ39GEF5Op1D+gDFsNve1CzlVwWOqoNq22BTU4DoSQcdd1LzmzpQsPD6A0sassV1/AYC4rqeiMHDkNtF0HbjRBxRwBKfGPhXz5wJIMupMkl7IHJNgextGy/l5RXkK6fzLi8I2o0riQ+tyQXECGoXsps3yZ3J4JBk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ifm.com; spf=pass smtp.mailfrom=ifm.com; dkim=pass (2048-bit key) header.d=ifm.com header.i=@ifm.com header.b=UaZKVZH5; arc=none smtp.client-ip=132.145.231.115 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ifm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ifm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ifm.com header.i=@ifm.com header.b="UaZKVZH5" Received: from pps.filterd (pp2023.ppsmtp.internal [127.0.0.1]) by pp2023.ppsmtp.internal (8.18.1.2/8.18.1.2) with ESMTP id 4B9GKEXG031083; Mon, 9 Dec 2024 18:59:10 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ifm.com; h=cc : content-transfer-encoding : content-type : date : from : in-reply-to : message-id : mime-version : references : subject : to; s=pps; bh=ANz80lwx+vllLEbzfRTuYpYF6Snm/gnwOr11NdB56cU=; b=UaZKVZH57aI8hFfGm02adzFqM267nDdcCTkvDZXOCpQClY4Ov42vmpEY3hFN7VMYOk/R 2Yn+ZUlKz+4mB1zVvAno2rrhECn2O0UcTYlfxhysGZTTH45Gbf6G0uUJAdj1CxXLbTE9 FwCssDkm2iaoNgKIQdAD+4gPxbp2gVW+fY5QuqSDuTVeYNciZIwGKYNVHAAAt6t2qCAf Hxp8v49t3gqfp+Zs4Od0yzYSrEJkwJzyqOUWXPKoo9aoNfQ1WuJihDGUIRmcCOzf862C kuVGuqOinL46ixL03fbgowBEUrGbZR78H4cjeqSfNp+OqEkY72wwSx8OG0ud1GsiDWDg JA== From: Fedor Ross Date: Mon, 9 Dec 2024 18:58:51 +0100 Subject: [PATCH net-next 1/2] net: dsa: microchip: Add of config for LED mode for ksz87xx and ksz88x3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20241209-netdev-net-next-ksz8_led-mode-v1-1-c7b52c2ebf1b@ifm.com> References: <20241209-netdev-net-next-ksz8_led-mode-v1-0-c7b52c2ebf1b@ifm.com> In-Reply-To: <20241209-netdev-net-next-ksz8_led-mode-v1-0-c7b52c2ebf1b@ifm.com> To: Woojung Huh , , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , "Jakub Kicinski" , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marek Vasut CC: , , Woojung Huh , , Tristram Ha , Fedor Ross X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733767148; l=3006; i=fedor.ross@ifm.com; s=20241209; h=from:subject:message-id; bh=va6KQ6fg6+4pePZiXAcMh5tjrhXgNGFnKfVDcKnT7fM=; b=S0OlkYm5f8Pq82ohXtFjF3EycdDgTeMv9RewosLf1X1MkJ+SqPCqZ9t+9BFQusQ3DGttdInCY P/Rfx1yN5FrDbTiwwqxTl4HeFwmpX47zwO/F3ESDcwZte5XM23/cJmU X-Developer-Key: i=fedor.ross@ifm.com; a=ed25519; pk=0Va3CWt8QM1HKXUBlspqksLl0ieto8l/GgQJJyNu/ZM= X-ClientProxiedBy: DEESEX10.intra.ifm (172.26.140.25) To DEESEX10.intra.ifm (172.26.140.25) X-Proofpoint-ID: SID=43cyfjur6a QID=43cyfjur6a-1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-09_14,2024-12-09_03,2024-11-22_01 Add support for the led-mode property for the following PHYs which have a single LED mode configuration value. KSZ8765, KSZ8794 and KSZ8795 use register 0x0b bits 5,4 to control the LED configuration. KSZ8863 and KSZ8873 use register 0xc3 bits 5,4 to control the LED configuration. Signed-off-by: Fedor Ross --- drivers/net/dsa/microchip/ksz8.c | 9 +++++++++ drivers/net/dsa/microchip/ksz8_reg.h | 1 + drivers/net/dsa/microchip/ksz_common.c | 2 ++ drivers/net/dsa/microchip/ksz_common.h | 1 + 4 files changed, 13 insertions(+) diff --git a/drivers/net/dsa/microchip/ksz8.c b/drivers/net/dsa/microchip/k= sz8.c index da7110d675583dfb7c9be876d5ec5d12cddcf9b4..6bac134b1ccd9cadf6f878d0e0e= 73f17ed23b45a 100644 --- a/drivers/net/dsa/microchip/ksz8.c +++ b/drivers/net/dsa/microchip/ksz8.c @@ -1898,6 +1898,15 @@ int ksz8_setup(struct dsa_switch *ds) regmap_update_bits(ksz_regmap_8(dev), REG_SW_CTRL_1, SW_AGGR_BACKOFF, SW_AGGR_BACKOFF); =20 + /* Configure LED mode */ + if (dev->led_mode > 3) + dev_warn(dev->dev, "Invalid LED mode %d, supported modes 0..3.\n", + dev->led_mode); + else if (!ksz_is_8895_family(dev)) + ksz_cfg(dev, + ksz_is_ksz88x3(dev) ? REG_SW_PWR_MGMT_LED_MODE : REG_SW_CTRL_9, + dev->led_mode << 4, true); + /* * Make sure unicast VLAN boundary is set as default and * enable no excessive collision drop. diff --git a/drivers/net/dsa/microchip/ksz8_reg.h b/drivers/net/dsa/microch= ip/ksz8_reg.h index 329688603a582b7f9dddc774327036edb54435f7..d04ae01c29b398414739e425d2c= 401ccbcfdac32 100644 --- a/drivers/net/dsa/microchip/ksz8_reg.h +++ b/drivers/net/dsa/microchip/ksz8_reg.h @@ -589,6 +589,7 @@ /* 88x3 specific */ =20 #define REG_SW_INSERT_SRC_PVID 0xC2 +#define REG_SW_PWR_MGMT_LED_MODE 0xC3 =20 /* PME */ =20 diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/micro= chip/ksz_common.c index 920443ee8ffd02380da64cd9e14e867d6210e890..22eb882c7335001aa545c1abe65= f25f4586e2d7f 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -5090,6 +5090,8 @@ int ksz_switch_register(struct ksz_device *dev) } of_node_put(ports); } + of_property_read_u32(dev->dev->of_node, "microchip,led-mode", &dev->led_= mode); + dev->synclko_125 =3D of_property_read_bool(dev->dev->of_node, "microchip,synclko-125"); dev->synclko_disable =3D of_property_read_bool(dev->dev->of_node, diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/micro= chip/ksz_common.h index b3bb75ca0796d208f232455677d338209bdaa97d..906f62b9cdb3677c3f8ece468d6= ae93a3031db6d 100644 --- a/drivers/net/dsa/microchip/ksz_common.h +++ b/drivers/net/dsa/microchip/ksz_common.h @@ -175,6 +175,7 @@ struct ksz_device { u32 chip_id; u8 chip_rev; int cpu_port; /* port connected to CPU */ + unsigned int led_mode; int phy_port_cnt; phy_interface_t compat_interface; bool synclko_125; --=20 2.34.1 From nobody Fri Dec 27 12:16:08 2024 Received: from pp2023.ppsmtp.net (pp2023.ppsmtp.net [132.145.231.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4ACCA146A63; Mon, 9 Dec 2024 18:25:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=132.145.231.115 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733768724; cv=none; b=l8/H3PjtM2BF//+T67+/G192hjnqO5o1L7htJPVIM55NmkA3RvcI+2PR89FW6KKKtVwgaLRPVQ1qlRqYmCw01zuqpDSF1oNGDRUIRgC4Y2frEqnHtTjc8geLS4OjQINUcthBoPPYC1/nevrJzaaSCeKrYKkpz1pN830KP2Ecq/s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733768724; c=relaxed/simple; bh=gLFQw4DMaeJ3d+JdvIzNsbyedDoZCMKcjcOE8enPTXI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=e1dt84fQG+8Rnjll+E/42uJmlMmShx+C4HJsMyhxlbNA6GJ09G7Us9VmHCxmde345Zqs3ECK2kZtmPKujtUVxXctJEp4F2BcXkpYgUtaJ480d0H9QzVU+mbQAvvCzXPztPVPhOY+ZMaVLSOoadCMLpJLF2CZFJq5WQPBn8mpBiY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ifm.com; spf=pass smtp.mailfrom=ifm.com; dkim=pass (2048-bit key) header.d=ifm.com header.i=@ifm.com header.b=tNZlcoTh; arc=none smtp.client-ip=132.145.231.115 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ifm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ifm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ifm.com header.i=@ifm.com header.b="tNZlcoTh" Received: from pps.filterd (pp2023.ppsmtp.internal [127.0.0.1]) by pp2023.ppsmtp.internal (8.18.1.2/8.18.1.2) with ESMTP id 4B9GFPN9001286; Mon, 9 Dec 2024 18:59:11 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ifm.com; h=cc : content-transfer-encoding : content-type : date : from : in-reply-to : message-id : mime-version : references : subject : to; s=pps; bh=lWK9c+ZIejq2822haSA17t/ZFCNoY1YEg/oiU2So7cQ=; b=tNZlcoTh2uzHzDoQHOAKkrfrtQn1ca9SBzdw44QWQZTsuFWz5sBITe7FuJjNnj20BvGP c9zavcIhIYRcySyhb1TAVeNohwT5JjpeEoKjhUiT0T5CJYcCDqYl3TXTNMO8ZPoQRs3t sBXk3zA99LtdtQO41RYhdwSoc1PMYPqig/XIqD1RqDofaVA60J0YMZ+4lhmTXeQ+/Rol IdwxrBNJPLZiCJueTSOj19fJJDVWu8ipm+/AFKapJq2AXIafUKbVUiYzIjQMBPbFZ6Js sRiiW1Q7bVWlA0AGbjt960BVj/fOAPFeZL7slr3EDKqnpQvGhv5ug/EPMQYSEHhX2FKx Zg== From: Fedor Ross Date: Mon, 9 Dec 2024 18:58:52 +0100 Subject: [PATCH net-next 2/2] dt-bindings: net: dsa: microchip: Add of config for LED mode for ksz87xx and ksz88x3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20241209-netdev-net-next-ksz8_led-mode-v1-2-c7b52c2ebf1b@ifm.com> References: <20241209-netdev-net-next-ksz8_led-mode-v1-0-c7b52c2ebf1b@ifm.com> In-Reply-To: <20241209-netdev-net-next-ksz8_led-mode-v1-0-c7b52c2ebf1b@ifm.com> To: Woojung Huh , , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , "Jakub Kicinski" , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marek Vasut CC: , , Woojung Huh , , Tristram Ha , Fedor Ross X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733767148; l=4792; i=fedor.ross@ifm.com; s=20241209; h=from:subject:message-id; bh=gLFQw4DMaeJ3d+JdvIzNsbyedDoZCMKcjcOE8enPTXI=; b=SWttvsIg5FKxiPzfoKRqznDuYn13YdrZFq2Dcg/fdpa3VONWyIwXv2ssA8NFPiFuPadQFguT8 uTAbCDFdCBzDISHBx/lDA4TcfMFVyvJ+vAIlG6ze724oEfKJR/c5qbQ X-Developer-Key: i=fedor.ross@ifm.com; a=ed25519; pk=0Va3CWt8QM1HKXUBlspqksLl0ieto8l/GgQJJyNu/ZM= X-ClientProxiedBy: DEESEX10.intra.ifm (172.26.140.25) To DEESEX10.intra.ifm (172.26.140.25) X-Proofpoint-ID: SID=43cyfjur6c QID=43cyfjur6c-1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-09_14,2024-12-09_03,2024-11-22_01 Add support for the led-mode property for the following PHYs which have a single LED mode configuration value. KSZ8765, KSZ8794 and KSZ8795 use register 0x0b bits 5,4 to control the LED configuration. KSZ8863 and KSZ8873 use register 0xc3 bits 5,4 to control the LED configuration. Signed-off-by: Fedor Ross --- .../devicetree/bindings/net/dsa/microchip,ksz.yaml | 89 +++++++++++++-----= ---- 1 file changed, 55 insertions(+), 34 deletions(-) diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml b= /Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml index 62ca63e8a26fda0615cc254acca620f14f47cd10..2420e63d80249e533a34f992a0d= 3d12d926a3aa6 100644 --- a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml +++ b/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml @@ -10,9 +10,6 @@ maintainers: - Marek Vasut - Woojung Huh =20 -allOf: - - $ref: /schemas/spi/spi-peripheral-props.yaml# - properties: # See Documentation/devicetree/bindings/net/dsa/dsa.yaml for a list of a= dditional # required and optional properties. @@ -106,38 +103,62 @@ required: - compatible - reg =20 -if: - not: - properties: - compatible: - enum: - - microchip,ksz8863 - - microchip,ksz8873 -then: - $ref: dsa.yaml#/$defs/ethernet-ports -else: - patternProperties: - "^(ethernet-)?ports$": +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + - if: + not: + properties: + compatible: + enum: + - microchip,ksz8863 + - microchip,ksz8873 + then: + $ref: dsa.yaml#/$defs/ethernet-ports + else: patternProperties: - "^(ethernet-)?port@[0-2]$": - $ref: dsa-port.yaml# - unevaluatedProperties: false - properties: - microchip,rmii-clk-internal: - $ref: /schemas/types.yaml#/definitions/flag - description: - When ksz88x3 is acting as clock provier (via REFCLKO) it - can select between internal and external RMII reference - clock. Internal reference clock means that the clock for - the RMII of ksz88x3 is provided by the ksz88x3 internally - and the REFCLKI pin is unconnected. For the external - reference clock, the clock needs to be fed back to ksz88x3 - via REFCLKI. - If microchip,rmii-clk-internal is set, ksz88x3 will provide - rmii reference clock internally, otherwise reference clock - should be provided externally. - dependencies: - microchip,rmii-clk-internal: [ethernet] + "^(ethernet-)?ports$": + patternProperties: + "^(ethernet-)?port@[0-2]$": + $ref: dsa-port.yaml# + unevaluatedProperties: false + properties: + microchip,rmii-clk-internal: + $ref: /schemas/types.yaml#/definitions/flag + description: + When ksz88x3 is acting as clock provier (via REFCLKO) = it + can select between internal and external RMII reference + clock. Internal reference clock means that the clock f= or + the RMII of ksz88x3 is provided by the ksz88x3 interna= lly + and the REFCLKI pin is unconnected. For the external + reference clock, the clock needs to be fed back to ksz= 88x3 + via REFCLKI. + If microchip,rmii-clk-internal is set, ksz88x3 will pr= ovide + rmii reference clock internally, otherwise reference c= lock + should be provided externally. + dependencies: + microchip,rmii-clk-internal: [ethernet] + - if: + properties: + compatible: + contains: + enum: + - microchip,ksz8765 + - microchip,ksz8794 + - microchip,ksz8795 + - microchip,ksz8863 + - microchip,ksz8873 + then: + properties: + microchip,led-mode: + description: + Set LED mode for ksz8765, ksz8794 or ksz8795 (Register 0x0B, b= its 5..4) + and ksz8863 or ksz8873 (Register 0xC3, bits 5..4). + items: + enum: + - 0 # LED0: Link/ACT, LED1: Speed + - 1 # LED0: Link, LED1: ACT + - 2 # LED0: Link/ACT, LED1: Duplex + - 3 # LED0: Link, LED1: Duplex =20 unevaluatedProperties: false =20 --=20 2.34.1