blob: ca12a9ca083045f479409d0a5172a88ab5eb529e [file] [log] [blame]
Rod Whitby7e36e2f2008-04-01 10:53:23 +01001/*
2 * arch/arch/mach-ixp4xx/fsg-pci.c
3 *
4 * FSG board-level PCI initialization
5 *
6 * Author: Rod Whitby <rod@whitby.id.au>
7 * Maintainer: http://www.nslu2-linux.org/
8 *
9 * based on ixdp425-pci.c:
10 * Copyright (C) 2002 Intel Corporation.
11 * Copyright (C) 2003-2004 MontaVista Software, Inc.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 *
17 */
18
19#include <linux/pci.h>
20#include <linux/init.h>
21#include <linux/irq.h>
22
23#include <asm/mach/pci.h>
24#include <asm/mach-types.h>
25
26void __init fsg_pci_preinit(void)
27{
Dmitry Baryshkov6cab4862008-07-27 04:23:31 +010028 set_irq_type(IRQ_FSG_PCI_INTA, IRQ_TYPE_LEVEL_LOW);
29 set_irq_type(IRQ_FSG_PCI_INTB, IRQ_TYPE_LEVEL_LOW);
30 set_irq_type(IRQ_FSG_PCI_INTC, IRQ_TYPE_LEVEL_LOW);
Rod Whitby7e36e2f2008-04-01 10:53:23 +010031
32 ixp4xx_pci_preinit();
33}
34
35static int __init fsg_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
36{
37 static int pci_irq_table[FSG_PCI_IRQ_LINES] = {
38 IRQ_FSG_PCI_INTC,
39 IRQ_FSG_PCI_INTB,
40 IRQ_FSG_PCI_INTA,
41 };
42
43 int irq = -1;
44 slot = slot - 11;
45
46 if (slot >= 1 && slot <= FSG_PCI_MAX_DEV &&
47 pin >= 1 && pin <= FSG_PCI_IRQ_LINES)
48 irq = pci_irq_table[(slot - 1)];
49 printk(KERN_INFO "%s: Mapped slot %d pin %d to IRQ %d\n",
50 __func__, slot, pin, irq);
51
52 return irq;
53}
54
55struct hw_pci fsg_pci __initdata = {
56 .nr_controllers = 1,
57 .preinit = fsg_pci_preinit,
58 .swizzle = pci_std_swizzle,
59 .setup = ixp4xx_setup,
60 .scan = ixp4xx_scan_bus,
61 .map_irq = fsg_map_irq,
62};
63
64int __init fsg_pci_init(void)
65{
66 if (machine_is_fsg())
67 pci_common_init(&fsg_pci);
68 return 0;
69}
70
71subsys_initcall(fsg_pci_init);