diff options
author | Paul Mundt <lethal@linux-sh.org> | 2006-09-27 02:59:17 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2006-09-27 02:59:17 -0400 |
commit | 5283ecb5ccbdb90d49fce6488d3944bba63a591c (patch) | |
tree | a58e20bd532fa5f933d099bb7b5dd0637b581d33 /arch/sh/drivers/pci/pci-auto.c | |
parent | d7c30c682a278abe1a52db83f69efec1a9d8f8c2 (diff) |
sh: Add support for R7780RP and R7780MP boards.
This adds support for the Renesas SH7780 development boards,
R7780RP and R7780MP.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/drivers/pci/pci-auto.c')
-rw-r--r-- | arch/sh/drivers/pci/pci-auto.c | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/arch/sh/drivers/pci/pci-auto.c b/arch/sh/drivers/pci/pci-auto.c index 4cef4d1d8c84..d55e46618549 100644 --- a/arch/sh/drivers/pci/pci-auto.c +++ b/arch/sh/drivers/pci/pci-auto.c | |||
@@ -45,11 +45,11 @@ | |||
45 | #include <linux/types.h> | 45 | #include <linux/types.h> |
46 | #include <linux/pci.h> | 46 | #include <linux/pci.h> |
47 | 47 | ||
48 | #undef DEBUG | 48 | #define DEBUG |
49 | #ifdef DEBUG | 49 | #ifdef DEBUG |
50 | #define DBG(x...) printk(x) | 50 | #define DBG(x...) printk(x) |
51 | #else | 51 | #else |
52 | #define DBG(x...) | 52 | #define DBG(x...) |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | /* | 55 | /* |
@@ -102,7 +102,7 @@ static u32 pciauto_upper_iospc; | |||
102 | static u32 pciauto_lower_memspc; | 102 | static u32 pciauto_lower_memspc; |
103 | static u32 pciauto_upper_memspc; | 103 | static u32 pciauto_upper_memspc; |
104 | 104 | ||
105 | static void __init | 105 | static void __init |
106 | pciauto_setup_bars(struct pci_channel *hose, | 106 | pciauto_setup_bars(struct pci_channel *hose, |
107 | int top_bus, | 107 | int top_bus, |
108 | int current_bus, | 108 | int current_bus, |
@@ -116,7 +116,6 @@ pciauto_setup_bars(struct pci_channel *hose, | |||
116 | int found_mem64 = 0; | 116 | int found_mem64 = 0; |
117 | 117 | ||
118 | for (bar = PCI_BASE_ADDRESS_0; bar <= bar_limit; bar+=4) { | 118 | for (bar = PCI_BASE_ADDRESS_0; bar <= bar_limit; bar+=4) { |
119 | #if !defined(CONFIG_SH_HS7751RVOIP) && !defined(CONFIG_SH_RTS7751R2D) | ||
120 | u32 bar_addr; | 119 | u32 bar_addr; |
121 | 120 | ||
122 | /* Read the old BAR value */ | 121 | /* Read the old BAR value */ |
@@ -125,7 +124,6 @@ pciauto_setup_bars(struct pci_channel *hose, | |||
125 | pci_devfn, | 124 | pci_devfn, |
126 | bar, | 125 | bar, |
127 | &bar_addr); | 126 | &bar_addr); |
128 | #endif | ||
129 | 127 | ||
130 | /* Tickle the BAR and get the response */ | 128 | /* Tickle the BAR and get the response */ |
131 | early_write_config_dword(hose, top_bus, | 129 | early_write_config_dword(hose, top_bus, |
@@ -140,8 +138,7 @@ pciauto_setup_bars(struct pci_channel *hose, | |||
140 | bar, | 138 | bar, |
141 | &bar_response); | 139 | &bar_response); |
142 | 140 | ||
143 | #if !defined(CONFIG_SH_HS7751RVOIP) && !defined(CONFIG_SH_RTS7751R2D) | 141 | /* |
144 | /* | ||
145 | * Write the old BAR value back out, only update the BAR | 142 | * Write the old BAR value back out, only update the BAR |
146 | * if we implicitly want resources to be updated, which | 143 | * if we implicitly want resources to be updated, which |
147 | * is done by the generic code further down. -- PFM. | 144 | * is done by the generic code further down. -- PFM. |
@@ -151,7 +148,6 @@ pciauto_setup_bars(struct pci_channel *hose, | |||
151 | pci_devfn, | 148 | pci_devfn, |
152 | bar, | 149 | bar, |
153 | bar_addr); | 150 | bar_addr); |
154 | #endif | ||
155 | 151 | ||
156 | /* If BAR is not implemented go to the next BAR */ | 152 | /* If BAR is not implemented go to the next BAR */ |
157 | if (!bar_response) | 153 | if (!bar_response) |
@@ -177,7 +173,7 @@ retry: | |||
177 | PCI_BASE_ADDRESS_MEM_TYPE_64) | 173 | PCI_BASE_ADDRESS_MEM_TYPE_64) |
178 | found_mem64 = 1; | 174 | found_mem64 = 1; |
179 | 175 | ||
180 | addr_mask = PCI_BASE_ADDRESS_MEM_MASK; | 176 | addr_mask = PCI_BASE_ADDRESS_MEM_MASK; |
181 | upper_limit = &pciauto_upper_memspc; | 177 | upper_limit = &pciauto_upper_memspc; |
182 | lower_limit = &pciauto_lower_memspc; | 178 | lower_limit = &pciauto_lower_memspc; |
183 | DBG(" Mem"); | 179 | DBG(" Mem"); |
@@ -193,22 +189,22 @@ retry: | |||
193 | if ((bar_value + bar_size) > *upper_limit) { | 189 | if ((bar_value + bar_size) > *upper_limit) { |
194 | if (bar_response & PCI_BASE_ADDRESS_SPACE) { | 190 | if (bar_response & PCI_BASE_ADDRESS_SPACE) { |
195 | if (io_resource_inuse->child) { | 191 | if (io_resource_inuse->child) { |
196 | io_resource_inuse = | 192 | io_resource_inuse = |
197 | io_resource_inuse->child; | 193 | io_resource_inuse->child; |
198 | pciauto_lower_iospc = | 194 | pciauto_lower_iospc = |
199 | io_resource_inuse->start; | 195 | io_resource_inuse->start; |
200 | pciauto_upper_iospc = | 196 | pciauto_upper_iospc = |
201 | io_resource_inuse->end + 1; | 197 | io_resource_inuse->end + 1; |
202 | goto retry; | 198 | goto retry; |
203 | } | 199 | } |
204 | 200 | ||
205 | } else { | 201 | } else { |
206 | if (mem_resource_inuse->child) { | 202 | if (mem_resource_inuse->child) { |
207 | mem_resource_inuse = | 203 | mem_resource_inuse = |
208 | mem_resource_inuse->child; | 204 | mem_resource_inuse->child; |
209 | pciauto_lower_memspc = | 205 | pciauto_lower_memspc = |
210 | mem_resource_inuse->start; | 206 | mem_resource_inuse->start; |
211 | pciauto_upper_memspc = | 207 | pciauto_upper_memspc = |
212 | mem_resource_inuse->end + 1; | 208 | mem_resource_inuse->end + 1; |
213 | goto retry; | 209 | goto retry; |
214 | } | 210 | } |
@@ -230,7 +226,7 @@ retry: | |||
230 | * If we are a 64-bit decoder then increment to the | 226 | * If we are a 64-bit decoder then increment to the |
231 | * upper 32 bits of the bar and force it to locate | 227 | * upper 32 bits of the bar and force it to locate |
232 | * in the lower 4GB of memory. | 228 | * in the lower 4GB of memory. |
233 | */ | 229 | */ |
234 | if (found_mem64) { | 230 | if (found_mem64) { |
235 | bar += 4; | 231 | bar += 4; |
236 | early_write_config_dword(hose, top_bus, | 232 | early_write_config_dword(hose, top_bus, |
@@ -362,7 +358,7 @@ pciauto_postscan_setup_cardbus_bridge(struct pci_channel *hose, | |||
362 | { | 358 | { |
363 | u32 temp; | 359 | u32 temp; |
364 | 360 | ||
365 | #if !defined(CONFIG_SH_HS7751RVOIP) && !defined(CONFIG_SH_RTS7751R2D) | 361 | #if !defined(CONFIG_SH_HS7751RVOIP) && !defined(CONFIG_SH_RTS7751R2D) && !defined(CONFIG_SH_R7780RP) |
366 | /* | 362 | /* |
367 | * [jsun] we always bump up baselines a little, so that if there | 363 | * [jsun] we always bump up baselines a little, so that if there |
368 | * nothing behind P2P bridge, we don't wind up overlapping IO/MEM | 364 | * nothing behind P2P bridge, we don't wind up overlapping IO/MEM |
@@ -396,7 +392,7 @@ pciauto_postscan_setup_cardbus_bridge(struct pci_channel *hose, | |||
396 | * configured by this routine to happily live behind a | 392 | * configured by this routine to happily live behind a |
397 | * P2P bridge in a system. | 393 | * P2P bridge in a system. |
398 | */ | 394 | */ |
399 | #if defined(CONFIG_SH_HS7751RVOIP) || defined(CONFIG_SH_RTS7751R2D) | 395 | #if defined(CONFIG_SH_HS7751RVOIP) || defined(CONFIG_SH_RTS7751R2D) || defined(CONFIG_SH_R7780RP) |
400 | pciauto_lower_memspc += 0x00400000; | 396 | pciauto_lower_memspc += 0x00400000; |
401 | pciauto_lower_iospc += 0x00004000; | 397 | pciauto_lower_iospc += 0x00004000; |
402 | #endif | 398 | #endif |
@@ -433,12 +429,12 @@ pciauto_bus_scan(struct pci_channel *hose, int top_bus, int current_bus) | |||
433 | int devfn_stop = 0xff; | 429 | int devfn_stop = 0xff; |
434 | 430 | ||
435 | sub_bus = current_bus; | 431 | sub_bus = current_bus; |
436 | 432 | ||
437 | if (hose->first_devfn) | 433 | if (hose->first_devfn) |
438 | devfn_start = hose->first_devfn; | 434 | devfn_start = hose->first_devfn; |
439 | if (hose->last_devfn) | 435 | if (hose->last_devfn) |
440 | devfn_stop = hose->last_devfn; | 436 | devfn_stop = hose->last_devfn; |
441 | 437 | ||
442 | for (pci_devfn=devfn_start; pci_devfn<devfn_stop; pci_devfn++) { | 438 | for (pci_devfn=devfn_start; pci_devfn<devfn_stop; pci_devfn++) { |
443 | 439 | ||
444 | if (PCI_FUNC(pci_devfn) && !found_multi) | 440 | if (PCI_FUNC(pci_devfn) && !found_multi) |
@@ -471,7 +467,7 @@ pciauto_bus_scan(struct pci_channel *hose, int top_bus, int current_bus) | |||
471 | if ((pci_class >> 16) == PCI_CLASS_BRIDGE_PCI) { | 467 | if ((pci_class >> 16) == PCI_CLASS_BRIDGE_PCI) { |
472 | DBG(" Bridge: primary=%.2x, secondary=%.2x\n", | 468 | DBG(" Bridge: primary=%.2x, secondary=%.2x\n", |
473 | current_bus, sub_bus + 1); | 469 | current_bus, sub_bus + 1); |
474 | #if defined(CONFIG_SH_HS7751RVOIP) || defined(CONFIG_SH_RTS7751R2D) | 470 | #if defined(CONFIG_SH_HS7751RVOIP) || defined(CONFIG_SH_RTS7751R2D) || defined(CONFIG_SH_R7780RP) |
475 | pciauto_setup_bars(hose, top_bus, current_bus, pci_devfn, PCI_BASE_ADDRESS_1); | 471 | pciauto_setup_bars(hose, top_bus, current_bus, pci_devfn, PCI_BASE_ADDRESS_1); |
476 | #endif | 472 | #endif |
477 | pciauto_prescan_setup_bridge(hose, top_bus, current_bus, | 473 | pciauto_prescan_setup_bridge(hose, top_bus, current_bus, |
@@ -490,10 +486,10 @@ pciauto_bus_scan(struct pci_channel *hose, int top_bus, int current_bus) | |||
490 | DBG("PCI Autoconfig: Found CardBus bridge, device %d function %d\n", PCI_SLOT(pci_devfn), PCI_FUNC(pci_devfn)); | 486 | DBG("PCI Autoconfig: Found CardBus bridge, device %d function %d\n", PCI_SLOT(pci_devfn), PCI_FUNC(pci_devfn)); |
491 | /* Place CardBus Socket/ExCA registers */ | 487 | /* Place CardBus Socket/ExCA registers */ |
492 | pciauto_setup_bars(hose, top_bus, current_bus, pci_devfn, PCI_BASE_ADDRESS_0); | 488 | pciauto_setup_bars(hose, top_bus, current_bus, pci_devfn, PCI_BASE_ADDRESS_0); |
493 | 489 | ||
494 | pciauto_prescan_setup_cardbus_bridge(hose, top_bus, | 490 | pciauto_prescan_setup_cardbus_bridge(hose, top_bus, |
495 | current_bus, pci_devfn, sub_bus); | 491 | current_bus, pci_devfn, sub_bus); |
496 | 492 | ||
497 | DBG("Scanning sub bus %.2x, I/O 0x%.8x, Mem 0x%.8x\n", | 493 | DBG("Scanning sub bus %.2x, I/O 0x%.8x, Mem 0x%.8x\n", |
498 | sub_bus + 1, | 494 | sub_bus + 1, |
499 | pciauto_lower_iospc, pciauto_lower_memspc); | 495 | pciauto_lower_iospc, pciauto_lower_memspc); |