Lines Matching refs:pci_dev
188 struct pci_dev *pci_dev = cobalt->pci_dev; in cobalt_pcie_status_show() local
189 struct pci_dev *pci_bus_dev = cobalt->pci_dev->bus->self; in cobalt_pcie_status_show()
193 if (!pci_is_pcie(pci_dev) || !pci_is_pcie(pci_bus_dev)) in cobalt_pcie_status_show()
197 pcie_capability_read_dword(pci_dev, PCI_EXP_DEVCAP, &capa); in cobalt_pcie_status_show()
198 pcie_capability_read_word(pci_dev, PCI_EXP_DEVCTL, &ctrl); in cobalt_pcie_status_show()
199 pcie_capability_read_word(pci_dev, PCI_EXP_DEVSTA, &stat); in cobalt_pcie_status_show()
209 pcie_capability_read_dword(pci_dev, PCI_EXP_LNKCAP, &capa); in cobalt_pcie_status_show()
210 pcie_capability_read_word(pci_dev, PCI_EXP_LNKCTL, &ctrl); in cobalt_pcie_status_show()
211 pcie_capability_read_word(pci_dev, PCI_EXP_LNKSTA, &stat); in cobalt_pcie_status_show()
227 pcie_capability_read_dword(pci_dev, PCI_EXP_SLTCAP, &capa); in cobalt_pcie_status_show()
228 pcie_capability_read_word(pci_dev, PCI_EXP_SLTCTL, &ctrl); in cobalt_pcie_status_show()
229 pcie_capability_read_word(pci_dev, PCI_EXP_SLTSTA, &stat); in cobalt_pcie_status_show()
237 struct pci_dev *pci_dev = cobalt->pci_dev; in pcie_link_get_lanes() local
240 if (!pci_is_pcie(pci_dev)) in pcie_link_get_lanes()
242 pcie_capability_read_word(pci_dev, PCI_EXP_LNKSTA, &link); in pcie_link_get_lanes()
248 struct pci_dev *pci_dev = cobalt->pci_dev->bus->self; in pcie_bus_link_get_lanes() local
251 if (!pci_is_pcie(pci_dev)) in pcie_bus_link_get_lanes()
253 pcie_capability_read_dword(pci_dev, PCI_EXP_LNKCAP, &link); in pcie_bus_link_get_lanes()
257 static void msi_config_show(struct cobalt *cobalt, struct pci_dev *pci_dev) in msi_config_show() argument
262 pci_read_config_word(pci_dev, 0x52, &ctrl); in msi_config_show()
268 pci_read_config_dword(pci_dev, 0x54, &adrs_l); in msi_config_show()
269 pci_read_config_dword(pci_dev, 0x58, &adrs_h); in msi_config_show()
270 pci_read_config_word(pci_dev, 0x5c, &data); in msi_config_show()
279 static void cobalt_pci_iounmap(struct cobalt *cobalt, struct pci_dev *pci_dev) in cobalt_pci_iounmap() argument
282 pci_iounmap(pci_dev, cobalt->bar0); in cobalt_pci_iounmap()
286 pci_iounmap(pci_dev, cobalt->bar1); in cobalt_pci_iounmap()
291 static void cobalt_free_msi(struct cobalt *cobalt, struct pci_dev *pci_dev) in cobalt_free_msi() argument
293 free_irq(pci_dev->irq, (void *)cobalt); in cobalt_free_msi()
294 pci_free_irq_vectors(pci_dev); in cobalt_free_msi()
297 static int cobalt_setup_pci(struct cobalt *cobalt, struct pci_dev *pci_dev, in cobalt_setup_pci() argument
305 ret = pci_enable_device(pci_dev); in cobalt_setup_pci()
310 pci_set_master(pci_dev); in cobalt_setup_pci()
311 pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &cobalt->card_rev); in cobalt_setup_pci()
312 pci_read_config_word(pci_dev, PCI_DEVICE_ID, &cobalt->device_id); in cobalt_setup_pci()
336 if (dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(64))) { in cobalt_setup_pci()
337 ret = dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(32)); in cobalt_setup_pci()
344 ret = pci_request_regions(pci_dev, "cobalt"); in cobalt_setup_pci()
352 cobalt->bar0 = pci_iomap(pci_dev, 0, 0); in cobalt_setup_pci()
353 cobalt->bar1 = pci_iomap(pci_dev, 1, 0); in cobalt_setup_pci()
355 cobalt->bar1 = pci_iomap(pci_dev, 2, 0); in cobalt_setup_pci()
371 if (pci_alloc_irq_vectors(pci_dev, 1, 1, PCI_IRQ_MSI) < 1) { in cobalt_setup_pci()
376 msi_config_show(cobalt, pci_dev); in cobalt_setup_pci()
379 if (request_irq(pci_dev->irq, cobalt_irq_handler, IRQF_SHARED, in cobalt_setup_pci()
381 cobalt_err("Failed to register irq %d\n", pci_dev->irq); in cobalt_setup_pci()
390 pci_disable_msi(pci_dev); in cobalt_setup_pci()
393 cobalt_pci_iounmap(cobalt, pci_dev); in cobalt_setup_pci()
394 pci_release_regions(pci_dev); in cobalt_setup_pci()
397 pci_disable_device(cobalt->pci_dev); in cobalt_setup_pci()
656 static int cobalt_probe(struct pci_dev *pci_dev, in cobalt_probe() argument
669 cobalt->pci_dev = pci_dev; in cobalt_probe()
673 retval = v4l2_device_register(&pci_dev->dev, &cobalt->v4l2_dev); in cobalt_probe()
696 retval = cobalt_setup_pci(cobalt, pci_dev, pci_id); in cobalt_probe()
742 cobalt_free_msi(cobalt, pci_dev); in cobalt_probe()
743 cobalt_pci_iounmap(cobalt, pci_dev); in cobalt_probe()
744 pci_release_regions(cobalt->pci_dev); in cobalt_probe()
745 pci_disable_device(cobalt->pci_dev); in cobalt_probe()
756 static void cobalt_remove(struct pci_dev *pci_dev) in cobalt_remove() argument
758 struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); in cobalt_remove()
777 cobalt_free_msi(cobalt, pci_dev); in cobalt_remove()
779 cobalt_pci_iounmap(cobalt, pci_dev); in cobalt_remove()
780 pci_release_regions(cobalt->pci_dev); in cobalt_remove()
781 pci_disable_device(cobalt->pci_dev); in cobalt_remove()