1. 31 8月, 2015 4 次提交
  2. 26 8月, 2015 1 次提交
    • B
      dm: core: Fix code reentrancy issue in device_probe_child() · cdeb2ba9
      Bin Meng 提交于
      The device might have already been probed during the call to
      device_probe() on its parent device (e.g. PCI bridge devices).
      In its parent device's probe routine, it might probe all of
      its child devices via device_probe() thus the codes reenter
      device_probe_child(). To support code reentrancy, test these
      allocated memory against NULL to avoid memory leak, and return
      to the caller if dev->flags has DM_FLAG_ACTIVATED set after
      device_probe() returns, so that we don't mess up the device.
      Signed-off-by: NBin Meng <bmeng.cn@gmail.com>
      Acked-by: NSimon Glass <sjg@chromium.org>
      cdeb2ba9
  3. 19 8月, 2015 2 次提交
  4. 06 8月, 2015 5 次提交
    • S
      dm: core: Add a way to set a device name · f5c67ea0
      Simon Glass 提交于
      Some devices are bound entirely by probing and do not have the benefit of
      a device tree to give them a name. This is very common with PCI and USB. In
      most cases this is fine, but we should add an official way to set a device
      name. This should be called in the device's bind() method.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      Reviewed-by: NBin Meng <bmeng.cn@gmail.com>
      f5c67ea0
    • M
      devres: make Devres optional with CONFIG_DEVRES · e2282d70
      Masahiro Yamada 提交于
      Currently, Devres requires additional 16 byte for each allocation,
      which is not so insignificant in some cases.
      
      Add CONFIG_DEVRES to make this framework optional.
      If the option is disabled, devres functions fall back to
      non-managed variants.  For example, devres_alloc() to kzalloc(),
      devm_kmalloc() to kmalloc(), etc.
      
      Because devres_head is also surrounded by an ifdef conditional,
      there is no memory overhead when CONFIG_DEVRES is disabled.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Suggested-by: NSimon Glass <sjg@chromium.org>
      Acked-by: NSimon Glass <sjg@chromium.org>
      e2282d70
    • M
      devres: introduce Devres (Managed Device Resource) framework · 608f26c5
      Masahiro Yamada 提交于
      In U-Boot's driver model, memory is basically allocated and freed
      in the core framework.  So, low level drivers generally only have
      to specify the size of needed memory with .priv_auto_alloc_size,
      .platdata_auto_alloc_size, etc.  Nevertheless, some drivers still
      need to allocate/free memory on their own in case they cannot
      statically know the necessary memory size.  So, I believe it is
      reasonable enough to port Devres into U-boot.
      
      Devres, which originates in Linux, manages device resources for each
      device and automatically releases them on driver detach.  With devres,
      device resources are guaranteed to be freed whether initialization
      fails half-way or the device gets detached.
      
      The basic idea is totally the same to that of Linux, but I tweaked
      it a bit so that it fits in U-Boot's driver model.
      
      In U-Boot, drivers are activated in two steps: binding and probing.
      Binding puts a driver and a device together.  It is just data
      manipulation on the system memory, so nothing has happened on the
      hardware device at this moment.  When the device is really used, it
      is probed.  Probing initializes the real hardware device to make it
      really ready for use.
      
      So, the resources acquired during the probing process must be freed
      when the device is removed.  Likewise, what has been allocated in
      binding should be released when the device is unbound.  The struct
      devres has a member "probe" to remember when the resource was
      allocated.
      
      CONFIG_DEBUG_DEVRES is also supported for easier debugging.
      If enabled, debug messages are printed each time a resource is
      allocated/freed.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NSimon Glass <sjg@chromium.org>
      608f26c5
    • M
      dm: add DM_FLAG_BOUND flag · aed1a4dd
      Masahiro Yamada 提交于
      Currently, we only have DM_FLAG_ACTIVATED to indicate the device
      status, but we still cannot know in which stage is in progress,
      binding or probing.
      
      This commit introduces a new flag, DM_FLAG_BOUND, which is set when
      the device is really bound, and cleared when it is unbound.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NSimon Glass <sjg@chromium.org>
      aed1a4dd
    • S
      dm: Support address translation for simple-bus · f3301771
      Simon Glass 提交于
      The 'ranges' property can be used to specify a translation from the system
      address to the bus address. Add support for this using the dev_get_addr()
      function, which devices should use to find their address.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      f3301771
  5. 22 7月, 2015 4 次提交
  6. 29 4月, 2015 1 次提交
  7. 23 4月, 2015 5 次提交
  8. 19 4月, 2015 5 次提交
  9. 17 4月, 2015 3 次提交
    • S
      dm: core: Add a uclass pre_probe() method for devices · 02c07b37
      Simon Glass 提交于
      Some uclasses want to set up a device before it is probed. Add a method
      for this.
      
      An example is with PCI, where a PCI uclass wants to set up its private
      data for later use. This allows the device's uclass() method to make calls
      whcih use that data (for example, read PCI memory regions from device
      tree, set up bus numbers).
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      02c07b37
    • S
      dm: core: Mark device as active before calling its probe() method · 02eeb1bb
      Simon Glass 提交于
      At present the device is not active when the probe() method is called. But
      some probe() methods want to set up the device and this can involve
      accessing it through normal methods. For example a PCI bus may wish to
      set up its PCI parameters using calls to pci_hose_write_config_dword() and
      similar.
      
      At present this does not work because every such call within the probe()
      method sees that the device is not active and attempts to probe it.
      
      Already we mark the device as probed before calling the uclass post_probe()
      method. This is a subtle change but I believe the new approach is better.
      Since the scope of the change is only the probe() method and all its callees
      it should still be within the control of the board author.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      02eeb1bb
    • S
      dm: core: Add dev_get_uclass_priv() to access uclass private data · e564f054
      Simon Glass 提交于
      Add a convenience function to access the private data that a uclass stores
      for each of its devices. Convert over most existing uses for consistency
      and to provide an example for others.
      Signed-off-by: NSimon Glass <sjg@chromium.org>
      e564f054
  10. 13 2月, 2015 1 次提交
  11. 30 1月, 2015 9 次提交