OMAP: Fix McBSP spin_lock deadlock
Subsystems (4)
PATCH v3 1/1 OMAP: Fix McBSP spin_lock deadlock
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.
mcbsp_clk is not the true clock, so delete it and ask omap_mcbsp_request enable mcbsp_ick and mcbsp_fck directly.
--- arch/arm/mach-omap1/mcbsp.c | 103 +++----------------- arch/arm/mach-omap2/mcbsp.c | 162 +++++++------------------------ arch/arm/plat-omap/include/mach/mcbsp.h | 6 +- arch/arm/plat-omap/mcbsp.c | 47 ++++++--- 4 files changed, 85 insertions(+), 233 deletions(-)
arch/arm/mach-omap1/mcbsp.c +12 -91
@@ -26,83 +26,6 @@#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) -{ -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 *), -GFP_KERNEL ); - -for (i =0 ; i < mclk->n_childs; 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])) -printk (KERN_ERR "Could not get clock %s (%d).\n" , - clk_names[i], mclk->clk.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[] = { - { - .clk = { - .name ="mcbsp_clk" , - .id =1 , - .enable = omap_mcbsp_clk_enable, - .disable = omap_mcbsp_clk_disable, - }, - }, - { - .clk = { - .name ="mcbsp_clk" , - .id =3 , - .enable = omap_mcbsp_clk_enable, - .disable = omap_mcbsp_clk_disable, - }, - }, -}; - -#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) -{ } -#endif -static void omap1_mcbsp_request (unsigned int id) {/*
@@ -165,8 +88,9 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = { .rx_irq = INT_McBSP1RX, .tx_irq = INT_McBSP1TX, .ops = &omap1_mcbsp_ops, - .clk_name = "mcbsp_clk", - }, + .ick_name = "mcbsp_ick", + .fck_name = "mcbsp_fck", + }, { .phys_base = OMAP1510_MCBSP2_BASE, .dma_rx_sync = OMAP_DMA_MCBSP2_RX,
@@ -182,7 +106,9 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = { .rx_irq = INT_McBSP3RX, .tx_irq = INT_McBSP3TX, .ops = &omap1_mcbsp_ops, - .clk_name = "mcbsp_clk", + .ick_name = "mcbsp_ick", + .fck_name = "mcbsp_fck", + }, };#define OMAP15XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap15xx_mcbsp_pdata)
@@ -200,7 +126,9 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = { .rx_irq = INT_McBSP1RX, .tx_irq = INT_McBSP1TX, .ops = &omap1_mcbsp_ops, - .clk_name = "mcbsp_clk", + .ick_name = "mcbsp_ick", + .fck_name = "mcbsp_fck", + }, { .phys_base = OMAP1610_MCBSP2_BASE,
@@ -217,7 +145,9 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = { .rx_irq = INT_McBSP3RX, .tx_irq = INT_McBSP3TX, .ops = &omap1_mcbsp_ops, - .clk_name = "mcbsp_clk", + .ick_name = "mcbsp_ick", + .fck_name = "mcbsp_fck", + }, };#define OMAP16XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap16xx_mcbsp_pdata)
@@ -228,15 +158,6 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {int __init omap1_mcbsp_init (void ) { -int i; - -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); - } - } -if (cpu_is_omap730 ()) omap_mcbsp_count =OMAP730_MCBSP_PDATA_SZ ;if (cpu_is_omap15xx ())
arch/arm/mach-omap2/mcbsp.c +36 -126
246 lines not on this page · raw message
arch/arm/plat-omap/include/mach/mcbsp.h +4 -2
@@ -340,7 +340,8 @@ struct omap_mcbsp_platform_data {u8 dma_rx_sync, dma_tx_sync;u16 rx_irq, tx_irq;struct omap_mcbsp_ops *ops; -char const *clk_name; +char const *ick_name; +char const *fck_name; };struct omap_mcbsp {
@@ -372,7 +373,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; };extern struct omap_mcbsp **mcbsp_ptr;extern int omap_mcbsp_count;
arch/arm/plat-omap/mcbsp.c +33 -14
80 lines not on this page · raw message
Signature · 1 line
1.5.6.3
OMAP3430 clock settings
Hi,
How do we find out clock settings on OMAP3430?
We need to find this out during runtime. Which register to read and
how to
know the clock settings of DSP, ARM and L3?
Regards,
Kishore.
SASKEN BUSINESS DISCLAIMER
-------------------------
This message may contain confidential, proprietary or legally privileged information. In case you are not the original intended Recipient of the message, you must not, directly or indirectly, use, Disclose, distribute, print, or copy any part of this message and you are requested to delete it and inform the sender. Any views expressed in this message are those of the individual sender unless otherwise stated. Nothing contained in this message shall be construed as an offer or acceptance of any offer by Sasken Communication Technologies Limited ("Sasken") unless sent with that express intent and with due authority of Sasken. Sasken has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any virus transmitted by this email
Re: OMAP3430 clock settings
Hi Krishna,
Quoted 3 lines · Krishna Kishore
We need to find this out during runtime. Which register to read and
how to
know the clock settings of DSP, ARM and L3?
Please refer to PRCM and Interconnect sections of the TRM, you may be interested in IVA2_CM, MPU_CM etc.
thanks
Ramesh
RE: OMAP3430 clock settings
Hi Ramesh Guptha,
Thanks a lot for your response.
We can check this PRCM section.
After reading IVA2_CM and MPU_CM registers, I want to know how to
calculate the clock speeds.
Since this procedure/formula will already be known, can you please
let me know?
Regards,
Kishore.
-----Original Message-----
From: Ramesh Gupta Guntha [mailto:[email protected]]
Sent: Wednesday, January 14, 2009 2:31 PM
To: Krishna Kishore
Cc: [email protected]
Subject: Re: OMAP3430 clock settings
Hi Krishna,
Quoted 3 lines · Krishna Kishore
We need to find this out during runtime. Which register to read and
how to
know the clock settings of DSP, ARM and L3?
Please refer to PRCM and Interconnect sections of the TRM, you may be interested in IVA2_CM, MPU_CM etc.
thanks
Ramesh
SASKEN BUSINESS DISCLAIMER
-------------------------
This message may contain confidential, proprietary or legally privileged information. In case you are not the original intended Recipient of the message, you must not, directly or indirectly, use, Disclose, distribute, print, or copy any part of this message and you are requested to delete it and inform the sender. Any views expressed in this message are those of the individual sender unless otherwise stated. Nothing contained in this message shall be construed as an offer or acceptance of any offer by Sasken Communication Technologies Limited ("Sasken") unless sent with that express intent and with due authority of Sasken. Sasken has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any virus transmitted by this email
Re: OMAP3430 clock settings
Quoted 3 lines · Krishna Kishore
After reading
IVA2_CMandMPU_CMregisters, I want to know how to calculate the clock speeds.
You should be using the clock framework. If you do that, then clk_get_rate() does that for you.
- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: OMAP3430 clock settings
In reply to Krishna KishoreKishore,
Quoted 3 lines
We need to find this out during runtime. Which register to read and
how to
know the clock settings of DSP, ARM and L3?
-- You can use this small utility to read/write/dump register values from user space. This is only for debug purpose if you want to peek and poke at some registers from user space.
https://omapzoom.org/gf/download/frsrelease/152/964/debuginfo.out
The usage is
For reading
./debuginfo.out r <Hex registerAddress without 0x prefix> <regAccessSize =8, 16, 32>
Eg: to read PM_PWSTCTRL_IVA2 register, it would be ./debuginfo.out r 483060E0 32
For writing
# ./debuginfo.out w <Hex registerAddress without 0x prefix> <regAccessSize =8, 16, 32> <value>
Eg: to write to PM_PWSTCTRL_IVA2 register, it would be ./debuginfo.out w 483060E0 32 <value>
For Dump
# ./debuginfo.out a <Hex registerAddress without 0x prefix> <numOfWordsToDump>
Eg: To dump first 100 values of IVA2_PRM registers ./debuginfo.out a 48306000 100
Thank you,
Best regards,
Hari
Quoted 44 lines
-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Krishna Kishore
Sent: Wednesday, January 14, 2009 1:41 AM
To: [email protected]
Subject: OMAP3430 clock settingsHi,
How do we find out clock settings on OMAP3430?
We need to find this out during runtime. Which register to read and
how to
know the clock settings of DSP, ARM and L3?Regards,
Kishore.
SASKEN BUSINESS DISCLAIMER
-------------------------
This message may contain confidential, proprietary or legally privileged information. In
case you are not the original intended Recipient of the message, you must not, directly or
indirectly, use, Disclose, distribute, print, or copy any part of this message and you are
requested to delete it and inform the sender. Any views expressed in this message are
those of the individual sender unless otherwise stated. Nothing contained in this message
shall be construed as an offer or acceptance of any offer by Sasken Communication
Technologies Limited ("Sasken") unless sent with that express intent and with due
authority of Sasken. Sasken has taken enough precautions to prevent the spread of
viruses. However the company accepts no liability for any damage caused by any virus
transmitted by this email--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: OMAP3430 clock settings
Hi Hari,
Thanks for providing this utility.
This is useful to read the values of registers from user space.
Can you please help us further by letting us know how to find out clock speeds of DSP, ARM, L3?
There are some multiplication factors to be used to arrive at clock speeds. Can you please let us know the procedure since it is already known?
Regards,
Kishore.
-----Original Message-----
From: Kanigeri, Hari [mailto:[email protected]]
Sent: Thursday, January 15, 2009 10:25 PM
To: Krishna Kishore; [email protected]
Subject: RE: OMAP3430 clock settings
Kishore,
Quoted 4 lines
We need to find this out during runtime. Which register to read and
how to
know the clock settings of DSP, ARM and L3?
-- You can use this small utility to read/write/dump register values from user space. This is only for debug purpose if you want to peek and poke at some registers from user space.
https://omapzoom.org/gf/download/frsrelease/152/964/debuginfo.out
The usage is
For reading
./debuginfo.out r <Hex registerAddress without 0x prefix> <regAccessSize =8, 16, 32>
Eg: to read PM_PWSTCTRL_IVA2 register, it would be ./debuginfo.out r 483060E0 32
For writing
# ./debuginfo.out w <Hex registerAddress without 0x prefix> <regAccessSize =8, 16, 32> <value>
Eg: to write to PM_PWSTCTRL_IVA2 register, it would be ./debuginfo.out w 483060E0 32 <value>
For Dump
# ./debuginfo.out a <Hex registerAddress without 0x prefix> <numOfWordsToDump>
Eg: To dump first 100 values of IVA2_PRM registers ./debuginfo.out a 48306000 100
Thank you,
Best regards,
Hari
Quoted 34 lines
-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Krishna Kishore
Sent: Wednesday, January 14, 2009 1:41 AM
To: [email protected]
Subject: OMAP3430 clock settingsHi,
How do we find out clock settings on OMAP3430?
We need to find this out during runtime. Which register to read and
how to
know the clock settings of DSP, ARM and L3?Regards,
Kishore.
SASKEN BUSINESS DISCLAIMER
-------------------------
This message may contain confidential, proprietary or legally privileged information. In case you are not the original intended Recipient of the message, you must not, directly or indirectly, use, Disclose, distribute, print, or copy any part of this message and you are requested to delete it and inform the sender. Any views expressed in this message are those of the individual sender unless otherwise stated. Nothing contained in this message shall be construed as an offer or acceptance of any offer by Sasken Communication Technologies Limited ("Sasken") unless sent with that express intent and with due authority of Sasken. Sasken has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any virus transmitted by this email
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
SASKEN BUSINESS DISCLAIMER
-------------------------
This message may contain confidential, proprietary or legally privileged information. In case you are not the original intended Recipient of the message, you must not, directly or indirectly, use, Disclose, distribute, print, or copy any part of this message and you are requested to delete it and inform the sender. Any views expressed in this message are those of the individual sender unless otherwise stated. Nothing contained in this message shall be construed as an offer or acceptance of any offer by Sasken Communication Technologies Limited ("Sasken") unless sent with that express intent and with due authority of Sasken. Sasken has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any virus transmitted by this email