Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2625679pxa; Mon, 17 Aug 2020 14:46:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMsK76JUJhNrEnqJnMhMtX7JKSJtwh4RyAdCLRY6c3OoijR+FKfa+rYHDo9PM3DWvt3JQE X-Received: by 2002:a17:906:dbd8:: with SMTP id yc24mr16741062ejb.176.1597700769421; Mon, 17 Aug 2020 14:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597700769; cv=none; d=google.com; s=arc-20160816; b=j3KkDAj00j2dwgIlGFNOsFo1vOdO/SLapF9DeuDP2YwBXCLYg1JLUFed2xs3vNUA/x mL1A538F1wl3kMo5SN2Sul2LjCZ947oV9g/5EXxlnTLKT5DKD16WOLUjIvfl3sTAu1gw 0Ge85qEdCqtHzf5UrO/yDy3UZeR3LQ3+Yl7BD/SYhZil4gZrOgxjtNfQ3Kgci0kiQVSt IN63RLJ4PC6UcwX33b+bDFQ1+tVG+wVMt67m5UByQWGaTvH3/HgM02jBC7mg60oC6XJg nArNQgI9uhUyUlRdzVtwcveccTrm4x8wY/baAl8N6goZEVaqNBOLwtICwotn6MpIttSC oXEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=B5GKLCbYpS1aOsfGj4EhPK69KOvgNwfogXvh4ahGAyk=; b=BvJOZ/CDwlc6ffHDQImhKn9NG1oxVvwg/Yvd1NE1kfX3AtIS0Wpu6OFUtmVMI4r3+X p6MMG0QD41bWguh9/c5G0Wpdy1pCVTjS5Qq+rK5xUZA8gW8BPYHyXwpwRE06zZ2DCjV4 u9hWWxlvWiVCzhifIuOZgduqBRR4GGI+4W8NaKc7medw3/pXj7TBKvglFqXy/+KVPEY9 DP7n58mV1C1fPF2PBsdBRdsH7/Fthxb5H+1MSxT7WxZ1N2MvFvMPDJS5sp0zqyY+7u9H VLIbCkAenTuyLiCD0/e/6ebiGPGY11i2rGPaOiYJ1lr/6SemGaNF7KwHJSslBZ9qU8an TWLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="0zH/8mCS"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w14si11881966ejb.720.2020.08.17.14.45.45; Mon, 17 Aug 2020 14:46:09 -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; dkim=pass header.i=@kernel.org header.s=default header.b="0zH/8mCS"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729357AbgHQPYT (ORCPT + 99 others); Mon, 17 Aug 2020 11:24:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:49474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729421AbgHQPXI (ORCPT ); Mon, 17 Aug 2020 11:23:08 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C8BAB22BEA; Mon, 17 Aug 2020 15:23:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597677786; bh=F31uPowNJjNMfFMctdd2MXIKeA3ecNKO28u5QHm02Fg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0zH/8mCSBLbLBey/6Kjkdt5nEF3INkygIgJA4u3PjgCgynQBOleL1BF14zDBIHK5A T2aaqd8gLO4kUFghObV+KkkVZI6I5wQmB7IH/zMyt52IFOZx2Yc7WvpAVWmD8xARok q47A/tNeUiE9k8ZNwx7aAQ54Ny+hWFTScOqTzEPA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antoine Tenart , "David S. Miller" , Sasha Levin Subject: [PATCH 5.8 107/464] net: phy: mscc: restore the base page in vsc8514/8584_config_init Date: Mon, 17 Aug 2020 17:11:00 +0200 Message-Id: <20200817143838.922996158@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Antoine Tenart [ Upstream commit 6119dda34e5d0821959e37641b287576826b6378 ] In the vsc8584_config_init and vsc8514_config_init, the base page is set to 'GPIO', configuration is done, and the page is never explicitly restored to the standard page. No bug was triggered as it turns out helpers called in those config_init functions do modify the base page, and set it back to standard. But that is dangerous and any modification to those functions would introduce bugs. This patch fixes this, to improve maintenance, by restoring the base page to 'standard' once 'GPIO' accesses are completed. Signed-off-by: Antoine Tenart Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/phy/mscc/mscc_main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c index 5ddc44f87eaf0..8f5f2586e7849 100644 --- a/drivers/net/phy/mscc/mscc_main.c +++ b/drivers/net/phy/mscc/mscc_main.c @@ -1379,6 +1379,11 @@ static int vsc8584_config_init(struct phy_device *phydev) if (ret) goto err; + ret = phy_base_write(phydev, MSCC_EXT_PAGE_ACCESS, + MSCC_PHY_PAGE_STANDARD); + if (ret) + goto err; + if (!phy_interface_is_rgmii(phydev)) { val = PROC_CMD_MCB_ACCESS_MAC_CONF | PROC_CMD_RST_CONF_PORT | PROC_CMD_READ_MOD_WRITE_PORT; @@ -1751,7 +1756,11 @@ static int vsc8514_config_init(struct phy_device *phydev) val &= ~MAC_CFG_MASK; val |= MAC_CFG_QSGMII; ret = phy_base_write(phydev, MSCC_PHY_MAC_CFG_FASTLINK, val); + if (ret) + goto err; + ret = phy_base_write(phydev, MSCC_EXT_PAGE_ACCESS, + MSCC_PHY_PAGE_STANDARD); if (ret) goto err; -- 2.25.1