From patchwork Sun Mar 24 20:34:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Baatz X-Patchwork-Id: 230509 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 03A2C2C05BD for ; Mon, 25 Mar 2013 09:49:03 +1100 (EST) Received: from mo6-p00-ob.rzone.de (mo6-p00-ob.rzone.de [IPv6:2a01:238:20a:202:5300::1]) by ozlabs.org (Postfix) with ESMTP id 187BE2C00A9 for ; Mon, 25 Mar 2013 07:41:04 +1100 (EST) X-RZG-AUTH: :L20Qdkipd/NtQfa28f3iP6nsj1VEm6lxnnjU56eNUnjyVKhsoRrRYQqTg2VsKWBjXOD8qSDlEoJr1es= X-RZG-CLASS-ID: mo00 Received: from gandalf.schnuecks.de ([2001:4dd0:f8d2:2602::1]) by smtp.strato.de (josoe mo16) (RZmta 31.22 AUTH) with (DHE-RSA-AES256-SHA encrypted) ESMTPA id L020afp2OJU4H2 ; Sun, 24 Mar 2013 21:34:48 +0100 (CET) Received: by gandalf.schnuecks.de (Postfix, from userid 500) id A85764014B; Sun, 24 Mar 2013 21:34:47 +0100 (CET) From: Simon Baatz To: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, florian@openwrt.org, thomas.petazzoni@free-electrons.com Subject: [PATCH 2/2] mv643xx_eth: defer probing if Marvell Orion MDIO driver not loaded Date: Sun, 24 Mar 2013 21:34:00 +0100 Message-Id: <1364157240-28883-3-git-send-email-gmbnomis@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1364157240-28883-1-git-send-email-gmbnomis@gmail.com> References: <1364157240-28883-1-git-send-email-gmbnomis@gmail.com> X-Mailman-Approved-At: Mon, 25 Mar 2013 09:47:25 +1100 Cc: Simon Baatz , andrew@lunn.ch, jason@lakedaemon.net, davem@davemloft.net X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" When both the Marvell MV643XX ethernet driver and the Orion MDIO driver are compiled as modules, the ethernet driver may be probed before the MDIO driver. Let mv643xx_eth_probe() return EPROBE_DEFER in this case, i.e. when it cannot find the PHY. Signed-off-by: Simon Baatz --- drivers/net/ethernet/marvell/mv643xx_eth.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index a65a92e..aedbd82 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -2681,7 +2681,7 @@ static struct phy_device *phy_scan(struct mv643xx_eth_private *mp, } /* Attempt to connect to the PHY using orion-mdio */ - phydev = NULL; + phydev = ERR_PTR(-ENODEV); for (i = 0; i < num; i++) { int addr = (start + i) & 0x1f; @@ -2812,11 +2812,17 @@ static int mv643xx_eth_probe(struct platform_device *pdev) netif_set_real_num_tx_queues(dev, mp->txq_count); netif_set_real_num_rx_queues(dev, mp->rxq_count); - if (pd->phy_addr != MV643XX_ETH_PHY_NONE) + if (pd->phy_addr != MV643XX_ETH_PHY_NONE) { mp->phy = phy_scan(mp, pd->phy_addr); - if (mp->phy != NULL) + if (IS_ERR(mp->phy)) { + err = PTR_ERR(mp->phy); + if (err == -ENODEV) + err = -EPROBE_DEFER; + goto out; + } phy_init(mp, pd->speed, pd->duplex); + } SET_ETHTOOL_OPS(dev, &mv643xx_eth_ethtool_ops);