kirin_pcie 96 drivers/pci/controller/dwc/pcie-kirin.c static inline void kirin_apb_ctrl_writel(struct kirin_pcie *kirin_pcie, kirin_pcie 99 drivers/pci/controller/dwc/pcie-kirin.c writel(val, kirin_pcie->apb_base + reg); kirin_pcie 102 drivers/pci/controller/dwc/pcie-kirin.c static inline u32 kirin_apb_ctrl_readl(struct kirin_pcie *kirin_pcie, u32 reg) kirin_pcie 104 drivers/pci/controller/dwc/pcie-kirin.c return readl(kirin_pcie->apb_base + reg); kirin_pcie 108 drivers/pci/controller/dwc/pcie-kirin.c static inline void kirin_apb_phy_writel(struct kirin_pcie *kirin_pcie, kirin_pcie 111 drivers/pci/controller/dwc/pcie-kirin.c writel(val, kirin_pcie->phy_base + reg); kirin_pcie 114 drivers/pci/controller/dwc/pcie-kirin.c static inline u32 kirin_apb_phy_readl(struct kirin_pcie *kirin_pcie, u32 reg) kirin_pcie 116 drivers/pci/controller/dwc/pcie-kirin.c return readl(kirin_pcie->phy_base + reg); kirin_pcie 119 drivers/pci/controller/dwc/pcie-kirin.c static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie, kirin_pcie 124 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie->phy_ref_clk = devm_clk_get(dev, "pcie_phy_ref"); kirin_pcie 125 drivers/pci/controller/dwc/pcie-kirin.c if (IS_ERR(kirin_pcie->phy_ref_clk)) kirin_pcie 126 drivers/pci/controller/dwc/pcie-kirin.c return PTR_ERR(kirin_pcie->phy_ref_clk); kirin_pcie 128 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie->pcie_aux_clk = devm_clk_get(dev, "pcie_aux"); kirin_pcie 129 drivers/pci/controller/dwc/pcie-kirin.c if (IS_ERR(kirin_pcie->pcie_aux_clk)) kirin_pcie 130 drivers/pci/controller/dwc/pcie-kirin.c return PTR_ERR(kirin_pcie->pcie_aux_clk); kirin_pcie 132 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie->apb_phy_clk = devm_clk_get(dev, "pcie_apb_phy"); kirin_pcie 133 drivers/pci/controller/dwc/pcie-kirin.c if (IS_ERR(kirin_pcie->apb_phy_clk)) kirin_pcie 134 drivers/pci/controller/dwc/pcie-kirin.c return PTR_ERR(kirin_pcie->apb_phy_clk); kirin_pcie 136 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie->apb_sys_clk = devm_clk_get(dev, "pcie_apb_sys"); kirin_pcie 137 drivers/pci/controller/dwc/pcie-kirin.c if (IS_ERR(kirin_pcie->apb_sys_clk)) kirin_pcie 138 drivers/pci/controller/dwc/pcie-kirin.c return PTR_ERR(kirin_pcie->apb_sys_clk); kirin_pcie 140 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie->pcie_aclk = devm_clk_get(dev, "pcie_aclk"); kirin_pcie 141 drivers/pci/controller/dwc/pcie-kirin.c if (IS_ERR(kirin_pcie->pcie_aclk)) kirin_pcie 142 drivers/pci/controller/dwc/pcie-kirin.c return PTR_ERR(kirin_pcie->pcie_aclk); kirin_pcie 147 drivers/pci/controller/dwc/pcie-kirin.c static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie, kirin_pcie 156 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie->apb_base = devm_ioremap_resource(dev, apb); kirin_pcie 157 drivers/pci/controller/dwc/pcie-kirin.c if (IS_ERR(kirin_pcie->apb_base)) kirin_pcie 158 drivers/pci/controller/dwc/pcie-kirin.c return PTR_ERR(kirin_pcie->apb_base); kirin_pcie 161 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie->phy_base = devm_ioremap_resource(dev, phy); kirin_pcie 162 drivers/pci/controller/dwc/pcie-kirin.c if (IS_ERR(kirin_pcie->phy_base)) kirin_pcie 163 drivers/pci/controller/dwc/pcie-kirin.c return PTR_ERR(kirin_pcie->phy_base); kirin_pcie 166 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie->pci->dbi_base = devm_ioremap_resource(dev, dbi); kirin_pcie 167 drivers/pci/controller/dwc/pcie-kirin.c if (IS_ERR(kirin_pcie->pci->dbi_base)) kirin_pcie 168 drivers/pci/controller/dwc/pcie-kirin.c return PTR_ERR(kirin_pcie->pci->dbi_base); kirin_pcie 170 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie->crgctrl = kirin_pcie 172 drivers/pci/controller/dwc/pcie-kirin.c if (IS_ERR(kirin_pcie->crgctrl)) kirin_pcie 173 drivers/pci/controller/dwc/pcie-kirin.c return PTR_ERR(kirin_pcie->crgctrl); kirin_pcie 175 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie->sysctrl = kirin_pcie 177 drivers/pci/controller/dwc/pcie-kirin.c if (IS_ERR(kirin_pcie->sysctrl)) kirin_pcie 178 drivers/pci/controller/dwc/pcie-kirin.c return PTR_ERR(kirin_pcie->sysctrl); kirin_pcie 183 drivers/pci/controller/dwc/pcie-kirin.c static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie) kirin_pcie 185 drivers/pci/controller/dwc/pcie-kirin.c struct device *dev = kirin_pcie->pci->dev; kirin_pcie 188 drivers/pci/controller/dwc/pcie-kirin.c reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL1); kirin_pcie 190 drivers/pci/controller/dwc/pcie-kirin.c kirin_apb_phy_writel(kirin_pcie, reg_val, PCIE_APB_PHY_CTRL1); kirin_pcie 192 drivers/pci/controller/dwc/pcie-kirin.c reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL0); kirin_pcie 194 drivers/pci/controller/dwc/pcie-kirin.c kirin_apb_phy_writel(kirin_pcie, reg_val, PCIE_APB_PHY_CTRL0); kirin_pcie 197 drivers/pci/controller/dwc/pcie-kirin.c reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_CTRL1); kirin_pcie 199 drivers/pci/controller/dwc/pcie-kirin.c kirin_apb_phy_writel(kirin_pcie, reg_val, PCIE_APB_PHY_CTRL1); kirin_pcie 202 drivers/pci/controller/dwc/pcie-kirin.c reg_val = kirin_apb_phy_readl(kirin_pcie, PCIE_APB_PHY_STATUS0); kirin_pcie 211 drivers/pci/controller/dwc/pcie-kirin.c static void kirin_pcie_oe_enable(struct kirin_pcie *kirin_pcie) kirin_pcie 215 drivers/pci/controller/dwc/pcie-kirin.c regmap_read(kirin_pcie->sysctrl, SCTRL_PCIE_OE_OFFSET, &val); kirin_pcie 218 drivers/pci/controller/dwc/pcie-kirin.c regmap_write(kirin_pcie->sysctrl, SCTRL_PCIE_OE_OFFSET, val); kirin_pcie 221 drivers/pci/controller/dwc/pcie-kirin.c static int kirin_pcie_clk_ctrl(struct kirin_pcie *kirin_pcie, bool enable) kirin_pcie 228 drivers/pci/controller/dwc/pcie-kirin.c ret = clk_set_rate(kirin_pcie->phy_ref_clk, REF_CLK_FREQ); kirin_pcie 232 drivers/pci/controller/dwc/pcie-kirin.c ret = clk_prepare_enable(kirin_pcie->phy_ref_clk); kirin_pcie 236 drivers/pci/controller/dwc/pcie-kirin.c ret = clk_prepare_enable(kirin_pcie->apb_sys_clk); kirin_pcie 240 drivers/pci/controller/dwc/pcie-kirin.c ret = clk_prepare_enable(kirin_pcie->apb_phy_clk); kirin_pcie 244 drivers/pci/controller/dwc/pcie-kirin.c ret = clk_prepare_enable(kirin_pcie->pcie_aclk); kirin_pcie 248 drivers/pci/controller/dwc/pcie-kirin.c ret = clk_prepare_enable(kirin_pcie->pcie_aux_clk); kirin_pcie 255 drivers/pci/controller/dwc/pcie-kirin.c clk_disable_unprepare(kirin_pcie->pcie_aux_clk); kirin_pcie 257 drivers/pci/controller/dwc/pcie-kirin.c clk_disable_unprepare(kirin_pcie->pcie_aclk); kirin_pcie 259 drivers/pci/controller/dwc/pcie-kirin.c clk_disable_unprepare(kirin_pcie->apb_phy_clk); kirin_pcie 261 drivers/pci/controller/dwc/pcie-kirin.c clk_disable_unprepare(kirin_pcie->apb_sys_clk); kirin_pcie 263 drivers/pci/controller/dwc/pcie-kirin.c clk_disable_unprepare(kirin_pcie->phy_ref_clk); kirin_pcie 268 drivers/pci/controller/dwc/pcie-kirin.c static int kirin_pcie_power_on(struct kirin_pcie *kirin_pcie) kirin_pcie 273 drivers/pci/controller/dwc/pcie-kirin.c regmap_write(kirin_pcie->sysctrl, kirin_pcie 276 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie_oe_enable(kirin_pcie); kirin_pcie 278 drivers/pci/controller/dwc/pcie-kirin.c ret = kirin_pcie_clk_ctrl(kirin_pcie, true); kirin_pcie 283 drivers/pci/controller/dwc/pcie-kirin.c regmap_write(kirin_pcie->sysctrl, kirin_pcie 285 drivers/pci/controller/dwc/pcie-kirin.c regmap_write(kirin_pcie->crgctrl, kirin_pcie 287 drivers/pci/controller/dwc/pcie-kirin.c regmap_write(kirin_pcie->sysctrl, kirin_pcie 290 drivers/pci/controller/dwc/pcie-kirin.c ret = kirin_pcie_phy_init(kirin_pcie); kirin_pcie 295 drivers/pci/controller/dwc/pcie-kirin.c if (!gpio_request(kirin_pcie->gpio_id_reset, "pcie_perst")) { kirin_pcie 297 drivers/pci/controller/dwc/pcie-kirin.c ret = gpio_direction_output(kirin_pcie->gpio_id_reset, 1); kirin_pcie 306 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie_clk_ctrl(kirin_pcie, false); kirin_pcie 310 drivers/pci/controller/dwc/pcie-kirin.c static void kirin_pcie_sideband_dbi_w_mode(struct kirin_pcie *kirin_pcie, kirin_pcie 315 drivers/pci/controller/dwc/pcie-kirin.c val = kirin_apb_ctrl_readl(kirin_pcie, SOC_PCIECTRL_CTRL0_ADDR); kirin_pcie 321 drivers/pci/controller/dwc/pcie-kirin.c kirin_apb_ctrl_writel(kirin_pcie, val, SOC_PCIECTRL_CTRL0_ADDR); kirin_pcie 324 drivers/pci/controller/dwc/pcie-kirin.c static void kirin_pcie_sideband_dbi_r_mode(struct kirin_pcie *kirin_pcie, kirin_pcie 329 drivers/pci/controller/dwc/pcie-kirin.c val = kirin_apb_ctrl_readl(kirin_pcie, SOC_PCIECTRL_CTRL1_ADDR); kirin_pcie 335 drivers/pci/controller/dwc/pcie-kirin.c kirin_apb_ctrl_writel(kirin_pcie, val, SOC_PCIECTRL_CTRL1_ADDR); kirin_pcie 342 drivers/pci/controller/dwc/pcie-kirin.c struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci); kirin_pcie 345 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie_sideband_dbi_r_mode(kirin_pcie, true); kirin_pcie 347 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie_sideband_dbi_r_mode(kirin_pcie, false); kirin_pcie 356 drivers/pci/controller/dwc/pcie-kirin.c struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci); kirin_pcie 359 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie_sideband_dbi_w_mode(kirin_pcie, true); kirin_pcie 361 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie_sideband_dbi_w_mode(kirin_pcie, false); kirin_pcie 369 drivers/pci/controller/dwc/pcie-kirin.c struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci); kirin_pcie 372 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie_sideband_dbi_r_mode(kirin_pcie, true); kirin_pcie 374 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie_sideband_dbi_r_mode(kirin_pcie, false); kirin_pcie 382 drivers/pci/controller/dwc/pcie-kirin.c struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci); kirin_pcie 384 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie_sideband_dbi_w_mode(kirin_pcie, true); kirin_pcie 386 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie_sideband_dbi_w_mode(kirin_pcie, false); kirin_pcie 391 drivers/pci/controller/dwc/pcie-kirin.c struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci); kirin_pcie 392 drivers/pci/controller/dwc/pcie-kirin.c u32 val = kirin_apb_ctrl_readl(kirin_pcie, PCIE_APB_PHY_STATUS0); kirin_pcie 403 drivers/pci/controller/dwc/pcie-kirin.c struct kirin_pcie *kirin_pcie = to_kirin_pcie(pci); kirin_pcie 404 drivers/pci/controller/dwc/pcie-kirin.c struct device *dev = kirin_pcie->pci->dev; kirin_pcie 413 drivers/pci/controller/dwc/pcie-kirin.c kirin_apb_ctrl_writel(kirin_pcie, PCIE_LTSSM_ENABLE_BIT, kirin_pcie 487 drivers/pci/controller/dwc/pcie-kirin.c struct kirin_pcie *kirin_pcie; kirin_pcie 496 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie = devm_kzalloc(dev, sizeof(struct kirin_pcie), GFP_KERNEL); kirin_pcie 497 drivers/pci/controller/dwc/pcie-kirin.c if (!kirin_pcie) kirin_pcie 506 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie->pci = pci; kirin_pcie 508 drivers/pci/controller/dwc/pcie-kirin.c ret = kirin_pcie_get_clk(kirin_pcie, pdev); kirin_pcie 512 drivers/pci/controller/dwc/pcie-kirin.c ret = kirin_pcie_get_resource(kirin_pcie, pdev); kirin_pcie 516 drivers/pci/controller/dwc/pcie-kirin.c kirin_pcie->gpio_id_reset = of_get_named_gpio(dev->of_node, kirin_pcie 518 drivers/pci/controller/dwc/pcie-kirin.c if (kirin_pcie->gpio_id_reset < 0) kirin_pcie 521 drivers/pci/controller/dwc/pcie-kirin.c ret = kirin_pcie_power_on(kirin_pcie); kirin_pcie 525 drivers/pci/controller/dwc/pcie-kirin.c platform_set_drvdata(pdev, kirin_pcie);