aboutsummaryrefslogtreecommitdiff
path: root/drivers
AgeCommit message (Collapse)Author
2015-03-03Merge branch 'linux-linaro-lsk' into linux-linaro-lsk-rtMark Brown
2015-03-03Merge remote-tracking branch 'lsk/v3.10/topic/coresight' into linux-linaro-lskMark Brown
2015-03-02coresight: fix function etm_writel_cp14() parameter orderKaixu Xia
Function etm_writel_cp14() takes an offset and a value rather than the other way around, something this patch is correcting. The semantic remains the same since it is only a function stub. Signed-off-by: Kaixu Xia <xiakaixu@huawei.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 5fb31cd839c21130c0b2524ceb9244e98dfe10e3) Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02coresight-etm: remove check for unknown Kconfig macroPaul Bolle
The CoreSight ETM/PTM driver contains a check for a CONFIG_CORESIGHT_SOURCE_ETM_DEFAULT_ENABLE macro. But there's no related Kconfig symbol CORESIGHT_SOURCE_ETM_DEFAULT_ENABLE. Remove that check and the single line of code it hides. Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 406b9f659fbc966ab47a1fe8f5c1a2e8110483ad) Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02coresight: fixing CPU hwid lookup in device treeMathieu Poirier
Some DT specification will represent CPU nodes with address cells greater than one, making the current code fail. Using the proper retrieval helper function ensure the correct hwid for CPUs is read properly with different address cell size. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 34a03c1d30f04ca7439c685c0ea9b7d79c353705) Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02coresight: remove the extra spacesKaixu Xia
There are some extra spaces, so just remove them from these lines. Signed-off-by: Kaixu Xia <xiakaixu@huawei.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit d786a47de97fd194d6cf4f9087543119b9b330c3) Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02coresight: fix the link between orphan connection and newly added deviceKaixu Xia
When founding a component that has orphan connections, we should validate if it match the newly added device. If it does not match, only then should the @still_orphan flag should be set. The tested result as follows. pre: /sys/bus/coresight/devices # echo 1 > e3c42000.etb/enable_sink /sys/bus/coresight/devices # echo 1 > e3c7c000.ptm/enable_source [ 15.527692] Unable to handle kernel NULL pointer dereference at virtual address 00000124 [ 15.555142] pgd = c2294000 [ 15.564226] [00000124] *pgd=3d393831, *pte=00000000, *ppte=00000000 [ 15.585391] Internal error: Oops: 817 [#1] PREEMPT SMP ARM [ 15.603807] CPU: 0 PID: 144 Comm: sh Not tainted 3.17.0-rc1-12634-g1222fe0-dirty #3 [ 15.629490] task: ed3803c0 ti: c213a000 task.ti: c213a000 [ 15.647627] PC is at coresight_build_paths+0x1c/0x314 [ 15.664579] LR is at coresight_build_paths+0x6c/0x314 [ 15.681526] pc : [<c02da20c>] lr : [<c02da25c>] psr: 20000013 [ 15.681526] sp : c213be88 ip : c02da800 fp : 00000000 [ 15.720023] r10: 00000002 r9 : ed13250c r8 : 00000001 [ 15.737549] r7 : c213bee8 r6 : ffffffea r5 : 00000000 r4 : 00000124 [ 15.759446] r3 : ed216f24 r2 : 00000001 r1 : c213bee8 r0 : 00000000 [ 15.781346] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user post: /sys/bus/coresight/devices # echo 1 > e3c42000.etb/enable_sink /sys/bus/coresight/devices # echo 1 > e3c7c000.ptm/enable_source [ 59.934255] coresight-etb10 e3c42000.etb: ETB enabled [ 59.951317] coresight-replicator replicator0: REPLICATOR enabled [ 59.971581] coresight-funnel e3c41000.funnel: FUNNEL inport 0 enabled [ 59.993334] coresight-etm3x e3c7c000.ptm: ETM tracing enabled Signed-off-by: Kaixu Xia <xiakaixu@huawei.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 22394bc58543639e5135f19eee2b03d14e4a9b66) Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02coresight: fix the replicator subtype valueKaixu Xia
According to the classification, the type of replicator is link, so the subtype should also be link_subtype. Signed-off-by: Kaixu Xia <xiakaixu@huawei.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 410d841a599683408a77f42f110cd17298682520) Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02coresight: fixing validity check on remote deviceKaixu Xia
A validity check should be made on the remote device, i.e rdev, rather than the current device. Signed-off-by: Kaixu Xia <xiakaixu@huawei.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 2ccffaf92e7b7cc9dfa6c3458fc9cb151621680a) Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02coresight: fix comment in of_coresight.cKaixu Xia
Outports is a member of the struct pdata and should be a better choice. Signed-off-by: Kaixu Xia <xiakaixu@huawei.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit f7c55298f17f0bf9d257ea7f2f15cf920248db5b) Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02coresight: fix typo in comment in of_coresight.cKaixu Xia
Debugfs isn't used for coresight configuration, so the corresponding comments should be changed. Signed-off-by: Kaixu Xia <xiakaixu@huawei.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit ff1e33b0c16ba422e3bf3fa8cc7e89b2c958e193) Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02coresight-etm: Fix initial trace ID valueMathieu Poirier
The coresight TRM specify that a component's trace ID should be other than 0. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit b2c09284bbfe36f9ba0e3e8bec8bb3c4789b3911) Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02coresight-tpiu: use module_amba_driver to simplify the codeWei Yongjun
module_amba_driver() makes the code simpler by eliminating boilerplate code. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 3ff7ca051a43bf2dfd1eebdd6c771c4b7a276d8e) Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02coresight-tmc: use module_amba_driver to simplify the codeWei Yongjun
module_amba_driver() makes the code simpler by eliminating boilerplate code. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit d2e580c272d19afff768b56dd0f5d2095cb5a07c) Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02coresight-funnel: use module_amba_driver to simplify the codeWei Yongjun
module_amba_driver() makes the code simpler by eliminating boilerplate code. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit a48f52e185f7f6da2c53f8dd4efda963c32b73f1) Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02coresight-etb: use module_amba_driver to simplify the codeWei Yongjun
module_amba_driver() makes the code simpler by eliminating boilerplate code. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 52d6bbb9b06cac67ec3c016bc9758a1815022b2b) Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02coresight-etm: unlock on error paths in mode_store()Dan Carpenter
There are some missing unlocks on the error paths. Fixes: a939fc5a71ad ('coresight-etm: add CoreSight ETM/PTM driver') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 6ad1095990328e7e4b3a0e260825ad4b6406785a) Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-02-21Merge branch 'linux-linaro-lsk' into linux-linaro-lsk-rtlsk-v3.10-rt-15.02lsk-v3.10-rt-14.02Mark Brown
2015-02-21Merge branch 'lsk/v3.10/topic/of' into linux-linaro-lsklsk-v3.10-15.02lsk-v3.10-14.02Mark Brown
2015-02-21i2c: Mark instantiated device nodes with OF_POPULATEPantelis Antoniou
Mark (and unmark) device nodes with the POPULATE flag as appropriate. This is required to avoid multi probing when using I2C and device overlays containing a mux. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit 6d0a0d9ad09be16e3ca676b245643945b4bff47d) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: drivers/i2c/i2c-core.c
2015-02-21i2c: Mark instantiated device nodes with OF_POPULATEPantelis Antoniou
Mark (and unmark) device nodes with the POPULATE flag as appropriate. This is required to avoid multi probing when using I2C and device overlays containing a mux. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit d5285c36e6d27c1a411a3131c034641a5fa452cb) Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-21i2c/of: Add OF_RECONFIG notifier handlerPantelis Antoniou
CONFIG_OF_DYNAMIC enables runtime changes to the device tree which in turn may trigger addition or removal of devices from Linux. Add an OF_RECONFIG notifier handler to receive tree change events and to creating or destroy i2c devices as required. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> [grant.likely: clean up #ifdefs and drop unneeded error handling] Signed-off-by: Grant Likely <grant.likely@linaro.org> Reviewed-by: Wolfram Sang <wsa@the-dreams.de> Cc: Rob Herring <robh+dt@kernel.org> Cc: linux-i2c@vger.kernel.org (cherry picked from commit ea7513bbc04170f1cbf42953187a4d8b731c71c4) Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-21i2c/of: Factor out Devicetree registration codePantelis Antoniou
Dynamically inserting i2c client device nodes requires the use of a single device registration method. Factor out the loop body of of_i2c_register_devices() so that it can be called for individual device_nodes instead of for all the children of a node. Note: The diff of this commit looks far more complicated than it actually is due the indentation being changed for a large block of code. When viewed using the diff -w flag to ignore whitespace changes it can be seen that the change is actually quite simple. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> [grant.likely: Made new function static and removed changes to header] Signed-off-by: Grant Likely <grant.likely@linaro.org> Reviewed-by: Wolfram Sang <wsa@the-dreams.de> Cc: Rob Herring <robh+dt@kernel.org> Cc: linux-i2c@vger.kernel.org (cherry picked from commit a430a3455f2c48995e06b359a82a1109a419e9ef) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: drivers/i2c/i2c-core.c
2015-02-21i2c: move OF helpers into the coreWolfram Sang
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. [Modified to keep a stub device registration API exposed to drivers in order to avoid disruption] Signed-off-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit 687b81d083c082bc1e853032e3a2a54f8c251d27) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: drivers/i2c/busses/i2c-designware-platdrv.c drivers/i2c/busses/i2c-imx.c drivers/i2c/busses/i2c-stu300.c drivers/i2c/busses/i2c-wmt.c drivers/of/Kconfig drivers/of/Makefile drivers/staging/imx-drm/imx-tve.c sound/soc/fsl/imx-wm8962.c
2015-02-19Merge branch 'linux-linaro-lsk' into linux-linaro-lsk-rtMark Brown
2015-02-19Merge remote-tracking branch 'lsk/v3.10/topic/of' into linux-linaro-lskMark Brown
Conflicts: drivers/of/Makefile
2015-02-17of/overlay: Directly include idr.hMark Brown
The overlay code uses IDRs but does not explicitly include the header providing the interface, instead relying on an implicit inclusion. Make the dependency implict to avoid potential future build issues if the implicit inclusion goes away. Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-17of/platform: Handle of_populate drivers in notifierPantelis Antoniou
When using overlays with drivers calling of_populate the notifier will try to create the device twice. Using the populated bit before proceeding protects against this. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 15204ab1ebc5aba608cd19c83c37b98438b938b0) Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-17of/overlay: Do not generate duplicate nodesPantelis Antoniou
During the course of the rewrites a bug sneaked in when dealing with children nodes of overlays, which ends up duplicating sub nodes. Simply remove the duplicate traversal of child nodes to fix. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 3e7f7626fd49a9ffba8520a1a073f62929acad63) Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-17of/overlay: Introduce DT overlay supportPantelis Antoniou
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> (cherry picked from commit 7518b5890d8ac366faa2326ce2356ef6392ce63d) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: drivers/of/Makefile
2015-02-17of: Refactor __of_node_alloc() into __of_node_dup()Grant Likely
Add a node argument to __of_node_alloc() and rename it to __of_node_dup() so that it can also be used to duplicate a node with its properties. This is important for the overlay code so that it can create new nodes without using separate changeset items for every single property. At the same time rework the overlay code to use the new function and drop the extra changeset items. Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit e51795815ef1a7adc018cbaf05aac46e3d24eda8) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: drivers/of/unittest.c
2015-02-17of: Use vargs in __of_node_allocGrant Likely
The overlay code needs to construct a new full_name from the parent name and the node name, but the current method has to allocate and then free an temporary string which is wasteful. Fix this problem by using vargs to pass in a format and arguments into __of_node_alloc(). At the same time remove the allocflags argument to __of_node_alloc(). The only users all use GFP_KERNEL, so there is no need to provide it as an option. If there is ever a need later it can be added back. Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit ef8bbd73a76197cf8362a2b43aaadc5717bd0746) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: drivers/of/unittest.c
2015-02-17of/reconfig: Add OF_DYNAMIC notifier for platform_bus_typePantelis Antoniou
Add OF notifier handler needed for creating/destroying platform devices according to dynamic runtime changes in the DT live tree. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 801d728c10db4b28e01590b46bf1f0df930760cc) Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-17of/platform: Fix of_platform_device_destroy iteration of devicesGrant Likely
of_platform_destroy does not work properly, since the tree population test was iterating on all devices having as its parent the given platform device. The check was intended to check whether any other platform or amba devices created by of_platform_populate were still populated, but instead checked for every kind of device. This is wrong, since platform devices typically create a subsystem regular device and set themselves as parents. Instead, go ahead and call the unregister functions for any devices created with of_platform_populate. The driver core will take care of unbinding drivers, and drivers are responsible for getting rid of any child devices that weren't created by of_platform_populate. Signed-off-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> (cherry picked from commit 75f353b61342b5847c7f6d8499fd6301dce09845) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: include/linux/of_platform.h
2015-02-17of: Keep track of populated platform devicesPawel Moll
In "Device Tree powered" systems, platform devices are usually massively populated with of_platform_populate() call, executed at some level of initcalls, either by generic architecture or by platform-specific code. There are situations though where certain devices must be created (and bound with drivers) before all the others. This presents a challenge, as devices created explicitly would be created again by of_platform_populate(). This patch tries to solve that issue in a generic way, adding a "populated" flag for a DT node description. Subsequent of_platform_populate() will skip such nodes (and its children) in a similar way to the non-available ones. This patch also adds of_platform_depopulate() as an operation complementary to the _populate() one. It removes a platform or an amba device populated from the Device Tree, together with its all children (leaving, however, devices without associated of_node untouched) clearing the "populated" flag on the way. Signed-off-by: Pawel Moll <pawel.moll@arm.com> Reviewed-by: Rob Herring <robh@kernel.org> Acked-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit c6e126de43e7d4abfd6cf796b40589db3a046167) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: drivers/of/platform.c include/linux/of_platform.h
2015-02-16Merge remote-tracking branch 'lsk/v3.10/topic/of' into linux-linaro-lskMark Brown
Conflicts: arch/powerpc/kernel/prom.c drivers/of/Kconfig drivers/of/Makefile drivers/of/selftest.c include/linux/of.h
2015-02-16of/reconfig: Always use the same structure for notifiersGrant Likely
The OF_RECONFIG notifier callback uses a different structure depending on whether it is a node change or a property change. This is silly, and not very safe. Rework the code to use the same data structure regardless of the type of notifier. Signed-off-by: Grant Likely <grant.likely@linaro.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Rob Herring <robh+dt@kernel.org> Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Cc: <linuxppc-dev@lists.ozlabs.org> (cherry picked from commit f5242e5a883bf1c1aba6bfd87b85e7dda0e62191) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: arch/powerpc/platforms/pseries/hotplug-memory.c include/linux/of.h
2015-02-16of/reconfig: Add debug output for OF_RECONFIG notifiersGrant Likely
Add some additional debug output to cover OF_RECONFIG notifier activity. At the same time, refactor the changeset debug output to use the same strings as the notifier debug output. Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 00aa37206e1a54dae61a0dba96bf2ee0938b99d7) Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-16of/reconfig: Add of_reconfig_get_state_change() of notifier helper.Pantelis Antoniou
Introduce of_reconfig_get_state_change() which allows an of notifier to query about device state changes. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit b53a2340d0d30468b7315992ba77fe188c3bc5c8) Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-16of/resolver: Switch to new local fixups format.Pantelis Antoniou
The original resolver format is way too cryptic, switch to using a tree based format that gets rid of repetitions, is more compact and readable. At the same time, update the selftests to using the new local fixups format. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> [grant.likely: Squashed in testcase changes and merged similar functions] Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit da56d04c806a3e9986c66a061d7363ca3157c37b) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: drivers/of/unittest-data/testcases.dts
2015-02-16of: Introduce Device Tree resolve support.Pantelis Antoniou
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> (cherry picked from commit 7941b27b16e3282f6ec8817e36492f1deec753a7) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: drivers/of/Kconfig drivers/of/Makefile
2015-02-16of: Transactional DT support.Pantelis Antoniou
Introducing DT transactional support. A DT transaction is a method which allows one to apply changes in the live tree, in such a way that either the full set of changes take effect, or the state of the tree can be rolled-back to the state it was before it was attempted. An applied transaction can be rolled-back at any time. Documentation is in Documentation/devicetree/changesets.txt Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> [glikely: Removed device notifiers and reworked to be more consistent] Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 201c910bd6898d81d4ac6685d0f421b7e10f3c5d) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: drivers/of/selftest.c drivers/of/testcase-data/testcases.dtsi include/linux/of.h
2015-02-16of: Reorder device tree changes and notifiersGrant Likely
Currently, devicetree reconfig notifiers get emitted before the change is applied to the tree, but that behaviour is problematic if the receiver wants the determine the new state of the tree. The current users don't care, but the changeset code to follow will be making multiple changes at once. Reorder notifiers to get emitted after the change has been applied to the tree so that callbacks see the new tree state. At the same time, fixup the existing callbacks to expect the new order. There are a few callbacks that compare the old and new values of a changed property. Put both property pointers into the of_prop_reconfig structure. The current notifiers also allow the notifier callback to fail and cancel the change to the tree, but that feature isn't actually used. It really isn't valid to ignore a tree modification provided by firmware anyway, so remove the ability to cancel a change to the tree. Signed-off-by: Grant Likely <grant.likely@linaro.org> Cc: Nathan Fontenot <nfont@austin.ibm.com> (cherry picked from commit 259092a35c7e11f1d4616b0f5b3ba7b851fe4fa6) Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-16of: Move dynamic node fixups out of powerpc and into common codeGrant Likely
PowerPC does an odd thing with dynamic nodes. It uses a notifier to catch new node additions and set some of the values like name and type. This makes no sense since that same code can be put directly into of_attach_node(). Besides, all dynamic node users need this, not just powerpc. Fix this problem by moving the logic out of arch/powerpc and into drivers/of/dynamic.c. It is also important to remove this notifier because we want to move the firing of notifiers from before the tree is modified to after so that the receiver gets a consistent view of the tree, but that is incompatible with notifiers that modify the node. Signed-off-by: Grant Likely <grant.likely@linaro.org> Cc: Nathan Fontenot <nfont@austin.ibm.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> (cherry picked from commit a25095d451ece23b1fef34474f3230100db7aa05) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: arch/powerpc/kernel/prom.c
2015-02-16of: Make sure attached nodes don't carry along extra childrenGrant Likely
The child pointer does not get cleared when attaching new nodes which could cause the tree to be inconsistent. Clear the child pointer in __of_attach_node() to be absolutely sure that the structure remains in a consistent layout. Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 6162dbe49a451f96431a23b4821f05e3bd925bc1) Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-16of: Make devicetree sysfs update functions consistent.Grant Likely
All of the DT modification functions are split into two parts, the first part manipulates the DT data structure, and the second part updates sysfs, but the code isn't very consistent about how the second half is called. They don't all enforce the same rules about when it is valid to update sysfs, and there isn't any clarity on locking. The transactional DT modification feature that is coming also needs access to these functions so that it can perform all the structure changes together, and then all the sysfs updates as a second stage instead of doing each one at a time. Fix up the second have by creating a separate __of_*_sysfs() function for each of the helpers. The new functions have consistent naming (ie. of_node_add() becomes __of_attach_node_sysfs()) and all of them now defer if of_init hasn't been called yet. Callers of the new functions must hold the of_mutex to ensure there are no race conditions with of_init(). The mutex ensures that there will only ever be one writer to the tree at any given time. There can still be any number of readers and the raw_spin_lock is still used to make sure access to the data structure is still consistent. Finally, put the function prototypes into of_private.h so they are accessible to the transaction code. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> [grant.likely: Changed suffix from _post to _sysfs to match existing code] [grant.likely: Reorganized to eliminate trivial wrappers] Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 8a2b22a2595bf89d4396530edf8388159fad9d83) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: drivers/of/base.c
2015-02-16of: rename of_aliases_mutex to just of_mutexPantelis Antoniou
We're overloading usage of of_aliases_mutex for sysfs changes, so rename to something that is more generic. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit c05aba2bd5f9dd3f363611ff844513de1341ac60) Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-16of: Create unlocked versions of node and property add/remove functionsPantelis Antoniou
The DT overlay code will need to manipulate nodes and properties while already holding the devicetree lock, or on nodes that are not yet attached to the tree, but the current helper functions don't allow that. Extract the core behaviour from the accessors and create the following unlocked variants. The unlocked variants require either the lock to already be held or for the nodes to be detached from the tree. Changes to live nodes will not get updated in sysfs, so the caller must arrange for housekeeping to take place after dropping the lock. The new functions are: __of_add_property(), __of_remove_property(), __of_update_property(), __of_attach_node() and __of_detach_node(). Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> [Remove unnecessary diff hunks and rewrite commit text] Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit d8c50088417ebf61ad8b132caad20d10f7736034) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: drivers/of/base.c
2015-02-16of: add __of_add_property() without lock operationsXiubo Li
There two places will use the same code for adding one new property to the DT node. Adding __of_add_property() and prepare for fixing of_update_property()'s bug. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 62664f67775fad840cf6f68d6b5f428817bef6c5) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: drivers/of/base.c
2015-02-16OF: Utility helper functions for dynamic nodesPantelis Antoniou
Introduce helper functions for working with the live DT tree, all of them related to dynamically adding/removing nodes and properties. __of_prop_dup() copies a property dynamically __of_node_alloc() creates an empty node Bug fix about prop->len == 0 by Ionut Nicu <ioan.nicu.ext@nsn.com> Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> [glikely: Added unittest for of_copy_property and dropped fine-grained allocations] [glikely: removed name, type and phandle arguments from __of_node_alloc] Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 698433963b98d6de7b102c242805c99fda4fa1fb) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: drivers/of/selftest.c