From patchwork Thu Oct 20 21:00:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyle Moffett X-Patchwork-Id: 120908 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7E9F81007D1 for ; Fri, 21 Oct 2011 08:18:16 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753534Ab1JTVRa (ORCPT ); Thu, 20 Oct 2011 17:17:30 -0400 Received: from 26.241.167.70.in-addr.border.exmeritus.com ([70.167.241.26]:35675 "EHLO border.exmeritus.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753161Ab1JTVNW (ORCPT ); Thu, 20 Oct 2011 17:13:22 -0400 Received: from ysera.exmeritus.com (firewall2.exmeritus.com [10.13.38.2]) by border.exmeritus.com (Postfix) with ESMTP id 2CFACAC087; Thu, 20 Oct 2011 17:03:33 -0400 (EDT) From: Kyle Moffett To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Kyle Moffett , "David S. Miller" , David Decotigny , Stephen Hemminger , Andrew Morton , Lucas De Marchi , Marc Kleine-Budde , Mike Frysinger Subject: [RFC PATCH 15/17] phy_device: Add "port" and "transciever" fields Date: Thu, 20 Oct 2011 17:00:22 -0400 Message-Id: <1319144425-15547-16-git-send-email-Kyle.D.Moffett@boeing.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1319144425-15547-1-git-send-email-Kyle.D.Moffett@boeing.com> References: <1319144425-15547-1-git-send-email-Kyle.D.Moffett@boeing.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Some PHYs have multiple software-selectable inputs and outputs, including RGMII, SGMII, SerDes, etc. New fields are added to the "struct phy_device" for "port" and "transciever" to allow "ethtool" to switch outputs at runtime. The defaults for the new fields are identical to the hardcoded values used previously. This should make no functional changes to the PHY layer behavior, but it will allow later PHY/ethernet drivers to override those fields. Signed-off-by: Kyle Moffett --- drivers/net/phy/phy.c | 4 ++-- drivers/net/phy/phy_device.c | 2 ++ include/linux/phy.h | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index c378f91..5f72055 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -290,9 +290,9 @@ int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd) ethtool_cmd_speed_set(cmd, phydev->speed); cmd->duplex = phydev->duplex; - cmd->port = PORT_MII; + cmd->port = phydev->port; cmd->phy_address = phydev->addr; - cmd->transceiver = XCVR_EXTERNAL; + cmd->transceiver = phydev->transciever; cmd->autoneg = phydev->autoneg; return 0; diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index fc0f315..d01b272 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -141,6 +141,8 @@ static struct phy_device* phy_device_create(struct mii_bus *bus, dev->speed = 0; dev->duplex = -1; + dev->port = PORT_MII; + dev->transceiver = XCVR_EXTERNAL; dev->pause = dev->asym_pause = 0; dev->link = 1; dev->interface = PHY_INTERFACE_MODE_GMII; diff --git a/include/linux/phy.h b/include/linux/phy.h index f07fc1c..0cb300d 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -308,6 +308,10 @@ struct phy_device { u32 supported; u32 advertising; + /* The current port/xcvr info (Copper, Fibre, MII, Direct-Attach) */ + u8 port; + u8 transceiver; + int autoneg; int link_timeout;