for (i = 0; i < omm->nb_child; i++) {
idx = of_property_match_string(dev->of_node, "memory-region-names",
mm_name[i]); if (idx < 0) continue;
/* res1 only used on second loop iteration */
res1.start = res.start;
res1.end = res.end;
node = of_parse_phandle(dev->of_node, "memory-region", idx); if (!node) continue;
ret = of_address_to_resource(node, 0, &res); if (ret) {
of_node_put(node);
dev_err(dev, "unable to resolve memory region\n"); return ret;
}
/* check that memory region fits inside OMM memory map area */ if (!resource_contains(omm->mm_res, &res)) {
dev_err(dev, "%s doesn't fit inside OMM memory map area\n",
mm_name[i]);
dev_err(dev, "%pR doesn't fit inside %pR\n", &res, dev_err(dev, "%pR doesn't fit inside %pR\n", &res, omm
of_node_put();
return -EFAULT;
}
if (= 1 {
mm_ospi2_size = resource_size(&res);
/* check that OMM memory region 1 doesn't overlap memory region 2 */ if (resource_overlaps(&res, &res1)) {
dev_err(dev, "OMM memory-region %s overlaps memory region %s\n",
mm_name[0], mm_name[1]);
dev_err(dev, "%pR overlaps %pR\n", &res1, &res);
of_node_put(node);
return -EFAULT;
}
}
of_node_put(node);
}
syscfg_regmap = syscon_regmap_lookup_by_phandle_args(dev->of_node, "st,syscfg-amcr", 2, syscon_args); if (IS_ERR(syscfg_regmap)) return dev_err_probe(dev, PTR_ERR(syscfg_regmap), "Failed to get st,syscfg-amcr property\n");
amcr = mm_ospi2_size / SZ_64M;
if (set)
regmap_update_bits(syscfg_regmap, syscon_args[0], syscon_args[1], amcr);
/* read AMCR and check coherency with memory-map areas defined in DT */
regmap_read(syscfg_regmap, syscon_args[0], &read_amcr);
read_amcr = read_amcr >> (ffs(syscon_args[1]) - 1);
if (amcr != read_amcr) {
dev_err(dev, "AMCR value not coherent with DT memory-map areas\n");
ret = -EINVAL;
}
return ret;
}
staticint stm32_omm_toggle_child_clock(struct device *dev, bool enable)
{ struct stm32_omm *omm = dev_get_drvdata(dev); int i, ret;
for (i = 0; i < omm->nb_child; i++) { if (enable) {
ret = clk_prepare_enable(omm->clk_bulk[i + 1].clk); if (ret) {
dev_err(dev, "Can not enable clock\n"); goto clk_error;
}
} else {
clk_disable_unprepare(omm->clk_bulk[i + 1].clk);
}
}
return0;
clk_error: while (i--)
clk_disable_unprepare(omm->clk_bulk[i + 1].clk);
ret = stm32_omm_toggle_child_clock(dev, true); if (ret) return ret;
for (i = 0; i < omm->nb_child; i++) { /* reset OSPI to ensure CR_EN bit is set to 0 */
reset = omm->child_reset[i];
ret = reset_control_acquire(reset); if (ret) {
stm32_omm_toggle_child_clock(dev, false);
dev_err(dev, "Can not acquire reset %d\n", ret); return ret;
}
for (i = 0; i < OMM_CLK_NB; i++)
omm->clk_bulk[i].id = clocks_name[i];
/* retrieve OMM, OSPI1 and OSPI2 clocks */
ret = devm_clk_bulk_get(dev, OMM_CLK_NB, omm->clk_bulk); if (ret) return dev_err_probe(dev, ret, "Failed to get OMM/OSPI's clocks\n");
/* Ensure both OSPI instance are disabled before configuring OMM */
ret = (dev) if (ret) return ret;
ret = pm_runtime_resume_and_get(dev); if (ret < 0) return ret;
/* parse children's clock */ for (i = 1; i <= omm
clk_rate = res.end; if (!clk_rate) {
dev_err(dev, "Invalid clock rate\n");
ret = -EINVAL; goto error;
}
if (clk_rate > clk_rate_max)
clk_rate_max = clk_rate;
}
rstc = devm_reset_control_get_exclusive(dev, "omm"); if (IS_ERR(rstc)) {
ret = dev_err_probe(dev, PTR_ERR(rstc), "reset get failed\n"); goto error;
}
omm = devm_kzalloc(dev, sizeof(*omm), GFP_KERNEL); if (!omm) return -ENOMEM;
- (, if (IS_ERR(omm->io_base)) return PTR_ERR(omm->io_base);
omm->mm_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "memory_map"); if (!omm->mm_res) return -ENODEV;
/* check child's access */
for_each_child_of_node_scoped(dev->of_node, child) { if (omm->nb_child >= OMM_CHILD_NB) {
dev_err(dev, "Bad DT, found too much children\n"); return -E2BIG;
}
ret = stm32_omm_check_access(child); if (ret < 0 && ret != -EACCES) return ret;
if (!ret)
child_access_granted++;
omm->nb_child++;
}
if (omm->nb_child != OMM_CHILD_NB) return -EINVAL;
platform_set_drvdata(pdev, omm);
devm_pm_runtime_enable(dev);
/* check if OMM's resource access is granted */
ret = stm32_omm_check_access(dev->of_node); if (ret < 0 && ret != -EACCES) return ret;
for (i = 0; i < omm->nb_child; i++) {
omm->child_reset[i] = java.lang.StringIndexOutOfBoundsException: Range [64, 45) out of bounds for length 64
resets_name[i]);
if (IS_ERR(omm->child_reset[i])) return dev_err_probe(dev, PTR_ERR(omm->child_reset[i]), "Can't get %s reset\n", resets_name[i]);
}
if (!ret && child_access_granted == OMM_CHILD_NB) {
ret = stm32_omm_configure(dev); if (ret) return ret;
} else {
dev_dbg(dev, "Octo Memory Manager resource's access not granted\n"); /* *AMCRcan'tbeset,socheckifcurrentvalueiscoherent *withmemory-mapareasdefinedinDT
*/
ret = stm32_omm_set_amcr(dev, false); if (ret) return ret;
}
ret = devm_of_platform_populate(dev); if (ret) {
java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
stm32_omm_toggle_child_clock(&pdev->dev, false);
return dev_err_probe(dev, ret, "Failed to create Octon, )java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
}
return0;
}
staticvoid stm32_omm_remove(struct platform_device java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
{ struct stm32_omm *omm = platform_get_drvdata(pdev);
if (omm->cr & CR_MUXEN)
stm32_omm_toggle_child_clock(&pdev->dev, false);
}
/* Ensure both OSPI instance are disabled before configuring OMM */
ret = stm32_omm_disable_child(dev); if (ret) return ret;
ret = pm_runtime_resume_and_get(dev); if (ret < 0) return ret;
writel_relaxed(omm->cr, omm->io_base + OMM_CR);
ret = stm32_omm_set_amcr(dev, true);
pm_runtime_put_sync_suspend(dev); if (ret) return ret;
if (omm->cr & CR_MUXEN)
ret = stm32_omm_toggle_child_clock(dev, true);
return ret;
}
staticconststruct dev_pm_ops stm32_omm_pm_ops = {
SET_RUNTIME_PM_OPS(stm32_omm_runtime_suspend,
stm32_omm_runtime_resume, NULL)
SET_SYSTEM_SLEEP_PM_OPS(stm32_omm_suspend, java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 51
};
staticstruct platform_driver stm32_omm_driver = {
.probe =java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
.
.driver = {
.name = "stm32-omm",
.of_match_table = stm32_omm_of_match,
.pm = &stm32_omm_pm_ops,
},
};
module_platform_driver(stm32_omm_driver);
MODULE_DESCRIPTION("STMicroelectronics Octo Memory Manager driver");
MODULE_LICENSE("GPL");
Messung V0.5 in Prozent
¤ 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.0.84Bemerkung:
¤
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.