Skip to content
Snippets Groups Projects
Forked from Reform / reform-boundary-uboot
29703 commits behind the upstream repository.
  • Stephen Warren's avatar
    2cd1b572
    time: fix usec_to_tick() · 2cd1b572
    Stephen Warren authored
    
    Commit 8dfafdde ("Introduce common timer functions") created a
    common definition of usec_to_tick() which had a couple problems:
    
    static unsigned long long usec_to_tick(unsigned long usec)
    {
           uint64_t tick = usec * get_tbclk();
    
    That likely overflows.
    
           usec *= get_tbclk();
    
    That was an attempt to fix it by performing the multiply after the
    promotion of usec to 64-bit, but was applied to the wrong variable,
    which was never used.
    
    This patch fixes these issues. A user-visible symptom of the problem was
    the e.g. "dhcp zImage" using an ASIX USB Ethernet dongle would print:
    
    Waiting for Ethernet connection... unable to connect.
    
    ... with no delay before "unable to connect". There are likely other
    symptoms.
    
    Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
    Acked-by: default avatarRob Herring <rob.herring@calxeda.com>
    2cd1b572
    History
    time: fix usec_to_tick()
    Stephen Warren authored
    
    Commit 8dfafdde ("Introduce common timer functions") created a
    common definition of usec_to_tick() which had a couple problems:
    
    static unsigned long long usec_to_tick(unsigned long usec)
    {
           uint64_t tick = usec * get_tbclk();
    
    That likely overflows.
    
           usec *= get_tbclk();
    
    That was an attempt to fix it by performing the multiply after the
    promotion of usec to 64-bit, but was applied to the wrong variable,
    which was never used.
    
    This patch fixes these issues. A user-visible symptom of the problem was
    the e.g. "dhcp zImage" using an ASIX USB Ethernet dongle would print:
    
    Waiting for Ethernet connection... unable to connect.
    
    ... with no delay before "unable to connect". There are likely other
    symptoms.
    
    Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
    Acked-by: default avatarRob Herring <rob.herring@calxeda.com>
time.c 2.11 KiB