All of lore.kernel.org
 help / color / mirror / Atom feed
From: nsekhar@ti.com (Sekhar Nori)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 9/9] ARM: davinci: da850: Added dsp clock definition
Date: Thu, 24 Jan 2013 11:57:57 +0530	[thread overview]
Message-ID: <5100D46D.9030408@ti.com> (raw)
In-Reply-To: <13514BD7FAEBA745BBD7D8A672905C1431206095@DFLE08.ent.ti.com>

On 1/23/2013 7:07 AM, Tivy, Robert wrote:
>> -----Original Message-----
>> From: Nori, Sekhar
>> Sent: Tuesday, January 22, 2013 4:04 AM
>>
>> Rob,
>>
>> On 1/11/2013 5:53 AM, Robert Tivy wrote:
>>> Added dsp clock definition, keyed to "davinci-rproc.0".
>>>
>>> Signed-off-by: Robert Tivy <rtivy@ti.com>
>>> ---
>>>  arch/arm/mach-davinci/da850.c |    9 +++++++++
>>>  1 file changed, 9 insertions(+)
>>>
>>> diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-
>> davinci/da850.c
>>> index 097fcb2..50107c5 100644
>>> --- a/arch/arm/mach-davinci/da850.c
>>> +++ b/arch/arm/mach-davinci/da850.c
>>> @@ -375,6 +375,14 @@ static struct clk sata_clk = {
>>>  	.flags		= PSC_FORCE,
>>>  };
>>>
>>> +static struct clk dsp_clk = {
>>> +	.name		= "dsp",
>>> +	.parent		= &pll0_sysclk1,
>>> +	.domain		= DAVINCI_GPSC_DSPDOMAIN,
>>> +	.lpsc		= DA8XX_LPSC0_GEM,
>>> +	.flags		= PSC_LRST,
>>> +};
>>> +
>>>  static struct clk_lookup da850_clks[] = {
>>>  	CLK(NULL,		"ref",		&ref_clk),
>>>  	CLK(NULL,		"pll0",		&pll0_clk),
>>> @@ -421,6 +429,7 @@ static struct clk_lookup da850_clks[] = {
>>>  	CLK("spi_davinci.1",	NULL,		&spi1_clk),
>>>  	CLK("vpif",		NULL,		&vpif_clk),
>>>  	CLK("ahci",		NULL,		&sata_clk),
>>> +	CLK("davinci-rproc.0",	NULL,		&dsp_clk),
>>
>> Adding this clock node without the having the driver probed leads to
>> kernel hang while booting. With CONFIG_DAVINCI_RESET_CLOCKS=n, the
>> kernel boot fine. It looks like there is some trouble disabling the
>> clock if it is not used. Can you please check this issue?
>>
>> Thanks,
>> Sekhar
> 
> Sekhar,
> 
> Thankyou for trying that out.
> 
> I discovered that the kernel boot hang is caused when trying to disable this clk during init, from within the function davinci_clk_disable_unused().  That function calls davinci_psc_config() which attempts to disable the DSP clock.  Since this clk is enabled after reset, disabling it involves a state transition, and therefore the function must wait for GOSTAT[1] to be 0.  For most peripherals this happens automatically, but for the DSP (and ARM, too), the DSP must execute the IDLE instruction to allow a clock enable->disable transition.  Since this is bootup and there is no real program on the DSP yet, this doesn't happen.
> 
> I was able to overcome this by adding PSC_FORCE to the clk->flags for dsp_clk.  In fact, without PSC_FORCE I was not able to "rmmod davinci_remoteproc" since the firmware file that I'm loading did not execute IDLE.  It feels like for davinci we should have a way to control the clk->flags' PSC_FORCE setting at run-time.  The PSC_FORCE would be set initially (during boot) and the user (or system integrator) would have a way to unset it dynamically.  That way, when the DSP firmware does actually have a structured way to enter IDLE, the user can say "I'd like a structured shutdown" and unset PSC_FORCE (via a clean API).  But for now I'm just going to turn on PSC_FORCE:
> 	.flags		= PSC_LRST | PSC_FORCE,

Thanks for the debug. It works for me after I added PSC_FORCE. Here is 
the patch I am finally committing.

Thanks,
Sekhar

commit 09810a853b9a7920ba8c250d18815ef236effc47
Author:     Robert Tivy <rtivy@ti.com>
AuthorDate: Thu Jan 10 16:23:22 2013 -0800
Commit:     Sekhar Nori <nsekhar@ti.com>
CommitDate: Thu Jan 24 10:54:08 2013 +0530

    ARM: davinci: da850: add dsp clock definition
    
    Added dsp clock definition, keyed to "davinci-rproc.0".
    DSP clocks is derived from pll0 sysclk1. Add a clock tree
    node for that too.
    
    Signed-off-by: Robert Tivy <rtivy@ti.com>
    [nsekhar at ti.com: merge addition of pll0 sysclk1 and dsp clock
    into one commit. Add PSC_FORCE to dsp clock node to handle the
    case where DSP does not go into IDLE and its clock needs to
    be disabled.]
    Signed-off-by: Sekhar Nori <nsekhar@ti.com>

diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 6b9154e..0c4a26d 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -76,6 +76,13 @@ static struct clk pll0_aux_clk = {
 	.flags		= CLK_PLL | PRE_PLL,
 };
 
+static struct clk pll0_sysclk1 = {
+	.name		= "pll0_sysclk1",
+	.parent		= &pll0_clk,
+	.flags		= CLK_PLL,
+	.div_reg	= PLLDIV1,
+};
+
 static struct clk pll0_sysclk2 = {
 	.name		= "pll0_sysclk2",
 	.parent		= &pll0_clk,
@@ -368,10 +375,19 @@ static struct clk sata_clk = {
 	.flags		= PSC_FORCE,
 };
 
+static struct clk dsp_clk = {
+	.name		= "dsp",
+	.parent		= &pll0_sysclk1,
+	.domain		= DAVINCI_GPSC_DSPDOMAIN,
+	.lpsc		= DA8XX_LPSC0_GEM,
+	.flags		= PSC_LRST | PSC_FORCE,
+};
+
 static struct clk_lookup da850_clks[] = {
 	CLK(NULL,		"ref",		&ref_clk),
 	CLK(NULL,		"pll0",		&pll0_clk),
 	CLK(NULL,		"pll0_aux",	&pll0_aux_clk),
+	CLK(NULL,		"pll0_sysclk1",	&pll0_sysclk1),
 	CLK(NULL,		"pll0_sysclk2",	&pll0_sysclk2),
 	CLK(NULL,		"pll0_sysclk3",	&pll0_sysclk3),
 	CLK(NULL,		"pll0_sysclk4",	&pll0_sysclk4),
@@ -413,6 +429,7 @@ static struct clk_lookup da850_clks[] = {
 	CLK("spi_davinci.1",	NULL,		&spi1_clk),
 	CLK("vpif",		NULL,		&vpif_clk),
 	CLK("ahci",		NULL,		&sata_clk),
+	CLK("davinci-rproc.0",	NULL,		&dsp_clk),
 	CLK(NULL,		NULL,		NULL),
 };
 

      reply	other threads:[~2013-01-24  6:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1357863807-380-1-git-send-email-rtivy@ti.com>
     [not found] ` <1357863807-380-7-git-send-email-rtivy@ti.com>
2013-01-11 12:26   ` [PATCH v5 6/9] ARM: davinci: Remoteproc driver support for OMAP-L138 DSP Ohad Ben-Cohen
2013-01-12  2:26     ` Tivy, Robert
2013-01-15  9:15       ` Sekhar Nori
2013-01-15 10:03         ` Ohad Ben-Cohen
2013-01-15 12:29           ` Sekhar Nori
2013-01-15 12:49             ` Ohad Ben-Cohen
2013-01-15 23:06               ` Tivy, Robert
2013-01-15 23:17                 ` Ohad Ben-Cohen
2013-01-16  5:16               ` Sekhar Nori
2013-01-15 10:00       ` Ohad Ben-Cohen
2013-01-12  9:31     ` Russell King - ARM Linux
2013-01-21  5:38   ` Sekhar Nori
2013-01-21 16:41     ` Russell King - ARM Linux
2013-01-21 18:53       ` Tivy, Robert
2013-01-22  2:09     ` Tivy, Robert
     [not found] ` <1357863807-380-2-git-send-email-rtivy@ti.com>
2013-01-16 13:55   ` [PATCH v5 1/9] ARM: davinci: da850 board: change pr_warning() to pr_warn() Sekhar Nori
     [not found] ` <1357863807-380-3-git-send-email-rtivy@ti.com>
2013-01-17  7:47   ` [PATCH v5 2/9] ARM: davinci: devices-da8xx.c: " Sekhar Nori
     [not found] ` <1357863807-380-5-git-send-email-rtivy@ti.com>
2013-01-17  7:55   ` [PATCH v5 4/9] ARM: davinci: da850: added pll0_sysclk1 for DSP usage Sekhar Nori
     [not found] ` <1357863807-380-6-git-send-email-rtivy@ti.com>
2013-01-17 11:33   ` [PATCH v5 5/9] ARM: davinci: New reset functionality/API provided for Davinci DSP Sekhar Nori
2013-01-17 17:46     ` Tivy, Robert
     [not found] ` <1357863807-380-8-git-send-email-rtivy@ti.com>
2013-01-21  8:34   ` [PATCH v5 7/9] ARM: davinci: Remoteproc platform device creation data/code Sekhar Nori
2013-01-22  2:33     ` Tivy, Robert
     [not found] ` <1357863807-380-9-git-send-email-rtivy@ti.com>
2013-01-21  8:36   ` [PATCH v5 8/9] ARM: davinci: da850 board: Added .reserve function and rproc platform registration Sekhar Nori
     [not found] ` <1357863807-380-10-git-send-email-rtivy@ti.com>
2013-01-21 10:36   ` [PATCH v5 9/9] ARM: davinci: da850: Added dsp clock definition Sekhar Nori
2013-01-22 12:03   ` Sekhar Nori
2013-01-23  1:37     ` Tivy, Robert
2013-01-24  6:27       ` Sekhar Nori [this message]

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=5100D46D.9030408@ti.com \
    --to=nsekhar@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.