aboutsummaryrefslogtreecommitdiffstats
path: root/bsp/mti-malta32/mti_malta32-fix-the-pci-resource-conflicts.patch
blob: ef47a72f8c3100efc0c4d9288890fcabd2d167f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
From ce7d0fb9680e32c86883a2689b394d57b5f3b7cd Mon Sep 17 00:00:00 2001
From: Jack Tan <jack.tan@windriver.com>
Date: Wed, 10 Mar 2010 15:05:39 +0800
Subject: [PATCH] mti_malta32: fix the pci resource conflicts

commit id 79896cf42f use request_resource() to replace the
insert_resource() in pci_claim_resource(). But this does
not fit the malta pci. With the new request_resource()
kernel allocate a collision io resource for PCI ethernet.
This disturb the PCI io space. One device use 0x1000 - 0x103f
and the PCI ethernet use 0x1020 - 0x103f and this is cause the
ethernet can't be accessed.

This fix supplies a fixup function to fix the ioport collision.

The old kernel log:

pci 0000:00:0a.1: BAR 4: assigned [io  0x1040-0x104f]
pci 0000:00:0a.1: BAR 4: set to [io  0x1040-0x104f] (PCI address [0x1040-0x104f]
pci 0000:00:0a.2: BAR 4: assigned [io  0x1000-0x101f]
pci 0000:00:0a.2: BAR 4: set to [io  0x1000-0x101f] (PCI address [0x1000-0x101f]
pci 0000:00:0a.3: address space collision: [io  0x1000-0x103f] already in use
pci 0000:00:0a.3: quirk: [io  0x1000-0x103f] claimed by PIIX4 ACPI
pci 0000:00:0a.3: address space collision: [io  0x1100-0x110f] already in use
pci 0000:00:0a.3: quirk: [io  0x1100-0x110f] claimed by PIIX4 SMB
pci 0000:00:0a.3: BAR 7: [io  0x1000-0x103f] has bogus alignment
pci 0000:00:0a.3: BAR 8: [io  0x1100-0x110f] has bogus alignment
pci 0000:00:0b.0: BAR 0: assigned [io  0x1020-0x103f]
pci 0000:00:0b.0: BAR 0: set to [io  0x1020-0x103f] (PCI address [0x1020-0x103f]
pci 0000:00:0b.0: BAR 1: assigned [mem 0x10111000-0x1011101f]
pci 0000:00:0b.0: BAR 1: set to [mem 0x10111000-0x1011101f] (PCI address [0x10111000-0x1011101f]
pci 0000:00:0b.0: BAR 6: assigned [mem 0x10000000-0x100fffff pref]
pci 0000:00:0c.0: BAR 0: assigned [mem 0x10110000-0x10110fff]
pci 0000:00:0c.0: BAR 0: set to [mem 0x10110000-0x10110fff] (PCI address [0x10110000-0x10110fff]
pci 0000:00:0c.0: BAR 1: assigned [mem 0x10100000-0x1010ffff]
pci 0000:00:0c.0: BAR 1: set to [mem 0x10100000-0x1010ffff] (PCI address [0x10100000-0x1010ffff]
......
pcnet32.c:v1.35 21.Apr.2008 tsbogend@alpha.franken.de
pcnet32: No access methods
......
......

Signed-off-by: Jack Tan <jack.tan@windriver.com>
---
 arch/mips/pci/fixup-malta.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/arch/mips/pci/fixup-malta.c b/arch/mips/pci/fixup-malta.c
index 0f48498..d4075bb 100644
--- a/arch/mips/pci/fixup-malta.c
+++ b/arch/mips/pci/fixup-malta.c
@@ -101,3 +101,24 @@ static void __init malta_piix_func1_fixup(struct pci_dev *pdev)
 
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB,
 	 malta_piix_func1_fixup);
+
+/* Use the io resource allocated by YAMON */
+static void __init malta_pcnet32_ioports_fixup(struct pci_dev *pdev)
+{
+	u32 check = 0, new = 0x1060;
+
+	pdev->resource[0].start = new;
+	pdev->resource[0].end = new + 0x1f;
+
+	pci_write_config_dword(pdev, 0x10, new);
+	pci_read_config_dword(pdev, 0x10, &check);
+
+	if ((new ^ check) & (u32)PCI_BASE_ADDRESS_IO_MASK)
+		printk(KERN_WARNING "pcnet32's BAR0 error updating (%#08x != %#08x)\n",
+				check, new);
+	else
+		printk(KERN_NOTICE "pcnet32's BAR0 updating is successful!\n");
+}
+
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE,
+	malta_pcnet32_ioports_fixup);
-- 
1.6.5.2