From f223c4a9230f520f27bf0e1c458335b79935805a Mon Sep 17 00:00:00 2001 From: Wojciech Jowsa Date: Wed, 15 Feb 2017 12:38:07 +0100 Subject: ar71xx: set status led for the gl-* boards Signed-off-by: Wojciech Jowsa --- target/linux/ar71xx/base-files/etc/board.d/01_leds | 21 +- target/linux/ar71xx/base-files/etc/diag.sh | 4 +- .../ar71xx/files/arch/mips/ath79/mach-gl-ar300m.c | 222 ++++++++++----------- .../ar71xx/files/arch/mips/ath79/mach-gl-mifi.c | 10 +- 4 files changed, 129 insertions(+), 128 deletions(-) (limited to 'target/linux') diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds index 4dc4bfd51d..0ed533dddb 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds @@ -312,19 +312,18 @@ dlan-pro-1200-ac) ucidef_set_led_gpio "plcw" "dLAN" "devolo:status:dlan" "17" "0" ucidef_set_led_gpio "plcr" "dLAN" "devolo:error:dlan" "16" "0" ;; -gl-ar150|\ -gl-ar300|\ -gl-ar300m|\ +gl-ar300m) + ucidef_set_led_wlan "wlan" "WLAN" "$board:red:wlan" "phy0tpt" + ;; gl-mifi) + ucidef_set_led_wlan "wlan" "WLAN" "$board:green:wlan" "phy0tpt" + ucidef_set_led_netdev "wan" "WAN" "$board:green:wan" "eth0" + ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth1" + ucidef_set_led_netdev "3gnet" "3GNET" "$board:green:net" "3g-wan" + ;; +gl-ar150|\ +gl-ar300) ucidef_set_led_wlan "wlan" "WLAN" "$board:wlan" "phy0tpt" - - case "$board" in - gl-mifi) - ucidef_set_led_netdev "wan" "WAN" "$board:wan" "eth0" - ucidef_set_led_netdev "lan" "LAN" "$board:lan" "eth1" - ucidef_set_led_netdev "3gnet" "3GNET" "$board:net" "3g-wan" - ;; - esac ;; gl-domino|\ sc300m|\ diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 106464105a..7987e51a67 100644 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -61,7 +61,9 @@ get_status_led() { ap90q|\ cpe830|\ cpe870|\ - gl-inet) + gl-inet|\ + gl-mifi|\ + gl-ar300m) status_led="$board:green:lan" ;; ap96) diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300m.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300m.c index 62906a1922..ca44b364c5 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300m.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-ar300m.c @@ -6,9 +6,9 @@ * Copyright (C) 2013 alzhao * Copyright (C) 2014 Michel Stempin * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. */ #include @@ -37,130 +37,130 @@ #define GL_AR300M_GPIO_BTN_LEFT 0 #define GL_AR300M_GPIO_BTN_RIGHT 1 -#define GL_AR300M_KEYS_POLL_INTERVAL 20 /* msecs */ -#define GL_AR300M_KEYS_DEBOUNCE_INTERVAL (3 * GL_AR300M_KEYS_POLL_INTERVAL) +#define GL_AR300M_KEYS_POLL_INTERVAL 20 /* msecs */ +#define GL_AR300M_KEYS_DEBOUNCE_INTERVAL (3 * GL_AR300M_KEYS_POLL_INTERVAL) -#define GL_AR300M_MAC0_OFFSET 0 -#define GL_AR300M_MAC1_OFFSET 6 -#define GL_AR300M_WMAC_CALDATA_OFFSET 0x1000 -#define GL_AR300M_PCIE_CALDATA_OFFSET 0x5000 +#define GL_AR300M_MAC0_OFFSET 0 +#define GL_AR300M_MAC1_OFFSET 6 +#define GL_AR300M_WMAC_CALDATA_OFFSET 0x1000 +#define GL_AR300M_PCIE_CALDATA_OFFSET 0x5000 static struct gpio_led gl_ar300m_leds_gpio[] __initdata = { - { - .name = "gl-ar300m:usb", - .gpio = GL_AR300M_GPIO_LED_USB, - .active_low = 0, - .default_state = 1, - }, - { - .name = "gl-ar300m:wlan", - .gpio = GL_AR300M_GPIO_LED_WLAN, - .active_low = 1, - }, - { - .name = "gl-ar300m:lan", - .gpio = GL_AR300M_GPIO_LED_LAN, - .active_low = 1, - }, - { - .name = "gl-ar300m:system", - .gpio = GL_AR300M_GPIO_LED_SYSTEM, - .active_low = 1, - .default_state = 1, - }, + { + .name = "gl-ar300m:green:usb", + .gpio = GL_AR300M_GPIO_LED_USB, + .active_low = 0, + .default_state = 1, + }, + { + .name = "gl-ar300m:green:wlan", + .gpio = GL_AR300M_GPIO_LED_WLAN, + .active_low = 1, + }, + { + .name = "gl-ar300m::green:lan", + .gpio = GL_AR300M_GPIO_LED_LAN, + .active_low = 1, + }, + { + .name = "gl-ar300m:green:system", + .gpio = GL_AR300M_GPIO_LED_SYSTEM, + .active_low = 1, + .default_state = 1, + }, }; static struct gpio_keys_button gl_ar300m_gpio_keys[] __initdata = { - { - .desc = "reset", - .type = EV_KEY, - .code = KEY_RESTART, - .debounce_interval = GL_AR300M_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_AR300M_GPIO_BTN_RESET, - .active_low = 1, - }, - { - .desc = "button right", - .type = EV_KEY, - .code = BTN_0, - .debounce_interval = GL_AR300M_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_AR300M_GPIO_BTN_LEFT, - .active_low = 0, - }, - { - .desc = "button left", - .type = EV_KEY, - .code = BTN_1, - .debounce_interval = GL_AR300M_KEYS_DEBOUNCE_INTERVAL, - .gpio = GL_AR300M_GPIO_BTN_RIGHT, - .active_low = 0, - }, + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = GL_AR300M_KEYS_DEBOUNCE_INTERVAL, + .gpio = GL_AR300M_GPIO_BTN_RESET, + .active_low = 1, + }, + { + .desc = "button right", + .type = EV_KEY, + .code = BTN_0, + .debounce_interval = GL_AR300M_KEYS_DEBOUNCE_INTERVAL, + .gpio = GL_AR300M_GPIO_BTN_LEFT, + .active_low = 0, + }, + { + .desc = "button left", + .type = EV_KEY, + .code = BTN_1, + .debounce_interval = GL_AR300M_KEYS_DEBOUNCE_INTERVAL, + .gpio = GL_AR300M_GPIO_BTN_RIGHT, + .active_low = 0, + }, }; static struct spi_board_info gl_ar300m_spi_info[] = { - { - .bus_num = 0, - .chip_select = 0, - .max_speed_hz = 25000000, - .modalias = "m25p80", - .platform_data = NULL, - }, - { - .bus_num = 0, - .chip_select = 1, - .max_speed_hz = 25000000, - .modalias = "ath79-spinand", - .platform_data = NULL, - } + { + .bus_num = 0, + .chip_select = 0, + .max_speed_hz = 25000000, + .modalias = "m25p80", + .platform_data = NULL, + }, + { + .bus_num = 0, + .chip_select = 1, + .max_speed_hz = 25000000, + .modalias = "ath79-spinand", + .platform_data = NULL, + } }; static struct ath79_spi_platform_data gl_ar300m_spi_data = { - .bus_num = 0, - .num_chipselect = 2, + .bus_num = 0, + .num_chipselect = 2, }; static void __init gl_ar300m_setup(void) { - u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 tmpmac[ETH_ALEN]; - - ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); - ath79_register_spi(&gl_ar300m_spi_data, gl_ar300m_spi_info, 2); - - /* register gpio LEDs and keys */ - ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_ar300m_leds_gpio), - gl_ar300m_leds_gpio); - ath79_register_gpio_keys_polled(-1, GL_AR300M_KEYS_POLL_INTERVAL, - ARRAY_SIZE(gl_ar300m_gpio_keys), - gl_ar300m_gpio_keys); - - ath79_register_mdio(0, 0x0); - - /* WAN */ - ath79_init_mac(ath79_eth0_data.mac_addr, art + GL_AR300M_MAC0_OFFSET, 0); - ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_eth0_data.phy_mask = BIT(4); - ath79_register_eth(0); - - /* LAN */ - ath79_init_mac(ath79_eth1_data.mac_addr, art + GL_AR300M_MAC1_OFFSET, 0); - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_eth1_data.speed = SPEED_1000; - ath79_eth1_data.duplex = DUPLEX_FULL; - ath79_switch_data.phy_poll_mask |= BIT(4); - ath79_switch_data.phy4_mii_en = 1; - ath79_register_eth(1); - - ath79_init_mac(tmpmac, art + GL_AR300M_WMAC_CALDATA_OFFSET + 2, 0); - ath79_register_wmac(art + GL_AR300M_WMAC_CALDATA_OFFSET, tmpmac); - - /* enable usb */ - ath79_register_usb(); - /* enable pci */ - ath79_register_pci(); + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); + u8 tmpmac[ETH_ALEN]; + + ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); + ath79_register_spi(&gl_ar300m_spi_data, gl_ar300m_spi_info, 2); + + /* register gpio LEDs and keys */ + ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_ar300m_leds_gpio), + gl_ar300m_leds_gpio); + ath79_register_gpio_keys_polled(-1, GL_AR300M_KEYS_POLL_INTERVAL, + ARRAY_SIZE(gl_ar300m_gpio_keys), + gl_ar300m_gpio_keys); + + ath79_register_mdio(0, 0x0); + + /* WAN */ + ath79_init_mac(ath79_eth0_data.mac_addr, art + GL_AR300M_MAC0_OFFSET, 0); + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; + ath79_eth0_data.speed = SPEED_100; + ath79_eth0_data.duplex = DUPLEX_FULL; + ath79_eth0_data.phy_mask = BIT(4); + ath79_register_eth(0); + + /* LAN */ + ath79_init_mac(ath79_eth1_data.mac_addr, art + GL_AR300M_MAC1_OFFSET, 0); + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; + ath79_eth1_data.speed = SPEED_1000; + ath79_eth1_data.duplex = DUPLEX_FULL; + ath79_switch_data.phy_poll_mask |= BIT(4); + ath79_switch_data.phy4_mii_en = 1; + ath79_register_eth(1); + + ath79_init_mac(tmpmac, art + GL_AR300M_WMAC_CALDATA_OFFSET + 2, 0); + ath79_register_wmac(art + GL_AR300M_WMAC_CALDATA_OFFSET, tmpmac); + + /* enable usb */ + ath79_register_usb(); + /* enable pci */ + ath79_register_pci(); } MIPS_MACHINE(ATH79_MACH_GL_AR300M, "GL-AR300M", "GL-AR300M", - gl_ar300m_setup); + gl_ar300m_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-mifi.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-mifi.c index 42f4415d7f..412c562fa0 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-mifi.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-mifi.c @@ -41,27 +41,27 @@ static struct gpio_led gl_mifi_leds_gpio[] __initdata = { { - .name = "gl-mifi:wan", + .name = "gl-mifi:greeen:wan", .gpio = GL_MIFI_GPIO_LED_WAN, .active_low = 0, }, { - .name = "gl-mifi:lan", + .name = "gl-mifi:green:lan", .gpio = GL_MIFI_GPIO_LED_LAN, .active_low = 0, }, { - .name = "gl-mifi:wlan", + .name = "gl-mifi:green:wlan", .gpio = GL_MIFI_GPIO_LED_WLAN, .active_low = 0, }, { - .name = "gl-mifi:net", + .name = "gl-mifi:green:net", .gpio = GL_MIFI_GPIO_LED_NET, .active_low = 0, }, { - .name = "gl-mifi:3gcontrol", + .name = "gl-mifi:green:3gcontrol", .gpio = GL_MIFI_GPIO_LED_3GCONTROL, .active_low = 0, } -- cgit v1.2.3