Skip to content

Commit b18b349

Browse files
committed
linux: devicetree: Early experimental support for Ethernet switching with DSA
1 parent 26c4d81 commit b18b349

File tree

10 files changed

+1744
-5
lines changed

10 files changed

+1744
-5
lines changed

tp2bmc/board/tp2bmc/boot.scr

-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,4 @@ load ${devtype} ${devnum}:${distro_bootpart} ${loadaddr} /boot/zImage
2020
load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} /boot/${fdt_filename}
2121
fdt addr ${fdt_addr_r}
2222

23-
# Our build of Linux doesn't yet know how to manage the switch, so:
24-
run ethsw_do_reset
25-
2623
bootz ${loadaddr} - ${fdt_addr_r}

tp2bmc/board/tp2bmc/linux_defconfig

+6-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ CONFIG_IP_MULTIPLE_TABLES=y
5252
CONFIG_INET_IPCOMP=y
5353
CONFIG_INET_UDP_DIAG=y
5454
CONFIG_IPV6_TUNNEL=y
55+
CONFIG_BRIDGE=y
56+
CONFIG_NET_DSA=y
57+
CONFIG_NET_DSA_TAG_RTL4_A=y
5558
CONFIG_NETLINK_DIAG=y
5659
CONFIG_UEVENT_HELPER=y
5760
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
@@ -66,6 +69,9 @@ CONFIG_EEPROM_AT24=y
6669
CONFIG_SCSI=y
6770
CONFIG_BLK_DEV_SD=y
6871
CONFIG_NETDEVICES=y
72+
CONFIG_NET_DSA_REALTEK=y
73+
# CONFIG_NET_DSA_REALTEK_MDIO is not set
74+
CONFIG_NET_DSA_REALTEK_RTL8365MB=y
6975
# CONFIG_NET_VENDOR_ALACRITECH is not set
7076
# CONFIG_NET_VENDOR_ALLWINNER is not set
7177
# CONFIG_NET_VENDOR_AMAZON is not set
@@ -114,7 +120,6 @@ CONFIG_STMMAC_ETH=y
114120
# CONFIG_NET_VENDOR_WANGXUN is not set
115121
# CONFIG_NET_VENDOR_WIZNET is not set
116122
# CONFIG_NET_VENDOR_XILINX is not set
117-
CONFIG_REALTEK_PHY=y
118123
# CONFIG_USB_NET_DRIVERS is not set
119124
# CONFIG_WLAN is not set
120125
CONFIG_INPUT_EVDEV=y
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
3+
# Kind of a hack, don't know where else to put this
4+
# Rename `eth0` to `dsa` on boot, so that it is not confused for a usable
5+
# Ethernet interface
6+
7+
case "$1" in
8+
start|"")
9+
exec ip link set eth0 name dsa
10+
;;
11+
*)
12+
echo "Usage: $0 {start}"
13+
exit 1
14+
;;
15+
esac
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# interface file auto-generated by buildroot
2+
3+
auto lo
4+
iface lo inet loopback
5+
6+
auto br0
7+
iface br0 inet dhcp
8+
bridge-ports node1 node2 node3 node4 ge0 ge1
9+
pre-up /etc/network/nfs_check
10+
wait-delay 15
11+
hostname $(hostname)

tp2bmc/board/tp2bmc/sun8i-t113s-turing-pi2-v2.4.dts

+4
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@
164164
};
165165
};
166166

167+
&ethernet_switch {
168+
reset-gpios = <&pio 6 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
169+
};
170+
167171
&i2c2 {
168172
/*
169173
* The TP2 board design includes a 4-pin fan header (J16) and

tp2bmc/board/tp2bmc/sun8i-t113s-turing-pi2-v2.5.dts

+4
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@
188188
};
189189
};
190190

191+
&ethernet_switch {
192+
reset-gpios = <&pio 6 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
193+
};
194+
191195
&i2c0 {
192196
status = "okay";
193197

tp2bmc/board/tp2bmc/sun8i-t113s-turing-pi2.dtsi

+82
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,88 @@
218218

219219
pagesize = <16>;
220220
};
221+
222+
ethernet_switch: ethernet-switch@5c {
223+
compatible = "realtek,rtl8365mb";
224+
reg = <0x5c>;
225+
226+
ethernet-ports {
227+
#address-cells = <1>;
228+
#size-cells = <0>;
229+
230+
ethernet-port@0 {
231+
reg = <0>;
232+
label = "node1";
233+
phy-handle = <&ethphy0>;
234+
phy-mode = "internal";
235+
};
236+
ethernet-port@1 {
237+
reg = <1>;
238+
label = "node2";
239+
phy-handle = <&ethphy1>;
240+
phy-mode = "internal";
241+
};
242+
ethernet-port@2 {
243+
reg = <2>;
244+
label = "node3";
245+
phy-handle = <&ethphy2>;
246+
phy-mode = "internal";
247+
};
248+
ethernet-port@3 {
249+
reg = <3>;
250+
label = "node4";
251+
phy-handle = <&ethphy3>;
252+
phy-mode = "internal";
253+
};
254+
ethernet-port@4 {
255+
reg = <4>;
256+
label = "cpu";
257+
ethernet = <&emac>;
258+
phy-handle = <&ethphy4>;
259+
phy-mode = "internal";
260+
};
261+
ethernet-port@5 {
262+
reg = <5>;
263+
label = "ge0";
264+
phy-handle = <&ethphy5>;
265+
phy-mode = "internal";
266+
};
267+
ethernet-port@6 {
268+
reg = <6>;
269+
label = "ge1";
270+
phy-handle = <&ethphy6>;
271+
phy-mode = "internal";
272+
};
273+
};
274+
275+
mdio {
276+
compatible = "realtek,smi-mdio";
277+
#address-cells = <1>;
278+
#size-cells = <0>;
279+
280+
ethphy0: ethernet-phy@0 {
281+
reg = <0>;
282+
};
283+
ethphy1: ethernet-phy@1 {
284+
reg = <1>;
285+
};
286+
ethphy2: ethernet-phy@2 {
287+
reg = <2>;
288+
};
289+
ethphy3: ethernet-phy@3 {
290+
reg = <3>;
291+
};
292+
ethphy4: ethernet-phy@4 {
293+
reg = <4>;
294+
};
295+
ethphy5: ethernet-phy@5 {
296+
reg = <5>;
297+
};
298+
ethphy6: ethernet-phy@6 {
299+
reg = <6>;
300+
};
301+
};
302+
};
221303
};
222304

223305
&emac {

tp2bmc/package/ifupdown-ng/ifupdown-ng.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
################################################################################
66

77
IFUPDOWN_NG_VERSION = 0.12.1
8-
IFUPDOWN_NG_SITE = $(call github,ifupdown-ng,ifupdown-ng,$(IFUPDOWN_NG_VERSION))
8+
IFUPDOWN_NG_SITE = $(call github,ifupdown-ng,ifupdown-ng,ifupdown-ng-$(IFUPDOWN_NG_VERSION))
99
IFUPDOWN_NG_LICENSE = GPL-2.0+
1010
IFUPDOWN_NG_LICENSE_FILES = COPYING
1111

0 commit comments

Comments
 (0)