Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2967534pxb; Mon, 17 Jan 2022 09:09:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyXbgA3ErUlGV1QCTglbucEIQy7WUNvZuruhRq/J2mh22ttWafHFP/nXkDdXaLVo2qWS/w X-Received: by 2002:a17:90b:38d2:: with SMTP id nn18mr6312537pjb.101.1642439358606; Mon, 17 Jan 2022 09:09:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642439358; cv=none; d=google.com; s=arc-20160816; b=xSTqVyLOx3nmgn9UqEmH+D7oRU9rSp7sWFXop6JSNA4Au0V0vr7zwy+tw/lfMQc3+2 ASI9OZ4tx+lpTNPeZBhr0rfuW2YzYmZ9jt0/X1+oNoytPIO9514bhFyiOCJbsPmW9Rz8 TEWtMKlQAlgRJdkhwsr+KWm7OJLjjP3yDTstbWc/rbPgGQEawuezgBb1/grF/Y9wHOCU X87seGoRMx6Nf4B+VNgJ1sMlaQ7lHl54I1gBIZj9Zc5q7CLO4PBvuNJUrgN6io/oASeT 0TRhwudFJifXdhgBSATzvITke0XcwNV69cuJG46itU2nPf3rASizodStOD13yL5rbuIi TGhQ== 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:dkim-signature; bh=XqtwsfBl4h0cva0psaE0RnQTgwo9up9m78qmVwb9bI4=; b=xmyw0S5mDNC6yl9bpZRqgPgL62kmN4qkszgfsOC2aTVA4NTSIXj/OUkFMW1vLJBNf5 VTysvtRb1dRfWR2QSmjo+/PXu8lk37kQ7CNkMyQQDoUUyhs4sXjXQv96AYz1ZgagWQ67 aBhIY/wvxIgr+/IF0s3w7VUHQsxxyjnWg1uUNEBO8ju4K0H3Y384RUj5robGjFQseltZ KaTx8U5MNca2CkLZ5lysQ9gt5wrrt+ym+EAxOghVEImRFLGUp7mA0/8MVqT1tFFy5GpP GyNglxeanhlKxHfnJrCZEcrskA0lpljJFUYthyJh4qdN+t1AqAyfdh1tbHa9KM7Zxw1W 4N2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Q6wzCvc9; 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=pass (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 ch22si16835033pjb.170.2022.01.17.09.09.06; Mon, 17 Jan 2022 09:09:18 -0800 (PST) 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; dkim=pass header.i=@collabora.com header.s=mail header.b=Q6wzCvc9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238665AbiAQKiW (ORCPT + 99 others); Mon, 17 Jan 2022 05:38:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235751AbiAQKiU (ORCPT ); Mon, 17 Jan 2022 05:38:20 -0500 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 38579C06161C; Mon, 17 Jan 2022 02:38:20 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id AA09C1F437BF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1642415898; bh=jqiDzA7U4dHZTbnAE4kudgIyEogo59g2smc2wtyjBCQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Q6wzCvc9qE0otYn2eiO7z1qOqwYBxHD2hj+a9xD+ZDbEhnoPnsww9q5sCVT0Ri90b +awd9SB778AgeVBUFaDcC2d0vYHLTDNlR6B3P2Qs40ImprpGrZj8dfJigFwyVREDlB g+YfVxD6EYxW0Q5gDY/5uEiedsqHf6Tg+ke3OIAPMgmjecb6RHfPaUpW/BjD0FrJXH c3nEvZFMef538HdXkXk6pHUNI0NdpJsV6hl8eGnrD32iqbvqg+2UjZgGn90oO/QuXf iX2yVyXjgpyM+Z8D6uzegZMrImvaYVEwywN/L9gHGyuYDgS96jvjZKHOkElscpyKyC wR3X2XAYjOkoQ== Subject: Re: [PATCH net-next v12 3/7] stmmac: dwmac-mediatek: re-arrange clock setting To: Biao Huang , davem@davemloft.net, Jakub Kicinski , Rob Herring Cc: Matthias Brugger , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, srv_heupstream@mediatek.com, macpaul.lin@mediatek.com, dkirjanov@suse.de References: <20220117070706.17853-1-biao.huang@mediatek.com> <20220117070706.17853-4-biao.huang@mediatek.com> From: AngeloGioacchino Del Regno Message-ID: <2c62f337-5eb4-e525-7e3a-289435315c09@collabora.com> Date: Mon, 17 Jan 2022 11:38:14 +0100 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: <20220117070706.17853-4-biao.huang@mediatek.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Il 17/01/22 08:07, Biao Huang ha scritto: > The rmii_internal clock is needed only when PHY > interface is RMII, and reference clock is from MAC. > > Re-arrange the clock setting as following: > 1. the optional "rmii_internal" is controlled by devm_clk_get(), > 2. other clocks still be configured by devm_clk_bulk_get(). > > Signed-off-by: Biao Huang > --- > .../ethernet/stmicro/stmmac/dwmac-mediatek.c | 72 +++++++++++++------ > 1 file changed, 49 insertions(+), 23 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c > index 8747aa4403e8..2678d2deb26a 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c > @@ -49,14 +49,15 @@ struct mac_delay_struct { > struct mediatek_dwmac_plat_data { > const struct mediatek_dwmac_variant *variant; > struct mac_delay_struct mac_delay; > + struct clk *rmii_internal_clk; > struct clk_bulk_data *clks; > - struct device_node *np; > struct regmap *peri_regmap; > + struct device_node *np; > struct device *dev; > phy_interface_t phy_mode; > - int num_clks_to_config; > bool rmii_clk_from_mac; > bool rmii_rxc; > + int num_clks; I don't see any need to get a num_clks here, at this point: since all functions reading this are getting passed a pointer to this entire structure, you can simply always access plat->variant->num_clks. Please, drop the addition of num_clks in this struct. Regards, Angelo