Add GPIO_FUNCTION_2 register defines, setup GPIO11/12 if needed in low level init...
authorPiotr Dymacz <pepe2k@gmail.com>
Sun, 21 Feb 2016 01:30:33 +0000 (02:30 +0100)
committerPiotr Dymacz <pepe2k@gmail.com>
Sun, 21 Feb 2016 01:30:33 +0000 (02:30 +0100)
u-boot/cpu/mips/ar7240/qca_gpio_init.S
u-boot/include/soc/qca_soc_common.h

index 36009db7970fc1193847ff7f03c99750a52ad5bf..3bdb5c4b29879cb8b87bbe3e745e839341d0c869 100644 (file)
@@ -498,6 +498,25 @@ lowlevel_gpio_init:
                #endif
        #endif
 
+       /* Enable regular GPIO function on GPIO11 and/or GPIO12 if needed */
+       #if defined(CONFIG_QCA_GPIO_MASK_OUTPUTS) || \
+               defined(CONFIG_QCA_GPIO_MASK_INPUTS)
+               #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & (GPIO11 | GPIO12)) || \
+                       (CONFIG_QCA_GPIO_MASK_INPUTS  & (GPIO11 | GPIO12))
+       li t8, QCA_GPIO_FUNC_2_REG
+       lw t9, 0(t8)
+                       #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO11) || \
+                               (CONFIG_QCA_GPIO_MASK_INPUTS  & GPIO11)
+       or t9, t9, QCA_GPIO_FUNC_2_JUMPSTART_DIS_MASK
+                       #endif
+                       #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO12) || \
+                               (CONFIG_QCA_GPIO_MASK_INPUTS  & GPIO12)
+       or t9, t9, QCA_GPIO_FUNC_2_WPS_DIS_MASK
+                       #endif
+       sw t9, 0(t8)
+               #endif
+       #endif
+
        /* Setup init states on requested GPIO lines */
        li  t8, QCA_GPIO_OUT_REG
        lw  t9, 0(t8)
index 0cdb59e4412c08a689b21209fcf5cc94e123eade..2d286dfc783b44ce281bd11564c7f5697619acc5 100644 (file)
  * GPIO registers BIT fields
  */
 
-/* GPIO_FUNCTION_1 register (GPIO function) */
+/* GPIO_FUNCTION_1/2 register (GPIO function) */
 #if (SOC_TYPE & QCA_AR933X_SOC)
        #define QCA_GPIO_FUNC_1_JTAG_DIS_SHIFT                  0
        #define QCA_GPIO_FUNC_1_JTAG_DIS_MASK                   (1 << QCA_GPIO_FUNC_1_JTAG_DIS_SHIFT)
        #define QCA_GPIO_FUNC_1_SPDIF_EN_MASK                   (1 << QCA_GPIO_FUNC_1_SPDIF_EN_SHIFT)
        #define QCA_GPIO_FUNC_1_SPDIF_TCK_EN_SHIFT              31
        #define QCA_GPIO_FUNC_1_SPDIF_TCK_EN_MASK               (1 << QCA_GPIO_FUNC_1_SPDIF_TCK_EN_SHIFT)
+
+       #define QCA_GPIO_FUNC_2_MIC_DIS_SHIFT                   0
+       #define QCA_GPIO_FUNC_2_MIC_DIS_MASK                    (1 << QCA_GPIO_FUNC_2_MIC_DIS_SHIFT)
+       #define QCA_GPIO_FUNC_2_I2S_ON_LED_SHIFT                1
+       #define QCA_GPIO_FUNC_2_I2S_ON_LED_MASK                 (1 << QCA_GPIO_FUNC_2_I2S_ON_LED_SHIFT)
+       #define QCA_GPIO_FUNC_2_SPDIF_ON23_SHIFT                2
+       #define QCA_GPIO_FUNC_2_SPDIF_ON23_MASK                 (1 << QCA_GPIO_FUNC_2_SPDIF_ON23_SHIFT)
+       #define QCA_GPIO_FUNC_2_I2SCK_ON1_SHIFT                 3
+       #define QCA_GPIO_FUNC_2_I2SCK_ON1_MASK                  (1 << QCA_GPIO_FUNC_2_I2SCK_ON1_SHIFT)
+       #define QCA_GPIO_FUNC_2_I2SWS_ON0_SHIFT                 4
+       #define QCA_GPIO_FUNC_2_I2SWS_ON0_MASK                  (1 << QCA_GPIO_FUNC_2_I2SWS_ON0_SHIFT)
+       #define QCA_GPIO_FUNC_2_I2SSD_ON12_SHIFT                5
+       #define QCA_GPIO_FUNC_2_I2SSD_ON12_MASK                 (1 << QCA_GPIO_FUNC_2_I2SSD_ON12_SHIFT)
+       #define QCA_GPIO_FUNC_2_WPS_DIS_SHIFT                   8
+       #define QCA_GPIO_FUNC_2_WPS_DIS_MASK                    (1 << QCA_GPIO_FUNC_2_WPS_DIS_SHIFT)
+       #define QCA_GPIO_FUNC_2_JUMPSTART_DIS_SHIFT             9
+       #define QCA_GPIO_FUNC_2_JUMPSTART_DIS_MASK              (1 << QCA_GPIO_FUNC_2_JUMPSTART_DIS_SHIFT)
+       #define QCA_GPIO_FUNC_2_WLAN_LED_ON0_SHIFT              10
+       #define QCA_GPIO_FUNC_2_WLAN_LED_ON0_MASK               (1 << QCA_GPIO_FUNC_2_WLAN_LED_ON0_SHIFT)
+       #define QCA_GPIO_FUNC_2_USB_LED_ON1_SHIFT               11
+       #define QCA_GPIO_FUNC_2_USB_LED_ON1_MASK                (1 << QCA_GPIO_FUNC_2_USB_LED_ON1_SHIFT)
+       #define QCA_GPIO_FUNC_2_LNA_ON28_SHIFT                  12
+       #define QCA_GPIO_FUNC_2_LNA_ON28_MASK                   (1 << QCA_GPIO_FUNC_2_LNA_ON28_SHIFT)
+       #define QCA_GPIO_FUNC_2_SLIC_EN_SHIFT                   13
+       #define QCA_GPIO_FUNC_2_SLIC_EN_MASK                    (1 << QCA_GPIO_FUNC_2_SLIC_EN_SHIFT)
+       #define QCA_GPIO_FUNC_2_SLIC_ON18-22_SHIFT              14
+       #define QCA_GPIO_FUNC_2_SLIC_ON18-22_MASK               (1 << QCA_GPIO_FUNC_2_SLIC_ON18-22_SHIFT)
+       #define QCA_GPIO_FUNC_2_SLIC_DIO_MUX_EN_SHIFT   15
+       #define QCA_GPIO_FUNC_2_SLIC_DIO_MUX_EN_MASK    (1 << QCA_GPIO_FUNC_2_SLIC_DIO_MUX_EN_SHIFT)
+       #define QCA_GPIO_FUNC_2_MDIO_SLAVE_ADDR_SHIFT   16
+       #define QCA_GPIO_FUNC_2_MDIO_SLAVE_ADDR_MASK    BITS(QCA_GPIO_FUNC_2__SHIFT, 3)
 #endif
 
 /*