blob: 40d2797d2bc43b255edd050cf17d270cdbc4325d [file] [log] [blame]
Brian Murphy1f21d2b2007-08-21 22:34:16 +02001/*
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 Murphy1f21d2b2007-08-21 22:34:16 +02008#include <linux/init.h>
Yoichi Yuasa89becf52007-11-09 18:42:35 +09009#include <linux/kernel.h>
Brian Murphy1f21d2b2007-08-21 22:34:16 +020010#include <linux/pci.h>
11#include <linux/types.h>
Yoichi Yuasa89becf52007-11-09 18:42:35 +090012
Thomas Bogendoerferb27418a2008-07-14 16:58:47 +020013#include <asm/lasat/lasat.h>
Yoichi Yuasa89becf52007-11-09 18:42:35 +090014
15#include <irq.h>
Brian Murphy1f21d2b2007-08-21 22:34:16 +020016
17extern struct pci_ops nile4_pci_ops;
18extern struct pci_ops gt64xxx_pci0_ops;
19static struct resource lasat_pci_mem_resource = {
20 .name = "LASAT PCI MEM",
21 .start = 0x18000000,
22 .end = 0x19ffffff,
23 .flags = IORESOURCE_MEM,
24};
25
26static struct resource lasat_pci_io_resource = {
27 .name = "LASAT PCI IO",
28 .start = 0x1a000000,
29 .end = 0x1bffffff,
30 .flags = IORESOURCE_IO,
31};
32
33static struct pci_controller lasat_pci_controller = {
34 .mem_resource = &lasat_pci_mem_resource,
35 .io_resource = &lasat_pci_io_resource,
36};
37
38static int __init lasat_pci_setup(void)
39{
40 printk(KERN_DEBUG "PCI: starting\n");
41
Thomas Bogendoerferb27418a2008-07-14 16:58:47 +020042 if (IS_LASAT_200())
Brian Murphy1f21d2b2007-08-21 22:34:16 +020043 lasat_pci_controller.pci_ops = &nile4_pci_ops;
Thomas Bogendoerferb27418a2008-07-14 16:58:47 +020044 else
45 lasat_pci_controller.pci_ops = &gt64xxx_pci0_ops;
Brian Murphy1f21d2b2007-08-21 22:34:16 +020046
47 register_pci_controller(&lasat_pci_controller);
48
49 return 0;
50}
51
52arch_initcall(lasat_pci_setup);
53
Ralf Baechle70342282013-01-22 12:59:30 +010054#define LASAT_IRQ_ETH1 (LASAT_IRQ_BASE + 0)
55#define LASAT_IRQ_ETH0 (LASAT_IRQ_BASE + 1)
56#define LASAT_IRQ_HDC (LASAT_IRQ_BASE + 2)
57#define LASAT_IRQ_COMP (LASAT_IRQ_BASE + 3)
58#define LASAT_IRQ_HDLC (LASAT_IRQ_BASE + 4)
59#define LASAT_IRQ_PCIA (LASAT_IRQ_BASE + 5)
60#define LASAT_IRQ_PCIB (LASAT_IRQ_BASE + 6)
61#define LASAT_IRQ_PCIC (LASAT_IRQ_BASE + 7)
62#define LASAT_IRQ_PCID (LASAT_IRQ_BASE + 8)
Brian Murphy1f21d2b2007-08-21 22:34:16 +020063
64int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
65{
66 switch (slot) {
67 case 1:
68 case 2:
69 case 3:
Yoichi Yuasa89becf52007-11-09 18:42:35 +090070 return LASAT_IRQ_PCIA + (((slot-1) + (pin-1)) % 4);
Brian Murphy1f21d2b2007-08-21 22:34:16 +020071 case 4:
Ralf Baechle70342282013-01-22 12:59:30 +010072 return LASAT_IRQ_ETH1; /* Ethernet 1 (LAN 2) */
Brian Murphy1f21d2b2007-08-21 22:34:16 +020073 case 5:
Ralf Baechle70342282013-01-22 12:59:30 +010074 return LASAT_IRQ_ETH0; /* Ethernet 0 (LAN 1) */
Brian Murphy1f21d2b2007-08-21 22:34:16 +020075 case 6:
Ralf Baechle70342282013-01-22 12:59:30 +010076 return LASAT_IRQ_HDC; /* IDE controller */
Brian Murphy1f21d2b2007-08-21 22:34:16 +020077 default:
Ralf Baechle70342282013-01-22 12:59:30 +010078 return 0xff; /* Illegal */
Brian Murphy1f21d2b2007-08-21 22:34:16 +020079 }
80
81 return -1;
82}
83
84/* Do platform specific device initialization at pci_enable_device() time */
85int pcibios_plat_dev_init(struct pci_dev *dev)
86{
87 return 0;
88}