soc: riscv: telink_b91: new pinctrl driver support
Added basic support for new pinctrl driver. Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
This commit is contained in:
parent
17e6d1c6c1
commit
45744e7b35
2 changed files with 46 additions and 0 deletions
|
@ -31,6 +31,9 @@ config NUM_IRQS
|
||||||
int
|
int
|
||||||
default 64
|
default 64
|
||||||
|
|
||||||
|
config PINCTRL
|
||||||
|
default y
|
||||||
|
|
||||||
config XIP
|
config XIP
|
||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
|
|
43
soc/riscv/riscv-privilege/telink_b91/pinctrl_soc.h
Normal file
43
soc/riscv/riscv-privilege/telink_b91/pinctrl_soc.h
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 Telink Semiconductor
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SOC_RISCV_TELINK_B91_PINCTRL_SOC_H
|
||||||
|
#define SOC_RISCV_TELINK_B91_PINCTRL_SOC_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <devicetree.h>
|
||||||
|
#include <dt-bindings/pinctrl/b91-pinctrl.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Telink B91 pin type.
|
||||||
|
*/
|
||||||
|
typedef uint32_t pinctrl_soc_pin_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Utility macro to initialize each pin.
|
||||||
|
*
|
||||||
|
* @param node_id Node identifier.
|
||||||
|
* @param prop Property name.
|
||||||
|
* @param idx Property entry index.
|
||||||
|
*/
|
||||||
|
#define Z_PINCTRL_STATE_PIN_INIT(node_id, prop, idx) \
|
||||||
|
(DT_PROP(DT_PROP_BY_IDX(node_id, prop, idx), pinmux) | \
|
||||||
|
((B91_PULL_DOWN * DT_PROP(DT_PROP_BY_IDX(node_id, prop, idx), bias_pull_down)) \
|
||||||
|
<< B91_PULL_POS) | \
|
||||||
|
((B91_PULL_UP * DT_PROP(DT_PROP_BY_IDX(node_id, prop, idx), bias_pull_up)) \
|
||||||
|
<< B91_PULL_POS) \
|
||||||
|
),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Utility macro to initialize state pins contained in a given property.
|
||||||
|
*
|
||||||
|
* @param node_id Node identifier.
|
||||||
|
* @param prop Property name describing state pins.
|
||||||
|
*/
|
||||||
|
#define Z_PINCTRL_STATE_PINS_INIT(node_id, prop) \
|
||||||
|
{ DT_FOREACH_PROP_ELEM(node_id, prop, Z_PINCTRL_STATE_PIN_INIT) }
|
||||||
|
|
||||||
|
#endif /* SOC_RISCV_TELINK_B91_PINCTRL_SOC_H */
|
Loading…
Add table
Add a link
Reference in a new issue