diff --git a/arch/x86/platforms/ia32/Kconfig b/arch/x86/platforms/ia32/Kconfig index 8dd518c4b29..1c7f2ca64ea 100644 --- a/arch/x86/platforms/ia32/Kconfig +++ b/arch/x86/platforms/ia32/Kconfig @@ -41,6 +41,7 @@ config PHYS_LOAD_ADDR default 0x00100000 config SYS_CLOCK_HW_CYCLES_PER_SEC - default 150000000 if PLATFORM_ATOM_N28XX - default 1193180 if PLATFORM_PCMINUTEIA + default 150000000 if LOAPIC_TIMER + default 25000000 if HPET_TIMER + default 1193180 if PIT diff --git a/arch/x86/platforms/ia32_pci/Kconfig b/arch/x86/platforms/ia32_pci/Kconfig index b65ac2d38a9..756845a018e 100644 --- a/arch/x86/platforms/ia32_pci/Kconfig +++ b/arch/x86/platforms/ia32_pci/Kconfig @@ -42,7 +42,10 @@ config PHYS_LOAD_ADDR default 0x00100000 config SYS_CLOCK_HW_CYCLES_PER_SEC - default 25000000 + default 150000000 if LOAPIC_TIMER + default 25000000 if HPET_TIMER + default 1193180 if PIT + config UART_CONSOLE_INDEX default 1 diff --git a/drivers/timer/loapic_timer.c b/drivers/timer/loapic_timer.c index de2ce18cb23..3e528971482 100644 --- a/drivers/timer/loapic_timer.c +++ b/drivers/timer/loapic_timer.c @@ -62,8 +62,8 @@ After reset, the timer is initialized to zero. * LOAPIC_TIMER_IRQ * LOAPIC_TIMER_INT_PRI * - * A board support package's kconf file must provide the following constants: - * CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC + * NOTE: CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC must be provided by either the + * platform configuration file or the project configuration file. */ #include diff --git a/include/sys_clock.h b/include/sys_clock.h index 4b93bf35a8e..cd8a14f3d43 100644 --- a/include/sys_clock.h +++ b/include/sys_clock.h @@ -43,6 +43,11 @@ that use timer functionality. #ifndef _ASMLANGUAGE #include +#if defined(CONFIG_SYS_CLOCK_EXISTS) && \ + (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC == 0) +#error "SYS_CLOCK_HW_CYCLES_PER_SEC must be non-zero!" +#endif + #define sys_clock_ticks_per_sec CONFIG_SYS_CLOCK_TICKS_PER_SEC #define sys_clock_hw_cycles_per_sec CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC diff --git a/kernel/Kconfig b/kernel/Kconfig index 1740bde3562..f18b3073244 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -53,11 +53,12 @@ config SYS_CLOCK_TICKS_PER_SEC This option specifies the frequency of the system clock in Hz. config SYS_CLOCK_HW_CYCLES_PER_SEC - int - #The value is set by each platform's Kconfig file. + int "System clock's h/w timer frequency" + default 0 help - Frequency of the hardware timer used for the system clock - (in Hz). + This option specifies the frequency of the hardware timer used for the + system clock (in Hz). It is normally set by the platform's defconfig file + and the user should generally avoid modifying it via the menu configuration. config SYS_CLOCK_EXISTS bool