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>
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;
40 printk("MPI: disabling fast memory bus...\n");
41 *IXP4XX_EXP_CFG1
&= ~0x80000000;
45 printk("PCI: reset bus...\n");
47 gpio_line_config(13, IXP4XX_GPIO_OUT
);
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 */
61 static int __init
sg720_map_irq(struct pci_dev
*dev
, u8 slot
, u8 pin
)
63 #if defined(CONFIG_MACH_SG590)
65 return IRQ_SG590_PCI_INTA
;
67 return IRQ_SG590_PCI_INTA
;
68 #elif defined(CONFIG_MACH_SG720)
70 return IRQ_SG720_PCI_INTB
;
72 return IRQ_SG720_PCI_INTB
;
74 return IRQ_SG720_PCI_INTA
;
76 return IRQ_SG720_PCI_INTA
;
81 struct hw_pci sg720_pci __initdata
= {
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
);
97 subsys_initcall(sg720_pci_init
);