Commit Graph

384568 Commits

Author SHA1 Message Date
Mark Brown
0a848fa4aa Merge branch 'linux-linaro-lsk' into linux-linaro-lsk-android 2015-03-03 09:34:14 +00:00
Mark Brown
b94eedf4bb Merge remote-tracking branch 'lsk/v3.10/topic/coresight' into linux-linaro-lsk 2015-03-03 09:33:54 +00:00
Mark Brown
384e9438bc Merge branch 'v3.10-backport' of http://git.linaro.org/people/mathieu.poirier/coresight into lsk-v3.10-coresight 2015-03-03 09:23:31 +00:00
Kaixu Xia
c572ae8a60 coresight: fix function etm_writel_cp14() parameter order
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 5fb31cd839)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:34:24 -07:00
Paul Bolle
1aa78225c8 coresight-etm: remove check for unknown Kconfig macro
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 406b9f659f)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:34:22 -07:00
Mathieu Poirier
d79f7c86f0 coresight: fixing CPU hwid lookup in device tree
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 34a03c1d30)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:34:21 -07:00
Kaixu Xia
02746fffef coresight: remove the unnecessary function coresight_is_bit_set()
This function coresight_is_bit_set() isn't called, so we should
remove it.

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 c4546f2466)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:34:20 -07:00
Kaixu Xia
cd9540f10c coresight: fix the debug AMBA bus name
The right debug AMBA bus name should be APB(Advanced Peripheral Bus),
so just fix it.

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 7af8792b4d)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:34:18 -07:00
Kaixu Xia
1729d7d125 coresight: remove the extra spaces
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 d786a47de9)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:34:17 -07:00
Kaixu Xia
ca02d80994 coresight: fix the link between orphan connection and newly added device
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 22394bc585)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:34:16 -07:00
Kaixu Xia
9c6059d639 coresight: remove the unnecessary replicator property
Now we use the device name to identify replicator instead
of a unique number, so just remove it.

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 603101708c)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:34:14 -07:00
Kaixu Xia
5d3a855d4d coresight: fix the replicator subtype value
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 410d841a59)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:34:13 -07:00
Kaixu Xia
46a8d0791a coresight: fixing validity check on remote device
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 2ccffaf92e)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:34:12 -07:00
Kaixu Xia
d5804b2d68 coresight: fix comment in of_coresight.c
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 f7c55298f1)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:34:10 -07:00
Mathieu Poirier
1e3e80795e coresight: Fixing wrong #ifdef/#endif placement
Fixing problem reported by:
        https://lkml.org/lkml/2015/1/6/86

The #ifdef/#endif is wrong and prevents the stub of function
of_get_coresight_platform_data() from being visible when
CONFIG_OF is not defined.

Moving CONFIG_OF condition out of CONFIG_CORESIGHT, making
them both independent.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit c61c4b5dd2)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:34:09 -07:00
Kaixu Xia
2ea3f1b8cf coresight: fix typo in comment in of_coresight.c
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 ff1e33b0c1)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:34:08 -07:00
Xia Kaixu
5716ad8d9e coresight: remove the unused macro CORESIGHT_DEBUGFS_ENTRY
Debugfs isn't used for coresight configuration, so the macro
CORESIGHT_DEBUGFS_ENTRY is unnecessary, just remove it.

Signed-off-by: Xia Kaixu <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 f379984f84)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:33:31 -07:00
Mathieu Poirier
6e2abfb389 coresight-etm: Fix initial trace ID value
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 b2c09284bb)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:33:29 -07:00
Wei Yongjun
5d51a40f73 coresight-tpiu: use module_amba_driver to simplify the code
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 3ff7ca051a)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:33:28 -07:00
Wei Yongjun
6795bfcd59 coresight-tmc: use module_amba_driver to simplify the code
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 d2e580c272)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:33:27 -07:00
Wei Yongjun
fc4cdb483b coresight-funnel: use module_amba_driver to simplify the code
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 a48f52e185)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:33:25 -07:00
Wei Yongjun
bbe8848fbe coresight-etb: use module_amba_driver to simplify the code
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 52d6bbb9b0)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:33:24 -07:00
Dan Carpenter
f7977db7e8 coresight-etm: unlock on error paths in mode_store()
There are some missing unlocks on the error paths.

Fixes: a939fc5a71 ('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 6ad1095990)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
2015-03-02 11:33:23 -07:00
Mark Brown
5c4f9098b7 Merge branch 'linux-linaro-lsk' into linux-linaro-lsk-android 2015-02-21 18:06:59 +09:00
Mark Brown
80124ed1ec Merge branch 'lsk/v3.10/topic/of' into linux-linaro-lsk 2015-02-21 18:06:44 +09:00
Pantelis Antoniou
6f491cafa2 i2c: Mark instantiated device nodes with OF_POPULATE
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-21 12:14:29 +09:00
Pantelis Antoniou
5722d513b0 i2c: Mark instantiated device nodes with OF_POPULATE
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-21 12:14:08 +09:00
Pantelis Antoniou
9f2de29f83 i2c/of: Add OF_RECONFIG notifier handler
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 ea7513bbc0)
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-21 12:13:53 +09:00
Pantelis Antoniou
4edb763a4c i2c/of: Factor out Devicetree registration code
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 a430a3455f)
Signed-off-by: Mark Brown <broonie@kernel.org>

Conflicts:
	drivers/i2c/i2c-core.c
2015-02-21 12:12:58 +09:00
Wolfram Sang
7f42704949 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.

[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 687b81d083)
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-21 12:10:58 +09:00
Mark Brown
def31719e1 Merge remote-tracking branch 'lsk/v3.10/topic/aosp' into linux-linaro-lsk-android
Conflicts:
	drivers/Kconfig
	drivers/Makefile
	fs/pstore/inode.c
	fs/pstore/ram.c
2015-02-20 14:29:33 +09:00
Mark Brown
855267e97a Merge branch 'linaro-android-3.10-lsk' of git://android.git.linaro.org/kernel/linaro-android into lsk-v3.10-aosp 2015-02-20 14:27:48 +09:00
Mark Brown
0fa60a2e6a Merge branch 'linux-linaro-lsk' into linux-linaro-lsk-android 2015-02-19 19:17:15 +09:00
Mark Brown
f6e46ae658 Merge remote-tracking branch 'lsk/v3.10/topic/of' into linux-linaro-lsk
Conflicts:
	drivers/of/Makefile
2015-02-19 19:17:10 +09:00
Mark Brown
82b67d73b1 of/overlay: Directly include idr.h
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-17 11:56:15 +09:00
Pantelis Antoniou
3472bee304 of/platform: Handle of_populate drivers in notifier
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 15204ab1eb)
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-17 11:56:15 +09:00
Pantelis Antoniou
5e3b95753e of/overlay: Do not generate duplicate nodes
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 3e7f7626fd)
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-17 11:56:14 +09:00
Pantelis Antoniou
0327df42b4 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>
(cherry picked from commit 7518b5890d)
Signed-off-by: Mark Brown <broonie@kernel.org>

Conflicts:
	drivers/of/Makefile
2015-02-17 11:56:14 +09:00
Grant Likely
1ee737348e of: Refactor __of_node_alloc() into __of_node_dup()
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 e51795815e)
Signed-off-by: Mark Brown <broonie@kernel.org>

Conflicts:
	drivers/of/unittest.c
2015-02-17 11:56:13 +09:00
Grant Likely
644d38f5ab of: Use vargs in __of_node_alloc
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 ef8bbd73a7)
Signed-off-by: Mark Brown <broonie@kernel.org>

Conflicts:
	drivers/of/unittest.c
2015-02-17 11:56:13 +09:00
Pantelis Antoniou
b529a532ec of/reconfig: Add OF_DYNAMIC notifier for platform_bus_type
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 801d728c10)
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-17 01:13:09 +09:00
Grant Likely
f2d2cdb9c3 of/platform: Fix of_platform_device_destroy iteration of devices
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 75f353b613)
Signed-off-by: Mark Brown <broonie@kernel.org>

Conflicts:
	include/linux/of_platform.h
2015-02-17 01:12:53 +09:00
Pawel Moll
e0bc89c5e7 of: Keep track of populated platform devices
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 c6e126de43)
Signed-off-by: Mark Brown <broonie@kernel.org>

Conflicts:
	drivers/of/platform.c
	include/linux/of_platform.h
2015-02-17 01:06:53 +09:00
Mark Brown
7710601a8b Merge remote-tracking branch 'lsk/v3.10/topic/of' into linux-linaro-lsk
Conflicts:
	arch/powerpc/kernel/prom.c
	drivers/of/Kconfig
	drivers/of/Makefile
	drivers/of/selftest.c
	include/linux/of.h
2015-02-16 16:57:48 +09:00
Grant Likely
e60dc70372 of/reconfig: Always use the same structure for notifiers
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 f5242e5a88)
Signed-off-by: Mark Brown <broonie@kernel.org>

Conflicts:
	arch/powerpc/platforms/pseries/hotplug-memory.c
	include/linux/of.h
2015-02-16 15:11:18 +09:00
Grant Likely
54c85511b3 of/reconfig: Add debug output for OF_RECONFIG notifiers
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 00aa37206e)
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-16 15:08:24 +09:00
Pantelis Antoniou
8f2b72743c of/reconfig: Add of_reconfig_get_state_change() of notifier helper.
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 b53a2340d0)
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-16 15:08:15 +09:00
Pantelis Antoniou
1fce2330c7 of/resolver: Switch to new local fixups format.
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 da56d04c80)
Signed-off-by: Mark Brown <broonie@kernel.org>

Conflicts:
	drivers/of/unittest-data/testcases.dts
2015-02-16 15:08:00 +09:00
Pantelis Antoniou
614005d5e9 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>

(cherry picked from commit 7941b27b16)
Signed-off-by: Mark Brown <broonie@kernel.org>

Conflicts:
	drivers/of/Kconfig
	drivers/of/Makefile
2015-02-16 15:04:02 +09:00
Pantelis Antoniou
67cf77308b of: Transactional DT support.
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 201c910bd6)
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-16 14:57:31 +09:00