Lines Matching refs:pc

20 u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address)
22 pcicore_write32(pc, BCMA_CORE_PCI_PCIEIND_ADDR, address);
23 pcicore_read32(pc, BCMA_CORE_PCI_PCIEIND_ADDR);
24 return pcicore_read32(pc, BCMA_CORE_PCI_PCIEIND_DATA);
27 static void bcma_pcie_write(struct bcma_drv_pci *pc, u32 address, u32 data)
29 pcicore_write32(pc, BCMA_CORE_PCI_PCIEIND_ADDR, address);
30 pcicore_read32(pc, BCMA_CORE_PCI_PCIEIND_ADDR);
31 pcicore_write32(pc, BCMA_CORE_PCI_PCIEIND_DATA, data);
34 static void bcma_pcie_mdio_set_phy(struct bcma_drv_pci *pc, u16 phy)
47 pcicore_write32(pc, BCMA_CORE_PCI_MDIO_DATA, v);
51 v = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_CONTROL);
58 static u16 bcma_pcie_mdio_read(struct bcma_drv_pci *pc, u16 device, u8 address)
68 pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, v);
70 if (pc->core->id.rev >= 10) {
72 bcma_pcie_mdio_set_phy(pc, device);
85 pcicore_write32(pc, BCMA_CORE_PCI_MDIO_DATA, v);
89 v = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_CONTROL);
92 ret = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_DATA);
97 pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, 0);
101 static void bcma_pcie_mdio_write(struct bcma_drv_pci *pc, u16 device,
111 pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, v);
113 if (pc->core->id.rev >= 10) {
115 bcma_pcie_mdio_set_phy(pc, device);
128 pcicore_write32(pc, BCMA_CORE_PCI_MDIO_DATA, v);
132 v = pcicore_read32(pc, BCMA_CORE_PCI_MDIO_CONTROL);
137 pcicore_write32(pc, BCMA_CORE_PCI_MDIO_CONTROL, 0);
140 static u16 bcma_pcie_mdio_writeread(struct bcma_drv_pci *pc, u16 device,
143 bcma_pcie_mdio_write(pc, device, address, data);
144 return bcma_pcie_mdio_read(pc, device, address);
151 static void bcma_core_pci_fixcfg(struct bcma_drv_pci *pc)
153 struct bcma_device *core = pc->core;
160 val16 = pcicore_read16(pc, regoff);
165 pcicore_write16(pc, regoff, val16);
173 void bcma_core_pci_early_init(struct bcma_drv_pci *pc)
175 if (pc->early_setup_done)
178 pc->hostmode = bcma_core_pci_is_in_hostmode(pc);
179 if (pc->hostmode)
182 bcma_core_pci_fixcfg(pc);
185 pc->early_setup_done = true;
192 static u8 bcma_pcicore_polarity_workaround(struct bcma_drv_pci *pc)
196 tmp = bcma_pcie_read(pc, BCMA_CORE_PCI_PLP_STATUSREG);
204 static void bcma_pcicore_serdes_workaround(struct bcma_drv_pci *pc)
208 bcma_pcie_mdio_write(pc, BCMA_CORE_PCI_MDIODATA_DEV_RX,
210 bcma_pcicore_polarity_workaround(pc));
211 tmp = bcma_pcie_mdio_read(pc, BCMA_CORE_PCI_MDIODATA_DEV_PLL,
214 bcma_pcie_mdio_write(pc, BCMA_CORE_PCI_MDIODATA_DEV_PLL,
221 static void bcma_core_pci_config_fixup(struct bcma_drv_pci *pc)
228 val16 = pcicore_read16(pc, regoff);
232 pcicore_write16(pc, regoff, val16);
240 static void bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc)
242 bcma_pcicore_serdes_workaround(pc);
243 bcma_core_pci_config_fixup(pc);
246 void bcma_core_pci_init(struct bcma_drv_pci *pc)
248 if (pc->setup_done)
251 bcma_core_pci_early_init(pc);
253 if (pc->hostmode)
254 bcma_core_pci_hostmode_init(pc);
256 bcma_core_pci_clientmode_init(pc);
261 struct bcma_drv_pci *pc;
267 pc = &bus->drv_pci[0];
269 if (pc->core->id.rev >= 15 && pc->core->id.rev <= 20) {
271 bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1,
273 bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1,
275 } else if (pc->core->id.rev >= 21 && pc->core->id.rev <= 22) {
277 bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1,
279 bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1,
285 static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend)
289 w = bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG);
294 bcma_pcie_write(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG, w);
295 bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG);
298 void bcma_core_pci_up(struct bcma_drv_pci *pc)
300 bcma_core_pci_extend_L1timer(pc, true);
303 void bcma_core_pci_down(struct bcma_drv_pci *pc)
305 bcma_core_pci_extend_L1timer(pc, false);