diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2015-03-22 17:09:16 -0500 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-04-18 11:11:13 -0600 |
commit | e58780dcb7b8656ebc2dd6ba6d0da728bc65bf40 (patch) | |
tree | 68b6448131caeaa7d02a88cfbb1116e56f3b679b /test/dm | |
parent | bfacad7da11711231ca59717c0a8bc7317c5bb28 (diff) | |
download | u-boot-imx-e58780dcb7b8656ebc2dd6ba6d0da728bc65bf40.zip u-boot-imx-e58780dcb7b8656ebc2dd6ba6d0da728bc65bf40.tar.gz u-boot-imx-e58780dcb7b8656ebc2dd6ba6d0da728bc65bf40.tar.bz2 |
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/dm')
-rw-r--r-- | test/dm/eth.c | 24 | ||||
-rw-r--r-- | test/dm/test.dts | 4 |
2 files changed, 27 insertions, 1 deletions
diff --git a/test/dm/eth.c b/test/dm/eth.c index 04ccf49..5688b71 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 762ddc3..0ab0916 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 = ð_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>; |