Generic clocks are configurable clocks which run outside the system clock domain.
They are often connected to peripherals which have an asynchronous component running independently of the bus clock, e.g. USB controllers, low-power timers and RTCs, etc.
Note that not all platforms have support for generic clocks; on such platforms, this API will not be available.
Data Structures | |
struct | genclk_config |
Hardware representation of a set of generic clock parameters. More... | |
Enumerations | |
enum | genclk_source { GENCLK_SRC_OSC0 = 0, GENCLK_SRC_OSC1 = 1, GENCLK_SRC_PLL0 = 2, GENCLK_SRC_PLL1 = 3 } |
Generic clock source ID. More... | |
Functions | |
static void | genclk_enable_config (unsigned int id, enum genclk_source src, unsigned int divider) |
Enable the configuration defined by src and divider for the generic clock identified by id. More... | |
Generic clock configuration | |
static void | genclk_config_defaults (struct genclk_config *cfg, unsigned int id) |
Initialize cfg to the default configuration for the clock identified by id. More... | |
static void | genclk_config_read (struct genclk_config *cfg, unsigned int id) |
Read the currently active configuration of the clock identified by id into cfg. More... | |
static void | genclk_config_write (const struct genclk_config *cfg, unsigned int id) |
Activate the configuration cfg on the clock identified by id. More... | |
static void | genclk_config_set_source (struct genclk_config *cfg, enum genclk_source src) |
Select a new source clock src in configuration cfg. More... | |
static void | genclk_config_set_divider (struct genclk_config *cfg, unsigned int divider) |
Set a new divider in configuration cfg. More... | |
static void | genclk_enable_source (enum genclk_source src) |
Enable the source clock src used by a generic clock. More... | |
Enabling and disabling Generic Clocks | |
static void | genclk_enable (const struct genclk_config *cfg, unsigned int id) |
Activate the configuration cfg on the clock identified by id and enable it. More... | |
static void | genclk_disable (unsigned int id) |
Disable the generic clock identified by id. More... | |
Chip-specific generic clock definitions | |
#define | GENCLK_DIV_MAX ((1 << AVR32_PM_GCCTRL_DIV_SIZE) * 2) |
Maximum divider supported by the generic clock implementation. More... | |
#define GENCLK_DIV_MAX ((1 << AVR32_PM_GCCTRL_DIV_SIZE) * 2) |
Maximum divider supported by the generic clock implementation.
The max division factor applicable to the source clock of the generic clock.
Referenced by genclk_config_set_divider().
enum genclk_source |
|
inlinestatic |
Initialize cfg to the default configuration for the clock identified by id.
References genclk_config::ctrl.
Referenced by genclk_enable_config().
|
inlinestatic |
Read the currently active configuration of the clock identified by id into cfg.
References genclk_config::ctrl.
|
inlinestatic |
Set a new divider in configuration cfg.
References Assert, genclk_config::ctrl, and GENCLK_DIV_MAX.
Referenced by genclk_enable_config().
|
inlinestatic |
Select a new source clock src in configuration cfg.
References Assert, and genclk_config::ctrl.
Referenced by genclk_enable_config().
|
inlinestatic |
Activate the configuration cfg on the clock identified by id.
References genclk_config::ctrl.
|
inlinestatic |
Disable the generic clock identified by id.
Referenced by sysclk_disable_usb().
|
inlinestatic |
Activate the configuration cfg on the clock identified by id and enable it.
References genclk_config::ctrl.
Referenced by genclk_enable_config().
|
inlinestatic |
Enable the configuration defined by src and divider for the generic clock identified by id.
id | The ID of the generic clock. |
src | The source clock of the generic clock. |
divider | The divider used to generate the generic clock. |
References genclk_config_defaults(), genclk_config_set_divider(), genclk_config_set_source(), genclk_enable(), and genclk_enable_source().
Referenced by sysclk_enable_usb().
|
inlinestatic |
Enable the source clock src used by a generic clock.
References Assert, GENCLK_SRC_OSC0, GENCLK_SRC_OSC1, GENCLK_SRC_PLL0, GENCLK_SRC_PLL1, osc_enable(), OSC_ID_OSC0, OSC_ID_OSC1, osc_is_ready(), osc_wait_ready(), and pll_enable_config_defaults().
Referenced by genclk_enable_config().