Last active
March 17, 2016 19:34
-
-
Save pqlaz/556c81971cbc27409fc0 to your computer and use it in GitHub Desktop.
Support for router D-Link DIR-320 h/w A (OpenWrt DD trunk)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/target/linux/brcm47xx/base-files/etc/board.d/01_detect b/target/linux/brcm47xx/base-files/etc/board.d/01_detect | |
index 91ac16e..ad75ba9 100755 | |
--- a/target/linux/brcm47xx/base-files/etc/board.d/01_detect | |
+++ b/target/linux/brcm47xx/base-files/etc/board.d/01_detect | |
@@ -152,7 +152,8 @@ detect_by_model() { | |
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0" | |
;; | |
- "Asus WL700") | |
+ "Asus WL700" | \ | |
+ "D-Link DIR-320 A1/A2") | |
ucidef_add_switch "switch0" \ | |
"0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "5@eth0" | |
;; | |
diff --git a/target/linux/brcm47xx/image/Makefile b/target/linux/brcm47xx/image/Makefile | |
index a65e9e0..c16e6ae 100644 | |
--- a/target/linux/brcm47xx/image/Makefile | |
+++ b/target/linux/brcm47xx/image/Makefile | |
@@ -230,6 +230,9 @@ endif | |
# Subtarget legacy | |
################################################# | |
+define Device/dlink-dir-320-ax | |
+endef | |
+ | |
define Device/dlink-dwl-3150 | |
IMAGES := bin | |
IMAGE/bin := trx-with-loader | tailed-bin | |
@@ -284,6 +287,7 @@ endef | |
ifeq ($(SUBTARGET),legacy) | |
TARGET_DEVICES += \ | |
+ dlink-dir-320-ax \ | |
dlink-dwl-3150 \ | |
edimax-ps1208-mfg \ | |
huawei-e970 \ | |
diff --git a/target/linux/brcm47xx/legacy/profiles/DIR320Ax.mk b/target/linux/brcm47xx/legacy/profiles/DIR320Ax.mk | |
new file mode 100644 | |
index 0000000..5e08052 | |
--- /dev/null | |
+++ b/target/linux/brcm47xx/legacy/profiles/DIR320Ax.mk | |
@@ -0,0 +1,17 @@ | |
+# | |
+# Copyright (C) 2016 OpenWrt.org | |
+# | |
+# This is free software, licensed under the GNU General Public License v2. | |
+# See /LICENSE for more information. | |
+# | |
+ | |
+define Profile/DIR320Ax | |
+ NAME:=D-Link DIR-320 Ax | |
+ PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-b43 | |
+endef | |
+ | |
+define Profile/DIR320Ax/Description | |
+ Package set compatible with the D-Link DIR-320 Ax. Contains USB support | |
+endef | |
+$(eval $(call Profile,DIR320Ax)) | |
+ | |
diff --git a/target/linux/brcm47xx/patches-4.1/321-MIPS-BCM47XX-Devices-add-dlink-dir320-for-4.x.patch b/target/linux/brcm47xx/patches-4.1/321-MIPS-BCM47XX-Devices-add-dlink-dir320-for-4.x.patch | |
new file mode 100644 | |
index 0000000..92e5a8a | |
--- /dev/null | |
+++ b/target/linux/brcm47xx/patches-4.1/321-MIPS-BCM47XX-Devices-add-dlink-dir320-for-4.x.patch | |
@@ -0,0 +1,81 @@ | |
+Index: linux-4.1.16/arch/mips/bcm47xx/board.c | |
+=================================================================== | |
+--- linux-4.1.16.orig/arch/mips/bcm47xx/board.c | |
++++ linux-4.1.16/arch/mips/bcm47xx/board.c | |
+@@ -186,6 +186,7 @@ struct bcm47xx_board_type_list3 bcm47xx_ | |
+ {{BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101, "Linksys WRT54G/GS/GL"}, "0x0101", "42", "0x10"}, | |
+ {{BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467, "Linksys WRT54G/GS/GL"}, "0x0467", "42", "0x10"}, | |
+ {{BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0708, "Linksys WRT54G/GS/GL"}, "0x0708", "42", "0x10"}, | |
++ {{BCM47XX_BOARD_DLINK_DIR320, "D-Link DIR-320 A1/A2"}, "0x048e", "", "0x35"}, | |
+ { {0}, NULL}, | |
+ }; | |
+ | |
+Index: linux-4.1.16/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | |
+=================================================================== | |
+--- linux-4.1.16.orig/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | |
++++ linux-4.1.16/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | |
+@@ -50,6 +50,7 @@ enum bcm47xx_board { | |
+ BCM47XX_BOARD_DELL_TM2300, | |
+ | |
+ BCM47XX_BOARD_DLINK_DIR130, | |
++ BCM47XX_BOARD_DLINK_DIR320, | |
+ BCM47XX_BOARD_DLINK_DIR330, | |
+ | |
+ BCM47XX_BOARD_HUAWEI_E970, | |
+Index: linux-4.1.16/arch/mips/bcm47xx/leds.c | |
+=================================================================== | |
+--- linux-4.1.16.orig/arch/mips/bcm47xx/leds.c | |
++++ linux-4.1.16/arch/mips/bcm47xx/leds.c | |
+@@ -213,6 +213,15 @@ bcm47xx_leds_dlink_dir130[] __initconst | |
+ }; | |
+ | |
+ static const struct gpio_led | |
++bcm47xx_leds_dlink_dir320[] __initconst = { | |
++ BCM47XX_GPIO_LED(0, "green", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF), | |
++ BCM47XX_GPIO_LED_TRIGGER(1, "green", "status", 0, "timer"), /* Originally blinking when device is ready, separated from "power" LED */ | |
++ BCM47XX_GPIO_LED(3, "red", "wps-red", 1, LEDS_GPIO_DEFSTATE_OFF), | |
++ BCM47XX_GPIO_LED(4, "blue", "wps-blue", 1, LEDS_GPIO_DEFSTATE_OFF), | |
++ BCM47XX_GPIO_LED(5, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF), | |
++}; | |
++ | |
++static const struct gpio_led | |
+ bcm47xx_leds_dlink_dir330[] __initconst = { | |
+ BCM47XX_GPIO_LED_TRIGGER(0, "green", "status", 1, "timer"), /* Originally blinking when device is ready, separated from "power" LED */ | |
+ BCM47XX_GPIO_LED(4, "unk", "usb", 1, LEDS_GPIO_DEFSTATE_OFF), | |
+@@ -582,6 +591,9 @@ void __init bcm47xx_leds_register(void) | |
+ case BCM47XX_BOARD_DLINK_DIR130: | |
+ bcm47xx_set_pdata(bcm47xx_leds_dlink_dir130); | |
+ break; | |
++ case BCM47XX_BOARD_DLINK_DIR320: | |
++ bcm47xx_set_pdata(bcm47xx_leds_dlink_dir320); | |
++ break; | |
+ case BCM47XX_BOARD_DLINK_DIR330: | |
+ bcm47xx_set_pdata(bcm47xx_leds_dlink_dir330); | |
+ break; | |
+Index: linux-4.1.16/arch/mips/bcm47xx/buttons.c | |
+=================================================================== | |
+--- linux-4.1.16.orig/arch/mips/bcm47xx/buttons.c | |
++++ linux-4.1.16/arch/mips/bcm47xx/buttons.c | |
+@@ -190,6 +190,12 @@ bcm47xx_buttons_dlink_dir130[] __initcon | |
+ }; | |
+ | |
+ static const struct gpio_keys_button | |
++bcm47xx_buttons_dlink_dir320[] __initconst = { | |
++ BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON), | |
++ BCM47XX_GPIO_KEY(7, KEY_RESTART), | |
++}; | |
++ | |
++static const struct gpio_keys_button | |
+ bcm47xx_buttons_dlink_dir330[] __initconst = { | |
+ BCM47XX_GPIO_KEY(3, KEY_RESTART), | |
+ BCM47XX_GPIO_KEY(7, KEY_UNKNOWN), | |
+@@ -533,6 +539,9 @@ int __init bcm47xx_buttons_register(void | |
+ case BCM47XX_BOARD_DLINK_DIR130: | |
+ err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir130); | |
+ break; | |
++ case BCM47XX_BOARD_DLINK_DIR320: | |
++ err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir320); | |
++ break; | |
+ case BCM47XX_BOARD_DLINK_DIR330: | |
+ err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir330); | |
+ break; | |
diff --git a/target/linux/brcm47xx/patches-4.4/321-MIPS-BCM47XX-Devices-add-dlink-dir320-for-4.x.patch b/target/linux/brcm47xx/patches-4.4/321-MIPS-BCM47XX-Devices-add-dlink-dir320-for-4.x.patch | |
new file mode 100644 | |
index 0000000..92e5a8a | |
--- /dev/null | |
+++ b/target/linux/brcm47xx/patches-4.4/321-MIPS-BCM47XX-Devices-add-dlink-dir320-for-4.x.patch | |
@@ -0,0 +1,81 @@ | |
+Index: linux-4.1.16/arch/mips/bcm47xx/board.c | |
+=================================================================== | |
+--- linux-4.1.16.orig/arch/mips/bcm47xx/board.c | |
++++ linux-4.1.16/arch/mips/bcm47xx/board.c | |
+@@ -186,6 +186,7 @@ struct bcm47xx_board_type_list3 bcm47xx_ | |
+ {{BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101, "Linksys WRT54G/GS/GL"}, "0x0101", "42", "0x10"}, | |
+ {{BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467, "Linksys WRT54G/GS/GL"}, "0x0467", "42", "0x10"}, | |
+ {{BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0708, "Linksys WRT54G/GS/GL"}, "0x0708", "42", "0x10"}, | |
++ {{BCM47XX_BOARD_DLINK_DIR320, "D-Link DIR-320 A1/A2"}, "0x048e", "", "0x35"}, | |
+ { {0}, NULL}, | |
+ }; | |
+ | |
+Index: linux-4.1.16/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | |
+=================================================================== | |
+--- linux-4.1.16.orig/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | |
++++ linux-4.1.16/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | |
+@@ -50,6 +50,7 @@ enum bcm47xx_board { | |
+ BCM47XX_BOARD_DELL_TM2300, | |
+ | |
+ BCM47XX_BOARD_DLINK_DIR130, | |
++ BCM47XX_BOARD_DLINK_DIR320, | |
+ BCM47XX_BOARD_DLINK_DIR330, | |
+ | |
+ BCM47XX_BOARD_HUAWEI_E970, | |
+Index: linux-4.1.16/arch/mips/bcm47xx/leds.c | |
+=================================================================== | |
+--- linux-4.1.16.orig/arch/mips/bcm47xx/leds.c | |
++++ linux-4.1.16/arch/mips/bcm47xx/leds.c | |
+@@ -213,6 +213,15 @@ bcm47xx_leds_dlink_dir130[] __initconst | |
+ }; | |
+ | |
+ static const struct gpio_led | |
++bcm47xx_leds_dlink_dir320[] __initconst = { | |
++ BCM47XX_GPIO_LED(0, "green", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF), | |
++ BCM47XX_GPIO_LED_TRIGGER(1, "green", "status", 0, "timer"), /* Originally blinking when device is ready, separated from "power" LED */ | |
++ BCM47XX_GPIO_LED(3, "red", "wps-red", 1, LEDS_GPIO_DEFSTATE_OFF), | |
++ BCM47XX_GPIO_LED(4, "blue", "wps-blue", 1, LEDS_GPIO_DEFSTATE_OFF), | |
++ BCM47XX_GPIO_LED(5, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF), | |
++}; | |
++ | |
++static const struct gpio_led | |
+ bcm47xx_leds_dlink_dir330[] __initconst = { | |
+ BCM47XX_GPIO_LED_TRIGGER(0, "green", "status", 1, "timer"), /* Originally blinking when device is ready, separated from "power" LED */ | |
+ BCM47XX_GPIO_LED(4, "unk", "usb", 1, LEDS_GPIO_DEFSTATE_OFF), | |
+@@ -582,6 +591,9 @@ void __init bcm47xx_leds_register(void) | |
+ case BCM47XX_BOARD_DLINK_DIR130: | |
+ bcm47xx_set_pdata(bcm47xx_leds_dlink_dir130); | |
+ break; | |
++ case BCM47XX_BOARD_DLINK_DIR320: | |
++ bcm47xx_set_pdata(bcm47xx_leds_dlink_dir320); | |
++ break; | |
+ case BCM47XX_BOARD_DLINK_DIR330: | |
+ bcm47xx_set_pdata(bcm47xx_leds_dlink_dir330); | |
+ break; | |
+Index: linux-4.1.16/arch/mips/bcm47xx/buttons.c | |
+=================================================================== | |
+--- linux-4.1.16.orig/arch/mips/bcm47xx/buttons.c | |
++++ linux-4.1.16/arch/mips/bcm47xx/buttons.c | |
+@@ -190,6 +190,12 @@ bcm47xx_buttons_dlink_dir130[] __initcon | |
+ }; | |
+ | |
+ static const struct gpio_keys_button | |
++bcm47xx_buttons_dlink_dir320[] __initconst = { | |
++ BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON), | |
++ BCM47XX_GPIO_KEY(7, KEY_RESTART), | |
++}; | |
++ | |
++static const struct gpio_keys_button | |
+ bcm47xx_buttons_dlink_dir330[] __initconst = { | |
+ BCM47XX_GPIO_KEY(3, KEY_RESTART), | |
+ BCM47XX_GPIO_KEY(7, KEY_UNKNOWN), | |
+@@ -533,6 +539,9 @@ int __init bcm47xx_buttons_register(void | |
+ case BCM47XX_BOARD_DLINK_DIR130: | |
+ err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir130); | |
+ break; | |
++ case BCM47XX_BOARD_DLINK_DIR320: | |
++ err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir320); | |
++ break; | |
+ case BCM47XX_BOARD_DLINK_DIR330: | |
+ err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir330); | |
+ break; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment