Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1115352ybt; Fri, 10 Jul 2020 23:54:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzZKh9iGAOh/UEDsP1UJmbsy6lbiKJ2URmlr8jGgdYKcLJnjjDctqNTyAVo3eGfmYUcHIq X-Received: by 2002:a17:906:ca43:: with SMTP id jx3mr52658059ejb.208.1594450486129; Fri, 10 Jul 2020 23:54:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594450486; cv=none; d=google.com; s=arc-20160816; b=tu31/n8a826uFGy2FjFsT/zOwF97mtEKZQCiCOfLOEMg3LZk3T4EY/IuI1waQeqADe L4FkvX9FlgpvbWRT48O3IfnOYRB7n2Nd2bBit402rW1BOXtWNhcp+8fsQyqejKkMaC5Y Q6IXEhszZtwdphOsGVPkGIpV3hp+6c0Rymm8lOFCfvpz3MLNQznVLUyfLqTl4uOb74WH OwHleXxM5PZnVXMpeCoOjEcRdD5h7JqAAcZInWfIU8DaTkj04cFPwY+VNB8pTZ//XGEm 9hOwWIcgvIr4aFdYOj1bvPs0mYNkjpRlKKATL7aQNcKkLRqH/c/KD1zYS2xIj7YgULM3 8wzA== 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=5/pL7myJ2O26iScT4MuJ72d6p8fz2vqbi3T8r9cOzPA=; b=OmkJ+C4/QBGW+Iuj3Oo4HYMA+AMXiAwQ57JQRoIowHb7XvHjmN31oX2sheDpQl5cig cBw4bxIiKzBaYtqlBItIdg8j6uwNbEJBt0d7PzS4J2/p8OWG6R7f5CKD4M9Jg5HpO8JD rRiZ1UtSdfByXfToRsCck23QG9yHUNnNybiphsYLyeHIz1p3WZq6z9bhV/AIy5mGdw1D 0lXbdDXZ27hMxtbks3eTrFlwekJBuKv4xE33zy+JivNVm6r9LXMgMva70/2ncyli68vG TLIgnYarp2Qj4eurawXGkbuQLPny3eT34iEC32M/Fc69SZZd8OK7trIUGCYGieOFUzc3 56bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=VisFGClx; 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 h16si5338089ejx.446.2020.07.10.23.54.23; Fri, 10 Jul 2020 23:54:46 -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=VisFGClx; 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 S1728278AbgGKGvh (ORCPT + 99 others); Sat, 11 Jul 2020 02:51:37 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:31159 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728012AbgGKGvh (ORCPT ); Sat, 11 Jul 2020 02:51:37 -0400 X-UUID: 5bb257ab688b4e8aa8520fa8ce059720-20200711 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=5/pL7myJ2O26iScT4MuJ72d6p8fz2vqbi3T8r9cOzPA=; b=VisFGClxawoD8yWFdbpA87mhmf380eOk3GihNf9USealmf+LWGacao9lhDg4zfXS0QwyLIn7HcLVloHnZLpQMoI74XuHvmVvRppcmRTmLqUS8V8RlixbkyxEFfcFn9ELY1Kac56RvLoWUw3vL87HSQdZW9e2BjDAVVIHNhFxCkg=; X-UUID: 5bb257ab688b4e8aa8520fa8ce059720-20200711 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 2023529905; Sat, 11 Jul 2020 14:51:33 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 11 Jul 2020 14:51:24 +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; Sat, 11 Jul 2020 14:51:23 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Rob Herring , Robin Murphy CC: Will Deacon , Evan Green , Tomasz Figa , , , , , , , , , Nicolas Boichat , , , , Subject: [PATCH 11/21] iommu/mediatek: Add power-domain operation Date: Sat, 11 Jul 2020 14:48:36 +0800 Message-ID: <20200711064846.16007-12-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200711064846.16007-1-yong.wu@mediatek.com> References: <20200711064846.16007-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 biB3aGljaCBpcw0KYWx3YXlzIG9uLiB0aGUgbGF0ZXN0IE00VSBpcyBpbiB0aGUgZGlzcGxheSBw b3dlciBkb21haW4gd2hpY2ggbWF5IGJlDQp0dXJuZW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