Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros
clockdomain.h File Reference
#include <linux/init.h>
#include <linux/spinlock.h>
#include "powerdomain.h"
#include <plat/clock.h>
#include <plat/omap_hwmod.h>
#include <plat/cpu.h>

Go to the source code of this file.

Data Structures

struct  clkdm_autodep
 
struct  clkdm_dep
 
struct  clockdomain
 
struct  clkdm_ops
 

Macros

#define CLKDM_CAN_FORCE_SLEEP   (1 << 0)
 
#define CLKDM_CAN_FORCE_WAKEUP   (1 << 1)
 
#define CLKDM_CAN_ENABLE_AUTO   (1 << 2)
 
#define CLKDM_CAN_DISABLE_AUTO   (1 << 3)
 
#define CLKDM_NO_AUTODEPS   (1 << 4)
 
#define CLKDM_ACTIVE_WITH_MPU   (1 << 5)
 
#define CLKDM_MISSING_IDLE_REPORTING   (1 << 6)
 
#define CLKDM_CAN_HWSUP   (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_DISABLE_AUTO)
 
#define CLKDM_CAN_SWSUP   (CLKDM_CAN_FORCE_SLEEP | CLKDM_CAN_FORCE_WAKEUP)
 
#define CLKDM_CAN_HWSUP_SWSUP   (CLKDM_CAN_SWSUP | CLKDM_CAN_HWSUP)
 
#define _CLKDM_FLAG_HWSUP_ENABLED   BIT(0)
 

: clockdomain name

struct clockdomain - OMAP clockdomain

: powerdomain containing this clockdomain : CLKSTCTRL reg for the given clock domain : CLKTRCTRL/AUTOSTATE field mask in CM_CLKSTCTRL reg : Clockdomain capability flags : Flags for use only by internal clockdomain code : Bit shift of this clockdomain's PM_WKDEP/CM_SLEEPDEP bit : (OMAP4 only) PRCM partition ID for this clkdm's registers : (OMAP4 only) CM instance register offset : (OMAP4 only) CM clockdomain register offset : Clockdomains that can be told to wake this powerdomain up : Clockdomains that can be told to keep this clkdm from inact : Usecount tracking : list_head to link all clockdomains together

should be a macro from mach-omap2/prcm44xx.h (OMAP4 only) should be a macro ending in _INST from the OMAP4 CM instance definitions (OMAP4 only) should be a macro ending in _CDOFFS from the OMAP4 CM instance definitions (OMAP4 only)

struct clkdm_ops omap2_clkdm_operations
 
struct clkdm_ops omap3_clkdm_operations
 
struct clkdm_ops omap4_clkdm_operations
 
struct clkdm_ops am33xx_clkdm_operations
 
struct clkdm_dep gfx_24xx_wkdeps []
 
struct clkdm_dep dsp_24xx_wkdeps []
 
struct clockdomain wkup_common_clkdm
 
int clkdm_register_platform_funcs (struct clkdm_ops *co)
 
int clkdm_register_autodeps (struct clkdm_autodep *ia)
 
int clkdm_register_clkdms (struct clockdomain **c)
 
int clkdm_complete_init (void)
 
struct clockdomainclkdm_lookup (const char *name)
 
int clkdm_for_each (int(*fn)(struct clockdomain *clkdm, void *user), void *user)
 
struct powerdomainclkdm_get_pwrdm (struct clockdomain *clkdm)
 
int clkdm_add_wkdep (struct clockdomain *clkdm1, struct clockdomain *clkdm2)
 
int clkdm_del_wkdep (struct clockdomain *clkdm1, struct clockdomain *clkdm2)
 
int clkdm_read_wkdep (struct clockdomain *clkdm1, struct clockdomain *clkdm2)
 
int clkdm_clear_all_wkdeps (struct clockdomain *clkdm)
 
int clkdm_add_sleepdep (struct clockdomain *clkdm1, struct clockdomain *clkdm2)
 
int clkdm_del_sleepdep (struct clockdomain *clkdm1, struct clockdomain *clkdm2)
 
int clkdm_read_sleepdep (struct clockdomain *clkdm1, struct clockdomain *clkdm2)
 
int clkdm_clear_all_sleepdeps (struct clockdomain *clkdm)
 
void clkdm_allow_idle (struct clockdomain *clkdm)
 
void clkdm_deny_idle (struct clockdomain *clkdm)
 
bool clkdm_in_hwsup (struct clockdomain *clkdm)
 
bool clkdm_missing_idle_reporting (struct clockdomain *clkdm)
 
int clkdm_wakeup (struct clockdomain *clkdm)
 
int clkdm_sleep (struct clockdomain *clkdm)
 
int clkdm_clk_enable (struct clockdomain *clkdm, struct clk *clk)
 
int clkdm_clk_disable (struct clockdomain *clkdm, struct clk *clk)
 
int clkdm_hwmod_enable (struct clockdomain *clkdm, struct omap_hwmod *oh)
 
int clkdm_hwmod_disable (struct clockdomain *clkdm, struct omap_hwmod *oh)
 
void __init omap242x_clockdomains_init (void)
 
void __init omap243x_clockdomains_init (void)
 
void __init omap3xxx_clockdomains_init (void)
 
void __init am33xx_clockdomains_init (void)
 
void __init omap44xx_clockdomains_init (void)
 
void _clkdm_add_autodeps (struct clockdomain *clkdm)
 
void _clkdm_del_autodeps (struct clockdomain *clkdm)
 

Macro Definition Documentation

#define _CLKDM_FLAG_HWSUP_ENABLED   BIT(0)

Definition at line 101 of file clockdomain.h.

#define CLKDM_ACTIVE_WITH_MPU   (1 << 5)

Definition at line 55 of file clockdomain.h.

#define CLKDM_CAN_DISABLE_AUTO   (1 << 3)

Definition at line 53 of file clockdomain.h.

#define CLKDM_CAN_ENABLE_AUTO   (1 << 2)

Definition at line 52 of file clockdomain.h.

#define CLKDM_CAN_FORCE_SLEEP   (1 << 0)

Definition at line 50 of file clockdomain.h.

#define CLKDM_CAN_FORCE_WAKEUP   (1 << 1)

Definition at line 51 of file clockdomain.h.

#define CLKDM_CAN_HWSUP   (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_DISABLE_AUTO)

Definition at line 58 of file clockdomain.h.

#define CLKDM_CAN_HWSUP_SWSUP   (CLKDM_CAN_SWSUP | CLKDM_CAN_HWSUP)

Definition at line 60 of file clockdomain.h.

#define CLKDM_CAN_SWSUP   (CLKDM_CAN_FORCE_SLEEP | CLKDM_CAN_FORCE_WAKEUP)

Definition at line 59 of file clockdomain.h.

#define CLKDM_MISSING_IDLE_REPORTING   (1 << 6)

Definition at line 56 of file clockdomain.h.

#define CLKDM_NO_AUTODEPS   (1 << 4)

Definition at line 54 of file clockdomain.h.

Function Documentation

void _clkdm_add_autodeps ( struct clockdomain clkdm)

Definition at line 166 of file clockdomain.c.

void _clkdm_del_autodeps ( struct clockdomain clkdm)

Definition at line 196 of file clockdomain.c.

void __init am33xx_clockdomains_init ( void  )

Definition at line 191 of file clockdomains33xx_data.c.

int clkdm_add_sleepdep ( struct clockdomain clkdm1,
struct clockdomain clkdm2 
)

clkdm_add_sleepdep - add a sleep dependency from clkdm2 to clkdm1 : prevent this struct clockdomain * from sleeping (dependent) : when this struct clockdomain * is active (source)

Prevent from automatically going inactive (and then to retention or off) if is active. Returns -EINVAL if presented with invalid clockdomain pointers or called on a machine that does not support software-configurable hardware sleep dependencies, -ENOENT if the specified dependency cannot be set in hardware, or 0 upon success.

Definition at line 598 of file clockdomain.c.

int clkdm_add_wkdep ( struct clockdomain clkdm1,
struct clockdomain clkdm2 
)

clkdm_add_wkdep - add a wakeup dependency from clkdm2 to clkdm1 : wake this struct clockdomain * up (dependent) : when this struct clockdomain * wakes up (source)

When the clockdomain represented by wakes up, wake up . Implemented in hardware on the OMAP, this feature is designed to reduce wakeup latency of the dependent clockdomain . Returns -EINVAL if presented with invalid clockdomain pointers, -ENOENT if cannot wake up clkdm1 in hardware, or 0 upon success.

Definition at line 454 of file clockdomain.c.

void clkdm_allow_idle ( struct clockdomain clkdm)

clkdm_allow_idle - enable hwsup idle transitions for clkdm : struct clockdomain *

Allow the hardware to automatically switch the clockdomain into active or idle states, as needed by downstream clocks. If the clockdomain has any downstream clocks enabled in the clock framework, wkdep/sleepdep autodependencies are added; this is so device drivers can read and write to the device. No return value.

Definition at line 815 of file clockdomain.c.

int clkdm_clear_all_sleepdeps ( struct clockdomain clkdm)

clkdm_clear_all_sleepdeps - remove all sleep dependencies from target clkdm : struct clockdomain * to remove all sleep dependencies from

Remove all inter-clockdomain sleep dependencies that could prevent from idling. Intended to be used during boot to initialize the PRCM to a known state, after all clockdomains are put into swsup idle and woken up. Returns -EINVAL if pointer is invalid, or 0 upon success.

Definition at line 723 of file clockdomain.c.

int clkdm_clear_all_wkdeps ( struct clockdomain clkdm)

clkdm_clear_all_wkdeps - remove all wakeup dependencies from target clkdm : struct clockdomain * to remove all wakeup dependencies from

Remove all inter-clockdomain wakeup dependencies that could cause to wake. Intended to be used during boot to initialize the PRCM to a known state, after all clockdomains are put into swsup idle and woken up. Returns -EINVAL if pointer is invalid, or 0 upon success.

Definition at line 575 of file clockdomain.c.

int clkdm_clk_disable ( struct clockdomain clkdm,
struct clk clk 
)

clkdm_clk_disable - remove an enabled downstream clock from this clkdm : struct clockdomain * : struct clk * of the disabled downstream clock

Decrement the usecount of this clockdomain when is disabled. Intended to be called by clk_disable() code. If the clockdomain usecount goes to 0, put the clockdomain to sleep (software-supervised mode) or remove the clkdm autodependencies (hardware-supervised mode). Returns -EINVAL if passed null pointers; -ERANGE if the usecount underflows; or returns 0 upon success or if the clockdomain is in hwsup idle mode.

Definition at line 1018 of file clockdomain.c.

int clkdm_clk_enable ( struct clockdomain clkdm,
struct clk clk 
)

clkdm_clk_enable - add an enabled downstream clock to this clkdm : struct clockdomain * : struct clk * of the enabled downstream clock

Increment the usecount of the clockdomain and ensure that it is awake before is enabled. Intended to be called by clk_enable() code. If the clockdomain is in software-supervised idle mode, force the clockdomain to wake. If the clockdomain is in hardware-supervised idle mode, add clkdm-pwrdm autodependencies, to ensure that devices in the clockdomain can be read from/written to by on-chip processors. Returns -EINVAL if passed null pointers; returns 0 upon success or if the clockdomain is in hwsup idle mode.

Definition at line 992 of file clockdomain.c.

int clkdm_complete_init ( void  )

clkdm_complete_init - set up the clockdomain layer

Put all clockdomains into software-supervised mode; PM code should later enable hardware-supervised mode as appropriate. Must be called after clkdm_register_clkdms(). Returns -EACCES if called before clkdm_register_clkdms(), or 0 upon success.

Definition at line 342 of file clockdomain.c.

int clkdm_del_sleepdep ( struct clockdomain clkdm1,
struct clockdomain clkdm2 
)

clkdm_del_sleepdep - remove a sleep dependency from clkdm2 to clkdm1 : prevent this struct clockdomain * from sleeping (dependent) : when this struct clockdomain * is active (source)

Allow to automatically go inactive (and then to retention or off), independent of the activity state of . Returns -EINVAL if presented with invalid clockdomain pointers or called on a machine that does not support software-configurable hardware sleep dependencies, -ENOENT if the specified dependency cannot be cleared in hardware, or 0 upon success.

Definition at line 641 of file clockdomain.c.

int clkdm_del_wkdep ( struct clockdomain clkdm1,
struct clockdomain clkdm2 
)

clkdm_del_wkdep - remove a wakeup dependency from clkdm2 to clkdm1 : wake this struct clockdomain * up (dependent) : when this struct clockdomain * wakes up (source)

Remove a wakeup dependency causing to wake up when wakes up. Returns -EINVAL if presented with invalid clockdomain pointers, -ENOENT if cannot wake up clkdm1 in hardware, or 0 upon success.

Definition at line 495 of file clockdomain.c.

void clkdm_deny_idle ( struct clockdomain clkdm)

clkdm_deny_idle - disable hwsup idle transitions for clkdm : struct clockdomain *

Prevent the hardware from automatically switching the clockdomain into inactive or idle states. If the clockdomain has downstream clocks enabled in the clock framework, wkdep/sleepdep autodependencies are removed. No return value.

Definition at line 850 of file clockdomain.c.

int clkdm_for_each ( int(*)(struct clockdomain *clkdm, void *user fn,
void user 
)

Definition at line 405 of file clockdomain.c.

struct powerdomain* clkdm_get_pwrdm ( struct clockdomain clkdm)
read

clkdm_get_pwrdm - return a ptr to the pwrdm that this clkdm resides in : struct clockdomain *

Return a pointer to the struct powerdomain that the specified clockdomain exists in, or returns NULL if is NULL.

Definition at line 431 of file clockdomain.c.

int clkdm_hwmod_disable ( struct clockdomain clkdm,
struct omap_hwmod oh 
)

clkdm_hwmod_disable - remove an enabled downstream hwmod from this clkdm : struct clockdomain * : struct omap_hwmod * of the disabled downstream hwmod

Decrement the usecount of this clockdomain when is disabled. Intended to be called by module_disable() code. If the clockdomain usecount goes to 0, put the clockdomain to sleep (software-supervised mode) or remove the clkdm autodependencies (hardware-supervised mode). Returns -EINVAL if passed null pointers; -ERANGE if the usecount underflows; or returns 0 upon success or if the clockdomain is in hwsup idle mode.

Definition at line 1077 of file clockdomain.c.

int clkdm_hwmod_enable ( struct clockdomain clkdm,
struct omap_hwmod oh 
)

clkdm_hwmod_enable - add an enabled downstream hwmod to this clkdm : struct clockdomain * : struct omap_hwmod * of the enabled downstream hwmod

Increment the usecount of the clockdomain and ensure that it is awake before is enabled. Intended to be called by module_enable() code. If the clockdomain is in software-supervised idle mode, force the clockdomain to wake. If the clockdomain is in hardware-supervised idle mode, add clkdm-pwrdm autodependencies, to ensure that devices in the clockdomain can be read from/written to by on-chip processors. Returns -EINVAL if passed null pointers; returns 0 upon success or if the clockdomain is in hwsup idle mode.

Definition at line 1046 of file clockdomain.c.

bool clkdm_in_hwsup ( struct clockdomain clkdm)

clkdm_in_hwsup - is clockdomain have hardware-supervised idle enabled? : struct clockdomain *

Returns true if clockdomain currently has hardware-supervised idle enabled, or false if it does not or if is NULL. It is only valid to call this function after clkdm_init() has been called. This function does not actually read bits from the hardware; it instead tests an in-memory flag that is changed whenever the clockdomain code changes the auto-idle mode.

Definition at line 887 of file clockdomain.c.

struct clockdomain* clkdm_lookup ( const char name)
read

Definition at line 372 of file clockdomain.c.

bool clkdm_missing_idle_reporting ( struct clockdomain clkdm)

clkdm_missing_idle_reporting - can enter autoidle even if in use? : struct clockdomain *

Returns true if clockdomain has the CLKDM_MISSING_IDLE_REPORTING flag set, or false if not or is null. More information is available in the documentation for the CLKDM_MISSING_IDLE_REPORTING macro.

Definition at line 911 of file clockdomain.c.

int clkdm_read_sleepdep ( struct clockdomain clkdm1,
struct clockdomain clkdm2 
)

clkdm_read_sleepdep - read sleep dependency state from clkdm2 to clkdm1 : prevent this struct clockdomain * from sleeping (dependent) : when this struct clockdomain * is active (source)

Return 1 if a hardware sleep dependency exists wherein will not be allowed to automatically go inactive if is active; 0 if 's automatic power state inactivity transition is independent of 's; -EINVAL if either clockdomain pointer is invalid or called on a machine that does not support software-configurable hardware sleep dependencies; or -ENOENT if the hardware is incapable.

REVISIT: Currently this function only represents software-controllable sleep dependencies. Sleep dependencies fixed in hardware are not yet handled here.

Definition at line 688 of file clockdomain.c.

int clkdm_read_wkdep ( struct clockdomain clkdm1,
struct clockdomain clkdm2 
)

clkdm_read_wkdep - read wakeup dependency state from clkdm2 to clkdm1 : wake this struct clockdomain * up (dependent) : when this struct clockdomain * wakes up (source)

Return 1 if a hardware wakeup dependency exists wherein will be awoken when wakes up; 0 if dependency is not set; -EINVAL if either clockdomain pointer is invalid; or -ENOENT if the hardware is incapable.

REVISIT: Currently this function only represents software-controllable wakeup dependencies. Wakeup dependencies fixed in hardware are not yet handled here.

Definition at line 540 of file clockdomain.c.

int clkdm_register_autodeps ( struct clkdm_autodep ia)

clkdm_register_autodeps - register autodeps (if required) : pointer to a static array of struct clkdm_autodep to register

Register clockdomain "automatic dependencies." These are clockdomain wakeup and sleep dependencies that are automatically added whenever the first clock inside a clockdomain is enabled, and removed whenever the last clock inside a clockdomain is disabled. These are currently only used on OMAP3 devices, and are deprecated, since they waste energy. However, until the OMAP2/3 IP block enable/disable sequence can be converted to match the OMAP4 sequence, they are needed.

Must be called only after all of the SoC clockdomains are registered, since the function will resolve autodep clockdomain names into clockdomain pointers.

The struct clkdm_autodep array must be static, as this function does not copy the array elements.

Returns -EACCES if called before any clockdomains have been registered, -EINVAL if called with a null argument, -EEXIST if autodeps have already been registered, or 0 upon success.

Definition at line 314 of file clockdomain.c.

int clkdm_register_clkdms ( struct clockdomain **  cs)

clkdm_register_clkdms - register SoC clockdomains : pointer to an array of struct clockdomain to register

Register the clockdomains available on a particular OMAP SoC. Must be called after clkdm_register_platform_funcs(). May be called multiple times. Returns -EACCES if called before clkdm_register_platform_funcs(); -EINVAL if the argument is null; or 0 upon success.

Definition at line 274 of file clockdomain.c.

int clkdm_register_platform_funcs ( struct clkdm_ops co)

clkdm_register_platform_funcs - register clockdomain implementation fns : func pointers for arch specific implementations

Register the list of function pointers used to implement the clockdomain functions on different OMAP SoCs. Should be called before any other clkdm_register*() function. Returns -EINVAL if is null, -EEXIST if platform functions have already been registered, or 0 upon success.

Definition at line 251 of file clockdomain.c.

int clkdm_sleep ( struct clockdomain clkdm)

clkdm_sleep - force clockdomain sleep transition : struct clockdomain *

Instruct the CM to force a sleep transition on the specified clockdomain . Returns -EINVAL if is NULL or if clockdomain does not support software-initiated sleep; 0 upon success.

Definition at line 743 of file clockdomain.c.

int clkdm_wakeup ( struct clockdomain clkdm)

clkdm_wakeup - force clockdomain wakeup transition : struct clockdomain *

Instruct the CM to force a wakeup transition on the specified clockdomain . Returns -EINVAL if is NULL or if the clockdomain does not support software-controlled wakeup; 0 upon success.

Definition at line 778 of file clockdomain.c.

void __init omap242x_clockdomains_init ( void  )

Definition at line 144 of file clockdomains2420_data.c.

void __init omap243x_clockdomains_init ( void  )

Definition at line 170 of file clockdomains2430_data.c.

void __init omap3xxx_clockdomains_init ( void  )

Definition at line 497 of file clockdomains3xxx_data.c.

void __init omap44xx_clockdomains_init ( void  )

Definition at line 438 of file clockdomains44xx_data.c.

Variable Documentation

struct clkdm_ops am33xx_clkdm_operations

Definition at line 67 of file clockdomain33xx.c.

struct clkdm_dep dsp_24xx_wkdeps[]

Definition at line 68 of file clockdomains2xxx_3xxx_data.c.

struct clkdm_dep gfx_24xx_wkdeps[]

Definition at line 59 of file clockdomains2xxx_3xxx_data.c.

struct clkdm_ops omap2_clkdm_operations

Definition at line 311 of file clockdomain2xxx_3xxx.c.

struct clkdm_ops omap3_clkdm_operations

Definition at line 324 of file clockdomain2xxx_3xxx.c.

struct clkdm_ops omap4_clkdm_operations

Definition at line 136 of file clockdomain44xx.c.

struct clockdomain wkup_common_clkdm

Definition at line 87 of file clockdomains2xxx_3xxx_data.c.