zephyr/soc/arm/ti_simplelink/cc13x2_cc26x2/pinctrl_soc.h
Florian Grandel 31fb5f53d2 drivers: cc13xx_cc26xx: pinctrl: fix header conflict
CC13/26xx's pinctrl_cc13xx_cc26xx.c driver included ioc.h and
(indirectly) pinctrl_soc.h which contained duplicate defines.

This change removes the header conflict and redundant definitions.

This prepares for subsequent changes in this change set that add
additional flags to the pinctrl driver which would otherwise trigger the
header conflict.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-26 14:32:53 +02:00

43 lines
1.3 KiB
C

/*
* Copyright (c) 2022 Vaishnav Achath
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef TI_SIMPLELINK_CC13XX_CC26XX_SOC_PINCTRL_H_
#define TI_SIMPLELINK_CC13XX_CC26XX_SOC_PINCTRL_H_
#include <zephyr/types.h>
#include <driverlib/ioc.h>
typedef struct pinctrl_soc_pin {
uint32_t pin;
uint32_t iofunc;
uint32_t iomode;
} pinctrl_soc_pin_t;
/* Convert DT flags to SoC flags */
#define CC13XX_CC26XX_PIN_FLAGS(node_id) \
(DT_PROP(node_id, bias_pull_up) * IOC_IOPULL_UP | \
DT_PROP(node_id, bias_pull_down) * IOC_IOPULL_DOWN | \
DT_PROP(node_id, bias_disable) * IOC_NO_IOPULL | \
DT_PROP(node_id, drive_open_drain) * IOC_IOMODE_OPEN_DRAIN_NORMAL | \
DT_PROP(node_id, drive_open_source) * IOC_IOMODE_OPEN_SRC_NORMAL | \
DT_PROP(node_id, input_enable) * IOC_INPUT_ENABLE | \
DT_PROP(node_id, input_schmitt_enable) * IOC_HYST_ENABLE)
#define CC13XX_CC26XX_DT_PIN(node_id) \
{ \
.pin = DT_PROP_BY_IDX(node_id, pinmux, 0), \
.iofunc = DT_PROP_BY_IDX(node_id, pinmux, 1), \
.iomode = CC13XX_CC26XX_PIN_FLAGS(node_id) \
},
#define Z_PINCTRL_STATE_PIN_INIT(node_id, prop, idx) \
CC13XX_CC26XX_DT_PIN(DT_PROP_BY_IDX(node_id, prop, idx))
#define Z_PINCTRL_STATE_PINS_INIT(node_id, prop) \
{ DT_FOREACH_PROP_ELEM(node_id, prop, Z_PINCTRL_STATE_PIN_INIT) }
#endif /* TI_SIMPLELINK_CC13XX_CC26XX_SOC_PINCTRL_H_ */