From patchwork Fri Mar 13 09:16:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Kohls X-Patchwork-Id: 449871 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 282DD140119 for ; Fri, 13 Mar 2015 20:17:33 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 11D6C281467; Fri, 13 Mar 2015 10:17:03 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id A2E4E28143D for ; Fri, 13 Mar 2015 10:16:58 +0100 (CET) X-policyd-weight: using cached result; rate: -5.5 Received: from sonne.alt-f4.ch (sonne.alt-f4.ch [95.128.33.42]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Fri, 13 Mar 2015 10:16:58 +0100 (CET) Received: from mehl.kola.li (HSI-KBW-46-223-173-221.hsi.kabel-badenwuerttemberg.de [46.223.173.221]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: mar@alt-f4.ch) by sonne.alt-f4.ch (Postfix) with ESMTPSA id 35D9D2BE62 for ; Fri, 13 Mar 2015 10:17:12 +0100 (CET) Received: by mehl.kola.li (Postfix, from userid 1000) id 325A7F98B; Fri, 13 Mar 2015 10:16:53 +0100 (CET) Date: Fri, 13 Mar 2015 10:16:53 +0100 From: Markus Kohls To: openwrt-devel@lists.openwrt.org Message-ID: <20150313091652.GA23051@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline Signed-off-by: Markus Kohls Tested-by: Markus Kohls User-Agent: Mutt/1.5.23 (2014-03-12) Subject: [OpenWrt-Devel] [OpenWrt-Devel,kernel] wnr2200 gpio X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Applied Patch from Ticket: #15267 --- target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c.old 2015-03-09 19:09:33.120104190 +0100 +++ target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c 2015-03-09 19:11:17.091893461 +0100 @@ -1,4 +1,4 @@ -/* +/* * NETGEAR WNR2200 board support * * Copyright (C) 2013 Aidan Kissane @@ -14,7 +14,9 @@ #include #include +#include +#include "common.h" #include "dev-ap9x-pci.h" #include "dev-eth.h" #include "dev-gpio-buttons.h" @@ -23,35 +25,45 @@ #include "dev-usb.h" #include "machtypes.h" -#define WNR2200_GPIO_LED_LAN2_AMBER 0 -#define WNR2200_GPIO_LED_LAN4_AMBER 1 -#define WNR2200_GPIO_LED_WPS 5 -#define WNR2200_GPIO_LED_WAN_GREEN 7 -#define WNR2200_GPIO_LED_USB 8 -#define WNR2200_GPIO_LED_LAN3_AMBER 11 -#define WNR2200_GPIO_LED_WAN_AMBER 12 -#define WNR2200_GPIO_LED_LAN1_GREEN 13 -#define WNR2200_GPIO_LED_LAN2_GREEN 14 -#define WNR2200_GPIO_LED_LAN3_GREEN 15 -#define WNR2200_GPIO_LED_LAN4_GREEN 16 -#define WNR2200_GPIO_LED_PWR_AMBER 21 -#define WNR2200_GPIO_LED_PWR_GREEN 22 - -#define WNR2200_GPIO_USB_POWER 24 - -#define WNR2200_KEYS_POLL_INTERVAL 20 /* msecs */ -#define WNR2200_KEYS_DEBOUNCE_INTERVAL (3 * WNR2200_KEYS_POLL_INTERVAL) - -#define WNR2200_MAC0_OFFSET 0 -#define WNR2200_MAC1_OFFSET 6 -#define WNR2200_PCIE_CALDATA_OFFSET 0x1000 +// AR9287 GPIO LED +#define WNR2200_GPIO_LED_WLAN 0 +#define WNR2200_GPIO_LED_PWR_AMBER 1 +#define WNR2200_GPIO_LED_PWR_GREEN 2 +#define WNR2200_GPIO_USB_5V 4 + +// AR9287 GPIO BUTTON +#define WNR2200_GPIO_BUTTON_WIFI 3 +#define WNR2200_GPIO_BUTTON_WPS 5 +#define WNR2200_GPIO_BUTTON_RESET 6 + +// AR7241 +#define WNR2200_GPIO_LED_WPS 7 +#define WNR2200_GPIO_LED_USB 8 + +#define WNR2200_GPIO_LED_LAN1_AMBER 6 +#define WNR2200_GPIO_LED_LAN2_AMBER 0 +#define WNR2200_GPIO_LED_LAN3_AMBER 11 +#define WNR2200_GPIO_LED_LAN4_AMBER 1 +#define WNR2200_GPIO_LED_WAN_AMBER 12 + +#define WNR2200_MAC0_OFFSET 0 +#define WNR2200_MAC1_OFFSET 6 +#define WNR2200_PCIE_CALDATA_OFFSET 0x1000 static struct gpio_led wnr2200_leds_gpio[] __initdata = { { + .name = "netgear:amber:lan1", + .gpio = WNR2200_GPIO_LED_LAN1_AMBER, + .active_low = 1, + }, { .name = "netgear:amber:lan2", .gpio = WNR2200_GPIO_LED_LAN2_AMBER, .active_low = 1, }, { + .name = "netgear:amber:lan3", + .gpio = WNR2200_GPIO_LED_LAN3_AMBER, + .active_low = 1, + }, { .name = "netgear:amber:lan4", .gpio = WNR2200_GPIO_LED_LAN4_AMBER, .active_low = 1, @@ -60,38 +72,14 @@ .gpio = WNR2200_GPIO_LED_WPS, .active_low = 1, }, { - .name = "netgear:green:wan", - .gpio = WNR2200_GPIO_LED_WAN_GREEN, - .active_low = 1, - }, { .name = "netgear:green:usb", .gpio = WNR2200_GPIO_LED_USB, .active_low = 1, }, { - .name = "netgear:amber:lan3", - .gpio = WNR2200_GPIO_LED_LAN3_AMBER, - .active_low = 1, - }, { .name = "netgear:amber:wan", .gpio = WNR2200_GPIO_LED_WAN_AMBER, .active_low = 1, }, { - .name = "netgear:green:lan1", - .gpio = WNR2200_GPIO_LED_LAN1_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan2", - .gpio = WNR2200_GPIO_LED_LAN2_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan3", - .gpio = WNR2200_GPIO_LED_LAN3_GREEN, - .active_low = 1, - }, { - .name = "netgear:green:lan4", - .gpio = WNR2200_GPIO_LED_LAN4_GREEN, - .active_low = 1, - }, { .name = "netgear:amber:power", .gpio = WNR2200_GPIO_LED_PWR_AMBER, .active_low = 1, @@ -106,6 +94,9 @@ { u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); + // Disable JTAG to use all AR7241 gpio leds. + ath79_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE, 0); + ath79_register_mdio(0, 0x0); ath79_init_mac(ath79_eth0_data.mac_addr, art+WNR2200_MAC0_OFFSET, 0); @@ -123,13 +114,16 @@ ath79_register_m25p80(NULL); ap91_pci_init(art + WNR2200_PCIE_CALDATA_OFFSET, NULL); + ap9x_pci_setup_wmac_led_pin(0, WNR2200_GPIO_LED_WLAN); + ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2200_leds_gpio), wnr2200_leds_gpio); /* enable power for the USB port */ - gpio_request_one(WNR2200_GPIO_USB_POWER, - GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, - "USB power"); + ap9x_pci_setup_wmac_gpio(0, + BIT(WNR2200_GPIO_USB_5V) | + BIT(WNR2200_GPIO_LED_PWR_AMBER) | BIT(WNR2200_GPIO_LED_PWR_GREEN), + BIT(WNR2200_GPIO_USB_5V) | BIT(WNR2200_GPIO_LED_PWR_AMBER)); ath79_register_usb(); }