Feed the mess through indent.
[linux-2.6/linux-mips.git] / arch / mips / pci / fixup-au1000.c
blob6f6f88fbd38c4e777174b8e81808434850bc0852
1 /*
2 * BRIEF MODULE DESCRIPTION
3 * Board specific pci fixups.
5 * Copyright 2001-2003 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 #include <linux/config.h>
30 #include <linux/types.h>
31 #include <linux/pci.h>
32 #include <linux/kernel.h>
33 #include <linux/init.h>
35 #include <asm/au1000.h>
36 //#include <asm/pb1500.h>
37 #ifdef CONFIG_MIPS_PB1000
38 #include <asm/pb1000.h>
39 #endif
41 #undef DEBUG
42 #ifdef DEBUG
43 #define DBG(x...) printk(x)
44 #else
45 #define DBG(x...)
46 #endif
48 static void fixup_resource(int r_num, struct pci_dev *dev);
49 #ifdef CONFIG_SOC_AU1500
50 static unsigned long virt_io_addr;
51 #endif
53 void __init pcibios_fixup_resources(struct pci_dev *dev)
55 /* will need to fixup IO resources */
58 void __init pcibios_fixup(void)
60 #ifdef CONFIG_SOC_AU1500
61 int i;
62 struct pci_dev *dev;
64 virt_io_addr = (unsigned long) ioremap(Au1500_PCI_IO_START,
65 Au1500_PCI_IO_END -
66 Au1500_PCI_IO_START + 1);
68 if (!virt_io_addr) {
69 printk(KERN_ERR "Unable to ioremap pci space\n");
70 return;
73 set_io_port_base(virt_io_addr);
74 #endif
76 #ifdef CONFIG_MIPS_PB1000 /* This is truly board specific */
77 unsigned long pci_mem_start = (unsigned long) PCI_MEM_START;
79 au_writel(0, PCI_BRIDGE_CONFIG); // set extend byte to 0
80 au_writel(0, SDRAM_MBAR); // set mbar to 0
81 au_writel(0x2, SDRAM_CMD); // enable memory accesses
82 au_sync_delay(1);
84 // set extend byte to mbar of ext slot
85 au_writel(((pci_mem_start >> 24) & 0xff) |
86 (1 << 8 | 1 << 9 | 1 << 10 | 1 << 27),
87 PCI_BRIDGE_CONFIG);
88 DBG("Set bridge config to %x\n", au_readl(PCI_BRIDGE_CONFIG));
89 #endif
92 void __init pcibios_fixup_irqs(void)
94 #ifdef CONFIG_SOC_AU1500
95 unsigned int slot, func;
96 unsigned char pin;
97 struct pci_dev *dev;
99 pci_for_each_dev(dev) {
100 if (dev->bus->number != 0)
101 return;
103 dev->irq = 0xff;
104 slot = PCI_SLOT(dev->devfn);
105 switch (slot) {
106 case 12:
107 case 13:
108 dev->irq = AU1000_PCI_INTA;
109 break;
112 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
113 DBG("slot %d irq %d\n", slot, dev->irq);
115 #endif
117 unsigned int pcibios_assign_all_busses(void)
119 return 0;
122 static void fixup_resource(int r_num, struct pci_dev *dev)