Received: by 10.223.176.5 with SMTP id f5csp2871097wra; Thu, 1 Feb 2018 07:20:19 -0800 (PST) X-Google-Smtp-Source: AH8x227g1J4x6TDIW6MtwX4/wA729eyaUBDivflFoxTE0Uq1h3JBuRZGHuoyJRSlIaBaHw8wfrN2 X-Received: by 10.99.55.65 with SMTP id g1mr20614245pgn.284.1517498418973; Thu, 01 Feb 2018 07:20:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517498418; cv=none; d=google.com; s=arc-20160816; b=M4/TaaFxjdzxif40qPzmxgRBsmOQTyUv6VH0GwoQ8WShWvGbmBf5LtXl1ocntCgf3/ rVqBQdSE+3L8nMCKJ26YXucRrDRygsrctAymXkSKmUA+ruTU19wPnOOoOGnCvDBgWwyD 5JeNIcDlvJgcBN4pim+5kLgEPigMTSRxg3KIVJei2jdXZ2KOIi8ckQxdorDC4i6bzc53 nBk9L4kxg7aSClanAWVS6nsNo4DkHsCYk7IY2PpW0yLLnVNnqUu4A+yY7bjGU9Tk3fkA OirOeftfmJogehmoDLTiYntdcoEkR24ub45G/Xjfrt5Jpk2/DcHy2pVJTTDwyWIy7csX CJhg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=R67SrO3LPHtmV3KrqhXI7o2HsN/fQO+I+AR5ILmBko4=; b=ZbqRBe0jckte4hIu5eXjMF6lV3vFbvWnyABJxP23tPCasqBeqrROpS44kFh0GULVNd ZmeRfLExhK5Amf9YYwfpip/GBf/vKJehxKRqzGuJw+poB+fe2vB6YT/f4qSq+pqY9qnW 2mffnTBEg5YR1zMlUEQZiZLIHLxPJWpxbHYoYQKHH8eqcq6KIFQZZguViowVToh28mIe 1U156FcwwJHDksd2dUtpCVtXxW2hE4QTaQqVvPhHGFFVO7lgyYgF1dD+IQtQhayBEM04 Zhc51gCTD8+tSDoedhLO/XTYClXqwIXo2KWDM5pm0CGi8G1ygvUKPNr1k95Y7gp7C6Z5 B2qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=V22gsCOY; 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=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f15si5074510pgt.312.2018.02.01.07.20.03; Thu, 01 Feb 2018 07:20:18 -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=@gmail.com header.s=20161025 header.b=V22gsCOY; 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=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752497AbeBAPTX (ORCPT + 99 others); Thu, 1 Feb 2018 10:19:23 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:50541 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752003AbeBAPTP (ORCPT ); Thu, 1 Feb 2018 10:19:15 -0500 Received: by mail-wm0-f65.google.com with SMTP id f71so6632907wmf.0; Thu, 01 Feb 2018 07:19:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=R67SrO3LPHtmV3KrqhXI7o2HsN/fQO+I+AR5ILmBko4=; b=V22gsCOYXagJNTxGKLMJX7OLAY2opgaL7MypQaypfUFWk9X9ELnyj+kJ+xq2dL3d86 5ddgjb5boltiJx3M4TROPrKPNx0f+BxVA3aWG7/J64BpOK7XvDtOwBb02FReHbjbpJdG NuxudQJOT5vWl3H8ezO14o/KGXLpaEmU1pADyExsYqMUWMBhi7+MkBlwZAIXQoRuVx3F u5T3COtz1gQMgVwmxncKhTO9ppM75Opb3GRNZ9oxkokhoYM7lwPOZLT0M8taSnKTVSbk wpuPhOGhRigl73F0sPTc1gRUipqEHXCUwAEGeFEHFMQrPhckF+/ODlzKYBiWlpSLKRu9 2KhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=R67SrO3LPHtmV3KrqhXI7o2HsN/fQO+I+AR5ILmBko4=; b=W1IU7b4cIy0QHXz2w24eO9t88cDFbXJPpXLelnEKPLfPGAXrIz9K0BsmwR6a3PN35u Vb7RAICPzS4IIOy3SOZGhocSXtCrTOq7TaLnnN3GYjVI6MaNUpBEJYZb2g1QHeYMjX91 zurlABaJkwmMUjta/ToNScMcX7ua1BzXJynqH9mR9alhT51S26ObGLfyRjyf2gZM9kPJ Bj1cDa7/ANJQhZwTp7pRu99rakE2Bd2NJFtyt4xF9OKoVycgv9tk+vgbLyqopeYdYnV6 ZHijzxZ8WvrlghIZx1lvVxTBhhIKydZZOVkQixjQY3u3c+LvuFq+6givGMrd+GFPWvkX L6zA== X-Gm-Message-State: AKwxyteV1wF9Z6VsP+a9Y7gB1UL4NVCdfLvmungxyPVFjhVZSb0xQdeP y7gy7sPHBejAmhRVTxtaIvC+8ISy X-Received: by 10.28.188.131 with SMTP id m125mr29410714wmf.39.1517498353699; Thu, 01 Feb 2018 07:19:13 -0800 (PST) Received: from ziggy.stardust ([93.176.153.129]) by smtp.gmail.com with ESMTPSA id e15sm113900wmh.39.2018.02.01.07.19.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Feb 2018 07:19:13 -0800 (PST) Subject: Re: [PATCH 2/2] soc: mediatek: add SCPSYS power domain driver for MediaTek MT7623A SoC To: sean.wang@mediatek.com, robh+dt@kernel.org, rjw@rjwysocki.net, khilman@baylibre.com Cc: ulf.hansson@linaro.org, devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <975fb80e1cdbe7f6d4a1d04fd3a2a21b619a193d.1517479588.git.sean.wang@mediatek.com> From: Matthias Brugger Message-ID: Date: Thu, 1 Feb 2018 16:19:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/01/2018 11:12 AM, sean.wang@mediatek.com wrote: > From: Sean Wang > > Add SCPSYS power domain driver for MT7623A SoC. The MT7623A's power > domains are the subset of MT7623 SoC's ones. As MT7623 SoC has full > features whereas MT7623A is being designed just for router applications. > Thus, MT7623A doesn't include those power domains multimedia function > belongs to. In order to avoid certain errors undoubtedly happening at > registering those power domains on MT7623A SoC using the existing MT7623 > SCPSYS driver, it's required to define another setup specifically for > MT7623A SoC. Also, use a meaningful definition for bus_prot_mask instead > of just hardcoded for it. Also is nearly always a indicator to put it in a different patch. Could you please do so? Otherwise the series look good. Regards, Matthias > > Signed-off-by: Sean Wang > --- > drivers/soc/mediatek/mtk-scpsys.c | 60 +++++++++++++++++++++++++++++-- > include/dt-bindings/power/mt7623a-power.h | 10 ++++++ > include/linux/soc/mediatek/infracfg.h | 4 +++ > 3 files changed, 72 insertions(+), 2 deletions(-) > create mode 100644 include/dt-bindings/power/mt7623a-power.h > > diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c > index 435ce5e..fc55faa 100644 > --- a/drivers/soc/mediatek/mtk-scpsys.c > +++ b/drivers/soc/mediatek/mtk-scpsys.c > @@ -24,6 +24,7 @@ > #include > #include > #include > +#include > #include > > #define SPM_VDE_PWR_CON 0x0210 > @@ -518,7 +519,8 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = { > .name = "conn", > .sta_mask = PWR_STATUS_CONN, > .ctl_offs = SPM_CONN_PWR_CON, > - .bus_prot_mask = 0x0104, > + .bus_prot_mask = MT2701_TOP_AXI_PROT_EN_CONN_M | > + MT2701_TOP_AXI_PROT_EN_CONN_S, > .clk_id = {CLK_NONE}, > .active_wakeup = true, > }, > @@ -528,7 +530,7 @@ static const struct scp_domain_data scp_domain_data_mt2701[] = { > .ctl_offs = SPM_DIS_PWR_CON, > .sram_pdn_bits = GENMASK(11, 8), > .clk_id = {CLK_MM}, > - .bus_prot_mask = 0x0002, > + .bus_prot_mask = MT2701_TOP_AXI_PROT_EN_MM_M0, > .active_wakeup = true, > }, > [MT2701_POWER_DOMAIN_MFG] = { > @@ -794,6 +796,47 @@ static const struct scp_domain_data scp_domain_data_mt7622[] = { > }; > > /* > + * MT7623A power domain support > + */ > + > +static const struct scp_domain_data scp_domain_data_mt7623a[] = { > + [MT7623A_POWER_DOMAIN_CONN] = { > + .name = "conn", > + .sta_mask = PWR_STATUS_CONN, > + .ctl_offs = SPM_CONN_PWR_CON, > + .bus_prot_mask = MT2701_TOP_AXI_PROT_EN_CONN_M | > + MT2701_TOP_AXI_PROT_EN_CONN_S, > + .clk_id = {CLK_NONE}, > + .active_wakeup = true, > + }, > + [MT7623A_POWER_DOMAIN_ETH] = { > + .name = "eth", > + .sta_mask = PWR_STATUS_ETH, > + .ctl_offs = SPM_ETH_PWR_CON, > + .sram_pdn_bits = GENMASK(11, 8), > + .sram_pdn_ack_bits = GENMASK(15, 12), > + .clk_id = {CLK_ETHIF}, > + .active_wakeup = true, > + }, > + [MT7623A_POWER_DOMAIN_HIF] = { > + .name = "hif", > + .sta_mask = PWR_STATUS_HIF, > + .ctl_offs = SPM_HIF_PWR_CON, > + .sram_pdn_bits = GENMASK(11, 8), > + .sram_pdn_ack_bits = GENMASK(15, 12), > + .clk_id = {CLK_ETHIF}, > + .active_wakeup = true, > + }, > + [MT7623A_POWER_DOMAIN_IFR_MSC] = { > + .name = "ifr_msc", > + .sta_mask = PWR_STATUS_IFR_MSC, > + .ctl_offs = SPM_IFR_MSC_PWR_CON, > + .clk_id = {CLK_NONE}, > + .active_wakeup = true, > + }, > +}; > + > +/* > * MT8173 power domain support > */ > > @@ -934,6 +977,16 @@ static const struct scp_soc_data mt7622_data = { > .bus_prot_reg_update = true, > }; > > +static const struct scp_soc_data mt7623a_data = { > + .domains = scp_domain_data_mt7623a, > + .num_domains = ARRAY_SIZE(scp_domain_data_mt7623a), > + .regs = { > + .pwr_sta_offs = SPM_PWR_STATUS, > + .pwr_sta2nd_offs = SPM_PWR_STATUS_2ND > + }, > + .bus_prot_reg_update = true, > +}; > + > static const struct scp_soc_data mt8173_data = { > .domains = scp_domain_data_mt8173, > .num_domains = ARRAY_SIZE(scp_domain_data_mt8173), > @@ -964,6 +1017,9 @@ static const struct of_device_id of_scpsys_match_tbl[] = { > .compatible = "mediatek,mt7622-scpsys", > .data = &mt7622_data, > }, { > + .compatible = "mediatek,mt7623a-scpsys", > + .data = &mt7623a_data, > + }, { > .compatible = "mediatek,mt8173-scpsys", > .data = &mt8173_data, > }, { > diff --git a/include/dt-bindings/power/mt7623a-power.h b/include/dt-bindings/power/mt7623a-power.h > new file mode 100644 > index 0000000..ac15b5d > --- /dev/null > +++ b/include/dt-bindings/power/mt7623a-power.h > @@ -0,0 +1,10 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +#ifndef _DT_BINDINGS_POWER_MT7623A_POWER_H > +#define _DT_BINDINGS_POWER_MT7623A_POWER_H > + > +#define MT7623A_POWER_DOMAIN_CONN 0 > +#define MT7623A_POWER_DOMAIN_ETH 1 > +#define MT7623A_POWER_DOMAIN_HIF 2 > +#define MT7623A_POWER_DOMAIN_IFR_MSC 3 > + > +#endif /* _DT_BINDINGS_POWER_MT2701_POWER_H */ > diff --git a/include/linux/soc/mediatek/infracfg.h b/include/linux/soc/mediatek/infracfg.h > index b0a507d..fd25f01 100644 > --- a/include/linux/soc/mediatek/infracfg.h > +++ b/include/linux/soc/mediatek/infracfg.h > @@ -21,6 +21,10 @@ > #define MT8173_TOP_AXI_PROT_EN_MFG_M1 BIT(22) > #define MT8173_TOP_AXI_PROT_EN_MFG_SNOOP_OUT BIT(23) > > +#define MT2701_TOP_AXI_PROT_EN_MM_M0 BIT(1) > +#define MT2701_TOP_AXI_PROT_EN_CONN_M BIT(2) > +#define MT2701_TOP_AXI_PROT_EN_CONN_S BIT(8) > + > #define MT7622_TOP_AXI_PROT_EN_ETHSYS (BIT(3) | BIT(17)) > #define MT7622_TOP_AXI_PROT_EN_HIF0 (BIT(24) | BIT(25)) > #define MT7622_TOP_AXI_PROT_EN_HIF1 (BIT(26) | BIT(27) | \ >