|
From: Paul M. <le...@us...> - 2002-07-12 20:14:31
|
Update of /cvsroot/linux-mips/linux/arch/mips/vr41xx/vr4122/capcella
In directory usw-pr-cvs1:/tmp/cvs-serv32248/arch/mips/vr41xx/vr4122/capcella
Added Files:
Makefile ide-capcella.c init.c pci_fixup.c setup.c
Log Message:
Merge yoichi-san's vr41xx patch. Still some cleanups needed..
--- NEW FILE: Makefile ---
#
# Makefile for the ZAO Networks Capcella 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 := capcella.o
all: capcella.o
obj-y := init.o setup.o
obj-$(CONFIG_IDE) += ide-capcella.o
obj-$(CONFIG_PCI) += pci_fixup.o
include $(TOPDIR)/Rules.make
--- NEW FILE: ide-capcella.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 ZAO Networks Capcella.
*
* Copyright (C) 1998, 1999, 2001 by Ralf Baechle
*/
#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 capcella_ide_default_irq(ide_ioreg_t base)
{
switch (base) {
case 0x8300: return 42;
}
return 0;
}
static ide_ioreg_t capcella_ide_default_io_base(int index)
{
switch (index) {
case 0: return 0x8300;
}
return 0;
}
static void capcella_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 capcella_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, flags, device, dev_id);
}
static void capcella_ide_free_irq(unsigned int irq, void *dev_id)
{
free_irq(irq, dev_id);
}
static int capcella_ide_check_region(ide_ioreg_t from, unsigned int extent)
{
return check_region(from, extent);
}
static void capcella_ide_request_region(ide_ioreg_t from, unsigned int extent,
const char *name)
{
request_region(from, extent, name);
}
static void capcella_ide_release_region(ide_ioreg_t from, unsigned int extent)
{
release_region(from, extent);
}
struct ide_ops capcella_ide_ops = {
&capcella_ide_default_irq,
&capcella_ide_default_io_base,
&capcella_ide_init_hwif_ports,
&capcella_ide_request_irq,
&capcella_ide_free_irq,
&capcella_ide_check_region,
&capcella_ide_request_region,
&capcella_ide_release_region
};
--- NEW FILE: init.c ---
/*
* FILE NAME
* arch/mips/vr41xx/vr4122/capcella/init.c
*
* BRIEF MODULE DESCRIPTION
* Initialisation code for the ZAO Networks Capcella.
*
* 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 "ZAO Networks Capcella";
}
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, " ");
}
mips_machgroup = MACH_GROUP_NEC_VR41XX;
mips_machtype = MACH_ZAO_CAPCELLA;
/* Add memory region */
add_memory_region(0, 32 << 20, BOOT_MEM_RAM);
}
void __init prom_free_prom_memory (void)
{
}
--- NEW FILE: pci_fixup.c ---
/*
* FILE NAME
* arch/mips/vr41xx/vr4122/capcella/pci_fixup.c
*
* BRIEF MODULE DESCRIPTION
* The ZAO Networks Capcella 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>
#include <linux/init.h>
#include <linux/pci.h>
#include <asm/vr41xx/capcella.h>
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:
dev->irq = RTL8139_1_IRQ;
break;
case 12:
dev->irq = RTL8139_2_IRQ;
break;
case 14:
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
switch (pin) {
case 1:
dev->irq = PC104PLUS_INTA_IRQ;
break;
case 2:
dev->irq = PC104PLUS_INTB_IRQ;
break;
case 3:
dev->irq = PC104PLUS_INTC_IRQ;
break;
case 4:
dev->irq = PC104PLUS_INTD_IRQ;
break;
}
break;
}
pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
}
}
unsigned int pcibios_assign_all_busses(void)
{
return 0;
}
--- NEW FILE: setup.c ---
/*
* FILE NAME
* arch/mips/vr41xx/vr4122/capcella/setup.c
*
* BRIEF MODULE DESCRIPTION
* Setup for the ZAO Networks Capcella.
*
* 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/pci_channel.h>
#include <asm/reboot.h>
#include <asm/time.h>
#include <asm/vr41xx/capcella.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 capcella_ide_ops;
#endif
#ifdef CONFIG_PCI
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}
};
struct vr41xx_pci_address_space vr41xx_pci_mem1 = {
VR41XX_PCI_MEM1_BASE,
VR41XX_PCI_MEM1_MASK,
IO_MEM1_RESOURCE_START
};
struct vr41xx_pci_address_space vr41xx_pci_mem2 = {
VR41XX_PCI_MEM2_BASE,
VR41XX_PCI_MEM2_MASK,
IO_MEM2_RESOURCE_START
};
struct vr41xx_pci_address_space vr41xx_pci_io = {
VR41XX_PCI_IO_BASE,
VR41XX_PCI_IO_MASK,
IO_PORT_RESOURCE_START
};
static struct vr41xx_pci_address_map pci_address_map = {
&vr41xx_pci_mem1,
&vr41xx_pci_mem2,
&vr41xx_pci_io
};
#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_MEM1_RESOURCE_START;
iomem_resource.end = IO_MEM2_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 = &capcella_ide_ops;
#endif
vr41xx_bcu_init();
vr41xx_cmu_init(0x0102);
vr41xx_siu_init(SIU_RS232C, 0);
#ifdef CONFIG_PCI
vr41xx_pciu_init(&pci_address_map);
#endif
}
|