Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
clock.c File Reference
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/delay.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/bitops.h>
#include <asm/cpu.h>
#include <plat/clock.h>
#include <plat/prcm.h>
#include <trace/events/power.h>
#include "soc.h"
#include "clockdomain.h"
#include "clock.h"
#include "cm2xxx_3xxx.h"
#include "cm-regbits-24xx.h"
#include "cm-regbits-34xx.h"

Go to the source code of this file.

Functions

void omap2_init_clk_clkdm (struct clk *clk)
 
void __init omap2_clk_disable_clkdm_control (void)
 
void omap2_clk_dflt_find_companion (struct clk *clk, void __iomem **other_reg, u8 *other_bit)
 
void omap2_clk_dflt_find_idlest (struct clk *clk, void __iomem **idlest_reg, u8 *idlest_bit, u8 *idlest_val)
 
int omap2_dflt_clk_enable (struct clk *clk)
 
void omap2_dflt_clk_disable (struct clk *clk)
 
void omap2_clk_disable (struct clk *clk)
 
int omap2_clk_enable (struct clk *clk)
 
long omap2_clk_round_rate (struct clk *clk, unsigned long rate)
 
int omap2_clk_set_rate (struct clk *clk, unsigned long rate)
 
int omap2_clk_set_parent (struct clk *clk, struct clk *new_parent)
 
int __init omap2_clk_switch_mpurate_at_boot (const char *mpurate_ck_name)
 
void __init omap2_clk_print_new_rates (const char *hfclkin_ck_name, const char *core_ck_name, const char *mpu_ck_name)
 

Variables

u16 cpu_mask
 
struct clkops clkops_omap2_dflt_wait
 
struct clkops clkops_omap2_dflt
 
struct clk_functions omap2_clk_functions
 

Function Documentation

void omap2_clk_dflt_find_companion ( struct clk clk,
void __iomem **  other_reg,
u8 other_bit 
)

omap2_clk_dflt_find_companion - find companion clock to : struct clk * to find the companion clock of : void __iomem ** to return the companion clock CM_*CLKEN va in : u8 ** to return the companion clock bit shift in

Note: We don't need special code here for INVERT_ENABLE for the time being since INVERT_ENABLE only applies to clocks enabled by CM_CLKEN_PLL

Convert CM_ICLKEN* <-> CM_FCLKEN*. This conversion assumes it's just a matter of XORing the bits.

Some clocks don't have companion clocks. For example, modules with only an interface clock (such as MAILBOXES) don't have a companion clock. Right now, this code relies on the hardware exporting a bit in the correct companion register that indicates that the nonexistent 'companion clock' is active. Future patches will associate this type of code with per-module data structures to avoid this issue, and remove the casts. No return value.

Definition at line 149 of file clock.c.

void omap2_clk_dflt_find_idlest ( struct clk clk,
void __iomem **  idlest_reg,
u8 idlest_bit,
u8 idlest_val 
)

omap2_clk_dflt_find_idlest - find CM_IDLEST reg va, bit shift for : struct clk * to find IDLEST info for : void __iomem ** to return the CM_IDLEST va in : u8 * to return the CM_IDLEST bit shift in : u8 * to return the idle status indicator

Return the CM_IDLEST register address and bit shift corresponding to the module that "owns" this clock. This default code assumes that the CM_IDLEST bit shift is the CM_*CLKEN bit shift, and that the IDLEST register address ID corresponds to the CM_*CLKEN register address ID (e.g., that CM_FCLKEN2 corresponds to CM_IDLEST2). This is not true for all modules. No return value.

Definition at line 178 of file clock.c.

void omap2_clk_disable ( struct clk clk)

omap2_clk_disable - disable a clock, if the system is not using it : struct clk * to disable

Decrements the usecount on struct clk . If there are no users left, call the clkops-specific clock disable function to disable it in hardware. If the clock is part of a clockdomain (which they all should be), request that the clockdomain be disabled. (It too has a usecount, and so will not be disabled in the hardware until it no longer has any users.) If the clock has a parent clock (most of them do), then call ourselves, recursing on the parent clock. This can cause an entire branch of the clock tree to be powered off by simply disabling one clock. Intended to be called with the clockfw_lock spinlock held. No return value.

Definition at line 274 of file clock.c.

void __init omap2_clk_disable_clkdm_control ( void  )

omap2_clk_disable_clkdm_control - disable clkdm control on clk enable/disable

Prevent the OMAP clock code from calling into the clockdomain code when a hardware clock in that clockdomain is enabled or disabled. Intended to be called at init time from omap*_clk_init(). No return value.

Definition at line 123 of file clock.c.

int omap2_clk_enable ( struct clk clk)

omap2_clk_enable - request that the system enable a clock : struct clk * to enable

Increments the usecount on struct clk . If there were no users previously, then recurse up the clock tree, enabling all of the clock's parents and all of the parent clockdomains, and finally, enabling 's clockdomain, and itself. Intended to be called with the clockfw_lock spinlock held. Returns 0 upon success or a negative error code upon failure.

Definition at line 313 of file clock.c.

void __init omap2_clk_print_new_rates ( const char hfclkin_ck_name,
const char core_ck_name,
const char mpu_ck_name 
)

omap2_clk_print_new_rates - print summary of current clock tree rates : clk name for the off-chip HF oscillator : clk name for the on-chip CORE_CLK : clk name for the ARM MPU clock

Prints a short message to the console with the HFCLKIN oscillator rate, the rate of the CORE clock, and the rate of the ARM MPU clock. Called by the boot-time MPU rate switching code. XXX This is intended to be handled by the OPP layer code in the near future and should be removed from the clock code. No return value.

Definition at line 486 of file clock.c.

long omap2_clk_round_rate ( struct clk clk,
unsigned long  rate 
)

Definition at line 369 of file clock.c.

int omap2_clk_set_parent ( struct clk clk,
struct clk new_parent 
)

Definition at line 393 of file clock.c.

int omap2_clk_set_rate ( struct clk clk,
unsigned long  rate 
)

Definition at line 378 of file clock.c.

int __init omap2_clk_switch_mpurate_at_boot ( const char mpurate_ck_name)

omap2_clk_switch_mpurate_at_boot - switch ARM MPU rate by boot-time argument : clk name of the clock to change rate

Change the ARM MPU clock rate to the rate specified on the command line, if one was specified. should be "virt_prcm_set" on OMAP2xxx and "dpll1_ck" on OMAP34xx/OMAP36xx. XXX Does not handle voltage scaling - on OMAP2xxx this is currently handled by the virt_prcm_set clock, but this should be handled by the OPP layer. XXX This is intended to be handled by the OPP layer code in the near future and should be removed from the clock code. Returns -EINVAL if 'mpurate' is zero or if clk_set_rate() rejects the rate, -ENOENT if the struct clk referred to by cannot be found, or 0 upon success.

Definition at line 446 of file clock.c.

void omap2_dflt_clk_disable ( struct clk clk)

Definition at line 225 of file clock.c.

int omap2_dflt_clk_enable ( struct clk clk)

Definition at line 201 of file clock.c.

void omap2_init_clk_clkdm ( struct clk clk)

omap2_init_clk_clkdm - look up a clockdomain name, store pointer in clk : OMAP clock struct ptr to use

Convert a clockdomain name stored in a struct clk 'clk' into a clockdomain pointer, and save it into the struct clk. Intended to be called during clk_register(). No return value.

Definition at line 94 of file clock.c.

Variable Documentation

struct clkops clkops_omap2_dflt
Initial value:
= {
}

Definition at line 254 of file clock.c.

struct clkops clkops_omap2_dflt_wait
Initial value:
= {
.find_companion = omap2_clk_dflt_find_companion,
}

Definition at line 247 of file clock.c.

u16 cpu_mask

Definition at line 40 of file clock.c.

struct clk_functions omap2_clk_functions
Initial value:
= {
.clk_enable = omap2_clk_enable,
.clk_disable = omap2_clk_disable,
.clk_round_rate = omap2_clk_round_rate,
.clk_set_rate = omap2_clk_set_rate,
.clk_set_parent = omap2_clk_set_parent,
.clk_disable_unused = omap2_clk_disable_unused,
}

Definition at line 515 of file clock.c.