[openwrt/openwrt] ramips: add support for OrayBox X1

LEDE Commits lede-commits at lists.infradead.org
Sun Apr 2 10:26:17 PDT 2023


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/6b66666da46dd50d4bd2cb1b94fd35ec7f10e54c

commit 6b66666da46dd50d4bd2cb1b94fd35ec7f10e54c
Author: Bin We <me at udp.pw>
AuthorDate: Fri Sep 23 01:04:01 2022 +0800

    ramips: add support for OrayBox X1
    
    Add support for OrayBox X1. It is a 802.11n router, based on MediaTek MT7628N.
    
    Specifications:
    SoC: MediaTek MT7628N (580MHz)
    RAM: 64 MiB
    Flash: 16 MiB NOR (Winbond W25Q128JVSIQ)
    Wireless: 802.11b/g/n 2x2 2.4GHz (Built In)
    Ethernet: 1x 100Mbps only
    USB: 1x USB Type-A 2.0 Host Port
    Button: 1x "Reset" button
    LED: 1x Blue LED + 1x Red LED + 1x White LED
    Power: 5V Micro-USB input
    
    Manufacturer Page:
    https://pgy.oray.com/router/x1.html/parameter
    
    Flash Layout:
    0x000000000000-0x000000030000 : "u-boot"
    0x000000030000-0x000000040000 : "kpanic"
    0x000000040000-0x000000050000 : "factory"
    0x000000050000-0x000000fe0000 : "firmware"
    0x000000fe0000-0x000000ff0000 : "bdinfo"
    0x000000ff0000-0x000001000000 : "reserve"
    
    Install via SSH:
    Original firmware is based on OpenWRT, but SSH is not start by default,
    You should enable it first
    
    1. Login into web admin (10.168.1.1), default password is 'admin'
    2. Open the following link, and the result should be {"code":0};
    SSH is now started, username is root, password is same as web admin password
    http://10.168.1.1/cgi-bin/oraybox?_api=ssh_set&enabled=1
    4. You can flash firmware via mtd: mtd write /tmp/firmware_image.bin firmware
    
    Signed-off-by: Bin We <me at udp.pw>
---
 target/linux/ramips/dts/mt7628an_oraybox_x1.dts    | 129 +++++++++++++++++++++
 target/linux/ramips/image/mt76x8.mk                |   8 ++
 .../ramips/mt76x8/base-files/etc/board.d/01_leds   |   3 +
 .../mt76x8/base-files/etc/board.d/02_network       |   4 +
 4 files changed, 144 insertions(+)

diff --git a/target/linux/ramips/dts/mt7628an_oraybox_x1.dts b/target/linux/ramips/dts/mt7628an_oraybox_x1.dts
new file mode 100644
index 0000000000..eb9a20aae0
--- /dev/null
+++ b/target/linux/ramips/dts/mt7628an_oraybox_x1.dts
@@ -0,0 +1,129 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "mt7628an.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	compatible = "oraybox,x1", "mediatek,mt7628an-soc";
+	model = "OrayBox X1";
+
+	aliases {
+		led-boot = &led_status_white;
+		led-failsafe = &led_status_red;
+		led-running = &led_status_white;
+		led-upgrade = &led_status_red;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		led_status_blue: status-blue {
+			label = "blue:status";
+			gpios = <&gpio 37 GPIO_ACTIVE_HIGH>;
+		};
+
+		led_status_red: status-red {
+			label = "red:status";
+			gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
+		};
+
+		led_status_white: status-white {
+			label = "white:status";
+			gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
+		};
+	};
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "reset";
+			gpios = <&gpio 38 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+	};
+};
+
+&spi0 {
+	status = "okay";
+
+	flash at 0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <40000000>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				label = "u-boot";
+				reg = <0x0 0x30000>;
+				read-only;
+			};
+
+			partition at 30000 {
+				label = "kpanic";
+				reg = <0x30000 0x10000>;
+				read-only;
+			};
+
+			partition at 40000 {
+				label = "factory";
+				reg = <0x40000 0x10000>;
+				read-only;
+			};
+
+			partition at 50000 {
+				compatible = "denx,uimage";
+				label = "firmware";
+				reg = <0x50000 0xf00000>;
+			};
+
+			bdinfo: partition at fe0000 {
+				label = "bdinfo";
+				reg = <0xfe0000 0x10000>;
+				read-only;
+			};
+
+			partition at ff0000 {
+				label = "reserve";
+				reg = <0xff0000 0x10000>;
+				read-only;
+			};
+		};
+	};
+};
+
+&state_default {
+	gpio {
+		groups = "jtag", "wdt";
+		function = "gpio";
+	};
+};
+
+&ethernet {
+	nvmem-cells = <&macaddr_bdinfo_9>;
+	nvmem-cell-names = "mac-address";
+};
+
+&wmac {
+	status = "okay";
+};
+
+&bdinfo {
+	compatible = "nvmem-cells";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	macaddr_bdinfo_9: macaddr at 9 {
+		reg = <0x9 0x6>;
+	};
+};
diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk
index 296b80d03f..fd16606f3f 100644
--- a/target/linux/ramips/image/mt76x8.mk
+++ b/target/linux/ramips/image/mt76x8.mk
@@ -474,6 +474,14 @@ define Device/onion_omega2p
 endef
 TARGET_DEVICES += onion_omega2p
 
+define Device/oraybox_x1
+  IMAGE_SIZE := 15360k
+  DEVICE_VENDOR := OrayBox
+  DEVICE_MODEL := X1
+  DEVICE_PACKAGES:= kmod-usb2 kmod-usb-ohci
+endef
+TARGET_DEVICES += oraybox_x1
+
 define Device/rakwireless_rak633
   IMAGE_SIZE := 7872k
   DEVICE_VENDOR := Rakwireless
diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
index d972762dad..792bd13ebc 100644
--- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
@@ -59,6 +59,9 @@ keenetic,kn-1613)
 mediatek,linkit-smart-7688)
 	ucidef_set_led_wlan "wifi" "wifi" "orange:wifi" "phy0tpt"
 	;;
+oraybox,x1)
+	ucidef_set_led_netdev "wifi" "wifi" "blue:status" "wlan0"
+	;;
 rakwireless,rak633)
 	ucidef_set_led_netdev "wifi_led" "wifi" "blue:wifi" "wlan0"
 	;;
diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
index bfd11fda2e..6bcdea971b 100644
--- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
@@ -141,6 +141,10 @@ ramips_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan" "6 at eth0"
 		;;
+	oraybox,x1)
+		ucidef_add_switch "switch0" \
+			"3:lan" "6 at eth0"
+		;;
 	rakwireless,rak633)
 		ucidef_add_switch "switch0" \
 			"0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6t at eth0"




More information about the lede-commits mailing list