summaryrefslogtreecommitdiff
path: root/arch/sandbox/dts
diff options
context:
space:
mode:
authorClaudiu Manoil <claudiu.manoil@nxp.com>2021-03-14 20:14:57 +0800
committerPriyanka Jain <priyanka.jain@nxp.com>2021-04-15 14:22:17 +0530
commitff98da06674d47ff995edd068bcbd4ae6da69f00 (patch)
tree7138a284dfed3ba35814c0d9a3e39bfce1e11971 /arch/sandbox/dts
parent3c56251f2be7b5d816ad1a9db710d3e815825b4b (diff)
sandbox: Add a DSA sandbox driver and unit test
The DSA sandbox driver is used for unit testing the DSA class code. It implements a simple 2 port switch plus 1 CPU port, and uses a very simple tag to identify the ports. The DSA sandbox device is connected via CPU port to a regular Ethernet sandbox device, called 'dsa-test-eth, managed by the existing eth sandbox driver. The 'dsa-test-eth' is not intended for testing the eth class code however, but it is used to emulate traffic through the 'lan0' and 'lan1' front pannel switch ports. To achieve this the dsa sandbox driver registers a tx handler for the 'dsa-test-eth' device. The switch ports, labeled as 'lan0' and 'lan1', are also registered as eth devices by the dsa class code this time. So pinging through these switch ports is as easy as: => setenv ethact lan0 => ping 1.2.3.5 Unit tests for the dsa class code were also added. The 'dsa_probe' test exercises most API functions from dsa.h. The 'dsa' unit test simply exercises ARP/ICMP traffic through the two switch ports, including tag injection and extraction, with the help of the dsa sandbox driver. I took care to minimize the impact on the existing eth unit tests, though some adjustments needed to be made with the addition of extra eth interfaces used by the dsa unit tests. The additional eth interfaces also require MAC addresses, these have been added to the sandbox default environment. Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com> Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Message-Id: <20210216224804.3355044-5-olteanv@gmail.com> Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
Diffstat (limited to 'arch/sandbox/dts')
-rw-r--r--arch/sandbox/dts/test.dts48
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 8c4c2bfddd..57f4dc1e57 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -15,7 +15,9 @@
aliases {
console = &uart0;
eth0 = "/eth@10002000";
+ eth2 = &swp_0;
eth3 = &eth_3;
+ eth4 = &dsa_eth0;
eth5 = &eth_5;
gpio1 = &gpio_a;
gpio2 = &gpio_b;
@@ -478,6 +480,52 @@
fake-host-hwaddr = [00 00 66 44 22 22];
};
+ dsa_eth0: dsa-test-eth {
+ compatible = "sandbox,eth";
+ reg = <0x10006000 0x1000>;
+ fake-host-hwaddr = [00 00 66 44 22 66];
+ };
+
+ dsa-test {
+ compatible = "sandbox,dsa";
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ swp_0: port@0 {
+ reg = <0>;
+ label = "lan0";
+ phy-mode = "rgmii-rxid";
+
+ fixed-link {
+ speed = <100>;
+ full-duplex;
+ };
+ };
+
+ swp_1: port@1 {
+ reg = <1>;
+ label = "lan1";
+ phy-mode = "rgmii-txid";
+
+ fixed-link {
+ speed = <100>;
+ full-duplex;
+ };
+ };
+
+ port@2 {
+ reg = <2>;
+ ethernet = <&dsa_eth0>;
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+ };
+ };
+ };
+
firmware {
sandbox_firmware: sandbox-firmware {
compatible = "sandbox,firmware";