1. 27 5月, 2015 1 次提交
  2. 15 4月, 2015 1 次提交
    • K
      of: Add helper function to check MMIO register endianness · 37786c7f
      Kevin Cernekee 提交于
      SoC peripherals can come in several different flavors:
      
       - little-endian: registers always need to be accessed in LE mode (so the
         kernel should perform a swap if the CPU is running BE)
      
       - big-endian: registers always need to be accessed in BE mode (so the
         kernel should perform a swap if the CPU is running LE)
      
       - native-endian: the bus will automatically swap accesses, so the kernel
         should never swap
      
      Introduce a function that checks an OF device node to see whether it
      contains a "big-endian" or "native-endian" property.  For the former case,
      always return true.  For the latter case, return true iff the kernel was
      built for BE (implying that the BE MMIO accessors do not perform a swap).
      Otherwise return false, assuming LE registers.
      
      LE registers are assumed by default because most existing drivers (libahci,
      serial8250, usb) always use readl/writel in the absence of instructions
      to the contrary, so that will be our fallback.
      Signed-off-by: NKevin Cernekee <cernekee@gmail.com>
      Reviewed-by: NPeter Hurley <peter@hurleysoftware.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NRob Herring <robh@kernel.org>
      37786c7f
  3. 28 3月, 2015 1 次提交
  4. 18 3月, 2015 1 次提交
  5. 04 12月, 2014 2 次提交
    • G
      of: Drop ->next pointer from struct device_node · 70161ff3
      Grant 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: NGrant Likely <grant.likely@linaro.org>
      Acked-by: NFrank Rowand <frank.rowand@sonymobile.com>
      Cc: Gaurav Minocha <gaurav.minocha.os@gmail.com>
      70161ff3
    • L
      of: add optional options parameter to of_find_node_by_path() · 75c28c09
      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: NLeif Lindholm <leif.lindholm@linaro.org>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      75c28c09
  6. 02 12月, 2014 1 次提交
    • R
      of: Rename "poweroff-source" property to "system-power-controller" · 8f73110f
      Romain Perier 提交于
      It reverts commit a4b4e046 ("of: Add standard property for poweroff capability").
      As discussed on the mailing list, it makes more sense to rename back to the
      old established property name, without the vendor prefix. Problem being that
      the word "source" usually tends to be used for inputs and that is out of control
      of the OS. The poweroff capability is an output which simply turns the
      system-power off. Also, this property might be used by drivers which power-off
      the system and power back on subsequent RTC alarms. This seems to suggest to
      remove "poweroff" from the property name and to choose "system-power-controller"
      as the more generic name. This patchs adds the required renaming changes and
      defines an helper function which checks if this property is set.
      Signed-off-by: NRomain Perier <romain.perier@gmail.com>
      Acked-by: NGrant Likely <grant.likely@linaro.org>
      Acked-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      8f73110f
  7. 25 11月, 2014 4 次提交
    • P
      of/overlay: Introduce DT overlay support · 7518b589
      Pantelis 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: NPantelis Antoniou <pantelis.antoniou@konsulko.com>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      7518b589
    • G
      of/reconfig: Always use the same structure for notifiers · f5242e5a
      Grant 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: NGrant 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>
      f5242e5a
    • G
      of/reconfig: Add empty stubs for the of_reconfig methods · f6892d19
      Grant Likely 提交于
      To simplify subsystem setup code, make empty stubs for the
      of_reconfig_*() methods. This is particularly useful for registering and
      unregistering the notifiers so that it doesn't impact the flow of the
      subsystem setup code.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      f6892d19
    • P
      of/reconfig: Add of_reconfig_get_state_change() of notifier helper. · b53a2340
      Pantelis Antoniou 提交于
      Introduce of_reconfig_get_state_change() which allows an of notifier
      to query about device state changes.
      Signed-off-by: NPantelis Antoniou <pantelis.antoniou@konsulko.com>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      b53a2340
  8. 19 11月, 2014 1 次提交
  9. 14 11月, 2014 1 次提交
  10. 05 11月, 2014 3 次提交
  11. 04 11月, 2014 3 次提交
    • G
      of: Eliminate of_allnodes list · 5063e25a
      Grant 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: NGrant 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>
      5063e25a
    • S
      of: introduce of_property_read_s32 · e7a00e42
      Sebastian Reichel 提交于
      Introduce signed 32bit integer of_property_read method.
      Signed-off-by: NSebastian Reichel <sre@kernel.org>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      e7a00e42
    • G
      of: Fix overflow bug in string property parsing functions · a87fa1d8
      Grant Likely 提交于
      The string property read helpers will run off the end of the buffer if
      it is handed a malformed string property. Rework the parsers to make
      sure that doesn't happen. At the same time add new test cases to make
      sure the functions behave themselves.
      
      The original implementations of of_property_read_string_index() and
      of_property_count_strings() both open-coded the same block of parsing
      code, each with it's own subtly different bugs. The fix here merges
      functions into a single helper and makes the original functions static
      inline wrappers around the helper.
      
      One non-bugfix aspect of this patch is the addition of a new wrapper,
      of_property_read_string_array(). The new wrapper is needed by the
      device_properties feature that Rafael is working on and planning to
      merge for v3.19. The implementation is identical both with and without
      the new static inline wrapper, so it just got left in to reduce the
      churn on the header file.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Darren Hart <darren.hart@intel.com>
      Cc: <stable@vger.kernel.org>  # v3.3+: Drop selftest hunks that don't apply
      a87fa1d8
  12. 22 10月, 2014 1 次提交
  13. 05 10月, 2014 1 次提交
  14. 24 7月, 2014 3 次提交
    • P
      of: Transactional DT support. · 201c910b
      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: NPantelis Antoniou <pantelis.antoniou@konsulko.com>
      [glikely: Removed device notifiers and reworked to be more consistent]
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      201c910b
    • G
      of: Reorder device tree changes and notifiers · 259092a3
      Grant 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: NGrant Likely <grant.likely@linaro.org>
      Cc: Nathan Fontenot <nfont@austin.ibm.com>
      259092a3
    • G
      of: Make devicetree sysfs update functions consistent. · 8a2b22a2
      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: NPantelis 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: NGrant Likely <grant.likely@linaro.org>
      8a2b22a2
  15. 07 7月, 2014 1 次提交
    • G
      of/platform: Fix of_platform_device_destroy iteration of devices · 75f353b6
      Grant 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: NGrant Likely <grant.likely@linaro.org>
      Signed-off-by: NPantelis Antoniou <pantelis.antoniou@konsulko.com>
      75f353b6
  16. 27 6月, 2014 2 次提交
  17. 21 5月, 2014 1 次提交
  18. 16 5月, 2014 1 次提交
    • P
      of: Keep track of populated platform devices · c6e126de
      Pawel 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: NPawel Moll <pawel.moll@arm.com>
      Reviewed-by: NRob Herring <robh@kernel.org>
      Acked-by: NGrant Likely <grant.likely@linaro.org>
      c6e126de
  19. 15 5月, 2014 1 次提交
  20. 18 4月, 2014 1 次提交
  21. 19 3月, 2014 1 次提交
    • P
      of: device_node kobject lifecycle fixes · 0829f6d1
      Pantelis Antoniou 提交于
      After the move to having device nodes be proper kobjects the lifecycle
      of the node needs to be controlled better.
      
      At first convert of_add_node() in the unflattened functions to
      of_init_node() which initializes the kobject so that of_node_get/put
      work correctly even before of_init is called.
      
      Afterwards introduce of_node_is_initialized & of_node_is_attached that
      query the underlying kobject about the state (attached means kobj
      is visible in sysfs)
      
      Using that make sure the lifecycle of the tree is correct at all
      times.
      Signed-off-by: NPantelis Antoniou <panto@antoniou-consulting.com>
      [grant.likely: moved of_node_init() calls, fixed up locking, and
                     dropped __of_populate() hunks]
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      0829f6d1
  22. 12 3月, 2014 2 次提交
    • G
      of: remove /proc/device-tree · 8357041a
      Grant Likely 提交于
      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: NGrant 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>
      8357041a
    • G
      of: Make device nodes kobjects so they show up in sysfs · 75b57ecf
      Grant Likely 提交于
      Device tree nodes are already treated as objects, and we already want to
      expose them to userspace which is done using the /proc filesystem today.
      Right now the kernel has to do a lot of work to keep the /proc view in
      sync with the in-kernel representation. If device_nodes are switched to
      be kobjects then the device tree code can be a whole lot simpler. It
      also turns out that switching to using /sysfs from /proc results in
      smaller code and data size, and the userspace ABI won't change if
      /proc/device-tree symlinks to /sys/firmware/devicetree/base.
      
      v7: Add missing sysfs_bin_attr_init()
      v6: Add __of_add_property() early init fixes from Pantelis
      v5: Rename firmware/ofw to firmware/devicetree
          Fix updating property values in sysfs
      v4: Fixed build error on Powerpc
          Fixed handling of dynamic nodes on powerpc
      v3: Fixed handling of duplicate attribute and child node names
      v2: switch to using sysfs bin_attributes which solve the problem of
          reporting incorrect property size.
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      Tested-by: NSascha Hauer <s.hauer@pengutronix.de>
      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>
      75b57ecf
  23. 12 2月, 2014 1 次提交
  24. 05 2月, 2014 2 次提交
  25. 03 2月, 2014 1 次提交
  26. 24 1月, 2014 1 次提交
  27. 04 11月, 2013 1 次提交