| Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 1 | /* | 
|  | 2 | * This file is subject to the terms and conditions of the GNU General Public | 
|  | 3 | * License.  See the file "COPYING" in the main directory of this archive | 
|  | 4 | * for more details. | 
|  | 5 | * | 
|  | 6 | * Copyright (C) 2000, 2001, 04 Keith M Wesolowski | 
|  | 7 | */ | 
| Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 8 | #include <linux/init.h> | 
| Yoichi Yuasa | 89becf5 | 2007-11-09 18:42:35 +0900 | [diff] [blame] | 9 | #include <linux/kernel.h> | 
| Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 10 | #include <linux/pci.h> | 
|  | 11 | #include <linux/types.h> | 
| Yoichi Yuasa | 89becf5 | 2007-11-09 18:42:35 +0900 | [diff] [blame] | 12 |  | 
| Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 13 | #include <asm/bootinfo.h> | 
| Yoichi Yuasa | 89becf5 | 2007-11-09 18:42:35 +0900 | [diff] [blame] | 14 |  | 
|  | 15 | #include <irq.h> | 
| Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 16 |  | 
|  | 17 | extern struct pci_ops nile4_pci_ops; | 
|  | 18 | extern struct pci_ops gt64xxx_pci0_ops; | 
|  | 19 | static struct resource lasat_pci_mem_resource = { | 
|  | 20 | .name	= "LASAT PCI MEM", | 
|  | 21 | .start	= 0x18000000, | 
|  | 22 | .end	= 0x19ffffff, | 
|  | 23 | .flags	= IORESOURCE_MEM, | 
|  | 24 | }; | 
|  | 25 |  | 
|  | 26 | static struct resource lasat_pci_io_resource = { | 
|  | 27 | .name	= "LASAT PCI IO", | 
|  | 28 | .start	= 0x1a000000, | 
|  | 29 | .end	= 0x1bffffff, | 
|  | 30 | .flags	= IORESOURCE_IO, | 
|  | 31 | }; | 
|  | 32 |  | 
|  | 33 | static struct pci_controller lasat_pci_controller = { | 
|  | 34 | .mem_resource	= &lasat_pci_mem_resource, | 
|  | 35 | .io_resource	= &lasat_pci_io_resource, | 
|  | 36 | }; | 
|  | 37 |  | 
|  | 38 | static int __init lasat_pci_setup(void) | 
|  | 39 | { | 
|  | 40 | printk(KERN_DEBUG "PCI: starting\n"); | 
|  | 41 |  | 
|  | 42 | switch (mips_machtype) { | 
|  | 43 | case MACH_LASAT_100: | 
|  | 44 | lasat_pci_controller.pci_ops = >64xxx_pci0_ops; | 
|  | 45 | break; | 
|  | 46 | case MACH_LASAT_200: | 
|  | 47 | lasat_pci_controller.pci_ops = &nile4_pci_ops; | 
|  | 48 | break; | 
|  | 49 | default: | 
|  | 50 | panic("pcibios_init: mips_machtype incorrect"); | 
|  | 51 | } | 
|  | 52 |  | 
|  | 53 | register_pci_controller(&lasat_pci_controller); | 
|  | 54 |  | 
|  | 55 | return 0; | 
|  | 56 | } | 
|  | 57 |  | 
|  | 58 | arch_initcall(lasat_pci_setup); | 
|  | 59 |  | 
| Yoichi Yuasa | 89becf5 | 2007-11-09 18:42:35 +0900 | [diff] [blame] | 60 | #define LASAT_IRQ_ETH1   (LASAT_IRQ_BASE + 0) | 
|  | 61 | #define LASAT_IRQ_ETH0   (LASAT_IRQ_BASE + 1) | 
|  | 62 | #define LASAT_IRQ_HDC    (LASAT_IRQ_BASE + 2) | 
|  | 63 | #define LASAT_IRQ_COMP   (LASAT_IRQ_BASE + 3) | 
|  | 64 | #define LASAT_IRQ_HDLC   (LASAT_IRQ_BASE + 4) | 
|  | 65 | #define LASAT_IRQ_PCIA   (LASAT_IRQ_BASE + 5) | 
|  | 66 | #define LASAT_IRQ_PCIB   (LASAT_IRQ_BASE + 6) | 
|  | 67 | #define LASAT_IRQ_PCIC   (LASAT_IRQ_BASE + 7) | 
|  | 68 | #define LASAT_IRQ_PCID   (LASAT_IRQ_BASE + 8) | 
| Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 69 |  | 
|  | 70 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 
|  | 71 | { | 
|  | 72 | switch (slot) { | 
|  | 73 | case 1: | 
|  | 74 | case 2: | 
|  | 75 | case 3: | 
| Yoichi Yuasa | 89becf5 | 2007-11-09 18:42:35 +0900 | [diff] [blame] | 76 | return LASAT_IRQ_PCIA + (((slot-1) + (pin-1)) % 4); | 
| Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 77 | case 4: | 
| Yoichi Yuasa | 89becf5 | 2007-11-09 18:42:35 +0900 | [diff] [blame] | 78 | return LASAT_IRQ_ETH1;   /* Ethernet 1 (LAN 2) */ | 
| Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 79 | case 5: | 
| Yoichi Yuasa | 89becf5 | 2007-11-09 18:42:35 +0900 | [diff] [blame] | 80 | return LASAT_IRQ_ETH0;   /* Ethernet 0 (LAN 1) */ | 
| Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 81 | case 6: | 
| Yoichi Yuasa | 89becf5 | 2007-11-09 18:42:35 +0900 | [diff] [blame] | 82 | return LASAT_IRQ_HDC;    /* IDE controller */ | 
| Brian Murphy | 1f21d2b | 2007-08-21 22:34:16 +0200 | [diff] [blame] | 83 | default: | 
|  | 84 | return 0xff;            /* Illegal */ | 
|  | 85 | } | 
|  | 86 |  | 
|  | 87 | return -1; | 
|  | 88 | } | 
|  | 89 |  | 
|  | 90 | /* Do platform specific device initialization at pci_enable_device() time */ | 
|  | 91 | int pcibios_plat_dev_init(struct pci_dev *dev) | 
|  | 92 | { | 
|  | 93 | return 0; | 
|  | 94 | } |