Lines Matching refs:pc
28 bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc) in bcma_core_pci_is_in_hostmode() argument
30 struct bcma_bus *bus = pc->core->bus; in bcma_core_pci_is_in_hostmode()
39 bcma_core_enable(pc->core, 0); in bcma_core_pci_is_in_hostmode()
41 return !mips_busprobe32(tmp, pc->core->io_addr); in bcma_core_pci_is_in_hostmode()
44 static u32 bcma_pcie_read_config(struct bcma_drv_pci *pc, u32 address) in bcma_pcie_read_config() argument
46 pcicore_write32(pc, BCMA_CORE_PCI_CONFIG_ADDR, address); in bcma_pcie_read_config()
47 pcicore_read32(pc, BCMA_CORE_PCI_CONFIG_ADDR); in bcma_pcie_read_config()
48 return pcicore_read32(pc, BCMA_CORE_PCI_CONFIG_DATA); in bcma_pcie_read_config()
51 static void bcma_pcie_write_config(struct bcma_drv_pci *pc, u32 address, in bcma_pcie_write_config() argument
54 pcicore_write32(pc, BCMA_CORE_PCI_CONFIG_ADDR, address); in bcma_pcie_write_config()
55 pcicore_read32(pc, BCMA_CORE_PCI_CONFIG_ADDR); in bcma_pcie_write_config()
56 pcicore_write32(pc, BCMA_CORE_PCI_CONFIG_DATA, data); in bcma_pcie_write_config()
59 static u32 bcma_get_cfgspace_addr(struct bcma_drv_pci *pc, unsigned int dev, in bcma_get_cfgspace_addr() argument
67 if (dev >= 2 || !(bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_LSREG) in bcma_get_cfgspace_addr()
73 pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI1, BCMA_CORE_PCI_SBTOPCI_CFG0); in bcma_get_cfgspace_addr()
75 addr = pc->host_controller->host_cfg_addr; in bcma_get_cfgspace_addr()
84 static int bcma_extpci_read_config(struct bcma_drv_pci *pc, unsigned int dev, in bcma_extpci_read_config() argument
92 WARN_ON(!pc->hostmode); in bcma_extpci_read_config()
106 val = bcma_pcie_read_config(pc, addr); in bcma_extpci_read_config()
111 val = pcicore_read32(pc, addr); in bcma_extpci_read_config()
114 addr = bcma_get_cfgspace_addr(pc, dev, func, off); in bcma_extpci_read_config()
148 static int bcma_extpci_write_config(struct bcma_drv_pci *pc, unsigned int dev, in bcma_extpci_write_config() argument
155 u16 chipid = pc->core->bus->chipinfo.id; in bcma_extpci_write_config()
157 WARN_ON(!pc->hostmode); in bcma_extpci_write_config()
171 val = bcma_pcie_read_config(pc, addr); in bcma_extpci_write_config()
176 val = pcicore_read32(pc, addr); in bcma_extpci_write_config()
179 addr = bcma_get_cfgspace_addr(pc, dev, func, off); in bcma_extpci_write_config()
211 bcma_pcie_write_config(pc, addr, val); in bcma_extpci_write_config()
213 pcicore_write32(pc, addr, val); in bcma_extpci_write_config()
236 struct bcma_drv_pci *pc; in bcma_core_pci_hostmode_read_config() local
240 pc = pc_host->pdev; in bcma_core_pci_hostmode_read_config()
243 err = bcma_extpci_read_config(pc, PCI_SLOT(devfn), in bcma_core_pci_hostmode_read_config()
256 struct bcma_drv_pci *pc; in bcma_core_pci_hostmode_write_config() local
260 pc = pc_host->pdev; in bcma_core_pci_hostmode_write_config()
263 err = bcma_extpci_write_config(pc, PCI_SLOT(devfn), in bcma_core_pci_hostmode_write_config()
271 static u8 bcma_find_pci_capability(struct bcma_drv_pci *pc, unsigned int dev, in bcma_find_pci_capability() argument
281 bcma_extpci_read_config(pc, dev, func, PCI_HEADER_TYPE, &byte_val, in bcma_find_pci_capability()
287 bcma_extpci_read_config(pc, dev, func, PCI_STATUS, &byte_val, in bcma_find_pci_capability()
293 bcma_extpci_read_config(pc, dev, func, PCI_CAPABILITY_LIST, &cap_ptr, in bcma_find_pci_capability()
300 bcma_extpci_read_config(pc, dev, func, cap_ptr, &cap_id, sizeof(u8)); in bcma_find_pci_capability()
302 bcma_extpci_read_config(pc, dev, func, cap_ptr + 1, &cap_ptr, in bcma_find_pci_capability()
306 bcma_extpci_read_config(pc, dev, func, cap_ptr, &cap_id, in bcma_find_pci_capability()
326 bcma_extpci_read_config(pc, dev, func, cap_data, buf, in bcma_find_pci_capability()
340 static void bcma_core_pci_enable_crs(struct bcma_drv_pci *pc) in bcma_core_pci_enable_crs() argument
342 struct bcma_bus *bus = pc->core->bus; in bcma_core_pci_enable_crs()
347 cap_ptr = bcma_find_pci_capability(pc, 0, 0, PCI_CAP_ID_EXP, NULL, in bcma_core_pci_enable_crs()
350 bcma_extpci_read_config(pc, 0, 0, root_cap, &val16, sizeof(u16)); in bcma_core_pci_enable_crs()
355 bcma_extpci_read_config(pc, 0, 0, root_ctrl, &val16, in bcma_core_pci_enable_crs()
373 bcma_extpci_read_config(pc, dev, 0, in bcma_core_pci_enable_crs()
387 void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) in bcma_core_pci_hostmode_init() argument
389 struct bcma_bus *bus = pc->core->bus; in bcma_core_pci_hostmode_init()
410 pc->host_controller = pc_host; in bcma_core_pci_hostmode_init()
414 pc_host->pdev = pc; in bcma_core_pci_hostmode_init()
434 pcicore_write32(pc, BCMA_CORE_PCI_CTL, BCMA_CORE_PCI_CTL_RST_OE); in bcma_core_pci_hostmode_init()
436 pcicore_write32(pc, BCMA_CORE_PCI_CTL, BCMA_CORE_PCI_CTL_RST | in bcma_core_pci_hostmode_init()
450 pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI0, in bcma_core_pci_hostmode_init()
456 if (pc->core->core_unit == 0) { in bcma_core_pci_hostmode_init()
463 pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI0, in bcma_core_pci_hostmode_init()
465 } else if (pc->core->core_unit == 1) { in bcma_core_pci_hostmode_init()
473 pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI0, in bcma_core_pci_hostmode_init()
477 pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI0, in bcma_core_pci_hostmode_init()
481 pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI1, BCMA_CORE_PCI_SBTOPCI_CFG0); in bcma_core_pci_hostmode_init()
484 pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI2, in bcma_core_pci_hostmode_init()
495 bcma_core_pci_enable_crs(pc); in bcma_core_pci_hostmode_init()
500 bcma_extpci_read_config(pc, 0, 0, BCMA_CORE_PCI_CFG_DEVCTRL, in bcma_core_pci_hostmode_init()
504 bcma_extpci_write_config(pc, 0, 0, BCMA_CORE_PCI_CFG_DEVCTRL, in bcma_core_pci_hostmode_init()
510 bcma_extpci_write_config(pc, 0, 0, PCI_COMMAND, &tmp, sizeof(tmp)); in bcma_core_pci_hostmode_init()
513 pcicore_write32(pc, BCMA_CORE_PCI_IMASK, BCMA_CORE_PCI_IMASK_INTA); in bcma_core_pci_hostmode_init()