h8300: update timer handler - misc update

- Update selection
- Update common timer handler
- Add support functions

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Yoshinori Sato 2008-10-15 22:01:17 -07:00 committed by Linus Torvalds
parent e0b0f9e4ea
commit 81d423e280
4 changed files with 102 additions and 88 deletions

View file

@ -1,5 +1,7 @@
menu "Processor type and features" menu "Processor type and features"
source "kernel/time/Kconfig"
choice choice
prompt "H8/300 platform" prompt "H8/300 platform"
default H8300H_GENERIC default H8300H_GENERIC
@ -11,6 +13,7 @@ config H8300H_GENERIC
config H8300H_AKI3068NET config H8300H_AKI3068NET
bool "AE-3068/69" bool "AE-3068/69"
select CONFIG_H83068
help help
AKI-H8/3068F / AKI-H8/3069F Flashmicom LAN Board Support AKI-H8/3068F / AKI-H8/3069F Flashmicom LAN Board Support
More Information. (Japanese Only) More Information. (Japanese Only)
@ -21,6 +24,7 @@ config H8300H_AKI3068NET
config H8300H_H8MAX config H8300H_H8MAX
bool "H8MAX" bool "H8MAX"
select CONFIG_H83068
help help
H8MAX Evaluation Board Support H8MAX Evaluation Board Support
More Information. (Japanese Only) More Information. (Japanese Only)
@ -28,6 +32,7 @@ config H8300H_H8MAX
config H8300H_SIM config H8300H_SIM
bool "H8/300H Simulator" bool "H8/300H Simulator"
select CONFIG_H83007
help help
GDB Simulator Support GDB Simulator Support
More Information. More Information.
@ -40,6 +45,7 @@ config H8S_GENERIC
config H8S_EDOSK2674 config H8S_EDOSK2674
bool "EDOSK-2674" bool "EDOSK-2674"
select CONFIG_H8S2768
help help
Renesas EDOSK-2674 Evaluation Board Support Renesas EDOSK-2674 Evaluation Board Support
More Information. More Information.
@ -55,44 +61,37 @@ config H8S_SIM
endchoice endchoice
if (H8300H_GENERIC || H8S_GENERIC)
menu "Detail Selection"
if (H8300H_GENERIC)
choice choice
prompt "CPU Selection" prompt "CPU Selection"
config H83002 config H83002
bool "H8/3001,3002,3003" bool "H8/3001,3002,3003"
select CPU_H8300H
config H83007 config H83007
bool "H8/3006,3007" bool "H8/3006,3007"
select CPU_H8300H
config H83048 config H83048
bool "H8/3044,3045,3046,3047,3048,3052" bool "H8/3044,3045,3046,3047,3048,3052"
select CPU_H8300H
config H83068 config H83068
bool "H8/3065,3066,3067,3068,3069" bool "H8/3065,3066,3067,3068,3069"
endchoice select CPU_H8300H
endif
if (H8S_GENERIC)
choice
prompt "CPU Selection"
config H8S2678 config H8S2678
bool "H8S/2670,2673,2674R,2675,2676" bool "H8S/2670,2673,2674R,2675,2676"
select CPU_H8S
endchoice endchoice
endif
config CPU_CLOCK config CPU_CLOCK
int "CPU Clock Frequency (/1KHz)" int "CPU Clock Frequency (/1KHz)"
default "20000" default "20000"
help help
CPU Clock Frequency divide to 1000 CPU Clock Frequency divide to 1000
endmenu
endif
if (H8300H_GENERIC || H8S_GENERIC || H8300H_SIM || H8S_SIM || H8S_EDOSK2674)
choice choice
prompt "Kernel executes from" prompt "Kernel executes from"
---help--- ---help---
@ -107,65 +106,8 @@ config ROMKERNEL
bool "ROM" bool "ROM"
help help
The kernel will be resident in FLASH/ROM when running. The kernel will be resident in FLASH/ROM when running.
endchoice endchoice
endif
if (H8300H_AKI3068NET)
config H83068
bool
default y
config CPU_CLOCK
int
default "20000"
config RAMKERNEL
bool
default y
endif
if (H8300H_H8MAX)
config H83068
bool
default y
config CPU_CLOCK
int
default 25000
config RAMKERNEL
bool
default y
endif
if (H8300H_SIM)
config H83007
bool
default y
config CPU_CLOCK
int
default "16000"
endif
if (H8S_EDOSK2674)
config H8S2678
bool
default y
config CPU_CLOCK
int
default 33000
endif
if (H8S_SIM)
config H8S2678
bool
default y
config CPU_CLOCK
int
default 33000
endif
config CPU_H8300H config CPU_H8300H
bool bool
@ -177,6 +119,49 @@ config CPU_H8S
depends on H8S2678 depends on H8S2678
default y default y
choice
prompt "Timer"
config H8300_TIMER8
bool "8bit timer (2ch cascade)"
depends on (H83007 || H83068 || H8S2678)
config H8300_TIMER16
bool "16bit timer"
depends on (H83007 || H83068)
config H8300_ITU
bool "ITU"
depends on (H83002 || H83048)
config H8300_TPU
bool "TPU"
depends on H8S2678
endchoice
if H8300_TIMER8
choice
prompt "Timer Channel"
config H8300_TIMER8_CH0
bool "Channel 0"
config H8300_TIMER8_CH2
bool "Channel 2"
depends on CPU_H8300H
endchoice
endif
config H8300_TIMER16_CH
int "16bit timer channel (0 - 2)"
depends on H8300_TIMER16
range 0 2
config H8300_ITU_CH
int "ITU channel"
depends on H8300_ITU
config H8300_TPU_CH
int "TPU channel"
depends on H8300_TPU
config PREEMPT config PREEMPT
bool "Preemptible Kernel" bool "Preemptible Kernel"
default n default n

View file

@ -295,6 +295,40 @@ static __inline__ void ctrl_outl(unsigned long b, unsigned long addr)
*(volatile unsigned long*)addr = b; *(volatile unsigned long*)addr = b;
} }
static __inline__ void ctrl_bclr(int b, unsigned long addr)
{
if (__builtin_constant_p(b))
switch (b) {
case 0: __asm__("bclr #0,@%0"::"r"(addr)); break;
case 1: __asm__("bclr #1,@%0"::"r"(addr)); break;
case 2: __asm__("bclr #2,@%0"::"r"(addr)); break;
case 3: __asm__("bclr #3,@%0"::"r"(addr)); break;
case 4: __asm__("bclr #4,@%0"::"r"(addr)); break;
case 5: __asm__("bclr #5,@%0"::"r"(addr)); break;
case 6: __asm__("bclr #6,@%0"::"r"(addr)); break;
case 7: __asm__("bclr #7,@%0"::"r"(addr)); break;
}
else
__asm__("bclr %w0,@%1"::"r"(b), "r"(addr));
}
static __inline__ void ctrl_bset(int b, unsigned long addr)
{
if (__builtin_constant_p(b))
switch (b) {
case 0: __asm__("bset #0,@%0"::"r"(addr)); break;
case 1: __asm__("bset #1,@%0"::"r"(addr)); break;
case 2: __asm__("bset #2,@%0"::"r"(addr)); break;
case 3: __asm__("bset #3,@%0"::"r"(addr)); break;
case 4: __asm__("bset #4,@%0"::"r"(addr)); break;
case 5: __asm__("bset #5,@%0"::"r"(addr)); break;
case 6: __asm__("bset #6,@%0"::"r"(addr)); break;
case 7: __asm__("bset #7,@%0"::"r"(addr)); break;
}
else
__asm__("bset %w0,@%1"::"r"(b), "r"(addr));
}
/* Pages to physical address... */ /* Pages to physical address... */
#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT) #define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
#define page_to_bus(page) ((page - mem_map) << PAGE_SHIFT) #define page_to_bus(page) ((page - mem_map) << PAGE_SHIFT)

View file

@ -7,6 +7,6 @@ extra-y := vmlinux.lds
obj-y := process.o traps.o ptrace.o irq.o \ obj-y := process.o traps.o ptrace.o irq.o \
sys_h8300.o time.o signal.o \ sys_h8300.o time.o signal.o \
setup.o gpio.o init_task.o syscalls.o \ setup.o gpio.o init_task.o syscalls.o \
entry.o entry.o timer/
obj-$(CONFIG_MODULES) += module.o h8300_ksyms.o obj-$(CONFIG_MODULES) += module.o h8300_ksyms.o

View file

@ -27,27 +27,21 @@
#include <linux/profile.h> #include <linux/profile.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/target_time.h> #include <asm/timer.h>
#define TICK_SIZE (tick_nsec / 1000) #define TICK_SIZE (tick_nsec / 1000)
/* void h8300_timer_tick(void)
* timer_interrupt() needs to keep up the real-time clock,
* as well as call the "do_timer()" routine every clocktick
*/
static void timer_interrupt(int irq, void *dummy, struct pt_regs * regs)
{ {
/* may need to kick the hardware timer */ if (current->pid)
platform_timer_eoi(); profile_tick(CPU_PROFILING);
write_seqlock(&xtime_lock);
do_timer(1); do_timer(1);
#ifndef CONFIG_SMP write_sequnlock(&xtime_lock);
update_process_times(user_mode(regs)); update_process_times(user_mode(get_irq_regs()));
#endif
profile_tick(CPU_PROFILING);
} }
void time_init(void) void __init time_init(void)
{ {
unsigned int year, mon, day, hour, min, sec; unsigned int year, mon, day, hour, min, sec;
@ -57,12 +51,13 @@ void time_init(void)
year = 1980; year = 1980;
mon = day = 1; mon = day = 1;
hour = min = sec = 0; hour = min = sec = 0;
platform_gettod (&year, &mon, &day, &hour, &min, &sec); #ifdef CONFIG_H8300_GETTOD
h8300_gettod (&year, &mon, &day, &hour, &min, &sec);
#endif
if ((year += 1900) < 1970) if ((year += 1900) < 1970)
year += 100; year += 100;
xtime.tv_sec = mktime(year, mon, day, hour, min, sec); xtime.tv_sec = mktime(year, mon, day, hour, min, sec);
xtime.tv_nsec = 0; xtime.tv_nsec = 0;
platform_timer_setup(timer_interrupt); h8300_timer_setup();
} }