Add Mindspeed Comcerto platform support
Subsystems (2)
Add the basic support for Mindspeed Comcerto platform. Now only Mindspeed Multifunction EVM board with Comcerto-1000 cpu is supported.
I split the basic platform patch to three small patches to make review easier.
Stanley.
PATCH 1/3 Add Mindspeed Comcerto platform support
From: Stanley.Miao <[email protected]>
Add Mindspeed Comcerto platform support. Now this patch includes only Multifunction EVM board with Comcerto-1000 CPU.
--- arch/arm/Kconfig | 11 ++ arch/arm/Makefile | 1 + arch/arm/boot/compressed/Makefile | 4 + arch/arm/boot/compressed/head-comcerto.S | 6 + arch/arm/boot/compressed/head.S | 5 + arch/arm/mach-comcerto/Kconfig | 32 +++++ arch/arm/mach-comcerto/Makefile | 10 ++ arch/arm/mach-comcerto/Makefile.boot | 2 + arch/arm/mach-comcerto/board-c1kmfcn_evm.c | 88 ++++++++++++ arch/arm/mach-comcerto/comcerto-1000.c | 146 ++++++++++++++++++++ .../arm/mach-comcerto/include/mach/comcerto-1000.h | 91 ++++++++++++ arch/arm/mach-comcerto/include/mach/debug-macro.S | 46 ++++++ arch/arm/mach-comcerto/include/mach/entry-macro.S | 70 ++++++++++ arch/arm/mach-comcerto/include/mach/hardware.h | 37 +++++ arch/arm/mach-comcerto/include/mach/io.h | 32 +++++ arch/arm/mach-comcerto/include/mach/memory.h | 33 +++++ arch/arm/mach-comcerto/include/mach/system.h | 39 +++++ arch/arm/mach-comcerto/include/mach/timex.h | 28 ++++ arch/arm/mach-comcerto/include/mach/uncompress.h | 58 ++++++++ arch/arm/mach-comcerto/include/mach/vmalloc.h | 21 +++ 20 files changed, 760 insertions(+), 0 deletions(-) create mode 100644 arch/arm/boot/compressed/head-comcerto.S create mode 100644 arch/arm/mach-comcerto/Kconfig create mode 100644 arch/arm/mach-comcerto/Makefile create mode 100644 arch/arm/mach-comcerto/Makefile.boot create mode 100644 arch/arm/mach-comcerto/board-c1kmfcn_evm.c create mode 100644 arch/arm/mach-comcerto/comcerto-1000.c create mode 100644 arch/arm/mach-comcerto/include/mach/comcerto-1000.h create mode 100644 arch/arm/mach-comcerto/include/mach/debug-macro.S create mode 100644 arch/arm/mach-comcerto/include/mach/entry-macro.S create mode 100644 arch/arm/mach-comcerto/include/mach/hardware.h create mode 100644 arch/arm/mach-comcerto/include/mach/io.h create mode 100644 arch/arm/mach-comcerto/include/mach/memory.h create mode 100644 arch/arm/mach-comcerto/include/mach/system.h create mode 100644 arch/arm/mach-comcerto/include/mach/timex.h create mode 100644 arch/arm/mach-comcerto/include/mach/uncompress.h create mode 100644 arch/arm/mach-comcerto/include/mach/vmalloc.h
arch/arm/Kconfig +11 -0
@@ -334,6 +334,15 @@ config ARCH_EP93XX help This enables support for the Cirrus EP93xx series of CPUs. +config ARCH_COMCERTO + bool "Mindspeed Comcerto" + select ZONE_DMA + select CPU_V6 + help + This enables support for Mindspeed's Comcerto development boards. + If you would like to build your kernel to run on one of these boards + then you must say 'Y' here. Otherwise say 'N' + config ARCH_FOOTBRIDGE bool "FootBridge" select CPU_SA110
@@ -841,6 +850,8 @@ source "arch/arm/mach-clps711x/Kconfig" source "arch/arm/mach-cns3xxx/Kconfig" +source "arch/arm/mach-comcerto/Kconfig" + source "arch/arm/mach-davinci/Kconfig" source "arch/arm/mach-dove/Kconfig"
arch/arm/Makefile +1 -0
@@ -141,6 +141,7 @@ machine-$(CONFIG_ARCH_INTEGRATOR) := integrator machine-$(CONFIG_ARCH_IOP13XX) := iop13xx machine-$(CONFIG_ARCH_IOP32X) := iop32x machine-$(CONFIG_ARCH_IOP33X) := iop33x +machine-$(CONFIG_ARCH_COMCERTO) := comcerto machine-$(CONFIG_ARCH_IXP2000) := ixp2000 machine-$(CONFIG_ARCH_IXP23XX) := ixp23xx machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx
arch/arm/boot/compressed/Makefile +4 -0
@@ -33,6 +33,10 @@ ifeq ($(CONFIG_CPU_XSCALE),y) OBJS += head-xscale.o endif +ifeq ($(CONFIG_ARCH_COMCERTO),y) +OBJS += head-comcerto.o +endif + ifeq ($(CONFIG_PXA_SHARPSL_DETECT_MACH_ID),y) OBJS += head-sharpsl.o endif
arch/arm/boot/compressed/head-comcerto.S new file +6 -0
@@ -0,0 +1,6 @@ +#include <asm/mach-types.h> + + .section ".start", "ax" + ldr r7, mach_type + +mach_type: .word MACH_TYPE_COMCERTO
arch/arm/boot/compressed/head.S +5 -0
@@ -66,6 +66,11 @@ wait: mrc p14, 0, pc, c0, c1, 0 add \rb, \rb, #0x00010000 @ Ser1 #endif .endm +#elif defined(CONFIG_ARCH_COMCERTO) + .macro loadsp, rb, tmp + mov \rb, #0x10000000 + orr \rb, \rb, #0x00090000 + .endm #elif defined(CONFIG_ARCH_S3C2410) .macro loadsp, rb, tmp mov \rb, #0x50000000
arch/arm/mach-comcerto/Kconfig new file +32 -0
@@ -0,0 +1,32 @@ +if ARCH_COMCERTO + +menu "Comcerto Implementation Options" + +choice + prompt "Comcerto System Type" + default ARCH_M83XXX + +config ARCH_M83XXX + bool "M83xxx" + select GENERIC_TIME + select GENERIC_CLOCKEVENTS + help + Say Y here if you intend to run this kernel with a Comcerto1000 device. + +endchoice + +choice + prompt "Comcerto Board type" + default EVM_C1KMFCN_EVM + +config EVM_C1KMFCN_EVM + bool "C1KMFCN_EVM" + depends on ARCH_M83XXX + help + Say Y here if you intend to run this kernel with a C1K Multifunction EVM board. + +endchoice + +endmenu + +endif
arch/arm/mach-comcerto/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# +# Makefile for the linux kernel. +# + +# Object file lists. + +obj-y := + +obj-$(CONFIG_ARCH_M83XXX) += comcerto-1000.o +obj-$(CONFIG_EVM_C1KMFCN_EVM) += board-c1kmfcn_evm.o
arch/arm/mach-comcerto/Makefile.boot new file +2 -0
@@ -0,0 +1,2 @@ +zreladdr-y := 0x80808000 +params_phys-y := 0x80800100
arch/arm/mach-comcerto/board-c1kmfcn_evm.c new file +88 -0
88 lines not on this page · raw message
arch/arm/mach-comcerto/comcerto-1000.c new file +146 -0
146 lines not on this page · raw message
arch/arm/mach-comcerto/include/mach/comcerto-1000.h new file +91 -0
91 lines not on this page · raw message
arch/arm/mach-comcerto/include/mach/debug-macro.S new file +46 -0
46 lines not on this page · raw message
arch/arm/mach-comcerto/include/mach/entry-macro.S new file +70 -0
70 lines not on this page · raw message
arch/arm/mach-comcerto/include/mach/hardware.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* arch/arm/mach-comcerto/include/mach/hardware.h +* +* Copyright (C) 2006 Mindspeed Technologies, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef __ASM_ARCH_HARDWARE_H +#define __ASM_ARCH_HARDWARE_H + +/***** Device *****/ +#if defined(CONFIG_ARCH_M83XXX ) +#include <mach/comcerto-1000.h> +#else +#error "mach/hardware.h : Unknown architecture" +#endif + +#ifndef __ASSEMBLY__ +struct sys_timer ; +extern struct sys_timer comcerto_timer; +extern void device_map_io (void ); +#endif + +#endif
arch/arm/mach-comcerto/include/mach/io.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* arch/arm/mach-comcerto/include/mach/io.h +* +* Copyright (C) 2004,2005 Mindspeed Technologies, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifndef __ASM_ARCH_COMCERTO1000_IO_H +#define __ASM_ARCH_COMCERTO1000_IO_H + +#include <asm/io.h> + +#if !defined(CONFIG_PCI ) + +#define __io (a) ((void __iomem *)(a)) +#define __mem_pci (a) (a) + +#endif + +#endif /* __ASM_ARCH_COMCERTO1000_IO_H */
arch/arm/mach-comcerto/include/mach/memory.h new file +33 -0
@@ -0,0 +1,33 @@ +/* +* arch/arm/mach-comcerto/include/mach/memory.h +* +* Copyright (C) 2006 Mindspeed Technologies, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef __ASM_ARCH_MEMORY_H +#define __ASM_ARCH_MEMORY_H + +#include <mach/hardware.h> + +#define PHYS_OFFSET COMCERTO_SDRAM_BASE + +#define __virt_to_bus (x) __virt_to_phys(x) +#define __bus_to_virt (x) __phys_to_virt(x) +#define __pfn_to_bus (x) __pfn_to_phys(x) +#define __bus_to_pfn (x) __phys_to_pfn(x) + +#endif
arch/arm/mach-comcerto/include/mach/system.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* arch/arm/mach-comcerto/include/mach/system.h +* +* Copyright (C) 2004,2005 Mindspeed Technologies, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifndef __ASM_ARCH_SYSTEM_H +#define __ASM_ARCH_SYSTEM_H + +#include <mach/hardware.h> +#include <asm/io.h> + +static inline void arch_idle (void ) +{ +/* +* This should do all the clock switching +* and wait for interrupt tricks +*/ +cpu_do_idle (); +} + +static inline void arch_reset (char mode,const char *cmd) +{ +} + +#endif /* __ASM_ARCH_SYSTEM_H */
arch/arm/mach-comcerto/include/mach/timex.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* linux/include/asm-arm/arch-comcerto/timex.h +* +* Copyright (C) 2006 Mindspeed Technologies, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef __ASM_ARCH_TIMEX_H__ +#define __ASM_ARCH_TIMEX_H__ + +#include <mach/hardware.h> + +#define CLOCK_TICK_RATE (COMCERTO_DEFAULTAHBCLK * 1000 * 1000) + +#endif
arch/arm/mach-comcerto/include/mach/uncompress.h new file +58 -0
58 lines not on this page · raw message
arch/arm/mach-comcerto/include/mach/vmalloc.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* arch/arm/mach-comcerto/include/mach/vmalloc.h +* +* Copyright (C) 2004,2005 Mindspeed Technologies, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#define VMALLOC_END (0xF0000000)
Signature · 1 line
1.5.4.3
PATCH 2/3 Add hardware timer support for Mindspeed Comcerto platflorm
From: Stanley.Miao <[email protected]>
Add hardware timer support for Comcerto platflorm. Timer0 is used by MSP and timer2 is used by fpp, so we choose timer1 for clockevent and timer3 for clocksource.
--- arch/arm/mach-comcerto/Makefile | 2 +- .../arm/mach-comcerto/include/mach/comcerto-1000.h | 3 + .../include/mach/comcerto-1000/timer.h | 62 ++++++ arch/arm/mach-comcerto/include/mach/system.h | 3 + arch/arm/mach-comcerto/time.c | 227 ++++++++++++++++++++ 5 files changed, 296 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-comcerto/include/mach/comcerto-1000/timer.h create mode 100644 arch/arm/mach-comcerto/time.c
arch/arm/mach-comcerto/Makefile +1 -1
@@ -4,7 +4,7 @@ # Object file lists. -obj-y := +obj-y := time.o obj-$(CONFIG_ARCH_M83XXX) += comcerto-1000.o obj-$(CONFIG_EVM_C1KMFCN_EVM) += board-c1kmfcn_evm.o
arch/arm/mach-comcerto/include/mach/comcerto-1000.h +3 -0
@@ -88,4 +88,7 @@#define APB_VADDR_BASE 0xfc000000/* VA of IO on APB bus */ #define APB_VADDR (x) ((x) - COMCERTO_AHB_APB_BASE + APB_VADDR_BASE) + +#include <mach/comcerto-1000/timer.h> +#endif
arch/arm/mach-comcerto/include/mach/comcerto-1000/timer.h new file +62 -0
62 lines not on this page · raw message
arch/arm/mach-comcerto/include/mach/system.h +3 -0
@@ -34,6 +34,9 @@ static inline void arch_idle(void)static inline void arch_reset (char mode,const char *cmd) { +/* use watch dog timer to reset the board */ +__raw_writel (0x1 ,COMCERTO_TIMER_WDT_CONTROL ); +__raw_writel (0x1 ,COMCERTO_TIMER_WDT_HIGH_BOUND ); }#endif /* __ASM_ARCH_SYSTEM_H */
arch/arm/mach-comcerto/time.c new file +227 -0
227 lines not on this page · raw message
Signature · 1 line
1.5.4.3
PATCH 3/3 Add irqs definition and handler for Mindspeed Comcerto platform
From: Stanley.Miao <[email protected]>
the Comcerto interrupt controller supports more than 32 peripheral interrupts, so two interrupt status registers and associated mask registers are required.
--- arch/arm/mach-comcerto/Makefile | 2 +- arch/arm/mach-comcerto/board-c1kmfcn_evm.c | 1 + arch/arm/mach-comcerto/comcerto-1000.c | 41 ++++ .../arm/mach-comcerto/include/mach/comcerto-1000.h | 1 + .../include/mach/comcerto-1000/intr.h | 78 ++++++++ .../include/mach/comcerto-1000/irqs.h | 121 ++++++++++++ arch/arm/mach-comcerto/include/mach/hardware.h | 1 + arch/arm/mach-comcerto/include/mach/irq.h | 155 +++++++++++++++ arch/arm/mach-comcerto/include/mach/irqs.h | 21 ++ arch/arm/mach-comcerto/irq.c | 200 ++++++++++++++++++++ 10 files changed, 620 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-comcerto/include/mach/comcerto-1000/intr.h create mode 100644 arch/arm/mach-comcerto/include/mach/comcerto-1000/irqs.h create mode 100644 arch/arm/mach-comcerto/include/mach/irq.h create mode 100644 arch/arm/mach-comcerto/include/mach/irqs.h create mode 100644 arch/arm/mach-comcerto/irq.c
arch/arm/mach-comcerto/Makefile +1 -1
@@ -4,7 +4,7 @@ # Object file lists. -obj-y := time.o +obj-y := irq.o time.o obj-$(CONFIG_ARCH_M83XXX) += comcerto-1000.o obj-$(CONFIG_EVM_C1KMFCN_EVM) += board-c1kmfcn_evm.o
arch/arm/mach-comcerto/board-c1kmfcn_evm.c +1 -0
@@ -69,6 +69,7 @@ static void __init platform_map_io(void)static void __init platform_irq_init (void ) { +device_irq_init (); }static void __init platform_init (void )
arch/arm/mach-comcerto/comcerto-1000.c +41 -0
50 lines not on this page · raw message
arch/arm/mach-comcerto/include/mach/comcerto-1000.h +1 -0
@@ -90,5 +90,6 @@#define APB_VADDR (x) ((x) - COMCERTO_AHB_APB_BASE + APB_VADDR_BASE)#include <mach/comcerto-1000/timer.h> +#include <mach/comcerto-1000/intr.h> #endif
arch/arm/mach-comcerto/include/mach/comcerto-1000/intr.h new file +78 -0
78 lines not on this page · raw message
arch/arm/mach-comcerto/include/mach/comcerto-1000/irqs.h new file +121 -0
121 lines not on this page · raw message
arch/arm/mach-comcerto/include/mach/hardware.h +1 -0
@@ -32,6 +32,7 @@struct sys_timer ;extern struct sys_timer comcerto_timer;extern void device_map_io (void ); +extern void device_irq_init (void );#endif #endif
arch/arm/mach-comcerto/include/mach/irq.h new file +155 -0
155 lines not on this page · raw message
arch/arm/mach-comcerto/include/mach/irqs.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* arch/arm/mach-comcerto/include/mach/irqs.h +* +* Copyright (C) 2004,2005 Mindspeed Technologies, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +*/ + +#ifndef __ASM_ARCH_IRQS_H +#define __ASM_ARCH_IRQS_H + +#if defined(CONFIG_ARCH_M83XXX ) +#include <mach/comcerto-1000/irqs.h> +#else +#error "Unsupported CPU" +#endif + +#endif /* __ASM_ARCH_IRQS_H */
arch/arm/mach-comcerto/irq.c new file +200 -0
200 lines not on this page · raw message
Signature · 1 line
1.5.4.3
PATCH 2/3 Add hardware timer support for Mindspeed Comcerto platflorm
In reply to stanleymiao at gmail.comarch/arm/mach-comcerto/include/mach/system.h static inline void arch_idle(void) · line 39
Quoted 11 lines · stanleymiao at gmail.com
arch/arm/mach-comcerto/include/mach/system.h +3
-0@@ -34,6 +34,9 @@ static inline void arch_idle(void)static inline void arch_reset (char mode,const char *cmd) { +/* use watch dog timer to reset the board */ +__raw_writel (0x1 ,COMCERTO_TIMER_WDT_CONTROL ); +__raw_writel (0x1 ,COMCERTO_TIMER_WDT_HIGH_BOUND );
Ah, so this is why it has an io.h include in the previous patch.
Quoted 37 lines
arch/arm/mach-comcerto/time.c new file +31
-0@@ -0,0 +1,227 @@ +/* +* linux/arch/arm/mach-comcerto/time.c +* +* Copyright (C) 2008 Mindspeed Technologies, Inc. +* Copyright (c) 2010 Wind River Systems, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/types.h> +#include <linux/interrupt.h> +#include <linux/clocksource.h> +#include <linux/clockchips.h> +#include <linux/io.h> +#include <linux/clk.h> +#include <linux/irq.h> +#include <linux/err.h> +
arch/arm/mach-comcerto/time.c line 41
Quoted 10 lines
arch/arm/mach-comcerto/time.c new file +10
-0+#include <mach/hardware.h> +#include <asm/mach/time.h> + +#define TID_CLOCKEVENT 1 +#define TID_CLOCKSOURCE 3 + +static DEFINE_SPINLOCK (timer_lock); + +struct comcerto_gptimer { +char *name;
const?
Quoted 125 lines
arch/arm/mach-comcerto/time.c new file +125
-0+unsigned long id;/* maybe not needed */ +unsigned long mask; +unsigned long hbound; +unsigned long lbound; +unsigned long count; +}; + +static void gptimer_enable (struct comcerto_gptimer *gptimer) +{ +unsigned long flags; +unsigned long irq_mask; + +spin_lock_irqsave (&timer_lock, flags); + irq_mask =__raw_readl (COMCERTO_TIMER_IRQ_MASK ); + irq_mask |= gptimer->mask; +__raw_writel (irq_mask,COMCERTO_TIMER_IRQ_MASK ); +spin_unlock_irqrestore (&timer_lock, flags); +} + +static void gptimer_disable (struct comcerto_gptimer *gptimer) +{ +unsigned long flags; +unsigned long irq_mask; + +spin_lock_irqsave (&timer_lock, flags); + irq_mask =__raw_readl (COMCERTO_TIMER_IRQ_MASK ); + irq_mask &= ~gptimer->mask; +__raw_writel (irq_mask,COMCERTO_TIMER_IRQ_MASK ); +spin_unlock_irqrestore (&timer_lock, flags); +} + +static struct comcerto_gptimer timers[] = { + [TID_CLOCKEVENT ] = { + .name ="timer1" , + .id =TID_CLOCKEVENT , + .mask =COMCERTO_TIMER1 , + .hbound =COMCERTO_TIMER1_HIGH_BOUND , + .lbound =COMCERTO_TIMER1_LOW_BOUND , + .count =COMCERTO_TIMER1_CURRENT_COUNT , + }, + [TID_CLOCKSOURCE ] = { + .name ="timer3" , + .id =TID_CLOCKSOURCE , + .mask =COMCERTO_TIMER3 , + .hbound =COMCERTO_TIMER3_HIGH_BOUND , + .lbound =COMCERTO_TIMER3_LOW_BOUND , + .count =COMCERTO_TIMER3_CURRENT_COUNT , + }, +}; + +static void gptimer_set_bound (struct comcerto_gptimer *gptimer, +unsigned low,unsigned high) +{ +__raw_writel (high, gptimer->hbound); +/* __raw_writel(low, gptimer->lbound); */ +} + +static void gptimer_clear_status (struct comcerto_gptimer *gptimer) +{ +__raw_writel (gptimer->mask,COMCERTO_TIMER_STATUS_CLR ); +} + +static unsigned long gptimer_get_current_count (struct comcerto_gptimer *timer) +{ +return __raw_readl (timer->count); +} + +static int comcerto_set_next_event (unsigned long cycles, +struct clock_event_device *evt) +{ +struct comcerto_gptimer *t = &timers[TID_CLOCKEVENT ]; + +if (evt->mode ==CLOCK_EVT_MODE_ONESHOT ) +gptimer_enable (t); +return 0 ; +} + +static void comcerto_set_mode (enum clock_event_mode mode, +struct clock_event_device *evt) +{ +struct comcerto_gptimer *t = &timers[TID_CLOCKEVENT ]; + +if (mode !=CLOCK_EVT_MODE_PERIODIC ) +gptimer_disable (t); +else +gptimer_enable (t); +} + +static struct clock_event_device clockevent = { + .name ="clockevent" , + .features =CLOCK_EVT_FEAT_PERIODIC |CLOCK_EVT_FEAT_ONESHOT , + .rating =200 , + .shift =24 , + .set_mode = comcerto_set_mode, + .set_next_event = comcerto_set_next_event, +}; + +static cycle_t comcerto_timer3_read (struct clocksource *cs) +{ +return (cycle_t )gptimer_get_current_count (&timers[TID_CLOCKSOURCE ]); +} + +static struct clocksource clocksource = { + .name ="clocksource" , + .rating =200 , + .read = comcerto_timer3_read, + .mask =CLOCKSOURCE_MASK (32 ), + .shift =24 , + .flags =CLOCK_SOURCE_IS_CONTINUOUS , +}; + +static void __init comcerto_clocksource_init (void ) +{ +struct comcerto_gptimer *t = &timers[TID_CLOCKSOURCE ]; + +gptimer_set_bound (t,0 ,0xffffffff ); + clocksource.mult =clocksource_hz2mult (COMCERTO_DEFAULTAHBCLK , clocksource.shift); +if (clocksource_register (&clocksource)) +printk (KERN_ERR "%s: can't register clocksource!\n" , clocksource.name); +} + +static irqreturn_t comcerto_timer1_interrupt (int irq,void *dev_id) +{ +u32 status; +struct comcerto_gptimer *t = &timers[TID_CLOCKEVENT ];
arch/arm/mach-comcerto/time.c line 176
Quoted 10 lines
arch/arm/mach-comcerto/time.c new file +10
-0+struct clock_event_device *dev = &clockevent; + + status =__raw_readl (COMCERTO_TIMER_STATUS ) &__raw_readl (COMCERTO_TIMER_IRQ_MASK ); + +/* timer1 expired */ +if (status & t->mask) { +/* we need to disable interrupt to simulate ONESHOT mode, +* do it before clearing the interrupt to avoid race */ +if (dev->mode !=CLOCK_EVT_MODE_PERIODIC ) +gptimer_disable (t);
Err, the one-shot mode emulation support looks buggy and completely unnecessary. Generally with clockevents, you tell it what the hardware supports and clockevents deals with it. You shouldn't emulate modes that the hardware doesn't support - especially if you're going to ignore the 'cycles' from set_next_event().
Quoted 59 lines
arch/arm/mach-comcerto/time.c new file +51
-0+ +gptimer_clear_status (t); + dev->event_handler (dev); + +return IRQ_HANDLED ; + } + +return IRQ_NONE ; +} + +static struct irqaction comcerto_timer1_irq = { + .name ="timer1" , + .flags =IRQF_DISABLED |IRQF_TIMER , + .handler = comcerto_timer1_interrupt, +}; + +static void __init comcerto_clockevents_init (void ) +{ +struct comcerto_gptimer *t = &timers[TID_CLOCKEVENT ]; + + clockevent.mult =div_sc (COMCERTO_DEFAULTAHBCLK ,NSEC_PER_SEC , clockevent.shift); + clockevent.max_delta_ns =clockevent_delta2ns (0x3fffffff , &clockevent); + clockevent.min_delta_ns =clockevent_delta2ns (1 , &clockevent); + clockevent.cpumask =cpumask_of (0 ); +clockevents_register_device (&clockevent); + +/* Clear all the timers except timer0 */ +__raw_writel (COMCERTO_TIMER_CSP ,COMCERTO_TIMER_STATUS ); + +/* Register interrupt handler for interrupt on IRQ_TIMERB*/ +setup_irq (IRQ_TIMER1 , &comcerto_timer1_irq); + +/* Set and enable the system timer */ +gptimer_set_bound (t,0 ,COMCERTO_DEFAULTAHBCLK *1000000 /HZ ); +} + +static void __init comcerto_timer_init (void ) +{ +/* +* DO NOT MODIFY THE CONFIGURATION OF TIMER0 +* It is used by the MSP +* For C1000 FPP will be using TIMER2 +*/ + +comcerto_clocksource_init (); +comcerto_clockevents_init (); +} + +struct sys_timer comcerto_timer = { + .init = comcerto_timer_init, +};Signature · 7 lines
1.5.4.3 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 2/3 Add hardware timer support for Mindspeed Comcerto platflorm
Hi, Russell,
Thanks for your review. I will update them and send V2.
Stanley.
2010/10/19 Russell King - ARM Linux <[email protected]>:
Quoted 1 line · stanleymiao at gmail.com
<snip>
Quoted 12 lines
Quoted 5 lines
+ ? ? if (status &
t->mask) {
+ ? ? ? ? ? ? /* we need to disable interrupt to simulate ONESHOT mode,
+ ? ? ? ? ? ? ?* do it before clearing the interrupt to avoid race */
+ ? ? ? ? ? ? if (dev->mode!=CLOCK_EVT_MODE_PERIODIC)
+ ? ? ? ? ? ? ? ? ? ?gptimer_disable(t);Err, the one-shot mode emulation support looks buggy and completely unnecessary. ?Generally with clockevents, you tell it what the hardware supports and clockevents deals with it. ?You shouldn't emulate modes that the hardware doesn't support - especially if you're going to ignore the 'cycles' from
set_next_event().
PATCH 1/3 Add Mindspeed Comcerto platform support
In reply to stanleymiao at gmail.comQuoted 7 lines · stanleymiao at gmail.com
arch/arm/Kconfig +0
-0@@ -334,6 +334,15 @@ config ARCH_EP93XX help This enables support for the Cirrus EP93xx series of CPUs.
arch/arm/Kconfig config ARCH_EP93XX · line 345
Quoted 10 lines
arch/arm/Kconfig +9
-0+config ARCH_COMCERTO + bool "Mindspeed Comcerto" + select ZONE_DMA + select CPU_V6 + help + This enables support for Mindspeed's Comcerto development boards. + If you would like to build your kernel to run on one of these boards + then you must say 'Y' here. Otherwise say 'N' +
#
# The "ARM system type" choice list is ordered alphabetically by option
# text. Please add new entries in the option alphabetic order. #
Erm...
arch/arm/Makefile machine-$(CONFIG_ARCH_INTEGRATOR) := integrator · line 144
Quoted 9 lines
arch/arm/Makefile +1
-0@@ -141,6 +141,7 @@ machine-$(CONFIG_ARCH_INTEGRATOR) := integrator machine-$(CONFIG_ARCH_IOP13XX) := iop13xx machine-$(CONFIG_ARCH_IOP32X) := iop32x machine-$(CONFIG_ARCH_IOP33X) := iop33x +machine-$(CONFIG_ARCH_COMCERTO) := comcerto
# Machine directory name. This list is sorted alphanumerically
# by CONFIG_* macro name.
Erm...
Quoted 8 lines
arch/arm/mach-comcerto/Kconfig new file +2
-0@@ -0,0 +1,32 @@ +if ARCH_COMCERTO +
arch/arm/mach-comcerto/Kconfig line 12
Quoted 10 lines
arch/arm/mach-comcerto/Kconfig new file +10
-0+menu "Comcerto Implementation Options" + +choice + prompt "Comcerto System Type" + default ARCH_M83XXX + +config ARCH_M83XXX + bool "M83xxx" + select GENERIC_TIME + select GENERIC_CLOCKEVENTS
Everyone should be using GENERIC_TIME and GENERIC_CLOCKEVENTS for new code, so please move this to live with ARCH_COMCERTO.
Quoted 17 lines
arch/arm/mach-comcerto/board-c1kmfcn_evm.c new file +11
-0@@ -0,0 +1,88 @@ +/* +* linux/arch/arm/mach-comcerto/board-c1kmfcn_evm.c +* +* Copyright (C) 2004,2008 Mindspeed Technologies, Inc. +* Copyright (c) 2010 Wind River Systems, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*
arch/arm/mach-comcerto/board-c1kmfcn_evm.c line 21
Quoted 10 lines
arch/arm/mach-comcerto/board-c1kmfcn_evm.c new file +10
-0+* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#include <linux/sched.h>
Are there more appropriate includes rather than this one?
arch/arm/mach-comcerto/board-c1kmfcn_evm.c line 27
Quoted 6 lines
arch/arm/mach-comcerto/board-c1kmfcn_evm.c new file +6
-0+#include <linux/device.h> +#include <linux/serial_8250.h> +#include <asm/sizes.h> +#include <asm/setup.h> +#include <asm/mach-types.h> +#include <asm/io.h>
linux/io.h
Quoted 35 lines
arch/arm/mach-comcerto/board-c1kmfcn_evm.c new file +35
-0+#include <asm/mach/arch.h> +#include <mach/hardware.h> + +/* -------------------------------------------------------------------- +* Serial interface +* -------------------------------------------------------------------- */ +static struct plat_serial8250_port comcerto_uart_data[] = { + { + .mapbase =COMCERTO_APB_UART0_BASE , + .membase = (void *)APB_VADDR (COMCERTO_APB_UART0_BASE ), + .irq =IRQ_UART0 , + .flags =UPF_BOOT_AUTOCONF |UPF_SKIP_TEST , + .iotype =UPIO_MEM , + .regshift =2 , + .uartclk =COMCERTO_DEFAULTAHBCLK *1000000 , + }, + { + .flags =0 , + }, +}; + +static struct platform_device comcerto_uart = { + .name ="serial8250" , + .id =PLAT8250_DEV_PLATFORM , + .dev = { + .platform_data = comcerto_uart_data, + }, +}; + +static struct platform_device *comcerto_devices[]__initdata = { + &comcerto_uart, +}; + +/************************************************************************ +* Machine definition
arch/arm/mach-comcerto/board-c1kmfcn_evm.c line 72
Quoted 10 lines
arch/arm/mach-comcerto/board-c1kmfcn_evm.c new file +10
-0+* +************************************************************************/ +static void __init platform_map_io (void ) +{ +device_map_io (); +} + +static void __init platform_irq_init (void ) +{ +}
If there's no IRQs then how do you get timer interrupts?
Quoted 38 lines
arch/arm/mach-comcerto/board-c1kmfcn_evm.c new file +16
-0+ +static void __init platform_init (void ) +{ +platform_add_devices (comcerto_devices,ARRAY_SIZE (comcerto_devices)); +} + +MACHINE_START (COMCERTO ,"Comcerto 1000 (Multifunction EVM)" ) +/* Mindspeed Technologies Inc. */ + .phys_io = COMCERTO_AHB_APB_BASE, + .io_pg_offst = ((COMCERTO_AHB_APB_BASE) >> 18) & 0xfffc, + .boot_params = COMCERTO_SDRAM_BASE + 0x100, + .map_io = platform_map_io, + .init_irq = platform_irq_init, + .init_machine = platform_init, + .timer = &comcerto_timer, +MACHINE_END arch/arm/mach-comcerto/comcerto-1000.c new file +16
-0@@ -0,0 +1,146 @@ +/* +* linux/arch/arm/mach-comcerto/comcerto-1000.c +* +* Copyright (C) 2004,2008 Mindspeed Technologies, Inc. +* Copyright (c) 2010 Wind River Systems, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*
arch/arm/mach-comcerto/comcerto-1000.c line 26
Quoted 10 lines
arch/arm/mach-comcerto/comcerto-1000.c new file +10
-0+* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#include <linux/sched.h> +#include <linux/mm.h> +#include <linux/init.h> +#include <asm/setup.h> +#include <asm/mach-types.h> +#include <asm/io.h>
linux/io.h
arch/arm/mach-comcerto/comcerto-1000.c line 30
Quoted 4 lines
arch/arm/mach-comcerto/comcerto-1000.c new file +4
-0+#include <asm/sizes.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <mach/hardware.h>
Most of the above looks like it was cut'n'pasted from the previous file. Do you really need all these includes?
Quoted 19 lines
arch/arm/mach-comcerto/include/mach/io.h new file +13
-0@@ -0,0 +1,32 @@ +/* +* arch/arm/mach-comcerto/include/mach/io.h +* +* Copyright (C) 2004,2005 Mindspeed Technologies, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
arch/arm/mach-comcerto/include/mach/io.h line 23
Quoted 10 lines
arch/arm/mach-comcerto/include/mach/io.h new file +10
-0+* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifndef __ASM_ARCH_COMCERTO1000_IO_H +#define __ASM_ARCH_COMCERTO1000_IO_H + +#include <asm/io.h>
Err no. This is a recipe for disaster. linux/io.h includes asm/io.h which includes mach/io.h. If you want io definitions, include linux/io.h. Do not include asm/io.h or mach/io.h directly.
arch/arm/mach-comcerto/include/mach/io.h line 27
Quoted 4 lines
arch/arm/mach-comcerto/include/mach/io.h new file +4
-0+ +#if !defined(CONFIG_PCI ) + +#define __io (a) ((void __iomem *)(a))
__typesafe_io() ?
Quoted 64 lines
arch/arm/mach-comcerto/include/mach/io.h new file +5
-0+#define __mem_pci (a) (a) + +#endif + +#endif /* __ASM_ARCH_COMCERTO1000_IO_H */ arch/arm/mach-comcerto/include/mach/memory.h new file +33
-0@@ -0,0 +1,33 @@ +/* +* arch/arm/mach-comcerto/include/mach/memory.h +* +* Copyright (C) 2006 Mindspeed Technologies, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef __ASM_ARCH_MEMORY_H +#define __ASM_ARCH_MEMORY_H + +#include <mach/hardware.h> + +#define PHYS_OFFSET COMCERTO_SDRAM_BASE + +#define __virt_to_bus (x) __virt_to_phys(x) +#define __bus_to_virt (x) __phys_to_virt(x) +#define __pfn_to_bus (x) __pfn_to_phys(x) +#define __bus_to_pfn (x) __phys_to_pfn(x) + +#endif arch/arm/mach-comcerto/include/mach/system.h new file +14
-0@@ -0,0 +1,39 @@ +/* +* arch/arm/mach-comcerto/include/mach/system.h +* +* Copyright (C) 2004,2005 Mindspeed Technologies, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details.
arch/arm/mach-comcerto/include/mach/system.h line 24
Quoted 10 lines
arch/arm/mach-comcerto/include/mach/system.h new file +10
-0+* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifndef __ASM_ARCH_SYSTEM_H +#define __ASM_ARCH_SYSTEM_H + +#include <mach/hardware.h> +#include <asm/io.h>
Nothing in this file needs asm/io.h, nor I suspect mach/hardware.h either.
Quoted 96 lines
arch/arm/mach-comcerto/include/mach/system.h new file +15
-0+ +static inline void arch_idle (void ) +{ +/* +* This should do all the clock switching +* and wait for interrupt tricks +*/ +cpu_do_idle (); +} + +static inline void arch_reset (char mode,const char *cmd) +{ +} + +#endif /* __ASM_ARCH_SYSTEM_H */ arch/arm/mach-comcerto/include/mach/uncompress.h new file +58
-0@@ -0,0 +1,58 @@ +/* +* arch/arm/mach-comcerto/include/mach/uncompress.h +* +* Copyright (C) 2004,2008 Mindspeed Technologies, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifndef __ASM_ARCH_UNCOMPRESS_H +#define __ASM_ARCH_UNCOMPRESS_H + +#define UART_DR (*(volatile unsigned long *)0x10090000) +#define UART_LSR (*(volatile unsigned long *)0x10090014) + +static inline void putc (int c) +{ +while (!(UART_LSR &0x20 )) +barrier (); + +UART_DR = c; +} + +static void flush (void ) +{ +} +static inline void puts (const char *ptr) +{ +char c; + +while ((c = *ptr++) !='\0' ) { +if (c =='\n' ) +putc ('\r' ); +putc (c); + } + +flush (); + +} + +/* +* nothing to do +*/ +#define arch_decomp_setup () + +#define arch_decomp_wdog () + +#endif /* __ASM_ARCH_UNCOMPRESS_H */ arch/arm/mach-comcerto/include/mach/vmalloc.h new file +11
-0@@ -0,0 +1,21 @@ +/* +* arch/arm/mach-comcerto/include/mach/vmalloc.h +* +* Copyright (C) 2004,2005 Mindspeed Technologies, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful,
arch/arm/mach-comcerto/include/mach/vmalloc.h line 21
Quoted 10 lines
arch/arm/mach-comcerto/include/mach/vmalloc.h new file +10
-0+* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#define VMALLOC_END (0xF0000000)
Should be typed to be unsigned long.
Hi, Russell,
Any comments ? I have added these three patches to your patch tracking system.
Thanks.
Stanley
2010/10/14 <[email protected]>:
Quoted 12 lines
Add the basic support for Mindspeed Comcerto platform. Now only Mindspeed Multifunction EVM board with Comcerto-1000 cpu is supported.
I split the basic platform patch to three small patches to make review easier.
Stanley.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 3 lines · Stanley.Miao
Hi, Russell,
Any comments ? I have added these three patches to your patch tracking system.
Now that the debug-macro changes are in, my tree is now closed for the upcoming merge window.
2010/10/18 Russell King - ARM Linux <[email protected]>:
Quoted 8 lines · Stanley.Miao
Quoted 3 lines
Hi, Russell,
Any comments ? I have added these three patches to your patch tracking system.
Now that the debug-macro changes are in, my tree is now closed for the upcoming merge window.
OK. I will re-send these patches based on linux-next.
Thanks.
Stanley.