Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Devicetree Clocks API

Topics

 FocalTech FT9001 clock identifiers
 Clock identifiers for FocalTech FT9001.
 NXP i.MX952 Clock Sources
 Root clock sources for i.MX952 SoC.

Macros

#define DT_CLOCKS_HAS_IDX(node_id, idx)
 Test if a node has a clocks phandle-array property at a given index.
#define DT_CLOCKS_HAS_NAME(node_id, name)
 Test if a node has a clock-names array property holds a given name.
#define DT_NUM_CLOCKS(node_id)
 Get the number of elements in a clocks property.
#define DT_CLOCKS_CTLR_BY_IDX(node_id, idx)
 Get the node identifier for the controller phandle from a "clocks" phandle-array property at an index.
#define DT_CLOCKS_CTLR(node_id)
 Equivalent to DT_CLOCKS_CTLR_BY_IDX(node_id, 0).
#define DT_CLOCKS_CTLR_BY_NAME(node_id, name)
 Get the node identifier for the controller phandle from a clocks phandle-array property by name.
#define DT_CLOCKS_CELL_BY_IDX(node_id, idx, cell)
 Get a clock specifier's cell value at an index.
#define DT_CLOCKS_CELL_BY_NAME(node_id, name, cell)
 Get a clock specifier's cell value by name.
#define DT_CLOCKS_CELL(node_id, cell)
 Equivalent to DT_CLOCKS_CELL_BY_IDX(node_id, 0, cell).
#define DT_INST_CLOCKS_HAS_IDX(inst, idx)
 Equivalent to DT_CLOCKS_HAS_IDX(DT_DRV_INST(inst), idx).
#define DT_INST_CLOCKS_HAS_NAME(inst, name)
 Equivalent to DT_CLOCK_HAS_NAME(DT_DRV_INST(inst), name).
#define DT_INST_NUM_CLOCKS(inst)
 Equivalent to DT_NUM_CLOCKS(DT_DRV_INST(inst)).
#define DT_INST_CLOCKS_CTLR_BY_IDX(inst, idx)
 Get the node identifier for the controller phandle from a "clocks" phandle-array property at an index.
#define DT_INST_CLOCKS_CTLR(inst)
 Equivalent to DT_INST_CLOCKS_CTLR_BY_IDX(inst, 0).
#define DT_INST_CLOCKS_CTLR_BY_NAME(inst, name)
 Get the node identifier for the controller phandle from a clocks phandle-array property by name.
#define DT_INST_CLOCKS_CELL_BY_IDX(inst, idx, cell)
 Get a DT_DRV_COMPAT instance's clock specifier's cell value at an index.
#define DT_INST_CLOCKS_CELL_BY_NAME(inst, name, cell)
 Get a DT_DRV_COMPAT instance's clock specifier's cell value by name.
#define DT_INST_CLOCKS_CELL(inst, cell)
 Equivalent to DT_INST_CLOCKS_CELL_BY_IDX(inst, 0, cell).

Detailed Description

Macro Definition Documentation

◆ DT_CLOCKS_CELL

#define DT_CLOCKS_CELL ( node_id,
cell )

#include <zephyr/devicetree/clocks.h>

Value:
DT_CLOCKS_CELL_BY_IDX(node_id, 0, cell)
#define DT_CLOCKS_CELL_BY_IDX(node_id, idx, cell)
Get a clock specifier's cell value at an index.
Definition clocks.h:208

Equivalent to DT_CLOCKS_CELL_BY_IDX(node_id, 0, cell).

Parameters
node_idnode identifier for a node with a clocks property
celllowercase-and-underscores cell name
Returns
the cell value at index 0
See also
DT_CLOCKS_CELL_BY_IDX()

◆ DT_CLOCKS_CELL_BY_IDX

#define DT_CLOCKS_CELL_BY_IDX ( node_id,
idx,
cell )

#include <zephyr/devicetree/clocks.h>

Value:
DT_PHA_BY_IDX(node_id, clocks, idx, cell)
#define DT_PHA_BY_IDX(node_id, pha, idx, cell)
Get a phandle-array specifier cell value at an index.
Definition devicetree.h:1687

Get a clock specifier's cell value at an index.

Example devicetree fragment:

clk1: clock-controller@... {
        compatible = "vnd,clock";
        #clock-cells = <2>;
};

n: node {
        clocks = <&clk1 10 20>, <&clk1 30 40>;
};

Bindings fragment for the vnd,clock compatible:

clock-cells:
  - bus
  - bits

Example usage:

DT_CLOCKS_CELL_BY_IDX(DT_NODELABEL(n), 0, bus) // 10
DT_CLOCKS_CELL_BY_IDX(DT_NODELABEL(n), 1, bits) // 40
Parameters
node_idnode identifier for a node with a clocks property
idxlogical index into clocks property
celllowercase-and-underscores cell name
Returns
the cell value at index "idx"
See also
DT_PHA_BY_IDX()

◆ DT_CLOCKS_CELL_BY_NAME

#define DT_CLOCKS_CELL_BY_NAME ( node_id,
name,
cell )

#include <zephyr/devicetree/clocks.h>

Value:
DT_PHA_BY_NAME(node_id, clocks, name, cell)
#define DT_PHA_BY_NAME(node_id, pha, name, cell)
Get a value within a phandle-array specifier by name.
Definition devicetree.h:1782

Get a clock specifier's cell value by name.

Example devicetree fragment:

clk1: clock-controller@... {
        compatible = "vnd,clock";
        #clock-cells = <2>;
};

n: node {
        clocks = <&clk1 10 20>, <&clk1 30 40>;
        clock-names = "alpha", "beta";
};

Bindings fragment for the vnd,clock compatible:

clock-cells:
  - bus
  - bits

Example usage:

DT_CLOCKS_CELL_BY_NAME(DT_NODELABEL(n), alpha, bus) // 10
DT_CLOCKS_CELL_BY_NAME(DT_NODELABEL(n), beta, bits) // 40
Parameters
node_idnode identifier for a node with a clocks property
namelowercase-and-underscores name of a clocks element as defined by the node's clock-names property
celllowercase-and-underscores cell name
Returns
the cell value in the specifier at the named element
See also
DT_PHA_BY_NAME()

◆ DT_CLOCKS_CTLR

#define DT_CLOCKS_CTLR ( node_id)

#include <zephyr/devicetree/clocks.h>

Value:
#define DT_CLOCKS_CTLR_BY_IDX(node_id, idx)
Get the node identifier for the controller phandle from a "clocks" phandle-array property at an index...
Definition clocks.h:137

Equivalent to DT_CLOCKS_CTLR_BY_IDX(node_id, 0).

Parameters
node_idnode identifier
Returns
a node identifier for the clocks controller at index 0 in "clocks"
See also
DT_CLOCKS_CTLR_BY_IDX()

◆ DT_CLOCKS_CTLR_BY_IDX

#define DT_CLOCKS_CTLR_BY_IDX ( node_id,
idx )

#include <zephyr/devicetree/clocks.h>

Value:
DT_PHANDLE_BY_IDX(node_id, clocks, idx)
#define DT_PHANDLE_BY_IDX(node_id, prop, idx)
Get a node identifier for a phandle in a property.
Definition devicetree.h:1908

Get the node identifier for the controller phandle from a "clocks" phandle-array property at an index.

Example devicetree fragment:

clk1: clock-controller@... { ... };

clk2: clock-controller@... { ... };

n: node {
        clocks = <&clk1 10 20>, <&clk2 30 40>;
};

Example usage:

DT_CLOCKS_CTLR_BY_IDX(DT_NODELABEL(n), 0)) // DT_NODELABEL(clk1)
DT_CLOCKS_CTLR_BY_IDX(DT_NODELABEL(n), 1)) // DT_NODELABEL(clk2)
Parameters
node_idnode identifier
idxlogical index into "clocks"
Returns
the node identifier for the clock controller referenced at index "idx"
See also
DT_PHANDLE_BY_IDX()

◆ DT_CLOCKS_CTLR_BY_NAME

#define DT_CLOCKS_CTLR_BY_NAME ( node_id,
name )

#include <zephyr/devicetree/clocks.h>

Value:
DT_PHANDLE_BY_NAME(node_id, clocks, name)
#define DT_PHANDLE_BY_NAME(node_id, pha, name)
Get a phandle's node identifier from a phandle array by name.
Definition devicetree.h:1856

Get the node identifier for the controller phandle from a clocks phandle-array property by name.

Example devicetree fragment:

clk1: clock-controller@... { ... };

clk2: clock-controller@... { ... };

n: node {
        clocks = <&clk1 10 20>, <&clk2 30 40>;
        clock-names = "alpha", "beta";
};

Example usage:

DT_CLOCKS_CTLR_BY_NAME(DT_NODELABEL(n), beta) // DT_NODELABEL(clk2)
Parameters
node_idnode identifier
namelowercase-and-underscores name of a clocks element as defined by the node's clock-names property
Returns
the node identifier for the clock controller referenced by name
See also
DT_PHANDLE_BY_NAME()

◆ DT_CLOCKS_HAS_IDX

#define DT_CLOCKS_HAS_IDX ( node_id,
idx )

#include <zephyr/devicetree/clocks.h>

Value:
DT_PROP_HAS_IDX(node_id, clocks, idx)
#define DT_PROP_HAS_IDX(node_id, prop, idx)
Is index idx valid for an array type property?
Definition devicetree.h:947

Test if a node has a clocks phandle-array property at a given index.

This expands to 1 if the given index is valid clocks property phandle-array index. Otherwise, it expands to 0.

Example devicetree fragment:

n1: node-1 {
        clocks = <...>, <...>;
};

n2: node-2 {
        clocks = <...>;
};

Example usage:

DT_CLOCKS_HAS_IDX(DT_NODELABEL(n1), 0) // 1
DT_CLOCKS_HAS_IDX(DT_NODELABEL(n1), 1) // 1
DT_CLOCKS_HAS_IDX(DT_NODELABEL(n1), 2) // 0
DT_CLOCKS_HAS_IDX(DT_NODELABEL(n2), 1) // 0
Parameters
node_idnode identifier; may or may not have any clocks property
idxindex of a clocks property phandle-array whose existence to check
Returns
1 if the index exists, 0 otherwise

◆ DT_CLOCKS_HAS_NAME

#define DT_CLOCKS_HAS_NAME ( node_id,
name )

#include <zephyr/devicetree/clocks.h>

Value:
DT_PROP_HAS_NAME(node_id, clocks, name)
#define DT_PROP_HAS_NAME(node_id, prop, name)
Is name name available in a foo-names property?
Definition devicetree.h:982

Test if a node has a clock-names array property holds a given name.

This expands to 1 if the name is available as clocks-name array property cell. Otherwise, it expands to 0.

Example devicetree fragment:

n1: node-1 {
        clocks = <...>, <...>;
        clock-names = "alpha", "beta";
};

n2: node-2 {
        clocks = <...>;
        clock-names = "alpha";
};

Example usage:

DT_CLOCKS_HAS_NAME(DT_NODELABEL(n1), alpha) // 1
DT_CLOCKS_HAS_NAME(DT_NODELABEL(n1), beta)  // 1
DT_CLOCKS_HAS_NAME(DT_NODELABEL(n2), beta)  // 0
Parameters
node_idnode identifier; may or may not have any clock-names property.
namelowercase-and-underscores clock-names cell value name to check
Returns
1 if the clock name exists, 0 otherwise

◆ DT_INST_CLOCKS_CELL

#define DT_INST_CLOCKS_CELL ( inst,
cell )

#include <zephyr/devicetree/clocks.h>

Value:
#define DT_INST_CLOCKS_CELL_BY_IDX(inst, idx, cell)
Get a DT_DRV_COMPAT instance's clock specifier's cell value at an index.
Definition clocks.h:327

Equivalent to DT_INST_CLOCKS_CELL_BY_IDX(inst, 0, cell).

Parameters
instDT_DRV_COMPAT instance number
celllowercase-and-underscores cell name
Returns
the value of the cell inside the specifier at index 0

◆ DT_INST_CLOCKS_CELL_BY_IDX

#define DT_INST_CLOCKS_CELL_BY_IDX ( inst,
idx,
cell )

#include <zephyr/devicetree/clocks.h>

Value:
#define DT_DRV_INST(inst)
Node identifier for an instance of a DT_DRV_COMPAT compatible.
Definition devicetree.h:4333

Get a DT_DRV_COMPAT instance's clock specifier's cell value at an index.

Parameters
instDT_DRV_COMPAT instance number
idxlogical index into clocks property
celllowercase-and-underscores cell name
Returns
the cell value at index "idx"
See also
DT_CLOCKS_CELL_BY_IDX()

◆ DT_INST_CLOCKS_CELL_BY_NAME

#define DT_INST_CLOCKS_CELL_BY_NAME ( inst,
name,
cell )

#include <zephyr/devicetree/clocks.h>

Value:
#define DT_CLOCKS_CELL_BY_NAME(node_id, name, cell)
Get a clock specifier's cell value by name.
Definition clocks.h:244

Get a DT_DRV_COMPAT instance's clock specifier's cell value by name.

Parameters
instDT_DRV_COMPAT instance number
namelowercase-and-underscores name of a clocks element as defined by the node's clock-names property
celllowercase-and-underscores cell name
Returns
the cell value in the specifier at the named element
See also
DT_CLOCKS_CELL_BY_NAME()

◆ DT_INST_CLOCKS_CTLR

#define DT_INST_CLOCKS_CTLR ( inst)

#include <zephyr/devicetree/clocks.h>

Value:
#define DT_INST_CLOCKS_CTLR_BY_IDX(inst, idx)
Get the node identifier for the controller phandle from a "clocks" phandle-array property at an index...
Definition clocks.h:292

Equivalent to DT_INST_CLOCKS_CTLR_BY_IDX(inst, 0).

Parameters
instinstance number
Returns
a node identifier for the clocks controller at index 0 in "clocks"
See also
DT_CLOCKS_CTLR()

◆ DT_INST_CLOCKS_CTLR_BY_IDX

#define DT_INST_CLOCKS_CTLR_BY_IDX ( inst,
idx )

#include <zephyr/devicetree/clocks.h>

Value:

Get the node identifier for the controller phandle from a "clocks" phandle-array property at an index.

Parameters
instinstance number
idxlogical index into "clocks"
Returns
the node identifier for the clock controller referenced at index "idx"
See also
DT_CLOCKS_CTLR_BY_IDX()

◆ DT_INST_CLOCKS_CTLR_BY_NAME

#define DT_INST_CLOCKS_CTLR_BY_NAME ( inst,
name )

#include <zephyr/devicetree/clocks.h>

Value:
#define DT_CLOCKS_CTLR_BY_NAME(node_id, name)
Get the node identifier for the controller phandle from a clocks phandle-array property by name.
Definition clocks.h:174

Get the node identifier for the controller phandle from a clocks phandle-array property by name.

Parameters
instinstance number
namelowercase-and-underscores name of a clocks element as defined by the node's clock-names property
Returns
the node identifier for the clock controller referenced by the named element
See also
DT_CLOCKS_CTLR_BY_NAME()

◆ DT_INST_CLOCKS_HAS_IDX

#define DT_INST_CLOCKS_HAS_IDX ( inst,
idx )

#include <zephyr/devicetree/clocks.h>

Value:
#define DT_CLOCKS_HAS_IDX(node_id, idx)
Test if a node has a clocks phandle-array property at a given index.
Definition clocks.h:53

Equivalent to DT_CLOCKS_HAS_IDX(DT_DRV_INST(inst), idx).

Parameters
instDT_DRV_COMPAT instance number; may or may not have any clocks property
idxindex of a clocks property phandle-array whose existence to check
Returns
1 if the index exists, 0 otherwise

◆ DT_INST_CLOCKS_HAS_NAME

#define DT_INST_CLOCKS_HAS_NAME ( inst,
name )

#include <zephyr/devicetree/clocks.h>

Value:
#define DT_CLOCKS_HAS_NAME(node_id, name)
Test if a node has a clock-names array property holds a given name.
Definition clocks.h:84

Equivalent to DT_CLOCK_HAS_NAME(DT_DRV_INST(inst), name).

Parameters
instDT_DRV_COMPAT instance number; may or may not have any clock-names property.
namelowercase-and-underscores clock-names cell value name to check
Returns
1 if the clock name exists, 0 otherwise

◆ DT_INST_NUM_CLOCKS

#define DT_INST_NUM_CLOCKS ( inst)

#include <zephyr/devicetree/clocks.h>

Value:
#define DT_NUM_CLOCKS(node_id)
Get the number of elements in a clocks property.
Definition clocks.h:108

Equivalent to DT_NUM_CLOCKS(DT_DRV_INST(inst)).

Parameters
instinstance number
Returns
number of elements in the clocks property

◆ DT_NUM_CLOCKS

#define DT_NUM_CLOCKS ( node_id)

#include <zephyr/devicetree/clocks.h>

Value:
DT_PROP_LEN(node_id, clocks)
#define DT_PROP_LEN(node_id, prop)
Get a property's logical length.
Definition devicetree.h:907

Get the number of elements in a clocks property.

Example devicetree fragment:

n1: node-1 {
        clocks = <&foo>, <&bar>;
};

n2: node-2 {
        clocks = <&foo>;
};

Example usage:

DT_NUM_CLOCKS(DT_NODELABEL(n1)) // 2
DT_NUM_CLOCKS(DT_NODELABEL(n2)) // 1
Parameters
node_idnode identifier with a clocks property
Returns
number of elements in the property