Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp578286ybl; Wed, 28 Aug 2019 02:13:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLV95zT0ZVCWAIO9+mOoWRx/d2ZoRqh1jaSC3CnM+gtfmQ49r6qv7Gvft+dqaRoeT3aXNn X-Received: by 2002:a63:ff0c:: with SMTP id k12mr2468216pgi.186.1566983612237; Wed, 28 Aug 2019 02:13:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566983612; cv=none; d=google.com; s=arc-20160816; b=wfnKPYP2iln0Nl1R5WH4+9DkWhkQ3hkcpU0AWSUBPrOPt1xbkB/D8ayxU8lSFQFjRw c4eLmoyU8hyYQkj6tToomeIEb7wzRYfmr6oE51UXEBq+v9KKoGJ/bKse8Xdqx3WliyJ7 w70bvB2KjWQF1G9b/hqRSYj18pRbY8sJ2ufVxoLhi/QiahBWco8wdbiUibR4KecpoOwt PvzE9qWD6kti6+VODOw8LNPgBirgzck1bjiKDUR7ZhQvjjdDfUwT3bEz2Z5NB+HOlHUB uTA7S5/rGWEkay3Cl99pnnQGzKngzH66ESVxba5+3v2qTbxzKkiN+ZosoIm3KpJPBDZa v9GQ== 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=aZ1fHXq1kvheyvXlXS8cnOv/fGIxYFs0cl+V/exPjRw=; b=vChg7w1nIph+Nyw+qB6xyjMEUxu+RvOeYxR5kakOcZYft4USScgRwjMDro4aVRx7GP qIrfOb2GGVxvAwyWcGY2/7vEcACJ725k9uHiGy5+Ba06ZJdNaKU/NkH9tidFxFXSPgkw PX2sbgHPD99CBkSEorPb4yKRwYWPAW3nGxKgSKzh/fp2kWyT1nGLI01h30Xwa2hM1ffp WKwheeEtiMyOW+BRHkMpGZtSeyybMKlj0EsWQepiOFzNXdevWpqWQCRWP7JDYgscp/PB Ui9WODxRox/j8CwZ42KpEpGu5Bmr7KPqqVqLGW0xJuPhjNEaCAjbZaDl9WsFyL05xkcB JeLQ== 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 o61si1534904pld.132.2019.08.28.02.13.16; Wed, 28 Aug 2019 02:13:32 -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 S1726877AbfH1JMO (ORCPT + 99 others); Wed, 28 Aug 2019 05:12:14 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:15642 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726829AbfH1JML (ORCPT ); Wed, 28 Aug 2019 05:12:11 -0400 X-UUID: 2ae563997998473bb4c35175723d4890-20190828 X-UUID: 2ae563997998473bb4c35175723d4890-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 1484903483; Wed, 28 Aug 2019 17:12:05 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs02n2.mediatek.inc (172.21.101.101) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 28 Aug 2019 17:12:05 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 28 Aug 2019 17:12:05 +0800 From: Weiyi Lu To: Nicolas Boichat , Matthias Brugger , Rob Herring CC: James Liao , Fan Chen , , , , , Weiyi Lu , Yong Wu Subject: [PATCH v7 08/13] soc: mediatek: Add basic_clk_id to scp_power_data Date: Wed, 28 Aug 2019 17:11:41 +0800 Message-ID: <1566983506-26598-9-git-send-email-weiyi.lu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1566983506-26598-1-git-send-email-weiyi.lu@mediatek.com> References: <1566983506-26598-1-git-send-email-weiyi.lu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: E6B5C96125D7620786185AF5D1FF6231904B9FC270085098950D6576F90139692000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Try to stop extending the clk_id or clk_names if there are more and more new BASIC clocks. To get its own clocks by the basic_clk_id of each power domain. Signed-off-by: Weiyi Lu --- drivers/soc/mediatek/mtk-scpsys.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c index fb2b027..d31e1a4 100644 --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -117,6 +117,8 @@ enum clk_id { * @sram_pdn_ack_bits: The mask for sram power control acked bits. * @bus_prot_mask: The mask for single step bus protection. * @clk_id: The basic clocks required by this power domain. + * @basic_clk_id: provide the same purpose with field "clk_id" + * by declaring basic clock prefix name rather than clk_id. * @caps: The flag for active wake-up action. */ struct scp_domain_data { @@ -127,6 +129,7 @@ struct scp_domain_data { u32 sram_pdn_ack_bits; u32 bus_prot_mask; enum clk_id clk_id[MAX_CLKS]; + const char *basic_clk_id[MAX_CLKS]; u8 caps; }; @@ -490,16 +493,26 @@ static struct scp *init_scp(struct platform_device *pdev, scpd->data = data; - for (j = 0; j < MAX_CLKS && data->clk_id[j]; j++) { - struct clk *c = clk[data->clk_id[j]]; + if (data->clk_id[0]) { + WARN_ON(data->basic_clk_id[0]); - if (IS_ERR(c)) { - dev_err(&pdev->dev, "%s: clk unavailable\n", - data->name); - return ERR_CAST(c); - } + for (j = 0; j < MAX_CLKS && data->clk_id[j]; j++) { + struct clk *c = clk[data->clk_id[j]]; + + if (IS_ERR(c)) { + dev_err(&pdev->dev, + "%s: clk unavailable\n", + data->name); + return ERR_CAST(c); + } - scpd->clk[j] = c; + scpd->clk[j] = c; + } + } else if (data->basic_clk_id[0]) { + for (j = 0; j < MAX_CLKS && + data->basic_clk_id[j]; j++) + scpd->clk[j] = devm_clk_get(&pdev->dev, + data->basic_clk_id[j]); } genpd->name = data->name; -- 1.8.1.1.dirty