1 /*
2 * arch/sh/drivers/pci/fixups-dreamcast.c
3 *
4 * PCI fixups for the Sega Dreamcast
5 *
6 * Copyright (C) 2001, 2002 M. R. Brown
7 * Copyright (C) 2002, 2003, 2006 Paul Mundt
8 *
9 * This file originally bore the message (with enclosed-$):
10 * Id: pci.c,v 1.3 2003/05/04 19:29:46 lethal Exp
11 * Dreamcast PCI: Supports SEGA Broadband Adaptor only.
12 *
13 * This file is subject to the terms and conditions of the GNU General Public
14 * License. See the file "COPYING" in the main directory of this archive
15 * for more details.
16 */
17
18 #include <linux/sched.h>
19 #include <linux/kernel.h>
20 #include <linux/param.h>
21 #include <linux/interrupt.h>
22 #include <linux/init.h>
23 #include <linux/irq.h>
24 #include <linux/pci.h>
25 #include <linux/dma-mapping.h>
26
27 #include <asm/io.h>
28 #include <asm/irq.h>
29 #include <mach/pci.h>
30
gapspci_fixup_resources(struct pci_dev * dev)31 static void __init gapspci_fixup_resources(struct pci_dev *dev)
32 {
33 struct pci_channel *p = board_pci_channels;
34
35 printk(KERN_NOTICE "PCI: Fixing up device %s\n", pci_name(dev));
36
37 switch (dev->device) {
38 case PCI_DEVICE_ID_SEGA_BBA:
39 /*
40 * We also assume that dev->devfn == 0
41 */
42 dev->resource[1].start = p->io_resource->start + 0x100;
43 dev->resource[1].end = dev->resource[1].start + 0x200 - 1;
44 /*
45 * Redirect dma memory allocations to special memory window.
46 */
47 BUG_ON(!dma_declare_coherent_memory(&dev->dev,
48 GAPSPCI_DMA_BASE,
49 GAPSPCI_DMA_BASE,
50 GAPSPCI_DMA_SIZE,
51 DMA_MEMORY_MAP |
52 DMA_MEMORY_EXCLUSIVE));
53 break;
54 default:
55 printk("PCI: Failed resource fixup\n");
56 }
57 }
58 DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, gapspci_fixup_resources);
59
pcibios_map_platform_irq(struct pci_dev * dev,u8 slot,u8 pin)60 int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin)
61 {
62 /*
63 * The interrupt routing semantics here are quite trivial.
64 *
65 * We basically only support one interrupt, so we only bother
66 * updating a device's interrupt line with this single shared
67 * interrupt. Keeps routing quite simple, doesn't it?
68 */
69 return GAPSPCI_IRQ;
70 }
71