Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3795621pxu; Wed, 9 Dec 2020 00:12:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJyh4j/hOPaKGHXwlGMbqkD0VVakVOorLwr9ZZW+YIrFtWqk7w0xM+1C8JKbeoFa/t3s/jak X-Received: by 2002:a17:907:28d4:: with SMTP id en20mr1120240ejc.196.1607501576741; Wed, 09 Dec 2020 00:12:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607501576; cv=none; d=google.com; s=arc-20160816; b=qeJgqnwippzBw8vymI6JmKQI75xRym7z4bwvniRfTHKt+DSPiV+9K9N1J4sAEddvpN 02T9HY+dI3Ipy+9zdmtkXDrzk3m0tO/De6tTrYUYDMwqvN875fsrYjo+MF2gzGs+hwX+ q2yl4hBsxKgg2SEwyeQoCLjKCLGmDSe4Fn3FD7QFT/T7WRUW9zF2HI3UUxjcFKt7uspo 7cX4+PT39sKnqrPz117JbTnb6y9EZOTh5QP1SbXpI2/D2cIjNF8vc5d1aEX5DHj47XHl FWkt+9uT2iGHhlSISgMhBh/uvIVKdvcRo/hM/XMIPYcdc8qagyAcjYK54aOhhEc3+2dp 1wFA== 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=d9YNc+jH4+J5k07jX5w/i11yHVYPlgSsi5vhaEXCRMA=; b=H9zwppfGgMeZ1Ure3NyPvN2xqEf0qNtYnyJtX5OisGa9gtg+fJ5Dtnzma2yiZbjBzf +a2o/GpLgFJaNLYznT1rfHW2PGYDPAhKN1ftGkMRBdCE5QaZ3VF2d+1jfa2/fYMkYag2 8B/470hY0EwCgOHq6yOfhtGZyVDZA2/TD5ruhnEQFnOjTiKWk1KG131SiPsGlKTY/3pM ZgW8VmVupM0qOktmx2Yd/Ky7kFsFYlUlNjqspYDBVc76WQw/nuAd5BkKfV7v8l/rD0Lm +zUVd3MUbBXaq9i2GcsJ5v9JLSWiklLRyiXw+bvvCG04/FtlvkQ4ZXdm/cTsMcHqj+G5 bCxA== 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 v1si366180ejf.162.2020.12.09.00.12.34; Wed, 09 Dec 2020 00:12:56 -0800 (PST) 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 S1728507AbgLIICz (ORCPT + 99 others); Wed, 9 Dec 2020 03:02:55 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:45258 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726449AbgLIICm (ORCPT ); Wed, 9 Dec 2020 03:02:42 -0500 X-UUID: bda078e12a65473a8c6ec9539b6e132c-20201209 X-UUID: bda078e12a65473a8c6ec9539b6e132c-20201209 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1960935038; Wed, 09 Dec 2020 16:01:59 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 9 Dec 2020 16:01:58 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 9 Dec 2020 16:01:58 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Rob Herring , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Evan Green , Tomasz Figa , , , , , , , , , Nicolas Boichat , , Subject: [PATCH v5 04/27] dt-bindings: memory: mediatek: Add domain definition Date: Wed, 9 Dec 2020 16:00:39 +0800 Message-ID: <20201209080102.26626-5-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20201209080102.26626-1-yong.wu@mediatek.com> References: <20201209080102.26626-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 In the latest SoC, there are several HW IP require a sepecial iova range, mainly CCU and VPU has this requirement. Take CCU as a example, CCU require its iova locate in the range(0x4000_0000 ~ 0x43ff_ffff). In this patch we add a domain definition for the special port. In the example of CCU, If we preassign CCU port in domain1, then iommu driver will prepare a independent iommu domain of the special iova range for it, then the iova got from dma_alloc_attrs(ccu-dev) will locate in its special range. This is a preparing patch for multi-domain support. Signed-off-by: Yong Wu Acked-by: Krzysztof Kozlowski Acked-by: Rob Herring --- include/dt-bindings/memory/mtk-smi-larb-port.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/dt-bindings/memory/mtk-smi-larb-port.h b/include/dt-bindings/memory/mtk-smi-larb-port.h index 7d64103209af..2d4c973c174f 100644 --- a/include/dt-bindings/memory/mtk-smi-larb-port.h +++ b/include/dt-bindings/memory/mtk-smi-larb-port.h @@ -7,9 +7,16 @@ #define __DT_BINDINGS_MEMORY_MTK_MEMORY_PORT_H_ #define MTK_LARB_NR_MAX 32 +#define MTK_M4U_DOM_NR_MAX 8 + +#define MTK_M4U_DOM_ID(domid, larb, port) \ + (((domid) & 0x7) << 16 | (((larb) & 0x1f) << 5) | ((port) & 0x1f)) + +/* The default dom id is 0. */ +#define MTK_M4U_ID(larb, port) MTK_M4U_DOM_ID(0, larb, port) -#define MTK_M4U_ID(larb, port) (((larb) << 5) | (port)) #define MTK_M4U_TO_LARB(id) (((id) >> 5) & 0x1f) #define MTK_M4U_TO_PORT(id) ((id) & 0x1f) +#define MTK_M4U_TO_DOM(id) (((id) >> 16) & 0x7) #endif -- 2.18.0