Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4354113pxk; Wed, 30 Sep 2020 00:14:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTB/8kivTpaYG42NEktGG4sTVHrHaxle6C71KI0HCT0/UqH630Qy6GAm1mySTfXAmEBym4 X-Received: by 2002:a50:8d57:: with SMTP id t23mr1255482edt.308.1601450040531; Wed, 30 Sep 2020 00:14:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601450040; cv=none; d=google.com; s=arc-20160816; b=e487CyI/LoYwY370fxExsSw9yOhNwWyrhDaFTUE4kylGfyxcLQ0MjTex13qEkcmaLR kQvGJF//F/IZR3UlvJ1oAr7GctiMSV3kf0QKKBvTlyYSVKrcDeBoDEy/R6xcQHiHbbCm EGLzLcmlaM1phVj4RVG/OnSXoYGryMeBJ5mafj4g8k8y+Yjyv5VPEIZeROeIL/7FLfb0 H0RgP5/7TpXJUcDrWCtXXV4d2X4gx3kfhyxbOXtrKcoMFKcED/AJ720PmPUERCLQc9pv Zwd1omvMru7dzIZZ9GvOLo+bP7plvkMV808E+XPcoQ95XCGHj/rA83gWAhqXaUMYllfC b2Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5cuaBwfVccDx8t6YaxBqxyKgg/cFncPpWk3C5+45/Dk=; b=UTmfRiyEi9BiaaNdSP17zNcP37Lw15HF0dcmk6X/NQR1eq0q1ls4GE4myZZA5HUf6L 4r6TaC0jp8fkGR6nMYGxzzCmUbqnfhkZHfVDQRTRjdlv2eA44L96OTxFHRiyjzpEI6oe GJMem9wLSkr+kLQjCa81t16qjxdWx36yhwuk0OD0YVUvult4iKixflQ1PTJELOQHIauK tTNdnWx2UNc2oM1l3pOOOZhmT5BlUO0qousAb7DhmlPGVvvSiCByO2iZNBkcEPfpj7C9 f94iBYWHCC1d3sYs9qQJd/qc8NwYa+5dnyoIgGcMxOYIAOczbag1XtWphfLbTVCEgDdI jXzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="k5z2wM2/"; 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 u2si569046ejx.507.2020.09.30.00.13.37; Wed, 30 Sep 2020 00:14:00 -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="k5z2wM2/"; 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 S1728322AbgI3HKI (ORCPT + 99 others); Wed, 30 Sep 2020 03:10:08 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:41270 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725440AbgI3HKH (ORCPT ); Wed, 30 Sep 2020 03:10:07 -0400 X-UUID: 71777b04e1034f118107bac2916b0cc4-20200930 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=5cuaBwfVccDx8t6YaxBqxyKgg/cFncPpWk3C5+45/Dk=; b=k5z2wM2/SYVmS3M7s5242mIgNZB8bjX4Gg05ixoHxaQYYD9TSKkk9kWFjn3a/Oe6V9sma98DXWDlTw1hDSSGpOR2S7tnR8rp8AKuZQ2QOIt4hjHMOjELIfuLheATOAJqftFKSpozAB3QlOylXUUMqyjVcbrfigM9rRtoXMJz3dY=; X-UUID: 71777b04e1034f118107bac2916b0cc4-20200930 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] 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 946817937; Wed, 30 Sep 2020 15:10:03 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 30 Sep 2020 15:10:00 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 30 Sep 2020 15:10:01 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Rob Herring , Robin Murphy , Krzysztof Kozlowski , Will Deacon CC: Evan Green , Tomasz Figa , , , , , , , , , Nicolas Boichat , , , , Greg Kroah-Hartman , Subject: [PATCH v3 15/24] iommu/mediatek: Add power-domain operation Date: Wed, 30 Sep 2020 15:06:38 +0800 Message-ID: <20200930070647.10188-16-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200930070647.10188-1-yong.wu@mediatek.com> References: <20200930070647.10188-1-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: C77212E66262157FC1E61846B81DE56A08D456D9678A5E9C684DD4C76542F2D42000:8 X-MTK: N Content-Transfer-Encoding: base64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SW4gdGhlIHByZXZpb3VzIFNvQywgdGhlIE00VSBIVyBpcyBpbiB0aGUgRU1JIHBvd2VyIGRvbWFp biB3aGljaCBpcw0KYWx3YXlzI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