Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux.git

This commit is contained in:
Stephen Rothwell 2024-12-20 14:39:31 +11:00
commit c8e81f3586
3 changed files with 34 additions and 9 deletions

View File

@ -1326,6 +1326,11 @@ static int scp_cluster_init(struct platform_device *pdev, struct mtk_scp_of_clus
return ret;
}
static const struct of_device_id scp_core_match[] = {
{ .compatible = "mediatek,scp-core" },
{}
};
static int scp_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@ -1357,13 +1362,15 @@ static int scp_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&scp_cluster->mtk_scp_list);
mutex_init(&scp_cluster->cluster_lock);
ret = devm_of_platform_populate(dev);
ret = of_platform_populate(dev_of_node(dev), scp_core_match, NULL, dev);
if (ret)
return dev_err_probe(dev, ret, "Failed to populate platform devices\n");
ret = scp_cluster_init(pdev, scp_cluster);
if (ret)
if (ret) {
of_platform_depopulate(dev);
return ret;
}
return 0;
}
@ -1379,6 +1386,7 @@ static void scp_remove(struct platform_device *pdev)
rproc_del(scp->rproc);
scp_free(scp);
}
of_platform_depopulate(&pdev->dev);
mutex_destroy(&scp_cluster->cluster_lock);
}

View File

@ -37,6 +37,10 @@
#include <linux/platform_data/dmtimer-omap.h>
#ifdef CONFIG_ARM_DMA_USE_IOMMU
#include <asm/dma-iommu.h>
#endif
#include "omap_remoteproc.h"
#include "remoteproc_internal.h"
@ -1323,6 +1327,19 @@ static int omap_rproc_probe(struct platform_device *pdev)
/* All existing OMAP IPU and DSP processors have an MMU */
rproc->has_iommu = true;
#ifdef CONFIG_ARM_DMA_USE_IOMMU
/*
* Throw away the ARM DMA mapping that we'll never use, so it doesn't
* interfere with the core rproc->domain and we get the right DMA ops.
*/
if (pdev->dev.archdata.mapping) {
struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(&pdev->dev);
arm_iommu_detach_device(&pdev->dev);
arm_iommu_release_mapping(mapping);
}
#endif
ret = omap_rproc_of_get_internal_memories(pdev, rproc);
if (ret)
return ret;

View File

@ -2486,6 +2486,13 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
rproc->dev.driver_data = rproc;
idr_init(&rproc->notifyids);
/* Assign a unique device index and name */
rproc->index = ida_alloc(&rproc_dev_index, GFP_KERNEL);
if (rproc->index < 0) {
dev_err(dev, "ida_alloc failed: %d\n", rproc->index);
goto put_device;
}
rproc->name = kstrdup_const(name, GFP_KERNEL);
if (!rproc->name)
goto put_device;
@ -2496,13 +2503,6 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
if (rproc_alloc_ops(rproc, ops))
goto put_device;
/* Assign a unique device index and name */
rproc->index = ida_alloc(&rproc_dev_index, GFP_KERNEL);
if (rproc->index < 0) {
dev_err(dev, "ida_alloc failed: %d\n", rproc->index);
goto put_device;
}
dev_set_name(&rproc->dev, "remoteproc%d", rproc->index);
atomic_set(&rproc->power, 0);