24 May, 2019

2 commits

  • If a device has relevant power domain, we will check the power up
    result in probing the device. If the power up is failed, the device_probe
    will return failure immediately.

    The only exception is the new FLAG (DM_FLAG_IGNORE_POWER_ON) is set by driver
    to indicate ignore the power up result.

    Signed-off-by: Ye Li
    (cherry picked from commit 8524ca764d8fbd05da1593abfed62bb075c50cd4)

    Ye Li
     
  • Add a new driver FLAG (DM_FLAG_IGNORE_DEFAULT_CLKS). If any driver
    is set with this flag, then when probing the device, we will skip
    setting the default clocks.

    This is useful when clock driver can't work with some device driver.

    Signed-off-by: Ye Li

    Ye Li
     

10 Dec, 2018

1 commit

  • If OF_CONTROL is not enabled and DM_SEQ_ALIAS is enabled, we must
    assign an alias (requested sequence number) to devices that belongs to a
    class with the DM_UC_FLAG_SEQ_ALIAS flag. Otherwise
    uclass_find_device_by_seq() cannot be used to get/probe a device. In
    particular i2c_get_chip_for_busnum() cannot be used.

    Signed-off-by: Jean-Jacques Hiblot
    Reviewed-by: Simon Glass
    Reviewed-by: Heiko Schocher

    Jean-Jacques Hiblot
     

30 Nov, 2018

1 commit


15 Nov, 2018

1 commit

  • Currently the comments of several APIs (eg: dm_init_and_scan()) say:

    @pre_reloc_only: If true, bind only drivers with the DM_FLAG_PRE_RELOC
    flag. If false bind all drivers.

    The 'Pre-Relocation Support' chapter in doc/driver-model/README.txt
    documents the same that both device tree properties and driver flag
    are supported.

    However the implementation only checks these special device tree
    properties without checking the driver flag at all. This updates
    lists_bind_fdt() to consider both scenarios.

    Signed-off-by: Bin Meng
    Reviewed-by: Simon Glass
    Squashed in http://patchwork.ozlabs.org/patch/996473/ :
    Signed-off-by: Simon Glass

    Bin Meng
     

09 Oct, 2018

3 commits


30 Sep, 2018

1 commit


21 Aug, 2018

1 commit


06 Aug, 2018

1 commit


09 Jul, 2018

1 commit


08 May, 2018

1 commit


07 May, 2018

1 commit

  • When U-Boot started using SPDX tags we were among the early adopters and
    there weren't a lot of other examples to borrow from. So we picked the
    area of the file that usually had a full license text and replaced it
    with an appropriate SPDX-License-Identifier: entry. Since then, the
    Linux Kernel has adopted SPDX tags and they place it as the very first
    line in a file (except where shebangs are used, then it's second line)
    and with slightly different comment styles than us.

    In part due to community overlap, in part due to better tag visibility
    and in part for other minor reasons, switch over to that style.

    This commit changes all instances where we have a single declared
    license in the tag as both the before and after are identical in tag
    contents. There's also a few places where I found we did not have a tag
    and have introduced one.

    Signed-off-by: Tom Rini

    Tom Rini
     

29 Jan, 2018

1 commit

  • Linux uses the properties 'assigned-clocks', 'assigned-clock-parents'
    and 'assigned-clock-rates' to configure the clock subsystem for use
    with various peripheral nodes.

    This implements clk_set_defaults() and hooks it up with the general
    device probibin in drivers/core/device.c: when a new device is probed,
    clk_set_defaults() will be called for it and will process the
    properties mentioned above.

    Note that this functionality is designed to fail gracefully (i.e. if a
    clock-driver does not implement set_parent(), we simply accept this
    and ignore the error) as not to break existing board-support.

    Signed-off-by: Philipp Tomsich
    Tested-by: David Wu

    Series-changes: 2
    - Fixed David's email address.

    Series-version: 2

    Cover-letter:
    clk: support assigned-clock, assigned-clock-parents, assigned-clock-rates

    For various peripherals on Rockchip SoCs (e.g. for the Ethernet GMAC),
    the parent-clock needs to be set via the DTS. This adds the required
    plumbing and implements the GMAC case for the RK3399.
    END

    Philipp Tomsich
     

22 Jan, 2018

1 commit


09 Oct, 2017

1 commit


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
     

01 Jun, 2017

5 commits


14 Apr, 2017

1 commit

  • There is a strange interaction with drivers which use DMA if the cache
    starts off in a dirty state. Buffer space which the driver reads (but has
    not previously written) can contain zero bytes from alloc_priv(). This can
    cause corruption of the memory used by DMA for incoming data.

    Fix this and add a comment to explain the problem.

    This allows the dwc2 driver to work correctly with driver model, for
    example.

    Signed-off-by: Simon Glass

    Simon Glass
     

05 Apr, 2017

1 commit

  • This patch adds the flags parameter to device_remove() and changes all
    calls to this function to provide the default value of DM_REMOVE_NORMAL
    for "normal" device removal.

    This is in preparation for the driver specific pre-OS (e.g. DMA
    cancelling) remove support.

    Signed-off-by: Stefan Roese
    Cc: Simon Glass
    Acked-by: Simon Glass

    Stefan Roese
     

08 Feb, 2017

1 commit

  • 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
     

03 Dec, 2016

1 commit

  • The currently available functions accessing the 'reg' property of a
    device only retrieve the address. Sometimes its also necessary to
    retrieve the size described by the 'reg' property. This patch adds
    the new function dev_get_addr_size_index() which retrieves both,
    the address and the size described by the 'reg' property.

    Signed-off-by: Stefan Roese
    Cc: Simon Glass
    Acked-by: Simon Glass

    Stefan Roese
     

24 Oct, 2016

1 commit


14 Oct, 2016

1 commit

  • These have now landed upstream. The naming is different and in one case the
    function signature has changed. Update the code to match.

    This applies the following upstream commits by
    Thierry Reding :

    604e61e fdt: Add functions to retrieve strings
    8702bd1 fdt: Add a function to get the index of a string
    2218387 fdt: Add a function to count strings

    Signed-off-by: Simon Glass

    Simon Glass
     

12 Aug, 2016

1 commit

  • Some code may want to read reg values from DT, but from nodes that aren't
    associated with DM devices, so using dev_get_addr_index() isn't
    appropriate. In this case, fdtdec_get_addr_size_*() are the functions to
    use. However, "translation" (via the chain of ranges properties in parent
    nodes) may still be desirable. Add a function parameter to request that,
    and implement it. Update all call sites to default to the original
    behaviour.

    Signed-off-by: Stephen Warren
    Reviewed-by: Simon Glass
    Squashed in build fix from Stephen:
    Signed-off-by: Simon Glass

    Stephen Warren
     

15 Jul, 2016

3 commits

  • Devices which use of-platdata have their own platdata. However, in many
    cases the driver will have its own auto-alloced platdata, for use with the
    device tree. The ofdata_to_platdata() method converts the device tree
    settings to platdata.

    With of-platdata we would not normally allocate the platdata since it is
    provided by the U_BOOT_DEVICE() declaration. However this is inconvenient
    since the of-platdata struct is closely tied to the device tree properties.
    It is unlikely to exactly match the platdata needed by the driver.

    In fact a useful approach is to declare platdata in the driver like this:

    struct r3288_mmc_platdata {
    struct dtd_rockchip_rk3288_dw_mshc of_platdata;
    /* the 'normal' fields go here */
    };

    In this case we have dt_platadata available, but the normal fields are not
    present, since ofdata_to_platdata() is never called. In fact driver model
    doesn't allocate any space for the 'normal' fields, since it sees that there
    is already platform data attached to the device.

    To make this easier, adjust driver model to allocate the full size of the
    struct (i.e. platdata_auto_alloc_size from the driver) and copy in the
    of-platdata. This means that when the driver's bind() method is called,
    the of-platdata will be present, followed by zero bytes for the empty
    'normal field' portion.

    A new DM_FLAG_OF_PLATDATA flag is available that indicates that the platdata
    came from of-platdata. When the allocation/copy happens, the
    DM_FLAG_ALLOC_PDATA flag will be set as well. The dtoc tool is updated to
    output the platdata_size field, since U-Boot has no other way of knowing
    the size of the of-platdata struct.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • This is a flag. Adjust the name to be consistent with the other flags.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • When CONFIG_SPL_OF_PLATDATA is enabled we should not access the device
    tree. Remove all references to this in the core driver-model code.

    Signed-off-by: Simon Glass

    Simon Glass
     

09 Jul, 2016

1 commit

  • This API helps to map physical register addresss pace of device to
    virtual address space easily. Its just a wrapper around map_physmem()
    with MAP_NOCACHE flag.

    Signed-off-by: Vignesh R
    Suggested-by: Simon Glass
    Reviewed-by: Jagan Teki
    Reviewed-by: Simon Glass
    Signed-off-by: Jagan Teki

    Vignesh R
     

27 May, 2016

1 commit

  • This will allow a driver's bind function to use the driver data. One
    example is the Tegra186 GPIO driver, which instantiates child devices
    for each of its GPIO ports, yet supports two different HW instances each
    with a different set of ports, and identified by the udevice_id .data
    field.

    Signed-off-by: Stephen Warren
    Acked-by: Simon Glass

    Stephen Warren
     

25 May, 2016

1 commit


17 May, 2016

2 commits


25 Apr, 2016

1 commit

  • On some platforms (e.g. x86), the return value of dev_get_addr() can't
    be assigned to a pointer type variable directly. As there might be a
    difference between the size of fdt_addr_t and the pointer type. On
    x86 for example, "fdt_addr_t" is 64bit but "void *" only 32bit. So
    assigning the register base directly in dev_get_addr() results in this
    compilation warning:
    warning: cast to pointer from integer of different size

    This patch introduces the new function dev_get_addr_ptr() that
    returns a pointer to the 'reg' address that can be used by drivers
    in this case.

    Signed-off-by: Stefan Roese
    Reviewed-by: Simon Glass
    Reviewed-by: Bin Meng

    Stefan Roese
     

15 Apr, 2016

1 commit

  • This function parses the reg property based on an index found in the
    reg-names property. This is required for bindings that are written
    using reg-names rather than hard-coding indices in reg.

    Signed-off-by: Stephen Warren
    Acked-by: Simon Glass

    Stephen Warren