diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-04-20 05:29:22 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-04-20 05:29:22 -0400 |
commit | e79066a659b893debe19010179d3f3f015d76d1c (patch) | |
tree | 8827e8c43a49957a3dd01fd8b22dfa36c918a575 /arch/sh/drivers/pci/pci-sh7780.c | |
parent | 99f95f117848088f2708b45c70be73152e78bb8a (diff) |
sh: pci: New-style controller registration.
This moves off of the board_pci_channels[] approach for bus registration
and over to a cleaner register_pci_controller(), all derived from the
MIPS code.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/drivers/pci/pci-sh7780.c')
-rw-r--r-- | arch/sh/drivers/pci/pci-sh7780.c | 87 |
1 files changed, 40 insertions, 47 deletions
diff --git a/arch/sh/drivers/pci/pci-sh7780.c b/arch/sh/drivers/pci/pci-sh7780.c index f02d9dfcf252..4dd6e3b94a67 100644 --- a/arch/sh/drivers/pci/pci-sh7780.c +++ b/arch/sh/drivers/pci/pci-sh7780.c | |||
@@ -15,11 +15,47 @@ | |||
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include "pci-sh4.h" | 16 | #include "pci-sh4.h" |
17 | 17 | ||
18 | static int __init sh7780_pci_init(struct pci_channel *chan) | 18 | extern u8 pci_cache_line_size; |
19 | |||
20 | static struct resource sh7785_io_resource = { | ||
21 | .name = "SH7785_IO", | ||
22 | .start = SH7780_PCI_IO_BASE, | ||
23 | .end = SH7780_PCI_IO_BASE + SH7780_PCI_IO_SIZE - 1, | ||
24 | .flags = IORESOURCE_IO | ||
25 | }; | ||
26 | |||
27 | static struct resource sh7785_mem_resource = { | ||
28 | .name = "SH7785_mem", | ||
29 | .start = SH7780_PCI_MEMORY_BASE, | ||
30 | .end = SH7780_PCI_MEMORY_BASE + SH7780_PCI_MEM_SIZE - 1, | ||
31 | .flags = IORESOURCE_MEM | ||
32 | }; | ||
33 | |||
34 | static struct pci_channel sh7780_pci_controller = { | ||
35 | .pci_ops = &sh4_pci_ops, | ||
36 | .mem_resource = &sh7785_mem_resource, | ||
37 | .io_resource = &sh7785_io_resource, | ||
38 | }; | ||
39 | |||
40 | static struct sh4_pci_address_map sh7780_pci_map = { | ||
41 | .window0 = { | ||
42 | #if defined(CONFIG_32BIT) | ||
43 | .base = SH7780_32BIT_DDR_BASE_ADDR, | ||
44 | .size = 0x40000000, | ||
45 | #else | ||
46 | .base = SH7780_CS0_BASE_ADDR, | ||
47 | .size = 0x20000000, | ||
48 | #endif | ||
49 | }, | ||
50 | }; | ||
51 | |||
52 | static int __init sh7780_pci_init(void) | ||
19 | { | 53 | { |
54 | struct pci_channel *chan = &sh7780_pci_controller; | ||
20 | unsigned int id; | 55 | unsigned int id; |
21 | const char *type = NULL; | 56 | const char *type = NULL; |
22 | int ret; | 57 | int ret; |
58 | u32 word; | ||
23 | 59 | ||
24 | printk(KERN_NOTICE "PCI: Starting intialization.\n"); | 60 | printk(KERN_NOTICE "PCI: Starting intialization.\n"); |
25 | 61 | ||
@@ -55,52 +91,6 @@ static int __init sh7780_pci_init(struct pci_channel *chan) | |||
55 | return ret; | 91 | return ret; |
56 | 92 | ||
57 | /* | 93 | /* |
58 | * Platform specific initialization (BSC registers, and memory space | ||
59 | * mapping) will be called via the platform defined function | ||
60 | * pcibios_init_platform(). | ||
61 | */ | ||
62 | return pcibios_init_platform(); | ||
63 | } | ||
64 | |||
65 | extern u8 pci_cache_line_size; | ||
66 | |||
67 | static struct resource sh7785_io_resource = { | ||
68 | .name = "SH7785_IO", | ||
69 | .start = SH7780_PCI_IO_BASE, | ||
70 | .end = SH7780_PCI_IO_BASE + SH7780_PCI_IO_SIZE - 1, | ||
71 | .flags = IORESOURCE_IO | ||
72 | }; | ||
73 | |||
74 | static struct resource sh7785_mem_resource = { | ||
75 | .name = "SH7785_mem", | ||
76 | .start = SH7780_PCI_MEMORY_BASE, | ||
77 | .end = SH7780_PCI_MEMORY_BASE + SH7780_PCI_MEM_SIZE - 1, | ||
78 | .flags = IORESOURCE_MEM | ||
79 | }; | ||
80 | |||
81 | struct pci_channel board_pci_channels[] = { | ||
82 | { sh7780_pci_init, &sh4_pci_ops, &sh7785_io_resource, &sh7785_mem_resource, 0, 0xff }, | ||
83 | { NULL, NULL, NULL, 0, 0 }, | ||
84 | }; | ||
85 | |||
86 | static struct sh4_pci_address_map sh7780_pci_map = { | ||
87 | .window0 = { | ||
88 | #if defined(CONFIG_32BIT) | ||
89 | .base = SH7780_32BIT_DDR_BASE_ADDR, | ||
90 | .size = 0x40000000, | ||
91 | #else | ||
92 | .base = SH7780_CS0_BASE_ADDR, | ||
93 | .size = 0x20000000, | ||
94 | #endif | ||
95 | }, | ||
96 | }; | ||
97 | |||
98 | int __init pcibios_init_platform(void) | ||
99 | { | ||
100 | struct pci_channel *chan = &board_pci_channels[0]; | ||
101 | u32 word; | ||
102 | |||
103 | /* | ||
104 | * Set the class and sub-class codes. | 94 | * Set the class and sub-class codes. |
105 | */ | 95 | */ |
106 | __raw_writeb(PCI_CLASS_BRIDGE_HOST >> 8, | 96 | __raw_writeb(PCI_CLASS_BRIDGE_HOST >> 8, |
@@ -153,5 +143,8 @@ int __init pcibios_init_platform(void) | |||
153 | 143 | ||
154 | __set_io_port_base(SH7780_PCI_IO_BASE); | 144 | __set_io_port_base(SH7780_PCI_IO_BASE); |
155 | 145 | ||
146 | register_pci_controller(chan); | ||
147 | |||
156 | return 0; | 148 | return 0; |
157 | } | 149 | } |
150 | arch_initcall(sh7780_pci_init); | ||