blob: 88fb191ad2ebd2b51d9fb3cc830a5df25c4af24b [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 */
8#include <linux/kernel.h>
9#include <linux/init.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/pci.h>
11#include <linux/types.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <asm/bootinfo.h>
13
14extern struct pci_ops nile4_pci_ops;
15extern struct pci_ops gt64120_pci_ops;
16static struct resource lasat_pci_mem_resource = {
17 .name = "LASAT PCI MEM",
18 .start = 0x18000000,
Thiemo Seuferec125c12005-07-03 19:12:05 +000019 .end = 0x19ffffff,
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 .flags = IORESOURCE_MEM,
21};
22
23static struct resource lasat_pci_io_resource = {
24 .name = "LASAT PCI IO",
25 .start = 0x1a000000,
Thiemo Seuferec125c12005-07-03 19:12:05 +000026 .end = 0x1bffffff,
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 .flags = IORESOURCE_IO,
28};
29
30static struct pci_controller lasat_pci_controller = {
31 .mem_resource = &lasat_pci_mem_resource,
32 .io_resource = &lasat_pci_io_resource,
33};
34
35static int __init lasat_pci_setup(void)
36{
Thiemo Seuferec125c12005-07-03 19:12:05 +000037 printk("PCI: starting\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
Thiemo Seuferec125c12005-07-03 19:12:05 +000039 switch (mips_machtype) {
40 case MACH_LASAT_100:
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 lasat_pci_controller.pci_ops = &gt64120_pci_ops;
42 break;
Thiemo Seuferec125c12005-07-03 19:12:05 +000043 case MACH_LASAT_200:
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 lasat_pci_controller.pci_ops = &nile4_pci_ops;
45 break;
Thiemo Seuferec125c12005-07-03 19:12:05 +000046 default:
Linus Torvalds1da177e2005-04-16 15:20:36 -070047 panic("pcibios_init: mips_machtype incorrect");
48 }
49
50 register_pci_controller(&lasat_pci_controller);
Ralf Baechlec83cfc92005-06-21 13:56:30 +000051
52 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070053}
Ralf Baechlec83cfc92005-06-21 13:56:30 +000054
55arch_initcall(lasat_pci_setup);
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
57#define LASATINT_ETH1 0
58#define LASATINT_ETH0 1
59#define LASATINT_HDC 2
60#define LASATINT_COMP 3
61#define LASATINT_HDLC 4
62#define LASATINT_PCIA 5
63#define LASATINT_PCIB 6
64#define LASATINT_PCIC 7
65#define LASATINT_PCID 8
66
67int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
68{
Thiemo Seuferec125c12005-07-03 19:12:05 +000069 switch (slot) {
70 case 1:
Thiemo Seuferec125c12005-07-03 19:12:05 +000071 case 2:
Thiemo Seuferec125c12005-07-03 19:12:05 +000072 case 3:
Thiemo Seufer50bd2c72005-07-03 19:16:13 +000073 return LASATINT_PCIA + (((slot-1) + (pin-1)) % 4);
Thiemo Seuferec125c12005-07-03 19:12:05 +000074 case 4:
75 return LASATINT_ETH1; /* Ethernet 1 (LAN 2) */
76 case 5:
77 return LASATINT_ETH0; /* Ethernet 0 (LAN 1) */
78 case 6:
79 return LASATINT_HDC; /* IDE controller */
80 default:
81 return 0xff; /* Illegal */
82 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070083
Thiemo Seuferec125c12005-07-03 19:12:05 +000084 return -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070085}
86
87/* Do platform specific device initialization at pci_enable_device() time */
88int pcibios_plat_dev_init(struct pci_dev *dev)
89{
90 return 0;
91}