diff --git a/drivers/pinctrl/pinctrl_numaker.c b/drivers/pinctrl/pinctrl_numaker.c index a443f705edf..e29f214a183 100644 --- a/drivers/pinctrl/pinctrl_numaker.c +++ b/drivers/pinctrl/pinctrl_numaker.c @@ -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 diff --git a/dts/bindings/pinctrl/nuvoton,numaker-pinctrl.yaml b/dts/bindings/pinctrl/nuvoton,numaker-pinctrl.yaml index 4474f9b089f..3ff6200ee39 100644 --- a/dts/bindings/pinctrl/nuvoton,numaker-pinctrl.yaml +++ b/dts/bindings/pinctrl/nuvoton,numaker-pinctrl.yaml @@ -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. diff --git a/soc/nuvoton/numaker/common/pinctrl_soc.h b/soc/nuvoton/numaker/common/pinctrl_soc.h index 4c12b81c94b..53f07b526ed 100644 --- a/soc/nuvoton/numaker/common/pinctrl_soc.h +++ b/soc/nuvoton/numaker/common/pinctrl_soc.h @@ -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) \