wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2003 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
Wolfgang Denk | 34ca9d3 | 2005-09-25 18:49:35 +0200 | [diff] [blame] | 5 | * Copyright (c) 2005 MontaVista Software, Inc. |
Wolfgang Denk | 8cc89d9 | 2005-09-25 16:27:55 +0200 | [diff] [blame] | 6 | * Vitaly Bordug <vbordug@ru.mvista.com> |
| 7 | * Added support for PCI bridge on MPC8272ADS |
| 8 | * |
Wolfgang Denk | bd8ec7e | 2013-10-07 13:07:26 +0200 | [diff] [blame] | 9 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #include <common.h> |
| 13 | |
| 14 | #ifdef CONFIG_PCI |
| 15 | |
| 16 | #include <pci.h> |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 17 | #include <mpc8260.h> |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 18 | #include <asm/m8260_pci.h> |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 19 | #include <asm/io.h> |
Matvejchikov Ilya | 8743c79 | 2008-07-06 13:57:00 +0400 | [diff] [blame] | 20 | #ifdef CONFIG_OF_LIBFDT |
| 21 | #include <libfdt.h> |
| 22 | #include <fdt_support.h> |
| 23 | #endif |
Wolfgang Denk | 6405a15 | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 24 | |
Wolfgang Denk | e5357d0 | 2006-05-30 23:32:44 +0200 | [diff] [blame] | 25 | #if defined CONFIG_MPC8266ADS || defined CONFIG_MPC8272 || defined CONFIG_PM826 |
Wolfgang Denk | 6405a15 | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 26 | DECLARE_GLOBAL_DATA_PTR; |
| 27 | #endif |
| 28 | |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 29 | /* |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 30 | * Local->PCI map (from CPU) controlled by |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 31 | * MPC826x master window |
| 32 | * |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 33 | * 0x80000000 - 0xBFFFFFFF CPU2PCI space PCIBR0 |
| 34 | * 0xF4000000 - 0xF7FFFFFF CPU2PCI space PCIBR1 |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 35 | * |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 36 | * 0x80000000 - 0x9FFFFFFF 0x80000000 - 0x9FFFFFFF (Outbound ATU #1) |
| 37 | * PCI Mem with prefetch |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 38 | * |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 39 | * 0xA0000000 - 0xBFFFFFFF 0xA0000000 - 0xBFFFFFFF (Outbound ATU #2) |
| 40 | * PCI Mem w/o prefetch |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 41 | * |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 42 | * 0xF4000000 - 0xF7FFFFFF 0x00000000 - 0x03FFFFFF (Outbound ATU #3) |
| 43 | * 32-bit PCI IO |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 44 | * |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 45 | * PCI->Local map (from PCI) |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 46 | * MPC826x slave window controlled by |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 47 | * |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 48 | * 0x00000000 - 0x1FFFFFFF 0x00000000 - 0x1FFFFFFF (Inbound ATU #1) |
| 49 | * MPC826x local memory |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 50 | */ |
| 51 | |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 52 | /* |
| 53 | * Slave window that allows PCI masters to access MPC826x local memory. |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 54 | * This window is set up using the first set of Inbound ATU registers |
| 55 | */ |
| 56 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 57 | #ifndef CONFIG_SYS_PCI_SLV_MEM_LOCAL |
| 58 | #define PCI_SLV_MEM_LOCAL CONFIG_SYS_SDRAM_BASE /* Local base */ |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 59 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 60 | #define PCI_SLV_MEM_LOCAL CONFIG_SYS_PCI_SLV_MEM_LOCAL |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 61 | #endif |
| 62 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 63 | #ifndef CONFIG_SYS_PCI_SLV_MEM_BUS |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 64 | #define PCI_SLV_MEM_BUS 0x00000000 /* PCI base */ |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 65 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 66 | #define PCI_SLV_MEM_BUS CONFIG_SYS_PCI_SLV_MEM_BUS |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 67 | #endif |
| 68 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 69 | #ifndef CONFIG_SYS_PICMR0_MASK_ATTRIB |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 70 | #define PICMR0_MASK_ATTRIB (PICMR_MASK_512MB | PICMR_ENABLE | \ |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 71 | PICMR_PREFETCH_EN) |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 72 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 73 | #define PICMR0_MASK_ATTRIB CONFIG_SYS_PICMR0_MASK_ATTRIB |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 74 | #endif |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 75 | |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 76 | /* |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 77 | * These are the windows that allow the CPU to access PCI address space. |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 78 | * All three PCI master windows, which allow the CPU to access PCI |
| 79 | * prefetch, non prefetch, and IO space (see below), must all fit within |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 80 | * these windows. |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 81 | */ |
| 82 | |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 83 | /* PCIBR0 */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 84 | #ifndef CONFIG_SYS_PCI_MSTR0_LOCAL |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 85 | #define PCI_MSTR0_LOCAL 0x80000000 /* Local base */ |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 86 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 87 | #define PCI_MSTR0_LOCAL CONFIG_SYS_PCI_MSTR0_LOCAL |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 88 | #endif |
| 89 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 90 | #ifndef CONFIG_SYS_PCIMSK0_MASK |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 91 | #define PCIMSK0_MASK PCIMSK_1GB /* Size of window */ |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 92 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 93 | #define PCIMSK0_MASK CONFIG_SYS_PCIMSK0_MASK |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 94 | #endif |
| 95 | |
| 96 | /* PCIBR1 */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 97 | #ifndef CONFIG_SYS_PCI_MSTR1_LOCAL |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 98 | #define PCI_MSTR1_LOCAL 0xF4000000 /* Local base */ |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 99 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 100 | #define PCI_MSTR1_LOCAL CONFIG_SYS_PCI_MSTR1_LOCAL |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 101 | #endif |
| 102 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 103 | #ifndef CONFIG_SYS_PCIMSK1_MASK |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 104 | #define PCIMSK1_MASK PCIMSK_64MB /* Size of window */ |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 105 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 106 | #define PCIMSK1_MASK CONFIG_SYS_PCIMSK1_MASK |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 107 | #endif |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 108 | |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 109 | /* |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 110 | * Master window that allows the CPU to access PCI Memory (prefetch). |
| 111 | * This window will be setup with the first set of Outbound ATU registers |
| 112 | * in the bridge. |
| 113 | */ |
| 114 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 115 | #ifndef CONFIG_SYS_PCI_MSTR_MEM_LOCAL |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 116 | #define PCI_MSTR_MEM_LOCAL 0x80000000 /* Local base */ |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 117 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 118 | #define PCI_MSTR_MEM_LOCAL CONFIG_SYS_PCI_MSTR_MEM_LOCAL |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 119 | #endif |
| 120 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 121 | #ifndef CONFIG_SYS_PCI_MSTR_MEM_BUS |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 122 | #define PCI_MSTR_MEM_BUS 0x80000000 /* PCI base */ |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 123 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 124 | #define PCI_MSTR_MEM_BUS CONFIG_SYS_PCI_MSTR_MEM_BUS |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 125 | #endif |
| 126 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 127 | #ifndef CONFIG_SYS_CPU_PCI_MEM_START |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 128 | #define CPU_PCI_MEM_START PCI_MSTR_MEM_LOCAL |
| 129 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 130 | #define CPU_PCI_MEM_START CONFIG_SYS_CPU_PCI_MEM_START |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 131 | #endif |
| 132 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 133 | #ifndef CONFIG_SYS_PCI_MSTR_MEM_SIZE |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 134 | #define PCI_MSTR_MEM_SIZE 0x10000000 /* 256MB */ |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 135 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 136 | #define PCI_MSTR_MEM_SIZE CONFIG_SYS_PCI_MSTR_MEM_SIZE |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 137 | #endif |
| 138 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 139 | #ifndef CONFIG_SYS_POCMR0_MASK_ATTRIB |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 140 | #define POCMR0_MASK_ATTRIB (POCMR_MASK_256MB | POCMR_ENABLE | POCMR_PREFETCH_EN) |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 141 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 142 | #define POCMR0_MASK_ATTRIB CONFIG_SYS_POCMR0_MASK_ATTRIB |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 143 | #endif |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 144 | |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 145 | /* |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 146 | * Master window that allows the CPU to access PCI Memory (non-prefetch). |
| 147 | * This window will be setup with the second set of Outbound ATU registers |
| 148 | * in the bridge. |
| 149 | */ |
| 150 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 151 | #ifndef CONFIG_SYS_PCI_MSTR_MEMIO_LOCAL |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 152 | #define PCI_MSTR_MEMIO_LOCAL 0x90000000 /* Local base */ |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 153 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 154 | #define PCI_MSTR_MEMIO_LOCAL CONFIG_SYS_PCI_MSTR_MEMIO_LOCAL |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 155 | #endif |
| 156 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 157 | #ifndef CONFIG_SYS_PCI_MSTR_MEMIO_BUS |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 158 | #define PCI_MSTR_MEMIO_BUS 0x90000000 /* PCI base */ |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 159 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 160 | #define PCI_MSTR_MEMIO_BUS CONFIG_SYS_PCI_MSTR_MEMIO_BUS |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 161 | #endif |
| 162 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 163 | #ifndef CONFIG_SYS_CPU_PCI_MEMIO_START |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 164 | #define CPU_PCI_MEMIO_START PCI_MSTR_MEMIO_LOCAL |
| 165 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 166 | #define CPU_PCI_MEMIO_START CONFIG_SYS_CPU_PCI_MEMIO_START |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 167 | #endif |
| 168 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 169 | #ifndef CONFIG_SYS_PCI_MSTR_MEMIO_SIZE |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 170 | #define PCI_MSTR_MEMIO_SIZE 0x10000000 /* 256 MB */ |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 171 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 172 | #define PCI_MSTR_MEMIO_SIZE CONFIG_SYS_PCI_MSTR_MEMIO_SIZE |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 173 | #endif |
| 174 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 175 | #ifndef CONFIG_SYS_POCMR1_MASK_ATTRIB |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 176 | #define POCMR1_MASK_ATTRIB (POCMR_MASK_512MB | POCMR_ENABLE) |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 177 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 178 | #define POCMR1_MASK_ATTRIB CONFIG_SYS_POCMR1_MASK_ATTRIB |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 179 | #endif |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 180 | |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 181 | /* |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 182 | * Master window that allows the CPU to access PCI IO space. |
| 183 | * This window will be setup with the third set of Outbound ATU registers |
| 184 | * in the bridge. |
| 185 | */ |
| 186 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 187 | #ifndef CONFIG_SYS_PCI_MSTR_IO_LOCAL |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 188 | #define PCI_MSTR_IO_LOCAL 0xA0000000 /* Local base */ |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 189 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 190 | #define PCI_MSTR_IO_LOCAL CONFIG_SYS_PCI_MSTR_IO_LOCAL |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 191 | #endif |
| 192 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 193 | #ifndef CONFIG_SYS_PCI_MSTR_IO_BUS |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 194 | #define PCI_MSTR_IO_BUS 0xA0000000 /* PCI base */ |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 195 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 196 | #define PCI_MSTR_IO_BUS CONFIG_SYS_PCI_MSTR_IO_BUS |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 197 | #endif |
| 198 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 199 | #ifndef CONFIG_SYS_CPU_PCI_IO_START |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 200 | #define CPU_PCI_IO_START PCI_MSTR_IO_LOCAL |
| 201 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 202 | #define CPU_PCI_IO_START CONFIG_SYS_CPU_PCI_IO_START |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 203 | #endif |
| 204 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 205 | #ifndef CONFIG_SYS_PCI_MSTR_IO_SIZE |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 206 | #define PCI_MSTR_IO_SIZE 0x10000000 /* 256MB */ |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 207 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 208 | #define PCI_MSTR_IO_SIZE CONFIG_SYS_PCI_MSTR_IO_SIZE |
wdenk | e5d61c7 | 2003-05-18 11:30:09 +0000 | [diff] [blame] | 209 | #endif |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 210 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 211 | #ifndef CONFIG_SYS_POCMR2_MASK_ATTRIB |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 212 | #define POCMR2_MASK_ATTRIB (POCMR_MASK_256MB | POCMR_ENABLE | POCMR_PCI_IO) |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 213 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 214 | #define POCMR2_MASK_ATTRIB CONFIG_SYS_POCMR2_MASK_ATTRIB |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 215 | #endif |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 216 | |
| 217 | /* PCI bus configuration registers. |
| 218 | */ |
| 219 | |
| 220 | #define PCI_CLASS_BRIDGE_CTLR 0x06 |
| 221 | |
| 222 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 223 | static inline void pci_outl (u32 addr, u32 data) |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 224 | { |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 225 | *(volatile u32 *) addr = cpu_to_le32 (data); |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 226 | } |
| 227 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 228 | void pci_mpc8250_init (struct pci_controller *hose) |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 229 | { |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 230 | u16 tempShort; |
| 231 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 232 | volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR; |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 233 | pci_dev_t host_devno = PCI_BDF (0, 0, 0); |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 234 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 235 | pci_setup_indirect (hose, CONFIG_SYS_IMMR + PCI_CFG_ADDR_REG, |
| 236 | CONFIG_SYS_IMMR + PCI_CFG_DATA_REG); |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 237 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 238 | /* |
| 239 | * Setting required to enable local bus for PCI (SIUMCR [LBPC]). |
| 240 | */ |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 241 | #ifdef CONFIG_MPC8266ADS |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 242 | immap->im_siu_conf.sc_siumcr = |
| 243 | (immap->im_siu_conf.sc_siumcr & ~SIUMCR_LBPC11) |
| 244 | | SIUMCR_LBPC01; |
Wolfgang Denk | 8cc89d9 | 2005-09-25 16:27:55 +0200 | [diff] [blame] | 245 | #elif defined CONFIG_MPC8272 |
Wolfgang Denk | 34ca9d3 | 2005-09-25 18:49:35 +0200 | [diff] [blame] | 246 | immap->im_siu_conf.sc_siumcr = (immap->im_siu_conf.sc_siumcr & |
| 247 | ~SIUMCR_BBD & |
| 248 | ~SIUMCR_ESE & |
| 249 | ~SIUMCR_PBSE & |
| 250 | ~SIUMCR_CDIS & |
| 251 | ~SIUMCR_DPPC11 & |
| 252 | ~SIUMCR_L2CPC11 & |
| 253 | ~SIUMCR_LBPC11 & |
| 254 | ~SIUMCR_APPC11 & |
| 255 | ~SIUMCR_CS10PC11 & |
| 256 | ~SIUMCR_BCTLC11 & |
| 257 | ~SIUMCR_MMR11) |
| 258 | | SIUMCR_DPPC11 |
| 259 | | SIUMCR_L2CPC01 |
| 260 | | SIUMCR_LBPC00 |
| 261 | | SIUMCR_APPC10 |
| 262 | | SIUMCR_CS10PC00 |
| 263 | | SIUMCR_BCTLC00 |
| 264 | | SIUMCR_MMR11; |
Heiko Schocher | 3ec4366 | 2006-12-21 17:17:02 +0100 | [diff] [blame] | 265 | #elif defined(CONFIG_TQM8272) |
Heiko Schocher | 609ed90 | 2007-03-21 08:45:17 +0100 | [diff] [blame] | 266 | /* nothing to do for this Board here */ |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 267 | #else |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 268 | /* |
| 269 | * Setting required to enable IRQ1-IRQ7 (SIUMCR [DPPC]), |
| 270 | * and local bus for PCI (SIUMCR [LBPC]). |
| 271 | */ |
| 272 | immap->im_siu_conf.sc_siumcr = (immap->im_siu_conf.sc_siumcr & |
| 273 | ~SIUMCR_LBPC11 & |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 274 | ~SIUMCR_CS10PC11 & |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 275 | ~SIUMCR_LBPC11) | |
| 276 | SIUMCR_LBPC01 | |
| 277 | SIUMCR_CS10PC01 | |
| 278 | SIUMCR_APPC10; |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 279 | #endif |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 280 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 281 | /* Make PCI lowest priority */ |
| 282 | /* Each 4 bits is a device bus request and the MS 4bits |
| 283 | is highest priority */ |
| 284 | /* Bus 4bit value |
| 285 | --- ---------- |
| 286 | CPM high 0b0000 |
| 287 | CPM middle 0b0001 |
| 288 | CPM low 0b0010 |
| 289 | PCI reguest 0b0011 |
| 290 | Reserved 0b0100 |
| 291 | Reserved 0b0101 |
| 292 | Internal Core 0b0110 |
| 293 | External Master 1 0b0111 |
| 294 | External Master 2 0b1000 |
| 295 | External Master 3 0b1001 |
| 296 | The rest are reserved */ |
| 297 | immap->im_siu_conf.sc_ppc_alrh = 0x61207893; |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 298 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 299 | /* Park bus on core while modifying PCI Bus accesses */ |
| 300 | immap->im_siu_conf.sc_ppc_acr = 0x6; |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 301 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 302 | /* |
| 303 | * Set up master windows that allow the CPU to access PCI space. These |
| 304 | * windows are set up using the two SIU PCIBR registers. |
| 305 | */ |
| 306 | immap->im_memctl.memc_pcimsk0 = PCIMSK0_MASK; |
| 307 | immap->im_memctl.memc_pcibr0 = PCI_MSTR0_LOCAL | PCIBR_ENABLE; |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 308 | |
Wolfgang Denk | 8cc89d9 | 2005-09-25 16:27:55 +0200 | [diff] [blame] | 309 | #if defined CONFIG_MPC8266ADS || defined CONFIG_MPC8272 |
wdenk | 792c44a | 2004-04-18 21:17:30 +0000 | [diff] [blame] | 310 | immap->im_memctl.memc_pcimsk1 = PCIMSK1_MASK; |
| 311 | immap->im_memctl.memc_pcibr1 = PCI_MSTR1_LOCAL | PCIBR_ENABLE; |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 312 | #endif |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 313 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 314 | /* Release PCI RST (by default the PCI RST signal is held low) */ |
| 315 | immap->im_pci.pci_gcr = cpu_to_le32 (PCIGCR_PCI_BUS_EN); |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 316 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 317 | /* give it some time */ |
| 318 | { |
Wolfgang Denk | 8cc89d9 | 2005-09-25 16:27:55 +0200 | [diff] [blame] | 319 | #if defined CONFIG_MPC8266ADS || defined CONFIG_MPC8272 |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 320 | /* Give the PCI cards more time to initialize before query |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 321 | This might be good for other boards also |
| 322 | */ |
| 323 | int i; |
| 324 | |
| 325 | for (i = 0; i < 1000; ++i) |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 326 | #endif |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 327 | udelay (1000); |
| 328 | } |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 329 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 330 | /* |
| 331 | * Set up master window that allows the CPU to access PCI Memory (prefetch) |
| 332 | * space. This window is set up using the first set of Outbound ATU registers. |
| 333 | */ |
| 334 | immap->im_pci.pci_potar0 = cpu_to_le32 (PCI_MSTR_MEM_BUS >> 12); /* PCI base */ |
| 335 | immap->im_pci.pci_pobar0 = cpu_to_le32 (PCI_MSTR_MEM_LOCAL >> 12); /* Local base */ |
| 336 | immap->im_pci.pci_pocmr0 = cpu_to_le32 (POCMR0_MASK_ATTRIB); /* Size & attribute */ |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 337 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 338 | /* |
| 339 | * Set up master window that allows the CPU to access PCI Memory (non-prefetch) |
| 340 | * space. This window is set up using the second set of Outbound ATU registers. |
| 341 | */ |
| 342 | immap->im_pci.pci_potar1 = cpu_to_le32 (PCI_MSTR_MEMIO_BUS >> 12); /* PCI base */ |
| 343 | immap->im_pci.pci_pobar1 = cpu_to_le32 (PCI_MSTR_MEMIO_LOCAL >> 12); /* Local base */ |
| 344 | immap->im_pci.pci_pocmr1 = cpu_to_le32 (POCMR1_MASK_ATTRIB); /* Size & attribute */ |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 345 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 346 | /* |
| 347 | * Set up master window that allows the CPU to access PCI IO space. This window |
| 348 | * is set up using the third set of Outbound ATU registers. |
| 349 | */ |
| 350 | immap->im_pci.pci_potar2 = cpu_to_le32 (PCI_MSTR_IO_BUS >> 12); /* PCI base */ |
| 351 | immap->im_pci.pci_pobar2 = cpu_to_le32 (PCI_MSTR_IO_LOCAL >> 12); /* Local base */ |
| 352 | immap->im_pci.pci_pocmr2 = cpu_to_le32 (POCMR2_MASK_ATTRIB); /* Size & attribute */ |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 353 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 354 | /* |
| 355 | * Set up slave window that allows PCI masters to access MPC826x local memory. |
| 356 | * This window is set up using the first set of Inbound ATU registers |
| 357 | */ |
| 358 | immap->im_pci.pci_pitar0 = cpu_to_le32 (PCI_SLV_MEM_LOCAL >> 12); /* PCI base */ |
| 359 | immap->im_pci.pci_pibar0 = cpu_to_le32 (PCI_SLV_MEM_BUS >> 12); /* Local base */ |
| 360 | immap->im_pci.pci_picmr0 = cpu_to_le32 (PICMR0_MASK_ATTRIB); /* Size & attribute */ |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 361 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 362 | /* See above for description - puts PCI request as highest priority */ |
Wolfgang Denk | 8cc89d9 | 2005-09-25 16:27:55 +0200 | [diff] [blame] | 363 | #ifdef CONFIG_MPC8272 |
| 364 | immap->im_siu_conf.sc_ppc_alrh = 0x01236745; |
| 365 | #else |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 366 | immap->im_siu_conf.sc_ppc_alrh = 0x03124567; |
Wolfgang Denk | 8cc89d9 | 2005-09-25 16:27:55 +0200 | [diff] [blame] | 367 | #endif |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 368 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 369 | /* Park the bus on the PCI */ |
| 370 | immap->im_siu_conf.sc_ppc_acr = PPC_ACR_BUS_PARK_PCI; |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 371 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 372 | /* Host mode - specify the bridge as a host-PCI bridge */ |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 373 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 374 | pci_hose_write_config_byte (hose, host_devno, PCI_CLASS_CODE, |
| 375 | PCI_CLASS_BRIDGE_CTLR); |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 376 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 377 | /* Enable the host bridge to be a master on the PCI bus, and to act as a PCI memory target */ |
| 378 | pci_hose_read_config_word (hose, host_devno, PCI_COMMAND, &tempShort); |
| 379 | pci_hose_write_config_word (hose, host_devno, PCI_COMMAND, |
| 380 | tempShort | PCI_COMMAND_MASTER | |
| 381 | PCI_COMMAND_MEMORY); |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 382 | |
wdenk | abda5ca | 2003-05-31 18:35:21 +0000 | [diff] [blame] | 383 | /* do some bridge init, should be done on all 8260 based bridges */ |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 384 | pci_hose_write_config_byte (hose, host_devno, PCI_CACHE_LINE_SIZE, |
| 385 | 0x08); |
| 386 | pci_hose_write_config_byte (hose, host_devno, PCI_LATENCY_TIMER, |
| 387 | 0xF8); |
wdenk | abda5ca | 2003-05-31 18:35:21 +0000 | [diff] [blame] | 388 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 389 | hose->first_busno = 0; |
| 390 | hose->last_busno = 0xff; |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 391 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 392 | /* System memory space */ |
Wolfgang Denk | e5357d0 | 2006-05-30 23:32:44 +0200 | [diff] [blame] | 393 | #if defined CONFIG_MPC8266ADS || defined CONFIG_MPC8272 || defined CONFIG_PM826 |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 394 | pci_set_region (hose->regions + 0, |
| 395 | PCI_SLV_MEM_BUS, |
| 396 | PCI_SLV_MEM_LOCAL, |
Kumar Gala | efa1f1d | 2009-02-06 09:49:31 -0600 | [diff] [blame] | 397 | gd->ram_size, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY); |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 398 | #else |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 399 | pci_set_region (hose->regions + 0, |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 400 | CONFIG_SYS_SDRAM_BASE, |
| 401 | CONFIG_SYS_SDRAM_BASE, |
Kumar Gala | efa1f1d | 2009-02-06 09:49:31 -0600 | [diff] [blame] | 402 | 0x4000000, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY); |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 403 | #endif |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 404 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 405 | /* PCI memory space */ |
Wolfgang Denk | 34ca9d3 | 2005-09-25 18:49:35 +0200 | [diff] [blame] | 406 | #if defined CONFIG_MPC8266ADS || defined CONFIG_MPC8272 |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 407 | pci_set_region (hose->regions + 1, |
| 408 | PCI_MSTR_MEMIO_BUS, |
| 409 | PCI_MSTR_MEMIO_LOCAL, |
| 410 | PCI_MSTR_MEMIO_SIZE, PCI_REGION_MEM); |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 411 | #else |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 412 | pci_set_region (hose->regions + 1, |
| 413 | PCI_MSTR_MEM_BUS, |
| 414 | PCI_MSTR_MEM_LOCAL, |
| 415 | PCI_MSTR_MEM_SIZE, PCI_REGION_MEM); |
wdenk | bf2f8c9 | 2003-05-22 22:52:13 +0000 | [diff] [blame] | 416 | #endif |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 417 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 418 | /* PCI I/O space */ |
| 419 | pci_set_region (hose->regions + 2, |
| 420 | PCI_MSTR_IO_BUS, |
| 421 | PCI_MSTR_IO_LOCAL, PCI_MSTR_IO_SIZE, PCI_REGION_IO); |
| 422 | |
| 423 | hose->region_count = 3; |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 424 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 425 | pci_register_hose (hose); |
| 426 | /* Mask off master abort machine checks */ |
| 427 | immap->im_pci.pci_emr &= cpu_to_le32 (~PCI_ERROR_PCI_NO_RSP); |
| 428 | eieio (); |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 429 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 430 | hose->last_busno = pci_hose_scan (hose); |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 431 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 432 | |
| 433 | /* clear the error in the error status register */ |
| 434 | immap->im_pci.pci_esr = cpu_to_le32 (PCI_ERROR_PCI_NO_RSP); |
| 435 | |
| 436 | /* unmask master abort machine checks */ |
| 437 | immap->im_pci.pci_emr |= cpu_to_le32 (PCI_ERROR_PCI_NO_RSP); |
wdenk | 2853603 | 2003-03-25 16:50:56 +0000 | [diff] [blame] | 438 | } |
| 439 | |
Matvejchikov Ilya | 8743c79 | 2008-07-06 13:57:00 +0400 | [diff] [blame] | 440 | #if defined(CONFIG_OF_LIBFDT) |
| 441 | void ft_pci_setup(void *blob, bd_t *bd) |
| 442 | { |
| 443 | do_fixup_by_prop_u32(blob, "device_type", "pci", 4, |
Wolfgang Denk | 20de6ac | 2008-08-12 12:10:11 +0200 | [diff] [blame] | 444 | "clock-frequency", gd->pci_clk, 1); |
Matvejchikov Ilya | 8743c79 | 2008-07-06 13:57:00 +0400 | [diff] [blame] | 445 | } |
| 446 | #endif |
| 447 | |
wdenk | 56ed43e | 2004-02-22 23:46:08 +0000 | [diff] [blame] | 448 | #endif /* CONFIG_PCI */ |