ath79: add support for Samsung WAM250
authorPiotr Dymacz <pepe2k@gmail.com>
Fri, 18 Sep 2020 12:11:13 +0000 (14:11 +0200)
committerPiotr Dymacz <pepe2k@gmail.com>
Sun, 27 Sep 2020 23:28:37 +0000 (01:28 +0200)
Samsung WAM250 is a dual-band (selectable, not simultaneous) wireless
hub, dedicated for Samsung Shape Wireless Audio System. The device is
based on Atheros AR9344 (FCC ID: A3LWAM250). Support for this device
was first introduced in e58e49bdbe (ar71xx target).

Specifications:

- Atheros AR9344
- 560/450/225 MHz (CPU/DDR/AHB)
- 64 MB of RAM (DDR2)
- 16 MB of flash (SPI NOR)
- 2x 10/100 Mbps Ethernet
- 2T2R 2.4/5 GHz Wi-Fi, with ext. PA (SE2598L, SE5003L) and LNA
- 1x USB 2.0
- 4x LED (all are driven by GPIO)
- 2x button (reset, wps/speaker add)
- DC jack for main power input (14 V)
- UART header on PCB (J4, RX: 3, TX: 5)

Flash instruction:

This device uses dual-image (switched between upgrades) with a common
jffs2 config partition. Fortunately, there is a way to disable this mode
so that more flash space can be used by OpenWrt image.

You can easily access this device over telnet, using root/root
credentials (the same also work for serial console access).

1. Make sure that your device uses second (bootpart=2) image using
   command: "fw_printenv bootpart".
2. If your device uses first image (bootpart=1), perform upgrade to the
   latest vendor firmware (after the update, device should boot from
   second partition) using web gui (default login: admin/1234567890).
3. Rename "sysupgrade" image to "firmware.bin", download it (you can use
   wget, tftp or ftpget) to "/tmp" and issue below commands:

   mtd_debug erase /dev/mtd3 0 $(wc -c /tmp/firmware.bin | awk -F' ' '{print $1}')
   mtd_debug write /dev/mtd3 0 $(wc -c /tmp/firmware.bin)
   fw_setenv bootpart
   fw_setenv bootcmd "bootm 0x9f070000"
   reboot

Revert to vendor firmware instruction:

1. Download vendor firmware to "/tmp" device and issue below commands:

   fw_setenv bootpart 1
   sysupgrade -n -F SS_BHUB_v2.2.05.bin

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
target/linux/ath79/dts/ar9344_samsung_wam250.dts [new file with mode: 0644]
target/linux/ath79/generic/base-files/etc/board.d/01_leds
target/linux/ath79/image/generic.mk

diff --git a/target/linux/ath79/dts/ar9344_samsung_wam250.dts b/target/linux/ath79/dts/ar9344_samsung_wam250.dts
new file mode 100644 (file)
index 0000000..3ae68d6
--- /dev/null
@@ -0,0 +1,163 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "ar9344.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       model = "Samsung WAM250";
+       compatible = "samsung,wam250", "qca,ar9344";
+
+       aliases {
+               led-boot = &led_power;
+               led-failsafe = &led_power;
+               led-running = &led_power;
+               led-upgrade = &led_power;
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               reset {
+                       label = "reset";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+
+               wps {
+                       label = "wps";
+                       linux,code = <KEY_WPS_BUTTON>;
+                       gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               lan {
+                       label = "wam250:white:lan";
+                       gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+               };
+
+               led_power: power {
+                       label = "wam250:white:power";
+                       gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+                       default-state = "keep";
+               };
+
+               repeater {
+                       label = "wam250:white:repeater";
+                       gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+               };
+
+               wlan {
+                       label = "wam250:white:wlan";
+                       gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "phy0tpt";
+               };
+       };
+};
+
+&eth0 {
+       status = "okay";
+
+       phy-handle = <&swphy0>;
+
+       mtd-mac-address = <&art 0x1002>;
+       mtd-mac-address-increment = <1>;
+
+       gmac-config {
+               device = <&gmac>;
+               switch-phy-swap = <1>;
+       };
+};
+
+&eth1 {
+       status = "okay";
+
+       mtd-mac-address = <&art 0x1002>;
+};
+
+&gpio {
+       lna0 {
+               line-name = "wam250:ext:lna0";
+               gpios = <19 GPIO_ACTIVE_HIGH>;
+               output-high;
+               gpio-hog;
+       };
+};
+
+&ref {
+       clock-frequency = <40000000>;
+};
+
+&spi {
+       status = "okay";
+
+       num-cs = <1>;
+
+       flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <50000000>;
+               m25p,fast-read;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "u-boot";
+                               reg = <0x000000 0x040000>;
+                               read-only;
+                       };
+
+                       partition@40000 {
+                               label = "u-boot-env";
+                               reg = <0x040000 0x010000>;
+                       };
+
+                       partition@50000 {
+                               label = "nvram";
+                               reg = <0x050000 0x020000>;
+                               read-only;
+                       };
+
+                       partition@70000 {
+                               compatible = "denx,uimage";
+                               label = "firmware";
+                               reg = <0x070000 0xf80000>;
+                       };
+
+                       art: partition@ff0000 {
+                               label = "art";
+                               reg = <0xff0000 0x010000>;
+                               read-only;
+                       };
+               };
+       };
+};
+
+&uart {
+       status = "okay";
+};
+
+
+&usb {
+       status = "okay";
+};
+
+&usb_phy {
+       status = "okay";
+};
+
+
+&wmac {
+       status = "okay";
+
+       mtd-cal-data = <&art 0x1000>;
+};
index 2b7b3bed553b070d72692069a4c145268d0ae5a7..78726afecfd463966ffef3a48d4a6bf495cf9620 100755 (executable)
@@ -212,6 +212,9 @@ pcs,cr3000)
 qihoo,c301)
        ucidef_set_led_wlan "wlan" "WLAN" "$boardname:green:wlan" "phy0tpt"
        ;;
+samsung,wam250)
+       ucidef_set_led_netdev "lan" "LAN" "$boardname:white:lan" "eth0"
+       ;;
 tplink,archer-a7-v5|\
 tplink,archer-c7-v4|\
 tplink,archer-c7-v5)
index 5d1058cae2682c1151bba3067f5cd53858264009..ce927ecd4f2c3be4358fa8ccd1e4e126a16df75f 100644 (file)
@@ -1415,6 +1415,16 @@ define Device/rosinson_wr818
 endef
 TARGET_DEVICES += rosinson_wr818
 
+define Device/samsung_wam250
+  SOC := ar9344
+  DEVICE_VENDOR := Samsung
+  DEVICE_MODEL := WAM250
+  IMAGE_SIZE := 15872k
+  DEVICE_PACKAGES := kmod-usb2
+  SUPPORTED_DEVICES += wam250
+endef
+TARGET_DEVICES += samsung_wam250
+
 define Device/siemens_ws-ap3610
   SOC := ar7161
   DEVICE_VENDOR := Siemens