[Linux-Xtensa] Re: [PATCH] xtensa: kernel: let variable 'ccount_freq' consistent with 'XTENSA_CALIBRATE_CCOUNT'

Baruch Siach baruch at tkos.co.il
Sun Jul 14 20:47:22 PDT 2013


Hi Chen Gang,

On Mon, Jul 15, 2013 at 09:49:36AM +0800, Chen Gang wrote:
> When 'XTENSA_CALIBRATE_CCOUNT' disabled, we can not use the features
> which related 'ccount_freq'.
> 
> Compiling with randconfig for cpu dc233c with dc233c overlay file, gcc
> 4.9.0 20130704 (experimental) and binutils-2.22.
> 
> The related config file is in attachment.
> 
> The related error:
> 
>     CC      arch/xtensa/kernel/time.o
>   arch/xtensa/kernel/time.c: In function ‘time_init’:
>   arch/xtensa/kernel/time.c:139:53: error: ‘ccount_freq’ undeclared (first use in this function)
>     clockevents_config_and_register(&ccount_timer.evt, ccount_freq, 0xf,

Thanks for reporting.

> Signed-off-by: Chen Gang <gang.chen at asianux.com>
> ---
>  arch/xtensa/kernel/time.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
> index 24bb0c17..c11941e 100644
> --- a/arch/xtensa/kernel/time.c
> +++ b/arch/xtensa/kernel/time.c
> @@ -136,12 +136,16 @@ void __init time_init(void)
>  	ccount_timer.evt.irq = irq_create_mapping(NULL, LINUX_TIMER_INT);
>  	if (WARN(!ccount_timer.evt.irq, "error: can't map timer irq"))
>  		return;
> +#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
>  	clockevents_config_and_register(&ccount_timer.evt, ccount_freq, 0xf,
>  			0xffffffff);
> +#endif
>  	setup_irq(ccount_timer.evt.irq, &timer_irqaction);

Enabling the interrupt while skipping the clockevents registration doesn't 
make much sense. The correct fix, in my opinion, is to define ccount_freq for 
!CONFIG_XTENSA_CALIBRATE_CCOUNT. I'll send a patch shortly.

>  	ccount_timer.irq_enabled = 1;
>  
> +#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
>  	setup_sched_clock(ccount_sched_clock_read, 32, ccount_freq);
> +#endif
>  }
>  
>  /*

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -


More information about the linux-xtensa mailing list