Skip to content

Commit 2a9effc

Browse files
Yoichi Yuasaralfbaechle
authored andcommitted
[MIPS] Cobalt: Split PCI codes from setup.c
It's removed #ifdef CONFIG_PCI/#endif from cobalt setup.c . Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent cc50b67 commit 2a9effc

3 files changed

Lines changed: 48 additions & 28 deletions

File tree

‎arch/mips/cobalt/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44

55
obj-y := irq.o reset.o setup.o
66

7+
obj-$(CONFIG_PCI) += pci.o
78
obj-$(CONFIG_EARLY_PRINTK) += console.o
89
obj-$(CONFIG_MTD_PHYSMAP) += mtd.o

‎arch/mips/cobalt/pci.c‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Register PCI controller.
3+
*
4+
* This file is subject to the terms and conditions of the GNU General Public
5+
* License. See the file "COPYING" in the main directory of this archive
6+
* for more details.
7+
*
8+
* Copyright (C) 1996, 1997, 2004, 05 by Ralf Baechle (ralf@linux-mips.org)
9+
* Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv)
10+
*
11+
*/
12+
#include <linux/init.h>
13+
#include <linux/pci.h>
14+
15+
#include <asm/gt64120.h>
16+
17+
extern struct pci_ops gt64111_pci_ops;
18+
19+
static struct resource cobalt_mem_resource = {
20+
.start = GT_DEF_PCI0_MEM0_BASE,
21+
.end = GT_DEF_PCI0_MEM0_BASE + GT_DEF_PCI0_MEM0_SIZE - 1,
22+
.name = "PCI memory",
23+
.flags = IORESOURCE_MEM,
24+
};
25+
26+
static struct resource cobalt_io_resource = {
27+
.start = 0x1000,
28+
.end = GT_DEF_PCI0_IO_SIZE - 1,
29+
.name = "PCI I/O",
30+
.flags = IORESOURCE_IO,
31+
};
32+
33+
static struct pci_controller cobalt_pci_controller = {
34+
.pci_ops = &gt64111_pci_ops,
35+
.mem_resource = &cobalt_mem_resource,
36+
.io_resource = &cobalt_io_resource,
37+
.io_offset = 0 - GT_DEF_PCI0_IO_BASE,
38+
};
39+
40+
static int __init cobalt_pci_init(void)
41+
{
42+
register_pci_controller(&cobalt_pci_controller);
43+
44+
return 0;
45+
}
46+
47+
arch_initcall(cobalt_pci_init);

‎arch/mips/cobalt/setup.c‎

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,6 @@ void __init plat_timer_setup(struct irqaction *irq)
6161
GT_WRITE(GT_INTRMASK_OFS, GT_INTR_T0EXP_MSK | GT_READ(GT_INTRMASK_OFS));
6262
}
6363

64-
extern struct pci_ops gt64111_pci_ops;
65-
66-
static struct resource cobalt_mem_resource = {
67-
.start = GT_DEF_PCI0_MEM0_BASE,
68-
.end = GT_DEF_PCI0_MEM0_BASE + GT_DEF_PCI0_MEM0_SIZE - 1,
69-
.name = "PCI memory",
70-
.flags = IORESOURCE_MEM
71-
};
72-
73-
static struct resource cobalt_io_resource = {
74-
.start = 0x1000,
75-
.end = 0xffff,
76-
.name = "PCI I/O",
77-
.flags = IORESOURCE_IO
78-
};
79-
8064
/*
8165
* Cobalt doesn't have PS/2 keyboard/mouse interfaces,
8266
* keyboard conntroller is never used.
@@ -109,14 +93,6 @@ static struct resource cobalt_reserved_resources[] = {
10993
},
11094
};
11195

112-
static struct pci_controller cobalt_pci_controller = {
113-
.pci_ops = &gt64111_pci_ops,
114-
.mem_resource = &cobalt_mem_resource,
115-
.mem_offset = 0,
116-
.io_resource = &cobalt_io_resource,
117-
.io_offset = 0 - GT_DEF_PCI0_IO_BASE,
118-
};
119-
12096
void __init plat_mem_setup(void)
12197
{
12298
static struct uart_port uart;
@@ -144,10 +120,6 @@ void __init plat_mem_setup(void)
144120

145121
printk("Cobalt board ID: %d\n", cobalt_board_id);
146122

147-
#ifdef CONFIG_PCI
148-
register_pci_controller(&cobalt_pci_controller);
149-
#endif
150-
151123
if (cobalt_board_id > COBALT_BRD_ID_RAQ1) {
152124
#ifdef CONFIG_SERIAL_8250
153125
uart.line = 0;

0 commit comments

Comments
 (0)