From patchwork Fri Nov 18 00:15:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 13047509 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 104D7C433FE for ; Fri, 18 Nov 2022 00:17:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2O5VGOcj1cemk28EnSzAr1Cq+/W1x/TZ8T5fUq1+Zps=; b=DY3Nh/Bhy90/eC gRxUw8CG3iftuHYMfz8iXIJQcvrehlNVg4nPSmMZAZGMD1LeocC8XQ/8KxkhMlziTWUBnZtxQhdn1 d7oCxWa09dFGiTJTFmlXB6ibe3PU/tG7kFp5DQCAaGmd9pgbd70cpx0b0wWsE66M0D0acw71LWZCp d9679+hcUGYSyczCKozCoqRLBy+zW3tmCQEFN6jEnR/vc0am4n053utW0hm5n7Ics2CtF/IejaAY1 +5VVYOBf3B4t+ZvqDpHBRRsum+owUXeBZsrekqms1XfziI3KQOcGfNwMTHa5bi0WNGMBYeWv543dW WmY4Dd4sjf4OUkm6/UAA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovp3U-000rkG-4o; Fri, 18 Nov 2022 00:16:28 +0000 Received: from finn.gateworks.com ([108.161.129.64] helo=finn.localdomain) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovp31-000rdC-Ff for linux-arm-kernel@lists.infradead.org; Fri, 18 Nov 2022 00:16:02 +0000 Received: from 068-189-091-139.biz.spectrum.com ([68.189.91.139] helo=tharvey.pdc.gateworks.com) by finn.localdomain with esmtp (Exim 4.93) (envelope-from ) id 1ovp2t-000nxs-MB; Fri, 18 Nov 2022 00:15:51 +0000 From: Tim Harvey To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Rob Herring , Krzysztof Kozlowski Cc: Tim Harvey Subject: [PATCH 1/3] dt-bindings: net: phy: dp83867: add LED mode property Date: Thu, 17 Nov 2022 16:15:46 -0800 Message-Id: <20221118001548.635752-2-tharvey@gateworks.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221118001548.635752-1-tharvey@gateworks.com> References: <20221118001548.635752-1-tharvey@gateworks.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221117_161559_543346_3D4714C9 X-CRM114-Status: UNSURE ( 8.40 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add description for new property ti,led-modes in binding file. Signed-off-by: Tim Harvey --- .../devicetree/bindings/net/ti,dp83867.yaml | 6 ++++++ include/dt-bindings/net/ti-dp83867.h | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/Documentation/devicetree/bindings/net/ti,dp83867.yaml b/Documentation/devicetree/bindings/net/ti,dp83867.yaml index b8c0e4b5b494..8b84c34d389f 100644 --- a/Documentation/devicetree/bindings/net/ti,dp83867.yaml +++ b/Documentation/devicetree/bindings/net/ti,dp83867.yaml @@ -118,6 +118,12 @@ properties: Transmitt FIFO depth- see dt-bindings/net/ti-dp83867.h for applicable values. + ti,led-modes: + description: | + List of LED modes - see dt-bindings/net/ti-dp83867.h for applicable + values. + $ref: schemas/types.yaml#/definitions/uint32-array + required: - reg diff --git a/include/dt-bindings/net/ti-dp83867.h b/include/dt-bindings/net/ti-dp83867.h index 6fc4b445d3a1..ea3e17b27427 100644 --- a/include/dt-bindings/net/ti-dp83867.h +++ b/include/dt-bindings/net/ti-dp83867.h @@ -50,4 +50,20 @@ #define DP83867_CLK_O_SEL_REF_CLK 0xC /* Special flag to indicate clock should be off */ #define DP83867_CLK_O_SEL_OFF 0xFFFFFFFF + +/* LED_CFG - LED configuration selection */ +#define DP83867_LED_SEL_LINK 0 +#define DP83867_LED_SEL_ACT 1 +#define DP83867_LED_SEL_ACT_TX 2 +#define DP83867_LED_SEL_ACT_RX 3 +#define DP83867_LED_SEL_COL 4 +#define DP83867_LED_SEL_LINK_1000BT 5 +#define DP83867_LED_SEL_LINK_100BT 6 +#define DP83867_LED_SEL_LINK_10BT 7 +#define DP83867_LED_SEL_LINK_10_100BT 8 +#define DP83867_LED_SEL_LINK_100_1000BT 9 +#define DP83867_LED_SEL_FULL_DUPLEX 10 +#define DP83867_LED_SEL_LINK_ACT 11 +#define DP83867_LED_SEL_ERR_TX_RX 13 +#define DP83867_LED_SEL_ERR_RX 14 #endif From patchwork Fri Nov 18 00:15:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 13047508 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F0475C433FE for ; Fri, 18 Nov 2022 00:17:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TJtK4C9o3ZbNUjyosd8Dkc001Sokj/G12zvAbVT/VX0=; b=LH2/h8r+Ds657N ghPg7JsaqqbSG9V8VuIlO7VZSuhcuJy5yuRcDkeVJlvJpEGHSQO6lPbM5QQhFKl8YZgj1aqOR8CGk 9nUPEBnhGhram1RZBEqxX8EPo+zDHpnLtsUtJWS+H6iTESjyWxpEMWiraCG7jCV6BysFgVapv3/JC ryuq12FV6LmOEPInGEsxsCg8TEyg+hgqdgiVpYWA9Osv17PKfRPm7Y4gSAMGcUodcKcHC9jjYC0MQ GdDUEPywTbpGDEQY+IgQHOP5BhnUQs1gKgxSP2Sy3pc1LLtOxfJsf2+/2+63a0ThV4wYdOo21R6KP P6EaLjoqRYINw9Kt8nVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovp3L-000rhv-Np; Fri, 18 Nov 2022 00:16:19 +0000 Received: from finn.gateworks.com ([108.161.129.64] helo=finn.localdomain) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovp31-000rdS-Ey for linux-arm-kernel@lists.infradead.org; Fri, 18 Nov 2022 00:16:01 +0000 Received: from 068-189-091-139.biz.spectrum.com ([68.189.91.139] helo=tharvey.pdc.gateworks.com) by finn.localdomain with esmtp (Exim 4.93) (envelope-from ) id 1ovp2u-000nxs-JY; Fri, 18 Nov 2022 00:15:52 +0000 From: Tim Harvey To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Rob Herring , Krzysztof Kozlowski Cc: Tim Harvey Subject: [PATCH 2/3] net: phy: dp83867: add LED mode configuration via dt Date: Thu, 17 Nov 2022 16:15:47 -0800 Message-Id: <20221118001548.635752-3-tharvey@gateworks.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221118001548.635752-1-tharvey@gateworks.com> References: <20221118001548.635752-1-tharvey@gateworks.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221117_161559_535267_B834E026 X-CRM114-Status: GOOD ( 15.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add configuration of LED modes per device-tree property ti,led-modes. Signed-off-by: Tim Harvey --- drivers/net/phy/dp83867.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c index 6939563d3b7c..008941a8d6aa 100644 --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c @@ -26,6 +26,7 @@ #define MII_DP83867_MICR 0x12 #define MII_DP83867_ISR 0x13 #define DP83867_CFG2 0x14 +#define DP83867_LEDCR1 0x18 #define DP83867_CFG3 0x1e #define DP83867_CTRL 0x1f @@ -150,6 +151,10 @@ /* FLD_THR_CFG */ #define DP83867_FLD_THR_CFG_ENERGY_LOST_THR_MASK 0x7 +/* LED Configuration 1 bits */ +#define DP83867_LED_MODE_SHIFT 4 +#define DP83867_LED_MODE_MASK 0xf + enum { DP83867_PORT_MIRROING_KEEP, DP83867_PORT_MIRROING_EN, @@ -167,6 +172,7 @@ struct dp83867_private { bool set_clk_output; u32 clk_output_sel; bool sgmii_ref_clk_en; + int led_modes[4]; }; static int dp83867_ack_interrupt(struct phy_device *phydev) @@ -573,7 +579,7 @@ static int dp83867_of_init(struct phy_device *phydev) struct dp83867_private *dp83867 = phydev->priv; struct device *dev = &phydev->mdio.dev; struct device_node *of_node = dev->of_node; - int ret; + int ret, led; if (!of_node) return -ENODEV; @@ -658,6 +664,13 @@ static int dp83867_of_init(struct phy_device *phydev) return -EINVAL; } + if (of_property_read_u32_array(of_node, "ti,led-modes", + dp83867->led_modes, + ARRAY_SIZE(dp83867->led_modes))) { + for (led = 0; led < ARRAY_SIZE(dp83867->led_modes); led++) + dp83867->led_modes[led] = -EINVAL; + } + return 0; } #else @@ -665,6 +678,7 @@ static int dp83867_of_init(struct phy_device *phydev) { struct dp83867_private *dp83867 = phydev->priv; u16 delay; + int led; /* For non-OF device, the RX and TX ID values are either strapped * or take from default value. So, we init RX & TX ID values here @@ -682,6 +696,10 @@ static int dp83867_of_init(struct phy_device *phydev) */ dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN / 2; + /* LED mode unconfigured */ + for (led = 0; led < ARRAY_SIZE(dp83867->led_modes); led++) + dp83867->led_modes[led] = -EINVAL; + return 0; } #endif /* CONFIG_OF_MDIO */ @@ -703,7 +721,7 @@ static int dp83867_probe(struct phy_device *phydev) static int dp83867_config_init(struct phy_device *phydev) { struct dp83867_private *dp83867 = phydev->priv; - int ret, val, bs; + int ret, val, bs, led; u16 delay; /* Force speed optimization for the PHY even if it strapped */ @@ -882,6 +900,16 @@ static int dp83867_config_init(struct phy_device *phydev) mask, val); } + /* LED Configuration */ + val = phy_read(phydev, DP83867_LEDCR1); + for (led = 0; led < ARRAY_SIZE(dp83867->led_modes); led++) { + if (dp83867->led_modes[led] != -EINVAL) { + val &= ~(DP83867_LED_MODE_MASK << (DP83867_LED_MODE_SHIFT * led)); + val |= (dp83867->led_modes[led] << (DP83867_LED_MODE_SHIFT * led)); + } + } + phy_write(phydev, DP83867_LEDCR1, val); + return 0; } From patchwork Fri Nov 18 00:15:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 13047507 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E280AC4332F for ; Fri, 18 Nov 2022 00:17:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rnn95E2I1/fbmlsFqXBp3Weel+z3AOAB/s+YuNiOob4=; b=TTxfRqnqdwxJNw hqehSU1KYRbJp81icLY/XSznnBcf1DZDjiwdDSEOQkDjRF3CrO9Izv52Jr8hh6R7Sn1SuCC/Cb2o2 4Ktzw7/p2KqHJE9TVNMowspdQFLknn7WQ/wb/78fugUerLReThYD7IMpqeRjZq8X83BmvQRCyL805 2IW6Gmes3dH760U3nIAk6JC3bONsGSjDBykfwJWM4ROBFJhdpCW7CdDRxtIjBAxNFgYBFaVFF0s1q R1HR0+gbRiufCTshufdcoFPoh1PKYkHVvrXyf08Hy3Vu420X5mMGWYHguwZx3/GqHdIYK+bpQx2xR 0cwGN6CXflgMMquEKZmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovp3D-000rgl-E4; Fri, 18 Nov 2022 00:16:11 +0000 Received: from finn.gateworks.com ([108.161.129.64] helo=finn.localdomain) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovp31-000rdJ-F9 for linux-arm-kernel@lists.infradead.org; Fri, 18 Nov 2022 00:16:00 +0000 Received: from 068-189-091-139.biz.spectrum.com ([68.189.91.139] helo=tharvey.pdc.gateworks.com) by finn.localdomain with esmtp (Exim 4.93) (envelope-from ) id 1ovp2v-000nxs-GZ; Fri, 18 Nov 2022 00:15:53 +0000 From: Tim Harvey To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Rob Herring , Krzysztof Kozlowski Cc: Tim Harvey Subject: [PATCH 3/3] arm64: dts: imx8m*-venice: add dp83867 PHY LED mode configuration Date: Thu, 17 Nov 2022 16:15:48 -0800 Message-Id: <20221118001548.635752-4-tharvey@gateworks.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221118001548.635752-1-tharvey@gateworks.com> References: <20221118001548.635752-1-tharvey@gateworks.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221117_161559_530592_992FF9E7 X-CRM114-Status: UNSURE ( 8.21 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add configuration for dp83867 PHY LED mode via ti,led-modes property. Signed-off-by: Tim Harvey --- arch/arm64/boot/dts/freescale/imx8mm-venice-gw700x.dtsi | 6 ++++++ arch/arm64/boot/dts/freescale/imx8mm-venice-gw7902.dts | 6 ++++++ arch/arm64/boot/dts/freescale/imx8mn-venice-gw7902.dts | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw700x.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw700x.dtsi index c305e325d007..bb9928153ff0 100644 --- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw700x.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw700x.dtsi @@ -111,6 +111,12 @@ ethphy0: ethernet-phy@0 { reg = <0>; ti,rx-internal-delay = ; ti,tx-internal-delay = ; + ti,led-modes = < + DP83867_LED_SEL_LINK + DP83867_LED_SEL_LINK_1000BT + DP83867_LED_SEL_LINK_ACT + DP83867_LED_SEL_LINK + >; tx-fifo-depth = ; rx-fifo-depth = ; }; diff --git a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7902.dts b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7902.dts index 11481e09c75b..d7de555cf5e1 100644 --- a/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7902.dts +++ b/arch/arm64/boot/dts/freescale/imx8mm-venice-gw7902.dts @@ -253,6 +253,12 @@ ethphy0: ethernet-phy@0 { reg = <0>; ti,rx-internal-delay = ; ti,tx-internal-delay = ; + ti,led-modes = < + DP83867_LED_SEL_LINK + DP83867_LED_SEL_LINK_1000BT + DP83867_LED_SEL_LINK_ACT + DP83867_LED_SEL_LINK + >; tx-fifo-depth = ; rx-fifo-depth = ; }; diff --git a/arch/arm64/boot/dts/freescale/imx8mn-venice-gw7902.dts b/arch/arm64/boot/dts/freescale/imx8mn-venice-gw7902.dts index 97582db71ca8..8e61966c8dd0 100644 --- a/arch/arm64/boot/dts/freescale/imx8mn-venice-gw7902.dts +++ b/arch/arm64/boot/dts/freescale/imx8mn-venice-gw7902.dts @@ -248,6 +248,12 @@ ethphy0: ethernet-phy@0 { reg = <0>; ti,rx-internal-delay = ; ti,tx-internal-delay = ; + ti,led-modes = < + DP83867_LED_SEL_LINK + DP83867_LED_SEL_LINK_1000BT + DP83867_LED_SEL_LINK_ACT + DP83867_LED_SEL_LINK + >; tx-fifo-depth = ; rx-fifo-depth = ; };