From: Jun S. <ju...@us...> - 2001-09-17 17:02:32
|
Update of /cvsroot/linux-mips/linux/arch/mips/korva In directory usw-pr-cvs1:/tmp/cvs-serv20578/arch/mips/korva Modified Files: setup.c irq_korva.c Makefile Added Files: candy_setup.c Log Message: Update Korva either driver (candy). Add some workaround. --- NEW FILE: candy_setup.c --- /* * Copyright 2001 MontaVista Software Inc. * Author: js...@mv... or js...@ju... * * arch/mips/korva/candy_setup.c * NEC Candy ether driver setup routine. * * 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. * */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #define MAX_NUM_DEVS 2 static struct { uint irq; ulong base_addr; ulong pmd_addr; u_char mac_addr[6]; } candy_boot_params[MAX_NUM_DEVS] = { {4, 0xb0002000, 0x14, {0x00, 0x00, 0x4c, 0x80, 0x92, 0xa1}}, {5, 0xb0003000, 0x16, {0x00, 0x00, 0x4c, 0x80, 0x92, 0xa2}} }; int nec_candy_get_boot_params(uint * irq, ulong * base_addr, ulong * pmd_addr, u_char * mac_addr) { static int index=0; int i; if (index == MAX_NUM_DEVS) return -1; *irq = candy_boot_params[index].irq; *base_addr = candy_boot_params[index].base_addr; *pmd_addr = candy_boot_params[index].pmd_addr; for (i=0; i< 6; i++) mac_addr[i] = candy_boot_params[index].mac_addr[i]; index ++; return 0; } EXPORT_SYMBLE(nec_candy_get_boot_params); /* * kernel boot parameters * format: "nec_candy_mac=xx,xx,xx,xx,xx,xx [nec_candy_mac=xx,xx,xx,xx,xx,xx]" */ static int __init nec_candy_boot_setup(char *str) { int ints[10]; int i; static int index=0; str = get_options(str, ARRAY_SIZE(ints), ints); if (ints[0] != 6) return 0; if (index == MAX_NUM_DEVS) return 1; /* ignore params */ for (i=0; i< 6; i++) candy_boot_params[index].mac_addr[i] = (u_char)ints[i+1]; index++; return 1; } __setup("nec_candy_mac=", nec_candy_boot_setup); Index: setup.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/korva/setup.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** setup.c 2001/08/23 19:13:56 1.1 --- setup.c 2001/09/17 17:02:29 1.2 *************** *** 29,33 **** #include <asm/ddb5xxx/debug.h> ! // #define USE_CPU_TIMER 1 /* are we using cpu counter as timer */ extern void nec_korva_restart(char* c); --- 29,33 ---- #include <asm/ddb5xxx/debug.h> ! #define USE_CPU_TIMER 1 /* are we using cpu counter as timer */ extern void nec_korva_restart(char* c); *************** *** 85,100 **** #endif - #if defined(CONFIG_NEC_CANDY) - /* need to come up with a better way. FIXME */ - static u_char ETHER_MAC_ADDR[][6] = { - {0x00, 0x00, 0x4c, 0x80, 0x92, 0xa1}, - {0x00, 0x00, 0x4c, 0x80, 0x92, 0xa2} - }; - - extern int - nec_candy_setup_boot_param(uint irq, ulong base_addr, ulong pmd_addr, u_char *mac_addr); - - #endif - void __init nec_korva_setup(void) { --- 85,88 ---- *************** *** 115,124 **** init_serial_ports(); - - #if defined(CONFIG_NEC_CANDY) - /* setup ether driver */ - nec_candy_setup_boot_param(4, 0xb0002000, 0x14, ETHER_MAC_ADDR[0]); - nec_candy_setup_boot_param(5, 0xb0003000, 0x16, ETHER_MAC_ADDR[1]); - #endif /* ---------------- board hardware setup ---------------- */ --- 103,106 ---- Index: irq_korva.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/korva/irq_korva.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** irq_korva.c 2001/08/23 19:13:56 1.1 --- irq_korva.c 2001/09/17 17:02:29 1.2 *************** *** 23,26 **** --- 23,28 ---- #include <asm/mipsregs.h> + #define KORVA_IRQ_WORKAROUND 1 + /* [jsun] sooner or later we should move this debug stuff to MIPS common */ #include <asm/ddb5xxx/debug.h> *************** *** 37,42 **** --- 39,49 ---- MIPS_ASSERT(irq < korva_irq_base+NUM_KORVA_IRQS); + #if defined(KORVA_IRQ_WORKAROUND) + clear_cp0_cause( 1 << (6 + 8)); + set_cp0_status(1 << (6 + 8)); + #else irq -= korva_irq_base; korva_out32(KORVA_S_IMR, korva_in32(KORVA_S_IMR) | (1 << irq) ); + #endif } *************** *** 49,54 **** --- 56,65 ---- MIPS_ASSERT(irq < korva_irq_base+NUM_KORVA_IRQS); + #if defined(KORVA_IRQ_WORKAROUND) + clear_cp0_status(1 << (6 + 8)); + #else irq -= korva_irq_base; korva_out32(KORVA_S_IMR, korva_in32(KORVA_S_IMR) & ~(1 << irq) ); + #endif } *************** *** 92,94 **** --- 103,109 ---- korva_irq_base = irq_base; + + #if defined(KORVA_IRQ_WORKAROUND) + korva_out32(KORVA_S_IMR, 0xff); + #endif } Index: Makefile =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/korva/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 2001/08/23 19:13:56 1.1 --- Makefile 2001/09/17 17:02:29 1.2 *************** *** 14,18 **** O_TARGET:= korva.a ! obj-y := setup.o prom.o reset.o int_handler.o irq.o irq_cpu.o irq_korva.o obj-$(CONFIG_BLK_DEV_INITRD) += ramdisk.o --- 14,19 ---- O_TARGET:= korva.a ! obj-y := setup.o prom.o reset.o int_handler.o irq.o irq_cpu.o irq_korva.o \ ! candy_setup.o obj-$(CONFIG_BLK_DEV_INITRD) += ramdisk.o |