drivers: pinctrl: support digital-path-disable for Numaker

Add new property digital-path-disable for Nuvoton numaker pinctrl driver.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
This commit is contained in:
cyliang tw 2024-05-08 09:35:08 +08:00 committed by Anas Nashif
parent 385c6874ef
commit de58070fa4
3 changed files with 10 additions and 2 deletions

View File

@ -16,7 +16,9 @@
#define GPIO_SIZE DT_REG_SIZE(DT_NODELABEL(gpioa))
#define SLEWCTL_PIN_SHIFT(pin_idx) ((pin_idx) * 2)
#define SLEWCTL_MASK(pin_idx) (3 << SLEWCTL_PIN_SHIFT(pin_idx))
#define SLEWCTL_MASK(pin_idx) (3 << SLEWCTL_PIN_SHIFT(pin_idx))
#define DINOFF_PIN_SHIFT(pin_idx) (pin_idx + GPIO_DINOFF_DINOFF0_Pos)
#define DINOFF_MASK(pin_idx) (1 << DINOFF_PIN_SHIFT(pin_idx))
static void gpio_configure(const pinctrl_soc_pin_t *pin, uint8_t port_idx, uint8_t pin_idx)
{
@ -28,7 +30,8 @@ static void gpio_configure(const pinctrl_soc_pin_t *pin, uint8_t port_idx, uint8
((pin->schmitt_enable ? 1 : 0) << pin_idx);
port->SLEWCTL = (port->SLEWCTL & ~SLEWCTL_MASK(pin_idx)) |
(pin->slew_rate << SLEWCTL_PIN_SHIFT(pin_idx));
port->DINOFF = (port->DINOFF & ~DINOFF_MASK(pin_idx)) |
((pin->digital_disable ? 1 : 0) << DINOFF_PIN_SHIFT(pin_idx));
}
/**
* Configure pin multi-function

View File

@ -83,3 +83,6 @@ child-binding:
Set the speed of a pin. This setting effectively limits the
slew rate of the output signal. Hardware default configuration is low.
Fast slew rate could support fast speed pins, like as SPI CLK up to 50MHz.
digital-path-disable:
type: boolean
description: disable digital path on a pin.

View File

@ -25,6 +25,7 @@ typedef struct pinctrl_soc_pin_t {
uint32_t open_drain: 1;
uint32_t schmitt_enable: 1;
uint32_t slew_rate: 2;
uint32_t digital_disable: 1;
} pinctrl_soc_pin_t;
#define Z_PINCTRL_STATE_PIN_INIT(node_id, prop, idx) \
@ -33,6 +34,7 @@ typedef struct pinctrl_soc_pin_t {
.open_drain = DT_PROP(node_id, drive_open_drain), \
.schmitt_enable = DT_PROP(node_id, input_schmitt_enable), \
.slew_rate = DT_ENUM_IDX(node_id, slew_rate), \
.digital_disable = DT_PROP(node_id, digital_path_disable), \
},
#define Z_PINCTRL_STATE_PINS_INIT(node_id, prop) \