Lines Matching refs:btpci
244 struct bt1_pcie *btpci = to_bt1_pcie(pci); in bt1_pcie_write_dbi2() local
247 regmap_update_bits(btpci->sys_regs, BT1_CCU_PCIE_GENC, in bt1_pcie_write_dbi2()
254 regmap_update_bits(btpci->sys_regs, BT1_CCU_PCIE_GENC, in bt1_pcie_write_dbi2()
260 struct bt1_pcie *btpci = to_bt1_pcie(pci); in bt1_pcie_start_link() local
268 regmap_update_bits(btpci->sys_regs, BT1_CCU_PCIE_GENC, in bt1_pcie_start_link()
271 ret = regmap_read_poll_timeout(btpci->sys_regs, BT1_CCU_PCIE_PMSC, val, in bt1_pcie_start_link()
279 ret = regmap_read_poll_timeout(btpci->sys_regs, BT1_CCU_PCIE_PMSC, val, in bt1_pcie_start_link()
296 ret = regmap_read_poll_timeout(btpci->sys_regs, BT1_CCU_PCIE_PMSC, val, in bt1_pcie_start_link()
307 struct bt1_pcie *btpci = to_bt1_pcie(pci); in bt1_pcie_stop_link() local
309 regmap_update_bits(btpci->sys_regs, BT1_CCU_PCIE_GENC, in bt1_pcie_stop_link()
327 static int bt1_pcie_get_resources(struct bt1_pcie *btpci) in bt1_pcie_get_resources() argument
329 struct device *dev = btpci->dw.dev; in bt1_pcie_get_resources()
333 btpci->dw.pp.bridge->ops = &bt1_pci_ops; in bt1_pcie_get_resources()
336 btpci->sys_regs = in bt1_pcie_get_resources()
338 if (IS_ERR(btpci->sys_regs)) in bt1_pcie_get_resources()
339 return dev_err_probe(dev, PTR_ERR(btpci->sys_regs), in bt1_pcie_get_resources()
344 if (!btpci->dw.app_clks[bt1_pcie_app_clks[i]].clk) { in bt1_pcie_get_resources()
351 if (!btpci->dw.core_clks[bt1_pcie_core_clks[i]].clk) { in bt1_pcie_get_resources()
358 if (!btpci->dw.app_rsts[bt1_pcie_app_rsts[i]].rstc) { in bt1_pcie_get_resources()
365 if (!btpci->dw.core_rsts[bt1_pcie_core_rsts[i]].rstc) { in bt1_pcie_get_resources()
374 static void bt1_pcie_full_stop_bus(struct bt1_pcie *btpci, bool init) in bt1_pcie_full_stop_bus() argument
376 struct device *dev = btpci->dw.dev; in bt1_pcie_full_stop_bus()
377 struct dw_pcie *pci = &btpci->dw; in bt1_pcie_full_stop_bus()
381 regmap_update_bits(btpci->sys_regs, BT1_CCU_PCIE_GENC, in bt1_pcie_full_stop_bus()
413 static int bt1_pcie_cold_start_bus(struct bt1_pcie *btpci) in bt1_pcie_cold_start_bus() argument
415 struct device *dev = btpci->dw.dev; in bt1_pcie_cold_start_bus()
416 struct dw_pcie *pci = &btpci->dw; in bt1_pcie_cold_start_bus()
434 ret = regmap_read_poll_timeout(btpci->sys_regs, BT1_CCU_PCIE_RSTC, val, in bt1_pcie_cold_start_bus()
462 ret = regmap_read_poll_timeout(btpci->sys_regs, BT1_CCU_PCIE_RSTC, val, in bt1_pcie_cold_start_bus()
541 struct bt1_pcie *btpci = to_bt1_pcie(pci); in bt1_pcie_host_init() local
544 ret = bt1_pcie_get_resources(btpci); in bt1_pcie_host_init()
548 bt1_pcie_full_stop_bus(btpci, true); in bt1_pcie_host_init()
550 return bt1_pcie_cold_start_bus(btpci); in bt1_pcie_host_init()
556 struct bt1_pcie *btpci = to_bt1_pcie(pci); in bt1_pcie_host_deinit() local
558 bt1_pcie_full_stop_bus(btpci, false); in bt1_pcie_host_deinit()
568 struct bt1_pcie *btpci; in bt1_pcie_create_data() local
570 btpci = devm_kzalloc(&pdev->dev, sizeof(*btpci), GFP_KERNEL); in bt1_pcie_create_data()
571 if (!btpci) in bt1_pcie_create_data()
574 btpci->pdev = pdev; in bt1_pcie_create_data()
576 platform_set_drvdata(pdev, btpci); in bt1_pcie_create_data()
578 return btpci; in bt1_pcie_create_data()
581 static int bt1_pcie_add_port(struct bt1_pcie *btpci) in bt1_pcie_add_port() argument
583 struct device *dev = &btpci->pdev->dev; in bt1_pcie_add_port()
590 btpci->dw.version = DW_PCIE_VER_460A; in bt1_pcie_add_port()
591 btpci->dw.dev = dev; in bt1_pcie_add_port()
592 btpci->dw.ops = &bt1_pcie_ops; in bt1_pcie_add_port()
594 btpci->dw.pp.num_vectors = MAX_MSI_IRQS; in bt1_pcie_add_port()
595 btpci->dw.pp.ops = &bt1_pcie_host_ops; in bt1_pcie_add_port()
597 dw_pcie_cap_set(&btpci->dw, REQ_RES); in bt1_pcie_add_port()
599 ret = dw_pcie_host_init(&btpci->dw.pp); in bt1_pcie_add_port()
604 static void bt1_pcie_del_port(struct bt1_pcie *btpci) in bt1_pcie_del_port() argument
606 dw_pcie_host_deinit(&btpci->dw.pp); in bt1_pcie_del_port()
611 struct bt1_pcie *btpci; in bt1_pcie_probe() local
613 btpci = bt1_pcie_create_data(pdev); in bt1_pcie_probe()
614 if (IS_ERR(btpci)) in bt1_pcie_probe()
615 return PTR_ERR(btpci); in bt1_pcie_probe()
617 return bt1_pcie_add_port(btpci); in bt1_pcie_probe()
622 struct bt1_pcie *btpci = platform_get_drvdata(pdev); in bt1_pcie_remove() local
624 bt1_pcie_del_port(btpci); in bt1_pcie_remove()