Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1126284pxb; Sat, 16 Oct 2021 02:22:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1g8D9drJ0a5uZTYL5NTALyidyRllHWLOqATGJvq7kz0NWh2/7tVgn1EuTPmyW/CqnZqwQ X-Received: by 2002:a05:6a00:1a15:b0:44d:a80:a194 with SMTP id g21-20020a056a001a1500b0044d0a80a194mr16449692pfv.78.1634376129428; Sat, 16 Oct 2021 02:22:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634376129; cv=none; d=google.com; s=arc-20160816; b=wO4VAAN6RUMm9zlHVd7zWas75hR0Xfq6Osjbal9BUXzWXDOheOiv5lriwTNurTe4xt uIhDbVPkyEXxsxyUgiyW6wQg3WUyNwsHco5ctbSCrESNaM6AIwP/OlYmpyxHYF0kEGUA hRu0ZnbmROKJW/XagY2opbr5E30MnpL/NxuoUCmk1ZC3H2XC8+GeTtY6PlxHpk3zEGns aTedKzg5grVu8E4FeHURLYElAKEcucoHnLkaAlsG0xeQzUGnInen0scCH8i6dk8D1FNT QTiJeEwh7FyPlKWpVx5hAz3qxg8hcKa7XjyBBrsR18PYxkPskSKmfpcUX5a5StC4CvNm oxVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=Ij/bA40N6WJrkzm+czKQP39lZXJLe7m+PkXj+e0IYyo=; b=R0FQRFDJoNYFIyultNg5bIsV/UhK7Fyj69P6tdl7xiwGq4PxtzYigGAD/CEU2M8J/e qOjdHQon2ZpRvANwZyAXCz8c4m3wQ900qsVU3ib6xJi3WZjVLyzXnn/IoFJc5juhNyin 3n3OT4dlNsZ44NhK9l4bLLtf+87JhNGToOLvvQxwiqBeD0Q/Gnfixd6aB87qtd9stC2j YohTfHjqVOncW0qdSt+SV5SDY6MEFuhAg0VqC2h9hc6aoGZhynTtS7pGzxgoMi2K/nFc Z11t9Zue/jRj7SJrCmZ7/Z/0nrk+VJtbG40slEZVewncpWOl7EOffJjjm5t5VGeFz4bC aCNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t23si11186354pgi.35.2021.10.16.02.21.57; Sat, 16 Oct 2021 02:22:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239845AbhJONlC (ORCPT + 99 others); Fri, 15 Oct 2021 09:41:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239838AbhJONk5 (ORCPT ); Fri, 15 Oct 2021 09:40:57 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A89DC061767; Fri, 15 Oct 2021 06:38:51 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 92E011F4536E Subject: Re: [PATCH v4 03/13] memory: mtk-smi: Use clk_bulk clock ops To: Yong Wu , Krzysztof Kozlowski , Rob Herring , Matthias Brugger Cc: Krzysztof Kozlowski , Joerg Roedel , Will Deacon , Robin Murphy , Tomasz Figa , linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, youlin.pei@mediatek.com, anan.sun@mediatek.com, ming-fan.chen@mediatek.com, yi.kuo@mediatek.com, anthony.huang@mediatek.com, Ikjoon Jang References: <20210914113703.31466-1-yong.wu@mediatek.com> <20210914113703.31466-4-yong.wu@mediatek.com> From: AngeloGioacchino Del Regno Message-ID: Date: Fri, 15 Oct 2021 15:38:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210914113703.31466-4-yong.wu@mediatek.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Use clk_bulk interface instead of the orginal one to simplify the code. > > For SMI larbs: Require apb/smi clocks while gals is optional. > For SMI common: Require apb/smi/gals0/gal1 in has_gals case. Otherwise, > also only require apb/smi, No optional clk here. > > About the "has_gals" flag, for smi larbs, the gals clock also may be > optional even this platform support it. thus it always use > *_bulk_get_optional, then the flag has_gals is unnecessary. Remove it. > The smi_common's has_gals still keep it. > > Also remove clk fail logs since bulk interface already output fail log. > > Signed-off-by: Yong Wu Hello Yong, thanks for the patch! However, I have an improvement to point out: > --- > drivers/memory/mtk-smi.c | 143 +++++++++++++++------------------------ > 1 file changed, 55 insertions(+), 88 deletions(-) > > diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c > index c5fb51f73b34..f91eaf5c3ab0 100644 > --- a/drivers/memory/mtk-smi.c > +++ b/drivers/memory/mtk-smi.c > @@ -60,6 +60,20 @@ enum mtk_smi_gen { > MTK_SMI_GEN2 > }; > > +#define MTK_SMI_CLK_NR_MAX 4 This refers to mtk_smi_common_clks[] and should be probably moved after that. In any case, I don't think that there's any need to manually define this as 4, as you can simply use the macro ARRAY_SIZE(mtk_smi_common_clks). Using that will make you able to not update this definition everytime an update occurs to the mtk_smi_common_clks array. > + > +/* larbs: Require apb/smi clocks while gals is optional. */ > +static const char * const mtk_smi_larb_clks[] = {"apb", "smi", "gals"}; > +#define MTK_SMI_LARB_REQ_CLK_NR 2 > +#define MTK_SMI_LARB_OPT_CLK_NR 1 > + > +/* > + * common: Require these four clocks in has_gals case. Otherwise, only apb/smi are required. > + */ > +static const char * const mtk_smi_common_clks[] = {"apb", "smi", "gals0", "gals1"}; > +#define MTK_SMI_COM_REQ_CLK_NR 2 > +#define MTK_SMI_COM_GALS_REQ_CLK_NR MTK_SMI_CLK_NR_MAX > + Apart from that, Acked-By: AngeloGioacchino Del Regno Regards, - Angelo