Zephyr API Documentation 3.7.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
pinctrl_soc_kinetis_common.h
Go to the documentation of this file.
1/*
2 * Copyright 2022, 2024 NXP
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/*
8 * @file
9 * NXP Kinetis SOC specific helpers for pinctrl driver
10 */
11
12
13#ifndef ZEPHYR_SOC_ARM_NXP_KINETIS_COMMON_PINCTRL_SOC_H_
14#define ZEPHYR_SOC_ARM_NXP_KINETIS_COMMON_PINCTRL_SOC_H_
15
18#include <zephyr/devicetree.h>
19#include <zephyr/types.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25
27
28/* Kinetis KW/KL/KE series does not support open drain. Define macros to have no effect
29 * Note: KW22 and KW24 do support open drain, rest of KW series does not
30 */
31/* clang-format off */
32#if (defined(CONFIG_SOC_SERIES_KINETIS_KWX) && \
33 !(defined(CONFIG_SOC_MKW24D5) || defined(CONFIG_SOC_MKW22D5))) || \
34 defined(CONFIG_SOC_SERIES_KINETIS_KL2X) || defined(CONFIG_SOC_SERIES_KINETIS_KE1XF) || \
35 defined(CONFIG_SOC_SERIES_KE1XZ)
36#define PORT_PCR_ODE(x) 0x0
37#define PORT_PCR_ODE_MASK 0x0
38#endif
39/* clang-format on */
40
41/* Kinetis KE series does not support slew rate. Define macros to have no effect */
42#if defined(CONFIG_SOC_SERIES_KINETIS_KE1XF) || defined(CONFIG_SOC_SERIES_KE1XZ)
43#define PORT_PCR_SRE(x) 0x0
44#define PORT_PCR_SRE_MASK 0x0
45#endif
46
47#if !(defined(CONFIG_SOC_SERIES_MCXA))
48#define PORT_PCR_IBE(x) 0x0
49#define PORT_PCR_IBE_MASK 0x0
50#endif
51
52#define Z_PINCTRL_KINETIS_PINCFG(node_id) \
53 (PORT_PCR_DSE(DT_ENUM_IDX(node_id, drive_strength)) | \
54 PORT_PCR_PS(DT_PROP(node_id, bias_pull_up)) | \
55 PORT_PCR_PE(DT_PROP(node_id, bias_pull_up)) | \
56 PORT_PCR_PE(DT_PROP(node_id, bias_pull_down)) | \
57 PORT_PCR_ODE(DT_PROP(node_id, drive_open_drain)) | \
58 PORT_PCR_SRE(DT_ENUM_IDX(node_id, slew_rate)) | \
59 PORT_PCR_IBE(DT_PROP(node_id, input_enable)) | \
60 PORT_PCR_PFE(DT_PROP(node_id, nxp_passive_filter)))
61
62#define Z_PINCTRL_KINETIS_PCR_MASK \
63 (PORT_PCR_MUX_MASK | PORT_PCR_DSE_MASK | PORT_PCR_ODE_MASK | PORT_PCR_PFE_MASK | \
64 PORT_PCR_IBE_MASK | PORT_PCR_SRE_MASK | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK)
65
66#define Z_PINCTRL_STATE_PIN_INIT(group, pin_prop, idx) \
67 DT_PROP_BY_IDX(group, pin_prop, idx) | Z_PINCTRL_KINETIS_PINCFG(group),
68
69#define Z_PINCTRL_STATE_PINS_INIT(node_id, prop) \
70 {DT_FOREACH_CHILD_VARGS(DT_PHANDLE(node_id, prop), DT_FOREACH_PROP_ELEM, pinmux, \
71 Z_PINCTRL_STATE_PIN_INIT)};
72
73#ifdef __cplusplus
74}
75#endif
76
79#endif /* ZEPHYR_SOC_ARM_NXP_KINETIS_COMMON_PINCTRL_SOC_H_ */
Devicetree main header.
struct pinctrl_soc_pin pinctrl_soc_pin_t
Type for R-Car pin.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90