From: <aot...@us...> - 2004-05-01 23:15:02
|
Update of /cvsroot/gc-linux/linux/arch/ppc/platforms In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21481/arch/ppc/platforms Modified Files: gamecube.h gamecube_pic.c Log Message: - Properly acknowledge interrupt requests in ->ack(): # cat /proc/interrupts Before: CPU0 1: 29 GC-PIC Edge GameCube Reset Switch 2: 33 GC-PIC Edge GameCube DVD Cover 4: 83412 GC-PIC Edge eth0 6: 0 GC-PIC Edge GameCube audio BAD: 83400 After: CPU0 1: 131 GEKKO-PIC Edge GameCube Reset Switch 2: 74 GEKKO-PIC Edge GameCube DVD Cover 4: 241964 GEKKO-PIC Edge eth0 6: 0 GEKKO-PIC Edge GameCube audio BAD: 0 - Remove test for irq < GAMECUBE_IRQS in ->enable(), ->disable() & ->ack(). - Eliminate GAMECUBE_{IN,OUT}() usage in favour of {set,clear}_bit() and {read,write}{b,w,l}(). - Rename gamecube_pic to gekko_pic. - Rename gamecube_*_irq() callbacks to gekko_*_irq(). - Remove debug printk's. Index: gamecube.h =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/ppc/platforms/gamecube.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- gamecube.h 25 Apr 2004 18:57:28 -0000 1.5 +++ gamecube.h 1 May 2004 23:14:38 -0000 1.6 @@ -1,20 +1,12 @@ /* * arch/ppc/platforms/gamecube.h * - * We steal here - * Macros, definitions, and data structures specific to the IBM PowerPC - * STB03xxx "Redwood" evaluation board. - * - * Author: Armin Kuster <ak...@mv...> - * - * Albert Herranz - * GAMECUBE - * - Added some defines for DI interrupt handling. + * Nintendo GameCube board-specific definitions. * - * 2001 (c) MontaVista, Software, Inc. This file is licensed under - * the terms of the GNU General Public License version 2. This program - * is licensed "as is" without any warranty of any kind, whether express - * or implied. + * 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. */ #ifndef __MACH_GAMECUBE_H @@ -22,12 +14,23 @@ #include <asm/ppcboot.h> +/* + * We have a total of 14 IRQs. Each has a corresponding bit in both + * the Interrupt Cause (PIIC) and Interrupt Mask (PIIM) registers. + */ +#define GAMECUBE_IRQS 14 +#define GAMECUBE_PIIC ((volatile ulong *)0xCC003000) +#define GAMECUBE_PIIM ((volatile ulong *)0xCC003004) -#define GAMECUBE_PIIC 0xcc003000 /* PI interrupt cause */ -#define GAMECUBE_PIIM 0xcc003004 /* PI interrupt mask */ -#define GAMECUBE_RESET 0xcc003024 /* RESET */ -#define GAMECUBE_DICVR 0xcc006004 /* DI Cover Register */ +/* + * Anything written here automagically puts us through reset. + */ +#define GAMECUBE_RESET 0xCC003024 +/* + * Until a driver for gcdvd exists, these may seek refuge here. + */ +#define GAMECUBE_DICVR 0xcc006004 /* DI Cover Register */ #define GC_DI_DISR 0xcc006000 /* DI Status Register */ #define GC_DI_DISR_BRKINT (1<<6) #define GC_DI_DISR_BRKINTMASK (1<<5) @@ -40,6 +43,4 @@ #define GAMECUBE_IN(a) (*(volatile unsigned long *)a) #define GAMECUBE_OUT(a,d) (*(volatile unsigned long *)a = d) -#define GAMECUBE_IRQS 14 - #endif /* !__MACH_GAMECUBE_H */ Index: gamecube_pic.c =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/ppc/platforms/gamecube_pic.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- gamecube_pic.c 1 May 2004 15:22:49 -0000 1.3 +++ gamecube_pic.c 1 May 2004 23:14:38 -0000 1.4 @@ -2,69 +2,48 @@ * arch/ppc/platforms/gamecube_pic.c */ -#undef DEBUG - - #include <linux/irq.h> #include <linux/init.h> -#include <linux/kernel.h> #include <asm/io.h> +#include <asm/bitops.h> #include "gamecube.h" -static void gamecube_mask_and_ack_irq(unsigned int irq) +static void gekko_mask_and_ack_irq(unsigned int irq) { - pr_debug("mask_and_ack(): %x, %x\n", GAMECUBE_IN(GAMECUBE_PIIM), - GAMECUBE_IN(GAMECUBE_PIIC)); - if (irq < GAMECUBE_IRQS) { - GAMECUBE_OUT(GAMECUBE_PIIM, GAMECUBE_IN(GAMECUBE_PIIM) & - ~(1 << irq)); /* mask */ - GAMECUBE_OUT(GAMECUBE_PIIC, 1 << irq); /* ack */ - } - pr_debug("after mask_and_ack(): %x, %x\n", GAMECUBE_IN(GAMECUBE_PIIM), - GAMECUBE_IN(GAMECUBE_PIIC)); + clear_bit(irq, GAMECUBE_PIIM); + set_bit(irq, GAMECUBE_PIIC); } -static void gamecube_mask_irq(unsigned int irq) +static void gekko_mask_irq(unsigned int irq) { - pr_debug("mask(): %x, %x\n", GAMECUBE_IN(GAMECUBE_PIIM), - GAMECUBE_IN(GAMECUBE_PIIC)); - if (irq < GAMECUBE_IRQS) - GAMECUBE_OUT(GAMECUBE_PIIM, GAMECUBE_IN(GAMECUBE_PIIM) & - ~(1 << irq)); /* mask */ + clear_bit(irq, GAMECUBE_PIIM); } -static void -gamecube_unmask_irq(unsigned int irq) +static void gekko_unmask_irq(unsigned int irq) { - pr_debug(" before unmask(): %x, %x\n", GAMECUBE_IN(GAMECUBE_PIIM), - GAMECUBE_IN(GAMECUBE_PIIC)); - if (irq < GAMECUBE_IRQS) - GAMECUBE_OUT(GAMECUBE_PIIM, GAMECUBE_IN(GAMECUBE_PIIM) | - (1 << irq)); - pr_debug("after unmask(): %x, %x\n", GAMECUBE_IN(GAMECUBE_PIIM), - GAMECUBE_IN(GAMECUBE_PIIC)); + set_bit(irq, GAMECUBE_PIIM); } - -static struct hw_interrupt_type gamecube_pic = { - .typename = " GC-PIC ", - .enable = gamecube_unmask_irq, - .disable = gamecube_mask_irq, - .ack = gamecube_mask_and_ack_irq, +static struct hw_interrupt_type gekko_pic = { + .typename = " GEKKO-PIC ", + .enable = gekko_unmask_irq, + .disable = gekko_mask_irq, + .ack = gekko_mask_and_ack_irq, }; void __init gamecube_init_IRQ(void) { int i; - GAMECUBE_OUT(GAMECUBE_PIIM, 0); /* disable all irqs */ - GAMECUBE_OUT(GAMECUBE_PIIC, 0xffffffff); /* ack all irqs */ + /* mask and ack all IRQs */ + writel(0x00000000, GAMECUBE_PIIM); + writel(0xffffffff, GAMECUBE_PIIC); for (i = 0; i < GAMECUBE_IRQS; i++) - irq_desc[i].handler = &gamecube_pic; + irq_desc[i].handler = &gekko_pic; } /* |