Fix warnings
[openwrt-10.03/.git] / target / linux / brcm63xx-2.6 / files / arch / mips / pci / fixup-bcm96348.c
1 /*
2 <:copyright-gpl
3  Copyright 2002 Broadcom Corp. All Rights Reserved.
4
5  This program is free software; you can distribute it and/or modify it
6  under the terms of the GNU General Public License (Version 2) as
7  published by the Free Software Foundation.
8
9  This program is distributed in the hope it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  for more details.
13
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 :>
18 */
19 #include <linux/init.h>
20 #include <linux/types.h>
21 #include <linux/pci.h>
22
23 #include <bcmpci.h>
24 #include <bcm_intr.h>
25 #include <bcm_map_part.h>
26 #include <6348_intr.h>
27 #include <6348_map_part.h>
28
29 static volatile MpiRegisters * mpi = (MpiRegisters *)(MPI_BASE);
30
31 static char irq_tab_bcm96348[] __initdata = {
32     [0] = INTERRUPT_ID_MPI,
33     [1] = INTERRUPT_ID_MPI,
34 #if defined(CONFIG_USB)
35     [USB_HOST_SLOT] = INTERRUPT_ID_USBH
36 #endif
37 };
38
39 int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
40 {
41     return irq_tab_bcm96348[slot];
42 }
43
44 static void bcm96348_fixup(struct pci_dev *dev)
45 {
46     uint32 memaddr;
47     uint32 size;
48
49     memaddr = pci_resource_start(dev, 0);
50     size = pci_resource_len(dev, 0);
51
52     switch (PCI_SLOT(dev->devfn)) {
53         case 0:
54             // UBUS to PCI address range
55             // Memory Window 1. Mask determines which bits are decoded.
56             mpi->l2pmrange1 = ~(size-1);
57             // UBUS to PCI Memory base address. This is akin to the ChipSelect base
58             // register.
59             mpi->l2pmbase1 = memaddr & BCM_PCI_ADDR_MASK;
60             // UBUS to PCI Remap Address. Replaces the masked address bits in the
61             // range register with this setting.
62             // Also, enable direct I/O and direct Memory accesses
63             mpi->l2pmremap1 = (memaddr | MEM_WINDOW_EN);
64             break;
65
66         case 1:
67             // Memory Window 2
68             mpi->l2pmrange2 = ~(size-1);
69             // UBUS to PCI Memory base address.
70             mpi->l2pmbase2 = memaddr & BCM_PCI_ADDR_MASK;
71             // UBUS to PCI Remap Address
72             mpi->l2pmremap2 = (memaddr | MEM_WINDOW_EN);
73             break;
74
75 #if defined(CONFIG_USB)
76         case USB_HOST_SLOT:
77             dev->resource[0].start = USB_HOST_BASE;
78             dev->resource[0].end = USB_HOST_BASE+USB_BAR0_MEM_SIZE-1;
79             break;
80 #endif
81     }
82 }
83
84 int pcibios_plat_dev_init(struct pci_dev *dev)
85 {
86         return 0;
87 }
88
89 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, PCI_ANY_ID,
90           bcm96348_fixup);
91
92 /*struct pci_fixup pcibios_fixups[] = {
93     { PCI_FIXUP_FINAL, PCI_ANY_ID, PCI_ANY_ID, bcm96348_fixup },
94     {0}
95 };*/