1 // SPDX-License-Identifier: GPL-2.0-only
3 * DSM-G600 board-level PCI initialization
5 * Copyright (C) 2006 Tower Technologies
6 * Author: Alessandro Zummo <a.zummo@towertech.it>
8 * based on ixdp425-pci.c:
9 * Copyright (C) 2002 Intel Corporation.
10 * Copyright (C) 2003-2004 MontaVista Software, Inc.
12 * Maintainer: http://www.nslu2-linux.org/
15 #include <linux/pci.h>
16 #include <linux/init.h>
17 #include <linux/irq.h>
18 #include <asm/mach/pci.h>
19 #include <asm/mach-types.h>
26 /* PCI controller GPIO to IRQ pin mappings */
34 void __init
dsmg600_pci_preinit(void)
36 irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA
), IRQ_TYPE_LEVEL_LOW
);
37 irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB
), IRQ_TYPE_LEVEL_LOW
);
38 irq_set_irq_type(IXP4XX_GPIO_IRQ(INTC
), IRQ_TYPE_LEVEL_LOW
);
39 irq_set_irq_type(IXP4XX_GPIO_IRQ(INTD
), IRQ_TYPE_LEVEL_LOW
);
40 irq_set_irq_type(IXP4XX_GPIO_IRQ(INTE
), IRQ_TYPE_LEVEL_LOW
);
41 irq_set_irq_type(IXP4XX_GPIO_IRQ(INTF
), IRQ_TYPE_LEVEL_LOW
);
45 static int __init
dsmg600_map_irq(const struct pci_dev
*dev
, u8 slot
, u8 pin
)
47 static int pci_irq_table
[MAX_DEV
][IRQ_LINES
] = {
48 { IXP4XX_GPIO_IRQ(INTE
), -1, -1 },
49 { IXP4XX_GPIO_IRQ(INTA
), -1, -1 },
50 { IXP4XX_GPIO_IRQ(INTB
), IXP4XX_GPIO_IRQ(INTC
),
51 IXP4XX_GPIO_IRQ(INTD
) },
52 { IXP4XX_GPIO_IRQ(INTF
), -1, -1 },
55 if (slot
>= 1 && slot
<= MAX_DEV
&& pin
>= 1 && pin
<= IRQ_LINES
)
56 return pci_irq_table
[slot
- 1][pin
- 1];
61 struct hw_pci __initdata dsmg600_pci
= {
64 .preinit
= dsmg600_pci_preinit
,
65 .setup
= ixp4xx_setup
,
66 .map_irq
= dsmg600_map_irq
,
69 int __init
dsmg600_pci_init(void)
71 if (machine_is_dsmg600())
72 pci_common_init(&dsmg600_pci
);
77 subsys_initcall(dsmg600_pci_init
);