[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201021123437.21538-5-nsaenzjulienne@suse.de>
Date: Wed, 21 Oct 2020 14:34:34 +0200
From: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
To: robh+dt@...nel.org, catalin.marinas@....com, hch@....de,
ardb@...nel.org, linux-kernel@...r.kernel.org,
Frank Rowand <frowand.list@...il.com>
Cc: robin.murphy@....com, linux-arm-kernel@...ts.infradead.org,
linux-rpi-kernel@...ts.infradead.org, jeremy.linton@....com,
iommu@...ts.linux-foundation.org, devicetree@...r.kernel.org,
will@...nel.org, lorenzo.pieralisi@....com, guohanjun@...wei.com,
Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
Subject: [PATCH v4 4/7] of: unittest: Add test for of_dma_get_max_cpu_address()
Introduce a test for of_dma_get_max_cup_address(), it uses the same DT
data as the rest of dma-ranges unit tests.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
---
Changes since v3:
- Remove HAS_DMA guards
drivers/of/unittest.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 06cc988faf78..b9a4d047a95e 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -869,6 +869,23 @@ static void __init of_unittest_changeset(void)
#endif
}
+static void __init of_unittest_dma_get_max_cpu_address(void)
+{
+ struct device_node *np;
+ phys_addr_t cpu_addr;
+
+ np = of_find_node_by_path("/testcase-data/address-tests");
+ if (!np) {
+ pr_err("missing testcase data\n");
+ return;
+ }
+
+ cpu_addr = of_dma_get_max_cpu_address(np);
+ unittest(cpu_addr == 0x50000000,
+ "of_dma_get_max_cpu_address: wrong CPU addr %pad (expecting %x)\n",
+ &cpu_addr, 0x50000000);
+}
+
static void __init of_unittest_dma_ranges_one(const char *path,
u64 expect_dma_addr, u64 expect_paddr)
{
@@ -3266,6 +3283,7 @@ static int __init of_unittest(void)
of_unittest_changeset();
of_unittest_parse_interrupts();
of_unittest_parse_interrupts_extended();
+ of_unittest_dma_get_max_cpu_address();
of_unittest_parse_dma_ranges();
of_unittest_pci_dma_ranges();
of_unittest_match_node();
--
2.28.0
Powered by blists - more mailing lists