From patchwork Wed Nov 7 19:46:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 994468 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="CqluHX8Y"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42qxmH3wKSz9s9J for ; Thu, 8 Nov 2018 06:48:15 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726952AbeKHFUD (ORCPT ); Thu, 8 Nov 2018 00:20:03 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:42479 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725945AbeKHFUC (ORCPT ); Thu, 8 Nov 2018 00:20:02 -0500 Received: by mail-wr1-f68.google.com with SMTP id y15-v6so18700723wru.9 for ; Wed, 07 Nov 2018 11:48:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=c1HtZMg8REJCD+HMisDOxNNns5yOKm1QaiETCCzHjNs=; b=CqluHX8YO4OfcDmfID+H2cHUcjpeAiiszwlaGq9C/gO4kgSWxicpQypIQ74WOpcQVS 3jhbKOmJ1qFRaZbGomT/f9AkTfjSvN1KfIuYiEVWONDkKkX9ncwTTucJjyLDhS6pUE99 8zfWBUFl9LNTimXcaG9lqL/V/xaWBAifSkDNnO60NHJa8vQVP2QNe0QB7WilQC8rB3Ff Hl3KLw1urGQOC0Gh9jmZdPt3aRsxkyifsmluoy7Rns35KgRf7RPbnYWH3lBMUYad5hvO /4Yz/dCufg2YfMC4aXu3rZ7Tf8Vcf546bTpTlIpvBZ1XG9hs2W8tvI93WSy+CRLEfjbl EGCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=c1HtZMg8REJCD+HMisDOxNNns5yOKm1QaiETCCzHjNs=; b=lmz2r1Rvh6ROq2NXTGOguKqPZacQxXBmTL18hYLzOp432i8xwhEtLHu+ZmYBZU7zCb MZbf06HCgkTGYa+fMtsz5j3wD3xWlRwfU6CbINcYPh+jqSgGo6ooxNS4ah2j/2cPJq9h Var1isC5i9ppYEnY9PI4Z4ssAPVC/wF8hnjUQpAqJC41fC9O2edfuAoyn6fAcUjjXSh7 D6OQaFhrgetVYaTnYAQIvwQ4JzvuHQZiudtcdYrgB1AKRWXF12qQKJfAvKNR2r6zKAn1 q79Iqa/xgMw+dZZQEZcmedhwrehk/pxM+h5gzBGs73PJtxOR3f+lwZ5AUOM8YAbU6rob 8VeQ== X-Gm-Message-State: AGRZ1gJW0XtkHnLa2HMIo3Y/yQ6rh+XKTvY5gZ7dRxIJfKbTCUbykJVu +Lr/yLW5fNGqnOgOyU5W8v3bIhzG X-Google-Smtp-Source: AJdET5dTNWogbxGRssKTApc5rl0JwlVRT8gcjaVt7WsNFf+ZSm54squ/tcWmHtHr4um+bDrNH2wqpg== X-Received: by 2002:adf:ba8b:: with SMTP id p11-v6mr1394615wrg.203.1541620091462; Wed, 07 Nov 2018 11:48:11 -0800 (PST) Received: from ?IPv6:2003:ea:8bcf:e300:845f:16a9:1070:df7f? (p200300EA8BCFE300845F16A91070DF7F.dip0.t-ipconnect.de. [2003:ea:8bcf:e300:845f:16a9:1070:df7f]) by smtp.googlemail.com with ESMTPSA id t198-v6sm3099129wmd.9.2018.11.07.11.48.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Nov 2018 11:48:10 -0800 (PST) Subject: [PATCH net-next 4/5] net: phy: remove state PHY_AN From: Heiner Kallweit To: Florian Fainelli , Andrew Lunn , David Miller Cc: "netdev@vger.kernel.org" References: <922c223b-7bc0-e0ec-345d-2034b796af91@gmail.com> Message-ID: <8db50df3-4cb9-9d60-b7e2-6924f8a521c4@gmail.com> Date: Wed, 7 Nov 2018 20:46:51 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <922c223b-7bc0-e0ec-345d-2034b796af91@gmail.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org After the recent changes in the state machine state PHY_AN isn't used any longer and can be removed. Signed-off-by: Heiner Kallweit --- drivers/net/phy/phy.c | 27 --------------------------- include/linux/phy.h | 19 +------------------ 2 files changed, 1 insertion(+), 45 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 87ed00030..226824804 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -50,7 +50,6 @@ static const char *phy_state_to_str(enum phy_state st) PHY_STATE_STR(READY) PHY_STATE_STR(PENDING) PHY_STATE_STR(UP) - PHY_STATE_STR(AN) PHY_STATE_STR(RUNNING) PHY_STATE_STR(NOLINK) PHY_STATE_STR(FORCING) @@ -944,32 +943,6 @@ void phy_state_machine(struct work_struct *work) case PHY_UP: needs_aneg = true; - phydev->link_timeout = PHY_AN_TIMEOUT; - - break; - case PHY_AN: - err = phy_read_status(phydev); - if (err < 0) - break; - - /* If the link is down, give up on negotiation for now */ - if (!phydev->link) { - phydev->state = PHY_NOLINK; - phy_link_down(phydev, true); - break; - } - - /* Check if negotiation is done. Break if there's an error */ - err = phy_aneg_done(phydev); - if (err < 0) - break; - - /* If AN is done, we're running */ - if (err > 0) { - phydev->state = PHY_RUNNING; - phy_link_up(phydev); - } else if (0 == phydev->link_timeout--) - needs_aneg = true; break; case PHY_NOLINK: if (!phy_polling_mode(phydev)) diff --git a/include/linux/phy.h b/include/linux/phy.h index 9e4d49ef4..2090277ea 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -178,7 +178,6 @@ static inline const char *phy_modes(phy_interface_t interface) #define PHY_INIT_TIMEOUT 100000 #define PHY_STATE_TIME 1 #define PHY_FORCE_TIMEOUT 10 -#define PHY_AN_TIMEOUT 10 #define PHY_MAX_ADDR 32 @@ -297,24 +296,10 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); * * UP: The PHY and attached device are ready to do work. * Interrupts should be started here. - * - timer moves to AN - * - * AN: The PHY is currently negotiating the link state. Link is - * therefore down for now. phy_timer will set this state when it - * detects the state is UP. config_aneg will set this state - * whenever called with phydev->autoneg set to AUTONEG_ENABLE. - * - If autonegotiation finishes, but there's no link, it sets - * the state to NOLINK. - * - If aneg finishes with link, it sets the state to RUNNING, - * and calls adjust_link - * - If autonegotiation did not finish after an arbitrary amount - * of time, autonegotiation should be tried again if the PHY - * supports "magic" autonegotiation (back to AN) - * - If it didn't finish, and no magic_aneg, move to FORCING. + * - timer moves to NOLINK or RUNNING * * NOLINK: PHY is up, but not currently plugged in. * - If the timer notes that the link comes back, we move to RUNNING - * - config_aneg moves to AN * - phy_stop moves to HALTED * * FORCING: PHY is being configured with forced settings @@ -329,7 +314,6 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); * link state is polled every other cycle of this state machine, * which makes it every other second) * - irq will set CHANGELINK - * - config_aneg will set AN * - phy_stop moves to HALTED * * CHANGELINK: PHY experienced a change in link state @@ -353,7 +337,6 @@ enum phy_state { PHY_READY, PHY_PENDING, PHY_UP, - PHY_AN, PHY_RUNNING, PHY_NOLINK, PHY_FORCING,