1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#include <linux/kernel.h>
24#include <linux/init.h>
25#include <linux/types.h>
26#include <linux/pci.h>
27
28#include <asm/bootinfo.h>
29
30#include <asm/emma/emma2rh.h>
31
32#define EMMA2RH_PCI_HOST_SLOT 0x09
33#define EMMA2RH_USB_SLOT 0x03
34#define PCI_DEVICE_ID_NEC_EMMA2RH 0x014b
35
36
37
38
39
40
41
42
43
44
45#define MAX_SLOT_NUM 10
46static unsigned char irq_map[][5] __initdata = {
47 [3] = {0, MARKEINS_PCI_IRQ_INTB, MARKEINS_PCI_IRQ_INTC,
48 MARKEINS_PCI_IRQ_INTD, 0,},
49 [4] = {0, MARKEINS_PCI_IRQ_INTA, 0, 0, 0,},
50 [5] = {0, 0, 0, 0, 0,},
51 [6] = {0, MARKEINS_PCI_IRQ_INTC, MARKEINS_PCI_IRQ_INTD,
52 MARKEINS_PCI_IRQ_INTA, MARKEINS_PCI_IRQ_INTB,},
53};
54
55static void __devinit nec_usb_controller_fixup(struct pci_dev *dev)
56{
57 if (PCI_SLOT(dev->devfn) == EMMA2RH_USB_SLOT)
58
59 pci_write_config_dword(dev, 0xe4, 1 << 5);
60}
61
62DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB,
63 nec_usb_controller_fixup);
64
65
66
67
68
69
70static void __devinit emma2rh_pci_host_fixup(struct pci_dev *dev)
71{
72 int i;
73
74 if (PCI_SLOT(dev->devfn) == EMMA2RH_PCI_HOST_SLOT) {
75 dev->class &= 0xff;
76 dev->class |= PCI_CLASS_BRIDGE_HOST << 8;
77 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
78 dev->resource[i].start = 0;
79 dev->resource[i].end = 0;
80 dev->resource[i].flags = 0;
81 }
82 }
83}
84
85DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_EMMA2RH,
86 emma2rh_pci_host_fixup);
87
88int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
89{
90 return irq_map[slot][pin];
91}
92
93
94int pcibios_plat_dev_init(struct pci_dev *dev)
95{
96 return 0;
97}
98