From patchwork Mon Mar 18 08:26:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 2286061 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 873CB3FD8C for ; Mon, 18 Mar 2013 08:29:40 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UHVPb-00085S-1w; Mon, 18 Mar 2013 08:27:19 +0000 Received: from co1ehsobe002.messaging.microsoft.com ([216.32.180.185] helo=co1outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UHVOy-0007wZ-Kr for linux-arm-kernel@lists.infradead.org; Mon, 18 Mar 2013 08:26:47 +0000 Received: from mail14-co1-R.bigfish.com (10.243.78.245) by CO1EHSOBE010.bigfish.com (10.243.66.73) with Microsoft SMTP Server id 14.1.225.23; Mon, 18 Mar 2013 08:26:35 +0000 Received: from mail14-co1 (localhost [127.0.0.1]) by mail14-co1-R.bigfish.com (Postfix) with ESMTP id 9E9319C0214; Mon, 18 Mar 2013 08:26:35 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1f42h1ee6h1de0h1202h1e76h1d1ah1d2ahzz8275dhz2dh87h2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1155h) X-FB-DOMAIN-IP-MATCH: fail Received: from mail14-co1 (localhost.localdomain [127.0.0.1]) by mail14-co1 (MessageSwitch) id 1363595192342180_12075; Mon, 18 Mar 2013 08:26:32 +0000 (UTC) Received: from CO1EHSMHS001.bigfish.com (unknown [10.243.78.249]) by mail14-co1.bigfish.com (Postfix) with ESMTP id 462C346007B; Mon, 18 Mar 2013 08:26:32 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CO1EHSMHS001.bigfish.com (10.243.66.11) with Microsoft SMTP Server (TLS) id 14.1.225.23; Mon, 18 Mar 2013 08:26:32 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server (TLS) id 14.2.328.11; Mon, 18 Mar 2013 08:26:31 +0000 Received: from S2101-09.ap.freescale.net ([10.192.185.135]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id r2I8QJBB028538; Mon, 18 Mar 2013 01:26:28 -0700 From: Shawn Guo To: Subject: [PATCH v2 2/4] net: freescale: fec: add support for optional enet_out clk Date: Mon, 18 Mar 2013 16:26:23 +0800 Message-ID: <1363595185-12302-3-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1363595185-12302-1-git-send-email-shawn.guo@linaro.org> References: <1363595185-12302-1-git-send-email-shawn.guo@linaro.org> MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130318_042641_158716_BADEF597 X-CRM114-Status: GOOD ( 12.64 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [216.32.180.185 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: netdev@vger.kernel.org, Shawn Guo , "David S. Miller" , Wolfram Sang X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Wolfram Sang Some MX28 boards need the internal enet_out clock to be enabled. So, do this in the driver iff the clock was referenced via devicetree. Signed-off-by: Wolfram Sang Signed-off-by: Shawn Guo --- drivers/net/ethernet/freescale/fec.c | 10 ++++++++++ drivers/net/ethernet/freescale/fec.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c index d2a9851..2297283 100644 --- a/drivers/net/ethernet/freescale/fec.c +++ b/drivers/net/ethernet/freescale/fec.c @@ -1800,6 +1800,11 @@ fec_probe(struct platform_device *pdev) goto failed_clk; } + /* enet_out is optional, depends on board */ + fep->clk_enet_out = devm_clk_get(&pdev->dev, "enet_out"); + if (IS_ERR(fep->clk_enet_out)) + fep->clk_enet_out = NULL; + fep->clk_ptp = devm_clk_get(&pdev->dev, "ptp"); fep->bufdesc_ex = pdev->id_entry->driver_data & FEC_QUIRK_HAS_BUFDESC_EX; @@ -1810,6 +1815,7 @@ fec_probe(struct platform_device *pdev) clk_prepare_enable(fep->clk_ahb); clk_prepare_enable(fep->clk_ipg); + clk_prepare_enable(fep->clk_enet_out); clk_prepare_enable(fep->clk_ptp); reg_phy = devm_regulator_get(&pdev->dev, "phy"); @@ -1875,6 +1881,7 @@ failed_irq: failed_regulator: clk_disable_unprepare(fep->clk_ahb); clk_disable_unprepare(fep->clk_ipg); + clk_disable_unprepare(fep->clk_enet_out); clk_disable_unprepare(fep->clk_ptp); failed_pin: failed_clk: @@ -1901,6 +1908,7 @@ fec_drv_remove(struct platform_device *pdev) clk_disable_unprepare(fep->clk_ptp); if (fep->ptp_clock) ptp_clock_unregister(fep->ptp_clock); + clk_disable_unprepare(fep->clk_enet_out); clk_disable_unprepare(fep->clk_ahb); clk_disable_unprepare(fep->clk_ipg); for (i = 0; i < FEC_IRQ_NUM; i++) { @@ -1931,6 +1939,7 @@ fec_suspend(struct device *dev) fec_stop(ndev); netif_device_detach(ndev); } + clk_disable_unprepare(fep->clk_enet_out); clk_disable_unprepare(fep->clk_ahb); clk_disable_unprepare(fep->clk_ipg); @@ -1943,6 +1952,7 @@ fec_resume(struct device *dev) struct net_device *ndev = dev_get_drvdata(dev); struct fec_enet_private *fep = netdev_priv(ndev); + clk_prepare_enable(fep->clk_enet_out); clk_prepare_enable(fep->clk_ahb); clk_prepare_enable(fep->clk_ipg); if (netif_running(ndev)) { diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index 01579b8..becb7bd 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h @@ -208,6 +208,7 @@ struct fec_enet_private { struct clk *clk_ipg; struct clk *clk_ahb; + struct clk *clk_enet_out; struct clk *clk_ptp; /* The saved address of a sent-in-place packet/buffer, for skfree(). */