summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2015-03-22 17:09:16 -0500
committerSimon Glass <sjg@chromium.org>2015-04-18 11:11:13 -0600
commite58780dcb7b8656ebc2dd6ba6d0da728bc65bf40 (patch)
tree68b6448131caeaa7d02a88cfbb1116e56f3b679b /test
parentbfacad7da11711231ca59717c0a8bc7317c5bb28 (diff)
downloadblackbird-obmc-uboot-e58780dcb7b8656ebc2dd6ba6d0da728bc65bf40.tar.gz
blackbird-obmc-uboot-e58780dcb7b8656ebc2dd6ba6d0da728bc65bf40.zip
dm: eth: Add support for aliases
Allow network devices to be referred to as "eth0" instead of "eth@12345678" when specified in ethact. Add tests to verify this behavior. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/dm/eth.c24
-rw-r--r--test/dm/test.dts4
2 files changed, 27 insertions, 1 deletions
diff --git a/test/dm/eth.c b/test/dm/eth.c
index 04ccf49820..5688b71de0 100644
--- a/test/dm/eth.c
+++ b/test/dm/eth.c
@@ -36,3 +36,27 @@ static int dm_test_eth(struct dm_test_state *dms)
return 0;
}
DM_TEST(dm_test_eth, DM_TESTF_SCAN_FDT);
+
+static int dm_test_eth_alias(struct dm_test_state *dms)
+{
+ NetPingIP = string_to_ip("1.1.2.2");
+ setenv("ethact", "eth0");
+ ut_assertok(NetLoop(PING));
+ ut_asserteq_str("eth@10002000", getenv("ethact"));
+
+ setenv("ethact", "eth1");
+ ut_assertok(NetLoop(PING));
+ ut_asserteq_str("eth@10004000", getenv("ethact"));
+
+ /* Expected to fail since eth2 is not defined in the device tree */
+ setenv("ethact", "eth2");
+ ut_assertok(NetLoop(PING));
+ ut_asserteq_str("eth@10002000", getenv("ethact"));
+
+ setenv("ethact", "eth5");
+ ut_assertok(NetLoop(PING));
+ ut_asserteq_str("eth@10003000", getenv("ethact"));
+
+ return 0;
+}
+DM_TEST(dm_test_eth_alias, DM_TESTF_SCAN_FDT);
diff --git a/test/dm/test.dts b/test/dm/test.dts
index 762ddc3507..0ab0916858 100644
--- a/test/dm/test.dts
+++ b/test/dm/test.dts
@@ -18,6 +18,8 @@
testfdt3 = "/b-test";
testfdt5 = "/some-bus/c-test@5";
testfdt8 = "/a-test";
+ eth0 = "/eth@10002000";
+ eth5 = &eth_5;
};
uart0: serial {
@@ -172,7 +174,7 @@
fake-host-hwaddr = <0x00 0x00 0x66 0x44 0x22 0x00>;
};
- eth@10003000 {
+ eth_5: eth@10003000 {
compatible = "sandbox,eth";
reg = <0x10003000 0x1000>;
fake-host-hwaddr = <0x00 0x00 0x66 0x44 0x22 0x11>;
OpenPOWER on IntegriCloud