if (!of_property_read_u32(combophy->dev->of_node, "st,output-micro-ohms", &val)) { if (val < min_imp || val > max_imp) {
dev_err(combophy->dev, "Invalid value %u for output ohm\n", val); return -EINVAL;
}
for (imp_of = 0; imp_of < ARRAY_SIZE(imp_lookup); imp_of++) if (imp_lookup[imp_of].microohm <= val) break;
if (WARN_ON(imp_of == ARRAY_SIZE(imp_lookup))) return -EINVAL;
/* * vddcombophy is interconnected with vddcore. Isolation bit should be unset * before using the ComboPHY.
*/
regmap_update_bits(combophy->regmap, SYSCFG_COMBOPHY_CR2,
SYSCFG_COMBOPHY_CR2_ISO_DIS, SYSCFG_COMBOPHY_CR2_ISO_DIS);
reset_control_assert(combophy->phy_reset);
if (combophy->type == PHY_TYPE_PCIE) {
ret = stm32_impedance_tune(combophy); if (ret) goto out_iso;
/* * Force elasticity buffer to be tuned for the reference clock as * the separated clock model is not supported
*/
regmap_update_bits(combophy->regmap, SYSCFG_COMBOPHY_CR5,
SYSCFG_COMBOPHY_CR5_COMMON_CLOCKS, SYSCFG_COMBOPHY_CR5_COMMON_CLOCKS);
reset_control_deassert(combophy->phy_reset);
ret = regmap_read_poll_timeout(combophy->regmap, SYSCFG_COMBOPHY_SR, val,
!(val & STM32MP25_PIPE0_PHYSTATUS),
10, 1000); if (ret) {
dev_err(combophy->dev, "timeout, cannot lock PLL\n"); if (combophy->type == PHY_TYPE_PCIE && !combophy->have_pad_clk)
regmap_update_bits(combophy->regmap, SYSCFG_PCIEPRGCR,
STM32MP25_PCIEPRGCR_EN, 0);
if (combophy->type != PHY_TYPE_PCIE)
regmap_update_bits(combophy->regmap, SYSCFG_COMBOPHY_CR1,
SYSCFG_COMBOPHY_CR1_REFSSPEN, 0);
goto out;
}
if (combophy->type == PHY_TYPE_PCIE) { if (!combophy->have_pad_clk)
regmap_update_bits(combophy->regmap, SYSCFG_PCIEPRGCR,
STM32MP25_PCIEPRGCR_EN, STM32MP25_PCIEPRGCR_EN);
val = readl_relaxed(combophy->base + COMBOPHY_SUP_ANA_MPLL_LOOP_CTL);
val &= ~COMBOPHY_PROP_CNTRL;
val |= propcntrl;
writel_relaxed(val, combophy->base + COMBOPHY_SUP_ANA_MPLL_LOOP_CTL);
}
/* * Clocks should be turned off since it is not needed for * wakeup capability. In case usb-remote wakeup is not enabled, * combo-phy is already turned off by HCD driver using exit callback
*/ if (combophy->is_init) {
clk_bulk_disable_unprepare(combophy->num_clks, combophy->clks);
/* since wakeup is enabled for ctrl */
enable_irq_wake(combophy->irq_wakeup);
}
/* * If clocks was turned off by suspend call for wakeup then needs * to be turned back ON in resume. In case usb-remote wakeup is not * enabled, clocks already turned ON by HCD driver using init callback
*/ if (combophy->is_init) { /* since wakeup was enabled for ctrl */
disable_irq_wake(combophy->irq_wakeup);
ret = clk_bulk_prepare_enable(combophy->num_clks, combophy->clks); if (ret) {
dev_err(dev, "can't enable clocks (%d)\n", ret); return ret;
}
}
combophy = devm_kzalloc(dev, sizeof(*combophy), GFP_KERNEL); if (!combophy) return -ENOMEM;
combophy->dev = dev;
dev_set_drvdata(dev, combophy);
combophy->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(combophy->base)) return PTR_ERR(combophy->base);
ret = stm32_combophy_get_clocks(combophy); if (ret) return ret;
combophy->phy_reset = devm_reset_control_get_exclusive(dev, "phy"); if (IS_ERR(combophy->phy_reset)) return dev_err_probe(dev, PTR_ERR(combophy->phy_reset), "Failed to get PHY reset\n");
combophy->regmap = syscon_regmap_lookup_by_compatible("st,stm32mp25-syscfg"); if (IS_ERR(combophy->regmap)) return dev_err_probe(dev, PTR_ERR(combophy->regmap), "No syscfg specified\n");
combophy->phy = devm_phy_create(dev, NULL, &stm32_combophy_phy_data); if (IS_ERR(combophy->phy)) return dev_err_probe(dev, PTR_ERR(combophy->phy), "failed to create PCIe/USB3 ComboPHY\n");
if (device_property_read_bool(dev, "wakeup-source")) {
irq = platform_get_irq(pdev, 0); if (irq < 0) return dev_err_probe(dev, irq, "failed to get IRQ\n");
combophy->irq_wakeup = irq;
ret = devm_request_threaded_irq(dev, combophy->irq_wakeup, NULL,
stm32_combophy_irq_wakeup_handler, IRQF_ONESHOT,
NULL, NULL); if (ret) return dev_err_probe(dev, ret, "unable to request wake IRQ %d\n",
combophy->irq_wakeup);
}
ret = devm_pm_runtime_enable(dev); if (ret) return dev_err_probe(dev, ret, "Failed to enable pm runtime\n");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.