aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bcma/main.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2011-08-22 14:28:50 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-22 14:28:50 -0400
commitb38d355eaa223e420d0c45ff7a3279ea811552c5 (patch)
tree4a6b3341e1b8b72afdc19e3b9bfe8c40219c04aa /drivers/bcma/main.c
parentca1ba7caa68520864e4b9227e67f3bbc6fed373b (diff)
parentaf2bf4b4ee58d262a9a5c1d4ce6f81835058f8b5 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Conflicts: drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c drivers/staging/ath6kl/os/linux/ar6000_drv.c
Diffstat (limited to 'drivers/bcma/main.c')
-rw-r--r--drivers/bcma/main.c70
1 files changed, 69 insertions, 1 deletions
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index 873e2e4ac55f..7072216a2a3f 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -66,6 +66,10 @@ static struct bcma_device *bcma_find_core(struct bcma_bus *bus, u16 coreid)
66static void bcma_release_core_dev(struct device *dev) 66static void bcma_release_core_dev(struct device *dev)
67{ 67{
68 struct bcma_device *core = container_of(dev, struct bcma_device, dev); 68 struct bcma_device *core = container_of(dev, struct bcma_device, dev);
69 if (core->io_addr)
70 iounmap(core->io_addr);
71 if (core->io_wrap)
72 iounmap(core->io_wrap);
69 kfree(core); 73 kfree(core);
70} 74}
71 75
@@ -80,6 +84,7 @@ static int bcma_register_cores(struct bcma_bus *bus)
80 case BCMA_CORE_CHIPCOMMON: 84 case BCMA_CORE_CHIPCOMMON:
81 case BCMA_CORE_PCI: 85 case BCMA_CORE_PCI:
82 case BCMA_CORE_PCIE: 86 case BCMA_CORE_PCIE:
87 case BCMA_CORE_MIPS_74K:
83 continue; 88 continue;
84 } 89 }
85 90
@@ -93,7 +98,10 @@ static int bcma_register_cores(struct bcma_bus *bus)
93 core->dma_dev = &bus->host_pci->dev; 98 core->dma_dev = &bus->host_pci->dev;
94 core->irq = bus->host_pci->irq; 99 core->irq = bus->host_pci->irq;
95 break; 100 break;
96 case BCMA_HOSTTYPE_NONE: 101 case BCMA_HOSTTYPE_SOC:
102 core->dev.dma_mask = &core->dev.coherent_dma_mask;
103 core->dma_dev = &core->dev;
104 break;
97 case BCMA_HOSTTYPE_SDIO: 105 case BCMA_HOSTTYPE_SDIO:
98 break; 106 break;
99 } 107 }
@@ -140,6 +148,13 @@ int bcma_bus_register(struct bcma_bus *bus)
140 bcma_core_chipcommon_init(&bus->drv_cc); 148 bcma_core_chipcommon_init(&bus->drv_cc);
141 } 149 }
142 150
151 /* Init MIPS core */
152 core = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
153 if (core) {
154 bus->drv_mips.core = core;
155 bcma_core_mips_init(&bus->drv_mips);
156 }
157
143 /* Init PCIE core */ 158 /* Init PCIE core */
144 core = bcma_find_core(bus, BCMA_CORE_PCIE); 159 core = bcma_find_core(bus, BCMA_CORE_PCIE);
145 if (core) { 160 if (core) {
@@ -169,6 +184,59 @@ void bcma_bus_unregister(struct bcma_bus *bus)
169 bcma_unregister_cores(bus); 184 bcma_unregister_cores(bus);
170} 185}
171 186
187int __init bcma_bus_early_register(struct bcma_bus *bus,
188 struct bcma_device *core_cc,
189 struct bcma_device *core_mips)
190{
191 int err;
192 struct bcma_device *core;
193 struct bcma_device_id match;
194
195 bcma_init_bus(bus);
196
197 match.manuf = BCMA_MANUF_BCM;
198 match.id = BCMA_CORE_CHIPCOMMON;
199 match.class = BCMA_CL_SIM;
200 match.rev = BCMA_ANY_REV;
201
202 /* Scan for chip common core */
203 err = bcma_bus_scan_early(bus, &match, core_cc);
204 if (err) {
205 pr_err("Failed to scan for common core: %d\n", err);
206 return -1;
207 }
208
209 match.manuf = BCMA_MANUF_MIPS;
210 match.id = BCMA_CORE_MIPS_74K;
211 match.class = BCMA_CL_SIM;
212 match.rev = BCMA_ANY_REV;
213
214 /* Scan for mips core */
215 err = bcma_bus_scan_early(bus, &match, core_mips);
216 if (err) {
217 pr_err("Failed to scan for mips core: %d\n", err);
218 return -1;
219 }
220
221 /* Init CC core */
222 core = bcma_find_core(bus, BCMA_CORE_CHIPCOMMON);
223 if (core) {
224 bus->drv_cc.core = core;
225 bcma_core_chipcommon_init(&bus->drv_cc);
226 }
227
228 /* Init MIPS core */
229 core = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
230 if (core) {
231 bus->drv_mips.core = core;
232 bcma_core_mips_init(&bus->drv_mips);
233 }
234
235 pr_info("Early bus registered\n");
236
237 return 0;
238}
239
172int __bcma_driver_register(struct bcma_driver *drv, struct module *owner) 240int __bcma_driver_register(struct bcma_driver *drv, struct module *owner)
173{ 241{
174 drv->drv.name = drv->name; 242 drv->drv.name = drv->name;