Lines Matching +full:aspm +full:- +full:no +full:- +full:l0s

1 // SPDX-License-Identifier: GPL-2.0
74 /* PCIe V2 per-port registers */
127 (GENMASK(((size) - 1), 0) << ((where) & 0x3))
145 * struct mtk_pcie_soc - differentiate between host generations
148 * @no_msi: Bridge has no MSI support, and relies on an external block
165 * struct mtk_pcie_port - PCIe port information
209 * struct mtk_pcie - PCIe host information
213 * @free_ck: free-run reference clock
214 * @mem: non-prefetchable memory resource
216 * @soc: pointer to SoC-dependent operations
230 struct device *dev = pcie->dev; in mtk_pcie_subsys_powerdown()
232 clk_disable_unprepare(pcie->free_ck); in mtk_pcie_subsys_powerdown()
240 struct mtk_pcie *pcie = port->pcie; in mtk_pcie_port_free()
241 struct device *dev = pcie->dev; in mtk_pcie_port_free()
243 devm_iounmap(dev, port->base); in mtk_pcie_port_free()
244 list_del(&port->list); in mtk_pcie_port_free()
252 list_for_each_entry_safe(port, tmp, &pcie->ports, list) { in mtk_pcie_put_resources()
253 phy_power_off(port->phy); in mtk_pcie_put_resources()
254 phy_exit(port->phy); in mtk_pcie_put_resources()
255 clk_disable_unprepare(port->pipe_ck); in mtk_pcie_put_resources()
256 clk_disable_unprepare(port->obff_ck); in mtk_pcie_put_resources()
257 clk_disable_unprepare(port->axi_ck); in mtk_pcie_put_resources()
258 clk_disable_unprepare(port->aux_ck); in mtk_pcie_put_resources()
259 clk_disable_unprepare(port->ahb_ck); in mtk_pcie_put_resources()
260 clk_disable_unprepare(port->sys_ck); in mtk_pcie_put_resources()
272 err = readl_poll_timeout_atomic(port->base + PCIE_APP_TLP_REQ, val, in mtk_pcie_check_cfg_cpld()
278 if (readl(port->base + PCIE_APP_TLP_REQ) & APP_CPL_STATUS) in mtk_pcie_check_cfg_cpld()
291 port->base + PCIE_CFG_HEADER0); in mtk_pcie_hw_rd_cfg()
292 writel(CFG_HEADER_DW1(where, size), port->base + PCIE_CFG_HEADER1); in mtk_pcie_hw_rd_cfg()
294 port->base + PCIE_CFG_HEADER2); in mtk_pcie_hw_rd_cfg()
297 tmp = readl(port->base + PCIE_APP_TLP_REQ); in mtk_pcie_hw_rd_cfg()
299 writel(tmp, port->base + PCIE_APP_TLP_REQ); in mtk_pcie_hw_rd_cfg()
306 *val = readl(port->base + PCIE_CFG_RDATA); in mtk_pcie_hw_rd_cfg()
321 port->base + PCIE_CFG_HEADER0); in mtk_pcie_hw_wr_cfg()
322 writel(CFG_HEADER_DW1(where, size), port->base + PCIE_CFG_HEADER1); in mtk_pcie_hw_wr_cfg()
324 port->base + PCIE_CFG_HEADER2); in mtk_pcie_hw_wr_cfg()
328 writel(val, port->base + PCIE_CFG_WDATA); in mtk_pcie_hw_wr_cfg()
331 val = readl(port->base + PCIE_APP_TLP_REQ); in mtk_pcie_hw_wr_cfg()
333 writel(val, port->base + PCIE_APP_TLP_REQ); in mtk_pcie_hw_wr_cfg()
342 struct mtk_pcie *pcie = bus->sysdata; in mtk_pcie_find_port()
350 while (bus && bus->number) { in mtk_pcie_find_port()
351 dev = bus->self; in mtk_pcie_find_port()
352 bus = dev->bus; in mtk_pcie_find_port()
353 devfn = dev->devfn; in mtk_pcie_find_port()
356 list_for_each_entry(port, &pcie->ports, list) in mtk_pcie_find_port()
357 if (port->slot == PCI_SLOT(devfn)) in mtk_pcie_find_port()
367 u32 bn = bus->number; in mtk_pcie_config_read()
380 u32 bn = bus->number; in mtk_pcie_config_write()
399 /* MT2712/MT7622 only support 32-bit MSI addresses */ in mtk_compose_msi_msg()
400 addr = virt_to_phys(port->base + PCIE_MSI_VECTOR); in mtk_compose_msi_msg()
401 msg->address_hi = 0; in mtk_compose_msi_msg()
402 msg->address_lo = lower_32_bits(addr); in mtk_compose_msi_msg()
404 msg->data = data->hwirq; in mtk_compose_msi_msg()
406 dev_dbg(port->pcie->dev, "msi#%d address_hi %#x address_lo %#x\n", in mtk_compose_msi_msg()
407 (int)data->hwirq, msg->address_hi, msg->address_lo); in mtk_compose_msi_msg()
413 return -EINVAL; in mtk_msi_set_affinity()
419 u32 hwirq = data->hwirq; in mtk_msi_ack_irq()
421 writel(1 << hwirq, port->base + PCIE_IMSI_STATUS); in mtk_msi_ack_irq()
434 struct mtk_pcie_port *port = domain->host_data; in mtk_pcie_irq_domain_alloc()
438 mutex_lock(&port->lock); in mtk_pcie_irq_domain_alloc()
440 bit = find_first_zero_bit(port->msi_irq_in_use, MTK_MSI_IRQS_NUM); in mtk_pcie_irq_domain_alloc()
442 mutex_unlock(&port->lock); in mtk_pcie_irq_domain_alloc()
443 return -ENOSPC; in mtk_pcie_irq_domain_alloc()
446 __set_bit(bit, port->msi_irq_in_use); in mtk_pcie_irq_domain_alloc()
448 mutex_unlock(&port->lock); in mtk_pcie_irq_domain_alloc()
451 domain->host_data, handle_edge_irq, in mtk_pcie_irq_domain_alloc()
463 mutex_lock(&port->lock); in mtk_pcie_irq_domain_free()
465 if (!test_bit(d->hwirq, port->msi_irq_in_use)) in mtk_pcie_irq_domain_free()
466 dev_err(port->pcie->dev, "trying to free unused MSI#%lu\n", in mtk_pcie_irq_domain_free()
467 d->hwirq); in mtk_pcie_irq_domain_free()
469 __clear_bit(d->hwirq, port->msi_irq_in_use); in mtk_pcie_irq_domain_free()
471 mutex_unlock(&port->lock); in mtk_pcie_irq_domain_free()
496 struct fwnode_handle *fwnode = of_node_to_fwnode(port->pcie->dev->of_node); in mtk_pcie_allocate_msi_domains()
498 mutex_init(&port->lock); in mtk_pcie_allocate_msi_domains()
500 port->inner_domain = irq_domain_create_linear(fwnode, MTK_MSI_IRQS_NUM, in mtk_pcie_allocate_msi_domains()
502 if (!port->inner_domain) { in mtk_pcie_allocate_msi_domains()
503 dev_err(port->pcie->dev, "failed to create IRQ domain\n"); in mtk_pcie_allocate_msi_domains()
504 return -ENOMEM; in mtk_pcie_allocate_msi_domains()
507 port->msi_domain = pci_msi_create_irq_domain(fwnode, &mtk_msi_domain_info, in mtk_pcie_allocate_msi_domains()
508 port->inner_domain); in mtk_pcie_allocate_msi_domains()
509 if (!port->msi_domain) { in mtk_pcie_allocate_msi_domains()
510 dev_err(port->pcie->dev, "failed to create MSI domain\n"); in mtk_pcie_allocate_msi_domains()
511 irq_domain_remove(port->inner_domain); in mtk_pcie_allocate_msi_domains()
512 return -ENOMEM; in mtk_pcie_allocate_msi_domains()
523 msg_addr = virt_to_phys(port->base + PCIE_MSI_VECTOR); in mtk_pcie_enable_msi()
525 writel(val, port->base + PCIE_IMSI_ADDR); in mtk_pcie_enable_msi()
527 val = readl(port->base + PCIE_INT_MASK); in mtk_pcie_enable_msi()
529 writel(val, port->base + PCIE_INT_MASK); in mtk_pcie_enable_msi()
536 list_for_each_entry_safe(port, tmp, &pcie->ports, list) { in mtk_pcie_irq_teardown()
537 irq_set_chained_handler_and_data(port->irq, NULL, NULL); in mtk_pcie_irq_teardown()
539 if (port->irq_domain) in mtk_pcie_irq_teardown()
540 irq_domain_remove(port->irq_domain); in mtk_pcie_irq_teardown()
543 if (port->msi_domain) in mtk_pcie_irq_teardown()
544 irq_domain_remove(port->msi_domain); in mtk_pcie_irq_teardown()
545 if (port->inner_domain) in mtk_pcie_irq_teardown()
546 irq_domain_remove(port->inner_domain); in mtk_pcie_irq_teardown()
549 irq_dispose_mapping(port->irq); in mtk_pcie_irq_teardown()
557 irq_set_chip_data(irq, domain->host_data); in mtk_pcie_intx_map()
569 struct device *dev = port->pcie->dev; in mtk_pcie_init_irq_domain()
576 dev_err(dev, "no PCIe Intc node found\n"); in mtk_pcie_init_irq_domain()
577 return -ENODEV; in mtk_pcie_init_irq_domain()
580 port->irq_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX, in mtk_pcie_init_irq_domain()
583 if (!port->irq_domain) { in mtk_pcie_init_irq_domain()
585 return -ENODEV; in mtk_pcie_init_irq_domain()
606 status = readl(port->base + PCIE_INT_STATUS); in mtk_pcie_intr_handler()
610 writel(1 << bit, port->base + PCIE_INT_STATUS); in mtk_pcie_intr_handler()
611 generic_handle_domain_irq(port->irq_domain, in mtk_pcie_intr_handler()
612 bit - INTX_SHIFT); in mtk_pcie_intr_handler()
623 * edge-triggered interrupt type, its status should in mtk_pcie_intr_handler()
627 writel(MSI_STATUS, port->base + PCIE_INT_STATUS); in mtk_pcie_intr_handler()
628 while ((imsi_status = readl(port->base + PCIE_IMSI_STATUS))) { in mtk_pcie_intr_handler()
630 generic_handle_domain_irq(port->inner_domain, bit); in mtk_pcie_intr_handler()
641 struct mtk_pcie *pcie = port->pcie; in mtk_pcie_setup_irq()
642 struct device *dev = pcie->dev; in mtk_pcie_setup_irq()
652 if (of_property_present(dev->of_node, "interrupt-names")) in mtk_pcie_setup_irq()
653 port->irq = platform_get_irq_byname(pdev, "pcie_irq"); in mtk_pcie_setup_irq()
655 port->irq = platform_get_irq(pdev, port->slot); in mtk_pcie_setup_irq()
657 if (port->irq < 0) in mtk_pcie_setup_irq()
658 return port->irq; in mtk_pcie_setup_irq()
660 irq_set_chained_handler_and_data(port->irq, in mtk_pcie_setup_irq()
668 struct mtk_pcie *pcie = port->pcie; in mtk_pcie_startup_port_v2()
672 const struct mtk_pcie_soc *soc = port->pcie->soc; in mtk_pcie_startup_port_v2()
676 entry = resource_list_first_type(&host->windows, IORESOURCE_MEM); in mtk_pcie_startup_port_v2()
678 mem = entry->res; in mtk_pcie_startup_port_v2()
680 return -EINVAL; in mtk_pcie_startup_port_v2()
682 /* MT7622 platforms need to enable LTSSM and ASPM from PCIe subsys */ in mtk_pcie_startup_port_v2()
683 if (pcie->base) { in mtk_pcie_startup_port_v2()
684 val = readl(pcie->base + PCIE_SYS_CFG_V2); in mtk_pcie_startup_port_v2()
685 val |= PCIE_CSR_LTSSM_EN(port->slot) | in mtk_pcie_startup_port_v2()
686 PCIE_CSR_ASPM_L1_EN(port->slot); in mtk_pcie_startup_port_v2()
687 writel(val, pcie->base + PCIE_SYS_CFG_V2); in mtk_pcie_startup_port_v2()
688 } else if (pcie->cfg) { in mtk_pcie_startup_port_v2()
689 val = PCIE_CSR_LTSSM_EN(port->slot) | in mtk_pcie_startup_port_v2()
690 PCIE_CSR_ASPM_L1_EN(port->slot); in mtk_pcie_startup_port_v2()
691 regmap_update_bits(pcie->cfg, PCIE_SYS_CFG_V2, val, val); in mtk_pcie_startup_port_v2()
695 writel(0, port->base + PCIE_RST_CTRL); in mtk_pcie_startup_port_v2()
702 writel(PCIE_LINKDOWN_RST_EN, port->base + PCIE_RST_CTRL); in mtk_pcie_startup_port_v2()
706 * 2.2.1 (Initial Power-Up (G3 to S0)). The deassertion of PERST# should in mtk_pcie_startup_port_v2()
711 /* De-assert PHY, PE, PIPE, MAC and configuration reset */ in mtk_pcie_startup_port_v2()
712 val = readl(port->base + PCIE_RST_CTRL); in mtk_pcie_startup_port_v2()
715 writel(val, port->base + PCIE_RST_CTRL); in mtk_pcie_startup_port_v2()
718 if (soc->need_fix_class_id) { in mtk_pcie_startup_port_v2()
720 writew(val, port->base + PCIE_CONF_VEND_ID); in mtk_pcie_startup_port_v2()
723 writew(val, port->base + PCIE_CONF_CLASS_ID); in mtk_pcie_startup_port_v2()
726 if (soc->need_fix_device_id) in mtk_pcie_startup_port_v2()
727 writew(soc->device_id, port->base + PCIE_CONF_DEVICE_ID); in mtk_pcie_startup_port_v2()
730 err = readl_poll_timeout(port->base + PCIE_LINK_STATUS_V2, val, in mtk_pcie_startup_port_v2()
734 return -ETIMEDOUT; in mtk_pcie_startup_port_v2()
737 val = readl(port->base + PCIE_INT_MASK); in mtk_pcie_startup_port_v2()
739 writel(val, port->base + PCIE_INT_MASK); in mtk_pcie_startup_port_v2()
745 val = lower_32_bits(mem->start) | in mtk_pcie_startup_port_v2()
747 writel(val, port->base + PCIE_AHB_TRANS_BASE0_L); in mtk_pcie_startup_port_v2()
749 val = upper_32_bits(mem->start); in mtk_pcie_startup_port_v2()
750 writel(val, port->base + PCIE_AHB_TRANS_BASE0_H); in mtk_pcie_startup_port_v2()
754 writel(val, port->base + PCIE_AXI_WINDOW0); in mtk_pcie_startup_port_v2()
762 struct mtk_pcie *pcie = bus->sysdata; in mtk_pcie_map_bus()
765 bus->number), pcie->base + PCIE_CFG_ADDR); in mtk_pcie_map_bus()
767 return pcie->base + PCIE_CFG_DATA + (where & 3); in mtk_pcie_map_bus()
778 struct mtk_pcie *pcie = port->pcie; in mtk_pcie_startup_port()
779 u32 func = PCI_FUNC(port->slot); in mtk_pcie_startup_port()
780 u32 slot = PCI_SLOT(port->slot << 3); in mtk_pcie_startup_port()
785 val = readl(pcie->base + PCIE_SYS_CFG); in mtk_pcie_startup_port()
786 val |= PCIE_PORT_PERST(port->slot); in mtk_pcie_startup_port()
787 writel(val, pcie->base + PCIE_SYS_CFG); in mtk_pcie_startup_port()
789 /* de-assert port PERST_N */ in mtk_pcie_startup_port()
790 val = readl(pcie->base + PCIE_SYS_CFG); in mtk_pcie_startup_port()
791 val &= ~PCIE_PORT_PERST(port->slot); in mtk_pcie_startup_port()
792 writel(val, pcie->base + PCIE_SYS_CFG); in mtk_pcie_startup_port()
795 err = readl_poll_timeout(port->base + PCIE_LINK_STATUS, val, in mtk_pcie_startup_port()
799 return -ETIMEDOUT; in mtk_pcie_startup_port()
802 val = readl(pcie->base + PCIE_INT_ENABLE); in mtk_pcie_startup_port()
803 val |= PCIE_PORT_INT_EN(port->slot); in mtk_pcie_startup_port()
804 writel(val, pcie->base + PCIE_INT_ENABLE); in mtk_pcie_startup_port()
808 port->base + PCIE_BAR0_SETUP); in mtk_pcie_startup_port()
811 writel(PCIE_CLASS_CODE | PCIE_REVISION_ID, port->base + PCIE_CLASS); in mtk_pcie_startup_port()
815 pcie->base + PCIE_CFG_ADDR); in mtk_pcie_startup_port()
816 val = readl(pcie->base + PCIE_CFG_DATA); in mtk_pcie_startup_port()
820 pcie->base + PCIE_CFG_ADDR); in mtk_pcie_startup_port()
821 writel(val, pcie->base + PCIE_CFG_DATA); in mtk_pcie_startup_port()
823 /* configure RC FTS number to 250 when it leaves L0s */ in mtk_pcie_startup_port()
825 pcie->base + PCIE_CFG_ADDR); in mtk_pcie_startup_port()
826 val = readl(pcie->base + PCIE_CFG_DATA); in mtk_pcie_startup_port()
830 pcie->base + PCIE_CFG_ADDR); in mtk_pcie_startup_port()
831 writel(val, pcie->base + PCIE_CFG_DATA); in mtk_pcie_startup_port()
838 struct mtk_pcie *pcie = port->pcie; in mtk_pcie_enable_port()
839 struct device *dev = pcie->dev; in mtk_pcie_enable_port()
842 err = clk_prepare_enable(port->sys_ck); in mtk_pcie_enable_port()
844 dev_err(dev, "failed to enable sys_ck%d clock\n", port->slot); in mtk_pcie_enable_port()
848 err = clk_prepare_enable(port->ahb_ck); in mtk_pcie_enable_port()
850 dev_err(dev, "failed to enable ahb_ck%d\n", port->slot); in mtk_pcie_enable_port()
854 err = clk_prepare_enable(port->aux_ck); in mtk_pcie_enable_port()
856 dev_err(dev, "failed to enable aux_ck%d\n", port->slot); in mtk_pcie_enable_port()
860 err = clk_prepare_enable(port->axi_ck); in mtk_pcie_enable_port()
862 dev_err(dev, "failed to enable axi_ck%d\n", port->slot); in mtk_pcie_enable_port()
866 err = clk_prepare_enable(port->obff_ck); in mtk_pcie_enable_port()
868 dev_err(dev, "failed to enable obff_ck%d\n", port->slot); in mtk_pcie_enable_port()
872 err = clk_prepare_enable(port->pipe_ck); in mtk_pcie_enable_port()
874 dev_err(dev, "failed to enable pipe_ck%d\n", port->slot); in mtk_pcie_enable_port()
878 reset_control_assert(port->reset); in mtk_pcie_enable_port()
879 reset_control_deassert(port->reset); in mtk_pcie_enable_port()
881 err = phy_init(port->phy); in mtk_pcie_enable_port()
883 dev_err(dev, "failed to initialize port%d phy\n", port->slot); in mtk_pcie_enable_port()
887 err = phy_power_on(port->phy); in mtk_pcie_enable_port()
889 dev_err(dev, "failed to power on port%d phy\n", port->slot); in mtk_pcie_enable_port()
893 if (!pcie->soc->startup(port)) in mtk_pcie_enable_port()
896 dev_info(dev, "Port%d link down\n", port->slot); in mtk_pcie_enable_port()
898 phy_power_off(port->phy); in mtk_pcie_enable_port()
900 phy_exit(port->phy); in mtk_pcie_enable_port()
902 clk_disable_unprepare(port->pipe_ck); in mtk_pcie_enable_port()
904 clk_disable_unprepare(port->obff_ck); in mtk_pcie_enable_port()
906 clk_disable_unprepare(port->axi_ck); in mtk_pcie_enable_port()
908 clk_disable_unprepare(port->aux_ck); in mtk_pcie_enable_port()
910 clk_disable_unprepare(port->ahb_ck); in mtk_pcie_enable_port()
912 clk_disable_unprepare(port->sys_ck); in mtk_pcie_enable_port()
922 struct device *dev = pcie->dev; in mtk_pcie_parse_port()
929 return -ENOMEM; in mtk_pcie_parse_port()
932 port->base = devm_platform_ioremap_resource_byname(pdev, name); in mtk_pcie_parse_port()
933 if (IS_ERR(port->base)) { in mtk_pcie_parse_port()
935 return PTR_ERR(port->base); in mtk_pcie_parse_port()
939 port->sys_ck = devm_clk_get(dev, name); in mtk_pcie_parse_port()
940 if (IS_ERR(port->sys_ck)) { in mtk_pcie_parse_port()
942 return PTR_ERR(port->sys_ck); in mtk_pcie_parse_port()
947 port->ahb_ck = devm_clk_get_optional(dev, name); in mtk_pcie_parse_port()
948 if (IS_ERR(port->ahb_ck)) in mtk_pcie_parse_port()
949 return PTR_ERR(port->ahb_ck); in mtk_pcie_parse_port()
952 port->axi_ck = devm_clk_get_optional(dev, name); in mtk_pcie_parse_port()
953 if (IS_ERR(port->axi_ck)) in mtk_pcie_parse_port()
954 return PTR_ERR(port->axi_ck); in mtk_pcie_parse_port()
957 port->aux_ck = devm_clk_get_optional(dev, name); in mtk_pcie_parse_port()
958 if (IS_ERR(port->aux_ck)) in mtk_pcie_parse_port()
959 return PTR_ERR(port->aux_ck); in mtk_pcie_parse_port()
962 port->obff_ck = devm_clk_get_optional(dev, name); in mtk_pcie_parse_port()
963 if (IS_ERR(port->obff_ck)) in mtk_pcie_parse_port()
964 return PTR_ERR(port->obff_ck); in mtk_pcie_parse_port()
967 port->pipe_ck = devm_clk_get_optional(dev, name); in mtk_pcie_parse_port()
968 if (IS_ERR(port->pipe_ck)) in mtk_pcie_parse_port()
969 return PTR_ERR(port->pipe_ck); in mtk_pcie_parse_port()
971 snprintf(name, sizeof(name), "pcie-rst%d", slot); in mtk_pcie_parse_port()
972 port->reset = devm_reset_control_get_optional_exclusive(dev, name); in mtk_pcie_parse_port()
973 if (PTR_ERR(port->reset) == -EPROBE_DEFER) in mtk_pcie_parse_port()
974 return PTR_ERR(port->reset); in mtk_pcie_parse_port()
977 snprintf(name, sizeof(name), "pcie-phy%d", slot); in mtk_pcie_parse_port()
978 port->phy = devm_phy_optional_get(dev, name); in mtk_pcie_parse_port()
979 if (IS_ERR(port->phy)) in mtk_pcie_parse_port()
980 return PTR_ERR(port->phy); in mtk_pcie_parse_port()
982 port->slot = slot; in mtk_pcie_parse_port()
983 port->pcie = pcie; in mtk_pcie_parse_port()
985 if (pcie->soc->setup_irq) { in mtk_pcie_parse_port()
986 err = pcie->soc->setup_irq(port, node); in mtk_pcie_parse_port()
991 INIT_LIST_HEAD(&port->list); in mtk_pcie_parse_port()
992 list_add_tail(&port->list, &pcie->ports); in mtk_pcie_parse_port()
999 struct device *dev = pcie->dev; in mtk_pcie_subsys_powerup()
1008 pcie->base = devm_ioremap_resource(dev, regs); in mtk_pcie_subsys_powerup()
1009 if (IS_ERR(pcie->base)) in mtk_pcie_subsys_powerup()
1010 return PTR_ERR(pcie->base); in mtk_pcie_subsys_powerup()
1014 "mediatek,generic-pciecfg"); in mtk_pcie_subsys_powerup()
1016 pcie->cfg = syscon_node_to_regmap(cfg_node); in mtk_pcie_subsys_powerup()
1018 if (IS_ERR(pcie->cfg)) in mtk_pcie_subsys_powerup()
1019 return PTR_ERR(pcie->cfg); in mtk_pcie_subsys_powerup()
1022 pcie->free_ck = devm_clk_get(dev, "free_ck"); in mtk_pcie_subsys_powerup()
1023 if (IS_ERR(pcie->free_ck)) { in mtk_pcie_subsys_powerup()
1024 if (PTR_ERR(pcie->free_ck) == -EPROBE_DEFER) in mtk_pcie_subsys_powerup()
1025 return -EPROBE_DEFER; in mtk_pcie_subsys_powerup()
1027 pcie->free_ck = NULL; in mtk_pcie_subsys_powerup()
1034 err = clk_prepare_enable(pcie->free_ck); in mtk_pcie_subsys_powerup()
1051 struct device *dev = pcie->dev; in mtk_pcie_setup()
1052 struct device_node *node = dev->of_node, *child; in mtk_pcie_setup()
1056 slot = of_get_pci_domain_nr(dev->of_node); in mtk_pcie_setup()
1082 list_for_each_entry_safe(port, tmp, &pcie->ports, list) in mtk_pcie_setup()
1086 if (list_empty(&pcie->ports)) in mtk_pcie_setup()
1097 struct device *dev = &pdev->dev; in mtk_pcie_probe()
1104 return -ENOMEM; in mtk_pcie_probe()
1108 pcie->dev = dev; in mtk_pcie_probe()
1109 pcie->soc = of_device_get_match_data(dev); in mtk_pcie_probe()
1111 INIT_LIST_HEAD(&pcie->ports); in mtk_pcie_probe()
1117 host->ops = pcie->soc->ops; in mtk_pcie_probe()
1118 host->sysdata = pcie; in mtk_pcie_probe()
1119 host->msi_domain = pcie->soc->no_msi; in mtk_pcie_probe()
1128 if (!list_empty(&pcie->ports)) in mtk_pcie_probe()
1138 struct list_head *windows = &host->windows; in mtk_pcie_free_resources()
1148 pci_stop_root_bus(host->bus); in mtk_pcie_remove()
1149 pci_remove_root_bus(host->bus); in mtk_pcie_remove()
1162 if (list_empty(&pcie->ports)) in mtk_pcie_suspend_noirq()
1165 list_for_each_entry(port, &pcie->ports, list) { in mtk_pcie_suspend_noirq()
1166 clk_disable_unprepare(port->pipe_ck); in mtk_pcie_suspend_noirq()
1167 clk_disable_unprepare(port->obff_ck); in mtk_pcie_suspend_noirq()
1168 clk_disable_unprepare(port->axi_ck); in mtk_pcie_suspend_noirq()
1169 clk_disable_unprepare(port->aux_ck); in mtk_pcie_suspend_noirq()
1170 clk_disable_unprepare(port->ahb_ck); in mtk_pcie_suspend_noirq()
1171 clk_disable_unprepare(port->sys_ck); in mtk_pcie_suspend_noirq()
1172 phy_power_off(port->phy); in mtk_pcie_suspend_noirq()
1173 phy_exit(port->phy); in mtk_pcie_suspend_noirq()
1176 clk_disable_unprepare(pcie->free_ck); in mtk_pcie_suspend_noirq()
1186 if (list_empty(&pcie->ports)) in mtk_pcie_resume_noirq()
1189 clk_prepare_enable(pcie->free_ck); in mtk_pcie_resume_noirq()
1191 list_for_each_entry_safe(port, tmp, &pcie->ports, list) in mtk_pcie_resume_noirq()
1195 if (list_empty(&pcie->ports)) in mtk_pcie_resume_noirq()
1196 clk_disable_unprepare(pcie->free_ck); in mtk_pcie_resume_noirq()
1235 { .compatible = "mediatek,mt2701-pcie", .data = &mtk_pcie_soc_v1 },
1236 { .compatible = "mediatek,mt7623-pcie", .data = &mtk_pcie_soc_v1 },
1237 { .compatible = "mediatek,mt2712-pcie", .data = &mtk_pcie_soc_mt2712 },
1238 { .compatible = "mediatek,mt7622-pcie", .data = &mtk_pcie_soc_mt7622 },
1239 { .compatible = "mediatek,mt7629-pcie", .data = &mtk_pcie_soc_mt7629 },
1248 .name = "mtk-pcie",