Release 4.11 drivers/ssb/main.c
/*
* Sonics Silicon Backplane
* Subsystem core
*
* Copyright 2005, Broadcom Corporation
* Copyright 2006, 2007, Michael Buesch <m@bues.ch>
*
* Licensed under the GNU/GPL. See COPYING for details.
*/
#include "ssb_private.h"
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/ssb/ssb.h>
#include <linux/ssb/ssb_regs.h>
#include <linux/ssb/ssb_driver_gige.h>
#include <linux/dma-mapping.h>
#include <linux/pci.h>
#include <linux/mmc/sdio_func.h>
#include <linux/slab.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ds.h>
MODULE_DESCRIPTION("Sonics Silicon Backplane driver");
MODULE_LICENSE("GPL");
/* Temporary list of yet-to-be-attached buses */
static LIST_HEAD(attach_queue);
/* List if running buses */
static LIST_HEAD(buses);
/* Software ID counter */
static unsigned int next_busnumber;
/* buses_mutes locks the two buslists and the next_busnumber.
* Don't lock this directly, but use ssb_buses_[un]lock() below. */
static DEFINE_MUTEX(buses_mutex);
/* There are differences in the codeflow, if the bus is
* initialized from early boot, as various needed services
* are not available early. This is a mechanism to delay
* these initializations to after early boot has finished.
* It's also used to avoid mutex locking, as that's not
* available and needed early. */
static bool ssb_is_early_boot = 1;
static void ssb_buses_lock(void);
static void ssb_buses_unlock(void);
#ifdef CONFIG_SSB_PCIHOST
struct ssb_bus *ssb_pci_dev_to_bus(struct pci_dev *pdev)
{
struct ssb_bus *bus;
ssb_buses_lock();
list_for_each_entry(bus, &buses, list) {
if (bus->bustype == SSB_BUSTYPE_PCI &&
bus->host_pci == pdev)
goto found;
}
bus = NULL;
found:
ssb_buses_unlock();
return bus;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 59 | 100.00% | 1 | 100.00% |
Total | 59 | 100.00% | 1 | 100.00% |
#endif /* CONFIG_SSB_PCIHOST */
#ifdef CONFIG_SSB_PCMCIAHOST
struct ssb_bus *ssb_pcmcia_dev_to_bus(struct pcmcia_device *pdev)
{
struct ssb_bus *bus;
ssb_buses_lock();
list_for_each_entry(bus, &buses, list) {
if (bus->bustype == SSB_BUSTYPE_PCMCIA &&
bus->host_pcmcia == pdev)
goto found;
}
bus = NULL;
found:
ssb_buses_unlock();
return bus;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 59 | 100.00% | 1 | 100.00% |
Total | 59 | 100.00% | 1 | 100.00% |
#endif /* CONFIG_SSB_PCMCIAHOST */
int ssb_for_each_bus_call(unsigned long data,
int (*func)(struct ssb_bus *bus, unsigned long data))
{
struct ssb_bus *bus;
int res;
ssb_buses_lock();
list_for_each_entry(bus, &buses, list) {
res = func(bus, data);
if (res >= 0) {
ssb_buses_unlock();
return res;
}
}
ssb_buses_unlock();
return -ENODEV;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 76 | 100.00% | 1 | 100.00% |
Total | 76 | 100.00% | 1 | 100.00% |
static struct ssb_device *ssb_device_get(struct ssb_device *dev)
{
if (dev)
get_device(dev->dev);
return dev;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 27 | 100.00% | 1 | 100.00% |
Total | 27 | 100.00% | 1 | 100.00% |
static void ssb_device_put(struct ssb_device *dev)
{
if (dev)
put_device(dev->dev);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 22 | 100.00% | 1 | 100.00% |
Total | 22 | 100.00% | 1 | 100.00% |
static int ssb_device_resume(struct device *dev)
{
struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
struct ssb_driver *ssb_drv;
int err = 0;
if (dev->driver) {
ssb_drv = drv_to_ssb_drv(dev->driver);
if (ssb_drv && ssb_drv->resume)
err = ssb_drv->resume(ssb_dev);
if (err)
goto out;
}
out:
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 77 | 100.00% | 1 | 100.00% |
Total | 77 | 100.00% | 1 | 100.00% |
static int ssb_device_suspend(struct device *dev, pm_message_t state)
{
struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
struct ssb_driver *ssb_drv;
int err = 0;
if (dev->driver) {
ssb_drv = drv_to_ssb_drv(dev->driver);
if (ssb_drv && ssb_drv->suspend)
err = ssb_drv->suspend(ssb_dev, state);
if (err)
goto out;
}
out:
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 82 | 100.00% | 2 | 100.00% |
Total | 82 | 100.00% | 2 | 100.00% |
int ssb_bus_resume(struct ssb_bus *bus)
{
int err;
/* Reset HW state information in memory, so that HW is
* completely reinitialized. */
bus->mapped_device = NULL;
#ifdef CONFIG_SSB_DRIVER_PCICORE
bus->pcicore.setup_done = 0;
#endif
err = ssb_bus_powerup(bus, 0);
if (err)
return err;
err = ssb_pcmcia_hardware_setup(bus);
if (err) {
ssb_bus_may_powerdown(bus);
return err;
}
ssb_chipco_resume(&bus->chipco);
ssb_bus_may_powerdown(bus);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 86 | 100.00% | 2 | 100.00% |
Total | 86 | 100.00% | 2 | 100.00% |
EXPORT_SYMBOL(ssb_bus_resume);
int ssb_bus_suspend(struct ssb_bus *bus)
{
ssb_chipco_suspend(&bus->chipco);
ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 0);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 32 | 100.00% | 2 | 100.00% |
Total | 32 | 100.00% | 2 | 100.00% |
EXPORT_SYMBOL(ssb_bus_suspend);
#ifdef CONFIG_SSB_SPROM
/** ssb_devices_freeze - Freeze all devices on the bus.
*
* After freezing no device driver will be handling a device
* on this bus anymore. ssb_devices_thaw() must be called after
* a successful freeze to reactivate the devices.
*
* @bus: The bus.
* @ctx: Context structure. Pass this to ssb_devices_thaw().
*/
int ssb_devices_freeze(struct ssb_bus *bus, struct ssb_freeze_context *ctx)
{
struct ssb_device *sdev;
struct ssb_driver *sdrv;
unsigned int i;
memset(ctx, 0, sizeof(*ctx));
ctx->bus = bus;
SSB_WARN_ON(bus->nr_devices > ARRAY_SIZE(ctx->device_frozen));
for (i = 0; i < bus->nr_devices; i++) {
sdev = ssb_device_get(&bus->devices[i]);
if (!sdev->dev || !sdev->dev->driver ||
!device_is_registered(sdev->dev)) {
ssb_device_put(sdev);
continue;
}
sdrv = drv_to_ssb_drv(sdev->dev->driver);
if (SSB_WARN_ON(!sdrv->remove))
continue;
sdrv->remove(sdev);
ctx->device_frozen[i] = 1;
}
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 163 | 100.00% | 2 | 100.00% |
Total | 163 | 100.00% | 2 | 100.00% |
/** ssb_devices_thaw - Unfreeze all devices on the bus.
*
* This will re-attach the device drivers and re-init the devices.
*
* @ctx: The context structure from ssb_devices_freeze()
*/
int ssb_devices_thaw(struct ssb_freeze_context *ctx)
{
struct ssb_bus *bus = ctx->bus;
struct ssb_device *sdev;
struct ssb_driver *sdrv;
unsigned int i;
int err, result = 0;
for (i = 0; i < bus->nr_devices; i++) {
if (!ctx->device_frozen[i])
continue;
sdev = &bus->devices[i];
if (SSB_WARN_ON(!sdev->dev || !sdev->dev->driver))
continue;
sdrv = drv_to_ssb_drv(sdev->dev->driver);
if (SSB_WARN_ON(!sdrv || !sdrv->probe))
continue;
err = sdrv->probe(sdev, &sdev->id);
if (err) {
ssb_err("Failed to thaw device %s\n",
dev_name(sdev->dev));
result = err;
}
ssb_device_put(sdev);
}
return result;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 157 | 95.15% | 2 | 66.67% |
Joe Perches | 8 | 4.85% | 1 | 33.33% |
Total | 165 | 100.00% | 3 | 100.00% |
#endif /* CONFIG_SSB_SPROM */
static void ssb_device_shutdown(struct device *dev)
{
struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
struct ssb_driver *ssb_drv;
if (!dev->driver)
return;
ssb_drv = drv_to_ssb_drv(dev->driver);
if (ssb_drv && ssb_drv->shutdown)
ssb_drv->shutdown(ssb_dev);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 58 | 100.00% | 1 | 100.00% |
Total | 58 | 100.00% | 1 | 100.00% |
static int ssb_device_remove(struct device *dev)
{
struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
struct ssb_driver *ssb_drv = drv_to_ssb_drv(dev->driver);
if (ssb_drv && ssb_drv->remove)
ssb_drv->remove(ssb_dev);
ssb_device_put(ssb_dev);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 56 | 100.00% | 1 | 100.00% |
Total | 56 | 100.00% | 1 | 100.00% |
static int ssb_device_probe(struct device *dev)
{
struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
struct ssb_driver *ssb_drv = drv_to_ssb_drv(dev->driver);
int err = 0;
ssb_device_get(ssb_dev);
if (ssb_drv && ssb_drv->probe)
err = ssb_drv->probe(ssb_dev, &ssb_dev->id);
if (err)
ssb_device_put(ssb_dev);
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 77 | 100.00% | 1 | 100.00% |
Total | 77 | 100.00% | 1 | 100.00% |
static int ssb_match_devid(const struct ssb_device_id *tabid,
const struct ssb_device_id *devid)
{
if ((tabid->vendor != devid->vendor) &&
tabid->vendor != SSB_ANY_VENDOR)
return 0;
if ((tabid->coreid != devid->coreid) &&
tabid->coreid != SSB_ANY_ID)
return 0;
if ((tabid->revision != devid->revision) &&
tabid->revision != SSB_ANY_REV)
return 0;
return 1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 84 | 100.00% | 1 | 100.00% |
Total | 84 | 100.00% | 1 | 100.00% |
static int ssb_bus_match(struct device *dev, struct device_driver *drv)
{
struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
struct ssb_driver *ssb_drv = drv_to_ssb_drv(drv);
const struct ssb_device_id *id;
for (id = ssb_drv->id_table;
id->vendor || id->coreid || id->revision;
id++) {
if (ssb_match_devid(id, &ssb_dev->id))
return 1; /* found */
}
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 86 | 100.00% | 1 | 100.00% |
Total | 86 | 100.00% | 1 | 100.00% |
static int ssb_device_uevent(struct device *dev, struct kobj_uevent_env *env)
{
struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
if (!dev)
return -ENODEV;
return add_uevent_var(env,
"MODALIAS=ssb:v%04Xid%04Xrev%02X",
ssb_dev->id.vendor, ssb_dev->id.coreid,
ssb_dev->id.revision);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 56 | 91.80% | 1 | 50.00% |
Al Viro | 5 | 8.20% | 1 | 50.00% |
Total | 61 | 100.00% | 2 | 100.00% |
#define ssb_config_attr(attrib, field, format_string) \
static ssize_t \
attrib##_show(struct device *dev, struct device_attribute *attr, char *buf) \
{ \
return sprintf(buf, format_string, dev_to_ssb_dev(dev)->field); \
} \
static DEVICE_ATTR_RO(attrib);
ssb_config_attr(core_num, core_index, "%u\n")
ssb_config_attr(coreid, id.coreid, "0x%04x\n")
ssb_config_attr(vendor, id.vendor, "0x%04x\n")
ssb_config_attr(revision, id.revision, "%u\n")
ssb_config_attr(irq, irq, "%u\n")
static ssize_t
name_show(struct device *dev, struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%s\n",
ssb_core_name(dev_to_ssb_dev(dev)->id.coreid));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Hauke Mehrtens | 40 | 100.00% | 1 | 100.00% |
Total | 40 | 100.00% | 1 | 100.00% |
static DEVICE_ATTR_RO(name);
static struct attribute *ssb_device_attrs[] = {
&dev_attr_name.attr,
&dev_attr_core_num.attr,
&dev_attr_coreid.attr,
&dev_attr_vendor.attr,
&dev_attr_revision.attr,
&dev_attr_irq.attr,
NULL,
};
ATTRIBUTE_GROUPS(ssb_device);
static struct bus_type ssb_bustype = {
.name = "ssb",
.match = ssb_bus_match,
.probe = ssb_device_probe,
.remove = ssb_device_remove,
.shutdown = ssb_device_shutdown,
.suspend = ssb_device_suspend,
.resume = ssb_device_resume,
.uevent = ssb_device_uevent,
.dev_groups = ssb_device_groups,
};
static void ssb_buses_lock(void)
{
/* See the comment at the ssb_is_early_boot definition */
if (!ssb_is_early_boot)
mutex_lock(&buses_mutex);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 20 | 100.00% | 1 | 100.00% |
Total | 20 | 100.00% | 1 | 100.00% |
static void ssb_buses_unlock(void)
{
/* See the comment at the ssb_is_early_boot definition */
if (!ssb_is_early_boot)
mutex_unlock(&buses_mutex);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 20 | 100.00% | 1 | 100.00% |
Total | 20 | 100.00% | 1 | 100.00% |
static void ssb_devices_unregister(struct ssb_bus *bus)
{
struct ssb_device *sdev;
int i;
for (i = bus->nr_devices - 1; i >= 0; i--) {
sdev = &(bus->devices[i]);
if (sdev->dev)
device_unregister(sdev->dev);
}
#ifdef CONFIG_SSB_EMBEDDED
if (bus->bustype == SSB_BUSTYPE_SSB)
platform_device_unregister(bus->watchdog);
#endif
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 63 | 75.90% | 1 | 50.00% |
Hauke Mehrtens | 20 | 24.10% | 1 | 50.00% |
Total | 83 | 100.00% | 2 | 100.00% |
void ssb_bus_unregister(struct ssb_bus *bus)
{
int err;
err = ssb_gpio_unregister(bus);
if (err == -EBUSY)
ssb_dbg("Some GPIOs are still in use\n");
else if (err)
ssb_dbg("Can not unregister GPIO driver: %i\n", err);
ssb_buses_lock();
ssb_devices_unregister(bus);
list_del(&bus->list);
ssb_buses_unlock();
ssb_pcmcia_exit(bus);
ssb_pci_exit(bus);
ssb_iounmap(bus);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 44 | 56.41% | 2 | 50.00% |
Hauke Mehrtens | 28 | 35.90% | 1 | 25.00% |
Joe Perches | 6 | 7.69% | 1 | 25.00% |
Total | 78 | 100.00% | 4 | 100.00% |
EXPORT_SYMBOL(ssb_bus_unregister);
static void ssb_release_dev(struct device *dev)
{
struct __ssb_dev_wrapper *devwrap;
devwrap = container_of(dev, struct __ssb_dev_wrapper, dev);
kfree(devwrap);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 33 | 100.00% | 1 | 100.00% |
Total | 33 | 100.00% | 1 | 100.00% |
static int ssb_devices_register(struct ssb_bus *bus)
{
struct ssb_device *sdev;
struct device *dev;
struct __ssb_dev_wrapper *devwrap;
int i, err = 0;
int dev_idx = 0;
for (i = 0; i < bus->nr_devices; i++) {
sdev = &(bus->devices[i]);
/* We don't register SSB-system devices to the kernel,
* as the drivers for them are built into SSB. */
switch (sdev->id.coreid) {
case SSB_DEV_CHIPCOMMON:
case SSB_DEV_PCI:
case SSB_DEV_PCIE:
case SSB_DEV_PCMCIA:
case SSB_DEV_MIPS:
case SSB_DEV_MIPS_3302:
case SSB_DEV_EXTIF:
continue;
}
devwrap = kzalloc(sizeof(*devwrap), GFP_KERNEL);
if (!devwrap) {
ssb_err("Could not allocate device\n");
err = -ENOMEM;
goto error;
}
dev = &devwrap->dev;
devwrap->sdev = sdev;
dev->release = ssb_release_dev;
dev->bus = &ssb_bustype;
dev_set_name(dev, "ssb%u:%d", bus->busnumber, dev_idx);
switch (bus->bustype) {
case SSB_BUSTYPE_PCI:
#ifdef CONFIG_SSB_PCIHOST
sdev->irq = bus->host_pci->irq;
dev->parent = &bus->host_pci->dev;
sdev->dma_dev = dev->parent;
#endif
break;
case SSB_BUSTYPE_PCMCIA:
#ifdef CONFIG_SSB_PCMCIAHOST
sdev->irq = bus->host_pcmcia->irq;
dev->parent = &bus->host_pcmcia->dev;
#endif
break;
case SSB_BUSTYPE_SDIO:
#ifdef CONFIG_SSB_SDIOHOST
dev->parent = &bus->host_sdio->dev;
#endif
break;
case SSB_BUSTYPE_SSB:
dev->dma_mask = &dev->coherent_dma_mask;
sdev->dma_dev = dev;
break;
}
sdev->dev = dev;
err = device_register(dev);
if (err) {
ssb_err("Could not register %s\n", dev_name(dev));
/* Set dev to NULL to not unregister
* dev on error unwinding. */
sdev->dev = NULL;
kfree(devwrap);
goto error;
}
dev_idx++;
}
#ifdef CONFIG_SSB_DRIVER_MIPS
if (bus->mipscore.pflash.present) {
err = platform_device_register(&ssb_pflash_dev);
if (err)
pr_err("Error registering parallel flash\n");
}
#endif
#ifdef CONFIG_SSB_SFLASH
if (bus->mipscore.sflash.present) {
err = platform_device_register(&ssb_sflash_dev);
if (err)
pr_err("Error registering serial flash\n");
}
#endif
return 0;
error:
/* Unwind the already registered devices. */
ssb_devices_unregister(bus);
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 297 | 71.39% | 3 | 30.00% |
Rafał Miłecki | 68 | 16.35% | 2 | 20.00% |
Albert Herranz | 19 | 4.57% | 1 | 10.00% |
FUJITA Tomonori | 14 | 3.37% | 1 | 10.00% |
Aurelien Jarno | 9 | 2.16% | 1 | 10.00% |
Joe Perches | 8 | 1.92% | 1 | 10.00% |
Kay Sievers | 1 | 0.24% | 1 | 10.00% |
Total | 416 | 100.00% | 10 | 100.00% |
/* Needs ssb_buses_lock() */
static int ssb_attach_queued_buses(void)
{
struct ssb_bus *bus, *n;
int err = 0;
int drop_them_all = 0;
list_for_each_entry_safe(bus, n, &attach_queue, list) {
if (drop_them_all) {
list_del(&bus->list);
continue;
}
/* Can't init the PCIcore in ssb_bus_register(), as that
* is too early in boot for embedded systems
* (no udelay() available). So do it here in attach stage.
*/
err = ssb_bus_powerup(bus, 0);
if (err)
goto error;
ssb_pcicore_init(&bus->pcicore);
if (bus->bustype == SSB_BUSTYPE_SSB)
ssb_watchdog_register(bus);
err = ssb_gpio_init(bus);
if (err == -ENOTSUPP)
ssb_dbg("GPIO driver not activated\n");
else if (err)
ssb_dbg("Error registering GPIO driver: %i\n", err);
ssb_bus_may_powerdown(bus);
err = ssb_devices_register(bus);
error:
if (err) {
drop_them_all = 1;
list_del(&bus->list);
continue;
}
list_move_tail(&bus->list, &buses);
}
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 125 | 73.96% | 1 | 33.33% |
Rafał Miłecki | 31 | 18.34% | 1 | 33.33% |
Hauke Mehrtens | 13 | 7.69% | 1 | 33.33% |
Total | 169 | 100.00% | 3 | 100.00% |
static int ssb_fetch_invariants(struct ssb_bus *bus,
ssb_invariants_func_t get_invariants)
{
struct ssb_init_invariants iv;
int err;
memset(&iv, 0, sizeof(iv));
err = get_invariants(bus, &iv);
if (err)
goto out;
memcpy(&bus->boardinfo, &iv.boardinfo, sizeof(iv.boardinfo));
memcpy(&bus->sprom, &iv.sprom, sizeof(iv.sprom));
bus->has_cardbus_slot = iv.has_cardbus_slot;
out:
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 104 | 100.00% | 2 | 100.00% |
Total | 104 | 100.00% | 2 | 100.00% |
static int __maybe_unused
ssb_bus_register(struct ssb_bus *bus,
ssb_invariants_func_t get_invariants,
unsigned long baseaddr)
{
int err;
spin_lock_init(&bus->bar_lock);
INIT_LIST_HEAD(&bus->list);
#ifdef CONFIG_SSB_EMBEDDED
spin_lock_init(&bus->gpio_lock);
#endif
/* Powerup the bus */
err = ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 1);
if (err)
goto out;
/* Init SDIO-host device (if any), before the scan */
err = ssb_sdio_init(bus);
if (err)
goto err_disable_xtal;
ssb_buses_lock();
bus->busnumber = next_busnumber;
/* Scan for devices (cores) */
err = ssb_bus_scan(bus, baseaddr);
if (err)
goto err_sdio_exit;
/* Init PCI-host device (if any) */
err = ssb_pci_init(bus);
if (err)
goto err_unmap;
/* Init PCMCIA-host device (if any) */
err = ssb_pcmcia_init(bus);
if (err)
goto err_pci_exit;
/* Initialize basic system devices (if available) */
err = ssb_bus_powerup(bus, 0);
if (err)
goto err_pcmcia_exit;
ssb_chipcommon_init(&bus->chipco);
ssb_extif_init(&bus->extif);
ssb_mipscore_init(&bus->mipscore);
err = ssb_fetch_invariants(bus, get_invariants);
if (err) {
ssb_bus_may_powerdown(bus);
goto err_pcmcia_exit;
}
ssb_bus_may_powerdown(bus);
/* Queue it for attach.
* See the comment at the ssb_is_early_boot definition. */
list_add_tail(&bus->list, &attach_queue);
if (!ssb_is_early_boot) {
/* This is not early boot, so we must attach the bus now */
err = ssb_attach_queued_buses();
if (err)
goto err_dequeue;
}
next_busnumber++;
ssb_buses_unlock();
out:
return err;
err_dequeue:
list_del(&bus->list);
err_pcmcia_exit:
ssb_pcmcia_exit(bus);
err_pci_exit:
ssb_pci_exit(bus);
err_unmap:
ssb_iounmap(bus);
err_sdio_exit:
ssb_sdio_exit(bus);
err_disable_xtal:
ssb_buses_unlock();
ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 0);
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 280 | 89.74% | 3 | 50.00% |
Albert Herranz | 23 | 7.37% | 1 | 16.67% |
Hauke Mehrtens | 8 | 2.56% | 1 | 16.67% |
Arnd Bergmann | 1 | 0.32% | 1 | 16.67% |
Total | 312 | 100.00% | 6 | 100.00% |
#ifdef CONFIG_SSB_PCIHOST
int ssb_bus_pcibus_register(struct ssb_bus *bus, struct pci_dev *host_pci)
{
int err;
bus->bustype = SSB_BUSTYPE_PCI;
bus->host_pci = host_pci;
bus->ops = &ssb_pci_ops;
err = ssb_bus_register(bus, ssb_pci_get_invariants, 0);
if (!err) {
ssb_info("Sonics Silicon Backplane found on PCI device %s\n",
dev_name(&host_pci->dev));
} else {
ssb_err("Failed to register PCI version of SSB with error %d\n",
err);
}
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 61 | 75.31% | 1 | 33.33% |
Joe Perches | 14 | 17.28% | 1 | 33.33% |
Larry Finger | 6 | 7.41% | 1 | 33.33% |
Total | 81 | 100.00% | 3 | 100.00% |
#endif /* CONFIG_SSB_PCIHOST */
#ifdef CONFIG_SSB_PCMCIAHOST
int ssb_bus_pcmciabus_register(struct ssb_bus *bus,
struct pcmcia_device *pcmcia_dev,
unsigned long baseaddr)
{
int err;
bus->bustype = SSB_BUSTYPE_PCMCIA;
bus->host_pcmcia = pcmcia_dev;
bus->ops = &ssb_pcmcia_ops;
err = ssb_bus_register(bus, ssb_pcmcia_get_invariants, baseaddr);
if (!err) {
ssb_info("Sonics Silicon Backplane found on PCMCIA device %s\n",
pcmcia_dev->devname);
}
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 65 | 91.55% | 1 | 50.00% |
Joe Perches | 6 | 8.45% | 1 | 50.00% |
Total | 71 | 100.00% | 2 | 100.00% |
#endif /* CONFIG_SSB_PCMCIAHOST */
#ifdef CONFIG_SSB_SDIOHOST
int ssb_bus_sdiobus_register(struct ssb_bus *bus,