From: Peng Fan <van.freenix@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V4 05/32] time: add wait_mask_set/clr_timeout helper functions
Date: Wed, 10 Jan 2018 12:08:08 +0800 [thread overview]
Message-ID: <20180110040345.GA29758@shlinux2> (raw)
In-Reply-To: <CAK7LNAS2TpwEhyW-j0JnD3nSCT0dC_G7hi45X-QXknGmcK9V4w@mail.gmail.com>
On Wed, Jan 10, 2018 at 12:19:28PM +0900, Masahiro Yamada wrote:
>2018-01-10 12:05 GMT+09:00 Peng Fan <peng.fan@nxp.com>:
>> Add heler functions for wait mask set/clr.
>>
>> Signed-off-by: Peng Fan <peng.fan@nxp.com>
>> Cc: Stefano Babic <sbabic@denx.de>
>> Cc: Fabio Estevam <fabio.estevam@nxp.com>
>> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
>> Cc: Simon Glass <sjg@chromium.org>
>> ---
>> include/linux/delay.h | 4 ++++
>> lib/time.c | 30 ++++++++++++++++++++++++++++++
>> 2 files changed, 34 insertions(+)
>>
>> diff --git a/include/linux/delay.h b/include/linux/delay.h
>> index 3dcd435d0d..b08fcb8c09 100644
>> --- a/include/linux/delay.h
>> +++ b/include/linux/delay.h
>> @@ -21,4 +21,8 @@ static inline void ndelay(unsigned long nsec)
>> udelay(DIV_ROUND_UP(nsec, 1000));
>> }
>>
>> +int wait_mask_set_timeout(void *addr, u32 mask, u32 timeout);
>> +
>> +int wait_mask_clr_timeout(void *addr, u32 mask, u32 timeout);
>> +
>> #endif /* defined(_LINUX_DELAY_H) */
>> diff --git a/lib/time.c b/lib/time.c
>> index aed1a091f2..9701287629 100644
>> --- a/lib/time.c
>> +++ b/lib/time.c
>> @@ -171,3 +171,33 @@ void udelay(unsigned long usec)
>> usec -= kv;
>> } while(usec);
>> }
>> +
>> +int wait_mask_set_timeout(void *addr, u32 mask, u32 timeout)
>> +{
>> + unsigned long long end_tick;
>> + u32 val;
>> +
>> + end_tick = usec_to_tick(timeout) + get_ticks();
>> + do {
>> + val = readl(addr);
>> + if ((val & mask) == mask)
>> + return 0;
>> + } while (end_tick > get_ticks());
>> +
>> + return -ETIMEDOUT;
>> +}
>> +
>> +int wait_mask_clr_timeout(void *addr, u32 mask, u32 timeout)
>> +{
>> + unsigned long long end_tick;
>> + u32 val;
>> +
>> + end_tick = usec_to_tick(timeout) + get_ticks();
>> + do {
>> + val = readl(addr);
>> + if (!(val & mask))
>> + return 0;
>> + } while (end_tick > get_ticks());
>> +
>> + return -ETIMEDOUT;
>> +}
>> --
>
>NACK.
>
>You are re-inventing wheel.
>
>Please use include/linux/iopoll.h
Thanks for the info. I'll discard this patch and fix the usage in the patchset.
Thanks,
Peng.
>
>
>
>
>
>--
>Best Regards
>Masahiro Yamada
>_______________________________________________
>U-Boot mailing list
>U-Boot at lists.denx.de
>https://lists.denx.de/listinfo/u-boot
--
next prev parent reply other threads:[~2018-01-10 4:08 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-10 3:05 [U-Boot] [PATCH V4 00/32] imx: add i.MX8M support and i.MX8MQ EVK Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 01/32] arm: imx: Rework i.MX specific commands to be excluded from SPL Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 02/32] imx: add i.MX8M into Kconfig Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 03/32] imx: mx8m: add register definition header file Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 04/32] imx: mx8m: add pin " Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 05/32] time: add wait_mask_set/clr_timeout helper functions Peng Fan
2018-01-10 3:19 ` Masahiro Yamada
2018-01-10 4:08 ` Peng Fan [this message]
2018-01-10 3:05 ` [U-Boot] [PATCH V4 06/32] imx: mx8m: add clock driver Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 07/32] imx: add sip function Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 08/32] imx: boot_mode: add USB_BOOT entry Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 09/32] imx: cpu: update cpu file to support i.MX8M Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 10/32] imx: spl: implement spl_boot_device for i.MX8M Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 11/32] imx: add i.MX8MQ SoC Revision and is_mx8m helper Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 12/32] imx: add pad settings bit definition for i.MX8M Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 13/32] imx: cpu: move speed/temp to common cpu Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 14/32] imx: cpu: add cpu speed/grade for i.MX8M Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 15/32] imx: refactor imx_get_mac_from_fuse Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 16/32] imx: cleanup bootaux Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 17/32] imx: bootaux: support i.MX8M Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 18/32] imx: mx7: move get_boot_device to cpu.c Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 19/32] imx: cpu: support get_boot_device for i.MX8M Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 20/32] imx: mx7: move mmc env code to mmc_env.c Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 21/32] imx: mx8m: add soc related settings and files Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 22/32] imx: makefile: compile files for i.MX8M Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 23/32] misc: ocotp: add i.MX8M support Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 24/32] mmc: fsl_esdhc: support i.MX8M Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 25/32] imx: lcdif: include i.MX8M Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 26/32] gpio: mxc: add i.MX8M support Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 27/32] net: fec: do not access reserved register for i.MX8M Peng Fan
2018-01-10 3:05 ` [U-Boot] [PATCH V4 28/32] net: fec: fix build warnings for 64bits support Peng Fan
2018-01-10 3:06 ` [U-Boot] [PATCH V4 29/32] imx: imx8mq: add dtsi file Peng Fan
2018-01-10 3:06 ` [U-Boot] [PATCH V4 30/32] power: pmic/regulator allow dm be omitted by SPL Peng Fan
2018-01-17 12:15 ` Jaehoon Chung
2018-01-10 3:06 ` [U-Boot] [PATCH V4 31/32] imx: mx8m: add ddr controller memory map Peng Fan
2018-01-10 3:06 ` [U-Boot] [PATCH V4 32/32] imx: add i.MX8MQ EVK support Peng Fan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180110040345.GA29758@shlinux2 \
--to=van.freenix@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox