From: Paul M. <le...@us...> - 2002-03-07 03:16:57
|
Update of /cvsroot/linux-mips/linux/arch/mips/vr41xx/vr4122/eagle In directory usw-pr-cvs1:/tmp/cvs-serv28915/arch/mips/vr41xx/vr4122/eagle Added Files: Makefile ide-eagle.c init.c irq.c pci_fixup.c setup.c Log Message: Imported Yoichi-san's Vr41xx patch, with some minor modifications. --- NEW FILE: Makefile --- # # Makefile for the NEC Eagle specific parts of the kernel # # Author: Yoichi Yuasa # yy...@mv... or so...@mv... # # Copyright 2001,2002 MontaVista Software Inc. # # Note! Dependencies are done automagically by 'make dep', which also # removes any old dependencies. DON'T put your own dependencies here # unless it's something special (ie not a .c file). # .S.s: $(CPP) $(AFLAGS) $< -o $@ .S.o: $(CC) $(AFLAGS) -c $< -o $@ O_TARGET := eagle.o all: eagle.o obj-y := init.o irq.o setup.o obj-$(CONFIG_IDE) += ide-eagle.o obj-$(CONFIG_PCI) += pci_fixup.o include $(TOPDIR)/Rules.make --- NEW FILE: ide-eagle.c --- /* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * IDE routines for typical pc-like standard configurations for the NEC Eagle board. * * Copyright (C) 1998, 1999, 2001 by Ralf Baechle */ /* * Changes: * MontaVista Software Inc. <yy...@mv...> or <so...@mv...> * Fri, 1 Mar 2002 * - Added NEC Eagle support. */ #include <linux/sched.h> #include <linux/ide.h> #include <linux/ioport.h> #include <linux/hdreg.h> #include <asm/ptrace.h> #include <asm/hdreg.h> static int eagle_ide_default_irq(ide_ioreg_t base) { return 0; } static ide_ioreg_t eagle_ide_default_io_base(int index) { return 0; } static void eagle_ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq) { ide_ioreg_t reg = data_port; int i; for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { hw->io_ports[i] = reg; reg += 1; } if (ctrl_port) { hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; } else { hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206; } if (irq != NULL) *irq = 0; hw->io_ports[IDE_IRQ_OFFSET] = 0; } static int eagle_ide_request_irq(unsigned int irq, void (*handler)(int,void *, struct pt_regs *), unsigned long flags, const char *device, void *dev_id) { return request_irq(irq, handler, SA_SHIRQ, device, dev_id); } static void eagle_ide_free_irq(unsigned int irq, void *dev_id) { free_irq(irq, dev_id); } static int eagle_ide_check_region(ide_ioreg_t from, unsigned int extent) { return check_region(from, extent); } static void eagle_ide_request_region(ide_ioreg_t from, unsigned int extent, const char *name) { request_region(from, extent, name); } static void eagle_ide_release_region(ide_ioreg_t from, unsigned int extent) { release_region(from, extent); } struct ide_ops eagle_ide_ops = { &eagle_ide_default_irq, &eagle_ide_default_io_base, &eagle_ide_init_hwif_ports, &eagle_ide_request_irq, &eagle_ide_free_irq, &eagle_ide_check_region, &eagle_ide_request_region, &eagle_ide_release_region }; --- NEW FILE: init.c --- /* * FILE NAME * arch/mips/vr41xx/eagle/init.c * * BRIEF MODULE DESCRIPTION * Initialisation code for the NEC Eagle board. * * Author: Yoichi Yuasa * yy...@mv... or so...@mv... * * Copyright 2001,2002 MontaVista Software 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * 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., * 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * Changes: * MontaVista Software Inc. <yy...@mv...> or <so...@mv...> * - New creation, NEC Eagle is supported. */ #include <linux/config.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/string.h> #include <asm/bootinfo.h> char arcs_cmdline[CL_SIZE]; const char *get_system_type(void) { return "NEC Eagle"; } void __init bus_error_init(void) { } void __init prom_init(int argc, char **argv, unsigned long magic, int *prom_vec) { int mem_size = CONFIG_NEC_EAGLE_MEM_SIZE; int i; /* * collect args and prepare cmd_line */ for (i = 1; i < argc; i++) { strcat(arcs_cmdline, argv[i]); if (i < (argc - 1)) strcat(arcs_cmdline, " "); } #if defined(CONFIG_SERIAL_CONSOLE) /* to use 38400 ttyS0 serial console */ strcat(arcs_cmdline, " console=ttyS0,38400"); #endif mips_machgroup = MACH_GROUP_NEC_VR41XX; mips_machtype = MACH_NEC_EAGLE; /* Add memory region */ switch (mem_size) { case 32: add_memory_region(0, 32 << 20, BOOT_MEM_RAM); break; case 64: add_memory_region(0, 64 << 20, BOOT_MEM_RAM); break; case 128: add_memory_region(0, 128 << 20, BOOT_MEM_RAM); break; default: panic("Memory size error"); } } void __init prom_free_prom_memory (void) { } --- NEW FILE: irq.c --- /* * FILE NAME * arch/mips/vr41xx/eagle/irq.c * * BRIEF MODULE DESCRIPTION * Interrupt routines for the NEC Eagle board. * * Author: Yoichi Yuasa * yy...@mv... or so...@mv... * * Copyright 2002 MontaVista Software 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * 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., * 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * Changes: * MontaVista Software Inc. <yy...@mv...> or <so...@mv...> * - New creation, NEC Eagle is supported. */ #include <linux/init.h> #include <linux/interrupt.h> #include <asm/io.h> #include <asm/vr41xx/eagle.h> static void enable_pciint_irq(unsigned int irq) { u8 val; val = readb(NEC_EAGLE_PCIINTMSKREG); val |= (u8)1 << (irq - PCIINT_IRQ_BASE); writeb(val, NEC_EAGLE_PCIINTMSKREG); } static void disable_pciint_irq(unsigned int irq) { u8 val; val = readb(NEC_EAGLE_PCIINTMSKREG); val &= ~((u8)1 << (irq - PCIINT_IRQ_BASE)); writeb(val, NEC_EAGLE_PCIINTMSKREG); } static unsigned int startup_pciint_irq(unsigned int irq) { enable_pciint_irq(irq); return 0; /* never anything pending */ } #define shutdown_pciint_irq disable_pciint_irq #define ack_pciint_irq disable_pciint_irq static void end_pciint_irq(unsigned int irq) { if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) enable_pciint_irq(irq); } static struct hw_interrupt_type pciint_irq_type = { "PCIINT", startup_pciint_irq, shutdown_pciint_irq, enable_pciint_irq, disable_pciint_irq, ack_pciint_irq, end_pciint_irq, NULL }; static int pciint_get_irq_number(int irq) { u8 val; int i; val = readb(NEC_EAGLE_PCIINTREG); val &= (NEC_EAGLE_PCIINT_CP_INTA | NEC_EAGLE_PCIINT_CP_INTB | NEC_EAGLE_PCIINT_CP_INTC | NEC_EAGLE_PCIINT_CP_INTD | NEC_EAGLE_PCIINT_LANINT); for (i = 0; i < 5; i++) if (val & (0x01 << i)) return PCIINT_IRQ_BASE + i; return -1; } void __init vr41xx_board_irq_init(void) { int i; writeb(0, NEC_EAGLE_PCIINTMSKREG); for (i = PCIINT_IRQ_BASE; i <= PCIINT_IRQ_LAST; i++) irq_desc[i].handler = &pciint_irq_type; vr41xx_cascade_irq(PCIINT_IRQ, pciint_get_irq_number); } --- NEW FILE: pci_fixup.c --- /* * FILE NAME * arch/mips/vr41xx/eagle/pci_fixup.c * * BRIEF MODULE DESCRIPTION * The NEC Eagle Board specific PCI fixups. * * Author: Yoichi Yuasa * yy...@mv... or so...@mv... * * Copyright 2001,2002 MontaVista Software 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * 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., * 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * Changes: * MontaVista Software Inc. <yy...@mv...> or <so...@mv...> * - New creation, NEC Eagle is supported. */ #include <linux/config.h> #ifdef CONFIG_PCI #include <linux/init.h> #include <linux/pci.h> #include <asm/pci_channel.h> #include <asm/vr41xx/eagle.h> #ifdef CONFIG_VRC4173 #include <asm/vr41xx/vrc4173.h> #endif static struct resource vr41xx_pci_io_resource = { "PCI I/O space", VR41XX_PCI_IO_START, VR41XX_PCI_IO_END, IORESOURCE_IO }; static struct resource vr41xx_pci_mem_resource = { "PCI memory space", VR41XX_PCI_MEM_START, VR41XX_PCI_MEM_END, IORESOURCE_MEM }; extern struct pci_ops vr41xx_pci_ops; struct pci_channel mips_pci_channels[] = { {&vr41xx_pci_ops, &vr41xx_pci_io_resource, &vr41xx_pci_mem_resource, 0, 256}, {NULL, NULL, NULL, 0, 0} }; void __init pcibios_fixup_resources(struct pci_dev *dev) { } void __init pcibios_fixup(void) { } void __init pcibios_fixup_irqs(void) { struct pci_dev *dev; u8 slot, func, pin; pci_for_each_dev(dev) { slot = PCI_SLOT(dev->devfn); func = PCI_FUNC(dev->devfn); dev->irq = 0; switch (slot) { case 11: case 12: case 13: case 14: case 15: pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); switch (pin) { case 1: dev->irq = CP_INTA_IRQ; break; case 2: break; dev->irq = CP_INTB_IRQ; case 3: break; dev->irq = CP_INTC_IRQ; case 4: break; dev->irq = CP_INTD_IRQ; } break; #ifdef CONFIG_VRC4173 case 24: dev->irq = VRC4173_CARDU1_IRQ; break; case 25: dev->irq = VRC4173_CARDU2_IRQ; break; #endif case 28: dev->irq = LANINTA_IRQ; break; case 29: dev->irq = PCISLOT_IRQ; break; #ifdef CONFIG_VRC4173 case 30: switch (func) { case 0: dev->irq = VRC4173_IRQ; break; case 1: dev->irq = VRC4173_AC97U_IRQ; break; case 2: dev->irq = VRC4173_USBU_IRQ; break; } break; #endif } pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); } } unsigned int pcibios_assign_all_busses(void) { return 0; } #endif --- NEW FILE: setup.c --- /* * FILE NAME * arch/mips/vr41xx/eagle/setup.c * * BRIEF MODULE DESCRIPTION * Setup for the NEC Eagle board. * * Author: Yoichi Yuasa * yy...@mv... or so...@mv... * * Copyright 2001,2002 MontaVista Software 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * 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., * 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * Changes: * MontaVista Software Inc. <yy...@mv...> or <so...@mv...> * - New creation, NEC Eagle is supported. */ #include <linux/config.h> #include <linux/init.h> #include <linux/console.h> #include <linux/ide.h> #include <linux/ioport.h> #include <asm/reboot.h> #include <asm/time.h> #include <asm/vr41xx/eagle.h> #ifdef CONFIG_BLK_DEV_INITRD extern unsigned long initrd_start, initrd_end; extern void * __rd_start, * __rd_end; #endif #ifdef CONFIG_BLK_DEV_IDE extern struct ide_ops eagle_ide_ops; #endif void __init nec_vr41xx_setup(void) { set_io_port_base(IO_PORT_BASE); ioport_resource.start = IO_PORT_RESOURCE_START; ioport_resource.end = IO_PORT_RESOURCE_END; iomem_resource.start = IO_MEM_RESOURCE_START; iomem_resource.end = IO_MEM_RESOURCE_END; #ifdef CONFIG_BLK_DEV_INITRD ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0); initrd_start = (unsigned long)&__rd_start; initrd_end = (unsigned long)&__rd_end; #endif _machine_restart = vr41xx_restart; _machine_halt = vr41xx_halt; _machine_power_off = vr41xx_power_off; board_time_init = vr41xx_time_init; board_timer_setup = vr41xx_timer_setup; #ifdef CONFIG_FB conswitchp = &dummy_con; #endif #ifdef CONFIG_BLK_DEV_IDE ide_ops = &eagle_ide_ops; #endif vr41xx_bcu_init(); vr41xx_dsiu_init(0); vr41xx_siu_init(1, SIU_RS232C, 0); #ifdef CONFIG_PCI vr41xx_pciu_init(); #endif #ifdef CONFIG_VRC4173 vrc4173_init(); #endif } |