3 Copyright 2002 Broadcom Corp. All Rights Reserved.
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.
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
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.
19 #include <linux/init.h>
20 #include <linux/types.h>
21 #include <linux/pci.h>
25 #include <bcm_map_part.h>
27 static volatile MpiRegisters * mpi = (MpiRegisters *)(MPI_BASE);
29 static char irq_tab_bcm96348[] __initdata = {
30 [0] = INTERRUPT_ID_MPI,
31 [1] = INTERRUPT_ID_MPI,
32 #if defined(CONFIG_USB)
33 [USB_HOST_SLOT] = INTERRUPT_ID_USBH
37 int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
39 return irq_tab_bcm96348[slot];
42 static void bcm96348_fixup(struct pci_dev *dev)
47 memaddr = pci_resource_start(dev, 0);
48 size = pci_resource_len(dev, 0);
50 switch (PCI_SLOT(dev->devfn)) {
52 // UBUS to PCI address range
53 // Memory Window 1. Mask determines which bits are decoded.
54 mpi->l2pmrange1 = ~(size-1);
55 // UBUS to PCI Memory base address. This is akin to the ChipSelect base
57 mpi->l2pmbase1 = memaddr & BCM_PCI_ADDR_MASK;
58 // UBUS to PCI Remap Address. Replaces the masked address bits in the
59 // range register with this setting.
60 // Also, enable direct I/O and direct Memory accesses
61 mpi->l2pmremap1 = (memaddr | MEM_WINDOW_EN);
66 mpi->l2pmrange2 = ~(size-1);
67 // UBUS to PCI Memory base address.
68 mpi->l2pmbase2 = memaddr & BCM_PCI_ADDR_MASK;
69 // UBUS to PCI Remap Address
70 mpi->l2pmremap2 = (memaddr | MEM_WINDOW_EN);
73 #if defined(CONFIG_USB)
75 dev->resource[0].start = USB_HOST_BASE;
76 dev->resource[0].end = USB_HOST_BASE+USB_BAR0_MEM_SIZE-1;
82 int pcibios_plat_dev_init(struct pci_dev *dev)
87 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, PCI_ANY_ID,
90 /*struct pci_fixup pcibios_fixups[] = {
91 { PCI_FIXUP_FINAL, PCI_ANY_ID, PCI_ANY_ID, bcm96348_fixup },