Jamie Lenehan | a09749d | 2006-09-27 15:05:39 +0900 | [diff] [blame] | 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 | */ |
| 14 | |
| 15 | #include <linux/config.h> |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/types.h> |
| 18 | #include <linux/init.h> |
Jamie Lenehan | a09749d | 2006-09-27 15:05:39 +0900 | [diff] [blame] | 19 | #include <asm/io.h> |
| 20 | #include <asm/titan.h> |
Paul Mundt | 959f85f | 2006-09-27 16:43:28 +0900 | [diff] [blame^] | 21 | #include "pci-sh4.h" |
Jamie Lenehan | a09749d | 2006-09-27 15:05:39 +0900 | [diff] [blame] | 22 | |
Paul Mundt | 959f85f | 2006-09-27 16:43:28 +0900 | [diff] [blame^] | 23 | int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) |
Jamie Lenehan | a09749d | 2006-09-27 15:05:39 +0900 | [diff] [blame] | 24 | { |
| 25 | int irq = -1; |
| 26 | |
| 27 | switch (slot) { |
| 28 | case 0: irq = TITAN_IRQ_WAN; break; /* eth0 (WAN) */ |
| 29 | case 1: irq = TITAN_IRQ_LAN; break; /* eth1 (LAN) */ |
| 30 | case 2: irq = TITAN_IRQ_MPCIA; break; /* mPCI A */ |
| 31 | case 3: irq = TITAN_IRQ_MPCIB; break; /* mPCI B */ |
| 32 | case 4: irq = TITAN_IRQ_USB; break; /* USB */ |
| 33 | default: |
Paul Mundt | 959f85f | 2006-09-27 16:43:28 +0900 | [diff] [blame^] | 34 | printk(KERN_INFO "PCI: Bad IRQ mapping " |
| 35 | "request for slot %d\n", slot); |
Jamie Lenehan | a09749d | 2006-09-27 15:05:39 +0900 | [diff] [blame] | 36 | return -1; |
| 37 | } |
| 38 | |
| 39 | printk("PCI: Mapping TITAN IRQ for slot %d, pin %c to irq %d\n", |
| 40 | slot, pin - 1 + 'A', irq); |
| 41 | |
| 42 | return irq; |
| 43 | } |
| 44 | |
| 45 | static struct resource sh7751_io_resource = { |
| 46 | .name = "SH7751_IO", |
| 47 | .start = SH7751_PCI_IO_BASE, |
| 48 | .end = SH7751_PCI_IO_BASE + SH7751_PCI_IO_SIZE - 1, |
| 49 | .flags = IORESOURCE_IO |
| 50 | }; |
| 51 | |
| 52 | static struct resource sh7751_mem_resource = { |
| 53 | .name = "SH7751_mem", |
| 54 | .start = SH7751_PCI_MEMORY_BASE, |
| 55 | .end = SH7751_PCI_MEMORY_BASE + SH7751_PCI_MEM_SIZE - 1, |
| 56 | .flags = IORESOURCE_MEM |
| 57 | }; |
| 58 | |
Jamie Lenehan | a09749d | 2006-09-27 15:05:39 +0900 | [diff] [blame] | 59 | struct pci_channel board_pci_channels[] = { |
Paul Mundt | 959f85f | 2006-09-27 16:43:28 +0900 | [diff] [blame^] | 60 | { &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff }, |
Jamie Lenehan | a09749d | 2006-09-27 15:05:39 +0900 | [diff] [blame] | 61 | { NULL, NULL, NULL, 0, 0 }, |
| 62 | }; |
| 63 | EXPORT_SYMBOL(board_pci_channels); |
| 64 | |
Paul Mundt | 959f85f | 2006-09-27 16:43:28 +0900 | [diff] [blame^] | 65 | static struct sh4_pci_address_map sh7751_pci_map = { |
Jamie Lenehan | a09749d | 2006-09-27 15:05:39 +0900 | [diff] [blame] | 66 | .window0 = { |
| 67 | .base = SH7751_CS2_BASE_ADDR, |
| 68 | .size = SH7751_MEM_REGION_SIZE*2, /* cs2 and cs3 */ |
| 69 | }, |
| 70 | |
| 71 | .window1 = { |
| 72 | .base = SH7751_CS2_BASE_ADDR, |
| 73 | .size = SH7751_MEM_REGION_SIZE*2, |
| 74 | }, |
| 75 | |
Paul Mundt | 959f85f | 2006-09-27 16:43:28 +0900 | [diff] [blame^] | 76 | .flags = SH4_PCIC_NO_RESET, |
Jamie Lenehan | a09749d | 2006-09-27 15:05:39 +0900 | [diff] [blame] | 77 | }; |
| 78 | |
| 79 | int __init pcibios_init_platform(void) |
| 80 | { |
| 81 | return sh7751_pcic_init(&sh7751_pci_map); |
| 82 | } |