From patchwork Sun Jan 27 14:27:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 2051711 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 881BF3FCDE for ; Sun, 27 Jan 2013 14:32:25 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TzTCx-0005O8-3M; Sun, 27 Jan 2013 14:27:43 +0000 Received: from mail-bk0-f44.google.com ([209.85.214.44]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TzTCt-0005Np-V5 for linux-arm-kernel@lists.infradead.org; Sun, 27 Jan 2013 14:27:40 +0000 Received: by mail-bk0-f44.google.com with SMTP id j4so910839bkw.3 for ; Sun, 27 Jan 2013 06:27:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=mlgdzYJIKuBsFB4badxzcMgSWwy5Tg2ek1HHNsgOx5c=; b=cabl/s4glPZ+DvA2U/aMMEFCaEURELQmc5bcsAS2EYgBIPiG3ViwRUCw3jU3pXyBlK vHNdHM6bNwH9aPKdmHsOPaVaA7XV9pBLLxwHa6XhRiX+yBBt2CHCwNyfbJFUpXH2VF3a zkV9hi8bHxNdyxz3zQl9OOEle6lj4FVbweFKfqV3qmBsdfHaAu1RofmVTu6sPCFraLzp haRk5uYkIq1A8CbSTNALup2xFfbbPLCttlJZJIK2LbRUvrHpckqavobsckLbdLvTMCjJ CIR/9CSn/WXxEGag7XIQ9GF34i3bz6B4KEpBZIygKIXQ0M2KM3EhHqGPzYxRMpwf6TFx JDNQ== X-Received: by 10.205.122.80 with SMTP id gf16mr706769bkc.15.1359296858157; Sun, 27 Jan 2013 06:27:38 -0800 (PST) Received: from nijin.lan (dslc-082-083-232-148.pools.arcor-ip.net. [82.83.232.148]) by mx.google.com with ESMTPS id f24sm4081180bkv.7.2013.01.27.06.27.36 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 27 Jan 2013 06:27:37 -0800 (PST) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH] NET: mv643xx: get smi clock from device tree Date: Sun, 27 Jan 2013 15:27:30 +0100 Message-Id: <1359296850-25348-1-git-send-email-sebastian.hesselbarth@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <684d670633e771b738725b082d88fdb773002f4a.1359232975.git.jason@lakedaemon.net> References: <684d670633e771b738725b082d88fdb773002f4a.1359232975.git.jason@lakedaemon.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130127_092740_162051_5A012829 X-CRM114-Status: GOOD ( 13.38 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.214.44 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (sebastian.hesselbarth[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Andrew Lunn , Jason Cooper , Arnd Bergmann , Olof Johansson , linux-arm-kernel@lists.infradead.org, Simon Baatz X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org mv643xx_eth is split up into core (ethernet) and smi (mdio) driver parts. If clock gates are introduced as for Kirkwood and Dove SoCs, smi registers are accessed with clock gated and cause the SoC to hang. This patch also gets and enables a clock passed from DT for the shared smi part of the driver. It has been tested on Dove and also allows the driver compiled and used as a module. DT conversion patches for mv643xx_eth on Dove will be sent on another patch set. Signed-off-by: Sebastian Hesselbarth --- Cc: Jason Cooper Cc: Andrew Lunn Cc: Arnd Bergmann Cc: Olof Johansson Cc: Simon Baatz Cc: linux-arm-kernel@lists.infradead.org --- drivers/net/ethernet/marvell/mv643xx_eth.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index 67e5d86..c0f0671 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -296,6 +296,9 @@ struct mv643xx_eth_shared_private { int extended_rx_coal_limit; int tx_bw_control; int tx_csum_limit; +#if defined(CONFIG_HAVE_CLK) + struct clk *clk; +#endif }; @@ -2626,6 +2629,12 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev) of_property_read_u32(pdev->dev.of_node, "tx_csum_limit", &pd->tx_csum_limit); +#if defined(CONFIG_HAVE_CLK) + msp->clk = of_clk_get(pdev->dev.of_node, 0); + if (!IS_ERR(msp->clk)) + clk_prepare_enable(msp->clk); +#endif + np = of_parse_phandle(pdev->dev.of_node, "shared_smi", 0); if (np) pd->shared_smi = of_find_device_by_node(np); @@ -2695,6 +2704,12 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev) out_free_mii_bus: mdiobus_free(msp->smi_bus); out_unmap: +#if defined(CONFIG_HAVE_CLK) + if (!IS_ERR(msp->clk)) { + clk_disable_unprepare(msp->clk); + clk_put(msp->clk); + } +#endif iounmap(msp->base); out_free: kfree(msp); @@ -2713,6 +2728,12 @@ static int mv643xx_eth_shared_remove(struct platform_device *pdev) } if (msp->err_interrupt != NO_IRQ) free_irq(msp->err_interrupt, msp); +#if defined(CONFIG_HAVE_CLK) + if (!IS_ERR(msp->clk)) { + clk_disable_unprepare(msp->clk); + clk_put(msp->clk); + } +#endif iounmap(msp->base); kfree(msp);