drivers: gpio: davinci: Fix for RAM MMIO

Move the direction reset to config init function. This ensures that regs
is read after the DEVICE_MMIO_NAMED_MAP is called, which is where the
init for RAM MMIO takes place

Tested on PocketBeagle 2 A53s.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
This commit is contained in:
Ayush Singh 2025-05-11 23:12:15 +05:30 committed by Anas Nashif
commit 3124c7ad24

View file

@ -153,13 +153,10 @@ static DEVICE_API(gpio, gpio_davinci_driver_api) = {
static int gpio_davinci_init(const struct device *dev) static int gpio_davinci_init(const struct device *dev)
{ {
const struct gpio_davinci_config *config = DEV_CFG(dev); const struct gpio_davinci_config *config = DEV_CFG(dev);
volatile struct gpio_davinci_regs *regs = DEV_GPIO_CFG_BASE(dev);
int ret; int ret;
DEVICE_MMIO_NAMED_MAP(dev, port_base, K_MEM_CACHE_NONE); DEVICE_MMIO_NAMED_MAP(dev, port_base, K_MEM_CACHE_NONE);
regs->dir = GPIO_DAVINCI_DIR_RESET_VAL;
config->bank_config(dev); config->bank_config(dev);
ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT);
@ -174,7 +171,7 @@ static int gpio_davinci_init(const struct device *dev)
static void gpio_davinci_bank_##n##_config(const struct device *dev) \ static void gpio_davinci_bank_##n##_config(const struct device *dev) \
{ \ { \
volatile struct gpio_davinci_regs *regs = DEV_GPIO_CFG_BASE(dev); \ volatile struct gpio_davinci_regs *regs = DEV_GPIO_CFG_BASE(dev); \
ARG_UNUSED(regs); \ regs->dir = GPIO_DAVINCI_DIR_RESET_VAL; \
} }
#define GPIO_DAVINCI_INIT(n) \ #define GPIO_DAVINCI_INIT(n) \