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