• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * DSM-G600 board-level PCI initialization
3  *
4  * Copyright (C) 2006 Tower Technologies
5  * Author: Alessandro Zummo <a.zummo@towertech.it>
6  *
7  * based on ixdp425-pci.c:
8  *	Copyright (C) 2002 Intel Corporation.
9  *	Copyright (C) 2003-2004 MontaVista Software, Inc.
10  *
11  * Maintainer: http://www.nslu2-linux.org/
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 
dsmg600_pci_preinit(void)26 void __init dsmg600_pci_preinit(void)
27 {
28 	set_irq_type(IRQ_DSMG600_PCI_INTA, IRQ_TYPE_LEVEL_LOW);
29 	set_irq_type(IRQ_DSMG600_PCI_INTB, IRQ_TYPE_LEVEL_LOW);
30 	set_irq_type(IRQ_DSMG600_PCI_INTC, IRQ_TYPE_LEVEL_LOW);
31 	set_irq_type(IRQ_DSMG600_PCI_INTD, IRQ_TYPE_LEVEL_LOW);
32 	set_irq_type(IRQ_DSMG600_PCI_INTE, IRQ_TYPE_LEVEL_LOW);
33 	set_irq_type(IRQ_DSMG600_PCI_INTF, IRQ_TYPE_LEVEL_LOW);
34 
35 	ixp4xx_pci_preinit();
36 }
37 
dsmg600_map_irq(struct pci_dev * dev,u8 slot,u8 pin)38 static int __init dsmg600_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
39 {
40 	static int pci_irq_table[DSMG600_PCI_MAX_DEV][DSMG600_PCI_IRQ_LINES] =
41 	{
42 		{ IRQ_DSMG600_PCI_INTE, -1, -1 },
43 		{ IRQ_DSMG600_PCI_INTA, -1, -1 },
44 		{ IRQ_DSMG600_PCI_INTB, IRQ_DSMG600_PCI_INTC, IRQ_DSMG600_PCI_INTD },
45 		{ IRQ_DSMG600_PCI_INTF, -1, -1 },
46 	};
47 
48 	int irq = -1;
49 
50 	if (slot >= 1 && slot <= DSMG600_PCI_MAX_DEV &&
51 		pin >= 1 && pin <= DSMG600_PCI_IRQ_LINES)
52 		irq = pci_irq_table[slot-1][pin-1];
53 
54 	return irq;
55 }
56 
57 struct hw_pci __initdata dsmg600_pci = {
58 	.nr_controllers = 1,
59 	.preinit	= dsmg600_pci_preinit,
60 	.swizzle	= pci_std_swizzle,
61 	.setup		= ixp4xx_setup,
62 	.scan		= ixp4xx_scan_bus,
63 	.map_irq	= dsmg600_map_irq,
64 };
65 
dsmg600_pci_init(void)66 int __init dsmg600_pci_init(void)
67 {
68 	if (machine_is_dsmg600())
69 		pci_common_init(&dsmg600_pci);
70 
71 	return 0;
72 }
73 
74 subsys_initcall(dsmg600_pci_init);
75