Set output pin initial value based on pin's pinmux pullup/pulldown setup
Some of FDT blobs for AM335x-based devices use pinmux pullup/pulldown flag to setup initial GPIO ouputp value, e.g. 4DCAPE-43 sets LCD DATAEN signal this way. It works for Linux because Linux driver does not enforce pin direction until after it's requested by consumer. So input with pullup flag set acts as output with GPIO_HIGH value Reviewed by: loos
This commit is contained in:
parent
5c500bdd46
commit
8864759038
@ -573,7 +573,7 @@ ti_gpio_bank_init(device_t dev)
|
||||
{
|
||||
int pin;
|
||||
struct ti_gpio_softc *sc;
|
||||
uint32_t flags, reg_oe, rev;
|
||||
uint32_t flags, reg_oe, reg_set, rev;
|
||||
clk_ident_t clk;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
@ -607,12 +607,18 @@ ti_gpio_bank_init(device_t dev)
|
||||
|
||||
/* Init OE register based on pads configuration. */
|
||||
reg_oe = 0xffffffff;
|
||||
reg_set = 0;
|
||||
for (pin = 0; pin < PINS_PER_BANK; pin++) {
|
||||
TI_GPIO_GET_FLAGS(dev, pin, &flags);
|
||||
if (flags & GPIO_PIN_OUTPUT)
|
||||
if (flags & GPIO_PIN_OUTPUT) {
|
||||
reg_oe &= ~(1UL << pin);
|
||||
if (flags & GPIO_PIN_PULLUP)
|
||||
reg_set |= (1UL << pin);
|
||||
}
|
||||
}
|
||||
ti_gpio_write_4(sc, TI_GPIO_OE, reg_oe);
|
||||
if (reg_set)
|
||||
ti_gpio_write_4(sc, TI_GPIO_SETDATAOUT, reg_set);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user