Lines Matching refs:afp
80 static void fu740_pcie_assert_reset(struct fu740_pcie *afp) in fu740_pcie_assert_reset() argument
83 gpiod_set_value_cansleep(afp->reset, 0); in fu740_pcie_assert_reset()
85 writel_relaxed(0x0, afp->mgmt_base + PCIEX8MGMT_PERST_N); in fu740_pcie_assert_reset()
88 static void fu740_pcie_deassert_reset(struct fu740_pcie *afp) in fu740_pcie_deassert_reset() argument
91 writel_relaxed(0x1, afp->mgmt_base + PCIEX8MGMT_PERST_N); in fu740_pcie_deassert_reset()
93 gpiod_set_value_cansleep(afp->reset, 1); in fu740_pcie_deassert_reset()
96 static void fu740_pcie_power_on(struct fu740_pcie *afp) in fu740_pcie_power_on() argument
98 gpiod_set_value_cansleep(afp->pwren, 1); in fu740_pcie_power_on()
107 static void fu740_pcie_drive_reset(struct fu740_pcie *afp) in fu740_pcie_drive_reset() argument
109 fu740_pcie_assert_reset(afp); in fu740_pcie_drive_reset()
110 fu740_pcie_power_on(afp); in fu740_pcie_drive_reset()
111 fu740_pcie_deassert_reset(afp); in fu740_pcie_drive_reset()
115 const uint16_t wrdata, struct fu740_pcie *afp) in fu740_phyregwrite() argument
117 struct device *dev = afp->pci.dev; in fu740_phyregwrite()
126 phy_cr_para_addr = afp->mgmt_base + PCIEX8MGMT_PHY1_CR_PARA_ADDR; in fu740_phyregwrite()
127 phy_cr_para_wr_data = afp->mgmt_base + PCIEX8MGMT_PHY1_CR_PARA_WR_DATA; in fu740_phyregwrite()
128 phy_cr_para_wr_en = afp->mgmt_base + PCIEX8MGMT_PHY1_CR_PARA_WR_EN; in fu740_phyregwrite()
129 phy_cr_para_ack = afp->mgmt_base + PCIEX8MGMT_PHY1_CR_PARA_ACK; in fu740_phyregwrite()
131 phy_cr_para_addr = afp->mgmt_base + PCIEX8MGMT_PHY0_CR_PARA_ADDR; in fu740_phyregwrite()
132 phy_cr_para_wr_data = afp->mgmt_base + PCIEX8MGMT_PHY0_CR_PARA_WR_DATA; in fu740_phyregwrite()
133 phy_cr_para_wr_en = afp->mgmt_base + PCIEX8MGMT_PHY0_CR_PARA_WR_EN; in fu740_phyregwrite()
134 phy_cr_para_ack = afp->mgmt_base + PCIEX8MGMT_PHY0_CR_PARA_ACK; in fu740_phyregwrite()
155 static void fu740_pcie_init_phy(struct fu740_pcie *afp) in fu740_pcie_init_phy() argument
158 writel_relaxed(0x1, afp->mgmt_base + PCIEX8MGMT_PHY0_CR_PARA_SEL); in fu740_pcie_init_phy()
159 writel_relaxed(0x1, afp->mgmt_base + PCIEX8MGMT_PHY1_CR_PARA_SEL); in fu740_pcie_init_phy()
168 fu740_phyregwrite(0, PCIEX8MGMT_PHY_LANE0_BASE, PCIEX8MGMT_PHY_INIT_VAL, afp); in fu740_pcie_init_phy()
169 fu740_phyregwrite(0, PCIEX8MGMT_PHY_LANE1_BASE, PCIEX8MGMT_PHY_INIT_VAL, afp); in fu740_pcie_init_phy()
170 fu740_phyregwrite(0, PCIEX8MGMT_PHY_LANE2_BASE, PCIEX8MGMT_PHY_INIT_VAL, afp); in fu740_pcie_init_phy()
171 fu740_phyregwrite(0, PCIEX8MGMT_PHY_LANE3_BASE, PCIEX8MGMT_PHY_INIT_VAL, afp); in fu740_pcie_init_phy()
172 fu740_phyregwrite(1, PCIEX8MGMT_PHY_LANE0_BASE, PCIEX8MGMT_PHY_INIT_VAL, afp); in fu740_pcie_init_phy()
173 fu740_phyregwrite(1, PCIEX8MGMT_PHY_LANE1_BASE, PCIEX8MGMT_PHY_INIT_VAL, afp); in fu740_pcie_init_phy()
174 fu740_phyregwrite(1, PCIEX8MGMT_PHY_LANE2_BASE, PCIEX8MGMT_PHY_INIT_VAL, afp); in fu740_pcie_init_phy()
175 fu740_phyregwrite(1, PCIEX8MGMT_PHY_LANE3_BASE, PCIEX8MGMT_PHY_INIT_VAL, afp); in fu740_pcie_init_phy()
181 struct fu740_pcie *afp = dev_get_drvdata(dev); in fu740_pcie_start_link() local
203 writel_relaxed(0x1, afp->mgmt_base + PCIEX8MGMT_APP_LTSSM_ENABLE); in fu740_pcie_start_link()
240 struct fu740_pcie *afp = to_fu740_pcie(pci); in fu740_pcie_host_init() local
245 fu740_pcie_drive_reset(afp); in fu740_pcie_host_init()
248 ret = clk_prepare_enable(afp->pcie_aux); in fu740_pcie_host_init()
258 writel_relaxed(0x1, afp->mgmt_base + PCIEX8MGMT_APP_HOLD_PHY_RST); in fu740_pcie_host_init()
261 ret = reset_control_deassert(afp->rst); in fu740_pcie_host_init()
267 fu740_pcie_init_phy(afp); in fu740_pcie_host_init()
270 clk_disable_unprepare(afp->pcie_aux); in fu740_pcie_host_init()
272 writel_relaxed(0x0, afp->mgmt_base + PCIEX8MGMT_APP_HOLD_PHY_RST); in fu740_pcie_host_init()
274 clk_prepare_enable(afp->pcie_aux); in fu740_pcie_host_init()
276 writel_relaxed(0x4, afp->mgmt_base + PCIEX8MGMT_DEVICE_TYPE); in fu740_pcie_host_init()
293 struct fu740_pcie *afp; in fu740_pcie_probe() local
295 afp = devm_kzalloc(dev, sizeof(*afp), GFP_KERNEL); in fu740_pcie_probe()
296 if (!afp) in fu740_pcie_probe()
298 pci = &afp->pci; in fu740_pcie_probe()
304 afp->mgmt_base = devm_platform_ioremap_resource_byname(pdev, "mgmt"); in fu740_pcie_probe()
305 if (IS_ERR(afp->mgmt_base)) in fu740_pcie_probe()
306 return PTR_ERR(afp->mgmt_base); in fu740_pcie_probe()
309 afp->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); in fu740_pcie_probe()
310 if (IS_ERR(afp->reset)) in fu740_pcie_probe()
311 return dev_err_probe(dev, PTR_ERR(afp->reset), "unable to get reset-gpios\n"); in fu740_pcie_probe()
313 afp->pwren = devm_gpiod_get_optional(dev, "pwren", GPIOD_OUT_LOW); in fu740_pcie_probe()
314 if (IS_ERR(afp->pwren)) in fu740_pcie_probe()
315 return dev_err_probe(dev, PTR_ERR(afp->pwren), "unable to get pwren-gpios\n"); in fu740_pcie_probe()
318 afp->pcie_aux = devm_clk_get(dev, "pcie_aux"); in fu740_pcie_probe()
319 if (IS_ERR(afp->pcie_aux)) in fu740_pcie_probe()
320 return dev_err_probe(dev, PTR_ERR(afp->pcie_aux), in fu740_pcie_probe()
324 afp->rst = devm_reset_control_get_exclusive(dev, NULL); in fu740_pcie_probe()
325 if (IS_ERR(afp->rst)) in fu740_pcie_probe()
326 return dev_err_probe(dev, PTR_ERR(afp->rst), "unable to get reset\n"); in fu740_pcie_probe()
328 platform_set_drvdata(pdev, afp); in fu740_pcie_probe()
335 struct fu740_pcie *afp = platform_get_drvdata(pdev); in fu740_pcie_shutdown() local
338 fu740_pcie_assert_reset(afp); in fu740_pcie_shutdown()