Re: [PATCH v4 25/36] nds32: Miscellaneous header files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 18, 2017 at 7:46 AM, Greentime Hu <green.hu@xxxxxxxxx> wrote:
> From: Greentime Hu <greentime@xxxxxxxxxxxxx>
>
> This patch introduces some miscellaneous header files.

> +static inline void __delay(unsigned long loops)
> +{
> +       __asm__ __volatile__(".align 2\n"
> +                            "1:\n"
> +                            "\taddi\t%0, %0, -1\n"
> +                            "\tbgtz\t%0, 1b\n"
> +                            :"=r"(loops)
> +                            :"0"(loops));
> +}
> +
> +static inline void __udelay(unsigned long usecs, unsigned long lpj)
> +{
> +       usecs *= (unsigned long)(((0x8000000000000000ULL / (500000 / HZ)) +
> +                                 0x80000000ULL) >> 32);
> +       usecs = (unsigned long)(((unsigned long long)usecs * lpj) >> 32);
> +       __delay(usecs);
> +}

Do you have a reliable clocksource that you can read here instead of doing the
loop? It's generally preferred to have an accurate delay if at all possible, the
delay loop calibration is only for those architectures that don't have any
way to observe how much time has passed accurately.

       Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux