Skip to content

Commit de58070

Browse files
cyliangtwnashif
authored andcommitted
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>
1 parent 385c687 commit de58070

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

drivers/pinctrl/pinctrl_numaker.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
#define GPIO_SIZE DT_REG_SIZE(DT_NODELABEL(gpioa))
1717

1818
#define SLEWCTL_PIN_SHIFT(pin_idx) ((pin_idx) * 2)
19-
#define SLEWCTL_MASK(pin_idx) (3 << SLEWCTL_PIN_SHIFT(pin_idx))
19+
#define SLEWCTL_MASK(pin_idx) (3 << SLEWCTL_PIN_SHIFT(pin_idx))
20+
#define DINOFF_PIN_SHIFT(pin_idx) (pin_idx + GPIO_DINOFF_DINOFF0_Pos)
21+
#define DINOFF_MASK(pin_idx) (1 << DINOFF_PIN_SHIFT(pin_idx))
2022

2123
static void gpio_configure(const pinctrl_soc_pin_t *pin, uint8_t port_idx, uint8_t pin_idx)
2224
{
@@ -28,7 +30,8 @@ static void gpio_configure(const pinctrl_soc_pin_t *pin, uint8_t port_idx, uint8
2830
((pin->schmitt_enable ? 1 : 0) << pin_idx);
2931
port->SLEWCTL = (port->SLEWCTL & ~SLEWCTL_MASK(pin_idx)) |
3032
(pin->slew_rate << SLEWCTL_PIN_SHIFT(pin_idx));
31-
33+
port->DINOFF = (port->DINOFF & ~DINOFF_MASK(pin_idx)) |
34+
((pin->digital_disable ? 1 : 0) << DINOFF_PIN_SHIFT(pin_idx));
3235
}
3336
/**
3437
* Configure pin multi-function

dts/bindings/pinctrl/nuvoton,numaker-pinctrl.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,6 @@ child-binding:
8383
Set the speed of a pin. This setting effectively limits the
8484
slew rate of the output signal. Hardware default configuration is low.
8585
Fast slew rate could support fast speed pins, like as SPI CLK up to 50MHz.
86+
digital-path-disable:
87+
type: boolean
88+
description: disable digital path on a pin.

soc/nuvoton/numaker/common/pinctrl_soc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ typedef struct pinctrl_soc_pin_t {
2525
uint32_t open_drain: 1;
2626
uint32_t schmitt_enable: 1;
2727
uint32_t slew_rate: 2;
28+
uint32_t digital_disable: 1;
2829
} pinctrl_soc_pin_t;
2930

3031
#define Z_PINCTRL_STATE_PIN_INIT(node_id, prop, idx) \
@@ -33,6 +34,7 @@ typedef struct pinctrl_soc_pin_t {
3334
.open_drain = DT_PROP(node_id, drive_open_drain), \
3435
.schmitt_enable = DT_PROP(node_id, input_schmitt_enable), \
3536
.slew_rate = DT_ENUM_IDX(node_id, slew_rate), \
37+
.digital_disable = DT_PROP(node_id, digital_path_disable), \
3638
},
3739

3840
#define Z_PINCTRL_STATE_PINS_INIT(node_id, prop) \

0 commit comments

Comments
 (0)