1/* 2 * Copyright (C) 2001 Dave Engebretsen, IBM Corporation 3 * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM 4 * 5 * pSeries specific routines for PCI. 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 */ 21 22#include <linux/init.h> 23#include <linux/ioport.h> 24#include <linux/kernel.h> 25#include <linux/pci.h> 26#include <linux/string.h> 27 28#include <asm/eeh.h> 29#include <asm/pci-bridge.h> 30#include <asm/prom.h> 31#include <asm/ppc-pci.h> 32 33 34static void __init pSeries_request_regions(void) 35{ 36 if (!isa_io_base) 37 return; 38 39 request_region(0x20,0x20,"pic1"); 40 request_region(0xa0,0x20,"pic2"); 41 request_region(0x00,0x20,"dma1"); 42 request_region(0x40,0x20,"timer"); 43 request_region(0x80,0x10,"dma page reg"); 44 request_region(0xc0,0x20,"dma2"); 45} 46 47void __init pSeries_final_fixup(void) 48{ 49 pSeries_request_regions(); 50 51 pci_addr_cache_build(); 52} 53 54/* 55 * Assume the winbond 82c105 is the IDE controller on a 56 * p610/p615/p630. We should probably be more careful in case 57 * someone tries to plug in a similar adapter. 58 */ 59static void fixup_winbond_82c105(struct pci_dev* dev) 60{ 61 int i; 62 unsigned int reg; 63 64 if (!machine_is(pseries)) 65 return; 66 67 printk("Using INTC for W82c105 IDE controller.\n"); 68 pci_read_config_dword(dev, 0x40, ®); 69 /* Enable LEGIRQ to use INTC instead of ISA interrupts */ 70 pci_write_config_dword(dev, 0x40, reg | (1<<11)); 71 72 for (i = 0; i < DEVICE_COUNT_RESOURCE; ++i) { 73 /* zap the 2nd function of the winbond chip */ 74 if (dev->resource[i].flags & IORESOURCE_IO 75 && dev->bus->number == 0 && dev->devfn == 0x81) 76 dev->resource[i].flags &= ~IORESOURCE_IO; 77 if (dev->resource[i].start == 0 && dev->resource[i].end) { 78 dev->resource[i].flags = 0; 79 dev->resource[i].end = 0; 80 } 81 } 82} 83DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105, 84 fixup_winbond_82c105); 85