Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1884282pxk; Sat, 5 Sep 2020 01:16:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIOlJDBnAfj89pzEt+3EoSaeMa9pJm/1qjwEnpUy37b0zp/npJkJmGwoOmvgw1OTj8hz5X X-Received: by 2002:a17:906:9718:: with SMTP id k24mr10639880ejx.365.1599293807948; Sat, 05 Sep 2020 01:16:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599293807; cv=none; d=google.com; s=arc-20160816; b=g0OSePn4vzhj+Iqym8K5EJCwuwLos/h8iTrduZNUI3hTDs8ibc9nUDIv/+gRce9Keb rVPQdy8AWmz+Ksl844cc5edOgmDr0OPA07t7sRxPCifYMCV0MyWIEsoWnKXeWmfYIcKZ sRlj4gQvhk2fzknertBHU3GYTSaqanr3mVo9+/6kR+1WvVGHKZkt/PxcIkxfUJAo9fdQ DQQpVVQm/yxwD2VzGCcXLmNxtS34sTcEWwPZqgsU4Rn4rlNxmADCEiGW3DspA593w6ri Fj+Mopiod2tJOkvgG6XNz9ecA1+L7ZAJTtIEH/EdNUNaNYxQNxgY3Cc1/ByYUUjMNwh+ zjng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Xyql66Axq7r0/zD3VtLzwTuEdmn0pBqUypd/sipGyzI=; b=B1uAwTO9/lYcpx8K8up1zHLwzaKPlbK2gtbgzpi8M/hY/ZrCNqIMW+JLTGL68FYEKq mRjX0rqNBqcEzS+BoSX5IknrJCrrGR7A6kMshV15Vv8uYsXyt4/o5E3Ecjbh1vO5vtdG YBxeNk6LSySsOJeu5JBb76LWzIDarzD+u2PqgbwbN5pOU2VAW2iIA6kf2zSeMH1eLdjJ tCifSPdQNFw6r9AWoEt970ZenkgDZC4Y4rdF7hJhABWOfdbzfKO0bl0u++NRRhQ0pRAv LN/hcYYuYRyl33wIGAoLEd04Mxj8q0OeFLfBw4v1cJbhKsAbQUuhqm0JUdATD/ts1ykz jwvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=nBZzkx4a; 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=pass (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 m1si5559168eds.116.2020.09.05.01.16.24; Sat, 05 Sep 2020 01:16:47 -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; dkim=pass header.i=@mediatek.com header.s=dk header.b=nBZzkx4a; 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=pass (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728522AbgIEINe (ORCPT + 99 others); Sat, 5 Sep 2020 04:13:34 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:5315 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728514AbgIEINa (ORCPT ); Sat, 5 Sep 2020 04:13:30 -0400 X-UUID: 43cf2ef8dfe24453a2b484204e67ff2b-20200905 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Xyql66Axq7r0/zD3VtLzwTuEdmn0pBqUypd/sipGyzI=; b=nBZzkx4aThrlSW11aIafCoNwIXFiaPnoiIIh6+TwKa91g6V+3TDKYQnxQv4vvofCeG/l1lOX/JPY5gBJKPiWrJSvTzHd4Lg9kcVQ6sHm+oeqiUUxereBpkMYQUJIhzMOoqGTzr2bcC/paGuyHZ6fQqYKPbZo8f/fw/3sgbtgPTc=; X-UUID: 43cf2ef8dfe24453a2b484204e67ff2b-20200905 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] 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 289913520; Sat, 05 Sep 2020 16:13:24 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 5 Sep 2020 16:13:21 +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; Sat, 5 Sep 2020 16:13:21 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Rob Herring , Robin Murphy CC: Will Deacon , Evan Green , Tomasz Figa , , , , , , , , , Nicolas Boichat , , , Subject: [PATCH v2 14/23] iommu/mediatek: Add power-domain operation Date: Sat, 5 Sep 2020 16:09:11 +0800 Message-ID: <20200905080920.13396-15-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200905080920.13396-1-yong.wu@mediatek.com> References: <20200905080920.13396-1-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Content-Transfer-Encoding: base64 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SW4gdGhlIHByZXZpb3VzIFNvQywgdGhlIE00VSBIVyBpcyBpbiB0aGUgRU1JIHBvd2VyIGRvbWFp biB3aGljaCBpcw0KYWx3YXlzIG9uLiB0aGUgbGF0ZXN0IE00VSBpcyBpbiB0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