Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1378871ybi; Wed, 19 Jun 2019 19:40:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxI8ts0ZgUxY+ItHFN5Rj5Vz2KEL09ZIYDCyYN9upJ5AEVhR6Nh4IM08up70TfYqIVM9W/m X-Received: by 2002:a17:90a:28e4:: with SMTP id f91mr462969pjd.99.1560998423620; Wed, 19 Jun 2019 19:40:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560998423; cv=none; d=google.com; s=arc-20160816; b=mBGD00LVr8h5aeTfvjnxnWiD8KKC/EHLzoaQwAR4lS29ai9E4yu4/Xw11OhQB7qDG9 UbjegpBCihnbMQFeoPpN5uNF5YWT/K1UURX+FxwrJS8krZrp5qsoNTrw4sAqG5PztXYU 9/WgZHasVqpshGGTqYGDRkFjFxjO9xwxcwDpkknX/WJ5iCybpSMQLAr2LXT5DLgE8W0x x10UXw65qNHhzntW7MaZmhtKg7t9nakEJ5+0TQBortJ4b6P1WhUpcV/B0B3Z4wfuqMUG 1RpSPN5YtvndbXKm9YUyiQzDadbtwI0j2LIOjNd/xAk82xc9azXstLFtKbUEm0EJiMi/ B3GA== 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=IrdpBXQWJMXOCuShPMAVFUvHQGh3vq0fRZLCYVqtPRE=; b=HlNPSMk0rc9yjb4/LY/+rUw7aFGN5k7MOSjv7HyAn5GCCUrLKkGEslkTgKaAIOw8Ft VPVm2mQibLiV0WVcTUe0dyva5J0/kLkyKN5DbT4nbC3hVV29fQMFwrdUrJxiBpjHKLR5 dQfelTl2JRyQVAGLwpAxAp/dmoH52aZ/Td/7bi9jc1K4OEOGpBjsaUSiO/FpIDz0fUvV fi3yZWS2qCRrQGLWMZXqo0h6fdcZyGHGx5K6nL3y7ngM97c48XIrRN1QCMm3PolnuyKt cMTI6SnzbiInRTmvQalDF0lrHa+iTTioMoaBNt3OyHnzG5yvlS2SQaXPfWSqPtClRv0i 8OTw== 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 f69si2865065pjg.43.2019.06.19.19.40.07; Wed, 19 Jun 2019 19:40:23 -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 S1731725AbfFTCjT (ORCPT + 99 others); Wed, 19 Jun 2019 22:39:19 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:41789 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726370AbfFTCi3 (ORCPT ); Wed, 19 Jun 2019 22:38:29 -0400 X-UUID: a1cbd5c3b77c4125a388f77f01f26e61-20190620 X-UUID: a1cbd5c3b77c4125a388f77f01f26e61-20190620 Received: from mtkmrs01.mediatek.inc [(172.21.131.159)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1916497800; Thu, 20 Jun 2019 10:38:21 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 20 Jun 2019 10:38:19 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 20 Jun 2019 10:38:19 +0800 From: Weiyi Lu To: Nicolas Boichat , Matthias Brugger , Rob Herring CC: James Liao , Fan Chen , , , , , Weiyi Lu , Yong Wu Subject: [PATCH v6 09/14] soc: mediatek: Add basic_clk_id to scp_power_data Date: Thu, 20 Jun 2019 10:38:01 +0800 Message-ID: <1560998286-9189-10-git-send-email-weiyi.lu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1560998286-9189-1-git-send-email-weiyi.lu@mediatek.com> References: <1560998286-9189-1-git-send-email-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_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 178198b..4a0752e 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