Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
pinctrl_rcar_x5h_common.h File Reference

Renesas R-Car Gen5 pinctrl common definitions. More...

#include <stdint.h>
#include <zephyr/devicetree.h>
#include <zephyr/sys/util_macro.h>

Go to the source code of this file.

Data Structures

struct  rcar_pin_func
 Type for R-Car pin function. More...
struct  pinctrl_soc_pin
 Type for R-Car pin. More...
struct  pfc_drive_reg
 Type for R-Car DRVCTRLn registers. More...
struct  pfc_bias_reg
 Type for R-Car bias registers. More...

Macros

#define RCAR_PIN_FLAGS_PULL_SET   BIT(0)
 Pull-up, pull-down, or bias disable is requested.
#define RCAR_PIN_FLAGS_PUEN   BIT(1)
 Perform on/off control of the pull resistors.
#define RCAR_PIN_FLAGS_PUD   BIT(2)
 Select pull-up resistor if set, pull-down otherwise.
#define RCAR_PIN_FLAGS_FUNC_SET   BIT(3)
 Alternate function for the pin is requested.
#define RCAR_PIN_PULL_UP   (RCAR_PIN_FLAGS_PULL_SET | RCAR_PIN_FLAGS_PUEN | RCAR_PIN_FLAGS_PUD)
 Pull-up enabled.
#define RCAR_PIN_PULL_DOWN   (RCAR_PIN_FLAGS_PULL_SET | RCAR_PIN_FLAGS_PUEN)
 Pull-down enabled.
#define RCAR_PIN_PULL_DISABLE   RCAR_PIN_FLAGS_PULL_SET
 Pull disabled.
#define RCAR_ALTSEL(node_id)
 Utility macro to get the alternate function ID.
#define RCAR_HAS_ALTSEL(node_id)
 Utility macro to check if an alternate function is selected.
#define RCAR_PIN_FUNC(node_id)
 Utility macro to initialize R-Car pin function.
#define RCAR_PIN_FLAGS(node_id)
 Utility macro to initialize R-Car pin flags (bias and pin mode).
#define RCAR_DT_PIN(node_id)
 Utility macro to initialize a R-Car pin.

Typedefs

typedef struct pinctrl_soc_pin pinctrl_soc_pin_t
 Type for R-Car pin.

Detailed Description

Renesas R-Car Gen5 pinctrl common definitions.

Macro Definition Documentation

◆ RCAR_ALTSEL

#define RCAR_ALTSEL ( node_id)
Value:
DT_PROP_BY_IDX(node_id, pin, 1)
#define DT_PROP_BY_IDX(node_id, prop, idx)
Get the value at index idx in an array type property.
Definition devicetree.h:1019

Utility macro to get the alternate function ID.

Parameters
node_idNode identifier.

◆ RCAR_DT_PIN

#define RCAR_DT_PIN ( node_id)
Value:
{ \
.pin = DT_PROP_BY_IDX(node_id, pin, 0), \
.func = COND_CODE_1(RCAR_HAS_ALTSEL(node_id), \
(RCAR_PIN_FUNC(node_id)), ({0})), \
.flags = RCAR_PIN_FLAGS(node_id), \
.drive_strength_microamp = \
COND_CODE_1(DT_NODE_HAS_PROP(node_id, drive_strength_microamp), \
(DT_PROP(node_id, drive_strength_microamp)), (0))},
#define DT_NODE_HAS_PROP(node_id, prop)
Does a devicetree node have a property?
Definition devicetree.h:4080
#define DT_PROP(node_id, prop)
Get a devicetree property value.
Definition devicetree.h:873
#define COND_CODE_1(_flag, _if_1_code, _else_code)
Insert code depending on whether _flag expands to 1 or not.
Definition util_macro.h:209
flags
Definition parser.h:97
#define RCAR_PIN_FUNC(node_id)
Definition pinctrl_rcar_common.h:50
#define RCAR_PIN_FLAGS(node_id)
Definition pinctrl_rcar_common.h:62
#define RCAR_HAS_ALTSEL(node_id)
Utility macro to check if an alternate function is selected.
Definition pinctrl_rcar_x5h_common.h:59

Utility macro to initialize a R-Car pin.

Parameters
node_idNode identifier.

◆ RCAR_HAS_ALTSEL

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

Utility macro to check if an alternate function is selected.

Parameters
node_idNode identifier.

◆ RCAR_PIN_FLAGS

#define RCAR_PIN_FLAGS ( node_id)
Value:
DT_PROP(node_id, bias_pull_up) * RCAR_PIN_PULL_UP | \
DT_PROP(node_id, bias_pull_down) * RCAR_PIN_PULL_DOWN | \
DT_PROP(node_id, bias_disable) * RCAR_PIN_PULL_DISABLE | \
RCAR_HAS_ALTSEL(node_id) * RCAR_PIN_FLAGS_FUNC_SET
#define RCAR_PIN_PULL_DOWN
Definition pinctrl_rcar_common.h:34
#define RCAR_PIN_PULL_UP
Definition pinctrl_rcar_common.h:33
#define RCAR_PIN_PULL_DISABLE
Definition pinctrl_rcar_common.h:35
#define RCAR_PIN_FLAGS_FUNC_SET
Alternate function for the pin is requested.
Definition pinctrl_rcar_common.h:29

Utility macro to initialize R-Car pin flags (bias and pin mode).

Parameters
node_idNode identifier.

◆ RCAR_PIN_FLAGS_FUNC_SET

#define RCAR_PIN_FLAGS_FUNC_SET   BIT(3)

Alternate function for the pin is requested.

◆ RCAR_PIN_FLAGS_PUD

#define RCAR_PIN_FLAGS_PUD   BIT(2)

Select pull-up resistor if set, pull-down otherwise.

◆ RCAR_PIN_FLAGS_PUEN

#define RCAR_PIN_FLAGS_PUEN   BIT(1)

Perform on/off control of the pull resistors.

◆ RCAR_PIN_FLAGS_PULL_SET

#define RCAR_PIN_FLAGS_PULL_SET   BIT(0)

Pull-up, pull-down, or bias disable is requested.

◆ RCAR_PIN_FUNC

#define RCAR_PIN_FUNC ( node_id)
Value:
{ \
((RCAR_ALTSEL(node_id) >> 10U) & 0xFU), \
((RCAR_ALTSEL(node_id) >> 14U) & 0x1FU), \
((RCAR_ALTSEL(node_id) & 0xFU))}
#define RCAR_ALTSEL(node_id)
Utility macro to get the alternate function ID.
Definition pinctrl_rcar_x5h_common.h:52

Utility macro to initialize R-Car pin function.

Offsets are defined in dt-bindings pinctrl-rcar-common.h

Parameters
node_idNode identifier.

◆ RCAR_PIN_PULL_DISABLE

#define RCAR_PIN_PULL_DISABLE   RCAR_PIN_FLAGS_PULL_SET

Pull disabled.

◆ RCAR_PIN_PULL_DOWN

#define RCAR_PIN_PULL_DOWN   (RCAR_PIN_FLAGS_PULL_SET | RCAR_PIN_FLAGS_PUEN)

Pull-down enabled.

◆ RCAR_PIN_PULL_UP

#define RCAR_PIN_PULL_UP   (RCAR_PIN_FLAGS_PULL_SET | RCAR_PIN_FLAGS_PUEN | RCAR_PIN_FLAGS_PUD)

Pull-up enabled.

Typedef Documentation

◆ pinctrl_soc_pin_t

Type for R-Car pin.