Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2001 MontaVista Software Inc.
0003  * Author: MontaVista Software, Inc.
0004  *          stevel@mvista.com or source@mvista.com
0005  *
0006  *  This program is free software; you can redistribute  it and/or modify it
0007  *  under  the terms of  the GNU General  Public License as published by the
0008  *  Free Software Foundation;  either version 2 of the  License, or (at your
0009  *  option) any later version.
0010  *
0011  *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
0012  *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
0013  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
0014  *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
0015  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
0016  *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
0017  *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
0018  *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
0019  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
0020  *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0021  *
0022  *  You should have received a copy of the  GNU General Public License along
0023  *  with this program; if not, write  to the Free Software Foundation, Inc.,
0024  *  675 Mass Ave, Cambridge, MA 02139, USA.
0025  */
0026 
0027 #include <linux/types.h>
0028 #include <linux/pci.h>
0029 #include <linux/kernel.h>
0030 
0031 #include <asm/mach-rc32434/rc32434.h>
0032 #include <asm/mach-rc32434/irq.h>
0033 
0034 static int irq_map[2][12] = {
0035     {0, 0, 2, 3, 2, 3, 0, 0, 0, 0, 0, 1},
0036     {0, 0, 1, 3, 0, 2, 1, 3, 0, 2, 1, 3}
0037 };
0038 
0039 int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
0040 {
0041     int irq = 0;
0042 
0043     if (dev->bus->number < 2 && PCI_SLOT(dev->devfn) < 12)
0044         irq = irq_map[dev->bus->number][PCI_SLOT(dev->devfn)];
0045 
0046     return irq + GROUP4_IRQ_BASE + 4;
0047 }
0048 
0049 static void rc32434_pci_early_fixup(struct pci_dev *dev)
0050 {
0051     if (PCI_SLOT(dev->devfn) == 6 && dev->bus->number == 0) {
0052         /* disable prefetched memory range */
0053         pci_write_config_word(dev, PCI_PREF_MEMORY_LIMIT, 0);
0054         pci_write_config_word(dev, PCI_PREF_MEMORY_BASE, 0x10);
0055 
0056         pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 4);
0057     }
0058 }
0059 
0060 /*
0061  * The fixup applies to both the IDT and VIA devices present on the board
0062  */
0063 DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, rc32434_pci_early_fixup);
0064 
0065 /* Do platform specific device initialization at pci_enable_device() time */
0066 int pcibios_plat_dev_init(struct pci_dev *dev)
0067 {
0068     return 0;
0069 }