* [U-Boot] [PATCH] arm/s5pxx: Fix get_timer_masked to get the time.
@ 2012-07-02 23:50 Zhong Hongbo
2012-07-05 11:55 ` Zhong Hongbo
0 siblings, 1 reply; 6+ messages in thread
From: Zhong Hongbo @ 2012-07-02 23:50 UTC (permalink / raw)
To: u-boot
From: Zhong Hongbo <bocui107@gmail.com>
In general, The get_timer_masked function get the system time,
no the number of ticks. Such as the nand_wait_ready will use
get_timer_masked to delay the operations. And change the system
time to adopt to the CONFIG_SYS_HZ.
Signed-off-by: Hongbo Zhong <bocui107@gmail.com>
---
arch/arm/cpu/armv7/s5p-common/pwm.c | 2 +-
arch/arm/cpu/armv7/s5p-common/timer.c | 20 ++++++++++++++++----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/arch/arm/cpu/armv7/s5p-common/pwm.c b/arch/arm/cpu/armv7/s5p-common/pwm.c
index 58d279e..44d7bc3 100644
--- a/arch/arm/cpu/armv7/s5p-common/pwm.c
+++ b/arch/arm/cpu/armv7/s5p-common/pwm.c
@@ -170,7 +170,7 @@ int pwm_init(int pwm_id, int div, int invert)
timer_rate_hz = get_pwm_clk() / ((prescaler + 1) *
(div + 1));
- timer_rate_hz = timer_rate_hz / 100;
+ timer_rate_hz = timer_rate_hz / CONFIG_SYS_HZ;
/* set count value */
offset = pwm_id * 3;
diff --git a/arch/arm/cpu/armv7/s5p-common/timer.c b/arch/arm/cpu/armv7/s5p-common/timer.c
index 359c21f..bb0e795 100644
--- a/arch/arm/cpu/armv7/s5p-common/timer.c
+++ b/arch/arm/cpu/armv7/s5p-common/timer.c
@@ -31,6 +31,8 @@
DECLARE_GLOBAL_DATA_PTR;
+unsigned long get_current_tick(void);
+
/* macro to read the 16 bit timer */
static inline struct s5p_timer *s5p_get_base_timer(void)
{
@@ -44,6 +46,8 @@ int timer_init(void)
pwm_config(4, 0, 0);
pwm_enable(4);
+ reset_timer_masked();
+
return 0;
}
@@ -72,16 +76,16 @@ void __udelay(unsigned long usec)
* 3. finish normalize.
*/
tmo = usec / 1000;
- tmo *= (CONFIG_SYS_HZ * count_value / 10);
+ tmo *= (CONFIG_SYS_HZ * count_value);
tmo /= 1000;
} else {
/* else small number, don't kill it prior to HZ multiply */
- tmo = usec * CONFIG_SYS_HZ * count_value / 10;
+ tmo = usec * CONFIG_SYS_HZ * count_value;
tmo /= (1000 * 1000);
}
/* get current timestamp */
- tmp = get_timer(0);
+ tmp = get_current_tick();
/* if setting this fordward will roll time stamp */
/* reset "advancing" timestamp to 0, set lastinc value */
@@ -92,7 +96,7 @@ void __udelay(unsigned long usec)
tmo += tmp;
/* loop till event */
- while (get_timer_masked() < tmo)
+ while (get_current_tick() < tmo)
; /* nop */
}
@@ -108,6 +112,14 @@ void reset_timer_masked(void)
unsigned long get_timer_masked(void)
{
struct s5p_timer *const timer = s5p_get_base_timer();
+ unsigned long count_value = readl(&timer->tcntb4);
+
+ return get_current_tick() / count_value;
+}
+
+unsigned long get_current_tick(void)
+{
+ struct s5p_timer *const timer = s5p_get_base_timer();
unsigned long now = readl(&timer->tcnto4);
unsigned long count_value = readl(&timer->tcntb4);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] arm/s5pxx: Fix get_timer_masked to get the time.
2012-07-02 23:50 [U-Boot] [PATCH] arm/s5pxx: Fix get_timer_masked to get the time Zhong Hongbo
@ 2012-07-05 11:55 ` Zhong Hongbo
2012-07-06 2:13 ` Minkyu Kang
0 siblings, 1 reply; 6+ messages in thread
From: Zhong Hongbo @ 2012-07-05 11:55 UTC (permalink / raw)
To: u-boot
Hi Minkyu,
Could you help me to review it?
Thanks,
hongbo
On 07/03/2012 07:50 AM, Zhong Hongbo wrote:
> From: Zhong Hongbo <bocui107@gmail.com>
>
> In general, The get_timer_masked function get the system time,
> no the number of ticks. Such as the nand_wait_ready will use
> get_timer_masked to delay the operations. And change the system
> time to adopt to the CONFIG_SYS_HZ.
>
> Signed-off-by: Hongbo Zhong <bocui107@gmail.com>
> ---
> arch/arm/cpu/armv7/s5p-common/pwm.c | 2 +-
> arch/arm/cpu/armv7/s5p-common/timer.c | 20 ++++++++++++++++----
> 2 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/s5p-common/pwm.c b/arch/arm/cpu/armv7/s5p-common/pwm.c
> index 58d279e..44d7bc3 100644
> --- a/arch/arm/cpu/armv7/s5p-common/pwm.c
> +++ b/arch/arm/cpu/armv7/s5p-common/pwm.c
> @@ -170,7 +170,7 @@ int pwm_init(int pwm_id, int div, int invert)
> timer_rate_hz = get_pwm_clk() / ((prescaler + 1) *
> (div + 1));
>
> - timer_rate_hz = timer_rate_hz / 100;
> + timer_rate_hz = timer_rate_hz / CONFIG_SYS_HZ;
>
> /* set count value */
> offset = pwm_id * 3;
> diff --git a/arch/arm/cpu/armv7/s5p-common/timer.c b/arch/arm/cpu/armv7/s5p-common/timer.c
> index 359c21f..bb0e795 100644
> --- a/arch/arm/cpu/armv7/s5p-common/timer.c
> +++ b/arch/arm/cpu/armv7/s5p-common/timer.c
> @@ -31,6 +31,8 @@
>
> DECLARE_GLOBAL_DATA_PTR;
>
> +unsigned long get_current_tick(void);
> +
> /* macro to read the 16 bit timer */
> static inline struct s5p_timer *s5p_get_base_timer(void)
> {
> @@ -44,6 +46,8 @@ int timer_init(void)
> pwm_config(4, 0, 0);
> pwm_enable(4);
>
> + reset_timer_masked();
> +
> return 0;
> }
>
> @@ -72,16 +76,16 @@ void __udelay(unsigned long usec)
> * 3. finish normalize.
> */
> tmo = usec / 1000;
> - tmo *= (CONFIG_SYS_HZ * count_value / 10);
> + tmo *= (CONFIG_SYS_HZ * count_value);
> tmo /= 1000;
> } else {
> /* else small number, don't kill it prior to HZ multiply */
> - tmo = usec * CONFIG_SYS_HZ * count_value / 10;
> + tmo = usec * CONFIG_SYS_HZ * count_value;
> tmo /= (1000 * 1000);
> }
>
> /* get current timestamp */
> - tmp = get_timer(0);
> + tmp = get_current_tick();
>
> /* if setting this fordward will roll time stamp */
> /* reset "advancing" timestamp to 0, set lastinc value */
> @@ -92,7 +96,7 @@ void __udelay(unsigned long usec)
> tmo += tmp;
>
> /* loop till event */
> - while (get_timer_masked() < tmo)
> + while (get_current_tick() < tmo)
> ; /* nop */
> }
>
> @@ -108,6 +112,14 @@ void reset_timer_masked(void)
> unsigned long get_timer_masked(void)
> {
> struct s5p_timer *const timer = s5p_get_base_timer();
> + unsigned long count_value = readl(&timer->tcntb4);
> +
> + return get_current_tick() / count_value;
> +}
> +
> +unsigned long get_current_tick(void)
> +{
> + struct s5p_timer *const timer = s5p_get_base_timer();
> unsigned long now = readl(&timer->tcnto4);
> unsigned long count_value = readl(&timer->tcntb4);
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] arm/s5pxx: Fix get_timer_masked to get the time.
2012-07-05 11:55 ` Zhong Hongbo
@ 2012-07-06 2:13 ` Minkyu Kang
2012-07-06 4:43 ` Jaehoon Chung
0 siblings, 1 reply; 6+ messages in thread
From: Minkyu Kang @ 2012-07-06 2:13 UTC (permalink / raw)
To: u-boot
Dear Jaehoon and Donghwa,
On 5 July 2012 20:55, Zhong Hongbo <bocui107@gmail.com> wrote:
> Hi Minkyu,
>
> Could you help me to review it?
>
> Thanks,
> hongbo
>
> On 07/03/2012 07:50 AM, Zhong Hongbo wrote:
>> From: Zhong Hongbo <bocui107@gmail.com>
>>
>> In general, The get_timer_masked function get the system time,
>> no the number of ticks. Such as the nand_wait_ready will use
>> get_timer_masked to delay the operations. And change the system
>> time to adopt to the CONFIG_SYS_HZ.
>>
>> Signed-off-by: Hongbo Zhong <bocui107@gmail.com>
>> ---
>> arch/arm/cpu/armv7/s5p-common/pwm.c | 2 +-
>> arch/arm/cpu/armv7/s5p-common/timer.c | 20 ++++++++++++++++----
>> 2 files changed, 17 insertions(+), 5 deletions(-)
>>
Could please test this patch.
Thanks.
Minkyu Kang.
--
from. prom.
www.promsoft.net
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] arm/s5pxx: Fix get_timer_masked to get the time.
2012-07-06 2:13 ` Minkyu Kang
@ 2012-07-06 4:43 ` Jaehoon Chung
2012-07-06 11:20 ` Minkyu Kang
0 siblings, 1 reply; 6+ messages in thread
From: Jaehoon Chung @ 2012-07-06 4:43 UTC (permalink / raw)
To: u-boot
Hi Minkyu,
I tested on trats-board.
I think it's working fine.
Tested-by: Jaehoon Chung<jh80.chung@samsung.com>
Best Regards,
Jaehoon Chung
On 07/06/2012 11:13 AM, Minkyu Kang wrote:
> Dear Jaehoon and Donghwa,
>
> On 5 July 2012 20:55, Zhong Hongbo <bocui107@gmail.com> wrote:
>> Hi Minkyu,
>>
>> Could you help me to review it?
>>
>> Thanks,
>> hongbo
>>
>> On 07/03/2012 07:50 AM, Zhong Hongbo wrote:
>>> From: Zhong Hongbo <bocui107@gmail.com>
>>>
>>> In general, The get_timer_masked function get the system time,
>>> no the number of ticks. Such as the nand_wait_ready will use
>>> get_timer_masked to delay the operations. And change the system
>>> time to adopt to the CONFIG_SYS_HZ.
>>>
>>> Signed-off-by: Hongbo Zhong <bocui107@gmail.com>
>>> ---
>>> arch/arm/cpu/armv7/s5p-common/pwm.c | 2 +-
>>> arch/arm/cpu/armv7/s5p-common/timer.c | 20 ++++++++++++++++----
>>> 2 files changed, 17 insertions(+), 5 deletions(-)
>>>
>
> Could please test this patch.
>
> Thanks.
> Minkyu Kang.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] arm/s5pxx: Fix get_timer_masked to get the time.
2012-07-06 4:43 ` Jaehoon Chung
@ 2012-07-06 11:20 ` Minkyu Kang
2012-07-06 11:37 ` Zhong Hongbo
0 siblings, 1 reply; 6+ messages in thread
From: Minkyu Kang @ 2012-07-06 11:20 UTC (permalink / raw)
To: u-boot
On 6 July 2012 13:43, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> Hi Minkyu,
>
> I tested on trats-board.
> I think it's working fine.
>
> Tested-by: Jaehoon Chung<jh80.chung@samsung.com>
>
> Best Regards,
> Jaehoon Chung
>
> On 07/06/2012 11:13 AM, Minkyu Kang wrote:
>
>> Dear Jaehoon and Donghwa,
>>
>> On 5 July 2012 20:55, Zhong Hongbo <bocui107@gmail.com> wrote:
>>> Hi Minkyu,
>>>
>>> Could you help me to review it?
>>>
>>> Thanks,
>>> hongbo
>>>
>>> On 07/03/2012 07:50 AM, Zhong Hongbo wrote:
>>>> From: Zhong Hongbo <bocui107@gmail.com>
>>>>
>>>> In general, The get_timer_masked function get the system time,
>>>> no the number of ticks. Such as the nand_wait_ready will use
>>>> get_timer_masked to delay the operations. And change the system
>>>> time to adopt to the CONFIG_SYS_HZ.
>>>>
>>>> Signed-off-by: Hongbo Zhong <bocui107@gmail.com>
>>>> ---
applied to u-boot-samsung.
Thanks.
Minkyu Kang.
--
from. prom.
www.promsoft.net
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] arm/s5pxx: Fix get_timer_masked to get the time.
2012-07-06 11:20 ` Minkyu Kang
@ 2012-07-06 11:37 ` Zhong Hongbo
0 siblings, 0 replies; 6+ messages in thread
From: Zhong Hongbo @ 2012-07-06 11:37 UTC (permalink / raw)
To: u-boot
On 07/06/2012 07:20 PM, Minkyu Kang wrote:
> On 6 July 2012 13:43, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>> Hi Minkyu,
>>
>> I tested on trats-board.
>> I think it's working fine.
>>
>> Tested-by: Jaehoon Chung<jh80.chung@samsung.com>
>>
>> Best Regards,
>> Jaehoon Chung
>>
>> On 07/06/2012 11:13 AM, Minkyu Kang wrote:
>>
>>> Dear Jaehoon and Donghwa,
>>>
>>> On 5 July 2012 20:55, Zhong Hongbo <bocui107@gmail.com> wrote:
>>>> Hi Minkyu,
>>>>
>>>> Could you help me to review it?
>>>>
>>>> Thanks,
>>>> hongbo
>>>>
>>>> On 07/03/2012 07:50 AM, Zhong Hongbo wrote:
>>>>> From: Zhong Hongbo <bocui107@gmail.com>
>>>>>
>>>>> In general, The get_timer_masked function get the system time,
>>>>> no the number of ticks. Such as the nand_wait_ready will use
>>>>> get_timer_masked to delay the operations. And change the system
>>>>> time to adopt to the CONFIG_SYS_HZ.
>>>>>
>>>>> Signed-off-by: Hongbo Zhong <bocui107@gmail.com>
>>>>> ---
>
> applied to u-boot-samsung.
Hi Jaehoon and Minkyu,
Thanks?
BR?
hongbo
>
> Thanks.
> Minkyu Kang.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-07-06 11:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-02 23:50 [U-Boot] [PATCH] arm/s5pxx: Fix get_timer_masked to get the time Zhong Hongbo
2012-07-05 11:55 ` Zhong Hongbo
2012-07-06 2:13 ` Minkyu Kang
2012-07-06 4:43 ` Jaehoon Chung
2012-07-06 11:20 ` Minkyu Kang
2012-07-06 11:37 ` Zhong Hongbo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox