]> Git Repo - J-u-boot.git/blame - test/dm/phys2bus.c
Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""
[J-u-boot.git] / test / dm / phys2bus.c
CommitLineData
30b20e6b
NSJ
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (c) 2020 Nicolas Saenz Julienne <[email protected]>
4 */
5
d678a59d 6#include <common.h>
30b20e6b
NSJ
7#include <dm.h>
8#include <mapmem.h>
9#include <phys2bus.h>
10#include <dm/device.h>
11#include <dm/ofnode.h>
12#include <dm/root.h>
13#include <dm/test.h>
14#include <dm/uclass-internal.h>
15#include <test/ut.h>
16
17static int dm_test_phys_to_bus(struct unit_test_state *uts)
18{
19 struct udevice *dev;
20 ofnode node;
21
22 node = ofnode_path("/mmio-bus@0");
23 ut_assert(ofnode_valid(node));
24 ut_assertok(uclass_get_device_by_ofnode(UCLASS_TEST_BUS, node, &dev));
25 /* In this case it should be transparent, no dma-ranges in parent bus */
26 ut_asserteq_addr((void*)0xfffffULL, (void*)dev_phys_to_bus(dev, 0xfffff));
27 ut_asserteq_addr((void*)0xfffffULL, (void*)(ulong)dev_bus_to_phys(dev, 0xfffff));
28
29 node = ofnode_path("/mmio-bus@0/subnode@0");
30 ut_assert(ofnode_valid(node));
31 ut_assertok(uclass_get_device_by_ofnode(UCLASS_TEST_FDT, node, &dev));
32 ut_asserteq_addr((void*)0x100fffffULL, (void*)dev_phys_to_bus(dev, 0xfffff));
33 ut_asserteq_addr((void*)0xfffffULL, (void*)(ulong)dev_bus_to_phys(dev, 0x100fffff));
34
35 return 0;
36}
37DM_TEST(dm_test_phys_to_bus, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
This page took 0.098451 seconds and 4 git commands to generate.