diff options
Diffstat (limited to 'arch/powerpc/platforms/powermac/pci.c')
-rw-r--r-- | arch/powerpc/platforms/powermac/pci.c | 89 |
1 files changed, 43 insertions, 46 deletions
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c index f671ed253901..de3f30e6b333 100644 --- a/arch/powerpc/platforms/powermac/pci.c +++ b/arch/powerpc/platforms/powermac/pci.c | |||
@@ -136,14 +136,14 @@ static void __init fixup_bus_range(struct device_node *bridge) | |||
136 | |(((unsigned int)(off)) & 0xFCUL) \ | 136 | |(((unsigned int)(off)) & 0xFCUL) \ |
137 | |1UL) | 137 | |1UL) |
138 | 138 | ||
139 | static unsigned long macrisc_cfg_access(struct pci_controller* hose, | 139 | static volatile void __iomem *macrisc_cfg_access(struct pci_controller* hose, |
140 | u8 bus, u8 dev_fn, u8 offset) | 140 | u8 bus, u8 dev_fn, u8 offset) |
141 | { | 141 | { |
142 | unsigned int caddr; | 142 | unsigned int caddr; |
143 | 143 | ||
144 | if (bus == hose->first_busno) { | 144 | if (bus == hose->first_busno) { |
145 | if (dev_fn < (11 << 3)) | 145 | if (dev_fn < (11 << 3)) |
146 | return 0; | 146 | return NULL; |
147 | caddr = MACRISC_CFA0(dev_fn, offset); | 147 | caddr = MACRISC_CFA0(dev_fn, offset); |
148 | } else | 148 | } else |
149 | caddr = MACRISC_CFA1(bus, dev_fn, offset); | 149 | caddr = MACRISC_CFA1(bus, dev_fn, offset); |
@@ -154,14 +154,14 @@ static unsigned long macrisc_cfg_access(struct pci_controller* hose, | |||
154 | } while (in_le32(hose->cfg_addr) != caddr); | 154 | } while (in_le32(hose->cfg_addr) != caddr); |
155 | 155 | ||
156 | offset &= has_uninorth ? 0x07 : 0x03; | 156 | offset &= has_uninorth ? 0x07 : 0x03; |
157 | return ((unsigned long)hose->cfg_data) + offset; | 157 | return hose->cfg_data + offset; |
158 | } | 158 | } |
159 | 159 | ||
160 | static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn, | 160 | static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn, |
161 | int offset, int len, u32 *val) | 161 | int offset, int len, u32 *val) |
162 | { | 162 | { |
163 | struct pci_controller *hose; | 163 | struct pci_controller *hose; |
164 | unsigned long addr; | 164 | volatile void __iomem *addr; |
165 | 165 | ||
166 | hose = pci_bus_to_host(bus); | 166 | hose = pci_bus_to_host(bus); |
167 | if (hose == NULL) | 167 | if (hose == NULL) |
@@ -177,13 +177,13 @@ static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn, | |||
177 | */ | 177 | */ |
178 | switch (len) { | 178 | switch (len) { |
179 | case 1: | 179 | case 1: |
180 | *val = in_8((u8 *)addr); | 180 | *val = in_8(addr); |
181 | break; | 181 | break; |
182 | case 2: | 182 | case 2: |
183 | *val = in_le16((u16 *)addr); | 183 | *val = in_le16(addr); |
184 | break; | 184 | break; |
185 | default: | 185 | default: |
186 | *val = in_le32((u32 *)addr); | 186 | *val = in_le32(addr); |
187 | break; | 187 | break; |
188 | } | 188 | } |
189 | return PCIBIOS_SUCCESSFUL; | 189 | return PCIBIOS_SUCCESSFUL; |
@@ -193,7 +193,7 @@ static int macrisc_write_config(struct pci_bus *bus, unsigned int devfn, | |||
193 | int offset, int len, u32 val) | 193 | int offset, int len, u32 val) |
194 | { | 194 | { |
195 | struct pci_controller *hose; | 195 | struct pci_controller *hose; |
196 | unsigned long addr; | 196 | volatile void __iomem *addr; |
197 | 197 | ||
198 | hose = pci_bus_to_host(bus); | 198 | hose = pci_bus_to_host(bus); |
199 | if (hose == NULL) | 199 | if (hose == NULL) |
@@ -209,16 +209,16 @@ static int macrisc_write_config(struct pci_bus *bus, unsigned int devfn, | |||
209 | */ | 209 | */ |
210 | switch (len) { | 210 | switch (len) { |
211 | case 1: | 211 | case 1: |
212 | out_8((u8 *)addr, val); | 212 | out_8(addr, val); |
213 | (void) in_8((u8 *)addr); | 213 | (void) in_8(addr); |
214 | break; | 214 | break; |
215 | case 2: | 215 | case 2: |
216 | out_le16((u16 *)addr, val); | 216 | out_le16(addr, val); |
217 | (void) in_le16((u16 *)addr); | 217 | (void) in_le16(addr); |
218 | break; | 218 | break; |
219 | default: | 219 | default: |
220 | out_le32((u32 *)addr, val); | 220 | out_le32(addr, val); |
221 | (void) in_le32((u32 *)addr); | 221 | (void) in_le32(addr); |
222 | break; | 222 | break; |
223 | } | 223 | } |
224 | return PCIBIOS_SUCCESSFUL; | 224 | return PCIBIOS_SUCCESSFUL; |
@@ -348,25 +348,23 @@ static int u3_ht_skip_device(struct pci_controller *hose, | |||
348 | + (((unsigned int)bus) << 16) \ | 348 | + (((unsigned int)bus) << 16) \ |
349 | + 0x01000000UL) | 349 | + 0x01000000UL) |
350 | 350 | ||
351 | static unsigned long u3_ht_cfg_access(struct pci_controller* hose, | 351 | static volatile void __iomem *u3_ht_cfg_access(struct pci_controller* hose, |
352 | u8 bus, u8 devfn, u8 offset) | 352 | u8 bus, u8 devfn, u8 offset) |
353 | { | 353 | { |
354 | if (bus == hose->first_busno) { | 354 | if (bus == hose->first_busno) { |
355 | /* For now, we don't self probe U3 HT bridge */ | 355 | /* For now, we don't self probe U3 HT bridge */ |
356 | if (PCI_SLOT(devfn) == 0) | 356 | if (PCI_SLOT(devfn) == 0) |
357 | return 0; | 357 | return NULL; |
358 | return ((unsigned long)hose->cfg_data) + | 358 | return hose->cfg_data + U3_HT_CFA0(devfn, offset); |
359 | U3_HT_CFA0(devfn, offset); | ||
360 | } else | 359 | } else |
361 | return ((unsigned long)hose->cfg_data) + | 360 | return hose->cfg_data + U3_HT_CFA1(bus, devfn, offset); |
362 | U3_HT_CFA1(bus, devfn, offset); | ||
363 | } | 361 | } |
364 | 362 | ||
365 | static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, | 363 | static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, |
366 | int offset, int len, u32 *val) | 364 | int offset, int len, u32 *val) |
367 | { | 365 | { |
368 | struct pci_controller *hose; | 366 | struct pci_controller *hose; |
369 | unsigned long addr; | 367 | volatile void __iomem *addr; |
370 | 368 | ||
371 | hose = pci_bus_to_host(bus); | 369 | hose = pci_bus_to_host(bus); |
372 | if (hose == NULL) | 370 | if (hose == NULL) |
@@ -400,13 +398,13 @@ static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, | |||
400 | */ | 398 | */ |
401 | switch (len) { | 399 | switch (len) { |
402 | case 1: | 400 | case 1: |
403 | *val = in_8((u8 *)addr); | 401 | *val = in_8(addr); |
404 | break; | 402 | break; |
405 | case 2: | 403 | case 2: |
406 | *val = in_le16((u16 *)addr); | 404 | *val = in_le16(addr); |
407 | break; | 405 | break; |
408 | default: | 406 | default: |
409 | *val = in_le32((u32 *)addr); | 407 | *val = in_le32(addr); |
410 | break; | 408 | break; |
411 | } | 409 | } |
412 | return PCIBIOS_SUCCESSFUL; | 410 | return PCIBIOS_SUCCESSFUL; |
@@ -416,7 +414,7 @@ static int u3_ht_write_config(struct pci_bus *bus, unsigned int devfn, | |||
416 | int offset, int len, u32 val) | 414 | int offset, int len, u32 val) |
417 | { | 415 | { |
418 | struct pci_controller *hose; | 416 | struct pci_controller *hose; |
419 | unsigned long addr; | 417 | volatile void __iomem *addr; |
420 | 418 | ||
421 | hose = pci_bus_to_host(bus); | 419 | hose = pci_bus_to_host(bus); |
422 | if (hose == NULL) | 420 | if (hose == NULL) |
@@ -442,16 +440,16 @@ static int u3_ht_write_config(struct pci_bus *bus, unsigned int devfn, | |||
442 | */ | 440 | */ |
443 | switch (len) { | 441 | switch (len) { |
444 | case 1: | 442 | case 1: |
445 | out_8((u8 *)addr, val); | 443 | out_8(addr, val); |
446 | (void) in_8((u8 *)addr); | 444 | (void) in_8(addr); |
447 | break; | 445 | break; |
448 | case 2: | 446 | case 2: |
449 | out_le16((u16 *)addr, val); | 447 | out_le16(addr, val); |
450 | (void) in_le16((u16 *)addr); | 448 | (void) in_le16(addr); |
451 | break; | 449 | break; |
452 | default: | 450 | default: |
453 | out_le32((u32 *)addr, val); | 451 | out_le32((u32 __iomem *)addr, val); |
454 | (void) in_le32((u32 *)addr); | 452 | (void) in_le32(addr); |
455 | break; | 453 | break; |
456 | } | 454 | } |
457 | return PCIBIOS_SUCCESSFUL; | 455 | return PCIBIOS_SUCCESSFUL; |
@@ -476,7 +474,7 @@ static struct pci_ops u3_ht_pci_ops = | |||
476 | |(((unsigned int)(off)) & 0xfcU) \ | 474 | |(((unsigned int)(off)) & 0xfcU) \ |
477 | |1UL) | 475 | |1UL) |
478 | 476 | ||
479 | static unsigned long u4_pcie_cfg_access(struct pci_controller* hose, | 477 | static volatile void __iomem *u4_pcie_cfg_access(struct pci_controller* hose, |
480 | u8 bus, u8 dev_fn, int offset) | 478 | u8 bus, u8 dev_fn, int offset) |
481 | { | 479 | { |
482 | unsigned int caddr; | 480 | unsigned int caddr; |
@@ -492,14 +490,14 @@ static unsigned long u4_pcie_cfg_access(struct pci_controller* hose, | |||
492 | } while (in_le32(hose->cfg_addr) != caddr); | 490 | } while (in_le32(hose->cfg_addr) != caddr); |
493 | 491 | ||
494 | offset &= 0x03; | 492 | offset &= 0x03; |
495 | return ((unsigned long)hose->cfg_data) + offset; | 493 | return hose->cfg_data + offset; |
496 | } | 494 | } |
497 | 495 | ||
498 | static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn, | 496 | static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn, |
499 | int offset, int len, u32 *val) | 497 | int offset, int len, u32 *val) |
500 | { | 498 | { |
501 | struct pci_controller *hose; | 499 | struct pci_controller *hose; |
502 | unsigned long addr; | 500 | volatile void __iomem *addr; |
503 | 501 | ||
504 | hose = pci_bus_to_host(bus); | 502 | hose = pci_bus_to_host(bus); |
505 | if (hose == NULL) | 503 | if (hose == NULL) |
@@ -515,13 +513,13 @@ static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn, | |||
515 | */ | 513 | */ |
516 | switch (len) { | 514 | switch (len) { |
517 | case 1: | 515 | case 1: |
518 | *val = in_8((u8 *)addr); | 516 | *val = in_8(addr); |
519 | break; | 517 | break; |
520 | case 2: | 518 | case 2: |
521 | *val = in_le16((u16 *)addr); | 519 | *val = in_le16(addr); |
522 | break; | 520 | break; |
523 | default: | 521 | default: |
524 | *val = in_le32((u32 *)addr); | 522 | *val = in_le32(addr); |
525 | break; | 523 | break; |
526 | } | 524 | } |
527 | return PCIBIOS_SUCCESSFUL; | 525 | return PCIBIOS_SUCCESSFUL; |
@@ -531,7 +529,7 @@ static int u4_pcie_write_config(struct pci_bus *bus, unsigned int devfn, | |||
531 | int offset, int len, u32 val) | 529 | int offset, int len, u32 val) |
532 | { | 530 | { |
533 | struct pci_controller *hose; | 531 | struct pci_controller *hose; |
534 | unsigned long addr; | 532 | volatile void __iomem *addr; |
535 | 533 | ||
536 | hose = pci_bus_to_host(bus); | 534 | hose = pci_bus_to_host(bus); |
537 | if (hose == NULL) | 535 | if (hose == NULL) |
@@ -547,16 +545,16 @@ static int u4_pcie_write_config(struct pci_bus *bus, unsigned int devfn, | |||
547 | */ | 545 | */ |
548 | switch (len) { | 546 | switch (len) { |
549 | case 1: | 547 | case 1: |
550 | out_8((u8 *)addr, val); | 548 | out_8(addr, val); |
551 | (void) in_8((u8 *)addr); | 549 | (void) in_8(addr); |
552 | break; | 550 | break; |
553 | case 2: | 551 | case 2: |
554 | out_le16((u16 *)addr, val); | 552 | out_le16(addr, val); |
555 | (void) in_le16((u16 *)addr); | 553 | (void) in_le16(addr); |
556 | break; | 554 | break; |
557 | default: | 555 | default: |
558 | out_le32((u32 *)addr, val); | 556 | out_le32(addr, val); |
559 | (void) in_le32((u32 *)addr); | 557 | (void) in_le32(addr); |
560 | break; | 558 | break; |
561 | } | 559 | } |
562 | return PCIBIOS_SUCCESSFUL; | 560 | return PCIBIOS_SUCCESSFUL; |
@@ -773,8 +771,7 @@ static void __init setup_u3_ht(struct pci_controller* hose) | |||
773 | * the reg address cell, we shall fix that by killing struct | 771 | * the reg address cell, we shall fix that by killing struct |
774 | * reg_property and using some accessor functions instead | 772 | * reg_property and using some accessor functions instead |
775 | */ | 773 | */ |
776 | hose->cfg_data = (volatile unsigned char *)ioremap(0xf2000000, | 774 | hose->cfg_data = ioremap(0xf2000000, 0x02000000); |
777 | 0x02000000); | ||
778 | 775 | ||
779 | /* | 776 | /* |
780 | * /ht node doesn't expose a "ranges" property, so we "remove" | 777 | * /ht node doesn't expose a "ranges" property, so we "remove" |