01 Jun, 2017

30 commits

  • This function does not change the device tree so adjust it to use const
    for this parameter.

    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
     
  • The of_ prefix conflicts with the livetree version of this function.
    Rename it to avoid problems when we add livetree support.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • If enabled, build a live device tree after relocation. This can then be
    used by driver model.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • This function converts the flat device tree into a hierarchical one with
    C structures and pointers. This is easier to access.

    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
     
  • Add a Kconfig option to enable a live device tree, built at run time from
    the flat tree. Also add structure definitions and a root node.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • In linux v4.9 this returns a value. This saves checking the warning
    condition twice in some code.

    Update the U-Boot version to do this also.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • Adjust the order to make it clear that *devp is set to NULL by default.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • Enable CONFIG_DM_MMC_OPS and CONFIG_BLK for all Tegra devices. This moves
    Tegra to use driver model fully for MMC.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • This function is called when the MMC block device is being probed. There
    is a recursive call in this function since find_mmc_device() itself can
    cause the MMC device to be probed.

    Admittedly the MMC device should already be probed, since we would not be
    probing its child otherwise, but the current code is unnecessarily
    convoluted.

    Rewrite this to access the MMC structure directly.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • When binding a new MMC device, make sure that it has the required
    operations. Since for now we still support *not* having the operations
    (with CONFIG_DM_MMC_OPS not enabled) it makes sense to add this check.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • The intention with block devices is that the device number (devnum field
    in its descriptor) matches the alias of its parent device. For example,
    with:

    aliases {
    mmc0 = "/sdhci@700b0600";
    mmc1 = "/sdhci@700b0400";
    }

    we expect that the block devices for mmc0 and mmc1 would have device
    numbers of 0 and 1 respectively.

    Unfortunately this does not currently always happen. If there is another
    MMC device earlier in the driver model data structures its block device
    will be created first. It will therefore get device number 0 and mmc0
    will therefore miss out. In this case the MMC device will have sequence
    number 0 but its block device will not.

    To avoid this, allow a device to request a device number and bump any
    existing device number that is using it. This all happens during the
    binding phase so it is safe to change these numbers around. This allows
    device numbers to match the aliases in all circumstances.

    Add a test to verify the behaviour.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • At present this code is inline. Move it into a function to allow it to
    be used elsewhere.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • Sometimes it is useful to be able to find a block device without also
    probing it. Add a function for this as well as the associated test.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • With driver model MMC is probed automatically when needed. We should not
    re-init MMC each time.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • We should not call out to board code from drivers. With driver model,
    mmc_power_init() already has code to use a named regulator, but the
    legacy code path remains. Update the code to make this clear.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • This core function will need to work with a live tree also. Update it to
    accept an ofnode instead of an offset.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • With live tree we need a struct device_node * to reference a node. With
    the existing flat tree, we need an int offset. We need to unify these into
    a single value which can represent both.

    Add an ofnode union for this and adjust existing code to move to this.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • At present devices use a simple integer offset to record the device tree
    node associated with the device. In preparation for supporting a live
    device tree, which uses a node pointer instead, refactor existing code to
    access this field through an inline function.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • This function is only used in one place. It is better to just declare it
    internally since there is a simpler replacement for use outside the
    driver-model core code.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • It is good practice to include common.h as the first header. This ensures
    that required features like the DECLARE_GLOBAL_DATA_PTR macro,
    configuration options and common types are available.

    Fix up some files which currently don't do this. This is necessary because
    driver model will soon start using global data and configuration in the
    dm/read.h header file, included via dm.h. The gd->fdt_blob value will be
    used to access the device tree and CONFIG options will be used to
    determine whether to support inline functions in the header file.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • This function should not be used outside the core driver-model code.
    Update it to use dm_scan_fdt_dev() instead.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • These support the flat device tree. We want to use the dev_read_..()
    prefix for functions that support both flat tree and live tree. So rename
    the existing functions to avoid confusion.

    In the end we will have:

    1. dev_read_addr...() - works on devices, supports flat/live tree
    2. devfdt_get_addr...() - current functions, flat tree only
    3. of_get_address() etc. - new functions, live tree only

    All drivers will be written to use 1. That function will in turn call
    either 2 or 3 depending on whether the flat or live tree is in use.

    Note this involves changing some dead code - the imx_lpi2c.c file.

    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
     
  • This header includes things that are needed to make driver build. Adjust
    existing users to include that always, even if other dm/ includes are
    present

    Signed-off-by: Simon Glass

    Simon Glass
     
  • Please pull another update for Broadcom MIPS.
    This contains new SoC's, new boards and new drivers and some bugfixes.

    Tom Rini
     
  • Mostly including the Armada 37xx pinctrl / gpio driver.

    Tom Rini
     
  • Currently these (board agnostic) commands cannot be selected using
    menuconfig and friends. Fix this the obvious way. As part of this,
    don't muddle the meaning of CONFIG_HASH_VERIFY to mean both 'hash -v'
    and "we have a hashing command" as this makes the Kconfig logic odd.

    Signed-off-by: Daniel Thompson
    [trini: Re-apply, add imply for a few cases, run moveconfig.py, also
    migrate CRC32_VERIFY]
    Signed-off-by: Tom Rini

    Daniel Thompson
     

31 May, 2017

10 commits