[lantiq] cleanup patches
[openwrt/svn-archive/archive.git] / target / linux / lantiq / files / arch / mips / pci / fixup-lantiq-pcie.c
1 /******************************************************************************
2 **
3 ** FILE NAME : ifxmips_fixup_pcie.c
4 ** PROJECT : IFX UEIP for VRX200
5 ** MODULES : PCIe
6 **
7 ** DATE : 02 Mar 2009
8 ** AUTHOR : Lei Chuanhua
9 ** DESCRIPTION : PCIe Root Complex Driver
10 ** COPYRIGHT : Copyright (c) 2009
11 ** Infineon Technologies AG
12 ** Am Campeon 1-12, 85579 Neubiberg, Germany
13 **
14 ** This program is free software; you can redistribute it and/or modify
15 ** it under the terms of the GNU General Public License as published by
16 ** the Free Software Foundation; either version 2 of the License, or
17 ** (at your option) any later version.
18 ** HISTORY
19 ** $Version $Date $Author $Comment
20 ** 0.0.1 17 Mar,2009 Lei Chuanhua Initial version
21 *******************************************************************************/
22 /*!
23 \file ifxmips_fixup_pcie.c
24 \ingroup IFX_PCIE
25 \brief PCIe Fixup functions source file
26 */
27 #include <linux/pci.h>
28 #include <linux/pci_regs.h>
29 #include <linux/pci_ids.h>
30
31 #include <lantiq_soc.h>
32
33 #include "pcie-lantiq.h"
34
35 #define PCI_VENDOR_ID_INFINEON 0x15D1
36 #define PCI_DEVICE_ID_INFINEON_DANUBE 0x000F
37 #define PCI_DEVICE_ID_INFINEON_PCIE 0x0011
38 #define PCI_VENDOR_ID_LANTIQ 0x1BEF
39 #define PCI_DEVICE_ID_LANTIQ_PCIE 0x0011
40
41
42
43 static void __devinit
44 ifx_pcie_fixup_resource(struct pci_dev *dev)
45 {
46 u32 reg;
47
48 IFX_PCIE_PRINT(PCIE_MSG_FIXUP, "%s dev %s: enter\n", __func__, pci_name(dev));
49
50 IFX_PCIE_PRINT(PCIE_MSG_FIXUP, "%s: fixup host controller %s (%04x:%04x)\n",
51 __func__, pci_name(dev), dev->vendor, dev->device);
52
53 /* Setup COMMAND register */
54 reg = PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER /* |
55 PCI_COMMAND_INTX_DISABLE */| PCI_COMMAND_SERR;
56 pci_write_config_word(dev, PCI_COMMAND, reg);
57 IFX_PCIE_PRINT(PCIE_MSG_FIXUP, "%s dev %s: exit\n", __func__, pci_name(dev));
58 }
59 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INFINEON, PCI_DEVICE_ID_INFINEON_PCIE, ifx_pcie_fixup_resource);
60 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LANTIQ, PCI_VENDOR_ID_LANTIQ, ifx_pcie_fixup_resource);
61
62 static void __devinit
63 ifx_pcie_rc_class_early_fixup(struct pci_dev *dev)
64 {
65 IFX_PCIE_PRINT(PCIE_MSG_FIXUP, "%s dev %s: enter\n", __func__, pci_name(dev));
66
67 if (dev->devfn == PCI_DEVFN(0, 0) &&
68 (dev->class >> 8) == PCI_CLASS_BRIDGE_HOST) {
69
70 dev->class = (PCI_CLASS_BRIDGE_PCI << 8) | (dev->class & 0xff);
71
72 printk(KERN_INFO "%s: fixed pcie host bridge to pci-pci bridge\n", __func__);
73 }
74 IFX_PCIE_PRINT(PCIE_MSG_FIXUP, "%s dev %s: exit\n", __func__, pci_name(dev));
75 }
76
77 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INFINEON, PCI_DEVICE_ID_INFINEON_PCIE,
78 ifx_pcie_rc_class_early_fixup);
79
80 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LANTIQ, PCI_DEVICE_ID_LANTIQ_PCIE,
81 ifx_pcie_rc_class_early_fixup);