12 Feb, 2019

1 commit


18 Dec, 2018

1 commit

  • RISC-V privileged architecture v1.10 defines a real-time counter,
    exposed as a memory-mapped machine-mode register - mtime. mtime must
    run at constant frequency, and the platform must provide a mechanism
    for determining the timebase of mtime. The mtime register has a
    64-bit precision on all RV32, RV64, and RV128 systems.

    Different platform may have different implementation of the mtime
    block hence an API riscv_get_time() is required by this driver for
    platform codes to hide such implementation details. For example,
    on some platforms mtime is provided by the CLINT module, while on
    some other platforms a simple 'rdtime' can be used to get the timer
    counter.

    With this timer driver the U-Boot timer functionalities like delay
    works correctly now.

    Signed-off-by: Bin Meng
    Reviewed-by: Lukas Auer
    Reviewed-by: Anup Patel

    Bin Meng
     

29 Nov, 2018

1 commit


15 Nov, 2018

3 commits

  • When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
    bound before relocation. However due to a bug in the DM core,
    the flag only takes effect when devices are statically declared
    via U_BOOT_DEVICE(). This bug has been fixed recently by commit
    "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
    lists_bind_fdt()", but with the fix, it has a side effect that
    all existing drivers that declared DM_FLAG_PRE_RELOC flag will
    be bound before relocation now. This may expose potential boot
    failure on some boards due to insufficient memory during the
    pre-relocation stage.

    To mitigate this potential impact, the following changes are
    implemented:

    - Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
    only supports configuration from device tree (OF_CONTROL)
    - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
    is statically declared via U_BOOT_DEVICE()
    - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
    drivers that support both statically declared devices and
    configuration from device tree

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

    Bin Meng
     
  • This is currently out of order. Sort it.

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

    Bin Meng
     
  • 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
     

22 Oct, 2018

2 commits

  • So far the TSC timer driver supports trying hardware calibration first
    and using device tree as last resort for its running frequency as the
    normal timer.

    However when it is used as the early timer, it only supports hardware
    calibration and if it fails, the driver just panics. This introduces
    a new config option to specify the early timer frequency in MHz and
    it should be equal to the value described in the device tree.

    Without this patch, the travis-ci testing on QEMU x86_64 target fails
    each time after it finishes the 'bootefi selftest' as the test.py see
    an error was emitted on the console like this:

    TSC frequency is ZERO
    resetting ...
    ### ERROR ### Please RESET the board ###

    It's strange that this error is consistently seen on the travis-ci
    machine, but only occasionally seen on my local machine (maybe 1 out
    of 10). Since QEMU x86_64 target enables BOOTSTAGE support which uses
    early timer, with this fix it should work without any failure.

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

    Bin Meng
     
  • In initr_bootstage() we call bootstage_mark_name() which ends up calling
    timer_get_us(). This call happens before initr_dm(), which inits driver
    model.

    On x86 we set gd->timer to NULL in the transition from board_init_f()
    to board_init_r(). See board_init_f_r() for this assignment. So U-Boot
    knows there is no timer available in the period immediately after
    relocation.

    On x86 the timer_get_us() call is implemented as calls to get_ticks() and
    get_tbclk(). Both of these call dm_timer_init() to set up the timer, if
    gd->timer is NULL and the early timer is not available.

    However dm_timer_init() cannot succeed before initr_dm() is called.

    So it seems that on x86 if we want to use CONFIG_BOOTSTAGE we must enable
    CONFIG_TIMER_EARLY. Update the Kconfig to handle this.

    Note: On most architectures we can rely on the pre-relocation memory still
    being available, so that gd->timer pointers to a valid timer device and
    everything works correctly. Admittedly this is not strictly correct since
    the timer device is set up by pre-relocation U-Boot, but normally this is
    fine. On x86 the 'CAR' (cache-as-RAM) memory used by pre-relocation U-Boot
    disappears in board_init_f_r() and any attempt to access it will hang.
    This is the reason why we must mark the timer as invalid when we get to
    board_init_f_r().

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

    Simon Glass
     

18 Sep, 2018

2 commits


11 Sep, 2018

2 commits


24 Aug, 2018

1 commit


20 Aug, 2018

1 commit

  • At present if TSC frequency is provided in the device tree, it takes
    precedence over hardware calibration result. This swaps the order to
    try hardware calibration first and uses device tree as last resort.

    This can be helpful when a generic dts (eg: coreboot/efi payload) is
    supposed to work on as many hardware as possible, including emulators
    like QEMU where TSC hardware calibration sometimes fails.

    Signed-off-by: Bin Meng
    Reviewed-by: Christian Gmeiner

    Bin Meng
     

02 Jul, 2018

1 commit

  • With the introduction of early timer support in the TSC driver,
    the capability of getting clock rate from device tree was lost
    unfortunately. Now we bring such functionality back, but with a
    limitation that when TSC is used as early timer, specifying clock
    rate from device tree does not work.

    This fixes random boot failures seen on QEMU targets: printing "TSC
    frequency is ZERO" and reset forever.

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

    Bin Meng
     

15 Jun, 2018

1 commit


13 Jun, 2018

1 commit


31 May, 2018

1 commit


11 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
     

28 Apr, 2018

1 commit


26 Apr, 2018

1 commit


14 Mar, 2018

1 commit


30 Nov, 2017

5 commits


06 Nov, 2017

1 commit


19 Sep, 2017

5 commits

  • With dtoc emitting fdt64_t for addresses (and region sizes), the array
    indices for accessing the reg[] array needs to be adjusted. This
    adjusts the Rockchip DM timer driver to correctly handle OF_PLATDATA
    given this new structure layout.

    Signed-off-by: Philipp Tomsich
    Acked-by: Philipp Tomsich
    Reviewed-by: Simon Glass

    Philipp Tomsich
     
  • Update the Rockchip timer driver to support a live device tree.

    Signed-off-by: Philipp Tomsich
    Reviewed-by: Simon Glass
    Acked-by: Philipp Tomsich

    Philipp Tomsich
     
  • To make the Rockchip DM timer driver useful for the timing of
    bootstages, we need a few enhancements:
    - This implements timer_get_boot_us.
    - This avoids reinitialising the timer, if it has already been
    set up (e.g. by our TPL and SPL stages). Now, we have a single
    timebase ticking from TPL through the full U-Boot.
    - This adds support for reading the timer even before the
    device-model is ready: we find the timer via /chosen/tick-timer,
    then read its address and clock-frequency, and finally read the
    timeval directly).

    Signed-off-by: Philipp Tomsich
    Reviewed-by: Simon Glass
    Acked-by: Philipp Tomsich

    Philipp Tomsich
     
  • When used with bootstage recording, dm_timer_init may be called
    surprisingly early: i.e. before dm_root is ready. To deal with
    this case, we explicitly check for this condition and return
    -EAGAIN to the caller (refer to drivers/timer/rockchip_timer.c
    for a case where this is needed/used).

    Signed-off-by: Philipp Tomsich
    Reviewed-by: Simon Glass
    Acked-by: Philipp Tomsich

    Philipp Tomsich
     
  • This updates dm_timer_init to support a live tree and deals with
    some fallout (i.e. the need to restructure the code such, that we
    don't need multiple discontinuous #if CONFIG_IS_ENABLED blocks).

    Signed-off-by: Philipp Tomsich
    Reviewed-by: Simon Glass
    Acked-by: Philipp Tomsich

    Philipp Tomsich
     

16 Sep, 2017

2 commits

  • With bootstage we need access to the timer before driver model is set up.
    To handle this, put the required state in global_data and provide a new
    function to set up the device, separate from the driver's probe() method.

    This will be used by the 'early' timer also.

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

    Simon Glass
     
  • Per the Intel 64 and IA-32 Architecture Software Developer's Manual,
    add the reference clock for Intel Atom Processors based on the Airmont
    Microarchitecture (Braswell).

    This keeps in sync with Linux kernel commit:
    6fcb41c: x86/tsc_msr: Add Airmont reference clock values

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

    Bin Meng
     

05 Sep, 2017

1 commit

  • When I originally added this driver, I did some careless (and in
    retrospect: mindless) copy & paste for the U_BOOT_DRIVER structure
    skeletion... unfortunately, the 'arc_timer' string was committed
    and slipped through all reviews.

    This fixes the U_BOOT_DRIVER name to read 'rockchip_rk3368_timer'
    (as originally intended).

    Signed-off-by: Philipp Tomsich
    Reported-by: Artturi Alm

    Philipp Tomsich
     

27 Aug, 2017

1 commit


13 Aug, 2017

2 commits

  • This adds a device-model driver for the timer block in the RK3368 (and
    similar devices that share the same timer block, such as the RK3288) for
    the down-counting (i.e. non-secure) timers.

    This allows us to configure U-Boot for the RK3368 in such a way that
    we can run with the secure timer inaccessible or uninitialised (note
    that the ARMv8 generic timer does not count, if the secure timer is
    not enabled).

    Signed-off-by: Philipp Tomsich
    Reviewed-by: Simon Glass

    Philipp Tomsich
     
  • To fully support DM timer in SPL and TPL, we need a few things cleaned
    up and normalised:
    - inclusion of the uclass and drivers should be an all-or-nothing
    decision for each stage and under control of $(SPL_TPL_)TIMER
    instead of having the two-level configuration with TIMER and
    $(SPL_TPL_)TIMER_SUPPORT
    - when $(SPL_TPL_)TIMER is enabled, the ARMv8 generic timer code can
    not be compiled in

    This normalises configuration to $(SPL_TPL_)TIMER and moves the config
    options to drivers/timer/Kconfig (and cleans up the collateral damage
    to some defconfigs that had SPL_TIMER_SUPPORT enabled).

    Signed-off-by: Philipp Tomsich
    Reviewed-by: Simon Glass

    Philipp Tomsich