From: Frank Li <Frank.Li@freescale.com>
To: b38611@freescale.com, davem@davemloft.net,
netdev@vger.kernel.org, lznuaa@gmail.com
Cc: shawn.guo@linaro.org, linux-arm-kernel@lists.infradead.org,
devicetree@vger.kernel.org, linux@arm.linux.org.uk,
Fugang Duan <B38611@freescale.com>,
Frank Li <Frank.Li@freescale.com>
Subject: [Patch v3 net-next 01/12] net:fec: add enet refrence clock for i.MX 6SX chip
Date: Thu, 11 Sep 2014 02:30:34 +0800 [thread overview]
Message-ID: <1410373845-5801-2-git-send-email-Frank.Li@freescale.com> (raw)
In-Reply-To: <1410373845-5801-1-git-send-email-Frank.Li@freescale.com>
From: Fugang Duan <B38611@freescale.com>
i.MX6sx enet has below clocks for user config:
clk_ipg: ipg_clk_s, ipg_clk_mac0_s, 66Mhz
clk_ahb: enet system clock, it is enet AXI clock for imx6sx.
For imx6sx, it alos is the clock source of interrupt coalescing.
The clock range: 200Mhz ~ 266Mhz.
clk_ref: refrence clock for tx and rx. For imx6sx enet RGMII mode,
the refrence clock is 125Mhz coming from internal PLL or external.
In i.MX6sx-arm2 board, the clock is from internal PLL.
clk_ref is optional, depends on board.
clk_enet_out: The clock can be output from internal PLL. It can supply 50Mhz
clock for phy. clk_enet_out is optional, depends on chip and board.
clk_ptp: 1588 ts clock. It is optional, depends on chip.
The patch add clk_ref to distiguish the different clocks.
Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
drivers/net/ethernet/freescale/fec.h | 1 +
drivers/net/ethernet/freescale/fec_main.c | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index ee41d98..635772b 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -272,6 +272,7 @@ struct fec_enet_private {
struct clk *clk_ipg;
struct clk *clk_ahb;
+ struct clk *clk_ref;
struct clk *clk_enet_out;
struct clk *clk_ptp;
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 89355a7..c21ecff1 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1621,6 +1621,11 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
}
mutex_unlock(&fep->ptp_clk_mutex);
}
+ if (fep->clk_ref) {
+ ret = clk_prepare_enable(fep->clk_ref);
+ if (ret)
+ goto failed_clk_ref;
+ }
} else {
clk_disable_unprepare(fep->clk_ahb);
clk_disable_unprepare(fep->clk_ipg);
@@ -1632,9 +1637,15 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
fep->ptp_clk_on = false;
mutex_unlock(&fep->ptp_clk_mutex);
}
+ if (fep->clk_ref)
+ clk_disable_unprepare(fep->clk_ref);
}
return 0;
+
+failed_clk_ref:
+ if (fep->clk_ref)
+ clk_disable_unprepare(fep->clk_ref);
failed_clk_ptp:
if (fep->clk_enet_out)
clk_disable_unprepare(fep->clk_enet_out);
@@ -2637,6 +2648,12 @@ fec_probe(struct platform_device *pdev)
fep->ptp_clk_on = false;
mutex_init(&fep->ptp_clk_mutex);
+
+ /* clk_ref is optional, depends on board */
+ fep->clk_ref = devm_clk_get(&pdev->dev, "enet_clk_ref");
+ if (IS_ERR(fep->clk_ref))
+ fep->clk_ref = NULL;
+
fep->clk_ptp = devm_clk_get(&pdev->dev, "ptp");
fep->bufdesc_ex =
pdev->id_entry->driver_data & FEC_QUIRK_HAS_BUFDESC_EX;
--
1.9.1
next prev parent reply other threads:[~2014-09-10 18:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-10 18:30 [Patch v3 net-next 00/12] net: fec: imx6sx multiqueue support Frank Li
2014-09-10 18:30 ` Frank Li [this message]
2014-09-10 18:30 ` [Patch v3 net-next 02/12] net:fec: add enet AVB feature macro define for imx6sx Frank Li
2014-09-10 18:30 ` [Patch v3 net-next 03/12] net: fec: change data structure to support multiqueue Frank Li
2014-09-10 18:30 ` [Patch v3 net-next 04/12] net: fec: parser max queue number from dt file Frank Li
2014-09-10 18:30 ` [Patch v3 net-next 05/12] net: fec: init multi queue date structure Frank Li
2014-09-10 18:30 ` [Patch v3 net-next 06/12] net:fec: Disable enet-avb MAC instead of reset MAC Frank Li
2014-09-10 18:30 ` [Patch v3 net-next 07/12] net: fec: add enet-avb IP support Frank Li
2014-09-10 18:30 ` [Patch v3 net-next 08/12] net:fec: Add fsl,imx6sx-fec compatible strings Frank Li
2014-09-10 18:30 ` [Patch v3 net-next 09/12] net: fec: change FEC alignment according to i.mx6 sx requirement Frank Li
2014-09-12 20:40 ` David Miller
2014-09-12 20:45 ` Zhi Li
[not found] ` <1410373845-5801-1-git-send-email-Frank.Li-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2014-09-10 18:30 ` [Patch v3 net-next 10/12] net: fec: init complete variable in early to avoid kernel dump Frank Li
2014-09-10 18:30 ` [Patch v3 net-next 11/12] ARM: Documentation: Update fec dts binding doc Frank Li
2014-09-10 18:30 ` [Patch v3 net-next 12/12] ARM: dts: imx6sx: add multi-queue support enet Frank Li
[not found] <1410373813-5731-1-git-send-email-yes>
2014-09-10 18:30 ` [Patch v3 net-next 01/12] net:fec: add enet refrence clock for i.MX 6SX chip yes-KgLukfWpBlCctlrPMvKcciBecyulp+rMXqFh9Ls21Oc
2014-09-10 18:30 ` yes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1410373845-5801-2-git-send-email-Frank.Li@freescale.com \
--to=frank.li@freescale.com \
--cc=b38611@freescale.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux@arm.linux.org.uk \
--cc=lznuaa@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=shawn.guo@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).