Commit graph

12 commits

Author SHA1 Message Date
Rob Herring fb2caa50fb of/selftest: add testcase for nodes with same name and address
Add a test case for nodes which have the same name and same
non-translatable unit address.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
Reviewed-by: Frank Rowand <frank.rowand@sonymobile.com>
2014-05-13 14:11:11 -05:00
Rob Herring 7d1cdc89c5 of/selftest: clean-up of_selftest_platform_populate pass/fail handling
Move the pass/fail checks into selftest() calls instead of a separate if
condition. Unconditionally calling pass was wrong.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Grant Likely <grant.likely@linaro.org>
2014-05-13 14:11:10 -05:00
Rob Herring 82c0f5897a of: selftest: add deferred probe interrupt test
Signed-off-by: Rob Herring <robh@kernel.org>
[grant.likely: fixed failure when root node specifies the interrupt parent]
Signed-off-by: Grant Likely <grant.likely@linaro.org>
2014-04-24 16:58:55 +01:00
Grant Likely 7e66c5c74f of/selftest: Add self tests for manipulation of properties
Adds a few simple test cases to ensure that addition, update and removal
of device tree node properties works correctly.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
2014-03-11 20:48:29 +00:00
Grant Likely 1f42e5dd50 of: Add self test for of_match_node()
Adds a selftest function for the of_match_node function. of_match_node
is supposed to handle precedence for the compatible property as well as
the name and device_type values. This patch adds some test case data and
a function that makes sure each test node matches against the correct
entry of an of_device_id table.

This code was written to verify the new of_match_node() implementation
that is an earlier part of this series.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
Cc: Kevin Hao <haokexin@gmail.com>
2014-02-20 11:52:09 +00:00
Grant Likely 79d9701559 of/irq: create interrupts-extended property
The standard interrupts property in device tree can only handle
interrupts coming from a single interrupt parent. If a device is wired
to multiple interrupt controllers, then it needs to be attached to a
node with an interrupt-map property to demux the interrupt specifiers
which is confusing. It would be a lot easier if there was a form of the
interrupts property that allows for a separate interrupt phandle for
each interrupt specifier.

This patch does exactly that by creating a new interrupts-extended
property which reuses the phandle+arguments pattern used by GPIOs and
other core bindings.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Kumar Gala <galak@codeaurora.org>
[grant.likely: removed versatile platform hunks into separate patch]
Cc: Rob Herring <rob.herring@calxeda.com>
2013-10-28 16:48:14 -07:00
Grant Likely a9f10ca76d of: Add testcases for interrupt parsing
This patch extends the DT selftest code with some test cases for the
interrupt parsing functions.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-10-24 11:43:21 +01:00
Grant Likely bd69f73f2c of: Create function for counting number of phandles in a property
This patch creates of_count_phandle_with_args(), a new function for
counting the number of phandle+argument tuples in a given property. This
is better than the existing method of parsing each phandle individually
until parsing fails which is a horribly slow way to do the count.

Tested on ARM using the selftest code.

v3: - Rebased on top of selftest code cleanup patch
v2: - fix bug where of_parse_phandle_with_args() could behave like _count_.
    - made of_gpio_named_count() into a static inline regardless of CONFIG_OF_GPIO

Tested-by: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
2013-02-13 10:09:31 +00:00
Grant Likely cabb7d5b78 of/selftest: Use selftest() macro throughout
Some of the selftests are open-coded. Others use the selftest() macro
defined in drivers/of/selftest.c. The macro makes for cleaner selftest
code, so refactor the of_parse_phandle_with_args() tests to use it.

Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-13 10:05:58 +00:00
Grant Likely f7f951c298 of/selftest: Fix GPIOs selftest to cover the 7th case
The of_gpio_named_count() self test doesn't hit the out-of-range
condition even though it is coded. Fix the bug by increasing the for
loop range by one.

Reported-by: Andreas Larsson <andreas@gaisler.com>
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2013-02-13 10:05:57 +00:00
Grant Likely 7aff0fe330 of: Add of_property_match_string() to find index into a string list
Add a helper function for finding the index of a string in a string
list property.  This helper is useful for bindings that use a separate
*-name property for attaching names to tuples in another property such
as 'reg' or 'gpios'.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2012-01-28 10:29:20 -07:00
Grant Likely 53a42093d9 of: Add device tree selftests
Add some runtime test cases for the library of device tree parsing functions.

v2: - Add testcase for phandle with 0 args
    - Don't run testcases if testcase data isn't present in device tree

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2011-12-12 13:40:16 -07:00