MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / arch / arm / mach-ixp4xx / sg720-pci.c
blobbed32ec01db9088f28f0965a9d70c34b55c354e4
1 /*
2 * arch/arm/mach-ixp4xx/sg720-pci.c
4 * SG590/SG720 board-level PCI initialization
5 * Copyright (C) 2004-2006 SnapGear - A division of Secure Computing
7 * Copyright (C) 2002 Intel Corporation.
8 * Copyright (C) 2003-2004 MontaVista Software, Inc.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
16 #include <linux/pci.h>
17 #include <linux/init.h>
18 #include <linux/delay.h>
19 #include <linux/irq.h>
21 #include <asm/mach-types.h>
22 #include <asm/hardware.h>
23 #include <asm/irq.h>
24 #include <asm/mach/pci.h>
26 void __init sg720_pci_preinit(void)
29 * Check the stepping of the IXP465 CPU. If it is not A0 or A1 then
30 * enable the MPI port for direct memory bus access. Much faster.
31 * This is broken on older steppings, so don't enable.
33 if (cpu_is_ixp46x()) {
34 unsigned long processor_id;
35 asm("mrc p15, 0, %0, cr0, cr0, 0;" : "=r"(processor_id) :);
36 if ((processor_id & 0xf) >= 2) {
37 printk("MPI: enabling fast memory bus...\n");
38 *IXP4XX_EXP_CFG1 |= 0x80000000;
39 } else {
40 printk("MPI: disabling fast memory bus...\n");
41 *IXP4XX_EXP_CFG1 &= ~0x80000000;
45 printk("PCI: reset bus...\n");
46 gpio_line_set(13, 0);
47 gpio_line_config(13, IXP4XX_GPIO_OUT);
48 gpio_line_set(13, 0);
49 mdelay(50);
50 gpio_line_set(13, 1);
51 mdelay(50);
53 gpio_line_config(8, IXP4XX_GPIO_IN);
54 set_irq_type(IRQ_IXP4XX_GPIO8, IRQT_LOW); /* INTA */
55 gpio_line_config(9, IXP4XX_GPIO_IN);
56 set_irq_type(IRQ_IXP4XX_GPIO9, IRQT_LOW); /* INTB */
58 ixp4xx_pci_preinit();
61 static int __init sg720_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
63 #if defined(CONFIG_MACH_SG590)
64 if (slot == 12)
65 return IRQ_SG590_PCI_INTA;
66 else if (slot == 13)
67 return IRQ_SG590_PCI_INTA;
68 #elif defined(CONFIG_MACH_SG720)
69 if (slot == 12)
70 return IRQ_SG720_PCI_INTB;
71 else if (slot == 13)
72 return IRQ_SG720_PCI_INTB;
73 else if (slot == 14)
74 return IRQ_SG720_PCI_INTA;
75 else if (slot == 15)
76 return IRQ_SG720_PCI_INTA;
77 #endif
78 return -1;
81 struct hw_pci sg720_pci __initdata = {
82 .nr_controllers = 1,
83 .preinit = sg720_pci_preinit,
84 .swizzle = pci_std_swizzle,
85 .setup = ixp4xx_setup,
86 .scan = ixp4xx_scan_bus,
87 .map_irq = sg720_map_irq,
90 int __init sg720_pci_init(void)
92 if (machine_is_sg720() || machine_is_sg590())
93 pci_common_init(&sg720_pci);
94 return 0;
97 subsys_initcall(sg720_pci_init);