From: Paul M. <le...@us...> - 2002-03-07 03:16:57
|
Update of /cvsroot/linux-mips/linux/arch/mips/vr41xx/vr4122/mp-c303 In directory usw-pr-cvs1:/tmp/cvs-serv28915/arch/mips/vr41xx/vr4122/mp-c303 Added Files: Makefile ide-mpc303.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 Victor MP-C303/304 specific parts of the kernel # # 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 := mp-c303.o all: mp-c303.o obj-y := init.o irq.o setup.o obj-$(CONFIG_IDE) += ide-mpc303.o obj-$(CONFIG_PCI) += pci_fixup.o include $(TOPDIR)/Rules.make --- NEW FILE: ide-mpc303.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 Victor MP-C303/304. * * Copyright (C) 1998, 1999, 2001 by Ralf Baechle */ /* * Changes: * Yoichi Yuasa <yu...@hh...> Sun, 24 Feb 2002 * - Added Victor MP-C303/304 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 mpc303_ide_default_irq(ide_ioreg_t base) { return 0; } static ide_ioreg_t mpc303_ide_default_io_base(int index) { return 0; } static void mpc303_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 mpc303_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 mpc303_ide_free_irq(unsigned int irq, void *dev_id) { free_irq(irq, dev_id); } static int mpc303_ide_check_region(ide_ioreg_t from, unsigned int extent) { return check_region(from, extent); } static void mpc303_ide_request_region(ide_ioreg_t from, unsigned int extent, const char *name) { request_region(from, extent, name); } static void mpc303_ide_release_region(ide_ioreg_t from, unsigned int extent) { release_region(from, extent); } struct ide_ops mpc303_ide_ops = { &mpc303_ide_default_irq, &mpc303_ide_default_io_base, &mpc303_ide_init_hwif_ports, &mpc303_ide_request_irq, &mpc303_ide_free_irq, &mpc303_ide_check_region, &mpc303_ide_request_region, &mpc303_ide_release_region }; --- NEW FILE: init.c --- /* * FILE NAME * arch/mips/vr41xx/mp-c303/init.c * * BRIEF MODULE DESCRIPTION * Initialisation code for the Victor MP-C303/304. * * Copyright 2002 Yoichi Yuasa * yu...@hh... * * 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/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 "Victor MP-C303/304"; } void __init bus_error_init(void) { } void __init prom_init(int argc, char **argv, unsigned long magic, int *prom_vec) { 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_VICTOR_MPC303; /* Add memory region */ add_memory_region(0, 32 << 20, BOOT_MEM_RAM); } void __init prom_free_prom_memory (void) { } --- NEW FILE: irq.c --- /* * FILE NAME * arch/mips/vr41xx/mp-c303/irq.c * * BRIEF MODULE DESCRIPTION * Interrupt routines for the Victor MP-C303/304. * * Copyright 2002 Yoichi Yuasa * yu...@hh... * * 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/init.h> void __init vr41xx_board_irq_init(void) { } --- NEW FILE: pci_fixup.c --- /* * FILE NAME * arch/mips/vr41xx/mp-c303/pci_fixup.c * * BRIEF MODULE DESCRIPTION * The Victor MP-C303/304 specific PCI fixups. * * Copyright 2002 Yoichi Yuasa * yu...@hh... * * 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/config.h> #ifdef CONFIG_PCI #include <linux/init.h> #include <linux/pci.h> #include <asm/pci_channel.h> #include <asm/vr41xx/mp-c303.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) { #ifdef CONFIG_VRC4173 case 24: dev->irq = VRC4173_CARDU1_IRQ; break; case 25: dev->irq = VRC4173_CARDU2_IRQ; break; 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/mp-c303/setup.c * * BRIEF MODULE DESCRIPTION * Setup for the Victor MP-C303/304. * * Copyright 2002 Yoichi Yuasa * yu...@hh... * * 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/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/mp-c303.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 mpc303_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 = &mpc303_ide_ops; #endif vr41xx_bcu_init(); vr41xx_siu_init(0, SIU_RS232C, 0); #ifdef CONFIG_PCI vr41xx_pciu_init(); #endif #ifdef CONFIG_VRC4173 vrc4173_init(); #endif } |