From: Piotr Dymacz Date: Fri, 3 Jun 2016 10:30:41 +0000 (+0200) Subject: Setup GPIO_OUT register before GPIO_OUT_FUNCx and GPIO_IN_ENx in low level GPIO init X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=484816347568a1c2f7281f84aa628ae4c592fd86;p=oweals%2Fu-boot_mod.git Setup GPIO_OUT register before GPIO_OUT_FUNCx and GPIO_IN_ENx in low level GPIO init --- diff --git a/u-boot/cpu/mips/ar7240/qca_gpio_init.S b/u-boot/cpu/mips/ar7240/qca_gpio_init.S index 41af006..5572712 100644 --- a/u-boot/cpu/mips/ar7240/qca_gpio_init.S +++ b/u-boot/cpu/mips/ar7240/qca_gpio_init.S @@ -142,13 +142,6 @@ lowlevel_gpio_init: #endif #endif - /* Setup GPIO number for LSUART RX in GPIO IN MUX */ - li t8, QCA_GPIO_IN_EN0_REG - lw t9, 0(t8) - and t9, t9, ~(QCA_GPIO_IN_EN0_LSUART_RXD_MASK) - or t9, t9, (CONFIG_QCA_GPIO_LSUART_RX << QCA_GPIO_IN_EN0_LSUART_RXD_SHIFT) - sw t9, 0(t8) - /* * Target regular GPIO and LSUART TX line configuration * @@ -173,6 +166,33 @@ lowlevel_gpio_init: #endif sw t9, 0(t8) + /* + * Setup GPIO type (out/in) in GPIO_OE + * register for all configured regular + * GPIOs and LSUART TX/RX lines + */ + li t8, QCA_GPIO_OE_REG + lw t9, 0(t8) + #ifdef CONFIG_QCA_GPIO_MASK_OUTPUTS + and t9, t9, ~(CONFIG_QCA_GPIO_MASK_OUTPUTS | \ + CONFIG_QCA_GPIO_MASK_LSUART_TX) + #else + and t9, t9, ~(CONFIG_QCA_GPIO_MASK_LSUART_TX) + #endif + #ifdef CONFIG_QCA_GPIO_MASK_INPUTS + or t9, t9, (CONFIG_QCA_GPIO_MASK_INPUTS | CONFIG_QCA_GPIO_MASK_LSUART_RX) + #else + or t9, t9, CONFIG_QCA_GPIO_MASK_LSUART_RX + #endif + sw t9, 0(t8) + + /* Setup GPIO number for LSUART RX in GPIO IN MUX */ + li t8, QCA_GPIO_IN_EN0_REG + lw t9, 0(t8) + and t9, t9, ~(QCA_GPIO_IN_EN0_LSUART_RXD_MASK) + or t9, t9, (CONFIG_QCA_GPIO_LSUART_RX << QCA_GPIO_IN_EN0_LSUART_RXD_SHIFT) + sw t9, 0(t8) + /* * TODO: what with default LSUART TX line? * @@ -383,26 +403,6 @@ lowlevel_gpio_init: sw t9, 0(t8) #endif - /* - * And finally, setup GPIO type (out/in) - * in GPIO_OE register for all configured - * regular GPIOs and LSUART TX/RX lines - */ - li t8, QCA_GPIO_OE_REG - lw t9, 0(t8) - #ifdef CONFIG_QCA_GPIO_MASK_OUTPUTS - and t9, t9, ~(CONFIG_QCA_GPIO_MASK_OUTPUTS | \ - CONFIG_QCA_GPIO_MASK_LSUART_TX) - #else - and t9, t9, ~(CONFIG_QCA_GPIO_MASK_LSUART_TX) - #endif - #ifdef CONFIG_QCA_GPIO_MASK_INPUTS - or t9, t9, (CONFIG_QCA_GPIO_MASK_INPUTS | CONFIG_QCA_GPIO_MASK_LSUART_RX) - #else - or t9, t9, CONFIG_QCA_GPIO_MASK_LSUART_RX - #endif - sw t9, 0(t8) - #endif /* CONFIG_QCA_GPIO_MASK_OUTPUTS || CONFIG_QCA_GPIO_MASK_INPUTS || CONFIG_QCA_GPIO_MASK_LSUART_TX */ #endif /* (SOC_TYPE & QCA_AR934X_SOC) || (SOC_TYPE & QCA_QCA953X_SOC) || (SOC_TYPE & QCA_QCA955X_SOC) */