diff options
Diffstat (limited to 'drivers/bcma/main.c')
| -rw-r--r-- | drivers/bcma/main.c | 84 | 
1 files changed, 69 insertions, 15 deletions
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index d865470bc95..9a6188add59 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c @@ -81,6 +81,18 @@ struct bcma_device *bcma_find_core(struct bcma_bus *bus, u16 coreid)  }  EXPORT_SYMBOL_GPL(bcma_find_core); +struct bcma_device *bcma_find_core_unit(struct bcma_bus *bus, u16 coreid, +					u8 unit) +{ +	struct bcma_device *core; + +	list_for_each_entry(core, &bus->cores, list) { +		if (core->id.id == coreid && core->core_unit == unit) +			return core; +	} +	return NULL; +} +  static void bcma_release_core_dev(struct device *dev)  {  	struct bcma_device *core = container_of(dev, struct bcma_device, dev); @@ -137,6 +149,14 @@ static int bcma_register_cores(struct bcma_bus *bus)  		dev_id++;  	} +#ifdef CONFIG_BCMA_DRIVER_MIPS +	if (bus->drv_cc.pflash.present) { +		err = platform_device_register(&bcma_pflash_dev); +		if (err) +			bcma_err(bus, "Error registering parallel flash\n"); +	} +#endif +  #ifdef CONFIG_BCMA_SFLASH  	if (bus->drv_cc.sflash.present) {  		err = platform_device_register(&bcma_sflash_dev); @@ -152,6 +172,17 @@ static int bcma_register_cores(struct bcma_bus *bus)  			bcma_err(bus, "Error registering NAND flash\n");  	}  #endif +	err = bcma_gpio_init(&bus->drv_cc); +	if (err == -ENOTSUPP) +		bcma_debug(bus, "GPIO driver not activated\n"); +	else if (err) +		bcma_err(bus, "Error registering GPIO driver: %i\n", err); + +	if (bus->hosttype == BCMA_HOSTTYPE_SOC) { +		err = bcma_chipco_watchdog_register(&bus->drv_cc); +		if (err) +			bcma_err(bus, "Error registering watchdog driver\n"); +	}  	return 0;  } @@ -165,9 +196,11 @@ static void bcma_unregister_cores(struct bcma_bus *bus)  		if (core->dev_registered)  			device_unregister(&core->dev);  	} +	if (bus->hosttype == BCMA_HOSTTYPE_SOC) +		platform_device_unregister(bus->drv_cc.watchdog);  } -int __devinit bcma_bus_register(struct bcma_bus *bus) +int bcma_bus_register(struct bcma_bus *bus)  {  	int err;  	struct bcma_device *core; @@ -183,6 +216,20 @@ int __devinit bcma_bus_register(struct bcma_bus *bus)  		return -1;  	} +	/* Early init CC core */ +	core = bcma_find_core(bus, bcma_cc_core_id(bus)); +	if (core) { +		bus->drv_cc.core = core; +		bcma_core_chipcommon_early_init(&bus->drv_cc); +	} + +	/* Try to get SPROM */ +	err = bcma_sprom_get(bus); +	if (err == -ENOENT) { +		bcma_err(bus, "No SPROM available\n"); +	} else if (err) +		bcma_err(bus, "Failed to get SPROM: %d\n", err); +  	/* Init CC core */  	core = bcma_find_core(bus, bcma_cc_core_id(bus));  	if (core) { @@ -198,10 +245,17 @@ int __devinit bcma_bus_register(struct bcma_bus *bus)  	}  	/* Init PCIE core */ -	core = bcma_find_core(bus, BCMA_CORE_PCIE); +	core = bcma_find_core_unit(bus, BCMA_CORE_PCIE, 0);  	if (core) { -		bus->drv_pci.core = core; -		bcma_core_pci_init(&bus->drv_pci); +		bus->drv_pci[0].core = core; +		bcma_core_pci_init(&bus->drv_pci[0]); +	} + +	/* Init PCIE core */ +	core = bcma_find_core_unit(bus, BCMA_CORE_PCIE, 1); +	if (core) { +		bus->drv_pci[1].core = core; +		bcma_core_pci_init(&bus->drv_pci[1]);  	}  	/* Init GBIT MAC COMMON core */ @@ -211,13 +265,6 @@ int __devinit bcma_bus_register(struct bcma_bus *bus)  		bcma_core_gmac_cmn_init(&bus->drv_gmac_cmn);  	} -	/* Try to get SPROM */ -	err = bcma_sprom_get(bus); -	if (err == -ENOENT) { -		bcma_err(bus, "No SPROM available\n"); -	} else if (err) -		bcma_err(bus, "Failed to get SPROM: %d\n", err); -  	/* Register found cores */  	bcma_register_cores(bus); @@ -229,6 +276,13 @@ int __devinit bcma_bus_register(struct bcma_bus *bus)  void bcma_bus_unregister(struct bcma_bus *bus)  {  	struct bcma_device *cores[3]; +	int err; + +	err = bcma_gpio_unregister(&bus->drv_cc); +	if (err == -EBUSY) +		bcma_err(bus, "Some GPIOs are still in use.\n"); +	else if (err) +		bcma_err(bus, "Can not unregister GPIO driver: %i\n", err);  	cores[0] = bcma_find_core(bus, BCMA_CORE_MIPS_74K);  	cores[1] = bcma_find_core(bus, BCMA_CORE_PCIE); @@ -275,18 +329,18 @@ int __init bcma_bus_early_register(struct bcma_bus *bus,  		return -1;  	} -	/* Init CC core */ +	/* Early init CC core */  	core = bcma_find_core(bus, bcma_cc_core_id(bus));  	if (core) {  		bus->drv_cc.core = core; -		bcma_core_chipcommon_init(&bus->drv_cc); +		bcma_core_chipcommon_early_init(&bus->drv_cc);  	} -	/* Init MIPS core */ +	/* Early init MIPS core */  	core = bcma_find_core(bus, BCMA_CORE_MIPS_74K);  	if (core) {  		bus->drv_mips.core = core; -		bcma_core_mips_init(&bus->drv_mips); +		bcma_core_mips_early_init(&bus->drv_mips);  	}  	bcma_info(bus, "Early bus registered\n");  |