From patchwork Thu Jun 20 22:06:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Arnaud Patard (Rtp)" X-Patchwork-Id: 253426 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 D71CF2C041F for ; Sun, 23 Jun 2013 06:25:57 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750859Ab3FVUZc (ORCPT ); Sat, 22 Jun 2013 16:25:32 -0400 Received: from lebrac.rtp-net.org ([88.191.135.105]:50537 "EHLO lebrac.rtp-net.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750746Ab3FVUZb (ORCPT ); Sat, 22 Jun 2013 16:25:31 -0400 X-Greylist: delayed 610 seconds by postgrey-1.27 at vger.kernel.org; Sat, 22 Jun 2013 16:25:31 EDT Received: by lebrac.rtp-net.org (Postfix, from userid 1000) id 4906E2D043; Sat, 22 Jun 2013 22:14:34 +0200 (CEST) Message-Id: <20130620221008.449950285@rtp-net.org> User-Agent: quilt/0.60-1 Date: Fri, 21 Jun 2013 00:06:45 +0200 From: Arnaud Patard (Rtp) To: netdev@vger.kernel.org Cc: Thomas Petazzoni Subject: [patch 1/2] Fix hang when loading the mvneta driver References: <20130620220644.715387300@rtp-net.org> Content-Disposition: inline; filename=mvneta-module-hang.patch Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When the mvneta driver is compiled, it'll be loaded with clocks disabled. This implies that the clocks should be enabled again before any register access or it'll hang. To fix it: - enable clock earlier - move timer callback after setting timer.data Signed-off-by: Arnaud Patard --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-next/drivers/net/ethernet/marvell/mvneta.c =================================================================== --- linux-next.orig/drivers/net/ethernet/marvell/mvneta.c 2013-06-20 23:39:37.485391949 +0200 +++ linux-next/drivers/net/ethernet/marvell/mvneta.c 2013-06-20 23:39:37.481391949 +0200 @@ -2728,20 +2733,10 @@ static int mvneta_probe(struct platform_ pp = netdev_priv(dev); - pp->tx_done_timer.function = mvneta_tx_done_timer_callback; - init_timer(&pp->tx_done_timer); - clear_bit(MVNETA_F_TX_DONE_TIMER_BIT, &pp->flags); - pp->weight = MVNETA_RX_POLL_WEIGHT; pp->phy_node = phy_node; pp->phy_interface = phy_mode; - pp->base = of_iomap(dn, 0); - if (pp->base == NULL) { - err = -ENOMEM; - goto err_free_irq; - } - pp->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(pp->clk)) { err = PTR_ERR(pp->clk); @@ -2765,7 +2760,16 @@ static int mvneta_probe(struct platform_ } } + pp->base = of_iomap(dn, 0); + if (pp->base == NULL) { + err = -ENOMEM; + goto err_free_irq; + } + pp->tx_done_timer.data = (unsigned long)dev; + pp->tx_done_timer.function = mvneta_tx_done_timer_callback; + init_timer(&pp->tx_done_timer); + clear_bit(MVNETA_F_TX_DONE_TIMER_BIT, &pp->flags); pp->tx_ring_size = MVNETA_MAX_TXD; pp->rx_ring_size = MVNETA_MAX_RXD;