Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp162818pxy; Tue, 20 Apr 2021 23:22:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0YlSAv+wcUcYT24PpbFxVBz/BuOpSmuuv/6hfHdU/Dv7ravBJ7FPtA5u1uJO7Jb9dnBSc X-Received: by 2002:a17:906:151a:: with SMTP id b26mr31346303ejd.492.1618986149077; Tue, 20 Apr 2021 23:22:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618986149; cv=none; d=google.com; s=arc-20160816; b=Uar/3eN9+9MINDTntFjR5iKtQIyLZo5iYfssBQ/LngT/RJRsrk9b2njtnT9uq3ysNc HYO8oxaymDi2R1H+li60+bUQy4+CkFzFVEmFFaFIB7fAQatUXSiv5vSOmQ8l53b6jmTX jDDGtw0rOqPWNW7qdGwj3jUVaeXvMERHcuPVQszj2jCQaolS/OwYP9RgqFqaaFvJHjm6 08ES/HmNFPfJgmYhXf4s0NdBDzscrmENYKwayUNbjvH4kMkFidsET+AQDVCz1/CawUpB qXsmz2j/6zEQvvc//AfQ2P4jlVR2A3LSlQbajrDkII1xhDRc/1iwTOAAgELd5WWzOaF/ lz6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=l5iUsYGgVLUyRNaa/V+DOeyQPpVOLtrTNl65e2SsueI=; b=ahCvssT+VKqOexY80DDKEHWdhGepWi9+COtAMHQ4psgVDKbgDRejtu6aWazPeMxlzg B6wvSECyR+U/ymNOn+iZFZ0GzDg2iCQrZ6dT15tDrJVX5GTw+NzJTCSZEeWFsqACMwbi 5P+45trPKuronKDNLboMoO0PeKG3KYDocqwbI+/dKPjYHYHLO1vPLK7TdaYtwJfblQi4 fKfGa/AMXoDInxRk12CPNjojfZoosDilEsFkq3d04I7EXDb4cK3R4JjG9sh7L8LOus38 SuQDq7f/U0n49O32USzSzmws9KXI2S5Ly8/Fw0RVooUhCpmr86VgLpIU71z58ihw5cnn wNyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i5si1175939edc.355.2021.04.20.23.22.05; Tue, 20 Apr 2021 23:22:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235317AbhDUFv7 (ORCPT + 99 others); Wed, 21 Apr 2021 01:51:59 -0400 Received: from mxout70.expurgate.net ([194.37.255.70]:39305 "EHLO mxout70.expurgate.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230390AbhDUFv6 (ORCPT ); Wed, 21 Apr 2021 01:51:58 -0400 Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.90) (envelope-from ) id 1lZ5lV-0008PZ-QE; Wed, 21 Apr 2021 07:51:09 +0200 Received: from [195.243.126.94] (helo=securemail.tdt.de) by relay.expurgate.net with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90) (envelope-from ) id 1lZ5lS-0009lB-Q3; Wed, 21 Apr 2021 07:51:06 +0200 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id A9F46240041; Wed, 21 Apr 2021 07:51:05 +0200 (CEST) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id 08AEA240040; Wed, 21 Apr 2021 07:51:05 +0200 (CEST) Received: from mschiller01.dev.tdt.de (unknown [10.2.3.20]) by mail.dev.tdt.de (Postfix) with ESMTPSA id 5A6F520043; Wed, 21 Apr 2021 07:51:03 +0200 (CEST) From: Martin Schiller To: hauke@hauke-m.de, martin.blumenstingl@googlemail.com, f.fainelli@gmail.com, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Schiller Subject: [PATCH net v3] net: phy: intel-xway: enable integrated led functions Date: Wed, 21 Apr 2021 07:50:47 +0200 Message-ID: <20210421055047.22858-1-ms@dev.tdt.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.dev.tdt.de Content-Transfer-Encoding: quoted-printable X-purgate-ID: 151534::1618984267-000063FF-A2736355/0/0 X-purgate-type: clean X-purgate: clean Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Intel xway phys offer the possibility to deactivate the integrated LED function and to control the LEDs manually. If this was set by the bootloader, it must be ensured that the integrated LED function is enabled for all LEDs when loading the driver. Before commit 6e2d85ec0559 ("net: phy: Stop with excessive soft reset") the LEDs were enabled by a soft-reset of the PHY (using genphy_soft_reset). Initialize the XWAY_MDIO_LED with it's default value (which is applied during a soft reset) instead of adding back the soft reset. This brings back the default LED configuration while still preventing an excessive amount of soft resets. Fixes: 6e2d85ec0559 ("net: phy: Stop with excessive soft reset") Signed-off-by: Martin Schiller --- Changes to v2: o Fixed commit message o Fixed email recipients once again. Changes to v1: Added additional email recipients. --- drivers/net/phy/intel-xway.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/phy/intel-xway.c b/drivers/net/phy/intel-xway.c index 6eac50d4b42f..d453ec016168 100644 --- a/drivers/net/phy/intel-xway.c +++ b/drivers/net/phy/intel-xway.c @@ -11,6 +11,18 @@ =20 #define XWAY_MDIO_IMASK 0x19 /* interrupt mask */ #define XWAY_MDIO_ISTAT 0x1A /* interrupt status */ +#define XWAY_MDIO_LED 0x1B /* led control */ + +/* bit 15:12 are reserved */ +#define XWAY_MDIO_LED_LED3_EN BIT(11) /* Enable the integrated function= of LED3 */ +#define XWAY_MDIO_LED_LED2_EN BIT(10) /* Enable the integrated function= of LED2 */ +#define XWAY_MDIO_LED_LED1_EN BIT(9) /* Enable the integrated function = of LED1 */ +#define XWAY_MDIO_LED_LED0_EN BIT(8) /* Enable the integrated function = of LED0 */ +/* bit 7:4 are reserved */ +#define XWAY_MDIO_LED_LED3_DA BIT(3) /* Direct Access to LED3 */ +#define XWAY_MDIO_LED_LED2_DA BIT(2) /* Direct Access to LED2 */ +#define XWAY_MDIO_LED_LED1_DA BIT(1) /* Direct Access to LED1 */ +#define XWAY_MDIO_LED_LED0_DA BIT(0) /* Direct Access to LED0 */ =20 #define XWAY_MDIO_INIT_WOL BIT(15) /* Wake-On-LAN */ #define XWAY_MDIO_INIT_MSRE BIT(14) @@ -159,6 +171,15 @@ static int xway_gphy_config_init(struct phy_device *= phydev) /* Clear all pending interrupts */ phy_read(phydev, XWAY_MDIO_ISTAT); =20 + /* Ensure that integrated led function is enabled for all leds */ + err =3D phy_write(phydev, XWAY_MDIO_LED, + XWAY_MDIO_LED_LED0_EN | + XWAY_MDIO_LED_LED1_EN | + XWAY_MDIO_LED_LED2_EN | + XWAY_MDIO_LED_LED3_EN); + if (err) + return err; + phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDCH, XWAY_MMD_LEDCH_NACS_NONE | XWAY_MMD_LEDCH_SBF_F02HZ | --=20 2.20.1