05 Oct, 2017

1 commit

  • As we discussed before in ML, dm_dbg() causes undefined reference
    error if #define DEBUG is added to users, but not drivers/core/util.c

    We do not need this macro because we can use pr_debug() instead, and
    it is pretty easy to enable it for the DM core by using ccflags-y.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

13 Aug, 2017

1 commit


12 Jul, 2017

1 commit

  • Add a function which reads resources from a device, such as the device
    hardware address. This uses the "reg" property in the device.

    Unlike other functions there is little sense in inlining this when
    livetree is not being used because it has some logic in it and this would
    just bloat the code size.

    Signed-off-by: Simon Glass
    Tested-by: Marcel Ziswiler
    Tested-on: Beaver, Jetson-TK1

    Simon Glass
     

01 Jun, 2017

6 commits

  • When the live tree is supported some functions need to change a little.
    Add an implementation which is used when not inlining these functions.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • Some functions deal with structured data rather than simple data types.
    It makes sense to have these in their own file. For now this just has a
    function to read a flashmap entry. Move the data types also.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • Add functions to access addresses in the device tree. These are brought
    in from Linux 4.10.

    Also fix up the header guard for fdtaddr.h to avoid confusion.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • Since U-Boot supports both a live tree and a flat tree, we need an easy
    way to access the tree without worrying about which is currently active.
    To support this, U-Boot has the concept of an ofnode, which can refer
    either to a live tree node or a flat tree node.

    For the live tree, the reference contains a pointer to the node (struct
    device_node *) or NULL if the node is invalid. For the flat tree, the
    reference contains the node offset or -1 if the node is invalid.

    Add a basic set of operations using ofnodes. These are implemented by
    using either libfdt functions (in the case of a flat DT reference) or
    the live-tree of_...() functions.

    Note that it is not possible to have both live and flat references active
    at the same time. As soon as the live tree is available, everything in
    U-Boot should switch to using that. This avoids confusion and allows us to
    assume that the type of a reference is simply based on whether we have a
    live tree yet, or not.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • Add a basic assortment of functions to access the live device tree. These
    come from Linux v4.9 and are modified for U-Boot to the minimum extent
    possible. While these functions are now very stable in Linux, it will be
    possible to merge in fixes if needed.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • Move this group of address-related functions into a new file. These use
    the flat device tree. Future work will provide new versions of these which
    can support the live tree.

    Signed-off-by: Simon Glass

    Simon Glass
     

01 Dec, 2015

1 commit


31 Aug, 2015

1 commit

  • Add Kconfig entries for the simple-bus driver, both for U-Boot
    and for SPL. The simple-bus is enabled by default in U-Boot and
    disabled by default in SPL to preserve the original behavior.

    Signed-off-by: Marek Vasut
    Cc: Simon Glass
    Acked-by: Simon Glass
    Modified to fit on top of Masahiro's $(SPL) setup:
    Signed-off-by: Simon Glass

    Marek Vasut
     

19 Aug, 2015

2 commits

  • We have flipped CONFIG_SPL_DISABLE_OF_CONTROL. We have cleansing
    devices, $(SPL_) and CONFIG_IS_ENABLED(), so we are ready to clear
    away the ugly logic in include/fdtdec.h:

    #ifdef CONFIG_OF_CONTROL
    # if defined(CONFIG_SPL_BUILD) && !defined(SPL_OF_CONTROL)
    # define OF_CONTROL 0
    # else
    # define OF_CONTROL 1
    # endif
    #else
    # define OF_CONTROL 0
    #endif

    Now CONFIG_IS_ENABLED(OF_CONTROL) is the substitute. It refers to
    CONFIG_OF_CONTROL for U-boot proper and CONFIG_SPL_OF_CONTROL for
    SPL.

    Also, we no longer have to cancel CONFIG_OF_CONTROL in
    include/config_uncmd_spl.h and scripts/Makefile.spl.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Tom Rini
    Reviewed-by: Simon Glass
    Acked-by: Linus Walleij

    Masahiro Yamada
     
  • We do not want to compile the DM remove code for SPL. Currently,
    we undef it in include/config_uncmd_spl.h (for C files) and in
    scripts/Makefile.uncmd_spl (for Makefiles). This is really ugly.

    This commit demonstrates how we can deprecate those two files.

    Use $(SPL_) for the entry in the Makfile and CONFIG_IS_ENABLED()
    in C files.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Tom Rini
    Reviewed-by: Simon Glass

    Masahiro Yamada
     

06 Aug, 2015

3 commits

  • 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: Masahiro Yamada
    Suggested-by: Simon Glass
    Acked-by: Simon Glass

    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: Masahiro Yamada
    Acked-by: Simon Glass

    Masahiro Yamada
     
  • Not all boards use garbage collection in their link step, so we should avoid
    adding options that rely on this for prevention of code bloat. Add separate
    Kconfig options for syscon and regmap uclasses.

    Signed-off-by: Simon Glass

    Simon Glass
     

22 Jul, 2015

4 commits


11 Jun, 2015

1 commit


21 Nov, 2014

1 commit


23 Oct, 2014

1 commit


25 Sep, 2014

1 commit

  • [1] Move driver/core/, driver/input/ and drivers/input/ entries
    from the top Makefile to drivers/Makefile

    [2] Remove the conditional by CONFIG_DM in drivers/core/Makefile
    because the whole drivers/core directory is already selected
    by CONFIG_DM in the upper level

    [3] Likewise for CONFIG_DM_DEMO in drivers/demo/Makefile

    [4] Simplify common/Makefile - both CONFIG_DDR_SPD and
    CONFIG_SPD_EEPROM are boolean macros so they can directly
    select objects

    Signed-off-by: Masahiro Yamada
    Acked-by: Marek Vasut

    Masahiro Yamada
     

05 Mar, 2014

1 commit

  • Add driver model functionality for generic board.

    This includes data structures and base code for registering devices and
    uclasses (groups of devices with the same purpose, e.g. all I2C ports will
    be in the same uclass).

    The feature is enabled with CONFIG_DM.

    Signed-off-by: Simon Glass
    Signed-off-by: Marek Vasut
    Signed-off-by: Pavel Herrmann
    Signed-off-by: Viktor Křivák
    Signed-off-by: Tomas Hlavacek

    Simon Glass