--- /dev/null
+From 36b3b702c20e67b18070159dfba80d2084836928 Mon Sep 17 00:00:00 2001
+From: Dan Haab <dhaab@luxul.com>
+Date: Mon, 23 Jan 2017 12:50:38 -0700
+Subject: [PATCH] MIPS: BCM47XX: Add Luxul devices to the database
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+So far only Luxul XWR-1750 router was supported. This adds a set of
+other Luxul devices based on BCM47XX. It's a standard support for LEDs
+and buttons.
+
+Signed-off-by: Dan Haab <dhaab@luxul.com>
+Cc: Hauke Mehrtens <hauke@hauke-m.de>
+Cc: Rafał Miłecki <zajec5@gmail.com>
+Cc: linux-mips@linux-mips.org
+Patchwork: https://patchwork.linux-mips.org/patch/15106/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+---
+ arch/mips/bcm47xx/board.c | 9 +++
+ arch/mips/bcm47xx/buttons.c | 72 +++++++++++++++++++
+ arch/mips/bcm47xx/leds.c | 81 ++++++++++++++++++++++
+ arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | 9 +++
+ 4 files changed, 171 insertions(+)
+
+--- a/arch/mips/bcm47xx/board.c
++++ b/arch/mips/bcm47xx/board.c
+@@ -149,6 +149,15 @@ struct bcm47xx_board_type_list2 bcm47xx_
+ /* board_id */
+ static const
+ struct bcm47xx_board_type_list1 bcm47xx_board_list_board_id[] __initconst = {
++ {{BCM47XX_BOARD_LUXUL_ABR_4400_V1, "Luxul ABR-4400 V1"}, "luxul_abr4400_v1"},
++ {{BCM47XX_BOARD_LUXUL_XAP_310_V1, "Luxul XAP-310 V1"}, "luxul_xap310_v1"},
++ {{BCM47XX_BOARD_LUXUL_XAP_1210_V1, "Luxul XAP-1210 V1"}, "luxul_xap1210_v1"},
++ {{BCM47XX_BOARD_LUXUL_XAP_1230_V1, "Luxul XAP-1230 V1"}, "luxul_xap1230_v1"},
++ {{BCM47XX_BOARD_LUXUL_XAP_1240_V1, "Luxul XAP-1240 V1"}, "luxul_xap1240_v1"},
++ {{BCM47XX_BOARD_LUXUL_XAP_1500_V1, "Luxul XAP-1500 V1"}, "luxul_xap1500_v1"},
++ {{BCM47XX_BOARD_LUXUL_XBR_4400_V1, "Luxul XBR-4400 V1"}, "luxul_xbr4400_v1"},
++ {{BCM47XX_BOARD_LUXUL_XVW_P30_V1, "Luxul XVW-P30 V1"}, "luxul_xvwp30_v1"},
++ {{BCM47XX_BOARD_LUXUL_XWR_600_V1, "Luxul XWR-600 V1"}, "luxul_xwr600_v1"},
+ {{BCM47XX_BOARD_LUXUL_XWR_1750_V1, "Luxul XWR-1750 V1"}, "luxul_xwr1750_v1"},
+ {{BCM47XX_BOARD_NETGEAR_WGR614V8, "Netgear WGR614 V8"}, "U12H072T00_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WGR614V9, "Netgear WGR614 V9"}, "U12H094T00_NETGEAR"},
+--- a/arch/mips/bcm47xx/buttons.c
++++ b/arch/mips/bcm47xx/buttons.c
+@@ -302,6 +302,51 @@ bcm47xx_buttons_linksys_wrtsl54gs[] __in
+ /* Luxul */
+
+ static const struct gpio_keys_button
++bcm47xx_buttons_luxul_abr_4400_v1[] = {
++ BCM47XX_GPIO_KEY(14, KEY_RESTART),
++};
++
++static const struct gpio_keys_button
++bcm47xx_buttons_luxul_xap_310_v1[] = {
++ BCM47XX_GPIO_KEY(20, KEY_RESTART),
++};
++
++static const struct gpio_keys_button
++bcm47xx_buttons_luxul_xap_1210_v1[] = {
++ BCM47XX_GPIO_KEY(8, KEY_RESTART),
++};
++
++static const struct gpio_keys_button
++bcm47xx_buttons_luxul_xap_1230_v1[] = {
++ BCM47XX_GPIO_KEY(8, KEY_RESTART),
++};
++
++static const struct gpio_keys_button
++bcm47xx_buttons_luxul_xap_1240_v1[] = {
++ BCM47XX_GPIO_KEY(8, KEY_RESTART),
++};
++
++static const struct gpio_keys_button
++bcm47xx_buttons_luxul_xap_1500_v1[] = {
++ BCM47XX_GPIO_KEY(14, KEY_RESTART),
++};
++
++static const struct gpio_keys_button
++bcm47xx_buttons_luxul_xbr_4400_v1[] = {
++ BCM47XX_GPIO_KEY(14, KEY_RESTART),
++};
++
++static const struct gpio_keys_button
++bcm47xx_buttons_luxul_xvw_p30_v1[] = {
++ BCM47XX_GPIO_KEY(20, KEY_RESTART),
++};
++
++static const struct gpio_keys_button
++bcm47xx_buttons_luxul_xwr_600_v1[] = {
++ BCM47XX_GPIO_KEY(8, KEY_RESTART),
++};
++
++static const struct gpio_keys_button
+ bcm47xx_buttons_luxul_xwr_1750_v1[] = {
+ BCM47XX_GPIO_KEY(14, BTN_TASK),
+ };
+@@ -561,6 +606,33 @@ int __init bcm47xx_buttons_register(void
+ err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs);
+ break;
+
++ case BCM47XX_BOARD_LUXUL_ABR_4400_V1:
++ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_abr_4400_v1);
++ break;
++ case BCM47XX_BOARD_LUXUL_XAP_310_V1:
++ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_310_v1);
++ break;
++ case BCM47XX_BOARD_LUXUL_XAP_1210_V1:
++ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1210_v1);
++ break;
++ case BCM47XX_BOARD_LUXUL_XAP_1230_V1:
++ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1230_v1);
++ break;
++ case BCM47XX_BOARD_LUXUL_XAP_1240_V1:
++ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1240_v1);
++ break;
++ case BCM47XX_BOARD_LUXUL_XAP_1500_V1:
++ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1500_v1);
++ break;
++ case BCM47XX_BOARD_LUXUL_XBR_4400_V1:
++ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xbr_4400_v1);
++ break;
++ case BCM47XX_BOARD_LUXUL_XVW_P30_V1:
++ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xvw_p30_v1);
++ break;
++ case BCM47XX_BOARD_LUXUL_XWR_600_V1:
++ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_600_v1);
++ break;
+ case BCM47XX_BOARD_LUXUL_XWR_1750_V1:
+ err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_1750_v1);
+ break;
+--- a/arch/mips/bcm47xx/leds.c
++++ b/arch/mips/bcm47xx/leds.c
+@@ -373,6 +373,60 @@ bcm47xx_leds_linksys_wrtsl54gs[] __initc
+ /* Luxul */
+
+ static const struct gpio_led
++bcm47xx_leds_luxul_abr_4400_v1[] __initconst = {
++ BCM47XX_GPIO_LED(12, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF),
++ BCM47XX_GPIO_LED_TRIGGER(15, "green", "status", 0, "timer"),
++};
++
++static const struct gpio_led
++bcm47xx_leds_luxul_xap_310_v1[] __initconst = {
++ BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"),
++};
++
++static const struct gpio_led
++bcm47xx_leds_luxul_xap_1210_v1[] __initconst = {
++ BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"),
++};
++
++static const struct gpio_led
++bcm47xx_leds_luxul_xap_1230_v1[] __initconst = {
++ BCM47XX_GPIO_LED(3, "blue", "2ghz", 0, LEDS_GPIO_DEFSTATE_OFF),
++ BCM47XX_GPIO_LED(4, "green", "bridge", 0, LEDS_GPIO_DEFSTATE_OFF),
++ BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"),
++};
++
++static const struct gpio_led
++bcm47xx_leds_luxul_xap_1240_v1[] __initconst = {
++ BCM47XX_GPIO_LED(3, "blue", "2ghz", 0, LEDS_GPIO_DEFSTATE_OFF),
++ BCM47XX_GPIO_LED(4, "green", "bridge", 0, LEDS_GPIO_DEFSTATE_OFF),
++ BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"),
++};
++
++static const struct gpio_led
++bcm47xx_leds_luxul_xap_1500_v1[] __initconst = {
++ BCM47XX_GPIO_LED_TRIGGER(13, "green", "status", 1, "timer"),
++};
++
++static const struct gpio_led
++bcm47xx_leds_luxul_xbr_4400_v1[] __initconst = {
++ BCM47XX_GPIO_LED(12, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF),
++ BCM47XX_GPIO_LED_TRIGGER(15, "green", "status", 0, "timer"),
++};
++
++static const struct gpio_led
++bcm47xx_leds_luxul_xvw_p30_v1[] __initconst = {
++ BCM47XX_GPIO_LED_TRIGGER(0, "blue", "status", 1, "timer"),
++ BCM47XX_GPIO_LED(1, "green", "link", 1, LEDS_GPIO_DEFSTATE_OFF),
++};
++
++static const struct gpio_led
++bcm47xx_leds_luxul_xwr_600_v1[] __initconst = {
++ BCM47XX_GPIO_LED(3, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF),
++ BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"),
++ BCM47XX_GPIO_LED(9, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF),
++};
++
++static const struct gpio_led
+ bcm47xx_leds_luxul_xwr_1750_v1[] __initconst = {
+ BCM47XX_GPIO_LED(5, "green", "5ghz", 0, LEDS_GPIO_DEFSTATE_OFF),
+ BCM47XX_GPIO_LED(12, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF),
+@@ -633,6 +687,33 @@ void __init bcm47xx_leds_register(void)
+ bcm47xx_set_pdata(bcm47xx_leds_linksys_wrtsl54gs);
+ break;
+
++ case BCM47XX_BOARD_LUXUL_ABR_4400_V1:
++ bcm47xx_set_pdata(bcm47xx_leds_luxul_abr_4400_v1);
++ break;
++ case BCM47XX_BOARD_LUXUL_XAP_310_V1:
++ bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_310_v1);
++ break;
++ case BCM47XX_BOARD_LUXUL_XAP_1210_V1:
++ bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1210_v1);
++ break;
++ case BCM47XX_BOARD_LUXUL_XAP_1230_V1:
++ bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1230_v1);
++ break;
++ case BCM47XX_BOARD_LUXUL_XAP_1240_V1:
++ bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1240_v1);
++ break;
++ case BCM47XX_BOARD_LUXUL_XAP_1500_V1:
++ bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1500_v1);
++ break;
++ case BCM47XX_BOARD_LUXUL_XBR_4400_V1:
++ bcm47xx_set_pdata(bcm47xx_leds_luxul_xbr_4400_v1);
++ break;
++ case BCM47XX_BOARD_LUXUL_XVW_P30_V1:
++ bcm47xx_set_pdata(bcm47xx_leds_luxul_xvw_p30_v1);
++ break;
++ case BCM47XX_BOARD_LUXUL_XWR_600_V1:
++ bcm47xx_set_pdata(bcm47xx_leds_luxul_xwr_600_v1);
++ break;
+ case BCM47XX_BOARD_LUXUL_XWR_1750_V1:
+ bcm47xx_set_pdata(bcm47xx_leds_luxul_xwr_1750_v1);
+ break;
+--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
++++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
+@@ -80,6 +80,15 @@ enum bcm47xx_board {
+ BCM47XX_BOARD_LINKSYS_WRT610NV2,
+ BCM47XX_BOARD_LINKSYS_WRTSL54GS,
+
++ BCM47XX_BOARD_LUXUL_ABR_4400_V1,
++ BCM47XX_BOARD_LUXUL_XAP_310_V1,
++ BCM47XX_BOARD_LUXUL_XAP_1210_V1,
++ BCM47XX_BOARD_LUXUL_XAP_1230_V1,
++ BCM47XX_BOARD_LUXUL_XAP_1240_V1,
++ BCM47XX_BOARD_LUXUL_XAP_1500_V1,
++ BCM47XX_BOARD_LUXUL_XBR_4400_V1,
++ BCM47XX_BOARD_LUXUL_XVW_P30_V1,
++ BCM47XX_BOARD_LUXUL_XWR_600_V1,
+ BCM47XX_BOARD_LUXUL_XWR_1750_V1,
+
+ BCM47XX_BOARD_MICROSOFT_MN700,
{{BCM47XX_BOARD_LINKSYS_WRT54G3GV2, "Linksys WRT54G3GV2-VF"}, "WRT54G3GV2-VF", "1.0"},
{{BCM47XX_BOARD_LINKSYS_WRT610NV1, "Linksys WRT610N V1"}, "WRT610N", "1.0"},
{{BCM47XX_BOARD_LINKSYS_WRT610NV2, "Linksys WRT610N V2"}, "WRT610N", "2.0"},
-@@ -150,9 +151,12 @@ struct bcm47xx_board_type_list2 bcm47xx_
- static const
- struct bcm47xx_board_type_list1 bcm47xx_board_list_board_id[] __initconst = {
+@@ -159,9 +160,12 @@ struct bcm47xx_board_type_list1 bcm47xx_
+ {{BCM47XX_BOARD_LUXUL_XVW_P30_V1, "Luxul XVW-P30 V1"}, "luxul_xvwp30_v1"},
+ {{BCM47XX_BOARD_LUXUL_XWR_600_V1, "Luxul XWR-600 V1"}, "luxul_xwr600_v1"},
{{BCM47XX_BOARD_LUXUL_XWR_1750_V1, "Luxul XWR-1750 V1"}, "luxul_xwr1750_v1"},
+ {{BCM47XX_BOARD_NETGEAR_R6300_V1, "Netgear R6300 V1"}, "U12H218T00_NETGEAR"},
{{BCM47XX_BOARD_NETGEAR_WGR614V8, "Netgear WGR614 V8"}, "U12H072T00_NETGEAR"},
{{BCM47XX_BOARD_NETGEAR_WNDR3300, "Netgear WNDR3300"}, "U12H093T00_NETGEAR"},
{{BCM47XX_BOARD_NETGEAR_WNDR3400V1, "Netgear WNDR3400 V1"}, "U12H155T00_NETGEAR"},
{{BCM47XX_BOARD_NETGEAR_WNDR3400V2, "Netgear WNDR3400 V2"}, "U12H187T00_NETGEAR"},
-@@ -162,6 +166,7 @@ struct bcm47xx_board_type_list1 bcm47xx_
+@@ -171,6 +175,7 @@ struct bcm47xx_board_type_list1 bcm47xx_
{{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_buttons_linksys_wrt54g3gv2[] __initconst = {
BCM47XX_GPIO_KEY(5, KEY_WIMAX),
BCM47XX_GPIO_KEY(6, KEY_RESTART),
-@@ -333,6 +351,17 @@ bcm47xx_buttons_motorola_wr850gv2v3[] __
+@@ -378,6 +396,17 @@ bcm47xx_buttons_motorola_wr850gv2v3[] __
/* Netgear */
static const struct gpio_keys_button
bcm47xx_buttons_netgear_wndr3400v1[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_RESTART),
BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
-@@ -360,6 +389,11 @@ bcm47xx_buttons_netgear_wndr4500v1[] __i
+@@ -405,6 +434,11 @@ bcm47xx_buttons_netgear_wndr4500v1[] __i
};
static const struct gpio_keys_button
bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_RESTART),
BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
-@@ -413,6 +447,9 @@ int __init bcm47xx_buttons_register(void
+@@ -458,6 +492,9 @@ int __init bcm47xx_buttons_register(void
int err;
switch (board) {
case BCM47XX_BOARD_ASUS_RTN12:
err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn12);
break;
-@@ -543,6 +580,12 @@ int __init bcm47xx_buttons_register(void
+@@ -588,6 +625,12 @@ int __init bcm47xx_buttons_register(void
case BCM47XX_BOARD_LINKSYS_WRT310NV1:
err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1);
break;
case BCM47XX_BOARD_LINKSYS_WRT54G3GV2:
err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g3gv2);
break;
-@@ -579,6 +622,12 @@ int __init bcm47xx_buttons_register(void
+@@ -651,6 +694,12 @@ int __init bcm47xx_buttons_register(void
err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gv2v3);
break;
case BCM47XX_BOARD_NETGEAR_WNDR3400V1:
err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1);
break;
-@@ -591,6 +640,9 @@ int __init bcm47xx_buttons_register(void
+@@ -663,6 +712,9 @@ int __init bcm47xx_buttons_register(void
case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1);
break;
BCM47XX_BOARD_LINKSYS_WRT54G3GV2,
BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101,
BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467,
-@@ -88,9 +89,12 @@ enum bcm47xx_board {
+@@ -97,9 +98,12 @@ enum bcm47xx_board {
BCM47XX_BOARD_MOTOROLA_WR850GP,
BCM47XX_BOARD_MOTOROLA_WR850GV2V3,
BCM47XX_BOARD_NETGEAR_WNDR3300,
BCM47XX_BOARD_NETGEAR_WNDR3400V1,
BCM47XX_BOARD_NETGEAR_WNDR3400V2,
-@@ -100,6 +104,7 @@ enum bcm47xx_board {
+@@ -109,6 +113,7 @@ enum bcm47xx_board {
BCM47XX_BOARD_NETGEAR_WNDR4000,
BCM47XX_BOARD_NETGEAR_WNDR4500V1,
BCM47XX_BOARD_NETGEAR_WNDR4500V2,
bcm47xx_leds_linksys_wrt54g_generic[] __initconst = {
BCM47XX_GPIO_LED(0, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
-@@ -478,6 +493,9 @@ void __init bcm47xx_leds_register(void)
+@@ -532,6 +547,9 @@ void __init bcm47xx_leds_register(void)
enum bcm47xx_board board = bcm47xx_board_get();
switch (board) {
case BCM47XX_BOARD_ASUS_RTN12:
bcm47xx_set_pdata(bcm47xx_leds_asus_rtn12);
break;
-@@ -611,6 +629,9 @@ void __init bcm47xx_leds_register(void)
+@@ -665,6 +683,9 @@ void __init bcm47xx_leds_register(void)
case BCM47XX_BOARD_LINKSYS_WRT310NV1:
bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt310nv1);
break;