mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-10 15:58:47 +00:00
iommu/mediatek: Lookup phandle to retrieve syscon to infracfg
This driver will get support for more SoCs and the list of infracfg compatibles is expected to grow: in order to prevent getting this situation out of control and see a long list of compatible strings, add support to retrieve a handle to infracfg's regmap through a new "mediatek,infracfg" phandle. In order to keep retrocompatibility with older devicetrees, the old way is kept in place. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Miles Chen <miles.chen@mediatek.com> Reviewed-by: Yong Wu <yong.wu@mediatek.com> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> Link: https://lore.kernel.org/r/20220616110830.26037-3-angelogioacchino.delregno@collabora.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
parent
d034dbbb9b
commit
7d748ffdee
@ -1140,6 +1140,16 @@ static int mtk_iommu_probe(struct platform_device *pdev)
|
||||
data->protect_base = ALIGN(virt_to_phys(protect), MTK_PROTECT_PA_ALIGN);
|
||||
|
||||
if (MTK_IOMMU_HAS_FLAG(data->plat_data, HAS_4GB_MODE)) {
|
||||
infracfg = syscon_regmap_lookup_by_phandle(dev->of_node, "mediatek,infracfg");
|
||||
if (IS_ERR(infracfg)) {
|
||||
/*
|
||||
* Legacy devicetrees will not specify a phandle to
|
||||
* mediatek,infracfg: in that case, we use the older
|
||||
* way to retrieve a syscon to infra.
|
||||
*
|
||||
* This is for retrocompatibility purposes only, hence
|
||||
* no more compatibles shall be added to this.
|
||||
*/
|
||||
switch (data->plat_data->m4u_plat) {
|
||||
case M4U_MT2712:
|
||||
p = "mediatek,mt2712-infracfg";
|
||||
@ -1152,9 +1162,9 @@ static int mtk_iommu_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
infracfg = syscon_regmap_lookup_by_compatible(p);
|
||||
|
||||
if (IS_ERR(infracfg))
|
||||
return PTR_ERR(infracfg);
|
||||
}
|
||||
|
||||
ret = regmap_read(infracfg, REG_INFRA_MISC, &val);
|
||||
if (ret)
|
||||
|
Loading…
x
Reference in New Issue
Block a user