Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1936597ima; Thu, 25 Oct 2018 07:16:25 -0700 (PDT) X-Google-Smtp-Source: AJdET5d/yfCvJxnqmVTksKy+LJVDltTR6kdzaCC6ZyycsOYeIWRBg2mYKuha8TctbCgKLJbuHBaU X-Received: by 2002:a63:cb51:: with SMTP id m17-v6mr1608350pgi.105.1540476984978; Thu, 25 Oct 2018 07:16:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540476984; cv=none; d=google.com; s=arc-20160816; b=gCTbw1mHeyQR5XKD4S7w1fsQwZTrUfA0Hbmn2m/uanJVGzn6HeMquqTrqBSF1SX6la uuAyyIWdaxJeGVm6sYkLrxSazHKI3xshh8SYCEmGGnnCZ1PAKr6jeySFuDfOOFJj+0ya 31IpLvB3WtiDQbQqrfoVGXC7M3wb5gReUlcOXinARgGKmgA2j+6eCzqox4P05Vm3LhJs MQjglA/hd2GQjmptyCc9W6P58JDstqedrl3vkjRr3ZQgNUqmlG0u5s/0vNc39xFCV/nK mtW1b1x+RmcEmG4gPvL78pZRruV2oYdeHtnbXHtbYxhHMGrzQIYnNn92vMHVaZy2B24t TDuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=fYjAl9fH6DyBgljU6V2VNz2Ic3M0cRuFeBgoJe6HBQQ=; b=do4EjEC293KeInojduBRG80QOzYNkUsjCyC/1/MEBxkcb9Mk769eEL57lRRLEZoth4 6qd9RGR0Am6ep3n+5dKO2z4XLVsmlFwoMgJVjhhp+mn1E/mesC13nzb8sgkvvAPiad5I UqtvLEbwPNXTP1HvPTnsgMmc4TppltmbjnGI7L6C8vR7v3O8LXQxdbr5TDonN2ODWP0g pmLdz+zGtPA5p77qqENgXX5sCouQocW//b1qcyM+wgILq32pfCTl7nB4FkJacVDlngPt xxlKSm9WZrtIOJUzOIGRk45KkVK9TcD6+7NV4jzA8prk+nguK0jnZ41Cw8XAuuHch8Jo 9Ijg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=h7IUttWF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z68-v6si8413654pfb.280.2018.10.25.07.15.44; Thu, 25 Oct 2018 07:16:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=h7IUttWF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728030AbeJYWoN (ORCPT + 99 others); Thu, 25 Oct 2018 18:44:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:52816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727739AbeJYWoL (ORCPT ); Thu, 25 Oct 2018 18:44:11 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4E23720840; Thu, 25 Oct 2018 14:11:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540476676; bh=grlzPBikMCQv4wQt+DFaXc7sS18hanNF2eHQmcywSao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h7IUttWFo5Q3unrid6+iQpjAh27xc4Vf0yWDs/twya/YTlgochMWcxrGHKjbb31M7 /9l6pfLju4qkImdoO8DalAv7aGZBrd4K56ADVmPleUvAKeqbZTyq5GBXj+IeM1JnFq EH30XAOyyWhEIy6BBVAQTVB9PAbK3Cyguia+uApY= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Kevin Hao , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL 4.14 15/46] net: phy: Add general dummy stubs for MMD register access Date: Thu, 25 Oct 2018 10:10:22 -0400 Message-Id: <20181025141053.213330-15-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141053.213330-1-sashal@kernel.org> References: <20181025141053.213330-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kevin Hao [ Upstream commit 5df7af85ecd88e8b5f1f31d6456c3cf38a8bbdda ] For some phy devices, even though they don't support the MMD extended register access, it does have some side effect if we are trying to read/write the MMD registers via indirect method. So introduce general dummy stubs for MMD register access which these devices can use to avoid such side effect. Fixes: b6b5e8a69118 ("gianfar: Disable EEE autoneg by default") Signed-off-by: Kevin Hao Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/phy/phy_device.c | 17 +++++++++++++++++ include/linux/phy.h | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index a174d05a9752..fe76e2c4022a 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1641,6 +1641,23 @@ int genphy_config_init(struct phy_device *phydev) } EXPORT_SYMBOL(genphy_config_init); +/* This is used for the phy device which doesn't support the MMD extended + * register access, but it does have side effect when we are trying to access + * the MMD register via indirect method. + */ +int genphy_read_mmd_unsupported(struct phy_device *phdev, int devad, u16 regnum) +{ + return -EOPNOTSUPP; +} +EXPORT_SYMBOL(genphy_read_mmd_unsupported); + +int genphy_write_mmd_unsupported(struct phy_device *phdev, int devnum, + u16 regnum, u16 val) +{ + return -EOPNOTSUPP; +} +EXPORT_SYMBOL(genphy_write_mmd_unsupported); + int genphy_suspend(struct phy_device *phydev) { int value; diff --git a/include/linux/phy.h b/include/linux/phy.h index dca9e926b88f..efc04c2d92c9 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -879,6 +879,10 @@ static inline int genphy_no_soft_reset(struct phy_device *phydev) { return 0; } +int genphy_read_mmd_unsupported(struct phy_device *phdev, int devad, + u16 regnum); +int genphy_write_mmd_unsupported(struct phy_device *phdev, int devnum, + u16 regnum, u16 val); /* Clause 45 PHY */ int genphy_c45_restart_aneg(struct phy_device *phydev); -- 2.17.1