wr703n_config : unconfig hornet_common_config
@/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR703N at:' `date` '\e[0m'
@echo "#define CONFIG_FOR_TPLINK_WR703N_V1 1" >> include/config.h
- @echo "#define GPIO_SYS_LED_BIT 27" >> include/config.h
- @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h
@echo "#define BOARD_CUSTOM_STRING \"TP-Link TL-WR703N\"" >> include/config.h
wr720n_v3_CH_config : unconfig hornet_common_config
@/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR720N v3 CH at:' `date` '\e[0m'
@echo "#define CONFIG_FOR_TPLINK_WR720N_V3 1" >> include/config.h
- @echo "#define GPIO_SYS_LED_BIT 27" >> include/config.h
- @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h
@echo "#define BOARD_CUSTOM_STRING \"TP-Link TL-WR720N v3 CH\"" >> include/config.h
wr710n_config : unconfig hornet_common_config
@/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR710N at:' `date` '\e[0m'
@echo "#define CONFIG_FOR_TPLINK_WR710N_V1 1" >> include/config.h
- @echo "#define GPIO_SYS_LED_BIT 27" >> include/config.h
- @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 8" >> include/config.h
@echo "#define BOARD_CUSTOM_STRING \"TP-Link TL-WR710N\"" >> include/config.h
mr3020_config : unconfig hornet_common_config
@/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3020 at:' `date`.'\e[0m'
@echo "#define CONFIG_FOR_TPLINK_MR3020_V1 1" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_BIT 27" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_ON 0" >> include/config.h
- @echo "#define GPIO_WPS_LED_BIT 26" >> include/config.h
- @echo "#define GPIO_WPS_LED_ON 0" >> include/config.h
- @echo "#define GPIO_WLAN_LED_BIT 0" >> include/config.h
- @echo "#define GPIO_WLAN_LED_ON 1" >> include/config.h
- @echo "#define GPIO_ETH_LED_BIT 17" >> include/config.h
- @echo "#define GPIO_ETH_LED_ON 0" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h
@echo "#define BOARD_CUSTOM_STRING \"TP-Link TL-MR3020\"" >> include/config.h
mr3040_config : unconfig hornet_common_config
@/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3040 at:' `date` '\e[0m'
@echo "#define CONFIG_FOR_TPLINK_MR3040_V1V2 1" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_BIT 27" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_ON 0" >> include/config.h
- @echo "#define GPIO_WLAN_LED_BIT 26" >> include/config.h
- @echo "#define GPIO_WLAN_LED_ON 0" >> include/config.h
- @echo "#define GPIO_ETH_LED_BIT 17" >> include/config.h
- @echo "#define GPIO_ETH_LED_ON 0" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h
@echo "#define BOARD_CUSTOM_STRING \"TP-Link TL-MR3040\"" >> include/config.h
mr10u_config : unconfig hornet_common_config
@/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR10U at:' `date` '\e[0m'
@echo "#define CONFIG_FOR_TPLINK_MR10U_V1 1" >> include/config.h
- @echo "#define GPIO_SYS_LED_BIT 27" >> include/config.h
- @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h
@echo "#define BOARD_CUSTOM_STRING \"TP-Link TL-MR10U\"" >> include/config.h
mr13u_config : unconfig hornet_common_config
@/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR13U at:' `date` '\e[0m'
@echo "#define CONFIG_FOR_TPLINK_MR13U_V1 1" >> include/config.h
- @echo "#define GPIO_SYS_LED_BIT 27" >> include/config.h
- @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h
@echo "#define BOARD_CUSTOM_STRING \"TP-Link TL-MR13U\"" >> include/config.h
wr740n_v4_config : unconfig hornet_common_config
@/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR740N v4 at:' `date` '\e[0m'
@echo "#define CONFIG_FOR_TPLINK_WR740N_V4 1" >> include/config.h
- @echo "#define GPIO_SYS_LED_BIT 27" >> include/config.h
- @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h
- @echo "#define GPIO_WLAN_LED_BIT 0" >> include/config.h
- @echo "#define GPIO_WLAN_LED_ON 1" >> include/config.h
- @echo "#define GPIO_LAN1_LED_BIT 14" >> include/config.h
- @echo "#define GPIO_LAN1_LED_ON 1" >> include/config.h
- @echo "#define GPIO_LAN2_LED_BIT 15" >> include/config.h
- @echo "#define GPIO_LAN2_LED_ON 1" >> include/config.h
- @echo "#define GPIO_LAN3_LED_BIT 16" >> include/config.h
- @echo "#define GPIO_LAN3_LED_ON 1" >> include/config.h
- @echo "#define GPIO_LAN4_LED_BIT 17" >> include/config.h
- @echo "#define GPIO_LAN4_LED_ON 0" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_BIT 13" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_ON 1" >> include/config.h
- @echo "#define GPIO_QSS_LED_BIT 1" >> include/config.h
- @echo "#define GPIO_QSS_LED_ON 1" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h
@echo "#define BOARD_CUSTOM_STRING \"TP-Link TL-WR74xN/D v4\"" >> include/config.h
mr3220_v2_config : unconfig hornet_common_config
@/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3220 v2 at:' `date` '\e[0m'
@echo "#define CONFIG_FOR_TPLINK_MR3220_V2 1" >> include/config.h
- @echo "#define GPIO_SYS_LED_BIT 27" >> include/config.h
- @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h
- @echo "#define GPIO_WLAN_LED_BIT 0" >> include/config.h
- @echo "#define GPIO_WLAN_LED_ON 1" >> include/config.h
- @echo "#define GPIO_LAN1_LED_BIT 14" >> include/config.h
- @echo "#define GPIO_LAN1_LED_ON 1" >> include/config.h
- @echo "#define GPIO_LAN2_LED_BIT 15" >> include/config.h
- @echo "#define GPIO_LAN2_LED_ON 1" >> include/config.h
- @echo "#define GPIO_LAN3_LED_BIT 16" >> include/config.h
- @echo "#define GPIO_LAN3_LED_ON 1" >> include/config.h
- @echo "#define GPIO_LAN4_LED_BIT 17" >> include/config.h
- @echo "#define GPIO_LAN4_LED_ON 0" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_BIT 13" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_ON 1" >> include/config.h
- @echo "#define GPIO_QSS_LED_BIT 1" >> include/config.h
- @echo "#define GPIO_QSS_LED_ON 1" >> include/config.h
- @echo "#define GPIO_USB_LED_BIT 26" >> include/config.h
- @echo "#define GPIO_USB_LED_ON 1" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h
@echo "#define BOARD_CUSTOM_STRING \"TP-Link TL-MR3220 v2\"" >> include/config.h
dir505_config : unconfig hornet_common_config
@/bin/echo -e '\e[32m> Configuring for D-Link DIR-505 at:' `date` '\e[0m'
@echo "#define CONFIG_FOR_DLINK_DIR505_A1 1" >> include/config.h
- @echo "#define GPIO_SYS_LED_BIT 27" >> include/config.h
- @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h
# we will use WPS button instead of reset
@echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h
gs_oolite_v1_dev_config : unconfig hornet_common_config
@/bin/echo -e '\e[32m> Configuring for GS-Oolite v1 with dev board at:' `date` '\e[0m'
@echo "#define CONFIG_FOR_GS_OOLITE_V1_DEV 1" >> include/config.h
- @echo "#define GPIO_SYS_LED_BIT 27" >> include/config.h
- @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h
- @echo "#define GPIO_WAN_LED_BIT 17" >> include/config.h
- @echo "#define GPIO_WAN_LED_ON 0" >> include/config.h
- @echo "#define GPIO_LAN1_LED_BIT 13" >> include/config.h
- @echo "#define GPIO_LAN1_LED_ON 0" >> include/config.h
- @echo "#define GPIO_LAN2_LED_BIT 15" >> include/config.h
- @echo "#define GPIO_LAN2_LED_ON 0" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 16" >> include/config.h
@echo "#define BOARD_CUSTOM_STRING \"Gainstrong GS-Oolite v1\"" >> include/config.h
black_swift_board_config : unconfig hornet_common_config
@echo '======= Configuring for Black Swift board (128K compressed) at:' `date` '======='
@echo "#define CONFIG_FOR_BLACK_SWIFT_BOARD 1" >> include/config.h
- @echo "#define GPIO_SYS_LED_BIT 27" >> include/config.h
- @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h
@echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW 1" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 16" >> include/config.h
# Carambola 2 uses 40 MHz oscillator
@echo "#define CONFIG_40MHZ_XTAL_SUPPORT 1" >> include/config.h
- @echo "#define GPIO_WLAN_LED_BIT 0" >> include/config.h
- @echo "#define GPIO_WLAN_LED_ON 0" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h
-
- # Carambola 2 development board has RST button pulled up, so it is active at low
@echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW 1" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 16" >> include/config.h
@/bin/echo -e '\e[32m> Configuring for Dragino Dragino v2 (MS14) at:' `date` '\e[0m'
@echo "#define CONFIG_FOR_DRAGINO_V2 1" >> include/config.h
@echo "#undef COMPRESSED_UBOOT" >> include/config.h
- @echo "#define GPIO_WLAN_LED_BIT 0" >> include/config.h
- @echo "#define GPIO_WLAN_LED_ON 1" >> include/config.h
- @echo "#define GPIO_WAN_LED_BIT 17" >> include/config.h
- @echo "#define GPIO_WAN_LED_ON 0" >> include/config.h
- @echo "#define GPIO_LAN_LED_BIT 13" >> include/config.h
- @echo "#define GPIO_LAN_LED_ON 0" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_BIT 28" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_ON 1" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h
@echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW 1" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 16" >> include/config.h
@/bin/echo -e '\e[32m> Configuring for Village Telco Mesh Potato 2 at:' `date` '\e[0m'
@echo "#define CONFIG_FOR_MESH_POTATO_V2 1" >> include/config.h
@echo "#undef COMPRESSED_UBOOT" >> include/config.h
- @echo "#define GPIO_WLAN_LED_BIT 0" >> include/config.h
- @echo "#define GPIO_WLAN_LED_ON 1" >> include/config.h
- @echo "#define GPIO_WAN_LED_BIT 17" >> include/config.h
- @echo "#define GPIO_WAN_LED_ON 0" >> include/config.h
- @echo "#define GPIO_LAN_LED_BIT 13" >> include/config.h
- @echo "#define GPIO_LAN_LED_ON 0" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_BIT 28" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_ON 1" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h
@echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW 1" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 16" >> include/config.h
gl-inet_config : unconfig hornet_common_config
@/bin/echo -e '\e[32m> Configuring for GL.iNet at:' `date` '\e[0m'
@echo "#define CONFIG_FOR_GL_INET 1" >> include/config.h
- @echo "#define GPIO_WLAN_LED_BIT 0" >> include/config.h
- @echo "#define GPIO_WLAN_LED_ON 1" >> include/config.h
- @echo "#define GPIO_LAN_LED_BIT 13" >> include/config.h
- @echo "#define GPIO_LAN_LED_ON 1" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 11" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 8" >> include/config.h
@echo "#define BOARD_CUSTOM_STRING \"GL.iNet\"" >> include/config.h
@echo "#define CFG_ATHRS17_PHY 1" >> include/config.h
@echo "#define CFG_AG7240_NMACS 1" >> include/config.h
@echo "#define CFG_DUAL_PHY_SUPPORT 1" >> include/config.h
- @echo "#define GPIO_SYS_LED_BIT 14" >> include/config.h
- @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h
- @echo "#define GPIO_WLAN_2G_LED_BIT 13" >> include/config.h
- @echo "#define GPIO_WLAN_2G_LED_ON 0" >> include/config.h
- @echo "#define GPIO_USB1_LED_BIT 11" >> include/config.h
- @echo "#define GPIO_USB1_LED_ON 0" >> include/config.h
- @echo "#define GPIO_USB2_LED_BIT 12" >> include/config.h
- @echo "#define GPIO_USB2_LED_ON 0" >> include/config.h
- @echo "#define GPIO_QSS_LED_BIT 15" >> include/config.h
- @echo "#define GPIO_QSS_LED_ON 0" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 16" >> include/config.h
@echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW 1" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 8" >> include/config.h
@echo "#define DDR2_32BIT_SUPPORT 1" >> include/config.h
@echo "#define CFG_ATHRS27_PHY 1" >> include/config.h
@echo "#define CFG_AG7240_NMACS 2" >> include/config.h
- @echo "#define GPIO_SYS_LED_BIT 14" >> include/config.h
- @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h
- @echo "#define GPIO_WLAN_2G_LED_BIT 13" >> include/config.h
- @echo "#define GPIO_WLAN_2G_LED_ON 0" >> include/config.h
- @echo "#define GPIO_LAN1_LED_BIT 19" >> include/config.h
- @echo "#define GPIO_LAN1_LED_ON 0" >> include/config.h
- @echo "#define GPIO_LAN2_LED_BIT 20" >> include/config.h
- @echo "#define GPIO_LAN2_LED_ON 0" >> include/config.h
- @echo "#define GPIO_LAN3_LED_BIT 21" >> include/config.h
- @echo "#define GPIO_LAN3_LED_ON 0" >> include/config.h
- @echo "#define GPIO_LAN4_LED_BIT 22" >> include/config.h
- @echo "#define GPIO_LAN4_LED_ON 0" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_BIT 18" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_ON 0" >> include/config.h
- @echo "#define GPIO_QSS_LED_BIT 15" >> include/config.h
- @echo "#define GPIO_QSS_LED_ON 0" >> include/config.h
- @echo "#define GPIO_USB_LED_BIT 11" >> include/config.h
- @echo "#define GPIO_USB_LED_ON 0" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 16" >> include/config.h
@echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW 1" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 8" >> include/config.h
@echo "#define DDR2_32BIT_SUPPORT 1" >> include/config.h
@echo "#define CFG_ATHRS27_PHY 1" >> include/config.h
@echo "#define CFG_AG7240_NMACS 2" >> include/config.h
- @echo "#define GPIO_SYS_LED_BIT 14" >> include/config.h
- @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h
- @echo "#define GPIO_WLAN_LED_BIT 13" >> include/config.h
- @echo "#define GPIO_WLAN_LED_ON 0" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_BIT 18" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_ON 0" >> include/config.h
- @echo "#define GPIO_LAN1_LED_BIT 19" >> include/config.h
- @echo "#define GPIO_LAN1_LED_ON 0" >> include/config.h
- @echo "#define GPIO_LAN2_LED_BIT 20" >> include/config.h
- @echo "#define GPIO_LAN2_LED_ON 0" >> include/config.h
- @echo "#define GPIO_LAN3_LED_BIT 21" >> include/config.h
- @echo "#define GPIO_LAN3_LED_ON 0" >> include/config.h
- @echo "#define GPIO_LAN4_LED_BIT 12" >> include/config.h
- @echo "#define GPIO_LAN4_LED_ON 0" >> include/config.h
- @echo "#define GPIO_USB_LED_BIT 11" >> include/config.h
- @echo "#define GPIO_USB_LED_ON 0" >> include/config.h
- @echo "#define GPIO_QSS_LED_BIT 15" >> include/config.h
- @echo "#define GPIO_QSS_LED_ON 0" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 17" >> include/config.h
@echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW 1" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h
@echo "#define DDR2_32BIT_SUPPORT 1" >> include/config.h
@echo "#define CFG_ATHRS27_PHY 1" >> include/config.h
@echo "#define CFG_AG7240_NMACS 2" >> include/config.h
- @echo "#define GPIO_SYS_LED_BIT 14" >> include/config.h
- @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h
- @echo "#define GPIO_WLAN_LED_BIT 13" >> include/config.h
- @echo "#define GPIO_WLAN_LED_ON 0" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_BIT 18" >> include/config.h
- @echo "#define GPIO_INTERNET_LED_ON 0" >> include/config.h
- @echo "#define GPIO_LAN1_LED_BIT 19" >> include/config.h
- @echo "#define GPIO_LAN1_LED_ON 0" >> include/config.h
- @echo "#define GPIO_LAN2_LED_BIT 20" >> include/config.h
- @echo "#define GPIO_LAN2_LED_ON 0" >> include/config.h
- @echo "#define GPIO_LAN3_LED_BIT 21" >> include/config.h
- @echo "#define GPIO_LAN3_LED_ON 0" >> include/config.h
- @echo "#define GPIO_LAN4_LED_BIT 12" >> include/config.h
- @echo "#define GPIO_LAN4_LED_ON 0" >> include/config.h
- @echo "#define GPIO_QSS_LED_BIT 15" >> include/config.h
- @echo "#define GPIO_QSS_LED_ON 0" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 17" >> include/config.h
@echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW 1" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h
@echo "#define DDR2_32BIT_SUPPORT 1" >> include/config.h
@echo "#define CFG_ATHRS27_PHY 1" >> include/config.h
@echo "#define CFG_AG7240_NMACS 2" >> include/config.h
- @echo "#define GPIO_SYS_LED_BIT 14" >> include/config.h
- @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h
- @echo "#define GPIO_LAN_LED_BIT 18" >> include/config.h
- @echo "#define GPIO_LAN_LED_ON 0" >> include/config.h
- @echo "#define GPIO_WLAN_LED_BIT 13" >> include/config.h
- @echo "#define GPIO_WLAN_LED_ON 0" >> include/config.h
- @echo "#define GPIO_QSS_LED_BIT 15" >> include/config.h
- @echo "#define GPIO_QSS_LED_ON 0" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 17" >> include/config.h
@echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW 1" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h
@echo "#define CFG_ATHRS27_PHY 1" >> include/config.h
@echo "#define CFG_ATH_GMAC_NMACS 2" >> include/config.h
@echo "#define DEFAULT_FLASH_SIZE_IN_MB 4" >> include/config.h
- @echo "#define GPIO_SYS_LED_BIT 13" >> include/config.h
- @echo "#define GPIO_SYS_LED_ON 0" >> include/config.h
@echo "#define GPIO_RST_BUTTON_BIT 12" >> include/config.h
@echo "#define GPIO_RST_BUTTON_IS_ACTIVE_LOW 1" >> include/config.h
@echo "#define BOARD_CUSTOM_STRING \"TP-Link TL-WR820N CH\"" >> include/config.h
extern int ar7240_ddr_find_size(void);
extern void ar933x_ddr_tap_init(void);
-#define SETBITVAL(val, pos, bit) do {ulong bitval = (bit) ? 0x1 : 0x0; (val) = ((val) & ~(0x1 << (pos))) | ( (bitval) << (pos));} while(0)
-
-void led_toggle(void)
-{
- unsigned int gpio;
-
- gpio = ar7240_reg_rd(AR7240_GPIO_OUT);
-
-#if defined(CONFIG_FOR_TPLINK_MR3020_V1)
- gpio ^= 1 << GPIO_WPS_LED_BIT;
-#elif defined(CONFIG_FOR_TPLINK_WR703N_V1) || defined(CONFIG_FOR_TPLINK_WR720N_V3) || defined(CONFIG_FOR_TPLINK_WR710N_V1)
- gpio ^= 1 << GPIO_SYS_LED_BIT;
-#elif defined(CONFIG_FOR_TPLINK_MR3040_V1V2)
- gpio ^= 1 << GPIO_INTERNET_LED_BIT;
-#elif defined(CONFIG_FOR_TPLINK_MR10U_V1) || defined(CONFIG_FOR_TPLINK_MR13U_V1)
- gpio ^= 1 << GPIO_SYS_LED_BIT;
-#elif defined(CONFIG_FOR_TPLINK_WR740N_V4) || defined(CONFIG_FOR_TPLINK_MR3220_V2)
- gpio ^= 1 << GPIO_SYS_LED_BIT;
-#elif defined(CONFIG_FOR_DLINK_DIR505_A1)
- gpio ^= 1 << GPIO_SYS_LED_BIT;
-#elif defined(CONFIG_FOR_GS_OOLITE_V1_DEV)
- gpio ^= 1 << GPIO_SYS_LED_BIT;
-#elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
- gpio ^= 1 << GPIO_WLAN_LED_BIT;
-#elif defined(CONFIG_FOR_DRAGINO_V2) || defined(CONFIG_FOR_MESH_POTATO_V2)
- gpio ^= 1 << GPIO_WLAN_LED_BIT;
-#elif defined(CONFIG_FOR_BLACK_SWIFT_BOARD)
- gpio ^= 1 << GPIO_SYS_LED_BIT;
-#elif defined(CONFIG_FOR_GL_INET)
- gpio ^= 1 << GPIO_WLAN_LED_BIT;
-#else
- #error "Custom GPIO in leg_toggle() not defined!"
-#endif
-
- ar7240_reg_wr(AR7240_GPIO_OUT, gpio);
-}
-
-void all_led_on(void)
-{
- unsigned int gpio;
-
- gpio = ar7240_reg_rd(AR7240_GPIO_OUT);
-
-#if defined(CONFIG_FOR_TPLINK_MR3020_V1)
- SETBITVAL(gpio, GPIO_WPS_LED_BIT, GPIO_WPS_LED_ON);
- SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, GPIO_INTERNET_LED_ON);
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, GPIO_WLAN_LED_ON);
- SETBITVAL(gpio, GPIO_ETH_LED_BIT, GPIO_ETH_LED_ON);
-#elif defined(CONFIG_FOR_TPLINK_WR703N_V1) || defined(CONFIG_FOR_TPLINK_WR720N_V3) || defined (CONFIG_FOR_TPLINK_WR710N_V1)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, GPIO_SYS_LED_ON);
-#elif defined(CONFIG_FOR_TPLINK_MR3040_V1V2)
- SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, GPIO_INTERNET_LED_ON);
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, GPIO_WLAN_LED_ON);
- SETBITVAL(gpio, GPIO_ETH_LED_BIT, GPIO_ETH_LED_ON);
-#elif defined(CONFIG_FOR_TPLINK_MR10U_V1) || defined(CONFIG_FOR_TPLINK_MR13U_V1)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, GPIO_SYS_LED_ON);
-#elif defined(CONFIG_FOR_TPLINK_WR740N_V4) || defined(CONFIG_FOR_TPLINK_MR3220_V2)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, GPIO_SYS_LED_ON);
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, GPIO_WLAN_LED_ON);
- SETBITVAL(gpio, GPIO_LAN1_LED_BIT, GPIO_LAN1_LED_ON);
- SETBITVAL(gpio, GPIO_LAN2_LED_BIT, GPIO_LAN2_LED_ON);
- SETBITVAL(gpio, GPIO_LAN3_LED_BIT, GPIO_LAN3_LED_ON);
- SETBITVAL(gpio, GPIO_LAN4_LED_BIT, GPIO_LAN4_LED_ON);
- SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, GPIO_INTERNET_LED_ON);
- SETBITVAL(gpio, GPIO_QSS_LED_BIT, GPIO_QSS_LED_ON);
-
- #ifdef CONFIG_FOR_TPLINK_MR3220_V2
- SETBITVAL(gpio, GPIO_USB_LED_BIT, GPIO_USB_LED_ON);
- #endif
-#elif defined(CONFIG_FOR_DLINK_DIR505_A1)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, GPIO_SYS_LED_ON);
-#elif defined(CONFIG_FOR_GS_OOLITE_V1_DEV)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, GPIO_SYS_LED_ON);
- SETBITVAL(gpio, GPIO_WAN_LED_BIT, GPIO_WAN_LED_ON);
- SETBITVAL(gpio, GPIO_LAN1_LED_BIT, GPIO_LAN1_LED_ON);
- SETBITVAL(gpio, GPIO_LAN2_LED_BIT, GPIO_LAN2_LED_ON);
-#elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, GPIO_WLAN_LED_ON);
-#elif defined(CONFIG_FOR_DRAGINO_V2) || defined(CONFIG_FOR_MESH_POTATO_V2)
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, GPIO_WLAN_LED_ON);
- SETBITVAL(gpio, GPIO_WAN_LED_BIT, GPIO_WAN_LED_ON);
- SETBITVAL(gpio, GPIO_LAN_LED_BIT, GPIO_LAN_LED_ON);
- SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, GPIO_INTERNET_LED_ON);
-#elif defined(CONFIG_FOR_BLACK_SWIFT_BOARD)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, GPIO_SYS_LED_ON);
-#elif defined(CONFIG_FOR_GL_INET)
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, GPIO_WLAN_LED_ON);
- SETBITVAL(gpio, GPIO_LAN_LED_BIT, GPIO_LAN_LED_ON);
-#else
- #error "Custom GPIO in all_led_on() not defined!"
-#endif
-
- ar7240_reg_wr(AR7240_GPIO_OUT, gpio);
-}
-
-void all_led_off(void)
-{
- unsigned int gpio;
-
- gpio = ar7240_reg_rd(AR7240_GPIO_OUT);
-
-#if defined(CONFIG_FOR_TPLINK_MR3020_V1)
- SETBITVAL(gpio, GPIO_WPS_LED_BIT, !GPIO_WPS_LED_ON);
- SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, !GPIO_INTERNET_LED_ON);
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, !GPIO_WLAN_LED_ON);
- SETBITVAL(gpio, GPIO_ETH_LED_BIT, !GPIO_ETH_LED_ON);
-#elif defined(CONFIG_FOR_TPLINK_WR703N_V1) || defined(CONFIG_FOR_TPLINK_WR720N_V3) || defined (CONFIG_FOR_TPLINK_WR710N_V1)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, !GPIO_SYS_LED_ON);
-#elif defined(CONFIG_FOR_TPLINK_MR3040_V1V2)
- SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, !GPIO_INTERNET_LED_ON);
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, !GPIO_WLAN_LED_ON);
- SETBITVAL(gpio, GPIO_ETH_LED_BIT, !GPIO_ETH_LED_ON);
-#elif defined(CONFIG_FOR_TPLINK_MR10U_V1) || defined(CONFIG_FOR_TPLINK_MR13U_V1)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, !GPIO_SYS_LED_ON);
-#elif defined(CONFIG_FOR_TPLINK_WR740N_V4) || defined(CONFIG_FOR_TPLINK_MR3220_V2)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, !GPIO_SYS_LED_ON);
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, !GPIO_WLAN_LED_ON);
- SETBITVAL(gpio, GPIO_LAN1_LED_BIT, !GPIO_LAN1_LED_ON);
- SETBITVAL(gpio, GPIO_LAN2_LED_BIT, !GPIO_LAN2_LED_ON);
- SETBITVAL(gpio, GPIO_LAN3_LED_BIT, !GPIO_LAN3_LED_ON);
- SETBITVAL(gpio, GPIO_LAN4_LED_BIT, !GPIO_LAN4_LED_ON);
- SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, !GPIO_INTERNET_LED_ON);
- SETBITVAL(gpio, GPIO_QSS_LED_BIT, !GPIO_QSS_LED_ON);
-
- #ifdef CONFIG_FOR_TPLINK_MR3220_V2
- SETBITVAL(gpio, GPIO_USB_LED_BIT, !GPIO_USB_LED_ON);
- #endif
-#elif defined(CONFIG_FOR_DLINK_DIR505_A1)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, !GPIO_SYS_LED_ON);
-#elif defined(CONFIG_FOR_GS_OOLITE_V1_DEV)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, !GPIO_SYS_LED_ON);
- SETBITVAL(gpio, GPIO_WAN_LED_BIT, !GPIO_WAN_LED_ON);
- SETBITVAL(gpio, GPIO_LAN1_LED_BIT, !GPIO_LAN1_LED_ON);
- SETBITVAL(gpio, GPIO_LAN2_LED_BIT, !GPIO_LAN2_LED_ON);
-#elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, !GPIO_WLAN_LED_ON);
-#elif defined(CONFIG_FOR_DRAGINO_V2) || defined(CONFIG_FOR_MESH_POTATO_V2)
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, !GPIO_WLAN_LED_ON);
- SETBITVAL(gpio, GPIO_WAN_LED_BIT, !GPIO_WAN_LED_ON);
- SETBITVAL(gpio, GPIO_LAN_LED_BIT, !GPIO_LAN_LED_ON);
- SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, !GPIO_INTERNET_LED_ON);
-#elif defined(CONFIG_FOR_BLACK_SWIFT_BOARD)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, !GPIO_SYS_LED_ON);
-#elif defined(CONFIG_FOR_GL_INET)
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, !GPIO_WLAN_LED_ON);
- SETBITVAL(gpio, GPIO_LAN_LED_BIT, !GPIO_LAN_LED_ON);
-#else
- #error "Custom GPIO in all_led_off() not defined!"
-#endif
-
- ar7240_reg_wr(AR7240_GPIO_OUT, gpio);
-}
-
// get button status
#ifndef GPIO_RST_BUTTON_BIT
#error "GPIO_RST_BUTTON_BIT not defined!"
}
}
-int gpio_init(void)
-{
-#if defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
- /* Disable clock obs
- * clk_obs1(gpio13/bit8), clk_obs2(gpio14/bit9), clk_obs3(gpio15/bit10),
- * clk_obs4(gpio16/bit11), clk_obs5(gpio17/bit12)
- * clk_obs0(gpio1/bit19), 6(gpio11/bit20)
- */
- ar7240_reg_wr(AR7240_GPIO_FUNC, (ar7240_reg_rd(AR7240_GPIO_FUNC) & ~((0x1f<<8)|(0x3<<19))));
-
-
- /* Enable eth Switch LEDs */
- ar7240_reg_wr(AR7240_GPIO_FUNC, (ar7240_reg_rd(AR7240_GPIO_FUNC) | (0x1f<<3)));
-
-
- //Turn on status leds:
- //set output enable
- ar7240_reg_wr(AR7240_GPIO_OE, (ar7240_reg_rd(AR7240_GPIO_OE) |(1<<0)));
-
- //set WLAN LED output to low (reverse polarity LED)
- //ar7240_reg_wr(AR7240_GPIO_CLEAR, (1<<0));
-
- /* Clear AR7240_GPIO_FUNC BIT2 to ensure that software can control LED5(GPIO16) and LED6(GPIO17) */
- ar7240_reg_wr(AR7240_GPIO_FUNC, (ar7240_reg_rd(AR7240_GPIO_FUNC) & ~(0x1<<2)));
-#else
- /* Disable clock obs
- * clk_obs1(gpio13/bit8), clk_obs2(gpio14/bit9), clk_obs3(gpio15/bit10),
- * clk_obs4(gpio16/bit11), clk_obs5(gpio17/bit12)
- * clk_obs0(gpio1/bit19), 6(gpio11/bit20)
- */
-
- ar7240_reg_wr(AR7240_GPIO_FUNC, (ar7240_reg_rd(AR7240_GPIO_FUNC) & 0xEF84E0FB));
-
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
- /* Disable EJTAG functionality to enable GPIO functionality */
- ar7240_reg_wr(AR7240_GPIO_FUNC, (ar7240_reg_rd(AR7240_GPIO_FUNC) | 0x8001));
-#endif
-
- /* Set HORNET_BOOTSTRAP_STATUS BIT18 to ensure that software can control GPIO26 and GPIO27 */
- ar7240_reg_wr(HORNET_BOOTSTRAP_STATUS, (ar7240_reg_rd(HORNET_BOOTSTRAP_STATUS) | (0x1<<18)));
-#endif
-
-#if defined(CONFIG_FOR_TPLINK_MR3020_V1)
-
- /* LED's GPIOs on MR3020:
- *
- * 0 => WLAN
- * 17 => ETH
- * 26 => WPS
- * 27 => INTERNET
- *
- */
-
- /* set OE, added by zcf, 20110509 */
- ar7240_reg_wr(AR7240_GPIO_OE, (ar7240_reg_rd(AR7240_GPIO_OE) | 0xC020001));
-
- /* Disable clock obs, added by zcf, 20110509 */
- //ar7240_reg_wr (AR7240_GPIO_FUNC, (ar7240_reg_rd(AR7240_GPIO_FUNC) & 0xffe7e07f));
-#elif defined(CONFIG_FOR_TPLINK_WR703N_V1) || defined(CONFIG_FOR_TPLINK_WR720N_V3) || defined(CONFIG_FOR_TPLINK_WR710N_V1)
-
- /* LED's GPIOs on WR703N/WR720Nv3/WR710N:
- *
- * 27 => SYS
- *
- */
-
- /* set OE, added by zcf, 20110714 */
- ar7240_reg_wr(AR7240_GPIO_OE, (ar7240_reg_rd(AR7240_GPIO_OE) | 0x8000000));
-#elif defined(CONFIG_FOR_TPLINK_MR3040_V1V2)
-
- /* LED's GPIOs on MR3040:
- *
- * 26 => WLAN
- * 17 => ETH
- * 27 => INTERNET
- *
- */
-
- /* set OE, added by zcf, 20110509 */
- ar7240_reg_wr(AR7240_GPIO_OE, (ar7240_reg_rd(AR7240_GPIO_OE) | 0xC020000));
-
- /* Disable clock obs, added by zcf, 20110509 */
- //ar7240_reg_wr (AR7240_GPIO_FUNC, (ar7240_reg_rd(AR7240_GPIO_FUNC) & 0xffe7e07f));
-#elif defined(CONFIG_FOR_TPLINK_MR10U_V1) || defined(CONFIG_FOR_TPLINK_MR13U_V1)
-
- /* LED's GPIOs on MR10U/MR13U:
- *
- * 27 => SYS
- *
- */
-
- /* set OE, added by zcf, 20110714 */
- ar7240_reg_wr(AR7240_GPIO_OE, (ar7240_reg_rd(AR7240_GPIO_OE) | 0x8000000));
-#elif defined(CONFIG_FOR_TPLINK_WR740N_V4)
-
- /* LED's GPIOs on WR740Nv4:
- *
- * 0 => WLAN
- * 1 => QSS
- * 13 => INTERNET
- * 14 => LAN1
- * 15 => LAN2
- * 16 => LAN3
- * 17 => LAN4
- * 27 => SYS
- *
- */
-
- /* set OE, added by zcf, 20110509 */
- ar7240_reg_wr(AR7240_GPIO_OE, (ar7240_reg_rd(AR7240_GPIO_OE) | 0x803E003));
-
- /* Disable clock obs, added by zcf, 20110509 */
- //ar7240_reg_wr (AR7240_GPIO_FUNC, (ar7240_reg_rd(AR7240_GPIO_FUNC) & 0xffe7e07f));
-#elif defined(CONFIG_FOR_TPLINK_MR3220_V2)
-
- /* LED's GPIOs on MR3220v2:
- *
- * 0 => WLAN
- * 1 => QSS
- * 13 => INTERNET
- * 14 => LAN1
- * 15 => LAN2
- * 16 => LAN3
- * 17 => LAN4
- * 26 => USB
- * 27 => SYS
- *
- */
-
- /* set OE, added by zcf, 20110509 */
- ar7240_reg_wr(AR7240_GPIO_OE, (ar7240_reg_rd(AR7240_GPIO_OE) | 0xC03E003));
-
- /* Disable clock obs, added by zcf, 20110509 */
- //ar7240_reg_wr (AR7240_GPIO_FUNC, (ar7240_reg_rd(AR7240_GPIO_FUNC) & 0xffe7e07f));
-#elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
- // TODO: check GPIO config for C2
-#elif defined(CONFIG_FOR_DRAGINO_V2) || defined(CONFIG_FOR_MESH_POTATO_V2)
-
- /* LED's GPIOs on MR3220v2:
- *
- * 0 => WLAN
- * 13 => LAN
- * 17 => WAN
- * 28 => INTERNET
- *
- */
-
- /* set GPIO_OE */
- ar7240_reg_wr(AR7240_GPIO_OE, (ar7240_reg_rd(AR7240_GPIO_OE) | 0x10022001));
-
-#elif defined(CONFIG_FOR_BLACK_SWIFT_BOARD)
-
- /* LED's GPIOs on Black Swift board:
- *
- * 27 => SYS LED (red) - output
- * 13-17=> output only (see AR9331 datasheet)
- * 11 => Reset switch (active low) - in (like all other by default)
- *
- */
-
- // set GPIO_OE
- ar7240_reg_wr(AR7240_GPIO_OE, (ar7240_reg_rd(AR7240_GPIO_OE) | 0x0803E000));
-
- // turn off all
- ar7240_reg_wr(AR7240_GPIO_SET, 0x0);
-
-#elif defined(CONFIG_FOR_DLINK_DIR505_A1)
-
- /* LED's GPIOs on DIR-505:
- *
- * 26 => RED LED
- * 27 => GREEN LED
- *
- */
-
- // set GPIO_OE
- ar7240_reg_wr(AR7240_GPIO_OE, (ar7240_reg_rd(AR7240_GPIO_OE) | 0xC000000));
-
- // turn off RED LED, we don't need it
- ar7240_reg_wr(AR7240_GPIO_OUT, (ar7240_reg_rd(AR7240_GPIO_OUT) | (0x1 << 26)));
-#elif defined(CONFIG_FOR_GS_OOLITE_V1_DEV)
-
- /* LED's GPIOs on GS-Oolite v1 with development board:
- *
- * 13 => LAN2
- * 15 => LAN1
- * 17 => WAN
- * 27 => SYS LED (green on dev board, red on module)
- *
- * I/O on development board:
- * 0 => RED LED (active low)
- * 1 => RED LED (active low)
- * 6 => Switch 8
- * 7 => Switch 7
- * 8 => USB power
- * 11 => Reset switch
- * 14 => RED LED (active low)
- * 16 => RED LED (active low)
- * 18 => RED LED (active low)
- * 19 => RED LED (active low)
- * 20 => RED LED (active low)
- * 21 => RED LED (active low)
- * 22 => RED LED (active low)
- * 23 => Relay 1
- * 24 => Relay 2
- * 26 => RED LED (active low)
- *
- */
-
- // set GPIO_OE
- ar7240_reg_wr(AR7240_GPIO_OE, (ar7240_reg_rd(AR7240_GPIO_OE) | 0xDFFE103));
-
- // turn on power on USB and turn off RED LEDs
- ar7240_reg_wr(AR7240_GPIO_SET, 0x47D4103);
-#elif defined(CONFIG_FOR_GL_INET)
-
- /* LED's GPIOs on GL.iNet:
- *
- * 0 => WLAN
- * 13 => LAN
- *
- */
-
- /* set GPIO_OE */
- ar7240_reg_wr(AR7240_GPIO_OE, (ar7240_reg_rd(AR7240_GPIO_OE) | 0x2001));
-
-#else
- #error "Custom GPIO config in gpio_config() not defined!"
-#endif
- return 0;
-}
-
int ar7240_mem_config(void)
{
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
extern int ath_ddr_initial_config(uint32_t refresh);
extern int ath_ddr_find_size(void);
-#define SETBITVAL(val, pos, bit) do {ulong bitval = (bit) ? 0x1 : 0x0; (val) = ((val) & ~(0x1 << (pos))) | ( (bitval) << (pos));} while(0)
-
-void led_toggle(void)
-{
- u32 gpio = qca_soc_reg_read(QCA_GPIO_OUT_REG);
-
-#if defined(CONFIG_FOR_TPLINK_WR820N_CH)
- gpio ^= 1 << GPIO_SYS_LED_BIT;
-#else
- #error "Custom GPIO in leg_toggle() not defined!"
-#endif
-
- qca_soc_reg_write(QCA_GPIO_OUT_REG, gpio);
-}
-
-void all_led_on(void)
-{
- u32 gpio = qca_soc_reg_read(QCA_GPIO_OUT_REG);
-
-#if defined(CONFIG_FOR_TPLINK_WR820N_CH)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, GPIO_SYS_LED_ON);
-#else
- #error "Custom GPIO in all_led_on() not defined!"
-#endif
-
- qca_soc_reg_write(QCA_GPIO_OUT_REG, gpio);
-}
-
-void all_led_off(void)
-{
- u32 gpio = qca_soc_reg_read(QCA_GPIO_OUT_REG);
-
-#if defined(CONFIG_FOR_TPLINK_WR820N_CH)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, !GPIO_SYS_LED_ON);
-#else
- #error "Custom GPIO in all_led_on() not defined!"
-#endif
-
- qca_soc_reg_write(QCA_GPIO_OUT_REG, gpio);
-}
-
int reset_button_status(void)
{
#ifndef GPIO_RST_BUTTON_BIT
#endif
}
-int gpio_init(void)
-{
- return 0;
-}
-
void ath_set_tuning_caps(void)
{
typedef struct {
udelay(10);
}
-void ath_gpio_config(void)
-{
- /* disable the CLK_OBS on GPIO_4 and set GPIO4 as input */
-#if 0
- ath_reg_rmw_clear(GPIO_OE_ADDRESS, (1 << 4));
- ath_reg_rmw_clear(GPIO_OUT_FUNCTION1_ADDRESS, GPIO_OUT_FUNCTION1_ENABLE_GPIO_4_MASK);
- ath_reg_rmw_set(GPIO_OUT_FUNCTION1_ADDRESS, GPIO_OUT_FUNCTION1_ENABLE_GPIO_4_SET(0x80));
- ath_reg_rmw_set(GPIO_OE_ADDRESS, (1 << 4));
-#endif
-
-#if 0
- /* Set GPIO 13 as input for LED functionality to be OFF during bootup */
- ath_reg_rmw_set(GPIO_OE_ADDRESS, (1 << 13));
- /* Turn off JUMPST_LED and 5Gz LED during bootup */
- ath_reg_rmw_set(GPIO_OE_ADDRESS, (1 << 15));
-#endif
- ath_reg_rmw_set(GPIO_OE_ADDRESS, (1 << 12));
-
-}
-
int ath_mem_config(void)
{
unsigned int type, reg32, *tap;
ath_usb_initial_config();
- ath_gpio_config();
#endif /* !defined(CONFIG_ATH_EMULATION) */
//ath_set_tuning_caps();
extern int wasp_ddr_initial_config(uint32_t refresh);
extern int ar7240_ddr_find_size(void);
-#define SETBITVAL(val, pos, bit) do {ulong bitval = (bit) ? 0x1 : 0x0; (val) = ((val) & ~(0x1 << (pos))) | ( (bitval) << (pos));} while(0)
-
-void led_toggle(void)
-{
- unsigned int gpio;
-
- gpio = ar7240_reg_rd(AR934X_GPIO_OUT);
-
-#if defined(CONFIG_FOR_TPLINK_WDR3600_WDR43X0_V1) || \
- defined(CONFIG_FOR_TPLINK_WDR3500_V1) || \
- defined(CONFIG_FOR_TPLINK_WR841N_V8) || \
- defined(CONFIG_FOR_TPLINK_WA830RE_V2_WA801ND_V2) || \
- defined(CONFIG_FOR_TPLINK_MR3420_V2)
- gpio ^= 1 << GPIO_SYS_LED_BIT;
-#else
- #error "Custom GPIO in leg_toggle() not defined!"
-#endif
-
- ar7240_reg_wr(AR934X_GPIO_OUT, gpio);
-}
-
-void all_led_on(void)
-{
- unsigned int gpio;
-
- gpio = ar7240_reg_rd(AR934X_GPIO_OUT);
-
-#if defined(CONFIG_FOR_TPLINK_WDR3600_WDR43X0_V1)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, GPIO_SYS_LED_ON);
- SETBITVAL(gpio, GPIO_WLAN_2G_LED_BIT, GPIO_WLAN_2G_LED_ON);
- SETBITVAL(gpio, GPIO_USB1_LED_BIT, GPIO_USB1_LED_ON);
- SETBITVAL(gpio, GPIO_USB2_LED_BIT, GPIO_USB2_LED_ON);
- //SETBITVAL(gpio, GPIO_QSS_LED_BIT, GPIO_QSS_LED_ON);
-#elif defined(CONFIG_FOR_TPLINK_WDR3500_V1)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, GPIO_SYS_LED_ON);
- SETBITVAL(gpio, GPIO_WLAN_2G_LED_BIT, GPIO_WLAN_2G_LED_ON);
- SETBITVAL(gpio, GPIO_LAN1_LED_BIT, GPIO_LAN1_LED_ON);
- SETBITVAL(gpio, GPIO_LAN2_LED_BIT, GPIO_LAN2_LED_ON);
- SETBITVAL(gpio, GPIO_LAN3_LED_BIT, GPIO_LAN3_LED_ON);
- SETBITVAL(gpio, GPIO_LAN4_LED_BIT, GPIO_LAN4_LED_ON);
- SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, GPIO_INTERNET_LED_ON);
- SETBITVAL(gpio, GPIO_QSS_LED_BIT, GPIO_QSS_LED_ON);
- SETBITVAL(gpio, GPIO_USB_LED_BIT, GPIO_USB_LED_ON);
-#elif defined(CONFIG_FOR_TPLINK_WR841N_V8)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, GPIO_SYS_LED_ON);
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, GPIO_WLAN_LED_ON);
- SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, GPIO_INTERNET_LED_ON);
- SETBITVAL(gpio, GPIO_LAN1_LED_BIT, GPIO_LAN1_LED_ON);
- SETBITVAL(gpio, GPIO_LAN2_LED_BIT, GPIO_LAN2_LED_ON);
- SETBITVAL(gpio, GPIO_LAN3_LED_BIT, GPIO_LAN3_LED_ON);
- SETBITVAL(gpio, GPIO_LAN4_LED_BIT, GPIO_LAN4_LED_ON);
- SETBITVAL(gpio, GPIO_QSS_LED_BIT, GPIO_QSS_LED_ON);
-#elif defined(CONFIG_FOR_TPLINK_MR3420_V2)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, GPIO_SYS_LED_ON);
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, GPIO_WLAN_LED_ON);
- SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, GPIO_INTERNET_LED_ON);
- SETBITVAL(gpio, GPIO_LAN1_LED_BIT, GPIO_LAN1_LED_ON);
- SETBITVAL(gpio, GPIO_LAN2_LED_BIT, GPIO_LAN2_LED_ON);
- SETBITVAL(gpio, GPIO_LAN3_LED_BIT, GPIO_LAN3_LED_ON);
- SETBITVAL(gpio, GPIO_LAN4_LED_BIT, GPIO_LAN4_LED_ON);
- SETBITVAL(gpio, GPIO_USB_LED_BIT, GPIO_USB_LED_ON);
- SETBITVAL(gpio, GPIO_QSS_LED_BIT, GPIO_QSS_LED_ON);
-#elif defined(CONFIG_FOR_TPLINK_WA830RE_V2_WA801ND_V2)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, GPIO_SYS_LED_ON);
- SETBITVAL(gpio, GPIO_LAN_LED_BIT, GPIO_LAN_LED_ON);
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, GPIO_WLAN_LED_ON);
- SETBITVAL(gpio, GPIO_QSS_LED_BIT, GPIO_QSS_LED_ON);
-#else
- #error "Custom GPIO in all_led_on() not defined!"
-#endif
-
- ar7240_reg_wr(AR934X_GPIO_OUT, gpio);
-}
-
-void all_led_off(void)
-{
- unsigned int gpio;
-
- gpio = ar7240_reg_rd(AR934X_GPIO_OUT);
-
-#if defined(CONFIG_FOR_TPLINK_WDR3600_WDR43X0_V1)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, !GPIO_SYS_LED_ON);
- SETBITVAL(gpio, GPIO_WLAN_2G_LED_BIT, !GPIO_WLAN_2G_LED_ON);
- SETBITVAL(gpio, GPIO_USB1_LED_BIT, !GPIO_USB1_LED_ON);
- SETBITVAL(gpio, GPIO_USB2_LED_BIT, !GPIO_USB2_LED_ON);
- //SETBITVAL(gpio, GPIO_QSS_LED_BIT, !GPIO_QSS_LED_ON);
-#elif defined(CONFIG_FOR_TPLINK_WDR3500_V1)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, !GPIO_SYS_LED_ON);
- SETBITVAL(gpio, GPIO_WLAN_2G_LED_BIT, !GPIO_WLAN_2G_LED_ON);
- SETBITVAL(gpio, GPIO_LAN1_LED_BIT, !GPIO_LAN1_LED_ON);
- SETBITVAL(gpio, GPIO_LAN2_LED_BIT, !GPIO_LAN2_LED_ON);
- SETBITVAL(gpio, GPIO_LAN3_LED_BIT, !GPIO_LAN3_LED_ON);
- SETBITVAL(gpio, GPIO_LAN4_LED_BIT, !GPIO_LAN4_LED_ON);
- SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, !GPIO_INTERNET_LED_ON);
- SETBITVAL(gpio, GPIO_QSS_LED_BIT, !GPIO_QSS_LED_ON);
- SETBITVAL(gpio, GPIO_USB_LED_BIT, !GPIO_USB_LED_ON);
-#elif defined(CONFIG_FOR_TPLINK_WR841N_V8)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, !GPIO_SYS_LED_ON);
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, !GPIO_WLAN_LED_ON);
- SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, !GPIO_INTERNET_LED_ON);
- SETBITVAL(gpio, GPIO_LAN1_LED_BIT, !GPIO_LAN1_LED_ON);
- SETBITVAL(gpio, GPIO_LAN2_LED_BIT, !GPIO_LAN2_LED_ON);
- SETBITVAL(gpio, GPIO_LAN3_LED_BIT, !GPIO_LAN3_LED_ON);
- SETBITVAL(gpio, GPIO_LAN4_LED_BIT, !GPIO_LAN4_LED_ON);
- SETBITVAL(gpio, GPIO_QSS_LED_BIT, !GPIO_QSS_LED_ON);
-#elif defined(CONFIG_FOR_TPLINK_MR3420_V2)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, !GPIO_SYS_LED_ON);
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, !GPIO_WLAN_LED_ON);
- SETBITVAL(gpio, GPIO_INTERNET_LED_BIT, !GPIO_INTERNET_LED_ON);
- SETBITVAL(gpio, GPIO_LAN1_LED_BIT, !GPIO_LAN1_LED_ON);
- SETBITVAL(gpio, GPIO_LAN2_LED_BIT, !GPIO_LAN2_LED_ON);
- SETBITVAL(gpio, GPIO_LAN3_LED_BIT, !GPIO_LAN3_LED_ON);
- SETBITVAL(gpio, GPIO_LAN4_LED_BIT, !GPIO_LAN4_LED_ON);
- SETBITVAL(gpio, GPIO_USB_LED_BIT, !GPIO_USB_LED_ON);
- SETBITVAL(gpio, GPIO_QSS_LED_BIT, !GPIO_QSS_LED_ON);
-#elif defined(CONFIG_FOR_TPLINK_WA830RE_V2_WA801ND_V2)
- SETBITVAL(gpio, GPIO_SYS_LED_BIT, !GPIO_SYS_LED_ON);
- SETBITVAL(gpio, GPIO_LAN_LED_BIT, !GPIO_LAN_LED_ON);
- SETBITVAL(gpio, GPIO_WLAN_LED_BIT, !GPIO_WLAN_LED_ON);
- SETBITVAL(gpio, GPIO_QSS_LED_BIT, !GPIO_QSS_LED_ON);
-#else
- #error "Custom GPIO in all_led_off() not defined!"
-#endif
-
- ar7240_reg_wr(AR934X_GPIO_OUT, gpio);
-}
-
// get button status
#ifndef GPIO_RST_BUTTON_BIT
#error "GPIO_RST_BUTTON_BIT not defined!"
return ar7240_ddr_find_size();
}
-int gpio_init(void)
-{
- return 0;
-}
-
long int dram_init()
{
return (long int)wasp_mem_config();
* This file contains code used for lowlevel initialization
* of GPIO, on supported Qualcomm/Atheros platforms
*
- * Copyright (C) 2015 Piotr Dymacz <piotr@dymacz.pl>
+ * Copyright (C) 2016 Piotr Dymacz <piotr@dymacz.pl>
*
- * SPDX-License-Identifier:GPL-2.0
+ * SPDX-License-Identifier: GPL-2.0
*/
#include <config.h>
#include <asm/addrspace.h>
#include <soc/qca_soc_common.h>
+/*
+ * Low level GPIO initialization:
+ * 1. Setup JTAG (disable by default, but allow to keep it up)
+ * 2. Disable all clock observation on platforms which support this
+ * 3. Setup UART lines
+ * 4. Setup all configured GPIO inputs/outputs
+ * 5. Set desired init values on configured GPIOs
+ *
+ * The user may use several config definitions here:
+ * 1. CONFIG_QCA_KEEP_JTAG_ENABLED
+ * - if defined, JTAG will not be disabled
+ * 2. CONFIG_QCA_GPIO_MASK_OUTPUTS,
+ * CONFIG_QCA_GPIO_MASK_INPUTS
+ * - bitmask for GPIOs to be set as outputs and inputs
+ * 3. CONFIG_QCA_GPIO_LSUART_TX,
+ * CONFIG_QCA_GPIO_LSUART_RX
+ * - GPIO number for LSUART TX (10 if empty) and RX line (9 if empty)
+ * 4. CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI,
+ * CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_LO
+ * - bitmask for outputs initialized to high and low state at start
+ * 5. CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI,
+ * CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO
+ * - bitmask for GPIO driven LEDs, used only in leds_on/leds_off functions,
+ * GPIO numbers for LEDs MUST be defined also in CONFIG_QCA_GPIO_MASK_OUTPUTS!
+ *
+ * TODO:
+ * 1. Allow to select LS, HS, both or none UART type
+ * on platforms which support both
+ * 2. Allow to select clocks observation on chosen pins
+ * 3. Ethernet/WLAN LEDs configuration
+ * 4. Enable JTAG on request (button?)
+ */
+
+/* Sanity check for GPIO driven LEDs */
+#if (defined(CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI) || \
+ defined(CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO)) && \
+ !defined(CONFIG_QCA_GPIO_MASK_OUTPUTS)
+ #error "GPIO numbers for LEDs must be included in CONFIG_QCA_GPIO_MASK_OUTPUTS!"
+#endif
+
+#if (defined(CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI) && \
+ !(CONFIG_QCA_GPIO_MASK_OUTPUTS & CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI)) || \
+ (defined(CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO) && \
+ !(CONFIG_QCA_GPIO_MASK_OUTPUTS & CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO))
+ #error "GPIO numbers for LEDs must be included in CONFIG_QCA_GPIO_MASK_OUTPUTS!"
+#endif
+
.globl lowlevel_gpio_init
-.ent lowlevel_gpio_init
+.type lowlevel_gpio_init, @function
+.align 4
+.text
+.ent lowlevel_gpio_init
lowlevel_gpio_init:
-
/*
- * JTAG and UART init
+ * =========================
+ * Low level GPIO setup for:
+ * 1. AR934x
+ * 2. QCA953x
+ * 3. QCA955x
+ * =========================
*/
#if (SOC_TYPE & QCA_AR934X_SOC) || \
- (SOC_TYPE & QCA_QCA955X_SOC) || \
- (SOC_TYPE & QCA_QCA953X_SOC)
+ (SOC_TYPE & QCA_QCA953X_SOC) || \
+ (SOC_TYPE & QCA_QCA955X_SOC)
+
+ /* Sanity check for JTAG pins (GPIO 0~3) */
+ #if defined(CONFIG_SKIP_LOWLEVEL_INIT) || \
+ defined(CONFIG_QCA_KEEP_JTAG_ENABLED)
+ #if (defined(CONFIG_QCA_GPIO_MASK_INPUTS) && (CONFIG_QCA_GPIO_MASK_INPUTS & 0xF)) || \
+ (defined(CONFIG_QCA_GPIO_MASK_OUTPUTS) && (CONFIG_QCA_GPIO_MASK_OUTPUTS & 0xF))
+ #error "Cannot use JTAG and GPIO0~3 at the same time!"
+ #endif
+ #endif
+
/*
- * Disable JTAG (bit 1 set) and ALL clock observation (bit 2~9 reset)
- * Do not do this in RAM version!
+ * Disable:
+ * 1. By default JTAG (bit 1 set)
+ * 2. All clock observation (bits 2~9 reset)
*/
li t8, QCA_GPIO_FUNC_REG
-
- #ifndef CONFIG_SKIP_LOWLEVEL_INIT
+ #if defined(CONFIG_SKIP_LOWLEVEL_INIT) || \
+ defined(CONFIG_QCA_KEEP_JTAG_ENABLED)
li t9, QCA_GPIO_FUNC_JTAG_DIS_MASK
- #else
+ #else
li t9, 0x0
- #endif
+ #endif
sw t9, 0(t8)
- /*
- * Setup GPIOs for LS UART:
- * - TX: GPIO10
- * - RX: GPIO9
- *
- * TODO:
- * - allow select LS or HS UART on platforms which support both
- * - allow select other than default GPIOs for LS/HS UART pins
- */
+ /* By default use GPIO10 for TX and GPIO9 for RX */
+ #ifndef CONFIG_QCA_GPIO_LSUART_TX
+ #define CONFIG_QCA_GPIO_LSUART_TX 10
+ #endif
- /* GPIO10 as output, GPIO9 as input */
- li t8, QCA_GPIO_OE_REG
- lw t9, 0(t8)
- and t9, t9, ~GPIO10
- or t9, t9, GPIO9
- sw t9, 0(t8)
+ #ifndef CONFIG_QCA_GPIO_LSUART_RX
+ #define CONFIG_QCA_GPIO_LSUART_RX 9
+ #endif
- /* Set LSUART_TXD on GPIO10 */
- li t8, QCA_GPIO_OUT_FUNC2_REG
- lw t9, 0(t8)
- and t9, t9, ~QCA_GPIO_OUT_FUNCX_GPIO10_EN_MASK
- or t9, t9, (QCA_GPIO_OUT_MUX_LSUART_TXD_VAL << \
- QCA_GPIO_OUT_FUNCX_GPIO10_EN_SHIFT)
- sw t9, 0(t8)
+ #define CONFIG_QCA_GPIO_MASK_LSUART_TX (1 << CONFIG_QCA_GPIO_LSUART_TX)
+ #define CONFIG_QCA_GPIO_MASK_LSUART_RX (1 << CONFIG_QCA_GPIO_LSUART_RX)
+
+ #define CONFIG_QCA_GPIO_LSUART_TX_FUNCX_SHIFT \
+ (8 * (CONFIG_QCA_GPIO_LSUART_TX - \
+ ((CONFIG_QCA_GPIO_LSUART_TX / 4) * 4)))
+
+ /* Some sanity checks for LS UART GPIO lines */
+ #if (CONFIG_QCA_GPIO_LSUART_TX >= QCA_GPIO_COUNT) || \
+ (CONFIG_QCA_GPIO_LSUART_RX >= QCA_GPIO_COUNT)
+ #error "LSUART GPIO numbers for TX and/or RX lines are not correct!"
+ #endif
- /* Set LSUART_RXD on GPIO9 */
+ #if (CONFIG_QCA_GPIO_LSUART_TX == CONFIG_QCA_GPIO_LSUART_RX)
+ #error "LSUART TX and RX GPIO numbers cannot be the same!"
+ #endif
+
+ /*
+ * Do not allow to use LSUART TX/RX lines
+ * as regular GPIO inputs/outputs at the same time
+ */
+ #if defined(CONFIG_QCA_GPIO_MASK_INPUTS) || defined(CONFIG_QCA_GPIO_MASK_OUTPUTS)
+ #if (CONFIG_QCA_GPIO_MASK_INPUTS & CONFIG_QCA_GPIO_MASK_LSUART_TX) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & CONFIG_QCA_GPIO_MASK_LSUART_RX) || \
+ (CONFIG_QCA_GPIO_MASK_OUTPUTS & CONFIG_QCA_GPIO_MASK_LSUART_TX) || \
+ (CONFIG_QCA_GPIO_MASK_OUTPUTS & CONFIG_QCA_GPIO_MASK_LSUART_RX)
+ #error "Cannot use LSUART lines as regular GPIOs at the same time!"
+ #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, (9 << QCA_GPIO_IN_EN0_LSUART_RXD_SHIFT)
+ 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)
-#endif
-/*
- * General configuration of GPIO (buttons, LEDs, default value, etc.)
- */
-#if defined(CONFIG_FOR_TPLINK_WDR3600_WDR43X0_V1)
/*
- * LEDs and buttons GPIOs on WDR3600/WDR43x0 v1:
- *
- * 11 => USB1 LED
- * 12 => USB2 LED
- * 13 => WLAN2G
- * 14 => SYS
- * 15 => QSS
- * 21 => USB2 POWER (active high)
- * 22 => USB1 POWER (active high)
+ * Target regular GPIO and LSUART TX line configuration
*
- * 16 => Reset button
- * 17 => Wi-Fi ON/OFF switch
+ * After selecting GPIO as output in GPIO_OE register,
+ * the line will be set to low, which causes signal
+ * toggle on pulled-up lines
*
- * All OUT GPIOs are active LOW if not stated otherwise
+ * To prevent this, we need to first setup desired
+ * init state for all GPIOs configured as outputs
+ * and then setup them as outputs
*/
-
- /* GPIO Init */
- li t8, QCA_GPIO_OE_REG
- lw t9, 0(t8)
- /* Set GPIOs 11~15 and 21~22 as outputs */
- and t9, t9, ~(GPIO11 | GPIO12 | GPIO13 | \
- GPIO14 | GPIO15 | GPIO21 | GPIO22)
- /* Set GPIOs 16~17 as inputs */
- or t9, t9, (GPIO16 | GPIO17)
- sw t9, 0(t8)
-
- /* Set GPIO function for GPIO 11 */
- li t8, QCA_GPIO_OUT_FUNC2_REG
+ li t8, QCA_GPIO_OUT_REG
lw t9, 0(t8)
- and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO11_EN_MASK)
- sw t9, 0(t8)
-
- /* Set GPIO function for GPIOs 12~15 */
- li t8, QCA_GPIO_OUT_FUNC3_REG
- li t9, 0x0
- sw t9, 0(t8)
-
- /* Turn on all LEDS and power on both USB */
- li t8, QCA_GPIO_SET_REG
- li t9, (GPIO21 | GPIO22)
+ #ifdef CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI
+ or t9, t9, (CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI | \
+ CONFIG_QCA_GPIO_MASK_LSUART_TX)
+ #else
+ or t9, t9, CONFIG_QCA_GPIO_MASK_LSUART_TX
+ #endif
+ #ifdef CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_LO
+ and t9, t9, ~(CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_LO)
+ #endif
sw t9, 0(t8)
- /* Wait for a while, for LEDs bootup blink */
- li t8, 0
- li t9, 0x70000
-
-1:
- addi t8, t8, 1
- bne t8, t9, 1b
- nop
-
- /* Turn off all LEDs */
- li t8, QCA_GPIO_SET_REG
- li t9, (GPIO11 | GPIO12 | GPIO13 | \
- GPIO14 | GPIO15 | GPIO21 | GPIO22)
- sw t9, 0(t8)
-
-#elif defined(CONFIG_FOR_TPLINK_WDR3500_V1)
/*
- * LEDs and buttons GPIOs on WDR3500 v1:
+ * TODO: what with default LSUART TX line?
*
- * 11 => USB LED
- * 12 => USB POWER (active high)
- * 13 => WLAN2G
- * 14 => SYS
- * 15 => QSS
- * 18 => WAN
- * 19 => LAN1
- * 20 => LAN2
- * 21 => LAN3
- * 22 => LAN4
+ * Some of QCA WiSoCs have GPIOs for LSUART TX/RX lines
+ * set by default (10 and 9 respectively) on reset and
+ * others do not (ex. QCA953x?).
*
- * 16 => Reset button
- * 17 => Wi-Fi ON/OFF switch
+ * Because of that we can use more than one line
+ * for TX signal if we setup other than default
+ * GPIO for it, without change default GPIO
+ * function.
*
- * All OUT GPIOs are active LOW if not stated otherwise
+ * Confirmed on AR9344 with LSUART TX set on
+ * GPIO1 and GPIO10 at the same time
*/
- /* GPIO Init */
- li t8, QCA_GPIO_OE_REG
+ /*
+ * Set GPIO mode on desired lines and GPIO number
+ * for LSUART TX using GPIO_OUT_FUNCTIONX registers:
+ * - 0 ~ 3 -> GPIO_OUT_FUNCTION0 (mask: 0x00000F)
+ * - 4 ~ 7 -> GPIO_OUT_FUNCTION1 (mask: 0x0000F0)
+ * - 8 ~ 11 -> GPIO_OUT_FUNCTION2 (mask: 0x000F00)
+ * - 12 ~ 15 -> GPIO_OUT_FUNCTION3 (mask: 0x00F000)
+ * - 16 ~ 19 -> GPIO_OUT_FUNCTION4 (mask: 0x0F0000)
+ * - 20 ~ 23 -> GPIO_OUT_FUNCTION5 (mask: 0xF00000)
+ */
+ #if defined(CONFIG_QCA_GPIO_MASK_OUTPUTS) || \
+ defined(CONFIG_QCA_GPIO_MASK_INPUTS)
+
+ /* GPIO_OUT_FUNCTION0 (GPIO 0~3) */
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & 0x00000F) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & 0x00000F) || \
+ (CONFIG_QCA_GPIO_MASK_LSUART_TX & 0x00000F)
+ li t8, QCA_GPIO_OUT_FUNC0_REG
lw t9, 0(t8)
- /* Set GPIOs 11~15 and 18~22 as outputs */
- and t9, t9, ~(GPIO11 | GPIO12 | GPIO13 | GPIO14 | GPIO15 | \
- GPIO18 | GPIO19 | GPIO20 | GPIO21 | GPIO22)
- /* Set GPIOs 16~17 as inputs */
- or t9, t9, (GPIO16 | GPIO17)
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO0) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO0)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO0_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO1) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO1)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO1_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO2) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO2)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO2_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO3) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO3)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO3_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_LSUART_TX & 0x00000F)
+ and t9, t9, ~(0xFF << CONFIG_QCA_GPIO_LSUART_TX_FUNCX_SHIFT)
+ or t9, t9, (QCA_GPIO_OUT_MUX_LSUART_TXD_VAL << \
+ CONFIG_QCA_GPIO_LSUART_TX_FUNCX_SHIFT)
+ #endif
sw t9, 0(t8)
+ #endif
- /* Set GPIO function for GPIO 11 */
+ /* GPIO_OUT_FUNCTION1 (GPIO 4~7) */
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & 0x0000F0) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & 0x0000F0) || \
+ (CONFIG_QCA_GPIO_MASK_LSUART_TX & 0x0000F0)
+ li t8, QCA_GPIO_OUT_FUNC1_REG
+ lw t9, 0(t8)
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO4) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO4)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO4_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO5) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO5)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO5_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO6) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO6)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO6_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO7) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO7)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO7_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_LSUART_TX & 0x0000F0)
+ and t9, t9, ~(0xFF << CONFIG_QCA_GPIO_LSUART_TX_FUNCX_SHIFT)
+ or t9, t9, (QCA_GPIO_OUT_MUX_LSUART_TXD_VAL << \
+ CONFIG_QCA_GPIO_LSUART_TX_FUNCX_SHIFT)
+ #endif
+ sw t9, 0(t8)
+ #endif
+
+ /* GPIO_OUT_FUNCTION2 (GPIO 8~11) */
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & 0x000F00) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & 0x000F00) || \
+ (CONFIG_QCA_GPIO_MASK_LSUART_TX & 0x000F00)
li t8, QCA_GPIO_OUT_FUNC2_REG
lw t9, 0(t8)
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO8) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO8)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO8_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO9) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO9)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO9_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO10) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO10)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO10_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO11) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO11)
and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO11_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_LSUART_TX & 0x000F00)
+ and t9, t9, ~(0xFF << CONFIG_QCA_GPIO_LSUART_TX_FUNCX_SHIFT)
+ or t9, t9, (QCA_GPIO_OUT_MUX_LSUART_TXD_VAL << \
+ CONFIG_QCA_GPIO_LSUART_TX_FUNCX_SHIFT)
+ #endif
sw t9, 0(t8)
+ #endif
- /* Set GPIO function for GPIOs 12~15 */
+ /* GPIO_OUT_FUNCTION3 (GPIO 12~15) */
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & 0x00F000) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & 0x00F000) || \
+ (CONFIG_QCA_GPIO_MASK_LSUART_TX & 0x00F000)
li t8, QCA_GPIO_OUT_FUNC3_REG
- li t9, 0x0
+ lw t9, 0(t8)
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO12) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO12)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO12_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO13) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO13)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO13_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO14) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO14)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO14_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO15) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO15)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO15_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_LSUART_TX & 0x00F000)
+ and t9, t9, ~(0xFF << CONFIG_QCA_GPIO_LSUART_TX_FUNCX_SHIFT)
+ or t9, t9, (QCA_GPIO_OUT_MUX_LSUART_TXD_VAL << \
+ CONFIG_QCA_GPIO_LSUART_TX_FUNCX_SHIFT)
+ #endif
sw t9, 0(t8)
+ #endif
- /* Set GPIO function for GPIOs 18~19 */
+ /* GPIO_OUT_FUNCTION4 (GPIO 16~19) */
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & 0x0F0000) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & 0x0F0000) || \
+ (CONFIG_QCA_GPIO_MASK_LSUART_TX & 0x0F0000)
li t8, QCA_GPIO_OUT_FUNC4_REG
lw t9, 0(t8)
- and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO18_EN_MASK | \
- QCA_GPIO_OUT_FUNCX_GPIO19_EN_MASK)
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO16) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO16)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO16_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO17) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO17)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO17_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO18) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO18)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO18_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO19) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO19)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO19_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_LSUART_TX & 0x0F0000)
+ and t9, t9, ~(0xFF << CONFIG_QCA_GPIO_LSUART_TX_FUNCX_SHIFT)
+ or t9, t9, (QCA_GPIO_OUT_MUX_LSUART_TXD_VAL << \
+ CONFIG_QCA_GPIO_LSUART_TX_FUNCX_SHIFT)
+ #endif
sw t9, 0(t8)
+ #endif
- /* Turn off all LEDs and turn on power on USB */
- li t8, QCA_GPIO_SET_REG
- li t9, (GPIO11 | GPIO12 | GPIO13 | GPIO14 | GPIO15 | \
- GPIO18 | GPIO19 | GPIO20 | GPIO21 | GPIO22)
+ /* GPIO_OUT_FUNCTION5 (GPIO 20~23) */
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & 0xF00000) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & 0xF00000) || \
+ (CONFIG_QCA_GPIO_MASK_LSUART_TX & 0xF00000)
+ li t8, QCA_GPIO_OUT_FUNC5_REG
+ lw t9, 0(t8)
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO20) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO20)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO20_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO21) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO21)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO21_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO22) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO22)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO22_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO23) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO23)
+ and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO23_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_LSUART_TX & 0xF00000)
+ and t9, t9, ~(0xFF << CONFIG_QCA_GPIO_LSUART_TX_FUNCX_SHIFT)
+ or t9, t9, (QCA_GPIO_OUT_MUX_LSUART_TXD_VAL << \
+ CONFIG_QCA_GPIO_LSUART_TX_FUNCX_SHIFT)
+ #endif
sw t9, 0(t8)
+ #endif
-#elif defined(CONFIG_FOR_TPLINK_WR841N_V8)
/*
- * LEDs and buttons GPIOs on WR841N/D v8:
- *
- * 12 => LAN4
- * 13 => WLAN
- * 14 => SYS
- * 15 => QSS
- * 18 => WAN
- * 19 => LAN1
- * 20 => LAN2
- * 21 => LAN3
- *
- * 16 => Wi-Fi ON/OFF switch
- * 17 => Reset button
- *
- * All OUT GPIOs are active LOW if not stated otherwise
+ * And finally, setup GPIO type (out/in)
+ * in GPIO_OE register for all configured
+ * regular GPIOs and LSUART TX/RX lines
*/
-
- /* GPIOs init */
li t8, QCA_GPIO_OE_REG
lw t9, 0(t8)
- /* Set GPIOs 12~15 and 18~21 as outputs */
- and t9, t9, ~(GPIO12 | GPIO13 | GPIO14 | GPIO15 | \
- GPIO18 | GPIO19 | GPIO20 | GPIO21)
- /* Set GPIOs 16~17 as inputs */
- or t9, t9, (GPIO16 | GPIO17)
+ #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)
- /* Set gpio function for GPIOs 12~15 */
- li t8, QCA_GPIO_OUT_FUNC3_REG
- li t9, 0x0
- sw t9, 0(t8)
+ #endif /* CONFIG_QCA_GPIO_MASK_OUTPUTS || CONFIG_QCA_GPIO_MASK_INPUTS */
- /* Set GPIO function for GPIOs 18~19 */
- li t8, QCA_GPIO_OUT_FUNC4_REG
- lw t9, 0(t8)
- and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO18_EN_MASK | \
- QCA_GPIO_OUT_FUNCX_GPIO19_EN_MASK)
- sw t9, 0(t8)
+#endif /* (SOC_TYPE & QCA_AR934X_SOC) || (SOC_TYPE & QCA_QCA953X_SOC) || (SOC_TYPE & QCA_QCA955X_SOC) */
- /* Turn off all LEDs */
- li t8, QCA_GPIO_SET_REG
- li t9, (GPIO12 | GPIO13 | GPIO14 | GPIO15 | \
- GPIO18 | GPIO19 | GPIO20 | GPIO21)
- sw t9, 0(t8)
+/*
+ * ===============================
+ * Low level GPIO setup for AR933x
+ * ===============================
+ */
+#if (SOC_TYPE & QCA_AR933X_SOC)
+
+ /* Sanity check for JTAG pins (GPIO 6~8) */
+ #if defined(CONFIG_SKIP_LOWLEVEL_INIT) || \
+ defined(CONFIG_QCA_KEEP_JTAG_ENABLED)
+ #if (defined(CONFIG_QCA_GPIO_MASK_INPUTS) && (CONFIG_QCA_GPIO_MASK_INPUTS & 0x1C0)) || \
+ (defined(CONFIG_QCA_GPIO_MASK_OUTPUTS) && (CONFIG_QCA_GPIO_MASK_OUTPUTS & 0x1C0))
+ #error "Cannot use JTAG and GPIO6~8 at the same time!"
+ #endif
+ #endif
-#elif defined(CONFIG_FOR_TPLINK_MR3420_V2)
/*
- * LEDs and buttons GPIOs on MR3420 v2:
- *
- * 4 => USB Power (active high)
- * 11 => USB/3G LED
- * 12 => LAN4
- * 13 => WLAN
- * 14 => SYS
- * 15 => QSS
- * 18 => WAN
- * 19 => LAN1
- * 20 => LAN2
- * 21 => LAN3
- *
- * 16 => WPS button
- * 17 => Reset button
- *
- * All OUT GPIOs are active LOW if not stated otherwise
+ * On AR933x HSUART TX/RX lines are connected to
+ * GPIO10 and GPIO9 respectively, so do not allow
+ * to use those GPIOs as regular at the same time
*/
+ #if defined(CONFIG_QCA_GPIO_MASK_INPUTS) || defined(CONFIG_QCA_GPIO_MASK_OUTPUTS)
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & (GPIO9 | GPIO10)) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & (GPIO9 | GPIO10))
+ #error "Cannot use HSUART lines as regular GPIOs at the same time!"
+ #endif
+ #endif
- /* GPIOs init */
- li t8, QCA_GPIO_OE_REG
+ /*
+ * GPIO configuration, using GPIO_FUNCTION_1 register:
+ * 1. Disable JTAG by default
+ * 2. Enable HSUART on GPIO9 and GPIO10 by default
+ * 3. Disable HSUART RTS/CTS on GPIO11/12 if needed
+ * 4. Disable selected Ethernet switch LEDs if needed
+ */
+ li t8, QCA_GPIO_FUNC_1_REG
lw t9, 0(t8)
- /* Set GPIOs 4, 11~15 and 18~21 as outputs */
- and t9, t9, ~(GPIO4 | GPIO11 | GPIO12 | GPIO13 | GPIO14 | \
- GPIO15 | GPIO18 | GPIO19 | GPIO20 | GPIO21)
- /* Set GPIOs 16~17 as inputs */
- or t9, t9, (GPIO16 | GPIO17)
- sw t9, 0(t8)
+ #if defined(CONFIG_SKIP_LOWLEVEL_INIT) || \
+ defined(CONFIG_QCA_KEEP_JTAG_ENABLED)
+ and t9, t9, ~(QCA_GPIO_FUNC_1_JTAG_DIS_MASK)
+ or t9, t9, QCA_GPIO_FUNC_1_UART_EN_MASK
+ #else
+ or t9, t9, (QCA_GPIO_FUNC_1_JTAG_DIS_MASK | \
+ QCA_GPIO_FUNC_1_UART_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & (GPIO11 | GPIO12)) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & (GPIO11 | GPIO12))
+ and t9, t9, ~(QCA_GPIO_FUNC_1_UART_RTS_CTS_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO13) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO13)
+ and t9, t9, ~(QCA_GPIO_FUNC_1_ETH_SW_LED0_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO14) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO14)
+ and t9, t9, ~(QCA_GPIO_FUNC_1_ETH_SW_LED1_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO15) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO15)
+ and t9, t9, ~(QCA_GPIO_FUNC_1_ETH_SW_LED2_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO16) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO16)
+ and t9, t9, ~(QCA_GPIO_FUNC_1_ETH_SW_LED3_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO17) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & GPIO17)
+ and t9, t9, ~(QCA_GPIO_FUNC_1_ETH_SW_LED4_EN_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO9)
+ and t9, t9, ~(QCA_GPIO_FUNC_1_SPI_CS_EN1_MASK)
+ #endif
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & GPIO10)
+ and t9, t9, ~(QCA_GPIO_FUNC_1_SPI_CS_EN2_MASK)
+ #endif
+ /* From datasheet: bit 15 should be written with 1 */
+ or t9, t9, ((1 << 15) | \
+ QCA_GPIO_FUNC_1_SPI_EN_MASK)
+ sw t9, 0(t8)
+
+ /* Enable regular GPIO function on GPIO26 and/or GPIO27 if needed */
+ #if defined(CONFIG_QCA_GPIO_MASK_OUTPUTS) || \
+ defined(CONFIG_QCA_GPIO_MASK_INPUTS)
+ #if (CONFIG_QCA_GPIO_MASK_OUTPUTS & (GPIO26 | GPIO27)) || \
+ (CONFIG_QCA_GPIO_MASK_INPUTS & (GPIO26 | GPIO27))
+ li t8, QCA_RST_BOOTSTRAP_REG
+ lw t9, 0(t8)
+ or t9, t9, QCA_RST_BOOTSTRAP_MDIO_GPIO_EN_MASK
+ sw t9, 0(t8)
+ #endif
+ #endif
- /* Set GPIO function for GPIO 4 */
- li t8, QCA_GPIO_OUT_FUNC1_REG
+ /* Setup init states on requested GPIO lines */
+ li t8, QCA_GPIO_OUT_REG
lw t9, 0(t8)
- and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO4_EN_MASK)
+ #ifdef CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI
+ or t9, t9, CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI
+ #endif
+ #ifdef CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_LO
+ and t9, t9, ~(CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_LO)
+ #endif
sw t9, 0(t8)
- /* Set GPIO function for GPIO 11 */
- li t8, QCA_GPIO_OUT_FUNC2_REG
+ /* Setup GPIOs in OE register */
+ #if defined(CONFIG_QCA_GPIO_MASK_OUTPUTS) || \
+ defined(CONFIG_QCA_GPIO_MASK_INPUTS)
+ li t8, QCA_GPIO_OE_REG
lw t9, 0(t8)
- and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO11_EN_MASK)
+ #ifdef CONFIG_QCA_GPIO_MASK_OUTPUTS
+ or t9, t9, CONFIG_QCA_GPIO_MASK_OUTPUTS
+ #endif
+ #ifdef CONFIG_QCA_GPIO_MASK_INPUTS
+ and t9, t9, ~(CONFIG_QCA_GPIO_MASK_INPUTS)
+ #endif
sw t9, 0(t8)
+ #endif
- /* Set GPIO function for GPIOs 12~15 */
- li t8, QCA_GPIO_OUT_FUNC3_REG
- li t9, 0x0
- sw t9, 0(t8)
+#endif /* (SOC_TYPE & QCA_AR933X_SOC) */
- /* Set GPIO function for GPIOs 18~19 */
- li t8, QCA_GPIO_OUT_FUNC4_REG
- lw t9, 0(t8)
- and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO18_EN_MASK | \
- QCA_GPIO_OUT_FUNCX_GPIO19_EN_MASK)
- sw t9, 0(t8)
+/*
+ * Custom, GPIO related code for boards should go here,
+ * after initial/basic GPIO configuration
+ */
- /* Turn off all LEDs and turn on power on USB */
- li t8, QCA_GPIO_SET_REG
- li t9, (GPIO4 | GPIO11 | GPIO12 | GPIO13 | GPIO14 | \
- GPIO15 | GPIO18 | GPIO19 | GPIO20 | GPIO21)
- sw t9, 0(t8)
+ jr ra
+ nop
-#elif defined(CONFIG_FOR_TPLINK_WA830RE_V2_WA801ND_V2)
- /*
- * LEDs and buttons GPIOs on WA830REv2 and WA801ND v2:
- *
- * 13 => WLAN
- * 14 => SYS
- * 15 => QSS
- * 18 => LAN
- *
- * 16 => Range Extender
- * 17 => Reset button
- *
- * All OUT GPIOs are active LOW if not stated otherwise
- */
+.end lowlevel_gpio_init
- /* GPIOs init */
- li t8, QCA_GPIO_OE_REG
- lw t9, 0(t8)
- /* Set GPIOs 13~15 and 18 as outputs */
- and t9, t9, ~(GPIO13 | GPIO14 | GPIO15 | GPIO18)
- /* Set GPIOs 16~17 as inputs */
- or t9, t9, (GPIO16 | GPIO17)
- sw t9, 0(t8)
+/*
+ * Set all predefined GPIO driven LEDs ON
+ */
- /* Set GPIO function for GPIOs 13~15 */
- li t8, QCA_GPIO_OUT_FUNC3_REG
- lw t9, 0(t8)
- and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO13_EN_MASK | \
- QCA_GPIO_OUT_FUNCX_GPIO14_EN_MASK | \
- QCA_GPIO_OUT_FUNCX_GPIO15_EN_MASK)
- sw t9, 0(t8)
+.globl all_led_on
+.type all_led_on, @function
+.align 4
+.text
+.ent all_led_on
- /* Set GPIO function for GPIO 18 */
- li t8, QCA_GPIO_OUT_FUNC4_REG
+all_led_on:
+#if defined(CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI) || \
+ defined(CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO)
+ li t8, QCA_GPIO_OUT_REG
lw t9, 0(t8)
- and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO18_EN_MASK)
- sw t9, 0(t8)
-
- /* Turn off all LEDs */
- li t8, QCA_GPIO_SET_REG
- li t9, (GPIO13 | GPIO14 | GPIO15 | GPIO18)
- sw t9, 0(t8)
+ #ifdef CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI
+ or t9, t9, CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI
+ #endif
+ #ifdef CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO
+ and t9, t9, ~(CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO)
+ #endif
+ sw t9, 0(t8)
+#else
+ nop
+#endif
-#elif defined(CONFIG_FOR_TPLINK_WR820N_CH)
- /*
- * LEDs and buttons GPIOs on WR820N CH:
- *
- * 11 => USB Power (active high)
- * 13 => SYS
- *
- * 0 => SWITCH
- * 1 => SWITCH
- * 12 => Reset button
- *
- * All OUT GPIOs are active LOW if not stated otherwise
- */
+ jr ra
+ nop
- /* GPIOs init */
- li t8, QCA_GPIO_OE_REG
- lw t9, 0(t8)
- /* Set GPIOs 11 and 13 outputs */
- and t9, t9, ~(GPIO11 | GPIO13)
- /* Set GPIOs 0, 1 and 12 as inputs */
- or t9, t9, (GPIO0 | GPIO1 | GPIO12)
- sw t9, 0(t8)
+.end all_led_on
- /* Set GPIO function for GPIOs 0 and 1 */
- li t8, QCA_GPIO_OUT_FUNC0_REG
- lw t9, 0(t8)
- and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO0_EN_MASK | \
- QCA_GPIO_OUT_FUNCX_GPIO1_EN_MASK)
- sw t9, 0(t8)
+/*
+ * Set all predefined GPIO driven LEDs OFF
+ */
- /* Set GPIO function for GPIO 11 */
- li t8, QCA_GPIO_OUT_FUNC2_REG
- lw t9, 0(t8)
- and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO11_EN_MASK)
- sw t9, 0(t8)
+.globl all_led_off
+.type all_led_off, @function
+.align 4
+.text
+.ent all_led_off
- /* Set gpio function for GPIOs 12 and 13 */
- li t8, QCA_GPIO_OUT_FUNC3_REG
+all_led_off:
+#if defined(CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI) || \
+ defined(CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO)
+ li t8, QCA_GPIO_OUT_REG
lw t9, 0(t8)
- and t9, t9, ~(QCA_GPIO_OUT_FUNCX_GPIO12_EN_MASK | \
- QCA_GPIO_OUT_FUNCX_GPIO13_EN_MASK)
- sw t9, 0(t8)
-
- /* Turn off LED, turn on power on USB */
- li t8, QCA_GPIO_SET_REG
- li t9, (GPIO11 | GPIO13)
- sw t9, 0(t8)
+ #ifdef CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI
+ and t9, t9, ~(CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI)
+ #endif
+ #ifdef CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO
+ or t9, t9, CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO
+ #endif
+ sw t9, 0(t8)
+#else
+ nop
#endif
- j ra
- .end lowlevel_gpio_init
+ jr ra
+ nop
+
+.end all_led_off
/* */
long int dram_init(void);
int timer_init(void);
-int gpio_init(void);
void full_reset(void);
void all_led_on(void);
void all_led_off(void);
#include <configs/ar7240.h>
#include <config.h>
+#include <soc/soc_common.h>
+
+/*
+ * GPIO configuration
+ */
+#if defined(CONFIG_FOR_TPLINK_WR703N_V1) ||\
+ defined(CONFIG_FOR_TPLINK_WR710N_V1)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO GPIO27
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO8)
+ #define CONFIG_QCA_GPIO_MASK_INPUTS GPIO11
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO8)
+
+#elif defined(CONFIG_FOR_TPLINK_MR10U_V1)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO GPIO27
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO18)
+ #define CONFIG_QCA_GPIO_MASK_INPUTS GPIO11
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO18)
+
+#elif defined(CONFIG_FOR_TPLINK_WR720N_V3)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO GPIO27
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO8)
+ #define CONFIG_QCA_GPIO_MASK_INPUTS (GPIO11 | GPIO18 | GPIO20)
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO8)
+
+#elif defined(CONFIG_FOR_TPLINK_MR13U_V1)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO GPIO27
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO18)
+ #define CONFIG_QCA_GPIO_MASK_INPUTS (GPIO6 | GPIO7 | GPIO11)
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO18)
+
+#elif defined(CONFIG_FOR_DLINK_DIR505_A1)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO (GPIO26 | GPIO27)
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO
+ #define CONFIG_QCA_GPIO_MASK_INPUTS GPIO11
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO
+
+#elif defined(CONFIG_FOR_BLACK_SWIFT_BOARD)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO GPIO27
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO
+ #define CONFIG_QCA_GPIO_MASK_INPUTS GPIO11
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO
+
+#elif defined(CONFIG_FOR_TPLINK_MR3020_V1)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI GPIO0
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO (GPIO17 | GPIO26 | GPIO27)
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO |\
+ CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI |\
+ GPIO8)
+ #define CONFIG_QCA_GPIO_MASK_INPUTS (GPIO11 | GPIO18 | GPIO20)
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO8)
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_LO CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI
+
+#elif defined(CONFIG_FOR_TPLINK_MR3040_V1V2)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO (GPIO17 | GPIO26 | GPIO27)
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO18)
+ #define CONFIG_QCA_GPIO_MASK_INPUTS GPIO11
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO18)
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_LO CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI
+
+#elif defined(CONFIG_FOR_TPLINK_WR740N_V4)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI (GPIO0 | GPIO1 | GPIO13 | GPIO14 | GPIO15 | GPIO16)
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO (GPIO17 | GPIO27)
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO |\
+ CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI)
+ #define CONFIG_QCA_GPIO_MASK_INPUTS (GPIO11 | GPIO26)
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_LO CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI
+
+#elif defined(CONFIG_FOR_TPLINK_MR3220_V2)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI (GPIO0 | GPIO1 | GPIO13 | GPIO14 | GPIO15 | GPIO16 | GPIO26)
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO (GPIO17 | GPIO27)
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO |\
+ CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI |\
+ GPIO8)
+ #define CONFIG_QCA_GPIO_MASK_INPUTS (GPIO11)
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO8)
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_LO CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI
+
+#elif defined(CONFIG_FOR_GS_OOLITE_V1_DEV)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO (GPIO13 | GPIO15 | GPIO17 | GPIO27)
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO
+ #define CONFIG_QCA_GPIO_MASK_INPUTS (GPIO11)
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO
+
+#elif defined(CONFIG_FOR_8DEVICES_CARAMBOLA2)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI (GPIO13 | GPIO14)
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO GPIO0
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO |\
+ CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI)
+ #define CONFIG_QCA_GPIO_MASK_INPUTS GPIO11
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_LO CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI
+
+#elif defined(CONFIG_FOR_DRAGINO_V2) ||\
+ defined(CONFIG_FOR_MESH_POTATO_V2)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI (GPIO0 | GPIO28)
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO (GPIO13 | GPIO17)
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO |\
+ CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI)
+ #define CONFIG_QCA_GPIO_MASK_INPUTS GPIO11
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_LO CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI
+
+#elif defined(CONFIG_FOR_GL_INET)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI (GPIO0 | GPIO13)
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI
+ #define CONFIG_QCA_GPIO_MASK_INPUTS GPIO11
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_LO CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_HI
+
+#endif
/*
* FLASH and environment organization
#include <configs/ar7240.h>
#include <config.h>
+#include <soc/soc_common.h>
+
+/*
+ * GPIO configuration
+ */
+#if defined(CONFIG_FOR_TPLINK_WDR3600_WDR43X0_V1)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO (GPIO11 | GPIO12 | GPIO13 | GPIO14 | GPIO15)
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO21 | GPIO22)
+ #define CONFIG_QCA_GPIO_MASK_INPUTS (GPIO16 | GPIO17)
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO21 | GPIO22)
+
+#elif defined(CONFIG_FOR_TPLINK_WDR3500_V1)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO (GPIO11 | GPIO13 | GPIO14 | GPIO15 | GPIO18 |\
+ GPIO19 | GPIO20 | GPIO21 | GPIO22)
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO12)
+ #define CONFIG_QCA_GPIO_MASK_INPUTS (GPIO16 | GPIO17)
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO12)
+
+#elif defined(CONFIG_FOR_TPLINK_MR3420_V2)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO (GPIO11 | GPIO12 | GPIO13 | GPIO14 | GPIO15 |\
+ GPIO18 | GPIO19 | GPIO20 | GPIO21)
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO4)
+ #define CONFIG_QCA_GPIO_MASK_INPUTS (GPIO16 | GPIO17)
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI (CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO | GPIO4)
+
+#elif defined(CONFIG_FOR_TPLINK_WR841N_V8)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO (GPIO12 | GPIO13 | GPIO14 | GPIO15 | GPIO18 |\
+ GPIO19 | GPIO20 | GPIO21)
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO
+ #define CONFIG_QCA_GPIO_MASK_INPUTS (GPIO16 | GPIO17)
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO
+
+#elif defined(CONFIG_FOR_TPLINK_WA830RE_V2_WA801ND_V2)
+ /* LEDs */
+ #define CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO (GPIO13 | GPIO14 | GPIO15 | GPIO18)
+
+ /* Outputs, inputs */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO
+ #define CONFIG_QCA_GPIO_MASK_INPUTS (GPIO16 | GPIO17)
+
+ /* Initial states */
+ #define CONFIG_QCA_GPIO_MASK_OUTPUTS_INIT_HI CONFIG_QCA_GPIO_MASK_LEDS_ACTIVE_LO
+
+#endif
/*
* FLASH and environment organization
init_fnc_t *init_sequence[] = { timer_init,
env_init,
baudrate_init,
- gpio_init,
serial_init,
console_init_f,
display_banner,
#else
init_fnc_t *init_sequence[] = { env_init,
baudrate_init,
- gpio_init,
serial_init,
console_init_f,
display_banner,