Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3275485imm; Tue, 17 Jul 2018 01:55:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfEYzRkKm92CUcDJhLUVMpjoNfixhTmHJNZBbSXsaxwLUnhnhT7G19ayRSMmfiSRofBanh3 X-Received: by 2002:a17:902:b717:: with SMTP id d23-v6mr760102pls.105.1531817727323; Tue, 17 Jul 2018 01:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531817727; cv=none; d=google.com; s=arc-20160816; b=sMqciPahyFRP2vdCWMpX4wrQJe9EUuYsQjw+BOmbNN1WPNGwur8edaSdB3Q7me1VO4 Y5rL5aSc7tdQ9W3FZPuZJqIXEYUNnhU5C3G3iM97+kCA7G3yWIA+ivAm27IvlWH+b1aM IJm1cO0oiAq6fyZ1VzZZqKduk1hj/hpwnCBasvSbim5sAu08eZDK04G7XKGSd5mhb/ek Ac3vaK7OsemsBjLaYsAIEoUkjKGbcarwsvti82nJwQ8VxNYkHqNgZPyi2pI5g09oDB7U Pohks9hiyKrNVVN21c2M26OT4CHtRaOCSS27hj+fKKx0Wq+xIGOkLvQd0zOlv1gd39j/ FHAA== 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:arc-authentication-results; bh=/c0krXNro0klrs8O0oN1e1tZjFxov5sO/vZOU2Skp8k=; b=YtfGI0T3dJulL9Q/gcXFPgpL/O0lSa9UQnatDudsn38rk6GKL4FrXEYt4IcXFhdCY+ PZguO+elYQvqeM38Q9vrWBH+M+1h7A8J36CljchEm9fCRCyhxPAFRi33CBA3kIfFi/Pn 7gsyzuIqAdHC2K3wfCmnylJToV9dMquhgdeF6Bss91t/eRhBFiXtAq94I1lilKIfihaO I/acUaTIFb+bHoO5hDOhUb9OP+KoGdhuo77x9IqZAkHIBoBZnYET40H61CI9oCJ9Szzz t+0d8IU2sq0NjtEzUHKVVZO/Y6yKLtU4wWj5e1DoQTZ8LYVm7SmJM7zDyqJBpUveN+EY vlXA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c25-v6si425254pgm.523.2018.07.17.01.55.12; Tue, 17 Jul 2018 01:55:27 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730880AbeGQJZd (ORCPT + 99 others); Tue, 17 Jul 2018 05:25:33 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:15704 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729683AbeGQJYW (ORCPT ); Tue, 17 Jul 2018 05:24:22 -0400 X-UUID: a4382f0fa28a47559fabaf11c8cd02ca-20180717 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1643907888; Tue, 17 Jul 2018 16:52:36 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs03n2.mediatek.inc (172.21.101.182) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Tue, 17 Jul 2018 16:52:34 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Tue, 17 Jul 2018 16:52:34 +0800 From: Mars Cheng To: Matthias Brugger , Rob Herring , Marc Zyngier , Ryder Lee , Stephen Boyd , Sean Wang CC: CC Hwang , Loda Chou , , , , , , , , Mars Cheng , Owen Chen Subject: [PATCH v5 04/11] soc: mediatek: add MT6765 scpsys support Date: Tue, 17 Jul 2018 16:52:25 +0800 Message-ID: <1531817552-17221-5-git-send-email-mars.cheng@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1531817552-17221-1-git-send-email-mars.cheng@mediatek.com> References: <1531817552-17221-1-git-send-email-mars.cheng@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds scpsys support for MT6765 Signed-off-by: Mars Cheng Signed-off-by: Owen Chen --- drivers/soc/mediatek/mtk-scpsys.c | 88 ++++++++++++++++++++++++++++++ include/dt-bindings/power/mt6765-power.h | 14 +++++ 2 files changed, 102 insertions(+) create mode 100644 include/dt-bindings/power/mt6765-power.h diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c index 5b24bb4..4bb6c7a 100644 --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -680,6 +681,79 @@ static void mtk_register_power_domains(struct platform_device *pdev, }; /* + * MT6765 power domain support + */ +#define SPM_PWR_STATUS_MT6765 0x0180 +#define SPM_PWR_STATUS_2ND_MT6765 0x0184 + +static const struct scp_domain_data scp_domain_data_mt6765[] = { + [MT6765_POWER_DOMAIN_VCODEC] = { + .name = "vcodec", + .sta_mask = BIT(26), + .ctl_offs = 0x300, + .sram_pdn_bits = GENMASK(8, 8), + .sram_pdn_ack_bits = GENMASK(12, 12), + }, + [MT6765_POWER_DOMAIN_ISP] = { + .name = "isp", + .sta_mask = BIT(5), + .ctl_offs = 0x308, + .sram_pdn_bits = GENMASK(8, 8), + .sram_pdn_ack_bits = GENMASK(12, 12), + }, + [MT6765_POWER_DOMAIN_MM] = { + .name = "mm", + .sta_mask = BIT(3), + .ctl_offs = 0x30C, + .sram_pdn_bits = GENMASK(8, 8), + .sram_pdn_ack_bits = GENMASK(12, 12), + }, + [MT6765_POWER_DOMAIN_CONN] = { + .name = "conn", + .sta_mask = BIT(1), + .ctl_offs = 0x32C, + .sram_pdn_bits = 0, + .sram_pdn_ack_bits = 0, + }, + [MT6765_POWER_DOMAIN_MFG_ASYNC] = { + .name = "mfg_async", + .sta_mask = BIT(23), + .ctl_offs = 0x334, + .sram_pdn_bits = 0, + .sram_pdn_ack_bits = 0, + }, + [MT6765_POWER_DOMAIN_MFG] = { + .name = "mfg", + .sta_mask = BIT(4), + .ctl_offs = 0x338, + .sram_pdn_bits = GENMASK(8, 8), + .sram_pdn_ack_bits = GENMASK(12, 12), + }, + [MT6765_POWER_DOMAIN_CAM] = { + .name = "cam", + .sta_mask = BIT(25), + .ctl_offs = 0x344, + .sram_pdn_bits = GENMASK(8, 9), + .sram_pdn_ack_bits = GENMASK(12, 13), + }, + [MT6765_POWER_DOMAIN_MFG_CORE0] = { + .name = "mfg_core0", + .sta_mask = BIT(7), + .ctl_offs = 0x34C, + .sram_pdn_bits = GENMASK(8, 8), + .sram_pdn_ack_bits = GENMASK(12, 12), + }, +}; + +static const struct scp_subdomain scp_subdomain_mt6765[] = { + {MT6765_POWER_DOMAIN_MM, MT6765_POWER_DOMAIN_CAM}, + {MT6765_POWER_DOMAIN_MM, MT6765_POWER_DOMAIN_ISP}, + {MT6765_POWER_DOMAIN_MM, MT6765_POWER_DOMAIN_VCODEC}, + {MT6765_POWER_DOMAIN_MFG_ASYNC, MT6765_POWER_DOMAIN_MFG}, + {MT6765_POWER_DOMAIN_MFG, MT6765_POWER_DOMAIN_MFG_CORE0}, +}; + +/* * MT6797 power domain support */ @@ -962,6 +1036,17 @@ static void mtk_register_power_domains(struct platform_device *pdev, .bus_prot_reg_update = false, }; +static const struct scp_soc_data mt6765_data = { + .domains = scp_domain_data_mt6765, + .num_domains = ARRAY_SIZE(scp_domain_data_mt6765), + .subdomains = scp_subdomain_mt6765, + .num_subdomains = ARRAY_SIZE(scp_subdomain_mt6765), + .regs = { + .pwr_sta_offs = SPM_PWR_STATUS_MT6765, + .pwr_sta2nd_offs = SPM_PWR_STATUS_2ND_MT6765, + }, +}; + static const struct scp_soc_data mt6797_data = { .domains = scp_domain_data_mt6797, .num_domains = ARRAY_SIZE(scp_domain_data_mt6797), @@ -1018,6 +1103,9 @@ static void mtk_register_power_domains(struct platform_device *pdev, .compatible = "mediatek,mt2712-scpsys", .data = &mt2712_data, }, { + .compatible = "mediatek,mt6765-scpsys", + .data = &mt6765_data, + }, { .compatible = "mediatek,mt6797-scpsys", .data = &mt6797_data, }, { diff --git a/include/dt-bindings/power/mt6765-power.h b/include/dt-bindings/power/mt6765-power.h new file mode 100644 index 0000000..d347b4e --- /dev/null +++ b/include/dt-bindings/power/mt6765-power.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _DT_BINDINGS_POWER_MT6765_POWER_H +#define _DT_BINDINGS_POWER_MT6765_POWER_H + +#define MT6765_POWER_DOMAIN_CONN 0 +#define MT6765_POWER_DOMAIN_MM 1 +#define MT6765_POWER_DOMAIN_MFG_ASYNC 2 +#define MT6765_POWER_DOMAIN_ISP 3 +#define MT6765_POWER_DOMAIN_MFG 4 +#define MT6765_POWER_DOMAIN_MFG_CORE0 5 +#define MT6765_POWER_DOMAIN_CAM 6 +#define MT6765_POWER_DOMAIN_VCODEC 7 + +#endif /* _DT_BINDINGS_POWER_MT6765_POWER_H */ -- 1.7.9.5