History log of /linux-master/drivers/of/Kconfig
Revision Date Author Comments
# 893ecc6d 16-Feb-2024 Stephen Boyd <sboyd@kernel.org>

of: Add KUnit test to confirm DTB is loaded

Add a KUnit test that confirms a DTB has been loaded, i.e. there is a
root node, and that the of_have_populated_dt() API works properly. We
skip the test when CONFIG_OF_EARLY_FLATREE=n because in that case we
know architecture code hasn't called unflatten_(and_copy_)?device_tree()
which would populate some sort of root node.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Reviewed-by: David Gow <davidgow@google.com>
Cc: Brendan Higgins <brendan.higgins@linux.dev>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20240217010557.2381548-8-sboyd@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>


# 7b937cc2 16-Feb-2024 Frank Rowand <frowand.list@gmail.com>

of: Create of_root if no dtb provided by firmware

When enabling CONFIG_OF on a platform where 'of_root' is not populated
by firmware, we end up without a root node. In order to apply overlays
and create subnodes of the root node, we need one. Create this root node
by unflattening an empty builtin dtb.

If firmware provides a flattened device tree (FDT) then the FDT is
unflattened via setup_arch(). Otherwise, the call to
unflatten(_and_copy)?_device_tree() will create an empty root node.

We make of_have_populated_dt() return true only if the DTB was loaded by
firmware so that existing callers don't change behavior after this
patch. The call in the of platform code is removed because it prevents
overlays from creating platform devices when the empty root node is
used.

[sboyd@kernel.org: Update of_have_populated_dt() to treat this empty dtb
as not populated. Drop setup_of() initcall]

Signed-off-by: Frank Rowand <frowand.list@gmail.com>
Link: https://lore.kernel.org/r/20230317053415.2254616-2-frowand.list@gmail.com
Cc: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20240217010557.2381548-3-sboyd@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>


# 7e08baf6 07-Jul-2023 Baoquan He <bhe@redhat.com>

of: make OF_EARLY_FLATTREE depend on HAS_IOMEM

On s390 systems (aka mainframes), it has classic channel devices for
networking and permanent storage that are currently even more common
than PCI devices. Hence it could have a fully functional s390 kernel
with CONFIG_PCI=n, then the relevant iomem mapping functions
[including ioremap(), devm_ioremap(), etc.] are not available.

In LKP error report at below on s390:
------
ld: kernel/dma/coherent.o: in function `dma_init_coherent_memory':
coherent.c:(.text+0x102): undefined reference to `memremap'
ld: coherent.c:(.text+0x226): undefined reference to `memunmap'
ld: kernel/dma/coherent.o: in function `dma_declare_coherent_memory':
coherent.c:(.text+0x8b8): undefined reference to `memunmap'
ld: kernel/dma/coherent.o: in function `dma_release_coherent_memory':
coherent.c:(.text+0x9aa): undefined reference to `memunmap'
------

In the config file, several Kconfig options are:
------
'# CONFIG_PCI is not set'
CONFIG_OF_EARLY_FLATTREE=y
CONFIG_DMA_DECLARE_COHERENT=y
------

So, enabling OF_EARLY_FLATTREE will select DMA_DECLARE_COHERENT
and cause above building errors even though they are not needed
because CONFIG_PCI is disabled.

Here let OF_EARLY_FLATTREE depend on HAS_IOMEM so that it won't
be built to cause compiling error if PCI is unset.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202306211329.ticOJCSv-lkp@intel.com/
Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: devicetree@vger.kernel.org
Link: https://lore.kernel.org/r/20230707135852.24292-9-bhe@redhat.com
Signed-off-by: Rob Herring <robh@kernel.org>


# c00a60d6 01-Apr-2023 Jiaxun Yang <jiaxun.yang@flygoat.com>

of: address: always use dma_default_coherent for default coherency

As for now all arches have dma_default_coherent reflecting default
DMA coherency for of devices, so there is no need to have a standalone
config option.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Signed-off-by: Christoph Hellwig <hch@lst.de>


# f381b31a 12-Feb-2023 Frank Rowand <frowand.list@gmail.com>

of: update kconfig unittest help

Add more information about the impact the of unittests have on the
live devicetree and why the tests should only be enabled for developer
kernels.

Add information about processing the test output such that the
results are more complete and comprehendable.

Signed-off-by: Frank Rowand <frowand.list@gmail.com>
Link: https://lore.kernel.org/r/20230213185702.395776-4-frowand.list@gmail.com
Signed-off-by: Rob Herring <robh@kernel.org>


# e330fb14 06-Oct-2021 Jakub Kicinski <kuba@kernel.org>

of: net: move of_net under net/

Rob suggests to move of_net.c from under drivers/of/ somewhere
to the networking code.

Suggested-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 1ee292a6 27-May-2021 Rob Herring <robh@kernel.org>

of: Drop reserved mem dependency on DMA_DECLARE_COHERENT and DMA_CMA

Reserved memory regions can be used for more than just DMA regions, so
only enabling on DMA_DECLARE_COHERENT (via HAS_DMA) or DMA_CMA is wrong.
This effectively doesn't matter except for the few cases arches select
NO_DMA.

At least, these users of RESERVEDMEM_OF_DECLARE depend on reserved memory
support:

arch/riscv/mm/init.c:RESERVEDMEM_OF_DECLARE(elfcorehdr, "linux,elfcorehdr", elfcore_hdr_setup);
drivers/memory/tegra/tegra210-emc-table.c:RESERVEDMEM_OF_DECLARE(tegra210_emc_table, "nvidia,tegra210-emc-table",
drivers/soc/fsl/qbman/bman_ccsr.c:RESERVEDMEM_OF_DECLARE(bman_fbpr, "fsl,bman-fbpr", bman_fbpr);
drivers/soc/fsl/qbman/qman_ccsr.c:RESERVEDMEM_OF_DECLARE(qman_fqd, "fsl,qman-fqd", qman_fqd);
drivers/soc/fsl/qbman/qman_ccsr.c:RESERVEDMEM_OF_DECLARE(qman_pfdr, "fsl,qman-pfdr", qman_pfdr);

Let's simplify things and enable OF_RESERVED_MEM when OF_EARLY_FLATTREE is
enabled.

Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210527223217.1572631-1-robh@kernel.org


# 14b26b12 08-Oct-2020 Calvin Johnson <calvin.johnson@oss.nxp.com>

net: phy: Move of_mdio from drivers/of to drivers/net/mdio

Better place for of_mdio.c is drivers/net/mdio.
Move of_mdio.c from drivers/of to drivers/net/mdio

Signed-off-by: Calvin Johnson <calvin.johnson@oss.nxp.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>


# dabf6b36 26-Jan-2020 Michael Ellerman <mpe@ellerman.id.au>

of: Add OF_DMA_DEFAULT_COHERENT & select it on powerpc

There's an OF helper called of_dma_is_coherent(), which checks if a
device has a "dma-coherent" property to see if the device is coherent
for DMA.

But on some platforms devices are coherent by default, and on some
platforms it's not possible to update existing device trees to add the
"dma-coherent" property.

So add a Kconfig symbol to allow arch code to tell
of_dma_is_coherent() that devices are coherent by default, regardless
of the presence of the property.

Select that symbol on powerpc when NOT_COHERENT_CACHE is not set, ie.
when the system has a coherent cache.

Fixes: 92ea637edea3 ("of: introduce of_dma_is_coherent() helper")
Cc: stable@vger.kernel.org # v3.16+
Reported-by: Christian Zigotzky <chzigotzky@xenosoft.de>
Tested-by: Christian Zigotzky <chzigotzky@xenosoft.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>


# ff4c25f2 03-Feb-2019 Christoph Hellwig <hch@lst.de>

dma-mapping: improve selection of dma_declare_coherent availability

This API is primarily used through DT entries, but two architectures
and two drivers call it directly. So instead of selecting the config
symbol for random architectures pull it in implicitly for the actual
users. Also rename the Kconfig option to describe the feature better.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Paul Burton <paul.burton@mips.com> # MIPS
Acked-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 34e04eed 01-Feb-2019 Christoph Hellwig <hch@lst.de>

of: select OF_RESERVED_MEM automatically

The OF_RESERVED_MEM can be used if we have either CMA or the generic
declare coherent code built and we support the early flattened DT.

So don't bother making it a user visible options that is selected
by most configs that fit the above category, but just select it when
the requirements are met.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Rob Herring <robh@kernel.org>


# 39a751a4 12-Feb-2018 Frank Rowand <frank.rowand@sony.com>

of: change overlay apply input data from unflattened to FDT

Move duplicating and unflattening of an overlay flattened devicetree
(FDT) into the overlay application code. To accomplish this,
of_overlay_apply() is replaced by of_overlay_fdt_apply().

The copy of the FDT (aka "duplicate FDT") now belongs to devicetree
code, which is thus responsible for freeing the duplicate FDT. The
caller of of_overlay_fdt_apply() remains responsible for freeing the
original FDT.

The unflattened devicetree now belongs to devicetree code, which is
thus responsible for freeing the unflattened devicetree.

These ownership changes prevent early freeing of the duplicated FDT
or the unflattened devicetree, which could result in use after free
errors.

of_overlay_fdt_apply() is a private function for the anticipated
overlay loader.

Update unittest.c to use of_overlay_fdt_apply() instead of
of_overlay_apply().

Move overlay fragments from artificial locations in
drivers/of/unittest-data/tests-overlay.dtsi into one devicetree
source file per overlay. This led to changes in
drivers/of/unitest-data/Makefile and drivers/of/unitest.c.

- Add overlay directives to the overlay devicetree source files so
that dtc will compile them as true overlays into one FDT data
chunk per overlay.

- Set CFLAGS for drivers/of/unittest-data/testcases.dts so that
symbols will be generated for overlay resolution of overlays
that are no longer artificially contained in testcases.dts

- Unflatten and apply each unittest overlay FDT using
of_overlay_fdt_apply().

- Enable the of_resolve_phandles() check for whether the unflattened
overlay is detached. This check was previously disabled because the
overlays from tests-overlay.dtsi were not unflattened into detached
trees.

- Other changes to unittest.c infrastructure to manage multiple test
FDTs built into the kernel image (access by name instead of
arbitrary number).

- of_unittest_overlay_high_level(): previously unused code to add
properties from the overlay_base devicetree to the live tree
was triggered by the restructuring of tests-overlay.dtsi and thus
testcases.dts. This exposed two bugs: (1) the need to dup a
property before adding it, and (2) property 'name' is
auto-generated in the unflatten code and thus will be a duplicate
in the __symbols__ node - do not treat this duplicate as an error.

Signed-off-by: Frank Rowand <frank.rowand@sony.com>


# 4670d610 17-Jan-2018 Rob Herring <robh@kernel.org>

PCI: Move OF-related PCI functions into PCI core

Following what has been done for other subsystems, move the remaining PCI
related code out of drivers/of/ and into drivers/pci/of.c

With this, we can kill a few kconfig symbols.

Signed-off-by: Rob Herring <robh@kernel.org>
[bhelgaas: minor whitespace, comment cleanups]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Frank Rowand <frowand.list@gmail.com>


# af6074fc 26-Dec-2017 Rob Herring <robh@kernel.org>

of: Use SPDX license tag for DT files

Convert remaining DT files to use SPDX-License-Identifier tags.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Reviewed-by: Frank Rowand <frank.rowand@sony.com>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Rob Herring <robh@kernel.org>


# 6019a3d0 25-Jul-2017 Rob Herring <robh@kernel.org>

of: enable unittests on UML

The unittests can run on UML, but OF_IRQ and OF_ADDRESS need to be
enabled. Rework the kconfig dependencies to enable the unittests. The
unittests cannot build on Sparc, so we need to add an explicit
dependency for !SPARC.

There's one failure in overlay tests because the base DT is not
unflattened early.

Cc: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Rob Herring <robh@kernel.org>


# b56b5528 04-Oct-2017 Rob Herring <robh@kernel.org>

of: make kobject and bin_attribute support configurable

Having device_nodes be kobjects is only needed if sysfs or OF_DYNAMIC is
enabled. Otherwise, having a kobject in struct device_node is
unnecessary bloat in minimal kernel configurations.

Likewise, bin_attribute is only needed in struct property when sysfs is
enabled, so we can make it configurable too.

Tested-by: Nicolas Pitre <nico@linaro.org>
Reviewed-by: Frank Rowand <frowand.list@gmail.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Rob Herring <robh@kernel.org>


# a9843193 17-Sep-2016 Boris Brezillon <bbrezillon@kernel.org>

mtd: Kill the OF_MTD Kconfig option

Commit d48f62b9a0a0 ("mtd: nand: move of_get_nand_xxx() helpers into
nand_base.c") removed the drivers/of/of_mtd.c file but did not remove
the associated OF_MTD Kconfig option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>


# a5e4bd99 24-Jun-2016 Arnd Bergmann <arnd@arndb.de>

of_mdio: select fixed phy support unconditionally

Calling the fixed-phy functions when CONFIG_FIXED_PHY=m as a previous
change tried cannot work if the caller is in built-in code:

drivers/of/built-in.o: In function `of_phy_register_fixed_link':
of_reserved_mem.c:(.text+0x85e0): undefined reference to `fixed_phy_register'

Making of_mdio depend on 'FIXED_PHY || !FIXED_PHY' would solve this
dependency by enforcing that OF_MDIO itself becomes a loadable module
when FIXED_PHY=y, but that creates a different dependency as it
breaks any built-in ethernet driver that uses of_mdio.

Making FIXED_PHY a bool option also cannot work, since it depends on
PHYLIB, which again is tristate.

This version now uses 'select FIXED_PHY' to ensure that the fixed-phy
portion of of_mdio is not optional. The main downside of this is
a small increase in code size for cases that do not need fixed phy
support, but it should avoid all of the link-time problems.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: d1bd330a229f ("of_mdio: Enable fixed PHY support if driver is a module")
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 298535c0 08-Apr-2016 David Daney <david.daney@cavium.com>

of, numa: Add NUMA of binding implementation.

Add device tree parsing for NUMA topology using device
"numa-node-id" property in distance-map and cpu nodes.

This is a complete rewrite of a previous patch by:
Ganapatrao Kulkarni<gkulkarni@caviumnetworks.com>

Signed-off-by: David Daney <david.daney@cavium.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>


# 1b7c501b 06-Oct-2015 Rob Herring <robh@kernel.org>

of: add config option to enable building of all dtbs

Enable building all dtb files when CONFIG_OF_ALL_DTBS is enabled. The dtbs
are not really dependent on a platform being enabled or any other kernel
config, so for testing coverage it is convenient to build all of the dtbs.

In order to only build dtbs, this option can be used by creating an
allno.config file containing:
CONFIG_COMPILE_TEST=y
CONFIG_OF=y
CONFIG_OF_ALL_DTBS=y

And then running:
make KCONFIG_ALLCONFIG=1 allnoconfig
make dtbs

While building the dtbs themselves don't need a cross compiler, the
scripts dependency does need one. This can be hacked around by
commenting out "subdir-y += mod" in scripts/Makefile.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: Grant Likely <grant.likely@linaro.org>


# 39da809e 05-Jul-2015 Rob Herring <robh@kernel.org>

of: add HAS_IOMEM depends to OF_ADDRESS

On UML builds, of_address.c fails to compile:

../drivers/of/address.c:873:2: error: implicit declaration of function ‘ioremap’ [-Werror=implicit-function-declaration]

This is due to CONFIG_OF now being user selectable. Add a dependency on
HAS_IOMEM to OF_ADDRESS in order to fix this.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Grant Likely <grant.likely@linaro.org>


# 649e0a77 27-May-2015 Rob Herring <robh@kernel.org>

of: make unittest select OF_EARLY_FLATTREE instead of depend on it

The DT unittest currently requires an arch (typically) to select
OF_EARLY_FLATTREE. Remove this dependency by selecting it directly so that
the unittest can be enabled easily on any architecture. With this and the
prior commit, we can easily enable and run unittests starting with x86
defconfig rather than hunting for the combination of config options to
enable OF on x86.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Grant Likely <grant.likely@lianro.org>


# 0166dc11 27-May-2015 Rob Herring <robh@kernel.org>

of: make CONFIG_OF user selectable

With the addition of overlays, it is now plausible to use DT on any arch
and without an arch using it at boot time. It is also desirable to
expand the compile coverage of the DT code. Make CONFIG_OF user
selectable by converting the menu to menuconfig.

Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Grant Likely <grant.likely@lianro.org>


# 63c60e3a 05-Apr-2015 Geert Uytterhoeven <geert@linux-m68k.org>

of: OF_IRQ should depend on IRQ_DOMAIN

If CONFIG_IRQ_DOMAIN=n:

drivers/of/irq.c: In function ‘of_irq_get’:
drivers/of/irq.c:406: error: implicit declaration of function ‘irq_find_host’
drivers/of/irq.c:406: warning: assignment makes pointer from integer without a cast
make[2]: *** [drivers/of/irq.o] Error 1

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Rob Herring <robh@kernel.org>


# 121c92ca 23-Jan-2015 Geert Uytterhoeven <geert+renesas@glider.be>

of: Allow selection of OF_DYNAMIC and OF_OVERLAY if OF_UNITTEST

Currently OF_DYNAMIC and OF_OVERLAY are not visible to the user, and are
selected automatically only when needed.

Allow them to be enabled manually to improve device tree unit test
coverage.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Grant Likely <grant.likely@linaro.org>


# 388404a3 15-Feb-2015 Matwey V. Kornilov <matwey@sai.msu.ru>

of: Drop superfluous dependance for OF_OVERLAY

The whole menu already depends on OF, so there is no need to additionaly specify it.

Suggested-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru>
Signed-off-by: Rob Herring <robh@kernel.org>


# 5c776064 15-Feb-2015 Matwey V. Kornilov <matwey@sai.msu.ru>

of: Add prompt for OF_OVERLAY config

Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru>
Signed-off-by: Rob Herring <robh@kernel.org>


# 3ce04b4a 11-Jan-2015 Gaurav Minocha <gaurav.minocha.os@gmail.com>

Removes OF_UNITTEST dependency on OF_DYNAMIC config symbol

This patch intends to remove the unittests dependency on
the functions defined in dynamic.c. So, rather than calling
of_attach_node defined in dynamic.c, minimal functionality
required to attach a new node is re-defined in unittest.c.
Also, now after executing the tests the test data is not
removed from the device tree so there is no need to call
of_detach_node.

Tested with and without OF_DYNAMIC enabled on ppc, arm and
x86

Signed-off-by: Gaurav Minocha <gaurav.minocha.os@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>


# 65d473b8 26-Nov-2014 Grant Likely <grant.likely@linaro.org>

of: remove select of non-existant OF_DEVICE config symbol

The OF_OVERLAY option selects OF_DEVICE, but OF_DEVICE was removed in
commit ba166e900b, "of: remove CONFIG_OF_DEVICE". Remove the unnecessary
select.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
Reported-by: Paul Bolle <pebolle@tiscali.nl>
Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>


# 7518b589 28-Oct-2014 Pantelis Antoniou <pantelis.antoniou@konsulko.com>

of/overlay: Introduce DT overlay support

Overlays are a method to dynamically modify part of the kernel's
device tree with dynamically loaded data. Add the core functionality to
parse, apply and remove an overlay changeset. The core functionality
takes care of managing the overlay data format and performing the add
and remove. Drivers are expected to use the overlay functionality to
support custom expansion busses commonly found on consumer development
boards like the BeagleBone or Raspberry Pi.

The overlay code uses CONFIG_OF_DYNAMIC changesets to perform the low
level work of modifying the devicetree.

Documentation about internal and APIs is provided in
Documentation/devicetree/overlay-notes.txt

v2:
- Switch from __of_node_alloc() to __of_node_dup()
- Documentation fixups
- Remove 2-pass processing of properties
- Remove separate ov_lock; just use the DT mutex.
v1:
- Drop delete capability using '-' prefix. The '-' prefixed names
are valid properties and nodes and there is no need for it just yet.
- Do not update special properties - name & phandle ones.
- Change order of node attachment, so that the special property update
works.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>


# 08d53aa5 14-Nov-2014 Ard Biesheuvel <ardb@kernel.org>

of/fdt: export fdt blob as /sys/firmware/fdt

Create a new /sys entry '/sys/firmware/fdt' to export the FDT blob
that was passed to the kernel by the bootloader. This allows userland
applications such as kexec to access the raw binary.

The fact that this node does not reside under /sys/firmware/device-tree
is deliberate: FDT is also used on arm64 UEFI/ACPI systems to
communicate just the UEFI and ACPI entry points, but the FDT is never
unflattened and used to configure the system.

A CRC32 checksum is calculated over the entire FDT blob, and verified
at late_initcall time. The sysfs entry is instantiated only if the
checksum is valid, i.e., if the FDT blob has not been modified in the
mean time. Otherwise, a warning is printed.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Grant Likely <grant.likely@linaro.org>


# 19fd7487 04-Nov-2014 Grant Likely <grant.likely@linaro.org>

of/unittest: Rename selftest.c to unittest.c

This is unit testing code. It should use that name because it makes more
sense than 'selftest'. Rename the files to match and rename the config
variable.

Signed-off-by: Grant Likely <grant.likely@linaro.org>


# 2eb46da2 02-Oct-2014 Grant Likely <grant.likely@linaro.org>

of/selftest: Use the resolver to fixup phandles

The selftest data ends up causing duplicate phandles in the live tree
for the time that the testcase data is inserted into the live tree. This
is obviously a bad situation because anything attempting to read the
tree while the selftests are running make resolve phandles to one of the
testcase data nodes. Fix the problem by using the of_resolve_phandles()
function to eliminate duplicates.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: Gaurav Minocha <gaurav.minocha.os@gmail.com>


# 7941b27b 04-Jul-2014 Pantelis Antoniou <pantelis.antoniou@konsulko.com>

of: Introduce Device Tree resolve support.

Introduce support for dynamic device tree resolution.
Using it, it is possible to prepare a device tree that's
been loaded on runtime to be modified and inserted at the kernel
live tree.

Export of of_resolve and bug fix of double free by
Guenter Roeck <groeck@juniper.net>

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
[grant.likely: Don't need to select CONFIG_OF_DYNAMIC and CONFIG_OF_DEVICE]
[grant.likely: Don't need to depend on OF or !SPARC]
[grant.likely: Factor out duplicate code blocks into single function]
Signed-off-by: Grant Likely <grant.likely@linaro.org>


# 32147e9a 25-Jul-2014 Gaurav Minocha <gaurav.minocha.os@gmail.com>

of: Fixing OF Selftest build error

This patch is to fix following error while compiling OF selftests.
"drivers/of/selftest.c:617:2: error: implicit declaration of function
'of_fdt_unflatten_tree'"

Now, CONFIG_OF_SELFTEST depends on CONFIG_OF_EARLY_FLATTREE so that the
broken configuration cannot be selected. Ultimately it would be a good
idea to allow CONFIG_OF_SELFTEST to select CONFIG_OF_EARLY_FLATTREE, but
there is a dependency problem on i386 and x86_64 that causes dtc to not
get built and causes the build to fail. That problem needs to be fixed
first.

Signed-off-by: Gaurav Minocha <gaurav.minocha.os@gmail.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>


# ae9304c9 17-Jul-2014 Gaurav Minocha <gaurav.minocha.os@gmail.com>

Adding selftest testdata dynamically into live tree

This patch attaches selftest's device tree data (required by /drivers/of/selftest.c)
dynamically into live device tree. First, it links selftest device tree data into the
kernel image and then iterates over all the nodes and attaches them into the live tree.
Once the testcases are complete, it removes the data attached.

This patch will remove the manual process of addition and removal of selftest device
tree data into the machine's dts file.

Tested successfully with current selftest's testcases.

Signed-off-by: Gaurav Minocha <gaurav.minocha.os@gmail.com>
[glikely: Removed ability to build as a module and fixed no-devicetree bug]
Signed-off-by: Grant Likely <grant.likely@linaro.org>


# e6a6928c 02-Apr-2014 Rob Herring <robh@kernel.org>

of/fdt: Convert FDT functions to use libfdt

The kernel FDT functions predate libfdt and are much more limited in
functionality. Also, the kernel functions and libfdt functions are
not compatible with each other because they have different definitions
of node offsets. To avoid this incompatibility and in preparation to
add more FDT parsing functions which will need libfdt, let's first
convert the existing code to use libfdt.

The FDT unflattening, top-level FDT scanning, and property retrieval
functions are converted to use libfdt. The scanning code should be
re-worked to be more efficient and understandable by using libfdt to
find nodes directly by path or compatible strings.

Signed-off-by: Rob Herring <robh@kernel.org>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Tested-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Stephen Chivers <schivers@csc.com>


# 8357041a 06-Nov-2012 Grant Likely <grant.likely@secretlab.ca>

of: remove /proc/device-tree

The same data is now available in sysfs, so we can remove the code
that exports it in /proc and replace it with a symlink to the sysfs
version.

Tested on versatile qemu model and mpc5200 eval board. More testing
would be appreciated.

v5: Fixed up conflicts with mainline changes

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
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>


# 3f0c8206 28-Feb-2014 Marek Szyprowski <m.szyprowski@samsung.com>

drivers: of: add initialization code for dynamic reserved memory

This patch adds support for dynamically allocated reserved memory regions
declared in device tree. Such regions are defined by 'size', 'alignment'
and 'alloc-ranges' properties.

Based on previous code provided by Josh Cartwright <joshc@codeaurora.org>

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>


# 25a31579 19-Feb-2014 Gregory CLEMENT <gregory.clement@bootlin.com>

of: Allows to use the PCI translator without the PCI core

Translating an address from a PCI node of the device-tree into a CPU
physical address doesn't require the core PCI support. Those
translations are just related to the device tree itself.

The use case to translate an address from a PCI node without actually
using the PCI core support is when one needs to access the PCI
controller without accessing any PCI devices.

Marvell SoCs, such as Kirkwood, Dove or Armada XP for instance, come
with an IP of a PCI controller. In the registers of this controller
are stored the ID and the revision of a SoC. With this patch it will
be possible to read the SoC ID of a board without any PCI device and
then without the PCI core support.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Reviewed-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>


# dee21420 24-Dec-2013 Geert Uytterhoeven <geert+renesas@linux-m68k.org>

of/Kconfig: Spelling s/one/once/

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 5d927086 24-Dec-2013 Geert Uytterhoeven <geert+renesas@linux-m68k.org>

of/Kconfig: Spelling s/one/once/

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Rob Herring <robh@kernel.org>


# f5ae18ec 07-Nov-2013 Rob Herring <rob.herring@calxeda.com>

dt: disable self-tests for !OF_IRQ

Fix OF selftest compile on sparc which does not enable OF_IRQ.

drivers/of/selftest.c:177: undefined reference to `of_irq_parse_one'
drivers/of/selftest.c:197: undefined reference to `of_irq_parse_one'
drivers/of/selftest.c:248: undefined reference to `of_irq_parse_one'

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Grant Likely <grant.likely@linaro.org>


# 1931ee14 11-Oct-2013 Marek Szyprowski <m.szyprowski@samsung.com>

Revert "drivers: of: add initialization code for dma reserved memory"

This reverts commit 9d8eab7af79cb4ce2de5de39f82c455b1f796963. There is
still no consensus on the bindings for the reserved memory and various
drawbacks of the proposed solution has been shown, so the best now is to
revert it completely and start again from scratch later.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>


# 9d8eab7a 26-Aug-2013 Marek Szyprowski <m.szyprowski@samsung.com>

drivers: of: add initialization code for dma reserved memory

This patch adds device tree support for contiguous and reserved memory
regions defined in device tree.

Large memory blocks can be reliably reserved only during early boot.
This must happen before the whole memory management subsystem is
initialized, because we need to ensure that the given contiguous blocks
are not yet allocated by kernel. Also it must happen before kernel
mappings for the whole low memory are created, to ensure that there will
be no mappings (for reserved blocks) or mapping with special properties
can be created (for CMA blocks). This all happens before device tree
structures are unflattened, so we need to get reserved memory layout
directly from fdt.

Later, those reserved memory regions are assigned to devices on each
device structure initialization.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Acked-by: Tomasz Figa <t.figa@samsung.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Rob Herring <rob.herring@calxeda.com>


# 687b81d0 10-Jul-2013 Wolfram Sang <wsa@kernel.org>

i2c: move OF helpers into the core

I2C of helpers used to live in of_i2c.c but experience (from SPI) shows
that it is much cleaner to have this in the core. This also removes a
circular dependency between the helpers and the core, and so we can
finally register child nodes in the core instead of doing this manually
in each driver. So, fix the drivers and documentation, too.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# ba166e90 19-Apr-2013 Rob Herring <rob.herring@calxeda.com>

of: remove CONFIG_OF_DEVICE

CONFIG_OF_DEVICE is always selected when CONFIG_OF is enabled, so remove
it and simplify of_platform.h and of_device.h headers. This also fixes
!OF compiles using of_platform_populate.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Grant Likely <grant.likely@linaro.org>


# 476ab8fb 03-Dec-2012 Andreas Larsson <andreas@gaisler.com>

of_i2c: sparc: Allow OF_I2C for sparc

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# d57a4282 07-Apr-2012 Grant Likely <grant.likely@secretlab.ca>

spi/devicetree: Move devicetree support code into spi directory

The SPI device tree support code isn't shared by any other subsystem. It can
be moved into the core drivers/spi directory and the exported symbol can be
removed.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>


# f141ed65 07-Apr-2012 Grant Likely <grant.likely@secretlab.ca>

gpio: Move DT support code into drivers/gpio

The code in drivers/of/gpio.c isn't shared by any other subsystem since it
is all gpiolib specific. drivers/gpio is a better place to maintain these
functions.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Linus Walleij <linus.walleij@stericsson.com>


# 770d7c39 27-Jan-2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

of/mtd/nand: add generic bindings and helpers

- nand-ecc-mode : String, operation mode of the NAND ecc mode.
Supported values are: "none", "soft", "hw", "hw_syndrome", "hw_oob_first",
"soft_bch".
- nand-bus-width : 8 or 16 bus width if not present 8
- nand-on-flash-bbt: boolean to enable on flash bbt option if not present false

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Stefan Roese <sr@denx.de>


# 0f22dd39 15-Feb-2012 Grant Likely <grant.likely@secretlab.ca>

of: Only compile OF_DYNAMIC on PowerPC pseries and iseries

Only two architectures use the OF node reference counting and reclaim bits.
There is no need to compile it for the rest of the PowerPC platforms or for
any of the other architectures. This patch makes iseries and pseries
select CONFIG_OF_DYNAMIC, and makes it default to off for everything else.

It is still safe to turn on CONFIG_OF_DYNAMIC on all architectures, it just
isn't necessary.

v2: Also select OF_DYNAMIC for PPC_CHROMA and MPC885ADS as reported by Michael
Meuling

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Jimi Xenidis <jimix@pobox.com> (for PPC_CHROMA bug fix)
Cc: Rob Herring <rob.herring@calxeda.com>


# 53a42093 12-Dec-2011 Grant Likely <grant.likely@secretlab.ca>

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>


# 98d9f30c8 10-Apr-2011 Benjamin Herrenschmidt <benh@kernel.crashing.org>

pci/of: Match PCI devices to OF nodes dynamically

powerpc has two different ways of matching PCI devices to their
corresponding OF node (if any) for historical reasons. The ppc64 one
does a scan looking for matching bus/dev/fn, while the ppc32 one does a
scan looking only for matching dev/fn on each level in order to be
agnostic to busses being renumbered (which Linux does on some
platforms).

This removes both and instead moves the matching code to the PCI core
itself. It's the most logical place to do it: when a pci_dev is created,
we know the parent and thus can do a single level scan for the matching
device_node (if any).

The benefit is that all archs now get the matching for free. There's one
hook the arch might want to provide to match a PHB bus to its device
node. A default weak implementation is provided that looks for the
parent device device node, but it's not entirely reliable on powerpc for
various reasons so powerpc provides its own.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Michal Simek <monstr@monstr.eu>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>


# 96e0a079 22-Feb-2011 Sebastian Andrzej Siewior <bigeasy@linutronix.de>

x86: dtb: Add support for PCI devices backed by dtb nodes

x86_of_pci_init() does two things:

- it provides a generic irq enable and disable function. enable queries
the device tree for the interrupt information, calls ->xlate on the
irq host and updates the pci->irq information for the device.

- it walks through PCI bus(es) in the device tree and adds its children
(device) nodes to appropriate pci_dev nodes in kernel. So the dtb
node information is available at probe time of the PCI device.

Adding a PCI bus based on the information in the device tree is
currently not supported. Right now direct access via ioports is used.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Tested-by: Dirk Brandewie <dirk.brandewie@gmail.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Cc: sodaville@linutronix.de
Cc: devicetree-discuss@lists.ozlabs.org
LKML-Reference: <1298405266-1624-8-git-send-email-bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>


# 04bea68b 23-Jan-2011 Sebastian Andrzej Siewior <sebastian@breakpoint.cc>

of/pci: move of_irq_map_pci() into generic code

There is a tiny difference between PPC32 and PPC64. Microblaze uses the
PPC32 variant.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
[grant.likely@secretlab.ca: Added comment to #endif, moved documentation
block to function implementation, fixed for non ppc and microblaze
compiles]
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>


# e6ce1324 18-Nov-2010 Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>

of/flattree: Add Kconfig for EARLY_FLATTREE

The device tree code is now in two pieces: some which can be used generically
on any platform which selects CONFIG_OF_FLATTREE, and some early which is used
at boot time on only a few architectures. This patch segregates the early
code so that only those architectures which care about it need compile it.
This also means that some of the requirements in the early code (such as
a cmd_line variable) that most architectures (e.g. X86) don't provide
can be ignored.

Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
[grant.likely@secretlab.ca: remove extra blank line addition]
[grant.likely@secretlab.ca: fixed incorrect #ifdef CONFIG_EARLY_FLATTREE check]
[grant.likely@secretlab.ca: Made OF_EARLY_FLATTREE select instead of depend
on OF_FLATTREE]
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>


# 4b6ba8aa 26-Oct-2010 David Daney <ddaney@caviumnetworks.com>

of/net: Move of_get_mac_address() to a common source file.

There are two identical implementations of of_get_mac_address(), one
each in arch/powerpc/kernel/prom_parse.c and
arch/microblaze/kernel/prom_parse.c. Move this function to a new
common file of_net.{c,h} and adjust all the callers to include the new
header.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
[grant.likely@secretlab.ca: protect header with #ifdef]
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>


# 3cfc535c 10-Oct-2010 Andres Salomon <dilinger@queued.net>

of/promtree: make drivers/of/pdt.c no longer sparc-only

Clean up pdt.c:
- make build dependent upon config OF_PROMTREE
- #ifdef out the sparc-specific stuff
- create pdt-specific header

Signed-off-by: Andres Salomon <dilinger@queued.net>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>


# ef2a4524 28-Jun-2010 Andres Salomon <dilinger@queued.net>

proc: unify PROC_DEVICETREE config

Microblaze and PPC both use PROC_DEVICETREE, and OLPC will as well.. put
the Kconfig option into fs/ rather than in arch/*/Kconfig.

Signed-off-by: Andres Salomon <dilinger@queued.net>
[grant.likely@secretlab.ca: changed depends to PROC_FS && !SPARC]
[grant.likely@secretlab.ca: moved to drivers/of/Kconfig]
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>


# 5ab5fc7e 05-Jul-2010 Grant Likely <grant.likely@secretlab.ca>

of: Put all CONFIG_OF dependencies into a Kconfig menu block

All of the options in drivers/of/Kconfig depend on CONFIG_OF. Putting
all of them inside a menu block simplifies the dependency statements.
It also creates a logical group for adding user selectable OF options.

This patch also changes (PPC_OF || MICROBLAZE) statements to (!SPARC)
so that those options are available to other architectures (and in
fact the !SPARC conditions should probably be re-evalutated since the
code is more generic now)

This patch also moves the definition of CONFIG_DTC from arch/* to
drivers/of/Kconfig

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>


# bcbefae2 28-Jun-2010 Stephen Rothwell <sfr@canb.auug.org.au>

of: define CONFIG_OF globally so architectures can select it

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>


# 9fd04992 08-Jun-2010 Grant Likely <grant.likely@secretlab.ca>

of/i2c: Generalize OF support

This patch cleans up the i2c OF support code to make it selectable by
all architectures and allow for automatic registration of i2c devices.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>


# 6b884a8d 08-Jun-2010 Grant Likely <grant.likely@secretlab.ca>

of/address: merge of_iomap()

Merge common code between Microblaze and PowerPC. This patch creates
new of_address.h and address.c files to containing address translation
and mapping routines. First routine to be moved it of_iomap()

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Michal Simek <monstr@monstr.eu>
CC: Stephen Rothwell <sfr@canb.auug.org.au>


# e3873444 18-Jun-2010 Grant Likely <grant.likely@secretlab.ca>

of/irq: Move irq_of_parse_and_map() to common code

Merge common code between PowerPC and Microblaze. SPARC implements
irq_of_parse_and_map(), but the implementation is different, so it
does not use this code.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michal Simek <monstr@monstr.eu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Jeremy Kerr <jeremy.kerr@canonical.com>


# fcdeb7fe 29-Jan-2010 Grant Likely <grant.likely@secretlab.ca>

of: merge of_attach_node() & of_detach_node()

Merge common code between PowerPC and Microblaze

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>


# e169cfbe 23-Nov-2009 Grant Likely <grant.likely@secretlab.ca>

of/flattree: merge find_flat_dt_string and initial_boot_params

Merge common code between Microblaze and PowerPC.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Tested-by: Michal Simek <monstr@monstr.eu>


# 6fa612b5 11-May-2009 Michal Simek <monstr@monstr.eu>

microblaze: Kconfig: Enable drivers for Microblaze

Signed-off-by: Michal Simek <monstr@monstr.eu>


# 8bc487d1 24-Apr-2009 Grant Likely <grant.likely@secretlab.ca>

openfirmware: Add OF phylib support code

Add support for parsing the device tree for PHY devices on an MDIO bus.
Currently many of the PowerPC ethernet drivers are open coding a solution
for reading data out of the device tree to find the correct PHY device.
This patch implements a set of common routines to:

a) let MDIO bus drivers register phy_devices described in the tree, and
b) let MAC drivers find the correct phy_device via the tree.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 284b0189 16-May-2008 Grant Likely <grant.likely@secretlab.ca>

spi: Add OF binding support for SPI busses

This patch adds support for populating an SPI bus based on data in the
OF device tree. This is useful for powerpc platforms which use the
device tree instead of discrete code for describing platform layout.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>


# 7444a72e 25-Jul-2008 Michael Buesch <mb@bu3sch.de>

gpiolib: allow user-selection

This patch adds functionality to the gpio-lib subsystem to make it
possible to enable the gpio-lib code even if the architecture code didn't
request to get it built in.

The archtitecture code does still need to implement the gpiolib accessor
functions in its asm/gpio.h file. This patch adds the implementations for
x86 and PPC.

With these changes it is possible to run generic GPIO expansion cards on
every architecture that implements the trivial wrapper functions. Support
for more architectures can easily be added.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: David Brownell <david-b@pacbell.net>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Samuel Ortiz <sameo@openedhand.com>
Cc: Kumar Gala <galak@gate.crashing.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 585468e5 18-Apr-2008 Jochen Friedrich <jochen@scram.de>

[POWERPC] i2c: Fix build breakage introduced by OF helpers

Fix build breakage introduced in commit "[POWERPC] i2c: OF helpers for
the i2c API". If i2c-core is compiled as a module, the helper needs
to be compiled as a module, as well. Rename i2c.c to of_i2c.c to
avoid name space conflict.

[paulus@samba.org: Changed dependency from OF to PPC_OF to avoid
sparc{32,64} allmodconfig breakage.]

Signed-off-by: Jochen Friedrich <jochen@scram.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>


# 612212a3 11-Apr-2008 Jochen Friedrich <jochen@scram.de>

[POWERPC] i2c: OF helpers for the i2c API

This implements various helpers to support OF bindings for the i2c
API.

Signed-off-by: Jochen Friedrich <jochen@scram.de>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>


# 863fbf49 11-Apr-2008 Anton Vorontsov <avorontsov@ru.mvista.com>

[POWERPC] OF helpers for the GPIO API

This implements various helpers to support OF bindings for the GPIO
LIB API.

Previously this was PowerPC specific, but it seems this code isn't
arch-dependent anyhow, so let's place it into of/.

SPARC will not see this addition yet, real hardware seem to not use
GPIOs at all. But this might change:

http://www.leox.org/docs/faq_MLleon.html

"16-bit I/O port" sounds promising. :-)

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Paul Mackerras <paulus@samba.org>


# f85ff305 01-May-2007 Stephen Rothwell <sfr@canb.auug.org.au>

Begin to consolidate of_device.c

This moves all the common parts for the Sparc, Sparc64 and PowerPC
of_device.c files into drivers/of/device.c.

Apart from the simple move, Sparc gains of_match_node() and a call to
of_node_put in of_release_dev(). PowerPC gains better recovery if
device_create_file() fails in of_device_register().

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Paul Mackerras <paulus@samba.org>
Acked-by: David S. Miller <davem@davemloft.net>