18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright 2001 MontaVista Software Inc. 38c2ecf20Sopenharmony_ci * Author: MontaVista Software, Inc. 48c2ecf20Sopenharmony_ci * stevel@mvista.com or source@mvista.com 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it 78c2ecf20Sopenharmony_ci * under the terms of the GNU General Public License as published by the 88c2ecf20Sopenharmony_ci * Free Software Foundation; either version 2 of the License, or (at your 98c2ecf20Sopenharmony_ci * option) any later version. 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 128c2ecf20Sopenharmony_ci * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 138c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 148c2ecf20Sopenharmony_ci * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 158c2ecf20Sopenharmony_ci * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 168c2ecf20Sopenharmony_ci * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 178c2ecf20Sopenharmony_ci * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 188c2ecf20Sopenharmony_ci * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 198c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 208c2ecf20Sopenharmony_ci * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License along 238c2ecf20Sopenharmony_ci * with this program; if not, write to the Free Software Foundation, Inc., 248c2ecf20Sopenharmony_ci * 675 Mass Ave, Cambridge, MA 02139, USA. 258c2ecf20Sopenharmony_ci */ 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#include <linux/types.h> 288c2ecf20Sopenharmony_ci#include <linux/pci.h> 298c2ecf20Sopenharmony_ci#include <linux/kernel.h> 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#include <asm/mach-rc32434/rc32434.h> 328c2ecf20Sopenharmony_ci#include <asm/mach-rc32434/irq.h> 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_cistatic int irq_map[2][12] = { 358c2ecf20Sopenharmony_ci {0, 0, 2, 3, 2, 3, 0, 0, 0, 0, 0, 1}, 368c2ecf20Sopenharmony_ci {0, 0, 1, 3, 0, 2, 1, 3, 0, 2, 1, 3} 378c2ecf20Sopenharmony_ci}; 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ciint pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 408c2ecf20Sopenharmony_ci{ 418c2ecf20Sopenharmony_ci int irq = 0; 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci if (dev->bus->number < 2 && PCI_SLOT(dev->devfn) < 12) 448c2ecf20Sopenharmony_ci irq = irq_map[dev->bus->number][PCI_SLOT(dev->devfn)]; 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci return irq + GROUP4_IRQ_BASE + 4; 478c2ecf20Sopenharmony_ci} 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_cistatic void rc32434_pci_early_fixup(struct pci_dev *dev) 508c2ecf20Sopenharmony_ci{ 518c2ecf20Sopenharmony_ci if (PCI_SLOT(dev->devfn) == 6 && dev->bus->number == 0) { 528c2ecf20Sopenharmony_ci /* disable prefetched memory range */ 538c2ecf20Sopenharmony_ci pci_write_config_word(dev, PCI_PREF_MEMORY_LIMIT, 0); 548c2ecf20Sopenharmony_ci pci_write_config_word(dev, PCI_PREF_MEMORY_BASE, 0x10); 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 4); 578c2ecf20Sopenharmony_ci } 588c2ecf20Sopenharmony_ci} 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci/* 618c2ecf20Sopenharmony_ci * The fixup applies to both the IDT and VIA devices present on the board 628c2ecf20Sopenharmony_ci */ 638c2ecf20Sopenharmony_ciDECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, rc32434_pci_early_fixup); 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci/* Do platform specific device initialization at pci_enable_device() time */ 668c2ecf20Sopenharmony_ciint pcibios_plat_dev_init(struct pci_dev *dev) 678c2ecf20Sopenharmony_ci{ 688c2ecf20Sopenharmony_ci return 0; 698c2ecf20Sopenharmony_ci} 70