Lines Matching refs:pcie
31 struct cdns_pcie *pcie = &rc->pcie; in cdns_pci_map_bus() local
44 return pcie->reg_base + (where & 0xfff); in cdns_pci_map_bus()
47 if (!(cdns_pcie_readl(pcie, CDNS_PCIE_LM_BASE) & 0x1)) in cdns_pci_map_bus()
50 cdns_pcie_writel(pcie, CDNS_PCIE_AT_LINKDOWN, 0x0); in cdns_pci_map_bus()
56 cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_PCI_ADDR0(0), addr0); in cdns_pci_map_bus()
69 cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_DESC0(0), desc0); in cdns_pci_map_bus()
80 static int cdns_pcie_host_wait_for_link(struct cdns_pcie *pcie) in cdns_pcie_host_wait_for_link() argument
82 struct device *dev = pcie->dev; in cdns_pcie_host_wait_for_link()
87 if (cdns_pcie_link_up(pcie)) { in cdns_pcie_host_wait_for_link()
97 static int cdns_pcie_retrain(struct cdns_pcie *pcie) in cdns_pcie_retrain() argument
108 lnk_cap_sls = cdns_pcie_readl(pcie, (CDNS_PCIE_RP_BASE + pcie_cap_off + in cdns_pcie_retrain()
113 lnk_stat = cdns_pcie_rp_readw(pcie, pcie_cap_off + PCI_EXP_LNKSTA); in cdns_pcie_retrain()
115 lnk_ctl = cdns_pcie_rp_readw(pcie, in cdns_pcie_retrain()
118 cdns_pcie_rp_writew(pcie, pcie_cap_off + PCI_EXP_LNKCTL, in cdns_pcie_retrain()
121 ret = cdns_pcie_host_wait_for_link(pcie); in cdns_pcie_retrain()
126 static void cdns_pcie_host_enable_ptm_response(struct cdns_pcie *pcie) in cdns_pcie_host_enable_ptm_response() argument
130 val = cdns_pcie_readl(pcie, CDNS_PCIE_LM_PTM_CTRL); in cdns_pcie_host_enable_ptm_response()
131 cdns_pcie_writel(pcie, CDNS_PCIE_LM_PTM_CTRL, val | CDNS_PCIE_LM_TPM_CTRL_PTMRSEN); in cdns_pcie_host_enable_ptm_response()
136 struct cdns_pcie *pcie = &rc->pcie; in cdns_pcie_host_start_link() local
139 ret = cdns_pcie_host_wait_for_link(pcie); in cdns_pcie_host_start_link()
146 ret = cdns_pcie_retrain(pcie); in cdns_pcie_host_start_link()
153 struct cdns_pcie *pcie = &rc->pcie; in cdns_pcie_host_init_root_port() local
172 cdns_pcie_writel(pcie, CDNS_PCIE_LM_RC_BAR_CFG, value); in cdns_pcie_host_init_root_port()
178 cdns_pcie_writel(pcie, CDNS_PCIE_LM_ID, id); in cdns_pcie_host_init_root_port()
182 cdns_pcie_rp_writew(pcie, PCI_DEVICE_ID, rc->device_id); in cdns_pcie_host_init_root_port()
184 cdns_pcie_rp_writeb(pcie, PCI_CLASS_REVISION, 0); in cdns_pcie_host_init_root_port()
185 cdns_pcie_rp_writeb(pcie, PCI_CLASS_PROG, 0); in cdns_pcie_host_init_root_port()
186 cdns_pcie_rp_writew(pcie, PCI_CLASS_DEVICE, PCI_CLASS_BRIDGE_PCI); in cdns_pcie_host_init_root_port()
196 struct cdns_pcie *pcie = &rc->pcie; in cdns_pcie_host_bar_ib_config() local
208 cdns_pcie_writel(pcie, CDNS_PCIE_AT_IB_RP_BAR_ADDR0(bar), addr0); in cdns_pcie_host_bar_ib_config()
209 cdns_pcie_writel(pcie, CDNS_PCIE_AT_IB_RP_BAR_ADDR1(bar), addr1); in cdns_pcie_host_bar_ib_config()
214 value = cdns_pcie_readl(pcie, CDNS_PCIE_LM_RC_BAR_CFG); in cdns_pcie_host_bar_ib_config()
231 cdns_pcie_writel(pcie, CDNS_PCIE_LM_RC_BAR_CFG, value); in cdns_pcie_host_bar_ib_config()
288 struct cdns_pcie *pcie = &rc->pcie; in cdns_pcie_host_bar_config() local
289 struct device *dev = pcie->dev; in cdns_pcie_host_bar_config()
369 struct cdns_pcie *pcie = &rc->pcie; in cdns_pcie_host_map_dma_ranges() local
370 struct device *dev = pcie->dev; in cdns_pcie_host_map_dma_ranges()
406 struct cdns_pcie *pcie = &rc->pcie; in cdns_pcie_host_init_address_translation() local
425 cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_PCI_ADDR1(0), addr1); in cdns_pcie_host_init_address_translation()
426 cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_DESC1(0), desc1); in cdns_pcie_host_init_address_translation()
428 if (pcie->ops->cpu_addr_fixup) in cdns_pcie_host_init_address_translation()
429 cpu_addr = pcie->ops->cpu_addr_fixup(pcie, cpu_addr); in cdns_pcie_host_init_address_translation()
434 cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_CPU_ADDR0(0), addr0); in cdns_pcie_host_init_address_translation()
435 cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_CPU_ADDR1(0), addr1); in cdns_pcie_host_init_address_translation()
443 cdns_pcie_set_outbound_region(pcie, busnr, 0, r, in cdns_pcie_host_init_address_translation()
449 cdns_pcie_set_outbound_region(pcie, busnr, 0, r, in cdns_pcie_host_init_address_translation()
475 struct device *dev = rc->pcie.dev; in cdns_pcie_host_setup()
480 struct cdns_pcie *pcie; in cdns_pcie_host_setup() local
488 pcie = &rc->pcie; in cdns_pcie_host_setup()
489 pcie->is_rc = true; in cdns_pcie_host_setup()
497 pcie->reg_base = devm_platform_ioremap_resource_byname(pdev, "reg"); in cdns_pcie_host_setup()
498 if (IS_ERR(pcie->reg_base)) { in cdns_pcie_host_setup()
500 return PTR_ERR(pcie->reg_base); in cdns_pcie_host_setup()
510 cdns_pcie_detect_quiet_min_delay_set(&rc->pcie); in cdns_pcie_host_setup()
512 cdns_pcie_host_enable_ptm_response(pcie); in cdns_pcie_host_setup()
514 ret = cdns_pcie_start_link(pcie); in cdns_pcie_host_setup()