Skip to content

Commit 8eb075f

Browse files
natto1784kartben
authored andcommitted
drivers: gpio: davinci: fix gpio output
Currently to set/clear the pins, we do a logical OR of the value with the existing values in set/clear registers. However, reading these registers always returns the value in out_data register. This is undesirable as it can cause unnecessary complications. Consider the following scenario: We need to set PIN 0: set_data |= BIT(0) We need to clear PIN 1: clr_data |= BIT(1) The latter would also clear the 0th bit due to the aforementioned behaviour. This patch fixes this by writing the mask directly without ORing. Signed-off-by: Amneesh Singh <a-singh7@ti.com>
1 parent a8b3238 commit 8eb075f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpio/gpio_davinci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static int gpio_davinci_port_set_bits_raw(const struct device *dev,
116116
{
117117
volatile struct gpio_davinci_regs *regs = DEV_GPIO_CFG_BASE(dev);
118118

119-
regs->set_data |= mask;
119+
regs->set_data = mask;
120120

121121
return 0;
122122
}
@@ -126,7 +126,7 @@ static int gpio_davinci_port_clear_bits_raw(const struct device *dev,
126126
{
127127
volatile struct gpio_davinci_regs *regs = DEV_GPIO_CFG_BASE(dev);
128128

129-
regs->clr_data |= mask;
129+
regs->clr_data = mask;
130130

131131
return 0;
132132
}

0 commit comments

Comments
 (0)