Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp613460pxb; Fri, 13 Aug 2021 02:24:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxomUAOmm7gnU/kGOanE1tyCWAgwZHIxH4n4bBFHctUHkBbBDlooR7ViCQkn3i+maC1TDbN X-Received: by 2002:a5d:87c6:: with SMTP id q6mr1308962ios.143.1628846692127; Fri, 13 Aug 2021 02:24:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628846692; cv=none; d=google.com; s=arc-20160816; b=U11Ln3yiRV8vonSs8iImaIsY8bxt2fwVyIBqXQzIOPGC4rDb8EyMLxBZHkNNiEEM43 Ypfo3HnAji61MOTgZt15/dNchzczsLkwWJL8nWHgawGfDfiF7cnnfvC4zEiqwLkhasJm nxuXyJnbyyO9b3r0COZksh1QtFpQVtRLv9cDL6Q19iKCz/drpjYE51eFQCO1vmM4TVet y1+yfX3dEm/BGY4At952spMjGQRWqVlP+dU4HietbJeXxsd9WPmuNH9qGXCMqlxqXoMT FmXsnC93UdCXmOmGvMhl0YY2qc4BTqPbnNdbm/bclSdUKC5IxIccFmKqCNdsRd883r1E 7fag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=sVavXdPyxhxsc/9qbfWexo6hlvgqAzZ/GFjTeZVdHrY=; b=DMzMxk/wBtF6lvNp9xVcVDXpTCTbjfXRnWs7YM5b3Ze6pp/7Oe8T1bL2mvG+Tx4N06 aBNewMIekJ11xN/NjvPDmj0l6euoo3T82B0jC+8Egc/ntfrJVtzyXHiqoATWVXU/jB3/ mkxqI+7QuRw5DgHzSc6c4T6/AUn9O3tfiBKJt/XUCJRXVWUeDIxS4nmMmRG3SM5qDnaT pATJbSRZq/o8Z59t5LBiMt2YWwic5QzL5mLa4kAkn1C/56rDfRgzedHMUGqRSK3y3ZaW m7uA7/uVy5uRm0u46ONiwKj0+Xa12aF3TqcpkS64TvcCPqSa1goqsjvuWsX6zBfY6Nxn ZRBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w4si974093ioa.95.2021.08.13.02.24.41; Fri, 13 Aug 2021 02:24:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239136AbhHMG4Q (ORCPT + 99 others); Fri, 13 Aug 2021 02:56:16 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:38062 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S239118AbhHMG4O (ORCPT ); Fri, 13 Aug 2021 02:56:14 -0400 X-UUID: 4bb8f6a2d7584e2e8c1406bb51c0d472-20210813 X-UUID: 4bb8f6a2d7584e2e8c1406bb51c0d472-20210813 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1442998272; Fri, 13 Aug 2021 14:55:45 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 13 Aug 2021 14:55:43 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 13 Aug 2021 14:55:42 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Evan Green , Tomasz Figa , Tomasz Figa , , , , , , , , , Nicolas Boichat , , Subject: [PATCH v2 16/29] iommu/mediatek: Adjust device link when it is sub-common Date: Fri, 13 Aug 2021 14:53:11 +0800 Message-ID: <20210813065324.29220-17-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210813065324.29220-1-yong.wu@mediatek.com> References: <20210813065324.29220-1-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For MM IOMMU, We always add device link between smi-common and IOMMU HW. In mt8195, we add smi-sub-common. Thus, if the node is sub-common, we still need find again to get smi-common, then do device link. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index a4479916ad33..a72241724adb 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -845,6 +845,17 @@ static int mtk_iommu_mm_dts_parse(struct device *dev, if (!smicomm_node) return -EINVAL; + /* Find smi-common again if this is smi-sub-common */ + if (of_property_read_bool(smicomm_node, "mediatek,smi_sub_common")) { + of_node_put(smicomm_node); /* put the sub common */ + + smicomm_node = of_parse_phandle(smicomm_node, "mediatek,smi", 0); + if (!smicomm_node) { + dev_err(dev, "sub-comm has no common.\n"); + return -EINVAL; + } + } + plarbdev = of_find_device_by_node(smicomm_node); of_node_put(smicomm_node); data->smicomm_dev = &plarbdev->dev; -- 2.18.0