[uClinux-dev] Re: [PATCH v2] m68knommu: Add Coldfire DMA Timer support
Hi Sebastian, Benedikt, Sebastian Siewior wrote: This one could be used as a hrtimer. Signed-off-by: Benedikt Spranger <[EMAIL PROTECTED]> Signed-off-by: Sebastian Siewior <[EMAIL PROTECTED]> This looks good now. Regards Greg I - added DMA_TIMER_X define - removed the comment - added a new comment which describes what is done - changed from reseting to free counting. The counter continues to count after the overflow. arch/m68knommu/platform/coldfire/Makefile|2 +- arch/m68knommu/platform/coldfire/dma_timer.c | 68 ++ 2 files changed, 69 insertions(+), 1 deletions(-) create mode 100644 arch/m68knommu/platform/coldfire/dma_timer.c diff --git a/arch/m68knommu/platform/coldfire/Makefile b/arch/m68knommu/platform/coldfire/Makefile index 40cf20b..4f416a9 100644 --- a/arch/m68knommu/platform/coldfire/Makefile +++ b/arch/m68knommu/platform/coldfire/Makefile @@ -18,7 +18,7 @@ obj-$(CONFIG_COLDFIRE)+= dma.o entry.o vectors.o obj-$(CONFIG_M5206)+= timers.o obj-$(CONFIG_M5206e) += timers.o obj-$(CONFIG_M520x)+= pit.o -obj-$(CONFIG_M523x)+= pit.o +obj-$(CONFIG_M523x)+= pit.o dma_timer.o obj-$(CONFIG_M5249)+= timers.o obj-$(CONFIG_M527x)+= pit.o obj-$(CONFIG_M5272)+= timers.o diff --git a/arch/m68knommu/platform/coldfire/dma_timer.c b/arch/m68knommu/platform/coldfire/dma_timer.c new file mode 100644 index 000..b623c99 --- /dev/null +++ b/arch/m68knommu/platform/coldfire/dma_timer.c @@ -0,0 +1,68 @@ +/* + * dma_timer.c -- Freescale ColdFire DMA Timer. + * + * Copyright (C) 2007, Benedikt Spranger <[EMAIL PROTECTED]> + * Copyright (C) 2008. Sebastian Siewior, Linutronix + * + */ + +#include +#include + +#include +#include +#include +#include + +#define DMA_TIMER_0(0x00) +#define DMA_TIMER_1(0x40) +#define DMA_TIMER_2(0x80) +#define DMA_TIMER_3(0xc0) + +#define DTMR0 (MCF_IPSBAR + DMA_TIMER_0 + 0x400) +#define DTXMR0 (MCF_IPSBAR + DMA_TIMER_0 + 0x402) +#define DTER0 (MCF_IPSBAR + DMA_TIMER_0 + 0x403) +#define DTRR0 (MCF_IPSBAR + DMA_TIMER_0 + 0x404) +#define DTCR0 (MCF_IPSBAR + DMA_TIMER_0 + 0x408) +#define DTCN0 (MCF_IPSBAR + DMA_TIMER_0 + 0x40c) + +#define DMA_FREQ((MCF_CLK / 2) / 16) + +/* DTMR */ +#define DMA_DTMR_RESTART (1 << 3) +#define DMA_DTMR_CLK_DIV_1 (1 << 1) +#define DMA_DTMR_CLK_DIV_16(2 << 1) +#define DMA_DTMR_ENABLE(1 << 0) + +static cycle_t cf_dt_get_cycles(void) +{ + return __raw_readl(DTCN0); +} + +static struct clocksource clocksource_cf_dt = { + .name = "coldfire_dma_timer", + .rating = 200, + .read = cf_dt_get_cycles, + .mask = CLOCKSOURCE_MASK(32), + .shift = 20, + .flags = CLOCK_SOURCE_IS_CONTINUOUS, +}; + +static int __init init_cf_dt_clocksource(void) +{ + /* +* We setup DMA timer 0 in free run mode. This incrementing counter is +* used as a highly precious clock source. With MCF_CLOCK = 150 MHz we +* get a ~213 ns resolution and the 32bit register will overflow almost +* every 15 minutes. +*/ + __raw_writeb(0x00, DTXMR0); + __raw_writeb(0x00, DTER0); + __raw_writel(0x, DTRR0); + __raw_writew(DMA_DTMR_CLK_DIV_16 | DMA_DTMR_ENABLE, DTMR0); + clocksource_cf_dt.mult = clocksource_hz2mult(DMA_FREQ, +clocksource_cf_dt.shift); + return clocksource_register(&clocksource_cf_dt); +} + +arch_initcall(init_cf_dt_clocksource); -- Greg Ungerer -- Chief Software Dude EMAIL: [EMAIL PROTECTED] Secure Computing CorporationPHONE: +61 7 3435 2888 825 Stanley St, FAX: +61 7 3891 3630 Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com ___ uClinux-dev mailing list uClinux-dev@uclinux.org http://mailman.uclinux.org/mailman/listinfo/uclinux-dev This message was resent by uclinux-dev@uclinux.org To unsubscribe see: http://mailman.uclinux.org/mailman/options/uclinux-dev
[uClinux-dev] Re: [PATCH v4] m68knommu: m68knommu: add old stack trace method
Sebastian Siewior wrote: The old method is used when frame pointers are not available. Also fix formating with CONFIG_KALLSYMS=n which eliminates \n. Signed-off-by: Sebastian Siewior <[EMAIL PROTECTED]> OK, I am pretty happy with this one now too. Regards Greg Gavin: thanks again for the hint. Now it should be complete. arch/m68knommu/kernel/traps.c | 38 +++--- 1 files changed, 35 insertions(+), 3 deletions(-) diff --git a/arch/m68knommu/kernel/traps.c b/arch/m68knommu/kernel/traps.c index ec9aea6..46f8f9d 100644 --- a/arch/m68knommu/kernel/traps.c +++ b/arch/m68knommu/kernel/traps.c @@ -103,12 +103,28 @@ asmlinkage void buserr_c(struct frame *fp) force_sig(SIGSEGV, current); } +static void print_this_address(unsigned long addr, int i) +{ +#ifdef CONFIG_KALLSYMS + printk(KERN_EMERG " [%08lx] ", addr); + print_symbol(KERN_CONT "%s\n", addr); +#else + if (i % 5) + printk(KERN_CONT " [%08lx] ", addr); + else + printk(KERN_CONT "\n" KERN_EMERG " [%08lx] ", addr); + i++; +#endif +} + int kstack_depth_to_print = 48; static void __show_stack(struct task_struct *task, unsigned long *stack) { unsigned long *endstack, addr; +#ifdef CONFIG_FRAME_POINTER unsigned long *last_stack; +#endif int i; if (!stack) @@ -126,6 +142,7 @@ static void __show_stack(struct task_struct *task, unsigned long *stack) printk(" %08lx", *(stack + i)); } printk("\n"); + i = 0; #ifdef CONFIG_FRAME_POINTER printk(KERN_EMERG "Call Trace:\n"); @@ -134,15 +151,30 @@ static void __show_stack(struct task_struct *task, unsigned long *stack) while (stack <= endstack && stack > last_stack) { addr = *(stack + 1); - printk(KERN_EMERG " [%08lx] ", addr); - print_symbol(KERN_CONT "%s\n", addr); + print_this_address(addr, i); + i++; last_stack = stack; stack = (unsigned long *)*stack; } printk("\n"); #else - printk(KERN_EMERG "CONFIG_FRAME_POINTER disabled, no symbolic call trace\n"); + printk(KERN_EMERG "Call Trace with CONFIG_FRAME_POINTER disabled:\n"); + while (stack <= endstack) { + addr = *stack++; + /* +* If the address is either in the text segment of the kernel, +* or in a region which is occupied by a module then it *may* +* be the address of a calling routine; if so, print it so that +* someone tracing down the cause of the crash will be able to +* figure out the call path that was taken. +*/ + if (__kernel_text_address(addr)) { + print_this_address(addr, i); + i++; + } + } + printk(KERN_CONT "\n"); #endif } -- Greg Ungerer -- Chief Software Dude EMAIL: [EMAIL PROTECTED] Secure Computing CorporationPHONE: +61 7 3435 2888 825 Stanley St, FAX: +61 7 3891 3630 Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com ___ uClinux-dev mailing list uClinux-dev@uclinux.org http://mailman.uclinux.org/mailman/listinfo/uclinux-dev This message was resent by uclinux-dev@uclinux.org To unsubscribe see: http://mailman.uclinux.org/mailman/options/uclinux-dev
[uClinux-dev] Re: [PATCH v3] m68knommu: add ffs and __ffs plattform which support ISA A+ or ISA C
Sebastian Siewior wrote: the ff1 and bitrev opcode appears in ISA C and ISA A+ what isn't supported by all plattforms. The assembly optimization is automaticly enabled if the compiler understand the required cpu keyword. My m5235 seems to boot and run fine so far. Signed-off-by: Sebastian Siewior <[EMAIL PROTECTED]> Ok, this looks good to me. Regards Greg Thanks Andrea. I didn't know about that define. arch/m68knommu/Makefile|9 + include/asm-m68knommu/bitops.h | 30 ++ 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/arch/m68knommu/Makefile b/arch/m68knommu/Makefile index e0b5f62..4d4a880 100644 --- a/arch/m68knommu/Makefile +++ b/arch/m68knommu/Makefile @@ -90,13 +90,14 @@ export PLATFORM BOARD MODEL CPUCLASS cflags-$(CONFIG_M5206) := -m5200 cflags-$(CONFIG_M5206e):= -m5200 cflags-$(CONFIG_M520x) := -m5307 -cflags-$(CONFIG_M523x) := -m5307 +cflags-$(CONFIG_M523x) := $(call cc-option,-mcpu=523x,-m5307) cflags-$(CONFIG_M5249) := -m5200 -cflags-$(CONFIG_M527x) := -m5307 +cflags-$(CONFIG_M5271) := $(call cc-option,-mcpu=5271,-m5307) cflags-$(CONFIG_M5272) := -m5307 -cflags-$(CONFIG_M528x) := -m5307 +cflags-$(CONFIG_M5275) := $(call cc-option,-mcpu=5275,-m5307) +cflags-$(CONFIG_M528x) := $(call cc-option,-m528x,-m5307) cflags-$(CONFIG_M5307) := -m5307 -cflags-$(CONFIG_M532x) := -m5307 +cflags-$(CONFIG_M532x) := $(call cc-option,-mcpu=532x,-m5307) cflags-$(CONFIG_M5407) := -m5200 cflags-$(CONFIG_M68328):= -m68000 cflags-$(CONFIG_M68EZ328) := -m68000 diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h index c142fbf..6f3685e 100644 --- a/include/asm-m68knommu/bitops.h +++ b/include/asm-m68knommu/bitops.h @@ -14,8 +14,38 @@ #error only can be included directly #endif +#if defined (__mcfisaaplus__) || defined (__mcfisac__) +static inline int ffs(unsigned int val) +{ +if (!val) +return 0; + +asm volatile( +"bitrev %0\n\t" +"ff1 %0\n\t" +: "=d" (val) +: "0" (val) + ); +val++; +return val; +} + +static inline int __ffs(unsigned int val) +{ +asm volatile( +"bitrev %0\n\t" +"ff1 %0\n\t" +: "=d" (val) +: "0" (val) + ); +return val; +} + +#else #include #include +#endif + #include #include -- Greg Ungerer -- Chief Software Dude EMAIL: [EMAIL PROTECTED] Secure Computing CorporationPHONE: +61 7 3435 2888 825 Stanley St, FAX: +61 7 3891 3630 Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com ___ uClinux-dev mailing list uClinux-dev@uclinux.org http://mailman.uclinux.org/mailman/listinfo/uclinux-dev This message was resent by uclinux-dev@uclinux.org To unsubscribe see: http://mailman.uclinux.org/mailman/options/uclinux-dev