Ejemplo n.º 1
0
static int msm_iommu_parse_dt(struct platform_device *pdev,
				struct msm_iommu_drvdata *drvdata)
{
	struct device_node *child;
	int ret = 0;
	struct resource *r;

	drvdata->dev = &pdev->dev;

	ret = __get_bus_vote_client(pdev, drvdata);

	if (ret)
		goto fail;

	ret = msm_iommu_parse_bfb_settings(pdev, drvdata);
	if (ret)
		goto fail;

	for_each_available_child_of_node(pdev->dev.of_node, child)
		drvdata->ncb++;

	ret = of_property_read_string(pdev->dev.of_node, "label",
				      &drvdata->name);
	if (ret)
		goto fail;

	drvdata->sec_id = -1;
	get_secure_id(pdev->dev.of_node, drvdata);

	r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "clk_base");
	if (r) {
		drvdata->clk_reg_virt = devm_ioremap(&pdev->dev, r->start,
						     resource_size(r));
		if (!drvdata->clk_reg_virt) {
			pr_err("Failed to map resource for iommu clk: %pr\n",
				r);
			ret = -ENOMEM;
			goto fail;
		}
	}

	drvdata->halt_enabled = of_property_read_bool(pdev->dev.of_node,
						      "qcom,iommu-enable-halt");

	ret = of_platform_populate(pdev->dev.of_node,
				   msm_iommu_ctx_match_table,
				   NULL, &pdev->dev);
	if (ret) {
		pr_err("Failed to create iommu context device\n");
		goto fail;
	}

	msm_iommu_add_drv(drvdata);
	return 0;

fail:
	__put_bus_vote_client(drvdata);
	return ret;
}
Ejemplo n.º 2
0
static int msm_iommu_parse_dt(struct platform_device *pdev,
                              struct msm_iommu_drvdata *drvdata)
{
    struct device_node *child;
    int ret;

    drvdata->dev = &pdev->dev;

    ret = __get_bus_vote_client(pdev, drvdata);
    if (ret)
        goto fail;

    ret = msm_iommu_parse_bfb_settings(pdev, drvdata);
    if (ret)
        goto fail;

    for_each_available_child_of_node(pdev->dev.of_node, child)
    drvdata->ncb++;

    ret = of_property_read_string(pdev->dev.of_node, "label",
                                  &drvdata->name);
    if (ret)
        goto fail;

    drvdata->sec_id = -1;
    get_secure_id(pdev->dev.of_node, drvdata);

    drvdata->halt_enabled = of_property_read_bool(pdev->dev.of_node,
                            "qcom,iommu-enable-halt");

    msm_iommu_add_drv(drvdata);

    return 0;

fail:
    __put_bus_vote_client(drvdata);
    return ret;
}