aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/pci
diff options
context:
space:
mode:
authorDeng-Cheng Zhu <dengcheng.zhu@imgtec.com>2013-10-07 12:45:04 -0400
committerRalf Baechle <ralf@linux-mips.org>2013-10-29 16:25:28 -0400
commit70002f76db5f8ed4ab72f539fc600510e2a98022 (patch)
tree2847d99eeec2e4be97fd1e70edcc385c25faad10 /arch/mips/pci
parentf7886e87546cc68844e8edb66150aaaeacaf7204 (diff)
MIPS: Get rid of hard-coded values for Malta PIIX4 fixups
Make the code more readable by using defines. Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com> Cc: Steven J. Hill <Steven.Hill@imgtec.com> Reviewed-by: James Hogan <james.hogan@imgtec.com> Reviewed-by: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/6031/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/pci')
-rw-r--r--arch/mips/pci/fixup-malta.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/arch/mips/pci/fixup-malta.c b/arch/mips/pci/fixup-malta.c
index 07ada7f8441e..df36e2327c54 100644
--- a/arch/mips/pci/fixup-malta.c
+++ b/arch/mips/pci/fixup-malta.c
@@ -1,5 +1,6 @@
1#include <linux/init.h> 1#include <linux/init.h>
2#include <linux/pci.h> 2#include <linux/pci.h>
3#include <asm/mips-boards/piix4.h>
3 4
4/* PCI interrupt pins */ 5/* PCI interrupt pins */
5#define PCIA 1 6#define PCIA 1
@@ -53,7 +54,8 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
53static void malta_piix_func0_fixup(struct pci_dev *pdev) 54static void malta_piix_func0_fixup(struct pci_dev *pdev)
54{ 55{
55 unsigned char reg_val; 56 unsigned char reg_val;
56 static int piixirqmap[16] = { /* PIIX PIRQC[A:D] irq mappings */ 57 /* PIIX PIRQC[A:D] irq mappings */
58 static int piixirqmap[PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_MAX] = {
57 0, 0, 0, 3, 59 0, 0, 0, 3,
58 4, 5, 6, 7, 60 4, 5, 6, 7,
59 0, 9, 10, 11, 61 0, 9, 10, 11,
@@ -63,11 +65,12 @@ static void malta_piix_func0_fixup(struct pci_dev *pdev)
63 65
64 /* Interrogate PIIX4 to get PCI IRQ mapping */ 66 /* Interrogate PIIX4 to get PCI IRQ mapping */
65 for (i = 0; i <= 3; i++) { 67 for (i = 0; i <= 3; i++) {
66 pci_read_config_byte(pdev, 0x60+i, &reg_val); 68 pci_read_config_byte(pdev, PIIX4_FUNC0_PIRQRC+i, &reg_val);
67 if (reg_val & 0x80) 69 if (reg_val & PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_DISABLE)
68 pci_irq[PCIA+i] = 0; /* Disabled */ 70 pci_irq[PCIA+i] = 0; /* Disabled */
69 else 71 else
70 pci_irq[PCIA+i] = piixirqmap[reg_val & 15]; 72 pci_irq[PCIA+i] = piixirqmap[reg_val &
73 PIIX4_FUNC0_PIRQRC_IRQ_ROUTING_MASK];
71 } 74 }
72 75
73 /* Done by YAMON 2.00 onwards */ 76 /* Done by YAMON 2.00 onwards */
@@ -76,8 +79,9 @@ static void malta_piix_func0_fixup(struct pci_dev *pdev)
76 * Set top of main memory accessible by ISA or DMA 79 * Set top of main memory accessible by ISA or DMA
77 * devices to 16 Mb. 80 * devices to 16 Mb.
78 */ 81 */
79 pci_read_config_byte(pdev, 0x69, &reg_val); 82 pci_read_config_byte(pdev, PIIX4_FUNC0_TOM, &reg_val);
80 pci_write_config_byte(pdev, 0x69, reg_val | 0xf0); 83 pci_write_config_byte(pdev, PIIX4_FUNC0_TOM, reg_val |
84 PIIX4_FUNC0_TOM_TOP_OF_MEMORY_MASK);
81 } 85 }
82} 86}
83 87
@@ -93,10 +97,14 @@ static void malta_piix_func1_fixup(struct pci_dev *pdev)
93 /* 97 /*
94 * IDE Decode enable. 98 * IDE Decode enable.
95 */ 99 */
96 pci_read_config_byte(pdev, 0x41, &reg_val); 100 pci_read_config_byte(pdev, PIIX4_FUNC1_IDETIM_PRIMARY_HI,
97 pci_write_config_byte(pdev, 0x41, reg_val|0x80); 101 &reg_val);
98 pci_read_config_byte(pdev, 0x43, &reg_val); 102 pci_write_config_byte(pdev, PIIX4_FUNC1_IDETIM_PRIMARY_HI,
99 pci_write_config_byte(pdev, 0x43, reg_val|0x80); 103 reg_val|PIIX4_FUNC1_IDETIM_PRIMARY_HI_IDE_DECODE_EN);
104 pci_read_config_byte(pdev, PIIX4_FUNC1_IDETIM_SECONDARY_HI,
105 &reg_val);
106 pci_write_config_byte(pdev, PIIX4_FUNC1_IDETIM_SECONDARY_HI,
107 reg_val|PIIX4_FUNC1_IDETIM_SECONDARY_HI_IDE_DECODE_EN);
100 } 108 }
101} 109}
102 110
@@ -108,10 +116,12 @@ static void quirk_dlcsetup(struct pci_dev *dev)
108{ 116{
109 u8 odlc, ndlc; 117 u8 odlc, ndlc;
110 118
111 (void) pci_read_config_byte(dev, 0x82, &odlc); 119 (void) pci_read_config_byte(dev, PIIX4_FUNC0_DLC, &odlc);
112 /* Enable passive releases and delayed transaction */ 120 /* Enable passive releases and delayed transaction */
113 ndlc = odlc | 7; 121 ndlc = odlc | PIIX4_FUNC0_DLC_USBPR_EN |
114 (void) pci_write_config_byte(dev, 0x82, ndlc); 122 PIIX4_FUNC0_DLC_PASSIVE_RELEASE_EN |
123 PIIX4_FUNC0_DLC_DELAYED_TRANSACTION_EN;
124 (void) pci_write_config_byte(dev, PIIX4_FUNC0_DLC, ndlc);
115} 125}
116 126
117DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0, 127DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0,