diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-01-31 23:11:25 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-01-31 23:11:25 -0500 |
commit | bcf39352eb9e9026f7a1028d4bce3707b65f104b (patch) | |
tree | 440794a7fe888c48bfb49bdd994873ae8a136866 /arch/sh/drivers/pci | |
parent | 85b59f5bb24aeca1a987cbb206e228bf630c8327 (diff) |
sh: Handle PCI controller resource conflicts.
register_pci_controller() can fail, but presently is a void function.
Change this over to an int so that we can bail early before continuing on
with post-registration initialization (such as throwing the controller in
to 66MHz mode in the case of the SH7780 host controller).
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/drivers/pci')
-rw-r--r-- | arch/sh/drivers/pci/pci-dreamcast.c | 4 | ||||
-rw-r--r-- | arch/sh/drivers/pci/pci-sh5.c | 4 | ||||
-rw-r--r-- | arch/sh/drivers/pci/pci-sh7751.c | 4 | ||||
-rw-r--r-- | arch/sh/drivers/pci/pci-sh7780.c | 5 | ||||
-rw-r--r-- | arch/sh/drivers/pci/pci.c | 5 | ||||
-rw-r--r-- | arch/sh/drivers/pci/pcie-sh7786.c | 4 |
6 files changed, 11 insertions, 15 deletions
diff --git a/arch/sh/drivers/pci/pci-dreamcast.c b/arch/sh/drivers/pci/pci-dreamcast.c index 210f9d4af141..bd5a1e50ebf6 100644 --- a/arch/sh/drivers/pci/pci-dreamcast.c +++ b/arch/sh/drivers/pci/pci-dreamcast.c | |||
@@ -95,8 +95,6 @@ static int __init gapspci_init(void) | |||
95 | outl(0x00002001, GAPSPCI_BBA_CONFIG+0x10); | 95 | outl(0x00002001, GAPSPCI_BBA_CONFIG+0x10); |
96 | outl(0x01000000, GAPSPCI_BBA_CONFIG+0x14); | 96 | outl(0x01000000, GAPSPCI_BBA_CONFIG+0x14); |
97 | 97 | ||
98 | register_pci_controller(&dreamcast_pci_controller); | 98 | return register_pci_controller(&dreamcast_pci_controller); |
99 | |||
100 | return 0; | ||
101 | } | 99 | } |
102 | arch_initcall(gapspci_init); | 100 | arch_initcall(gapspci_init); |
diff --git a/arch/sh/drivers/pci/pci-sh5.c b/arch/sh/drivers/pci/pci-sh5.c index 873ed2b44055..bce73faabc88 100644 --- a/arch/sh/drivers/pci/pci-sh5.c +++ b/arch/sh/drivers/pci/pci-sh5.c | |||
@@ -216,8 +216,6 @@ static int __init sh5pci_init(void) | |||
216 | sh5_mem_resource.start = memStart; | 216 | sh5_mem_resource.start = memStart; |
217 | sh5_mem_resource.end = memStart + memSize; | 217 | sh5_mem_resource.end = memStart + memSize; |
218 | 218 | ||
219 | register_pci_controller(&sh5pci_controller); | 219 | return register_pci_controller(&sh5pci_controller); |
220 | |||
221 | return 0; | ||
222 | } | 220 | } |
223 | arch_initcall(sh5pci_init); | 221 | arch_initcall(sh5pci_init); |
diff --git a/arch/sh/drivers/pci/pci-sh7751.c b/arch/sh/drivers/pci/pci-sh7751.c index 02306ddb4011..6ad5beb524aa 100644 --- a/arch/sh/drivers/pci/pci-sh7751.c +++ b/arch/sh/drivers/pci/pci-sh7751.c | |||
@@ -176,8 +176,6 @@ static int __init sh7751_pci_init(void) | |||
176 | word = SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_ARBM; | 176 | word = SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_ARBM; |
177 | pci_write_reg(chan, word, SH4_PCICR); | 177 | pci_write_reg(chan, word, SH4_PCICR); |
178 | 178 | ||
179 | register_pci_controller(chan); | 179 | return register_pci_controller(chan); |
180 | |||
181 | return 0; | ||
182 | } | 180 | } |
183 | arch_initcall(sh7751_pci_init); | 181 | arch_initcall(sh7751_pci_init); |
diff --git a/arch/sh/drivers/pci/pci-sh7780.c b/arch/sh/drivers/pci/pci-sh7780.c index b68f45b6451a..0e0ddd67e6e1 100644 --- a/arch/sh/drivers/pci/pci-sh7780.c +++ b/arch/sh/drivers/pci/pci-sh7780.c | |||
@@ -71,6 +71,7 @@ static int __init sh7780_pci_init(void) | |||
71 | size_t memsize; | 71 | size_t memsize; |
72 | unsigned int id; | 72 | unsigned int id; |
73 | const char *type; | 73 | const char *type; |
74 | int ret; | ||
74 | 75 | ||
75 | printk(KERN_NOTICE "PCI: Starting intialization.\n"); | 76 | printk(KERN_NOTICE "PCI: Starting intialization.\n"); |
76 | 77 | ||
@@ -197,7 +198,9 @@ static int __init sh7780_pci_init(void) | |||
197 | __raw_writel(SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_FTO, | 198 | __raw_writel(SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_FTO, |
198 | chan->reg_base + SH4_PCICR); | 199 | chan->reg_base + SH4_PCICR); |
199 | 200 | ||
200 | register_pci_controller(chan); | 201 | ret = register_pci_controller(chan); |
202 | if (unlikely(ret)) | ||
203 | return ret; | ||
201 | 204 | ||
202 | sh7780_pci66_init(chan); | 205 | sh7780_pci66_init(chan); |
203 | 206 | ||
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c index 63b11fddffec..488331c45033 100644 --- a/arch/sh/drivers/pci/pci.c +++ b/arch/sh/drivers/pci/pci.c | |||
@@ -58,7 +58,7 @@ static void __devinit pcibios_scanbus(struct pci_channel *hose) | |||
58 | 58 | ||
59 | static DEFINE_MUTEX(pci_scan_mutex); | 59 | static DEFINE_MUTEX(pci_scan_mutex); |
60 | 60 | ||
61 | void __devinit register_pci_controller(struct pci_channel *hose) | 61 | int __devinit register_pci_controller(struct pci_channel *hose) |
62 | { | 62 | { |
63 | if (request_resource(&iomem_resource, hose->mem_resource) < 0) | 63 | if (request_resource(&iomem_resource, hose->mem_resource) < 0) |
64 | goto out; | 64 | goto out; |
@@ -88,10 +88,11 @@ void __devinit register_pci_controller(struct pci_channel *hose) | |||
88 | mutex_unlock(&pci_scan_mutex); | 88 | mutex_unlock(&pci_scan_mutex); |
89 | } | 89 | } |
90 | 90 | ||
91 | return; | 91 | return 0; |
92 | 92 | ||
93 | out: | 93 | out: |
94 | printk(KERN_WARNING "Skipping PCI bus scan due to resource conflict\n"); | 94 | printk(KERN_WARNING "Skipping PCI bus scan due to resource conflict\n"); |
95 | return -1; | ||
95 | } | 96 | } |
96 | 97 | ||
97 | static int __init pcibios_init(void) | 98 | static int __init pcibios_init(void) |
diff --git a/arch/sh/drivers/pci/pcie-sh7786.c b/arch/sh/drivers/pci/pcie-sh7786.c index ac37ee879bab..feac1fef21eb 100644 --- a/arch/sh/drivers/pci/pcie-sh7786.c +++ b/arch/sh/drivers/pci/pcie-sh7786.c | |||
@@ -296,9 +296,7 @@ static int __devinit sh7786_pcie_init_hw(struct sh7786_pcie_port *port) | |||
296 | if (unlikely(ret < 0)) | 296 | if (unlikely(ret < 0)) |
297 | return ret; | 297 | return ret; |
298 | 298 | ||
299 | register_pci_controller(port->hose); | 299 | return register_pci_controller(port->hose); |
300 | |||
301 | return 0; | ||
302 | } | 300 | } |
303 | 301 | ||
304 | static struct sh7786_pcie_hwops sh7786_65nm_pcie_hwops __initdata = { | 302 | static struct sh7786_pcie_hwops sh7786_65nm_pcie_hwops __initdata = { |