public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kishon@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/6] ARM: AM43xx: Add support for disabling clocks in uboot
Date: Tue, 11 Aug 2015 14:55:30 +0530	[thread overview]
Message-ID: <55C9BF8A.1020603@ti.com> (raw)
In-Reply-To: <20150811090103.4347e499@amdc2363>

Hi,

On Tuesday 11 August 2015 12:31 PM, Lukasz Majewski wrote:
> Hi Kishon,
> 
>> Add do_disable_clocks() to disable clock domains and module clocks.
>> These clocks are enabled using do_enable_clocks().
> 
> Please correct the message subject. As fair as I can tell you are
> changing clocks on am33xx SoC, not AM43xx.

The same file is used by both am33xx and am43xx. Maybe I can change that to
am33xx/am43xx.
> 
>>
>> Cc: Roger Quadros <rogerq@ti.com>
>> Cc: Tero Kristo <t-kristo@ti.com>
>> Cc: Nishanth Menon <nm@ti.com>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>  arch/arm/cpu/armv7/am33xx/clock.c        |   53
>> ++++++++++++++++++++++++++++++
>> arch/arm/include/asm/arch-am33xx/clock.h |    1 + 2 files changed, 54
>> insertions(+)
>>
>> diff --git a/arch/arm/cpu/armv7/am33xx/clock.c
>> b/arch/arm/cpu/armv7/am33xx/clock.c index ec7d468..f6a4cee 100644
>> --- a/arch/arm/cpu/armv7/am33xx/clock.c
>> +++ b/arch/arm/cpu/armv7/am33xx/clock.c
>> @@ -144,6 +144,34 @@ static inline void enable_clock_module(u32
>> *const clkctrl_addr, u32 enable_mode,
>> wait_for_clk_enable(clkctrl_addr); }
>>  
>> +static inline void wait_for_clk_disable(u32 *clkctrl_addr)
>> +{
>> +	u32 clkctrl, idlest = MODULE_CLKCTRL_IDLEST_FULLY_FUNCTIONAL;
>> +	u32 bound = LDELAY;
>> +
>> +	while ((idlest != MODULE_CLKCTRL_IDLEST_DISABLED)) {
>> +		clkctrl = readl(clkctrl_addr);
>> +		idlest = (clkctrl & MODULE_CLKCTRL_IDLEST_MASK) >>
>> +			 MODULE_CLKCTRL_IDLEST_SHIFT;
>> +		if (--bound == 0) {
>> +			printf("Clock disable failed for 0x%p idlest
>> 0x%x\n",
>> +			       clkctrl_addr, clkctrl);
>> +			return;
>> +		}
>> +	}
>> +}
>> +
>> +static inline void disable_clock_module(u32 *const clkctrl_addr,
>> +					u32 wait_for_disable)
>> +{
>> +	clrsetbits_le32(clkctrl_addr, MODULE_CLKCTRL_MODULEMODE_MASK,
>> +			MODULE_CLKCTRL_MODULEMODE_SW_DISABLE <<
>> +			MODULE_CLKCTRL_MODULEMODE_SHIFT);
>> +	debug("Disable clock module - %p\n", clkctrl_addr);
>> +	if (wait_for_disable)
>> +		wait_for_clk_disable(clkctrl_addr);
>> +}
>> +
>>  static inline void enable_clock_domain(u32 *const clkctrl_reg, u32
>> enable_mode) {
>>  	clrsetbits_le32(clkctrl_reg, CD_CLKCTRL_CLKTRCTRL_MASK,
>> @@ -151,6 +179,14 @@ static inline void enable_clock_domain(u32
>> *const clkctrl_reg, u32 enable_mode) debug("Enable clock domain -
>> %p\n", clkctrl_reg); }
>>  
>> +static inline void disable_clock_domain(u32 *const clkctrl_reg)
>> +{
>> +	clrsetbits_le32(clkctrl_reg, CD_CLKCTRL_CLKTRCTRL_MASK,
>> +			CD_CLKCTRL_CLKTRCTRL_SW_SLEEP <<
>> +			CD_CLKCTRL_CLKTRCTRL_SHIFT);
>> +	debug("Disable clock domain - %p\n", clkctrl_reg);
>> +}
>> +
>>  void do_enable_clocks(u32 *const *clk_domains,
>>  		      u32 *const *clk_modules_explicit_en, u8
>> wait_for_enable) {
>> @@ -170,6 +206,23 @@ void do_enable_clocks(u32 *const *clk_domains,
>>  	};
>>  }
>>  
>> +void do_disable_clocks(u32 *const *clk_domains,
>> +			    u32 *const *clk_modules_disable,
>> +			    u8 wait_for_disable)
>> +{
>> +	u32 i, max = 100;
>> +
>> +
> 
> Remove one blank line here.

sure.

Thanks
Kishon

  reply	other threads:[~2015-08-11  9:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10 11:28 [U-Boot] [PATCH 0/6] ti: dwc3: Enable USB clocks on-demand Kishon Vijay Abraham I
2015-08-10 11:28 ` [U-Boot] [PATCH 1/6] ARM: OMAP5: Add support for disabling clocks in uboot Kishon Vijay Abraham I
2015-08-11  0:33   ` Tom Rini
2015-08-18 17:14   ` [U-Boot] [U-Boot, " Tom Rini
2015-08-10 11:28 ` [U-Boot] [PATCH 2/6] ARM: OMAP5: Add functions to enable and disable USB clocks Kishon Vijay Abraham I
2015-08-11  0:33   ` Tom Rini
2015-08-13 14:34     ` Kishon Vijay Abraham I
2015-08-10 11:28 ` [U-Boot] [PATCH 3/6] ARM: AM43xx: Add support for disabling clocks in uboot Kishon Vijay Abraham I
2015-08-11  0:33   ` Tom Rini
2015-08-11  7:01   ` Lukasz Majewski
2015-08-11  9:25     ` Kishon Vijay Abraham I [this message]
2015-08-10 11:28 ` [U-Boot] [PATCH 4/6] ARM: AM43xx: Add functions to enable and disable USB clocks Kishon Vijay Abraham I
2015-08-11  0:33   ` Tom Rini
2015-08-13 14:34     ` Kishon Vijay Abraham I
2015-08-10 11:28 ` [U-Boot] [PATCH 5/6] board: ti: invoke clock API to enable and disable clocks Kishon Vijay Abraham I
2015-08-11  0:34   ` Tom Rini
2015-08-10 11:28 ` [U-Boot] [PATCH 6/6] ARM: OMAP5/AM43xx: remove enabling USB clocks from enable_basic_clocks() Kishon Vijay Abraham I
2015-08-11  0:34   ` Tom Rini

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=55C9BF8A.1020603@ti.com \
    --to=kishon@ti.com \
    --cc=u-boot@lists.denx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox