Skip to content
Permalink
Browse files

ramips: add support for I-O DATA WNPR2600G

  • Loading branch information...
musashino205 committed Jan 21, 2019
1 parent 399aa0b commit 5ef0c5eaa5b06cb5107b90404d96c560ada5a8c1
@@ -260,7 +260,8 @@ ramips_setup_interfaces()
elecom,wrc-1900gst|\
hg255d|\
iodata,wn-ax1167gr|\
iodata,wn-gx300gr)
iodata,wn-gx300gr|\
iodata,wnpr2600g)
ucidef_add_switch "switch0" \
"1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0"
;;
@@ -569,6 +570,9 @@ ramips_setup_macs()
iodata,wn-gx300gr)
wan_mac=$(macaddr_add "$(mtd_get_mac_binary Factory 4)" 1)
;;
iodata,wnpr2600g)
wan_mac=$(macaddr_add "$(mtd_get_mac_binary Factory 4)" -1)
;;
kn_rc|\
kn_rf|\
kng_rc)
@@ -0,0 +1,155 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;

#include "mt7621.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
compatible = "iodata,wnpr2600g", "mediatek,mt7621-soc";
model = "I-O DATA WNPR2600G";

aliases {
led-boot = &led_power;
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
};

memory@0 {
device_type = "memory";
reg = <0x0 0x8000000>;
};

chosen {
bootargs = "console=ttyS0,57600";
};

leds {
compatible = "gpio-leds";

led_power: power {
label = "wnpr2600g:green:power";
gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
default-state = "on";
};

notification {
label = "wnpr2600g:green:notification";
gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
};

wlan2g {
label = "wnpr2600g:green:wlan2g";
gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
};

wlan5g {
label = "wnpr2600g:green:wlan5g";
gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
};
};

keys {
compatible = "gpio-keys-polled";
poll-interval = <20>;

auto {
label = "auto";
gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
linux,code = <BTN_0>;
linux,input-type = <EV_SW>;
};

reset {
label = "reset";
gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};

wps {
label = "wps";
gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
};
};
};

&spi0 {
status = "okay";

flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <10000000>;

partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

partition@0 {
label = "u-boot";
reg = <0x000000 0x030000>;
read-only;
};

partition@30000 {
label = "u-boot-env";
reg = <0x030000 0x010000>;
read-only;
};

Factory: partition@40000 {
label = "Factory";
reg = <0x040000 0x010000>;
read-only;
};

partition@50000 {
compatible = "denx,uimage";
label = "firmware";
reg = <0x050000 0xda0000>;
};

partition@df0000 {
label = "manufacture";
reg = <0xdf0000 0x190000>;
read-only;
};

partition@f80000 {
label = "storage";
reg = <0xf80000 0x080000>;
read-only;
};
};
};
};

&ethernet {
mtd-mac-address = <&Factory 0x4>;
mediatek,portmap = "wllll";
};

&pinctrl {
state_default: pinctrl0 {
gpio {
ralink,group = "uart2", "uart3", "jtag", "wdt";
ralink,function = "gpio";
};
};
};

&pcie {
status = "okay";
/*
* WNPR2600G has MT7615 chips for 2.4/5 GHz wifi,
* but it's not supported in OpenWrt.
*/
};

&xhci {
status = "disabled";
};
@@ -87,6 +87,25 @@ define Build/relocate-kernel
rm -rf $@.relocate
endef

define Build/elx-header
$(eval hw_id=$(word 1,$(1)))
$(eval xor_pattern=$(word 2,$(1)))
( \
echo -ne "\x00\x00\x00\x00\x00\x00\x00\x03" | \
dd bs=42 count=1 conv=sync; \
hw_id="$(hw_id)"; \
echo -ne "\x$${hw_id:0:2}\x$${hw_id:2:2}\x$${hw_id:4:2}\x$${hw_id:6:2}" | \
dd bs=20 count=1 conv=sync; \
echo -ne "$$(printf '%08x' $$(stat -c%s $@) | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \
dd bs=8 count=1 conv=sync; \
echo -ne "$$($(STAGING_DIR_HOST)/bin/mkhash md5 $@ | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \
dd bs=58 count=1 conv=sync; \
) > $(KDIR)/tmp/$(DEVICE_NAME).header
$(call Build/xor-image,-p $(xor_pattern) -x)
cat $(KDIR)/tmp/$(DEVICE_NAME).header $@ > $@.new
mv $@.new $@
endef

define Build/umedia-header
fix-u-media-header -T 0x46 -B $(1) -i $@ -o $@.new && mv $@.new $@
endef
@@ -228,6 +228,17 @@ define Device/iodata_wn-gx300gr
endef
TARGET_DEVICES += iodata_wn-gx300gr

define Device/iodata_wnpr2600g
DTS := WNPR2600G
DEVICE_TITLE := I-O DATA WNPR2600G
IMAGE_SIZE := 13952k
IMAGES += factory.bin
IMAGE/factory.bin := \
$$(sysupgrade_bin) | check-size $$$$(IMAGE_SIZE) | \
elx-header 0104003a 8844A2D168B45A2D
endef
TARGET_DEVICES += iodata_wnpr2600g

define Device/k2p
DTS := K2P
IMAGE_SIZE := $(ralink_default_fw_size_16M)

0 comments on commit 5ef0c5e

Please sign in to comment.
You can’t perform that action at this time.