| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
| Uwe Zeisberger | f30c226 | 2006-10-03 23:01:26 +0200 | [diff] [blame] | 2 | * arch/sh/drivers/pci/fixups-dreamcast.c | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * | 
|  | 4 | * PCI fixups for the Sega Dreamcast | 
|  | 5 | * | 
|  | 6 | * Copyright (C) 2001, 2002  M. R. Brown | 
| Paul Mundt | 959f85f | 2006-09-27 16:43:28 +0900 | [diff] [blame] | 7 | * Copyright (C) 2002, 2003, 2006  Paul Mundt | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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> | 
| Magnus Damm | a724605 | 2008-01-24 18:40:50 +0900 | [diff] [blame] | 25 | #include <linux/dma-mapping.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 |  | 
|  | 27 | #include <asm/io.h> | 
|  | 28 | #include <asm/irq.h> | 
| Paul Mundt | f15cbe6 | 2008-07-29 08:09:44 +0900 | [diff] [blame] | 29 | #include <mach/pci.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 |  | 
|  | 31 | static void __init gapspci_fixup_resources(struct pci_dev *dev) | 
|  | 32 | { | 
| Paul Mundt | 951a681 | 2009-04-20 21:34:36 +0900 | [diff] [blame] | 33 | struct pci_channel *p = dev->sysdata; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | */ | 
| Paul Mundt | b6c58b1 | 2010-02-01 20:01:50 +0900 | [diff] [blame] | 42 | dev->resource[1].start	= p->resources[0].start  + 0x100; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | dev->resource[1].end	= dev->resource[1].start + 0x200 - 1; | 
| Paul Mundt | d556fcc | 2009-04-20 19:31:20 +0900 | [diff] [blame] | 44 |  | 
|  | 45 | /* | 
|  | 46 | * This is not a normal BAR, prevent any attempts to move | 
|  | 47 | * the BAR, as this will result in a bus lock. | 
|  | 48 | */ | 
|  | 49 | dev->resource[1].flags |= IORESOURCE_PCI_FIXED; | 
|  | 50 |  | 
| Magnus Damm | a724605 | 2008-01-24 18:40:50 +0900 | [diff] [blame] | 51 | /* | 
|  | 52 | * Redirect dma memory allocations to special memory window. | 
|  | 53 | */ | 
|  | 54 | BUG_ON(!dma_declare_coherent_memory(&dev->dev, | 
|  | 55 | GAPSPCI_DMA_BASE, | 
|  | 56 | GAPSPCI_DMA_BASE, | 
|  | 57 | GAPSPCI_DMA_SIZE, | 
|  | 58 | DMA_MEMORY_MAP | | 
|  | 59 | DMA_MEMORY_EXCLUSIVE)); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | break; | 
|  | 61 | default: | 
|  | 62 | printk("PCI: Failed resource fixup\n"); | 
|  | 63 | } | 
|  | 64 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, gapspci_fixup_resources); | 
|  | 66 |  | 
| Ralf Baechle | d534194 | 2011-06-10 15:30:21 +0100 | [diff] [blame] | 67 | int __init pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | { | 
| Paul Mundt | 959f85f | 2006-09-27 16:43:28 +0900 | [diff] [blame] | 69 | /* | 
|  | 70 | * The interrupt routing semantics here are quite trivial. | 
|  | 71 | * | 
|  | 72 | * We basically only support one interrupt, so we only bother | 
|  | 73 | * updating a device's interrupt line with this single shared | 
|  | 74 | * interrupt. Keeps routing quite simple, doesn't it? | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | */ | 
| Paul Mundt | 959f85f | 2006-09-27 16:43:28 +0900 | [diff] [blame] | 76 | return GAPSPCI_IRQ; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | } |