Received: by 10.213.65.68 with SMTP id h4csp923977imn; Wed, 28 Mar 2018 15:54:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx4848BKIB+zUxYV6/S4ECA7R8uxjolDb3oXM/aPiJxebpGqMjC23A0/6n2cDSQJ0y92pVwMr X-Received: by 2002:a17:902:3204:: with SMTP id y4-v6mr2355566plb.226.1522277691415; Wed, 28 Mar 2018 15:54:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522277691; cv=none; d=google.com; s=arc-20160816; b=QK9PS2jU19xA+GDW8TRSqXRxP2Erw5wKxYRCyMpscA699l6WgAn/D8JSRINP/podP8 wL9Z8pf7kSZ3yO25RVkzWTkd4xDLH7yQHvJv7HEHSlvHT+l9A2jSWhdBuTxD5tCPp1nw Xa01Gd/hh1iFjUUOm3CgTXum7HtkMO9SDYLvwMHLuM/xfz1mAYiSp1p3J1VAfP0IgVyd n/akm0uWaTyB0CbrfkP7RgnftpFpRzEV82gL5UCNXrxkp9xE11TQI51GceU1mIgMYeIC HZ4hOmRhZnCvnKtQgeOebFCf+XqoO8D6FlV1CBHoGxGRNk/OYh0z2YlmnHeVFq/w7zRN HM2A== 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:arc-authentication-results; bh=mVml2QmMV/9LOze+QbdXNU5iUk/+wMYi9e8eJAEkIIw=; b=ky2FT+aR8o3huLZcfdaX5rMdxywf4dZHuuzlMimD2jINoV63lTc0XdhSfOWMzhcceN trDEvvfuYFcrsTQLSf5cAgwsljg8yqBR0Ib/kWI4+ODdB2d39EBVChrTL/wABEM4o9/9 0A7QOMdDSOEjZtqoQOMApHhWi7gaY0gG59k+wg5GpXHHqlcLWVn+Qv2yzGBiNARZ8GQo cgRsx3hRA+7Y/Wrn3C1kXdfLD+AMchB3lp2PO+ELNcYvgDzUIWfaLshW3WApMIMZXYCd j16tQeqqYpCfUChryYY0snRkyGyw+muo+TsY1v0faCvq+bYe5jcd6jIZ/PL18wEGdpng LdUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=C9v+ha1c; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l14si3051028pgn.188.2018.03.28.15.54.37; Wed, 28 Mar 2018 15:54:51 -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=@gmail.com header.s=20161025 header.b=C9v+ha1c; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754057AbeC1Wob (ORCPT + 99 others); Wed, 28 Mar 2018 18:44:31 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:45472 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753365AbeC1WoX (ORCPT ); Wed, 28 Mar 2018 18:44:23 -0400 Received: by mail-pg0-f65.google.com with SMTP id y63so1747049pgy.12; Wed, 28 Mar 2018 15:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mVml2QmMV/9LOze+QbdXNU5iUk/+wMYi9e8eJAEkIIw=; b=C9v+ha1cX2JcecygVeR1wcgOdtPHW5/osP5bn2ZKtLMApi50ml0MYi6qpKM9PQbpej 9QqeeCLdA7O6XZSkCgEZ7VTJB8EXtpP40oaKqKM/Kkxt09FonjtegQKv7j3aTNVKdMmt nWRIjyl5auQSK2QTbfE7i7mboO+zmmEk8iVydo3xtYQAJtSXOVS7gHJdtf6q+7bjcKPG XKwUBt4zCf2eHKb5qnl4C7We/oYl7CEI7urk3VhicMhbF4jN3xccnyQgyZAlRi578vZh dWFNchaMOmCfgvVo6FKFIGZqzl5xpnQOw36DgK1zxaJ8q1ZlTixito9FXtFfawb5I+G/ VsvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mVml2QmMV/9LOze+QbdXNU5iUk/+wMYi9e8eJAEkIIw=; b=oANpXYjnjNBcyZAef/J/YbGmb5rxbVn73E0aO+bfWPn9Z1YI0Yu5cPPZTJnFUbteAN l5oXtlfK5AnL6ZsjoPoUG9IUwSOMD2xhskSuHNx5ac8fs51mp5J/e6J0nRCmJt1KJ53P ++fLf2yOgi2ITMp75/YQNu67YJ2OYPRHQ/5eeU2jMoFD1XT/t3LbqBXSfLWQ3S+UzdLx JWgtAc9s5B10BZsUDmms6XW9c5Ma5hStw8XEH3E++1Fum+rCFYvgK6v1v3RE0W5stasH UoYjiojRCN9fmL0YS/s4CESOs6l8yeFCU/vgiJ5bwOqO2Ga2kRpHNvxqUZtbW+tS3ysv UNYQ== X-Gm-Message-State: AElRT7HSDJnL/x14f2cmqPN98+DHXZbnkA8qhN8A6cCktCEugI+fvqXJ wJBT0bJpkZmFVEDXuIUwOU8z0p3X X-Received: by 10.98.236.220 with SMTP id e89mr4323335pfm.173.1522277062646; Wed, 28 Mar 2018 15:44:22 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id s4sm8056472pgp.29.2018.03.28.15.44.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Mar 2018 15:44:21 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Thomas Petazzoni , Andrew Lunn , "David S. Miller" , Russell King , linux-kernel@vger.kernel.org (open list), Antoine Tenart , Yan Markman , Stefan Chulski , Maxime Chevallier , Miquel Raynal , Marcin Wojtas Subject: [PATCH net-next v2 1/2] net: phy: phylink: Provide PHY interface to mac_link_{up,down} Date: Wed, 28 Mar 2018 15:44:15 -0700 Message-Id: <20180328224416.6981-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180328224416.6981-1-f.fainelli@gmail.com> References: <20180328224416.6981-1-f.fainelli@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation for having DSA transition entirely to PHYLINK, we need to pass a PHY interface type to the mac_link_{up,down} callbacks because we may have to make decisions on that (e.g: turn on/off RGMII interfaces etc.). We do not pass an entire phylink_link_state because not all parameters (pause, duplex etc.) are defined when the link is down, only link and interface are. Update mvneta accordingly since it currently implements phylink_mac_ops. Acked-by: Russell King Signed-off-by: Florian Fainelli --- drivers/net/ethernet/marvell/mvneta.c | 4 +++- drivers/net/phy/phylink.c | 4 +++- include/linux/phylink.h | 14 +++++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index eaa4bb80f1c9..cd09bde55596 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -3396,7 +3396,8 @@ static void mvneta_set_eee(struct mvneta_port *pp, bool enable) mvreg_write(pp, MVNETA_LPI_CTRL_1, lpi_ctl1); } -static void mvneta_mac_link_down(struct net_device *ndev, unsigned int mode) +static void mvneta_mac_link_down(struct net_device *ndev, unsigned int mode, + phy_interface_t interface) { struct mvneta_port *pp = netdev_priv(ndev); u32 val; @@ -3415,6 +3416,7 @@ static void mvneta_mac_link_down(struct net_device *ndev, unsigned int mode) } static void mvneta_mac_link_up(struct net_device *ndev, unsigned int mode, + phy_interface_t interface, struct phy_device *phy) { struct mvneta_port *pp = netdev_priv(ndev); diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 51a011a349fe..9b1e4721ea3a 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -470,10 +470,12 @@ static void phylink_resolve(struct work_struct *w) if (link_state.link != netif_carrier_ok(ndev)) { if (!link_state.link) { netif_carrier_off(ndev); - pl->ops->mac_link_down(ndev, pl->link_an_mode); + pl->ops->mac_link_down(ndev, pl->link_an_mode, + pl->phy_state.interface); netdev_info(ndev, "Link is Down\n"); } else { pl->ops->mac_link_up(ndev, pl->link_an_mode, + pl->phy_state.interface, pl->phydev); netif_carrier_on(ndev); diff --git a/include/linux/phylink.h b/include/linux/phylink.h index bd137c273d38..e95cc12030fa 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -73,8 +73,10 @@ struct phylink_mac_ops { void (*mac_config)(struct net_device *ndev, unsigned int mode, const struct phylink_link_state *state); void (*mac_an_restart)(struct net_device *ndev); - void (*mac_link_down)(struct net_device *ndev, unsigned int mode); + void (*mac_link_down)(struct net_device *ndev, unsigned int mode, + phy_interface_t interface); void (*mac_link_up)(struct net_device *ndev, unsigned int mode, + phy_interface_t interface, struct phy_device *phy); }; @@ -161,25 +163,31 @@ void mac_an_restart(struct net_device *ndev); * mac_link_down() - take the link down * @ndev: a pointer to a &struct net_device for the MAC. * @mode: link autonegotiation mode + * @interface: link &typedef phy_interface_t mode * * If @mode is not an in-band negotiation mode (as defined by * phylink_autoneg_inband()), force the link down and disable any - * Energy Efficient Ethernet MAC configuration. + * Energy Efficient Ethernet MAC configuration. Interface type + * selection must be done in mac_config(). */ -void mac_link_down(struct net_device *ndev, unsigned int mode); +void mac_link_down(struct net_device *ndev, unsigned int mode, + phy_interface_t interface); /** * mac_link_up() - allow the link to come up * @ndev: a pointer to a &struct net_device for the MAC. * @mode: link autonegotiation mode + * @interface: link &typedef phy_interface_t mode * @phy: any attached phy * * If @mode is not an in-band negotiation mode (as defined by * phylink_autoneg_inband()), allow the link to come up. If @phy * is non-%NULL, configure Energy Efficient Ethernet by calling * phy_init_eee() and perform appropriate MAC configuration for EEE. + * Interface type selection must be done in mac_config(). */ void mac_link_up(struct net_device *ndev, unsigned int mode, + phy_interface_t interface, struct phy_device *phy); #endif -- 2.14.1