Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2723709ybl; Thu, 19 Dec 2019 19:48:06 -0800 (PST) X-Google-Smtp-Source: APXvYqye3h2dIHT7ZdlZsaAplKhDBJ/w0bCoaFcSTLj37svmov3G/bfkNZv5mXaYAWT07CMIdE8K X-Received: by 2002:a05:6830:110a:: with SMTP id w10mr12896463otq.300.1576813686630; Thu, 19 Dec 2019 19:48:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576813686; cv=none; d=google.com; s=arc-20160816; b=dEKCHDGv5jIxOjZElJoEcd8xI47a6n5oW16tbEWvFhlcUZAWcVV3DHrUPLPSaMKAkQ KkaNdMQ3JifieqGKpQ36pRSX9eEKjJSZoEvCI7IIUQmjZmRH4aqWZehXGlqhy4aIIPtH jDpPluvrCa+9kvzQSUG5//CNjVy+GzdGncLy72CtqYKg2xr3ENAwuqhJj22uOdcq9IJF RSUVxRLrPiUXlP3/Vdy3SGXsdO7HlyoOFK+BRaiA+zW4jshWeKdckfykb4d9U1a9hq5G FkWHo19RApdPcAx1Zpo2r9+GYTqRfA7w4il4Ewt9CZJPyrsAparlNauNo+Vzue6R2Iqe zjlA== 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=w8agqSkABPe2gpBFFdaj1Yu7esFJCdenNL3aq1JoRvw=; b=PqsSL05Noz8TWuKTbVffPs3nJzwger47mK6IyCFfX6uWQv4I0XSoZ74d65cpEe2hex kWJH8yL6MZxCkuRjUOP4ajw9uMprG0iRCwbbEwtT6NOFFxi7rsBhjyhrICRTdrMa1Kid 3XSgyWRMXdAPnnrdVKMkNrYKYibZa/gkFFffQPYHrODpPDwvobWp2Qr6AiEu5YoLCU3z T4/trA8jR7K6ksmYuctHgBukDajkm1uv8u4mB/BeAyTMMzDLQbYsffrIB5ecgsiXiaGQ vvT4ooWddOXg9Bujzo3uYimjr5mkL8835GufV9g67hcWq3ducleXAhTCEGwEtyrN5c/E dQjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="e/HnjBMB"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id l131si4217136oig.120.2019.12.19.19.47.55; Thu, 19 Dec 2019 19:48:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="e/HnjBMB"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727459AbfLTDqq (ORCPT + 99 others); Thu, 19 Dec 2019 22:46:46 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:40750 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727024AbfLTDqQ (ORCPT ); Thu, 19 Dec 2019 22:46:16 -0500 X-UUID: c184a00e992e4a688619ee8619bd097c-20191220 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=w8agqSkABPe2gpBFFdaj1Yu7esFJCdenNL3aq1JoRvw=; b=e/HnjBMBLGpgHL5pXlaaJJWFGo5cLW22hLuwwSY7mhcI8qlxXQY/Tx1YTKnHdz6t4L3e3mQbzaBwxAOwhl0qZ8M1RR4YswJzmXEncX7vk8g97NyHgF0CCyOm/emKPJjGGcjXzymz4nPBWf8tKHQB2EnDDr3+LKj5LIWKt4lbTqs=; X-UUID: c184a00e992e4a688619ee8619bd097c-20191220 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1585691683; Fri, 20 Dec 2019 11:46:09 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 20 Dec 2019 11:45:50 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 20 Dec 2019 11:46:07 +0800 From: Weiyi Lu To: Nicolas Boichat , Matthias Brugger , Rob Herring , Sascha Hauer CC: James Liao , Fan Chen , , , , , Weiyi Lu Subject: [PATCH v11 06/10] soc: mediatek: Add subsys clock control for bus protection Date: Fri, 20 Dec 2019 11:46:00 +0800 Message-ID: <1576813564-23927-7-git-send-email-weiyi.lu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1576813564-23927-1-git-send-email-weiyi.lu@mediatek.com> References: <1576813564-23927-1-git-send-email-weiyi.lu@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 QWRkIHN1YnN5cyBDRyBjb250cm9sIGZsb3cgYmVmb3JlL2FmdGVyIHRoZSBidXMgcHJvdGVjdCBj b250cm9sDQpkdWUgdG8gYnVzIHByb3RlY3Rpb24gbmVlZCBTTUkgYnVzIHJlbGF0aXZlIENHcyBl bm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