Lines Matching +full:fixed +full:- +full:mmio +full:- +full:clock
3 * Broadcom PCI-core driver
28 return ssb_read32(pc->dev, offset); in pcicore_read32()
34 ssb_write32(pc->dev, offset, value); in pcicore_write32()
40 return ssb_read16(pc->dev, offset); in pcicore_read16()
46 ssb_write16(pc->dev, offset, value); in pcicore_write16()
62 /* Assume one-hot slot wiring */
79 if (pc->cardbusmode && (dev > 1)) in get_cfgspace_addr()
115 int err = -EINVAL; in ssb_extpci_read_config()
117 void __iomem *mmio; in ssb_extpci_read_config() local
119 WARN_ON(!pc->hostmode); in ssb_extpci_read_config()
125 err = -ENOMEM; in ssb_extpci_read_config()
126 mmio = ioremap(addr, len); in ssb_extpci_read_config()
127 if (!mmio) in ssb_extpci_read_config()
130 if (mips_busprobe32(val, mmio)) { in ssb_extpci_read_config()
135 val = readl(mmio); in ssb_extpci_read_config()
151 iounmap(mmio); in ssb_extpci_read_config()
161 int err = -EINVAL; in ssb_extpci_write_config()
163 void __iomem *mmio; in ssb_extpci_write_config() local
165 WARN_ON(!pc->hostmode); in ssb_extpci_write_config()
171 err = -ENOMEM; in ssb_extpci_write_config()
172 mmio = ioremap(addr, len); in ssb_extpci_write_config()
173 if (!mmio) in ssb_extpci_write_config()
176 if (mips_busprobe32(val, mmio)) { in ssb_extpci_write_config()
183 val = readl(mmio); in ssb_extpci_write_config()
188 val = readl(mmio); in ssb_extpci_write_config()
196 writel(val, mmio); in ssb_extpci_write_config()
200 iounmap(mmio); in ssb_extpci_write_config()
212 err = ssb_extpci_read_config(extpci_core, bus->number, PCI_SLOT(devfn), in ssb_pcicore_read_config()
226 err = ssb_extpci_write_config(extpci_core, bus->number, PCI_SLOT(devfn), in ssb_pcicore_write_config()
241 .end = SSB_PCI_DMA + SSB_PCI_DMA_SZ - 1,
259 * We must first check if the device is a device on the PCI-core bridge.
263 if (d->bus->ops != &ssb_pcicore_pciops) { in ssb_pcicore_plat_dev_init()
264 /* This is not a device on the PCI-core bridge. */ in ssb_pcicore_plat_dev_init()
265 return -ENODEV; in ssb_pcicore_plat_dev_init()
268 dev_info(&d->dev, "PCI: Fixing up device %s\n", pci_name(d)); in ssb_pcicore_plat_dev_init()
271 d->irq = ssb_mips_irq(extpci_core->dev) + 2; in ssb_pcicore_plat_dev_init()
272 pci_write_config_byte(d, PCI_INTERRUPT_LINE, d->irq); in ssb_pcicore_plat_dev_init()
277 /* Early PCI fixup for a device on the PCI-core bridge. */
282 if (dev->bus->ops != &ssb_pcicore_pciops) { in ssb_pcicore_fixup_pcibridge()
283 /* This is not a device on the PCI-core bridge. */ in ssb_pcicore_fixup_pcibridge()
286 if (dev->bus->number != 0 || PCI_SLOT(dev->devfn) != 0) in ssb_pcicore_fixup_pcibridge()
289 dev_info(&dev->dev, "PCI: Fixing up bridge %s\n", pci_name(dev)); in ssb_pcicore_fixup_pcibridge()
294 dev_err(&dev->dev, "PCI: SSB bridge enable failed\n"); in ssb_pcicore_fixup_pcibridge()
303 dev_info(&dev->dev, in ssb_pcicore_fixup_pcibridge()
313 if (dev->bus->ops != &ssb_pcicore_pciops) { in ssb_pcicore_pcibios_map_irq()
314 /* This is not a device on the PCI-core bridge. */ in ssb_pcicore_pcibios_map_irq()
315 return -ENODEV; in ssb_pcicore_pcibios_map_irq()
317 return ssb_mips_irq(extpci_core->dev) + 2; in ssb_pcicore_pcibios_map_irq()
328 dev_dbg(pc->dev->dev, "PCIcore in host mode found\n"); in ssb_pcicore_init_hostmode()
333 val |= SSB_PCICORE_CTL_CLK; /* Clock on */ in ssb_pcicore_init_hostmode()
342 if (pc->dev->bus->has_cardbus_slot) { in ssb_pcicore_init_hostmode()
343 dev_dbg(pc->dev->dev, "CardBus slot detected\n"); in ssb_pcicore_init_hostmode()
344 pc->cardbusmode = 1; in ssb_pcicore_init_hostmode()
346 ssb_gpio_out(pc->dev->bus, 1, 1); in ssb_pcicore_init_hostmode()
347 ssb_gpio_outen(pc->dev->bus, 1, 1); in ssb_pcicore_init_hostmode()
366 * Tested delay 850 us lowered reboot chance to 50-80%, 1000 us fixed it in ssb_pcicore_init_hostmode()
386 * to non-MIPS platform. in ssb_pcicore_init_hostmode()
399 struct ssb_bus *bus = pc->dev->bus; in pcicore_is_in_hostmode()
403 chipid_top = (bus->chip_id & 0xFF00); in pcicore_is_in_hostmode()
408 if (bus->sprom.boardflags_lo & SSB_PCICORE_BFL_NOPCI) in pcicore_is_in_hostmode()
411 /* The 200-pin BCM4712 package does not bond out PCI. Even when in pcicore_is_in_hostmode()
414 if (bus->chip_id == 0x4712) { in pcicore_is_in_hostmode()
415 if (bus->chip_package == SSB_CHIPPACK_BCM4712S) in pcicore_is_in_hostmode()
417 if (bus->chip_package == SSB_CHIPPACK_BCM4712M) in pcicore_is_in_hostmode()
420 if (bus->chip_id == 0x5350) in pcicore_is_in_hostmode()
423 return !mips_busprobe32(tmp, (bus->mmio + (pc->dev->core_index * SSB_CORE_SIZE))); in pcicore_is_in_hostmode()
434 if (((tmp & 0xF000) >> 12) != pc->dev->core_index) { in ssb_pcicore_fix_sprom_core_index()
436 tmp |= (pc->dev->core_index << 12); in ssb_pcicore_fix_sprom_core_index()
461 struct ssb_device *pdev = pc->dev; in ssb_pcicore_pci_setup_workarounds()
462 struct ssb_bus *bus = pdev->bus; in ssb_pcicore_pci_setup_workarounds()
470 if (pdev->id.revision < 5) { in ssb_pcicore_pci_setup_workarounds()
478 } else if (pdev->id.revision >= 11) { in ssb_pcicore_pci_setup_workarounds()
488 u8 rev = pc->dev->id.revision; in ssb_pcicore_pcie_setup_workarounds()
535 struct ssb_device *pdev = pc->dev; in ssb_pcicore_init_clientmode()
536 struct ssb_bus *bus = pdev->bus; in ssb_pcicore_init_clientmode()
538 if (bus->bustype == SSB_BUSTYPE_PCI) in ssb_pcicore_init_clientmode()
544 /* Additional PCIe always once-executed workarounds */ in ssb_pcicore_init_clientmode()
545 if (pc->dev->id.coreid == SSB_DEV_PCIE) { in ssb_pcicore_init_clientmode()
548 /* TODO: Clock Request Update */ in ssb_pcicore_init_clientmode()
554 struct ssb_device *dev = pc->dev; in ssb_pcicore_init()
562 pc->hostmode = pcicore_is_in_hostmode(pc); in ssb_pcicore_init()
563 if (pc->hostmode) in ssb_pcicore_init()
566 if (!pc->hostmode) in ssb_pcicore_init()
615 v |= 0x2; /* MDIO Clock Divisor */ in ssb_pcie_mdio_read()
618 if (pc->dev->id.revision >= 10) { in ssb_pcie_mdio_read()
626 if (pc->dev->id.revision < 10) in ssb_pcie_mdio_read()
655 v |= 0x2; /* MDIO Clock Divisor */ in ssb_pcie_mdio_write()
658 if (pc->dev->id.revision >= 10) { in ssb_pcie_mdio_write()
666 if (pc->dev->id.revision < 10) in ssb_pcie_mdio_write()
685 struct ssb_device *pdev = pc->dev; in ssb_pcicore_dev_irqvecs_enable()
690 if (dev->bus->bustype != SSB_BUSTYPE_PCI) { in ssb_pcicore_dev_irqvecs_enable()
691 /* This SSB device is not on a PCI host-bus. So the IRQs are in ssb_pcicore_dev_irqvecs_enable()
700 bus = pdev->bus; in ssb_pcicore_dev_irqvecs_enable()
702 might_sleep_if(pdev->id.coreid != SSB_DEV_PCI); in ssb_pcicore_dev_irqvecs_enable()
705 if ((pdev->id.revision >= 6) || (pdev->id.coreid == SSB_DEV_PCIE)) { in ssb_pcicore_dev_irqvecs_enable()
709 coremask = (1 << dev->core_index); in ssb_pcicore_dev_irqvecs_enable()
711 WARN_ON(bus->bustype != SSB_BUSTYPE_PCI); in ssb_pcicore_dev_irqvecs_enable()
712 err = pci_read_config_dword(bus->host_pci, SSB_PCI_IRQMASK, &tmp); in ssb_pcicore_dev_irqvecs_enable()
716 err = pci_write_config_dword(bus->host_pci, SSB_PCI_IRQMASK, tmp); in ssb_pcicore_dev_irqvecs_enable()
730 if (pc->setup_done) in ssb_pcicore_dev_irqvecs_enable()
732 if (pdev->id.coreid == SSB_DEV_PCI) { in ssb_pcicore_dev_irqvecs_enable()
735 WARN_ON(pdev->id.coreid != SSB_DEV_PCIE); in ssb_pcicore_dev_irqvecs_enable()
738 pc->setup_done = 1; in ssb_pcicore_dev_irqvecs_enable()