4 * ADM5120 specific PCI fixups
6 * Copyright (C) ADMtek Incorporated.
7 * Copyright (C) 2005 Jeroen Vreeken (pe1rxq@amsat.org)
8 * Copyright (C) 2007 Gabor Juhos <juhosg@freemail.hu>
9 * Copyright (C) 2007 OpenWrt.org
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the
23 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301, USA.
28 #include <linux/autoconf.h>
29 #include <linux/types.h>
30 #include <linux/kernel.h>
31 #include <linux/init.h>
32 #include <linux/pci.h>
33 #include <linux/pci_ids.h>
34 #include <linux/pci_regs.h>
36 #include <asm/delay.h>
37 #include <asm/bootinfo.h>
39 #include <asm/mach-adm5120/adm5120_info.h>
40 #include <asm/mach-adm5120/adm5120_defs.h>
41 #include <asm/mach-adm5120/adm5120_irq.h>
43 static void adm5120_pci_fixup(struct pci_dev
*dev
)
48 /* setup COMMAND register */
49 pci_write_config_word(dev
, PCI_COMMAND
,
50 (PCI_COMMAND_IO
| PCI_COMMAND_MEMORY
| PCI_COMMAND_MASTER
));
52 /* setup CACHE_LINE_SIZE register */
53 pci_write_config_byte(dev
, PCI_CACHE_LINE_SIZE
, 4);
56 pci_write_config_dword(dev
, PCI_BASE_ADDRESS_0
, 0);
57 pci_write_config_dword(dev
, PCI_BASE_ADDRESS_1
, 0);
60 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ADMTEK
, PCI_DEVICE_ID_ADMTEK_ADM5120
,
64 int __init
pcibios_map_irq(struct pci_dev
*dev
, u8 slot
, u8 pin
)
70 /* FIXME: this code should be working on all boards? */
71 if (slot
> 0 && slot
< 4)
72 irq
= ADM5120_IRQ_PCI0
+slot
-1;
74 switch (mips_machtype
) {
75 case MACH_ADM5120_RB_111
:
76 case MACH_ADM5120_RB_112
:
77 case MACH_ADM5120_RB_133
:
78 case MACH_ADM5120_RB_133C
:
79 case MACH_ADM5120_RB_153
:
80 if (slot
> 0 && slot
< 4)
81 irq
= ADM5120_IRQ_PCI0
+slot
-1;
84 if (slot
> 1 && slot
< 5)
85 irq
= ADM5120_IRQ_PCI0
+slot
-2;
89 printk(KERN_INFO
"PCI: mapping irq for device %s, slot:%u, pin:%u, "
90 "irq:%d\n", pci_name(dev
), slot
, pin
, irq
);
95 int pcibios_plat_dev_init(struct pci_dev
*dev
)