Commit | Line | Data |
---|---|---|
a09749dd JL |
1 | /* |
2 | * arch/sh/drivers/pci/ops-titan.c | |
3 | * | |
4 | * Ported to new API by Paul Mundt <lethal@linux-sh.org> | |
5 | * | |
6 | * Modified from ops-snapgear.c written by David McCullough | |
7 | * Highly leveraged from pci-bigsur.c, written by Dustin McIntire. | |
8 | * | |
9 | * May be copied or modified under the terms of the GNU General Public | |
10 | * License. See linux/COPYING for more information. | |
11 | * | |
12 | * PCI initialization for the Titan boards | |
13 | */ | |
a09749dd JL |
14 | #include <linux/kernel.h> |
15 | #include <linux/types.h> | |
16 | #include <linux/init.h> | |
0f08f338 | 17 | #include <linux/pci.h> |
a09749dd JL |
18 | #include <asm/io.h> |
19 | #include <asm/titan.h> | |
959f85f8 | 20 | #include "pci-sh4.h" |
a09749dd | 21 | |
959f85f8 | 22 | int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) |
a09749dd JL |
23 | { |
24 | int irq = -1; | |
25 | ||
26 | switch (slot) { | |
27 | case 0: irq = TITAN_IRQ_WAN; break; /* eth0 (WAN) */ | |
28 | case 1: irq = TITAN_IRQ_LAN; break; /* eth1 (LAN) */ | |
29 | case 2: irq = TITAN_IRQ_MPCIA; break; /* mPCI A */ | |
30 | case 3: irq = TITAN_IRQ_MPCIB; break; /* mPCI B */ | |
31 | case 4: irq = TITAN_IRQ_USB; break; /* USB */ | |
32 | default: | |
959f85f8 PM |
33 | printk(KERN_INFO "PCI: Bad IRQ mapping " |
34 | "request for slot %d\n", slot); | |
a09749dd JL |
35 | return -1; |
36 | } | |
37 | ||
38 | printk("PCI: Mapping TITAN IRQ for slot %d, pin %c to irq %d\n", | |
39 | slot, pin - 1 + 'A', irq); | |
40 | ||
41 | return irq; | |
42 | } | |
43 | ||
44 | static struct resource sh7751_io_resource = { | |
45 | .name = "SH7751_IO", | |
46 | .start = SH7751_PCI_IO_BASE, | |
47 | .end = SH7751_PCI_IO_BASE + SH7751_PCI_IO_SIZE - 1, | |
48 | .flags = IORESOURCE_IO | |
49 | }; | |
50 | ||
51 | static struct resource sh7751_mem_resource = { | |
52 | .name = "SH7751_mem", | |
53 | .start = SH7751_PCI_MEMORY_BASE, | |
54 | .end = SH7751_PCI_MEMORY_BASE + SH7751_PCI_MEM_SIZE - 1, | |
55 | .flags = IORESOURCE_MEM | |
56 | }; | |
57 | ||
a09749dd | 58 | struct pci_channel board_pci_channels[] = { |
959f85f8 | 59 | { &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff }, |
a09749dd JL |
60 | { NULL, NULL, NULL, 0, 0 }, |
61 | }; | |
62 | EXPORT_SYMBOL(board_pci_channels); | |
63 | ||
959f85f8 | 64 | static struct sh4_pci_address_map sh7751_pci_map = { |
a09749dd JL |
65 | .window0 = { |
66 | .base = SH7751_CS2_BASE_ADDR, | |
67 | .size = SH7751_MEM_REGION_SIZE*2, /* cs2 and cs3 */ | |
68 | }, | |
69 | ||
70 | .window1 = { | |
71 | .base = SH7751_CS2_BASE_ADDR, | |
72 | .size = SH7751_MEM_REGION_SIZE*2, | |
73 | }, | |
74 | ||
959f85f8 | 75 | .flags = SH4_PCIC_NO_RESET, |
a09749dd JL |
76 | }; |
77 | ||
78 | int __init pcibios_init_platform(void) | |
79 | { | |
80 | return sh7751_pcic_init(&sh7751_pci_map); | |
81 | } |