Re: [PATCH v2] OMAP: Fix McBSP spin_lock deadlock.
Can you please repost your first version of the patch? Please. This V1 patch is good if one wishes to provide the fclk for McBSP from the MCBSP_CLKS. Then the fclk from the per can be turned off. With the V2 patch it's not that straightforward at all. - Eero -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] OMAP: Fix McBSP spin_lock deadlock.
* Eero Nurkkala ext-eero.nurkk...@nokia.com [090113 11:11]: Can you please repost your first version of the patch? Please. This V1 patch is good if one wishes to provide the fclk for McBSP from the MCBSP_CLKS. Then the fclk from the per can be turned off. With the V2 patch it's not that straightforward at all. I guess the V1 patch is the one at: http://marc.info/?l=linux-omapm=122588610400970w=2 But it needs to be refreshed to apply so let's wait for Stanley to repost it. Tony -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] OMAP: Fix McBSP spin_lock deadlock.
On Mon, 2009-01-12 at 12:46 +0200, Tony Lindgren wrote: * stanley.miao stanley.m...@windriver.com [090112 12:34]: On Thu, 2009-01-08 at 15:33 +0200, Tony Lindgren wrote: * stanley.miao stanley.m...@windriver.com [081107 15:47]: This solution keeps the virtual clock in place and enable the child clocks before enable the virtual clock. So, any comments ? What if we just removed the custom clock and had a struct **clk in struct omap_mcbsp that contains the clocks for each instance? It works. This is what I did in my first patch. OK, sorry for all this going back and forth.. It's OK. In order to make the code better, it is worth a little more job. We still don't have a good long term solution on how to handle different clocks.. snip Sounds like we should just apply your original patch, then figure out a good long term approacth. Can you please repost your first version of the patch? I will post the patch V3. Stanley. Regards, Tony -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] OMAP: Fix McBSP spin_lock deadlock.
On Thu, 2009-01-08 at 15:33 +0200, Tony Lindgren wrote: * stanley.miao stanley.m...@windriver.com [081107 15:47]: This solution keeps the virtual clock in place and enable the child clocks before enable the virtual clock. So, any comments ? What if we just removed the custom clock and had a struct **clk in struct omap_mcbsp that contains the clocks for each instance? It works. This is what I did in my first patch. The difference is I add two struct *clk in struct omap_mcbsp. struct omap_mcbsp { @@ -365,7 +366,8 @@ struct omap_mcbsp { /* Protect the field .free, while checking if the mcbsp is in use */ spinlock_t lock; struct omap_mcbsp_platform_data *pdata; - struct clk *clk; + struct clk *ick; + struct clk *fck; If one struct **clk is better, I will resend the patch later. Stanley -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] OMAP: Fix McBSP spin_lock deadlock.
* stanley.miao stanley.m...@windriver.com [090112 12:34]: On Thu, 2009-01-08 at 15:33 +0200, Tony Lindgren wrote: * stanley.miao stanley.m...@windriver.com [081107 15:47]: This solution keeps the virtual clock in place and enable the child clocks before enable the virtual clock. So, any comments ? What if we just removed the custom clock and had a struct **clk in struct omap_mcbsp that contains the clocks for each instance? It works. This is what I did in my first patch. OK, sorry for all this going back and forth.. We still don't have a good long term solution on how to handle different clocks.. The difference is I add two struct *clk in struct omap_mcbsp. struct omap_mcbsp { @@ -365,7 +366,8 @@ struct omap_mcbsp { /* Protect the field .free, while checking if the mcbsp is in use */ spinlock_t lock; struct omap_mcbsp_platform_data *pdata; - struct clk *clk; + struct clk *ick; + struct clk *fck; If one struct **clk is better, I will resend the patch later. Sounds like we should just apply your original patch, then figure out a good long term approacth. Can you please repost your first version of the patch? Regards, Tony -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] OMAP: Fix McBSP spin_lock deadlock.
This solution keeps the virtual clock in place and enable the child clocks before enable the virtual clock. So, any comments ? Stanley. On Thu, 2008-11-06 at 20:44 +0800, Stanley.Miao wrote: A spin_lock deadlock will occur when omap_mcbsp_request() is invoked. omap_mcbsp_request() -- clk_enable(mcbsp-clk) -- clk_enable get clockfw_lock, then call - omap2_clk_enable() -- _omap2_clk_enable() -- omap_mcbsp_clk_enable() -- clk_enable(mcbsp_ick)-- now clk_enable acquire clockfw_lock again. The solution: If a alias clock has some relative clocks, enable relative clocks before enable the alias clock. Signed-off-by: Stanley.Miao [EMAIL PROTECTED] --- arch/arm/mach-omap1/mcbsp.c | 67 ++-- arch/arm/mach-omap2/mcbsp.c | 88 +++--- arch/arm/plat-omap/clock.c |9 +++- arch/arm/plat-omap/include/mach/clock.h |2 + 4 files changed, 47 insertions(+), 119 deletions(-) diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c index 7de7c69..cf220be 100644 --- a/arch/arm/mach-omap1/mcbsp.c +++ b/arch/arm/mach-omap1/mcbsp.c @@ -26,80 +26,45 @@ #define DPS_RSTCT2_PER_EN(1 0) #define DSP_RSTCT2_WD_PER_EN (1 1) -struct mcbsp_internal_clk { - struct clk clk; - struct clk **childs; - int n_childs; -}; - #if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) -static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk) +static void omap_mcbsp_clk_init(struct clk *mclk) { const char *clk_names[] = { dsp_ck, api_ck, dspxor_ck }; int i; - mclk-n_childs = ARRAY_SIZE(clk_names); - mclk-childs = kzalloc(mclk-n_childs * sizeof(struct clk *), + mclk-n_relatives = ARRAY_SIZE(clk_names); + mclk-relatives = kzalloc(mclk-n_relatives * sizeof(struct clk *), GFP_KERNEL); - for (i = 0; i mclk-n_childs; i++) { + for (i = 0; i mclk-n_relatives; i++) { /* We fake a platform device to get correct device id */ struct platform_device pdev; pdev.dev.bus = platform_bus_type; - pdev.id = mclk-clk.id; - mclk-childs[i] = clk_get(pdev.dev, clk_names[i]); - if (IS_ERR(mclk-childs[i])) + pdev.id = mclk-id; + mclk-relatives[i] = clk_get(pdev.dev, clk_names[i]); + if (IS_ERR(mclk-relatives[i])) printk(KERN_ERR Could not get clock %s (%d).\n, - clk_names[i], mclk-clk.id); + clk_names[i], mclk-id); } } -static int omap_mcbsp_clk_enable(struct clk *clk) -{ - struct mcbsp_internal_clk *mclk = container_of(clk, - struct mcbsp_internal_clk, clk); - int i; - - for (i = 0; i mclk-n_childs; i++) - clk_enable(mclk-childs[i]); - return 0; -} - -static void omap_mcbsp_clk_disable(struct clk *clk) -{ - struct mcbsp_internal_clk *mclk = container_of(clk, - struct mcbsp_internal_clk, clk); - int i; - - for (i = 0; i mclk-n_childs; i++) - clk_disable(mclk-childs[i]); -} - -static struct mcbsp_internal_clk omap_mcbsp_clks[] = { +static struct clk omap_mcbsp_clks[] = { { - .clk = { - .name = mcbsp_clk, - .id = 1, - .enable = omap_mcbsp_clk_enable, - .disable= omap_mcbsp_clk_disable, - }, + .name = mcbsp_clk, + .id = 1, }, { - .clk = { - .name = mcbsp_clk, - .id = 3, - .enable = omap_mcbsp_clk_enable, - .disable= omap_mcbsp_clk_disable, - }, + .name = mcbsp_clk, + .id = 3, }, }; #define omap_mcbsp_clks_size ARRAY_SIZE(omap_mcbsp_clks) #else #define omap_mcbsp_clks_size 0 -static struct mcbsp_internal_clk __initdata *omap_mcbsp_clks; -static inline void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk) +static struct clk __initdata *omap_mcbsp_clks; +static inline void omap_mcbsp_clk_init(struct clk *mclk) { } #endif @@ -233,7 +198,7 @@ int __init omap1_mcbsp_init(void) for (i = 0; i omap_mcbsp_clks_size; i++) { if (cpu_is_omap15xx() || cpu_is_omap16xx()) { omap_mcbsp_clk_init(omap_mcbsp_clks[i]); - clk_register(omap_mcbsp_clks[i].clk); + clk_register(omap_mcbsp_clks[i]); } } diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c