diff options
Diffstat (limited to 'arch/arm/mach-integrator/pci_v3.c')
-rw-r--r-- | arch/arm/mach-integrator/pci_v3.c | 62 |
1 files changed, 29 insertions, 33 deletions
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c index b866880e82ac..bbeca59df66b 100644 --- a/arch/arm/mach-integrator/pci_v3.c +++ b/arch/arm/mach-integrator/pci_v3.c | |||
@@ -41,61 +41,61 @@ | |||
41 | /* | 41 | /* |
42 | * The V3 PCI interface chip in Integrator provides several windows from | 42 | * The V3 PCI interface chip in Integrator provides several windows from |
43 | * local bus memory into the PCI memory areas. Unfortunately, there | 43 | * local bus memory into the PCI memory areas. Unfortunately, there |
44 | * are not really enough windows for our usage, therefore we reuse | 44 | * are not really enough windows for our usage, therefore we reuse |
45 | * one of the windows for access to PCI configuration space. The | 45 | * one of the windows for access to PCI configuration space. The |
46 | * memory map is as follows: | 46 | * memory map is as follows: |
47 | * | 47 | * |
48 | * Local Bus Memory Usage | 48 | * Local Bus Memory Usage |
49 | * | 49 | * |
50 | * 40000000 - 4FFFFFFF PCI memory. 256M non-prefetchable | 50 | * 40000000 - 4FFFFFFF PCI memory. 256M non-prefetchable |
51 | * 50000000 - 5FFFFFFF PCI memory. 256M prefetchable | 51 | * 50000000 - 5FFFFFFF PCI memory. 256M prefetchable |
52 | * 60000000 - 60FFFFFF PCI IO. 16M | 52 | * 60000000 - 60FFFFFF PCI IO. 16M |
53 | * 61000000 - 61FFFFFF PCI Configuration. 16M | 53 | * 61000000 - 61FFFFFF PCI Configuration. 16M |
54 | * | 54 | * |
55 | * There are three V3 windows, each described by a pair of V3 registers. | 55 | * There are three V3 windows, each described by a pair of V3 registers. |
56 | * These are LB_BASE0/LB_MAP0, LB_BASE1/LB_MAP1 and LB_BASE2/LB_MAP2. | 56 | * These are LB_BASE0/LB_MAP0, LB_BASE1/LB_MAP1 and LB_BASE2/LB_MAP2. |
57 | * Base0 and Base1 can be used for any type of PCI memory access. Base2 | 57 | * Base0 and Base1 can be used for any type of PCI memory access. Base2 |
58 | * can be used either for PCI I/O or for I20 accesses. By default, uHAL | 58 | * can be used either for PCI I/O or for I20 accesses. By default, uHAL |
59 | * uses this only for PCI IO space. | 59 | * uses this only for PCI IO space. |
60 | * | 60 | * |
61 | * Normally these spaces are mapped using the following base registers: | 61 | * Normally these spaces are mapped using the following base registers: |
62 | * | 62 | * |
63 | * Usage Local Bus Memory Base/Map registers used | 63 | * Usage Local Bus Memory Base/Map registers used |
64 | * | 64 | * |
65 | * Mem 40000000 - 4FFFFFFF LB_BASE0/LB_MAP0 | 65 | * Mem 40000000 - 4FFFFFFF LB_BASE0/LB_MAP0 |
66 | * Mem 50000000 - 5FFFFFFF LB_BASE1/LB_MAP1 | 66 | * Mem 50000000 - 5FFFFFFF LB_BASE1/LB_MAP1 |
67 | * IO 60000000 - 60FFFFFF LB_BASE2/LB_MAP2 | 67 | * IO 60000000 - 60FFFFFF LB_BASE2/LB_MAP2 |
68 | * Cfg 61000000 - 61FFFFFF | 68 | * Cfg 61000000 - 61FFFFFF |
69 | * | 69 | * |
70 | * This means that I20 and PCI configuration space accesses will fail. | 70 | * This means that I20 and PCI configuration space accesses will fail. |
71 | * When PCI configuration accesses are needed (via the uHAL PCI | 71 | * When PCI configuration accesses are needed (via the uHAL PCI |
72 | * configuration space primitives) we must remap the spaces as follows: | 72 | * configuration space primitives) we must remap the spaces as follows: |
73 | * | 73 | * |
74 | * Usage Local Bus Memory Base/Map registers used | 74 | * Usage Local Bus Memory Base/Map registers used |
75 | * | 75 | * |
76 | * Mem 40000000 - 4FFFFFFF LB_BASE0/LB_MAP0 | 76 | * Mem 40000000 - 4FFFFFFF LB_BASE0/LB_MAP0 |
77 | * Mem 50000000 - 5FFFFFFF LB_BASE0/LB_MAP0 | 77 | * Mem 50000000 - 5FFFFFFF LB_BASE0/LB_MAP0 |
78 | * IO 60000000 - 60FFFFFF LB_BASE2/LB_MAP2 | 78 | * IO 60000000 - 60FFFFFF LB_BASE2/LB_MAP2 |
79 | * Cfg 61000000 - 61FFFFFF LB_BASE1/LB_MAP1 | 79 | * Cfg 61000000 - 61FFFFFF LB_BASE1/LB_MAP1 |
80 | * | 80 | * |
81 | * To make this work, the code depends on overlapping windows working. | 81 | * To make this work, the code depends on overlapping windows working. |
82 | * The V3 chip translates an address by checking its range within | 82 | * The V3 chip translates an address by checking its range within |
83 | * each of the BASE/MAP pairs in turn (in ascending register number | 83 | * each of the BASE/MAP pairs in turn (in ascending register number |
84 | * order). It will use the first matching pair. So, for example, | 84 | * order). It will use the first matching pair. So, for example, |
85 | * if the same address is mapped by both LB_BASE0/LB_MAP0 and | 85 | * if the same address is mapped by both LB_BASE0/LB_MAP0 and |
86 | * LB_BASE1/LB_MAP1, the V3 will use the translation from | 86 | * LB_BASE1/LB_MAP1, the V3 will use the translation from |
87 | * LB_BASE0/LB_MAP0. | 87 | * LB_BASE0/LB_MAP0. |
88 | * | 88 | * |
89 | * To allow PCI Configuration space access, the code enlarges the | 89 | * To allow PCI Configuration space access, the code enlarges the |
90 | * window mapped by LB_BASE0/LB_MAP0 from 256M to 512M. This occludes | 90 | * window mapped by LB_BASE0/LB_MAP0 from 256M to 512M. This occludes |
91 | * the windows currently mapped by LB_BASE1/LB_MAP1 so that it can | 91 | * the windows currently mapped by LB_BASE1/LB_MAP1 so that it can |
92 | * be remapped for use by configuration cycles. | 92 | * be remapped for use by configuration cycles. |
93 | * | 93 | * |
94 | * At the end of the PCI Configuration space accesses, | 94 | * At the end of the PCI Configuration space accesses, |
95 | * LB_BASE1/LB_MAP1 is reset to map PCI Memory. Finally the window | 95 | * LB_BASE1/LB_MAP1 is reset to map PCI Memory. Finally the window |
96 | * mapped by LB_BASE0/LB_MAP0 is reduced in size from 512M to 256M to | 96 | * mapped by LB_BASE0/LB_MAP0 is reduced in size from 512M to 256M to |
97 | * reveal the now restored LB_BASE1/LB_MAP1 window. | 97 | * reveal the now restored LB_BASE1/LB_MAP1 window. |
98 | * | 98 | * |
99 | * NOTE: We do not set up I2O mapping. I suspect that this is only | 99 | * NOTE: We do not set up I2O mapping. I suspect that this is only |
100 | * for an intelligent (target) device. Using I2O disables most of | 100 | * for an intelligent (target) device. Using I2O disables most of |
101 | * the mappings into PCI memory. | 101 | * the mappings into PCI memory. |
@@ -127,8 +127,8 @@ | |||
127 | * | 127 | * |
128 | * returns: configuration address to play on the PCI bus | 128 | * returns: configuration address to play on the PCI bus |
129 | * | 129 | * |
130 | * To generate the appropriate PCI configuration cycles in the PCI | 130 | * To generate the appropriate PCI configuration cycles in the PCI |
131 | * configuration address space, you present the V3 with the following pattern | 131 | * configuration address space, you present the V3 with the following pattern |
132 | * (which is very nearly a type 1 (except that the lower two bits are 00 and | 132 | * (which is very nearly a type 1 (except that the lower two bits are 00 and |
133 | * not 01). In order for this mapping to work you need to set up one of | 133 | * not 01). In order for this mapping to work you need to set up one of |
134 | * the local to PCI aperatures to 16Mbytes in length translating to | 134 | * the local to PCI aperatures to 16Mbytes in length translating to |
@@ -138,7 +138,7 @@ | |||
138 | * | 138 | * |
139 | * Type 0: | 139 | * Type 0: |
140 | * | 140 | * |
141 | * 3 3|3 3 2 2|2 2 2 2|2 2 2 2|1 1 1 1|1 1 1 1|1 1 | 141 | * 3 3|3 3 2 2|2 2 2 2|2 2 2 2|1 1 1 1|1 1 1 1|1 1 |
142 | * 3 2|1 0 9 8|7 6 5 4|3 2 1 0|9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0 | 142 | * 3 2|1 0 9 8|7 6 5 4|3 2 1 0|9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0 |
143 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 143 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
144 | * | | |D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|F|F|F|R|R|R|R|R|R|0|0| | 144 | * | | |D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|D|F|F|F|R|R|R|R|R|R|0|0| |
@@ -150,7 +150,7 @@ | |||
150 | * | 150 | * |
151 | * Type 1: | 151 | * Type 1: |
152 | * | 152 | * |
153 | * 3 3|3 3 2 2|2 2 2 2|2 2 2 2|1 1 1 1|1 1 1 1|1 1 | 153 | * 3 3|3 3 2 2|2 2 2 2|2 2 2 2|1 1 1 1|1 1 1 1|1 1 |
154 | * 3 2|1 0 9 8|7 6 5 4|3 2 1 0|9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0 | 154 | * 3 2|1 0 9 8|7 6 5 4|3 2 1 0|9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0 |
155 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 155 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
156 | * | | | | | | | | | | |B|B|B|B|B|B|B|B|D|D|D|D|D|F|F|F|R|R|R|R|R|R|0|1| | 156 | * | | | | | | | | | | |B|B|B|B|B|B|B|B|D|D|D|D|D|F|F|F|R|R|R|R|R|R|0|1| |
@@ -161,7 +161,7 @@ | |||
161 | * 15:11 Device number (5 bits) | 161 | * 15:11 Device number (5 bits) |
162 | * 10:8 function number | 162 | * 10:8 function number |
163 | * 7:2 register number | 163 | * 7:2 register number |
164 | * | 164 | * |
165 | */ | 165 | */ |
166 | static DEFINE_RAW_SPINLOCK(v3_lock); | 166 | static DEFINE_RAW_SPINLOCK(v3_lock); |
167 | 167 | ||
@@ -181,7 +181,7 @@ static DEFINE_RAW_SPINLOCK(v3_lock); | |||
181 | #undef V3_LB_BASE_PREFETCH | 181 | #undef V3_LB_BASE_PREFETCH |
182 | #define V3_LB_BASE_PREFETCH 0 | 182 | #define V3_LB_BASE_PREFETCH 0 |
183 | 183 | ||
184 | static unsigned long v3_open_config_window(struct pci_bus *bus, | 184 | static void __iomem *v3_open_config_window(struct pci_bus *bus, |
185 | unsigned int devfn, int offset) | 185 | unsigned int devfn, int offset) |
186 | { | 186 | { |
187 | unsigned int address, mapaddress, busnr; | 187 | unsigned int address, mapaddress, busnr; |
@@ -280,7 +280,7 @@ static void v3_close_config_window(void) | |||
280 | static int v3_read_config(struct pci_bus *bus, unsigned int devfn, int where, | 280 | static int v3_read_config(struct pci_bus *bus, unsigned int devfn, int where, |
281 | int size, u32 *val) | 281 | int size, u32 *val) |
282 | { | 282 | { |
283 | unsigned long addr; | 283 | void __iomem *addr; |
284 | unsigned long flags; | 284 | unsigned long flags; |
285 | u32 v; | 285 | u32 v; |
286 | 286 | ||
@@ -311,7 +311,7 @@ static int v3_read_config(struct pci_bus *bus, unsigned int devfn, int where, | |||
311 | static int v3_write_config(struct pci_bus *bus, unsigned int devfn, int where, | 311 | static int v3_write_config(struct pci_bus *bus, unsigned int devfn, int where, |
312 | int size, u32 val) | 312 | int size, u32 val) |
313 | { | 313 | { |
314 | unsigned long addr; | 314 | void __iomem *addr; |
315 | unsigned long flags; | 315 | unsigned long flags; |
316 | 316 | ||
317 | raw_spin_lock_irqsave(&v3_lock, flags); | 317 | raw_spin_lock_irqsave(&v3_lock, flags); |
@@ -374,12 +374,9 @@ static int __init pci_v3_setup_resources(struct pci_sys_data *sys) | |||
374 | } | 374 | } |
375 | 375 | ||
376 | /* | 376 | /* |
377 | * the IO resource for this bus | ||
378 | * the mem resource for this bus | 377 | * the mem resource for this bus |
379 | * the prefetch mem resource for this bus | 378 | * the prefetch mem resource for this bus |
380 | */ | 379 | */ |
381 | pci_add_resource_offset(&sys->resources, | ||
382 | &ioport_resource, sys->io_offset); | ||
383 | pci_add_resource_offset(&sys->resources, &non_mem, sys->mem_offset); | 380 | pci_add_resource_offset(&sys->resources, &non_mem, sys->mem_offset); |
384 | pci_add_resource_offset(&sys->resources, &pre_mem, sys->mem_offset); | 381 | pci_add_resource_offset(&sys->resources, &pre_mem, sys->mem_offset); |
385 | 382 | ||
@@ -391,9 +388,9 @@ static int __init pci_v3_setup_resources(struct pci_sys_data *sys) | |||
391 | * means I can't get additional information on the reason for the pm2fb | 388 | * means I can't get additional information on the reason for the pm2fb |
392 | * problems. I suppose I'll just have to mind-meld with the machine. ;) | 389 | * problems. I suppose I'll just have to mind-meld with the machine. ;) |
393 | */ | 390 | */ |
394 | #define SC_PCI IO_ADDRESS(INTEGRATOR_SC_PCIENABLE) | 391 | #define SC_PCI __io_address(INTEGRATOR_SC_PCIENABLE) |
395 | #define SC_LBFADDR IO_ADDRESS(INTEGRATOR_SC_BASE + 0x20) | 392 | #define SC_LBFADDR __io_address(INTEGRATOR_SC_BASE + 0x20) |
396 | #define SC_LBFCODE IO_ADDRESS(INTEGRATOR_SC_BASE + 0x24) | 393 | #define SC_LBFCODE __io_address(INTEGRATOR_SC_BASE + 0x24) |
397 | 394 | ||
398 | static int | 395 | static int |
399 | v3_pci_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) | 396 | v3_pci_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) |
@@ -498,7 +495,6 @@ void __init pci_v3_preinit(void) | |||
498 | unsigned int temp; | 495 | unsigned int temp; |
499 | int ret; | 496 | int ret; |
500 | 497 | ||
501 | pcibios_min_io = 0x6000; | ||
502 | pcibios_min_mem = 0x00100000; | 498 | pcibios_min_mem = 0x00100000; |
503 | 499 | ||
504 | /* | 500 | /* |