* [PATCH] mv_xor: add support for clkdev framework @ 2009-06-23 9:56 Saeed Bishara 2009-06-23 9:56 ` [PATCH] mv_xor: add support for power management Saeed Bishara 2009-06-23 16:20 ` [PATCH] mv_xor: add support for clkdev framework Dan Williams 0 siblings, 2 replies; 9+ messages in thread From: Saeed Bishara @ 2009-06-23 9:56 UTC (permalink / raw) To: linux-raid, dan.j.williams; +Cc: buytenh, nico, saeed.bishara, Saeed Bishara Signed-off-by: Saeed Bishara <saeed@marvell.com> --- drivers/dma/mv_xor.c | 16 ++++++++++++++++ drivers/dma/mv_xor.h | 4 ++++ 2 files changed, 20 insertions(+), 0 deletions(-) diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index ddab94f..db77903 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c @@ -1325,6 +1325,14 @@ static int mv_xor_shared_probe(struct platform_device *pdev) platform_set_drvdata(pdev, msp); +#if defined(CONFIG_HAVE_CLK) + msp->clk = clk_get(&pdev->dev, NULL); + if (IS_ERR(msp->clk)) + dev_notice(&pdev->dev, "cannot get clkdev\n"); + else + clk_enable(msp->clk); +#endif + /* * (Re-)program MBUS remapping windows if we are asked to. */ @@ -1336,6 +1344,14 @@ static int mv_xor_shared_probe(struct platform_device *pdev) static int mv_xor_shared_remove(struct platform_device *pdev) { +#if defined(CONFIG_HAVE_CLK) + struct mv_xor_shared_private *msp = platform_get_drvdata(pdev); + + if (!IS_ERR(msp->clk)) { + clk_disable(msp->clk); + clk_put(msp->clk); + } +#endif return 0; } diff --git a/drivers/dma/mv_xor.h b/drivers/dma/mv_xor.h index 06cafe1..08c3815 100644 --- a/drivers/dma/mv_xor.h +++ b/drivers/dma/mv_xor.h @@ -22,6 +22,7 @@ #include <linux/io.h> #include <linux/dmaengine.h> #include <linux/interrupt.h> +#include <linux/clk.h> #define USE_TIMER #define MV_XOR_SLOT_SIZE 64 @@ -55,6 +56,9 @@ struct mv_xor_shared_private { void __iomem *xor_base; void __iomem *xor_high_base; +#if defined(CONFIG_HAVE_CLK) + struct clk *clk; +#endif }; -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] mv_xor: add support for power management 2009-06-23 9:56 [PATCH] mv_xor: add support for clkdev framework Saeed Bishara @ 2009-06-23 9:56 ` Saeed Bishara 2009-06-23 16:20 ` [PATCH] mv_xor: add support for clkdev framework Dan Williams 1 sibling, 0 replies; 9+ messages in thread From: Saeed Bishara @ 2009-06-23 9:56 UTC (permalink / raw) To: linux-raid, dan.j.williams; +Cc: buytenh, nico, saeed.bishara, Saeed Bishara Signed-off-by: Saeed Bishara <saeed@marvell.com> --- drivers/dma/mv_xor.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-) diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index db77903..ecacd32 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c @@ -1284,9 +1284,38 @@ mv_xor_conf_mbus_windows(struct mv_xor_shared_private *msp, writel(win_enable, base + WINDOW_BAR_ENABLE(1)); } +#ifdef CONFIG_PM +static int mv_xor_suspend(struct platform_device *pdev, pm_message_t state) +{ + return 0; +} + +static int mv_xor_resume(struct platform_device *pdev) +{ + struct mv_xor_device *device = platform_get_drvdata(pdev); + struct dma_chan *chan, *_chan; + struct mv_xor_chan *mv_chan; + + list_for_each_entry_safe(chan, _chan, &device->common.channels, + device_node) { + mv_chan = to_mv_xor_chan(chan); + mv_chan_unmask_interrupts(mv_chan); + + mv_set_mode(mv_chan, mv_chan->current_type); + } + return 0; +} + +#else +#define mv_xor_suspend NULL +#define mv_xor_resume NULL +#endif + static struct platform_driver mv_xor_driver = { .probe = mv_xor_probe, .remove = __devexit_p(mv_xor_remove), + .suspend = mv_xor_suspend, + .resume = mv_xor_resume, .driver = { .owner = THIS_MODULE, .name = MV_XOR_NAME, @@ -1355,9 +1384,36 @@ static int mv_xor_shared_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM +static int mv_xor_shared_suspend(struct platform_device *pdev, + pm_message_t state) +{ + return 0; +} + +static int mv_xor_shared_resume(struct platform_device *pdev) +{ + struct mv_xor_platform_shared_data *msd = pdev->dev.platform_data; + struct mv_xor_shared_private *msp = platform_get_drvdata(pdev); + /* + * (Re-)program MBUS remapping windows if we are asked to. + */ + if (msd != NULL && msd->dram != NULL) + mv_xor_conf_mbus_windows(msp, msd->dram); + + return 0; +} + +#else +#define mv_xor_shared_suspend NULL +#define mv_xor_shared_resume NULL +#endif + static struct platform_driver mv_xor_shared_driver = { .probe = mv_xor_shared_probe, .remove = mv_xor_shared_remove, + .suspend = mv_xor_shared_suspend, + .resume = mv_xor_shared_resume, .driver = { .owner = THIS_MODULE, .name = MV_XOR_SHARED_NAME, -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] mv_xor: add support for clkdev framework 2009-06-23 9:56 [PATCH] mv_xor: add support for clkdev framework Saeed Bishara 2009-06-23 9:56 ` [PATCH] mv_xor: add support for power management Saeed Bishara @ 2009-06-23 16:20 ` Dan Williams 2009-06-23 16:42 ` saeed bishara 2009-06-23 16:44 ` Nicolas Pitre 1 sibling, 2 replies; 9+ messages in thread From: Dan Williams @ 2009-06-23 16:20 UTC (permalink / raw) To: Saeed Bishara; +Cc: linux-raid, buytenh, nico, saeed.bishara Saeed Bishara wrote: > Signed-off-by: Saeed Bishara <saeed@marvell.com> > --- Can you expand the changelog to explain why this patch is needed and summarize what it does? Also, releasing patches this late in the merge window requires some extra justification and acks because I will not have a chance to get any exposure of this patch in linux-next, in general patches should be available before the merge window opens. Per the schedule the merge window can close any day now, so this may get delayed until 2.6.32. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mv_xor: add support for clkdev framework 2009-06-23 16:20 ` [PATCH] mv_xor: add support for clkdev framework Dan Williams @ 2009-06-23 16:42 ` saeed bishara 2009-06-23 16:44 ` Nicolas Pitre 1 sibling, 0 replies; 9+ messages in thread From: saeed bishara @ 2009-06-23 16:42 UTC (permalink / raw) To: Dan Williams; +Cc: Saeed Bishara, linux-raid, buytenh, nico On Tue, Jun 23, 2009 at 7:20 PM, Dan Williams<dan.j.williams@intel.com> wrote: > Saeed Bishara wrote: >> >> Signed-off-by: Saeed Bishara <saeed@marvell.com> >> --- > > Can you expand the changelog to explain why this patch is needed and > summarize what it does? ok, I'll re-send the patch Also, releasing patches this late in the merge > window requires some extra justification and acks because I will not have a > chance to get any exposure of this patch in linux-next, in general patches > should be available before the merge window opens. Per the schedule the > merge window can close any day now, so this may get delayed until 2.6.32. actually I was not looking to merge it for next release, I don't mind if the patch merged only in 2.6.32. sorry for not mentioning that. > > -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mv_xor: add support for clkdev framework 2009-06-23 16:20 ` [PATCH] mv_xor: add support for clkdev framework Dan Williams 2009-06-23 16:42 ` saeed bishara @ 2009-06-23 16:44 ` Nicolas Pitre 2009-06-23 17:00 ` Saeed Bishara 1 sibling, 1 reply; 9+ messages in thread From: Nicolas Pitre @ 2009-06-23 16:44 UTC (permalink / raw) To: Dan Williams; +Cc: Saeed Bishara, linux-raid, Lennert Buijtenhek, saeed.bishara On Tue, 23 Jun 2009, Dan Williams wrote: > Saeed Bishara wrote: > > Signed-off-by: Saeed Bishara <saeed@marvell.com> > > --- > > Can you expand the changelog to explain why this patch is needed and > summarize what it does? Also, releasing patches this late in the merge > window requires some extra justification and acks because I will not > have a chance to get any exposure of this patch in linux-next, in > general patches should be available before the merge window opens. Per > the schedule the merge window can close any day now, so this may get > delayed until 2.6.32. I don't expect for the clock API counter part to this patch to make it in this merge window either, so there is no rush. Nicolas ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mv_xor: add support for clkdev framework 2009-06-23 16:44 ` Nicolas Pitre @ 2009-06-23 17:00 ` Saeed Bishara 2009-06-23 17:11 ` Dan Williams 2009-06-23 17:22 ` Nicolas Pitre 0 siblings, 2 replies; 9+ messages in thread From: Saeed Bishara @ 2009-06-23 17:00 UTC (permalink / raw) To: Nicolas Pitre; +Cc: Dan Williams, linux-raid, Lennert Buijtenhek, saeed.bishara > > > > Can you expand the changelog to explain why this patch is needed and > > summarize what it does? Also, releasing patches this late in the merge Here is the patch with more explanation: ----------------------------------------< From c999ed53a913979f1739854cb7c881a9dde980c6 Mon Sep 17 00:00:00 2001 From: Saeed Bishara <saeed@marvell.com> Date: Tue, 12 May 2009 13:29:34 +0300 Subject: [PATCH 1/2 v2] mv_xor: add support for clkdev framework When the clkdev framework is enabled, the device's clock is gated by default, this patch uses the framework to enable the clock when using the driver loaded and disables it when unloading the driver. Signed-off-by: Saeed Bishara <saeed@marvell.com> --- drivers/dma/mv_xor.c | 16 ++++++++++++++++ drivers/dma/mv_xor.h | 4 ++++ 2 files changed, 20 insertions(+), 0 deletions(-) diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index ddab94f..db77903 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c @@ -1325,6 +1325,14 @@ static int mv_xor_shared_probe(struct platform_device *pdev) platform_set_drvdata(pdev, msp); +#if defined(CONFIG_HAVE_CLK) + msp->clk = clk_get(&pdev->dev, NULL); + if (IS_ERR(msp->clk)) + dev_notice(&pdev->dev, "cannot get clkdev\n"); + else + clk_enable(msp->clk); +#endif + /* * (Re-)program MBUS remapping windows if we are asked to. */ @@ -1336,6 +1344,14 @@ static int mv_xor_shared_probe(struct platform_device *pdev) static int mv_xor_shared_remove(struct platform_device *pdev) { +#if defined(CONFIG_HAVE_CLK) + struct mv_xor_shared_private *msp = platform_get_drvdata(pdev); + + if (!IS_ERR(msp->clk)) { + clk_disable(msp->clk); + clk_put(msp->clk); + } +#endif return 0; } diff --git a/drivers/dma/mv_xor.h b/drivers/dma/mv_xor.h index 06cafe1..08c3815 100644 --- a/drivers/dma/mv_xor.h +++ b/drivers/dma/mv_xor.h @@ -22,6 +22,7 @@ #include <linux/io.h> #include <linux/dmaengine.h> #include <linux/interrupt.h> +#include <linux/clk.h> #define USE_TIMER #define MV_XOR_SLOT_SIZE 64 @@ -55,6 +56,9 @@ struct mv_xor_shared_private { void __iomem *xor_base; void __iomem *xor_high_base; +#if defined(CONFIG_HAVE_CLK) + struct clk *clk; +#endif }; -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] mv_xor: add support for clkdev framework 2009-06-23 17:00 ` Saeed Bishara @ 2009-06-23 17:11 ` Dan Williams 2009-06-23 17:22 ` Nicolas Pitre 1 sibling, 0 replies; 9+ messages in thread From: Dan Williams @ 2009-06-23 17:11 UTC (permalink / raw) To: Saeed Bishara Cc: Nicolas Pitre, linux-raid, Lennert Buijtenhek, saeed.bishara Saeed Bishara wrote: >>> Can you expand the changelog to explain why this patch is needed and >>> summarize what it does? Also, releasing patches this late in the merge > Here is the patch with more explanation: Thanks, and thanks for the clarification about the target kernel. Regards, Dan ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mv_xor: add support for clkdev framework 2009-06-23 17:00 ` Saeed Bishara 2009-06-23 17:11 ` Dan Williams @ 2009-06-23 17:22 ` Nicolas Pitre 2009-06-24 7:29 ` Saeed Bishara 1 sibling, 1 reply; 9+ messages in thread From: Nicolas Pitre @ 2009-06-23 17:22 UTC (permalink / raw) To: Saeed Bishara; +Cc: Dan Williams, linux-raid, Lennert Buijtenhek, saeed.bishara On Tue, 23 Jun 2009, Saeed Bishara wrote: > > > > > > > Can you expand the changelog to explain why this patch is needed and > > > summarize what it does? Also, releasing patches this late in the merge > Here is the patch with more explanation: > ----------------------------------------< > >From c999ed53a913979f1739854cb7c881a9dde980c6 Mon Sep 17 00:00:00 2001 > From: Saeed Bishara <saeed@marvell.com> > Date: Tue, 12 May 2009 13:29:34 +0300 > Subject: [PATCH 1/2 v2] mv_xor: add support for clkdev framework > > When the clkdev framework is enabled, the device's clock is gated > by default, this patch uses the framework to enable the clock > when using the driver loaded and disables it when unloading the > driver. Can't you be more agressive with clock gating? Like using clk_get() when loading the driver and clk_put() when unloading, but using clk_enable()/clk_disable() only when a DMA channel is actually requested or active. Nicolas ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mv_xor: add support for clkdev framework 2009-06-23 17:22 ` Nicolas Pitre @ 2009-06-24 7:29 ` Saeed Bishara 0 siblings, 0 replies; 9+ messages in thread From: Saeed Bishara @ 2009-06-24 7:29 UTC (permalink / raw) To: Nicolas Pitre; +Cc: Dan Williams, linux-raid, Lennert Buijtenhek, saeed.bishara On Tue, 23 Jun 2009, Nicolas Pitre wrote: > On Tue, 23 Jun 2009, Saeed Bishara wrote: > > > > > > > > > > > Can you expand the changelog to explain why this patch is needed and > > > > summarize what it does? Also, releasing patches this late in the merge > > Here is the patch with more explanation: > > ----------------------------------------< > > >From c999ed53a913979f1739854cb7c881a9dde980c6 Mon Sep 17 00:00:00 2001 > > From: Saeed Bishara <saeed@marvell.com> > > Date: Tue, 12 May 2009 13:29:34 +0300 > > Subject: [PATCH 1/2 v2] mv_xor: add support for clkdev framework > > > > When the clkdev framework is enabled, the device's clock is gated > > by default, this patch uses the framework to enable the clock > > when using the driver loaded and disables it when unloading the > > driver. > > Can't you be more agressive with clock gating? > > Like using clk_get() when loading the driver and clk_put() when > unloading, but using clk_enable()/clk_disable() only when a DMA channel > is actually requested or active. I agree with your suggestion, I'll add it to my todo list :). however, I think that this should be managed by the DMA engine stack, low level drivers should only provide the run time suspend/resume functions, I think that can be done on top of the runtime PM framework, see http://lwn.net/Articles/336729/ > Nicolas > ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-06-24 7:29 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-06-23 9:56 [PATCH] mv_xor: add support for clkdev framework Saeed Bishara 2009-06-23 9:56 ` [PATCH] mv_xor: add support for power management Saeed Bishara 2009-06-23 16:20 ` [PATCH] mv_xor: add support for clkdev framework Dan Williams 2009-06-23 16:42 ` saeed bishara 2009-06-23 16:44 ` Nicolas Pitre 2009-06-23 17:00 ` Saeed Bishara 2009-06-23 17:11 ` Dan Williams 2009-06-23 17:22 ` Nicolas Pitre 2009-06-24 7:29 ` Saeed Bishara
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.