aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2009-03-11 02:46:14 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-04-16 03:00:12 -0400
commitd0e3db40e2a1352aa2a2f425a7d4631bddc03d51 (patch)
tree275392db569a7f3808d8f86cfcb4874bfe81f997 /arch
parentb8b47bfbe4eb1ae0e6891e49c86a5f4fb00413be (diff)
sh: add init member to pci_channel data
This patch adds an init callback to struct pci_channel and makes sure it is initialized properly. Code is added to call this init function from pcibios_init(). Return values are adjusted and a warning is is printed if init fails. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/sh/boards/mach-dreamcast/setup.c6
-rw-r--r--arch/sh/drivers/pci/ops-cayman.c2
-rw-r--r--arch/sh/drivers/pci/ops-dreamcast.c18
-rw-r--r--arch/sh/drivers/pci/ops-landisk.c2
-rw-r--r--arch/sh/drivers/pci/ops-lboxre2.c2
-rw-r--r--arch/sh/drivers/pci/ops-r7780rp.c2
-rw-r--r--arch/sh/drivers/pci/ops-rts7751r2d.c2
-rw-r--r--arch/sh/drivers/pci/ops-sdk7780.c2
-rw-r--r--arch/sh/drivers/pci/ops-se7780.c2
-rw-r--r--arch/sh/drivers/pci/ops-sh03.c2
-rw-r--r--arch/sh/drivers/pci/ops-snapgear.c2
-rw-r--r--arch/sh/drivers/pci/ops-titan.c2
-rw-r--r--arch/sh/drivers/pci/pci-sh5.c6
-rw-r--r--arch/sh/drivers/pci/pci-sh5.h1
-rw-r--r--arch/sh/drivers/pci/pci-sh7751.c11
-rw-r--r--arch/sh/drivers/pci/pci-sh7751.h1
-rw-r--r--arch/sh/drivers/pci/pci-sh7780.c9
-rw-r--r--arch/sh/drivers/pci/pci-sh7780.h1
-rw-r--r--arch/sh/drivers/pci/pci.c23
-rw-r--r--arch/sh/include/asm/pci.h2
20 files changed, 56 insertions, 42 deletions
diff --git a/arch/sh/boards/mach-dreamcast/setup.c b/arch/sh/boards/mach-dreamcast/setup.c
index d1bee4884cd6..ebe99227d4e6 100644
--- a/arch/sh/boards/mach-dreamcast/setup.c
+++ b/arch/sh/boards/mach-dreamcast/setup.c
@@ -30,7 +30,6 @@
30 30
31extern struct irq_chip systemasic_int; 31extern struct irq_chip systemasic_int;
32extern void aica_time_init(void); 32extern void aica_time_init(void);
33extern int gapspci_init(void);
34extern int systemasic_irq_demux(int); 33extern int systemasic_irq_demux(int);
35 34
36static void __init dreamcast_setup(char **cmdline_p) 35static void __init dreamcast_setup(char **cmdline_p)
@@ -51,11 +50,6 @@ static void __init dreamcast_setup(char **cmdline_p)
51 handle_level_irq); 50 handle_level_irq);
52 51
53 board_time_init = aica_time_init; 52 board_time_init = aica_time_init;
54
55#ifdef CONFIG_PCI
56 if (gapspci_init() < 0)
57 printk(KERN_WARNING "GAPSPCI was not detected.\n");
58#endif
59} 53}
60 54
61static struct sh_machine_vector mv_dreamcast __initmv = { 55static struct sh_machine_vector mv_dreamcast __initmv = {
diff --git a/arch/sh/drivers/pci/ops-cayman.c b/arch/sh/drivers/pci/ops-cayman.c
index 38ef76207af6..f4a5e14f7e5a 100644
--- a/arch/sh/drivers/pci/ops-cayman.c
+++ b/arch/sh/drivers/pci/ops-cayman.c
@@ -77,7 +77,7 @@ int __init pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin)
77} 77}
78 78
79struct pci_channel board_pci_channels[] = { 79struct pci_channel board_pci_channels[] = {
80 { &sh5_pci_ops, NULL, NULL, 0, 0xff }, 80 { sh5_pci_init, &sh5_pci_ops, NULL, NULL, 0, 0xff },
81 { NULL, NULL, NULL, 0, 0 }, 81 { NULL, NULL, NULL, 0, 0 },
82}; 82};
83EXPORT_SYMBOL(board_pci_channels); 83EXPORT_SYMBOL(board_pci_channels);
diff --git a/arch/sh/drivers/pci/ops-dreamcast.c b/arch/sh/drivers/pci/ops-dreamcast.c
index f5d2a2aa6f3f..f62063eb6490 100644
--- a/arch/sh/drivers/pci/ops-dreamcast.c
+++ b/arch/sh/drivers/pci/ops-dreamcast.c
@@ -42,15 +42,6 @@ static struct resource gapspci_mem_resource = {
42 .flags = IORESOURCE_MEM, 42 .flags = IORESOURCE_MEM,
43}; 43};
44 44
45static struct pci_ops gapspci_pci_ops;
46
47struct pci_channel board_pci_channels[] = {
48 { &gapspci_pci_ops, &gapspci_io_resource,
49 &gapspci_mem_resource, 0, 1 },
50 { 0, }
51};
52EXPORT_SYMBOL(board_pci_channels);
53
54/* 45/*
55 * The !gapspci_config_access case really shouldn't happen, ever, unless 46 * The !gapspci_config_access case really shouldn't happen, ever, unless
56 * someone implicitly messes around with the last devfn value.. otherwise we 47 * someone implicitly messes around with the last devfn value.. otherwise we
@@ -116,7 +107,7 @@ static struct pci_ops gapspci_pci_ops = {
116 * gapspci init 107 * gapspci init
117 */ 108 */
118 109
119int __init gapspci_init(void) 110static int __init gapspci_init(struct pci_channel *chan)
120{ 111{
121 char idbuf[16]; 112 char idbuf[16];
122 int i; 113 int i;
@@ -168,3 +159,10 @@ char * __devinit pcibios_setup(char *str)
168{ 159{
169 return str; 160 return str;
170} 161}
162
163struct pci_channel board_pci_channels[] = {
164 { gapspci_init, &gapspci_pci_ops, &gapspci_io_resource,
165 &gapspci_mem_resource, 0, 1 },
166 { 0, }
167};
168EXPORT_SYMBOL(board_pci_channels);
diff --git a/arch/sh/drivers/pci/ops-landisk.c b/arch/sh/drivers/pci/ops-landisk.c
index 343c072a5a79..c46911d95eca 100644
--- a/arch/sh/drivers/pci/ops-landisk.c
+++ b/arch/sh/drivers/pci/ops-landisk.c
@@ -30,7 +30,7 @@ static struct resource sh7751_mem_resource = {
30}; 30};
31 31
32struct pci_channel board_pci_channels[] = { 32struct pci_channel board_pci_channels[] = {
33 {&sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0x3ff}, 33 { sh7751_pci_init, &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0x3ff},
34 {NULL, NULL, NULL, 0, 0}, 34 {NULL, NULL, NULL, 0, 0},
35}; 35};
36 36
diff --git a/arch/sh/drivers/pci/ops-lboxre2.c b/arch/sh/drivers/pci/ops-lboxre2.c
index 8bff32a22101..f606df2195c1 100644
--- a/arch/sh/drivers/pci/ops-lboxre2.c
+++ b/arch/sh/drivers/pci/ops-lboxre2.c
@@ -39,7 +39,7 @@ static struct resource sh7751_mem_resource = {
39extern struct pci_ops sh7751_pci_ops; 39extern struct pci_ops sh7751_pci_ops;
40 40
41struct pci_channel board_pci_channels[] = { 41struct pci_channel board_pci_channels[] = {
42 { &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff }, 42 { sh7751_pci_init, &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff },
43 { NULL, NULL, NULL, 0, 0 }, 43 { NULL, NULL, NULL, 0, 0 },
44}; 44};
45 45
diff --git a/arch/sh/drivers/pci/ops-r7780rp.c b/arch/sh/drivers/pci/ops-r7780rp.c
index bf32ee8b1321..b51b7e4078d0 100644
--- a/arch/sh/drivers/pci/ops-r7780rp.c
+++ b/arch/sh/drivers/pci/ops-r7780rp.c
@@ -43,7 +43,7 @@ static struct resource sh7780_mem_resource = {
43extern struct pci_ops sh7780_pci_ops; 43extern struct pci_ops sh7780_pci_ops;
44 44
45struct pci_channel board_pci_channels[] = { 45struct pci_channel board_pci_channels[] = {
46 { &sh4_pci_ops, &sh7780_io_resource, &sh7780_mem_resource, 0, 0xff }, 46 { sh7780_pci_init, &sh4_pci_ops, &sh7780_io_resource, &sh7780_mem_resource, 0, 0xff },
47 { NULL, NULL, NULL, 0, 0 }, 47 { NULL, NULL, NULL, 0, 0 },
48}; 48};
49EXPORT_SYMBOL(board_pci_channels); 49EXPORT_SYMBOL(board_pci_channels);
diff --git a/arch/sh/drivers/pci/ops-rts7751r2d.c b/arch/sh/drivers/pci/ops-rts7751r2d.c
index e4208a697321..fe5a231b8669 100644
--- a/arch/sh/drivers/pci/ops-rts7751r2d.c
+++ b/arch/sh/drivers/pci/ops-rts7751r2d.c
@@ -47,7 +47,7 @@ static struct resource sh7751_mem_resource = {
47extern struct pci_ops sh7751_pci_ops; 47extern struct pci_ops sh7751_pci_ops;
48 48
49struct pci_channel board_pci_channels[] = { 49struct pci_channel board_pci_channels[] = {
50 { &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff }, 50 { sh7751_pci_init, &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff },
51 { NULL, NULL, NULL, 0, 0 }, 51 { NULL, NULL, NULL, 0, 0 },
52}; 52};
53EXPORT_SYMBOL(board_pci_channels); 53EXPORT_SYMBOL(board_pci_channels);
diff --git a/arch/sh/drivers/pci/ops-sdk7780.c b/arch/sh/drivers/pci/ops-sdk7780.c
index 21d59d4a2150..7277cd15ae6a 100644
--- a/arch/sh/drivers/pci/ops-sdk7780.c
+++ b/arch/sh/drivers/pci/ops-sdk7780.c
@@ -49,7 +49,7 @@ static struct resource sdk7780_mem_resource = {
49}; 49};
50 50
51struct pci_channel board_pci_channels[] = { 51struct pci_channel board_pci_channels[] = {
52 { &sh4_pci_ops, &sdk7780_io_resource, &sdk7780_mem_resource, 0, 0xff }, 52 { sh7780_pci_init, &sh4_pci_ops, &sdk7780_io_resource, &sdk7780_mem_resource, 0, 0xff },
53 { NULL, NULL, NULL, 0, 0 }, 53 { NULL, NULL, NULL, 0, 0 },
54}; 54};
55EXPORT_SYMBOL(board_pci_channels); 55EXPORT_SYMBOL(board_pci_channels);
diff --git a/arch/sh/drivers/pci/ops-se7780.c b/arch/sh/drivers/pci/ops-se7780.c
index 78a6f2bc4f12..76a74fb42fb0 100644
--- a/arch/sh/drivers/pci/ops-se7780.c
+++ b/arch/sh/drivers/pci/ops-se7780.c
@@ -58,7 +58,7 @@ static struct resource se7780_mem_resource = {
58extern struct pci_ops se7780_pci_ops; 58extern struct pci_ops se7780_pci_ops;
59 59
60struct pci_channel board_pci_channels[] = { 60struct pci_channel board_pci_channels[] = {
61 { &sh4_pci_ops, &se7780_io_resource, &se7780_mem_resource, 0, 0xff }, 61 { sh7780_pci_init, &sh4_pci_ops, &se7780_io_resource, &se7780_mem_resource, 0, 0xff },
62 { NULL, NULL, NULL, 0, 0 }, 62 { NULL, NULL, NULL, 0, 0 },
63}; 63};
64EXPORT_SYMBOL(board_pci_channels); 64EXPORT_SYMBOL(board_pci_channels);
diff --git a/arch/sh/drivers/pci/ops-sh03.c b/arch/sh/drivers/pci/ops-sh03.c
index e1703ff5a4d2..0218135f0bb8 100644
--- a/arch/sh/drivers/pci/ops-sh03.c
+++ b/arch/sh/drivers/pci/ops-sh03.c
@@ -39,7 +39,7 @@ static struct resource sh7751_mem_resource = {
39extern struct pci_ops sh4_pci_ops; 39extern struct pci_ops sh4_pci_ops;
40 40
41struct pci_channel board_pci_channels[] = { 41struct pci_channel board_pci_channels[] = {
42 { &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff }, 42 { sh7751_pci_init, &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff },
43 { NULL, NULL, NULL, 0, 0 }, 43 { NULL, NULL, NULL, 0, 0 },
44}; 44};
45 45
diff --git a/arch/sh/drivers/pci/ops-snapgear.c b/arch/sh/drivers/pci/ops-snapgear.c
index cba80153dde9..2e254c6cf6c1 100644
--- a/arch/sh/drivers/pci/ops-snapgear.c
+++ b/arch/sh/drivers/pci/ops-snapgear.c
@@ -40,7 +40,7 @@ static struct resource sh7751_mem_resource = {
40}; 40};
41 41
42struct pci_channel board_pci_channels[] = { 42struct pci_channel board_pci_channels[] = {
43 { &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff }, 43 { sh7751_pci_init, &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff },
44 { 0, } 44 { 0, }
45}; 45};
46 46
diff --git a/arch/sh/drivers/pci/ops-titan.c b/arch/sh/drivers/pci/ops-titan.c
index 69fcc5c5d520..ffa79bdf4755 100644
--- a/arch/sh/drivers/pci/ops-titan.c
+++ b/arch/sh/drivers/pci/ops-titan.c
@@ -52,7 +52,7 @@ static struct resource sh7751_mem_resource = {
52}; 52};
53 53
54struct pci_channel board_pci_channels[] = { 54struct pci_channel board_pci_channels[] = {
55 { &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff }, 55 { sh7751_pci_init, &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff },
56 { NULL, NULL, NULL, 0, 0 }, 56 { NULL, NULL, NULL, 0, 0 },
57}; 57};
58EXPORT_SYMBOL(board_pci_channels); 58EXPORT_SYMBOL(board_pci_channels);
diff --git a/arch/sh/drivers/pci/pci-sh5.c b/arch/sh/drivers/pci/pci-sh5.c
index 7a97438762c8..008a02ec0d9f 100644
--- a/arch/sh/drivers/pci/pci-sh5.c
+++ b/arch/sh/drivers/pci/pci-sh5.c
@@ -27,6 +27,12 @@
27unsigned long pcicr_virt; 27unsigned long pcicr_virt;
28unsigned long PCI_IO_AREA; 28unsigned long PCI_IO_AREA;
29 29
30int __init sh5_pci_init(struct pci_channel *chan)
31{
32 pr_debug("PCI: Starting intialization.\n");
33 return pcibios_init_platform();
34}
35
30/* Rounds a number UP to the nearest power of two. Used for 36/* Rounds a number UP to the nearest power of two. Used for
31 * sizing the PCI window. 37 * sizing the PCI window.
32 */ 38 */
diff --git a/arch/sh/drivers/pci/pci-sh5.h b/arch/sh/drivers/pci/pci-sh5.h
index 7cff3fc04d30..af09f384c7d2 100644
--- a/arch/sh/drivers/pci/pci-sh5.h
+++ b/arch/sh/drivers/pci/pci-sh5.h
@@ -108,6 +108,7 @@ extern unsigned long pcicr_virt;
108extern struct pci_ops sh5_pci_ops; 108extern struct pci_ops sh5_pci_ops;
109 109
110/* arch/sh/drivers/pci/pci-sh5.c */ 110/* arch/sh/drivers/pci/pci-sh5.c */
111int sh5_pci_init(struct pci_channel *chan);
111int sh5pci_init(unsigned long memStart, unsigned long memSize); 112int sh5pci_init(unsigned long memStart, unsigned long memSize);
112 113
113#endif /* __PCI_SH5_H */ 114#endif /* __PCI_SH5_H */
diff --git a/arch/sh/drivers/pci/pci-sh7751.c b/arch/sh/drivers/pci/pci-sh7751.c
index 9c2c01490d62..230db8bd9744 100644
--- a/arch/sh/drivers/pci/pci-sh7751.c
+++ b/arch/sh/drivers/pci/pci-sh7751.c
@@ -32,7 +32,7 @@
32 * space mapping) will be called via the platform defined function 32 * space mapping) will be called via the platform defined function
33 * pcibios_init_platform(). 33 * pcibios_init_platform().
34 */ 34 */
35static int __init sh7751_pci_init(void) 35int __init sh7751_pci_init(struct pci_channel *chan)
36{ 36{
37 unsigned int id; 37 unsigned int id;
38 int ret; 38 int ret;
@@ -40,19 +40,18 @@ static int __init sh7751_pci_init(void)
40 pr_debug("PCI: Starting intialization.\n"); 40 pr_debug("PCI: Starting intialization.\n");
41 41
42 /* check for SH7751/SH7751R hardware */ 42 /* check for SH7751/SH7751R hardware */
43 id = pci_read_reg(NULL, SH7751_PCICONF0); 43 id = pci_read_reg(chan, SH7751_PCICONF0);
44 if (id != ((SH7751_DEVICE_ID << 16) | SH7751_VENDOR_ID) && 44 if (id != ((SH7751_DEVICE_ID << 16) | SH7751_VENDOR_ID) &&
45 id != ((SH7751R_DEVICE_ID << 16) | SH7751_VENDOR_ID)) { 45 id != ((SH7751R_DEVICE_ID << 16) | SH7751_VENDOR_ID)) {
46 pr_debug("PCI: This is not an SH7751(R) (%x)\n", id); 46 pr_debug("PCI: This is not an SH7751(R) (%x)\n", id);
47 return -ENODEV; 47 return -ENODEV;
48 } 48 }
49 49
50 if ((ret = sh4_pci_check_direct(NULL)) != 0) 50 if ((ret = sh4_pci_check_direct(chan)) != 0)
51 return ret; 51 return ret;
52 52
53 return pcibios_init_platform(); 53 return pcibios_init_platform();
54} 54}
55subsys_initcall(sh7751_pci_init);
56 55
57static int __init __area_sdram_check(struct pci_channel *chan, 56static int __init __area_sdram_check(struct pci_channel *chan,
58 unsigned int area) 57 unsigned int area)
@@ -178,7 +177,7 @@ int __init sh7751_pcic_init(struct pci_channel *chan,
178 } 177 }
179 178
180 if (!word) 179 if (!word)
181 return 0; 180 return -1;
182 181
183 /* configure the wait control registers */ 182 /* configure the wait control registers */
184 word = ctrl_inl(SH7751_WCR1); 183 word = ctrl_inl(SH7751_WCR1);
@@ -202,5 +201,5 @@ int __init sh7751_pcic_init(struct pci_channel *chan,
202 word = SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_ARBM; 201 word = SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_ARBM;
203 pci_write_reg(chan, word, SH4_PCICR); 202 pci_write_reg(chan, word, SH4_PCICR);
204 203
205 return 1; 204 return 0;
206} 205}
diff --git a/arch/sh/drivers/pci/pci-sh7751.h b/arch/sh/drivers/pci/pci-sh7751.h
index 6f101e5a6c83..0ea4387df136 100644
--- a/arch/sh/drivers/pci/pci-sh7751.h
+++ b/arch/sh/drivers/pci/pci-sh7751.h
@@ -130,6 +130,7 @@
130struct sh4_pci_address_map; 130struct sh4_pci_address_map;
131 131
132/* arch/sh/drivers/pci/pci-sh7751.c */ 132/* arch/sh/drivers/pci/pci-sh7751.c */
133int sh7751_pci_init(struct pci_channel *chan);
133int sh7751_pcic_init(struct pci_channel *chan, 134int sh7751_pcic_init(struct pci_channel *chan,
134 struct sh4_pci_address_map *map); 135 struct sh4_pci_address_map *map);
135 136
diff --git a/arch/sh/drivers/pci/pci-sh7780.c b/arch/sh/drivers/pci/pci-sh7780.c
index 56f673f66cb5..4706e880b087 100644
--- a/arch/sh/drivers/pci/pci-sh7780.c
+++ b/arch/sh/drivers/pci/pci-sh7780.c
@@ -45,7 +45,7 @@
45 * space mapping) will be called via the platform defined function 45 * space mapping) will be called via the platform defined function
46 * pcibios_init_platform(). 46 * pcibios_init_platform().
47 */ 47 */
48static int __init sh7780_pci_init(void) 48int __init sh7780_pci_init(struct pci_channel *chan)
49{ 49{
50 unsigned int id; 50 unsigned int id;
51 int ret, match = 0; 51 int ret, match = 0;
@@ -55,7 +55,7 @@ static int __init sh7780_pci_init(void)
55 ctrl_outl(0x00000001, SH7780_PCI_VCR2); /* Enable PCIC */ 55 ctrl_outl(0x00000001, SH7780_PCI_VCR2); /* Enable PCIC */
56 56
57 /* check for SH7780/SH7780R hardware */ 57 /* check for SH7780/SH7780R hardware */
58 id = pci_read_reg(NULL, SH7780_PCIVID); 58 id = pci_read_reg(chan, SH7780_PCIVID);
59 if ((id & 0xffff) == SH7780_VENDOR_ID) { 59 if ((id & 0xffff) == SH7780_VENDOR_ID) {
60 switch ((id >> 16) & 0xffff) { 60 switch ((id >> 16) & 0xffff) {
61 case SH7763_DEVICE_ID: 61 case SH7763_DEVICE_ID:
@@ -82,12 +82,11 @@ static int __init sh7780_pci_init(void)
82 ctrl_outl(0x33333333, INTC_INTPRI); 82 ctrl_outl(0x33333333, INTC_INTPRI);
83 } 83 }
84 84
85 if ((ret = sh4_pci_check_direct(NULL)) != 0) 85 if ((ret = sh4_pci_check_direct(chan)) != 0)
86 return ret; 86 return ret;
87 87
88 return pcibios_init_platform(); 88 return pcibios_init_platform();
89} 89}
90core_initcall(sh7780_pci_init);
91 90
92int __init sh7780_pcic_init(struct pci_channel *chan, 91int __init sh7780_pcic_init(struct pci_channel *chan,
93 struct sh4_pci_address_map *map) 92 struct sh4_pci_address_map *map)
@@ -153,5 +152,5 @@ int __init sh7780_pcic_init(struct pci_channel *chan,
153 word = SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_FTO; 152 word = SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_FTO;
154 pci_write_reg(chan, word, SH4_PCICR); 153 pci_write_reg(chan, word, SH4_PCICR);
155 154
156 return 1; 155 return 0;
157} 156}
diff --git a/arch/sh/drivers/pci/pci-sh7780.h b/arch/sh/drivers/pci/pci-sh7780.h
index d34961153d58..2f3c92065ec3 100644
--- a/arch/sh/drivers/pci/pci-sh7780.h
+++ b/arch/sh/drivers/pci/pci-sh7780.h
@@ -109,6 +109,7 @@
109struct sh4_pci_address_map; 109struct sh4_pci_address_map;
110 110
111/* arch/sh/drivers/pci/pci-sh7780.c */ 111/* arch/sh/drivers/pci/pci-sh7780.c */
112int sh7780_pci_init(struct pci_channel *chan);
112int sh7780_pcic_init(struct pci_channel *chan, 113int sh7780_pcic_init(struct pci_channel *chan,
113 struct sh4_pci_address_map *map); 114 struct sh4_pci_address_map *map);
114 115
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 0d6ac7a1db49..29ec16e69afa 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -28,18 +28,31 @@ static int __init pcibios_init(void)
28 struct pci_bus *bus; 28 struct pci_bus *bus;
29 int busno; 29 int busno;
30 30
31 /* init channels */
32 busno = 0;
33 for (p = board_pci_channels; p->init; p++) {
34 if (p->init(p) == 0)
35 p->enabled = 1;
36 else
37 pr_err("Unable to init pci channel %d\n", busno);
38 busno++;
39 }
40
31#ifdef CONFIG_PCI_AUTO 41#ifdef CONFIG_PCI_AUTO
32 /* assign resources */ 42 /* assign resources */
33 busno = 0; 43 busno = 0;
34 for (p = board_pci_channels; p->pci_ops != NULL; p++) 44 for (p = board_pci_channels; p->init; p++)
35 busno = pciauto_assign_resources(busno, p) + 1; 45 if (p->enabled)
46 busno = pciauto_assign_resources(busno, p) + 1;
36#endif 47#endif
37 48
38 /* scan the buses */ 49 /* scan the buses */
39 busno = 0; 50 busno = 0;
40 for (p = board_pci_channels; p->pci_ops != NULL; p++) { 51 for (p = board_pci_channels; p->init; p++) {
41 bus = pci_scan_bus(busno, p->pci_ops, p); 52 if (p->enabled) {
42 busno = bus->subordinate + 1; 53 bus = pci_scan_bus(busno, p->pci_ops, p);
54 busno = bus->subordinate + 1;
55 }
43 } 56 }
44 57
45 pci_fixup_irqs(pci_common_swizzle, pcibios_map_platform_irq); 58 pci_fixup_irqs(pci_common_swizzle, pcibios_map_platform_irq);
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index df1d383e18a5..5c7a8f1d2d54 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -17,11 +17,13 @@
17 * external) PCI controllers. 17 * external) PCI controllers.
18 */ 18 */
19struct pci_channel { 19struct pci_channel {
20 int (*init)(struct pci_channel *chan);
20 struct pci_ops *pci_ops; 21 struct pci_ops *pci_ops;
21 struct resource *io_resource; 22 struct resource *io_resource;
22 struct resource *mem_resource; 23 struct resource *mem_resource;
23 int first_devfn; 24 int first_devfn;
24 int last_devfn; 25 int last_devfn;
26 int enabled;
25}; 27};
26 28
27/* 29/*