From: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
To: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
Sriramakrishnan <srk-l0cyMroinI0@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org
Subject: Re: [PATCH 1/2] TI DaVinci EMAC: Add EMAC PHY clock handling.
Date: Fri, 12 Mar 2010 14:27:09 -0800 [thread overview]
Message-ID: <87bpet6urm.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1268317491-3822-2-git-send-email-srk-l0cyMroinI0@public.gmane.org> (Sriramakrishnan's message of "Thu\, 11 Mar 2010 19\:54\:50 +0530")
Sriramakrishnan <srk-l0cyMroinI0@public.gmane.org> writes:
> Source for the EMAC PHY clock can be different from the
> module clock and driver needs to request/enable the EMAC
> phy clock explicitly. This was not required earlier as on
> most Davinci platforms the phy clock is always on . On AM35x
> platform the phy clock needs to be managed explicitly , hence
> adding clock management for phy clock.
>
> Signed-off-by: Sriramakrishnan <srk-l0cyMroinI0@public.gmane.org>
Acked-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
Dave, if you prefer, with your ack, I'll merge this via the davinci
tree along with corresponding platform changes.
Kevin
> ---
> drivers/net/davinci_emac.c | 22 ++++++++++++++++++++--
> 1 files changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
> index 8a42dbe..d9ae6ee 100644
> --- a/drivers/net/davinci_emac.c
> +++ b/drivers/net/davinci_emac.c
> @@ -491,6 +491,7 @@ struct emac_priv {
>
> /* clock frequency for EMAC */
> static struct clk *emac_clk;
> +static struct clk *emac_phy_clk;
> static unsigned long emac_bus_frequency;
> static unsigned long mdio_max_freq;
>
> @@ -2637,18 +2638,28 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
> struct emac_platform_data *pdata;
> struct device *emac_dev;
>
> - /* obtain emac clock from kernel */
> - emac_clk = clk_get(&pdev->dev, NULL);
> + /* obtain emac module clock from kernel */
> + emac_clk = clk_get(&pdev->dev, "emac_clk");
> if (IS_ERR(emac_clk)) {
> printk(KERN_ERR "DaVinci EMAC: Failed to get EMAC clock\n");
> return -EBUSY;
> }
> +
> + /* obtain emac phy clock from kernel */
> + emac_phy_clk = clk_get(&pdev->dev, "phy_clk");
> + if (IS_ERR(emac_phy_clk)) {
> + printk(KERN_ERR "DaVinci EMAC: Failed to get PHY clock\n");
> + clk_put(emac_clk);
> + return -EBUSY;
> + }
> +
> emac_bus_frequency = clk_get_rate(emac_clk);
> /* TODO: Probe PHY here if possible */
>
> ndev = alloc_etherdev(sizeof(struct emac_priv));
> if (!ndev) {
> printk(KERN_ERR "DaVinci EMAC: Error allocating net_device\n");
> + clk_put(emac_phy_clk);
> clk_put(emac_clk);
> return -ENOMEM;
> }
> @@ -2734,6 +2745,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
> netif_napi_add(ndev, &priv->napi, emac_poll, EMAC_POLL_WEIGHT);
>
> clk_enable(emac_clk);
> + clk_enable(emac_phy_clk);
>
> /* register the network device */
> SET_NETDEV_DEV(ndev, &pdev->dev);
> @@ -2783,6 +2795,7 @@ mdiobus_quit:
>
> netdev_reg_err:
> mdio_alloc_err:
> + clk_disable(emac_phy_clk);
> clk_disable(emac_clk);
> no_irq_res:
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -2790,6 +2803,7 @@ no_irq_res:
> iounmap(priv->remap_addr);
>
> probe_quit:
> + clk_put(emac_phy_clk);
> clk_put(emac_clk);
> free_netdev(ndev);
> return rc;
> @@ -2821,7 +2835,9 @@ static int __devexit davinci_emac_remove(struct platform_device *pdev)
> free_netdev(ndev);
> iounmap(priv->remap_addr);
>
> + clk_disable(emac_phy_clk);
> clk_disable(emac_clk);
> + clk_put(emac_phy_clk);
> clk_put(emac_clk);
>
> return 0;
> @@ -2835,6 +2851,7 @@ static int davinci_emac_suspend(struct device *dev)
> if (netif_running(ndev))
> emac_dev_stop(ndev);
>
> + clk_disable(emac_phy_clk);
> clk_disable(emac_clk);
>
> return 0;
> @@ -2846,6 +2863,7 @@ static int davinci_emac_resume(struct device *dev)
> struct net_device *ndev = platform_get_drvdata(pdev);
>
> clk_enable(emac_clk);
> + clk_enable(emac_phy_clk);
>
> if (netif_running(ndev))
> emac_dev_open(ndev);
> --
> 1.6.2.4
>
> _______________________________________________
> Davinci-linux-open-source mailing list
> Davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
next prev parent reply other threads:[~2010-03-12 22:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-11 14:24 [PATCH 0/2] TI DaVinci EMAC: Add support for handling PHY Clock Sriramakrishnan
2010-03-11 14:24 ` [PATCH 1/2] TI DaVinci EMAC: Add EMAC PHY clock handling Sriramakrishnan
[not found] ` <1268317491-3822-2-git-send-email-srk-l0cyMroinI0@public.gmane.org>
2010-03-11 14:24 ` [PATCH 2/2] davinci: introduce EMAC PHY clock usage Sriramakrishnan
2010-03-12 22:38 ` Kevin Hilman
2010-03-15 14:59 ` Nori, Sekhar
2010-03-12 22:27 ` Kevin Hilman [this message]
2010-03-12 22:33 ` [PATCH 1/2] TI DaVinci EMAC: Add EMAC PHY clock handling David Miller
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=87bpet6urm.fsf@deeprootsystems.com \
--to=khilman-1d3hcaltpluheniveurvkkeocmrvltnr@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=srk-l0cyMroinI0@public.gmane.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).