Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Clock Protocol

Clock management operations via SCMI. More...

Files

file  clk.h
 Header file for the SCMI Clock Protocol.

Data Structures

struct  scmi_clock_config
 Describes the parameters for the CLOCK_CONFIG_SET command. More...
struct  scmi_clock_rate_config
 Describes the parameters for the CLOCK_RATE_SET command. More...
struct  scmi_clock_attributes
 Describes the content of the CLOCK_ATTRIBUTES command reply. More...

Macros

#define SCMI_CLK_CONFIG_DISABLE_ENABLE_MASK   GENMASK(1, 0)
 Mask of the enable/disable field in a CLOCK_CONFIG_SET attributes word.
#define SCMI_CLK_CONFIG_ENABLE_DISABLE(x)
 Extract the enable/disable field from a CLOCK_CONFIG_SET value x.
#define SCMI_CLK_ATTRIBUTES_CLK_NUM(x)
 Extract the number of clocks from a PROTOCOL_ATTRIBUTES reply x.
#define SCMI_CLK_RATE_SET_FLAGS_ASYNC   BIT(0)
 CLOCK_RATE_SET flag: perform the rate change asynchronously.
#define SCMI_CLK_RATE_SET_FLAGS_IGNORE_DELEAYED_RESP   BIT(1)
 CLOCK_RATE_SET flag: do not send a delayed response for async requests.
#define SCMI_CLK_RATE_SET_FLAGS_ROUNDS_UP_DOWN   BIT(2)
 CLOCK_RATE_SET flag: round the rate up (set) or down (cleared).
#define SCMI_CLK_RATE_SET_FLAGS_ROUNDS_AUTO   BIT(3)
 CLOCK_RATE_SET flag: round the rate to the closest supported value.
#define SCMI_CLK_PROTOCOL_SUPPORTED_VERSION   0x30000
 Version of the SCMI clock protocol supported by this driver.
#define SCMI_PROTO_VER_MAJOR(v)
 Clock name length (short version).
#define SCMI_PROTO_VER_MINOR(v)
 Extract minor version from SCMI protocol version.
#define SCMI_CLK_NAME_LEN   16
 clock name length (short version)
#define SCMI_CLK_ENABLED(attributes)
 Get the clock's enabled status based on given attributes.
#define SCMI_CLK_HAS_RESTRICTIONS(attributes)
 Check if a clock has restrictions based on given attributes.
#define SCMI_CLK_STATE_CONTROL_ALLOWED(permissions)
 Check if clock allows gating/ungating based on its permissions.

Functions

int scmi_clock_config_set (struct scmi_protocol *proto, struct scmi_clock_config *cfg)
 Send the CLOCK_CONFIG_SET command and get its reply.
int scmi_clock_rate_get (struct scmi_protocol *proto, uint32_t clk_id, uint32_t *rate)
 Query the rate of a clock.
int scmi_clock_rate_set (struct scmi_protocol *proto, struct scmi_clock_rate_config *cfg)
 Send the CLOCK_RATE_SET command and get its reply.
int scmi_clock_parent_get (struct scmi_protocol *proto, uint32_t clk_id, uint32_t *parent_id)
 Query the parent of a clock.
int scmi_clock_parent_set (struct scmi_protocol *proto, uint32_t clk_id, uint32_t parent_id)
 Send the CLOCK_PARENT_SET command and get its reply.
int scmi_clock_attributes (struct scmi_protocol *proto, uint32_t clk_id, struct scmi_clock_attributes *attributes)
 Send the CLOCK_ATTRIBUTES command and get its reply.
int scmi_clock_get_permissions (struct scmi_protocol *proto, uint32_t clk_id, uint32_t *permissions)
 Send the CLOCK_GET_PERMISSIONS command and get its reply.

Detailed Description

Clock management operations via SCMI.

Macro Definition Documentation

◆ SCMI_CLK_ATTRIBUTES_CLK_NUM

#define SCMI_CLK_ATTRIBUTES_CLK_NUM ( x)

#include <zephyr/drivers/firmware/scmi/clk.h>

Value:
((x) & GENMASK(15, 0))
#define GENMASK(h, l)
Create a contiguous bitmask starting at bit position l and ending at position h.
Definition util.h:80

Extract the number of clocks from a PROTOCOL_ATTRIBUTES reply x.

◆ SCMI_CLK_CONFIG_DISABLE_ENABLE_MASK

#define SCMI_CLK_CONFIG_DISABLE_ENABLE_MASK   GENMASK(1, 0)

#include <zephyr/drivers/firmware/scmi/clk.h>

Mask of the enable/disable field in a CLOCK_CONFIG_SET attributes word.

◆ SCMI_CLK_CONFIG_ENABLE_DISABLE

#define SCMI_CLK_CONFIG_ENABLE_DISABLE ( x)

#include <zephyr/drivers/firmware/scmi/clk.h>

Value:
#define SCMI_CLK_CONFIG_DISABLE_ENABLE_MASK
Mask of the enable/disable field in a CLOCK_CONFIG_SET attributes word.
Definition clk.h:26
__UINT32_TYPE__ uint32_t
Definition stdint.h:90

Extract the enable/disable field from a CLOCK_CONFIG_SET value x.

◆ SCMI_CLK_ENABLED

#define SCMI_CLK_ENABLED ( attributes)

#include <zephyr/drivers/firmware/scmi/clk.h>

Value:
((attributes) & BIT(0))
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44

Get the clock's enabled status based on given attributes.

◆ SCMI_CLK_HAS_RESTRICTIONS

#define SCMI_CLK_HAS_RESTRICTIONS ( attributes)

#include <zephyr/drivers/firmware/scmi/clk.h>

Value:
((attributes) & BIT(1))

Check if a clock has restrictions based on given attributes.

◆ SCMI_CLK_NAME_LEN

#define SCMI_CLK_NAME_LEN   16

#include <zephyr/drivers/firmware/scmi/clk.h>

clock name length (short version)

◆ SCMI_CLK_PROTOCOL_SUPPORTED_VERSION

#define SCMI_CLK_PROTOCOL_SUPPORTED_VERSION   0x30000

#include <zephyr/drivers/firmware/scmi/clk.h>

Version of the SCMI clock protocol supported by this driver.

◆ SCMI_CLK_RATE_SET_FLAGS_ASYNC

#define SCMI_CLK_RATE_SET_FLAGS_ASYNC   BIT(0)

#include <zephyr/drivers/firmware/scmi/clk.h>

CLOCK_RATE_SET flag: perform the rate change asynchronously.

◆ SCMI_CLK_RATE_SET_FLAGS_IGNORE_DELEAYED_RESP

#define SCMI_CLK_RATE_SET_FLAGS_IGNORE_DELEAYED_RESP   BIT(1)

#include <zephyr/drivers/firmware/scmi/clk.h>

CLOCK_RATE_SET flag: do not send a delayed response for async requests.

◆ SCMI_CLK_RATE_SET_FLAGS_ROUNDS_AUTO

#define SCMI_CLK_RATE_SET_FLAGS_ROUNDS_AUTO   BIT(3)

#include <zephyr/drivers/firmware/scmi/clk.h>

CLOCK_RATE_SET flag: round the rate to the closest supported value.

◆ SCMI_CLK_RATE_SET_FLAGS_ROUNDS_UP_DOWN

#define SCMI_CLK_RATE_SET_FLAGS_ROUNDS_UP_DOWN   BIT(2)

#include <zephyr/drivers/firmware/scmi/clk.h>

CLOCK_RATE_SET flag: round the rate up (set) or down (cleared).

◆ SCMI_CLK_STATE_CONTROL_ALLOWED

#define SCMI_CLK_STATE_CONTROL_ALLOWED ( permissions)

#include <zephyr/drivers/firmware/scmi/clk.h>

Value:
((permissions) & BIT(31))

Check if clock allows gating/ungating based on its permissions.

◆ SCMI_PROTO_VER_MAJOR

#define SCMI_PROTO_VER_MAJOR ( v)

#include <zephyr/drivers/firmware/scmi/clk.h>

Value:
((v) >> 16)

Clock name length (short version).

Extract major version from SCMI protocol version

Parameters
vCombined 32-bit protocol version (major << 16 | minor)
Returns
Major version number

◆ SCMI_PROTO_VER_MINOR

#define SCMI_PROTO_VER_MINOR ( v)

#include <zephyr/drivers/firmware/scmi/clk.h>

Value:
((v) & 0xFFFF)

Extract minor version from SCMI protocol version.

Parameters
vCombined 32-bit protocol version (major << 16 | minor)
Returns
Minor version number

Function Documentation

◆ scmi_clock_attributes()

int scmi_clock_attributes ( struct scmi_protocol * proto,
uint32_t clk_id,
struct scmi_clock_attributes * attributes )

#include <zephyr/drivers/firmware/scmi/clk.h>

Send the CLOCK_ATTRIBUTES command and get its reply.

Parameters
protoPointer to SCMI clock protocol data
clk_idID of the clock for which the query is done
attributesClock attributes returned by the command
Returns
0 on success, negative errno value on failure.

◆ scmi_clock_config_set()

int scmi_clock_config_set ( struct scmi_protocol * proto,
struct scmi_clock_config * cfg )

#include <zephyr/drivers/firmware/scmi/clk.h>

Send the CLOCK_CONFIG_SET command and get its reply.

Parameters
protoPointer to SCMI clock protocol data
cfgPointer to structure containing configuration to be set
Returns
0 on success, negative errno value on failure.

◆ scmi_clock_get_permissions()

int scmi_clock_get_permissions ( struct scmi_protocol * proto,
uint32_t clk_id,
uint32_t * permissions )

#include <zephyr/drivers/firmware/scmi/clk.h>

Send the CLOCK_GET_PERMISSIONS command and get its reply.

Parameters
protoPointer to SCMI clock protocol data
clk_idID of the clock for which the query is done
permissionsClock permissions returned by the command
Returns
0 on success, negative errno value on failure.

◆ scmi_clock_parent_get()

int scmi_clock_parent_get ( struct scmi_protocol * proto,
uint32_t clk_id,
uint32_t * parent_id )

#include <zephyr/drivers/firmware/scmi/clk.h>

Query the parent of a clock.

Parameters
protoPointer to SCMI clock protocol data
clk_idID of the clock for which the query is done
parent_idPointer to be set via this command
Returns
0 on success, negative errno value on failure.

◆ scmi_clock_parent_set()

int scmi_clock_parent_set ( struct scmi_protocol * proto,
uint32_t clk_id,
uint32_t parent_id )

#include <zephyr/drivers/firmware/scmi/clk.h>

Send the CLOCK_PARENT_SET command and get its reply.

Parameters
protoPointer to SCMI clock protocol data
clk_idID of the clock for which the query is done
parent_idto be set via this command to be set
Returns
0 on success, negative errno value on failure.

◆ scmi_clock_rate_get()

int scmi_clock_rate_get ( struct scmi_protocol * proto,
uint32_t clk_id,
uint32_t * rate )

#include <zephyr/drivers/firmware/scmi/clk.h>

Query the rate of a clock.

Parameters
protoPointer to SCMI clock protocol data
clk_idID of the clock for which the query is done
ratePointer to rate to be set via this command
Returns
0 on success, negative errno value on failure.

◆ scmi_clock_rate_set()

int scmi_clock_rate_set ( struct scmi_protocol * proto,
struct scmi_clock_rate_config * cfg )

#include <zephyr/drivers/firmware/scmi/clk.h>

Send the CLOCK_RATE_SET command and get its reply.

Parameters
protoPointer to SCMI clock protocol data
cfgPointer to structure containing configuration to be set
Returns
0 on success, negative errno value on failure.