From patchwork Thu Apr 30 22:07:57 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Christophe PLAGNIOL-VILLARD X-Patchwork-Id: 71661 X-Patchwork-Delegate: promsoft@gmail.com Return-Path: X-Original-To: wd@gemini.denx.de Delivered-To: wd@gemini.denx.de Received: from diddl.denx.de (diddl.denx.de [10.0.0.6]) by gemini.denx.de (Postfix) with ESMTP id 6057C83420E8 for ; Fri, 1 May 2009 00:14:33 +0200 (CEST) Received: from diddl.denx.de (localhost.localdomain [127.0.0.1]) by diddl.denx.de (Postfix) with ESMTP id 526C9C912BCD for ; Fri, 1 May 2009 00:14:33 +0200 (CEST) Received: from pop.mnet-online.de by diddl.denx.de with POP3 (fetchmail-6.3.8) for (single-drop); Fri, 01 May 2009 00:14:33 +0200 (CEST) Received: from murder (svr19.m-online.net [192.168.3.147]) by backend2 (Cyrus v2.2.12) with LMTPA; Fri, 01 May 2009 00:12:17 +0200 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend3.pop.m-online.net (Cyrus v2.2.13) with LMTPA; Fri, 01 May 2009 00:12:16 +0200 Received: from scanner-4.m-online.net (scanner-4.m-online.net [192.168.1.18]) by mail.m-online.net (Postfix) with ESMTP id B943F2003AC; Fri, 1 May 2009 00:12:16 +0200 (CEST) Received: from mxin-3.m-online.net ([192.168.1.19]) by scanner-4.m-online.net (scanner-4.m-online.net [192.168.1.18]) (amavisd-new, port 10026) with ESMTP id 02635-08; Fri, 1 May 2009 00:19:26 +0200 (CEST) Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by mxin-3.m-online.net (Postfix) with ESMTP id 1FBE746C0B6; Fri, 1 May 2009 00:19:26 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C8A7C282B3; Fri, 1 May 2009 00:11:30 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21bk+Eth92QC; Fri, 1 May 2009 00:11:30 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DDF072845A; Fri, 1 May 2009 00:11:00 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8D4BA283CB for ; Fri, 1 May 2009 00:10:54 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FR53wxvv7Ohd for ; Fri, 1 May 2009 00:10:51 +0200 (CEST) Received: from 30.mail-out.ovh.net (30.mail-out.ovh.net [213.186.62.213]) by theia.denx.de (Postfix) with SMTP id F2E68283EE for ; Fri, 1 May 2009 00:10:45 +0200 (CEST) Received: (qmail 5256 invoked by uid 503); 30 Apr 2009 22:10:56 -0000 Received: from b7.ovh.net (HELO mail153.ha.ovh.net) (213.186.33.57) by 30.mail-out.ovh.net with SMTP; 30 Apr 2009 22:10:56 -0000 Received: from b0.ovh.net (HELO queue-out) (213.186.33.50) by b0.ovh.net with SMTP; 30 Apr 2009 22:10:51 -0000 Received: from ns32433.ovh.net (HELO localhost) (plagnioj%jcrosoft.com@213.251.161.87) by ns0.ovh.net with SMTP; 30 Apr 2009 22:10:47 -0000 From: Jean-Christophe PLAGNIOL-VILLARD To: u-boot@lists.denx.de Date: Fri, 1 May 2009 00:07:57 +0200 Message-Id: <1241129278-20661-3-git-send-email-plagnioj@jcrosoft.com> X-Mailer: git-send-email 1.6.2.1 In-Reply-To: <1241129278-20661-2-git-send-email-plagnioj@jcrosoft.com> References: <1241129278-20661-1-git-send-email-plagnioj@jcrosoft.com> <1241129278-20661-2-git-send-email-plagnioj@jcrosoft.com> X-Ovh-Tracer-Id: 2442921323890715418 X-Ovh-Remote: 213.251.161.87 (ns32433.ovh.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|H 0.5/N Subject: [U-Boot] [PATCH 3/4] s3c4510b: move interrupts code to soc X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de X-Virus-Scanned: by amavisd-new at m-online.net Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- cpu/arm720t/Makefile | 4 +- cpu/arm720t/s3c4510b/Makefile | 1 + cpu/arm720t/s3c4510b/interrupts.c | 85 +++++++++++++++++++++++++++++++++ cpu/arm720t/{interrupts.c => timer.c} | 74 ++++------------------------- 4 files changed, 98 insertions(+), 66 deletions(-) create mode 100644 cpu/arm720t/s3c4510b/interrupts.c rename cpu/arm720t/{interrupts.c => timer.c} (78%) diff --git a/cpu/arm720t/Makefile b/cpu/arm720t/Makefile index d5ac7d3..3e9b45a 100644 --- a/cpu/arm720t/Makefile +++ b/cpu/arm720t/Makefile @@ -26,7 +26,9 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(CPU).a START = start.o -COBJS = interrupts.o cpu.o + +COBJS += cpu.o +COBJS += timer.o SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) diff --git a/cpu/arm720t/s3c4510b/Makefile b/cpu/arm720t/s3c4510b/Makefile index c099036..91e27fd 100644 --- a/cpu/arm720t/s3c4510b/Makefile +++ b/cpu/arm720t/s3c4510b/Makefile @@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).a COBJS-y += cache.o +COBJS-y += interrupts.o SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y)) diff --git a/cpu/arm720t/s3c4510b/interrupts.c b/cpu/arm720t/s3c4510b/interrupts.c new file mode 100644 index 0000000..f543569 --- /dev/null +++ b/cpu/arm720t/s3c4510b/interrupts.c @@ -0,0 +1,85 @@ +/* + * (C) Copyright 2002 + * Sysgo Real-Time Solutions, GmbH + * Marius Groeger + * + * (C) Copyright 2002 + * Sysgo Real-Time Solutions, GmbH + * Alex Zuepke + * + * See file CREDITS for list of people who contributed to this + * project. + * + * 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 + */ + +#include +#include +#include +#include + +# ifndef CONFIG_USE_IRQ +# error CONFIG_USE_IRQ _must_ be defined when using CONFIG_S3C4510B +# endif + +static struct _irq_handler IRQ_HANDLER[N_IRQS]; + +void do_irq (struct pt_regs *pt_regs) +{ + unsigned int pending; + + while ( (pending = GET_REG( REG_INTOFFSET)) != 0x54) { /* sentinal value for no pending interrutps */ + IRQ_HANDLER[pending>>2].m_func( IRQ_HANDLER[pending>>2].m_data); + + /* clear pending interrupt */ + PUT_REG( REG_INTPEND, (1<<(pending>>2))); + } +} + +static void default_isr( void *data) { + printf ("default_isr(): called for IRQ %d\n", (int)data); +} + +void irq_install_handler (int irq, interrupt_handler_t handle_irq, void *data) +{ + if (irq >= N_IRQS || !handle_irq) + return; + + IRQ_HANDLER[irq].m_data = data; + IRQ_HANDLER[irq].m_func = handle_irq; +} + +int arch_interrupt_init (void) +{ + int i; + + /* install default interrupt handlers */ + for (i = 0; i < N_IRQS; i++) + irq_install_handler(i, default_isr, (void *)i); + + /* configure interrupts for IRQ mode */ + PUT_REG( REG_INTMODE, 0x0); + /* clear any pending interrupts */ + PUT_REG( REG_INTPEND, 0x1FFFFF); + + /* + * Enable global interrupt + * Enable timer0 interrupt + */ + CLR_REG( REG_INTMASK, ((1<>2].m_func( IRQ_HANDLER[pending>>2].m_data); - - /* clear pending interrupt */ - PUT_REG( REG_INTPEND, (1<<(pending>>2))); - } -#elif defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR) - /* No do_irq() for IntegratorAP/CM720T as yet */ -#elif defined(CONFIG_LPC2292) - void (*pfnct)(void); pfnct = (void (*)(void))VICVectAddr; (*pfnct)(); -#else -#error do_irq() not defined for this CPU type -#endif } #endif -#ifdef CONFIG_S3C4510B -static void default_isr( void *data) { - printf ("default_isr(): called for IRQ %d\n", (int)data); -} +#if defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR) + /* Use IntegratorAP routines in board/integratorap.c */ +#else +#if defined(CONFIG_S3C4510B) static void timer_isr( void *data) { unsigned int *pTime = (unsigned int *)data; @@ -103,39 +78,9 @@ static void timer_isr( void *data) { } #endif -#if defined(CONFIG_INTEGRATOR) && defined(CONFIG_ARCH_INTEGRATOR) - /* Use IntegratorAP routines in board/integratorap.c */ -#else - static ulong timestamp; static ulong lastdec; -#if defined(CONFIG_USE_IRQ) && defined(CONFIG_S3C4510B) -int arch_interrupt_init (void) -{ - int i; - - /* install default interrupt handlers */ - for ( i = 0; i < N_IRQS; i++) { - IRQ_HANDLER[i].m_data = (void *)i; - IRQ_HANDLER[i].m_func = default_isr; - } - - /* configure interrupts for IRQ mode */ - PUT_REG( REG_INTMODE, 0x0); - /* clear any pending interrupts */ - PUT_REG( REG_INTPEND, 0x1FFFFF); - - lastdec = 0; - - /* install interrupt handler for timer */ - IRQ_HANDLER[INT_TIMER0].m_data = (void *)×tamp; - IRQ_HANDLER[INT_TIMER0].m_func = timer_isr; - - return 0; -} -#endif - int timer_init (void) { #if defined(CONFIG_NETARM) @@ -176,11 +121,10 @@ int timer_init (void) */ PUT_REG( REG_TDATA0, (CONFIG_SYS_SYS_CLK_FREQ / CONFIG_SYS_HZ)); - /* - * Enable global interrupt - * Enable timer0 interrupt - */ - CLR_REG( REG_INTMASK, ((1<