All of lore.kernel.org
 help / color / mirror / Atom feed
From: hvaibhav@ti.com (Vaibhav Hiremath)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] net: davinci_mdio: enable and disable clock
Date: Fri, 3 Aug 2012 10:46:49 +0530	[thread overview]
Message-ID: <501B5EC1.7010304@ti.com> (raw)
In-Reply-To: <1343936616-29318-1-git-send-email-zonque@gmail.com>



On 8/3/2012 1:13 AM, Daniel Mack wrote:
> Make the driver control the device clocks. Appearantly, the Davinci
> platform probes this driver with the clock all powered up, but on OMAP,
> this isn't the case.
> 
> Signed-off-by: Daniel Mack <zonque@gmail.com>
> ---
>  drivers/net/ethernet/ti/davinci_mdio.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c
> index cd7ee20..b4b6015 100644
> --- a/drivers/net/ethernet/ti/davinci_mdio.c
> +++ b/drivers/net/ethernet/ti/davinci_mdio.c
> @@ -332,6 +332,8 @@ static int __devinit davinci_mdio_probe(struct platform_device *pdev)
>  		goto bail_out;
>  	}
>  
> +	clk_enable(data->clk);
> +
>  	dev_set_drvdata(dev, data);
>  	data->dev = dev;
>  	spin_lock_init(&data->lock);
> @@ -379,8 +381,11 @@ bail_out:
>  	if (data->bus)
>  		mdiobus_free(data->bus);
>  
> -	if (data->clk)
> +	if (data->clk) {
> +		clk_disable(data->clk);
>  		clk_put(data->clk);
> +	}
> +
>  	pm_runtime_put_sync(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
>  
> @@ -397,8 +402,11 @@ static int __devexit davinci_mdio_remove(struct platform_device *pdev)
>  	if (data->bus)
>  		mdiobus_free(data->bus);
>  
> -	if (data->clk)
> +	if (data->clk) {
> +		clk_disable(data->clk);
>  		clk_put(data->clk);
> +	}
> +
>  	pm_runtime_put_sync(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
>  
> @@ -427,6 +435,8 @@ static int davinci_mdio_suspend(struct device *dev)
>  	data->suspended = true;
>  	spin_unlock(&data->lock);
>  
> +	clk_disable(data->clk);
> +
>  	return 0;
>  }
>  
> @@ -435,6 +445,8 @@ static int davinci_mdio_resume(struct device *dev)
>  	struct davinci_mdio_data *data = dev_get_drvdata(dev);
>  	u32 ctrl;
>  
> +	clk_enable(data->clk);
> +

Danial,

I would request you to wait for this, its not that simple and straight.
And once you migrate to runtime PM you don't need clk_enable/disable,
this should get handled under runtime PM api's.

Also have you read my another email post -

http://comments.gmane.org/gmane.linux.ports.arm.omap/80796

Certainly, with respect to CPSW & MDIO, this patch is not enough and
requires further investigation. I have started looking at this and
hopefully will have some solution soon...

Thanks,
Vaibhav

WARNING: multiple messages have this Message-ID (diff)
From: Vaibhav Hiremath <hvaibhav@ti.com>
To: Daniel Mack <zonque@gmail.com>
Cc: netdev@vger.kernel.org, mugunthanvnm@ti.com,
	devicetree-discuss@lists.ozlabs.org, koen@dominion.thruhere.net,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] net: davinci_mdio: enable and disable clock
Date: Fri, 3 Aug 2012 10:46:49 +0530	[thread overview]
Message-ID: <501B5EC1.7010304@ti.com> (raw)
In-Reply-To: <1343936616-29318-1-git-send-email-zonque@gmail.com>



On 8/3/2012 1:13 AM, Daniel Mack wrote:
> Make the driver control the device clocks. Appearantly, the Davinci
> platform probes this driver with the clock all powered up, but on OMAP,
> this isn't the case.
> 
> Signed-off-by: Daniel Mack <zonque@gmail.com>
> ---
>  drivers/net/ethernet/ti/davinci_mdio.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c
> index cd7ee20..b4b6015 100644
> --- a/drivers/net/ethernet/ti/davinci_mdio.c
> +++ b/drivers/net/ethernet/ti/davinci_mdio.c
> @@ -332,6 +332,8 @@ static int __devinit davinci_mdio_probe(struct platform_device *pdev)
>  		goto bail_out;
>  	}
>  
> +	clk_enable(data->clk);
> +
>  	dev_set_drvdata(dev, data);
>  	data->dev = dev;
>  	spin_lock_init(&data->lock);
> @@ -379,8 +381,11 @@ bail_out:
>  	if (data->bus)
>  		mdiobus_free(data->bus);
>  
> -	if (data->clk)
> +	if (data->clk) {
> +		clk_disable(data->clk);
>  		clk_put(data->clk);
> +	}
> +
>  	pm_runtime_put_sync(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
>  
> @@ -397,8 +402,11 @@ static int __devexit davinci_mdio_remove(struct platform_device *pdev)
>  	if (data->bus)
>  		mdiobus_free(data->bus);
>  
> -	if (data->clk)
> +	if (data->clk) {
> +		clk_disable(data->clk);
>  		clk_put(data->clk);
> +	}
> +
>  	pm_runtime_put_sync(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
>  
> @@ -427,6 +435,8 @@ static int davinci_mdio_suspend(struct device *dev)
>  	data->suspended = true;
>  	spin_unlock(&data->lock);
>  
> +	clk_disable(data->clk);
> +
>  	return 0;
>  }
>  
> @@ -435,6 +445,8 @@ static int davinci_mdio_resume(struct device *dev)
>  	struct davinci_mdio_data *data = dev_get_drvdata(dev);
>  	u32 ctrl;
>  
> +	clk_enable(data->clk);
> +

Danial,

I would request you to wait for this, its not that simple and straight.
And once you migrate to runtime PM you don't need clk_enable/disable,
this should get handled under runtime PM api's.

Also have you read my another email post -

http://comments.gmane.org/gmane.linux.ports.arm.omap/80796

Certainly, with respect to CPSW & MDIO, this patch is not enough and
requires further investigation. I have started looking at this and
hopefully will have some solution soon...

Thanks,
Vaibhav

WARNING: multiple messages have this Message-ID (diff)
From: Vaibhav Hiremath <hvaibhav@ti.com>
To: Daniel Mack <zonque@gmail.com>
Cc: <netdev@vger.kernel.org>, <mugunthanvnm@ti.com>,
	<devicetree-discuss@lists.ozlabs.org>,
	<koen@dominion.thruhere.net>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/2] net: davinci_mdio: enable and disable clock
Date: Fri, 3 Aug 2012 10:46:49 +0530	[thread overview]
Message-ID: <501B5EC1.7010304@ti.com> (raw)
In-Reply-To: <1343936616-29318-1-git-send-email-zonque@gmail.com>



On 8/3/2012 1:13 AM, Daniel Mack wrote:
> Make the driver control the device clocks. Appearantly, the Davinci
> platform probes this driver with the clock all powered up, but on OMAP,
> this isn't the case.
> 
> Signed-off-by: Daniel Mack <zonque@gmail.com>
> ---
>  drivers/net/ethernet/ti/davinci_mdio.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c
> index cd7ee20..b4b6015 100644
> --- a/drivers/net/ethernet/ti/davinci_mdio.c
> +++ b/drivers/net/ethernet/ti/davinci_mdio.c
> @@ -332,6 +332,8 @@ static int __devinit davinci_mdio_probe(struct platform_device *pdev)
>  		goto bail_out;
>  	}
>  
> +	clk_enable(data->clk);
> +
>  	dev_set_drvdata(dev, data);
>  	data->dev = dev;
>  	spin_lock_init(&data->lock);
> @@ -379,8 +381,11 @@ bail_out:
>  	if (data->bus)
>  		mdiobus_free(data->bus);
>  
> -	if (data->clk)
> +	if (data->clk) {
> +		clk_disable(data->clk);
>  		clk_put(data->clk);
> +	}
> +
>  	pm_runtime_put_sync(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
>  
> @@ -397,8 +402,11 @@ static int __devexit davinci_mdio_remove(struct platform_device *pdev)
>  	if (data->bus)
>  		mdiobus_free(data->bus);
>  
> -	if (data->clk)
> +	if (data->clk) {
> +		clk_disable(data->clk);
>  		clk_put(data->clk);
> +	}
> +
>  	pm_runtime_put_sync(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
>  
> @@ -427,6 +435,8 @@ static int davinci_mdio_suspend(struct device *dev)
>  	data->suspended = true;
>  	spin_unlock(&data->lock);
>  
> +	clk_disable(data->clk);
> +
>  	return 0;
>  }
>  
> @@ -435,6 +445,8 @@ static int davinci_mdio_resume(struct device *dev)
>  	struct davinci_mdio_data *data = dev_get_drvdata(dev);
>  	u32 ctrl;
>  
> +	clk_enable(data->clk);
> +

Danial,

I would request you to wait for this, its not that simple and straight.
And once you migrate to runtime PM you don't need clk_enable/disable,
this should get handled under runtime PM api's.

Also have you read my another email post -

http://comments.gmane.org/gmane.linux.ports.arm.omap/80796

Certainly, with respect to CPSW & MDIO, this patch is not enough and
requires further investigation. I have started looking at this and
hopefully will have some solution soon...

Thanks,
Vaibhav

  parent reply	other threads:[~2012-08-03  5:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-02 19:43 [PATCH 1/2] net: davinci_mdio: enable and disable clock Daniel Mack
2012-08-02 19:43 ` Daniel Mack
2012-08-02 19:43 ` [PATCH 2/2] net: davinci_mdio: add DT bindings Daniel Mack
2012-08-02 19:43   ` Daniel Mack
2012-08-02 19:53 ` [PATCH 1/2] net: davinci_mdio: enable and disable clock Russell King - ARM Linux
2012-08-02 19:53   ` Russell King - ARM Linux
2012-08-02 20:17   ` Daniel Mack
2012-08-02 20:17     ` Daniel Mack
2012-08-02 20:20 ` Paul Walmsley
2012-08-02 20:20   ` Paul Walmsley
2012-08-02 20:28   ` Daniel Mack
2012-08-02 20:28     ` Daniel Mack
2012-08-03  5:16 ` Vaibhav Hiremath [this message]
2012-08-03  5:16   ` Vaibhav Hiremath
2012-08-03  5:16   ` Vaibhav Hiremath
2012-08-03  5:22   ` Daniel Mack
2012-08-03  5:22     ` Daniel Mack
2012-08-03  5:53     ` Hiremath, Vaibhav
2012-08-03  5:53       ` Hiremath, Vaibhav

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=501B5EC1.7010304@ti.com \
    --to=hvaibhav@ti.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.