From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mason Subject: Waiting for the PHY to complete auto-negotiation Date: Wed, 6 Dec 2017 17:39:00 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Florian Fainelli , Andrew Lunn , David Miller To: netdev Return-path: Received: from smtp5-g21.free.fr ([212.27.42.5]:52004 "EHLO smtp5-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711AbdLFQjL (ORCPT ); Wed, 6 Dec 2017 11:39:11 -0500 Sender: netdev-owner@vger.kernel.org List-ID: Hello, I've been trying to wrap my head around Ethernet auto-negotiation, vs actual / real packets seen at the MAC layer. I found the relevant Wikipedia article to be fairly informative: https://en.wikipedia.org/wiki/Autonegotiation The reason I care is that my Ethernet HW does not allow changing the flow control setting once the MAC has started (more specifically, once RX DMA has been enabled). In nb8800_open(), the code currently works in this order: nb8800_start_rx(dev); phy_start(phydev); The first line enables the MAC (and DMA). The second enables the PHY and starts auto-negotiation. This is a problem: I would like for PHY auto-negotiation to be /complete/ before I enable the MAC. What is the recommended way to wait for the PHY? AFAICT, the PHY layer calls back into the eth driver through the adjust_link() callback registered through of_phy_connect(). It seems like this might be a good place to enable the MAC? (When some other conditions are true.) Regards.