compat-wireless still needs updates to support the RF chip, which
claims it is a RF3053.

Signed-off-by: Christopher Lais <chris+open...@zenthought.org>
---
 target/linux/ramips/base-files/etc/diag.sh         |    2 +-
 .../etc/hotplug.d/firmware/10-rt2x00-eeprom        |    3 +
 .../ramips/base-files/etc/uci-defaults/01_leds     |    3 +
 .../ramips/base-files/etc/uci-defaults/02_network  |   12 ++
 .../ramips/base-files/lib/preinit/06_set_iface_mac |    4 +
 target/linux/ramips/base-files/lib/ramips.sh       |    3 +
 .../ramips/base-files/lib/upgrade/platform.sh      |    7 +
 .../arch/mips/include/asm/mach-ralink/machine.h    |    1 +
 .../ramips/files/arch/mips/ralink/rt3883/Kconfig   |    6 +
 .../ramips/files/arch/mips/ralink/rt3883/Makefile  |    1 +
 .../files/arch/mips/ralink/rt3883/mach-br-6475nd.c |  194 ++++++++++++++++++++
 target/linux/ramips/image/Makefile                 |   27 +++
 target/linux/ramips/rt3883/config-3.7              |    1 +
 target/linux/ramips/rt3883/profiles/edimax.mk      |   16 ++
 14 files changed, 279 insertions(+), 1 deletion(-)
 create mode 100644 
target/linux/ramips/files/arch/mips/ralink/rt3883/mach-br-6475nd.c
 create mode 100644 target/linux/ramips/rt3883/profiles/edimax.mk

diff --git a/target/linux/ramips/base-files/etc/diag.sh 
b/target/linux/ramips/base-files/etc/diag.sh
index 102ff27..6f12cec 100755
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -18,7 +18,7 @@ get_status_led() {
        br6524n)
                status_led="edimax:blue:power"
                ;;
-       br6425)
+       br6425 | br-6475nd)
                status_led="edimax:green:power"
                ;;
        dir-300-b1 | dir-600-b1 | dir-600-b2 | dir-615-h1 | dir-615-d | 
dir-620-a1)
diff --git 
a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom 
b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
index 43121e1..f58618b 100644
--- a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
+++ b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
@@ -110,6 +110,9 @@ case "$FIRMWARE" in
 
 "rt2x00pci_1_0.eeprom")
        case $board in
+       br-6475nd)
+               rt2x00_eeprom_extract "factory" 0 272
+               ;;
        rt-n56u)
                rt2x00_eeprom_extract "factory" 32768 272
                ;;
diff --git a/target/linux/ramips/base-files/etc/uci-defaults/01_leds 
b/target/linux/ramips/base-files/etc/uci-defaults/01_leds
index 104f201..59e3d4a 100755
--- a/target/linux/ramips/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ramips/base-files/etc/uci-defaults/01_leds
@@ -38,6 +38,9 @@ case $board in
        br6425)
                set_wifi_led "edimax:orange:wlan"
                ;;
+       br-6475nd)
+               set_wifi_led "edimax:amber:wlan"
+               ;;
        broadway)
                set_usb_led "red:diskmounted"
                set_wifi_led "red:wps_active"
diff --git a/target/linux/ramips/base-files/etc/uci-defaults/02_network 
b/target/linux/ramips/base-files/etc/uci-defaults/02_network
index 5fb52bb..117ba96 100755
--- a/target/linux/ramips/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ramips/base-files/etc/uci-defaults/02_network
@@ -61,6 +61,13 @@ ramips_setup_interfaces()
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
                ;;
 
+       br-6475nd)
+               ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+               ucidef_add_switch "switch0" "1" "1"
+               ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
+               ucidef_add_switch_vlan "switch0" "2" "0 9t"
+               ;;
+
        dir-645)
                ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
                ucidef_add_switch "switch0" "1" "1"
@@ -163,6 +170,11 @@ ramips_setup_macs()
                wan_mac=$(macaddr_add "$lan_mac" 1)
                ;;
 
+       br-6475nd)
+               lan_mac=$(mtd_get_mac_binary cimage 13)
+               wan_mac=$(mtd_get_mac_binary cimage 7)
+               ;;
+
        w306r-v20)
                lan_mac=$(mtd_get_mac_binary factory 4)
                wan_mac=$(macaddr_add "$lan_mac" 5)
diff --git a/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac 
b/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac
index fcfb86b..b1fa774 100644
--- a/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac
+++ b/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac
@@ -30,6 +30,10 @@ preinit_set_mac_address() {
                mac=$(macaddr_setbit_la "$mac")
                ifconfig eth0 hw ether $mac 2>/dev/null
                ;;
+       br-6475nd)
+               mac=$(mtd_get_mac_binary factory 13)
+               ifconfig eth0 hw ether $mac 2>/dev/null
+               ;;
        dir-300-b1 |\
        dir-300-b2 |\
        dir-600-b1)
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 0702145..36d4a95 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -93,6 +93,9 @@ ramips_board_detect() {
        *"ESR-9753")
                name="esr-9753"
                ;;
+       *"Edimax BR-6475nD")
+               name="br-6475nd"
+               ;;
        *"F5D8235 v1")
                name="f5d8235-v1"
                ;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 1b358c1..05601ca 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -73,6 +73,13 @@ platform_check_image() {
                }
                return 0
                ;;
+       br-6475nd)
+               [ "$magic" != "43535953" ] && {
+                       echo "Invalid image type."
+                       return 1
+               }
+               return 0
+               ;;
        esac
 
        echo "Sysupgrade is not yet supported on $board."
diff --git 
a/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h 
b/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h
index b3903fc..ee1055c 100644
--- a/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h
+++ b/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h
@@ -79,6 +79,7 @@ enum ramips_mach_type {
        RAMIPS_MACH_RT_N56U,            /* Asus RT-N56U */
 
        /* RT3883 based machines */
+       RAMIPS_MACH_BR_6475ND,          /* Edimax BR-6475nD */
        RAMIPS_MACH_TEW_691GR,          /* TRENDnet TEW-691GR */
        RAMIPS_MACH_TEW_692GR,          /* TRENDnet TEW-692GR */
 
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt3883/Kconfig 
b/target/linux/ramips/files/arch/mips/ralink/rt3883/Kconfig
index 57823f0..a1969e3 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt3883/Kconfig
+++ b/target/linux/ramips/files/arch/mips/ralink/rt3883/Kconfig
@@ -18,6 +18,12 @@ config RT3883_MACH_OMNI_EMB_HPM
        select RALINK_DEV_GPIO_BUTTONS
        select RALINK_DEV_GPIO_LEDS
 
+config RT3883_MACH_BR_6475ND
+       bool "Edimax BR-6475nD support"
+       select HW_HAS_PCI
+       select RALINK_DEV_GPIO_BUTTONS
+       select RALINK_DEV_GPIO_LEDS
+
 config RT3883_MACH_TEW_691GR
        bool "TRENDnet TEW-691GR support"
        select RALINK_DEV_GPIO_BUTTONS
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt3883/Makefile 
b/target/linux/ramips/files/arch/mips/ralink/rt3883/Makefile
index e1ab61e..4631b7c 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt3883/Makefile
+++ b/target/linux/ramips/files/arch/mips/ralink/rt3883/Makefile
@@ -16,3 +16,4 @@ obj-$(CONFIG_RT3883_MACH_OMNI_EMB_HPM)        += 
mach-omni-emb-hpm.o
 obj-$(CONFIG_RT3883_MACH_RT_N56U)      += mach-rt-n56u.o
 obj-$(CONFIG_RT3883_MACH_TEW_691GR)    += mach-tew-691gr.o
 obj-$(CONFIG_RT3883_MACH_TEW_692GR)    += mach-tew-692gr.o
+obj-$(CONFIG_RT3883_MACH_BR_6475ND)    += mach-br-6475nd.o
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt3883/mach-br-6475nd.c 
b/target/linux/ramips/files/arch/mips/ralink/rt3883/mach-br-6475nd.c
new file mode 100644
index 0000000..8338b36
--- /dev/null
+++ b/target/linux/ramips/files/arch/mips/ralink/rt3883/mach-br-6475nd.c
@@ -0,0 +1,194 @@
+/*
+ * Edimax BR-6475nD board support
+ *
+ * Copyright (C) 2012 Gabor Juhos <juh...@openwrt.org>
+ * Copyright (C) 2013 Christopher Lais <chris+open...@zenthought.org>
+ *   BR-6475nD
+ *
+ * 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 <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/rtl8367.h>
+#include <linux/ethtool.h>
+#include <linux/pci.h>
+#include <linux/phy.h>
+#include <linux/rt2x00_platform.h>
+#include <linux/spi/spi.h>
+#include <linux/gpio.h>
+
+#include <asm/mach-ralink/machine.h>
+#include <asm/mach-ralink/dev-gpio-buttons.h>
+#include <asm/mach-ralink/dev-gpio-leds.h>
+#include <asm/mach-ralink/rt3883.h>
+#include <asm/mach-ralink/rt3883_regs.h>
+#include <asm/mach-ralink/ramips_eth_platform.h>
+
+#include "devices.h"
+
+#define BR_6475ND_GPIO_LED_WPS         0  /* not populated */
+#define BR_6475ND_GPIO_LED_POWER       10
+#define BR_6475ND_GPIO_LED_WLAN                18
+#define BR_6475ND_GPIO_LED_WLAN_A      14 /* not populated */
+#define BR_6475ND_GPIO_LED_WLAN_G      11
+#define BR_6475ND_GPIO_LED_USB_0       12 /* not populated */
+#define BR_6475ND_GPIO_LED_USB_1       13 /* not populated */
+
+#define BR_6475ND_GPIO_BUTTON_RESET    7  /* marked "WPS/Reset" */
+
+#define BR_6475ND_GPIO_BUTTON_WPS      26 /* not populated */
+#define BR_6475ND_GPIO_BUTTON_DEFAULT  27 /* not populated */
+#define BR_6475ND_GPIO_BUTTON_USB_RESET        19 /* power? */
+
+#define BR_6475ND_GPIO_SWITCH_RFKILL   9
+
+#define BR_6475ND_KEYS_POLL_INTERVAL   20
+#define BR_6475ND_KEYS_DEBOUNCE_INTERVAL (3 * BR_6475ND_KEYS_POLL_INTERVAL)
+
+#define BR_6475ND_GPIO_RTL8367_SCK     4
+#define BR_6475ND_GPIO_RTL8367_SDA     5
+
+static struct gpio_led br_6475nd_leds_gpio[] __initdata = {
+       {
+               .name           = "edimax:green:power",
+               .gpio           = BR_6475ND_GPIO_LED_POWER,
+               .active_low     = 1,
+       },
+       {
+               .name           = "edimax:amber:wlan",
+               .gpio           = BR_6475ND_GPIO_LED_WLAN_G,
+               .active_low     = 1,
+       },
+       {
+               .name           = "edimax:amber:wlan_5ghz",
+               .gpio           = BR_6475ND_GPIO_LED_WLAN_A,
+               .active_low     = 1,
+       },
+#if 0
+       /* The headers for these exist, but are not populated */
+       {
+               .name           = "edimax:none:wps",
+               .gpio           = BR_6475ND_GPIO_LED_WPS,
+               .active_low     = 1,
+       },
+       {
+               .name           = "edimax:none:wlan",
+               .gpio           = BR_6475ND_GPIO_LED_WLAN_A,
+               .active_low     = 1,
+       },
+       {
+               .name           = "edimax:none:usb0",
+               .gpio           = BR_6475ND_GPIO_LED_USB_0,
+               .active_low     = 1,
+       },
+       {
+               .name           = "edimax:none:usb1",
+               .gpio           = BR_6475ND_GPIO_LED_USB_1,
+               .active_low     = 1,
+       },
+#endif
+};
+
+static struct gpio_keys_button br_6475nd_gpio_buttons[] __initdata = {
+       {
+               .desc           = "WPS/Reset button",
+               .type           = EV_KEY,
+               .code           = KEY_RESTART,
+               .debounce_interval = BR_6475ND_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = BR_6475ND_GPIO_BUTTON_RESET,
+               .active_low     = 1,
+       },
+       {
+               .desc           = "RFKILL switch",
+               .type           = EV_SW,
+               .code           = KEY_RFKILL,
+               .debounce_interval = BR_6475ND_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = BR_6475ND_GPIO_SWITCH_RFKILL,
+               .active_low     = 1,
+       },
+};
+
+static struct rtl8367_extif_config br_6475nd_rtl8367_extif0_cfg = {
+       .txdelay = 1,
+       .rxdelay = 0,
+       .mode = RTL8367_EXTIF_MODE_RGMII,
+       .ability = {
+               .force_mode = 1,
+               .txpause = 1,
+               .rxpause = 1,
+               .link = 1,
+               .duplex = 1,
+               .speed = RTL8367_PORT_SPEED_1000,
+       },
+};
+
+static struct rtl8367_platform_data br_6475nd_rtl8367_data = {
+       .gpio_sda       = BR_6475ND_GPIO_RTL8367_SDA,
+       .gpio_sck       = BR_6475ND_GPIO_RTL8367_SCK,
+       .extif0_cfg     = &br_6475nd_rtl8367_extif0_cfg,
+};
+
+static struct platform_device br_6475nd_rtl8367_device = {
+       .name           = RTL8367_DRIVER_NAME,
+       .id             = -1,
+       .dev            = {
+               .platform_data  = &br_6475nd_rtl8367_data,
+       },
+};
+
+static struct rt2x00_platform_data br_6475nd_pci_wlan_data = {
+       .eeprom_file_name       = "rt2x00pci_1_0.eeprom",
+};
+
+static int br_6475nd_pci_plat_dev_init(struct pci_dev *dev)
+{
+       if (dev->bus->number == 1 && PCI_SLOT(dev->devfn) == 0)
+               dev->dev.platform_data = &br_6475nd_pci_wlan_data;
+
+       return 0;
+}
+
+static void __init br_6475nd_init(void)
+{
+       rt3883_gpio_init(RT3883_GPIO_MODE_SPI |
+                        RT3883_GPIO_MODE_UART0(RT3883_GPIO_MODE_GPIO) |
+                        RT3883_GPIO_MODE_JTAG |
+                        RT3883_GPIO_MODE_PCI(RT3883_GPIO_MODE_PCI_FNC));
+
+       rt3883_register_pflash(0);
+
+       ramips_register_gpio_leds(-1, ARRAY_SIZE(br_6475nd_leds_gpio),
+                                 br_6475nd_leds_gpio);
+
+       ramips_register_gpio_buttons(-1, BR_6475ND_KEYS_POLL_INTERVAL,
+                                    ARRAY_SIZE(br_6475nd_gpio_buttons),
+                                    br_6475nd_gpio_buttons);
+
+       platform_device_register(&br_6475nd_rtl8367_device);
+
+       rt3883_register_wlan();
+
+       rt3883_eth_data.speed = SPEED_1000;
+       rt3883_eth_data.duplex = DUPLEX_FULL;
+       rt3883_eth_data.tx_fc = 1;
+       rt3883_eth_data.rx_fc = 1;
+       rt3883_register_ethernet();
+
+       rt3883_register_wdt(false);
+
+#if 0
+       /* The BR-6475nD has 7 headers for ports, but does not ship with
+          the headers and related components populated */
+       /* It may also be neccesary to provide power via a GPIO */
+       rt3883_register_usbhost();
+#endif
+
+       rt3883_pci_set_plat_dev_init(br_6475nd_pci_plat_dev_init);
+       rt3883_pci_init(RT3883_PCI_MODE_PCIE);
+}
+
+MIPS_MACHINE(RAMIPS_MACH_BR_6475ND, "BR-6475ND", "Edimax BR-6475nD",
+             br_6475nd_init);
diff --git a/target/linux/ramips/image/Makefile 
b/target/linux/ramips/image/Makefile
index 67a6f60..4e7dd37 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -257,11 +257,33 @@ define BuildFirmware/Edimax
        fi
 endef
 
+define BuildFirmware/EdimaxCombined
+       $(call PatchKernelLzma,$(2),$(3))
+       if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt `expr $(4) - 84` 
]; then \
+               echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big" >&2; \
+       else if [ `stat -c%s "$(KDIR)/root.$(1)"` -gt $(5) ]; then \
+               echo "Warning: $(KDIR)/root.$(1) is too big" >&2; \
+       else \
+               ( dd if=$(KDIR)/vmlinux-$(2).bin.lzma bs=`expr $(4) - 84` 
conv=sync ; dd if=$(KDIR)/root.$(1) ) > $(KDIR)/vmlinux-$(2).bin.lzma.combined 
; \
+       fi ; fi
+       $(call 
MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma.combined,$(KDIR)/vmlinux-$(2).bin.lzma.combined.uImage)
+       -mkedimaximg -i "$(KDIR)/vmlinux-$(2).bin.lzma.combined.uImage" \
+               -o $(call imgname,$(1),$(6)).bin \
+               -s $(7) -m $(8) -f $(9) -S $(10)
+endef
+
 define BuildFirmware/BR6524N
        $(call BuildFirmware/Generic,$(1),$(2),$(call mkcmdline,$(3),$(4),$(5)) 
$(call mkmtd/$(6),$(mtdlayout_4M)),917484,2949120)
        $(call BuildFirmware/Edimax,$(1),br6524n,CSYS,WNRA,0x50000,0xc00000)
 endef
 
+mtdlayout_BR6475ND:=192k(u-boot)ro,64k(nvram)ro,64k(factory)ro,128k(cimage)ro,1024k(kernel),6720k(rootfs),7744k@0x70000(uimage)ro
+kernel_size_BR6475ND:=1048576
+rootfs_size_BR6475ND:=6881280
+define BuildFirmware/BR6475ND
+       $(call BuildFirmware/EdimaxCombined,$(1),$(2),$(call 
mkcmdline,$(3),$(4),$(5)) $(call 
mkmtd/$(6),$(mtdlayout_BR6475ND)),$(kernel_size_BR6475ND),$(rootfs_size_BR6475ND),br-6475nd,CSYS,RN54,0x70000,0x790000)
+endef
+
 
mtdlayout_f5d8235=320k(u-boot)ro,1536k(kernel),6208k(rootfs),64k(nvram),64k(factory),7744k@0x50000(firmware)
 mtd_f5d8235_kernel_part_size=1572864
 mtd_f5d8235_rootfs_part_size=6356992
@@ -715,11 +737,16 @@ define Image/Build/Profile/TEW692GR
        $(call 
Image/Build/Template/$(fs_squash)/$(1),UMedia,tew-692gr,TEW-692GR,0x026920)
 endef
 
+define Image/Build/Profile/BR6475ND
+       $(call 
Image/Build/Template/$(fs_squash)/$(1),BR6475ND,br-6475nd,BR-6475ND,ttyS1,57600n8,phys)
+endef
+
 ifeq ($(CONFIG_RALINK_RT3883),y)
 define Image/Build/Profile/Default
        $(call Image/Build/Profile/DIR645,$(1))
        $(call Image/Build/Profile/OMNIEMBHPM,$(1))
        $(call Image/Build/Profile/RTN56U,$(1))
+       $(call Image/Build/Profile/BR6475ND,$(1))
        $(call Image/Build/Profile/TEW691GR,$(1))
        $(call Image/Build/Profile/TEW692GR,$(1))
 endef
diff --git a/target/linux/ramips/rt3883/config-3.7 
b/target/linux/ramips/rt3883/config-3.7
index 8076397..d370cc2 100644
--- a/target/linux/ramips/rt3883/config-3.7
+++ b/target/linux/ramips/rt3883/config-3.7
@@ -109,6 +109,7 @@ CONFIG_RALINK_DEV_GPIO_LEDS=y
 # CONFIG_RALINK_RT305X is not set
 CONFIG_RALINK_RT3883=y
 CONFIG_RAMIPS_WDT=y
+CONFIG_RT3883_MACH_BR_6475ND=y
 CONFIG_RT3883_MACH_DIR_645=y
 CONFIG_RT3883_MACH_OMNI_EMB_HPM=y
 CONFIG_RT3883_MACH_RT_N56U=y
diff --git a/target/linux/ramips/rt3883/profiles/edimax.mk 
b/target/linux/ramips/rt3883/profiles/edimax.mk
new file mode 100644
index 0000000..b807c2c
--- /dev/null
+++ b/target/linux/ramips/rt3883/profiles/edimax.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/BR6475ND
+       NAME:=Edimax BR-6475nD
+       PACKAGES:=swconfig
+endef
+
+define Profile/BR6475ND/Description
+       Package set compatible with the Edimax BR-6475nD board.
+endef
+$(eval $(call Profile,BR6475ND))
-- 
1.7.10.4

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to