1 // SPDX-License-Identifier: GPL-2.0
3 * arch/sh/drivers/pci/fixups-dreamcast.c
5 * PCI fixups for the Sega Dreamcast
7 * Copyright (C) 2001, 2002 M. R. Brown
8 * Copyright (C) 2002, 2003, 2006 Paul Mundt
10 * This file originally bore the message (with enclosed-$):
11 * Id: pci.c,v 1.3 2003/05/04 19:29:46 lethal Exp
12 * Dreamcast PCI: Supports SEGA Broadband Adaptor only.
15 #include <linux/sched.h>
16 #include <linux/kernel.h>
17 #include <linux/param.h>
18 #include <linux/interrupt.h>
19 #include <linux/init.h>
20 #include <linux/irq.h>
21 #include <linux/pci.h>
22 #include <linux/dma-mapping.h>
28 static void gapspci_fixup_resources(struct pci_dev
*dev
)
30 struct pci_channel
*p
= dev
->sysdata
;
32 struct pci_bus_region region
;
34 printk(KERN_NOTICE
"PCI: Fixing up device %s\n", pci_name(dev
));
36 switch (dev
->device
) {
37 case PCI_DEVICE_ID_SEGA_BBA
:
39 * We also assume that dev->devfn == 0
41 dev
->resource
[1].start
= p
->resources
[0].start
+ 0x100;
42 dev
->resource
[1].end
= dev
->resource
[1].start
+ 0x200 - 1;
45 * This is not a normal BAR, prevent any attempts to move
46 * the BAR, as this will result in a bus lock.
48 dev
->resource
[1].flags
|= IORESOURCE_PCI_FIXED
;
51 * Redirect dma memory allocations to special memory window.
53 * If this GAPSPCI region were mapped by a BAR, the CPU
54 * phys_addr_t would be pci_resource_start(), and the bus
55 * address would be pci_bus_address(pci_resource_start()).
56 * But apparently there's no BAR mapping it, so we just
57 * "know" its CPU address is GAPSPCI_DMA_BASE.
59 res
.start
= GAPSPCI_DMA_BASE
;
60 res
.end
= GAPSPCI_DMA_BASE
+ GAPSPCI_DMA_SIZE
- 1;
61 res
.flags
= IORESOURCE_MEM
;
62 pcibios_resource_to_bus(dev
->bus
, ®ion
, &res
);
63 BUG_ON(dma_declare_coherent_memory(&dev
->dev
,
66 resource_size(&res
)));
69 printk("PCI: Failed resource fixup\n");
72 DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID
, PCI_ANY_ID
, gapspci_fixup_resources
);
74 int pcibios_map_platform_irq(const struct pci_dev
*dev
, u8 slot
, u8 pin
)
77 * The interrupt routing semantics here are quite trivial.
79 * We basically only support one interrupt, so we only bother
80 * updating a device's interrupt line with this single shared
81 * interrupt. Keeps routing quite simple, doesn't it?