Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1142739img; Tue, 19 Mar 2019 01:03:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxYLb57iMJNvlobMIjGlJYWYzv/qL8kIm6eJGrfJd8N3AIcFvVekxM3zv+vO13KDyvb0Zle X-Received: by 2002:aa7:8b93:: with SMTP id r19mr22919365pfd.163.1552982599376; Tue, 19 Mar 2019 01:03:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552982599; cv=none; d=google.com; s=arc-20160816; b=p64zwPghC0bwTuCMVqCI/qxeKN+vwNRLSdKjawVjSJGurOlxQtZlt0uFd7eonQ/rTC iKDnotkUAutqvbLT1a0aKj8/TXkBhatLlNfdJH4JrtHINowPR62ZlTxZE4b2Os86AVQY mz8fmaCx8KoLGIfDDriKJTRoyJWAi7K4aS5XwKpx7aIE/weSMuE1/IP3HtDdZh6Dgmq8 1fgj7PjhaQklaFwgBXdk/ndy7s/FZMzq1W16fVnNYyRYQEVJ+ZLzRcTodhoMaKPDdkSM +0BktsImXYZ7mkJgmT7yTQ/TMuT61M7U2doR3u6lQfJh236hWQ6DMlp2JZ1QIF3baLu0 Svxw== 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=Byele/L5TWBCd9RUT3qUeVp/0JwFRvzs2KUOVxcyQOI=; b=1AGzdtKrpYu70eQ/0XVuMRrNSzCVo1OYCsRl9oyK09FXczk7Jw+/uLPrlP8ae/Cmmg Ltn++gFJ4rsBZdTGLchXkBYQuY7rAFFaKDeuJRIXHSi2XKmG2r0r1vMkSARdWe4Zyjea vs+oA0IAVrL5HxCygwy0xWWHj0CeOHnWWAfImy5FwHh3jxOXthOscYjyhmBxKZb86T49 sAD06p7lZ4q/U7gnQLNbLV3zV/2Rur9UfKbcoKYCqxu83D+cHW4akS53ghW6pYMqLA7m O9g6bAgSdUuoinVQ+UXvxZkUMmFHO4fFpS6eF5cNeoOGXy9fw7YVNBW6MdRFHJ6eRAqS 8EBQ== 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 f8si10853156pgo.80.2019.03.19.01.03.03; Tue, 19 Mar 2019 01:03:19 -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 S1727495AbfCSICN (ORCPT + 99 others); Tue, 19 Mar 2019 04:02:13 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:2245 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727399AbfCSICK (ORCPT ); Tue, 19 Mar 2019 04:02:10 -0400 X-UUID: ad1c2b2d06364257bca3d961d68f8971-20190319 X-UUID: ad1c2b2d06364257bca3d961d68f8971-20190319 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1742679652; Tue, 19 Mar 2019 16:01:58 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs03n1.mediatek.inc (172.21.101.181) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 19 Mar 2019 16:01:57 +0800 Received: from mtkslt210.mediatek.inc (10.21.14.14) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 19 Mar 2019 16:01:57 +0800 From: Weiyi Lu To: Nicolas Boichat , Matthias Brugger , Rob Herring CC: James Liao , Fan Chen , , , , , Weiyi Lu Subject: [PATCH v5 09/14] soc: mediatek: Add basic_clk_name to scp_power_data Date: Tue, 19 Mar 2019 16:01:35 +0800 Message-ID: <20190319080140.24055-10-weiyi.lu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190319080140.24055-1-weiyi.lu@mediatek.com> References: <20190319080140.24055-1-weiyi.lu@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 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_name of each power domain. Signed-off-by: Weiyi Lu --- drivers/soc/mediatek/mtk-scpsys.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c index 6bf846cb1893..c6360de4e41e 100644 --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -118,6 +118,8 @@ static const char * const clk_names[] = { * @bus_prot_mask: The mask for single step bus protection. * @clk_id: The basic clock needs to be enabled before enabling certain * power domains. + * @basic_clk_name: 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 { @@ -128,6 +130,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_name[MAX_CLKS]; u8 caps; }; @@ -499,16 +502,24 @@ 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]) { + 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); - } + 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_name[0]) { + for (j = 0; j < MAX_CLKS && + data->basic_clk_name[j]; j++) + scpd->clk[j] = devm_clk_get(&pdev->dev, + data->basic_clk_name[j]); } genpd->name = data->name; -- 2.18.0