Lines Matching refs:pcie
26 struct rcar_pcie pcie; member
36 static void rcar_pcie_ep_hw_init(struct rcar_pcie *pcie) in rcar_pcie_ep_hw_init() argument
40 rcar_pci_write_reg(pcie, 0, PCIETCTLR); in rcar_pcie_ep_hw_init()
43 rcar_pci_write_reg(pcie, 0, PCIEMSR); in rcar_pcie_ep_hw_init()
46 rcar_rmw32(pcie, REXPCAP(0), 0xff, PCI_CAP_ID_EXP); in rcar_pcie_ep_hw_init()
47 rcar_rmw32(pcie, REXPCAP(PCI_EXP_FLAGS), in rcar_pcie_ep_hw_init()
49 rcar_rmw32(pcie, RCONF(PCI_HEADER_TYPE), 0x7f, in rcar_pcie_ep_hw_init()
53 rcar_rmw32(pcie, REXPCAP(PCI_EXP_SLTCAP), PCI_EXP_SLTCAP_PSN, 0); in rcar_pcie_ep_hw_init()
55 val = rcar_pci_read_reg(pcie, EXPCAP(1)); in rcar_pcie_ep_hw_init()
58 rcar_pci_write_reg(pcie, val, EXPCAP(1)); in rcar_pcie_ep_hw_init()
60 val = rcar_pci_read_reg(pcie, EXPCAP(2)); in rcar_pcie_ep_hw_init()
65 rcar_pci_write_reg(pcie, val, EXPCAP(2)); in rcar_pcie_ep_hw_init()
68 rcar_rmw32(pcie, EXPCAP(12), PCI_EXP_LNKSTA_CLS, in rcar_pcie_ep_hw_init()
72 rcar_rmw32(pcie, TLCTLR + 1, 0x3f, 50); in rcar_pcie_ep_hw_init()
75 rcar_rmw32(pcie, RVCCAP(0), 0xfff00000, 0); in rcar_pcie_ep_hw_init()
96 struct rcar_pcie *pcie = &ep->pcie; in rcar_pcie_parse_outbound_ranges() local
108 dev_err(pcie->dev, "missing outbound window %u\n", i); in rcar_pcie_parse_outbound_ranges()
114 dev_err(pcie->dev, "Cannot request memory region %s.\n", in rcar_pcie_parse_outbound_ranges()
134 struct rcar_pcie *pcie = &ep->pcie; in rcar_pcie_ep_get_pdata() local
136 struct device *dev = pcie->dev; in rcar_pcie_ep_get_pdata()
143 pcie->base = devm_ioremap_resource(dev, &res); in rcar_pcie_ep_get_pdata()
144 if (IS_ERR(pcie->base)) in rcar_pcie_ep_get_pdata()
145 return PTR_ERR(pcie->base); in rcar_pcie_ep_get_pdata()
166 struct rcar_pcie *pcie = &ep->pcie; in rcar_pcie_ep_write_header() local
172 val = rcar_pci_read_reg(pcie, IDSETR0); in rcar_pcie_ep_write_header()
174 rcar_pci_write_reg(pcie, val, IDSETR0); in rcar_pcie_ep_write_header()
180 rcar_pci_write_reg(pcie, val, IDSETR1); in rcar_pcie_ep_write_header()
185 val = rcar_pci_read_reg(pcie, SUBIDSETR); in rcar_pcie_ep_write_header()
187 rcar_pci_write_reg(pcie, val, SUBIDSETR); in rcar_pcie_ep_write_header()
191 val = rcar_pci_read_reg(pcie, PCICONF(15)); in rcar_pcie_ep_write_header()
193 rcar_pci_write_reg(pcie, val, PCICONF(15)); in rcar_pcie_ep_write_header()
206 struct rcar_pcie *pcie = &ep->pcie; in rcar_pcie_ep_set_bar() local
213 dev_err(pcie->dev, "no free inbound window\n"); in rcar_pcie_ep_set_bar()
237 rcar_pcie_set_inbound(pcie, cpu_addr, in rcar_pcie_ep_set_bar()
240 err = rcar_pcie_wait_for_phyrdy(pcie); in rcar_pcie_ep_set_bar()
242 dev_err(pcie->dev, "phy not ready\n"); in rcar_pcie_ep_set_bar()
256 rcar_pcie_set_inbound(&ep->pcie, 0x0, 0x0, 0x0, bar, false); in rcar_pcie_ep_clear_bar()
265 struct rcar_pcie *pcie = &ep->pcie; in rcar_pcie_ep_set_msi() local
268 flags = rcar_pci_read_reg(pcie, MSICAP(fn)); in rcar_pcie_ep_set_msi()
270 rcar_pci_write_reg(pcie, flags, MSICAP(fn)); in rcar_pcie_ep_set_msi()
278 struct rcar_pcie *pcie = &ep->pcie; in rcar_pcie_ep_get_msi() local
281 flags = rcar_pci_read_reg(pcie, MSICAP(fn)); in rcar_pcie_ep_get_msi()
292 struct rcar_pcie *pcie = &ep->pcie; in rcar_pcie_ep_map_addr() local
299 err = rcar_pcie_wait_for_dl(pcie); in rcar_pcie_ep_map_addr()
301 dev_err(pcie->dev, "link not up\n"); in rcar_pcie_ep_map_addr()
307 dev_err(pcie->dev, "failed to get corresponding window\n"); in rcar_pcie_ep_map_addr()
318 rcar_pcie_set_outbound(pcie, window, &win); in rcar_pcie_ep_map_addr()
343 rcar_pcie_set_outbound(&ep->pcie, idx, &win); in rcar_pcie_ep_unmap_addr()
351 struct rcar_pcie *pcie = &ep->pcie; in rcar_pcie_ep_assert_intx() local
354 val = rcar_pci_read_reg(pcie, PCIEMSITXR); in rcar_pcie_ep_assert_intx()
356 dev_err(pcie->dev, "MSI is enabled, cannot assert INTx\n"); in rcar_pcie_ep_assert_intx()
360 val = rcar_pci_read_reg(pcie, PCICONF(1)); in rcar_pcie_ep_assert_intx()
362 dev_err(pcie->dev, "INTx message transmission is disabled\n"); in rcar_pcie_ep_assert_intx()
366 val = rcar_pci_read_reg(pcie, PCIEINTXR); in rcar_pcie_ep_assert_intx()
368 dev_err(pcie->dev, "INTx is already asserted\n"); in rcar_pcie_ep_assert_intx()
373 rcar_pci_write_reg(pcie, val, PCIEINTXR); in rcar_pcie_ep_assert_intx()
375 val = rcar_pci_read_reg(pcie, PCIEINTXR); in rcar_pcie_ep_assert_intx()
377 rcar_pci_write_reg(pcie, val, PCIEINTXR); in rcar_pcie_ep_assert_intx()
382 static int rcar_pcie_ep_assert_msi(struct rcar_pcie *pcie, in rcar_pcie_ep_assert_msi() argument
389 val = rcar_pci_read_reg(pcie, MSICAP(fn)); in rcar_pcie_ep_assert_msi()
400 val = rcar_pci_read_reg(pcie, PCIEMSITXR); in rcar_pcie_ep_assert_msi()
401 rcar_pci_write_reg(pcie, val | (interrupt_num - 1), PCIEMSITXR); in rcar_pcie_ep_assert_msi()
417 return rcar_pcie_ep_assert_msi(&ep->pcie, fn, interrupt_num); in rcar_pcie_ep_raise_irq()
428 rcar_pci_write_reg(&ep->pcie, MACCTLR_INIT_VAL, MACCTLR); in rcar_pcie_ep_start()
429 rcar_pci_write_reg(&ep->pcie, CFINIT, PCIETCTLR); in rcar_pcie_ep_start()
438 rcar_pci_write_reg(&ep->pcie, 0, PCIETCTLR); in rcar_pcie_ep_stop()
483 struct rcar_pcie *pcie; in rcar_pcie_ep_probe() local
491 pcie = &ep->pcie; in rcar_pcie_ep_probe()
492 pcie->dev = dev; in rcar_pcie_ep_probe()
536 rcar_pcie_ep_hw_init(pcie); in rcar_pcie_ep_probe()