aboutsummaryrefslogtreecommitdiff
path: root/drivers
AgeCommit message (Collapse)Author
2016-01-14Merge remote-tracking branch 'lts/linux-3.18.y' into linux-linaro-lsk-v3.18linux-linaro-lsk-v3.18Alex Shi
2015-12-16Merge branch 'v3.18/topic/of-overlay' into linux-linaro-lsk-v3.18lsk-v3.18-15.12linux-linaro-lsk-v3.18-testAlex Shi
2015-12-16of: handle both '/' and ':' in path stringsv3.18/topic/of-overlayBrian Norris
Commit 106937e8ccdc ("of: fix handling of '/' in options for of_find_node_by_path()") caused a regression in OF handling of stdout-path. While it fixes some cases which have '/' after the ':', it breaks cases where there is more than one '/' *before* the ':'. For example, it breaks this boot string stdout-path = "/rdb/serial@f040ab00:115200"; So rather than doing sequentialized checks (first for '/', then for ':'; or vice versa), to get the correct behavior we need to check for the first occurrence of either one of them. It so happens that the handy strcspn() helper can do just that. Fixes: 106937e8ccdc ("of: fix handling of '/' in options for of_find_node_by_path()") Signed-off-by: Brian Norris <computersforpeace@gmail.com> Cc: stable@vger.kernel.org # 3.19 Acked-by: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Rob Herring <robh@kernel.org> (cherry picked from commit 721a09e95c786346b4188863a1cfa3909c76f690) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of: unittest: Add option string test case with longer pathBrian Norris
There were regressions seen with commit 106937e8ccdc ("of: fix handling of '/' in options for of_find_node_by_path()"), where we couldn't handle extra '/' before the ':'. Let's test for this now. Confirmed that this test fails without the previous patch and passes when patched. All other tests pass. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Rob Herring <robh@kernel.org> (cherry picked from commit 5ca1b0dd016701f67994414a2af50dec6efcf103) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of: unittest: Add options string testcase variantsPeter Hurley
Add testcase variants with '/' in the options string to test for scan beyond end path name terminated by ':'. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Rob Herring <robh@kernel.org> (cherry picked from commit 8cbba1ab1ae15b3a5d96caa526eac607f80bda23) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of: fix handling of '/' in options for of_find_node_by_path()Leif Lindholm
Ensure proper handling of paths with appended options (after ':'), where those options may contain a '/'. Fixes: 7914a7c5651a ("of: support passing console options with stdout-path") Reported-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Cc: <stable@vger.kernel.org> # 3.19 Signed-off-by: Rob Herring <robh@kernel.org> (cherry picked from commit 106937e8ccdcf0f4b95fbf0fe9abd42766cade33) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of/unittest: Fix the wrong expected value in of_selftest_property_stringWang Long
This patch fix the wrong expected value of of_property_match_string in of_selftest_property_string. Signed-off-by: Wang Long <long.wanglong@huawei.com> Signed-off-by: Rob Herring <robh@kernel.org> (cherry picked from commit 649022e08e4798ffb6e9b11c56ee6b2c62465d11) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of/unittest: remove the duplicate of_changeset_initWang Long
Remove the duplicate of_changeset_init. In of_selftest_changeset testcase, the "struct of_changeset chgset" is initialized twice, but only once is enough. so, drop the first initializtion code. Signed-off-by: Wang Long <long.wanglong@huawei.com> Signed-off-by: Rob Herring <robh@kernel.org> (cherry picked from commit dc6a9453eb253658df8740d4d872c6323daf4f0d) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of/overlay: Remove unused variableFabio Estevam
Commit 3e7f7626fd49a ("of/overlay: Do not generate duplicate nodes") removed the only use of the 'grandchild' variable, which leads to the following build warning: drivers/of/overlay.c: In function 'of_overlay_apply_single_device_node': drivers/of/overlay.c:89:31: warning: unused variable 'grandchild' [-Wunused-variable] struct device_node *tchild, *grandchild; ^ Remove this unused variable. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Rob Herring <robh@kernel.org> (cherry picked from commit d3a891652adb82e1973348c703a597cb54e41dea) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of/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 explicit to avoid potential future build issues if the implicit inclusion goes away. Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Rob Herring <robh@kernel.org> (cherry picked from commit 0d1886df6f770f881daa275fc2d3aae0c1cb5c9d) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of: Drop superfluous dependance for OF_OVERLAYMatwey V. Kornilov
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> (cherry picked from commit 388404a31297793beff8778324652a09f9dc6157) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of: Add prompt for OF_OVERLAY configMatwey V. Kornilov
Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru> Signed-off-by: Rob Herring <robh@kernel.org> (cherry picked from commit 5c776064a4a4600a7adea4503d77c6aad9baa476) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of/pci: Remove duplicate kfree in of_pci_get_host_bridge_resources()Lorenzo Pieralisi
Commit d2be00c0fb5a ("of/pci: Free resources on failure in of_pci_get_host_bridge_resources()") fixed the error path so it frees everything on the "resources" list. That list includes the bus_range, so we should not free it again. Remove the superfluous free of bus_range. [bhelgaas: changelog] Fixes: d2be00c0fb5a ("of/pci: Free resources on failure in of_pci_get_host_bridge_resources()") Reported-by: Jiang Liu <jiang.liu@linux.intel.com> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> CC: Rafael J. Wysocki <rjw@rjwysocki.net> (cherry picked from commit feb28979c137ba3f649ad36fc27c85c64c111f78) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of/fdt: fix sparse warningLad, Prabhakar
this patch fixes following sparse warning: fdt.c:765:12: warning: symbol 'early_init_dt_scan_chosen_serial' was not declared. Should it be static? Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Rob Herring <robh@kernel.org> (cherry picked from commit 523bf17f1c7c3171e03dbd31402dfa263e63d178) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of: EXPORT_SYMBOL_GPL of_property_read_u64_arraySakari Ailus
Make of_property_read_u64_array() available for modules as well. This was missing from the patch which originally added the function. Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Rob Herring <robh@kernel.org> (cherry picked from commit 2d4c0aef0ff4d4374590d6c7b259a259bb2cb21b) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of/unittest: Overlays with sub-devices testsPantelis Antoniou
Introduce selftests for overlays using sub-devices present in children nodes. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 6b1271de3723a7957c7cc6a7f36ea114f557e730) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of/unittest: Remove obsolete codeGrant Likely
Commit 3ce04b4a9, "Removes OF_UNITTEST dependency on OF_DYNAMIC config symbol" removes a bunch of code, but missed a few minor bits. Clean it up by removing the node removal cache and flag. Signed-off-by: Grant Likely <grant.likely@linaro.org> Cc: Gaurav Minocha <gaurav.minocha.os@gmail.com> Cc: Rob Herring <robh@kernel.org> (cherry picked from commit fca8ba4ee24d17f8845ed1c8edcc3fd81c4650c2) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of/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: Alex Shi <alex.shi@linaro.org>
2015-12-16of/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: Alex Shi <alex.shi@linaro.org>
2015-12-16Removes OF_UNITTEST dependency on OF_DYNAMIC config symbolGaurav Minocha
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> (cherry picked from commit 3ce04b4a9fdc30b6ec651e477dd08fee4e48f9aa) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16drivers: of: Export of_reserved_mem_device_{init,release}George G. Davis
Export of_reserved_mem_device_{init,release} so that modules can initialize and release their assigned per-device cma_area. Signed-off-by: George G. Davis <george_davis@mentor.com> [robh: s/EXPORT_SYMBOL/EXPORT_SYMBOL_GPL/] Signed-off-by: Rob Herring <robh@kernel.org> (cherry picked from commit 615fde79feb854bcda56abf9e5cfcd6638b3d310) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of: Delete unnecessary check before calling "of_node_put()"Markus Elfring
The of_node_put() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit c46ca3c8310b61d253a39ff1375ea97912794cd1) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of: Drop ->next pointer from struct device_nodeGrant Likely
The ->next pointer in struct device_node is a hanger-on from when it was used to iterate over the whole tree by a particular device_type property value. Those days are long over, but the fdt unflattening code still uses it to put nodes in the unflattened tree into the same order as node in the flat tree. By reworking the unflattening code to reverse the list after unflattening all the children of a node, the pointer can be dropped which gives a small amount of memory savings. Signed-off-by: Grant Likely <grant.likely@linaro.org> Acked-by: Frank Rowand <frank.rowand@sonymobile.com> Cc: Gaurav Minocha <gaurav.minocha.os@gmail.com> (cherry picked from commit 70161ff336674ecfd20614a9c0c61cb17a6e9e83) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of: support passing console options with stdout-pathLeif Lindholm
Support specifying console options (like with console=ttyXN,<options>) by appending them to the stdout-path property after a separating ':'. Example: stdout-path = "uart0:115200"; Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> [grant.likely: minor rework to shorten the diffstat] Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 7914a7c5651a51617d952e8fa745000ed8c4f001) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of: add optional options parameter to of_find_node_by_path()Leif Lindholm
Update of_find_node_by_path(): 1) Rename function to of_find_node_opts_by_path(), adding an optional pointer argument. Provide a static inline wrapper version of of_find_node_by_path() which calls the new function with NULL as the optional argument. 2) Ignore any part of the path beyond and including the ':' separator. 3) Set the new provided pointer argument to the beginning of the string following the ':' separator. 4: Add tests. Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 75c28c09af99a0db0ccd8b4395469761aa736543) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of: Remove unneeded and incorrect MODULE_DEVICE_TABLEGrant Likely
The unittest code has a MODULE_DEVICE_TABLE that isn't needed by any of the unittests, and isn't even correct. Remove it. Signed-off-by: Grant Likely <grant.likely@linaro.org> Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com> (cherry picked from commit 63ebecc03d2f18411da51a0981bd63818bbd0b54) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of: base, fix of_property_read_string_helper kernel-docJiri Slaby
It referenced of_property_read_string_util whereas the function name is of_property_read_string_helper. Introduced in a87fa1d81a9fb5e9adca9820e16008c40ad09f33 (of: Fix overflow bug in string property parsing functions). Found out when reviewing the stable 3.12 queue. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit e99010edb37f5d5bca6a4d4b78d74cddfc0fc5a4) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of: remove select of non-existant OF_DEVICE config symbolGrant Likely
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> (cherry picked from commit 65d473b8007b4ef9f2a5e52f39c52d2141dfd421) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of/overlay: Add overlay unittestsPantelis Antoniou
Add unittests for OF overlays. It tests overlay device addition/removal and whether the apply revert sequence is correct. Changes since V1: * Added local fixups entries. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 177d271cf3171bb6826ee5189f67dc1f7d34f1da) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of/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: Alex Shi <alex.shi@linaro.org>
2015-12-16of/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: Alex Shi <alex.shi@linaro.org>
2015-12-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: Alex Shi <alex.shi@linaro.org>
2015-12-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: Alex Shi <alex.shi@linaro.org>
2015-12-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: Alex Shi <alex.shi@linaro.org>
2015-12-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: Alex Shi <alex.shi@linaro.org>
2015-12-16of: 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: Alex Shi <alex.shi@linaro.org>
2015-12-16of: 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: Alex Shi <alex.shi@linaro.org>
2015-12-16of: Properly set the OF_POPULATED_BUS flag on root nodeGrant Likely
of_platform_populate() takes a subset of the device tree and turns it into a set of platform_devices. At the same time it sets the OF_POPULATED_BUS flag in each bus nodes so that of_platform_depopulate() can undo the operation at a later time. However, it doesn't set the flag on the root of the population tree which means that dynamic modifications of the device tree at runtime will not create/destroy devices correctly. Fix of_platform_populate() to set the OF_POPULATED_BUS flag on the node it is called with. Signed-off-by: Grant Likely <grant.likely@linaro.org> Cc: Rob Herring <robh+dt@kernel.org> Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Cc: Pawel Moll <pawel.moll@arm.com> (cherry picked from commit 2d0747c4b68be8eb8ccfa2c538f2f5dd2ea89094) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of/fdt: export fdt blob as /sys/firmware/fdtArd Biesheuvel
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> (cherry picked from commit 08d53aa58cb162e65e25dbe31d28438657cb8e33) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of: Change of_device_is_available() to return boolKevin Cernekee
This function can only return true or false; using a bool makes it more obvious to the reader. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 53a4ab96c61a34d62717b1481f6043e0b4338d74) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of/irq: Export of_irq_get()Laurent Pinchart
The function will be used by the I2C core which can be compiled as a module. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Rob Herring <robh@kernel.org> Acked-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> (cherry picked from commit 9eb08fb3d15896bfff57fcd4c87e3fd5b19d8581) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of/platform: Move platform devices under /sys/devices/platformGrant Likely
Currently the devices created by drivers/of/platform.c get created at the root of /sys/devices. This goes against the typical pattern for sysfs where the top level /sys/devices structure contains categories of devices, and the structure of devices is placed below that. To fix this, make the code in drivers/of/platform.c follow the drivers/base/platform.c behaviour, and use &platform_bus as the default parent for all new platform_devices and amba_devices. This change has been discussed for a long time, but nobody has actually acted on it. Userspace code that expects to find devices under a fixed /sys/devices/... path will be affected. It isn't /supposed/ to do that, but if anyone complains then I'll add a default-off workaround option to put them back into the root. Signed-off-by: Grant Likely <grant.likely@linaro.org> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Rob Herring <robh+dt@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> (cherry picked from commit 43c0767e17ac70e494b6a381b3a20be6a1a75c70) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of: check for size < 0 after rounding in early_init_dt_add_memory_archArd Biesheuvel
Memory regions passed to early_init_dt_add_memory_arch() are rounded to PAGE_SIZE by subtracting the size of the leading fractional page from the 'size' argument. However, size being a u64 type, if its value is sufficiently small, the subtraction wraps around and produces a bogus value, potentially leading to crashes. Fix this by ignoring the memory range in such cases. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 8cccffc52694938fc88f3d90bc7fed8460e27191) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of/fdt: Don't clear initial_boot_params if fdt_check_header() failsBjorn Helgaas
If the device tree pointer is NULL, early_init_dt_verify() fails, leaving initial_boot_params unchanged. If the device tree pointer is non-NULL but invalid, early_init_dt_verify() again fails but this time it also clears initial_boot_params. Leave initial_boot_params unchanged if the device tree pointer is invalid. This doesn't fix a bug, but it makes the behavior more consistent and easier to analyze. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 50ba08f301a1b0310775deeed00c9b24ba75fe8a) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of/unittest: Remove test devices after adding themGrant Likely
The of_platform_populate() test cases don't remove the test devices after they are added. Fix this by adding tests for of_platform_depopulate(). At the same time rework the selftest() macro to return the test result value. This makes it easy to use the macro inside an if() condition. Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit 851da976dc1d72becc03e144b38c4efab9e7b361) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of: Request and map make argument name constantMatthias Brugger
This patch makes the name argument from of_io_request_and_map constant. Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> (cherry picked from commit b75b276bead4850c86e60747babe09be5c13d4d1) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of/unittest: Rename selftest.c to unittest.cGrant Likely
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> (cherry picked from commit 19fd74879a32fb10357e0cda9c8050f01bb3eeb8) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-16of: Eliminate of_allnodes listGrant Likely
The device tree structure is composed of two lists; the 'allnodes' list which is a singly linked list containing every node in the tree, and the child->parent structure where each parent node has a singly linked list of children. All of the data in the allnodes list can be easily reproduced with the parent-child lists, so of_allnodes is actually unnecessary. Remove it entirely which saves a bit of memory and simplifies the data structure quite a lot. Signed-off-by: Grant Likely <grant.likely@linaro.org> Cc: Rob Herring <robh@kernel.org> Cc: Gaurav Minocha <gaurav.minocha.os@gmail.com> Cc: Pantelis Antoniou <pantelis@pantelis.antoniou@konsulko.com> (cherry picked from commit 5063e25a302e6a83f6590d9a06bd5f6400b17430) Signed-off-by: Alex Shi <alex.shi@linaro.org>
2015-12-14broadcom: fix PHY_ID_BCM5481 entry in the id tableAaro Koskinen
[ Upstream commit 3c25a860d17b7378822f35d8c9141db9507e3beb ] Commit fcb26ec5b18d ("broadcom: move all PHY_ID's to header") updated broadcom_tbl to use PHY_IDs, but incorrectly replaced 0x0143bca0 with PHY_ID_BCM5482 (making a duplicate entry, and completely omitting the original). Fix that. Fixes: fcb26ec5b18d ("broadcom: move all PHY_ID's to header") Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
2015-12-14net: qmi_wwan: add XS Stick W100-2 from 4G SystemsBjørn Mork
[ Upstream commit 68242a5a1e2edce39b069385cbafb82304eac0f1 ] Thomas reports " 4gsystems sells two total different LTE-surfsticks under the same name. .. The newer version of XS Stick W100 is from "omega" .. Under windows the driver switches to the same ID, and uses MI03\6 for network and MI01\6 for modem. .. echo "1c9e 9b01" > /sys/bus/usb/drivers/qmi_wwan/new_id echo "1c9e 9b01" > /sys/bus/usb-serial/drivers/option1/new_id T: Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#= 4 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1c9e ProdID=9b01 Rev=02.32 S: Manufacturer=USB Modem S: Product=USB Modem S: SerialNumber= C: #Ifs= 5 Cfg#= 1 Atr=80 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan I: If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage Now all important things are there: wwp0s29f7u2i3 (net), ttyUSB2 (at), cdc-wdm0 (qmi), ttyUSB1 (at) There is also ttyUSB0, but it is not usable, at least not for at. The device works well with qmi and ModemManager-NetworkManager. " Reported-by: Thomas Schäfer <tschaefer@t-online.de> Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>