Received: by 10.213.65.68 with SMTP id h4csp1995573imn; Sun, 8 Apr 2018 16:53:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+bEmvj45hnb93lSxxNneNfaBNrF0bR6RTe5FBgIjYFLIlwF6fHPLwHan1Pnqm0Shx5l2bD X-Received: by 2002:a17:902:7c0e:: with SMTP id x14-v6mr6353213pll.51.1523231614228; Sun, 08 Apr 2018 16:53:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523231614; cv=none; d=google.com; s=arc-20160816; b=xJ62J4tdaXT4oFVIBNj7FJX11Nv20oD+TE5xGknD503eU15QWSSaL7ceTCix1Ir4CF YkEzRfSqF0CwJb9Bw8lNmRxZNUjiRlBHNkOLEoL4MQmSju0ASX69jK+drFHGQP34KOSh XhAFCMotDan5oZ1piS8r6d56gXV7dVoX5mEabu+OVd5fUtVPFrdPIvwYRyBk4edxT4Gn U71wnd/DGELwba/iKRTHg6DB3+JOKgx7v4fVSjgayl94cWfcEVMyHAiZHD+mWEjYN5AN FOpPzUZKHl07y9j3QbjNVSncu0jME2kwIxWvvdMgFGqJNVOEq0OxS9axuDJ7R8uPYz9/ 5fUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=E6RQ0lsmitRDGAR+onL5dSs9M5RvRAZ3MT5fHWhMlY4=; b=z2HuzH/O+O9fjP3WxaOAx5pS1Ho3DxdMO2S3PAuIDDeQ+HuwC9Y99o2kkZqZ/8Xqwv kiJ/CtU3btFXLm8kJcmbe9EZpKKgE/w7HQzrc1356aL45TS7qcdQu/pq8d8KWPzmHFtb M5aanNKY3Cv2KRYgSOanFPKJIrLIwn+YQh3yptKoeRi1IKdDqA18cU8oDaeH/Rh8F44Y Llu/VAB+iWhIaXNxNsjXNczn+pf5RO+R/uWcEgYeS7iJacCvT8101oqXTnUjhVU+96jF lFLHB2DYPQzTqYtunRtwdm6KADAwIM1r09DxcUbRtfdTSGXLyEeDYHJtvMsA4QSqeQUJ Gy9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bKYXGlFc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6-v6si13408353pll.722.2018.04.08.16.52.56; Sun, 08 Apr 2018 16:53:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bKYXGlFc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752697AbeDHU5p (ORCPT + 99 others); Sun, 8 Apr 2018 16:57:45 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:34119 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752255AbeDHU5n (ORCPT ); Sun, 8 Apr 2018 16:57:43 -0400 Received: by mail-wr0-f193.google.com with SMTP id d19so2846033wre.1 for ; Sun, 08 Apr 2018 13:57:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=E6RQ0lsmitRDGAR+onL5dSs9M5RvRAZ3MT5fHWhMlY4=; b=bKYXGlFcQcL4ivZdhQXKZ215ew8IlmZliy2eavWQFFI4P5SmGAXdWM74khfAIf98b4 D1h7IOE6znh0LIS7TgLXIBGGacJfSyCwnDwdW1SuU4qikO/qlTvbq58W/keniYujKRCK lxjSlKBdksvVvPyR4CqovgCarXQ3MER8zj5BhCRQo7KufFYaTPTDMMhADuKX2g4ZNGDS zvk10LmWQPXos3hlVs9mIRfErv4rq3E4VQ2W5qa6C10FvbqZI/3lqKxTaSkGqmkHmlry efshuQPYWGHsrXm8O36orgCZHxP3DPB9OEZhAcxNOwkv1DzzRfojluTzozrPqC/QeOrN dqsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=E6RQ0lsmitRDGAR+onL5dSs9M5RvRAZ3MT5fHWhMlY4=; b=JnAaUnAQJHISYrg8+aQOtx99doVacE3zv06L+jSBdX9GYAIDUbAjESdwmBBGmPsgcm Bln2ARFi0popTK8K5hVl99WV8eMPSHDS52eh7rERFIji1lJImvBGrGUqcouaxrJN9Dk4 7U3i9dUHhnLqLV1S7CAOq89xXssKARW9R4ImLsaMCL/fueX+Z2bAuDrwlH1iMh25oXc2 nlVBkMVrCk8giB4TQ8wb7667t9BPWl3D2si2ToxLVRl8Sl4Yzblp5KanZEmV1fLoM35A cLd7LTXJN6pnrup/LScf+pcbyJoYM4lPuAANjgdQsc0Cf83Ou1EgPoY2Bbcv9O5HFiQh K0Tg== X-Gm-Message-State: ALQs6tDoW7JdLbbmKo91TA5VMFtH/KqONRgKPoaSYCeHEnKQdAqptQ3C KCwIcmU33ZS2Putj5/6GNwqgQg== X-Received: by 2002:a19:59d1:: with SMTP id n200-v6mr20235768lfb.84.1523221062521; Sun, 08 Apr 2018 13:57:42 -0700 (PDT) Received: from linux-samsung.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id o2sm2558271lja.86.2018.04.08.13.57.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Apr 2018 13:57:41 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: James Hogan , Ralf Baechle Cc: linux-mips@linux-mips.org, Hauke Mehrtens , linux-kernel@vger.kernel.org, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH 1/2] MIPS: BCM47XX: Add support for Netgear WNR1000 V3 Date: Sun, 8 Apr 2018 22:57:32 +0200 Message-Id: <20180408205733.9026-1-zajec5@gmail.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafał Miłecki This adds support for detecting this model board and registers some LEDs and buttons. There are two uncommon things regarding this device: 1) It can use two different "board_id" ID values. Unit I have uses "U12H139T00_NETGEAR" value. This magic is also used in firmware file header. There are two reports (one from an OpenWrt user) of a different "U12H139T50_NETGEAR" magic though. 2) Power LEDs share GPIOs with buttons. Amber one seems to share GPIO 2 with WPS button and green one seems to share GPIO 3 with reset button. It remains unknown how to support them and handle buttons at the same time. For that reason they aren't added to the list of supported LEDs. Signed-off-by: Rafał Miłecki --- arch/mips/bcm47xx/board.c | 2 ++ arch/mips/bcm47xx/buttons.c | 9 +++++++++ arch/mips/bcm47xx/leds.c | 9 +++++++++ arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | 1 + 4 files changed, 21 insertions(+) diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c index edfaef0d73a4..a80910d2738c 100644 --- a/arch/mips/bcm47xx/board.c +++ b/arch/mips/bcm47xx/board.c @@ -172,6 +172,8 @@ struct bcm47xx_board_type_list1 bcm47xx_board_list_board_id[] __initconst = { {{BCM47XX_BOARD_NETGEAR_WNDR4000, "Netgear WNDR4000"}, "U12H181T00_NETGEAR"}, {{BCM47XX_BOARD_NETGEAR_WNDR4500V1, "Netgear WNDR4500 V1"}, "U12H189T00_NETGEAR"}, {{BCM47XX_BOARD_NETGEAR_WNDR4500V2, "Netgear WNDR4500 V2"}, "U12H224T00_NETGEAR"}, + {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T00_NETGEAR"}, + {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T50_NETGEAR"}, {{BCM47XX_BOARD_NETGEAR_WNR2000, "Netgear WNR2000"}, "U12H114T00_NETGEAR"}, {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Netgear WNR3500L"}, "U12H136T99_NETGEAR"}, {{BCM47XX_BOARD_NETGEAR_WNR3500U, "Netgear WNR3500U"}, "U12H136T00_NETGEAR"}, diff --git a/arch/mips/bcm47xx/buttons.c b/arch/mips/bcm47xx/buttons.c index 88d400d256c4..977990a609ba 100644 --- a/arch/mips/bcm47xx/buttons.c +++ b/arch/mips/bcm47xx/buttons.c @@ -412,6 +412,12 @@ bcm47xx_buttons_netgear_wndr4500v1[] __initconst = { }; static const struct gpio_keys_button +bcm47xx_buttons_netgear_wnr1000_v3[] __initconst = { + BCM47XX_GPIO_KEY(2, KEY_WPS_BUTTON), + BCM47XX_GPIO_KEY(3, KEY_RESTART), +}; + +static const struct gpio_keys_button bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = { BCM47XX_GPIO_KEY(4, KEY_RESTART), BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON), @@ -670,6 +676,9 @@ int __init bcm47xx_buttons_register(void) case BCM47XX_BOARD_NETGEAR_WNDR4500V1: err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1); break; + case BCM47XX_BOARD_NETGEAR_WNR1000_V3: + err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr1000_v3); + break; case BCM47XX_BOARD_NETGEAR_WNR3500L: err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1); break; diff --git a/arch/mips/bcm47xx/leds.c b/arch/mips/bcm47xx/leds.c index 34a7b3fbdfd9..3fe015602945 100644 --- a/arch/mips/bcm47xx/leds.c +++ b/arch/mips/bcm47xx/leds.c @@ -498,6 +498,12 @@ bcm47xx_leds_netgear_wndr4500v1[] __initconst = { }; static const struct gpio_led +bcm47xx_leds_netgear_wnr1000_v3[] __initconst = { + BCM47XX_GPIO_LED(0, "blue", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF), + BCM47XX_GPIO_LED(1, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF), +}; + +static const struct gpio_led bcm47xx_leds_netgear_wnr3500lv1[] __initconst = { BCM47XX_GPIO_LED(0, "blue", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF), BCM47XX_GPIO_LED(1, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF), @@ -758,6 +764,9 @@ void __init bcm47xx_leds_register(void) case BCM47XX_BOARD_NETGEAR_WNDR4500V1: bcm47xx_set_pdata(bcm47xx_leds_netgear_wndr4500v1); break; + case BCM47XX_BOARD_NETGEAR_WNR1000_V3: + bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr1000_v3); + break; case BCM47XX_BOARD_NETGEAR_WNR3500L: bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr3500lv1); break; diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h index cbf9da7f2f94..0ef8893e07f8 100644 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h @@ -110,6 +110,7 @@ enum bcm47xx_board { BCM47XX_BOARD_NETGEAR_WNDR4000, BCM47XX_BOARD_NETGEAR_WNDR4500V1, BCM47XX_BOARD_NETGEAR_WNDR4500V2, + BCM47XX_BOARD_NETGEAR_WNR1000_V3, BCM47XX_BOARD_NETGEAR_WNR2000, BCM47XX_BOARD_NETGEAR_WNR3500L, BCM47XX_BOARD_NETGEAR_WNR3500U, -- 2.11.0