Skip to content

Commit

Permalink
ath79: convert buffalo WZR-450HP2 to DSA
Browse files Browse the repository at this point in the history
Reimplement switch handling of WZR-450HP2 with DSA.

Signed-off-by: Edward Chow <[email protected]>
  • Loading branch information
InsaneKnight committed Dec 13, 2024
1 parent deaa16d commit bb78b7e
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 15 deletions.
178 changes: 165 additions & 13 deletions target/linux/ath79/dts/qca9558_buffalo_wzr-450hp2.dts
Original file line number Diff line number Diff line change
Expand Up @@ -127,35 +127,187 @@
&mdio0 {
status = "okay";

phy0: ethernet-phy@0 {
switch@0 {
compatible = "qca,qca8337";
#address-cells = <1>;
#size-cells = <0>;

reg = <0>;
qca,ignore-power-on-sel;
qca,led-open-drain;

ports {
#address-cells = <1>;
#size-cells = <0>;

port@0 {
reg = <0>;
ethernet = <&eth0>;
phy-mode = "rgmii-id";
tx-internal-delay-ps = <1000>;
rx-internal-delay-ps = <2000>;

fixed-link {
speed = <1000>;
full-duplex;
};
};

port@1 {
reg = <1>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&phy_port1>;

leds {
#address-cells = <1>;
#size-cells = <0>;

led@0 {
reg = <0>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
};
};

port@2 {
reg = <2>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&phy_port2>;

leds {
#address-cells = <1>;
#size-cells = <0>;

led@0 {
reg = <0>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
};
};

port@3 {
reg = <3>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&phy_port3>;

leds {
#address-cells = <1>;
#size-cells = <0>;

led@0 {
reg = <0>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
};
};

port@4 {
reg = <4>;
label = "lan4";
phy-mode = "internal";
phy-handle = <&phy_port4>;

leds {
#address-cells = <1>;
#size-cells = <0>;

led@0 {
reg = <0>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_LAN;
default-state = "keep";
};
};
};

qca,ar8327-initvals = <
0x04 0x07600000 /* PORT0 PAD MODE CTRL: RGMII, to eth0 */
0x0c 0x80080080 /* PORT6 PAD MODE CTRL: SGMII, to eth1 */
0x10 0x81000080 /* POWER ON STRAP */
0x50 0xcc35cc35 /* LED_CTRL0 */
0x54 0xca35ca35 /* LED_CTRL1 */
0x58 0xc935c935 /* LED_CTRL2 */
0x5c 0x03ffff00 /* LED_CTRL3 */
0x7c 0x0000007e /* PORT0_STATUS */
0x94 0x0000007e /* PORT6_STATUS */
>;
port@5 {
reg = <5>;
label = "wan";
phy-mode = "internal";
phy-handle = <&phy_port5>;

leds {
#address-cells = <1>;
#size-cells = <0>;

led@0 {
reg = <0>;
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_WAN;
default-state = "keep";
};
};
};

port@6 {
reg = <6>;
ethernet = <&eth1>;
phy-mode = "sgmii";
qca,sgmii-rxclk-falling-edge;

fixed-link {
speed = <1000>;
full-duplex;
};
};
};

mdio {
#address-cells = <1>;
#size-cells = <0>;

phy_port1: phy@0 {
reg = <0>;
};

phy_port2: phy@1 {
reg = <1>;
};

phy_port3: phy@2 {
reg = <2>;
};

phy_port4: phy@3 {
reg = <3>;
};

phy_port5: phy@4 {
reg = <4>;
};
};
};
};

&mdio1 {
status = "okay";
};

&eth0 {
status = "okay";

nvmem-cells = <&macaddr_wan>;
nvmem-cell-names = "mac-address";
phy-handle = <&phy0>;
pll-data = <0x56000000 0x00000101 0x00001616>;

gmac-config {
device = <&gmac>;
rgmii-enabled = <1>;
};

fixed-link {
speed = <1000>;
full-duplex;
};
};

&eth1 {
Expand Down
7 changes: 7 additions & 0 deletions target/linux/ath79/generic/base-files/etc/board.d/01_leds
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ alcatel,hh40v)
ucidef_set_led_netdev "wan_data" "WAN Data" "green:wan" "eth0" "tx rx"
ucidef_set_led_netdev "wan_link" "WAN Link" "orange:wan" "eth0" "link"
;;
buffalo,wzr-450hp2)
ucidef_set_led_netdev "lan1" "LAN1" "qca8k-0.0:00:green:lan" "lan1" "link-10 link-100 link-1000 tx rx"
ucidef_set_led_netdev "lan2" "LAN2" "qca8k-0.0:01:green:lan" "lan2" "link-10 link-100 link-1000 tx rx"
ucidef_set_led_netdev "lan3" "LAN3" "qca8k-0.0:02:green:lan" "lan3" "link-10 link-100 link-1000 tx rx"
ucidef_set_led_netdev "lan4" "LAN4" "qca8k-0.0:03:green:lan" "lan4" "link-10 link-100 link-1000 tx rx"
ucidef_set_led_netdev "wan" "WAN" "qca8k-0.0:04:green:wan" "wan" "link-10 link-100 link-1000 tx rx"
;;
alfa-network,ap121f|\
alfa-network,ap121fe|\
alfa-network,wifi-camppro-nano-duo|\
Expand Down
8 changes: 6 additions & 2 deletions target/linux/ath79/generic/base-files/etc/board.d/02_network
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,12 @@ ath79_setup_interfaces()
"0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth0"
;;
buffalo,wzr-450hp2)
ucidef_add_switch "switch0" \
"6@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0"
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
ucidef_set_network_device_conduit "lan1" "eth1"
ucidef_set_network_device_conduit "lan2" "eth1"
ucidef_set_network_device_conduit "lan3" "eth1"
ucidef_set_network_device_conduit "lan4" "eth1"
ucidef_set_network_device_conduit "wan" "eth0"
;;
buffalo,wzr-600dhp|\
buffalo,wzr-hp-ag300h|\
Expand Down
4 changes: 4 additions & 0 deletions target/linux/ath79/image/generic.mk
Original file line number Diff line number Diff line change
Expand Up @@ -763,9 +763,13 @@ define Device/buffalo_wzr-450hp2
$(Device/buffalo_common)
SOC := qca9558
DEVICE_MODEL := WZR-450HP2/WZR-450HP2D
DEVICE_PACKAGES := kmod-ag71xx kmod-dsa-qca8k kmod-phy-qca83xx \
-kmod-ag71xx-legacy -kmod-switch-ip17xx -kmod-switch-ar8xxx -kmod-swconfig -swconfig
BUFFALO_PRODUCT := WZR-450HP2
IMAGE_SIZE := 15936k
SUPPORTED_DEVICES += wzr-450hp2
DEVICE_COMPAT_VERSION := 1.1
DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA
endef
TARGET_DEVICES += buffalo_wzr-450hp2

Expand Down

0 comments on commit bb78b7e

Please sign in to comment.