static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out) { char prefix[10]; struct bcma_device *core; switch (bus->hosttype) { case BCMA_HOSTTYPE_PCI: memset(out, 0, sizeof(struct ssb_sprom)); snprintf(prefix, sizeof(prefix), "pci/%u/%u/", bus->host_pci->bus->number + 1, PCI_SLOT(bus->host_pci->devfn)); bcm47xx_fill_sprom(out, prefix, false); return 0; case BCMA_HOSTTYPE_SOC: memset(out, 0, sizeof(struct ssb_sprom)); core = bcma_find_core(bus, BCMA_CORE_80211); if (core) { snprintf(prefix, sizeof(prefix), "sb/%u/", core->core_index); bcm47xx_fill_sprom(out, prefix, true); } else { bcm47xx_fill_sprom(out, NULL, false); } return 0; default: pr_warn("bcm47xx: unable to fill SPROM for given bustype.\n"); return -EINVAL; } }
static void bcma_hcd_init_chip_arm_phy(struct bcma_device *dev) { struct bcma_device *arm_core; void __iomem *dmu; arm_core = bcma_find_core(dev->bus, BCMA_CORE_ARMCA9); if (!arm_core) { dev_err(&dev->dev, "can not find ARM Cortex A9 ihost core\n"); return; } dmu = ioremap_nocache(arm_core->addr_s[0], 0x1000); if (!dmu) { dev_err(&dev->dev, "can not map ARM Cortex A9 ihost core\n"); return; } /* Unlock DMU PLL settings */ iowrite32(0x0000ea68, dmu + 0x180); /* Write USB 2.0 PLL control setting */ iowrite32(0x00dd10c3, dmu + 0x164); /* Lock DMU PLL settings */ iowrite32(0x00000000, dmu + 0x180); iounmap(dmu); }
static int bcma_host_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { struct bcma_bus *bus; int err = -ENOMEM; const char *name; u32 val; /* Alloc */ bus = kzalloc(sizeof(*bus), GFP_KERNEL); if (!bus) goto out; /* Basic PCI configuration */ err = pci_enable_device(dev); if (err) goto err_kfree_bus; name = dev_name(&dev->dev); if (dev->driver && dev->driver->name) name = dev->driver->name; err = pci_request_regions(dev, name); if (err) goto err_pci_disable; pci_set_master(dev); /* Disable the RETRY_TIMEOUT register (0x41) to keep * PCI Tx retries from interfering with C3 CPU state */ pci_read_config_dword(dev, 0x40, &val); if ((val & 0x0000ff00) != 0) pci_write_config_dword(dev, 0x40, val & 0xffff00ff); /* SSB needed additional powering up, do we have any AMBA PCI cards? */ if (!pci_is_pcie(dev)) { bcma_err(bus, "PCI card detected, they are not supported.\n"); err = -ENXIO; goto err_pci_release_regions; } /* Map MMIO */ err = -ENOMEM; bus->mmio = pci_iomap(dev, 0, ~0UL); if (!bus->mmio) goto err_pci_release_regions; /* Host specific */ bus->host_pci = dev; bus->hosttype = BCMA_HOSTTYPE_PCI; bus->ops = &bcma_host_pci_ops; bus->boardinfo.vendor = bus->host_pci->subsystem_vendor; bus->boardinfo.type = bus->host_pci->subsystem_device; /* Initialize struct, detect chip */ bcma_init_bus(bus); /* Scan bus to find out generation of PCIe core */ err = bcma_bus_scan(bus); if (err) goto err_pci_unmap_mmio; if (bcma_find_core(bus, BCMA_CORE_PCIE2)) bus->host_is_pcie2 = true; /* Register */ err = bcma_bus_register(bus); if (err) goto err_unregister_cores; pci_set_drvdata(dev, bus); out: return err; err_unregister_cores: bcma_unregister_cores(bus); err_pci_unmap_mmio: pci_iounmap(dev, bus->mmio); err_pci_release_regions: pci_release_regions(dev); err_pci_disable: pci_disable_device(dev); err_kfree_bus: kfree(bus); return err; }