Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/realtek dsa #209

Merged
merged 3 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tp2bmc/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ menu "tpi2 app packages"
source "$BR2_EXTERNAL_TP2BMC_PATH/package/tpi/Config.in"
source "$BR2_EXTERNAL_TP2BMC_PATH/package/raspberrypi-target-usbboot/Config.in"
endmenu

source "$BR2_EXTERNAL_TP2BMC_PATH/package/ifupdown-ng/Config.in"
8 changes: 0 additions & 8 deletions tp2bmc/board/tp2bmc/boot.scr
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ load ${devtype} ${devnum}:${distro_bootpart} ${loadaddr} /boot/turing-pi2.itb
# read hardware version from EEPROM
tpi_info hw_version tpi_hw_version

# Our build of Linux doesn't yet know how to manage the switch, so:
if test "${tpi_hw_version}" = "v2.4.0"; then
env set ethsw_reset_pin PG13
else
env set ethsw_reset_pin PG3
fi
run ethsw_do_reset

setenv fit_boot_args "${loadaddr}#config-${tpi_hw_version:-v2.4.0}"
if env exists boot_unlocked; then
echo "disabling write protection.."
Expand Down
8 changes: 6 additions & 2 deletions tp2bmc/board/tp2bmc/linux_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_INET_IPCOMP=y
CONFIG_INET_UDP_DIAG=y
CONFIG_IPV6_TUNNEL=y
CONFIG_BRIDGE=y
CONFIG_NET_DSA=y
CONFIG_NET_DSA_TAG_RTL4_A=y
CONFIG_NETLINK_DIAG=y
CONFIG_UEVENT_HELPER=y
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
Expand All @@ -66,6 +69,9 @@ CONFIG_EEPROM_AT24=y
CONFIG_SCSI=y
CONFIG_BLK_DEV_SD=y
CONFIG_NETDEVICES=y
CONFIG_NET_DSA_REALTEK=y
# CONFIG_NET_DSA_REALTEK_MDIO is not set
CONFIG_NET_DSA_REALTEK_RTL8365MB=y
# CONFIG_NET_VENDOR_ALACRITECH is not set
# CONFIG_NET_VENDOR_ALLWINNER is not set
# CONFIG_NET_VENDOR_AMAZON is not set
Expand Down Expand Up @@ -114,7 +120,6 @@ CONFIG_STMMAC_ETH=y
# CONFIG_NET_VENDOR_WANGXUN is not set
# CONFIG_NET_VENDOR_WIZNET is not set
# CONFIG_NET_VENDOR_XILINX is not set
CONFIG_REALTEK_PHY=y
# CONFIG_USB_NET_DRIVERS is not set
# CONFIG_WLAN is not set
CONFIG_INPUT_EVDEV=y
Expand All @@ -128,7 +133,6 @@ CONFIG_SERIAL_8250_NR_UARTS=8
CONFIG_SERIAL_8250_DW=y
CONFIG_I2C=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_GPIO=y
CONFIG_I2C_MV64XXX=y
CONFIG_SPI=y
CONFIG_SPI_SUN6I=y
Expand Down
15 changes: 15 additions & 0 deletions tp2bmc/board/tp2bmc/overlay/etc/init.d/S00dsa
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

# Kind of a hack, don't know where else to put this
# Rename `eth0` to `dsa` on boot, so that it is not confused for a usable
# Ethernet interface

case "$1" in
start|"")
exec ip link set eth0 name dsa
;;
*)
echo "Usage: $0 {start}"
exit 1
;;
esac
11 changes: 11 additions & 0 deletions tp2bmc/board/tp2bmc/overlay/etc/network/interfaces
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# interface file auto-generated by buildroot

auto lo
iface lo inet loopback

auto br0
iface br0 inet dhcp
bridge-ports node1 node2 node3 node4 ge0 ge1
pre-up /etc/network/nfs_check
wait-delay 15
hostname $(hostname)
4 changes: 4 additions & 0 deletions tp2bmc/board/tp2bmc/sun8i-t113s-turing-pi2-v2.4.dts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@
};
};

&ethernet_switch {
reset-gpios = <&pio 6 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
};

&i2c2 {
/*
* The TP2 board design includes a 4-pin fan header (J16) and
Expand Down
4 changes: 4 additions & 0 deletions tp2bmc/board/tp2bmc/sun8i-t113s-turing-pi2-v2.5.dts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@
};
};

&ethernet_switch {
reset-gpios = <&pio 6 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
};

#ifndef IS_UBOOT
&i2c0 {
status = "okay";
Expand Down
82 changes: 82 additions & 0 deletions tp2bmc/board/tp2bmc/sun8i-t113s-turing-pi2.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,88 @@

pagesize = <16>;
};

ethernet_switch: ethernet-switch@5c {
compatible = "realtek,rtl8365mb";
reg = <0x5c>;

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

ethernet-port@0 {
reg = <0>;
label = "node1";
phy-handle = <&ethphy0>;
phy-mode = "internal";
};
ethernet-port@1 {
reg = <1>;
label = "node2";
phy-handle = <&ethphy1>;
phy-mode = "internal";
};
ethernet-port@2 {
reg = <2>;
label = "node3";
phy-handle = <&ethphy2>;
phy-mode = "internal";
};
ethernet-port@3 {
reg = <3>;
label = "node4";
phy-handle = <&ethphy3>;
phy-mode = "internal";
};
ethernet-port@4 {
reg = <4>;
label = "cpu";
ethernet = <&emac>;
phy-handle = <&ethphy4>;
phy-mode = "internal";
};
ethernet-port@5 {
reg = <5>;
label = "ge0";
phy-handle = <&ethphy5>;
phy-mode = "internal";
};
ethernet-port@6 {
reg = <6>;
label = "ge1";
phy-handle = <&ethphy6>;
phy-mode = "internal";
};
};

mdio {
compatible = "realtek,smi-mdio";
#address-cells = <1>;
#size-cells = <0>;

ethphy0: ethernet-phy@0 {
reg = <0>;
};
ethphy1: ethernet-phy@1 {
reg = <1>;
};
ethphy2: ethernet-phy@2 {
reg = <2>;
};
ethphy3: ethernet-phy@3 {
reg = <3>;
};
ethphy4: ethernet-phy@4 {
reg = <4>;
};
ethphy5: ethernet-phy@5 {
reg = <5>;
};
ethphy6: ethernet-phy@6 {
reg = <6>;
};
};
};
};

&emac {
Expand Down
2 changes: 2 additions & 0 deletions tp2bmc/configs/tp2bmc_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ BR2_PACKAGE_GPTFDISK_SGDISK=y
BR2_PACKAGE_GPTFDISK=y
BR2_PACKAGE_HTOP=y
BR2_PACKAGE_I2C_TOOLS=y
BR2_PACKAGE_IFUPDOWN_NG=y
BR2_PACKAGE_IPROUTE2=y
BR2_PACKAGE_LIBAIO=y
BR2_PACKAGE_LIBCURL_CURL=y
BR2_PACKAGE_LIBCURL=y
Expand Down
18 changes: 18 additions & 0 deletions tp2bmc/package/ifupdown-ng/Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
config BR2_PACKAGE_IFUPDOWN_NG
bool "ifupdown-ng"
depends on BR2_USE_MMU # fork()
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_4 # iproute2
depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
select BR2_PACKAGE_LIBBSD if !BR2_TOOLCHAIN_USES_MUSL
# runtime for ip binary
select BR2_PACKAGE_IPROUTE2
help
Network device manager that is largely compatible with Debian
ifupdown, BusyBox ifupdown and Cumulus Networks' ifupdown2.

https://github.com/ifupdown-ng/ifupdown-ng

comment "ifupdown-ng needs a toolchain w/ headers >= 3.4"
depends on BR2_USE_MMU
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_4
depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diff --git a/Makefile b/Makefile
index 9300bc6..168402c 100644
--- a/Makefile
+++ b/Makefile
@@ -20,18 +20,18 @@ STATE_FILE := /run/ifstate
CONFIG_FILE := /etc/network/ifupdown-ng.conf
EXECUTOR_PATH := /usr/libexec/ifupdown-ng

-CFLAGS ?= -ggdb3 -Os
-CFLAGS += -Wall -Wextra -Werror
-CFLAGS += -Wmissing-declarations -Wmissing-prototypes -Wcast-align -Wpointer-arith -Wreturn-type
-CFLAGS += ${LIBBSD_CFLAGS}
-CPPFLAGS = -I.
-CPPFLAGS += -DINTERFACES_FILE=\"${INTERFACES_FILE}\"
-CPPFLAGS += -DSTATE_FILE=\"${STATE_FILE}\"
-CPPFLAGS += -DCONFIG_FILE=\"${CONFIG_FILE}\"
-CPPFLAGS += -DPACKAGE_NAME=\"${PACKAGE_NAME}\"
-CPPFLAGS += -DPACKAGE_VERSION=\"${PACKAGE_VERSION}\"
-CPPFLAGS += -DPACKAGE_BUGREPORT=\"${PACKAGE_BUGREPORT}\"
-CPPFLAGS += -DEXECUTOR_PATH=\"${EXECUTOR_PATH}\"
+override CFLAGS += -ggdb3 -Os
+override CFLAGS += -Wall -Wextra -Werror
+override CFLAGS += -Wmissing-declarations -Wmissing-prototypes -Wcast-align -Wpointer-arith -Wreturn-type
+override CFLAGS += ${LIBBSD_CFLAGS}
+override CPPFLAGS += -I.
+override CPPFLAGS += -DINTERFACES_FILE=\"${INTERFACES_FILE}\"
+override CPPFLAGS += -DSTATE_FILE=\"${STATE_FILE}\"
+override CPPFLAGS += -DCONFIG_FILE=\"${CONFIG_FILE}\"
+override CPPFLAGS += -DPACKAGE_NAME=\"${PACKAGE_NAME}\"
+override CPPFLAGS += -DPACKAGE_VERSION=\"${PACKAGE_VERSION}\"
+override CPPFLAGS += -DPACKAGE_BUGREPORT=\"${PACKAGE_BUGREPORT}\"
+override CPPFLAGS += -DEXECUTOR_PATH=\"${EXECUTOR_PATH}\"


LIBIFUPDOWN_SRC = \
3 changes: 3 additions & 0 deletions tp2bmc/package/ifupdown-ng/ifupdown-ng.hash
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Locally computed
sha256 d42c8c18222efbce0087b92a14ea206de4e865d5c9dde6c0864dcbb2b45f2d85 ifupdown-ng-0.12.1.tar.gz
sha256 dac461b054f4dc686b1a787534a2d919af37a769926ff33516f26d4f79844876 COPYING
34 changes: 34 additions & 0 deletions tp2bmc/package/ifupdown-ng/ifupdown-ng.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
################################################################################
#
# ifupdown-ng
#
################################################################################

IFUPDOWN_NG_VERSION = 0.12.1
IFUPDOWN_NG_SITE = $(call github,ifupdown-ng,ifupdown-ng,ifupdown-ng-$(IFUPDOWN_NG_VERSION))
IFUPDOWN_NG_LICENSE = GPL-2.0+
IFUPDOWN_NG_LICENSE_FILES = COPYING

# Makefile-allow-passing-custom-CFLAGS-CPPFLAGS.patch

ifeq ($(BR2_PACKAGE_LIBBSD),y)
IFUPDOWN_NG_DEPENDENCIES += libbsd host-pkgconf
define IFUPDOWN_NG_EXTRA_FLAGS
LIBBSD_CFLAGS="$(shell $(HOST_DIR)/bin/pkg-config --cflags libbsd-overlay)" \
LIBBSD_LIBS="$(shell $(HOST_DIR)/bin/pkg-config --cflags --libs libbsd-overlay)"
endef
endif

define IFUPDOWN_NG_BUILD_CMDS
$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) \
$(IFUPDOWN_NG_EXTRA_FLAGS) \
-C $(@D)
endef

define IFUPDOWN_NG_INSTALL_TARGET_CMDS
$(RM) $(TARGET_DIR)/sbin/{ifctrstat,ifdown,ifparse,ifquery,ifup}
$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) install \
DESTDIR=$(TARGET_DIR)
endef

$(eval $(generic-package))
Loading
Loading