Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp403092ybl; Tue, 27 Aug 2019 22:57:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqym0tCGZxtyoUcQSockvwFxrUhLbsi53X7qSy9HdH0v9+ls+8WVm/Al64+i8c/DC4aNxwJv X-Received: by 2002:a17:902:1c7:: with SMTP id b65mr2548523plb.313.1566971869754; Tue, 27 Aug 2019 22:57:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566971869; cv=none; d=google.com; s=arc-20160816; b=1LJRWdPOx6HBgd00pHA6b0SBzdqG1Iji2mUz5KsI244G3WM4coor546E9v4nwf4WR/ NqOJFM97dAreimBMjQZx2wuNwkiIiBo5ZKpi4sd/wwMJMA5hlyJ8x7/z6cK/Lnevungb yrT60A4H7IeCPGe6O/pNszjL0NG/g1l9wZ+vEZfud9es4CcWpH2GMoiz5BKf/o+DcL4M odsFgWgGAWfeupX4JtiJAa4+1OfAQRvtTy4DJf/6OB6F6/NvXibAuV6N8e4PtEAxvZKY /8Eolc9CiQdzjJFkyZXE109zr7ZvwT7gE77CtN8Yl9fJdNiHuBSO+nLsKKx956yFXr/P yyZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=2xL6CsNN3Uka3NAchQXdlD5tzbflcc4d41rG/slrNyg=; b=ebevMS/R0DdZXdvkzff6kEKmzleIot8n+UI4OrPblQS0gSLqY99BRYEsp0tvViDzrq 39+N4UsFzcms7I8BK2kQ5RO2b2NJbgZr6LCHBIVcvkLy/uNmu4RCIuTJ1qg6b4FdMP3P Ii7IcdSoNHOO55lz5vvER7V6LkCqpoQEQRPu3R/UcrgVCKKN3Q6AaEvThGxeqDvLyufe Bls70UlsOWBPRUvJxmXVAADClXnuNu1Syh4RxsnwqAvietTydf45OzYf+8AogXywPJAB Ok+DFET3/qHlIyTwFzuU3Ph7sI6FmZ9TksusR6HkF0aWqSODej9ZUVtohI/Ktzrsax7K wC2A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 y1si1068939plr.164.2019.08.27.22.57.33; Tue, 27 Aug 2019 22:57:49 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726328AbfH1F42 (ORCPT + 99 others); Wed, 28 Aug 2019 01:56:28 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:62854 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726100AbfH1F40 (ORCPT ); Wed, 28 Aug 2019 01:56:26 -0400 X-UUID: 79903e6fb6d5485bbdf2686359156612-20190828 X-UUID: 79903e6fb6d5485bbdf2686359156612-20190828 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1421000632; Wed, 28 Aug 2019 13:56:20 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs02n2.mediatek.inc (172.21.101.101) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 28 Aug 2019 13:56:27 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 28 Aug 2019 13:56:26 +0800 From: Chunfeng Yun To: Rob Herring , Stephen Boyd CC: Mark Rutland , Michael Turquette , Matthias Brugger , Ryder Lee , Chunfeng Yun , Nicolas Boichat , Weiyi Lu , Erin Lo , , , , , Subject: [PATCH 2/2] clk: mediatek: add pericfg clocks for MT8183 Date: Wed, 28 Aug 2019 13:55:55 +0800 Message-ID: <1566971755-21217-2-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1566971755-21217-1-git-send-email-chunfeng.yun@mediatek.com> References: <1566971755-21217-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: D64A18BE0E67B75CFF0178547373DF7B913A420C3974F69A674CFB0CE0B7E9842000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add pericfg clocks for MT8183, it's used when support USB remote wakeup Cc: Weiyi Lu Signed-off-by: Chunfeng Yun --- drivers/clk/mediatek/clk-mt8183.c | 35 ++++++++++++++++++++++++++ include/dt-bindings/clock/mt8183-clk.h | 4 +++ 2 files changed, 39 insertions(+) diff --git a/drivers/clk/mediatek/clk-mt8183.c b/drivers/clk/mediatek/clk-mt8183.c index 1aa5f4059251..b19221bad0c9 100644 --- a/drivers/clk/mediatek/clk-mt8183.c +++ b/drivers/clk/mediatek/clk-mt8183.c @@ -999,6 +999,25 @@ static const struct mtk_gate infra_clks[] = { "msdc50_0_sel", 24), }; +static const struct mtk_gate_regs peri_cg_regs = { + .set_ofs = 0x20c, + .clr_ofs = 0x20c, + .sta_ofs = 0x20c, +}; + +#define GATE_PERI(_id, _name, _parent, _shift) { \ + .id = _id, \ + .name = _name, \ + .parent_name = _parent, \ + .regs = &peri_cg_regs, \ + .shift = _shift, \ + .ops = &mtk_clk_gate_ops_no_setclr_inv, \ +} + +static const struct mtk_gate peri_clks[] = { + GATE_PERI(CLK_PERI_AXI, "periaxi", "axi_sel", 31), +}; + static const struct mtk_gate_regs apmixed_cg_regs = { .set_ofs = 0x20, .clr_ofs = 0x20, @@ -1194,6 +1213,19 @@ static int clk_mt8183_infra_probe(struct platform_device *pdev) return of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); } +static int clk_mt8183_peri_probe(struct platform_device *pdev) +{ + struct clk_onecell_data *clk_data; + struct device_node *node = pdev->dev.of_node; + + clk_data = mtk_alloc_clk_data(CLK_PERI_NR_CLK); + + mtk_clk_register_gates(node, peri_clks, ARRAY_SIZE(peri_clks), + clk_data); + + return of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); +} + static int clk_mt8183_mcu_probe(struct platform_device *pdev) { struct clk_onecell_data *clk_data; @@ -1223,6 +1255,9 @@ static const struct of_device_id of_match_clk_mt8183[] = { }, { .compatible = "mediatek,mt8183-infracfg", .data = clk_mt8183_infra_probe, + }, { + .compatible = "mediatek,mt8183-pericfg", + .data = clk_mt8183_peri_probe, }, { .compatible = "mediatek,mt8183-mcucfg", .data = clk_mt8183_mcu_probe, diff --git a/include/dt-bindings/clock/mt8183-clk.h b/include/dt-bindings/clock/mt8183-clk.h index 0046506eb24c..a7b470b0ec8a 100644 --- a/include/dt-bindings/clock/mt8183-clk.h +++ b/include/dt-bindings/clock/mt8183-clk.h @@ -284,6 +284,10 @@ #define CLK_INFRA_FBIST2FPC 100 #define CLK_INFRA_NR_CLK 101 +/* PERICFG */ +#define CLK_PERI_AXI 0 +#define CLK_PERI_NR_CLK 1 + /* MFGCFG */ #define CLK_MFG_BG3D 0 #define CLK_MFG_NR_CLK 1 -- 2.23.0